523 73 215MB
English Pages [484] Year 1980
D r. D
oBB'S
ToURNALof
COMPUTER (Calisthenics
O r th o d o n tia
Running Light Without Overbyte
A Reference Journal for Users of Home Computers
V olu me Two
[T5 The People’s Computer Company Series
Dr. D obb’s Journal of Computer Calisthenics 6 Orthodontia, Volume Two
D r. D o b b s
JouuNALof
COMPUTER (Calisthenics ^
O rth o d o n tia
R u n n in g Light Without O v e r b y te
A Reference Journal for Users of Home Computers
V olum e Two
|j|2 The People’s Computer Company Series
[¥ 1
H A Y D E N B O O K C O M P A N Y , IN C .
I H I R ochelle P a rk , N e w J e rs e y
Acknowledgments Profuse thanks to all the authors and readers who contribute articles and share ideas with Dr. D obb’s. Dr. D o b b ’s Journal, distributed worldwide, owes its existence to you. Thanks also to the employees and other supporters o f People’s Computer Company who have seen Dr. D o b b ’s through its inception, growing pains and success. Full-page computer art by David Dameron. Linocut o f griffin by Wendy Palmer. The mythological griffin, half lion and half eagle, has long stood as an enemy o f ignorance.
ISBN 0-8104-5484-X
Copyright © 1 9 8 0 by People’s Computer Company. All rights reserved. No part o f this book may be reprinted, or reproduced, or utilized in any form or by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying and recording, or in any information storage and retrieval system, w ithout permission in writing from the Publisher. Printed in the United States o f America
1
2
3
4
80
81
82
83
5
6 84
7 85
8 86
9 87
PRINTING 88
YEAR
Editor’s Prefa ce
The second volume o f Dr. D o b b ’s Journal is being compiled quite some time after the pub lication o f the magazines it contains. That makes it possible to write a preface with some degree o f perspective. By contrast w ith the contents o f Volumes 1 and 3, this volume provides a pic ture o f an industry’s growing pains. Microcomputers were still very m uch the domain o f hobbyists and technology junkies in early 1977, but, during the course o f that year, computers began to emerge as useful tools for home and business. At the same time, Dr. D o b b ’s found itself acting as a consumer ad vocate in a market that was beginning an era o f explosive growth. In late 1977, it was m y privilege to fo llo w e r D o b b ’s founder, Jim Warren, as editor; I walked right into the middle o f a world o f dazzling machines, selfless people exploring diffi cult systems for the love o f the science itself, and fast-talking carny barkers. Since it seemed that the field genuinely needed a publication to speak for the consumer, Z>. D o b b ’s began to publish independent product reviews and reports on delayed deliveries, and to pursue con sumer complaints. That task, however, became overwhelming. The industry was growing too fast for the reviewers to keep up w ith all the details o f the major new products; companies were founded, and folded, overnight. To the extent o f our small staffs ability, however, serious complaints were still pursued, and customers reported that our efforts helped resolve some o f their prob lems. Dr. D o b b ’s , Volume 2, chronicles the emergence o f the small computer as a useful tool. Here you will find a complete source listing for Lawrence Livermore Basic, which became popular due to its im plementation o f a floating point m ath package. The quest for a standard floating point im plem entation is still being discussed by a committee o f the IEEE, and LLL Basic directly contributed to that effort. The publication of LLL Basic also represented one of Dr. D o b b ’s primary functions - the introduction o f useable software into the public domain. In this volume, we have collected im portant pieces of systems software, all by authors who contributed their work for no reward other than the satisfaction gained by sharing. For ex
ample, tw o issues of DDJ were required to present the full docum entation and source code for Dr. John Starkweather’s 8080 PILOT. This language is now used world-wide, and was the springboard for later developments in computer-assisted instruction (CAI). For the m ost part, the software in Volume 2 is based on the Intel 8080, which was the first microprocessor to come into general use with the MITS Altair 8800 m icrocomputer, and which emphasized systems operation rather than applications. Max Agoston’s “ Kernel,” a complete 8080 operating system, is published with documentation and source listing, and is now, also in use world-wide. Of course, it isn’t all heavy-duty. Lichen Wang, author o f Palo Alto Tiny Basic (which appeared in Volume 1 of Dr. D o b b ’s ) offers the tasty “Interactive Language for the Control of Robots.” Volume 2 also contains graphics routines, disassemblers, memory tests, patches and corrections to commercially offered software —all products o f the pleasure people have had learning how to use these wonderous machines. Following the course of the letters and short subjects gives some o f the flavor of the debates among readers, including the importance o f software authors’ receiving reasonable compen sation for their efforts; the endless debate about ‘hex vs. octal’ notation: and rumors that later turned out to be true, as well as others that turned out not to be (oops!). The most delightful result o f editing a magazine like Dr. D o b b ’s Journal was observing the intense interest of, and active participation by, the readers. I was continually amazed that people would send in material that had taken a great deal o f work and care to develop because they wanted to share with others. The year 1977 produced a quantity o f software which is still in use today, and which has formed the basis for a number of commercial packages. It was an unforgettable experience to have been involved in it. Tom Williams
Contents
V O L U M E 13 17 18
N U M B E R
1,
1 9 7 7
A PD P-11-Like, 16-Bit Micro for the S-lOOBus Dick Wilcox, Alpha Micro Technology D D J Editor Comments on the Alpha Micro System Jim C. Warren, Jr. Lawrence Livermore Lab’s 8080 BASIC John Dickenson, Jerry Barber, John Teeter, Royce Eckard, Eugene Fisher
V O L U M E 77 79 80 81 82 83 86 92 95 98 100 114
2,
2,
N U M B E R
2,
1 9 7 7
Free Software? Or - Support Your Local Software Vendor Tom Pittman String Handling for Pittm an’s 6800 Tiny BASIC Henry L. Kee Extensions to Wang’s Palo Alto Tiny BASIC Russ Hayden Pittman 6800 Tiny BASIC Mods for SWTPC PR —40 Printer Mickey E. Ferguson STRINGOUT Mods for Espinosa’s 6502 Routine H.T. Gordon Symple Cyphering David Gruhn High Speed Interaction Without Interrupt or DMA Eugene Fisher Modifications to M icrosoft 8K BASIC 3.1 for Cromemco Z —80 $10 for 6 4 -Characters & Scrolling on a TVT-II R. Lynn Smith 64 C har/line TVT-II Mods, Requests & Suggestions Gary Alevy An 8080 Disassembler Ward Christensen Appendices to CASUAL Bob Van Valzah
V O L U M E
2,
N U M B E R
3,
1 9 7 7
122 124 126 129 137 139 144
Tiny Linkage Editor for “ relocatable code” on 8080’s and Z -80’s Proposal for Standard Z -80 Code Peter G. Formaniak Graphics on the Poly-88 Harvey A. Cohen Extended Accuracy Arithmetic Routines M.G. Dineley Algorithm for computing square roots James A. Hinds 8080 Disassembler Written in MITS 3.2 BASIC Jef Raskin M6800 Disassembler Gordon Stallings
148 150 152
Proposed Tiny PILOT Dennis Allison An SC/MP Subroutine Supervisor Richard K. Peterson The Selectric Typewriter as An Output Device Rod Graves
Dan M. Shaw
V O L U M E 159 162 162 164 166 168 173 186 188 190
207 208 216 232
246 247 248 252 253 255 257 259 261 262 263 265 268 271 296 297
1 9 7 7
2,
N U M B E R
5,
1 9 7 7
2,
N U M B E R
6,
1 9 7 7
Wayne Watch: A New DDJ Featurette for the Naive Novice Jim C. Warren, Jr., Editor, DDJ Which Manufacturer Offers the Longest Delivery Delay? a pseudo-contest Response to Tom Pittm an’s Editorial Dave Allen More Support for Software Vendors Brent Longtin A Story o f Traffic Lights, or: A BASIC Program to Play the Game o f lif e R. Broucke Conversions Between Octal and Hexadecimal R. Broucke SCHDL: A BASIC-cod ed‘Daily Reminder” Bob Moody & Steve Williams Curve Plotting on a TV Screen with the Polymorphics Video Interface and MITS BASIC R. Broucke 6800 Circle Maker David Hudson Dompier Plus: A “Musical Keyboard” Bruce Hicks Permanent Solution to Missing SP and PSW Definitions in PTC Sys Bruce R. Kendall Tape LOAD and SAVE Routines for P.T.’s BASIC Ron Santore KIM-1 Breakpoint Routines: Plain & Fancy Willi Kushe A ‘Turtle’ for VDM Marvin R. Winzenread An Example of an M6800-Based GPIB Interface S.C. Baunach Errata: TVT-II Mods had Pin Numbers Permuted Christopher Terry Lower Case Mod for SWTPC’s CT-1024 R. Lynn Smith
V O L U M E 301 302 303 305 306
4,
What to Get Your Computer for its First Birthday Jef Raskin Testing the D Z80-80 CPU: Nifty Z -80 Conversion for Altair & IMSAI Computers Jef Raskin Jack Armstrong’s Super Decoder Ring — Revisited Marvin R. Winzenread Video Chase for 8080/VDM Joseph J. Sanger Source Code for 8080 PILOT, Version 1.1 John A. Starkweather, Ph.D. A Practical, Low-Cost Home/School Microprocessor System Joe Weisbecker
V O L U M E 245
N U M B E R
Washington Club Offers Free Access to Their O n -lin e Journal Pros & Cons of Modems for Cassette Recording Using an Acoustic Coupled Modem as a Bulk Storage Interface MITS Basic, Poly Basic, and NIBL —Product Review Jef Raskin Screen Image Hard Copy for the VDM-I Dan S. Parker Here, Now: A Micro APL for 8080’s Erik T. Mueller Guide to 8080 PILOT, Version 1.1 John A. Starkweather, Ph.D. A 650X Program Relocater Ralph Sherman A KIM -1 TV Sketch Program Stan Ockers The Characteristics and Decodability o f the Universal Product Code Symbol D. Savir & G.J. Laurer
V O L U M E 203 205
2,
2,
N U M B E R
7,
1 9 7 7
SCCS Group Buy—Complaint & Response About Those ASCII TTY’s That You Cannot Trade F o r . . . Some Dire Warnings o f a Modem Jef Raskin Pennywhistle Plays a Better Tune Jef Raskin VDM-1 Modifications Lichen Wang
David Jon Fylstra
308 310 311 312 314 316 319 320 321 322 322 326 327
Dissecting the SWTPC Control Interface Phillip Schuman PCF is Center for Personal Communications Law Kenneth S. Widelitz Towards a Good ju-C Language Joshua P. Gordon On the Effects o f Filling Cavities Within the Fillings o f Cavities Within . . . The APL Core Project Texas A&M APL Committee Decoding 650X Opcodes H.T. Gordon A High-Speed Memory Test Program for the 6502 Jim F. Butterfield Mods to 8080 PILOT Steven Spence Z -80 Patches for MITS Basic Martin D. Gray One-for-One Patch to P.T. 5K Basic Morris G. Miller Real-Time Modification for Sanger’s Video CHASE David J. Morgan An 8080 Tracer John Walker Friend Finds Factorial Flaw Jef Raskin
V O L U M E 331 332 333 334 346 367 368
N U M B E R
8,
1 9 7 7
About Those Elusive PILOT Tapes — Ronald C. Fryxell reply by Gregory Yob Some Follow-Ups and A Few New Tidbits from Readers Jef Raskin Computer Applications for the Handicapped Warren J. Dunning AN INTERACTIVE PROGRAMMING LANGUAGE FOR CONTROL OF ROBOTS Lichen Wang A MICROPROCESSOR OPERATING SYSTEM: THE KERNEL Max K. Agoston, Ph.D. Basic-Coded Memory Dumper John B. Palmer Patching Microsoft’s 4.0 Basic on P.T.’s SOL Jack L. Calaway
V O L U M E 376 380 385 389 391 398 400 404 406 412
2,
Steve Witham
2,
N U M B E R
9,
1 9 7 7
A Detailed Report on Product Delivery Complaints Tom Williams, Assistant Editor The Heath H-8: Pro & Con Poly Doc Corrections Richard B. Emerson Dijkstra’s Minilanguage Neils Laughlin GRAFX —A Graphics Monitor for the 8080/TV Dazzler Jonathan W. Mills Alphanumeric Plotter for Poly Video Display Arthur Armstron Utilities & Music on the Cosmac Elf Edward M. McCormack PROMable IK Operating System for RCA’s Elf Edward M. McCormack Multiple Column Accounting Charlie Pack OPLEGL Correction & a 6502 Scanning-Debugger H.T. Gordon
V O L U M E
2,
N U M B E R
10,
1 9 7 7
420 423 426 427 429 436 443 444 445
New Voice Synthesis & Graphics Products Kenneth Young H eathkit’s H -8: A Consumer’s View Paul R. Poduska, Ph.D. A KIM-1 Disassembler Theodore E. Bridge VDM-1 Driver Mods John Moorhead MATHPAC: A Kimath Supplement John Eaton GPM for the 6800 Frits van der Wateren ZAPS Operating System and Assembler for the Z -80 Jef Raskin SWTPC Editor Form at Update Phil Hughes KAPIAR: AN 8080 MACROPROCESSOR Steve Newberry
475
Index to Volumes One, Two, and Three
About
People’s Com puter Company People’s Computer Company was founded in 1972 to demystify computers by teaching people how to use them. It is still carrying on that crusade through magazines, books and informal classes. As one o f PCC’s founders, Bob Albrecht explained in the first issue o f the PCC newspaper, “Computers are mostly used against people instead o f for people, used to control people in stead of to free them. I t’s time to change all that. We need a People’s Computer Company.” Since then, in its role as a non-profit, educational corporation, PCC has published a news paper, three magazines, and several books on home/personal computing. The Personal Com puter NETwork, (PCNET) joined People’s Computer Company in March, 1979. PCNET is a Bay Area, California group dedicated since 1977 to the development of personal computerbased telecommunications. Computertown, U.S.A.!, a computer literacy project joined People’s Computer Company in August, 1979. In the past PCC also operated a neighborhood computer center, and a mail-order bookstore. Today, the PCC magazines — Recreational Computing, Dr. Dobb’s Journal, and Computer Music Journal —have a combined circulation o f about 28,000 (paid subscribers plus news stand sales). People’s Computer Company sprang from the same roots as the Whole Earth Catalog. Both were offshoots of the Portola Institute o f Menlo Park, an organization dedicated to invest igating and promoting the idea o f alternative technology. For the founders o f PCC, that meant learning to use computers as a liberating force in society. In PCC’s view, familiarity with computers breeds confidence and personal power. “The com puter -liberated kid grows up to be an adult unafraid to challenge his bills - or anything else in the world’s great electronic system,” says Albrecht. People’s Computer Company publishes three magazines for three distinct audiences. The oldest, Recreational Computing, is for the computer novice to the intermediate hobbyist. It started out as a newspaper called People’s Computer Company, evolved into People’s Com puters magazine, and took its present name with the January-February 1979 issue. The maga zine is published bimonthly. “I t’s in the hom e—in a relaxed, recreational environm ent—that the real com puter revolution is going to take place over the next few years,” said Albrecht. As the first publication in the personal computing field, Recreational Computing has spawned imitators. “ But we feel we have a very special niche,” says pub Usher Willard Holden. “Recreational Computing takes risks that other publications don’t. We are willing to publish articles that may be off-beat and outrageous if we think they will get people excited about the possibilities of computers.” Dr. Dobb’s Journal, PCC’s second publication, had its beginning in January 1976 as a short term mimeographed forum for the newly w ritten Tiny Basic language. Reader response was so strong that the Journal went into steady publication. Most DDJ readers describe themselves as having from intermediate to extensive computer experience. Dr. Dobb’s Journal is a reference journal read worldwide. Ten percent o f the circulation is outside the United States. The magazine contains sophisticated discussions o f programming techniques and hardware modifications. About half o f each issue is devoted to free software. DDJ appears ten times a year. Computer Music Journal, the third PCC publication, is at the forefront o f new developments in the computer music world. During the past 20 years, there has been extensive research in applying computers to music. The results of this research are becoming more visible as digital techniques transform music production, music analysis, and music recording. Computer Music Journal, published since 1977, is a respected source for inform ation in this field. The Journal is distributed quarterly to universities, research institutes, and individual subscribers in 27 countries. People’s Computer Company occupies the second floor o f a small office building in down town Menlo Park. The 30 staff members, more than half of whom are part-tim e, have pro fessional interests in education, art, musical composition, com puter science and journalism. People’s Computer Company Box E Menlo Park, CA 94025
dr. dobbs journal of
C O MP U T E R (C alisthenics 6
^ )r th o d o n tia
Running Light W ithout Overbyte Number 11
January 1977
Volume 2, Issue 1
A REFERENCE JOURNAL FOR USERS OF HOME COMPUTERS
A P D P -11-L ik e, 16-B it M icro for th e S -1 0 0 Bus, D ick W ilcox, A lpha M icro T ec h n o lo g y Complete with a multi-tasking, multi-user floppy disk operating system DDJ Editor Comments on the Alpha Micro System, Jim C. Warren, Jr. L aw rence L iverm ore Lab’s 8 0 8 0 B A SIC , Joh n D ick en so n , Jerry Barber, John T eeter, R o y c e E ckard, E u gen e F isher Includes Floating Point Package Complete User Documentation & Examples Complete, Assembled A nnotated Source Code
- and a few , miscellaneous hardware announcements -
3
7
8
© David Dameron 1979
A PDP-11-Like, 16-Bit Micro for the S-100 Bus 16 BITS F O R Y O U R IMSAI O R A L T A IR COM PUTER by Dick Wilcox, 1342 Mauna Loa Road, Tustin, CA 92680 (714) 838-1381 As I was waiting for my computer to finish an assembly, I happened to be glancing over my September issue o f DDJ when I came across your small but interesting article way down down in the corner o f page 11 entitled, “ HOT IDEA” . In it you suggested that someone should interface the LSI-11 board to the S-100 bus used in the IMSAI and ALTAIR hobby com puters. I would like to acquaint you with a recent develop ment o f mine which should prove to be o f interest to the more advanced hobbyists who have run out of flexibility in their 8080 systems. I have worked w ith the PDP-11 series ever since the ori ginal design first came out on the market (the now extinct PDP-11/20) and have gotten quite used to working with a full set of 16-bit registers. To drop back to an 8-bit single accumulator machine seemed to be intolerable and so I inves tigated just what you suggested. I have done extensive soft ware and hardware interfacing to several of the PDP-11 models and after some study, came up with the conclusion that the low impedence bus structure of the LSI-11 was not easily adaptable to the S-100. In addition, the board size pretty much eliminated the incorporation of it directly into the actual computer box which all-in-all cast a dim shadow over the whole idea. The only feasible solution to this problem seemed to be a totally new design based around some already existing micro processor. The system I selected is the Western Digital MCP1600 which is comprised o f two system chips (40-pin) and from one to four microprogrammable ROMS (40-pin) which may be custom programmed to perform various macro-level instruction sequences. Working together with a personal friend, Rich Notari, I came up with a workable instruction set that could exist in the MCP-1600. Rich then took this list and added a few frills o f his own based on some previous experi ences w ith this particular chip set. A note o f thanks is due at this point to him for his undying efforts and late hours for I feel that he is the only programmer I know who could have successfully completed the microprogramming o f this system in the short time frame allotted. We have named this particular chip set (4 chips total) as it is currently microprogrammed, the WD-16 microprocessor system. This system is then interfaced to the S-100 IMSAI/ALTAIR bus using some 70-plus TTL logic chips which fit totally on two standard sized S-100 interface PC boards. These cards plug directly into the m otherboard o f your com puter and include as standard features, multi-level interrupt steering logic, priority DMA channels (up to eight o f them), and in interrupt-driven real-time clock for timesharing job control or program timing. The real beauty of this new sys tem, however, lies in the software which is now running on it (notice I said now). The complete unit including the WD-16 microprocessor and associated TTL interface is named the CM-16 microcomputer and is currently running in two IMSAI computers, undergoing rigorous testing at my house and at Alpha Micro Technology where much o f the development was done. I am working in depth with the guys there to in sure that the unit will be compatible with the m ajority of the January, 1977
currently available memory and peripheral devices on the market. So far the computer is performing admirably with no modifications necessary to any o f the devices we have tried it out with. Microprocessor Structure The microprocessor is basically a 16-bit structured device which has been interfaced to the 8-bit IMSAI bus in a method which makes it transparent to the programmer. There are a total o f eight registers (each 16-bits) which are used as a pro gram counter (PC), a stack pointer (SP), and 6 general pur pose work registers (R0-R5). The work registers are all identi cal and may be used for memory addressing, accumulators, or index registers. Clock cycle for the chip set is 2Mhz to make it compatible with current 8080 devices although the unit is capable o f speeds up to 3.3 Mhz with some modifications. Each machine instruction is 1, 2, or 3 words in length depend ing on the addressing modes in use by the instruction. Instruc tion formats include control instructions, single operand in structions, and m onitor call instructions. Instruction operands can be register data or memory data which may be referenced directly (no register involved) or indirectly (through one of the registers). The stack may be specified as any contiguous block of memory and any operand may be directly referenced (not just the one on the top). In addition to the specified stack register, any of the six general purpose registers may also be used as stack registers for multiple-stack compiler applica tions. Memory-to-memory operations may be done directly throughout the entire addressing range o f 65K bytes (32K words) w ithout disturbing any of the general purpose regis ters. These instructions include add, subtract, logical and, logical or, and logical bit testing. Addressing o f memory is normally done as either full 16-bit words or as single 8-bit bytes. Most instructions allow either mode o f operation, thereby giving very flexible character-string handling w ithout sacrificing arithmetic capabilities. The top 256 bytes o f the addressing range (memory locations FF00-FFFF) are translated by the interface logic into 8080 I/O instructions and presented to the bus as such with the proper signals wiggling at the proper times. This eliminates the need for separate I/O instructions and most memory reference instructions may be used for I/O transfers with certain clearly defined restrictions. For all other memory ac cess operations, the logic cleverly translates the 16-bit proces sor requests into a couple of ordinary old 8080 8-bit requests and both ends o f the string are quite happy w ith the arrange ment. Interrupts are handled on a single level with up to eight hardware selectable priorities, totally compatible w ith the 8080 interrupt scheme. The user has the option o f running with either vectored or non-vectored software handling of the interrupt request. Vectored interrupts merely use the device interrupt code (0-7) as a table pointer to develop an absolute address to the specific interrupt handling routine. DMA transfers require some slight modification to the device board since the DMA structure uses some o f the currently spare lines o f the 100 bus structure. The 16-bit unit (dubbed the CM-16) resides in the computer in complete harm ony with the existing 8080 CPU processor and uses a single control line (PRDY) to perform the hardware switching. At any one time, one o f the processors is using the bus and the other processor is tri-stated. This m ethod avoids making the 8080 CPU ob-
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 3
13
solete and allows 8080 programs to be loaded under control of the extensive CM-16 software operating system and then executed using the 8080 CPU. At the present time, this switching is done mechanically but could be done via a soft ware controlled output port if care was taken in the software timing. Available Software All o f the software about to be described is currently run ning on my prototype units with the exception o f the Ex tended BASIC Compiler system which is still undergoing de velopment. The operating system is one which I have been using (in general design) on several computers over the past several years and has proven to be extremely useful in imple menting new systems. I have recoded the various modules of it into the CM-16 macro instruction set and am running it with major success in all areas tested. Since most of the sys tem is generalized in nature and is implemented in a very ex tensive macro defined language, translation to the CM-16 code was fairly easy. The basic structure o f the command language used by the operating system and the file system used for disk management greatly resembles the Decsvstem-10 operating system which I feel is one of the most powerful and easy to master. Operating System The operating system (or m onitor) may be generated in one o f several basic cofigurations. To gain all o f the features inherent in the design of the command language, the operating system should be based on disk (either floppy or hard surface) where the loading and execution o f programs is handled auto matically by the system. This disk-based version contains all routines for file handling on the disk and other peripheral de vices (including memory). It can be structured for real-time processing and full timesharing using fixed memory partition ing which is dynamically allocated during run-time. The time sharing routines include priority processing m ethods and dy namic device reassignment for non-sharable devices. A line printer spooler is included which runs in its own dedicated jobstream for those users lucky enough to have laid their hands on one o f these expensive beasties. The operating sys tem may also be generated in a much limited version which does not require a disk and allocated space in RAM dynam ically for program and data files. In this version the user must explicitly load the run programs which perform most of the system tasks from some peripheral device such as a cassette tape. The operating system includes all facilities for logical I/O handling on a device-independent basis. All programs are w rit ten using logical calls such as OPEN, READ, WRITE, CLOSE, etc., and the m onitor assigns input and output devices (or files) at run time under operator control. This means that when the user purchases his new random access Magnetic Wimbis device, all he has to do is write a small driver for getting data into and out o f the Wimbis and all o f his programs (in cluding all system programs) will operate w ith said bizarre device. Writing this driver is done in macro assembly language using a set o f predefined rules. An extensive terminal service package allows various different devices to be defined as sys tem consoles or peripheral I/O devices and interact with the operating system using specific control codes necessary for such things as carriage position and cursor control. I feel that with the myriad o f different peripheral devices on the market (including surplus items) it is im portant to offer an easy m eth od to implement these devices without having to rewrite all programs. Command Language The command language implemented in the CM-16 operat Page 4
14
ing system offers the user the ability to easily define his own commands without modification to any of the system soft ware. It works like this: when a command (1-6 characters) is typed on the terminal, the operating system searches for ei ther a program by that name or a command file by that name. These programs and commands may be stored in a common system library or in the user’s own area Searching is performed in a manner defined when the user builds his operating system. If a program is found by that name it is automatically loaded into memory and executed. In other words, the file renaming functions are performed by a program called RENAME.PRG which is part o f the system utility package. When the user types RENAME on his terminal the program is executed and performs the function. If the command results in the location of a command file that file is loaded into memory and the lines in that file are then fed into the terminal input stream one at a time just as if they had been typed on the terminal in sequence by the user. Each command file is ASCII and is created and edited by the text editor just as any source file or data file would be. Lines within the command file may include pro gram name commands, other command file commands, or in put data required for the execution o f the program called. Specific control codes (preceeded by a colon) allow the con trol of echoing, manual keyboard input for specific data, and operator messages within the command file processing. Disk Data Organization The disk (or multiple disks) is dynamically allocated as files are built using a bitmap technique which eliminates the need for a compression phase when the disk becomes frag mented due to file deletion. Each time a file is opened it eats up only as much space as it actually requires. Records within the file are linked in sequence and need not be con tiguous except for special files which the user may option ally preallocate to a given size. When the file is deleted, all the space it occupied becomes imediately available for an other file to use. On the larger scale, the disk may be allo cated under one or more user areas with each user having a separate account number and an optional password (1-6 characters) which is required at login time. Each user area is protected from other user’s vandalism by file protection codes and account numbers. Filenames need only be unique within each user area eliminating the necessaity of keeping track o f who’s doing what w ith which, etc. User areas need not be allocated when they are set up since space on the disk is allocated on a first-come, first-serve basis. Utility routines assist in creating and maintaining user accounts and files in the system area. The system area is merely another user area and also may dynamically change as required. All input and output files and devices are referenced by a general format: device :filename.extension [ppn] The device code is a 3-character alpha name given to the peripheral unit to be referenced. This may be optionally followed by a drive number for units which may have more than one drive such as disk or tape. Typical assigned names might include DSK for disk, TAP for cassette tape, LPT for line printer, and TTY for terminal devices. DSKO and DSK1 would therefore be the device codes for two individ ual drives connected to the same disk controller. These names are assigned by the user when he writes or renames the associated device driver routine. The exception to this is DSK which must be the name o f the system disk when the disk operating system is used. The filename.extension follows the standard Decsystem-10 convention o f using from 1-6 alphanumeric characters for the name of the file
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
and a 1-3 character extension (or modifier) which usually specifies the type o f file it is. For example, given the pro gram name o f CONVRT for a conversion program, the fol lowing standard extensions are used by the system: CONVRT.MAC CONVRT.BAK
macro language source file backup source file created by the edi tor
CONVRT.OBJ CONVRT.PRG
object file created by the assembler runnable program file created by the Link loader symbol file used by the symbolic debugging program
CONVRT.SYM
The ppn within brackets represents the user account number (also called project-programmer number, hence ppn) when reference is to another user area. Filenames and ppns are used only for file structured devices and are ignored for non-file-structured devices such as a printer or paper-tape reader. Some examples of dataset references are: LPT: DSK: CONVRT. MAC DSK1 : CONVRT. PRG [24,51 TTY:
Line printer File CONVRT. MAC in current user area on disk File named CONVRT. PRG in user area 24,5 on disk 1 Current user terminal device
All routines for processing these dataset references and set ting up the links to the correct devices and files are built into the resident operating system thereby relieving the programmer o f that task. The programmer merely sets up a 20-word dataset definition block (DDB) and then uses a dozen or so monitor calls which reference this DDB to per form all I/O setup and accessing operations. Assembly Language Development System The assembly language programming fanatic (long may he live!) has plenty of support in the CM-16 development sys tem. The assembler is an extensive macro-level one with complete macro definition facilities and conditional assembly pseudo-operators. Internal and external global reference statements allow a large program to be segmented into lit tle hunks and assembled separately while allowing inter-seg ment data and procedure references. A linkage loader is then called to link all the object files together, resolve all external references, and generate a runnable program file. The resultant program may be totally relocatable w ithout relinking if certain programming standards are adhered to due to the addressing capabilities of the hardware. A copy statement in the assembler allows system definition libraries and standard routines to be included in the source program with a single statement. These libraries and routines are normal ASCII source files and may reside in a common sys tem area (DSKO: [7,7]) or in the user area. A symbolic debug program (DDT) allows the user to test his program under the supervision of a controlling program. Using DDT the user may set breakpoints, single-step execution, and in spect data at any point during execution. All data areas and program instructions are referenced by the symbols used in the source program so the programmer need not work in that diabolical numbering system known as hexa decimal. This DDT basically parallels the program by the same name in the Decsystem-10 for those o f you who are familiar with it. Input to the DDT program is the program file (.PRG) and the symbol file (.SYM) which was created by the symbol file creation program which interprets the assembler output object file (.OBJ) as required. As a January, 1977
final frosting on the cake, there is a segmentation system in the assembler and the m onitor which allows a program to be broken into logical segments and executed in a much smaller amount of memory by having each segment overlay the preceeding one. BASIC Compiler and Run System As I mentioned previously, this is the main piece of soft ware which is not totally complete at this time, although it is sufficiently up and running for many test programs to be demonstrated. I have implemented the language in a kind of unique way which makes it a true compiler but which allows it to look like an interpreter in the development code. The source code may be edited via the standard text editor as a file on disk or it may be edited using the line editor built into BASIC which follows the standards used by the other popular BASIC systems on the market. The program is auto matically compiled once when the RUN command is execu ted and the object code (actually a series of Polish-mode driver codes) is built in memory and then executed. This compiled code may optionally be stored off on disk and later recalled for execution, requiring only the run-time package to be resident. The language elements implemented (and to be imple mented) include most o f the currently available functions found in the popular extended BASIC interpreters. Timings taken on some various programs indicate timings on the or der of 5-7 times as fast as the current version o f MITS 8K BASIC depending on the amount of m ath being performed and the types of variables being used. String functions are fully supported as in integer and double-precision arithmetic. I also intend to include some fairly extensive assembly lan guage and subroutine linkages to enable the high-speed rou tines to be implemented where needed. Disk file data ac cess m ethods are also supported along with matrix opera tions. I have also included some rather unique features which are not a part of the standard BASIC format but which should provide the sophisticated user some additional flexibility. Variable names may be any length alphanumeric and are not limited to one or two characters. A redefinition scheme allows you to define any name as a command or set of commands to be referenced later in the program or in the terminal command system itself. For example, the name TOM could be equated to the multiple command sequence PRINT “ TOM IS ALIVE” :GOTO 230 and each time TOM was entered into the program, the above sequence would re place it. This is quite similar to the macro definition facility commonly found in assemblers. A copy statement allows external routines to be included in the source program when the compile mode is in use. There are also some other minor functions to numerous to mention here. If I could just find a function that would automatically document all the other features I would be in fat city. Text Editor For the Decsystem-10 fans, the tex t editor is basically a limited version o f the very popular TECO program. It is a character-oriented free-form ASCII file editor with com mands to add, delete, and insert both line and character strings in a text buffer. A pointer keeps track of your posi tion within the text buffer and is manipulated by commands which move it forward and backward by a fixed number of lines or characters. Search commands may be used to locate a specific character string and leave the pointer set immedi ately after it. An iteration scheme allows a series of editor commands to be enclosed in angle brackets and repeated a predetermined number o f times. There are 26 registers (AZ) which may be used for the holding and moving of varia-
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 5
15
ble lengths of text or numeric values including the pointer location. The text editor may be used to create and main tain source files, command files, and data files (ASCII). System Utility Programs To supplement the creation, maintenance and operation of the system there exist a number o f utility programs which perform specific functions. I will describe briefly a few of the more im portant ones. Probably the single m ost impor tant one is the m onitor generation program which allows the user to tailor the monitor to his specific needs and create a runnable m onitor which includes selected routines and may optionally include some user w ritten functions for fast ac cess. The system allows the storing of several different flavors o f monitors which may be called upon at any time for specific operations. Another im portant utility is one which creates and maintains the user accounts on the vari ous disks. Accounts may be added and deleted and pass words may be changed. This program is also used to in itialize a new disk removing all files and accounts and free ing up all the blocks. An extensive disk analysis program may be run which reads the entire disk structure and plots out the allocation of all files. Checks are made to insure that no two files are accessing the same physical disk record or records reserved for system use (such as the master direc tory record and bitmaps). All files and directory records are read and checked for errors. The bitmap is analyzed for records marked in use but not in a file and vice-versa. The bitmap is then recreated and rewritten onto the disk. This is an effective garbage-collection program which is very help ful in recovering from major disk failures which may destroy part of the file structure. There also exists the usual collection of support routines for copying files, dumping memory and disk data, print directory and file listings, and monitoring system status and operations. Most programs are accessible to all user accounts but a few o f the programs are privileged in the respect that they may be run only when the user is logged under the system manager’s account number of 1,2. This prevents the non-informed users (such as wives and kids) from inad vertantly eating up their own system disks. Now please don’t go and write about the intelligence levels o f wives versus husbands, since I was only kidding. Really, some of my best friends are wives! 8080 Cross Assembler For those o f you who have some 8080 assembly language programs and do not wish to convert them immediately I have have a full macro and conditional assembly system for the standard 8080 instruction set which will accept 8080 source code and generate 8080 runnable programs. This develop ment may be done using all the flexibility of the CM-16 operating system whereby the source file and object file may be stored on disk (or other peripheral). The runnable program may then be loaded into memory using a special loader and the processor switched to 8080 mode to run the program. Since both microprocessors physically share the bus this is not a major inconvenience and makes for a pretty nifty little 8080 development system also. Current Progress of System Testing As I m entioned previously, this system is currently run ning and not just a pipe dream and I invite anyone inter ested to come down to Alpha Micro for a live demonstra tion. The current system is running in an IMSAI computer with 40K bytes o f memory o f various types, a dual ICOM Frugal Floppy disk unit, a Tarbell cassette, and a 3P+S con nected to a Lear Siegler Dumb Terminal. The memory re quirements for the software operating system range from about 8K for a limited version to around 14K for the full timesharing disk-based one. We will be recommending Page 6
16
around 24K as a minimum memory size which includes space for user program assembly and BASIC compilations. Due to the power o f the microprocessor itself and the exten sive software available, I do not feel that the main market place will be the limited memory systems and with the price o f memories dropping constantly, the tradeoffs in volved in limiting the m onitor to 4K bytes or less is not worth it. We are testing the prototype unit with various memories and peripherals to insure compatibility with most o f the more popular ones. The following is a list o f the devices that we have tested with the CM-16 with complete success: Seals 8K Memory Processor Tech 4K and 8K Memories IMSAI 4K Memory Solid State Music 4K Memory IMSAI SIO-2 Serial I/O Interface IMSAI PIO-4 Parallel I/O interface Cromemco 8K Bytesaver Processor Tech 3P+S I/O Interface ICOM Frugal Floppy Disks Tarbell Cassette Interface Lear Siegler ADM-3 Dumb Terminal Teletype ASR-33 Terminal Processor Tech VDM-1 Video Display Marketing Approach The finished CM-16 computers are scheduled for delivery on January 15, 1977 and will be distributed exclusively by Alpha Micro Technology of Tustin, CA. The unit will be sold as a kit with the price being somewhere under $999 (does that sound better than $1000?) which will include all software mentioned above. The software will be distributed in one o f several standard versions in runnable binary for mat on either floppy disk or cassette tape media. I firmly believe that the hobby market should be basically just that and therefore we intend to make all software available for as little as possible to cover handling and a small profit margin. I have done commercial consulting for over six years and feel that companies making a profit from my software can well afford to pay top prices for it. The hobbyist, on the other hand, merely wants to enjoy his toys and perhaps gain some real insight into the world of computers while doing so. I see no threat to my own existence there and intend to make every effort to be personally responsive to all questions and comments concerning the CM-16 software library and also intend to maintain some form o f update service to users who care to get all the latest improvements as they come out. The actual cost o f the software system (included in the price o f the CM-16 kit) is somewhere around $75.00 for the runnable binary system. This will cover the license to use that software for non-profit only. Commercial users desiring to OEM either the CM-16 com puter or the WD-16 chip set alone will be asked to pay a nominal licensing fee for each version sold. An unusual approach not commonly found in systems o f this magnitude is that we intend to sell all source files and listings in selected groups for a similarly nominal price. They will be distributed on floppy disks and will be modi fiable by the user if he so desires. I intend to also distribute a fairly complete set o f manuals giving information on w rit ing your own m onitor routines and peripheral drivers. Since much o f the software is modular in scope, many o f the rou tines used to build the m onitor, assembler, and compiler will be available for the user. I have seen the enthusiasm that the hobby market has produced and feel that the feedback that I receive on my software will more than offset any ad ditional profit to be made by overpricing.
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
I hope that this brief description will spur the interest of some o f you out there and I invite you to write or call me for further information on this new microprocessor system. Most of my time lately has been spent chasing gremlins and I welcome the opportunity to engage in some casual conver sation now and then with other hobbyists interested in ad vancing the field o f computers. You can find me chasing gremlins at the following location: Alpha Micro Technology 1342 Mauna Loa Road Tustin, CA 92680
Supervisor Call Instructions: SVCA arg Jumps to a monitor routine defined by a table base address in location 22 plus twice the argument value SVCB arg Pushes all registers onto the stack including the SP and PC and then jumps to a monitor routine as in SVCA getting the table base address from location 24 SVCC arg Same as SVCB using table from location 26 Irnnediate ADDI SUBI MOVI BICI
Mode Instructions: imm,reg Adds the irnnediate data (range 1- 1 6 ) to reg imm,reg Subtracts the immediate data (range 1- 16 ) from reg imm,reg Moves the immediate data (range 1- 16 ) to reg imm.reg Clears the bits in reg corresponding to inmediate data
Single Address Instructions: ROR dst Rotates dst^right one bit through the earn- flag RORB dst Rotates dst byte right one bit through the carry flag ROL dst Rotates dst word left one bit through the carry flag ROLB dst Rotates dst byte left one bit through the carry flag TST dst Tests the dst word and sets the CPU flags per the result TSTB dst Tests the dst byte and sets the CPU flags per the result ASL dst Shifts the dstword left one bitintothe carryflag Shifts the dstbyte left one bitintothe carryflag Sets the dst word to all ones Sets the dst byte to all ones Clears the dstword to zeros CLRB dst Clears the dstbyte to zeros ASR dst Shifts the dstword left one bitintothe carryflag ASRB dst Shifts the dstbyte left one bitintothe carryflag SWAB dst Swaps the two bytes in the dst word Swaps the two hex digits in the dst byte Compliments the dst word (one's compliment) Compliments the dst byte (one's compliment) Negates the dst word (two’ s compliment) Negates the dst byte (two's compliment) Increments the dst word by one INCB dst Increments the dst byte by one DEC dst Decrements the dst word by one Decrements the dst byte by one IW2 dst Increments the dst word by two SXT dst Extends the sign bit (N flag) through the dst word LSTS dst Loads the processor flags and interrupt from the dst word SSTS dst Stores the processor flags and interrupt into the dst word TJMP dst Table jump based on data in dst and table following the inst TCALL dst Table subroutine call similar to TJMP Adds the carry flag to the dst word ADC dst SRC dst Subtracts the carry flag from the dst word Double Address Instructions: ADD sre.dst Adds the sre word to the dst word SUB sre.dst Subtracts the sre word from the dst word AND sre.dst Logical AND's the sre word into the dst word BIC sre.dst Clears bits in the dst word corresponding to the sre word BIS sre.dst Logical OR's the sre word into the dst word BISB sre.dst Logical OR's the sre byte into the dst byte BIT sre.dst Sets processor flags based on corresponding sre-dst word bits XOR sre.dst Logical XOR's the sre word into the dst word MOV sre.dst Moves the sre word to the dst word MOVB sre.dst Moves the sre byte to the dst byte CMP sre.dst Compares the sre word to the dst word and sets flags CMPB sre.dst Compares the sre byte to the dst byte and sets flags Register-Address Instructions: Call the subroutine at dst (PC pushed onto stack) CALL dst Call the subroutine at dst using reg as link register CALL reg,dst Loads the effective address dst into reg LEA reg,dst Special form of LEA which jumps to dst routine JMP dst Exchanges the words in the reg and dst XCH reg,dst Decrements reg by one and branches to dst if result not zero SOB reg,dst Shifts the word in reg by (dst) bits (left if +, right if -) reg,dst ASH Shifts the double-word unit in reg,reg+1 same as ASH ASHC reg,dst Multiplies reg by dst leaving result in reg,reg+1 MUL reg,dst Divides reg,reg+1 by dst leaving result in reg (remainder in DIV reg,dst reg+1) Branch Instructions: Branch unc BR adr Branch if BEQ adr BNE Branch if adr Branch if BPL adr BM 1 adr Branch if Branch if BHI adr Branch if BHIS adr BL0 adr Branch if Branch if BL0S adr Branch if BGT adr Branch if BGfc adr Branch if BLT adr Branch if BLF. adr Branch if BVC adr Branch if BVS adr Branch if BCC adr Branch if adr BCS
January, 1977
DDJ E D ITO R COM M ENTS ON THE ALPH A MICRO SYSTEM by Jim C. Warren, Jr. I saw this widgit running at a December meeting of the Home brew Computer Club, and was totally blown away by it! It comes close to being an order of magnitude more potent than any other system I have seen. In prototype form, I watched John French running BASIC on one L-S terminal while Dick Wilcox was running the editor and the macro assembler on a second terminal. At the same time, a DECsystem-10 style SYST AT system status display was running on a Processor Technology VDM, showing which jobs were alive, which one was active, etc., and also displaying a hoursminutes-seconds clock. It is, truly, a multi-tasking, multi-user sys tem. All of this was running on an IMSAI with 48K bytes of RAM and dual iCom floppy disc drives. John told me the 8080 board was still in there, doing little more than supporting the front panel. Incidentally, at one point the system crashed—I believe Dick was running in privileged mode and garbled his memory partitioning commands (i.e., operator error, not system error). He simply reached over, hit the front panel RESET switch, and booted off the disc in a few seconds. He asked John how much memory he wanted (for running BASIC), allocated it, and both of them were off and running again. Evidently the system truly is device-independent. I talked to Dick about two days ago, asking if he could easily get the system running on the $350 I BM 2311 multi-platter, hard-disc, 7.25 MEGAbyte disc-pack drive that is being interfaced to the S-100 bus by another group in Southern California (ahhh, but that's another story for another issue). He said that it shouldn't take more than a coupla hours to write the driver for it; then it would run with no further changes to the software. Concerning the BASIC "compiler": as I understand it, Dick's BASIC processor translates into an efficient intermediate code which is both compact and fast to interpret. In this way, it gains the reported 5-7 speed advantage over the MITS BASIC. It is not, however, a true compiler in the sense of generating absolute object code for the target machine. I would like to particularly applaud Dick's position regarding low-cost distribution of software for not-for-profit use. He is recognizing and adjusting to the realities of the new world of per sonal computing in a manner that I feel is fair and reasonable for everyone concerned. His willingness to release his very extensive systems software sources is to be particularly applauded. Why bother with a multi-tasking operating system on a "per sonal" computer? Let's daydream for a moment. Wouldn’t it be nice to be able to start a lengthy listing on our hardcopy device; while that was running, start an assembly of a large program; and then go about editing the source for another program from our softcopy terminal? That's exactly what you can do with a multi tasking system . . . the Sixteen/8 (a later name for the CWI-1 6). Why bother with multi-user capabilities? Well, let's say that your kids want to run Space War at the same time you want to do some "serious work" on your home system. Or, let's say a school has already purchased a number of IMSAI's—such as is the case with the San Jose Unified School District in California-and would like to allow more students to use the machines at the same time, than is possible in a one-on-one environment. Since the capability is already there—it was in Dick's home-grown operating system on the 11 / 20 for four years—it might be useful. On the other hand, you can ignore it if you wish. Watch for a comprehensive evaluation of the Sixteen/8 in a future issue of DDJ. Dick and John have promised that, as soon as they get their first batch of production units, they will let me come down, pick any one I choose out of the bunch, bring it back to the Bay Area, and bang away on it to my heart's content. Be assured that an evaluation of that unit—particularly its software and systems aspects—will appear in Dr. D o b b ’s shortly thereafter. Multiple-bit Shift SSRR reg,cnt SSLR reg,cnt SSRA reg,cnt SSLA reg,cnt SDRR reg,cnt SDLR reg,cnt SDRA reg,cnt SDLA reg,cnt
Shifts Shifts Shifts Shifts Shifts Shifts Shifts Shifts
the the the the the the the the
word in reg right cnt times through the carry word in reg left cnt times through the carry word in reg right cnt times from the carry word in reg left cnt times into the carry double-word inreg,reg+1 sameasSSRR double-word inreg,reg+1 sameasSSLR double-word inreg,reg+1 sameasSSRA double-word inreg,reg+1 sameasSSLA
Floating Point instructions: at this time the floating point microprogramming is not complete and the'final format is still undergoing change. The basic floating point instructions will be available as an optional fifth microprocessor chip. Please note that many of the instructions are rather exotic and were designed specifically to be used in the operating system for subroutine processing. Many of the instructions in this category will not be used for application programs but are available for those who wish to dabble with them.
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 7
17
Lawrence Livermore Lab’s 8080 BASIC includes floating point package user documentation & complete, annotated source Foreward The BASIC interpreter described in this user’s guide was developed at the University o f Idaho by John Dickenson, Jerry Barber, and John Teeter under a contract with the Lawrence Livermore Laboratory. In addition, Jerry Barber, as an LLL summer employee, made significant contributions to this docu ment and to implementing the BASIC language in an MCS-8080 8080 microprocessor. Abstract Scientists are finding increased applications for m icropro cessors as process controllers in their experiments. However, while microprocessors are small and inexpensive, they are dif ficult to program in machine or assembly language. A highlevel language is needed to enable scientists to develop their own microprocessor programs for their experiments on loca tion. Recognizing this need, LLL contracted to have such a language developed. This report describes the result—the LLL BASIC interpreter.
Introduction The BASIC interpreter described in this user’s manual was designed to operate with the MCS-8080 microprocessor. It consists o f a 5K-byte-PROM resident interpreter used for pro gram generation and debug. The goal in developing the 8080 BASIC was to provide a high-level, easy-to-use language for performing both control and com putation fuctions in the MCS-8080 microprocessor. To minimize system size and cost, the interpreter was con strained to fit into 5K bytes. It was necessary, therefore, to limit the commands to those considered the most useful in microprocessor applications. A list o f these commands is given in Table 1, and a list of the statements making up the BASIC interpreter is presented in Table 2. Average assembly-language execution times and the various operations allowed in the BASIC floating-point package are given in Table 3.
Table 1. BASIC interpreter commands. Command
Action
RUN SCR LIST PLST PTAPE
Begins program execution Gears program from memory Lists ASCII program in memory Punches paper-tape copy of program Reads paper-tape copy of program using high-speed reader Interrupts program during execution
CNTRL S Page 8
18
Table 2. BASIC statements. Statement
Function
0 to 32767
Indicates BASIC line number (maximum range 0 to 32767). Indicates a comment (Spaces are ignored excpet when enclosed in quotes, there fore, comments are generally enclosed in quotes) Indicates end of program Stops program Transfers to line number XX Declares an array (Only one-dimensional arrays with an integer number of ele ments are allowed) Indicates an assignment statem ent (Additio, subtraction, multiplication, division, or special function may be used) tion, subtraction, multiplication, division,
REM
END STOP GO to XX DIM LET
IF expression THEN XX INPUT PRINT FOR NEXT
GO SUB NN RETURN CALL
GET PUT
Condition statem ent which transfers to line number XX if the condition of the ex pression is met Allows numeral data to be inputed via a terminal Allows numerical data and character strings to be printed on a terminal Causes program to iterate through a loop a designated number of times Signals end of loop and at which point the computer adds the step value to the varia ble and checks to see if the variable is still less than the terminal value Transfers control to a subroutine that begins at line NN Returns control to the line after the last GO SUB CALL (N ,A ,B ,. . . . ) N = subroutine No. as listed in assembly patch table A, B, etc. = parameters, con stants, variables, or expressions. (X) = READ 8080 INPUT PORT X (Y) = OUTPUT A BYTE OF DATA TO OUTPUT PORT Y
Table 3. BASIC operations and execution times. Operation ADD SUBTRACT MULTIPLY DIVIDE
Execution times on 8080 (msec) 2.4 2.4 5.4 7.0
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
USING THE BASIC INTERPRETER
GOTO
Starting the Interpreter The BASIC interpreter is presently configured so that it is located in memory pages 11 g to 34g. The starting address is 17g, location 0. This address begins an initialization sequence a second starting address—page 17g, location 23 g—can be used. This starting address is used if the user wishes to retain any program that might exist in memory. Once started the interpreter responds with READY. Entering a Line Each line entered is terminated with the carriage-return key. The line-feed key is ignored. It is possible to correct errors on a line being entered by either deleting the entire line or by deleting one or more characters on the line. A character is deleted w ith either the rubout key or the shift/ 0 kry. Several characters can be deleted by using the rubout key several times in succession. Character deletion is, in effect, a logical backspace. To delete the line you are cur rently typing, use the CNTRL/Y key. The above line-editing features can be used on command, program, or data lines. Commands The following commands are available: RUN - Begins program execution SCR - Clears program from memory LIST - lists program in memory PLST - Punches paper-tape copy of program PTAPE- Reads in paper-tape copy of program using high-speed reader The LIST and PLST commands can be followed by one or two line numbers to indicate that only a part o f the pro gram is to be listed. If one line number follows the command, the program is listed from that line number to the end o f the program. If two line numbers (separated by a comma) follow the command, the listing begins at the first line number and ends at the second. When a command is completed, READY will be typed on the teletype. Once initialized by a command, a process will normally go to completion. However, if you wish to interpret an executing program or a listing, simply strike CNTRL S and the process will terminate and a READY message will be typed, typed. Statements Each statem ent line begins with a line number, which must be an integer between 0 and 32767. Statements can be entered in any order, but they will be executed in numerical order. All blanks are ignored. A program can be edited by using the line numbers to insert or delete statements. Typing a line number and then typing a carriage return causes statem ent at that line number to be de leted. Since the statem ents can be entered in any order, a statem ent can be inserted between between two existing state ments by giving it a line number between the two existing statement line numbers. To replace a statem ent, the new statement should have the same line number as the old state ment. The following types o f statements are allowed: REM - Indicates a remark (comment). The system deletes bln deletes blanks from all character strings that are not enclosed in quotes (”). Therefore, it is suggested that characters following the REM key word be enclosed in quotes. END - Indicates the end of a program. The program stops when it gets to the END statement. All pro grams must end with END. STOP - Stops the program. This statement is used when the program needs to be stopped other than at the end of the program text.
DIM
January, 1977
l jjj
IF
INPUT
Transfers to a line number. This statement is used to loop or jump within a program. Declares an array. Only one-dimensional arrays with an integer constant number o f elements are allowed. An array with N elements uses in dexes 0 through N -l. All array locations are set to zero. No check is made on subscripts to en sure that they are within the declared array. An array variable must be a single letter. Indicates an assignment statement. Non-array variables can be either a single letter or a letter followed by a digit. It is possible to have an array and a non-array variable with the same name. The general form of the LET statement is: line number LET identifier = expression, where “identifier” is either a subscripted array element or a non-array variable or function (see section on functions) and “expression” is a unary or binary expression. The expression will be one of the following ten types: variable -variable - variable -variable variable * variable variable + variable -variable * variable variable - variable variable / variable, -variable + variable -variable / variable, where “variable” is an identifier, function, or number. The subscript o f an array can also be an expression. Numbers in a program statement or input via the teletype are handled with a floating-point package provided by LLL. Numbers can have any of the following forms: 4 ±4 .123 4. ±4.0 +.123 4.0 1.23 0.123 ±4 ±1.23 ±0.123 and the user may add an exponent to any o f the above forms using the letter E to indicate powers of 10. The forms o f the exponent are: E±1 E±15 E l E 15 E l E 15. The numbers are stored with seven-digit accuracy; therefore, seven significant figures can be entered. The smallest and largest num bers are ±2.71051E-20 and ±9.22337E18. This is the conditional statement. It has the form: line number IF expression relation expression THEN transfer line number. The possible re lations are: Equal = Greater than > Less than < Greater than or equal >= =< Less than or equal < If the relation between the two expressions is true then the program transfers to the line num ber, otherwise it continues sequentially. This command allows numerical data to be input via the teletype. The general form is: Line number INPUT identifier list, where an “identifier list” is a sequence o f iden tifiers separated by commas. There is no comma after the last identifier so, if only one identifier is present, no comma is needed. When an INPUT statem ent is executed, a colon (:) is output to
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 9
19
the teletype to indicate that data are expected. The data are entered as numbers separated by commas. If fewer data are entered than ex pected, another colon is output to the teletype, indicating again that data are expected. For example, where 50 INPUT I,J,K,P is executed, a colon is output to the teletype. Then, if only 3 numerical values are entered, an other colon will be output to indicate that more data are expected; e.g., : 4,4,6.2 C/R : 10.3 C/R where C/R is the carriage-return key. If an error is made in the input-data line, an error message is issued and the entire line of data m ust be re entered. If, for the above example, : 4,4,6M2,10.3 C/R is entered, the system will respond INPUT ERROR, TRY AGAIN At this time, the proper response would be 4,4,6.2,10.3 C/R. PRINT - This command allows numerical data and character strings to be printed on the teletype. Two types of print items are legal in the print statement: character strings enclosed in quotes (” ) and ex pressions. These items are separated by either a comma or a semicolon. If print items are separated by a comma, a skip occurs to the next pre-formatted field before printing o f the item following the comma begins. The pre-formatted fields begin at columns 1 ,1 4 , 27, 40, and 52. If print items are separated by a semicolon, no skip occurs. If a semicolon or comma is the last character on a print statem ent line, the appro priate formatting occurs and the carriage-returnline feed is suppressed. A print statem ent of the form 50 PRINT will generate a carriage-return-line feed. Thus, the two lines below 50 PRINT “ INPUT A NUMBER” ; 60 INPUT A will result in the following output: INPUT A NUMBER: For more examples, see sample programs in Appendix A. FOR - Causes program to iterate through a loop a desig nated number of times. NEXT - Signals end of loop at which point the computer adds the step value to the variable and checks to see if the variable is still less than the terminal value. GOSUB NN - Transfer control to a subroutine that begins at line NN. RETURN - Returns control to the next sequential line after the last GOSUB statement executed. A return statement executed before a GOSUB is equi valent to a STOP statement. CALL - Calls user-written assembly-language routines of the form CALL (N, A, B ,. ..), where N is a subroutine number from 0 - 2 5 4 and A, B ,. . . are parameters. The parameters can be constants, variables, or expressions. How ever, if variables and constants or expressions are intermixed, all variables should have been Page 10
20
referenced before the CALL statement. Other wise, the space reserved for newly referenced variables may overwrite the results of constants and expressions. A memory map of one con figuration o f the system is shown below: Page 10 Page 11
O P T STACK BASIC I NTERPRETER A C TIVE VAR'S.
First word of available memory
U SER SUB'S.
Pointer to first word of available memory anc subroutine table
USER SOURCE BASIC STK Page 43 Loc 370
The subroutine table contains 3-byte entries for each sub routine. The table directly follows the pointer to the first word of available memory (FWAM) and must end with an octal 377. A sample table and its subroutines is shown below: ORG 1/W 2Q DW SUBEND DB 1 DW SUB1 DB 4 DW SUB4 DB 5 DW SUB5 DB 2 DB SUB2 DB 377Q SUB1: i RET SUB5: 4RET • • RET SUBEND EQU
; Define FWAM ; Subroutine #1 ; Starting add of subroutine #1 ; Subroutine #4 ; Starting add of subroutine #4 ; Subroutine #5 ; Starting add of subroutine #5 ; Subroutine #2 ; etc. ; end o f subroutine table ; Subroutine #1 ; Subroutine #5
; FWAM
Addresses to passed parameters are stored on the stack. The user must know how many parameters were passed to the sub routine. These must be taken off the stack before RET is executed. Addresses are stored last parameter first on the stack. Thus, on entry to a subroutine, the first POP instruc tion will recover the address to the last parameter in the call list. The next will recover the next to last, etc. Each scalar variable passed results in the address to the first byte of a four-byte block o f memory. Each array element passes the address to the first byte of a (N-M) x four-byte memory block, where N is the number o f elements given the array in the DIM STMT and M is the array subscript in the CALL STMT. For passed parameters to be handled in expressions within BASIC, they must be in the proper floating-point format.
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January,
Functions Two special functions not found in most BASIC codes are available to input or output data through Intel 8080 port numbers. The function GET allows input from a port and the function PUT allows output to a port. Their general forms are: GET (expression) PUT (expression). The function GET may appear in statements in a position that implies that a numerical value is used. The function PUT may appear in statements in a position that implies that a numerical value will be stored or saved. This is because GET inputs a number and PUT outputs a number. For example, LET PUT(I) = GET(J) is valid while LET GET(I) = PUT(J) is invalid. These functions send or receive one byte o f data, which in BASIC is treated as a number from 0 to 255. Error Messages If an unrecognizable command is entered, the word WHAT? is printed on the teletype. Simply retype the command. It may also have been caused by a missing line number on a BASIC statem ent, in which case you should retype the state ment with a line number. If an error is encountered while executing a program, an error message is typed out that indicates an error number and the line number in which the error occurred. The meanings of the error numbers are given in Table 4. Table 4. Meanings of error numbers. Error num ber 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Error Program has no END statem ent Unrecognizable keyword at beginning of statem ent Source statements exist after END statem ent Designation line number is improperly formed in a GOTO, GOSUB, or IF statem ent Destination line number in a GOTO, GOSUB, or IF statem ent does not exist Unexpected character Unfinished statem ent Illegally formed expression Error in floating-point conversion Illegal use of a function Duplicate array definition An array is referenced before it is defined Error in the floating-point-to-integer routine, number is too big Invalid relation in an IF statem ent
During program execution and whenever new lines are added to the program, a test is made to see if there is sufficient mem ory. If the memory is full, MEMORY FULL is printed on the teletype. At this point, you should enter one o f the single digits below to indicate what you wish to do: Number entered Meaning 0 (RUN) runs the program in memory 1 (PLST) outputs program in memory to paper tape punch 2 (LIST) lists program in memory 3 (SCR) erases program in memory 4 none of the above (will cause WHAT? to be printed in teletype). January, 1977
To help you select the best alternative, a brief description of how the statements are manipulated in memory will be helpful. All lines entered as program are stored in memory. If lines are deleted or replaced, the original still remains in memory. Thus, it is possible, if a great deal of line editing has been done, to have a significant portion o f memory taken up with unused statements. If a MEMORY FULL message is ob tained in these circumstances, then the best thing to do is punch a tape of the program (entering number 1), then erase the program memory with a SCR command (or a number 3, if memory is too full to accept commands), and then re-enter your program using the high-speed paper-tape reader with the PTAPE command.
Appendix A: Sample Programs The program below gives a few examples of the use of the print statement. LIST 1PRINT“THE PRE-FORMATTED COLUMNS ARE SHOWN BELOW 2PRINT1,2,3,4,5
4PRINT 10PRINT“INPUT 1ST NUMBER” : 2 0 INPUTA 30PRINT“INPUT 2ND NUMBER” , 40INPUTB 50PRINT 60PRINT“A IS” ;A 70PRINT“ B IS” ,B 80PRINT“ A IS” ;A;“ B IS” ,B,“ A+B IS” ;A+B 100END READY RUN THE PRE-FORM ATTED COLUMNS ARE SHOWN BELOW 1.0000E 00 2.0000E 00 3.0000E 00 4.0000E 00 5.0000E 00 INPUT 1ST NUMBER:2
INPUT 2ND NUMBER A is 2.0000E 00 B IS 3.0000E 00 A is 2.0000E 00B IS READY
:3
3.0000E 00 A+B IS 5.0000E 00
The following program plots a function on a display. It uses four user-written assembly-language subroutines. The display works as follows: The contents o f memory locations on pages 274g to 277g are displayed as 16 rows o f 64 characters each. Thus, if location 201$ on page 274 contains 3 0 lg (ASCII A), an A appears in column 2 of Row 3. An example o f this pro gram’s execution is shown below: RUN WHAT SHOULD PLOT BE LABELED? MCS80 BASIC INTERPRETER
READY The BASIC and assembly-language programs and the display output are shown on the following pages.
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Pa9e 11
21
BASIC Program LIST THIS ROUTINE WILL PLOT A SET O F AXIS A N D A QUADRATIC FUNCTION I REM" O N A D I S P L A Y A N D T H E N L A B E L IT. IT U S E S A 4 U S E R W R I T T E N 2RF.M" 3REM" SUB-ROUTINES: 4REM C A L L ( 1 ,X,Y,C) - P L A C E S C IN C O L U M N X, R O W Y O F T H E D I S P L A Y 5RKM" W H E R E C IS AN A S C I I C O D E D C H A R A C T E R 6REM" 7R E M C A L L ( 2 , A (0)) - R E A D S A C H A R A C T E R S T R I N G F R O M T H E T T Y A N D S T O R E S 8RF.M" I T "IN A R R A Y A 9 REM" 1 0 REM C A L L ( 3 , A ( 0 ) ) - W R I T E S T H E C H A R A C T E R S T R I N G S T O R E D IN A R R A Y A 11REM" T O T H E D I S PLAY 12RE M " 13REM 14REM" C A L L (4) - C L E A R S T H E D I S P L A Y 15REM 16REM" S T A R T OF P R O G R A M 17 R E M 18REM" RESERVE STORAGE AREA FOR TITLE 20D I M A ( 1 0 ) 30REM" C L E A R S C REEN 4 0 CALL(4) 50REM" A SK FOR AND INPUT TITLE 55PR1NT"WHAT SHOULD PLOT BE LABELED?"; 6 0 C A L L ( 2 ,A ( 0 ) ) 7 0 REM" D R A W AXIS 80GOSUB500 90REM" PLOT FUNCTION 10 0 L E T X = - 2 9 110GOSUH1000 120CALL(1,31+X,8-Y,248) 13 0 L E T X = X + 1 140IFX>GET COLUMN ADD ;COPY TO FREG1
;FIX IT ;P N T T O
4TH
BYTE
jGET IT T O A ;C A L C U L A T I O N O F
ADDRES
j A D D IN C O L U M N L O C ;S T O R E C H A R A C T E R }D O N E ODT ;O D T R O U T I N E |6ET STORAGE AREA ADD ;INIT CNTR ;B U M P P N T R ;R E A D A C H A R A C T E R ;C R ? ;Y E S - D O N E ;INCR CNT ;S A V E C H A R A C T E R ;S T O R E
CNT
jSEND A
LF
1D O N E jGET ADD ;S C R E E N A D D >C N T }S E N D
STRING
;D O N E ;S C R E E N A D D }S P A C E }C N T R S {CLEAR
IT
;D O N E
LRKORS
SYMBOL TABLE
A COPDH FIX LUP M SCOPE SUB4
00 0 0 0 7 013212 014012 010720 000006 016633 017003
ADINC D FREGl LUP2 PSW SP
B DUN2 H LUP3 READ SUB2
016730 000002 016567 016740 000006 000006
000000 016756 000004 016772 000333 016734
C E L LUP4 SBEND SUB3
000001 000003 000005 017014 017027 016764
ERRORS
.•DEFINE E X T E R N A L S FIX EQU 140120 COPDH EQU 132120 165670 FREGl ECU ORG 166140 DW SBEND ;E N T R I E S I N S U B T A B L E DB 1 DW SCOPE DB 2 DW SUB2 DB 3 DW SUB3 DB 4 DW SUB4 DB 377Q ;T H E C A L L T O T H I S R O U T I N E C A L L (1 X Y C) }T H E V A L U E O F C I S P L A C E D ;O F T H E D I S P L A Y SCOPE: POP D LXI H FREGl 035 CALL COPDH 026 XCHG CALL FIX 030 INX D INX D INX D LDAX D MOV B A POP D
;F I X R O U T I N E ;COPY ROUTINE .•FLOATING P N T
REGISTER
;F W A M
;N O M O R E IS O F T H E F O R M IN C O L U M N
X
LINE
ENTRYS
Y
;A D D R E S S O F C H A R A C T E R .•COPY T O F R E G l j A D D R E S S T O DE ;F I X I T 7PN T T O 4TH BYTE
jGET CHARACTER ;S A V E I N B ;R O W A D D
Dr. Dobb's Journal of Computer Calisthenics & Orth
XX X
I
XXX
xxxxxxx Jxxxxxxx
x
MCS80 BASIC interpreter
Display output for preceding prwgram.
January, 1977
Appendix B: Description of Basic Interpreter Following is a brief description o f the BASIC interpreter. Hopefully, with this description, it will not be a major project to modify the BASIC to satisfy the reader’s specific needs. Formats Source statements are stripped of blanks on input (character strings enclosed in “ ” s are an exception) and stored as is in memory, using the following format: Binary equivalent of line no.
EVAL
FINPT
Length of ASCII source statement
n u Forward pointer to next sequential line
i ....r t ASCII source statement
The forward pointer links statements by ascending line num bers. The last line’s forward pointer (supposedly an end state ment) has value 177777s to indicate end of the list. The symbol table is built up at run time and begins after the most recently entered source statem ent (the variable STSPAC points to where the symbol table will start). Symbol table entries are shown below.
FIX FSYM
Scalar-variable format
Variable name
Forward pointer
Variable value
A r m y - v a r i a b l e format Bin
/-m o /-ASCI I letter
Array name
Forward pointer
A rray elements
Subroutines Following is a list of potentially useful subroutines, with a brief description on each subroutine: - Value pointed to by Hand L is tested to ALPHA see if it is an ASCII letter. CY = 1 => Yes CY = 0 => No - Same as above but tests for a decimal NUMB number (ASCII 0-9). CHAR2 - Inputs a character from the teletype to a register. CHAR5 - Same as above for HSR. CHK1 - Checks to see if HL are equal to 177777s (-1). CY = 1 => Yes. CY = 0 => No. CONV (CURT) - One o f the floating-point routines. Con verts floating-point number to a character string. O utput is padded to the output buffer. COPDH - Copies floating-point number pointed to by D,E to location pointed to by H,L; uses copy. COPY - One of the floating-point routines. Copies floating-point value pointed to by A,L to location pointed to by H,C. CUB - Converts the integer-character string pointed to by H,L to its binary equivalent. Value returns in D,E registers. DCOMP - Double-byte comparison routine. Com pares value in CB to the in ED. Z=1 => CB = ED CY = 1 => CB > ED CY = 0 => CB > ED. DFXL - One o f the floating-point routines. Used to float an unsigned integer H,L point to first of four bytes; integer is right justi fied in first three bytes. January, 1977
LADD LSUB LOIU LMUL LMCM
MCHK MEMFUL
MULT
NSRCH
OUTR PAD SYMSRT
Evaluates an expression the first element of which is pointed to by H,L and the length o f which is in C. Used to evaluate expressions wherever they are legal in BASIC. C usually contains the length of the source statement line containing the expression. One o f the floating-point routines. Con verts character string to floating-point number. The variable HLINP contains a pointer to the character string, and the variable CREG contains the length of line containing character string. Mode = 0 = > data comes from teletype (i.e., only de limiters are g’s). Mode = 1 => data comes from source statements. Fixes a floating-point number. DE points to number to be fixed. Error code 13 is given if number is too big to fix. Finds symbols in symbol table. BC con tains symbol. Returns with HL pointing to symbol value. CY = 1 => symbol was found. CY = 0 and a scalar => symbol not found, but inserted and initialized to 0. CY = 0 and an array => not found, no action taken: HL are meaningless. Floating-point add routine. Floating-point subtract routine. Floating-point divide routine. Floating-point multiply routine. One of the floating-point routines. Com pares two floating-point values HL Point to first HB point to second z = 1 => Equality CY = 1 = > first < second (Note: compares absolute only, does not reference mantissa sign.) Waits for flag from port 3. Proper mask is sent in register B. Checks to see if memory is full. HL point to location of memory to be checked. Memory is considered full if it is within 50jo locations o f the current value o f stack pointer. Multiplies two two-byte binary numbers. HL point to last byte of four bytes. First two contain first number. Last two con tain second number. Answer returns in BCDE. Routine to locate source line in memory passed binary value of line number in DE. Returns address o f line in HL, CY = 1 => not found. Used by CONV (CURT) to pad output to output buffer. Pads characters to output buffer. A con tains character; B contains number of pads. Checks a character string to see if it is a BASIC symbol. HL contains address pointing to first character o f symbol, C contains length o f line that contains sym bol. A contains type o f symbol sought. 0 = command 1 = keyword z = operator or delimiter 3 = function Returns with 377g in a register if nothing found. Otherwise A contains
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 13
23
symbol number in appropriate KDAT table. Thus, for symbol type 2, if a 4 is returned, the symbol found was the fourth one (starting w ith 0) in table KDAT3 (KDAT concatenated with 2 and 1 or A). CIS is updated, but HL is not. Inputs a line from teletype. Stores start TTYIW ing at location pointed to by HL. Line edits. Returns length of line in A register (maximum line length is 72 characters). Called with HL pointing to a variable, VALUE constant, or function; C contains line length, returns w ith DE pointing to floating-point value. HL, C are updated. Called with HL pointing to character VAR string, C has line length. Determines if character string is a variable. If so, returns with CY = 1, DE pointing to value (sub scripts o f arrays are evaluated, etc.). HL, C updated. If not, a variable returns CY = 0, HL, C untouched. Dumps contents o f output buffer to tele WRIT type. Uses entry WRIT1 w ith D register equal to one to suppress CR/LF. Part of floating-point subroutines. Writes ZROL a floating-point zero, starting at location pointed to by HL. The preceding list contains those subroutines most likely to be used by someone modifying BASIC. If you plan on using one o f the routines, you should examine it and its comments carefully. Variables Following is a list o f interpreter variables, with a description of each variable. Assembly time variable. Contains the MEMST first available RAM location. This is where active variables start. Assembly time variable. Contains the last MEMEND available location in RAM SEND Has value 6, used w ith RST instruction to print characters via ODT. O utput buffer, the first location contains OBUFF the number o f characters in the buffer +1. Input buffer, occupies same area as IBUF OBUFF. STLINE Points to first source line to be executed. If no source, contains 177777s. NLINE, NLZ, Contain address, binary-equivalent line NL4, NL6 number, forward pointer, and length of next input line. KLINE, KL2, Same as above, but used by a subroutine KL4, KL6 that inserts lines in sequential order (insert). PLINE, PL2, Subroutine insert to order statements PL4, PL6 sequentially. KASE, LEN Temporary storage for commandmode routines. MULTI, MULT2 Used to store binary values to be multi plied. SBSAV Temporary storage for commandmode routines. Next available location in memory, sym STSPAC bol table starts here at run time. Pointer to the current line at run time. LPNT Pointer to current character in current line CPNT at run time. Point to next sequential line at run time. KFPNT Two floating-point registers. FREG1, FREG2 Page 14
24
HLINP, CREG NXTSP GREG MODE MESCR
VARAD VEND FWAM
Temporary storage for HL and C registers for routine INP. Pointer to next available space of memory for symbol table. General register, in and out instructions are stored here and executed for get and put functions. Indicates to INP routine whether input data comes from source or teletype. Temporary storage for call-statement processor. Points to next available space after symbol table. Area after the symbol table is used to store intermediate results o f expressions or constants passed to user subroutines. Temporary storage space for input-statement processor. Assembly time variable. Indicates end of interpreter variable-storage area and where FWAM pointer is to go. First word of available memory pointer. This is where user source programs go.
Some o f the above variables occupy the same area o f mem ory. This is because some variables are used only in the com mand mode and others only at runtime. To conserve space, they share the same memory locations. N ew Statements To add additional statements to the BASIC, use the follow ing procedure. First, insert the statement keyword in the data tables for subroutine SYMSRT. Then, insert the starting ad dress of the statem ent processor in the interpreter JUMP table. Finally, the statement processor itself must be inserted. The keyword must be entered in the table KDAT2. The first byte must be the keyword length and the next bytes hold the ASCII-coded keyword. The table must end with a 371q . If the keyword is the N th entry in the table, on return from SYMSRT, the A register will hold N-l if the keyword is found. The starting address o f the statement processor must be in serted into table JTBL. The order o f keywords in KDAT2 must correspond with statem ent processor addresses in JTBL since, on return from SYMSRT, the A register times two is used as offset in JTBL to determine processor address. The statement processor must be placed somewhere in memory. Generally, the first thing done in the statement processors is to load the pointer to the statement (LHLD CPNT) and increment past the keyword (since HL is not up dated by SUMSRT). On entry, C contains the number of characters in the line minus those checked by SYMSRT. The end of the processor should be a “ JMPIEND” instruction.
N ew Functions New functions must be added to SYMSRT Data Table KDAT4 in the same manner as for key words. The function itself must be placed in subroutine “VALUE.” Presently, the only function in VALUE is GET.
Message Lines The following description tells how to incorporate messages into B ASIC output routines. Currently, to output a message to the teletype, the user executes an LXI H,ODATA, then a call to FORMK where K is an integer indicating which message is wanted (i.e., K = z indicates “ TURN ON PUNCH” ). FORM pads the message into the output buffer. Then A “ CALL
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
WRIT” writes the contents of the fubber. Suppose the message “ POTATO BASIC” is to be added. Preceding the form 9 instruction, we will insert “ FORIO: INR L.” At the end o f the ODATA table, we add “ DB ODAT8 and 377Q.” . And, after message ODAT 7, we add ODAT8 DB *12, “POTATO BASIC.” Now, the following program segment: LXI H,ODATA CALL FORIO CALL WRIT, will cause “POTATO BASIC” to be output to the teletype. C om plete Assembled, A nnotated Source Code Begins on N ext Page *12 is the character count in the message. FIRST JAPANESE COMPUTER CLUB & A WORLD WIDE CONTEST Japan has been slow to enter the microcomputer hobby; however, it looks as though the dam is breaking: there is now now a Japan Microcomputer Club (address: The 1st Ohkura Building 4F, 2-1 Nihonbashi, Chou-ku, Tokyo, Japan). At the Mini/Micro Exposition in San Francisco we picked up the first issue o f their newsletter (translated from Japanese) dated October, 1976. They already have a significant organi zational and administrative structure that includes club offi cers associated w ith the University o f Tokyo, Intel Japan, Waseda University, Keio University, Seikei University, SORD Company, Tokyo Institute of Technology, the University of Gifu, Hosei University, Nippon Tel & Tel, and JIPDEC . . . as well as other organizations, less well known in the U.S. They are having almost weekly symposia this fall, including speakers from NEC, TDK Fairchild, Toshiba, Fjuitsu, Hit achi, Intel Japan, Mitsubishi, and other Japanese microproces sor manufacturers. The back page of their “ Micro Computer News” men tions a microcomputers application contest: “ For develop ing techniques, directing a spotlight on to unknown talents, and encouraging new ideas, we are planning a contest in March, 1977. Anyone in the world can be an entrant. Subscription should be sent not later than February, 1977. No only winners but also all the entrants will have mar velous prizes!” Another interesting tidbit is that one o f the Club’s General Council Members, Hidetoshi Takahashi, was part of the JIPDEC Microprocessor Study Team which visited People’s Computer Company last spring [see DDJ, May 1976]. BOOK O N D IG IT A L T R O U B L E SH O O T IN G Many computer hobbyists are either neophytes or "software people who may have mad little or no experience in the care and feeding of LSI hardware. When their JOLT, KI M, or POLY breaks a leg they either ship it back to the factory, tote it to the nearest computer store, or shoot it. There is, however, a book that should be quite helpful in providing a basic understanding of digital troubleshooting techniques. This is Richard E. Gasperini's Digital Troubleshooting, available for $9. 95 from the Hayden Book Co., 50 Essex St., Rochelle Park, NJ 07662. This book introduces the reader to the fundamentals of bipolar and MOS technology, explains how to read logic diagrams, and dis cusses basic tools and diagnostic methods. It then covers the use of common digital circuits such as decoders, multiplexers, flip-flops, buffers, counters, and shift registers. The book does assume some prior knowledge of electronics, but not of digital circuitry. It dis cusses the use of memory and display devices, and gives many useful tips on soldering and unsoldering ICs, obtaining replacement parts, etc. Chapter 18 contains some good suggestions on obtaining addi tional information, and an appendix explains how to interpret manu facturer's part numbers, such as SN74LS195N. Jim Day January, 1977
FLOPPY DISC SY STEM (S?) FOR N O N -H A R D W A R E TY PES Dear Jim, Dec. 22, 1976 A few weeks ago I called you seeking advice for a client. They were interested in acquiring a microcomputer with dual floppies that had a good BASIC and text editing capabilities. Sounds easy so far. The only hook was that the system was to be used by non-professionals in a non-technical environ ment with no hardware types around and only BASIC pro grams available. After talking to you, I sought advice from a few others, as well. I was surprised at the result . . . if my clients want to buy today, there appears to be only one professional quality (non-hobby) system that fits their needs. That is the DTC Microfile. All other possibilities are in various stages of “development,” “ testing,” “ debugging” or are too new to have any track record. Microfile has been installed in the U.S. and abroad and appears to be a proven system. It’s easy to use and beginners, with a little training, can easily use the text editor. I assume that more users like my clients exist, and I assume that more vendors will attem pt to match what DTC has already done or improve on it. How about you guys (vendors) keeping us informed as the systems come on the market. Sincerely, LeRoy Finkel CACHE S U R V E Y Results o f a survey o f the members o f CACHE (Chicago Area Computer Hobby Enthusiasts) taken at the September meeting. ♦ How many members have an 8080 or Z80 computer “ up & running” as of this date? 37 members. ♦ How many members have a system “ up & running” with any other CPU? 16 members. ♦ Of those with 8080’s, how much contiguous memory is currently available for applications program (RAM)? Greater Greater Greater Greater Greater Greater Greater Greater Greater
than than than than than than than than than
0 but less than 1K: or equal to 1 but less than 2K: or equal to 2 but less than 4K: or equal to 4 but less than 8K: or equal to 8 but less than 12K: or equal to12 but less than 16K: or equal to16 but less than 24K: or equal to24 but less than 32K: or equal to 32 but less than 64K:
1 member 2 1 7 11 6 4 5 0
♦ Of those with 8080’s, how many members do not have Page 0 available for applications programs? 1 member. ♦ Of those with 8080’s, how many have a terminal device “ up & running” through parallel I/O ports (no software UARTS)? 16 members. ♦ Of those above, how many know how to write I/O drivers for their terminal? All 16 members knew how. ♦ Of those above, how many can use an I/O driver of the form below? GET:
IN ANI J(N)Z IN ANI RET
TI RP TIRM GET TI DP 177Q
PUT: PUT 1 :
PUSH IN ANI J(N)Z POP OUT RET
PSW TORP TORM PUT1 PSW TODP
All 16 members could.
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 15
25
MEMST MEMEND S E ND CBUFF IBUF S T L 1 NE N L I NE NL2 NL4 NL6 KLINE KL2 KL4 KL6 PL I NE PL2 PL4 S2SAV PL6 KASE LEN MULTI MULT2 NXTSP STSPAC NORM FLOAT 2r?0L LPNT KLEN CPNT KFPNT FREG2 CREG L AD D L MUL LDI V LSUB DFXL LMCM HLINP GREG FREG1 SCR
030000 037777 ooooos 030000 030001 030111 0301 13 0301 I 3 030117 030121 030122 030124 0 3 0 I 26 030)30 030131 030133 030135 030135 030137 0 3 0 1 *0 0301 030142 0 3 0 ’ 44 030131 030113 007 70 7 007712 007715 030J22 030130 U30133 030126 030200 0302.04 0 0 7 /2 0 007723 007726 007731 007734 007737 030206 030167 0 3 0 i 74 0301-16 007745 030205 007750 007753 007756 007761 007754 007767 030210 030212 030214 030216 030220 030224 030216 000024 030226 030252 030252
CeNV
MODE FIN PT MUL T P7VAL DCOMP MCHK CH A R 2 MESCR VARAD VNAME VLCC FLIMT NEST STAC STSI Z T OP NS BOT NS V E ND ; MAIN
010000
010000 010003 010005
010010 010012 010013
010015 01 0 0 2 0 010023 01 0 0 2 6 010031 010034 Oi 0 0 0 7 010042 0 1 0 0 13 01004 4 010045 010046 010047 01 0 0 5 2 010053
010005 010060
01 0 0 6 3 010065 010071 010074 01007?
Page 16
26
041 066 041 066 054 066 052 042 061 041 315 315 052 043 013 043 043 043 3 l5 1 17 376 312 315 332 315 3^4 3f5 303
000 001 111 377 377 320 1 13 377 13 2 1 10 320 1 13
06 0 060
03 7 060 077 024 024 022 060
31 1 0 2 3 000 03 7 0^2 10 2 024 ?36 21 7 037
M1:
020 022 020 022 021 020 020
M1 A: M2: M3:
EQU 30000Q EQU 37777Q EOU 6 EQU MEMST EQU MEMST+ 1 EQU MEMST + 1 1 1 Q EQU MEMST +1 1 3Q EQU MEMST♦ 1 15Q EQU M E M S T * 1 17Q EQU M EMST +1 21 Q EQU MEMST♦ 1 22Q EQU MEMST+ 1 24Q EQU MEMST+ 1 2 6 Q EQU MEMST+ 1 30Q EQU M E M S T + 1 31 Q EQU M EMST + 1 3 3 Q EQU M EMST + 1 3 5 Q EQU PL4 EQU MEMST+ 1 37Q EQU MEMST + 1 4 0 Q EQU MEMST+ 1 4 1 Q EQU MEMST+ 1 42Q EQU MEMST+144Q EQU MEMST + 1 31 Q EQU M EM ST + 1 13Q EQU 7707Q EQU 7712Q EQU 7 71 5Q EQU MEMST + 1 2 2 Q EQU MEMST+ 1 30Q EQU MEMST + 1 3 3 Q EQU MEMST+ 1 26 Q EQU MEMST + 2 0 0 Q EOU MEMST + 2 0 4 Q EQU 7720Q EQU 7723Q EQU 7726Q EQU 7731Q 7734Q EQU EQU 7737Q EQU MEMST+2060 EQU MEMST+167Q EQU MEMST + 1 7 4 Q EQU MEMST+146Q EQU 7745Q EQU MEMST + 2 0 5 Q EQU 7750Q EQU 7753Q EQU 7756Q EQU 7761Q EQU 7764Q EQU 7767Q EQU MEMST + 2 1 OQ EQU MEMST + 2 1 2Q EQU MEMST + 2 1 4Q EQU MEMST + 2 1 6Q EQU MEMST + 2 2 0 Q EQU MEMST + 2 2 4 Q EQU MEMST + 2 2 6 Q SET 20 EQU ST AC EQU STAC+STSIZ EQU M EMST + 2 5 2 Q R 0UT 1N E- -HANDL ES ALL ORG 1 OOOOQ LXI H,OBUFF MVI M, 1 LX! H ,S T L INE MV! M ,377Q I NR MVI M ,377Q LHLD FWAM SHLD NL I NE LXI SP,MEMEND LXI H,ODATA CALL F 0 RM 1 CALL WRI T LHLD NL I NE 1 NX H I NX H I NX H I NX H I NX H CALL TTY IN MOV C, A CPI 0 JZ M3 CALL ALPHA JC M4 CALL NUMB CNC WHAT CALL INSERT J MP M3
; MUST
USER
B E ON P A G E BOUNDARY
; R S T F OR ODT ; I N P U T AND O U T P U T ; SAME AR E A
BUFFERS
; RETURN
FOR
ADD.
SAVE
CALL
OCCUPY
STMT.
D E F I N E MEMORY SCR A R E A P N T R T EMP S P A C E F OR I N P . S T M T . T EMP S P A C E F OR ' F O R - N E X T ' T EMP S P A C E FOR ' F O R - N E X T ' T EMP S P A C E FOR ' F O R - N E X T ' NESTING STACK-POINTER F O R - N E X T N E S T I N G STACK STACK S I ZE,ALLO WS 10 NESTED FO RTOP OF S T A C K NEXT BOT TOM OF S T A C K ,DEF END OF V A R . S T O R A G E AR E A INPUT
; G E T ADORE S O F JSTORE I N FREE
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
FWA MEM. SPACE PN T R.
January, 1977
07C
0 1 0 | 02 010*04 0 1 0 i 07 01 0 i 1 0 010113 oi o n 4 0 1 0 117 010120 010123 010125 010127 010132 01 0 1 3 5 010136 010141 010142
000 31 5 3 6 7 074 31 4 2 C 6 075 3 1 2 173 075 31 4 2 5 2 312 026 075 3 1 4 321 312 026 075 312 000 075 304 236
010145 Oi 0 1 5 0 010152 0 1 0 ’ 55 010160 010161 010163 0 1 0 i05 010171 010174 010!77 010202 010204 010207 010210 010211 010212 010213 010214
315 376 312 315 1 17 376 312 315 332 315 31 5 376 312 043 043 043 043 043 303
010217 010220 010221 010222 010225 010227 010232 010235 010236 010237 0!0242 010245 01024 5 010247 010250 010253 0 1 0 2 56 010261 010264 010267 010272 010275 010277 010300 010003 010304 010305 010307 010312 010313 010314 010316 010317 010320 0 1 0 3 23 010324 010327 010332 010335 010340 0 1 0 3 41 010342 010343 01034 5 0103 4 7 0 1 0 350 010351 0 10 3 5 4 0 1 0 3 57 010362 0 1 03G5 010370 010373 010374
053 161 043 315 052 376 005 332 242 304 236 173 027 334 236 052 113 16 2 043 163 041 113 315 356 052 1 11 315 2 43 322 32^ 052 1 13 042 111 026 377 13 2 31 5 2 1 3 043 176 306 005 052 113 205 15 7 076 000 214 147 042 113 311 042 122 041 122 315 356 041 1 15 126 054 136 041 12 4 106 054 1 16 3 1 5 361 31 2 0 ^ 1 3 3 2 172 0 5 2 12 6 315 243 3 3 2 •:>1 7 345 0 5 2 12 2
January, 1977
010 000 1J5 325
A, 0 MV! CALL SYMSRT I NR A M4A: CZ WHAT OCR A JZ RUN OCR A CZ TAPE JZ M2 DCR A CZ L IS T JZ M2 DCR A JZ Ml DCR A CNZ WHAT : ROUT I N E TO I N P U T FROM HSR CALL CHAR5 PTAPE: CPI 0 JZ PTAPE HSR I N CALL PT 1 : MOV C, A CPI 0 JZ PTAPE ALPHA CALL M4 JC CALL INSERT CALL CHAR5 CPI 0 JZ M2 I NX H H 1 NX I NX H I NX H H I NX PT 1 JMP ROUT I N E TO H A N D L E A L L S OURC E L I N E I N P U T . T H I S I N C L U D E S I N S E R T I O N , D E L E A T 1 ON. AND . AD D I T I O N CF NEW SOURC E L I N E S . DCX H INSERT MOV M,C I NX H CALL CVB CPI 5 JC I SRI A CNZ WHAT MOV A,E RAL CC WHAT LHLD ISR1A: NL I NE MOV M, 0 I NX H MOV M,E LXI H,N LIN E CALL PTVAL L HLD STL INE CALL CHK1 J NC ISRT3 L HLD N L I NE SHLD STLINE MV 1 ISRT1 D ,3770 MOV CALL I tpnt I NX H ISRT2: MOV A, M ADI 5 LHLD N L I NE ADD L MOV L .A MV 1 A, 0 ADC H MOV H, A SHLD N L I NE RET ISRT3: SH L D KLINE ISRT4: LX I H,KLINE CALL PTVAL LX I H, N L 2 MOV D,M I NR L MOV E.M LX I H,KL2 MOV B, M I NR L MOV C,M CALL DCOMP JZ ISRT6 JC I S R 12 LHLD KL4 CALL CHK1 JC ISRT5 PUSH H LHLD K L I NE
M4: 022 021 026 021 020 021 020 020 021 025 020 024
000 1^5 0^2 r 02 217 010 000 026
020 022 020 020 025
153
020
020
022 020 021 021 060
060 017 050 022 020 060 060 021
060
060 060 060 01 7 060
060
01 7 021 021 060 022 021 060
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 17
27
0 1 0 3 77 01 0 « i 0 2 0 1 0 4 05 01 0 4 1 0 01 0 4 1 1 01C414 010417 0 1 0 4 22 010425 010425 0 1 C427 010432 010435 010435 010441 010444 010447 01C452 010455 01045$ 010451 010462 010453 010465 010471 0 1 0 4 74 010475 010500 010503 01 0'J>04 010507 010510 01 0 5 1 3 01 OS 1 4 010517 0 1 C522 010025 010525 0 i 0531 010532 0 1 0S33 010536 010541 0 1 C544 01 0 5 4 5 010550 010553 010555 010551 010554 010567 010572 010575 010575 010501 010504 010605 0 1 0C10
042 041 315 341 042 303 052 315 310 353 052 315 353 303 052 315 302 052 353 052 345 301 315 052 312 353 052 315 31 1 042 31 1 052 353 052 315 052 353 052 345 301 31 5 31 2 052 353 052 315 04 1 303 052 042 303 05 2 353 052 31 5 310 31 5 303
010613 010614 010615 010616 010617 010620
043 043 16 3 043 162 31 1
010621 010622 010623 010524 010625 010625 010627 010630 010633 010634 010635
345 043 043 043 043 1 16 043 315 341 271 31 1
010536 010641 010644 010647
041 315 315 303
010652 010653 010654 010657 010662 0106S5 01066 7 010670 010672
365 305 041 315 31 5 076 301 OOP 365
Page 18
28
131 131 356
060 060 01 7
122 327 1 13 221
060 020 060 021
12 2 213
060 021
275 1 13 221 1 10 111
020 060 021 021 060
122
060
361 1£ 6 10 4
01 7 060 021
131 213
060 021
11 1 060 126
060
1 13 213 122
060 021 060
11 1 060 361 161 1 13
01 7 021 060
131 0 6 0 21 3 0 2 1 121 0 6 0 304 020 1 13 0 6 0 1 11 000 15 3 0 2 1 12 2 0 6 0 1 13 221
060 021
213 1£2
021 021
161
022
132 104 320 023
024 024 022 020
13 2 107 320 000
024 024 022
100
ISR T5:
IS R T 6:
SHLD LXI CALL POP SHLD J MP LHLD CALL RZ XCHG LHLD CALL XCHG J MP LHLD CALL JNZ
PLINE H ,PLIN E PTVAL H K L I NE ISRT4 NLINE NOLINE K L I NE STPNT ISRT1 NLINE NOLINE ISRT8 ST L INE
LHLD KLINE P US H H POP B CALL DCOMP LHLD KL4 JZ ISRT7 XCHO LHLD PLINE CALL STPNT RET SHLD 1SRT7: STLINE RET ISRT8: LHLD KL4 XCHG LHLD NLINE CALL STPNT ISRT9: LHLD KLINE XCHG L HLD STLINE P US H H POP B DCOMP CALL JZ I SR11 LHLD NLINE XCHG LHLD PLINE CALL STPNT ISR10: LXI H. NL6 J MP ISRT2 I S R I 1: LHLD NLINE SHLD STL1NE JMP ISR10 1SR12: LHLD KLINE XCHG LHLD NLINE CALL NOLINE RZ CALL STPNT J MP ISRT9 : R O U T I N E TO S T O R E P O I N T E R S I N T O MEM ARRAY STPNT: INX H INX H MOV M, E I NX H MOV M, 0 RET : R O U T I N E TO CHECK NEW L I N E FOR SOURC E S T M T . NOLINE: PUSH H INX H INX H INX H INX H MOV C,M I NX H CALL LENGTH POP H CMP C RET : R O U T I N E 1 0 RE S P OND W I T H ' W H A T ? * FOR U N I D E N T I F I E D : COMMAND. LXI WHAT: H.ODATA F0RM7 CALL CALL WRIT J MP MIA : R O U T I N E TO PUNCH P A P E R T A P E O F S O U R C E . TAPE: P US H PSW P US H B LXI H,ODATA CALL F0RM2 CALL WRIT A.O MVI POP B MVI B ,100Q P US H PSW
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
010673 0 1 0 3 74 0(0677 0 10/02 01070 3 010704 010707 0 1 0 /1 0 010711 0 1 0 /1 4 01071 7 0 10/20
305 315 31b 301 305 315 3 01 361 31 31 5 361 31 1
010721 010724 010727 010732 010735 010740 010743 010744 010747 010752 010753 010754 010755 010756 010757 010760 010761 010764 010767 0 i 0 7 70 0 1 0 7 73 010774 010777 011000 011001 011002 011005
255 320
022 022
321
021
255 320
022 022
052 31 5 332 042 041 042 015 304 052 043 043 10 6 043 1 16 305 043 315 315 301 052 353 315 310 150 141 315 303
111 243 023 131 377 12 2
060 022 020 060 377 060
1 15 131
025 060
011010 011012 011013 011014 011016 011020 011023
333 037 320 333 37G 312 31 1
003
011024 011025 011027 011031 01;032 011033 011034 011037 011040 011041 011042 011043 011045 011047
305 006' 016 176 270 077 322 271 301 31 1 305 006 016 303
01 1 0 5 2 011053 011054 011057 011060 01 1 C 61 011063 01 1 0 0 6 011071 011072 011073 011074 011077 011102 011105 011110 011113 011116 011117 011120 01 1 1 2 2
345 305 315 365 345 376 312 041 16 7 054 1 61 041 042 041 012 041 315 343 176 336 202
January, 1977
P US H CALL CALL POP PUSH CALL POP POP CALL CALL
12 2
060
361
01
010 352
022 021
002 223 023
7
020
260 272
040
022
301 333 031
022
1 61
022
000 15 0 14 0
022 060
Ol 2 142 000 14 4 14 5 353
000 060 000 060 060 01 7
260
PAD WRIT
B B
L IS T
B
PSW PAD WRI T PSW
se? TO L I S T TO T T Y T LHLD STL INE CALL CHK1 JC MIA SHL O PLINE LXI H , 177777Q SHLD KLINE DCR C CNZ BOUND LHLD PLINE LIS1 INX H INX H MOV B,M I NX H MOV C.M P US H B I NX H CALL FORMS WRIT CALL POP B LHLD KLINE XCHG CALL DCOMP RZ MOV L,B MOV H, C CALL Q U I TT ; CHECK FOR I N T E R R U P T I O N J MP L IS 1 : NONE - C O N T I N U E j I H I 5 K D U I I N t CHt OK. 5 P ORT Z FOR A C N T R L / S CH A R A C T E R ; I F ONE I S FOUND T H E N E X E C U T I O N I S TO B E I N T E R R U P T E D ; CONT ROL I S P A S S E D TO M I A IN 6u it t : ; T E ST FLAG PORT RAR ; F L A G TO CY RNC ; N O T H I N G THERE IN 2 ; F L A G WAS S E T , G E T DAT A CPI 223Q QTCHK: ; WAS I T C N T R L / S ? JZ M1A • YES RE T •NO, RETURN R O U T I N E S NUMB AND A L P H A CHE CK I F C O N T E N T S OF MEMORY L O C A T I O N I N HL C O N T A I N A S C I I N U M E R I C OR A L P H B E T I C C H A R A C T E R . R E T U R N CY = 1 I F Y E S , C Y = 0 I F NO. NUMB: B PUSH MVI B , 260Q MVI C , 272Q Cl: MOV A,M CMP a CMC J NC BAC CMP C BAC: POP B RET ALPHA: P US H B MVI B , 301Q MVI C . 333Q J MP C R O U T I N E TO C O N V E R T A S C I I N U M E R I C C H A R . S T R I N G TO E Q U I V A L E N T B I N A R Y NUMBER. R E T U R N S E Q U I V A L E N T I N DE REG. L E N G T H OF L I N E P A S S E D I N REG C AND R E T U R N E D P O I N T I N G TO L A S T N U M E R I C C H A R . L E N G T H OF CHAR S T R I N G R E T U R N E D I N REG A . 6vb P US H H B P US H CALL LENGTH PUSH PSW PUSH H
,
1 11 024 320 022
B
nuu
L IS T:
CVB1
CPI
0
JZ LXI MOV •I NR MOV LXI SHLO LXI SHLD LXI CALL XTHL MOV SB I ADD
CVB2 H,KASE M, A L M, C H. 1 0 MULTI H, 0 MULT2 H,MULT2+1 MULT A, M 260Q D
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 19
29
/
0 1 ' 123 01 i ) 2 4 o n i O IH P 7 0 1 1 1 VO 011131 O i l 132 O i l 133 011134 01 l i 3 5 01 1 1 3 6 O il’ ll o n i ■-(: 0111-13 0111-11 011145 O i l 150 011151 O i l t52 O il 53 011156 O i l 157 01 11 CO
127 07G 0 0 0 213 137 043 343 162 054 16 3 345 0 4 1 141 065 055 065 341 302 1 i 3 341 361 301 141 041 1 16 341 31 1
011161 011162 oi n e3 011165 011170 011173 011174 O il 175 011176 011201 011204 oi i 205 01120$ 011207
305 345 006 o 15 322 043 004 015 312 303 170 341 301 31 1
060
022
060
000 02 4 204
022 022
204 16 5
022 022
011210 011213 011216 011217 011220 O i l 221 011222 011225 011230 O i l 231 011232 011233 011234 011235 011240 011241 011242
052 1 1 1 31 5 2 4 3 330 106 043 1 16 3 1 5 361 312 2 4 0 043 176 043 146 157 303 213 053 267 31 1
060 022
01 1 2 4 3 O i 1? A 4 0 l 1 24 1 ' 011247 011251 01 > 2 r'>? 011253 011254
305 345 006 000 0 1 6 001 01 1 341 301 31 1
011255 011256 011257 01 1 2i >0 O il 01 1 2C-1 01 1 26>d 011 0 112/0 O i l 271 011274 011275 0 1 1 27b 01 1 S O I 011302 011303 011304 011305 011310 011311 011312
305 325 345 041 1 15 156 127 076 275 302 151 167 315 054 162 054 005 302 172 105 1 51
Page 20
30
000
01 7 022
022
MOV D, A MV 1 A, 0 ADC E MOV E, A I NX H XTHL MOV M.O I NR L MOV M.E P US H H LX 1 H, LEN DCR M DCR L DCR M POP H JNZ CVB1 POP H CVB2: POP PSW POP B LX 1 H, LE N MOV C,M POP H RET R O U T I N E TO E V A L U A T E L E N G T H OF A S C I I N U M E R I C CHAR S T R I N G : P A S S E D ADD OF F I R S T CHAR I N HL R E G , R E T U R N S L E N G T H I N REG A . B • LENGTH: P US H P US H H MV 1 B, 0 NL E 1 : CALL NUMB J NC NLE2 I NX H I NR B DCR C JZ NLE2 JMP NLE1 MOV A, B NLE2: POP H POP B RET R O U T I N E TO L O C A T E SOURC E L I N E I N MEM. P A S S E D B I N V A L U E OF L I N E NUMBER I N D E ( L O W , H I GwH. ,), R E G. R E T U R N S A D D R E S S OF SOURCE L I N E I N HL R E G S . ( H I G H , L O W ) . CY S E T = @ NOT F OU N D . STLINE LHLD NSRCH: CHK1 CALL L2: RC B, M MOV NX d 6 omp CALL F OU ND JZ I NX H MOV A, M I NX H MOV H.M MOV JMP h A OCX H F OUND: ORA A RET ; R O U T I N E TO COMPARE C O N T E N T S OF HL TO 1 7 7 7 7 7 Q . I F Y E S : CY = 0 I F NO. ; RETURNS C Y - 1 PUS H B CHK 1 : PUSH H MVI B ,0 MV1 C,1 DAD B POP H POP B RET ; R O U T I N E TO F AD O U T P U T B U F F E R W I T H C O N T E N T S OF : REG B C O N T A I N S NUMBER OF CHAR TO P A D . P US H B PAD: PUSH D
050
111 PI
30 Z
022
320
022 P2:
270
02?
L^FH MOV MOV MOV MV I CMP JNZ MOV MOV CALL I NR MOV I NR DCR JNZ MOV MOV MOV
REG A .
H,OBUFF C ,L L.M D,A A , 73 L P2 L, C M.A WRIT L M.D L B P1 A,D B ,L L.C
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
011313 011314 011315 011316 011317
160 341 321 301 31 1
011320 011322 01 1 3 2 3 01 1 3 2 4 01 i r = 2 5 011330 011331 011332 011333 011336 011337 011340 011341 011342 011343 0 1 1 3 43 011347 0 1 i 352 01 1 35-1 0 1 '3 5 5 011357 011330 011351 011363 011354 011365 011356
026 355 345 305 041 345 1 16 015 312 054 1 76 367 054 015 302 0?5 31 2 076 367 07*3 367 341 066 301 341 361 31 1
0 1 1 367 01 1 b 7 0 011371 011372 011373 011376 011377 011402 01 1 4 0 4 0 1 1 405 011405
325 305 345 345 041 161 041 036 205 15 7 156 1 16 054 106 343 1 76 270 302 015 312 345 Coi 305
0 1 1 4 ;c-
n 1 i j 50 0 1 1431 0 ’ 1 't>2 0 1 1 453 0". 1 0 4 01 1 4 5 7 0114:0 0 1 1 4 61 0 1 14 6 2 0 1 1 463 0 1 1 464
011465 o i : 4C-6 0114/1
0 1 1 4 74 O' i 1 4 7 5 011477
011500 011503 01 i 5 0 4 01 1 505 0 1 1 506
January, 1977
000
060
360
022
337
022
360 215
022
212 001
1 41 1 13 000
043 077 141 042 O' O
01 4 341
0 ! 14 4-1 O i 1 4-17
000
34 5 3 45 ca i
141
161 157 142 176 034 1 17 074
30p 041
Oi o
CC4 036 1 73
377
041
14 1
136 035 341 341
141
MOV M, B POP H POP D POP a RET ; R O U T I N E TO DUMP O U T P U T TO T T Y . WR1 T : MVI D, 0 W RIT1: PUSH PSW PUSH H PUSH B LXI H,OBUFF PUSH H MOV C,M DCR C W2 JZ I NR L MOV W1 A.M RST S E ND ; P R I NT V I A OOT I NR L DCR C JNZ W1 DCR D JZ W2 MVI A ,215Q RS T S E ND ; PR I NT V I A ODT MVI A , 2 1 2Q RS T S E ND ; PR I NT V I A ODT W2 : POP H MVI M. 1 POP B POP H POP PSW RET R O U T I N E TO L O C A T E COMMANDS, KE Y WORDS, O P E R A T O R S , AND F U N C T I O N . HL C O N T A I N S ADD OF F I R S T C H A R . : REG C C O N T A I N S L E N G T H OF L I N E : R E T U R N S SY MBOL NUMBER I F FOUND I N REG A , 3 7 7 0 I N A I F NOT F OU N D . &YMSRT: PUSH D PUSH B P US H H H PUSH H. LEN LXI ; SAVE C I N LEN MOV M, C LXI ; L O C A T E T Y P E OF SY MBOL S O U G H T . H,KDATA MVI ; REG A C O N T A I N S : E.O ; 0 FOR COMMAND ADD L ; 1 FOR KEYWORD MOV L ,A ; 2 FOR O P E RAT O R AND D E L I M I T E R L.M MOV MOV C,M S2: : 3 FOR F U N C T I O N I NR L S3: B.M MOV XTHL A.M MOV B CMP JNZ 54 C DCR JZ 55 H PUSH H, L EN LXI DCR M POP H JZ S4A H I NX XTHL S3 JMP I NR S4A: C POP S4: H MOV ADD L* C D, H MOV POP H B POP B PUS H H PUSH H P US H LXI H, LEN MOV M, C MOV L, A MOV H, D MOV A, M I NR E MOV I NR £ ‘A JNZ S3 LXI H, L E N I NR M MVI E,377Q MOV S5: A, E MOVE S Y MB OL NUMBER I N T O REG A LXI H, L EN MOV E.M DCR E POP H POP H
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 21
31
301 1 13 321 31 1
* * * *
1 1 1 17
1
001
6 C,E D
KDAT3:
OF
MUST
C H AR.
BE
LEFT IN L I N E 1 NT
ON ONE
PAGE
0 1 2 3 4 5 6 7 8 9 10 11 12
DB 1 ,2 74 0 ,1 ,2 7 60 DB 1 ,2 54 0 ,1 ,2 7 50 DB 1 , 251Q DB 1 ,';'+ 2 0 0 0 4 DB « « « J « f « CHPAR DB ' T ' OR 2 0 0 Q CHPAR " ' H" ' ' H ' OR 2 0 0 Q DB *»«£*## CHPAR ' E ' OR 2 0 0 Q DB CHPAR ' " N " ' ' N ' OR 2 0 0 0 DB 2 DB * » / J i ## CHPAR ' T ' OR 2 0 0 0 DB ' ' ' 0 ' ' ' CHPAR DB ' 0 ' OR 2 0 0 Q 4 DB " 'S ' " CHPAR ' S ' OR 2 0 0 Q DB • * t y • 0 • CHPAR ' T ' OR 2 0 0 Q DB CHPAR DB ' E ' OR 2 0 0 Q 0 • *p • 0 • CHPAR ' P ' OR 2 0 0 0 DB 1 , ' * ' +200Q DB 1 , 2 5 7 Q , 1 , 253Q D3 1 , 255Q C3
•
>
t - ■
#, # THEN
; TO
; STEP
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
01 I 6 7 7 011700 011704 01 1 7 1 0
377 003 003 377
307 320
305 325
3 2 4 KDAT4: 324
DB 03 DB DB
3770 3 ,3 0 7 0 ,3 0 5 0 .3 2 4 0 3 ,3 2 0 0 ,3 2 5 0 ,3 2 4 0 377Q
: GET : PUT
‘ * ***,*? * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * x * * * * * * * * * * * * * * * i
011711
011712 011714 011717 01 1 7 2 1 011724 011726 011731 011733 01 1 7 c *3 01174 0 011743 0117^5 01 1 700 011752 01 1 7 “35 011756 01 1 7. >7 011760 01 1 ^ 6 3 0 1 1 7 06 0 11770 011/71 011772 0117/3 011776 01177/ 0 1 2C00 0> 2 0 0 1 0 i2003 01 ? 0 0 4 0 1 ?0Q5 0 ’ 2007
0 1 2 0 10
01 201 2
012013 012015
01 2 0 1 6 012017
01 2 0 2 0
012021 012022 01 2 0 2 3 012024 012026 012030 012031
012022 012033 012036 012037 012042 012043 012046 012050 01 2 0 5 3 012054 012057 01 2 0 6 0 012061 01206 2 012063 012064 012065 012066 012067 012072 012073 012074 012075 012076
January, 1977
345 006 315 376 312 376 312 376 312 376 312 376 31 2 376 312 16 7 043 004
000 367 231
017
001
024
377
36 6
023
337 3 71
023
212 314 010
024
214 314
023
31 5
024 303 314 076 337 367 053 005 362 314 341 257 31 1 076 334 367 0 7 6 000 341 31 1 0 7 6 212 367 0 1 6 COO 341 170 271 310 325 345 345 036 026 257 272 176 302 273 302 024 303 376 312 273 302 025 343 167 043 343 01 4 043 005 302 171 341 341 321 31 1
023
215
025 023
023
242
000
053
024
0- 16
024
060 240 065
024 024
060
024
030
024
o ! t T ^ I S P V T SOURC E L I N E FROM T T Y . P A S S E D ADO OF F I R S T CHAR I N H L . R E T U R N S L E N G T H OF L I N E I N REG A 1“TY I N : P US H H MV I B, 0 TIN1 CALL CHA R 2 CPI 2 3 1Q ; C N T R L Y? JZ TIN 5 CPI 377Q ; RUBOUT ? JZ T I N2 CPI 33/Q ; BACK ARROW ( R U B O U T ) ? JZ T I N 2 +3 CPI 21 20 ;LF? JZ T I N1 CPI 21 5 0 ; CR JZ TIN 4 214Q CPI ; FORM F E E D ? JZ T I N1 : I GNORE MOV M, A I NX H I NR B CALL MEMFUL JMP T I N1 MV I T IN 2: A,337Q RS T SEND I PR I NT V I A O D T DCX H DCR B JP TIN1 POP H XRA A Z E RO A RE T T IN 3: MV I A,334Q RST S E ND P R I N T V I A ODT MV I TIN 3A: A, 0 POP H RET MV I TI N 4: A,212Q RST S E ND ; PR I NT V I A ODT MV I T1N4A: POP 8 '° MOV A, B CMP C RZ ; R O U T I N E TO REMOVE B L A N K S FROM SOURC E U N L E S S E N C L O S E D I N I ' S PUSH D ; SAVE R E G ' S PUS H H PUS H H MV I + 2000 I N I T E FOR COMPARES MV I d ! o D = 1 = > W I T H I N Q U O T E S , L E A V E BL ANKS PK1 XRA A CLEAR A CMP CHECK I N P U T MODE 0 MOV A, M G E T CHAR JNZ QST RG W I T H I N QUOT E S T R I N G CMP I S I T 1ST ! ? E JNZ $ +7 NO - P ROCE ED I NR 0 YE S , SET FLAG JMP 0STR1 CONTINUE CPI 240Q I S I T A SPACE? EK2 Y E S - L E A V E OUT QST RG dSp 2ND " ? JNZ $ +4 NO - C O N T I N U E DCR 0 R E S E T F L AG QSTR1 XTHL GET D E S T I N A T I O N A D D R E S S MOV M, A SAVE I NX H BUMP P N T R . XTHL G E T SOURC E A D D . I NR C BUMP CHAR. CNT PK2: I NX H BUMP P N T R . DCR B DCR I N P U T L I N E CHAR C NT JNZ PK1 MORE - GO A G A I N MOV A, C CHAR CNT TO A POP H RESTONE R E G ' RETURN POP H POP 0 RET R O U T I N E S TO PAD ME S S AGE S TO OUTPUT BU F FE R. FOR 1 2 PADS ' U N D E R F L O W' F O R I 1 PADS ' O V E R F L O W ' F O R I 0 PADS ' Z E R O D I V I D E ' F 0 R M 9 PADS ' I N P U T E RR OR , T RY A G A I N ' FQRM8 PADS ' MEMORY F U L L ' F 0 R M 7 PADS ' W H A T ? ' F 0 R M 4 PADS ' I N L I N E ' F 0 R M 3 PADS ' E R R O R ' F 0 R N 2 PADS ' T U R N ON P U N C H ' FORM 1 PADS ' R E A D Y ' FORMS PADS SOURCE L I N E , P A S S E D A D D R E S S OF LENGTH 0 L I N E I N HL R E G S . F 0 R M 6 PADS CHAR S T R I N G , P A S S E D ADD OF F I R S T CHAR I N HL 4 L E N G T H OF S T R I N G I N REG C
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 23
33
012077 012100 012101 012102 012101 01 2 ! 0 4 012105 0 1 2 i 06 012107 012110 012111 0 1 2 1 12 012113 012115 012116 012117 01 21 2 0 012122 012125 012126 01 2 1 3 1
054 054 054 054 054 054 054 054 054 156 1 16 1 71 376 000 310 043 1 76 0 0 6 001 315 255 015 3 0 2 1 16 31 1
01 2 1 3 2 01 2 i 3 3 01 2 1 3 4 01 2 1 3 5 01 2 i 3 6 012137 012140 012141 01 2 1 4 2 0 1 2 143 0 121 -M 0 1 2 l 50 0 12,5? 0 1 215S 012162 012165 0 1 2 l 70 012174 012200 012201 012205 0 1 2 2 11 0 1 2 2'3 012217 012221 01222? 01223 I 01 2 2 6 i 012240 01224 4 012250 0 i 2254 012260 012264 0 1 2 2 G7 012273 012277 012302 012303 012312 0123 i3 0 1 2 3 17 012323
144 152 170 201 213 221 240 267 302 313 005 104 015 1 16 040 103 010 12 2 040 01 1 040 105 005 124 016 1 17 106 215 026 125 122 054 1 31 101 012 10 5 111 010 12 2 127 01 1 105 1 17
012325 012326 012330 012333 0 1 2 ’ 36 012340 012343 012345 012350 012352 012355 012357 012362 012354 012367 o u : : i 70 0 1 2 3 71 0 I 2372 01 2 : ' 7 5 012400 012401 01 2 . 1 0 2 01 2 1 0 5 012406 012407
345 005 303 315 376 312 376 312 376 312 376 312 376 31 2 16 7 C43 004 315 303 053 005 362 341 257 31 1
Page 24
34
122 131 12 4 (V'0 120 1 10 215 12 2 040 1 14 040 127 077 1 15 122 12 5 212 111 124 12 2 040 040 111 111 10 6 1 2 '>>>;'> 013225 013226 01322 7 01 3 2 . 3 2 013235 013240 013*43 013245 013250 013253 013254 013257 013262
353 04 2 012 011 04 2 041 3^5 345 052 315 315 322 075 303
i 13 l 31 252 224 023
060 06 0 060 060 020
1I 1 010 243 250 001 2 76 1 7:2
oeo 022 022 02S 02 5 063
12 2 35 6 130
060 01 7 063
XCHG SH L D SHLD LXI SHLD LXI P US H PUSH LHLD CALL CALL J NC MVI JMP SHLD PUSH LXI CALL LDA
STSPAC NXTSP H , BOTNS NEST H, M I A H H STL INE QU1 TT CHK1 SO RCE A, 1 ERROR LPNT H H,LPNT PTVAL KLEN
January, 1977
P
^
345 04 1 315 072
■IN IT . RUN:
I L OO P :
SO RCE :
STSPAC CKDIM
A D J U S T S T A R T O F S Y MBOL T/ - EL. E SO I T S T A R T S ON AM E V E N 4 WORD EC UN A D J U S T S T A R T OF SY MBOL T A B L E SO I T DOES NOT CROSS PAGE BOUNDARY
; IN IT
SP
FOR
NESTING
STACK
; PRECAUTION, I N CASE RETURN ; E X E C U T E D B E F O R E A GOSUB
IS
,• S T A R T OF S O URC E ; CHECK FOR I N T E R R U P T I O N ; H L = - 1 - Q NO MORE SOURCE ; ERROR
1,
NO
END
STMT.
: D E F I N E V A L U E S OF ; KB I N , K F P N T , K L E N ; C H A R ' S I N L I N E TO C
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 27
37
01 321.'. 5 0 1 3C03 01 3 ■: i' 7 01 3 3 7 0 013271 013272 013J73 01 3 ?74 013277 01 33i . ' 2 013335 01 3 ;i 0 6 0 1 3J07 013312 01 3 * 1 4 0 1 3 117 01 3 ' 2 1 01 3 3>24 01332 7 013332 0 1 3 J33 013331 0 13336 013337 0 1 3 3 40 0 1 3 3 41 0 1 3 3 42 013343 01 o ' M 4 0 1 3 3 46 0 1 3 >50 0 1 3 3 52 0133r 4 013306 013360 013362 0 1 3 3 64 013366 013370 013372 01337 4 013376 O’ 340 0 013403 013406 01341 1 0 1 3 4 13 013416 013421 013422 013423 01 3 . 3 2 4 013427 013432 013433 013436 013440 013443 013446 013451 013453 013456 013461 013462 013463 0134 34 013437 0 1 3 4 72 01 3 - : 7 1 013477 013500 013503 0 \ 3505 013506 01351 1 013514 013517 013520 0 1 3 5 21 013523 013524 013525 01352 7 01 3 5 - 5 0 013533 013534 013535 013536 013540 013543 0 1 354S 0 1 3 5 47 013550 Page 28
38
1 17 01 4 341 043 043 043 043 31 5 315 322 257 074 315 376 302 076 303 042 041 207 137 026 031 176 043 146 15 7 351 203 253 242 023 000 016 223 142 056 16 0 346 373 375 357 052 315 332 0 76 r5P3 052 043 043 043 31 5 315 267 302 076 303 315 3 22 076 303 052 043 043 043 315 332 076 303 106 315 076 2/6 302 31 5 31 5 205 157 076 214 147 073 276 GO? 345 305 1 10 006 31 5 322 301 341 076
005 025 '■>42 0 2 2 274 025 367 377 324 002 276 13 3 34 4
L I:
022 025 025 060 025
GKEY:
000
033 032 033 020 027 027 03 4 033 02 7 035 035 035 035 036 1c 3 243 003 276 13 3
JTBL:
060 022 02 0 025 050
E NDD:
GOTO: g sen t
000 052
025 022
013 004 276 210 23 ? 005 276 I 33
027 025 022 025 025 050
042 077 0C6 27 6
022 027
366 250
C23
072 363 052
027 025 022
GTRA:
OKN:
DIM:
DLOOP: ER6:
025 OKLET:
000 251 07 2
000 015 15 5 021
02 7
025 027
:
MOV I NR POP I NX 1 NX I NX I NX CALL CALL J NC XRA 1 NR CALL CPI JNZ MVI J MP SHLD LXI ADD MOV MVI DAD MOV 1 NX MOV MOV PCHL DW DW DW DW DW DW DW DW DW DW DW DW DW DW L HLD CALL JC MVI JMP LHLD I NX 1 NX I NX CALL CALL eRA JNZ MVI J MP CALL JNC MVI JMP LHLD 1 NX I NX 1 NX CALL JC MVI JMP MOV CALL MVI CMP JNZ CALL CALL ADD MOV MVI ADC MOV MVI CMP JNZ PUSH PUSH MOV MVI CALL J NC POP POP MVI
C,A C H H H H H I CP2 ALPHA LI A A SYMSRT 377Q GKEY A, 2
ERROR
CPNT H,JTBL A E, A D ,0
0
A.M H H, M
; MOVE P N T R , TO 1 S T : I N SOURC E R E C .
CHAR
; I NC R . H . L DCR C ;F1ND F IR S T LETTER ; L E T T E R FOUND ; D E T E R M I N E KEYWORD ; BAD
KEYWORD
j LOAD J UMP ; DO UBL E A
TABLE
PNTR.
; P N T . TO PROP E R P RO C. ; A D D . I N JUMP T A B L E ; GET PROC. ADD.
L, A
LET PR I I END MIA ENDD GOTO I F RT INPUT DIM CALLP GOSUB RETRN FOR NEXT KFPNT CHK1 MIA A, 3 ERROR CPNT H H H I CP4 CVB A OKN A. 4 ERROR NSRCH I LOOP A ,3 ERROR CPNT H H H ALPHA O KL ET A .6 ERROR B. M I CP7 A,250Q M ER6 I CP7 CVB L
L. A
H, A A ,251Q M ER6 H B C.B F SYM NDOU B H A, 11H
J I N D I R E C T J UMP ; J MP T A B L E
TO P R O C .
; REM S T M T . - NO A C T I O N ; S T O P S T M T , - R E T U R N TO E D I T
; CHECK TO S E E ; SOURCE A F T E R ; MORE SOURC E
MODE
I F MORE END ERROR
3
; GOTO S T M T . P R OC . ; I N C R E M E N T P A S T KEYWORD ; P O S S I B L E ERROR 4 i GET D E S T I N A T I O N ; MAKE S U R E I T WAS OK
; GET NEXT LPNT ; MAKE S UR E I T E X I S T E D ; NON-EXISTENT ; D I M S T M T . PROC. ; P N T TO F I R S T V A R . ; CHE CK
IF
; ERROR
6
IT
; I NCR.CPNT ; CHECK FOR
IS
A VAR.
(
; I N C R . CPNT ; C O N V . TO B I N NO. ; U P D A T E CPNT ; E D C O N T A I N ARRAY ; C C O N T . NO. ; IN LINE ; CHECK FOR )
CHARS
; SAVE B , C , H , L ; S E T UP FOR C A L L
; ERROR
LEN.
TO
LEFT
F SYM
11
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
Oi G S 5 2 01 o i cvr>53 O ' C'S:3? 0 1 3JS2 Oi 3563 Oi Of f 6 3 01357i O ’ 3 5 72 013573 013575 013576 013577 013600 01 3 6 0 2 013603 013305 013306 0 1 G6 0 7 013010 013611 010612 013613 01 Cfci. 4 013617 013620 013621 013622 01 ? 6 2 3 01 36 2 * 1 013025 013630 013631 0136°2 013*35 01363 5 013341 013344 0 1 3 o h “5 0 1 3 6 13 0 1 3 3 17 0 I 3650 OI 36C- 3 0 13 6 3 4 013657 013651 013662 0 1 3 ' 63 013663
303 325 3 53 052 353 31 5 31 5 353 321 066 043 1 61 043 066 043 066 043 17 2 057 1 17 173 057 107 31 5 043 043 043 043 003 345 31 5 14 0 1 51 315 341 322 042 301 341 043 01 5 312 015 31 2 076 276 043 31 2 303
013671 01 3 8 7 2 013673 013674 0136/5 01367 7 013700 013/01 013 702 01 3 7 0 3 01370 1 013707 013710 013711 013712 0 13 7 13
365 305 325 345 005 032 I 67 023 043 005 302 341 321 301 361 31 1
013714 013715 01 3/17 013722 Ot 3 7 2 3
305 006 315 301 31 1
013724 013727 0 1 3 /0 0 0137 2 013735 0 1 3 /3 7 0 1 3 /4 2 0 13 / 4 £ 0 1 3 /4 7 o i :«y 013753 013754 0 1 3 7 63 0 i 37 F' 3
315 330 076 31 5 376 312 376 302 303 043 043 043 171 267
January, 1977
276
025
D U P L I C A T E ARRAY D E F . JMP ERROR SAVE D I M . LENGTH PUSH 0 A D D . OF L A S T S Y M . TAB E NT RY, T O DE XCHG G E T AD D . OF A V A I L A B L E MEM. NXTSP L HLD S E T UP FOR C A L L XCHG CHECK S T A R T OF ' D I M ' ARRAY CKDIM CALL S T O R E NEW P N T R STPNT CALL N X T S P TO HL XCHG RESTORE D POP D MVI M, 0 I N S E R T VAR I N SYMB. T A B. 1 NX H MOV M, C I NX H M VI \ F P N T TO - 1 M ,377Q I NX H M VI M ,377Q P N T S TO F I R S T DATA 1 NX H G E T O N E ' S COMPL EMENT OF A,D MOV NUMBER OF E L E M E N T S CMA I N ARRAY TO B , C MOV C, A MOV A, E CMA MOV B, A CONT : CALL Z R OL ; Z E R O E OUT E L E M T S . I NX H ; OF ARRAY I NX H I NX H I NX H I NX B PUSH H CALL ; MEMORY F U L L ? MEMF UL MOV H,B MOV L, C CALL CHK 1 POP H J NC CONT SHLD NXTSP ; NEW V A L U E OF N X T S P . POP B ; RESTORE R E G ' S POP H I NX H DCR C ; MORE E L E M T S I N L I N E ? JZ I END OCR C JZ ER6 M VI A,254Q ; NEXT ELEMENT A CMP M I NX H JZ DLOOP JMP ER6 TO COPY COISTEN TO ; BY DE LOCATION H . L COPDH: PUSH ; SAVE R E G I S T E R S PSW PUSH B PUSH D PUSH H M VI B ,4 ; COUNT COPD1 L DAX D ; G ET FROM SOURC E MOV ; P U T TO D E S T I N A T I O N M, A 1 NX D ; BUMP P N T R S , CNT I NX H DCR B JNZ C 0 PD1 POP ; RESTORE R E G I S T E R S H POP D POP B POP PSW RET OUTR PADS O U T P U T FROM CONV" I N T O O U T P U T B U F F E R U S I N G R O U T I N E PAO ALL RE G 'S M A IN TA IN E D 6utr: PUSH B S A V E REG B MVI PAD ONCE B, 1 PAD DO I T CALL B POP R E S T O R E B AND R E T . R ET V AL UE RETURNS N D ( H ) , E ( L ) PNTR. TO T HE VALUE! OF A TOKEN C , H , L ARE U P D A T E D A , 3 ARE D E S T R O Y E D VALUE: CALL VAR I S I T A VARIA BLE? RC Y E S - A L L DONE MVI A ,3 NO CHEK I F A F U N C .
NDOU: 131
060
301 213
037 021
000
377 377
315
01 7
021
025
243
022
214 131
02 7 060
242
033
072 254
027
064 072
027 027
OC 4
277
027
001 255
022
203
030
003 367 377 1 14 001 352 216
022
rAi i
030 027 034 GET:
CPI JZ CPI JNZ JMP I NX I NX I NX MOV ORA
K CNT
1
G ET ER10 H H H
; ; ; ; ; ;
NOT A F U N C T I O N WAS I T P U T ( - - ) ? NO - OK I L L E G A L US E OF F U N C T I O N OK, IT 'S GET( - - ) UPDATE H , L
; CHECK
FOR
PREMATURE
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
EO L
Page 29
39
0137o7 01 3 7 6 2 013764 013765 0 1 3 7 70 0 1 3 7 73 013776 0 13 /7 7 01 3 01 4 0 1 4 014015 014013 01401 7 01 4 0 2 0 01 4 0 2 1 014024 014026 011027 01 4 0 3 2 01403 3 014034 014035 014033 014041 01 4 0 M 01 - ' i 045 01 4 0 4 7 014 050 014051 014052 014053 014056 014061 014062 01 4 0 ' > 5 014070 0 ’ 4071 014072 014073 01 4 0 / 4 014075 014076 014101 014)04 014105 014106 014!07 014111 014114 014117 014122 0 1 4 ! 24 01 4 : 2 5 0 1 4 I 30 01 4 1 3 2 014135 014140 01414 3
312 076 276 302 315 3 15 345 041 31 5 353 341 315 023 023 023 032 127 1 71 267 312 076 276 302 043 015 345 305 001 041 036 176 002 0 43 003 035 302 041 162 303 041 167 053 257 167 053 167 315 021 301 341 31 1 333 30? 31 5 332 076 276 302 076 31 5 332 021 31 1
014144 014147 01 4 1 5 2 01 4 1 5 3 014153 014161 014163 0 1 4 ]66 014171 014174 014175 01 4 1 7 6 01 4 2 0 0
062 205 060 042 206 060 1 71 062 204 060 041 167 0 6 0 0 1 6 14 5 315 350 017 052 206 060 072 204 060 1I 7 31 1 0 7 6 01 1 303 276 025
014203 014203 01 1 2 0 7 014210 Page 30
40
315 320 043 015
070
032
2^0 0 70 373 335
032 025 031
I 74 271
060 027
0~>3
031
070 251
032
070
032
16 7 10 7 005
060 030 V I:
0^,6 170
030 060
167 171
060 060
234 i 67
01 7 060
000 063. 024 130 256
030 022 030
070 001 144 176 167
042
HOME:
RINST:
032 030 030 050
022
:
JZ MVI CMP JNZ CALL CALL P US H LXI C£ L L XCHG POP CALL I NX I NX I NX L DAX MOV MOV ORA JZ MVI CMP JNZ I NX DCR P US H P US H LXI LXI MVI MOV STAX I NX I NX DCR JNZ LXI MOV JMP LXI MOV DCX XRA MOV DCX MOV CALL LXI POP POP RET IN J MP
ER8 A ,250Q M ER8 I CP 8 EVAL H H,FREG1 COPDH H F IX D D
D
D D,A A, C A ER8 A ,251Q M ER8 H C H B B,GREG H ,R IN ST E, 5 A, M B H B E VI H,GREG+1 M, D GREG H,GREG+2 M, A H A M, A H M, A DFXL D,GREG B H 0 HOME NUMB OKK A ,2560 M ER8 A. 1 RDKON ER9 D,GREG
; CHEK
F OR
(
; BUMP P N T R * S ; G ET P O R T ■ ; S A V E REG H , L ; COPY
IT
; RESTORE ; FI X IT ; GET ; REG
H ,L
L OWEST D
BYTE
TO
;EOL? ; CHECK ; BUMP ; ; ; ; ; ; ;
)
PNTR' S
SAVE H, L , B, C S T O R E PROGRAM S E G ME N T I N R A M , S T A R T A T GREG A D D . OF I M S T ' S M U M 3 . OF B Y T E S GET B Y T E S T O R E I N RAM
; BUMP ; ; ; ; ;
FOR
PNTR' S,DCR
CNT
S T O R E PO RT = I N RAM OK - T R A N S F E R S E T UP FOR F L O A T S T O R E AWAY I N P U T
; Z ERO OUT H I G H E R B Y T E S ; BUT CHAR. D O E S N ' T MATTER ; FLOAT I T ; F I X D . E RESTORE
; RAM
C ,H ,L
INSTRUCTIONS
j NUMBER JC MVI ; DEC. PNT.? CMP JNZ OKK: MVI ; M 0 D E = 1, IE. I N P U T FROM SOURC E CALL ; READ C O N S T A N T TO GREG JC ; I F ERROR T H E N CY = 1 LXI ; P N T S . TO C O N S T A N T RET T H I S ROUT i NE READS A C O N S T A N T I N T O GREG FROM A S C I I C H A R A C T E R S P O I N T E D TO BY HL AND C E N T E R W I T H A - 0 => DAT A FROM T T Y E N T E R W I T H A = 1 => DAT A FROM SOURC E RE T U R N W I T H CY = 1 => ERROR I N C O N V E R S I O N RD: ; CN: STA MODE ; S A V E MODE FOR R O U T . INP SHLD HLINP ; SA V E HL FOR R O U T . INP MOV A, C STA CREG ; S A V E C FOR R O U T . INP LXI H,GREG ; WHER V A L U E W I L L GO MV I C , S C R AND 3 7 ? Q ; S E T UP AND C A L L F I N P T CALL F I NPT LHLD HLINP ; R E T O R E H , L AND C LDA CREG MOV C, A RE T ; DONE ER9: MVI A, 9 JMP ERROR VAR D E C I D E S WHE THE R A TOKEN I S A VAR I A 3 L E I F SO CY= 1 AND ADDRESS I S C O M P U T E D , ( S U B S C R I P T I S EVALUATED E T C . ) , R E T U R N S W I T H DE P N T I N G TO V A R . R E F E R E N C E D H , L , C , U P D A T E D A , B DESTROYED I F NOT A V A R I 3 L E C Y = 0 H , L , C ARE L E F T UNT O UCHE D VA R : CALL ALPHA 1 S T CHAR A L E T T E R ? RNC NO- MOT V A R . I NX H BUMP P N T R ' S DCR C ko n t
call
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
01 1 21 1 011214 014215 014 217 014220 014221 OI A 2 2 2 0 i 4223 Oi 4 2 1 0 01 4 2 ?3 01 -12 >4 Oi -I ?_ j 6 01 1241
4?4? 014243 014245 Oi 4 2 1 7 01 2 3 0 014251 0 1 «25? 01 4 2 0 - 3 014200 014261 014262 014265 01 4 2 6 6 0 1 4 2 70 014273 014274 014275 014300 014301 014302 014 303 014304 014303 014306 014307 014310 014313 014314 014315 014316 014317 0 14 3 2 0 014322 014325 014327 014330 014333 014334 014 335 014340 014343 014344 01 4 v ' 4 ’i 014345 014347 014 302 014355 0 1 4 3 56 014361 014364 014365 01 4 3 6 6 014371 O i4^73 0 1 4 3 74 Oi 4 3 7 7 0 1 4 4 00 0 1 4 4 01 014402 014403 01 4 4 0 - 1 014405 014405 014407 014 410 0144 i 1 014412 014413 014414 014415 014416 01 4 4 1 7 014420 0 1 4 4 21 014422 014423 014424 0 1 4 4 25 014426 014427 January, 1977
302 305 01 G 053 106 043 303 3 i0 32? 305 076 315 301 074 302 014 053 267 31 1 315 322 043 015 312 305 076 315 301 074 312 053 305 1 16 053 106 043 043 353 315 353 301 067 31 1 176 3 76 312 076 305 31 5 301 074 312 303 053 176 043 365 315 315 343 04 1 315 353 311 315 0 70 276 302 043 015 023 023 032 107 023 032 267 027 137 170 027 127 173 267 027 137 172 027 12 7 361 305 1 17 006
2? 5
030 SC1 :
000
007 042 25?
030 02? 030
002 067
02 2
214
030
MORE:
BUPT:
024 31 7
02?
300
030
002 OS 7
022
070
032
SFSG:
033
SLCAD:
015
026
SCALR:
ARCK: 250 34 3 002
030
367
022
070 214
032 030 ARYES:
373 335
025 031
174 271
060 027
053 251
031
070
032
000
J NZ PUSH MVI DCX MOV I NX J MP CALL J NC PUSH MVI CALL POP I NR JNZ I NR DCX ORA RET CALL J NC I NX DCR JZ PUS H MVI CALL POP I NR JZ DCX PUSH MOV DCX MOV I NX INX XCHO CALL XCHG POP STC RET MSV CPI JZ MVI PUSH CALL POP I NR JZ JMP DCX MOV I NX PUSH CALL CALL PUS H LXI CALL XCHO POP CALL MVI CMP JNZ I NX DCR INX I NX LDAX MOV INX LDAX ORA RAL MOV MOV RAL MOV MOV ORA RAL MOV MOV RAL MOV POP P US H MOV MVI
MORE B C.O H B.M H SCALR ALPHA SFSO B A, 2 SYMSRT B A SCI C H A NUMB ARCK H C SL OAO B A ,2 SYMSRT B A ER8 H B C.M H B,M H H F SYM B A.M 250Q ARYES A ,2 B SYMSRT B A ER8 SCI H A.M H PSW I CP8 EVAL H H.FREG1 COPDH H F IX A ,251Q M ER8 H C D D D B. A D 0 A
MORE TO L I N E SAVE B . E O L S E T FOR C A L L TO F SYM GET S I N G L E L E T T E R VAR TO B 2ND A L E T T E R ? SO F AR SO GOOD SAVE C CHECK FOR D E L I M I T E R RESTORE C FOUND? YES NOT A V A R . BACK UP P N T R ' S C Y = 0 AND R E T T E S T FOR NUMBER MAYBE AN ARRAY I T S A SC A L A R BUMP P N T R ' S EOL SAVE C S E T UP FOR S Y M S R T T E S T FOR L E G A L G ET C BACK D E L I M I T E R FOUND? NO, ERROR MOVE B A CK. S A V E C. GET V A R . INTO B . C FOR F SYM
; ; ; ; ;
SAVE H . L I N D. E GET P N T R TO V A L U E R E S T O R E H , L P N T R TO G ET C REG BACK SET CY.R E T
DE
ARRAY C H E K , G E T CH A R A C T E R IS IT ( ? Y E S , I T S AM ARRAY N O - C H E K FOR L E G A L D E L 1 M . SAVE C RESTORE C D E L I M I T E R FOUND? 1 C H AR. S C A L A R V A R . Y E S - W E HAVE ARRAY GET VAR. SAVE BUMP
VAR.
PNTR'S
EVALUATE S U B S C R I P T S A V E REG H . L COPY
IT
RESTORE H . L F I X VAL UE CHECK FOR )
BUMP P N T R ' S P N T TO LOWER
2
BYTES
E.A A.B
H - B Y T E TO B PN T TO LOW B Y T E LOW B Y T E TO A K I L L CY S T A R T M U L T OF O F F S E T BY 4 C B Y T E S / F L T P T => GET H BYTE
D, A A, E A
DE I S O F F S E T * 2 G E T LOW K I L L CARRY
E.A A, D D, A PSW B C. A B.O
DE C O N T A I N 0 F F S E T * 4 GET V A R , . SAVE C SETUP
TO
CALL
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
F SYM Page 31
41
01 4 4 5 3 014451 O l4455 Ol 4 4 5 6 O l4457 014400 014461 014452 014453 014455 014 466 014467 014472 014473 014474 01 4 4 7 5 014501 014503 01 4i >C6 014507 01 4 5 1 0 01 4 5 1 1 01 4 5 1 2 014513 014514 014517 014522 014525 014533 014533 014535 014540 014542 014545 014550 014551 01 4 5 5 2 014553 014555 014556 014557 01 4 5 6 0 014561 014563 014564 014565 014553 0145>7 014570 01 4 5 7 1 014572 014573 014574 01457 3 014575 014577 014600 014601 014602 014003 014004 014505
305 345 325 023 023 023 032 365 346 027 027 332 037 037 376 332 076 303 037 037 022 033 033 033 041 315 041 021 315 O il 006 016 315 041 361 321 027 076 037 106 022 170 346 023 043 106 022 023 170 043 106 022 170 02-^ 022 033 033 033 341 301 31 1 200
0 1 4C1 1 014612 014613 014514 014617 01 4 6 2 2 014623 014524 014627 01 4 6 3 1
345 325 305 052 072 117 257 302 076 301
Page 32
42
015 045 022 276
026 031 025
177 10 6
031
030 1 10 023 276
031
174 271 200 205 271 174 200 146 320 174
025
060 027 050 0 31 027 060 01 7 060
000
H ; SAVE H , L PUS H F SYM ; G ET S T A R T AD D . CALL JC AF OND ; ERROR 1 2 MVI A, 12H ; ARRAY R E F . NOT D I M ' E D . J MP ERROR ; H , L NOW PNT TO S T A R T OF DAD AFOND: 0 ; A R R A Y , ADD O F F S E T , EXCHO XCHG i R E S T O R E F N T R ' S AMD R E T . POP H POP B STC ; S E T CY RET ; ROUT I N E TO F I X F L O A T I N G P O I N T ; N U M B E R S , A L L R E G ' S B U T A ARE ; M A I N T A I N E D . DE P N T TO 4 B Y T E S ; C F = TO BE F I X E D B rix : P US H P US H H ; SAVE R E G ' S P US H D I NX 0 I NX D ; P N T TO 4 T H B Y T E I NX D 0 LDAX j SAVE CHAR. (FOR S I G N ) PSW PUSH ANI 1 77Q ; CHEK I F E X P S I G N I S RAL RAC JC M I NSE RAR RAR ; R E S T O R E CHAR 300 ; I S I T TOO B I G ? CPI JC GOOD MVI ; ERROR 1 3 A, 13H JMP ERROR ; F I X = TOO B I G RAR M INSE: RAR ; ABSOLUTE VALUE D GOOD: STAX OCX D OCX D OCX D ; MOV P N T R BACK LX 1 H,FREG1 CALL COPDH ; COPY TO FREG1 LX I H,FREG2 ; STORE . 5 * 2 * * 2 4 I N LX 1 D,FDAT ; FREG2 CALL COPDH ; COPY I T LX I H.FREG1 J S E T UP TO C A L L L A D D MVI B , F R E G 2 AND 3 7 7 Q MVI C , SCR AND 3 7 7 Q LADD CALL ; ADD T H E M , R E S U L T I N FREG1 LX I H,FREG1 POP PSW ; G E T S I G N AND A D D . POP D RAL MVI ; G E T S I G N O NL Y RAR MOV B, M ; GET BYTE1 STAX D ; S T O R E B Y T E 1 OF F I X MOV A .B ANI 1770 j CLEAR H I G H B I T ( FROM A DD ) 1 NX D I NX H MOV B,M ; G ET B Y T E 2 STAX D ; ST ORE BY T E 2 OF F I X I NX D MOV A, B I NX H MOV B, M ; GET B Y T E 3 STAX D ; S T O R E B Y T E 3 OF F I X MOV A.B I NX D STAX D ; ST ORE B YT E 4 OF F I X DCX D ; F I X D PNTR DCX D DCX 0 POP H PGP B R ET FDAT: DB 200Q ,0 ,0 ,3 0 0 ; I N P SAVES ALL R E G ' S ' * ’ ; S E R V E S AS B U F F E R BE T WE E N F I N P T AND j OATA I N P U T . I F M 0 D E = 0 , DAT A COMES FROM T T Y ; I F MODE= 1 DAT A COMES FROM S O U R C E S T M T S . ; I N A L L C A S E S H L , C ARE U P D A T E D FROM H L I N P , AND CREG AND R E T U R N E D i NP: PUSH H ; SAVE ALL R E G ' S P US H 0 PUSH B LHLD HL I NP ; GET P N T R ' S L DA CREG MOV C, A ORA A ; CHECK FOR EOL JNZ CHKMO ; NO CHECK MODE SPACE: MVI A ,240Q ; S E ND A S P A C E I DONE: POP B ; RESTORE R E G ' S
177
000
000
206 204
060 060
235 240
031
030
o
343 315 332 076 303 031 353 341 301 067 31 1
>
O l 4431 014432 014435 014440 014442 014445 014443 014447 014450 014451 01 4 - 1 5 2
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
01-1632 OHC33 0 1 - 103- 1 01 4 6 3 5 01 4 6 4 0 01-4641 014644 014645 01 4 0 - 1 7 014652 01 4 6 5 5 01 SO 014663 014065 014570 014672 014675 01 Y E S PUSH PSW Z = 0 => NO JNZ ECAV CALL I CP8 BUMP P O I N T E R ECAV: CALL VALUE G E T P N T R . TO V A L U E PUSH H GET V A L U E TO FREG1 LXI H,FREG1 CALL COPDH XCHG POP H POP PSW GET S I G N JNZ DOL S H A L L WE NE G A T E ? I NX D Y E S , P O I N T TO CH A R . I NX 0 I NX D LDAX AND LOAD TO A 0 RAL R O T A T E S I G N TO CY CMC COM P L E M E N T I T RAR R O T A T E BACK STAX 0 S T O R E AWAY DCX D AMD F I X P N T R . DCX 0 DCX D DOL : MOV A, C I S T H I S END OF L I N E ? ORA A RZ YES-RETURN P US H B SAVE C MVI A, 2 NO -SET UP TO C A L L S Y M S R T AND C A L L CALL SYMSRT FOP B RESTORE C I NR D E L I M I T E R FOUND? A JZ ER8 NO, ERROR SUI 10 CHECK FOR E X P R E S S I O N EOK: DE L I MI TER RC PUSH PSW SAVE O VE RA TI O N CALL I CPS BUMP P N T R ' S CRA C L E A R CY A PUSH H G ET B Y T E S OF NUMBER AGA: LDAX D AND P L A C E ON S T A C K MOV L .A I NX D LDAX D I NX D H, A MOV 2 B Y T E S TO H , L XTHL XCHANGE, RES TO RE S Hj L CMC JC AGA ANOTHER PASS? CALL VALUE GET 2ND VAL UE MOV A, C CHECK FOR END OF L I N E CRA I F SO => WE LL FORMED A
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 33
43
015001 010054 015005 015057 015062 015053 015055 015070 015072 015075 015076 015077 015102 015105
015106
015107 015110 015113 015114 015117
015120
312 305 076 315 301 3 76 332 076 303 305 345 041 315 321 301 341 042 341 042 353 361
075 002 357 012 075 010 276
JZ P US H MVI CALL POP
032 022 032
200 271
050 027
175
060
174
050
015121 0 1 5 1 23 126 015130 015132 015133 015136 015141 015142 015145 015145 015151 015154 015157 015160 015161 015162 015165 015166 015167 015172 015173 015176 0 1 5 I 77 015202 015203 015206 015207 015212 015215 015220 015223 015224 015225 0)5226 015227 01523 2 01523 5 015240 01524? 015246
015
015217 015200
015203 015255 015207 015260 01 52fc' I Oi 52c 4
0 152t>5 010266 015270 015273 0 15 2 7 4 015276 01 5 *01 015304 015305 Page 34
44
305 3 45 041 006 01 6 075 372 312 075 312 075 312 303 31 5 124 135 267 312 325 365 315 361 041 345 04 1 027 332 027 332 303 04 1 315 321 341 301 31 1 315 303 315 303 31 5 124 1 31 303 052 043 043 043 313 043 01 5 006 302 004 076 315 303 176 375
174 200 146
060
235 243
032 032
=> => => =>
FREGl FREGl FREGl FREGl
* / + -
FREG2 FREG2 FREG2 FREG2
I N CASE OF A R I T H M E T I C ERROR A M ESS AGE I S S E N T TO U S E R . I F A C O N T A I N S I L L E G A L O P E R A T I O N R E Q U E S T ERROR I S S E N T TO U SE R ; ( E R R O R 8 ) AND T HE I N T E R P R E T E R I S A B 0 R 1 E D . PUSH BI NO P: B ; SAVE R E G ' S H PUSH H,FREGl ; S E T UP P N T R ' S TO LXI B . F R E G 2 AND 3 7 7 0 ; F R E G ' S AND SCR ARE A C,SCR AND 3 7 7 Q AND DO O P E R A T I O N DCR A JM FMULT 0 , 1 = > « OR / JZ Dl V 2 , 3 = > + OR DCR A JZ AODD DCR A JZ SUBB JMP ER8 I L L E G A L OPER. AODD: L ADD CALL DO A D D I T I O N MOV AS B C: D,H F I X P N T R ' S F OR R E T . MOV E. L SET FLAGS FPERR: ORA A NO ERROR JZ NFPER S A V E DE P US H D SAVE A P US H PSW DUMP B U F F E R G E T A BACK LXI H,WFPER RETURN ADDRESS P US H H S A V E ON S T A C K LXI H,ODATA MESSAGE T ABLE RAL UNDE RFL OW? JC F OR 1 2 YES RAL O VE RFL OW? JC FORI 1 YES J MP FOR 1 0 NO - I T S Z E R O D I V I D E WF P E R : LXI H,ODATA MESSAGE T ABLE CALL ERLN PRINT ' I N LIN E ( U S E PART OF POP D RESTORE R E G ' S ERROR NFPER: POP H POP B RET SUBB: CALL LSUB ; DO S U B T R A C T I O N JMP A SBC FMULT: CALL L MUL DO M U L T . JMP MDBC Dl V: CALL LDIV • DO D I V . MDBC: MOV D,H AND F I X P N T R ' S FOR RET. MOV E, C JMP FPERR ; CHECK FOR ERROR ; P R I N T P RO CE S S O R PR 1 : L HLD CPNT INX H ; I N C R . P A S T KEYWORD I NX H ' I NX H CALL I CP7 1 NX H J BUMP P N T R S DCR C MVI B, 0 . S E T CHAR CNT JNZ PLOOP C O N T I N U E I F MORE I NR 8 ; N O T H I N G MORE, PAD A NULL MVI A, 0 CALL PAD JMP PEND • W R I T E I T AND C O N T I N I PLOCP: MOV A.M GET CHARACTER CPI ' " ' +2 00Q I S I T "?
m
15 4
032
227 070 320
032 032 01 7
224
032
320
022
215
032
132
024
077
024
10 0 101 13 2 337
02 4 024 024 025
331 10 7 323 245 326
01 7 032 01 7 032 01 7
161
032
133
050
366
025
000 304
032
000 255 134
022 033
242
B io
SAVE C E L S E C A L L S Y M S R T TO Cl 1SK FOR E X P . D E L . RECOVER I T
Y E S , WE LL FORMED MVI ILL -FO RM ED EXP. J MP WFOR: P US H B S A V E C , AND H , L P US H H LXI H,FREG2 COPY 2 N D V A L U E TO CALL COPDH FREG2 POP 0 GET B Y T E S FROM S T A C K POP B POP H INTO F R E G l +2 SHLD F R E G l +2 AND N E X T 2 B Y T E S POP H FROM S T A C K TO F R E G l SHLD FREGl XCHG G ET O P E R A T I O N POP PSW ; T H I S R O U T I N E P E RF O RMS B I N A R Y O P E R A T I O N S ON O P E R A N D S I N F R E G l AND FREG2 ; B , C , H, L AF l . L E F T U N D I S T U R B E D . A I S D E S T R O Y E D ; D . E P N T TO R E S U L T ; O P E R A T I O N ^ ARE S P E C I F I E D BY A R E G I S T E R AS F OL L O WS : A-0 A- 1 A =2 A-3
015122
A .2 SYilSRT WFOR A, 8 EKROR
ER8!
025
WFOR
B
¥UT
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 n 0 0 0 0 0 0 0 0 0 0 0 0 0 Cl 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5307 r-3i 2 03 i 5 5316
0 0 0 0
532 i 5524 5325 5327 5332 5333 5336 5337 5340 5343 5344 534 6 5351 5354 5357 5.? 023 005 31 2 305 325 315 3 33 c :2 341 171 301 1 10 365 325 076 315 32? 341 341 257 074 31 1 345 05? n?i 315 321 1 01 341 361 117 303
46
2 50 237 i 32
03 3 033 024 024 0?? 053
01 5 G 5 0 01 5 6 5 1 01 5 6 5 2 015053 01 5 6 j ; ' 0150^3 01 5 ( 5 1 01$662 0 1 5 6 G3 01 5 ? GO 015037 01 5 b 7 0 01 5 B / 1 015372 015673 015675 01 5/00 015/01 015702 01 5/05 0 1 5 7 C6 015707 01 5 V 1 2 Oi 3 7 i 3 0157 iG 0157 i 7 015720 01572 i 015722 015723 01572 4 O' 5 7 2 4 0 i 'j / 3 1 01 5 7 i 4 01 5 7 3 5 01 5/33 01573/ 01574 0 01 5 7 '11 015742 Oi 5 7 4 5 01 5/50 015753 015754 015755 01 5 7 5 6 015757 015760
Page 36
02 2 32 2 02 2 001 0 6 0 31 1 0 2 3
INPOK: I END:
MOV CALL CALL LXI CALL XCHG POP POP MOV CALL JZ LXI CALL CALL L DA MOV JMP JC LHLD JMP
D ,0 PAD WR1 T1 H .IB U F TTYIN H B B, A STRIN 1 NPOK H,ODATA F0RM9 WRI T PL6 C, A INPER PRMP T KFPNT I LOOP
TO S U P P R E S S C R / L F PAD I T WRITE IT A D D . OF I N P U T B U F F E R READ A L I N E AD D . OF K - S T R I N G TO DE A D D . OF V - S T R I N G V - S T R I N G CNT TO C K - S T R I N G CNT TO B T R A N S F E R C O N S T A N T S TO V A R I B L E S NO ERROR S E N D ERROR ME S S A G E GET
V-STRING
CNT
START AGAIN NEED MORE C O N S T A N T S A L L OK - G E T NEW P N T R . CONTINUE
OF AN A S C I ! S T R I N G OF C O N S T A N T S TO T HE L O C A T I O N S S P E C I F I E D BY AN A S C I I S T R I N G OF V A R I B L E S P O I N T E R AMO L I N E CNT OF V A R . S T R I N G ARE I N H L , C P O I N T E R AMD L I N E CNT OF C O N S T . S T R I N G ARE I N D E , B ON R E T U R N : Z = 0 AND CY = 0 A L L OK Z = 0 AND CY =1 N E E D MORE C O N S T A N T S Z=1 ERROR I N C O N V E R S I O N A L L P O I N T E R S AND L I N E C N T ' S ARE R E T U R N E D U P D A T E D STR1N: MOV A. GET V - S T R I N G CNT ORA A T E S T FOR EO L RZ DONE , CY = 0 = > A L L OK MOV A. M GET CHAR. CPI * ' OR 200Q IS IT A ,? JNZ STOKV I T ' S NOT A , I NX H COMMA, BUMP P N T R ' S DCR C JZ ERRET P O S S I B L E ERROR ( I F EOL) STOKV: MOV GET K - S T R I N G L E N G T H ORA T E S T FOR EOL STC I N C A S E I T ' S EO L RZ R E T , CY = 1 =@ N E E D MORE C O N S T A N T S 0 LDAX G E T CHAR CPI ' * OR 200Q T E S T FOR , JNZ STOKK NOT A , - READY TO GO I NX D BUMP P N T R ' S DCR b P O S S I B L E ERROR ( I F EOL) ERRET JZ S A V E . K - S T R I N G C NT P US H B ST CKK: SAVE K - S T R I N G PNTR PUSH D A D D . TO V A R I B L E TO DE VAR CALL V A R . ADD TO H , L XCHG SAVE SHLD VA R A D A D D R E S S OF K - S T R I N G POP H MOV V - S T R I N G CNT TO A A,C K - S T R I N G C NT TO B POP K - S T R I N G CNT TO C MOV S A V E V - S T R I N G CNT PUSH S A V E V - S T R I N G AD D . PUSH D A = 0 = @ D AT A FROM T T Y MVI A, 0 G E T C O N S T A N T TO GREG RCKON CALL ST NER J NC POP H EMPTY STACK H POP ERROR XRA A ERRET: I NR A RET PUSH ; SAVE K - S T R I N G PNTR. H STNER: LHLD ; GET V A R . ADD VARAD LXI ; A D D . TO C O N S T . D,GREG COPDH CALL ; C O P Y I T TO V A R I A B L E L O C . POP D ; K - S T I N G P N T R . TO DE ; K - S T R I N G L E N G T H TO B MOV B,C POP ; V - S T R I N G P N T R . TO HL H ; V - S T R I N G L E N G T H TO C POP PSW MOV C, A ; LOOP JMP STRIN ; L E T S T M T . P R O C E S S OR J GE T P N T R . LHLD CPNT LET: ; F I X PNTR. H I NX H I NX H I NX ; CHE CK F OR EO L MOV A, C ORA A LOK JNZ A ,7 MVI ER7: ERROR JMP VAR CALL ; G E T A D D R E S S TO V A R . L OK : JC SAW ; I T ' S A VARIABLE A, 3 MVI ; N O - C H E K F OR F U N C . CALL SYMSRT CPI 377Q
liS
000 1 44 341
030 033
212 16 7 271
060 060 027
250
033
133
060
003 007 2 76 203 1 >0 003 367 377
034 02 5 030 034 022
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6020 6023 601-4 60 2 7 6030 6031 6032
60? 4 60? 7 '■0 ' 0 •50 4 2 504 5 5050 0 0 T-3 6054 505 7 6052 6 Ofe3 6064 6067 eo/o 6071 60 7 2 6073 6074 6075 6077 6 10 2 6 l05 6107 6110 61 1 1 6112 6 ’ 14 6-17 6 ’>2 2 6i 25 6 i 26 6131 61 3 4 6 ' 37 6 ’ TO LPTR>
NORM
1 28
L,E L L L E, A A, M 127 E M, A
L L L
C A L L MSFH CMP E JC ABCH J N Z BBCH ADD E JC BMIN C A L L AORS JP LOOO C A L L DCMP JC L 131 JNZ L001 MVI A , 2 RET C A L L AORS JP L 128 C A L L DCMP JC L003 JNZ L I 29 J MP L 0 0 2 C A L L AORS JM LOOO J MP C0M1 C A L L AORS JM L 128 J MP COM2 XRA A RE T MVI A. 1 RE T MVI A , 3 RE T MV! A. 128 RE T MV! A, 129 RET MVI A. 131 RET
RESULT
T HE
AND
RETURN
RESULT
; COMPARE T H E C H A R A C T E R I S T I C S ; I F C H A R ( H , L ) . G E . C H A R C H , 3 ) CONTINUE ; I r C H A R ( H ( L ) . L T . C H A R ( H , B ) THE COPY ; CHAR CH , B ) TO C H A R ( H , L ) ; COMPUTE S I G N OF R E S U L T ; ADD M A N T I S S A S ; I F T H E R E I S NO OVF LW - DONE : 1 F OVERFL OW S H I F T R I G H T ; AND I N C R E M E N T C H A R A C T E R I S T I C ; A L L D O NE , SO R E T U R N
S T O R E S T HE PREVIOUSLY
E, L L.C A, M
TO
MANTISSA SIG N B E E N COMPUT ED ; ; ; ; ; ;
THE RES U LT LASD.
SAVE L PTR C P T R TO L LOAD I N D E X WORD SCARF S I G N RESTORE L PTR L PTR\2
; TO L ; SAVE ; ; ; ;
IN BY
SIGN
IN
E
S C A R F CHAR ADD S I G N STORE I T RESTORE
; L PTR S U B RO UT IN E LASD U T I L I T Y R O U T I N E FOR L A D S C A L C U L A T E S T RUE OPER AND SGN R E T U R N S ANSWER I N F E T C H MANT S I G N S , F I N A , D COMPARE S I G N S F \ , S - MEANS GO TO A BRANCH F - S \ MEANS CO TO B BRANCH SAME S I G N I F H E R E , ADD S I G N S I F BOTH M I N U S , W I L L OVE RFL OW BOT H POS I F HERE I F AN A D D , LOAD 0 COMPARE F W I T H S S . G T . F , S O LOAD 131 F . G T . S , S O LOAD 1 ERROR C O N D I T I O N , Z ERO ANSWER CHECK FOR ADD OR SUB A D D , SO LOAD 128 COMPARE F W I T H S S . GT . . F , 3 0 LOAD 3 F G T . S . S O LOAD 129 ERROR F T , S - SO T E S T FOR A / S S U B T R A C T , SO LOAD 0 A D D , SO GO TO DCMP F - , S \ , SO T E S T FOR A / S SUB ADD
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 45
55
S U B R O U T I N E LMCM COMPARES T HE M A G N I T U D E OF TWO F L O A T I N G P N T NUMBERS
004327 004532 004533 004036
3 1 5 13 3 0 1 2 300 31 5 3 6 4 0 1 2 31 1
ZC1 IF
LMCM:
CALL RNZ CALL RET
CCMP DCMP
[,c n
IF F . L T . S .
; CHE CK CHARS ; R E T U R N I F NOT E Q UAL ; I F E Q U A L , CHECK MANT S
*************************************************** / / / /
MULTIPLY
SUBROUTINE S U B R O U T I N E L MUL FLOATING POINT MULTIPLY L P T R X B P T R TO C P T R
00-1537 004542 004*345
0 0 1 '. 50 004553 004056 004557 004550 004363 004564 004566 004571 004574 004375 0 C'4 5 7 6 004577 004502 004603
004604 004605
3 1 5 151 315 3 3 2 312 315 312
1 35 1 51
01 3 01 1 2 5 7 01 2 3 - 2 01 1 2c 7 0 1 2
035 1 53 026 030 315
3 i5 332
1 75 151 1 17 3 15
1 75 1 51 1 17 025
KPGO:
3 70
01 1
I NTR:
1 66 01 1 341 01 2 100 01 3
315
351
0C !64 4 004645 C04C46 0046^7 C04652
1 75 151 1 17 315 0 0 6 012 3 0 3 1 7 7 01 1
315
1 14 0 1 2 200
31 1
MOV E , L MOV L . C C A L L DCL R MOV L , E MVI D , 2 4 C A L L DR S T JC MADO MOV A , L MOV L , C MOV C . A C A L L DR S T MOV A , L MOV L , C MOV C , A DCR D J N Z KPGO AORS CALL LMCP JM MOV E ,L MOV L ,C CALL DLST MOV CFCHE CALL ADD E 20 00 CPI JZ UFLWC 1 SUI CALL CCHK RE T
01 1
376 3 12 32G 315
203
JZ
01 1 01 1
302 315 372
153
JZ CALL
244
370
CSIGN ZCHK WZERC BCHK WZERC
CALL CALL
012
004606 004611 C04614 C04617 C04620 004621 004624 004625 C04630 C04631 C04633 004656 C04640 C04643
13 5 151
LMUL:
1 42 01 3 001 i 04 0 1 3 MADD:
MOV A . L MOV L , C MOV C . A C A L L DADD J MP I N T R
SUBROUTINE
; COMPUT E S I G N OF R E S U L T AND S T O R E ; CHECK F I R S T OPE R A N D FOR Z ERO ; Z E RO * A N Y T H I N G = Z ERO ; CHECK SE COND O P E RAND FOR Z E RO ; A N Y T H I N G » Z ERO = Z ERO SAVE L PTR C P T R TO L CLR PRODU CT MANT L OC S L P T R TO L LOAD NUMQER I T E R A T I O N S S H I F T L PTR R I G H T W I L L ADD B P T R I F C C 1 INTERCHANGE L AND C PTRS S H I F T PRO DU CT OVER 1N T E R C H A N G E L AND C P T R S . B A C K TO OR I G 1 NAL >
IT
MORE C Y C L E S I F Z t O T ES T I F RESULT I S NO RM AL IZ ED I F N O R M A L I Z E D GO COMPUT E CHAR SAVE LPTR I N E S E T L = CPT R L E F T S H I F T R E S U L T TO N O R M A L I Z E RESTORE LPTR OTHERWISE SET A - C H A R ( H , L ) , E = C H A R ( H . B ) CHAF.'C R E S U L T ) = CHAR ( H , L ) + C H A R ( H . B ) CHECK FOR S M A L L E S T N E G A T I V E NUMBER I F SO T HEN UNDERFL OW S U B T R A C T 1 TO C O M P E N S A T E FOR N O R M A L I Z E CHECK C H A R A C T E R I S T I C AND S T O R E I T RETURN ; INTERCHANGE ; L AND . q pypg ■ ACCUMULATE
PRODU CT
NORM
T H I S SUBROUTINE W IL L NORMALIZE A FLOATIN G P O IN T N UMBER, P R E S E R V I N G I T S O R I G I N A L S I G N . WE CHECK FOR UNDE RFL OW AND S E T T H E C O N D I T I O N FLAG A P P R O P R I A T E L Y . ( S E E ER, \ OR R E T U R N S ) . T H E R I S AN E N T R Y P O I N T TO F L O A T A S I G N E D I N T E G E R ( F L O A T ) AND AN E N T R Y P O I N T TO F L O A T AN U N S I G N E D INTEGER. ENTRY
POINTS:
NORM FLOAT DFXL REGISTERS
N O R M A L I Z E F L O A T I N G P T NUMBER A T ( H , L ) F L O A T T R I P L E P R E C I S I O N I N T E G E R A T ( H .,lL > PRESERVING SIG N B I T IN ( H , L ) + 3 FLOAT UNSIGNED ( P O S I T I V E ) T R I P L E P R E C IS IO N AT ( H , L )
ON E X I T :
A = C O N D I T I O N F L A G ( S E E ERROR D , E = GARBAGE B , C , H , L = SAME AS ON E N T R Y 004655 004656 004661 004662 004663 0 0 1*366 004671
Page 46
56
135 3 15 127 153 315 312 176
101
012
332 215
011 012
NORM: N0RM1: FXL1 : FXL2: REP6:
MOV CALL MOV MOV CALL JZ MOV
E, L GCHAR D, A L, E ZMCHK WZER A.M
RETURNS)
SAVE L I N E GET C H A R ( H . L ) I N A W IT H S I G N EXTENDED S A V E CHAR I N D RESTORE L CHE CK FOR Z E RO M A N T I S S A I F Z E RO M A N T I S S A T HEN Z ERO R E S U L T G E T MOST S I G N I F I C A N T B Y T E OF MANTISSA
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
004672 004573
267
004676
00471 3
172 376 312 315 025 303 303
004716
135
004717 004720 004721 004722 004723 004724 004725
054 054 054
004727
303
00077
004701 004704 00 4 /0 7
004/10
372
313
011
300 14 3 351
01 2 01 1
271 303
01 1 012
CRA JM
A SCHAR
SCHAR:
MOV CPI JZ CALL DCR JMP J MP
A.D MI NCH WUND DLST D REP6 I NC R 3
6f
MOV
E .L
1 NR 1 NR I NR XRA MOV MOV MVI
L L L A M A L .E D, 2 4
JMP
FXL2
:
x l
257
167 153 026 030 263
FLOAT:
01 1
SUBROUTINE
SET FLAGS I F MOST S I G N F I CANT B I T = 1 T H E N NUMBER I S N O R M A L I Z E D AND WE GO TO STORE THE C H A R A C T E R I S T I C O T H E R W I S E CHECK FOR UNDERFLOW COMPARE W I T H M I N I M U M CHAR I F ‘ EQ UAL T H E N UNDERFLOW S H I F T MANTISSA LEFT DECREMENT C H A R A C T E R S T I C LOOP AN T E S T N E X T B I T S T O R E THE C H A R A C T E R I S T I C U S I N G T H E SAME CODE AS T H E I N C R E M E N T E N T E R H ER E TO F L O A T U N S I G N E D INTEGER F I R T SAVE L I N E MAKE ( H , L ) P O I N T TO CHAR MAKE ( H . L ) P O I N T TO CHAR MAKE ( H . L ) P O I N T TO CHAR Z E R O A C CUM UL AT O R STORE A PLUS ( + ) S I G N RESTORE L E N T E R HERE TO F L O A T I N T E G E R PRESERVING O R IG IN A L S IG N IN ( H . L ) * 3 S E T UP C H A R A C T E R I S T I C GO F L O A T T HE NUMBER
Z CHK
T H I S R O U T I N E S E T S T HE Z ERO A F L O A T I N G ZERO AT ( H . L ) . SUBROUTINE
0 0 4 734
054 054 1 76
0 0 4 7 35 004736 004737
266 055
004740 0 0 4711
Z MCHK:
655
266
311
I NR I NR MOV DCR ORA DCR
L L A.M L M L
ORA RET
M
THIS 13 5 150 3 15 i 53 31 1
001751 004752 004753 004754 004755 004756 004757 004760 004761
054 054 1 76 267 027 167 055 1 76 027
004762 004763 004764 004765 004766 00476 7
167 055 1 76 027 167 31 1
004770 004771 004772 004773 C04774 004775 004776 001777
135 1 76 037 167 054 1 76 037 167
January, 1977
IT
DETECTS
FLAG
IF
IT
OETECTS A
£chk:
SUBROUTINE
00474 2 004743 004744 0 0 4 74 7 0 0 4 7 }0
IF
ZMCHK
T H I S R O U T I N E S E T S T H E Z ERO Z ERO M A N T I S S A A T ( H . L ) 0 0 4 7 32 004732 004733
FLAG
&CHK: 332
011
S E T L TO P O I N T L A S T B Y T E OF M A N T I S S A S E T L TO P O I N T TO L A S T B Y T E OF M A N T I S S A LOAD L E A S T S I G N I F I C A N T B Y T E L P O I N T S TO M I D D L E B Y T E OR W I T H L E A S T S I G N F I C ANT B Y T E L P O I N T S TO MOST S I G N F I CANT B Y T E OF M A N T I S S A ( O R I G I N A L V A L U E ) OR I N MOST S 1G N F I CANT B Y T E R E T U R N S W I T H Z ERO F L A G S E T
APPROPRIATELY
BCHK ROUTINE
MOV MOV CALL MOV RET
E.L L, B ZCHK L .E
CHECKS
(H .B )
FOR
SUBROUTINE S H I F T S DBL
f l LS T :
I NR I NR MOV ORA RAL MOV DCR MOV RAL MOV OCR MOV RAL MOV RET
t)RST:
MOV MOV RAR MOV I NR MOV RAR MOV
L L A.M A M.A L A.M
M-. A L A.M M,A
E .L A.M M .A L A.M Mj A
FLOATING
PT
Z E RO
SAVE L P TR I N E SET L=BPTR CHECK FOR Z ERO RESTORE L = L P T R RETURN DLST WORD ONE
PL ACE
LF
;/***T P ; L OAD I T ; K I L L CARRY ; SHI FT I T LEFT j STORE I T ; L OAD I T ; SHI FT I T LEFT I F CARRY S E T BY F I R S T S H I F T I T W I L L BE I N L S B OF SE COND ;/***T P • / * # * ALL
EXTENSION DONE
TP
S U B R O U T I N E DRS T S H I F T S DOUBL E WORD ONE P L A C E TO T H E R I G H T DOES NOT A F F E C T 0 ; / * * « T P M O D IFIED RIGHT S H IF T L OAD F I R S T WORD ROTATE I T R I G H T STORE I T /* * * TP LOAD SE COND WORD S H IF T IT RIGHT STORE I T
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
TP
Page 47
S7
1 NR MOV RAR MOV MOV RE T
0 0 5 0 03 005004 0U50U5
054 176 03 I 167 15 3 31 1
005006 003007 005010 005011 005012 OOf ' O l 3 00501 ^ 0 0 5 0 15 005016 005017 005020 005021 005022 005023 005C24 005025 005026 005027 005030 005031 005032 005033 005034
135 15 0 054 054 176 153 054 054 206 167 150 054 176 153 054 216 167 150 176 153 216 167 31 1
fjADD:
005035 00503$ 005037 0050-10 0050.11 0050-12 0050-13 0050-14 005045
257 167 054 167 054 16 7 055 055 31 1
6
005046 005047 000050 0050a1 005052 005053
135 054 054 176 150 054 054 226 153 054 054 16 7 055 176 150 054 236 153 054 16 7 055 17 6 15 0 235 15 3 16 7 311
6 s UB:
005000
OOc-OOl C'05005
005054
005055 0 0 5 0 30 005057 005000 005061 005002 005063 005064 005065 00506'; 005067 005070 005071 005072 005073 005074 005075 005076 005077 005100
cl
R:
MOV MOV I NR I NR MOV MOV I NR I MR ADO MOV MOV I NR MOV MOV I NR ADC MOV MOV MOV MOV ADC MOV RET
; /* * *
L
TP
EXTENSION
A. M M, A
• / * * * TP
L .E
-
ALL
DONE
TP
S U B R O U T I N E DADD ADDS TWO DOUBL E P R E C I S I O N WORDS, C M I F T H E R E I S OVRF LW ; S A V E BAS E I N E B A S E \ 3 TO L B A S E \ 4 TO L
.l L.B L e
» iT P
L
A.M L.E L L M M( A L.B
L OA D S MANTB B A S E TO L B A S E \ 1 TO L / * * * tp ADD TWO M A N T B J S S T O R E ANSWER / * s * TP E X T E N S I O N
L
A, M t ' E
M M, A L, B
/ * * * T P - A L L DONE B A S E \ 3 TO L MANTA OF S TO A BAS E TO L ADD W I T H CARRY S T O R E ANSWER
A.M
L.E M M, A
S U B R O U T I N E DCL R C L E A R S TWO S U C C E S S I V E L O C A T I O N S OF MEMORY
XRA A MOV M , A I NR L MOV M , A I NR L MOV M, A DCR DCR RET
MOV I NR I NR MOV MOV I NR I NR SUB MOV I NR I NR MOV DCR MOV MOV I NR SDB MOV I NR MOV DCR MOV MOV S8B MOV MOV RET
• / * * * TP ;/***T P ;/***T P
/ * * * * * A L L MEW D S U 3 - S H O R T E R * * * S U B R O U T I N E DSUB DO U B L E P R E C I S I O N S U B T R A C T ; SA V E BASE I N E / * * « TP E X T E N S I O N / S T A R T W I T H LOWS / G E T ARG / N O W S E T UP TO S U 8
E,L L L A.M L.B L L M L.E L L M, A L A.M L.B L M
; / N O W DO I T ; / NOV/ MUST P U T
IT
BACK
/ P U T BACK / * * * T P - A L L DONE / G E T LOW OF L OP / S E T TO BOP / S E T TO BOP LOW / G E T D I F F . OF LOWS / S A V E I N L O P LOW / T O L OP LOW / I N T O RAM / B A C K UP TO L OP H I G H / G E T L OP H I G H / S E T TO BOP H I G H / S U B . W I T H CARRY / S A V E I N L OP H I G H / I N T O RAM / A L L DONE - MUCH S H O R T E R
M, A A.M L.B M L.E M, A
SUBROUTINE
EXTENSION Z ERO 3 - A L L DONE
GCHAR
T H I S S U B R O U T I N E R E T U R N S T HE C H A R A C T E R I S T I C OF T H E F L O A T I N G P O I N T NUMBER P O I N T E D TO BY ( H . L ) I N T HE A R E G I S T E R W I T H I T S S I G N E X T E N D E D I N T O LEFTMOST B IT . REGISTERS
ON E X I T :
A = C H A R A C T E R I S T I C OF ( H . L ) W I T H L = (ORIGINAL L) + 3 B , C , D , E , H = SAME AS ON E N T R Y 005101 0 0 5 I 02 0 0 5 I 03 005104
054 054 054 176
005105
3 46
Page 48
58
GCHAR:
17 7
I NR I NR I NR MOV ANI
THE
L L L A. M 1 77Q
; MAKE ( H , L ) ; MAKE ( H, L ) ; MAKE ( H . L ) ; S E T A = CHAR ; GE T R I D OF
SIGN
EXTENDED
P O I N T TO CHAR P O I N T TO CHAR P O I N T TO CHAR + MANTISSA SIGN MANTISSA SIGN B I T
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
005107 005 I 11 0 0 5 1 13
306 356 31 1
100 100
AO! XR1 RET
SUBROUTI NE
1 OOQ
PROPAGATE CHAR S I G N I N T O L EF T MOS T B I T RESTORE O R I G I N A L CHAR S I G N B I T RETURN W I T H ( H . L ) P O I N T I N G TO THE CHAR = O R I G I N A L ( H . D + 3 SOMEONE EL SE W I L L CLEAN UP
1000
CFCHE
T H I S S U B R O U T 1NE RETURNS THE C H A R A C T E R I S T I C S OF THE F L O A T I N G P O I N T NUMBERS P O I N T E D TO BY ( H . L ) AND ( H . B ) I N THE A AND E R E G I S T E R S R L S P E C T I V E L Y , W I T H T H E I R S I G N S EXTENDED I N T O THE L EFT MOS T B I T . R E G I S T E R S ON E X I T : A = C H A R A C T E R I S T I C OF ( H . L ) E = C H A R A C T E R I S T I C OF ( H . B ) B . C . H . L * SAME AS ON ENTRY
WITH SIGN WITH SIG N
EXTENDED EXTENDEO
0 = A
0051 1 4 0 0 5 1 15 0 0 5 1 1S 005121 005122 005'23 005126 005127 005130 005131 0 0 5 I 32
135 150 3 1 5 101 15 3 13 7 3 1 5 101 055 055 055 127 31 1
CFCHE:
MOV MOV CALL MOV MOV CALL DCR DCR DCR MOV RET
01 2 01 2
SUBROUTINE
E, L L, B GCHAR L, E E.A GCHAR L L L D. A
SAVE L P T R I N E SET L = BPTR GET C H A R ( H . B ) W I T H S I G N EXTENDED I N /I RESTORE L = L PT R SE T E - C H A R ( H . B ) W I T H S I G N EXTENDED SET A = CHAR( H . L ) WI T H S I G N EXTENDED RESTORE L = L PT R RESTORE L = L PT R RESTORE L = L PT R SE T D = A = C H A R ( H . L ) W I T H S I G N EXTENDED
CCMP
T H I S S U B R O U T I N E COMPARES THE C H A R A C T E R I S T I C S OF F L O A T I N G P O I N T NUMBERS P O I N T E D TO BY ( H . L ) AND ( H . B ) . THE ZERO F L I P - F L O P I S SE T I F C H A R ( H . L ) EQUALS CHAR(H.B). I F C H A R ( H . L ) I S L ESS THAN C H A R ( H . B ) THEN THE CARRY B I T W I L L BE S E T . REGISTERS
ON E X I T :
A = C H A R A C T E R I S T I C OF ( H . L ) E = C H A R A C T E R I S T I C OF ( H . B ) D = A B . C . H . L = SAME AS ON ENTRY 005133
315
0051G6 005137 0 0 5 ! > 3 .0 F L W 1 ; W R IT E OVERFLO W ; LO A D C H A R A C T E R IS T IC IN T O D R E G IS T E R ; W R 1 T E C H A R A C T E R 1S T I C : L O A D M A N T IS S A V A L U E B Y T E S OF ; WE ASS U M E H E R E T H A T A H M A N T IS S A ; A R E T H E SAM E ; W R IT E T H E M A N T IS S A : S E T A C C t M U LA T'.iR TO F L A G ; SI T F LA G S PRO PERLY : R L 1 U R . I (W M AN T R E S T O R E D ( H , L ) ) I, I NOF 1 ; WR 1 TE I N D E F I N I T E • f't 'A R A C T E R I S T I C IN T O D R E G IS T E R ; W R1 I £ C H A R A C T E R 1 S T IC : LO A D M A N T IS S A V A L U E : V/E AS-'l UME H E R E T H A T A L L B Y T E S OF M A N T IS S A ; A R E THE SAM E ; W R IT E TH E M A N T IS S A ; S E T A C C U M U LA TO R TO F LA G ; S E T FLAG S PR O PER LY ; R E T U R N (WHAN''" R E S T O R E D ( H , L ) ) W R IT E
NORMAL
ZERO
S T O R E C H A R A C T E R IS T IC ZERO A CCUM ULATO R S T O R E ZERO M A N T IS S A SET FLAG S PROPERLY RETURN FOR
ERROR
FOR
ZER O
RETURNS
P O IN T L E A S T S I G N I F I C A N T B Y T E OF M A N T IS S A S T O R E L S B Y T E OF M A N T IS S A P O IN T TO N E X T L E A S T S I G N I F I C A N T B Y T E OF M A N T IS S A MOV M, A S T O R E N L S B Y T E OF M A N T IS S A DCR L P O IN T TO MOST S I G N I F I C A N T B Y T E OF M A N T IS S A MOV M .A S T O R E M S C Y T E OF M A N T IS S A RET R E T U R N ( H , L ) P O IN T S TO B E G IN N IN G O F F L O A T IN G P O IN T R E S U L T R O U T IN E TO W R IT E C H A R A C T E R T IC FOR ERROR R E T U R N S NOTE: WE P R E S E R V E O R IG IN A L N A N I I S S A S IG N ON EN TRY D C O N T A IN S NEW C H A R A C T E R iI S T IC TO BE S T O R E D .
W M ANT:
005230 005231 005232
055 167 055
005233 005234
167 055
005235 005236
167 31 1
005237 005240 0 0 5 2 -1 1 0 0 5 2 -1 2
054 054 054 1 76
005243 0 0 5 2 -1 5 005245 005247
346 200 262 167 31 1
W CHAR:
DCR
L
MOV DCR
M .A L
IN R I NR IN R MOV
L L L A .M
ANI ORA MOV RET
200Q D M .A
S U B R O U T IN E
S E T ( H . L ) TO P O IN T TO C H A R A C T E R IS T IC PA R T OF ABO VE P A R T OF ABOVE LOAD C H A R A C T E R IS T IC A AND M A N T IS S A S IG N J U S T K E E P M A N T IS S A S IG N OR IN MEW C H A R A C T E R IS T IC S T O R E I T BACK R E T U R N W IT H ( H . L ) P O IN T TO OF R F S U L T C H A R A C T E R IS T IC SOMEONE E L S E W IL L F I X UP ( H . L )
IN D F C
T H I S R O U T IN E W R IT E S A F L O A T IN G I N D E F I N I T E . S E T S T H I S W R IT E S W R IT E S A F L O A T L NG P O IN T I N D E F I N I T E A T ( H , C ) , S E T S THE C O N D IT IO N F L A G AND R E T U R N S 005250 005251 005252 005255 0052& 6
135 1 51 315 153 31 1
I 177
n d fc
:
012
MOV MOV CALL MOV RET
S U B R O U T IN E
E .L L «C WI ND Lj E
S A V E L P T R IN E S E T L = C P T R SO ( H . L ) - A D D R W R IT E I N D E F I N I T E RESTO RE L = L P T R RETURN
Page 50
60
135 151 31 5 153
W ZERC: 215
012
MOV MOV CALL MOV RET
RESULT
W ZERC
T H I S R O U T IN E W R IT E S A NORMAL A T ( H . C ) , S E T S T H E C O N D IT IO N 005257 005260 005261 005254
OF
E. L L .C WZER < -,E
F L A O T IN G F L A G AND
P O IN T ZERO RETURNS
S A V E L P T R IN E S E T L = C P T R SO ( H . L ) = ADDR O F W R IT E NORMAL ZER O RESTO RE L = L P T R R E TU R N
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
RESULT
January, 1977
005265
RET
31 1
; RETURN
S U B R O U T IN E
I NCR
T H I S S U B R O U T IN E IN C R E M E N T S TH E C H A R A C T E R IS T IC OF TH E F L O A T IN G P O IN T NUMBER P O IN T E D TO BY ( H . L ) , WE T E S T FOR O VERFLO W AND S E T A P P R O P R IA T E F L A G . (S E E ERRRCR R E T U R N S ). R E G IS T E R S
A = C O N D IT IO N F L A G D = C L O B B ER E D B . C . H . L = SAME
t 0 0 5 ;.> 3 6 005271 0 0 5 ;-7 3 0 0 5 ;i7 6 005^77 005300 005303 005304 005305 0053C 6 005310 005311 005^12 005313 005315 0 0 5 3 '6 005317 005320 005321 0053?2 005323
315 3 So 31 2 127 024 303 054 054 054 076 242 12 7 1 76 346 2G 2 16 7 055 055 055 257 31 1
101 077 IC S
012 012
306
012
i NCR:
IN C R 3 : 177
ON E X I T :
IN C R 2 :
200
SCCFG :
GCHAR CALL CPI MAXCH JZ 0FL W 1 MOV D , A I NR D JMP I NCR2 I NR L I NR L I NR L M VI A .1 7 7 Q ANA D MOV D , A MOV A .M ANI 200Q ORA D MOV n . A DCR L DCR L DCR L XRA A RET
S U B R O U T IN E
(S E E
ERROR
RETURNS)
G ET CHAR W IT H S IG N E X T E N D E D COMPARE W IT H MAX CHAR P E R M IT T E D IN C R E M E N T WOULD CA U S E O VERFLO W ; /S A V E ET I N D ; /IN C R E M E N T I T JUM P AROUND A L T E R N A T E EN TR Y P O IN T C.OME HER E TO S TO R E C H A R A C T E R IS T IC P O IN T ( H . L ) TO CHAR P O IN T ( H . L ) TO CHAR / K I L L S IG N B I T /B A C K TO D /N O W S IG N I T / G E T M A N T IS S A S IG N / P U T T O G E TH E R /S T O R E I T BACK /M OW BACK TO BA S E / * * * TP ; SET
SUCCESS
FLAG
DECR
T H IS S U B R O U T IN E D E C R E M E N T S TH E C H A R A C T E R IS T IC OF TH E F L O A T IN G P O IN T NUMDER P O IN T E D TO BY ( H . L ) WE T E S T FOR UNDERFLO W AND S E T A P P R O P R IA T E F L A G . ( S E E ERRROR R E T U R N S ). R E G IS T E R S
ON
E X IT :
A = C O N D IT IO N F L A G ( S E E ERROR D = C L O B B ER E D B , C , H . L = SAM E AS ON E N T R Y 005324 005327 005331 005334 005335 005336
005341 005342 005343 0 0 5 34 4 005345 0 0 5 3 16
005347 005350 005351 00 5 353 0C ' 3 5 4 O l15 3 5 5 005356
315 376 312 127 025 303
101 300 150
012
306
012
6ECR:
AORS:
135 1 51 176 267 153 311
135 1 51 026 176 153 242 31 1
012
ts T R :
002
005357 0 0 5 JbO 005361 005362 005363
1 rt5 151 167 153 31 1
ACPR:
005364 O1^ t ;,5 005366 005367
176 135 150 276
6cM P :
January, 1977
CALL CPI JZ MOV DCR JMP
GCHAR M IN C H UFLW1 D ,A D IN C R 2
RETURNS)
; G ET CHAR W IT H S IG N E X T E N D E D ; COMPARE W IT H M IN CHAR P E R M IT T E D ; D E C R EM EN T WOULD CA U S E UNDERFLO W ; S A V E C H A R A C T E R S T IC IN D ; D E C R E M E N T C H A R A C T E R IS T IC ; G 0 S T O R E I T BACK
E .L L .C A .M A L .E
S U B R O U T IN E AORS RETURN S C I I F BASE HAS A 1 I N MSB ; SAVE BASE ; B A S E \ S TO L ; LO A D I T ; SE T FLAG S ; R E S T O R E BA S E
E .L L .C D ,2 A .M L .E D
S U B R O U T IN E T S T R CHE C K S C P T R TO S E E I F NLSBC1 R E T U R N S Z C 1 I F NOT DESTRO YS E , D ; S A V E BASE ; C P T R TO L ; MASK TO D ; LOAD V A L U E ; R E S T O R E BASE ; AND V A L U E W IT H MASK
MOV MOV MOV MOV R ET
E .L L, C M ,A L .E
S U B R O U T IN E ACPR S T O R E S A IN L O C A T IO N L P T R IN E ; SAVE LPTR C P T R TO L STORE A R E S T O R E BA S E
MOV MOV MOV CMP
A .M E .L L .B
MOV MOV MOV ORA MOV RET
MOV MOV MVI MOV MOV ANA RET
M
\6
OF
CPTR
S U B R O U T IN E DCMP CO M PARES TWO DO UBLE L E N G T H WORDS ; NUM M ANTA TO A ; S A V E B A S E IN E ; B A S E \3 TO L ; COMPARE W IT H DEN M ANTA
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 51
61
0 0 0 J .’0 0 0 0 371
0 05 VI2 0053/3 0 0 5 3 7-1 0QV375 0053/0 0 0 5 3 77 005-100 005-101 005 '02 005-103 005-10-1 005-105 005-106 005-107 005-110 005-11 I
005412 00541o 0 0 : 4 20 005423 005426 005427 005432 005433 00543-1 005435 005436 005437 0 0 54 41 0054-02 005443
MOV RNZ INR MOV MOV INR CMP MOV RNZ INR INR MOV MOV I NR INR CMP MOV RET
1 53 300 054 1 76 15 0 054 276 15 3 300 054 054 1 76 15 0 054 054 276 153 31 1
315 332 3 15 322 31 1 315 1 35 151 054 054 1 76 306 1 67 1 53 311
351 01 1 0 2 7 01 3 3 64 01 2 027 013
ENT1 :
346 0 1 2
OVER:
ENT2:
001
RETURN BASE TO L RETURN I F NOT THE SAME L TO NUM MANTB LOAD I T DEN MANTB ADD TO L BASE\ 4 TO L
L.E L A. M L.B L M L,E
, / * * * T P EXTENSION /NOW CHECK BYTE 3
L L A. M L.B L L M L.E
/ G E T FOR COMPARE / B Y T E 3 NOW /COMPARE - ALL DONE
(/* * * T P
CALL DLST JC OVER CALL DCMP JNC OVER RET CALL DSUB MOV E . L MOV L . C INR L INR L MOV A. M ADI 1 MOV M. A MOV L . E RET
»
» 005444 0 0 5 4 16 0 0 5 4 17 005450 0 05 4 5 1 005452 005453 0 0 5 4 5 -1
005455 00 5450 005401 005463 OC 54 34 005405 005467 005470
026 1 51 1 76 1 53 1 67 014 034 025 302 1 73 3^ 6 1 37 1 71 326 1 17 31 1
t. XFR: REP3:
004
045
013
004 004
MVI MOV MOV MOV MOV INR INR DCR JNZ MOV SUI MOV MOV SUI MOV RET
D .4 L.C A.M L.E M. A C E D REPS A.E 4 E,A A.C 4 C.A
SUBROUTINE DI VC PERFORMS ONE CYCLE OF DOUBLE PRE C I S I ON FLOATING PT D I V I D E ENTER AT ENT 1 ON F I R S T CYCLE EN ER AT ENT2 ALL THEREAFTER ; SHI FT MOVING D I V I D E N D ; I F CARRY C1 , NUM. GT. D ; COMPARE NUM WITH DEN ; I F CARRY NOT S ET. NUM. GE ; CALL DOUBLE SUBTRACT ; SAVE BASE I N E ; BASE \ 6 TO L ; BASE \ 7 TO L ; /***T P ; AOD 1 ; PUT I T BACK ; RESTORE BASE TO L SUBROUTINE LXFR MOVES CPTR TO EPTR MOVES 3 WORDS I F ENTER AT ; /MOVE 4 WORDS ; CPTR TO L ; CPTR> TO A ; EPTR TO L ; ; ; ; ; ; ; ; ; ; ;
/ I NCREMENT C / I NCREMENT E TO NEXT / T E S T FOR DONE /GO FOR FOR T I L L D=0 /NOW RESET C AND E / RESET BACK BY 4 / P U T BACK I N E /NOW RESET C /BY 4 /BACK TO C /DONE
SUBROUTINE LDCP T H I S SUBROUTINE COMPUTES THE CHARACTERI STI C FOR THE FLOATI NG D I V I D E ROUTINE REGISTERS ON E X I T : A = CONDI TI ON FLAG ( SEE ERROR RETURNS) 0 , E = GARBAGE B , C , H , L = SAME AS ON ENTRY REGISTERS (H.B) (H.C) (H ,L) 005471 0 0 5 4 74
0U5475
215 223 30 3
114
012
104 0 1 3
LDCP:
CALL SUB JMP
ON ENTRY: = ADDRESSOFF D I V I S O R = ADDRESS OF QUOTIENT = ADDRESS OF D I V I D EN D CFCHE E CCHK
SET E = C H A R ( H . B ) , A = C H A R ( H . L ) SUBTRACT TO GET NEW CHARACTERI STI C GO CHEJCK FOR OVER/UNDERFLOW AND STORE CHARACTERTI ST 1C
SUBROUTINE LMCP T H I S SUBROUTINE COMPUTES THE CHARACTERI STI C FOR THE FLOATI NG MULTI PLY ROUTI NE. R E G IS T E R S
ON E X I T :
A = CONDI TI ON FLAG (SEE ERROR RETURNS) 0 , E = GARBAGE B . C . H . L = SAME AS ON ENTRY
Page 52
62
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
000500 000003
315 203
114
012
R E G IS T E R S
ON E N T R Y :
(H , B ) (H , C) ( H , L>
= ADDRESS = ADDRESS = ADDRESS
LMCP:
CALL ADD
O F F M U L T IP L IC A N D O F PRO DU CT O F M U L T I P L IE R
C FC H E
E
S B U R O U T IN E
; S E T E = C H A R ( H , B ) , A = C HA R ( H . L ) ; ADD TO G ET NEW C H A R A C T E R IS T IC ; NOW F A L L IN T O T H E R O U T IN E ; W H IC H CHECKS FOR O V E R /U N D E R F L O W J AND S T O R E C H A R A C T E R T 1 S T IC
CCHK
T H I S S U B R O U T IN E CHE C K S A C H A R A C T E R IS T IC I N TH E A C C UM ULATO R FOR OVERFLO W OR U N D E R FL O W . I T TH E N S T O R E S T H E C H A R A C T E R IS T IC , P R E S E R V IN G TH E P R E V IO U S L Y CO M PUTED M A N T IS S A S I G N . R E G IS T E R S
ON
(H .L ) ( H, B) ( H ,C ) A
ENTRY: = = = =
R E G IS T E R S
A D D R E S S OF ONE O PERAND A D D R E S S OF O TH E R O PERAND ADDRESS OF R ES U LT NEW C H A R A C T E R IS T IC O F RESULT
ON E X I T :
A = C O N D IT IO N D , £ = GARBAGE B . C . H . L = SAME
005004 005504 000505 005011
005513 005516 0C5520 005523 000524 005525 005026 000531 005532
376 10 0 302 12 3 3 76 2 0 0 332 1 3 3 37 6 3 0 0 332 14 2
6CHK: 01 3 013 013
13 5 1 51 12 7
31 5
STORC:
303
012
15 3 31 1
CPI JC CPI JC CPI JC MOV MOV MOV CALL MOV RET
S U 3 R 0 U T IN E T H IS SETS
0C5533 00053 4 000035 0055 TO A SA V E M ANT S IG N L P T R BACK TO L S T O R E B P T R M ANT S IG N LPTR N2 / * * * TP TO L _ L P T R \2 > T 0 A S A V E L P T R MANT S IG N L P T R BACK TO L / * * * TP
E .L L .B L L L A .M 128 L .E E, A L L L A, M 128 L L L
S U B R O U T IN E B C T L M OVES B P T R CHAR TO DESTRO YSE ; L P T R TO E B P T R TO L BPTR \ 2 / * * *T P TO L B P T R CHAR TO A L P T R TO L LPTR \ 2 TO L /* x * T P S T O R E B P T R CHAR L P T R TO L
E .L L .B
A .M L .E
M .A L .E
LPTR
IN
CHAR
LPTR
CHAR
I* * * * * * * * ! * * * - * * * * * * * * * * * * * * * * * * * * .* * .* * '* * * * * * * * * ,* * * * * * * * / / / / 5 D I G I T F L O A T IN G P T . O U T P U T X X X X X X X X X X X X X X X y X X X X X X X X X X X X X X X X X X t X r t ^ X X f t X X X X X X * * * * * *
R O U T IN E TO C O N V E R T F L O A T IN G P T . x * » NUM BERS TO A S C I I AND O U T P U T THEM V I A A S U B R O U T IN E * * * C A L L E D OUTR N O TE : T H IS IS C U R R E N TLY S E T * * * TO ODT * S O U T P U T R O U T IN E 005632 005635 005040 000641 000042 0 0 5 6 /! 3 005046 005617 005650 005651 005652 005653 005654 005657 005660 005061 00560 2 005663 005054
Page 54
64
315 30? 01 4 01 4 151 3 i 5 054 054 054 054 257 167 303 126 054 106 054 13 6 054
332 207
215
0! 6
01 1 013
CVRT:
012
01 4 NNZRO:
CALL JN Z I NR I NR MOV CALL I NR I NR IN R 1 NR XRA MOV JMP MOV IN R L MOV B .M IN R L MOV E .M IN R L
ZCHK NNZRO C c L, C WZER L L L L A M, A M DSKP D, M
CHECK FOR NEW ZERO NOT ZERO I T W AS, O F F S E T C BY ; W R IT E ZERO ; P N T TO D E C IM A L
;S E T
IT
TO
EXPONENT
ZERO
; OUTPUT IT ; / G E T T H E NUMBER
;/4
2
TO
CONVERT
W ORD* * * T P
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
005665 005663 005667 005670 005671 005672 005673 005674 005675 0056 75 00567 7 005700 005702 005703 00570? 005710 O u 5 7 1 c. 005714 005715 005716 005717 005720 005723 005725 005730 005733 00573 5 0057C 3 00573 7 0 0 5 74 2 00574 4 0 0 5 7 -1 5 005 747 005752 005755 0 0 5 /5 7 0 0 5 7 C0 005763 005765 005770 0 0 5 7 /3 00 5 7 /5 006000 006003 006005 006006 006011 006013 006016 006017 006020 006021 006023 006024 0 0 6 0 ,> 7 006031 006034 006037 006042 0 0 C -0 4 5 006050 006052 006055 006060 ooeoei 0060G 4 006065 00G 06 7 006072 006074 006077 006100 006101 005102 003103 006105 006107 006112 0 0 0 l 13 0 0 6 1 14 O O S i15 006116 0 0 5 12 0 0 0 6 12 3 006124 006125 000126 006130 006131 0 0 6 ’ 32 006135 006"36 0 0 6 1 40 January, 1977
17 6 014 01 4 151 162 054 160 054 16 3 054 10 7 345 167 376 312 326 346 007 054 16 7 170 31 5 056315 315 10 7 346 170 312 076 220 376 372 315 306 167 303 G 5S 315 315 3 76 362 315 306 167 303 375 362 151 055 055 066 13 7 31 5 376 362 315 31 5 315 3 0 ;’ 076 315 31 5 10 7 315 17 0 3 -15 315 306 31 5 151 055 055 176 376 076 31 4 12 6 025 16 2 31 1 036 315 151 055 171 306 1 17 174 315 1 71 326 1 17
177 10 0 31 4 001 10 0
01 3 NZRO:
?^0 024 361 235
01 4 01 4 01 4
TST0:
100 345 200 022 363 243 005 330 030 361 235 001 01 1 243 001 370 007 000
01 3 G O TV: 01 3 01 4 013 TR Y1 : 01 4 01 4
TST1 :
01 4 01 4
MDGN:
01 3 OKI : 014 NDSKP:
005 01 4
16 6 012 31 1 072 115 072 037 305 37D 275
01 7 014
220
01 4
077 340 260 375
01 01 01 01 01
4 4 4 4
4
01 4 D IG O : 01 7
005 255 375
01 7
001 166
01 4
M ULTT:
01 1 377 01 1
POPD: IN P O P :
01 4
MOV A .M IN R C ■ /O F F S E T S C R A T C H P O IN T E R BY 2 IN R C MOV L , C ; / L NOT N E E D E D ANY MORE MCV M .D ; / S A V E NUMBER IN S C R A T C H IN R L MOV M ,B IN R L MOV M ,E / * * *T P / * * x XP IN R L MOV B ,A /S A V E - COPY OF CHAR & S IG N A N I 177Q G ET O NLY C H A R . MOV M ,A / S A V E A B S (N U M B E R ) C P I 1 OOQ CK FOR ZERO NZRO JZ S 'J I 1 / G E T S IG N O F D E C . E X P ANI 1 OOQ / G E T S L G N OF C H A R . RLC MOVE I T TO S IG N P O S IT I O N IN R L /M O V E TO D E C IM A L E X P . MOV M .A / S A V E S IG N OF E X P . MOV A , B / G E T M A N T . S IG H BACK ; /O U T P U T S IG N C A L L S IG N M V I L . ( T E N 5 AND 3 7 7 0 ) ; / TRY M U L T . OR D I V . BY 1 0 0 0 0 0 C A L L COPT /M A K E A COPY IN RAM C A L L GCHR /G E T C H A R . O F NUMBER MOV B . A / S A V E A COPY A N I 1 OOQ / G E T A B S O L U T E V A L U E O F CHAR MOV A . B /IN C A S E PLUS JZ G O TV /A L R E A D Y P L U S /M A K E M IN U S IN T O P L U S M VI A .2 0 0 Q SUB B / P L U S = 2 0 0 3 - CHAR C PI 22Q / T E S T FOR U SE OF 1 0 0 0 0 0 JM TRY 1 /W O N T GO / W I L L GO SO DO I T C A L L MORD ADI 5 / IN C R E M E N T O E C . E X P O N E N T BY MOV M ,A /U P D A T E MEM /G O TRY A G A IN JM P T S T 3 M V I L , ( TEN AND 3 7 7 0 ) ; / NOV/ U SE J U S T T E N C A L L CO PT / P U T I T IN RAM C A L L GCHR /G E T C H A R A C T E R IS T IC CPI 1 /M U S T G E T IN RANGE 1 TO 6 / A T L E A S T I T S 1 OR B IG G E R JP OKI C A L L MORD /M U S T MIJL OF D I V BY 1 0 ADI 1 / IN C R E M E N T D E C IM A L E X P . MOV M ,A /U P D A T E MEM /N O W TRY A G A IN JM P T S T 1 CPI 7 / T E S T FOR L E S S THAN 7 JP /N O P E - 7 OR G R E A T E R MDGN ; / S E T UP D I G I T COUNT MOV L .C DCR L DCR L /IN 1 S T WORD OF S C R A T C H MVI M ,5 / 5 D IG IT S MOV E . A /S A V E C H A R . AS L E F T S H I F T CO UNT CALL L S F T / S H I F T L E F T PRO P ER NUMBER C P I 12Q / T E S T FOR 2 D I G I T S HER E /J M P I F 2 D I G I T S TO O U T P U T JP TWOD /O U T P U T F IR S T D I G I T C A L L D IG O / M U L T I P L Y T H E NUMBER BY 1 0 CALL M U LTT C A L L D IG O /P R IN T D I G I T IN A J N Z POPD /M O R E D I G I T S ? M VI A ,3 0 5 Q /N O SO P R I N T E C A L L O UTR / B A S I C C A L L TO O U T P U T CALL GETEX / G E T D E C IM A L EX P MOV B , A / S A V E A COPY C A L L S IG N /O U T P U T S IG N MOV A , B / G E T E X P BACK A N I 77Q / G E T GOOD B I T S /G O C O N V E R T 2 D I G I T S C A L L CTWO ADI 260Q /M A K E A IN T O A S C I I C A L L OUTR /O U T P U T D I G I T MOV L . C /G E T D I G I T CO UNT DCR ------ L /B A C K UP TO D I G I T CO UNT DCR L MOV A .M / T E S T FOR D E C IM A L P T CPI 5 /P R IN T . A FTE R 1ST D I G I T M VI A .2 5 6 Q / J U S T IN CASE CZ OUTR /O U T P U T . I F 1 S T D I G I T MOV O .M /N O W D E C R E M E N T D I G I T COUNT DCR D MOV M .O /U P D A T E MEM AND L E A V E F L O P S S E T RET /S E R V E S AS TERM FOR D I GO & C V R T M V I E ,1 /M U L T . BY 1 0 ( S T A R T W IT H X 2 ) CALL L S FT /L E F T S H IF T 1 = X 2 MOV L . C /S A V E X 2 I N " R E S U L T " DCR L / S E T TO TOP OF NUMBER MOV A . C / S E T C TO R E S U L T ADI 110 MOV C . A /N O W C S E T R IG H T MOV A ,H /S H O W RAM TO RAM T R A N S F E R C A L L COPY /S A V E X 2 F IN A L L Y MOV A . C /M U S T R E S E T C SUI 11Q /B A C K TO NORMAL MOV C .A
Dr. Dobb's Do Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
F IR S T
Page 55
65
0 0 6 ' -41 0 0 6 ' -43 O O C '4 4 0 0 6 ' -15 006150 0 0 6 1 51 0 0 6 '5 2 0 0 6 1 5-4 006155 006160 OOo 61 0 0 6 ’ 62 006163 006164 0 0 6 l6 5 0 0 6 166 OOC-1 0 7 0 0 6 1 /O 00617 1 0 0 b 172 006173 0 0 6 1 7-1 0 0 6 1 73 006 75 00617 7 0 0 *2 0 0 OOC2 0 1 005202 006203 006204 006205 006206 0 C5 2 0 7 005210 006211 006212 00^213 006214 00C 215 006220 006222 006224 006227 006231 006234 006235 006236 006237 006240 006241 006242 0 0 6 2 -1 3 006246 006247 006250 006251 006252 006253 006255 00625S 006257 0 0 6 2 - '1 006264
006267
0 0 6 2 70 006271 006272
006273 0062/6 0062 77 006300 006303
006306 0 0 6 3 1; 006'J 1 4 0CC-31 5
006320 00632i 006323 006323 006327
006330
006331 0 0 6 3 3 -4 006335 006340 0 0 6 3 -4 2 00634 3 OOC3 4 5 006350 006352 006353 006354 Page 56
66
036 1 51 055 315 151 1 71 30G 107 31 5 055 176 15 0 055 216 31 1 151 055 257 167 035 370 054 0J4 054 1 76 027 16 7 055 176 027 167 055 176 027 16 7 055 176 027 303 346 076 312 076 315 31 1 151 054 054 054 176 31 1 315 137 105 004 151 1 71 306 1 17 173 346 312 315 171 1 15 157 17 4 31 5 151
002 172
014
012 003
012
LSFT: TLO O P: TLP2:
1 71 200 240 231 255 375
01 4 S IG N : 01 4 01 7
GCHR: G ETA:
276
01 4
303 315
10 7 31 5 13 7 345 31 2 035 16 3 170 303 034 303 036 034 326 362 306 107 173 315
M ORD:
01 1 200 303 13 7
014 01 1 F IN U P :
377
01 4
233 000 267 340
014
2 /6
01 4
200 334
014
GETEX:
054
303 315
PLSV:
010
01 4 014
DI V IT : TW O D:
F IN IT : 042
01 4
327 377
01 4
ADD1 : C TW O : LGOP:
012 342 012
01 4
072
01 4
MVI E , 2 MOV L . C DCR L CALL T L P 2 MOV L . C MOV A , C A D I 1 2Q MCV B . A C A L L DADD DCR L MOV A .M r o v L .B DCR L ADC M R ET MOV L . C DCR L XRA A MOV M , A DCR E RM I NR L I NR L I NR L MOV A .M RAL MOV M , A DCR L MOV A .M RAL MOV M . A DCR L MOV A .M RAL MOV M , A DCR L MOV A .M RAL JM P TLO O P ANI 200Q M VI A ,2 4 0 Q JZ PLSV MVI A . 2 5 5 0 C A L L OUTR RET MOV L . C I NR L I NR L I NR L MOV A .M RET CALL. G E T E X MOV E . A MOV B . L 1 NR B MOV L . C MOV A C ADI 1 10 MOV C .A MCV A . E ANI 2000 JZ DI V I T C A L L LM UL MOV A , C MOV C . L MOV L , A MOV A , H C A L L COPY MOV L . C I NR L JMP G ETA CALL L D IV JMP F I NUP C £ L L CTWO MOV B , A CALL GETEX MOV ANI 2 0 0 0 JZ ADD1 DCR E MOV M , E MOV A , B JMP I NPOP I NR E JM P F I N I T M VI E ,3 7 7 Q I NR E SUI 1 2Q JP LOOP ADI 12 0 MOV B , A MOV A . E C A L L D IG S
; /N O W ; /B U T
G ET ( X 2 ) X 4 = X 8 M UST S A V E O VERFLO W
/G E T X 8 / S E T UP TO C A L L / S E T B TO X 2 /T O X 2
DADO
/A D D TWO LOW WORDS /B A C K UP TO O VERFLO W /G E T I T /N O W S E T TO X 2 O VERFLO W / I T S AT B -1 /A D D W IT H CARRY - CARRY WAS P R E S E R V E D / A L L D O N E , R E T U R N O VERFLO W I N A / S E T P T R FOR L E F T S H I F T O F NUMBER /B A C K UP TO OVERFLO W /O V E R F L O W = 0 1 S T T IM E / S A V E OVERFLOW / T E S T FOR DONE / d o ;; e w h e n e m i n u s /M O V E TO LOW ;/* * * T P ; /S H 1FT
E X T E N S IO N LEFT 4 BYTES
/ P U T BACK / * * * T P - A L L DONE /G E T LOW /S H IF T LEFT 1 /R E S T O R E I T /B A C K UP TO H IG H /G E T H IG H / S H I F T I T L E F T W IT H CARRY / P U T 1 T BACK /B A C K UP TO O VERFLO W /G E T O VERFLO W /S H IF T IT L E FT /G O F O R MORE / G E T S IG N B I T /S P A C E IN S T E A D O F P L U S / T E S T FO R + /N E G A T I V E /O U T P U T S IG N ; / G E T C H A R C T E R IS T IC ; /M O V E TO I T / * * x TP /F E T C H IN T O A /D O N E /M U L OR D I V D E P E N D IN G ON E X P / S A V E D E C IM A L E X P / S E T UP TO M U LT OR D I V /N O W BOP P O IN T E R S E T / L P O IN T S TO NUMBER TO C O N V E R T / P O I N T C A T " R E S U L T " AREA /IN S C R A TC H /N O W C S E T R IG H T /N O W T E S T FOR MUL / T E S T N E G A T IV E D E C . E X P . /IF EXP IS + THEN D IV ID E /M U L T . /S A V E L O O . O F R E S U L T /C = L O C OF NUMBER ( I T WAS D E S T R O Y E D ) / S E T L TO L O C . OF R E S U T L /S H O W RAM TO RAM T R A N S F E R /M O V E R E S U L T TO NU M 3ER /N O W G ET D E C IM A L E X P ; / U S E PA R T j/D IV ID E
OF
GCHR
/C O N V E R T TO 2 D I G I T S / S A V E ONES D I G I T / G E T D E C IM A L E X P / S A V E A COPY / T E S T FOR N E G A T IV E /B U M P EX P BY 1 S IN C E 2 D I G I T S /D E C R E M E N T N E G A T IV E E X P S IN C E 2 /R E S T O R E E X P W IT H NEW V A L U E /N O W DO 2N D D I G I T /G O OUT 2N D AND R E S T FO D I G I T S /C O M P E N S A T E FOR 2 D I G I T S
D IG IT S
/C O N V E R T 2 D I G I T B I N TO BCD /A D D UP T E N S D I G I T /S U B T R A C T 1 0 / T 1 I L N E G A T IV E R E S U L T /R E S T O R E O NES D I G I T /S A V E ONES D I G I T /G E T TE N S D I G I T /O U T P U T I T
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
006357 006360 006361 006362 006364 006365 006367 006372 0 0 6 3 73 006375 006376 006377 006400 006401 006402 006403 006401 0 0 6 103 OCO 1 06 000407 0064 i o 0 0 6 4 11 006412 006413
006414 006415 006416 006417
006420 000421 006422 006423
170 31 1 1 71 306 1 17 076 315 1 71 326 1 17 311 104 147 176 054 126 054 13 6 054 15 6 1 10 l 05 1 51 16 7 054 176 16 2 054 163 054 16 0
01 4
005 C O PY :
31 1
006424 0 0 6 4 30
COPT:
005 015 377
MOV A , 8 RET MOV A , C ADI 5 MOV C , A M VI A , ( T E N 5 /2 5 6 ) . C A L L COPY MOV A , C SUI 5 MOV 6 , A RET MOV B . H MOV H ,A MOV A , M I NR L MOV D ,M IN R L MOV E ,M I NR L MOV L ,M MOV H ,B MOV B , L MOV L , C MOV M .A I NR L MOV A ,M MOV M .D IN R L MOV M .E IN R L MOV M .B RET
1"0
240
000
003
021
^EN5: TEN:
D3 DB
/S E T
A TO
/C O P Y /S E T
FROM C TO
/C O P Y I T /N O W R E S E T /IT S
MAP
R E L A T IV E C -2 C -l C C *1 C+2 C +3 C +4 C +5 C +6 C+7 C +8 C +9 C+10 C+ 11
TO
FOR
ERR: x * x i
1 0 'N
TO
RAM
TO
PUT
C
RESET
/S A V E RAM H / S E T TO SO URC E H / G E T 4 WORDS IN T O
THE
REGS.
; / L A S T ONE E R A S E S L ; / S E T TO D E S T IN A T IO N RAM ; / S A V E 4 T H WORD IN B ; / S E T TO D E S T IN A T IO N ; /S A V E F IR S T WORD j / S A V E T H I S WORD I N ; /N O W P U T 2 N D WORD
; /A L L ; /A L L
4 C O P IE D DONE
I/O
C O N V E R S IO N
=
A ( IN P U T S A V E S C H E R E
NOW
100000.
R O U T IN E S
( C + 2 ) U SE D I G I T COUNT O VERFLO W H IG H NUMBER - M A N T IS S A LOW NUMBER C H A R A C T E R IS T IC D E C IM A L E X P O N E N T ( S I G N T E N * *N T E N * *N T E N * *N R E S U L T OF M U L T & D I V AND TEM P FOR X 2 •I
& M A G .)
M
L FOR D IG IT
NUMBER TO GO IN T O J U S T IN P U T ( I N P U T
/x w * * *B E G tN 067 31 1
D IG IT
PLACE
3 0 3 0 , ' 2 0 0 . 0 0 , 21Q ;/3 0 3 2 4 0 (3 ) 2 4 0 0 ,0 0 ,0 0 ,4 0 ;/1 2 (8 ) = 10
SCR ATCH
0 0 6 134 0 0 6 135
2N D
(IN P U T ONLY)
ONLY)
IN P U T * * * * * * * * * * * * *
; ERROR F L A G ; AND R E T U R N
STC RET
xx*x**«*»xt*’x*£sx«x***ii*x**.'S*K*x*»:;:xxft*x**»x*xx*tt*x* / / / /
4
1 /2
D IG IT
IN P U T
R O U T IN E
XXXXXXXXXXXXXXXrXXfXXXXXXXXXXItntXXXftXXftXXXX*************
/L /C
006436 006437 0064 3? 5 315 346
31 1 0 1 5 3 /6
203 025 230 360 034 022 276 177
13 7
346 007
10 0
01 5
015 015 01 3 01 4
TSTEX:
SCA LE:
MOV B . L MOV A . C A D I 1 7Q MOV L , A MOV M ,B I NR C I NR C CALL ZR O I T I NR L MOV M .A C A L L GNUM CPI 3760 JZ DECPT C P I 25Q JZ I NEXP CPI 360Q J N Z ERR CALL FLTSG N CALL GETEX A N I 177Q MOV E , A AN I 100Q RLC
P O IN T S P O IN T S
TO WHERE TO P U T IN P U T NUMBER TO 1 3 ( 1 0 ) WORDS OF S C R A T C H
/S A V E ADDRESS /IN SC R A TC H /C O M P U T E L O C .
WHERE IN
D A TA
IS
TO GO
SCR ATCH
/P U T IT /O F F S E T S C R A T C H P O IN T E R /B Y 2 /Z E R O NUMBER /A N D ZERO / D E C IM A L E X P O N E N T / G E T IN T E G E R P A R T O F NUM / T E R M * .? /Y E S / T E S T FO R E /Y E S - HANDLE EXP / T E S T FOR S P A C E TERM ( 2 4 0 B - 2 6 0 B ) /N O T L E G A L TERM /F L O A T ft AMD S IG N I T /G E T D E C IM A L E X P /G E T GOOD B I T S /S A V E COPY /G E T S IG N O F E X P / I N T O S IG N B I T
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 57
67
0 0 0 '- 1 1 00631 2 00031 3 0063 14 0065 I 7 0 0 6 5 c .’ 1 006322 0 C 6 ': 2 3 0 0 6 3 2 -1 006526 006331 006334 006336 0 0 6 3 10 0 0 6 5 -1 3 00634 3 006350 0C63S1
00653-1
006553 006361 006564 006566 006567 006372
006575 0 0 6 3 /7
006600 006603 00660 4 0C6695 006606 00661 0 006613 006614 0066 I5 COCO I S
006617 006620 006623 006624 006623 006630 006633 006636 006641 006 644 006 oA5 006651
0C6632 006653 006634 006635
0C6637 0C6660 006651 006662 006663 006664 006667 006671 006672 006673 006674 006675
006676 006 700 006701 0 0 1-7 0 2
000703 006706 006711 006714 006716
267 107 173 312 076 £23 200 16 7 056 315 31 5 346 376 372 315 326 16 7 303 056 313 313 346 267 31 2 313 326 167
303
151 035 055 006 315 137 1 51 055 035 106 315 160 173
303 3 13 315 31 3 315 376 302 151 054 054 176
346
372
076 220 054 206 16 7 1 71 3C3 157 15 6 174 315
303
31 5 376 31 2
370 302 151 054 054 054
006741
3 i2
Page 58
68
066 303 37 6 326
370 3 76 360 i 37 31 5 16 3
3 15 267
01 5 APLS:
024 361 276 077 005 154 243 005
01 4 01 4 I NTS: 015 01 4
134 030 361 276 077
01 4 01 4
026 243 001
016 01 4
164
015
015 TRYTN: IN T I :
DEC PT: 000 01 4 01 s
276
01 4
063
015
022 026 035
01 5
01 5
I NEXP:
01 5 31 1 0 1 5 360 034 015
037
10 7 034 176 267 170
006721 00672 3 00672-5 0 0 6 7 27 005730 006/3i 006732 006734 006737 0067/! 1 000746 00674/ 006751 OC u 7 5 2 006733 006753 0067 oV 006762
122 200
ORA A MOV B . A MOV JZ APLS MVI A . 2 0 0 Q
272 000
01 5
USEIT:
015
377
014 1 0 0 01 5 3 7 2 01 7 240 31 1 0 1 5 255 337 015
200 31 1 0 1 5 233 3 11 015 260 012 047
01 5
1 16
01 4
GNUM:
T RYP: TSTN:
/ S E T FLOPS /SAVE SI GN / G E T EXP BACK /JMP IS ♦ /MAKE MINUS ♦ SUB /NOW I T S + ADD B / S I G N NUMBER MOV M A / S A VE EXP ( S I G N & M A O .) MVI L i ( TEN5 AND 3 7 7 0 ) ; / TRY MORD WITH 1 0 * * 5 F I R S T CALL COPT /TRANSFER TO RAM CALL GETEX / G E T DECIMAL E X P ANI 77Q / G E T MAG. OF E X P CPI 50 / T E S T FOR USE OF 1 0 * * 5 JM TRYTN /WONT GO - TRY 10 CALL MORD / W I L L GO SO DO I T SUI 5Q /MAG - MAG - 5 MOV M. A /UPDATE DEC. EXP I N MEM JMP 1NT5 / GO TRY ACAIN MVI L , ( TEN AND 3 7 7 0 ) ; / P U T TEN I N RAM CALL COPT CALL GETEX / S E T UP FOR LOOP ANI 77Q / G E T MAGNITUDE ORA A / T E S T FOR 0 JZ SAVEN /DONE, MOVE NUM OUT AND G ET O U T CALL MORD /NOT DONE - DO 10 SUI 10 / E X P = EXP -1 MOV M, A /UPDATE MEM JMP I N T I / T R Y AGAIN MOV L . C /Z ERO D I G I T CO UNT DCR L / S I N C E I TS NECESSARY DCR L / T O COMPUTE EXP. MVI M , 0 /ZEROED CALL E P 1 /GNUM IN MIDDLE MOV E . A / SAVE TERMINATOR MOV L , C /MOVE D I G I T COUNT TO EXP DCR L /BACK UP TO D I G I T CO UNT DCR L MOV B .M /GOT D I G I T COUNT CALL G E T E X / S E T L TO DEC. E X P MOV M. B / P U T EXP MOV A , E /TERM BACK TO A JMP TSTEX / T E S T FOR E+OR-XX CALL FLTSGN / F L OA T AND SI GN NUMBER CALL SAVEN / S A V E NUMBER I N ( L ) TEMP CALL ZROI T /ZERO OUT NUM. FCR I N P UT T I N G EXP CALL GNUM /NOW INPUT EXPONENT CPI 3 6 0 0 / T E S T FOR S P A C E T F R M . JNZ ERR / N OT L E G A L - TRY A G A IN MOV L . C / G E T EXP OUT OF MEM I NR L / * * * TP I NR L / E X P L I M I T E D TO 5 B I T S MOV A. M / G E T LOWEST 8 B I T S ANI 3 70 / G E T GOOD B I T S MOV B . A / S A VE THEM I NR L / G E T SIGN OF EXP MOV A. M /INTO A ORA A / S E T FLOPS MOV A . B / I N C A S E NOTHING TO DO JM / I F NEG. USE AS + USEIT MVI A. OQ / I F + MAKE SUB B / 0 - X = -X I NR L / P O I N T AT EXP ADD M / GET REAL DEC, EXP MOV M, A / P U T I N MEM /NOW GET NUMBER BACK MOV A . C ADI 1 5 Q /GET ADD OF L MOV L , A / L POI NTS TO L OF NUMBER /NOW L POI NTS TO NUMBER MOV L . M /RAM TO RAM COPY W l AC(?PY /COPY I T BACK JMP SCALE /NOW ADJUST FOR EXP CALL INP / G E T A CHAR CPI 2 4 0 0 / I GN O R E LEADING SPACES JZ GNUM CPI 2 5 5 Q / T E S T FOR JNZ TRYP / NOT MINUS MOV L . C / M I N U S SO SET SI GN I NR L / I N CHAR LOC. I NR L / * * * TP INR / S E T - SIGN MVI M . 2 0 0 Q JMP GNUM / I GN O R E ♦ CPI 2 5 3 0 JZ GNUM / S T R I P ASCI I SUI 2 6 0 0 /RETURN I F TERM RM CPI 1 20 / T E S T FOR NUMBER / ILLEGAL RP / S A VE D I G I T MOV E . A / L O C . OF D I G I T STORAGE TO L CALL GETN / S A VE D I G I T MOV M. E CALL MULTT /MULT NUMBER BY 10 / T E S T FCR TOO MANY D I G I T S ORA A
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
January, 1977
OOb' 763 006764 000767 006.770
ooe.77i
006772 0 0 6 7 73 006774 006/75 OC'G 7 7 6 007000 00700! 007002 007003 007025 007005 007007 007010 007011 007012 007013 007014 007017 007022 007023 007025 007027 007031 007032 007033 007034 007035 007036 007037 007040 007041 0070/14 007045 00704 6 00 70 4 7 007050 0 0 7 0 52 00 7033 007054 007055 0 0 70 76
007057 007060 007061
CO/062 007063 00/064 007065 OU7066 000633
300
CM 5 151 054 054 206 16 7 055 176 316 167 055 176 316 167 330 005 055 10 6 004 16 0 315
303
306
305 31 5 17 0 301 31 1
007104 007105 007106 00 7107
365 325 345 076 136 054 126 054 325 343 13 6 043 126 043 343 16 3 054 162 054 075
00 7 l 30 007131
January, 1977
372 344
01 7 015
302
EP1 : FLTSGN:
325
011 SAVEN:
015
15 7 136 153 054 1 61 151 1 13 17 4 315 377 1 17 267 31 1 1 71 306 016 15 7 176 31 1 1 51 257 167 054 16 7 054 16 7 054 16 7 31 1
007075 007076 0 0 7 1 01 007 02 007103
007)23 0 0 7 l 24 00 7125 0 0 7 1 26 0 0 7 127
000
1 71
173 271 300 172 270 31 1
0 0 7 1 14 007115 0 0 7 '1 6 007117 007120 007121 0 0 7 122
000
151
303
007067 007070 007071 0 0 70 72 007073 007074
007 11 0071i 2 0 0 7 1 13
047 016
014
ORA
333 030
002
M 6
RNZ C A L L G ETN MOV L , C I NR L I NR L ADD M MOV M , A DCR L MOV A .M AC I 00 MOV M . A DCR L MOV A , M AC I 0 0 MOV M , A RC DCR L DCR L MOV B , M I NR B MOV M , B C A L L IN P JMP T S T N MOV L JMP FI MOV A . C A D I 1 50 MOV L , A MOV E ,M MOV L , E I NR L MOV M, C MOV L . C MOV C , E MOV A . H C A L L COPY MOV C. A
015
A
/T O O
/GET /SET
MANY D I G I T S D IG IT L TO NUMBER
/ X * * TP /A D D IN TH E D I G I T / P U T R E S U L T BACK /N O W DO H IG H /G E T H IG H TO ADD I N /A D D IN CARRY /U P D A T E H IG H / * * * TP E X T E N S IO N /A D D I N CARRY / * * * TP A L L DONE /O V E R F L O W ERROR /9 U M P D I G I T COUNT
CARRY
NOW
/ G E T D I G I T COUNT /B U M P D I G I T COUNT /U P D A T E D I G I T COUNT / G E T N E X T CHAR /M U S T BE NUM. OR TERM ; P O IN T L A T NUMBER TO ; GO F L O A T I T / P U T NUMBER I N ( L ) / G E T ADD O F L
FLO AT
/G E T L OF R E S U LT /P O IN T L AT ( L ) / S E T TO 2N D WORD TO S A V E C / S A V E C IN ( L ) +1 S IN C E I T W IL L BE / S E T UP TO C A L L COPY DESTRO YED /N O W L S C S E T /R A M TO RAM COPY /C O P Y TC L / ( L ) + 1 R E T U R N E D H ER E SO S E T A S C ; MAKE 5 U !!E CY = 0 (N O E R R O R ) /N O V / E V E R Y T H IN G H U N K Y -D O R R Y /G E T D I G I T / L A S T L O C . IN SC R A TC H / P U T IN L /G E T D I G I T
RET GETN: MOV A . C A D I 1 60 MOV L , A MOV A .M R ET Z R O IT : MOV L . C /Z E R O NUMBERXRA A MOV M, A / * * * TP I NR L / * * * TP MOV M . A I NR L MOV M , A I NR L ; /N O W S E T S IG N TO ♦ MOV M . A RET ; /D O N E REA D EOU ; ODT READ R O U T IN E ; C O N T A IN LOW B Y T E OF TWO B Y T E V A L U E . R E T U R N S C Y = 1 I F : B O D E , CY = 0 I F B C < D E : Z = 1 I F B C = D E . DCOMP: MOV A, E CMP C RNZ MOV Aj 0 CMP B RET ; R O U T IN E TO IN P U T CHAR FROM TTY CH AR 2: PUSH B CALL READ ; IN P U T FROM ODT MOV A .B ; G E T CHAR TO A R E G . POP B ; RESTO RE B ,C RFT FORWARD P N T . AND ; R O U T IN E ',0 A D J U S T V A L U E S O F B I N PA R SED ADD OF TEM P V A R IA B L E L IN E L E N G T H OF SOURCE L I N E . : C O N T A IN IN G ADD OF S O I PUSH PSW PTVAL: PUSH D PUSH H M VI A, 002 MOV E. M I NR L MOV D.M I NR L PUSH D XTHL N1 : MOV E. M H I NX MOV D.M I NX H XTHL MOV M. E I NR L M, D MOV 1 NR L A DCR JNZ N1
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 59
69
0 0 7 '2 1 0 0 / 135 0 0 /'3 6 00/ 37 0 0 7 : io 0 0 7 ' -4 1 007 : 4? CO 7 , 13
343 12 6 341 1 62 341 321 361 31 1
0 0 7 ' ^D
I
_____ ,___ A
J
ON*.
'
'
I °
____ A __
3
©
C
D
I
' I 1
7
C
D
C
1
0 RAW DATA
C
C
j l i i
D
C
D
D
D
D
D
C
D
C
C
___ n _ ____ _ n ___ n ___ n _____ SEPARATE CLOCK
© 7. The Data M ark has a transfer rate of 2 /xs per b it (a), o r tw ic e th a t o f th e usual fo rm a t. T his e lim in a te s p o s s ib le e rro rs and th e need fo r d o u b le b u ffe rin g . The m is s in g clo c k pulses are generated w ith the aid o f a sep a rate c lo ck sig na l (b) fro m th e flo p p y disc.
(2 MHz)
9 9 TH EN 5 7 FO R 1 = 1 T O 1 6 1 P R IN T iN E X T 8 OUT 2 0 0 , 0 1 0 U = Z + 7 5 4 I L = Z + 8 6 4 I K=L I P = Z + 3 2 : N = Z -3 2 : J = Z + 7 2 2 1 5 PO KE Z , 3 2 i H = 0 1 1 = 0 1 PO K E L + 1 2 8 , 1 6 0 i L = L + 1 2 8 2 0 D = Z + 5 9 2 iP O K E D , 9 0 1 P O K E D + l , 6 5 1 PO K E D + 2 , 8 0 i P 0 K E D + 3 , 8 3 3 0 PO K E D + 3 1 . 6 6 : PO K E D + 3 2 , ? 9 i P 0 KE D + 3 3 , 7 6 iP O K E D + 3 4 , 8 4 4 0 PO K E D + 3 5 , 8 3 i P O K E D + 9 6 , 7 6 i P O K E D + 9 ? . 6 9 1 PO KE D + 9 8 , 7 0 4 5 PO KE D + 9 9 , 8 4 i S = S + 1 .G O S U B 4 0 0 5 0 S = 0 iX = Z s Y = Z + 6 4 1 0 0 GOSUB 3 0 0 0 1 1 0 I F I N P ( 2 5 5 ) = 0 TH EN 1 0 0 1 2 0 GOSUB 'tO O 1 3 0 PO K E L + 6 4 , 3 2 * P 0 K E L , 4 i L = L - 6 4 i G 0 S U b 3 0 0 0 1 5 0 I F L O N TH EN 1 3 0 2 0 0 PO K E P . 3 2 2 1 0 I F B = 0 AND ( X - 1 = F OR X - 2 = P ) T E E N 2 4 0 2 1 2 I F B = 1 AND ( X + l - P OR X + 2 = P ) TH EN 2 4 0 2 2 0 I F S < 1 TH EN 5 2 3 0 GOTO 1 1 0 24CT H - 3 + 1 i I = I N T ( H / 1 0 ) iP O K E J + l , H - I * 1 0 + 4 8 . P O K E J , I + 4 8 . I = H 2 4 2 D = Z + 3 2 i? O K E D , 9 0 i P O K E D + l , 6 5 1 P O K E D + 2 , 8 0 i P O K E D + 3 , 8 0 2 4 4 PO K E D + 4 , 3 3 i X = Z i W=0 2 4 5 PO K E X , 3 2 i X « X + l i W = W + l i I F W O 5 0 THEN 2 4 5 2 5 0 GOTO 5 0 4 0 0 S = S - l i L = K i V = I N T ( S / 1 0 ) i P O K E U + l , S - V * 1 0 + 4 8 1 POKE U .V + 4 8 4 1 0 V = S 'i RETURN 3 0 0 0 I F 5 = 1 THEN 3 9 0 0 3 1 0 0 PO KE X - l , 3 2 1 PO KE X , 7 i X = X + l 1 I F X O Y THEN RETURN 3 2 0 0 X = X - 1 1 B = 1 1 RETURN 3 9 0 0 PO K E X + l , 3 2 ‘ PO K E X , ? i X = X - l i I F X O Z TH EN RETURN 4 0 0 0 X = X + 1 1 B = 0 1 RETURN
Dt. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
February, 1977
$10 F O R 6 4 C H A R A C T E R S & S C R O L L IN G O N A T V T II Dear Mr. Warren: January 27,1977 I am enclosing details for a conversion I made on my SWTPC TVT-II to allow it to operate in a scrolling mode with 64 character lines. I’ve been using this feature on my TVT for over two months now and find it a marked improvement over the original. The modified terminal displays 16 types lines each with up to 64 characters. All data is entered along the bottom line in typical scroll fashion. Similarly, a line feed will cause all typed lines to move up one position on the screen while the top line “ wraps” around to the bottom . The additional circuitry fits nicely on a 3” x 3 ” universal P.C. board which I have mounted on the TVT memory board with plastic stand-offs. All parts are readily available and the whole project should not run over $ 10 .00. The change divides nicely into two main sections and two options. Each is treated separately below. Should anyone have need for less than the total circuitry either section and the options can be used separately or in any combination. SCROLLING CONVERSION: In the unmodified TVT circuit, cursor line position in formation comes from up-down counter, IC-34. This then feeds IC-41 where it is compared with data on memory address A-5 thru A-8. Disconnecting this feed from IC-34 and placing the four “ A” input lines o f IC-41 at logic 1 will locate the cursor along line 16 at bottom line of the screen. Scrolling is then accomplished by inserting, essentially
BREAK FOIL
r
J7
I-----1
in series, a 7483, 4-bit binary adder, in memory address lines A-5, A-6, A-7 and A-8 as they feed to the 2102 memory IC’s. The four outputs of IC-34 are fed into the “ B” inputs on the 7483 full adder and used to provide a binary “off set” , shifting the TVT display up one line each time IC-34 is incremented or down if it is decremented. Since only 16 TV display lines are involved, one 4-bit adder is all that is necessary. The CARRY OUTPUT is ignored and input CO tied to ground. 64 CHARACTER CONVERSION: In order to generate 64 character lines, the dot generator, IC-18B, must operate at approximately twice its normal frequency. To do this capacitor C-4 was changed to 15 PF. To address 64 characters 6 memory address bits are re quired. Five are provided for from the 32 character lines in the original TVT-II- Along with an extra memory add ress bit, one additional register to feed it is also needed. Fortunately, both of these are available in the TVT-II. One o f the flip-flops in IC-14 is unused and with only slight wiring changes this fourth flip-flop can be used for the extra address bit. Although it’s a bit unconventional, we can use the tenth memory address line, the page select (A-9), as the sixth bit memory address. This works well and with only a minimum of changes to the original circuitry. Also required for the 64 character conversion is a means of keeping track of the cursor for characters 33 thru 64. One additional stage of up-down counting has been added to the cursor position registers just ahead of
-X -X -X
-x
1C 3 4
|
TO 7483 PIN II
A| A2 A 3 A 4 3ND
I
__ I*
C4
S | Z2 C 3 * 4
7483
-BREAK FOIL
1C 6
AM
VCC
l*>oV] x x X X Q -v w v TO
_,
r-M V E l
----- 1----------o 01 OPTIONAL.
IC34
PIN 7
1C 41
-J
GROUNDING THIS POINT PLACES CURSOR ON UNE No. 8 IN M ID SCREEN. -STR AP 1C41 AS SHOWN
P/O TVT n
MEMORY BOARD:
P/O TVT TL MAIN BOARD
C T -1024 TVT 3E SCROLL MODIFICATION February, 1977
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 25
95
Page 26
96
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E. Menlo Park, CA 94025
February, 1977
IC-34 to take care of this. This extra counter uses essen tially the same circuitry as the existing fifth bit counter. Along with the counter one additional comparator is needed to compare the counter output with the new memory address data from line A-9. A 7485 comparator has been added for this purpose. Only one o f the four circuits on the 7485 is used. The others are all tied to the +5VDC. All comparators are connected in series in the TVT so this “ extra” one may be tied in at any convenient point in the string. OPTION NO. 1: This option provides an automatic EOL erase on line 16 with a “line feed’ so new lines will always come up “ clean” . No attem pt was made to store data in the TVT-II beyond what is actually on the screen. Doing this will require additional memory. OPTION NO. 2: This option charges the “ EOF” erase circuit to a “ full screen” erase regardless of cursor position. Scrolling places the cursor on the bottom line which defeats the normal “ Home-up” , “ EOF” screen erase procedure. The “Home-up” jum per on the comparator controlled cursor board should also be removed. Many o f the circuit elements needed for the project are available from unused IC sections on the TVT. However, using them would have increased the complexity of the wiring. Therefore, I chose to use separate IC’s. Placing the extra circuitry on a small P.C. board makes the full conversion quite simple. A 3” x 3” “ universal” PC board is adequate for the purpose. D.C. voltage was taken direct ly from the TVT’s regulated +5VDC supply. The TVT lends itself well to modifications of this type and I expect there are several changes which have been made by others that we all could profit from. I would very much like to see what other readers are doing or have done with their TVT-IPs. Sincerely, R. Lynn Smith PSC No. 1, Box 7327 APO San Francisco, CA 96286
NEW S IG N E T IC S 8 K PR O M O F F E R S H IG H E R S P E E D , 30% S IZ E R E D U C T IO N O F C H IP SUNNYVALE, California - A field programmable 8192 bit bipolar Read Only Memory with a 2048 x 4 organization is now available in production quantities from Signetics. One of the first 8K PROMs to be marketed in large quantities, the new Signetics device also offers improvements in speed, size and power requirements over similar devices announced by other manufacturers, according to Ralph Kaplan, Marketing Manager for Memories. The TTL-compatible memory is available with either Open Collector outputs (82S184) or Tri-State outputs (82S185), allowing to optimal word expansion in bussed organizations. Key performance specifications include an address access time of 100 nanoseconds maximum and typical power dissipation o f 50 microwatts/bit. The 82S184/185 devices also feature a significantly smaller chip size of 26,600 square mils, about 30% smaller than current industry standards for devices with this capa city, according to Kaplan. Both devices are available in a space-saving 18-pin ceramic DIP package and offer substantial savings in costs. Priced at $31.00 in quantities of 100 and up, they represent a cost/bit savings of approximately 35% compared with equivalent PROMs now on the market, Kaplan says. The 82S184/185 devices are an extension o f the Signetics generic family o f PROMs, utilizing the same basic fusiblelink programming techniques. They also represent a fur ther extension o f the company’s line of PROMs with 4-bit word organization, which facilitates memory expansion. Other features include on-chip address decoding and a chip enable input. The 82S184 and 185 are currently available in the commercial temperature range (0 C to +75C), with mili tary grade devices expected in the near future. For further information contact Signetics, 811 Argues Avenue, Sunnyvale, California 94086. (408)739-7700.
PARTS LIST Item No. 1. 2. 2a. 2b. 2c. 2d. 2e. 2 f. 2g. 2h.
Description
Qty.
Scrolling Conversion 7483 64 Character Conversion 15 PF Capacitor .1 Mdf Capacitors Cermic 1000 Ohm 1/4 Watt Resistors 7403 7404 7474 7485 IN 914 or Equiv.
1 Ea. 1 2 4 1 1 1 1 1
Ea. Ea. Ea. Ea. Ea. Ea. Ea. Ea.
These beautiful, immaculate, exquisite, masterfully executed perfectly produced, ever-so-wonderful schematics have brought joy to this old editor’s heart. 0... what great pleasure doth arise from well-done artwork. —EDITOR A L T A IR D IS T R IB U T IO N M O V E S January 21, 1977 M ITS, INC.has decided to move its subsidiary, Altair Distribution Company, Inc., from 730 Boston Post Road, Wayside Plaza, Sudbury, Massachusetts 01776 to M ITS headquarters at 2450 Alamo, S.E., Albuquerque, New Mexico 87106. The transfer is in progress and is planned to be a smooth one. If you have any questions, please contact Mr. Robert Tinley, Vice President of Operations, or Mr. Robert Lindemuth, Vice President of Finance, at MITS in Albuquerque. February, 1977
S IN G E R /F R ID E N D O C U M E N T A T IO N Dr. Dobbs & Readers: I have schematics, wire lists, and operator instructions for Singer/Friden Key-to-Tape terminals that were widely sold on the S. Calif, surplus market. I charge $20.00, which is refundable if it isn’t what you need. Send me your top assy number and plug-in card numbers. John Clothier, EE c/o Interstate Electronics 707 E. Vermont Ave. Anaheim, CA 92803
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 27
97
64 C H A R /L IN E T V T -II M O D S , R E Q U E S T S & S U G G E S T IO N S
Dear Dr. DJOCC&O,
Dec. 29, 1976
First, praise for the excellent product review of the Poly 88 system. Could you arrange a comparison/evaluation of some floppy disc units (i.e. Digital Systems w/CPM), Processor Tech nology’s Helios and the ICOM system. Many of us are waiting to buy a floppy storage system and at 2K dollars, purchasers are entitled to some o f D D J’s expert evaluation. Second, enclosed you will find an article that describes how the TVT-II can very simply be modified to display 64 characters/line. It requires only one IC as indicated and it works. It was originally developed in the Atlanta Area Micro Computer Club. Third, I would like to compliment Marvin Wizenread on the interesting VDM software he has submitted to DDJ. I pose this challenge to his ingenuity — how about a PONG game? PLEASE: ask him to document for a VDM at the Proctoc standard address o f CCOOH-CFFFH, the UP and DOWN assembly language sequences o f his programs. I enjoyed Marvin’s Life on a VDM but if “ Life’s Like That” having to enter the starting configuration from the front panel, then why bother to use a computer? Life can be done with graph paper, pencil and eraser. However, despair not, haters o f front panel switches. I am writing an article that discusses humane ways of putting data in your machines. I would like to suggest a new approach for DDJ to pursue in the area o f software development. Till now, DDJ has set up specifications for languages that can be implemented by its readers. The response in the form of Tiny Basics, and other languages has been wonderful. I propose that DDJ publish specifications for applications programs that would serve as an impetus to program development as did the original specifications for Tiny Basic. For instance: Applications Project I: Payroll a) Language: ANSI Basic or ALTAIR 8K Basic V3,2 b) Minimal Hardware: ALTAIR/IMSAI computer 20K RAM memory Tarbell cassette ASCII keyboard and VDM or other video display unit ASR 33 or other hardcopy printing device c) Objective: To provide payroll com putations for a business with 15 to 20 employees. It should allow the preparation of payroll for hourly and salaried employees on a periodic basis. Data should be available as weekly summary sheets for all employees and also individual payroll files for each employee. The program should be able to produce quarterly and annual reports o f information needed for filing with local, state and federal tax authorities. That’s all for the time being.
TVT-II 64 CHARACTER MODIFICATION This modification converts the TVT-II display to a single page of 16 lines of 64 characters. Operation o f the cursor board, screen read board, parallel or serial interface is unaffected. After conversion the TVT-II will operate as usual with the cursor homing after character 64 on line 16. Parts Needed: 1) IC-43 (1) one 7486 quad exclusive or gate 2) IC-40 if needed (see Step 2) 3) Sharp razor to cut printed circuit foils 4) Jumper wires - insulated solid conductor smaller than 24 guage. Steps: You will cut PC foils (only a 1/16” gap is needed) and add jumpers. The notation 40-5 means IC-40 pin 5 1) Remove R7 (4.7K) and replace with a 1.8K resistor to increase the dot clock frequency. 2) Remove IC-40. (If you cannot remove IC’s from a plated thru board without damaging the board then clip each lead of IC-40, remove its body, and desolder each pin individually. If you cut IC-40’s pins then you will need a new one to complete the modification.) Cut the foil between 40-6 and 40-11. Replace IC-40. 3) On the bottom o f the board cut the foil at 40-5 and 40-13. On the top cut the foil at 40-11 and 40-12. Cut the foil at 40-11 and 40-12. Cut the foil from 40-4 to 33-8 at the feed thru near 40-14, not under the IC. 4) Piggyback the 7486, now called IC-43, on top of IC-40 by bending all pins except 7 and 14 out horizontally. Then solder pins 7 and 14 o f IC-43 to pins 7 and 14 of IC-40. 5) Bottom o f the board cut the foil at 23-10. Connect 43-3 to 17-12. Connect 43-2 to 23-10. Connect a short wire to 43-1. If this wire is connected to +5V then video polarity is inverted; if grounded, then polarity is normal. You can add a switch here or solder permanent ly as desired. 6) On the bottom cut the foil at 27-13 and at 27-9. Top of the board cut the foil at 35-5 at the feed thru. Connect 40-11 to 35-5. Connect 40-12 to 33-8. Connect 40-13 to 27-9. Connect 27-1 to 27-13. Connect 27-8 to 40-4.
F*>* 23/0 Sincerely, Gary Alevy 1056 Fifth Avenue New York, NY 10028
— '|rc 13\ 3
11 IC
“
I
V P f O POLfiRITl
TVl'll
Page 28
98
17
L- *s
6* CHAfMCT E R MOD \f\CflTION
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
February, 1977
7) Bottom o f the board cut the foil between 35-4 and R23. On the top cut the foils at 28-4, 28-5, 33-9. Connect 40-6 to 35-4. Connect 40-5 to 43-6. Connect 40-4 to 43-10. Connect 28-5 and 43-4 to R23. Connect 43-5 to 40-14. Connect 28-4 to R46 at 35-5. Connect 33-9 to R46. 8) On the bottom cut the foil from 12-4 to 21-1 at 21-1. Connect 12-4 to 21-14. Connect 21-1 to 21-12 to address line, A9, which is the foil that was cut from 27-9. Connect 43-9 to A9. 9) Connect 43-8 to 43-11. Connect 42-3 (the foil which was cut from 40-11) to 43-11. Connect 33-6 (the foil which was cut from 40-12) to 43-12. Connect 35-3 (which was cut from 33-9) to 43-13. 10) The modification is complete. Whew! Now double check everything.... 11) Apply power. Adjust R4 and R6 to center the display. If the width is too large then decrease R7. After center ing the display, if some characters lose dots you may have to change IC-22. Ugh!!! Some surplus 2513 characters are not fast enough. Happy Computing, Gary Alevy 1056 Fifth Avenue New York, NY 10028
February, 1977
T H E T R E N T O N C O M P U T E R F E S T IV A L R ID E S A G A IN IN NEW JE R S E Y ! The Trenton C om puter Festival (TCF), the originator of amateur computer fests, will happen again, on April 31 — May 1, 1977. The second annual TCF will be bigger and better than the original. It is being expanded to two full days, with new and larger facilities to house up to 90 exhibitors. There will be 30 speakers and demonstrations galore. There will be hundreds of door prizes and a huge outdoor flea market. Computer conference sections and forums are planned on the following topics: Microcomputers for home, radio amateurs, education and medicine; consumer applications of microproces sors; computer music; robots; graphics; speech synthesis; estab lishing amateur computer standards; computer club convention. It is expected that attendance will exceed 3,000. There will be amateur computing contests and awards, Saturday night awards banquet, programming copying service, forum audio cassette copying service, free bus service between hotels/motels and fest, activities for wives and kids, and free parking for up to 4,000 cars. TCF-77 is being sponsored by: Amateur Computer Group' of New Jersey, Philadelphia Area Computer Society, Trenton State College Digital Computer Society, Institute of Electrical & Electronic Engineers-Princeton Section and the Department of Engineering Technology, Trenton State College.
Copyright 1976
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 29
99
An 8 0 8 0 Disassembler with exquisite documentation PLUS 1. Details about how to get it on your cassette tape fo r 59 • H p TT w O VO x • p T rH m H rH » • c w 0 P CO H CO 0 VO Q
C\ rH * r> rH >1 u d a u -2 3 Cn
u (I) rH •§ g 01 to d 10 •H Q E CT c •H u 3 >4-1 >4-1 0 0) p p 3 H in •• ••
y
X
Page 30
100
£3 o
O 73 0) M (U x c 4 J GJ U p d 3 £ H +■> 3 u •H 0 0 W • 0 » M 4-1 4J ■U V4 •H to 1 a to o a> s H to CO tO X -H to d rH > , u to -H x d W C 0) d 3 a CO >1 to M •H E rH a , •H 4J d 73 3 44 3 •H 3 Q) > 1 ^ c r 3 -h -h c cn H d E 0 G •H u 4-i 3 c a d ^ «* CJ 0 M d 3 .4 -1 P — d u 3 0 c r c s .g O 0 u > -n d C H 3 M d ■H ^ cn p a P £ 0 c 0 d rH to > 3 •H d P . •p +J 0 •H X •H 10 O M to 3 P 3 C 0 n rH U >> 0 CO G -H tO j a o 0 (U-H CJ 3 U 3 u 03 to P MJ rH M 3 H u a) W M 0 3 0 03 0 p d CA to EH to 4-1 to d 3 3 ■p M 0 G to 0 73 •H 0 U 0 d c >i -3 a c 3 +J CO ^4 33 Vh CO H 3 > H \ & G 3 0 W s 2 •H 0) 0 73 ■H ~ (1) 0) 44 rH rH d tO 4J . 3 P Ul > i-U rH fc 03 X 0^3 rH d ■H ,3 3 H 10 . 3 X 4-J •H 0 II 0 0 5 T3 ■H X • m ' j co 5 3 3 .3 X 3 0 d a u O 5 3 rH i—i ' » -a * A to d < H •H c 0 73 o 3 X H 3 H 4J 0) H •H X o d a d co p P X 73 3 X Zii o d 3 X d u ^ H CO •H frj 3 U JZ 3 0) 3 •H ^ 3 U d ■-« 0 *3 H O d J 3 ■H 33 0 M
V4 a) v 3 a* £ 0 u
O
CO • •H to r; o d a, d E •u d 0 a \ x: U M +j
to V4 - a rH G) P c 3 . G) c 0 JC d 5 E x: 3 J P E 3 d V4 p p w d >1 0 U to u 3 ,3 to • 4J c 0 •H 0 •H > if^ 'O rH X p 3 3 x: 3 • d 3 C xx to W d A J-i p •H P C t/> rH 0 T3 3 o » 3 >1 P to M d 3 r4 - 3 < 0 3 •H >-( • P V4 c 2L, 0 c u rH d X d U-( d p •H d V4 C\ •H d «H MH QJ V4 E 3 X • 0 « to •H 3 3 CT r; d 0 ^ 04 QJ y O V4 d CP CO •H 3 P rH 3 d VO u 3 J J .3 3 rH G p > v H •H ►3 d xx -3 rH rH a rH V4 u u +3 E 3 VM C rH 3 Q rH n i—i • •H d 3 •H 0 < , QJ M 0 *H u ^4 p 5 d G 2 U-l rH V4 3 d M d • 0 +j 3 d 3 U ^3 c P >1-*J CO CO « P c 0 C 3 0 i-4 *4-) d c 0 0 CO •H p . 3 •H 3 d c 0 c r u 3 to C/1 E •H 0 d 5 ^4 u o u CO •fc U p ^4 J3 >1 ~ rH to a 3 x: > .P rH O' 0 •H Q, rH UH •H to rH to q J UH 0 rH GJ •P < Q r* 'J u to 3 £ Q c 0 34 H ■H £ 3 3 0 a 0 3 rH u •H 3 VO CO • 5 0 CO •H P CO •sr M .3 d • P d d 0 d 3 CO 'O • • p ■—i 4J •H O T3 0 CO CO CO 3 p p G H *4H ■H U G d 0 0 .3 M T3 3 a rH E •H > * U P rH d • •H * 0) 3 m GJ 3 W 3 m U t h ^ ; rr 3 3 5 yi 0 2* y o xz 3 m GJ ' J +3 'T rH p CO !3 6) CO d H P •H 3 •H *3 p ^4 3 to •H 0 c 5 3 • 0 0 3 -H 3 ■H 3 u ” W • a Cm • e-< 3: 3 g ,3 § 24 3 rH CO y o u O' CU-rA 0 P d c; H d 3 s < d P G 4J a V4 "3 •H p 3 3 3 •3 H CO » U-4 3 0 d 0 CO y s rH U P 3 - 3 rH _3 GJ 0 o 3: o i—1 "3 0 rH 'J •» U V4 3 d 3 "J) < >4-1 S I J X c, CO rH * ' J A y U P 0 p >. •—1 3 u d •H •H 3 d E 3 • *• 3 a 0 3 £-4 "3 P 3 *■ u CO P U Eh CO 4J P 3 d P 4J 'vO •H d 3 p 3 3 3 ? 'SI 3 3 > a 'J3 3 0 P > JZ •H 3 P V) P H J-i u 3 3 P 3 •J) 3 CO -3 a 0 3 Z~* 3 3 H ^4 •H d to P -3 d 3 cm
m
u 3 xx u
d M
P G • d P 5 3 to 0 H a T3 rH
>. E "3 3 sx to •H rH A
3
04 3 0 >. G 3 XX
T3 3 CO d
3 0 >1 to G 0 •H P CO 3 3 tJ1 3 ,3 P U 3 to 3 d 3
c r m m CO G P d 3 3 >1 i z d d d ”3 rH to >1 3 33 3 to E-» 44 p d G d XXXX 03 3 3 3 QJ rH •H P X G •H •H M 3 rH rH rH X Eh P to •H d •H P d p 3 M •H rH d G 3 "3 S P p 3 3 33 33 • • K* •H CO G H d to I p d 33 d d 3 p 3 ^ CO V4 p u V4 3 >1 33 0 3 3 5 « E CO E G rH £ 3 0< .U h -H W 3 •H 3 0 d 3 c r to 3 3 3 3 3 d * P p to rH 3 XX CO 73 3 >H x P ^3 a G "3 rH O'. 4J •>•H •H 3 3 3 •H > .p CO d 3 3 P • » H 2 H u d G 3 CO CO 3 3 3 P ^ 3 d CO U d 3 •H CO V4 \ p ^ 33 X 3 p 3 i 5-1 3 3 G d p d to O ' X • 3 V4 3 P 3 cr 3 ”3 P 3 •H tO -H d 3 XX xx >1 3 P 3 G P 3 • u 0 m rH 3 3 73 3 > 3 p a G P 3 3 3 3 •H P P d —' *3 04 3 P H 3 U £ • *3 CO 3 -H ^4 3 73 rH 0 •H 3 3 O ' 3 (N to d d to 3 Q4 u >. X X J 3 C 3 3 >1 3 3 ^ «■ « TJ O P rH >1 4J O CO * d ■H O4 3 V4 < >1 3 G > i IJH c r 3 cn rH u •H 3 5 •H >1 3 < Eh 3 •H 3 x to e 3 rH rH 3 P P H d G 3 Oi 3 5 -H 3 ^4 rH d 3 0 •H rH 3 P a P H M > *3 P 3 3 r : •H d d 3 d rH 04 *4H to 1 •h p d G 3 , 3 c r 0 U 73 rH • P 3 d 73 3 E J-i d P rH 3 O 4C cr 3 E 3 3 3 to cr d E 3 E 3 •H 3 G u 5 d » H H C 3 •H 3 3 -H •H •H CO • T3 d 3 x: 3 G -H 3 tO to 33 3 > ." 3 E E 3 3 P 3 to «> M 3 •H 5 to 3 3 U4 3 H d rH 3 d to U E G P P •H 3 P 3 3 • rX 3 E •H d d 3 U u \ JG 0 4 ^ CO G G G 3 £ 4-1 cr- to •H CO — CO ^ 3 P O 43 CO •H d 0 > ? G > 3 to u p d r : m -h 3 3 P d •H C d d X 3 d 3 3 3 3 3 44 V4 0 P rH rH U U CO Ot 5 to 5 U Oi • 73 ‘H J3 d xx H 3 3 3 •H G 3 3 3 3 •H X CM P O4> . •H ** XX QJ QJ J-( d £ U *> P G IH d w vo 3 — "3 CO P j a 73 U d rH 3 d d V 4 G X O X 3 E 12 d P c r w •H P 3 >i O. 3 -H 3 •H P V£> 14-1 P P 14 rH k jX 3 G Eh -3 co >1 5 J3 3 QJ 04 G P E ^ •H V-i P s •H u 3 •H M C P O P n o 3 3 b P 3 to >1 rH CN U •j H 3 ”3 G C UH 0 p r; O 4-4 •H 3 3 3 0 3 d 3 co P » 3 _3 d P 3 to cr d 3 p 3 r3 3 U 3 rH CO d rH •H 3 3 XX •H 3 d 3 P —' cr5 3 p 3 c u 3 3 u P P 73 •H 3 •H X -H U-l u P Cr 3 3 P 3 c 3 c ' a U 31 CO 'w 3 U d •H 3 H4 • d XX • G c r C O 3 d 33 G 4-4 •H >H 3 d 3 d P X U •3 •H ,3 3 3 3 Vh a 03 5 O G 3 •H 5 d 3 "3 CO 3 d n •H 3 •H • rH • P d 3 XX p CO •H O l 3 0 3 h: 3 P G ^4 4-1 3 2 CO w u rH h : G P d •H O., UJ < 44 4-> *. • 3 U "3 •H 3 u 3 M % • •H fO H u ^ 0 +J 5 )0 U 0 V (ZJ u fO X 0 _ M 2 H 'd H 3 QJ rH to ^3 3 2 3 3 < p in d to 'O 3 •H C*. -* 73 H G u •H 04 IQ •H •H 0 >1 2 in to 4J M ZJ 4J 3 r - 1 ___ l o 3 V4 • 3 . p 3 G :r "3 d 3 U U O 43 "3 d -3 d 3 g p m j j u-4 3 _ E 3 d 3 Vh 3 3 d 3 3 d 3 4J U d P d O % , 4 d c rH d U P C > >1 to u 0 n I 73 U 31 •H 3 CO >1 5 • xx 3 3 G d P 3 UH 3 34 3 P XX n Tl •H 3 rn CU V4 *H P • G 04- h 2L, H CO d c r P -H 3 p p p x 3 •r4 rH d 5 to ^4 c r u d CJ to •H p ■H 3 ^3 a H •3 3 3 P ja O' 3 O 4d > , h 0 ■H !> rH 31 rH 3 3 3 3 •ri •H P CO XX O 4d 3 G 3 rH O t P rH 5 4J n 33 O ' 44 u •H 3 T3 d E G V4 c r 3 V4 •H 3 U-i 0 d 3 0 >4H P CO 3 u 1 3 3 CO ,3 H 3 3 -U 3 G 3 P 3 d G P -H 33 P "3 3 0 5 4J r3 UH P 3 3 3 U CO >1 • *3 •H •H 3 > 3 3 - IH 3 3 W d 44 3 3 m sMH 3 c 3 73 d rH p d d 1—1 U 3 d >1 3 33 P ^1 •H 3 U-l G 3 — 0 M V4 U 4-1 d 3 3 3* co O 4P « 4J 3 3 3 P 3 d 3 X d "3 CO d P ^4 s 3 p d 3 3 3 Jh 3 ^5 3 •H d d CO Eh 0 rz 3 S-4 a CO ,3 H .0 d CO P 73 to 3 3 E 4J d U H •H d •H rH d >1 P U CO 3 3 ^4 O U 0 3 3 >, 1o d P 3 / 3 -3 3 d 3 3 d 3 rH rH •H d d E 3 d > P H • CO co ■H V4 3 -j 4 J ^ >> 3 O "3 CO •H G *■ U4 H _a 3 d •H E ** H d — P •H 3 •H d d >1 > , CO *3 M 3 4J ■Ji 3 33 3 3 « • 7* 3 3 >■4 P ■3 iw 3 3 P d -h J-i p H rH n, ,3 3 3 d 3 3 3 -1 ■H 0 33 Hi 3 3 • 3 3 P frg 2 = • 4-> P •H •3 O r-l •> 5 31 P 3 P cr U — 3 3 3> U-« rH -3 3 •—( d d CO 3 3 cr 3 3 p Ti '3 . 3 M 0. .. -« •H p P *4H 3 'H CO CJ 3 H 3 P 3 31 d 1 u
a;
— o 3
3 0
0 a
r3 0 0
% u 0
^4 . d u U l i q) cr! ^ n C O 0 0 p 0 C 0 > 3 E tn 0 P u d rH P f— i d "H x: m d 73 rH 0 C J X3 JZ P 3 d 3< 0 0 Li to E 3 0 Q JW C J rH d •H E 0 u to to c p in C J tr»_o 0 0 P G 5 OP to X G rj C to 0 0 d • O-H 0 •H o o G G 73 0 73 73 C O 0 G J V 4 Li C 3 0 m 7373 C O.H C N d d 0 x: 73 G U d P o JZ p p to d d 0 0 p 0 5 73 •H O ^4 C O 0 3>U 0 rH IT P d jj 0 p d > *■G 3 •H ra C O * p 0 a h J4 < W 2 •H u 3 0 C OE E 5 c 0 ■H o 73 0 0 p d ii, 73 Li H to P j G3P d p 0 d to d 0 3 p P m 3 0 Li >1 ^ J ■n p 0 •H to 0 CTQ 34 -2 G •H ■H4-1 0 < *• E 0 P Li rH 073 3> CT73 d > 3 5 0 *3 0 G d ( u 73 0 G 1— 1-H O' d d JZ O-3 to Li jJ LI • 0 0 to U rH 2 to 0 Li . u V4 •H u G 0 CJ-H G d i> d C4 34 0 0 0 Ch 4-1 E O O 3> 0 >i P •H W 3 0 G5 p C J d Li JZ d 0 34 Li C J O J T3 ca p « 0) 0 E >i C ^ ^ P p c J4 tO 3 3 0 0 0 0 3 ■/ o O 0 to C-h 2 p p 0 p G to 0 > a w> d G to 0 •H •H 0 to n d Li x) C ! u 2 a 0 M co d •H H p 5 • Li to 5 34 H rH 0 Li O4 -H ^ 73 0 • • 0 G O ■30 a d u H P Wp P m 4-1 rH X\ '~1 0 G, 3 0 G d to 0 ^ 0 p •H •H p E G h 'J >i 3> tn h 2) -h • O4-1 to -a 73 0 O P 5 p C c d 3 V 4 to co M r5 0 rH to :4 o C O •H >i,G -3 0 o u to P to •* to P ___ 53 p d J4 r•H 4-1 3 2 r. p tn H u d tN 0 •H 0 0 d 5 W C O _G 0 p 0 p .3 to O a. to 3 Q C O3i •H P C O0 O > i3 ** < to •H •H P 0 0 u to 0 G p d —.2 tH H •H 0 73 0 :o 5 5 f'- d a d P O G > •H p d P p 34 G 5 4H G to d co d 3^ C ■H Li •H 0 0 0 0 ^ O , ■H 34 Li Li W 2 u 73 4-i G ) p 3,3 J3 C O *3 0 *4-1 G 0 >i 0 0 yj •H sz G P P 2 H D 5 U —0 _G G U to 073 2 d d 0 •H >3C ) G P u 0 0 G •H OH « •> •H 3 0 p 73 to 'h r3J4 P 0 5 to
February, 1977
H > 1 II S P O£ \ 3 CP\ 3 E a o dou j ^ u o. 0 d d o >i 3 H ^ >, S3 d h o -a 0) 0.^ d l+-i •H c 0 o 'W-H O u Q) * 10 \ P •H P M U J M PH d O JZ p P d ^ 34 0: OHO P ‘M H 'O X 0 rH W • d d co h 'O 3 ;H 0 p P oo to to cn,c c 3 d O •H c 3 p -H 0 to o H H -H P JS 'O ^ 0 3 5 0 A t^'O d to o >10 E C C E 3 k ‘ o IP G) to •h d d S JZ 5 p u u \ ■P P CO 0 * G 0 O 0, d < Vj sZ Q Si ^ U JZ 3< O 34 0 - S M IDH ^ C to G) d H 34 0 d * 73 U .3 o to d p to d p o o 0 P o ^ w p p W i o o OK 3 P 3 •H 3 Di P q; H O Cn «h E 0 £ E *H G o d -H 0 p 5 QJ >. O gp P P oP -H d -H w o to OP > iH > d 3 Cr> 0 >i£a •h ^ w r: u > , Q P d ^3 3^ o 2 0 3 2 iu *4H-H d ■ 3 0 0 > i 0 P •H 3 ^ M rH W )p d d >, o to o d o p ^ p > o u ^ o -h to O P H H H o O J3 H 4J -H M P M P 34 ”3 to 0 d o 33 0 u QJ in 3 ra a u GJ zz. o 0 4-1 X —1 4-JJra X T3 in 4J a r—G•— JZ L. X CO CJ X •—— 5 4-J 3 c CO QJ o m JCO o o
P p P • to r j G 3^ V 4 -X I . 0 3 0 0 G 0 p H H •H 0 •H P 0 d G 0 U >3 0 3 •H 3 O 2 P X 3 0 H Ll 0 3 0 0 G H 0 to 0 0 P ► 4 H 0 P d 3 0 • 0 0 3 2 34.3-H p 0 0 UC O 0 > 0 G 34 2 C 3 G p P Ll r-i 0 P G 0 > ,P 04H 0 2 P 0 4-1 0 3 ~ 0 0 3 •H 0 P P-H JZ •H 4-1 > 0 to G 3 jZ 0 d •H C O 3 • 0 0 0 p p to 0 0 P 0 a: P 3^ 0 r-i Li *“ X JZ H Li 3 d H G 3 0 G0 C O cii M P4 G 0 •H C Si 0 C Od u dH 3 G d - •rvH • 3 0 0 12 3^ 3^X3 d 34 u -H n P 0 4-J 0 •H Ll 10 to 4-1 to G cr 0 JZ Si x? x; x: j Z to Li d Li 0 0 3< 0 •H 3 G G 0 p p 0 O to •H G 4 1 d 3 4 d •H M O O •H •H p x d 0 G P J to i 2 3 0 p G 3 r— Li 73 Ll 3 xi a •H G 0 0 H 3 U 73 H 0 > ■H 3 p P p O' 0 P 3 Ll •H G p •H O' u Li 0 0 •H P tT' O 7 Ll 3 •H d P 0 0 Lj P £4 Oi G 3 d to •H G G d 4-1 4-1 0 0 3 3 Ll H JZ O •H W -H d 0 x: 0 d p d 0, to JZ C ,G 4-1 JZ X P Op 0 O' U 44 s i 31 x: 4-1 •H >1 P O JJ Si 3: 3 to P G 34 G P H •H •H M 3 x: co /3 3 d 0 0 C 0 Li s 2 0 •H O Ll • p to JZ p 12 d > O 3 Ll -H P p O' d G 73 Li 4-1 Ll L< • „G to 3 d 0 •H •H • 3 >1 ■H 0 P G 3 w d 0 P 0 3 jZ p 3 » H O 0 * d g P 0 to •H E 3 •H 0 •H G to Ll G 0 0 2 G OJ O P 0 44 •H to >. 0 C -3 Ll p P 4 0 0 d V 0 H O 0 2 O P 3 HH 1) p C O * OU 2 44 t*H u to U H Ll 3> 0 IN 3 O .O P H 3 P 0 0 0 C 4-1 44 Ll p 0 O d Li G 3 G 0 d 3 d to r3 G P d •H U 0 0 Ll G 0 3 C G HH 0 H O03 d 0 •H 0 - H H P •H O 0 H P d to 3 Z 4 •H to 3» d D O-H O 0 P C C O G G 0 0 G 3> x,* to P 3 0 p H •H 0 •H ■t. H d G G d to to P C H•H 3 H Ll 3 •H 04 Ll p h 0 w I •H d-H 2 •H to d • P p a P H 0 G G to O 3 JZ 0 7 3 Oi •H 0 0 C O34 H 3 3 0 0 •H P 4J M 0 O 0 0 0 d 0 0 O U H 73 > d 3 P 3 -H 3 4-1 0 Li G d M ■UH ■H •H •H P d 3 3 P tO O' 4-> ra u-i ■H to P H 7 0 d g to 4-1 C O-M 4-i 0 H Ll 3 2 to • 0 0 4 o V 4 G 0 J*£ 0 >. 0 0 V d 4-1 Ll Ll 0 d G H o> P •H to 0 u -3 3 2 3 r-i •H P 0 G u 0 jZ 3 0 343 H 3 •H 0 0 d Ll 0 Cfl to 3 Ll M 1—1 to H 4 •H 44 0 3 V G O 4-i \ H 3 h "ll G Ll •H d p p d 0 P < -3 Li d 3 V 0 0 0 p •H 0 P V 4 •H 0 2 HG3 >. 0 to p H to to 3 3 O' > 7 3 3 C h - 0 P G O 04 3 G < d P >1 d G •H 0 -3 0 •H > 0 d •» H 3 p '— G u 0 3 »• •H Ll •H 0 3 0 d •H H Ll ^3 0 0 Si P H C P OG 0 0 U G 3 3 • ,7 H H •H d •H 3> U 7 to M G-H 3 3>U G P 3* p Ll 3 4 ■H d 0 V G to 0 G G 1 3 G C O 3 d •H 2 0 0 G O' 3 p •H 3 c < C P 2 0 H Pi C O d 3 C O .3 d C r> G •H 33 0. G d >1 3 G H 0 72 3> d 0 P 'J 0 •H 4P M H to 0 V 3 G V 4 0 Ll H 3 G 3 3 x: 0 O 2 ^ 0 > O' J) d ZLi £-3 p 3 to H 0 O 0 0 G 0 u G 0 0 H r j 3 Li L-3 •H Li Li •H co 0 d •H C O Li Li E W 0 § -‘ 4 H 34 3444 ■H •H G4 3 H C O 4-1 4H-3 3 3 [4 d
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 31
101
*-> > 3 u - ro
a
a .a
.
(Li in
v_ i_ o > xX •— T J 4-» x oj — E— 3 01 XI in E *3 w a iu
O — >
w U
01
ro in c
in in —
3
O
r
3
W
f- c a OJ in
I C C C3
X
o ro o
E 3
tu > - 3
X 3
■ — ■— 2
a O o c
—
>
3 03 x— C — — c »— — to 4-» in — 03 M- O u — c c ro in *-* -3 in roro a in -— to — u ro — C3X — 3 a in o 03 ' i_4J "O O E 3 - v_
0 O
4-J
in *-*
2 »tc — ro c x«4— 4-j n o 5 — o -a O w — O -3 »— 4-J C o "3 ro «4- TJ 03 a 4-1 in — u c in TJ fD 2 ro 03 .3 0 CL X O in v. 03 to . 3x a *j c -E a 03 xi to E O x ro 1 m w w u bO io ro % — i_a .— o» o a o — x f-H x x e E ro > a in > +-» in x a in *-*W 03 03 □ x x be w w w c E in ro i_ »+- bO in i-— o c D bflv+- — O w w ■a u l . 03 3 03 ro *a w x a 03 03 *-* -3 x 4-1 03 03 h - 14- — 3 O "3 C in 03 — i_ w • 03 O C 03 *4-X 4J O — — E u X 03 3 (O m c 3 c 4-» 4-* O 03 — 03> X >— > 4-*
— ra «tj o w ro -O . X - o in *-> —xi E r- +J 03 "O o 03 a> > in a; o bO 0) a. ro x c o in D C OJ (O 13— -Q > id nj fD oj — x a- aj — -2 C > 3 tO r E ^ u ro E W QJ (0 0) E w .D T 3 W □ x -a — d — 14- C 3 3 u •m bO X 4J 4-J W ■a 03 ro 3 in 03 T J 03 O m ' a i_— wj u o ro •u a x > c o i - in x in — xx — 3 OJ h- < — ft) X > 5s-a 03 X 03 3 ax E t j in bOX X 3 3 3 3 3 -3 -3 03 0 3 E ** in « c C - 03 — X O u m- in in in -----•* —-» 03 4 -J X O •— >— ’ — ^ 4-1 0) * 13 C 0 ^ 3 in 0 X ■ I o O ~ C 4- *— tfl < 0 i_ 4 J ^ L bS ID § -3 — in 3 C iM— — 03 3 — c c i E — a> in T) > 01 o — -3 — in ro a) in o a r a yi C O X 3 C +■» » co — *J 03 E .M- < w X — bfl to 3 *— O
a u)
4-> d n
□ E v. c a; a o
—
in
4_>
— in — O — *-* in *-> > 3 in ro 3 ro x x in x u . ro a — .— in r- in -a i a in c— _ -u : E a a i ro 1- •*-* % fO o X "O 0) C D E * OJ-OI1 — a I 3 Hi*. U L in o
bfl v "O C > 0) c — •— Q. fO 4-J-Q O
3 tj
in
V03
> r- —
3
in
X 4J 4-» E 03 in u in n in 3 u a 0 3 143 X 3 4-J ca 0 1 0 c 3 X X "3 ro 3 c 4-* 4J 0 ro L. 4-J 0 3 u C 3 x E 3 L> t o 4-J in in in c 3 in
in C J / r— 3 ro 3 O 0 x X O x 4-J 2 *— E > 3 X in in E x ro ro 0 c in in 3 r— -3 X < c 4-J »— _ ro 3 L_ c x 0 • 3 ro X ■— E c a >. 0 0 -3 in c 4_l c 3 c bfl 3 0 O — >4- - 3 C 3 i— c ■3 4-1 O *4— 0 c in 3 — a L_ in c 0 4J -3 3 a in C U in c ro l_ 3 L- 3 0 X O L. X 0 4-J 3 3 4-J 3 3 3 > «— X 03 U - X ro 4-J > X O 4-J 4J ro X c 3 r— bfl 3 1. in 3 C x a . 3 X ■3 ro 4-1 3 X C ro X L_ 4-* 3 ro "3 — i3 C X 3 3 03 C 3 a ro a O 14- 4-J bfl 3 4-J 0
3
— rH O
Page 32
102
O 4-J
•
c
in
—
ro
4-» —
OJ U 03 l 3 O — U ro > i_
in
o —
X
E
> ro
03 X 4-J
V3-3 C 03 ro in X 03 4-*
03 ro
o o X
I O w V.
x
x
-a
O 3
x ro 2 c
3
U 03 4-» ■3 — U 03 03 in io l bfi x • 3 X a O in 03 4-» ^ b f lj
X
U •
. 0 3 —
I C O 4J I o—
ca
E ro ro X in 3 C c O L. o ro 0 4J LJL -3 1— c 3 o u • o -3 3 ro Li_ 03 X 3 v_ ca ro 3 ca in in in ro c > in 3 X xr~ — — x 3 h- • 3 4-J X
0 4J
u 4-J 3 ro 3 *-* 4-» in 3 E O 3 ro
X i- 3 4-J bflX O 4J X i_ 1— Cl X ■3 o i3 *-» in c 3 3 X o o 4-J U-
•—
in ■ 3 0) > *4- C •— O ro 3
x C3 o XT 4-* — •— h2 < in oc LU Q. 3 O in c 3 CC in LU -J CO 3 21 X LU 4-» CO CO
z: o L PD 03 C "3 • CO — — i_ . 0303 bO v. ro ccs x : oi l l ~ c 03 4-» E C - — 33 o w m4J a) o / X 4-» 4-» i_ ro • in ~3 — E c m bfl o> x E l u in 03 4 J 1 0) — C 4-1 oj 03 a _ —jro c in 4-1 01 in c. 4-* 3 in X X CU o LI- •— — c M t— l- — X 3 3 3 L- ro 3 4-< 10- o in c 4-* -3 in 03 X •— L_ ro "3 4J 03 X 0 in 4-J 4-J 3 E c o >-3 4J — in ro 3 O X 3 c X ro -3 — E3 0 3 4-*CO 2 in O 3 •4— C O ro ■3 • 3 4 J L-O E 3 X >o c CO bfl o X CO O 14- 3 3 3 X 4-1 •3 c 03 14•— X o 3 3 a 01 N in 4-> X 4-» C 4J h00 c c C 3 0 XW •— -3 4-* ro •— 3 in 3 x hro "3 •— -3 — 3 4-J z z Cw ro ro t c 3 ■ 3 x •— X E 3 LU •w CX ro 3 >» 3 C U in S i_ o in in 2 4-J c •4—-J E /—s bfl4-> 0 a 3 i_ 3 S O Z in in 0 0 •— m E 4-1 3 4-* in -3 0 x c in 3 X c o 4-1 ~T •— in 4-1 LU — c: X ro •— 3 3 3 in o 4-1—. LU t_ E o c c LU 4-J E C X 4-J ■M > i_ C bfl 3 3 in •— —I-3 3Z 3 •— 0 — -3 14- 3 in — O O 3 •— X 3 in l u X 3 u. ro o x — Li- 4-J «*- L_ X in "3
in
x ^ u ro z: — — *2 O 03 l_ C *-»*-».— u c ro o x 4- u c
4J 3 3 in X •— 3 »4E
1 LU —I __ Li-
in
} 4-* l/l ro ) — in - in x
—
3
-3
> X
— 03 -3 C a o m c X 3 ro X X < p— r— c 4-J X ca 2 X ro in x x E L- ro
in m c O •— 4J V. u 0 3 4-1 \_ ro 4J L_ in 3 c
E 3 ro E L•— 4-J bfl O l_ Q. •— Va O 3 V- a 3 3 0 X 3 »— V4-J X X a 4-1 E 143 3 in X O in in 4-J •— ro 3 4-J 4-J •— c ro L_ in 3 2 •— 03 in 3 X 2 bfl L. H 4-< C 3 i_ X 4J 4-J O •-% 3 3 ro in 4U in E 3 ro x •— x ro 0 4J u 4-J c 4-J 3 •— 3 •— L_ 2 i_ 5 •— in 03 in fl 4-» V c 4-J — > — — 2 v_ bfl 3 c c 4-J ro 3 c x — 3
0
V- Z) bfl CC O 03
in
u ro ( rH 10—
O—
w
— v 03
— (0
14-
< i
x
r~ . in _ ro 3 in i03 ro — O 4-J 3 4-J X — o X 03 ■ 4-* i_ •_ 4-J ro 4-* in in 4-4 >s V. ro > ro 2 -- X > X 14- in 3 X ^ C 03 in •3 — X bfl 3 > E 2 3 CN 4-J ro 3 O ro 4-» C 03 j* . 4-* in o 4-J 3 > .x in — in 03 C 14- 4-J c o in 4J X > ro x in 3 o o ._ ■ —X in in u in r— M— 04 3 •— *j 4J -o 3 in 3 in ro 3 X 3 l_ > r~ 3 4-J X c m 03 E E r~ 03 w 4-» V- ro 4-J k. 4-» -C X V- 3 X > o i- 3 X *4— bfl*4- > 3 O C -3- 2 m in O- 3 N — L. C — — 3 CNJ 4-J 3 2 3 4-J — i- • • ro o X m u x ) X in •— 4-J ro co "3 1 i. ■3 c r— 4-J— i— < ro r— 4-J 03 0 in «42 •— o _i k_ X in in c • — ro o 3 3 c — 4-J 03 E CO in X — U- c •4- 4-J 03 3
o 03 X X J03
•• LU QC 3 Q LU 0 0 CC
CL >—1 CO UJ CO co < to
0 < a LU Z LU O
4-J C 3 3 x in a ro 4J O > in O "3 O ■3 2 4-1 «— ro in X in ro _ 3 3 c in x 3 •3 X 3 3 ■3 0 *4in 3 L- 2 C 4-J ro in 3 3 ro •— ro L_ ro X m X ro 4-J . 3 c 3 ro in C a 3 "3 3 c c 3 bfl in in 0 O bfl H in _ ro X X 4-J 3 O c — 2 4-» 00 4-J < L_ r— — > 2 4-J X 4-J ,— 4-J 3 Lro 3 in __ 3 x. 4J c 2 c c 4-* 4-* ro ■3 > f— 2 bfl X to in 4-J in in X c ■3 u ro X ■3 — E tc 3 3 O O ro L_ in -3 CO r — 3 L1- TJ l l Q X X V 4-J __ E \0 c 4-J 0 O ro 3 ro 3 u i_ in • 3 in • 3 ro 3 a 3 in 3 a a CL L_ in ro > 4-J — 3 0 3 ro 3 ro 4-j 4-J 4-J u in O 3 3 ro 3 c X 3 c 2 a L>* 3 143 0 0 4-J M. mm L- bfl. ■3 m O 3 x 0 3 X X 2 0 4-J X > • 3 r— ro X c X r— 3 r-m in in -J 3 X 3 in s •— E 0 ro 2 > L. 2 C ro 3 ro 0 O > in c 3 in O — 2 m 4-J 4-J c ro V. X 4-J 0 14— 3 3 E in u3 4-J - 3 3 3 > r— in 3 4-J 0 M O w X 3 in in 3 ~r~ " 3 in 0 3 ro i_ ro u CO 3 c 3 4-J 0 i_ — ro in 3 > 4-J in 3 2 — 4-J 3 c — 4-* " 3 ro E 3 3 C *3 ro 4-J 3 w— L. X 3 P bfl 3 L_ O ro L— 3 2 3 > 3 O V. X 0 in C c 4-J a 2 3 P 3
*J C > V- L- X 14- c bfl > in ro 0 O 0 3 O 0 C .— •— L_ 3 2 u- 3 4-J 3 to #-x in w —1 bfl 3 X 3 14- >.
x in C 3 in 3 - j L- O — i_ L- 4-J 4-J ro > 3 O 4-» in 3 >— 0 a 4-j in c O r— •— X XE a w ro " 3 4-J 2 3 ro r — •— in L— ro 5 • in x ro 3 03 O 3 in in 3 f— CN ro 3 i- 4-J bfl 3 c 'C N bfl 4J 03 *H — OJ 4-J in 4-J CO 4-J O •— 3 < •— T~ E - 3 in 14— 0 • 3 ■3 /-X 3 > ro ro bfl 3 X 4-J 3 L- 3 in ■3 r-H X ro L_ 3 J- — X c to X CO ro T J TJ E •• 4-J ro c 3 3 0 in X in 2 2 — bfl 0 in U > 0 — U 0 0 c in ro 3 ro 2 •—v — in r— 2 0 »— CO _ X -3 ro L- O < V. 14ro -3 E m 3 0 3 3 0 •X • in in 0 in 0 ro lu x • X 4-J iin ■3 ro ro u £3 3 in in ro 3 C 14- c ro 0 L_ > in ro c 14- 3 ro > — > ro X O 3 2 TJ T~ X 4-J 3 c ro ■3 3 3 3 4-J L- 03 3 in w 3 3 4-* 3 in 3 ro 3 N c 4J 4-J 2 •3 0 3 ro 3 V. 4-J C > a a 4-* in 4-J 03 *4— bfl 4-j — in c in 3 3 3 •— c 3 X 4-J X O O 3 4-1 •— C 3 3 •— ro 3 3 i- 4-J >* c 3 < ro in L_ 4-J 3 3 TJ Q_ 3 3 " 3 in a 3 in ro 3 c 3 > in O 3 in c a x — V- 3 ro X in 3 03 14X 0 3 4-J 4-» X 4-J 1 0 — 3 14- i- ro O ro in in ro 4-J ro 3 3 in a L. 3 4J ro •— X 3 0 ro E 3 3 ro in X TJ in 4-J ro 3 in 4-J L_ . — 03 " 3 ro X 2 fO 4-J 0 0 3 ro r -3
3 ro ro L- X 4-J bfl E ro E
O 3 i— in a in ro in 3 X TJ 4-J 3 0 c >.
TJ
in ro 3 L- E ro 3 X 4-J in ro 3 3 in L. 3 ro -3 ro c 4-J ro ro ■3 x C 3 2 X O 4-J ■3
x 3 4-J •— 2 in
3 L. 3 x 2 TJ 3 C E u 3 4-J 3 "3 3 > ro X 3 0 > C 3
LO 14a 3
3 in • c in 3 3 in 4-J O ca c 0 L_ 3 3 x 0 4J >
c c i_ O E 3 4-» *u 3 X 3 4-J x in 3 ro E -Q 3 4-J 4-J x m L. in c 0 2 X H 4-J 3 % ■3 3 • L_ 3 C 4-J in X ro c 3 bfl •— in ro L_ in ro E 0 m to 14L- 3 bfl C 0 2 V- O bfl a -3 C 3 TJ 3 X c X 4-» ro
^-x O — X bfl O X I - C > bfl C 4-1 14CC • — — c •— >
3 >
• — C_)
2 x •— 0J CO O E 4-J bfl CJ UJ — ro CO LU ro 4-1 in O in 2 0 bfl c CO C ro 3 ro m- ro LU 3 •— X 3 in bfl 4-J i_ X 03 144J 3 3 X 0 bfl 3 c ro L. in 3 X 4-J C •— x 3 >* c in 4-J •— •— c c TJ c 3 X 4-J x X 0 3 ro — — 3 X O 3 3 E 3 3 c 3 JZ — 4-J 3 4-J > in ro •— to LU a C in > E ci- 0 •— — •— 3 ro 3 >2 in C T J in 1•— O — 3 3 >. X 4_> _1 X 3 in 3 E TJ - J 4-J 2A 3 in 0 in X c in 3 in ro > < X 01 *4— ro O 3 > 1 - 3 in in 4-» X E — > C x-* ro ro in 3 ro V- 4-J X 3 3 X 3 in • in L. 0 — 3 — a »4- 2 > 2Z C 3 in in ro O — 0 3 3 3 x > 4-» > u •— 3 4-J 3 L_ in a — 3 3 •— ro a 3 3 O X •- i 3 > 3 C > L. TJ bo 3 3 in > . bfl 4-J c c — TJ c O 4J c 3 3 •— 3
E L. O «4QJ r—
bfl O .—
O C
O CJ
1—
L.
O in in
0 0
O u CL
OJ c — ■a aj c qj id in QJ 4-*
x M
o
o
o
o
o
o
0 sz
cj
O M
1-
C
0 — 0) d JZ
0
bfl 0 JZ C M CJ X bfl — c c 0 QJ in —
ID
fD < C bfl L_ C 3 • QJ M C
2 C QJ M — bfl QJ — ID JZ — C > L — L. V_ ID ID c u in — -O
OJ JZ OJ M 4-J X J Z OJ 4J 5s rH U
>
QJ 4-1 >
ID a in __ —
0
CO
-Q 1—4
O in — c sz
in
0
M CO
< (D M c — fD (0 — c XJ O QJ in — M M > i _ — CJ JZ ID "O X J M XJ 0 c in id u
QJ Z> JZ M *J
>
-Q
O
_ O O -J
T~ < CC O
0 CC o_
u ID O — — O
to < 0) M > -Q rH
CC UJ —1 CQ LU to to
< CO 0
in
QJ QJ 4 ) T J -
sz
CJ M in 3 CJ in
u
0
3
' in in ■M
QJ
a
0 0
OJ
X JZ c L_ — X ID > . c > 4-1 L. a m bfl 2 c O 0 i_ X ■3 •• in a c x 2 • O O bO ID r— ~~ c X LU — M •— O M L. 14• in in >4— — JZ
OJ CJ
CJ
OJ
TO QJ
QJ
•—
CJ OJ
GJ ID •O XJ -Q QJ » O QJ E L » +-» c oj id > c — in ; qj id in in E — QJ E c l in m o x — >> O CJ "O .a
E JZ 4-J OJ _ bfl ID CO in 1 c CJ L. OJ i - 0 ■— M a — O w /- x «4in OJ OJ — c -3 CJ 4-J O -3 3 c
u
ID bfl O 4-* O M
aj jz JZ M
C M o 2 — c M . _ -O O QJ 3H D
M
• in v- c — a) o jz — M M QJ ID O i*- U ID —Oa •— in
CJ
a
0
o abflU- O QJ
xj
qj
QJ O 1 - QJ
jz
QJ-C 0-0 *j *j U fD
— q j in jz — "O— M O O U Q JN a — iJZ a id in xj o +-»—
_Q M — ID QJ —
14-
0
— CL — I QJ
— xU qj —
— JZ M JZ M 14-
0
0 0 0
X QJ
ID
QJ C Lc q j o> — in Q. — qj o
in CJ c c XJ— bo 3 — — — in 0 C CJ rH
CZ
>-
E
b£ «— *4c •— 0
2 M > CJ bfl 2 ID L. CO O ID_J in E J Z UJ in a U CO CJ E lx XJ O M XJ O O c fD M O C LL 0 CJ a bO M ID c ID a QJ
O E X! c •— fU X J •— •— L. •— 0 M J— ID > u- E ID bfl CJ U O CJ O i_ L. M O aj E a CJ fD E -C sz 3 a M QJ bO CT E bfl CJ OJ X •— CJ JZ M > M 4O-* C ID *4- - J c M s z •— ID — — •— Li. in L. CD x OJ — CJ 2 i - in X w— 3 • — M— C CJ 3
h— X UJ
c o c n o rH CN >1 O l CNI CM OM O l 0 4 fA k n r n 0 0 3 0 O O O O O O
SZ
> c H 0 J - m i o N
o
UJ to CO < to — 0
l-
z> 0
o
UJ CL >h-
— h- 0 0 h-
0
o o o o o o o o o o o < o
UJ z z — — hCC 3 < O X CC 0 K — 3 — CL O K tO 3 < O
< H < O
0
UJ _J CO
to . to UJ UJ X CO UJ 0 to > H < — CO to 2 — z to 0 0 — UJ UJ H to X 0 z hZJ UJ CC to u. CO
CC
•
0 CL
S 0
JZ ■ a ID u tD E
< CO
CC
*
_c x c u fD 0) U C o 3 E 3— ro E _C O m O ■MU U o =i a; x bo j z o i m M 4-» in ID o c- bo in aQJ • - Cd c c bO > C z M QJ _ > c M 2 (D QJ — 0 3 -C “ C£ o /-S ID QJ in QJ j*r QJ C Cl M C x O QJ _ l ID •— •— 3 CQ ■a 3 in E V- M in c u ID y— QJ 3 QJ M M ID -O •o O ^ in “ 3 o O > •— in — c in o u 3 •— — QJ «4_ M O bO a a CD a c 0 5 QJ Q . L. C oo > 3 0 ) o o Qj in M M in in r^ \ in QJ a O - C c a. QJ (D r— JZ JZ o M C L. s -Q 1— M >— -C “ 3 0 -O x ID i n XJ i n o QJ • ID u •— in ID 4-1 (D 1— _ c QJ o a in 3 QJ E 4-* r^ . jy 2 u (D -a QJ l_ . c ID O oo O M X q j in - o in M M X ID 3 in QJ L. hO 0 c 4-* t o — < L. fD c ID bfl 0 — bo a fD M »— 0 E z L- O C u _ a O O 3 fD < — 0) •—i_ M M 0 M M C M O in •— 0 M ■— • 3 c a j L. — a 3 “3 3 M r— in •— in s z ID 0 ID c M 1— •—
L.
CJ OJ
X M 4-» in
CJ
CJ CJ
ro -L
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
CJ
CJ
CJ QJ CJ ~~ > — I>
i_ M
qj s V)
0 0 yy0 y - co LL < UJ LU — co O or
LU CL >y-
1LU O
2 1
x LU y0 3 a
LU LU t - ■st or CO or
*
*
_
y
”2
< X
CO o ' Q- O
_
—i 0 x > x cn —1 < CD Q- 0 CL O O z 3 < CL O - J O "3 0 "3 C
*
or < X 0 0
I O O O O O O O O O O O O
fx. f*x r>. rx. fx. OO OO OO OO OO OO OO 00 OO OO CT) CT) r-» 0 0 0 0 O OOOOOO O O O O O O 0 O O O O
fA fA rH fA fA fA
0 CT) rl fA
fA
LU CL >y-
or co < — X 0 or hl - co 3 z o_ — y3 LL O —
la
fA fA rH fA fA fA
< CT) rH fA
O < -J LL
z z —
CL — _ 0 — CO
< CL 2: 2 : O O 2: CM or u j 0 la O- CC O h_J -J < 0
0 z < or LU O CL z 0 < CC LU UJ 1 — CL < O — O X O LU H LU 2: 3 x 2: a. 1------ y - cc Z 3 0 -h O L L O LU • CL O • X
_ CL O
O O O 0
fA IA LO CT) O O O O LL CM LA OO 00 CQ CQ CQ CQ CQ CO CQ CQ C Q O O O O rH r l r l r l r H r l rH r l rH r l rH r l r l fA fA fA fA fA fA fA fA fA tA fA fA IA
00 O rl fA
fA fA
IA fA LL O LL r l
fA fA
fA rA
rH 0 rH CO r l rx. CM |x. in r*x
OO CO O O O CM LA LO f x 00 CT) CO O LU LL CM St rx. O O O O O O O a a a CD CD O O O LU LU UJ rH r l r l r l r l r l r l r l r l r l rH r l rH r l rH r l r l r l fA fA IA fA fA IA fA IA IA IA fA fA fA IA fA fA fA IA
CT) LU rH fA
< LU < t LU CM CQ LU K*, i n O K M L Q L I . Q N N N U . U
O LU rl IA
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
I U. U. LL LL LL LL Ll_ U_
Page 35
105
o
o
X Ul Ul X -1 CQ < < X hQ- z _l — < cc o. LU O Ul o 3 < u. 2
H O _ o 1X o —
HO __ o 1LL Ul -J
CC \— LU O
LUz —I a: CQ3 CQ1_ LU
Ul -J CO CQ _ z
a
CC
J— % X H LL — UJ O — LU CC — —1h- CDDC 1UJ Z h* Z > h - — CO1—_ _ < Ul cc ul ui a: co o Q- cc O o.
< -J CO < >CO O UJ
LU _J CQ < 1—
o z — CO o -J o z Ul
< z _
T '
\- h-
LU
3
CC
cc
< X o
2:
o
cc U.
UJ o o
x
%
Ul
X hCOUl o < o cc 2 < ZZ. cccc LU |— < < Q_1CLX X UJ CO U lu. o o UJ ui — — O
0
•
J UlH 1 -
O
- J _ J h -h -O O
X
O O h -
h< 0. —1O 2: CO—2 CO0----1j- CO
0
0
0
0
0
0
10 f**- 00
r*^ 0
m m
O 0 CD O 00 0 0
a 0 O O O O cn 0 0 00 c o c o c o c o 0 0 0 0 0 0
in 10 n
m
rH m
m m
m cm m 0 m -3 - f"* j - r-* CM
rx
U J O Ul 0 0 mO m 0
rH UJ O Ul m
O
0 rH OO O
m
U. 0 ll
m
0 m
CO
0
O 00 00 0
O O O O O O O O O O O O O in iflN C O fflO H CD O H CN m 00 cd cn c n cn C n a i C D C D O l C D O O O O O O O O r H r H 0 0 0 0 0
^
fH m
rH m
O CQ CO CO cn
0 in 0
LU O
LL
10
COOOrHCNminOO 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
o cn o o
T
co
Cf O
o m r>» m C M N C N fN
1
O
z —J
CQ
021-3
O
o
o
J-
Ul H >-
3
3 T H A H
3 UJ
21
O
D P B
2:
h-
a. I—
m m m m m m m m mm m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m
< o O UJ —1 cc UJ cc . cc — • X • 1 0 Ul X < LU I1CO X 1 LU O X 2: o x 2 : CL O 1 z o . . OO OO ULU I I 1 — — O • O CC I1»H~ -1 — CL O 3 - < H1O O I— 1 z z O Z 1 CC CO — I1 CQ I-------------------1 ------- — - J- — 1 l u cc cc c c cc c c cc c c UJ 1 3 3 cc CL Cl 0 . CC CL 1 CLO-O-CCCL I CO CO
—l
Ul Q. >* 1-
O
_ J — Q_
o in cn CO o LL rH rH fH rH CN m - t i n r>. CD o U l O rH rH iH rH CN i n oo CD o LL LL LL LL CN ^ N t s r s M ^ c O < Q L L o o o o o o o o CD LU UJ U l U J U l U l U l UJ U l U J UJ UJ LL LL. LL LL LL LL LL LL LL LL LL LL LL LL o o o o o o o o o o o CN CN CN CN CM CM CN CN CN CN CN CN CN CN CN CN CN CN CN CN CN CN CN CN CN CN CN CN CN CN CM CN CM CN CN m m m m m m m m m m m
CC
X O
3
rH m
CC
U lUl Q- CL >- >h* %HM < M
Z —
CC
- 2 >h CO h Q- M
CL CO
1 cl O H to 3 CN O )
o
o m
. U Ja. 2 > -CO x H \
UJ o
O N hX < M
3
—J
o
LU UJ
_J
ID
X
--
D_
o
X
-—I J O LL
CL >fM
oc X Ul X
X -I -J
J—
Z CC X LU
CC X
o in CN rH
*
O O IA H rH
Q-
a a a :Q :< u -)< < Q :
LU Ul
_J a. X >Ul c o X M LO
3
LU2 2 S 2 2 2 2 2 C T Q Q C Q C C Q O CO < H
LU Ul
D D B B Z D
3 3
H A A C H
o
Z z
p A Z A Z
- - - - - - - -
_
n
O O 0 rH CN rH tH rH rH rH rH
rH rH
0
m
in
m ^f
m
m
in
O CD LL CN LL
CM m LU CN rH rH LU CM m n s m u i O m m
in 0 0 CO U J LL COCOCO CQ CO 0 0
m - 00 OOOO 0
j CM CO O O CN CN CM CN CN CM CN CN CN CN CN CN CN m m m m m m m m m m m m m
February, 1977
0
ycc
o
U. Li-
o z
CC H
CS
CL
to in
LU -J
rH
CO CO
—
z to
—
O
O.
CO
CM
— Z —
Ul
3 X 0 o ____i r
O Z cl -3
Z
>
z UJ
LU
Xo h— o »H Z H UJ — z Ul o
z —
-J z
Ul \-
to
Q.
rH
X O
o 3
o o o 2:
C^»
jh o j to ui w cc - z co
- J CL
3
CC
0
UJ O
T* < < < z CL Z 3 cc cc CC < 0 “ 3h z cc CL
H
LU o i
Q NU
0 cn tn 0
CO V
O O O O O 0 in LO N OO OS O in j - J - -a- ■30 O O O O 0
to lO f''* 0 0 j -
to tn in
LL LL U. to LU CM tH tH tH UJ LL O
LU tn m O
in LO r-* 00 < O LL tn tn tn m m m tn tn tn tn m tn tn tn tn m m m
LL m tn tn
rH J- J^t tn m tn tn tn tn tn tn
m to r>- OO cn < CO 0 0 cn cn cn cn tn cn cn m m m m m m m m m m m m m
z
z
— UJ —
—II— — >-
1
H co — X
LU CO
X
m
in in
X
0
Q
LU H CO
2222
cc
» r>» tn tn tn tn tn tn tn tn tn tn tn tn tn tn tn tn tn m tn tn m tn
Page 37
107
3 2:
X O > O n
0 0
X CQ x
X
X
-J
X
—1 X X —1 C J CJ CJ < z c c cj cr
X > Z 0 — n
—1 0
h—1 3 < LL LU O
—1 cc O 2: CQ >2: co >CO > - z o r lu O H Q h- Z O LU >O o r c o I— I- z z — co LU < 1— h- z 2 Z — LU O O Z C JQ .
1C
2:
c h-
O O
- l > J > < x > > r— z 0 < 0 < 0 h z H CO — 2 . 0 2 . 0 2 . 0 0 —
< Q
O
x
x
*
X X < < X < O h 0 h c r z i - h i u 2 : c o x — 00 00 o r
*
LU — 13 O or
*
O 0 O O O O CM fA J - LA CO LO CO CO CO CO CO O 0 0 O 0 0
O OO ID O
O J-
CQ CQ CQ rH rH rH J - •s t fA fA
O O O O O O O O O O CD O rH CM fA ■st LA CO r ^ CO r*x r x r * CO r**. rrx O 0 0 0 0 0 0 0 0 0
O O O O CT> O rH CM r » 00 00 00 O O O O
*
> Z O O
hX LU z
—i LU z — h 3 0 or
0 h-
0
H i - > l u z CO Z > __ UJ 0 < 0 o r 0 00 a .
0 h-
—1 2 X 0 0 UJ a. x x -1 c o —* 3 < 0- 0
X < X I- z 00 —
0
CC 2: >CO
z
- Q . —1 CO CQ Z < x or 1— LU 3 X H —1 LU O » cr CQ 2 0 uj >X X CO CQ O
or 2 X 0 0 LU
- IX o ------- 1 < X H 0 < 1— z i u CL O CO — o r
X hco
« CO
*
O O 0 O O fA ■St LA CO r*. 0 0 00 OO OO 00 O 0 O O 0
0
*
*
*
>or or < O Q Q UJ Z or 3
z lu
QO
CQ t2 >-
XO t—
*
O O O O O O O O O O O O OO cn O rH CM fA J - in c o r ^ OO cn CO 00 cn CD cn cn cn cn cn cn cn CT> O 0 0 0 0 0 O 0 0 O 0 0
f— h — Z CO LL LU — O
0 C Z
■ or or < O
z or • 3 0 h- Z LU 3 l - o r o LU . LL CO • >or hZ LU
Q— V: oo
— —i l u — UJ 3 O CQ _ J CO < < < - J > . • . . . •
0
■fc * X * h< O —1 2
H < 2
O z
0
0X
O
O
(— o
t3 p
3
CO
• -£
3 CQ
< h—
O
_i O
" /
CO
;
m
O O I O OO
5 1 h
rn
x
. .
X oo X 10 LU o O o o CO rH m m m O o _i J
CO
x r-. rH rH m
x r-H r-H rH x m O O —I X — _ j _ j —I Cl . CO z INI x x < 3 < 3 to 3 Q-
X LL X LL 0 O CO
X LU O r—l m
Q-
h- < co co o — Z Q 3
V.
^
I
CC H
X h-
X
Q
Q —I
UJ
2
c:x x hrN ll x t o o U_ O o O 00 ZZ m CO J
LU X H-
LU
00 3
—1 0
LO 0 0 CO LU O 0 0 O r-H f-H r-H rH m m m m
r-H f-H r-H m
JrH r-H m
00
rrH rH r-H rH m m
O Z
*
in
00 CO rH 00 rH m m —j _1
0 LU O O _ i rH X O 00 —1_1 r H 0 CO 0 m LL X r H m X < r H rH _ l u l 0 m —J _J O m —1 m X 003 J O LU rH 0 — — 1O rH CL 0 —1 X O x x Z Z M X rH rH z : r H _ 1 _ — < 0 co rn m 3 _i —1 m
X X tO 3
Q. !**» rH rH
m —J
0 0 m ct co 00 co uj rH j * r>. 00 r H rH rH rH LU O 0 0 0 0 0 0 X rH rH r H r H r H r H rH r H rH r H rH uj m m m m m m m m m m m
Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Box E, Menlo Park, CA 94025
Page 41
111
cc G o
o o o o in m in o o o
o cn L"» o
1O C
o o LO o
o rH cO o
LO rH
co
i p~ a: c o v , uj o >-
^ ZD o -o < o CC
. o o
o o o o o o o r—1 CM m st m LO r-x r>* r~r>» o O o o o o o
LU in
o
_i
LL < — 3 Q
CO —
- c/0 cc o co w — — < < \ cc i < i < X i 2 o — j o ► - ac h-cxrco w h O U J \C U liJ L iJ O U U m 2 0 o < o p > i > - 2 > - o c o c
luh ac2 o — h-O o o a.
cc G UJ G ZD < -J < -J > ca
— i
-J DC LU o CC LU LU CO ZD UJ o o —I LL UL < CC 2 J C ------O UJ O — o -j ca co h CN h - O -J < 1- UJ 2 1I— CO 2 < 1— x cc 3 CC x X < < — i LU LU 1- x uj O > O O 2 UJ UJ 1— LU 2 2 < CC 1— CC CC CO CQ < o C —1 UJ LU 2 0 0 o G L U J N — 1— 2 S UJ - j h o
-J
j m uj uj < < — J cl h cl ca O _j _i < Q p^ o < z x 2 x >- x cc m ------ 1 o > < — < > x oc pm a. — a rsi o n o 2 > < c c c r s ia . r s ic c c 2 0 2 0 x < “2 n — C O S O Q I C O t n X 2 - O O Q . - I Q uj
ca