Answer to Question #349171 in Assembler for hshskwosi

Question #349171

Create an assembly program that would check if the input character is a numeric character. alphabet (letter) or a special character.




HINT: Each character has a corresponding decimal and hex values in the ASC table. Use ASCII table.

1
Expert's answer
2022-06-09T09:58:48-0400
DATA SEGMENT
    EnterCh    db "Char: $"
    AlphCh        db " - character is an alphabet$"
    NumberCh    db " - character is a number$"
    SpecialCh    db " - character isa special symbol$"
DATA ENDS

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

    mov dx, offset EnterCh
    mov ah, 9
    int 21h    
    
; wait for any key press:
    mov ah, 0
    int 16h    
    mov  ah, 0eh
    int  10h  
    
   cmp al,'0'
   jl special            ; if char < '0' ->special
   cmp al,':'    
   jl number            ; if char < ';' ->number        
   cmp al,'A'    
   jl special        ; if char < 'A ' ->special  
  cmp al,'['
   jl alph    ;    
   cmp al,'a'
   jl special       
  cmp al,'{'
   jl alph    ;    
   jmp special
number:
    mov dx, offset NumberCh
    mov ah, 9
    int 21h     
      jmp      EXIT_PROG        
alph:
    mov dx, offset AlphCh
    mov ah, 9
    int 21h     
      jmp      EXIT_PROG    
special:
    mov dx, offset SpecialCh
    mov ah, 9
    int 21h  
  EXIT_PROG:            ; Program is terminated
     MOV AH,4CH
     INT 21H

CODE ENDS

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