DKC2_CODE_BEB800.asm
Yoshifanatic1_Donkey-Kong-Country-3-Disassembly/DKC3/GarbageData/DKC2_CODE_BEB800.asm

CODE_BEB800:
	TAX
	PHK
	PLB
	JMP.w (DATA_BEB806,x)

DATA_BEB806:
	dw $BECB97
	dw $BECDD9
	dw $BECE84
	dw $BECF6A
	dw $BEE487
	dw $BEE086
	dw $BEE2E1
	dw CODE_BEB850
	dw CODE_BEBA99
	dw $BEE6F3
	dw $BEE8C5
	dw $BEEA95
	dw $BEEB56
	dw $BEEC8A
	dw $BEEE44
	dw $BEEF43
	dw $BEEFA5
	dw $BEEA87

CODE_BEB82A:
	PHK
	PLB
	LDY.b $64
	LDA.w $0054,y
	STA.b $8E
	LDA.w $002E,y
	AND.w #$007F
	ASL
	SEC
	ADC.b $01,S
	TAX
	PLA
	LDA.w $002F,y
	AND.w #$00FF
	ASL
	JMP.w ($0000,x)

CODE_BEB849:
	JSL.l $BBBB76
	JMP.w [$05A9]

CODE_BEB850:
	JSR.w CODE_BEB82A

DATA_BEB853:
	dw CODE_BEB86B
	dw CODE_BEB8EF
	dw CODE_BEB94D
	dw CODE_BEB992
	dw CODE_BEB9E4
	dw CODE_BEB8EF
	dw CODE_BEBA2C
	dw CODE_BEBA39
	dw CODE_BEBA3C
	dw CODE_BEBA57
	dw CODE_BEBA5A
	dw CODE_BEBA7D

CODE_BEB86B:
	JSL.l $B9D100
	JSL.l $BCFB58
	JSL.l CODE_BEBE6D
	BCS.b CODE_BEB87C
	JMP.w CODE_BEB849

CODE_BEB87C:
	LDA.w #$0064
	LDX.b $64
	LDY.b $4C,x
	CPY.w #$08CC
	BCC.b CODE_BEB898
	BNE.b CODE_BEB88F
	LDA.w #$004C
	BRA.b CODE_BEB898

CODE_BEB88F:
	JSL.l $BB8147
	LDX.b $64
	LDA.w #$0064
CODE_BEB898:
	STA.b $32
	LDA.w $0000,y
	STA.w $4204
	CLC
	ADC.b $42,x
	CMP.b $32
	BCC.b CODE_BEB8B2
	LDA.b $32
	DEC
	SBC.w $0000,y
	STA.b $42,x
	LDA.b $32
	DEC
CODE_BEB8B2:
	STA.w $0000,y
	SEP.b #$20
	LDA.b #$0A
	STA.w $4206
	REP.b #$20
	LDA.b $4A,x
	EOR.b $4F,x
	AND.w #$00FF
	EOR.b $4F,x
	JSL.l $BEC5A7
	SEP.b #$20
	LDA.w $4214
	XBA
	LDA.w $4216
	REP.b #$20
	LDX.b $64
	STA.b $46,x
	LDA.b $48,x
	AND.w #$00FF
	ORA.w #$F000
	STA.b $44,x
	INC.b $2E,x
	LDA.b $4E,x
	JSL.l $B58003
	JMP.w [$05A9]

CODE_BEB8EF:
	JSL.l $B9D100
	LDX.b $64
	LDA.w $097D
	BNE.b CODE_BEB8FD
	STX.w $097D
CODE_BEB8FD:
	LDA.b $44,x
	CLC
	ADC.w #$0200
	BMI.b CODE_BEB90B
	CMP.b $48,x
	BCC.b CODE_BEB90B
	LDA.b $48,x
CODE_BEB90B:
	STA.b $44,x
	JSL.l $BEC5E5
	BPL.b CODE_BEB94A
	LDX.b $64
	STX.w $097D
	LDA.b $48,x
	CMP.b $44,x
	BNE.b CODE_BEB94A
	LDA.b $2A
	AND.w #$0007
	BNE.b CODE_BEB94A
	DEC.b $42,x
	BMI.b CODE_BEB948
	BEQ.b CODE_BEB933
	LDA.b $4E,x
	JSL.l $B58003
	LDX.b $64
CODE_BEB933:
	LDA.b $46,x
	CMP.w #$0909
	BEQ.b CODE_BEB948
	SED
	CLC
	ADC.w #$0091
	AND.w #$0F0F
	CLD
	STA.b $46,x
	JMP.w [$05A9]

CODE_BEB948:
	INC.b $2E,x
CODE_BEB94A:
	JMP.w [$05A9]

CODE_BEB94D:
	TYX
	DEC.b $5C,x
	BPL.b CODE_BEB984
	DEC.b $0A,x
	DEC.b $0A,x
	SEP.b #$20
	CLC
	DEC.b $45,x
	DEC.b $45,x
	BPL.b CODE_BEB967
	LDA.b #$F0
	CMP.b $45,x
	BCC.b CODE_BEB967
	STA.b $45,x
CODE_BEB967:
	REP.b #$20
	BCC.b CODE_BEB984
	SEP.b #$20
	LDA.b $51,x
	CMP.b $0A,x
	REP.b #$20
	BNE.b CODE_BEB984
	CPX.w $097D
	BNE.b CODE_BEB97D
	STZ.w $097D
CODE_BEB97D:
	JSL.l $BB82B8
	JMP.w [$05A9]

CODE_BEB984:
	LDX.b $64
	CPX.w $097D
	BNE.b CODE_BEB97D
	JSL.l $B9D100
	JMP.w [$05A9]

CODE_BEB992:
	LDA.w $052D
	AND.w #$00FF
	CMP.w #$0003
	BNE.b CODE_BEB9B2
	LDA.w #$0621
	JSL.l $B58003
	LDA.w #$0522
	JSL.l $B58003
	LDA.w #$0735
	JSL.l $B58003
CODE_BEB9B2:
	JSL.l $BB8114
	BCC.b CODE_BEB9D6
	LDX.b $64
	LDA.b $36,x
	CMP.w #$01C3
	BNE.b CODE_BEB9C6
	LDA.w #$01C5
	BRA.b CODE_BEB9C9

CODE_BEB9C6:
	LDA.w #$01C4
CODE_BEB9C9:
	JSL.l $B9D0C6
	LDX.b $64
	LDA.w #$0003
	JSL.l $BB8C44
CODE_BEB9D6:
	LDY.w #$00CE
	JSL.l $BB842C
	LDX.b $64
	INC.b $2E,x
	JMP.w [$05A9]

CODE_BEB9E4:
	JSL.l $B9D100
	JSL.l $BCFB58
	JSL.l CODE_BEBE6D
	BCS.b CODE_BEB9F5
CODE_BEB9F2:
	JMP.w [$05A9]

CODE_BEB9F5:
	LDX.b $6A
	CPX.w $0597
	BEQ.b CODE_BEB9F2
	LDA.w #$0200
	JSL.l CODE_BEBE4D
	BCS.b CODE_BEB9F2
	JSL.l $BB8125
	JSL.l $BB819F
	LDA.w #$0002
	TSB.w $08C4
	LDX.b $64
	LDA.b $36,x
	CMP.w #$01C4
	BEQ.b CODE_BEBA24
	CMP.w #$01C5
	BEQ.b CODE_BEBA24
	JMP.w CODE_BEB87C

CODE_BEBA24:
	LDA.w #$0007
	STA.b $2E,x
	JMP.w [$05A9]

CODE_BEBA2C:
	LDA.b $5C,x
	BPL.b CODE_BEBA36
	LDA.w #$0002
	TSB.w $08C4
CODE_BEBA36:
	JMP.w CODE_BEB94D

CODE_BEBA39:
	JMP.w [$05A9]

CODE_BEBA3C:
	JSL.l $BB8135
	BCC.b CODE_BEBA50
	LDA.w #$01C5
	JSL.l $B9D0C6
	LDX.b $64
	INC.b $2E,x
	JMP.w [$05A9]

CODE_BEBA50:
	LDX.b $64
	STZ.b $2E,x
	JMP.w [$05A9]

CODE_BEBA57:
	JMP.w CODE_BEB849

CODE_BEBA5A:
	LDA.w #$0621
	JSL.l $B58003
	LDA.w #$0522
	JSL.l $B58003
	LDA.w #$0735
	JSL.l $B58003
	LDY.w #$00CE
	JSL.l $BB842C
	LDX.b $64
	INC.b $2E,x
	JMP.w [$05A9]

CODE_BEBA7D:
	JSL.l $B9D100
	JSL.l $BCFB58
	JSL.l CODE_BEBE6D
	BCC.b CODE_BEBA96
	LDA.w #$004B
	STA.w $08B8
	STZ.b $2E,x
	BRL.w CODE_BEB87C

CODE_BEBA96:
	JMP.w [$05A9]

CODE_BEBA99:
	JSR.w CODE_BEB82A

DATA_BEBA9C:
	dw CODE_BEBAAA
	dw CODE_BEBB1F
	dw CODE_BEBB2A
	dw CODE_BEBB6E
	dw CODE_BEBBCA
	dw CODE_BEBC07
	dw CODE_BEBC9A

CODE_BEBAAA:
	LDA.w $004C,y
	AND.w $0902
	BEQ.b CODE_BEBAB9
	JSL.l $BB82B8
	JMP.w [$05A9]

CODE_BEBAB9:
	JSL.l $B9D100
	JSL.l $BCFB58
	JSL.l CODE_BEBE6D
	BCS.b CODE_BEBACA
	JMP.w CODE_BEB849

CODE_BEBACA:
	LDA.b $12,x
	ORA.w #$3000
	STA.b $12,x
	TXA
	CLC
	ADC.b $4A,x
	TAY
	LDA.w $0000,y
	EOR.b $4F,x
	AND.w #$00FF
	EOR.b $4F,x
	JSL.l $BEC5A7
	INC.b $2E,x
	LDA.b $4C,x
	TSB.w $0902
	LDA.w $0902
	INC
	AND.w #$000F
	STA.b $52,x
	BNE.b CODE_BEBAFD
	LDA.w #$0001
	JSL.l $BEC637
CODE_BEBAFD:
	LDA.b $4E,x
	JSL.l $B58003
	LDX.b $64
	LDA.w $0902
	LSR
	BCS.b CODE_BEBB0D
	STZ.b $42,x
CODE_BEBB0D:
	LSR
	BCS.b CODE_BEBB12
	STZ.b $44,x
CODE_BEBB12:
	LSR
	BCS.b CODE_BEBB17
	STZ.b $46,x
CODE_BEBB17:
	LSR
	BCS.b CODE_BEBB1C
	STZ.b $48,x
CODE_BEBB1C:
	JMP.w [$05A9]

CODE_BEBB1F:
	JSL.l $B9D100
	JSL.l $BEC5E5
	JMP.w [$05A9]

CODE_BEBB2A:
	JSL.l $BEC5E5
	LDY.b $64
	LDA.w $0012,y
	AND.w #$01FF
	ASL
	ASL
	ASL
	ASL
	LDX.w #$08C0
	LDY.w #$2401
	PHA
	JSR.w CODE_BEBD5C
	PLA
	BCS.b CODE_BEBB5E
	ADC.w #$0100
	LDX.w #$08C0
	LDY.w #$2501
	JSR.w CODE_BEBD5C
	BCC.b CODE_BEBB61
	LDA.w $1730
	SBC.w #$0008
	STA.w $1730
CODE_BEBB5E:
	JMP.w [$05A9]

CODE_BEBB61:
	LDX.b $64
	STX.w $097B
	LDA.w #$C000
	STA.b $1C,x
	INC.b $2E,x
	TXY
CODE_BEBB6E:
	TYX
	LDY.w #$0003
	STZ.b $5E
	LDA.b $50,x
	STA.b $60
	SEP.b #$20
CODE_BEBB7A:
	LDA.b $42,x
	BEQ.b CODE_BEBB8A
	LDA.b $43,x
	CMP.b $60
	BEQ.b CODE_BEBB8A
	INC.b $43,x
	INC.b $43,x
	INC.b $5E
CODE_BEBB8A:
	INX
	INX
	DEY
	BPL.b CODE_BEBB7A
	REP.b #$20
	JSL.l $BEC5E5
	BMI.b CODE_BEBB99
	INC.b $5E
CODE_BEBB99:
	TXA
	CLC
	ADC.b $4A,x
	TAY
	SEP.b #$20
	LDA.b $0A,x
	XBA
	LDA.b $06,x
	REP.b #$20
	STA.w $0000,y
	LDA.b $5E
	BNE.b CODE_BEBBC7
	INC.b $2E,x
	LDA.b $52,x
	BNE.b CODE_BEBBC7
	INC.b $2E,x
	STZ.b $5C,x
	LDA.w #$0003
CODE_BEBBBB:
	SEC
	LDY.w #$20E8
	PHA
	JSR.w CODE_BEBCB2
	PLA
	DEC
	BPL.b CODE_BEBBBB
CODE_BEBBC7:
	JMP.w [$05A9]

CODE_BEBBCA:
	TYX
	DEC.b $5C,x
	BPL.b CODE_BEBC04
	TYX
	LDY.w #$0003
	STZ.b $5E
	LDA.b $51,x
	STA.b $60
	SEP.b #$20
CODE_BEBBDB:
	LDA.b $42,x
	BEQ.b CODE_BEBBEB
	LDA.b $43,x
	CMP.b $60
	BEQ.b CODE_BEBBEB
	DEC.b $43,x
	DEC.b $43,x
	INC.b $5E
CODE_BEBBEB:
	INX
	INX
	DEY
	BPL.b CODE_BEBBDB
	REP.b #$20
	LDA.b $5E
	BNE.b CODE_BEBC04
	LDA.b $64
	CMP.w $097B
	BNE.b CODE_BEBC00
	STZ.w $097B
CODE_BEBC00:
	JSL.l $BB82B8
CODE_BEBC04:
	JMP.w [$05A9]

CODE_BEBC07:
	LDA.w #$0078
	STA.w $0973
	LDX.b $64
	INC.b $5C,x
	LDA.b $5C,x
	CMP.w #$002F
	BCS.b CODE_BEBC31
	BIT.w #$0008
	BEQ.b CODE_BEBC27
	LDA.b $12,x
	AND.w #$7FFF
	STA.b $12,x
	JMP.w [$05A9]

CODE_BEBC27:
	LDA.b $12,x
	ORA.w #$8000
	STA.b $12,x
	JMP.w [$05A9]

CODE_BEBC31:
	BEQ.b CODE_BEBC82
	CMP.w #$004B
	BCC.b CODE_BEBC89
	BEQ.b CODE_BEBC70
	CMP.w #$0067
	BCC.b CODE_BEBC77
	BEQ.b CODE_BEBC5E
	CMP.w #$0083
	BCC.b CODE_BEBC65
	BNE.b CODE_BEBC4F
	LDA.w #$042A
	JSL.l $B58003
CODE_BEBC4F:
	LDA.w #$0003
	CLC
	JSR.w CODE_BEBCB2
	BPL.b CODE_BEBC65
	LDX.b $64
	INC.b $2E,x
	BRA.b CODE_BEBC92

CODE_BEBC5E:
	LDA.w #$0529
	JSL.l $B58003
CODE_BEBC65:
	LDA.w #$0002
	CLC
	JSR.w CODE_BEBCB2
	BPL.b CODE_BEBC77
	BRA.b CODE_BEBC92

CODE_BEBC70:
	LDA.w #$0628
	JSL.l $B58003
CODE_BEBC77:
	LDA.w #$0001
	CLC
	JSR.w CODE_BEBCB2
	BPL.b CODE_BEBC89
	BRA.b CODE_BEBC92

CODE_BEBC82:
	LDA.w #$0727
	JSL.l $B58003
CODE_BEBC89:
	LDA.w #$0000
	CLC
	JSR.w CODE_BEBCB2
	BPL.b CODE_BEBC97
CODE_BEBC92:
	LDA.w #$0000
	STA.b ($32)
CODE_BEBC97:
	JMP.w [$05A9]

CODE_BEBC9A:
	JSL.l $BB82B8
	LDA.w #$0001
	JSL.l $BEC629
	LDX.b $64
	CPX.w $097B
	BNE.b CODE_BEBCAF
	STZ.w $097B
CODE_BEBCAF:
	JMP.w [$05A9]

CODE_BEBCB2:
	BCC.b CODE_BEBCCE
	PHY
	JSR.w CODE_BEBD0F
	LDA.b ($32)
	AND.w #$00FF
	XBA
	STA.b ($34)
	LDA.b ($32)
	AND.w #$FF00
	STA.b ($36)
	PLA
	STA.b ($38)
	LDY.w #$0001
	RTS

CODE_BEBCCE:
	JSR.w CODE_BEBD0F
	LDA.b ($32)
	BEQ.b CODE_BEBD0E
	LDA.w #$0200
	STA.b $5E
	LDA.b ($38)
	XBA
	AND.w #$FF00
	SEC
	SBC.b ($34)
	JSR.w CODE_BEBD2A
	CLC
	ADC.b ($34)
	STA.b ($34)
	AND.w #$FF00
	XBA
	STA.b ($32)
	LDA.w #$0040
	STA.b $5E
	LDA.b ($38)
	AND.w #$FF00
	SEC
	SBC.b ($36)
	JSR.w CODE_BEBD2A
	CLC
	ADC.b ($36)
	STA.b ($36)
	AND.w #$FF00
	ORA.b ($32)
	STA.b ($32)
	DEY
CODE_BEBD0E:
	RTS

CODE_BEBD0F:
	ASL
	ASL
	TAX
	LDY.w #$FFFA
CODE_BEBD15:
	LDA.l DATA_BEBD4C,x
	AND.w #$00FF
	CLC
	ADC.b $64
	STA.w $0038,y
	INX
	INY
	INY
	BMI.b CODE_BEBD15
	BEQ.b CODE_BEBD15
	RTS

CODE_BEBD2A:
	BEQ.b CODE_BEBD3A
	BCS.b CODE_BEBD3C
	EOR.w #$FFFF
	INC
	JSR.w CODE_BEBD3C
	EOR.w #$FFFF
	INC
	RTS

CODE_BEBD3A:
	DEY
	RTS

CODE_BEBD3C:
	CMP.w #$0100
	BCC.b CODE_BEBD4B
	LSR
	LSR
	LSR
	LSR
	CMP.b $5E
	BCS.b CODE_BEBD4B
	LDA.b $5E
CODE_BEBD4B:
	RTS

DATA_BEBD4C:
	db $42,$04,$06,$4A,$44,$08,$0A,$4C,$46,$20,$22,$50,$48,$26,$28,$52

CODE_BEBD5C:
	STX.b $32
	LDX.w $1730
	CPX.b $78
	BCS.b CODE_BEBD8D
	STA.w $1734,x
	TYA
	STA.w $1736,x
	LDA.b $32
	AND.w #$00FF
	ORA.w #$8000
	STA.w $1738,x
	LDA.b $32
	AND.w #$FF00
	LSR
	LSR
	LSR
	STA.w $1732,x
	TXA
	CLC
	ADC.w #$0008
	STA.w $1730
	STZ.w $1740,x
CODE_BEBD8D:
	RTS

CODE_BEBD8E:
	JSR.w CODE_BEBD92
	RTL

CODE_BEBD92:
	STY.b $5E
	JSL.l $BCFE0A
	LDX.b $64
	BCC.b CODE_BEBDC0
	JSR.w $BEC58F
	LDY.b $6A
	LDA.b $5E
	ORA.w $0032,y
	STA.w $0032,y
	LDA.b $12,x
	EOR.b $20,x
	AND.w #$4000
	EOR.b $20,x
	AND.w #$C000
	CLC
	ADC.b $64
	SEC
	SBC.w #$0D84
	STA.w $0034,y
	SEC
CODE_BEBDC0:
	RTS

CODE_BEBDC1:
	LDX.b $64
	STY.b $64
	STY.b $6A
	PHX
	JSL.l $BCFB58
	JSL.l $BCFEE0
	PLX
	STX.b $64
	JSL.l $BCFB58
	LDA.b $DD
	CMP.w $09D3
	BCC.b CODE_BEBE01
	LDA.w $09D7
	CMP.b $D9
	BCC.b CODE_BEBE01
	STA.b $E5
	LDA.w $09D9
	CMP.b $DB
	BCC.b CODE_BEBE01
	STA.b $E7
	LDA.b $DF
	CMP.w $09D5
	BCC.b CODE_BEBE01
	LDA.w $09D3
	STA.b $E1
	LDA.w $09D5
	STA.b $E3
CODE_BEBE01:
	LDX.b $64
	LDY.b $6A
	RTL

CODE_BEBE06:
	JSL.l $B3A361
	LDY.w #$0034
	JSL.l $BB842C
	LDX.b $64
	RTS

CODE_BEBE14:
	JSR.w CODE_BEBE18
	RTL

CODE_BEBE18:
	STA.b $60
	LDX.b $64
	LDA.b $32,x
	STA.b $5E
	BEQ.b CODE_BEBE4B
	STZ.b $32,x
	LDA.b $34,x
	AND.w #$3FFF
	CLC
	ADC.w #$0D84
	STA.b $6A
	LDA.b $5E
	BIT.b $60
	BEQ.b CODE_BEBE43
	JSL.l $BBBD48
	LDX.b $64
	LDY.w #$0000
	LDA.w #$0000
	SEC
	RTS

CODE_BEBE43:
	LDY.w #$0000
	LDA.w #$0001
	SEC
	RTS

CODE_BEBE4B:
	CLC
	RTS

CODE_BEBE4D:
	PHX
	PHA
	LDX.b $6A
	CPX.w $0593
	BEQ.b CODE_BEBE5B
	CPX.w $0597
	BNE.b CODE_BEBE67
CODE_BEBE5B:
	LDA.b $2E,x
	ASL
	ASL
	TAX
	PLA
	AND.l $B896B7,x
	BNE.b CODE_BEBE6A
CODE_BEBE67:
	CLC
	PLX
	RTL

CODE_BEBE6A:
	SEC
	PLX
	RTL

CODE_BEBE6D:
	STA.b $5E
	LDA.w #$0010
	PHK
	PEA.w CODE_BEBE79-$01
	JMP.w [$09F9]
CODE_BEBE79:
	BCS.b CODE_BEBE7F
	LDX.b $64
	TXY
	RTL

CODE_BEBE7F:
	JSL.l $BBBD48
	LDX.b $64
	LDY.b $6A
	LDA.w #$0000
	RTL

CODE_BEBE8B:
	LDY.w #$0000
CODE_BEBE8E:
	STA.w $09F7
	STY.b $60
	LDA.w #$0010
	PHK
	PEA.w CODE_BEBE9D-$01
	JMP.w [$09F9]
CODE_BEBE9D:
	BCS.b CODE_BEBEAD
	LDX.b $64
	TXY
	RTL

CODE_BEBEA3:
	JSL.l $BCFCC5
	BCS.b CODE_BEBEAD
	LDX.b $64
	TXY
	RTL

CODE_BEBEAD:
	LDA.w $09F7
	STA.b $5E
	LDA.w #$0020
	JSL.l CODE_BEBE4D
	BCS.b CODE_BEBF20
	JSL.l $BCFEC0
	JSL.l $BCFED8
	LDA.w $09F5
	LDX.w $0D5E
	BEQ.b CODE_BEBED6
	AND.w #$0001
	ASL
	ASL
	ORA.w $09F5
	STA.w $09F5
CODE_BEBED6:
	XBA
	TSB.w $09F5
	LDX.b $6A
	LDA.b $41,x
	AND.w #$00E0
	LSR
	LSR
	LSR
	LSR
	ADC.b $60
	LDX.w $19CE
	BNE.b CODE_BEBEF0
	TAX
CODE_BEBEED:
	JMP.w (DATA_BEBF23,x)

CODE_BEBEF0:
	CMP.w #$0030
	BCS.b CODE_BEBF00
	AND.w #$000E
	CMP.w #$0006
	BCC.b CODE_BEBF00
	JMP.w $BEC410

CODE_BEBF00:
	TAX
	LDY.b $6A
	LDA.w #$0005
	TSB.w $09F5
	LDA.w $0040,y
	PHA
	ORA.w #$1800
	STA.w $0040,y
	JSL.l CODE_BEBEED
	STA.b $5E
	PLA
	STA.w $0040,y
	LDA.b $5E
	RTL

CODE_BEBF20:
	JMP.w CODE_BEBEA3

DATA_BEBF23:
	dw $BEC02A
	dw $BEC169
	dw $BEC085
	dw $BEC1D6
	dw $BEC267
	dw $BEC2C0
	dw $BEC359
	dw $BEC410
	dw $BEC02A
	dw $BEC01E
	dw $BEC014
	dw $BEC1D6
	dw $BEC267
	dw $BEC2C0
	dw $BEC359
	dw $BEC410
	dw $BEC02A
	dw $BEC169
	dw $BEC085
	dw $BEC1D6
	dw $BEC21D
	dw $BEC2C0
	dw $BEC359
	dw $BEC410
	dw CODE_BEBF63
	dw CODE_BEBF63
	dw CODE_BEBF63
	dw CODE_BEBF63
	dw CODE_BEBF63
	dw CODE_BEBF63
	dw CODE_BEBF63
	dw CODE_BEBF63

CODE_BEBF63:
	LDX.b $6A
	LDY.b $64
	LDA.b $1E,x
	AND.w #$0101
	BNE.b CODE_BEBF83
	LDA.b $DF
	CLC
	ADC.b $DB
	LSR
	CMP.b $E7
	BCC.b CODE_BEBF83
	LDA.b $24,x
	SEC
	SBC.w #$0180
	BMI.b CODE_BEBFD9
	BRL.w $049D

CODE_BEBF83:
	LDA.w $001E,y
	AND.w #$0101
	BNE.b CODE_BEBFC4
	LDA.w $0006,y
	SEC
	SBC.b $06,x
	BCS.b CODE_BEBF97
	EOR.w #$FFFF
	INC
CODE_BEBF97:
	CMP.w #$0018
	BCS.b CODE_BEBFD9
	LDA.b $DF
	SEC
	SBC.b $E3
	XBA
	STA.b $24,x
	BIT.b $0E,x
	BMI.b $69
	XBA
	CMP.b $0E,x
	BCC.b $64
	LDA.b $06,x
	STA.w $0A3E
	LDA.b $0C,x
	STA.w $0A40
	LDY.w #$0034
	JSL.l $BB842C
	STZ.w $09E7
	JMP.w $BEC452

CODE_BEBFC4:
	LDA.b $1E,x
	AND.w #$0002
	BEQ.b CODE_BEBFD9
	LDA.b $06,x
	CMP.w $0006,y
	ROR
	EOR.w $0026,y
	BPL.b CODE_BEBFD9
	JMP.w $BEC452

CODE_BEBFD9:
	LDA.b $2E,x
	CMP.w #$0056
	BEQ.b $31
	LDA.b $06,x
	CMP.w $0006,y
	BCS.b CODE_BEBFEE
	LDA.b $D9
	SEC
	SBC.b $E5
	BRA.b CODE_BEBFF3

CODE_BEBFEE:
	LDA.b $DD
	SEC
	SBC.b $E1
CODE_BEBFF3:
	XBA
	AND.w #$FF00
	STA.b $2C,x
	BPL.b $0A
	CMP.w #$FC00
	BCS.b $0D
