woof is a very basic computer, only supporting a 256x128 1bpp display, an 8 button controller, 64KB of memory, and a fantasy CPU I made called "mew" which is *heavily* inspired by the UXN.
The inspiration was to make a UXN variant with a deque instead of a stack, or as I like to call it, a quack. Each opcode has a flag indicating whether it operates on the back or the front of the quack, along with a "short mode" flag, and a "conditional" flag. Short mode means 16bit operations instead of 8bit. Conditional means that the top of the stack is popped, and the instruction is only executed if the byte is nonzero.
This does not really have many (or any?) advantages over the UXN. It was an experimental project to see if I actually could do it, and because I thought it would be cool. I learned a lot while making this, and I'm glad I made it, but I probably won't actually use it for anything.
Programs are assembled from MEW assembly to machine code using a program called grao.
Below is a Hello, World! program with explanations. You can see the obvious similarities between UXN Tal and mew assembly.
@Console ( define console IO port at 0x00 ) !START ( define program start at 0x100 ) ;text ( push the address of the string to the stack as a 16bit number ) @loop ( declare the start of the loop ) DUP2 RAM ( duplicate the address, then get one letter from the string ) DUP .Console WIO ( duplicate the letter and write it to the console ) vSWP vINC2 vSWP ( increment the address at the front of the stack ) ;loop ROT ROT ( push the start of the loop to the queue, and then move it behind the letter ) JMP2? ( only jump back to the start of the loop if the value of the letter is nonzero ) POP2 BRK ( empty the queue and stop execution ) @text "Hello '20 "World! '0a '00 ( 20 and 0a are ascii codes for space and linebreak respectively. 00 is the string's null terminator )
The above program is 34 bytes once assembled.
'number' refers to a byte or a short
READ: gets one byte from stdin
WRITE: puts one byte into stdout
READ: nothing
WRITE: puts one byte into stderr
READ: nothing
WRITE: kills the process
READ: nothing
WRITE: defines the address in memory to be called for drawing each frame to screen. setting this will stop the process from exiting once it's finished.
READ: nothing
WRITE: sets a pixel on the screen. high 8 bits are the X coordinate, low 7 bits are the Y coordinate. remaining 0x80 bit either sets the pixel on or off
READ: nothing
WRITE: sets the address in memory of an 8x8 1bpp sprite (total of 8 bytes)
READ: nothing
WRITE: identical to set pixel, but draws the indicated sprite instead
READ: gets one byte that indicates which buttons are currently being pressed. see below
WRITE: sets address in memory to be called when a button is pressed or released
each bit in the controller byte corresponds to one button
────────────────────────────────
Last updated 24R00
Incoming: projects[1]