The code below is contained in a FAT16 boot sector at offset 0x3E of the 512 byte sector. At boot time the sector is loaded to memory at location 0:0x7C00. The first three bytes of the sector are:
EB 3C 90
which translate to the following jump instruction:
JMP SHORT 0x3E
which jumps to the start of the code listed below.
My question is about the push
and the pop
instructions in the last two lines listed below.
The push
pushes the byte 0x54 to location 0x7BFF. The pop
instruction pops the bytes located at 0x7C00 & 0x7BFF into the ES
register. So ES = 0xEB54
. But isn't that a very unusual thing to do? It pops a byte that was never even pushed. Furthermore, the value in ES
will eventually be used for a specific purpose later on in the boot sector code.
MY QUESTION: What value is popped into ES
in the last line below?
xor ax,ax
mov ds,ax
mov ss,ax
mov sp,0x7c00
mov bp,sp
cld
sti
mov [bp+0x24],dl
mov al,[bp+0x10]
mul word [bp+0x16]
add ax,[bp+0xe]
adc dl,dh
add ax,[bp+0x1c]
adc dx,[bp+0x1e]
push byte +0x54
pop es