;pakkun projectile projecticle
;by smkdan

incsrc subroutinedefs_trasm.asm

DIR = $03
PROPRAM = $04
TEMP = $09

dcb "INIT"
	RTL

dcb "MAIN"
	PHB
	PHK
	PLB
	JSR Run
	PLB
	RTL


Run
	JSL SubOffscreenX0
	JSL GetDrawInfo
	JSR GFX			;draw sprite

	LDA $14C8,x
	CMP #$08          	 
	BNE Return           
	LDA $9D			;locked sprites?
	BNE Return

	JSL $81802A		;regular speed update
	JSL $81A7DC		;mario interact
Return
	RTS        
			
;=====

XDISP	dcb $00,$08,$00,$08
YDISP	dcb $00,$00,$08,$08
PROP	dcb $00,$40,$80,$C0

TILEMAP = $C7

GFX
	LDA $15F6,x	;set propram base
	STA PROPRAM

	LDX #$00
OAM_Loop
	LDA $00		;dead simple GFX routine
	CLC
	ADC XDISP,x
	STA $0300,y
	LDA $01
	CLC
	ADC YDISP,x
	STA $0301,y
	LDA #TILEMAP
	STA $0302,y
	LDA PROPRAM
	ORA $64
	ORA PROP,x
	STA $0303,y

	INY
	INY
	INY
	INY

	INX
	CPX #$04	;4 tiles
	BNE OAM_LOOP

	LDX $15E9	;restore sprite index
	LDY #$00	;8x8 tiles
        LDA #$03        ;4 tile
        JSL $81B7B3	;reserve

	RTS

