Question: In Assembly Language Programming using DosBox I have the following code I just need to add a function that displays and classifies the entered character

In Assembly Language Programming using DosBox

I have the following code I just need to add a function that displays and classifies the entered character in number, letter or symbol. Example if the user enters A then the programs displays: A - letter, 3 - number, & - symbol and let the user decide if the programs ends or not. The following is the code I have right now:

.MODEL SMALL

.STACK

.DATA

STRING db "Enter a character: ",13,10,13,10,'$' CHARACTER db ? TYPE db "unknown",13,10,'$'

.CODE MAIN PROC MOV AX, @DATA MOV DS, AX

; your code goes here

call SHOW_STRING

call READ_CHARACTER

mov dl, CHARACTER cmp dl, '0' jl SYMBOL cmp dl, '9' jg SYMBOL mov TYPE, "number",13,10,'$' jmp DISPLAY

SYMBOL: cmp dl, 'A' jl SYMBOL2 cmp dl, 'Z' jg SYMBOL2 mov TYPE, "letter",13,10,'$' jmp DISPLAY

SYMBOL2: cmp dl, 'a' jl UNKNOWN cmp dl, 'z' jg UNKNOWN mov TYPE, "letter",13,10,'$' jmp DISPLAY

UNKNOWN: mov TYPE, "symbol",13,10,'$'

DISPLAY: call WRITE_CHARACTER

mov dx, offset TYPE mov ah, 9 int 21h

call CLEAR_KEYBOARD_BUFFER

MOV AX, 4C00h INT 21h

MAIN ENDP

;***********************************************************************************

SHOW_STRING PROC mov dx, offset STRING ; write all characters mov ah, 9 ; in the standard output int 21h ; DX has the offset of the first character RET ; the last character must be '$' SHOW_STRING ENDP

;***********************************************************************************

WRITE_CHARACTER PROC mov ah, 2h ; write a character to standard output mov dl, CHARACTER ; DL has the character int 21H

mov dx, offset TYPE mov ah, 9 int 21h

RET WRITE_CHARACTER ENDP

;***********************************************************************************

READ_CHARACTER PROC mov ah, 8h ; read a character without echo from standard input int 21h ; AL stores the character read

mov CHARACTER, al RET READ_CHARACTER ENDP

;***********************************************************************************

CLEAR_KEYBOARD_BUFFER PROC mov ah, 0bh ; check standard input status int 21h ; AL = 0 if input buffer is empty

cmp al, 0h ; jz CLEARED ; are there no more characters in the standard input

NEXT: call READ_CHARACTER

mov ah, 0bh ; check standard input status int 21h ; AL = 0 if input buffer is empty

cmp al, 0h ; jnz NEXT ; are there more characters in the standard input CLEARED: RET CLEAR_KEYBOARD_BUFFER ENDP

end MAIN

I have the following problems:

asig3.asm(11): warning A4016: Reserved word used as symbol: TYPE asig3.asm(29): error A2010: Syntax error asig3.asm(37): error A2010: Syntax error asig3.asm(45): error A2010: Syntax error asig3.asm(49): error A2010: Syntax error

51036 + 438836 Bytes symbol space free

1 Warning Errors 4 Severe Errors

Need help finishing the code and fixing the warning and errors

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!