Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 18:21 16 Nov 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 : Unexpected gotcha with LIBRARY

Author Message
MustardMan

Senior Member

Joined: 30/08/2019
Location: Australia
Posts: 175
Posted: 05:06am 27 Nov 2020
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2171
Posted: 05:39am 27 Nov 2020
Copy link to clipboard 
Print this post

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: Australia
Posts: 3308
Posted: 06:00am 27 Nov 2020
Copy link to clipboard 
Print this post

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: Australia
Posts: 175
Posted: 06:51am 27 Nov 2020
Copy link to clipboard 
Print this post

  Geoffg said  ...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.

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: Australia
Posts: 3308
Posted: 12:23pm 27 Nov 2020
Copy link to clipboard 
Print this post

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