Reading Colour RAM
Moderator: Moderators
Reading Colour RAM
I've noticed that if I try to do a PEEK(38400), I don't always get the actual colour value back - and I see the same thing in VICE (unexpanded Vic).
When the kernel scrolls the screen up (as it would during a LIST for example), I assume that the the kernel must read the colour RAM in order to move the colour codes up the screen.
What is needed in order to read the colour RAM correctly - and what causes the changing values that I see at 38400?
When the kernel scrolls the screen up (as it would during a LIST for example), I assume that the the kernel must read the colour RAM in order to move the colour codes up the screen.
What is needed in order to read the colour RAM correctly - and what causes the changing values that I see at 38400?
Re: Reading Colour RAM
The color RAM is only 4-bit. What you read on the upper 4 bits will just be garbage on the bus.
You need to AND your read value with $0f to get the actual contents of the memory between $9400-$9800.
You need to AND your read value with $0f to get the actual contents of the memory between $9400-$9800.
Re: Reading Colour RAM
Oh, is it that simple? Hehe. Of course - that makes perfect sense now. Thanks for that

- Orangeman96
- Vic 20 Enthusiast
- Posts: 183
- Joined: Tue Jan 16, 2024 3:42 pm
- Location: U.S.A.
Re: Reading Colour RAM
So is the high nybble is always garbage on the bus between $9400-$9800 / 37888-38912? -OGM
- AndyH
- Vic 20 Afficionado
- Posts: 442
- Joined: Thu Jun 17, 2004 5:51 am
- Website: https://www.hewco.uk
- Location: UK
- Occupation: Developer
Re: Reading Colour RAM
Yes, those bits are just not available.
It can be used for storing data within these limitations for the range that's spare. On Emu's Massive Hunt I use it to store 4 flags per screen to determine what objects you've collected on that screen.
It can be used for storing data within these limitations for the range that's spare. On Emu's Massive Hunt I use it to store 4 flags per screen to determine what objects you've collected on that screen.
Re: Reading Colour RAM
So whereabouts do your 4 bits actually get written to? The colour RAM chips are only 4bits wide I believe - so where do the other 4bits go if you're writing to $9600 for example?
- AndyH
- Vic 20 Afficionado
- Posts: 442
- Joined: Thu Jun 17, 2004 5:51 am
- Website: https://www.hewco.uk
- Location: UK
- Occupation: Developer
Re: Reading Colour RAM
Depending where your screen is set, either $9400 or $9600 will be free to use (the lower 4 bits).
- Orangeman96
- Vic 20 Enthusiast
- Posts: 183
- Joined: Tue Jan 16, 2024 3:42 pm
- Location: U.S.A.
Re: Reading Colour RAM
I'm pretty sure the read of $9600 on an unexpanded Vic reads the same physical chip and location as $9400 does with 8K RAM expansion. In other words the address mapping changes when the 8K RAM is present, but the Vic chip is always accessing the same colour RAM chip locations in both cases.Orangeman96 wrote: ↑Wed May 07, 2025 6:46 pm So its only two low nybbles then, AndyH: the low nybble of $9400 (four bits) and the low nybble of $9600 (four bits)? -OGM
If we had a screen that was smaller than the full colour RAM that is available, then we could use the unused colour RAM 4-bit locations that are at the end of the screen space. Maybe that's the bit I didn't get.
- Orangeman96
- Vic 20 Enthusiast
- Posts: 183
- Joined: Tue Jan 16, 2024 3:42 pm
- Location: U.S.A.
Re: Reading Colour RAM
Gotcha, Sparky, I was just trying to ascertain how many half-byte locations were acutally in-play/meaningfully-usable. -OGMSparkyNZ wrote: ↑Wed May 07, 2025 7:15 pm
I'm pretty sure the read of $9600 on an unexpanded Vic reads the same physical chip and location as $9400 does with 8K RAM expansion. In other words the address mapping changes when the 8K RAM is present, but the Vic chip is always accessing the same colour RAM chip locations in both cases.
If we had a screen that was smaller than the full colour RAM that is available, then we could use the unused colour RAM 4-bit locations that are at the end of the screen space. Maybe that's the bit I didn't get.
Re: Reading Colour RAM
If its 4-bit x 1K.. For a default screen size of 22x23, that would be 506 nybbles.. so I guess 1024 - 506 nybbles free?Orangeman96 wrote: ↑Wed May 07, 2025 8:37 pm Gotcha, Sparky, I was just trying to ascertain how many half-byte locations were acutally in-play/meaningfully-usable. -OGM
Hehe. This is all quite fun and hacky - I would never have thought about using the colour RAM for additional memory

- AndyH
- Vic 20 Afficionado
- Posts: 442
- Joined: Thu Jun 17, 2004 5:51 am
- Website: https://www.hewco.uk
- Location: UK
- Occupation: Developer
Re: Reading Colour RAM
Colour memory, with only lower 4 bits wired up are between $9400 and $97ff.
Mapping the Vic describes the memory range as bits 7-4 = not there, bit 3 = multicolour, bits 0-2 = foreground colour.
Bit 7 of $9002 affects the location of screen memory (along with $9005) but more importantly it also defines if colour memory starts at $9400 or $9600.
So for Emu I use the unused colour space for my screen item flags. Only lower nybble is usable.
In another game, Bluevolution, I use the spare colour ram for my meteor bits, like a double buffer. Again only the lower 4 bits used.
Mapping the Vic describes the memory range as bits 7-4 = not there, bit 3 = multicolour, bits 0-2 = foreground colour.
Bit 7 of $9002 affects the location of screen memory (along with $9005) but more importantly it also defines if colour memory starts at $9400 or $9600.
So for Emu I use the unused colour space for my screen item flags. Only lower nybble is usable.
In another game, Bluevolution, I use the spare colour ram for my meteor bits, like a double buffer. Again only the lower 4 bits used.
Last edited by AndyH on Thu May 08, 2025 1:38 am, edited 1 time in total.
- Mike
- Herr VC
- Posts: 5134
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Reading Colour RAM
So much for the rumours, here are the facts: https://sleepingelephant.com/ipw-web/bu ... 1&start=22
- Orangeman96
- Vic 20 Enthusiast
- Posts: 183
- Joined: Tue Jan 16, 2024 3:42 pm
- Location: U.S.A.
Re: Reading Colour RAM
Vielen Dank, Herr VC!Mike wrote: ↑Thu May 08, 2025 1:17 am So much for the rumours, here are the facts: https://sleepingelephant.com/ipw-web/bu ... 1&start=22

(mod: unnecessary full quote of linked-to posting removed)