Pascal-M 2k1 Pascal on the KIM-1

New version of the Pascal-M system, run Pascal programs on the KIM-1.

HEXPAWN

A game by Robert Leedom, published in 6502 user notes #13, 1979. Typed in by Dominic Bumbaco so we can play it!

Paper tape and hex dump of the program
Original article

Suppress the KIM-1 echo

A page on suppressing the KIM-1 echo of TTY input, read non-blocking and make the TTY input deaf.

Problems with the KIM-1 TTY character input

  1. The KIM-1 hardware is hardware echoing incoming serial characters to the output, no echo in software involved, so you cannot influence what appears on screen. Very annoying!
  2. The KIM-1 GETCH routine is blocking, no way to check for a character coming in, like a Break. waiting.
    Also quite annoying if porting other software to the KIM-1 or you want the program interruptable.
  3. While a program is running something CPU intensive and you type something the program is not really waiting for, the characters appear on screen. Because the KIM-1 does hardware echoing of TTY input, this is unavoidable it seems

Here I present solutions for these problems in software, made possible by the genius hardware design of the KIM-1 TTY I/O.
Are they perfect? Maybe not, it is still bitbanging the incoming serial signal. It can miss the correct starting point for the incoming character bit stream.
If you want a perfect solution, you will need interrupt driven ringbuffered serial I/O with a dedicated IC like the 6850, 6551 etc.
Without this extra hardware you can achieve acceptable results with these routines.

Background in (updated) original article KIM Kenner 17 page 14, Dutch, Hans Otten, 1980

In the KIM Kenner 1 Siep de Vries, founder of the Dutch KIM Club mentioned how in Focal-65 for the 6502 a trick was built in to suppress the hardware echo by manipulating the TTY out bit PB0. I took the idea and implemented it on my KIM-1 in 1980 without seeing the Focal code, as I did not have a Focal binary yet then!

I examined in 2003 how it was done, from the Focal disassembly I made then:

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

How to suppress the hardware echo to TTY out or making the TTY input deaf

The hardware echo of incoming serial signal to outgoing TTY output 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.
PB5 (audio TTY control) 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 for incoming signals.


The genius designers of the KIM-1 used NAND gates in the TTY I/O!

Non-blocking input

The KIM-1 GETCH routine detects an incoming character by looking in a loop for the start bit to appear. It then reads the character.
By first doing that loop of looking for the start bit and returning if not yet, then we have the check for a key pressed and a character coming in.
If a character is incoming we have to call as fast as possible the GETCH routine.

;
; KEYPRESS
;   check character coming on character non-blocking 
;   - carry set if char coming in
;   - follow up with GETCH or EGETCH as fast as possible if you want echo or no echo 
;
KEYPRS  LDA  SAD
        BMI  NOKEY      ; If bit 7 is set, the line is idle, no char
        SEC
        RTS             ; Carry set if key pressed, A is key
NOKEY   CLC
        RTS             ; carry clear, no key

As argued above, this is not foolproof. It is easy to miss an incoming character, as there is no buffering of the input.

Echo suppress

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, the incoming serial character. So nothing is echoed.

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. The calling program is now responsible for the echoing or otherwise.

;
; EGETCH from TTY without echo (Y returned FF due to GETCH)
;
EGETCH  LDA  SBD
        AND  #$FE       ; Set PB0 to U26 low to suppress the echo
        STA  SBD
        JSR  GETCH
        PHA
        LDA  SBD
        ORA  #$01       ; Set PB0 to U26 high to enable the echo
        STA  SBD
        PLA
        RTS

To make the TTY input really deaf you can use PB5. Calling the deaf routine hardware blocks any incoming TTY signal.

; 
; TTYDEAF
;   call this to block any incoming character
;
TTYDEAF LDA  SBD
        ORA  #$20       ; Set PB5 to U26 high to block input
        STA  SBD
        RTS
; 
; TTYHEAR
;   call this to restore incoming character via GETCH or EGETCH
;
TTYHEAR LDA  SBD
        AND  #$DF       ; Set PB5 to U26 low to allow input
        STA  SBD
        RTS

Using TTYdeaf/hear in combination with KEYPRS and EGETCH works quite well to prevent most unwanted screen display of characters.

Example program of suppressing echo and non-blocking

I wrote a litle program demonstarting the non-blocking and no echo facilities presented here.
Download sources, binary, papertape here.
This is the console output of the program:

KIM
0000 0200
0200 A2 G

Demo of echo suppress and non-blocking input Hans Otten, 2026

Normal get character, until ESCAPE
 1 31 2 32 3 33 4 34 5 35 6 36  03 1B
NOECHO get character, until ESCAPE
  31  32  33  34  35  36  03  1B

If run on KIM-1 Simulator: set in  Settings Non-blocking or Focal-V3D

Non-blocking no echo until ESCAPE
31
key pressed
32
key pressed
33
key pressed
03
key pressed

Demo of echo suppress and non-blocking input Hans Otten, 2026

KIM
0200 A2 _

If you have a KIM-1, PAL-1, PAL-2 or Micro-KIM, these routines may help you.
The Corsham KIM Clone does not support PB5, and no deaf input on that one. Echo suppress works!

These routines also run on the KIM-1 Simulator. The non-blocking routine requires a Setting in the Simulator.
In versions before 2.3.1 check Focal-V3D, the later versions check Allow non-blocking.
The TTYdeaf routine does not work yet on the Simulator, PB5 is ignored.

Settings in 2.3.0

Settings 2.3.1












KIM-1 manuals and MOS Technology documents

On this page manuals, most English, some German and other MOS Technology documents

PDFs from all over the internet, archive.org,.thanks for that!
From https://www.retro-commodore.eu/2021/02/14/kim-1-manuals/ come the high quality scans!
Most are own scans and many hours of correcting scans to higher and cleaner quality.



KIM-1 User Manual

Four version are known to exist, a First Edition January 1976, a Second Edition March 1976 Revision 6500-15A, a Second Edition 6500-15B August 1976, and a Rockwell version Rev 1 1977.
There may have been a 6500-15C on which the Rockwell version is based. From 15A to 15B the difference is in a changed description of the 6530 timer. In the Rockwell version the keypad change of SST switch to the left is documented.
A German version is also known.

Proofreading version of User Manual from Terry Holdt
KIM-1 User Manual First Edition, January 1976
No Version number, could be 6500-15.
KIM User Manual Errata Letters for First Edition
KIM-1 User Manual 15A March 1976
KIM-1 User Manual 15B August 1976

User manual in HTML format
User manual in text format
Appendix with complete ROM listing in PDF format

KIM-1 User Manual Rockwell Rev 1, 1977
Revision of Rockwell KIM-1 User Manual
MOS KIM-1 Handbuch, German version of KIM-1 User manual

MCS6500 Family Hardware Manual

Hardware Manual August 1975 First Edition Publications Number 6500-10
6500-10 MCS6500 Hardware Manual August 1975 First Edition
Errate letter for Hardware Manual 6500–10
Hardware Manual January 1976 Second Edition Publications Number 6500-10A
6500-10A MCS6500 Hardware Manual January 1976 Second edition
6500-10A MCS6500 Hardware Manual Second Edition January 1976
high quality, printed in Germany
MCS6500 Hardware manual 6500-10A in HTML format
MCS6500 Hardware Manual 6500-10A in ASCII format
MOS 6500 Hardware Handbuch
German version of Hardware manual
Rockwell 6500 Hardware Manual
MCS6500 Microcomputer Family Hardware Manual 50A Reproduced
High-res quality typeset manual by Pickledlight. Local copy. Check the original for updates.
MCS6500 Microcomputer Family Hardware Manual Reproduced
MCS6500 Microcomputer Family Hardware Manual Reproduced Cover
MCS6500 Microcomputer Family Hardware Manual Reproduced with Cover

MCS6500 Family Programming manual

6500-50A MCS6500 Programming Manual January 1976
with reference card


6500-50A MCS6500 Microcomputer Family Programming Manual
Reproduced

High-res quality typeset manual by Pickledlight. Local copy. Check the original for updates.
Hardcover of MCS6500 Microcomputer Family Programming Manual
MCS6500 Microcomputer Family Programming Manual reproduced with cover
Programming Manual in HTML format
Programming manual appendix in HTML format
Rockwell 6500 Programming Manual
6500-50 MCS6500 Programming Manual Synertek
6500-50 MCS6500 Programming Manual Synertek in HTML format
MOS Microcomputers Programmier Handbuch
German version of Programming manual

KIM Hints

A small booklet from MOS Technology comes with every KIM-1 with hints how to use the KIM-1. Like audio cassette, Teletype, paper tape, power supply and the Interval Timer in the 6530.

KIM Hints, grey cover
KIM-1 Hints, white cover
KIM hints in text format
KIM-1
KIM-1 Hints with additions and corrections

KIM Application Note #2 Interval timer Operation

KIM Application Note #2 Interval timer Operation

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)

Cross assembler Manual, GE timeshare

Scan-160408-0001 Cross assembler Manual, GE timeshare
MCS6500 Microprocessor Software Support
Guide for using the MOS Technology Support Software on United Computing Systems timesharing service
Describes the MCS6500 Cross Assembler, Simulator and DMP to ROM programs.

MOS KIMath Subroutines Programming Manual

MOS KIMath Subroutines Programming Manual

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

First Book of KIM

Written by Jim Butterfield, Stan Ockers and Eric Rehnke (and many other authors!), first published 1977.
Invaluable source of information on programming the standard KIM-1. Background, games, utilities such as Hypertape.
Many reprints, many publishers.
The two versions downloadable here are rescanned and of high quality. The layout is a bit different, the contents are mostly identical. The corrections listed below are applicable to the Human Electron version, the Hayden version already has those corrections.
The previous version and only until now, still all on the internet is low quality, full of artefacts and missing the last page.

First Book of KIM, 1977, 1978
Published by Hayden Book Company. Later version, corrected edition
First Book of KIM, 1977
Published in Europe by Human Electron GMBH. Earlier version, corrections required
The Appendix SYM/KIM tot the First Book of KIM
1979, Robert A Peck, Hayden Book Company
Last page of Hayden version, a quick reference of the KIM-1
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
Software from First Book of KIM in binary, audio (Wave) and papertape format, by Dave Willams.

THE FIRST BOOK OF KIM – corrections
– Authorships: SORT p. 136: by Jim Pollock
– FARMER BROWN, HYPERTAPE, SUPERDUDE: by Jim Butterfield
– Titles: MUTI-MAZE, p 92, should be MULTI-MAZE
– Programs:
– BANDIT: change 0252 and 029C from 08 to 0B
– CODE TEST, p.58: change 02CE thru 02DA to:
D1 65 D4 C5 D5 85 D0 A2 04 B5 D0 95 D1
– MUSIC BOX, p.90: add 027D 84 E7 – STY LIMIT+1
– MINI DIS, p. 125: add 0364 68 – PLA
– LUNAR LANDER, p.84: Press A for altitude display (is not in the Hayden version!)
– WUMPUS, p.107:. If WUMPUS moves into a room. with a pit or superbats, he’ll’ be hidden – you won’t be told WUMPUS CLOSE. Either guess or pitch a can to make him move.
– Asteroid line 0269 should be labeled NOBT
– Blackjack 0292 should be labeled HIT
– PING PONG hex dump 0325 should be “08” not “C0”
– WUMPUS line 06C delete duplicate label “ROOM”


Newsletters and errata

MOS Technology newsletters
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

Other MOS Technology documents

MOS Technology Floating point BCD routines
MOS Technology January 1976, Rev 0.
Numbers of six digits BCD Mantissa,
a two digit BCD Exponent and the signs for the mantissa
MCS6532 Design Specification
Published before the first 6532 datasheet
MCS6500 Microprocessor Software Support
Guide for using the MOS Technology Support Software on United Computing Systems timesharing service
Describes the MCS6500 Cross Assembler, Simulator and DMP to ROM programs.
MCS6500 datasheet May 1976
MDT 650 product description
Simplifying Conversion from 6800 to 6502
TIM Software development Aid Product description
KIM 2-3-4-5 product descriptions

Warranty card that came with the KIM-1

Byte Magazine 1978 09 Plugging the KIM-2 Gap

Byte Magazine 1978 09 Plugging the KIM-2 Gap