我只想问一下如何在MS-DEBUG中对角打印0-9个数字? 这是我的代码:
mov cx, 000a
mov ah, 02
mov dl, 30
int 21
inc dl
loop ; loop to int 21
我的输出是0123456789
但所需的输出是:
0
1
2
3
4
5
6
7
8
9
答案 0 :(得分:2)
mov cx, 000a mov ah, 02 mov dl, 30 int 21 inc dl loop ; loop to int 21
在您的代码中,您仅更改DL寄存器中的列组件(通过使用DOS输出功能)。难怪你的循环产生:0123456789
对DH寄存器中的行组件进行更改,并看到它会为您提供所需的结果:
mov cx, 000a
mov bh, 00 < Use display page 0 to position the cursor on
mov ah, 02 < Luckily BIOS and DOS have the same function number
mov dl, 30 < This defines the start column and also the character
mov dh, 02 < This defines the start row
again:
int 10 < This sets the cursor
int 21 < This outputs the character in DL
inc dl < This changes the column and also the character
inc dh < This changes the row
loop again