[Coco] real-time mouse cursor

Darren A. darccml at hotmail.com
Sun Jan 27 03:30:52 EST 2008


>> 
>> I mostly use the following VSYNC subroutine in all of my screen updating 
>> stuff.
>> 
>> VSYNC   TST     $FF02
>> a@      TST     $FF03
>>         BPL     a@
>>         RTS
>> 
> 
> That's the way to use the PIA interrupt but as time is crucial, I'd 
> suggest in-line code rather than a subroutine. That will remove the 
> cycles needed to BSR or JSR and RTS.
> 
--

When possible, I would also recommend avoiding the TST instruction in time-critical code. If either A or B do not need to be preserved, its faster to use an LD:

        LDA     $FF02
a@     LDA    $FF03
        BPL     a@

And if X or U don't need to be preserved, you can save one more cycle within the loop at the expense of a one-time penalty of 3 cycles on entry:

        LDU    #$FF03
        LDA     -1,U
a@     LDA    ,U
        BPL     a@


Darren


_________________________________________________________________
Shed those extra pounds with MSN and The Biggest Loser!
http://biggestloser.msn.com/


More information about the Coco mailing list