PENETRATOR is an older arcade tame for the TS2068, that was put out by Timex in 1983. It is readily converted to Larken disk operation. Simply use a Header Reader to locate the program code; and inspect the front end Basic to find the start USR address.
However the program contains a Landscape Editor to allow you to modify the game. This Editor also allows you to save the modified landscapes code to tape, and to reload it. The challenge was to convert this feature to the Larken system.
The program code proved difficult to break out of, once the game was started. Often it is possible to break out of a m/c program by using the NMI-button and either pressing the A key or doing a SAVE to a protected disk. However, in this case every use of the NMI-button resulted in a system crash. This was going to make things difficult.
With Spectrum programs the first thing I usually do is to search for a CALL to a LOAD routine in the ROM. I do a FOR/NEXT loop looking for appearances of a 205, followed by an 86 and a 5. In the Spectrum parlance this could mean a CALL to address 1366, the start of the Spectrum LOAD routine. In this case it was a TS2068 program, so that meant complications since the SAVE/LOAD routines for the TS2068 are in the EXROM. I found that the program could be loaded, and would work in both the Spectrum and the TS2068 modes. This meant that the SAVE/LOAD routines were not in the ROM at all, but were imbedded in the program itself.
Since there was not likely to be any call to address 1366, and the location of the LOAD/SAVE routines were unknown, I then looked for a LD IX instruction (221) in the code, again using a FOR/NEXT loop. The LD IX instruction is used as a preface to most every SAVE and LOAD instruction. I wrote the FOR/NEXT loop so that every time it encountered an address containing a 221 it would print out a value based on the contents of the next two addresses. I multiplied contents of the higher-numbered address by 256 and added it to the contents of the lower address. If there was an LD IX used in a LOAD or SAVE routine this would give me a starting address. I’m looking for clues.
I found quite a number of promising addresses. I Then loaded a disassembler at address 48000 (the disassembler “spec48.Cc” found on the club Larken disk #17). In loading, it overwrote part of the program code, but I guessed that the code we wanted to look at was below address 48000. If it had been higher I would have loaded “spec28.Cc” at 28000. I looked over the addresses and identified several promising ones. They contained sequences of LD A, 0 ; LD IX 47117; and LD DE, 7376. These are hot prospects for SAVE/LOAD m/c routines.
When I reloaded the program code, and then did a series of USR calls to these addresses I produced tape LOAD and tape SAVE effects. I explored the code further and found a USR call that would produce the screen instructions for the SAVE and LOAD actions. I was hot on the trail!
My first thought was to have the program exit to Basic to do the load and save routines from Basic. However I could not seem to exit gracefully from the program; my understanding of m/c programming leaves something to be desired! What I then decided to do was to employ a variation of a m/c routine that I had used earlier in the program SNODGITS. I would arrange that the program, instead of calling up the tape routines, would call up my own disk-save and disk-load routines. The PENETRATOR program code started at 32768, so I chose to locate my code at 32000.
Now, the disk routines require that a name be given to the program to be saved. What better than to make use of the name that one enters at the Editor portion of the program. This is fine, but now it was necessary to locate where the name was stored in the program code. I loaded the program, ran it, went into the landscape editor SAVE mode, entered a name, and just prior to the tape-SAVE I did an NMI-save. I had to do this because there was no way that I could break out of a running program. What I therefore planned to do was to inspect the program using the “doctor.B1” program (“doctor.B1” is a Larken utility on the club Larken disk #1).
Now, I had a fairly good idea of where the landscape name might be located. Earlier, when I did an experimental SAVE of a landscape, and had tried to read the header, I found that it was an unusual header. I won’t go into details about it, except to say that I found the word “GARBAGE” in it. I therefore did a search for this word in the program, using the ASCII printout feature of the “spec48.Cc” disassembler program. I had located it at about address 47126, so I explored that area, with “doctor.B1”, as I mentioned. And was successful.
I found there was space reserved for a 6-character name at address 47117. I decided to POKE a “.C1” in the three addresses immediately following the name. These addresses contained the start of the word “GARBAGE” I mentioned earlier. I reasoned that this was likely to be unused in the Larken mode. I found that the program would accept only 6-character names. That is to say, when the programs asked for a name it would only act on the first 6 characters. This, added to the “.C1” that I placed in the program would make up a proper Larken name.
I also went through the program and changed several instruction sequences which referred to TAPE, making them DISK. I ignored the tape verification routine, though it could have been deleted.
The disk LOAD/SAVE routine used in the SNODGIT program had to be modified to suit this particular application. I wrote separate disk SAVE and LOAD routines; and modified the PENETRATOR code addresses 46650 (LOAD), and 46843 (SAVE) to CALL the appropriate routine. Why those two addresses? Well, these were the addresses of the CALLs to the tape SAVE and LOAD routines, so I simply did a redirect to my disk routines.
Now, the Larken SAVE routine requires that the starting address and length of the code to be saved (and loaded) be specified. Because of the unusual nature of the tape SAVE headers it was not possible to determine this information from the tape headers. A close look at the tape SAVE routine in the PENETRATOR code showed a LD IX, 53248 and a LD DE, 7376. These could indicate a starting address 53248 and code length of 7376 bytes and seemed promising. The code contained other possible numbers, however the above were put into the ‘disk’ code, and proved to be correct.
The Disk code was arranged so that after a SAVE or a LOAD function was completed, a JUMP was made to address 32768, the start of the program. This was similar to the original program operation.
That was about it except to do a SAVE of the new code block 32000,33535 that included the modified program code plus the two disk routines.
10 FOR n=32000 TO 32128
20 READ a: POKE n,a
50 NEXT n
100 DATA 195,0,128,0,0,0,205,30
,125,195,0,128,0,0,0
101 DATA 205,80,125,195,0,128,0
,0,0,0,0,0,0,0,0
102 DATA 243,0,205,98,0,33,13,1
84,17,34,32,1,10,0,237
103 DATA 176,62,11,50,2,32,205,
198,0,33,0,208,34,51,32
104 DATA 33,208,28,34,49,32,205
,201,0,58,100,0,251,201,0
105 DATA 0,0,0,0,0,0,243,0,205,
98,0,33,13,184,17
106 DATA 34,32,1,10,0,237,176,6
2,11,50,2,32,205,204,0
107 DATA 33,0,208,34,51,32,33,2
08,28,34,49,32,205,207,0
108 DATA 58,100,0,251,201,0,0,0
,0,0,0,0,0,0,0
47112 79 O 47113 82 R 47114 84 T 47115 41 ) 47116 0 47117 0 47118 0 47119 0 47120 0 47121 0 47122 0 47123 46 . 47124 67 C 47125 49 1 47126 28 47127 71 G 47128 65 A 47129 82 R 47130 66 B 47131 65 A 47132 71 G 47133 69 E 46650 205 46651 6 46652 125 46653 48 46654 36 46843 205 46844 15 46845 125 46846 6 46847 50
31999 00 NOP
32000 C30080 JP 32768
32003 00 NOP
32004 00 NOP
32005 00 NOP
32006 CD1E7D CALL 32030
32009 C30080 JP 32768
32012 00 NOP
32013 00 NOP
32014 00 NOP
32015 CD507D CALL 32080
32018 C30080 JP 32768
32021 00 NOP
32022 00
//
NOP
NOP
32030 F3 DI
32031 00 NOP
32032 CD6200 CALL 98
32035 210DB8 LD HL,47117
32038 112220 LD DE,8226
32041 010A00 LD BC,10
32044 EDB0 LDIR
32046 3E0B LD A,11
32048 320220 LD (8194),A
32051 CDC600 CALL 198
32054 2100D0 LD HL,53248
32057 223320 LD (8243),HL
32060 21D01C LD HL,7376
32063 223120 LD (8241),HL
32066 CDC900 CALL 201
32069 3A6400 LD A,(100)
32072 FB EI
32073 C9 RET
32074 00
//
NOP
32081 F3 DI
32082 00 NOP
32083 CD6200 CALL 98
32086 210DB8 LD HL,47117
32089 112220 LD DE,8226
32092 010A00 LD BC,10
32095 EDB0 LDIR
32097 3E0B LD A,11
32099 320220 LD (8194),A
32102 CDCC00 CALL 204
32105 2100D0 LD HL,53248
32108 223320 LD (8243),HL
32111 21D01C LD HL,7376
32114 223120 LD (8241),HL
32117 CDCF00 CALL 207
32120 3A6400 LD A,(100)
32123 FB EI
32124 C9 RET
32125 00 NOP
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.