Dynamite Dan | Routines |
Prev: FE79 | Up: Map | Next: FEFA |
Used by the routine at FE45. This is mainly a copy of the ROM loading routine.
|
||||
FEAB | INC D | Reset zero flag and remember AF | ||
FEAC | EX AF,AF' | |||
FEAD | DEC D | |||
FEAE | DI | Disable interrupts while loading (although they are already disabled) | ||
FEAF | LD A,$0F | Set border to white | ||
FEB1 | OUT ($FE),A | |||
FEB3 | IN A,($FE) | Read the EAR signal | ||
FEB5 | RRA | |||
FEB6 | AND $20 | |||
FEB8 | OR $02 | Add red border | ||
FEBA | LD C,A | Remember this state | ||
FEBB | CP A | Set the zero flag | ||
FEBC | RET NZ | Return if load abandoned | ||
FEBD | CALL $FF52 | Get a tape edge | ||
FEC0 | JR NC,$FEBC | Bail out if we couldn't find one | ||
FEC2 | LD HL,$0415 | Wait for a while before checking a tape signal. This length is identical to the ROM routine. | ||
FEC5 | DJNZ $FEC5 | |||
FEC7 | DEC HL | |||
FEC8 | LD A,H | |||
FEC9 | OR L | |||
FECA | JR NZ,$FEC5 | |||
FECC | CALL $FF4E | Get a tape edge again | ||
FECF | JR NC,$FEBC | Bail out if we didn't find one | ||
At this point a leading tone has been found
|
||||
FED1 | LD B,$9C | Timing constant | ||
FED3 | CALL $FF4E | Get a tape edge | ||
FED6 | JR NC,$FEBC | Bail out if there was none | ||
FED8 | LD A,$C6 | Was an edge found soon enough? | ||
FEDA | CP B | |||
FEDB | JR NC,$FEBD | No, so loop back again to find one | ||
FEDD | INC H | Increase the edge pair count | ||
FEDE | JR NZ,$FED1 | Loop back if more edge pairs need to be retrieved | ||
Get the sync pulse
|
||||
FEE0 | LD B,$C9 | Timing constant | ||
FEE2 | CALL $FF52 | Get a tape edge | ||
FEE5 | JR NC,$FEBC | Bail out if there wasn't one | ||
FEE7 | LD A,B | Were two tape edges close enough together to be considered a sync pulse? | ||
FEE8 | CP $D4 | |||
FEEA | JR NC,$FEE0 | No, so loop round and check again | ||
The tape block is in sync, so load data
|
||||
FEEC | CALL $FF52 | Get a tape edge | ||
FEEF | RET NC | Exit if there wasn't one | ||
FEF0 | LD A,C | Switch borders to blue + yellow | ||
FEF1 | XOR $03 | |||
FEF3 | LD C,A | |||
FEF4 | LD H,$00 | Initialise byte to collect | ||
FEF6 | LD B,$E1 | Timing constant. | ||
FEF8 | JR $FF12 | Jump forward to the loading routine |
Prev: FE79 | Up: Map | Next: FEFA |