Difference between revisions of "Z80 Routines:Graphic:putLargeSprite2"
From WikiTI
(created) |
m (moved Z80 Routines:Graphic:putLargeSprite to Z80 Routines:Graphic:putLargeSprite2: mistake) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | ||
− | + | ||
The '''put16xBsprite''' routine is used to plot a large sized sprite given its height and width. | The '''put16xBsprite''' routine is used to plot a large sized sprite given its height and width. | ||
Line 85: | Line 84: | ||
ld c,3 ;width | ld c,3 ;width | ||
ld ix,sprite | ld ix,sprite | ||
− | call | + | call largeSprite |
call fastcopy | call fastcopy | ||
;... | ;... |
Latest revision as of 01:11, 25 June 2010
The put16xBsprite routine is used to plot a large sized sprite given its height and width.
Code
;-----> Draw a picture ;Input: ix->sprite ; a=x ; l=y ; b=height (in pixels) ; c=width (in bytes, e.g. 2 would be 16 pixels) ;Output: nothing ; All registers are destroyed except bc', de', hl' largeSprite: di ex af,af' ld a,c push af ex af,af' ld e,l ld h,$00 ld d,h add hl,de add hl,de add hl,hl add hl,hl ld e,a and $07 ld c,a srl e srl e srl e add hl,de ld de,gbuf add hl,de largeSpriteLoop1: push hl largeSpriteLoop2: ld d,(ix) ld e,$00 ld a,c or a jr z,largeSpriteSkip1 largeSpriteLoop3: srl d rr e dec a jr nz,largeSpriteLoop3 largeSpriteSkip1: ld a,(hl) xor d ld (hl),a inc hl ld a,(hl) xor e ld (hl),a inc ix ex af,af' dec a push af ex af,af' pop af jr nz,largeSpriteLoop2 pop hl pop af push af ex af,af' ld de,$0C add hl,de djnz largeSpriteLoop1 pop af ret
Example
;... ld e,8 ;y ld a,16 ;x ld b,10 ;height ld c,3 ;width ld ix,sprite call largeSprite call fastcopy ;... sprite: .db %11111111,%11111111,%11111111 .db %11111111,%11111111,%11111111 .db %10000001,%10000001,%11111111 .db %10000001,%10000001,%11111111 .db %10000001,%10000001,%11111111 .db %10000001,%10000001,%11111111 .db %10000001,%10000001,%11111111 .db %10000001,%10000001,%11111111 .db %11111111,%11111111,%11111111 .db %11111111,%11111111,%11111111