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

Re: Apple II Graphics Programming (Assembly)



Calibrator <calibrator@freenet.de> wrote:
> This makes sense as
> - 240 bytes of each page x 32 pages = 7680 bytes
> and
> - 40 bytes per hires-line x 192 lines = 7680 bytes!

Yes, I thought to do a similar check after my post, namely:
40 x 192 = 7680 for the graphics
64 x 8 = 512 for the holes
Total = 8192: check!

> You'd need a branch over a "JMP a" combo at the end as the
> unrolled loop would be larger than the branch range...
> (64 STA instructions with 3 bytes each = 192 bytes)

Good point. I did say the method was thoughtless :-)

>> Or you can do something like what Calibrator said but skip
>> over the middle hole along the way:
> 
> Which results in a total of 41040 cycles.
> 
> Paul's "standard unrolled version" uses a total of 42239 cycles,
> though, as the loop runs 256 times.
> 
> With my $F8 check (which still fills about half the holes) it
> would need about 40919 cycles...

I wasn't approaching this from the angle of skipping holes to improve
speed, but as a way of doing a fast clear while preserving the screen
holes in case they were being used. Just a silly exercise really.
So I'm not too surprised that this method turns out slower.

>> Or involve the X register and run the same loop twice with different
>> index values but the same exit condition:
> 
> The a-loop runs 240 times = 38400+1679 = 40079
> Special case #1 (Y=$7F) = +5 cycles (once)
> Special case #2 (Y=$FF after DEY) = +11 cycles (once)
> = total 40095 cycles (I hope...)
> 
> About 2000 cycles faster than Paul's routine (5%) - not very
> eye-friendly but perhaps the best trade-off, isn't it?

Ah, so this is actually quicker! I've never tried it so I have no idea
how it performs visually.

Thanks for doing the cycle counts!

Mark