First public commit.
This commit is contained in:
parent
2a48f52979
commit
4bac9d83ed
288 changed files with 18417 additions and 1076 deletions
49
lenser/vic20/palette.py
Normal file
49
lenser/vic20/palette.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"""Commodore VIC-20 (VIC 6560/6561) 16-colour palette.
|
||||
|
||||
Calibrated against MAME's `vic20`: a display-setup cartridge cycled the global
|
||||
background ($900F bits 4-7) over all 16 values while a blank-character cell was
|
||||
sampled with the emulator's screen pixel reader (NORMAL mode -- $900F bit 3 = 1;
|
||||
with bit 3 = 0 the chip is in REVERSE mode and blank cells show the foreground).
|
||||
|
||||
The VIC has 16 colours but the per-cell *foreground* (colour RAM, 3 bits) is
|
||||
limited to the first 8; the global background / border / auxiliary may be any of
|
||||
the 16. Colours 8-15 are lighter variants of 0-7.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import numpy as np
|
||||
|
||||
from ..palette import srgb_to_lab
|
||||
|
||||
VIC = np.array([
|
||||
(0x00, 0x00, 0x00), # 0 black
|
||||
(0xFF, 0xFF, 0xFF), # 1 white
|
||||
(0xF0, 0x00, 0x00), # 2 red
|
||||
(0x00, 0xF0, 0xF0), # 3 cyan
|
||||
(0x60, 0x00, 0x60), # 4 purple
|
||||
(0x00, 0xA0, 0x00), # 5 green
|
||||
(0x00, 0x00, 0xF0), # 6 blue
|
||||
(0xD0, 0xD0, 0x00), # 7 yellow
|
||||
(0xC0, 0xA0, 0x00), # 8 orange
|
||||
(0xFF, 0xA0, 0x00), # 9 light orange
|
||||
(0xF0, 0x80, 0x80), # 10 pink
|
||||
(0x00, 0xFF, 0xFF), # 11 light cyan
|
||||
(0xFF, 0x00, 0xFF), # 12 light purple
|
||||
(0x00, 0xFF, 0x00), # 13 light green
|
||||
(0x00, 0xA0, 0xFF), # 14 light blue
|
||||
(0xFF, 0xFF, 0x00), # 15 light yellow
|
||||
], dtype=np.float64)
|
||||
|
||||
# Foreground (colour RAM, 3-bit) is limited to the first 8 colours.
|
||||
FG_USABLE = list(range(8))
|
||||
# Background / border / auxiliary may be any of the 16.
|
||||
BG_USABLE = list(range(16))
|
||||
|
||||
|
||||
def get_palette() -> np.ndarray:
|
||||
return VIC
|
||||
|
||||
|
||||
def palette_lab() -> np.ndarray:
|
||||
return srgb_to_lab(VIC)
|
||||
Loading…
Add table
Add a link
Reference in a new issue