video: Add a text mode
Why?
- A text mode would require 1/8:th of the VRAM compared to 1 bpp graphics.
- A text mode is less CPU hungry than 1 bpp graphics.
- A text mode requires less hazzle and code than 1 bpp graphics.
Changes
- Add a new CMODE: TEXT1
- Store the font in the palette memory.
- Use SETPAL to load a font.
- One 8x8 glyph is stored in two palette entries, so we get 128 glyph entries in total (e.g. 7-bit ASCII).
- Do something fun with char codes 128-255 (e.g. invert the glyph pixels?).
- Add two video registers for the background & foreground colors in text mode.
- Names: TEXTFG and TEXTBG?
- Pure 24-bit RGB, or something with an alpha channel (A8R5G6B5)?
- Add a "sub row" video register (find a better name?).
- The ADDR register marks the start of the text line.
- The SUBROW register tells which row of the glyph to render (0-7).
- The shift stage of the pixel pipeline needs some modification.
- We need a modified palette lookup in text mode (different lookup address).
- We need an extra pixel pipeline stage after the palette/glyph lookup to select the pixel color from the TEXTFG/TEXTBG registers.
Edited by mbitsnbites