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

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

	 use	INTENN.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
	
*-----------------------

L080000  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F2
         TCS
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0016
         LDA   [$F4],Y
         DEC
         LDY   #$0016
         STA   [$F4],Y
         SEC
         SBC   #$0000
         BVS   L080040
         EOR   #$8000
L080040  BPL   L080045
         BRL   L0800D3
L080045  LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0014
         LDA   [$F4],Y
         CMP   #$0001
         BNE   L0800A3
         LDA   L020039
         CMP   #$0002
         BNE   L0800A3
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0002
         LDY   #$0016
         STA   [$F4],Y
         BRA   L0800CC
L0800A3  LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0004
         LDY   #$0016
         STA   [$F4],Y
L0800CC  LDA   #$0001
         BRA   L0800D6
         BRA   L0800D6
L0800D3  LDA   #$0000
L0800D6  TAY
         TSC
         CLC
         ADC   #$0006
         TCS
         TYA
         PLD
         RTL

L0800E0  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00EE
         TCS
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STX   $F2
         STA   $F0
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0002
         STA   [$F4],Y
         LDA   $FF
         SEC
         SBC   #$0003
         PHA
         LDA   #$0006
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03081C
         LDX   #^L03081C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$FFFF
         STA   [$F4]
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0002
         STA   [$F4]
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0004
         STA   [$F4],Y
         LDA   #$0000
         LDY   #$0004
         STA   [$F0],Y
         LDA   #$FFFF
         LDY   #$000A
         STA   [$F0],Y
         LDA   #$0000
         LDY   #$000C
         STA   [$F0],Y
         LDA   #$0000
         STA   [$F0]
         LDA   #$0000
         LDY   #$0002
         STA   [$F0],Y
         LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L0801CB
         DEX
L0801CB  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         BNE   L0801EB
         BRL   L0802C9
L0801EB  LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L0801F8
         DEX
L0801F8  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         STA   [$F4]
         LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L080225
         DEX
L080225  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         SEC
         SBC   #$0018
         BVS   L080249
         EOR   #$8000
L080249  BMI   L08029E
         LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L080258
         DEX
L080258  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         SEC
         SBC   #$0014
         LDX   #$0000
         TAY
         BPL   L08027E
         DEX
L08027E  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         STA   [$F4]
L08029E  LDA   $FF
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L0802AB
         DEX
L0802AB  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         STA   [$F4]
L0802C9  PEI   $FF
         JSL   L0F02BB
         PLY
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L0802D8  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00DE
         TCS
         STZ   $E2
         STZ   $E0
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STX   $F0
         STA   $EE
         LDA   #$0002
         PHA
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0008
         LDA   [$F4],Y
         SEC
         JSL   L01041B
         PLY
         STA   $E4
         LDA   $E4
         STA   $F2
         BRA   L0803C1
L080364  LDA   $F2
         AND   #$0003
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $EE
         CLC
         ADC   #$0006
         LDX   $F0
         BCC   L08037A
         INX
L08037A  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$8000
         TAY
         BNE   L0803BF
         LDA   $F2
         AND   #$0003
         PHA
         LDA   #$0002
         SEC
         JSL   L01059C
         PLA
         CLC
         ADC   #$0001
         PHA
         LDA   $E2
         INC   $E2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00E6
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         STA   [$F4]
L0803BF  INC   $F2
L0803C1  LDA   $E4
         CLC
         ADC   #$0004
         SEC
         SBC   $F2
         BEQ   L0803D3
         BVS   L0803D1
         EOR   #$8000
L0803D1  BMI   L080364
L0803D3  LDA   $E2
         BRL   L0804C3
L0803D8  LDA   $E6
         STA   $E0
         BRL   L0804D1
L0803DF  LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0008
         LDA   [$F4],Y
         CMP   $E6
         BNE   L08040F
         LDA   $E6
         STA   $E0
         BRA   L080413
L08040F  LDA   $E8
         STA   $E0
L080413  BRL   L0804D1
L080416  LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0008
         LDA   [$F4],Y
         CMP   $E6
         BNE   L080473
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0008
         LDA   [$F4],Y
         EOR   #$0004
         CMP   $E8
         BEQ   L080473
         LDA   $E8
         STA   $E0
         BRA   L0804B5
L080473  LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0008
         LDA   [$F4],Y
         CMP   $E6
         BNE   L0804A3
         LDA   $EA
         STA   $E0
         BRA   L0804B5
L0804A3  JSL   L0703A5
         AND   #$0001
         TAY
         BEQ   L0804B1
         LDA   $EA
         BRA   L0804B3
L0804B1  LDA   $E6
L0804B3  STA   $E0
L0804B5  BRL   L0804D1
L0804B8  BRL   L0804D1
L0804BB  DA    L0803D8
         DA    L0803DF
         DA    L080416
         DA    L0804B8
L0804C3  DEC
         CMP   #$0003
         BCC   L0804CC
         LDA   #$0003
L0804CC  ASL
         TAX
         JMP   (L0804BB,X)

L0804D1  LDA   $E0
         TAY
         TSC
         CLC
         ADC   #$001A
         TCS
         TYA
         PLD
         RTL

L0804DD  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00D6
         TCS
         STZ   L0200AE
         STZ   $F0
         BRL   L080639
L0804F0  LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $FD
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDX   $F4
         LDA   #$0006
         CLC
         ADC   $F2
         BCC   L080524
         INX
L080524  JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         STA   $EC
         LDA   $EC
         AND   #$8000
         TAY
         BEQ   L08053E
         LDA   $FD
         STA   $EC
L08053E  STZ   $EE
         BRL   L080627
L080543  LDA   $EE
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $EC
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDX   $F4
         LDA   #$0006
         CLC
         ADC   $F2
         BCC   L080577
         INX
L080577  JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         STA   $EA
         LDA   $EA
         CMP   #$FFFF
         BNE   L08058F
         BRL   L080625
L08058F  LDA   $EA
         AND   #$8000
         TAY
         BNE   L08059A
         BRL   L080625
L08059A  LDA   $EA
         AND   #$7FFF
         STA   $EA
         LDA   L0200AE
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031B57
         LDX   #^L031B57
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   $EC
         STA   [$F2]
         LDA   L0200AE
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00E0
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   $EA
         STA   [$F2]
         LDA   $EA
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         PHA
         LDA   L0200AE
         PHA
         INC
         STA   L0200AE
         PLA
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00D8
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         PLA
         STA   [$F2]
L080625  INC   $EE
L080627  LDA   $EE
         SEC
         SBC   #$0004
         BVS   L080632
         EOR   #$8000
L080632  BMI   L080637
         BRL   L080543
L080637  INC   $F0
L080639  LDA   $F0
         SEC
         SBC   #$0004
         BVS   L080644
         EOR   #$8000
L080644  BMI   L080649
         BRL   L0804F0
L080649  LDA   L0200AE
         BRL   L0807F2
L08064F  LDAL  L031B57
         STA   $E8
         BRL   L080800
L080658  LDA   $E0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0004
         LDA   [$F2],Y
         CMP   $FF
         BNE   L080685
         BRL   L0806DA
L080685  LDA   $E2
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0004
         LDA   [$F2],Y
         CMP   $FF
         BEQ   L0806DA
         LDA   $D8
         CMP   #$0004
         BEQ   L0806C5
         LDA   $DA
         CMP   #$0004
         BEQ   L0806C5
         LDAL  L031B57
         STA   $E8
         BRA   L0806D8
L0806C5  LDA   $D8
         CMP   #$0004
         BNE   L0806D2
         LDAL  L031B57
         BRA   L0806D6
L0806D2  LDAL  L031B59
L0806D6  STA   $E8
L0806D8  BRA   L080710
L0806DA  LDA   $E0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0004
         LDA   [$F2],Y
         CMP   $FF
         BNE   L08070A
         LDAL  L031B57
         BRA   L08070E
L08070A  LDAL  L031B59
L08070E  STA   $E8
L080710  BRL   L080800
L080713  STZ   $E8
         STZ   $F0
         BRA   L08077B
L080719  LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00E0
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0004
         LDA   [$F2],Y
         CMP   $FF
         BNE   L080779
         LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031B57
         LDX   #^L031B57
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         STA   $E8
L080779  INC   $F0
L08077B  LDA   $F0
         SEC
         SBC   #$0003
         BVS   L080786
         EOR   #$8000
L080786  BMI   L08078C
         LDA   $E8
         BEQ   L080719
L08078C  LDA   $E8
         BNE   L0807E4
         STZ   $F0
         BRA   L0807D3
L080794  LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00D8
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         CMP   #$0004
         BNE   L0807D1
         LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L031B57
         LDX   #^L031B57
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         STA   $E8
L0807D1  INC   $F0
L0807D3  LDA   $F0
         SEC
         SBC   #$0003
         BVS   L0807DE
         EOR   #$8000
L0807DE  BMI   L0807E4
         LDA   $E8
         BEQ   L080794
L0807E4  BRL   L080800
L0807E7  BRL   L080800
L0807EA  DA    L08064F
         DA    L080658
         DA    L080713
         DA    L0807E7
L0807F2  DEC
         CMP   #$0003
         BCC   L0807FB
         LDA   #$0003
L0807FB  ASL
         TAX
         JMP   (L0807EA,X)

L080800  LDA   $E8
         TAY
         TSC
         CLC
         ADC   #$0020
         TCS
         TYA
         PLD
         RTL

L08080C  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E6
         TCS
         LDA   $FF
         PHA
         LDA   #$007E
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L0312AA
         LDX   #^L0312AA
         JSL   L010410
         PLA
         PLX
         STX   $EA
         STA   $E8
         STZ   $F2
         BRL   L080951
L08083D  LDY   #$0004
         LDA   [$E8],Y
         STA   $EE
         STZ   $EC
         LDA   #$0003
         STA   $F0
         BRL   L0808F5
L08084E  LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         BNE   L080872
         BRL   L0808F3
L080872  LDA   $F0
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         CMP   $EE
         BNE   L0808F3
         LDA   $F0
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         SEC
         SBC   #$0003
         BVS   L0808C1
         EOR   #$8000
L0808C1  BPL   L0808F3
         LDA   $EC
         SEC
         SBC   #$0004
         BVS   L0808CE
         EOR   #$8000
L0808CE  BMI   L0808F3
         LDA   $EC
         INC   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $E8
         CLC
         ADC   #$0006
         LDX   $EA
         BCC   L0808E5
         INX
L0808E5  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   $F0
         STA   [$F4]
L0808F3  INC   $F0
L0808F5  LDA   $F0
         SEC
         SBC   #$0018
         BVS   L080900
         EOR   #$8000
L080900  BMI   L080905
         BRL   L08084E
L080905  LDA   $EC
         STA   $F0
         BRA   L08092F
L08090B  LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $E8
         CLC
         ADC   #$0006
         LDX   $EA
         BCC   L08091E
         INX
L08091E  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         STA   [$F4]
         INC   $F0
L08092F  LDA   $F0
         SEC
         SBC   #$0004
         BVS   L08093A
         EOR   #$8000
L08093A  BPL   L08090B
         LDX   $EA
         LDA   $E8
         CLC
         ADC   #$000E
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STX   $EA
         STA   $E8
         INC   $F2
L080951  LDA   $F2
         SEC
         SBC   #$0009
         BVS   L08095C
         EOR   #$8000
L08095C  BMI   L080961
         BRL   L08083D
L080961  TSC
         CLC
         ADC   #$0012
         TCS
         PLD
         RTL

L080969  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E6
         TCS
         LDA   #$007F
         STA   $EC
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STX   $EA
         STA   $E8
         LDA   $FF
         SEC
         SBC   #$0014
         BNE   L0809A5
         BRL   L080A24
L0809A5  BVS   L0809AA
         EOR   #$8000
L0809AA  BMI   L0809AF
         BRL   L080A24
L0809AF  JSL   L0703A5
         AND   #$003F
         STA   $EE
         TAY
         BEQ   L0809BD
         BRA   L0809C2
L0809BD  LDA   #$0001
         STA   $EE
L0809C2  LDA   $FF
         SEC
         SBC   #$0004
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         STA   $F2
         LDA   $EE
         SEC
         SBC   $F2
         BEQ   L080A00
         BVS   L0809FA
         EOR   #$8000
L0809FA  BPL   L080A00
         LDA   $F2
         BRA   L080A02
L080A00  LDA   $EE
L080A02  STA   $F2
         LDA   $F2
         SEC
         SBC   #$005A
         BVS   L080A0F
         EOR   #$8000
L080A0F  BPL   L080A22
         LDA   $F2
         SEC
         SBC   #$005D
         BEQ   L080A20
         BVS   L080A1E
         EOR   #$8000
L080A1E  BMI   L080A22
L080A20  BRA   L0809AF
L080A22  BRA   L080A36
L080A24  JSL   L0703A5
         AND   $EC
         STA   $F2
         TAY
         BEQ   L080A31
         BRA   L080A36
L080A31  LDA   #$0001
         STA   $F2
L080A36  LDA   $F2
         SEC
         SBC   #$0078
         BEQ   L080A4A
         BVS   L080A43
         EOR   #$8000
L080A43  BPL   L080A4A
         LDA   #$0078
         STA   $F2
L080A4A  LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0001
         LDY   #$0002
         STA   [$F4],Y
         LDA   $F2
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         STA   [$F4]
         LDA   $F2
         LDY   #$0004
         STA   [$E8],Y
         LDA   $F2
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         STA   [$E8]
         LDA   #$0000
         LDY   #$0008
         STA   [$E8],Y
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         BRL   L080BEF
L080B03  STZ   $EE
         BRA   L080B5E
L080B07  LDA   $EE
         EOR   #$0002
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $F2
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   $F6
         LDA   #$0006
         CLC
         ADC   $F4
         BCC   L080B3E
         INX
L080B3E  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$8000
         TAY
         BEQ   L080B5C
         LDA   $EE
         ASL
         CLC
         ADC   #$0001
         LDY   #$0008
         STA   [$E8],Y
L080B5C  INC   $EE
L080B5E  LDA   $EE
         SEC
         SBC   #$0004
         BVS   L080B69
         EOR   #$8000
L080B69  BMI   L080B72
         LDY   #$0008
         LDA   [$E8],Y
         BEQ   L080B07
L080B72  BRL   L080BFF
L080B75  STZ   $EE
         BRA   L080BCF
L080B79  LDA   $EE
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $F2
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   $F6
         LDA   #$0006
         CLC
         ADC   $F4
         BCC   L080BAD
         INX
L080BAD  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$8000
         TAY
         BNE   L080BCD
         LDA   $EE
         ASL
         CLC
         ADC   #$0001
         LDY   #$0008
         STA   [$E8],Y
         BRA   L080BE3
L080BCD  INC   $EE
L080BCF  LDA   $EE
         SEC
         SBC   #$0004
         BVS   L080BDA
         EOR   #$8000
L080BDA  BMI   L080BE3
         LDY   #$0008
         LDA   [$E8],Y
         BEQ   L080B79
L080BE3  BRL   L080BFF
L080BE6  BRL   L080BFF
L080BE9  DA    L080B03
         DA    L080B75
         DA    L080BE6
L080BEF  DEC
         DEC
         DEC
         CMP   #$0002
         BCC   L080BFA
         LDA   #$0002
L080BFA  ASL
         TAX
         JMP   (L080BE9,X)

L080BFF  LDA   $F2
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         LDY   #$0002
         STA   [$E8],Y
         LDA   #$00BE
         LDY   #$000E
         STA   [$E8],Y
         LDA   #$0092
         LDY   #$0010
         STA   [$E8],Y
         LDA   #$0002
         LDY   #$000A
         STA   [$E8],Y
         LDA   #$0000
         LDY   #$000C
         STA   [$E8],Y
         LDA   #$0000
         LDY   #$0012
         STA   [$E8],Y
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0006
         STA   [$F4],Y
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0004
         STA   [$F4],Y
         LDA   $FF
         SEC
         SBC   #$0014
         BVS   L080CA1
         EOR   #$8000
L080CA1  BMI   L080CD4
         LDA   #$0002
         LDY   #$0014
         STA   [$E8],Y
         LDA   L02003B
         CMP   #$0001
         BEQ   L080CC9
         LDA   L02003B
         SEC
         SBC   #$0003
         BVS   L080CBF
         EOR   #$8000
L080CBF  BPL   L080CD1
         LDA   $F2
         AND   #$0001
         TAY
         BNE   L080CD1
L080CC9  LDA   #$0001
         LDY   #$0014
         STA   [$E8],Y
L080CD1  BRL   L080DAE
L080CD4  LDA   #$000C
         LDY   #$000A
         STA   [$E8],Y
         JSL   L0703A5
         AND   #$000F
         PHA
         LDY   #$000E
         LDA   [$E8],Y
         PLX
         STX   $F8
         CLC
         ADC   $F8
         LDY   #$000E
         STA   [$E8],Y
         LDA   $FF
         SEC
         SBC   #$0014
         LDX   #$0000
         TAY
         BPL   L080D01
         DEX
L080D01  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         STA   [$F4]
         LDA   $FF
         SEC
         SBC   #$0014
         LDX   #$0000
         TAY
         BPL   L080D2E
         DEX
L080D2E  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0002
         STA   [$F4],Y
         LDA   $FF
         SEC
         SBC   #$0014
         LDX   #$0000
         TAY
         BPL   L080D5E
         DEX
L080D5E  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0004
         STA   [$F4],Y
         LDA   L02003B
         CMP   #$0000
         BNE   L080DAE
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0002
         STA   [$F4],Y
         INC   L020048
L080DAE  TSC
         CLC
         ADC   #$0012
         TCS
         PLD
         RTL

         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00E6
         TCS
         LDA   #$0006
         STA   $F4
         BRL   L081030
L080DC9  LDA   $F4
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         BNE   L080DED
         BRL   L08102E
L080DED  LDA   $F4
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STX   $EA
         STA   $E8
         LDY   #$0004
         LDA   [$E8],Y
         STA   $F0
         LDA   $F0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0002
         LDA   [$F6],Y
         STA   [$E8]
         LDA   $F0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDY   #$0004
         LDA   [$F6],Y
         LDY   #$0002
         STA   [$E8],Y
         LDA   $F0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         PHA
         LDA   $F4
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         PLA
         STA   [$F6]
         LDA   $F4
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         BRL   L08101E
L080EC8  STZ   $F2
         BRA   L080F19
L080ECC  LDA   $F2
         EOR   #$0002
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $F0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDX   $F8
         LDA   #$0006
         CLC
         ADC   $F6
         BCC   L080F03
         INX
L080F03  JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         AND   #$8000
         TAY
         BEQ   L080F17
         BRA   L080F26
L080F17  INC   $F2
L080F19  LDA   $F2
         SEC
         SBC   #$0004
         BVS   L080F24
         EOR   #$8000
L080F24  BPL   L080ECC
L080F26  LDA   $F2
         ASL
         CLC
         ADC   #$0001
         LDY   #$0008
         STA   [$E8],Y
         LDA   #$00BE
         LDY   #$000E
         STA   [$E8],Y
         LDA   #$0092
         LDY   #$0010
         STA   [$E8],Y
         LDA   $F4
         SEC
         SBC   #$0014
         BVS   L080F4D
         EOR   #$8000
L080F4D  BMI   L080F59
         LDA   #$0002
         LDY   #$000A
         STA   [$E8],Y
         BRA   L080F61
L080F59  LDA   #$000C
         LDY   #$000A
         STA   [$E8],Y
L080F61  BRL   L08102E
L080F64  STZ   $F2
         BRA   L080FB2
L080F68  LDA   $F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $F0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDX   $F8
         LDA   #$0006
         CLC
         ADC   $F6
         BCC   L080F9C
         INX
L080F9C  JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         AND   #$8000
         TAY
         BNE   L080FB0
         BRA   L080FBF
L080FB0  INC   $F2
L080FB2  LDA   $F2
         SEC
         SBC   #$0004
         BVS   L080FBD
         EOR   #$8000
L080FBD  BPL   L080F68
L080FBF  LDA   $F2
         ASL
         CLC
         ADC   #$0001
         LDY   #$0008
         STA   [$E8],Y
         LDA   #$00BE
         LDY   #$000E
         STA   [$E8],Y
         LDA   #$0092
         LDY   #$0010
         STA   [$E8],Y
         LDA   $F4
         SEC
         SBC   #$0014
         BVS   L080FE6
         EOR   #$8000
L080FE6  BMI   L080FF2
         LDA   #$0002
         LDY   #$000A
         STA   [$E8],Y
         BRA   L081012
L080FF2  LDA   #$000C
         LDY   #$000A
         STA   [$E8],Y
         JSL   L0703A5
         AND   #$0007
         PHA
         LDY   #$0008
         LDA   [$E8],Y
         PLX
         STX   $FA
         CLC
         ADC   $FA
         LDY   #$0008
         STA   [$E8],Y
L081012  BRL   L08102E
L081015  BRL   L08102E
L081018  DA    L080EC8
         DA    L080F64
         DA    L081015
L08101E  DEC
         DEC
         DEC
         CMP   #$0002
         BCC   L081029
         LDA   #$0002
L081029  ASL
         TAX
         JMP   (L081018,X)

L08102E  INC   $F4
L081030  LDA   $F4
         SEC
         SBC   #$0018
         BVS   L08103B
         EOR   #$8000
L08103B  BMI   L081040
         BRL   L080DC9
L081040  TSC
         CLC
         ADC   #$0014
         TCS
         PLD
         RTL

L081048  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00EE
         TCS
         STZ   $F0
         LDA   #$0003
         STA   $F2
         BRA   L08108C
L08105C  LDA   $F2
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         CMP   $FF
         BNE   L08108A
         LDA   $F2
         STA   $F0
L08108A  INC   $F2
L08108C  LDA   $F2
         SEC
         SBC   #$0006
         BVS   L081097
         EOR   #$8000
L081097  BMI   L08109D
         LDA   $F0
         BEQ   L08105C
L08109D  LDA   $F0
         TAY
         TSC
         CLC
         ADC   #$000A
         TCS
         TYA
         PLD
         RTL

         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F2
         TCS
         STZ   $F4
         BRA   L0810E3
L0810B8  LDA   $F4
         LDX   #$0000
         TAY
         BPL   L0810C1
         DEX
L0810C1  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0000
         STA   [$F6]
         INC   $F4
L0810E3  LDA   $F4
         SEC
         SBC   #$0004
         BVS   L0810EE
         EOR   #$8000
L0810EE  BPL   L0810B8
         TSC
         CLC
         ADC   #$0008
         TCS
         PLD
         RTL

L0810F8  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E8
         TCS
         STZ   $F2
         BRL   L081646
L081108  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L081111
         DEX
L081111  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         CMP   #$0001
         BEQ   L081136
         BRL   L08158B
L081136  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L08113F
         DEX
L08113F  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         BNE   L081181
         BRL   L08158B
L081181  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L08118A
         DEX
L08118A  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         LDA   $F2
         CLC
         ADC   #$0014
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         STA   [$F4]
         LDA   $F2
         CLC
         ADC   #$0014
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STX   $F0
         STA   $EE
         LDA   $F2
         LDX   #$0000
         TAY
         BPL   L081214
         DEX
L081214  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STX   $EC
         STA   $EA
         LDY   #$0002
         LDA   [$EE],Y
         PHA
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         PLX
         STX   $F4
         CMP   $F4
         BNE   L0812B3
         LDA   $F2
         LDX   #$0000
         TAY
         BPL   L08128F
         DEX
L08128F  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         CMP   $FF
         BNE   L0812CE
L0812B3  LDY   #$0004
         LDA   [$EA],Y
         LDY   #$0004
         STA   [$EE],Y
         LDY   #$0008
         LDA   [$EA],Y
         LDY   #$0008
         STA   [$EE],Y
         LDA   [$EA]
         STA   [$EE]
         BRL   L0813DB
L0812CE  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L0812D7
         DEX
L0812D7  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         SEC
         SBC   #$0006
         BVS   L081300
         EOR   #$8000
L081300  BMI   L081305
         BRL   L0813DB
L081305  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L08130E
         DEX
L08130E  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0014
         LDA   [$F4],Y
         CMP   #$0001
         BNE   L08135A
         BRL   L0813DB
L08135A  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L081363
         DEX
L081363  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         STA   [$F4]
         LDA   $F2
         LDX   #$0000
         TAY
         BPL   L08138C
         DEX
L08138C  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0002
         STA   [$F4],Y
         LDA   $F2
         LDX   #$0000
         TAY
         BPL   L0813B8
         DEX
L0813B8  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0004
         STA   [$F4],Y
L0813DB  LDY   #$0002
         LDA   [$EA],Y
         LDY   #$0002
         STA   [$EE],Y
         PHA
         LDA   $F2
         LDX   #$0000
         TAY
         BPL   L0813EF
         DEX
L0813EF  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         PLX
         STX   $F4
         CMP   $F4
         BEQ   L081419
         BRL   L081588
L081419  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L081422
         DEX
L081422  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         SEC
         SBC   #$0006
         BVS   L08144B
         EOR   #$8000
L08144B  BPL   L081450
         BRL   L0814FA
L081450  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L081459
         DEX
L081459  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$FFFF
         STA   [$F4]
         LDA   $F2
         LDX   #$0000
         TAY
         BPL   L081482
         DEX
L081482  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         SEC
         SBC   #$0003
         LDX   #$0000
         TAY
         BPL   L0814AD
         DEX
L0814AD  STX   $F8
         ASL
         ROL   $F8
         LDX   $F8
         PHX
         PHA
         LDA   #L03177C
         LDX   #^L03177C
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         STA   [$F4]
         LDA   $F2
         CLC
         ADC   #$005A
         LDY   #$0004
         STA   [$EE],Y
         LDA   $F2
         PHA
         LDA   #$0002
         SEC
         JSL   L01059C
         PLA
         CLC
         ADC   #$0001
         LDY   #$0008
         STA   [$EE],Y
         PEA   $0001
         PEA   $0059
         JSL   L0F0628
         PLY
         PLY
         BRL   L081588
L0814FA  LDY   #$0002
         LDA   [$EE],Y
         CMP   #$0016
         BNE   L081507
         BRL   L081588
L081507  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L081510
         DEX
L081510  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         STA   [$F4]
         LDA   $F2
         LDX   #$0000
         TAY
         BPL   L081539
         DEX
L081539  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0002
         STA   [$F4],Y
         LDA   $F2
         LDX   #$0000
         TAY
         BPL   L081565
         DEX
L081565  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         LDY   #$0004
         STA   [$F4],Y
L081588  BRL   L081644
L08158B  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L081594
         DEX
L081594  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         BEQ   L0815B9
         BRL   L081644
L0815B9  LDA   $F2
         LDX   #$0000
         TAY
         BPL   L0815C2
         DEX
L0815C2  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         SEC
         SBC   #$0006
         BVS   L0815EB
         EOR   #$8000
L0815EB  BPL   L081644
         LDA   $F2
         LDX   #$0000
         TAY
         BPL   L0815F6
         DEX
L0815F6  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         CMP   #$0016
         BEQ   L081644
         LDA   $F2
         LDX   #$0000
         TAY
         BPL   L081624
         DEX
L081624  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$0000
         STA   [$F4]
L081644  INC   $F2
L081646  LDA   $F2
         SEC
         SBC   #$0004
         BVS   L081651
         EOR   #$8000
L081651  BMI   L081656
         BRL   L081108
L081656  LDA   #$0014
         STA   $F2
         BRL   L08174D
L08165E  LDA   $F2
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         BNE   L081682
         BRL   L08174B
L081682  LDA   $F2
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         CMP   #$0016
         BEQ   L0816B0
         BRL   L08174B
L0816B0  LDA   $F2
         SEC
         SBC   #$0014
         LDX   #$0000
         TAY
         BPL   L0816BD
         DEX
L0816BD  PEA   $0000
         PEA   $0006
         CLC
         JSL   L0105E1
         LDA   #L031764
         LDX   #^L031764
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   #$FFFF
         STA   [$F4]
         LDA   $F2
         SEC
         SBC   #$0014
         CLC
         ADC   #$005A
         PHA
         LDA   $F2
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         LDY   #$0004
         STA   [$F4],Y
         LDA   $F2
         SEC
         SBC   #$0014
         PHA
         LDA   #$0002
         SEC
         JSL   L01059C
         PLA
         CLC
         ADC   #$0001
         PHA
         LDA   $F2
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         LDY   #$0008
         STA   [$F4],Y
L08174B  INC   $F2
L08174D  LDA   $F2
         SEC
         SBC   #$0018
         BVS   L081758
         EOR   #$8000
L081758  BMI   L08175D
         BRL   L08165E
L08175D  TSC
         CLC
         ADC   #$0010
         TCS
         PLD
         RTL

L081765  PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E6
         TCS
         STZ   $E8
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         STA   $F2
         STZ   $EC
         BRL   L0818AC
L08179F  LDA   $F2
         STA   $F0
         LDA   #$0001
         STA   $EE
         BRL   L081847
L0817AB  LDA   #$0003
         STA   $EA
         BRL   L081831
L0817B3  LDA   $EA
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         CMP   $F0
         BNE   L08182F
         LDA   $EA
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0002
         LDA   [$F4],Y
         BEQ   L08182F
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   $EA
         LDY   #$0012
         STA   [$F4],Y
         LDA   $EC
         ASL
         CLC
         ADC   #$0001
         STA   $E8
L08182F  INC   $EA
L081831  LDA   $EA
         SEC
         SBC   #$0006
         BVS   L08183C
         EOR   #$8000
L08183C  BMI   L081845
         LDA   $E8
         BNE   L081845
         BRL   L0817B3
L081845  INC   $EE
L081847  LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $F0
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDX   $F6
         LDA   #$0006
         CLC
         ADC   $F4
         BCC   L08187B
         INX
L08187B  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         STA   $F0
         SEC
         SBC   #$0000
         BEQ   L0818AA
         BVS   L081894
         EOR   #$8000
L081894  BPL   L0818AA
         LDA   $EE
         SEC
         SBC   #$0004
         BVS   L0818A1
         EOR   #$8000
L0818A1  BMI   L0818AA
         LDA   $E8
         BNE   L0818AA
         BRL   L0817AB
L0818AA  INC   $EC
L0818AC  LDA   $EC
         SEC
         SBC   #$0004
         BVS   L0818B7
         EOR   #$8000
L0818B7  BMI   L0818C0
         LDA   $E8
         BNE   L0818C0
         BRL   L08179F
L0818C0  LDA   $EE
         CMP   #$0002
         BEQ   L0818CC
         LDA   L020039
         BEQ   L0818D3
L0818CC  LDA   $E8
         ORA   #$8000
         STA   $E8
L0818D3  LDA   $E8
         TAY
         TSC
         CLC
         ADC   #$0012
         TCS
         TYA
         PLD
         RTL

L0818DF  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E8
         TCS
         JSL   L0703A5
         AND   #$0003
         STA   $EE
         PEI   $FF
         JSL   L081765
         PLY
         STA   $F2
         AND   #$7FFF
         TAY
         BEQ   L081946
         LDA   $F2
         AND   #$7FFF
         PHA
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         LDY   #$0008
         STA   [$F4],Y
         LDA   $F2
         AND   #$8000
         TAY
         BEQ   L08193E
         LDA   #$0001
         STA   $F0
         BRA   L081943
L08193E  LDA   #$0008
         STA   $F0
L081943  BRL   L0819FB
L081946  STZ   $F0
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDY   #$0004
         LDA   [$F4],Y
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STX   $EC
         STA   $EA
         LDA   $EE
         STA   $F2
         BRA   L0819F7
L081993  LDA   $F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $EA
         CLC
         ADC   #$0006
         LDX   $EC
         BCC   L0819A6
         INX
L0819A6  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$8000
         TAY
         BNE   L0819EC
         LDA   $F2
         ASL
         CLC
         ADC   #$0001
         PHA
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         PLA
         LDY   #$0008
         STA   [$F4],Y
         LDA   #$0008
         STA   $F0
L0819EC  LDA   $F2
         CLC
         ADC   #$0001
         AND   #$0003
         STA   $F2
L0819F7  LDA   $F0
         BEQ   L081993
L0819FB  LDA   $F0
         TAY
         TSC
         CLC
         ADC   #$0010
         TCS
         TYA
         PLD
         RTL

L081A07  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00E6
         TCS
         LDA   $FD
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STX   $EA
         STA   $E8
         JSL   L0703A5
         STA   $EC
         LDA   $FD
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         BRL   L081B6F
L081A58  LDA   #$0001
         PHA
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0008
         LDA   [$F2],Y
         SEC
         JSL   L01076A
         PLA
         STA   $F0
         LDA   $F0
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDY   #$0004
         LDA   [$F2],Y
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDX   $F4
         LDA   #$0006
         CLC
         ADC   $F2
         BCC   L081AE2
         INX
L081AE2  JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         STA   $EE
         LDA   #$0000
         LDY   #$000C
         STA   [$E8],Y
         LDA   #$00BE
         LDY   #$000E
         STA   [$E8],Y
         LDA   #$0092
         LDY   #$0010
         STA   [$E8],Y
         LDA   $FF
         LDY   #$0012
         STA   [$E8],Y
         LDY   #$0004
         LDA   [$E8],Y
         CMP   $EE
         BNE   L081B22
         LDA   #$0001
         LDY   #$000A
         STA   [$E8],Y
         BRA   L081B3C
L081B22  LDA   $EC
         AND   #$0001
         TAY
         BEQ   L081B34
         LDA   #$0004
         LDY   #$000A
         STA   [$E8],Y
         BRA   L081B3C
L081B34  LDA   #$0006
         LDY   #$000A
         STA   [$E8],Y
L081B3C  BRL   L081B7F
L081B3F  LDA   #$0000
         LDY   #$000C
         STA   [$E8],Y
         LDA   #$00BE
         LDY   #$000E
         STA   [$E8],Y
         LDA   #$0092
         LDY   #$0010
         STA   [$E8],Y
         PEI   $FD
         JSL   L0818DF
         PLY
         LDY   #$000A
         STA   [$E8],Y
         BRL   L081B7F
L081B66  BRL   L081B7F
L081B69  DA    L081A58
         DA    L081B3F
         DA    L081B66
L081B6F  DEC
         DEC
         DEC
         CMP   #$0002
         BCC   L081B7A
         LDA   #$0002
L081B7A  ASL
         TAX
         JMP   (L081B69,X)

L081B7F  TSC
         CLC
         ADC   #$0010
         TCS
         PLD
         RTL

L081B87  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00EE
         TCS
         LDA   #$000C
         STA   $F0
         LDA   $FD
         CMP   $FF
         BNE   L081BC1
         PEI   $FF
         JSL   L0800E0
         PLY
         PEA   $00B4
         JSL   L0405F2
         PLY
         PEA   $0000
         PEA   ^L031622
         PEA   L031622
         JSL   L040732
         PLY
         PLY
         PLY
         STZ   $F0
         BRL   L081C4B
L081BC1  JSL   L0703A5
         AND   #$0007
         CMP   #$0000
         BEQ   L081BD0
         BRL   L081C4B
L081BD0  LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   #$000E
         LDY   #$000A
         STA   [$F2],Y
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   #$0000
         LDY   #$000C
         STA   [$F2],Y
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   #$0004
         LDY   #$0016
         STA   [$F2],Y
L081C4B  LDA   $F0
         TAY
         TSC
         CLC
         ADC   #$0008
         TCS
         TYA
         PLD
         RTL

L081C57  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00DE
         TCS
         LDA   $FD
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STX   $EA
         STA   $E8
         LDA   $FD
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STX   $E2
         STA   $E0
         LDA   $FF
         PHA
         LDA   #$001A
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03059A
         LDX   #^L03059A
         JSL   L010410
         PLA
         PLX
         STX   $E6
         STA   $E4
         LDA   #$0003
         LDY   #$0014
         STA   [$E8],Y
         LDA   #$0000
         LDY   #$000C
         STA   [$E8],Y
         LDA   $FF
         LDY   #$0012
         STA   [$E8],Y
         LDA   #$0000
         LDY   #$0006
         STA   [$E0],Y
         LDA   [$E0]
         CMP   #$0003
         BNE   L081D1D
         LDY   #$0002
         LDA   [$E4],Y
         PHA
         LDY   #$0004
         LDA   [$E8],Y
         PHA
         JSL   L0804DD
         PLY
         PLY
         STA   $EC
         LDA   $EC
         LDY   #$0006
         STA   [$E0],Y
         LDY   #$0004
         LDA   [$E8],Y
         CMP   $EC
         BEQ   L081D12
         LDA   #$0006
         LDY   #$000A
         STA   [$E8],Y
         BRA   L081D1A
L081D12  LDA   #$0010
         LDY   #$000A
         STA   [$E8],Y
L081D1A  BRL   L081DD8
L081D1D  LDA   $FD
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   #$0000
         LDY   #$0006
         STA   [$F2],Y
         LDA   #$0002
         LDY   #$000A
         STA   [$E8],Y
         LDA   #$0001
         PHA
         LDY   #$0008
         LDA   [$E8],Y
         SEC
         JSL   L01076A
         PLA
         STA   $EE
         LDY   #$0004
         LDA   [$E4],Y
         STA   $EC
         LDA   $EE
         STA   $F0
         BRA   L081DC6
L081D65  LDA   $F0
         AND   #$0003
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   $EC
         PHA
         LDA   #$0016
         CLC
         JSL   L01059C
         PLA
         LDX   #$0000
         PHX
         PHA
         LDA   #L03082E
         LDX   #^L03082E
         JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDX   $F4
         LDA   #$0006
         CLC
         ADC   $F2
         BCC   L081D9C
         INX
L081D9C  JSL   L010410
         PLA
         PLX
         STA   $F2
         STX   $F4
         LDA   [$F2]
         BEQ   L081DC4
         LDA   $F0
         AND   #$0003
         PHA
         LDA   #$0002
         SEC
         JSL   L01059C
         PLA
         CLC
         ADC   #$0001
         LDY   #$0008
         STA   [$E8],Y
         BRA   L081DD8
L081DC4  INC   $F0
L081DC6  LDA   $EE
         CLC
         ADC   #$0004
         SEC
         SBC   $F0
         BEQ   L081DD8
         BVS   L081DD6
         EOR   #$8000
L081DD6  BMI   L081D65
L081DD8  TSC
         CLC
         ADC   #$0018
         TCS
         PLD
         RTL

