Write a program using the XLAT instruction that will read a letter from the keyb
ID: 3807972 • Letter: W
Question
Write a program using the XLAT instruction that will read a letter from the keyboard mat is one of the first 9 letters (a through i) and will output a number 1 through 9 output the number 1 if it is the letter a, output the letter 2 if it is the letter b, etc. Results: Explain how the program works. Reference for reading from the keyboard. A program to get a character from the keyboard (without testing 4 a character is ready) and place that character in location 400 is as follows: Reference for writing to the screen.Explanation / Answer
START SUB AH,AH //CLEAR AH; TO GET INPUT FROM KEYBOARD
INT 16H // INTERUPT TO GET INPUT FROM KEYBOARD
AND AL,F0H // MASKING THE HIGHER NIBBLES OF AL
MOV DL,AL // MOVING THE CHARCATER TO DL FROM WHICH THE CONSOLE WILL PRINT
JZ START // IF THE INPUT IS GREATER THAN J THEN START AGAIN
SUB AL,09 // SUBTRACT 9 FROM AL
JNS START // JUMP IF NOT NEGATIVE TO START
MOV AH,02 // INITIALIZING AH TO PRINT MODE
INT 21H // INTERUPT TO PRINT
STOP // END OF PROGRAM
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.