Focal on the KIM-1

89 views
Skip to first unread message

Hans Otten

unread,
Sep 26, 2022, 8:35:18 AM9/26/22
to PAL 6502 computer
I have preserved a version of Focal (V3D Aresco) from tape. Given to me in 1979 by my friends of the KIM Club. Original Digital Equipment language. 

I loaded it on the KIM-1 long ago, and it seem to run then. It uses the echo suppression trick I documented.

Today I tried it on the KIM-1 Simulator. I thought I had the echo suppression simulated but Focal failed. After patching to get character routine with NOPs, just leaving JSR 1EA0 and CLC, Focal came to life. It works!

These are the character I/O routines of Focal V3D (Aresco)

Output:
34AA  20 A0 1E          JSR H1EA0
34AD  18                CLC
34AE  60                RTS

Input:
34AF  E6 76     H34AF   INC Z76
34B1  2C 40 17          BIT H1740
34B4  30 F9             BMI H34AF       ;=>
34B6  AD 42 17          LDA H1742
34B9  29 FE             AND #$FE
34BB  8D 42 17          STA H1742
34BE  20 5A 1E          JSR H1E5A
34C1  48                PHA
34C2  AD 42 17          LDA H1742
34C5  29 FE             AND #$FE
34C7  09 01             ORA #$01
34C9  8D 42 17          STA H1742
34CC  68                PLA
34CD  18                CLC
34CE  60                RTS

So I have to find out why my (once working!) echo suppression fails in the current simulator! Always fun to work on it. 

Any one else tried Focal yet? It is a nice interpreter for an expanded KIM-1 and PAL-1
firstrun.jpg

Hans Otten

unread,
Sep 26, 2022, 8:39:29 AM9/26/22
to PAL 6502 computer
The patch looks like this now:
34B1 EA       NOP  
 34B2 EA       NOP  
 34B3 EA       NOP  
 34B4 EA       NOP  
 34B5 EA       NOP  
 34B6 EA       NOP  
 34B7 EA       NOP  
 34B8 EA       NOP  
 34B9 EA       NOP  
 34BA EA       NOP  
 34BB EA       NOP  
 34BC EA       NOP  
 34BD EA       NOP  
 34BE 20 5A 1E JSR $1E5A  
 34C1 48       PHA  
 34C2 EA       NOP  
 34C3 EA       NOP  
 34C4 EA       NOP  
 34C5 EA       NOP  
 34C6 EA       NOP  
 34C7 EA       NOP  
 34C8 EA       NOP  
 34C9 EA       NOP  
 34CA EA       NOP  
 34CB EA       NOP  
 34CC 68       PLA  
 34CD 18       CLC  
 34CE 60       RTS  

Message has been deleted

Neil Andretti

unread,
Sep 28, 2022, 8:48:16 AM9/28/22
to PAL 6502 computer
Thats really great news, Finally focal running again on the KIM-1
I could not get the previous version from your site running. I guess it was heavily modded.

As for the Echo problem in the KIMSimulator: Apple-1 Basic has the same issue.
It's working on the real mchine and doubleing the lettters in the Simulator.

Have a nice week (sorry for being afk some weeks....)
Nils
A1Patched.ptp

Hans Otten

unread,
Sep 28, 2022, 10:30:07 AM9/28/22
to PAL 6502 computer
OK it works now.  It did work in the past,  but in one of the updates it got damaged.

New version of the KIM-1 Simulator, the 'echo' trick works now.

The Simulator 1.16 supports Focal V3D. But with a complication, requiring a (temporary) setting.

Focal did something  what caused a hang on the simulator.

These are the character I/O routines of Focal V3D:

OUTFOCAL   JSR $1EA0
          CLC
          RTS
INFOCAL  INC $76
          BIT $1740
          BMI INFOCAL
          LDA $1742
          AND #$FE
          STA $1742
          JSR $1E5A
          PHA
          LDA $1742
          AND #$FE
          ORA #$01
          STA $1742
          PLA
          CLC
          RTS
 
The OUTFOCAL is nothing special, just the KIM-1 OUTCH routine called.

INFOCAL is where something  special happens, reason unknown to me:
INFOCAL INC $76 
                 BIT $1740 
                 BMI INFOCAL
 
Here the TTY input line is monitored for a start bit. And a zeropage location incremented. I suspect this is a smart way to have a random number seed, because waiting time for a user pressing a key is unpredictable.

I needed a setting in the emulator to do this. See Settings: Break setting to Focal. Default is Normal and CTRL-C works as break e.g. for MS Basic,

The rest of the routine is the echo suppression routine as documented in Suppress KIM-1 echo – Retro Computing (hansotten.nl) 
Jim uses the suppress echo routine also in his ROM programs, like Wozmon and the monitor.  

New version of the Simulator will be online later today.

Neil Andretti

unread,
Sep 29, 2022, 5:16:48 AM9/29/22
to PAL 6502 computer
With the latest version of the KIM Simulator Apple-1 Basic is working \o/
Thank you Hans 🙏
Nils

Hans Otten

unread,
Sep 29, 2022, 1:18:11 PM9/29/22
to PAL 6502 computer
That makes me happy! This means the simulation of KIM-1 hardware is one step better. All Jim's programs in the PAL-1 ROM should work now.

I am thinking of making a 'configuration' setting. Choose PAL-1 and you get a PAL-1 ROM and 32K RAM added.
Or a MicroKIM or Corsham KIM Clone setting. Or a custom one.

Hans Otten

unread,
Sep 29, 2022, 1:21:15 PM9/29/22
to PAL 6502 computer
Or a KIM-1 like I had in 1980: total 48K, serial I/O and parallel keyboard. 

John Kennedy

unread,
Oct 14, 2022, 11:56:26 PM10/14/22
to PAL 6502 computer
I've been trying VTL and Apple 1 BASIC on my own emulator and sure enough I get the echo.
My emulator isn't as sophisticated and so the bit twiddling on the TTY bit PB0 doesn't work.

Reply all
Reply to author
Forward
0 new messages