You are on page 1of 2

Qn 2 Codes:

title OTL
.model small
.stack 100h
.data
arry db 127 dup(0)
msg1 db "You have enter the number which have ASCII code less than 32.$"
msg2 db "You have enter the number which have ASCII code greater than 127.$"

.code
extrn writeint:proc

main proc
mov ax, @data
mov ds, ax

;Insert ASCII codes for values in an array


mov bx, offset arry
mov cx,127
mov si, 0h
intl:
add [bx],si
inc si
inc bx
loop intl

;Input a character from DOS window


mov ah,0h
int 16h
mov cx,ax

;Comparing the character with ASCII codes in lookup table.


lea bx,arry
xlat ;retrive ASCII code from the table where al = content of [ds:bx+al]
cmp al,20h
jl msgndogo
jmp mwisho

msgndogo:

lea dx,msg1
mov ah,9
int 21h

mwisho:
mov ax, 4c00h
int 21h
main endp
end main

You might also like