nmi_code:
	lda.l $7E1908
	cmp #$04
	bne +
	jsr WheelCode
	+
	.return
	RTS

	
WheelCode:
	!StateTimer = $0AF5
	!LowerGFXaddr = $708000
	 PHX
	 PHY
	 LDA #$07
	 STA $2105
	 STZ $210B
	 STZ $2107
	 LDA !StateTimer
	 CMP #$01
	 BEQ +
	 JMP .endnmi
	 +
	 LDA #$10
	 SEC
	 SBC $140B ;!BlockCounter in sprite
	 STA $00
	 STZ $01
	 REP #$20
	 LDA #$5420
	 SEC
	 SBC $00
	 SBC $00
	 STA $02
	 STA $2116		;VRAM Address
	 LDA #$180D		;43x0 - 2 registers write once
	 STA $4340		;43x1 - $2118 - VRAM Data Write lo byte
	 LDA.w #.BlankTile	;Mode 7 Graphics Offset (Inserted with xkas)
	 STA $4342		;DMA Source Address Offset
	 LDX.b #.BlankTile>>16	; Mode 7 Graphics Bank
	 STX $4344		;DMA Source Address Bank
	 LDA #$0004
	 STA $4345
	 STA $04
		
	 LDX #$10		;Free DMA channel
	 STX $420B		;Enable DMA
	 
	 LDA $02
	 CLC
	 ADC #$0020
	 STA $2116
	 LDA #$0004
	 STA $4345
	 
	 LDX #$10		;Free DMA channel
	 STX $420B		;Enable DMA
	 
	 LDA #$5800
	 CLC
	 ADC $00
	 ADC $00
	 STA $02
	 STA $2116		;VRAM Address
	 LDA #$180D		;43x0 - 2 registers write once
	 STA $4340		;43x1 - $2118 - VRAM Data Write lo byte
	 LDA.w #.BlankTile	;Mode 7 Graphics Offset (Inserted with xkas)
	 STA $4342		;DMA Source Address Offset
	 LDX.b #.BlankTile>>16	; Mode 7 Graphics Bank
	 STX $4344		;DMA Source Address Bank
	 LDA #$0004
	 STA $4345
	 STA $04
		
	 LDX #$10		;Free DMA channel
	 STX $420B		;Enable DMA
	 
	 LDA $02
	 CLC
	 ADC #$0020
	 STA $2116
	 LDA #$0004
	 STA $4345
	 
	 LDX #$10		;Free DMA channel
	 STX $420B		;Enable DMA
	 
	 SEP #$20

	 .endnmi
	 PLY
	 PLX
	 RTS
	 
	 .BlankTile
		db $00 	;Repeated byte uploaded, it's a blank tile so it doesn't matter what the pallette and flip are
	 