A good location for a custom C64 font is at location $D000-$DFFF.
> But wait! Are the VIC-II registers not mapped at $D000?
Yes, that is right, but it can be switched with the character ROM by clearing bit 2 on location $0001.
> But wait! Then you have character ROM at that location. How can you set a custom font?
When the font ROM is switched into area $D000-$DFFF and the CPU stores bytes at these locations between $D000-$DFFF, they will not be stored into the ROM but to the underlying RAM. So the CPU reads from ROM and writes to RAM in that situation.
When the I/O is activated into area $D000-$DFFF, the VIC-II registers are used in this area and the CPU will read and write to the VIC-II registers.
So, it is only possible to store values into the RAM area $D000-$DFFF when the font ROM is switched in. The CPU can never read a value from this RAM area. So what is the use? Well, the VIC-II will see the RAM, so you can put a custom charset at this location, or other VIC-II data.
When the font ROM is switched into area $D000-$DFFF, only the CPU will see the ROM, not the VIC-II. The only locations where the VIC-II chip will see the character ROM is
at the locations $1000-$1FFF and $9000-$9FFF. These are the so-called
Shadow Font area's. Let this sink in, before you get confused.
We can conclude that the locations $1000-$1FFF and $9000-$9FFF are highly
suitable for code, because the VIC-II will only see the character ROM at
these locations and the CPU will only see the RAM.
The $D000-$DFFF RAM area can only contain VIC-II data, because the bytes cannot be loaded by the CPU. This makes this area suitable for a custom font. If the I/O is activated in this area, the CPU will return the VIC-II register values and if the character ROM is activated in this area, the CPU will return the character ROM bytes. So, you can only store values in this RAM area when the ROM is switched in, the CPU can never read values from this RAM. A custom font is static in most cases, so suitable for this area. However if you want 'rotating' characters, this area is not suitable.
Geen opmerkingen:
Een reactie posten