[英]Meaning of push registers with segment and offset
i want to create MBR with assembly language . 我想用汇编语言创建MBR。 But i have code , give by somebody that i don't understand . 但是我有代码,由我不理解的人给出。 When you write 当你写
push ax
push bx
What is the meaning , when we use segment and offset 什么是段和偏移量
For more details, read this code : 有关更多详细信息,请阅读以下代码:
[BITS 16]
[ORG 0x0]
mov ax, 0x07C0
mov ds , ax
mov es , ax
mov ax , 0x8000
mov ss , ax
mov sp , 0xf000
mov si ,msgDebut
call afficher
end :
jmp end
msgDebut db "HelloWorld!!!!",13,10,0
afficher :
push ax
push bx
.debut :
lodsb
cmp al ,0
jz .fin
mov ah , 0x0E
mov bx , 0x07
int 0x10
jmp .debut
.fin :
pop bx
pop ax
ret
times 510-($-$$) db 144
dw 0xAA55
can you explain me this code line by line using memory addressing, segmentation, and offset abstraction 您能使用内存寻址,分段和偏移量抽象逐行解释此代码吗?
The push
instruction places its operand on the stack for conservation. push
指令将其操作数放在堆栈上以进行保存。
The stack is an area of memory set aside for this purpose. 堆栈是为此目的预留的内存区域。
The stackpointer determines where the data will be stored in memory. 所述stackpointer确定其中数据将被存储在存储器中。 When the stackpointer SS:SP
is equal to 0x8000:0xEFFE, push ax
will first lower the stackpointer by 2 so it becomes 0x8000:0xEFFC and then write the contents of the AX
register in that memory address. 当堆栈指针SS:SP
等于0x8000:0xEFFE时, push ax
将首先将堆栈指针降低2,使其变为0x8000:0xEFFC,然后将AX
寄存器的内容写入该内存地址。
Hereafter push bx
will again lower the stackpointer by 2 so it now becomes 0x8000:0xEFFA and then write the contents of the BX
register in that memory address. 此后, push bx
将再次使堆栈指针降低2,因此它现在变为0x8000:0xEFFA,然后将BX
寄存器的内容写入该内存地址。
The pop
instruction reverses the actions of push
. pop
指令使push
操作反向。 You use these to restore the registers to their original values. 您可以使用它们将寄存器恢复到其原始值。
afficher :
push ax ; Preserve AX
push bx ; Preserve BX
...
pop bx ; Restore BX
pop ax ; Restore AX
ret
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.