Up: Map
33024: Save Skool Daze to tape
saver This is the program used to save the fast code block for Skool Daze.
Used by the routine at 32484 (which is located at 32228 before 24288 is called).
The fast code block consists of two sections of data. The first section contains the 16573 bytes of data for addresses 16384-32956. The second section contains 65535 bytes of data starting at address 32971, moving forward in steps of 23 bytes, and ending at 32925.
Note that the last three bytes in the first section (addresses 32954-32956) are actually loaded into addresses 32902, 32925 and 32948 by the load routine. Note also that the last byte in the second section, for address 32925, is not loaded by the load routine.
33024 LD IX,16384 16384 to 32956 will be saved first
33028 LD DE,16572
33031 LD A,255 A flag byte of 255 (the first byte saved) indicates a data block
33033 LD HL,3224 This constant will give a leader tone of about 2 seconds
33036 EX AF,AF'
33037 INC DE Adjust the length and start address to allow for the flag byte
33038 DEC IX
33040 DI Disable interrupts
33041 LD A,2 MIC on, border red
33043 LD B,A
First create the 2-second leader tone.
33044 DJNZ 33044
33046 OUT (254),A
33048 XOR 15
33050 LD B,164
33052 DEC L
33053 JR NZ,33044
33055 DEC B
33056 DEC H
33057 JP P,33044
Then create the sync pulse.
33060 LD B,47
33062 DJNZ 33062
33064 OUT (254),A
33066 LD A,13
33068 LD B,55
33070 DJNZ 33070
33072 OUT (254),A
It's time to save the first byte, which will be the flag byte (255).
33074 LD BC,6670 B=26 (timing constant), C=14 (MIC off, border yellow)
33077 EX AF,AF' A=255
33078 LD L,A L=255
33079 JP 33091 Jump forward to save the flag byte
This is the main byte-saving loop.
33082 LD A,D In the analagous ROM routine, the second instruction here is 'OR E', to check whether it's time to save the last byte (the parity byte)
33083 LD A,D
33084 JR Z,33098 This jump (to save the parity byte) is never made
33086 LD L,(IX+0) Fetch the next byte to be saved
33089 LD A,H A=current parity byte
33090 XOR L Update this for the next byte to be saved
33091 LD H,A H=new parity byte
33092 LD A,1 A=1 (MIC on, border blue)
33094 SCF Set the carry flag (which will act as the marker bit)
33095 JP 33121 Jump forward to save the byte
This section of code, if it were used, would save the parity byte.
33098 LD L,H Pick up the parity byte in L
33099 JR 33089 Save it
This is the bit-saving loop for the first section of data (16384-32956).
33101 LD A,C A=14 (MIC off, border yellow) for the second pass
33102 BIT 7,B Set the zero flag to indicate that this is the second pass through the loop
33104 DJNZ 33104
33106 JR NC,33112 Jump if we are saving a '0'
33108 LD B,32
33110 DJNZ 33110
33112 OUT (254),A
33114 LD B,29 Set the timing constant for the second pass
33116 JR NZ,33101 Jump back for the second pass if we've just done the first
33118 DEC B
33119 XOR A Clear the carry flag
33120 INC A A=1 (MIC on, border blue)
33121 RL L Move the bit to be saved into the carry flag, and the marker bit leftwards
33123 JP NZ,33104 Jump unless we've saved all 8 bits of the byte
A byte from the first section (16384-32956) has just been saved. Are there any more left?
33126 DEC DE Decrease the length counter
33127 INC IX Move to the next byte to be saved
33129 LD B,16 Set the timing constant for the first bit of the next byte
33131 LD A,127 Return if the BREAK key is being pressed
33133 IN A,(254)
33135 RRA
33136 RET NC
33137 LD A,D Have we saved 16384 to 32956 yet?
33138 INC A
33139 JP NZ,33082 Jump back if not
Now a further 65535 bytes are saved: starting at 32971, moving forward in steps of 23 bytes, and ending at 32925.
33142 LD A,D IX=32957 and DE=65535 the first time we get here
33143 OR E
33144 JR Z,33158 Jump if we have now saved 32971 onwards
33146 LD L,(IX+14) IX+14=32971 the first time we get here
33149 LD A,H A=current parity byte
33150 XOR L Update this for the next byte to be saved
33151 LD H,A H=new parity byte
33152 LD A,1 A=1 (MIC on, border blue)
33154 SCF Set the carry flag (which will act as the marker bit)
33155 JP 33181 Jump forward to save the byte
This is where we come when all 82108 bytes have been saved.
33158 LD L,0
33160 RET
This is the bit-saving loop for the second section of data.
33161 LD A,C A=14 (MIC off, border yellow) for the second pass
33162 BIT 7,B Set the zero flag to indicate that this is the second pass through the loop
33164 DJNZ 33164
33166 JR NC,33172 Jump if we are saving a '0'
33168 LD B,32
33170 DJNZ 33170
33172 OUT (254),A
33174 LD B,29 Set the timing constant for the second pass
33176 JR NZ,33161 Jump back for the second pass if we've just done the first
33178 DEC B
33179 XOR A Clear the carry flag
33180 INC A A=1 (MIC on, border blue)
33181 RL L Move the bit to be saved into the carry flag, and the marker bit leftwards
33183 JP NZ,33164 Jump unless we've saved all 8 bits of the byte
A byte from the second section has just been saved. Are there any more left?
33186 DEC DE Decrease the length counter
33187 EXX Move forward 23 bytes to the next byte to be saved
33188 ADD IX,BC
33190 EXX
33191 LD B,16 Set the timing constant for the first bit of the next byte
33193 LD A,127 These instructions check the BREAK key but do not act on the result
33195 IN A,(254)
33197 RRA
33198 JP 33142 Save the next byte
The last 5 bytes of the first section saved make important changes to the load routine when the game is being loaded:
32952 JR NZ,32893 This will replace the 'JR NZ,32907' at 32952, and kick off the loading of 65537 bytes from 32902 onwards (in steps of 23, all the way round to 32902 again)
32954 DEFB 32 This byte will replace the 49 at 32902, changing the instruction there from 'LD SP,23833' to 'JR NZ,32929'
32955 DEFB 221 This byte will be loaded into 32925 (which already contains 221)
32956 DEFB 173 This byte will be loaded into 32948 (which already contains 173)
Up: Map