post

KIM-1 Ziptape

Glen Deas sent me an article about the Ziptape cassette interface, 1978, by the late Lew Edwards. Glen made a PCB for it.

The article about the Fast Cassette Interface is part of my CW Moser Assembler/editor package. Scanned by me in 2010 to the file kimfastcassette.pdf and on my website with the CW Moser package for years now .
Glen Deas knew it was designed by Lew Edwards and entered the source in modern assembler format.


Page 1      A65 65C02 Assembler 1.16
Line#  Loc   Code      Line
1                  
2                  ;-----------------------------------------------------------------------------------------------------------
3                  ;      E:\ZIPTAPE>CSC ZIPTAPE1.ASM
4                  ;
5                   ;     E:\ZIPTAPE>CSC6502 ZIPTAPE1.ASM 
6                   ;           Page 1      File ZIPTAPE1.ASM
7                  ;
8                  ;
9                  ;       ORG $4000
10  4000                    * = $4000
11                  ; ***Irk FAST CASSETTE INTERFACE 
12                  ;    (CONFIGURED FOR KIM)
13                  ;================================================================
14                  ;modified for CSC 6502 Cross Assembler Glen Deas K5GED 1/11/2023
15                  ;================================================================
16                  ;To use this software, enter data in memory locations 0123 
17                  ;as follows:  0123 = LOAD/NO
18                  ;                     0124-0125 = START ADDRESS
19                  ;                     0126-0127 = END ADDRESS
20                  ;The record routine will record from START ADDRESS to END ADDRESS 
21                  ;LOAD/NO has no meaning to the record software.;
22                  ;
23                  ;The load routine will load from START ADDRESS to END ADDRESS 
24                  ;store data in memory onl if LOAD/NO does not =al 0. Where 
25                  ;LOAD/NO can be used for verifying and unconditionally selecting 
26                  ;modules on tape.
27                  ;
28                  ;The load and record routines have callable entry points at 
29                  ;(4000) and CREAD (40A5), and non-ccallable entry points at 
30                  ;LDENTRY (4141) and RCENTRY (4152). If CREAD is called, the
31                  ;Z bit in the PSR will be treu on return if no error was detected
32                  ;and false if errors occurred. If execution is at the non callable
33                  ;entry LDENTRY, a break (via BRK instruction) will be execcuted 
34                  ;at end of loading and register A will indicate if the data was
35                  ;loaded correctly: R(A)=00 for good load, and EE for errors.
36                  ;
37                  ;
38  1702            CPORT = $1702 ;CASSETTE I/O
39  1703            CPORTD = $1703 ;PORT DIRECTION REGISTER 
40                  ;BIT 3 = WRITE TO CASSETTE; BIT 2 - READ FROM CASSETTE
41                  ;
42                  ;
43                  ; :== VARIABLES ==
44  00B2            CHECKSUM           =    $00B2 
45  00B6            ADDRS              =    $00B6 
46  00B6            COUNT              =    ADDRS 
47  00B4            FORMBYTE           =    $00B4 
48  00B4            SYNCCOUNT          =    FORMBYTE
49  00B5            BITCOUNT           =    $00B5
50                  ;
51                  ;INPUT PARMS
52  0123            LOADNO = $0123 
53  0124            TSTART = $0124
54  0126            TEND = $0126
55                  ;
56                  ;CWRITE: WRITE TO TAPE FROM (START) TO (END)
57                  ;
58  4000  AD 03 17  CWRITE LDA CPORTD
59  4003  09 08             ORA #%00001000 ;BIT 3 FOR OUTPUT ON PIA 
60  4005  8D 03 17      STA CPORTD
Page 2      A65 65C02 Assembler 1.16
Line#  Loc   Code      Line
61                  ;THE ABOVE INITIALIZES BIT 3 FOR OUTPUT ON PIA
62  4008  A9 20             LDA #$20 ;32 TIMES 
63  400A  85 B6         STA COUNT
64  400C  A9 16     LPRECST LDA #$16    ;SYNC CHAR.
65  400E  20 41 40      JSR WRITEBYTE
66  4011  A9 10         LDA #$10
67  4013  85 B4         STA SYNCCOUNT
68  4015  20 5D 40  LPDELA JSR OUTZERO
69  4018  C6 B4         DEC SYNCCOUNT
70  401A  D0 F9         BNE LPDELA
71                  ;DELAY TIME FOR SYNC
72  401C  C6 B6         DEC COUNT 
73  401E  D0 EC         BNE LPRECST
74  4020  20 84 40      JSR MOVESTAD
75  4023  A9 0F         LDA #$0F ;RECORD START CHAR. 
76  4025  20 41 40      JSR WRITEBYTE
77  4028  A2 00         LDX #$00
78  402A  86 B2         STX CHECKSUM ;CLEAR CHECKSUM LOW BYTE 
79  402C  86 B3         STX CHECKSUM+1 ;AND HIGH BYTE
80                  ;
81  402E  A1 B6     LOOPDATA LDA (ADDRS,X) ;LOAD DATA INDEXED BY X REG 
82  4030  20 41 40      JSR WRITEBYTE
83  4033  20 8F 40      JSR INCCOMP
84  4036  90 F6         BCC LOOPDATA
85  4038  A5 B3         LDA CHECKSUM+1
86  403A  48            PHA  SAVE HI CKSUM
87  403B  A5 B2         LDA CHECKSUM
88  403D  20 41 40      JSR WRITEBYTE WRITE LO CKSUM FIRST 
89  4040  68            PLA  HI CKSUM NEXT
90                  ;THE ABOVE WRITES BOTH CHECKSUM BYTES
91                  ;
92                  ;ROUTINE TO WRITE A BYTE TO TAPE
93                  ;
94  4041  85 B4     WRITEBYTE STA FORMBYTE
95  4043  20 34 41      JSR CKSUMADD UPDATE CHECKSUM COUNTER
96  4046  20 7C 40      JSR OUTONE START BIT 
97  4049  A9 08         LDA #$08 8 BITS
98  404B  85 B5         STA BITCOUNT
99  404D  06 B4     DATALOOP ASL FORMBYTE SHIFT LEFT INTO CARRY 
100  404F  90 05         BCC ZEROBIT
101  4051  20 7C 40  ONEBIT  JSR OUTONE
102  4054  F0 03         BEQ CKENDBY
103  4056  20 5D 40  ZEROBIT JSR OUTZERO
104  4059  C6 B5     CKENDBY DEC BITCOUNT
105  405B  D0 F0         BNE DATALOOP 
106                  ;NOT OUTPUT 1 STOP BIT
107                  ;
108                  ;ROUTINE OUTPUT A ZERO TO TAPE
109                  ;
110  405D  A9 20     OUTZERO LDA #$20 '0' DELAY CONSTANT 
111                  
112                  ;:ROUTINE WRITE TO TAPE
113                  ;
114  405F  48        WRITE PHA  SAVE DELAY CONSTANT
115  4060  AD 02 17      LDA CPORT
116  4063  09 08         ORA #%00001000 ;OUT A" ON BIT 3
117  4065  8D 02 17      STA CPORT 
118  4068  68            PLA 
119  4069  48            PHA 
120  406A  AA            TAX DELAY CONSTANT
Page 3      A65 65C02 Assembler 1.16
Line#  Loc   Code      Line
121  406B  20 78 40      JSR LOOPD 
122  406E  AD 02 17      LDA CPORT
123  4071  29 F7         AND #%11110111 ;OUT A '01 ON BIT 3 
124  4073  8D 02 17      STA CPORT
125  4076  68            PLA
126  4077  AA            TAX   DELAY CONSTANT
127  4078  CA        LOOPD DEX
128  4079  D0 FD         BNE LOOPD
129  407B  60            RTS
130                  ;
131                  ;ROUTINE OUTPUT A ONE TO TAPE
132                  ;
133  407C  A9 50     OUTONE  LDA #$50 '1' DELAY CONSTANT
134  407E  D0 DF         BNE WRITE
135                  ;DELAY FOR '0' TIME FOR READ 
136                  
137  4080  A2 30     READDELAY LDX #$30
138  4082  D0 F4         BNE LOOPD
139                  ;
140                  ;ROUTINE MOVE FROM START TO ADDRS
141                  ;
142  4084  AD 24 01  MOVESTAD LDA TSTART
143  4087  85 B6         STA ADDRS
144  4089  AD 25 01      LDA TSTART+1
145  408C  85 B7         STA ADDRS+1 
146  408E  60            RTS
147                  ;:ROUTINE INCREMENT AND COMPARE
148                  
149  408F  E6 B6     INCCOMP INC ADDRS
150  4091  D0 02         BNE SKIPINC 
151  4093  E6 B7         INC ADDRS+1
152  4095  A5 B7     SKIPINC    LDA ADDRS+1
153  4097  CD 27 01      CMP TEND+1
154  409A  90 08         BCC NOTEND 
155  409C  A5 B6         LDA ADDRS 
156  409E  CD 26 01      CMP TEND
157  40A1  90 01         BCC NOTEND 
158  40A3  38            SEC
159  40A4  60        NOTEND RTS
160                  ;ON RETURN, C=CLEAR: NOTEND: C=SET: END REACHED
161                  ;
162  40A5  A2 00     CREAD LDX #$00
163  40A7  86 B6         STX COUNT
164  40A9  20 EF 40  LOOPLOAD JSR READBYTE
165  40AC  C9 16         CMP #$16 SYNC
166  40AE  D0 04         BNE SKIP1 
167  40B0  E6 B6         INC COUNT
168  40B2  D0 F5         BNE LOOPLOAD
169  40B4  A4 B6     SKIP1 LDY COUNT
170  40B6  C0 0A         CPY #$0A   ;MUST B >= 10 SYNC'S 
171  40B8  90 EB         BCC CREAD
172  40BA  C9 0F         CMP  #$0F RECORD START
173  40BC  D0 E7         BNE  CREAD
174  40BE  A0 00         LDY #$00
175  40C0  84 B2         STY CHECKSUM
176  40C2  84 B3         STY CHECKSUM+1 LAR CHECKSUM LOCATIONS
177  40C4  20 84 40       JSR MOVESTAD START > ADDRS (2)
178                  ;
179                  ;NOW LOAD DATA
180                  
Page 4      A65 65C02 Assembler 1.16
Line#  Loc   Code      Line
181  40C7  20 EF 40  LOOP69 JSR READBYTE
182  40CA  AC 23 01      LDY LOADNO ;CKG IF TO STORE
183  40CD  F0 02         BEQ SKIPSTOR
184  40CF  81 B6         STA (ADDRS,X)
185  40D1  20 8F 40  SKIPSTOR JSR INCCOMP
186  40D4  90 F1         BCC LOOP69
187  40D6  A5 B3         LDA CHECKSUM+1
188  40D8  48            PHA SAVE CHKSUM HI
189  40D9  A5 B2         LDA CHECKSUM
190  40DB  48            PHA SAVE CHKSUM LO
191  40DC  20 EF 40      JSR READBYTE
192  40DF  68            PLA
193  40E0  C5 B4         CMP FORMBYTE CHECK CHECKSUM LO
194  40E2  D0 07         BNE RETURN
195  40E4  20 EF 40      JSR READBYTE
196  40E7  68            PLA
197  40E8  C5 B4         CMP FORMBYTE CHECK CHECKSUM HI
198  40EA  60            RTS
199  40EB  68        RETURN PLA
200  40EC  A9 FF         LDA #$FF CLEAR Z-BIT
201  40EE  60            RTS
202                  ;ON RETURN Z-BIT = TRUE:GOOD LOAD: Z-BIT ==FALSE: ERROR
203                  ;
204                  ;ROUTINE READ A BYTE FROM TAPE
205                  ;
206  40EF  20 2E 41  READBYTE JSR INPORT
207  40F2  D0 FB         BNE READBYTE LOOP UNTIL 0
208  40F4  20 2E 41  WAITFORI JSR INPORT
209  40F7  F0 FB         BEQ WAITFORI LOOP UNTIL 1
210  40F9  20 80 40      JSR READDELAY
211  40FC  20 2E 41      JSR INPORT
212  40FF  F0 F3         BEQ WAITFORI IF ZERO
213  4101  20 2E 41  WAITFORO JSR INPORT
214  4104  D0 FB         BNE WAITFORO WAIT TIL END OF START BIT
215  4106  A9 08         LDA #$08
216  4108  85 B5         STA BITCOUNT
217  410A  20 2E 41  WAITTOCN JSR INPORT
218  410D  F0 FB         BEQ WAITTOCN ;LOOP UNTIL '1'
219  410F  20 80 40      JSR READDELAY
220  4112  20 2E 41      JSR INPORT
221  4115  F0 08         BEQ PROCESSO IF '0' THENZERO, ELSE ONE
222                  ;
223  4117  20 2E 41  PROCESS1 JSR INPORT
224  411A  D0 FB         BNE PROCESS1 ;LOOP UNTIL '0
225  411C  38            SEC
226  411D  B0 01         BCS ROTATEIN
227  411F  18        PROCESSO CLC
228                  ;
229  4120  26 B4     ROTATEIN ROL FORMBYTE ;ROTATE CARRY
230  4122  C6 B5         DEC BITCOUNT 
231  4124  D0 E4         BNE WAITTOCN 
232  4126  A5 B4         LDA FORMBYTE
233  4128  20 34 41      JSR CKSUMADD UPDATE CHECKSUM
234  412B  A5 B4         LDA FORMBYTE 
235  412D  60            RTS
236                  ;
237                  ;
238                  ;INPUT FROM TAPE
239                  ;
240  412E  AD 02 17  INPORT LDA CPORT
Page 5      A65 65C02 Assembler 1.16
Line#  Loc   Code      Line
241  4131  29 04         AND #%00000100 ;MASK OUT ALL BUT BIT 2 
242  4133  60            RTS
243                  ;
244                  ;
245                  ;UPDATE CHEKSUM COUNTERS
246                  ;
247  4134  18        CKSUMADD CLC
248  4135  D8            CLD
249  4136  65 B2         ADC CHECKSUM+$00 AD R(A) TO CKSUM LO
250  4138  85 B2         STA CHECKSUM+$00
251  413A  A9 00         LDA #$00
252  413C  65 B3         ADC CHECKSUM+1 ADD 00 TO CKSUM HI 
253  413E  85 B3         STA CHECKSUM+1
254  4140  60            RTS
255                  ;
256                  ;
257  4141  20 A5 40  LOADENTRY JSR CREAD
258  4144  D0 08         BNE BAD
259  4146  A9 00         LDA #$00 INDICATE GOOD LOAD BY R(A) =
260  4148  00        B BRK 
261  4149  EA            NOP 
262  414A  EA            NOP
263  414B  4C 41 41      JMP LOADENTRY
264  414E  A9 EE     BAD LDA #$EE  ;INICATE BAD LOAD BY RA)=EE
265  4150  D0 F6         BNE B
266                  ;
267  4152  20 00 40  RECORDENT JSR CWRITE
268  4155  00           BRK
269  4156  EA           NOP 
270  4157  EA           NOP
271  4158  4C 52 41    JMP RECORDENT
272                  
273                  ;END OF PROGRAM
274                  
275  415B             .END
Page 6      A65 65C02 Assembler 1.16
Symbol            Value Line  References
ADDRS             00B6  45    (9) 46 81 143 145 149 151 152 155 184 
BAD               414E  264   (1) 258 
BITCOUNT          00B5  49    (4) 98 104 216 230 
B                 4148  260   (1) 265 
CHECKSUM          00B2  44    (12) 78 79 85 87 175 176 187 189 249 250 252 253 
CKENDBY           4059  104   (1) 102 
CKSUMADD          4134  247   (2) 95 233 
COUNT             00B6  46    (5) 63 72 163 167 169 
CPORT             1702  38    (5) 115 117 122 124 240 
CPORTD            1703  39    (2) 58 60 
CREAD             40A5  162   (3) 257 171 173 
CWRITE            4000  58    (1) 267 
DATALOOP          404D  99    (1) 105 
FORMBYTE          00B4  47    (8) 48 94 99 193 197 229 232 234 
INCCOMP           408F  149   (2) 83 185 
INPORT            412E  240   (7) 206 208 211 213 217 220 223 
LOADENTRY         4141  257   (1) 263 
LOADNO            0123  52    (1) 182 
LOOP69            40C7  181   (1) 186 
LOOPDATA          402E  81    (1) 84 
LOOPD             4078  127   (3) 121 128 138 
LOOPLOAD          40A9  164   (1) 168 
LPDELA            4015  68    (1) 70 
LPRECST           400C  64    (1) 73 
MOVESTAD          4084  142   (2) 74 177 
NOTEND            40A4  159   (2) 154 157 
ONEBIT            4051  101   (0) 
OUTONE            407C  133   (2) 96 101 
OUTZERO           405D  110   (2) 68 103 
PROCESS1          4117  223   (1) 224 
PROCESSO          411F  227   (1) 221 
READBYTE          40EF  206   (5) 164 181 191 195 207 
READDELAY         4080  137   (2) 210 219 
RECORDENT         4152  267   (1) 271 
RETURN            40EB  199   (1) 194 
ROTATEIN          4120  229   (1) 226 
SKIP1             40B4  169   (1) 166 
SKIPINC           4095  152   (1) 150 
SKIPSTOR          40D1  185   (1) 183 
SYNCCOUNT         00B4  48    (2) 67 69 
TEND              0126  54    (2) 153 156 
TSTART            0124  53    (2) 142 144 
WAITFORI          40F4  208   (2) 209 212 
WAITFORO          4101  213   (1) 214 
WAITTOCN          410A  217   (2) 218 231 
WRITEBYTE         4041  94    (4) 65 76 82 88 
WRITE             405F  114   (1) 134 
ZEROBIT           4056  103   (1) 100 
Errors   = 0
Warnings = 0
;184000AD031709088D0317A92085B6A916204140A91085B4205D4007EA
;184018C6B4D0F9C6B6D0EC208440A90F204140A20086B286B3A1B60D92
;184030204140208F4090F6A5B348A5B22041406885B4203441207C0A08
;18404840A90885B506B49005207C40F003205D40C6B5D0F0A920480AF2
;184060AD021709088D02176848AA207840AD021729F78D021768AA0805
;184078CAD0FD60A950D0DFA230D0F4AD240185B6AD250185B760E60E67
;184090B6D002E6B7A5B7CD27019008A5B6CD260190013860A200860B96
;1840A8B620EF40C916D004E6B6D0F5A4B6C00A90EBC90FD0E7A0000EE7
;1840C084B284B320844020EF40AC2301F00281B6208F4090F1A5B30C79
;1840D848A5B24820EF4068C5B4D00720EF4068C5B46068A9FF60200D3E
;1840F02E41D0FB202E41F0FB208040202E41F0F3202E41D0FBA9080C59
;18410885B5202E41F0FB208040202E41F008202E41D0FB38B0011809D7
;18412026B4C6B5D0E4A5B4203441A5B460AD021729046018D865B20B83
;18413885B2A90065B385B36020A540D008A90000EAEA4C4141A9EE0BE0
;0B4150D0F620004000EAEA4C52410575
;00000F000F
post

John Bell Apple 16 bit A/D

post

John Bell Apple 6522 card



post

John Bell PN 82-300

PN 82-300
6502 CPU, 6532 RIOT, 2716 or 2532 EPROM
One of the smallest 6502 based computers possible with the technology of the 1980ties!


(circuit drawn by Mike K8LH)

Circuit Diagrams with thanks to Dallas Shell

post

John Bell PN 81-260

PN 81-260
A larger 6502 SBC, 2 VIA 6522, 2K RAM, RK ROM












John Bell PN 80-153

PN 80-153
Five IC’s on a SBC: 6502, 6522 VIA,  2716 EPROM, 2x 2114 SRAM, 74LS10 decoder








PCB images by Glen Deas, thanks!

(Clock modification with crystal,  Don Sawyer)

This is a revision, connecting phi2 to pin 11 of the ‘LS10, “to improve memory response”, so the wire is soldered!

My retro toolchain

Development for my old 8 bit retro SBC’s has become much easier with fast PCs and good tools. All cross development.

What took hours on my KIM-1: load editor form tape -edit source – save on tape (multiple tape files if big) – assemble form tape to tape – load binary from tape – run
can now be done very fast.
Powerful text editors, cross assembler, KIM-1 Simulator, seconds per iteration.

The only slow part remains: me!

More on my favorite toolchain here.

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
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).

Convert 8 bit hex formats

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.

KIM-1 simulator

6502/65C02 CPU emulation, disassembler, TTY, KIM-1 keypad and LEDs.

See the KIM-1 Simulator page for more information.

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.

C:\MICROKIM\kimpaper
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>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 ED’s Utility KIMTape
These text files can be converted to DOS text files with this utility.

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.

KIM Tape Convert WAV to BIN and BIN to WAV

Not my program, but so handy!

KIMTAPE v0.5 – tape conversion utility for KIM-1 and SYM-1 (2004-05-17) Local copy of http://dxforth.mirrors.minimaltype.com/#kimtape)

KIMTAPE allows programs stored on cassette tape to be decoded to a program file. It handles both MOS Technology KIM-1 and Synertek SYM-1 tape formats including HYPERTAPE. The reverse process – converting a program file to an audio wavefile is also possible, allowing one to produce perfectly regenerated cassettes. KIMTAPE works with 8-bit mono WAV, VOC or RAW audio files recorded
at 22050 samples per second.

Download: kimtap05.zip (MS-DOS) It is MS-DOS and runs fine in VDOS (https://www.vdos.info/) or DOSbox (slow).

The binary files in the KIM-1 program archives have been reproduced, from the original cassette recordings, with the tool KIMTAPE on a PC in a DOS box. See Eds DX-Forth and Utilities Page for this and other nice programs.
This program also makes it possible to reproduce the original cassette recordings that can be read by a KIM-1.

The files were made as follows: The KIM-1 cassette audio was connected to the PC audio input and (with e.g. Audacity) recorded as a wave file (mono 22KHz).
For example: qchess.wav
The wave file was then converted with KIMTAPE to a binary file (the exact content of of the KIM-1 memory when recorded).
And the KIMTAPE utility then displays load address (for example and tape ID

c:\kimtape qchess.wav qchess.bin
KIMTAPE version 0.5 17-May-04
infile: qchess.wav
outfile: qchess.BIN
Program 01 address 0200 checksum OK xxxx bytes done

This .bin file (any extension is fine!) is NOT a wave file! It contains the exact content of the KIM-1 memory when recorded. The size is exactly the number of bytes as stored in the memory of the KIM-1 and much smaller than the wave file. This binary file can be converted back to a wave file with KIMTAPE or converted to a papertape file with KIMPAPER:

C:\kimtape -M -A0200 -D01 -B2 qchess.bin qchess.wav 

As you can see: you have to specify the load address and the program ID. The B parameter indicates hypertape speed (2 here, slow)
The resulting wav file should be acceptable for the KIM-1. It is (as I have tested) acceptable as input for KIMTAPE!

All command parameters can be seen by typing KIMTAPE without parameters:

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.

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