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

  1. Initialize X=0
  2. Set loop counter to 4
  3. Multiply X by 10
  4. Get Digit from Keyboard (it will be in ASCII)
  5. Convert ASCII digit to a number (by subtracting 30h from it)
  6. Add Number to X
  7. Go to Step 3; You may use the LOOP instruction for this

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!