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

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

	 use	TLBOX.E.S
	 use	TLBOX.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
	
*-----------------------

L160000  ENT
         LDY   #$0000
         LDX   #$0000
         LDA   L020129
         BEQ   L160012
         DEC
         STA   L020129
         BRL   L160080
L160012  SEP   #$20
         LDAL  PTRIG
         NOP
         NOP
         NOP
         NOP
         NOP
         NOP
L16001E  LDAL  PADDL0
         BPL   L160033
         INY
         CPY   #$0190
         BPL   L160078
L16002A  LDAL  PADDL1
         BPL   L16001E
         INX
         BRA   L16001E
L160033  LDAL  PADDL0
         BPL   L16003C
         INY
         BRA   L16002A
L16003C  LDAL  PADDL1
         BPL   L160045
         INX
         BRA   L160033
L160045  REP   #$20
         LDA   #$0004
         CPY   #$0002
         BMI   L16005A
         LDA   #$0008
         CPY   #$00E6
         BPL   L16005A
         LDA   #$0000
L16005A  STA   L02012D
         LDA   #$0001
         CPX   #$0002
         BMI   L160070
         LDA   #$0002
         CPX   #$00E6
         BPL   L160070
         LDA   #$0000
L160070  ORA   L02012D
         STA   L02012D
         BRA   L160086
L160078  REP   #$20
         LDA   #$0014
         STA   L020129
L160080  LDA   #$0000
         STA   L02012D
L160086  LDAL  L0200A8
         TAX
         LDAL  L0332C1,X
         AND   #$00FF
         BEQ   L160097
         STA   L02012D
L160097  LDAL  BUTN0
         AND   #$8080
         BEQ   L1600A3
         LDA   #$0080
L1600A3  ORA   L02012D
         STA   L02012D
         RTL

L1600AA  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00D8
         TCS
         PEA   $0000
         TDC
         CLC
         ADC   #$00E2
         PHA
         _ReadAsciiTime
         BCS   L1600CA
         LDA   #$0000
L1600CA  STAL  L020010
         LDA   $F1
         AND   #$00FF
         PHA
         LDA   $F2
         AND   #$00FF
         PHA
         LDA   #$0100
         SEC
         JSL   L01059C
         LDA   $EF
         AND   #$00FF
         PHA
         LDA   $EE
         AND   #$00FF
         PHA
         LDA   #$0100
         SEC
         JSL   L01059C
         LDA   $EC
         AND   #$00FF
         PHA
         LDA   $EB
         AND   #$00FF
         PHA
         LDA   #$0100
         SEC
         JSL   L01059C
         PLA
         PLX
         STX   $FA
         CLC
         ADC   $FA
         PLX
         STX   $FA
         CLC
         ADC   $FA
         PLX
         STX   $FA
         CLC
         ADC   $FA
         PLX
         STX   $FA
         CLC
         ADC   $FA
         PLX
         STX   $FA
         CLC
         ADC   $FA
         LDX   #$0000
         TAY
         BPL   L160130
         DEX
L160130  STX   $DC
         STA   $DA
         LDX   $DC
         LDA   $DA
         STA   L0200AC
         TSC
         CLC
         ADC   #$0022
         TCS
         PLD
         RTL

L160143  ENT
         LDAL  L0200A8
         BEQ   L16014D
         STAL  L02012B
L16014D  LDAL  L02012B
         TAX
         LDA   #$0000
         STAL  L02012B
         TXA
         RTL

L16015B  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00EE
         TCS
         LDA   #$0001
         STA   $F0
         LDA   #L033526
         LDX   #^L033526
         STX   $F4
         STA   $F2
         PEA   $000A	; P16 GET_PREFIX (1)
         PEA   $0000
         TDC
         CLC
         ADC   #$00F0
         PHA
         JSL   L010844
         LDA   #$0003
         STA   $F0
         PEA   $0009	; P16 SET_PREFIX (3)
         PEA   $0000
         TDC
         CLC
         ADC   #$00F0
         PHA
         JSL   L010844
         TSC
         CLC
         ADC   #$000C
         TCS
         PLD
         RTL

L1601A2  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00E8
         TCS
*         LDA   #$8000	; block locked down
	 lda   #%10000000_00001000 ; locked + no special
         STA   $EA
         SEC
         LDA   $FD
         SBC   #$FDE8
         BNE   L1601C1
         LDA   $FF
         SBC   #$0000
         BRA   L1601C8
L1601C1  LDA   $FF
         SBC   #$0000
         REP   #$02
L1601C8  BVS   L1601CD
         EOR   #$8000
L1601CD  BMI   L1601D7
         LDA   $EA
         CLC
         ADC   #$0010
         STA   $EA
L1601D7  PHX
         PHA
         PEI   $FF
         PEI   $FD
         LDA   L02000C
         PHA
         PEI   $EA
         PEA   $0000
         PEA   $0000
         _NewHandle
         BCS   L1601F5
         LDA   #$0000
L1601F5  STAL  L020010
         PLA
         PLX
         STX   $F0
         STA   $EE
         LDA   $EE
         CMP   #$0000
         BNE   L160216
         LDA   $F0
         CMP   #$0000
         BNE   L160216
         LDA   L020010
         PHA
         JSL   L1609A8
         PLY
L160216  LDY   #$0002
         LDA   [$EE],Y
         TAX
         LDA   [$EE]
         TAY
         TSC
         CLC
         ADC   #$000E
         TCS
         TYA
         PLD
         RTL

L160228  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00EC
         TCS
         PHX
         PHA
         PEI   $FF
         PEI   $FD
         _FindHandle
         BCS   L160245
         LDA   #$0000
L160245  STAL  L020010
         PLA
         PLX
         STX   $F0
         STA   $EE
         SEC
         LDA   $EE
         SBC   #$0000
         BNE   L16025E
         LDA   $F0
         SBC   #$0000
         BRA   L160265
L16025E  LDA   $F0
         SBC   #$0000
         REP   #$02
L160265  BEQ   L16027B
         PEI   $F0
         PEI   $EE
         _DisposeHandle
         BCS   L160277
         LDA   #$0000
L160277  STAL  L020010
L16027B  LDA   $EE
         CMP   #$0000
         BNE   L160292
         LDA   $F0
         CMP   #$0000
         BNE   L160292
         LDA   L020010
         PHA
         JSL   L1609A8
         PLY
L160292  TSC
         CLC
         ADC   #$000A
         TCS
         PLD
         RTL

L16029A  PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00EA
         TCS
         PEA   $0020
         PEI   $FF
         PEI   $FD
         JSL   L050068
         PLY
         PLY
         PLY
         STA   $EC
         PHA
         JSL   L050137
         PLY
         STX   $F0
         STA   $EE
         PEI   $EC
         JSL   L050110
         PLY
         LDX   $F0
         LDA   $EE
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         PLD
         RTL

L1602D4  ENT
         PHD
         TSC
         SEC
         SBC   #$00F1
         TCD
         ADC   #$00E4
         TCS
         PEA   $0020
         PEI   $F9
         PEI   $F7
         JSL   L050068
         PLY
         PLY
         PLY
         STA   $EA
         LDA   $EA
         CMP   #$FFFF
         BEQ   L16031C
         PEI   $FF
         PEI   $FD
         PEI   $FB
         PEI   $EA
         JSL   L0500BA
         PLY
         PLY
         PLY
         PLY
         STA   $E8
         LDA   $E8
         LDX   #$0000
         STX   L020131
         STA   L02012F
         PEI   $EA
         JSL   L050110
         PLY
         BRA   L160328
L16031C  STZ   $E8
         PEI   $F9
         PEI   $F7
         JSL   L1609CA
         PLY
         PLY
L160328  LDA   $E8
         TAY
         TSC
         CLC
         ADC   #$000C
         TCS
         TYA
         PLD
         RTL

L160334  ENT
         PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$00DC
         TCS
L16033F  PEI   $FF
         PEI   $FD
         JSL   L16029A
         PLY
         PLY
         STX   $F0
         STA   $EE
         LDA   $EE
         CMP   #$FFFF
         BNE   L160368
         LDA   $F0
         CMP   #$FFFF
         BNE   L160368
         PEI   $FF
         PEI   $FD
         JSL   L1609CA
         PLY
         PLY
         BRL   L16044F
L160368  PEI   $F0
         PEI   $EE
         JSL   L1601A2
         PLY
         PLY
         STX   $EC
         STA   $EA
         STX   $E8
         STA   $E6
         LDX   $F0
         LDA   $EE
         STX   L020131
         STA   L02012F
         PEA   $0020
         PEI   $FF
         PEI   $FD
         JSL   L050068
         PLY
         PLY
         PLY
         STA   $DE
L160394  SEC
         LDA   $EE
         SBC   #$FFFF
         BNE   L1603A3
         LDA   $F0
         SBC   #$0000
         BRA   L1603AA
L1603A3  LDA   $F0
         SBC   #$0000
         REP   #$02
L1603AA  BEQ   L160413
         BVS   L1603B1
         EOR   #$8000
L1603B1  BPL   L160413
         PEA   $FFFF
         PEI   $E8
         PEI   $E6
         PEI   $DE
         JSL   L0500BA
         PLY
         PLY
         PLY
         PLY
         STA   $E4
         LDA   $E4
         CMP   #$FFFF
         BEQ   L1603EB
         PEI   $FF
         PEI   $FD
         JSL   L160A34
         PLY
         PLY
         PEI   $EC
         PEI   $EA
         JSL   L160228
         PLY
         PLY
         STZ   $EA
         STZ   $EC
         STZ   $EE
         STZ   $F0
         BRA   L160411
L1603EB  LDX   $F0
         LDA   $EE
         SEC
         SBC   #$FFFF
         PHA
         TXA
         SBC   #$0000
         TAX
         PLA
         STX   $F0
         STA   $EE
         LDX   $E8
         LDA   $E6
         CLC
         ADC   #$FFFF
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         STX   $E8
         STA   $E6
L160411  BRA   L160394
L160413  LDX   $F0
         LDA   $EE
         PHA
         PEI   $E8
         PEI   $E6
         PEI   $DE
         JSL   L0500BA
         PLY
         PLY
         PLY
         PLY
         STA   $E4
         PEI   $DE
         JSL   L050110
         PLY
         LDX   $F0
         LDA   $EE
         CMP   $E4
         BEQ   L16044F
         PEI   $FF
         PEI   $FD
         JSL   L160A34
         PLY
         PLY
         PEI   $EC
         PEI   $EA
         JSL   L160228
         PLY
         PLY
         STZ   $EA
         STZ   $EC
L16044F  LDA   $EA
         CMP   #$0000
         BNE   L16045B
         LDA   $EC
         CMP   #$0000
L16045B  SEC
         LDA   $EA
         SBC   #$0000
         BNE   L16046A
         LDA   $EC
         SBC   #$0000
         BRA   L160471
L16046A  LDA   $EC
         SBC   #$0000
         REP   #$02
L160471  BNE   L160476
         BRL   L16033F
L160476  LDX   $EC
         LDA   $EA
         TAY
         TSC
         CLC
         ADC   #$001A
         TCS
         TYA
         PLD
         RTL

L160484  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00D0
         TCS
         PEA   $0000
         PEA   $0000
         TDC
         CLC
         ADC   #$00D2
         PHA
         _GetColorTable
         BCS   L1604A7
         LDA   #$0000
L1604A7  STAL  L020010
L1604AB  STZ   $F4
         STZ   $F2
         BRL   L16058F
L1604B2  LDA   $F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00D2
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         AND   #$0F00
         TAY
         BEQ   L1604FB
         LDA   $F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00D2
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         SEC
         SBC   #$0100
         STA   [$F6]
         LDA   #$FFFF
         STA   $F4
L1604FB  LDA   $F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00D2
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         AND   #$00F0
         TAY
         BEQ   L160544
         LDA   $F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00D2
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         SEC
         SBC   #$0010
         STA   [$F6]
         LDA   #$FFFF
         STA   $F4
L160544  LDA   $F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00D2
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         AND   #$000F
         TAY
         BEQ   L16058D
         LDA   $F2
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00D2
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   [$F6]
         SEC
         SBC   #$0001
         STA   [$F6]
         LDA   #$FFFF
         STA   $F4
L16058D  INC   $F2
L16058F  LDA   $F2
         CMP   #$0010
         BEQ   L160599
         BRL   L1604B2
L160599  JSL   L160886
         PEA   $0000
         PEA   $0000
         TDC
         CLC
         ADC   #$00D2
         PHA
         _SetColorTable
         BCS   L1605B5
         LDA   #$0000
L1605B5  STAL  L020010
         LDA   $F4
         BEQ   L1605C0
         BRL   L1604AB
L1605C0  TSC
         CLC
         ADC   #$002A
         TCS
         PLD
         RTL

L1605C8  ENT
         PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00C8
         TCS
         STZ   $EC
         BRA   L1605F8
L1605D7  LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00CA
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   #$0000
         STA   [$F0]
         INC   $EC
L1605F8  LDA   $EC
         CMP   #$0010
         BNE   L1605D7
         STZ   $EA
L160601  STZ   $EE
         STZ   $EC
         BRL   L16075D
L160608  LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00CA
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         AND   #$0F00
         PHA
         LDA   $EC
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         AND   #$0F00
         PLX
         STX   $F0
         CMP   $F0
         BEQ   L160679
         BCC   L160679
         LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00CA
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         CLC
         ADC   #$0100
         STA   [$F0]
         LDA   #$FFFF
         STA   $EE
L160679  LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00CA
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         AND   #$00F0
         PHA
         LDA   $EC
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         AND   #$00F0
         PLX
         STX   $F0
         CMP   $F0
         BEQ   L1606EA
         BCC   L1606EA
         LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00CA
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         CLC
         ADC   #$0010
         STA   [$F0]
         LDA   #$FFFF
         STA   $EE
L1606EA  LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00CA
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         AND   #$000F
         PHA
         LDA   $EC
         LDX   #$0000
         STX   $F4
         ASL
         ROL   $F4
         LDX   $F4
         PHX
         PHA
         LDX   $FD
         LDA   $FB
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         AND   #$000F
         PLX
         STX   $F0
         CMP   $F0
         BEQ   L16075B
         BCC   L16075B
         LDA   $EC
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00CA
         JSL   L010410
         PLA
         PLX
         STA   $F0
         STX   $F2
         LDA   [$F0]
         CLC
         ADC   #$0001
         STA   [$F0]
         LDA   #$FFFF
         STA   $EE
L16075B  INC   $EC
L16075D  LDA   $EC
         CMP   #$0010
         BEQ   L160767
         BRL   L160608
L160767  INC   $EA
         JSL   L160886
         PEA   $0000
         PEA   $0000
         TDC
         CLC
         ADC   #$00CA
         PHA
         _SetColorTable
         BCS   L160785
         LDA   #$0000
L160785  STAL  L020010
         LDA   $EE
         BEQ   L160790
         BRL   L160601
L160790  TSC
         CLC
         ADC   #$002C
         TCS
         PLD
         RTL

L160798  ENT
         PHD
         TSC
         SEC
         SBC   #$00FB
         TCD
         ADC   #$00D2
         TCS
         STZ   $D4
         BRA   L1607C8
L1607A7  LDA   $D4
         ASL
         LDX   #$0000
         PHX
         PHA
         LDX   #$0000
         TDC
         CLC
         ADC   #$00D6
         JSL   L010410
         PLA
         PLX
         STA   $F6
         STX   $F8
         LDA   #$0000
         STA   [$F6]
         INC   $D4
L1607C8  LDA   $D4
         CMP   #$0010
         BNE   L1607A7
         PEA   $0000
         PEA   $0000
         TDC
         CLC
         ADC   #$00D6
         PHA
         _SetColorTable
         BCS   L1607E7
         LDA   #$0000
L1607E7  STAL  L020010
         TSC
         CLC
         ADC   #$0028
         TCS
         PLD
         RTL

L1607F3  ENT
         PHD
         TSC
         SEC
         SBC   #$00F3
         TCD
         ADC   #$00EC
         TCS
         PEA   $00C8
         PEI   $FF
         PEI   $FD
         PEI   $FB
         PEI   $F9
         JSL   L160894
         PLY
         PLY
         PLY
         PLY
         PLY
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L16081A  ENT
         PHD
         TSC
         SEC
         SBC   #$00ED
         TCD
         ADC   #$00E6
         TCS
         PEI   $FF
         LDA   $FD
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L033394
         LDX   #^L033394
         JSL   L010410
         PLA
         PLX
         STA   $E8
         STX   $EA
         LDA   [$E8]
         LDX   #$0000
         PHX
         PHA
         LDX   $FB
         LDA   $F9
         JSL   L010410
         LDA   $F7
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L033394
         LDX   #^L033394
         JSL   L010410
         PLA
         PLX
         STA   $E8
         STX   $EA
         LDA   [$E8]
         LDX   #$0000
         PHX
         PHA
         LDX   $F5
         LDA   $F3
         JSL   L010410
         JSL   L160894
         PLY
         PLY
         PLY
         PLY
         PLY
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L160886  ENT
         LDA   #$0000
         STAL  L020000
L16088D  LDAL  L020000
         BEQ   L16088D
         RTL

L160894  PHD
         TSC
         SEC
         SBC   #$00F1
         TCD
         ADC   #$00E8
         TCS
         LDA   $FF
         ASL
         LDX   #$0000
         PHX
         PHA
         LDA   #L033394
         LDX   #^L033394
         JSL   L010410
         PLA
         PLX
         STA   $EC
         STX   $EE
         LDA   [$EC]
         STA   $FF
         PHB
         PHK
         PLB
         PER   L1608D6+1
         PLA
         STA   $EA
         SEP   #$20
         LDA   $F9
         XBA
         LDA   $FD
         REP   #$20
         STA   ($EA)
         LDX   $F7
         LDY   $FB
         LDA   $FF
         DEC
L1608D6  MVN   $010000,$000000
         PLB
         TSC
         CLC
         ADC   #$0008
         TCS
         PLD
         RTL

L1608E2  ENT
         PHD
         TSC
         SEC
         SBC   #$00F1
         TCD
         ADC   #$00E7
         TCS
         LDY   #$0000
         STY   $EA
         LDX   #$0000
         SEP   #$20
L1608F7  CPX   $FF
         BEQ   L160934
         LDY   $EA
         LDA   [$F7],Y
         BEQ   L160934
         BPL   L16091D
         STA   $E9
         INY
         STY   $EA
L160908  LDY   $EA
         LDA   [$F7],Y
         INY
         STY   $EA
         TXY
         STA   [$FB],Y
         INX
         CPX   $FF
         BEQ   L160934
         INC   $E9
         BNE   L160908
         BRA   L1608F7
L16091D  INY
         STA   $E9
         LDA   [$F7],Y
         INY
         STY   $EA
         TXY
L160926  STA   [$FB],Y
         INY
         CPY   $FF
         BEQ   L160934
         DEC   $E9
         BNE   L160926
         TYX
         BRA   L1608F7
L160934  REP   #$20
         LDX   $FD
         LDA   $FB
         TAY
         TSC
         CLC
         ADC   #$0009
         TCS
         TYA
         PLD
         RTL

L160944  ENT
         PHD
         TSC
         SEC
         SBC   #$00F1
         TCD
         ADC   #$00E7
         TCS
         PEI   $FF
         PEI   $FD
         PEI   $FB
         LDX   $F9
         LDA   $F7
         CLC
         ADC   #$0020
         PHA
         TXA
         ADC   #$0000
         TAX
         PLA
         PHX
         PHA
         JSL   L1608E2
         PLY
         PLY
         PLY
         PLY
         PLY
         TSC
         CLC
         ADC   #$0009
         TCS
         PLD
         RTL

L160977  PHD
         TSC
         SEC
         SBC   #$00F5
         TCD
         ADC   #$00EE
         TCS
         PEI   $FF
         PEI   $FD
         PEI   $FB
         JSL   L050000
         PLY
         PLY
         PHX
         PHA
         _SysFailMgr
         BCS   L16099C
         LDA   #$0000
L16099C  STAL  L020010
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L1609A8  PHD
         TSC
         SEC
         SBC   #$00F9
         TCD
         ADC   #$00F2
         TCS
         PEI   $FF
         PEA   ^L033343
         PEA   L033343
         JSL   L160977
         PLY
         PLY
         PLY
         TSC
         CLC
         ADC   #$0006
         TCS
         PLD
         RTL

L1609CA  PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$008C
         TCS
         PEA   ^L033365
         PEA   L033365
         PEA   $0000
         TDC
         CLC
         ADC   #$008E
         PHA
         JSL   L010882
         PLY
         PLY
         PLY
         PLY
         PEI   $FF
         PEI   $FD
         PEA   $0000
         TDC
         CLC
         ADC   #$008E
         PHA
         JSL   L0107D7
         PLY
         PLY
         PLY
         PLY
         PEA   ^L03336C
         PEA   L03336C
         PEA   $0000
         TDC
         CLC
         ADC   #$008E
         PHA
         JSL   L0107D7
         PLY
         PLY
         PLY
         PLY
         LDA   L020010
         PHA
         PEA   $0000
         TDC
         CLC
         ADC   #$008E
         PHA
         JSL   L160977
         PLY
         PLY
         PLY
         TSC
         CLC
         ADC   #$006A
         TCS
         PLD
         RTL

L160A34  PHD
         TSC
         SEC
         SBC   #$00F7
         TCD
         ADC   #$008C
         TCS
         PEA   ^L033379
         PEA   L033379
         PEA   $0000
         TDC
         CLC
         ADC   #$008E
         PHA
         JSL   L010882
         PLY
         PLY
         PLY
         PLY
         PEI   $FF
         PEI   $FD
         PEA   $0000
         TDC
         CLC
         ADC   #$008E
         PHA
         JSL   L0107D7
         PLY
         PLY
         PLY
         PLY
         PEA   ^L03338B
         PEA   L03338B
         PEA   $0000
         TDC
         CLC
         ADC   #$008E
         PHA
         JSL   L0107D7
         PLY
         PLY
         PLY
         PLY
         PEA   $FFFF
         PEA   $0000
         TDC
         CLC
         ADC   #$008E
         PHA
         JSL   L160977
         PLY
         PLY
         PLY
         TSC
         CLC
         ADC   #$006A
         TCS
         PLD
         RTL

