Saturday, 9 August 2014

Printing numbers from 0-9 (8086)

Here is a program to print the number from 0-9 for the 8086 architecture. If you have any doubts please let me know.

.MODEL SMALL
.DATA
MSG1 DB 0AH,0DH,'0 TO 9: ',0ah,'$'
MSG DB 0AH,0DH,'9 TO 0: ',0ah,'$'

.CODE
START:
MOV AX,@DATA
MOV DS,AX

LEA DX,MSG1
MOV AH,09H
INT 21H

MOV BX,0000H
MOV CX,000AH
ADD BL,30H
CONT:MOV DL,BL
MOV AH,02H
INT 21H
INC BX
LOOP CONT

LEA DX,MSG
MOV AH,09H
INT 21H

MOV CX,000AH
DEC DX
CONT1:MOV DL,BL
MOV AH,02H
INT 21H
DEC BX
LOOP CONT1
.EXIT
END START

No comments:

Post a Comment