[net.micro.cbm] more on c64 joysticks

miller@uiucdcs.UUCP (miller ) (02/14/84)

#N:uiucdcs:36100041:000:1778
uiucdcs!miller    Feb 13 23:53:00 1984

     Since there was a question by Lew over what I meant when I said joystick
port 1 in the west direction, fire button not pressed "slows the machine down",
I thought I'd write two programs to demonstrate what I was talking about.  The
first one reports on the position of the joystick in columns 1 & 2 (and a * in
3 if the fire button is pressed).

10FORI=0TO10:READD$(I):NEXT
20DATAC,N,S,,W,NW,SW,,E,NE,SE
30INPUT"PORT 1 OR 2";PO
40IFPO=1THENPO=56321
50IFPO=2THENPO=56320
60J=PEEK(PO)
70IF(JAND16)=0THEN?"  *xxx";  replace the 3 x's by back cursors <=
80?D$(15-(JAND15))
90GOTO60

     (Get line 70 right - two blanks, *, 3 <= and don't forget the trailing ;)
     The next program is in assembly lang.  I'm too lazy to translate the whole
program above, so I simply had it print a whole slew of A's.  But you can no-
tice the same affect.  The program runs fast anytime *except* when the joystick
is in that one configuration.  Then, it really does "slow down".

START LDA# 65
      JSR  65490  chrout routine
      JMP  START

     You'll notice it pauses in between lines at about the same speed as the
Basic LIST with the CTRL key down.  As I stated in my previous note, I really
don't know how the CTRL key is programmed to work; I haven't spent the time to
find out.  I made a guess before, but that's all it was.
     As to why Lew's FROGGER goes fast, I can only hazard another guess.  I've
noticed that FROGGER won't return control when my reset button (which I added)
is pressed.  This forces a cold start.  FROGGER *must* flip out the c64 kernal
ROM in order to prevent that.  Hence, the CTRL software goes with it.  (BTW,
FROGGER is the only program I've seen so far that imploys that trick.  Usually,
my reset button gets them all.)

A. Ray Miller
Univ Illinois

robertm@dartvax.UUCP (Robert P. Munafo) (02/22/84)

----------------------------------------------------------------
    
The control keys slows down output on the Commodore 64 because
the Kernal screen output routine checks for the control key every
time it calls the Scroll Up routine.  Programs can disable this
"feature" by using a different screen output routine - one which
does not delay on screen scrolling when control is held down.
  
   Robert P. Munafo   ...!{decvax,linus}!dartvax!robertm