commit 7c4b3385cb3241aa04102ca10c4664f5cd5aa84e Author: GitHub Actions Date: Mon Apr 8 22:09:53 2024 +0000 Deploy exoticorn/microw8 to exoticorn/microw8:gh-pages diff --git a/404.html b/404.html new file mode 100644 index 0000000..f8414f0 --- /dev/null +++ b/404.html @@ -0,0 +1,3 @@ + +404 Not Found +

404 Not Found

diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..bf04991 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,683 @@ + + + + + + Docs | + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +
+ + + + + +
+
+ +
+ Overview +
+ + + + + +
+ API +
+ + +
+ - Math +
+ +
+ - Random +
+ + + +
+ - Input +
+ + + +
+ - Sound +
+ + + + + + +
+ - uw8 run +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ - Itch.io +
+ + + + + + + + + + + + + + + + + +
+ - Input +
+ + + + + + + + + +
+
+ + + +
+ +
Docs
+

Overview

+

MicroW8 loads WebAssembly modules with a maximum size of 256kb. Your module needs to export +a function fn upd() which will be called once per frame. +After calling upd MicroW8 will display the 320x240 8bpp framebuffer located +at offset 120 in memory with the 32bpp palette located at 0x13000.

+

The memory has to be imported as env memory and has a maximum size of 256kb (4 pages).

+

If the module exports a function called start, it will be called once after the module is +loaded.

+

Memory map

+
00000-00040: user memory
+00040-00044: time since module start in ms
+00044-0004c: gamepad state
+0004c-00050: reserved
+00050-00070: sound data (synced to sound thread)
+00070-00078: reserved
+00078-12c78: frame buffer
+12c78-12c7c: sound registers/work area base address (for sndGes function)
+12c7c-13000: reserved
+13000-13400: palette
+13400-13c00: font
+13c00-14000: reserved
+14000-40000: user memory
+
+

API

+

All API functions are found in the env module.

+

Math

+

These all do what you'd expect them to. All angles are in radians.

+

fn asin(x: f32) -> f32

+

Returns the arcsine of x.

+

fn acos(x: f32) -> f32

+

Returns the arccosine of x.

+

fn atan(f32) -> f32

+

Returns the arctangent of x.

+

fn atan2(y: f32, x: f32) -> f32

+

Returns the angle between the point (x, y) and the positive x-axis.

+

fn sin(angle: f32) -> f32

+

Returns the sine of angle.

+

fn tan(angle: f32) -> f32

+

Returns the tangent of angle.

+

fn cos(angle: f32) -> f32

+

Returns the cosine of angle.

+

fn exp(x: f32) -> f32

+

Returns e^x.

+

fn log(x: f32) -> f32

+

Returns the natural logarithmus of x. Ie. e^log(x) == x.

+

fn pow(x: f32, y: f32) -> f32

+

Returns x^y.

+

fn fmod(x: f32, y: f32) -> f32

+

Returns x modulo y, ie. x - floor(x / y) * y. This means the sign of the result of fmod is the same as y.

+

Random

+

MicroW8 provides a pretty good PRNG, namely xorshift64*. It is initialized to a constant seed at each startup, so if you +want to vary the random sequence you'll need to provide a seed yourself.

+

fn random() -> i32

+

Returns a (pseudo-)random 32bit integer.

+

fn randomf() -> f32

+

Returns a (pseudo-)random float equally distributed in [0,1).

+

fn randomSeed(seed: i32)

+

Seeds the PRNG with the given seed. The seed function is reasonably strong so that you can use

+
randomSeed(index);
+random()
+
+

as a cheap random-access PRNG (aka noise function).

+

Graphics

+

The default palette can be seen here. (Press Z on the keyboard to switch to palette.)

+

The palette can be changed by writing 32bit rgba colors to addresses 0x13000-0x13400.

+

The drawing functions are sub-pixel accurate where applicable (line, circle). Pixel centers lie halfway between integer +coordinates. Ie. the top-left pixel covers the area 0,0 - 1,1, with 0.5,0.5 being the pixel center.

+

fn cls(color: i32)

+

Clears the screen to the given color index. Also sets the text cursor to 0, 0 and disables graphical text mode.

+

fn setPixel(x: i32, y: i32, color: i32)

+

Sets the pixel at x, y to the given color index.

+

fn getPixel(x: i32, y: i32) -> i32

+

Returns the color index at x, y. Returns 0 if the given coordinates are outside the screen.

+

fn hline(left: i32, right: i32, y: i32, color: i32)

+

Fills the horizontal line [left, right), y with the given color index.

+

fn rectangle(x: f32, y: f32, w: f32, h: f32, color: i32)

+

Fills the rectangle x,y - x+w,y+h with the given color index.

+

(Sets all pixels where the pixel center lies inside the rectangle.)

+

fn circle(cx: f32, cy: f32, radius: f32, color: i32)

+

Fills the circle at cx, cy and with radius with the given color index.

+

(Sets all pixels where the pixel center lies inside the circle.)

+

fn rectangleOutline(x: f32, y: f32, w: f32, h: f32, color: i32)

+

Draws a one pixel outline on the inside of the given rectangle.

+

(Draws the outermost pixels that are still inside the rectangle area.)

+

fn circleOutline(cx: f32, cy: f32, radius: f32, color: i32)

+

Draws a one pixel outline on the inside of the given circle.

+

(Draws the outermost pixels that are still inside the circle area.)

+

fn line(x1: f32, y1: f32, x2: f32, y2: f32, color: i32)

+

Draws a line from x1,y1 to x2,y2 in the given color index.

+

fn blitSprite(spriteData: i32, size: i32, x: i32, y: i32, control: i32)

+

Copies the pixel data at spriteData onto the screen at x, y. The size of the sprite is passed as width | (height << 16). +If the height is given as 0, the sprite is is treated as square (width x width).

+

The control parameter controls masking and flipping of the sprite:

+
    +
  • bits 0-7: color mask index
  • +
  • bit 8: switch on masked blit (pixel with color mask index are treated as transparent)
  • +
  • bit 9: flip sprite x
  • +
  • bit 10: flip sprite y
  • +
+

fn grabSprite(spriteData: i32, size: i32, x: i32, y: i32, control: i32)

+

Copies the pixel data on the screen at x, y to spriteData. Parameters are exactly the same as blitSprite.

+

Input

+

MicroW8 provides input from a gamepad with one D-Pad and 4 buttons, or a keyboard emulation thereof.

+

The buttons are numbered

+ + + + + + + + + +
ButtonKeyboardIndex
UpArrow-Up0
DownArrow-Down1
LeftArrow-Left2
RightArrow-Right3
AZ4
BX5
XA6
YS7
+

In addition to using the API functions below, the gamepad state can also be read as a bitfield of +pressed buttons at address 0x44. 0x48 holds the buttons that were pressed last frame.

+

fn isButtonPressed(btn: i32) -> i32

+

Returns whether the buttons with the given index is pressed this frame.

+

fn isButtonTriggered(btn: i32) -> i32

+

Returns whether the given button is newly pressed this frame.

+

fn time() -> f32

+

Returns the time in seconds since the start of the cart.

+

The integer time in milliseconds can also be read at address 0x40.

+

Text output

+

The default font can be seen here.

+

The font can be changed by writing 1bpp 8x8 characters to addresses 0x13400-0x13c00.

+

All text printing is done at the cursor position, which is advanced after printing each character. +The cursor is not visible.

+

Text printing can operate in two modes - normal and graphics. After startup and after cls() normal mode is active.

+

Normal mode

+

In normal mode, text printing is constrained to an 8x8 character grid. Setting the cursor position to 2,3 will start printing at pixel coordinates 16,24.

+

When printing characters, the full 8x8 pixels are painted with the text and background colors according to the character graphics in the font.

+

When moving/printing past the left or right border the cursor will automatically wrap to the previous/next line. When moving/printing past the upper/lower border, the screen will be scrolled down/up 8 pixels, filling the fresh line with the background color.

+

Graphics mode

+

In graphics mode, text can be printed to any pixel position, the cursor position is set in pixel coordinates.

+

When printing characters only the foreground pixels are set, the background is "transparent".

+

Moving/printing past any border does not cause any special operation, the cursor just goes off-screen.

+

Control chars

+

Characters 0-31 are control characters and don't print by default. They take the next 0-2 following characters as parameters. +Avoid the reserved control chars, they are currently NOPs but their behavior can change in later MicroW8 versions.

+ + + + + + + + + + + + + + + + + + + + +
CodeParametersOperation
0-Nop
1charPrint char (including control chars)
2-3-Reserved
4-Switch to normal mode, reset cursor to 0,0
5-Switch to graphics mode
6-Switch output to (debug) console
7-Bell / trigger sound channel 0
8-Move cursor left
9-Move cursor right
10-Move cursor down
11-Move cursor up
12-do cls(background_color)
13-Move cursor to the left border
14colorSet the background color
15colorSet the text color
16-23-Reserved
24-Swap text/background colors
25-30-Reserved
31x, ySet cursor position (*)
+

(*) In graphics mode, the x coordinate is doubled when using control char 31 to be able to cover the whole screen with one byte.

+

Debug output

+

Control code 6 switches all text output (except codes 4 and 5 to switch output back to the screen) to the console. Where exactly this ends +up (if at all) is an implementation detail of the runtimes. The native dev-runtime writes the debug output to stdout, the web runtime to +the debug console using console.log. Both implementation buffer the output until they encounter a newline character (10) in the output stream.

+

There may be future runtimes that ignore the debug output completely.

+

In CurlyWas, a simple way to log some value might look like this:

+
printChar('\06V: '); // switch to console out, print some prefix
+printInt(some_value);
+printChar('\n\4'); // newline and switch back to screen
+
+

fn printChar(char: i32)

+

Prints the character in the lower 8 bits of char. If the upper 24 bits are non-zero, right-shifts char by 8 bits and loops back to the beginning.

+

fn printString(ptr: i32)

+

Prints the zero-terminated string at the given memory address.

+

fn printInt(num: i32)

+

Prints num as a signed decimal number.

+

fn setTextColor(color: i32)

+

Sets the text color.

+

fn setBackgroundColor(color: i32)

+

Sets the background color.

+

fn setCursorPosition(x: i32, y: i32)

+

Sets the cursor position. In normal mode x and y are multiplied by 8 to get the pixel position, in graphics mode they are used as is.

+

Sound

+

Low level operation

+

MicroW8 actually runs two instances of your module. On the first instance, it calls upd and displays the framebuffer found in its memory. On the +second instance, it calls snd instead with an incrementing sample index and expects that function to return sound samples for the left and right +channel at 44100 Hz. If your module does not export a snd function, it calls the api function sndGes instead.

+

As the only means of communication, 32 bytes starting at address 0x00050 are copied from main to sound memory after upd returns.

+

By default, the sndGes function generates sound based on the 32 bytes at 0x00050. This means that in the default configuration those 32 bytes act +as sound registers. See the sndGes function for the meaning of those registers.

+

export fn snd(sampleIndex: i32) -> f32

+

If the module exports a snd function, it is called 88200 times per second to provide PCM sample data for playback (44.1kHz stereo). +The sampleIndex will start at 0 and increments by 1 for each call. On even indices the function is expected to return a sample value for +the left channel, on odd indices for the right channel.

+

fn playNote(channel: i32, note: i32)

+

Triggers a note (1-127) on the given channel (0-3). Notes are semitones with 69 being A4 (same as MIDI). A note value of 0 stops the +sound playing on that channel. A note value 128-255 will trigger note-128 and immediately stop it (playing attack+release parts of envelope).

+

This function assumes the default setup, with the sndGes registers located at 0x00050.

+

fn sndGes(sampleIndex: i32) -> f32

+

This implements a sound chip, generating sound based on 32 bytes of sound registers.

+

The spec of this sound chip are:

+
    +
  • 4 channels with individual volume control (0-15)
  • +
  • rect, saw, tri, noise wave forms selectable per channel
  • +
  • each wave form supports some kind of pulse width modulation
  • +
  • each channel has an optional automatic low pass filter, or can be sent to one of two manually controllable filters
  • +
  • each channel can select between a narrow and a wide stereo positioning. The two stereo positions of each channel are fixed.
  • +
  • optional ring modulation
  • +
+

This function requires 1024 bytes of working memory, the first 32 bytes of which are interpreted as the sound registers. +The base address of its working memory can be configured by writing the address to 0x12c78. It defaults to 0x00050.

+

Here is a short description of the 32 sound registers.

+
00 - CTRL0
+06 - CTRL1
+0c - CTRL2
+12 - CTRL3
+  | 7  6 |   5  |   4  |  3  2  |    1    |    0    |
+  | wave | ring | wide | filter | trigger | note on |
+
+  note on: stay in decay/sustain part of envelope
+  trigger: the attack part of the envlope is triggered when either this changes
+           or note on is changed from 0 to 1.
+  filter : 0 - no filter
+           1 - fixed 6db 1-pole filter with cutoff two octaves above note
+           2 - programmable filter 0
+           3 - programmable filter 1
+  wide   : use wide stereo panning
+  ring   : ring modulate with triangle wave at frequency of previous channel
+  wave   : 0 - rectangle
+           1 - saw
+           2 - triangle
+           3 - noise
+
+01 - PULS0
+07 - PULS1
+0d - PULS2
+13 - PULS3
+  Pulse width 0-255, with 0 being the plain version of each wave form.
+  rectangle - 50%-100% pulse width
+  saw       - inverts 0%-100% of the saw wave form around the center
+  triangle  - morphs into an octave up triangle wave
+  noise     - blends into a decimated saw wave (just try it out)
+
+02 - FINE0
+08 - FINE1
+0e - FINE2
+14 - FINE3
+  Fractional note
+
+03 - NOTE0
+09 - NOTE1
+0f - NOTE2
+15 - NOTE3
+  Note, 69 = A4
+
+04 - ENVA0
+0a - ENVA1
+10 - ENVA2
+16 - ENVA3
+  | 7 6 5 4 | 3 2 1 0 |
+  | decay   | attack  |
+
+05 - ENVB0
+0b - ENVB1
+11 - ENVB2
+17 - ENVB3
+  | 7 6 5 4 | 3 2 1 0 |
+  | release | sustain |
+
+18 - VO01
+  | 7 6 5 4  | 3 2 1 0  |
+  | volume 1 | volume 0 |
+
+19 - VO23
+  | 7 6 5 4  | 3 2 1 0  |
+  | volume 3 | volume 2 |
+
+1a - FCTR0
+1b - FCTR1
+  | 7 6 5 4   | 3 | 2    | 1    | 0   |
+  | resonance | 0 | band | high | low |
+
+1c - FFIN0
+1e - FFIN1
+  cutoff frequency - fractional note
+
+1d - FNOT0
+1f - FNOT1
+  cutoff frequency - note
+
+

The uw8 tool

+

The uw8 tool included in the MicroW8 download includes a number of useful tools for developing MicroW8 carts. For small productions written in +wat or CurlyWas you don't need anything apart from uw8 and a text editor of your choice.

+

uw8 run

+

Usage:

+

uw8 run [<options>] <file>

+

Runs <file> which can be a binary WebAssembly module, an .uw8 cart, a wat (WebAssembly text format) source file or a CurlyWas source file.

+

Options:

+
    +
  • -b, --browser: Run in browser instead of using native runtime
  • +
  • -t FRAMES, --timeout FRAMES: Sets the timeout in frames (1/60s). If the start or update function runs longer than this it is forcibly interupted +and execution of the cart is stopped. Defaults to 30 (0.5s)
  • +
  • -w, --watch: Reloads the given file every time it changes on disk.
  • +
  • -p, --pack: Pack the file into an .uw8 cart before running it and print the resulting size.
  • +
  • -u, --uncompressed: Use the uncompressed uw8 format for packing.
  • +
  • -l LEVEL, --level LEVEL: Compression level (0-9). Higher compression levels are really slow.
  • +
  • -o FILE, --output FILE: Write the loaded and optionally packed cart back to disk.
  • +
+

when using the native runtime:

+
    +
  • -m, --no-audio: Disable audio, also reduces cpu load a bit
  • +
  • --no-gpu: Force old cpu-only window code
  • +
  • --filter FILTER: Select an upscale filter at startup
  • +
  • --fullscreen: Start in fullscreen mode
  • +
+

Note that the cpu-only window does not support fullscreen nor upscale filters.

+

Unless --no-gpu is given, uw8 will first try to open a gpu accelerated window, falling back to the old cpu-only window if that fails. +Therefore you should rarely need to manually pass --no-gpu. If you prefer the old pixel doubling look to the now default crt filter, +you can just pass --filter nearest or --filter 1.

+

The upscale filter options are:

+
1, nearest              : Anti-aliased nearest filter
+2, fast_crt             : Very simple, cheap crt filter, not very good below a window size of 960x720
+3, ss_crt               : Super sampled crt filter, a little more demanding on the GPU but scales well to smaller window sizes
+4, chromatic_crt        : Variant of fast_crt with a slight offset of the three color dots of a pixel, still pretty cheap
+5, auto_crt (default)   : ss_crt below 960x720, chromatic_crt otherwise
+
+

You can switch the upscale filter at any time using the keys 1-5. You can toggle fullscreen with F.

+

uw8 pack

+

Usage:

+

uw8 pack [<options>] <infile> <outfile>

+

Packs the WebAssembly module or text file, or CurlyWas source file into a .uw8 cart.

+

Options:

+
    +
  • -u, --uncompressed: Use the uncompressed uw8 format for packing.
  • +
  • -l LEVEL, --level LEVEL: Compression level (0-9). Higher compression levels are really slow.
  • +
+

uw8 unpack

+

Usage:

+

uw8 unpack <infile> <outfile>

+

Unpacks a MicroW8 module into a standard WebAssembly module.

+

uw8 compile

+

Usage:

+

uw8 compile [<options>] <infile> <outfile>

+

Compiles a CurlyWas source file to a standard WebAssembly module. Most useful together with +the --debug option to get a module that works well in the Chrome debugger.

+

Options:

+
    +
  • -d, --debug: Generate a name section to help debugging
  • +
+

uw8 filter-exports

+

Usage:

+

uw8 filter-exports <infile> <outfile>

+

Reads a binary WebAssembly module, removes all exports not used by the MicroW8 platform + everything that is unreachable without those exports and writes the resulting module to outfile.

+

When compiling C code (or Rust, zig or others) to WebAssembly, you end up with a few exported global variables that are used for managing the heap and C stack, even if the code doesn't actually use those features. You can use this command to automatically remove them and gain a few bytes. See the C, Rust and zig examples in the MicroW8 repository.

+

Other useful tools

+

The Web Assembly Binary Toolkit includes +a few useful tools, eg. wat2wasm to compile the WebAssemby text format to binary +wasm and wasm2wat to disassemble wasm binaries.

+

Binaryen includes wasm-opt which enable additional optimizations over what LLVM (the backend that is used by most compilers that target WebAssembly) can do.

+

Distribution

+

The classical distribution option is just to put the .uw8 cart into a zip file, let people run it themselves, either in the uw8 tool or in the web runtime.

+

If you want to go this way, you might consider including microw8.html in your download. It's specifically designed to be a small (~10KB at the moment), self-contained HTML file for just this reason. That way, anyone who has downloaded you production can run it, even when offline, provided they have a modern web browser at hand. Also, should future versions of MicroW8 ever introduce any kind of incompatibilities, they'd still have a compatible version right there without hunting arround for an old version.

+ +

For small productions (<= 1024 bytes), when you load them in the web runtime, the URL is automatically updated to include the cart as base64 encoded data. You can just give that URL to others for them to run your prod.

+

url parameter

+

Another option is to put the cart on a webserver and add #url=url/to/the/cart.uw8 to the end of the web runtime URL. (Like this)

+

If the cart and the web runtime are on different domains, you'll have to make sure that CORS header are enabled for the cart, otherwise the web runtime won't be able to load it.

+

Feel free to put the web runtime on your own server if it makes sense to you, its license allows you to do anything you want with it.

+

.html + .uw8

+

At startup the web runtime will try to load a cart in the same directory as the .html file. If the URL of the web runtime ends in .html it will try to load a cart with the same name and the extension .uw8. If the URL of the web runtime ends in a / it will try to load a cart.uw8 at that location.

+

So, you could for example serve the web runtime as https://example.org/mytunnel.html and the cart as https://example.org/mytunnel.uw8 and send people to the HTML page to run the cart. Or you could put them up as https://example.org/mytunnel/index.html and https://example.org/mytunnel/cart.uw8 and send people to https://example.org/mytunnel.

+

If a cart is found and loaded in this way, the load button is hidden.

+

Itch.io

+

The above .html + .uw8 option works great on Itch.io as well. Put these two files into a zip archive:

+
    +
  • index.html: a copy of the web runtime (microw8.html in the MicroW8 download)
  • +
  • index.uw8: Your game cart
  • +
+

Upload the zip file to itch.io and make sure to set the embedded viewport size to exactly (!) 640x480 pixel. At that exact size the web runtime hides everything except for the MicroW8 screen.

+

If instead you actually want to display the border around the screen and the byte size you can try a size of about 720x620.

+

See here for an example upload.

+

.uw8 format

+

The first byte of the file specifies the format version:

+

Format version 00:

+

This file is simply a standard WebAssembly module

+

Format version 01:

+

The rest of this file is the same as a WebAssembly +module with the 8 byte header removed. This module +can leave out sections which are then taken from +a base module provided by MicroW8.

+

You can generate this base module yourself using +uw8-tool. As a quick summary, it provides all function +types with up to 5 parameters (i32 or f32) where the +f32 parameters always preceed the i32 parameters. +Then it includes all imports that MicroW8 provides, +a function section with a single function of type +() -> void and an export section that exports +the first function in the file under the name upd.

+

Format version 02:

+

Same as version 01 except everything after the first byte is compressed +using a custom LZ compression scheme.

+

The web runtime

+

Load carts into the web runtime either by using the "Load cart..." button, or by dragging the file +onto the screen area.

+

Input

+

For input, you can either use a standard gamepad or keyboard. On a keyboard use the arrow keys and the keys Z, X, A and S to emulate the A, B, X and Y buttons.

+

Video recording

+

Press F10 to start recording, press again to stop. Then a download dialog will open for the video file. +The file might miss some metadata needed to load in some video editing tools, in that case you can run +it through ffmpeg like this `ffmpeg -i IN_NAME.webm -c copy -o OUT_NAME.webm to fix it up.

+

To convert it to 1280x720, for example for a lovebyte upload, you can use:

+
ffmpeg -i IN.webm -vf "scale=960:720:flags=neighbor,pad=1280:720:160:0" -r 60 OUT.mp4
+
+

Screenshot

+

Pressing F9 opens a download dialog with a screenshot.

+

Devkit mode

+

Append #devkit to the web runtime url in order to switch to devkit mode. In devkit mode, standard web assembly modules +are loaded bypassing the loader, removing all size restrictions. At the same time, the memory limit is increased to 1GB.

+ + +
+ + + +
+ + + + + + + diff --git a/img/microw8.svg b/img/microw8.svg new file mode 100644 index 0000000..09d9478 --- /dev/null +++ b/img/microw8.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/img/technotunnel.png b/img/technotunnel.png new file mode 100644 index 0000000..e9cf229 Binary files /dev/null and b/img/technotunnel.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..bcdb94a --- /dev/null +++ b/index.html @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ +
+ +
+
+

A WebAssembly based fantasy console

+
+ + + +
+
+ Explore More ⇩ +
+ +
+ + + +
+ + + + + +
+
+ +
+ About +
+ + +
+ Specs +
+ + +
+ Examples +
+ + +
+ Versions +
+ + +
+ - v0.2.2 +
+ +
+ - v0.2.1 +
+ +
+ - v0.2.0 +
+ + + + + +
+
+ + + +
+ +
Overview
+

About

+

MicroW8 is a WebAssembly based fantasy console inspired by the likes of TIC-80, WASM-4 and PICO-8.

+

The initial motivation behind MicroW8 was to explore whether there was a way to make WebAssembly viable for size-coding. (Size coding being the art of creating tiny (often <= 256 bytes) graphical effects and games.) The available examples so far are all in this space, however, I very carefully made sure that all design decisions make sense from the point of view of bigger projects as well.

+

Specs

+
    +
  • Screen: 320x240, 256 colors, 60Hz
  • +
  • Modules: Up to 256KB (WASM)
  • +
  • Memory: 256KB
  • +
  • Gamepad input (D-Pad + 4 Buttons)
  • +
+

For detailed documentation see here.

+

Examples

+ +

Examplers for older versions:

+
    +
  • Technotunnel B/W (199 bytes uncompressed): A port of my entry in the Outline'21 bytebattle quater final (older MicroW8 version with monochrome palette)
  • +
  • XorScroll (50 bytes uncompressed): A simple scrolling XOR pattern. Fun fact: This is the pre-loaded effect when entering a bytebattle.
  • +
  • CircleWorm (126 bytes uncompressed): Just a test for the circle fill function.
  • +
+

Versions

+

v0.2.2

+ +

Changes:

+
    +
  • call start function after loading cart if the cart exports one
  • +
  • fix sndGes having the wrong name and not being included in the auto imports
  • +
  • fix control codes 4-6 (change text output mode) being invoked when used as parameters in other control sequences
  • +
  • only open browser window once a cart was compiled sucessfully when running with -b
  • +
+

v0.2.1

+ +

Changes:

+
    +
  • new gpu accelerated renderer with (optional) crt filter
  • +
  • optimized hline function, a big speed-up when drawing large filled circles or rectangles
  • +
  • print fractional size of packed uw8 cart
  • +
+

v0.2.0

+ +

Changes:

+
    +
  • add sound support!
  • +
  • add support to redirect text output to the console for debugging using control code 6
  • +
  • update curlywas: +
      +
    • add support for else if
    • +
    • add support for escape sequences in strings
    • +
    • add support for char literals
    • +
    • add support for binop-assignment, eg. +=, ^=, <<= etc. (also support for the tee operator: +:=)
    • +
    • "integer constant cast to float" literal syntax in CurlyWas (ex. 1_f is equivalent to 1 as f32)
    • +
    +
  • +
+

Older versions

+

Find older versions here.

+ + +
+ + + +
+ + + + + + + diff --git a/juice.css b/juice.css new file mode 100644 index 0000000..768b427 --- /dev/null +++ b/juice.css @@ -0,0 +1 @@ +.text-center{text-align:center}.pos-absolute{right:0;left:0;position:absolute}.box-shadow{box-shadow:0 2px 10px 2px #ddd}.heading-text{font-family:"Fira Sans", sans-serif;font-size:32px;font-weight:600;padding:10px 0 25px 0;color:var(--primary-text-color)}h1,.title-text{font-family:"Fira Sans", sans-serif;font-size:25px;font-weight:500;color:var(--primary-text-color);border-left:var(--primary-color) 8px solid;padding-left:10px}h2,.subtitle-text{font-family:"Fira Sans", sans-serif;font-size:20px;font-weight:500;color:var(--primary-text-color)}.text{font-family:"Fira Sans", sans-serif;font-size:18px;font-weight:400;line-height:26px;letter-spacing:0.2px;color:var(--primary-text-color)}.subtext{font-family:"Fira Sans", sans-serif;font-size:16px;font-weight:400;letter-spacing:0.1px}.content{padding:0 40px;display:flex;flex-direction:column;overflow-x:auto}.content pre{overflow-x:auto;padding:1.25em 1.5em;white-space:pre;word-wrap:normal;background-color:white;color:#4a4a4a;font-size:.875em;font-family:monospace}.content code{background-color:white;color:#4a4a4a;font-size:.875em;font-weight:normal;padding:0.25em 0.5em;font-family:monospace}.content pre code{padding:0}.content a{color:var(--primary-link-color)}.content a:hover{text-decoration:underline}.content blockquote{border-left:#e2dede 8px solid;margin:0;background-color:#f2f1f0;padding:0 20px}body{padding:0;margin:0;box-sizing:border-box;background-color:var(--secondary-color);display:flex;flex-direction:column;min-height:100vh}a{text-decoration:none}ul{margin-top:0.5rem}ul>li{padding:0.3rem 0}p>img{width:100%;height:auto}header{background-color:var(--primary-color);color:black;padding:20px 50px;display:flex;align-items:center;justify-content:space-between}.logo{font-family:"Alfa Slab One", serif;font-size:32px;color:var(--primary-text-color);display:flex;align-items:center;margin:0 40px}.logo img{width:60px;margin:0 25px}.nav-item{margin:0 10px;text-decoration:none;font-size:18px;font-weight:bold}.nav-item:hover{color:#000;text-decoration:underline}.hero{display:flex;align-items:center;justify-content:space-evenly;height:100vh;background-color:var(--primary-color);overflow-x:hidden;padding:0 40px}.hero .explore-more{position:absolute;bottom:20px;cursor:pointer}main{display:flex;padding:50px 100px;flex-grow:1}main .toc{max-width:260px;min-width:240px}main .toc-item{padding:10px 20px;color:#424242}main .toc-item a,main .toc-item-child a{color:var(--secondary-text-color)}main .toc-item a:hover,main .toc-item-child a:hover{cursor:pointer;text-decoration:underline}main .toc-item a.active,main .toc-item-child a.active{color:var(--toc-highlight-text-color)}main .toc-item-child{padding:0 30px 5px;color:#424242}.toc-sticky{border-radius:3px;border-top:5px solid var(--primary-color);background-color:white;position:sticky;position:-webkit-sticky;position:-moz-sticky;position:-ms-sticky;position:-o-sticky;top:10px;padding:10px 0 20px;max-height:100vh;overflow:auto}footer{padding:50px;display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:#202020;color:#fcfcfc}footer a{color:#fcfcfc;text-decoration:underline}@media screen and (min-width: 1280px){.content{max-width:60%;min-width:800px}}@media screen and (max-width: 768px){header{padding:10px 30px;flex-direction:column;align-items:center;justify-content:center}.logo{font-size:28px;margin:10px}.logo img{width:45px;margin:0 10px 0 0}.nav-item{margin:0 5px;font-size:14px}.hero{padding:40px 30px}main{padding:30px}.content{padding:0}.explore-more,.toc{display:none}} diff --git a/normalize.css b/normalize.css new file mode 100644 index 0000000..192eb9c --- /dev/null +++ b/normalize.css @@ -0,0 +1,349 @@ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + +html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +/** + * Render the `main` element consistently in IE. + */ + +main { + display: block; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type="button"], +[type="reset"], +[type="submit"] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} diff --git a/robots.txt b/robots.txt new file mode 100644 index 0000000..f75e61c --- /dev/null +++ b/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Disallow: +Allow: / +Sitemap: https://exoticorn.github.io/microw8/sitemap.xml diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..14148a0 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,12 @@ + + + + https://exoticorn.github.io/microw8/ + + + https://exoticorn.github.io/microw8/docs/ + + + https://exoticorn.github.io/microw8/versions/ + + diff --git a/uw8/skipahead.uw8 b/uw8/skipahead.uw8 new file mode 100644 index 0000000..b25250b Binary files /dev/null and b/uw8/skipahead.uw8 differ diff --git a/v0.1.0/index.html b/v0.1.0/index.html new file mode 100644 index 0000000..4a42077 --- /dev/null +++ b/v0.1.0/index.html @@ -0,0 +1 @@ +MicroW8
MicroW8 0.1.0
\ No newline at end of file diff --git a/v0.1.1/index.html b/v0.1.1/index.html new file mode 100644 index 0000000..03cc5e1 --- /dev/null +++ b/v0.1.1/index.html @@ -0,0 +1 @@ +MicroW8
MicroW8 0.1.1
\ No newline at end of file diff --git a/v0.1.2/index.html b/v0.1.2/index.html new file mode 100644 index 0000000..56877b9 --- /dev/null +++ b/v0.1.2/index.html @@ -0,0 +1 @@ +MicroW8
MicroW8 0.1.2
\ No newline at end of file diff --git a/v0.1pre1/index.html b/v0.1pre1/index.html new file mode 100644 index 0000000..c8331a1 --- /dev/null +++ b/v0.1pre1/index.html @@ -0,0 +1 @@ +MicroW8
\ No newline at end of file diff --git a/v0.1pre2/index.html b/v0.1pre2/index.html new file mode 100644 index 0000000..75f5447 --- /dev/null +++ b/v0.1pre2/index.html @@ -0,0 +1 @@ +MicroW8
\ No newline at end of file diff --git a/v0.1pre3/index.html b/v0.1pre3/index.html new file mode 100644 index 0000000..7a6fdce --- /dev/null +++ b/v0.1pre3/index.html @@ -0,0 +1 @@ +MicroW8
\ No newline at end of file diff --git a/v0.1pre4/index.html b/v0.1pre4/index.html new file mode 100644 index 0000000..6e704bd --- /dev/null +++ b/v0.1pre4/index.html @@ -0,0 +1 @@ +MicroW8
\ No newline at end of file diff --git a/v0.1pre5/index.html b/v0.1pre5/index.html new file mode 100644 index 0000000..2aa2b1a --- /dev/null +++ b/v0.1pre5/index.html @@ -0,0 +1 @@ +MicroW8
\ No newline at end of file diff --git a/v0.2.0-rc1/index.html b/v0.2.0-rc1/index.html new file mode 100644 index 0000000..c5a7c95 --- /dev/null +++ b/v0.2.0-rc1/index.html @@ -0,0 +1 @@ +MicroW8
MicroW8 0.2.0-rc1
\ No newline at end of file diff --git a/v0.2.0-rc2/index.html b/v0.2.0-rc2/index.html new file mode 100644 index 0000000..ff05584 --- /dev/null +++ b/v0.2.0-rc2/index.html @@ -0,0 +1 @@ +MicroW8
MicroW8 0.2.0-rc2
\ No newline at end of file diff --git a/v0.2.0-rc3/index.html b/v0.2.0-rc3/index.html new file mode 100644 index 0000000..9c00091 --- /dev/null +++ b/v0.2.0-rc3/index.html @@ -0,0 +1 @@ +MicroW8
MicroW8 0.2.0-rc3
\ No newline at end of file diff --git a/v0.2.0/index.html b/v0.2.0/index.html new file mode 100644 index 0000000..5564334 --- /dev/null +++ b/v0.2.0/index.html @@ -0,0 +1 @@ +MicroW8
MicroW8 0.2.0
\ No newline at end of file diff --git a/v0.2.1/index.html b/v0.2.1/index.html new file mode 100644 index 0000000..c25f2e8 --- /dev/null +++ b/v0.2.1/index.html @@ -0,0 +1 @@ +MicroW8
MicroW8 0.2.1
\ No newline at end of file diff --git a/v0.2.2/index.html b/v0.2.2/index.html new file mode 100644 index 0000000..afff28c --- /dev/null +++ b/v0.2.2/index.html @@ -0,0 +1 @@ +MicroW8
MicroW8 0.2.2
\ No newline at end of file diff --git a/versions/index.html b/versions/index.html new file mode 100644 index 0000000..5c7ad25 --- /dev/null +++ b/versions/index.html @@ -0,0 +1,268 @@ + + + + + + | + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +
+ + + + + +
+
+ +
+ v0.2.0 +
+ + + + + + + + + + + +
+ v0.1.2 +
+ + +
+ v0.1.1 +
+ + +
+ v0.1.0 +
+ + +
+
+ + + +
+ +
Versions
+

v0.2.0

+ +

Changes:

+
    +
  • add sound support!
  • +
  • add support to redirect text output to the console for debugging using control code 6
  • +
  • update curlywas: +
      +
    • add support for else if
    • +
    • add support for escape sequences in strings
    • +
    • add support for char literals
    • +
    • add support for binop-assignment, eg. +=, ^=, <<= etc. (also support for the tee operator: +:=)
    • +
    • "integer constant cast to float" literal syntax in CurlyWas (ex. 1_f is equivalent to 1 as f32)
    • +
    +
  • +
+

v0.2.0-rc3

+ +

Changes:

+
    +
  • improve timing stability some more. essentially now guaranteeing that "frame = time_ms * 6 / 100" returns +consecutive frame numbers, provided the module can be run at 60 fps
  • +
  • add support to redirect text output to the console for debugging using control code 6
  • +
  • update curlywas: +
      +
    • add support for else if
    • +
    • add support for escape sequences in strings
    • +
    • add support for char literals
    • +
    • add support for binop-assignment, eg. +=, ^=, <<= etc. (also support for the tee operator: +:=)
    • +
    +
  • +
+

v0.2.0-rc2

+ +

Changes:

+
    +
  • fix timing issues of sound playback, especially on systems with large sound buffers
  • +
+

v0.2.0-rc1

+ +

Changes:

+
    +
  • add sound support
  • +
  • "integer constant cast to float" literal syntax in CurlyWas (ex. 1_f is equivalent to 1 as f32)
  • +
+

Known issues:

+
    +
  • timing accuracy/update frequency of sound support currently depends on sound buffer size
  • +
+

v0.1.2

+ +

Changes:

+
    +
  • add option to uw8 run to run the cart in the browser using the web runtime
  • +
  • CurlyWas: implement include support
  • +
  • CurlyWas: implement support for constants
  • +
  • fix crash when trying to draw zero sized line
  • +
+

v0.1.1

+ +

Changes:

+
    +
  • implement more robust file watcher
  • +
  • add basic video recording on F10 in web runtime
  • +
  • add screenshot on F9
  • +
  • add watchdog to interrupt hanging update in native runtime
  • +
  • add devkit mode to web runtime
  • +
  • add unpack and compile commands to uw8
  • +
  • add support for table/element section in pack command
  • +
  • disable wayland support (caused missing window decorations in gnome)
  • +
+

v0.1.0

+ + + +
+ + + +
+ + + + + + +