C-64 Programmer's reference guide

Page 85

C64PRG10 |BLOCK+-------+-----------+ IMAGE | CONTENTS | | |DECIMAL| HEX | | | +-----+-------+-----------+-----------+---------------------------------+ | 0 | 53248 | D000-D1FF | 1000-11FF | Upper case characters | | | 53760 | D200-D3FF | 1200-13FF | Graphics characters | | | 54272 | D400-D5FF | 1400-15FF | Reversed upper case characters | | | 54784 | D600-D7FF | 1600-17FF | Reversed graphics characters | | | | | | | | 1 | 55296 | D800-D9FF | 1800-19FF | Lower case characters | | | 55808 | DA00-DBFF | 1A00-1BFF | Upper case & graphics characters| | | 56320 | DC00-DDFF | 1C00-1DFF | Reversed lower case characters | | | 56832 | DE00-DFFF | 1E00-1FFF | Reversed upper case & | | | | | | graphics characters | +-----+-------+-----------+-----------+---------------------------------+ Sharp-eyed readers will have just noticed something. The locations occupied by the character ROM are the same as the ones occupied by the VIC-II chip control registers. This is possible because they don't occupy the same locations at the same time. When the VIC-II chip needs to access PROGRAMMING GRAPHICS

105

~ character data the ROM is switched in. It becomes an image in the 16K bank of memory that the VIC-II chip is looking at. Otherwise, the area is occupied by the I/O control registers, and the character ROM is only available to the VIC-II chip. However, you may need to get to the character ROM if you are going to use programmable characters and want to copy some of the character ROM for some of your character definitions. In this case you must switch out the I/O register, switch in the character ROM, and do your copying. When you're finished, you must switch the 1/0 registers back in again. During the copying process (when I/O is switched out) no interrupts can be allowed to take place. This is because the I/O registers are needed to service the interrupts. If you forget and perform an interrupt, really strange things happen. The keyboard should not be read during the copying process. To turn off the keyboard and other normal interrupts that occur with your Commodore 64, the following POKE should be used: POKE 56334,PEEK(56334)AND254

(TURNS INTERRUPTS OFF)

After you are finished getting characters from the character ROM, and are ready to continue with your program, you must turn the keyboard scan back on by the following POKE: POKE 56334,PEEK(56334)OR1

(TURNS INTERRUPTS ON)

The following POKE will switch out 1/0 and switch the CHARACTER ROM in: POKE 1,PEEK(1)AND251 The character ROM is now in the locations from 53248-57343 ($D000$DFFF). To switch I/O back into $D000 for normal operation use the following POKE: POKE 1,PEEK(1)OR 4

106

PROGRAMMING GRAPHICS Pagina 85


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.