Silicon ChipComputer Bits - May 1994 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: We must reject any move to reduce our mains voltage to 230V
  4. Feature: Electronic Engine Management; Pt.8 by Julian Edgar
  5. Feature: The Fingerscan ID System by Leo Simpson
  6. Feature: Passive Rebroadcasting For TV Signals by Mike Pinfold
  7. Project: Fast Charger For Nicad Batteries by Darren Yates
  8. Project: Two Simple Servo Driver Circuits by Nenad Stojadinovic
  9. Project: An Induction Balance Metal Locator by John Clarke
  10. Order Form
  11. Project: Dual Electronic Dice by Darren Yates
  12. Serviceman's Log: Always look on the grim side by The TV Serviceman
  13. Project: Multi-Channel Infrared Remote Control by Brian Roberts
  14. Product Showcase
  15. Feature: Computer Bits by Darren Yates
  16. Review: Bookshelf by Silicon Chip
  17. Vintage Radio: Trash or treasure - recognising the good stuff by John Hill
  18. Back Issues
  19. Feature: Remote Control by Bob Young
  20. Market Centre
  21. Advertising Index
  22. Outer Back Cover

This is only a preview of the May 1994 issue of Silicon Chip.

You can view 31 of the 96 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • Electronic Engine Management; Pt.1 (October 1993)
  • Electronic Engine Management; Pt.1 (October 1993)
  • Electronic Engine Management; Pt.2 (November 1993)
  • Electronic Engine Management; Pt.2 (November 1993)
  • Electronic Engine Management; Pt.3 (December 1993)
  • Electronic Engine Management; Pt.3 (December 1993)
  • Electronic Engine Management; Pt.4 (January 1994)
  • Electronic Engine Management; Pt.4 (January 1994)
  • Electronic Engine Management; Pt.5 (February 1994)
  • Electronic Engine Management; Pt.5 (February 1994)
  • Electronic Engine Management; Pt.6 (March 1994)
  • Electronic Engine Management; Pt.6 (March 1994)
  • Electronic Engine Management; Pt.7 (April 1994)
  • Electronic Engine Management; Pt.7 (April 1994)
  • Electronic Engine Management; Pt.8 (May 1994)
  • Electronic Engine Management; Pt.8 (May 1994)
  • Electronic Engine Management; Pt.9 (June 1994)
  • Electronic Engine Management; Pt.9 (June 1994)
  • Electronic Engine Management; Pt.10 (July 1994)
  • Electronic Engine Management; Pt.10 (July 1994)
  • Electronic Engine Management; Pt.11 (August 1994)
  • Electronic Engine Management; Pt.11 (August 1994)
  • Electronic Engine Management; Pt.12 (September 1994)
  • Electronic Engine Management; Pt.12 (September 1994)
  • Electronic Engine Management; Pt.13 (October 1994)
  • Electronic Engine Management; Pt.13 (October 1994)
Items relevant to "Fast Charger For Nicad Batteries":
  • Fast Nicad/NiMH Battery Charger PCB pattern (PDF download) [11102941] (Free)
Items relevant to "Two Simple Servo Driver Circuits":
  • Two Simple Servo Driver PCB patterns (PDF download) [09105941/2] (Free)
Items relevant to "An Induction Balance Metal Locator":
  • Induction Balance Metal Locator PCB pattern (PDF download) [04305941] (Free)
Items relevant to "Dual Electronic Dice":
  • Dual Electronic Dice PCB [08105941] (AUD $10.00)
  • Dual Electronic Dice PCB pattern (PDF download) [08105941] (Free)
Items relevant to "Multi-Channel Infrared Remote Control":
  • Multi-channel Infrared Remote Control PCB pattern (PDF download) [15105941/2] (Free)
Items relevant to "Computer Bits":
  • DOS software for Computer Bits, May 1994 (BYTEFREE.BAS/EXE) (Free)
Articles in this series:
  • Computer Bits (July 1989)
  • Computer Bits (July 1989)
  • Computer Bits (August 1989)
  • Computer Bits (August 1989)
  • Computer Bits (September 1989)
  • Computer Bits (September 1989)
  • Computer Bits (October 1989)
  • Computer Bits (October 1989)
  • Computer Bits (November 1989)
  • Computer Bits (November 1989)
  • Computer Bits (January 1990)
  • Computer Bits (January 1990)
  • Computer Bits (April 1990)
  • Computer Bits (April 1990)
  • Computer Bits (October 1990)
  • Computer Bits (October 1990)
  • Computer Bits (November 1990)
  • Computer Bits (November 1990)
  • Computer Bits (December 1990)
  • Computer Bits (December 1990)
  • Computer Bits (January 1991)
  • Computer Bits (January 1991)
  • Computer Bits (February 1991)
  • Computer Bits (February 1991)
  • Computer Bits (March 1991)
  • Computer Bits (March 1991)
  • Computer Bits (April 1991)
  • Computer Bits (April 1991)
  • Computer Bits (May 1991)
  • Computer Bits (May 1991)
  • Computer Bits (June 1991)
  • Computer Bits (June 1991)
  • Computer Bits (July 1991)
  • Computer Bits (July 1991)
  • Computer Bits (August 1991)
  • Computer Bits (August 1991)
  • Computer Bits (September 1991)
  • Computer Bits (September 1991)
  • Computer Bits (October 1991)
  • Computer Bits (October 1991)
  • Computer Bits (November 1991)
  • Computer Bits (November 1991)
  • Computer Bits (December 1991)
  • Computer Bits (December 1991)
  • Computer Bits (January 1992)
  • Computer Bits (January 1992)
  • Computer Bits (February 1992)
  • Computer Bits (February 1992)
  • Computer Bits (March 1992)
  • Computer Bits (March 1992)
  • Computer Bits (May 1992)
  • Computer Bits (May 1992)
  • Computer Bits (June 1992)
  • Computer Bits (June 1992)
  • Computer Bits (July 1992)
  • Computer Bits (July 1992)
  • Computer Bits (September 1992)
  • Computer Bits (September 1992)
  • Computer Bits (October 1992)
  • Computer Bits (October 1992)
  • Computer Bits (November 1992)
  • Computer Bits (November 1992)
  • Computer Bits (December 1992)
  • Computer Bits (December 1992)
  • Computer Bits (February 1993)
  • Computer Bits (February 1993)
  • Computer Bits (April 1993)
  • Computer Bits (April 1993)
  • Computer Bits (May 1993)
  • Computer Bits (May 1993)
  • Computer Bits (June 1993)
  • Computer Bits (June 1993)
  • Computer Bits (October 1993)
  • Computer Bits (October 1993)
  • Computer Bits (March 1994)
  • Computer Bits (March 1994)
  • Computer Bits (May 1994)
  • Computer Bits (May 1994)
  • Computer Bits (June 1994)
  • Computer Bits (June 1994)
  • Computer Bits (July 1994)
  • Computer Bits (July 1994)
  • Computer Bits (October 1994)
  • Computer Bits (October 1994)
  • Computer Bits (November 1994)
  • Computer Bits (November 1994)
  • Computer Bits (December 1994)
  • Computer Bits (December 1994)
  • Computer Bits (January 1995)
  • Computer Bits (January 1995)
  • Computer Bits (February 1995)
  • Computer Bits (February 1995)
  • Computer Bits (March 1995)
  • Computer Bits (March 1995)
  • Computer Bits (April 1995)
  • Computer Bits (April 1995)
  • CMOS Memory Settings - What To Do When The Battery Goes Flat (May 1995)
  • CMOS Memory Settings - What To Do When The Battery Goes Flat (May 1995)
  • Computer Bits (July 1995)
  • Computer Bits (July 1995)
  • Computer Bits (September 1995)
  • Computer Bits (September 1995)
  • Computer Bits: Connecting To The Internet With WIndows 95 (October 1995)
  • Computer Bits: Connecting To The Internet With WIndows 95 (October 1995)
  • Computer Bits (December 1995)
  • Computer Bits (December 1995)
  • Computer Bits (January 1996)
  • Computer Bits (January 1996)
  • Computer Bits (February 1996)
  • Computer Bits (February 1996)
  • Computer Bits (March 1996)
  • Computer Bits (March 1996)
  • Computer Bits (May 1996)
  • Computer Bits (May 1996)
  • Computer Bits (June 1996)
  • Computer Bits (June 1996)
  • Computer Bits (July 1996)
  • Computer Bits (July 1996)
  • Computer Bits (August 1996)
  • Computer Bits (August 1996)
  • Computer Bits (January 1997)
  • Computer Bits (January 1997)
  • Computer Bits (April 1997)
  • Computer Bits (April 1997)
  • Windows 95: The Hardware That's Required (May 1997)
  • Windows 95: The Hardware That's Required (May 1997)
  • Turning Up Your Hard Disc Drive (June 1997)
  • Turning Up Your Hard Disc Drive (June 1997)
  • Computer Bits (July 1997)
  • Computer Bits (July 1997)
  • Computer Bits: The Ins & Outs Of Sound Cards (August 1997)
  • Computer Bits: The Ins & Outs Of Sound Cards (August 1997)
  • Computer Bits (September 1997)
  • Computer Bits (September 1997)
  • Computer Bits (October 1997)
  • Computer Bits (October 1997)
  • Computer Bits (November 1997)
  • Computer Bits (November 1997)
  • Computer Bits (April 1998)
  • Computer Bits (April 1998)
  • Computer Bits (June 1998)
  • Computer Bits (June 1998)
  • Computer Bits (July 1998)
  • Computer Bits (July 1998)
  • Computer Bits (November 1998)
  • Computer Bits (November 1998)
  • Computer Bits (December 1998)
  • Computer Bits (December 1998)
  • Control Your World Using Linux (July 2011)
  • Control Your World Using Linux (July 2011)
Articles in this series:
  • Remote Control (March 1994)
  • Remote Control (March 1994)
  • Remote Control (May 1994)
  • Remote Control (May 1994)
COMPUTER BITS BY DARREN YATES What’s your free disc space? This month, we begin a series of articles looking at BIOS & DOS interrupts. In this article, we take a look at a simple programming technique that enables us to find out the free space on any drive without having to use the DOS DIR command. If you’re writing programs that use up lots of disc space, particularly database files or any graphics programs, the odds are that you’ll need to keep track of how much space you have to work with on a disc drive, whether it be hard or floppy. A program that crashes when the disc drive is full is pretty useless but most programming languages don’t have a simple routine which returns the bytes free in a variable. An example of this related to electronics is if you’re writing code which allows the computer to sample incoming analog voltages via an A/D converter. At any time, and depending on your sampling speed, it would be quite easy for the system to run out of disc space. A crash at this point would be disastrous and would almost certainly necessitate a repeat performance of the sample. Thank­fully, we can get access to this information in the same way the DIR command does using a simple QuickBASIC routine. CALL INTERRUPT() In the past, we’ve used the CALL ABSOLUTE() routine built into both QBasic and QuickBASIC. This time, let’s try an even simpler routine which is built into QuickBASIC called CALL INTER­RUPT(). The original method consisted of writing assembly code which has to be 74  Silicon Chip stored into an array and then the base and offset address found for the first element of that array and so on. While it worked well, it was by no means an easy to remember process. When QuickBASIC was launched, the people at Microsoft realised the usefulness of the inbuilt BIOS and DOS routines and incorporated a simple interface function which allowed easy access to them. One of these routines happens to be “Find Disc Space”. In the DOS routines, it is designated INT 21h,3600h. When this routine is called, it returns various pieces of useful informa­tion and this can be seen in Table 1. Upon calling INT 21H, the AX register must be loaded with 3600 hex. As we mentioned a couple of months ago, you can think of the interrupt as TABLE 1 Get Disk Free Space (interrupt 21h, service 36h) Category: Disk services Registers on Entry: AH: 36h DL: Drive code Registers on Return: AX: Sectors per cluster BX: Available clusters CX Bytes per sector DX: clusters per drive the street name and the AX register as the house number. When the routine is completed, all four general purpose 16-bit registers AX to DX are called into play and return the sec­tors per cluster, number of free clusters, bytes per sector and clusters per drive, respectively. From these registers, we can gather the following about the drive: • bytes per sector; • number of sectors per cluster; • number of free clusters; • number of clusters per drive; • amount of drive space used; • drive space remaining; and • total drive size. In most normal programming cases, only the last three items are of any practical use. Sample program Right, let’s now take a look at the sample program in Fig.1. If you compare this to the other programs published so far, you’ll notice that it requires fewer lines of code. To start off, we first have to define a type variable which we’ll call REGTYPE. This consists of all the required registers for CALL INTERRUPT(). The initial values are not important at this stage so we don’t have to worry about clearing them. Next, we define two arrays – INARY and OUTARY – as copies of the type REGTYPE. After that, the AX field of INARY is set to 3600 hex. The following line takes advantage of QuickBASIC’s COMMAND$ string metacommand. When typing in the command line at the DOS prompt to start the program, you would normally type BYTEFREE C: or whatever drive letter you like. COMMAND$ then contains everything after the program name. Basic Listing For Disk Bytes Free Utility ‘Disk Bytes Free Utility ‘Written by DARREN YATES B.Sc. ‘Copyright 1994 Silicon Chip Publications Pty Ltd TYPE regtype AX AS INTEGER BX AS INTEGER CX AS INTEGER DX AS INTEGER BP AS INTEGER SI AS INTEGER DI AS INTEGER FLAGS AS INTEGER DS AS INTEGER ES AS INTEGER END TYPE DIM inary AS regtype DIM outary AS regtype inary.AX = &H3600 drive$ = UCASE$(MID$(COMMAND$, 1, 1)) inary.DX = ASC(drive$) - 64 CALL interrupt(&H21, inary, outary) bytespersector& = outary.CX sectorspercluster& = outary.AX freeclusters& = outary.BX clustersperdrive& = ABS(outary.DX) memfree& = bytespersector& * sectorspercluster& * freeclusters& drivesize& = bytespersector& * sectorspercluster& * clustersperdrive& PRINT : PRINT “Analysis of drive “; drive$ + “:” PRINT : PRINT “Bytes free:”; memfree&; “bytes”, , “Bytes per sector :”; bytespersector& PRINT “Drive size:”; drivesize&; “bytes”, , “Sectors per cluster:”; sectorspercluster& PRINT “Bytes used:”; drivesize& - memfree&; “bytes”, , “Clusters per drive :”; clustersperdrive& program can be converted to work in the same manner as BUTTON.BAS published previously by just substituting the new INT number and adding the appropriate bytes to the arguments being passed to the machine code program. For those using QuickBASIC, make sure that you load QB with the QB.QLB quick library. This library holds the CALL INTERRUPT and CALL ABSOLUTE routines. You can do this by typing in the following line at the C:\ QB45 does prompt: C:\QB45> QB/LQB.QLB The /L option allows you to load in an extra Quick library and automatically invokes QB.LIB when you compile the program. The program will also work with drives running Microsoft Double­ Space, recognising both the real and host drives. To run the EXE file, simply type: BYTEFREE <drive>, where <drive> is the drive letter. As usual, we are making copies of BYTEFREE.BAS/ OBJ/ EXE available for $7 plus $3 postage. You can either send your cheque to SILICON CHIP or call (02) 979 5644 and quote your SC credit card details. K ALEX The UV People ETCH TANKS ● Bubble Etch ● Circulating So in this case, it would contain “C:”. Looking back at the program, this line takes the first character in the COMMAND$ string, converts it to upper case and then stores it in the DRIVE$ string. The interrupt we’re going to use also accepts a variable to allow us to select the drive we wish to analyse. This is stored in DX. However, the way it recognises the drives is 0 for A:, 1 for B:, 2 for C: and so on. Using the ASCII code we can simply take the drive letter, convert it to ASCII and then subtract 64 from it. This gives us the correct number for each drive. The following line then makes the call to the interrupt. Upon return, all four registers AX to DX contain our wanted informa- tion. These are then stored in long integers (four bytes wide), as denoted by the “&” symbol. The reason for using long integers is that it makes the following multiplication much easier to handle. Now all we have to do is to multiply the bytes per sector by the sectors per cluster and the number of free clusters to get our resulting free disc space. The drive size is found by multiplying the bytes per sector by the sectors per cluster and the number of clusters per drive. The number of bytes used is simply just the drive size minus the free disc space. The final four lines of code print this information on the screen. Now there are bound to be cries from people who only have QBasic. This LIGHT BOXES ● Portuvee 4 ● Portuvee 6 ● Dual Level TRIMMER ● Ideal PCB DRILL ● Toyo HiSpeed MATERIALS ● PC Board: Riston, Dynachem ● 3M Label/Panel Stock ● Dynamark: Metal, Plastic ✸ AUSTRALIA’S NO.1 STOCKIST ✸ K ALEX 40 Wallis Ave, East Ivanhoe 3079. Phone (03) 9497 3422, Fax (03) 9499 2381 May 1994  75