Menu
JAQForum Ver 19.10.27

Forum Index : Microcontroller and PC projects : Programming Advice

Posted: 12:02am
28 Jun 2026
Copy link to clipboard
NickMikhay
Newbie

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.
 
Posted: 12:18am
28 Jun 2026
Copy link to clipboard
toml_12953
Guru

  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
 
Posted: 04:04am
28 Jun 2026
Copy link to clipboard
vegipete
Guru


Look at the "CALL" command.
(Maybe unavailable for the MM2.)
Edited 2026-06-28 14:06 by vegipete
 
Posted: 06:00am
28 Jun 2026
Copy link to clipboard
Martin H.
Guru


  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.
 
Posted: 06:39am
28 Jun 2026
Copy link to clipboard
Volhout
Guru

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
 


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