360-Assembly Lang Final
What is the sum of each pair of binary integers? a. 10101111 + 11011011 b. 10010111 + 11111111 c. 01110101 + 10101100
(a) 110001010 (b) 110010110 (c) 100100001
convert the decimal 2 to binary
0010
convert hex 0x3F7A to binary
0011 1111 0111 1010
convert the decimal 512 to binary
1000000000
convert the decimal 12 to binary
1100
convert binary 0001 0101 1001 1010 to hex
159Ah
convert the binary 0010 to Hex
2
A finite-state machine is a specific application of what type of data structure?
A directed graph.
What is a state?
A task's state consists of the contents of the processor registers, program counter, and status flags, along with references to the task's memory segments. It is the transition in which the CPU is in.
Name all the 16 bit registers:
AX, BX, CX, DX, SI, DI, BP, SP
What are the arithmetic rules for adding binary?
Binary Addition: 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 10
How do you perform two's compliment in binary?
By inverting the bits and then adding 1. 00000001 11111110 +00000001 11111111
Name all six segment registers.
CS, DS, SS, ES, FS, GS
The central processor unit (CPU) contains registers and what other basic elements?
Control Unit, Arithmetic Logic Unit, and the clock.
Why does memory access take more machine cycles than register access?
Conventional memory is outside the CPU and it responds more slowly to access requests. Registers are hard-wired inside the CPU.
The central processor unit is connected to the rest of the computer system using what three buses?
Data, Address, and Control buses.
During which stage of the instruction execution cycle is the program counter incremented?
During the fetch step.
Name all eight 32-bit general-purpose registers.
EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP
Besides the stack pointer (ESP), what other register points to variables on the stack?
EBP
In a finite-state machine diagram, what do the edges represent?
Each edge is a transition from one state to another, caused by some input.
Which two additional steps are required in the instruction execution cycle when a memory operand is used?
Fetch memory operands, store memory operands.
What are the three basic steps in the instruction execution cycle?
Fetch, decode, execute.
Name all the 8 bit registers:
High = AH, BH, CH, DH Low = AL,BL,CL,DL
What is the LSB?
Least Significant Bit (bit position 0)
What is the MSB?
Most Significant Bit (largest bit position)
Name at least four CPU status flags.
Most common: Carry, Sign, Zero, Overflow. Less common: Auxiliary Carry, Parity.
What happens in a finite-state machine when no more input is available and the current state is a nonterminal state?
The FSM enters an error state.
After a program has been loaded into memory, how does it begin execution?
The OS executes a branch (like a GOTO) to the first machine instruction in the program.
When the processor switches from one task to another, what values in the first task's state must be preserved?
The program counter, the task's variables, and the CPU registers (including the status flags).
What parts make up an address?
The segment base address and an offset.
How do you convert hex to binary?
To convert a value from hexadecimal to binary, you merely translate each hexadecimal digit into its 4-bit binary equivalent.
In a finite-state machine diagram, what do the nodes represent?
a state
Which flag is set when an arithmetic operation causes a carry from bit 3 to bit 4 in an 8-bit operand.
auxiliary (AC)
Which flag is set when the result of an unsigned arithmetic operation is too large to fit into the destination?
carry (CF)
Data travels along a bus one byte at a time.
false
For any two integers n and m, ((n XOR m) OR m) produces n.
false
In the following statement, EAX is called the destination operand: mov EBX,EAX
false
The .CODE directive must always occur before the .DATA directive.
false
The Carry flag reflects the status of a signed arithmetic operation.
false
The EBP register points to the last value pushed on the stack.
false
The EQU directive permits a constant to be redefined at any point in a program.
false
The JCXZ instruction jumps to a target label when the ECX register is equal to zero.
false
The MOVZX instruction cannot use a variable as the source operand
false
The OR instruction can be used to set an operand's value to zero
false
The PROC directive marks both the beginning and ending of a procedure.
false
The PUSH instruction copies a value from the stack to an operand before incrementing the stack pointer.
false
The Parity flag indicates whether the highest byte of a destination operand has an even number of 1 bits
false
The SAHF instruction copies the Sign, Overflow, and Carry flags to the AL register.
false
The SDWORD directive is used when defining unsigned 32-bit integers.
false
The SHL instruction is suitable only for signed integers
false
The TEST instruction always alters the destination operand
false
The binary representation of decimal 34 is 00110011.
false
The binary value of AL after the following instructions have executed is 11101101. mov al, 01101011b rol al,2
false
The destination operand of the AND instruction must be a register.
false
The runtime stack is managed by the operating system, with no support from the CPU.
false
The syntax for the MOV instruction is: MOV source, destination
false
The upper half of the EDX register is called DX.
false
With unsigned operands, the CMP instruction sets the Carry flag when the destination operand is greater than the source operand.
false
When a program runs, what information does the OS read from the filename's disk directory entry?
filename, file size, starting location on the disk, and last modification date and time.
What special purpose does the ECX register serve?
loop counter
Which flag is set when the result of a signed arithmetic operation is either too large or too small to fit into the destination?
overflow (OF)
Which flag is set if the least-significant byte in the result contains an even number of 1 bits. Otherwise, PF is clear.
parity (PF)
Which flag is set when an arithmetic or logical operation generates a negative result?
sign (SF)
Describe signed and unsigned.
signed integers are either positive or negative. An unsigned integer is positive by default. Zero is positive by default.
A link library is a file containing procedures that have been assembled into machine code.
true
If AL contains +127 and you add 3 to AL, the Overflow flag will be set.
true
If the source code for an assembly language program is modified, you must run both the assembler and linker to update the program's executable code.
true
In Protected mode, immediate values pushed on the stack are always 32 bits long.
true
In Protected mode, programs are given separate memory areas named segments.
true
In Real-address mode, only one program can run at a time.
true
Suppose BX and DX both contain positive signed integers. If adding them produces a negative result, the Overflow flag will be set
true
The DIV instruction generates a divide overflow condition when the quotient is too large to fit into the destination operand.
true
The EIP register cannot be the destination operand of a MOV, ADD, or SUB instruction.
true
The JA instruction is used when comparing unsigned integers.
true
The JO instruction is used after an operation involving signed integers.
true
The MOV instruction requires both operands to be the same size.
true
The MUL instruction sets the Carry flag if the upper half of the product is not equal to zero.
true
The NOT instruction inverts each bit in a destination operand.
true
The Overflow flag will never be set when adding a positive integer to a negative integer
true
The PUSHAD instruction pushes all the 32-bit general-purpose registers on the stack.
true
The Zero flag contains a binary 1 when the result of an arithmetic operation is zero
true
The binary representation of decimal -42 is 11010110.
true
The binary value of AL after the following instructions have executed is 00011010. mov al,01101011b shr al,2
true
The binary value of AL after the following instructions have executed is 11111100. mov al,11000101b sar al,4
true
The control unit (CU) coordinates the sequencing of steps involved in executing machine instructions.
true
The first value pushed on a stack is the last one to be removed.
true
The following instructions will set the Overflow flag: mov al,+125 sub al,-5
true
The following is a valid data definition statement: helloStr WORD 65535
true
The following is a valid identifier: AB?62_$
true
The following statement will assemble without errors: mov WORD PTR [edx], 1234h
true
The hexadecimal values of DX and AX after the following instructions have executed are DX=0005 and AX=0000. mov dx,5000h mov ax,10h mul dx
true
The listing file contains a list of segments and groups in a program.
true
The sum of the binary integers 1101101 and 00111011 is 10101000.
true
Which flag is set when the result of an arithmetic or logical operation generates a result of zero?
zero (ZF)