Sprites.Platform.Spectrum

The ZX Spectrum platform pack: the machine's shared colours, its sprite constants under Sprite, and its font constants under Font. Two colours a cell, drawn from the fifteen the Spectrum shows.

Sprites.Platform.Spectrum

Sprite

Image

Text

Font

Sequencer

Sprites.Platform.Spectrum.Name String

The machine's display name.

"ZX Spectrum"

Sprites.Platform.Spectrum.Palette Array

The machine's fixed colours, as packed 0xRRGGBBAA integers, the set a slot may be recoloured from.

[
  0x000000ff,
  0x0000d7ff,
  0xd70000ff,
  0xd700d7ff,
  0x00d700ff,
  0x00d7d7ff,
  0xd7d700ff,
  0xd7d7d7ff,
  0x0000ffff,
  0xff0000ff,
  0xff00ffff,
  0x00ff00ff,
  0x00ffffff,
  0xffff00ff,
  0xffffffff
]

Sprites.Platform.Spectrum.Sprite.Slots Array

The colours the editor starts on, one a slot.

[
  0x000000ff,
  0xd7d7d7ff
]

Sprites.Platform.Spectrum.Sprite.Modes Array

The sprite modes, in the order the Info window lists them. Each sets a colour count, a pixel aspect and a size rule.

NameColoursPixel aspectSize
Standard21widths 8, 16, 24, 32; heights 8, 16, 24, 32
[
  { "name": "Standard", "colours": 2, "pixelAspect": 1, "allowedWidths": [8, 16, 24, 32], "allowedHeights": [8, 16, 24, 32] }
]

Sprites.Platform.Spectrum.Sprite.DefaultWidth Number

The sprite width the editor opens on.

16

Sprites.Platform.Spectrum.Sprite.DefaultHeight Number

The sprite height the editor opens on.

16

Sprites.Platform.Spectrum.Image.Slots Array

The picker's palette: the Spectrum's fifteen colours, the eight base colours and their bright forms.

[
  0x000000ff, 0x0000d7ff, 0xd70000ff, 0xd700d7ff, 0x00d700ff, 0x00d7d7ff, 0xd7d700ff, 0xd7d7d7ff,
  0x0000ffff, 0xff0000ff, 0xff00ffff, 0x00ff00ff, 0x00ffffff, 0xffff00ff, 0xffffffff
]

Sprites.Platform.Spectrum.Image.Modes Array

The image screen modes, in the order the Info window lists them. Each names a fixed screen size.

The mode is attribute based: each 8×8 cell carries its own ink and paper colour, so a cell shows two colours at once, the classic colour clash. Image.DefaultInk is 0 (black) and Image.DefaultPaper is 7 (white) where a cell names none.

NameSize
Standard256 × 192
[
  { "name": "Standard", "allowedSizes": [ [ 256, 192 ] ] }
]

Sprites.Platform.Spectrum.Image.DefaultInk Number

The ink colour index a cell takes where it names none, black on the Spectrum's palette.

0

Sprites.Platform.Spectrum.Image.DefaultPaper Number

The paper colour index a cell takes where it names none, white on the Spectrum's palette.

7

Sprites.Platform.Spectrum.Image.DefaultWidth Number

The image width the editor opens on.

256

Sprites.Platform.Spectrum.Image.DefaultHeight Number

The image height the editor opens on.

192

Sprites.Platform.Spectrum.Text.Palette Array

The colours a text cell draws ink and paper from, the machine's shared fifteen. It is the same Sprites.Platform.Spectrum.Palette, as packed 0xRRGGBBAA integers.

[
  0x000000ff,
  0x0000d7ff,
  0xd70000ff,
  0xd700d7ff,
  0x00d700ff,
  0x00d7d7ff,
  0xd7d700ff,
  0xd7d7d7ff,
  0x0000ffff,
  0xff0000ff,
  0xff00ffff,
  0x00ff00ff,
  0x00ffffff,
  0xffff00ff,
  0xffffffff
]

Sprites.Platform.Spectrum.Text.Modes Array

The text screen modes, in the order the Info window lists them. Each names a pixel aspect and the widths and heights a screen may take, here the fixed 32 by 24 character grid.

NamePixel aspectWidthsHeights
Standard13224
[
  { "name": "Standard", "pixelAspect": 1, "allowedWidths": [32], "allowedHeights": [24] }
]

Sprites.Platform.Spectrum.Text.WholeCell Boolean

Whether colour is set for a whole cell at once. On the Spectrum the attribute lives per cell, so ink and paper are chosen freely per cell and this is false.

false

Sprites.Platform.Spectrum.Text.DefaultInk Number

The ink colour index a fresh cell takes, black on the Spectrum's palette.

0

Sprites.Platform.Spectrum.Text.DefaultPaper Number

The paper colour index a fresh cell takes, white on the Spectrum's palette.

7

Sprites.Platform.Spectrum.Text.DefaultWidth Number

The screen width in character cells the text editor opens on.

32

Sprites.Platform.Spectrum.Text.DefaultHeight Number

The screen height in character cells the text editor opens on.

24

Sprites.Platform.Spectrum.Font.Charsets Array

The machine's built-in character sets, each a font object of name, cell size and glyphs. The Spectrum has one: the ROM font. Font.DefaultFont is the first entry.

[ { name: 'ROM font', w: 8, h: 8, first: 32, glyphs: [ /* 96 glyphs */ ] } ]

Sprites.Platform.Spectrum.Font.Slots Array

The two colours the font editor starts on, paper then ink, as packed 0xRRGGBBAA integers. A slot may be recoloured from the palette.

[
  0xffffffff,
  0x000000ff
]

Sprites.Platform.Spectrum.Font.Modes Array

The font modes, in the order the Info window lists them. A font mode sets a colour count, a pixel aspect and the fixed cell size, so the editor holds two colours at the machine's glyph size.

NameColoursPixel aspectSize
Standard218×8
[
  { "name": "Standard", "colours": 2, "pixelAspect": 1, "allowedWidths": [8], "allowedHeights": [8] }
]

Sprites.Platform.Spectrum.Font.DefaultWidth Number

The glyph cell width in pixels of the default font.

8

Sprites.Platform.Spectrum.Font.DefaultHeight Number

The glyph cell height in pixels of the default font.

8

Sprites.Platform.Spectrum.Font.CharStart Number

The character code of the first glyph in the default font.

32

Sprites.Platform.Spectrum.Font.CharCount Number

The number of glyphs in the default font.

96

Sprites.Platform.Spectrum.Font.DefaultFont Object

The built-in font as a font object: its mode and cell size, and a glyphs array in the compact ROM form, one byte per pixel row, the top bit the leftmost pixel. See the Spectrum font page for the format.

The Spectrum default font, 96 glyphs
The ROM font, extracted from the real ZX Spectrum 48K ROM. Drawn from Sprites.Platform.Spectrum.Font.DefaultFont.
Sprites.Platform.Spectrum.Font.Charsets = [
  {
    name: "ROM font", w: 8, h: 8, freeform: false, first: 32,
    glyphs: [
      [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00], // 32
      [0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x00], // 33
      [0x00,0x24,0x24,0x00,0x00,0x00,0x00,0x00], // 34
      [0x00,0x24,0x7e,0x24,0x24,0x7e,0x24,0x00], // 35
      [0x00,0x08,0x3e,0x28,0x3e,0x0a,0x3e,0x08], // 36
      [0x00,0x62,0x64,0x08,0x10,0x26,0x46,0x00], // 37
      [0x00,0x10,0x28,0x10,0x2a,0x44,0x3a,0x00], // 38
      [0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00], // 39
      [0x00,0x04,0x08,0x08,0x08,0x08,0x04,0x00], // 40
      [0x00,0x20,0x10,0x10,0x10,0x10,0x20,0x00], // 41
      [0x00,0x00,0x14,0x08,0x3e,0x08,0x14,0x00], // 42
      [0x00,0x00,0x08,0x08,0x3e,0x08,0x08,0x00], // 43
      [0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x10], // 44
      [0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00], // 45
      [0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00], // 46
      [0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x00], // 47
      [0x00,0x3c,0x46,0x4a,0x52,0x62,0x3c,0x00], // 48
      [0x00,0x18,0x28,0x08,0x08,0x08,0x3e,0x00], // 49
      [0x00,0x3c,0x42,0x02,0x3c,0x40,0x7e,0x00], // 50
      [0x00,0x3c,0x42,0x0c,0x02,0x42,0x3c,0x00], // 51
      [0x00,0x08,0x18,0x28,0x48,0x7e,0x08,0x00], // 52
      [0x00,0x7e,0x40,0x7c,0x02,0x42,0x3c,0x00], // 53
      [0x00,0x3c,0x40,0x7c,0x42,0x42,0x3c,0x00], // 54
      [0x00,0x7e,0x02,0x04,0x08,0x10,0x10,0x00], // 55
      [0x00,0x3c,0x42,0x3c,0x42,0x42,0x3c,0x00], // 56
      [0x00,0x3c,0x42,0x42,0x3e,0x02,0x3c,0x00], // 57
      [0x00,0x00,0x00,0x10,0x00,0x00,0x10,0x00], // 58
      [0x00,0x00,0x10,0x00,0x00,0x10,0x10,0x20], // 59
      [0x00,0x00,0x04,0x08,0x10,0x08,0x04,0x00], // 60
      [0x00,0x00,0x00,0x3e,0x00,0x3e,0x00,0x00], // 61
      [0x00,0x00,0x10,0x08,0x04,0x08,0x10,0x00], // 62
      [0x00,0x3c,0x42,0x04,0x08,0x00,0x08,0x00], // 63
      [0x00,0x3c,0x4a,0x56,0x5e,0x40,0x3c,0x00], // 64
      [0x00,0x3c,0x42,0x42,0x7e,0x42,0x42,0x00], // 65
      [0x00,0x7c,0x42,0x7c,0x42,0x42,0x7c,0x00], // 66
      [0x00,0x3c,0x42,0x40,0x40,0x42,0x3c,0x00], // 67
      [0x00,0x78,0x44,0x42,0x42,0x44,0x78,0x00], // 68
      [0x00,0x7e,0x40,0x7c,0x40,0x40,0x7e,0x00], // 69
      [0x00,0x7e,0x40,0x7c,0x40,0x40,0x40,0x00], // 70
      [0x00,0x3c,0x42,0x40,0x4e,0x42,0x3c,0x00], // 71
      [0x00,0x42,0x42,0x7e,0x42,0x42,0x42,0x00], // 72
      [0x00,0x3e,0x08,0x08,0x08,0x08,0x3e,0x00], // 73
      [0x00,0x02,0x02,0x02,0x42,0x42,0x3c,0x00], // 74
      [0x00,0x44,0x48,0x70,0x48,0x44,0x42,0x00], // 75
      [0x00,0x40,0x40,0x40,0x40,0x40,0x7e,0x00], // 76
      [0x00,0x42,0x66,0x5a,0x42,0x42,0x42,0x00], // 77
      [0x00,0x42,0x62,0x52,0x4a,0x46,0x42,0x00], // 78
      [0x00,0x3c,0x42,0x42,0x42,0x42,0x3c,0x00], // 79
      [0x00,0x7c,0x42,0x42,0x7c,0x40,0x40,0x00], // 80
      [0x00,0x3c,0x42,0x42,0x52,0x4a,0x3c,0x00], // 81
      [0x00,0x7c,0x42,0x42,0x7c,0x44,0x42,0x00], // 82
      [0x00,0x3c,0x40,0x3c,0x02,0x42,0x3c,0x00], // 83
      [0x00,0xfe,0x10,0x10,0x10,0x10,0x10,0x00], // 84
      [0x00,0x42,0x42,0x42,0x42,0x42,0x3c,0x00], // 85
      [0x00,0x42,0x42,0x42,0x42,0x24,0x18,0x00], // 86
      [0x00,0x42,0x42,0x42,0x42,0x5a,0x24,0x00], // 87
      [0x00,0x42,0x24,0x18,0x18,0x24,0x42,0x00], // 88
      [0x00,0x82,0x44,0x28,0x10,0x10,0x10,0x00], // 89
      [0x00,0x7e,0x04,0x08,0x10,0x20,0x7e,0x00], // 90
      [0x00,0x0e,0x08,0x08,0x08,0x08,0x0e,0x00], // 91
      [0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x00], // 92
      [0x00,0x70,0x10,0x10,0x10,0x10,0x70,0x00], // 93
      [0x00,0x10,0x38,0x54,0x10,0x10,0x10,0x00], // 94
      [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff], // 95
      [0x00,0x1c,0x22,0x78,0x20,0x20,0x7e,0x00], // 96
      [0x00,0x00,0x38,0x04,0x3c,0x44,0x3c,0x00], // 97
      [0x00,0x20,0x20,0x3c,0x22,0x22,0x3c,0x00], // 98
      [0x00,0x00,0x1c,0x20,0x20,0x20,0x1c,0x00], // 99
      [0x00,0x04,0x04,0x3c,0x44,0x44,0x3c,0x00], // 100
      [0x00,0x00,0x38,0x44,0x78,0x40,0x3c,0x00], // 101
      [0x00,0x0c,0x10,0x18,0x10,0x10,0x10,0x00], // 102
      [0x00,0x00,0x3c,0x44,0x44,0x3c,0x04,0x38], // 103
      [0x00,0x40,0x40,0x78,0x44,0x44,0x44,0x00], // 104
      [0x00,0x10,0x00,0x30,0x10,0x10,0x38,0x00], // 105
      [0x00,0x04,0x00,0x04,0x04,0x04,0x24,0x18], // 106
      [0x00,0x20,0x28,0x30,0x30,0x28,0x24,0x00], // 107
      [0x00,0x10,0x10,0x10,0x10,0x10,0x0c,0x00], // 108
      [0x00,0x00,0x68,0x54,0x54,0x54,0x54,0x00], // 109
      [0x00,0x00,0x78,0x44,0x44,0x44,0x44,0x00], // 110
      [0x00,0x00,0x38,0x44,0x44,0x44,0x38,0x00], // 111
      [0x00,0x00,0x78,0x44,0x44,0x78,0x40,0x40], // 112
      [0x00,0x00,0x3c,0x44,0x44,0x3c,0x04,0x06], // 113
      [0x00,0x00,0x1c,0x20,0x20,0x20,0x20,0x00], // 114
      [0x00,0x00,0x38,0x40,0x38,0x04,0x78,0x00], // 115
      [0x00,0x10,0x38,0x10,0x10,0x10,0x0c,0x00], // 116
      [0x00,0x00,0x44,0x44,0x44,0x44,0x38,0x00], // 117
      [0x00,0x00,0x44,0x44,0x28,0x28,0x10,0x00], // 118
      [0x00,0x00,0x44,0x54,0x54,0x54,0x28,0x00], // 119
      [0x00,0x00,0x44,0x28,0x10,0x28,0x44,0x00], // 120
      [0x00,0x00,0x44,0x44,0x44,0x3c,0x04,0x38], // 121
      [0x00,0x00,0x7c,0x08,0x10,0x20,0x7c,0x00], // 122
      [0x00,0x0e,0x08,0x30,0x08,0x08,0x0e,0x00], // 123
      [0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x00], // 124
      [0x00,0x70,0x10,0x0c,0x10,0x10,0x70,0x00], // 125
      [0x00,0x14,0x28,0x00,0x00,0x00,0x00,0x00], // 126
      [0x3c,0x42,0x99,0xa1,0xa1,0x99,0x42,0x3c], // 127
    ],
  },
];

Sprites.Platform.Spectrum.Sequencer Object

The sequencer channel model for the 128K AY chip: three tone channels with one shared envelope and noise generator, described as address-free capabilities with value ranges. The Sprites.Media.Sequencer editor reads this to lay out the grid and gate what each channel can do. The 48K beeper is a separate single-channel model, added later. Registers are on the Spectrum audio page; here only value ranges matter.

{
  name: 'ZX Spectrum',
  channelTypes: {
    tone: { capabilities: {
      pitch:    { mode: 'latched', notes: ['A0', 'B7'], finetune: false },
      volume:   { mode: 'latched', level: { bits: 4 } },
      noise:    { mode: 'latched', via: 'mixer' },
      envelope: { mode: 'latched', type: 'shape', ref: 'shared.envelope' }
    } }
  },
  channels: [ { type: 'tone' }, { type: 'tone' }, { type: 'tone' } ],
  shared: {
    envelope: { mode: 'latched', shapes: 8, period: { bits: 16 } },
    noise:    { mode: 'latched', period: { bits: 5 } }
  },
  effects: ['arpeggio', 'portamento', 'vibrato', 'volumeSlide']
}