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