[stella] Reading joystick buttons & VBLANK -- a lesson for a newbie

Subject: [stella] Reading joystick buttons & VBLANK -- a lesson for a newbie
From: Ruffin Bailey <rufbo1@xxxxxxxxxxx>
Date: Wed, 03 Jul 2002 18:34:43 -0400
Sorta a "warning for other newbies/any other little tricks I'm missing?"
post.  

Was trying to figure out how to read the joystick buttons.  Luckily ran
across one of Erik Mooney's posts from 1997
(http://biglist.com/lists/stella/archives/199703/msg00328.html) that said
VBLANK needs to have a 1 in D6 if you want to be able to read the joystick
buttons.  I went back and found that bit in the Stella manual ("When all
else fails, read the directions.")...

     ;This address controls vertical blank and the latches and
     ;dumping transistors on the input ports by writing into bits
     ;D7, D6 and D1 of the VBLANK register.

     ;D1 [ 1 = start vert. blank, 0 = stop vert. blank]
     ;D6 [ 1 = Enable I4 I5 latches, 0 = disable I4 I5 latches]
     ;D7 [ 1 = dump I6I1I2I3 ports to ground, 0 = remove dump
     ;path to ground]

Nick's HtDaP has a bit of code like this before hitting the line draw
kernel:

LF07D: LDA    INTIM   ;4  Here's the screen draw routine.
       BNE    LF07D   ;2

       STA    WSYNC   ;3
       STA    VBLANK  ;3

In this code we're going to be sticking #%00000000 into WSYNC & VBLANK --
which wipes out your ability to read the joystick buttons.  I changed it to
the following, using a 1 in D6 and 0's everywhere else (like what would
happen by default in HtDaP):
     
LF07D: LDA    INTIM   ;4  Here's the screen draw routine.
       BNE    LF07D   ;2
    lda #%01000000
       STA    WSYNC   ;3
       STA    VBLANK  ;3

Am I messing anything up there?  What are these other ports good for (the
whole "dump bit" thing)?  Why would I want to ground these latches?

Anyhow, lesson learned -- if you want to read the joystick, HtDaP needs a
little line change.

Ruffin Bailey

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread