Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How to solve maths problems with examples

Answered: 1 week ago