CIS Logo SVC Logo

   Computing & Information Systems
   Department

 

Schoology Facebook        Search CIS Site      Tutorials

Mac-1 Instruction Set


Note that xxxx xxxx xxxx denotes a 12 bit constant called x for short and that yyyy yyyy denotes an 8 bit constant called y for short. The meaning of each instruction is described in Pascal-like notation below each Mac-1 instruction.
LODD		0000 xxxx xxxx xxxx		load direct
	ac := m[x]
STOD		0001 xxxx xxxx xxxx		store direct
	m[x] := ac
ADDD		0010 xxxx xxxx xxxx		add direct
	ac := ac + m[x]
SUBD		0011 xxxx xxxx xxxx		subtract direct
	ac := ac - m[x]
JPOS		0100 xxxx xxxx xxxx		jump positive
	if ac >= 0 then pc := x			(really a jump non-negative)
JZER		0101 xxxx xxxx xxxx		jump zero
	if ac = 0 then pc := x
JUMP		0110 xxxx xxxx xxxx		jump always
	pc := x
LOCO		0111 xxxx xxxx xxxx		load constant
	ac := x	(where 0 <= x <= 4095)
LODL		1000 xxxx xxxx xxxx		load local
	ac := m[sp + x]
STOL		1001 xxxx xxxx xxxx		store local
	m[x + sp] := ac
ADDL		1010 xxxx xxxx xxxx		add local
	ac := ac + m[sp + x]
SUBL		1011 xxxx xxxx xxxx		subtract local
	ac := ac - m[sp + x]
JNEG		1100 xxxx xxxx xxxx		jump negative
	if ac < 0 then pc := x
JNZE		1101 xxxx xxxx xxxx		jump nonzero
	if ac <> 0 then pc := x
CALL		1110 xxxx xxxx xxxx		call a procedure
	sp := sp - 1; m[sp] := pc; pc := x
PSHI		1111 0000 0000 0000		push indirect
	sp := sp - 1; m[sp] := m[ac]
POPI		1111 0010 0000 0000		pop indirect
	m[ac] := m[sp]; sp := sp + 1
PUSH		1111 0100 0000 0000		push onto stack
	sp := sp - 1; m[sp] := ac
POP		1111 0110 0000 0000		pop from stack
	ac := m[sp]; sp := sp + 1
RETN		1111 1000 0000 0000		return from a procedure
	pc := m[sp]; sp := sp + 1
SWAP		1111 1010 0000 0000		swap ac and sp
	tmp := ac; ac := sp; sp := tmp
INSP		1111 1100 yyyy yyyy		increment sp
	sp := sp + y	(where 0 <= y <= 255)
DESP		1111 1110 yyyy yyyy		decrement sp
	sp := sp - y	(where 0 <= y <= 255)
HALT		1111 1111 yyyy yyyy		halts the simulator (y unused)

Note that some bit patterns are still available for new Mac-1 instructions. These all involve the eight bit from the left. For example, we could use the bit pattern 1111 1101 for a new Mac-1 instruction if we rewrite the microprogram interpreter to correctly distinguish between 1111 1100 (INSP) and 1111 1101 (the new instruction). Similarly, we could use 1111 1011 if we distinguish it from 1111 1010 (SWAP).

Maintained by: Br. David Carlson
Last updated: August 03, 2006
Disclaimer