Answer to Question #318650 in Assembler for xtian

Question #318650

characters.asm: Construct an assembly language program that will accept any character then tells whether the entered character is an alphabet, a number, or a special symbol.


1
Expert's answer
2022-03-26T12:40:50-0400
; DosBox
DATA SEGMENT
msgEnter    db "Enter char: $"
msgA    db 10,"the entered character is an alphabet$"
msgN    db 10,"the entered character is a number$"
msgS    db 10,"the entered character isa special symbol$"
DATA ENDS

CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
    MOV AX,DATA
    MOV DS,AX

    mov dx, offset msgEnter
    mov ah, 9
    int 21h    
    
; wait for any key press:
    mov ah, 0
    int 16h    
    mov     ah, 0eh
    int     10h  
    
; Check char
   cmp al,'0'
   jl special            ; char < '0'
   cmp al,':'
   jl number            
   cmp al,'A'
   jl special      
  cmp al,'['
   jl alph    ;    
   cmp al,'a'
   jl special       
  cmp al,'{'
   jl alph    ;    
   jmp special
number:
    mov dx, offset msgN
    mov ah, 9
    int 21h     
      jmp      EXIT_PROG        
alph:
    mov dx, offset msgA
    mov ah, 9
    int 21h     
      jmp      EXIT_PROG    
special:
    mov dx, offset msgS
    mov ah, 9
    int 21h  
  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