40 lines
2.6 KiB
Markdown
40 lines
2.6 KiB
Markdown
# Stack based 8-Bit processor
|
|
|
|
## Peripherals
|
|
|
|
Connected to a bidirectional bus.
|
|
|
|
## Instruction set
|
|
|
|
| Operand Code | Instruction | Signature | Description |
|
|
| ------------ | ----------- | --------- | ------------------------------------------------------ |
|
|
| 00000000 | nop | | Just do nothing for a cycle straight |
|
|
| 00010000 | int | interrupt | Interrupt code to call on PIA |
|
|
| 00100000 | jmp | label | Jump to label if last operation had non zero result |
|
|
| 00110000 | wfi | interrupt | Wait for interrupt. If interrupt is zero, wait for any |
|
|
| 00000100 | push | stack, rx | Push the rx value to the index stack |
|
|
| 00010100 | pop | stack, rx | Pop into the register rx from index stack |
|
|
| 00001000 | read | rdx | Read from PIA into the target register |
|
|
| 00011000 | write | rdx | Write to PIA the value of target register |
|
|
| 00000010 | not | rx | negates rx |
|
|
| 00010010 | par | rx | parity of rx |
|
|
| 00100010 | cnt | rx | count of set bits in rx |
|
|
| 00110110 | and | rx,r1 | Store and of rx and r1 into rx |
|
|
| 01000110 | or | rx,r1 | Store or of rx and r1 into rx |
|
|
| 01010110 | xor | rx,r1 | Store xor of rx and r1 into rx |
|
|
| 01100110 | mov | rx,r1 | overwrite rx with r1 |
|
|
| 01110110 | sl | rx,r1 | shift rx left by r1 |
|
|
| 10000110 | sr | rx,r1 | shift rx right by r1 |
|
|
| 00001010 | add | rx,r1 | Add r1 to rx |
|
|
| 00011010 | sub | rx,r1 | Subtract r1 from rx |
|
|
| 00001110 | seq | rx,ry | Set if rx = ry |
|
|
| 00011110 | slt | rx,ry | Set if rx < ry |
|
|
| 00101110 | sltu | rx,ry | set if abs(rx) < abs(ry) |
|
|
|
|
### Instruction Types
|
|
|
|
| From | To | Type |
|
|
| -------- | -------- | ------------------ |
|
|
| 00000000 | 11111110 | Base Instructions |
|
|
| 00000001 | 11111111 | Possible extension |
|