Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:35 30 Jun 2026 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 : Programming Advice

Author Message
NickMikhay
Newbie

Joined: 05/02/2026
Location: United States
Posts: 11
Posted: 12:02am 28 Jun 2026
Copy link to clipboard 
Print this post

Hello,

I have a question as I am getting to learn a little programming, and don't have any formal experience. I am trying to create a rudimentary program in MMBASIC for DOS, and to move it to the MM2 in the future.

The plan is to get a line input from the user and compare that string to a list of possible keywords in an array. That part is understandable.

However, I would like to use that string after some string manipulation code, to branch to another part of the program, preferably a label, but can be a sub.

In other words, use a string as an entry to a part of the program, which will end there,
or jump back to the start if the user wishes.

I thought this is what the eval(s$) function is for, and that
I would pass "GOTO Keyword"

eval("GOTO Keyword")  'Where Keyword is a variable obtained from user.

Or, just plain
Goto Keyword          'Where Keyword is a variable obtained from user at runtime.

Is this possible to do so in BASIC.
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 670
Posted: 12:18am 28 Jun 2026
Copy link to clipboard 
Print this post

  NickMikhay said  Hello,

I have a question as I am getting to learn a little programming, and don't have any formal experience. I am trying to create a rudimentary program in MMBASIC for DOS, and to move it to the MM2 in the future.

The plan is to get a line input from the user and compare that string to a list of possible keywords in an array. That part is understandable.

However, I would like to use that string after some string manipulation code, to branch to another part of the program, preferably a label, but can be a sub.

In other words, use a string as an entry to a part of the program, which will end there,
or jump back to the start if the user wishes.

I thought this is what the eval(s$) function is for, and that
I would pass "GOTO Keyword"

eval("GOTO Keyword")  'Where Keyword is a variable obtained from user.

Or, just plain
Goto Keyword          'Where Keyword is a variable obtained from user at runtime.

Is this possible to do so in BASIC.


Yes you can GOTO or GOSUB to a label but look at multiline IF-THEN-ELSE first

INPUT "Command";c$
IF c$="THIS" THEN
 do this code
ELSEIF c$="THAT"
 do some other code
ELSEIF c$="THE OTHER"
 do some other code still
ELSE
 finally, if the other choices don't fit, do this code
END IF
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1181
Posted: 04:04am 28 Jun 2026
Copy link to clipboard 
Print this post

Look at the "CALL" command.
(Maybe unavailable for the MM2.)
Edited 2026-06-28 14:06 by vegipete
Visit Vegipete's *Mite Library for cool programs.
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1462
Posted: 06:00am 28 Jun 2026
Copy link to clipboard 
Print this post

  vegipete said  Look at the "CALL" command.
(Maybe unavailable for the MM2.)
Oh yes, that was another thing.
Looks like that’s available on CMM2 too
https://geoffg.net/Downloads/Maximite/Colour_Maximite_2_User_Manual.pdf
Page 69
  Quote  CALL usersubname$
[,usersubparameters,....]
This is an efficient way of programmatically calling user defined subroutines
(see also the CALL() function). In many case it can allow you to get rid of
complex SELECT and IF THEN ELSEIF ENDIF clauses and is processed in
a much more efficient way. The “usersubname$” can be any string or
variable or function that resolves to the name of a normal user subroutine
(not an in-built command). The “usersubparameters” are the same
parameters that would be used to call the subroutine directly. A typical use
could be writing any sort of emulator where one of a large number of
subroutines should be called depending on some variable. It also allows a
way of passing a subroutine name to another subroutine or function as a
variable.


Edited 2026-06-28 16:02 by Martin H.
'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5957
Posted: 06:39am 28 Jun 2026
Copy link to clipboard 
Print this post

CMM2 and MM2 are 2 totally different platforms.

The MM2 is more like a picomite with version 5.5 MMbasic, less memory an 30% of the speed.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026