Question: im learning assembly language ASM and i need to implement the following in the program provided Program: Objectives: Students will learn to use Registers to
im learning assembly language ASM and i need to implement the following in the program provided
Program:
Objectives: Students will learn to use Registers to do Step by Step ASM Instructions
& ; .386 .model flat, stdcall .stack 4096 ExitProcess PROTO ,dwExitCode:DWORD INCLUDE Irvine32.inc ;This is a comment ;The following is group comment delimited with & COMMENT & INCLUDE c:\irvine\Irvine32.inc include c:\irvine\macros.inc includelib c:\irvine\irvine32.lib includelib c:\irvine\kernel32.lib includelib c:\irvine\user32.lib &
.data Result DWORD ? .code main proc mov ebx,2 ;ebx=2 inc ebx ;ebx++ i.e. ebx=ebx+1 add ecx,2 ;ecx=ecx+2 mov eax,ebx ;eax=eax+ebx add eax,ecx ; eax = eax+ecx mov ebx,eax ;ebx=eax mov eax,ebx dec ebx sub eax,ecx ; eax=eax-ecx add eax,ebx ;eax=eax+ebx mov Result,eax ;Result= eax invoke exitprocess,0 ;EXIT TO OS main endp
end main



Procedure: Write an assembly program that receives the variables X and Y from the keyboard instead of being hard coded in the program. It then used in the following computation to determine W which is printed on the screen. loc DD W DW Sum DW 0 0 0 Lines of Code to input X from the Keyboard Lines of Code to input Y from the Keyboard loc = Y * 160 + X * 2 Y = 1000 Y = Y -1 Sum = loc/16+ Y +Y/4 + Y/200 W = Sum % 7+5 A typical session will look like the following Input X=1 Input Y= 1 Output W=7 Input X= 19 Input Y=63 Output W=6 HINTS: Declare variables for strings in the data area. For instance inputX db Input X=, '$' inputY db Input Y=", S' output W db Output W=", ($' Notel: You may not use any library functions. Only DOS/BIOS functions can be used. Note2: Your program should be able to handle up to 4 digit unsigned decimal numbers for X and Y but instructor will test it for any two digit numbers. Testing: Be sure to test your program before you demonstrate it to your lab instructor. Procedure: Write an assembly program that receives the variables X and Y from the keyboard instead of being hard coded in the program. It then used in the following computation to determine W which is printed on the screen. loc DD W DW Sum DW 0 0 0 Lines of Code to input X from the Keyboard Lines of Code to input Y from the Keyboard loc = Y * 160 + X * 2 Y = 1000 Y = Y -1 Sum = loc/16+ Y +Y/4 + Y/200 W = Sum % 7+5 A typical session will look like the following Input X=1 Input Y= 1 Output W=7 Input X= 19 Input Y=63 Output W=6 HINTS: Declare variables for strings in the data area. For instance inputX db Input X=, '$' inputY db Input Y=", S' output W db Output W=", ($' Notel: You may not use any library functions. Only DOS/BIOS functions can be used. Note2: Your program should be able to handle up to 4 digit unsigned decimal numbers for X and Y but instructor will test it for any two digit numbers. Testing: Be sure to test your program before you demonstrate it to your lab instructor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
