Hi [mention]blueowl0708[/mention],
thank you for your interest in SetoLOAD
There are essentially two ways to include a fast loading scheme like SetoLOAD in your programs. I have employed both. All of them require a basic knowledge of Z80 Assembly and of the Spectrum ROM loading routine. Nothing out of this world however, as you will soon see.
This is due to the fact that you will usually need to load more than a piece of data at a time, e.g. a loading screen and one or more blocks of code, therefore you will need to insert your loading routine inside another Assembly program, which will recall the custom loading one changing the necessary references - loading address and length of the data - as needed, from block to block.
What you should always remember, anyway, is:
- any custom loader routine must be assembled in the non-contended RAM space, i.e. from address 32768 on, otherwise the loading routine's timings will go astray and loading will fail;
- for turbo blocks, timings (Pilot pulse etc.), must be set through a block editor routine. ZX-Blockeditor allows you to insert them once, then copy and paste turbo data and attach it to each block. Timings for SetoLOAD can be found in the source code.
The simplest method is to load from a BASIC program the loading routine comprehensive of the custom loading scheme. This is especially useful when you must load pieces of code into different memory banks for 128K RAM models. In this case, each block is loaded at address 49152.
In this example we load a screen image and a block of code, assembling the code to an address that must be higher than the main block end, i.e. if the main block starts at 32000 and is 18000 bytes long, then our loading program must be assembled higher than 32000+18000 = 50000. For simplicity's sake, we will also assume that none of the blocks are compressed, in that case you must also add a decompression code to the program to decompress data after loading it.
Code: Select all
ORG 64000
; The following four rows are optional. They obscure the screen so that the
; loading screen can be only seen at the end, when attributes are loaded.
LD A,0 ; (64 for BRIGHT 1)
LD (23693),A ; PAPER 0, INK 0, BRIGHT 0
LD (23624),A ; last two rows have INK and PAPER 0
CALL 3503 ; CLS
; Load the screen
LD IX,16384 ; code loading address
LD DE,6912 ; code block length in bytes
CALL SETOLOAD
; Load the code block
LD IX,32000 ; code loading address
LD DE,18000 ; code block length in bytes
CALL SETOLOAD
JP 32000 ; jump to the start of the loaded program
SETOLOAD:
[here goes the SetoLOAD routine]
This program is assembled to a tape file with an assembler (I use Pasmo 0.54 beta), and loaded through a simple BASIC program like:
10 CLEAR 31999: LOAD "" CODE : RANDOMIZE USR 64000
Another way is to load the routine directly as if it was a BASIC program. This method was used by G.B. Max (Giovanni Zanetti) for his great Biturbo/Biturbo II loading schemes, which were the first I managed to "reverse engineer". An example of this loader in action can be seen in my
Cousin Horace, the last game I made before creating SetoLOAD.
This will require the program to be assembled as a .BIN file and then to a BASIC file with BIN2DATA.EXE, an utility which assembles a machine code program into a BASIC file. A batch file I created for this purpose is CAR.BAT:
Code: Select all
@echo off
pasmo --bin %1.asm %1.bin
bin2data -org [assembly address] -rem %1.bin %1.tap
del %1.bin
If for example your program is saved as LOADING.ASM and begins at address 25000, [assembly address] must be 25000 in fact. Just type CAR LOADING at the PC command prompt and a LOADING.TAP file will be created, which can be loaded by simply entering LOAD "" on the Spectrum.
Also, the SetoLOAD code must be copied in non-contended memory to work, and must have been assembled at the required address first. So if you want SetoLOAD to stay at address 65000, first assemble it at that address as a .BIN file, otherwise it won't work.
So here is another example:
Code: Select all
SETOLOAD EQU 65000 ; we want SetoLOAD at this address
ORG 25000
; The following four rows are optional etc.
LD A,0 ; (64 for BRIGHT 1)
LD (23693),A ; PAPER 0, INK 0, BRIGHT 0
LD (23624),A ; last two rows have INK and PAPER 0
CALL 3503 ; CLS
LD HL,SL ; We want the SetoLOAD routine copied from this address...
LD DE,SETOLOAD ; ...to this.
LD BC,178 ; length in bytes of the "SetoLOAD.bin" file
LDIR ; copy the routine
LD IX,16384 ; load screen
LD DE,6912
CALL SETOLOAD
LD IX,32000 ; load code
LD DE,18000
CALL SETOLOAD
JP 32000 ; jump to the start of the loaded program
SL: INCBINE "SetoLOAD.bin"
That's how it works basically, feel free to ask if you want to know more.