The Ultimate C64 Overview Michael Steil, http://www.pagetable.com/ 25th Chaos Communication Congress 2008 Retrocomputing is cool as never before. People play Look and Feel C64 games in emulators and listen to SID music, but few people know much about the C64 architecture A C64 only needs to be connected to power and a TV and its limitations, and what programming was like set (or monitor) to be fully functional. When turned back then. This paper attempts to give a comprehen- on, it shows a blue-on-blue theme with a startup mes- sive overview of the Commodore 64, including its in- sage and drops into a BASIC interpreter derived from ternals and quirks, making the point that classic Microsoft BASIC. In order to load and save BASIC computer systems aren't all that hard to understand - programs or use third party software, the C64 re- and that programmers today should be more aware of quires mass storage - either a “datasette” cassette the art that programming once used to be. tape drive or a disk drive like the 5.25" Commodore 1541. Commodore History Unless the user really wanted to interact with the BA- SIC interpreter, he would typically only use the BA- Commodore Business Machines was founded in 1962 SIC instructions LOAD, LIST and RUN in order to by Jack Tramiel. The company specialized on elec- access mass storage. LOAD"$",8 followed by LIST tronic calculators, and in 1976, Commodore bought shows the directory of the disk in the drive, and the chip manufacturer MOS Technology and decided LOAD"filename",8 followed by RUN would load and to have Chuck Peddle from MOS evolve their KIM-1 start a program. If a tape drive is connected, LOAD computer kit (a design that demos their new MOS and RUN will launch the first program on tape - 6502 8 bit CPU) into the Commodore PET series: pressing SHIFT and the RUN/STOP key has the same computers with built-in monitors for the home, effect. school and small business market that ended up By default, typing characters without SHIFT will re- competing with devices from Atari and Apple. sult in upper case characters being shown on the In 1981, Commodore introduced the VIC-20, a 5 KB screen. This can be changed by pressing the Commo- stripped down monitorless computer-in-the- dore key and SHIFT at the same time, which switches keyboard design based on the PET for the home com- to the upper/lower character set. This behavior is due puter market. This was followed by the (incompati- to the fact that the first PET only had uppercase char- ble) higher-end Commodore 64 in 1982 that included acters, and that BASIC required keywords unshifted - more PET features, came with 64 KB of RAM (an but all tutorials taught them as uppercase. This is also immense amount compared to the rest of the market) the reason why in Commodore's version of ASCII, and was very aggressively priced at US$595 beating called PETSCII, the codes for uppercase and lower- the competition by a factor of two. This was made case characters are reversed. possible by designing and building most of the system The text based user interface is not a line editor, but a in-house. screen editor, i.e. the cursor can be moved freely on Although some features of the C64 were taken from the screen, and pressing RETURN on a line with ex- the PET models of the time, it had to be connected to isting text will present the text to the application as if a TV set, which only made 40 columns of text possible it were just typed in. (as opposed to 80 columns on the PET). Also, the While a physical screen line is only 40 characters, the BASIC 4.0 codebase was stripped down to the old 2.0 screen editor logic can extend it to a logical 80 char- feature set to make it fit into 8 KB. acters - whenever a character is entered on the 40th In the beginning, the C64 did well in the competition. column, the rest of the screen is moved down by one The superior but compatible C128 from 1985 did well, line, ”opening” a line that extends the previous line to too, but was never more popular than the C64, which 80 characters. continued to be sold. The direct successor to the low- The C64 screen editor supports selecting one out of end VIC-20, the 1984 Plus/4 and its siblings, the C16 16 color for the foreground text by pressing the key and the C116, failed, mostly because they were in- combinations Ctrl+1 to Ctrl+8 and Commodore+1 to compatible with the C64, which at that time already Commodore+8. Reverse text mode can be turned on had a remarkable software library. and off with Ctrl+9 and Ctrl+0. A few years after the introduction, the C64 was still offered as a low-end alternative to the Commodore Ports and Connections Amiga, and while it became less popular in the USA, it gained more and more popularity in Europe. In the The C64 has a whole range of connection possibilities. early 90s, when manufacturing costs of a C64 were as On the side, it has two 9 pin Atari-style joystick con- low as $25, it gained a second life in Eastern Europe. nectors that can also be used for a mouse, light pens Production did not end until the liquidation of Com- or paddles. On the back, there is the expansion port, modore in 1994. According to the 1993 Annual Re- which exports the complete processor bus, allowing port, 17 million C64 had been produced in by then, as not only game cartridges but also cartridges with I/O well as 4.5 million C128. chips that map themselves into the CPU's address space - or even cartridges that completely replace the CPU. For a conventional TV connection, there is an 1 RCA connector that outputs an RF signal. For moni- formed earlier the same year by former Motorola en- tors, there is an extra DIN connector that carries gineers, headed by Chuck Peddle. The philosophy of separate chroma, luma and audio signals (S-Video). the 6502 was to have a reduced instruction set and a For connecting Commodore compatible printers and small register file, making it simpler and faster than disk drives, there is a DIN connector for the IEC bus. CPUs like the Z80 at the same clock speed, as well as There is also a dedicated connector for datasette cheaper to manufacture. drives. The ”User Port” consists of several GPIO pins Unlike other CPUs, the 6502 does not have a set of that can be used for custom hardware projects, or as a general purpose registers. Instead, it has a single ac- RS-232 port (with TTL levels), for which support ex- cumulator A (for arithmetic and logic), two index reg- ists in the ROM. isters X and Y (for incrementing, decrementing and indexing memory) and a stack pointer. All these reg- Board isters are 8 bits. The processor status, consisting of the negative (N), overflow (V), break (B), decimal (D), On the C64 motherboard, there is a dedicated IC each interrupt (I), zero (Z) and carry (C) flags is exposed as for the main tasks. There is the MOS 6510 CPU, eight register P. The program counter (PC) is 16 bits wide. 64 KBit RAM chips (later consolidated into 2), three The fact that the stack pointer is 8 bit means that the ROM chips with KERNAL (I/O library), BASIC and stack is confined to the area between $0100 and the character set (KERNAL and BASIC were later $01FF in the address space, i.e. the upper half of the consolidated), two 6526 CIA I/O controllers (one for effective stack pointer is hard-coded to $01. There is keyboard and joystick, one for the IEC bus and the another special area in the address space: The first user port), the 6581 SID sound chip, and the 6567/ 256 bytes, at $0000 to $00FF are referred to as the 6569 VIC video chip, as well as the RAM chip that zero page (ZP). Many instructions support special holds the 512 bytes of Color RAM. encodings for zero page addresses, which saves one byte in the instruction encoding as well as at least one All non-RAM chips are custom chips designed manu- cycle of execution time. This can be seen as an exten- factured by MOS, Commodore's inhouse chip com- sion of the register file to another 256 (though exter- pany. nal) registers. All opcodes are one byte, and have 0, 1 or 2 byte op- Address Space erands. The 8x8 opcode matrix is somewhat logical (e.g. branch instructions are encoded as $10, $30, The 8 bit C64 design has a 16 bit address bus, allow- $50, ...), but there is no easy rule to construct the op- ing the CPU to address 64 KB of memory. Since the code table. Nevertheless, the opcode table is a mini- C64 has 64 KB of RAM, filling the complete address mal encoding for optimal decoding in the 6502's in- space, ROM and I/O chips are mapped into regions of ternal PLA ROM. the address space that are shared with RAM: The CPU can switch these regions between RAM and a Instruction Set second or third mapping. These regions are as fol- The instruction set is very streamlined, and avoids lows: redundancies.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages8 Page
-
File Size-