The Commodore 64 has 64K bytes of RAM. It also has 20K bytes of ROM, containing BASIC, the operating system, and the standard character set. It also accesses input/output devices as a 4K chunk of memory. How is this all possible on a computer with a 16-bit address bus, that is normally only capable of addressing 64K?
The secret is in the 6510 processor chip itself. On the chip is an input/output port. This port is used to control whether RAM or ROM or I/O will appear in certain portions of the system's memory. The port is also used to control the DatassetteTM, so it is important to affect only the proper bits.
The 6510 input/output port appears at location 1. The data direction register for this port appears at location 0. The port is controlled like any of the other input/output ports in the system . . . the data direction controls whether a given bit will be an input or an output, and the actual data transfer occurs through the port itself. The lines in the 6510 control port are defined as follows:
|LORAM||0||OUTPUT||Control for RAM/ROM at $A000-$BFFF|
|HIRAM||1||OUTPUT||Control for RAM/ROM at $E000-$FFFF|
|CHAREN||2||OUTPUT||Control for I/O/ROM at $D000-$DFFF|
|3||OUTPUT||Cassette write line|
|4||INPUT||Cassette switch sense (0=play button down)|
|5||OUTPUT||Cassette motor control (0=motor spins)|
The proper value for the data direction register is as follows:
BITS 5 4 3 2 1 0 ---------------- 1 0 1 1 1 1
(where 1 is an output, and 0 is an input).
|This page has been created by Sami Rautiainen.|
|Read the small print.||Last updated November 07, 1998.|