home *** CD-ROM | disk | FTP | other *** search
- BCLOCK - Generic Battery Clock
- HBC - "HandBookClock"
-
- Freeware Battery Clocks For Laptops Such As The Gateway HandBook
-
- 1. The Generic Version, BCLOCK.
-
- BCLOCK is a merely a teensy TSR battery clock suitable for many
- laptop computers. It is a generic program and will run on any
- laptop that I can imagine. It is a very simple program- the
- clock start counts at zero and refreshes every minute. So if it
- goes off screen, fear not, it will return. Give it a minute to
- start up, too.
-
- Unfortunately you cannot turn it off or reset it, and it starts
- over each time you boot. All it really tells you is elapsed
- time from when you started it. This is often good enough,
- especially on laptops with a suspend state, where you reboot
- seldom. So, when you are done charging the battery and want to
- hit the road or go portable, start up the program, or reboot if
- it's already running and then start it up again. You'll then
- always know how many minutes you've put on the batteries.
-
- Why such a simple program? After all, there are a lot of
- programs out there for battery "gas" gauge measurement, and some
- of them are pretty sophisticated, allowing for charging time and
- a lot of things. But they are pretty hefty TSRs, 15-20k in
- size, and memory is not to be frittered away. And besides, the
- purported accuracy of these programs is a little illusory since
- how long the batteries last depend very much on how much disk
- access you do, i.e., how much the disk spins/starts up, etc. So
- why gild the lily, let's just have a program that tells you how
- much time has passed. Believe it or not, nowhere in
- shareware/freeware land could I find one. So, here is my own.
-
- If you reboot and then restart the program you'll just have to
- make a mental note of total time, in the BCLOCK generic version.
-
- The idea was to keep the program very small and fast, with
- little overhead. After all, we are stealing the timer interrupt
- and we could really get ourselves bogged down if the code was
- long or slow.
-
-
- 2. The Gateway HandBook Version, HBC.
-
- HBC deals with the reboot/reset problem BUT IT ONLY WORKS ON THE
- GATEWAY HANDBOOK. Do NOT use it on any other computer. DON'T
- TRY IT! You may blow away your setup information and I will not
- be responsible, you have been warned!
-
- You start up HBC just like you would BCLOCK, just type in the
- command name and off it goes. But there is a difference. HBC
- stores its timing information directly in unused bytes of the
- computer's CMOS. This is what makes it so dangerous when used
- on the wrong machine!
-
- HBC will retain its time setting through a warm boot
- (CTRL-ALT-DEL variety). So, put it at the end (the end, please,
- nowhere else) of your AUTOEXEC.BAT file, and it will start up
- every time you boot. It will not retain its setting through a
- cold boot (FN-ALT-DEL) or a hardware reset (the switch in the
- hole on the bottom of the unit, the one you poke with your pen
- when the machine gets hopelessly hung).
-
- 3. Resetting the Clock.
-
- However, HBC allows for a reset by running the program HBCSET.
- You will be prompted for hours and minutes. Enter either zeroes
- to restart from the beginning (as in after a full battery
- charge), or whatever elapsed time is appropriate. For instance
- if the clock last read 1.09 and you do a cold boot, set the
- clock to one hour, ten minutes (an extra minute to allow for the
- boot up time).
-
- Now, here is a feature in which I take some pride of authorship.
- I have discovered where in the BIOS the HandBook "knows" whether
- or not it is on AC or battery power (see the source code if you
- are curious). So, the HBC program is clever enough to increase
- elapsed time when you are running on battery power, and DECREASE
- elapsed time when you are running on AC power. What does this
- mean for you? Well, you run on battery power for a while and
- build up some time on the display clock. Then you go and plug
- the thing in. The clock starts running backwards because now
- the battery is charging! And, on the HandBook, it luckily turns
- out that a minute of charging gives you back more or less a
- minute of battery time. Logically enough, the clock stops at
- zero... and, in fact, when it reaches zero, it quits
- displaying. Having it sit there reading zero all the time
- really doesn't impart much information to you.
-
- All of this is not completely precise, of course, but will give
- you a reasonable indication of where you are.
-
- Be aware that if you close the lid the machine goes into suspend
- mode. The clock cannot change but the battery keeps charging.
- In such a case, you'll have to reset the clock manually with
- HBCSET. No big deal, you're probably going to go for a full
- charge at that point, and you can just set the clock back to
- zero.
-
- Now, you still need to know how long the batteries will last,
- and this varies a great deal. It depends on your power
- management settings and above all on how often you access the
- disk drive. (I am preparing a companion paper, with program
- samples, showing techniques for maximizing both speed and
- battery life. But that's for another day.) Gateway rates the
- battery at 2.5 - 4.5 hours of service, depending upon these
- factors. I find that 2-3 hours is about the limit. In fact, I
- watch the HBC display, and when it goes over 2 hours I start to
- get a little cautious. At 2.5 hours, I'm ready to put in the
- spare battery when I reach a point of pause. (Did you buy a
- spare battery? It's not a bad investment.)
-
- So, you'll need to work with your machine a bit, and find out
- what the battery life is for you. Run HBC and you'll have an
- easy time measuring this!
-
- 4. Future Features, Perhaps Developed by You.
-
- Some ideas for those who like to tinker: have the resident part
- of the program load itself back over the PSP before going
- resident. This might save a few hundred bytes from the resident
- (TSR) portion. And, of course, real tinkerers can try to cut
- cycles from the program execution to make it run
- faster-better-quicker. The assembler code is not very elegant
- or pretty- I am not Mr. Assembler Programmer. (The code has one
- merit, though: it works.)
-
- What I would like to see automated further is the recharging
- timing. It would be possible to look at the real time clock to
- see if the machine had been in suspend mode and adjust
- accordingly (when running on AC power). This would add a bunch
- of complications and make the resident code longer, which is why
- I didn't do this. But it's a thought.
-
- Yet another possibility: have the clock count down against
- expected battery life. It would have to count back up when
- charging, and stop at the maximum expected life. I didn't do
- this because I think it gives a false idea of how much time is
- left, as this varies so greatly with usage.
-
- 5. Random Comments
-
- I cannot claim total originality for this program, as the basic
- idea came from looking at a disassembly of an ancient minutes
- and hours type clock program of unknown origin. Needless to
- say, there is nothing left of this prototype; I've rewritten it
- totally.
-
- I hope it is of some use to you, as it seems to be for me. I do
- claim the right to pass this on, as there is no longer any
- similarity between this program and the one I used as
- inspiration.
-
- The final code is around 624 bytes when resident: not too
- onerous, and it runs reasonably well, too. One could always do
- better, of course....
-
- I wrote the HBCSET program in C rather than assembler because I
- wanted to do it in ten minutes or less (which is about how long
- it took) and I didn't want to mess with keyboard I/O and
- character to integer conversions in assembler. So call me lazy.
- The "brand" of C used here is Microsoft Quick C.
-
- Please send any comments to Robert Newell on Software Creations,
- Bob Newell on Xevious, BNewell on the Gateway BBS, or by mail to
- 1825 N. Grandview Lane, Bismarck, ND 58501. I'd just like to
- know if anyone uses this and if it is of any value. It is of
- course freeware, with source code provided. Just be sure to
- share your improvements with myself and others on a similar
- freeware basis.
-
- The only restrictions on this program are, that you may not sell
- it, and if you modify it and give out a modified version, you
- must state who you are and the fact that the program has indeed
- been modified. You also may not remove or alter this
- documentation, or the warning file which accompanies the
- program. I don't want to see anyone wipe out their CMOS through
- lack of fair warning.
-
- Of course I disclaim all warrantees, expressed or implied, and
- assume no liability for anything whatsoever under any possible
- legal theory. If you use this program, you alone are
- responsible for anything that may result in any way out of the
- use of the program. If you wipe out your setup information,
- trash your CMOS totally, destroy your computer, burn down your
- village, or break out in hives- or anything else, for that
- matter- deal with it yourself, I'm not responsible.
-
- Support for this program: none promised. If you find bugs of
- course let me know. Please- no phone calls (period).
-
- 6. A Little Tzedakah Can Make a Difference.
-
- As I said, this is freeware, but if you use this program and
- like it or find it useful, why not consider donating a few
- dollars to a worthy charity in the name of computer hobbyists.
- There are people and groups out there that can truly use the
- help, and the good p.r. wouldn't hurt us. And besides that,
- you'll feel good about yourself in a very important way.
-
- Bismarck, North Dakota
- 07/20/93
-