We planned to upgrade GitLab and Mattermost to the latest version this Friday morning (early). You may experience some downtime!

Commit c9964a66 authored by thomas@cs.ru.nl's avatar thomas@cs.ru.nl

* Added short info on heap and heappointer to info

* Consistent usage of 'stack pointer' vs 'stackpointer' (and alike)
* Start directory for opening files is location of .jar and not the user's home directory
* Fixed structure comments for STMH instructions with size 1
parent e4ea178c
# General help info for Simple Stack Machine
registers=Eight registers are available, some of which have a specific purpose. A register is private location in a processor, often faster accessible then external memory. Currently the Program Counter (PC), Stack Pointer (SP), Mark Pointer (MP) and Return Register (RR) as well as freely usable scratch registers are available, respectively identified by numbers 0..7. Registers are identified by the name R<x>, where <x> is the register number. Register with a specific purpose are also named with the name indicating their purpose.
registers=Eight registers are available, some of which have a specific purpose. A register is private location in a processor, often faster accessible then external memory. Currently the programcounter (PC), stackpointer (SP), markpointer (MP), heappointer (HP), and return register (RR) as well as freely usable scratch registers are available, respectively identified by numbers 0..7. Registers are identified by the name R<x>, where <x> is the register number. Register with a specific purpose are also named with the name indicating their purpose.
PC=The Program Counter (PC) is used to remember what the current next instruction is. It contains the address (i.e. points to) the location of the next instruction. The machine fetches an instruction from the location pointed to by the PC. After each fetch it is automatically updated to point to the next instruction.
PC=The programcounter (PC) is used to remember what the current next instruction is. It contains the address (i.e. points to) the location of the next instruction. The machine fetches an instruction from the location pointed to by the PC. After each fetch it is automatically updated to point to the next instruction.
programcounter=@PC
SP=The Stack Pointer (SP) is used to push and pop values for usage in expression evaluation. The Stack is also used to store variables. These are often accessed via the MP.
SP=The stackpointer (SP) is used to push and pop values for usage in expression evaluation. The stack is also used to store variables. These are often accessed via the MP.
stackpointer=@SP
MP=The Mark Pointer (MP) is used to access local variables, allocated on the stack. Each variable is accessed using a displacement relative to the MP.
MP=The markpointer (MP) is used to access local variables, allocated on the stack. Each variable is accessed using a displacement relative to the MP.
markpointer=@MP
RR=The Return Register (RR) is used to return a value without placing it on a stack. Strictly seen this is not necessary but a convenience, since values also can be passed via the stack.
HP=The heappointer (HP) is used to remember the next free address of the heap. After every store to the heap, the heappointer is incremented with the size of stored values.
heappointer=@HP
RR=The return register (RR) is used to return a value without placing it on a stack. Strictly seen this is not necessary but a convenience, since values also can be passed via the stack.
return register=@RR
instruction=An instruction is an encoding of some operation, executed in the machine. A set of instructions stored in memory is called the code. Some instructions have inline operands, that is, after their location in the code an extra operand is stored, a constant, e.g. in "ldc 1". In pre/post conditions this location is indicated by M[PCpre+1] since it can be found on that location. The behavior of an instruction is both informally described as well as using pre/postcondifitions.
......@@ -20,9 +23,11 @@ memory=Memory stores words. A word is an 32 bits integer. Currently only a limit
stack=Stack is the part of memory used to store values needed for evaluating expressions. The stack is located after the code and grows from lower addresses to higher ones.
heap=Heap is the part of memory used to store composite values. The heap is located after the stack and grows from lower addresses to higher ones.
code=Code is the part of memory used to store instructions. It starts at address 0.
help=The Simple Stack Runner executes instructions for a hypothetical (and thus simple) machine. See memory, registers, syntax, instruction as starting points for help.
help=The Simple Stack Machine Interpreter executes instructions for a hypothetical (and thus simple) machine. See memory, registers, syntax, instruction as starting points for help.
syntax=Syntax of instructions (as loaded from file) is: (label:)? (instr arg*)?. In other words, an (optional) instruction preceded by an (optional) label and followed by an argument if required. Comment may start with ";" or "//" (Java/C++ style) and ends at the end of the line. This characters are interpreted as start of comment. A label may be used as an argument. Example: "l1: beq l1 ; comment".
......
......@@ -64,7 +64,7 @@ stma_descr=Store Multiple via Address. Pops values from the stack and stores it
stma_prepost=displ = M_pre[PC_pre + 1], size = M_pre[PC_pre + 2], SP_post = SP_pre - size - 1, M_post[M_pre[SP_pre] + displ .. M_pre[SP_pre] + displ + size - 1] = M_pre[SP_post + 1 .. SP_post + size]
stma_example=none
ldr_descr=Load Register. Pushes a value from a register. Registers 0, 1, 2 and 3 are called PC (program counter), SP (stack pointer), MP (mark pointer) and RR (return register) respectively.
ldr_descr=Load Register. Pushes a value from a register. Registers 0, 1, 2 and 3 are called PC (programcounter), SP (stackpointer), MP (markpointer) and RR (return register) respectively.
ldr_prepost=SP_post = SP_pre + 1, M_post[SP_post] = REG_pre[ M_pre[PC_pre+1] ]
ldr_example=ldr RR ; decrement register, ldc 1, sub, str RR
......
......@@ -512,8 +512,12 @@ public class Machine
int endAddr = beginAddr + size - 1;
registers.adjustHP(size);
popMultiple(beginAddr, size);
memory.setAnnotationAt(beginAddr, new MemoryAnnotation("begin", null));
memory.setAnnotationAt(endAddr, new MemoryAnnotation("end", null));
if(size == 1) {
memory.setAnnotationAt(beginAddr, new MemoryAnnotation("begin / end", null));
} else {
memory.setAnnotationAt(beginAddr, new MemoryAnnotation("begin", null));
memory.setAnnotationAt(endAddr, new MemoryAnnotation("end", null));
}
push(endAddr);
break;
......
......@@ -17,14 +17,14 @@ public class Registers extends AbstractMemoryCellModel
public static final int PC = 0 ;
public static final int SP = 1 ;
public static final int MP = 2 ;
//public static final int RR = 3 ;
public static final int HP = 4 ;
public static final int HP = 3 ;
//public static final int RR = 4 ;
private static final int nrRegs = 8 ;
private static final String[] regNames = { "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7" } ;
private static final String[] regNamesAlias = { "PC", "SP", "MP", "RR", "HP" } ;
private static final String[] regNamesAlias = { "PC", "SP", "MP", "HP", "RR" } ;
//private MemoryCell cells[] ;
private int cells[] ;
......
......@@ -315,6 +315,7 @@ public class SSMRunner extends JFrame
statusScrollPane.setBorder(createTitledBorder("Status"));
statusTable.setVisible(true);
statusTable.setFont(null);
statusTable.setPreferredScrollableViewportSize(new java.awt.Dimension(1200, 40));
outputScrollPane.setVisible(true);
outputScrollPane.setFont(null);
outputScrollPane.setBorder(createTitledBorder("Output"));
......@@ -815,6 +816,9 @@ public class SSMRunner extends JFrame
public void tbLoadButtonActionPerformed(java.awt.event.ActionEvent e)
{
JFileChooser chooser = new JFileChooser( recentLoadedFile ) ;
if (recentLoadedFile == null) {
chooser.setCurrentDirectory(new File ("."));
}
Utils.ExtensionFileFilter ff = new Utils.ExtensionFileFilter( "ssm" ) ;
chooser.setFileFilter( ff ) ;
if( chooser.showOpenDialog( this ) == JFileChooser.APPROVE_OPTION )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment