Assembly Chapter 4

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

If the relative offset is encoded in a single signed byte, (a) what is the largest possible backward jump? (b) what is the largest possible forward jump?

(a) −128 (b) +127

The operand types are the same for ADD as for MOV, following these rules:

. Both operands must be the same size. • Both operands cannot be memory operands. • The instruction pointer register (IP, EIP, or RIP) cannot be a destination operand.

What will be the final value of AX? mov ax,6 mov ecx,4 L1: inc ax loop L1

10

IF intArray has TYPE = 2 and LENGTHOF = 32. Therefore, SIZEOF intArray equals ____

64

The ______ instruction adds a source operand to a destination operand

ADD

The _____ directive aligns a variable on a byte, word, doubleword, or paragraph boundary.

ALIGN

The ___ _____ flag is set when a 1 bit carries out of position 3 in the least significant byte of the destination operand.

Auxiliary Carry

The ____ _____ flag indicates a carry or borrow out of bit 3 in the destination operand. It is primarily used in binary coded decimal (BCD) arithmetic, but can be used in other contexts.

Auxiliary Carry (AC)

The ______ flag indicates unsigned integer overflow

Carry

if an instruction has an 8-bit destination operand but the instruction generates a result larger than 11111111 binary, the ____ flag is set

Carry

The Overflow, Sign, Zero, Auxiliary Carry, and Parity flags are changed according to the value of the destination operand. The INC and DEC instructions do not affect the ___________

Carry flag

When nested ____ operators are used in an array definition, LENGTHOF returns the product of the two counters

DUP

______ operand-uses a numeric or character literal expression

Immediate

There are three basic types of operands:

Immediate operand, Register operand, Memory operand

____ ______ are ideal for traversing an array.

Indirect operands

_______ is an unconditional jump to a label that is usually within the same procedure

JMP

The _______ directive lets you insert a label and give it a size attribute without allocating any storage.

LABEL

The ___________ instruction copies the low byte of the EFLAGS register into AH.

LAHF (load status flags into AH)

The _______ operator counts the number of elements in a single data declaration.

LENGTHOF

The _______ operator counts the number of elements in an array, defined by the values appearing on the same line as its label.

LENGTHOF

The ________ operator returns the number of elements in an array.

LENGTHOF

The ________instruction creates a counting loop

LOOP

____ _____order refers to the way Intel stores integers in memory. • Multi-byte integers are stored in reverse order, with the least significant byte stored at the lowest address

Little endian

The ______ instruction (move with zero-extend) copies the contents of a source operand into a destination operand and zero-extends the value to 16 or 32 bits. This instruction is only used with _____ ______

M0VZX, unsigned integers

The ____ instruction copies data from a source operand to a destination operand. Known as a data transfer instruction

MOV

The _______ instruction (move with sign-extend) copies the contents of a source operand into a destination operand and sign-extends the value to 16 or 32 bits. This instruction is only used with signed integers

MOVSX, signed integers

______ operand-references a memory location

Memory

Applying the ____ instruction to a nonzero operand always sets the Carry flag.

NEG

The ____ instruction produces an invalid result if the destination operand cannot be stored correctly

NEG

The ________ instruction reverses the sign of a number by converting the number to its two's complement

NEG (negate)

The _____ operator returns the offset of a data label. The offset represents the distance, in bytes, of the label from the beginning of the data segment

OFFSET

The _______ operator returns the distance of a variable from the beginning of its enclosing -segment.

OFFSET

The ____ flag is set when the result of a signed arithmetic operation overflows or underflows the destination operand

Overflow

The ______ flag indicates signed integer overflow.

Overflow

__________ never occurs when the signs of two addition operands are different.

Overflow

if an instruction has a 16-bit If destination operand but it generates a negative result smaller than -32,768 decimal, the ______ flag is set.

Overflow

The ______ operator lets you override an operand's default size.

PTR

You can use the _____ operator to override the declared size of an operand. This is only necessary when you're trying to access the operand using a size attribute that is different from the one assumed by the assembler.

PTR

_____ can also be used to combine elements of a smaller data type and move them into a larger operand. The CPU will automatically reverse the bytes.

PTR

_______Overrides the default type of a label (variable). Provides the flexibility to access part of a variable.

PTR

The _____ flag indicates whether or not an even number of 1 bits occurs in the least significant byte of the destination operand, immediately after an arithmetic or boolean instruction has executed.

Parity

The _______ is set when the least significant byte of the destination has an even number of 1 bits

Parity flag (PF)

______ operand-uses a named CPU register

Register

The ___________ instruction copies AH into the low byte of the EFLAGS (or RFLAGS) register.

SAHF (store AH into status flags)

The _____ operator returns a value that is equivalent to multiplying LENGTHOF by TYPE

SIZEOF

The _____ operator returns the number of bytes used by an array initializer.

SIZEOF

The _______operator returns a value that is equivalent to multiplying LENGTHOF by TYPE.

SIZEOF

The _____ instruction subtracts a source operand from a destination operand. The set of possible operands is the same as for the ADD instruction

SUB

From a mechanical point of view, the ____ flag is a copy of the destination operand's high bit

Sign

If the most significant bit (MSB) of the destination operand is set, the ______ flag is set.

Sign

The ___ flag indicates that an operation produced a negative result.

Sign

The ____ flag is set when the result of a signed arithmetic operation is negative

Sign

The ___ operator returns the size (in bytes) of an operand or of each element in an array.

TYPE

The _____ operator returns the size, in bytes, of a single element of a data declaration. .

TYPE

The _____ operator returns the size, in bytes, of a single element of a variable

TYPE

T/F MOV is very flexible in its use of operands, as long as the following rules are observed: Both operands cannot be memory operands

True

T/F MOV is very flexible in its use of operands, as long as the following rules are observed: Both operands must be the same size.

True

T/F MOV is very flexible in its use of operands, as long as the following rules are observed: The instruction pointer register (IP, EIP, or RIP) cannot be a destination operand.

True

The ________ instruction exchanges the contents of two operands

XCHG (exchange data)

The _____ flag indicates that an operation produced zero.

Zero

The ______flag is set when the result of an arithmetic operation equals zero

Zero

if an operand is subtracted from another of equal value, the _____ flag is set.

Zero

There are two notational forms:

[label + reg], label[reg]

The INC (increment) and DEC (decrement) instructions, respectively, _______________ from a register or memory operand

add 1 and subtract 1

A data declaration spans multiple lines if each line (except the last) ends with a ______. The LENGTHOF and SIZEOF operators include all lines belonging to the declaration:

comma

M0V cannot directly ___ ____ from a smaller operand to a larger one

copy data

A ___ ___ ___ copies data from a source operand to a destination operand.

data transfer instruction

Note that PTR must be used in combination with one of the standard assembler ___ ___

data types

A ___ _____ ___is an operand identifier that refers to a specific offset within the data segment.

direct memory operand

You can add a displacement to the name of a variable, creating a ____ ____ operand. This lets you access memory locations that may not have explicit labels

direct-offset

____ ____ by adding an integer constant to the name of a data label.

effective address

When adding two unsigned integers, the Carry flag is a copy of the carry out of the most significant bit of the destination operand. Intuitively, we can say CF = 1 when the sum _____ the storage size of its destination operand

exceeds

A jump outside the current procedure must be to a special type of label called a ___ _____

global label

The rules for operands in the XCHG instruction are the same as those for the MOV instruction (Section 4.1.4), except that XCHG does not accept _____ operands

immediate

An ____ _____ adds a constant to a register to generate an effective address

indexed operand

An ___ _____ holds the address of a variable, usually an array or string. It can be dereferenced (just like a pointer).

indirect operand

A subtract operation sets the Carry flag when a _____ unsigned integer is subtracted from a ____ one.

larger, smaller

You can declare a______ variable that contains the offset of another variable

pointer

MASM has no built-in ___ _____ for effective addresses.

range checking

You can ______ an indirect or indexed operand to the offset of an array element. This is done by multiplying the index by the array's TYPE:

scale

There is a very easy way to tell whether signed overflow has occurred when adding two operands. Overflow occurs when:

• Adding two positive operands generates a negative sum • Adding two negative operands generates a positive sum


Kaugnay na mga set ng pag-aaral

PHYS 101 - 2 - Three Phase Power and Control

View Set

Chapter 4: Igneous Rocks and Intrusive Activity, Chapter 5 Volcanoes and Volcanic Hazards, Chapter 6 Weathering and Soils, Chapter 7 Sedimentary Rocks, Chapter 8 Metamorphism and Metamorphic Rocks

View Set

Week 3- Infection Test Pharmacology ATI Questions (Exam 2)

View Set

MACROECONOMICS EXAM 3 CLICKER QUESTIONS

View Set