Download software notes - Altair 8800 Clone
Transcript
computer notes ^ THE SEARCH C o m p u t e r N o t e s is continually seeking quality manuscripts on applications, troubleshooting, interfacing, software, book reviews, fiction, cartoons and a variety of other computer-related topics. Articles should be a m i n i m u m of 8 0 0 w o r d s and a m a x i m u m of 3 6 0 0 w o r d s long (about 15 pages typed double-space). H o n o r a r i u m s are based on an article's technical quality and its suitability for C N ' s readership. Payment will range from 50<P to $1 per typeset magazine c o l u m n inch for all text and programs. No payment will be m a d e for illustrations. All articles are subject t o editing t o fit space requirements and content needs of o u r readership. Payment for articles which are accepted will be sent upon publication. Articles submitted to C . N . should be typed, double-space, with the author's n a m e , address and t h e d a t e in t h e u p p e r left-hand c o r n e r o f each numbered page. A u t h o r s should also include a onesentence autobiographical statement about their job, professional title, previous electronic a n d / o r computer expereince under the article's title. Authors should retain a copy of each article submitted. All illustrations, diagrams, schematics and other graphic material should be submitted in black ink on s m o o t h white paper. Prints and PIVIT's are acceptable. No pencil d r a w i n g s unless properly "fixed'.' No halftone or w a s h d r a w i n g s . W h e n e v e r possible, art should be d o n e t o finished size. Complicated d r a w i n g s should be submitted oversize for reduction t o format by C . N . All artwork should be mailed flat, never folded. Unless requested, graphics are not returned. Sketches, r o u g h s and "idea" d r a w i n g s are generally not used. Photos, charts, p r o g r a m s and figures should be clearly labelled and referred t o by n u m b e r within the text of the manuscript. Only clear, glossy black and white p h o t o s (no Polaroid pictures) will be accepted. Photos should be taken with uniform lighting and s h a r p focus. Program listings should be recorded with the darkest ribbon possible on blank white paper. COA-PPLTf/? / V 0 T F 3 is published m o n t h l y by IVIITS, Inc., 2 4 5 0 A l a m o SE, Albuq u e r q u e , NIVI, 8 7 1 0 6 , ( 5 0 5 ) 2 4 3 - 7 8 2 1 . A free year's subscription is included with every p u r c h a s e of an A l t a i r ^ c o m p u t e r . R e g u l a r s u b s c r i p t i o n s can be o r d e r e d f r o m t h e IVIITS C u s t o m e r Service Dept. for $ 5 per year in the U.S. a n d $ 2 0 per year for overseas. Single copies are available for 5 0 $ each at all Altair C o m p u t e r Centers. Entire c o n t e n t s c o p y r i g h t , 1977, IVIITS, Inc. S e n d articles, q u e s t i o n s , c o m m e n t s a n d s u g g e s t i o n s t o Editor, C0/WP L W / ? /VOTES, IVIITS, Inc. ^ M ) T S , inc. 1 9 7 7 (Volume 3 , Issue 1, J u n e ) 2 4 5 0 A l a m o S . E . , A l b u q u e r q u e , N e w Mexico 8 7 1 0 6 NOTE Aitair ,s a t r a d e m a r k of Miis. inc. ALTA!R T!MESHAR!NG BASHC CHALLENGES LARGE COMPUTER SVSTEMS By Susan 8. Dixon Aitair Timesharing microcomputers dynamic package capabilities dominated that BASiC for is a unique and with powerful chahenge by l a r g e r , a fietd more costiy computers. Aitair Timesharing Aitair Timesharing BASIC and Disk BASiC are magnified versions of the powerful and efficient Aitair Extended BASiC. Each version includes increased capabilities to accommodate as many as eight different programs running simuttaneously and independentiy within the system. Typical Aitair T i m e s h a r i n g B A S I C s y s t e m . inclu< Floppy D i s k s a n d Aitair 8 8 0 0 b Turnkey mode], s u p p o r t s u p t o eight u s e r s instantaneous Keyboard Response Input and output are interrupt driven ] Aitair B-100 C R T s . Aitair air T i m e s h a r i n g B A S I C —Extensive diagnostics for program !/0 Device Support debugging. and fulty buffered to provide virtually A variety of input devices can be instantaneous keyboard response even linked to Aitair Timesharing BASiC and —Automatic line numbering. when the system supports the m a x i m u m Aitair Timesharing — Both number of users. The output flexibility permits the use of CRT's for Sharing high-speed oriented text editor with tine and buffers empty more quickly than they are fitted, data Disk BASIC. This manipulations and so it will appear the CPU is dedicated to T e i e t y p e s ^ and hard each individual termina!. when hardcopy output is required. High Speed Systematic J o b Rotation Aitair copy Timesharing Disk BASIC facilitates the listing of programs on a round-robin system, the CPU suspends line printer. Programs await listing in a operation queue to prevent mixing different jobs. of a job c u r r e n t l y being executed, stores the address of the next Users receive a message instruction and moves to the next job. printer is unavailable. Each job is served a hundred milii- second stice of its program. as a Fixed Aitair Partition provides Time line- manipulation capabilities. Educationa) Appiications A single Aitair 8800b loaded with either version of Timesharing BASIC can be utilized by s e v e r a ! students performing independent operations. One Storage and another makes use of Timesharing BASiC's extensive diagnostics to debug a Timesharing rapid furnish student practices program development, Program Loading Capabiiities Partitioned Memory Locations Established Versatite if the line BASiC character terminals Operating within a highty efficient versions of A i t a i r loading Disk BASiC and program program white several other students calculate complicated equations. AH System, each job is confined to a unique retrieval since all programs reside on a program activity occurs simultaneously area of memory. Users may then access floppy disk. Read and modify passwords with no discernable response delay. only their individual jobs, not the system may be specified for program fixes to or other jobs. This protects jobs from limit access by other users. alteration or destruction. The size of the Aitair Timesharing BASIC can be memory area must be established with a loaded minimum cassette. Programs m a y be stored for o^ 1024 b y t e s during from paper tape initialization. Memory areas m a y be of later use on paper tape. different sizes, depending on need. Each Other Features program area contains: —BASiC program text —Variabte and string space —Work space —Approximately 300 bytes of the timesharing system C/N June. 1 9 7 7 or a u d i o —Control of a specific job m a y be Computer-oriented education need not be limited to programming classes. An Aitair Timesharing System is a valuabie visual tool in science, math and engineering classes and as an introduction to the various aspects of computer technology to solve real world problems. transferred from one terminal to another with a single command. An —Various control characters allow stimulates suspension and resumption of each job without ioss of data. Aitair Timesharing interest System a n d provides a vehicle for discussion for the younger CONTINUED ONE N e w ^ F e a t M ^ a S a ^ s a o n A U T Those of you who have been asking for a Turnkey version of the Aitair 3800b O - S T A R T By Dar Scott machine tooi or some other dedicated again. The indicators show that an t/O application. operation is in progress, a HALT state computer m a y now stand up and cheer, The seriai input/output channel is has been entered, interrupts are enabied because the Turnkey version of " t h e essentially half of a 2StO board. With the or an interrupt is in progress. The tights mainframe of the 70's" is now available. The Turnkey version incorporates alt addition channel of a jumper interface selection, is compatible and the with switches the good quality construction and good TTY, RS-232 or TTL signals. This means operation. looks of the Aitair 8800b computer. But that the Turnkey version can operate CPU Board just because the Turnkey doesn't have a with front panel or a front panei interface arrangement board equipment doesn't mean it's merely a almost any terminai with no or i/O interface necessary. The i / O provide the ports The CPU board is the standard Aitair 8800b CPU board. It consists of five major functional blocks: stripped-down version of the Aitair 8800b associated with the seria) input/output computer, it has some unique features, channel can be assigned to any 128 i / O " inciuding port pairs by switch selection. — 8212 Status Latch the new T u r n k e y Moduie minimum facilities to monitor and control system — 8080A CPU Chip 8224 Ciock Generator Chip board. With this board at) the functiona) The I K R A M and the IK P R O M can units of the computer — the CPU, R A M each be assigned to any IK block within and P R O M memory sense switches and the ful) Aitair 8800b address space by The CPU board is, in most respects, serial i / O — can be contained on just two switch selection. The P R O M used Is the identical to t h e 8800b C P U 1702A-a256-byte by 8-bit PROM.* A disk described in a previous Computer Note* bootstrap articie (see p. 1, 4-5 in J u i y circuit boards, which are supplied in the standard Turnkey version package. But the most important advantage of loader PROM, a general — Drivers and Receivers " Power-On-Ctear Circuit board C/N). purpose mutti-bootloader P R O M and a However, the Power-On-Ciear Circuit is the Turnkey Moduie is that it contains small monitor P R O M are aiso available especiaHy i m p o r t a n t in the Turnkey AUTO-START, from MiTS for use with the Turnkey version because it generates a puise to version. reset the system. The circuit is designed which ailows the computer to begin executing a program in P R O M as soon as the power is turned on or the START is actuated. The switches on the Turnkey version front pane) are the P O W E R The Turnkey Module includes the switch, so t h a t even generate a short retiable power outages Power-On-Ciear which has a key lock for system security; puise. The Turnkey Moduie uses this START, which Initializes the CPU and puise to reset the C P U — AUTO-START initiates P R E S E T low. The CPU board extends — IK bytes each of R A M and P R O M and RUN/STOP, which allows execution this of a program to be stopped and started starting before the Power-On-f*tear puise following functional parts: memory the AUTO-START sequence; by putting putse to prevent the CPU from " " Serial t/O Channel — Control for the front panel Required Hardware A L F A M — Miscellaneous control and T i M E S H A F M N G housekeeping logic The AUTO-START feature is the key START switch is actuated, the computer is forced instruction to begin at the executing memory the iocation specified by switches on the Turnkey Module. This means that when the power goes on, the computer can be m a d e to start a loader program or a automatically without monitor keying in a bootstrap loader from the front panel. Alternately, the computer can be m a d e to start a custom applications program at start-up. This should appeal to users who want to build the computing power of an Aitair 8800b into a lab instrument, CONTINUED student. Chiidren versions of Aitair find it —Aitair 8800 series m a i n f r a m e and particutarly CPU fascinating to use a computer to soive —A m i n i m u m of 32K R A M arithemetic problems. —Vector )nterrupt/Rea) Time Ctock Scientific and Engineering Uses board Engineering firms and scientific labs currently using —Up to 4 2SI0 boards to interface programmable terminals (no other types of t/0 calcuiators will benefit from the muiti- boards can be supported). purpose capabilities of a microcomputer —Line printer (optionat for Attair for complex math routines and statisticai Timesharing Disk BAStC). manipulation. An Aitair 8800B operating with Timesharing BAStC provides a The following products are optionat for Attair Timesharing BASIC toading number of individuals with access to and graphic or tabular output in addition to Disk BASiC. the following mathematics) functions: SIN, COS, TAN, LOG, SQR, SGN, ABS, INT and R N D . FOURTEEN both Timesharing BASiC. to the Turnkey version's ease of use. When the power is turned on or when the The foilowing hardware is needed to support B A S ! C required for Aitair Timesharing —An A)tair ftoppy disk drive and controiler. —88-PROM board. C/N June. 1 9 7 7 NEW ALTAtR M!N!D!SK STORES OVER 71K By Thomas Durston is completely removed from all i / O and memory boards. The mother board for the Turnkey version of the Aitair 8800b computer has 18 usable slots. Power Suppty The power supply for the Turnkey version is the s a m e as that for the standard power Aitair 8800b computer. This supply furnishes voltages the following at the indicated currents: 8 volts at 18 amps + 18 volts at 2 amps -18 volts at 2 amps full load The miniaturization of mass storage is just one of the exciting features of the Drive through two Minidisk Controller Cards that plug into the Aitair new Aitair Minidisk System. Designed to Bus. All control, status and data 1/0 work with the Aitair 8800b, the Minidisk signals are handled through three 1/0 has a storage capacity of over 71K bytes ports per diskette with an access time of iess Controller. To insure m a x i m u m life of dedicated to t h e Minidisk the drive motor, a timer in the Controller than three seconds. Aitair Minidisk BASiC, resides in the lower 20K of memory and provides the turns the system off if the Minidisk is not accessed for five seconds. disk utilization routines. Aitair Minidisk The Minidisk Drive Case contains a BASiC includes the standard functions of disk drive, power supply, line buffers and BASIC, addressing circuitry. The Drive address plus maintenance many extra procedures file that is switch selectable. The selected programming address is displayed on the front panel The software driver for the for easy identification. Write protect is significantly power. increase Minidisk Read/Write functions is based on the hard sectoring format, which simplifies system configuration. The Aitair 8800b interacts with the Aitair s y s t e m f e a t u r i n g 8 S O O b Turnkey M o d e l , d u a l Aitair M i n i d i s k s . LSI A D M - 3 C R T a n d Q 7 0 Line Printer. C / N J u n e . 1 9 7 7 ONE Minidisk also a standard feature on the drive. Check with MITS or your local dealer for prices and availability. CONTtNUED NEW ALTA)R <VH<N<D<SK STORES OVER 71K A D D H A R D COPV CAPAB!LmES CONTtNUED 88-MDS Attair Minidisk Controtter Description includes Controller Boards and Cables. Can controt Drives. Similar operation Bits per interconnect second 1 to 4 M i n i d i s k in c i r c u i t r y a n d to the Aitair Controller. 2. Data Transfer Rate: 125,000 a s e t of 2 Ftoppy Disk First drive is included in 3. Access Time a) Disk Enable to R E A D or W R i T E (Function of motor start-up t i m e ) : MDS. Additional Drives are available as 88-MDDR'S. lsec (min) b) Track to track: 50 ms c) Average Access Time Specifications (including motor Number of slots start-up t i m e ) : 1.85 sec 3) Worst Case Access required in 8800 bus: 2 Time: 2.9 sec e) Worst Case Latency: Number of ICs: Functiona! Specifications TTL Logic: 57 CMOS: 1 Voltage Regulators: 2 1. R o t a t i o n a l Speed: 300 r p m (200 ms/Rev.) 2. Track Density : 48 tracks per inch interconnect 3. Number of Tracks: 35 Wiring: Insulation displacement cables 4. Number of Sectors: 16 and connectors 5. Time Per Sector: 12.5 ms i/0 Addresses Software: (Octai): 010, 011, 012 BAStC Attair Software Data Transfer Format: Hard Minidisk Extended on a W r i t e Protected Minidiskette is virtually identical to Rate: 1 byte every 64 us Data 200 ms Sectored (16 Aitair Disk BASIC in operation a n d features. The manual includes Bootstrap sectors) interrupt Listing and R E A D / W R t T E Drive Code. System: Interrupt at beginning of sector Be sure to specify the cassette tape or (Optional - not used for Aitair Minidisk BASIC) paper tape for Bootstrap Power Programmed Requirements: 1.4A @ 8V each): 88-MDDR Aitair Minidisk Drive 1. M D B L Description power Disk drive in case with supply, Buffer and Address Loader, if required. PROMS PROM. Avaitabte ($45 Minidisk Bootstrap Loader on p r o g r a m m a b l e read only memory iC to be used with 88-PMC eiectronics. inciudes Interconnect Cable P R O M Memory Card at highest 256- and one biank Minidiskette. byte block address. 2. D R W T P R O M . Floppy and Minidisk READ/WRITE Specifications 1. D a t a Capacity Format — Hard ' .; ! Sectored . . a) Per Minidiskette: 71,680 Data Bytes b) Per Track: fundamental Test P R O M has the diagnostic tests for checking hardware operation. To be used with the 88-PMC at 3rd highest 256-byte block address. 2,048 Data Bytes c) Per Sector: 128 Data Bytes FOURTEEN C/N June. 1 9 7 7 TO VO^R SVSTEM peripherai calcuiates the most rapid way to print products-the C700 high-speed printer and each tine so that unnecessary carriage the Q70 printer-to interface with returns are eliminated. MiTS returns a n d reducing wear. introduces two new the Aitair 8800 series microcomputers. The Q70 operates with The Aitair C700 is a high-speed seriai 'daisy character printer which prints up to 60 lower case characters. The wheei spins characters per second. The printhead is for character iocation, and a h a m m e r a 5X7 dot matrix which prints the 64 then forces the wheel against the ribbon, character subset of the ASCii font. paper and platen. The Aitair Q70 is an upper and tower Both the C700 and Q70 provide other case/etectric typewriter-quaiity printer superior features for easy operation with speciaiiy designed and modified to minimal maintenance. Each printer is interface with the Aitair 8800 series, it furnished prints case accommodate forms up to 15 inches in characters and symbols at 45 characters width. An electronic Top of Form in the per second. Q70 provides rapid positioning of each The 96 u p p e r Q70 is and ideai lower for business with also included. any other application and/or which requires form tractors to sheet. A manual Top of Form switch is systems, word processing systems or wheei With the Q70, ribbon replacement is not messy The an high quality printout for letters, iabeis, exasperating, documents, etc. wheel is easy to replace, and the ribbon is Each printer operates in a highiy efficient yet unique manner. The C700 C/N June. 1 3 7 7 a wheei' system to rapidly print upper and task. print conveniently enclosed in a cartridge. CONTINUED FIVE /yew MMTS OFFERS TWO CRTs By Bennett tnkeles MITS now offers the LSI ADM-3 and the Aitair B-100 C R T t e r m i n a i s for reliable communication in any Aitair computer system. Such user benefits as fast, quiet operation and fewer mechanicai probtems are just some of the reasons to consider CRT implementation. Both terminals display 24 lines of 80 characters on a non-glare screen and interface at RS-232 and 20 m A current loop levels. standard switch A D D H A R D COPY CARAB<L<T<ES TO Y O U R SYSTEM CONTINUED Font: 96 character positions on 'daisy' in 10 a n d 12 pitch. applications. proportional Vertically spacing in in Slew rate at 5 " per second. centered character lines, the C700 has Aitair C700 Specifications increased throughput, since the print Printing absolute minimum. A circuit serial, impact, bidirectional. Printing rate: 60 characters per second, m a x i m u m ; 26 132-column wear since parts motion is reduced to an lines per minute. which allows power to be decreased when the Transmission rate: 75,000 characters per printer is inactive further reduces wear. second (bit-paraltet, character-serial). Both printers are easily integrated into any Aitair 8800 computer system. Each comes with Indicators/Switches: O n / O f f , tnternal controls: Automatic control, complete the interface by connecting the away printer to the computer via the interface Check with MITS or your local dealer for prices and availability of the Q70 and mm second; Full characters writer quality. continuous multipart forms with or without sprocket holes. M a x i m u m width of 15 inches. after (17.3"). Up to 5-part sprocket-fed continuous forms m a y be handted. Dimensions: 178 m m high, 457 m m deep, 622 of electric typeor feed forms can be handled. Any Print speed and format: 45 characters sheets auto Paper feed: Tractor (pin-feed) up to 439 Aitair 88-Q70 Specificiations F o r m s : Single p a p e r run- carriage return. C700. per motor inhibitor, tine board. mm wide. (7"x28"x24.5") RS-232 permanent copies can be easiiy The Aitair B-100 inciudes quad- directional cursor control with carriage cursor for direct positioning by tine and column, 11-key n u m e r i c decimal point pad with for s i m p i e e n t r y of numeric data, erase mode for cursor to end of line and cursor to end of memory erase. A!tair 16K Memory Board N o w Avai<ab<e The new Aitair memory module provides 16K bytes of d y n a m i c Random Access Memory. By implementing low power and fast access dynamic memory ICs, the Aitair 88-16MCD runs at a maximum watts power dissipation and a m a x i m u m of three time of 350 nanoseconds. Crystal-controlled logic timing eliminates the need for on-board one-shot multivibrator circuitry. This resuits in continuous operation without wait states for greater reliability. Bus strips provide isolation between Weight: 27 kg (60 lbs.) Electrical system The ADM-3's retained. Out Indicator, interface card which is ptugged into the Aitair bus. Ribbon cables and connectors Select/ Deselect, Paper/ its o w n s p e c i a l features of return and tine feed, an addressable method: Character head returns to the right or left margin. unique to asynchronous serial ASCI) printers so that — spacing many for a variety extension connector permits interfacing Increments of 1 /48" up or down. less t h a n 132 This special feature results in minima) include unit. Format: Horizontally — 132 characters rates The LSI ADM-3 and the Aitair B-100 also suitable increments of 1/120". set to print character set and selectable transmission Prestige Elite comes with each and When C R T includes the from 75 to 19,200 baud. print wheel; wide variety of fonts available Each 64 ASCII requirements: 115/230 VAC + 10%, Hz 50/60 power and signal tines for m a x i m u m noise suppression. Address setection is switch selectable in 4K biocks. Each board requires one stot on the Attair 8800 bus. C / N J u n e . 1 9 7 7 ONE The Aitair B - 1 0 0 C R T p r o v i d e s f a s t , q u i e t a n d efficient o p e r a t i o n f o r a n y Aitair c o m p u t e r s y s t e m . Publications Offer Variety of Approaches The April issue of COMPUTER NOTES featured an article "Publications Provide entitled, Novice With COMPUTER to that of PCC, but information is aimed hardware/software at advanced computer users. Software PEOPLE'S COMPANY is a applications-oriented tabloid for the articles, such as games, modifications Essential Information," (Page 10 M a y novice a s welt as the experienced and unique software systems, make up CN), some of the current computer user, information is presented the bulk of D D J . Product releases and computer iiterature. We regret that the in an informal style with m a n y useful reader following annotations. PCC also acts as a sounding informative magazine. surveyed publications from People's Computer Company were not Included. board for novel ideas proposing changes in computer technology. The format JOURNAL of Dr. OF COMPUTER DOBB'S CALiS- T H E N i C S & O R T H O D O N T I A is similar responses COMPUTER round out this MUSIC JOURNAL offers a c o m p r e h e n s i v e a n d highty technical approach musical applications to high of quality digital electronics. This journal is best suited for those who utilize theoretical information for designing computer music systems. Subscriptions and additional information about these publications can be obtained f r o m : People's Computer Company P.O. Box E Menlo Park, CA 94025 C/N June, 197 7 SEVEN A d d s V a r s a t i ^ i t y t o A ! t a i r By Dave Antreasian S y s t a The graphics capability of a CRT plays an important r o l e in every' computer system. The graphics mode is especialiy useful for displaying graphs or curves quickly in reai-time and is a " m u s t " for such computer games as Ping-Pong. The foiiowing program was written for these applications. hardware restriction versatility, the program mode! for any hardware system restriction Although limits is a a its heipfu! display. The refers to cursor control incompatibiiity with terminals that include this feature. This p r o g r a m was written for a Beehive 100 terminal, in which the cursor is positioned by sending the following four-byte code to the terminal: (ASCII) Octal Code (ASCIi) Decimai Code Byte 1. Escape Sequence Code 33 27 50 40 3. Line Number 40-64 *32-54 4. Column Number 40-157 "32-111 2. Cursor Address Function Code *32 Represents line o r c o i u m n 1; 33 Represents line or column 2, etc. This four byte sequence positions the cursor, and the next byte received prints the desired character. Notice that positioning the cursor beyond either field limit causes the cursor to disappear or scroll the display. If the display is BASiC.) Each point in the data screen parameters: properly, because the first " h o m e " reference point will be tost. The program BASIC with is written in Aitair a user-cailed Machine Language display routine at tine 5000. Although it would be more efficient in machine language, its versatility would be greatly reduced in the translation. The program accesses an Anatog-to- block is s p e c i f i e d by three 1. the first byte is the tine number (ASCii) 2. The second byte is the coiumn number (ASCIi) 3. The third byte is the desired character (ASCil) Notice that the data block is composed of two sections. The first Digita! Converter card (88-ADC) which section reads eight channels of information and for " m o v i n g " data points, and the second thus defines four points on the display. A section fixed sections are separated by a data byte = background "fieid" is also dispiayed. By substituting another subroutine FOURTEEN initialing scroiied, the program cannot blank the (bytes8064to8075) contains "fixed" is reserved points. The 255. Upon recognition of the (255) code, the display program jumps back to the for the one at line 7100, Aitair BASIC can BASiC program, so the " f i x e d " field is plot any number of desired points simpty dispiayed by writing each point into the " D a t a "moving" Btock," which starts at iocation 8064. (Be display. This significantly reduces the sure to limit memory size to 8000 when display writing time. oniy once. Then oniy fieid is refreshed to the the C/N June. 1977 Machine Code Portion of Display Routine LIST 037, 100 41 103 315 Call Status CK?> 104 [ 1 6 6 1 105 L037 J 106 176 133 107 110 323 111 023 Call Status CK. \ Cursor 112 315 / Address 113 j-1661 114 L037 J 115 076 116 117 120 106 323 023 001 121 LXI (B,C) 122 r o o o i 123 Looo J 160 L110 J 323 161 162 023 Next Data point 163 303 164 [-1031 165 L037 J 166 333 167 022 * 170 037 171 037 ( Status 172 322 f Check 173 174 L037] 175 311 176 0 177 0 200 1st Data Loc. C/N June, 1 9 7 7 ,, ,, , , 0 124 315 Call Status CK. 125 r i 6 6 1 126 L037 J 127 176 ACC MEM 130 376 CPI) test byte ) 131 377 132 310 RET if Zero 2j Output 133 323 Output data 134 023 , 135 043 INCR H.L. 136 003 INCR B.C. 137 076 j (ACC) 3 140 003 141 271 CMP ACC to ( 142 302 JNZ 143 ri241 144 L037J 145 315 Call Status 146 r i 6 6 i 147 L.037 J 150 076 151 033 152 323 153 023 154 315 Call Statusi Cursor 155 r i 6 6 i Home 156 L037 J 157 [-0761 * Port 2/RS232 2 PPIi'jT"'HO! 1)Ei..ETE L I K E S S - 6 0 A rir. P E - P r n " 31 3 3 : P O K E 800 1 , 1 2 8 :POK;E 8 3 3 2 10 POKE 80 0 0 12 POKE 80 3 3 lit :POKE 83 0 5 , 31 2 0 5 : P u K E 8 3 34 62 :POKE 83 3 7 , 2 7 :POKE 80 3 8 , 211 14 PO HE 80 0 6 11 8 16 POKE 80 0 9 ! 9 :POKE f 3 1 a , 20 5 :POK.E ^ 0 1 1 18 POKE 80 12 31 :POKE 801*3 , 62 rPOJ'.E 80 14 , 70 21 1 :POK E 8 0 16 19 :POKE 80 17 1 20 POKE 80 1 5 28 POKE 83 1 8 0 :POKE 80 19 , 3 :POKE 8 3 2 3 , 2 0 6 12 6 1 1 8; :POKE 8 a 2 2 31 :POKE 8 0 2 3 24 POKE 80 2 1 26 POKE 80 2 4 2 54 :POK E 8 0 2 5 2 5 5 :POKE 8 0 2 6 , 2 0 28 POKE 80 2 7 21 1 : P o K E 8 0 2 8 19 :POKE 8 0 2 9 35 30 POKE 83 3 0 3 :POKE 8 0 31 , 6 2 : p O K E 80 32 , 3 32 '^OKE 80 3 3 - 1 9 4 :"-'OKE 8 0 3 5 , 84 1 8 5 :POK E 83 34 34 POKE 8 03 6 31 {POKE 80 3 7 , 23 5 :POKE 8 0 3 8 11 8 36 POKE 8 0 3 9 31 tPOlfE 83 40 , 62 : " 0 K E 8 0 4 1 , 2 7 38 POKE 80 42 21 1 :POH, E 83 4 3 19 :POKE 8344. 20 5 40 POKE 80 4 5 1 1 8 : ^ O K E E0 4 6 62 31 :POKE 8 0 4 7 42 POKE 80 48 72 :POKE 8 0 4 9 , 211 : P 0 K E f 0 50 1 9 44 POKE 80 51 67 :POKE 8 3 53 1 9 5 :POK E 80 52 31 46 POKE 80 54 2 1 9 :POK E 80 5 5 18 :PUKE 80 5 6 31 48 POKE 80 5 7 31 :POKE 8 3 5 8 , 2 1 3 :POKE 8 3 59 1!8 50 POKE FQ 6 3 , 3 1 : P C K E 8 0 61 , 2 0 ! :POKE80 6 2 , 3 : P O K E 8 0 6 3 , 0 60 STOP 70 V l - t O : E I A S = 0 : D t = d 5 : M = 6 6 : E 3 = 6 7 : I ; A = 6 € :ST=i?0 64 80 0!.*T13 0 , 0 : O P T 1 3 1 , 2 5 5 : O H T 1 3 0 , 4 : O P T 1 2 8 , 0 : O P T 1 2 9 , 2 5 5 : O P T 1 2 8 , 4 4 90 0 K T 1 3 4 , 0 :OPT 1 3 5 , 0 :0UT1 3 4 , 4 :01 T1 3 2 , 0 :0!.'T1 3 3 , 0 : 0 P T 1 3 2 , 4 100 0 P T 1 9 , 2 7 : 0 ! * T 1 9 , 6 9 : P E t . PLAN!! D I S P L A ^ 150 FOUI-PO 64T0 92 6 7 ' : P 0 K E I , 32 :KE T I 200 P O K E 7 3 , 6 4 : P ' 0 K E 7 4 , 3 1 : P E ! - SET t: -=80 3 3 10 0 0 FOP 0 = 8 3 79 TO 9269:t.OSPP.&aOO NEK 50 0 0 :*=!*SP ( Y ) 550 0 0 H T 1 9 , 3 2 : 0 P * T 1 9 , 3 2 570 0 P0KE8O 7 6 , 2 5 5 ! P O K E 6 3 7 7 , 2 5 5 : P O K E 8 Q 7 8 , 2 61 0 0 I F P ! i E i ; ( e 0 6 6 ) = 3 8 Tl-BH 650 0 62 0 0 POi:ESO 6 6 , 3 2 : P 0 K E 8 Q 6 9 , 3 2 : P O K E 8 3 7 . S S t P O h E e O 7 5 , 3 : 62 5 0 GOTO 530 0 650 0 8 0 S P B 7 1 3 0 651 0 POKE83 6 4 , L I + 3 2 : " 0 K E 8 3 6 7 , L 2 + 3 2 : P O K E 8 3 7 0 , L + 3 2 : P O K E f 0 7 3 , L 4 + 32 6530 POKBCO 6 5 , C I +32 : P O i ; E 8 3 6 8 , C.2 + 32 :POKE8 3 71 C3 + 32 :POKE8 0 7 4 , 0 4 + 32 6 5 4 0 POKE&O 6 6 , D 1 : P O K E 8 0 6 9 , D 2 : P O i : E 8 0 7 2 , P 3 : ^ O K E 8 0 7 5 , D 4 70 0 3 LOTu 50 0 0 71 0 0 FOP CH = 0 T 0 1 : O P T 1 3 1 , C H : O P T 1 2 9 , C K 72 0 0 MS = H'jP (1 33 ) : L S = I i ' P ( 1 3 5 ) 73 0 0 V= ( (1 6*t;s + ( ( L S / 1 6)AND1 5 ) ) * V I / 4 0 9 5 ) - E I A S 73 50 740 0 I F Cl!=0 TP EH L I = I N T ( V ) 741 0 IF C ! = l THEN C l = I i J T ( 4 * V ) 742 0 I F CH=2 THEH L 2 = I N T ( V ) 7430 I F CK^3 T!:EK C 2 = I N T ( 4 * V ) 744 0 I F CP = 4 THEH L 3 = I U T C V ) 74 50 IF CK = 5 THEM C 3 = I N T ( 4 ^ V ) 7460 I F CH=6 THEN E 4 = I H T ( V ) 74 70 I F Cl;= 7 THEN C 4 = I N T ( 4 * V ) 7650 N H ' T CH:RETt'P.N 80 0 0 READ X : I F X=2 5 THEN POKEJ,>::C-OTO 50 0 0 80 0 2 RETURN 850 0 D A T A . 3 5 , 3 5 , 4 3 , 3 6 , 3 6 , 4 3 3 7j 3 7 , 4 3 , 3 8 , 3 8 , 4 3 , 3 9 , 3 9 , 4 3 8501 DATA 4 0 , 4 0 , 4 3 , 4 1 , 4 1 , 4 3 42. 4 2 , 4 3 , 4 3 , 4 3 , 4 3 , 4 4 , 4 4 , 4 3 8502 DATA 4 5 , 4 5 , 4 3 , 4 6 , 4 6 , 4 3 8590 DATA 2 5 5 : R E K END OF B L O C ! OK , LX1M 101 [200] 102 L037_] , , , , , ,, , ,, ,, , SOFTWARE NINE SOFTWARE NOTES User s Program Handtes Compter Numbers By Chuck Vertrees By John Hayes Complex numbers often appear In Genera! Manager, ASDC scientific and advanced Program improvement and improving programs in the User Group A complex number is defined as a number that has both real and imaginary calculation, in order to use complex parts, numbers, the reader first rectangular form as A + iB where A is t h e 300 understand the concept of imaginary the real part and B is the imaginary part. Library. numbers. The Aitair User Group is currently reviewing mathematical An Many of the programs will be put in must it is u s u a l l y represented in It is considered as one quantity when imaginary number is a real doing calculations. For example, the machine readable form and grouped for number muitiplied with an imaginary numbers (1) 3 + p and (2) 4 - a particular size computer and language. operator. rerpesented in graph 2. (The imaginary operator is Single programs will still be distributed usually represented by an " i " or " j . " ) in whatever form This operator they are received. is defined so that the Current software listings (printed every square root of minus one is equal to the month operation, i.e.4-1 = i, or ( i ) ' = -1 or i x i in C O M P U T E R NOTES and supplied as a separate update sheet to all = -1. Remember that the square root of a CN subscribers) will show hardware and negative number is not usualiy defined. language With the above definitions, the square requirements for each roots of n e g a t i v e program. numbers 680b), Notice that (3)' = 9 and (-3)' = 9. But program's memory 3+ and the requirements in .0) 21-5 = 13. used 4 represented. For e x a m p l e , ^ 9 l = 3 a n d f ? - R f — I — I — I — h When submitting a program, users the language s-t- 2. c a n be should indicate the computer (8800 or are -4 -3 -2 -1 -+R -+—t-1 (2) -2 (i3)' = -9 and (-i3)' = -9. bytes. Graph 1 represents -3 imaginary numbers should clarify the difference Price increase between imaginary numbers and real -S numbers. Remember that it is possible to Rising costs of program duplication graphically represent a function in two -l Graph 3 shows polar form as an dimension by drawing an " x " and " y " alternative prices for some programs. Program and axis and then complex number. Notice that the point 4 subroutine listings are now $4 for up to 10 function. pages, $5 for 11-20 pages and $6 for 20-40 (1) ( X , Y ) = (2, 2) (magnitude and angle), which is written pages. These new prices are indicated on (2) ( X , Y ) = (4, 3) as L-& the listings in this month's CN insert. (3) ( X , Y ) = (-2, 2) Price changes for all previous programs (4) ( X , Y ) = (3, 0) have resulted in a slight increase in plotting values of the method of representing a + j4 can also be represented as a vector will be issued as an appendix to the AUG (4, i 4 ) or +y Software Catalogue. 5 1. 4 - Machine-readabie code 3 - The User G r o u p is interested In programs already in the library. Anyone who can provide the : ) S ) 1 .4 User Group with either paper tape or cassette forms of earlier 1 -2 i -1 -2- Library, -3- 343, 3330 t^R (4) ! - l programs should contact the Aitair User Group Suite i l M 1 software ! (1) J purchasing machine-readable code for .(2) Peachtree, Atlanta, Georgia 30326. -4- in - 5 --y In this case both the X and Y axis are TEN graph (rectangular) 3 the point is represented 4 + i4 as the length L from the origin at ang!e-&-where real number lines. Now, let's replace the L =</ X ' + Y? = V 4 ' + 4' = / 3 2 * = 4^5* and real Y axis with an imaginary " i " axis so tan O- =4/4 or-&= arctan 1 = 45° which is that the Y axis represents imaginary represented in Standard Polar Form as numbers. C/N June, 197 7 The following compiex number flow chart and program written in Aitair BASiC is avaitabte through the Aitair Compiex Number intrepreter for BASiC By Dr. John J . Herro (Used as a Program or Subroutine) Annotated Program Listing User Group Software Library. mainprgm. 49990 L Z = 0 : iNPUTSS: GOSUB 50010: GOTO49990 (AUG Library number: 7014) subroutine 50000 L Z = 1 50010 S Z $ = " ( ?+-*/ % ! D R P E L " : i F S S = " " T H E N R E T U R N 50020 FOR J Z = 1 TO LEN (S$): GOSUB50030: N E X T J Z : RETURN 50030 F O R )Z=1 TO 16: ) F M i D $ ( S S , J Z , 1 ) = M I D $ (SZ$, IZ,1) THEN 50050 badchar. 50040 N E X T iZ: P R ) N T " U N R E C O G N i Z E D C H A R A C T E R i N " : good char. 50050 ON iZ GOTO 50070,50290, 50240, 50220,50210, 50270, 50260, GOTO 50170 50300 50060 ON iZ-8 GOTO 50200, 50190, 50280, 50330, 50120,50320, 50150: RETURN ( 50070 F O R ! Z = J Z T O L E N ( S S ) : i F M I D $ ( S $ , i Z , l ) = " ) " T H E N missing ) 50080 N E X T iZ: P R I N T " M i S S i N G ) i N " : GOTO50170 ) 50090 A Z = V A L ( M i D $ ( S S $ , J Z + D ) : E Z = 0 50090 ; 50100 FOR K Z = J Z TO iZ: iF M ! D $ (S$, KZ, 1) = " ; " THEN E Z = V A L ( M i D $ (S$, KZ+1)) 50110 N E X T KZ: J Z = I Z : R E T U R N P 50120 iZ=1.570796*SGN(EZ). i F A Z T H E N i Z = A T N ( E Z / A Z ) 50130 t F A Z 0 T H E N iZ = iZ+6.283185*((EZ 0)+.5) 50140 A Z = S Q R ( A Z 2 + E Z 2): E Z = i Z : R E T U R N L 50150 GOSUB 50120: i F A Z T H E N A Z = L O G ( A Z ) : R E T U R N aritherr. 50160 P R i N T " L O G ( 0 ) O R / O O R O ( X ; Y ) , X error 50170 P R i N T S U P R t N T T A B ( J Z - l ) " =0iN" " 50180 iF L Z T H E N E N D E L S E J Z = L E N ( S $ ) : R E T U R N ! 50190 i Z = A Z : A Z = B Z : K Z = E Z : E Z = F Z : GOSUB 50230: D Z = i Z : H Z = K Z : RETURN % 50200 i Z = A Z : A Z = B Z : B Z = i Z : i Z = E Z : E Z = F Z : F Z = ! Z : R E T U R N 50210 AZ=-AZ: E Z = - E Z + 50220 A Z = B Z + A Z : E Z = F Z + E Z drop stack 50230 B Z = C Z : C Z = D Z : F Z = G Z : G Z = H Z : R E T U R N ? 50240 PRiNTAZ;CHR$(43-(EZ 0 ) * 2 ) " I " A B S ( E Z ) : GOSUB50120 50250 P R ) N T " = " AZ " A T " EZ*57.29578"DEG.": GOTO50330 / * 50260 GOSUB 50150: AZ=-AZ: E Z = - E Z : GOSUB 50320 50270 iZ=AZ*BZ-EZ*FZ: E Z = E Z * B Z + A Z * F Z : A Z = i Z : GOTO 50230 D 50280 EZ=EZ/57.29578: GOTO 50330 50290 D Z = C Z : C Z = B Z : B Z = A Z : H Z = G Z : G Z = F Z : F Z = E Z : RETURN 50300 )F B Z = 0 A N D F Z = 0 A N D A Z 0 T H E N A Z = 0 : E Z = 0 : GOTO 50230 50310 GOSUB 50200: GOSUB 50150: GOSUB50270 E 50320 A Z = E X P (AZ) R 50330 ! Z = A Z * C O S ( E Z ) : E Z = A Z * S i N ( E Z ) : A Z = i Z : R E T U R N NOTE: Spaces were inserted in this program listing to improve readabiiity. Deieting ail unnecessary spaces will save 149 bytes. This program was written in Extended BASiC. it will run in 8K BASiC If line 50180 is replaced with: 50180 iF L Z T H E N E N D 50185 J Z = L E N ( S $ ) : R E T U R N A 30-page user manual is availabie for $6 from the Aitair User Group Software CONTiNUED C/N June. 1S77 ELEVEN R e s e q u e n c e s L < n e s P r o g r a E v e n t y m K i n c e r e e p m s e n t e d By Doug Jones in is the largest possible line n u m b e r that BASiC, the first few iine n u m b e r s a r e Whenever i write a program 680 BASIC will accept without displaying half-way aiways nicely incremented — 10, 20, 30 an error message. suddenly show an error message. For etc. The subroutines also start a t easy-to- How to Use t h e Resequencer. r e m e m b e r line numbers, such as G O S U B Write or load your Sometimes the resequencer might be example, program through a the newiy program sequenced 240 IF A = B T H E N G O S U B 1000. But things don't seem to stay that containing the odd line numbers. Then remark load the resequencer and type in the E R R O R O N L i N E 473 explaining w h a t the routine is about a n d starting line — RUN63967. After a few OK have to squeeze in 999REM. By the t i m e seconds, t h e computer will a s k : the O L D LINE, NEW, STEP, NULLS? program t o p u t in a is c o m p l e t e , t h e line listing might print the following message. nice, i forget and The line n u m b e r referenced to in t h e error message is in the original p r o g r a m . numbers look anything but weli planned: Y o u r answer m i g h t be 7,100,10, 5. This This can occur 10, 16, 17, 33, 49 . . . indicates asked to resequence a line that does not The following resequencer p r o g r a m gives Aitair 680 B A S I C professional-looking, ( ! ) your old p r o g r a m if t h e resequencer is began at line 7, (2) you w a n t to renumber exist. it starting with line 100, (3) in increments How Does the Resequencer W o r k ? users evenly that Resequencer of 10 a n d (4) set N U L L S to 5. incremented lines. The user m a y choose Resequencer does not r e w r i t e a the starting line n u m b e r a n d the step of program in m e m o r y . increment. produces a typed Instead, listing it property runs through a p r o g r a m three times. The first t i m e it looks for the first O L D line . When it is found, the system examines the p r o g r a m specifications. line by iine, counting lines as it goes. It only 33 iines long. I intentionally wrote it With this listing and a punched tape, the stops when it reaches its own first tine in unusual line numbers. To avoid being user can type N E W and then re-enter the number. a 'space' gobbler, the p r o g r a m lines a r e newly sequenced p r o g r a m . The B A S i C resequencer p r o g r a m is sequenced to t h e users t h e second On pass it gathers existing line numbers into a n a r r a y for incremented by one. The last line, 63999, User s Program HatltcMes Complex Numbers CONTINUED 60090 ( START PRINT ERROR MSG. NOT 50070 FOUND D 60020 ( N/ RETURN FIND NEXT ) CHAR. N CHAR. = ? ? OMR. 50240 50290 , # ? FOUNO 50090 PUT FIRST N O . (OR ONLY NO.) INTO REAL PART A T BOTTOM OF STACK, 0 tNTO IMAG. PART. j Y PRINT REAL & IMAE PARTS. CHAR. = - ? RAISE STACK 50] 00 CHAR. = / ? CALL LOS NEGATE BOTTOM N O . ON STACK. CALL EXP IS THERE ; CALL POLAR 50300 CHAR. = t ? BASE = 0 & REAL (EXP0N) >0 ? PUT 2ND NO. INTO IMAG PART AT BOTTOM OF STACK. 50310 INTERCHANGE Z] AND Z,. ! o CALL LOG ) 50320 PUT 0 ON BOTTOM OF STACK. FOURTEEN CALL MJLT CHAR. = * ? WITHIN ( ) ? * 180/" NESATE BOTTOM M 0 . ON STACK. 50260 N / PRINT M A E . , a ANGLE (RADS) DROP THE STACK. 50270 50210 ANY MORE CHARACTERS IN STRING? A00 BOTTOM 2 N0S. ON STACK CHAR. = + ? CALL EXP CALL MULT C/N June. 1 9 7 7 LI SI future G O T O and G O S U B references. Resequencer displays the n u m b e r Ojf lines the p r o g r a m contains. It tetls the *+ + * * O E M O N S t i ^ t l O N I TNPUi o 17 IF [PEN 49 3 A3 IF a=C 1 wgN GOSUB ] : SI 0\ A GOiO ] . 3 7 , 4 9 77 GOSJB t : G O i 077 "3*1 G )I 3 ] OF nESEOJENCErt r'rfOGnAM ***** user to R E A D Y P U N C H and then pauses white the Starting operation leader and is performed. contro)-0 are punched a u t o m a t i c a i l y to prevent echo. On the third pass, t h e program begins listing. E a c h initia) line n u m b e r is 639 67 0^1 -<\END,FOR,MEXi T< HJ\63?6 7 *).[) LINE A, NER ' 1 \!E S = 7 ^KADY P!J\CH S)EP, A, INPOt ,G0< O . r t L ^ , IF,rtES< One. \JLLS? the incremental step f r o m the previous tine number. Referenced line n u m b e r s are then a function of the starting p a r a m e t e r s and the position of a iin! n u m b e r in the a r r a y . The resequencing and iisting stop when the p r o g r a m reaches its starting iine n u m b e r . It then resets nulls to zero, prints an E N D to undo the control^) echo suppression and spiils out some finishing tf* REM * * * * * p7l t ^ i p j i 4 IF DEMONSIfsAIION OF KESEGOENCE^ ***** 7?l IF 3=C GOSUB 4 G U I ?7t, GOSU^ P 3 : G 0 < ) 6 ^ 71 GOTO 23 P9: ieader. Since resequencer starts looking for the old first line in the top part of K CONTtNUED BASiC, there is a siight chance that it ) MULT 50200 ^ CHAR. = % 50270' USE ? (U;Z)*(X;Y)= (WX-YZ;WY+XZ) N ^ CHAR. = : DROP ? THE STACK. N RETURN CHAR. D ? 50)50 ] ] f P O L A R CALL LOG S0120 CONVERT FROM RECT. TO POLAR FORM (ANGLE IN RAOS), SELECTING PROPER ARCTAN. CHAR. N CHAR. = BLANK ? C/N June, 1977 50040 PRINT ERROR MSG. ( RETURN D RETURN SEVENTEEN J) J Circuit Ana!ysis Applications Expanded t o Run w i t h Aitair BASNG Mew PoHicy . A d o p t e d Due to rising costs, M I T S will now oniy accept A circuit is a group of components orders for $25 or more. with fixed characteristics interacting in Please place all other orders with your some prescribed m a n n e r . A n electricai local dealer. engineer's job is to deveiop m a t h e m a t i c a i reiationships between t h e R e s e q u e n c e r K e e p s P r o g r a m An optional old starting line n u m b e r L i n e s further Ewarn^y Encremented CONTtNUED into a program will permit of a circuit describe the total behavior network. In order to d e v e l o p that of t h e these resequencing of a latter portion of t h e relationships, electronic circuits must be p r o g r a m . This works as long as there is anaiyzed. no previous reference to the earlier part m i g h t find some assembled instruction of with the s a m e resequenced. n u m e r i c value as the various components starting line n u m b e r . However, I haven't the program The that is n o t b e i n g Computer anaiysis of eiectronic circuits is nothing new in itseif. However, this p r o g r a m brings a u t o m a t e d anaiysis user can increment the line to the Aitair computer running B A S i C . it seen it happen yet, and I've used the n u m b e r s by any step, even 3.2 or -9.7. Ail is, therefore, inexpensive to i m p t e m e n t p r o g r a m to resequence everything I can GOTOs and easy to modify for speciai needs. find on a paper tape. correctly to line a n d G O S U B s a r e referenced 437.13. Unfortunateiy, The anaiysis technique a n d output Attair BASIC will not run a p r o g r a m with f o r m a t s used in this p r o g r a m a r e based find the starting line n u m b e r — iust a bit iine n u m b e r s tike that. W h a t can be done on those in t&M's E C A P longer if the trigonometric functions a r e with such a listing? if you have a time- Circuit Analysis P r o g r a m ) , written for initialized in BASIC. Even if the oid first share computer access a t work, give it to the I B M 1620. The input f o r m a t is siightly line n u m b e r doesn't exist, it will try its the time-share coordinator. Teit h i m or different than E C A P ' s . Aithough E C A P darndest to find it a n y w a y . I've seen her: " L o o k w h a t your time-share has does t h r e e d i f f e r e n t types of c i r c u i t those lights blink for a half-hour, and it done to all m y computer files . . . now analysis, this p r o g r a m does only steady still wouldn't give up. none of t h e m r u n ! " state D.C. anaiysis. It usually takes only a few seconds to (Eiectronic The soiution technique used is nodai ^ L L 5 : F 0 K N = I i 0 ] 13 : ? C H R K P ) : :NEXt : ?CHx$( I 5 ) : L I S t anaiysis. it's based on Kirchoff's current iaw, which says the algebraic s u m of the 63 9 6 7 D A I A E N D , F 0 R , N E X 1 , D A t A , I N P U 1 , D I M , R E A D , L E i , GOt 0 , R U N , ! F , h E 3 t OHE W 6 P D A IA G 9 S U S , R E I J R N , R E f . , S I O P , O N , N U L L , W A I t 6*19 6 9 D A t A L I S I , C L E A R , N E W , t A h ( , t 0 , F N , S P C ( , i H E N , N O t , 5 t E P ,+ , - , ^-1071 OAt A A N D , O R , > , 619 7 ! DAIASIN.lAN,At N,PEEK,LEN,SiRt,7AL,AbC,CHR$,LEr W 7 9 , D E F , P C < E , P R t N i , CO\ti =-, < , S G N , I ^ i i , A 8 b , U S R , F r . ' E , P 0 S * , zero, and O h m ' s Law, which says voltage t ,MNt),L0G,EXP,C0b !S,KIGHi currents ieaving (or entering) a node is MIDi READC!:TFC!<>"END"tHEN63972 equais the product current. Apptying current Law and some matrix 63 9 7 3 DIMAf ( 6 5 ): F 0 R N = i n 6 5 : R E A D A K N ) :NEXt : C =0:P=6)4 2 : Z = ] 2 7 : Y =63967 law, 43974 INPUf'OLD alegbra, a computer can find the soiution 639 7 5 P ) = P : I F 0 L < > 2 5 6 * ( P E E H ( P + 2 ) ) + P E E K ( P + 3 ) i H E N P = P + ] : GOt 0 6 3 9 7 5 tTNE # , NEW S1EP, NULLb"! OL,NI*,!B,M:AS(0)*"END" 63976 I F 25 6 * ( P E E K ( P +2 ) ) ^ P E E K ( P +3 ) = Y t W E N P R l N t " L I N E S 63 9 7 7 P=((2 56*(PEEHfP)))+PEE^(P+))):C 63 9 7 8 P R I N t " R E A D Y 639 7 9 = " : C : GOt 0 6 3 9 7 8 NULL ( M ) :F0Rt< : ] t O I 0 P ) : P R I N t C H R K 0 ) ! of a circuit after a description of t h e circuit is in m e m o r y . I : G 0 i 0639 76 PUNCM":FORK =1t 0 5 : P R I N t : N E X ) : F O R K Ohm's of resistance a n d Kirchoff's =1i O ] 0 0 0 : N E X t Circuits a r e a series of nodes or :NEXi :PRINt CHRK I 5 ) : P R l N t 63 9 8 71 D t ^ A ( C ) : P =P I : F O R N = ) f O C : A ( N ) =r( ( 2 5 6 * ( P E E K ( P ^ 2 ) . ) ) + P E E K ( P + 3 ) ) piaces 639P] together a n d branches or connections p=((2^6*(PEEK(P)) )+PEEK (P+ t ) ) : N E X i N : L L C =0 : C t r " " : p = p ] 639 8 2 I P C r L L t W E N P R I N t " E N D " : N U L L 0 : F O R N =1 t O j 0 : P R I N t C H R K 0 ) : : N E X t : E N D 639 8 3 P P = ( ( 2 5 6 * ( P E E < < ( P ) ) ) + P E E K ( P + I ) ) : P =P + 2 : L N = N * + 639P4 PR I N t R IGWt S ( S I R K L N ) , L E N ( b t R K L N ) ) - ] ) ! 639^5 6398 6 63907 " (IB*C) " ! : C 1 : P = P +2 : G O t 063986 8t HEN63990 TFF=Pti H E N P R I N t : P R I N i C I - : R K F ) ; : P : P + t : GOt 0 6 3 9 8 2 PR I N t C l - ' R K F ) ! : G O T 0 6 3 9 8 5 63 9 9 ^ p - p + ] ; G ^ P E E K ( P ) : I F G > = 4 8 A N D G < = 5 7 i H E N C t = C $ + C h ' R K G ) : F L =1 : G O t 0 6 3 9 9 0 TFG=3?ANDFL=atHEN63999 6399P IFFL=]ANDG<7twEN63996 639 9 3 IFF<>!58ANDG<>0tWEN6399'i 63994 F=G:60I063986 63 9 9 5 P R T N t : P R I N t " E R R O R 63997 between the nodes containing electronic components, i n p u t of the circuit to t h e IFF>7tWEN63985 639cp 639 9 6 a r e connected P=P+]:IFP=P2tHEN63982 F = P E E K ( P ) : I F F ^ Z I M E N P R I N t A K F - 1 2 8 ) : : I F F =1 3 6 0 R F = ] 4 0 O R F 639C9 6399! where things F O R K - ] t O L L : TFA( K ) ON U N E #"}A(C):NL)LL0:END ( C 5 ) t H E N X t = S t R K N w t ( I B * ( K - ] ) ) ) : GOt 0 6 3 9 9 8 NEXIKrGOi063995 639QC PR I N t R !GWt t ( X $ , L E N ( X i ) - ) 63999 PRINtCHRS(6l!:G0i06399H ) : : FL=P): C i I F G < > 3 2 A N D G < > 4 4 t HEN6 3 9 9 4 K FOURTEEN C/N June. 1 9 7 7 program is in terms of these branches and their nodes. The arrangement of each branch is standardized and assumed by the solution. (See Fig. 1.) Only the basic eiectronic components shown in Figure 1 are recognized by the solution. Ohm's Law covers voltage, c u r r e n t and resistance but says nothing about transistors, diodes or 7400s. Since only a steady state solution is found in this program, capacitors are considered open circuits and inductors as short circuits. However, with the proper combination of the a!!owed elements shown in Figure 1, the user can "model" transistors, diodes and other non-linear components in a non-steady state and non-D.C. anaiyzer. Every branch must contain one and only one non-zero r e s i s t a n c e or conductance. According to Ohm's Law, zero resistance requires an infinite current flowing in the branch. Each branch may have a voltage source, current source or dependent current source. Since this program has onty a steady state D.C. analysis, the circuit must have at least one independent source, one node other than ground and one branch. Every node must have a path to ground through the branches of the circuit. Without the path to ground, certain sections of the circuit wouid "fioat" free of the rest. Starting with the number one, each node is numbered in increments of one. Ground is always node zero. Branches and dependent current sources are numbered consecutivety from one. There is no branch or dependent source zero. Output from the solution is in terms of these numbers, input Program The input program is a compromise between ease of programming and ease of use. The easiest program to write might ask for the number of branches and then quiz the user on the values of it's components and the nodes to which it is connected. This would require a lot of operator and computer time that could be put to more productive use. The easiest program wouid permit a user to enter and edit any data in any order at any time. But such a program would be rather complicated to write. C/N J u n e , 1 9 7 7 A L T A I R DC E L E C T R O N I C C I R C U I T A N A L Y S I S P R O G R A M A D A P T E D F R O M IBM 1620 E C A P TO A L T A I R 8K B A S I C ( V E R S I O N 3 . 2 OR 4 . 0 ) B Y TOM S I M P S O N 2 / 1 4 / 7 7 !S C L E A R 9 9 : M O = 3 t D E F F N K X ) = I N T ( - ( X > 0 ) * X ) : I N P U T " N O D E S " ; X : M N = F M I < X - I ) 20 I N P U T " B R A N C H E S " ; X : M B = F N I ( X - I ) ! INPUT"f)EP S C S " ; X : M D = F M I ( X - i ) 33 DIH M(MB,HN),NI ( M B ) , H F ( M 3 ) , Z(M?) + !,MN + ! ) , Y ( M B ) , Y L < M B ) , Y H ( M B ) , C U ( M B ) 43 DIM A(MB),AL(MB),AH(MB).,E(MB),EL<MB).,EH(MB),D(MD),DL(MD),Di:(MD) 5 0 DIM E C K M M ) , I P < M N ) , N V ( H H ) , B V < M B ) , I N ( M N , t ) , W ( M N ) , W L C M M ) , W H ( M N ) 60 DIM R W ( M D > , C L ( M D : , S D ( M N ) ! D 3 = : " N B 3 " : K $ = " / X ( ) K M " : C $ = " B D * G R E I ":K!=t 70 P R I M T : P R I N T " A L T A I R DC E C A P " ; P R I N T : P S = " C M B V E V E C P L P D W C S D N V B C C ' 7 ! H " : K 0 = 3 KM=-I:K2=2 80 K 3 = 3 : K 4 = 4 : K 5 = 5 : K 6 = 6 : K 7 = 7 : K 9 = 9 : N N = K M : N B = K M : N D - K M : N Y = K M : N E = K M : M A = K M 90 P C = . 0 I :CT=* I 0 3 0 : C M = i E 6 : C I = . 0 3 H S 6 = 3 6 H 0 PH=K8 ! 20 I N P U T X S : L = L E N (XS ) : 1=1(3: I F X S < > " R U H " T H E H 150 130 I F M Y - M B A N D ( N E * K M 0 R M A > K M ) A N D N B : * K M A N D N N : - K M T H E N 1 3 6 3 140 P R I M T " M I N R E Q U I R E M E N T S F O R S O L U T I O N H O T M E T " : E N D 150 I F X $ = " M O D I F Y " T H E N M O = M O + K H G O T O I 2 0 160 I F L E F T $ < X S , K I ) = " R " T H B N I 2 0 170 IFXS="NEW"THEN!0 189 I F L E r T S < X S , K 5 > = " P R I M T " T H E M I = K 5 : G O T O 9 0 0 190 IFXSs-"END"THENEND 200 I=I+Ki:IFI>LTHENI20 2 1 0 F0HK=KiT0K4!i I F M I D S ( X S , I,KI ) < > M I D $ ( C S , K , K t 3 T H E N M E X T : G O T O ! 0 0 0 220 OMKGOTO2S0,233,233,470 230 T Y = K - m { G 0 S U B 5 2 9 : X = T - K H I F T Y = K 2 T H E N 2 S S 240 IF'X>MBrHEKPRINT"BRANCH # T O O G R E A T " ; ! G O T O I 0 3 0 25B I F M 0 T H E N 4 7 3 260 IFND3-KHTHKa!PRINT"B R E C O R D S C A N N O T F O L L O W D R E C O R D S " ; : G 0 T 0 : 3 3 9 370 N B - K B + K I : G O T O 3 ! 0 289 I F X > M D T H E N ? n i H T " D E P S O U R C E * T O O G R E A T " ; : G O T O ! 0 3 0 230 I F M 0 T H E N 3 7 B 300 N D = M D + I 3iC I=I+m:F0RK=KtT0K3:IFMID$(X$,I,KI)<*MID$(D$,K,Kt)THENMBXTsGOTO)M0 320 O M K G O T O 3 I ! S , 4 2 0 , 3 4 3 340 I F T Y = K ! T H K : H 0 8 O 353 GOSUB603:TL=TL-K! ! T H " T H - K 1 : ! F T L : ' M B O R T H * M B T H E N ! B I 0 330 C L ( N D ) = T L ! R W ( H 9 ) = T H 370 I = I + K I :F0RK=sK3T0H5:IFMIDS<XS*I'.Kl ) < > M I D $ ( D S , K , m ) T H E M H E X T : GOTO!. 330 380 IFK-K5THEK373 390 T T - K - K 2 : G 0 3 U B 6 ! S : I F T T - K 2 T H B N 4 I 0 400 K = C L ( N D ) : T - T * Y ( K ) : T L = T L * Y L ( K ) : T H = T H * Y H ( K ) 410 D < M D ) = T s D L ( M 3 ) = T H D H ( N D ) = * T H : G O T O 123 420 IFTY=K2THS:mS33 433 GOSUB603:TL=TL-m :TH==TH'-KI : I F T L > M N O R T H * M N T H E M i 0 2 S 440 IFTL>MMTHEVtW"TL 4SS IFTH^MNTHE.'JMM="H 460 HKX)=fL:HF(X)=:TH 470 I-H-KIUFlP-LTHENtKf! 488 fORK^KSTOKy:IFMIMCXS.I,K:)<*MIDS(C$,K,Kt:THENMBXT:GOTO 1093 IFK=K9TKEH470 590 SB : IF!'"K^AND(TT=::!0RTT=K2)THEN iS43 513 T = K I / T : T I = T L : T L = K I / T H : T H = K I / H 520 Y ( X ) - T : Y L < X ) = T L : Y H ( X ) = T H : I F M O = K 0 T H E N N Y = N Y + K t 530 G O T O 4 7 0 540 E < X ) - T : E L C X ) = T L : E H ( X ) = T H : I F M O = K 0 T H E N N E = N E + K t 550 GOTO470 560 A ( X ) = T : A L ( X ) = T L : A H ( X ) = T H : I F M O = K 0 T H E N N A = N A + K ! 570 G O T O 4 7 0 600 ZZ=K2tGOTO650 610 ZZ=KI:GOTO630 620 Z Z = K 0 630 I = I + K t : Z S " M I D $ ( X S , I , K t ) : I F Z $ = " " O R Z S = " = " T H E N 6 3 0 640 GOSUB790:T=Ti*MU:IFZZ=K0THENRETURN 650 I = I-<-K!:IFMIDKX$,I,KI) = " "THEN650 6 6 0 IFt-!ID$(X$^I,Kt ) < > " ( " T H E M T L = T : T H = T : I = I - K H O N Z Z G O T O 7 6 0 , 1030 670 I-H-KIiGOSUB790:TL=TI^MU 680 I=I+m:F0RK=KIT0K3:IFMID$(X$,I^KIX>MID$(K$^K^K!)THENNEXT:GOTOI003 690 ONKGOTO6S0,700,7:0 7 0 0 I=I-)'K) ! G O S U B 7 9 6 : T H = T I * M U : G O T O 7 3 0 7!0 IFZZ<*KtTHEN!060 7 20 T L " A B S ( T ) * T L * P C : T H = T + T L : T L = T - T L 730 I = H K 1 : I F I > L O R M I D $ C X $ , I , K ! ) = " ) " T H E N R E T U R N 740 IFMID$(X$,I^KI)=" "THEM730 750 GOTO!000 760 RETURN 790 CONTiNUED Ti=VAL(MIDS<X$,I)) SEVENTEEN Circuit Analysis Applications 660 F0RJ=IT0I.:F0RK=K!T0K7: I F M I D S ( X S , J , K I )<>MID$(K$,K,K1)THENNEXTK,J 830 I = J - K 1 : M U = K 1 : I F Z Z < > m 0 R K < K 6 0 R K * K 7 T H E N R E T U R M 840 I = I+K! : I F T T = K 2 A U D K = K 6 T H E N H U = C T : R E T U R N C O N T I N U E D 850 I F T T = K 2 A N D K = K 7 T H E H M U = C M : R E T U H N 860 I=I+K1:IFTT=K3AMDMID$(XS,I,m)="V"THEN8!8 The f o r m a t used here f a l l s 870 I F T T = K 4 A M D M I D S < X 3 , I , K I ) < > " A " T H E N 1000 s o m e w h e r e in between these t w o 890 MU=CI:RETURN extremes, it's not a particularly simple 9 0 0 I = I + K 1 : I F I > L T H E N 1 2 0 910 I F MID$<X<6,I,K1) = " "THEN900 p r o g r a m , but it's straightforward. 920 H*MIDS(XS,I,K3)="ALL"THENPR=4095:GOTO!20 Although it doesn't allow a compietely 930 F 0 R K = K 8 T 0 1 1 : I F H I D S C X S , I , K 2 ) o M I D $ ( P S , K 2 * K + K ! , K 2 ) T H E N N E X T : G O T O 1 0 0 0 940 PR=PR0RCK2'K>:I=I+K!:GOTO930 free format, it's fairly easy to learn, 1000 P R I N T " S Y H T A X E H R 0 R - P 0 S . " ; i : E N D input Format 1010 P H I N T " B R A N C H # T O O G R E A T " : E N D See the sample runs for the input 1 0 2 0 P R I N T " M O D E F T O O G R E A T " : E N D 1030 P R I N T " - T R Y A G A I N " : G O T O 1 2 0 format. Branches are described with the 1 0 4 0 P R I N T " Z E R O R E S I S T A N C E O R C O N D U C T A N C E N O T A L L O W E D " : E N D letter " B " as the first non-space i 8 6 0 I F P R = K 3 ? H E N P R I N T " N 0 O U T P U T S P E C I F I E D " J < G O T O 1 0 3 0 MODIFY";MO;"**":GOTO1090 character and followed by the branch 1 0 7 0 P R I N T : P R I N T : P R I N T : P R I M T : I F M O T H E N P R I N T " * * 1080 PRINT"** S O L U T I O N * * " number. A node " N " is foliowed by two 1 0 9 0 P R I N T : P K I N T : P R I N T node numbers in parenthesis. The first 1 I 0 C F O R K = K 0 T O N B : F O R J = K 0 T O N N : M ( K , J ) = K 0 : N E X T J , K number is the initiat node of this branch. 1 1 1 0 F O R I = K O T O N B : I F H l ( I ) * : 9 M T H E N M ( I . , M I ( I ) ) = K I !I20 I F M F ( I ) > K M T H E K H ( I , N F ( I ) ) = K M The second is the final node. Initiat and 1 1 3 3 N E X T final nodes a r e determined by the 1 2 0 0 F 0 R I = K S T 0 N N : Z ( I , N N + K 1 ) = K 0 : Z ( N M + K I , I ) = K 0 : F O K J = K 9 T O N N : Z ( I , J ) = K 0 positive current direction in the branch, 1 2 1 0 F O n K = K 0 T O N B : T - M ( K , I ) : T 1 = M ( K , J ) : I F T = K 0 O R T ! = K 0 T H E N 1 2 3 S 1220 2 ( I , J ) = Z(I,..!H-TaTI*Y(K) which is set arbitrarily by the user. 1 2 3 0 H E X T K , J , I : I F M D = K M T H E N ! 4 0 S Current flows from the initial node to the I 3 S 0 F O R I = K 0 T O N D : L = R W < I ) : H = C L t I ) : F O R J = K 0 T O N N : F O R K = K 0 T O M N final node. Then the component values in 1 3 1 0 T = M < L , J ) : T 1 = M ( M , K ) : I F T = K 0 O R T 1 = K 0 T H E N 1 3 3 0 1320 Z < J , K ) = ^ Z ( J , K ) + T * T l a D ( I ) the branch are entered in any order. R = 1 3 3 9 H K X T K , J , I d e f i n e s r e s i s t a n c e , G = d e f i n e s !4SP FORi-K<atON3!CU;i ) = K S :CU( I ) = A ( I ) - Y ( I ) :NEXT:IFND=KMTHEH1440 conductance, E = defines voltage source 1 4 I B F 0 R I - K 8 T 0 M D : L = R W ( I ) : L i - C L < I ) I42& I F E { L l ) T H E H C m L ) = C U ( L ) - G ( I ) * E C L l ) and 1= defines independent current 14 30 NEXT source. Only component values included 1 4 4 8 FORN-KCTCNN:::^.(N) = K 0 : F O R M = K 0 T O N B : E O C N ) = E Q ( N ) ^ < t I ^ . M ) ^ C U ( t n : H E X T M , N in the branch should be specified. The l.^ss iFPRju-iDi:lT:-::riG0SU325B? only thing missing from F i g . 1 is 1500 FORI=K0TONM:IP(I)=K0:NEXT:FORI=K0TONN:T=K0:FORJ=K0TONN *i510 I F I P ( J ) = K ! T H E N 1 5 6 0 d e p e n d e n t c u r r e n t sources, w h i c h 1520 FORK=0TONN)IFIP(K)>KITHENRETURN sometimes cause modeling difficulties. 1530 IFIP<K)=K1THENI550 1540 I F A B S ( Z ( J , K ) ) ^ A B S C T ) T H E N I R = J ) I C = K : T = - Z ( J , K ) A dependent current source has a 1550 NEXTK value which depends on a quantity in 1560 NEXTJ 1570 I P ( I C ) = I P ( I C ) + K 1 : I F I R = I C T H E N 1 5 9 0 another branch of the circuit iine. 1580 FORL=K0TONN:T=ZMR,L) : Z < I R , L ) = Z ( I C , L ) : Z ( I C ^ L ) = T : N E X T L Dependent current sources are carried 1590 I N ( I , K 0 ) = I R : I N ( I , K ! ) = I C : P V = Z ( I C , I C ) : Z ( I C , I C ) = K 1 internally as transconductance vaiues. 1600 FORL=K0TONN:ZMC,L) = Z<IC.,L)/PV:MEXTL 1610 FORLI=K0TONN:IFH=iICTHENi640 Another often used value is current gain 1620 T = Z < L ! , I C ) : Z t L l , I C ) = K 0 : F O R L = K 0 T O N N or beta value. The values are related by 1630 Z ( H , L ) = Z ( L 1 , L ) - Z ( I C , L ) * T : N E X T L the equation: Transconductance = beta 1640 NEXTL! 1650 N E X T I / resistance of controiling branch. The 1660 F O R I = N N T O K 0 S T E P K M : 1 F I N { I ^ K 0 ) = I N ( I , K 1 ) T H E N 1690 IR=IM{I,K0):IC=IN(I,K1):FORK=K0TONN:T=Z(K,IR):Z(K,IR)=Z(K,IC) problem is that if a beta vaiue is used to 1670 describe a dependent source, then the 1680 Z ( K , I C ) = T : N E X T K 1690 NEXTI:IFPRANO2048THENGOSUB2600 resistance of the controiling branch must 1700 FORN=<K0TONN:NV(N)=K0:FORM=K0TONN:NV(N)=NV(N)'<-Z(N,M)^EQ(M) :NEXTM,N be previously defined. Otherwise, a 1710 IFPRAND256THENGOSUB2450 17S0 FORM=K0TONB:BV(M)=K0:FORM=K0TONN:BV(M)=BV<M)+M(M,N)*NV(M):NEXTN^M "divide by zero" error occurs when the 1730 IFPRANDK2THENGOSUB2700 expression above is e v a i u a t e d . So, 1740 FORI=K0TONB:BV(I)=BV(I)+ECI):NEXT:IFPRANDK4THEHGOSUB2800 d e p e n d e n t s o u r c e s a r e e n t e r e d 1750 F O R I = K 0 T O N B : C U ( I ) = K 0 : C U ( I ) = Y ( I ) * B V ( I ) - A < I ) : N E X T : I F N D ^ K M T H E N ! 7 9 0 1760 F O R I = K 0 T O N D : L = R W ( I ) : L 1 = C L ( I ) separateiy and only after alt other -1770 I F B V ( L 1 ) T H E N C U ( L ) = C U ( L ) + D < I ) * B V ( L ! ) branch data has been entered. Line 260 in 1780 NEXT the program does not tet the user enter 1790 IFPRANDS12THENGOSUB2900 1800 FORI=K0TONB:CU(I) = C U ( I ) + A ( I):NEXT:IFPRAND8THENGOSUB3000 any more branch data after one or more 1810 FORI=K0TONB:CU(I)^CU(I)*BV<I):MEXT:IFPRAMD16THENGOSUB31O0 1820 FORI=K0TONB:BV<I)=BV(I)-E<I):NEXT:IF(PRAND224)=K0THEN110 dependent sources are entered. 1830 F O R J = K 0 T O M N : T = N V ( J ) : W ( J ) = T : M L ( J ) = T : M H { J ) = T : S D { J ) = K 0 : N E X T The input line for dependent sources 1840 PV=K1 :F0RIT=K1T0K4:NU=NB! IFITOK2THEM1870 fotiows the format branch data. The first 1850 IFND=KMTHEN2360 non-space c h a r a c t e r is t h e letter I 8 6 0 NU=ND 1870 FORI=K0TONU:ONITGOTO1910,1910,1880,1900 " D " , followed by the dependent source 1880 IFE(I)=K0THEN2350 number. Next is a branch group with the 1890 GOTO1910 letter " B " , followed by two branch 1900 IFA(I)=K0THEN2350 1910 FORJ=K0TONN:NV(J)=K0:NEXTJ:ONITGOTO1928,!930,1940,1990 FOURTEEN C/N June. 1 9 7 7 1920 1930 1940 1950 I960 !970 i960 1990 2000 2010 2020 2030 2040 2050 2060 2070 2080 2090 2100 2110 2115 2120 T 1 = Y ( I ) * Y ( I ) * ( E < I ) + B V ( I ) ) : I I = I : T R = K 1 !GOTO2000 H = R M ( I ) : J J = C L ( I ) :T!=*- ( E ( J J ) + B V ( J J ) ) : T R = K 3 : G O T O 2 0 0 0 IFND=KMTHEN1980 F O R J = K 0 T O N D : I F I < > C L < J)THETM970 II=RM(J):T1=-D<J):TR=K4:GOTO2000 NEXTJ II=HT1=<-Y(I):TR=K3:GOTO2300 II=I:T1=K1:TR=K3 IFMI(II)=KMTHENNI=NN+K1:GOTO2020 NI=NI(II) IFNF(II)=KMTHEMNF=NN+K1:GOTO2040 NF=NF(II) FORM=K0TONN:NV{N)=NV(N)+(Z(N,NI)-Z<N,NF))*T1:MEXTN ONTRGOTO2060,2090,2100,1970 IFND=Kt^THEM2100 FORJ=K0TOND: I F K > C L ( J ) T H E N 2 0 9 0 II=RW(J) :T1=Y(I)=)=DCJ)*(E(H+BV(I)){TR=K2:GOTO230B NEXTJ IF(PRAND32)=K0THEN2240 IFPVTHSNPRINT:PRINT"*PARTIAL DERIVATIVES*":PV=K0 P R I M T : P H I N T " N O D E VOLTAGES WITH RESPECT TO " J 0HITG0T02130,2149,2150,2160 2150 2160 2178 2180 2190 2200 2210 2220 2230 2240 2250 2260 2270 2280 2290 2300 2310 2320 2330 2340 2350 2360 2370 2380 CNN 2390 2400 2410 2420 2430 2450 = KM 2460 2470 PRINT"VOLTAGE SOURCE IN B R A N C H " ; i + K H G 0 T 0 2 1 7 3 PRIMT"CURRENT SOURCE ACROSS B R A N C H " ; I + K l PRINT!ONITG0T02130,2190,2200,2210 T1=PC/Y(I):GOTO2220 T1=PC*D<I):GOTO2220 T1=PC*E{I):GOTO2220 T1=PC*ACI) PRINT"NODE M O . " , " P A R T I A L S " , " S E N S I T I V I T I E S " : P R I M T { F O R N = K 0 T O N N T=NV(N)*ABS(T1):PRINTN+K1,MV(N),T:NEXTN ONITGOTO2250,2260,2270,2280 T1=(Y<I)-YL(I))/(Y(I)*YL(I)):T2=(Y(I)-YH(I))/(Y(I)*YH(I)):G0T02299 T1=DH(I)-D(I):T2=DL(I)-D(I):GOTO2290 T1=EH(I)-E{I):T2=EL(I)-E(I):GOTO2290 T1=AH(I)-A<I):T2=AL<I)-A<I) T=T1-T2:FORJ=K0TONN:ONSGN<NV(J))+K1GOTO232*0,2310 WH(J)=WH(J)+NV(J)*T2:WL<J)=WL(J)+NV<J)*T!:GOTO2320 HH(J)=WHCJ)+NV(J)*T1:ML(J>=VL<J)+NV(J)*T2 NEXTJ:T=T*T/S6:FORJ=K0TONN:IFMV(J)=K0THEN2340 T1=NV{J):SD{J)=SD(J)+T1*T1*T MEXTJ NEXT! NEXTIT:IF(PRAND64)=K0THEN2400 PRINT : P R I N T " * W O R S T CASE NODE V O L T A G E S * " : P R I N T PRINT"NODE N O . " , " N O M I N A L C A S E " , " V . C . M A X " , " W . C . M I N " : P R I N T : F O R J = K 0 T n u m b e r s in parenthesis. The first branch n u m b e r is the controlling branch. The second is t h e branch in which the dependent source resides. The next v a i u e is the t r a n s c o n d u c t a n c e or beta v a l u e : G= defines t r a n s c o n d u c t a n c e and B = defines c u r r e n t g a i n . A s s u m e d units a r e o h m , mho, volt and a m p e r e . The following multipliers are avaiiable: K = kilohm, M = megohm, MV= m i l l i v o l t and M A = Numeric values can miHiampere. be in any form a c c e p t a b t e to BASIC'S V A L function. in m a n y cases it's desirable to obtain a " w o r s t c a s e " a n a l y s i s of a circuit. Circuit values a r e never absolute and v a r y in ranges, i.e. + 5%, + 10% etc. So 0 PRINTJ+K1,W(J),WH<J),WL(J):NEXT:PRINT:PRIMT IF<PRAND128)=K0THEMPRINT:PRINT:GOTO110 P R I N T : P R I N T " * S T A M D A R D DEVIATION OF NODE V O L T A G E S * " : P R I N T PRINT"MODE N O . " , " S T D . DEV.":PRINT:FORI=K0TONN PRINTI+K1,SQR(SD(I)):NEXT:PRIMT:PRINT:GOTO!10 PRINT:PRINT"*NODE VOLTAGES*":PRINT:PRINT"NODES","VOLTAGES":PRINT:LA the actual value installed in a circuit is u n k n o w n unless explicitly m e a s u r e d . A worst case a n a l y s i s allows c o m p o n e n t s with specified toierance to v a r y during evaiuation. To obtain a worst case analysis or standard deviation tolerance values of node for one voltages, or more p a r a m e t e r s should be entered. They are entered as m i n i m u m / m a x i m u m or a percentage nominai value, which and values follows the enclosed in parenthesis. Both types a r e shown in the s a m p l e runs. By specifying a tolerance on one or more key component values in the circuit, t h e effect on the possible range can be d e t e r m i n e d on the desired output. Numeric values must have some a c c e p t a b l e t e r m i n a t i n g c h a r a c t e r . Since the input is into a string and numeric values a r e extracted using V A L , some m e a n s of f i n d i n g t h e end of the n u m b e r is needed to continue the scan of the input K=LA+K1:LA=LA+K4:IFLA>NNTHEMLA=NN P R I N T K + m " - " L A + K ! , : F O R J = K T O L A : P R I M T N V < J ) , : N E X T : P R I M T : I F N M > L A T H E M 2 4 6 line. The first method I used w a s to 2480 PRINT:PRINT:RETURN 2 5 0 0 P R I N T : P R I N T " * N O D A L CONDUCTANCE M A T R I X * " 2510 PRINT:PRINT"ROM COLS.":PRINT:FORI=K0TONN:LA=KM 2 5 2 0 K=LA+K1::LA=LA+K4:IFLA>NNTHENLA=NN 2530 P R I N T : P R I N T I + K 1 " "K+K1"-"LA+K1,:FORJ=KTOLA:PRINTZCI,J),:MEXTJ:IFMN> LATHEM2520 2540 PRIMT:NSXTI:PRINT:PRINT:PRINT:RETURN 2 5 5 0 P R I N T : P R I N T " * E Q U I V . CURRENT V E C T O R * " : P R I N T : P R I M T " M O O E M O . " , " C U R R E N T 2 5 6 3 PRINT!FORI=*K0TOMN : P R I N T I + K 1 , E Q < I ) : N E X T I : : P R I N T :RETURN 2 6 0 0 P R I N T : P R I N T " * N O D A L IMPEDANCE M A T R I X * " : 6 0 T 0 2 5 1 3 2 7 0 0 P R I N T : P R I N T " * B R A M C H VOLTAGES*" 2710 PRINT:PR?MT"BRAMCHES","VOLTAGES":LA=KM 2 7 2 0 K=LA+K1:LA=LA+K4:IFLA>NBTHENLA=NB 2730 P3INT:PRINTK+K1"-"LA+K1,:FORJ=KTOLA:PRINTBV(J),:M6XTJ:IFNB>LATHEN27 20 c o m p u t e the number of c h a r a c t e r s a n u m b e r used on the input line using L E N ( S T R $ ( X ) + ( X ) = % ) . However, a n u m b e r entered as 4.25E3 causes the expression a b o v e to e v a l u a t e to L E N ("4250") + (-D = 4, o r two less characters than " 4 . 2 5 E 3 " . This m e t h o d did not work for exponential n u m b e r s . So ) decided upon another solution, which allows use of exponential n u m b e r s and m o r e flexible input. This final solution uses n u m e r i c vaiues immediateiy followed by some t e r m i n a t i n g c h a r a c t e r . The c h a r a c t e r s a r e space,/, ( , ) , % , K , M and end-of-input CONTtNUED tine. They are in K$ and are frequently used in t h e input string. C/N June, 1977 SEVENTEEN Sotution a n d Output 2740 PRINT:PRINT:RETURN T w e t v e v a t u e s a r e a v a i l a b l e f r o m t h e 3 8 0 0 PRINT:PRINT--*ELEMENT VOLTAGES*":GOTO2710 PRINT:PRINT"#BRANCH CURRENTS*":GOTO38!0 sotution. A n y c o m b i n a t i o n Of o u t p u t 3000 PRINT:PRIMT"*ELEMENT CURRENTS*" values can be specified by an input line 3010 P R I N T : P R I N T " 3 3 A N C H E S " , " C U R R E N T S " + DEHMT l o f t 3020 P R I N T : L A = m containing the word P R I N T , ' e f t ^ K=LA+K1:LA=LA+K4:IFLA>NBTHENLA=NB { u s t i f i e d , f o l l o w e d b y t w o - l e t t e r 3040 PRINTK+K1"-"LA+K1,:F0RU=KT0LA:PRINTCU(J),:NEXT.J:PRINT:IFN3>LATHEN33 abbreviations for each desired value. 30 f S . o Tahlc 1 1 The wnrH At ) fnllnwinn ^ ^ ^ PRINT:PRINT!RETURN ^ e e l a o i e 1.; t n e w o r a /it-t-Tonowmg P R I N T causes ail output to be printed. One variable, P R , is used to store the output information. E a c h bit of P R is set to a value of one for one specific output ^ ^ ^ PRIMT:PRINT"*ELEMENT POWER L O S S E S * " : P R I N T : P R I N T " B R A M C H E S " , " P O W E R SSES":GOTO3820 "" * * * * * S A M P L E R ^ OF ALTAIK DC ECAP 3/12/77 *,m*+sTARTING WITH THE C I R C U I T IN F I G . 2 LO type using the O R operator. The bits of RUN P R a r e tested using the A N D operator MODES? 2 A A A . BRANCHES? 3 w h e n d i f f e r e n t o u t p u t v a l u e s a r e p g p scs? 0 avaitabie. Any n u m b e r of P R I N T lines can be used anywhere in the input. ALTAIR DC ECAP The word R U N , left justified, starts ? R THE NODES AND BRANCHES HAVE ALREADY BEEN NUMBERED thesoiution. F i r s t a c h e c k i s m a d e t o s e e ? R . . ^ , A? R tf the m t n t m u m c o n d t t i o n s for a s o l u t i o n ^ BRANCH l HAS I N I T I A L NODE 0 AT^ FINAL NODE 1 N ( 8 / l ) R=3 E=24 have been met. Line 130 checks for a ? R BRANCH 2 HAS I N I T I A L NODE 2 resistance branch. or There conductance must (GROUND) in every ? ^ FINAL NODE ! ? B2 N C 2 / 1 ) R=4 least one ? R BRANCH 3 HAS I N I T I A L NODE 2 be at AND FINAL NODE 0 independent source, at least one branch ? R and at ieast one node. Line 1060 checks ? ? for specified output. ? A f t e r s o i u t i o n a n d p r i n t o u t is ? . . . A 1 n. ? compiete, the p r o g r a m returns to the ^ ^ ^ ^ ^ R FOR OUTPUT GET MODE VOLTAGES R AND BRANCH CURRENTS PRINT NV BC R READY FOR SOLUTION p ^ input routine. Several things a r e now possibie. "END" command returns level. " N E W " to BASiC * * SOLUTION restarts t h e * N ° ° E ** VOLTAGES* p r o g r a m f r o m the beginning and resets MODES VOLTAGES aii circuit va);ues. Since the solution does not a l t e r any input data, additional * * 2 *S 10 output can be specified and another R U N *BRANCH CURRENTS* m a d e . The print variable, P R , is reset to BRANCHES zero or no output after each Each RUN CURRENTS solution. produces only the output 1 * 3 2 -2 2 requested for that R U N . Modify ? R The word M O D I F Y , left j u s t i f i e d , ? ? increments the modtfy flag, variable ? MO. Data that changes component ? THE CURRENT IM BRANCH 2 I S NEGATIVE OR " R R R OPPOSITE IN DIRECTION TO THAT WHICH WAS ASSIGMBD NOV MODIFY THE C I R C U I T TO BS F I G . 3 values can then be entered. Changing a ? R T H E V O L T A G E S O U R C E iN B R A N C H 1 iS N O W 12 VOLTS vaiue to zero effectivety removes t h e ? R THE RESISTANCE IN BRANCH 3 I S NOW n OHMS component f r o m the circuit. New sources ? B3 R = n ,_ ^ . A R SET THE SAME OUTPUT c a n be e n t e r e d in a n y e s t a b t i s h e d ? PRtMT NV BC b r a n c h . N e w b r a n c h e s c a n n o t b e ? RUN entered. * * MODIFY To modify a branch, enter the letter ^ Q ^ g l ** VOLTAGES* " B " and the branch n u m b e r . O m i t the node g r o u p and enter the new values i n , " ° ° E S this branch. Component values that wilt not be c h a n g e d can be o m i t t e d . To ^ : - 2 ^ VOLTAGES 10 7.33333 CURRENTS* modify a dependent source n u m b e r , o m i t the branch group and enter n e w BRANCHES transconductance or beta vaiues. if beta CURRENTS .666667 -.666667 .666667 values a r e entered, the resistance in the controiiing EIGHTEEN branch shouid be changed C/NJun6. 1977 ? ? ? ? ? ? ? ? T ? ? 7 H MODIFY IT AGAIN TO BE F I G . MODIFY B I R=5 E=-24 R THE VOLTAGE SOURCE IN F I G . R I S OPPOSITE IN POLARITY TO R STANDARD BRANCH ( F I G . I) B3 E=12 R=6 R INCLUDE BRANCH VOLTAGES IN PRINT BC R FORGOT SOME PRINT NV BV RUN MODIFY 2 first 4 4 BRANCH THE the "B" command, if the Once the word M O D ) F Y is entered, I only circuit performed. modifications However, they can be can be performed as m a n y times as necessary. THE OUTPUT If the ability to a d d branches to the circuit is necessary, the p r o g r a m must be changed to allow the modify flag, M O , to be reset to zero. ** Subroutines a r e used for printing alt *NODE VOLTAGES* MODES with resistance is changed at ait. output except partiai derivatives, worst VOLTAGES I - 2 -20 *BHAMCH VOLTAGES* case and standard deviation, which a r e computed only if output is requested. -16.8 Genera) P r o g r a m Description Lines 10 to 110 set up the p r o g r a m . BRANCHES ' VOLTAGES - 3 Function FNI m i n i m i z e s its a r g u m e n t to 20 BRANCHES 3.2 -16.8 zero, avoiding a FC error in the D ) M statements. Three input statements get CURRENTS maximum nodes, dependent ? R WANTED RESISTOR ? PRINT EC ? RUN * * MODIFY 2 *ELEMENT CURRENTS TOO different sources memory execution, branches to sizes. variabies and accommodate To are speed used for constants. ** Lines 120 to 570 process the input CURRENTS* line. " R " as the first character on the BRANCHES I CURRENTS - 3 line causes the line to be ignored and can -.8 .6 -.8 ? R NOW ANALYZE THE SINGLE STSGE COMMON EMITTER ? R A M P L I F I E R IN F I G . 5 ? R THE E9UIVALENT C I R C U I T I S SHOWN IN F I G . 6 ? R CAPICATORS HAVE BEEN REPLACED ? R WITH OPEN C I R C U I T S AMD THE 2N657 ? R TRANSISTOR WITH I T ' S EQUIVALENT. ? R THERE ARE THREE NODES-SIX BRANCHES7 R AND ONE DEPENDENT SOURCE. 7 R HAVE TO START OVER-7 NEW NODES? 4 BRANCHES? 9 DEP SCS? 3 SOLUTION ** 470. The next non-space character of a continuation line must be R, G, E or h Dependent source input tines cannot be continued. The processing of an input tine is simple. Look for " B " or " D " , find its numbers range group, check the and then extract p a r a m e t e r vatues, putting them in the appropriate carried matrix. internalty Resistance is as conductance. At line 510 m i n i m u m - m a x i m u m resistance tolerances become m a x i m u m - m i n i m u m conductance tolerances. The subroutine at line 600 contrcfts extraction of n u m e r i c vatues. tt has three entry points at lines 600, 610 and 620 n u m b e r s ) , two n u m b e r s in parenthesis (node or branch group) or both ( n o m i n a i fint 1 1 - 3 4.0238IE-03 0 -2.857!4E-03 2 1 - 3 .142857 5.9009E-04 -.142947 3 1 - 3 -.145714 -9.0090IE-05 .147804 CONTINUED C/NiJune. 1977 the p a r a m e t e r extraction routine at line to extract a single value ( " B " or " D " *NODAL CONDUCTANCE MATRIX* HUM of the previous line and causes a j u m p to the node or branch R T H I S TIME INCLUDE TOLERANCE VALUES FOR R WORST CASE ANALYSIS AND STANDARD DEVIATION R B I N ( 0 / 2 ) R = 2 K ( 7 X ) E=*20(5S) B2 N ( 0 / I ) R = 6 K ( 7 ^ ) * E=20<19/21) B3 N ( 0 / I ) R = I 0 0 0 ( 7 S ) B4 N ( I / 3 ) R = 3 5 0 ( 1 8 3 ) E=-500MV B5 N ( 3 / 0 ) R = 5 0 0 ( 4 6 5 / 5 3 5 ) B6 N < 2 / 3 ) R = ! l . ! E 3 ( t 0 % ) D! B ( 4 / 6 ) B=50(I0X) PRINT ALL RUN ** Using an asterisk as the first character indicates that this iine is a continuation n u m b e r , check the n u m b e r ' s range, find ALTAIR DC ECAP ? ? ? ? ? ? ? ? ? ? ? ? ? be used to insert r e m a r k s into the input. and tolerance values). Subroutine 790 to 890 extracts vatues, finds their length on the input line and retrieves the multiptier, if present. The value is returned in T1 and the^muitipiier value in M U . n NtNETEEN Lines 900 to 940 handle the P R I N T input line. Each two-letter group is "NODAL IMPEDANCE MATRIX* ROW COLS. compared to aitowed commands in P$ by loop variable K. When a c o m m a n d is 1 - 3 found, K has the bit number that needs to ! be set to one. Two raised to the power K has the decimal equivalent needed in BASiC. Using the OR operator to set the bits doesn't change any bits already set. Setting the same bit more than once has no effect either. Lines 1000 to 1040 a r e error messages. Error detection is limited and is not recoverable except when an error occurs at the beginning of the input iine in a " B " or " D " number. Lines 1100 to 1130 set up matrix M — the nodal connectivity matrix, it is set to _+ 1 or zero, indicating which branches are'connected with which nodes. The values indicate: 1 = initiat node, -1 = 3 - 3 1 - 3 823.889 2.85272 18.6852 -3163.61 1977.27 1851.14 810.31 4.01752 26.3149 U.0728 2.26853 -2.79423 .525696 -2.79423 .0256958 +NODE VOLTAGES* MODES VOLTAGES 1 - 3 2.79423 *BRANCH VOLTAGES* BRANCHES VOLTAGES 1 - 4 -11.0728 -2.79423 5 - 6 2.26853 * ELEMENT VOLTAGES* 8.80427 BRANCHES VOLTAGES 1 - 4 8.9272 branch. If one node of a branch is ground, 5 - 6 2.26853 *BRANCH CURRENTS* no information is entered into matrix M . BRANCHES finai node and 0 = node not connected to 17.2058 8.80427 CURRENTS Instead, it is implied by the absence of 1 - 4 4.4636E-03 ^ELEMENT CURRENTS* one node. 2.86763E-03 -2.79423E-03 2.79423E-03 2.86763E-03 -2.79423E-03 7.34167E-05 Lines 1200 to 1290 set up matrix Z — the nodal conductance matrix. Z is a square matrix with dimensions max. BRANCHES 1 - 4 CURRENTS 4.4636E-03 nodes +1 by max. nodes +1. Its vaiues are the conductance between the nodes indicated by the subscripts. When the subscripts are the same, vaiues on the major diagonal give the conductance from the node to ground. 5 - 6 4.53706E-03 ^ELEMENT POWER LOSSES* BRANCHES 1 - 4 4.46401E-03 POWER LOSSES .0398475 .0493398 .0102925 DERIVATIVES* .0393023 transconductance values to matrix Z if 5 - 6 *PARTIAL there are any dependent current sources NODE VOLTAGES WITH RESPECT TO RES. Lines 1300 to 1380 add 7.80771E-03 1.8865E-06 IN BRANCH 1 In the circuit. Lines 1400 to 1430 c o m p u t e the current for each branch in matrix CU. Lines 1440 to 1450 p r o d u c e EQ=M*CU — an equivalent matrix current vector for each node. 1690, changing Z to a nodal impedance matrix. There are node resistances in matrix Z and equivalent node currents in matrix EQ. The product N V = Z * E Q is taken at iine 1700, setting the NV matrix to node voltages. (Ohm's Law) 1720 t a k e s t h e difference between initial and finai node voitages and gives branch voitages in matrix BV. Resistor (element) voltages are computed at iine 1740. The source voitage is added to the branch voltage. Resistor voitage is a voltage drop, and source voltage is a voitage rise or negative FOURTEEN 1 2 3 PARTIALS SENSITIVITIES -6.36671E-06 -4.41288E-03 -8.9663E-06 -1.27334E-04 -.0882576 NODE VOLTAGES WITH RESPECT Matrix Z is inverted at lines 1500 to Line MODE NO. MODE NO. 1 2 3 PARTIALS -3.93768E-04 1.51201E-03 -3.87278E-04 -1.79326E-04 TO RES. SENSITIVITIES -.0236261 .0907207 -.0232367 NODE VOLTAGES WITH RESPECT TO RES. NODE NO. IN BRANCH 2 IN BRANCH 3 PARTIALS SENSITIVITIES 2.30213E-03 -8.S39SSE-03 2.26419E-03 .0230213 -.0883985 .0226419 MODE VOLTAGES WITH RESPECT TO RES. IN BRANCH 4 NODE NO. PARTIALS SENSITIVITIES 2.84905E-96 2.70973E-04 -6.94049E-05 9.97166E-06 9.48406E-04 -2.42917E-04 C/N June. 1977 MODE VOLTAGES WITH RESPECT TO RES. MODE NO. 1 2 3 *E*UIV. PARTIALS 1.69551E-04 .0167975 2.38785E-04 CURRENT VECTOR* voltage drop. This is refiected in Fig. 1 by IN BRANCH S the source and resistor voltages that are SENSITIVITIES opposite in polarity. The branch voltage S.47757E-04 .0339875 1.19392E-03 is the sum of the voltage drop in the branch or BV = EV + (-E) and EV = BV + E. Lines 1750 to 1780 compute branch MODE NO. 1 2 3 CURRENT currents in matrix CU by using O h m ' s 4.7619E-03 .0814286 -.0728571 adding the dependent current source and Law (!-E*G) to find the resistor c u r r e n t subtracting NODE VOLTAGES WITH RESPECT TO RES. MODE MO. IN BRANCH 6 the independent current source. The independent current source is subtracted rather than added, because PARTIALS SENSITIVITIES 1 2 -1.13134E-06 9.0I302E-06 -I.25579E-04 I.30045E-03 current. 3 -1.59331E-06 -1.76858E-04 source back it is opposite in direction from the branch By adding the independent current NODE VOLTAGES WITH RESPECT TO GM. BRANCH 4 TO BRANCH 6 NODE MO. PARTIALS SENSITIVITIES 21 . 4. 2 06 -3 48 12 07 5 I 8027E - 45..683I 0 E-0 04 3 3 .57295 in at line 1800, resistor currents are computed in matrix CU. Line 1810 computes the power iost in each resistor as the product of resistor current and voltage. Line 8.185E-04 1820 returns matrix BV to branch voltages. Lines 1830 to 2240 compute partia! MODE VOLTAGES WITH RESPECT TO VOLTAGE SOURCE IN BRANCH I derivatives of node voltages with respect NODE NO. PARTIALS SENSITIVITIES to each circuit parameter. They also 21 26 63 36 .19.84 8 7E-03 85 .21. 9 72 77 22 7E - 0 4 compute 3 2.00876E-03 4.01752E-04 for NODE VOLTAGES WITH RESPECT TO VOLTAGE SOURCE IN BRANCH 2 PARTIALS SENSITIVITIES 21 37 72 36 19 5 - .. 51 2 3 - ..100257 44 56 4 3 .135052 sensitivity coefficient a one percent change in the voltages are parameter value; Worst NODE NO. a representing the change in node voitage case node computed at lines 2240 to 2310. Lines 2240 to 2280 produce toierance values with m a x i m u m tolerances being positive and .0270103 m i n i m u m tolerances negative. A worst NODE VOLTAGES WITH RESPECT TO VOLTAGE SOURCE IN BRANCH 4 case m a x i m u m vaiue is computed as the sum of the products of partial derivatives NODE NO. PARTIALS 2t - .30. 3 68 98 00 86 97 3 .945336 SENSITIVITIES and toierance values when both terms -1 . 0. 91 48043534E5- 0 4 are positive. A m i n i m u m vaiue is the sum 4.72678E-03 when both t e r m s are Assuming that the partia! negative. derivatives are nearly constant over the toierance *WORST CASE NODE VOLTAGES* range, the worst case analysis is within NODE NO. NOMINAL CASE 1 2 3 2.797 42 28 3 21.12. 60 8 53 W . C . MAX 3 . 2 85 01 69 21.57. 51 8 74 W.C. MIN about three percent of actual values, in 2 .. 9 314 021 6 1 . 77 8 19 67 3 other wor(js, keeping tolerance values small (10% or less) keeps the worst case analysis within three percent of actual *STANDARD DEVIATION OF MODE VOLTAGES* NODE MO. STD. 1 2 3 DEV. .0896619 .555564 .0883014 values. If larger tolerances need to be used or more accurate results are desired, use direct substitution of partial RUN ? R MO MORE TO DO ? END minimum/maxi- m u m values according to the sign of the derivative again. procedure in a M O D I F Y Be s u r e to r e p e a t for each parameter. and the The anaiysis used in this program has the advantage of giving results directly from the nominal solution. CONTINUED C/N Juna. 1377 TWENTY-ONE Lines standard based 2320 to deviation on partial 2330 compute of node a voltages derivatives and tolerance values. The sample solutions that foiiow were run on an Aitair 8800b with 16K memory. I used Aitair 8K BASiC (versions 3.2 and 4.0) with some m e m o r y to spare. Processing an input line of branch data requires about three to 10 seconds, depending on the n u m b e r of values. The complete output in the s a m p l e run took about 15 minutes to print on a 110 baud terminal. By using 4.0 BASiC, input can easily be saved for large circuits. Readers who a r e u n f a m i i i a r with etectronic circuit analysis should look for a simpie electrical engineering or network anaiysis text. For more applications, TRONIC GRAM information read CIRCUIT (ECAP; IBM's 1620 ANALYSiS 1620-EE-02X) on ELECPRO- USER'S M A N U A L (publication n u m b e r H20-01701) or iBM ANALYSIS AND ELECTRONiC PROGRAM APPLICATIONS, Lieberman, CIRCUiT TECHNIQUES Jenren Prentice-Hall, Englewood Cliffs, N . J . Table 1 Available Output NV Node voltages BV Branch voltages EV E l e m e n t voltages BC Branch currents EC Element currents PL E l e m e n t power losses PD Partial derivatives WC Worst case analysis SD Standard deviation CM Nodal conductance m a t r i x IM Nodal impedance m a t r i x CV Equivalent current vector ALL All the above and Inc., Variable list M O - M o d i f y flag MN - M a x i m u m n o d e s MB - M a x i m u m b r a n c h e s MD - Maximum dependent sources M(MB,MN) - Connectivity matrix N I ( M B ) - I n i t i a l n o d e of b r a n c h ME N F ( M B ) - F i n a l n o d e of b r a n c h MB Z{MN+1,MN+1) - N o d a l conductance matrix Nodal impedance matrix Y ( M B ) - C o n d u c t a n c e in b r a n c h M B Y L ( M B ) - M i n i m u m c o n d u c t a n c e in b r a n c h M B Y H ( M B ) - M a x i m u m c o n d u c t a n c e in b r a n c h M B C U ( M B ) - C u r r e n t in b r a n c h MB A ( M B ) - N o m i n a l c u r r e n t s o u r c e in b r a n c h MB AL(MB) - Minimum " " AH(MB) - Maximum " E ( M B ) - N o m i n a l v o l t a g e s o u r c e in b r a n c h MB EL(MB) - Minimum " " EH(MB) - Maximum " " D(MB) - N o m i n a l t r a n s c o n d u c t a n c e in b r a n c h MB DL(MB) - Minimum DH(MB) - Maximum " E Q ( M N ) - E q u i v a l e n t c u r r e n t v e c t o r for n o d e MN IP(MN) - C o u n t e r s for m a t r i x i n v e r s i o n I N ( M N , 1 ) - S u b s c r i p t s of m a t r i x Z s h o w i n g M a x i m u m v a l u e s N V ( M N ) - N o d e v o l t a g e of n o d e MN B V ( M B ) - B r a n c h v o l t a g e of b r a n c h M B W(MN) - Nominal node voltages WL(MN) - Worst case minimum node voltages MH(MN) " " maximum " " R W ( M D ) - R e s i d i n g b r a n c h of d e p e n d e n t s o u r c e C L ( M D ) - C o n t r o l l i n g b r a n c h of d e p e n d e n t c u r r e n t s o u r c e SD(MN) - S t a n d a r d d e v i a t i o n of n o d e v o l t a g e s s q u a r e d D $ , K $ , C $ , P $ - c o m p a r i s o n c h a r a c t e r s for i n p u t KM,KP,K1,K2,K3,K4,K5,K6,K7,K9,PC,CT,CM,CI,S6 - constants NN - N u m b e r o f n o d e s in this c u r c u i t NB " " branches " NY " " r e s i s t a n c e s ( c o n d u c t a n c e s ) in this c u r c u i t NE " " v o l t a g e s o u r c e s in t h i s c i r c u i t NA " " i n d e p e n d e n t c u r r e n t s o u r c e s in t h i s c i r c u i t PR - output flags X$ - input line L - L e n g t h of X $ I - C h a r a c t e r p o i n t e r in X $ , L o o p v a r i a b l e J , K , L , M , N , L 1 , I T , I I , J J - loop v a r i a b l e s TY - T y p e of c u r r e n t i n p u t line X - p r e s e n t b r a n c h or d e p e n d e n t s o u r c e n u m b e r T - Temporary nominal value TL " minimum " TH " maximum " T T - T y p e of c u r r e n t p a r a m e t e r NI,NF,T1,T2 Temporary variables ZZ - R e t u r n flag for s u b r o u t i n e 600 MU - Multiplier value L A - L a s t v a l u e t o be p r i n t e d on this line PV - current pivot 24V 12 BC = branch current TWENTY-TWO C / N Jurte, 1 9 7 7 by locations F F F E and F F F F resets the ACIA 630b isoiating problems in the Aitair 680b is sometimes interaction difficult between due to hardware would and Location then jump examines of h a r d w a r e to 0000 instead location F002. F002 is the a d d r e s s of the programmable the outputting to the t e r m i n a l . Bad m e m o r y , t e r m i n a l / n o and particularly in locations 00F3-00FF, can bits terminal, (i.e. Baudot/no Baudot, etc.). The M P U stores this bit software. The Aitair 680b m a y fai! to throw the M P U off (the stack pointer is pattern f r o m location F002 along with operate for several Bit 7 of stored in one of these locations). If the other information into locations OOF3- location F002 m i g h t be high and the 6800 6800 can't access the proper instructions O O F F . If bit 7 ( t e r m i n a l / n o t e r m i n a l ) is reasons. .from the P R O M monitor, the 680b can go high, the M P U branches to iocation 8000 into a wild run condition. Finally, if the and starts execution. If bit 7 is low, the ACiA the M P U examines the n u m b e r of stop bits isn't initialized or working, indicated by location F002 and sends this 680b m a y not output. Troubleshooting these problems for information to the A C I A . When the A C i A procedures are covered this is Ready to output, the M P U then outputs in article, following a brief expianation of the p r o m p t character. the Reset and Monitor operations during Troubieshooting 1. Halt the 680b and e x a m i n e location Reset. (The Baudot option monitor is not _12 here. However, those users F002. Data bits 5 and 6 should be high. described with the Baudot option should be able to D a t a bits 1, 2, 3, 4 a n d apply this information to their systems.) c o r r e s p o n d 6800 microprocessor can option is set. be p r o g r a m m e d to start executing at any memory iocation. This differs b. Bit 2 will be low if 2 stop bits are signif- set and high for 1 stop bit. icantly f r o m the 8080 microprocessor, in -Vs T which 2K the 8080 p r o g r a m counter c. Bits 3 and 4 are not used and a r e is n o r m a l l y set low. cieared with reset and execution starts at 6K location 0. The 6800 is reset when R E S d. Bit (reset - pin 40 of the 6800) is low for eight retrieving the contents of IK information into the program counter. The then starts execution at unit (MPU) the location indicated by the p r o g r a m counter. Notice that in the Aitair 680b, locations F F F E a n d F F F F a r e located inside the P R O M N0 monitor. 20 When T [3 the 6800 microprocessor is hatted and the Reset switch is held, V M A is tow, BA and ?2K R/W are high (read state), and the address bus contains the restart address F F F E . Address N2 lights A1-A1S are then on, and the AO tight is off 6E when the Reset switch is held. When the B R u n / H a l t switch is moved to Run, the 11. IK Dl from FFFE and FFFF, part of the p r o g r a m counter and the byte ijp ET reads storing the byte in F F F E in the upper / IK 6800 N3 Bj Loo in location F F F F in the lower part of the p r o g r a m counter. The 6800 then j u m p s to the location pointed to by F F F E EJ FFFF. -i-W *r* N0 C / N J u n e . 1 9 7 7 ONE and Monitor Operation During Reset termlnai If the data lights do not m a t c h the above list, check for shorts and bad iCs. IC R R should be enabled with a low at pins microprocessing be low for option. memory iocation F F F E and F F F F and loading 7 will option and high for no t e r m i n a l clock periods. A reset operation invoives this 7 should hardware- a. Bit 1 will be low if the no Baudot After the Aitair 680b is powered up, - J r the p r o g r a m m a b l e straps set by the user. Reset the to 1 and 15. The inputs of iC RR correspond to the h a r d w a r e straps. If IC R R is not enabled IC X is usually at fault. 2. Try the 680b first in no terminal option with the foliowing j u m p routine. Jump 0000 7E 1 00 2 -amp 00 If the 680b f a i l s to e x e c u t e it properly, e x a m i n e all the locations in the PROM, FFFE particularly and locations FFD8-FFF4. FFFF, The data in these locations should match the listing given in the System Monitor M a n u a l . If not, do the following. a. Check address gating at pin 14 (chip select) for the PROM. E x a m i n i n g addresses f r o m FF00F F F F should result in a low at pin 14. * When running, only AO & 1 should be lit. When the 6800 starts executing the CONTINUED instructions, the instructions pointed to TWENTY-THREE M a w CONTINUED T e c h n i q u e s b. Check each address line on the tocation 000B. This p r o g r a m is designed components or if the A C t A is not reset P R O M by separately lifting u p A0- to be run when the 680b is strapped for no with software. A7 and terminal monitoring the PROM which 7. Users with 680b-BSM cards who address pins. If a line fails to go activate the A C t A can be seen. Notice a r e trying to check the write w a v e f o r m s high with the address switch, so that the inputs that if 41 is in tocation 000B, the tetter U is can use any p r o g r a m that continuously check for shorts. Shorts between output. The A S C i ) writes into m e m o r y . address letter lines can be found by bit pattern for the U is 01010101, resulting in an The p r o g r a m usuatty put in the working IK is RAM. trying combinations of addresses. atmost s y m m e t r i c a l square w a v e at pin 6 Tabte 5 contains a p r o g r a m that witt c. Check the power and ground to the of the A C I A . Any putses or levels which write whatever is in tocation 0001 into an P R O M . Note that the -9v shoutd be do not m a t c h Table 1 indicate a problem. address of the 680b-BSM card. at least -9v at the bottom of the 5. The 680b m a y ripple. d. Check the data f r o m the P R O M letter or p r o m p t character if the 6800 the microprocessor INTRODUCTtON TO COMPUTERS Osborne and the data buffers W W and Y Y . register futt These buffers shouid be enabled. status e. Chip select RAMs) (pin should 13 of the 2102 not be low ACtA address FFOO-FFFF. sees a The looping, to indicate that transmit. transmit indication register. continuousty for The by t h e data ACtA MPU may be waiting for the it is ready program in Table to 3 deposits the status in tocation 0020 since f. The M P U R / W line should be high when the 680b is halted. Check the it cannot be checked when the 680b isn't halt state levels of the 6800 as running. shown in the following list. For further repair probtems, contact never output the MtTS Associates PUTER Repair and SYSTEM Department. by M6800 AN MICROand MtCROCOM- DESiGN DATA by Motorota a r e atso excel tent references on the operation of the 6800 and its f a m i l y of chips. R u n the p r o g r a m for a m o m e n t , then stop the 680b and e x a m i n e tocation 0020. Data bit 1 shoutd be high, indicating a ready to t r a n s m i t condition, and data bit 0 shoutd be tow if no data has been sent to the 680b. D a t a bits 2 and 3 shoutd be tow. tf incorrect, check to see if A C t A pins 23 and 24 a r e low (which they should be), tf bit 1 is low, the A C t A was not reset RAM property. Check the data tines f r o m the m e m o r y exists in location 0000-00FF by 6800 to the A C t A for shorts or opens 3. M a k e depositing sure t h a t w o r k i n g into each bit separateiy. (especially D O and D l ) „ Recheck the Locations 00F2-00FF a r e used by the signals to the A C t A . Highs in bits 4, 5 an{t PROM 6 indicate transmission errors. bytes monitor such echo/no as echo for various breakpoint and the software address, 6. tf the A C t A w!tt output but not pointer. input, run the p r o g r a m in Tabte 3 a n d stack M a k e sure that these tocations work and check are separate f r o m all other locations by printing periods for proper tetters typed the status, tf the 680b keeps iifting up each address switch one at a to it (like M , N or J ) , then the ASCtt t i m e and checking to see if only the codes corresponding for these tetters a r e probabty lights. If an LED distorted. The p r o g r a m in Tabte 4 can does not light, check for shorts. (For hetp isolate this problem. information LED on deposit problems, see "Troubleshooting the 680b," September CN, pp. 6-7 and 10^ 4. Unfortunately, W h i l e running the p r o g r a m , type one character on the t e r m i n a i . Stop the 680b and e x a m i n e tocation 0020. C o m p a r e the the AC IA status bit pattern on the data tights to the ASC11 and data register can't be checked with code for that character, tf they do not the 680b in the halt state, because V M A is m a t c h , took for shorts on the data lines. low when the M P U is hatted, if the A C t A Pin 2 of the A C t A shoutd go tow when the is not reset property or given correct character is typed, otherwise check t/0 seriai wiring, tf pin 2 of the A C t A is atways tow, information, the 680b m a y not output the prompt character. the A C t A witt think it is atways Receiving Check the inputs to the ACtA for the a character, tf a TetetypeTM is used as halted state as listed in Table 1. Tabte 2 the t/0 terminat, it wit! run open. Pin 2 shows a p r o g r a m which initializes the coutd be tow permanentty due to shorts, ACiA improper and character constantly whose TWENTY-FOUR ASCI) outputs code the is in ptacement of components (check R204 if TTY is used), bad t/0 C / N J u n e . 1 9 7 7 ONE !t's a jung!e out there, crawling with publications that deal with every aspect of home and business computing from spacey games to inventory, accounting and process control. There's a lot you need to know to find your way around. computer notes" COMPUTER NOTES offers a monthly survival kit of easyto-understand features on computer hardware, software and unique applications. CN is published by IVHTS, inc., the Aitair^ people. Each issue is a combination of articles written by knowledgeable free-lancers and experienced MITS engineers, designers and software specialists. Whether you're currently a microcomputer "expert" or just taking those first scary steps into the jungle, be sure to take COMPUTER NOTES with you. You may need it. TUCSON, AZ, 8 5 7 1 1 4 9 4 1 East 29th St. (602) 748 7363 BERKELEY, CA 9 4 7 1 0 (415)-845-5300 ^ SANTA M O N I C A , C A 9 0 4 0 1 820 Broadway (213) 451-0713 W I N D S O R LOCKS, CT 0 6 0 9 6 6 3 South Main Street (203) 627 0188 DENVER, C O 80211 2 8 3 9 W. 4 4 t h A v e . (303)-458-5444 ATLANTA, GA 3 0 3 0 5 3330 Piedmont Road (404)231-1691 P A R K R I D G E , )L 6 0 0 6 8 5 1 7 Talcott R o a d (312) 823 2388 BURLINGTON, MA 01803 120 C a m b r i d g e Street ( 6 1 7 ) 272-8770 A N N A R B O R , Ml 4 8 1 0 4 3 1 0 East Washington Street (313)995-7616 M A D t S O N H E I G H T S , M) 4 8 0 7 1 505-507 W e s t 11 Mile S t . (313) 545 2225 EAGAN, MN 55122 3 9 3 8 B e a u D ' R u e Drive (612) 452 2567 ST. L O U I S , M O 6 3 1 3 0 8 1 2 3 - 2 5 Page Blvd. (314) 427 6116 DAYTON, OH 4 5 4 1 4 5 2 5 2 N o r t h Dixie Drive (513)-274-1149 TULSA, OK 7 4 1 3 5 5 3 4 5 E a s t Forty First S t . (918)-664-4564 BEAVERTON, OR 97005 8 1 0 5 S W Nimbus Ave. (503)-644-2314 DNCOLN, NB 68503 6 1 1 N. 2 7 t h S t . Suite 9 (402)-474-2800 CHARLOTTE, N.C. 2 8 2 0 5 1 8 0 8 E. I n d e p e n d e n c e B l v d . (704)-334-0242 a!tair computer centers ALBUQUERQUE, NM 87110 3 1 2 0 S a n Mateo N.E. (505) 8 8 3 8282, 883-8283 ALBANY, NY 12211 269 Osborne Road (518) 459 6140 NEW Y O R K . N Y 1 0 0 1 8 55 West 39th Street ( 2 1 2 ) 2 2 1 1404 DALLAS, TX 7 5 2 3 4 3 2 0 8 Beltline Road. Suite 2 0 6 ( 2 1 4 ) 2 4 1 - 4 0 8 8 Metro-263 7 6 3 8 HOUSTON, TX 77036 5 7 5 0 Bintliff Drive (713) 780 8981 R I C H M O N D , VA 2 3 2 3 0 4 5 0 3 West Broad St. ( 8 0 4 ) -335 5 7 7 3 S P R I N G F I E L D , VA 2 2 1 5 0 6 6 0 5 A Backlick Road ( 7 0 3 ) 5 6 9 1110 C H A R L E S T O N , W.VA. 2 5 3 0 1 S u i t e 5^ 6 (304)-345-1360 ^ - c o m p u t e r n o t e s 3 3 3 0 Peachtree R o a d . Suite 3 4 3 Atlanta. Georgia 3 0 3 2 6 6 DuDEA^S 2450 A l a m o S . E . A l b u q u e r q u e . N e w M e x i c o 87106 S5.00 ($20 OO overseas) enclosed Please send m e a 1 year subscription t o C o m p u t e r $ 5 . 0 0 per year in U.S. $ 2 0 . 0 0 per year overseas. ill I have m o v e d ! NAME: ADDRESS: CITY: : . STAT)-. COMPANY/ORGANIZATION D Check Enclosed MCorBAC/Visa#_ - .. ^ D Master C h a r g e D BankAmericard/Visa Signature ZIP Notes. Have you written Software for your Attair Computer? The Aitair 8 8 0 0 c o m p u t e r was the first micro produced for the general public and remains number o n e in sales, with m o r e than 8 , 0 0 0 mainframes in the field. The wide acceptance of the Aitair computer and its rapid adaptation to many diversified applications has truly turned the dream of the affordable c o m p u t e r into a reality. Yet the machine itself, remarkable as it is, represents only the beginning. The right Software, tailored to meet a user's specific requirements, is a vital part of any c o m p u t e r system. IVIITS wants to insure that Aitair users everywhere have the best applications software available today and in the future. For this reason, a new MITS subsidiary, the ALTAIR SOFTWARE DISTRIBUTION COMPANY, has been formed. Its purpose: to acquire the highest quality software possible and distribute it nationally through Aitair C o m p u t e r Centers. That's w h e r e you c o m e in. The A S D C will pay substantial royalties to the originators of all software accepted into the A S D C library. If you have written business, industrial or commercial use software for the Aitair 8 8 0 0 , A S D C wants to hear from you. It is the aim of the A S D C to stimulate and reward creativity in producing useful software that makes those dreams of "computers for everyone" c o m e true. The A S D C will select only software that measures up to its high standards for system design, coding and d o c u m e n t a t i o n . The software will then be further d o c u m e n t e d and distributed through ^ ^ ^ ^ ^ ^ ^ Aitair Computer Centers around ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ the country. For more information on h o w to ^ H H H ) ^ ^ ^ ^ submit software to the A S D C , H HHHHH) H ask your Local A l t a i r C o m ^ y ^ ^ t ^ y ^ ^ p u t e r Center for an ASDC Software Submittal or contact the ALTAIR W A R E DISTRIBUTION COMPANY. ALTAIR S O F T W A R E DISTRIBUTION C O M P A N Y 3 3 3 0 Peachtree Road. Suite 3 4 3 Atlanta. Georgia 3 0 3 2 6 404-231-2308 see next p a g e for a listing of Aitair C o m p u t e r Centers