Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:18 01 Sep 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 : MMBasic for Windows - alphas

     Page 5 of 12    
Author Message
Goksteroo
Senior Member

Joined: 15/03/2021
Location: Australia
Posts: 114
Posted: 09:44am 20 Feb 2022
Copy link to clipboard 
Print this post

Matherp (or other gurus), I've had troubles running mode 16 - I get various corrupted characters on the screen. From what I've investigated, these corrupted characters are because the Window for MMB4W is not displaying a full 1920x1080 res and consequently the little bit of compression corrupts part of the screen. Mind you, the window fits exactly on my screen but MMB4W does not fill that window up (see left margin in the attached pic). Is this just my setup?


 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10377
Posted: 10:07am 20 Feb 2022
Copy link to clipboard 
Print this post

  Quote  Is this just my setup?


Yes: sort of. You need a monitor resolution bigger than the mode you choose. My monitor is 4K and mode 16 works perfectly.
 
Goksteroo
Senior Member

Joined: 15/03/2021
Location: Australia
Posts: 114
Posted: 10:26am 20 Feb 2022
Copy link to clipboard 
Print this post

Thought that might be the case - no biggy
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10377
Posted: 11:55am 20 Feb 2022
Copy link to clipboard 
Print this post

I can create a mechanism to go full screen which will solve it - I'll include that in the next release
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5195
Posted: 02:03pm 20 Feb 2022
Copy link to clipboard 
Print this post

How to use serial ports in Linux when running MMB4W under Wine.
Tested on Ubuntu 20.04LTS (20.04.03).

- Install Wine (instructions from Ubuntu website, this does not install the latest version of Wine, but that is not essential for this post).

Most of us will use USB serial convertors using FTDI or CH340 chips. Good news: Linux does not require you to install specific drivers. All drivers (als for cheap chinese copies) are in the linux kernel.

Wine emulates windows in linux, and for serial ports it uses symbolic links to the linux serial ports. In linux these serial ports (devices) are visible as objects in the folder /dev/. The serial ports have a group identification (tty) extended with a type identification (i.e. S) and number (0...32).

The first serial port on a linux system would be /dev/ttyS0.
If you open a terminal in linux and type ls /dev/tty* you get an overview of all serial ports.

The type designator (the "S")  can have different types
S = hardware serial port
USB = USB-serial convertor (this type is used by FTDI chips)
ACM = USB modem (this type is often used by Arduino and the CH340 uses it also)

Linux automatically enumerates new serial ports when a USB-serial cable is plugged in. This is a convernience (easy) and an annoyance (2 USB serial ports are not always enumerated in the same order, so you can easily accidentally swap them).

Wine

Wine lives within the Linux system in the users space. In Ubuntu the user has a home folder, and in this folder you find folders like "Documents", "Downloads", etc.. very similar to Windows user space.

In this user space Wine uses a hidden folder called ".wine" (in Linux folders becomme hidden when the folder name starts with a period "."). You can view this folder in the file browser when enabling view of hidden folders (and then you will see many more hidden folders, but .wine is one of them once you have started wine once.

In user space the folder .wine/dosdevices shows the locations where Wine interfaces with the linux system. You can find a link to your C drive, and links to serial ports.
Every time you start Wine, the folder .wine/dosdevices is refreshed, so it is not advised to make changes to the links in this folder, they will get lost.

Wine re-writes the contents of this folder with links to serial ports in the /dev/ttyS* list, and these are defaulted to hardware serial ports (ttyS0...ttyS32).
It links COM1 to /dev/ttyS0, COM2 to /dev/ttyS1 etc...).

So how do we attach a USB serial port to MMB4W running under Wine...? All are attached to non existing hardware ports. Wine will add the /dev/ttyUSB0 after the first 32 hardware serial ports. so it will become COM33. When your program cannot handle COM33 (I expect MMB4W will, but some programs can not, they are restricted to COM1..COM4) then you need to force Wine to use the USB serial interface as COM1. This is how:

Regedit !

In the linux terminal, type regedit. You will start Wine's registry editor.
In HKEY_LOCAL_MACHINE/software/wine/ports you can find serial ports. This section is empty (only the default is there). When you add "COM1" with value "/dev/ttyUSB0" it will be replacing the default com1 link to /dev/ttyS0 to /dev/ttyUSB0.

See below picture that shows (in Ubuntu 20.04) the folder .win/dosdevices with many serial port links, and a link fopr the C drive. It shows the terminal where you start regeedit, and it shows an example in regedit, where I define the com1 link to /dev/ttyUSB0



For basic usage, when only 1 or 2 USB-serial interfaces are attached, this may suffice. You simply add a second entry in Regedit with com2 linking to /dev/ttyUSB1

For more complex setups, Linux can use rules, based on the manufacurer and serial number of the USB-serial convertor chip to identify each of them uniquely. When there is interest I can write a post about that.

So does it work .... YES

U used following simple terminal program to communicate between MMB4W running under Wine, with a CMM2. In between a FTDI TTL-232RG cable.

'very simple terminal program

open "com1:9600" as #1

do
 do
   if loc(#1) <> 0 then
     b$=input$(loc(#1),#1)
     print b$;
   end if
   a$=inkey$
 loop until a$<>""
 print #1,a$;
loop until a$="q"


The only quirck I found is that the CMM2 and MMB4W under Wine use a different terminator (<LF> and <CR><LF>) but that is easily overcome....
Edited 2022-02-21 00:41 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8042
Posted: 02:53pm 20 Feb 2022
Copy link to clipboard 
Print this post

If you don't mind, Volhout, I'll include this in the MMB4W document.

I'll also include Tassy Jim's colour bar demo if there's no objection.

It's easier to find this useful stuff if it's all in one place. :)
Mick

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

Joined: 05/03/2018
Location: Netherlands
Posts: 5195
Posted: 06:07pm 20 Feb 2022
Copy link to clipboard 
Print this post

Hi Mick,

Thank you for working on a manual. Yes you can add this to the document.

Regards,

Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8042
Posted: 06:18pm 20 Feb 2022
Copy link to clipboard 
Print this post

Cheers, it'll be in the next release.

(Now where have I heard that before?)
Mick

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

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 299
Posted: 08:35pm 20 Feb 2022
Copy link to clipboard 
Print this post

matherp,

If sound functions causes crashes on win7 maybe we can have some kind of switch to turn off  sound functionality while running from CMD for example? (in case you would decide to drop WIN7 compatibility. WIN7 lovers will better welcome WIN7 compatible MMbasic version, sure   )
My MMBasic 'sand box'
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1116
Posted: 02:23am 21 Feb 2022
Copy link to clipboard 
Print this post

GUI BARGAUGE problem

MMBasic 5.07.03a4

BARGAUGE does not recognise colour arguments - on a CMM2, the following program shows a gauge increasing red thru yellow then green. In MMB4W,it just displays the foreground and background colours with the foreground colour increasing up to the first threshhold point then the background colour for the rest of the gauge.


GUI BARGAUGE #1,0,100,300,20,rgb(white),rgb(black),0,100,rgb(red),40,rgb(yellow),55,rgb(green),100

do
 for x = 0 to 100 step 2
 ctrlval(#1) = x
 pause 1000
 next x
loop

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Goksteroo
Senior Member

Joined: 15/03/2021
Location: Australia
Posts: 114
Posted: 02:37am 21 Feb 2022
Copy link to clipboard 
Print this post

Error induced with mid$(p$,x,1)="*" if len(p$)>127
option default integer
p$=space$(255)
mid$(p$,10,1)="*"
gives
[3] MID$(p$,10,1)="*"
Error : 10 is invalid (valid is 1 to -1)

Change length of P$ to 127 or less and all is OK.
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1116
Posted: 02:38am 21 Feb 2022
Copy link to clipboard 
Print this post

GUI GAUGE problem

Similar to the BARGAUGE problem. On the CMM2, the circular gauge has the three threshhold colours low intensity. As the value increases, the intensity is changed to full intensity.

In MMB4W, there is no low intensity colour and the first threshhold colour defaults to the foreground colour. The second and third threshhold colours display correctly.

The following program demonstrates:-

GUI GAUGE #1,200,200,50,rgb(white),rgb(black),0,100,2,"deg",rgb(red),40,rgb(yellow),55,rgb(green),100

do
for x = 0 to 100 step 2
ctrlval(#1) = x
pause 1000
next x
loop

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10377
Posted: 07:52am 21 Feb 2022
Copy link to clipboard 
Print this post

Gokstero and Panky

Thanks for the bug reports - I'm pleased to say both easy to fix.
Major new update coming later today (I hope) with include files etc.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10377
Posted: 01:26pm 21 Feb 2022
Copy link to clipboard 
Print this post

V5.07.03pa5

MMBasic.zip

I'll probably forget stuff as there are a lot of changes

Bug fixes to GUI and MID as above
Various Bug fixes to other graphics relating to transparency

New command CONSOLE. This is the same as print but puts output to the console window - perfect for debugging

Main window now has minimise and maximise capability - thanks to Romeo for the how

All # commands as per CMM2 (INCLUDE, DEFINE, COMMENT)

Mode command - use a negative value for the mode and you will get fullscreen with no border e.g. MODE -16 will fill a 1080p monitor perfectly

Mode command - now accepts 8,12, 16, and 32 as valid bits/pixel as well as 0 and 1. 8,16, and 32 are converted to 0 i.e. RGB888. 12 is converted to 1 i.e. ARGB8888

Mode 14 = Mode 12 but 2 screen pixels per logical pixel

PLAY EFFECT now implemented as per CMM2

This has all been tested with Mauro's Wolf3d and DemoX. Both run as downloaded from  https://github.com/mauroxavierneto with no changes.
Gauntlet nearly runs but Mauro does some PEEK and POKEing into the framebuffer which  needs changing form 8-bit to 32-bit


Things to do: Change all file and path input to properly Canonicalize the pathnames

Issues: Still a problem with focus after mode changes - you need to click the mouse to activate keyboard input

Source open and available on https://github.com/UKTailwind/MMB4W
 
Michal
Senior Member

Joined: 02/02/2022
Location: Poland
Posts: 125
Posted: 02:35pm 21 Feb 2022
Copy link to clipboard 
Print this post

WOW it's alive !!!

Michal
 
Romeo

Newbie

Joined: 11/02/2022
Location: France
Posts: 24
Posted: 02:35pm 21 Feb 2022
Copy link to clipboard 
Print this post

  matherp said  V5.07.03pa5

Full open source! Wooaaaaaaaa!!!
Full screen mode!! Woaaaaaaaaaaaaa!!
It's Christmas again!
Thank you Sir!! Now let's make it roll!  
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8042
Posted: 02:42pm 21 Feb 2022
Copy link to clipboard 
Print this post

I suppose I'd better update the paperwork then...

MMBasic For Windows 220221.pdf
Mick

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

Joined: 09/06/2017
Location: Finland
Posts: 375
Posted: 03:20pm 21 Feb 2022
Copy link to clipboard 
Print this post

Tested CONSOLE in a5:

In Pixel Game Engine:
Extract from program. V and Vold are both DIM as FLOAT.
Vold=V
CONSOLE "Vold=";Vold


Output in MMBasic.exe window
Vold= 1.390000000"CM",1,1,RGB(GRAY)'|144
Vold= 1.370000000"CM",1,1,RGB(GRAY)'|144
Vold= 1.350000000"CM",1,1,RGB(GRAY)'|144


Vold is in reality a float with 2 decimals. The rest of the printed string come from a completely different place in the code; a SUB. The "144" is the same as the linenumber for the row. This is the actual row in the SUB:

text k,m,"+","CM",1,1,rgb(gray)
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10377
Posted: 03:53pm 21 Feb 2022
Copy link to clipboard 
Print this post

MMBasic.zip

Fixes bug in ON ERROR SKIP
should fix missing 0 terminator in string for console output
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 375
Posted: 04:06pm 21 Feb 2022
Copy link to clipboard 
Print this post

Thanks Peter!
It fixed the CONSOLE problem. Works now as expected; at least as far as I have tested.
Strings OK
Float OK
Integer OK

Regards Fred
 
     Page 5 of 12    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025