Skip to main content

197909 Byte Magazine Vol 04 09 Homebrewing

  • PublicationBYTE
  • Pages260
  • Source197909_Byte_Magazine_Vol_04-09_Homebrewing.pdf
← Magazines 197909 Byte Magazine Vol 04 09 Homebrewing
/ 260
Source: VintageApple.org — Complete 1975–1998 run, restored by Steve M.
Page 1
Loading…
Text content (OCR)
Be, ~~ > .. > SS = "i Ta OLN : a i a Se , * uy 8) 2 ee . Ey in ® the small systems journal AMEGRAW-HILL PUBLICATION: SYSTEMS - SOLUTIONS If you have a problem that can be solved by a computer—we have a systems solution. * Two central processors with maximum RAM capacities of 56K and 384 K bytes ® Three types of disk drives with capacities of 175K, 1.2M and 16M bytes * Two dot matrix printers with 80 and 132 line capacity ® A Selectric typewriter interface and a daisy wheel printer Match these to your exact need, add one or more of our intelligent terminals and put togeth: asystem from one source with guaranteed compatibility in both software and hardware. Southwest Technical Products systems give you unmatched power, speed and versatility. They are packaged in custom designed woodgrain finished cabinets. Factory service and support on the entire system and local service is available in many cities. SOUTHWEST TECHNICAL PRODUCTS CORPORATION ptt 219 W. RHAPSODY EE CC sSANANTONIO, TEXAS 78216 (512) 344-0241 Circte 356 on inquiry card. } CMe € Cromemco Low-cost hard disk computers — are here 11 megabytes of hard disk and 64 kilobytes of fast RAM in a Z80A computer for under $10K. Two floppy drives, too. Naturally, it’s from Cromemco. It's a reality. In Cromemco’s new Model Z-2H you get all of the above get it all. In this new Model Z-2H you get not only a large-storage Winchester hard disk drive but also two floppy disk drives. In the hard disk drive you get unprecedented storage capacity at this price—11 megabytes unfor- matted. You get speed—both in the 4 MHz Z80A microprocessor and in the fast 64K RAM which has a chip access time of only 150 nanoseconds. You get speed in the computer minimum instruction execution time of 1 micro- second, You get speed in the hard disk transfer rate of 5.6 megabits/sec. EXPANDABILITY You get expandability, too. The high-speed RAM can be expanded to 512 kilobytes if you wish. And the computer has a full 12-slot card cage you can use for additional RAM and interface cards. BROADEST SOFTWARE SUPPORT With the Z-2H you also get the broadest software support in the Circle 80 on inquiry card. microcomputer field. Software Cro- memco is known for. Software like this: @ Extended BASIC @ FORTRAN IV @ RATFOR (RATional FORtran) e@ COBOL @ Z80 Macro Assembler @ Word Processing System @ Data Base Management with more coming all the time. SMALL, RUGGED, RELIABLE With all its features the new Z-2H, including its hard disk drive, is stil! housed in just one small cabinet. Hard disk drive at lower left can be inter- changed just by sliding oul and disconnecting plug. Seven free card slots are available. Z-2H includes printer interface card. Cromemco Pee ee ae oe TO Included in that cabinet, too, is Cromemcoruggedness and reliability. Cromemco is time-proved. Our equipment is a survey winner for reliability, Of course, there's Cro- memco’s all-metal cabinet. ged, solid. And, there’s the heavy- power supply (30A @ 8V, 15A @ +18 V, and 15A @ —18V) for cir- cuitry you'll sooner or later want to plug into those free card slots. CALL NOW With its high performance and low price you KNOW this new Z-2H is going to be a smash. Look into it right now. Contact your Cromemco computer store and our sales literature, Find out you can see it. Many dealers will be showing the Z-2H soon—and you'll want to be there when they do. PRESENT CROMEMCO USERS We've kept you in mind, too. Ask | about the new Model HDD Disk | Drive which can combine with your present Cromemco computer to give you up to 22 megabytes of disk storage. Pe eesilaica Ares mola ECE ‘© (415) 964-7400 Tomorrow’s computers now BYTE September 1979 1. ter The single card c oe bint: rh ue SR 10) 1h Ps 50! ra ‘Specialists in computers and peripherals 280 BERNARDO AVE., MOUNTAIN VIEW, CA 94040 © (415) 964-7400 isi ul geen di fall NEN Hea Circle 80 on inquiry card. ‘2 BYTE September 1979 Par Foreground 10 JOYSTICK INTERFACES by Steve Ciarcia An interface for every purpose 2.0 INTRODUCTION TO MULTIPROGRAMMING by Mark Dahmke @® By Some basic concepts 4 Pa 3 4. INTERFACE A CHESSBOARD TO YOUR KIM-1 by jeff Teeters Play chess with a computer as easily as with a human opponent 70 A LOW-SPEED ANALOG-TO-DIGITAL CONVERTER by Richard C Hallgren Perform real-time data analysis 96 THE NATURE OF ROBOTS, Part 4 by William T Powers A simple, human experiment 11 8 INEXPENSIVE, OPTICAL PAPER-TAPE READER by Brian A Harron A manual paper-tape reader with no moving parts 130 A MODEL OF THE BRAIN FOR ROBOT CONTROL, Part 4 by James Albus Decision-making procedures Background 62, SOME MUSINGS ON HARDWARE DESIGN by Clayton Eli Simple design techniques 8 4. SOLDERING TECHNIQUES by William Trimmer A picture essay 160 HANDY PULSER by Bob Chrisp A simple, circuit-debugging tool 182 THE AMSAT-GOLEM-80 by Joe Kasser A modular and inexpensive S-100 computer system 196 ADD SOME CONTROL TO YOUR COMPUTER by Ken Barbier Let your computer influence the outside world Nucleus Editorial: The Rationale of Yet Another Homebrew System 6 Book Reviews 122,152 Programming Quickies 58,1 Letters 150 Unclassified Ads 61 Languages Forum 164 BYTE's Bits 80 Event Queue 176 Technical Forum 82 . What's New? 214 Clubs and Newsletters 92 Reader Service 256 BYTE News 115 BOMB 256 Cover Art: Fantasy on Homebrewing by Robert Tinney ~ BYTE is published monthly by BYTE Publications Inc, 70 Main St, Peterborough NH 03458, a wholly-owned subsidiary of McGraw-Hill, Inc. Address all mail excepl subscriptions 10 above address: phone (603) 924-7217. Address subscriptions, change of address, USPS Form 3579, and lulfiliment questions to BYTE Subscriptions, PO Box 590, Martinsville NJ 08836. Secons class postage paid al Peterborough NH 03458 and al additional mailing offices—USPS Publication No. 102410 {ISSN 0360-5280). Subscriptions are $18 for one year, $32 tor two years, and $46 for three years in the USA and its possessions. In Canada and Mexico, $20 for one year, $36 lor two years, $52 for three years. $32 for one year ait delivery to Europe. $32 surface delivery elsewhere. Air delivery to selected areas al additional rates upon request. Single copy price is $2 In the USA and its possessions, $2.40 in Canada and Mexico, $3.50 in Europe, and $4 elsewhere. Foreign subscriptions and sales should be remitted in United States funds drawn on a US bank. Printed in United States of America. ‘Address alt editorial correspondence to the editor at the above address. Unacceptable manuscripts will be returned if accompanied by sulficient first class postage. Not responsible lor lost manuscripts or photos. Opinions expressed by the authors are not necessarily those of BYTE. Enlire contents copyright © 1878 by BYTE Publications Inc. All rights reserved. BYTE® is available in microform trom University Microliims International, 300 N Zeeb Rd, Dep! PR. Ann Arbor Mi 48106 USA or 18 Bedford Row, Dept PR, London WC1R 4Ey ENGLAND. Subscription WATS Line: (800) 258-5485 Office hours: Mon-Thur 8:30 AM - 4:30 PM Friday 8:30 AM - Noon September 1979 © BYTE Publications Inc 3 la This BYTE About the Cover On this issue's cover, Robert Tinney has created a “fantasy on homebrewing.” in the middle of a sylvan glade, we see the form of a computer being sculpted by some homebrewer. A couple of humanoid forest denizens look on with wonder, perhaps hoping to get @ glimpse of our home- brewer on his return to the work- place. Building a joystick in- terface for your computer system adds a new physical input dimension. There are as many dif- ferent ways to interface a joystick as there are ap- plications. Steve Ciarcia discusses several widely varying ways to design Joystick Interfaces. Page 10 The idea of having a microcomputer work in a multiprogramming en- vironment is becoming a reality. Already there are several multiprogram- ming systems on the market. Mark Dahmke provides an Introduction to Multiprogramming so we can understand how these systems operate, If you enjoy playing chess against your com- puter, but dislike typing in the moves in abstract notation, you will be in- terested in a method of allowing the computer to detect moves made on a real chessboard. Jeff Teeters devised such a method and now tells us how he did it in Interface a Chessboard to Your KIM-1. Page 34 Some Musings On Hardware Design by Clayton Ellis provides readers with background information on picking integrated circuits and using them in homebrew work. Although there are many applications where a high-speed analog-to- digital converter is necessary, many conver- sion applications can make do with a slower conversion. Richard C Hallgren has built A Low-Speed Analog-to- Digital Converter for the Apple Il which he uses as a real-time data analyzer. Page 70 When constructing electronic equipment, it is imperative that good Soldering Techniques are developed. William Trim- mer presents a photo essay of good soldering practices and several ex- amples of unwanted techniques. Page 84 William T Powers brings his discussion of The Nature of Robots to a close by applying the previously-discussed techniques and theories in a simple experiment with a human subject. Page 96 The search for the in- expensive paper-tape A Harron describes an Inexpensive, Optical Paper-Tape Reader. Page 118 James Albus considers the mechanisms of choice in his closing article about A Model of the Brain for Robot Control. Page 130 A Handy Pulser can prove to be very useful when testing a digital cir- cuit. Bob Chrisp shares with us his version of a useful pulse generator. Page 160 In The AMSAT- GOLEM-80, Joe Kasser shows how your com- puter club (or any other group of experimenters) can economically build an S-100 microcomputer, The system is modular and expandable. Page 182 Performing simple con- trol functions with your computer can be easy. Ken Barbier describes how to Add Some Con- trol to Your Computer. Page 20 Page 62 reader continues as Brian Page 196 Publishers Production Director ational Advortising Virginia Londoner Nancy Estle Roprosentatives: Gordan A Williamson Production Edi Associates Ine Publisher David Willlam Hayward Officers of McGraw-Hill s Ann Graves Marion Gagnon 280 Hise Av Publications Company: Gordon Asslotant aith Hanson Janet Ames Neeanar Halohts MA 02184 L donas, President; Group Vice SVE Callihan Warren Witiamson Eileen Kind B17) dadsoas Presidents: Danial ‘A. McMillan, jobin M Moss Editorial Director James E. Boddorf; Senior Vice Carl T Helmers Jr Mineo Advertising BI (ia oe Bernd ‘Ny 1007 Presidents: Russell F. Anderson; Executive Editor Bien Bingham ocean Gaueley Ralph R. Schulz, Editorial; Vice Giatenner Mont jetlon Art on Bardsley cin Wtlcigan AV Presidents: Jamos E. Hackett, ite 1010 i ! Raymond cA "A Cote ich Dixon ate Manger Chicago I. 60611 Le ieuton eater ot Blaise W Liffick HOUMCarTeD LeBoAMleTe ret Gives Leyburn, Circulation; John W. Editor Pamelan toaslp toto Eval cr Palten, Sales; Edward & Richard § Shutord Typograpners Agnes E an Schirmer, International. Assistant Editors Chery! A Hurd Melanie Berton) Bala. ‘Alto CA 94303 Otficers of the Corporation: Kent Richard Babe L Whealet Barbara Elis fa) 962 07081714) 540-0554 Harold W. Mcgraw Jr, President Elton Assletants Kathy doctor” Ginnig FBoudiiesd Trafic Department Chiet Executive Oiticer and Gale Britton Photostat Technician ‘Anne M Baldwin Mark Sandagate Chairman of the Board; Robert F. Faith Ferry uty Londner Receptionist Thomas Yanni Landes, Senior Vice Presidiani Now Products Editor aeaueine Earnsnew eT er and Secretary; Ralph J. Webb, lube, Newsletters e Laura’A Hanson Kovin Maguire pate) Dratting Aasistant Jon Swanson Mary E Fluhr 4 September 1979 © BYTE Publications Inc bG I’ve seen Lanier, Vydec, Xerox, Olivetti, and Wang. I’ve chosen WORDSMITH from MICRO DIVERSIONS. 9 Ut. Vi Congressman Charlie Rose Chairman, Policy Group on Information and Computers THE WorosmMith” TEXT EDITOR Yes, I'd like to learn more about Wordsmith.™ Send me your information packet. Name i Micro Diversions, Inc. Company 8455-D Tyco Road, Address Vienna, Virginia 22180 Clty ———— (703) 827-0888 BYTE September 1979 5. Editorial Altos Computer Systems 2378-8 Walsh Avenue Santa Clara, CA 95050 Apple Computer 40260 Bandley Dr. Cupertine, CA 95014 Digita) Microsystems Inc. {Fotmorly Digital Systems} 4448 Piedmont Ave. Oakland, CA 94611 Imsal Mtg. Corporation 14860 Wicks Bivd San Leandro, CA 94577 Industrial Micro Systems 633 West Katella, Sulte L Orange. CA 92667 North Star Computer 2547 9h Street Berkeley. CA 94710 Percom Data 318 Barnes Garland. Ix 75042 Polymorphic Systems 460 Word Dr Sante Barbara, CA $3111 Problem Salver Systems 20834 Lassen Street Chatsworth, CA 91311 Processor Applications Limited 2807 E. Valley View Avenue West Covina, CA 91792 SD Sales 3401 W. Kingsley Garland, 1X 78040 Smoke Signal Broadcasting 6304 Yucca Hollywood, CA 90028 Technico Ine. 9130 Red Branch Road Columbia, MD 21045 Texas Electronic Instruments 5636 Etheridge Houston, TX 77087 Thinker Toys 1201 10th Street Berkeley, CA 94710 Vista Computer Company 2807 Oregon Court Torrance, CA 90803 A..Shugart 6 — Seprember 1979 © BYTE Publications Inc The Rationale of Yet Another Homebrew System by Carl Heimers In this issue of BYTE, we are placing a special emphasis on the homebrewing of computers: the craft of assembling the hardware and software of a system from standard components in nonstandard ways. This month’s editorial pro- vides a continuation of notes begun in July on the design and assembly of my new homebrew 6809 system. In this editorial, we complete the final details of the physical layout and power supplies of the system, as well as the overall design of the system. We shall also begin a discussion of the actual processor card. Future installments in this series on homebrew, general purpose, com- puter hardware will record details of the system beyond this article's goal of defining a backplane bus structure. As noted earlier (“Editorial,” June 1979 BYTE, page 6), the intent of this exercise is to develop a specialized controller node for a loosely coupled system of processors involved with musical applications. The multiple processors ini- tially contemplated were a Pascal-oriented, large personal computer and an ALF products model AD-8 music synthesizer with its 6502 used for house- keeping. In addition to this coordinating task, the 6809 would provide a cen- tral point for the connection of keyboards, displays and other hardware re- quired by musical applications. But ideas change and evolve. Since the ist installments were written, plans have become slightly more grandiose with my recent acquisition of a New England Digital “Synclavier” music synthesizer and its associated Able/60 minicomputer. Located in Norwich VT, New England Digital is a combined spin-off of the music and electrical engineering departments of Dartmouth College across the Connecticut river in NH. The computer for the music syn- thesizer employs the XPL language as its high-level user interaction. The New England Digital version of XPL is augmented by a floating-point data type. With the exception of an adaptation of UCSD Pascal, which is expected to be available soon, all systems software is written in XPL, including what is described as a 3-pass optimizing XPL compiler. {XPL is the language described in the book A Compiler Generator, by McKeeman, Wortman, et al, published circa 1968. The commonly used microcomputer language PL/M, 1st designed and implemented by Gary Kildall, is very similar to XPL in syntax and semantics. XPL is a simple subset of PL/I, with data types restricted to character and integer forms. ] At this point, I now have a need for multiple processor communications beyond the level of 1 large machine {a Western Digital P-engine) driving a smart peripheral through a seria] communications link. The smart peripheral will still handie specialized details like the paralle] interface to the older syn~ thesizer and the eventual interface to an electronically controlled player piano. See photo notes on pages 8 and 9, text continued on page 202 ‘After workin work, it’s a kick to get down to Ba: one thing that makes it more fun is my Shugart minifloppy™: We use Shugart drives at work, when | bought my own system | made sure it had a minifloppy drive “Why? Shugart invented the minifloppy. The guys who designed our system at work tell me that Shugart is the leader in floppy design and has more drives in use than any other manufacturer, If Shugart drives are reliable enough for hard-working business computers, they‘ve got to be a good value for my home system “When I'm working on my programs late at night, | can’t wait for cassette storage. My minifloppy gives me fast random access and data transfer. The little minidiskettes™ store plenty of data file easily too “SY made the right decision when | bought a system with the minifloppy. When you lay out your n hard-earned cash, you want reliability and performance. Do what | did. Get a system with the minifloppy.”” If it isn’t Shugart, it isn’t minifloppy. JS Shugart 435 Oakmead Parkway, Sunnyvale, California 94086 See opposite page for list of manufacturers featuring Shugart's minifloppy in their systems. TM minilloppy Is @ registered rademark of Shugatt Associates BYTE September 19797 Hardware Basis... These photographs depict some further details of the physical hardware of the new homebrew 6809 computer system, As noted earlier, Vector Electronic Co com- ponents were used for the assembly of a backplane. Photographs 1 through 5 show various aspects of the new design's packaging. Photo 1: The new computer system's final physical mounting basis is a mahogony box with guide blocks for the backplane assembly, Power supplies are located underneath the box. Power for the com- puter and accessories will be controlled by the standard, household wall switch mounted on the side of the box. Power connections to the backplane power buses will pass through a hole underneath the backplane in this photo, The hole pro- vides an exit path for the flow of hot air from the power supplies. Individual boards of the system plug into the backplane from the top as shown here. The backplane assembly slides into the grooves of the 2 guide blocks. These blocks are bolted to the top of the box using 4-20 machine-screws and threaded inserts, The grooves for the backplane board were cut 1/16th of an inch wide with a router and edge guide. The wood- shop tools required to fabricate this case included a table saw, electric hand drill, drill press, router, belt sander, sabre saw, and the usual collection of hand tools, Photo 2; The power supply modules are attached to 2 wooden brackets which are screwed into the main box by means of %-20 machine-screw threaded inserts. The power supply modules are mounted on the brackets using 48-32 threaded in- serts. Ordinary brass finish door stops serve as legs to keep the assembly off the table top, thus allowing natural convec- tion to cool the power supply modules. No attempt is made to calculate heating factors. The inverted cup shape of the box seems like an excellent trap for heat, however, the large hole beneath the backplane assembly at the top of the box provides a relatively low-impedance outlet for the heated air from below. If the temperatures observed under load are excessive, then a fix will be necessary. Ina commercial or industrial engineering situation where production of a product is contemplated, this “patch up after pro- blems” strategy is not the recommended practice due to the possibilities of costly errors, but for one of a kind products in a noncommercial and highly experimental context, it is certainly acceptable and can economize on time. Photo 3: (a) Brass machine-screw inserts to provide metal to wood fastening in the 8 — September 1979 ©) BYTE Publications Inc (1) (2) (3a) Ww assembly of the computer housing. These particular parts were purchased from the Brookstone Co Peterborough NH. (b) When inserting the machine-screw fasteners into hardwood, better results were obtained when the hole drilled in the wood was 1/64th of an inch larger than the recommended size in the instructions. Asshort section of the machine-screw to be used, together with a hex nut, provide a tool for driving the insert as shown in this picture, When using the $8-32 inserts in hardwood, a slightly larger hole than sug- gested in the instructions is a necessity. Unless the extra clearance is given, the torque on the #8-32 bolt used in driving insert will cause the insert to twist ap it after 1 or 2 uses. Photo 4: The backplane is the first and the most tiresome wiring involved with assembly of a small computer. Its defini- tion is provided by the simple instruc- tions: FOR each free socket, pin BY NUMBER OF each socket, CONNECT that pin to the same pin of the next socket in the backplane! The backplane assembly was described in the notes of the July 1979 BYTE, page 194, This photo shows the finished backplane after all wiring and installation of bypass capacitors has been completed. Photo 5: The wiring of the backplane, as well as the rest of this computer, was done with the Vector Electronic Co's “slit-N- wrap" technique. An electric eraser was used to motorize the connections, with an adapter custom-made ona small lathe. It is (5a) (56) recommended that motorized wiring be employed with the “slit-N-wrap” tech- nique. In previous experimental elec- tronics built with this technique, relia- bility problems were encountered with manual termination of the wires to wire- wrap socket posts. Motorized wrapping with this tool provides a uniform and higher force for stripping the insulation off the wire. At (a) is the adapter: a hollow tube made from 2 junk box spacers, a #10-32 bolt with a hole drilled through it, a brass union between the 2 spacers, and a large brass adapter to which a #10-32 nut is soldered. (This latter kludge is what hap- pens when one makes an adapter on a Sunday afternoon and a #10-32 tap is not available!) At (b) the completed adapter is mounted in the Bruning Electric Eraser in a typical use situation. September 1979 © BYTE Publications Inc 9 Cisecia’s Ciecuit Geller Copyright © 1979 by Steven A Ciarcia. All rights reserved. Joystick Interfaces Steve Ciarcia POB 582 Glastonbury CT 06033 Photo 1: A typical joystick with 4 potentiometers The thought that often comes to mind when the word joystick is men- tioned to a computer enthusiast is of a spacewar-type game. A photon torpedo is fired from an opponent's starship, and the thruster joystick is deftly moved to reposition the craft out of its path. All of this occurs without having to take your eyes off the screen. Eye/hand coordination is almost “instinctive.” With a glance to the upper right of the video screen, the joystick is tilted to the upper-right corner of its 360° range. This moves the spacecraft toward that coor- dinate. Reverse thrust is accomplish- ed by moving the joystick in the op- posite direction, as though you are pulling back on the throttle of a real 10 September 1979 &) BYTE Publications Inc craft. Such is the general experience with joysticks. However, the poten- tial use of these devices greatly ex- ceeds that of game playing. A joystick, for those people who are unfamiliar with one, is shown in photo 1. It is an electromechanical device with resistance outputs pro- portional to the X,Y displacement of a central ball and lever. Photo 2 illustrates the mechanical connections to the potentiometers. When the stick is positioned in the center of its axes, the X and Y poten- tiometers show resistances in the center of their ranges. When the stick is tilted to the upper right, both potentiometers are at their full- resistance limit, while the opposite Photo 2: Note how moving the stick moves the gimbal arrangement, which in turn changes the settings of the poten- tiometers. (lowest resistance) is true when in the lower-left position. The outputs of the 2 potentiometers accurately track, as if on an X,Y coordinate axis, the position of the joystick. It should be noted that while it takes only 2 poten- tiometers to define 2-dimensional travel, most joysticks are manufac- tured with 4 potentiometers. This is a remnant of the days when joysticks were connected directly to the 4 deflection-plates of a cathode ray tube (video screen). It is one thing to consider inter- facing a joystick to a computer, and quite another to do it. A joystick is a mechanical X,Y positioning device. Even with proportional output resis- tances, an input interface must be designed to convert position from an analog to a digital representation which can be used by the computer, A further consideration is the resolu- tion, or percent, of full-scale travel per bit sensitivity. Is the application so gross that center and full-scale are the only points of interest, as in a TAIRBIBILIL WIDS=Il Vertical Disk Subsystem ) | Lt ws-n SYSTEM INCLUDES: * 2 Siemens 8”’ Disk Drives © 1 Cabinet with Fan and Power Supply © 1 Tarbell Floppy Disk Inter- face, assembled & tested. e 1 CP/M Disk Operating Sys- tem, ¢ 1 Tarbell BASIC. All Cables and Connectors. * Complete User Documenta- tion. e Fully factory assembled and tes Price . . $1888.00 Circle 360 on inquiry card. BYTE September 197911 2 JOYSTICK POTENTIOMETERS / +15¥ / 470 10m Fy tom 2 mM D Rr \cze> ay 50K 1oy_ 1oK 10M lox 9 10K 9 | 4 Si , b— > a aCe -—_[ > 82 af 25 -——{> 86 TO 4 LEAST 10K JOM SIGNIFICANT tok tom TO 4 MOST BITS OF SIGNIFICANT INPUT PORT} BITS OF 10K 7 (oK 7 INPUT PORT } +—o— b al 2, p——_{>> as 6 tea 6 ike 1 310k 10M lok Jom 10K 10K Laws SF 45> ilo 2 BO 12a Z Ba a}. a] {el IC; 10k LM3339 lok LM339 Number Type +5V GND Ic1 LM339 3 12 *Ry* APPROXIMATELY 100 ONMS. \c2 LM339 $- 12 * Figure 1; Low-resolution static interface, This interface is for 1 2-potentiometer joystick. For 4-potentiometer joysticks, build a second circuit like this one, and interface it to another input port. Nate that if the comparator does not trigger at full-scale setting, a small resistor may have to be added at Rx (marked with asterisk). game control, or is the application one which requires fine control, such as a cursor-positioning device in a high-resolution graphics system? All joystick interfaces are not created equal. There is a trade-off between hardware and software. The lower the resolution, the fewer the parts. The higher the resolution, the greater the electrical complexity or the software interaction with the in- terface. It is also important to recognize that computer systems which operate only in a high-level language like BASIC cannot use an interface design that requires an assembly language subroutine as an integral component. In such instances only a static interface can be used. Included in this presentation are 4 interface designs which should cover most requirements, as well as demonstrate the considerable dif- ferences between them. The 4 types are: @ low-resolution static 12 September 1979 | BYTE Publications Inc @ high-resolution fully static hardware @ software-driven pulse-width modulated ® high-resolution analog+to-digital Low-Resolution Static Interface First of all, static simply means that the interface hardware determines the potentiometer position value and pre- sents it in constant, parallel digital form to the computer. When the interface is attached to any parallel input port, this joystick value can be read with a single INPUT command in BASIC, As far as the computer is concerned, the value is fully static, and the computer reads whatever data is there when the INPUT is ex- ecuted. The interface hardware has the responsibility of asynchronously updating the digital value as the stick is moved. Often the joystick is simply used to indicate relative direction and magnitude, In a wheelchair, for in- stance, full linear control of speed and direction would require rather expensive drive electronics. Most chairs use simple relay contacts and provide 2 or 3 selectable speeds. A joystick control built for this applica- tion would not have to have a resolu- tion of 8 bits, but could, in fact, suf- fice with 2. Figure 1 shows a low- resolution static output joystick inter- face suitable for use in this application. Each potentiometer is connected as a voltage divider between a reference voltage source of 3.9 V and ground, The valtage output of each poten- tiometer is, in turn, fed to a 2-bit, parallel analog-to-digital converter. This type of converter uses 4 com- parators set for 25%, 50%, 75%, and 100% of full scale. If a voltage, when applied, is less than 0.975 V, all com- Parator outputs will be at 0 V. At 1.0 V, corresponding to the joystick be- ing moved 25% of full scale, the least significant bit (LSB) of the converter will be a logic 1, while the other bits are low. Similarly, at full input all —— fa | ioe theirs. So you didn't think documentation made a difference. Sure, MicroSource is flexible, powerful. versatile. Sure, it's sophisticated yet simple: the first user-oriented software. But you may not be aware of the biggest difference of all, Documentation. The most extensive in the industry. Support makes a difference, too. The support of some of the world’s leading microcomputer people. The support of stringent field testing and follow up. The invaluable support of business software experts dedicated to helping you manage information in real-world environments. Not just when you acquire software, but as you implement, as you train, as you use Microsource to solve your contemporary business problems. The MicroSource Difference means dealer support, too: we back every dealer with our experience, our knowledge. our integrity. Plus, the materials and resources he needs to provide the finest in software solutions and data base management ours. From AutoScribe™, the versatile word processing package that means business . . . to Bookkeeper™, designed by a CPA to produce efficient client writeups. From the powerful LedgerPlus™ financial package to MoneyBelt™, the flexible accounting system, both for small to medium sized businesses .. . or small to medium sized departments of big corporations. TimeKeeper™ — for the professional practice or the corporate service department — bills for time, when time means money. All MicroSource is backed by exhaustive operations manuals, incomparable factory support, and system expandability. It runs on North Star, Vector Graphics, Heath Data Systems, Apple and TRS-80 . . before long, CP/M, Cromemco, Data General and MicroNOVA. Sample the MicroSource difference. Ask your dealer about powerful. user-oriented MicroSource software. Or call the telephone number below for the nearest MicroSource dealer near you. 1425 W. 12th PI. - Tempe, AZ 85281 - 602-894-9247 Circle 222 on inquiry card. BYTE September 1979 13 comparators will be triggered, and bits 0 thru 3 will be logical 1s. Additional encoding logic can be added to produce a true 2-bit representation from the 4 compara- tors, but it is just as easy for a com- puter to interpret it directly. With a 4-bit connection as shown, used in a BASIC program, 25% of full scale would be 1 decimal, 50% of full scale would be 3 decimal, 75% of full scale would be 7 decimal, and full scale would be 15 decimal. It should be easy to trigger any action by a coin- cidence with these values. The real significance of this method is that the potentiometer position is presented statically to the computer and re- quires no other interaction. This makes it ideal for direct use with BASIC. poor ron ------ sovstick - - - = - 5 nen ener n nnn clock 4 +5V Al A2 10 6 ne Q Ry 1c box owe | Fara 8-B8IT Ry POSITION nf 35m Rext/Cext 80 Bi B2 B3 84 85 86 B87 7 13 |iz_ | _fio 3 fej fio 7400 Qn A A A Qe, 9B Ac Ao 7486 9 3 LOAD a 169 1c10 ath 2 eee 2 1c40 crock 2 163, ciock2 1/9. AB co AB co por 7400 2 2 | | 2 3 [¢ |5 —_ pe CLEAR icap 5 | om jo fe fi iz_|o je |u a 8 ¢ OD AB C OD 1 INPUTB cz LinpuTs cg g| icoa p>>—SOUNT INPUT A 7493 'Vinputa 7493 clock C>—— ice ROW) O12) RON _ROL2) 7404 [ [ [ 3 21 >02 cLock a al Aa ° 6 Cexr @ ice BI H Nee 8-BIT Rp POSITION 35ms Rex /Cext BO BI B2 B3 84 85 86 87 Ice 7404 1 13 fi2_ fir fio L222 Qa QB Qc Ap 10 13 Loan 1e13 AB co AB Cc Troe 7400 2 [3 [4 Js 2 [3 |4 5 12 AR 1a] ica pl CLe + 2 jo fe fu jo |e |v a B Cc OD a 8 ¢ O 1 H 4 Ltinput Bey) Litinpurs cia 5| 1c5> STL ‘“Vineura 7493 ‘SJiypura 7493 cLock (>——4 ice ROW) ROL2) ROU) ROL2) 7404 E E 7 “4 September 1979 © BYTE Publications Inc +>ot High-Resolution Static Interface It is quite possible that 2 bits of resolution is not enough for your application, but direct compatibility with a slow, high-level language is still a requirement. Expanding the parallel comparator method will work in theory, but you must realize that a 4-bit analog-to-digital con- verter uses 15 comparators, and an 8-bit, parallel analog-to-digital con- verter needs 255 comparators! So much for that method. Realizing that the output of the joystick is a variable resistance, we can use this to advantage. This resis- tance can set the time constant of a at Number Type +5V GND (C1 74121 14 7 ce 74121 14 a Ica 7486 4 7 Ic4 7400 14 y. Ics 7400 14 Ys \c6 7404 14 7 17 7493 & 10 Ice 7493 5 10 (cg 7495 14 7 1C10 7495 14 t Ic1t 7493 5 10 IC12 7493 5 40 Ic13 7495 14 7 C14 7495 14 7 ic1s NESSS 8 v +8Vv of FREQUENCY 115 ADJUSTMENT |, |, «NESS 10x RESET Vcc DISCHARGE 3 R7.SKHE 3.3K output f—{_> cLock 6 ovTpuT THRESHOLD 2) rRIGGER GROUND BYPASS 7 3 0.01uF tJ in Figure 2: High-resolution, static interface. Each potentiometer in the joystick con- trols the pulse width of a ane-shot. The pulse width can vary from 35 ms at full- scale to 100 us at 0. If a joystick with 4 potentiometers is used, a duplicate circuit may be constructed for the 3rd and 4th potentiometers. function which has a pulse width pro- portional to joystick position. Figure 2 illustrates an interface design which uses this technique. The 2 joystick potentiometers R1 and R2 control the pulse width of a one-shot (monostable multivi- brator). The one-shot has a pulse width of 35 ms when the poten- tiometer is at SO k ohm full scale and something less than 100 ys at 0% of full scale. A 7.5 kHz clock signal asynchronously triggers the one-shots. When the one-shot fires, its duration is proportional to the joystick posi- tion and will vary from approxi- mately 0 to 35 ms. Using midscale pulse width of 17 ms as an example, the circuit timing is as in figure 3. On the leading edge of the one-shot signal, a clear pulse is generated through an edge detector configured 7486 device. The clear pulse resets the 2 7493s which form an 8-bit counter. Once cleared, the counters start counting clock pulses for the duration of the one-shot’s period. On its trail- ing edge, a load pulse is generated which loads this 8-bit count into an 8-bit storage register. The computer is connected to read this 8-bit value through a parallel input port. Suc- cessive clearing and counting opera- tions update the register every 35 ms or so (worst case). The clock rate is 7.5 kHz which has a period of 133 gs. If the one-sho. has a pulse width of 17 ms, then 127 clock pulses would be gated to the counter. Of a total possi- ble 255 counts, 127 would represent 50% of full scale. Software-Driven Interfaces So far I have discussed only static interfaces, If the computer used with the joystick has sufficient speed and excess computing time available, then it is reasonable to use the computer to directly determine the one-shot period. Figure 4 shows a circuit which directly connects to the computer bus and demonstrates this technique, The circuit as shown is wired for I/O (in- put/output) port decimal 255 or hexadecimal FF. The 4 joystick poten- tiometers are used as the timing resistors on 4 NE55S-type one-shots, When an OUT 0, FF is executed in assembly language, it triggers all 4 one-shots. To keep track of the pulse widths, a 74125 3-state driver gates the one-shot outputs onto the data bus during an IN FF instruction. By looping through this program a number of times and keeping track of the logic levels of the 4 one-shots, the computer can accurately determine joystick position in terms of loop counts of instruction times. Listing 1 is a program which does this for 1 potentiometer. High-Resolution Analog+o-Digital While all methods are in some way analog-to-digital converters, the last cLocK ||| T5KH2 ONE SHOT Q ia © TO 35 mSEC CLEAR = 20nSEC LOAD = 20pSEC COUNT iil M © TO 255 PULSES Figure 3: Timing diagram for interface of figure 2. The driving clock signal is 7.5 kHz. The one-shot can be triggered for periods of 0 to 35 ms, depending upon the position of the joystick. When a reading is to be taken, the counters are cleared. Counts are made until the one-shot signal drops, and then a load signal is sent to the interface. At this point the counter is read to determine the position of the joystick. September 1979 @ BYTE Publications inc 15 clear B lngger one-shots increment B register tead potentiometers isolate bit 0 continue as long as one-shot is high value 1s In B register Listing 1: A typical assembly language program for usitig the joystick interface of figure 4. After the one-shots are triggered. the program loops and checks the status of bit 0. When this bit is set, the conversion value is in register B. This program assumes that there is only 1 value being checked, and it is being input through bit 0. method is in fact an 8-bit absolute- analog-to-digital converter, typical of the type used in computerized meas- urement applications. IC1 is an 8-bit digital-to-analog converter that pro- duces an output voltage proportional to a digital input applied to pins 5 thru 12. For a complete explanation of this device, I refer you to a pre- vious " Ciarcia’s Cirevit Cellar” arti- cle, “Control the World” (September 1977 BYTE, page 30). This article also The 3 basic sections are a computer-controlled voltage source dCs 1 and 2), an analog-input multiplexer (IC3} which selects an in- dividual joystick potentiometer by a 2-bit address code, and a comparator (IC4) which compares these voltages. In operation, the digital-to-analog converter is first set to 0 V out (hexa- decimal 00 digital input to it) and 2 potentiometer is selected through the multiplexer. If VO from the digital-to- analog converter is less than V,, from the potentiometer, the output will be logic 0. Next, the digital-to-analog converter input setting is incre- mented, and the comparator output is checked again. Eventually an input count will be reached which will exceed V,,. The comparator output will then be a logic 1. The digital-to-analog con- verter input count is now the value of outlines calibration and test pro- the voltage V,,. The worst case re- cedures. quires 256 iterations using this my OMRU Aha oy ARE JOYSTICK 1e8 POTENTIOMETERS 7 Tele Nese rags sox $2 PK 2 3 2 ouTPuT So {> 09 i roy THRESHOLD 7 vo>— ‘ iz 2 DiscHarse Co 22K al CONTROL, as Es T° 1a TRIGGER 6 O.01e To 4 J T compute 4¢ > 3/30 joe Fay AOORESS 43 >>> 5 A 6 a2 C>—4 bs ro 22K - 0 50K io oureur PS S > Co wReshoLD A 2 fi 20 C>—44 2 na Sdoischarce |, ' ae CONTROL To [+s] ca Bnoune RISGER coupiiren 7400 e Oak: DATA 3 $ BUS + By 2 ice —_ Pt Fe be [ is ae K ouy Put se 8 ware 21 ee Gane > {> be L {DISCHARGE e | a CONTROL a IIGGER @ Toomer 10 egy aie : TROL 4 iezp 22K 50K i ie ourpur 2 pe [> os THRESHOLD ‘e BloiscHarse |, , ale CONTROL lyr TRIGGER ‘i a 2 a mL 8 10 ro} 4 reaa Co Figure 4: Software-driven interface. If the computer can directly read the input fron the joystick interface, the hardware required can be greatly simplified. When hexadecimal FF is output to port 0, all 4 one-shots are triggered. The pulse wideh is then deterntined by a program running through a short loop looking at the logic levels of the 4 one-shots. Listing 1 shows a typical program for this application. 16 September 1979 + BYTE Publications Ine no loose ends computer, floppy, /O,16K RAM. $1595" ayheares New Heathkit® H89 All-In-One Computer Heath takes the risk out of selecting a balanced computer system. Now, video terminal, floppy, keyboard and 8-bit computer are brought together in one self-contained, compact unit. Nothing hangs out. Two Z80's The personal computer has never been simpler, Or smarter. Two Z80 microproc- essors mean terminal never shares pow- er with computer, as do most desk-top units. So this terminal is capable of a multitude of high-speed functions, all controllable by keyboard or software. 12 hays, 8 tral a 102K bytes storage Built-in floppy disk system gives you fast access to programs and data. Each 5%- inch diskette has more than 102K bytes of storage area, enough to hold entire files. The All-In-One comes with 16K RAM, expandable to 48K. Hundreds of uses at home or work The All-In-One Computer runs programs written in MICROSOFT™ BASIC and ASSEMBLER Languages. And it accepts all current software written for the popular Heathkit H8 computer. You can choose from scores of practical programs for home and business. Learn by building What better way to learn about comput- ers than to build one yourself? The All- In-One is available in easy-to-build kit form, as well as completely assembled. Like all Heath electronic kits, it comes to you with its own easy-to-follow assem- bly manual and a nationwide network of service centers to assure smooth sailing. FREE CATALOG For complete detalls on the Heathkit H89 All Computer and nearly 400 other electronic kits for your home, work of pleasure, send today for the latest Heathkit Catalog of values. °91195 without floppy. Mail order kit price, F.0.8. Benton Harbor, MI. Also available at Heathkit Electronic Centers at slightly higher prices. Prices subject to change without notice. Heathkit cP-165 HEATH COMPANY, DEPT. 334-570, BENTON HARBOR, MI 49022 Circle 216 on inquiry card. BYTE September 1979 17 Number DIGITAL-TO-ANALOG CONVERTER (ct Ic2 +15v (c3 . ica a ater ; Wr lpr wWwaz3a 7 a eg 4.7K FROM COMPUTER FULL OUTPUT PORT I SCALE orFseT AUST ADJUST Lex an 5K 2.2K use 5 rns . 87 CS +Vaee yk yk % —_4 + Ip 85 (> 2 ra * MCI408LS LM30ia 4 8 «o— 4 83 C—4] lo 10 15 eo ~VREF DIGITAL TO ANALOG CONVERTER u T FOR O TO 2.56V ss C— 3.3K st a a Ls6_12 Rance |! oo CONTROL CoPeN COMPARATOR 16 T 330F TO COMPUTER S30F INPUT PORT | ~15v {> ag YOYSTICK MULTIPLEX LMBO1A IN7S0 vin ary FROM COMPUTER OUTPUT PORT 2 rer Vege = 2.56 8, C—te out Bo C——Ha in) Re and resolution relative to the other fouls methods. See OF ae You should now realize that both the design and construction of a INz joystick interface are influenced by Ics many factors. It is not unusual to find 04051 R one manufacturer charging $50 for a m3 : igok joystick, while another charges $200. i Resolution, accuracy, and software SECOND Pain oF | 5 : he ori id POTENTIOMETERS | interaction are the prime considera- twa 2 t Ra tions. Where static inputs are re- INH tooo i quired, the hardware will necessarily s$—s Figure 5: High-resolution analog-to-digital conversion. This hardware-oriented device multiplexes 4 voltage inputs (from the joystick potentiometers) and has the capability of handling 4 more voltages. method. A better technique is suc- cessive approximation where the computer progresses through a binary search to “zero in” on the final value. A full explanation of suc- cessive approximation is delineated in my article entitled “Talk to Me: Add a Voice to Your Computer for $35” (June 1978 BYTE, page 142). 18 — September 1979 © BYTE Publications Inc With the digital-to-analog con- verter set for a full-scale value of 2.56 V, each count is equivalent to 10 mV. Only 4 channels of the CD4051 are used for the joysticks, leaving another 4 channels as auxiliary inputs from external sources. Thus it is possible for this interface to serve a dual role because of its high accuracy be more complicated. Resolution and accuracy ultimately determine the complexity of the interface. For simple spacewar-type games, the circuit of figure 1 should suffice. For more demanding applications such as cursor control in a high- resolution graphics system, figure 5 may be the optimum choice. Be careful when buying joystick inter- faces, Make sure that they mate with your program requirements and your systems abilities. Next month's “Circuit Cellar” feature will discuss a stand-alone, light-emitting diode display board. a “Our inventory Think we'd trust it to than Scotch Brand 4 — is Our existence. anything less Diskettes?” Don Stone, President, Mass. Auto Supply Company, Inc., Boston, Mass. Scotch Diskettes are the diskettes you can depend upon with the information your business depends upon. Each one is tested and certified error-free before it leaves our factory. Because we know nothing less than perfection is acceptable for your vital business data Scotch Diskettes are available in regular or mini sizes, compatible with almost any system. To find out where you can purchase Scotch Diskettes, call toll free: 800-328-1300. (In Minnesota, call collect: 612- 736-9625.) Ask for the Data Recording Products Division. In Canada, write 3M Canada Inc., London, Ontario, N6A 4T1. If it’s worth remembering, it’s worth Scotch Data Recording Products. Circle 968 on inquiry card. BYTE September 1979 19 Introduction to Multiprogramming Multiprogramming has usually been considered out of reach of the average personal computer experi- menter using a small or medium scale computer. Actually, anyone with a processor above the level of an 8008 can operate a multiprogram or multiuser system. The original pur- pose of multiprogramming was to allow more than 1 user to take advan- tage of a computer simultaneously. This increased the productivity of the machine by allowing programs to run while other programs were awaiting user input, access to a disk, etc. This may seem to conflict with the advantages inherent in micro- processor based systems (single user systems and low cost}. However, there are many instances where the ability to run more than 2 program at a time may be advantageous. Note that the statement “more than 1 pro- gram may run at a time” does not mean simultaneous execution. That is the definition of multiprocessing (more than 1 processor on the bus), not multiprogramming. To describe multiprogramming more effectively, | shall refer to a more well-known function in com- puters: real-time interrupts. Suppose we are using a microcomputer to manage the environment in a small office building. Normally we want ta continually poll (scan) the sensors that are distributed throughout the building and adjust heating, cooling and lights on the basis of temperature and time of day. Let us say that 20 © September 1972 BYTE Publications In Mark Dahmke 8312 Selleck 600 N 15th St Lincoln NE 68508 during normal operation, someone in the building wants to change the temperature of an office, One way to do this is to have a video terminal and keyboard attach- ed to the system that generates an in- terrupt when a keyboard request is made. Upon receiving the interrupt, the computer saves the status of the current program and enters or trans- fers control to the keyboard read routine. As soon as the user has made the desired change, the system loads the old status information and returns to the origina} program. This same in- terrupt technique could be used to design a time shared system that would allow several terminals to be hooked up to a processor, Each ter- minal would generate an interrupt, and whichever program was active would be put in a wait state. This arrangement only works well for a few terminals, though. You can ima- gine what would happen if everyone happened to press a key at the same time. Figure 1 shows timing comparisons of several modes of operation already discussed. In figure 1a 2 independent processors are shown, each doing something different and neither in- terfering with the other. This is known as multiprocessing. The pro- cessors may or may not be sharing 1/Olinput/output) terminals or memory. In figure 1b 2 processors are shown in a master-slave arrangement. Perhaps the slave processor performs floating point arithmetic or some complex 1/O function. The master processor can give the slave processor commands via an interrupt and con- tinue other processing until the slave informs it that it has finished the desired operation. Figure Ic shows a single processor with an interrupt being applied. The processor temporarily gives control to the routine specified by the inter- rupt hardware and begins executing it. When complete, it returns control to the main program, Figure 1d shows the multiterminal timeshare system. Usually the interrupt hardware con- tains provisions for daisy chaining or prioritizing the interrupts as they come in. Thus, if terminal 6 applies an interrupt and the processor is busy with terminal 7, terminal 6 is not allowed to interrupt the processor untif terminal 7 is finished. Using multiprogramming is like using real-time interrupts. A multi- programmed system uses interrupts, but in a more efficient way. Imagine a simple 2 program situation, Suppose program A is running and no other About the Author Mark Dahmke is currently employed by the University of Nebraska Computer Network as a programmer. analyst m the Acadentic Com- puting Services section. He is also a senior comiiter scienre major. At home, Mark owns an 8080 based system with 32 K bytes of memory and dual COM flopny disk drives. His work involves graphics. electronics writing, systems programming and speech syn- thesis. ALTOS presents a new standard in quality and reliability WE’RE ALTOS COMPUTER SYSTEMS. Our SUN-SERIES ACS8000 business/scientific computer creates a new standard in quality and reliability in high technology computers. HIGH TECHNOLOGY The ACS8000 is a single board, Z80®* disk-based computer. It utilizes the ultra-reliable Shugart family of 8 inch, IBM compatible, disk drives. A choice of drives is available: single or double density, single or double sided. Select the disk capacity you need, when you need it: 4M, 1M, 2M, or 4M bytes. The ACS8000 features the ultimate in high technology hardware: a fast 4 MHz Z80 CPU, 64 kilobytes of 16K dynamic RAM, | kilobyte of 2708 EPROM, an AMD 9511 floating point processor, a Western Digital floppy disk controller, a Z80 direct memory access, Z80 Parallel and Serial I/O (two serial RS232 ports, 1 parallel port), and a Z80 CTC Programmable Counter/Timer (real time clock). In essence, the best in integrated circuit technology. BUILT-IN RELIABILITY _ The ACS8000 is a true single board computer. This makes it inherently reliable and main- tainable. The board and the two Shugart drives are easily a cessible and can be removed in less than five minutes. All ele: tronics are socketed for quick replacement. Altos provide: complete diagnostic utility software for drives and memory. QUALITY SOFTWARE Unlimited versatility. The ACS 8000 supports the widely accepted CP/M®** disk operating system and FOUR high level languages: BASIC, COBOL, PASCAL and FORTRAN IV, All available NOW. PRICE ACS 8000-1, single density, single- sided i: Mb] $3,840 ACS 8000-2, double density, single-sided [1 Mb] $4,500 ACS 8000-3, single density, double-sided (1 Mb} $4,800 ACS 8000-4, double density, double-sided [2 Mb] $: A Brackets show disk capacity per standard two drive syste: models come standard with 32 Kb RAM and two 8” disk peo as shown above. Expansion to 64 Kb is $363 per 16 Kb. FPP, DMA, software optional. Dealer/OEM discounts available. Delivery: 30 days ARO, all models. *280 is a trademark of Zilog. Inc. Circle 6 on inquiry card. COMPUTER S STEMS 2338A Gacanienye taser aaa ® CA 95050 @ (408) 244-5766 programs have been started. Then a user initiates (loads) another program called B. How will program B gain control of the system so that it might start to execute? The process of passing control from one program to the next is usually handled by an operating system module referred to as an inter- rupt call routine. Normally, to save the programmer the trouble of making sure that this routine gets called at regular intervals, the routine is usually imbedded in many of the 1/O driver routines or other standard utility subroutines on a system. Note that this technique will in no way upset any of the flags or registers of the routine it is called from. This interrupt call program will: 1, Determine if any other programs are waiting to execute. 2. Ifso, save all registers and flags on the stack and save the address of the current program’s stack pointer in a special table in memory. 3. Load the new program's stack pointer from the table, pop all registers and flags off the stack. 4, Return to the new program, Loading the new stack pointer raises some interesting questions. If program B has not yet begun, how could its registers have been pushed onto its stack? Figure 2 shows the stacks of both programs as they would be at each step in the previous- ly described interrupt call routine. Part of the job of the routine that in- itialized program B is to set up a dummy stack and stack pointer such that the program counter address on the top of the stack contains the entry point of program B. Thus, when the interrupt call routine reaches step 4, it will execute a return instruction, then pop the entry point address off the stack and begin executing program B, When the interrupt routine is called again, it will see that program A is waiting and will save all of program B's registers and flags, swap stack pointers and return to program A at the point where it was first inter- rupted. All this activity will take place every time the interrupt routine is called, but if one of the programs gets caught in an infinite loop, the inter- rupt call routine may not get called. The simplest way to avoid this kind of problem is to add some hardware to provide external timed interrupts. As shown in figure 3, the interrupt timer is set to provide an interrupt every 10 ms. A reset line is provided PROCESSOR | (2) lonocesson 2 10 | PRockam a | 10 | programe | fo | PRocRams | 10 | PROGRAM 8 | 10 | PROGRAM B | 10 | PROGRAM B | 10 i MASTER PROGRAM & PROGRAM & CONTINUES PROGRAM & OTHER WORK (0) | aye SLAVE PROGRAM sNiTiATED | { suave senos meany sicnan LA Inactive OR PROGRAM A RACTIVE OR cae BOCORAN A INACTIVE OR DOING OTHER WORK EXTERNAL INTERRUPT “occurs te) PROGRAM A INTERRUPT ROUTINE PROGRAM & RESUMED ! to) OPERATING TERMINAL © OPERATING TERMINAL 7 TERMINAL 6 TERMINAL 7 | TERMINAL 6 OPERATING SYSTEM SERVICED SYSTEM SERVICED SERVICED COMPLETED COMPLETED SYSTEM TIME Figure 1: Timing diagrams for 4 different system organizations. Figure 1a is a multiprocessing example using 2 independent pro- cessors. Figure 1b is a multiprocessing example using 2 processors connected in a master-slave configuration, Figure 1c is a single pro- cessor with 1 level of interrupt. Figure 1d is a single processor with 8 levels of interrupts. Each of the 8 levels is activated by 1 of 8 ter- minals. 22 September 1979 © BYTE Publications Inc STACK A a (HIGH PROGRAM COUNTER , STACK POINTER A—y (FD) PROGRAM COUNTER Ww) AFTER INTERRUPT CALL STACK 8 a (HIGH) PROGRAM COUNTER (Low) PROGRAM COUNTER STACK A (2 PROGRAM COUNTER (HIGH) PROGRAM COUNTER (Low) ALL REGISTERS, ————+] FLAGS ALL REGISTERS STACK POINTER A (STACK POINTER, SAVE LOCATION) FLAGS STACK POINTER @ (STACK POINTER SAVE AREA) STACK POINTER B—* STACK B co) PROGRAM COUNTER (HIGH) PROGRAM COUNTER (Low) Figure 2: Arrangement of all stacks and stack pointers at each interval of an interrupt call routine, in the event that the interrupt routine is manually called (through the soft- ware method), The timer may be reset to give the program its full 10 ms. A disable line is provided to allow the user to turn off the timer for special applications (software timing) in which the processor must not be in- terrupted, Figure 4 shows our previous exam- ple of figure 1, but with the extra hardware generated interrupts added. In figure 4a some software interrupts are mixed in with the hardware inter- rupts. The timer is reset after each call to the interrupt routine. Figure 4b is the same except that the timer is not reset after each call. A Complete System There are limitless ways to go about developing a computer system that will be easy to use. A look at the current market shows this to be true, perhaps even to a greater extent on the small systems level. I will not at- tempt to describe all possible varia- tions available on a multiprogram- ming system, but I will try to give as generalized a view as possible. First, we must consider what is necessary to make a useful system. The following are essential: 1, Some form of operating system that allows simplified user com- tonne Te —tt aron 4700 (rare srarey cock a6 canny ia 1oms TO INTERRUPT ry PROCESSOR CLEAR ({eceer reser Cc a cena néett D FLIP-FLOP bv comme Figure 3; Simple hardware interrupt timer set for 10 ms intervals. September 1979 © BYTE Publications Inc 23 TIMER RESET BY SOFTWARE TIMER RESET BY SOFTWARE TIMER RESET BY SOFTWARE TIMER TIMER 10. TIMER TIMER 10 10 INTERRUPT INTERRUPT INTERRUPT INTERRUPT INTERRUPT INTERRUPT INTERRUPT CALL CALL CALL TIMER TIMER NOT RESET NOT RESET fo) | programa | PROGRAM 8 procram 4 | @ | procram 4 | procram a | a | pRocRAM a | PROGRAM A ) 10 10 TIMER TIMER INTERRUPT TIMER INTERRUPT TIMER 10 INTERRUPT INTERRUPT CALL INTERRUPT CALL INTERRUPT INTERRUPT TIMER TIMER CALL INTERRUPT INTERRUPT TIME Figure 4: Interrupt timing example of figure 1 reviewed with the addition of a hardware timer. The timer may be used in 2 ways: The example in figure 4a resets the timer on each interrupt call. This allows each program to receive its full 10 ms time slot. The example in figure 4b does not reset the timer. Therefore, a hardware interrupt occurs every 10 ms. munications (ie: BASIC, DOS, CPM). 2. Convenient mass (cassette or disk), 3. Sufficient memory to handle all programs. storage I/O Another consideration might be the internal architecture of the processor, but that is another level of problem. Figure 5 shows the memory layout of a typical multiprogramming system. To maintain a simple system, I have combined the operating system with the timesharing routines that support al] terminals (video displays, keyboards and teletypewriters). This means that each time the operating system gains control (through an interrupt call or timer interrupt), it will complete its own activity and then transfer control to the time- sharing program for the remainder of the time slot. If the operating system is given highest priority, the response times of the terminals should not suf- fer. The operation of the timeshare program can be treated as a multi- BOOTSTRAP INTERRUPT LOADER ROUTINE tiie ALL 1/0 SHARING ROUTINES SUPPORT PROGRAM OPERATING STEM SYSTEM (0) STACK O STACK I USER PROGRAM | STACK 2 USER PROGRAM 2 Figure 5: System geography of a typical multiprogramming system with space for the operating system and 2 other programs. 24 September 1979 © BYTE Publications Inc program system in miniature, where each terminal is given a time slot, or it may be designed to simply scan the terminals, choosing a new terminal each time it is given control, Controlling 1/O Many programmers have dis- covered the convenience of vectoring all 1/O through 1 subroutine; this simplifies programming greatly and makes system changes much easier. Typically, 1 subroutine will accept an operand (if necessary) and an operator function code passed from the main program and will decide which I/O function to perform. In my hypothetical computer, this ap- proach will be used. Note that in some large computer systems, the I/O driver programs can only be ac- cessed by executing a special kind of interrupt call that informs the operating system that the user's pro- gram desires to perform some kind of input or output operation. The oper- ating system then takes charge, per- forms the 1/O for the program in question, and returns pointers telling where the input data was stored in memory or that the requested output function has been completed. This type of I/O handling is neces- sary because the I/O controllers are extremely complex and are capable of performing an entire 1/O operation Circle 9 on inquiry card.—> In California, a store owner charts sales on his Apple Computer. On weekends though, he totes Apple home to help plan family finances with his wife. And for the kids to explore the new world of personal computers. Computer Club, to challenge other members g, to computer games of skill and to cA trade programs. oO Innovative folks everywhere have discovered that the era of the personal computer has already begun—with Apple. Educators and students use Apple in the classroom. Businessmen trust Apple with the books. Parents are making Apple the newest family pastime. And kids of all ages are learning how much fun computers can be. Visit your local computer store The excitement starts in your local computer store. It’s How to buy ersonal compute A hobbyist in Michigan starts a local Apple a friendly place, owned by one of your neighbors. He'll show you exactly what you can use a personal computer for. What to look for Your neighborhood computer store has several different brands to show you. Chances are the salesman will recommend an Apple Computer. Apple's the one you can program yourself. So there’s no limit to the things you can do. The more you use your Apple the more uses you'll discover. So it’s important that Apple is the computer with more expansion capability. You can’t outgrow Apple. It’s your move Grab a piece of the future for yourself —we'll give you the address of the Apple dealer nearest you when you call our toll-free number. Then drop by and sink your teeth into an Apple. (800) 538-9696. In California, (800) 662-9238. without processor intervention. In fact, it would be very inefficient to make the processor of a large system perform these menial tasks when it could be working on more important programs. In microcomputer systems we are not normally concerned with the optimization of I/O functions and it does not really hurt performance to have the processor perform most of the I/O. Consequently, the 1/0 driver routines in the system | am describing will not be considered as part of the operating system. They are just utility subroutines that may be called by the user’s program. Defining the Necessary Tables With only 2 programs very few, if any tables are needed to tell the inter- rupt routine which program was ac- tive at the instant the system was in- terrupted and which program is next in line. But imagine a system capable of supporting 10 or more programs: some form of priority scheduling will be needed, as well as a table to hold all of the stack pointers of the inactive programs. To handle the list of programs (herein referred to as tasks), we must define a task contro! table that keeps track of a number of pointers and descriptors. First, each entry will begin with the task number that uni- quely defines each task, Next, we will include the priority of the task on an arbitrary scale of 0 to 10, It will then get the processor before a task of lower priority (10 is highest). If 2 tasks have the same priority, the first one in line in the task control table will get control, The task control table must also keep track of the last value of the stack of each task and whether or not the task may be inter- rupted (in the case of critical timing loops). Another important status byte that must be kept is the current activity indicator. This byte contains the task number of the currently active task. Now let us assume that we have 3 dif- ferent tasks running and all have been initialized (stored in the task control table). The first task has a task number of 0 and a priority of 10. Generally the operating system is 8P2SM PARALLEL/SERIAL I/O BOARD WITH MODEM {UU ijith PARALLEL PORTS: | Peats ted total fn sirex tana bits SERIAL PORTS: J Serul Forts with associated: control tina r sae eee oe TE oe R824! Please rush the following TE on MODI Pwo card tate AVAILABLE BAUD . J Co Card (assembled) As crs Irma awe 1b Adataue 120 baud A he ne Haat aul gp sen a 100 haul we 150) aud ny HW haul 0a Goa 5 haw = 400 fennel 24 baud CA residents add 6% or ay wee supplied baud rates up te 500 kdebauel e R Taal Dupes anemer Oy ceneinate, 100 Baul . . carats ' " * MicroDaSys Cae os a P.O, Box 36051 Paice? $1009 tassembled ond testes Los Angeles, CA 90036 26 September 1979 + BYTE Publications Inc (213) 935-4555 Circle 220 on inquiry cara. given the task number 0 designation. Since the operating system and timeshare program (user terminals) are considered one big program in this example, task 0 is also the designation of the timeshare system. Task 1 is a program that one of the users submitted (initiated) from a ter- minal; it has a priority of 10. Task 2 was also loaded and initiated by a user through the timeshare terminals, and it has a priority of 10. Imagine that the timeshare pro- gram calls the 1/O driver program to write a character out to a terminal. Since there could be many terminals connected to the system, how does the program know which one to write to? It would be very inefficient to have different routines for each device, but the only way that a pro- gram could tell the I/O driver which specific display to write to is for the calling program to know the physical address of that terminal. Passing the actual address of the device ruins the neatness of the I/O routine, though. It is more convenient to specify the function to be performed (1 = write to video display; 2 = read keyboard; 3 = write to cassette; 4 = read cassette), The solution is to have another en- try in the task control table called a communications control block pointer that points to the location of the communications control block for the particular task. Since each task is given its own block, the user may define his or her own functions and addresses. Thus each program may have its own video display, key- board, cassette interface and disk. The communications control block contains a list of function numbers, the address of the I/O port or memory mapped port, and the ad- dress of the 1/O subroutine that will perform the operation. Figure 6 shows the arrangement of all tables. Starting and Stopping To initialize a new task, the user adds entries to the appropriate tables through a console command and causes a dummy stack and stack pointer to be created. To stop a task, the last thing done in the task is to call a subroutine that would remove its task control table entry. This is equivalent to a CALL EXIT in FOR- TRAN found on many larger systems. North Star Announces — Double Density x 2 Sides = Quad Capacity! The North Star Horizon now delivers que fecording on our new min! drives! That drive North Star system accesses o' Think of the application flexibility that so much info give youl North Star has quadrupled the disk capacity of the Horizon computer but prices have Increased a modest 15 perce! Nn a dollar per that’s a bargain that Is hard to beat! The proven North Star disk controller was originally accommodate the two-sided drives, North Star C upgraded fo handle th IIttle or no change. Of c w Capi ourse, single ity. ¥ sided di: new disk system B5 on Inquiry card North Star Horizon Computer Prices (includes 32K RAM, one parallel and two serial 1/0 ports), assembled, burned-in and tested. Horlzon-1-32K-Q $2565 Horizon-2-32K-Q $3215 Horizon-1-32K-D $2315 Horlzon-2-32K-D $2765 Get both sides now! Quad capacity Is avaliable from your North Star dealer. NorthStar” North Star Computers 1440 Fourth Street CA 94710 50 TWX/Telex 910-366-7001 CURRENT ACTIVITY INDICATOR ACTIVE TASK NUMBER TASK CONTROL TABLE comi CONTROL BLO STACK TASK e | PRIORITY | CONTER INTERRUPT STATUS UNICATIONS. (ONE FOR EACH TASK ck CONTROL TABLE ENTRY) COMMUNICATIONS CONTROL BLOCK POINTER ee 170 FUNCTION cOOE 170 ROUTINE ADDRESS TO HANDLE THIS FUNCTION 1/0 PORT OR MEMORY MAPPED ADDRESS: ASSIGNED TO TASK # n le— Eno OF TABLE MARKER (HEXADECIMAL FF) com CON. BLOCK h+—— END OF TABLE MARKER (HEXADECIMAL FF) MUNICATIONS TROL, Lr ———____] BLOCK COMMUNICATIONS CONTROL Le Figure 6; Control table organization. The current activity indicator contains the task number of the active task. The task control table contains the task number, task priority, last value of stack pointer, interrupt status flag (1 for yes, 0 for no interrupts), and the pointer to the task’s communications control block. The communications control block contains the I/O (input/output) function code, address of I/O driver routine associated with the function code, and the 1/O port or memory mapped address assigned to the task for the particular function. One entry is provided for each function code used in the task. The owner of the task may add entries to the communications control block for specialized 1/O driver requirements. Example The easiest way to show how all tables and pointers affect each other and the system is to observe them during a short period of machine ac- tivity. As we begin, task O (the operating system and timeshare routines) has control, and a timer interrupt is occurring. There are 2 other tasks in memory: task 1 has priority 5 and task 2 has priority 4. First, as the interrupt routine is entered it saves all registers and flags of task 0 on stack 0 and saves the task 0 stack pointer in the task 0 task con- trol table entry (see figure 7). Next, it scans the task control table for the task of next highest priority, moves the new task number (task 1) to the 28 September 1979 © BYTE Publications Inc current activity indicator, moves the task 1 stack pointer from the task control table to the processor's stack pointer, pops all of task 1's registers and flags off of stack 1, and executes a return, which has the effect of pop- ping the program counter and jump- ing to that address. Task 1, while executing, en- counters a call to the 1/O driver routine with a request for a keyboard input (see figure 8). When the [/O driver routine is entered, it scans the task control table to find the com- munication control block pointer entry for task 1 (the routine deter- mines which task called it by looking at the current activity indicator), then scans the communication control block for the function number entry corresponding to the one passed by the main program. Even though the computer may have 5 or more key- boards attached to it, the port address found in the communication control block gives it the address of the keyboard assigned to task 1. Since the keyboard read routine is a common one, the address referred to in the communication control block points to a subroutine located within the operating system area. Note that if the user had need for some special I/O subroutine, he could locate it in his own memory area and put the address in his com- munication control block as another function code. Returning to the example, the keyboard read subroutine is called from the I/O driver, reads the keyboard port assigned to task 1, and retums to the I/O driver with the ASCII code. The I/O driver returns to the main program with the ASCII code in a register or memory loca- tion, In figure 9 the next timer inter- rupt has occurred, so control returns to the interrupt handler routine. Again, the interrupt routine saves all registers and flags of task 1 on stack 1, looks at the current activity in- dicator to see which program was last active, saves the stack pointer in the task 1 task control table entry, scans the task control table for the next highest priority task, and finds that task 2 should get control. The stack pointer for task 2 is loaded from the task control table, all registers and flags are popped off of stack 2 and again a return is executed that causes task 2 to take control. In the next step (shown in figure 10), task 2 has encountered the equivalent of a CALL EXIT or STOP command and has finished process- ing. This CALL EXIT calls a ter- minator routine which again finds out who called it (via the current activity indicator) and simply eradicates the task control table entry for that task. To keep things neat, all succeeding table entries are moved up 1 notch. Then, control is returned to the inter- rupt handler, which will find the next task in line, In this case, since no other tasks of lower priority are waiting, control is returned to the highest priority task 0. Error Handling On a single program system, error handling is something that the user can watch for manually. When several programs are running, the system must have routines to handle errors rapidly so that other programs will not be slowed down or destroyed. There are many common errors that are relatively easy to deal with. Executing an invalid op code or forgetting to put in the 2nd or 3rd byte of a multibyte op code can be handled through a simple system restart (through the interrupt handler routine) without losing continuity. But what about a program loop that accidentally destroys part or all of another user's program? On an [BM 360, all memory blocks assigned to a + THANSFER OF CONTROL + AIA OR PONTERS rasK CONTROL COMMUN ICAT) coats COMMUNICATIONS ’ CONTROL BLOCK O , T BOOTSTRAP WT ERRUPT LOSDER Task 0 4 ‘OADE Tae ane ROUTINE CURRENT Me ACTIVITY He impicator it i STACK O USER PROGRAM TASK 1 COMMUNICATIONS CONTROL BLOCK ¢ se] STACK A Figure 7: Task 0 has control of the processor and has just been interrupted, The inter- rupt routine looks at all pointers, saves the status, and then transfers control to task 1. task are given a unique 4-bit protect key (which is the same as the task number) that is stored in external hardware. One approach might involve having 2 external 16-bit registers that could be loaded by the interrupt routine with the high and low memory addresses of the active task. = TRANSFER OF CONTROL = + DATA OR POINTERS Then, every time the address bus has a valid address on it, it is tested against these registers. However, special precautions would have to be taken in those cases in which a utility in low memory (I/O driver routine etc) is called, or when memory map- ped I/O ports outside these address limits are used. ar sevBORRD BOOTSTRAP LOADER CURRENT ACTIVITY INDICATOR TASK CONTROL TABLE COMMUNICATIONS CONTROL BLOCK O 11/0 DRIVER ‘ Protas ) STACK 0 TASK | COMMUNICATIONS CONTROL BLOCK 1 stack 1 Figure 8: Task 1 has requested keyboard input from its assigned keyboard. When the input is completed, the 1/O (input/output) driver returns control to task 1. September 1979 © BYTE Publications Inc 29 «TRANSFER OF CONTROL + DATA OR POINTERS rasey 4 3 BOOTSTRAP = INTERRUPT Coaoen cee b fouriee Li a" gir Fit CURRENT en? henivity. aoe moraron | 7 = ¥ ‘of a — font no 4 bs COMMUNICATIONS TABLE CONTROL BLOCK O BTAEE’O 7 T | COMMUNICATIONS CONTROL BLOCK ) task 2 COMMUNICATIONS. CONTROL BLOCK 2 sq stack 2 Figure 9: Task 1 has been interrupted and turns control over to the interrupt routine. Control is then passed to task 2. | TRANSFER OF CONTROL —— — — «pera on poimreas BOOTSTRAP LOADER CURRENT ACTIVITY INDICATOR he COMMUNICATIONS CONTROL BLOCK Task CONTROL TABLE TERMINATOR STACK 0 TASK 1 COMMUNICATIONS CONTROL BLOCK stace + TASK 2 [4 COMMUNICATIONS CONTROL BLOCK 2 stack 2 be ne es cl 30 September 1979 © BYTE Publications Inc Resolving Allocation Conflicts Allocating 1/O devices has been a problem since the early days of com- puters. Devices like tape drives and card readers (sequential devices) are nonshareable: only 1 program may use them at a time. However, disk drives are considered shareable, since the head may be positioned at ran- dom to gather data. The simplest method that can be applied to the system described in this article would be to have the initiator program check all communication control blocks to make sure that certain devices are not assigned more than once. I/O Software Considerations As mentioned earlier, 1/O techni- ques in use on small systems leave all control up to the processor. If special timing is needed or if strobes or ready flags have to be checked, software is used instead of extra hardware, as in the case of larger systems. This in itself is good from the standpoint of economy, but requires that special care be taken when writing the driver and controller software. For example, suppose a cassette read routine uses a universal asyn- chronous receiver transmitter (UART) implemented in software as an algorithm instead of hardware. In a nonmultitasking system, the pro- gram may simply loop and time down between bits, but in a multitask system the timer interrupt would surely halt the activity and execute other programs. It may be well over 30 ms before it can return to the cassette read routine. It is easy to see what can happen to critical timing loops on a system that uses any kind of interrupts. The solution? If you must do the critical timing in software, it is necessary to turn off the interrupt timer while in the critical loop and reactivate it when in noncritical parts of the routine. If external hardware is used, and internal timing is reduced Figure 10, Task 2 has completed its execu- tion and encounters a CALL EXIT. Con- trol is given to the terminator routine which performs some cleanup operations and removes the task 2 entry from the task control table, effectively destroying the task, Control is then given to the inter- rupt routine which again scans the task control table to find the next task awaiting execution, Circle 255 on inquiry card.» DOUBLE DENSITY SOLID SAVINGS! Now you can put your S-100 system solidly into a full-size, single/double density, 600K bytes/side disk memory for just $1149 complete. DISCUS/2D™ single/double density disk memory from Thinker Toys™ is fully equipped, fully assembled, and fully guaranteed to perform perfectly. DISCUS/2D™ is a second generation disk memory system that’s compatible with the new IBM System 34 format. The disk drive is a full-size Shugart 800R, the standard of reliability and performance in disk drives. It’s delivered in a handsome cabinet with built-in power supply. The S-100 controller utilizes the amazing Western Digital 1791 dual-density controller chip... plus power-on jump circuitry, 1K of RAM, 1K of ROM with built-in monitor, and a hardware UART to make I/O interfacing a snap. The DISCUS/2D™ system is fully integrated with innovations by designer/inventor George Morrow. Sottware includes BASIC-V™ virtual disk BASIC, DOS, and DISK-ATE™ assembler/editor, Patches for GP/M* are also included. CP/M‘ MicroSoft Disk BASIC and FORTRAN are also available at extra cost. DISCUS/2D" is the really solid single/double density disk system you've been waiting for. We can deliver it now for just $1149. And for just $795 apiece, you can add up to 3 additional Shugart drives to your system. Both the hardware and software are ready when vou are. Ask your local computer store to order the DISCUS/2D™ for you. Or, if unavailable locally, write Thinker Toys,™ 5221 Central Ave., Richmond, CA 94804. Or call (415) 524-2101 weekdays, 10-5 Pacific Time. (FOB Berkeley. Cal. res. add tax.) *CPIM Is a trademark of Digital Research. moet makes disk memory for Thinker Toys to noncritical loops, the intervention of the multitask interrupt timer will not normally affect the system. If the interrupt timer causes an interrupt just before a byte is received by the UART but returns in time for the next byte to be received, the easiest way to assure that the cassette read routine does not drop a byte is to set the timing of the interrupt oscillator to at least twice as fast as the transmission rate of the UART. This greatly reduces chances of losing a byte. An alternate approach is to have even more hardware that forces the interrupt timer to timeout and return control to the program awaiting the data transfer operation when the in- coming data is present. A third way involves the use of direct memory ac- cess (DMA) capability, in which the external controller reads the UART and deposits the data directly into memory. With this approach, the calling program need only initialize the external registers and go into a wait state until the transfer is com- plete, allowing the rest of the tasks to execute normally. This last approach is used on many large systems and constitutes what is called a channel. Managing the System As you can see, many levels of ac- tivity are required to control a multiprogramming system properly. It is also apparent that some minimal hardware is required to prevent one user from obtaining exclusive control of the processor or writing over someone else's program or data. The use of control tables and a standard interrupt routine are also important as a way of letting the interrupt routines and I/O drivers know which task had contro! of the processor last. If the user plans to run BASIC soft- ware or some other kind of language interpreter, the safety features discussed earlier may be implemented as part of the interpreter. To run a lower-level operating system that allows the user ta generate assembler level code will generally require the hardware described in this article, thus safeguarding the system and its users from accidental loss of pro- grams or data. In general, the use of timed interrupts allows for a fairly even distribution of processor activity, and depending on the cycle time of the host system, between 4 and 12 tasks may be handled without too noticeable a delay in response time. @ REFERENCES Abrams, Marshall D, and Stein, Philo G. Computer Hardware and Software, Addison: Wesley, Reading MA. 1973. Davis. William S. Operating Systems, Addison-Wesley, Reading, MA. 1977. Martin, Donald P, Microcomputer Design, Martin Research Ltd, Northbrook IL, 1976. Signetics Data Manual, Signetics Corpora- tion, Sunnyvale CA, 1976. Struble, George W Assembler Language Programming: The IBM System 360 370, se- cond edition, Addison-Wesley. Reading MA. 1975. Tanenbaum, Andrew S, Structured Con- puter Organization, Prentice-Hall, Englewood Clilfs NJ, 1976. Fourth nniversary Sale from the Originator of the TRS-80* Project FMG Corporation was formed in 1975 as a software consulting company. For the past 4 years FMG has been developing and in- troducing new programs de- signed to increase the versatility of the TRS-80. Last year we intro- duced the CP’M system, this year we offer the UCSD Pascal system. PASCAL UCSD Pascal, the powerful general purpose language system, de- veloped for large and complex systems. 1s now avaiable for your TRS-80, The FMG UCSD Pascai sysiem ‘opens a new generation of value for your TRS-80. Package includes ‘Operating System Screen Eaitor 280 Macro Assembler Linrary Pascal Compiler Unites and System Reference Book Price $150.00 (Requires 48k System with 2 drives } Available without Macro Assembler, Linkes and Library Price $100.00 FORTRAN Now On Sale! Comparable to compilers on large maintrames and minicomputers. All ‘of ANSI standard FORTRAN x3 9- 1966 1s included excep! COMPLEX dala type Therefore. users may take advantage of the many applica: tions programs already writen 1 FORTRAN Package includes FORTRAN Compiler Macro Assembler (280) Linker Library Lib Manager (Not im TAS-DOS version.) Price $350.00 For this month only Sale priced at 250.00 Manual $25.00 (Specily TRS-OOS or TAS-CP M versions } SID Symbolic Instruction Debugger Symbolic memory reference with built-in assembler disassemblet SID Diskette and Manual Price $125.00 For this Month Only Sale Priced at $75 00 32 September 1979 - BYTE Publications Inc Ni CP/M Operating W System New 1.46 Version Includes AS-232 and 10 Byte im- plementation, Editor, Assembler Debugger and Uulties or 8080 and 280 Systems. For up 10 four TRS:80 floppy disks Package includes: CP M System Diskette 5" CP M Features and Facilities Manual CP M Editor s Manual CP M Assembler Manual CP td Debugger Manual CP M Intertace Guide Pnce $150.00 (Requires 16k and one drive minimum } (Set ol 5 Manuals $25.00) Updates for 1 4 versions owners $15.00 MAC Macro Assembler Compatible with new Intel Macro standard Complete Guide to Macro applicahons MAC Diskette and Manual Price $150 00 For this Month Only Sale Priced at $99.00 TEXTWRITER II A text formatting program that prints ties created by an editing program Contracts. personalized form letters and other documents can be printed from a stored library of standard paragraphs Price $130 00 For This Month Only Sale Priced al $75.00 Manual 325 00 trs-00 NE COMMUNICATOR S232 Communication Program allows the TRS-80 to transmit or re- ceive programs of data tiles Also makes the TRS-80 into a remote ter- minal, Requires Radio Shack RS232 and CPM E = Call or Write for Complete information SLIME A Division of Applied Data Corp P.O. Box 16020,89 Fort Worth, ‘Texas 76133 « (817) 294-2510 $2500 Circle 134 on inquiry card. REAL ESTATE SOFTWARE Business Is Booming Over 240,000 Offices Nationwide And Still Growing! The Real Estate Market has never been so widespread, profitable and competitive! To beat competition and reduce expensive labor costs, more and more real estate offices are relying upon computers to organize and direct their business transactions. To meet this growing demand, R.S.!., Inc.™, has devel- oped the most comprehensive Real Estate Software ever that is specially designed to satisfy the needs of all Realtors ... large or small. The software is easy to use and requires no training. R.S.1., Inc.™, Real Estate Software is divided into 2 pro- grams, Property Management and Cash Flow Analysis (forthcaming). Each program comes complete with an instruction manual that features screen-by-screen displays. The Programs run on a DEC station 78 & 88 series, CP/M” operating system type 8080 or Z-80 with 48K of memory, C Basic 2 version 2.03, CRUN 2 version 2.03, 8 inch single or dual density floppy disks, a 132 character printer and CRT terminal with a 24 x 80 screen. MAIL COUPON OR CALL... TOLL—FREE (800) 227-3474 R.S.1."™'s Software systems for the Real Estate market can be profitable for you. Inquire today for full details on Real Estate Software programs. Circle 323 on inquiry card. PROPERTY MANAGEMENT SOFTWARE Comes Complete With a 200 Page Instruction Manual...With 80 Screen-by-Screen Displays for Easy Reference! Program includes: * Operating Statement Report * Balance Sheet Report * Rent Book Report * Management Fees Report * Vacancy Report * Late Rent Report * Check Writing / Check Register * Deposit Register & much more... Mail to: ! Check enclosed Bill my Send me your PROPERTY MANAGEMENT software complete with 200 pg. manual for $595.00 (shipping & in- surance included / CA residents add sales tax) Master Charge VISA Acct. # Exp.date___—— Signature Name Address. City State. Zip. Telephone _____finciude area code} DEALERS!... Check here Cand attach business card to coupon for complete details on all &.S.1.™ Software and merchandising support! Interface a Chessboard to Your KIM-1 Chess is a fascinating game. Com- puter chess is especially fascinating because the complex analysis which determines each move is performed by a machine instead of a human. Computer chess offers an excellent way to demonstrate the power and versatility of personal computers. Most computer chess systems are unable to “see” a chessboard. A Jeff Teeters 1720 Coolidge Ct Eau Claire WI 54701 human playing against a computer will usually set up a chessboard beside the computer, and the moves will be communicated to and from the machine through the use of a keyboard and a display in some type of abstract notation. Keyboard entry of moves is unde- sirable. It is inconvenient, error prone, and inelegant. The abstract Photo 1: Two pawns, a White Knight, and a loose rivet are shown on top of the elec- tronic chessboard. One row of 8 light emitting diodes (LEDs) is placed along the left side of the board, and another row is placed along the bottom of the board as seen by the human player. Two LEDs are lit to indicate a single square, using an X,Y axis system. A single large hole is drilled in the center of each square to accept entrance of the rivet which is glued to the bottom of each chessman. The rivet completes an electrical circuit between 2 pieces of wire that run from smaller holes through the large central hole. This switching arrangement allows the computer to detect the presence or absence of a piece at each square of the board. In this prototype, an additional set of 3 wires is seen in each square; these wires remain from an earlier, unsuccessful switching attempt. 34 September 1979 © BYTE Publications inc notation promotes errors and makes play difficult for people who do not know the notation system. Further- more, errors may not be detected un- til many intervening moves have occurred, An ideal chess-playing system would contain a digital television camera to observe the board and a mechanical arm to move the pieces. {A mechanical arm designed for exactly this application was described in the article “A Hobbyist Robot Arm,” by Keith Baxter and Timothy Daly in the February 1979 BYTE, page 84...RSS] A less costly alter- native is to construct a chessboard which can electronically com- municate with the computer. The computer may then “look” at the board position through its 1/O(in- put/output) ports. A means of in- dicating the computer's moves on the chessboard itself may also be pro- vided, In the system that I have con- structed, the user makes his move on the electronic chessboard, instead of typing each move on a keyboard, The computer's moves are displayed on the chessboard through the use of discrete light emitting diodes (LEDs), arranged in an X,Y coordinate sys- tem. The LEDs show the user exactly which chessman the computer wants to move, and to which square. In addition to being aesthetically pleasing, this system makes it im- possible to enter your move in- About the Author leff Teeters is an undergraduate student at the University of Wisconsin at River Falls where he majors in mathematics. correctly, and easy to interpret the computer's move. The board is continuously scanned so that even if the user moves the computer's piece incorrectly, the mistake is detected immediately. A speaker is connected to the computer to let unwary users know (by a buzz) when they misinter- pret a computer move. This speaker also emits a brief sound when the chess program has decided on a move and when it has been recorded into the computer's internal board representation. This project is designed for specific use with Peter Jenning’s Microchess, running on a KIM-1 with about 0.5 K bytes of extra memory. Imple- mentation on other 6502 based com- puter systems should be relatively easy since only a few minor software modifications would be needed. The required hardware consists of a chess set, a package of cheap switching diodes, 2 integrated circuits, 16 discrete LEDs and 32 copper rivets. The chessboard should have a thin, nonconductive surface that is easy to drill holes through. This surface must be supported by side panels so there is a hollow space of about 2 cm under the board for wiring. I used a cheap plywood chess set that is designed to fold into a storage box for the chessmen. The copper rivets should be small in diameter, about 12 mm long, and have a flat top. The ones that I used were size 9 rivets manufac- tured by the Tower Corporation of Madison IN. System Concepts KIM-1 Microchess uses an internal board-status table to keep track of the whereabouts of the chessmen. This table contains 32 square numbers which indicate the position of the 32 pieces. It is important to realize that Microchess generates moves solely on the basis of what is in that table, and not how it was placed there. My plan of attack was simple. I had only to wire a chessboard to the computer and write an interface program that would translate moves on the chess- board into changes in the table. Since this program will be needed only when moves are physically being made, it can be called from Microchess and used in place of the Microchess keyboard I/O (input/out- put) routines. After the user has finished moving, control can be Photo 2: The bottom of the chessboard. The switching diodes and connecting wires are soldered directly to the wire contacts in the central holes. The 2 integrated circuits are type SN74154 decoder/demultiplexers. Note the tips of rivets protruding through some of the holes. transferred back to Microchess to compute the machine's next move. The Microchess to chessboard interface program is logically straightforward. If no move is being made, the table should be an accurate representation of the board. A move is detected when the table does not correctly represent the current board position. If an empty square appears on the board where the table indicates that a chessman resides, then the user has just picked up that man. If the table shows an unoccupied square which the board indicates is occu- pied, a chessman has just been set down in that square. A move is con- stituted by the user picking up a man and setting it down in some other location. A capture is completed by picking up 2 men and setting 1 down in the space formerly occupied by the other. Because the Microchess table is updated each time a simple move or capture is made, the table always gives an accurate representation of the current board position. Hardware Details Note that the chessboard interface program can keep track of the moves that are made simply by knowing if individual squares are occupied by a piece or are empty. The circuit which Photo 3: The complete chessplaying sys- tem. The completed electronic chessboard stands in the foreground. The chessboard and the sound-effect speaker are con- nected to the KIM-1 computer residing in the suitcase in the background. provides this information to the com- puter is illustrated in figure 1. For purposes of square identification, the chessboard is conceptually cut in half. The 2 pieces are placed logically end to end, forming an arrangement September 1979 © BYTE Publications Inc 35 29450 BREAKING THE SOUND BARRIER wane September 1977 ’ THE TRAP DOOR March 1979 Byte Cover Prints -- The September '77 and March '79 covers of BYTE are now each available as a limited edition art print, personally signed and numbered by the artist, Robert Tinney. These prints are strictly limited to a quantity of 750 for each cover, and no other editions, of any size, will ever be published. Each print is 18” x 22”, printed on quality, coated stock, and signed and numbered in pencil at bottom. The price of each print is $25. This includes 1) a signed and numbered print; 2) a Certificate of Authenticity, also signed personally by the artist and witnessed, attesting to the number of the edi- tion (750), and the destruction of the printing plates; and 3) first class shipment in a heavy-duty mailing tube. . To order your limited edition art print, fill out and mail the order form below. Send me____. ‘Breaking the Sound Barrier” prints at $25 each, and _____ ‘Trap Door” prints at $25 each. | understand this price in- cludes Certificate of Authenticity and first class shipment. Ol have enclosed check or money order to Robert Tinney Graphics. O Charge this to my Master Charge or Visa Card #. Expires: Ship my print(s) to: Name. Address. City. State. Zip. Send order to: robert tinney graphics Lan P O. Box 45047 = Baton Rouge, LA 70895 -§ 36 BYTE September 1979 4) [ee Circle 369 on inquiry card. | CCS has everything to expand your Apple IT” Friendly Frankie's roadside accessories, including: prom faster, and for a lot less bucks. Apple || stand has plenty to whet modules, asynchronous and For all the mouth-watering your appetite for expansion. So, if synchronous serial interfaces, details, contact our northern you're ready to have your Apple |! arithmetic processors, program- California headquarters or your computer interface with the outside mable timers, parallel interfaces, local roadside computer store. If world, wheel around to Frankie's A/D converters, and Apple II Frankie's out, ask for Dennis or stand today. compatible boards galore. Jerry. They'll be glad to help you Expand to your heart's con- Let Frankie connect your "Apple Il is a registered tent with our full range of delicious — Apple II to the rest of the world trademark of Apple Computers, Inc supe =A ae ‘ FRIENDLY FRANKIE’ Circle 38 on inquiry card 3.3K Q 14H ° COLUMN (FROM GUTPUTS OF IC) 162 (INPUTS TO IC) SN74154 n 1 ee | eel ROW 2 pa-i > ys pa-2[ > 62 pa-3( > Pa-4a[ > COLUMN JO Figure 1: Circuit which determines whether or not a given square is occupied. The chessboard is conceptually cut in half. it is placed 50 that the squares form a4 by 16 matrix. For each square, a diode and a switch are wired in series between the appropriate row and column lines. A closed switch indicates an occupied square; an open switch indicates an empty square. of 4 rows and 16 columns. A diode matrix allows the hardware to iden- tify the individual squares. The integrated circuit in figure 1 is a type SN74154 4 to 16 line decoder/ demultiplexer. The 4 input lines to the device are connected to the KIM-1 I/O port A. Each of the 16 output lines is linked to a column in the matrix. This portion of the circuit allows the KIM-1 to select 4 squares out of the total of 64, The 4 rows of the matrix are connected to the 1/O port B. Row and column addressing allows scanning of a single square. Each square of the chessboard has a switch, A closed switch indicates that the square has a piece on it; an open switch shows that the square is empty, To determine whether or not a piece is on a particular square, the interface program first selects the column by sending the correct binary 38 — Seprember 1979 © BYTE Publications Inc code to the 4 input lines on the SN74154. This brings 1 of the 16 out- put fines low, while the diodes keep the rest high, If the switch is closed (ie: a piece is on the square), then the corresponding row-line will be pulled low and the matching port-B data register bit will be a 0, Thus,by select- ing the column through port A and testing the row bits in port B, it is possible to determine the status of every square on the board. Switch Experimentation Now for the hard part: what can be used as a switch? The actual mechani- cal operation remains the only unre- solved detail. All that is needed is some means of closing the switch whenever a piece is set down, and opening it when one is picked up. There are several ways to accomplish this—some of which are better than others. In my first attempt ] put aluminum foil on the bottom of the pieces and used simple wire contacts on top of the board. I punched 6 holes into each square using a large needle to form the corners of 2 concentric, equi- lateral triangles. Three strands of wire were looped through the holes forming 3 symmetric contacts (see figure 2a). The third contact was used only to balance the pieces. The concept is simple. The piece is set on top of the wire contacts and the aluminum foil makes the necessary connection. Unfortunately it didn't work, The contacts were not suf

Showing the first 100000 of 850386 characters.

mp.ls