;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; graphics routine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; TILEMAP dcb $80,$82,$84,$86 SUB_GFX JSR GET_DRAW_INFO ; sets y = OAM offset LDA $157C,x ; \ $02 = direction STA $02 ; / LDA $14 LSR A LSR A LSR A AND #$03 STA $03 PHX LDA $00 ; \ tile x position = sprite x location ($00) STA $0300,y ; / LDA $01 ; \ tile y position = sprite y location ($01) STA $0301,y ; / PLX LDA $15F6,x ; tile properties xyppccct, format PHX LDX $02 ; \ if direction == 0... BNE NO_FLIP ; | ORA #$40 ; / ...flip tile NO_FLIP ORA $64 ; add in tile priority of level STA $0303,y ; store tile properties LDX $03 LDA TILEMAP,x STA $0302,y PLX INY ; \ increase index to sprite tile map ($300)... INY ; | ...we wrote 1 16x16 tile... INY ; | ...sprite OAM is 8x8... INY ; / ...so increment 4 times LDY #$02 ; \ 460 = 2 (all 16x16 tiles) LDA #$00 ; | A = (number of tiles drawn - 1) JSL $01B7B3 ; / don't draw if offscreen RTS ; return