post

PC Tools

Updated December 2020, Linux compilation checked, bugs fixed, online program for comverting binary to wave file.

To aid in the handling of KIM-1 program and dataformats I have written some programs for Windows and Linux (Raspbian), sources included.

KIM-1 simulator
Convert 8 bit hex formats GUI
Convert 8 bit hex formats CLI
KIMPaper
KIM Tape WAV to BIN conversion
KIMPoser Tape Convert hex to WAV online
KIM Tape Convert WAV to BIN and BIN to WAV
Pascal-M cross compiler

All programs come with source (Free Pascal Lazarus), compiled for Windows but thanks to Freepascal and Lazarus also compiled and tested on Linux (Ubuntu and Raspberry PI OS).

KIM-1 simulator

6502/65C02 CPU emulation, disassembler, TTY, KIM-1 keypad and LEDs.
See the KIM-1 Simulator page for more information.

Convert 8 bit hex formats GUI

A general purpose utility to convert common 8 bit hex and binary formats, such as Intel HEX, Motorola S records, MOS Papertape, hex format, and binary files.

Sources (Freepascal Lazarus).
Convert8bithexformat Setup for Windows, Executables for Ubuntu and Raspberry PI OS
Available formats:
– BIN binary, raw data, no formatting, no information on start address.
– HEX formatted as hex numbers raw data, no start address included.
– IHEX Intel hex 8 bit format, multiple memory block, start address included.
– PAP MOS Technology papertape format, multiple memory blocks, start address included.
– SREC Motorola 8 bit S record, contiguous memory block, start address included.
– A1hex Apple Woz monitor hex format, start address included.
– KIM Tape as used in the KIM-1 Simulator as emulation of audio tape files.

Convert8bithex CLI

https://github.com/HansOtten/convert8bithex

convert8bithex - convert 8 bit hex files, 
command line V1.0 (based on Convert 8 bit hex files V3.1) Hans Otten

Usage: convert8bithex [options] infile outfile

Options:
  -i, --in FORMAT     input format  (default: from infile extension)
  -o, --out FORMAT    output format (default: from outfile extension)
  -s, --start ADDR    load address in hex for bin and hex input (default 0000)
  -m, --merge         write one output covering all parts, gaps filled
      --fill BYTE     hex fill byte for gaps with --merge (default FF)
  -k, --tapeid ID     hex KIM-1 tape ID for kim output (default 00)
  -d, --define TEXT   define directive for define output, e.g. ".byte $"
  -y, --yes           overwrite existing output files
  -q, --quiet         only report errors
  -h, --help          this text
  -V, --version       show version

Formats:
  bin      binary, no address (use -s)
  prg      binary, first two bytes load address (low, high)
  hex      hex digits, two per byte, no address (use -s)
  ihex     Intel hex
  mos      MOS / KIM-1 papertape
  tim      TIM papertape
  srec     Motorola S-record (S1/S5/S9)
  apple1   Apple 1 hex monitor format
  kim      KIM-1 tape (.tap, binary with ID)
  define   assembler source with define bytes (output only, use -d)

Extensions: .bin .prg .hex .ihex/.ihx .ptp/.pap .tim .srec/.s19 .ahex .tap .asm

Input with several address ranges (Intel hex, papertape, S-record, Apple 1)
is loaded as separate parts. Output to bin, prg, hex, apple1 or kim then gives
one file per part, named <outfile name><start address><ext>,
e.g. prog0200.bin and prog1000.bin. Use -m for a single file instead.

Examples:
  convert8bithex monitor.ptp monitor.bin
  convert8bithex -m --fill 00 basic.ihex basic.bin
  convert8bithex -s E000 rom.bin rom.srec
  convert8bithex -o define -d ".byte $" rom.bin rom.asm

KIM Paper

Note that the Conver8bitHexFormat program is also capable of converting to and from Papertape format from many more formats.
Originally written for the launch of the MicroKIM, an older version is on the support CD.

When you attach a serial device like the teletype or a modern PC with Hyperterminal you can use the TIM monitor of the KIM-1. One of the functions is loading from and saving to a papertape device on the teletype. Now since this is a way to load and save data as a textfile this is in fact quite useful.
The Micro-KIM triggered me to modernize my conversion utility for MOS Technology papertape format dating from 1983, VAX/VMS and Turbo Pascal. A Windows and a commandline/console version are available.

KIMPAPER for Windows

A program for Windows to convert between papertape and binary format.

Windows setup KIMPAPER
Sources (Freepascal Lazarus, build also on Linux)

KIMPAPER V1.1 for DOS

Not too modern, but handy, a commandline utility. Does exactly the same as the Windows program KIMPAPER. Runs fine in a commandline DOS box. Can also be compiled for Linux with Freepascal. In the KIMPAPER DOS archive the program, source and information on the program and papertape format can be found.

KIM-1 MOS Technology BIN papertape format conversion utility, Hans Otten, 2007 v1.1

Syntax is:
KIMPAPER [-[b|p] filename [startaddress]
C:\MICROKIM\kimpaper -h
KIM-1 Mos Technology BIN papertape format conversion utility, Hans Otten, 2007 v1.1
Syntax is: KIMPAPER [-[b|p|h] filename [startaddress] first parameter switches
-h help
-p convert to papertape
-b convert to binary
second parameter (first if no parameters, assumed binary to papertape)
name of file to convert
.BIN for binary, forces conversion to PAPertape
.PAP for papertape, forces conversion to BINary
third parameter (assumed 0000 if not present)
startaddress for BIN to papertape conversion
Files of type .BIN wil force conversion to papertape.PAP
Files of type .PAP wil force conversion to binary .BIN

Examples:
C:\MICROKIM\kimpaper mastermind.bin 0200
KIM-1 Mos Technology BIN papertape format conversion utility, Hans Otten, 2007 v1.1
C:\MICROKIM&amp;amp;amp;amp;amp;amp;amp;gt;kimpaper mastermind.pap
KIM-1 Mos Technology BIN papertape format conversion utility, Hans Otten, 2007 v1.1
Start address 0200 in file mastermind.BIN

Convert KIM tape to text


KIM Tape to Text is a utility to convert between binary format of a KIM-1 tape dump to a DOS text file.
The KIM tape dump is a binary file and is just a dump of part of the memory of the KIM-1.
This binary file can be a text file as used in editors Micro Ade or CW Assm/TED.
By using the tape write routine in the KIM-1 one can write an audio file on cassette.
When this audio file is captured on a PC as WAV file (22K, mono) this can be converted back to a binary memory dump with KIMTAPE

First open the binary file. If this is recognized as Micro Ade or CW Moser format, the Save as text file can be used.

Windows program.
Full source for Freepascal and Lazarus, no Windows dependencies. Compiled on 64 bits Windows 10 as 32 bit application.

Note on detection of assembler editor type
1. Micro Ade file must start with CR: when present this is Micro Ade
line nr follows 2 byte
line ends with $0D
file ends with $40
2. Assm/Ted by CW Moser starts with line number $10 $00
end of line is high bit set
There may be rare situations that a file starts with a $0D or a different line nr. You can force CW Mose detection by changing this to a sequence of $10 $00 $0D and if necessary blanks $20 to make it consistent. If in doubts: use an editor that shows the file in hex (Ultra Edit, or the free Notepad ++, Text editor PRO) and study the tape file.

Methods to get the binary file out of a Junior or KIM-1.
Read the record tape into a binary with Ed’s KIMTAPE conversion *see below). It is MS-DOS and runs fine in VDOS (https://www.vdos.info/) or DOsbox (slow).
Make a note of start address as shown by KIMTAPE.
Non-printing ASCII characters are filtered out of the resulting text file.

KIMTAPE Convert WAV to BIN and BIN to WAV

Source and executble here, Freepascal, so cross platform

KIMTAPE version 1.0  (Free Pascal port of KIMTAPE 0.5)

Use:  KIMTAPE [options] infile[.typ] [outfile[.typ]]

-C    console output              -M    make wavefile
-Bn   HYPERTAPE speed  2x 3x 6x   -I    invert wavefile
-U    SYM-1 high speed format     -V    VOC wavefile
-Fn   offset  -127 to 127         -R    RAW wavefile
-Hn   hysteresis  0 to 127        -Ln   leader (sec)
-Gn   timing  -2 to 2             -T    sine tone
-An   load address (hex)          -Dn   prog ID (hex)

Additional options in this version:
-K    classic decoder (zero crossings, as KIMTAPE 0.5)
-En   high tone boost 0..4 (default: automatic)
-N    no automatic DC/level adjust  (-K and SYM-1 decoding)
-Pn   channel  0=mix 1=left 2=right  (decode, stereo files)
-Sn   sample rate: output wavefile (encode, default 22050)
      or RAW input file (decode, default 22050)
-Wn   sample width 8 or 16 bits  (encode, default 8)
-O    overwrite output file without asking

Several recordings of the same tape can be combined:
  KIMTAPE rec1.wav+rec2.wav+rec3.wav outfile

default: decode WAV file, KIM-1 format
         load address=0200, file ID=00

Conversion utility for KIM-1 and SYM-1 format audio tapes.
Input WAV files may use any sample rate (44100, 48000, ...),
8/16/24/32 bit integer or float samples, mono or stereo.
Output is an 8-bit mono WAV, VOC or RAW wavefile recorded at
22,050 samples per second unless -S / -W are given.

Pascal-M Cross compiler

Executables of cross compiler, workflow, sources, command line utilities.

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.

post

Intel SDK-85

A new SBC in my collection: the SDK-85 made by Intel. Still functional, good looking PCB and manual.

The SDK-85 MCS-85 System Design Kit was a single board microcomputer system kit using the Intel 8085 processor, clocked at 3 MHz with a 1.3 μs instruction cycle time. It contained all components required to complete construction of the kit, including LED display, keyboard, resistors, caps, crystal, and miscellaneous hardware. A preprogrammed ROM was supplied with a system monitor. The kit included a 6-digit LED display and a 24-key keyboard for direct insertion, examination, and execution of a user’s program. It also had a serial transistor interface for a 20 mA current loop Teletype using the bit-serial SID and SOD pins on the CPU. The maximum user RAM for programs and data, on the factory standard kit, was limited to 0xC2 or 194 decimal bytes. The full 256 bytes was available on the expansion RAM. User programs could call subroutines in the monitor ROM for functions such as: Serial In/Out, CRLF, Read Keyboard, Write Display, time delay, convert binary to two character hexadecimal etc.

– RAM 256 bytes expandable to 512 bytes with another 8155 RAM / 22 programmable IO lines.
– The 14-bit programmable Timer/Counter was used for system single-step control. The expansion Timer/Counter was available.
– ROM 2 KB expandable to 4 KB with another 8755 EPROM / 16 programmable IO lines in the expansion socket.

Extra 8155 RAM I/O and 8755 EPROM are on order.

Manuals and books

SDK-85 user’s Manual
MCS-8085 Family User’s Manual
The MCS-80/85 Family User’s Manual January 83.pdf

ROM SDK-85 Monitor (8355 ROM)
ROM SDK-85 utilities (second EPROM 8755)