Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 18:47 14 Nov 2025 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 : CMM2: MODE conundrum

Author Message
djwildstar
Newbie

Joined: 29/07/2020
Location: United States
Posts: 24
Posted: 09:01pm 30 Aug 2020
Copy link to clipboard 
Print this post

I'm trying to figure out how MODE and OPTION DEFAULT MODE interact, and have run into a few unexpected situations.  I've checked the documentation and I haven't found answers, but I'm a newbie and maybe I'm looking in the wrong places.

I'm using MMBasic 5.05.05b22.

Working with OPTION DEFAULT MODE 9, I was able to confuse the display a bit.  I suspect this is a bug:
Load up any program that is more than a screenful of code, and perform the following actions:
LIST <enter> and press <space> as many times as needed to page through the program.  Then type:
PRINT MM.INFO(MODE) <enter>
Note that your command prompt is now down in the status line.  Try
LIST <enter>
Again and note that the screen empties, and the entire program scrolls through the status line.  A reset or Control-C will fix the issue.  I have also tried this sequence with OPTION DEFAULT MODE 1 in effect and observed the same issue.


I also observed a few strange behaviors, but I suspect these are undocumented features (not bugs).

OPTION DEFAULT MODE seems to set the current display mode as well.  In other words, it not only stores a new power-on default, but also sets that same display mode immediately, with the side-effect of clearing the screen  This makes sense, but was unexpected.

It also appears that some commands have a side-effect of setting the current display mode back to the default.

In particular, the editor and file manager run in the default mode (even if a different display mode has been set), and return the display to the default mode when they exit (even if the display was in a different mode when they were entered).

The following examples assume that OPTION DEFAULT MODE 1 is in effect.  I haven't tried all of the other modes, but they work the same way if OPTION DEFAULT MODE 9 is in effect and you use MODE 1 in the examples below.

MODE 9 <enter>
LIST FILES <enter>
The file list is displayed briefly, and then the screen clears.
PRINT MM.INFO(MODE) <enter>
Returns 1.8 (the default mode) and not 9.8.  I find this confusing, because the mode change (and screen clear) takes effect after the file list is produced - meaning that you cannot see the list of files unless the current mode is the same as the default mode.  If LIST FILES is supposed to change the display mode back to default, shouldn't it do so before it outputs the listing, so that the user can see the output?

Any error seems to reset the mode to the default.
MODE 9 <enter>
ARGLEBARGLE <enter> results in "Error: Unknown command".  
PRINT MM.INFO(MODE) outputs 1.8 (the default mode).
This makes sense, on the theory that the user might be in a strange display mode that isn't supported by their monitor and therefore cannot see what they are typing.  

Input a program that consists of two lines: PRINT MM.INFO(MODE) and PAUSE 1000.  Then do:
MODE 9 <enter>
RUN <enter>
The program will display its output, and return to the prompt.  At the prompt type:
PRINT MM.INFO(MODE) <enter>
And we're now back in the default mode.  What is interesting is that starting a program via RUN didn't change the mode, but returning to the command prompt after running a program did change it to the default.  Again, I don't see this as a problem (and it is probably helpful if you are working on a game program that changes the display mode but would prefer to see files and code in a different mode).  

MODE 9 <enter>
EDIT <enter>
PRINT MM.INFO(MODE) <enter>
results in 1.8 (the default mode).  The same sequence also works with the FILES command to run the file manager.  I can see where it makes sense to run the editor and file manager in the default mode (particularly when the currently-set mode may be a low-resolution one where the these tools won't work well), but I didn't see this in the documentation.

I had expected that NEW would set the screen mode back to the default (it does), and that RUN might also (but not in the way I expected).  I was surprised that other commands changed it as well.  Is there a list somewhere of which commands change the display mode and which do not?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10581
Posted: 07:15am 31 Aug 2020
Copy link to clipboard 
Print this post

Nearly all actions on the CMM2 outside of a running program will return the screen to default mode. This is intended. The only thing that doesn't is executing a "correct" command at the command line after a mode has been set at the command line.

The issue with list is a bug - I thought I'd found all instances of that  
As you correctly report the workround is to press Ctrl-C to reposition the cursor.

PS: if you download and install V5.05.05 again you might find it is magically fixed  
Edited 2020-08-31 19:05 by matherp
 
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 2025