Jaguar joypad STOS source ..enjoy.. ;)

STOS-related stuff in here please

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

EstTeeEfEm
Captain Atari
Captain Atari
Posts: 299
Joined: Mon May 04, 2015 9:02 pm

Jaguar joypad STOS source ..enjoy.. ;)

Postby EstTeeEfEm » Thu Jan 07, 2016 10:19 am

STOS JagPad programming source code including the ability for multiple buttons and uses the Jaguar pad on the STE

My apologies for the LOOONG code but I didnt want to get bogged down in loops and dims .. i wanted this to be as simple as possible for people so there ;) It is quite fast enough even interpreted but its far better compiled...

Try pressing A and B and C all together ;)

It took a LOT of work to work via trial and error to get everything out here and I know some of the code is backwards..
I tried to comment as much as i could dare to lol

I shall refer people to this document
http://www.gamesx.com/controldata/ejp_faq.htm

when asking questions on the 2nd pad and paddles, but they are all possible in STOS using this code as a basis

Just save the code as JAGCODE.ASC and import...


Code: Select all

10 key off : curs off : hide : mode 0
20 palette $0,$700,$70
30 dim JAGPAD(21)
40 dim GRP(4,2) : for Y=1 to 2 : for X=1 to 4 : GRP(X,Y)=0 : next X : next Y
50 logic=back
60 rem *********************************************
70 rem *********************************************
80 for X=1 to 21 : JAGPAD(X)=1 : next X
90 pen 1 : locate 0,0 : print "JAGPAD PORT A"
95 locate 0,4 : pen JAGPAD(1) : print "UP"
100 locate 0,5 : pen JAGPAD(2) : print "DOWN"
110 locate 0,6 : pen JAGPAD(3) : print "LEFT"
120 locate 0,7 : pen JAGPAD(4) : print "RIGHT"
130 rem ***********
140 locate 10,4 : pen JAGPAD(5) : print "FIRE A"
150 locate 10,5 : pen JAGPAD(6) : print "FIRE B"
160 locate 10,6 : pen JAGPAD(7) : print "FIRE C"
170 rem ***********
180 locate 0,11 : pen JAGPAD(8) : print "1"
190 locate 2,11 : pen JAGPAD(9) : print "2"
200 locate 4,11 : pen JAGPAD(10) : print "3"
210 locate 0,13 : pen JAGPAD(11) : print "4"
220 locate 2,13 : pen JAGPAD(12) : print "5"
230 locate 4,13 : pen JAGPAD(13) : print "6"
240 locate 0,15 : pen JAGPAD(14) : print "7"
250 locate 2,15 : pen JAGPAD(15) : print "8"
260 locate 4,15 : pen JAGPAD(16) : print "9"
270 locate 0,17 : pen JAGPAD(17) : print "*"
280 locate 2,17 : pen JAGPAD(18) : print "0"
290 locate 4,17 : pen JAGPAD(19) : print "#"
300 rem ***********
310 locate 10,13 : pen JAGPAD(20) : print "OPTION"
320 locate 10,15 : pen JAGPAD(21) : print "PAUSE"
330 screen swap : wait vbl
340 rem **************************************************
350 doke $FFFF9202,$FFFE
360 A=deek($FFFF9200) : B=deek($FFFF9202)
370 GRP(1,1)=A
380 GRP(1,2)=B
390 doke $FFFF9202,$FFFD
400 A=deek($FFFF9200) : B=deek($FFFF9202)
410 GRP(2,1)=A
420 GRP(2,2)=B
430 doke $FFFF9202,$FFFB
440 A=deek($FFFF9200) : B=deek($FFFF9202)
450 GRP(3,1)=A
460 GRP(3,2)=B
470 doke $FFFF9202,$FFF7
480 A=deek($FFFF9200) : B=deek($FFFF9202)
490 GRP(4,1)=A
500 GRP(4,2)=B
510 rem ********** GROUP ONE **************************
520 if GRP(1,1)=65535 then JAGPAD(5)=1
530 for X=1 to 4 : if GRP(1,2)=65535 then JAGPAD(X)=1 : next X
540 if GRP(1,1)=65533 then JAGPAD(5)=2
550 if GRP(1,2)=65279 then JAGPAD(1)=2
560 if GRP(1,2)=65023 then JAGPAD(2)=2
570 if GRP(1,2)=64511 then JAGPAD(3)=2
580 if GRP(1,2)=63487 then JAGPAD(4)=2
590 if GRP(1,1)=65534 then JAGPAD(21)=2 : else JAGPAD(21)=1
600 rem ********** GROUP TWO **************************
610 if GRP(2,1)=65535 then JAGPAD(6)=1
620 if GRP(2,1)=65533 then JAGPAD(6)=2 : rem FIRE B
630 if GRP(2,2)=65279 then JAGPAD(17)=2 : else JAGPAD(17)=1
640 if GRP(2,2)=65023 then JAGPAD(14)=2 : else JAGPAD(14)=1
650 if GRP(2,2)=64511 then JAGPAD(11)=2 : else JAGPAD(11)=1
660 if GRP(2,2)=63487 then JAGPAD(8)=2 : else JAGPAD(8)=1
670 rem ********** GROUP THREE ************************
680 if GRP(3,1)=65535 then JAGPAD(7)=1
690 if GRP(3,1)=65533 then JAGPAD(7)=2 : rem FIRE C
700 if GRP(3,2)=65279 then JAGPAD(18)=2 : else JAGPAD(18)=1 : rem 0
710 if GRP(3,2)=65023 then JAGPAD(15)=2 : else JAGPAD(15)=1 : rem 8
720 if GRP(3,2)=64511 then JAGPAD(12)=2 : else JAGPAD(12)=1 : rem 5
730 if GRP(3,2)=63487 then JAGPAD(9)=2 : else JAGPAD(9)=1 : rem 2
740 rem ********** GROUP FOUR *************************
750 if GRP(4,1)=65535 then JAGPAD(20)=1
760 if GRP(4,1)=65533 then JAGPAD(20)=2 : else JAGPAD(20)=1 : remoption
770 if GRP(4,2)=65279 then JAGPAD(19)=2 : else JAGPAD(19)=1 : rem #
780 if GRP(4,2)=65023 then JAGPAD(16)=2 : else JAGPAD(16)=1 : rem 9
790 if GRP(4,2)=64511 then JAGPAD(13)=2 : else JAGPAD(13)=1 : rem 6
800 if GRP(4,2)=63487 then JAGPAD(10)=2 : else JAGPAD(10)=1 : rem 3
805 if inkey$=" " then default : end
810 goto 90


Another piece of code I wrote while trying to forget about games
enjoy :D

User avatar
exxos
Hardware Guru
Hardware Guru
Posts: 4933
Joined: Fri Mar 28, 2003 8:36 pm
Location: England
Contact:

Re: Jaguar joypad STOS source ..enjoy.. ;)

Postby exxos » Thu Jan 07, 2016 10:40 am

Cool :) I don't know anything about those ports or pads. why do you start using deek and doke ? Why writing to the joystick address's ?

Have you looked at the STE extension or the Control extension as they state they control the jagpads http://www.exxoshost.co.uk/atari/STOS/EXTENSIONS/index.htm
4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter

http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator

EstTeeEfEm
Captain Atari
Captain Atari
Posts: 299
Joined: Mon May 04, 2015 9:02 pm

Re: Jaguar joypad STOS source ..enjoy.. ;)

Postby EstTeeEfEm » Thu Jan 07, 2016 10:47 am

Well, the STE jagpads have FOUR states each representing four groups of buttons...
You need to write into the register which "group" you want to access...
if you look, the same register is read and even gives the same 65 number back but with a different set of buttons...

I checked out the control extension but its unreliable (ST Format told me so too :) )...
The DEEK is the reading of the register attached to the jagpads..

but you need to DOKE into FF9202 in order to tell the STE which set of buttons to use, hence the four groups split with REMS

The Jagpad uses multiplexing false/true states to cram 21 buttons onto 15 pins

Direct register access is always nice ;) also, did you know that BLIT doesnt allow palette changes? You cannot simply PALETTE $000,$777 when screenswapping logical/physical .. thats why i use $ffff8240 to change palette's.. check it out.. odd quirk of TML

User avatar
exxos
Hardware Guru
Hardware Guru
Posts: 4933
Joined: Fri Mar 28, 2003 8:36 pm
Location: England
Contact:

Re: Jaguar joypad STOS source ..enjoy.. ;)

Postby exxos » Thu Jan 07, 2016 11:00 am

Ahh, see I know nothing :) There is the "STE" extension also. I think there was a lot of versions of the control extension, so possible STformat could have had a early one. I wouldn't take much notice what they say anyway ;) In anycase if it works, then job sorted :)

I don't remember much about commands, it been some 20+ years since I was active in STOS. Though it might be useful if you write a bit of a article on your finds then I can include them on my site ?
4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter

http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 4774
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Jaguar joypad STOS source ..enjoy.. ;)

Postby simonsunnyboy » Thu Jan 07, 2016 11:03 am

Small advice, before activating EJP routines, crosscheck the cookiejar that the program is not running on a MSTE. The registers are available but will give bogus inputs (MSTE lacks the physical ports)
Simon Sunnyboy/Paradize - http://paradize.atari.org/ - STOT: http://www.npoi.de/stot/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

Jabber: simonsunnyboy@atari-jabber.org

EstTeeEfEm
Captain Atari
Captain Atari
Posts: 299
Joined: Mon May 04, 2015 9:02 pm

Re: Jaguar joypad STOS source ..enjoy.. ;)

Postby EstTeeEfEm » Thu Jan 07, 2016 11:10 am

forgive me for being naive maybe but without the ports would it not just give the default registers?...
in the source there is scope for "not pressing anything" .. do you think this is sufficient or would the MSTE actually give different default results?

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 4774
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Jaguar joypad STOS source ..enjoy.. ;)

Postby simonsunnyboy » Thu Jan 07, 2016 11:13 am

I don't remember details but i got bugreports for my games Penta and Nuclear Waste Dump with jagpad access on MSTEs that it did not work at all. Try your code on a MSTE to crosscheck for effects.
Simon Sunnyboy/Paradize - http://paradize.atari.org/ - STOT: http://www.npoi.de/stot/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

Jabber: simonsunnyboy@atari-jabber.org

EstTeeEfEm
Captain Atari
Captain Atari
Posts: 299
Joined: Mon May 04, 2015 9:02 pm

Re: Jaguar joypad STOS source ..enjoy.. ;)

Postby EstTeeEfEm » Thu Jan 07, 2016 11:15 am

Though it might be useful if you write a bit of a article on your finds then I can include them on my site ?


lol, I've thought about this myself but there is just too much I dont know enough about..

I guess this just comes down to learning only what I've needed to learn, for example... file handling routines saving in particular is a new one on me lol
We need another manual for sure though ;)

Try your code on a MSTE to crosscheck for effects.


I wish I could.. i only have a lowly STF myself and this was coded on STEEM, maybe this is the time to ask some nice MSTE owner to compile and check it ;)


Social Media

     

Return to “STOS”

Who is online

Users browsing this forum: No registered users and 1 guest