BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Tue Jul 17, 2018 6:34 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Suppression of Leading Zeroes with Data Input
PostPosted: Sun Jun 07, 2015 4:57 pm 
Offline
Guru

Joined: Fri Dec 07, 2012 3:48 pm
Posts: 67
I am re-hashing an old topic: the fact that leading zeroes are suppressed when using DEC, HEX & BIN modifiers with Input, e.g. SERIN, which I never managed to solve to my satisfaction with Nathan.

I have developed routines to use STR instead, and then to convert the string to a number, but the code is long and wasteful of program memory. I have posted samples of this technique some time ago, but I have “tuned” the programs somewhat, so I have attached 2 new sample programs using STR for numeric input.

A few weeks ago, I started running out of program memory using the STR routines and decided to have look at what goes on in the Mbasic Libraries. Suffice it to say that I have gained even more respect for whomever developed these libraries – they are exceedingly complex!!!

In any case, with a little trial and error I managed to find the applicable bits of code in the mbasicnummod.lib file and made the necessary changes so that leading zeroes are NOT suppressed when using DEC, HEX & BIN Modifiers for Data Input, e.g. SERIN. All the changes are commented in the file.

These changes are ONLY to bypass leading zero suppression in the library code and ONLY for Data Input – they DO NOT change anything else and everything else still works the same.
They also do NOT interfere with the DEC, HEX & BIN modifiers when outputting Data.

If you want to try this modification, the mbasicnummod.lib file is in the MBasic14 folder in this path “C:\Program Files (x86)\BasicMicro UK\BMUK Nano IDE\System\MBasic14” on my Windows 7 machine.

Rename the existing mbasicnummod.lib file to something like “mbasicnummod – Original .lib” and then copy the new (unzipped) file into the MBasic14 folder.

I have also attached 4 programs which I used to test the mod.

IMORTANT!!!! The modified file is from the new BMUK IDE. I have NOT tested with the “old” Basic Micro Studio.

If anybody does try this, please let me know if you encounter anything odd.

All files and programs are attached as zipped files - problems with uploading them otherwise!?!?

Regards
Andre


Attachments:
STR Numeric Input with Leading Zeroes - WITHOUT Enter Key.zip [1.35 KiB]
Downloaded 144 times
STR Numeric Input with Leading Zeroes - WITH Enter Key.zip [1.45 KiB]
Downloaded 145 times
Test modifed mbasicnummod.lib to allow leading zeroes.zip [1.6 KiB]
Downloaded 186 times
mbasicnummod.zip [2.14 KiB]
Downloaded 131 times
Top
 Profile  
 
 Post subject: Re: Suppression of Leading Zeroes with Data Input
PostPosted: Mon Jun 08, 2015 9:31 pm 
Offline
Site Admin
User avatar

Joined: Fri Apr 12, 2013 8:38 pm
Posts: 87
Location: Nottingham, England, UK
HI Andre

Thanks for sharing this information on your findings,

I have not had cause myself to do something like your wanting to do here but for other users needing this its very useful,

We do appreciate you input to the forum contents,

Many Thanks
Dave

BasicMicroUK
www.basicmicro.co.uk
http://stores.ebay.co.uk/Basic-Micro-UK/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO