Simulation (Stage 4) -- Optimal simulation procedure for Task 1 |
Follow the directions given previously to down load the executable file e1final.out. With the
addition of the label START, the SDS simulator will be able to automatically bring your code
into the Source window and to load up the program counter (PC) with the correct start of this
code segment.
Activate the GO button (or the F5 function key) and you will see that the code will run and
then stop at the TRAP instruction introduced into the code.
Activate the RESET button and note that the program counter (in the Register window) and Source windows are automatically reset to the start of our code.
Since you have modified the source code to add useful variables/label names, you will now be able to quickly access the corresponding memory locations using the SDS Memory window.
The fact that we have made the mycode program segment a subroutine makes no difference if we are simply interested in the final result of executing our code segment. However it makes an important difference if we are interested in "single-stepping" through our code to see how each instruction functions.
RESET the processor and activate the STEP button (or the F10 function key). Note that when the simulator gets to the subroutine call (JSR mycode), the simulation simply executes all of the subroutine instructions without pausing. This is a very useful feature as often you want to just get the result from a subroutine rather than worry about all its gory details. To check that the subroutine is actually entered, activate a BREAKPOINT at the start of the mycode segment in the way discussed earlier. Check that the simulation gets into and stops in the subroutine.
Clear the BREAKPOINT if still set, and RESET your simulation. Rather than activating the STEP button to move through the code, activate the STEP-IN button (or the F8 function key). Note that now the simulator will "step-in" to the subroutine and show the operation of each instruction.
WARNING:- I found that on the SDS6.4 version of the simulator that the STEP-IN operation "sometimes" seemed to do the exact opposite to what was expected. Rather than stepping into the subroutine, activating this button meant the code executed until the final TRAP instruction.
This erratic behavior seems to be fixed in the 6.5 simulator release. In case you do still come across the problem during your experiments, simply add a BREAKPOINT at the end of each subroutine.
![]() |
Last modified: July 01, 1996 09:53 PM by M. Smith.
Copyright -- M. R. Smith