Subject: [stella] Help Interpreting Code From: "Roagie" <roagie@xxxxxxx> Date: Sat, 13 Jul 2002 11:35:18 -0700 |
Hi all. I'm making good progress in my newbie-ism. I'm also compiling a newbie FAQ as I go, so it's nice and authentic :) Here's my latest question... a fellow did a rewrite of a bunch of demos and slapped into one BIN. It's called alpha.asm. I was interested in Crackers bat with moving sprite demo so I stripped it out of the alpha demo. At this point I am examining code and tracing each step to see how it works, but I can not figure out what is going on here: (all comments are my own, please correct if wrong) note: vertPos = current vertPos of sprite GRP0SIZE = height of sprite begin code snippet: ------------------------------------------------------------ LoadGrfx STA WSYNC DEY ; Y = Y - 1 CPY vertPos ; compare vertPos and Y, returns 1 if they are the same BNE sprite1 ; if Y = vertPos, then branch LDA #27 ; set sprite height STA GRP0SIZE ; sprite is 27 scanlines high sprite1 LDX GRP0SIZE ; load X with current line of sprite being drawn BMI grfx2 ; branch on minus (N = 1). See if finished drawing sprite, does X = -1? LDA p0data,X ; if X <> -1 then store sprite data STA GRP0 ; store data to TIA P0 graphics reg. DEC GRP0SIZE ; GRP0SIZE = GRP0SIZE - 1 grfx2 TYA BEQ OverScan ; check to see if Y = 0, if so frame is done BNE LoadGrfx ; if not, load next scanline data --------------------------------------------------------------- As I read it, if the current scanline equals the sprite's vertPos, then it bypasses reseting the sprite height to 27. But let's say that we haven't hit that point and that the next 10 scanlines do not contain the sprite. So it keeps loading GRP0SIZE = 27. And it keeps storing the player data 'LDA p0data,X' where X = 27 every scanline. So WHY isn't there a large vertical bar of the sprite's 27th byte down the scanlines? The player graphic data for that offset is $ff. My Understanding of the Routine: (something should be wrong in here) - The routine drops down into sprite1, so X is always loaded with the GRP0SIZE, which is always 27 if the vertPos is not the same as the current scanline. - The storing of the player data is bypassed if X = -1 (AKA bit 7 = 1), but as far as I can tell, X = 27 = #%00011011. bit 7 is not a 1. So this command should be executed each time, but for some reason isn't. - I see how the sprite is disabled, because his P0data,0 is $00, which disables him in his last scanline of being drawn. So I know that X can not be set back to 27 unless Y = vertPos, but I don't understand how. :( Another thing that funks me out is that Y = vertPos for only one line! So it shouldn't be drawing the sprite after the first scanline! Help!!! ---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[stella] supercharger good; busted , KirkIsrael | Thread | Re: [stella] Help Interpreting Code, Roagie |
Re: [stella] Megacart, video captur, John Saeger | Date | Re: [stella] supercharger good; bus, Eckhard Stolberg |
Month |