Emulating the VIC 20's Memory This is perhaps the easiest part of the VIC to emulate and will probably be the part you'll write first. All that needs to be done is to create an array of size 64K to hold the whole of the VIC 20's memory. This is also one part of the emulation that needs to be as quick as you can get it. READING AND WRITING TO MEMORY You will be using different functions to read and write to different parts of memory. Storing and reading values from the VIC chip registers will use different functions than storing and reading from the VIA chips. The reason different functions are used is because its not just the memory location that is being updated or read from. Other parameters are adjusted when these register locations are accessed. For example, screen dimensions, colours, sound tones, timers, keyboard scanning, etc. Other locations are ROM locations and writes to these locations should be ignored. What I have done in my emulator is to have two arrays of size 256 where each position represents a page of memory. These arrays store pointers to the functions which read and write that particular page of memory. I then have two general functions (which could be MACROs if you wanted) that call the function given by the pointer in the array position given by the high byte of the address being accessed. WHAT EACH MEMORY LOCATION DOES It is important to know what each memory location is used for so that the correct function is chosen to read and write to the given address. There are memory maps available on the internet that give this information. The important locations are discussed in the descriptions of the 6522 VIA chip and 6561 VIC chip. A brief memory map guideline is given below. Address Address (decimal) (hex) 0 BASIC working memory 0 1023 storage 3FF 1024 3K Memory 400 4095 Expansion FFF 4096 User memory area (unexpanded or 3K expansion) 1000 7679 Screen memory when 8K or greater expansion 1DFF 7680 Screen memory (unexpanded or 3K expansion) 1E00 8185 User memory (8K or greate expansion) 1FF9 8192 8K Memory 2000 16383 Expansion 3FFF 16384 8K Memory 4000 24575 Expansion 5FFF 24576 8K Memory 6000 32767 Expansion 7FFF 32768 VIC 20 Character Sets 8000 36836 (ROM) 8FFF 36864 6561 VIC Chip 9000 36879 Control registers 900F 37136 6522 VIA Chips 9110 37167 I/O Control registers 912F 37888 Colour Memory 9400 38399 (if memory expanded) 95FF 38400 Colour Memory 9600 38911 (unexpanded system) 97FF 40960 Expansion ROM A000 49151 BFFF 49152 BASIC interpreter C000 57343 (ROM) DFFF 57344 KERNEL Operating Sytem E000 65535 (ROM) FFFF LOADING ROMS One of the first things that the emula