04-19-2014, 10:39 PM
I give you... the msis2416-0, or Magazorb Snuggly Instruction Set 24 bit 16 bit CPU Revision 0.
So... this baby has 4 bit OPCODE and 11 bit Immediate. Shall we see the commands?
0000 : add : 0000 3 bit r1 3 bit r2 3 bit r3 : r1=r2+r3
0001 : addi : 0001 3 bit r1 3 bit r2 14 bit Imm : r1=r2+Imm
0010 : sw : 0010 3 bit r1 3 bit r2 : r1=r2
0011 : swi : 0011 3 bit r1 0 16 bit Imm : r1=Imm
0100 : swe : 0100 3 bit r1 3 bit r2 : word at RAM address r2 = r1
0101 : lwe : 0101 3 bit r1 3 bit r2 : r1 = word at RAM address r2
0110 : bnc : 0110 000 0 16 bit Imm : PC=PC+1+Imm
0111 : bnra : 0111 r1 : PC=r1
1000 : beq : 1000 r1 r2 r3 : if r1=r2, bnra r3, otherwise, skip line
1001 : bi : 1001 r1 r2 : r1=!r2
1010 : bx : 1010 r1 r2 r3 : r1 = r2 XOR r3
1011 : bs : 1011 r1 r2 : r1=r2/2
1100 : scf : null : carry flag = 1
1101 : halt : null : halt all CPU operations
Here is a sample program i wrote that counts to 19.
-Snargy
So... this baby has 4 bit OPCODE and 11 bit Immediate. Shall we see the commands?
0000 : add : 0000 3 bit r1 3 bit r2 3 bit r3 : r1=r2+r3
0001 : addi : 0001 3 bit r1 3 bit r2 14 bit Imm : r1=r2+Imm
0010 : sw : 0010 3 bit r1 3 bit r2 : r1=r2
0011 : swi : 0011 3 bit r1 0 16 bit Imm : r1=Imm
0100 : swe : 0100 3 bit r1 3 bit r2 : word at RAM address r2 = r1
0101 : lwe : 0101 3 bit r1 3 bit r2 : r1 = word at RAM address r2
0110 : bnc : 0110 000 0 16 bit Imm : PC=PC+1+Imm
0111 : bnra : 0111 r1 : PC=r1
1000 : beq : 1000 r1 r2 r3 : if r1=r2, bnra r3, otherwise, skip line
1001 : bi : 1001 r1 r2 : r1=!r2
1010 : bx : 1010 r1 r2 r3 : r1 = r2 XOR r3
1011 : bs : 1011 r1 r2 : r1=r2/2
1100 : scf : null : carry flag = 1
1101 : halt : null : halt all CPU operations
Here is a sample program i wrote that counts to 19.
Code:
swi ax,1 ; Number counting to 19 starts out as 1
swi bx,19 ; Number to count to is 19
swi cx,4 ; The line to branch to if the counting number has not reached to 19
swi dx,8 ; The line to branch to if the counting number has reached 19
beq ax,bx,dx ; Checks if counting number is 19, if it is, go to line 8
addi ax,ax,1 ; Add 1 to the counting number
bnra bx ; Start the loop over again and check
halt ; Stop all CPU processes.
-Snargy