Reputation: 165
The table contains parts of memory:
The registers have these contents:
DS: 0726
CS: 0624
SS: 0727
ES: 0626
AX: 0003
BX: 0042
BP: 0036
SP: 002B
What is the result after these instructions:
a) mov ax, 10011b ;ax = ____h
b) mov ah, 4[BX] ;ah = ____h
c) mul bl ;ax = ____h
d) pop cx ;cx =____ h
e) mov ax, [BP] ;ax = ________h
Keep in mind, the instructions are separate/sandboxed from each other. One instruction doesn't influence the next one
For context, this is not homework. I'm prepping for exams and I don't know how to solve this. I've just begun studying the 8086.
My results:
a) ax = 0013h
b) ah = 03h (Probably not, since I'm not sure what the 4 is doing in 4[BX]. Multiplication?)
c) ax = 00C6h
d) cx = ? (I know how to get the address of the top of the stack, it's 729Bh, but I assume the value is in the table above? I don't know how to find it)
e) ax = F6 (Tried to make some sense of the table above. Probably not correct)
Upvotes: 0
Views: 326
Reputation: 5775
When BP
or SP
is used in addressing, the default segment register is SS
, otherwise it's DS
.
Rewrite the first column of memory dump table with linear address, i.e. instead of seg:offs calculate 16*seg+offs. This gives addresses
07260
07270
07280
07290
072A0
Ad d): pop cx
loads a word from SS:SP
, which is 0727:002B, which corresponds to linear address 0729B. At B-th column of fourth line we can see 00 12, so the answer is cx = 1200h.
Ad e): mov ax,[BP]
loads a word from SS:BP
, which is 0727:0036, which corresponds with linear address 072A6. At 6-th position in the last line we can see 18 24, so the answer is ax = 2418h.
Upvotes: 4