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.
| Symbol | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f | g | h |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| Symbol | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
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 cell | C | c | D | d | E | F | f | G | g | A | a | B |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Note | C | C# | D | D# | E | F | F# | G | G# | A | A# | B |
The sound, in numbers
The same settings as the NES chip, from octave 0 to 8.
Pulse duty (P, G)
| Duty | Width | Sound |
|---|---|---|
0 | 12.5% | thin, nasal |
1 | 25% | the classic lead |
2 | 50% | hollow square, odd harmonics only |
3 | 75% | like 25% (the same wave upside down) |
Chords of G
| Chord | Name | Semitones |
|---|---|---|
0 | octave | 0 · 12 |
1 | fifth | 0 · 7 · 12 |
2 | major | 0 · 4 · 7 |
3 | minor | 0 · 3 · 7 |
4 | sus4 | 0 · 5 · 7 |
5 | major 7 | 0 · 4 · 7 · 11 |
6 | minor 7 | 0 · 3 · 7 · 10 |
7 | diminished | 0 · 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.
| Pitch | Divider | Register clock |
|---|---|---|
0 | 4 | 447,443 Hz |
1 | 8 | 223,722 Hz |
2 | 16 | 111,861 Hz |
3 | 32 | 55,930 Hz |
4 | 64 | 27,965 Hz |
5 | 96 | 18,643 Hz |
6 | 128 | 13,983 Hz |
7 | 160 | 11,186 Hz |
8 | 202 | 8,860 Hz |
9 | 254 | 7,046 Hz |
a | 380 | 4,710 Hz |
b | 508 | 3,523 Hz |
c | 762 | 2,349 Hz |
d | 1016 | 1,762 Hz |
e | 2034 | 880 Hz |
f | 4068 | 440 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.
| Colour | 0 NES | 1 C64 | 2 Game Boy | 3 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.