Femtobasic Save & Load to Hydra SD Card?
Humanoido
Posts: 5,770
Using Femtobasic without any changes, will save and load programs work with the plug in Hydra SD Card?
Post Edited (humanoido) : 4/29/2009 4:15:07 PM GMT
Post Edited (humanoido) : 4/29/2009 4:15:07 PM GMT
Comments
save [noparse][[/noparse] $08000 ] : rem saves to 2nd 32K area of EEPROM
save [noparse][[/noparse] $10000 ] : rem saves to 3rd 32K area of EEPROM
save [noparse][[/noparse] $18000 ] : rem saves to 4th 32K area of EEPROM
The 1st 32K area starts at $00000 and contains the boot area with FemtoBasic itself
You don't have to save Basic programs to a 32K boundary, but there's no checking whether one program overlaps onto another already stored. FemtoBasic only stores what's needed and Basic programs normally are less than 8K in size, so you could keep 3 * 4 = 12 programs in the Hydra's extra 96K of EEPROM (past the 1st 32K).
The load statement works the same way
You can also save and load a single program using just the LOAD and SAVE statements without any parameters. These use the area in the 1st 32K of EEPROM past the end of FemtoBasic. This area gets overwritten if you download a fresh copy of FemtoBasic or any other program. The 32K areas past the 1st one are untouched when you download a new program.
If you have an expansion card plugged in, the expansion card takes the place of the on-board EEPROM and the on-board EEPROM gets relocated to $20000. That means that you have another 96K available (since you probably want to keep the on-board EEPROM's 1st 32K with a copy of FemtoBasic in it in case you need to remove the expansion card.
FemtoBasic will check the EEPROM area used by "SAVE" and "LOAD" for an automatic start program. Look at the documentation for details.
In the future I hope to see a variety of programming examples and maybe a source material newsletter or something can be put together about Femtobasic program apps at that time. [noparse]:)[/noparse]
Just a final note - what does femtobasic stand for? I got the basic part, and maybe t is for the original t in tiny basic? I googled it but didn't see the mysterious answer.
I'm interested in using FemtoBasic to develop serious applications with Hydra, but need a way to save and then load programs after the Hydra is reset or power cycled.
If I save a program into the main Hydra board like this:
SAVE [noparse][[/noparse]A]
It will save perfect. Then if clear out the program in RAM with NEW, and do a LIST, it is verified that the program is erased from RAM. I can then do this:
LOAD [noparse][[/noparse]A]
and the program will load perfect back into RAM, and I can LIST it, again, perfect.
Now the problem begins. If I turn off the Hydra board, or reset it, the FemtoBasic will show the first greeting line on the screen and remain locked up.
It happens with the main board, or with the game card, (both were loaded with FemtoBasic).
Can you give me a working example code line of how to save or load programs using the the Hydra board, and same for load/save using the 128K game card? (so it will work when reset or power cycled)
For example, if you specify a starting SAVE address of $8000 through $803E, the length of the program is stored in $803E/$803F and the actual program is stored in 64 byte pieces starting at $8040. You can store other information in the first 62 bytes of the EEPROM area used. You could store a program name or number there and have a "master" program that searches for a particular name and loads and executes that saved program.
When you use a LOAD with an address of $8000 through $803E, the same algorithm is used so the length is expected to be in $803E/$803F.
Post Edited (humanoido) : 5/3/2009 6:10:26 PM GMT
In terms of knowing what to write ... I memorized the powers of two up through 16 bits.
Post Edited (Mike Green) : 5/3/2009 2:17:08 PM GMT