[ot?] request for comment
I was going to write a simulator for Bell Labs "Cardiac" (cardboard
slide the slides and move bits be the cpu your self) computer, but all I
can find is the Instruction Set, none of how the instructions are
implemented.
So, I decieded to write my own...
Here is the instruction set, I thought it best to consult with you all
before beginning to code. What
do you think?
Opcodes
0 1 2 3 4 5 6 7
Z N o1 o2 o3
=================================================================
Z N 0 0 1 i r r get copy (indirect) register rr to acx
Z N 0 1 0 i r r put copy (indirect) acx to register rr
Z N 0 1 1 o o o Mathop
0 0 0 nop
0 0 1 add acx + acy ==> acx
0 1 0 sub acx - acy ==> acx
0 1 1 and acx & acy ==> acx
1 0 0 exor acx xor acy ==> acx
1 0 1 or acx | acy ==> acx
1 1 0 cmp acx cmp acy set Z and N
1 1 1 cpz acx cmp 0 set Z and N
Z N 1 0 0 p p p inp copy port ppp ==> acx
Z N 1 0 1 p p p out copy acx ==> port ppp
Z N 1 1 0 i r r swp acx ==> (ind) Rn == > acx
Z N 1 1 1 0 o o acx op group
0 0 0 not r1 <== ! r1
0 0 1 shl Shift left
0 1 0 shr Shift right
0 1 1 inc Increment r1 <== r1 + 1
Z N 1 1 1 1 o o Jump Group
1 0 0 jmp ind [pc] pc <== [pc]
1 0 1 jsr ind [pc] R2 <== pc , pc <== [pc]
1 1 0 rtn pc <== R2
1 1 1 Halt,reset [pc] <== 0
Zero and Negative flags
On execution of the cmp and cpz instructions the Z and N flags are
set, following instructions can test these flags and choose to execute
or not.
Z N Meaning
0 0 Execute if acx was positive on test (acx > 0 / acx > acy)
0 1 Execute if acx was negative on test (acx < 0 / acx < acy)
1 0 Execute if acx was zeron on test (acx = 0 / acx = acy)
1 1 Always execute
Registers
00 r0 acx 1st operand
01 r1 acy 2nd operand
10 r2 ptr Pointer register
11 r3 pc Program Counter
here is an example of an assembled program....
Assembly of a simple program
org $10 ; program starts at 10 10
get ind pc ; load value1 acy 10 11001111 00010000
adr value1 11 00011001 00010001
swp acy 12 11110110 00010010
get ind pc ; load value2 acx 13 11001111 00010011
adr value2 14 00011010 00010100
add ; sum values 15 11011001 00010101
put ind pc ; store sum 16 11010111 00010110
adr sum 17 00011011 00010111
hlt ; end of program 18 11111111 00011000
value1 byt 19 00011001
value2 byt 1A 00011010
sum byt 1B 00011011
end ; end of code
I know, it only has 256 words of 8 bit memory, but isn't this as much as
some of the early machines?
Received on Sun Aug 12 2001 - 17:27:10 BST
This archive was generated by hypermail 2.3.0
: Fri Oct 10 2014 - 23:33:32 BST