The machine language

Encoding instructions

A computer accepts only the language of zeros and once. Therefore, the instructions have to be encoded in binary. An example of such encoding is presented below.

00000100 10000000
00000000 10000001
00000101 10000000
00001111 00000000

The binary encoding above is splitted into two columns for the programmer convenience. Each column represents a byte (an 8-bit string) stored in computer memory. The meaning of the bytes for this specific code is explained below.

Encoding strategy:

The first column of the encoding is an operation code, which the second column represents an argument for that instruction.

Code Parameter Action
00000100 X Load accumulator with the contents of memory location X
00000000 X Add contents of memory location X to the accumulator
00000101 X Store the accumulator contents in memory location X
00001111 X Halt execution

Assembly language instructions:

With the instruction encoding provided by the above table, our code makes more sense now:

Load  10000000 
Add   10000001 
Store 10000000 
Halt

The PIPPIN Assembler instructions:

Data flow instructions
Op. Code Comments
LOD X (or #X) X -> A, place X into accumulator
STO Y A -> Y, store contents of the accumulator in location Y
 
Arithmetic - logic instructions
Op. Code Comments
ADD X (or #X) A+X -> A, add X to contents of accumulator
SUB X (or #X) A-X -> A
MUL X (or #X) A*X -> A
DIV X (or #X) A/X -> A
AND X (or #X) A and X -> A If contents of A and location X are both
nonzero, put 1 into A, otherwise, put 0 into A
NOT A not A -> A If A=0, set A=1, otherwise set A=0
CPZ X if X=0, set A=1, otherwise set A=0
CPL X if X<0, set A=1, otherwise set A=0
 
Control instructions
Op. Code Comments
JMP Y goto instruction number Y
JMZ Y if A=0, go to instruction number Y
if A is not 0, proceed with next instruction
NOP no operation
HLT halt execution