Modify the Wombat 1 computer to Wombat 2 by adding Stack.
The stack has two operations: which are “Push” and “Pop”. Add a stack, a new stack pointer register, push and pop machine instructions to make Wombat 2 computer. Please note that the push operation will push a value from the main memory to the stack while the pop operation will pop a value from the stack to the main memory.
Also, add “call” and “return” machine instructions. “call” instruction will allow the subprogram to be called, whereas “return” instruction will allow the subprogram to end and return to main program.
Write a complete Wombat 2 assembly language program.
The main program should take a positive number as input and call first subprogram to calculate the radix 4 representation for that number and the second program will display the result. The radix 4 calculation should use stack.
Comments
Leave a comment