Can anyone help me on this:
I'm starting programing assembly (in TASM), I'm trying to do this example:
- Print numbers from 1 to 10 within a cycle.
I've managed to print them from 1 to 9 but when it gets to number 10 it prints the corresponding caracter ":" and not number 10! How can I print numbers with 2 or more digits?
This is the code I've made (ex1.asm):
.MODEL SMALL
.STACK 100h
.DATA
PROGRAMA DB "IMPRIMIR OS NUMEROS DE 1 A 10 NUM CICLO.",10,10,"$"
NUM DB 0
.CODE
;initializes data segment
MOV AX, @data
MOV DS, AX
MOV DX, OFFSET PROGRAMA
MOV AH, 09h
INT 21h
;for 1 to 10
MOV CX, 10
REPETIR:
INC NUM ;adds 1 to the number in NUM
MOV DL, NUM
ADD DL, "0"
MOV AH, 02h
INT 21h ;prints the number
MOV DX, 0Ah ;new line
MOV AH, 02h
INT 21h ;prints the new line
LOOP REPETIR
;terminates the program
MOV AX, 4C00h
INT 21h
END
Thanks in advance for any help.