📄 stack.asm
字号:
; This sample shows how the
; stack works. Click "Stack"
; button in emulator to see
; the contents of the stack.
#MAKE_COM#
; This code does nothing
; useful, except printing
; "Hi" in the end.
; COM file is loaded at 100h
; prefix:
ORG 100h
MOV AX, 1234h
PUSH AX
MOV DX, 5678h
PUSH DX
POP BX
POP CX
; function call pushes
; IP value of the next
; instruction:
CALL tfunc
MOV AX, 7890h
PUSH AX
POP BX
; A typical use of
; stack is to set segment
; registers.
; set DS to video
; memory segment:
MOV AX, 0B800h
PUSH AX
POP DS
; print "Hi":
MOV [170h], 'H'
MOV [172h], 'i'
; color attribute for 'H'
MOV [171h], 11001110b
; color attribute for 'i'
MOV [173h], 10011110b
RET
; the test procedure:
tfunc PROC NEAR
XOR BX, BX
XOR CX, CX
; here we "pop" the IP
; value:
RET
tfunc ENDP
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -