For Focal V3D a setting has to be made in the Settings, to allow Focal to do its magic in the input routine.
By working on Focal I did add comments to the disassembly of what I found. You will find the original by Paul R. Santa-Marie and my partly commented version in the archive.
Nils a.k.a. netzherpes typed in a number of KIM-1 programs to run on his PAL-1, the KIM-1 compatible clone.
Not only does he types them in in assembler, some even by contacting the original author!, tests the programs and also provides source and ready to run binaries or papertapes.
And he draws nice looking cover images!
You have 20 shots to detect a 3×1 ship on a 8×8 grid. The ship can be aligned horizontal, vertical or diagonal.
How to play: Enter the coordinated and fire (Button F). If you hit the ship, the mostright counter will jump to 01.
If you hit all 3 coordinates of the ship, you won, the display will show “dEAd” and the number of shots used.
(c) 1978 Roland Kushnier (orig)
(c) 1979 Jody Nelis (bugfix)
The 6 column Version of Fer Webers Target1 Shooter Game (https://github.com/netzherpes/Target1-for-KIM-1)
Author Fer Weber
published in KIM Kenner 8 on 18.06.1979
This is a walkthrough of one of the most amazing computer games in history.
KIMventure is a (colossal cave like) adventure game for the KIM-1 that fits in only 1 (ONE) KB of RAM. It offers 24 room to explore with a lot of traps and riddles to solve. It was programmed in 1979 by Robert Leedom with pen and paper (no assembler etc.)
The program is written, probably by hand, Herwig Feichtinger in the German magazine Hobbycomputer, Issue 1. Available on archive.org.
I took the source as typed in by Nils, added the comments from the (see below) listing in the article and made sure it was binary compatible with the listing. There are some problems with the first entry in the database.
; Target assembler: TASM
;*****************************
;* Telefonbuch *
;* (c) 1979 *
;* Herwig Feichtinger *
;*****************************
; typed in and checked by Nils Andreas
; comments entered from German listing into source
; checked for being binary compatible with original listing in HobbyComputer 1 1979
;
; Note that getch in KIM-1 returns with Y = $FF, used in this program to save two bytes?
; Testcase for the KIM-1 Simulator, which now emulates this getch behaviour
;
; Hans Otten, 15 december 2021
;
CR = $0d ; carriage return
esc = $1b ; escape
crlf = $1e2f ; KIM-1 print cr
getch = $1e5a ; KIM-1 read char for tty
space = $1e9e ; KIM-1 print space tty
outch = $1ea0 ; KIM-1 print car on tty
incpt = $1f63 ; increment pointer
;
; zeropage
;
savy = $f9
tablep = $fa ; pointer into table
bufferp = $df ; buffer
table = $0200 ; table starts here
;
.org $0000
;
start: lda #(table & $ff) ; low byte table address
sta tablep
lda #(table >> 8) ; high byte table address
sta tablep + 1 ;
ldx #$17 ; 17 bytes clear
lda #$00
buffer: sta bufferp,x ; clear buffer
dex
bne buffer
;
read: jsr getch ; get ascii character
cmp #esc ; escape?
bne chkend ; no
iny ; yes, y = 0
chkfre: jsr incpt ; increment table pointer
lda (tablep),y ; query buffer
bne chkfre ; free space in buffer?
input: jsr getch ; get ascii character
iny ; y=0
cmp #esc ; escape?
beq start ; yes, back to begin
sta (tablep),y ; no, store in table
jsr incpt ; increment table pointer
jmp input ; and again
chkend: cmp #CR ; return?
beq zzz ; yes, line ready
sta bufferp +1,x ; no, store char in buffer
inx ; increment buffer index
cpx #$15 ; is $15?
bne read ; next character
;
zzz: nop
nop
;
newline: jsr incpt ; table after return
ldy #$00 ; search for character
lda (tablep),y ; in table
beq printquest ;
cmp #CR ; found?
bne newline ; no, search again
found: ldx #$00 ; yes, compare character in table
compbuf: iny ; with character in buffer
lda bufferp +1,x ; no, compare table and buffer
beq printline ; show it
lda (tablep),y
cmp #CR ; return?
beq zzz
cmp bufferp +1,x ; next character
bne found
inx
bne compbuf
;
nop
nop
;
printline:
jsr crlf ; new line
ldy #$01
loadchar:
lda (tablep),y ; load character from table
beq printquest ; zero is ready
cmp #CR ; return?
beq zzz ; end of table entry
sty savy ; save Y
jsr outch ; and print character
ldy savy
iny ; increment Y, next
bne loadchar ; load new character
printquest:
jsr crlf ; print return
lda #'?' ; print ?
jsr outch ;
jsr space ; print space
jmp start ; return
;
.end
Here the pages where the program is described and the listing shown.
Nils, a very enthousiast PAL-1 user discovered in an old German magazine, 1979, HobbyComputer 1, a small phonebook program for the KIM-1.
It is a command line utility, extremely small and quite clever. See the post about it here.
So he entered the code in assembler and did some tests on his PAL-1 (it worked) and in the KIM-1 Simulator, which was not working.
He found the ‘database’ corrupted.
Of course I had to look at it and see what was going on. It had to be something about using zeropage pointers into the database.
And it was. In the source an instruction appeared:
INY ; Y = 0
followed by an indirect addressing, Y into the database and preceded by a call to getch, reading a character from the keyboard.
Y was not used in the program before, so in the Simulator it was uncertain what the value was.
GETCH is known to destroy the Y register, delivering the character in register A. How is unspecified.
In the KIM-1 Simulator the KIM-1 GETCH is patched to the ACIA routines of the emulated 6850 serial interface.
Those routines do not use Y, so it is left untouched.
So time to study the KIM-1 routines. In the delay a bit routine the Y register is filled with the final state of a counter, TIMH.
It looks like the decrement ends with the value $FF, when the BPL becomes false, the whole purpose of the use of Y seems to determine that end of the loop?
1ED4 AD F3 17 DELAY LDA CNTH30
1ED7 8D F4 17 STA TIMH
1EDA AD F2 17 LDA CNTL30
1EDD 38 DE2 SEC
1EDE E9 01 DE4 SBC #$01
1EE0 B0 03 BCS DE3
1EE2 CE F4 17 DEC TIMH
1EE5 AC F4 17 DE3 LDY TIMH
1EE8 10 F3 BPL DE2
1EEA 60 RTS
Anyway, the KIM-1 Simulator 0.9.4. GETCH routine now returns with Y=$FF and the phonebook program seems to work.
I know KB6 existed. The ‘6’ stands for the precision in digits of the floating point number. In the documentation KB-6 is described.
Never seen a version in the wild. I know KB6 existed. The ‘6’ stands for the precision in digits of the floating point number. In the documentation KB-6 is described. Never seen a version in the wild. So the reconstruction here is not checked with the original, addresses in the reconstruction from the linker differ from the documentation.”>So the reconstruction here is not checked with the original, addresses in the reconstruction from the linker differ from the documentation.