Jump to content
  • entries
    62
  • comments
    464
  • views
    85,014

Read paddles in your spare time

Sign in to follow this  
Guest

293 views

Some gamers love paddles. And for some games, they can be the best form of control.Many 2600 programmers hate paddles. They're a pain in the tush to read, since the programmer has to observe, with about a scan line's precision, when the paddle input changes shape.Fortunately, it's possible to ease the requirements for reading paddles considerably if one uses a little trick: although many games reset the paddle timing circuit at the start or end of VSYNC or VBLANK, there is no requirement that the paddle reset occur at a fixed spot each frame. If a game has a certain area of the screen during which it can afford to read the paddles on every scan line, it may be possible to time the paddle reset to ensure that the paddles timeout within that region.For example, suppose a game has a loop that runs once every eight scan lines. It may be possible to code something like:

  cpx paddlecoarse ; Assuming X is a down-counter  lda #0  ; Not needed if accumulator bit 3 is guaranteed zero  ror  sta VBLANK

Eight or ten cycles. Comparable to the nine cycles required for a 'conventional' paddle-reading approach, but with a difference: the above code doesn't need to be run every scan line, but only every eighth.Later in the frame, it will be necessary to read the paddles every scan line, but if there are 32 consecutive scan lines where the paddles can be read, that will suffice. Take a reading to see when the paddle times out within that range (if it does). Add that reading to 8 times paddlecoarse and use that as the current paddle position. Then, if the last reading was within 10 of the end, increase paddlecoarse (so it should happen sooner next frame); if within 10 of the beginning, decrease paddlecoarse.The net effect will be that game can allow the user to move the paddle over a wide range with single-scan-line accuracy, but paddle overhead will be much lower than with conventional approaches.

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...