Worked Example
Quick example to show how to convert a .TAP tape
To convert Manic Miner type:
tapondsk "Manic Miner (1983)(Bug-Byte).tap"
This will create a DISK file with the following output:
+-------------------------------------------------------------------------------
| TAPonDSK v1.0e © 2020 Tom Dalby
+-------------------------------------------------------------------------------
| TAP File Scan
+-------------------------------------------------------------------------------
| # | Details
|-----+-------------------------------------------------------------------------
| 1 | Program: "ManicMiner" LINE 1 (L1:78,V:+78,C:0x14) (L2:80,C:0xc7)
| 2 | Code: "mm1 " 22528, 768 (C:0xc9) (L2:770,C:0x39)
| 3 | Code: "MM2 " 32768, 32768 (C:0x91) (L2:32770,C:0x71)
+-------------------------------------------------------------------------------
| Checking for LOAD redirection in BASIC
| - #2 Found LOAD CODE -> CODE location not specified so 22528 OK
| - #3 Found LOAD CODE -> CODE location not specified so 32768 OK
+-------------------------------------------------------------------------------
| Modifying Tape BASIC for Disk
| - Found LOAD, adding in new filename "MANICMIN.0"
| - Found LOAD, adding in new filename "MANICMIN.1"
| - L1:98, V:+98
| - Adding Disk Motor Stop PAUSE & USR 0 Mode Switch.
+-------------------------------------------------------------------------------
| Decoding Tape BASIC (L1:78, V:+78)
+-------------------------------------------------------------------------------
| # | LSZE | LNUM | BASIC
|-----+------+------+-----------------------------------------------------------
| 001 | 13 | 10 | CLEAR 30000
| 002 | 39 | 20 | BORDER 0: PAPER 0: INK 0: CLS : LOAD ""CODE : LOAD ""CODE
| 003 | 14 | 30 | RANDOMIZE USR 33792
+-------------------------------------------------------------------------------
| Replaced 2 LOADs, Need 2.
| Bank Switching ON
| Decoding New Disk BASIC (L1:149)
+-------------------------------------------------------------------------------
| # | LSZE | LNUM | BASIC
|-----+------+------+-----------------------------------------------------------
| 001 | 13 | 10 | CLEAR 30000
| 002 | 76 | 20 | BORDER 0: PAPER 0: INK 0: CLS : LOAD "MANICMIN.0"CODE :
| | | | LOAD "MANICMIN.1"CODE : PAUSE CODE "d": RANDOMIZE USR
| | | | VAL "23875"
| 003 | 14 | 30 | RANDOMIZE USR 33792
| 004 | 37 | 9999 | REM NEXT *=\#6.+6.+6.+6v+6.+6Q RANDOMIZE CLEAR THEN .
| | | | INKEY$ CLS <> STEP STEP STEP STEP STEP STEP STEP
+-------------------------------------------------------------------------------
| BASIC Top: 23903
| Checking for best CLEAR Value(s)
| - BASIC CLEAR is OK @ 30000
| - DISK Loader CLEAR OK @ 24575.
+-------------------------------------------------------------------------------
| DSK Name: MANICMIN
| - Writing BASIC: "DISK " [44]
| - Writing BASIC: "MANICMIN " [149 V:149]
| - Writing CODE: "MANICMIN0" [768]
| - Writing CODE: "MANICMIN1" [32768]
| Writing out Disk: Manic Miner (1983)(Bug-Byte).DSK
+-------------------------------------------------------------------------------
This is probably the easiest type of tape to convert as it is very straight forward with no funky BASIC.
Note the added REM statement at line 9999 is the USR 0 switch and also notice the PAUSE added to switch
off the disk Motor.
Now for a more complex title, let us try BMX Simulator. Again type:
tapondsk "BMX Simulator (1987)(Code Masters)(48K-128K).tap"
Now this title has 2 Headerless CODE blocks so the utility scans the BASIC and M/C before these blocks
to find Tape Load ROM calls. As you can see from the output it successfully finds these in the 1st CODE
block loaded and replaces the CALLs with a custom DISK Loader. I've done it this way to keep the
loader in tact so any copying or setting up remains as is to improve compatibility.
+-------------------------------------------------------------------------------
| TAPonDSK v1.0e © 2020 Tom Dalby
+-------------------------------------------------------------------------------
| TAP File Scan
+-------------------------------------------------------------------------------
| TAP File Scan
+-------------------------------------------------------------------------------
| # | Details
|-----+-------------------------------------------------------------------------
| 1 | Program: "BMX " LINE 0 (L1:44,V:+44,C:0x77) (L2:46,C:0x7f)
| 2 | Code: " " 65500, 34 (C:0x82) (L2:36,C:0x80)
| 3 | HL Data Block: ?????, 6912 (L2:6914,C:0x74)
| 4 | HL Data Block: ?????, 40600 (L2:40602,C:0x43)
+-------------------------------------------------------------------------------
| Checking for LOAD redirection in BASIC
| - #2 Found LOAD CODE -> CODE location not specified so 65500 OK
+-------------------------------------------------------------------------------
| Headerless CODE blocks found. Scanning BASIC & M/C to determine Start Pos.
| - Found 0 Start(s) in BASIC
| - JP Not Found & SP Not Found
| - Found 2 Start(s) in CODE Block File 2
| - Found JP 47500 & SP Not Found
+-------------------------------------------------------------------------------
| HL# | Updated Details
|-----+-------------------------------------------------------------------------
| 2 | CODE: "" 16384,6912
| 3 | CODE: "" 24900,40600
+-------------------------------------------------------------------------------
| Modifying Tape BASIC for Disk
| - Found LOAD, adding in new filename "BMX.0"
| - L1:49, V:+49
| Decoding Tape BASIC (L1:44, V:+44)
+-------------------------------------------------------------------------------
| # | LSZE | LNUM | BASIC
|-----+------+------+-----------------------------------------------------------
| 001 | 13 | 10 | CLEAR 24900
| 002 | 5 | 20 | LOAD ""CODE
| 003 | 14 | 30 | RANDOMIZE USR 65500
+-------------------------------------------------------------------------------
+-------------------------------------------------------------------------------
| 2 Headerless Blocks Found, scanning previous m/c for loader...
| - Redirecting Headerless Tape Calls to 23809.
| - Headerless File 1 -> F:2 @11 -> 0xcd 0x0556 to 0xcd 0x5d01
| - Headerless File 2 -> F:2 @26 -> 0xcd 0x0556 to 0xcd 0x5d01
+-------------------------------------------------------------------------------
| Replaced 1 LOADs, Need 1.
| Decoding New Disk BASIC (L1:136)
+-------------------------------------------------------------------------------
| # | LSZE | LNUM | BASIC
|-----+------+------+-----------------------------------------------------------
| 001 | 13 | 10 | CLEAR 24900
| 002 | 10 | 20 | LOAD "BMX.0"CODE
| 003 | 14 | 30 | RANDOMIZE USR 65500
| 004 | 83 | 9999 | REM NEXT . CLEAR ¸>. GO SUB y2\[ CLS INVERSE RESTORE
| | | | MERGE STEP ..CODE W_go STEP ?....PY!G] STEP ..!P]4...
| | | | MOVE LLIST STEP .... STEP .. STEP .. NEXT . CLEAR ¸>.
| | | | GO SUB y2\[ CLS <>BMX .1 COPY .
+-------------------------------------------------------------------------------
| BASIC Top: 23890
| Checking for best CLEAR Value(s)
| - BASIC CLEAR is OK @ 24900
| - DISK Loader CLEAR OK @ 24575.
+-------------------------------------------------------------------------------
| DSK Name: BMX
| - Writing BASIC: "DISK " [44]
| - Writing BASIC: "BMX " [136 V:136]
| - Writing CODE: "BMX 0" [34]
| - Writing CODE: "BMX 1" [6912]
| - Writing CODE: "BMX 2" [40600]
| Writing out Disk: BMX Simulator (1987)(Code Masters)(48K-128K).DSK
+-------------------------------------------------------------------------------
Now the REM statement at line 9999 is the custom disk loader and not the USR 0 switch which is now
not possible. You are also unable to turn bank switching off as the loader needs switching to remain
on to work.
Ok so let us get a little more complex. For a Spectrum +3 memory area 0x5B00 to 0x5C00 is used for
storing 3DOS variables. As such you cannot overwrite it during the load and unfortunately a lot
of tape loaders do exactly this including the Ultimate Play the Game titles. If the utility encounters
one of these it abandons the original BASIC loader and builds a custom version which copies this memory
area at the end of load once 3DOS has finished.
Let us try Atic Atac. Again type:
tapondsk "Atic Atac (1983)(Ultimate Play The Game).tap"
This will start as normal but after the initial scan will determine that the 3DOS area is being overwritten.
It immediately flips into building the custom loader. One thing to note is that the custom loader
automatically turns off the bank switching, the -o option now actually turns it back on if required.
+-------------------------------------------------------------------------------
| TAPonDSK v1.0e © 2020 Tom Dalby
+-------------------------------------------------------------------------------
| TAP File Scan
+-------------------------------------------------------------------------------
| # | Details
|-----+-------------------------------------------------------------------------
| 1 | Program: "ATIC " LINE 0 (L1:388,V:+388,C:0x1f) (L2:390,C:0x84)
| 2 | Code: "ATSP " 16384, 6912 (*P2:388,C:0xcb) (L2:6914,C:0x90)
| 3 | Code: "0 " 24575, 30209 (*P2:388,C:0x41) (L2:30211,C:0xae)
| 4 | Code: "1 " 23424, 18 *3DOS (*P2:388,C:0x5e) (L2:20,C:0x98)
| 5 | Code: "2 " 23728, 1 (*P2:388,C:0x79) (L2:3,C:0x16)
| 6 | Code: "3 " 23672, 2 (*P2:388,C:0xb3) (L2:4,C:0xee)
+-------------------------------------------------------------------------------
| Checking for LOAD redirection in BASIC
| - #2 Found LOAD SCREEN$ -> 16384 Compared to 16384
| - #3 Found LOAD CODE -> CODE location not specified so 24575 OK
| - #4 Found LOAD CODE -> CODE location not specified so 23424 OK
| - #5 Found LOAD CODE -> CODE location not specified so 23728 OK
| - #6 Found LOAD CODE -> CODE location not specified so 23672 OK
+-------------------------------------------------------------------------------
| CODE block in File 4 overwrites the 3DOS buffers @ 0x5B00 to 0x5BFF. This will
| cause the disk load to fail. It might be possible to build a Custom Loader...
+-------------------------------------------------------------------------------
| # | LSZE | LNUM | BASIC
|-----+------+------+-----------------------------------------------------------
| 001 | 384 | 0 | CLEAR 24574: BEEP .1,1: BEEP .1,2: BEEP .1,3: BEEP .1,4:
| | | | BEEP .1,5: PAPER 0: BORDER 0: INK 7: BRIGHT 1: CLS :
| | | | PRINT BRIGHT 1; INK 7;AT 9,6;"ATIC ATAC IS LOADING";AT 1
| | | | 2,10;"[IV1]PLEASE WAIT"[IV0]: PRINT AT 0,0: LOAD ""
| | | | SCREEN$ : INK 0: PAPER 0: PRINT AT 6,0: LOAD ""CODE :
| | | | PRINT AT 6,0: LOAD ""CODE : PRINT AT 6,0: LOAD ""CODE :
| | | | PRINT AT 6,0: LOAD ""CODE : PRINT USR 23424
+-------------------------------------------------------------------------------
| Scanning BASIC for CLEAR and USR
| - Found CLEAR: 24574 (24574)
| - Found USR: 23424 (23424
+-------------------------------------------------------------------------------
| + F:2 16384, 6912
| + F:4 23424, 18
| + F:6 23672, 2
| + F:5 23728, 1
| + F:3 24575,30209
| #1 (1) 16384 -> (16384,6912) -> 6912 (P:0) (O:0)
| #2 (4) 23296 -> (23424,18)(23672,2)(23728,1)(24575,30209) -> 1280 (P:1258) (O:30208)
| #3 (0) 24576 -> 30208 (P:0) -> 54784
| Custom loader:
| - CODE 16384,38400 + SP 24574 + JP 23424
| - Bank Switching OFF
+-------------------------------------------------------------------------------
| DSK Name: ATIC
| - Writing BASIC: "DISK " [44]
| - Writing BASIC: "ATIC " [145]
| - Writing CODE: "ATIC 0" [38400]
| Writing out Disk: Atic Atac (1983)(Ultimate Play The Game).DSK
+-------------------------------------------------------------------------------
There are some other options which can help with things like removing files in the tape which are not needed
and cause the conversion to fail, and removing lines from the BASIC loader which are again not required and may
cause issues. I got Warlock of Firetop Mountain to work by removing a lot of the BASIC loader before conversion.