I have the following function:
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
the output of it should be what is seen in the this screenshot - and this is the output of it (at least in the begginig)
but, after the "good" output filled the console (when it needed to "scroll") it doesn't longer print those spaces between each '&', instead it just prints each of them in a new line as can be seen here.
What might cause such strange behaviour? What am I doing wrong? How should I fix this?
I am using emu8086.