Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 03:39 06 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 : MM Library Anomaly

Author Message
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 842
Posted: 01:30pm 22 Jun 2017
Copy link to clipboard 
Print this post

Not a big deal but I have noticed a small anomaly when loading a Library of three fonts to a blank 170 chip, with MM 5.0404 loaded.
If I "Load and Run" from MMEdit all three fonts I get an "Out of Memory" error (i.e. before I can save the fonts to Library) (I have "Auto crunch" and "Delete Blank Lines" selected).
If I split the font file in two I can load and save to Library the first two and then the third.

I would have thought that memory would have been big enough to read all the fonts in before saving to the Library? (its only a small PITA to split the file each time).

Cheers,

AndrewEdited by Andrew_G 2017-06-23
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 01:58pm 22 Jun 2017
Copy link to clipboard 
Print this post

What happens when you load a font is that it is held in program memory as 8-digit hex numbers AND MMBasic extracts the binary data from the 8-bit hex numbers and copies this data in another part of the flash memory. So the flash holds two copies of the font. The reason for keeping the 8-digit hex numbers is so that you can edit them and see the whole program as loaded.

When you transfer the font to the library the 8-digit hex numbers are removed resulting in a large memory saving. The binary data for the font is retained but is marked as being in the library so it will not be deleted.

The upshot of all this is that when you first load the fonts (before transferring them to the library) there is a lot of flash memory consumed and this is why you could not get all three fonts loaded at the same time. Loading the fonts in stages and copying them to the library (as you did) is the correct way around the issue.

All this is going on inside a small 28-pin chip - I think that it is a small miracle that it can run sophisticated firmware as it does.

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

Guru

Joined: 08/09/2011
Location: United States
Posts: 1421
Posted: 02:06pm 22 Jun 2017
Copy link to clipboard 
Print this post

  Geoffg said  

All this is going on inside a small 28-pin chip - I think that it is a small miracle that it can run sophisticated firmware as it does.

Geoff


It is because of the excellent work you and Peter have done.
Micromites and Maximites! - Beginning Maximite
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 842
Posted: 03:55pm 22 Jun 2017
Copy link to clipboard 
Print this post

Geoff,
Thanks so much for the explanation - so much better than just saying "because"!
As CircuitGizmos and others have said we are in awe, not just because of the work that you, Peter and others have done, but also the time you all put in to help others out.
Thanks,
Andrew
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 09:43pm 22 Jun 2017
Copy link to clipboard 
Print this post

"Because."

Seriously though, I had the same issue with a MM+ where I used three or four extra fonts, and had the exact same problem, in that the 8-digit HEX codes gobbled up all the available memory. Setup on this system, requires that you install two different codes. With the blank MM+, I load "Library 1p0.BAS" kind of idea - just the library routines, and ONLY the library routines including the fonts.

LIBRARY SAVE that, then load the main code. Those 8-digit HEX codes gobble up a startling amount of memory, so the library area is a God-send for this kind of thing.

Small programs will probably be able to keep the 8-digit HEX codes within the main listing, but bigger programs will have to stash them in the library area.
Smoke makes things work. When the smoke gets out, it stops!
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 842
Posted: 09:54pm 22 Jun 2017
Copy link to clipboard 
Print this post

Very funny Grogster. You made me nearly spill my Guinness.
Cheers,
Andrew
 
Print this page


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

© JAQ Software 2024