= = = SIX BIT MACHINE = = =

By Jack Eisenmann


The Six Bit Machine is a virtual console which emulates a 6-bit processing environment to deliver true retro-style games. It features its own unique machine code, color graphics, sound, and the ability to create your own games by entering code.


This emulator is currently in BETA mode! I have recently finished the console, so there still may be some minor bugs. You can use it by clicking the link below:


6 bit machine.swf


The only game available right now is "pong", which is only for testing purposes... Yes, it is a simple game. Future games will be much more complex.


= SYSTEM DETAILS =


This console is genuinely 6-bit; ALL data in the machine is processed as a 6 bit number. 6 bits allow for numbers between 0 and 63 (2^6 = 64). A "byte" in this guide will refer to a 6-bit byte, not an 8-bit byte.


The system has 2 kinds of ROM (predefined sets of 6 bit numbers) and 2 kinds of RAM (variable sets of 6 bit numbers). ROM is always 4096 bytes maximum (having 2 byte addressing), and RAM is always 64 bytes max (1 byte addressing). The kinds of memory are described below.


Data ROM contains data which is used for things such as music, level data, etc. Any large amount of static information can be stored in data ROM and called in a program.


Program ROM contains commands which are executed by the system. All code is contained in program ROM.


Program RAM (or just RAM) is used to temporarily store information used by the program. Things such as counters, scores, and locations can be stored in RAM.


Lastly, screen RAM stores a byte for each 6 by 6 pixel region of the display. This is useful for when a character needs to navigate over a terrain. The screen is 48 by 48 pixels, so there are 8 by 8 screen RAM regions.


= COMPILER DETAILS =


For the purpose of efficient memory usage, 1 byte serves many functional purposes; it can be used as a coordinate, color, note, etc. The code compiler recognizes many techniques for converting such things into 6-bit numbers. Each of these elements are separated by a space (or by a new line; it doesn't matter which or how many you use to separate elements). The conversions are listed below.


Any base 10 number between 0 and 63 is stored directly according to its value. Similarly, any 6 bit binary number is stored according to its value (for example, 010001 is 17).


Non-numeric characters are converted into 6-bit numbers according to a special encoding. Starting with the first character as 1, the encoding is as follows:

(space)ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_=+:',<.>/?lrud

The last 4 characters represent arrow keys. Note that if you type a tilde (~) before a numeric character, it will be encoded (for example, ~3 encodes a 3). To encode a space, a tilde by itself is used (~ encodes a space).


A coordinate is stored by entering [x,y], where x and y are any number between 0 and 7. Coordinates are used to locate certain sprites on the screen.


Colors are stored by entering [r,g,b], where r, g, and b are numbers 0 through 3. Each number represents a color in the rgb value; smaller numbers are darker, larger ones are lighter.


A musical note can be converted if written in the form xyz, where x is A, B, C, D, E, F, or G, y is - (natural), + (sharp), or b (flat), and z is an octave between 1 and 5 (an example note is C-3, which is C natural in the 3rd octave).


If you write stop or loop, it tells the sound processor to either stop playing the current sound or loop to where the music started playing.


Lastly, data ROM is separated from program ROM by any amount of number signs (#, or ########### to emphasize division). Any values before the separator are in data ROM, and values after are in program ROM.


= COMMAND DETAILS =


All commands have a command name (determined by a letter) and arguments. Commands are strung together without separation. All of the commands are described below.


C (arg number) (address)

Call: Substitute a value in a RAM address as an argument in the next command (which is NOT a substitution command). The first argument after the command is 1.


S (address) (value)

Set: Store a value in an address in RAM.


M (address) (value 1 address) (+, -, *, or /) (value 2)

Math: Perform a mathematical operation and store the result in an address. Values loop from 63 to 0, and are rounded down!


R (address) (maximum value)

Random: Generates a random number within a certain range and stores it.


B (address 1) (address 2) (value address)

Binary: Stores the text equivalent of a 6 bit number. 2 addresses are used for storing the number (one for each character).


L (ROM address 1) (ROM address 1)

Label: Stores the current position in the code in 2 addresses OR marks a position (if both addresses are the same).


G (ROM address 1) (ROM address 2)

Goto: Skips to a pre-stored position in the code OR skips forward until the correct mark is found (if addresses are the same).


H (frames)

Halt: Stops execution until a certain number of frames have passed (FPS rate is 10).


I (value 1 address) (=, !, <, or >) (value 2)

If: If the condition is false, then the next command is skipped.


P (x) (y) (color)

Pixel: Displays a single pixel.


D (coordinate) (color) (number) (row 1) (row 2) ... (row 6)

Display: Displays an image and stores a number in its position in screen RAM. Each row should be written as a binary number, where a 1 represents a pixel.


T (coordinate) (color) (char 1) (char 2) ... 0

Text: Displays text. The end of the text is marked by 0. Stores 1 in the position of each letter in screen RAM.


F (address) (coordinate)

Find: Stores the number of a certain place in screen RAM.


E (coordinate)

Erase: Clears an image, setting the number at its position to 0.


A

Clear all: Clears the entire screen, setting all positions to 0.


X (address) (coordinate)

Stores the x value of a coordinate.


Y (address) (coordinate)

Stores the y value of a coordinate.


Z (address) (x) (y)

Converts an x and y value into a coordinate.


K (address) (key/character)

Key: Stores 1 if the key has been pressed, otherwise 0. The only input the user can give is a, s, p, and the arrow keys.


> (RAM address) (Data ROM address 1) (Data ROM address 2)

Data ROM: Stores data from data ROM into RAM. Data ROM is used for level data, music data, etc.


N (channel: 0 or 1) (command: 0 or 1) (Data ROM address 1) (Data ROM address 2)

Note: Makes sound play according to notes stored in given locations in data ROM. There are 2 channels for music. 0 for a command means stop, 1 means play. Notes in data ROM are played consecutively. A 0 as a note means play no note. 1 through 7 as a note means hold the last note played for a number of beats (there are 5 beats in a second). The music player will respond to "stop" and "loop" commands in data ROM.