Hello all,
As promised, here is the beginning of the kernel for my RS Hockey game. Right now it's not doing much - just dispalying the rink (with full vertical scrolling), clock, period and score. Next step is to display the puck.
LDA PFData2,X ; [55] + 4 STA PF2 ; [59] + 3 all set for next section LDA PFData1,X ; [62] + 4 STA PF1 ; [66] + 3 ScanLoop LDA IceColor,X ; [69] + 4 STA COLUBK ; [73] + 3 end of line 4 ; ----------------------------------------------------------------------------------- ; START OF LINE 1 CPY BallY ; [0] + 3 BEQ EnableBall ; [3] + 2/3 LDA #00 ; [5] + 2 JMP DrawBall ; [7] + 3 EnableBall LDA #02 ; [6] + 2 NOP ; [8] + 2 DrawBall STA ENABL ; [10] + 3 DEY ; 2 STA WSYNC ; [13] + 3 end of line 1 ; ----------------------------------------------------------------------------------- ; START OF LINE 2 DEY ; 2 STA WSYNC ; end of line 2 ; ----------------------------------------------------------------------------------- ; START OF LINE 3 DEY ; 2 STA WSYNC ; end of line 3 ; ----------------------------------------------------------------------------------- ; START OF LINE 4 SLEEP 46 ; [0] + 46 INX ; [46] + 2 DEY ; [48] + 2 decrement the scanline we're on BEQ DoneLoop ; [50] + 2 LDA PFData2,X ; [52] + 4 STA PF2 ; [56] + 3 all set for next section LDA PFData1,X ; [59] + 4 STA PF1 ; [63] + 3 JMP ScanLoop ; [66] + 3
I'm using Y to count the relative scanline (0-159) and X as an index into the data for PF1, PF2 and COLUBK. I've divided the playing area (160 pixels) into 40 loops of 4 scanlines and I'm updating PF1, PF2 and the COLUBK at the end of the 4th scanline for the *next* group of 4 scanlines. This is leaving me with 74 cycles for 3 scanlines (since I DEY on each line, assuming I get rid of the WSYNC) and 46 for the 4th line (taken up by a SLEEP right now).
I quickly put together some code to display the puck (ball) at the beginning of scanline 1 (it takes up 13 cycles). Of course, this will only display the puck when it's on scanline 0, 4, 8, etc. and keep it displayed for 4 lines (which isn't the desired result). I'm not sure how to proceed here - do I duplicate the ball-display code for each scan line? Is this the most efficient way to enable/disable the ball? Any suggestions would be very much appreciated.
I hope this post isn't out of line for the Newbies forum - I've only been doing this stuff for a few months and consider myself a newbie, especially if I have questions about displaying the ball!!
Thanks again for any help!!













