Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:07 27 Apr 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 : Autoconfig

Author Message
DaveC5
Newbie

Joined: 24/09/2025
Location: United Kingdom
Posts: 40
Posted: 07:40am 25 Apr 2026
Copy link to clipboard 
Print this post

Hi,

Is it possible to alter the OPTIONs based on an external input? Not all OPTIONs, perhaps, but maybe the screen resolution i.e. a short routine that checks for an input and sets the screen resolution based on it on-the-fly.

Also, is it possible to have this running as a kind of terminate-and-stay-resident?

Be gentle ... I'm not a programmer!

Dave
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8781
Posted: 11:55am 25 Apr 2026
Copy link to clipboard 
Print this post

RESOLUTION should be set as close to the native resolution of your monitor that you can get. This can be regarded as a hardware setting that you couldn't change via an external input.

MODE lets you change the display at any time, but the number of variations is restricted by the RESOLUTION. You can certainly change MODE depending on an external input.

Most OPTIONs are used to configure MMBasic to particular hardware. As such you shouldn't ever need (or want) to change them under software control - it would be like changing the attached hardware.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
DaveC5
Newbie

Joined: 24/09/2025
Location: United Kingdom
Posts: 40
Posted: 02:18pm 25 Apr 2026
Copy link to clipboard 
Print this post

... unless of course, you wanted to change the hardware
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8781
Posted: 02:47pm 25 Apr 2026
Copy link to clipboard 
Print this post

Oh, you can change the hardware, that's not a problem. You just can't change it unless you configure MMBasic to use it - and you can't do that while MMBasic is using it. :)

AFAIK the options indicated in the manual as "permanent" are saved to a reserved flash area. They are used to set up things like audio and display drivers, where there may not be enough RAM to have more than one that can be used. The drivers for a particular version of MMBasic are there in the firmware, but you can't switch between them as their system requirements vary.

Different versions of MMBasic are specific. e.g. there are no VGA drivers compiled into the HDMI version and vice versa. They simply aren't there.

The different HDMI resolutions differ in CPU clock speed and you can't change that while MMBasic is running, only by restarting the CPU (triggered automatically by changing the resolution).
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
DaveC5
Newbie

Joined: 24/09/2025
Location: United Kingdom
Posts: 40
Posted: 03:12pm 25 Apr 2026
Copy link to clipboard 
Print this post

Thanks Mick.

What I'm wondering then is; is it possible to run a routine *on startup* that performs a simple check on an external (something e.g. resistor value) that then invokes the OPTION RESOLUTION command, which will then reboot the Pi into the correct mode for the hardware that the (something) has identified.

Probably a daft idea, but I'm tinkering with the idea of building Peter's Palm Pico but without the display/keyboard built-in, just with a header connector to which I can plug either a small hand-sized keypad and screen for portability or a larger keyboard and screen for convenience. That way I could cart round the same core computer but configure it as a handheld, tablet(-ish) or laptop scale device.

I'm sure there would be a way of manually reconfiguring the display setting, but I thought it would be neat if the Pi just checked a resistor value or something and then automatically configured itself to whichever platform it found itself. Assuming the different formats used the same LCD chip.


Dave.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8781
Posted: 03:26pm 25 Apr 2026
Copy link to clipboard 
Print this post

I don't think you can as I think it has to be entered at the command line.
You could try the EXECUTE command, with your program set to AUTORUN. The EXECUTE would change the CPU speed and cause it to reboot - hopefully starting your program. Unfortunately some commands are specifically blocked from being EXECUTEd and RESOLUTION could well be one of them. You couldn't call it from a routine, your program would start as from NEW.


EDIT:
On further reading, have you tried a simple OPTION RESOLUTION nn [,cpuspeed] command in your program? The system may reboot anyway, but if you use AUTORUN it should restart in the new resolution. You could VAR SAVE info before doing it to get the correct mode number or something.


ANOTHER EDIT:
Ah!... You mentioned LCD chip. There are no OPTION RESOLUTION or MODE commands, your resolution and colour depth are set by the LCD display, which is defined in the OPTION command. Once again, you could try to run that option in your program before anything writes to the display.

.
Edited 2026-04-26 01:44 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 284
Posted: 03:37pm 25 Apr 2026
Copy link to clipboard 
Print this post

G'day Dave,
There is the command END cmd$ that will exit from a program and run the cmd$ string at the command prompt, just tried the following and it may do what you require:


' prog to test resolution change
if MM.HRES = 640 then End "Option Resolution 800x480"

end


If you run this with the resolution set to 640 then it will reset the resolution to 800x480

So the following may work:

'prog to set screen resolution
' setup pins etc
if (pin(gp0)=0) and (MM>HRES <> 640) then END "Option Resolution 640"
if (pin(gp0)=1) and (MM>HRES <> 800) then END "Option Resolution 800x480"
.....

Option Autorun should restart the program again.

Hope this helps, I've learnt something new for today  

Regards, Lyle.
Edited 2026-04-26 01:47 by mozzie
 
DaveC5
Newbie

Joined: 24/09/2025
Location: United Kingdom
Posts: 40
Posted: 03:43pm 25 Apr 2026
Copy link to clipboard 
Print this post

Thanks Mick and Mozzie,

That's given me something to think about.

First problem is squashing everything into something the size of a gnat's knapsack.

Cheers
Dave
 
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