diff options
| author | user <user@clank> | 2026-07-18 20:41:27 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-18 20:41:27 +0200 |
| commit | 9e7d5f6e5e01b7473b84bc3449d7f8e0f78e7045 (patch) | |
| tree | 5dcde624f3b366cc9244e08b0d2ca4ab35b338e2 /include | |
| parent | kernel: a real timer source (64 Hz tick IRQ) + uptime(1) (diff) | |
| download | gbos-9e7d5f6e5e01b7473b84bc3449d7f8e0f78e7045.tar.gz gbos-9e7d5f6e5e01b7473b84bc3449d7f8e0f78e7045.tar.xz gbos-9e7d5f6e5e01b7473b84bc3449d7f8e0f78e7045.zip | |
term: 7-color terminal (per-glyph fg+bg) + ANSI escapes; colorize irc
Fano-plane palette scheme: the 7 colors map onto 7 CGB BG palettes so
any color pair shares one palette; a tile's palette is picked from the
set of colors its two cells need (tables generated by tools/gencolor.py).
Per cell a packed (bg<<4)|fg byte lives alongside the char shadow, and
the glyph blitter steers glyph/empty pixels to each cell's fg/bg color
slots via plane masks.
An ANSI-ish CSI parser (ESC [ .. m) drives it; usr/ansi.c demos it and
the irc client now renders hashed nick colors, status dimming and a
channel-activity bar.
Diffstat (limited to '')
| -rw-r--r-- | include/gbos.inc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/gbos.inc b/include/gbos.inc index 246628c..e63d53f 100644 --- a/include/gbos.inc +++ b/include/gbos.inc @@ -17,6 +17,28 @@ DEF IEF_TIMER EQU %00000100 DEF rDIV EQU $FF04 ; divider register: free-running 8-bit @ 16384 Hz DEF rSVBK EQU $FF70 ; CGB WRAM bank select ($D000-$DFFF): 1..7 DEF wCurMask EQU $D589 ; term/osk: cursor underline bits OR'd into a tile's last row +; --- color renderer (term.asm) --------------------------------------------- +; Per-glyph foreground AND background color. Each pixel of a tile gets a CGB +; color-id: glyph pixels use the fg color's slot, empty pixels the bg color's +; slot. The 7 colors form a Fano plane across 7 BG palettes so any pair shares +; one palette; a tile's palette is chosen from the set of colors it needs +; (tools/gencolor.py builds PalData/BitTab/BestPal/SlotOf). Per cell we store a +; packed color byte = (bg<<4)|fg (each 0..7; 0=black/default). +DEF wFGP0 EQU $D5A2 ; foreground plane-0 mask (glyph pixels -> id bit0) +DEF wFGP1 EQU $D5A3 ; foreground plane-1 mask (glyph pixels -> id bit1) +DEF wCurColor EQU $D5A4 ; current packed color (bg<<4)|fg for chars printed next +DEF wAnsiState EQU $D5A5 ; ANSI parser: 0=normal 1=after-ESC 2=in-CSI +DEF wAnsiParam EQU $D5A6 ; ANSI parser: accumulating numeric parameter +DEF wPalAttr EQU $D5A7 ; chosen palette (bits 0..2) for a tile's tilemap attr +DEF wTMSlot EQU $D5A8 ; line-slot stashed by term_write_tilemap's attr pass +DEF wBGP0 EQU $D5A9 ; background plane-0 mask (empty pixels -> id bit0) +DEF wBGP1 EQU $D5AA ; background plane-1 mask (empty pixels -> id bit1) +DEF wCSL EQU $D5AB ; color_setup scratch: left cell packed color +DEF wCSR EQU $D5AC ; color_setup scratch: right cell packed color +DEF wCSset EQU $D5AD ; color_setup scratch: 7-bit set of colors present +DEF wCSpb EQU $D5AE ; color_setup scratch: palette*8 (SlotOf base) +DEF wCStmp0 EQU $D5AF ; color_setup scratch: assembled plane-0 mask +DEF wCStmp1 EQU $D5B0 ; color_setup scratch: assembled plane-1 mask DEF OSK_DOCK EQU 3 ; on-screen keyboard height in rows (dock at the bottom) DEF rKEY1 EQU $FF4D ; CGB speed switch DEF rSB EQU $FF01 ; serial data @@ -265,5 +287,6 @@ DEF PROG_NSLOOKUP EQU 28 DEF PROG_DHCP EQU 29 DEF PROG_IRC EQU 30 DEF PROG_UPTIME EQU 31 +DEF PROG_ANSI EQU 32 ENDC |
