3

The C64 and the C128 have a memory for storing the color values of a character. The size of this memory is 1k x 4bit (2k x 4bit for the C128 which can do a double buffering), thus reading the value at a given address gives you the memory value in the 4 lower bits. The higher nibble can yield different results though.

Trying out

10 PRINT PEEK(55296);:GOTO10

on a C64 emulator gave me something like

 14  14  254  254  254  110  14  254  14

where 14 is the foreground color of the chars here and means light blue, the color that is set after a reset of the C64. 254 has the same lower nibble, but all bits set in the upper nibble.

My questions is, are 1111 or 0000 the only possibilities for the high nibble or are other values possible as well?

10

On a Commodore 64 or Commodore 128, the upper four bits of the data bus will be left floating when reading color memory. On my vintage Commodore 128, floating data bits would generally read as high, but on the Commodore 64 they would be more likely to report whatever value had been last output to the data bus. Because CPU cycles alternate with display data fetches, this would typically cause the upper four bits of the data bus to reflect the upper four bits of the last byte fetched by the VIC-II chip, but trying to predict which bytes those would be will generally be difficult and not very useful. Instead, it's generally best to regard the upper bits as though every read might independently yield whatever bit pattern would be least useful.

7
  • Interesting! So, on a C128, other than on a C64, floating data bits are read as high? – Peter B. Jan 18 at 19:57
  • @PeterB.: When I got my Commodore 128, that was one of the things I noticed soon after I started using it. I have no idea whether that behavior is common to all Commodore 128 machines, or only to certain manufacturing runs/board revisions. – supercat Jan 18 at 20:14
  • Hmmm. It's not so consistent on my C128. I get various values for the upper nybble, which only rarely equal to %1111. Same behavior in both C64 and C128 mode. – Brian H Jan 18 at 20:15
  • @BrianH: I wouldn't expect the behavior to differ in C64 vs C128 mode. How early in the design life of the C128 was yours made? Mine was pretty early, and I wouldn't be surprised if it includes bus pull-ups to avoid leaving the bus floating when using the Z80, but a later design rev eliminated those because they turned out not to be necessary in practice. – supercat Jan 18 at 20:18
  • I just tested on my C128 (flat model, German edition) and it had the higher nibble constantly at 1111 for the color RAM. Same behavior, as to be expected, in the C64 mode. – Peter B. Jan 18 at 20:20
1

This is completely from memory (and one from 35 years ago at that) But I seem to remember that you could also have multi-color mode in text mode as well. The higher 4 bits were the designation for the second color. The built-in fonts looked funny when the low-res multi color mode was set, but you could twiddle the bitmaps of custom fonts to achieve other effects

3
  • I think you are remembering two distinct modes here. In the hires bitmap mode the colors are stored in lower/upper nibble as you described. Since the color RAM is only a memory with 4 Bit words, this is done in the screen memory instead. The multicolor text mode has two extra colors set in the VIC registers and each character can choose a color between 0 and 7 set in the color RAM. The 4th bit is used to determine the mode switch, because you can mix single-color and multicolor characters in that mode. – Peter B. Jan 19 at 7:28
  • As I said, rusty and faint memory. But in the scheme you describe, how can you select the second foreground color? – Boluc Papuccuoglu Jan 19 at 7:31
  • Hmm ok, Just looked at the reference guide (page 117) .In multi-colour you can select between two BACKground colors, not foreground colors. And the background colors are global. – Boluc Papuccuoglu Jan 19 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.