The first row is printing junks.
I tried to switch things offset,index etc. But the first line is always wrong regardless of what the string is.
mov AX, 0b800h
mov ES, AX
nums db ' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 '
numsend label byte
;first row
MOV SI,OFFSET nums
MOV DI,160*4 +2 ;1st row,1st column, 2 cells per char
MOV AH, 07h
MOV CX,5*3;2 chars per digit, and 5 digit
row1:
MOV AL,[SI]
MOV ES:[DI],AX
INC SI
ADD DI,2
LOOP row1
;second row
MOV SI,OFFSET nums+15 ;point to the beginning of '_6 _7 _8 _9 10' from nums array
MOV DI,160*5 +2 ;2nd row,1st column, 2 cells per char
MOV AH, 07h
MOV CX,5*3 ;2 chars per digit, and 4 digit
row2:
MOV AL,[SI]
MOV ES:[DI],AX
INC SI
ADD DI,2
LOOP row2
;third row
MOV SI,OFFSET nums+30 ;point to the beginning of '11 12 13 14 15' from nums array
MOV DI,160*6 + 2*1 ;3rd row,1stcolumn,2 cells per char
MOV AH, 07h
MOV CX,5*3 ;2 chars per digit, and 4 digit
row3:
MOV AL,[SI]
MOV ES:[DI],AX
INC SI
ADD DI,2
LOOP row3
;fourth row
MOV SI,OFFSET nums+45 ;point to the beginning of ' 16 17 18 19 ' from nums array
MOV DI,160*7 + 2*1 ;4th row,1stcolumn,2 cells per char
MOV AH, 07h
MOV CX,5*3 ;2 chars per digit, and 4 digit
row4:
MOV AL,[SI]
MOV ES:[DI],AX
INC SI
ADD DI,2
LOOP row4
I expected:
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19
But i always get: random ascii values (for the first line)
6 7 8 9 10
11 12 13 14 15
16 17 18 19