Professional Documents
Culture Documents
Assembly Programme 1 To 10 Number Write
Assembly Programme 1 To 10 Number Write
How to Done it :
Added proc dollars, to fill numstr with dollar signs (necessary to display, and to clear the
string before converting the next number).
Comment :
1. LINE BREAK.
4. IF NUM <= 10
5. we know 10 is not single carecter digit .that couse i convert number to string.
6. Display String
8. NUM++.
joy
My Code :
.MODEL SMALL
.STACK 100H
.DATA
NUM DW ?
https://github.com/codewithjoymondal/Print-1-to-10-in-
Or
; Comment no 1
lbk db 13,10,'$'
; Comment no 2
numstr db '$$'
joy .CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
;Comment no 3
MOV NUM, 1
START:
;Comment no 4
CMP NUM, 10
JBE PRINT
JMP close
PRINT:
; MOV AH,2
joy
;
;
MOV DL,NUM
INT 21H
; Comment no 5
call number2string
;Comment no 6
mov ah, 9
int 21h
;Comment no 7
mov ah, 9
int 21h
joy
;Comment no 7
INC NUM
JMP START
close:
MOV Ax,4C00H
int 21h
MAIN ENDP
number2string proc
call dollars
mov bx, 10
mov cx, 0
joymondal1:
mov dx, 0
div bx
joy
push dx
inc cx
cmp ax, 0
jne joymondal1
joymondal2:
pop dx
add dl, 48
mov [ si ], dl
inc si
loop joymondal2
ret
number2string endp
proc dollars
mov cx, 5
joy
mov di, offset numstr
dollars_sign:
mov [ di ], bl
inc di
loop dollars_sign
ret
endp
END MAIN
joy
OutPut
joy