stack.asm
来自「介绍用Java解析网络数据的三种特殊方法」· 汇编 代码 · 共 71 行
ASM
71 行
; 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 + =
减小字号Ctrl + -
显示快捷键?