1. Write a program ArrayToStack which copies (ie, pushes) the N
elements of an array, Vector, onto the runtime stack. Vector is an array of
unsigned double-word integers.
2. Write a program StackToArray which copies back to Vector the
last N double-word elements pushed onto the stack (by some piece of code such as
ArrayToStack). StackToArray should not reverse Vector (that is, the
elements should return to their initial positions as before the execution of
3. Write a program StackReverse which uses the runtime stack to
reverse an array Vector of N unsigned double-word integers.
4. To test these three programs, your main program should display the
following interaction with you (things in reds are your inputs). Fix the maximum
size of the array to be N = 20; thus, your runtime stack will never overflow .
1. Write a procedure called HexOutput that displays the content of
register EBX as a hexadecimal string. See the algorithm’s pseudocode in Slide-51
of Chap_06 (Lecture-9). A full solution for the binary case (BinOutput) also
appears in Slide-48 and Slide-49 of Lecture-9 (I have explained and traced this
solution in classroom).
For example: If EBX contains 1111 1110 0000 0001 1100 1000 0011 0111, then
the procedure HexOutput should display the hexadecimal string “FE01C837h”;
note: make sure that character ‘h’ is displayed at the end.
2. Write a procedure called HexInput that loads the register EAX with
the numerical value of the hexadecimal string entered at the keyboard. See the
algorithm’s pseudocode in Slide-52 of Chap_06 (Lecture-9). A full solution for
the binary case (BinInput) also appears in Slide-50 of Lecture-9 (I have
explained and traced this solution in classroom).
For example: EAX is loaded with 1111 1110 0000 0001 1100 1000 0011 0111,
when the procedure HexInput reads the hexadecimal string “FE01C837h”;
note: make sure that character ‘h’ is the last character read from keyboard.
3. To test these two procedures above, your main program should first
ask you “What do you want to do, Lovely?”.
1. If you type the letter W (or w) then the main program reads an unsigned
32- bit decimal number from the keyboard, and loads the number into
EBX, and then calls the procedure HexOutput (which displays a
2. If you type the letter R (or r) then the main program calls the procedure
HexInput (which reads a string from the keyboard, then loads it into
EAX), and then displays the binary content of register EAX.
It exits with the message “Get Lost, you Sweetey Honey Bun” when you type anything
else . In 3.1 and 3.2, above, the main program exits with “Thank you, Sweetey Honey
2 freelancer chào giá trung bình$48 cho công việc này
I have read your details about the project and that suits me a lot, l have earned certificate in c, programming , Assembly language and many more... I look forward to working with you ...