Getting kalah to work

48 views
Skip to first unread message

Bill E

unread,
Mar 29, 2026, 10:06:14 AM (12 days ago) Mar 29
to [PiDP-1]
I've started looking into this, first problem is that it uses a loader that isn't the usual.
I've started deciphering it, but any assistance would be welcome.
This one uses the sense switches. If all are off, it clears memory up to the loader, then loads using its expected format and starts the program.

If ss2 is on, the mem clear is skipped and it compares the loaded tape, again in its format, with the current contents of memory and halts if it doesn't match.

If ss1 is on, it halts before starting the program it loads.

That's as far as I've gotten, not sure how much time I want to spend on it.
But, if anyone wants to figure out just what the load format it uses is, I'll add it to the tape disassembler. Then kalah can be disassembled and I can try to figure out why it doesn't work.

What I've gotten so far is attached.
Bill
specalloader.mac

Bill E

unread,
Apr 4, 2026, 10:44:16 AM (6 days ago) Apr 4
to [PiDP-1]
Now that I can disassemble it, I've been digging into it. It is a BIG program, uses all of bank 0. First, the instructions in kahla_lab.txt are totally wrong. Using its settings will immediately crash.
I can get it to work a bit, but it's really not functional, still looking into it.
You can see it play itself, though.
The real (so far) instructions:
TW switches 0-5 specify the number of pieces in each pit to start with. Don't try using more than a small number, too many will crash the program and corrupt memory.
TW switches 15-17 determine the lookahead depth the program uses. Bigger numbers will take MUCH longer per move as will more pieces. MUCH longer.
A good demo setting is:
TW 003001
The sense switches are heavily used. They are only scanned when the program starts or is restarted at location 02000.
SS1 - just halts 
SS2 - same as SS3
SS3 -  show a detailed numeric representation of the moves being played
SS4 -  no display, but show game decision making as it plays itself
SS5 -  show a numeric representation of the moves being made
SS6 - show a typed board updating as the moves are being made

SS2,3,5,6 are exclusive. If more than one is set, the lowered number one takes precedence

So, what's wrong?
It NEVER asks for input in any mode.
If SS4 is off, it just displays the initial board setup and does nothing else.
If SS4 is on, it plays itself.

Clearly something is broken, I'll poke around some more until I get bored.
Bill

Sgeo

unread,
Apr 6, 2026, 12:59:37 PM (4 days ago) Apr 6
to [PiDP-1]
I have Kalah working in my Web based emulator. Input is via light pen. I really need to upload the tape and instructions there.

Bill E

unread,
Apr 6, 2026, 3:58:25 PM (4 days ago) Apr 6
to [PiDP-1]
Great. It would be interesting to see if yours is the same binary. From looking at the code briefly, there's no way it ever gets to asking for input. Could be some switch setting I haven't figured out yet, though.
Bill

Sgeo

unread,
Apr 6, 2026, 7:01:51 PM (3 days ago) Apr 6
to [PiDP-1]
I'm using the same kalah.bin that is attached to https://groups.google.com/g/pidp-1/c/3sdUdKFTKLo/m/aPeHHh6eAAAJ

Remember that checking the light pen can be done by looking for program flag 3 or the check status I/O instruction. IIRC I didn't actually implement the latter yet. I don't have the Kalah disassembly in front of me at the moment.

Sgeo

unread,
Apr 6, 2026, 7:25:00 PM (3 days ago) Apr 6
to [PiDP-1]

Bill E

unread,
Apr 6, 2026, 7:56:52 PM (3 days ago) Apr 6
to [PiDP-1]
It never occurred to me to check for the lightpen being used. I still don't know why there is code to read from tyi. Tyo is used as I noted above.
So, yes, with the lightpen it actually works!.
Bill
Reply all
Reply to author
Forward
0 new messages