new game (need loop fix)

All discussions about the Atari 8bit range of machines.

Moderators: Mug UK, Silver Surfer, Moderator Team

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12250
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: new game (need loop fix)

Postby wongck » Mon Feb 26, 2018 11:40 pm

Frank B wrote:I don't know basic. You'd need a function which returns a value and a calling routine above it with a switch statement or a load of ifs.

I do not know MSX basic.
From what i remember for AppleSoft Basic, there are GOSUB tbat are similar to function.
Also the scope of a variable in Basic is very simple, there is only one... that's global scope. So your return value can be read everywhere.

My guess at my Basic game now as I forgotten it, was that a huge loop using GOTO wrapping INPUT and bunch of IF then GOSUB statements.

Well, wonder if an infant can do of that, what can I say.....
My Stuff: FB/Falcon CT63+CTPCI_ATI_RTL8139 14+512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

MrPixel
Captain Atari
Captain Atari
Posts: 191
Joined: Mon Jan 08, 2018 4:31 am

Re: new game (need loop fix)

Postby MrPixel » Tue Feb 27, 2018 1:01 am

sorry for that comment. , can you post an example?

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12250
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: new game (need loop fix)

Postby wongck » Tue Feb 27, 2018 11:47 am

I guess something like this, just expand on it. Not even sure if it runs.
I am sure there are better example than this....

Code: Select all

10 print "Do something >"
20 input A$
30 if A$ = "W" then gosub 100
40 if A$ = "A" then gosub 200
50 if A$ = "S" then gosub 300
60 if A$ = "Z" then gosub 400
70 if A$ = "Q" then print "Bye": END
80 goto 10
100 print "you walked north" : return
200 print "you walked east" : return
300 print "you walked west" : return
400 print "you walked south" : return
My Stuff: FB/Falcon CT63+CTPCI_ATI_RTL8139 14+512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

MrPixel
Captain Atari
Captain Atari
Posts: 191
Joined: Mon Jan 08, 2018 4:31 am

Re: new game (need loop fix)

Postby MrPixel » Thu Mar 01, 2018 2:11 am

return without gosub in 100

MrPixel
Captain Atari
Captain Atari
Posts: 191
Joined: Mon Jan 08, 2018 4:31 am

Re: new game (need loop fix)

Postby MrPixel » Thu Mar 01, 2018 2:13 am

didn't work

MrPixel
Captain Atari
Captain Atari
Posts: 191
Joined: Mon Jan 08, 2018 4:31 am

Re: new game (need loop fix)

Postby MrPixel » Thu Mar 01, 2018 2:27 am

MrPixel wrote:it workedk

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 985
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: new game (need loop fix)

Postby FedePede04 » Thu Mar 01, 2018 5:26 am

did you use gosub or did you use goto?

gosub is like a BSR, JSR, CALL in asm (depend on processor) where you need a return
where goto is like Bra,jmp in Asm

Code: Select all

--- Gosub ---

10 gosub 100
20 print'now its my turn'
30 end
100 print ' me first'
110 return

--- Goto ---

10 goto 100
20 print'now its my turn'
30 end
100 print ' me first'
110 goto 20


Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 985
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: new game (need loop fix)

Postby FedePede04 » Thu Mar 01, 2018 5:28 am

btw here is a basic manual for the msx
https://books.google.dk/books?id=Qo-GDA ... sx&f=false
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12250
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: new game (need loop fix)

Postby wongck » Thu Mar 01, 2018 11:43 am

Not surprised if it does not work as the BASIC flavour is AppleSoft. :D
Also it is not tested and was off the top of my head.
My Stuff: FB/Falcon CT63+CTPCI_ATI_RTL8139 14+512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 985
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: new game (need loop fix)

Postby FedePede04 » Thu Mar 01, 2018 12:01 pm

wongck wrote:Not surprised if it does not work as the BASIC flavour is AppleSoft. :D
Also it is not tested and was off the top of my head.


hi wongck

the error he is getting sound like he is hitting the a return with out a gosub first
indicate that he did not use gosub or he is missing the loop line in line 80.

as i recall it, the input$ is not good using on the MSX he should be using inkey$ instead of, but else you code is looking good :D
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12250
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: new game (need loop fix)

Postby wongck » Thu Mar 01, 2018 1:47 pm

Well, Simon, on the other thread, pointed him to some very good games writing resource and that's all in BASIC.
Should not really need this any more, as there are plenty of examples there.

And coming back to say "don't work" while not showing the code or where the error is, really does not help himself.
One can only make a guess at what the problem was and say something, but may be barking at the wrong tree.
really that code snippet of mine is so simple I cannot see where it can go wrong, other than mistyping typo.
My Stuff: FB/Falcon CT63+CTPCI_ATI_RTL8139 14+512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 985
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: new game (need loop fix)

Postby FedePede04 » Thu Mar 01, 2018 7:17 pm

you are right wongck
its was also the reason why i wrote and support you code, it is very simple and if you can't make that work, then you have a very long way to go before you can do a game.

it is also the reason that i post the link for the MSX manual, it is filled with code examples so he can learn how to code on the MSX.
one need to start at a place, but to start with coding a game, is maybe setting the bar too high.


edit:

Link to MSX books
http://msx.hansotten.com/books/
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

joska
Hardware Guru
Hardware Guru
Posts: 3877
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: new game (need loop fix)

Postby joska » Thu Mar 01, 2018 9:11 pm

MrPixel wrote:didn't work


What you need to do at this stage is what we did back in the 80's - sit down in front of the computer with a crappy manual and lots of spare time, and start playing with it. Too many of today's programmers "learn" programming by copy/paste from forums and tutorials without making the effort to really understand what their copied code does.
Jo Even

Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64

MrPixel
Captain Atari
Captain Atari
Posts: 191
Joined: Mon Jan 08, 2018 4:31 am

Re: new game (need loop fix)

Postby MrPixel » Thu Mar 01, 2018 9:39 pm

i understand. i will lean a bit more. thank you all for your help

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 985
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: new game (need loop fix)

Postby FedePede04 » Thu Mar 01, 2018 10:32 pm

MrPixel wrote:i understand. i will lean a bit more. thank you all for your help


good luck with it, the MSX basic is actual quite good, and i actual consider buying one my self, to learn my son how to code(He keep asking me :lol: )

and use the MSX forum instead of, they probably know alot more, about the MSX that we do here, and have fun while you are learning, these are the most important advice i can give you.
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

MrPixel
Captain Atari
Captain Atari
Posts: 191
Joined: Mon Jan 08, 2018 4:31 am

Re: new game (need loop fix)

Postby MrPixel » Fri Mar 02, 2018 12:26 am

i appreciate it. can someone look at the Worst of sega cd thread?


Social Media

     

Return to “The Atari 8bit corner”

Who is online

Users browsing this forum: No registered users and 1 guest

cron