Write an program in assembly language to read a letter entered by a user. The pr
ID: 3702712 • Letter: W
Question
Write an program in assembly language to read a letter entered by a user. The program should display an enlarged version of a given letter on the screen. The program should also do the following:
Clear the screen and change the screen colour to yellow on blue
Change the cursor position to row 10, column 0
Prompt the user to key in an upper case letter (A-E). Read the letter from the keyboard.
Test whether the letter is in range (A, ..., E). Display an error message if the letter is out of range and terminate the program.
Display an enlarged version of the letter on the screen.
Define a bit pattern for each letter and use this pattern to display the individual lines:
For example: for the letter B displayed, you should define a string of 7 hex numbers, one hex number for each line.
To display the first line, step through the bit pattern, displaying a space if the bit is equal to zero and displaying a '$' otherwise. Write a carriage return and line fees to the screen and move to the pattern for the next line. Display all 7 lines of the enlarged letter.
Example: if the user enters B, the following pattern is displayed:
Enlarged Letter Bit Pattern Hex Number Line Number
$$$$ 11110 1E 1
$ $ 10001 11 2
$ $ 10001 11 3
$$$$ 11110 1E 4
$ $ 10001 11 5
$ $ 10001 11 6
$$$$ 11110 1E 7
Mark allocation: clearing screeen , changing screen colour and setting cursor position (3)
displaying user prompt (1)
Readig the letter (ASCII character) (2)
testing the range and displaying an error message if the letter is out of range (3)
definition of bit patterns (5)
displaying the lines corresponding to the bit pattern of the letter entered (6)
A program listing submitted (5)
Three screen shots of test cases submitted (3x5)
program structure (5)
program documentation / comments (5)
Explanation / Answer
To Get the input from the user and display on the screen in an enlarged form and change the color to Yellow on Blue
.model small
.stack 100h /* Allocates 100 bytes for SS*/
.data
.code
main proc
/* video Mode for getting an enlarged letter*/
mov ah,0
mov al,12h
int 10h
mov ah,02h
mov dh,10
mov dl,40
int 10h
mov ah,1 /* accepts character or letter from the user*/
int 21h /*interrupt*/
mov ah,09h /* output message*/
mov bl,0e1h /*color change*/
mov cx,1 /* count for display*/
mov dl,al /* copies the contents of al to dl to display onto the screen*/
mov ah,2
int 21h
mov ah,4ch
int 21h
mov ah,03h /* clears the screen and sets the cursor on top*/
mov bl,1
mov dh,10
mov dl,0
int 10h
main endp
end main
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.