The Slug computer runs as a simulation in your browser over the internet. You don't need to by anything. Using your computer connected to the internet, you can write and try your programs.
The Slug computer has a simple machine language:
- You can load the memory of this computer,
- can run a program that you loaded in memory or
- you can restart the computer.
The Slug computer has 100 memory locations. Each location can accommodate a number of up to 4 digits (0000 to 9999) the values can be positive or negative. You can see and alter the contents of the memory by clicking the button "Load memory" in the Slug control panel.
Memory can only accomodate numbers (no characters) and numbers are represented in our everyday decimal notation.
Each instruction occupies one memory location. Out of the possible 4 digits, the first two denote the operation to be performed and the second two digits specify an address in memory where the operand is to be found.
xx yy
xx is the op code
yy is the address of the operand in memory
For example, an instruction "0110" has an operation code =01 and operand address =10. The operation code=01 means "Load Accumulator" (see machine language reference). Therefore, this will cause the computer to get the contents of memory location 10 (operand address) and load this contents to the accumulator. Accumulator is a special register that works pretty much as the display in a calculator.
Yes, the Slug computer also has some registers that can also accommodate a number with 4 digits:
Accumulator (ACC)
The accumulator (ACC) is the place where all the arithmetic operations take place. You can load the accumulator with a value from memory, you can store the accumulator in a memory position, you can perform arithmetic operations between the accumulator and one operand in memory. Results are always kept in the accumulator.
The accumulator is just like the display in a calculator.
You can also decide what to do depending on the value in the accumulator.
Instruction Counter (IC)
The instruction counter holds the address of the next instruction to be executed
When the computer is started, the instruction counter is automatically reset to zero, so that the first instruction to be executed is the one in memory location 00. As the program executes, the contents of the IC are updated usuaally being incremented by one so that one instruction is exectuted after the other. Some instructions may cause the contents of the IC to be modified in other ways.
What are you talking about, man? This is free for your fun!