Nico Posted May 30, 2012 Share Posted May 30, 2012 Hi, I would like to add the score at the top of the screen just like Combat or Video Olimpics does. I guess I should use PF1 to acomplish this right? but I cant seem to get the kernel to work. This is what I have so far: LDY #SCORE_HEIGHT .scoreloop STA WSYNC LDX #AMBAR+5 TYA SEC SBC #SCORE_HEIGHT-10 CMP #20 BCC .drawnumber LDX #WHITE .drawnumber STX COLUBK DEY BNE .scoreloop LDA #GREEN STA COLUBK ; Playfield Backfround color LDY #SCREEN_LINES-SCORE_HEIGHT .screenloop STA WSYNC ; Ball vertical position LDX #%00000010 ; Set ball enable bit TYA ; Move line number to A SEC ; Set carry before subtracting SBC BallVPos ; Subtract ball start line CMP #BALL_HEIGHT ; Test if line is in [0, BALL_HEIGHT-1] BCC .enableball ; yes -> enable ball LDX #%00000000 ; no -> clear ball enable bit .enableball STX ENABL ; Player 0 vertical position LDX #PLAYER_GFX TYA SEC SBC P0VPos CMP #PLAYER_HEIGHT BCC .enableP0 LDX #0 .enableP0 STX GRP0 ; Player 1 vertical position LDX #PLAYER_GFX TYA SEC SBC P1VPos CMP #PLAYER_HEIGHT BCC .enableP1 LDX #0 .enableP1 STX GRP1 DEY BNE .screenloop Basicly its two loops, one for the score and the other one to draw the paddles and the ball, is this the correct way of doing it? Quote Link to comment Share on other sites More sharing options...
+SvOlli Posted May 30, 2012 Share Posted May 30, 2012 Hi, I would like to add the score at the top of the screen just like Combat or Video Olimpics does. I guess I should use PF1 to acomplish this right? but I cant seem to get the kernel to work. This is what I have so far: [...] Basicly its two loops, one for the score and the other one to draw the paddles and the ball, is this the correct way of doing it? I can't be of a complete help, since I've only done demos so far, but I can help you with showing the score. Drawing the playfield asymmetrically, what you need for displaying scores, is a bit tricky. This is your first step into the depth of the TIA, since you now also need horizontal timing additionally to your vertical timing. The playfield data is displayed as 40 bits, but there are only 20 bits of registers. After displaying the first 20 bits, a bit in CTRLPF tells the TIA if the bit should be displayed again or in reverse order. You want to got with the first option, wait after PF1 gets drawn for the left half, then change the data to the values for the right half. At the beginning of the next line, you'll fill PF1 again with the data for the left half and so on... CTRLPF also has a bit that toggles the color of the playfield from COLUPF to COLUP0 (left halt) and COLUP1 (right half), intended for drawing scores as used in Combat and many others. Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted May 30, 2012 Share Posted May 30, 2012 Have you gone through the sub forum 2600 Programming For Newbies? yet? If not, I suggest you use the second pinned entry in that forum to follow the lessons in order. Lesson 18 has a nice timing diagram that shows when you need to update the play field registers to display different things(like scores!) on both sides of the screen. I printed out a copy and reference it all the time when I'm working on my projects. Quote Link to comment Share on other sites More sharing options...
Nico Posted May 31, 2012 Author Share Posted May 31, 2012 ok, I'm going to do some reading to see how I can do this... thanks! 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.