Section 9.2: Assembling and running CSC-1 programs (Frame 7)                     [prev][home][next]

Here are all the CSC-1 instructions:

LOD  X           *Load direct                 A <- m[X]
STD  X            Store direct                m[X] <- A
LDS              *Load secondary              A <- m[S]
LDI  X           *Load immediate              A <- X
STS               Store secondary             m[S] <- A
A2S               A to S                      S <- A
S2A              *S to A                      A <- S

ADD  X           *Add                         A <- A + m[X]
SUB  X           *Subtract                    A <- A - m[X]
AND  X           *And (bitwise)               A <- A and m[X]
OR   X           *Or (bitwise)                A <- A or m[X]
NOT  X           *NOT (bitwise)               A <- not m[X]
SHL              *shift left (1 bit)          A <- A * 2
SHR              *shift right (1 bit)         A <- A / 2
NOP               null operation              do nothing, waste time

JMP  X            jump                        PC <- X
JZ   X            jump if Z bit is set        if Z=1 then PC <- X
JV   X            jump if V bit is set        if V=1 then PC <- X
JC   X            jump if C bit is set        if C=1 then PC <- X
JN   X            jump if N bit is set        if N=1 then PC <- X
JP   X            jump if N bit is not set    if N=0 then PC <- X
HLT               halt                        stop executing
CAL  X            call subprogram             S <- PC + 1; PC <- X
RET               return from subprogram      PC <- S

* = this instruction sets the CNZV bits

The "X" following some instructions denotes an address, which can be between 0 and 4095 inclusive. For LDI, the "X" is a constant integer value, also between 0 and 4095 inclusive.