Update Specification.
Re-formatted as markdown. Changed how flags are accessed. Started flag documentation. Added syscalls.
This commit is contained in:
58
FLAGS.md
Normal file
58
FLAGS.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Flags
|
||||
|
||||
Locations shown below are relative to the start of flags, typically 0xFF00.
|
||||
|
||||
Bits marked N/A read as zero and writing values will not have an effect.
|
||||
|
||||
## Console
|
||||
|
||||
### Status | CONSTS | 0x00
|
||||
|
||||
| | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
||||
| --------------- | --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| **Read/Write** | | | | | | | R/W | R |
|
||||
| **Defaults** | | | | | | | 1 | X |
|
||||
| **Name** | N/A | N/A | N/A | N/A | N/A | N/A | Enabled | Available |
|
||||
|
||||
### Cursor X | CONPOSX | 0x01
|
||||
|
||||
* 8-bit unsigned number
|
||||
* Read/Write
|
||||
|
||||
### Cursor Y | CONPOSY | 0x02
|
||||
|
||||
* 8-bit unsigned number
|
||||
* Read/Write
|
||||
|
||||
### Width | CONX | 0x03
|
||||
|
||||
* 8-bit unsigned number
|
||||
* Read/Write
|
||||
|
||||
### Height | CONY | 0x04
|
||||
|
||||
* 8-bit unsigned number
|
||||
* Read/Write
|
||||
|
||||
## ALU
|
||||
|
||||
Flags here for logic/math results
|
||||
|
||||
## Tape
|
||||
|
||||
Tape control and status
|
||||
|
||||
## Traps
|
||||
|
||||
Trap status and settings
|
||||
|
||||
|
||||
<!--
|
||||
### Name | ALIAS | 0x00
|
||||
|
||||
| | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
||||
| --------------- | --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| **Read/Write** | | | | | | | | |
|
||||
| **Defaults** | | | | | | | | |
|
||||
| **Name** | | | | | | | | |
|
||||
-->
|
||||
94
SPEC.md
Normal file
94
SPEC.md
Normal file
@@ -0,0 +1,94 @@
|
||||
## Features
|
||||
|
||||
* 4 16-bit Registers
|
||||
* 254 8-bit Flag Registers
|
||||
* Start at end of memory from 0xFF00
|
||||
* See [FLAGS.md](FLAGS.md)
|
||||
* 255 8-bit Ports
|
||||
* 0x00 console in/out
|
||||
* 0x01 tape in/out
|
||||
* 0x02-0x20 Reserved
|
||||
* Others Implementation Specific
|
||||
* 255 Syscall routines
|
||||
* Program Counter
|
||||
* Call Stack 16 x 16-bit
|
||||
* 64K x 8-bit Memory
|
||||
* MSB / big-endian
|
||||
|
||||
## ASM Parameters
|
||||
|
||||
| Type | Symbol | Example/Use |
|
||||
| ----------------- | ------ | ----------------- |
|
||||
| Registers | R | A-D |
|
||||
| Marker | : | :XYZ |
|
||||
| Absolute Location | # | 0-65535 \| 0xFFFF |
|
||||
|
||||
## Location Parameter (@)
|
||||
|
||||
| Code | ASM | Type | Values |
|
||||
| ---- | --- | ------------------- | -------------------------------- |
|
||||
| 0x0 | P | Port | 0-255 \| 0xFF |
|
||||
| 0x1 | R | Register | A-D |
|
||||
| 0x2 | M | Memory | 0-65535 \| 0xFFFF |
|
||||
| 0x3 | L | Immediate | 0-65535 \| 0xFFFF \| 'a' \| "a" |
|
||||
| 0x4 | A | Address In Register | A-D |
|
||||
|
||||
## ASM Instructions
|
||||
|
||||
| Hex | ASM | Parameters | Notes |
|
||||
| ---- | ----- | ---------------- | ----- |
|
||||
| **Misc**
|
||||
| 0x00 | NOP | |
|
||||
| **Load/Save**
|
||||
| 0x10 | LOAD | [R] [@] |
|
||||
| 0x11 | SAVE | [R] [@] |
|
||||
| 0x12 | LOADH | [R] [@] |
|
||||
| 0x13 | LOADL | [R] [@] |
|
||||
| 0x14 | SAVEH | [R] [@] |
|
||||
| 0x15 | SAVEL | [R] [@] |
|
||||
| **Math**
|
||||
| 0x20 | CLR | [R] |
|
||||
| 0x21 | ADD | [R] [@] |
|
||||
| 0x22 | SUB | [R] [@] |
|
||||
| 0x23 | DIV | [R] [@] |
|
||||
| 0x24 | MUL | [R] [@] |
|
||||
| 0x25 | INC | [R] |
|
||||
| 0x26 | DEC | [R] |
|
||||
| **Logic**
|
||||
| 0x30 | NOT | [R] |
|
||||
| 0x31 | AND | [R] [@] |
|
||||
| 0x32 | OR | [R] [@] |
|
||||
| 0x33 | XOR | [R] [@] |
|
||||
| 0x34 | SHL | [R] [0-7] | Shift Left
|
||||
| 0x35 | SHR | [R] [0-7] | Shift Right
|
||||
| 0x36 | BTS | [R] [0-7] | Bit Set
|
||||
| 0x37 | BTC | [R] [0-7] | Bit Clear
|
||||
| **Stack**
|
||||
| 0x40 | CALL | [#\|:] |
|
||||
| 0x41 | RET | |
|
||||
| **Program Flow**
|
||||
| 0x50 | HALT | |
|
||||
| 0x51 | JMP | [#\|:] |
|
||||
| 0x52 | JZ | [R] [#\|:] |
|
||||
| 0x53 | JNZ | [R] [#\|:] |
|
||||
| 0x54 | JBS | [R] [0-7] [#\|:] |
|
||||
| 0x55 | JBC | [R] [0-7] [#\|:] |
|
||||
| **System**
|
||||
| 0x60 | SYS | [0-255] | Syscall, parameters depend on call
|
||||
|
||||
### Assembler Only
|
||||
|
||||
| ASM | Parameters | Notes |
|
||||
| ------ | ---------- | ------------ |
|
||||
| ORIGIN | [#] | Sets the Memory Address for the next instruction |
|
||||
|
||||
## Program Format
|
||||
|
||||
ORIGIN 0
|
||||
:MARKERA JMP :MARKERB # This is a comment
|
||||
:MARKERB INC A
|
||||
JMP :MARKERA
|
||||
[...ASM Instrictions...]
|
||||
MEMORY
|
||||
0x100 "string abcd"
|
||||
100 0x00 00 00
|
||||
70
SPEC.txt
70
SPEC.txt
@@ -1,70 +0,0 @@
|
||||
Features
|
||||
- 4 16-bit Registers
|
||||
- 255 8-bit Flag Registers
|
||||
- 255 8-bit Ports
|
||||
- 0 console in/out
|
||||
- 1 tape in/out
|
||||
- 2-32 Reserved
|
||||
- Others Implementation Specific
|
||||
- Program Counter
|
||||
- Call Stack 16 x 16-bit
|
||||
- 64K x 8-bit Memory
|
||||
- MSB / big-endian
|
||||
|
||||
Registers (R) A-D -> 0-3
|
||||
Marker (:) :XYZ
|
||||
|
||||
Locations (@)
|
||||
Code ASM Type Values
|
||||
0x0 P Port 0-255 | 0xFF
|
||||
0x1 R Register A-D
|
||||
0x2 M Memory 0-65535 | 0xFFFF
|
||||
0x3 # Immediate 0-65535 | 0xFFFF | 'a' | "a"
|
||||
0x4 F Flag 0-255 | 0xFF
|
||||
0x5 A Address In Register A-D
|
||||
|
||||
Instructions
|
||||
|
||||
Code ASM
|
||||
Misc
|
||||
0x00 NOP
|
||||
Registers
|
||||
0x10 LOAD R @
|
||||
0x11 SAVE R @
|
||||
0x12 LOADH R @
|
||||
0x13 LOADL R @
|
||||
0x14 SAVEH R @
|
||||
0x15 SAVEL R @
|
||||
Accumulator
|
||||
0x20 CLR R
|
||||
0x21 ADD R @
|
||||
0x22 SUB R @
|
||||
0x23 DIV R @
|
||||
0x24 MUL R @
|
||||
0x25 INC R
|
||||
0x26 DEC R
|
||||
Logic
|
||||
0x30 NOT R
|
||||
0x31 AND R @
|
||||
0x32 OR R @
|
||||
0x33 XOR R @
|
||||
0x34 SHL R 0-7 Shift Left
|
||||
0x35 SHR R 0-7 Shift Right
|
||||
0x36 BTS R 0-7 Bit Set
|
||||
0x37 BTC R 0-7 Bit Clear
|
||||
Stack
|
||||
0x40 CALL #|:
|
||||
0x41 RET
|
||||
Program Flow
|
||||
0x50 HALT
|
||||
0x51 JMP #|:
|
||||
0x52 JZ R #|:
|
||||
0x53 JNZ R #|:
|
||||
0x54 JBS R 0-7 #|:
|
||||
0x55 JBC R 0-7 #|:
|
||||
|
||||
Program Format
|
||||
[...ASM...]
|
||||
MEMORY
|
||||
0x100 "string abcd"
|
||||
100 0x00 00 00
|
||||
Reference in New Issue
Block a user