Jump to content
IGNORED

How to read VCS Keypad/Kid's Controller/Video touch pad?


Philsan

Recommended Posts

I want to read VCS Keypad/Kid's Controller/Video touch pad (they are identical) in Turbo Basic XL.

Here I have found this Compute's listing (also attached) but it only works in Atari Basic:

1 GRAPHICS 0
10 DIM ROW(3),I$(13),BUTTON$(1)
30 GOSUB 6000
60 POSITION 2,7:PRINT "CONTROLLER # 1:";
80 GOSUB 7000:POSITION 19,7:PRINT BUTTON$;
120 GOTO 80
6000 REM
6010 POKE 54018,48:POKE 54016,255:POKE 54018,52:POKE 54016,221
6030 ROW(0)=238:ROW(1)=221:ROW(2)=187:ROW(3)=119
6040 I$=" 123456789*0#"
6050 RETURN
7000 PORT=54016
7010 P=1:PAD=0
7020 FOR J=0 TO 3
7030 POKE PORT, ROW(J)
7040 FOR I=1 TO 10:NEXT I
7050 IF PADDLE(PAD+1)>10 THEN P=J+J+J+2:GOTO 7090
7060 IF PADDLE(PAD)>10 THEN P=J+J+J+3:GOTO 7090
7070 IF STRIG(0)=0 THEN P=J+J+J+4:GOTO 7090
7080 NEXT J
7090 BUTTON$=I$(P,P)
7100 RETURN

Can someone help me?

I am programming a game for kids and I would like to use the Kid's controller with Cookie Monster Munch overlay (big direction buttons!).

KIDSCONT.zip

Edited by Philsan
Link to comment
Share on other sites

It's been a while since I looked at the keypads, but you essentially have to strobe the joystick pins, then monitor the trigger and paddle lines. I'd suggest some sort of of interrupt routine to do the monitoring; unless the game can sit and wait for input, you'll miss too many button presses if you aren't constantly scanning.

Link to comment
Share on other sites

I want to read VCS Keypad/Kid's Controller/Video touch pad (they are identical) in Turbo Basic XL.

I have found this complicated listing (also attached) but it only works in Atari Basic:

 

Most likely it's not working in Turbo BASIC because of timing problems (Turbo being faster than Atari BASIC). Try increasing the delay in line 7040 from 10 to 30 or so...

 

David_P is right though: it'd be better to write a VBI routine to handle the keypads, for anything like an interactive game.

Link to comment
Share on other sites

Urchlay, I too think the problem is in timing so I will try to change the delay in line 7040.

 

David_P, I am programming a simple game for children (3 years), they are very slow in pushing buttons, so I don't need a faster routine (anyway I am not able to program in ML!).

 

 

EDIT

Urchlay, changing the 10 in 50 in line 7040 the routine works perfectly in Turbo-Basic XL.

Thank you!

Edited by Philsan
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   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...