Commodore 128

From Wikipedia, the free encyclopedia

Commodore 128
Type Home computer
Released 1985
Discontinued 1989
Processor MOS Tech. 8502 @ 2 MHz
Zilog Z80A @ 4 MHz
Memory 128 KiB
OS Microsoft BASIC 7.0

The Commodore 128 (C128, CBM 128, C=128) home/personal computer was Commodore Business Machines's (CBM) last commercially released 8-bit machine. Introduced in January of 1985 at the CES in Las Vegas, it appeared three years after its predecessor, the bestselling C64. The primary hardware designer of the C128 was Bil Herd.

Contents

[edit] Technical overview

The C128 was a significantly expanded, and compatible, successor to the earlier C64. The new machine featured 128 KiB of RAM (externally expandable to 640 KiB) and an 80-column RGB monitor output (driven by the 8563 VDC chip with 16 KiB dedicated video RAM), as well as a redesigned case/keyboard with a numeric keypad. Instead of the 6510 CPU of the C64, the C128 incorporated a two-CPU design. The primary CPU, the 8502, was a slightly improved version of the 6510; its main addition was the ability to run at a 2 MHz clock rate (however, this required turning off the 40-column video output). The second CPU was a Zilog Z80 which was used for ensuring CP/M compatibility and for mode-selection of the computer upon boot-up. The two processors cannot run concurrently, thus the C128 was not a multiprocessing system.

The C128 had three modes of operation: C128 Mode (native mode), which ran at 1 or 2 MHz with the 8502 CPU and had both 40- and 80-column text modes available; CP/M Mode, which used the Z80 second CPU in either 40- or 80-column text mode; and C64 Mode, which was very nearly 100% compatible with the earlier computer. It should be noted that none of these modes would have been possible as implemented on the C128 without the Z80 chip. The Z80 controls the bus on initial boot-up and checks to see if there is a CP/M boot disk, if there are any C64/C128 cartridges present, and if the Commodore key (C64-mode selector) is active on boot-up. Based on what it finds, it will switch to the appropriate mode of operation.

Some 128s suffered from a reliability problem caused by the electromagnetic shield over the internal board. The shield had fingers that rested on the top of the major chips to conduct heat into the shield which then acted as a large heatsink. A combination of poor contact and the fact that plastic encased chips do not lose heat that way plus the shield being made from mu-metal (a poor heat conductor) saw some chips overheat and fail. The SID sound chip was particularly vulnerable in this respect as it operated from a 9 volt supply. The situation could be vastly improved by removing the shield completely.

[edit] C128 Mode

C128 Motherboard
C128 Motherboard

While the C64's graphics and sound capabilities were generally considered excellent, the popular home computer was the subject of a number of perennial criticisms. The 40-column VIC-II video display, while excellent for gaming, was often considered inadequate for productivity applications such as word processing. The lack of a numeric keypad was also an issue with some office suite software. Furthermore, the 2.0 revision of Commodore BASIC that was incorporated into the C64 was quite limited, and lacked keywords to handle the system's graphical and sound capabilities. These features had to be accessed via cumbersome PEEK and POKE commands, or by custom written machine language routines. Also criticized was the lack of a hardware reset button, an essential device when developing assembly routines. Finally, the C64's 1541 disk drive was almost universally condemned as slow and unreliable.

The designers of the C128 succeeded in rectifying most of these concerns. A new chip, the VDC, provided the C128 with an 80-column color RGB display. The new 8502 CPU was completely backward-compatible with the C64's 6510, but could run at double the speed if desired. A numeric keypad was added to the keyboard, as were various other keys. The C64's rudimentary BASIC 2.0 was replaced with the far more flexible and powerful BASIC 7.0, which included keywords designed specifically to take advantage of the machine's capabilities, and also incorporated a sprite editor and machine language monitor. The screen editor was further improved. A reset button was added to the system.

Three new disk drives were introduced in conjunction with the C128, the 1570, 1571, and 3.5 inch 1581 drives promising far faster transfer speeds via a new "burst mode". With these three drives, more complex drive data arrangements were also made available to Commodore users in the nature of "track and sector" oriented subdirectories, a feature not available to PC users, who instead had to convolute their file allocation tables to do the same thing. The disk drives also had more on-board RAM than their predecessors, the 1540 and 1541 drives.

The C128 also had far more RAM than the C64, and a far higher proportion was available for BASIC programming, due to the new MMU bankswitching chip. This feature made it possible for BASIC program code to be stored separately from variables, greatly enhancing the machine's ability to handle complex programs.

The C128's greater hardware capabilities, especially the increased RAM, screen display resolution, and serial bus speed, made it the preferred platform for running the GEOS graphical operating system.

[edit] CP/M Mode

The second of the C128's two CPUs was the Zilog Z80, which allowed the C128 to run CP/M; the machine came with CP/M 3.0, aka CP/M Plus (backward compatible with CP/M 2.2) and ADM31/3A terminal emulation. To make a large application software library instantly available at launch, the Commodore 128 CP/M and accompanying 1571 floppy disk drive was designed to run almost all Kaypro-specific CP/M software without modification.

Unfortunately, the C128 ran CP/M noticeably slower than most dedicated CP/M systems, as the Z80 processor ran at an effective speed of only 2 MHz (instead of the more common 4–6 MHz) and because it used CP/M 3.0, whose complexity made it inherently slower than the earlier, more widespread, CP/M 2.2 system. From the source code of the C128 CP/M implementation, it is clear that the engineers originally planned to make it possible to run CP/M in the "fast" mode as well, with the 40-column output turned off and the Z80 running at an effective 4 MHz; however this did not work on the released C128 hardware.

A possibly unique feature of the C128 among CP/M systems was that some of the low-level BIOS services were executed by the 8502 chip instead of the Z80. The latter transferred control to the 8502 after having placed the pertinent parameter values in designated memory locations. The Z80 then turned itself off, being awoken by the 8502 at completion of the BIOS routine, with status value(s) available in RAM for inspection.

[edit] C64 Mode

By incorporating the original C64 BASIC and KERNAL ROMs in their entirety (16 KiB total), the C128 achieves almost 100% compatibility with C64 software. The C64 mode can be accessed in one of three ways:

  • Hold down the Commodore logo key when booting the system
  • Enter the GO 64 command in BASIC 7.0 immediate mode
  • Boot with a C64 cartridge plugged in

Some of the few C64 programs that fail on a C128 run correctly when the CAPS LOCK key is pressed down (or the ASCII/National key on international C128 models). This has to do with the larger built-in I/O port of the C128's CPU. Whereas the C64's SHIFT LOCK key was simply a mechanical latch for the left SHIFT key, the corresponding key on the C128 can be read via the 8502's built-in I/O port. A few C64 programs are confused by this extra I/O bit; keeping the CAPS LOCK key in the down position will force the I/O line low, matching the C64's configuration and resolving the issue.

A handful of C64 programs wrote to $D030 (53296), often as part of a loop initializing the VIC-II chip registers. This memory-mapped register, unused in the C64, operated as a selector for 2 MHz mode in the C128. Since it was not disabled in C64 mode, an inadvertent write could blank the 40-column display by putting the CPU into fast mode. Fortunately, very few programs suffered from this flaw. In July 1986, COMPUTE!'s Gazette published a type-in program that exploited this minor incompatibility, by using a raster interrupt to enable fast mode when the bottom of the visible screen was reached, and then disable it when screen rendering began again at the top. By using fast mode during the vertical blank period, standard video display was maintained while increasing overall execution speed by about 20%. [1] [2]

An easy way to tell the C128's C64 mode and a real C64 apart, typically used from within a running program, is to write a value different from 0xFF (255) to memory address 0xD02F (53295), which is used to decode the extra keys of the C128 (the numerical keypad and some other keys). On the 64 this memory location will always contain the value 0xFF no matter what was written to it, but on a C128 in 64 mode the value of the location—a memory-mapped register—can be changed. Thus, checking the location's value after writing to it will reveal the actual hardware platform.

[edit] RAM setup

To handle the relatively large amounts of installable RAM, tenfold the 8502's 64 KiB address space, an on-board MMU chip performed continuous bank switching concurrently with general operation of the machine. While the MMU was designed to handle more than 128 KiB, the chips that were actually produced and used in the C128 cannot do so; thus memory expansions beyond 128 KiB, the so-called RAM Expansion Units, contained their own memory controller which would move blocks of memory between the main and expansion RAM.

[edit] 128D; RGB graphics

A Commodore 128D
A Commodore 128D

The Commodore 128D was released in the summer of 1986; it was an updated version of the C128 with a detached keyboard and a 1571 disk drive in the same box as the main system unit, providing a sleeker, more professional-looking appearance, much like that of a desktop PC. In Europe the first C128Ds came in a plastic case with a side-mounted carrying handle and were technically exactly the same as a C128 with the 1571 disk drive. Additionally these models were equipped with a somewhat noisy cooling fan, leading to the model sometimes being referred to as the "128 Diesel". Later models of the C128D came in a metal case; among these were the Commodore 128DCR (CR = cost reduced). These later models had some minor improvements. The internal design was more integrated to save production costs, but also improved the thermal design, so that a fan was supposedly not needed anymore (later experience proved that the fan was a worthwhile addition and many C128D's were so modified).

Inside, the C128D ROMs contained several bug fixes, and the 8563 VDC chip (in the C128DCR, the 8568) was equipped with the maximum capacity 64 KiB of video RAM – four times that of the original C128. This permitted the C128D to do higher-resolution graphics with more colors in RGB mode, although very little software took advantage of this. With or without the extra RAM, the VDC's high-resolution graphics modes were inaccessible from the C128's BASIC. They could only be utilized through low-level PEEK and POKE commands (or their assembly language equivalents), or via third-party BASIC language extensions. The most popular such toolkit was Free Spirit Software's "BASIC 8", which added high-resolution VDC graphics commands to CBM BASIC. BASIC 8 was available on two disks (editor disk and runtime disk) and with a ROM chip for installation in the C128's internal Function ROM socket.

[edit] Market performance

The system architecture of the C128, which in case of a C128D with memory expansion included three CPUs, five types of RAM memory, three operating modes, two system speeds, two graphics chips and two completely different low-level floppy disk encoding schemes was positively baroque and not at all orthogonal. This high complexity was probably a factor in the limited success of the C128—but of course also much of the reason for the machine's popularity among long-time CBM users and 'hackers', who enjoyed the capability of full C64 compatibility in a computer which was also fully usable as a BBS terminal and general office application platform in 80-column mode running native or CP/M programs. Another selling point for this group of users was the full-featured business keyboard, which was the first 'real' keyboard of a CBM computer since the less flexible (and thence, less popular) CBM-II/B series.

Because the C128 would run virtually all C64 software, and because the next-generation, 16-bit, home computers, primarily the Commodore Amiga and Atari ST, were gaining ground, relatively little software for the C128's native mode appeared (probably on the order of 100–200 fully commercial titles, plus the usual share of public domain and magazine type-in programs). While the C128 sold a total number of 4 million units between 1985 and 1989, its popularity paled in comparison to that of its predecessor. This has been blamed on the lack of native software and on Commodore's less-aggressive marketing. An additional explanation may be found in the fact that the C64 sold huge numbers to people primarily interested in computer games, which the more expensive C128 didn't add much value towards improving (with the exception of a few Infocom text adventures)—the C128 was certainly a better business machine than the C64, but not really a better gaming machine, and people who wanted business machines bought IBM PC clones almost exclusively by the time the C128 was released. The main reason that the C128 still sold fairly well was probably that it was also a much better machine for hobbyist programming than the C64.

Also, when the C128(D/DCR) was discontinued in 1989, it was reported to cost nearly as much to manufacture as the 16-bit Amiga 500, even though the C128D had to sell for several hundred dollars less to keep the Amiga's high-value marketing image intact.

Bil Herd commented on the Wikipedia C128 article himself, stating: "We considered the C128 to be a holding action until the next generation computers arrived, we were trying to up the game as far as expectations for new machines and buy a year, two at the max in the process. In that we exceeded our initial goals but probably due in part to Commodore's lackluster followthrough on marketing and selling the Amiga."

[edit] C128 trivia

The C128 Easter egg screen, with a listing of, and a message from, the machine's main developers. Notice the term "herdware", named after Bil Herd.
The C128 Easter egg screen, with a listing of, and a message from, the machine's main developers. Notice the term "herdware", named after Bil Herd.
  • Easter egg: Entering the command "SYS 32800,123,45,6" in native mode would reveal the 40-column screen shown to the right:
  • The Commodore 128's BASIC V7, the programming language which came built-in with the computer, could be crashed or cause the computer to reboot by executing PRINT""+-X (where X is any integer), depending on the number entered for X. This bug is present in all known versions of Microsoft's 6502 BASIC interpreter, including the BASIC of all other 8-bit Commodore machines, as well as Applesoft BASIC.
  • Entering the keywords QUIT or OFF will produce an "?UNIMPLEMENTED COMMAND ERROR".
  • The earlier ROM revision of the C128 included a rather obvious bug. When in "CAPS LOCK" mode, each of the alphabetic keys would type properly in upper-case except the "Q", which remained lower-case.
  • Multiple zero page and CPU stack locations can be defined by twiddling some bits in the C128's MMU, which makes multitasking a practical (although unrealized) possibility.

[edit] Specifications

  • CPUs:
    • MOS Technology 8502 @ 1 or 2 MHz
    • Zilog Z80  @ 4 MHz (effectively running at 2 MHz due to stopping half the time to allow VIC-II video chip access to system bus)
  • RAM: 128 KiB system RAM, 2 KiB 4-bit dedicated color RAM (for the VIC-II E), 16 KiB or 64 KiB dedicated video RAM (for the VDC), up to 512 KiB REU expansion RAM
  • ROM:   72 KiB (28 KiB BASIC 7.0, 4 KiB MLM, 8 KiB C128 KERNAL, 4 KiB screen editor, 4 KiB Z80 BIOS, ca. 9 KiB C64 BASIC 2.0, ca. 7 KiB C64 KERNAL, 4 KiB C64 (or international) character generator, 4 KiB C128 (or national) character generator) – expandable by 32 KiB Internal Function ROM (optional; for placement in motherboard socket)
  • Video:
    • MOS 8564/8566 VIC-II E (NTSC/PAL) for 40-column composite video (a TV set can be used instead of a monitor if desired)
      • Direct register access through memory-mapped I/O
      • Text mode: 40×25, 16 colors
      • Graphics modes: 160×200, 320×200
      • 8 hardware sprites
      • 2 KiB dedicated 4-bit color RAM, otherwise uses main memory as video RAM
    • MOS 8563 VDC (or, in C128DCR, the 8568) for 80-column digital RGBI component video, compatible with IBM PC CGA monitors, monochrome display also possible on composite video monitors; usable with TV sets only when the set has SCART and/or baseband video-in sockets in addition to the antenna connector.)
      • Indirect register access (address register, data register in mapped memory)
      • Text mode: 80×25, 16 colors (not the same as those of the VIC-II)
      • Graphics modes: 640×200, 640×400 (interlaced)
      • No hardware sprites
      • 16 KiB dedicated video RAM (64 KiB standard in 128D, 128 was upgradable to 64 KiB), accessible to the CPU only in a doubly indirect method (address register, data register on VDC, which in turn are addressed through address register, data register in mapped memory)
      • limited blitter functionality alleviates this RAM bottleneck
  • Sound:
    • MOS 8580 SID synthesizer chip
      • 3 voices, ADSR controllable
      • White noise channel
      • Cost-reduced and noise-reduced version of C64's MOS 6581; some early C128s actually have 6581s
  • I/O Ports:
    • All the ports of C64 (q.v.) —100% compatible— plus the following:
    • Higher speed possible on the serial bus
    • Expansion port more flexibly programmable
    • RGBI video output (DB9-connector, identical to IBM PC CGA connector, but with an added monochrome composite signal)

[edit] External links

[edit] References

  • Greenley, Larry, et.al. (1986). Commodore 128 Programmer's Reference Guide. Bantam Computer Books/Commodore Publications. ISBN 0-553-34378-5.
  • Gerits, K.; Schieb, J.; Thrun, F. (1986). Commodore 128 Internals. 2nd ed. Grand Rapids, Michigan: Abacus Software, Inc. ISBN 0916439429 . Original German edition (1985), Düsseldorf, West Germany: DATA BECKER GmbH & Co. KG.