Engine.asm
Yoshifanatic1_Earthworm-Jim-2-Disassembly/EWJ2/SPC700/Engine.asm

%SPCDataBlockStart(0500)
CODE_0500:
	JMP (DATA_0503-$02+x)

DATA_0503:
	dw CODE_1971
	dw CODE_19A9
	dw CODE_1987
	dw CODE_197E
	dw CODE_19A1
	dw CODE_1972
	dw CODE_19EB
	dw CODE_1A0E
	dw CODE_1A6F
	dw CODE_1ACA
	dw CODE_1984
	dw CODE_1C87
	dw CODE_1E75

;---------------------------------------------------------------------------

CODE_051D:
	JMP (DATA_0520+x)

DATA_0520:
	dw CODE_1C05
	dw CODE_105E
	dw CODE_1BD3
	dw CODE_1BF1
	dw CODE_1BC7
	dw CODE_1BF2
	dw CODE_1BF7

;---------------------------------------------------------------------------

CODE_052E:
	JMP (DATA_0531+x)

DATA_0531:
	dw CODE_1512
	dw CODE_1516
	dw CODE_153A
	dw CODE_151E
	dw CODE_152B
	dw CODE_152F
	dw CODE_151A
	dw CODE_153E
	dw CODE_1542
	dw CODE_1557
	dw CODE_156E
	dw CODE_152E
	dw CODE_150E

;---------------------------------------------------------------------------

CODE_054B:
	JMP (DATA_054E+x)

DATA_054E:
	dw CODE_1574
	dw CODE_157B
	dw CODE_1598
	dw CODE_157A
	dw CODE_1580
	dw CODE_158C
	dw CODE_1585
	dw CODE_157A
	dw CODE_159D
	dw CODE_15B3
	dw CODE_15CE
	dw CODE_1577
	dw CODE_156F
	db $00

;---------------------------------------------------------------------------

DATA_0569:
	db $00,$10,$20,$30,$40,$50,$60,$70

DATA_0571:
	db $01,$02,$04,$08,$10,$20,$40,$80

DATA_0579:
	db $00

CODE_057A:
	MOV $39, A
	MOV $1D, X
	MOV A, DATA_0571+x
	MOV $F2, #$5C
	MOV $F3, A
	MOV $35, A
	MOV Y, $1C
	MOV A, $02F9+y
	CMP A, #$FF
	BNE CODE_0599
CODE_0591:
	MOV A, $C7+x
	AND A, #$7C
	MOV $C7+x, A
	SETC
	RET

CODE_0599:
	MOV DATA_0579, A
	MOV Y, A
	MOV A, $2080+y
	MOV $0284, A
	MOV A, $2100+y
	MOV $0285, A
	MOV A, $2000+y
	MOV $0286, A
	BPL CODE_05BE
	CMP A, #$F8
	BCC CODE_05BE
	CMP A, #$FF
	BEQ CODE_0591
	CALL CODE_074B
	BCS CODE_0591
CODE_05BE:
	MOV Y, $1C
	MOV A, $02B7+y
	AND A, #$08
	OR A, $C7+x
	MOV $C7+x, A
	MOV Y, DATA_0579
	MOV A, $2380+y
	INC A
	AND A, #$0F
	BEQ CODE_05DC
	XCN A
	MOV Y, $3A
	MUL YA
	MOV A, Y
	JMP CODE_05DE

CODE_05DC:
	MOV A, $3A
CODE_05DE:
	MOV $FFB2+x, A
	MOV Y, $1C
	MOV A, $0443+y
	MOV $FFAA+x, A
	MOV A, $0459+y
	AND A, #$7F
	MOV $FFA2+x, A
	MOV A, $FF54+y
	MOV $FF9A+x, A
	MOV A, $049B+y
	MOV $FF8A+x, A
	PUSH X
	MOV A, X
	MOV Y, A
	CALL CODE_15E2
	POP X
	CALL CODE_1941
	MOV $F2, #$5C
	MOV $F3, #$00
	MOV A, DATA_0569+x
	MOV X, A
	MOV Y, DATA_0579
	MOV A, $2180+y
	MOV $3E, A
	INC X
	INC X
	PUSH X
	MOV $F2, X
	MOV X, $1D
	MOV A, #$00
	MOV $FFF2+x, A
	MOV A, $2300+y
	MOV $FFBA+x, A
	AND A, #$08
	BEQ CODE_064B
	MOV A, $2480+y
	XCN A
	LSR A
	MOV $FFEA+x, A
	MOV A, $2400+y
	MOV $FFDA+x, A
	AND A, #$F0
	LSR A
	OR A, #$07
	MOV $FFE2+x, A
	MOV A, $CF+x
	AND A, #$FB
	MOV $CF+x, A
CODE_064B:
	BBC1 $3E, CODE_066A
	MOV A, $2480+y
	XCN A
	LSR A
	MOV $FFC2+x, A
	MOV A, $2380+y
	XCN A
	AND A, #$0F
	MOV $FFD2+x, A
	MOV A, #$00
	MOV $FFCA+x, A
	MOV A, $C7+x
	OR A, #$20
	MOV $C7+x, A
CODE_066A:
	MOV A, $2200+y
	CLRC
	ADC A, $39
	CLRC
	ADC A, $42
	MOV $06, A
	MOV X, $1D
	MOV $FF7A+x, A
	MOV A, $2280+y
	MOV $FF82+x, A
	MOV Y, $1C
	MOV A, $0485+y
	MOV $FF72+x, A
	BBC3 $3E, CODE_06AD
	CLRC
	ADC A, $06
	PUSH A
	SETC
	SBC A, #$18
	BPL CODE_0696
	MOV A, #$00
CODE_0696:
	CMP A, #$1F
	BCC CODE_069C
	MOV A, #$1F
CODE_069C:
	MOV $F2, #$6C
	AND $41, #$E0
	OR A, $41
	MOV $41, A
	MOV $F3, A
	POP A
	POP X
	MOV $F2, X
	PUSH X
CODE_06AD:
	MOV A, $0286
	INC A
	INC A
	MOV Y, $1D
	MOV $04D7+y, A
	CALL CODE_1683
	POP X
	INC X
	INC X
	MOV $F2, X
	MOV Y, DATA_0579
	MOV A, $0286
	INC A
	INC A
	MOV $F3, A
	BBS2 $3E, CODE_06DE
	INC X
	MOV $F2, X
	MOV $F3, #$00
	INC X
	INC X
	MOV $F2, X
	MOV A, $0284
	MOV $F3, A
	JMP CODE_06F0

CODE_06DE:
	INC X
	MOV $F2, X
	MOV A, $0284
	OR A, #$80
	MOV $F3, A
	INC X
	MOV $F2, X
	MOV A, $0285
	MOV $F3, A
CODE_06F0:
	MOV X, $1D
	MOV A, #$00
	BBC6 $3E, CODE_06F9
	OR A, #$04
CODE_06F9:
	BBC5 $3E, CODE_0703
	OR A, #$02
	BBC6 $3E, CODE_0703
	OR A, #$01
CODE_0703:
	MOV $04DF+x, A
	MOV A, $FFBA+x
	MOV $08, A
	MOV A, $C7+x
	BBC4 $3E, CODE_0712
	OR A, #$10
CODE_0712:
	BBC1 $3E, CODE_0717
	OR A, #$20
CODE_0717:
	MOV $C7+x, A
	OR $37, $35
	BBS0 $3E, CODE_0722
	EOR $37, $35
CODE_0722:
	MOV $F2, #$4D
	MOV $F3, $37
	OR $36, $35
	BBS3 $3E, CODE_0731
	EOR $36, $35
CODE_0731:
	MOV $F2, #$3D
	MOV $F3, $36
	MOV $F2, #$4C
	MOV $F3, $35
	MOV X, $1D
	MOV A, DATA_0571+x
	EOR A, #$FF
	AND A, DATA_1C06
	MOV DATA_1C06, A
	RET

;---------------------------------------------------------------------------

CODE_074B:
	PUSH X
	PUSH Y
	MOV A, $2080+y
	MOV $0C, A
	MOV A, $2100+y
	MOV $0D, A
	MOV Y, #$00
	MOV A, ($0C)+y
	MOV $0284, A
	INC Y
	MOV A, ($0C)+y
	MOV $0285, A
	INC Y
	MOV A, ($0C)+y
	BNE CODE_076D
	POP Y
	POP X
	SETC
	RET

CODE_076D:
	MOV X, A
	INC Y
	MOV A, $39
	MOV $08, A
	DEC A
	MOV $09, A
	SETC
	SBC A, #$03
	MOV $0A, A
	DEC A
	MOV $0B, A
	MOV $39, #$3C
CODE_0781:
	MOV A, ($0C)+y
	MOV $0E, A
	INC Y
	MOV A, ($0C)+y
	MOV $0F, A
	INC Y
	MOV A, ($0C)+y
	MOV $10, A
	INC Y
	CMP $0E, $08
	BEQ CODE_07BE
	BCS CODE_07B2
	BBC3 $10, CODE_079F
	CMP $0E, $0A
	BCS CODE_07E8
CODE_079F:
	BBC4 $10, CODE_07A7
	CMP $0E, $0B
	BCS CODE_07E3
CODE_07A7:
	MOV A, $10
	AND A, #$07
	BEQ CODE_07B2
	CMP $0E, $09
	BEQ CODE_07B9
CODE_07B2:
	DEC X
	BNE CODE_0781
	POP Y
	POP X
	SETC
	RET

CODE_07B9:
	CLRC
	ADC A, $39
	MOV $39, A
CODE_07BE:
	MOV A, $0F
	BPL CODE_07CA
	AND A, #$7F
	MOV $0286, A
	JMP CODE_07FD

CODE_07CA:
	MOV DATA_0579, A
	MOV Y, A
	MOV A, $2080+y
	MOV $0284, A
	MOV A, $2100+y
	MOV $0285, A
	MOV A, $2000+y
	MOV $0286, A
	JMP CODE_07FD

CODE_07E3:
	MOV $11, #$03
	BRA CODE_07EB

CODE_07E8:
	MOV $11, #$FF
CODE_07EB:
	MOV A, $08
	SETC
	SBC A, $0E
	ADC A, $11
	MOV Y, A
	MOV A, DATA_080D+y
	CLRC
	ADC A, $39
	MOV $39, A
	BRA CODE_07BE

CODE_07FD:
	MOV A, $10
	LSR A
	LSR A
	LSR A
	LSR A
	LSR A
	CLRC
	ADC A, $39
	MOV $39, A
	POP Y
	POP X
	CLRC
	RET

DATA_080D:
	db $00,$06,$0B,$0F,$00,$06,$09,$0C
	db $0F

;---------------------------------------------------------------------------

CODE_0816:
	CLRP
	MOV A, #$00
	MOV $F4, A
	MOV $F5, A
	MOV $F6, A
	MOV $F7, A
	MOV X, #$FB
	MOV SP, X
	MOV X, A
CODE_0825:
	MOV (X+), A
	CMP X, #$F0
	BNE CODE_0825
	MOV Y, A
CODE_082B:
	MOV $0100+y, A
	MOV $0200+y, A
	MOV $0300+y, A
	MOV $0400+y, A
	DBNZ Y, CODE_082B
	MOV Y, A
	DEC A
CODE_083B:
	MOV $2000+y, A
	MOV $2100+y, A
	MOV $2200+y, A
	MOV $2300+y, A
	DBNZ Y, CODE_083B
	MOV A, #$01
	MOV $25, A
	MOV $27, #$25
	MOV $26, #$00
	CALL CODE_0B8F
	MOV A, #$FF
	MOV $027B, A
	MOV $027D, A
	MOV $027F, A
	MOV $0281, A
	MOV A, #$7F
	MOV $0287, A
	JMP CODE_086D

CODE_086C:
	NOP
CODE_086D:
	MOV A, #$00
	MOV $2E, A
CODE_0871:
	CALL CODE_1B9E
	AND $43, #$FD
	MOV $F7, $43
CODE_087A:
	MOV A, $FD
	BNE CODE_0884
	CALL CODE_1941
	JMP CODE_087A

CODE_0884:
	MOV $2E, A
	INC $44
	CALL CODE_1431
	MOV A, $028D
	BPL CODE_0893
	JMP CODE_0917

CODE_0893:
	DEC $028D
	BMI CODE_089B
	JMP CODE_0917

CODE_089B:
	MOV A, $028E
	BNE CODE_08B7
	INC A
	MOV $028E, A
	MOV A, #$28
	MOV $028D, A
	MOV $F2, #$6C
	MOV A, $41
	AND A, #$1F
	MOV $41, A
	MOV $F3, A
	JMP CODE_0917

CODE_08B7:
	CMP A, #$01
	BNE CODE_08C7
	INC A
	MOV $028E, A
	MOV $F2, #$0D
	MOV A, $0291
	MOV $F3, A
CODE_08C7:
	MOV Y, #$FF
	MOV A, $028F
	BPL CODE_08DB
	CMP A, $0292
	BEQ CODE_08D8
	DEC $0292
	MOV Y, #$00
CODE_08D8:
	JMP CODE_08E5

CODE_08DB:
	CMP A, $0292
	BEQ CODE_08E5
	INC $0292
	MOV Y, #$00
CODE_08E5:
	MOV $F2, #$2C
	MOV A, $0292
	MOV $F3, A
	MOV A, $0290
	BPL CODE_08FF
	CMP A, $0293
	BEQ CODE_08FC
	DEC $0293
	MOV Y, #$00
CODE_08FC:
	JMP CODE_0909

CODE_08FF:
	CMP A, $0293
	BEQ CODE_0909
	INC $0293
	MOV Y, #$00
CODE_0909:
	MOV $0293, A
	MOV $028D, Y
	MOV $F2, #$3C
	MOV A, $0293
	MOV $F3, A
CODE_0917:
	MOV A, DATA_1C06
	MOV $40, A
	MOV A, #$00
	MOV DATA_1C06, A
	MOV $1E, #$70
	MOV $35, #$80
	MOV X, #$07
CODE_0929:
	CALL CODE_1941
	MOV $1D, X
	MOV A, $C7+x
	MOV $30, A
	MOV A, $0283
	BNE CODE_0958
	INC $BF+x
	BNE CODE_093D
	INC $B7+x
CODE_093D:
	MOV A, $C7+x
	AND A, #$02
	BEQ CODE_0949
	CALL CODE_0E6A
	JMP CODE_09E4

CODE_0949:
	MOV A, $C7+x
	AND A, #$04
	BEQ CODE_0955
	CALL CODE_1D71
	JMP CODE_09E4

CODE_0955:
	JMP CODE_097E

CODE_0958:
	BMI CODE_097E
	MOV A, DATA_0569+x
	MOV $F2, A
	MOV7 C, $00F3
	ROR $F3
	CMP $F3, #$FF
	BNE CODE_096C
	MOV $F3, #$00
CODE_096C:
	INC $F2
	MOV7 C, $00F3
	ROR $F3
	CMP $F3, #$FF
	BNE CODE_097B
	MOV $F3, #$00
CODE_097B:
	INC $0283
CODE_097E:
	BBS7 $30, CODE_0984
	JMP CODE_09E4

CODE_0984:
	BBS4 $30, CODE_0993
	BBC7 $40, CODE_0993
	MOV $30, #$00
	CALL CODE_0B78
	CALL CODE_1E3E
CODE_0993:
	MOV A, $04E7+x
	MOV $33, A
	MOV A, $0283
	BNE CODE_09AD
	BBC5 $30, CODE_09A3
	CALL CODE_1764
CODE_09A3:
	MOV A, $FFBA+x
	AND A, #$08
	BEQ CODE_09AD
	CALL CODE_17E3
CODE_09AD:
	MOV A, $1E
	CLRC
	ADC A, #$08
	MOV $F2, A
	MOV A, $F3
	BNE CODE_09BF
	MOV A, $04DF+x
	AND A, #$80
	BNE CODE_09CB
CODE_09BF:
	CMP A, $0108+x
	BCS CODE_09D7
	CMP A, #$08
	BCS CODE_09D7
	BBS1 $33, CODE_09D7
CODE_09CB:
	MOV $30, #$00
	MOV $F2, #$5C
	MOV $F3, $35
	CALL CODE_1E3E
CODE_09D7:
	MOV $0108+x, A
	BBC7 $30, CODE_09E0
	CALL CODE_0A70
CODE_09E0:
	MOV A, $30
	MOV $C7+x, A
CODE_09E4:
	ASL $40
	LSR $35
	SETC
	SBC $1E, #$10
	DEC X
	BMI CODE_09F2
	JMP CODE_0929

CODE_09F2:
	MOV A, $1C1B
	BEQ CODE_09FC
	MOV X, #$00
	CALL CODE_1D2A
CODE_09FC:
	MOV A, $1C1C
	BEQ CODE_0A06
	MOV X, #$01
	CALL CODE_1D2A
CODE_0A06:
	MOV A, $0283
	BEQ CODE_0A0E
	JMP CODE_0871

CODE_0A0E:
	MOV $1C, #$15
CODE_0A11:
	CALL CODE_1941
	MOV X, $1C
	MOV A, $47+x
	BMI CODE_0A53
	MOV A, $02B7+x
	AND A, #$80
	BEQ CODE_0A53
	CALL CODE_0A5A
	SETC
	MOV A, $89+x
	SBC A, $08
	MOV $89+x, A
	MOV A, $73+x
	SBC A, $09
	MOV $73+x, A
	MOV A, $5D+x
	SBC A, #$00
	MOV $5D+x, A
	MOV A, $47+x
	SBC A, #$00
	MOV $47+x, A
CODE_0A3D:
	MOV A, $47+x
	BMI CODE_0A49
	OR A, $5D+x
	OR A, $73+x
	OR A, $89+x
	BNE CODE_0A53
CODE_0A49:
	CALL CODE_0C64
	MOV A, $02B7+x
	AND A, #$80
	BNE CODE_0A3D
CODE_0A53:
	DEC $1C
	BPL CODE_0A11
	JMP CODE_0871

;---------------------------------------------------------------------------

CODE_0A5A:
	MOV A, $042D+x
	MOV Y, $2E
	MUL YA
	MOV $09, A
	MOV $08, #$00
	MOV Y, $2E
	MOV A, $0417+x
	MUL YA
	ADDW YA, $08
	MOVW $08, YA
	RET

;---------------------------------------------------------------------------

CODE_0A70:
	MOV A, $0148+x
	BPL CODE_0A76
CODE_0A75:
	RET

CODE_0A76:
	MOV A, $0283
	BNE CODE_0A75
	PUSH X
	MOV A, $0120+x
	MOV X, A
	CALL CODE_0A5A
	POP X
	SETC
	MOV A, $AF+x
	SBC A, $08
	MOV $AF+x, A
	MOV A, $A7+x
	SBC A, $09
	MOV $A7+x, A
	MOV A, $0150+x
	SBC A, #$00
	MOV $0150+x, A
	BCS CODE_0AA4
	MOV A, $0148+x
	DEC A
	MOV $0148+x, A
	BMI CODE_0AAE
CODE_0AA4:
	OR A, $AF+x
	OR A, $A7+x
	OR A, $0148+x
	BEQ CODE_0AAE
	RET

CODE_0AAE:
	MOV A, $04DF+x
	MOV $08, A
	BBC0 $08, CODE_0ABF
	MOV A, #$00
	MOV $BF+x, A
	MOV A, #$80
	MOV $B7+x, A
	RET

CODE_0ABF:
	MOV A, $04DF+x
	OR A, #$80
	MOV $04DF+x, A
	MOV $06, #$B7
	BBS1 $08, CODE_0AD9
	BBS2 $08, CODE_0AD6
	MOV $06, #$BF
	JMP CODE_0AD9

CODE_0AD6:
	MOV $06, #$B0
CODE_0AD9:
	MOV A, $1E
	CLRC
	ADC A, #$05
	MOV $F2, A
	MOV $F3, #$00
	INC A
	INC A
	MOV $F2, A
	MOV $F3, $06
	RET

;---------------------------------------------------------------------------

CODE_0AEB:
	PUSH Y
	MOV Y, #$00
	CLRC
	ADC A, #$28
	BCC CODE_0AF4
	INC Y
CODE_0AF4:
	PUSH X
	MOV X, #$3C
	DIV YA, X
	POP X
	PUSH X
	MOV $042D+x, A
	MOV A, #$00
	MOV X, #$3C
	DIV YA, X
	POP X
	MOV $0417+x, A
	POP Y
	RET

;---------------------------------------------------------------------------

CODE_0B08:
	PUSH Y
	BBC3 $33, CODE_0B29
	MOV X, #$07
CODE_0B0E:
	MOV A, $C7+x
	AND A, #$02
	BEQ CODE_0B19
	MOV A, $0120+x
	BRA CODE_0B22

CODE_0B19:
	MOV A, $C7+x
	AND A, #$80
	BEQ CODE_0B26
	MOV A, $FF92+x
CODE_0B22:
	CMP A, $1C
	BEQ CODE_0B6C
CODE_0B26:
	DEC X
	BPL CODE_0B0E
CODE_0B29:
	MOV X, #$07
CODE_0B2B:
	MOV A, $C7+x
	AND A, #$86
	BEQ CODE_0B6C
	DEC X
	BPL CODE_0B2B
	MOV A, #$00
	MOV Y, A
	MOVW $14, YA
	DEC A
	MOV $13, A
	MOV X, #$07
CODE_0B3E:
	MOV A, $0100+x
	AND A, #$3F
	CMP A, $13
	BCS CODE_0B54
	MOV $13, A
	MOV $12, X
	MOV Y, $B7+x
	MOV A, $BF+x
	MOVW $14, YA
	JMP CODE_0B62

CODE_0B54:
	BNE CODE_0B62
	MOV Y, $B7+x
	MOV A, $BF+x
	CMPW YA, $14
	BCC CODE_0B62
	MOVW $14, YA
	MOV $12, X
CODE_0B62:
	DEC X
	BPL CODE_0B3E
	MOV X, $12
	CMP $3F, $13
	BCC CODE_0B8C
CODE_0B6C:
	POP Y
	MOV A, #$00
	MOV $BF+x, A
	MOV $B7+x, A
	MOV A, $3F
	MOV $0100+x, A
CODE_0B78:
	MOV A, DATA_0569+x
	CLRC
	ADC A, #$05
	MOV $F2, A
	MOV $F3, #$00
	INC A
	INC A
	MOV $F2, A
	MOV $F3, #$9F
	CLRC
	RET

CODE_0B8C:
	POP Y
	SETC
	RET

;---------------------------------------------------------------------------

CODE_0B8F:
	MOV A, #$00
	MOV $F2, #$5C
	MOV $F3, A
	MOV $F2, #$2D
	MOV $F3, A
	MOV $F2, #$3D
	MOV $F3, A
	MOV $F2, #$2C
	MOV $F3, A
	MOV $F2, #$3C
	MOV $F3, A
	MOV A, #$7F
	MOV $F2, #$0C
	MOV $F3, A
	MOV $F2, #$1C
	MOV $F3, A
	MOV $F2, #$5D
	MOV $F3, $27
	MOV X, #$00
	MOV Y, #$08
CODE_0BC0:
	PUSH X
	MOV A, #$00
	MOV $F2, X
	MOV $F3, A
	INC X
	MOV $F2, X
	MOV $F3, A
	INC X
	INC X
	INC X
	MOV $F2, X
	MOV $F3, A
	INC X
	MOV $F2, X
	MOV $F3, A
	INC X
	INC X
	MOV $F2, X
	MOV $F3, A
	POP A
	CLRC
	ADC A, #$10
	MOV X, A
	DBNZ Y, CODE_0BC0
	MOV A, #$FF
CODE_0BE7:
	MOV $028C, A
	MOV $41, #$60
	MOV $0C, #$5D
	MOV $0D, #$18
	MOV Y, #$00
	CALL CODE_1869
	MOV $F1, #$03
	MOV $FA, #$40
	MOV $FB, #$10
	MOV A, $FD
	MOV A, $FE
	RET

;---------------------------------------------------------------------------

CODE_0C06:
	MOV A, $41
	AND A, #$BF
	MOV $41, A
	MOV $F2, #$6C
	MOV $F3, A
	RET


;---------------------------------------------------------------------------

DATA_0C12:
	db "SLICK/Audio v1.07bCopyright(C)1994 Bitmasters,Inc."

;---------------------------------------------------------------------------

DATA_0C44:
	dw CODE_0D29
	dw CODE_0D29
	dw CODE_0D5A
	dw CODE_0D2D
	dw CODE_0D29
	dw CODE_0D29
	dw CODE_0DBF
	dw CODE_0DC9
	dw CODE_0DDA
	dw CODE_0E11
	dw CODE_0D29
	dw CODE_0DA9
	dw CODE_0E44
	dw CODE_0E4F
	dw CODE_0E5A
	dw CODE_0E67

CODE_0C64:
	MOV A, $0325+x
	MOV $1F, A
	MOV A, $033B+x
	MOV $20, A
CODE_0C6E:
	CALL CODE_1941
	MOV A, $030F+x
	MOV $33, A
	MOV A, $02B7+x
	MOV $34, A
	MOV Y, #$00
	MOV A, ($1F)+y
	BPL CODE_0CA8
	INCW $1F
	CMP A, #$E0
	BCC CODE_0C91
	PUSH X
	AND A, #$1F
	ASL A
	MOV X, A
	MOV A, ($1F)+y
	JMP (DATA_0C44+x)

CODE_0C91:
	CMP A, #$C0
	BCC CODE_0CA3
	MOV $13, A
	MOV A, ($1F)+y
	INCW $1F
	MOV $12, A
	CALL CODE_10D6
	JMP CODE_0D00

CODE_0CA3:
	INCW $1F
	JMP CODE_0D00

CODE_0CA8:
	INCW $1F
	PUSH A
	BBC4 $33, CODE_0CB1
	JMP CODE_0D28

CODE_0CB1:
	MOV $3A, #$7F
	BBS0 $33, CODE_0CBD
	MOV A, ($1F)+y
	MOV $3A, A
	INCW $1F
CODE_0CBD:
	BBS0 $34, CODE_0CCA
	MOV A, $02CD+x
	MOV $3F, A
	CALL CODE_0B08
	BCC CODE_0CD1
CODE_0CCA:
	POP A
	CALL CODE_0EB4
	JMP CODE_0D00

CODE_0CD1:
	CALL CODE_1E3E
	MOV $1D, X
	MOV A, $3A
	MOV $0128+x, A
	POP A
	MOV $0130+x, A
	MOV A, $1C
	MOV $0120+x, A
	CALL CODE_0EB4
	MOV A, #$00
	MOV $AF+x, A
	MOV A, $28
	ASL A
	MOV $A7+x, A
	MOV A, $29
	ROL A
	MOV $0150+x, A
	MOV A, $2A
	ROL A
	MOV $0148+x, A
	MOV A, #$02
	MOV $C7+x, A
CODE_0D00:
	MOV X, $1C
	CALL CODE_0EB4
	CLRC
	MOV A, $28
	ADC A, $73+x
	MOV $73+x, A
	MOV A, $29
	ADC A, $5D+x
	MOV $5D+x, A
	MOV A, $2A
	ADC A, $47+x
	MOV $47+x, A
	BPL CODE_0D1D
	JMP CODE_0C6E

CODE_0D1D:
	MOV A, $1F
	MOV $0325+x, A
	MOV A, $20
	MOV $033B+x, A
	RET

CODE_0D28:
	RET

CODE_0D29:
	POP X
	JMP CODE_0D00

CODE_0D2D:
	POP X
	BBC7 $33, CODE_0D34
	JMP CODE_0D90

CODE_0D34:
	MOV A, $02B7+x
	AND A, #$7F
	MOV $02B7+x, A
	BBC4 $34, CODE_0D42
	CALL CODE_0EEB
CODE_0D42:
	MOV Y, #$08
	MOV $0E, X
	MOV A, X
CODE_0D47:
	CMP A, $FF91+y
	BNE CODE_0D52
	MOV A, #$FF
	MOV $FF91+y, A
	MOV A, X
CODE_0D52:
	DBNZ Y, CODE_0D47
	MOV A, #$00
	MOV $02B7+x, A
	RET

CODE_0D5A:
	POP X
	MOV A, ($1F)+y
	BNE CODE_0D7A
	INCW $1F
	MOV A, $1F
	MOV $0393+x, A
	MOV A, $20
	MOV $037D+x, A
	MOV A, $0367+x
	MOV $03BF+x, A
	MOV A, $0351+x
	MOV $03A9+x, A
	JMP CODE_0D00

CODE_0D7A:
	MOV A, $34
	AND A, #$06
	BEQ CODE_0D90
	MOV A, $34
	AND A, #$7F
	MOV $02B7+x, A
	BBC4 $34, CODE_0D8D
	CALL CODE_0EEB
CODE_0D8D:
	INCW $1F
	RET

CODE_0D90:
	MOV A, $037D+x
	MOV $20, A
	MOV A, $0393+x
	MOV $1F, A
	MOV A, $03BF+x
	MOV $0367+x, A
	MOV A, $03A9+x
	MOV $0351+x, A
CODE_0DA6:
	JMP CODE_0D00

CODE_0DA9:
	POP X
	BBC1 $34, CODE_0DBD
	MOV A, $34
	AND A, #$7F
	MOV $02B7+x, A
	BBC4 $34, CODE_0DBA
	CALL CODE_0EEB
CODE_0DBA:
	JMP CODE_0D42

CODE_0DBD:
	BRA CODE_0DA6

CODE_0DBF:
	POP X
	MOV A, ($1F)+y
	MOV $02F9+x, A
	INCW $1F
	BRA CODE_0DA6

CODE_0DC9:
	POP X
	MOV A, ($1F)+y
	MOV $FF3E+x, A
	CLRC
	ADC A, $04B1+x
	CALL CODE_0AEB
	INCW $1F
	BRA CODE_0DA6

CODE_0DDA:
	POP X
	MOV A, $0367+x
	MOV $08, A
	MOV A, $0351+x
	MOV $09, A
	INCW $08
	INCW $08
	MOV A, $09
	MOV $0351+x, A
	MOV A, $08
	MOV $0367+x, A
	MOV A, ($08)+y
	MOV $1F, A
	INC Y
	MOV A, ($08)+y
	MOV $20, A
	DEC Y
	MOV A, $FF28+x
	CLRC
	ADC A, $1F
	MOV $1F, A
	MOV A, $FF12+x
	ADC A, $20
	MOV $20, A
	INCW $1F
	JMP CODE_0D00

CODE_0E11:
	POP X
	MOV A, ($1F)+y
	INCW $1F
	CMP A, #$01
	BNE CODE_0E26
	MOV A, ($1F)+y
	MOV $0B, A
	MOV $0E, #$18
	CALL CODE_10E9
	BRA CODE_0E34

CODE_0E26:
	CMP A, #$02
	BNE CODE_0E34
	MOV A, ($1F)+y
	MOV $0B, A
	MOV $0E, #$02
	CALL CODE_10E9
CODE_0E34:
	INCW $1F
CODE_0E36:
	JMP CODE_0D00

CODE_0E39:
	CALL CODE_1BFE
	MOV A, ($1F)+y
	AND A, #$0F
	INCW $1F
	MOV X, A
	RET

CODE_0E44:
	CALL CODE_0E39
	MOV A, #$00
	MOV $0254+x, A
	POP X
CODE_0E4D:
	BRA CODE_0E36

CODE_0E4F:
	CALL CODE_0E39
	MOV A, #$01
	MOV $0254+x, A
	POP X
	BRA CODE_0E4D

CODE_0E5A:
	CALL CODE_0E39
	MOV A, $0254+x
	INC A
	MOV $0254+x, A
	POP X
	BRA CODE_0E4D

CODE_0E67:
	POP X
	BRA CODE_0E4D

CODE_0E6A:
	MOV $1D, X
	MOV A, $0120+x
	MOV $1C, A
	MOV Y, A
	MOV $FF92+x, A
	MOV A, $030F+y
	MOV $04E7+x, A
	MOV $42, #$00
	MOV A, $046F+y
	MOV $FF6A+x, A
	MOV A, $02E3+y
	MOV $9F+x, A
	MOV A, $03D5+y
	MOV $04EF+x, A
	MOV A, $03EB+y
	MOV $04CF+x, A
	MOV A, $0401+y
	MOV $04C7+x, A
	MOV A, #$80
	MOV $C7+x, A
	MOV A, #$00
	MOV $0108+x, A
	MOV $CF+x, A
	MOV A, $0128+x
	MOV $3A, A
	MOV A, $0130+x
	CALL CODE_057A
	MOV X, $1D
	RET

CODE_0EB4:
	MOV Y, #$00
	MOV $28, Y
	MOV $29, Y
	MOV $2A, Y
	MOV A, ($1F)+y
	BPL CODE_0EE6
	AND A, #$7F
	MOV $29, A
	LSR $29
	ROR $28
	INCW $1F
	MOV A, ($1F)+y
	BPL CODE_0EE4
	AND A, #$7F
	MOV $2A, $29
	OR A, $28
	MOV $29, A
	MOV $28, #$00
	LSR $2A
	ROR $29
	ROR $28
	INCW $1F
	MOV A, ($1F)+y
CODE_0EE4:
	OR A, $28
CODE_0EE6:
	MOV $28, A
	INCW $1F
	RET

CODE_0EEB:
	RET

CODE_0EEC:
	PUSH X
	MOV $3F, Y
	MOV $35, #$01
	MOV X, #$00
CODE_0EF4:
	MOV A, $02B7+x
	AND A, #$80
	BEQ CODE_0F00
	INC X
	CMP X, #$16
	BNE CODE_0EF4
CODE_0F00:
	CMP X, #$16
	BNE CODE_0F0B
	CALL CODE_0FD7
	BCC CODE_0F0B
	POP X
	RET

CODE_0F0B:
	MOV $1C, X
	POP A
	MOV $02F9+x, A
	MOV A, $0296
	MOV $03D5+x, A
	MOV A, $3F
	MOV $02CD+x, A
	MOV A, #$00
	MOV $47+x, A
	MOV $5D+x, A
	MOV $73+x, A
	MOV $89+x, A
	MOV $03EB+x, A
	MOV $0401+x, A
	MOV A, $32
	MOV $030F+x, A
	MOV A, $42
	MOV $046F+x, A
	MOV A, $2F
	MOV $FF3E+x, A
	MOV A, $027A
	MOV $04B1+x, A
	CLRC
	ADC A, $2F
	CALL CODE_0AEB
	MOV X, $1C
	MOV A, $3A
	MOV $0443+x, A
	MOV A, $0279
	MOV $0459+x, A
	MOV A, #$7F
	MOV $FF54+x, A
	MOV A, #$80
	MOV $02B7+x, A
	MOV A, $0A
	MOV $0485+x, A
	MOV A, $0278
	AND A, #$7F
	MOV $049B+x, A
	MOV A, $0B
	MOV $02E3+x, A
	MOV A, $0294
	MOV $FF28+x, A
	MOV A, $0295
	MOV $FF12+x, A
	BEQ CODE_0FB6
	BBC2 $32, CODE_0FA9
	MOV A, $20
	MOV $0351+x, A
	MOV $03A9+x, A
	MOV A, $1F
	MOV $0367+x, A
	MOV $03BF+x, A
	MOV Y, #$00
	MOV A, ($1F)+y
	INC Y
	CLRC
	ADC A, $0294
	MOV $16, A
	MOV A, ($1F)+y
	DEC Y
	ADC A, $0295
	MOV $20, A
	MOV $1F, $16
	INCW $1F
CODE_0FA9:
	MOV A, $1F
	MOV $0393+x, A
	MOV A, $20
	MOV $037D+x, A
	CALL CODE_0D00
CODE_0FB6:
	RET

DATA_0FB7:
	db $76,$5A,$45,$4C,$B8,$A3,$AD,$A2
	db $41,$1D,$76,$1C,$FB,$F3,$F3,$FE
	db $77,$5C,$41,$58,$AB,$B9,$BE,$AF
	db $47,$46,$19,$15,$83,$A4,$A9,$E4

CODE_0FD7:
	CMP $0B, #$E0
	BCC CODE_102B
	MOV $16, #$FF
	MOV $17, #$FF
	MOV $18, #$FF
	MOV $19, #$FF
	MOV X, #$15
CODE_0FEA:
	MOV A, $02E3+x
	CMP A, #$E0
	BCS CODE_0FFF
	MOV A, $02CD+x
	CMP A, $16
	BCS CODE_0FFC
	MOV $16, A
	MOV $17, X
CODE_0FFC:
	JMP CODE_100E

CODE_0FFF:
	CMP A, #$F8
	BCS CODE_100E
	MOV A, $02CD+x
	CMP A, $18
	BCS CODE_100E
	MOV $18, A
	MOV $19, X
CODE_100E:
	DEC X
	BPL CODE_0FEA
	MOV X, $17
	BMI CODE_1019
	CLRC
	JMP CODE_1028

CODE_1019:
	MOV A, $18
	CMP A, $3F
	BEQ CODE_1021
	BCS CODE_1027
CODE_1021:
	MOV X, $19
	CLRC
	JMP CODE_1028

CODE_1027:
	SETC
CODE_1028:
	JMP CODE_105D

CODE_102B:
	MOV $16, #$FF
	MOV $17, #$FF
	MOV X, #$15
CODE_1033:
	MOV A, $02E3+x
	CMP A, #$E0
	BCS CODE_1045
	MOV A, $02CD+x
	CMP A, $16
	BCS CODE_1045
	MOV $16, A
	MOV $17, X
CODE_1045:
	DEC X
	BPL CODE_1033
	MOV X, $17
	BMI CODE_105C
	MOV A, $16
	CMP A, $3F
	BEQ CODE_1054
	BCS CODE_1058
CODE_1054:
	CLRC
	JMP CODE_1059

CODE_1058:
	SETC
CODE_1059:
	JMP CODE_105D

CODE_105C:
	SETC
CODE_105D:
	RET

CODE_105E:
	CMP $08, #$01
	BNE CODE_1067
	CALL CODE_13CD
	RET

CODE_1067:
	CMP $08, #$04
	BNE CODE_1072
	MOV X, #$00
	CALL CODE_1C39
	RET

CODE_1072:
	CMP $08, #$05
	BNE CODE_107D
	MOV X, #$01
	CALL CODE_1C39
	RET

CODE_107D:
	CMP $08, #$06
	BNE CODE_1088
	MOV X, #$00
	CALL CODE_1C42
	RET

CODE_1088:
	CMP $08, #$07
	BNE CODE_1093
	MOV X, #$01
	CALL CODE_1C42
	RET

CODE_1093:
	CMP $08, #$08
	BNE CODE_109C
	CALL CODE_1C62
	RET

CODE_109C:
	MOV A, $08
	BPL CODE_10A8
	AND A, #$7F
	MOV $08, A
	CALL CODE_125A
	RET

CODE_10A8:
	MOV A, $08
	MOV Y, A
	AND A, #$20
	BNE CODE_10B0
	RET

CODE_10B0:
	MOV A, Y
	AND A, #$10
	BNE CODE_10BB
	MOV A, Y
	AND A, #$0F
	JMP CODE_10BE

CODE_10BB:
	MOV A, Y
	OR A, #$F0
CODE_10BE:
	AND A, #$1F
	CMP A, #$10
	BCC CODE_10C6
	OR A, #$E0
CODE_10C6:
	MOV $13, A
	MOV A, $0B
	MOV $12, A
	MOV $0E, #$0A
	MOV $0F, #$FF
	CALL CODE_1478
	RET

CODE_10D6:
	MOV A, $13
	AND A, #$1F
	CMP A, #$10
	BCC CODE_10E0
	OR A, #$E0
CODE_10E0:
	MOV $13, A
	MOV $0E, #$0A
	CALL CODE_10E9
	RET

CODE_10E9:
	PUSH X
	PUSH Y
	MOV $0A, X
	MOV A, $03D5+x
	MOV $0F, A
	MOV Y, $0A
	MOV X, $0E
	MOV A, $0B
	CALL CODE_052E
	POP Y
	POP X
	PUSH X
	PUSH Y
	MOV $0A, X
	MOV A, $03D5+x
	MOV $0F, A
	MOV Y, #$07
CODE_1108:
	MOV A, $0A
	CMP A, $FF92+y
	BNE CODE_1122
	MOV A, $0F
	CMP A, $04EF+y
	BNE CODE_1122
	MOV A, $00C7+y
	BPL CODE_1122
	MOV X, $0E
	MOV A, $0B
	CALL CODE_054B
CODE_1122:
	DEC Y
	BPL CODE_1108
	POP Y
	POP X
	RET

CODE_1128:
	MOV $0E, #$97
	MOV $0F, #$02
	MOV Y, #$00
CODE_1130:
	INC Y
	CMP Y, #$11
	BEQ CODE_1166
	MOV A, ($0E)+y
	BNE CODE_113D
	INC Y
	JMP CODE_1163

CODE_113D:
	MOV $0D, A
	DEC Y
	MOV A, ($0E)+y
	MOV $0C, A
	PUSH Y
CODE_1145:
	MOV Y, #$02
	MOV A, ($0C)+y
	CMP A, #$FF
	BEQ CODE_1160
	CMP A, $08
	BEQ CODE_1167
	DEC Y
	MOV A, ($0C)+y
	PUSH A
	DEC Y
	MOV A, ($0C)+y
	POP Y
	ADDW YA, $0C
	MOVW $0C, YA
	JMP CODE_1145

CODE_1160:
	POP Y
	INC Y
	INC Y
CODE_1163:
	JMP CODE_1130

CODE_1166:
	RET

CODE_1167:
	POP Y
	MOV A, #$00
	MOV $0F, A
	MOV Y, #$03
	MOV A, ($0C)+y
	MOV X, A
	INC Y
	ASL A
	ROL $0F
	ASL A
	ROL $0F
	ASL A
	ROL $0F
	CLRC
	ADC A, #$07
	MOV $0E, A
	ADC $0F, #$00
	CLRC
	ADC $0E, $0C
	ADC $0F, $0D
	MOV A, $0E
	MOV $0294, A
	MOV A, $0F
	MOV $0295, A
	MOV A, ($0C)+y
	MOV $2F, A
	INC Y
	MOV A, ($0C)+y
	MOV $32, A
	MOV $31, A
	INC Y
	MOV A, ($0C)+y
	BEQ CODE_11BB
	INC Y
	CALL CODE_1869
	MOV A, Y
	CLRC
	ADC A, #$0B
	MOV Y, A
	CLRC
	MOV A, $0294
	ADC A, #$0C
	MOV $0294, A
	BCC CODE_11BB
	INC $0295
CODE_11BB:
	INC Y
	MOV A, #$01
	MOV $0296, A
CODE_11C1:
	MOV $32, $31
	MOV A, ($0C)+y
	OR A, $32
	MOV $32, A
	INC Y
	MOV A, ($0C)+y
	MOV $0F, A
	INC Y
	MOV A, ($0C)+y
	MOV $3A, A
	INC Y
	MOV A, $0278
	BPL CODE_11E1
	MOV A, ($0C)+y
	OR A, #$80
	MOV $0278, A
CODE_11E1:
	INC Y
	MOV A, ($0C)+y
	MOV $42, A
	INC Y
	MOV A, ($0C)+y
	MOV $0E, A
	INC Y
	MOV A, ($0C)+y
	CLRC
	ADC A, $0C
	MOV $1F, A
	INC Y
	MOV A, ($0C)+y
	ADC A, $0D
	MOV $20, A
	INC Y
	PUSH X
	PUSH Y
	MOV X, $0E
	MOV Y, $0F
	CALL CODE_0EEC
	INC $0296
	POP Y
	POP X
	DEC X
	BEQ CODE_120F
	JMP CODE_11C1

CODE_120F:
	CALL CODE_0C06
	RET

CODE_1213:
	MOV X, $1C
	CMP X, #$16
	BCC CODE_121B
	SETC
	RET

CODE_121B:
	INC $1C
	MOV A, $02B7+x
	AND A, #$80
	BEQ CODE_1230
	MOV A, $02E3+x
	CMP $0A, #$FF
	BEQ CODE_1237
	CMP A, $0A
	BEQ CODE_1237
CODE_1230:
	INC X
	CMP X, #$16
	BCC CODE_121B
	SETC
	RET

CODE_1237:
	CLRC
	RET

CODE_1239:
	MOV Y, #$08
	MOV $F2, #$78
CODE_123E:
	MOV A, $F3
	BPL CODE_1245
	EOR A, #$FF
	INC A
CODE_1245:
	MOV $FF07+y, A
	MOV A, $00C6+y
	ASL A
	ROR $21
	SETC
	SBC $F2, #$10
	DBNZ Y, CODE_123E
	MOV A, $21
	MOV $FF10, A
	RET

CODE_125A:
	MOV $0F, #$FF
	CMP A, #$02
	BNE CODE_1265
	CALL CODE_13DF
	RET

CODE_1265:
	CMP A, #$04
	BNE CODE_1270
	MOV $F2, $0A
	MOV $F3, $0B
	RET

CODE_1270:
	CMP A, #$06
	BNE CODE_1278
	CALL CODE_13B2
	RET

CODE_1278:
	CMP A, #$07
	BNE CODE_128E
	MOV A, #$FF
	MOV Y, #$80
CODE_1280:
	MOV $1FFF+y, A
	DBNZ Y, CODE_1280
	INC A
	MOV Y, #$10
CODE_1288:
	MOV $0296+y, A
	DBNZ Y, CODE_1288
	RET

CODE_128E:
	CMP A, #$08
	BNE CODE_129E
	MOV $0C, #$5D
	MOV $0D, #$18
	MOV Y, #$00
	CALL CODE_1869
	RET

CODE_129E:
	CMP A, #$10
	BNE CODE_12A8
	MOV $0E, #$06
	JMP CODE_1478

CODE_12A8:
	CMP A, #$14
	BNE CODE_12E7
	MOV $10, #$02
	CMP $0B, #$FF
	BEQ CODE_12B7
	OR $10, #$10
CODE_12B7:
	MOV $1C, #$00
CODE_12BA:
	CALL CODE_1213
	BCS CODE_12CA
	MOV A, $02B7+x
	OR A, $10
	MOV $02B7+x, A
	JMP CODE_12BA

CODE_12CA:
	MOV4 C, $0010
	BCC CODE_12E6
	MOV Y, #$06
CODE_12D1:
	MOV A, $027B+y
	CMP A, #$FF
	BEQ CODE_12DC
	DEC Y
	DEC Y
	BPL CODE_12D1
CODE_12DC:
	MOV A, $0A
	MOV $027B+y, A
	MOV A, $0B
	MOV $027C+y, A
CODE_12E6:
	RET

CODE_12E7:
	CMP A, #$15
	BNE CODE_12FF
	MOV A, $0B
	CMP A, #$80
	BCC CODE_12F3
	MOV A, #$7F
CODE_12F3:
	MOV $0287, A
	MOV $0E, #$16
	MOV $0A, #$FF
	JMP CODE_1478

CODE_12FF:
	CMP A, #$20
	BNE CODE_1307
	MOV $25, $0A
	RET

CODE_1307:
	CMP A, #$22
	BNE CODE_131D
	MOV A, $0B
	AND A, #$0F
	BNE CODE_1312
	DEC A
CODE_1312:
	MOV $0F, A
	AND $0B, #$F0
	MOV $0E, #$10
	JMP CODE_1478

CODE_131D:
	CMP A, #$2F
	BNE CODE_132C
	MOV A, $0A
	MOV DATA_2500+$02, A
	MOV A, $0B
	MOV DATA_2500+$03, A
	RET

CODE_132C:
	CMP A, #$2E
	BNE CODE_1339
	MOV Y, #$00
	MOV A, ($0A)+y
	AND A, #$FC
	MOV ($0A)+y, A
	RET

CODE_1339:
	CMP A, #$2D
	BNE CODE_1346
	MOV A, #$03
CODE_133F:
	MOV Y, #$00
	OR A, ($0A)+y
	MOV ($0A)+y, A
	RET

CODE_1346:
	CMP A, #$2C
	BNE CODE_134E
	MOV A, #$01
	BRA CODE_133F

CODE_134E:
	CMP A, #$70
	BCC CODE_1367
	SETC
	SBC A, #$71
	BMI CODE_1358
	INC A
CODE_1358:
	MOV $0F, A
	MOV $0E, #$08
	MOV A, $0B
	BMI CODE_1364
	MOV $0E, #$00
CODE_1364:
	JMP CODE_1478

CODE_1367:
	CMP A, #$60
	BCC CODE_1379
	SETC
	SBC A, #$61
	BMI CODE_1371
	INC A
CODE_1371:
	MOV $0F, A
	MOV $0E, #$02
	JMP CODE_1478

CODE_1379:
	CMP A, #$50
	BCC CODE_1398
	SETC
	SBC A, #$51
	BMI CODE_1383
	INC A
CODE_1383:
	MOV $0F, A
	MOV $0E, #$04
	MOV A, $0B
	ASL A
	EOR A, $0B
	BPL CODE_1395
	MOV $0E, #$0C
	EOR $0B, #$80
CODE_1395:
	JMP CODE_1478

CODE_1398:
	CMP A, #$40
	BCC CODE_13B1
	SETC
	SBC A, #$41
	BMI CODE_13A2
	INC A
CODE_13A2:
	MOV $0F, A
	MOV $0E, #$0E
	MOV A, $0B
	BPL CODE_13AE
	MOV $0E, #$12
CODE_13AE:
	JMP CODE_1478

CODE_13B1:
	RET

CODE_13B2:
	MOV $0A, #$FF
	MOV A, $0B
	BEQ CODE_13BF
	MOV A, #$40
	MOV $0283, A
	RET

CODE_13BF:
	MOV $0283, A
	MOV $0E, #$14
	JMP CODE_14BD

CODE_13C8:
	MOV $0A, #$FF
	BRA CODE_13EF

CODE_13CD:
	MOV A, #$00
	CALL CODE_18E9
	MOV A, #$00
	CALL CODE_189E
	MOV A, #$00
	CALL CODE_18B7
	MOV $0A, #$FF
CODE_13DF:
	MOV $1C, #$00
CODE_13E2:
	CALL CODE_1213
	BCS CODE_13EF
	MOV A, #$00
	MOV $02B7+x, A
	JMP CODE_13E2

CODE_13EF:
	PUSH X
	MOV $10, #$00
	MOV Y, #$07
CODE_13F5:
	MOV A, $00C7+y
	AND A, #$86
	BEQ CODE_1426
	CMP $0A, #$FF
	BEQ CODE_1415
	AND A, #$06
	BNE CODE_140A
	MOV A, $009F+y
	BRA CODE_1411

CODE_140A:
	MOV A, $0120+y
	MOV X, A
	MOV A, $02E3+x
CODE_1411:
	CMP A, $0A
	BNE CODE_1426
CODE_1415:
	MOV A, Y
	MOV X, A
	CALL CODE_1E3E
	MOV A, DATA_0571+y
	OR A, $10
	MOV $10, A
	MOV A, #$00
	MOV $00C7+y, A
CODE_1426:
	DEC Y
	BPL CODE_13F5
	MOV $F2, #$5C
	MOV $F3, $10
	POP X
	RET

CODE_1431:
	MOV X, #$15
CODE_1433:
	MOV A, $02B7+x
	AND A, #$80
	BEQ CODE_1450
	MOV A, $02B7+x
	AND A, #$08
	BEQ CODE_1450
	MOV A, $0459+x
	BNE CODE_144C
	MOV $02B7+x, A
	JMP CODE_1450

CODE_144C:
	DEC A
	MOV $0459+x, A
CODE_1450:
	DEC X
	BPL CODE_1433
	MOV X, #$07
CODE_1455:
	MOV A, $C7+x
	AND A, #$80
	BEQ CODE_1474
	MOV A, $CF+x
	AND A, #$08
	BEQ CODE_1474
	MOV A, $FFA2+x
	BNE CODE_146B
	MOV $C7+x, A
	JMP CODE_1474

CODE_146B:
	PUSH X
	DEC A
	MOV $FFA2+x, A
	CALL CODE_15E2
	POP X
CODE_1474:
	DEC X
	BPL CODE_1455
	RET

CODE_1478:
	MOV Y, #$15
	CMP $0A, #$FF
	BEQ CODE_149E
	CMP $0F, #$FF
	BEQ CODE_14AA
CODE_1484:
	MOV A, $0A
	CMP A, $02E3+y
	BNE CODE_1499
	MOV A, $0F
	CMP A, $03D5+y
	BNE CODE_1499
	MOV X, $0E
	MOV A, $0B
	CALL CODE_052E
CODE_1499:
	DEC Y
	BPL CODE_1484
	BRA CODE_14BD

CODE_149E:
	MOV X, $0E
	MOV A, $0B
	CALL CODE_052E
	DEC Y
	BPL CODE_149E
	BRA CODE_14BD

CODE_14AA:
	MOV A, $0A
	CMP A, $02E3+y
	BNE CODE_14B8
	MOV X, $0E
	MOV A, $0B
	CALL CODE_052E
CODE_14B8:
	DEC Y
	BPL CODE_14AA
	BRA CODE_14BD

CODE_14BD:
	MOV Y, #$07
	CMP $0A, #$FF
	BEQ CODE_14E7
	CMP $0F, #$FF
	BEQ CODE_14F7
CODE_14C9:
	MOV A, $0A
	CMP A, $009F+y
	BNE CODE_14E3
	MOV A, $0F
	CMP A, $04EF+y
	BNE CODE_14E3
	MOV A, $00C7+y
	BPL CODE_14E3
	MOV X, $0E
	MOV A, $0B
	CALL CODE_054B
CODE_14E3:
	DEC Y
	BPL CODE_14C9
	RET

CODE_14E7:
	MOV A, $00C7+y
	BPL CODE_14F3
	MOV X, $0E
	MOV A, $0B
	CALL CODE_054B
CODE_14F3:
	DEC Y
	BPL CODE_14E7
	RET

CODE_14F7:
	MOV A, $0A
	CMP A, $009F+y
	BNE CODE_150A
	MOV A, $00C7+y
	BPL CODE_150A
	MOV X, $0E
	MOV A, $0B
	CALL CODE_054B
CODE_150A:
	DEC Y
	BPL CODE_14F7
	RET

CODE_150E:
	MOV $FF54+y, A
	RET

CODE_1512:
	MOV $0459+y, A
	RET

CODE_1516:
	MOV $049B+y, A
	RET

CODE_151A:
	MOV $046F+y, A
	RET

CODE_151E:
	PUSH Y
	POP X
	MOV $04B1+x, A
	CLRC
	ADC A, $FF3E+x
	CALL CODE_0AEB
	RET

CODE_152B:
	MOV $0443+y, A
CODE_152E:
	RET

CODE_152F:
	MOV A, $13
	MOV $03EB+y, A
	MOV A, $12
	MOV $0401+y, A
	RET

CODE_153A:
	MOV $0485+y, A
	RET

CODE_153E:
	MOV $02F9+y, A
	RET

CODE_1542:
	AND A, #$10
	BNE CODE_154E
	MOV A, $02B7+y
	AND A, #$FE
	JMP CODE_1553

CODE_154E:
	MOV A, $02B7+y
	OR A, #$01
CODE_1553:
	MOV $02B7+y, A
	RET

CODE_1557:
	PUSH A
	AND A, #$2A
	MOV $06, A
	POP A
	AND A, #$15
	ASL A
	EOR A, #$FF
	MOV $07, A
	MOV A, $030F+y
	AND A, $07
	OR A, $06
	MOV $030F+y, A
CODE_156E:
	RET

CODE_156F:
	MOV $FF9A+y, A
	BRA CODE_1577

CODE_1574:
	MOV $FFA2+y, A
CODE_1577:
	CALL CODE_15E2
CODE_157A:
	RET

CODE_157B:
	MOV $FF8A+y, A
	BRA CODE_1577

CODE_1580:
	MOV $FFAA+y, A
	BRA CODE_1577

CODE_1585:
	MOV $FF6A+y, A
CODE_1588:
	CALL CODE_1683
	RET

CODE_158C:
	MOV A, $13
	MOV $04CF+y, A
	MOV A, $12
	MOV $04C7+y, A
	BRA CODE_1588

CODE_1598:
	MOV $FF72+y, A
	BRA CODE_1588

CODE_159D:
	AND A, #$10
	BNE CODE_15A9
	MOV A, $00CF+y
	AND A, #$EF
	JMP CODE_15AE

CODE_15A9:
	MOV A, $00CF+y
	OR A, #$10
CODE_15AE:
	MOV $00CF+y, A
	BRA CODE_1577

CODE_15B3:
	PUSH A
	AND A, #$2A
	MOV $06, A
	POP A
	AND A, #$15
	ASL A
	EOR A, #$FF
	MOV $07, A
	MOV A, $04E7+y
	AND A, $07
	OR A, $06
	MOV $04E7+y, A
	CALL CODE_15E2
	RET

;---------------------------------------------------------------------------

CODE_15CE:
	AND A, #$FF
	BEQ CODE_15E0
	MOV A, DATA_0569+y
	MOV $F2, A
	MOV A, #$00
	MOV $F3, A
	INC $F2
	MOV $F3, A
	RET

CODE_15E0:
	BRA CODE_15E2

CODE_15E2:
	MOV A, $00CF+y
	AND A, #$02
	BEQ CODE_15EA
	RET

CODE_15EA:
	MOV A, DATA_0569+y
	MOV $F2, A
	PUSH Y
	MOV A, Y
	MOV X, A
	MOV A, $FFB2+x
	MOV Y, A
	MOV A, $FFAA+x
	INC Y
	ASL A
	MUL YA
	MOV A, $FFA2+x
	INC Y
	ASL A
	MUL YA
	MOV A, $FF9A+x
	INC Y
	ASL A
	MUL YA
	MOV A, $0287
	INC Y
	ASL A
	MUL YA
	MOV $3B, Y
	MOV $3C, Y
	MOV A, $FF8A+x
	ASL A
	MOV $18, A
	MOV Y, $3C
	MUL YA
	MOV $3C, Y
	MOV A, #$FF
	SETC
	SBC A, $18
	MOV Y, $3B
	MUL YA
	MOV $3B, Y
	CMP $25, #$00
	BNE CODE_1639
	MOV A, $3C
	CLRC
	ADC A, $3B
	ROR A
	MOV $3C, A
	MOV $3B, A
	JMP CODE_164A

CODE_1639:
	CMP $25, #$02
	BNE CODE_164A
	MOV A, $04E7+x
	AND A, #$20
	BEQ CODE_164A
	EOR $3C, #$FF
	INC $3C
CODE_164A:
	POP Y
	MOV A, $00CF+y
	AND A, #$10
	BEQ CODE_1658
	MOV $3B, #$00
	MOV $3C, #$00
CODE_1658:
	MOV A, $C7+x
	AND A, #$20
	BNE CODE_166F
	MOV A, $3B
	MOV $0110+y, A
	MOV $F3, A
	INC $F2
	MOV A, $3C
	MOV $0118+y, A
	MOV $F3, A
	RET

CODE_166F:
	PUSH X
	MOV A, $3B
	MOV $0110+y, A
	MOV A, $3C
	MOV $0118+y, A
	MOV A, Y
	MOV X, A
	CALL CODE_17AD
	MOV A, X
	MOV Y, A
	POP X
	RET

;---------------------------------------------------------------------------

CODE_1683:
	MOV A, $00CF+y
	AND A, #$02
	BEQ CODE_168B
	RET

CODE_168B:
	MOV $06, #$00
	MOV $07, #$25
	PUSH Y
	MOV $1A, Y
	MOV $15, #$00
	MOV A, $FFF2+y
	MOV $14, A
	BPL CODE_16A0
	DEC $15
CODE_16A0:
	MOV A, $FF82+y
	CLRC
	ADC A, $04C7+y
	MOV $21, A
	MOV A, $FF72+y
	ADC A, $FF7A+y
	CLRC
	ADC A, $04CF+y
	CLRC
	ADC A, $FF6A+y
	MOV Y, A
	MOV A, $21
	ADDW YA, $14
	MOV $21, A
	MOV A, Y
	PUSH A
	MOV Y, $1A
	MOV $07, #$00
	MOV A, $04D7+y
	ASL A
	ROL $07
	ASL A
	ROL $07
	ADC $07, #$25
	MOV $06, A
	MOV Y, #$01
	MOV A, ($06)+y
	MOV $15, A
	DEC Y
	MOV A, ($06)+y
	SETC
	SBC A, #$1B
	SBC $15, #$00
	MOV $14, A
	POP A
	MOV Y, #$00
	MOV X, #$0C
	DIV YA, X
	MOV $06, Y
	MOV Y, #$1A
	SETC
	SBC A, ($14)+y
	MOV $07, A
	MOV A, $06
	ASL A
	MOV Y, A
	MOV A, ($14)+y
	MOV $16, A
	INC Y
	MOV A, ($14)+y
	MOV $17, A
	MOV A, $21
	BEQ CODE_1727
	INC Y
	MOV A, ($14)+y
	MOV $18, A
	INC Y
	MOV A, ($14)+y
	MOV $19, A
	MOV $15, #$00
	MOVW YA, $18
	SUBW YA, $16
	MOV $06, Y
	MOV Y, $21
	MUL YA
	MOV $14, Y
	MOV A, $06
	MOV Y, $21
	MUL YA
	ADDW YA, $14
	ADDW YA, $16
	MOVW $16, YA
CODE_1727:
	MOV Y, $07
	BEQ CODE_173E
	BMI CODE_1737
CODE_172D:
	ASL $16
	ROL $17
	DEC Y
	BNE CODE_172D
	JMP CODE_173E

CODE_1737:
	LSR $17
	ROR $16
	INC Y
	BNE CODE_1737
CODE_173E:
	MOV Y, $1A
	MOV A, DATA_0569+y
	INC A
	INC A
	MOV $F2, A
	PUSH A
	MOV X, $16
	MOV A, $FFBA+y
	AND A, #$01
	BNE CODE_1756
	MOV $F3, X
	JMP CODE_175B

CODE_1756:
	MOV A, X
	AND A, #$F0
	MOV $F3, A
CODE_175B:
	POP A
	INC A
	MOV $F2, A
	MOV $F3, $17
	POP Y
	RET

;---------------------------------------------------------------------------

CODE_1764:
	MOV A, $FFC2+x
	BEQ CODE_176E
	DEC A
	MOV $FFC2+x, A
	RET

CODE_176E:
	MOV A, DATA_0569+x
	MOV $F2, A
	MOV $0C, A
	CALL CODE_17AD
	MOV A, $FFBA+x
	XCN A
	AND A, #$0F
	MOV $0C, A
	MOV A, $FFCA+x
	BMI CODE_179A
	CLRC
	ADC A, $0C
	CMP A, #$40
	BCC CODE_1797
	AND A, #$3F
	EOR A, #$FF
	CLRC
	ADC A, #$40
	AND A, #$3F
	OR A, #$80
CODE_1797:
	JMP CODE_17A9

CODE_179A:
	AND A, #$3F
	SETC
	SBC A, $0C
	BMI CODE_17A6
	OR A, #$80
	JMP CODE_17A9

CODE_17A6:
	EOR A, #$FF
	INC A
CODE_17A9:
	MOV $FFCA+x, A
	RET

;---------------------------------------------------------------------------

CODE_17AD:
	MOV A, $FFCA+x
	LSR A
	LSR A
	AND A, #$0F
	MOV $09, A
	MOV Y, A
	MOV A, $FFD2+x
	AND A, #$0F
	MOV $0B, A
	INC A
	MUL YA
	EOR A, #$FF
	MOV $0A, A
	MOV Y, A
	MOV A, $0110+x
	MUL YA
	MOV $F3, Y
	INC $F2
	MOV Y, $0A
	MOV A, $0118+x
	BMI CODE_17D8
	MUL YA
	MOV $F3, Y
	RET

CODE_17D8:
	EOR A, #$FF
	INC A
	MUL YA
	MOV A, Y
	EOR A, #$FF
	INC A
	MOV $F3, A
	RET

;---------------------------------------------------------------------------

CODE_17E3:
	MOV A, $FFEA+x
	BEQ CODE_17ED
	DEC A
	MOV $FFEA+x, A
	RET

CODE_17ED:
	PUSH X
	MOV A, X
	MOV Y, A
	CALL CODE_1683
	POP X
	MOV A, $FFDA+x
	AND A, #$0F
	MOV $0C, A
	MOV A, $FFE2+x
	MOV $08, A
	EOR A, #$FF
	INC A
	MOV $09, A
	MOV A, $CF+x
	MOV $0A, A
	BBS2 $0A, CODE_182D
	SETC
	MOV A, $FFF2+x
	SBC A, $0C
	BVS CODE_181E
	CMP A, #$80
	BCC CODE_182A
	CMP A, $09
	BEQ CODE_181E
	BCS CODE_182A
CODE_181E:
	SETC
	SBC A, $09
	EOR A, #$FF
	INC A
	CLRC
	ADC A, $09
	EOR $0A, #$04
CODE_182A:
	JMP CODE_1849

CODE_182D:
	CLRC
	MOV A, $FFF2+x
	ADC A, $0C
	BVS CODE_183D
	CMP A, #$80
	BCS CODE_1849
	CMP A, $08
	BCC CODE_1849
CODE_183D:
	SETC
	SBC A, $08
	EOR A, #$FF
	INC A
	CLRC
	ADC A, $08
	EOR $0A, #$04
CODE_1849:
	MOV $FFF2+x, A
	MOV A, $0A
	MOV $CF+x, A
	RET

;---------------------------------------------------------------------------

DATA_1851:
	db $7D,$2C,$3C,$0D,$0F,$1F,$2F,$3F
	db $4F,$5F,$6F,$7F,$00,$00,$00,$00
	db $7F,$00,$00,$00,$00,$00,$00,$00

;---------------------------------------------------------------------------

CODE_1869:
	PUSH Y
	MOV A, ($0C)+y
	CALL CODE_18E9
	INC Y
	MOV A, ($0C)+y
	CALL CODE_189E
	INC Y
	MOV A, ($0C)+y
	CALL CODE_18B7
	INC Y
	MOV A, ($0C)+y
	CALL CODE_18D0
	INC Y
	CALL CODE_1887
	POP Y
	RET

CODE_1887:
	PUSH X
	MOV $46, #$0F
	MOV X, #$08
CODE_188D:
	MOV A, ($0C)+y
	INC Y
	MOV $F2, $46
	MOV $F3, A
	CLRC
	ADC $46, #$10
	DEC X
	BNE CODE_188D
	POP X
	RET

CODE_189E:
	PUSH A
	MOV A, $028E
	DEC A
	DEC A
	BPL CODE_18AD
	POP A
	MOV $028F, A
	JMP CODE_18B6

CODE_18AD:
	POP A
	MOV $F2, #$2C
	MOV $F3, A
	MOV $028F, A
CODE_18B6:
	RET

CODE_18B7:
	PUSH A
	MOV A, $028E
	DEC A
	DEC A
	BPL CODE_18C6
	POP A
	MOV $0290, A
	JMP CODE_18CF

CODE_18C6:
	POP A
	MOV $F2, #$3C
	MOV $F3, A
	MOV $0290, A
CODE_18CF:
	RET

CODE_18D0:
	PUSH A
	MOV A, $028E
	DEC A
	DEC A
	BPL CODE_18DF
	POP A
	MOV $0291, A
	JMP CODE_18E8

CODE_18DF:
	POP A
	MOV $F2, #$0D
	MOV $F3, A
	MOV $0291, A
CODE_18E8:
	RET

CODE_18E9:
	CMP A, $028C
	BNE CODE_18EF
	RET

CODE_18EF:
	MOV $028B, A
	MOV $F2, #$6C
	MOV A, $41
	OR A, #$20
	MOV $F3, A
	MOV $41, A
	MOV A, #$00
	MOV $F2, #$2C
	MOV $F3, A
	MOV $F2, #$3C
	MOV $F3, A
	MOV $F2, #$0D
	MOV $F3, A
	MOV $028E, A
	MOV $0292, A
	MOV $0293, A
	MOV A, $028B
	MOV $F2, #$7D
	MOV $F3, A
	ASL A
	ASL A
	ASL A
	EOR A, #$FF
	MOV $F2, #$6D
	MOV $F3, A
	PUSH Y
	PUSH X
	MOV $05, A
	MOV $04, #$00
	MOV $01, #$FF
	MOV $00, #$00
	CALL CODE_1B2E
	POP X
	POP Y
	MOV A, #$4F
	MOV $028D, A
	RET

;---------------------------------------------------------------------------

CODE_1941:
	PUSH A
CODE_1942:
	MOV A, $F6
	CBNE $F6, CODE_1942
	BNE CODE_1956
	MOV A, $FE
	BEQ CODE_1954
	PUSH X
	PUSH Y
	CALL CODE_1F6D
	POP Y
	POP X
CODE_1954:
	POP A
	RET

CODE_1956:
	MOV $F6, #$F0
	MOV $F5, #$05
	PUSH X
	PUSH Y
CODE_195E:
	MOV X, A
	CALL CODE_0500
	MOV $F7, $43
	MOV A, $F6
	BNE CODE_195E
	MOV $F6, A
	MOV $F5, A
	POP Y
	POP X
	POP A
	RET

CODE_1971:
	RET

CODE_1972:
	MOV $F1, #$80
	MOV $F3, #$6C
	MOV $F2, #$FF
	JMP !REGISTER_SPC700_IPLROMLoc

CODE_197E:
	AND $43, #$FE
	JMP CODE_1987

CODE_1984:
	CALL CODE_1239
CODE_1987:
	MOV Y, #$00
	MOV X, $F4
	MOV $F5, X
	MOV $F6, #$FF
CODE_1990:
	MOV A, ($F4)+y
	MOV $F4, A
	INC X
	MOV $F5, X
CODE_1997:
	CMP X, $F4
	BNE CODE_1997
	MOV A, $F6
	BPL CODE_1990
	BRA CODE_19E3

CODE_19A1:
	MOV A, $F5
	MOV $0202, A
	OR $43, #$02
CODE_19A9:
	MOV A, $F4
CODE_19AB:
	MOV $F4, #$FF
	MOV $F5, #$00
	MOV $F6, #$F8
CODE_19B4:
	CBNE $F6, CODE_19B4
	MOV Y, #$01
	MOV X, #$00
CODE_19BB:
	CMP A, $F6
	BEQ CODE_19BB
	MOV A, $F4
	MOV ($F6+x), A
	MOV A, $F5
	MOV ($F6)+y, A
	MOV A, $F6
	MOV $F4, X
	DBNZ $F7, CODE_19D0
	BRA CODE_19E3

CODE_19D0:
	CMP A, $F6
	BEQ CODE_19D0
	MOV A, $F4
	MOV ($F6+x), A
	MOV A, $F5
	MOV ($F6)+y, A
	MOV A, $F6
	MOV $F4, Y
	DBNZ $F7, CODE_19BB
CODE_19E3:
	MOV $F6, #$F1
CODE_19E6:
	MOV A, $F6
	BMI CODE_19E6
	RET

CODE_19EB:
	MOVW YA, $F4
	MOVW $02, YA
	MOV $F6, #$F2
CODE_19F2:
	CMP X, $F6
	BEQ CODE_19F2
	MOVW YA, $F4
	MOVW $04, YA
	INCW $04
	BRA CODE_19AB

CODE_19FE:
	MOV $F6, #$FB
CODE_1A01:
	MOV A, $F6
	BNE CODE_1A01
	SET7 $43
	MOV $F7, $43
	MOV $F6, #$00
	RET

CODE_1A0E:
	CALL CODE_19FE
	CALL CODE_1B2B
	INCW $04
	INCW $04
	MOV Y, #$00
	MOV $23, $04
	MOV $24, $05
	MOV A, ($04)+y
	ASL A
	MOV $21, A
	INCW $04
	MOV A, ($04)+y
	CLRC
	ADC A, $02
	INC A
	INC A
	MOV $22, #$00
	ASL A
	ROL $22
	ASL A
	ROL $22
	ADC A, #$00
	MOV $1A53, A
	MOV $1A5C, A
	MOV A, $22
	ADC A, #$25
	MOV $1A54, A
	MOV $1A5D, A
	MOV X, #$00
	INCW $04
CODE_1A4D:
	MOV A, ($04)+y
	SETC
	ADC A, $23
	MOV DATA_2500+x, A
	INC X
	INC Y
	MOV A, ($04)+y
	ADC A, $24
	MOV DATA_2500+x, A
	INC Y
	INC X
	DEC $21
	BNE CODE_1A4D
CODE_1A64:
	CLR7 $43
	MOV $F7, $43
	POP A
	POP A
	POP Y
	POP X
	POP A
	RET

CODE_1A6F:
	CALL CODE_19FE
	CALL CODE_1B2B
	MOV A, $0298
	BEQ CODE_1A7F
	MOV X, #$0C
	CALL CODE_1B5E
CODE_1A7F:
	CALL CODE_1B8B
	MOV X, #$0F
CODE_1A84:
	MOV A, $0297+x
	BEQ CODE_1A8D
	DEC X
	DEC X
	BPL CODE_1A84
CODE_1A8D:
	BNE CODE_1AAA
	INCW $04
	INCW $04
	MOV A, $05
	MOV $0297+x, A
	MOV A, $04
	MOV $0296+x, A
	MOV A, $01
	MOV $02A7+x, A
	MOV A, $00
	MOV $02A6+x, A
	CALL CODE_1AAD
CODE_1AAA:
	JMP CODE_1A64

CODE_1AAD:
	MOV Y, #$02
	MOV A, ($04)+y
	CMP A, #$FF
	BEQ CODE_1AC9
	CLRC
	ADC A, $02
	MOV ($04)+y, A
	DEC Y
	MOV A, ($04)+y
	PUSH A
	DEC Y
	MOV A, ($04)+y
	POP Y
	ADDW YA, $04
	MOVW $04, YA
	JMP CODE_1AAD

CODE_1AC9:
	RET

CODE_1ACA:
	CALL CODE_19FE
	CALL CODE_1B2B
	MOV Y, #$02
	MOV A, ($04)+y
	CLRC
	ADC A, $04
	MOV $21, A
	INC Y
	MOV A, ($04)+y
	ADC A, $05
	MOV $22, A
	MOV $00, $04
	MOV $01, $05
	MOV Y, #$00
CODE_1AE8:
	MOV A, ($21)+y
	INCW $21
	CMP A, #$FF
	BCS CODE_1B28
	ADC A, $02
	AND A, #$7F
	MOV X, #$0A
	MOV $24, #$20
	MOV $23, A
CODE_1AFB:
	MOV A, ($21)+y
	MOV ($23)+y, A
	CLRC
	ADC $23, #$80
	ADC $24, #$00
	INCW $21
	DEC X
	BNE CODE_1AFB
	MOV X, $23
	MOV A, $2000+x
	CMP A, #$FD
	BCC CODE_1B25
	CLRC
	MOV A, $2080+x
	ADC A, $00
	MOV $2080+x, A
	MOV A, $2100+x
	ADC A, $01
	MOV $2100+x, A
CODE_1B25:
	JMP CODE_1AE8

CODE_1B28:
	JMP CODE_1A64

CODE_1B2B:
	CALL CODE_1B8B
CODE_1B2E:
	MOV X, #$0E
CODE_1B30:
	MOV A, $0298+x
	BEQ CODE_1B5D
	MOV Y, A
	MOV A, $0297+x
	CMPW YA, $00
	BCS CODE_1B59
	CMPW YA, $04
	BCC CODE_1B4E
CODE_1B41:
	MOV A, #$00
	MOV $0298+x, A
	CALL CODE_1B5E
	BRA CODE_1B30

CODE_1B4B:
	JMP CODE_1B59

CODE_1B4E:
	MOV A, $02A8+x
	MOV Y, A
	MOV A, $02A7+x
	CMPW YA, $04
	BCS CODE_1B41
CODE_1B59:
	DEC X
	DEC X
	BPL CODE_1B30
CODE_1B5D:
	RET

CODE_1B5E:
	PUSH X
	MOV A, X
	MOV Y, A
CODE_1B61:
	DEC Y
	DEC Y
	BPL CODE_1B67
	POP X
	RET

CODE_1B67:
	MOV A, $0298+y
	BEQ CODE_1B88
	MOV $0298+x, A
	MOV A, $0297+y
	MOV $0297+x, A
	MOV A, $02A7+y
	MOV $02A7+x, A
	MOV A, $02A8+y
	MOV $02A8+x, A
	MOV A, #$00
	MOV $0298+y, A
	DEC X
	DEC X
CODE_1B88:
	JMP CODE_1B61

CODE_1B8B:
	MOV Y, #$00
	MOV A, ($04)+y
	INC Y
	CLRC
	ADC A, $04
	MOV $00, A
	MOV A, ($04)+y
	ADC A, $05
	MOV $01, A
	DECW $00
	RET

CODE_1B9E:
	MOV Y, $D7
	CMP Y, $0202
	BEQ CODE_1BC6
	MOV A, $0205+y
	MOV $08, A
	MOV A, $0206+y
	MOV $0A, A
	MOV A, $0207+y
	MOV $0B, A
	CLRC
	ADC $D7, #$04
	AND $D7, #$3F
	MOV A, $0204+y
	ASL A
	MOV X, A
	CALL CODE_051D
	JMP CODE_1B9E

CODE_1BC6:
	RET

CODE_1BC7:
	MOV A, $0A
	PUSH A
	MOV $0A, $0B
	CALL CODE_13DF
	POP A
	MOV $0A, A
CODE_1BD3:
	MOV Y, $D7
	MOV A, $0205+y
	MOV $0278, A
	MOV A, $0206+y
	MOV $0279, A
	MOV A, $0207+y
	MOV $027A, A
	CLRC
	ADC $D7, #$04
	AND $D7, #$3F
	JMP CODE_1128

CODE_1BF1:
	RET

CODE_1BF2:
	MOVW YA, $0A
	MOVW $04, YA
	RET

CODE_1BF7:
	MOVW YA, $0A
	MOVW $00, YA
	JMP CODE_1B2E

CODE_1BFE:
	OR $43, #$01
	MOV $F7, $43
	RET

CODE_1C05:
	RET

DATA_1C06:
	db $00,$00,$00,$00,$00,$55,$AA,$FF
	db $FF,$FF,$FF,$00,$00,$00,$00,$00
	db $00,$00,$00,$00,$00,$00,$00,$00
	db $00,$00,$00,$00,$00,$00,$00,$00
	db $00,$00,$00,$00,$00,$00,$00,$00
	db $00,$00,$00,$00,$00

CODE_1C33:
	MOV Y, $F7+x
	OR A, $08
	OR A, ($00+x)
CODE_1C39:
	MOV A, $0A
	MOV $E2+x, A
	MOV A, $0B
	MOV $DC+x, A
	RET

CODE_1C42:
	MOV A, $0A
	ASL A
	MOV $21, A
	MOV $22, #$00
	MOV A, X
	MOV $1C19+x, A
	MOV $1C15+x, A
	MOV A, $E2+x
	MOV Y, $DC+x
	ADDW YA, $21
	MOV $E4+x, A
	MOV $DE+x, Y
	ADDW YA, $21
	MOV $E6+x, A
	MOV $E0+x, Y
	RET

CODE_1C62:
	MOV A, $0A
	MOV $1C37, A
	MOV A, $0B
	BEQ CODE_1C80
CODE_1C6B:
	JMP CODE_1C6B

CODE_1C6E:
	MOV A, $1F6A
	MOV $1F13, A
	MOV A, $1F6B
	MOV $1F14, A
	MOV A, $1F6C
	MOV $1F15, A
CODE_1C80:
	MOV A, $1C37
	MOV $1F09, A
	RET

CODE_1C87:
	MOV $F5, #$10
	MOVW YA, $F4
	MOV $1C08, A
	MOV X, A
	MOV A, Y
	MOV $1C1D+x, A
	MOV $F6, #$FF
	MOV A, #$FE
CODE_1C99:
	CMP A, $F6
	BNE CODE_1C99
	MOVW YA, $F4
	MOV $F6, #$FE
	MOV $1C27+x, A
	MOV A, #$FD
CODE_1CA7:
	CMP A, $F6
	BNE CODE_1CA7
	MOVW YA, $F4
	MOV $F6, #$FD
	MOV $E8+x, A
	MOV $EA+x, Y
	MOV A, #$FC
CODE_1CB6:
	CMP A, $F6
	BNE CODE_1CB6
	MOVW YA, $F4
	MOV $F6, #$FC
	MOV $1C29+x, A
	MOV A, Y
	MOV $1C23+x, A
	MOV A, $1C0D
	BMI CODE_1CD7
	MOV X, A
	CALL CODE_1D1A
	MOV X, $1C08
	MOV A, #$FF
	MOV $1C0D, A
CODE_1CD7:
	MOV A, $1C21
	BMI CODE_1CE8
	MOV X, A
	CALL CODE_1D1A
	MOV X, $1C08
	MOV A, #$FF
	MOV $1C21, A
CODE_1CE8:
	MOV X, $1C08
	MOV A, $1C19
	MOV $1C15, A
	MOV $1C0F, A
	MOV A, #$FF
	MOV $1C13, A
	CMP X, #$00
	BNE CODE_1D04
	SET2 $43
	CLR4 $43
	JMP CODE_1D08

CODE_1D04:
	SET3 $43
	CLR5 $43
CODE_1D08:
	MOV $F7, $43
	MOV A, #$00
	MOV $1C1B, A
	MOV A, #$01
	MOV $1C38, A
CODE_1D15:
	MOV A, $F6
	BMI CODE_1D15
	RET

CODE_1D1A:
	CALL CODE_0B78
	MOV A, $CF+x
	AND A, #$FD
	MOV $CF+x, A
	MOV A, $C7+x
	AND A, #$FB
	MOV $C7+x, A
	RET

CODE_1D2A:
	MOV A, $1C38
	BEQ CODE_1D35
CODE_1D2F:
	MOV $F6, #$8C
	JMP CODE_1D2F

CODE_1D35:
	MOV A, #$00
	MOV $1C1B+x, A
	MOV $1C08, X
	MOV A, $1C0D+x
	AND A, $1C21+x
	BMI CODE_1D4B
CODE_1D45:
	JMP CODE_1D45

CODE_1D48:
	JMP CODE_1D5F

CODE_1D4B:
	MOV A, $1C27+x
	MOV $3F, A
	MOV $33, #$00
	CALL CODE_0B08
	BCC CODE_1D5F
	MOV X, $1C08
	CALL CODE_1E58
	RET

CODE_1D5F:
	MOV A, #$04
	MOV $C7+x, A
	MOV A, X
	MOV Y, $1C08
	MOV $1C21, A
	MOV A, DATA_0571+x
	MOV $1C2B, A
	RET

;---------------------------------------------------------------------------

CODE_1D71:
	MOV Y, $1D
	MOV X, #$00
	MOV $1C08, X
	MOV A, Y
	MOV $1C0D+x, A
	MOV A, #$00
	MOV $04EF+y, A
	DEC A
	MOV $1C21+x, A
	MOV A, DATA_0571+y
	MOV $F2, #$5C
	MOV $F3, A
	MOV A, X
	ASL A
	ASL A
	MOV Y, A
	MOV A, $1C0F+x
	MOV $1C17+x, A
	MOV X, A
	MOV A, $E2+x
	MOV DATA_2500+y, A
	MOV A, $DC+x
	MOV DATA_2500+$01+y, A
	MOV Y, $1C08
	MOV X, $1D
	CALL CODE_1FAC
	MOV X, $1C08
	MOV Y, $1D
	MOV A, #$02
	MOV $00CF+y, A
	MOV A, #$90
	MOV $00C7+y, A
	MOV A, #$81
	MOV $04DF+y, A
	MOV A, #$00
	MOV $04E7+y, A
	MOV $FFBA+y, A
	DEC A
	MOV $1C0F, A
	MOV A, #$FE
	MOV $FF92+y, A
	MOV $009F+y, A
	MOV A, X
	MOV $04EF+y, A
	MOV $F2, #$5C
	MOV $F3, #$00
	MOV A, DATA_0569+y
	MOV $F2, A
	MOV A, $1C29
	LSR A
	MOV $F3, A
	INC $F2
	MOV $F3, A
	INC $F2
	MOV A, $E8
	MOV $F3, A
	INC $F2
	MOV A, $EA
	MOV $F3, A
	INC $F2
	MOV $F3, X
	INC $F2
	MOV $F3, #$00
	INC $F2
	INC $F2
	MOV $F3, #$7F
	MOV A, DATA_0571+y
	EOR A, #$FF
	PUSH A
	AND A, $37
	MOV $37, A
	MOV $F2, #$4D
	MOV $F3, A
	POP A
	AND A, $36
	MOV $36, A
	MOV $F2, #$3D
	MOV $F3, A
	MOV $F2, #$4C
	MOV A, DATA_0571+y
	MOV $F3, A
	MOV X, $1D
	CALL CODE_1FDC
	MOV A, DATA_0571+y
	OR A, DATA_1C06
	MOV DATA_1C06, A
	RET

;---------------------------------------------------------------------------

CODE_1E37:
	MOV A, $C7+x
	AND A, #$04
	BEQ CODE_1E3E
	RET

CODE_1E3E:
	MOV A, $CF+x
	AND A, #$02
	BEQ CODE_1E51
	CMP X, $1C0D
	BNE CODE_1E51
	PUSH X
	CALL CODE_1D1A
	MOV X, #$00
	BRA CODE_1E59

CODE_1E51:
	MOV A, $CF+x
	AND A, #$FD
	MOV $CF+x, A
	RET

CODE_1E58:
	PUSH X
CODE_1E59:
	CMP X, #$00
	BNE CODE_1E64
	CLR2 $43
	SET4 $43
	JMP CODE_1E68

CODE_1E64:
	CLR3 $43
	SET5 $43
CODE_1E68:
	MOV A, #$FF
	MOV $1C0D+x, A
	MOV $1C21+x, A
	MOV $F7, $43
	POP X
	RET

CODE_1E75:
	MOV $F5, #$11
	MOV A, $F4
	MOV $1C2F, A
	MOV A, $F5
	MOV $F6, #$EF
	MOV $1C30, A
	SET7 $43
	MOV $F7, $43
CODE_1E8A:
	MOV A, $F6
	BPL CODE_1E8A
	MOVW YA, $F4
	MOV $F6, #$EE
	MOVW $23, YA
	MOV $1C2D, A
	CMP A, #$00
	BPL CODE_1E9F
	JMP CODE_1F44

CODE_1E9F:
	MOV $1C2E, Y
	MOV Y, $23
	MOV A, $1C19
	MOV $1C11, A
	MOV X, A
	MOV A, $E2+x
	MOV $21, A
	MOV A, $DC+x
	MOV $22, A
	MOV A, X
	DEC A
	DEC A
	BPL CODE_1EBB
	CLRC
	ADC A, #$06
CODE_1EBB:
	MOV $1C19, A
	CMP A, $1C15
	BNE CODE_1ECA
	MOV A, $1C33
	AND A, $43
	MOV $43, A
CODE_1ECA:
	MOV $F7, $43
	MOV $F5, #$12
	MOV A, $24
	BPL CODE_1EFA
	MOV A, $1C1D
	MOV X, A
CODE_1ED8:
	CMP $F6, #$00
	BNE CODE_1ED8
	MOV $F5, #$13
	MOV Y, #$00
	MOV $24, Y
	MOV A, $1C37
	MOV $D8, A
	MOV A, $F4
	MOV $F6, Y
CODE_1EED:
	CMP A, $F4
	BEQ CODE_1EED
	MOV $F5, #$14
	NOP
	NOP
	NOP
	JMP CODE_1EFA

CODE_1EFA:
	MOV A, $F4
	MOV ($21)+y, A
	INC Y
	MOV A, $F5
	MOV ($21)+y, A
	INC Y
	DEC $D8
	BNE CODE_1F0E
	MOV $D8, #$07
	JMP CODE_1F11

CODE_1F0E:
	MOV A, $1C29+y
CODE_1F11:
	PUSH Y
	MUL YA
	MOV A, $1C29+y
	POP Y
	DEC X
	BNE CODE_1EFA
	MOV $F5, #$21
	MOV A, $1C2F
	BMI CODE_1F2D
	MOV A, Y
	SETC
	SBC A, #$09
	MOV Y, A
	MOV A, ($21)+y
	OR A, #$03
	MOV ($21)+y, A
CODE_1F2D:
	MOV $F5, #$31
CODE_1F30:
	MOV A, $F6
	BNE CODE_1F30
	CLR7 $43
	MOV $F7, $43
	MOV X, #$00
	CALL CODE_1F54
	MOV A, #$00
	MOV $1C38, A
	RET

CODE_1F44:
	MOV $F6, #$E0
CODE_1F47:
	MOV A, $F6
	BNE CODE_1F47
	MOV $F6, #$00
	CLR7 $43
	MOV $F7, $43
	RET

CODE_1F54:
	MOV A, $1C2F+x
	BMI CODE_1F63
	BEQ CODE_1F60
	MOV A, #$01
	MOV $1C1B+x, A
CODE_1F60:
	JMP CODE_1F69

CODE_1F63:
	MOV A, $1C11+x
	MOV $1C13+x, A
CODE_1F69:
	RET

CODE_1F6A:
	MOV $1C38, Y
CODE_1F6D:
	MOV A, DATA_1C06
	MOV DATA_1C06+$01, A
	CALL CODE_1FDC
	MOV X, $1C0D
	BMI CODE_1F86
	MOV A, $C7+x
	BPL CODE_1F86
	AND A, #$10
	BEQ CODE_1F86
	CALL CODE_1F87
CODE_1F86:
	RET

CODE_1F87:
	MOV A, $04EF+x
	MOV Y, #$00
	MOV A, DATA_1C06
	AND A, $1C2B+y
	BEQ CODE_1FDB
	AND A, DATA_1C06+$01
	BEQ CODE_1F9A
	RET

CODE_1F9A:
	MOV A, $1C35+y
	OR A, $43
	MOV $43, A
	MOV $F7, A
	MOV A, DATA_1C06
	EOR A, $1C2B+y
	MOV DATA_1C06, A
CODE_1FAC:
	MOV A, $1C17+y
	MOV $1C15+y, A
	CMP A, $1C13+y
	BNE CODE_1FC0
	MOV A, $C7+x
	AND A, #$EF
	MOV $C7+x, A
	MOV A, $1C13+y
CODE_1FC0:
	DEC A
	DEC A
	BPL CODE_1FC7
	CLRC
	ADC A, #$06
CODE_1FC7:
	MOV $1C17+y, A
	PUSH Y
	MOV X, A
	MOV A, Y
	ASL A
	ASL A
	MOV Y, A
	MOV A, $E2+x
	MOV DATA_2500+$02+y, A
	MOV A, $DC+x
	MOV DATA_2500+$03+y, A
	POP Y
CODE_1FDB:
	RET

CODE_1FDC:
	MOV $F2, #$7C
	MOV A, $F3
	OR A, DATA_1C06
	MOV $F3, #$00
	MOV DATA_1C06, A
	RET

DATA_1FEB:
	db $03,$00,$00,$00,$00,$00,$00,$00
	db $00,$00
%SPCDataBlockEnd(0500)

%SPCDataBlockStart(2500)
DATA_2500:
	db $00,$26,$00,$26
%SPCDataBlockEnd(2500)

%SPCDataBlockStart(2600)
DATA_2600:
	db $A0,$77,$77,$77,$77,$77,$77,$77,$77,$A3,$88,$88,$88,$88,$88,$88
	db $88,$88
%SPCDataBlockEnd(2600)

%EndSPCUploadAndJumpToEngine($!Define_EWJ2_SPC700_EngineStartAddress)

