Suppress KIM-1 echo

Original article: KIM Kenner 17 page 14, Dutch, Hans Otten. Translation 2021 Hans Otten

Problem: the KIM-1 hardware is echoing incoming serial characters to the output, no echo in software involved. Very annoying!

In the KIM Kenner 1 Siep de Vries, founder of the Dutch KIM Club mentioned how in Focal for the 6502 a trick was built in to suppress the hardware echo by manipulating the TTY out bit. I examined later how it was done, from the Focal disassembly:

34AF  E6 76       L34AF INC $76         ; random number?
34B1  2C 40 17          BIT H1740       ; check if character is incoming
34B4  30 F9             BMI H34AF       ;=> wait until startbit
34B6  AD 42 17          LDA H1742
34B9  29 FE             AND #$FE        ; clear PA7
34BB  8D 42 17          STA H1742
34BE  20 5A 1E          JSR H1E5A       ; KIM-1 input
34C1  48                PHA
34C2  AD 42 17          LDA H1742
34C5  29 FE             AND #$FE        ; isolate PA7
34C7  09 01             ORA #$01        ; set PA7 to 1
34C9  8D 42 17          STA H1742
34CC  68                PLA
34CD  18                CLC
34CE  60                RTS

Hardware echo

I took the idea and implemented the software (without knowing then in 1980 the Focal disassembly!).

The echo of incoming serial to outgoing is shown in the next figures (from the KIM user manual and the KIM Circuit poster).

The TTY KEYBD signal goes via a transistor and NAND gate U15 to PA7 port of the 6532. That signal also goes to pin 10 input  of NAND gate U26  which is the TTY out line. This is the hardware echo. When the KIM-1 sends out a character it comes from PB0 to pin 9 of of NAND gate U26 and so comes out to the TTY Out line.
Note that PB5 is connected via an inverter to NAND gate U15. The other input is TTY IN. Making PB5 high will make the TTY input PA7 deaf.
Note PB5 is also Audio out.

Suppress echo in software


The solution to suppress the echo is making output PB0 low. The NAND gate out will now stay high, ignoring any changes on the other input, which is the incoming serial character.
Only when receiving a character PBO should be made high. Also any incoming character will now not be echoed unless the program wants to receive a character!

Example program

In this routine the standard KIM-1 GETCH routine at $1E5A is encapsulated in a subroutine that prevents the echo by setting PB0. Note that this is not a complete block of the echo, it is only active when the program calls the blocking EGETCHAR. When the program sends out charactersto a dispaly, anything typed at the keyboard will also appear at the display.
The calling program is now responsible for the echoing!

0001   1000             echo .org $1000
0002   1000             ;
0003   1000             echoflag = $17E2 ; flag: 0 normal echo
0004   1000             SBD = $1742 ; KIM 6532 PIA B data register
0005   1000             GETCH = $1E5A ; KIM TTY Getch routine 
0006   1000             ;
0007   1000 AD E2 17    EGETCHAR LDA echoflag ; if notechoflag 
0008   1003 F0 08         beq normal ;  then normal echo 
0009   1005 AD 42 17      LDA SBD  ; else set TTY bit PB0 to 0 
0010   1008 29 FE         AND #$FE  
0011   100A 8D 42 17      STA SBD ; 
0012   100D 20 5A 1E    normal JSR GETCH ; get character from input
0013   1010 48            PHA ; save
0014   1011 AD 42 17      LDA SBD ; set TTY bit PB0 
0015   1014 09 01         ORA #$01 
0016   1016 8D 42 17      STA SBD 
0017   1019 68            PLA ; restore received character
0018   101A 60            RTS 
0019   101B               .end
0020   101B               tasm: Number of errors = 0

Does EGETCHAR work on the KIM-1 clones or SImulator?

Micro-KIM and PAL-1: yes, the hardware is identical, IC numbers are different
Corsham Technology: yes, though the hardware for audio is not there, there is still a NAND gate IC17C coupling PA7 and PB0.

KIM-1 Simulator V1.16 and higher: yes.

Enhanced solution: always deaf for input
If you study the hardware shown above you see PB5 also blocks the echo. The following routine tries to use this to make the input permanent deaf.

0001   1000             echo .org $1000
0002   1000             ;
0003   1000             echoflag = $17E2 ; flag: 0 normal echo
0004   1000             SBD = $1742 ; KIM 6532 PIA B data register
0005   1000             GETCH = $1E5A ; KIM TTY Getch routine 
0006   1000             ;
0007   1000             ; no echo when reading character
0008   1000             ; 
0009   1000 AD E2 17    EGETCHAR LDA echoflag ; if not echoflag 
0010   1003 F0 08         beq normal ;  then normal echo 
0011   1005 AD 42 17      LDA SBD  ; else set TTY bit PB0 to 
0012   1008 29 FE         AND #$FE 
0013   100A 8D 42 17      STA SBD ; 
0014   100D 20 5A 1E    normal JSR GETCH ; get character form input
0015   1010 48            PHA ; save
0016   1011 AD 42 17      LDA SBD ; set TTY bit PB0 
0017   1014 09 01         ORA #$01 
0018   1016 8D 42 17      STA SBD 
0019   1019 68            PLA ; restore received character
0020   101A 60            RTS 
0021   101B             ;
0022   101B             ; no echo only at wish if reading character
0023   101B             ; note that using tape I/O will leave PB5 low
0024   101B             ; 
0025   101B AD E2 17    DGETCHAR LDA echoflag ; if notechoflag 
0026   101E F0 05         beq dnormal ;  then normal echo 
0027   1020 AD 42 17      LDA SBD  ; else set TTY bit PB0 to 
0028   1023 29 FE         AND #$FE ; PB0 low
0029   1025 29 DF       dnormal AND #$DF ; PB5 low
0030   1027 8D 42 17      STA SBD ; 
0031   102A 20 5A 1E      JSR GETCH ; get character from input
0032   102D 48            PHA ; save
0033   102E AD 42 17      LDA SBD ; set TTY bit PB0 and PB5
0034   1031 09 21         ORA #$21 ; high
0035   1033 8D 42 17      STA SBD 
0036   1036 68            PLA ; restore received character
0037   1037 60            RTS 
0038   1038               .end
0039   1038               
0040   1038               tasm: Number of errors = 0

Note that using tape I/O will leave PB5 low, allowing echo, only set high when the program calls DGETCHAR.

Does DGETCHAR work on the KIM-1 clones?

Micro-KIM and PAL-1: yes, the hardware is identical, IC numbers are different
Corsham Technology: no, PB5 is not used.

KIM-1 Simulator: not yet

KIM-1 manuals

On this page manuals, most English, some German

PDFs from all over the internet, archive.org, own scanning. Thanks for that!
From https://www.retro-commodore.eu/2021/02/14/kim-1-manuals/ come the high quality scans!


User Manual

User manual high quality
User manual in HTML format
User manual in text format
User manual in PDF format (note page 18-25 of the ROM listing is missing)
Appendix with ROM listing in PDF format
Corrected page 17 of ROM listing
Appendix with complete ROM listing in PDF format
Revision of Rockwell KIM-1 User’s manual
Proofreading version of User Manual from Terry Holdt
MOS KIM-1 Handbuch, German version of KIM-1 User manual

Hardware manual

Hardware Manual January 1976 Second Edition Publications Number 6500-10A
MCS6500 Hardware Manual high quality
Hardware Manual in ASCII format
MCS6500 Hardware Manual jan 1975 in PDF format
MCS6500 Hardware Manual jan 1976 second edition in PDF format
Hardware manual in HTML format
Rockwell 6500 Hardware Manual
MOS 6500 Hardware Handbuch
German version of Hardware manual

Programming manual

MCS6500 Microcomputer Family Programming Manual high quality
High-res quality typeset manual by Pickledlight. Local copy. Check to original for updates!
MCS6500 Microcomputer Family Programming Manual
MCS6500 Microcomputer Family Programming Manual Hardcover
Programming Manual in PDF format
Programming Manual in HTML format
Programming manual appendix in HTML format
Rockwell 6500 Programming_Manual
MOS Microcomputers Programmier Handbuch,
German version of Programming manual

KIM Hints

KIM hints
KIM-1 Hints PDF format
KIM-1 Hints smaller PDF format
KIM-1 Hints in text format
KIM-1 Hints in text format with additions and corrections

KIM-2 – KIM-5 manuals

Hardware extensions, see also the KIM System Products pages.

< User’s Manual Motherboard KIM-4 in PDF
User’s Manual Motherboard KIM-4
User’s Manual Motherboard KIM-4 in BW PDF
User’s Manual Motherboard KIM-4 in HTML
< MOS KIM-2-3-4 User Manual Expansion Modules
KIM System products folder KIM-3B KIM-4 IM-5 KIM-6 incl pricelist
MOS KIM Assembler Manual Preliminary (KIM-5)
MOS KIM Text Editor User Manual (KIM-5)

Byte Magazine 1978 09 Plugging the KIM-2 Gap

Byte Magazine 1978 09 Plugging the KIM-2 Gap

Cross assembler Manual, GE timeshare

Scan-160408-0001 Cross assembler Manual, GE timeshare

Cross assembler Manual, GE timeshare

MOS KIMath Subroutines Programming Manual

6502 Reference Cards

6502 Reference Cards collection
MOS Technology Reference Card, better quality, early one, ROR instruction missing, handwritten

MCS6501 reference card August 1975


MCS6501 August 1975


No ROR instruction!

MOS Technology Cross assembler


Circuit diagram poster

KIM-1 circuit diagram
Rockwell branded circuit diagram
KIM-1 poster in high resolution, large picture!
KIM-1 poster in high resolution,
cleaned up by Joshy of Forum64 and me (August 2022)
KIM-1 poster in high resolution, cleaned up and with wide borders
KIM-1 poster in high resolution, scan by Dave McMurtrie
Redrawn KIM-1 circuit diagram

KIM-2/3/4/5

< User’s Manual Motherboard KIM-4 in PDF
User’s Manual Motherboard KIM-4
User’s Manual Motherboard KIM-4 in BW PDF
User’s Manual Motherboard KIM-4 in HTML

First Book of KIM

First Book of KIM
The First Book of KIM-1 in PDF format
The First Book of KIM-1, part in text format
The First Book of KIM-1 in HTML format
Sources of The First Book of KIM-1 in source and papertape format, Jeff Tranter

Newsletters and errata

MOS Technology newsletter February 1976
MOS Technology April 1976 customer update
Customer Errata Letters
Customer Errata Letter 1
Customer Errata Letter 2
Customer Errata Letter 3

Quick references

KIM-1 Quick Reference by Jeff Trenter
KIM-1 user guide and notes
from the book “Microcomputer Principles
featuring the 6502/KIM