A fantasy console. This is a work in progress, spec is not finalised.
Stack-machine, 8-bit words, 16-bit addresses? 20-bit? (MMU allows access to 1MB). PPU with internal VRAM. Tile based display.
| category | hex | name | desc |
|---|---|---|---|
| system | 00 | ZZZ | no operation |
| 01 | SYS | SYS n system call |
|
| 0F | HLT | break/halt | |
| stack operations | 20 | POP | drop/pop(a -- ) |
| 21 | DUP | duplicate(a -- a a) |
|
| 22 | SWP | swap(a b -- b a) |
|
| 23 | OVR | over(a b -- a b a) |
|
| 24 | ROT | rotate left(a b c -- b c a)for -ROT use rot rot |
|
| ?? | NIP | nip(a b --)aka SWP POP |
|
| ?? | TUC | tuck(a b -- b a b)aka SWP OVR |
|
| literals & addressing | 30 | ST1 | store(a lo hi -- )could be named POKE |
| 31 | ST2 | store 16 | |
| 32 | LD1 | load(lo hi -- a)could be named PEEK |
|
| 33 | LD2 | load 16 bits lo hi | |
| 34 | IM1 | literal, push next byte to stack( -- a) |
|
| 35 | IM2 | literal, push next 2 bytes to stack( -- lo hi)could be named PICK |
|
| alu (8-bit unless noted) | 40 | ADD | add(a b -- c) |
| 41 | SUB | subtract(a b -- c) |
|
| 42 | AND | bitwise and(a b -- c) |
|
| 43 | IOR | bitwise or(a b -- c) |
|
| 44 | XOR | bitwise xor(a b -- c) |
|
| 45 | NOT | bitwise not `(a -- ~a) |
|
| ?? | BSL | bit shift left | |
| ?? | BRL | bit roll left | |
| control flow | 50 | CAL | perform subroutine call to address in next 2 bytes maybe JSR jump subroutine? |
| 51 | RTN | return non-zero(cond -- ) |
|
| 52 | RTZ | return zero(cond -- ) |
|
| 53 | RET | unconditional return | |
| 54 | HOP | rel jump 8 bit (next byte) | |
| 55 | SKP | indirect jump (lo hi -- ) | |
| 56 | JMP | jump 16 bit (next 2 bytes) | |
| undecided | ?? | RSW | push/write to return stack(lo hi --) |
| undecided | ?? | RSR | pop/read from return stack to data stack( -- a) |
| io & timing | 60 | VBL | blocks until VBLANK flag set (then clears) |
| ?? | PUT | PUT n write val to io port n? (val -- ) |
|
| ?? | GET | GET n get byte from port number push to stack |
37 SYS n emulator syscall hook (dev only) 40 IN port ( -- val8) 41 OUT port (val8 --) 42 WAIT_VBL blocks until VBLANK flag set (and clears it)