我有以下功能:
printRows proc
mov cx, 25
printRowsLoop:
mov si, 0
printSingleRowLoop:
mov ah, 3 ;save current cursor position at dx (dh:dl)
int 10h
push dx ;keep the position for later
mov ah, 2
mov dl, '&'
int 21h ; print '&' char in the current curser position
pop dx ; restore dx
add dl, 5 ; increase the column of it with a const number (so it would look like a square)
mov ah, 2
int 10h
inc si
cmp si, 3 ; print 3 '&' in each row
jne printSingleRowLoop
mov dl, 13 ; result of these 3 groups of commands should be 2 new lines
mov ah, 2
int 21h
mov dl, 10
;mov ah, 2 ; ah is alredy 2
int 21h
;mov dl, 10 ; dl is already 10
;mov ah,2 ; ah is already 2
int 21h
loop printRowsLoop ; print (cx) lines
ret
printRows endp
它的输出应该是这个屏幕截图中看到的- 这是它的输出(至少在开始时)
但是,在“好”输出填满控制台之后(当它需要“滚动”时)它不再打印每个“&”之间的那些空格,而是将它们中的每一个打印在一个新行中,如此处所示.
什么可能导致这种奇怪的行为?我究竟做错了什么?我应该如何解决这个问题?
我正在使用emu8086。