- 利用棧兩個(gè)值交換
mov ax, 1000h
mov bx, 1001h
push ax
push bx
pop ax
pop bx
- 一個(gè)完整的程序
assume cs:code
:代碼段
code segment
mov ax, 1000h
mov bx, 2000h
mov cx, 1000h
mov ds, cx
mov [0], ax
mov [1], bx
:正常退出
mov ax, 4c00h
:中斷
int 21h
code ends
end
編譯器只關(guān)注ax高位4c
mov ax, 4c00h == mov ah, 4ch
- 常見(jiàn)中斷
- int 10h用戶(hù)執(zhí)行BIOS中斷
- int 3h斷電中端
- int 21h用戶(hù)執(zhí)行DOS程序中斷
- Hello World
assume cs:code, ds:data
:數(shù)據(jù)段
data segment
data ends
:代碼段
code segment
:$結(jié)束
db "a-Hello World!$"
db "13213213$"
:程序執(zhí)行入口
start:
:將代碼端關(guān)聯(lián)
mov ax, data
mov ds, ax
:從哪里開(kāi)始打印
mov dx, 0h
:打印字符串
mov ah, 9h
int 21h
:退出程序
mov ax, 4c00h
int 21h
code ends
end start