Answer to Question #318590 in Assembler for xtian

Question #318590

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.


1
Expert's answer
2022-03-26T12:41:08-0400
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS