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 2 of 3 | |||||
Author | Message | ||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
Ooh, we could use screen memory to pass data between consecutive programs ... Just kidding, I think Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Sasquatch Senior Member Joined: 08/05/2020 Location: United StatesPosts: 296 |
Does "Case Is" no longer work? Try this program: Option Explicit Dim X as float X = 10 Select Case X Case Is < 5 Print "Less than 5" Case 5 Print "Equals 5" Case Is > 5 Print "Greater than 5" Case Else Print "Done" End Select -Carl |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5912 |
CASE works but it looks like IS doesn't so use the variable instead: OPTION EXPLICIT DIM X AS FLOAT X = 10 SELECT CASE X CASE x < 5 PRINT "Less than 5" CASE 5 PRINT "Equals 5" CASE x > 5 PRINT "Greater than 5" CASE ELSE PRINT "Done" END SELECT PRINT "finished" Jim VK7JH MMedit  MMBasic Help |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5912 |
Sorry, I meant to edit the previous post. CASE works but it looks like IS doesn't so leave it out instead (IS was always optional): OPTION EXPLICIT DIM X AS FLOAT X = 10 SELECT CASE X CASE < 5 PRINT "Less than 5" CASE 5 PRINT "Equals 5" CASE > 5 PRINT "Greater than 5" CASE ELSE PRINT "Done" END SELECT PRINT "finished" Edited 2020-11-26 08:41 by TassyJim VK7JH MMedit  MMBasic Help |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
Sorry, but it is nonsensical to assume anything is set after a program is run except data you have stored using VAR SAVE. Anything which was still there is pure happenstance and no program should rely on it - just bad practice. In the MM2 Geoff now does a software reset before a program is run to ensure everything is reset and the CMM2 may well follow that practice Edited 2020-11-26 08:55 by matherp |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
I only asked you not to change the now longstanding behaviour of previous versions (and I believe the CMM1) and not clear the VGA display between programs. If you do then you basically make any possibility of enhancing the CMM2 with an extended set of command line tools a pipe dream. Imagine how useless Unix, DOS and the whole catalogue of console driven computers would have been if every command/program executed cleared the screen. EDIT: just checked the one authentic microcomputer I have at hand and that doesn't clear the display before or after running a program. That is what CLS is for. My understanding is that there is a big difference between the purpose of the MM2 and the CMM2 (with a VGA display). The former is intended to be used as a microcontroller whereas the latter was designed to be a microcomputer (implemented via a microcontroller). Please don't break this or the nay-sayers will be correct and the CMM2 is just going to be a games machine. Best wishes, Tom Edited 2020-11-26 09:36 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
johnd Newbie Joined: 22/10/2020 Location: United StatesPosts: 30 |
If it needs to be reset for some reason after running a program, how about making it an Option and maybe it could default to true. But if you don't want it reset you could use OPTION RESET OFF. Best of both worlds, except for the extra firmware coding. |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
I'm still hoping this is all some great misunderstanding in Peter's expression of, or my comprehension of his intentions and their implications. If it isn't a misunderstanding and Peter is determined on this course then I wouldn't make it an OPTION, I think that would give the CMM2 one two many modes of operation and the issues that arise from different behaviour observed by different users. Better to make a decision, and if people (e.g. me) don't like it they should probably find something better to do with their time My opinion is that for reasons of historical precedence, utility and backward-compatibility the CMM2 in its primary advertised role as a microcomputer should preserve the VGA display (PAGE 0) and the Y cursor position between programs. If any given program doesn't want this behaviour it should call CLS. As Peter expressed I think relying on anything being maintained in the rest of the screen or other memory (except as supported by VAR SAVE) is a bad idea; the CMM2 has a fast file system so files can be used to exchange information between programs, not memory tricks. Yours sincerely, Tom Edited 2020-11-26 19:56 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1097 |
I'm with Peter on this one re leaving something on the screen. If you want what remains on the screen from one program to be available for some later program, save it to a file for later recovery. To leave any remnants of one program's video output for some possible future program IMHO, just doesn't make sense to me. I understand your specific requirement Tom but can't, politely, agree, Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
That's fine Doug, but it is not backward compatible with how previous versions of the firmware behave (or the CMM1 I believe) and also not compatible with the 80's era microcomputers that the CMM2 seeks to ape, e.g. C64 and BBC micro. Can I suggest we wait to hear from Peter just in case this is all a misunderstanding ? Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
Please note I don't want it to "be available for some later program", I want it to be available for the USER. If I implement "find", "grep" and "count", then as a USER I don't want the screen to clear between each of the commands: *find "*.bas" > "out.txt" *grep "foo" < "out.txt" > "out2.txt" *count < "out2.txt" In this example no program is relying on the screen output by the previous program, data is exchanged via files, however the USER experience is greatly improved if they can see all the "commands" they've issued. Note I'm aware that the BASIC "shell" doesn't implement redirection; you have to build it into each programs separately. Best wishes, Tom Edited 2020-11-26 20:13 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
V5.06.00b6 http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip This fixes the CASE IS issue - another case of too aggressive crunching It hopefully fixes all variants of the SORT command (thanks to Jim for the testing) It fixes a bug in using the PIXEL command with arrays This was a really nasty memory corruption bug that was uncovered because I put the clearance of video memory into the last beta but has been there for a long time. This is also now fixed. Now onto the video clearing issue - The purist in me (and despite the way I develop I am at heart a purist ) says everything should be cleared when you run a new program and many (including Geoff) agree. However, I do understand Tom's point of view. In this release all video pages except page 0 are cleared when you run a program and the x and y positions are not changed. Any mode change will of course clear page 0 but if you run a program in the same mode as the default (OPTION DEFAULT MODE) then it will be up to you to clear the screen. I hope this is a compromise everyone can accept. Note: this version runs a little faster than previous versions. There is precisely no reason for this. Every time I compile some combination of the compiler optimisation and the way that caching works in the processor seems to yield a very slightly different result. Edited 2020-11-26 21:03 by matherp |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
Thank you Peter, I look forward to testing it later in the day. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
Bug with CHOICE unless I'm doing something daft? > Print Asc(Choice("a" = "a", " ", "b")) 1 Output should be "32", the ASCII code of the " " space character. And: > Print Choice("a" = "a", "a", "b") a <-- looks correct > Print Choice("a" = "a", "a", "b") = "a" 0 <-- should be 1 > Print (Choice("a" = "a", "a", "b") = "a") 0 <-- ditto Best wishes, Tom Edited 2020-11-27 02:18 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
It's returning the length of the string. Fixed in next beta. Confusion over C type strings and MMBasic type strings. At the moment all string returns from choice have an extra character at the front - this will be non-printing for short strings Edited 2020-11-27 02:19 by matherp |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
Thank you. Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
As the change is trivial I've just replaced b6 |
||||
mclout999 Guru Joined: 05/07/2020 Location: United StatesPosts: 430 |
How is the 5.6.0 manual progressing? I have lost track of all the changes that are happening and look forward to a new manual that chronicles the epic enhancements to the CMM2. I am amazed at the progress this project keeps making including 3D functions arriving soon. Thanks as always to our beneficent leaders that make this all possible and so exciting to be involved with. |
||||
vegipete Guru Joined: 29/01/2013 Location: CanadaPosts: 1082 |
The purist in me (and despite the way I develop I am at heart a purist ) says everything should be cleared when you run a new program and many (including Geoff) agree. However, I do understand Tom's point of view. In this release all video pages except page 0 are cleared when you run a program and the x and y positions are not changed. Any mode change will of course clear page 0 but if you run a program in the same mode as the default (OPTION DEFAULT MODE) then it will be up to you to clear the screen. I hope this is a compromise everyone can accept. To be clear, screen memory, other than page 0, is cleared _only_ when a program is _run_, correct? When a program terminates, I can still examine what was left. Good. By cleared, I gather you mean, set to 0. Why 0? Why not 0xFF? What if OPTION COLOURCODE REVERSE is set? Never mind. Leave the can of worms alone. If it must be, then (most but not all stuff) cleared to 0 on run is fine. Visit Vegipete's *Mite Library for cool programs. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
Has only ever applied to the filemanager and editor |
||||
Page 2 of 3 |
Print this page |