Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:08 02 Aug 2025 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: Memory map?

     Page 3 of 3    
Author Message
alynna
Newbie

Joined: 05/10/2021
Location: United States
Posts: 28
Posted: 10:24pm 08 Oct 2021
Copy link to clipboard 
Print this post

  Mixtel90 said  It's only on the CMM2 that you don't need the ASCII representation of CSUBs in RAM. That's because on all the other platforms the editor and the program are both in RAM at the same time - they are not external file based. The CMM2 keeps the ASCII on the SDcard. Also, because the CMM2 is file-based, it can use #DEFINE & #INCLUDE, which aren't available on other platforms (AFAIK!).

This explains Peter's earlier answer: "Possibly true for the CMM2 but not for the ArmmiteF4, PicoMite, and ArmmiteH7 which all run the same code (edit/autosave needs the ascii source) so it is not something I'm going to change".


Got it, i'll scrap that idea.   The inline assembler seems like it will be more fun anyway... a bit more acorn-like.

Long ago (like 20 years) I wrote an extension for C64 BASIC that allowed you to inline assembler.   In the most awesome way:

10 x%=0:inc x%:lda x%:sta $d020:?x,:goto 10

The variable would always be replaced with the location of the variable.  Good for working with strings.  Ints were a little more tricky, being two bytes, but the syntax like a$[4] would autoload the y register and create instructions like lda (location of a$),y.  And for ints, if you did lda >x%, that would translate to lda (location of x% + 1).

So I already have an idea for expanded syntax for the assembler...
Edited 2021-10-09 08:26 by alynna
 
alynna
Newbie

Joined: 05/10/2021
Location: United States
Posts: 28
Posted: 10:34pm 08 Oct 2021
Copy link to clipboard 
Print this post

  matherp said  
  Quote  6there is no reason that the "hexadecimal text" ever need be copied into the program memory.


Possibly true for the CMM2 but not for the ArmmiteF4, PicoMite, and ArmmiteH7 which all run the same code (edit/autosave needs the ascii source) so it is not something I'm going to change


So umm, are you ok with this change:

> run "memfunc-test"
Program memory size:          824
Program lines:                21
Variable memory size:         3328
Variable count:               4
String var size:              3072
Total flash memory:           524288
Saved variable size:          0
Saved variable count:         0
Font memory size:             0
Font count:                   0
C Function memory size:       0
C Function count:             0
Heap size:                    2816
Total memory:                 5472000
Used memory:                  6968
Free memory:                  5465032

> list
'Make some variables for the heck of it
tails = 6
fox$ = "The quick brown fox jumped over a lazy dog."
g! = 4.669201609
dim a$(10)

'Memory report!
?"Program memory size:"    tab(30) mm.info(mem progsize)
?"Program lines:"          tab(30) mm.info(mem proglines)
?"Variable memory size:"   tab(30) mm.info(mem varsize)
?"Variable count:"         tab(30) mm.info(mem varcount)
?"String var size:"        tab(30) mm.info(mem stringsize)
?"Total flash memory:"     tab(30) mm.info(mem flashsize)
?"Saved variable size:"    tab(30) mm.info(mem fvarsize)
?"Saved variable count:"   tab(30) mm.info(mem fvarcount)
?"Font memory size:"       tab(30) mm.info(mem fontsize)
?"Font count:"             tab(30) mm.info(mem fontcount)
?"C Function memory size:" tab(30) mm.info(mem cfuncsize)
?"C Function count:"       tab(30) mm.info(mem cfunccount)
?"Heap size:"              tab(30) mm.info(mem heap)

?"Total memory:"           tab(30) mm.info(mem total)
?"Used memory:"            tab(30) mm.info(mem used)
?"Free memory:"            tab(30) mm.info(mem free)


Now that I know about the issue with tokens, I could fit more functionality into existing tokens.  Are you OK with contributions back?  How would I send them to you?
 
alynna
Newbie

Joined: 05/10/2021
Location: United States
Posts: 28
Posted: 10:39pm 08 Oct 2021
Copy link to clipboard 
Print this post

  alynna said  
  Mixtel90 said  It's only on the CMM2 that you don't need the ASCII representation of CSUBs in RAM. That's because on all the other platforms the editor and the program are both in RAM at the same time - they are not external file based. The CMM2 keeps the ASCII on the SDcard. Also, because the CMM2 is file-based, it can use #DEFINE & #INCLUDE, which aren't available on other platforms (AFAIK!).

This explains Peter's earlier answer: "Possibly true for the CMM2 but not for the ArmmiteF4, PicoMite, and ArmmiteH7 which all run the same code (edit/autosave needs the ascii source) so it is not something I'm going to change".


Got it, i'll scrap that idea.   The inline assembler seems like it will be more fun anyway... a bit more acorn-like.

Long ago (like 20 years) I wrote an extension for C64 BASIC that allowed you to inline assembler.   In the most awesome way:

5 x%=0
10 inc x%:lda x%:sta $d020:?x,:goto 10

The variable would always be replaced with the location of the variable.  Good for working with strings.  Ints were a little more tricky, being two bytes, but the syntax like a$[4] would autoload the y register and create instructions like lda (location of a$),y.  And for ints, if you did lda >x%, that would translate to lda (location of x% + 1).

So I already have an idea for expanded syntax for the assembler...
 
alynna
Newbie

Joined: 05/10/2021
Location: United States
Posts: 28
Posted: 10:42pm 08 Oct 2021
Copy link to clipboard 
Print this post

  alynna said  
  matherp said  
  Quote  6there is no reason that the "hexadecimal text" ever need be copied into the program memory.


Possibly true for the CMM2 but not for the ArmmiteF4, PicoMite, and ArmmiteH7 which all run the same code (edit/autosave needs the ascii source) so it is not something I'm going to change


So umm, are you ok with this change:

> run "memfunc-test"
Program memory size:          824
Program lines:                21
Variable memory size:         3328
Variable count:               4
String var size:              3072
Total flash memory:           524288
Saved variable size:          0
Saved variable count:         0
Font memory size:             0
Font count:                   0
C Function memory size:       0
C Function count:             0
Heap size:                    2816
Total memory:                 5472000
Used memory:                  6968
Free memory:                  5465032

> list
'Make some variables for the heck of it
tails = 6
fox$ = "The quick brown fox jumped over a lazy dog."
g! = 4.669201609
dim a$(10)

'Memory report!
?"Program memory size:"    tab(30) mm.info(mem progsize)
?"Program lines:"          tab(30) mm.info(mem proglines)
?"Variable memory size:"   tab(30) mm.info(mem varsize)
?"Variable count:"         tab(30) mm.info(mem varcount)
?"String var size:"        tab(30) mm.info(mem stringsize)
?"Total flash memory:"     tab(30) mm.info(mem flashsize)
?"Saved variable size:"    tab(30) mm.info(mem fvarsize)
?"Saved variable count:"   tab(30) mm.info(mem fvarcount)
?"Font memory size:"       tab(30) mm.info(mem fontsize)
?"Font count:"             tab(30) mm.info(mem fontcount)
?"C Function memory size:" tab(30) mm.info(mem cfuncsize)
?"C Function count:"       tab(30) mm.info(mem cfunccount)
?"Heap size:"              tab(30) mm.info(mem heap)

?"Total memory:"           tab(30) mm.info(mem total)
?"Used memory:"            tab(30) mm.info(mem used)
?"Free memory:"            tab(30) mm.info(mem free)


Now that I know about the issue with tokens, I could fit more functionality into existing tokens.  Are you OK with contributions back?  How would I send them to you?


Oh, another question.  Is the CPU running with 32 or 64 bit registers?
Also is there a way to run the BASIC from RAM?  I am not sure of the longevity of my flash ...
Edited 2021-10-09 08:45 by alynna
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 11:26pm 08 Oct 2021
Copy link to clipboard 
Print this post

  alynna said  Also is there a way to run the BASIC from RAM?  I am not sure of the longevity of my flash ...


See OPTION RAM in the manual.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
alynna
Newbie

Joined: 05/10/2021
Location: United States
Posts: 28
Posted: 11:46pm 08 Oct 2021
Copy link to clipboard 
Print this post

  lizby said  
  alynna said  Also is there a way to run the BASIC from RAM?  I am not sure of the longevity of my flash ...


See OPTION RAM in the manual.


When I say "run from RAM" btw I mean the BASIC itself, not the programs..
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 442
Posted: 12:19am 09 Oct 2021
Copy link to clipboard 
Print this post

  alynna said  
  lizby said  
  alynna said  Also is there a way to run the BASIC from RAM?  I am not sure of the longevity of my flash ...


See OPTION RAM in the manual.


When I say "run from RAM" btw I mean the BASIC itself, not the programs..


The BASIC memory area isn't written to. Only flash writes significantly affect the lifespan. Reads are essentially free!
 
alynna
Newbie

Joined: 05/10/2021
Location: United States
Posts: 28
Posted: 02:13am 09 Oct 2021
Copy link to clipboard 
Print this post

  toml_12953 said  
  alynna said  
  lizby said  
  alynna said  Also is there a way to run the BASIC from RAM?  I am not sure of the longevity of my flash ...


See OPTION RAM in the manual.


When I say "run from RAM" btw I mean the BASIC itself, not the programs..


The BASIC memory area isn't written to. Only flash writes significantly affect the lifespan. Reads are essentially free!


I've been flashing new builds of MMBasic regularly.  So far I have done it about 25 times while debugging it and learning how the source code works.  How many times do people think I can do that until the flash gets angry?

The TL;DR of it is I want to run the *firmware* from RAM until it does what I want, then flash it.  Possible?
Edited 2021-10-09 12:16 by alynna
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 02:41am 09 Oct 2021
Copy link to clipboard 
Print this post

  alynna said  Also is there a way to run the BASIC from RAM?  I am not sure of the longevity of my flash ...


There's this:
  abraxas said  Usually flash controllers have built in flash leveling that ensures that each block is written to with the same frequency. So the longevity would be 10000 full capacity writes. Now this is with the assumption that the flash memory in the Waveshare board actually implements flash leveling. No idea if it does or not, also, how much storage are we talking about there?


From this thread, where flash write issues for the CMM2 were first addressed.

But it seems unlikely, however keen you may be, that you will surpass matherp's number of flashes of the firmware. I don't recall that he has reported any issues.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
alynna
Newbie

Joined: 05/10/2021
Location: United States
Posts: 28
Posted: 04:08am 09 Oct 2021
Copy link to clipboard 
Print this post

  lizby said  
  alynna said  Also is there a way to run the BASIC from RAM?  I am not sure of the longevity of my flash ...


There's this:
  abraxas said  Usually flash controllers have built in flash leveling that ensures that each block is written to with the same frequency. So the longevity would be 10000 full capacity writes. Now this is with the assumption that the flash memory in the Waveshare board actually implements flash leveling. No idea if it does or not, also, how much storage are we talking about there?


From this thread, where flash write issues for the CMM2 were first addressed.

But it seems unlikely, however keen you may be, that you will surpass matherp's number of flashes of the firmware. I don't recall that he has reported any issues.


Based on this I won't worry about it then :)
 
     Page 3 of 3    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025