Good

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 16

Compiled By : Muhammad Ishfaq.

CS401 Important Solved Assignments for MID Term

Q1) Differentiate Between register and Memory location (4)


1) Registers are storage locations internal to the processor but RAM is located external to the
CPU.
2) All data must be moved into a register before it can be operated whereas data has to be
loaded into a CPU register from memory before the CPU can process it.
3) Registers are faster where as memory is much slower than registers.
4) In general, registers hold the data the processor is currently working on, while Memory
holds the program instructions and the data the program requires.
Note: A best practice is to draw a table with two columns and highlight the difference with
specifying the features in separate columns
Q2) Commands to view data in Memory Window 1 & 2:
A) Command to view data in memory window 1
Syntax: M1 Segment-Base-Address : Offset-Address
Example M1 DS : 0100
Explanation: The above example will display the contents of memory location at
offset address 0x0100 in Data Segment register. The data will be displayed in Memory
Window 1
B) Command to view data in memory window 2
Syntax: M2 Segment-Base-Address : Offset-Address
Example M2 DS : 0100
Explanation: The above example will display the contents of memory location at
offset address 0x0100 in Data Segment register. The data will be displayed in Memory
Window 2
Q3) Code to Swap two numbers:
[org 0x0100]
jmp Start
var1: dw 5 ; First Variable
var2: dw 10 ; Second variable
Start:
mov ax, [var1] ; AX=Var1
mov dx, [var2] ; BX= Var2
mov [var1],dx ; Interchanged value
mov [var2],ax
int 0x21
Explanation: in this code we used two variables Var1 and Var2 whose values were to be
swapped we first moved the contents of first variable in AX and those of second register in
DX and finally we swapped the variables by assigning the variables, the value of other
variable (stored in register). We used to registers because we can’t move data directly from
one memory location to other.
Q4) Explain the instructions with example.
JNZ:
JNE:
Both of the above instructions are synonyms of each other and belong to set of instructions
from conditional jump, both test the condition that ZF is set or not if ZF=0 (i.e. the last
mathematical/logical operation did not produce zero result) a jump will occur to specified
location.
Syntax: JNZ labelname
JNE labelname
Compiled By : Muhammad Ishfaq.
Example JNZ Swap
Explanation: here JNZ will check the ZF and a jump will occur to accordingly depending
on the value of CF and execution will start from the first instruction after labelname label.
CMP:
The cmp instruction is used to compare two operands. It subtracts the right operand from
the left operand; however no register is modified except the CF and ZF flags, which are set.
Syntax: CMP destination, source
Example CMP Ax, 0x0100
Explanation: By comparing the contents of AX register with 0x0100 the target flags are
modified accordingly:
Rules to Set Flags:
A < B CF = 1 ZF = 0
A = B CF = 0 ZF = 1
A > B CF = 0 ZF = 0

Q6) which instructions are legal. If illegal correct them.


i. mov [05], [ 24]
ii. mov [label1], 501
iii. mov bx, al
iv. mov bx,[bs+bp+200]
Solution:
mov [05], [ 24]
Memory to Memory referencing is not allowed. The correct instructions for
this operation could be
mov ax, [24]
mov [05],ax
mov [label1], 50l
Here the size of data to be moved is ambiguous, so assembler will complain:
One option can be:
mov ax,501
mov [label1] ,ax
mov bx, al
Size Mismatch, BX is 16 bits where as AL is 8-bits: the desired result can be
received as
mov bx, ax
or mov bl, al

mov bx,[bs+bp+200]
Two base registers are involved which is illegal. We can only add index register
with base.
mov ax, [bp+ si+100]
Q7) Calculating physical address.
1) Suppose CS register contains the value “1DDD” in hexadecimal and IP register contains
the following value “0436” again in hexadecimal.
2) The binary value of CS will be “0001110111011101”.
3) Append four binary zeros to the Least Significant Side, now it becomes:
“00011101110111010000”
4) The binary value of IP register is “0000010000110110”.
5) Append four binary bits to the Most Significant Side, now it becomes:
“00000000010000110110”
Compiled By : Muhammad Ishfaq.
6) Now the Segment Value is “00011101110111010000”
7) Offset Value is “00000000010000110110”
8) Add Both of these binary numbers and you get the actual physical address:
00011101110111010000+00000000010000110110= 00011110001000000110
9) So the actual physical address is “11110001000000110”.

How these instructions are legal or illegal. If illegal tell the reason and how we can
make this legal,
if legal then what these instructions do.
a. mov ax, bx
b. mov 10,ax
c. mov bx, [num2]
d. mov [num1],[num2]
e. add [num2],[num1]
f. mov [num1],al
Solution:
a. mov ax, bx
This instruction is legal because register to register move is allowed.
b. mov 10,ax
This instruction is illegal because the we cant move a register or memory address into a
constant. It can be rectify mov bx,ax or mov [var],ax.
c. mov bx, [num2]
This instruction is legal because memory to register is also allowed.
d. mov [num1],[num2]
This instruction is illegal because memory to memory is not allowed. It can be rectify
Mov ax, [num2]
Mov [num1], ax
e. add [num2],[num1]
This instruction is illegal because memory to memory operation is not allowed. It can be
rectify
mov ax,[num1]
add [num2], ax
f. mov [num1],al
This instruction is legal because register to memory is allowed.
Assemble the following code and step through it inside the debugger. Observer the
values of AX, BX, and the four words starting at “num1” after every instruction and fill
them in the table given below. All number entered in the table must be in hexadecimal.
Also give the reason why the result in [num1+6] is not 30 as expected.
[org 0x100]
mov ax, [num1]
mov bx, [num1+2]
add ax, bx
mov bx, [num1+4]
add ax, bx
mov [num1+6], ax

mov ax, 0x4c00


int 0x21

num1: db 5, 10, 15, 0


Compiled By : Muhammad Ishfaq.
Solution:
AX BX [num1] [num1+2] [num1+4] [num1+6]
Mov ax, [num1] 0x0A05 0x0000 0x05 0x0F 0x00 0x14
Mov bx, [num1+2] 0x0A05 0x000F 0x05 0x0F 0x00 0x14
Add ax, bx 0x0A14 0x000F 0x05 0x0F 0x00 0x14
Mov bx, [num1+4] 0x0A14 0x0000 0x05 0x0F 0x00 0x14
Add ax, bx 0x0A14 0x0000 0x05 0x0F 0x00 0x14
Mov [num1+6], ax 0x0A14 0x0000 0x05 0x0F 0x00 0x14
Reason that why result in [num1+6] is not 30 as expected:
The problem here is that data is defined as BYTE
num1: db 5, 10, 15, 0
and we are moving it into 16 bit registers
mov ax, [num1]
i.e. interpreting data as WORD.
Now num1 points to 5, num1+2 points to 15 and num1+4, num1+6 both points to garbage
values. Also, after execution of mov ax, [num1] AX will contain 0x0A05 instead of 0x0005. All
these issues lead to the wrong value in num1+6.

Calculate the effective address and the physical address accessed by each of the
following instructions. Also give the value of the designated register in each
instruction by looking up the dump of a portion of physical memory given below.
All questions are independent of each other. Assume the registers are initialized as
ES = 0x4020
DS = 0x40A0
BX = 0x0010
SI = 0x000E
BP = 0x0000
SS = 0x4010
If you calculate a physical address and it is not present in the table given above then simple
write that “Address is not given in table”.
Solution:
mov ax, [30]
First we have to calculate offset which is decimal 30 (0x1E).
Effective Address = 0x0030
Physical Address = (Segment Address * 0x10) + Effective Address
= (0x40A0 * 0x10) + 0x001E
= 0x40A1E
The Address is not present in the Memory Dump.
________________________________________________________________________
mov cx,[es:bx-0x10]
Effective Address = bx – 0x10
= 0x0010 – 0x10 = 0x0000
Physical Address = (Segment Address * 0x10) + Effective Address
= (0x4020 * 0x10) + 0x0000
= 0x40200
The Value of CX Register from the Memory Dump is = 0x0A43
mov bx,[bp + 0x0F]
Effective Address = bp + 0x0F
= 0x0000 + 0x000F = 0x000F
Compiled By : Muhammad Ishfaq.
Physical Address = (Segment Address * 0x10) + Effective Address
= (0x4010 * 0x10) + 0x000F
= 0x4010F
The Address is not present in the Memory Dump (One byte is missing).
mov cx, [0x30 + 0x15]
Effective Address = 0x45 = 0x0045
Physical Address = (Segment Address * 10) + Effective Address
= (0x40A0 * 0x10) + 0x0045
= 0x40A45
The Address is not present in the Memory Dump.
mov byte al,[0x0E]
Effective Address = 0x000E
Physical Address = (Segment Address * 0x10) + Effective Address
= (0x40A0 * 0x10) + 0x000E
= 0x40A0E
The Value of AL register from the Memory Dump is 75.
mov ax, [bx+si+0x15]
Effective Address = 0x0010 + 0x000E + 0x0015
= 0x0033
Physical Address = (Segment Address * 0x10) + Effective Address
= (0x40A0 * 0x10) + 0x0033
= 0x40A33
The Address is not present in the Memory Dump.
mov bx,[0x11]
Effective Address = 0x0011
Physical Address = (Segment Address * 0x10) + Effective Address
= (0x40A0 * 0x10) + 0x0011
= 0x40A11
The Address is not present in the Memory Dump.
Effective Address Physical Address Register Value
Mov ax, [30] 0x001E 0x40A1E Not given
Mov cx, [es:bx-0x10] 0x0000 0x40200 0x0A43
Mov bx, [bp+0x0F] 0x000F 0x4010F Byte not there
Mov cx, 0x0045 0x40A45 Not given
[0x30+0x15]
Mov byte al, [0x0E] 0x000E 0x40A0E 0x75
Mov ax, 0x0033 0x40A33 Not given
[bx+si+0x15]
Mov bx, [0x11] 0x0011 0x40A11 Not given

Question # 1. What is wrong with following instructions?


mov [byte1], 20
mov [111],[333]
mov [BX],[SI]
mov CS, SS
mov DL, CX
Solution:
a. Size of movement is not specified.
b. Memory to memory data movement is not allowed
c. Memory to memory data movement is not allowed.
Compiled By : Muhammad Ishfaq.
d. Segment to Segment movement is not allowed.
e. Size mismatch.
Question # 2 What is the effective address generated by the following combinations if
they are valid. Initially BX= 0x0200, SI= 0x0020, DI= 0x0002, BP= 0X400 AND SP=
0XFFFF?
a) bx + bp
b) bx + sp
c) bx + di
d) bx-si
e) bx + 100
Solution:
a) Invalid
b) Invalid
c) 0x0202
d) Invalid
e) 0x300
If AX=0x8000 and BX=0x0001 and “cmp ax, bx” is executed, which of the following
jumps will be taken? Each part is independent of others. Also give the value of Z, S,
and C flags.
a. jg greater
b. jl smaller
c. ja above
d. jb below
Solution:
Instructions Jump ZF SF CF
Jg greater Not taken 0 0 0
Jl smaller Taken 0 0 0
Ja above Taken 0 0 0
Jb below Not taken 0 0 0
Write a program in Assembly Language to find the maximum number and the minimum
number from an array of ten numbers.
Solution:
[org 0x0100]
jmp start ; unconditionally jump over data

array1: dw 10, 5, 30, 4, 50, 1, 20, 6, 40, 8


min: dw 0
max: dw 0
start:
;---------------for finding minimum number
mov bx, 0 ; initialize array index to zero
mov ax, 0 ; initialize min to zero
mov ax, [array1+bx] ; minimum number to ax
mov cx,10
top1: cmp ax, [array1+bx] ; are we find the minimum number
jle end1 ; if less or equal number
mov ax,[array1+bx] ;ax contains the minimum number
end1:
add bx, 2 ; advance bx to next index
loop top1
Compiled By : Muhammad Ishfaq.
mov [min], ax ; write back minimum in memory

;----------------for maximum number

mov bx, 0 ; initialize array index to zero


mov ax, 0 ; initialize max to zero
mov ax, [array1+bx] ; maximum number to ax
mov cx,10

top2: cmp ax, [array1+bx] ; are we find the maximum number


jge end2 ; if greater or equal number
mov ax,[array1+bx] ;ax contains the maximum number

end2:
add bx, 2 ; advance bx to next index
loop top2

mov [max], ax ; write back maximum number in memory


mov ax, 0x4c00 ; terminate program
int 0x21

Suppose AL contains 10011011b and CF= 0. Give the new contents of AL after each of
the following instructions is executed. Assume the preceding initial conditions for
each part of this question.
a. SHL AL,1
b. SHR AL, CL if CL contains 3
c. ROL AL ,1
d. SAR AL, CL if CL contains 3
e. RCR AL,CL if CL contains 2
Solution:
a. AL=00110110 CF=1
b. AL=00010011 CF=0
c. AL=00110111 CF=1
d. AL=11110011 CF=0
e. AL=10100110 CF=1
Q#1 AX contains a number between 0-15. Write code to complement the corresponding
bit in BX. For example if AX contains 6; complement the 6th bit of BX. (Note: First bit
in BX is at 0th position and last bit is at 15th position)
Solution:
[org 0x0100]
mov ax,3 ;suppose ax contain 3

mov dx,1 ; initial value for complement with bx


cmp ax,0 ;if ax contain 0
je complement ; go for complement ist bit

mov cx,ax ;other wise move the value in cx


shl dx,cl ; shift 1 to left for number value in ax
Compiled By : Muhammad Ishfaq.
complement:
xor bx,dx ;perform comlement operation

mov ax,4ch
int 21h

Q#2 Suppose that AX=0x3412, BX=0x7856, CX= 0x1CAB, and SP=0x100. Given the
contents of AX, BX, CX, and SP after executing the following instructions:
PUSH AX
PUSH BX
XCHG AX, CX
POP CX
PUSH AX
POP BX
SOLUTION:
AX BX CX SP
PUSH AX 0x3412 0x7856 0x1CAB 0xFE
PUSH BX 0x3412 0x7856 0x1CAB 0XFC
XCHG 0x1CAB 0x7856 0x3412 0XFC
AX,CX
POP CX 0x1CAB 0x7856 0x7856 0xFE
PUSH AX 0x1CAB 0x7856 0x7856 0XFC
POP BX 0x1CAB 0x1CAB 0x7856 0xFE
Identify the problems in the following instructions and correct them by replacing them
with one or two instruction having the same effect.

v. mov [05], [ 24]


; Memory to memory move is illegal in Intel architecture. The correct instructions
for this operation could be
mov ax, [24]
mov [24],ax

vi. mov [label1], 501


; Constant to memory move is illegal in Intel architecture. The correct instruction
could be
mov ax,501
mov [label1] ,ax

vii. mov bx, al


; Size mismatch i.e. bx is 16 bit register and al is 8 bit register. The correct
statement could be
mov bx, ax
or
mov bl, al

viii. mov ax, [si+di+100]


; Addition of two index register in one memory access is disallowed. We can do
this operation by addition of index and base register.
mov ax,[si+ bx+100]
Compiled By : Muhammad Ishfaq.

ix. mov bx,[bs+bp+200]


; Addition of two based register in one memory access is disallowed. We can do
this operation by addition of index and base register.
mov ax,[bp+ si+100]

Write a program to calculate the square of 10 by using a loop that adds 10 to the
accumulator 10 times.
Solution:
[org 0x0100]

mov bx,10
mov cx,10
mov ax,0

l1:
add ax, bx
sub cx, 1
jnz l1

mov [total], ax
mov ax,0x4c00
int 0x21
total: dw 0

If AX=8FFF and BX=0FFF and “cmp ax, bx” is executed, which of the following jumps
will be taken? Each part is independent of others. Also give the value of Z, S, and C
flags.

i. jg greater
ii. jl smaller
iii. ja above
iv. jb below

Instructions Jump ZF SF CF
Jg greater Not taken 0 1 0
Jl smaller Taken 0 1 0
Ja above Taken 0 1 0
Jb below Not taken 0 1 0
a. As an application of the shift and rotate instruction, let’s consider the problem of
reversing the bit pattern in a byte or word. For example, if AL contains 11100100,
we want to make it 00100111. Write the code that reverses the bit pattern in AL
register.
b. Show the values of each register which you have used in your program after the
each iteration of shifting or rotating bits with the following pattern.

Values of Values of Values of


No of iteration
Register 1 Register 2 Register 3
1st iteration . . .
Compiled By : Muhammad Ishfaq.
2 nd
iteration . . .
. . . .
. . . .
. . . .
Solution: (a)
[ORG 0X100]
MOV AL, 11100100b
MOV BL,0
MOV CX, 8

REV:
SHL AL, 1
RCR BL, 1
LOOP REV

MOV AL, BL

MOV AX, 0x4c00


INT 0x21
Solution (b)
CX AL BL
st
1 iteration 8 11100100 00000000
2nd iteration 7 11001000 10000000
rd
3 iteration 6 10010000 11000000
th
4 iteration 5 00100000 11100000
5th iteration 4 01000000 01110000
th
6 iteration 3 10000000 00111000
7th iteration 2 00000000 10011100
th
8 iteration 1 00000000 01001110
th
9 iteration 0 00000000 00100111
Write a program to swap every pair of bits in the AX register.
Solution:
[org 0x0100]

mov ax,1001100110011001b
mov bx,0
mov dx, 0 ; initialization
mov bx, ax ; get a copy of ax
and bx, 0011001100110011b ; bx now has 01, 45, 89, 1213 bits
rol bx, 2

mov dx, ax ; get a copy of ax


and dx, 1100110011001100b ; dx now has 23, 67, 1011, 1415 bits
ror dx,2

mov cx, 0
mov cx, bx
or cx, dx ; ORing of bx and dx will produce desired result

mov ax, cx ; ax now has the result


Compiled By : Muhammad Ishfaq.
end: mov ax, 4c00h
int 21h
Write a program to count the number of 1 bits in BX, without changing BX. put the
answer in AX and use ROL instruction only.
Solution:
XOR AX, AX
MOV CX, 16
TOP:
ROL BX, 1
JNC NEXT
INC AX
NEXT:
LOOP TOP
a. Calculate the physical memory address generated by the following segment offset
pairs.
i. 74F0:2123
Physical Address = Segment x10 + Offset
Physical Address = 74F0 x10 + 2123
Physical Address = 774F00 + 2123
Physical Address = 77023h

0000:6727
Physical Address = Segment x10 + Offset
Physical Address = 0000 x10 + 6727
Physical Address = 00000 + 6727
Physical Address = 6727h

FFFF:4336
Physical Address = Segment x10 + Offset
Physical Address = FFFF x10 + 4336
Physical Address = FFFF0 + 4336
Physical Address = 104326h
To make 20bit physical address we have to drop the carry bit so
Physical Address = 04326h

AB01:FFFF
Physical Address = Segment x10 + Offset
Physical Address = AB01 x10 + FFFF
Physical Address = AB010 + FFFF
Physical Address = BB00Fh

0FFF:FFFF
Physical Address = Segment x10 + Offset
Physical Address = 0FFF x10 + FFFF
Physical Address = 0FFF0 + FFFF
Physical Address = 1FFEFh

b. Identify the problems in the following instructions and correct them by replacing them
with one or two instruction having the same effect.
Compiled By : Muhammad Ishfaq.
x. mov [02], [ 22]
; Memory to memory move is illegal in Intel architecture. The correct instructions
for this operation could be
mov ax, [22]
mov [22],ax

xi. mov [wordvar], 20l


; Constant to memory move is illegal in Intel architecture. The correct instruction
could be
mov ax,201
mov [wordvar] ,ax

xii. mov bx, al


; Size mismatch i.e. bx is 16 bit register and al is 8 bit register. The correct
statement could be
mov bx, ax
or
mov bl, al

xiii. mov ax, [si+di+100]


; Addition of two index register in one memory access is disallowed. We can do
this operation by addition of index and base register.
mov ax,[si+ bx+100]

xiv.mov bx,[bs+bp+200]
; Addition of two based register in one memory access is disallowed. We can do
this operation by addition of index and base register.
mov ax,[bp+ si+100]

a. Write a program in assembly language that calculate the factorial of a number where
factorial is defined as:
Factorial(x) = x*(x-1)*(x-2)*...*1
factorial (0) = 1
[org 0x0100]
mov ax, 1 ; ax hold the factorial
mov cx, 5 ; suppose cx contain the value for which factorial is to
; determined.

top:
mul cx ; ax = ax * cx
loop top

mov ax,0x4c00 ;terminate program


int 0x21

b. If AX=8FFF and BX=0FFF and “cmp ax, bx” is executed, which of the following
jumps will be taken? Each part is independent of others. Also give the value of Z, S,
and C flags.
a) jg greater
Compiled By : Muhammad Ishfaq.
b) jl smaller
c) ja above
d) jb below

Instructions Jump ZF SF CF
Jg greater Not taken 0 1 0
Jl smaller Taken 0 1 0
Ja above Taken 0 1 0
Jb below Not taken 0 1 0
a. What is the difference between shift right (SHR) and shit arithmetic right (SAR)
instructions?
The SAR instruction operates like SHR, with one difference, the msb retains its original
value.
b. What is the difference between AND and TEST instructions?
The TEST instruction perform an AND operation of the destination with the source but
does not change the destination contents
c. The relations of CALL and RET instructions with PUSH and POP instructions.
When CALL instruction is executed the PUSH operation is to be perfumed to save the
address of next instruction and when the RET instruction is executed the POP
operations is to be performed to get the return address of next instruction to be
executed
Write a sequence of instruction to do each of the following:
a. Put the sum 1+ 4+7+ … +148 in AX
Solution:
MOV AX, 0 ; initialize AX
MOV BX, 1 ; contain every added value

WHILE_:
CMP BX, 148 ; compare with last vale
JG ENDWHILE_

ADD AX, BX ; AX hold the sum


ADD BX, 3 ; BX contain the new adding value
JMP WHILE_

ENDWHILE_:
b. Put the sum 100+95+90+ … +5 in AX
Solution:
MOV AX, 0 ; initialize AX
MOV BX, 100 ; contain every adding value

WHILE_:
CMP BX, 5 ; compare with last vale
JL ENDWHILE_

ADD AX, BX ; AX hold the sum


SUB BX, 5 ; BX contain the new adding value
JMP WHILE_

ENDWHILE_:
Compiled By : Muhammad Ishfaq.

1. Identify the problems in the following instructions and correct them by replacing
them with one or two instruction having the same effect.
a. mov [02], [22]
b. mov [wordvar], 20
c. mov bx, al
d. mov ax, [si+di+100]

Solution:
a)
mov ax, [22]
mov [02], ax
OR
mov al, [22]
mov [02], [al]
b)
mov al, 22
mov [wordvar], al
c)
mov bl, al
d)
Mov bx, si
Mov ax, [bx+di+100]

Write instructions to do the following.


a. Copy contents of memory location with offset 0025 in the current data segment into
AX.
b. Copy AX into memory location with offset 0FFF in the current data segment.
c. Move contents of memory location with offset 0010 to memory location with offset
002F in the current data segment.
Solution:
1 a. mov SI, 0x0025
mov AX, [SI]
1 b. mov [DI], 0x0FFF
mov [DI], AX
1 c. mov DI, 0x002F
mov SI, 0x0010
mov AX, [SI]
mov [DI], AX
Compiled By : Muhammad Ishfaq.
Replace the following invalid instructions with a single instruction that has the same
effect.
1 a. pop ip
2 b. mov ip, L5
3 c. sub sp, 2 mov [ss:sp], ax
4 d. mov ax, [ss:sp] add sp, 2
5 e. add sp, 6 mov ip, [ss:sp-6]

Solution:
a. ret
b. jmp L5
c. push ax
d. pop ax
e. call

As an application of the shift and rotate instruction, let’s consider the problem of
reversing the bit pattern in a byte or word. For example, if AL contains 11011100, we
want to make it 00111011. Write the code that reverses the bit pattern in AL register.
Solution:
MOV AL, 11011100b
MOV BL,0
MOV CX, 8
REV:
SHL AL, 1
RCR BL, 1
LOOP REV
MOV AL, BL
MOV AX, 0x4c00
INT 0x21

Consider the given block of code from an assembly language program. And suppose
that AX= 1234h, BX= 5678h, CX= 9ABCh and SP= 100h.

Give the contents of AX, BX, CX and SP after executing the following block of
instructions.

PUSH AX
PUSH BX
XCHG AX, CX
POP CX
PUSH AX
POP BX
Compiled By : Muhammad Ishfaq.
VALUES AFTER THE EXECUTION OF INSTRUCTION
Instructions AX BX CX SP Stack Top
--- 0x1234 0x5678 0x9ABC 0x0100 ---
PUSH AX 0x1234 0x5678 0x9ABC 0x00FE 0x1234
PUSH BX 0x1234 0x5678 0x9ABC 0x00FC 0x5678
XCHG AX, CX 0x9ABC 0x5678 0x1234 0x00FC 0x5678
POP CX 0x9ABC 0x5678 0x5678 0x00FE 0x1234
PUSH AX 0x9ABC 0x5678 0x5678 0x00FC 0x9ABC
POP BX 0x9ABC 0x9ABC 0x5678 0x00FE 0x1234
SO THE FINAL VALUES ARE
0x9ABC 0x9ABC 0x5678 0x00FE 0x1234h

You might also like