Load routines |
Prev: 5D17 | Up: Map | Next: 802F |
Used by the routine at 802F.
|
||||
8000 | INC SP | Place the address 0000 on the stack above the current return address, so the Spectrum will reset if there's a loading error | ||
8001 | INC SP | |||
8002 | EX (SP),HL | |||
8003 | LD H,$00 | |||
8005 | LD L,H | |||
8006 | EX (SP),HL | |||
8007 | DEC SP | |||
8008 | DEC SP | |||
8009 | LD A,$06 | |||
800B | CALL $8011 | Listen for one edge | ||
800E | RET NC | Return if no edge was found within the time limit | ||
This entry point is also used by the routine at 802F.
|
||||
800F | LD A,$0B | Wait a bit | ||
8011 | DEC A | |||
8012 | JR NZ,$8011 | |||
8014 | AND A | Reset the carry flag | ||
8015 | INC B | Have we run out of time to find an edge? | ||
8016 | RET Z | Return with the carry flag reset if so | ||
8017 | LD A,$7F | Collect an EAR port reading in bit 6 of A | ||
8019 | IN A,($FE) | |||
801B | RRA | Move it to bit 5 of A | ||
801C | AND A | In the analogous ROM routine, the instruction here is 'RET NC', causing a return if BREAK was pressed; in this routine, that behaviour is disabled (pressing BREAK does nothing) | ||
801D | XOR C | Compare this EAR port reading with the previous one | ||
801E | AND $20 | |||
8020 | JR Z,$8015 | Jump back if they are the same (i.e. no edge was found) | ||
8022 | LD A,C | Alternate the border colour | ||
8023 | CPL | |||
8024 | LD C,A | |||
8025 | AND $07 | |||
8027 | OR $08 | |||
8029 | OUT ($FE),A | |||
802B | SCF | Signal: an edge was found within the time limit | ||
802C | RET | Return with B indicating the time taken to find the edge |
Prev: 5D17 | Up: Map | Next: 802F |