I've now landed at the following loop, each iteration of which draws a single line (320 pixels) of colour 15 to the framebuffer.
Code: Select all
$00079412 : 48e4 fcf0 movem.l d0-d5/a0-a3,-(a4) $00079416 : 48e4 fcf0 movem.l d0-d5/a0-a3,-(a4) $0007941a : 48e4 fcf0 movem.l d0-d5/a0-a3,-(a4) $0007941e : 48e4 fcf0 movem.l d0-d5/a0-a3,-(a4) $00079422 : 51cf ffee dbra d7,$79412
I've had a go this morning at optimising this using the Blitter. Thankfully, this is colour 15, so I just need to draw a solid sequence of $ffff word values to the screen buffer - there's no added complexity resulting from needing to write different values for different words.
This is game code, so there are various interrupts going on in the background that need to happen. We therefore have no choice but to use Hog mode and split the blits into small chunks - we can't have the Blitter tying up the bus for long periods by (for example) drawing all lines in one go. Shared mode isn't going to work because the time slices are not sufficiently granular and interrupts will get blocked.
My understanding is that the best-case scenario for the Blitter is 1 nop per word written. So given that we're writing 80 words per line, that's 80 nops, which, at 4 cycles per nop, equates to 320 cycles (versus 352 cycles for the movem). However, we also have to start the Blitter for each line, which as a bare minimum, might look like this:
Code: Select all
move.w d1,(a1) ; ycount (8a38) move.b d2,(a0) ; blitter control (8a3c)
So in conclusion, I know that the Blitter will outperform movem in theoretical terms, even for drawing solid blocks of colour. But when taking into account the constraints put in place by game code, is it fair to say that things aren't so clear cut, and that sometimes the Blitter will be ahead and sometimes movem will be ahead? For simplicity, I've omitted the initial setup code for both movem and Blitter from this discussion, but they appear roughly equivalent in terms of size and timing.
I've gained a lot from using the Blitter in Lotus STE, but in this particular scenario it doesn't feel like the right thing to do.
Thoughts and corrections from the audience would be much appreciated!