[A83] Re: something to talk about


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

[A83] Re: something to talk about




> The routine first calculates how many times to shift each graphic byte from
> the X offset of the screen pixel offset.  It then preshifts all of the
> graphics into two 256 byte tables, one for left and right.  The shifting
> is quickly done using a prewritten, self modifying (relocated) loop.  This
> is very fast, since the loop is then essentially "hard coded" for that shift
> number.
> 
I can hardly understand why you need a self-modifying loop for that
purpose. As a first idea, I would do it by simple addition instead, like
this:

 push iyl
 ld ix,LEFTBYTE
 ld bc,RIGHTBYTE
 ld de,64 ; shifting by 6 bits in this case
 ld hl,0 ; shifted byte
 ld iyl,d ; always zero
LOOP:
 add hl,de
 ld (ix),h
 ld a,l
 ld (bc),a
 inc ix
 inc bc
 dec iyl
 jp nz,LOOP
 pop iyl

Some unrolling would certainly help.
-- 
http://fastmail.fm - IMAP accessible web-mail



Follow-Ups: