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 : CMM2: V5.06.00b4: More "fun" functionality for testing
Page 1 of 3 | |||||
Author | Message | ||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8570 |
V5.06.00b4 http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip This beta should fix the problems identified in MATH SET, PAGE_AND in addition there is some new "stuff" which you are invited to test and use. HELP changes Pressing F12 in the middle of a word will now load the whole word into the help system. So you don't need to be at the beginning of a command or function name to find the help for it. When you exit help in the editor the command at the top is copied into a buffer. You can use F11 to paste this into your program. It just inserts this at the cursor so typically you would point to a blank line and press F11. Then you can replace the syntax example with your data and, assuming the help text is correct, know you have the syntax correct. SORT changes The syntax for SORT is now SORT array() [,indexarray] [,flags] [,startposition] [,elementstosort] The new parameters should have no impact on existing code which will default them to run as before. flag values are: bit0: 0 (default if omitted) normal sort - 1 reverse sort bit1: 0 (default) case dependent - 1 sort is case independent startposition defines which element in the array to start the sort. Default is 0 (OPTION BASE 0) or 1 (OPTION BASE 1) elementstosort defines how many elements in the array should be sorted. Default is all elements after the startposition CHOICE function CHOICE(condition, ExpressionIfTrue, ExpressionIfFalse) This new function allows you to do simple either or selections much more efficiently and faster than using IF THEN ELSE ENDIF clauses The condition is anything that will resolve to nonzero (true) or zero (false) The expressions are anything that you could normally assign to a variable or use in a command e.g. print choice(1, "hello","bye") will print "Hello" print choice(0, "hello","bye") will print "Bye" a=1:b=1:print choice(a=b, "hello","bye") will print "Hello" Finally: You can use MM.INFO(DIRECTORY) as an alternative to the function cwd$. There is one small difference in that the pathname in MM.INFO(DIRECTORY) will always end with the '/' character Edited 2020-11-24 04:45 by matherp |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3833 |
Thank you Peter <does a happy dance> Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
elk1984 Senior Member Joined: 11/07/2020 Location: United KingdomPosts: 227 |
Fantastic stuff. Thanks Peter! |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3833 |
Hi Peter, Hmm, because we have to provide parameter N before we provide N+1 we potentially have to allocate a (large) redundant index() array for SORT(). I don't suppose it does, or can support a dummy value, e.g. SORT a$(),0,&b11,lb%,num% Also for user-friendliness should you consider using letters for the flags, c.f. the flag that controls the behaviour of DIR$() ? Thanks for the enhancements, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8570 |
You can miss out any of the optional parameters SORT a$(),,2,,10 is perfectly valid Edited 2020-11-24 05:30 by matherp |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3833 |
Ah, lovely. Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5886 |
No splash screen image on startup. The usual text does go out the serial and the space is there where the logo etc should be. Or is black the new black? Jim VK7JH MMedit  MMBasic Help |
||||
Sasquatch Senior Member Joined: 08/05/2020 Location: United StatesPosts: 296 |
Thanks! Page_AND etc. Working great in 16bit modes, however now throws error complaining about parameters in Mode 1,12 -Carl |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5886 |
exiting out of the commandline HELP gives an assortment of errors. Unknown command > help ? Invalid character: * > VK7JH MMedit  MMBasic Help |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8570 |
This is correct. You can't use page 0 as an input in any mode or or page 1 as an input in 12-bit mode to AND, OR, or XOR as they are the display pages. This will be in the documentation. They can be used as the output of course. me trying to clear all video pages to meet previous comment but in the wrong place - easy fix Also easy fix - should test better |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5886 |
There is something strange with SORT If I include index zero, the index array is correct but if I try and start the sort at 1, the sorted array is OK but the index array is "strange" OPTION EXPLICIT OPTION DEFAULT NONE DIM INTEGER maxFiles = 500 ' adjust to suit expected maximum DIM fList$(maxFiles) LENGTH 60' file names for sorting DIM fSort$(maxFiles) LENGTH 60 DIM fIndex%(maxFiles) DIM INTEGER mf, z DIM f$ mf = 1 f$ = DIR$("*", ALL) DO WHILE f$ <> "" IF MM.INFO$(FILESIZE f$)=-2 THEN ' it is a directory fList$(mf) = " "+f$+" <DIR>"' the leading space keeps directories sorted first ELSE fList$(mf) = f$ ENDIF mf = mf + 1 IF mf > maxFiles THEN EXIT DO f$ = DIR$() LOOP mf = mf -1 ' we now know the number of entries ' print the unsorted list FOR z = 1 TO mf PRINT STR$(z,4);" ";fList$(z) NEXT z ' make a copy to use in the sort FOR z = 1 TO mf fSort$(z)= fList$(z) NEXT z 'SORT fSort$(), fIndex%(),&b10,0, mf+1 ' this one works SORT fSort$(), fIndex%(),&b10,1, mf ' this one gives strange fIndex%() ' print the sorted list and the original data using the index array FOR z = 1 TO mf PRINT STR$(fIndex%(z),4);" "; fSort$(z);" ";fList$(fIndex%(z)) NEXT z END Jim VK7JH MMedit  MMBasic Help |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8570 |
Thanks Jim I wasn't correctly passing the start index into the sort - will post b5 when I've tested all the fixes |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8570 |
V5.06.00b5 posted http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip Should fix the HELP and SORT bugs identified above also now allows any pages to be used for PAGE AND_PIXELS etc. Edited 2020-11-24 20:02 by matherp |
||||
markboston36 Regular Member Joined: 27/10/2020 Location: United StatesPosts: 76 |
i need to get on the ball and learn this so i can use all of these fancy new things. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5886 |
Close but no cigar. Fixed for string arrays but still has a problem with integer arrays when starting from an index other than zero. OPTION EXPLICIT OPTION DEFAULT NONE DIM INTEGER maxFiles = 500 ' adjust to suit expected maximum DIM fList$(maxFiles) LENGTH 60' file names for sorting DIM fSize%(maxFiles) ' file sizes dim fSort$(maxFiles) LENGTH 60 DIM fsortSize%(maxFiles) dim fIndex%(maxFiles) DIM INTEGER mf, z DIM f$ mf = 1 f$ = DIR$("*", ALL) DO WHILE f$ <> "" fSize%(mf)=MM.INFO$(FILESIZE f$) IF fSize%(mf) = -2 THEN ' it is a directory fList$(mf) = " "+f$+" <DIR>"' the leading space keeps directories sorted first ELSE fList$(mf) = f$ ENDIF mf = mf + 1 IF mf > maxFiles THEN EXIT DO f$ = DIR$() LOOP mf = mf -1 ' we now know the number of entries ' print the unsorted list FOR z = 1 TO mf PRINT STR$(z,4);" ";fList$(z) NEXT z ' sort by file size using numbers instead of strings math add fSize%(), 0, fSortSize%() ' SORT fSortSize%(), fIndex%(),&b10,0, mf+1 ' this one works SORT fSortSize%(), fIndex%(),&b10,1, mf ' this one has problems ' print the sorted list FOR z = 0 TO mf PRINT STR$(fIndex%(z),4);" "; STR$(fSize%(fIndex%(z)),10,0);" "; fList$(fIndex%(z)) NEXT z Jim VK7JH MMedit  MMBasic Help |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8570 |
Jim This code doesn't run - gives a string length error Can you come up with a simple example without involving strings if you think integer arrays are incorrect Edited 2020-11-25 08:50 by matherp |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5886 |
I assume you have file names longer than 60 characters. Try removing the 'length 60' of the two arrays Or this: OPTION EXPLICIT OPTION DEFAULT NONE DIM INTEGER maxFiles = 500 ' adjust to suit expected maximum DIM fSize%(maxFiles) ' file sizes DIM fsortSize%(maxFiles) dim fIndex%(maxFiles) DIM INTEGER mf, z DIM f$ mf = 1 f$ = DIR$("*", ALL) DO WHILE f$ <> "" fSize%(mf)=MM.INFO$(FILESIZE f$) mf = mf + 1 IF mf > maxFiles THEN EXIT DO f$ = DIR$() LOOP mf = mf -1 ' we now know the number of entries ' print the unsorted list FOR z = 1 TO mf PRINT STR$(z,4);" ";fSize%(z) NEXT z ' sort by file size using numbers instead of strings math add fSize%(), 0, fSortSize%() 'SORT fSortSize%(), fIndex%(),&b10,0, mf+1 ' this one works SORT fSortSize%(), fIndex%(),&b10,1, mf ' this one has problems ' print the sorted list (including index aero) FOR z = 0 TO mf PRINT STR$(fIndex%(z),4);" "; fSize%(fIndex%(z)) NEXT z Jim Edited 2020-11-25 09:07 by TassyJim VK7JH MMedit  MMBasic Help |
||||
LeoNicolas Guru Joined: 07/10/2020 Location: CanadaPosts: 441 |
The MATH Q_VECTOR command signature in the manual is wrong. The manual specifies this signature: MATH Q_VECTOR inV(), outVQ() and the correct is: MATH Q_VECTOR x,y,z,outVQ() |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3833 |
A new bug to "blow your mind", at least it did mine. As usual the code below is a stripped down version of something moderately sane: Colour Maximite 2 MMBasic Version 5.06.00b5 Copyright 2011-2020 Geoff Graham Copyright 2016-2020 Peter Mather > list "bug.bas" repeat() End Sub repeat() Local i$ ' Local j$ Print "Hello" Pause 2000 Run "bug.bas" End Sub Run whilst looking at the VGA display. It should display: Hello Hello Hello Hello ... It did this on beta 2, but in beta 5 it clears the screen between each invocation but doesn't reset the y position, so instead the text "Hello" slowly migrates down the screen. I'm not sure if it is intended but please don't start clearing PAGE 0 automatically before/after program invocations, that will make writing programs that extend the capabilities of the BASIC console and work on the VGA display impossible. But this isn't even the bug that blows my mind, now uncomment the Local j$ and run again, still looking at the VGA display. The display now flashes / re-synchs / blanks, whatever the technical term is, between each program invocation and it did this in beta 2 as well. Best wishes, Tom Edited 2020-11-26 06:28 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1082 |
I would extend that and say, please don't clear ANY pages when a program is run. If a programmer needs a cleared page, it is the programmer's responsibility to do the clearing. Yes, my 3D maze program shows corrupted graphics when run after another program that used higher pages, but that is not the job of the firmware to fix. As Tom says, there could be many reasons to want pre-existing data to persist between separate programs. Visit Vegipete's *Mite Library for cool programs. |
||||
Page 1 of 3 |
Print this page |