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

UNK_BBC026:
	db $10,$DD,$60,$AC

ADDR_BBC02A:
	TYX
	JMP.w [$04F5]

ADDR_BBC02E:
	LDA.w $0039,y
	AND.w #$00FF
	ASL
	TAX
	JMP.w (UNK_BBC039,x)

UNK_BBC039:
	dw ADDR_BBC043
	dw ADDR_BBC08A
	dw ADDR_BBC139
	dw ADDR_BBC156
	dw ADDR_BBC16A

ADDR_BBC043:
	LDA.w $0012,y
	STA.w $0054,y
	STA.w $002C,y
	LDA.w $0016,y
	STA.w $0056,y
	STA.w $0032,y
	LDA.w #$800A
	STA.w $0026,y
	JSR.w ADDR_BBC182
	LDX.w $05B9
	LDA.w $0632,x
	LDY.w #$0032
	BIT.w #$0002
	BEQ.b ADDR_BBC077
	LDY.w #$0034
	BIT.w #$0040
	BEQ.b ADDR_BBC077
	LDY.w #$0036
ADDR_BBC077:
	JSL.l $BB8585
	BCS.b ADDR_BBC087
	LDX.b $70
	LDY.b $76
	STX.b $5C,y
	STY.b $5C,x
	INC.b $39,x
ADDR_BBC087:
	JMP.w [$04F5]

ADDR_BBC08A:
	TYX
	LDA.w #$0040
	AND.b $3C,x
	STZ.b $3C,x
	BNE.b ADDR_BBC097
	JMP.w ADDR_BBC115

ADDR_BBC097:
	LDA.w $05B9
	CMP.w #$0032
	BNE.b ADDR_BBC0C7
	LDA.w $0630
	CMP.w $0536
	BEQ.b ADDR_BBC0AB
	BCC.b ADDR_BBC0C1
	BRA.b ADDR_BBC0B3

ADDR_BBC0AB:
	LDA.w $062F
	CMP.w $0535
	BCC.b ADDR_BBC0C1
ADDR_BBC0B3:
	LDA.w $0536
	CMP.w #$0115
	BCS.b ADDR_BBC0BE
	JSR.w ADDR_BBC124
ADDR_BBC0BE:
	JSR.w ADDR_BBC12C
ADDR_BBC0C1:
	LDA.w #$0003
	STA.w $0533
ADDR_BBC0C7:
	LDA.w #$0004
	JSL.l $B2800F
	LDA.w #$074D
	JSL.l $B28018
	LDX.b $70
	LDA.b $5E,x
	BEQ.b ADDR_BBC107
	LDY.w #$007E
	LDX.w $05B9
	LDA.w $0632,x
	AND.w #$0002
	BEQ.b ADDR_BBC0EC
	LDY.w #$0080
ADDR_BBC0EC:
	JSL.l $BB8585
	LDA.w #$0518
	JSL.l $B28018
	LDA.w #$0217
	JSL.l $B28018
	LDA.w #$0119
	JSL.l $B28018
	LDX.b $70
ADDR_BBC107:
	INC.b $39,x
	LDA.w #$8000
	TSB.w $044A
ADDR_BBC10F:
	JSR.w ADDR_BBC182
	JMP.w [$04F5]

ADDR_BBC115:
	LDA.w #$0003
	JSL.l $BEC00F
	BCS.b ADDR_BBC10F
	JSR.w ADDR_BBC182
	JMP.w ADDR_BBC173

ADDR_BBC124:
	LDY.w #$035E
	JSL.l $BB85B5
	RTS

ADDR_BBC12C:
	LDA.w $0535
	STA.w $062F
	LDA.w $0536
	STA.w $0630
	RTS

ADDR_BBC139:
	TYX
	LDY.b $5C,x
	LDA.b $46,x
	LSR
	STA.w $005E,y
	DEC.b $46,x
	BNE.b ADDR_BBC150
	INC.b $39,x
	LDY.b $5C,x
	LDA.w #$0001
	STA.w $005E,y
ADDR_BBC150:
	JSR.w ADDR_BBC182
	JMP.w [$04F5]

ADDR_BBC156:
	TYX
	DEC.b $60,x
	BPL.b ADDR_BBC16A
	INC.b $39,x
	LDA.w #$001F
	STA.w $1949
	JSL.l $B8807E
	STZ.w $1959
ADDR_BBC16A:
	JSR.w ADDR_BBC1E4
	JSR.w ADDR_BBC182
	JMP.w [$04F5]

ADDR_BBC173:
	JSL.l $BBACFB
	BCC.b ADDR_BBC17F
	LDY.b $70
	LDX.b $5C,y
	STZ.b $5C,x
ADDR_BBC17F:
	JMP.w [$04F5]

ADDR_BBC182:
	LDX.b $70
	LDA.b $46,x
	AND.w #$0003
	CLC
	ADC.w #$8182
	XBA
	STA.b $58,x
	LDA.b $46,x
	AND.w #$0004
	LSR
	CLC
	ADC.w #$0022
	XBA
	ORA.w #$0007
	STA.b $68,x
	SEP.b #$20
	LDA.b #$77
	SEC
	SBC.b $46,x
	STA.b $1A
	CLC
	ADC.b #$08
	STA.b $6B,x
	LDA.b $1A
	LSR
	LSR
	LSR
	LSR
	STA.b $6C,x
	LDA.b #$00
	ADC.b #$00
	EOR.b #$01
	ASL
	ASL
	ASL
	STA.b $62,x
	REP.b #$20
	LDY.b $5C,x
	BEQ.b ADDR_BBC1E3
	LDA.b $46,x
	SEC
	SBC.w #$005B
	CLC
	ADC.b $16,x
	STA.w $0016,y
	LDA.w #$0008
	BIT.b $1E,x
	BVC.b ADDR_BBC1DD
	LDA.w #$FFF8
ADDR_BBC1DD:
	CLC
	ADC.b $12,x
	STA.w $0012,y
ADDR_BBC1E3:
	RTS

ADDR_BBC1E4:
	LDX.b $70
	LDA.b $12,x
	STA.b $54,x
	LDA.b $16,x
	STA.b $56,x
	LDA.b $2C,x
	STA.b $12,x
	LDA.b $32,x
	STA.b $16,x
	JSL.l $B9E000
	LDX.b $70
	LDA.b $2C,x
	LDY.b $12,x
	STA.b $12,x
	STY.b $2C,x
	LDA.b $32,x
	LDY.b $16,x
	STA.b $16,x
	STY.b $32,x
	RTS

ADDR_BBC20D:
	JMP.w (UNK_BBC210,x)

UNK_BBC210:
	dw $0000
	dw ADDR_BBC216
	dw ADDR_BBC221

ADDR_BBC216:
	LDA.w $005E,y
	CMP.w $0060,y
	BEQ.b ADDR_BBC221
	JSR.w ADDR_BBC233
ADDR_BBC221:
	LDX.b $5C,y
	BEQ.b ADDR_BBC22C
	JSL.l $B9A006
	JMP.w [$04F5]

ADDR_BBC22C:
	JSL.l $BB8591
	JMP.w [$04F5]

ADDR_BBC233:
	STA.w $0060,y
	LDX.b $62,y
	LDA.w $05B5
	BEQ.b ADDR_BBC23F
	LDX.b $64,y
ADDR_BBC23F:
	LDA.w $0060,y
	STZ.b $46
	LDY.w $04C4
	CPY.w #$0002
	BNE.b ADDR_BBC258
	LDY.w $04C6
	BEQ.b ADDR_BBC267
	LDY.w #$001E
	STY.b $46
	BRA.b ADDR_BBC267

ADDR_BBC258:
	TAY
	LDA.w $053B
	BIT.w #$0040
	BEQ.b ADDR_BBC266
	LDA.w #$001E
	STA.b $46
ADDR_BBC266:
	TYA
ADDR_BBC267:
	LDY.w #$002B
	JSL.l ADDR_BBC26F
	RTS

ADDR_BBC26F:
	STA.b $3E
	EOR.w #$FFFF
	SEC
	ADC.w #$0020
	STA.b $40
	TXA
	ASL
	TAX
	LDA.l $FD3216,x
	CLC
	ADC.b $46
	STA.b $46
	TYA
	ASL
	TAX
	LDA.l $FD3216,x
	STA.b $42
	LDA.w #$00FD
	STA.b $44
	STA.b $48
	LDA.w #$2F80
	STA.b $1A
	LDA.w #$007E
	STA.b $1C
	LDY.w #$001C
ADDR_BBC2A3:
	LDA.b [$42],y
	STA.l $000022
	LDA.b [$46],y
	STA.l $000024
	JSR.w ADDR_BBC343
	DEY
	DEY
	BPL.b ADDR_BBC2A3
	LDA.b $E8
	ASL
	ASL
	TAX
	LDA.w #$2F80
	STA.w $06FC,x
	LDY.b $70
	LDA.w $001F,y
	AND.w #$000E
	ASL
	ASL
	ASL
	CLC
	ADC.w #$0081
	XBA
	ORA.w #$007E
	STA.w $06FE,x
	LDA.b $E8
	INC
	AND.w #$000F
	STA.b $E8
	RTL

ADDR_BBC2E0:
	STA.b $3E
	EOR.w #$FFFF
	SEC
	ADC.w #$0020
	STA.b $40
	TXA
	ASL
	TAX
	LDA.l $FD54FE,x
	STA.b $46
	TYA
	ASL
	TAX
	LDA.l $FD54FE,x
	STA.b $42
	LDA.w #$00FD
	STA.b $44
	STA.b $48
	LDA.w #$2F80
	STA.b $1A
	LDA.w #$007E
	STA.b $1C
	LDY.b $1E
ADDR_BBC310:
	LDA.b [$42],y
	STA.l $000022
	LDA.b [$46],y
	STA.l $000024
	JSR.w ADDR_BBC343
	DEY
	DEY
	BPL.b ADDR_BBC310
	RTL

ADDR_BBC324:
	STX.w $0022
	AND.w #$003F
	STA.b $3E
	EOR.w #$FFFF
	SEC
	ADC.w #$0020
	STA.b $40
ADDR_BBC335:
	LDA.b [$42],y
	STA.l $000024
	JSR.w ADDR_BBC343
	DEY
	DEY
	BPL.b ADDR_BBC335
	RTL

ADDR_BBC343:
	LDX.b $24
	LDA.b $22
	JSR.w ADDR_BBC37A
	STA.b $26
	LDA.b $24
	LSR
	LSR
	LSR
	LSR
	LSR
	TAX
	LDA.b $22
	LSR
	LSR
	LSR
	LSR
	LSR
	JSR.w ADDR_BBC37A
	ASL
	ASL
	ASL
	ASL
	ASL
	TSB.b $26
	LDA.b $25
	LSR
	LSR
	TAX
	LDA.b $23
	LSR
	LSR
	JSR.w ADDR_BBC37A
	ASL
	ASL
	TSB.b $27
	LDA.b $26
	STA.b [$1A],y
	RTS

ADDR_BBC37A:
	SEP.b #$20
	AND.b #$1F
	STA.w $4202
	LDA.b $3E
	STA.w $4203
	LDA.b ($00)
	REP.b #$20
	LDA.w $4216
	STA.b $3A
	SEP.b #$20
	LDA.b $40
	STA.w $4202
	TXA
	AND.b #$1F
	STA.w $4203
	REP.b #$20
	LDA.b $3A
	CLC
	ADC.w $4216
	LSR
	LSR
	LSR
	LSR
	LSR
	CMP.w #$001F
	BCC.b ADDR_BBC3B1
	LDA.w #$001F
ADDR_BBC3B1:
	RTS

ADDR_BBC3B2:
	JMP.w (UNK_BBC3B5,x)

UNK_BBC3B5:
	dw ADDR_BBC3B9
	dw ADDR_BBC4A2

ADDR_BBC3B9:
	LDA.w $0039,y
	AND.w #$00FF
	ASL
	TAX
	JMP.w (UNK_BBC3C4,x)

UNK_BBC3C4:
	dw ADDR_BBC3CA
	dw ADDR_BBC408
	dw ADDR_BBC458

ADDR_BBC3CA:
	TYX
	INC.b $39,x
	LDA.b $5C,x
	JSR.w ADDR_BBC3FC
	STA.b $5C,x
	LDA.b $5E,x
	JSR.w ADDR_BBC3FC
	STA.b $5E,x
	LDA.b $60,x
	JSR.w ADDR_BBC3FC
	STA.b $60,x
	LDA.b $63,x
	AND.w #$00FF
	CLC
	ADC.b $16,x
	STA.b $64,x
	LDA.b $62,x
	AND.w #$00FF
	EOR.w #$FFFF
	SEC
	ADC.b $16,x
	STA.b $62,x
	JMP.w $BBC027

ADDR_BBC3FC:
	BIT.b $1E,x
	BVS.b ADDR_BBC404
	EOR.w #$FFFF
	INC
ADDR_BBC404:
	CLC
	ADC.b $12,x
	RTS

ADDR_BBC408:
	JSR.w ADDR_BBC45B
	BCC.b ADDR_BBC41B
	LDA.w $0012,y
	CMP.b $5E,x
	ROR.b $1A
	CMP.b $12,x
	ROR
	EOR.b $1A
	BMI.b ADDR_BBC41E
ADDR_BBC41B:
	JMP.w $BBC027

ADDR_BBC41E:
	LDX.w $04FD
	LDA.b $1E,x
	AND.w #$CFFF
	ORA.w #$2000
	STA.b $1E,x
	LDX.b $7C
	BEQ.b ADDR_BBC439
	LDA.b $1E,x
	AND.w #$CFFF
	ORA.w #$2000
	STA.b $1E,x
ADDR_BBC439:
	LDA.w #$001D
	JSL.l $B88069
	BCS.b ADDR_BBC455
	LDX.b $70
	LDA.b $4C,x
	STA.w $17CA
	LDA.b $60,x
	STA.w $17CC
	LDA.b $16,x
	STA.w $17CE
	INC.b $39,x
ADDR_BBC455:
	JMP.w [$04F5]

ADDR_BBC458:
	JMP.w [$04F5]

ADDR_BBC45B:
	LDY.b $7C
	BEQ.b ADDR_BBC462
	JSR.w ADDR_BBC46B
ADDR_BBC462:
	LDY.w $04FD
	JSR.w ADDR_BBC46B
	LDY.w $04F9
ADDR_BBC46B:
	LDX.b $70
	LDA.w $0012,y
	CMP.b $5C,x
	ROR.b $1A
	CMP.b $12,x
	ROR
	EOR.b $1A
	BPL.b ADDR_BBC497
	LDA.w $0016,y
	CMP.b $62,x
	ROR.b $1A
	CMP.b $64,x
	ROR
	EOR.b $1A
	BPL.b ADDR_BBC497
	LDA.w $001E,y
	AND.w #$CFFF
	ORA.w #$2000
	STA.w $001E,y
	SEC
	RTS

ADDR_BBC497:
	LDA.w $001E,y
	ORA.w #$3000
	STA.w $001E,y
	CLC
	RTS

ADDR_BBC4A2:
	JMP.w [$04F5]

ADDR_BBC4A5:
	PLB
	CPY.b $BF
	CPY.b $E8
	CPY.b $BB
	LDA.b $5C,x
	CLC
	ADC.b $12,x
	STA.b $5C,x
	LDA.b $5E,x
	CLC
	ADC.b $16,x
	STA.b $5E,x
	INC.b $38,x
	JMP.w $BBC027

ADDR_BBC4BF:
	TYX
	LDY.w $04F9
	LDA.w $0012,y
	CMP.b $5C,x
	BIT.b $1E,x
	BVC.b ADDR_BBC4D0
	BCS.b ADDR_BBC4D4
	BRA.b ADDR_BBC4D7

ADDR_BBC4D0:
	BCC.b ADDR_BBC4D4
	BRA.b ADDR_BBC4D7

ADDR_BBC4D4:
	JMP.w $BBC027

ADDR_BBC4D7:
	LDX.b $70
	INC.b $38,x
	LDA.w #$001F
	STA.w $1949
	JSL.l $B8807E
	JMP.w [$04F5]

ADDR_BBC4E8:
	JMP.w [$04F5]

ADDR_BBC4EB:
	JMP.w (UNK_BBC4EE,x)

UNK_BBC4EE:
	dw ADDR_BBC4FC
	dw ADDR_BBC571
	dw ADDR_BBC57C
	dw ADDR_BBC5D2
	dw ADDR_BBC62E
	dw ADDR_BBC66B
	dw ADDR_BBC6FE

ADDR_BBC4FC:
	LDA.w $0066,y
	AND.w $05D7
	BEQ.b ADDR_BBC50B
	JSL.l $BB8597
	JMP.w [$04F5]

ADDR_BBC50B:
	JSL.l $B9A006
	JSL.l $BCE3EF
	JSL.l $BEC012
	BCS.b ADDR_BBC51C
	JMP.w $BBC027

ADDR_BBC51C:
	LDA.b $1E,x
	ORA.w #$3000
	STA.b $1E,x
	TXA
	CLC
	ADC.b $64,x
	TAY
	LDA.w $0000,y
	EOR.b $57,x
	AND.w #$00FF
	EOR.b $57,x
	JSL.l $BBCE2C
	INC.b $38,x
	LDA.b $66,x
	TSB.w $05D7
	LDA.w $05D7
	INC
	AND.w #$000F
	STA.b $5A,x
	BNE.b ADDR_BBC54F
	LDA.w #$0001
	JSL.l $B88084
ADDR_BBC54F:
	LDA.b $68,x
	JSL.l $B28012
	LDX.b $70
	LDA.w $05D7
	LSR
	BCS.b ADDR_BBC55F
	STZ.b $5C,x
ADDR_BBC55F:
	LSR
	BCS.b ADDR_BBC564
	STZ.b $5E,x
ADDR_BBC564:
	LSR
	BCS.b ADDR_BBC569
	STZ.b $60,x
ADDR_BBC569:
	LSR
	BCS.b ADDR_BBC56E
	STZ.b $62,x
ADDR_BBC56E:
	JMP.w [$04F5]

ADDR_BBC571:
	JSL.l $B9A006
	JSL.l $BBCE6A
	JMP.w [$04F5]

ADDR_BBC57C:
	JSL.l $BBCE6A
	LDA.w #$2D40
	STA.b $1A
	LDA.w #$00FC
	STA.b $1C
	LDA.w #$0008
	STA.b $1D
	LDX.b $70
	LDA.b $1E,x
	AND.w #$01E0
	JSL.l $B78009
	BCS.b ADDR_BBC5C2
	LDA.w #$2E40
	STA.b $1A
	LDA.w #$00FC
	STA.b $1C
	LDA.w #$0008
	STA.b $1D
	LDA.b $1E,x
	AND.w #$01E0
	ORA.w #$0010
	JSL.l $B78009
	BCC.b ADDR_BBC5C5
	LDA.w $155E
	SBC.w #$0008
	STA.w $155E
ADDR_BBC5C2:
	JMP.w [$04F5]

ADDR_BBC5C5:
	LDX.b $70
	STX.w $18DB
	LDA.w #$C000
	STA.b $26,x
	INC.b $38,x
	TXY
ADDR_BBC5D2:
	TYX
	LDY.w #$0003
	STZ.b $3E
	LDA.b $58,x
	STA.b $40
	SEP.b #$20
ADDR_BBC5DE:
	LDA.b $5C,x
	BEQ.b ADDR_BBC5EE
	LDA.b $5D,x
	CMP.b $40
	BEQ.b ADDR_BBC5EE
	INC.b $5D,x
	INC.b $5D,x
	INC.b $3E
ADDR_BBC5EE:
	INX
	INX
	DEY
	BPL.b ADDR_BBC5DE
	REP.b #$20
	JSL.l $BBCE6A
	BMI.b ADDR_BBC5FD
	INC.b $3E
ADDR_BBC5FD:
	TXA
	CLC
	ADC.b $64,x
	TAY
	SEP.b #$20
	LDA.b $16,x
	XBA
	LDA.b $12,x
	REP.b #$20
	STA.w $0000,y
	LDA.b $3E
	BNE.b ADDR_BBC62B
	INC.b $38,x
	LDA.b $5A,x
	BNE.b ADDR_BBC62B
	INC.b $38,x
	STZ.b $6C,x
	LDA.w #$0003
ADDR_BBC61F:
	SEC
	LDY.w #$20E8
	PHA
	JSR.w ADDR_BBC716
	PLA
	DEC
	BPL.b ADDR_BBC61F
ADDR_BBC62B:
	JMP.w [$04F5]

ADDR_BBC62E:
	TYX
	DEC.b $6C,x
	BPL.b ADDR_BBC668
	TYX
	LDY.w #$0003
	STZ.b $3E
	LDA.b $59,x
	STA.b $40
	SEP.b #$20
ADDR_BBC63F:
	LDA.b $5C,x
	BEQ.b ADDR_BBC64F
	LDA.b $5D,x
	CMP.b $40
	BEQ.b ADDR_BBC64F
	DEC.b $5D,x
	DEC.b $5D,x
	INC.b $3E
ADDR_BBC64F:
	INX
	INX
	DEY
	BPL.b ADDR_BBC63F
	REP.b #$20
	LDA.b $3E
	BNE.b ADDR_BBC668
	LDA.b $70
	CMP.w $18DB
	BNE.b ADDR_BBC664
	STZ.w $18DB
ADDR_BBC664:
	JSL.l $BB8597
ADDR_BBC668:
	JMP.w [$04F5]

ADDR_BBC66B:
	LDA.w #$0078
	STA.w $18D3
	LDX.b $70
	INC.b $6C,x
	LDA.b $6C,x
	CMP.w #$002F
	BCS.b ADDR_BBC695
	BIT.w #$0008
	BEQ.b ADDR_BBC68B
	LDA.b $1E,x
	AND.w #$7FFF
	STA.b $1E,x
	JMP.w [$04F5]

ADDR_BBC68B:
	LDA.b $1E,x
	ORA.w #$8000
	STA.b $1E,x
	JMP.w [$04F5]

ADDR_BBC695:
	BEQ.b ADDR_BBC6E6
	CMP.w #$004B
	BCC.b ADDR_BBC6ED
	BEQ.b ADDR_BBC6D4
	CMP.w #$0067
	BCC.b ADDR_BBC6DB
	BEQ.b ADDR_BBC6C2
	CMP.w #$0083
	BCC.b ADDR_BBC6C9
	BNE.b ADDR_BBC6B3
	LDA.w #$0713
	JSL.l $B28012
ADDR_BBC6B3:
	LDA.w #$0003
	CLC
	JSR.w ADDR_BBC716
	BPL.b ADDR_BBC6C9
	LDX.b $70
	INC.b $38,x
	BRA.b ADDR_BBC6F6

ADDR_BBC6C2:
	LDA.w #$0712
	JSL.l $B28012
ADDR_BBC6C9:
	LDA.w #$0002
	CLC
	JSR.w ADDR_BBC716
	BPL.b ADDR_BBC6DB
	BRA.b ADDR_BBC6F6

ADDR_BBC6D4:
	LDA.w #$0711
	JSL.l $B28012
ADDR_BBC6DB:
	LDA.w #$0001
	CLC
	JSR.w ADDR_BBC716
	BPL.b ADDR_BBC6ED
	BRA.b ADDR_BBC6F6

ADDR_BBC6E6:
	LDA.w #$0710
	JSL.l $B28012
ADDR_BBC6ED:
	LDA.w #$0000
	CLC
	JSR.w ADDR_BBC716
	BPL.b ADDR_BBC6FB
ADDR_BBC6F6:
	LDA.w #$0000
	STA.b ($1A)
ADDR_BBC6FB:
	JMP.w [$04F5]

ADDR_BBC6FE:
	JSL.l $BB8597
	LDA.w #$0001
	JSL.l $B88087
	LDX.b $70
	CPX.w $18DB
	BNE.b ADDR_BBC713
	STZ.w $18DB
ADDR_BBC713:
	JMP.w [$04F5]

ADDR_BBC716:
	BCC.b ADDR_BBC732
	PHY
	JSR.w ADDR_BBC773
	LDA.b ($1A)
	AND.w #$00FF
	XBA
	STA.b ($1C)
	LDA.b ($1A)
	AND.w #$FF00
	STA.b ($1E)
	PLA
	STA.b ($20)
	LDY.w #$0001
	RTS

ADDR_BBC732:
	JSR.w ADDR_BBC773
	LDA.b ($1A)
	BEQ.b ADDR_BBC772
	LDA.w #$0200
	STA.b $3E
	LDA.b ($20)
	XBA
	AND.w #$FF00
	SEC
	SBC.b ($1C)
	JSR.w ADDR_BBC78E
	CLC
	ADC.b ($1C)
	STA.b ($1C)
	AND.w #$FF00
	XBA
	STA.b ($1A)
	LDA.w #$0040
	STA.b $3E
	LDA.b ($20)
	AND.w #$FF00
	SEC
	SBC.b ($1E)
	JSR.w ADDR_BBC78E
	CLC
	ADC.b ($1E)
	STA.b ($1E)
	AND.w #$FF00
	ORA.b ($1A)
	STA.b ($1A)
	DEY
ADDR_BBC772:
	RTS

ADDR_BBC773:
	ASL
	ASL
	TAX
	LDY.w #$FFFA
ADDR_BBC779:
	LDA.l UNK_BBC7B0,x
	AND.w #$00FF
	CLC
	ADC.b $70
	STA.w $0020,y
	INX
	INY
	INY
	BMI.b ADDR_BBC779
	BEQ.b ADDR_BBC779
	RTS

ADDR_BBC78E:
	BEQ.b ADDR_BBC79E
	BCS.b ADDR_BBC7A0
	EOR.w #$FFFF
	INC
	JSR.w ADDR_BBC7A0
	EOR.w #$FFFF
	INC
	RTS

ADDR_BBC79E:
	DEY
	RTS

ADDR_BBC7A0:
	CMP.w #$0100
	BCC.b ADDR_BBC7AF
	LSR
	LSR
	LSR
	LSR
	CMP.b $3E
	BCS.b ADDR_BBC7AF
	LDA.b $3E
ADDR_BBC7AF:
	RTS

UNK_BBC7B0:
	db $5C,$10,$12,$64,$5E,$14,$16,$66,$60,$2A,$2C,$58,$62,$30,$32,$5A

ADDR_BBC7C0:
	JMP.w (UNK_BBC7C3,x)

UNK_BBC7C3:
	dw ADDR_BBC7C7
	dw ADDR_BBC7E2

ADDR_BBC7C7:
	TYX
	LDA.b $1E,x
	EOR.w $18F5
	AND.w #$F000
	EOR.w $18F5
	STA.b $1E,x
	STZ.b $26,x
	INC.b $38,x
	LDA.b $40,x
	JSL.l $B9A000
	JMP.w [$04F5]

ADDR_BBC7E2:
	JSL.l $B9A006
	JSL.l $BCE3EF
	JSL.l $BEC012
	BCS.b ADDR_BBC7F3
	JMP.w $BBC027

ADDR_BBC7F3:
	LDA.w #$0001
	SED
	CLC
	ADC.w $05D3
	STA.w $05D3
	CLD
	db $22										; Note: JSL that gets cut off.