;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;True levelinitASM Code lies ahead.
;If you are too lazy to search for a levelinit
;Use CTRL+F. The format is as following:
;levelinitx - levelinits 0-F
;levelinitxx - levelinits 10-FF
;levelinitxxx - levelinits 100-1FF
;Should be pretty obvious...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

levelinit0:
RTS
levelinit1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit2: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit3: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit8: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit9: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitA: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitC: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitD: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitE: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitF: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit12: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit13: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit14: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit15: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit16: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit17: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit18: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit19: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit20: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit21: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit22: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit23: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit24: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit25: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit26: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit27: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit28: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit29: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit2A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit2B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit2C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit2F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit30: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit31: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit32: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit33: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit34: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit35: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit36: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit37: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit38: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit39: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit3D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit3E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit3F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit40: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit41: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit42: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit43: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit44: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit45: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit46: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit47: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit48: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit49: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit4A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit4B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit4C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit4D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit4E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit4F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit52: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit53: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit54: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit55: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit56: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit57: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit58: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit59: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit5A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit5C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit5D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit5E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit5F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit60: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit61: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit62: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit63: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit64: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit65: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit66: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit67: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit6C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit69: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit6A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit6E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit6F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit70: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit74: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit76: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit77: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit79: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit7A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit7B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit7D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit7E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit7F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit80: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit81: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit82: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit83: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit84: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit85: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit86: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit87: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit8B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit8C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit8D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit8E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit8F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit90: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit91: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit92: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit93: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit94: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit95: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit96: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit97: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit98: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit99: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit9A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit9B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit9C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit9D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit9E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit9F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitA0: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitA1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitA2: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitA3: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitA4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitA5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitA6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitA7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitA8: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitAB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitAD: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitAE: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitAF: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitB0: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitB1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitB2: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitB3: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitB4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitB5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitB6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitB7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitB8: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitB9: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitBA: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitC1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitC4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitC5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitC6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
RTS

levelinitC7:
	STZ $62		;make sure that the counter is at 0

	LDA #$00
	STA $0DAE

	LDA #$11	;disable layer 2
	STA $212C
	STA $212D

	STZ $0F63

	STZ $61		;initialize wait timer 1

	STZ $0F5E	;initialize wait timer 2

	LDA #45		;set wait-timer at start
	STA $191F
	RTS

levelinitC8:
levelinitC9: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitCA: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitCB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitCC: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitCD: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitCE: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitCF: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitD0: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitD1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitD2: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitD3: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitD4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitD5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitD6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitD7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitD8: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitD9: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitDA: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitDB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitDC: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitDD: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitDE: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitDF: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitE0: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitE1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitE2: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitE3: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitE4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitE5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitE6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitE7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitE8: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitE9: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
RTS
levelinitEA:  
	INC $85
	RTS
levelinitEB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitEC: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitED: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitF0: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitF1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitF2: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitF3: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitF4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitF5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitF6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitF7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitF8: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitF9: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitFB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitFC: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitFD: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitFE: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinitFF: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit100: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit101: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit104: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit105: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit106: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit107: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit108: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit109: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit10A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit10B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit10C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit10D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit10E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit10F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit110: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit112: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit113: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit114: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit115: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit116: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit117: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit118: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit119: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit11A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit11C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit11D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit11E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit11F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit121: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit122: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit124: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit125: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit127: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit128: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit129: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit12A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit12B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit12C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit12F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit131: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit133: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit134: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit135: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit136: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit137: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit139: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit13A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit13B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit13C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit13D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit13E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit13F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit140: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit141: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit142: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit143: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
RTS
levelinit144:
	STZ $0F42
	RTS
levelinit145:
	LDA $40     ;\
	ORA #$72    ; |Set the layer 3 bit of CGADDSUB
	STA $40     ;/
        LDA #$17    ;\
	STA $212D   ;/add some layer to the subscreen
	JSR level145

	LDA.b #autostim145
	STA $00
	LDA.b #autostim145>>8
	STA $01
	LDA.b #autostim145>>16
	STA $02
	PHK			; \ Jump to stripe image upload routine.
	PER .return-1		;  |
	PEA $84CE		;  |
	JML $00871E		; /
.return	
	RTS

levelinit147:
	STZ $0F42

	REP #$20	; 16 bit A
	LDA #$0000	; $43X0 = 00 
	STA $4330	; $43x1 = 00
	LDA #$0C00	; get pointer to brightness table
	STA $4332	; store it to low and high byte pointer
	PHK		; get bank
	PLY		;
	STY $4334	; store to bank pointer byte
	SEP #$20	; 8 bit A
	LDA #$08	; Enable HDMA on channel 3
	TSB $0D9F	;

	RTS
levelinit148:
	LDA #$04
	TSB $40
        LDA #$13    	;\
	STA $212d   	;/add some layer to the subscree

	LDA.b #autostim148
	STA $00
	LDA.b #autostim148>>8
	STA $01
	LDA.b #autostim148>>16
	STA $02
	PHK			; \ Jump to stripe image upload routine.
	PER .return-1		;  |
	PEA $84CE		;  |
	JML $00871E		; /
.return	
	RTS



levelinit146:
levelinit149: 
	RTS

levelinit14A: 
	STZ $0F42
	RTS
levelinit14B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit14C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit14D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit14E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit14F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit150: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit151: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit152: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit153: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit154: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit155: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit156: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit157: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit158: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit159: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit15A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit15B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit15C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit15D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit15E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit15F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit160: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit161: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit162: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit163: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit164: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit165: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit166: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit167: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit168: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit169: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit16A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit16B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit16C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit16D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit16E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit16F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit172: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit173: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit174: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit175: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit176: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit17B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit17C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit17D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit17E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit17F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit180: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit181: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit182: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit183: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit184: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit185: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit186: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit188: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit189: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit18A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit18B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit18C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit18D: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit18E: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit18F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit190: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit191: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit192: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit193: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit194: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit195: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit196: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit197: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit198: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit199: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit19A: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit19B: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit19C: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit19F: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1A5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1A6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1A7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1A9: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1AA: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1AB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1AC: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1AD: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1AE: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1AF: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1B0: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1B1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1B2: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1B3: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1B4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1B5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1B6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1B7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1B8: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1B9: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1BA: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1BB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1BC: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1BD: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1BE: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1BF: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1C0: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1C1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1C2: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1C3: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1C4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1C5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1C6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1C7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1C8: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1CA: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1CB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1CC: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1CD: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1CE: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1CF: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1D0: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1D1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1D3: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1D4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1D5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1D6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1D7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1D8: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1D9: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1DA: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1DB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1DC: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1DD: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1DE: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1DF: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1E0: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1E1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1E2: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1E3: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1E4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1E5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1E6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1E7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1E8: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1E9: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1EA: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1EB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1EC: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1ED: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1EE: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1EF: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1F0: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1F1: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1F2: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1F3: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1F4: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1F5: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1F6: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1F7: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1F8: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1F9: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1FA: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1FB: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1FC: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1FD: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1FE: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
levelinit1FF: ; DO NOT ADD CODE TO THIS LABEL WITHOUT PUTTING AN RTS BEFORE IT
	RTS




levelinit10:
	LDA #$00		; HDMA gradient
	STA $4330
	LDA #$02
	STA $4340
	LDA #$32
	STA $4331
	STA $4341
	REP #$20
	LDA.w #.Table2
	STA $4332
	LDA.w #.Table1
	STA $4342
	SEP #$20
	LDA.b #.Table2>>16
	STA $4334
	LDA.b #.Table1>>16
	STA $4344
	LDA #$18
	TSB $0D9F
	RTS


	.Table1
	db $08,$3A,$4F
	db $08,$3B,$4F
	db $08,$3B,$50
	db $08,$3C,$51
	db $08,$3C,$52
	db $08,$3D,$53
	db $08,$3D,$54
	db $08,$3E,$55
	db $08,$3E,$56
	db $80,$3F,$57
	db $18,$3F,$57
	db $00

.Table2
	db $08,$8A
	db $28,$8B
	db $80,$8C
	db $30,$8C
	db $00


levelinit11:
  	LDA $40		;\
	ORA #$04	; |Set the layer 3 bit of CGADDSUB
	STA $40		;/
        LDA #$13	;\
	STA $212D	;/add some layer to the subscreen
	RTS		;Return





levelinit1F:
	LDA $24
        CLC
        ADC #$80
        STA $24
	LDA #$04
	TSB $40
        LDA #$13    	;\
	STA $212d   	;/add some layer to the subscree

	LDA.b #autostim1F
	STA $00
	LDA.b #autostim1F>>8
	STA $01
	LDA.b #autostim1F>>16
	STA $02
	PHK			; \ Jump to stripe image upload routine.
	PER .return-1		;  |
	PEA $84CE		;  |
	JML $00871E		; /
.return	
	JMP level1F

levelinit2D:
	LDA #$24
	STA $40
	LDA #$13
	STA $212D

	LDX #$18
.TileMap
	LDA IceWaterTilemap2D,x
	STA $7F837D,x
	DEX
	BPL .TileMap

	LDA #$00
	STA $4330
	LDA #$02
	STA $4340

	LDA #$32
	STA $4331
	STA $4341

	REP #$20
	LDA.w #Table2D_2
	STA $4332
	LDA.w #Table2D_1
	STA $4342

	SEP #$20

	LDA.b #Table2D_2>>16
	STA $4334
	LDA.b #Table2D_1>>16
	STA $4344

	LDA #$18
	TSB $0D9F

	JMP level2D

Table2D_1:
	db $18,$41,$82
	db $08,$42,$83
	db $10,$43,$84
	db $10,$44,$85
	db $08,$44,$86
	db $10,$45,$86
	db $10,$45,$87
	db $20,$46,$88
	db $20,$47,$89
	db $08,$48,$8A
	db $08,$48,$8B
	db $28,$49,$8B
	db $00

Table2D_2:
	db $18,$21
	db $28,$22
	db $38,$23
	db $30,$24
	db $38,$25
	db $00

IceWaterTilemap2D:
	incbin icewater.stim

levelinit2E:
	REP #$10

	LDX #$01B2
.Loop
	LDA Snowball2E,x
	STA $7F837D,x
	DEX
	BPL .Loop

	SEP #$10

	LDA #$00
	STA $7FA000
	STA $7FA001
	STA $7FA006
	STA $7FA007
	STA $7FA008
	STA $7FA009
	STA $7FA00A
	STA $7FA00B
	STA $7FA00C

	REP #$20
	LDA #$F1C0
	STA $7FA002	; Free RAM for Layer 3 X offset.
	LDA #$0020
	STA $7FA004	; Free RAM for Layer 3 Y offset.
	SEP #$20

	STZ $15E8	; Free RAM used to determine Mario's skating speed for this level.

	LDA.b #$00
	STA.l $7FB020
	STA.l $7FB021
	LDA.b #$00
	STA.l $7FB022
	STA.l $7FB023

	LDX #$09
LoopInit2E:
	LDA Table2E,x
	STA $7FB600,x
	DEX
	BPL LoopInit2E

	LDA #$01
	STA $4350

	LDA #$2C
	STA $4351

	REP #$20
	LDA #$B600
	STA $4352
	SEP #$20
	LDA #$7F
	STA $4354

	LDA #$20
	TSB $0D9F

	JMP level2E_Grp1

Table2E:
db $7F,$15,$0A
db $50,$15,$0A
db $10,$02,$1D
db $00

Snowball2E:
	incbin Snowball.stim

levelinit3A:
levelinit3B:
levelinit3C:
	LDA #$00	;Unused tile	(walking 1)
	STA $7F8800

	LDA #$A0	;Head tile 1	(walking 1)
	STA $7F8801

	LDA #$C0	;Body tile 1	(walking 1)
	STA $7F8802

	LDA #$00	;Unused tile	(walking 2)
	STA $7F8803

	LDA #$A0	;Head tile 2	(walking 2)
	STA $7F8804

	LDA #$C2	;Body tile 2	(walking 2)
	STA $7F8805

	LDA #$82	;Vial tile	(throwing)
	STA $7F8806

	LDA #$A4	;Head tile 3	(throwing)
	STA $7F8807

	LDA #$C4	;Body tile 3	(throwing)
	STA $7F8808


	LDA #$82	;Vial tile 1	(actual vial)
	STA $7F8809

	LDA #$88	;Vial tile 2	(actual vial)
	STA $7F880A

	LDA #$88	;Vial tile 3	(actual vial)
	STA $7F880B

	LDA #$82	;Vial tile 4	(actual vial)
	STA $7F880C

	LDA #$80	;Vial tile 5	(actual vial)
	STA $7F880D
	RTS

levelinit50:
levelinit51:
levelinit5B:
	LDA #$00		; HDMA gradient
	STA $4330
	LDA #$02
	STA $4340
	LDA #$32
	STA $4331
	STA $4341
	REP #$20
	LDA.w #.Table2
	STA $4332
	LDA.w #.Table1
	STA $4342
	SEP #$20
	LDA.b #.Table2>>16
	STA $4334
	LDA.b #.Table1>>16
	STA $4344

	PHP
	REP #$20
	LDY #$03
	STY $4350
	LDY #$21
	STY $4351
	LDA.w #.Table
	STA $4352
	LDY.b #.Table>>16
	STY $4354
	SEP #$20
	PLP
	LDA #$38
	TSB $0D9F
	RTS

.Table1
	db $33,$3A,$8A
	db $20,$3B,$8B
	db $21,$3C,$8B
	db $10,$3D,$8B
	db $10,$3D,$8C
	db $20,$3E,$8C
	db $11,$3F,$8D
	db $1B,$3F,$8C
	db $00
.Table2
	db $23,$4E
	db $20,$4F
	db $10,$50
	db $10,$51
	db $11,$52
	db $10,$53
	db $10,$54
	db $10,$55
	db $21,$56
	db $1B,$57
	db $00
.Table
	db $23 : dw $2F00,$29DA
	db $10 : dw $2F00,$29FA
	db $10 : dw $2F00,$2DFB
	db $10 : dw $2F00,$2E1B
	db $10 : dw $2F00,$2E3C
	db $11 : dw $2F00,$2E5C
	db $10 : dw $2F00,$2E7D
	db $10 : dw $2F00,$329D
	db $10 : dw $2F00,$32BE
	db $10 : dw $2F00,$32DE
	db $11 : dw $2F00,$36DF
	db $1B : dw $2F00,$32FF
	db $00





levelinit68:
	LDA #$48		; Initialize timer (see level68:)
	STA $14A8
	RTS

levelinit6B:
levelinit6D:
	LDA #$17		 	;\ Everything
	STA $212C			;| is on main screen
	LDA #$00 			;| Nothing
	STA $212D			;| is on sub screen
	LDA #$27			;| Affect layer 1,2,3
	STA $40				;/ and back enable

	LDA #$00
	STA $4330
	LDA #$02
	STA $4340

	LDA #$32
	STA $4331
	STA $4341

	REP #$20
	LDA.w #.Table2_6B
	STA $4332
	LDA.w #.Table1_6B
	STA $4342

	SEP #$20

	LDA.b #.Table2_6B>>16
	STA $4334
	LDA.b #.Table1_6B>>16
	STA $4344

	LDA #$18
	TSB $0D9F

	RTS

.Table1_6B
db $80,$2E,$80
db $22,$2E,$80
db $04,$2F,$80
db $04,$30,$80
db $03,$31,$80
db $03,$32,$80
db $03,$33,$80
db $03,$34,$80
db $03,$35,$80
db $04,$36,$80
db $04,$37,$80
db $17,$38,$80
db $08,$39,$80
db $00

.Table2_6B
db $80,$40
db $20,$40
db $04,$41
db $04,$42
db $03,$43
db $03,$44
db $03,$45
db $03,$46
db $03,$47
db $04,$48
db $04,$49
db $0E,$4A
db $02,$4B
db $01,$4C
db $01,$4D
db $01,$4E
db $01,$4F
db $01,$50
db $01,$51
db $01,$52
db $01,$53
db $01,$54
db $01,$55
db $02,$56
db $04,$57
db $00


levelinit75:
	LDA #$FF
	STA $1887
	LDA #$FF	; Fills the Air meter
	STA $7E005C
	RTS

levelinit78:
	LDA #$FF
	STA $1887
	RTS

levelinit7C:
levelinit123:
LDA #$17
STA $212C
STA $212D

LDA #$B4			;
STA $24				; set the initial Y position of Layer 3
STZ $25				;
LDA #$04			;
TRB $40				; disable Layer 3 from being affected by CGADSUB

        LDA #$13    	;\
	STA $212d   	;/add some layer to the subscree

	LDA.b #autostim123
	STA $00
	LDA.b #autostim123>>8
	STA $01
	LDA.b #autostim123>>16
	STA $02
	PHK			; \ Jump to stripe image upload routine.
	PER .return-1		;  |
	PEA $84CE		;  |
	JML $00871E		; /
.return	
	RTS

levelinit88:
	LDA #$BD
	STA $1468
	RTS
levelinit89:
levelinit8A:
	STZ $76
	RTS

levelinitA9:

REP #$20
LDA #$0000
STA $4330
LDA #InitCODE
STA $4332
PHK
PLY
STY $4334
SEP #$20
LDA #$08
TSB $0D9F
RTS

InitCODE:
db $03,$00
db $03,$01
db $03,$02
db $03,$03
db $03,$04
db $03,$05
db $03,$06
db $03,$07
db $03,$08
db $03,$09
db $03,$0A
db $03,$0B
db $03,$0C
db $03,$0D
db $03,$0E
db $80,$0F
db $03,$0E
db $03,$0D
db $03,$0C
db $03,$0B
db $03,$0A
db $03,$09
db $03,$08
db $03,$07
db $03,$06
db $03,$05
db $03,$04
db $03,$03
db $03,$02
db $03,$01
db $03,$00
db $00

levelinitAA:
levelinitAC:
	STZ $58
	RTS

levelinitBB:
	LDA $7F9A83
	ORA #$01
	STA $7F9A83
	LDA #$FF
	STA $1DEF	;freeram used for start of race timer
	RTS
levelinitBC:
	LDA $7F9A83
	ORA #$02
	STA $7F9A83
	RTS
levelinitBD:
	LDA $7F9A83
	ORA #$04
	STA $7F9A83
	RTS
levelinitBE:
	LDA $7F9A83
	ORA #$08
	STA $7F9A83
	LDA #$00	;number of targets hit
	STA $7F9A90
	LDA #$19	;number of shots allowed
	STA $7F9A91
	RTS
levelinitBF:

	LDA $7F9A83
	ORA #$10
	STA $7F9A83
	RTS
levelinitC0:	;7F9A7B-7D = answer submission digits
		;$7F9A7E-80 = correct answer digits
		;$7F9A81-82 = total points missed, points missed in previous game
		;$7F9A83 = which doors have been entered so far
		;$7F9A84 = initial time of timer sprite
	STZ $19	
	LDA $7F9A81	;total points missed
	CLC
	ADC $7F9A82	;points missed in last game
	STA $7F9A81
	LDA #$00
	STA $7F9A82

	LDA $7F9A81	;if points missed are too great, time for the consolation prize!
	CMP #$0B
	BCC StillTryC0
	lda #$05
	sta $71
StillTryC0:
	RTS

levelinitC2:
levelinitC3:
	LDA $7F8889
	STA $13BF
	RTS

levelinitEE:
INC $85 ;added for water flag midway point

JSR levelEE
LDA $24
ADC #$FB
ADC #$0B
STA $24

LDA #$04
TSB $40
LDA #$13
STA $212D
LDA.b #TidesEE
STA $00
LDA.b #TidesEE>>8
STA $01
LDA.b #TidesEE>>16
STA $02
PHK
PER $0006
PEA $84CE
JML $80871E
RTS

levelinitEF:
JSR levelEF

LDA $24
ADC #$0B
STA $24

LDA #$04
TSB $40
LDA #$13
STA $212D
LDA.b #TidesEE
STA $00
LDA.b #TidesEE>>8
STA $01
LDA.b #TidesEE>>16
STA $02
PHK
PER $0006
PEA $84CE
JML $80871E
RTS

levelinitFA:
	!BlocksHit = $7FB100
	LDA #$00
	LDX #$08
	.loop
	STA !BlocksHit,x
	DEX
	BPL .loop
	LDA #$01
	STA $14AF
	RTS

levelinit102:
STZ $19
STZ $0DBC
STZ $0DC2
LDX #$06 ;the amount of bytes in the scroll table. Should be a multiple of 3
LOOP:
LDA ScrollTable,x
STA $7FA000,x
DEX
BPL LOOP
RTS

ScrollTable:
db $79,$01,$01
db $10,$01,$01
db $00 ;end byte, don't remove it

levelinit103:
	LDA $40     ;\
	ORA #$72    ; |Set the layer 3 bit of CGADDSUB
	STA $40     ;/
        LDA #$17    ;\
	STA $212D   ;/add some layer to the subscreen
	LDA.b #autostim145
	STA $00
	LDA.b #autostim145>>8
	STA $01
	LDA.b #autostim145>>16
	STA $02
	PHK			; \ Jump to stripe image upload routine.
	PER .return-1		;  |
	PEA $84CE		;  |
	JML $00871E		; /
.return	
	JMP level103

levelinit111:
	STZ $19 
	LDA #$00
	STA $7F9A83
	STA $7F9A82
	STA $7F9A81	;total points missed
	RTS

levelinit11B:
	LDA #$3F
	STA $13BF
	RTS

levelinit71:
levelinit72:
levelinit73:
RTS
levelinit120:
	JMP level120
RTS
levelinit126:
		LDA #$00
		STA $4330
		LDA #$02
		STA $4340

		LDA #$32
		STA $4331
		STA $4341

		REP #$20
		LDA.w #level2E_Table2
		STA $4332
		LDA.w #level2E_Table1
		STA $4342

		SEP #$20

		LDA.b #level2E_Table2>>16
		STA $4334
		LDA.b #level2E_Table1>>16
		STA $4344

		LDA #$18
		TSB $0D9F

		RTS

levelinit12D:
STZ $18E6
STZ $1908
STZ $191B

JMP levelinit3A

RTS
levelinit12E:
	LDA #$00	;Unused tile	(walking 1)
	STA $7F8800

	LDA #$A0	;Head tile 1	(walking 1)
	STA $7F8801

	LDA #$C0	;Body tile 1	(walking 1)
	STA $7F8802

	LDA #$00	;Unused tile	(walking 2)
	STA $7F8803

	LDA #$A0	;Head tile 2	(walking 2)
	STA $7F8804

	LDA #$C2	;Body tile 2	(walking 2)
	STA $7F8805

	LDA #$82	;Vial tile	(throwing)
	STA $7F8806

	LDA #$A4	;Head tile 3	(throwing)
	STA $7F8807

	LDA #$C4	;Body tile 3	(throwing)
	STA $7F8808


	LDA #$82	;Vial tile 1	(actual vial)
	STA $7F8809

	LDA #$88	;Vial tile 2	(actual vial)
	STA $7F880A

	LDA #$88	;Vial tile 3	(actual vial)
	STA $7F880B

	LDA #$82	;Vial tile 4	(actual vial)
	STA $7F880C

	LDA #$80	;Vial tile 5	(actual vial)
	STA $7F880D

LDA #$01
STA $4300

LDA #$18
STA $4301

LDA.b #Background
STA $4302
LDA.b #Background>>8
STA $4303
LDA.b #Background>>16
STA $4304

REP #$20
LDA #$5000
STA $2116

LDA #$2000
STA $4305
SEP #$20

LDA #$01
STA $420B

LDA #$01
STA $4310

LDA #$18
STA $4301

LDA.b #EggShatterGFX
STA $4302
LDA.b #EggShatterGFX>>8
STA $4303
LDA.b #EggShatterGFX>>16
STA $4304

REP #$20
LDA #$76F0
STA $2116

LDA #$0032
STA $4305
SEP #$20

LDA #$01
STA $420B




REP #$20
LDA $1A
LSR
LSR
STA $22
LDA $1C
LSR
LSR
STA $24
SEP #$20

	RTS




EggShatterGFX:
db $00, $03, $02, $05, $06, $09, $0E, $11 
db $0C, $12, $18, $24, $10, $28, $00, $38 
db $00, $00, $00, $00, $00, $00, $00, $00 
db $00, $00, $00, $00, $00, $00, $00, $00

levelinit130:
LDA #$FF
STA $7E005C
RTS




levelinit138:
	JMP level138
RTS



levelinit132:
RTS
levelinit170:
LDX #$FF
Loop1702:
INX
CPX #$0C
BEQ Done1702

	LDA $9E,x
	CMP #$97
	BNE Loop1702
	STZ $14C8,x
	BRA Loop1702

Done1702:
	;Set up the KooPhD's tilemap
	LDA #$00	;Unused tile	(walking 1)
	STA $7F8800

	LDA #$A0	;Head tile 1	(walking 1)
	STA $7F8801

	LDA #$C0	;Body tile 1	(walking 1)
	STA $7F8802

	LDA #$00	;Unused tile	(walking 2)
	STA $7F8803

	LDA #$A0	;Head tile 2	(walking 2)
	STA $7F8804

	LDA #$C2	;Body tile 2	(walking 2)
	STA $7F8805

	LDA #$82	;Vial tile	(throwing)
	STA $7F8806

	LDA #$A4	;Head tile 3	(throwing)
	STA $7F8807

	LDA #$C4	;Body tile 3	(throwing)
	STA $7F8808


	LDA #$82	;Vial tile 1	(actual vial)
	STA $7F8809

	LDA #$88	;Vial tile 2	(actual vial)
	STA $7F880A

	LDA #$88	;Vial tile 3	(actual vial)
	STA $7F880B

	LDA #$82	;Vial tile 4	(actual vial)
	STA $7F880C

	LDA #$80	;Vial tile 5	(actual vial)
	STA $7F880D
	RTS
levelinit171:
LDA #$01
STA $4300

LDA #$18
STA $4301

LDA.b #Background
STA $4302
LDA.b #Background>>8
STA $4303
LDA.b #Background>>16
STA $4304

REP #$20
LDA #$5000
STA $2116

LDA #$2000
STA $4305
SEP #$20



LDA #$01
STA $420B
	RTS

levelinit177:
	LDA #$0F
	STA $13BF
	STZ $0D9C
	RTS
levelinit178:
	RTS
levelinit179:
levelinit17A:
	REP #$20
	LDA #$0000
	STA $1466
	SEP #$20
	LDX #$48
LoopYYY:
	LDA LVLYYY_HDMA,x
	STA $7FB100,x	; Parallax HDMA RAM table.
	DEX
	BPL LoopYYY
	JMP Parallax_INIT2

LVLYYY_HDMA:
db $06,$00,$00	; No scrolling
db $0D,$00,$00	; Slow scrolling
db $0E,$00,$00	; Medium scrolling
db $02,$00,$00	; Slow scrolling
db $01,$00,$00	; Very slow scrolling
db $0A,$00,$00	; Medium scrolling
db $03,$00,$00	; No scrolling
db $13,$00,$00	; Fast scrolling
db $0A,$00,$00	; Medium scrolling
db $03,$00,$00	; Slow scrolling
db $0B,$00,$00	; Medium scrolling
db $02,$00,$00	; Very slow scrolling
db $03,$00,$00	; Fast scrolling
db $0B,$00,$00	; Very fast scrolling
db $05,$00,$00	; No scrolling
db $0F,$00,$00	; Slow scrolling
db $11,$00,$00	; Medium scrolling
db $0D,$00,$00	; Slow scrolling
db $01,$00,$00	; Very slow scrolling
db $06,$00,$00	; Medium scrolling
db $10,$00,$00	; Fast scrolling
db $16,$00,$00	; Very slow scrolling
db $04,$00,$00	; Slow scrolling
db $01,$00,$00	; No scrolling
db $0E,$00,$00	; Very fast scrolling
db $00
RTS
levelinit187:
	STZ $15
	STZ $16
	STZ $17
	STZ $18
	RTS

levelinit19D:
levelinit19E:
levelinit1A0:
levelinit1A1:
levelinit1A2:
RTS
levelinit1A3:
	JSR level1A0
Darkness:
	REP #$20	; 16 bit A
	LDA #$0000	; $43X0 = 00 
	STA $4330	; $43x1 = 00
	LDA #LVL1BRIGHT	; get pointer to brightness table
	STA $4332	; store it to low and high byte pointer
	PHK		; get bank
	PLY		;
	STY $4334	; store to bank pointer byte
	SEP #$20	; 8 bit A
	LDA #$08	; Enable HDMA on channel 3
	TSB $0D9F	;
	RTS		; return

LVL1BRIGHT:
db $03,$00
db $03,$01
db $03,$02
db $03,$03
db $03,$04
db $03,$05
db $03,$06
db $03,$07
db $03,$08
db $03,$09
db $03,$0A
db $03,$0B
db $03,$0C
db $03,$0D
db $03,$0E
db $80,$0F
db $03,$0E
db $03,$0D
db $03,$0C
db $03,$0B
db $03,$0A
db $03,$09
db $03,$08
db $03,$07
db $03,$06
db $03,$05
db $03,$04
db $03,$03
db $03,$02
db $03,$01
db $03,$00
db $00
	RTS


levelinit1A4:
	LDA #$27
	STA $7B
	LDA #$A0
	STA $7D

	REP #$20	; 16 bit A
	LDA #$0000	; $43X0 = 00 
	STA $4330	; $43x1 = 00
	LDA #LVL2BRIGHT	; get pointer to brightness table
	STA $4332	; store it to low and high byte pointer
	PHK		; get bank
	PLY		;
	STY $4334	; store to bank pointer byte
	SEP #$20	; 8 bit A
	LDA #$08	; Enable HDMA on channel 3
	TSB $0D9F	;
	JMP level1A3		; return

LVL2BRIGHT:
db $80,$0F
db $39,$0F
db $03,$0E
db $03,$0D
db $03,$0C
db $03,$0B
db $03,$0A
db $03,$09
db $03,$08
db $03,$07
db $03,$06
db $03,$05
db $03,$04
db $03,$03
db $03,$02
db $03,$01
db $03,$00
db $00

	RTS

levelinit1A8:
	JMP level1A8
RTS
levelinit1C9:
	JMP level138
RTS
levelinit1D2:
;!RAM =		$7FA010 
;; 4 bytes
;
;!HDMARAM =	$7FA000 
;; 10 bytes
;
;	LDA #$00
;	STA !RAM
;	STA !RAM+$1
;	LDA #$80
;	STA !RAM+$2
;	LDA #$C0
;	STA !RAM+$3
; parallax start
;	LDX #$09
;-	LDA .ScrollTable,x
;	STA !HDMARAM,x
;	DEX
;	BPL -
;	RTS
;.ScrollTable
;	db $20,$01,$01
;	db $7F,$01,$01
;	db $20,$01,$01
;	db $7F,$01,$01
;	db $00
; parallax end
RTS