char.asm: Construct an assembly language program that will accept either an upper case or a lower case letter then shows what the previous and next letter is.
DATA SEGMENT
msgEnter db "Enter char: $"
msgNewLine db 0ah, 0dh,"$"
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
MOV ES,AX
mov dx, offset msgEnter
mov ah, 9
int 21h
; wait for any key press:
mov ah, 0
int 16h
mov bl, al ; save char
mov ah, 0eh
int 10h
mov dx, offset msgNewLine
mov ah, 9
int 21h
mov al,bl ; restore char
dec al ; pre
mov ah, 0eh
int 10h
mov al,bl ; restore char
inc al ; next
mov ah, 0eh
int 10h
_quit:
MOV AH,1 ; Waiting for a key press
INT 16H
EXIT_PROG: ; Program is terminated
MOV AH,4CH
INT 21H
CODE ENDS
END START
Comments
Leave a comment