Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 18:42 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: Next steps?

     Page 7 of 8    
Author Message
Atomizer_Zero
Senior Member

Joined: 04/07/2020
Location: United Kingdom
Posts: 134
Posted: 02:02pm 30 Jul 2020
Copy link to clipboard 
Print this post

Couple things I would like, for convenience more than anything.. (please forgive me if these are already possible. If so, I would LOVE to know how!)

Conditional Operator.
PSUEDO: result = (a > b) ? a : b
TRANSLATION :
if (a > b) then
 result = a
else
 result = b
end if

This is somewhat already possible
result = (a > b)
which would return a 1 if true or 0 if false. But the benifit of the Conditional Operator is that you could return whatever value you want based on if result was a 1 or 0, all in one line.

Combined Numeric Operations, such as
+=, -=, or=, and=, /=, ++, --, etc.


Again these are for convenience more than anything else. having a++ instead of a = a + 1, is nice lol
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 02:19pm 30 Jul 2020
Copy link to clipboard 
Print this post

Maybe there's a better way to do this, but I would really love some additions to the sprite commands that would allow a way to resize a sprite either when it's being loaded or after it's been loaded.

For example, I found some sprites online that I like, but I need them to be a lot smaller to work in my game. Currently I'm having to load them as a graphic to a hidden page, then copy that region to another area on the same page but resized smaller, then read that smaller region into the sprite...

Would be nice if I could just say when loading the sprite in from a PNG or whatever "make it this size" (or even better to be able to specify one of the dimensions and have it calculate the other to maintain the original aspect ratio.)

Alternatively allow us to load in a sprite and then in the sprite copy command have a way to specify the resize in the copy operation.
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 02:23pm 30 Jul 2020
Copy link to clipboard 
Print this post

  lizby said  
  mkopack73 said  How about ON ERROR GOTO label. ??? Be a bit like exception handling in  C++ or Java

This function is easily achieved now (for specific instruction lines) with, for instance:
   On error skip
   Open sFN For random As #2 ' try to open index file
   If MM.Errno<>0 Then

where whatever you want can follow "then".

~


Can you give a little bigger example?

When I've tried to use the skip option I just couldn't figure out WHAT it was skipping. It as an [n] option to say how many instructions (but instructions != lines)...

I just would like to be able to say:

ON ERROR GOTO errorhandling

<do some lines of instructions, if there is any sort of problem it jumps down to the errorhandling label>

END

errorhandling:
print "There was a problem..."
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3017
Posted: 03:19pm 30 Jul 2020
Copy link to clipboard 
Print this post


 On error skip
 Open sFN For random As #2 ' try to open index file
 If MM.Errno<>0 Then  GOTO errorhandling

'  ... some more code

 END

errorhandling:
 print "There was a problem..."
 end ' or fix it and continue somewhere

"ON ERROR SKIP" means no error message will be produced if the following line errors.

Then "If MM.Errno<>0 Then" gives you an opportunity to do anything you like when an error was detected.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 01:08am 31 Jul 2020
Copy link to clipboard 
Print this post

hi

I am finish my CMM2 (thank for "keyboard Fr"   )

I have a wish: would it be possible to add a permanent (saved) option "Keynumlock on" or "keynumlock off".
Let me explain: at startup or after using certain options (I tested with "ram option"), even if before we selected the "Num Lock" key on the numeric keypad, the numeric keypad is not more active.
When you are used to working with a 105-key keyboard and using the numeric keypad, it is difficult to work as if you have a 95-key keyboard.
 
mxck
Newbie

Joined: 30/07/2020
Location: New Zealand
Posts: 9
Posted: 11:34am 01 Aug 2020
Copy link to clipboard 
Print this post

I second the introduction of a `CALL <mem_addr>` keyword so that we can step in and out of assembly language. Obviously once one of those is called you're mostly "on your own" if you mess up ;D
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3848
Posted: 11:48am 01 Aug 2020
Copy link to clipboard 
Print this post

  mxck said  I second the introduction of a `CALL <mem_addr>` keyword so that we can step in and out of assembly language. Obviously once one of those is called you're mostly "on your own" if you mess up ;D


I'm probably wrong, but do you really need one? If a normal CSub is not sufficient for your needs then I think you could use a CSub to switch the program counter to any arbitrary area of memory, such as an integer array (treated as bytes) that you have preloaded with machine code. Not certain how you would return to BASIC but if you are that determined to be close to the metal I'm sure it could be managed.

... basically use a CSub to roll your own CALL command.

Regards,

Tom
Edited 2020-08-01 21:54 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

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

This thread was aimed at looking at changes to include in 5.05.04 which is now the current release. As large numbers of CMM2 are starting to be in use I don't intend to make any further significant changes as this will lead to issues with the expanding userbase. The CMM2 can now be considered "complete". V5.05.05 will just be a maintentance release picking up any remaining bugs or logical ommisions in functionality.

  Quote  I second the introduction of a `CALL <mem_addr>` keyword so that we can step in and out of assembly language.


The way of using assembler or compiled C is using the CSUB.

  Quote  Couple things I would like, for convenience more than anything.. (please forgive me if these are already possible. If so, I would LOVE to know how!)


This has been discussed in the past for other MMBasic platforms. There is no logic in implementing bits of C syntax in Basic - where do we stop?

  Quote  How about ON ERROR GOTO label. ??? Be a bit like exception handling in  C++ or Java

Sorry, but unless that is something Geoff includes in a future release of MMbasic it won't be in the CMM2

  Quote  Let me explain: at startup or after using certain options (I tested with "ram option"), even if before we selected the "Num Lock" key on the numeric keypad, the numeric keypad is not more active.


Changing permanent options is not something you are expected to do on a routine basis. Changing many of them can only be implemented by doing a S/W reset which will re-initialise the processor and in your case the NUMLOCK setting. Once you have a stable setup you will only need to press the NUMLOCK key after each power cycle. Getting the Lock keys to work at all was not easy with the ST USB Host stack. I'm not going to make changes to this. It is not as easy as it may seem.

  Quote  For example, I found some sprites online that I like, but I need them to be a lot smaller to work in my game.


The expectation is that you do things like this on the machine where you downloaded the sprite in the first place. The CMM2 can't do the download so it makes little sense to try and include a graphics editor replicating widely available functionality on the mainstream desktop platforms
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3662
Posted: 12:04pm 01 Aug 2020
Copy link to clipboard 
Print this post

+1 CSub as it now is looks to be all that's needed.

John
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3848
Posted: 12:44pm 01 Aug 2020
Copy link to clipboard 
Print this post

  matherp said  
  Quote  Couple things I would like, for convenience more than anything.. (please forgive me if these are already possible. If so, I would LOVE to know how!)


This has been discussed in the past for other MMBasic platforms. There is no logic in implementing bits of C syntax in Basic - where do we stop?


Personally I think that's a highly subjective argument, the creators of FreeBASIC certainly disagree with you ... but then if you wanted to argue that FreeBASIC (and for that matter VB.NET) are not actually BASIC then I might be inclined to agree.

However I think there are two less subjective arguments against their inclusion so the end result is the same:

1. I believe that operators count against the 128 tokens that the MMBasic interpreter reserves for Functions. This limit has been exhausted on the CMM2, so we can't have more operators without a re-architecting of the interpreter.

2. If we had them then it would reduce portability of even simple graphics-free programs to other 8-bit like BASIC implementations.

None of this means I wouldn't like these operators, just that we should understand and probably accept their absence.

YMMV,

Tom
Edited 2020-08-01 22:53 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2870
Posted: 11:09am 05 Aug 2020
Copy link to clipboard 
Print this post

Hi Peter, All,

As I test the CMM2 I build up I run many different test programs, some of which have extra files like sound or bmp images.. this means the directory is about half .BAS files and half ancillary files.

I know I can sort by TYPE but is it possible to only display .BAS files thus hiding all other files.

This could be an option, or ^B in the file manager or even by way of a hidden (or not displayed anyway) file with configuration for that card.

It could then possible hold configurations for access to the SD like file types to display or not display, default sort order, default directory and possibly other options I can’t even imagine of.

Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1593
Posted: 12:38am 04 Sep 2020
Copy link to clipboard 
Print this post

I was wondering if the PrtSc (print screen) key on the keyboard could be used in the firmware to save a copy of the screen as an image file in a similar way as the PC does to the clipboard?

It would be useful for reporting bugs for one thing, not only in the firmware, but in games as well. Also to capture a screen where the result is unexpected and you want to keep if for some reason or another.

OK, it can be done programmatically but in that case you need to be prepared for it and your program needs to be able to trap the key to act on it.

Just thinking.

Bill
Keep safe. Live long and prosper.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 1795
Posted: 03:59am 04 Sep 2020
Copy link to clipboard 
Print this post

On page one a request was made for a compiler.

"Would it be possible to add a C compiler to the OS or a BASIC compiler to speed up the program's execution? Yeah, I know it's a BASIC driven machine and it's not supposed to be able to squeeze every last bit of performance out of the hardware..."

Could a pretend compiler be made with an extension to the RUN command by saving the interpreted code to file or, for regular MicroMites to a Library Function instead of actually running it?

eg. RUN to FILE FileName
or  RUN to FUNCTION FunctionName

It could then be called from within a program like any other saved function.

Hopefully the pre-interpreted functions would run faster than normal.

Phil
Edited 2020-09-04 14:10 by phil99
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 10:14am 04 Sep 2020
Copy link to clipboard 
Print this post

It is time to wind up this thread as V5.05.05 is complete as far as the main functionality I intend to include in the CMM2

Any future releases will be largely maintenance releases picking up any outstanding bugs and minor functional tweaks.

Re the recent points raised:

  Quote  As I test the CMM2 I build up I run many different test programs, some of which have extra files like sound or bmp images.. this means the directory is about half .BAS files and half ancillary files.

I know I can sort by TYPE but is it possible to only display .BAS files thus hiding all other files.

This could be an option, or ^B in the file manager or even by way of a hidden (or not displayed anyway) file with configuration for that card.

It could then possible hold configurations for access to the SD like file types to display or not display, default sort order, default directory and possibly other options I can’t even imagine of.


Sorry - this comes into the too hard category. Because the filemanger has to include directories I can't use the built-in pattern matching to filter file types so it would be a huge amount of code for limited advantage

  Quote  I was wondering if the PrtSc (print screen) key on the keyboard could be used in the firmware to save a copy of the screen as an image file in a similar way as the PC does to the clipboard?


I've got a better solution for this requirement that I'll include in a future release

  Quote  Could a pretend compiler be made with an extension to the RUN command by saving the interpreted code to file or, for regular MicroMites to a Library Function instead of actually running it?


No: that isn't how the interpreter works so there is no intermediate code that could be saved
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 367
Posted: 10:17am 04 Sep 2020
Copy link to clipboard 
Print this post

Not sure if this is the right place - but currently using CMM2 and MMBasic (on Windows) in an educational setting.

What would be really useful would be to be able to code on MMBasic (Windows) and for the code to run on the PC in a way that reflects the CMM2.

I'm really thinking of the graphics elements of the CMM2 --  A whole class set (say 30) CMM2's is not likely to be practical -- so my users need to code in a PC environment and transfer to the CMM2 --- this is fine for text / data work --- but anything graphical needs to be coded on the CMM2 (or with a CMM2 tethered to a PC).

Appreciate that this is probably not the thread to post this is -- I was being "opportunist" ;-)

I would second this:  >>> Combined Numeric Operations, such as
+=, -=, or=, and=, /=, ++, --, etc  as a segue to Python-esqu syntax (sorry to drop the P bomb).

Always - awesome work.

Nim
Entropy is not what it used to be
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 10:27am 04 Sep 2020
Copy link to clipboard 
Print this post

  Quote  What would be really useful would be to be able to code on MMBasic (Windows) and for the code to run on the PC in a way that reflects the CMM2.


If you have the odd 1000 hours free to code it - feel free

  Quote  I would second this:  >>> Combined Numeric Operations, such as
+=, -=, or=, and=, /=, ++, --, etc  as a segue to Python-esqu syntax (sorry to drop the P bomb).


Discussed repeatedly - not Basic - not happening sorry
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3848
Posted: 10:30am 04 Sep 2020
Copy link to clipboard 
Print this post

  matherp said  

  Quote  I would second this:  >>> Combined Numeric Operations, such as
+=, -=, or=, and=, /=, ++, --, etc  as a segue to Python-esqu syntax (sorry to drop the P bomb).


Discussed repeatedly - not Basic - not happening sorry


Have you considered a FAQ
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3558
Posted: 11:02am 04 Sep 2020
Copy link to clipboard 
Print this post

Dear matherp,

You explained this was the thread investigating features for 5.04.
And we are at 5.05 already... so this thread is old.

About the feature:
If there is flash space available, you could use some of it to expand the help text.

In linux you have the "man" that gives a short description (sometimes long) for each command.
In most IDE's there is a "hover over" help that explains the syntax.

For MMBasic, especially the syntax of commands could be explained. Similar to what in the user manual is written.
It can be in the form of "help loop" typed from the commandline
Or a luxuous function key press when the cursor is at a keyword showing the help text.

Regards,

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 11:07am 04 Sep 2020
Copy link to clipboard 
Print this post

  Quote  It is time to wind up this thread as V5.05.05 is complete as far as the main functionality I intend to include in the CMM2
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1593
Posted: 11:10am 04 Sep 2020
Copy link to clipboard 
Print this post

  Quote   Quote  
I was wondering if the PrtSc (print screen) key on the keyboard could be used in the firmware to save a copy of the screen as an image file in a similar way as the PC does to the clipboard?


I've got a better solution for this requirement that I'll include in a future release

Thanks Peter I’ll be interested in seeing what you come up with.  It will also be useful for documenting games and things like your graphics tutorial.

Bill
Keep safe. Live long and prosper.
 
     Page 7 of 8    
Print this page
© JAQ Software 2024