Question
Write an assembly program that receives the variables X and Y from the keyboard instead of being hard coded in the program. They are used
Write an assembly program that receives the variables X and Y from the keyboard instead of being hard coded in the program. They are used in the following computation to determine W which is then printed on the screen. You may not use any library functions. Only low level software interrupt functions can be used.Your program should be able to handle up to 4 digit unsigned decimal numbers for X and Y.
----------------------- CODE STARTS
[ int W;
Lines of Code to input X from the Keyboard
Lines of Code to input Y from the Keyboard
W = Y * 160 + X * 2
Lines of code to output W to the screen.]
-----------------------CODE ENDS
NOTES:
*Declare variables for strings in the data area. For instance
inputX BYTE Input X=, $
inputY BYTE Input Y=, $
outputW BYTE Output W=, $
newline BYTE 0dh, 0ah, $
*Here are some detailed steps to help you input variable X from the keyboard based on above algorithm
- Initialize X=0
- Set loop counter to 4
- Multiply X by 10
- Get Digit from Keyboard (it will be in ASCII)
- Convert ASCII digit to a number (by subtracting 30h from it)
- Add Number to X
- Go to Step 3; You may use the LOOP instruction for this
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started