Chipgrid / Documentation / Reference

Values, notes and colours

What a cell can hold, in base 36; the notes, chords, noise and palettes, as tables.

Values: base 36

One character per cell: after 9 the count goes on with letters, a=10 … z=35. Ten digits + 26 letters = 36 symbols, base 36. So one cell holds 0 to 35.

Symbol0123456789abcdefgh
Value01234567891011121314151617
Symbolijklmnopqrstuvwxyz
Value181920212223242526272829303132333435

What about hex? The first 16 symbols, 0–f, are also the hexadecimal digits, the way 8-bit programmers wrote numbers: one hex digit = 4 bits = 16 values; two digits = a byte, 00–ff = 0–255. Base 36 starts exactly like hex and carries on after f.

Inputs with 16 values. What was 4-bit on the old chips goes 0–f here: colour and background, noise pitch, and the volume I writes. Past f it wraps: g → 0, h → 1.

Results wrap too after z, like an odometer: 9Ar = 9 + 27 = 36 → 0.

Use lowercase for values — uppercase letters are operators (except inside an input, where they are read as values: G = 16).

Careful in note inputs: there, letters are note names first — c is C#, not 12. A sum above 9 sent into a note may play something else than you expect.

Notes

C D E F G A B; lowercase is sharp: c=C#, d=D#, f=F#, g=G#, a=A#. Digits and h–z count semitones up from C.

In the cellCcDdEFfGgAaB
NoteCC#DD#EFF#GG#AA#B

The sound, in numbers

The same settings as the NES chip, from octave 0 to 8.

Pulse duty (P, G)

DutyWidthSound
012.5%thin, nasal
125%the classic lead
250%hollow square, odd harmonics only
375%like 25% (the same wave upside down)

Chords of G

ChordNameSemitones
0octave0 · 12
1fifth0 · 7 · 12
2major0 · 4 · 7
3minor0 · 3 · 7
4sus40 · 5 · 7
5major 70 · 4 · 7 · 11
6minor 70 · 3 · 7 · 10
7diminished0 · 3 · 6

The chord is arpeggiated: its notes follow each other 50 times a second, and the ear fuses them into one chord.

Noise pitches (N)

The pitch chooses how fast the 15-bit shift register steps: the NES processor clock (1.79 MHz) divided by the divider. Mode 1 (metallic) loops after 93 steps instead of 32,767.

PitchDividerRegister clock
04447,443 Hz
18223,722 Hz
216111,861 Hz
33255,930 Hz
46427,965 Hz
59618,643 Hz
612813,983 Hz
716011,186 Hz
82028,860 Hz
92547,046 Hz
a3804,710 Hz
b5083,523 Hz
c7622,349 Hz
d10161,762 Hz
e2034880 Hz
f4068440 Hz

The palettes

Chosen by V (its first input). A colour is a number from 0 to f: change the palette and everything already drawn changes colour. The Game Boy has only four greens, repeated.

Colour0 NES1 C642 Game Boy3 CGA
0#000000#000000#0f380f#000000
1#fcfcfc#ffffff#306230#0000aa
2#f83800#880000#8bac0f#00aa00
3#fca044#aaffee#9bbc0f#00aaaa
4#f8b800#cc44cc#0f380f#aa0000
5#b8f818#00cc55#306230#aa00aa
6#00a800#0000aa#8bac0f#aa5500
7#00e8d8#eeee77#9bbc0f#aaaaaa
8#0078f8#dd8855#0f380f#555555
9#6844fc#664400#306230#5555ff
a#d800cc#ff7777#8bac0f#55ff55
b#f878f8#333333#9bbc0f#55ffff
c#7c7c7c#777777#0f380f#ff5555
d#bcbcbc#aaff66#306230#ff55ff
e#881400#0088ff#8bac0f#ffff55
f#004058#bbbbbb#9bbc0f#ffffff

The screen

160 × 120 pixels. Positions count in blocks of 5 × 5 pixels: x from 0 to 31, y from 0 to 23. O sprites are 8 × 8 pixels, doubled; " letters are 8 pixels wide; $ pixels are 2 × 2. Three layers: 0 back, 1 middle (the usual one), 2 front.

Esc