Code: Select all
[0000-0FFF] IPL/RAM
[1000-BFFF] RAM
[C000-CFFF] RAM/ROM
[D000-D7FF] VRAM 2KB
[D800-DFFF] -
[E000-E7FF] I/O
[E800-EFFF] EXT
[F000-F3FF] FDIF if any
[F400-FFFF] -
PCG[0000-03FF] = fixed characters $00-$7F
PCG[0400-07FF] = programmable characters $80-$FF (1st set)
2nd Font:
PCG[0800-03FF] = fixed characters $00-$7F (same as PCG[0000-03FF])
PCG[0C00-0FFF] = programmable characters $80-$FF (2nd set)
Writing byte:
$E000-$E003:
PIO
$E004-$E007:
CTC
$E008:
8253 gate0
$E010:
PCG_DATA (byte to describe 8-pixel row of a character)
$E011:
PCG_ADDR (offset in the PCG in 8-pixel row unit) -> up to 256/8 = 32 characters
$E012:
PCG_CTRL
bit 0-1: character selector -> (PCG_ADDR + 256*(PCG_CTRL&3)) -> address in the range of the upper 128 characters font
bit 2 : font selector -> PCG_CTRL&2 == 0 -> 1st font else 2nd font
bit 3 : select which font for display
bit 4 : use programmable font for display
bit 5 : set programmable upper font -> PCG_CTRL&20 == 0 -> fixed upper 128 characters else programmable upper 128 characters
So if you want to change a character pattern (only doable in the upper 128 characters of a font), you need to:
- set bit 5 to 1 : PCG_CTRL[5] = 1
- set the font to select : PCG_CTRL[2] = font_number
- set the first row address of the character: PCG_ADDR[0..7] = row[0..7] and PCG_CTRL[0..1] = row[8..9]
- set the 8 pixels of the row in PCG_DATA
'row' is between 0 and 1023; row[0..2] is the 8-pixel row index (0-7) of the character index coded in row[3..9] (0-127) being in the upper side of MZASCII.
Since a character has 8 rows, you need to do it 8 times by incrementing the row index.
When displaying characters on the screen, programmable font is used if PCG_CTRL[4] is set and PCG_CTRL[3] says which font is active (1st or 2nd font).
Reading byte:
$E000-$E003:
PIO
$E004-$E007:
CTC
$E008:
TEMPO and HBLANK like MZ-80 A
$E00C:
[0000-0FFF] becomes RAM (last physical 4KB RAM normally residing at $C000)
[C000-CFFF] becomes IPL
$E010:
[0000-0FFF] becomes IPL
[C000-CFFF] becomes RAM (last physical 4KB RAM)
$E014:
normal display (black background, green foreground)
$E015:
reverse display (green background, black foreground)