• Please review our updated Terms and Rules here

Embedded ML code in C= Educational titles?

tech58761

Experienced Member
Joined
Nov 10, 2023
Messages
57
Location
Northern Plains, USA
Before jumping into the main reason for this thread... after seeing the post about the LoadStar archives online, I wonder if there are any equivalent archives of the 'educational' titles Commodore put out way back then?
(I'd love to get a copy of the Artillery game!)

So, as I said, this questions pertains to the software from Commodore, where it had the splash screen with the checkered line around the edge and the C= logo in the middle, then the same 3-4 menu options after that (where option 1 always went to the main program).

If you ever listed the program, there would always be some graphics characters at the start which were actually a couple chunks of 65xx assembly code, and listing the program after running it showed that those chunks were modified (with one line always listing as gibberish afterwards).

What did those routines do?
 
Here's the disassembled code from Hangmath, which I have handy here. It is embedded directly in the program at location $0830.

Code:
.C:0830  78          SEI
.C:0831  A9 3D       LDA #$3D
.C:0833  8D 14 03    STA $0314
.C:0836  A9 08       LDA #$08
.C:0838  8D 15 03    STA $0315
.C:083b  58          CLI
.C:083c  60          RTS
.C:083d  20 EA FF    JSR $FFEA
.C:0840  A9 FF       LDA #$FF
.C:0842  85 91       STA $91
.C:0844  4C 34 EA    JMP $EA34
.C:0847  78          SEI
.C:0848  A9 31       LDA #$31
.C:084a  8D 14 03    STA $0314
.C:084d  A9 EA       LDA #$EA
.C:084f  8D 15 03    STA $0315
.C:0852  58          CLI
.C:0853  60          RTS

This routine is a bit overkill. What it does is transparently disable the STOP key by modifying the Kernal Timer A interrupt (this runs 50 or 60 times per second to do things like keyscan). Normally this IRQ calls the Kernal UDTIM routine at $ffea to service the jiffy clock. This routine also scans for RUN/STOP and, if pressed, puts the result into $91. This routine redirects the Timer A interrupt into custom code that calls UDTIM, then overwrites the value at $91 so that RUN/STOP will never be detected, and then runs the continuation of the Timer A interrupt in the Kernal. The routine at $0830 installs the modified IRQ and the routine at $0847 disables it.

These programs are designed to be run on any 40-column PET or C64, and the routines are actually called on the PET as well, but the PET doesn't vector its IRQ and nothing actually happens.

A simpler way to do this on the 64 is to change the Kernal ISTOP vector in RAM, which is called through $ffe1. Normally this vector points to $f6ed. A POKE 808,234 will cause a nonsense value to be returned, disabling RUN/STOP and RUN/STOP-RESTORE, though it also stomps on the Y register and shortcuts other side effects of this routine which can foul up LISTing your program (though this is sometimes desirable).
 
Back
Top