资 源 简 介
Problem Machine
A 4 bit CPU simulation for Android...
Registers
PC - 4Bit Program Counter
A - 4Bit accumulator register
A" - 4Bit shadow register
Flags
Z - Zero Flag
IO Ports
IN - 4Bit input port
OUT - 4Bit output port
Opcodes
0000 - SHL - Shift Left ( A = (A << 1) )
0001 - SHR - Shift Right ( A = (A >> 1) )
0010 - IN - ( A = IN )
0011 - OUT - ( OUT = A )
0100 - INC - Increment A ( if(A == 0){Z = 1}; else {Z = 0});
0101 - DEC - Decrement A ( if(A == 0){Z = 1}; else {Z = 0});
0110 - ZERO - Zero A (Z = 1)
0111 - SWAP - Swap the accumulator and shadow register ( Z == Z )
Jumps
Jumps unconditional
10 00 - JMPZ - PC = 0
10 01 - JMPA - PC = A
10 10 - JMPO - PC = PC - 1