Re: [stella] Reading Paddles?

Subject: Re: [stella] Reading Paddles?
From: Paul Slocum <paul-stella@xxxxxxxxxxxxxx>
Date: Fri, 10 Jan 2003 22:01:06 -0600

I searched the Dig and Archives, and the only examples I could find didn't really explain how to do it. Before I just copy and paste code, I'd like to know what's really going on in the hardware :-)

Erik covered it pretty well. It is possible to display a decent amount of stuff while reading the paddles, but it's tough. Which game are you talking about using them in? You might consider keyboard controllers or driving controllers which don't require anything extra in the kernal.

In order to read paddles in Marble Craze I ended up making an incredibly complex kernal that wasted a *ton* of ROM space. It has dual alternating frame kernals that only loop every 13 lines and each sprite image uses two pages. The dual kernals and sprite data alone use an entire 4k bank! I don't read the paddles with terribly high resolution either (twice every 13 lines I think), and I only read 2 paddles each frame. But I did manage to display an asymmetric playfield, two smooth moving player graphics, a missile, and shade the left and right side of the screen independently.

I used Y as my line counter and this code to check the paddles:

        lda INPT0               ;3
        bmi paddles1            ;2 or 3
        sty padVal1             ;3

The problem here is that you end up with a different number of cycles used depending on what INPT0 gives you. I used WSYNC to even things up every few lines, but there's another trick that will even it up without WSYNC:

        lda INPT0               ;3
        bmi paddles1            ;2 or 3
        bpl noPaddles           ;2 or 3
        sty padVal1             ;3

; somewhere outside of kernal loop
        bpl paddles1            ;3

Hope I got all the cycle counts right. I couldn't use this trick because my kernal loops were so huge that the "bpl noPaddles" would be a "branch out of range" in some places.


Archives (includes files) at
Unsub & more at

Current Thread