Subject: skipdraw from Eric Ball WAS: [stella] Finally underway: 2600 Cookbook From: KirkIsrael@xxxxxxxxxxxxx Date: 13 Apr 2004 12:50:49 -0000 |
Eric Ball wrote me the following: > For the cookbook, here is the famous skipDraw routine: > > ; draw player sprite 0: > lda #P0HEIGHT-1 ; 2 > dcp P0_Y ; 5 (DEC and CMP) > bcs .doDraw0 ; 2/3 > lda #0 ; 2 > .byte $2c ;-1 (BIT ABS to skip next 2 bytes) > .doDraw0: > lda (P0_Ptr),y ; 5 > sta GRP0 ; 3 = 18 cycles (constant) > > P0_Y is initialized to the vertical position (0 = top) plus the height of > the sprite minus 1 (P0HEIGHT-1). So when your sprite is 6 pixels tall and > starts at line 45, then initialize P0_Y with 50 (45+6-1). With each line, > P0_Y will be decreased. > > The result of the compare will be: > P0_Y = 50..6: 5 (P0HEIGHT-1) is smaller than P0_Y -> carry = 0 -> skipDraw > P0_Y = 5..0: 5 is bigger than/equal to P0_Y -> carry = 1 -> doDraw > P0_Y = 255..: 5 is smaller than P0_Y -> carry = 0 -> skipDraw I tried to put it in action at http://alienbill.com/2600/cookbook/skipdraw.txt The trouble is, he doesn't specify what Y, used in "lda (P0_Ptr),y", in there--it looks like there should be "sty P0_Y" somewhere, since judging by the results it only displays the correct graphic when Y < POHEIGHT, though of course that would throw of the even count. (in my code, I'm using Y as a dey/bne'ing countdown.) Is Eric Ball on the right track, what would this need to be to be a successful skipdraw? In case people were wondering, I'm trying to make one miniprogram (still easy to understand) that covers a few topics: -subpixel movement -skipDraw -joystick reading/firebutton reading -exact horizontal positioning -indirect referencing for changing player graphics then for each of those topics in 2600 Cookbook, the example will be that miniprogram with the relevant section in red. I think it should be a good learning tool. -- KirkIsrael@xxxxxxxxxxxxx http://kisrael.com "Sometimes your shallowness is so thorough, it's almost like depth."--Daria ---------------------------------------------------------------------------------------------- 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 -> |
---|---|---|
Re: [stella] How RRampage works, Erik Mooney | Thread | RE: skipdraw from Eric Ball WAS: [s, Dennis Debro |
Re: [stella] My New Project - RRamp, KirkIsrael | Date | RE: [stella] Re: About your tutoria, Christian Bogey |
Month |