Jaffe wrote:
The code tepples posted is a subroutine.
Yes, thank you; I agree.

Jaffe wrote:
You can place it wherever you want (of course not in the middle of some other code). Was this what you meant, or do you mean where to place the actual calls (jsr) to the routine?
Well, i think i ment both... My first problem was that I placed it in the middle of some other code. I've moved the
Code:
; Background data
bg:
.incbin "charSelect1.nam"
; Attribute table
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0
.byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$0F,$0F,$0F,$0F,$0F,$0F,$0F,$0F
;sprite data
hero_frame1:
.db aY, $80, $00, aX, aY, $81, $00, aX+8
.db aY+8, $90, $00, aX, aY+8, $91, $00, aX+8
.db aY+16, $a0, $00, aX, aY+16, $a1, $00, aX+8
.db aY+24, $b0, $00, aX, aY+24, $b1, $00, aX+8
hero_frame2:
.db aY, $80, $00, aX, aY, $81, $00, aX+8
.db aY+8, $90, $00, aX, aY+8, $91, $00, aX+8
.db aY+16, $a0, $00, aX, aY+16, $a1, $00, aX+8
.db aY+24, $b0, $00, aX, aY+24, $b1, $00, aX+8
hero_frame3:
.db aY, $80, $00, aX, aY, $81, $00, aX+8
.db aY+8, $90, $00, aX, aY+8, $91, $00, aX+8
.db aY+16, $a0, $00, aX, aY+16, $a1, $00, aX+8
.db aY+24, $b0, $00, aX, aY+24, $b1, $00, aX+8
hero_frame4:
.db aY, $80, $00, aX, aY, $81, $00, aX+8
.db aY+8, $90, $00, aX, aY+8, $91, $00, aX+8
.db aY+16, $a0, $00, aX, aY+16, $a1, $00, aX+8
.db aY+24, $b0, $00, aX, aY+24, $b1, $00, aX+8
;Operator < produces the low byte of an address
sprite_layouts_lo:
.db <hero_frame1, <hero_frame2, <hero_frame3, <hero_frame4
;Operator > produces the high byte of an address
sprite_layouts_hi:
.db >hero_frame1, >hero_frame2, >hero_frame3, >hero_frame4
;Number of hardware sprites in each layout
sprite_layouts_count:
.db 8, 8, 8, 8
that part underneath the background and attribute data code at the end... that was obvious to me; after i did it.

but, it's ok to make a mistake
and then learn from that. : )
Jaffe wrote:
...or do you mean where to place the actual calls (jsr) to the routine?
After many ideas and hours of reading I have decided to place the
jsr in my vblank code because vblank is the period where you write to the sprite memory,
right?Thank you Jaffe for helping me!
This code has not worked for me, yet... now, it draws the first sprite in the correct spot on the screen; but only the first sprite.
Back to my assembly book.
3
edit: forgot to post my codeCode:
draw_sprite:
...
ldx oamIndex
@loop:
; If you have the address of an array in a zero page pointer,
; you use the (d),y addressing mode and increase Y to go
; to the next byte.
lda (t0), y
iny
;ect. start
sta sprite, x
inx
;end ect. THIS IS THE END OF MY CODE.
dec t2
bne @loop
stx oamIndex
rts