Subject: Re: [stella] MultiSpriteDemo update (source+binary)|
From: emooney@xxxxxxxxxxxxxxxx (Erik Mooney)
Date: Mon, 07 Apr 1997 12:04:37 GMT
>>It's tricky, but I think I've figured it out. > >(...) >Thanks... do you think it is faster or slower than the more common, >SBC-based routine? I'm pretty sure it is faster. The new routine uses between 59 and 73 cycles plus the JSR and RTS. If the check for out-of-range values is removed and the routine is made a macro, it will fit into one scanline if needed. The SBC routine uses at least 7 cycles per iteration (INX, SBC #15, BPL), which can take at least 70 cycles, and the initialization and cleanup (shifting the fine coordinate to the upper 4 bits and putting everything together into one register) would be about 30, I think, for a range of 30 to 100. The average is about the same, but I like the new one because it's more consistent. >>Obviously, the whole thing would be 12 cycles faster as a macro instead of >>as a subroutine if you can spare the space and only use it a few times. > >Not really needed if it's called during VBLANK, when there are cycles to lose... True, but it can be used during screen-display if needed... maybe you're short on RAM and can only store the standard X coordinate of objects instead of both the standard X and FC_X. (with a lot of objects, this could be important) and combining messages: >hmmm... you'll have to experiment on the real 2600, as things might be >different on emulators. >I wonder why are you asking this :) ...maybe you want to use all the >available cycles during a scanline, without even doing the STA WSYNC? I had a routine that needed to rewrite both GRP registers each line while updating all three PF registers twice per scanline (non-repeating, non-reflected playfield) and checking the ball's Y coordinate and writing to ENABL if necessary (all this is possible - see Millipede), and I needed to know exactly how many instructions I could do before needing to STA WSYNC. It turns out that you must STA WSYNC no later than cycle 71 to catch the end of the current line on a real 2600, while PC Atari allows a STA WSYNC as late as cycle 74. -- Archives available at http://www.biglist.com/lists/stella/archives/ E-mail UNSUBSCRIBE in the body to stella-request@xxxxxxxxxxx to be removed.