home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR3 / LAPCLOCK.ZIP / CLOCKS.DOC < prev    next >
Text File  |  1993-07-21  |  10KB  |  205 lines

  1. BCLOCK - Generic Battery Clock
  2. HBC - "HandBookClock"
  3.  
  4. Freeware Battery Clocks For Laptops Such As The Gateway HandBook
  5.  
  6. 1. The Generic Version, BCLOCK.
  7.  
  8. BCLOCK is a merely a teensy TSR battery clock suitable for many
  9. laptop computers.  It is a generic program and will run on any
  10. laptop that I can imagine.  It is a very simple program- the
  11. clock start counts at zero and refreshes every minute.  So if it
  12. goes off screen, fear not, it will return.  Give it a minute to
  13. start up, too.
  14.  
  15. Unfortunately you cannot turn it off or reset it, and it starts
  16. over each time you boot.  All it really tells you is elapsed
  17. time from when you started it.  This is often good enough,
  18. especially on laptops with a suspend state, where you reboot
  19. seldom.  So, when you are done charging the battery and want to
  20. hit the road or go portable, start up the program, or reboot if
  21. it's already running and then start it up again.  You'll then
  22. always know how many minutes you've put on the batteries.
  23.  
  24. Why such a simple program?  After all, there are a lot of
  25. programs out there for battery "gas" gauge measurement, and some
  26. of them are pretty sophisticated, allowing for charging time and
  27. a lot of things.  But they are pretty hefty TSRs, 15-20k in
  28. size, and memory is not to be frittered away.  And besides, the
  29. purported accuracy of these programs is a little illusory since
  30. how long the batteries last depend very much on how much disk
  31. access you do, i.e., how much the disk spins/starts up, etc.  So
  32. why gild the lily, let's just have a program that tells you how
  33. much time has passed.  Believe it or not, nowhere in
  34. shareware/freeware land could I find one.  So, here is my own.
  35.  
  36. If you reboot and then restart the program you'll just have to
  37. make a mental note of total time, in the BCLOCK generic version.
  38.  
  39. The idea was to keep the program very small and fast, with
  40. little overhead.  After all, we are stealing the timer interrupt
  41. and we could really get ourselves bogged down if the code was
  42. long or slow.
  43.  
  44.  
  45. 2. The Gateway HandBook Version, HBC.
  46.  
  47. HBC deals with the reboot/reset problem BUT IT ONLY WORKS ON THE
  48. GATEWAY HANDBOOK.  Do NOT use it on any other computer.  DON'T
  49. TRY IT!  You may blow away your setup information and I will not
  50. be responsible, you have been warned!
  51.  
  52. You start up HBC just like you would BCLOCK, just type in the
  53. command name and off it goes.  But there is a difference.  HBC
  54. stores its timing information directly in unused bytes of the
  55. computer's CMOS.  This is what makes it so dangerous when used
  56. on the wrong machine!
  57.  
  58. HBC will retain its time setting through a warm boot
  59. (CTRL-ALT-DEL variety).  So, put it at the end (the end, please,
  60. nowhere else) of your AUTOEXEC.BAT file, and it will start up
  61. every time you boot.  It will not retain its setting through a
  62. cold boot (FN-ALT-DEL) or a hardware reset (the switch in the
  63. hole on the bottom of the unit, the one you poke with your pen
  64. when the machine gets hopelessly hung).
  65.  
  66. 3. Resetting the Clock.
  67.  
  68. However, HBC allows for a reset by running the program HBCSET.
  69. You will be prompted for hours and minutes.  Enter either zeroes
  70. to restart from the beginning (as in after a full battery
  71. charge), or whatever elapsed time is appropriate.  For instance
  72. if the clock last read 1.09 and you do a cold boot, set the
  73. clock to one hour, ten minutes (an extra minute to allow for the
  74. boot up time).
  75.  
  76. Now, here is a feature in which I take some pride of authorship.  
  77. I have discovered where in the BIOS the HandBook "knows" whether 
  78. or not it is on AC or battery power (see the source code if you 
  79. are curious).  So, the HBC program is clever enough to increase 
  80. elapsed time when you are running on battery power, and DECREASE 
  81. elapsed time when you are running on AC power.  What does this 
  82. mean for you?  Well, you run on battery power for a while and 
  83. build up some time on the display clock.  Then you go and plug 
  84. the thing in.  The clock starts running backwards because now 
  85. the battery is charging!  And, on the HandBook, it luckily turns 
  86. out that a minute of charging gives you back more or less a 
  87. minute of battery time.  Logically enough, the clock stops at 
  88. zero...  and, in fact, when it reaches zero, it quits 
  89. displaying.  Having it sit there reading zero all the time 
  90. really doesn't impart much information to you.
  91.  
  92. All of this is not completely precise, of course, but will give
  93. you a reasonable indication of where you are.
  94.  
  95. Be aware that if you close the lid the machine goes into suspend 
  96. mode.  The clock cannot change but the battery keeps charging.
  97. In such a case, you'll have to reset the clock manually with
  98. HBCSET.  No big deal, you're probably going to go for a full
  99. charge at that point, and you can just set the clock back to
  100. zero.
  101.  
  102. Now, you still need to know how long the batteries will last,
  103. and this varies a great deal.  It depends on your power
  104. management settings and above all on how often you access the
  105. disk drive.  (I am preparing a companion paper, with program 
  106. samples, showing techniques for maximizing both speed and 
  107. battery life.  But that's for another day.)  Gateway rates the 
  108. battery at 2.5 - 4.5 hours of service, depending upon these 
  109. factors.  I find that 2-3 hours is about the limit.  In fact, I 
  110. watch the HBC display, and when it goes over 2 hours I start to 
  111. get a little cautious.  At 2.5 hours, I'm ready to put in the 
  112. spare battery when I reach a point of pause.  (Did you buy a 
  113. spare battery?  It's not a bad investment.)
  114.  
  115. So, you'll need to work with your machine a bit, and find out
  116. what the battery life is for you.  Run HBC and you'll have an 
  117. easy time measuring this!
  118.  
  119. 4. Future Features, Perhaps Developed by You.
  120.  
  121. Some ideas for those who like to tinker: have the resident part
  122. of the program load itself back over the PSP before going
  123. resident.  This might save a few hundred bytes from the resident
  124. (TSR) portion.  And, of course, real tinkerers can try to cut
  125. cycles from the program execution to make it run
  126. faster-better-quicker.  The assembler code is not very elegant
  127. or pretty- I am not Mr. Assembler Programmer.  (The code has one
  128. merit, though: it works.)
  129.  
  130. What I would like to see automated further is the recharging
  131. timing.  It would be possible to look at the real time clock to
  132. see if the machine had been in suspend mode and adjust
  133. accordingly (when running on AC power).  This would add a bunch
  134. of complications and make the resident code longer, which is why
  135. I didn't do this.  But it's a thought.
  136.  
  137. Yet another possibility: have the clock count down against 
  138. expected battery life.  It would have to count back up when 
  139. charging, and stop at the maximum expected life.  I didn't do 
  140. this because I think it gives a false idea of how much time is 
  141. left, as this varies so greatly with usage.
  142.  
  143. 5. Random Comments
  144.  
  145. I cannot claim total originality for this program, as the basic 
  146. idea came from looking at a disassembly of an ancient minutes
  147. and hours type clock program of unknown origin.  Needless to
  148. say, there is nothing left of this prototype; I've rewritten it
  149. totally.
  150.  
  151. I hope it is of some use to you, as it seems to be for me.  I do
  152. claim the right to pass this on, as there is no longer any
  153. similarity between this program and the one I used as
  154. inspiration.
  155.  
  156. The final code is around 624 bytes when resident: not too
  157. onerous, and it runs reasonably well, too.  One could always do 
  158. better, of course....
  159.  
  160. I wrote the HBCSET program in C rather than assembler because I
  161. wanted to do it in ten minutes or less (which is about how long
  162. it took) and I didn't want to mess with keyboard I/O and
  163. character to integer conversions in assembler.  So call me lazy.
  164. The "brand" of C used here is Microsoft Quick C.
  165.  
  166. Please send any comments to Robert Newell on Software Creations, 
  167. Bob Newell on Xevious, BNewell on the Gateway BBS, or by mail to 
  168. 1825 N. Grandview Lane, Bismarck, ND 58501.  I'd just like to 
  169. know if anyone uses this and if it is of any value.  It is of 
  170. course freeware, with source code provided.  Just be sure to 
  171. share your improvements with myself and others on a similar 
  172. freeware basis.
  173.  
  174. The only restrictions on this program are, that you may not sell
  175. it, and if you modify it and give out a modified version, you
  176. must state who you are and the fact that the program has indeed
  177. been modified.  You also may not remove or alter this 
  178. documentation, or the warning file which accompanies the 
  179. program.  I don't want to see anyone wipe out their CMOS through 
  180. lack of fair warning.
  181.  
  182. Of course I disclaim all warrantees, expressed or implied, and
  183. assume no liability for anything whatsoever under any possible
  184. legal theory.  If you use this program, you alone are
  185. responsible for anything that may result in any way out of the
  186. use of the program.  If you wipe out your setup information, 
  187. trash your CMOS totally, destroy your computer, burn down your 
  188. village, or break out in hives- or anything else, for that 
  189. matter- deal with it yourself, I'm not responsible.
  190.  
  191. Support for this program: none promised.  If you find bugs of 
  192. course let me know.  Please- no phone calls (period).
  193.  
  194. 6. A Little Tzedakah Can Make a Difference.
  195.  
  196. As I said, this is freeware, but if you use this program and
  197. like it or find it useful, why not consider donating a few
  198. dollars to a worthy charity in the name of computer hobbyists.
  199. There are people and groups out there that can truly use the
  200. help, and the good p.r. wouldn't hurt us.  And besides that,
  201. you'll feel good about yourself in a very important way.
  202.  
  203. Bismarck, North Dakota
  204. 07/20/93
  205.