Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 09:28 06 May 2024 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 - pre-alphas

     Page 3 of 17    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 07:48pm 26 Jan 2022
Copy link to clipboard 
Print this post

NOW with full GUI and Mouse support


MMBasic.zip

Really happy with this  

You can interrogate the mouse with the mouse function
MOUSE(X) 'gets the x-coordinate
MOUSE(Y) 'gets the y-coordinate
MOUSE(W [,scale]) get the movement of the wheel since the last call of the function
Use scale to adjust the sensitivity by dividing the internal count by scale (default 1)
MOUSE(L) 'gets the left  mouse button (1 is pressed)
MOUSE(M) 'gets the middle  mouse button (1 is pressed)
MOUSE(R) 'gets the right  mouse button (1 is pressed)
MOUSE(D)
D This allows you to detect a double click of the left mouse button .
The algorithm say the two clicks must occur between 100 and 500
milliseconds apart. The report via MOUSE(D) is then valid for 500mSec
before it times out or until it is read.


NB: MM+ TOUCH() function is automatically translated to MOUSE() by the firmware, see the PicoMite manual for the touch GUI sub-functions

mouse command
MOUSE LEFTDOWNinterrupt [,RIGHTDOWNINTERRUPT] [,LEFTUPINTERRUPT]

e.g.

MOUSE leftint, rightint, leftup
do
 if mouse(D) then print "Double click @ ",mouse(x),mouse(y)
loop
sub leftint
 print "left down @ ",mouse(x),mouse(y)
end sub
sub leftup
 print "left up @ ",mouse(x),mouse(y)
end sub
sub rightint
 print "right down @ ",mouse(x),mouse(y)
end sub




Test code for the GUI, please give it a try


gui-test.zip


 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 08:00pm 26 Jan 2022
Copy link to clipboard 
Print this post


Got this when i tried to download MMBasic.zip.
/Fred
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5914
Posted: 08:01pm 26 Jan 2022
Copy link to clipboard 
Print this post

You are making good progress.

I am still seeing resolution problems with the timer.

Without any other programs running, the resolution is 10mS


Start any other program that has timing involved such as MMEdit V5 or VLC and the timing resolution changes to 15-16mS



I expect that it involves the timeBeginPeriod function (timeapi.h)from the Windows API

An extract:
  Quote  timeBeginPeriod function (timeapi.h)

Prior to Windows 10, version 2004, this function affects a global Windows setting. For all processes Windows uses the lowest value (that is, highest resolution) requested by any process. Starting with Windows 10, version 2004, this function no longer affects global timer resolution. For processes which call this function, Windows uses the lowest value (that is, highest resolution) requested by any process. For processes which have not called this function, Windows does not guarantee a higher resolution than the default system resolution.

Starting with Windows 11, if a window-owning process becomes fully occluded, minimized, or otherwise invisible or inaudible to the end user, Windows does not guarantee a higher resolution than the default system resolution. See SetProcessInformation for more information on this behavior.


I am running W10 and I think you are on W11.

The test program used:
 DIM INTEGER starttime, laptime, midtime
 
 starttime = TIMER
 midtime = starttime
 
 FOR k = 1 TO 25
   FOR n = 1 TO 10000
     x = LOG(12346)
   NEXT n
   laptime = TIMER - midtime
   midtime = TIMER
   PRINT k, TIMER - starttime, laptime
 NEXT k
 


Jim
Edited 2022-01-27 06:03 by TassyJim
VK7JH
MMedit   MMBasic Help
 
RetroJoe

Senior Member

Joined: 06/08/2020
Location: Canada
Posts: 290
Posted: 08:20pm 26 Jan 2022
Copy link to clipboard 
Print this post

Peter, gui-test works like a charm - very cool!

One bugette: copying (right mouse click from browser) and pasting (CTRL-V) into the editor resulted in a "CLIPBOARD IS EMPTY" error

Test platform specs:

Windows 10 Pro
Dell Inspiron
11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz   2.80 GHz
16GB RAM
NVIDIA GeForce MX350

P.S.

Like some of the other 8-bit enthusiasts around here, I've been checking in from time to time on the Commander X16 project.

The latest update on their website is thus: "As of December 2021 David has suggested there could be a '9 to 12 month' delay" (and, dollars to donuts, it won't be "generally available" even then i.e. they will be doing some limited KickStarter thing to fund the initial production run).

Meaning, when your "WinMite" version is released, the mighty Mite ecosystem will have the retrocomputing pole position all to itself, for at least a year!
Edited 2022-01-27 06:23 by RetroJoe
Enjoy Every Sandwich / Joe P.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3663
Posted: 08:23pm 26 Jan 2022
Copy link to clipboard 
Print this post

  Pluto said  
Got this when i tried to download MMBasic.zip.
/Fred

False positive - ignore.

John
 
RetroJoe

Senior Member

Joined: 06/08/2020
Location: Canada
Posts: 290
Posted: 10:35pm 26 Jan 2022
Copy link to clipboard 
Print this post

Just (re)-read the first post in this thread:
  Quote  Pasting into the window doesn't work and will probably never work...


If I'm interpreting that right, it seems like a major usability issue - copying and pasting code within the MM Editor, and from browser windows into the Editor, are very common operations.

I guess "best practice" will be to use a 3rd-party editor?
Enjoy Every Sandwich / Joe P.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 10:41pm 26 Jan 2022
Copy link to clipboard 
Print this post

  Quote  If I'm interpreting that right, it seems like a major usability issue


That's the way it is. You are trying to pastes a text string into a pixel mapped graphics window. It ain't going to work. You can't have everything
 
LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 446
Posted: 11:08pm 26 Jan 2022
Copy link to clipboard 
Print this post

The MMBasic.exe is running fine on Wine  

It's complaining of Option angle degrees and Option keyboard.
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 501
Posted: 02:07am 27 Jan 2022
Copy link to clipboard 
Print this post

hi,

wow GUI support !great Progress

works fine
Edited 2022-01-27 12:12 by Plasmamac
Plasma
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5914
Posted: 03:21am 27 Jan 2022
Copy link to clipboard 
Print this post

A test program to show off the modes.
The CIRCLE function creates artifacts on the outside of the circle.
Use the C key to toggle the circle on/off
Also, P -saving a BMP, creates a unreadable file. I will investigate that further.

' test card for MMB4W
' TassyJim January 2022
 
 OPTION EXPLICIT
 OPTION DEFAULT NONE
 DIM INTEGER wd, ht, wbox, sh, x, w, n, nn, m, maxMode, mk, cir
 DIM FLOAT a
 DIM k$, imgtitle$, fname$, imgRes$
 DIM INTEGER c(8)
 c(0) = RGB(BLACK)
 c(1) = RGB(YELLOW)
 c(2) = RGB(CYAN)
 c(3) = RGB(GREEN)
 c(4) = RGB(MAGENTA)
 c(5) = RGB(RED)
 c(6) = RGB(BLUE)
 c(7) = RGB(WHITE)
 c(8) = RGB(64,64,64)
 
 maxMode = 16
 a = 1
 cir = 1
 CLS
 
 DO
   IF m = 0 THEN
     MODE 1 ',8
     CLS
     TEXT 400,100, "Video mode test",cm,5,1
     TEXT 400,180, "Ratio = aspect ratio used in the circle command",cm,1,1
     TEXT 400,220, "Q to quit, P to save page as a BMP",cm,3,1
     TEXT 400,260, "Up Down arrow or mouse wheel to change mode",cm,2,1
     TEXT 400,300, "+ - to change circle aspect ratio",cm,2,1
     TEXT 400,340, "C to toggle circle",cm,2,1
   ELSE
     CLS             ' erase video memory before mode change
     MODE m
     CLS
     PAUSE 100
     wd = MM.HRES : ht = MM.VRES
     nn = INT(wd/80)
     imgtitle$ =" MODE "+STR$(m)+" Ratio "+STR$(a,1,3)+" "
     imgRes$ = " "+STR$(MM.HRES)+" x "+STR$(MM.VRES)+" "
'pages$ = " Maximum page number = "+STR$(mp)+" "
     wbox = wd / 8
     
     FOR x = 0 TO 7
       BOX x*wbox,ht/4,wbox,ht/2,0,c(x), c(x)
     NEXT x
' full gradient for each primary colour and greyscale
     FOR x = 0 TO wd-1
       sh = 255*x/wd
       
       LINE x,0,x,ht/12,1,RGB(sh,0,0)
       LINE x,ht/12,x,ht/6,1,RGB(0,sh,0)
       LINE x,ht/6,x,ht/4,1,RGB(0,0,sh)
       
       LINE x,ht*9/12,x,ht*10/12,1,RGB(0,sh,sh)
       LINE x,ht*10/12,x,ht*11/12,1,RGB(sh,0,sh)
       LINE x,ht*11/12,x,ht,1,RGB(sh,sh,0)
       
       LINE x,ht/2,x,ht*3/4,1,RGB(sh,sh,sh) ' greyscale
     NEXT x
' circle to check aspect ratio
     IF cir THEN CIRCLE wd/2,ht/2, ht*15/32,3,a,c(7)
     sh = 0
     x = wd/2 - 55*nn/2
' black white bars to check monitor bandwidth
     FOR w = 10 TO 1 STEP -1
       FOR n = 1 TO nn
         sh = 255 - sh
         LINE x,ht*3/8,x,ht*5/8,w,RGB(sh,sh,sh)
         x = x + w
       NEXT n
     NEXT w
' white and red border to check that image fits on monitor
     BOX 0,0,wd,ht,3,c(7)
     BOX 1,1,wd-2,ht-2,1,c(5)
' title
     IF wd > 600 THEN
       TEXT wd/2,ht/2-15, imgtitle$,cm,4,1
'TEXT wd/2,ht/2, pages$,cm,4,1
       TEXT wd/2,ht/2+15, imgRes$,cm,4,1
     ELSE
       TEXT wd/2,ht/2-11, imgtitle$,cm,1,1
'TEXT wd/2,ht/2, pages$,cm,1,1
       TEXT wd/2,ht/2+11, imgRes$,cm,1,1
     ENDIF
' show the new image
   ENDIF
   PAUSE 100
' wait for keypress or mouse wheel
   DO
     k$ = INKEY$
     mk = MOUSE(w)
     IF mk < 0 THEN
       k$ = CHR$(129)
     ELSEIF mk > 0 THEN
       k$ = CHR$(128)
     ENDIF
   LOOP UNTIL k$<>""
'
   SELECT CASE k$
     CASE "C","c" ' toggle circle
       cir = 1 - cir
     CASE "Q","q"
       EXIT DO
     CASE "P","p"
       fname$ = MID$(imgtitle$,2)+".bmp"
       TIMER = 0
       SAVE IMAGE fname$
' PAGE WRITE 0
       TEXT wd/2,ht/2,"Saved as "+fname$+" in "+STR$(TIMER/1000,3,2)+" Sec" ,cm,1,1
       DO
         k$ = INKEY$
       LOOP UNTIL k$<>""
     CASE CHR$(128) ' up arrow
       m = m - 1
       IF m < 1 THEN m = maxMode
     CASE CHR$(129) ' down arrow
       m = m + 1
       IF m > maxMode THEN m = 1
       
     CASE "+" ' ratio plus
       IF a < 1.4 THEN a = a + 0.01
     CASE "-" ' ratio minus
       IF a > 0.75 THEN a = a - 0.01
     CASE ELSE ' same as down arrow
       m = m + 1
       IF m > maxMode THEN m = 1
   END SELECT
 LOOP
 
 CLS
 MODE 1
END
 
 
 


Jim
VK7JH
MMedit   MMBasic Help
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 501
Posted: 06:11am 27 Jan 2022
Copy link to clipboard 
Print this post

Hi,
after startup and edit
no option line on the Bottom after changing mode
no code line pointer at Startup/edit



Edited 2022-01-27 16:20 by Plasmamac
Plasma
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 08:21am 27 Jan 2022
Copy link to clipboard 
Print this post

  Quote  It's complaining of Option angle degrees and Option keyboard.


Not implemented yet

  Quote  after startup and edit
no option line on the Bottom after changing mode

Know the issue - will fix

  Quote  The CIRCLE function creates artifacts on the outside of the circle.

Know the issue - will fix, this will also fix the arc problem as it uses the same code

Need to find a better timer - any ideas?
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 501
Posted: 09:13am 27 Jan 2022
Copy link to clipboard 
Print this post

HPET?
Plasma
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 327
Posted: 09:16am 27 Jan 2022
Copy link to clipboard 
Print this post

  Volhout said  
  Plasmamac said  Hi,

Editor Mode - 16 % cpu
Run    Mode - 30 % Cpu

Grainbench 130201

I5 2500S  with 2,7 Ghz

its a litte bit faster as version 1  12700 Grains


looks fine here


I ran the grainbench on this i5 system: 175000 grains.
So the computation speed is top. While running grainbench it is 55% CPU load.

No idea why the text printing is slower. Maybe the throttle is removed from the graphics output routine, or my W10 machine is not HW compatible (driver mismatch on HW acceleration?). But I can watch youtube video's on this machine, so it is graphics capable.


WoW! On my 3.5GHz i9 system running Windows 11, I only get 119210 grains.
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 327
Posted: 09:25am 27 Jan 2022
Copy link to clipboard 
Print this post

  TassyJim said  A test program to show off the modes.
The CIRCLE function creates artifacts on the outside of the circle.
Use the C key to toggle the circle on/off
Also, P -saving a BMP, creates a unreadable file. I will investigate that further.


Jim


With MMBasic version 5.07.03pa1 I get

[29] TEXT 400,100, "Video mode test",cm,5,1
Error: Unknown command
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 501
Posted: 09:29am 27 Jan 2022
Copy link to clipboard 
Print this post


Plasma
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 327
Posted: 09:33am 27 Jan 2022
Copy link to clipboard 
Print this post

  matherp said  NOW with full GUI and Mouse support


MMBasic.zip



How do I change to the US keyboard? CONFIG KEYBOARD US doesn't work.
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 501
Posted: 09:36am 27 Jan 2022
Copy link to clipboard 
Print this post



my i3 desktop with a 710 card
Plasma
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 501
Posted: 09:37am 27 Jan 2022
Copy link to clipboard 
Print this post

@toml  its not in yet
Plasma
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 327
Posted: 09:45am 27 Jan 2022
Copy link to clipboard 
Print this post

  matherp said  NOW with full GUI and Mouse support

Test code for the GUI, please give it a try

gui-test.zip




I get

[23] GUI Interrupt Touchdown, Touchup
Error : Unknown command


If I try to turn on the mouse with

OPTION MOUSE 0

I get invalid option.
 
     Page 3 of 17    
Print this page
© JAQ Software 2024