Oh, yeah, the plotloop is a complete placeholder, just so I can
compare output to the C prototype. That said, I'd done exactly the
same thing on scf versus set 7,d in my line drawing code (don't worry:
just once, outside the loop). I must find time to finish documenting
my vector drawing code as I'm sure that would only benefit from being
seen by somebody other than me.

The screen's at 32768 because I have multiplication tables occupying
the highest and lowest 2kb of RAM. It's the usual squared and divided
by 4 stuff, so by using that positioning I can do the relevant 16bit
addition and subtraction in HL and then read the result directly from
RAM without any further computation.

On Sat, Oct 24, 2009 at 8:43 PM, Chris Pile <chris.p...@blueyonder.co.uk> wrote:
> Just a quick glimps of the code shows you can save 8-clocks every
> itteration of your plotloop by getting rid of the SET 7,D instructions
> and putting a SCF before a RR D instruction.  Replacing the SRL D's
> with RR D's.
>
> But as you're not likely to be using this particular plotloop in the final
> article it probably doesn't matter too much!
>
> That said, using SCF / RR D instead of SRL D / SET 7,D is something
> worth remembering for later!
>
> Better still, keep your screens at address 0 and do away with the SCF's
> altogether.
>
> Rearranging your registers so that you don't need to keep calculating the
> screen address is always a good optimisation...  But I take it you're going
> to use the stack to shove the scanlines on-screen?  Which is even better!!
>
> I've always been a big fan of using the stack!!  :-))
>
> Chris.
>
>
>
>
>
> @plotloop:
>
> ; left pixel
> ld a, (hl)
> inc h
>
> ; right pixel
> ld c, (hl)
> inc l
>
> dec h
>
> ld d, l
> ld e, a
> srl d
> rr e
> jr nc, @+rpx
>
> ld a, 0x0f
> jr @+pxd
>
> @rpx:
> ld a, 0xf0
>
> @pxd:
> set 7, d
> ld (de), a
>
> ld d, l
> ld e, c
> srl d
> rr e
> jr nc, @+rpx
>
> ld a, 0x0e
> jr @+pxd
>
> @rpx:
> ld a, 0xe0
>
> @pxd:
> set 7, d
> ld (de), a
>
> djnz @-plotloop
>
>

Reply via email to