a review problem lists these registers in hex:
cs = ???? sp = 0300 ax = a66a ip = 01cf
ds = 4100 bp = 0003 bx = 1234
ss = 48ee si = 0100 cx = 00ff
es = 4cee di = 1000 dx = 0000
The absolute address of the next instruction to be executed is 40f0f.
40f0f -01cf _____ 40d40 / 10 = 40d4 = cs
Is the size of the data segment in bytes always equal to the stack segment minus the data segment * 10? 48ee - 4100 = 7ee0. Likewise, is the code segment in bytes always equal to the data segment minus the code segment * 10? 48ee - 40d4 = 81a0.
For
mov cx,[bx + si]
, the absolute address of the source operand is 42334.bx = 1234 si = 0100 _________ 1334 ds = 4100 * 10 = 41000 + 1334 = 42334
For
mov cx,[di - 4]
, the absolute address of the source operand is 41ffc.di = 1000 - 4 _________ 0FFC ds = 4100 * 10 = 41000 + 0ffc = 41ffc
For
mov cx,[bp + si - 3]
, the absolute address of the source operand is 48fe0.bp = 0003 si = 0100 - 3 _________ 0100 ss = 48ee * 10 = 48ee0 + 0100 = 48fe0
Am I going about solving these the right way? How do I know when to use the stack segment for these calculations and when to use the data segment?
For address calculations involving
bp
orsp
or stack operations likepush
orpop
the segment register is implicitlyss
, for other addressesds
. Exception: If you use a string instruction, the destination segment register is implicitlyes
.