Assembly Program To Find Predecessor Of Given Character

printstring macro msg
mov ah, 09h
mov dx, offset msg
int 21h
endm

data segment
cr equ 0dh
lf equ 0ah
msg1 db 'Enter a character','$'
msg2 db cr,lf,'The predecessor of char is : ','$'
data ends

code segment
assume cs:code, ds:data
start:
        mov ax, data
        mov ds, ax
        printstring msg1
                mov ah, 01h
                int 21h
                mov bl, al
        dec bl
        printstring msg2
                mov ah, 02h
                mov dl,bl
                int 21h
        mov ax, 4c00h
        int 21h
code ends
        end start

Leave a comment