*
* Hostage
*
* (c) 1990, Infogrames / Mindscape
* (s) 2020, Antoine Vignau
*

*-----------------------
		
	 mx	%00
	 rel
	 lst	off

	 use	SCROLUS.X.S
	 
*-----------------------

	use	4/Event.Macs
	use	4/Locator.Macs
	use	4/Mem.Macs
	use	4/Misc.Macs
	use	4/QD.Macs
	use	4/Sound.Macs
	use	4/Util.Macs
	
*-----------------------

L110000  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00A8
         TCS
         LDA   $FF
         PHA
         LDA   #$0012
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L032B57
         LDX   #^L032B57
         JSL   L010410
         JSL   L050068
         PLY
         PLY
         STA   $AE
         LDA   $AE
         SEC
         SBC   #$0000
         BVS   L110039
         EOR   #$8000
L110039  BMI   L11003E
         BRL   L1100B1
L11003E  PEA   $0006
         PEA   $0000
         TDC
         CLC
         ADC   #$00B2
         PHA
         PEI   $AE
         JSL   L0500BA
         PLY
         PLY
         PLY
         PLY
         LDA   $B4
         XBA
         STA   $B4
         LDA   $B6
         XBA
         STA   $B6
         LDA   $B6
         PHA
         LDA   $B4
         SEC
         JSL   L01059C
         PLA
         ASL
         STA   $B0
         LDA   $B0
         LDX   #$0000
         PHX
         PHA
         JSL   L070000
         PLY
         PLY
         STX   L0200F9
         STA   L0200F7
         PEI   $B0
         LDX   L0200F9
         LDA   L0200F7
         PHX
         PHA
         PEI   $AE
         JSL   L0500BA
         PLY
         PLY
         PLY
         PLY
         LDX   L0200F9
         LDA   L0200F7
         STX   $AC
         STA   $AA
         LDY   $B0
         DEY
         DEY
L1100A1  LDA   [$AA],Y
         LSR
         STA   [$AA],Y
         DEY
         DEY
         BPL   L1100A1
         PEI   $AE
         JSL   L050110
         PLY
L1100B1  LDA   $FF
         PHA
         LDA   #$0012
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L032B69
         LDX   #^L032B69
         JSL   L010410
         JSL   L050068
         PLY
         PLY
         STA   $AE
         LDA   $AE
         SEC
         SBC   #$0000
         BVS   L1100DF
         EOR   #$8000
L1100DF  BPL   L11012A
         PEA   $0022
         PEA   $0000
         TDC
         CLC
         ADC   #$00B2
         PHA
         PEI   $AE
         JSL   L0500BA
         PLY
         PLY
         PLY
         PLY
         LDA   $B2
         LSR
         STA   $B0
         LDA   $B0
         LDX   #$0000
         PHX
         PHA
         JSL   L070000
         PLY
         PLY
         STX   L0200FD
         STA   L0200FB
         PEI   $B0
         LDX   L0200FD
         LDA   L0200FB
         PHX
         PHA
         PEI   $AE
         JSL   L0500BA
         PLY
         PLY
         PLY
         PLY
         PEI   $AE
         JSL   L050110
         PLY
L11012A  TSC
         CLC
         ADC   #$0050
         TCS
         PLD
         RTL

L110132  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F0
         TCS
         STZ   $F4
         BRA   L11018A
L110141  STZ   $F2
         BRA   L11017B
L110145  LDA   $F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $F4
         PHA
         LDA   #$0012
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L032BCF
         LDX   #^L032BCF
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0000
         STA   [$F6]
         INC   $F2
L11017B  LDA   $F2
         SEC
         SBC   #$0009
         BVS   L110186
         EOR   #$8000
L110186  BPL   L110145
         INC   $F4
L11018A  LDA   $F4
         SEC
         SBC   #$0003
         BVS   L110195
         EOR   #$8000
L110195  BPL   L110141
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L11019F  ENT
         PHD
         TSC
         SEC
         SBC   #$00F3
         TCD
         ADC   #$00E2
         TCS
         PEA   $FFFF
         PEA   $00E1
         PEA   $2000
         PEA   $00E1
         PEA   $2000
         JSL   L150000
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   $FB
         CLC
         ADC   $FF
         STA   $E6
         STZ   $E8
         STZ   $E4
         STZ   $EC
         BRA   L110221
L1101D1  PEI   $E4
         LDA   $FB
         CLC
         ADC   $E8
         PHA
         LDA   $F9
         CLC
         ADC   $FD
         PHA
         LDA   $FB
         CLC
         ADC   $E8
         PHA
         PEI   $F9
         JSL   L150098
         PLY
         PLY
         PLY
         PLY
         PLY
         PEI   $E4
         LDA   $E6
         SEC
         SBC   $E8
         PHA
         LDA   $F9
         CLC
         ADC   $FD
         PHA
         LDA   $E6
         SEC
         SBC   $E8
         PHA
         PEI   $F9
         JSL   L150098
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   $E8
         CLC
         ADC   #$0002
         STA   $E8
         PEA   $03E8
         JSL   L140D0A
         PLY
         INC   $EC
L110221  LDA   #$0004
         PHA
         LDA   $FF
         SEC
         JSL   L01041B
         PLY
         SEC
         SBC   $EC
         BVS   L110235
         EOR   #$8000
L110235  BMI   L1101D1
         LDA   $E8
         SEC
         SBC   #$0002
         STA   $E8
         STZ   $EC
         BRA   L1102A3
L110243  PEI   $E4
         LDA   $FB
         CLC
         ADC   $E8
         CLC
         ADC   #$0001
         PHA
         LDA   $F9
         CLC
         ADC   $FD
         PHA
         LDA   $FB
         CLC
         ADC   $E8
         CLC
         ADC   #$0001
         PHA
         PEI   $F9
         JSL   L150098
         PLY
         PLY
         PLY
         PLY
         PLY
         PEI   $E4
         LDA   $E6
         SEC
         SBC   $E8
         SEC
         SBC   #$0001
         PHA
         LDA   $F9
         CLC
         ADC   $FD
         PHA
         LDA   $E6
         SEC
         SBC   $E8
         SEC
         SBC   #$0001
         PHA
         PEI   $F9
         JSL   L150098
         PLY
         PLY
         PLY
         PLY
         PLY
         LDA   $E8
         CLC
         ADC   #$0002
         STA   $E8
         PEA   $03E8
         JSL   L140D0A
         PLY
         INC   $EC
L1102A3  LDA   #$0004
         PHA
         LDA   $FF
         SEC
         JSL   L01041B
         PLY
         SEC
         SBC   $EC
         BEQ   L1102BB
         BVS   L1102B9
         EOR   #$8000
L1102B9  BMI   L110243
L1102BB  PEA   $FFFF
         PEA   $00E1
         PEA   $2000
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         JSL   L150000
         PLY
         PLY
         PLY
         PLY
         PLY
         TSC
         CLC
         ADC   #$0010
         TCS
         PLD
         RTL

         PHD
         TSC
         SEC
         SBC   #$00ED
         TCD
         ADC   #$00E0
         TCS
L1102E8  LDA   L020027
         AND   #$00FF
         BNE   L1102FA
         LDA   L020029
         AND   #$00FF
         BEQ   L1102FA
         BRA   L1102E8
L1102FA  JSL   L040635
         PEA   $00C8
         PEA   $0000
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         PEA   $0000
         PEA   $00E1
         PEA   $2000
         JSL   L16081A
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDX   L020064
         LDA   L020062
         STX   L02008A
         STA   L020088
         LDX   L020060
         LDA   L02005E
         STX   L02008E
         STA   L02008C
         JSL   L160484
         PEI   $F5
         PEI   $F3
         PEI   $F9
         PEI   $F7
         JSL   L1607F3
         PLY
         PLY
         PLY
         PLY
         LDA   $FF
         BNE   L110361
         LDX   L02008E
         LDA   L02008C
         PHX
         PHA
         JSL   L1605C8
         PLY
         PLY
         BRA   L11036F
L110361  LDX   L02008A
         LDA   L020088
         PHX
         PHA
         JSL   L1605C8
         PLY
         PLY
L11036F  TSC
         CLC
         ADC   #$000C
         TCS
         PLD
         RTL

L110377  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00F0
         TCS
         LDA   $FF
         BRL   L1106EC
L110387  PEA   $0000
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         LDX   L020060
         LDA   L02005E
         PHX
         PHA
         JSL   L150060
         PLY
         PLY
         PLY
         PLY
         PLY
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1607F3
         PLY
         PLY
         PLY
         PLY
         JSL   L160484
         JSL   L070062
         LDX   L020060
         LDA   L02005E
         PHX
         PHA
         JSL   L1605C8
         PLY
         PLY
         BRL   L1106FA
L1103D4  PEA   $0000
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         LDX   L020060
         LDA   L02005E
         PHX
         PHA
         JSL   L150060
         PLY
         PLY
         PLY
         PLY
         PLY
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1607F3
         PLY
         PLY
         PLY
         PLY
         JSL   L160484
         JSL   L070062
         LDX   L020060
         LDA   L02005E
         PHX
         PHA
         JSL   L1605C8
         PLY
         PLY
         BRL   L1106FA
L110421  PEA   $00B2
         PEA   $0000
         JSL   L1507AF
         PLY
         PLY
         PEA   $0000
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         LDX   L020064
         LDA   L020062
         PHX
         PHA
         JSL   L150060
         PLY
         PLY
         PLY
         PLY
         PLY
         JSL   L160484
         LDA   $FD
         AND   #$8000
         TAY
         BEQ   L110458
         BRL   L1104BF
L110458  PEI   $FD
         JSL   L0D09CE
         PLY
         PEA   $0000
         LDAL  L0316C6
         PHA
         LDAL  L0316C4
         PHA
         JSL   L170184
         PLY
         PLY
         PLY
         LDX   L0200BD
         LDA   L0200BB
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         PEA   $00B3
         PEA   $0000
         PEA   $0000
         JSL   L130695
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDX   L0200BD
         LDA   L0200BB
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         PEA   $00B2
         PEA   $00E8
         PEA   $0001
         JSL   L130695
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         BRA   L1104CA
L1104BF  LDA   $FD
         AND   #$7FFF
         PHA
         JSL   L06017D
         PLY
L1104CA  PEA   $0001
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         JSL   L150729
         PLY
         PLY
         PLY
         PLY
         PLY
         JSL   L070062
         LDX   L020086
         LDA   L020084
         PHX
         PHA
         JSL   L1605C8
         PLY
         PLY
         BRL   L1106FA
L1104FB  PEA   $0000
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         LDX   L020064
         LDA   L020062
         PHX
         PHA
         JSL   L150060
         PLY
         PLY
         PLY
         PLY
         PLY
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1607F3
         PLY
         PLY
         PLY
         PLY
         JSL   L160484
         JSL   L070062
         LDX   L020064
         LDA   L020062
         PHX
         PHA
         JSL   L1605C8
         PLY
         PLY
         BRL   L1106FA
L110548  PEA   $0000
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         LDX   L020064
         LDA   L020062
         PHX
         PHA
         JSL   L150060
         PLY
         PLY
         PLY
         PLY
         PLY
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1607F3
         PLY
         PLY
         PLY
         PLY
         JSL   L160484
         JSL   L070062
         LDX   L020064
         LDA   L020062
         PHX
         PHA
         JSL   L1605C8
         PLY
         PLY
         BRL   L1106FA
L110595  PEA   $0000
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         LDX   L020064
         LDA   L020062
         PHX
         PHA
         JSL   L150060
         PLY
         PLY
         PLY
         PLY
         PLY
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1607F3
         PLY
         PLY
         PLY
         PLY
         PEA   $00B2
         PEA   $0000
         JSL   L1507AF
         PLY
         PLY
         JSL   L160484
         PEI   $FD
         JSL   L0D09CE
         PLY
         PEA   $0000
         LDAL  L0316C6
         PHA
         LDAL  L0316C4
         PHA
         JSL   L170184
         PLY
         PLY
         PLY
         LDX   L0200BD
         LDA   L0200BB
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         PEA   $00B3
         PEA   $0000
         PEA   $0000
         JSL   L130695
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDX   L0200BD
         LDA   L0200BB
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         PEA   $00B2
         PEA   $00E8
         PEA   $0001
         JSL   L130695
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         PEA   $0001
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         JSL   L150729
         PLY
         PLY
         PLY
         PLY
         PLY
         JSL   L070062
         LDX   L020086
         LDA   L020084
         PHX
         PHA
         JSL   L1605C8
         PLY
         PLY
         BRL   L1106FA
L11066F  JSL   L160484
         PEA   $0000
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDX   L020060
         LDA   L02005E
         PHX
         PHA
         JSL   L150060
         PLY
         PLY
         PLY
         PLY
         PLY
         JSL   L070062
         LDX   L020060
         LDA   L02005E
         PHX
         PHA
         JSL   L1605C8
         PLY
         PLY
         BRL   L1106FA
L1106A4  JSL   L160484
         PEI   $FD
         JSL   L0D09CE
         PLY
         PEI   $FD
         JSL   L0D093C
         PLY
         LDX   L020086
         LDA   L020084
         PHX
         PHA
         JSL   L1605C8
         PLY
         PLY
         BRL   L1106FA
L1106C7  BRL   L1106FA
L1106CA  DA    L110548
         DA    L110387
         DA    L110387
         DA    L1106A4
         DA    L1104FB
         DA    L1103D4
         DA    L11066F
         DA    L110421
         DA    L1104FB
         DA    L11066F
         DA    L1103D4
         DA    L110421
         DA    L1106C7
         DA    L110387
         DA    L110387
         DA    L110595
         DA    L1106C7
L1106EC  DEC
         CMP   #$0010
         BCC   L1106F5
         LDA   #$0010
L1106F5  ASL
         TAX
         JMP   (L1106CA,X)

L1106FA  SEP   #$20
         STZ   L0200AA
         REP   #$20
L110701  JSL   L160000
         TAY
         BEQ   L11070A
         BRA   L110701
L11070A  SEP   #$20
         STZ   L0200A8
         REP   #$20
L110711  JSL   L160143
         TAY
         BEQ   L11071A
         BRA   L110711
L11071A  STZ   L020041
         STZ   L02003F
         STZ   L02003D
         LDA   #$0001
         SEP   #$20
         STA   L0200B8
         REP   #$20
         LDA   #$0001
         STA   L020050
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L11073B  ENT
         PHD
         TSC
         SEC
         SBC   #$00F3
         TCD
         ADC   #$00EC
         TCS
         LDA   [$FD]
         SEC
         SBC   #$0000
         BVS   L110751
         EOR   #$8000
L110751  BMI   L11077D
         LDA   [$F9]
         SEC
         SBC   #$FFF8
         BEQ   L110776
         BVS   L110760
         EOR   #$8000
L110760  BPL   L110776
         JSL   L0703A5
         AND   #$0001
         PHA
         LDA   [$F9]
         PLX
         STX   $F2
         SEC
         SBC   $F2
         STA   [$F9]
         BRA   L11077B
L110776  LDA   #$0001
         STA   [$FD]
L11077B  BRA   L1107A3
L11077D  LDA   [$F9]
         SEC
         SBC   #$0008
         BVS   L110788
         EOR   #$8000
L110788  BMI   L11079E
         JSL   L0703A5
         AND   #$0001
         PHA
         LDA   [$F9]
         PLX
         STX   $F2
         CLC
         ADC   $F2
         STA   [$F9]
         BRA   L1107A3
L11079E  LDA   #$FFFF
         STA   [$FD]
L1107A3  TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L1107AB  ENT
         PHD
         TSC
         SEC
         SBC   #$00EF
         TCD
         ADC   #$00E8
         TCS
         LDA   $F9
         SEC
         SBC   $F5
         BVS   L1107C0
         EOR   #$8000
L1107C0  BPL   L1107EC
         LDA   $FB
         SEC
         SBC   $F7
         BVS   L1107CC
         EOR   #$8000
L1107CC  BPL   L1107EC
         LDA   $F5
         CLC
         ADC   $FD
         SEC
         SBC   $F9
         BVS   L1107DB
         EOR   #$8000
L1107DB  BPL   L1107EC
         LDA   $F7
         CLC
         ADC   $FF
         SEC
         SBC   $FB
         BVS   L1107EA
         EOR   #$8000
L1107EA  BMI   L1107F1
L1107EC  LDA   #$0000
         BRA   L1107F4
L1107F1  LDA   #$0001
L1107F4  TAY
         TSC
         CLC
         ADC   #$0006
         TCS
         TYA
         PLD
         RTL

L1107FE  ENT
         PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00E8
         TCS
         STZ   $EA
         BRL   L110953
L11080E  LDX   #$0000
         LDA   #$0001
         PHX
         PHA
         LDA   $EA
         PHA
         LDA   #$000E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   $FB
         PHA
         LDA   #$007E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0312AA
         LDX   #^L0312AA
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         PHA
         LDA   $EA
         PHA
         LDA   #$000E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   $FB
         PHA
         LDA   #$007E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0312AA
         LDX   #^L0312AA
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDY   #$0002
         LDA   [$F0],Y
         PHA
         LDA   #$003C
         SEC
         JSL   L01059C
         PLA
         PLX
         STX   $F4
         CLC
         ADC   $F4
         CLC
         ADC   #$0002
         LDX   #$0000
         TAY
         BPL   L1108A9
         DEX
L1108A9  SEC
         JSL   L010743
         LDX   $FF
         LDA   $FD
         JSL   L010410
         PLA
         PLX
         STX   $EE
         STA   $EC
         LDA   $EA
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $FB
         PHA
         LDA   #$0012
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L032BCF
         LDX   #^L032BCF
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         BEQ   L110921
         LDA   #$7180
         STA   [$EC]
         LDA   #$7200
         LDY   #$0002
         STA   [$EC],Y
         LDA   #$7280
         LDY   #$0078
         STA   [$EC],Y
         LDX   $EE
         LDA   $EC
         CLC
         ADC   #$0078
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STA   $F0
         STX   $F2
         LDA   #$7300
         LDY   #$0002
         STA   [$F0],Y
         BRA   L110951
L110921  LDA   #$3680
         STA   [$EC]
         LDA   #$3680
         LDY   #$0002
         STA   [$EC],Y
         LDA   #$3D00
         LDY   #$0078
         STA   [$EC],Y
         LDX   $EE
         LDA   $EC
         CLC
         ADC   #$0078
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STA   $F0
         STX   $F2
         LDA   #$3D00
         LDY   #$0002
         STA   [$F0],Y
L110951  INC   $EA
L110953  LDA   $EA
         SEC
         SBC   #$0009
         BVS   L11095E
         EOR   #$8000
L11095E  BMI   L110963
         BRL   L11080E
L110963  TSC
         CLC
         ADC   #$000C
         TCS
         PLD
         RTL

L11096B  ENT
         PHD
         TSC
         SEC
         SBC   #$00E3
         TCD
         ADC   #$00C8
         TCS
         STZ   $CA
         LDA   $E9
         AND   #$00FF
         BNE   L110982
         BRL   L11125A
L110982  PEA   $008C
         JSL   L0405F2
         PLY
         PEA   $0000
         PEA   ^L031622
         PEA   L031622
         JSL   L040732
         PLY
         PLY
         PLY
         PEA   $7530
         JSL   L140D0A
         PLY
         LDA   #$0003
         STA   $DC
         BRL   L11124A
L1109AA  LDA   $DC
         LDX   #$0000
         TAY
         BPL   L1109B3
         DEX
L1109B3  STX   $E2
         ASL
         ROL   $E2
         ASL
         ROL   $E2
         ASL
         ROL   $E2
         LDX   $E2
         PHX
         PHA
         LDX   $ED
         LDA   $EB
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0006
         LDA   [$DE],Y
         STA   $D8
         LDA   #$0040
         CLC
         ADC   $F1
         CLC
         ADC   #$0028
         PHA
         LDA   #$0040
         CLC
         ADC   $EF
         CLC
         ADC   #$0028
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1507ED
         PLY
         PLY
         PLY
         PLY
         STA   $D4
         LDA   $DC
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L110A0C
         DEX
L110A0C  PEA   $0000
         PEA   $000A
         CLC
         JSL   L0105E1
         LDX   $F7
         LDA   $F5
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0008
         LDA   [$DE],Y
         BNE   L110A2F
         BRL   L110AC6
L110A2F  LDA   $D4
         CMP   #$000B
         BEQ   L110A40
         LDA   $D4
         CMP   #$000E
         BEQ   L110A40
         BRL   L110AC6
L110A40  LDA   $DC
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L110A4D
         DEX
L110A4D  PEA   $0000
         PEA   $000A
         CLC
         JSL   L0105E1
         LDX   $F7
         LDA   $F5
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0008
         LDA   [$DE],Y
         SEC
         SBC   #$0001
         LDY   #$0008
         STA   [$DE],Y
         LDA   #$0001
         STA   [$F9]
         LDA   $DC
         SEC
         SBC   #$0003
         STA   $D6
         LDA   $DC
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0000
         LDY   #$0002
         STA   [$DE],Y
         PEA   $0050
         JSL   L0405F2
         PLY
         PEA   $0000
         PEA   ^L031626
         PEA   L031626
         JSL   L040732
         PLY
         PLY
         PLY
         PEA   $7530
         JSL   L140D0A
         PLY
         BRL   L11125A
L110AC6  LDA   $DC
         LDX   #$0000
         TAY
         BPL   L110ACF
         DEX
L110ACF  STX   $E2
         ASL
         ROL   $E2
         ASL
         ROL   $E2
         ASL
         ROL   $E2
         LDX   $E2
         PHX
         PHA
         LDX   $ED
         LDA   $EB
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0004
         LDA   [$DE],Y
         BNE   L110AF6
         BRL   L1110D3
L110AF6  PEA   $0014
         PEA   $000C
         LDA   $F1
         CLC
         ADC   #$0028
         PHA
         LDA   $EF
         CLC
         ADC   #$0028
         PHA
         LDA   $DC
         LDX   #$0000
         TAY
         BPL   L110B13
         DEX
L110B13  STX   $E2
         ASL
         ROL   $E2
         ASL
         ROL   $E2
         ASL
         ROL   $E2
         LDX   $E2
         PHX
         PHA
         LDX   $ED
         LDA   $EB
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0002
         LDA   [$DE],Y
         PHA
         LDA   $DC
         LDX   #$0000
         TAY
         BPL   L110B3F
         DEX
L110B3F  STX   $E2
         ASL
         ROL   $E2
         ASL
         ROL   $E2
         ASL
         ROL   $E2
         LDX   $E2
         PHX
         PHA
         LDX   $ED
         LDA   $EB
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   [$DE]
         CLC
         ADC   #$0008
         PHA
         JSL   L1107AB
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         AND   #$00FF
         BNE   L110B77
         BRL   L1110D3
L110B77  LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$000A
         LDA   [$DE],Y
         CMP   #$0000
         BNE   L110BA5
         BRL   L1110D3
L110BA5  LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$000A
         LDA   [$DE],Y
         CMP   #$000E
         BNE   L110BD3
         BRL   L1110D3
L110BD3  LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$000A
         LDA   [$DE],Y
         CMP   #$000F
         BNE   L110C01
         BRL   L1110D3
L110C01  LDA   $DC
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0002
         LDA   [$DE],Y
         BNE   L110C25
         BRL   L1110D3
L110C25  LDA   $D4
         CMP   #$000A
         BEQ   L110C3D
         LDA   $D4
         CMP   #$0002
         BEQ   L110C3D
         LDA   $D4
         CMP   #$0006
         BEQ   L110C3D
         BRL   L110FC0
L110C3D  LDA   L0200F2
         CMP   #$FFFF
         BEQ   L110C7B
         PEA   $00A0
         JSL   L0405F2
         PLY
         PEA   $0000
         PEA   ^L03162A
         PEA   L03162A
         JSL   L040732
         PLY
         PLY
         PLY
         PEA   $EA60
         JSL   L140D0A
         PLY
         PEA   $EA60
         JSL   L140D0A
         PLY
         LDA   #$0001
         STA   $CA
L110C72  JSL   L040871
         TAY
         BNE   L110C7B
         BRA   L110C72
L110C7B  LDA   $DC
         LDX   #$0000
         TAY
         BPL   L110C84
         DEX
L110C84  STX   $E2
         ASL
         ROL   $E2
         ASL
         ROL   $E2
         ASL
         ROL   $E2
         LDX   $E2
         PHX
         PHA
         LDX   $ED
         LDA   $EB
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0000
         LDY   #$0004
         STA   [$DE],Y
         PEA   $0050
         JSL   L0405F2
         PLY
         PEA   $0000
         PEA   ^L031626
         PEA   L031626
         JSL   L040732
         PLY
         PLY
         PLY
         PEA   $7530
         JSL   L140D0A
         PLY
         LDA   L0200F2
         CMP   #$FFFF
         BNE   L110CD4
         BRL   L110DDF
L110CD4  LDA   L0200F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $F3
         PHA
         LDA   #$0012
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L032BCF
         LDX   #^L032BCF
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0001
         STA   [$DE]
         PEI   $FF
         PEI   $FD
         PEI   $F3
         JSL   L1107FE
         PLY
         PLY
         PLY
         JSL   L0703A5
         STA   $D2
         JSL   L0703A5
         STA   $D0
         LDA   #$0009
         PHA
         LDA   $D0
         CLC
         JSL   L01041B
         LDA   #$000E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #$0003
         PHA
         LDA   $D2
         CLC
         JSL   L01041B
         LDA   #$007E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0312AA
         LDX   #^L0312AA
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0004
         LDA   [$DE],Y
         STA   $CE
         LDA   L0200F2
         PHA
         LDA   #$000E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   $F3
         PHA
         LDA   #$007E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0312AA
         LDX   #^L0312AA
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0004
         LDA   [$DE],Y
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0004
         LDA   [$DE],Y
         STA   $CC
         PEI   $CE
         PEI   $CC
         JSL   L0F0332
         PLY
         PLY
L110DDF  LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0000
         LDY   #$000A
         STA   [$DE],Y
         LDA   $DC
         SEC
         SBC   #$0006
         BVS   L110E13
         EOR   #$8000
L110E13  BMI   L110E40
         LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$000E
         LDY   #$000A
         STA   [$DE],Y
         BRA   L110E9F
L110E40  LDA   $DC
         SEC
         SBC   #$0014
         BVS   L110E4B
         EOR   #$8000
L110E4B  BPL   L110E9F
         LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$000F
         LDY   #$000A
         STA   [$DE],Y
         LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$FFFF
         LDY   #$0012
         STA   [$DE],Y
L110E9F  LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0000
         LDY   #$000C
         STA   [$DE],Y
         LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0004
         LDY   #$0016
         STA   [$DE],Y
         STZ   $DA
         BRL   L110FAD
L110EF6  LDA   $DA
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $D8
         PHA
         LDA   #$000E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   $F3
         PHA
         LDA   #$007E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0312AA
         LDX   #^L0312AA
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDX   $E0
         LDA   #$0006
         CLC
         ADC   $DE
         BCC   L110F41
         INX
L110F41  JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   [$DE]
         CMP   $DC
         BNE   L110FAB
         LDA   $DA
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $D8
         PHA
         LDA   #$000E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   $F3
         PHA
         LDA   #$007E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0312AA
         LDX   #^L0312AA
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDX   $E0
         LDA   #$0006
         CLC
         ADC   $DE
         BCC   L110F9C
         INX
L110F9C  JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0000
         STA   [$DE]
L110FAB  INC   $DA
L110FAD  LDA   $DA
         SEC
         SBC   #$0004
         BVS   L110FB8
         EOR   #$8000
L110FB8  BMI   L110FBD
         BRL   L110EF6
L110FBD  BRL   L1110D0
L110FC0  LDA   $DC
         SEC
         SBC   #$0006
         BVS   L110FCB
         EOR   #$8000
L110FCB  BMI   L110FD0
         BRL   L1110D0
L110FD0  LDA   $DC
         SEC
         SBC   #$0014
         BVS   L110FDB
         EOR   #$8000
L110FDB  BPL   L110FE0
         BRL   L1110D0
L110FE0  LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0000
         LDY   #$000C
         STA   [$DE],Y
         LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$00BE
         LDY   #$000E
         STA   [$DE],Y
         LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0092
         LDY   #$0010
         STA   [$DE],Y
         LDA   $DC
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   [$DE]
         CMP   #$0003
         BNE   L1110A7
         LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0006
         LDY   #$000A
         STA   [$DE],Y
         BRA   L1110D0
L1110A7  LDA   $DC
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0008
         LDY   #$000A
         STA   [$DE],Y
L1110D0  BRL   L11125A
L1110D3  LDA   #$0040
         CLC
         ADC   $F1
         CLC
         ADC   #$0028
         PHA
         LDA   #$0040
         CLC
         ADC   $EF
         CLC
         ADC   #$0028
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1507ED
         PLY
         PLY
         PLY
         PLY
         CMP   #$000F
         BEQ   L111101
         BRL   L111248
L111101  LDA   L0200F2
         CMP   #$FFFF
         BNE   L11110C
         BRL   L11121E
L11110C  LDA   $CA
         BEQ   L111113
         BRL   L11121E
L111113  LDA   L0200F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $F3
         PHA
         LDA   #$0012
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L032BCF
         LDX   #^L032BCF
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDA   #$0001
         STA   [$DE]
         PEI   $FF
         PEI   $FD
         PEI   $F3
         JSL   L1107FE
         PLY
         PLY
         PLY
         JSL   L0703A5
         STA   $D2
         JSL   L0703A5
         STA   $D0
         LDA   #$0009
         PHA
         LDA   $D0
         CLC
         JSL   L01041B
         LDA   #$000E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #$0003
         PHA
         LDA   $D2
         CLC
         JSL   L01041B
         LDA   #$007E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0312AA
         LDX   #^L0312AA
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0004
         LDA   [$DE],Y
         STA   $CE
         LDA   L0200F2
         PHA
         LDA   #$000E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   $F3
         PHA
         LDA   #$007E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0312AA
         LDX   #^L0312AA
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0004
         LDA   [$DE],Y
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $DE
         STX   $E0
         LDY   #$0004
         LDA   [$DE],Y
         STA   $CC
         PEI   $CE
         PEI   $CC
         JSL   L0F0332
         PLY
         PLY
L11121E  PEA   $00A0
         JSL   L0405F2
         PLY
         PEA   $0000
         PEA   ^L03162A
         PEA   L03162A
         JSL   L040732
         PLY
         PLY
         PLY
         PEA   $EA60
         JSL   L140D0A
         PLY
         PEA   $EA60
         JSL   L140D0A
         PLY
         BRA   L11125A
L111248  INC   $DC
L11124A  LDA   $DC
         SEC
         SBC   #$0018
         BVS   L111255
         EOR   #$8000
L111255  BMI   L11125A
         BRL   L1109AA
L11125A  LDA   $D6
         TAY
         TSC
         CLC
         ADC   #$001A
         TCS
         TYA
         PLD
         RTL

L111266  ENT
         PHD
         TSC
         SEC
         SBC   #$00EF
         TCD
         ADC   #$00DA
         TCS
         STZ   $DC
         LDA   $F7
         CLC
         ADC   #$0018
         CLC
         ADC   #$000C
         STA   $F7
         STZ   $E8
         BRL   L1114FF
L111284  LDA   $E8
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $FB
         PHA
         LDA   #$000E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   $F9
         PHA
         LDA   #$007E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0312AA
         LDX   #^L0312AA
         JSL   L010410
         PLA
         PLX
         JSL   L010410
         PLA
         PLX
         STA   $EA
         STX   $EC
         LDX   $EC
         LDA   #$0006
         CLC
         ADC   $EA
         BCC   L1112CF
         INX
L1112CF  JSL   L010410
         PLA
         PLX
         STA   $EA
         STX   $EC
         LDA   [$EA]
         STA   $E6
         TAY
         BNE   L1112E3
         BRL   L1114CF
L1112E3  LDA   $E6
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $EA
         STX   $EC
         LDY   #$0006
         LDA   [$EA],Y
         STA   $E4
         LDA   $E4
         AND   #$8000
         TAY
         BEQ   L11133F
         LDA   $E4
         AND   #$7FFF
         TAY
         BEQ   L111334
         JSL   L0703A5
         AND   #$0001
         PHA
         LDA   $E4
         PLX
         STX   $EE
         SEC
         SBC   $EE
         STA   $E4
         LDA   #$8000
         STA   $E2
         BRA   L11133D
L111334  LDA   $E4
         AND   #$7FFF
         STA   $E4
         STZ   $E2
L11133D  BRA   L11136E
L11133F  LDA   $E4
         SEC
         SBC   #$001F
         BVS   L11134A
         EOR   #$8000
L11134A  BMI   L111362
         JSL   L0703A5
         AND   #$0001
         PHA
         LDA   $E4
         PLX
         STX   $EE
         CLC
         ADC   $EE
         STA   $E4
         STZ   $E2
         BRA   L11136E
L111362  LDA   $E4
         ORA   #$8000
         STA   $E4
         LDA   #$8000
         STA   $E2
L11136E  LDA   $E6
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $EA
         STX   $EC
         LDA   $E4
         LDY   #$0006
         STA   [$EA],Y
         LDA   $E4
         AND   #$7FFF
         PHA
         LDA   $F5
         PLX
         STX   $EE
         CLC
         ADC   $EE
         STA   $DE
         LDA   $E6
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L032B9F
         LDX   #^L032B9F
         JSL   L010410
         PLA
         PLX
         STA   $EA
         STX   $EC
         LDA   [$EA]
         ORA   $E2
         STA   $E0
         LDX   L020058
         LDA   L020056
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         LDA   $F7
         CLC
         ADC   #$0040
         SEC
         SBC   #$0003
         PHA
         LDA   $DE
         CLC
         ADC   #$0040
         PHA
         PEI   $E0
         JSL   L130695
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDA   $E6
         LDX   #$0000
         TAY
         BPL   L1113FD
         DEX
L1113FD  STX   $EE
         ASL
         ROL   $EE
         ASL
         ROL   $EE
         ASL
         ROL   $EE
         LDX   $EE
         PHX
         PHA
         LDX   $FF
         LDA   $FD
         JSL   L010410
         PLA
         PLX
         STA   $EA
         STX   $EC
         LDA   $DE
         STA   [$EA]
         LDA   $F7
         SEC
         SBC   #$0018
         SEC
         SBC   #$0003
         PHA
         LDA   $E6
         LDX   #$0000
         TAY
         BPL   L111432
         DEX
L111432  STX   $EE
         ASL
         ROL   $EE
         ASL
         ROL   $EE
         ASL
         ROL   $EE
         LDX   $EE
         PHX
         PHA
         LDX   $FF
         LDA   $FD
         JSL   L010410
         PLA
         PLX
         STA   $EA
         STX   $EC
         PLA
         LDY   #$0002
         STA   [$EA],Y
         LDA   $E6
         LDX   #$0000
         TAY
         BPL   L11145E
         DEX
L11145E  STX   $EE
         ASL
         ROL   $EE
         ASL
         ROL   $EE
         ASL
         ROL   $EE
         LDX   $EE
         PHX
         PHA
         LDX   $FF
         LDA   $FD
         JSL   L010410
         PLA
         PLX
         STA   $EA
         STX   $EC
         LDA   $E6
         LDY   #$0004
         STA   [$EA],Y
         LDA   $E6
         LDX   #$0000
         TAY
         BPL   L11148B
         DEX
L11148B  STX   $EE
         ASL
         ROL   $EE
         ASL
         ROL   $EE
         ASL
         ROL   $EE
         LDX   $EE
         PHX
         PHA
         LDX   $FF
         LDA   $FD
         JSL   L010410
         PLA
         PLX
         STA   $EA
         STX   $EC
         LDA   $FB
         LDY   #$0006
         STA   [$EA],Y
         LDA   $E6
         SEC
         SBC   #$0006
         BVS   L1114BA
         EOR   #$8000
L1114BA  BPL   L1114CD
         LDA   $E6
         SEC
         SBC   #$0014
         BVS   L1114C7
         EOR   #$8000
L1114C7  BMI   L1114CD
         LDA   $E6
         STA   $DC
L1114CD  BRA   L1114FD
L1114CF  LDA   $E6
         LDX   #$0000
         TAY
         BPL   L1114D8
         DEX
L1114D8  STX   $EE
         ASL
         ROL   $EE
         ASL
         ROL   $EE
         ASL
         ROL   $EE
         LDX   $EE
         PHX
         PHA
         LDX   $FF
         LDA   $FD
         JSL   L010410
         PLA
         PLX
         STA   $EA
         STX   $EC
         LDA   #$0000
         LDY   #$0004
         STA   [$EA],Y
L1114FD  INC   $E8
L1114FF  LDA   $E8
         SEC
         SBC   #$0004
         BVS   L11150A
         EOR   #$8000
L11150A  BMI   L11150F
         BRL   L111284
L11150F  LDA   $DC
         TAY
         TSC
         CLC
         ADC   #$0014
         TCS
         TYA
         PLD
         RTL

