Wednesday, October 30, 2013

To input the number and display untill 0 is passed

;Aim:- To input the number and display untill 0 is passed

.8086
.model small
.data
msg1 db 13,10, "enter a character to be displayed:$"
msg2 db 13,10, "displaying entered character:$"
.code
START:
MOV AX,@data
MOV DS,AX
Again:LEA DX,msg1 ;loads the offset of MSG1 in dx
MOV AH,09H ;Display s string
INT 21H ;Whose offset is in dx

MOV AH,01H
INT 21H

CMP AL,30H
jz label1
MOV BL,AL


LEA DX,msg2 ;loads the offset of MSG2 in dx
MOV AH,09H
INT 21H
MOV DL,BL
MOV AH,02H
INT 21H

jmp Again
label1: MOV AX,4C00H
INT 21H
END START

;Output
enter a character to be displayed: d
displaying entered character: d

No comments:

Post a Comment