Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 11:22 25 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoVaders

     Page 1 of 4    
Author Message
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 892
Posted: 08:14am 04 Jul 2022
Copy link to clipboard 
Print this post







My first try of a complete Game in MM Basic on Picomite VGA
Use Cursor Keys to moce and Space to fire
If one would extend it by Joystick - Routines, you are very welcome


PicoVaders.zip

Chears, Martin
Edited 2022-07-04 18:15 by Martin H.
'no comment
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5714
Posted: 08:17am 04 Jul 2022
Copy link to clipboard 
Print this post

Oh, this needs to go on the PicoGAME board. :)  Nice!
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 892
Posted: 08:51am 04 Jul 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  Oh, this needs to go on the PicoGAME board. :)  Nice!

Oh, there is something lika a PicoGame Board?!
Since I'm relatively new to the Pico and MM Basic, I don't know all of the Boards yet. But feel free to share it whereever you like
Edited 2022-07-04 18:52 by Martin H.
'no comment
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5714
Posted: 09:19am 04 Jul 2022
Copy link to clipboard 
Print this post

Oh, it's a PCB that I designed for the PicoMite VGA. It takes two controllers.
The current version is 1.4 (Here), but I have a new one coming up once I have the documentation and a couple of odd bits sorted out.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 892
Posted: 09:55am 04 Jul 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  Oh, it's a PCB that I designed for the PicoMite VGA. It takes two controllers.
The current version is 1.4 (Here), but I have a new one coming up once I have the documentation and a couple of odd bits sorted out.

Classical misunderstanding ...  
you meant that PCB ...
I thought that there is a Board/Forum where I have to post the source ...

since you only need 3 buttons (left/right/fire) it should be not to much effort, to change the

Do While Inkey$<>" "  

to the Fire Button in the Sub Intro
and extend the Sub Move_Player for the Joystick routine.

Chears
  Martin
'no comment
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3839
Posted: 09:55am 04 Jul 2022
Copy link to clipboard 
Print this post

Unofficially, but with Mick's permission I'm starting to put together an online repository of information on the PicoGAME:

   https://github.com/thwill1000/pico-game-vga

Best wishes,

Tom
Edited 2022-07-04 20:15 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 892
Posted: 10:02am 04 Jul 2022
Copy link to clipboard 
Print this post

Very NICE  
'no comment
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 10:24am 04 Jul 2022
Copy link to clipboard 
Print this post

Oh excellent.  This is just what the PicoMite VGA needs.
Thanks.

Geoff
Geoff Graham - http://geoffg.net
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 892
Posted: 10:29am 04 Jul 2022
Copy link to clipboard 
Print this post

@Geoff
since I bought my first ZX81 it has been a dream do code Space Invaders (in Basic)  at least just 40 Years Later, you made it is possible :-)
So I have to thank You  
'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3510
Posted: 04:44pm 04 Jul 2022
Copy link to clipboard 
Print this post

Nice Martin!
Very close to the original on the ZX.
I owned a ZX81 for few years, and this was my only game. When the tape worn out, I sold the ZX. For around 3 euro.... what a shame... anyway, thats what is was those days. Always something new to buy. Better most cases..

To the game....
Firing goes well. But moving the gun around is not. This is terribly slow.
I tried to increase the movement, but then the cleanup of old position of the gun is not correct.

Sub Move_Player
 k$=Inkey$
 If k$="" Then Exit Sub
 If Asc(k$)=130 Then plx=plx-3:If plx<16 Then plx=16:Exit Sub     'was plx=plx-1
 If Asc(k$)=131 Then plx=plx+3:If plx>188 Then plx=188:Exit Sub   'was plx=plx+1
 If k$=" " And BA=0 Then
   If Not ua% Then Inc Myst%,Int(Rnd*3)
   BA=1:BX=plx+7:BY=210
   For f=1000 To 1 Step -50:Play tone 1000+f,1000+f,5:Pause 2:Next f
 EndIf
End Sub


Not sure if this relates to key repeat of my keyboard (I think it has none).
Edited 2022-07-05 04:50 by Volhout
PicomiteVGA PETSCII ROBOTS
 
cosmic frog
Senior Member

Joined: 09/02/2012
Location: United Kingdom
Posts: 278
Posted: 07:45pm 04 Jul 2022
Copy link to clipboard 
Print this post

  Volhout said  
To the game....
Firing goes well. But moving the gun around is not.


I have the same problem.
I think this is a problem with INKEY$ not clearing/using the keyboard buffer.

Maybe you could use a couple of buttons wired up to the GPIO's and re-write the code?

The game itself looks great!

Dave.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3510
Posted: 07:57pm 04 Jul 2022
Copy link to clipboard 
Print this post

This is a bit better, not much

Sub Move_Player
k$=Inkey$
If k$="" Then Exit Sub
If Asc(k$)=130 Then plx=plx-1:If plx<16 Then plx=16:Exit Sub     'was plx=plx-1
If Asc(k$)=131 Then plx=plx+1:If plx>188 Then plx=188:Exit Sub   'was plx=plx+1
If k$=" " And BA=0 Then
  If Not ua% Then Inc Myst%,Int(Rnd*3)
  BA=1:BX=plx+7:BY=210
  For f=1000 To 1 Step -50:Play tone 1000+f,1000+f,5:Pause 2:Next f
  do:loop until inkey$=""
EndIf
End Sub

Edited 2022-07-05 06:01 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 892
Posted: 03:12am 05 Jul 2022
Copy link to clipboard 
Print this post

  cosmic frog said  
  Volhout said  
To the game....
Firing goes well. But moving the gun around is not.


I have the same problem.
I think this is a problem with INKEY$ not clearing/using the keyboard buffer.

Maybe you could use a couple of buttons wired up to the GPIO's and re-write the code?

The game itself looks great!

Dave.

Thanks for the feetback
I will try it with GPIO this afternoon..
Are there default (preferred) Ports to Use for Atari type Joysticks (not to get in Conflict with other Projects).

!!this is all theory and untested!!
It's 5am here and I won't be able to test it until late this afternoon


This would be something like that(for example if you use GPIO 2,3 and 4 for input
they switch 3.3V to the GPIO Pins
so add this at the Progamstart:

SetPin Gp02, DIN, pulldown:'left
SetPin Gp03, DIN, pulldown:'right
SetPin Gp04, DIN, pulldown:'Fire


The Move_Player Sub could look like this:

Sub Move_Player
 k$=Inkey$
 GPI%=Pin(GP02)+Pin(GP03)+Pin(GP04)
 If k$="" and GPI%=0 Then Exit Sub
 If Asc(k$)=130 or Pin(GP02)=1  Then plx=plx-1:If plx<16 Then plx=16:Exit Sub
 If Asc(k$)=131 or Pin(GP03)=1 Then plx=plx+1:If plx>188 Then plx=188:Exit Sub
 If  BA=0 Then
   If k$=" " or Pin(GP04)=1  Then
     If Not ua% Then Inc Myst%,Int(Rnd*3)
     BA=1:BX=plx+7:BY=210
     For f=1000 To 1 Step -50:Play tone 1000+f,1000+f,5:Pause 2:Next f
   EndIf
 EndIf
End Sub


'no comment
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3654
Posted: 06:09am 05 Jul 2022
Copy link to clipboard 
Print this post

  cosmic frog said  I think this is a problem with INKEY$ not clearing/using the keyboard buffer.

Dave.

The code posted may show the problem - being stuck in the FOR loop?

John
Edited 2022-07-05 16:10 by JohnS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5714
Posted: 07:07am 05 Jul 2022
Copy link to clipboard 
Print this post

There are no standard pins for Atari joysticks. The best approach is probably to set them up using CONST at the beginning of your program then it's easy to change them for any setup.
e.g.

CONST JU = 1 'GP0
CONST JD = 2 'GP1
CONST JL = 4 'GP2

SETPIN JU, DIN
SETPIN JD, DIN
SETPIN JL, DIN

etc.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3839
Posted: 08:53am 05 Jul 2022
Copy link to clipboard 
Print this post

  Martin H. said  Are there default (preferred) Ports to Use for Atari type Joysticks (not to get in Conflict with other Projects).


LOL, from experience with the CMM2 I would say that outside of anything fixed in the firmware (nothing in the case of the PicoMite) the residents of The Backshed have a pathological aversion to standardising which ports should be assigned to game controllers.

I admittedly have a vested interest, but I would suggest you follow the assignment @Mixtel90 used with the PicoGAME VGA (and also with his expansion board for Peter's reference PCB - though I'm not sure if anyone has built one of those):

https://github.com/thwill1000/pico-game-vga/blob/main/hardware/v14/14%20Circuit%20diagram.pdf

   GP0: Up
   GP1: Down
   GP2: Left
   GP3: Right
   GP14: Fire

All active low.

@Mixtel90 is also correct that using CONSTs for the pin assignment would be best practice ... though you do then have to pay for extra variable lookups so if you have performance problems you may end having having to inline them anyway.

Best wishes,

Tom
Edited 2022-07-05 19:18 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
cosmic frog
Senior Member

Joined: 09/02/2012
Location: United Kingdom
Posts: 278
Posted: 09:56am 05 Jul 2022
Copy link to clipboard 
Print this post



Atari joystick pinouts.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3839
Posted: 10:02am 05 Jul 2022
Copy link to clipboard 
Print this post

  cosmic frog said  Atari joystick pinouts.


That's correct and matches the layout of the PicoGAME VGA controller ports, but the question here is about the pins on the Pico, not the pins on the controller port - see the schematic linked above.

Also note the Pico will be driving the joystick at 3.3V not 5V, apocraphally that still works - I can't personally confirm as my AliExpress (clone) Atari joysticks are still in their packaging.

Best wishes,

Tom
Edited 2022-07-05 20:03 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
cosmic frog
Senior Member

Joined: 09/02/2012
Location: United Kingdom
Posts: 278
Posted: 10:20am 05 Jul 2022
Copy link to clipboard 
Print this post

  thwill said  

Also note the Pico will be driving the joystick at 3.3V not 5V


If the joystick only uses U,D,L,R,Fire all the joysticks I've seen don't need a voltage.
The ones that do need a voltage are those that use extra buttons and usually have some kind of shift register inside.

Dave.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3839
Posted: 10:25am 05 Jul 2022
Copy link to clipboard 
Print this post

  cosmic frog said  If the joystick only uses U,D,L,R,Fire all the joysticks I've seen don't need a voltage.
The ones that do need a voltage are those that use extra buttons and usually have some kind of shift register inside.

Dave.


ACK. I was only pointing it out because your pinout showed a 5V pin, whereas the same port/pin on the PicoGAME VGA is at 3.3V.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
     Page 1 of 4    
Print this page
© JAQ Software 2024