An Introduction to the SIC architecture

SIC/XE Instruction Set

SIC Instructions

SIC only knows how to do basic operations, such as working with registers, integer arithmetic (all in register A), comparing register A to a word in memory, conditional jumping, and calling and returning from a subroutine using register L.

Register instructions

Load

Warning: LDCH only sets the lowest byte of register A, it leaves the other bits unchanged, so you have to be careful when reading the value of register A after using LDCH.

Store

(m..m+2) means the value in memory from address (byte) m to m+2, which is 3 bytes, i.e. a word.

Arithmetic instructions

All arithmetic instructions use the register A and store the result back into it.

Bitwise operations

Comparison instructions

There are three possible outcomes of the comparison:

The actual underlying value for each of the results isn’t mentioned in the SIC specification, so it’s up to each simulator to implement it and then consistently use it (e.g 00 for =, 01 for > and 10 for <).

The TIX instruction is commonly used when counting or doing the assembly version of a for loop.

Jump instructions

All jump instructions set the value of the PC register to the address to jump to.

Subroutine instructions

TODO: Check if PC is incremented before it is stored in JSUB, since we want to go to the next command, not the same one

Input and Output

SIC supports writing to and reading from external devices (usually text files and/or standard input/output in simulator implementations). Each device has an 8-bit ID (so there can be at most 256 devices), which has to be stored somewhere in memory.

dev[(m)] means device, whose ID is stored in memory at the address m.

SIC/XE-only instructions

SIC/XE can use all of the instructions that SIC supports, but it can use advanced addressing modes to adapt them to its larger memory size. It also introduces a few new instructions, which are not supported on the bare SIC.

Things to keep in mind:

Register instructions

SIC/XE adds a few new register instructions, but those that are used in arithmetic operations will be listed in the next section.

Load

Store

Conversion

Arithmetic instructions

New (SIC/XE-only) arithmetic instructions use registers for calculating and storing the result (of course SIC/XE can also use the existing SIC arithmetic instructions as well).

Comparison instructions

The value of CC is set in the same way as with SIC.

System instructions