In the series about the assemblers Commodore used for developing the ROMs of their 8-bit computers, this article covers the 1987 “HCD65” assembler that ran on the C128.
- Part 0: Overview
- Part 1: MOS Cross-Assembler
- Part 2: MOS Resident Assembler
- Part 3: BSO CY6502
- Part 4: HCD65 ← this article
- Part 5: 6502ASM
To build the ROMs for their 8-bit computers, Commodore originally used an assembler that ran on their own PET machines (part 2 of the series). From 1984 on, they used the “Boston Systems Office” (BSO) cross-assembler running on VAX/VMS (part 3).
In 1986, Commodore started working on a clone of the BSO cross-assembler that was supposed to run on the C128. An internal document (
c65.doc) in the original C128 source archive states:
HCD65XX is a powerful macro assembler syntactically identical to the assembler used to orginally develop the C128 source code running on a VAX-8600 under VMS. This tool is capable of assembling the same source files on a C128.
They announced the project in a usenet post to net.micro.cbm from April 1986:
There is a package developed in house that includes a macro assembler and a program editor that both take advantage of the C128 hardware. […] the object was to make it do everything that the VAX based cross assemblers can do, and to allow truely large assemblies. The editor is similar to the DEC EDT keypad editing mode.
It is too soon to know when or if this package will be available, but I am sure that it will be publicized on the various networks…
It was mentioned again in a post from October 1986:
We have a developers package containing a new macro assembler and editor that we hope to have available by year end. The assembler is compatible with the BSO 6502 Assembler that has been used by Commodore for software development of late.
The new assembler, called “HCD65” (in the manual) or “HCD65XX” (in the software), named after its developer Hedley Davis, was released in 1987 as part of the Commodore 128 Developer’s Package (manual, internal, internal (65CE02 version)).
The assembler consists of two components: A BASIC program to query the arguments from the user, and the non-interactive assembler binary. The BASIC frontend presents the following menu:
(C)1986 COMMODORE ELECTRONICS, LTD. ALL RIGHTS RESERVED V3.5 ENTER FILE NAME FOR SOURCE = KERNAL.SRC PICK A CONFIGURATION 0) NO LISTING : SOURCE,OBJ ON 8 1) LISTING TO SCREEN : SOURCE,OBJ ON 8 2) LISTING TO UNIT 4 : SOURCE,OBJ ON 8 3) ERRORS ONLY : SOURCE ON 8 4) LIST/XREF TO UNIT 4: SOURCE,OBJ ON 8 5) NO LISTING : SOURCE,OBJ ON 9 6) LISTING TO SCREEN : SOURCE,OBJ ON 9 7) PRINT LISTING ON 4 : SOURCE,OBJ ON 9 8) ERRORS ONLY : SOURCE ON 9 9) LIST/XREF TO UNIT 4: SOURCE,OBJ ON 9
It allows entering a filename (the extension
.SRC is added automatically) and configuration options that control whether to hide/show/print the LST, whether to generate a cross-reference and what drive to read the sources from. Pressing RETURN in the menu will allow the user to configure all options manually.
It then asks for the date string, since the C128 does not have a real-time clock, and asks the user to verify the settings:
(C)1986 COMMODORE ELECTRONICS, LTD. ALL RIGHTS RESERVED V3.5 ASSEMBLY OF KERNAL.SRC SOURCE FILES ON UNIT 9 LISTING OUTPUT = PRINTER NO CROSS REFERENCE DATE STRING ="2021-05-08" ERROR OUTPUT = SCREEN OBJECT OUTPUT = KERNAL.OBJ ON UNIT 9 PRINTER DEVICE NUMBER = 4 LIST AND ERROR FILE WIDTH = 80 COLUMNS RUN THIS CONFIGURATION ? (Y/N)
Y will start the assembly.
HCD65 was designed to be as similar to BSO as possible, but there are a few differences:
- HCD65 accepts both ASCII and PETSCII source files. When using existing BSO source files, it is important that the source files use CR line breaks and that the filenames referenced by
.INCLUDEhave the right case.
- HCD65 is missing the
.IFdirective that BSO understands as a synonym to
There are four known versions of the HCD65 assembler:
Little is known about this version. The LST files that shipped with the C128 Devpack were built with this version.
This is the version that shipped as part of the C128 Devpack.
HCD65XX 65CE02 V0.1
In 1989, Commodore started writing the ROM for the upcoming C64DX/C65. The CPU of the machine was a 4510, which implemented the extended 65CE02 instruction set, so in order to use the additional CPU features, they needed an assembler that supported them.
The BSO/VAX cross-assembler that they had been using for all development at the time was written by a third party and Commodore did not have its source, so Fred Bowen added support to the C128 HCD65.
- HCD65XX 65CE02 V0.1 (BIN: 11166 bytes, built from the source using HCD65XX V3.5)
HCD65XX 65CE02 V0.2
Version 0.2 is changes the AUG/MAP opcode from 65CE02 to the 4510 semantics, and adds an alternative syntax to the BBR/BBS mnemos.
The sources of the V3.5 and 65CE02 0.1 and 0.2 versions are available as part of the Commodore Source collection:
Use at Commodore
It is unclear why Commodore developed HCD65 in the first place.
It is unlikely that they developed HCD65 mainly for a commercial release. There were plenty of assemblers on the market, and BSO compatibility is not something users were looking for.
Another hypothesis would be that they wanted to replace the BSO cross-assembler for in-house use.
In 1986, they were using BSO on a 12.5 MHz VAX-8600. The original PDP-10 version of BSO’s tools were implemented in hand-written machine code, but the later PDP-11/VAX/ULTRIX versions were probably written in a high-level language. There might have been a chance that a new assembler written in well-optimized machine code for the 2 MHz C128 could have matched the speed of the BSO assembler, but the C128’s I/O system (even using the new Fast Serial bus) would have certainly ruined that.
So they wouldn’t have replaced BSO for a speed benefit or added convenience. Original LST files that have been preserved show that Commodore used BSO, not HCD65, for all 6502-based projects until 1990 (C64GS).
One realistic reason for developing HCD65 would be as an insurance policy: to have an in-house alternative to BSO, so they would not be dependent on a third party. The in-house solution could also be altered and extended, especially in the context of the upcoming 4510/65CE02 CPU. The 65CE02 project, an effort to re-design the 6502 in CMOS, started in late 1985. And in fact, 4510/65CE02 support was added to HCD65 in 1989.
The graphics extensions to BASIC 10 by the external contractor Walrus Software Inc. were developed using HCD65 65CE02, and so was the C65 DOS ROM for a while, before all development switched to the “Commodore 6502ASM” cross-assembler in 1990.
The next article will discuss this new cross-assembler that Commodore developed in 1989.