VIC-20-PEEK-AND-POKE-MULTICOLOR-COMPLEXITY -------------------------------------------------------------------------------------------------- TOOL: COMMODORE VIC-20 - BASIC 2 Language: BASIC Extra: - Author: Misel Zivanovic Note: (C) 31st DEC 2025 - www.lived.ch, mzretro.ch --------------------------------------------------------------------------------------------------- VIC-20 has access to 4 color registers when Multi-Color {low-resolution} is active! Which means would theoretically need 4 addresses to manage that. However, VIC-20 needs just 3 due to the fact that BORDER and BACKGROUND COLOR and managed by only one register using LOW-HIGH Nibble color structure. The content of this table will help you to better understand what i mean! VIC-20 COLOR PALETTE: -----------------|-------|----------------------|----|----|-----------------------------------------------| COLORS 0-7 |dec/hex| VIC-20 COLOR LISTING |dec |hex | COLORS 0-15 | ---------------- |-------|----------------------|--- |----|-----------------------------------------------| LOW-NIBBLE | #$ 00 | 00 - Black | 00 |#$00| HIGH-NIBBLE {BACKGROUND COLORS} | {Bits 0-2} | #$ 01 | 01 - White | 08 |#$08| {Bits 4-7} | BORDER COLORS: | #$ 02 | 02 - Red | 16 |#$10| POKE 36879,INV+{COLOR x 16} | POKE 36879,X+INV | #$ 03 | 03 - Cyan | 32 |#$20| | CHARACTER COLORS:| #$ 04 | 04 - Magenta | 48 |#$30| INV = 8 NORMAL MODE | POKE *38400,X+MC | #$ 05 | 05 - Green | 64 |#$40| INV = 0 INVERSE MODE | POKE 646,X+MC | #$ 06 | 06 - Blue | 80 |#$50| COLOR = 0-15 | | #$ 07 | 07 - Yellow | 96 |#$60| SND = bit 0-3 Sound Vol. {not needed here}| -----------------|-------|----------------------|112 |#$70| ` | * If more than | | 08 - Orange |128 |#$80| POKE 36878,SND+{COLOR x 16} {Color Bit 4-7} | 8KB RAM then the | | 09 - Light Orange |144 |#$90|-----------------------------------------------| start address is | | 10 - Pink |160 |#$A0| How to know what is what? | POKE 37888,X+MC | | 11 - Light Cyan |176 |#$B0|-----------------------------------------------| -----------------| | 12 - Light Magenta |192 |#$C0| 00- POKE 36879,INV+{COLOR x 16}- SCREEN/BG {1}| MC=8=Multi Color | | 13 - Light Green |208 |#$D0| 01- POKE 36879,X+INV - Border {2}| MC=0=Normal Mode | | 14 - Light Blue |224 |#$E0| 10- POKE 38400,X+MC - Color MAP {3}| INV=8 Normal Mode| | 15 - Light Yellow |240 |#$F0| 11- POKE 36878,SND+{COLOR x 16}- MC Color {4}| INV=0 Inver. Mode| | | | |-----------------------------------------------| X = 0-7 | | | | | | -----------------|-------|----------------------|----|----|-----------------------------------------------| Note that bit 3 {dec value 8} is depending on register, | Byte/Character/Graphics Example: | responsible to enable/disable INVERSE/NORMAL MODE and |-------------------------------- --------------| also to switch between NORMAL/MULTICOLOR MODE | 11 11 11 11 Note how horizontally one | | 11 10 10 11 pixel is 2 bits wide! | * Also the SCREEN address is going down to $1000, | 11 10 10 11 Basically, you have 4 horizonal | dec 4096 when more than 8KB RAM is available! | 11 00 00 11 pixels and 8 vertical pixels | Default SCREEN address is $1e00, dec 7680 | 11 00 00 11 In praxis this is the regular | | 11 01 01 11 high-resolution screen. | | 11 01 01 11 | | 11 11 11 11 | | = | |-----------------------------------------------| | DATA 255, 235, 235, 195, 195, 215, 215, 255 | ----------------------------------------------------------|-----------------------------------------------| In next lesson we are going to create some Characters and Graphics elements!