On this page:
- History of the KIM-5 Resident Assembler/Editor
- Relevant manuals
- ROM dumps and sources
- Weird behaviour of assembler
The KIM-5 Resident Assembler/Editor is a 6502 version of the MOS Technology Cross Assembler. See the pages on the MOS Technology/Commodore assemblers on pagetable.com
The Resident Assembler was written by Michael Corder (of MOS contractor COMPAS Microsystems) by hand-assembling the Cross-Assembler FORTRAN code to native 6502 assembly.
Consequently, both assemblers were compatible in that they understood the same source format, with the same math features and the same directives and options. That way, they defined the basic format supported by all future Commodore assemblers. This means that the Resident Assembler took uppercase ASCII source files.
John Feagans on the origin of the KIM-5 Resident Assembler/Editor:
As a grad student at Iowa State University, Ames, I had access to all the development of these KIM boards as the local contractor for MOS was Compass Microsystems. The original 6502 assembler was written in Fortran and available on Tymshare. First Michael Corder (aka The Cordless Electric Programmer) hand compiled the Fortran to 6502 assembler. Even the Fortran line numbers were used as labels. This became the basis of the MDT 650, an ICE for 6502, and the KIM assembler. Compass developed another product called the MiniMac–a 6502 development system on a plugin for a DEC PDP-11. I took Corders 6502 assembler and hand translated line by line from 6502 assembler to PDP-11 assembly. When I joined Commodore I ported the assembler one more time to become the PET assembler and later C64 assembler.
In 1977, Commodore announced the Resident Assembler/Editor for the KIM-1, which shipped in the form of the KIM-5 ROM board with three 6540 ROM chips (6 KB total) containing the assembler and a simple editor.
The manuals (see below) from 1977 do not mention the .DBYTE, .PAGE and .SKIP directives. In the source (see below) they seem to be recognized and lead to an error.
The assembler could read source from cassette tape or paper tape, but it could not write OBJ files; instead, it would write the binary to RAM.
If the source was too big to be placed in memory, the assembler could read source files from tape until the .END directive was encountered.
All described in the two manuals that I found:
MOS KIM Assembler Manual Preliminary (KIM-5) | |
MOS KIM Text Editor User Manual (KIM-5) |
The KIM-5 Resident Assembler/Editor ROMs
Many years I searched on the internet on fora, websites and friends in the retro world, it did not lead to a dump of the KIM-5 ROMs. It was even doubted the KIM-5 with Assembler/Editor was ever sold, despite the adverts in magazines of that period.
A couple of years ago I saw a listing on ebay.de of a.o. a KIM-5 and a KIM-3B board. I was too late, could not contact the seller or buyer, but I knew the KIM-5 did exist!
A year later Stefan Hamann approached me to ask for information on KIM-1 material he bought from ebay. He was the buyer!
Stefan was so nice to lent me the KIM-5 (and KIM-3B) and the EPROMs he obtained. I have finally a KIM-5 in my hands with ROMs!
The KIM-5 Resident Assembler/Editor is placed in three 2K ROMs of type MOS 6540, and the KIM-5 board configured to show these in memory at E000-E7FF.
With the excellent Backbit Pro Chip Tester I managed to dump the 6540-007, -008, and 009 ROMs. 6540 are strange ROMs, see below. To my surprise the ICs were in excellent condition.
In the other EPROMs (2x 4K 2532) I found a copy of the KIM-5 Resident Assembler/Editor ROMs, nearly identical to the 6540’s. So the dumps are reliable.
ROM dump archives
This archive has the ROM dumps of the KIM-5 Resident Assembler/Editor for KIM-1 Mos Technology Commodore:
- Dumps of original KIM-5 2K ROMs
- 6540-007 E000 – E7FF
- 6540-008 E800 – EFFF
- 6540-009 F000 – F000
- Combined to one binary
(suitable for KIM-1 Simulator 1.5.1 or KIM-1 with ROM/RAM at E000-F7FF- kim5.bin E000-F7FF
- EPROM dump (4K ROMs) (has valid KIM-1 Reset/NMI/IRQ vectors at high memory)
Small changes like jmp to tape dump routine in the ROM (see sources) - KIM E000
- KIM F000
- Combined to one binary
- kim e000-ffff
With the binaries dumped I have
- loaded in the KIM-1 Simulator (version V1.5.0. with RAM at E000-F7FF added) and started the Editor. See the screenshots below (in which I did not configure the symbol table as instructed in the manual!).
- disassembled and recreate assembler source which assembles to identical binary and documented as much as possible with the assembler sources on pagetable (PET, AIM 65)
Source of KIM-5 Resident Assembler/Editor
Recreated source of KIM-5 Resident Assembler/Editor with the aid of TASM32, result is binary identical with the ROM dumps.
Tables, data, jump tables, all recreated. A lot is commented, the editor part needs some attention. Assembles fine.
Eduardo Casino helped me to find the last location dependent statements, and now the program runs at other locations like $9000 after adjusting the .org directive and reassembly.
Eduardo Casino created a CC65 version of the source: Recreated source in CC65 Assembler format of KIM-5 Resident Assembler/Editor
Assembling branch instructions
While working with the assembler Eduardo found weird behaviour by the assembler of the code generated.
Backward branches are done in the usual way. Forward branches generate an extra NOP instruction.
It is not doing any damage, it just wastes space and execution time.
See the next screenshots.