Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 19:24 16 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 15 of 17    
Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 01:41am 14 Feb 2022
Copy link to clipboard 
Print this post

  Plasmamac said  serial test :


first Start gives an Error
second Start will work

either flush the buffer when you start or limit the string length to 255
 open "COM9:230400" as #2
 do
   k$ = inkey$
   if k$ <>"" then print #2,k$;
   if loc(#2) > 0 then
     j$ = input$(min(loc(#2),255),#2)
     print j$;
   endif
 loop

VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 04:51am 14 Feb 2022
Copy link to clipboard 
Print this post

  Plasmamac said  NEW - WILL NOT WORK @pa20


NEW works for me @pa20.

Jim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 04:56am 14 Feb 2022
Copy link to clipboard 
Print this post

Last demo of named colours:



'
MODE 1
CLS

TEXT 10,10 , "WHITE     "+HEX$(RGB(WHITE),4), ,1,1,RGB(WHITE)
TEXT 10,30 , "YELLOW    "+HEX$(RGB(YELLOW),4), ,1,1,RGB(YELLOW)
TEXT 10,50 , "LILAC     "+HEX$(RGB(LILAC),4), ,1,1,RGB(LILAC)
TEXT 10,70 , "BROWN     "+HEX$(RGB(BROWN),4), ,1,1,RGB(BROWN)
TEXT 10,90 , "FUCHSIA   "+HEX$(RGB(FUCHSIA),4), ,1,1,RGB(FUCHSIA)
TEXT 10,110, "RUST      "+HEX$(RGB(RUST),4), ,1,1,RGB(RUST)
TEXT 10,130, "MAGENTA   "+HEX$(RGB(MAGENTA),4), ,1,1,RGB(MAGENTA)
TEXT 10,150, "RED       "+HEX$(RGB(RED),4), ,1,1,RGB(RED)
TEXT 10,170, "CYAN      "+HEX$(RGB(CYAN),4), ,1,1,RGB(CYAN)
TEXT 10,190, "GREEN     "+HEX$(RGB(GREEN),4), ,1,1,RGB(GREEN)
TEXT 10,210, "CERULEAN  "+HEX$(RGB(CERULEAN),4), ,1,1,RGB(CERULEAN)  
TEXT 10,230, "MIDGREEN  "+HEX$(RGB(MIDGREEN),4), ,1,1,RGB(MIDGREEN)  
TEXT 10,250, "COBALT    "+HEX$(RGB(COBALT),4), ,1,1,RGB(COBALT)
TEXT 10,270, "MYRTLE    "+HEX$(RGB(MYRTLE),4), ,1,1,RGB(WHITE)
TEXT 10,290, "BLUE      "+HEX$(RGB(BLUE),4), ,1,1,RGB(BLUE)
TEXT 310,10 , "BLACK     "+HEX$(RGB(BLACK),4), ,1,1,RGB(WHITE)
TEXT 310,30 , "GRAY      "+HEX$(RGB(GRAY),4), ,1,1,RGB(GRAY)
TEXT 310,50 , "GREY      "+HEX$(RGB(GREY),4), ,1,1,RGB(GREY)
TEXT 310,70 , "LIGHTGRAY "+HEX$(RGB(LIGHTGRAY),4), ,1,1,RGB(LIGHTGRAY)
TEXT 310,90 , "LIGHTGREY "+HEX$(RGB(LIGHTGREY),4), ,1,1,RGB(LIGHTGREY)
TEXT 310,110, "ORANGE    "+HEX$(RGB(ORANGE),4), ,1,1,RGB(ORANGE)
TEXT 310,130, "PINK      "+HEX$(RGB(PINK),4), ,1,1,RGB(PINK)
TEXT 310,150, "GOLD      "+HEX$(RGB(GOLD),4), ,1,1,RGB(GOLD)
TEXT 310,170, "SALMON    "+HEX$(RGB(SALMON),4), ,1,1,RGB(SALMON)
TEXT 310,190, "BEIGE     "+HEX$(RGB(BEIGE),4), ,1,1,RGB(BEIGE)
 
BOX 180,  5,100,20,1,RGB(WHITE),RGB(WHITE)
BOX 180, 25,100,20,1,RGB(YELLOW),RGB(YELLOW)
BOX 180, 45,100,20,1,RGB(LILAC),RGB(LILAC)
BOX 180, 65,100,20,1,RGB(BROWN),RGB(BROWN)
BOX 180, 85,100,20,1,RGB(FUCHSIA),RGB(FUCHSIA)
BOX 180,105,100,20,1,RGB(RUST),RGB(RUST)
BOX 180,125,100,20,1,RGB(MAGENTA),RGB(MAGENTA)
BOX 180,145,100,20,1,RGB(RED),RGB(RED)
BOX 180,165,100,20,1,RGB(CYAN),RGB(CYAN)
BOX 180,185,100,20,1,RGB(GREEN),RGB(GREEN)
BOX 180,205,100,20,1,RGB(CERULEAN),RGB(CERULEAN)
BOX 180,225,100,20,1,RGB(MIDGREEN),RGB(MIDGREEN)
BOX 180,245,100,20,1,RGB(COBALT), RGB(COBALT)
BOX 180,265,100,20,1,RGB(MYRTLE),RGB(MYRTLE)
BOX 180,285,100,20,1,RGB(BLUE),RGB(BLUE)
BOX 480,  5,100,20,1,RGB(BLACK),RGB(BLACK)
BOX 480, 25,100,20,1,RGB(GRAY),RGB(GRAY)
BOX 480, 45,100,20,1,RGB(GREY),  RGB(GREY)
BOX 480, 65,100,20,1,RGB(LIGHTGRAY),RGB(LIGHTGRAY)
BOX 480, 85,100,20,1,RGB(LIGHTGREY),RGB(LIGHTGREY)
BOX 480,105,100,20,1,RGB(ORANGE),RGB(ORANGE)
BOX 480,125,100,20,1,RGB(PINK),RGB(PINK)
BOX 480,145,100,20,1,RGB(GOLD),RGB(GOLD)
BOX 480,165,100,20,1,RGB(SALMON),RGB(SALMON)
BOX 480,185,100,20,1,RGB(BEIGE),RGB(BEIGE)

DO:LOOP

Hex numbers are transparency, blue, green, red

Jim
VK7JH
MMedit   MMBasic Help
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8603
Posted: 08:45am 14 Feb 2022
Copy link to clipboard 
Print this post

MMBasic.zip


F7, shift-del, shift-tab now all working in the editor (see CMM2 manual for details), just mouse support to complete

typing edit without a parameter will open the currently loaded file or give an error if nothing loaded.
To create a new program simply type EDIT "newfilename" and the editor will open with a blank screen

For those who haven't used the CMM2 editor before, the big advantage is that the new editor supports horizontal scrolling allowing lines longer than the screen size to be edited properly
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3582
Posted: 09:17am 14 Feb 2022
Copy link to clipboard 
Print this post

Hi Peter,

- programs with line numbers run fine
- last version also called a20 (like previous)
- when in editor, pressing F2 rus program but does not show result on screen. pressing F2 second time shows output.

tested program:
'palindrome numbers are symetrical. in base 10 they should have the form abccba from numbers under 1e6.
'in base 2 they cannot end in a zero, becuase the first bit cannot be zero. This limits to odd numbers.
'in base 10 you will have  to ripple through abccba and abcba and abba and aba and aa and a

Timer = 0
Total = 0

'6 digits
For a=1 To 9 Step 2
 k=a*100001
 For b=0 To 9
   l=b*10010
   For c=0 To 9
     x=c*1100+l+k
     bincheck
Next c,b,a

'5 digits
For a=1 To 9 Step 2
 k=a*10001
 For b=0 To 9
   l=b*1010
   For c=0 To 9
     x=c*100+l+k
     bincheck
Next c,b,a

'4 digits
For a=1 To 9 Step 2
 k=a*1001
 For b=0 To 9
   x=b*110+k
   bincheck
Next b,a

'3 digits
For a=1 To 9 Step 2
 k=a*101
 For b=0 To 9
   x=b*10+k
   bincheck
Next b,a

'2 digits
For a=1 To 9 Step 2
 x=a*11
 bincheck
Next a

'1 digits, these are all symetrical (b1,b11,b101,b111,b1001)
For x=1 To 9 Step 2
 Total = Total + x
Next x

Print Timer
Print Total

' checking the binary string for symetry
' the lsb is always 1 (odd), the msb is always 1 (never start with 0)
' so we only check  the other digits
' for strings with an odd length we do not test the centre bit.
Sub bincheck
 y$=Bin$(x) : w=Len(y$) : z=Int(w/2)
 'Print y$,z,w
 pali=0
 For i=2 To z
   'Print Mid$(y$,i,1),Mid$(y$,w+1-i,1)
   If Mid$(y$,i,1)=Mid$(y$,w+1-i,1) Then
     pali=pali+1
   End If
 Next i
 If pali = z-1 Then
    Total = Total + x
    Print y$," pali"
 End If
End Sub

PicomiteVGA PETSCII ROBOTS
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 10:27am 14 Feb 2022
Copy link to clipboard 
Print this post




This worked yesterday, but not anymore. Syntax error.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3582
Posted: 10:37am 14 Feb 2022
Copy link to clipboard 
Print this post

Option colourcode (colorcode).

- option colorcode does not work. Always colorcode in edit mode.
- option colorcode OFF -> option list shows colorcode off
 option colorcode ON -> option list does not show colorcode entry

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8603
Posted: 10:52am 14 Feb 2022
Copy link to clipboard 
Print this post

  Quote  This worked yesterday, but not anymore. Syntax error.


No it didn't

open "com19:230400"

is the correct syntax same as every other MMBasic variant
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 11:36am 14 Feb 2022
Copy link to clipboard 
Print this post

Thanks Peter. It works as you propose.

However, I am almost sure that the "Baud=230400"-version did work in an earlier version of MMbasic for Windows.  MMBasic DOS/Windows Version User Manual MMBasic Ver 5.05.05 p.7:


  Quote  The following is an example:
OPEN "COM12: baud=4800" AS #5 ' open COM12 with a speed of 4800 baud
PRINT #5, "Hello" ' send the string "Hello" out of the serial port
dat$ = INPUT$(20, #5) ' get up to 20 characters from the serial port
CLOSE #5 ' close the serial port


I am 100% satisfied leaving out the "Baud=".  

/Fred
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 504
Posted: 01:05pm 14 Feb 2022
Copy link to clipboard 
Print this post

Pa20 - new .
Iam confused, after new command  the Editor isnt empty.
Even i like to know if the serial port buffer is empty/cleared after open com?
Can't tested yet but iam curious.
Plasma
 
Michal
Senior Member

Joined: 02/02/2022
Location: Poland
Posts: 116
Posted: 05:22pm 14 Feb 2022
Copy link to clipboard 
Print this post

Hi,

I'm trying to adopt the example from Maximite, sprites/ghost/ghost.bas and it seems there is a problem with "sprite loadpng" (or something else).
Would I ask for an example with loaded sprites?

Michal
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8603
Posted: 07:57pm 14 Feb 2022
Copy link to clipboard 
Print this post

pa21

MMBasic.zip

Mouse now integrated into the editor with same functionality as CMM2 e.g navigating and selecting text for cut-and-paste.
Cut and paste in the editor now uses the Window clipboard so you can paste external text into the editor or get text from the editor into an external application.
Ctrl-V no longer functional in autosave - but will return soon
Edited 2022-02-15 05:57 by matherp
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 330
Posted: 08:46pm 14 Feb 2022
Copy link to clipboard 
Print this post

pa21:
WONDERFUL new functionality! Copy-Paste works perfectly.
I get serial communication to work up to 230400Baud via MicroBridge USB-TTL. TX:MicroMite 28pin and RX:MMBasic for Windows. Did not yet check the other direction. Is this to be expected as the limit for Microbridge? Just curious, no immediate need for higher speed.

THANKS!
 
KD5ZXG
Regular Member

Joined: 21/01/2022
Location: United States
Posts: 53
Posted: 08:58pm 14 Feb 2022
Copy link to clipboard 
Print this post

Could mouse drag-select perhaps also scroll the edit window?
I am grateful for all the edit improvements made so far.
 
Goksteroo
Senior Member

Joined: 15/03/2021
Location: Australia
Posts: 110
Posted: 10:45pm 14 Feb 2022
Copy link to clipboard 
Print this post

Matherp, I'm amazed by the speed you add new commands, routines and functionality and your speed at nullifying found bugs. Impressive.

On a side note, is 'load data f$,addr' functional yet? It reports a syntax error to me.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 03:32am 15 Feb 2022
Copy link to clipboard 
Print this post

I gave the serial port a workout.

This program on the CMM2
do
k$ = inkey$
loop until k$ = "*"
for m = 1 to 500
print str$(m,4)+" Friends, Romans, countrymen, lend me your ears; I come to bury Caesar, not to praise him."
next m
print "*"
print "*"


and this on MMB4W
open "COM11:230400" as #2
open "speedtest.txt" for output as #3
do
k$ = inkey$
loop until k$<>""
print #2, "*";
timer = 0
do
line input #2,j$
print #3, j$
loop until j$ = "*"
print #3, timer
print timer
close #3
close #2

"any key to start"


At 230400 baud, it took 2096mS to transfer ~48000 bytes from serial to file.
The CMM2 was also printing to monitor so that would slow things down a bit.

I then did the same using a picomite with it's 'full speed' USB port

Time taken was 637mS to transfer the same 48000 bytes
There were no signs of any dropped characters or other problems.
The serial code works bl...y well.

Jim
VK7JH
MMedit   MMBasic Help
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 504
Posted: 06:19am 15 Feb 2022
Copy link to clipboard 
Print this post

New command now works well,
Plasma
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8603
Posted: 08:32am 15 Feb 2022
Copy link to clipboard 
Print this post

  Quote  Could mouse drag-select perhaps also scroll the edit window?


You don't need it to:

Just start the selection with the mouse as normal and release the left button at the end of the page.
The editor stays in selection mode. Then just use the scroll wheel to scroll down and the selection will track down the new lines. Selection mode is only exited when you CTL-X or CTRL-C or esc or del
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 504
Posted: 11:09am 15 Feb 2022
Copy link to clipboard 
Print this post

Mouse support works well  
Plasma
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8603
Posted: 06:42pm 15 Feb 2022
Copy link to clipboard 
Print this post

pa22

MMBasic.zip

Enables double press of home and end in editor to move to start and end of the file

AUTOSAVE fname$

The filename is now mandatory as on the CMM2. You can now paste into autosave using CTRL-V.
When you exit autosave with F1 or CTRL-Z. the file is saved and the program is loaded ready to run. The "last file edited" is updated so you can edit the file without specifying the filename.

In addition if you exit with F2 the file is immediately run

If you exit with CTRL-C no file will be created

LOAD DATA now implemented but completely untested.
 
     Page 15 of 17    
Print this page
© JAQ Software 2024