Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 08:12 19 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 6 of 8    
Author Message
Sasquatch

Senior Member

Joined: 08/05/2020
Location: United States
Posts: 296
Posted: 04:21pm 03 Jul 2020
Copy link to clipboard 
Print this post

I only received my Waveshare modules this week.  Took 7 weeks to arrive from Waveshare in China.  I have been running the demo's and games posted here and I am thoroughly enjoying the project so far.

One major feature that I find is lacking compared to the 8 bit machines of the '80s and '90s is the ability to load a file into memory and then "jump" or transfer execution to the code that was just loaded.  This allowed code written in assembler or compiled code to be run in "bare metal" mode.  As far as I can recall, ALL of the old 8 bit home computers (C64, TRS-80, Apple][ etc.) had provision for this.

I realize that the primary focus of this project, as well as the entire MicroMite family, is that MMBasic lowers the bar of entry as well as provides a nostalgic feel for those of us who cut our teeth on the 8bit home computers.  The performance of MMBasic on these modern 32bit CPU's is quite impressive.

It might be argued that there would be little interest or that support for such a feature would become a nightmare etc.  However, the ST developer tools (C-compiler etc.) are FREE and the source code for MMBasic could also be used as a "library" of functions in C to get things rolling.  

While MMBasic is simple and the learning curve is short, the ability to program the "bare metal" in C (with free compiler etc.) might encourage those who have not yet "taken the leap" into modern compiled languages.  The hope would be that the community would provide open-source examples and demos that would provide newbies a starting point.  Additionally, this could bring interest from those in the Arduino and other communities to take a closer look at the project.

Oh, and the demo-scene would be absolutely fantastic!

I realize that the prospect of providing documentation and support for compiled code seems daunting.  At this point I'm just asking that this feature should be considered and possibly implemented and left to the community to see where it might lead.
-Carl
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1085
Posted: 07:11pm 03 Jul 2020
Copy link to clipboard 
Print this post

Would the SPRITE READ command benefit from having an optional [source page] parameter?
Visit Vegipete's *Mite Library for cool programs.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3678
Posted: 08:17pm 03 Jul 2020
Copy link to clipboard 
Print this post

  Sasquatch said  the ability to load a file into memory and then "jump" or transfer execution to the code that was just loaded.  This allowed code written in assembler or compiled code to be run in "bare metal" mode.

Someone wanting that could add it.  Common toolchains support the ST chip and ST provide lots of doc, including about the builtin bootloader.

It's not currently a feature of CMM2's MMBasic.

I'm not sure which would be the fastest/easiest way to get it.  Possibly by tweaking MMBasic but perhaps not.  It's very easy to replace the chip's flash contents (e.g. via USB, no special tool needed) so bare metal is already easy.

John
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 06:02am 05 Jul 2020
Copy link to clipboard 
Print this post

  vegipete said  Would the SPRITE READ command benefit from having an optional [source page] parameter?


So as I understand it, the alternative is to set "PAGE WRITE" for which page the sprite will be read from. Your version is a bit clearer.

Also I've seen a warning, "While sprites are in use, all sprite commands must be done with the same PAGE WRITE set". (in 2020-07-01_152409_Graphics Programming on the CMM2-v1.0b.pdf)

I don't know if the warning needs to apply to "SPRITE READ". If not, that would be good to know, and to note with the warning.
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 06:22am 05 Jul 2020
Copy link to clipboard 
Print this post

It would be nice for PLAY SOUND to have an optional duration, so new programmers can try it out without needing to learn the timing commands first, and without getting an annoyingly long beep.

It could just do the equivalent of:
PLAY SOUND soundno, channelno, type, frequency, volume : PAUSE duration : PLAY SOUND soundno, channelno, "O"

-- Caspian
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 08:11am 06 Jul 2020
Copy link to clipboard 
Print this post

For reading a sprite from screen (SPRITE READ) or loading from an array (SPRITE LOADARRAY), would you want to allow selecting a different colour to be transparent, similar to how the pi-cromite has an option for choosing the transparent colour in "SPRITE LOAD [#]n, fname$ [,colour]"?

-- Caspian
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 08:51am 06 Jul 2020
Copy link to clipboard 
Print this post

  Quote  Would the SPRITE READ command benefit from having an optional [source page] parameter?


Can add this in next version

  Quote  the ability to load a file into memory and then "jump" or transfer execution to the code that was just loaded.  This allowed code written in assembler or compiled code to be run in "bare metal" mode.


CFunctions are now supported and have access to internal firmware routines

  Quote  It would be nice for PLAY SOUND to have an optional duration,

PLAY TONE has this capability. However, for PLAY SOUND there can be 8 independent sounds which would all need timers tracking and this is too much overhead for the sound interrupt which is already too big - sorry

  Quote  For reading a sprite from screen (SPRITE READ) or loading from an array (SPRITE LOADARRAY), would you want to allow selecting a different colour to be transparent, similar to how the pi-cromite has an option for choosing the transparent colour in "SPRITE LOAD [#]n, fname$ [,colour]"?


SPRITE READ in 12-bit mode will import the transparency of the original image. I removed the optional transparent colour for performance reasons - use an ARGB8888 png file for proper trnasparency
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 01:53pm 06 Jul 2020
Copy link to clipboard 
Print this post

  matherp said  
  Quote  It would be nice for PLAY SOUND to have an optional duration,

PLAY TONE has this capability. However, for PLAY SOUND there can be 8 independent sounds which would all need timers tracking and this is too much overhead for the sound interrupt which is already too big - sorry


Okay, sure.

  matherp said  
  Quote  For reading a sprite from screen (SPRITE READ) or loading from an array (SPRITE LOADARRAY), would you want to allow selecting a different colour to be transparent, similar to how the pi-cromite has an option for choosing the transparent colour in "SPRITE LOAD [#]n, fname$ [,colour]"?


SPRITE READ in 12-bit mode will import the transparency of the original image. I removed the optional transparent colour for performance reasons - use an ARGB8888 png file for proper trnasparency


Yeah, I didn't mean for PNGs without their own transparency. I was thinking of when I don't have an external image file to use, and I might want to make a sprite that has solid black parts, separate from the sprite's background.

I realised there's another way to do it, if I understand the guides correctly. In 8 bit mode, I could set a non-zero colour index to black using map(c)=RGB(0,0,0). Then use colour 0 for background, colour c for black. Does that look right?

So it's only in 16 bit mode it can't be done, with SPRITE READ.

For SPRITE LOADARRAY, should it be possible to load 8-bit colour indexes when in 8-bit mode, instead of RGB numbers? Otherwise it can be done using SPRITE READ.
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1085
Posted: 03:18pm 06 Jul 2020
Copy link to clipboard 
Print this post

  capsikin said  Yeah, I didn't mean for PNGs without their own transparency. I was thinking of when I don't have an external image file to use, and I might want to make a sprite that has solid black parts, separate from the sprite's background.

I had this problem when I was making the deck of playing cards posted in another thread. My solution was to make the black parts very dark gray - &h101010 for example.
Visit Vegipete's *Mite Library for cool programs.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3865
Posted: 08:50am 09 Jul 2020
Copy link to clipboard 
Print this post

Does MMBasic provide a mechanism to find the size of an array, e.g. when it is passed into a function or subroutine?

If not, then could one be added? The interpreter must know this because it reports an error if you access an out of bounds element.

Regards,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3167
Posted: 12:05pm 09 Jul 2020
Copy link to clipboard 
Print this post

Currently there is no way for a program to get the size of an array.  

On reflection, it would be difficult to come up with a logical syntax that could deal with multiple dimensions.  The manual recommends passing the size as additional parameter(s) to the sub/fun that will manipulate the array.  This might not be the neatest approach but it works and is used in other languages.

Geoff
Geoff Graham - http://geoffg.net
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3865
Posted: 03:52pm 09 Jul 2020
Copy link to clipboard 
Print this post

  Geoffg said  Currently there is no way for a program to get the size of an array.

On reflection, it would be difficult to come up with a logical syntax that could deal with multiple dimensions.  The manual recommends passing the size as additional parameter(s) to the sub/fun that will manipulate the array.  This might not be the neatest approach but it works and is used in other languages.


Thanks Geoff, and understood, I just thought I might be missing something since the interpreter knows these values. I guess they are nowhere conveniently PEEKable either?

Regards,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
pipati
Newbie

Joined: 09/07/2020
Location: Norway
Posts: 1
Posted: 09:25pm 09 Jul 2020
Copy link to clipboard 
Print this post

  matherp said  re Raspberry Pi (copied from an email to someone asking why not Raspberry Pi)

At the end of the day it possibly could be done but I chose to use the ST chip because there is an excellent development environment that I had used before.

... The ST has a 1000 page manual explaining the internals in precise detail and a guaranteed support life.


Hi, would you mind listing the tools you use, and perhaps suggest how to get started?

Thanks, John
 
MikoKisai
Newbie

Joined: 10/07/2020
Location: Germany
Posts: 6
Posted: 01:48am 10 Jul 2020
Copy link to clipboard 
Print this post

  Geoffg said  Currently there is no way for a program to get the size of an array.  

On reflection, it would be difficult to come up with a logical syntax that could deal with multiple dimensions.  The manual recommends passing the size as additional parameter(s) to the sub/fun that will manipulate the array.  This might not be the neatest approach but it works and is used in other languages.

Geoff


QBasic had two functions relating to this, LBOUND and UBOUND. Both took an array as the first parameter and an optional dimension index (starting at and defaulting to 1), and returned the lowest or highest index for that dimension.

Perhaps that could serve as inspiration here? From my understanding, MMBasic doesn't support arbitrary start indexes like QB did (only OPTION BASE) so it probably only needs the UBOUND function (and in that case, naming it BOUND might be better).
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2294
Posted: 02:07am 12 Jul 2020
Copy link to clipboard 
Print this post

peter: a quick question: does the CMM2 firmware detect if the H7 is a 400MHz or a 480MHz part and then program the clock dividers appropriately at startup, or is this hard-wired into the silicon?

if it were programmable, it may be useful to have a OPTION command to select between the speeds, as i see the odd report in the forums of some folks having issues with video noise that may be related to the higher speed. being able to select the speed would enable diagnosing this. ideally, there would be three settings: 400, 480, and AUTO


cheers,
rob   :-)
Edited 2020-07-12 12:09 by robert.rozee
 
Womble

Senior Member

Joined: 09/07/2020
Location: United Kingdom
Posts: 267
Posted: 12:30am 15 Jul 2020
Copy link to clipboard 
Print this post

  robert.rozee said  if it were programmable, it may be useful to have a OPTION command to select between the speeds, as i see the odd report in the forums of some folks having issues with video noise that may be related to the higher speed. being able to select the speed would enable diagnosing this. ideally, there would be three settings: 400, 480, and AUTO

That would be me   both video noise and sound problems.  I'm hoping that the suggested external Oscillator Mod will help/fix the problem.  The capacitors arrived today, and the oscillator is on its way from Farnell in Belgium.

I saw reference by one of the devs (Peter?) to overclocking the H7 during testing, so hopefully its a software setting (like the R.Pi).  I would also like to see the above Option if it is possible to easily implement.
 
Womble

Senior Member

Joined: 09/07/2020
Location: United Kingdom
Posts: 267
Posted: 10:59am 17 Jul 2020
Copy link to clipboard 
Print this post

External oscillator mod fixed the video noise/tearing problem for me.  I still have audio issues which could be Waveshare issue, or maybe ground loop interference.  The ability to switch frequencies would be useful for testing.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3027
Posted: 11:26pm 19 Jul 2020
Copy link to clipboard 
Print this post

What I could use at the moment, is an "eval-like" function that will take a BASIC command (or in particular an assignment) rather than a BASIC expression.

So I'd like to be able to do 'EVAL("someVarName=1234")' (where "someVarName" is not known when the program starts, but then the variable would have been created). Is such a thing available now, or is it reasonable to make it available?

Hmmm, upon reflection, I'm not sure how this dynamic expansion of the program's variable list would work.
Edited 2020-07-20 09:30 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 01:53am 20 Jul 2020
Copy link to clipboard 
Print this post

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

Joined: 17/05/2016
Location: United States
Posts: 3027
Posted: 12:52pm 30 Jul 2020
Copy link to clipboard 
Print this post

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

~
Edited 2020-07-30 22:54 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
     Page 6 of 8    
Print this page
© JAQ Software 2024