我在編寫.com程序的環境時遇到了問題。我知道,當es指向psp的開始時,它被放置在es:2ch。這裏是我的代碼:編寫.com程序的環境(NASM)
org 100h
mov cx,256
mov ah,2
xor si, si ; si = 0
mov si,[es:si] ; si = begining of the psp
sub si, 2ch ; adding 2ch offset to si
mov si, [si] ; making si point to com environement
loop1: ; output chars until '0'
mov dl, [si]
inc si
cmp dl, '0'
je end_of_program
int 21h
loop loop1
end_of_program:
mov ah, 0
int 16h
mov ah, 4ch
int 21h
輸出:
R♥˙{ T♥ | `♦☺Ç☻ ▼ ţ☺ IT
♦☻ NLł☻ PO┬☺ NO×☻ CFÓ☻ SV┤☻ SU╩☻ LA▲♥ DV4♥ RU÷☻ BRJ♥
HUĘ♥ ISż♥ PLď♥ ROŕ♥ SL ♦ YU▬♦ TRB♦ ETn♦ JPX♦ USä♦
那麼我的輸出OK?它是第一個變量,它應該是這樣嗎? – Patryk 2013-03-19 12:14:39