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 : MMBasic 4.4 Beta 2
Author | Message | ||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
I have another beta test version of MMBasic 4.4 to which has been added the MODULE LOAD and MODULE UNLOAD commands. These allow libraries of user defined commands or functions to be loaded into MMBasic from within a running program. This can be used to load specialised libraries to extend the functionality of MMBasic. Examples include device drivers, libraries that provide bit manipulation and libraries of specialised mathematical functions. Another use is to extend the amount of memory available by only loading sections of code as needed and then unloading them when their task is finished so that another section of code can be loaded. You can download the test version from: http://geoffg.net/Downloads/Maximite/MMBasic_4.4_Beta_2.zip There are a few other fixes/changes in this version: - The SEEK command - FILES on drive A: includes the size of the file. - CHAIN command now resets the DATA pointer and will not throw an error indicating too many GOSUBS, FOR LOOPS, DO LOOPS or similar. - Fixed a bug in the CLR$() function which produced random characters. Any bug reports, suggestions, etc gratefully received. Thanks Geoff Geoff Graham - http://geoffg.net |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9308 |
Do you ever get any sleep Geoff? (rhetorical!) Smoke makes things work. When the smoke gets out, it stops! |
||||
ajkw Senior Member Joined: 29/06/2011 Location: AustraliaPosts: 290 |
Geoff, Just doing a little testing, I have a problem reading a file with input(1, #1) when the file #1 is open with append, I get an Error: Cannot read from file If I open with input then I get the correct response. Writing to a file with append is working ok. Also, in the code examples in the language manuals you have Data$ = INPUT$(64, #1) Data$ does not work in a program because data$ seems to be treated as a command and not as a variable, ie when editing you type data$ = .... that later becomes Data$ which the change in capitalization seems to verify. Anthony. file a.txt contains abcdefghijklmnopqrstuvwxyz open "a.txt" for append as #1 print lof(#1) seek #1,4 print input$(3,#1) close #1 |
||||
TinkersALot Regular Member Joined: 20/11/2012 Location: United StatesPosts: 72 |
the risk in making something better is that some yahoo will come along and ask for better still [grin]. ...And now if you could only make the basic interpreter a multitasking basic interpreter... |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
Ah, sorry Anthony, you are right on both counts. In this beta version I changed opening a file for random access from APPEND to RANDOM (new keyword). And you are right Data$ is not valid as a variable. My mistake was that I forgot to update the documentation in the downloadable zip (fixed now). This is the correct documentation for Random File I/O in Beta 2: 2013-06-06_235833_Random_File_IO_updated.pdf Geoff Geoff Graham - http://geoffg.net |
||||
ajkw Senior Member Joined: 29/06/2011 Location: AustraliaPosts: 290 |
Random works fine. Just a thought however, should seek #1,1 position the pointer to the end of the first byte ready to read byte 2 (as it does) or should it position the pointer ready to read byte 1? I prefer the later but there may be conventions I am not aware of. The module commands seem to be behaving as expected. You might what a look for further uses of data$ in the manuals, ie page 43 in the main manual and further down in 2013-06-06_235833_Random_File_IO_updated.pdf Cheers, Anthony. |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
I will have think about that. Normally the first byte in a file is byte number zero. You are suggesting that it should be byte number one, just like with strings where the first character is numbered character number one. I might check what Bill did many years ago and see if I can remain compatible. Geoff P.S. Thanks for the documentation bug report. Geoff Graham - http://geoffg.net |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
Geoff, I don't have my MS Basic books with me but this is from the QB64 wiki: My understanding is "SEEK 1" would set things up to read the first byte of the file. It is not something I have done recently so the grey matter may need some oiling.... Jim PS: Love the MODULE commands, I think they will suit me more than CHAIN. VK7JH MMedit MMBasic Help |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
Thanks, I will change SEEK (and LOC()) so that the first byte is 1. Geoff Graham - http://geoffg.net |
||||
Print this page |