![]() |
Forum Index : Microcontroller and PC projects : Come in and find out
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1193 |
okokok... but it is no error Subservient, I solemnly pledge to use the Select Function next time, just to avoid such discussions. ![]() ![]() ![]() Edited 2022-11-02 19:07 by Martin H. 'no comment |
||||
Bleep Guru ![]() Joined: 09/01/2022 Location: United KingdomPosts: 579 |
Since the walls on the sides are trapezoidal, I can't use the box function (x1,Y1) ...... | ..... | ....(X3,Y3) | | | | | | | | | ....(X4,Y4) | ..... (X2,Y2) ...... I draw one triagngle connecting the Corners 1->3->4->1 and the second triangle 1->2->4->1 As I used the same for the Gaps and the Wall in Front because the parameters of the BOX command are different (X,Y,W,H). I didn't feel like converting the coordinates again ![]() triagngle command is fast enough. ![]() This isn't animation in the proper sense, so the refresh rate doesn't really matter. Cheers Mart!n Hi Martin, You could however use Polygon, but looking at how you have constructed the blocking wall, and side gaps this would not be a straight swap in, but they are faster than using 2 Triangles, if that were a requirement. :-) Regards, Kevin. Edited 2022-11-02 21:41 by Bleep |
||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1193 |
Hi Martin, You could however use Polygon, but looking at how you have constructed the blocking wall, and side gaps this would not be a straight swap in, but they are faster than using 2 Triangles, if that were a requirement. :-) Regards, Kevin. Hi Kevin, with the Polygon funtion there will be some changes needed But I tested it (for now) just for the left and right walls... here the changed sub, (@Jim also without the nested IF Statement): Sub Draw_Element nr%,mir%,Gap% Local x1%,y1%,x2%,y2%,x3%,y3%,x4%,y4%,xarr%(5),yarr%(5) x1%=Wall%(nr%,0,0):y1%=Wall%(nr%,0,1) x2%=Wall%(nr%,1,0):y2%=Wall%(nr%,1,1) x3%=Wall%(nr%,2,0):y3%=Wall%(nr%,2,1) x4%=Wall%(nr%,3,0):y4%=Wall%(nr%,3,1) If mir% Then x1%=240-x1%:x2%=240-x2%:x3%=240-x3%:x4%=240-x4% WallC1%=RGB(0,64,0):WallC2%=RGB(0,128,0) Select Case Gap% Case 0 'Wall xarr%(0)=x1%:xarr%(1)=x3%:xarr%(2)=x4%:xarr%(3)=x2%:xarr%(4)=x1% yarr%(0)=y1%:yarr%(1)=y3%:yarr%(2)=y4%:yarr%(3)=y2%:yarr%(4)=y1% Polygon 4,xarr%(),yarr%(),WallC1%,WallC1% Case 1 'Gap Triangle x1%,y3%,x3%,y3%,x4%,y4%,WallC2%,WallC2% Triangle x1%,y4%,x1%,y3%,x4%,y4%,WallC2%,WallC2% Case Else 'Blocker Triangle x1%,y1%,240-x1%,y1%,240-x1%,y2%,WallC2%,WallC2% Triangle x1%,y1%,240-x1%,y2%,x1%,y2%,WallC2%,WallC2% End Select End Sub Of course, there are many different ways to draw walls.I am not sure if, in this case, the Filling of 2 Arrays and the call of the Polygon Routine would take more Time than just draw 2 Triangles. not sure why I should make those changes, since it runs fast enough as it is. As my Granddad told dont fix it if it isn't broken Edited 2022-11-02 23:37 by Martin H. 'no comment |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2394 |
A great advert for vga mmbasic. I was surprised how fast lcd graphics using fill worked. Triangles great for dial pointer. Picomite is nice but vga setup would be better graphics. Got to wire it, yawn. |
||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1193 |
connecting to VGA is not a big deal If you look at the circuit in Mixtel90s PicoGame Mini 00 Construction Pack youll get it done with just 4 Resistors ©Mixtel90 it works Edited 2022-11-03 02:42 by Martin H. 'no comment |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2394 |
If you look at the circuit in Mixtel90s PicoGame Mini 00 Construction Pack youll get it done with just 4 Resistors ©Mixtel90 it works Looks simple for 16 colours, why not in "The manual"? I will try that. I have 8 channel 3.3V to 5V bi direction boards for the key board. I got 4 ps2 kb , 2 I cut the plugs off. Would they run at 3.3V logic? Power from 3.3V and see.. can not damage picomite that way or use logic level converter, which has 8 channels, so useful for other devices. I will try tonight to get vga running. SPI Lcd is impressive but I must try vga. Will I still be able to use mmedit or will it be vga terminal? I will see... I hope. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7515 |
If you are lucky a PS/2 keyboard can be connected directly - but you have to be able to power it from 3V3. Keyboards that need 5V *have* to have a level shifter of some sort as they may contain pullups to 5V which will damage the Pico. Unfortunately you can't tell reliably which keyboards will work without trying them. A level shifter can be two cheap mosfets and 4 resistors. Edited 2022-11-03 06:29 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2394 |
I have a few of these bi-directional logic level converters. Nice for ili lcd with 5V logic like pic/arduino 328p. vga picomite is more desk space is my problem, monitot, keyboard. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7515 |
PicoGAME? 105mm x 110mm A bit smaller... PicoGAME VGA mini? 70mm x 90mm but hasn't got Port B. Both can take 5V keyboards. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
I've been smoke-testing my controller library so have taken liberties with Martin's code: PicoGAME version with keyboard, NES and Atari joystick support: maze-pm.zip CMM2 version with keyboard, Wii Classic and Atari joystick (on the G2 DX) support: maze-cmm2.zip The CMM2 version should also run with the keyboard on MMB4W. And here is the code of the PicoGAME version for those who are interested but cannot be bothered with actually downloading and running: ' Transpiled on 07-11-2022 20:11:09 'Maze Game by Mart!n Herhaus 2022 'Init, switch to 16 Col 320x240 Screen ' BEGIN: #Include "ctrl.ipp" ----------------------------------------------- ' Copyright (c) 2022 Thomas Hugo Williams ' License MIT <https://opensource.org/licenses/MIT> ' ' MMBasic Controller Library ' ' Preprocessor flag PICOMITE defined ' Preprocessor flag CTRL_ONE_PLAYER defined ' Preprocessor flag CTRL_NO_CURSORS defined ' Preprocessor flag CTRL_NO_SNES defined Const ctrl.VERSION = 900 ' 0.9.0 ' Button values as returned by controller read functions. Const ctrl.R = &h01 Const ctrl.START = &h02 Const ctrl.HOME = &h04 Const ctrl.SELECT = &h08 Const ctrl.L = &h10 Const ctrl.DOWN = &h20 Const ctrl.RIGHT = &h40 Const ctrl.UP = &h80 Const ctrl.LEFT = &h100 Const ctrl.ZR = &h200 Const ctrl.X = &h400 Const ctrl.A = &h800 Const ctrl.Y = &h1000 Const ctrl.B = &h2000 Const ctrl.ZL = &h4000 Const ctrl.OPEN = -1 Const ctrl.CLOSE = -2 ' The NES standard specifies a 12 micro-second pulse, but all the controllers ' I've tested work with 1 micro-second, and possibly less. Const ctrl.PULSE = 0.001 ' 1 micro-second ' When a key is pressed ctrl.on_key() sets the corresponding byte of this ' 256-byte map to 1. When ctrl.keydown(i%) is called the corresponding ' byte is read and set to 0. Note that a 256-bit map could be used but would ' be slower. Dim ctrl.key_map%(31 + Mm.Info(Option Base)) ' Initialises keyboard reading. Sub ctrl.init_keys() ctrl.term_keys() On Key ctrl.on_key() End Sub Sub ctrl.on_key() Local ch$ = Inkey$ If ch$ <> "" Then Poke Var ctrl.key_map%(), Asc(ch$), 1 End Sub ' Terminates keyboard reading. Sub ctrl.term_keys() On Key 0 Memory Set Peek(VarAddr ctrl.key_map%()), 0, 256 Do While Inkey$ <> "" : Loop End Sub Function ctrl.keydown%(i%) ctrl.keydown% = Peek(Var ctrl.key_map%(), i%) If ctrl.keydown% Then Poke Var ctrl.key_map%(), i%, 0 End Function Function ctrl.poll$(duration%, ctrls$()) Local expires% = Choice(duration%, Timer + duration%, &h7FFFFFFFFFFFFFFF) Local key%, i%, t% Do For i% = Bound(ctrls$(), 0) To Bound(ctrls$(), 1) On Error Ignore Call ctrls$(i%), ctrl.OPEN On Error Abort If Mm.ErrNo <> 0 Then Continue For t% = Timer + 20 Do Call ctrls$(i%), key% If (key% = ctrl.A) Or (key% = ctrl.START) Then ctrl.poll$ = ctrls$(i%) ' Wait for user to release key. Do While key% <> 0 : Call ctrls$(i%), key% : Loop Call ctrls$(i%), ctrl.CLOSE Exit Function EndIf Loop While Timer < t% Call ctrls$(i%), ctrl.CLOSE Next Loop Until Timer >= expires% End Function ' Atari joystick on PicoGAME Port A. Sub atari_a(x%) Select Case x% Case Is >= 0 x% = Not Pin(GP14) * ctrl.A Inc x%, Not Pin(GP0) * ctrl.UP Inc x%, Not Pin(GP1) * ctrl.DOWN Inc x%, Not Pin(GP2) * ctrl.LEFT Inc x%, Not Pin(GP3) * ctrl.RIGHT Exit Sub Case ctrl.OPEN SetPin GP14, DIn SetPin GP0, DIn SetPin GP1, DIn SetPin GP2, DIn SetPin GP3, DIn End Select End Sub ' Reads port A connected to a NES gamepad. ' ' Note that the extra pulse after reading bit 7 (Right) should not be necessary, ' but in practice some NES clone controllers require it to behave correctly. Sub nes_a(x%) Select Case x% Case Is >= 0 Pulse GP2, ctrl.PULSE x% = Not Pin(GP1) * ctrl.A : Pulse GP3, ctrl.PULSE Inc x%, Not Pin(GP1) * ctrl.B : Pulse GP3, ctrl.PULSE Inc x%, Not Pin(GP1) * ctrl.SELECT : Pulse GP3, ctrl.PULSE Inc x%, Not Pin(GP1) * ctrl.START : Pulse GP3, ctrl.PULSE Inc x%, Not Pin(GP1) * ctrl.UP : Pulse GP3, ctrl.PULSE Inc x%, Not Pin(GP1) * ctrl.DOWN : Pulse GP3, ctrl.PULSE Inc x%, Not Pin(GP1) * ctrl.LEFT : Pulse GP3, ctrl.PULSE Inc x%, Not Pin(GP1) * ctrl.RIGHT : Pulse GP3, ctrl.PULSE Exit Sub Case ctrl.OPEN SetPin GP2, Dout ' Latch SetPin GP3, Dout ' Clock SetPin GP1, Din ' Data Pin(GP2) = 0 Pin(GP3) = 0 End Select End Sub ' END: #Include "ctrl.ipp" ----------------------------------------------- Option Break 4 On Key 3, on_exit Select Case Mm.Device$ Case "PicoMiteVGA" Mode 2 Font 1 FrameBuffer Create FrameBuffer Write F Case "Colour Maximite 2", "Colour Maximite 2 G2", "MMBasic for Windows" Mode 7 Font 1 Page Write 1 Case Else Error "Unsupported device: " + Mm.Device$ End Select ctrl.init_keys() Dim ctrl$ = show_title$() cw%=RGB(white):WallC1%=0:WallC2%=RGB(RED):cP%=RGB(green) 'Read the XY-Coordinates of the Wall Elements Corners Dim Wall%(6,4,2) For N%=0 To 5 'Walls For C%=0 To 3 '4 Corners For F%=0 To 1 '2 Coordinates (X,Y) Read Wall%(N%,C%,F%) Next Next Next MazeW%=24:MazeH%=24 ' create array and fill Dim Maze$(MazeW%,MazeH%) length 1 restart_game: For x% = 0 To MazeW% For y% = 0 To MazeH% Maze$(x%, y%) = "#" Next Next 'generate random Maze generator MovDir$=Chr$(146)+Chr$(148)+Chr$(147)+Chr$(149) show_map%=0:CLS cw% 'place Player PlrX%=MazeW%-1:PlrY%=MazeH%-1:PD%=3 'place Exit Ex_X%=2:Ex_Y%=0:If Maze$(Ex_X%,1)="#" Then Inc Ex_X% Maze$(Ex_X%,Ex_Y%)="E" If show_map% Then Box 243+Ex_X%*3,3+Ex_Y%*3,3,3,,WallC2%,WallC2% Colour 0, cw% Text 244,98,"D X Y" Select Case ctrl$ Case "nes_a" Text 244,130,"NES PAD" Case "atari_a" Text 244,130,"ATARI JOY" Case "keys_wasd" Text 244,130,"KEYS:" Text 244,140,"W:FORWARD" Text 244,150,"S:BACKWRD" Text 244,160,"A:TURN L." Text 244,170,"D:TURN R." End Select Text 244,190,"M:SHOW/" Text 244,204," HIDE MAP" ' --- Game Loop --- redraw% = 1 Do If redraw% Then Text 244,110,Mid$(MovDir$,PD%+1,1)+" "+Str$(PlrX%,2)+" "+Str$(PlrY%,2)+" " Draw_3D Select Case PD% Case 0:XS%=0 :YS%=-1 Case 1:XS%=1 :YS%=0 Case 2:XS%=0 :YS%=1 Case 3:XS%=-1:YS%=0 End Select If show_map% Then Box 243+PlrX%*3,3+PlrY%*3,3,3,,cp%,cp% redraw% = 0 If Mm.Device$ = "PicoMiteVGA" Then FrameBuffer Copy F, N, B Else Page Copy 1 To 0, B EndIf EndIf ' Wait for user to press key Key% = 0 Do While Key% = 0 Call ctrl$, Key% If Key% = 0 Then If ctrl.keydown%(Asc("m")) Then Key% = ctrl.SELECT EndIf If Key% = OldKey% Then Key% = 0 Else OldKey% = Key% ' Don't auto-repeat. Loop Select Case Key% Case ctrl.LEFT Inc PD%,-1:Inc PD%,4*(PD%=-1) redraw% = 1 Case ctrl.RIGHT Inc PD%:PD%=PD% And 3 redraw% = 1 Case ctrl.UP, ctrl.DOWN OX%=PlrX%:OY%=PlrY% Inc PlrX%, Choice(Key% = ctrl.UP, 1, -1) * XS% Inc PlrY%, Choice(Key% = ctrl.UP, 1, -1) * YS% If Maze$(PlrX%,PlrY%)="#" Then PlrX%=OX%:PlrY%=OY% If show_map% Then Box 243+ox%*3,3+oy%*3,3,3,,cw%,cw% redraw% = 1 Case ctrl.SELECT show_map% = Not show_map% If show_map% Then Box 243,3,76,76,,cw%,cw% Show_Maze Box 243+Ex_X%*3,3+Ex_Y%*3,3,3,,255.255 Else Box 243,3,76,76,,cw%,cw% EndIf redraw% = 1 End Select If PlrX%=Ex_X% And PlrY%=Ex_Y% Then Exit Loop Text 64,50,Chr$(151)+" WELL DONE! "+Chr$(151) Text 60,85,"PRESS Q TO QUIT" Text 60,105,"OR ANY OTHER KEY" Text 60,115," TO TRY ANOTHER" Text 64,125," MAZE" If Mm.Device$ = "PicoMiteVGA" Then FrameBuffer Copy F, N, B Else Page Copy 1 To 0, B EndIf ctrl.term_keys() ikey$ = "" Do While ikey$ = "" : ikey$ = LCase$(Inkey$) : Loop If ikey$ = "q" Then CLS 0 : on_exit() ctrl.init_keys() GoTo restart_game '---------------------------- Sub draw_3d Box 0,0,241,240,,cw%,cw% Select Case PD% Case 0 For f%=0 To 5 If PlrY%-f%<0 Then Exit For If Maze$(PlrX%-1,PlrY%-f%)="#" Then Draw_Element f%,0,0 Else Draw_Element f%,0,1 If Maze$(PlrX%+1,PlrY%-f%)="#" Then Draw_Element f%,1,0 Else Draw_Element f%,1,1 If Maze$(PlrX%,PlrY%-f%)="#" Then Draw_Element f%,1,2:Exit For Next f% Case 1 For f%=0 To 5 If PlrX%+f%>MazeW% Then Exit For If Maze$(PlrX%+f%,PlrY%-1)="#" Then Draw_Element f%,0,0 Else Draw_Element f%,0,1 If Maze$(PlrX%+f%,PlrY%+1)="#" Then Draw_Element f%,1,0 Else Draw_Element f%,1,1 If Maze$(PlrX%+f%,PlrY%)="#" Then Draw_Element f%,1,2:Exit For Next f% Case 2 For f%=0 To 5 If PlrY%+f%>MazeH% Then Exit For If Maze$(PlrX%+1,PlrY%+f%)="#" Then Draw_Element f%,0,0 Else Draw_Element f%,0,1 If Maze$(PlrX%-1,PlrY%+f%)="#" Then Draw_Element f%,1,0 Else Draw_Element f%,1,1 If Maze$(PlrX%,PlrY%+f%)="#" Then Draw_Element f%,1,2:Exit For Next f% Case 3 For f%=0 To 5 If PlrX%-f%<0 Then Exit For If Maze$(PlrX%-f%,PlrY%+1)="#" Then Draw_Element f%,0,0 Else Draw_Element f%,0,1 If Maze$(PlrX%-f%,PlrY%-1)="#" Then Draw_Element f%,1,0 Else Draw_Element f%,1,1 If Maze$(PlrX%-f%,PlrY%)="#" Then Draw_Element f%,1,2:Exit For Next f% End Select End Sub 'draw the elements Sub Draw_Element nr%,mir%,Gap% Local x1%,y1%,x2%,y2%,x3%,y3%,x4%,y4% x1%=Wall%(nr%,0,0):y1%=Wall%(nr%,0,1) x2%=Wall%(nr%,1,0):y2%=Wall%(nr%,1,1) x3%=Wall%(nr%,2,0):y3%=Wall%(nr%,2,1) x4%=Wall%(nr%,3,0):y4%=Wall%(nr%,3,1) If mir% Then x1%=240-x1%:x2%=240-x2%:x3%=240-x3%:x4%=240-x4% WallC1%=RGB(0,64,0):WallC2%=RGB(0,128,0) If Not Gap% Then 'Wall Triangle x1%,y1%,x2%,y2%,x4%,y4%,WallC1%,WallC1% Triangle x1%,y1%,x3%,y3%,x4%,y4%,WallC1%,WallC1% ElseIf Gap%=1 Then 'Gap Triangle x1%,y3%,x3%,y3%,x4%,y4%,WallC2%,WallC2% Triangle x1%,y4%,x1%,y3%,x4%,y4%,WallC2%,WallC2% Else 'Blocker Triangle x1%,y1%,240-x1%,y1%,240-x1%,y2%,WallC2%,WallC2% Triangle x1%,y1%,240-x1%,y2%,x1%,y2%,WallC2%,WallC2% EndIf End Sub Sub show_maze For y% = 0 To MazeH% For x% = 0 To MazeW% If Maze$(x%,y%)="#" Then Box 243+x%*3,3+y%*3,3,3,,0,0 Next x% Next y% End Sub ' --- 2D Maze generator --- ' algorithmen based on ' https://rosettacode.org/wiki/Maze_generation#BASIC256 ' -------------------------- Sub generator Local done%,i%,CurX%,CurY%,OldX%,OldY%,x%,y% ' initial start location CurX%=Int(Rnd * (MazeW% - 1)) CurY%=Int(Rnd * (MazeH% - 1)) ' value must be odd If CurX% Mod 2=0 Then Inc CurX% If CurY% Mod 2=0 Then Inc CurY% Maze$(CurX%, CurY%) = " " ' generate maze done%=0 Do While done%=0 For i% = 0 To 99 OldX%=CurX% OldY%=CurY% ' move in random direction Select Case Int(Rnd*4) Case 0 If CurX%+2<MazeW% Then Inc CurX%,2 Case 1 If CurY%+2<MazeH% Then Inc CurY%,2 Case 2 If CurX%-2>0 Then Inc CurX%,-2 Case 3 If CurY%-2>0 Then Inc CurY%,-2 End Select ' if cell is unvisited then connect it If Maze$(CurX%,CurY%)="#" Then Maze$(CurX%,CurY%)=" " Maze$(Int((CurX%+OldX%)/2),((CurY%+OldY%)/2))=" " EndIf Next i% ' check if all cells are visited done%=1 For x%=1 To MazeW%-1 Step 2 For y%=1 To MazeH%-1 Step 2 If Maze$(x%,y%)="#" Then done%=0 Next y% Next x% Loop End Sub Sub on_exit() On Key 3, 0 Option Break 3 If Mm.Device$ = "PicoMiteVGA" Then FrameBuffer Close F Else Page Write 0 EndIf ctrl.term_keys() On Error Ignore Call ctrl$, ctrl.CLOSE On Error Abort End End Sub Function show_title$() Const X_OFFSET% = MM.HRes \ 2 Const Y_OFFSET% = MM.VRes \ 2 Cls Text X_OFFSET%, Y_OFFSET% - 15, "3D MAZE", "CM", 1, 2, RGB(Green) Text X_OFFSET%, Y_OFFSET% + 8, "(c) 2022 Martin Herhaus", "CM", 7, 1, RGB(Green) Local text$ = Choice(Mm.Device$ <> "MMBasic for Windows", "Press START, FIRE or SPACE", "Press SPACE") Text X_OFFSET%, Y_OFFSET% + 40, text$, "CM", 1, 1, RGB(White) If Mm.Device$ = "PicoMiteVGA" Then FrameBuffer Copy F, N, B Else Page Copy 1 To 0, B EndIf ' Prompt user to select controller. Select Case Mm.Device$ Case "PicoMiteVGA" Static POLL_THESE$(2) = ("keys_wasd", "nes_a", "atari_a") Case "Colour Maximite 2", "Colour Maximite 2 G2" Static POLL_THESE$(2) = ("keys_wasd", "wii_classic_3", "atari_dx") Case "MMBasic for Windows" Static POLL_THESE$(1) = ("keys_wasd", "keys_wasd") End Select Local ctrl$ = ctrl.poll$(0, POLL_THESE$()) Call ctrl$, ctrl.OPEN Cls If Mm.Device$ = "PicoMiteVGA" Then Framebuffer Copy F, N, B Else Page Copy 1 To 0, B EndIf show_title$ = ctrl$ End Function Sub keys_wasd(x%) If x% < 0 Then Exit Sub x% = ctrl.keydown%(32) * ctrl.A Inc x%, (ctrl.keydown%(Asc("w")) Or ctrl.keydown%(128)) * ctrl.UP Inc x%, (ctrl.keydown%(Asc("s")) Or ctrl.keydown%(129)) * ctrl.DOWN Inc x%, (ctrl.keydown%(Asc("a")) Or ctrl.keydown%(130)) * ctrl.LEFT Inc x%, (ctrl.keydown%(Asc("d")) Or ctrl.keydown%(131)) * ctrl.RIGHT Inc x%, ctrl.keydown%(Asc("m")) * ctrl.SELECT End Sub ' --- WallData --- Data 0,0,0,239,10,10,10,229 Data 11,11,11,228,50,50,50,189 Data 51,51,51,188,80,80,80,159 Data 81,81,81,158,100,100,100,139 Data 101,101,101,138,110,110,110,129 Data 111,111,111,128,120,120,120,120 Best wishes, Tom Edited 2022-11-08 08:54 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1193 |
PicoGAME version with keyboard, NES and Atari joystick support: maze-pm.zip CMM2 version with keyboard, Wii Classic and Atari joystick (on the G2 DX) support: maze-cmm2.zip The CMM2 version should also run with the keyboard on MMB4W. And here is the code of the PicoGAME version for those who are interested but cannot be bothered with actually downloading and running: Best wishes, Tom nice Mod,i will study it later. Maybe I'll learn the basics of the controller routines. ![]() Using Pages / Framebuffer makes the picture more stable, but you lose compatibility with the Non VGA PicoMites with ILI9341 LCDPANEL. Cheers Mart!n Edited 2022-11-08 14:02 by Martin H. 'no comment |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2394 |
PicoGAME version with keyboard, NES and Atari joystick support: maze-pm.zip CMM2 version with keyboard, Wii Classic and Atari joystick (on the G2 DX) support: maze-cmm2.zip The CMM2 version should also run with the keyboard on MMB4W. And here is the code of the PicoGAME version for those who are interested but cannot be bothered with actually downloading and running: Best wishes, Tom nice Mod,i will study it later. Maybe I'll learn the basics of the controller routines. ![]() Using Pages / Framebuffer makes the picture more stable, but you lose compatibility with the Non VGA PicoMites with ILI9341 LCDPANEL. Cheers Mart!n I would code for vga. lcd is not fast as vga. |
||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1193 |
PicoGAME version with keyboard, NES and Atari joystick support: maze-pm.zip CMM2 version with keyboard, Wii Classic and Atari joystick (on the G2 DX) support: maze-cmm2.zip The CMM2 version should also run with the keyboard on MMB4W. And here is the code of the PicoGAME version for those who are interested but cannot be bothered with actually downloading and running as usual, my NES wouldn't work but as long as it is connected to Port 2 the Program also ignores the Key presses or Atari Joystic on Port 1 ![]() Edited 2022-11-09 21:01 by Martin H. 'no comment |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
![]() Sounds like some wire is crossed somewhere, what NES controller have you got ? Perhaps it's one with a micro-controller inside (requiring 5V) instead of one based on a simple shift-register ? You might also try increasing ctrl.PULSE! Also are you using an "official" PicoGAME VGA board or a homebrew ? Try this test program: ctrl-test-pmvga.zip Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1193 |
Thank you Tom, I Use Mixtel90s PicoGame VGA Board V2.0 and the aliexpress "NES" Controller looks like yours I used your Test Program , Atari Joystick works an A and B exept the Fire Button (allways triggerd) The NES Controller just get some short results if I press A&B together. with No controller connected I got with F2: Atari Port A 2048 = A F3 Atari Port B 2176 I will probably have to check the solder joints and the resistor values ??again Edited 2022-11-10 03:36 by Martin H. 'no comment |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
Hi Martin, That definitely looks like you have at least one short. I'm pretty confident about the code and it is rock solid on my 1.4 PCB. That controller is cosmetically the same as the ones with the dodgy d-pads ![]() I suppose it is possible that you are the only user to have actually tried a 2.0 PCB and that a gremlin got into that version - I certainly haven't populated one yet, but will do so tomorrow - Mick how about you ? Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7515 |
The Atari fire button inputs are on GP14 (Port A) and GP15 (Port B). Both have a 150R pull-up resistor to 3V3 and a 100nF capacitor to Gnd. The pull-up is such a low value because pin 6 of the ports is also used as the supply to the NES controllers. These inputs are pulled low by the fire button and should never read as always triggered. I've just had a look at the circuit and SL6 files for version 2.0 and I can't see a problem. Values read for the NES controllers look very odd to me: 2048 is 10000000000 (11 bits) 2176 is 10010110000 As these are clocked serial inputs the PCB will either read them or not - you shouldn't get incorrect values, especially without a controller plugged in as the control and data lines have pull-up resistors. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
Hi Mick, 2048 is 10000000000 (11 bits) 2176 is 10010110000 Those are not the raw NES serial values, the "ctrl" library maps the outputs of all controllers onto the wider range of outputs returned by "Wii Classic Controller" as that is the one standard that the MMBasic manuals document. 2048 = Button A 2176 = Button A + Up Mick, have you built a PCB 2.0 ? Best wishes, Tom Edited 2022-11-10 06:46 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4857 |
Nes is 8 bit, snes is either 12 bit or can be read as 16 bit. PicomiteVGA PETSCII ROBOTS |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
And the 'ctrl' library uses neither, it uses the bitmap documented in the MMBasic manual for the Wii Classic Controller. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |