A85: Put Sprite
[Prev][Next][Index][Thread]
A85: Put Sprite
i am kinda new to programming and am not really familiar with the put_sprite
routines. is there a heavily commented routine out there that someone could
post? i would really appreciate it. i have the usgard tutorial but i don't
really understand jimmy m.'s putsprite routine that well. could someone
comment it for me? i would really apprecate it so much. thanks a ton. i've
pasted jimmy m.'s putsprite at the end of this so people could comment what it
is doing with each line. or just a summary paragraph of the mechanics.
thanks a ton everyone.
jimi
PutSprite: ; Puts a sprite pointed to by HL at B,C
push bc
push de
ld a,63
sub c
ld c,a
push hl
push hl
call FIND_PIXEL
ld de,$FC00
add hl,de
ex de,hl
pop hl
ld b,(hl)
inc hl
ld c,(hl)
inc hl
push hl
pop ix
ex de,hl
PS_NewRow:
push bc
ld d,(ix)
inc ix
push af
push hl
PS_NewCol:
rl d
ld e,a
jr nc,PS_NoPixel
or (hl)
jr PS_NextPixel
PS_NoPixel:
cpl
and (hl)
PS_NextPixel:
ld (hl),a
ld a,e
rrca
jr nc,PS_SameByte
inc hl
PS_SameByte:
djnz PS_NewCol
pop hl
pop af
ld de,16
add hl,de
pop bc
dec c
jr nz,PS_NewRow
pop hl
pop de
pop bc
ret
The sprite is stored like this:
.db 6,6 ; x- and y-width in pixels
.db %110011
.db %100001
.db %000000
.db %000000
.db %100001
.db %110011