Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 05:17 04 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 : CMM2: V5.06.00b4: More "fun" functionality for testing

     Page 2 of 3    
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3848
Posted: 09:29pm 25 Nov 2020
Copy link to clipboard 
Print this post

  vegipete said  As Tom says, there could be many reasons to want pre-existing data to persist between separate programs.


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 States
Posts: 296
Posted: 09:57pm 25 Nov 2020
Copy link to clipboard 
Print this post

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: Australia
Posts: 5912
Posted: 10:31pm 25 Nov 2020
Copy link to clipboard 
Print this post

  Sasquatch said  Does "Case Is" no longer work?


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: Australia
Posts: 5912
Posted: 10:39pm 25 Nov 2020
Copy link to clipboard 
Print this post

Sorry, I meant to edit the previous post.
  Sasquatch said  Does "Case Is" no longer work?


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 Kingdom
Posts: 8592
Posted: 10:54pm 25 Nov 2020
Copy link to clipboard 
Print this post

  Quote  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.


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 Kingdom
Posts: 3848
Posted: 11:18pm 25 Nov 2020
Copy link to clipboard 
Print this post

  matherp said  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


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 States
Posts: 30
Posted: 08:48am 26 Nov 2020
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 3848
Posted: 09:55am 26 Nov 2020
Copy link to clipboard 
Print this post

  johnd said  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.  


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: Australia
Posts: 1097
Posted: 10:00am 26 Nov 2020
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 3848
Posted: 10:05am 26 Nov 2020
Copy link to clipboard 
Print this post

  panky said  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.


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 Kingdom
Posts: 3848
Posted: 10:12am 26 Nov 2020
Copy link to clipboard 
Print this post

  panky said  ... If you want what remains on the screen from one program to be available for some later program ...


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 Kingdom
Posts: 8592
Posted: 11:02am 26 Nov 2020
Copy link to clipboard 
Print this post

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

  Quote  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.


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 Kingdom
Posts: 3848
Posted: 11:05am 26 Nov 2020
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 3848
Posted: 03:59pm 26 Nov 2020
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 8592
Posted: 04:17pm 26 Nov 2020
Copy link to clipboard 
Print this post

  Quote  Bug with CHOICE unless I'm doing something daft?

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 Kingdom
Posts: 3848
Posted: 04:19pm 26 Nov 2020
Copy link to clipboard 
Print this post

  matherp said  
  Quote  Bug with CHOICE unless I'm doing something daft?

It's returning the length of the string. Fixed in next beta. Confusion over C type strings and MMBasic type strings


Thank you.
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 04:36pm 26 Nov 2020
Copy link to clipboard 
Print this post

As the change is trivial I've just replaced b6
 
mclout999
Guru

Joined: 05/07/2020
Location: United States
Posts: 430
Posted: 05:08pm 26 Nov 2020
Copy link to clipboard 
Print this post

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: Canada
Posts: 1082
Posted: 06:32pm 26 Nov 2020
Copy link to clipboard 
Print this post

  matherp said  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.

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 Kingdom
Posts: 8592
Posted: 06:36pm 26 Nov 2020
Copy link to clipboard 
Print this post

  Quote   What if OPTION COLOURCODE REVERSE is set?

Has only ever applied to the filemanager and editor
 
     Page 2 of 3    
Print this page
© JAQ Software 2024