post

My retro toolchain

About my toolchains for retro computing.

Tools are very personal choice, what works for me. I use Windows (11 now) as my main workstation and often the command line. I do have Linux desktops for compatibility testing. As I grew up in the 80ties with mini’s like HP1000, PDP-11 + RSX-11M, VAX/VMS, MS-DOS, all command line, many many editors, from line editors to screen oriented (EDT from DEC was great!) with all kind of automation tools and code management, I feel comfortable with what Windows (and Linux) offer me now, it makes me very productive! YMMV, pick your tools as you like it.

Tools development
When there is not a tool available that does easy what I need, I write my own. GUI or command line, depending on the context.
My toolchain consists of Freepascal (commandline) and Lazarus (GUI).
Most tools have to do with manipulating binary data as to be expected. Other areas are compilers and simulators.
Resulting tools run on Windows, Linux and Apple Mac’s. See the, like the Hex format conversion, the KIM-1 Simulator and more.

Assembly toolchain

I have quite a collection of 8 bit computers, 6502, Z80, 6809.
Each processor comes with its own machine language, and for each processor myriads of assemblers have been made, each with its own deviations of the official syntax and way they operate. The simple ones are two-pass assemblers generating binaries and listings and symbol tables. More advanced are made up of an assembler and a linker. Linkers are nice and powerful, but a bit overkill for simple projects. I like command line assemblers, callable from an editor.

Notepad++ Editor
A very powerful text editor, with syntax highlighting, multiple files windows open, good search, plugins like hex editor and external tools support.

  1. Install latest version from the download
  2. Add plugins Hexeditor and NPPEXEC
  3. Add scripts to nppexec such as (requires TASM 2 installed, read below)

    • make6502pap tasm -65 -x3 -g1 -s “$(FILE_NAME)” “$(NAME_PART).pap” “$(NAME_PART).lst” -s “$(NAME_PART).sym”
    • make6502bin tasm -65 -g3 -s -l -fff “$(FILE_NAME)” “$(NAME_PART).bin” “$(NAME_PART).lst” -s “$(NAME_PART).sym”
    • make6502hex tasm -65 -x3 -g0 -s “$(FILE_NAME)” “$(NAME_PART).ihex” “$(NAME_PART).lst” -s “$(NAME_PART).sym”
    • makez80hex tasm -80 -g0 -s “$(FILE_NAME)” “$(NAME_PART).ihex” “$(NAME_PART).lst” -s “$(NAME_PART).sym”
    • etc, see c:\tasm\TASMMAN,HTM
  4. Edit you source
  5. Assembly first time: press F6 choose wanted script
  6. After that Press CTRL-F6 to asemble
  7. The output of the assemble appears at the bottom of the editor in a separate part
  8. Open in Notepad also the listing file
  9. If errors, correct the source
  10. if errorfree, start debugging your code, leave Notepad++ open to edit source and read the listing

TASM32
This is a command line assembler that supports processors like 6502 and Z80. Output is binary, MOS papertape, Intel Hex, Motorola S-record. Listings and symbol tables (for the KIM-1 Simulator) can be generated. Used from Notepad++ as Tool, no need to start from the command line.

  1. Download TASM 32 here
  2. Unpack in e.g. c:\tasm
  3. Create environment variable TASMTABS=C:\TASM
    (Settings – Related Settings – Advanced system settings – Advanced tab – Environment Variables).
  4. Add c:\tasm to the PATH
  5. Invoke tasm from the command line without arguments for help and/or read TASMMAN.HTM in C:/tasm
  6. Add macro’s to Notepad++, see there.

Test and debug
The output of the assembler can be downloaded to the SBC. Burn an EPROM, download hex or papertape. And test the code.

For KIM-1 programs I always use the KIM-1 Simulator debugger on the PC.
Set breakpoints and watches, trace the code, inspect memory, run the program.
When it is a TTY console program, I sue a terminal emulator, Teraterm.
2400 baud 8 bit, one stop bit, no parity, 5 ms character delay, 20 ms line delay for papertape upload.. Higher baudrates may work.

For CP/M there are many emulators available, choose one that allows file from the PC to be accessed also by the emulator. E.g. the Z80 IDE and CP.M emulator of Hein Pragt.
CC65
I only use the assembler and linker of the CC65 package. Mainly for KIM-1 KB9 Basic development, as the source from Pagetable is in this format.

This is how I do it (Windows, can be done also on Linux)

  1. Download and unpack the archive of pagetable in a folder on your PC.
  2. Download and unpack the CC65 package, a C compiler, from which only the assembler and linker is used. I used the Windows binary.
  3. Copy CA65.EXE, LD65.EXE and longbranch.mac from the CC65 package to the folder where you unpacked the MS Basic source.
  4. Change whatever you like in the source. It is quite a complicated construction, with macros for every variant, so look carefully at the listing file what really is produced.
    Start with no adaptations and then go on studying the listing file and testing. The KIM-1 Simulator is a good tool for testing! Load the symbol table file to see what is where.
  5. Assemble and link with this simple batch file makekb9v2.bat, resulting in an object, a binary, a listing file and a symbol label file.
    ca65 -D kb9 msbasic.s -o tmp/kb9v2.o -l tmp/kb9v2.lst
    ld65 -C kb9.cfg tmp/kb9v2.o -o tmp/kb9v2.bin -Ln tmp/kb9v2.lbl
    
  6. Repeat step 4 and 5 until you are satisfied with the adaptations. The article listed above are a good source of inspiration.

Winmerge
A tool to compare files, text and binary. Open the program, drop binary files from the explorer on it and see the differences highlighted. Essential to compare ROM dumps or to check if assembler source assembly leads to identical binary as the original. Detects subtle syntax differences from sources converted or disassembled, leading to different code.

Disassembler
Still searching for a good multiprocessor tool. With some intelligence, like input files not only binary, but also a symbol file and tips of what is data and what is code. Output should be in assembler format ready to assemble. A multipass operation, where you learn from each iteration symbols and data areas.

For 6502 code I use the online tool at Virtual Disassembler. Drop the binary and copy the code. Choose the output format, like “listing” or “assembler”. You can input a symbol file.

PRDIS, Printing Disassembler

In 1982 I wrote/composed a program to have disassembled code on paper, with page numbers. Read more about it here.

The core routine of the disassembler is the well-known Steve Wozniak/Allen Baum 1976 article A 6502 Disassembler from Apple
The program is a TTY program. I build it with the then current hardware and software of my KIM-1:

  • 32K RAM from $2000
  • Video terminal uppercase 24×32 on the KIM TTY serial in/output
  • A parallel ASCII keyboard connected to the second 6532 RIOT port
  • A serial connected, at 9600 baud, Heathkit H14 matrix printer
  • Dual audio cassette records under motor control
  • MICRO ADE assembler/Editor, extended and with video TTY as output, parallel keyboard as input and could print at the H14 printer

post

Printing Disassembler

In 1982 I wrote/composed a program to have disassembled code on paper, with page numbers.

The core routine of the disassembler is the well-known Steve Wozniak/Allen Baum 1976 article A 6502 Disassembler from Apple
The program is a TTY program. I build it with the then current hardware and software of my KIM-1:

  • 32K RAM from $2000
  • Video terminal uppercase 24×32 on the KIM TTY serial in/output
  • A parallel ASCII keyboard connected to the second 6532 RIOT port
  • A serial connected, at 9600 baud, Heathkit H14 matrix printer
  • Dual audio cassette records under motor control
  • MICRO ADE assembler/Editor, extended and with video TTY as output, parallel keyboard as input and could print at the H14 printer

Only the KIM-1 survived today this setup and is now on display above my desk in an acryl case. Most of the software is converted from tape and is on this site in the KIM Software page.

The program was written to have a disassembled printed listing of software like the Microsoft Basic KB9 and other binary only software, so I could analyze, make notes and patch it at will to my hardware and more. It was located at location $B000, out of the way of where most programs were loaded, like $0400 or $2000.
The program prompts for output to video or to video + printer. If printer is selected the output will be paginated with page numbers and it asks for a header text.
I still have the printed output of Microsoft Basic with my hand written notes on it.

My workplace setup in 1982: KIM-1, dual cassette, tv monitor, H14 printer, ASCII keyboard

The original source and binary (restored from cassette, the previous version on the website was incomplete):

Printing disassembler, load and start address is $B000
Source of disassembler
Requires a parallel keyboard for character input at the free 6530 PIA port. H14 printer output if print is requested.

As is not fit for a standard KIM-1!

PRDIS Version 2

In January 2023 Glen Deas, K5GED, approached me about this program. He found out the binary was missing the last bytes (now corrected). He also showed me how he converted the MICRO ADE source to AS65 format and made it use the KIM-1 standard TTY I/O again.
Printing disassembler, load and start address is $B000 for KIM-1, Glen Deas version

  
   ; VERSION 1.1 JANUARY 2023  SYNTAX MODIFIED FOR THE
   ;  A65 CROSS ASSEMBLER   GLEN DEAS, K5GED  USA
       INVOKE A65:  A65 -L -M -H D6502TTYV2.S
   ; Version 2.0  MODIFIED TO USE THE KIM-1 SERIAL I/O INSTEAD OF PARALLEL KEYBOARD
   ;               USING KIM'S TTY ROUTINES - BY DEFAULT IT OUTPUTS TO THE VIDEO 
   ;               MONITOR/TTY VIA THE OUTCHK CALL TO THE KIM-1 MONITOR 
   ; Set up Procomm up for 7 data, Mark parity, and 2 stop bits, no echo

PRDIS Version 3
I could not resist to spent an afternoon on the source Glen Deas has given me. So much fun to work on code 40 years later. Grateful to Glen for his work on his vesion.

Here is my latest version, running fine in the KIM-1 Simulator.
Source and binary in papertape format V3 of PRDIS
Improvements in V3:

  • No problems with echo or 7 bit anymore, all standard KIM-1 monitor
  • Lowercase messages
  • Code for H14 printer or parallel keyboard commented out, reducing size
  • Rommable, variables moved to RAM $0200, program at $B000
  • Stops output after every 16 lines, any key but Enter stops program
  • Source formatted and syntax for TASM32, license added


Example session, PRDIS disassembling itself without and with Pagination:

KIM
B000 D8 G
Printing Disassembler V3.0 for 6502 
Printer or video format (p/V)?  

Address range (XXXX-YYYY)? B000-B100
Disassembly: 
B000  D8          CLD 
B001  A2 FF       LDX #$FF
B003  9A          TXS 
B004  A9 01       LDA #$01
B006  8D 00 02    STA $0200
B009  A9 00       LDA #$00
B00B  85 EE       STA $EE
  .
  .
  .
B0F6  C9 22       CMP #$22
B0F8  F0 13       BEQ $B10D
B0FA  29 07       AND #$07
B0FC  09 80       ORA #$80
B0FE  4A          LSR 
B0FF  AA          TAX 

KIM
B000 D8 G
Printing Disassembler V3.0 for 6502 
Printer or video format (p/V)?  P

Address range (XXXX-YYYY)? B000-B200
Header text? PRINTING DISASSEMBLER

PRINTING DISASSEMBLER                                             Page 01

B000  D8          CLD 
B001  A2 FF       LDX #$FF
B003  9A          TXS 
B004  A9 01       LDA #$01
B006  8D 00 02    STA $0200
B009  A9 00       LDA #$00
B00B  85 EE       STA $EE
B00D  8D 01 02    STA $0201
B010  20 2A B3    JSR $B32A
B013  A2 B4       LDX #$B4
B015  A0 AC       LDY #$AC
  .
  .
  .
B1C6  60          RTS 
B1C7  A5 F0       LDA $F0
B1C9  38          SEC 

PRINTING DISASMBLER                                             Page 05

B1CA  A4 FB       LDY $FB
B1CC  AA          TAX 
B1CD  10 01       BPL $B1D0
B1CF  88          DEY 
  .
  .
  .
B1F9  33          ??? 
B1FA  D0 8C       BNE $B188
B1FC  44          ??? 
B1FD  00          BRK 
B1FE  11 22       ORA ($22),Y

KIM
B000 D8 

Corsham Bus Extender

Corsham Technologies produces a Bus Extender fot the KIM-1. Simple but so handy

It is placed beween the external device on Application or Extension Connector and has 44 pin header to attach wires to a breadboard for example.
Only negative I can say about it, tinned edge connectors and not gold plated.

Nice addition to my Reproduction KIM-1s!

MOS KIM-1 Reproduction, white version

Dave Wiliams made a revison of the MOS KIM-1 Reproduction, a white version.

The original green and the new white are for sale at ebay as of January 2023.

More information here.

AIM 65 clone

Mr. Nagano, from Tokyo, Japan send me photos and circuit diagram of an AIM 65 clone he built. It is a beautiful and functionally and esthetic faithful clone. In fact, he built two, one with a CPLD 3V3 version and a 5 V version with a 6532 RIOT.

Read all about it here.

6507 breadboard computer

A 6507 CPU with a 6532 RIOT and a 27C512 EEPROM on a small breadboard.

Github with circuit diagram and sources

KIM-1 Rockwell sticker

My KIM-1 came as an Rockwell OEM kit. The Rev F board is made by Commodore MOS Technology, the packaging and manuals are the original MOS Technology books, but Rockwell branded.

The logo on the KIM-1 is covered with a sticker, of course to have the Rockwell logo on the board. But some one was so clever to add essential information and addresses of the KIM-1 monitor.

KIM-1 Rev A Photos

Guido Lehwalder gave me photos of his KIM-1 Rev A. Thanks!
Note the different colors of components.

I added these to the KIM-1 Revisions page.

Rev A, photo by Guido Lehwalder


Rev A, photo by Guido Lehwalder

Tor-Eirik Bakke Lunde a.k.a TEBL created several computer systems with detailed documentation.

The RC-ONE is a KIM-1 clone, inspired by the design by Ruud Baltissen, which can be built in a compact to much expanded format.

TEBL separated functionality into separate boards so that each version would cost only around 5$ per piece instead. It means it’s no longer a single board computer, but if it means more people can build it as a fun project then that’s a plus in my book. The main setup does not include the additional 15 I/O lines due to space requirements, but you can add those back to the system by including the 65K Expansion (in addition to the backplane module) if you want to. If you just want to play around with the system and try your hand at machine language coding, you can get started with the CPU board, UI board and a keypad module.

The whole design is documented on TEBLs github page, from circuit diagrams to PCB design.

The manual is an excellent guide to the system, read that first!