129 lines
6.8 KiB
Org Mode
129 lines
6.8 KiB
Org Mode
* machine
|
|
:PROPERTIES:
|
|
:CUSTOM_ID: machine
|
|
:END:
|
|
I like uxn's idea of it being 16 bit because its 0 to 65535 or -32768 to
|
|
32767 which fits in your head nicely.
|
|
|
|
** memory
|
|
:PROPERTIES:
|
|
:CUSTOM_ID: memory
|
|
:END:
|
|
ideas for memory (ram) is going to be a giant hashmap of some kind, or
|
|
maybe like picolisp?
|
|
|
|
picolisp has 64 bit machine words, a cell is 2 words
|
|
|
|
** types
|
|
:PROPERTIES:
|
|
:CUSTOM_ID: types
|
|
:END:
|
|
number (fixed point numbers), symbols (string), cons-pairs (lists)
|
|
|
|
0000 0000 0000 0000 0000 0000 0000 0000
|
|
|
|
tfff xxxx yyyy zzzz
|
|
|
|
0rgb xxxx yyyy zzzz
|
|
|
|
mmrr rrrg ggb0 0000 {xxxx xxxx yyyy yyyy zzzz zzzz} {xxxx xxxx yyyy yyyy
|
|
zzzz zzzz} vz{xxxx xxxx yyyy yyyy zzzz zzzz}
|
|
|
|
rrrx gggy bbbz xxxx yyyy zzzz
|
|
|
|
**** 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:
|
|
ASCII/UTF8 encoded values
|
|
|
|
*** mouse/joystick
|
|
:PROPERTIES:
|
|
:CUSTOM_ID: mousejoystick
|
|
:END:
|
|
Theoretically a modern controller could be mapped into 3 mouse/joystick
|
|
devices
|
|
|
|
A nes controller could be mapped onto 1 mouse/joystick device
|
|
|
|
x axis -> J1 -> J2 -> Dpad left/right y axis -> J1 -> J2 -> Dpad up/down
|
|
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?
|
|
|
|
*** sound/music
|
|
: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.
|
|
|
|
*** network/filesystem
|
|
:PROPERTIES:
|
|
:CUSTOM_ID: networkfilesystem
|
|
:END:
|
|
9p filesystem/network by default.
|
|
|
|
Have an easy way to network.
|
|
|
|
*** opcodes
|
|
|
|
|---------------------------------------------------------------------------------------+------------------------------------------------------------------|
|
|
| opcode | description |
|
|
|---------------------------------------------------------------------------------------+------------------------------------------------------------------|
|
|
| nil | noop/nil/eos |
|
|
| *bbbb call | calls the address as a function |
|
|
| b syscall | calls a system call based on the opcode |
|
|
| bbbb pushReal - | allocates Q16.16 bits on the stack |
|
|
| - popReal bbbb | deallocates Q16.16 bits from the stack |
|
|
| b *bbbb storeByte - | stores 8 bits from the stack to the address |
|
|
| bbbb *bbbb storeReal - | stores 64 bits from the stack to the address |
|
|
| *bbbb loadByte b | loads 8 bits from the address to the stack |
|
|
| *bbbb loadReal bbbb | loads 64 bits from the address to the stack |
|
|
| bbbb bbbb addReal bbbb | adds 64 bits from the stack |
|
|
| bbbb bbbb subReal bbbb | subtracts 64 bits from the stack |
|
|
| bbbb bbbb mulReal bbbb | multiplies 64 bits from the stack |
|
|
| bbbb bbbb divReal bbbb | divides 64 bits from the stack |
|
|
| bbbb [bbbb bbbb bbbb] scalevec3 [bbbb bbbb bbbb] | scales the vec3 by the f64 on the stack |
|
|
| [bbbb bbbb bbbb] [bbbb bbbb bbbb] addvec3 [bbbb bbbb bbbb] | adds 2 vec3 together from the stack |
|
|
| [bbbb bbbb bbbb] [bbbb bbbb bbbb] subvec3 [bbbb bbbb bbbb] | subtracts 2 vec3 together from the stack |
|
|
| [bbbb bbbb bbbb] [bbbb bbbb bbbb] mulvec3 [bbbb bbbb bbbb] | multiplies 2 vec3 together from the stack |
|
|
| [bbbb bbbb bbbb] [bbbb bbbb bbbb] dotvec3 bbbb | dot product of 2 vec3 together from the stack |
|
|
| [bbbb bbbb bbbb] [bbbb bbbb bbbb] crossvec3 [bbbb bbbb bbbb] | cross product of 2 vec3 together from the stack |
|
|
| [bbbb bbbb bbbb] normvec3 [bbbb bbbb bbbb] | normalizes a vec3 |
|
|
| [[bbbb bbbb bbbb bbbb]*4] invmat4 [[bbbb bbbb bbbb bbbb]*4] | inverts a mat4 from the stack |
|
|
| [[bbbb bbbb bbbb bbbb]*4] [[bbbb bbbb bbbb bbbb]*4] mulmat4 [[bbbb bbbb bbbb bbbb]*4] | multiplies 2 mat4's from the stack |
|
|
| *triangle-array-ptr nnnn drawtriangles - | drawn 'n' many triangles using a array of vertices and its color |
|
|
| *str1 *str2 streq b | checks 2 strings returns a bool of if they are the same |
|
|
| *str1 *str2 strcat *str3 | concatinates 2 strings and returns the address of the new string |
|
|
| *str strlen bbbb | pushes the length of the string onto the stack |
|
|
| | |
|
|
| | |
|
|
|---------------------------------------------------------------------------------------+------------------------------------------------------------------|
|