我在编写 .com 程序的环境时遇到问题。我知道,当 es 指向 psp 的开头时,它位于 es:2ch。这是我的代码:
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ä♦