Instruction set for register architecture processor

Register processor

Registers A B witch size of sizeof(int)
Pointer registers SP BP pointing locations on the stack
Program counter PC
Flags Z C
Memory for variables

Instructions, flags modified and the number of processor cycles to complete the instruction
Instruction Description Flags Cycles
MOV A, #number A « number Z, set if number is zero 2
MOV A, [address] A « [address] Z, set if data is zero 3
MOV [address],A [address] « A Z, see above 3
MOV [ptr+offset],A [ptr+offset] « A (ptr = SP, BP) Z, see above 3 (without offset) or 4
MOV A, [ptr+offset] A « [ptr+offset] (ptr = SP, BP) Z, see above 3 (without offset) or 4
MOV dest,src dest « src (dest, src = A, B, SP, BP) Z, see above 1
PUSH Astack « A Z, set if number pushed is zero 2
PUSH Bstack « B Z, see above 2
PUSH BPstack « BP Z, see above 2
POP AA « stack Z, set if number popped is zero 2
POP BB « stack Z, see above 2
POP BPBP « stack Z, see above 2
ADD A,B A « A + B Z, set if result is zero 1
SUB A,B A « A - B Z, see above and C, set if result is negative 1
MUL A,B A « A * B Z, see above 2
DIV A,B A « A / B Z, see above 3
NEG A A « - A Z, see above 1
OR A,B A « A | B Z, see above 1
AND A,B A « A & B Z, see above 1
XOR A,B A « A ^ B Z, see above 1
NOT A A « ~A Z, see above 1
CMP A,B - Z,C (same as SUB instruction) 1
CALL address stack « PC+1 , PC « address - 4
RET PC « stack - 4
JMP address PC « address - 2
JE address PC « address if Z=1 - 2 (jump taken) or 1
JNE address PC « address if Z=0 - 2 (jump taken) or 1
JG address PC « address if Z=0 i C=0 - 2 (jump taken) or 1
JL address PC « address if C=1 - 2 (jump taken) or 1
JGE address PC « address if C=0 - 2 (jump taken) or 1
JLE address PC « address if C=1 or Z=1 - 2 (jump taken) or 1

Simulator
Pseudo-instructions implemented in the simulator
DD id declare space for variable id
BRK break point for t command of the simulator