Graphical Assembler Simulator Program (GASP)

Application to help you to learn assembly language

Requiring nearly 3000 lines of code, Peter Hearnshaw's Graphical Assembler Simulator Program (GASP) is his most substantial contribution and also the one which is likely to achieve the greatest use. GASP simulates the processing of assembler programs written in code based on Intel syntax. You can follow the flow of instructions and data through the registers as shown by the highlighting of the active link in red. The program should help you to remember the purposes of registers and flags and also prepare you for our tutorial on Pascal in-line assembler. GASP is loosely based on JASPer, but is simpler and easier to use.

The following screenshot shows GASP as it appears when you double click on GASP.exe (available in the zip download below).

GASP at start-up

GASP at start-up

We have tabulate the uses of the special-purpose registers PC (program counter), MAR (Memory Address Register), MDR (Memory data register) and CIR (Current Instruction Register) on the next page. We also describe how you can use the general purpose registers AX and BX.

In order to use the program, you will need to know the instruction set and the syntax for GASP. We have reproduced one of its help files on our page entitled How to use GASP. On the same page we provide instructions for using Peter's own graphical user interface with buttons, a text box, message box and file dialogues.

Peter supplies some sample programs and also some challenges. We have one page showing the challenges and another for his solutions. (We hope you will be able to write suitable assembler code without resorting to these solutions). We would be grateful for suggestions for other challenges to add to the collection.

Finally, we show the code of program GASP and its six units. You can examine the code to see the large number of specific, helpful error messages that Peter provides. See before the code of unit instructionslvl2 a table containing some of the intricate planning that was necessary for the highlighting of links.

Students have already tested GASP and have found it to be robust. (Peter had included automated testing among his own rigorous testing methods). They used it as an enjoyable way to learn and appreciated the specific error messages explaining any of their syntax errors. The most able amongst you might like to try to extend it to handle one or more of the following:
  • indexed addressing;
  • negative integers;
  • space for more than 25 instructions.
Anyone that enhances GASP will appreciate Peter's thoroughly commented code and his use of meaningful identifiers throughout. Please inform us if you manage to add significant functionality.


You can download a zip file (only 187KB) containing the source code, project information, help files, sample assembler programs and GASP.exe. Unzip all the files to the same directory.

In order to develop this program, you will need to have downloaded Stefan Berinde`s file as described in our Graphics tutorial. You should copy the unzipped wincrt.pas, wingraph.pas and winmouse.pas (from the src folder) into your program folder.

Programming - a skill for life!

Fourteen programs (with five web versions) including 3D-Driving, GASP and Knowledge by Peter Hearnshaw