Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:01 21 Oct 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 : miniFM

     Page 1 of 2    
Author Message
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 07:52pm 13 Oct 2025
Copy link to clipboard 
Print this post

Hello!

It was open in a tab in my editor and I haven't touched it for months. Now I found the time to add the for me missing peaces. I have just finished it and it isn't fully tested but looks very good.

So this is, with many thanks @ Javavi for his nice code, a minimal version of his FM172. I added and modified some lines and deleted all I don't need.

The changes:

it runs on all platforms in colour
it resizes putty and leaves a clean screen when closed
uses only characters below 128 so looks good in every constellation
all Coulour calls are replaced by a sub routine call
the subroutine sets the colour for console and/or screen
the terminal size for console only can be set with a variable at the beginning
colours for cursor and F-keys can be set with a variable at the beginning
replaced the ISR to set the time
clears the input buffer for inkey$ so cursor stops immediately
added a keypress_delay variable because it's too fast now.
Runs perfect on my ssd1963 LCD on a RP2040 (which was the major reason doing it)

This is a one time work I don't want to follow up because it runs good enough for me.


miniFM.zip



Edit:

I forgot to include HDMIUSB and VGAUSB to have tiling. Line 30 needs to be:
If Field$(MM.DEVICE$,1," ") =  "PicoMiteVGA" Or Field$(MM.DEVICE$,1," ") = "PicoMiteHDMI" or Field$(MM.DEVICE$,1," ") = "PicoMiteVGAUSB" or Field$(MM.DEVICE$,1," ") = "PicoMiteHDMIUSB" Then

Edited 2025-10-14 06:41 by dddns
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5357
Posted: 12:11pm 14 Oct 2025
Copy link to clipboard 
Print this post

Thanks dddns,

Works nice on my 2040 VGA system, on both terminal (putty/MMCC) and VGA screen.
You have removed some functions, okay for me. The only remark I can make is that when closing the filemanager, on the VGA screen there is "[7 [2J [H". Probably data that is send to the terminal, but also shows up on the VGA screen.

Maybe you can shorten line 30 with INSTR(MM.DEVICE$,"HDMI") or INSTR(MM.DEVICE$, "VGA").

It is good this version exists. It may be the version Peter would default add to MMBasic since it works across all platforms.

I'll leave your mini version on my 2040 system for further testing (although you indicated no bug fixes will be done on this version).

Volhout
Edited 2025-10-14 22:13 by Volhout
PicomiteVGA PETSCII ROBOTS
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 03:42pm 14 Oct 2025
Copy link to clipboard 
Print this post

  Volhout said  The only remark I can make is that when closing the filemanager, on the VGA screen there is "[7 [2J [H". Probably data that is send to the terminal, but also shows up on the VGA screen.

Maybe you can shorten line 30 with INSTR(MM.DEVICE$,"HDMI") or INSTR(MM.DEVICE$, "VGA").
Volhout


Hello Volhout,

thanks for testing. The above is fixed.

I started this morning making it explicit compliant.
I turned it completely into a library which can be called from command line or within a program:
Option explicit                                                                                      
Dim fm_is_initialized                                                                                
minifm                                                                                              
Print "back"                                                                                        
End

From command line as well as in programs it starts in any condition.

miniFM_explicit.zip
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5357
Posted: 05:37pm 14 Oct 2025
Copy link to clipboard 
Print this post

Hi ddddns,

I cannot use the library version. Sorry. I use the library dynamic, and Petrobot uses flash slot 3.
I reserved flash slot 2 for the filemanager, so I will use miniFM.
I will check what you fixed, and make the same fix in miniFM.

Volhout
PicomiteVGA PETSCII ROBOTS
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 05:41pm 14 Oct 2025
Copy link to clipboard 
Print this post

It's just an option. Add
minifm

at the top of the code and let it run.
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 05:54pm 14 Oct 2025
Copy link to clipboard 
Print this post

The only reason to do this was that it runs under explicit. The library function is a side product.The splitoff of the init section can be reverted just in 5 min..
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5357
Posted: 06:44pm 14 Oct 2025
Copy link to clipboard 
Print this post

Hi dddns,

Coming from mode 2 (vga game) the terminal scales to 320x240.

This solves it

 Dim integer vid_mode
 Font 1
 
 If MM.DISPLAY Then
   if instr(mm.device$,"VGA") or instr(mm.device$,"HDMI") then '@harm
     'If Field$(MM.DEVICE$,1," ") =  "PicoMiteVGA" Or Field$(MM.DEVICE$,1," ") = "PicoMiteHDMI" Then
     MODE 1 : Font 1 : TILE HEIGHT MM.Info(FONTHEIGHT)
     Const FW = MM.Info(FONTWIDTH) : FH = MM.Info(FONTHEIGHT)
     Const CHRES = MM.HRES / FW:CVRES = MM.VRES / FH
     vid_mode = 1
   else
     Const FW = MM.Info(FONTWIDTH) : FH = MM.Info(FONTHEIGHT)      
   End If
   Print Chr$(27) + "[8;" + Str$(MM.HEIGHT) ";" + Str$(MM.WIDTH +1) + "t"; 'set terminal size
   Option console both
 Else
   Const FW = MM.Info(FONTWIDTH) : FH = MM.Info(FONTHEIGHT)
   Const CVRES = tty_console_row : CHRES = tty_console_col
   Option display tty_console_row, tty_console_col
   Print Chr$(27) + "[8;" + Str$(tty_console_row) + ";" + Str$(tty_console_col + 1) + "t"; 'set terminal size
 End If


Volhout

P.S. it is a bit clumsy, defining FH and FM in 3 different locations. But it works.
Edited 2025-10-15 04:46 by Volhout
PicomiteVGA PETSCII ROBOTS
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 07:25pm 14 Oct 2025
Copy link to clipboard 
Print this post

Hello Volhout,

the section you refer to is from yesterday or so. The variables are dimmed wrong I think. I have rewritten that. I have corrected a bug I brought in an this starts again directly but by commenting out the first call it can be used as library.

miniFM.zip
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5357
Posted: 07:38pm 14 Oct 2025
Copy link to clipboard 
Print this post

Hi dddns,

No, you did not fix the issue. The problem is that you are defining a few constants, and then change to mode 1 (MM.HRES etc.. change)

If you are in mode 2 when starting the miniFM you get this (both VGA and console(both Putty and MMCC)):



My changes fixed that.

Volhout
Edited 2025-10-15 05:41 by Volhout
PicomiteVGA PETSCII ROBOTS
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 07:51pm 14 Oct 2025
Copy link to clipboard 
Print this post

But there are no constants any more!? Everything is integer now.
Otherwise the ":" seems not to be correct, is it?

edit:
That only worked because it ran in Option default integer. In your case the variable behind the ":" was dimmed automatic as integer while the other one was a Const
Edited 2025-10-15 05:57 by dddns
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5357
Posted: 08:00pm 14 Oct 2025
Copy link to clipboard 
Print this post

Hi dddns,



Volhout
PicomiteVGA PETSCII ROBOTS
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 08:14pm 14 Oct 2025
Copy link to clipboard 
Print this post

Ok. So if it still exists would you please post the corrected section from version of the last zip that I can copy/paste.
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 09:35pm 14 Oct 2025
Copy link to clipboard 
Print this post

Just to get it straight once. I found another bug and quick tested it for VGA(coming from Mode 2 Font 5), 800x480 LCD and console only.

miniFM.zip
Edited 2025-10-15 07:37 by dddns
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8221
Posted: 07:00am 15 Oct 2025
Copy link to clipboard 
Print this post

I like this concept. A simple, basic FM is all that's needed most of the time. Being able to view pictures, play sounds etc. is fine but those can be done from the command line anyway - and that's where you will usually be running a FM from. More facilities are a "nice to have" but not really necessary. It's far more important to be able to run the FM on different displays.
Mick

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

Joined: 05/03/2018
Location: Netherlands
Posts: 5357
Posted: 07:31am 15 Oct 2025
Copy link to clipboard 
Print this post

Hi dddns,

When you are in mode 2 VGA, in line 40 you change to mode 1.

When changing mode 2 to mode 1 following changes
MM.INFO(FONTWIDTH) ---- I did not expect this but it changes
MM.INFO(FONTHEIGHT) --- I did not expect this but it changes
MM.VRES --- obvious
MM.HRES --- obvious

So every calculation using these variables need to be re-done.
In your code

Between line 40 and line 41, insert

FW = MM.Info(FONTWIDTH): FH = MM.Info(FONTHEIGHT)


That should do the job

Volhout
Edited 2025-10-15 17:31 by Volhout
PicomiteVGA PETSCII ROBOTS
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 07:57am 15 Oct 2025
Copy link to clipboard 
Print this post

Good morning Volhout,

did you test the latest zip? I tested it on VGA and setting mode 2 or mode 3 and then execute fm works for me, screen and console.
Please test it and if it really still happens I will post another update with the lines included.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5357
Posted: 08:05am 15 Oct 2025
Copy link to clipboard 
Print this post

Hi dddns,

I am now on a business trip (left this morning), first chance I have on a VGA picomite is when I get home. Sorry, no short term testing possible on VGA.
I do have 2040-GEEK with me, so I can test the console version only.

But there is one thing you can do if you have a VGA system.


mode 2 : font 1
print mm.info(fontwidth)
mode 1 : font 1
print mm.info(fontwidth)


In mode 2 value is 6, in mode 1 value is 8. That means that your calculated
CVRES = MM.VRES / FH, CHRES = MM.HRES / FW
have the wrong value if you do not re-calculate FH and FW.

Volhout
Edited 2025-10-15 18:10 by Volhout
PicomiteVGA PETSCII ROBOTS
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 08:09am 15 Oct 2025
Copy link to clipboard 
Print this post

no hurry and nice trip!
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 02:27pm 19 Oct 2025
Copy link to clipboard 
Print this post

Hello!

I spent the last days to get it complete.

The changes:

- the init routine is complete
- the main loop is done
- dialogs are rewritten and done
- dialogs and everything is centered
- dialogs have an option for confirm, "yes to all" and cancel
- you can set behavior for confirm and overwrite
- Everything scales correctly from 5 x 37 to 100 x 240 characters terminal size
- on VGA and HDMI in all Mode 1 resolutions
- Took special care for LCD and it should run from ILI9341 320x240 to any.
- On LCD you can chose any system font
- code cleanup and formatting

There are still minor cosmetic issues.
Error handling is not done yet

I haven't touched the backend subroutines at all. All I can say is that they run super stable and deliver correct answers.

Please test this and comment!

minifm_RC.zip
smallest possible, here 40x20 like on a ILI9341:

Standard 80x24:

'Custom variables-----------------------------------------------------
 Dim integer confirm_each = 1 '0:Don't ask, 1:always ask
 Dim integer overwrite = 0 '0: alwasy ask, 1: don't ask
 Dim integer run_bas = 0 ' disable Enter to execute .bas file
 Dim integer lcd_font = 1 ' 0 to use system setting
 Dim integer tty_console_row = 24 'terminal height, min = 5 max = 100
 Dim integer tty_console_col = 80 'terminal width, min = 37 max = 240
 Dim integer cursor_colour = 7
 Dim integer fn_colour_bc = 7 'F Key colour
 Dim integer fn_colour_fc = 0
 Dim integer clock_bc = 14
 Dim integer clock_fc = 3
 Dim integer keypress_delay = 20 'in mSec
 Dim integer DnFColor=0  'Dirs & Files Color (0=Colorer ON)
 Dim integer SelColor=14 'Color of selected files
 Dim integer RMAX=199    'Max number of Records in File List (255 max)
 '---------------------------------------------------------------------

Edited 2025-10-20 00:28 by dddns
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 640
Posted: 02:40pm 19 Oct 2025
Copy link to clipboard 
Print this post

ps: dialogs are rewritten means, that copy, move and delete are done with one consolidated subroutine. So this definitely has impact. Please test it.
E.g. It does no error handling and prevents to copy a directory into itself on the same drive.
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025