Instruction Table
The areas highlighted in yellow are the extensions of my ATTiny_TPS and the Arduino_TPS version. The corresponding mnemonics of the SPS assembler are in square brackets.
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
---|---|---|---|---|---|---|---|---|
n.n. | Port [DOUT] |
Delay [WAIT] |
Jump back relative [RJMP] |
A=# [LDA] |
=A | A= | A=Ausdruck | |
0 | NOP [NOP] | aus | 1ms | 0 | 0 | A<->B [SWAP] | ||
1 | 1 | 2ms | 1 | 1 | B=A [MOV] | A=B [MOV] | A=A + 1 [INC] | |
2 | 2 | 5ms | 2 | 2 | C=A [MOV] | A=C [MOV] | A=A - 1 [DEC] | |
3 | 3 | 10ms | 3 | 3 | D=A [MOV] | A=D [MOV] | A=A + B [ADD] | |
4 | 4 | 20ms | 4 | 4 | Dout=A [STA] | Din [LDA] | A=A - B [SUB] | |
5 | 5 | 50ms | 5 | 5 | Dout.1=A.1 [STA] | Din.1 [LDA] | A=A * B [MUL] | |
6 | 6 | 100ms | 6 | 6 | Dout.2=A.1 [STA] | Din.2 [LDA] | A=A / B [DIV] | |
7 | 7 | 200ms | 7 | 7 | Dout.3=A.1 [STA] | Din.3 [LDA] | A=A and B [AND] | |
8 | 8 | 500ms | 8 | 8 | Dout.4=A.1 [STA] | Din.4 [LDA] | A=A or B [OR] | |
9 | 9 | 1s | 9 | 9 | PWM.1=A [STA] | ADC.1 [LDA] | A=A xor B [XOR] | |
a | 10 | 2s | 10 | 10 | PWM.2=A [STA] | ADC.2 [LDA] | A= not A [NOT] | |
b | 11 | 5s | 11 | 11 | Servo.1=A [STA] | RCin.1 [LDA] | A= A % B (Rest) [MOD] | |
c | 12 | 10s | 12 | 12 | Servo.2=A [STA] | RCin.2 [LDA] | A= A + 16 * B [BYTE] | |
d | 13 | 20s | 13 | 13 | E=A [MOV] | A=E [MOV] | A= B - A[BSUBA] | |
e | 14 | 30s | 14 | 14 | F=A [MOV] | A=F [MOV] | A=A SHR 1 [SHR] ab V 11 |
|
f | 15 | 60s | 15 | 15 | Push A [PUSH] | Pop A [POP] | A=A SHL 1 [SHL] ab V 11 |
- There are 2 additional registers (E and F)
- and there is a stack with the 2 methods push and pop. There is space for 16 values in the stack.
- There are also 2 new calculations, one for the remainder of a division (A= A % B) and one for an 8-bit conversion. A = A + 16 * B
- As of version 0.6, the swap command has also been added, which swaps A and B registers.
- And a new calculation A = B - A. Especially when you are in the 8-bit space, it is sometimes quite cumbersome to carry out this operation.
- from version 11 there are now also shift operations. These shift the contents of register A either to the left SHL (which corresponds to a multiplication by 2) or to the right (SHR). That would then be a division by 2. Warning: although we are in 4-bit space here, these operations are 8-bit capable.
8 | 9 | a | b | c | d | e | f | |
---|---|---|---|---|---|---|---|---|
Page [PAGE] | Jump absolut (#+16*page) [JMP] |
C* C>0: C=C-1; Jump # + (16*page) [LOOPC] |
D* D>0:D=D-1; Jump # + (16*page) [LOOPC] |
Skip if | Call # + (16*Page) [Call] |
Callsub/Ret | Byte Befehle | |
0 | 0 | 0 | 0 | 0 | A==0 [SKIP0] | 0 | ret [RTR] | A=ADC.1 [BLDA] |
1 | 1 | 1 | 1 | 1 | A>B [AGTB] | 1 | Call 1 [CASB] | A=ADC.2 [BLDA] |
2 | 2 | 2 | 2 | 2 | A<B [ALTB] | 2 | 2 [CASB] | A=RCin.1 [BLDA] |
3 | 3 | 3 | 3 | 3 | A==B [AEQB] | 3 | 3 [CASB] | A=RCin.2 [BLDA] |
4 | 4 | 4 | 4 | 4 | Din.1==1 [DEQ1 1] | 4 | 4 [CASB] | PWM.1=A [BSTA] |
5 | 5 | 5 | 5 | 5 | Din.2==1 [DEQ1 2] | 5 | 5 [CASB] | PWM.2=A [BSTA] |
6 | 6 | 6 | 6 | 6 | Din.3==1 [DEQ1 3] | 6 | 6 [CASB] | Servo.1=A [BSTA] |
7 | 7 | 7 | 7 | 7 | Din.4==1 [DEQ1 4] | 7 | Servo.2=A [BSTA] | |
8 | 8 | 8 | 8 | 8 | Din.1==0 [DEQ0 1] | 8 | Def 1 [DFSB] | Tone=A [TONE] |
9 | 9 | 9 | 9 | 9 | Din.2==0 [DEQ0 2] | 9 | 2 [DFSB] | |
a | 10 | 10 | 10 | 10 | Din.3==0 [DEQ0 3] | 10 | 3 [DFSB] | |
b | 11 | 11 | 11 | 11 | Din.4==0 [DEQ0 4] | 11 | 4 [DFSB] | |
c | 12 | 12 | 12 | 12 | S_PRG==0 [PRG0] | 12 | 5 [DFSB] | |
d | 13 | 13 | 13 | 13 | S_SEL==0 [SEL0] | 13 | 6 [DFSB] | int. LED on |
e | 14 | 14 | 14 | 14 | S_PRG==1 [PRG1] | 14 | int. LED off | |
f | 15 | 15 | 15 | 15 | S_SEL==1 [SEL1] | 15 | restart [REST] | PrgEnd [PEND] |
Additional features in the Arduino_TPS version:
- Because we have enough EEPROM, the page area is extended to 16 pages. So extends TPS to 256 bytes
- In the skip instructions there is also the skip on A=0 command.
- 6 real subprograms can now also be created via the E commands. These are created using the Def# command. The routine is started with Call#. With return you come back. The Def# memory may also be above the 256 bytes in the EEPROM. So also outside the range of the jump commands.
- The restart command, with which the entire controller is restarted, this is also new.
- Commands that work with 8-bit resolution are located in area F.
- FF means end of program. → automatic jump to 0.
- NEW Tone command: emits a tone. The midi notes are the basis. Midi notes from 36 (C2) to 108 (C8) are supported. The output is PWM 2. The basis is the A register as an 8-bit value.