[Coco] real-time mouse cursor

Robert Gault robert.gault at worldnet.att.net
Sun Jan 27 09:56:42 EST 2008


Roger Taylor wrote:

> At 09:54 PM 1/26/2008, you wrote:
> 
>> Or better yet, replace the TST $FF03, BPL a@ with a SYNC instruction.
>> (Of course, time isn't really crucial if you're spending the bulk of 
>> it doing
>> nothing while waiting for the next interrupt.)
> 
> 
> 
> Doesn't this SYNC to any interrupt, though?
> 
> Btw, it just dawned on me after all the years... why do sprite calcs 
> like this:
> 
> LDD     ,X      screen data
> ANDA    ,U      mask data
> ANDB    1,U
> ORA     128,U   sprite data
> ORB     129,U
> STD     ,X
> 
> when this is the same:
> 
> LDD     ,X      screen data
> ANDA    ,U      mask data
> ANDB    1,U
> ADDD    128,U   sprite data
> STD     ,X
> 
> No reg.a/b OR'ing is needed. You can do a 16-bit simulated OR with the 
> ADDD instruction.
> And the speed increase is very noticeable over 64 sprites!  Actually, 65 
> now... for the mouse cursor.
> 
> I'm using direct offsets into the sprite and screen data instead of auto 
> incs ( ,r++) because an entire sprite is plotted with precalced byte 
> offsets like the above.  Spaghetti and meatballs, anybody?
> 
> With the 6309, "ANDD" is even possible for the masking.
> 
> LDD     ,X      screen data
> ANDD    ,U      mask data
> ADDD    128,U   sprite data
> STD     ,X
> 

It might work for you but I can see one cause for failure trying to 
replace ORA ORB with ADDD.

Let's take and example.
start ldd #$1234
       ora T1
       orb T2
       swi
T1    fcb $BB
T2    fcb $FF

regD will = $BBFF

start ldd #$1234
       addd T1
       swi
T1    fcb $BB
T2    fcb $FF

regD will = $CE33

I think you will find you can only use ADDD if your mask is $0000. OR 
may look like addition but it is not equivalent.



More information about the Coco mailing list