129 lines
4.7 KiB
Org Mode
129 lines
4.7 KiB
Org Mode
* machine
|
|
:PROPERTIES:
|
|
:CUSTOM-ID: machine
|
|
:END:
|
|
|
|
** memory
|
|
:PROPERTIES:
|
|
:CUSTOM-ID: memory
|
|
:END:
|
|
|
|
one large uint32 array
|
|
|
|
** types
|
|
:PROPERTIES:
|
|
:CUSTOM-ID: types
|
|
:END:
|
|
real (floating point number) f32
|
|
int (integer) i32
|
|
nat (unsigned integer) u32
|
|
|
|
3-3-2 bit rgb
|
|
:PROPERTIES:
|
|
:CUSTOM-ID: bit-rgb
|
|
:END:
|
|
rrrg ggbb xxxx yyyy
|
|
|
|
triangles
|
|
|
|
textures
|
|
|
|
devices
|
|
:PROPERTIES:
|
|
:CUSTOM-ID: devices
|
|
:END:
|
|
** screen
|
|
:PROPERTIES:
|
|
:CUSTOM-ID: screen
|
|
:END:
|
|
default screen is a single 2 triangle square face with a single dynamic
|
|
texture that can be drawn on it
|
|
|
|
** keyboard
|
|
:PROPERTIES:
|
|
:CUSTOM-ID: keyboard
|
|
:END:
|
|
ASCIIUTF8 encoded values
|
|
|
|
** mousejoystick
|
|
:PROPERTIES:
|
|
:CUSTOM-ID: mousejoystick
|
|
:END:
|
|
Theoretically a modern controller could be mapped into 3 mousejoystick
|
|
devices
|
|
|
|
A nes controller could be mapped onto 1 mousejoystick device
|
|
|
|
x axis -> J1 -> J2 -> Dpad leftright y axis -> J1 -> J2 -> Dpad updown
|
|
button 1 -> A -> t1 -> select button 2 -> B -> t2 -> start button 3 -> X
|
|
-> b2 -> "meta button like controller start" button 4 -> Y -> b2 ->
|
|
unused
|
|
|
|
xxxx yyyy 1234
|
|
|
|
x (4 bits) y (4 bits) 1 is button 1 pressed? 2 is button 2 pressed? 3 is
|
|
button 3 pressed? 4 is button 4 pressed?
|
|
|
|
** soundmusic
|
|
:PROPERTIES:
|
|
:CUSTOM-ID: soundmusic
|
|
:END:
|
|
This one is going to be the hardest most likely| but its prolly going to
|
|
be something like the backend dac for ORCA.
|
|
|
|
** networkfilesystem
|
|
:PROPERTIES:
|
|
:CUSTOM-ID: networkfilesystem
|
|
:END:
|
|
9p filesystemnetwork by default.
|
|
|
|
Have an easy way to network.
|
|
|
|
** opcodes
|
|
|
|
|----------------+------------------------------------------------------|
|
|
| opcode | description |
|
|
|----------------+------------------------------------------------------|
|
|
| HALT | terminate execution |
|
|
| ADD-INT | dest = src1 + src2 |
|
|
| SUB-INT | dest = src1 - src2 |
|
|
| MUL-INT | dest = src1 src2 |
|
|
| DIV-INT | dest = src1 src2 |
|
|
| JEQ-INT | jump to address dest if src1 as int == src2 as int |
|
|
| JGT-INT | jump to address dest if src1 as int > src2 as int |
|
|
| JLT-INT | jump to address dest if src1 as int < src2 as int |
|
|
| JLE-INT | jump to address dest if src1 as int <= src2 as int |
|
|
| JGE-INT | jump to address dest if src1 as int >= src2 as int |
|
|
| INT-TO-REAL | dest = src1 as f32 |
|
|
| ADD-UINT | dest = src1 + src2 |
|
|
| SUB-UINT | dest = src1 - src2 |
|
|
| MUL-UINT | dest = src1 src2 |
|
|
| DIV-UINT | dest = src1 src2 |
|
|
| JEQ-UINT | jump to address dest if src1 as int == src2 as uint |
|
|
| JGT-UINT | jump to address dest if src1 as int > src2 as uint |
|
|
| JLT-UINT | jump to address dest if src1 as int < src2 as uint |
|
|
| JLE-UINT | jump to address dest if src1 as int <= src2 as uint |
|
|
| JGE-UINT | jump to address dest if src1 as int >= src2 as uint |
|
|
| UINT-TO-REAL | dest = src1 as f32 |
|
|
| ADD-REAL | dest = src1 + src2 |
|
|
| SUB-REAL | dest = src1 - src2 |
|
|
| MUL-REAL | dest = src1 src2 |
|
|
| DIV-REAL | dest = src1 src2 |
|
|
| JEQ-REAL | jump to address dest if src1 as real == src2 as real |
|
|
| JGE-REAL | jump to address dest if src1 as real >= src2 as real |
|
|
| JGT-REAL | jump to address dest if src1 as real > src2 as real |
|
|
| JLT-REAL | jump to address dest if src1 as real < src2 as real |
|
|
| JLE-REAL | jump to address dest if src1 as real <= src2 as real |
|
|
| REAL-TO-INT | dest = src1 as int |
|
|
| REAL-TO-UINT | dest = src1 as int |
|
|
| MOV | dest = src1 |
|
|
| JMP | jump to address src1 unconditionally |
|
|
| INT-TO-STRING | dest = src1 as str |
|
|
| UINT-TO-STRING | dest = src1 as str |
|
|
| REAL-TO-STRING | dest = src1 as str |
|
|
| READ-STRING | dest = read as str |
|
|
| PRINT-STRING | write src1 to stdout |
|
|
| CMP-STRING | dest = src1 as str == src2 as str |
|
|
| | |
|
|
|----------------+------------------------------------------------------|
|