post

Me and my KIM-1

My first computer is a KIM-1. Still have it! A life changing experience!

This is the story of me and the KIM-1.

Philips educational kits.

As a young child, at age 12, I was introduced to electronics with the Philips electronic kits. First a Pionier crystal radio. Easy to build, good instruction manual. Lots of listening pleasure!.

Two years later I bought the Philips EE8 Electronic Engineer kit. Again nice builds (the 8 stands for 8 experiments), with a good manual. Since the manual covered the expansion to the EE20 for 20 experiments, I bought the parts myself one by one at Aurora Vijzelgracht, Amsterdam.
More on the Philips electronic kits.

Radio Bulletin

In 1978 I bought my first computer, a KIM-1. It turned out to be a Rockwell rebadged Rev F Mos Technology board.

The beginning of lots of fun, learning, member of the KIM gg Club and making and publishing in the dutch electronics magazine Radio Bulletin and the KIM Kenner.

In 2014 the big KIM-1 machine was finally taken down in parts, the following photos showed the end result as in 1985 after many years of tinkering.

The KIM-1 system ended as a real production system until 1985, mainly to write articles, all Radio Bulletin and KIM Club Magazine related work was done with this system.

My KIM-1 workplace in 1979, no video terminal, no printer, hand assembly

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

1984, VT100 as videoterminal, what a progress!

Then a CP/M machine took over (a Spectravideo X’Press 738) with the same VT100 as terminal.

  • KIM-1
  • 8K RAM  in system case
  • 32K RAM in expansion case
  • Two ACIA 6850 serial
  • A PIA/VIA card with two 6820 PIA’s
  • Parallel ASCII keyboard with home made logic circuit
  • Video Display 32×32 uppercase characters on an analog TV
  • Dual cassette tape system with motor control
  • MDCR digtal cassette system in second expansion case
  • Radio Grafisch Display in second expansion case
  • Heathkit H14 matrix pinter, serial with RTS handshake via bitbanging RIOT port
  • VT100 Digital Equipment Video display unit VT100
  • Boot tape to load device drivers and Micro Ade (extended to 8K)
  • MICRO ADE assembler/editor, used for program development and article authoring
  • Microsoft Basic KB9 (not used often, nice study material!)
  • Pascal-M compiler and interpreter (mainly development and experiments, not for production)

First the KIM-1, I still have it, in working condition, in my private museum. Changes still visible, are a red acryl cover over the LED displays, a capacitor moved to the back to make it flat enough to fit the case I made and some supports to have it lay stable and safe on a table.

Why a KIM-1?

In 1977 I was reading in the electronics magazines about the revolution taking place: 8 bit microprocessors!
During my study I encountered Digital Equipment machines, PDP-8 in the lab, PDP-11 in the Mathematic Computer Science department, a Minc in Medical Physics group, my major.
The electronics department where I was doing an intern not only introduced to digital electronics and I helped them to introduce the Z80 to the instruments designed for laboratory experiments.
I learned assembler quickly, PDP-11 was a dream come true, the Z80 a bit of a nightmare but you could do so much with effort.

At the same time I started to write for the magazine Radio Bulletin, simple analog and digital circuits and continued to be an editor until 1987. I met Dick de Boer who was writing his famous Microprocessor articles and introduced the KIM-1 to the Dutch electronic engineers. So a KIM-1 with the very attractive 6502 was the logical choice for my first microprocessor system.

First case: memory, connectors, power supply

A KIM-1 itself was fun to learn with, but it quickly needed more; a permanent power supply, protection, easy to access connectors and interfaces for  a bus to have  more memory.
So the case seen in the next figure was built:

Power hungry, so lots of lineair power supplies with large cooling.

The first case I built from alu profiles contained the KIM-1, a backplane for 6 memory boards, a lot of power supplies (lineair, so heat was a problem!), a patch panel to access the expansion connector, cassette I/O, serial interface and various switches.

PCBs handmade, double sided!


Memory 2K RAM Card, BEM Bus Brutech Variant made by Hans Otten
Memory boards were made myself by drawing with Edding ink on the blank PCB, etching and drilling. Filled with 2102 RAM IC’s for 1K per board, it filled lower RAM of the KIM-1 $0400 – $13FF. The bus is a 31 pin DIN connector, based upon the BEM (Brutech) bus.

I bought two of this deck from Radio Service Twenthe, Den Haag, fascinating electroncis dump store!

The next thing I built was a video display unit. All TTL 74XX logic IC’s, a 2513 character generator, a AY-5-1013 character generator, an ASCII keyboard, display on TV 32×32 characters uppercase. RS232 input/output to the KIM-1.
On top of the VDU a dual cassette deck is shown. From the famous Dutch dump shop Radio Service Twente two audio cassette decks were bought, some audio amplifiers and power supply added, and a remote control circuit via a 6532 GPIO line (standard as in Micro Ade). Served me well for many years, in 2014 the decks strings were dried out and crumbled after many years of not being used.

Next was a real expansion cabinet with a long backplane for 32K memory with 8x 4K RAM card, 2114 based, Designed by me, published in Radio Bulletin and sold by Visser Assembling Electronics. BEM bus compatible.

4K SRAM card

4K SRAM card, Radio Bulletin September 1979 part 1  part 2


Production 4K RAM card


Prototype 4K RAM card, also hand drawn on the PCB!

In the expansion cabinet three slots were added for I/O. Two cards were designed by me and published in Radio Bulletin: an ACIA card for two 6850 Motorola ICs, and a PIA card for two PIAs, 6522 or 6520 or 6820 or 6821. I never used more than one ACIA and one PIA card. Shown are the prototype cards, in the article production quality PCBs were used.

PIA and VIA card design by Hans Otten June 1984 Radio Bulletin

ACIA Motorola 6850 by Hans Otten, 1983 Radio Bulletin

On one of the ACIAs a VT100 Digital Equipment terminal was connected, taking over from the bit banged serial interface and the homebuilt video display. ON the other ACIA a Heathkit H14 matrix printer was added, a mediocre but adequate printer.

Together with Micro Ade as assembler and editor, the dual cassette deck, 40K RAM In total, this was a nice machine! Until 1987, when I bought the Spectravideo X’Press 738 MSX and CP/M system, used for all my publishing activities.

A third expansion cabinet was built around 1983. It was driven by the PIA’s, the Radio Bulletin Grafisch Display was inside the cabinet, along with two MDCR Philips Digital cassette recorders, alo published in Radio Bulletin. The speed difference between Hypertape audio cassettes and 2400 baud MDCR speed was not that impressive.

Dirk Dral

EPROM card (Dirk Dral)

Tape copy

KIM Kenner 18 1981 Hans Otten, Translated by Hans Otten 2021

A program to duplicate a KIM-1 cassette tape with multiple files on it. Command driven. Requires enough memory above $2000 to hold the largest file on tape (32K for example)
Version 1.1 added the Check tape command.

Binary V1.1 can be downloaded here.

Requires two cassette recorders controlled via the Remote control, see below for the Micro Ade description of control via KIM PIA PB2 and PB3.

Source in Micro Ade format, also downloadable here.

************************************
TAPE COPYING PROGRAM
;
HJC OTTEN JULY 1981 V1.0
JULY 1982 V1.1
;
BASED ON SUPERDUPE FROM THE FIRST BOOK OF KIM
AND THE MICRO ADE CASSETTE ROUTINES
;
COPY WILL REPRODUCE A TAPE COMPLETELY AUTOMATIC
WHEN READ AND WRITE RECORDERS ARE CONNECTED
WITH THE MOTOR CONTROLS OF MICRO ADE
;
DURING READ OPERATIONS IT IS POSSIBLE TO STOP THE
COPYING BY MAKING PA7 OF PIA 1700 HIGH
REMOVE THIS BIT TESTS IF NOT AVAILABLE
AT O249, 02D6 AND 02E9
OR CHANGE FOR KIM TTY BREAK THE PIA LOCATION TO 1740
AND THE BRANCH FOLLOWING TO BMI
;
INSERT REWINDED READ AND WRITE CASSETTES
AND START AT 0200
;
FIRST THE WRITE CASSETTE IS RUN PAST THE LEADER
THEN A FILE IS READ , IF FOUND THE ID AND STARTADDRESS
ARE DISPLAYED . NEXT THE FILE IS WRITTEN.
IF READY THE DISPLAY LINE LOOKS LIKE
ID= 01 START= $3600 COPY !
THE DATA FROM THE FILE IS STORED IN A BUFFER AT $2000
WHERE ENOUGH RAM MUST BE AVAILABLE
;
THIS PROGRAM CAN EASILY BE MODIFIED TO
A CHECKING AND DIRECTORY OF ALL FILES ON A TAPE
BY REPLACING THE JUMP
02D0 4C 2A 02 JMP CREAD
THAT SKIPS THE WRITING OF A FILE
;
*******************************************************
;
COPY ORG $2000 ;
;
DEFINES :
;
BUFFER * $2300 ;
SYNC * $16 ; SYNCHRONISATION CHARACTER
EOD * $2F ; END OF DATA
EOF * $04 ; END OF FILE
SOD * $2A ; START OF DATA
FF * $0C ; FORM FEED
;
; ZERO PAGE USE
HELPL * $00DD ;
HELPH * $00DE ;
CHKCOP * $00DF ; CHECK OR COPY FLAG
;
RPTRL * $00E0 ; READ POINTER IN BUFFER
RPTRH * $00E1 ;
WPTRL * $00E2 ; WRITE POINTER IN BUFFER
WPTRH * $00E3 ;
STRPTL * $00ED ; POINTER IN PRINT STRING
STRPTH * $00EE ;
CC * $00F1 ; COUNT FIELDS IN WRITE
COUNT * $00F2 ;
CHKSUM * $00F6 ; CHECKSUM
CHKHI * $00F7 ;
GANG * $00F5 ; USED BY WRITE
ID * $00F9 ; ID OF FILE
STADRL * $00FA ; STARTADDRESS OF FILE
STADRH * $00FB ;
STARTA * $00FC ; CONSTANT FOR INDEXED WRITE
TRIB * $00FE ; USED BY WRITE
;
; PIA LOCATIES
;
PAD * $1700 ; BREAKKEY IN BIT 7
PBD * $1702 ; PB2 = READ, PB3 = WRITE MOTOR CONTROL
PBDD * $1703 ;
KPAD * $1740 ; LEDDISPLAY
KPADD * $1741 ;
KPBD * $1742 ; CASSETTE I/O
KPBDD * $1743 ;
TIMERT * $1744 ; TIMER
TIMER * $1747 ;
;
; KIM MONITOR ROUTINES
;
RDBIT * $1A41 ; READ BIT FROM TAPE
RDBTK * $19F3 ; READ BYTE FROM TAPE
RDCHTK * $1A24 ; READ CHARACTER FROM TAPE (2 BYTE)
PACKT * $1A00 ; PACK ASCII TO HEX
CHK * $1F91 ; COMPUTE CHECKSUM IN F6,F7
CHKT * $194C ; COMPUTE CHECKSUM IN 17E7,E8
INIT * $1E8C ; INIT KIM PIA'S
SPACE * $1E9E ; PRINT SPACE ON TTY
OUTCH * $1EA0 ; PRINT ACCU ON TTY
PRTBYT * $1E3B ; PRINT ACCU AS TWO HEX CHARACTERS ON TTY
CRLF * $1E2F ; PRINT CR + LF ON TTY
MNITOR * $1C00 ; KIM MONITOR ENTRY POINT
;
*******************************************************
;
MAIN FLOW OF PROGRAM :
;
PROGRAM COPY
;
INITCOPY
REPEAT
READ FILE TO BUFFER
WRITE BUFFER TO FILE
UNTIL FOREVER
;
END
;
*******************************************************
;
PROCEDURES :
;
START CLD ; PROCEDURE INITCOPY
LDAIM $0C ; INIT CASSETTE MOTOR CONTROL
STA PBDD ;
LDAIM $FF ;
STA PBD ;
LDAIM FF ; CLEARSCREEN
JSR OUTCH ;
LDXIM $FF ;
NEX DEX ;
BNE NEX ;
LDXIM HELLOM ; PRINTSTRING ('TAPE COPY')
LDYIM HELLOM /
JSR PRTSTR ;
LDXIM ANDMSG ;
LDYIM ANDMSG /
JSR PRTSTR ;
LDXIM CHKMSG ;
LDYIM CHKMSG /
JSR PRTSTR ;
LDXIM VRSMSG ;
LDYIM VRSMSG /
JSR PRTSTR ;
JSR CRLF ;
JSR CRLF ;
LDXIM CHKMSG ; PRINT ('CHECK OR COPY)
LDYIM CHKMSG /
JSR PRTSTR ;
LDXIM ONLMSG ;
LDYIM ONLMSG /
JSR PRTSTR ;
LDAIM $00 ; CHKCOP FLAG = COPY
STA CHKCOP ;
JSR GETCH ; WAIT FOR ANSWER
PHA ;
JSR OUTCH ; ECHO CHARACTER
JSR CRLF ;
PLA ;
CMPIM 'Y ;
BNE NOCHK ; IF CHAR <> Y THEN COPY
LDAIM $FF ;
STA CHKCOP ;
LDXIM CHKMSG ; PRINT CHECK
LDYIM CHKMSG /
JSR PRTSTR ;
JMP CREAD ;
NOCHK LDXIM COPYMS ;
LDYIM COPYMS /
JSR PRTSTR ; PRINT COPY
LDAIM $F7 ; TURN WRITE CASSETTE MOTOR ON
STA PBD ;
LDXIM $10 ; DELAY (LEADERCASSETTE)
JSR DELAY ;
LDAIM $FF ; TURN WRITE CASSETTE MOTOR OFF
STA PBD ; END INITCOPY
CREAD LDAIM BUFFER / PROCEDURE READ FILE TO BUFFER
STA RPTRH ; READPTR := BUFFERSTART
STA WPTRH ; WRITEPTR := BUFFERSTART
LDAIM $00 ; CHECKSUM := 0
STA CHKSUM ;
STA CHKHI ;
LDAIM BUFFER ;
STA RPTRL ;
STA WPTRL ;
LDAIM $FB ; TURN READ CASSETTEMOTOR ON
STA PBD ;
LDAIM $13 ; INIT CASSETTE I/O
STA KPBD ;
LDAIM $7F ; INIT LEDDISPLAY
STA KPADD ;
SYN BIT PAD ; REPEAT
BPL GOON ; WHILE NOT BYTE = SYNC DO
JMP MONRET ; READ(BYTE)
GOON JSR RDBIT ; IF BREAK EXIT TO MONITOR
LSR ID ; ENDWHILE
ORA ID ; READ(BYTE)
STA ID ; UNTIL BYTE = START OF DATA
STA KPAD ;
TST CMPIM $16 ;
BNE SYN ;
JSR RDCHT ;
STA KPAD ;
CMPIM $2A ;
BNE TST ;
JSR RDBYT ;
STA ID ; ID := READ(BYTE)
LDXIM $FE ; STARTADDRESS := READ(ADDRESS)
ADDR JSR RDBYT ;
STAZX STARTA ;
JSR CHK ;
INX ;
BMI ADDR ;
;
BYTE LDXIM $02 ; WHILE NOT BYTE = END OF DATA DO
DUBL JSR RDCHT ; BUFFER(RPOINTER) := READ(CHARACTER)
CMPIM EOD ; CHECKSUM := CHECKSUM + CHARACTER
BEQ WIND ; RPOINTER := RPOINTER + 1
JSR PACKT ; ENDWHILE
BNE ELNK ;
DEX ;
BNE DUBL ;
STAIX RPTRL ;
JSR CHK ;
INC RPTRL ;
BNE OVER ;
INC RPTRH ;
OVER BNE BYTE ;
WIND JSR RDBYT ; RCHECKSUM := READ(CHECKSUM)
CMP CHKHI ;
BNE ELNK ;
JSR RDBYT ;
CMP CHKSUM ;
PHP ;
LDAIM $FF ; TURN READ CASSETTE MOTOR OFF
STA PBD ;
PLP ; IF RCHECKSUM <> CHECKSUM GREAD FILE TO BUFFER
BNE ELNK ;
JSR CRLF ; PRINTSTRING ('ID=')
LDXIM IDMES ; PRINT (ID)
LDYIM IDMES /
JSR PRTSTR ;
LDA ID ;
JSR PRTBYT ;
LDXIM STMES ; PRINTSTRING (' START=')
LDYIM STMES /
JSR PRTSTR ; PRINT (STARTADDRESS)
LDA STADRH ;
JSR PRTBYT ;
LDA STADRL ;
JSR PRTBYT ;
LDXIM ENMSG ; PRINT ('END = ')
LDYIM ENMSG /
JSR PRTSTR ;
SEC ;
LDA RPTRL ; HELP := READPOINTER - BEGINBUFFER
SBCIM BUFFER ;
STA HELPL ;
LDA RPTRH ;
SBCIM BUFFER /
STA HELPH ;
CLC ; HELP := HELP + STARTADDRESS
LDA HELPL ;
ADC STADRL ;
STA HELPL ;
LDA HELPH ;
ADC STADRH ;
JSR PRTBYT ;
LDA HELPL ;
JSR PRTBYT ;
LDA CHKCOP ;
BNE ELNK ; IF CHECKCOPY FLAG <> THEN CHECK ONLY
JMP CWRITE ;
ELNK JMP CREAD ; END READ FILE TO BUFFER
;
; SUBROUTINE READBYTE
;
RDBYT BIT PAD ; PROCEDURE READ(BYTE)
BMI MONRET ; IF BREAKKEY THEN EXIT TO MONITOR
;
JMP RDBTK ; ENDIF
MONRET LDAIM $FF ; READ BYTE FROM CASSETTE
STA PBD ; END READ BYTE
JSR INIT ;
JMP MNITOR ;
RDCHT BIT PAD ; PROCEDURE READ(CHARACTER)
BMI MONRET ; IF BREAKKEY THEN EXIT TO MONITOR
JMP RDCHTK ; READ CHARACTER FROM TAPE
CWRITE LDAIM $F7 ; PROCEDURE WRITE BUFFER TO FILE
STA PBD ; TURN WRITE CASSETTE MOTOR ON
LDXIM $08 ;
JSR DELAY ; DELAY (FILEGAP)
LDAIM $27 ; INIT WRITE CASSETTE I/O
STA GANG ;
LDAIM $BF ;
STA KPBDD ;
LDXIM $FF ; COUNT := 255
LDAIM SYNC ; WHILE COUNT > 0 DO
JSR NWRITE ; WRITE(SYNCHRONIZATION CHARACTER)
LDAIM SOD ; COUNT := COUNT - 1
JSR OUTCHT ; ENDWHILE
LDA ID ; WRITE (START OF DATA )
JSR OUTBT ; WRITE (ID)
LDA STADRL ; WRITE (STARTADDRESS)
JSR OUTBT ;
LDA STADRH ;
JSR OUTBT ;
DATA LDYIM $00 ; WHILE WPOINTER < RPOINTER DO
LDAIY WPTRL ; WRITE (BUFFER(WPOINTER)0)
JSR OUTBT ; WPOINTER := WPOINTER + 1
INC WPTRL ; ENDWHILE
BNE SAMP ;
INC WPTRH ;
SAMP LDA WPTRL ;
CMP RPTRL ;
LDA WPTRH ;
SBC RPTRH ;
BCC DATA ;
LDAIM EOD ; WRITE (END OF DATA )
JSR OUTCHT ;
LDA CHKHI ; WRITE (CHECKSUM)
JSR OUTBT ;
LDA CHKSUM ;
JSR OUTBT ;
LDXIM $02 ;
LDAIM $04 ; WRITE (END OF FILE)
JSR NWRITE ;
LDAIM $FF ; TURN WRITE CASSETTE MOTOR OFF
STA PBD ;
JSR INIT ;
LDXIM COPYMS ; PRINT ('COPY !')
LDYIM COPYMS /
JSR PRTSTR ;
LDAIM '! ;
JSR OUTCH ;
JMP CREAD ; END WRITE BUFFER TO FILE
;
; SUBROUTINE NWRITE
;
NWRITE STX CC ; PROCEDURE NWRITE (N,CHARACTER)
HICA PHA ; WHILE N > 0 DO
JSR OUTCHT ; WRITE (CHARACTER)
PLA ; N := N - 1
DEC CC ; ENDWHILE
BNE HICA ; END NWRITE
RTS ;
;
; SUBROUTINE OUTBTC
;
OUTBTC JSR CHKT ; PROCEDURE WRITE(BYTE) AS TWO ASCII
OUTBT PHA ;
LSRA ; CHECKSUM := CHECKSUM + BYTE
LSRA ; CONVERT LEFT NIBBLE OF BYTE TO ASCII
LSRA ; WRITE(ASCII)
LSRA ; CONVERT RIGHT NIBBLE OF BYTE TO ASCII
JSR HEXT ; WRITE(ASCII)
PLA ; END WRITE BYTE
HEXT ANDIM $0F ;
CMPIM $0A ;
CLC ;
BMI HEXAT ;
ADCIM $07 ;
HEXAT ADCIM $30 ;
OUTCHT LDYIM $08 ; PROCEDURE WRITE (BYTE)
STY COUNT ; COUNT :=8
TRY LDYIM $02 ; WHILE COUNT > 0 DO
STY TRIB ; SEND 3 PULSES 3700 HZ
ZON LDXAY NPUL ; IF MSB BYTE = 1 THEN
PHA ; SEND 3 PULSES 3700 HZ
ZONA BIT TIMER ; ELSE
BPL ZONA ; SEND 2 PULSES 2400 HZ
LDAAY TIMG ;
STA TIMERT ; ENDIF
LDA GANG ; SEND 2 PULSES 2400 HZ
EORIM $80 ; SHIFT BYTE LEFT
STA KPBD ; ENDWHILE
STA GANG ; END WRITE BYTE
DEX ;
BNE ZONA ;
PLA ;
DEC TRIB ;
BEQ SETZ ;
BMI ROUT ;
LSRA ;
BCC ZON ;
SETZ LDYIM $00 ;
BEQ ZON ;
ROUT DEC COUNT ;
BNE TRY ;
RTS ;
;
; TIMING TABLE
;
NPUL = $02 ; NUMBER OF 2400 HZ PULSES
TIMG = $C3 ; TIMER COUNT
= $03 ; NUMBER OF 3700 PULSES
= $7E ; TIMER COUNT
;
; DELAY ROUTINE
;
DELAY LDYIM $FF ; PROCEDURE DELAY (NR)
YLOOP LDAIM $FF ; DELAY TIME * NR
ALOOP SEC ; END DELAY
SBCIM $01 ;
BNE ALOOP ;
DEY ;
BNE YLOOP ;
DEX ;
BNE DELAY ;
RTS ;
;
; SUBROUTINE PRINT STRING
;
PRTSTR STX STRPTL ; PROCEDURE PRINTSTRING(STRINGPTR)
STY STRPTH ;
PNEXT LDYIM $00 ; WHILE NOT END OF STRING DO
LDAIY STRPTL ; PRINT (MEMORY(STRINGPTR)
PHA ; STRINGPTR := STRINGPTR + 1
JSR OUTCH ; ENDWHILE
PLA ;
BMI LAST ;
INC STRPTL ;
BNE NEXTS ;
INC STRPTH ;
NEXTS JMP PNEXT ;
LAST RTS ;
;
; SUBROUTINE GET CHARACTER
;
GETCH BIT PAD ; PROCEDURE GETCHARACTER ( CHAR )
BPL GETCH ; WAIT FOR STROBE
GWAIT BIT PAD ; WAIT FOR END OF STROBE 
BMI GWAIT ;
LDA PAD ; GET CHARACTER
RTS ; END GETCHARACTER
;
; STRING DATA
;
IDMES = 'I
= 'D
= '=
= $A0
;
STMES = '
= 'S
= 'T
= '=
= $A0
;
ENMSG = '
= 'E
= 'N
= '=
= $A0
;
HELLOM = 'T
= 'A
= 'P
= 'E
COPYMS = '
= 'C
= 'O
= 'P
= 'Y
= $A0
;
;
CHKMSG = 'C
= 'H
= 'E
= 'C
= 'K
= $A0
ONLMSG = 'O
= 'N
= 'L
= 'Y
= '
= '?
= $A0
VRSMSG = 'V
= '1
= '.
= '1
= $A0
;
ANDMSG = 'A
= 'N
= 'D ;
= $A0



KIM-1 printer output RS232 H14

Original articles KIM Kenner 13 1980, 6502 Kenner 19 1981: Hans Otten PGJ de Beer Trasnlated Hans Otten 2021

In two articles a routine to send a character via serial to a printer (or any serial device) and interface this routine to Micro Ade.
The second version allows for handshake signal CTS.
Baudrate may vary from 300 to 9600 baud. Only one or two (handshake) PIA bits are nevcessary, the serial signal is composed with bit banging.
A simple hardware connection to RS232 in two variants: RS232C signal level compliant or a very simple resistor (sufficient for short distances and most printers).

Source in Micro Ade format.

First source with choice of baudrate, second fixed baudrate 4800 baud and CTS handshake.

Also a routine to read a character form a parallel keyboard connected to PIA A with strobe bit in bit 7.



Make MS Basic KB9 faster: the ROR bug

KIM Kenner 19 Patches op Basic Hans Otten, translated by Hans Otten, 20211

May 1981 Byte Magzine had an article in System Notes, Faster Basic for Ohio Scientific.
The article described how the first batch of the 6502 had a faulty ROR instruction, so the programmers of Microsoft Basic had to work around this missing instruction with a slower replacement, (Note 2021: this is well explained in the Pagetable MS Basic articles) and how to patch this to really use the ROR instruction and speed up things.

A letter to the editor in a later Byte (September 1981?) showed the patches required for the KB9 KIM-1 version.

Location $37DE to $3801 and $38D2 to $3903 are now unused.

This patch may speed up KB9 quite a bit for number crunching.

 

Cassette read and write indicator

KIM Kenner 10 March 1980, Dutch article by Hans Otten, English translation Hans Otten, 2021

Having an indication of how the reading and writing to the cassette recorder is going is nice. With the Micro Ade routines the LED display is used for this. the standard KIM-1 routines are mute.
This small hardware circuit gives either a visual or audible indication with the standard KIM-1 routines.

How does it work?
An indication for for the read process is the output signal of the PLL circuit, a stream of digital pulsed delivered at PB7 of the RRIOT 6530-002. During the reading pin PB7 is rpogrammed as input, during the wirte it is an output. Via a buffer the output signal signal is brought to Audio-Out and Audio-Out-High.
The use of PB7 as input and output during the read and write process means that during a read the decoded signal appears on Audio Out, and as it is meant to be, during writing also has the output signal. Collision is prevented by blocking the input signal during writing. So this means that during reading and during write the signal is present on Audio-Out. This enables a indication of both read and write processes.


The circuit

The signal on Audio-Out (application connector A-M) is brought to a transistor (general purpose type) and the alternating signal makes the LED blink quite fast. A miniature loudspeaker can be switched in and the signal can be heard, it is in the hearable audio range. The LED is not very informative, the loudspeaker is, but also can be annoying, so the switch is welcome.

Do not use a lower value than 33 ohm for R2, it will damage the transistor. The circuit does not represent a heavy load, so you can use the KIM-1 power supply.

Construction
A piece of stripboard is sufficient. See the figure below for the connections of transistor and LED. Red, green, yellow can all be used.
Other usage
By programming the output PB7 music or signals can be heard.

Reading tapes from other KIM-1

KIM kenner 6 1978 Hans Otten Dutch, translation to English Hans Otten 2021

Reading tapes recorded on another KIM-1 or bought like Tiny basic, Microsoft KB-9, Miccrochess and Micro Ade was not that easy. Many many errors, especially the hypertape format.

Reading and writing of my own tapes, after having configured the PLL following the guide in the User manual, and keeping the cassette recorder clean, now is flawless. With the motor control (see Micro Ade manual appendix) it is a pleasure!

I read and tried all advices, like adjusting the azimuth of the recorder head, cleaning etc. Maybe the variations in tape speed between recorder and my player and the resulting frequency shift was a problem?
What really helped was looking with an oscilloscope at the output of the PLL (pin 7 of the LM311) we can see clearly the problem:

No real problems with noise or dropouts, just deviations between different recordings, so the PLL does not operate correctly. Bought tapes showed the pictures Wrong 1 and Wrong 2. And that leads to reading problems, the software makes the wrong decisions on ‘0’s or ‘1’s.

The following procedure was developed to read the bought tape, store it and save the program on my own tapes:

  1. Start reading the problem tape, 1873G
  2. Connect a simple voltmeter to pin 7 of the LM311 or Expansion connector-X
  3. Now change the PLL variable resistor to a reading of 2.7V. A scope would show ‘Correct’
  4. Start the read again
  5. Save the program
  6. Repeat with your own recording or the user Manual PLL set procedure

This helped me to read the problem tapes. Only for Microsoft Basic I had to play with the output volume, large variations in the recorded signal. But it worked in the end and now I have my own recordings on tape, several stored and working copies. One can never have enough backups!

PLL Test


This program write alternate two low frequency or three high frequency tones to the tape recorder.
Record this for a couple of minutes.
When reading this tape the PLL should convert this to a symmetric block pulse.


This program shows on the first two digits on the KIM-1 LED display the number of ‘1’s read, on the second two digits the number of ‘0’s read.
When all is well this should 80/80 but anything between 60/A0 and A0/60 is fine.

ASCII parallel keyboard to KIM-1

Kenner 2 page 4 July 1977 Co Filmer, translated to english Hans Otten, 2021

A parallel ASCII keyboard is a nice addition to the KIM-1.

Connect to the PIA A of the KIM-1 on the Application connector.

Some keyboards may require a -12 V power supply.

The address 1700 now shows the ASCII keyboard code of (the last) key pressed. The high bit (PB7) is the strobe signal, the other 7 bits the ASCII code.

A program should poll the strobe bit, if activated wait for the strobe bit to be deactivated, and then read the key and return.
Testing for keypressed such as a break test means checking the strobe bit, if activated stop processing, etc..

Code fragments by Hans Otten

PAD * $1700 ; BREAKKEY IN BIT 7
; SUBROUTINE GET CHARACTER
;
GETCH BIT PAD ; PROCEDURE GETCHARACTER ( CHAR ) 
BPL GETCH ;   WAIT FOR STROBE
GWAIT BIT PAD ;   WAIT FOR END OF STROBE 
BMI GWAIT ;
LDA PAD ;   GET CHARACTER
RTS  ; END GETCHARACTER
;
; example of break test
;
SYN BIT PAD ;   REPEAT
BPL GOON ;     WHILE NOT keypressed
JMP MONRET ;      
GOON continue processing
post

Cassette reading problems KIM-1

Another article from the Dutch KIM Kenner magazine:

RECORDING PROGRAMS WITH THE KIM-1 AND THE CASSETTE RECORDEROriginal Uwe Schroeder, KIM Kenner 1, March 12 1977 Translation June 2021 Hans Otten

Recording programs with the KIM-1 and the cassette recorder

Original Uwe Schroeder, KIM Kenner 1, March 12 1977  Translation June 2021 Hans Otten

Introduction

A large number of KIM-1 users seem, like me, to have problems recording computer programs on the cassette recorder. For unknown reasons the KIM-1 refuses to read a program, while before it went well with the same tape. These problems have led me to study the KIM-1 system and I hope to have finally discovered the cause of the problem.
This article serves to aid other KIM-1 users to solve also these problems.

Part of the PLL circuit, including input impedances

Analysis of the KIM-1 FSK system
Signals are stored on the cassette tape with FSK (frequency Shift Keying). By consecutive high and low frequency sounds (on the KIM-1 3.6 kHz and 2.4 kHz). These high and low frequency sounds are generating not with much hardware, but with software. Reading programs is done by analyzing these sounds with the LM565 IC (a Phase Locked Loop, see User manual page 31 and fig 3.8). The fact if the sound was high or low frequency is determined after some amplification and filtering via a LM311 comparator to ‘0’ and ‘1’ and offered to I/O port PB7 of the second 6530 RRIOT).

The problems arising at the reading are probably caused by not correct functioning of the circuit around the PLL. The average cassette recorder appears to supply sometimes during a very short period a dropout to let the PLL function correctly.

Where and how things can go wrong with the PLL

  • When we record on the cassette recorder a constant tone of 3.6 kHz and listen to the recording and examine it with an oscilloscope, we see and hear the sound volume fluctuate or even disappear for short periods, we call this dropouts of the tape. These dropouts will mean a fluctuation of the sound available for the PLL to detect 10 to 100 times lower volume and cause the detection to fail. By measuring the PLL level I have seen 10 to 100% more signal than required, so that ca mean PLL malfunction.
  • If a tape is passing the head misaligned/tilted of the tape recorder head, higher frequencies are in the disadvantage and weaker. This head misalignment will cause problems with recordings from other tape recorders, bought or from other users.
  • Suppose we use a perfect +5V power supply, then VCC can be considered ‘Ground’ When we send on Audio In a AC current of 550 mV, then resistors R8 andR14 reduce the signal 1/11 of 550 Mv = 50 mV supplied to the PLL. Measurements indicate the PLL requires at least 40mV to sync the PLL and see it as a ‘high’ frequency sound.
    Remark: replace the R8 with 1K to give the PLL 250 mV instead of 50mV.
  • Suppose we use a perfect recorder with a very low output impedance. And suppose the power supply has a noise level of 600 mV. Fig 2 shows, after some calculations the noise level results in 40 mV on the PLL input. If we reduce the resistor to 1K , the noise level becomes 230 mV.

The specifications of the PLL indicate the correct functioning of the PLL at an input level of nominal 2, maximal 20 mV. The fact that the measurements indicate the PLL only operates at levels of 40 mV indicate the noise levels are at the same level as the input signal coning from the recorder. A better noise reduced may help, but other sources of interference are possible. Therefore extra amplification of the signal is preferred instead of altering the KIM-1 hardware.

Solve the tape recorder problems
Since the problems with reading of tapes on the KIM-1 seems to be related to fluctuating signal levels:

  • Record the signal as loudly as possible, use a recorder without automatic level adjustment and record so that the tape is saturated.
  • When using the loudspeaker output, experiment with the volume. But too loud means distortion and may also lead to failures.
  • Build an amplifier for frequencies 2-4 kHz 10 to 20 times, short dropouts should be well amplified.
  • Use C60 instead of C120 types. Normal cheap ferro is fine, Chrome has more dropouts.
  • If the KIM-1 reports a reading error (FFFF in the display) and you want to know how much of the tape has been read, location 17ED and 17EE contain the first address not read yet.
    Make a copy of finished programs on another cassette and check this copy for readability. Do not use this copy anymore and store it. When using a cassette often, this may lead to problems, like the mangling of the tape in the drive.

Troubleshooting
Here is a procedure to work around reading tape problems:

  1. Check if the recorder is connected to the KIM-1
  2. Check Volume and Tone control ((max high)
  3. Press Reset.
  4. Set location 17F9 to 0.
  5. Set location 00F1 to 0.
  6. Inspect location 1742. Here the information of I/O pin is shown. The display shows 1742 87
  7. Start the recorder. The middle bar of the 8 now will blink, if not : you have Error 6A (see below).
    Stop the recorder, remove the cassette and start the recorder. Now the middle bar of the 8 should not blink, else you have Error 6B (see below)
  8. If the Volume knob of your recorder controls the strength of the output signal: start the recorder and determine in which setting the blinking of the bar changes. If you have not enough headroom, see Error 7.
  9. Check of the correct detection of the high frequency.
    Type in the next program and start it (the program writes a constant tone of 3.6kHz to the recorder)
    Record this tone on the recorder for several minutes.
    Rewind the recorder and start playing. Now the display should show no middle bar 1742 07
    The bar should not blink at all, every blink indicates a dropout or such. See Error 7 and Error 8.
  10. Read User Manual C and E

Oscilloscope test
If you have an oscilloscope, do the following measurements.

  1. Attach the scope to Audio Out, e.g the negative side of C4 (user manual page B-1).
  2. If you have dual channel scope, connect the other input to the top of resistor R8, that is the PLL input.
  3. Set the timebase to 1 ms, and connect Audio-Out-High with Audio-In.
  4. Start a dump of memory with 1800G

The scope will now show figure 3.

Stop the dump program , remove the connection between Audio-In and Audio Out-High and connect the cassette recorder to the KIM-1. Start reading the tape (1873G) and move the tape to a problem area. You need to start the reading program to avoid the interference of the display. When all is right you should see the same nice picture on the scope as before.
Now increase and lower the signal level of the cassette recorder to see, if or when, there are problems with the PLL. Dropouts are visible with a image that is unstable or noise peaks. Dropouts are best studied with the 3.6 kHz recorded signal. They are visible as negative peaks on Expansion connector PLL-Test E-X. A high frequency tone is on this pin a +5V, a low as 0V.

Error 6A
The PLL is not functioning, sounds are not detected. This can be caused by:

  • No +12V power supply
  • The signal of the cassette recorder is not reaching the KIM-1
  • The signal is way too weak
  • The PLL is broken or not properly configured.
    Configuring of the PLL can be done with the program PLLCAL in Appendix I page 13
    Connect Audio-Out-High with Audio-In and start the test program on 1A6B. Inspect pin E-X PLL test on the expansion connector with a voltmeter. Adjust the variable resistor on the KIM-1 so that you see 2.5V. A small adjustment can lead to 0 to 5V, as expected.

Error 6B
The PLL is active while no input signal is present.

  • Noise signals picked up
  • Defective PLL or misconfigured of the display shows: 1742 07

Error 7
Your cassette recorder is delivering a too weak signal and you will get reading problems. See the amplifier below for a solution.
Error 8
Essential for the correct operation is the correct high frequency 3.6 kHz.

  • Dirty cassette recorder heads. Clean with a quality product
  • Unaligned head. If you are lucky there is aa small screw next to the tape head allows to adjust it, listen to a high pitch
  • Tape head is worn out, replace the cassette recorder

Amplifier between KIM-1 and the cassette recorder.

When some amplification is required the following circuit may be useful.

The amplification is controlled with variable resistor P1 from 3 to 100x. A second order Butterworth filter lowers frequencies below 2 kHz to remove mains noise.
Note the shielded cables in the drawing. Be careful to use the indicated ground point, never make a groundloop !
Place the amplifier away from noise sources and the KIM-1, noise will be amplified too!

Insert a 22 nf (22kpF in the drawing) on resistors R33 and R34 (see figure 4 right bottom and Appendix B page B1).
Adjust P2 variable resistor for Vu (output 741 opamp) = 6V
P1 controls the amplification.
The opamp (741) can be any standard general purpose audio type.
Test the amplifier as described above. Adjust for optimal volume. Record a program on tape with lower as usual volume. Try higher volume only temporarily if an error occurs.