[Coco] real-time mouse cursor
Roger Taylor
operator at coco3.com
Sun Jan 27 12:44:13 EST 2008
At 08:56 AM 1/27/2008, you wrote:
>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.
I disagree. You're not picturing the sprites and masks in your
figuring. ;) It doesn't work on abitrary numbers. I am in NO WAY
saying that an OR operation is the same as an ADD operation. I'm
saying that you can SIMULATE the sprite OR operation by using ADD, if
your sprites and mask data are set right, which they should ALREADY
be set to based on how sprites work. I'm talking about simple
2-element CoCo sprites, here, btw. The mask data and the overlay data.
$1234 <- screen data
$F00F <- mask
$1004 <- new screen data
$0CC0 <- sprite data
$1CC4 <- after an ADDD # of $1004 and $0CC0
$1CC4 <- after an ORA # /ORB #
I'm sure ages of CoCo games could be sped up greatly if they used
ADDD, but I'm not sure some games don't already do this.
And while you guys keep scratching the ole noggins, I'm watching 64
jewel-shaped sprites bounce around the screen with nice 1-pixel
borders around them, and working flawlessly.
More information about the Coco
mailing list