Write a HLA(Higher Assembly Langauge) (not assembly language) program to read so
ID: 2887418 • Letter: W
Question
Write a HLA(Higher Assembly Langauge)(not assembly language) program to read some numbers.
The program saves the number into heap memory.
The program stops when a zero is entered.
Program displays the numbers in the order of input in a single line.
? Use the heap memory (not stack) for the data.
? You may use stack for some individual instructions.
? After allocating memory, make sure that that:
? You save EAX, so you can retrieve its original value whenever is needed.
? EAX will be used by HLA for many other things.
? Make sure that you release the allocated memory before ending the program.
Need HLA (Higher Level Assembly!!!!!) program, not assembly language, they are not the same!!!
Student Name Project 4 Enter a pos1tiue numbe to stop 15 Enter a positiue numbeto stop: 67 Enter a positive number, to stop 23 Enter a pos1tiue numbe to stop 3 Enter a positive number. to stop: 90 Enter a positiue number to stop: 56 Enter a positive number, 0 to stop: 87 Enter a pos1tiue numbe to stop51 Enter a positiue numbeto stop: 44 Enter a pos 1tlue numbeto stop Enter a p Enter a positive number. to stop: 98 Enter a positiue number to stop- * Enter a positive number, 0 to stop: i ositive number. 0 to stop: 65 6 45 67 23 3 90 56 87 51 44 49 65 98 79 Student Name - End of Project 4Explanation / Answer
program readIntsToHeap;
#include( "stdlib.hhf" );
type
IntArray : array.dArray ( int32, 1 );
var
i32 : int32;
static
NumArray : array.dArray ( IntArray, 1);
begin readIntsToHeap;
mov ( 0, eax );
array.daAlloc ( NumArray, 50_000 );
array.index ( ebx, NumArray, 1 );
repeat
stdout.put ( "Enter a positive number, 0 to stop: " );
stdin.geti32 ();
mov ( eax, [ebx] );
add ( 4, ebx );
until ( eax = 0 );
array.index ( ebx, NumArray, 1 );
repeat
mov ( [ebx], eax );
add ( 4, ebx );
mov ( eax , i32 );
stdout.puti32 ( i32 );
stdout.put(" ");
until (eax = 0);
array.daFree ( NumArray );
end readIntsToHeap;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.