Prev: 8014 Up: Map Next: 81DD
80B9: Tape loading
Used by the routine at load_stage.
tape_load_5C00 80B9 LD IX,$5C00 Setup to load a block at $5C00 of length $1AF0
80BD LD DE,$1AF0
This entry point is used by the routine at start. IX = address DE = bytes
tape_load 80C0 INC D D++
80C1 LD A,$98 A = 152
80C3 SCF Set carry flag
80C4 EX AF,AF' bank
80C5 DEC D D-- -- weird inc then dec
80C6 DI Disable interrupts
80C7 LD A,$08 Set MIC bit (deactivates MIC)
80C9 OUT ($FE),A output
80CB IN A,($FE) input
80CD RRA why shift?
80CE AND $20 Check EAR input bit 6
80D0 OR $02 set border?
80D2 LD C,A
80D3 CP A A == A ?
tape_load_5C00_0 80D4 RET NZ
tape_load_5C00_1 80D5 CALL sub_814b Call sub_814b
80D8 JR NC,tape_load_5C00_0
80DA LD HL,$0415 Delay time
tape_load_5C00_2 80DD DJNZ tape_load_5C00_2 Delay for B iterations -- is B not initialised?
80DF DEC HL HL--
80E0 LD A,H Loop while HL > 0
80E1 OR L
80E2 JR NZ,tape_load_5C00_2
80E4 CALL sub_8147 Call sub_8147
80E7 JR NC,tape_load_5C00_0
tape_load_5C00_3 80E9 LD B,$9C B = 156
80EB CALL sub_8147 Call sub_8147
This entry point is used by the routine at entrypt_48k.
tape_load_5C00_4 80EE JR NC,tape_load_5C00_0
80F0 LD A,$C6 A = 198
80F2 CP B
80F3 JR NC,tape_load_5C00_1
80F5 INC H
80F6 JR NZ,tape_load_5C00_3
tape_load_5C00_5 80F8 LD B,$C9 B = 201
80FA CALL sub_814b Call sub_814b
80FD JR NC,tape_load_5C00_0
80FF LD A,B
8100 CP $D4 212
8102 JR NC,tape_load_5C00_5
8104 CALL sub_814b Call sub_814b
8107 RET NC
8108 LD A,C A = C ^= 3
8109 XOR $03
810B LD C,A
810C LD H,$00
810E LD B,$B0 B = 176
8110 JR tape_load_5C00_11
tape_load_5C00_6 8112 EX AF,AF'
8113 JR NZ,tape_load_5C00_8 wuuuut?
8115 JR NZ,tape_load_5C00_7
tape_load_5C00_7 8117 LD (IX+$00),L
811A JR tape_load_5C00_9
tape_load_5C00_8 811C RL C
811E XOR L A ^= L
811F RET NZ
8120 LD A,C RR C and copy to A?
8121 RRA
8122 LD C,A
8123 INC DE DE++
8124 JR tape_load_5C00_10
tape_load_5C00_9 8126 INC IX
tape_load_5C00_10 8128 DEC DE
8129 EX AF,AF'
812A LD B,$B2 B = 178
tape_load_5C00_11 812C LD L,$01
tape_load_5C00_12 812E CALL sub_8147 Call sub_8147
8131 RET NC
8132 LD A,$C8 A = 200
8134 CP B
8135 RL L
8137 LD B,$B0 B = 176
8139 JP NC,tape_load_5C00_12
813C LD A,H A = H ^ L
813D XOR L
813E LD H,A Save A
813F LD A,D Loop while DE > 0
8140 OR E
8141 JR NZ,tape_load_5C00_6
8143 LD A,H Restore A
8144 CP $01 Is it 1?
8146 RET Return (with flags?)
sub_8147 8147 CALL sub_814b
814A RET NC
sub_814b 814B LD A,$16 Delay loop of 22 iterations
tape_load_5C00_13 814D DEC A
814E JR NZ,tape_load_5C00_13
8150 AND A Clear carry flag
tape_load_5C00_14 8151 INC B what's in B?
8152 RET Z Return if zero (failure)
8153 LD A,$7F %01111111
8155 IN A,($FE) Read from port
8157 RRA
8158 RET Z
8159 XOR C A ^= C
815A AND $20 check EAR input bit 6
815C JR Z,tape_load_5C00_14 loop if zero
815E LD A,C A = C = ~C
815F CPL
8160 LD C,A
8161 AND $02
8163 OR $08 Set MIC bit (deactivate MIC)
8165 OUT ($FE),A Output
8167 SCF Set carry
8168 RET Return (success)
rewind_tape 8169 DEFB $70 attr?
816A DEFW $F001 Screen position (8,64)
816C DEFW $5901 Screen attribute position (1,8)
816E DEFM "REWIND TAPE TO START OF SIDE ",$B2 "REWIND TAPE TO START OF SIDE 2"
start_tape 818C DEFB $68 attr?
818D DEFW $F04B Screen position (88,96)
818F DEFW $598B Screen attribute position (11,12)
8191 DEFM "START TAP",$C5 "START TAPE"
819B DEFB $68 attr?
819C DEFW $F089 Screen position (72,128)
819E DEFW $5A09 Screen attribute position (9,16)
searching_for_n 81A0 DEFM "SEARCHING FOR ",$B1 "SEARCHING FOR 1"
81AF DEFB $68 attr?
81B0 DEFW $F0CD Screen position (104,160)
81B2 DEFW $5A8D Screen attribute position (13,20)
found_n 81B4 DEFM "FOUND ",$B1 "FOUND 1"
stop_the_tape_press_gear 81BB DEFB $70 attr?
81BC DEFW $F04A Screen position (80,96)
81BE DEFW $598A Screen attribute position (10,12)
81C0 DEFM "STOP THE TAP",$C5 "STOP THE TAPE"
81CD DEFB $60 attr?
81CE DEFW $F08B Screen position (88,128)
81D0 DEFW $5A0B Screen attribute position (11,16)
81D2 DEFM "PRESS GEA",$D2 "PRESS GEAR"
Prev: 8014 Up: Map Next: 81DD