![]() |
Forum Index : Microcontroller and PC projects : MMBasic for Windows - alphas
Page 1 of 12 ![]() ![]() |
|||||
Author | Message | ||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
MMBasic for Windows V5.07.03a0 MMBasic.zip The MMBasic for Windows code is now officially past the pre-alpha phase and enters alpha. i.e. most of the functionality is now there and there are not too many reports of issues but there is still work to do. The big change in V5.07.03a0 is support for proper transparency as per the CMM2 The mode command is changed as follows to follow the CMM2 as closely as possible: MODE modeno [,alphaenabled] [,background colour] By default alphaenabled is 0 and the background colour is BLACK To use the second layer set alphaenabled to 1 and optionally choose a background colour Unlike the CMM2 MMbasic for windows uses full ARGB8888 colour in all modes and has a transparency value (A) of 0-255 When you change the mode to alpha by default you are still writing to page 0 and it is cleared to RGB(BLACK)which is opaque. If you want to see the background colour pixels on page 0 must be written with a transparency of less than 255. Use CLS RGB(BLANK) to clear a page to completely transparent. If you set to write to page 1 this will overlay page 0 and the background to the extent that the alpha value of the pixels on PAGE 1 are set (between 0=transparent and 255=opaque). Note when playing with this at the command line you can get very confused so it is easier to understand what is happening with a very simple program. mode 14,1,rgb(magenta) 'set into 2 layer mode with the background set to magenta font 3 print "Click to get focus" mouseclick print "now we will clear page 0 to blank" print "click to continue" mouseclick cls rgb(blank) colour rgb(black),rgb(blank) print "This text is written on page 0 with transparent backgound" print "click to continue" mouseclick print "Now we will write to the top page" print "click to continue" mouseclick page write 1 cls rgb(blank) sprite loadpng 1,"apple" sprite write 1,50,10,1 sprite transparency 1,128 'change the transparency of the sprite sprite write 1,200,10,1 page write 0 print @(0,mm.info(fontheight)*4)"You can see the page 0 text through the right hand apple" print "Click to exit and remember to click again to get focus" mouseclick sprite close all mode 14 colour rgb(white),rgb(black) end sub mouseclick do loop until mouse(l) do loop until not mouse(l) end sub apple.zip Finally a note on the RGB function. RGB(COLOURNAME) will return a fully opaque representation of that colour RGB(red, green, blue) will return a fully opaque representation of that colour use RGB(red, green, blue, trans) to set a partially transparent colour If you must, you can use numerical values directly as colours e.g CLS &H80607080 This will set the transparency to &H80, the blue level to &H60, the green level to &H70 and the red level to &H80. Note that red and blue are reversed compared to the CMM2 if a direct numerical value is used in this way i.e ABRG8888 ![]() |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
V5.07.03a1 MMBasic.zip Forgot to mention above right clicking in the editor on the first character in the line is the same as HOME. Right clicking after the last character in a line on on the last character if the line exceeds the screen width is the same as the END key This version includes the ability to send a BREAK "character" on the serial port. e.g. OPEN "COM1:9600" as #1 PRINT #1,BREAK This will send a break which is set to be 20 bit lengths of the port held in the zero state. I've even tested it on the scope and it works ![]() |
||||
Romeo![]() Newbie ![]() Joined: 11/02/2022 Location: FrancePosts: 24 |
Great work! But you have too much creativity, we cannot follow your rythme to test all these new stuffs. I just tested the transparency and it works like a charm, it will be usefull for my need (a moving map using scroll, with sprites scrolling with it or standing still on the screen, and with text showing the Points of Interest: the text transparent background will sure look more 'professionnal' ) Beside that, things seems to slowly forking away from the CMM2 features, I was expecting MMBasic-4-Windows to mimic the CMM2, in a attempt to keep the code portable. Or maybe the MMBasic-4-CMM2 would benefit from your actual work, and both will join together? Only time will tell! Keep the good work! Thanks! |
||||
Michal Senior Member ![]() Joined: 02/02/2022 Location: PolandPosts: 125 |
Hi matherp, Version a1 behaves more unstable than a0. Sometimes it doesn't start from BAS. It closes unexpectedly. Michal |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
Bizarre the change is trivial just the BREAK feature Try the attached I've done a clean build MMBasic.zip |
||||
Pluto Guru ![]() Joined: 09/06/2017 Location: FinlandPosts: 375 |
Serial communication works well up to 230400 Baud (with a Microbridge). For higher speed, do you think an other type of USB-TTL like CP2102 would help? Any ideas where the bottleneck could be? Tested with an old DIY ECG. Faster datastream would be needed for diagnosis; but at least i can see that the patient is alive. ![]() Regards Fred |
||||
Michal Senior Member ![]() Joined: 02/02/2022 Location: PolandPosts: 125 |
Unfortunately, no changes. a0 definitely more stable. It always starts. It never closes unexpectedly. ADD: Tests on your apple.bas Michal Edited 2022-02-17 06:23 by Michal |
||||
Plasmamac![]() Guru ![]() Joined: 31/01/2019 Location: GermanyPosts: 573 |
can confirm : first apple.bas start works a while when crush. new starts : fps drops to 1 fps when crush. restarting pc now and test again. cu after restating win all the same apple.bas crushs . btw ; why not adding a textfield to "MMBasic - Shortcut" and create a debuglog with. it will not crushing and we can see the problems if we make debuglog " here iam" Edited 2022-02-17 08:45 by Plasmamac Plasma |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
Try again MMBasic.zip |
||||
Michal Senior Member ![]() Joined: 02/02/2022 Location: PolandPosts: 125 |
MMBasic.zip It looks like this build is stable. (What was that?) Michal Edited 2022-02-17 08:55 by Michal |
||||
Plasmamac![]() Guru ![]() Joined: 31/01/2019 Location: GermanyPosts: 573 |
works ![]() Plasma |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
Not aware of any significant differences. The mode command is slightly different because there is only one colour depth in windows. On the CMM2 the different colour depths are there because of display performance issues and not because they are a preferred approach. Question to all: what areas am I still missing and have forgotten? #INCLUDE is the obvious omission. |
||||
Plasmamac![]() Guru ![]() Joined: 31/01/2019 Location: GermanyPosts: 573 |
Play ( sound overall) Option Angle Execute Edited 2022-02-17 18:02 by Plasmamac Plasma |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
Really? That was only included for educational uses and shouldn't be needed for "real" users |
||||
Plasmamac![]() Guru ![]() Joined: 31/01/2019 Location: GermanyPosts: 573 |
Why not , maybe implement later Plasma |
||||
Plasmamac![]() Guru ![]() Joined: 31/01/2019 Location: GermanyPosts: 573 |
Forget - load data Plasma |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
Already there |
||||
Romeo![]() Newbie ![]() Joined: 11/02/2022 Location: FrancePosts: 24 |
Not aware of any significant differences. The mode command is slightly different because there is only one colour depth in windows. On the CMM2 the different colour depths are there because of display performance issues and not because they are a preferred approach. Concerning the differences between CMM2/Windows coding approach, I mean, for example: as I am very interrested in the scrollable feature of the Framebuffer (using the FB WINDOW command), I'm concerned by the size it takes in memory; a 24bits colors MODE in Windows gives a bigger FB size in memory than a 8bits, just... the triple. On Windows it does'nt matter, but on CMM2 it is crucial, as memory is very scarce. If the MODE command in Windows works differently as in CMM2, the code is just, as you say rigthly, slightly different; I need to dig a bit more what I wanna do, and how to do it, to keep the code portable between Win/CMM2. |
||||
Goksteroo Senior Member ![]() Joined: 15/03/2021 Location: AustraliaPosts: 114 |
The way F1 works on CMM2 - select a folder and load a program from within it. |
||||
Michal Senior Member ![]() Joined: 02/02/2022 Location: PolandPosts: 125 |
Hi matherp, I get such an error [831] Arc x%,y%,x1%,y1%,els,ela,c% Error : Radials in the course of the execution of the following For i%=1 To 100 x%=Rnd()*maxx y%=Rnd()*maxy x1%=Rnd()*maxx y1%=x1%+(Rnd()*30) if y1%=x1% then y1%=x1%+1 c%=Rnd()*&hffffff els=rnd()*360 'random size ela=rnd()* 360 'random angle Arc x%,y%,x1%,y1%,els,ela,c% Next i% Michal |
||||
Page 1 of 12 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |