![]() |
Forum Index : Microcontroller and PC projects : CMM2: Memory map?
![]() ![]() |
|||||
Author | Message | ||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
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 StatesPosts: 28 |
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 StatesPosts: 28 |
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 StatesPosts: 28 |
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 StatesPosts: 3378 |
See OPTION RAM in the manual. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
alynna Newbie ![]() Joined: 05/10/2021 Location: United StatesPosts: 28 |
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 StatesPosts: 442 |
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 StatesPosts: 28 |
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 StatesPosts: 3378 |
There's this: 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 StatesPosts: 28 |
There's this: 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 :) |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |