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

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

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

L060000  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00F0
         TCS
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L060013  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00EC
         TCS
         PEA   $0032
         PEA   $0050
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         PEA   $0040
         PEA   $0078
         PEA   $0032
         PEA   $00C0
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1504BB
         TAY
         TSC
         CLC
         ADC   #$0014
         TCS
         TYA
         LDX   L0200BD
         LDA   L0200BB
         PHX
         PHA
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         PEA   $00B3
         PEA   $0050
         PEA   $0000
         JSL   L130695
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDX   L0200BD
         LDA   L0200BB
         PHX
         PHA
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         PEA   $00B2
         PEA   $0138
         PEA   $0001
         JSL   L130695
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         JSL   L070062
         STZ   $EE
         STZ   $F0
         BRA   L0600A6
L0600A0  INC   $EE
         BNE   L0600A6
         INC   $F0
L0600A6  SEC
         LDA   $EE
         SBC   $FD
         BNE   L0600B3
         LDA   $F0
         SBC   $FF
         BRA   L0600B9
L0600B3  LDA   $F0
         SBC   $FF
         REP   #$02
L0600B9  BVS   L0600BE
         EOR   #$8000
L0600BE  BPL   L0600A0
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00EC
         TCS
         PEA   $0032
         PEA   $0050
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         PEA   $0040
         PEA   $0078
         PEA   $0032
         PEA   $0080
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1504BB
         TAY
         TSC
         CLC
         ADC   #$0014
         TCS
         TYA
         LDX   L0200BD
         LDA   L0200BB
         PHX
         PHA
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         PEA   $00B3
         PEA   $0050
         PEA   $0000
         JSL   L130695
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDX   L0200BD
         LDA   L0200BB
         PHX
         PHA
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         PEA   $00B2
         PEA   $0138
         PEA   $0001
         JSL   L130695
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         JSL   L070062
         STZ   $EE
         STZ   $F0
         BRA   L06015B
L060155  INC   $EE
         BNE   L06015B
         INC   $F0
L06015B  SEC
         LDA   $EE
         SBC   $FD
         BNE   L060168
         LDA   $F0
         SBC   $FF
         BRA   L06016E
L060168  LDA   $F0
         SBC   $FF
         REP   #$02
L06016E  BVS   L060173
         EOR   #$8000
L060173  BPL   L060155
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L06017D  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00E2
         TCS
         LDX   L020139
         LDA   L020137
         STX   $E6
         STA   $E4
         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   $F4
         STX   $F6
         LDY   #$0008
         LDA   [$F4],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   $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
         STA   $F4
         STX   $F6
         LDX   $F6
         LDA   #$0006
         CLC
         ADC   $F4
         BCC   L06021C
         INX
L06021C  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         STA   $F2
         LDA   $FF
         ASL
         ASL
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L0304DA
         LDX   #^L0304DA
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         CMP   #$0003
         BEQ   L06024E
         BRL   L060365
L06024E  PEA   $0000
         PEA   $0000
         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   #$000E
         CLC
         ADC   $F4
         BCC   L060280
         INX
L060280  STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         JSL   L170184
         PLY
         PLY
         PLY
         LDX   #$0000
         TAY
         BPL   L060295
         DEX
L060295  STX   $EA
         STA   $E8
         LDX   $EA
         LDA   $E8
         CLC
         ADC   #$0002
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         PHX
         PHA
         LDX   $E6
         LDA   $E4
         JSL   L010410
         PLA
         PLX
         STX   $E6
         STA   $E4
         STZ   $EC
         STZ   $EE
         BRA   L0602D1
L0602BE  LDX   $EE
         LDA   $EC
         CLC
         ADC   #$0004
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STX   $EE
         STA   $EC
L0602D1  LDX   $EE
         LDA   $EC
         CLC
         ADC   #$0001
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         PHX
         PHA
         LDX   $E6
         LDA   $E4
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         CMP   #$0001
         BNE   L0602BE
         LDX   $EE
         LDA   $EC
         CLC
         ADC   #$0002
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         PHX
         PHA
         LDX   $E6
         LDA   $E4
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         AND   #$00FF
         CLC
         ADC   #$0050
         STA   L020035
         LDX   $EE
         LDA   $EC
         CLC
         ADC   #$0003
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         PHX
         PHA
         LDX   $E6
         LDA   $E4
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         AND   #$00FF
         CLC
         ADC   #$002E
         CLC
         ADC   #$0004
         CLC
         ADC   #$0010
         SEC
         SBC   #$001C
         STA   L020037
         BRL   L0604AE
L060365  PEA   $0000
         PEA   $0001
         LDA   $F0
         EOR   #$0002
         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   $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
         STA   $F4
         STX   $F6
         LDX   $F6
         LDA   #$000E
         CLC
         ADC   $F4
         BCC   L0603C6
         INX
L0603C6  JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         PHA
         JSL   L170184
         PLY
         PLY
         PLY
         LDX   #$0000
         TAY
         BPL   L0603E1
         DEX
L0603E1  STX   $EA
         STA   $E8
         LDX   $EA
         LDA   $E8
         CLC
         ADC   #$0002
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         PHX
         PHA
         LDX   $E6
         LDA   $E4
         JSL   L010410
         PLA
         PLX
         STX   $E6
         STA   $E4
         STZ   $EC
         STZ   $EE
         BRA   L06041D
L06040A  LDX   $EE
         LDA   $EC
         CLC
         ADC   #$0004
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STX   $EE
         STA   $EC
L06041D  LDX   $EE
         LDA   $EC
         CLC
         ADC   #$0001
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         PHX
         PHA
         LDX   $E6
         LDA   $E4
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         CMP   #$002F
         BNE   L06040A
         LDX   $EE
         LDA   $EC
         CLC
         ADC   #$0002
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         PHX
         PHA
         LDX   $E6
         LDA   $E4
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         AND   #$00FF
         SEC
         SBC   #$000E
         CLC
         ADC   #$0050
         STA   L020035
         LDX   $EE
         LDA   $EC
         CLC
         ADC   #$0003
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         PHX
         PHA
         LDX   $E6
         LDA   $E4
         JSL   L010410
         PLA
         PLX
         STA   $F4
         STX   $F6
         LDA   [$F4]
         AND   #$00FF
         AND   #$00FF
         CLC
         ADC   #$002E
         CLC
         ADC   #$0004
         CLC
         ADC   #$0010
         STA   L020037
L0604AE  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
         TSC
         CLC
         ADC   #$0016
         TCS
         PLD
         RTL

L060500  ENT
         PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00EE
         TCS
         PEA   $000C
         LDA   $FF
         ORA   #$8000
         PHA
         JSL   L110377
         PLY
         PLY
         PEA   $00A0
         JSL   L0405F2
         PLY
         PEA   $0000
         PEA   ^L03162A
         PEA   L03162A
         JSL   L040732
         PLY
         PLY
         PLY
         LDX   L020135
         LDA   L020133
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         LDA   L020037
         PHA
         LDA   L020035
         PHA
         PEA   $0040
         JSL   L130695
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         LDX   L0200A6
         LDA   L0200A4
         PHX
         PHA
         LDX   L020070
         LDA   L02006E
         PHX
         PHA
         JSL   L1607F3
         PLY
         PLY
         PLY
         PLY
         JSL   L070062
         STZ   $F0
         STZ   $F2
         BRA   L060581
L06057B  INC   $F0
         BNE   L060581
         INC   $F2
L060581  SEC
         LDA   $F0
         SBC   #$86A0
         BNE   L060590
         LDA   $F2
         SBC   #$0001
         BRA   L060597
L060590  LDA   $F2
         SBC   #$0001
         REP   #$02
L060597  BVS   L06059C
         EOR   #$8000
L06059C  BPL   L06057B
         TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

