User documentation

Version 0.39

1. Brief description

Random Access Stored Program machine (RASP) is an abstract von-Neumann computer. It means it does not represent a physical device, but ranther it is intended to work as a model to study von-Neumann architecture, without the need to care about specific manufacturer’s hardware details.

Firstly, it is usefull to present Random Access Stored Program (RASP) machine’s architecture — it is schematically depicted in the following figure.

RASP architecture

As we can see, the control unit, i.e. processor, reads data from the input tape and writes results of executed operations onto the output tape. The tapes serve as a form of I/O devices. The two heads — reading ® and writing (W), are pointers to current reading/writing position.

As already stated, RASP machine represents a von Neumann computer. This implies that the operating memory exists as a single unit in which both program and data can reside. The segment containing the program is organised in the way that two adjacent cells contain instruction/operand alternately. The memory can be read as well as written to by the control unit.

2. Installation and run

There is no need to download/install RASP separately as it is included in the emuStudio distribution. Here is the structure of the directories containing the files neccessary for our RASP virtual computer:

2.1. Directory structure

  • config/RASP.conf: configuration file of RASP architecture.

  • compilers/raspc-rasp.jar: RASP compiler plug-in.

  • cpu/rasp-cpu.jar: RASP CPU emulator - CPU plug-in.

  • mem/rasp-mem.jar: RASP main memory plug-in.

RASP virtual computer in emuStudio uses with tapes as I/O devices. For this purpose, abstractTape-ram.jar plug-in is used (© P. Jakubčo).

2.2. Abstract schema

Each virtual computer in emuStudio is defined by so called 'abstract schema' (please see emuStudio User documentation). It defines all the parts of its architecture (what it consists of) and inner communication (how architecture components are interconnected). Following figure presents RASP abstact schema:

RASP abstract schema

3. Compiler raspc-rasp

RASP compiler is included in the architecture of RASP virtual computer in emuStudio. Its purpose is to translate source code of a RASP program into the form executable by the RASP CPU emulator.

It includes lexical analyzer which is responsibe for recognising lexical units within the source code. It also enables syntax highlighting. Then, the code goes through syntax analysis which checks for syntax errors and builds up the syntactic tree. The tree is then passed through and binary code executable by the emulator is generated.

As with the other emuStudio compilers, you start the compilation by the "Compile source" icon in the main menu. The result of the compilation is saved into a binary file with the .bin extension and also loaded into the RASP operating memory.

3.1. Installation and run

RASP compiler plugin is already included in emuStudio distribution, in location compilers/raspc-rasp.jar.

3.2. Language syntax

3.2.1. Program start definition

As RASP is a von-Neumann computer, both the program and the data reside in the same memory module. Therefore, we need to clearly specify, where the program start address is as CPU must know where to start emulation. We do so by the org directive followed by a positive ineteger. Program start definition must be the first line of the source code. Please, do not place any empty lines before it. Here, an example follows:

org 5

If you do not specify the program start address, or if you set it to 0 (org 0), the default pre-set value will be used, which is 20. The compiler will warn you about this, so do not worry. Setting program start to 0 is not allowed as register R0 is used as the accumulator and therefore any instruction written here would be overwritten sooner or later.

3.2.2. Supported instructions

All RASP emulator supported instructions together with their semantics are available in the RASP CPU documentation. There are three types of operands of those instructions:

  • register - e.g. READ 1

  • constant - e.g. WRITE =2 - you specify that operand of an instruction should be interpreted as a constant by the = character.

  • label, which is operand of jump instructions (JMP, JZ, JGTZ), e.g. JMP label

3.2.3. Line of code structure

Each RASP instruction with its operand MUST be on a separate line, otherwise the code will not compile.

A single line of code consists of instruction followed by its operand. The line can be optionally started with a label. It is possible to put the label and the instruction on two separate lines, however, please, do not place any empy lines between the label and the instruction.

Example (WRITE 2 can be on a separate line):

labelName: WRITE 2


RASP compiler supports one-line comments. You start them with a semicolon (;):

;this is a comment

You can append a comment to an existing line, e.g.

write 2 ;comment

or put it on a completely new line.

4. CPU rasp-cpu

RASP CPU is the core of the RASP virtual computer. Its purpose is to execute RASP program composed of RASP instructions which is stored in the RASP memory. The CPU is therefore connected with the memory.

To run 'interactive' RASP programs (programs reading user input and writing something to the output), input and output tapes are needed. They are included there in default RASP configuration.

4.1. Installation and run

RASP CPU plugin is already included in emuStudio distribution, in location cpu/rasp-cpu.jar.

4.2. Supported instructions

RASP CPU emulator supports the following instructions:

Table 1. RASP instructions
Operation code Instruction mnemonic code Semantics



finish program execution



read from input tape into register Ri



write constant i onto the output tape



write the content of the register Ri onto the output tape



load the accumulator (register R0) with the i constant



load the accumulator (register R0) with the content of Ri register



store the accumulator (register R0) content into register Ri


ADD =i

increase accumulator (register R0) value by constant i



increase accumulator (register R0) value by the value of register Ri


SUB =i

decrease accumulator (register R0) value by constant i



decrease accumlator (register R0) by the value of register Ri


MUL =i

multiply accumulator (register R0) by constant i



multiply accumulator (register R0) by the value of register Ri


DIV =i

divide accumulator (register R0) by constant i



divide accumulator (register R0) by the value of register Ri



set instruction pointer (IP) to the address pointed to by the label l


JZ l

set instruction pointer (IP) to the address pointed to by the label l if value of the accumulator (register R0) is zero (R0 = 0)



set instruction pointer (IP) to the address pointed to by the label l if value of the accumulator (register R0) is greater than zero (R0 > 0)

4.3. CPU Status panel

There is a simple GUI window provided for the RASP CPU. It displays the two most important values:

  • current value of the accumulator (R0 register)

  • current value of the instruction pointer (IP) which points to current position within the executed program

Also, information about the current RUNNING STATUS is displayed.

Following figure shows a screenshot:

RASP CPU status panel

5. Memory rasp-mem

RASP memory plug-in serves as the main store (operating memory) for the RASP virtual computer. As already mentioned in the introduction of this manual, RASP is an example of von-Neumann architecture, which implies that both program and data reside in the same memory module.

After compilation of a RASP source code file the compiled program is loaded into here. During the process of the emulation, the CPU plug-in reads instructions an their operands and writes results of the operations from/to the memory.

5.1. Installation and run

RASP memory plugin is already included in emuStudio distribution, in location mem/rasp-mem.jar.

5.2. Graphical user interface (GUI)

During the emulation, user can view current content of the operating memory in a simple GUI window:

Memory GUI window

It is also possible to load a compiled memory image from a file by clicking on the OPEN icon:

OPEN icon

After that, you can choose the binary file you want to load.

By clicking on the CLEAN icon, you can clean the entire memory content:

CLEAN icon

The table with memory cells content is editable. By double-clicking on a row you can simply edit the value. You confirm your changes by the ENTER key.

If you edit a cell that contains an instruction, you edit its operation code, e.g. if a cell contains the ADD = instruction (operation code 7) and you change the cell to 9, the operation code will be overwritten. As a result, the instruction changes to SUB =. It means that you cannot write number 9 as a data item here, only as an operation code.