Generic Stack Assembly Language Simulation

written by Teresa Carrigan


Run model in your browser


Top

HOW TO USE IT

First, choose the program to load. This model comes with four sample programs, but you can choose to type in your own program or load a program that has been saved to a textfile. Please note that an applet can't load a textfile.

The contents of all the memory locations will be randomized, based on the random-memory slider. For example, if the slider is set at 25, each memory location will contain a random number from -25 to +25. Changing this slider only effects the model when setup is pressed.

Click setup to load the program and display the stack machine. You may now click either Step or Run to show the animation.

Step animates the current line of the program loaded. You can press this repeatedly until the program halts or runs out of lines to be executed.

Run animates the remainder of the program loaded. To run it again, you must press Setup.

Interrupt sets an interrupt flag, and when the current fetch-execute cycle finishes, the cycle stops until either the step or run button is clicked. The next instruction will be the one that would have been processed if the interrupt had not occurred.

Reset allows you to clear everything and start from scratch. Setup is supposed to do this for you.

What-to-show lets the user decide what the labels of the turtles and patches will show. For example, if set at "contents" then the memory locations will show their contents, if set at "address" then the memory locations will show their addresses, and if set at "expression" then the stack items and memory locations will show algebraic expressions that have been used to calculate the values stored in them. When you make a change in What-to-show, press the "change what shows" button to activate the change. If you do not press the button, eventually the stack machine will notice and activate the change for you.

The Slow-me-down slider allows the user to adjust the animation speed. At zero, the program runs so fast that you only see the final display. If you are testing a program, then .05 is a good setting. If you are studying the fetch-execute cycle or how a stack machine works, then .1 or higher would be better.

The Console monitor gives messages about what is happening, including any error messages. The Explanation monitor gives the steps of the fetch-execute cycle as they are happening.


Home

Applets on this website were written by Teresa Carrigan in 2004, for use in computer science courses at Blackburn College, with the exception of the Fireworks applet. The applets made with NetLogo require Java 1.4.1 or higher to run. The applets made with NetBeans require Java 1.4.2 or higher to run. Applets might not run on Windows 95 or Mac OS 8 or 9. You may obtain the latest Java plugin from Sun's Java site.