A86: Re: 16x16 Vid Mem Shift (rotate)


[Prev][Next][Index][Thread]

A86: Re: 16x16 Vid Mem Shift (rotate)




This routine should be a bit faster than what you had before.  I haven't
tested it, but it should work.  Notice the trick used to do both layers in
one loop and to loop without using a register for a loop counter.  And if
it's too slow, you can always unroll it:

Gray1 = $fc00
Gray2 = $ca00

; de = corner in buffer
ShiftRight:
 ld hl,Gray2
 add hl,de
 ex de,hl
 ld bc,Gray1
 add hl,bc
 ld bc,14
 ld a,32
ShiftRightLoop:
 ld (_@ShiftRightLoopCount),a
 or a
 rr (hl)
 inc hl
 rr (hl)
 inc hl
 rr (hl)
 add hl,bc
 ex de,hl
_@ShiftRightLoopCount =$+1
 ld a,0
 dec a
 jr nz,ShiftRightLoop
 ret

>
> I'm trying to move a 16x16 section of vid mem 1 pixel to the side. I've
> just started by trying to make it move the the right. This is supposed to
> input DE as the top-left byte of the sprite, and then shift it all 1 pixel
> over. It also has to work with grayscale ($FC00 and $CA00 layers). Any
> ideas why it won't work?




References: