Instructions SetFollowing is a detailed list of all instructions available in the Heritage/1 minicomputer. The following notation has been used:
Duration is expressed in clock cycles, broke down into: op cod fetch, operand fetch and exec. For example: 3+3+2 means: 3 cycles for op code fetch, 3 for operand fetch and 2 for execution. Total duration is given in microseconds (between parenthesis) assuming a 4 MHz clock frequency.
Register names are written in uppercases (example: A). Identifiers in lowercase indicate generic register (r, s), operand (p), function (g) etc.
Affected flags is expressed with the string: zncv with not-affected flags replaced with dashes (-). For example, the string znc- means that Zero, Negative and Carry flags are affected, Overflow is not.
Generic op cod encoding is written in binary; then a complete list of actual codes is given in hex.
===============================================================
HERITAGE/1 INSTRUCTIONS SET (7/13/2010)
===============================================================
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REGISTER ENCODING
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0001 A
0010 B
0011 C
0100 D
0101 E
0110 SP
0111 PC
1000 OR
1001 MRD (Memory Read signal )
1010 MWR (Memory Write signal )
1011 LDR (LDR_PC: load relative)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DATA TRANSFER
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : mov r, s
Descript : Move register
Flags : zn--
Duration : 3+0+2 (1.25 us)
Op cod: 0001 0000 ssss rrrr
r: A B C D E SP PC
s:
A 1011 1012 1013 1014 1015 1016 1017
B 1021 1022 1023 1024 1025 1026 1027
C 1031 1032 1033 1034 1035 1036 1037
D 1041 1042 1043 1044 1045 1046 1047
E 1051 1052 1053 1054 1055 1056 1057
SP 1061 1062 1063 1064 1065 1066 1067
PC 1071 1072 1073 1074 1075 1076 1077
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : stox r, p
Descript : Store indirect
Flags : zn--
Duration : 3+0+2 (1.25 us)
Op cod: 0001 pppp rrrr 1010
r: A B C D E SP PC
p:
B 121a 122a 123a 124a 125a 126a 127a
C 131a 132a 133a 134a 135a 136a 137a
D 141a 142a 143a 144a 145a 146a 147a
E 151a 152a 153a 154a 155a 156a 157a
SP 161a 162a 163a 164a 165a 166a 167a
PC 171a 172a 173a 174a 175a 176a 177a
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : mvi value
Descript : Move immediate
Flags : zn--
Duration : 3+3+2 (2 us)
Op cod: 0010 0000 0110 rrrr
r: A B C D E SP PC
2081 2082 2083 2084 2085 2086 2087
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : sto r, addr
Descript : Store direct
Flags : zn--
Duration : 3+3+2 (2 us)
Op cod: 0010 1000 rrrr 1010
r: A B C D E SP PC
281a 282a 283a 284a 285a 286a 287a
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : ldx r, p
Descript : Load indirect
Flags : zn--
Duration : 3+0+3 (1.5 us)
Op cod: 0011 pppp 1001 rrrr
r: A B C D E SP PC
p:
B 3291 3292 3293 3294 3295 3296 3297
C 3391 3392 3393 3394 3395 3396 3397
D 3491 3492 3493 3494 3495 3496 3497
E 3591 3592 3593 3594 3595 3596 3597
SP 3691 3692 3693 3694 3695 3696 3697
PC 3791 3792 3793 3794 3795 3796 3797
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : ld r, addr
Descript : Load direct
Flags : zn--
Duration : 3+3+3 (2.25 us)
Op cod: 0100 1000 1001 rrrr
r: A B C D E SP PC
4891 4892 4893 4894 4895 4896 4897
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ALU
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Register A is always the left operand, as for example:
sub a, b ; a=a-b.
ALU operations are the following:
add Arithmetic add
sub Arithmetic substract
cmp Compare (only flags are affected)
and Logical and
or Logical or
xor Logical exclusive or
shfl Shift left
shfr Shift right
swp Swap MSB and LSB
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : (various)
Descript : ALU with registers
Flags : znc-
Duration : 3+0+2 (1.25 us)
These instructions operate with A and a register r.
Op cod: 0101 0000 rrrr gggg
r: A B C D E SP PC
g:
ADD 5011 5021 5031 5041 5051 5061 5071
SUB 5012 5022 5032 5042 5052 5062 5072
CMP 5013 5023 5033 5043 5053 5063 5073
AND 5014 5024 5034 5044 5054 5064 5074
OR 5015 5025 5035 5045 5055 5065 5075
XOR 5016 5026 5036 5046 5056 5066 5076
SHFL 5017 5027 5037 5047 5057 5067 5077
SHFR 5018 5028 5038 5048 5058 5068 5078
SWP 5019 5029 5039 5049 5059 5069 5079
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : (various)
Descript : ALU immediate
Flags : znc-
Duration : 3+3+2 (2 us)
Example:
adi a, VALUE
Op cod: 0110 0000 1000 gggg
ADI 6081
SUBI 6082
CMPI 6083
ANDI 6084
ORI 6085
XORI 6086
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : (various)
Descript : ALU indirect
Flags : znc-
Duration : 3+0+3 (1.5 us)
Example:
addx a, e
Op cod: 0111 rrrr 1001 gggg
r: B C D E SP PC
g:
ADDX 7291 7391 7491 7591 7691 7791
SUBX 7292 7392 7492 7592 7692 7792
CMPX 7293 7393 7493 7593 7693 7793
ANDX 7294 7394 7494 7594 7694 7794
ORX 7295 7395 7495 7595 7695 7795
XORX 7296 7396 7496 7596 7696 7796
SHFLX 7297 7397 7497 7597 7697 7797
SHFRX 7298 7398 7498 7598 7698 7798
SWPX 7299 7399 7499 7599 7699 7799
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : (various)
Descript : ALU direct
Flags : znc-
Duration : 3+3+3 (2.25 us)
Example:
addd a, ADDRESS
Op cod: 1000 1000 1001 gggg
ADDD 8891
SUBD 8892
CMPD 8893
ANDD 8894
ORD 8895
XORD 8896
SHFLD 8897
SHFRD 8898
SWPD 8899
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
INC / DEC
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : inc r
Descript : Increment
Flags : zn-v
Duration : 3+0+1 (1 us)
Op cod: 1001 0000 0000 0rrr
r: A B C D E SP
9001 9002 9003 9004 9005 9006
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : dec r
Descript : Decrement
Flags : zn-v
Duration : 3+0+1 (1 us)
Op cod: 1001 000r rr00 0000
r: A B C D E SP
9040 9080 90c0 9100 9140 9180
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : incm r, s
Descript : Increment multiple
Flags : zn-v
Duration : 3+0+1 (1 us)
Op cod: 1001 0000 00rr rsss
r: A B C D E SP
s:
A 9009 900a 900b 900c 900d 900e
B 9011 9012 9023 9014 9015 9016
C 9019 901a 901b 901c 901d 901e
D 9021 9022 9023 9024 9025 9026
E 9029 902a 902b 902c 902d 902e
SP 9031 9032 9033 9034 9035 9036
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : decm r, s
Descript : Decrement multiple
Flags : zn-v
Duration : 3+0+1 (1 us)
Op cod: 1001 rrrs ss00 0000
r: A B C D E SP
s:
A 9240 9280 92c0 9300 9340 9380
B 9440 9480 94c0 9500 9540 9580
C 9640 9680 96c0 9700 9740 9780
D 9840 9880 98c0 9900 9940 9980
E 9a40 9a80 9ac0 9b00 9b40 9b80
SP 9c40 9c80 9cc0 9d00 9d40 9d80
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : indec r, s
Descript : Increment-Decrement
Flags : zn-v
Duration : 3+0+1 (1 us)
This instruction increments register r and decrements registers s
in a single clock cycle.
If content of any of them changes from 0000 to ffff, both n and v
flags are activated.
If content changes from 0000 to ffff, both n and v flags are activated.
If r=s, the register in question remains unchanged but flags get
activated as result of the decrement operation.
Op cod: 1001 000s ss00 0rrr
r: A B C D E SP
s:
A 9041 9042 9043 9044 9045 9046
B 9081 9082 9083 9084 9085 9086
C 90c1 90c2 90c3 90c4 90c5 90c6
D 9101 9102 9103 9104 9005 9006
E 9141 9142 9143 9144 9145 9146
SP 9181 9182 9183 9184 9185 9186
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : indec i
Descript : Increment-Decrement implicit
Flags : zn-v
Duration : 3+0+1 (1 us)
This instruction increments registers D, E and decrements registers C
in a single clock cycle.
If content of any of them changes from 0000 to ffff, both n and v flags
are activated.
If content changes from 0000 to ffff, both n and v flags are activated.
Op cod: 1001 0000 1110 0101 (90e5)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
JUMP
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Actual jump occurs with the clock pulse following the jump complete
execution cycle. Conditional jumps will test the associated condition
status from the Flags register. If the condition is not met, execution
will take 1 cycle instead of 2. Unconditional jumps will always jump.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : (various)
Descript : Jump direct
Flags : ---
Duration : 3+3+2 (2 us)
Example:
jnz ADDRESS
Op cod (unconditional): 0010 0000 1000 0111
Op cod (conditional) : 1010 0000 1000 ssss
s:
jp 2087
jz a080
jnz a081
jn a082
jnn a083
jc a084
jnc a085
jv a086
jnv a087
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : (various)
Descript : Jump relative direct
Flags : ---
Duration : 3+3+2 (2 us)
Example:
jnzr OFFSET
Op cod (unconditional): 0010 0000 1000 1011
Op cod (conditional) : 1010 0001 1000 0sss
s:
jpr 208b
jzr a180
jnzr a181
jnr a182
jnnr a183
jcr a184
jncr a185
jvr a186
jnvr a187
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : (various)
Descript : Jump indirect
Flags : ---
Duration : 3+0+2 (1.25 us)
Example:
jnz e
Op cod (unconditional): 0001 0000 0rrr 0111
Op cod (conditional) : 1011 0000 0rrr 0sss
r: A B C D E SP
s:
jpx 1017 1027 1037 1047 1057 1067
jzx b010 b020 b030 b040 b050 b060
jnzx b011 b021 b031 b041 b051 b061
jnx b012 b022 b032 b042 b052 b062
jnnx b013 b023 b033 b043 b053 b063
jcx b014 b024 b034 b044 b054 b064
jncx b015 b025 b035 b045 b055 b065
jvx b016 b026 b036 b046 b056 b066
jnvx b017 b027 b037 b047 b057 b067
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : (various)
Descript : Jump relative indirect
Flags : ---
Duration : 3+0+2 (1.25 us)
Example:
jnzrx e
Op cod (unconditional): 0001 0000 rrrr 1011
Op cod (conditional) : 1011 0001 rrrr 1sss
r: A B C D E SP
s:
jprx 101b 102b 103b 104b 105b 106b
jzrx b110 b120 b130 b140 b150 b160
jnzrx b111 b121 b131 b141 b151 b161
jnrx b112 b122 b132 b142 b152 b162
jnnrx b113 b123 b133 b143 b153 b163
jcrx b114 b124 b134 b144 b154 b164
jncrx b115 b125 b135 b145 b155 b165
jvrx b116 b126 b136 b146 b156 b166
jnvrx b117 b127 b137 b147 b157 b167
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CALL, RET and INT
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CALL, RET and INT instructions are the only ones that take more than 4 clock
periods to execute. The extra cycles are required for saving/restoring PC and
F to/from the stack before branching.
These branches are always unconditional.
CALL instructions operate in this order:
- Copy PC to the stack
- Decrement SP
- Copy F to the stack
- Decrement SP
- Load/Add PC with given address/offset
RET instructions operate in this order:
- Increment SP
- Load F from the stack
- Increment SP
- Load PC from the stack
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : callx r
Descript : Call indirect
Flags : ---
Duration : 3+0+8 (2.25 us)
Op cod: 1111 0001 0000 0rrr
r: A B C D E SP
callx f101 f102 f103 f104 f105 f106
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : callrx r
Descript : Call relative indirect
Flags : ---
Duration : 3+0+8 (2.25 us)
Op cod: 1111 0001 0001 0rrr
r: A B C D E SP
callrx f111 f112 f113 f114 f115 f116
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : call addr
Descript : Call direct
Flags : ---
Duration : 3+3+8 (3.5 us)
This instruction saves PC, F to the stack, then branch to the address given
in the operand.
Op cod: 1111 0010 0000 1000 (f208)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : callr off_set
Descript : Call relative direct
Flags : ---
Duration : 3+3+8 (3.5 us)
Op cod: 1111 0010 0001 1000 (f218)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : ret
Descript : Return from subroutine
Flags : ---
Duration : 3+0+8 (2.25 us)
Op cod: 1111 0011 0000 0000 (f300)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : reti
Descript : Return from interrupt
Flags : ---
Duration : 3+0+8 (2.25 us)
Op cod: 1111 0011 0000 0001 (f301)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : int vector
Descript : Software Interrupt
Flags : ---
Duration : 3+0+8 (2.25 us)
Op cod: 1111 0101 vvvv vvvv (f5HL) ; HL: vector
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
STACK
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : push
Descript : Insert into the stack
Flags : zn--
Duration : 3+0+3 (1.5 us)
Op cod: 1111 0111 0000 0rrr
r: A B C D E SP PC
f701 f702 f703 f704 f705 f706 f707
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : pop
Descript : Remove from the stack
Flags : zn--
Duration : 3+0+3 (1.5 us)
Op cod: 1111 0111 0001 0rrr
r: A B C D E SP PC
f711 f712 f713 f714 f715 f716 f717
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MACHINE CONTROL
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Instruction : (various)
Descript : Misc instructions
Flags : ----
Duration : 3+0+1 (1 us)
hlt f900 ; halt
clrf f901 ; clear flags register
di f902 ; disable hardware interrupts
ei f903 ; enable hardware interrupts
dt f904 ; disable Timer interrupt
et f905 ; enable Timer interrupt
|