|
Forum Index : Microcontroller and PC projects : Unexpected gotcha with LIBRARY
| Author | Message | ||||
| MustardMan Senior Member Joined: 30/08/2019 Location: AustraliaPosts: 175 |
I was fooling around with LIBRARY SAVE with the intent of saving a customised font without having to load it every time I loaded my program, and I came across a gotcha. It may be well known about, but had me scratching my head! I created the font using the excellent FontEdit program, merged it with another font I'd created previously, turned into a standalone program, into MMedit, downloaded, LIBRARY SAVE. And then loaded my main program and found it would not run. Even a simple program like PRINT "Hello" would not run. I would type RUN<enter> and be greeted with the ">" prompt. I fiddled and fussed with saving, listing & deleting the library and fiddling with the 'program' and it suddenly went away. I couldn't determine why... until today when the exact same thing happened. I have a habit of always putting "END" on the last line of my program. I had done the same for the font file I had loaded (and LIBRARY SAVEd). Take that line out, and it operated as I library like I expected. So, if the last line (or probably any line - but I have not tried) of the program to be saved in the library is END, then the MicroMite will not run any programs from then on... Doh! |
||||
| CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171 |
makes sense, but noted anyway cheers If you are into customising a bit, try building your own "gold image" with your favourite flavour of firmware loaded with all your fonts and extensions/common functions in the library then read the image back out on a programmer (I use a PIC Kit 3). Bingo, your own build ready to take whatever code you like with all your customisations in place. |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
Other commands that could confuse you include INPUT, SLEEP and PAUSE. As you have found out, anything in the library that is not within a sub or function will be run before tha main program starts. This code can be as big as you want, in fact I have seen a 40Kb program loaded into the library with nothing in the main program memory. When you type RUN the library code runs just as if it was in main memory. Geoff Edited 2020-11-27 16:00 by Geoffg Geoff Graham - http://geoffg.net |
||||
| MustardMan Senior Member Joined: 30/08/2019 Location: AustraliaPosts: 175 |
Well that is very cool! Does it do any compression of a program saved in this way, as it does when saving a font? |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
Yes, everything is compressed when it is loaded into the library. If you are running out of program space this is a good way of cramming even more program lines into the Micromite. Geoff Geoff Graham - http://geoffg.net |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |