marc.hull Posted May 11, 2011 Share Posted May 11, 2011 I understand that the onscreen sprite rows start @>FF and then are ordered 0 to 190. Is it correct that when a sprite moves off the top of the screen it goes to location >FE then >FD etc until it appears at the bottom again at 190 ? Quote Link to comment Share on other sites More sharing options...
matthew180 Posted May 11, 2011 Share Posted May 11, 2011 A sprite Y coordinate is "partially signed". Any Y value over >E0 (224) (i.e. >E1 to >FF, or 225 to 255 unsigned, or -31 (225) to -1(255)) is considered signed. This is to allow the sprites to "slide in" from the top of the screen. So, when the Y value goes over >E0, the sprite starts to appear at the top depending on how big the sprite is. If the sprite is 16x16 magnified, then at 225 you will see the bottom pixel row of the sprite (note that this is "1 pixel", and NOT "1 magnified pixel" which is really 2x2 pixels.) Also note that the reason you have to use a Y of 255 to get a sprite on the top row is because the VDP processes sprites one line *before* where they are actually displayed. That's why a Y value of 0 is shown on row 1, etc. Quote Link to comment Share on other sites More sharing options...
marc.hull Posted May 11, 2011 Author Share Posted May 11, 2011 A sprite Y coordinate is "partially signed". Any Y value over >E0 (224) (i.e. >E1 to >FF, or 225 to 255 unsigned, or -31 (225) to -1(255)) is considered signed. This is to allow the sprites to "slide in" from the top of the screen. So, when the Y value goes over >E0, the sprite starts to appear at the top depending on how big the sprite is. If the sprite is 16x16 magnified, then at 225 you will see the bottom pixel row of the sprite (note that this is "1 pixel", and NOT "1 magnified pixel" which is really 2x2 pixels.) Also note that the reason you have to use a Y of 255 to get a sprite on the top row is because the VDP processes sprites one line *before* where they are actually displayed. That's why a Y value of 0 is shown on row 1, etc. Ok that's over my head could you dumb it down a shade ? For example if I write 254 to the Y location will that place the sprite 1 pixel above the screen while 253 would be 2 pixels above the screen ? Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted May 11, 2011 Share Posted May 11, 2011 I understand that the onscreen sprite rows start @>FF and then are ordered 0 to 190. Is it correct that when a sprite moves off the top of the screen it goes to location >FE then >FD etc until it appears at the bottom again at 190 ? Yes. If you move the sprites manually, then avoid a y-coordinate of >d0, which is the end of sprite list indicator (hardware). Quote Link to comment Share on other sites More sharing options...
matthew180 Posted May 11, 2011 Share Posted May 11, 2011 Ok that's over my head could you dumb it down a shade ? For example if I write 254 to the Y location will that place the sprite 1 pixel above the screen while 253 would be 2 pixels above the screen ? Yes, until you get to 224, which is the "wrap around" point to the bottom of the screen (but still in the invisible area.) Basically it goes like this: Sprites below are 32x32 (magnification is on, pixels are "fat") Y --- 225 xx...xx 226 xx xx xx...xx . . . xx xx . .Y@225. . . . . . .Y@226. 253| xx xx . . 254| xx...xx xx...xx ---+-------------------------------------------- 255| xx...xx xx...xx 0| xx xx xx...xx . | . . xx xx . | Active screen area .Y@255. . . . | . . . Y@0 . 29| xx xx . . 30| xx...xx xx xx 31| xx...xx . | . | . | 191| ---+--------- 192| . | Bottom border area . . 208 <-- disables any sprites after this one 209 . . . 224 Quote Link to comment Share on other sites More sharing options...
Tursi Posted May 13, 2011 Share Posted May 13, 2011 An easy way to think of it might be to just assume that the height is still 256 pixels, and sprites wrap around, with row 255 as the first line of the screen. Anything on row 191 or lower is not visible since it's off the bottom. Sometimes it's easier just to remember the facts than to understand why they are that way. (Actually, maybe that's not easier, but I'll leave it up anyway, just in case. ) Quote Link to comment Share on other sites More sharing options...
marc.hull Posted May 15, 2011 Author Share Posted May 15, 2011 An easy way to think of it might be to just assume that the height is still 256 pixels, and sprites wrap around, with row 255 as the first line of the screen. Anything on row 191 or lower is not visible since it's off the bottom. Sometimes it's easier just to remember the facts than to understand why they are that way. (Actually, maybe that's not easier, but I'll leave it up anyway, just in case. ) I finally figured out my issue. I was working on the sprite/background checking routine and had a problem when the sprite went above the screen. Turns out I needed to mirror the first line of graphics at the end of my screen table. Done and everything works as advertised. I'll post the code as well as a demo for a new game I am working on using this method tomorrow. It's 10:00 PM. here and well past my bed time . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.