Question: help with the following program. Please look at the hints that are at the end of the program. I have completed this assigment but the
help with the following program. Please look at the "hints" that are at the end of the program. I have completed this assigment but the only issue is that I was not able to make it work with a procedure function, which is required for this assigment.
PROGRAM : multiplesOfAnother Function
Write an HLA Assembly language program that implements the following function:
procedure multiplesOfAnother i: int; j : int; @nodisplay; @noframe;
This function should return into EAX the value if the parameters are multiples of one another; otherwise, return into EAX the value In order to receive full credit, you should be preventing register corruption by preserving and then restoring the value of any register your function touches. This rule applies to every register except for EAX which is being used to pass an answer back to the calling code.
Feed Me i:
Feed Me j:
EAX
Feed Me i:
Feed Me j:
EAX
Feed Me i:
Feed Me j:
EAX
Feed Me i:
Feed Me j:
EAX
Hint: Since we haven't learned how to do much math coming soon... I am assuming you will keep adding the smaller value to itself over and over again until you reach the bigger amount
Below is the code I have so far without the procedure function, which I need help implementing.
program MultiplesOfAnother;
#include "stdlib.hhf
static
i : int;
j : int;
temp : int;
begin MultiplesOfAnother;
stdout.putFeed Me i: ;
stdin.geti;
stdout.putFeed Me j: ;
stdin.getj;
pushebx;
pushecx;
pushedx;
movi ecx; Move i to ECX
movj ebx; Move j to EBX
mov eax; Initialize EAX to not multiple
cmpecx ebx;
jle checkMultiple;
checkMultiple:
movecx temp;
addecx temp;
checkLoop:
cmpebx temp;
je multipleFound;
addecx temp;
cmpebx temp;
jg checkLoop;
jmp done;
multipleFound:
mov eax; Set EAX to
done:
Restore registers
popedx;
popecx;
popebx;
stdout.putEAX ;
stdout.putieax;
stdout.newln;
end MultiplesOfAnother;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
