Re: A89: Re: Re: Survey for the next version of PlusShell


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

Re: A89: Re: Re: Survey for the next version of PlusShell



 
>
>At 04:28 1998-11-19 -0500, you wrote:
>>Let me revise that: there are actually three cases, the third being that
>>_both_ coordinates are of negative values.  In some clipping routines,
this
>>must be treated as a unique case.
>
>Then the clipping routine was bad...

hehe, it constitutes everything I've ever written in 68k :-)  you can look at it if you want (the 8x8 version):
http://www.eden.rutgers.edu/~assets/acz/sprite8.asm


>
>>(Really; before I implemented that case
>>in the 89 clipping routine I wrote, it actually crashed the calc when you
>>tried to move the sprite off both the top and the left edges of the screen
>>simultaneously) This is very nice because on all other TI calcs there are
>>eight cases you must implement! (or at least test)
>
>No, only 4 cases. In ASCR (sprite clipping for the 86), it's only
>four cases. For left & right, I create a mask. If x=-2, the
>mask would be %00111111 (8 bit sprites on the 86), if x=MAX_X-3,
>mask = %11111000. For top & bottom, just start on a different row,
>and change number of rows to put.

I understand that you can use a complicated labeling system and masks to avoid repeating code -- as you did in ascr and as I didn't do -- but there are still eight cases you need to _test_.  For example, once you know that you must clip the top, you must also test right and left (only left on the 89); neglecting to do so won't automaticly mean that the code will work when it must clip multiple directions (ie, clipping in four directions isn't enough by itself).  So, there really are eight cases (three on the 89) that your code must account for ... still you're right in that you don't necessarily have to treat them as "unique".
 
There is a small speed advantage in how I did it.  My routine still probably sucks though, because I have no idea of how to optimize 68k :-P