Description
- Single step through the program created in the previous assignment (HW3)—the AddSub Program. Submit a trace of screenshots single stepping through each line of the program.
- Declare whether each flag is set (‘1’ for set, ‘0’ for not set) following each instruction. Show the function of the instructions by hand.
Instruction # | Instruction | CF | SF | ZF | OF |
0 | mov ax, 7F00h | ||||
1 | add ax, 100h | ||||
2 | add al, 0h | ||||
3 | add al, 0FFh | ||||
4 | sub ah, 080h |
- Given the following data declarations:
.data
Alpha BYTE 2Bh, 23h, 4Ah
Beta DWORD 222h
Delta DWORD 312h
Iota DWORD 434h
Zeta WORD 124h
- Write an instruction that moves Beta into EAX and adds Iota to the same register
- Write a set of instructions that adds all the elements of the array Alpha into AL
- Write a set of instructions that moves Delta into EAX, adds the value stored in Zeta to the same register
- Write an instruction that moves the last two bytes in ALPHA into CX.
- What are the contents of CX subsequent to part D of this question?
- Fill in the requested register values after executions of the instructions:
Show the memory map.
.data
myBytes BYTE 24h, 25h, 26h, 27h
myWords WORD 2233h, 3355h, 3456h, AACCh, BCCBh
myDoubles DWORD BB00h, 2345h, 3456h, AB71h, 44h
myPointer DWORD myDoubles
.code
mov esi, OFFSET myBytes
mov ax, WORD PTR [esi+2] ; A. AX =
mov eax, DWORD PTR myWords ; B. EAX =
mov esi, myPointer
mov ax, WORD PTR [esi+8] ; C. AX =
mov ax, WORD PTR [esi+1] ; D. AX =
mov ax, WORD PTR [esi-6] ; E. AX =
- What is returned by the following operations in connection to the given array:
.data
myArray DWORD 12 DUP(23), 3, 34, 467 , 2365, 47899
- TYPE myArray
- LENGTHOF myArray
- SIZEOF myArray
- Fill in the requested register values after executions of the instructions (Do not let your eyes deceive you. There are some movSx instructions and some movZx instructions.):
.code
mov bx, 0ACD8h
movzx eax, bx ; A. EAX =
movzx edx, bl ; B. EDX =
movzx cx, bh ; C. CX =
mov bx, 0DD34h
movsx eax, bx ; D. EAX =
movsx edx, bl ; E. EDX =
movsx cx, bh ; F. CX =