74470 11690 uei oig V itrs ih h PET the with Pictures TV posing Superim / Cneso o te Atari the on Conversion A/D pl Porm o pressor Com Program Apple ETME 1982 SEPTEMBER THE THE 80 Feature 68000 6502/6809 JOURNAL
nentoa dto $295 £1.80 $250Kingdom United Edition Edition International Edition US/Canada
WHY THE MICROSOFT RAM C^M AKES OUR SOfTCARD AN EVEN BETTER DEA. Memory — you never seem to have quite applications like the Peachtree Software account- enough of it. ing systems. VisiCalc™ and other Apple software But if you're one of the thousands of Apple packages can take advantage of RAMCard too. owners using the SoftCard, there's an economical And RAMCard gives you the extra capacity to new way to expand your memory dramatically. develop advanced programs of your own, using the 16K ON A PLUG-IN CARD. SoftCard and CP/M. Even with the RAMCard in Microsoft's new RAMCard simply J k place, you can still access your ROM BASIC plugs into your Apple II,R and adds 16k l l J I a . and mon'tor routines. bytes of dependable, buffered 8 h P M r JOIN THE SOFTCARD read/write storage. w \ f a m iw : Together with the SoftCard, * * * j The RAMCard is just the the RAMCard gives you a 56k , __ latest addition to the SoftCard CP/M” system that's big enough 1 Q§ ‘ * ’ family — a comprehensive sys- to take on ail kinds of chores that §S| « I - j j'zZ— r5r~f tem of hardware and software woUld never fit before (until now, M ; j y.| j , ~~ . S that can make your Apple more the only way to get this much versatile and powerful than you memory was to have an Apple _ _,j; ever imagined. Language Card installed). , % ; ; : / S Your Microsoft dealer has all GREAT SOFTWARE: j i i : ; J '%£> the exciting details. Visit him : "“f - 15 soon’ and discover a great idea YOURS, OURS, OR THEIRS. dcc *j ui if ^ cc. _ msmm* With the RAMCard and “5 7K / ' that keeps getting better. SoftCard, you can tackle large- g e tr*' -JT * : 3 __« Microsoft Consumer Products scale business and scientific D t ' = . 10700 Northup Way computing with our COBOL and l l i j ; ' 1 Bellevue, WA 98004 FORTRAN languages. Or greatly t 206-828-8080 increase the capability of CP/M SoftCard. RAMCard and Microsoft a'e trademarks of Microsoft. Ir,c Ap::ie n is a registered trademark of App'e Computer Inc Z-bC s a registerea trademarn ot Zilog. ire CP;M is a registered trademark of , Digital Research •• ; - • ' V:siCa(c is a registered trademark of Personal - ~ • Suftware Inc Microsoft Consumer Products is a d-vision of Microsoft Inc
TM
/ H I C P p S O f T 2MHZ 6809 SYSTEMS GIMIX offers you avariety to choose from! 38 MB WINCHESTER SYSTEM...... $17,498.99 HARDWARE FEATURES: ★ 2MHz 6809 CPU ★ DMA Double Density Floppy Disk Controller ★ 512KB Static RAM ★ Dual 8” DSDD Floppy Disk System ★ 8 RS232C Serial Ports ★ Dual Winchester Subsystem with ★ 2 Parallel Ports Two19 MB 51A” Winchester Drives SOFTWARE FEATURES: ★ OS-9 LEVEL TWO Multi-User ★ OS-9 Text Editor Operating System ★ OS-9 Assembler ★ OS-9 Debugger 19 MB WINCHESTER SYSTEM...... $8998.09 HARDWARE FEATURES: ★ 128K Static Ram ★ 4 RS232C Serial Ports ★ 2MHz 6809 CPU ★ 1 MB 5 Vi” Floppy Disk Drive ★ 19 MB 51A” Winchester DMA Subsystem ★ DMA Double Density Floppy Disk Controller SOFTWARE FEATURES: ★ OS-9 LEVEL TWO Multi-User ★ OS-9 Debugger Operating System ★ OS-9 Assembler ★ OS-9 Text Editor 128KB MULTI-USER SYSTEM...... $6997.39 HARDWARE FEATURES: ★ 2MHz 6809 CPU ★ 2 RS232C Serial Ports ★ DMA Double Density Floppy Disk Controller ★ Dual 8” DSDD Floppy Disk System ★ 128KB Static Ram SOFTWARE FEATURES: Your choice of either UniFLEX or OS-9 LEVEL TWO. Both are Unix-like Multi-User/Multi-Tasking Operating Systems. 56KB FLEX/OS-9 “ SWITCHING” SYSTEM ...... $ 4 1 4 8 . 4 9 HARDWARE FEATURES: ★ 2MHz 6809 CPU ★ DMA Double Density Floppy Disk Controller ★ 56K Static Ram ★ 2 Built-in 5 Vi” 40tr DSDD Disk Drives ★ 2 RS232C Serial Ports (80 Track DSDD Drive Option .. add $400.00) SOFTWARE FEATURES: ★ GMXBUG monitor — FLEX Disk Operating System ★ OS-9 LEVEL ONE Multi-tasking operating system for up to 56K of memory WINCHESTER SUBSYSTEMS Winchester packages are available for upgrading current GIMIX 6809 systems equipped with DMA controllers, at least one floppy disk drive, and running FLEX, OS-9 LEVEL ONE or OS-9 LEVEL TWO. The packages include one or two 19MB (unformat ted) Winchester drives, DMA Hard Disk Interface, and the appropriate software drivers. The Interface can handle two 51/i” Winchester Drives, providing Automatic Data Error Detection and Correction: up to 22 bit burst error detection and 11 bit burst error correction. Dual drives can be used together to provide over 30 MBytes of on line storage -- or use one for back-up of the other. (More convenient and reliable than tape backup systems. #90 includes one 19MB Drive, Interface, and S o ftw a re ...... $4288.90 #91 includes two 19MB Drives, Interface, and Softw are...... $6688.91 Contact GIMIX for systems customized to your needs or for more information. 50 HZ Export Versions Available GIMIX Inc. reserves the right to change pricing and product specifications at any time without further notice. 1337 W EST 37th PLACE CHICAGO, ILLINOIS 60609 inc. GIMIX® and GHOST® are registered trademarks ol GIMIX Inc (312)927 5510 FLEX and UniFLEX are trademarks o1 Technical Systems Consultants Inc. G i m i x OS-9 is a trademark ol Microware Inc. TWX 910-221-4055 1982 GIMIX Inc. THE CHIEFTAIN™ 51/>-INCH WINCHESTER HARD DISK COMPUTER SO ADVANCED IN SO MANY WAYS . . AND SO COST-EFFECTIVE . . IT OBSOLETES MOST OTHER SYSTEMS AVAILABLE TODAY AT ANY PRICE.
• HARD DISK SYSTEM CAPACITY • 2-MHZ OPERATION Winchester with tape or floppy back-up . . . The Chieftain series includes 5V4- and 8-inch All Chieftains operate at 2-MHz, regardless they all run under DOS or OS-9 with Winchesters that range from 4- to 60- of disk storage type or operating system no need to modify hardware or software. megabyte capacity, and higher as technology used. Compare this to other hard disk advances. All hard disk Chieftains include systems, no matter how much they cost! • UNBOUNDED FLEXIBILITY 64-k memory with two serial ports and You'll probably never use it, but any Chieftain DOS69D disk operating system. • DMA DATA TRANSFER hard disk system can drive up to 20 other DMA data transfer to-and-from tape and disk Winchesters, and four tape drives, with a • LIGHTNING ACCESS TINE is provided for optimum speed. A special single DMA interface board! Average access time for 5W-inch Winchesters design technique eliminates the necessity is 70-msec, comparable to far more costly of halting the processor to wait for data • SMOKE SIGNAL'S HERITAGE OF hard disk systems, That means data transfer which normally transfers at a slower speed, EXCELLENCE ten-times faster than floppy disk systems. determined by the rotational velocity of This new-generation computer is accompa the disk. nied by the same Endurance-Certified The Chieftain quality Dealers and end-users all over the • RUNS UNDER DOS OR OS-9 world have come to expect from Smoke Computer Systems: no matter which Chieftain you select. . . Signal. And support, software selection and 5'A- or 8-inch floppy, or 5 'A- or 8-inch extremely competitive pricing are very much Here are the Chieftain 6809-based a part of that enviable reputation. hard disk computers that are destined to change data processing . . . 20-Megabyte Tape Streamer Back-Up Option
CHIEFTAIN 95W4 Available with all Chieftain hard 4-megabyte, 5'A-inch Winchester with □ a 360-k floppy disk drive (pictured). disk configurations. This cartridge tape capability CHIEFTAIN 95XW4 provides full 20-megabyte □ 4-megabyte. SW-inch Winchester with disk back-up in less than five a 750-k octo-density floppy disk drive minutes with just one command, or copy com CHIEFTAIN 98W15 mand for individual file □ 15-megabyte, 5'A-inch Winchester with transfers. Transfers data a V-megabyte 8-inch floppy disk drive. tape-to-disk or disk-to- tape. Floppy back-up is CHIEFTAIN 9W15T20 also available in a variety 15-megabyte, 5'/i-inch Winchester with □ a 20-megabyte tape streamer, of configurations.
Write or call today for details (including the low prices) on the Chieftain S e rie s.. . and on dealership opportunities
SMOKE SIGNAL BROADCASTING® C om pany A d d re s s _ 31336 VIA COLINAS W ESTLAKE VILLAGE, CA 91362 C ity______TEL (213) 889-9340 Telephone (
2 MICRO - The 6502/6809 Journal No. 52 - September 1982 TM
September Highlights
68000 Feature We welcome Dr. Richard C. Vile, Jr., as an Apple con tributing editor. Richard will be working with our in- Once again the microcomputer industry has a new and ex house Apple specialist, Phil Daley, to expand our Apple citing product to offer users: the 68000 microprocessor. coverage. Dozens of companies have already built computers around this chip, or developed compatible software and peri Commodore pherals. The big news about the 68000 is that it can be used as a powerful add-on to your 6502. There are two articles of special interest to PET/CBM owners. Peter Hiscocks (p. 11) describes a hardware tech Laurence Kepple, in "The 68000 and the Personal nique to simultaneously display on the PET's screen the Computer” (p. 27), discusses the 68000 as a 6502 add-on. computer's output and the image from a closed-circuit TV He offers some insights on the manufacturers and their camera. Although the PET does not have access to the im products. If you're interested in adding a 68000 to your age, it can be programmed to display fancy captions or to present system, take a look at this article. point out certain features. The picture could also be used to enhance an otherwise dull computer run. We're providing a very useful and detailed series on the 68000 microprocessor itself, authored by Joe Hootman, a "Auto SAVE for the PET” by Louis Sander (p. 83) is a Professor of Electrical Engineering at the University of BASIC subroutine you attach to your programs during North Dakota. The first part (p. 41) contains a brief in development. It ensures that you make copies of your pro troduction to the 68000 and detailed treatment of the data gram at regular intervals, thereby giving you more protec movement commands. Future installments will offer tion from unanticipated disasters. tables on the 68000's instruction set. Loren Wright's "PET Vet” column (p. 78) discusses Tom Whiteside and Joe Jelemensky of Motorola, manu Eastern House Software's MAE macro assembler and some facturer of the 68000, describe the registers, instruction new Commodore-oriented publications. set, and addressing modes of this microprocessor (p. 32). We would like to welcome Dave Malmberg and Jim Our data sheet this month will serve as a handy refer Strasma as contributing editors in the Commodore area. ence to 68000 programmers. Atari
6809 We are happy to have Paul Swanson on board now as a contributing editor and Atari columnist. Paul's column Hal Clark presents an article (p. 57) for 6809-based will begin in November. He will also help us increase our machines to give a Pascal-like structure to your machine- base of Atari authors. language programs. This makes the program easier to read and debug while maintaining the execution speed and Straightforward Garbage Collection memory efficiency of assembly language. This program by Comelis Bongers appeared in our August A BASIC program to calculate market projections on issue, page 90 (also one of the utilities on disk). A few industry and company sales, by Len Suckle, is presented readers missed the important note that appeared at the end for the Color Computer (p. 67). It could be translated to of Mr. Bongers' article. Here it is again, in case you missed other BASICs fairly easily and is well documented so you it too: could customize for a specific application. The machine-language program starts at $9000 and has a length of $260 bytes. After assembling the text file and Apple storing it to disk, the program can be installed by : BRUN programname. This command executes an initialization For Apple users, Barton Bauers has written an extremely routine that sets HLMEM to $9000 and installs the & vec useful machine-language utility to reduce the length of tor. If you want to BRUN the routine from within an Apple Applesoft BASIC programs and increase the speed of soft program, the BRUN command should be inserted at loading and execution (p. 89). It allows you to fully docu the first line of the program, and must be followed by a ment your program with remarks and single line state CLEAR command. For example: ments for legibility, and then remove the remarks and con catenate all non-referenced lines for a streamlined version. 10 PRINT ‘‘BRUN program name” : CLEAR: REM control D behind first quotes. This month's "Apple Slices” column (p. 47) by Tim Osbom, presents a quick random-access technique called The program makes use of some Applesoft routines in 1 'hashing.” If you want to speed up access to your file pro ROM. If the RAM version of Applesoft is being used, the grams that do a lot of random accessing, here is the solution. relevant subroutine calls have to be adjusted. jk|£pn~
No. 52 - September 1982 MICRO - The 6502/6809 Journal 3 4 MICRO - The 6502/6809 Journal No. 52 - September 1982 NO. 52 SEPTEMBER 1982
/AlCftOTHE 6502/6809 JOURNAL STAFF President/Editor-in-Chief 68000 FEATURE ROBERT M. TRIPP The 68000 and the Personal Computer ...... Laurence Keppie Publisher 2 7 The 68000 as an add-on to 6502-based systems MARY GRACE SMITH An MC68000 Overview ...... Tom Whiteside and Joe Jelemensky Senior Editor 3 2 LAURENCE KEPPLE ' A description of the 68000’s registers, instruction set, and addressing modes Editorial Staff 68000 Instruction Set ...... Joe Hootman PHIL DALEY — Technical editor 41 Part I in a series on the 68000, including a detailed table of Data Movements JOHN HEDDERMAN — Jr. programmer MARJORIE MORSE — Editor JOAN WITHAM — Editorial assistant HARDWARE LOREN WRIGHT — Technical editor Graphics Department Superimposing TV Pictures on PET Video ...... Peter d. Hiscocks HELEN BETZ — Director 11 Modify the PET to superimpose a television camera picture on the PET video display PAULA M. KRAMER — Production mgr. EMMALYN H. BENTLEY — Typesetter 1 A a /d Conversion Using a 555 Timer IC ...... Mike Dougherty ■ ^ This simple 555 timer yields a high dynamic range inexpensively Sales and Marketing CATHI BLAND — Advertising mgr. CAROL A. STARK — Circulation mgr. p o Delayed Reset and Autoboot for the OSI ...... U g o v .R e LINDA HENSDILL — Dealer Sales Z-'** Add both a time delay to the BREAK key, and an automatic disk system bootup MAUREEN DUBE — Promotion Accounting Department LANGUAGE AIDS DONNA M. TRIPP — Comptroller KAY COLLINS — Bookkeeper C H AMPER-POS for the APPLE ...... Philippe Francois EILEEN ENOS — Bookkeeper ^ ■ A machine-language utility that extends APPLESOFT to include a POSition function
Contributing Editors C 7 6809 Macros for Structured Programming ...... H al Clark DAVE MALMBERG ' Use assembler macros for structured assembly-language programming JIM STRASMA PAUL SWANSON RICHARD VILE APPLICATIONS Advertising Sales Representatives See Page 127 Market Projection Program 67 for the Color Computer ...... Leonard I. Suckle Subscription/Dealer inquiries A sophisticated business program to project industry and company sales (617) 256-5515 Double-Entry Formatting for your Checkbook O 0 On the C1P...... Leo Jankowski DEPARTMENTS A simple checkbook balancing program 3 September Highlights 7 Editorial UTILITIES 8 Letters/Updates q o Auto SAVE for the PET ...... Louis F. Sander 45 MICRO News A routine for automatic cassette backup 87 New Publications 100 Book Reviews o n COM PRESS — An APPLESOFT Optimizer . . Barton M. Bauers Reduce APPLESOFT program memory requirements by up to 30% 103 Reviews in Brief 108 6502 Bibliography 110 6809 Bibliography COLUMNS 111 Software Catalog A7 Apple Slices ...... Tim Osborn 117 Hardware Catalog ^ ’ “ Hashing” ...A quick random-access technique 123 Tech Data Sheet 127 Advertiser’s Index ■70 PET Vet...... Loren Wright 128 Next Month in MICRO * ® The MAE assembler and new Commodore-oriented publications
No. 52 - September 1982 MICRO - The 6502/6809 Journal 5 I'iiT-.e-1* -Sr-. PftQGItftMMlNS Oif Tjft APPLE If. For begmneB.AS5EMR.Y U ^- THE BOOK assembler available for the* Apple while ar the ptovtdes.a dear aruS noorechnicaf introduction same time being the’ easiest to us# rc> machine language programming on the IMPACT, WE’RE SO CONFIDENT OF THIS CLAIM, Apple Drawn mmtfemonrhlycotuiminSofroll* WAT IF YOU CAN AND A SETTER ASSEMBLER Maqcilne. and expanded to provide even mote WITHIN 30 DAYS OF PURCHASE, SIMPLY RETURN mramanan. A5SEMDLY.UNES-, THE BOOK hos THE COMPLETE MERUN PACKAGE FOR A FULL already received amcol qcdajm as the best REFUND* tutorial on machine language programming A fu# featured' macro assembler With optional _ available ■ • / :' • - * v.* * i ’ t assembly to disk, and use of indude'files. Merilns Monethonaslmp Example programs include; pocftifes, sound, dish editor has word processor-like power with-such A-EUG jndudei Its awn rtifru-assembler,s fifes and mdfe;..air presented with the novice options as global search/replace, a powerful labels, and even conditional nose flpgs-1 programmer In mind. The book also includes an line editor, and more. The package also Indudes means MAH, con be (M in a 'dormant'S excellent reference section teflnjeach machine„ SOURCEROR. a utility to generate labeled which will later pacnip’ in the trace mode, jOTty language command, and a sample listing pseudo source code from row. Dinaty flics, and when certain conditions are met Thus routines'.^. illustrating its moy'common uses in caual source a bo SOURCEROft St, a Hilly labeled and wi^iiaftiHy. operQNonoI prpgtoms con be tesifed listing. . -v commented source listing of Applesoft BASIC! - rlg|» ofjao-tftne.‘ \ ■*, SUGGESTED RETAIL PRICE: *19.95 SUGGESTED RETAIL PRICE: S64.95 SUGGE5TH) RETAIL PRICE: (49.95 SPECIAL LIMITED TIME COMDlNATION PRICE: S l 1 9 .9 5 THIS OFFER VADD THROUGH OCTOBER 31, 1^82. • CAUfOWIA. RODENTS ADO 6% WtES-TAX Please ask your local. Apple dealer for more dfefoils, or wrire SDS ta ra sample Kst of MERUN's commands and o complete product guide of aver 20 athet auiaandtng. programs! *MSRUN siheaswfribter af choice of These leading software companies; AKI5O.IMC*0RQDEADUND SOFTWARE. INC. sautnujesteRn- .. cram,I i r m m r hit ■ PROMETHEUS PRODUCTS. data INC . SINUS SOfTWME,IKC svstems . SYNERQSTIC SOFTWARE. P.O. OOX 582 . SANTEE, CALIFORNIA 92071 . TELEPHONE: 714/562-3670
MICRO - The 6502/6809 Journal No. 52 - September 1982 6 About the Cover TM
Editorial
When Worlds Collide Tracy Licklider, Vice President of Soft The 68000 microprocessor is one of a ware Arts, noted recently, "VisiCalc is number of new chips that are making it a screen-intensive, highly interactive increasingly difficult for minicomputer program. Timesharing systems simply manufacturers to justify their existence cannot process VisiCalc's frequent as an enterprise distinct from the world demands for screen refreshes. In a VIA Train Number 1, "T h e Canadian/1 of microcomputing. More than market minicomputer, multiuser environ makes its way westward across the con share and terminology are at stake. The ment, VisiCalc gets bogged down.” tinental divide. Nearly three days ago it critical issue is: what role does the in Thus, one of the most powerful pro left Montreal and tomorrow morning it dividual user play as part of a computer grams in history succeeded in part will be in Vancouver, British Columbia. system? In a microcomputer system, because its designers were thinking in the computer and the user are on equal terms of a one-on-one relationship be Computers are used by travel agen terms, one-on-one partners in a tween the computer and its user. cies to keep transportation schedules, such as this one, readily accessible. A problem-solving endeavor. In a mini microcomputer could be installed on computer, multiuser environment, the Interactivity is the key, because in board the train and tied into a radio com individual user is simply less impor teractivity means maximum user in munications network with other, larger tant. Many users must compete for the volvement. What minicomputer manu computers. The Canadian Pacific Rail attention of the CPU. Waiting in line facturers have yet to understand is that road (whose tracks VIA is using) runs has never been popular, and some peo the more involvement users have in a long sulfur, coal, and grain trains with ple are asking why, in this era of ever computer system, the more powerful the computer-controlled "robot” loco cheaper hardware, there are those who computer system becomes. As Hal Har motives midway through the train. say we should go on waiting. For exam denbergh puts it: "To a minicomputer Every change in speed or gear made by type, a minicomputer which has seven the crew at the head of the train is ple Hal Hardenbergh, in his newsletter duplicated by the robot locomotives. DTACK Grounded, speaks up for the teen applications programs available individual user with some vigor: "Re for it is described as 'heavily Photo by Loren Wright, MICRO Editor fusing to give each user his or her own supported.' You tell the owner of a individual, undivided processor chip is PET, Apple, or [TRS] 80 that a par prima-facie evidence of utter contempt ticular personal computer has a thou for the customer. And utter contempt sand application programs available IMCftO is published monthly by: is all that a minicomputer type has for and they will reply, 'Oh? What’s wrong MICRO INK, Chelmsford, MA 01824 us personal computer types!’1 with it? Isn’t it a popular machine?' ” Second Class postage paid at: Chelmsford, MA 01824 and additional The fantastic support available for a mailing offices "U tter contempt"? Surely Mr. Har micro like the Apple is a direct result of USPS Publication Number: 483470 denbergh goes too far. However, con user involvement. ISSN: 0271-9002 sider the following observation from Ms. Andrea Lewis in a recent issue of Even those with a minicomputer or Send subscriptions, change of address, USPS Computer Design: "Putting a mini ientation are beginning to think in Form 3579, requests for back issues and all computer operating system on a toy terms of "one person, one processor.” other fulfillment questions to computer will not result in a cheap Computer Business News recently MICRO INK minicomputer.” By "toy computer,” quoted Motorola Inc.'s Tom Starnes as 34 Chelmsford Street P.O. Box 6502 Ms. Lewis means to indicate "micro saying that, though everyone does not Chelmsford, MA 01824 computer.” She goes on, "T o support need distributed processing capabilities or call multiple users in a true timesharing en in their applications now, almost 617/256-5515 vironment, reliable memory protection everyone will "run out of gas” in terms Telex: 955329 TLX SRVC 800-227-1617 must be provided to keep one errant of processing capability using a single user from disrupting the other users' system bus. "Which is why applica work on the system.” A "true time tions are turning more frequently to Subscription Rates Pei Year sharing environment"? Is there distributed processing where a number U.S. $24.00 of different processors each performs 2 yr. / $42.00 something intrinsically valuable about timesharing? Useful when hardware their own isolated programs,” he con Foreign surface mail $27.00 was fabulously expensive, timesharing tended. As for timesharing systems, Air mail: Europe $42.00 still requires costly overhead, such as Stames said, "It is not much more ex Mexico, Central America, the "reliable memory protection” to pensive to have a [16-bit chip] and Middle East, North Africa, which Ms. Lewis refers. memory for user programs in the work Central Africa $48.00 station itself. The benefit is the user South America, South Africa, Far East, Australasia, Other costs of timesharing are more has a high-performance processor all to New Zealand $72.00 subtle. For example, VisiCalc, a pro himself." To which we at MICRO say, gram that was conceived especially for "Amen.' i Copyright© 1982 by MICRO INK All Rights Reserved "toy computers,” does not work well in a timesharing environment. As U a i A r e v t c c
No. 52 - September 1982 MICRO - The 6502/6809 Journal 7 TM
Letters/Updates
Atari DOS Bug Atari Bug Demo Dear Editor: TESTING INSTRUCTIONS: A; Type in program. There is a bug in the Atari DOS (or B: SAVE to disk as "D:BUGTEST.BAS". BASIC's disk I/O) that can clobber up C: Type "RUN". to half of RAM page 6, the "safe" ram. Since the operation of this bug isn't ob 0100 REM : BUG—DEMO 0110 REM : BY DAVID H. SIMMONS vious, it can cause incredible amounts 0120 DIM I N * (256) of trouble; I spent two days going over a 0130 OPEN #1,4,0,"D:BUGTEST.BAS" USR subroutine to try to find the bug, 0140 REM (OR OTHER ’TEXT R E C O R D ’ FILE) before I discovered that my routine had 0150 ? "IOCB BUFFER ADDRESS: ";PEEK(852)+256*PEEK(853) nothing to do with it. 0160 REM : *David H. Simmons The second improvement was to P.O. Box 7000-140 place 1/8-inch thick foam rubber be Redondo Beach, CA 90277 Fan Improvement tween the part of the fan case and com puter that come in contact with each Dear Editor: other. This minimizes vibration.
Othello Update I recently purchased a System Saver Robert Gershowitz fan by Kensington Software. Although 76-51 169 Street Phil Daley, MICRO’S Technical the fan works as advertised, I have Flushing, NY 11366 Editor foi the Apple, offers this update:
In the program Othello ( MICRO on Listing for Othello Line Changes the Apple, Vol. 3), Charles Taylor 16 DIM B 0 M D (9 ,9 ): DIM 2 : QOSUB 181 the minor modifications presented 60 ODI£)R= OC(lURN) :ZZ = 0 here, the computer will play a level 1 62 IF NOT Z OR TURN =■ 1 THEN PRINT PROMPTS (TORN) 133 IF Z AND TORN =■ 2 THEN ZZ = ZZ + l:tCWE$ = 0 0 $ (Z Z ): GOTO 135s REM game of Othello for those who need an SUBR GfflMCVE opponent. This would be especially use 135 PASS = 0 : IF M3VE$ = “DONE” THEN PASS - 1:Q » 1 0 0 : RETTURN ful in learning how to play the game. 173 DMA A1,A8,H1,H8,B1,B8,G1,<38 174 DMA A2,A7,H2,H7,C1,C8,F1,F8 Lines 16-135 contain adjustments 175 DMA A3,A6,H3,H6,D1,D8,E1,E8 to the Taylor program corresponding 176 DMA A4,A5,H4,H5,C4,C5,F4,F5 177 DMA D3,D6,E3,E6,C3,C6,F3,F6 lines. Lines 173-183 are new material. 178 DMA D2,D7,E2,E7,B4,B5,G4,G5 There was a minor bug in the program 179 DMA B3,B6,C2,C7,F2,F7,G3,G6 as published. The only way the pro 180 DMA B2,B7,G2,G7,P gram knew that the game ended was 181 HOB : PRIWT “DO TOU Wlffl TO PIAY THE COMPUTER?" when all 64 blocks were filled. It is 182 INPUT Z$: IF USFT$ ( Z $ ,l) = "Y“ THEN Z = 1 183 RETURN possible to not have any moves left
8 MICRO - The 6502/6809 Journal No. 52 - September 1982 Take a Bigger Byte of MICRO Special Introductory Offer A task at9m TWNWCiSir OiMK Id ...... ,T!TTi!ffi ___ JL» » ewwwil-tirweogBri^. Subscribe Now and Save 3 3 % (Off Newsstand Price) (First Time Subscribers Only) MICRO brings you information-packed pages every month. Each issue delivered to your door opens doors to computing mastery!
Subscribe to MICRO and learn how to extend , your computing knowledge to get the most out of your computer and expand its capabilities.
Subscribe to MICRO and develop your microcomputing skill. Keep up with the latest technology—Don’t be left behind!
Subscribe to MICRO Today and find, each month at your door, a world of computing power you could only dream of yesterday.
All for Only □ YES! I’m Serious Send me a 1 Year Introductory Subscription MCRO for only $19.95 (Foreign—surface mail—$22.95) 4 THE 6502/6809 JOURNAL $ 19.95 For fast service call toll free 1-800-345-8112 (In PA 1-800-662-2444) 1 YEAR MICRO BOOKS Quan Title Price s/h Total □ PAYMENT ENCLOSED SUBSCRIPTION _____ Micro on the Apple Vol. 1 $24.95 $2.00 ______(Checks payable to MICRO) _____ Micro on the Apple Vol. 2 24.95 2.00 ______□ VISA □ Master Card _____ Micro on the Apple Vol. 3 24.95 2.00 ______What’s Where in the Apple...Plus... _____ the All New Guide to What's Where 24.95 2.00 ______Act.# ______THE GUIDE to WWA 9.95 2.00 ______Expires ------(MA residents add 5% sales tax) Total ______
MICRO Name for the Address SERIOUS J COMPUTERIST City
State/Prov. Zip 83-356 Offer good until 10/31/82 Country L Allow 4-6 weeks for delivery i Get The Most Out Of Your APPLE
With The Most Important Book With Ever Published on the APPLE! MICRO on the What’s Where in the APPLE. APPLE Series Plus...the All New Guide Complete with to What’s Where Diskette No need to type in Revised Edition of the famous Apple Atlas hundreds of lines of code.
• Guides you — with a numerical W hat's Where in the APPLE...PLUS... Atlas and an alphabetical Gazet - the all new guide to WHAT'S WHERE teer — to over 2,000 memory loca Vol. 1 tions of PEEKs, POKEs, and Vol. 2 Vol. 3. CALLS. Allows you to: Lets you: Just Released! • Gives names and locations of I Round and format I Speed up machine Gives you more: various Monitor, DOS, Integer BASIC, and Applesoft routines — numbers accurately language programm ■ Machine language and tells you how they’re used. ■Get lowercase ing using 5 powerful aids • Enables you to move easily letters and punctua machine language I I/O enhancements aids between BASIC and Machine tion into Applesoft ■Graphics and Language strings I Add additional games • Guides you through the inner I Ray the hig game editing and I/O workings and hidden mechanisms AN ATLAS TO “Spelunker” features of the Apple. THE APPLE COMPUTER With Full Etplaniloiy T 91I Added I Play the intriguing By William F. Luabbart game “GalactiCube" All Apple users will find this book helpful in understanding their machine, and essential for mastering it! ...and much, much more! Together Volumes 1, 2, and 3 provide The Atlas and THE ALL NEW GUIDE are more than 110 programs on diskette available in one, 256-page Wire-O-Bound for less than $1.00 each. book for only $24.95 Volumes 1 and 2: 13 sector DOS 3.2 format. If you own the original W hat’s Where in the Volume 3: 16 sector DOS 3.3 format. A pple? you will want THE GUIDE to comple Micro on the Apple, Volumes 1, 2, and 3 ment your edition. This 128-page Wire-O-Bound (Complete with Diskette) version contains all new material to be used with the memory map and atlas for $9.95. $24.95 each
NO POSTAGE NECESSARY IF MAILED IN THE UNITED STATES Use Coupon BUSINESS REPLY CARD On Reverse FIRST CLASS PERMIT NO. 60, CHELMSFORD, MA Side to Order POSTAGE WILL BE PAID BY ADDRESSEE and MICRO Mail TODAY! 34 Chelmsford Street P.O. Box 6502 Chelmsford, MA 01824
83-356 ROCKWELL Microcomputers from Excert, Inc. THE AIM 65/40 THE AIM 65 Single Board or Smorgasbord Take-Out Order
- m m w
'fsfiMftpps If*, /'■ , fSS&W*
turf!,, *000 1 *&W3 a a ^ f;V,urS
A full size terminal style keyboard w/8 special A full size terminal style keyboard w/3 special function keys function keys A smart, 40 character display with its own A 20 character display microprocessor A 40 column printer w/text and graphic output A 20 column printer w/text and graphic output capability Up to 64K of on-board RAM and ROM Up to 4K RAM and 20K ROM on-board On-board interfaces include RS232, dual audio On-board interfaces include 20MA TTY, dual cassette and 2 user I/O R6522 devices audio cassette and 1 user I/O R6522 device Firmware includes interactive monitor and text Firmware includes interactive monitor and text editor w/options of Assembler, BASIC, FORTH editor w/options of Assembler, BASIC, FORTH, and PL/65 PASCAL, & PL/65
And if the above isn’t enough. Try the RM65 — a product line filled with embellishments including:
32K DRAM Board AC IA Board Prototype cards CRT Controller IEEE-488Board Adaptor Buffer Modules Floppy Disk Controller CPU/SBC Board General Purpose I/O Board PROM Programmer 4-16 Slot Card Cages PROM/ROM Board
NEW LOWER PRICES AND A CASH DISCOUNT* TO BOOT!
A65/40-16 (16K RAM)...... $1225. A65-1 (1K RAM)...... $420 A65/40-32 (32K RAM)...... $1295 A65-4 (4K RAM)...... $445 A65/40-A (Assembler) ...... $ 85 A65-4B (4K RAM w/BASIC) ...... $495 A65/40-B (BASIC)...... $ 65 A65-PS (PASCAL)...... $100 A65-F (FORTH) ...... $ 6 5 A65-A (Assembler)...... $ 35 Mail Order to:
Educational Computer Division EXCERT INCORPORATED Higher quantities quoted upon request, COD's accepted, SALES P.O Box 8600 shipping will be added. * Deduct 5% cash discount on SERVICE prepaid orders. Minnesota residents add 5% sales tax. INSTALLATION White Bear Lake, MN 55110 Prices subject to change without notice. CONSULTING (612) 426-4114
No. 52 - September 1982 MICRO - The 6502/6809 Journal 9 Skyles Electric Works Epson-PET/CBM Graphic ROM Pack For PET/CBM Owners Who Want: Complete Program Listing Printouts Complete Screen Graphic Printouts Graphic Printouts From Programs
on your Epson Printer
Order the Skyles Electric Works EPSON-PET GRAPHIC ROM Package. The ROM when installed in an EPSON MX80, MX80FT, or MX100 with Graftrax Plus printer will reproduce most of the PET/CBM graphics characters. Most importantly when using the accompanying high speed machine language program, the Epson-PET Graphic ROM pack gives s complete program listing with all screen controls shown (cursor, home, clear, etc.). This high speed machine language program for program listing, screen image printout (screen dumps) and BASIC program controllec printing (i.e. PRINT ) automatically translates the PET-ASCII characters to the EPSON-GRAPHIC ROM characters. A BASIC sample program and PRINT subroutine, that may be incorporated into any existing BASIC program, completes this "complete solution" package.
EPSON MODEL ROM MODEL
MX70 Not Available MX80 (serial no. to 359999) EPG80 (EPG82, 3 ROM Version) MX80 (serial no. after 360000) EPG81 (EPG83, 3 ROM Version) MX80FT EPG8F MX80 Graftrax Not Available MX80 Graftrax Plus EPG8G+ MX80FT Graftrax Plus EPG8G+ MX100 Not Available MX100 Graftrax Plus EPG10G+
The Epson-PET Graphics ROM Pack has been designed to furnish you with PET/CBM graphics printing in the easiest way possible. This is done by furnishing a high speed machine language program that is "hidden" at the top of your PET/CBM memory.
The machine language program serves 3 major functions.
1: Translates PET-ASCII code to ASCII code for program listing.
2: Translates screen code to ASCII code for screen image printouts.
3: Translates PET-ASCII code strings to ASCII strings for normal program printout. This feature may also be used for making ASCII files for your disk or tape recorder.
INSTALLATION: Installs into your Epson printer
PRICE: Epson-PET Graphics ROM Pack EPG80, EPG81, EPG8F___$75.00 Please specify your Epson printer model type and and serial number when ordering. For all PET/CBM's BASIC 2.0/Revision 3, or BASIC 4.0
AVAILABILITY: Immediately from your LOCAL DEALER o r VISA, MASTERCHARGE ORDERS CALL (800) 227-9998 (except California residents) CALIFORNIA ORDERS PLEASE CALL (415) 965-1735
23IE South Whisman Road Mountain View, CA 94041 Skyles Electric Works (415) 965-1735 MICRO - The 6502/6809 Journal No. 52 - September 1982 Superimposing TV Pictures on PET Video
by Peter D. Hiscocks
The Commodore PET may be full brightness (or greenness, in the The added video amplifier controls the modified to superimpose the case of the new PETs). The PET dis power supply rail of the existing picture from a television camera play, of course, only has to deal with amplifier, thereby setting the max on the PET video display. The the two extremes of brightness. The imum dark level and creating a con resultant combined picture (PET grey scale is dealt with by the video tinuous grey scale in response to the amplifier (figure 4) and the modifica video signal. PET characters (white) are video and television Image) may tions to the PET video display (figure 3). visible as long as the video picture is also be fed to a remote monitor not completely white. or video tape recorder. In the existing PET display cir cuitry, the video amplifier switches the Modifying the PET video display is cathode of the CRT between 35 volts not for the faint-hearted or the novice I had to superimpose the picture from a (dark level) and ground (white level). electronic tinkerer. There are high television camera on the PET video display as part of an airborne camera control unit (see reference). The same Figure 1: Block Diagram concept could be useful in a variety of situations. For example, the composite video signal — television picture plus PET graphics and alphanumerics — could be fed to an extension monitor or video tape recorder and the PET would become a very sophisticated video titling system. In another situation, the signal from a microscope-mounted television camera could be fed to the PET and the area of cells determined by tracing with a light pen.
Note that the television picture is not available to the PET; it is simply overlaid on the display, and the PET doesn't know of its existence. A block diagram of the system is shown in Figure 2: Sync Circuits figure 1. + 5V A first requirement of the system is that the television camera scan rate be synchronized to that of the PET display. Fortunately, the vertical and horizontal sync signals are available at the PET User Port. These are modified to a suitable form by the sync circuits shown in figure 2, and fed to the televi sion camera. The television camera must be able to accept and lock on these signals, but this is a common re quirement of cameras that are used in studio situations. I used the Sanyo 1620 X camera.
The next requirement of the system is that the display be able to show a continuous grey scale from full dark to
No. 52 - September 1982 MICRO - The 6502/6809 Journal 11 voltages inside the display, and ; Figure 3: PET Video Amplifier Modifications mistake could fry you and/or you PET. The circuit details that I show ii figure 3 apply to the early PETs ani you'd be wise to confirm the circuitry i you have a newer version.
The circuitry of the added video am plifier should be copied fairly closely especially in the choice of transistor: (the bandwidth requirement for th< amplifier is in the order of 3.5 MHz), made up the circuit on Veroboard anc mounted it inside the case of the PEI display. In my installation, I used < relay to kill the television picture sc the toggle switch could be placed or the front panel, without having to rui signal-carrying leads up to the fron panel. Leads from the added videc amplifier to the existing videc amplifier should be kept as short a; possible and well away from th< display flyback transformer area.
Figure 4: Camera Video Amplifier In figure 3, the addition of the 4.7 Kohm resistor prevents excessiv* power dissipation in the 33-volt zenei TO B FIG 3 diode.
Figure 1 also shows how the com bined picture and graphics image maj 0.47 f i F § 1.2K be sent to some external device such a; an external video display or video tape BRIGHTNESS recorder. The video amplifier of figure i 1K TO A & IN914 FIG 3 buffers the video signal from the televi ON5022 sion camera and the HUH Video Buffei r (HUH Electronics, 1429 San Mateo, CA 94402) develops a composite sync 2 IN914 signal from the PET sync signals. Ax A IN914 alternative suitable circuit for the lattei CAMERA _ 560 is given in The PET Revealed, by Nick VIDEO 0°-----f — -SAA(— 2N3725 INPUT V ' Hampshire, page 86. £822 OFF A ON ITi Reference »------u TOC FIG 3 "A Computer-Based Camera Con trol System,'' by A. Roberts and P. Hiscocks, Photogrammetric Engineer ing and Remote Sensing, Vol. 47, No. 1, Jan. 1981, pp. 53-57. Figure 5; Video Ampllfer
Peter Hiscocks is an instructor at Ryerson Polytechnical Institute, where he teaches courses in Electrical and Theatre technology. He is a columnist for Audio/ COMPOSITE Video Canada, builds computer interfaces ' VIDEO on a freelance basis, and is currently working on a computer-controlled sound system for the reproduction of insect sounds at the Royal Ontario Museum. He may be contacted at Electrical Dept., Ryerson Polytechnical Institute, 50 Gould St., Toronto, Canada M5B 1E8.
Q1 2N4401 OR EQUIVALENT JSMCftO
12 MICRO - The 6502/6809 Journal No. 52 - September 1982 from SubUDGIC... quality software for your Apple II.
A2-FS1 FLIGHT SIMULATOR Combines superior flight simulation with the best animated 3D graphics available. Practice take-offs and landing, other aerial maneuvers, declare war on the enemy. 16K cassette, $25.00. 32K disk, $33.50.
i i f l A2-PB1 PINBALL -T h e ultimate arcade simulation program, an exciting pinball game with the ball and f||pper precision to make increased skill pay off. Includes 10 different play modes and 100 user- adjustable modes. 48K disk, $29.95.
A2-SG1 ESCAPE! - The simple game of captive III ji ! f E f .C K'-.f I 1. pursuit. A gem for game purists ... A classic for your game collection. 48K disk, $29.95.
See them today at your dealer... KfeLOGIC Communications Corp. 713 Edgebrook Drive or for direct orders add $1.50 andspecify UPS or first class mail. Illinois residents add 5% sales tax. VISA and Champaign, IL 61820 MasterCard accepted. Descriptive brochures of most (217) 359-8482 products listed here are available on request Telex: 206995 “Apple" Is the registered trademark of Apple Computer Inc. A/D Conversion Using a 555 Timer 1C
by Mike Dougherty
For applications not requiring resistance to be measured should cover capacitor, C]. For each single pulse, pin high-speed analog to digital this range. Often it is difficult for the 3 remains at a low voltage for a time, conversion, this simple 555 hobbyist to find a resistive sensor with tL, proportional to Ri. Pin 3 remains at Timer circuit yields a high this full range. Secondly, even if such a a high voltage for a time, tH, propor dynamic range for very low cost. resistive sensor is found, the Atari tional to R] + R2. Specifically, these Although demonstrated with an hardware can only resolve one part in times are defined: 228. This yields an effective A/D con Atari 800, this 555 A/D converter version of LOG2(228J = 7.8 bits. There tH = 0.693 (Rx + R2| (Ci) seconds may be used by any computer are many applications which could use system with one unused bit on finer resolution or greater dynamic tL = 0.693 (Ri) (Ci) seconds an input port. range. Thus, as the resistive sensor R2 varies, This article discusses the use of an the time that the pulse is high also These programs require: inexpensive 555 Timer circuit, the soft varies. Atari 800 ware required to digitize the 555 out 555 Timer 1C put, and software designed to display By attaching 555 pin 3 to an input and other electronic the 555 Timer waveform on the Atari pin on a parallel port, the length of time 800. Although the Atari 800 is used to that the pulse is high may be measured components demonstrate the 555 Timer circuit, the by computer clock speed. In the astable general principles may be applied to mode, only a single input line is re The Atari 800 already contains hard any 6502-based computer. quired to digitize R2. ware capable of digitizing a resistive sensor, such as a thermistor or photo Hardware The circuit of figure 1 was powered resistor, through a game controller through the joystick #4 controller jack. jack. During each video scan, the The 555 Timer is available from Pin 7 of joystick #4 supplies the + 5 resistance of each paddle is measured Radio Shack in an eight-pin DIP volt source, while pin 8 is the Atari by a custom-designed LSI chip called package for approximately $1 (Radio ground. With the Atari 800 providing POKEY. At the end of a video scan, the Shack part number 276-1723). This ap the + 5V power source through the con Atari Operating System reads the plication uses the 555 as a free-running troller jack, a random variability up to POKEY registers and places the digi astable multivibrator, shown in the cir 10% was observed. This error was tized values in the paddle shadow cuit of figure 1. In this mode of opera eliminated with the addition of a filter registers in memory. These values are tion, the 555 outputs a TTL-compatible ing capacitor, C2, across the + 5V accessed through the PADDLE ( ) pulse stream on pin 3. The waveform of source and ground. function of BASIC. the pulse stream is determined by the external resistors, Ri and R2, and the Software Since the POKEY digitization is done by hardware and the shadow regis One simple approach to measuring ters are maintained by the operating the high portion of the pulse is outlined system, this analog to digital conver by the "pseudocode” in listing 1. sion method is easy to use. Simply replace the paddle controller with the The first two DOWHILE loops desired resistive sensor and obtain the allow the pseudocode to synchronize digitized result via the proper PAD with the free-running 555 pulse stream. DLE! ) function. The actual A/D con In the worst case, this synchronization version will be performed auto will take 0.693(2Ri + R2) (C!) seconds. matically by the hardware and updated Because of this relationship, R2 was by the operating system every l/60 th chosen as the resistive sensor and Ri of a second. was made as small as possible. Thus the time that a pulse is low is kept constant As straightforward as this approach by Ri and is only long enough for the seems, there are two major disadvan first and third DOWHILE loops to recog tages. First, the Atari 800 hardware was nize the zero level of the 555 output. designed for the 1MQ potentiometer used in the paddle controller. To fully The time represented by each count utilize the Atari hardware, the variable is determined by the length of the third
14 MICRO - The 6502/6809 Journal No. 52 - September 1982 DOWHILE loop and the specific delay utilized. Typically, the exact length of Listing 1: Pseudocode A/D Conversion the third DOWHILE loop is not impor tant since most applications will re BEGIN Pulse; quire a series of calibrations to map the initialize COUNT to zero; digitized counts onto the physical DOWHILE line is not equal to zero; quantity being measured. In practice, read 1/O port; the third DOWHILE loop is written to logically "AND" with MASK to isolate 555 line; execute as fast as possible. If this is not END WHILE; fast enough, then the value of capacitor DOWHILE line is equal to zero; Ci is increased. By controlling both the read 1/O port; measuring loop and the capacitor value logically "AND” with MASK to isolate 555 line; of Ci, a wide range of resistive sensors ENDWHILE; may be utilized. DOWHILE line is not equal to zero; increment COUNT by one; As an example, the 6502 assembler delay; subroutine in listing 2 demonstrates a read I/O port; 19-cycle timing loop. With a 1 MHz logically "AND” with mask to isolate 555 line,- clock, this loop will sample the input ENDWHILE; line, bit 0 of PORT, every 19 micro END Pulse. seconds. Assume that Ci is 0.1 pF, Ri is fixed at 2KS, and,the resistive sensor covers the range from 2KQ to 700KQ Listing 2: Sample 6502 A/D Conversion Subroutine
(the practical range of the paddle game "1.0 0 ) ; i ; < > i / ) I i i > ; t i I / t i 1 controllers). Then tH will vary from 0110 • 0.2777 ms at 2KQ to 48.6 ms at 700KQ 0120 * LIGTIMG * 2 0130 ? with the digitized count varying from 0110 I SAMPLE 65 02 SUBROUTINE TO COUNT COUNT =15 to COUNT = 2558, a 0150 ! THE NUMBER OF LOOP S THAT BIT0 OF range of 2543 counts. The worst case 0160 * I/O PORT IS HIGH, THE RESULT IS time to synchronize and take the sam 0170 J LEFT IN ZERO PAGE MEMORY. THE 0130 ; COUNTING LOOP CONTAINS "DELAY" ple at the maximum resistance is 2tH + 0190 t INSTRUCTIONS TO MAKE THE LOOP tL = 97.5 ms, or approximately l/10th 0 20 0 ? EXECUTION TIME 1? CYCLES. of a second. 0210 ♦ 0220 r t > > » f > > > t > i 1 i t t t > ! > t t » 0230 If a longer delay may be tolerated, 0240 * then Ci may be increased to 1/iF. In this [>301 0250 PORT *D301 PORTB OF ATARI 0 004 0260 COUNT = fD't ZERO PAGE RESULT BUFFER case, tH will vary from 2.77 ms to 486 0270 ♦ ms with the digitized count varying 0 0 00 0280 $060 0 ATARI FREE MEMORY from 146 to 25579, a range of 25433 0290 ) 0 AO 0 A900 0300 PULSE LDA ♦too INIT Y,X AS COUNT counts. Thus the 0.1 /jF capacitor gives 0602AA 0310 TAX THIS IS FASTER a digitized dynam ic range of 0603 AEi 0320 TAY THAN MEMORY LOG2(2543) = 11.3 bits; the 1.0 jiF 0330 capacitor gives a dynamic range of 0340 *, SYNCHRONIZE WITH 555 PULSE STREAM 0 35 0 t LOG2(25433) = 14.6 bits. If time is not 0604 AD01D3 0360 SYNCHI LDA PORT INPUT ALL 8 LINES a critical factor, the 555 approach 0607 2901 0370 AND *toi MASK TO ONLY BIT0 allows high dynamic range for very low 060? D0F9 0380 BNE SYNCHI STILL HIGH, WAIT TILL LOW 0390 cost. 0 6 0 E-: AD01D3 0400 SYNCLO LDA PORT INPUT ALL 8 LINES 0 60ET. 2901 0410 AND **01 MASK TO ONLY BITO 0610 F0F9 0420 BEQ SYNCLO STILL LOW, WAIT TILL HIGH » Atari 800 Considerations 0430 t 0440 ; COUNT * LOOPS PULSE IS HIGH The approach outlined in the 0450 > 0612 E8 0460 CNTLP INX COUNT THIS TIME IN LOOP previous sections may be implemented 0613 D00C 0470 BNE NOCARY NO CARRY TO MSB on the Atari after dealing with two 0615 C8 0480 INY ADD CARRY TO MSB operating system problems. Although 0616 El A 0490 NOP DELAY FOR 4 CYCLES these problems are specific to the Atari, 0617 e:a 0500 NOP 061B AD01D3 0510 LDAPORT INPUT I/O PORT other computer systems may have 061E1: 2901 0520 AND **01 ISOLATE BITO similar difficulties. 061D D0F3 0530 BNECNTLP STILL HIGH -- COUNT ON 061F F0 0A 0540 BEQ RETURN WRAP IT UP 0550 ; The Atari computer system drives 0621 FA 0 56 0 NOCARY NOP DELAY FOR 5 CYCLES the video display through direct 0622 A5FF 0570 LDA*FF memory access (DMA). A sophisticated 0624 ADO 103 0580 LDA PORT INPUT I/O PORT approach utilizing the custom-designed 0 627 2901 0590 AND **01 ISOLATE BITO 062? D0E7 0600 BNE CNTLP STILL HIGH — COUNT ON LSI chips, called ANTIC and CTIA, 0610 t provides the graphics versatility of the 0620 ; RESULT IN Y,X REGI STER PAIR Atari. To optimize the video perfor 0630 ; mance, the Atari has a basic clock 062B B6D4 0640 RETURN STX COUNT SAVE IN ZERO PAGE 0 6 2D 8405 0650 STY COUNT+1 speed of 1.79 MHz rather than the more 0 62F 60 0660 RTS common 1 MHz. However, the actual 063 0 0670 .END speed of program execution depends
No. 52 - September 1982 MICRO - The 6502/6809 Journal 15 upon the amount of “ cycle stealing” DMA activity required to run the video Listing 3: Atari USR Function A/D Conversion screen. As the graphics mode uses more memory to define the video screen, more DMA data transfers are required U1UU I,,,,,,,,,,,,,,,,,,.,,,,,,,,,,,,, 0105 to refresh the screen. Thus a program 0110 LISTING * 3 will execute slower under GRAPHICS 8 0115 mode than under GRAPHICS 0 mode. 0120 ATARI USR FUNCTION TO COUNT THE In addition, for graphics modes com 0125 LOOPS WHICH A 555 PULSE IS HIGH. 0130 THE STEPS PERFORMED ARE I bined with text (e.g. GRAPHICS 8), the 0135 DMA rate will differ between display 0140 1) TURN OFF DMA SHADOW REGISTER ing the graphics portion and the text 0145 2) WAIT FOR VBLANK TO TRANSFER portion of the screen. This variable rate 0150 THE SHADOW REG TO HARDWARE 0 155 3) DISABLE THE VBLANK INTERRUPT DMA affects the effective speed of the 0160 4) SYNCHRONIZE WITH THE 555 counting loop used to measure the 555 0165 PULSE STREAM WITH 2 LOOPS pulse width. 0170 5) COUNT THE NUMBER OF LOOPS 0175 THE PULSE IS HIGH 0180 6) SAVE THE RESULTS IN THE ZERO Fortunately, there is a simple solu 0185 PAGE USR RETURN LOCATIONS, tion to the DMA problem — turn the 0190 RESET VBLANK AND DMA 0195 DMA off. You can disable the DMA by 0200 writing a zero in the DMA shadow 0205 USAGE! C0UNT=USR(1696,LINE) register, SDMCTL, located at $022F in 0Z10 memory. This value is transferred to 0Z15 WHERE LINE IS THE MASK TO 0Z20 ISOLATE THE BIT CONNECTED the DMA controller register by the 02Z5 TO THE 555 PULSE STREAM. operating system during the VBLANK 0230 UPON RETURN, COUNT WILL interrupt routine, every l/6 0 th of a sec 0Z35 CONTAIN THE DIGITIZED VALUE. ond. (VBLANK is the interrupt routine 0240' 0245 executed after every complete video 0250 scan. The Atari Operating System uses 0Z55 VBLANK to update the system time, OZZF 0Z60 DMASR = *022F DMA SHADOW REGISTER input the game controller reigsters, D40E 0265 NMIEN = *D40E NMI ENABLE REGISTER D301 0270 PORT = *D301 PORTB - - JOYSTICK *3,*4 transfer shadow registers to and from 0014 0275 RTC = *0014 LSB OF REAL TIME CLOCK hardware, and other housekeeping 00D4 0280 USRRET = *0 0D4 USR RETURN ADDR tasks.) Thus to turn off the DMA, 00D1 0285 LINE = *00D1 STORAGE FOR LINE MASK 0290 simply POKE a zero into memory loca 0295 tion $022F and wait for the system 0000 0300 *= *06A0 FREE MEMORY IN PAGE 6 clock to change (low order byte at 0305 $0014). Since VBLANK updates the 06A0 68 0310 ATOD PLA * OF USR ARGUMENTS 06A1 68 0315 PLA HIGH ORDER OF LINE clock, the change in the system clock 06AZ 68 0320 PLA LOW ORDER OF LINE value indicates that VBLANK has ex 06A3 85D1 03Z5 STA LINE SAVE 8 BIT LINE MASK ecuted and the DMA shadow register 0330 0335 TURN OFF DMA SHADOW REGISTER has been transferred to the DMA hard 0340 ware. To restore the DMA, POKE a $22 06A5 A900 0345 LDA **00 (decimal 34) to the DMA shadow 0 6A7 8D2F02 0350 STA DMASR CLEAR SHADOW REGISTER register at memory location $022F. 06AA AA 0355 TAX INITIALIZE REGS FOR COUNT 06AB A8 0360 TAY 0365 The second problem concerns the 0370 WAIT FOR VBLANK INTERRUPT actual time taken to execute VBLANK. 0375 A typical 555 digitization time was 06AC A514 0380 LDA RTC CURRENT LSB OF RTC 06AE C514 0385 RTCWAT CMP RTC SEE IF RTC HAS CHANGED about a tenth of a second or longer. 06B0 F0FC 0390 BEQ RTCWAT NOT YET, WAIT During this digitization, VBLANK 0395 could interrupt several times. Since 0400 DISABLE VBLANK INTERRUPT 0405 processor time would be spent ex 06B2 A920 0410 LDA **Z0 ecuting the VBLANK routine instead of 06B4 8D0ED4 0415 STA NMIEN CLEAR BIT6 OF NMIEN counting, the digitized value would be 0420 too low. In addition, the short low 0425 SYNCHRONIZE TO 555 PULSE STREAM 0430 period of the pulse could occur during 06B7 AD01D3 0435 SYNCHI LDA PORT INPUT ALL 8 LINES VBLANK execution and be missed by 06BA 25D1 0440 AND LINE ISOLATE 555 BIT the counting subroutine. The counting 06BC D0F9 0445 BNE SYNCHI STILL HIGH, WAIT 0450 subroutine would erroneously continue 06BE AD01D3 0455 SYNCLO LDA PORT INPUT ALL 8 LINES until a low pulse was recognized. 06C1 25D1 0460 AND LINE ISOLATE 555 BIT 06C3 F0F9 0465 BEQ SYNCLO STILL LOW, WAIT 0470 The Atari designers anticipated this 0475 DIGITIZE TIME THAT PULSE IS HIGH type of problem also. Although the 0480 VBLANK interrupt is connected to the 0 6C5 E8 0485 CNTLP INX COUNT THIS TIME IN LOOP 06C6 DO 0C 0490 BNE NOCARY NO CARRY TO MSB OF COUNT 6502 non-maskable interrupt line, 06C8 C8 0495 INY CARRY TO MSB OF COUNT NMI, external hardware was provided 06C9 A5FF 0500 LDA *FF DELAY 3 CYCLES to allow an Atari program to disable (Continued) this NMI interrupt before it reaches the
16 MICRO - The 6502/6809 Journal No. 52 - September 1982 Table 1: Atari 800 PORTB Pinouts Listing 3 (Continued) PORTB Bit Joystick Pin# Mask 06CE: AD01D3 0505 LDA PORT INPUT I/O PORT 06CE25D1 0510 AND LINE ISOLATE 555 BIT 0 #3 1 1 06D0 D0F3 0515 BNE CNTLP STILL HIGH — COUNT ON 1 #3 2 2 06D2 F0 09 0520 BEQ RETURN t LOW WRAP IT UP 2 #3 3 4 0 525 t 4 8 06D4 e:a 0530 NOCARY NOP DELAY 4 CYCLES 3 #3 06D5 EA 0 535 NOP 4 #4 1 16 06D6 AD01D3 0540 % LDA PORT INPUT I/O PORT 5 #4 2 32 06D9 25D1 0 545 AND LINE ISOLATE 555 BIT 6 #4 3 64 06D6 D 0 E. 8 0 55 0 BNE CNTLP STILL HIGH — COUNT ON 7 #4 4 128 0 555 0560 SAVE RESULTS, RESTORE HARDWARE 0565 6502 chip. This interrupt line is con 0 6DD 86D4 057 0 RETURN STX USRRET USR RESULT BUFFER 06DF 84D5 0 575 STY USRRET+1 trolled by bit 6 of the hardware register 06E1 A960 0580 LDA *$60 SET BIT6 OF NMIEN NMIEN at location $D40E. Clearing bit 06E3 8D0ED4 0585 STA NMIEN TO ENABLE VBLANK AGAIN 6 of NMIEN disables the VBLANK in 06E6 A922 0590 LDA *$22 terrupt; setting bit 6 of NMIEN enables 0 6F.8 8D2F02 0 595 STA DMASR ENABLE DMA THRU VBLANK 06EE: 60 0600 RTS BACK TO BASIC the VBLANK interrupt. A word of cau 06EC 060; .END tion: this register also controls other in terrupts. To disable the VBLANK inter rupt, POKE a $20 into NMIEN; to Listing 4: USR Function to Trace Atari Port B enable the VBLANK interrupt, POKE a $60 into NMIEN. 0100 0105 A BASIC callable USR function to 0110 LISTING * 4 0115 sample an input pin of PORTB, 0120 ATARI USR FUNCTION TO SAMPLE joystick #3 and #4, is given in listing 3. 0125 AND STORE THE VALUE OF PORTE:, The USR argument is used to mask the 0130 JOYSTICK *3 AND *4. THE STEPS 0135 PERFORMED ARE! 8-bit I/O port to the single I/O line at 0140 tached to the 555 pulse stream of pin 3. 0145 1) INITIALIZE The pinouts for PORTB and associated 0150 2) DISABLE DMA AND VBLANK masks are outlined in table 1. 0155 3) IN 256 BYTE BLOCKS, SAMPLE 0160 AND STORE PORTE: 0165 4) RESTORE VBLANK AND DMA TRACE 0170 0175 0180 USAGE! X=USR(1536,ADR(DATA*>) To test the 555 circuit, a simple 0185 program was written to trace the 0190 WHERE DATA* IS A STRING VARIABLE PORTB input lines and store the results 0195 DIMENSIONED TO BE 1024 BYTES in memory to be later plotted on the 0200 IN SIZE TO HOLD THE ACTUAL. 0205 F'ORTB VALUES. screen. This program, TOACE, takes a D210 trace of 1024 samples and plots the 0215 results in GRAPHICS 8 mode via the 0220 0 22.5 two USR functions in listings 4 and 5. 0 0CB 0230 ADDR = $0 0CB STORAGE FOR DATA ADDR TRACE also uses the USR function of D301 0235 PORT = $D301 ATARI PORTE: listing 3 to allow the pulse stream to be 0014 0240 RTC = $0 014 LSB OF REAL TIME CLOCK digitized. The BASIC program is 022F 0245 DMASR — $022F DMA SHADOW REGISTER D40E 0250 NMIEN = $D40E NMI ENABLE REGISTER presented in listing 6. 0255 t 0260 t TRACE allows any input pin of 0 0 0 0 0265 * = $0600 FREE ATARI RAM 0270 PORTB to be sampled and plotted. The 0275 ! INITIALIZE TRACE specific line is determined by the value 0280 of the bit mask variable, LINEMASK. 0600 68 0285 TRACE PLA * OF USR ARGUMENTS Refer to table 1 for the PORTB pinouts 0601 68 0290 PLA 16 BIT DATA BUFFER ADDR 0602 85CC 0295 STA ADDR+1 MSB OF DATA* and corresponding mask values. 0604 68 0300 PLA 0605 85CB 0305 STA ADDR LSB OF DATA* The loops used to perform the A/D 0607 A0 0 0 0310 LDY *$00 INDIRECT INDEXED POINTER conversion and to trace the waveform 0609 A204 0315 LDX **04 FOUR BLOCKS OF 256 SAMPLES 0320 t* take 19 cycles. However, TRACE does 0325 ! DISABLE DMA AND VBLANK contain one timing error. The trace 0330 > function breaks the 1024 samples into 060B A900 0335 LDA **00 four blocks of 256 single byte samples. 060D 8D2F02 0340 STADMASR TURN OFF SHADOW REGISTER 0610 A514 0345 LDARTC WAIT UNTIL VBLANK INTERRUPT This is because the 6502 indirect indexed 0612 C514 0350 RTCWATCMPRTC NEW RTC VALUE ? addressing mode handles 256-byte 0614 F0FC 0355 BEQ RTCWAT NOT YET, WAIT blocks quickly and conveniently. The 0616 A920 0360 LDA **20 YES, DISABLE VBLANK 0618 8D0ED4 0365 STANMIEN CLEAR BIT6 OF NMIEN extra clock cycles between each 0370 , 256-byte block were preferred over 0375 ! TAKE TRACE IN 256 BYTE BLOCKS slowing down the basic loop simply to 0380 ' (Continued) sample all trace points at equal time intervals.
No. 52 - September 1982 MICRO - The 6502/6809 Journal 17 The plot of the trace is done by a USR function simply to make TRACE Listing 4 (Continued) more convenient to use. The short marks displayed to the left of each 061E: EA 0 385 CQLLCT NOP LOOP MUST BE 19 CYCLES 256-byte trace segment indicate logic 1 061C EA 0390 NOP TD MATCH A/D CONVERSION and 0. 061D AD01D3 0 395 LDAPORT SAMPLE PORTB 0620 91CB 0100 STA(ADDR),Y SAVE IN DATA$ These techniques form the basis for 0622 C8 0105 INY NEXT MEMORY LOCATION measuring physical quantities through 0623 D0F6 0110 BNE COLLCT FOR 256 BYTES 0625 E6CC 0115 INC ADDR+1 POINT TC) NEXT MEM PAGE: resistive sensors inexpensively. With 0627 CA 012.0 DEX ALL FOUR BLOCKS ? very simple circuits much of the world 0628 D0F1 0125 BNE COLLCT NO, SAMPLE NEXT BLOCK may be sensed by youi computer. 0130 » 0135 J RESTORE ATARI VBLANK AND DMA 0110 ; References 062A A960 0145 LDA *$60 RESET BIT6 OF NMIEN 062C 8D0ED4 0450 STANMIEN ALLOW VBLANK INTERRUPT 1. Lancaster, Don, "TTL Cookbook," 0 62F A922 0455 LDA *$22 SET DMA SHADOW REGISTER 0631 8D2F02 0160 STADMASR LEET VBLANK SET HARDWARE Howard W. Sams & Co., Inc., Indi 0631 60 0465 RTS BACK TO BASIC anapolis, Indiana. Copyright 1978. 0635 0470 • END
2. Mims in, Forrest M., "Engineer's Notebook, Integrated Circuit Appli cations," Radio Shack, USA. Copy L isting 5: USR Function to Plot Trace Data right 1979. 0100 i t * * t t t t » t t t t t t t t t t . t t t t t > * t 0105 0110 LISTING * 5 Mike Dougherty currently works at 0115 Martin Marietta Aerospace in Denver, 0120 ATARI USR FUNCTION TO PLOT A Colorado. His home-based system 0125 256 BYTE LOGIC GRAPH FROM BIT presently consists of an Atari 800 with 0130 NUMBER "LINE" OF THE DATA, 24K bytes of memory, the Atari 410 0135 recorder, and the Atari 850 Interface 0140 u s a g e : Module for future communication with 0145 X=U SR( 1600 ,data,one,zero,1i ne) 0150 single board computers. Address 0 155 WHERE: correspondence to 7659 West Fremont 0160 data IS THE ADDRESS OF THE 256 Ave., Littleton, CO 80123. 0165 BYTES OF DATA TO BE PLOTTED 0170 one IS THE LEFT HAND ADDRESS OF 0175 THE LOGIC HIGH LINE 0180 zero IS THE LEFT HAND ADDRESS OF 0185 THE LOGIC LOW LINE 0190 line IS THE MASK TO ISOLATE: THE 0195 SPECIFIC BIT OF data TO BE 0200 PLOTTED Jntrrrating l^nfturai? ^ 0205 0210 0215 THE FOLLOWING STEPS ARE PERFORMED! p r*a « nta 0220 0225 1) INITIALIZE 0230 2) FOR EACH BYTE OF DATA! OSI C4P-MF SOFTWARE 0235 ISOLATE BIT "LINE" 02.40 IF BIT = 0 THEN 0245 SET BIT IN ONE LINE 0250 ELSE 0255 SET BIT IN ZERO LINE 0260 ENDIF 0265 ROTATE THE MASK PATTERN RIGHT 0270 IF ALL 8 BITS THEN 0275 RESET THE MASK 0 280 INCREMENT THE GRAPH INDEX 0285 ENDIF 0290 02.95 NOTE*. DUE TO THE WAY THE GRAPHICS 0300 SCREEN IS ADDRESSED, THE La BLES 0305 ONE AND ZERO SEEM BACKWARD. 0310 0315 THE MOST EXTENSIVE 010 A0VENTIJRE/FANTASY 0320 t t t t FOR THE OS I ! YOU MUST TRAVEL THROUGH THE EVIL LANDS OF ISIERON. FIGHTING A«0 0 325 K IL L IN G MONSTERS AN0 MAGIC-USERS EVERY 0330 STEP OF THE UAYt YOUR 00AL IS TO SEEK 0 0CB 0335 DATA OUT CERTAIN TREASURES THAT U IL L ALL0U $0 0CB FOR DATA ADDR STORAGE YOU TO FREE THE LAND FROM THE E V IL CHAIN 0 OCD 0340 ONE $0 OCD FOR LOGIC HIGH ADDR STORAGE OF MAGIC CASTLES! COMPLETE U ITH FULL 00CF 0345 ZERO $0 0CF FOR LOGIC LOW ADDR STORAGE GRAPHICS 01 SPLAY. COLOR ANO SOUNO! 00D1 0350 LINE 10 0D1 BIT MASK INCLUDES A COMPREHENSIVE MANUAL. ALL 06FF 0355 DINDEX = $06FF DATA INDEX THIS FOR ONLY...... » 2 » .9 3 06FE 0360 GINDEX = $06FE GRAPH INDEX 06FD 0365 MASK t06FD TO SET BIT IN GRAPH 0370 SENO TOl SEND 11 FOR OUR 0375 INTERESTING SOFTWARE CATALOG OF THE 21101 S . HARVARD BLVD. FINEST O SI-C 4P 0 0 0 0 0380 *= $0640 FREE ATARI RAM TORRANCE. CA 9 0301 r e SOFTWARE... 0385 0390 INITIALIZE 0395 (Continued)
18 MICRO - The 6502/6809 Journal No. 52 - September 1982 Listing 5 (Continued)
0640 68 0400 PLOT PLA * OF USR ARGUMENTS 0641 68 0405 PLA GET DATA ADDRESS 0642 85CC 0410 STA DATA+1 MSB PROFESSIONAL 0644 68 0415 PLA WORD PROCESSOR 0645 85CB 0420 STADATA LSB 0 647 68 0 425 PLA GET ONE LINE ADDRESS ' Double Columns ' Page by Paragraph Right Justification ^ Line Centering 0648 85CE 0430 STA ONE+1 MSB ' Printer Graphics ' Shorthand 064A 68 0435 PLA ' Variable Line Space ' Margin Control 0 64E: 85CD 0440 STAONE LSB ' Printer Control Code ' Form Letters 064D 68 0445 PLA GET ZERO LINE ADDRESS 064E 85D0 0450 STA ZERO+1 MSB FOR APPLE/PET/CBM 0650 68 0455 PLA COPYWRITER op 0651 85CF 0460 STAZERO LSB 0653 68 0465 PLA GET PORTB LINE MASK only $185.00 0654 68 0470 PLA ONLY 8 BIT VALUE 0655 85D1 0475 STALINE LSB EXCHANGE DATA w IBM 3740 0657 A900 0480 LDA **00 PEDISK II 877 FLOPPY DISK Sys 0659 8DFF06 0485 STA DINDEX INIT DATA INDEX tem s can now read and w rite records 065C 8DFE06 0490 STA GINDEX INIT GRAPH INDEX from IBM “Basic Data Exchange” 065F A901 0495 LDA **01 type diskettes. FILEX software from 0661 8DFD06 0500 STAMASK GRAPHICS BIT POSITION WILSERVE does all the work! Con- 0505 ; ‘"verts EBCDIC - ASCII. 0510 ; PLOT EACH BYTE OF THE 256 BYTE EXCHtfUfi® System (877/FILEX) ...... $1295. "0515 ; BLOC! OF DATA PEDISK 877-1 8’ Floppy for PET ...... $ 995. 0520 ; PEDISK 540-1 5’ Floppy for PET...... $ 595. 0664 ACFF06 0525 PLOTLP LDY DINDEX DATA INDEX CONTROLLER BOARD w POOS...... $ 229. 0667 B1CB 0530 LDA (DATA)tY GET BYTE OF DATA PEDISK II is a high performance floppy disk 0669 25D1 0535 AND LINE ISOLATE TO SINGLE BIT system designed-for the Commodore PET/CBM, Rockwell AIM and Synertek SYM. It features high 0 66B DO 0C 0540 BNE NE0 PLOT <> 0 VI.AUE 0545 performance, simple reliable design and IBM for t mat. 066D ACFE06 0550 LDYGINDEX GRAPH INDEX 0670 ADFD06 0 555 LDA MASK CURRENT BIT POSITION SOFTWARE FOR PEDISK II 0673 11CD 0560 ORA (ONE),Y SET BIT COPYWRITER Pro Word Processor ...... $185. 0675 91CD 0 565 STA(ONE),Y REPLACE IN GRAPH MAE Macro Assembler Editor by EHS ...... $170. 0677 D00A 0570 FLEXFILE II Data Base Manager ...... $ 80. BNENEXT BRANCH ALWAYS PAPERMATE Word Processor ...... $ 60. ; 0 575 DISK UTILITY P A C K ...... $ 25. 0679 ACFE06 0580 NE0 LDY GINDEX GRAPH INDEX FASTFILE Data Base...... $100. 0 67C ADFD06 0585 LDAMASK CURRENT BIT POSITION FILEX IBM A ccess R o u tin e s ...... $245. 067F 11CF 0590 ORA (Z E R O ) , Y SET BIT MENU L O A D ...... $ 10. 0681 91CF 0595 STA (ZERO),Y REPLACE IN GRAPH fu llF O R T H + ...... $100. 0600 ; 0683 18 0605 NEXT CLC ROTATE MASK THRU CARRY Commodore Communicates! 0684 6EFD06 0610 ROR MASK NEXT BIT IN GRAPH COMPACK $129. 0687 DO 04 0615 BNE SKIP 0689 6EFD06 0620 ROR MASK ROTATE INTO BIT7 Intelligent Teminal Package 0 68C C8 0625 INY PLOT TO NEXT GRAPH BYTE including: ACIA based interface 068D 8CFE06 0630 SKIP STYGINDEX RESTORE GRAPH INDEX DB25 cable 0690 EEFF06 0635 INC DINDEX NEXT BYTE OF DATA STCP software 0693 D0CF 0640 BNEPLOTLP FOR ALL 256 BYTES ' Remote Telemetry XON-XOFF Control 0695 60 0645 RTS RETURN TO BASIC ‘ Transfer to/fr Disk v User Program Cntl 0696 0650 .END ‘ Printer Output v Status Line $139 COLOR CHART AIM/SYM system video display, 64 x 16 Listing 6: BASIC Program TRACE characters, 8 colors, plugs into ROM socket, 4K RAM Multiple modes; semi 1 RF.M ------TRACE------graphics, alpha. 2 REM - PET/CBM color graphic display, 1 28 x 3 REM - L.ow Resolution Loqic Analyser 192 pixels, generate color bar graphs 4 REM - and 555 Tiner A/D Converter on one screen with data on main 5 REM - screen. RS170 video color chart. 6 REM - by Mike Dougherty 6847 based video output. 7 REM - COLOR VIDEO FOR PET/CBM/AIM/SYM 8 R E M ------9 REM ROMSWITCH - 4 ROMS IN 1 1110 DIM BYTE*(2),DATA*<1024) SPACEMAKER $39.95 1115 TRAP 2000 tREM WHEN ALL. USR FUNCTIONS HAVE BEEN POKED Switch 4 ROMs into the same socket. 1120 READ ADDRtREM STARTING ADDRESS OF CODE A slide switch activates one of four. 1130 FOR CDDE==0 TO 1 STEP 0 Electronic controls insure no glitches 1140 READ BYTE*!REM BYTE OF CODE and allow ROM switching under soft 1150 IF BYTE*-"**" THEN SOUND OfO.OiOJGOTO 1120iREM GET NEXT ware control. ROMs can be switched USR FUNCTION from the keyboard. 1140 GOSUB 1400!REM CONVERT BYTE*->BYTE fiillFORTH+ for APPLE/PET 1170 POKE ADDR,BYTE!REM PLACE IN MEMORY FULL FIG FORTH implementation plus 1175 ADDR-ADDR+1 conditional assembler, floating point, 1100 NEXT CODE string handling, multi-dimensional arrays, 1400 REM and disk virtual mamory. 1401 REM --- CONVERT BYTE* TO BYTE fullFORTH +■ from IDPC C o ...... $100. 1402 REM Target Compiler ...... $ 50. 1410 BYTE=0 1420 V=”ASC(BYTE*< 1) ) iGOSUB 1500 SEE YOUR DEALER OR: 1430 V“ASC(BYTE*<2))iGOSUB 1500 ^ P.O. Box 102 1440 RETURN M IC R O T E C H Langhorne, Pa. 19047 / 215-757-0284 150 0 REM (Continued) DEALER INQUIRIES INVITED
No. 52 - September 1982 MICRO - The 6502/6809 Journal 19
I Oealers w elcom e! E books ■ ■ and SOFTWARE For ATARI—PET—OSI—APPLE H -6602-VlC-20-«ne»»ir-,Rme* Listing 6 (Continued) ATARI ATARI ATARI ATARI ELCOMP FORTH - Enhanced FIG-FORTH on disk only. ATARI BASIC - Learning by Order No. 7055 839.96 1510 IF V<58 THEN BYTE=BYTE*16+Y-18 Using 1528 IF Y>57 THEN BYTE=BYTE*16+V-55 This new book is an "Action”- How to connect your EPSON- Book. You do more than read it. Printar to the ATARI 400/800. 1530 SOUND 0,BYTE,10,8 Learn the intricacy of ATARI- Construction article with printed BASIC thorugh the short programs circuit board and software. 1510 RETURN which are provided. The (Screenprint and variable charac 1600 REM suggestions challenge you to ters per line). change and write program Order-No. 7210 819.95 1601 REM ---SAMPLE THE PORT EVERY 19 routines. Yes, it's exciting - 1602 REM ---CYCLES AND STORE INTO Many of the programs are appropriate for beginners as well OS^S^S^OS^OSI 1603 REM -— THE BYTE ARRAY, DATA*. as experienced com puter users. (Screen Drawings, Special Sounds, Introduction to OSI computers. 1601 REM Keys, Paddles + Joysticks. Diagrams, hardware and software 1605 DATA 1536 Specialized Screen Routines, information not prwiously G raphics and Sound. Peeks and waitable in one compact source. 1610 DATA 68,68>85,CC,68>85,CB Pokes and special s tu ff t. 192 pages. O rd e rN o . 164 S9.95 Order-No. 157 87.95 1615 DATA A0,00,A2,01,A9,00,8D,2F,02 1617 DATA A5,11,C5,11,F0,FC ATARI Learning by Using — The Second Book of OHIO B ook + cassette or disk Order-No. 158 87.95 1625 DATA A 9 ,20,8 D ,OE,D1 This package includes the book No. 164 plus a cassette or disk The T h ird B o ok o f O H IO 1630 DATA EA,EA,AD,01,D3,91,CB (please specify) containing a Order No. 159 87.95 variety of the programs which 1635 DATA C8,DO,F6,E6,CC,CA,DO,F1 are listet in the book. The Fourth Book ol OHIO 1610 DATA A9,60,8D,OE,D1,A9,22 Order No.: 7220 S39.95 Order-No. 160 89.95 G m m (of the ATARI-Computer 1615 DATA 8D,2F,02,60 How to program your own games VIP Package - Above book plus 1695 DATA ** on the ATARI. Complete listings a cassette w ith the programs. in BASIC and Machine Language Order-No. 160A 819.95 1700 REM of exciting games. Tricks end hints. The Fifth Book of OHIO 1701 REM ---PLOT A ROW OF DATA* ON OrderNo. 162 8 7.95 Order-No. 161 87.96 1702 REM — THE SCREEN AS DEFINED GAME PACKAGE for the ATARI Invoice Writing Pro-am fo r OSI- 1703 REM — BY THE ARGUMENTS. Book + cassette or disk C1P M F, C4P. Disk and Cassette, Includes the book No. 162 plus 8K RAM . 1701 REM cassette or disk (please specify) Order-No. 8234 829.80 containing a variety of the pro 1705 DATA 1600 grams listed in the book. Mailing List for C1PMF or 1710 DATA 68 > 68 > 85,C C ,68 > 85,CB Order No. 7221 839.06 C4PMF 24K RAM A TM O N A -1 250 addresses Incl. phone number 1715 DATA 68,85,CE,68,85,CD Machine Language Monitor for and parameters on one 5 1/4 disk) 1720 DATA 60,85,DO,68,85,CF th e A T A R I 4 0 0/80 0. Order-No. 8240 829.80 This powerful monitor provides 8K Microsoft BASIC Ref. Man. 1721 DATA 68,68,85,D1 you with the firmware support Order-No. 151 89.95 that you need to get the most 1722 DATA A9,00,8D,FF,06,8D,FE,06 out of your powerful system. Expansion Handbook for 6602 1725 DATA A9,01,8D,FD,06 ATMONA-1 comes on a bootable and 6802 cassette. No cartridges required. Order-No. 162 89.95 1730 DATA AC,FF,06,B1,CB,25,D1 Disassemble, Memory Dump HEX 1735 DATA DO,OC,AC,FE,06,AD,FD,06 + ASCII, (Change Memory Microcomputer Appl. Notes Locations. Blocktransfer, fill Order-No. 153 89.96 1710 DATA 11,CD,91,CD,DO,OA m em ory b lo c k , save and load Compton Sound Generation machine language programs, start 1715 DATA AC,FE,06,AD,FD,06 New revised applications manual mach, Lang. Progr. (Printer for the Texas Instruments SN 1717 6ATA 11,CF,91,CF op tio n a l). 76477 Complex Sound Genera Comes with Introductionary to r. 1750 DATA 18,6E,FD,06,D0,01 article on how to program the Order-No. 154 86.96 ATARI computer in machine 1752 DATA 6E,FD,06,C8 language. (Available also in ROM) Small Business Programs 1755 DATA 8C,FE,06 Order-No. 7022 819.95 Complete listings for the business user. Inventory, Invoice Writing, 1757 DATA EE,FF,06,DO,CF,60 ATMONA-2 Superstepper Mailing List and much more. A very powerful Tracer to explore Introduction to Business Appli 1795 DATA ** the ATARI ROM/RAM area. Stop cations. 1800 REM at previously selected address. OrderNo. 156 81440 O pcode o r operand (cassette). 1801 REM ---SAMPLE A BIT DEFINED BY Order-No. 7049 849.95 Microcomputer Hardware Hand b o o k 1845 pages) 1802 REM ---THE ARGUMENT MASK AND EDITOR/ASSEMBLER for Descriptions, pinouts and specifi ATARI 800, 32K or 48K RAM cations of the most popular 1803 REM ---MEASURE THE TIME THE Extremely fast and powerful microprocessor and support chips. Editor/Assembler. (BK Source- 1801 REM — PULSE IS HIGH IN 19 CYCLE A MUST for the hardware buff. code in about S seconds) Includes Order-No. 29 ______8 1 4.96 1805 REM ---TIME UNITS. A T M O N A -1 . Order-No. 7098 S49.95 1806 REM Cara and Feeding of the MACRO-Assembler C om m odore P ET 1810 DATA 1696 for ATARI 800, 48K RAM Eight chapters exploring PET Please specify yo u r system: R A M , hardware. Includes repair artd 1812 DATA 68,68,68,85,01 disc o r cassette. interfacing information. Pro 1815 DATA A9,00,8D,2F,02,AA,A8 Order-No. 7099 S89.00 gram m ing tricks and schematics. Add 839.00 for cartrioge version Order-No. 160 86.95 1820 DATA A5,11,C5,11,FO,FC Prototype-Ex pension Board for G u nfrg ht - For ATAKI 400/800 1825 DATA A9,20,8D,OE,D1 16K RAM, needs twp joysticks, VIC-20 (S-44-Bus). Order-No. 4844 818.95 1830 DATA AD,01,03,25,01,DO,F9 animation and sound. (8K machine language). Wordprocessor f.VIC-20,8K RAM 1835 DATA AD,01,D3,25,01,FO,F9 Order-No. 7207 819.95 Order No. 4870 819.99 Mailing List for VIC-20,16kRAM 1810 DATA E 8 , DO , OC, C8 , AS , FF , AD , 01, D3 8irth control with the ATARI O rde r N o . 48 83 8 1 4.96 1815 DATA 25,D1,D0,F3,F0,09 (Knaus Q gino) Casa, or disk T ric k s fo r V IC s - T he V IC *t*ry Order No. 7222 829.96 Programs, hints and expansion 1850 DATA EA,EA,AD,01,D3,25,D1,D0,E8 Astrology and Biorhythm for information for VC-20 1855 DATA 86,D1,81,D5,A9,60 A T A R I (eaai. o r disk) Order No. 141 89.96 OrderNo. 7223 829.96 TIC TAC VIC 1860 DATA 8D,0E,D1,A9,22,8D,2F,02,60 O rde r N o . 48 80 8 9 .9 6 EPROM Cartridge KIT for ATARI G A M E P A C K I (3 Gemesl 1895 DATA ** Cartridge (bare board) with in* Order No. 4881 814.96 2000 REM structions (holds two 16K or two Dual Joystick Instruction 32K EPROMs (2716,2532,2732) O rder N o . 4 8 8 6 8 9 .9 6 2001 REM -REPEAT F0REYER! Order No. 7224 819.96 INPUT/OUTPUT Programming 2002 REM - INPUT THE LINE MASK TO Order No. 7043 complete 829.95 with your VIC Order No. 4886 89.96 2003 REM - CONTROL THE LINE SAMPLED; Invoice Writing for small 16K RAM/ROM board for 844- business with ATARI 400/800 2001 REM - SET UP SCREEN FOR TRACE! bus. Any combination of RAM 16K RAM . and ROM on one board. 2005 REM - DO UNTIL "ESCAPE" KEY*. O rder-N o. 70 22 . cess. 8 2 9 .8 5 (SY212B o r 2716) Order-No. 7200. disc. 89.99 Order-NO. 6 1 3 839.96 2006 REM - IF KEY = "A": Mailing-List No. 7213 824.95 Low coat expenison boards for 2007 REM - PERFORM A/D ON LINE Inventory Contr.No.7215 824.95 your AfTLE II. Bare board comes with extensive description and 2008 REM - DEFINED BY LINEMASK! NEW I A T E X T -1 softw are. 2009 REM - TURN OFF KEY! This new wordprocessor in 6522 VIA—I/O Exp. machine language (8K) for all 2010 REM - ELSE IF KEY = "C"! O rder-N o. 6 0 5 83 9 .0 0 ATARI 400/800 computers offers 2716 EPROM-Burner the best price performance ever. 2011 REM - PERFORM A/D ON LINE Order-No. 607 *49,00 23 editor control commands, 8 K E P R O M /R A M Card 2012 REM - DEFINED BY LINEMASK! 17 formatting commends, dyna O rder-N o. 6 0 9 8 2 9.00 mic formatting. Vertical and 2013 REM - ELSE IF KEY = "T": horizontal scrolling (up to 255 Software for SINCLAIR ZX-81 char, per line) Include command and TIMEX 1000 2011 REM - TURN OFF KEY! o n disk! Machine Language M onitor 2015 REM - DO A TRACE OF PORT! Order No. 7210 cassette 82 9 .9 5 Order No. 2399 89 .9 6 Order No. 7211 disk 8 3 9 .9 6 Mailing Lift 2016 REM - PLOT BIT DEFINED BY OrderNo. 7212 ca rtrid g e 8 7 9 .0 0 Order No. 2398 8 1 9 .9 6 8 AS IC and 2017 REM - LINEMASK! Leant FORTH for the ATARI machine language with 2018 REM - ENDIF! 400/800 cassette or disk ZX-81 (82) or TIMEX 1000. Order No. 7063 819.96 Order No. 140 (book) 89.95 2019 REM - ENDD05 ELCOMP Publishing, Inc., 53 Bedrock Lane 2020 REM -END REPEAT. Pomona, CA 91766, Phone: (714) 623 8314 2021 REM Peyment: Check, Money Order, VISA, Maatercherge. Eurochecfc. POSTPAID on PREPAID in USA. 86.00 bending fee for C.O.D. 2022 REM (Continued) All orden outside USA: Add 16% dripping. CA add 6.6% sales tax. 2110 GRAPHICS 0 A T A R I is a registered trad em ark o f A T A R I In c. A P PLE is a registered trademark of APPLE Inc. PET+VlC-20 is e trademark o f Commodore.
No. 52 - September 1982 20 MICRO - The 6502/6809 Journal Listing 6 (Continuedj 2120 POSITION 10,10!PRINT "Line M a s k " ! 2130 INPUT LINEMASK 2140 REM 2150 REM Scotch 2210 GRAPHICS 8!POKE 752,1 2220 SETCOLOR 1,6,11 2230 SETCOLOR 2,6,1 MEMOREX 2240 COLOR 1 2250 REM 2260 REM \ferbatim 2410 FOR L00p=0 TO 1 STEP 0 2415 F'RINT " T - trace A - A/D " 2420 IF PEEK(761)=63 THEN PRINT " T - trace A - A/D "; u a /d : "i USR ( 1696, LINE M A S K ) J P O K f: 764,255 maxell, 2421 IF PEEK<761>=28 THEN POKE 761,255:GOTO 20 0 0 2422 IF F'EEK (761 > = 18 THEN PRINT " T - trace A - A/D m ;"a /d : USR (1696, LINE MASK ) 2423 IF PEEK (761) 01 5 THEN 2120 BASF 2121 POKE: 761,255 2130 X=USR<1536,ADRMACHINE LANGUAGE SPEED WHERE IT COUNTS... IN YOUR PROGRAM!
Some routines on this disk are: Binary file info For the first time, Amper-Magic makes it easy for people who don’t know Delete array machine language to use its power! Now you can attach slick, finished machine Disassemble memory Dump variables language routines to your Applesoft programs in seconds! And interface them by nam e, not by address! Find substring Get 2-byte values You simply give each routine a name of your choice, perform the append pro Gosub to variable cedure once at about 15 seconds per routine, and the machine language becomes a Goto to variable permanent part of your BASIC program. (Of course, you can remove it if you want to.) Hex memory dump Up to 255 relocatable machine language routines can be attached to a BASIC Input anything program and then called by name. We supply some 20 routines on this disk. More Move memory can be entered from magazines. And more library disks are in the works. Multiple poke decimal Multiple poke hex These routines and more can be attached and accessed easily. For example, Print w/o word break to allow the typing of commas and colons in a response (not normally allowed in Restore special data Applesoft), you just attach the Input Anything routine and put this line in your program: Speed up Applesoft xxx PRINT “ PLEASE ENTER THE DATE.” ; : & INPUT,DATES Speed restore Store 2-byte values &-MAGIC makes it Easy to be Fast & Flexible! Swap variables PRICE: $75 Anthro - Digital Software P.O. Box 1385 Pittsfield, MA 01202 &*Magic and Amper-Magic are trademarks of Amhro-Digkal, inc. Applesoft is a trademark of Apple Computer, Inc. The People - Computers Connection
No. 52 - September 1982 MICRO - The 6502/6809 Journal 21 NEW FROM D & N MICRO PRODUCTS, INC. Z80A CPU with 4MHz clock and CP/M 2.2 aluminum with vinyl woodgrain decorativf operating system. 64K of low power static finish. 8 slot backplane for expansion. 4i RAM. Calendar real time clock. Centronics pin buss is compatible with most OS type parallel printer interface. Serial inter boards. Usesall standard IBM formatCP/N face for terminal communications, dip software. switch baud rates of 150 to 9600.4"cooling fan with air intake on back of computer and Model 80-1200 $299£ discharge through ventilation in the bot 2 8" single sided drives, 1.2 meg ol tom. No holes on computer top or side for storage entry of foreign object. Two 8” single or Model 80-2400 $3496 double sided floppy diskdrives. IBM single 2 8 ” double sided drives, 2.4 meg of density 3740 format for 243K of storage on storage each drive. Using double density with 1K Option 001 $ 9E sectors 608K of storage is available on a Serial printer port, dip switch baud rate single sided drive or 1.2 meg on a double settings MICRO-8O COMPUTER sided drive. Satin finish extruded Software available in IBM single density 8" format. Microsoft Digital Research Mlcropro Basic-80 $289 PL/1-80 $459 Wordstar $299 BasicCompiler $329 Mac $ 85 Mail-Merge $109 Fortran-80 $410 Sid $ 78 Spellstar $175 Cobol-80 $574 Z-Sid $ 95 SuperSort I $195 Macro-80 $175 C Basic-2 $110 Pascal Edit-80 $105 Tex $ 90 Pascal/MT + $429 Mu Simp/Mu Math $224 DeSpool $ 50 Pascal Z $349 Mu Lisp-80 $174 Ashton-Tate Pascal M $355 dBase II $595 Convert almost any static memory OSI machine to CP/M® with the D & N-80 CPU Board.
Z80A CPU with 4MHz clock. 2716 EPROM plete with 10 ft. cable. Optional Real Time J with monitor and bootstrap loader. RS-232 Calendar Clock may be set or read using m E M F k serial interface for terminal communica ‘CALL’ function in high level languages. tions or use as a serial printer interface in a Power requirements are only 5 volts at 1.4 VIDEO system. Disk controller is an Intel amps. Available with WORDSTAR for serial £ » • 8272 chip to provide single or double densi terminal systems. ty disk format. 243K single density or608K double density of disk storage on a single D & N-80 serial $695 sided 8" drive. A double sided drive pro D&N-80 serial w/Wordstar $795 vides 1.2 meg of storage. DMA used with D & N-80 video $695 disk controller to unload CPU during block Option 001 $ 80 transfers from the disk drives. Optional parallel printer and real time Centronics type parallel printer port com calendar clock D & N-80 CPU BOARD OTHER OSI COMPATIBLE HARDWARE I0-CA10X Serial PrlnterPort $125 C1P-EXP Expansion Interface $ 65 Compatible with OS-65U and OS-65D soft Expansion for C1P 600 or 610 board to the Disk Drives and Cables ware OSI 48 pin buss. Requires one slot in 8"ShugartSA801 singlesided $395 IO-CA9 Parallel Printer Port $175 backplane. Use with BP-580 backplane 8 "ShugartSA851 double sided $585 Centronics standard parallel printer inter BIO-1600 Bare 10 card $ 50 FLC-66ft.cablefromD&NorOSI $ 69 face with 10 ft. flat cable Supports 8K of memory, 2 16 bit parallel controller to 8 ' disk drive BP-580 8 Slot Backplane $ 47 ports may be used as printer interfaces. 5 51/4" MPIB51 with cable, power $450 Assembled 8 slot backplane for OSI 48 pin RS-232 serial ports, with manual and Molex supply and cabinet buss connectors FLC-51/48 ft. cable for connection $ 75 24MEM-CM9 $380 24MEM-CM9F $530 DSK-SW Disk Switch $ 29 to 5 1/4 drive and D & N or OSI 16MEM-CM9 $300 16MEM-CM9F $450 Extends life of drive and media. Shuts off controller, with data separator and 8MEM-CM9 $210 8MEMCM9F $360 minifloppy spindle motor when system is disk switch BMEM-CM9F $ 50 FL470 $180 not accessing the drive. Complete KIT and Okldata Microline Printers 24K memory/floppy contraller card sup manual ML82A Dot Matrix Printer $534 ports up to 24K of 2114 memory chips and 120 CPS, 80/120 columns, 9.5'' paper width, an OSI type floppy disk controller. D & N Micro Products, Inc friction or pin feed Available fully assembled and tested with 3684 N. Wells St. ML83ASameas82Aexcept $895 8, 16, or 24K of memory, with floppy con Fort Wayne, Ind. 46808 16" paper width, 132/232 columns with troller (F). Controller supports 2 drives. tractor feed Needs separated clock and data inputs. (219) 485-6414 M L 84 Same as 82A except 200 CPS, $1152 Available Bare (BMEM-CM9F) or controller 16" paper width, 132/232 columns, 2K buf only (FL-470). Ideal way to upgrade TERMS $2.50 shipping, Foreign orders add 15%. fer, dot addressable graphics, with tractor cassette based system Indiana residents add 4% sales tax. feed
22 MICRO - The 6502/6809 Journal No. 52 - September 1982 Delayed Reset and Autoboot for the OSI
by Ugo V. Re
The following two circuit ditioned to change quickly from a low Construction of Delayed RESET modifications to an OSI to high state. Circuit computer will enhance the capabilities of your system by The 7414 IC is a Hex Schmitt Trig The Delayed RESET circuit can be adding a time delay to the ger that will produce a rapidly changing built on a wire-wrap IC socket as action of the BREAK key output signal from a slowly changing follows: |charging capacitor) input signal. The (System RESET) and by output goes negative when the input 1 . Wire pin 2 to pin 3. providing an automatic boot-up exceeds 1.7 volts, and goes positive of a disk system on power-up, or when the input drops below 0.9 volts. 2. Wirepins 5, 9, 11, and 13 to pin 14. after a power failure. Two of the six gates are wired in series to invert the signal so that a low 3. Solder the 220 yL F capacitor be (BREAK key depressed) is applied to the tween pin 1 and pin 7 (positive side RESET pin of the 6502 chip. to pin 1). How often, while typing, have you hit the BREAK key when you wanted to hit Figure 1a: Delayed RESET Circuit the RETURN key? I've made this mis take many times, and with a disk system it becomes very annoying to re enter BASIC without booting-up the disk.
One way to correct the problem is to relocate the BREAK key away from the keyboard. Another method is to add a time-delayed action to the BREAK (RESET) key similar to the method used by the C1P series 2 computer. I chose to add a time delay to RESET as this circuit would provide an additional benefit that then can be expanded to provide an automatic boot-up on power-up.
Description of Delayed RESET Circuit
Figure la is the Delayed RESET Cir cuit Diagram. This circuit can be added to any OSI system including the C8P with the RESET key mounted in the computer case.
A resistor placed in series with a capacitor will control the time it takes for a capacitor to fully charge or discharge. Because the capacitor's charge changes slowly it cannot be used to directly control the RESET pin on the 6502. The 6502 requires a rapid change from low to high to RESET the chip. The signal from the capacitor can be used, however, after it has been con
No. 52 - September 1982 MICRO - The 6502/6809 Journal 23 4. Solder a 4.7K iesistoi to pin 1. used to trigger one half of a 74123 IC input B1 (first half of the 74123, inpu (Monostable Multivibrator). Its output A1 grounded), to trigger the 74123. Thi 5. Solder a 50 Q resistor to pin 14. is then used to trigger the second half of Q1 output goes high for 100-200 mse< the 74123 in order to produce still before returning to a low state. The Q] 6. Wire pin 14 to 5V and pin 7 to another pulse to turn on the TIL117 output is connected to input A2 (sec ground. (Opto-Isolator). ond half of the 74123, input B2 is wirec to 5 volts), therefore, when it goes low 7. Cut the red lead | trace on the 600 The 74123 can be triggered in two it triggers the 74123. The Q2 outpui board] that goes from the BREAK ways. If input A is held low, bringing goes high and turns on the light key, on the 542 board to pin 40, on input B from a low to high state will emitting diode (LED) in TIL117. Thi< the 6502 chip. trigger the 74123. If input B is held causes the photo transistor to switch high, bringing input A from a high to on and short the contacts of the "D ' 8. Solder the loose ends of the 50 Q low state will trigger the 74123. As a key. After 100-200 msec, Q2 outpui and 4.7K resistors together and result of a trigger, the Q output goes returns to the low state and the photc wire to the red lead/trace from the high and the Q output goes low, staying transistor returns to an open circuit, BREAK key. there for a time determined by the with the "D ” key no longer shorted. At resistor and capacitor combination, this time the computer has booted-up 9. Wire pin 4, 7414 IC to the red lead/ before returning to their initial states. BEXEC*. trace going to pin 40, of the 6502 chip. At power-up it takes one to two Construction of Circuit Board seconds for the capacitor (Cl) to charge 10. Store the IC socket so that it doesn't to approximately two volts before the The Delayed RESET and Auto-Boot short out to any other components. output of the 7414 will change from a circuits should be built on a circuit low to high state. This signal is sent to board and mounted at the keyboard. In The combination of a 4.7K resistor and a 220 nF capacitor will give a time delay of about two to three seconds. C6 Additional delay can be obtained by in R3 creasing the size of the capacitor. Do not increase the size of the resistors as - = * / = }■ RESISTOR S i DIODES the values shown are the maximum -CZZD-I that can be used for reliable operation. With the circuit installed, the BREAK key must be depressed for two to three seconds before the screen will clear. □ □ □ □ □ With the Delayed RESET installed, Figure 3a: 542 Rev A. Keyboard the computer comes up in RESET at power-up. With a few more com ponents we can use the signal from this circuit to provide an automatic boot-up DIODES at power-up.
i i Description of Auto-Boot Circuit R3 H-----h Figure lb is the Auto-Boot Circuit -I h Diagram. This circuit provides an addi -I K > RESISTOR tional time delay after RESET goes high RUB -1 h before shorting the contacts of the "D '' OUT H h M h key to boot-up the disk system. Figure 3b: 542 Rev B. Keyboard y
In addition to supplying a signal to the 6502 microprocessor chip, the out put of the 7414 IC (Schmitt Trigger) is RESISTORS
□ □ □ □
Figure 3c: 600 Board
Figure 3: Location of C6 and R3 Leads
24 MICRO - The 6502/6809 Journal No. 52 - September 1982 a C8P system it could be placed in the Once the circuit board is completed A15 board via a 16-conductor cable and CPU case near the A15 circuit board. it must be wired to five volts, ground, appear on pins 2 and 9 of the “A” the BREAK key, and the contacts of the keypad socket. See figure 4 for the loca You can use point-to-point wiring "D " key. This can be accomplished in tion of socket and wiring points. Power with IC sockets mounted on a per one of three ways. is also available on the A15 board. The forated board, or you can make a BREAK key leads, however, will have printed circuit board (see figure 2 for The best method is to wire all leads to be extended to this board and then the layout). Check for the correct directly to the contacts on the key routed to the CPU board. orientation of the electrolytic capaci board. This method is the same for all tors and integrated circuits before keyboards. With the keyboard face Now whenever you turn on the soldering any components to the board. down, the "D " key contact pads are power, press the BREAK key, or if the fourth group from the right-hand power returns after a power failure, edge and the second group from the bot your computer will boot-up and run Figure 4: Location of C6 and R3 Leads tom edge. The topmost pad (the C6 BEXEC*. You can modify BEXEC* so lead) should have a potential of 4-5 that it will run a special program (home
1------1 volts and is wired to TIL 117, pin 5. The control, security, bulletin board, etc.), 1 JOYSTICK 1 bottom pad is wired to TIL 117, pin 4. without any operator intervention. I The BREAK key contacts are also on have my system running continuously ______------1 1 1 1 1 > 1 the right-hand edge of the keyboard. A and have not yet had a problem. + 1------1 0 red and black pair of wires leave the • JOYSTICK 1 keyboard and go to the CPU board. I would recommend that you do not 0 Power can be picked off at any IC — pin run your system continuously without o o o o o 7 or 8 for ground, and pin 14 or 16 for some form of motor control for the five volts. disks. See the article by N.E. Ingersoll c— >~o o o o in MICRO, September 1981, page 15.1 Another method is to wire to a have this circuit installed in my C4P | KEY PAD | resistor, C6 lead, and diode, R3 lead, MF system and highly recommend it to I B’ I located on the keyboard. See figure 3 reduce power consumption and disk I______I for the location of these components. wear.
J11 CABLE TO This last method can only be used if The author may be contacted at 167 KEYBOARD you have an A15 circuit board installed Sprucewood Dr., Levittown, NY 11756. in your system. The C6 and R3 leads A15 BOARD are extended from the keyboard to the JMCftO
Attache style cases for carrying and protecting a complete computer set-up. Constructed of the highest quality luggage material with saddle stitching. Will accommodate equipment in a fully operational configuration along with manuals, working papers and disks. Never a need to remove equipment from case. Simply remove lid, connect power and operate.
• AP101 Apple II with Single Disk D rive...... $109 • AP102 Apple II with Double Disk D rives ...... 119 • AP103 Apple II, 9 inch Monitor & Double Drives .. 129 • AP104 Apple III, two additional Drives & Siientype 139 • AP105 12 inch monitor plus accessories ...... 99 • P401 Paper Tiger 440/445/460 ...... 99 • P402 Centronics 730/737 ...... 89 • P403 Epson MX70 or MX80 ...... 89 • P404 Epson MX100...... 99 • P405 IDS 560 or Prism Printer...... 109 • CC80 Matching Attache Case (5”) ...... 85 • CC90 Matching Attache Case (3 ") ...... 75 • CC91 Matching Accessory C ase...... 95 compmer case companv ...... 5650 INDIAN MOUND CT. COLUMBUS, OHIO 43213 (614) 868-9464 O y ' W t Accept M etier Charge and Vi»a. Include S i.00 handling.
No. 52 - September 1982 MICRO - The 6502/6809 Journal 25 DREAM MACHINE
ARE YOU BORED? Today you can enhance your Pet or Apple II with We designed our 68000 board primarily for the the power of today’s fastest, most powerful serious individual hacker. We have discovered that microprocessor! Revel in the luxury of sixteen each there are fewer of those than we anticipated! Did you 32 bit registers! Perform a 32 bit add using one buy one of the first Pets or Apples about four years instruction, in less than a microsecond! Run ago? Remember how much fun you had? Because graphics over a hundred times faster than Applesoft! there wasn’t much software back then, many of you wrote your own. What’s that? None of the above interests you? Then go away so that we can address those persons These days every program that can be written for who are interested! your Pet or Apple has been written, several times. So, a couple of years ago you started adding hardware Now that there is no one here but us performance accessories. And life became exciting for a few more freaks, let us tell you about DTACK GROUNDED: months. Then, boredom city again! Our product is real and available now. It was You want to know where all the hackers went? Go reviewed in the April PEELINGS II, including a look in a mirror. Your problem is that there are no real photograph on the front cover. It has also been challenges anymore. reviewed in several club newsletters, such as Mini’app’les and the Keystone Apple Core. DO WE HAVE A CURE FOR YOU! In 1981 most people didn’t know about the 68000, When you begin looking into the 68000 you will so we started a newsletter called “DTACK discover there is little software available right now. GROUNDED, the Journal of Simple 68000 Systems.” That’s because the 68000 is less than two years old. We have twelve issues in print, about 180 pages of There was little software for the 6502 when it was information about the 68000 and other high less than two years old, you may recall. performance processors. We now have new challenges and opportunities. About our name: DTACK stands for ‘DaTa Everything has not been done. There have been an ACKnowiedge’. That’s pin 10 on the 68000 and is enormous number of 68000 based systems primarily responsible for the complexity of most announced! Ours is the only performance oriented 68000 system designs. We tied pin 10 firmly to 68000 product which will improve the computer you ground, which means that data is always already own (Pets and Apples for now). acknowledged. So the processor always runs at full speed (not true of a lot of expensive 68000-based You want to have fun? Here is our experience: A systems). simple but elegant 3-D Applesoft graphics demo runs in 53 minutes. We now have the identical package Our approach does have some disadvantages. running in 10.3 seconds using a 68000 (with no Grounding DTACK prevents hooking some cheating). That's a speed improvement of over 300 to peripherals directly to the 68000. However, we intend 1! There is absolutely no way that this can be done that the host computer perform all I/O functions (we without a 68000! can transfer 70,000 bytes/sec in either direction between the host and our 68000 board). The What? You like being bored? But you want to be operating system is the operating system you now bored at 68000 speeds? We have a solution for you: have since our board is designed as an attached tuck yourself into a time capsule for the next four or processor to your personal computer (just the Pet or five years. When you come out, all of the 68000 Apple II for now). software will have been written! We have 4K boards with 8MHz 68000s. From there But if you do not have a time capsule, you are we go up to 220K systems with 12.5 MHz (!) 68000s. going to have a problem very soon now as your The latter package is generally purchased for computer associates start showing up with business purposes, of course. machinery that runs circles around your 6502. Aren’t bragging rights in your local user group worth a few DIGITAL ACOUSTICS hundred dollars? 1415 E. McFadden, Ste. F DEALERS: We regret that all sales are factory Santa Ana, CA 92705 direct. There is no retail discount. We adopted that policy to make it possible to offer a quality 68000 (714) 835-4884 product at a personally affordable price. Apple, Applesoft and Apple II are trademarks of Apple Computer Company. Pet is a trademark of Commodore Business Machines.
26 MICRO - The 6502/6809 Journal No. 52 - September 198 The 68000 and the Personal Computer
by Laurence Kepple
Your 6502 system is still a RAM) to $1123 (for the same board minutes and 40 seconds in Applesoft gateway to the future! This with 92K). (See PEELINGS II, April with the 68000 handling floating point article discusses some of the 1982, for a review of these products.) operations; and 45 seconds with the Company president Hal Hardenbergh, 68000 running a machine-code program hardware and software aspects in his newsletter DTACK Grounded, and the 6502 used exclusively for I/O. of what promises to be an has announced that the company will A graphics version of the 68000 floating exciting market for the 68000 as soon market less expensive boards with point package that uses a 16-bit man an add-on to 6502-based dynamic instead of static RAM. tissa produced the fastest time of all: system s. 18.9 seconds. The name “DTACK Grounded” ex Very Large Scale Integration (VLSI) tech plains the company's hardware ap There are other 68000 boards avail nology has made it possible for Motor proach to getting the 68000 into the able. Motorola itself recently announced ola to turn the CPU architecture of a personal computer market. Pin 10 of an MC68000 Educational Computer minicomputer (Digital Equipment Cor the 68000, “DTACK” , stands for DaTa Board. As its name suggests, the pur poration's PDP-11) into a micro ACKnowledged. The 68000 needs this pose of this board is to make it processor. The 68000 is so compact and pin to function with the asynchronous economical (cost: $495.00) for students so powerful that it threatens to erase data bus for which it was designed by and designers to get familiar with the the distinction between mini and Motorola. By grounding DTACK, the 68000. The board includes 32K of RAM microcomputers. The question now is: 68000 is made compatible with the and 16K of ROM firmware that pro do you hold on to the minicomputer synchronous data busses used in vides the user with debug/monitor concept in the microprocessor world? simpler personal computer systems. functions, program entry, assembling, Do you run two or more terminals on disassembling, and I/O functions. To the 68000 as though it were still a Using the 68000 as a co-processor simplify programming in the educa PDP-11? Or do you adopt a "one per with a 6502-based system can produce tional environment, a primitive assem son, one processor" philosophy? The amazing improvements in execution bler/disassembler function allows pro Fortune 32:16 starts at about $5000 and speed. For example, a 3-D graphics grams to be entered, displayed, and may be able to support as many as 16 demonstration included with the modified in assembly language. Espe terminals. The comparably priced DTACK Grounded board runs in 30 cially in this latter characteristic, Radio Shack Model 16 can support two minutes, 5 seconds in Applesoft; 10 Motorola's board resembles those of terminals. The manufacturers of the The DTACK Grounded 68000 board (with 12K of static RAM) attached to MICRO’S SAGE II, which costs under $4000, Apple II. The large (!) rectangular shape on the far right of the board Is the MC68000. have deliberately designed their 68000 (Photo by Loren Wright) computer as a single-user system.
Whatever approach is adopted, the rate at which companies are announc ing new 68000-based systems makes one thing certain: the 68000 micro processor has become a chip worth knowing. Fortunately, you do not have to buy an entirely new system to be able to work with the 68000. As is the case with the 6809, add-on boards are becoming available that allow you to use your 6502-based system as a foun dation for work with a more advanced processor.
For example, DTACK Grounded (1415 E. McFadden, St. F, Santa Ana, CA 92705) is now shipping peripheral boards for the Apple II and for the PET that allow users to join the 68000 with the 6502 as a co-processor. The cost of these boards ranges from $595 (for an expansion board with 4K of static
No. 52 - September 1982 MICRO - The 6502/6809 Journal 27 ■ 68000 FEATURE
DTACK Grounded. Another company, interested in 68000 peripheral boards DTACK Grounded board. Clearly, i Intellimac (6001 Montrose Rd.( Rock aimed at 6502 machines. The signifi you start to develop 68000 software oi ville, MD 20852) has announced a cance of such expansion boards goes your Apple any time soon, you will b< 68000 single-board kit, the 68 beyond simply improving the execu one of the first. This is not the case fo Magnum, for $745.00. This board of tion time of existing unprotected soft those 6502 owners who opt for thi fers 128K of dynamic RAM, 16K bytes ware. Bringing the 68000 out of the 6809 on boards such as those offered b] of firmware ROM/EPROM, and 16K relatively exclusive minicomputer en Stellation Two and ESD Labs. Thi bytes of user EPROM. The system's vironment into the personal computing 6809 has a substantial base of excellen firmware offers features similar to world should greatly stimulate the software, and two powerful operatinj those of Motorola's ECB. Also like the development of software for the 68000. systems, OS-9 and FLEX. ECB, the Magnum requires the user to Given the power of the 68000, this supply a power source and a CRT would be a significant event. If the terminal. 68000 ever achieves anything like the 6502's level of support, the results However, one crucial event has We assume that other companies could be awesome. already taken place that will influence are going to follow DTACK Grounded's the future of a substantial portion oi lead and design 68000 boards especially Owners of 6502 systems who are 68000 development work: UNIX has for specific personal computer systems. considering entry into the 68000 world won wide acceptance as the best oper Micro Technology Unlimited (2806 should be aware that, for some time, ating system for the 68000. One impor Hillsborough St., P.O. Box 12106, they will be strangers in a strange land. tant reason for the UNIX-68000 con Raleigh, NC 27605) has announced a The production of software for the nection is that UNIX was written foi 68000 expansion board for its 68000 is only beginning. Phase Zero, the 68000’s minicomputer ancestor, 6502-based system, the MTU-130 Ltd. (2509 N. Campbell Ave., Suite the PDP-11. Created at Bell Labs, microcomputer. Called the Data- 130, Tucson, Arizona 85719) has just UNIX has received hundreds of man- mover-256, the board provides a 68000 started to market the first development years of additional development al processor and an additional 256K of software designed specifically for the some of America's leading universities. RAM (price: $999.00). It seems that 6502/68000 environment. Called “The If microcomputer users can gain access MTU is deliberately pursuing a 6502/ Apple II to MC68000 Cross-Assembler," to UNIX through the 68000, they will 68000 envirqnment, in which users get the program, written in 6502 machine have an operating system of tremen the best of both worlds: compatibility code, accepts 68000 assembly com dous power. UNIX offers a vast numbej with a widely supported 8-bit micro mands and produces 68000 object code of utilities and a means of linking them processor, and upgradability to the (cost: $99.00). The program is intended into large constructs via "pipes." This power of the 68000. At MICRO, we are to run on an Apple II equipped with a makes designing large programs sim-
OSI Disk Users INTRODUCING!
Double your disk storage capacity Without adding disk drives Now you can more than double your usable floppy disk storage capacity—for a fraction of the cost of additional disk drives. Modular Systems’DiskDoubler ™ is adouble- density adapter that doubles the storage capacity of For you, the 68XX userl An exciting new monthly each disk track. The DiskDoubler plugs directly into an magazine formatted for the 68XX enthusiast OSI disk interface board. No changes to hardware or specializing in hardware applications. software are required.
The DiskDoubler increases total disk space under OS- REGULAR FEATURES WILL INCLUDE: 65U to 550K; under OS-65D to 473K for 8-inch floppies, • Articles on 6800, 6809, and 68000 to 163K for mini-floppies. With the DiskDoubler, each • Construction Articles drive does the work of two. You can have more and larger programs, related files, and disk utilities on - New Product Announcements the same disk—for easier operation without constant • Product Reviews disk changes. - Classified Ads • * 2 -B its ' Your OSI system is an investment in computing power. • Questions & Answers Get the full value from the disk hardware and software that you already own. Just write to us, and we’ll send you the full story on the DiskDoubler, along with the rest of our growing family of products for OSI disk systems. ADVERTISERS WELCOME! CASH COMPENSATION FOR ARTICLES YEARLY SUBSCRIPTIONS AVAILABLE ™DiskDoubler is a trademark of Modular Systems. 1 Year $24.00 2 Years $45.00 Single Issue $2.95 Post Office Box 16 C CALL NOW FOR YOUR SUBSCRIPTION! Oradell, NJ 07649.0016 Telephone 201 262.0093 P. O. BOX 310 CONYERS, GEORGIA 30207 404-929-0606 MASTER CHARGE, VISA, and AMERICAN EXPRESS ACCEPTED
28 MICRO - The 6502/6809 Journal No. 52 - September 1982 pier, and encourages the fullest use of MS-DOS and CP/M are "Model Ts" the modular approach in solving com compared to the "Lear Jet" function plex problems. In addition, UNIX is ality of a UNIX-like system. A 68000 MICRObits written in, and of course supports, the version of COHERENT is on the way. Deadline for MICRObits- 20ih of sec powerful programming language C. ond month before publication; i.e., September 20ih lor November issue. Not every 68000 operating system Send typewritten copy (40-word limit) But the attempt to make UNIX the will be UNIX-based or UNIX-com with $25.00 per insertion (Sub standard operating system for the patible. Mindful of the relative lack of scribers: first ad at S10.00 I 68000 is not without difficulties. In the applications software that runs under first place, UNIX itself has yet to be UNIX, some manufacturers will try to 6800/6809 Software standardized. Because substantial de use large libraries of applications pro Includes compatible single-user, velopment of UNIX was done at dif grams to induce buyers to stay with multi-user and network-operating ferent universities, and because UNIX their non-UNIX but processor-indepen systems, compilers, accounting and was designed to be easily modifiable, dent operating systems. For example, word processing packages. Free the operating system assumed a some Microcobol Products, Inc. (MPSI), catalog. what different form at each site. developer of the BOS/5 and MBOS/5 Software Dynamics Variants include Revision 5, Revision operating systems, plans to release a 2111 W Crescent, Sta. C 6, Revision 7, and a recently announced 68000 version in the fall of 1982. The Anaheim, CA 92H01 System III. Another problem is that, BOS/5 operating system is already while UNIX provides rich resources in available on a wide range of processors Lessons in Algebra terms of software development tools, it (Z80, PDP-11, 8086) and supports a does not offer much application soft large base of business applications pro An easy and fun way to ’earn the ware — again, a situation that reflects grams. Once the BOS/5 system is basic elements of high school algebra. the university setting in which UNIX ported to the 68000, all of this applica Apple computer diskette $29.95 30-day money-back guarantee if not was formed. The absence of an applica tions software will run without any satisfied. tion orientation resulted in some UNIX recompilation or relinking. Another George Earl deficiencies, such as the lack of error business-oriented, non-UNIX operating 1302 So. General McMullen Dr. recovery for disk I/O . Finally, the system is OASIS 16, the 16-bit version San Antonio, TX 78237 language in which UNIX is written, C, of an 8-bit operating system that sup while very powerful, is not nearly as ports a substantial quantity of business portable as COBOL, for instance. software. Dynamite PET/CBM Accessories! Wnte-protect switches/indicators for Major efforts are now underway to However, UNIX will almost cer 2040/4040 disk drives. Real world solve these problems. Microsoft, the tainly be the primary operating system software at low cost 2114 RAM company that made BASIC famous, is used in the development of new appli adapter [replaces obsolete 6550sl and attempting to achieve the same feat of cations software for 68000 micro 4K memory expansion for ''old" 8K standardization with UNIX. Microsoft's computers. Some powerful micro PETs. Hundreds of satisfied version of UNIX, called XENIX, sup processor development tools, in addi customers. Write (or free catalog1 ports high-level languages that are well tion to those already part of UNIX, are Optimized Data Systems established in the microcomputer being made available for the UNIX en Dept. M, Box 595' I’lacer.tia, CA 92670 market: BASIC, COBOL, FORTRAN, vironment. The Boston Systems Office and Pascal. Charles River Data, (469 Moody St., Waltham, MA 02154) developer of the $20,000 Universe 68 recently announced a delivery date in New! The Aerobics Master [the kind of system that Motorola had late June for UNIX-compatible versions Here's a day-by-day diary for in mind when it designed the 68000), of the more than 50 high-speed micro exercisers designed by a mnner. has also created UNOS to go along with processor assemblers, symbolic debug Tracks progress of a variety ut it. In addition to C, UNOS supports gers, and linkers that they originally excrcise activities. 4(iK, DOS 3.3 and FORTRAN, BASIC, and Pascal. developed for the PDP-11. Given the ROM Applesoft required Warranteed close relationship between the 68000 upon registration. SASE for more Some software developers have and the PDP-11, this minicomputer is information. Introductory price preferred to create independent oper an ideal software development system §22.95 - includes shipping ating systems that maintain com for 68000 systems running UNIX. Free Lance Ink patibility with UNIX. For example, the BSO's strategy is to support such a 1806 Wickham Mark Williams Company (1430 West development effort on the PDP-11. Royal Oak, MI 4H07 3 Wrightwood, Chicago, Illinois 60614) has produced the COHERENT system, The low-cost availability of a chip VERBATIM Datalife Diskettes which it describes as "a totally in with the power of the 68000 is good dependent development'' that nonethe news for anyone who believes in the Five and one-quarter inches, SSDD, soft-sectored, reinforced centers. Only less is designed to preserve compati potential of microcomputers. Perhaps $27 95'box of ten Plastic case $2 bility with Revision 7 of UNIX. Like the best news of all is that we do not more. Hip-sort box tor 50 5 U ” UNIX, COHERENT was initially de have to spend $5,000 or more for access diskettes, with index lahs - only veloped on the PDP-11. In addition to to the 68000. Your 6502 system is still $27 95 [’lease include $2 flipping ’ C, COHERENT supports a BASIC a gateway to the future. In time, the handling. Send for hardware/software interpreter-compiler, XYBASIC. Mark development effort at the minicom list. Williams has just announced a version puter level, in addition to the work The Soit Spot, Inc. of COHERENT for the 8088-based IBM done by microcomputer users them Dept. C l, P O Box 212 Personal Computer. The firm's presi selves, will produce microcomputer Corbett, OR 97019 dent, Robert Swartz, noted that ex performance and capacity that we can isting PC operating systems such as hardly imagine today. 4MCRO' (Continued on page 38)
No. 52 - September 1982 MICRO - The 6502/6809 Journal 29 VOLUME 2 now available! NIBBLE EXPRESS
TABLE OF CONTE NIBBLE EXPRESS VOLUME 2 CHAMP ...... NOW AVAILABLE! 5 8 Working Out with CHAMP ...... The 1981 Anthology of the major articles Amper-Reader...... 10 Hex/Dec Codes Without Conversio and programs is underway! It contains 11 Auto Run and Tape Protection ... up-to-date enhancements and corrections 12 MRS ...... to programs which appeared in Volume 2 of 14 Le Mans ...... NIBBLE 17 Inputting Strings With Commas ... 19 Phantom Numeric Pad ...... Even if you have all 8 issues of NIBBLE in 21 Disk Snooping Part 1 ...... 1981, you’ll want The Express to have 22 Apple Paintbox ...... 25 updated program listings in one convenient 28 Mad Mad Cube ...... package! Disk Snooping Part 2 ...... 30 Applsoft Linefinder ...... 200 solidly packed pages with major 34 37 Direct Keyboard Disk Commands programs and articles for your Apple! A Converting Muffin to Demuffin ... 39 Apple STAR System ...... MUST for your Library! 42 48 Disk Snooping part 3 ...... NIBBLE EXPRESS will be an invaluable Intesoft Connection part 1 ...... 52 Trap ’Em ...... reference for your Apple now and for years to 57 Fast Data Format ...... come! 60 Quick and Easy Hi-Res ...... 62 Apple RAT ...... for only $14.95 (plus shipping) you can make Nibble 63 Binary Disk Copy ...... Express a permanent part of your library. 65 Disk Master ...... 67 Trap/Step ...... 76 Biorhythms ...... ORDER YOUR COPY NOW! 82 Intesoft Connection part 2 ...... 88 Teleprocessing ...... 93 Lo-Res Screen Dump ...... NIBBLE 97 Apple Tricks . . . Reset Trap ...... P.O. Box 325 100 Mini-Amper Edit ...... Lincoln, MA 01773 103 How to Enter Assembler Listings . 106 Free Cat for Apple DOS Users ... Yes! I. want NIBBLE EXPRESS Vol. 2 in my library! 108 M.A.P.S...... Here’s my O Cfteek □ Money order 112 Amper Jump & TSort ...... for $14.95 plus $1.75 postage/handling. (Outside 118 Apple A rtis t...... U»S. add $2.75 for pesiage/bandflng). 123 Pascal Lo-Res Graphics ...... 127 Big CAT ...... □ Also send me NIBBLE EXPRESS Vol. 1 at $12.95 131 Amper Store Recall ...... pttis $1.75 postage/handling (outside U.S. add $2.75 132 D.A.R.T...... for j 134 Print Use ...... 142 Intesoft connection III ...... Master Card & Visa Accepted 148 Lazer Blaster ...... 152 Auto Repeat K e y ...... 153 Card #. .Expires. 154 Poor Boy's LE ...... Catsup—Catalog Supervisor ...... Telephone. 155 157 TRAC Budget ...... Name___ _ TRAC Graphics ...... 159 TRAC Plus ...... Street. 162 165 Archives ...... City__ State. Bp. Intesoft connection IV ...... 168 Command Changer • (missing the Your check or money order must accompany your ordsr to qualify. 171 Outside U.S.: Checks must be drawn on a U.S. Bank. 176 DOS Remover ...... ‘Applet Is a registefed trademark at Appis Computer Company.
MICRO - The 6502/6809 Journal Chances are, when you Siemens system with over A special introductory offer bought your first disk drive, it 10,000 lifetime hours. Shielded when you order Apple-Mate was an Apple. Now that you're connecting cable also attached. directly from us. ready for a second, take a look So when you're ready to boost LONG TERM the juice on your Apple, add-on at Quentin. DEPENDABILITY Our Apple*-Mate™ 51A" Disk the Quentin Apple-Mate. MTBF (Mean Time Between Drive is fully software transparent To order: Check, money order, Failures)— 8,500 power-on hours, with Apple's DOS 3.3 operating Visa or Mastercard number. Calif, and the unit has a one-year system in full and half track residents add 6% sales tax. warranty. operation. Allow one week delivery. Add it to your present drive for COUNT ON QUENTIN greater capacity and faster access. FOR QUALITY Just piug it in and go to work. Quentin Research was building And the Apple-Mate has these disk systems for the computer High Performance advantages: industry when Apple was a little ON TRACK HEAD SEEK bud on the big computer tree. We're known for product reliabil A precision lead screw positions ity and stand behind every system the head onto the correct track. we sell you. 19355 Business Center Drive Time-consuming retries and Northridge, California 91324 disk-to-disk copying errors are But the best news may be the price— only $335.00 (40 tracks). (213) 701-1006 virtually eliminated. SIEMENS* DISK DRIVE The apple-beige unit is built around the highly reliable MORE JUICE FOR YOUR APPLE
Special Introductory Price: $335.00
® Apple is a registered trademark of Apple Computer, Inc tSiemens is a trademark of Siemens Corporation, ‘ Apple-Mate is a trademark of Quentin Research, Inc., which does not manufacture Apple computers. An MC68000 Overview
by Tom Whiteside and Joe Jelemensky
This article is the first in a two- • separate supervisor stack pointer program control and system control part series by the authors • vectored, multilevel, priority inter operations. The complete instruction set is shown in tables 1 and 2. describing the Motorola rupt handling MC68000 microprocessor. This • TRAP vectors to handle a variety of The addressing modes of the part describes the registers, error conditions and operating sys M C68000 are of six basic types: register instruction set and addressing tem calls direct, register indirect, absolute, im m odes. mediate, program counter relative, and Data types include bit, byte, word, long implied. Add to these basic types the word, and BCD digits. The machine ability to do indexing, post-incre The second part will give some has 17 32-bit registers. Sixteen of these menting, and pre-decrementing, and simple programming examples are accessible in user state (8 address you have 14 specific addressing modes to illustrate programming registers and 8 data registers). The re (as shown in table 3). maining register is the supervisor stack techniques and special features pointer and is only accessible when the of the MC68000. machine is in supervisor state. Registers
The M C68000 was designed to take The 17 data and address registers advantage of the latest technology in free the programmer from the overhead VLSI semiconductor manufacturing. of a complicated register management The Motorola M C68000 is rapidly be Likewise, the recent advances in com scheme in the majority of applications. coming the most popular new-genera- puter science have also influenced the Eight of the registers (DO through D7) tion microprocessor used in high per design of the CPU and the instruction are data registers and may be used for formance desktop or personal com set of the MC68000. The LINK and byte, word, and long word operations. puters. Several manufacturers have an UNLK instructions make it easy to The remaining 8 (A0 through A7) are nounced systems using the MC68000, allocate and deallocate space dynamic user-accessible address registers. The with costs ranging from $5,000 to ally on the system stack. This is address registers and the supervisor $10,000, depending on the amount of especially useful when setting up local system stack pointer may be used for memory and size and type of disk variables in a procedure. Another in word and long word address operations. storage. These systems pack the power struction, CHK, aids the implementa All of the 17 registers may be used as of a minicomputer into a personal tion of high-level languages. CHK index registers. All allow post-incre computer-size package and price. allows the checking of array bounds menting and pre-decrementing, giving with a single instruction by comparing the programmer the ability to use any The main reason for this favorable the value of a register specified with of them as a user stack pointer. performance/price ratio is the advanced zero and an upper limit. micro-programmed architecture of the The other registers on the M C68000 MC68000. Its 16-bit external data bus The instruction set is quite regular, are a 16-bit status register and a 32-bit and 32-bit internal registers allow high in that most instructions use the same program counter. The registers are throughput. A 23-bit external address addressing modes and can operate on summarized in the programming bus, plus upper and lower data strobe, most data types. All op codes are 16 model in table 4. allows direct addressing of 16 mega bits in length. Additional information bytes of memory. The powerful in necessary for specific instructions and struction set was designed to allow addressing modes may require one to easier implementation of structured four additional words to contain im Data Registers high-level languages, such as Pascal mediate data, displacement offsets, or and C. Operating systems are also sup absolute addresses. Each of the eight data registers ported by the basic architecture, with (D0-D7) is 32 bits wide. Data registers features such as: The basic instruction types are: data are further subdivided into word (16 movement operations; integer arith bits) and byte (8 bits) lengths for data metic,- logical operations; shift opera manipulation. Long word operands, of • supervisor and user states of operation tions; bit manipulation (bit addressable course, occupy the entire register. • privileged supervisor instructions test, set, clear); BCD arithmetic; and Word operands occupy the low order 16
32 MICRO - The 6502/6809 Journal No. 52 - September 1982 bits, and bytes occupy the low order 8 portion of the register is used or changed; byte contains an eight-level interrupt bits. When data registers are used as the remaining portion is left undisturbed. mask and additional processor-related either a source or destination operand status bits. These status bits indicate in an instruction, only the appropriate Address Registers whether or not the MC68000 is in trace state and/or supervisor state. The con Each address register and the stack dition code byte contains bits for pointers are also 32 bits wide. The ad overflow (V), zero result (Z), negative dress registers may also be used for result (N), carry (C), and extend (X). Table 1: Instruction SET word operands, but, unlike the data The status word has six unimple registers, may not be used for byte mented bits reserved for future exten Mnemonic Description operands. Word operands are contained sions to the MC68000 family. ABCD Add Decimal with Extend in the low order 16 bits of an address ADD Add register. When an address register is AND Logical And used as a source operand, either the en ASL Arithmetic Shift Left ASR Arithmetic Shift Right tire register or the low order 16 bits will Instruction Set Description be used, depending on whether it is a Bcc Branch Conditional long word or word operation. If an ad In this section we will discuss the BCHG Bit Test and Change BCLR Bit Test and Clear dress register is specified as a destina MC68000 instruction set in moderate BRA Branch Always tion operand, the entire register is af detail. There are several variations of BSET Bit Test and Set fected. Long word operations will of some instructions, which make them BSR Branch to Subroutine course write the 32-bit value into the shorter (and/or faster), allow easy BTST Bit Test entire 32-bit register. Word operations manipulation of pointers, and more CHK Check Register Against will cause sign extension on any other flexible immediate addressing. The Bounds operands before the operation takes programmer may explicitly choose CLR Clear Operand CMP Compare place. these variations or allow the Motorola Resident Structured Assembler to DBcc Test Condition, Decrement The system stack pointers (A7 in select the appropriate form of the in and Branch DIVS Signed Divide user and supervisor state) are used by struction. These variations include D1VU Unsigned Divide the machine for interrupt, subroutine “quick", "immediate”, and "address" call, and trap processing. The two stack instruction types, designated by "Q ” , EOR Exclusive OR EXG Exchange Registers pointers are both accessed by using A7 “ 1", and "A ” suffixes to the instruc EXT Sign Extend in the operand field of an instruction. tion mnemonic. The supervisor stack will be accessed if IMP Jump JSR Jump to Subroutine the MC68000 is in supervisor state and Data Movement Operations the user stack pointer will be used if it LEA Load Effective Address is not in supervisor state. The user may Unlike the MC6800/6809 architec LINK Link Stack LSL Logical Shift Left also use the system stack to store tem tures, the MC68000 does not have LSR Logical Shift Right porary data by pushing and pulling data specific load and store register opera via the MOVE instruction, or by using tions containing explicit register MOVE Move MOVEM Move Multiple Registers the LINK and UNLK instructions reference. Instead, a more powerful MOVEP Move Peripheral Data described later. MOVE instruction is provided to per MULS Signed Multiply form data transfers. The source and MULU Unsigned Multiply destination of data transfer operations NBCD Negate Decimal with are specified independently of the in Extend Program Counter struction. This allows movement of NEG Negate data between registers, from register to NOP No Operation NO Ones Complement The program counter of the memory, from memory to register, and MC68000 is a full 32 bits in length, from memory to memory. Data MOVE OR Logical OR even though the range of the address instructions allow byte, word, and long PEA Push Effective Address space is only 24 bits (23 bits plus upper word operands. Address MOVE instruc and lower data strobe) on the current tions allow only word and long word RESET Reset External Devices operands. This insures that only legal ROL Rotate Left without Extend version. Future versions will have 32 ROR Rotate Right without bits of address space. The program address manipulations can be executed. Extend counter is manipulated -by program ROXL Rotate Left with Extend control-type instructions (branches, ROXR Rotate Right with Extend RTE Return from Exception subroutine calls, etc.). The program RTR Return and Restore counter is also used as the base address The MC68000 also includes several RTS Return from Subroutine in program counter relative address special MOVE instructions. The MOVE Multiple register instruction SBCD Subtract Decimal with calculations. Extend (MOVEM) allows several registers to be Sec Set Conditonal moved to or from memory with one in STOP Stop struction. The MOVE Peripheral data SUB Subtract instruction (MOVEP) provides a means SWAP Swap Data Register Halves Status Register to transfer word and long word data to TAS Test and Set Operand or from peripheral data registers, which TRAP Trap are located at alternate addresses in TRAPV Trap on Overflow The status register on the MC68000 TST Test is 16 bits long. It is broken up into an memory space. The EXchanGe regis 8-bit system status byte and an 8-bit ters instruction (EXG) allows the swap UNLK Unlink condition code byte. The system status ping of contents between any pair of
No. 52 - September 1982 MICRO - The 6502/6809 Journal 33 68000 FEATURE
the accessible registers. Load Effective (sign bit) of the byte is then set before through the loop. Address (LEA) and Push Effective Ad the instruction is completed. This is dress (PEA) provide means for manipu very useful for manipulation of sema Binary Coded Decimal (BCD) arid lating address pointers in position- phores between processes, since the test metic operations are also supported b independent programs by loading the and set operation is uninterruptable. the MC68000. The following multipri effective address of a variable into an cision BCD arithmetic functions ma address register or pushing it onto a Immediate data of byte, word, and be performed: add decimal with exten stack. LINK stack (LINK) and UNLinK long word length may be added to or (ABCD), subtract decimal with exten stack (UNLK) instructions allow the subtracted from the data stored at the (SBCD), and negate decimal with e: user to easily reserve and return tem effective address using the add and sub tend (NBCD). The BCD arithmeti porary variable space on a stack. The tract immediate instructions (ADDI operations are restricted to byte-lengt MOVE Quick instruction (MOVEQ) and SUBI). operands and can be register-to-registe makes it easy to transfer sign-extended or memory-to-memory operations. 8-bit immediate data to a register with A variation of the add and subtract a very fast one-word instruction. immediate instructions are "quick'' Logical Operations add and subtract (ADDQ and SUBQ). These instructions allow the addition The M C68000 provides a full set c or subtraction of immediate data (in logical operation instructions. Logics the range one to eight) to byte, word, or and (AND), inclusive or (OR), es long word operands. The advantage of elusive or (EOR), and logical comple Integer Arithmetic Operations these instructions are speed and com ment (NOT) are available for all sizes c pactness. They are particularly useful integer data operands. In addition, a se The four basic arithmetic functions in loops where loop counts must be of immediate instructions, ANDI, OR] of add, subtract, integer multiply, and altered by some small value other than and EORI provide logical operations 01 integer divide are supported by the one, but less than nine each time all operand sizes. MC68000, along with other useful operations such as compare operand, negate operand, test operand, and clear operand.
The ADD and SUB operations are available for both address and data Table 2: Instruction Variations operations. Data operations allow all sizes of operands. Address operations are restricted to legal address size Instruction operands (long word and word). The Type Variation Description arithmetic CoMPare instruction (CMP) ADD ADD Add can be used on data, address, and ADDA Add Address memory compare operations. The ADDQ Add Quick NEGate (NEG) and CLeaR (CLR) in ADDI Add Immediate ADDX Add with Extend struction can be used on all sizes of data operations (byte, word, and long AND AND Logical AND word). The multiply instruction is used ANDI AND Immediate ANDI to CCR AND Immediate to Condition Code to multiply two word operands to form ANDI to SR AND Immediate to Status Register a long word result. MULU is used for unsigned multiplication and MULS for CMPCMP Compare CMPA Compare Address signed multiplication. CMPM Compare Memory CMPI Compare Immediate In division, a long word dividend is EOREOR Exclusive OR divided by a word divisor to produce a EORI Exclusive OR Immediate word quotient with a word remainder. EORI to CCR Exclusive Immediate to Condition Codes Again, instructions are provided for EORI to SR Exclusive OR Immediate to Status Register signed and unsigned operations (DIVS MOVE MOVE Move and DIVU). A set of extended arith MOVEA Move Address metic instructions is also available for MOVEQ Move Quick MOVE to CCR Move to Condition Codes programming multiprecision and mixed MOVE to SR Move to Status Register size arithmetic functions. These in MOVE from SR Move from Status Register clude ADDX, SUBX, NEGX, and EXT MOVE to USP Move to User Stack Pointer
(sign extend). The test instruction NEG NEG Negate (TST) is used to set the condition codes NEGX Negate with Extend as a result comparing the operand to OR OR Logical OR the value zero. ORI OR Immediate ORI to CCR OR Immediate to Condition Codes Another powerful instruction in this ORI to SR OR Immediate to Status Register
category is the Test And Set instruction SUB SUB Subtract (TAS). TAS sets the N and Z condition SUBA Subtract Address codes based on a compare of the byte SUBI Subtract Immediate operand specified in the instruction SUBQ Subtract Quick with zero. The most significant bit SUBX Subtract with Extend
34 MICRO - The 6502/6809 Journal No. 52 - September 1982 68000 FEATURE ■
Shift and Rotate Operations tion code bits. Zeros are shifted into the tive address of the operand, all operand MSB during right shifts, and into the sizes are allowed. A shift count of one Bidirectional arithmetic and logical LSB during left shift operations. to eight bits may be specified in the in shift operations are performed in the struction, or a count of zero to 63 bits MC68000 by executing the ASR, ASL, Rotate operations (ROR and ROL) may be specified in a data register. LSR, and LSL instructions. Rotate oper rotate only the bits in the operand and ations may be performed with the ROR, do not include the contents of the ex Shifts and rotates on memory oper ROL, ROXR, and ROXL instructions. tend (X) bit. The operand is rotated in ands can only be single bit shifts and the direction specified by the instruc are restricted to word length operands. Arithmetic shift operations shift the tion, and the last bit rotated will also be operand in the direction specified. The contained in the carry (C) bit. The con Bit Manipulation Operations last bit shifted out of the operand will tents of the X bit will never be rotated be contained in the carry (C) bit and the into the operand. Several powerful bit manipulation extend (X) bit of the Condition Code instructions have been implemented in Register (CCR). When the operand is Extended rotate operations are pro the MC68000. Individual bits may be shifted right, the value of the sign bit of vided by the rotate with extend instruc tested (BTST), tested and set (BSETJ, the operand (Most Significant Bit) will tions (ROXR and ROXL), which in tested and cleared (BCLR), or tested be preserved., During left shift opera clude the extend (X) bit in the opera and toggled (BCHG). The BTST in tions, the Least Significant Bit of the tion. During these operations, the struction causes the state of the speci operand will be replaced by zero (0). previous contents of the X bit will be fied bit in the operand to be reflected by The overflow (VJ bit will indicate if the shifted into the MSB or LSB, depending the zero (Z) bit in the condition code sign of the operand has changed during on the direction of the rotate operation. register. The BSET and BCLR instruc the left shift operation. Multiple precision shifts and rotates tions allow the state of the specified bit can be performed using a combination to be reflected by the Z bit, and in addi Logical shift operations shift the of shift and extended rotate operations. tion, set or clear the specified bit after operand either right or left as specified the test. The BCHG instruction causes by the instruction. The last bit shifted All shift and rotate operations may the state of the bit to be reflected in the out of the operand in either direction be performed on memory or registers. Z bit, and also changes the state of the will be contained in the C and X condi When a register is specified as the effec specified bit in the operand to the op posite state after the test.
Bit manipulation operations may be performed on register or memory oper ands. If the effective address is speci Table 3: Addressing Modes fied as a register, the bit number speci fication is modulo 32, allowing all bits contained in the register to specified. Mode Generation Memory operands are restricted to byte Register Direct Addressing length and the bit number specification Data Register Direct EA = Dn is modulo 8. The bit number is Address Register Direct EA = An specified as part of the instruction, or Absolute Data Addressing in a data register specified in the Absolute Short EA = (Next Word) instruction. Absolute Long EA = [Next Two Words)
Program Counter Relative Addressing Relative with Offset EA = (PC) + dI6 Program Control Operations Relative with Index and Offset EA = (PC) + (Xn) + da
Register Indirect Addressing Program execution in the MC68000 Register Indirect EA = (An) is controlled by the Program Counter Postincrement Register Indirect EA = (An), An An + N (PC). The PC is updated in the normal Predecrement Register Indirect A n*— An - N, EA = (An) processing of an instruction to point to Register Indirect with Offset EA = (An) + dlfi Indexed Register Indirect with Offset EA = (An) + (Xn) + d8 the next instruction to be executed. The PC will either point to the next se Immediate Data Addressing quential instruction in memory, or to Immediate DATA = Next Wordfs) another instruction sequence else Quick Immediate Inherent Data where in memory as a result of a PC Implied Addressing modifying instruction. Implied Register EA = SR, USP, SP, PC The program counter is modified by Notes: the execution of an instruction in one EA = Effective Address of two ways. In the first way, the PC is An = Address Register Dn = Data Register modified by adding a displacement, Xn = Address or Data Register used as Index Register specified in the instruction, to the cur SR = Status Register rent PC to get the address of the next PC = Program Counter instruction to be executed. The dis ( ) = Contents of dft = 8-bit Offset (displacement! placement (word or byte) specified in d16 = 16-bit Offset (displacement) relative branch instructions is a two's N = 1 for Byte, 2 for Words and 4 for Long Words complement integer value, which ■*- = Replaces counts the relative distance in bytes.
No. 52 - September 1982 MICRO - The 6502/6809 Journal 35 The value of the PC is the address of and falls through if it is true. If the con System Control Operations the current instruction, plus two. The dition is not true, the contents of a displacement is calculated by the specified register is decremented and Several instructions offer easy im assembler when the program is assem the result compared to - 1. If the value plementation of system control func bled, or by the linker when building a is not - 1 , the branch will be taken. tions. These instructions allow logical load module. By adding displacements Otherwise control will resume with operations on the status and condition to the current PC, the program will be the instruction following the DBcc. All code bits, trap and exception process position independent, since all PC conditional branches are relative to the ing, special range checking, special pro changes are relative and control is current PC. Table 6 lists the conditions gram flow control operations, and even always resumed at the same location in that can be tested by the conditional a special peripheral reset operation. the program instead of an absolute branch instruction. memory address. This allows programs Many of these can be used only if to execute anywhere in memory in Unconditional branch instructions the MC68000 is in the supervisor mode stead of from a specific area. always force the destination address of (S bit in the system byte of the Status the branch to be loaded into the pro Register set) to support the operating In the second way, the PC may be gram counter. These branches may be system environment. These privileged modified by instructions that load an relative to the current PC or absolute instructions include those that change effective address value into the PC addresses. The BRAnch unconditional the state of bits in the system byte of when the instruction is executed. In instruction (BRA) will always cause the the status register (ANDI, EORI, ORI, this case, the value of the PC will be PC to be replaced by the value of the and MOVE EA to SR), change the value overwritten by the new address speci current PC, plus the relative displace of the User Stack Pointer (MOVE USP), fied in the instruction. When these in ment specified in the instruction. The ReTum from Exception trap (RTE), structions are executed, control will be JuMP instruction (JMP) causes the PC stop program execution (STOP), and transferred to the memory address to be loaded with the effective address cause the RESET pin to become an out specified regardless of where the pro specified in the JuMP instruction. put and be asserted (RESET). gram is loaded. There are also two subroutine call Instructions that directly change Program control operations are ac instructions. These instructions first the contents of the Condition Code complished with a collection of branch save the value of the current PC (ad Register portion of the status register instructions, subroutine branches, and dress of next sequential instruction to (ANDI, EORI, ORI, and MOVE EA to return instructions. Branch instruc be executed) on the system stack CCR) and store the status register tions can be conditional or uncondi (pointed to by address register A7), and (MOVE SR to EA) may be executed in tional. The conditional branches allow then cause the PC to be loaded with the user mode also. testing various condition bits in the address of the subroutine to be ex condition code register individually or ecuted. The Branch to SubRoutine The user program may also execute in Boolean combination. If the condi (BSR) instruction causes the relative intructions that might generate a trap. tion specified in the branch instruction offset specified in the instruction to be These are: the range checking instruc is met, the branch will be taken. If not, added to the PC. The Jump to Sub- tion (CHK); the specific trap generation the next sequential instruction will be Routine instruction (JSR) loads the PC to one of 16 trap vectors (TRAP); and executed. The conditional branch in with the effective address of the sub causing a trap on overflow bit set in the struction (Bcc) tests the condition routine specified by the effective ad condition code register (TRAPV). specified in the instruction. Then it dress specified by the JSR instruction. either branches or falls through to the next instruction, based on whether the There are two instructions that condition is met or not. The test condi return program control to the address tion, decrement and branch instruction stored on the system stack. ReTurn Addressing Modes (DBcc), tests the specified condition from Subroutine (RTS) pulls the new program counter value from the stack The MC68000's 14 addressing Table 4: Programmer’s Model and program execution resumes at that modes can be grouped into three broad for the MC68000 address. The ReTum and Restore in classes. These are: 1. Register District, struction (RTR) additionally restores 2. Memory, and 3. Inherent addressing. the condition code register from the DO stack when returning from interrupt D1 Register Direct Addressing Modes D2 processing. D3 Eight 0 4 Data In Register Direct addressing, the ef Q5 Registers Bcc and BSR can have displacement fective address is one of the 16 06 values of byte and word lengths. DBcc registers. Register addressing can be D7 always has a word length displacement divided into these two categories: 1. value. The effective address used by the Data Register Direct — Dn; 2. Address AO A1 JMP and JSR instructions is specified by Register Direct — An. The notation for A2 Seven the addressing mode of the instruction. Data Register Direct addressing is A3 Address A4 Registers "D n '1 (e.g., DO refers to data register A5 Another instruction that uses the 0). Likewise, Address Register Direct A6 condition codes is the Set according to addressing notation is "An’’. User Stack Pointer Two Stack condition (See). The See instruction Supervisor Stack Pointer Pointers tests the specified condition (see table 6) Memory Addressing Modes Program and sets the byte specified by the effec j Counter tive address to all ones if the condition Status Unlike Register Direct addressing, [System Byte User Byte | Register is true. Otherwise the byte is cleared. Memory addressing modes provide the
36 MICRO - The 6502/6809 Journal No. 52 - September 1982 68000 FEATURE■ address of an operand that is in memory. A list of Memory addressing Table 5: MC68000 Status Register modes for the MC68000 follows. System Byte User Byte Beneath each of the Memory address ing modes is an example of its assem 'is 13 10 6 ^ 4 0N bler syntax. All indirect references are T S ^ ^ ’2 ’ 1 N Z V C placed in parentheses. Trace Mode - 1. Indirect Addressing Supervisor 'k a. Address Register Indirect State J (An) Interrupt ^ b. Address Register Indirect with Mask ) Postincrement Extend — (An) + Negative — Condition c. Address Register Indirect with Zero — Codes Predecrement Overflow — -(An) Carry — d. Address Register Indirect with Displacement { disp(An) e. Address Register Indirect with Index b. Absolute Long b. Program Counter With Index disp(An + Im. W) where Im is Am inst.L ADDRESS disp(PC + In) where In is An or Dn or Dm disp(An + Im. L] where Im is Am 4. Immediate Addressing or Dm 3. Program Counter Relative Addressing a. Immediate 2. Absolute Addressing a. Program Counter with #xxx a. Absolute Short Displacement b. Quick Immediate disp(PC) #xxx . inst.W ADDRESS Icontinued)
SOUTHEASTERN MICRO SYSTEMS, INC. 1080 IRIS DRIVE CONYERS, GEORGIA 30207 404-922-1620 X SX-9 Single Board System PET/CBM™ ■ Uees 6600 CPU ■ Two RS232 Serial Ports » Two Parallel 8 Bit Porta 2000/3000/4000 Series • One High-Speed Serial Port • System Clock at 1.22 MHZ, Fixed not using a CRT, or display controller chip • System provides lor selectable diagnostics on power up or by com m and $275.00* ■ Provides (or automatic disk boot on p-ower up ■ Provides for board ID for future multi-user configuration or user d e fin e d Select either On The • Expansion capabilities via ribbon cable • Disk controller provides control fcr up to four 5 1/4' drives from 80 x 25 or 40 x 25 Built-in SS/SD up to DS/DD control Display • Real time clock • Memory 64K RAM (62K User Memory) • Ail signals via plug in ribbon connectors From the keyboard or program • Compatible with TSC FLEX 9 and all TSC 6809 single user software. DS/DD requires SEMS-1 Disk Drivers • Board size: 10.25* by 10.5* Displays the full, original character set • Power requirements: r5 VDC at 3 AMPS, r12 VDC at 250 ma, -12 VDC at 100 ma Available from your local dealer or: • Optional Cabinet with Power Supply EXECOM CORP. 1901 Polaris Ave. LIMITED OFFER PRICES Racine, Wl 5 3 4 0 4 8are Board With SEMS-1 ASS E M B LE D & TESTED Ph. 414-632-1004 Monitor & Documentation 80ARD WITH CA8INET ♦ Plus installation charge of $75.00 & POW ER SUPPLY
ONLY 100 Bare Boards SOFTWARE: TSC FLEX 9 Available only for Basic 3.0 & Basic 4.0 Will Be Soldi ORDER NOW! With S£MS Disk Drivers PET & CBM™a First order basis (with Editor & Assembler) trademark of Commodore Business Machines US SHIPPING $10.00, FOREIGN SHIPPING $50.00
No. 52 - September 1982 MICRO - The 6502/6809 Journal 37 MICRObits Table 6: Condition Codes Allowed for the DBcc, See, and Bcc Instructions. (Continued from page 29)
AIM 65 — Real Time Clock CC Carry Clear LS Lower or Same Provides hour, minute, second, day of c s Carry Set LT Less Than EQ Equal MI Minus week, day, month, year. Twelve- or F False * NE Not Equal 24-hour format. Pin compatible with GE Greater or Equal PL Plus AIM expansion connector (also SYM, GT Greater Than T True KIM). Pour switch selectable HI Higher VC Overflow Clear interrupts. Nicad battery backup. LE Less or Equal VS Overflow Set Industrial quality board 4.5 x 6. All ICs socketed. Single 5V supply. * The false condition does not apply to Bcc. Twenty-two-page manual. All software included. Bare board $29, Complete A&T $93, includes batteries. Add $4 shipping and handling. CA residents add 6%. Data Design Group The various forms of Address Regis Index, except that the program counter 7100 Mimosa Drive ter Indirect addressing provide great is used instead of an address register. Carlsbad, CA 92008 flexibility. In the simplest of these, the (714) 265-6940 effective address is the contents of the For normal immediate addressing, specified address register. In the Post the effective address is the word or long The Wrath of Khan increment mode, the effective address word immediately following the op is still the specified address register but code, depending on the size of the Can you defeat a Superman? the address register will be incre operation. Single bytes are stored as a Command Enterprise in a tactical mented after the operation. The Pre word (the upper byte is zeros). In Quick battle against the Reliant. Cl-P decrement mode is the same except the Immediate addressing, a special case of controls Reliant's maneuvers and address register is decremented before weapons via Artificial Intelligence immediate addressing, the immediate logic routines. Features full status the operation. The Pre-decrement and data (a number from 1 to 8) is contained display, sensors, photon torpedoes, Post-increment modes automatically in a 3-bit field in the opcode. Quick Im phasers, deflectors, and more. adjust the number of words to decre mediate addressing is available for Cassette 8K - $14.95 ppd. ment or increment based on the size of ADD and SUB instructions where con Cygnus Software the operation. For the Address Register stants are used frequently. Immediate Suite 432 Indirect with Displacement mode, the addressing limits the destination ad Ft. Lauderdale, FL 33311 effective address is formed by summing dressing mode to register direct. the contents of the specified address However, many special immediate in register with a sign-extended 16-bit off struction variants exist, such as ADDI, Perseus Programming for OSI set. The Address Register Indirect with for using memory addressing for the Boxed Jn — An adventure in which Index effective address is the contents destination address. you must escape to become a member of the specified address register, summed of the CIA. Rookie Mission —- Your with the sign extended 8-bit displace Implicit Addressing first mission as an agent and you ment and the specified index register. must find the traitor! Suicide Mission — An exciting graphics game that pits The index register can be any of the ad Many instructions make implicit you against an alien who has captured dress or data registers and can be references to the program counter, the your crew, and you must retrieve specified as either a long word or a word supervisor stack pointer, the user stack them against over-whelming odds. [which will be sign extended). The ex pointer, or the status register. For ex Tough! All programs run in 8K and on ecution speed of the Address Register ample, the RTS (return from sub a C1P, C2P, C2-4P, or C8P with a with Index is not affected by the size of routine) implies use of the program cassette-based system. Send $9.95 for the index. counter and the stack pointer. each or $22.95 for all. Perseus Programming In the Absolute Addressing modes, Using the MC68000 9311 Avery Rd. the effective address is specified in the Broadview Heights, OH 44147 word or words following the opcode. In In the second part, we hope to pro the case of Absolute Short addressing, vide a better feel for using the MC68000 OSI States and Capitals Drill the word is sign-extended to form the through a series of simple examples, In effective address. addition to showing assembler syntax, Let your kids use the computer and these examples will illustrate instruc learn at the same time! You won't The Program Counter addressing tions such as LINK, UNLK, and CHK believe this program is running on your 8K C1P! Graphics, screen clears, modes use the contents of the program which may be unfamiliar. no scrolling, and it even gives you a counter to form an effective address. grade. Get a correct answer and watch These modes are important for writing the flag wave. Cassette - $10.95 plus position-independent code. The Pro Joe felemensky and Tom Whiteside are $1.50 for postage. Math drill games gram Counter with Displacement mode engineers in the Motorola MOS also available. sums the contents of the program Microprocessor Design Group. They can Tripod Productions counter with a 16-bit sign-extended be contacted at Motorola, Inc., Mail Drop Rt. 11, Box 71 displacement just like Address Register M2880, 3501 Ed Bluestein Blvd., Austin, Bowling Green, KY 42101 Indirect with Displacement. The Pro Texas 78721. gram Counter with Index mode is iden (Continued on page 98) tical to Address Register Indirect with JMCftO
38 MICRO - The 6502/6809 Journal No. 52 - September 1982 GET FREE SOFTWARE FOR YOUR COMPUTER! HOW? JUST ORDER ANY OF THE ITEMS BELOW, AND SELECT YOUR FREE SOFTWARE FROM THE BONUS SOFTWARE SECTION, USING THE FOLLOWING RULE: FOR THE FIRST $100.00 WORTH OF MERCHANDISE ORDERED TAKE 1 ITEM; FOR THE NEXT $200.00 WORTH OF MERCHANDISE ORDERED TAKE ANOTHER ITEM; FOR THE NEXT $300.00 TAKE A THIRD ITEM, ETC. ALL AT NO COST.
HARDWARE by APPLE COMPUTER PRINTERS COMPUTER SYSTEMS APPLE II + 48K 1199 PASCAL 150 EPSON; ATARI FLOPPY OR + CNTRLR 545 FLOPPY DRIVE 465 MX80 449 M X 80 F /T 549 ATARI 800(16K ) 629 ATARI 4 0 0 (16K) 335 APPLE III. 128K 2999 PILOT 125 MX100w/Graftrax 729 MX70w/Graftrax 285 810 Disk Drive 449 825 Printer 599 We carry the rest ot the APPLE line at low. low prices' CALL1 APPLE Intfce/Cbl 85 GRAFTRAX 60 16K Ram Memory 89 850 Interlace 159 GRAPPLER Inttc 149 2K Buffer Serial Card 135 M icrosoft Basic 69 830 Modem 149 M X80Ribbon 15 MX100 Ribbon 24 INTEC32KRam Memory 129 Telelink Cartridge 25 OTHER HARDWARE for APPLE C.ITOH; ATARI800(48K) 739 AXL0N 128K Ram Disk 550 O.C. HAYES: F -10 Daisy Wheef (Par) 1495 F-10 Daisy Wheel (Ser) 1495 ATARI 4 0 0 (48K) 435 Micromodem II 285 Smartmodem 225 Pro-Writer (Par/Ser) 599 Pro-Writer (Par) 499 OSBORNE MICROSOFT: F -10Tractor Option 225 Printerinterfaces CALL Osborne 1 1695 PrinterCable 55 Z80Softcard 269 l6KRamcard 139 NEC: XEROX PC-8023A MOUNTAIN COMPUTER: 495 NEC 7710 Daisy 2345 820-1 Systemw/5"Dr. 2450 820-2Systemw/8"Dr. 2950 Expansion Chassis 559 Music System 339 QUME: 0IAB L0: CP/MOp. Sys. 159 W ordstar 419 A/0 + D/ACard 299 CPS M ulti-function 169 SPRINT 9 /4 5 1995 6 3 0 R /0 2099 Super Calc 199 DIABL0630 Printer 2099 Systems-PlusBIZ SOFTWARE, PER MODULE CALL' X / 10 Control Card 169 Super Talker 169 0KI0ATA: CALL FOR MORE PRICES' WE CARRY FULL LINE’ Microline82A 495 M icroline 80 375 NEC CALIFORNIA COMPUTER SYSTEMS: MicrolineTractor 59 O kigraphl 79 Full Line at Low, Low Prices' CALL1 Centronics Par Int 115 A/DConverter 105 Microline83A 799 M icroline 84 (Par) 1099 C0MM000REVIC Async S erial'nt 135 Calendar/Clock 101 I0S: VIC20Computer 259 VIC 151 Sprinter 335 CALL FOR MORE PRICES' WE CARRY FULL LINE1 560 with graphics 1095 Prism-Print Software 49 VIC 1540 Oisk Drive 499 VIC 1211 ASupr-Expndr 59 VI0EX: Prtsm 80 (Basic) 899 Prism 132 (Basic) 1050 VIC 1530 Datasette 69 VIC 1011A RS-232 Port 45 80 Col Bd & Softs wMch 235 Enhancer 11 125 Auto Sheet Feed 125 PrismColor 325 Enhancerl 105 Softsw itch 29 Sprint Mode (200cps) 125 Dot PlotGraphics 85 GENERAL CP/M SOFTWARE MORE OTHER HAR0WARE FOR APPLE: MICROSOFT; SSM A I0-II 195 Keybd Co Num Keypad 129 Basic 80 275 Edit80 139 SSM Serial AS 10 115 SunshineJoystick 39 ADD-ON MEMORY CARDS & DISK DRIVES Basic Compiler 299 MuMath/MuSimp 199 SSM Par AP10 99 Game Paddles 29 FOR APPLE Fortran 80 339 MuLisp/MuStar 159 Novation Apple Cat 319 S hadow /V et 885 MEMORY: Cobol 80 499 M-Sort 128 Versawrrter Tablet 249 SUP'R MOD 29 Microsoft 16KRamcard 139 Saturn 32K Card 199 M acro 80 139 Z-80Softcard/Apple 269 Prac Penph Microbuff Prac Penph Microbuff Legendl28KRamcard 649 Saturn 64K Card 369 (32K) 249 (16K) 210 MICROPRO: Legend 64KRamcard 299 Saturn 128K Card 525 Wordstar 275 Calcstar 199 Prometheus 128K SVA256KAPL-Cache 1045 439 Mailmerge 89 Supersort 165 OTHER SOFTWARE for APPLE: AXLQ N320KRam Disk 1149 16Kof4l16.200NSMem 25 Spellstar 165 Custom Notes 275 APPLE-COMPATIBLE FLOPPIES by MICRO-SCI: Oatastar 239 PERSONAL SOFTWARE/VISIC0RP: With Controller No C ontroller Visicalc 3 3 195 Visiliies 199 ASHT0N-TATE: A35 Exact Replacement 460 A35ExactReplffcement 415 dBASEII 475 dBASE H Guide 29 CALL FOR MORE PRICES' WE CARRY FULL LINE' A40 40-Track 489 A4040-Track 399 MICROSOFT: A70 70-Track 599 A70 70-Track 499 SORCIM: Super CaJc 189 APPLE Fortran (Z80) 129 APPLECobol (Z80) 499 8 FLOPPY 0ISK SYSTEMS: TASC Basic Compiler 139 M BASIC Compiler (Z80) 299 Vista OualSSOD 1299 Vista Dual DSDD 1599 F0X-GELLER: TIME Manager 125 M uM ath 199 SVA AM S8000 Dual SVA AMS8000 Dual Quickscreen 129 dUTIL 69 AIDS 99 M/SORT 149 SSDD 1945 0S0D 2595 Ouickcode (Writes programs ford BASE II) 199 MICR0-PR0: SVAZVX4 Quad Cntrllr 495 SVA Disk 2 + 2 Cntrtlr 359 ISA: Wordstar 225 Mail-Merge 99 CORVUSHARO 0ISKS: Spellguard 219 SP/LAW 99 Spellstar 149 Data-Star 199 6 MB Hard Disk 2249 Apple Interface 175 PEACHTREE: Super-Sort 149 Calc-Star 149 11 MBHardDisk 3945 Other Computer Intfce CALL Gen Ledger 3 9 9/40 Inventory 399/40 PEACHTREE: BIZ Packages, at 199 20 MB Hard Oisk 4769 Mirror Back-Up 675 Acct Rec. 399/40 Magtcalc 269/25 Acct Pay 399/40 Sales Invoicing 399/40 CPA BIZ Packages, atl 195 Payroll 399/40 MORE OTHER SOFTWARE for APPLE: SYSTEMS PLUS DBMasterlorCORVUS 399 MONITORS, PLOTTERS & PERIPHERALS OB Master 179 All Modules 415/EA Data Factory 5 0 239 PFS 85 MONITORS: ASCII Express 55 Dakin5Oeprec Planner 299 Zenith 12 "Green 125 Zenith 13 "Color 359 Sorcim Super Calc 189 Dakm 5 BIZ Bookkeeper 299 Amdek 12 "Green 135 Amdek 13 "C olor 359 S-100 BOARDS Howard Tax Prep 115 Broderbund Payroll 325 BMC 12 "Green 119 BMC 1 2 " Color 349 HAYESS-100M0DEM 325 HAYESSMARTMODEM 219 Howard Real Estate Anal 129 BPiAccounting Pkgs/ea 325 Electrohome RGB Inttce 275 Electrohome RGB 1 3 " Clr 725 HAYESCHR0N0GRAPH 189 CCS64KRAM BOARD 525 Synergistic "Data Reporter" Manages Plots & Edits Oata1 189 PLOTTERS: Watanabe 1-Pen 1150 Watanabe 6-Pen 1400 W0R0-PR0CESS0RS A SPELLERS for APPLE: Strobe Plotter 1-Pen 699 Strobel Apple Intfce 99 WordstarCP/M m EZW riter Prof Sys 21b Houston Inst DMP-3 929 Houston Inst DMP-4 1185 FLOPPY DISKS MagicWandCP/M 299 M U SE SuperText80 150 Elephant 5 25 Elephant 8 OTHER PERIPHERALS: Executive Secretary 199 W ordpower 5U SoftSSSD/bx 25 Soft SSSD/6x Scott Shadow/VET 885 Street Echo II Svnth 189 29 Letter Perfect 1 /5 Hebrew ll 5b 27 3M 8'' SoftSSSD/bx 32 Votrax Type-N’-Talk 325 ComputerSta. 0ithertizer269 3M 5 " Soft SSSO/bx Magic Window 85 Screenw riter li 110 Maxell 5" SoftSSSD/bx 31 Maxell 8" Soft SSSO/bx 35 ALF9-VoiceMusic Bd. 155 Comp. Sta VideoCamera375 Spellguard 219 Spellstar CP/M 149 DYSAN 5" Soft SSSO/bx 37 DYSAN8"SofSSSD/bx 49 Word Handler (Gives 80-Col & Lower-Case with no board1 iyy A LF3-V oiceM usic Bd. 199 Comp Stat Bothabove 599 BONUS SOFTWARE SECTION! Let us acquaint you with MESSAGE-MAKING SOFTWARE Just place the disk in the Records of files can be printed, if desired. Additional modules coming are a STATISTICS APPLE, enter the texi. and colorful, dynamic messages appear o r the screens of TV sets INTERFACE, CHECKBOOK, MAILING LIST 4 DATA-ENTRY. connected to the computer Use the soHware lo broadcast messages on TV screens in REQUIRES 48K. 4 ROM A P P LE S O FT ...... $40. schools, hospitals, factories, store window, exhibit booths, etc The following program is APPLE LITERATURE DATABASE: Allows rapid retrieval (via keywords) of references Irom our latest release total APPLE literature thru 1980, on 5.25 "disk. Each entry in the data base consists of the SUPER MESSAGE. Creates messages m lull-page “chunks" Each message allows article, author-name, periodicai-name. date of issue, & page nos. The database is statements ol mixed typestyles, typesizes and colors, in mixed upper and lower case intended to support large magazine files which would require lengthy manual searching Styles range from regular APPLE characters, up to double-size, double-width characters to recover information. Annual updates will be available with a heavy, bold font. Six colors may be used for each different typestyle. Vertical and REQUIRES 48K & ROM APPLESOFT. . . $60. horizontal centering are available, and word-wrap is automatic. Users can chain pages WORDPOWER Is a simple, powerful, low cost, line-oriented word processor program It together to make multi page messages. Pages can be advanced manually or automatical offers a fast machine language FIND & REPLACE. Text can ba listed to screen or printer, ly. Multi page messages can be stored to disc or recalled instantly with or without line-numbers. Lower-case adaptors are supported You can merge files, REOUIRES 48K & ROM APPLESOFT $50 move groups of lines, and easily add, change, or delete lines. WORDPOWER can be used APPLE PLOTS YOUR DATA 4 KEEPS YOUR RECORDS TOO! APPLE DATA GRAPH 2.1: to create and maintain EXEC files, it can also oe used as a rapid, unstructured, inlorma- Plots up to 3 superimposed curves on the Hi-res Screen both X & Y axes dimensioned. tion-storage and retrieval system via its No. 52 - September 1982 MICRO - The 6502/6809 Journal 39 IMAGE PRINTER SERIES Sensible Software is proud to introduce our new series of high resolution screen dumps. IMAGE PRINTERS provide a simple way to transfer high resolution graphic images onto paper. Each pro gram in the series has unique features that give you full control of the printing. Some of the included options are: Full control over the area of the HIRES screen to be printed. You graphically pick the area for the utmost ease and accuracy. One-step printout of the picture with the ability to pause or abort the printing at any time. Menu-driven. All options are invoked with single keystrokes. IMAGE PRINTERS are extremely easy to use. Multiple image sizes, 6 different sizes for letter quality printers, 4 sizes for other printers. • Creation of an inverse (negative) image for reverse printing. The ability to save the compressed and inverse images to disk. One time configuring for your printer and interface card. Why answer all those questions about your printer each time you want to print a picture? • The images may be printed anywhere on the page. IMAGE PRINTERS support most popular interface cards, such as cards from Apple, California Compu ter Systems, Epson, and Mountain Computer. (The SSM AIO Serial Card and user-written 'driver' routines may be used with the letter quality printers.) There are three separate versions of IMAGE PRINTERS, each one tailored to take full ad vantage of a different printer. IMAGE PRINTER— LETTER QUALITY. For all popular letter quality printers (Diablo, NEC, Qume, etc.) IMAGE PRINTER— EPSON. For the popular Epson MX-70, MX-80 and MX-100. I MAGE PRINTER— N EC P08023A. For the NEC dot-matrix printer. All versions ore available for $40.00 ea. Please specify version desired.
Sensible Software 6619 Perham Drive Dept MO West Bloomfield. Michigan 48033 * (313) 399-0877 Visa and Mastercard W elcome Please add $1 25 postage and handling per diskette
40 MICRO - The 6502/6809 Journal No. 52 - September 198 68000 Instruction Set by Joe Hootman
Table t: Data Movement
Mnemonic Data Size/CCR Name Comments/Address modes and opcode Editor’s note: The author has compiled several detailed tables of 68000 instruc MOVEA 16, 32 Mare Moves the contents of the source to the CCR Address destination address register. Sign of word tions. This month's article offers a brief XNZ V c data is extended to 32 bits. introduction to the 68000, along with - -- -- table 1. We will publish more instruc Opcode Format tion tables in future issues, including 15 14 13 12 11 10 9876543210 those on addressing modes. Destination Source 0 0 Size Reg 0|0|1| Mode | Reg
All addressing modes can be used for the source Since its introduction, the Motorola Held. • MC68000 has set a trend for 16-bit MOVEM 16, 32 Move Designated registers may be moved to an microprocessors that may become an CCR Multiple effective address. industry standard. One reason for the XNZ V c Registers 68000's quick success is the design Opcode Format philosophy Motorola used when the 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 68000 was conceived. Motorola wanted 0 1 0 0 1 direc 0 0 1 size Effective Addr. to give the 68000 a simple instruction tion Mode Reg. set, and a flexible set of addressing modes. They also wanted it to be com Register List Mask patible with 6800 peripheral hardware Direction: 0-register to memory, and to contain many programming fea 1-memory to register tures. The implementation of this Size: 0-word field, 1-long word philosophy allows 6800/6809 micro Post Increment Address Mode processor users to adapt easily to using 15 14 13 12 11 1C 9 8 7 6 5 4 3 2 1 0 both 68000 hardware and software. The instruction set, while compact, con A7 A6 A5 A4 A3 A2 A1 A0 D7 D6 D5 D4 D3 D2 D1 DO tains many special instructions that are Predecrement Addressing Mode unique to the 68000. These instruc 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 tions allow two different processing 3 states to exist in the 68000, as well as DO D1 D2 D3 D4 D5 D6 D7 A0 AI A2 A3 A4 A5 A7 movement of data from 6800 peri Predecrement Address modes cannot use pherals. Special arithmetic instructions Addressing modes: 1, 2, 4, 11, 12, 13, 14 * are also provided.
Post increment Address modes cannot use 68000 users can turn to several Address modes: 1, 2, 5, 13, 14 * references for help. The Motorola Users Manual1 is essential for every 68000 MOVEP 16, 32 Move Data is moved between data registers and user. An excellent book by L. J. CCR Peripheral memory. The high order byte of data bus is used X N ZV c Data when address is even; if address is odd the Scanlon2 explains the 68000 in detail, transfers are made to the low half of data bus. and provides excellent programming This instruction can be used to transfer data examples. The 68000 Microprocessor from 6800 devices. Handbook by G. Kane3 discusses char 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 acteristics and features of the 68000. 0 0 0 0 Data Op-Mode 0 0 1 Address Register Register
Special features of the 68000, which Displacement differentiate it from the 6800 series of microprocessors, are: Opmode: 100-Word from memory to register 101-Long word from memory to register 110-Word from register to memory 1. The data bus of the 68000 is 16 bits 111-Long word from register to memory wide. MOVEQ 32 Move Move 8-bit immediate data to a data register, CCR Quick with sign extension. 2. The 68000 is microprogrammed. XNZV c - • * 0 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 3. The 68000 is expandable. These ex 0 1 1 1 Register 0 Data pandable features will be defined by Motorola in the future. (ContinuedI
No. 52 - September 1982 MICRO - The 6502/6809 Journal 41 68000 FEATURE! Mnemonic Data Size/CCR Name Com ments/ Address modes and opcode 4. The 68000 will work with 6800 T MOVE from 16 Move from The contents of the status register is moved to parts, with a special software state SR CCR status the destination location. ment, and hardware for completing XNZ V c register the handshaking requirements. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Effective Address 5. The 68000 is capable of addressing a 0 1 0 0 0 0 0 0 1 1 Mode | Register large amount of memory. This instruction cannot use the following Address modes: 2, 10, 11, 12, 13, 14.* 6. The 68000 has a minimum number of instructions with a large number MOVE 8, 16, 32 Move data This instruction moves the contents of the of addressing modes. from source to the destination. XNZ V c source to - • • 0 0 destination 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 7. The 68000 is capable of supporting Destination (EA) Source (EA) multiple users. 0 0 Size Register | Mode Mode 1 Register 8. A supervisory state exists that is pro The size specifies the size of the data to be tected from access by the user. This moved. state is used to support the overhead for multiple-user hardware inter 01-Byte 10-Long word ll*Word rupts, and certain classes of user The effective address of the destination cannot generated errors and traps. use: 10, 11, 12, 13, 14* 9. The hardware architecture and soft The effective address of the source can use all the addressing modes except 13, 14. * ware of the 68000 will easily support higher-level languages such as ADA, MOVE to 16 Move The content of the source is moved to the Pascal, Fortran, etc. CCR condition condition code register. X V NZ c “"k 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 * * * * These features indicate that the 1 Effective Address 68000 will exist in its present form, or 0 1 0 0 0 1 0 0 1 1 Mode ] Register | in a mildly modified form, for a signifi cant length of time. The expandable All addressing modes can be used except 13, 14* features of the 68000 will allow users to learn a machine, and develop soft SWAP 16 Swap This instruction exchanges the upper half of a ware and hardware, without fear of CCR register data register with the lower half of the data their work becoming quickly obsolete. X N z V c halves register. • • - 00 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 1 0 0 0 0 1 0 0 0 Register MOVE The addressing mode of this instruction is inherent. Table 1 displays the MOVE instruc EXG 32 Exchange This instruction exchanges the contents of two tions implemented in the 68000. These CCR registers registers. Hie exchange can take place between XNZV c any of the registers. instructions move data both inside the 15 1 4 1 3 12 11 10 9 8 7 6 5 4 3 2 1 processor from register to register, and from external RAM and external de Register Op-mode Register vices. The table indicates which bits 1 1 0 0 Number 1 Number are set in the USR with the completion Opmode: 01000-data registers of the instruction. The user part of the 01001-address registers status register is the lower eight bits of 10001-data and address registers the register; the system part is the up (bits 0-2 m ust be address register number} per eight bits. Motorola, in their in struction set, has chosen to refer to the LEA 32 Load The effective address is loaded into the user portion of the status register as the CCR effective specified address register. Condition Code Register (CCR). X N ZV c address
Register Effective Address A dash (—) in a bit location in 0 1 0 0 1 1 1 Mode | Register dicates that the operation has no effect on the bit. A * indicates that the opera This instruction cannot be used with the tion may alter the bit, depending on the following addressing modes: 1, 2, 4, S, 13, 14* data and operation. Note that all the PEA 36 Push The effective address is computed and the move operations except one do not set CCR effective long word is pushed onto the stack. the V or C bits; these bits can only be X N ZV c address set or cleared by an operation on data, 15 14 13 1211 10 9 8 7 6 5 4 3 2 1 0 or specific operations on the CCR. Effective Address 0 1 0 0 0 0 1 Mode | Register 0 1 0 The MOVE to CCR (move to condi This instruction cannot use the following tion code) can set or clear every bit in addressing modes: 1, 2, 4, 5, 13, 14 * the CCR. This instruction could be used •The Addressing Modes will be presented in future issues. to check on the state of the first four
42 MICRO - The 6502/6809 Journal No. 52 - September 1982 bits of a word, or to set or clear bits in structions is MOVE M [Move Multiple the incrementing of a register, LEA is the CCR. (The instruction could also Registers). This instruction allows the used with auto-incrementing or auto- be used to unstack the CCR from movement of the selected data registers decrementing addressing. memory.) to consecutive memory locations. It could be used to store the results of PEA (Push Effective Address) MOVE (MOVE data from source to multiple word arithmetic operations. pushes the specified address onto the destination) is a popular instruction For example, if the IEEE floating point stack. This instruction is used as the because it allows movement of data arithmetic standard is implemented, traditional push instruction. between data registers and address the registers would contain the various registers inside the 68000. It also components of the floating point num References allows the movement of data between ber. Note that because both data regis the 68000 and RAM. ters and address registers can be moved, 1. 16-Bit Microprocessor User's this instruction can be used to stack Manual, Third Edition. Prentice- MOVE and MOVE A (Move Address) the registers. Hall, Inc.; Englewood Cliffs, New are similar, except that MOVE A is the Jersey 07632. instruction reserved for moving data to MOVE P (Move Peripheral Data) is the address registers. That is, the used to move 8-bit data to the data 2. The 68000: Principles and Program destination register in the MOVE A in registers from memory, or transfer 8-bit ming, L.J. Scanlon, Howard W. structions are the address registers. The data from the data registers to memory. Sams and Co. Inc.; 4300 West 62nd MOVE instruction is generally used to This instruction, in conjunction with St., Indianapolis, Indiana 46268. move data to and from the data regis the proper hardware interface, allows ters. Proper coding results in the the transfer of data between the 68000 3. 68000 Microprocessor Handbook, G. MOVE A instruction. and 6800 peripheral parts. Kane, OSBORNE/McGraw-Hill; 630 Bancroft Way, Berkeley, Califor If you want to examine the status MOVE Q (Move Quick) allows the nia 94710. register to find out the state of the X, N, immediate movement of 8-bit data to Z, V, and C bits, as well as allowing the any designated data register. The sign checking of the interrupt mask, the of the data is extended to fill the 32 bits Professor Hootman can be contacted at the trace (T), and supervisor status, use the of the data register, thus the operation University of North Dakota, Dept, of MOVE from SR (Move from Status is always a long word operation. Some Electrical Engineering, University Station, Register) instruction. assemblers will use a MOVE Q instruc Grand Forks, North Dakota 58202. tion every time 8-bit data are to be One of the most powerful move in- moved. JMCftO
The SWAP (Swap Register Halves) is not the same as the previously discussed MOVE instructions, but it is Attention a data movement instruction. This in Z' S c o tc h \ struction will place the upper 16 bits of Software and the designated data register into the lower 16 bits of the designated data MEMOREX Hardware register. The lower 16 bits will be moved to the upper 16 bits of the regis \ferbatim. Manufacturers! ter. This instruction could be used to move data in a 32-bit register into a position to be tested by the CCR. maxell Have You Seen Our EXG (Exchange Registers) ex changes the contents of two registers Review s in Brief? using the full 32 bits of the two BASF registers. EXG will exchange data registers with data registers, address MICRO'S product review registers with address registers, and ad wabash department offers readers dress registers with data registers. This type of instruction, could move an ad Diskettes and all your media needs Our REGULAR prices are SPECIAL an easy-to-read and highly dress register to a data register to allow informative review of operations and testing of the state of CALL FREE 1800} 421-3957 current products. If you the address, while not destroying the C.O.D. charge cards accepted. contents of the data register. Excellent dealer program. would like your product(s) reviewed in MICRO, ask LEA (Load Effective Address) loads a for a list of our panel of specified address register with an effec tive address. LEA loads all 32 bits of the 1418 West Shaw Avenue qualified reviewers. You address register from memory. For ex Fresno. C A 93711 can contact them directly! ample, LEA cannot be used to load the address register from a data register. MOVE A can be used for this. LEA ef fectively increments or decrements the contents of a register. To implement
No. 52 - September 1982 MICRO - The 6502/6809 Journal 43 W t z a r d - S O S m ^ 3 H 9 0 2 7 ^ SERIAL OUTPUT BUFFER CARU THE TACKLER™ DUAL • MODE PARALLEL INTERFACE FOR Input a new task while your old task prints out THE APPLE* NO MORE DELAY 2 BOARDS IN ONE FOR NO MORE Apple software including COMPATIBILITY PROBLEMS! FOR SLOW PRINTERS Applesoft BASIC■, Integer An intelligent board to provide easy control of your printer's full potential. Plus a standard parallel W I Z A R D - S O B is a serial BASIC', CP/M. Pascal, etc. board at the flip of a switch - your assurance of compatibility with essentially all software for the printer interface that lets you ■ Fully compatible with most APPLE*. Hires printing with simple keyboard operate your Apple while data Apple II expansion boards. commands that replace hard to use software routines. No disks to load. Special features include from your previous operation ■ Low power consumption inverse, doubled, and rotated graphics and many text control features, available through easy is printing out. It ends waiting for cool reliable operation keyboard or software commands. while your printer prints. The ■ Leads soldered directly into It’s simple to print HIRES graphics from an APPLE computer with The Tackler from TYMAC. This is the first truly universal parallel interface! Plus the ROM W I Z A R D - S O B contains a board for reliable operation for your specific printer. Sophisticated intelligence when you need it, total compability that never lets you down. 16K byte “ character buffer” ■ Many formatting features. Change printers - no need to buy another board. Just plug in one of our that ma y be expanded to ■ Two-year factory replace ROM’S and you’re all set ROM’S available for Epson, C. Itoh, NEC, and Okidata - others available soon. 32K bytes of character buffer ment warranty You've asked us to make the TACKLER better than the others and we ing. It accepls data at the ■ RS-232 printer interface d M .______$15 9 .0 0 * Apple’s rapid transfer rate, compatible UPGRADEABLE PARALLEL PRINTER CARD stores the data and feeds it Backed by the world's # 1 A Universal Centronics type parallel printer board to your printer at the rate complete with cable and connector. This unique independent manufacturer of board allows you to turn on and off the high bit so the printer can accept. peripheral controllers that you can access additional features in many printers. Easily upgradeable to a fully intelligent ■ Fully compatible with all Available at all fine printer board with graphics and text dumps. Use Apple II and Apple II Plus* Computer Stores S249.00 with EPSON, C. ITOH, ANADEX, STAR-WRITER, NEC, OKI and others with standard Centronics computers Telephone (800) 854-8737 configuration. ______$ 1 3 9 .0 0 ■ Fully compatible with most (714) 850-1666 THE PERFORMER PRINTER FORMATTER BOARD for Epson, OKI, NEC 8023, CITOH 8510 provides resident HIRES screen dump and print formatting in firmware. Plugs into Apple slot and easy access to all inter fonts through menu with PR# command, ^'lUESPEH ll(ii:illl se with standard printer cards to add intelligence. $ 49.00 specify printer. ______Systems THE MIRROR FIRMWARE FOR NOVATION APPLE CAT II* SUBSIDIARY OF WESPERCORP The Data Communication Handler ROM Emulates syntax of an other popular AppleG Modem product with improvements. Plugs directly on Apple CAT II ■ Registered Trademark of Board. Supports Videx and Smarterm 80 column cards, touch tone and rotary Apple Computers, Inc. dial, remote terminal, voice toggle, easy printer access and much more. List $ 3 9.0 0 ______introductory Price $29.00 DOUBLE DOS Plus A piggy-back board that plugs into the disk-controller card so that you can switch select between DOS 3.2 and DOS 3.3. DOUBLE DOS Plus requires APPLE DOS ROMS.______$ 3 9 .0 0
NIBBLES AW AY II AGAIN! Ahead of ail others. AUTO LO AD PARAMETERS . . . Free’s the user from having to Manually Key in Param values used with the more popular software packages available for the Apple II. EXPANDED USER MANUAL . . . incorporates new Tutorials for .all levels of expertice; Beginners Flowchart for ‘where do I begin’ to ‘Advanced Disk Analysis' is included. TRACK/SECTOR EDITOR . . .An all new Track/Sector Editor, including the following features: Read, Write, insert Delete Search, and impressive Print capabilities! DISK DIAGNOSTICS . . . Checks such things as. Drive Speed, Diskette Media Reliability, and Erasing Diskettes. HIGHEST RATED . . . Best back up Program in Softalk Poll (Rated 8.25 out of 10). CONTINUAL UPDATES.. .Available from Computer Applications and new $ 6 9 .9 5 listings on the source. ______M r H. SEEL. S u p e r P I X h ir e s s c r e e n d u m p ------The Software package that will allow your printer to dump page 1 or page 2 of the Apple Hires screen horizontally or vertically. Use with EPSON* MX-80 with or without GRAFTRAX* Roms, MX-70 - OKI* Microline 80, 82, 83, 82A, 83A - C. ITOH* 8510 and NEC 8023A Requires Tymac Parallel Printer Board PPC-100 ... $24.95.______APPLE L IN K -A versitile modem utility that provides the Apple user the ability to transfer disk files and software over the phone. Only one package needed for full transfers. Compatable with all DOS file types. $59.00 ______(requires Hayes Micro Modem) ______THE APPLE CARD -Two sided 100% plastic reference card Loaded with information of interest to all Apple owners. $3.98 >*■■1 .I /MICRO-WARE DIST. INC. ; P-O. BOX 113 POMPTON PLAINS. N.J. 07444 Deaier ancj Distributor Inquires Invited. It P a y s to W rite for MICRO! MICRO Magazine is actively seeking articles to present to our unique audience of sophisticated computerists. We welcome contributions on any aspect of 6502/6809/68000 hardware and software. Send us your latest ready-to-key-in program!
Each issue of MICRO presents articles on a wide range of systems and topics. In addition, each issue includes a special feature. We are planning features on the following topics:
January-Math and Simulations February-Languages March-Printers April-Communications May-Wave of New Computers June-Operating Systems
If you’ve developed material relating to these subjects, w e’d like to see it! Send articles to the attention of the editorial department. We are con tinually looking for good articles and/or programs for the:
Atari, Apple, CBM/PET, VIC, 68000, 6809, and TRS-80 Color Computer.
Standard MICRO categories that may be included in any issue are:
I/O • BASIC Aids • Machine-Language Aids • Graphics Games • Applications • Programming Techniques • Utilities Programming Languages • Hardware
We are also interested in topics our readers feel are important. Send in your own feature suggestions!
MICRO is sold in computer stores and on newsstands all over the world! Publishing an article in MICRO means quick distribution of your ideas.
W e’re proud of the fact that MICRO’S circulation is growing by leaps and bounds. And, we pay as well as BYTE! Get a copy of our Writer’s Guide now!
Special Note to all MICRO authors: please begin sending your text as well as your programs in machine-readable format. This will enable us to edit the text with the help of word processing. Continue to include a printed text version as you include a printed program listing.
No. 52 - September 1982 MICRO - The 6502/6809 Journal 45 FOR YOUR APPLE II Industry standard products at super saver discount prices
80 COLUMN SPECIAL AND NEW VIDEO DISPLAYS FOR APPLE II 5 MEGABYTE HARD DISK SMARTERM For Apple II. Supplied with controller. Use with CP/M, Apple DOS, & Apple Pascal ..... $1995 PARALLEL PRINTERS (Not to be confused with SU P R T E R M ) 51/4” DISK DRIVE Software switching from 80 to 40 and 40 to 80 NEC 8023 or C-ITOH 8510 characters. 9 new characters not found on the Use with standard Apple II disk controller. .$295 Apple keyboard. Fully compatible with CP/M* and (Virtually identical) Specifications: • 100 CPS dot Apple PASCAL*. With lowest power consumption matrix printer • 80 column print-136 characters 5V*” FLOPPY DISKS of only 2.5 watts. per line • Tractor/friction feed • 7 different print With hub rings.Boxof 10. (List: $345)...... $225 fonts included • 2K printer buffer • Proportional With other purchase ...... $19.95 spacing • Bit image graphics and graphic symbols. Without purchase ...... $23.00 SMARTERM EXPANDED CHARACTER SET 7" x 11" matrix with true decenders. Add to NEC 8023 or C-ITOH...... $495 16K MEMORY EXPANSION MODULE above...... $40 N E C 8023 or C-ITOH 8510 with The preferred 16K RA M Expansion Module from Parallel Interface and Ca b l e ...... $550 PROMETHEUS. Fully compatible with CP/M" and „ „ Combination SM A R T E R M and E P S O N 100 with Parallel interface Apple Pascal-. With full 1-year parts and labor BestBuy! EXPANDED CHARACTER SET ...... $749 warranty. (List: $169) ...... $75 and Cable Special at ...... $260 VIDEX, VIDEOTERM ...... $249 WORD PROCESSING SPECIAL VIDEX ENHANCER II...... $119 Z-80 CARD FOR YOUR APPLlh WITH WORDSTAR AND SUPERCALC! MICROSOFT SOFTCARD Do professional word processing on your APPLE. -j i M l r CENTRONICS COMPATIBLE With CP/M'and MBASIC. All necessary hardware and software included. Complete 80 column video display, enhanced PARALLEL INTERFACE (List: $399) ...... $289 character set, 16K memory board, Z-Card with From PROMETHEUS. For use with Epson, NEC, BestBuy!!! CP/M* software, Wordstar and word processing C-ITOH, and other printers. Fully compatible with software and SuperCALC. ADVANCED LOGIC SYSTEM CP/M* and Apple Pascal®. (List: $1,128)... .Special at $695 PRT-1, Only ...... $69 Z-CARD WithC-PM Has everything the Softcard has except MBASIC. GRAPHITTI CARD Works with Microsoft's disks too. from Prometheus! ExpandaRAM Prints HIRES page 1 or 2 from onboard firmware. Features: True 1:1 aspect ratio, prints emphasized (List $269)..... Special at $195 The only 128K RA M card that lets you start with 16K, 32K, or 64K of memory now and expand to mode, reverse mode, rotates 90 degrees... plus ALS SYNERGIZER the full 128K later. Fully compatible with Apple more. Compare all this with the Grappler. We think Pascal, CP/M1, and Visacalc. No Apple modifi you'll agree that this is the best graphics card on CP/M" operating package with an 80 column cation required. Memory management system in the market. Specify for use with EPSON, NEC- video board, CP/M- interface, and 16K memory cluded with all ExpandaRAMs. Disk emulators 8023, C-ITOH Prowriter, orOkidata. expansion for Apple II. Permits use of the full included with 64K and 128K versions. (List: $125) ...... $89 range of CP/M' software on Apple II. Includes SuperCALC. MEM-32 Two rows of 16K RAM S (List: $749) ...... $549 make a 32K RA M Card...... $209 SOFTWARE MEM-64 One row of 64K RAM. WORDSTAR ...... Special at $195 U-Z-80 PROCESSOR BOARD With DO S 3.3 disk emulator...... $299 SPELLSTAR ...... $125 (From Europe) M E M - 1 2 8 Two rows of 64K RA M S installed S U P E R C A L C ...... $175 Software compatible with Softcard and m a k e a 128K Card. D BASE II $525 ALS Software...... $149 With DO S 3.3 disk emulator...... $399 VISICALC...... $149 MEM-RKT 64K RA M Add-On-Kits- D B MA S T E R ...... $189 MICROSOFT + PREMIUM SYSTEM 64K Dynamic RAMS. Each ...... $125 Includes Videx Videoterm, Softswitch, Microsoft VISICALC Expansion Program All equipment shipped factory fresh. Manufacturers' warranties and Softcard, Microsoft and Z-80 Card, and for ME M - 1 2 8 ...... $75 included. Please add53.00 per product for shipping and handling. California: add % tax; BART Counties: / %. Osborn CP/M' Manual...... $595 M E M - P S L Pascal disk emulator for 6 6 12 M E M - 1 2 8 ...... $45 All items are normally in stock
JOYSTICK MODEMS FOR YOUR APPLE II P h o n e f a r Q u i c k • • HAYES Smartmodem ...... $229 Takes the place of two MICROMODEM II...... $279 S h i p m e n t ! Apple Paddle Controllers. From BM P Enterprises. Heavy duty industrial con [415)490-3420 struction and cable. Non-self centering. With ... And we ’ll be here to help after you polarity switches for consistent motion control. receive your order. Feel free to call the SGC (List: $59) ...... $39 Technical Staff for assistance.
MONITORS FOR YOUR APPLE VERSAcard FROM PROMETHEUS Four cards on one! With true simultaneous opera A M D E K 300G tion. Includes: (1) Serial Input/Output Interface, ( 1 8 M H Z Anti-Glare Screen) ...... $179 (2) Parallel Output Interface, (3) Precision Clock/ NEC 12” HIRES GR EEN ...... $179 Calendar, and (4) BSR Control. All on one card. SUPER SPECIAL! Fully compatible with CP/M- and Apple Pascal*. The m ail o rd e rspecialists SPECIAL 12” GR E E N MO N I T O R ...... $99 (List: $249) ...... $169 342 Quartz Circle, Livermore, CA 94550
46 MICRO - The 6502/6809 Journal No. 52 - September 1982 TM
Apple Slices
Listing 1 simplicity. I implemented this in my By Tim Osborn FIND routine (lines 9000-9060) by in crementing the record number (KEY) 0 A5 - " * 1 0 CDS - CHR? ( 4 ) until a free record was found or until I This month's Apple Slices presents a 20 PRIWT CD$"0PB* TE5T-FII2,U 00" searched 20 records. I recognize a free technique to quickly access records on 30 FOR J - 0 ID 500 record by NM$ being equal to NAM$ a random access file. This technique, 40 PRIWT CD?"WRITE TEST-FUJE,R"; J (NAM$ is set to null by the ADD called hashing, key-to-address trans 50 FOR I - 1 TO 6 routine before calling FIND), or by 6 0 PRIWT AS formation, or randomizing, converts a 7 0 NEXT NM$ being equal to " 0 ” . NM$ is null if user key into an address (or record 8 0 NEXT the record has never been used (this is number) where the record associated 9 0 PRIWT CDS “CLOSE T E S T -F T IZ " the way the file is initialized when with the key is stored. This key may be listing 1 creates the file) and NM$ is a customer number, part number, in equal to " 0 " if it was used at one time voice number, or anything that iden but is now available. The reason for a tifies the target record to the user. search the chain until the key of the different code for a once-used record is stored record matches the search that the program must continue to Hashing should be used where quick key. The disadvantage of this tech search up to 20 records, or until NM$ is random access is desirable. If the ap nique is that the chain must be equal to null (" to make sure the plication calls for a lot of sequential maintained and the overflow space new record is not a duplicate. If NM$ = processing, hashing will not be a good must be managed, which adds com “ ” , then I know a record with this design choice for data organization. In plexity. The advantage is that any same key could not have been stored situations where data is accessed by number of overflows can be sup further into the file. It would have been key in some undetermined order, ported as long as there is spare room stored here if it had searched this far hashing is at an advantage, because in the overflow area. before. If NM$ = " 0 ” , it is possible that most records can be found within a few this record was used when a record reads. Listing 2 is an example in which 2. Distributed overflow space: Instead with the new record's key was added name and address records are hashed on of using a separate overflow area, and the system had to look further into the name field. I will refer to the listing overflows are interleaved with nor the file at that time to find a free space. to help clarify some points and to pre mal records by setting aside some sent a practical example. records and designating them as If it finds a duplicate, the RC (return overflow. The advantage here is that code) is set to 3 and returns to the ADD An important consideration in the proximity of an overflow may subroutine. The ADD subroutine will hashing is dealing with collisions or allow it to be accessed without re display a message and return to the overflows. An overflow occurs when quiring additional head movement main menu (line 7034). If NM$ = " 0 ” , two or more keys in the key range gen of the random access device. For FIND saves the available record num erate the same address (home record) Apple owners this means that we ber in KY and sets RC = 2. This tells the within the address range. This can hap would attempt to store overflows on ADD subroutine to use KY instead of pen if there are as many variations in the same track as the home record. KEY as the available space. This is the key set as there are addresses to The disadvantage is that chain main necessary because the FIND subroutine store the data. For example, in my tenance adds complexity to the continues to increment KEY to search name and address retrieval system system. for a record with a null value in NM$. (listing 2), the file can hold up to a This process can be described as maximum of 500 records (a system 3. Open addressing: This technique follows (upon return to ADD): design constraint) and there are an in tries to store the record in the home finite number of names. Therefore, space first; if it is full, it stores the many names may be transformed into record in the next available space. 1. If R C =0, then KEY = the available the same address, creating overflow This method is easy to implement. space where we can store the new situations. As long as a sufficient amount of free record. space exists in the file, the record Some overflow handling techniques can be stored close to the home 2. If RC = 1, then 20 records were include: record. The disadvantage is that, searched and all were used. (ADD when the file begins to fill up, the will display a "FILE TOO FULL” 1. Overflow linked lists: A separate search time increases, as it takes message.) area of the file is set aside for longer to find an unused record. overflows. If an overflow occurs, it is 3. If RC = 2, then a previously used stored in the first available overflow After considering the various tech record was available. The value in space and chained off from the home niques available, I chose the open ad KY will be used as the available record. On a recall it is necessary to dressing technique because of its design space.
No. 52 - September 1982 MICRO - The 6502/6809 Journal 47 4. If RC = 3, then the new record is a Listing 2 duplicate. |ADD will display a “DUPLICATE RECORD" error message.) 1 GOSUB 10000: RBt INITIALIZE THRIf 10 BIG - 15:FL - 500:CD$ - CHRS ( 4 ): DIM SVS(6) FIND can be forced to search more 14 PRINT CDS “OPEN TRST-FILE, L100" records by raising the value of BIG 15 m w r CDS 16 IF RC - 0 THHJ OTIO IS (which is currently set at 20). If BIG is 17 FOR J - I TO 3000: NEXT J:RC - 0 decremented, it is possible that 18 HOE : PRINT "(Q)UIT (A)DD" previously stored records will not be 20 INPOT “(CMAUGE (D)EUCTE (I)NQUIRE ";AS 30 IP AS - "A" THM OOSUB 7000: GOTO 16 found. I did some extensive testing 40 IP AS - "C" THM OOSUB 7200: GOTO 16 with random key values and found that 50 IP A$ - "D" TOM OOSUB 7500: GOTO 16 the “FILE TOO FULL" message was 60 IP AS - " I " TOM OOSUB 8500: GOTO 16 produced when the file contained ap 70 IF A$ - "Q“ TOM PRIOT CDS'CICSE 'TOST-FILE": END 80 GOTO 18 proximately 300 records with BIG set 5998 RBI at 20. The trade-off is between efficiency 5999 RBI ****OOMPOIB ADDRESS**** and space; the further you allow 6000 KEY ■ 0 6002 Ul - UN (KEYS) records to be stored from the home 6005 FOR I - 1 TO IN record, the lower the efficiency. The 6010 MDS - MIDS (KEYS,1,1) more you limit record storage to the 6015 FOR J - 0 TO 35 home record, the larger the amount of 6020 IP - TBU$(J) TOM KEY - KEY + (J * J / 3) :J - 35 6030 NEXT i NECT wasted space. 6050 KEY - KEY * KEY 6060 KEYS - SIRS (KEY) The other major consideration 6070 KEYS - HID$ (KEYS,2,3) when designing a hashing system is the 6080 KEY - VAL (KEYS) 6090 KEY - m r (KEY * .5) key-to-address transformation tech 6100 RETURN nique. This technique converts the 6448 RBt user key into a physical location for 6449 RBt ****WRITE RECORD**** 6500 PRIWT CDS; “WRITE TEST-FIUE , R“;KEY storage. All techniques transform the 6510 PRIOT NM$ key into a number within an order of 6520 PRIOT RDS magnitude that is the same as the 6525 PRIOT CTYS number of addresses (records). Then 6527 PRIOT ST$ 6530 PRnrr zps they multiply the intermediate result 6535 PRIOT TELS by a factor that limits the final result to 6540 PRIOT CDS the range of addresses available on the 6550 RETURN 6998 RSt storage device. 6999 RBt ****ADD RB30RDS**** 7000 FUSES - "ADD“:NRMS - "" 7005 GOSUB 8000: RBt (ST INPUTS 7006 SVS(l) - »t$iSV S(2) - HDS:SVS(3) - CWSiSVS(4) - ST$:SVS(5) - ZPS:SV S (6) - TELS 7007 KEYS - IMS In my system I chose a method 7010 GOSUB 6000: RBI 03MPOTE ADDRESS called center-squaring. This method in 7020 GOSUB 9000: RBt FIND AVAIL. RET volves taking the key value, converting 7025 FUCS - "* it into a number which can be squared, 7027 IP RC > 0 TOM PRIOT CDS 7030 IP RC - 1 TOM INVERSE : PRINT "FILE TOO FU Ii": NORMAL : RETURN squaring the number, stripping off as 7032 IP RC - 2 TOM KEY - KY many outer digits as necessary, and 7034 IF RC - 3 TOM INVERSE : PRINT "DUPLICATE RECORD": NOFMAL : RETURN multiplying by a factor to limit the ad 7035 IMS - SVS(l) :RD$ - SVS(2):CIYS - SVS(3):ST$ - SVS(4):ZPS - SVS(5)iTE dress to the valid range. My COM L$ - SV$(6) 7040 G36UB 65001 RBt WRITE RB33RD PUTE ADDRESS subroutine (lines 7050 RETURN 6000-6448) follows this sequence of operations. 7199 RBt ****OtANffi***** 7200 HOME : PRIOT "DO YOU WISH TO CHANGE TOE NAME?” 7210 INPUT “RH>Ur (Y)ES OR (N)O ”;AS 1. Line 6000 sets KEY to 0. KEY will 7220 IF AS - *N“ GOTO 7290 become the address of the home 7230 IP AS < > "Y* GOTO 7210 record — the first record where we 7235 INPUT "OLD NAME - “iNMS: IF NMS - "" GOTO 7235 will attempt to store a new name 7240 KEYS - NM$: GOSUB 6000: RBt COMPUTE ADDRESS 7250 HAMS - IMS: GOSUB 9000: RBt FIND RECORD and address record. 7260 IP RC - 1 TOM : INVERSE i PRINT "RECORD HOT FOUND": NORMAL : PRINT COS: RB1TJRN 2. Line 6002 finds the length of KEY$, 7270 IMS - "0" i GOSUB 6500: RBt 0EU5TE OLD RECORD 7280 INPUT "NW NMC - “:»t$: IF Wt$ - “" GOTO 7280 which holds the name associated 7282 KEYS - IMS with the new name and address 7284 GOSUB 6000: RBt COMPOTE NEW KEY record. 7286 GOTO 7330 7290 INPUT "NAME - ";NM$:KEY$ - Wt$: IF )M$ - "" GCTO 7290 7300 GOSUB 6000 3. Lines 6005-6030 convert KEY$ into 7310 NMS - (MS: GOSUB 9000: RBt FIND RECORD a number through table lookups and 7320 IP RC - I TOM INVERSE : PRIOT "RECORD HOT FOLND": NORMAL : PRINT store the accumulation in KEY. The CDS i RE1UKN (J * f / 3) expression in line 6020 7330 INPUT "CHANGE STREET? , (Y)ES OR (N)0 "jAS 7340 IF AS - *Y* TOM INPUT "STREET - ";RD$: GCTO 7360 helps insure that a number of the 7350 IP AS < > "N" GOTO 7330 proper magnitude is produced. (Continued)
48 MICRO - The 6502/6809 Journal No. 52 - September 19S; 4. Line 6050 squares KEY. Listing 2 (Continued) 5. Line 6060 converts KEY back to a 7340 IF AS - "Y" THBJ INPUT "STREET - ";RD$: GOTO 7360 string (KEYS). 7350 ip a$ < > "N" goto 7330 7360 INPUT "CHANGE CITY?, (Y)ES OR (N)O ";A$ 7370 IP AS - “Y" THBI INPUT “CITY - ";CTY$: GOTO 7382 6. Line 6070 takes out the second, 7380 IP A$ < > "N" anno 7360 third, and fourth digits, and stores 7382 INPUT "CHANGE STATE?. (Y)ES OR (N)O ";AS 7384 IP A$ - "Y" THEN INPUT "STATE - ";S T $: OCTIO 7390 them back in KEY$. 7386 IP A$ < > "N" GOTO 7382 7390 INPUT "CHANGE ZIP?, (Y)ES OR (N)O “;AS 7. Line 6080 converts KEY$ back to a 7400 IP A$ - *Y* THBJ INPUT "ZIP - "?A$: OOTO 7420 numerical value (KEY). 7410 IP A$ < > "N“ OOTO 7390 7420 INPUT "CHANGE TEL. NO?, (Y)ES OR (N)O ";A$ 7430 IP A$ - "Y" THBJ INPUT "TEL. NO. - “;TCU$: GOTO 7450 8. Line 6090 brings KEY within the 7440 IF A$ < > "N“ OOTO 7420 range of records on my file. When 7450 GOSUB 6500 listing 1 creates the file, it creates 7470 RETURN 7498 RB4 500 records, thus the factor of .5. 7499 REM * * * * nRT J7TE**** 7500 HOME 7510 INPUT "NAME - "jKEY$ It is important that a key-to-address 7515 SAMS - KEfS 7520 GOSUB 6000: RBI COMPUTE ADDRESS transformation method spread the 7530 OOSUB 9000: RBI FIND RECORD records throughout the file as evenly as 7540 IP RC - 1 THBJ INVERSE : PRINT “RECORD MOT FTXJND" i NOSMAL : PRINT possible to minimize overflows. The CD$: RETURN address generated should bear no rela 7550 K4$ - "0" 7560 OOSUB 6500: RBI WRITE RHDRD tion to the key, so that a key with a 7570 REIUOJ higher value may be stored below a key 7998 RIM with a lower value. This is often 7999 RBI ****GET INPOTS**** 8000 HOME necessary because applications have 8010 INPUT "NAME - ":NM$: IF tW$ - " “ OR NM$ - "0" GOTO 8000: RBt R many records with similar keys. If E5ERVED NAMES there is a relationship between the keys 8020 INPUT "STREET - ";FD$ and the addresses generated, it would 8030 INPUT "CITY - ";CIY$ 8035 INPUT "STATE - “;STS cause one part of the file to become 8040 INPUT "ZIP - ";ZP$ full; overflows will occur in great 8050 INPUT “TEL. NO.- “;TEL$ numbers. 8060 RETURN 8498 REM 8499 REM ****IM3UIRE**** I hope I have provided enough infor 8500 HOME : INPUT "NAME =■ " ;NAM$ mation to allow you to develop your 8505 KEY$ - NAM$ own hashing applications. If you don't 8510 GOSUB 6000: REM COMPUTE ADDRESS 8520 GOSUB 9000: RBI FIND RBOORD feel up to programming your own 8530 IF RC » 1 THBJ INVERSE : PRINT “RECORD NOT FOUND": NORMAL : PRINT system, listing 1 and listing 2 can be CD$: RETURN used as a quick-access address book. 8550 PRINT “STREET - “;RD$ Remember to run listing 1 first to in 8560 PRIWT "CITY - “;CTY$ 8565 PRINT “STATE - “;STS itialize the file. If you get the "FILE 8570 PRINT “ZIP - “;ZP$ TOO FULL" error message, then you 8580 PRINT “TEL. NO.» “rTELS may wish to bump up BIG, which is in 8590 PRINT itialized on line 10. This will slow 8600 PRINT “PRESS RETURN TO CONTINUE" 8610 GET A$ down access but will allow you to store 8620 RETURN more records. 8998 RBI 8999 REM ****FIND RB30RD**** 9000 J =■ 0:RC - 0 Otherwise, you can change listing 1 9010 IP J < > BIG GOTO 9020 to load more than 500 records. If you 9012 IF RC - 0 THEN RC - 1 : RETURN do, remember to change FL (file length 9014 RETURN : REM RC>2 — line 10) from 500 to the number of 9020 IF KEY > PL THEN KEY » 0 9030 PRINT CD$“READ TEST-FIUE,R",-KEY records you wish to load. Also change 9040 INPUT NMS,RD$,dYS,ST$,ZPS,TCLS the range multiplication factor from .5 9042 IP FUCS < > "ADD" THBJ GOTO 9050 to .xxx, where xxx is equal to the 9044 IF (#4$ - "0“ AND RC - 0 THHJ KY = KEY:RC » 2 : OOTO 9060 number of records you wish to load 9045 IF » SV S(l) THEN RC - 3 : RETURN 9050 IF NMS - NAMS THBJ PRINT CDS: RETURN (line 6090). If you plan to load more 9060 KEY - KEY + 1 :J - J + 1: GOTO 9010 than a thousand records, you will need 9998 RB4 to change the center-extraction from 9999 RBI ****BUILD T&HTK**** 10000 DIM TBL$(35) MID$ (KEYS,2,3) to MID$ (KEYS,2,4) 10010 FOR J = 0 TO 35: READ TOL$(J): NECT J or MID$ (KEYS,3,4). 10015 RETURN 10100 DMA “1 ", "2“ , “3“, “4“ , "5 “, "6” , “7“ , “8 “, “9 “, "0 ", "Q“, "W", "E ", "R", "T ", "Y", “U“, "I “, “O", “P ", “A", "S“, "D", “F ", “G", "H", “ J" , “K", "L ", “Z", "X", “C“, “V", “B“, “N", “M" Reference
1. Computer Data-Base Organization, by James Martin, Prentice-Hall, Englewood Cliffs, New Jersey. JMCftO
No. 52 - September 1982 MICRO - The 6502/6809 Journal 49 Three minutes to find that "just right" property.
Search through up to 3600 property listings with Real-Soft programs for Real Estate Agencies.
No need to flip through endless pages of listings to find that "just right" property. Simply have your client specify the price range, number of bed rooms, preferred geographical location, accept able house styles and up to 12 additional listing features. REAL-SOFT programs will find the right properties quickly and impressively giving you more time to view the selected properties and close the sale!
REAL-SOFT is an integrated set of computer pro grams designed specifically for real estate agency use. All routines are fully customizable to meet the requirements of virtually any agencies. Up to 10 different house styles, 12 different listing features and 16 different areas. Very easy to learn — in cluded is a complete set of practice data to experi ment with. Requires 48K Apple II, 2 disk drives and monitor. Printer is optional.
If printer is used a printout of selected properties can be output in only a few minutes for your client to view and discuss in detail.
Other useful routines in this powerful set of pro grams include a Property Availability Report, full Mortgage Amortization Tables (American OR Canadian method), and a Mortgage Compari son Analysis Report. Then use still another part of REAL-SOFT to estimate the replace ment cost of any listing (using local factors), or to estimate the mortgage amount that your client can qualify for!
Available at your local Apple dealer.
R E A L-S O F T Real estate software 1450 West Georgia Street, Vancouver, B.C. V6G 2T8
Apple II is a trademark of Apple Inc. Telephone (604) 669-2262
50 MICRO - The 6502/6809 Journal No. 52 - September 1982 AMPER-POS for the Apple
by Philippe Francois
This machine-language utility where: System Requirement extends Applesoft to include a A$ is the sub-string variable AMPER-POS is written in assembly POSition function similar to B$ is the string variable language and can be run on a 16K, 32K, P ascal’s. C% is the output integer variable or 48K system with either disk or cassettes. The $300 (768 decimal) ad 2. The second entry point finds the AMPER-POS dress has been chosen for ORG because other strings' occurrences and has the $300,$3FF memory range is avail requires: the simple format: able for short machine-language pro Apple II or Apple II Plus CALL 880 grams (see reference 2). with Applesoft in ROM or language card
Listing 1 To Pascal, there is a POS function that searches within the string variable 0 800 1 PAG 0800 2 TEXT for an occurrence of a character 0800 3 string matching the context of the 0800 4 *** *** 0800 5 . *** POSITION FUNCTION *** "pattern" variable PATTERN. The 0800 6 ; * * * (AMPER-POS) * * * value returned is an integer repre 0800 7 *** BY * * * 0800 8 ; * * * PHILIPPE FRANCOIS * * * senting the first character position 0800 9 ****** where the matching string is found. If 0800 10 0800 11 no matching string is found, the POS 0800 12 returns a value of zero that does not 0800 13 7 AMPERPOS IS AN APPLESOFT ROM ROUTINE FOR .FINDING OCCURENCES 0800 14 i OF A SUB-STRING "PATTERN" IN A STRING "TEXT" correspond to one of the allowable 0800 15 character positions in a STRING vari 0800 16 : ENTRY POINTS: 0800 17 able [see reference 1). 0800 18 y 1) FOR THE FIR ST OCCURENCE: 4 P (A $,B$,C % ) 0800 19 ; WHERE: 0800 20 ; A$-SUB STRING (PATTERN) PROGRAM POSITION; 0800 21 i B$"STRING (TEXT) VAR PATTERN, TEXT : string; 0800 22 ; Cl-PO SITIO N OF A$ IN B$ 0800 23 BEGIN 0800 24 ; IT RETURNS: PATTERN: = ’pal'; 0800 25 j A) ZERO IN C% IF A$ IS NOT IN B$ 0800 26 I B) TOE FIR ST CHARACTER POSITION WHERE TEXT: = 'So long,pal.." 0800 27 ; TOE MATCHING STRING A$ IS FOUND IN BS WRITELNf'Position of ’,PATTERN,’ 0800 28 0800 29 f 2) CALL 8 00 FOR W E NEXT OCCURENCES OF A$ IN B$ in ',TEXT,' = ’,POS (PATTERN, 0800 30 TEXT)); 0800 31 7 0800 32 t AMPERPOS USEAGE END. 0800 33 • 0800 34 BEGINL EPZ $00 EFFECTIVE STRING BEGINNING 0800 35 BEGINH EPZ BEGINL+$01 This function fails in Applesoft, so 0800 36 M EPZ BEGINH+$01 "PATTERN" LENGTH you need to write a short machine rou 0800 37 N EPZ M+$01 "TEXT" LENGTH 0800 38 PTRL EPZ N+$01 PTRL,H IS A POINTER tine, AMPER-POS, which gives the first 0800 39 PTHH EPZ PTRL+$01 TO TOE STRING ADDRESS occurrence of PATTERN in TEXT, but 0800 40 INDICJ EPZ PTRH+S01 STARTING POSITION IN TEXT 0800 41 FLAG EPZ IN DICJ+501 IF PATTERN IS FOUND IN TEXT also gives the other occurrences (if any). 0800 42 TOEN FLAG-1 0800 43 ELSE FLAG-0 0800 44 : APPLESOFT USEAGE The Routine 0800 45 0800 46 XSAV EPZ $46 0800 47 VALTYP EPZ $11 0-NUMBER FF*STRING AMPER-POS was designed to find 0800 48 CHKOPN EQU $DEBB CHECK TOE " ( " the occurrences of a sub-string A$ in a 0800 49 CHKCLS EQU $DEB8 CHECK THE " ) " 0800 50 CHKCOM EQU $DEBE CHECK TOE " , " string B$. There are two entry points: 0800 51 ERROR EQU $DD76 "MISMATCH" ERROR 0800 52 CHRGET EQU $00B1 0800 53 PTRGET EQU $DFE3 READ A VARIABLE AND FIND IT IN 1 . The first entry point finds the first 0800 54 • MEMORY (ON EXIT W E ADDRESS TO occurrence of A$ in B$ and has the 0800 55 ? TOE VALUE OF W E VARIABLE IN A,Y) format: 0800 56 . 0300 57 ORG $300 0300 58 (Continued) & P ( A$,B$,C% )
No. 52 - September 1982 MICRO - The 6502/6809 Journal 51 Entering AMPER-POS Listing 1 (Continued) 0300 60 To enter the program, type in the 0300 61 hex codes or instructions from the 0300 62 0300 63 source listing with an assembler. To 0 3 0 0 64 save the program, type: 0300 65 VERIFY " P ( 0300 66 0300 67 BSAVE AMPER-POS OBJ,A$300, 0300 C9D0 68 CMP #"P'* 0302 F003 69 BEQ *+5 L$BC (for disk) 0304 70 PAG 0304 4C76DD 71 JMP ERROR 0307 20B100 72 JS R CHRGET 300-3BCW (for cassettes) 030A 20BBDE 73 JS R CHKOPN i CHECK THE " ( " 030D 74 030D 75 030D 76 SEARCH "PATTERN" Theory 030D 77 030D 78 030D 20E3DP 79 JS R PTRGET Suppose we want to find the first in 0310 E611 80 INC VALTYP 0312 F003 81 BEQ STRG1 VALTYP EQUAL ZERO, IT I S A STRING stance of the pattern string PAT 0314 4C76DD 82 JMP ERROR TERN (1)... PATTERN (M) in the target 0317 83 0317 8504 84 STA PTRL string TEXT( 1)..TEXT(N),M = N. 03 1 9 8405 85 STY PTRH (PATTERN(I) denotes the Ith character 031B A000 86 LDY #$00 031D B104 87 LDA (P T R L ), Y of PATTERN.) An obvious approach is 031F 8502 88 STA M to align PATTERN with the leftmost M 0321 C8 89 I MY 0322 B104 90 LDA (P T R L ), Y characters at TEXT and start matching. 0324 8500 91 STA BEGINL When a mismatch occurs, shift PAT 0326 C8 92 INY 0327 B104 93 LDA (PTRL),Y TERN right one character and restart 0329 8501 94 STA BEGINH matching from its first position. Con 032B 95 032B 96 tinue until either PATTERN matches 032B 97 REWRITE THE SUBSTRING "PATTERN" AT PATTRN ADDRESS or there are no more characters to 032B 98 032B 99 match in TEXT. 032B A0FF 100 LDY #$FF 032D C8 101 LABELl IMY 032E B100 102 LDA (BEGINL),Y The following algorithm that we 0330 99BA03 103 STA PATTRN,Y use in the AMPER-POS program is the 0333 C402 104 CPY M 0335 D0F6 105 BNE LABEL1 formal version of what has just been 0337 106 described (see reference 3 for more 0337 2 0 BEDE 107 JS R CHKCOM 033A 108 details): 033A 109 033A 110 SEARCH "TEXT" 033A 111 INTEGER i,j,m,n; 033 A 112 STRING pattem (l:m ),text(l:n); 0 3 3 * 20E3DP 113 JSR PTRGET 0330 E 6 U 114 TNC VALTYP i; = j: - 1; 033F F003 115 BEQ STRG2 DO WHILE i < = m AND j < = n; 0341 4C76DD 116 JMP ERROR 0344 117 STRG2 t IF pattem(i) = text|j) THEN 0344 8504 118 STA PTRL DO/*keep matching*/ 0346 8405 119 STY PTRH 0343 A000 120 LDY l$00 i: = i + l;/*bum p pattern position*/ 034A B104 121 LDA (PTRL),Y j: = j + l;/+and text position*/ 034C 8503 122 STA N 034E C8 123 INY END 034F B104 124 LDA (PTRL} fY ELSE 0351 8500 125 STA BEGINL 0353 ca 126 INY DO/* backtrack*/ 0354 B104 127 L0A (PTRL), Y j: =j + 2<-i; 0356 8501 128 STA BEGINH 0358 129 i := l ; 0356 20HEDE 130 JSR CHKCOM END 035B 131 035B 132 END 035B 133 SEARCH OUTPUT VARIABLE 035B 134 0351 135 035B 20E3DF 136 JSR PTRGET Program Logic 0358 A611 137 LDX VALTYP 0360 P003 138 BEQ TNT 0362 207600 139 JSR ERROR Here is a synopsis of the program 0365 140 PAG logic: 0365 141 0365 8504 142 STA PTRL 0367 8405 143 STY PTRH Lines 64-143 retrieve the parameters 0369 144 0369 20B8DE 145 JSR CHKCLS from the statement. Applesoft 036C 146 ROM routines are used to reduce the 036C 147 036C 148 RESOLVING length of the program. 036C 149 036C 150 036C 151 Ii-REG. X Lines 152-194 translate the precedent 036C 152 Jt-REQ. Y algorithm. Take the X and Y registers 036C 153 036C A900 154 LDA *900 INDXCJi-0 for the I and J indexes, but because AB 036E 8506 155 STA INDICJ SO LUTE^ and INDIRECT, Y address 0370 156 0370 157 ing begin with the zero value for X and 0370 158 SECOND ENTRY POINT. CALL (ON ADDRESS+S63) Y, the algorithm has been slightly 0370 159 (Continued, modified.
52 MICRO - The 6502/6809 Journal No. 52 - September 198S Lines 200-216 put the result of the Listing 1 (Continued) search in the output variable (zero if 0370 *200 161 LDX *900 f li«0 ; Jt-INDICJ the search is unsuccessful). 0372 8607 162 STXFLAG 0374 *406 163 LDY INDICJ 0376 164 1 Lines 221-225 prepare the INDICJ 0376 165 BEGINi 0376 166 t variable for the next searching. 0376 E402 167 CPX M r DO WHILE I<«M AND J<-N 0378 P027 168 BEQEND r 037* C403 169 CPY N j See figure 1 for an example, of how 03 7C P023 170 BEQ END i to use AMPER-POS. 0378 B100 171 LDA (BEGINL),Y i 0380 DDBA03 172 CMP PATTRN,X r IP PATTERN(I)"TEXT(J) 0383 D00E 173 BNE LABEL2 r 0385 *507 174 LDA FLAG r IP FLAG-0 THEN 0387 D006 175 BNE LABELS t 0389 A901 176 LDA •901 j DO If you save a name "SMITH” , an 038B 8S07 177 STA FLAG r FLAG3*1 address "31ST AV NY” , and a phone 038D 8406 178 STY INDICJ j INDICJi-J 038P 179 » I END number ”333 444 555”, on a mailing 038P 180 t ELSE sequential file, you can use the se 038? 181 » DO quence shown in figure 2. 038P E8 182 LABKL3 I NX t I»-I+l 0390 ce 183 INY > Jt-J+1 0391 184 * END 0391 D083 185 BNE BEGIN r 0393 ca 186 IABEL2 INY t ELSE 0394 8646 187 STXXSAV j DO Figure 2 039638 188 SEC t Ji-J+2-I 0397 98 189 TYA p r i n t ••*************" 0398 E546 190 SBCXSAV t 10 039* A8 191 TAY 20 PRINT " * EXAMPLE 2 * " 039B A200 192 LDX •$00 r I*-l 30 PRINT **************” 039D 8607 193 STX FLAG FL A G 1*0 4 0 PRINT 039P 194 ; END 50 D$ = CHRS ( 4 ) 039? P0D5 195 BEQ BEGIN j 6 0 PRINT D$"OPEN MAIL" 03*1 196 ? END 70 PRINT D$"WRITE MAIL" 03*1 197 00 PRINT "SMITM": 03*1 198 ------03*1 199 END OP ALGORITO 03*1 200 ------PRINT "31ST AV N .Y." 03*1 201 PRINT "333 444 5555" 03*1 202 END* 03*1 A 5 0 7 203 LDA FLAG 90 PRINT D$"CLOSE MAIL" 03*3 0004 204 BNE LABEL4 ; IP FLAG-0 THEN 03*5 A9FP 205 LDA ♦ $FF i INDICJ:-0 03*7 8506 206 STAINDICJ : 03*9 207 03*9 208 IABEL4 03*9 A506 209 LDA INDICJ ; ELSE 03*B 210 PAG 03 *B 18 211 CLC 7 INDICJs*INDICJ+l 03 *C 6901 212 ADC • $01 But because it is better to have only 03 AE 213 03 AE 214 one PRINT statement, we concatenate 03 *E 215 PUT INDICJ IN OUTPUT VARIABLE the three strings, separated with a . 03 AE 216 03 AE 217 The statement 40 becomes: 03 AE A001 218 LDY • $01 03 B0 9104 219 STA (PTRL),Y 03B2 220 40 A$ = “SMITH!31 st AV NYI333 444 03 B2 221 5 5 5 !” 03B2 222 FOR NEXT OCCURENCE : INDICJ:-INDICJ+M 03B2 03B2 i s 224 CLC and statement 80 becomes: 03 B3 A506 225 LDA INDICJ 03B56502 226 ADCM 03 B7 8506 227 STA INDICJ 80 PRINT A$ 03B9 60 228 RTS 03BA 229 03BA 230 PATTRN so that figure 3 will look like: 03 BA 231 o 1 03BA 233 ROOM FOR A "PATTERN" STRING UP TO 15 CHARACTERS U J Bn 03C9 235 DFS 15 03C9 236 03C9 237 STOP: Figure 3
10 PRI{JT •■ ************* n Figure 1 20 PRINT " * EXAMPLE 3 ■•*************" 30 PRINT "************* n 4 PRINT TAB( 14) 4 0 A$ = "SM IT H 131ST AV 5 PRINT TAB( 14) " * EXAMPLE 1 * " 6 PRINT TAB( 14) »*************" N .Y.1333 444 55551" 10 PRINT CHR5 (4 )"BLOAD AMPER-POS.OBJ" POKE 1 0 1 4 , 0 : POKE 1 0 1 5 , 3 : REM FETCH THE AMPERSAND 20 50 D$ = CHR$ (4) 30 A$ = " I " : B$ = " TO I S 11 S 1 A 1T E S T " 60 PRINT D$"OPEN MAIL" 40 S, P(A$,B$,PO%) 70 PRINT D$"WRITE MAIL" 50 GOSUB 1 0 0 8 0 PRINT A$ 6 0 CALL 8 8 0 : GOSUB 1 0 0 9 0 PRINT D$"CLOSE MAIL" 70 I F PO% < > 0 THEN 6 0 8 0 END 9 0 REM PRINTING SUBROUTINE 100 I F PO% = 0 THEN PRINT : PRIN T "NO (OR NO MORE) OCCURENCE OF <“ ; A $ ;" > " : RETUftN 110 PRINT : PRINT "THERE I S AN OCCURENCE OF <“ ; A $ ; “ > IN < " ; B $ :" > AT THE ":P O % ;'"M P O S IT IO N ": RETURN . . , „ „ , And to re-read the three values we use (Continued on next page) the program in figure 4.
No. 52 - September 1982 MICRO - The 6502/6809 Journal 53 References Figure 1 (Continued) 1 . Microcomputer Problem Solving with Pascal, Kenneth L. Bowles, Springer-Verlag, NY. THERE I S AN OCCURENCE OF IN AT THE 5TO POSITION
2. BASIC Programming Reference ■MERE I S AN OCCURENCE OF IN AT THE 8TH POSITION Manual: Applesoft II, Apple Com THERE I S AN OCCURENCE OF IN AT TOE 10TH PO SITIO N puter Inc. NO (OR NO MORE) OCCURENCE OF <1> 3. Data Type and Structures, C.C. Gotlieb, Leo R. Gotlieb, Prentice Hall Inc. 4. "A Comparison of Three String- Figure 4 Matching Algorithms," G. de V. Smit, Software Practice and Ex perience, Vol. 12, No. 1. 10 D$ = CHR$ ( 4 ) 15 PRINT D$”BUDAD AMPER-POS .OBJ" 16 POKE 1 0 1 4 , 0 : POKE 1 0 1 5 , 3 : REM LOAD & VECTOR 20 PRINT D$"OPEN MAIL" 30 PRINT D$"READ MAIL" 40 INPUT B$ 50 PRINT D$"CIjOSE MAIL” 6 0 A$ = “ 1 “ 70 S. P(A$,B$,P0») 80 NA$ =■ MID$ (B$ , 1, PO% - 1 ):J = PO» + 1 The author may be contacted at 90 CALL 880: AD$ =■ MID$ (B$,J,PO% - J):J = PO% + 1 C.N.R.S./L.I.S.H., 31, Chemin Joseph 100 CALL 880:PN$ = MID$ (B$,J,PO» - J) Aiguier, 13277 Marseille Cedex 9, France. JM C ftO RAPHTRIX'" 1.3, EDITRIX NEED HARD COPY OF YOUR APPLE CAN YOU SEE WHAT YOUR HI-RES GRAPHIC? WORD PROCESSOR WITH IS GOING TO PRINT? GRAPHTRIX™ 1.3 fi WITH YOU CAN ^ EDITRIX INSERT YOUR YOUR TEXT WILL GRAPHIC BE DISPLAYED ANYWHERE AS IT IN YOUR IS TO BE TEXT. PRINTED, USE ANY OF UP TO 19 PRINTERS 220 COLUMNS AND Insert Graphics, 10 INTERFACE CARDS Footnotes, Superscripts Data Transforms Inc. 616 Washington, Suite 106 or Different Type Fonts Denver, Colorado 80203 Anywhere In Your Text (303) 832-1501 These Features Plus Many More Features: Graphic Magnification, Are Right At Your Fingertips With Normal/Inverse, Page Centering, EDITRIXT“ High and Low Crop Marks, Title String, From Superscript, Footnotes, Chapters, Fully Data Transforms Inc. 616 Washington, Suite 106 Menu Driven REQUIRES: Apple II with 48K. Applesoft Denver, C olorado 80203 (303) 832-1501 in ROM, One Disk Drive with DOS 3.3. REQUIRES: Apple II with 48K, Applesoft in ROM, DOS 3.3 and the GRAPHTRIX 1.3 Matrix Graphics System. Apple is a Irademarti o( Apple Computet Inc. Apple a a trademark of Apple Computer Inc c Copyright 1982 Data transforms Inc. All Rights Reserved. (c) Copyright 1982 Data Transtoims. inc. All Rights Reserved GRAPHTRIX is the Trademark ol Dola Transforms Inc , a division ol Solarstahcs Inc ( AND GRAPHTRIX are the tiodemarts of Data Transforms Inc.. o division ol Salorstotics Inc. 54 MICRO - The 6502/6809 Journal No. 52 - September 1982 U ersa Com puting PRESENTS VersaWriter DRAWING TABLET COMPLETE HARDWARE / SOFTWARE GRAPHICS SYSTEM - $299 • Hi-Res & Med-Res Draw • Color Fill-In • Split / Full Screen • Paint Brush-5 Sizes • Change Color Hue & Intensity • Save / Load / Erase • Point to Point / Line Draw • Reverse Picture • Text Writer • Air Brush • Scaling • Fix X or Y Axis Requires: Atari ^300, 32K RAM, Basic Language Cartridge, Disk Drive GRAPHICS COMPOSER GLOBE MASTER PADDLE / JOYSTICK COMPLETE HI-RES GRAPHICS SOFTWARE - $39.95 GEOGRAPHY GAME - $29.95 • Draw on Hi-Res Screens 7 or 8 • 8 Hi-Res Color Maps • Save Pictures on Disk or Cassette • U.S.-Europe-World-Asia-Africa-Australia • Create Player / Missile Shapes • Countries-Cities-Capitals-Oceans- Automatically Rivers-Mountains, Etc. • Geometric Figures Program • Several Skill Levels Requires: Atari®800, 32K RAM, Basic Language Cartridge, • Add Text to Screen Disk Requires: Atari®800, 32K RAM, Basic Language Cartridge, Disk or Cassette ATARI ®is a registered trademark of Atari Inc. MIND BOGGLERS THREE STRATEGY GAMES • Capture CASSETTE $15.95 DISK $19.95 • Mystery Box Requires: Atari®400, 16K RAM, Cassette • Simon Says Atari 800, 24K RAM, Cassette or Disk I Uersa Computing,knc 3541 Old Conejo Road, Suite 104 Newbury Park, CA. 91320 (805)498-1956 No. 52 - September 1982 MICRO - The 6502/6809 Journal * r f . AiOt^' o te^ \d^ + uX fiYc>CcP 4&*' ' f t * * t *|J®X 6 <*«4'^rfJ'9 4 < V * ’‘ * ^ .**>■ 0 ? = ? . ^ c.jd1 . M° OS'4* •jjjf®5 £ < * « $ & $ * ■ xe Axi&‘ \ ,MO .vfAe vot6 - .'CP..'CP \ cjpf> vd^ ( •v -.<© cJP5 * ^ P t r f * ve* f \ jp ' ■^Odfc* A e ^ V ,e i - <*S<® d a " vql* $.®t- t^v ' .^T^' '< > ? > < & * * 6809 Macros for Structured Programming by Hal Clark This article presents a technique Listing 1 for using assembler macros to ************************************************************************* allow structured assembly- * * * TITLE - MACRO.X09 * language programming. The * AUTHOR! HAL CLARK * examples presented are for the * ON-GOING IDEAS * * RD#1 BOX 810 * 6809, but they can be easily * STARKSBORO, VT 05487 * modified for other processors. * * ************************************************************************* ************************************************************************* Structured Macros * * PROG A MACRO TO DEFINE THE BEGINNING OF A PROGRAM requires: * IT NAMES THE PROGRAM FOR THE LINKER AND * JUMPS TO THE LABEL . 6809-based machine with * macro assembler * EX. PROG TEST * May be adapted to other ************************************************************************* PROG MACR PNAME processors NAME PNAME JM P B E G IN ENDM Structured program development is PAGE defined as top down programming. ************************************************************************* When using this approach, the main PARM - A MACRO TO PUSH PASSED PARAMETERS ONTO THE SYSTEM body of the program is developed first, STACK. THE TYPE IS EXPECTED TO BE BYTE r WORD* REF t then each succeeding level is developed OR REG * until the total program is finished. ************************************************************************* When the program is entered into the BYTE EQU 1 WORD EQU 2 computer, it is usually entered in the REF EQU 3 same, top down, fashion. REGA EQU 1 REGB EQU 2 REGD EQU 3 The newer structured languages, R'EGX EQU A such as ADA, Pascal, and Modula, re REGYEQU 5 quire that constants, variables, and pro REGU EQU 6 PARMMACRO VALUE»TYPE cedures/functions (subroutines] be IF N A R G .E Q .l defined before use, thus giving the IFVALUE.EQ.REGA ZZZPOSSET Z Z Z P 0 5 + 1 following program structure: PSHS A ELSE PROGRAM name IF VALUE.EQ.REGB ZZZPOS SET Z Z Z P 0 S + 1 CONSTant definitions PSHS B VARiable definitions ELSE IF VALUE.EQ.REGD FUNCTION definitions ZZZPOSSET Z Z Z P O S + 2 PROCEDURE definitions PSHS D main program ELSE IF VALUE .EQ.REGX ZZZPOSSET Z 2 Z P 0 S + 2 BASIC and machine language, how PSHS X ever, do not require that constants, var ELSE IF VALUE.EQ.REGY iables, or subroutines be defined before ZZZPOSSET Z Z Z P O S + 2 use. Neither BASIC nor machine lan PSHS Y ELSE guage requires program structuring. A IF VALUE.EQ.REGU lack of program structuring often re ZZZPOSSET Z Z Z P O S + 2 sults in an excessive use of memory PSHS U ELSE and an unreasonable amount of time ERROR INVALID ARGUMENT devoted to debugging, and customer ENDIF ENDIF support. ENDIF ENDIF Pascal is a highly strucutred lan ENDIF ENDIF (Continued on next page) guage that allows the systematic No. 52 - September 1982 MICRO - The 6502/6809 Journal 57 development of computer programs. Listing 1 (continued) These programs are easy to debug and modify due to their structure. Unfor tunately, not all applications can afford ZZZPOS SET ZZZPOS+1 the overhead in memory usage and ex LDB VALUE PSHS B ecution speed that many versions of ELSE IF TYPE.EQ.l Pascal require. The most transportable ZZZPOS SET ZZZPOS+1 versions of Pascal compile the source LDB VALUE code into some form of intermediate PSHS B ELSE code, usually called P-code, which is IF TYPE.EQ.WORD then interpreted each time the program ZZZPOS SET ZZZPOS+2 is run. LDD VALUE PSHS D ELSE The macros presented in this article IF TYPE.EQ.2 ZZZPOS SET ZZZPOS+2 allow structured development of LDD VALUE machine-language programs. Programs PSHS D developed using these macros appear to ELSE IF TYPE,EQ.REF be a combination of Pascal and in-line ZZZPOS SET ZZZPOS+2 assembly language. By using macros, TFR U'D ADDD ♦VALUE the structure of Pascal may be combined PSHS D with the execution speed and memory ELSE efficiency of assembly language. ERROR INVALID ARGUMENT ENDIF ENDIF These macros generate machine ENDIF ENDIF code for the Motorola 6809 CPU. They ENDIF are designed to be used with the Micro ENDIF tek 6809 cross-assembler, which is END* PAGE written in FORTRAN and available for ************************************************************************* most computers. The version used in * * CALL - A MACRO TO CALL A SUBROUTINE WHILE PASSING UP TO * the examples is running on a Digital * SIX PARAMETERS* EACH PARAMETER MUST BE ENCLOSED * Equipment Corp. PDP 11/34. * WITH < > AND CONTAIN THE PROPER TYPE. * * EX. CALL TEST»» BYTE> * * * Although these macros generate in ************************************************************************* structions for a specific micro CALL MACRO DEST»P1»P2»P3»P4 »P5»P6 processor, the ideas behind their design ZZZPOS SET 0 IF NARG.GT.1 may be used to develop similar macros PARM PI for other processors. Even if a macro IF NARG.GT.2 PARM P2 assembler is not available, the ideas IF NARG.GT.3 presented here can be used in machine- PARM P3 language programs to increase reliability IF NARG.GT.4 PARM P 4 and decrease development time. IF NARG.GT . t* PARM PS Implementation IF NARG. GI * 6 p.2) PM f>6 ENDIF In this section we shall discuss the ENDIF ENDIF actual implementation of the macros, ENDIF as well as some other aspects of struc FI HD I F tured programming not required by the ENDIF JSRDEST use of the macros. IF ZZZPOS LEAS Z Z Z P O S * s ENDIF Macros, while allowing the program ENDM to have a structure similar to Pascal, do PAGE ************************************************************************* not actually require the same format PAIR. * grams are easier to understand with '■ EX. VAR » * that structure, so all the examples will ************************************************************************ use it. 7 VAR MACRO LBL»SIZE LBL RES SIZE ENDM The Stack Machine * VAR MACRO T1»T2*T3»T4»T5*T6 IF N A R G . G E . l These macros and programs written ZVAR T l using the macros define the 6809-based ENDIF computer as a stack-oriented machine. IF NARG.GE.2 ZVAR T2 The 6809 makes this implementation ENDIF easy because of its two stack registers IF NARG.GE.3 and many addressing modes that allow ZVAR T3 ENDIF stack access. 58 MICRO - The 6502/6809 Journal No. 52 - September 198; Listing 1 (continued) All data in the system, except for IF NARG.GE.4 constants and variables defined in the ZVAR T4 ENDIF main body of a program, aie stored on IF NARG.GE.5 the stack. Each procedure or function ZVAR T5 has the capability of receiving up to six ENDIF IF NARG.EQ.6 passed parameters each time it is used. ZVAR 16 Procedures and functions also have a ENDIF ENDM reserved area on the stack for their own PAGE use while active. When a procedure or ************************************************************************* function is finished, the area on the * * * CON A MACRO TO DEFINE PROGRAM CONSTANTS* UP TO SIX * stack is given up so that the next * CONSTANTS MAY BE DEFINED AT ONCE USING THE STANDARD * subroutine may use it. This keeps the * PAIR DEFINITIONS» * amount of "dedicated-all-the-time, * * * EX. CONS ? » * used-some-of-the-time'' memory to a * * minimum. Use of the stack also avoids +************************************************************************ 7C0NS MACRO LBL»VAL the problems caused by using a com LBL EQU VAL mon variable at the wrong time. ENDM * CONS MACRO Tl»T2 T1»T2p ?T3»T4*T5»T£ T3»T4 * T3 Register Usage IF NARG.GE.1 ZCONS T l The Motorola 6809 has five 16-bit ENDIF IF NARG.GE .2 registers, two 8-bit registers, and one ZCONS T2 16-bit accumulator that may be used as ENDIF IF NARG.GE.3 two 8-bit accumulators. The registers ZCONS T3 and their function within the defined ENDIF stack machine follow: IF NARG.GE.4 ZCONS T4 ENDIF 16-bit IF NARG.GE.5 ZCONS T5 PC — program counter. Points to the ENDIF next instruction to execute, and is IF NARG.EQ.6 only modified by the jump to sub ZCONS 16 ENDIF routine, return from subroutine, and ENDM the various branch instructions. PAGE ************************************************************************* * S — system stack pointer. Must be LCONS - A MACRO TO DEFINE PROCEDURE CONSTANTS* UP TO SIX initialized at the start of a program. CONSTANTS MAY BE DEFINED AT ONCE USING THE STANDARD PAIR DEFINITIONS* THESE CONSTANTS ARE This register should not be changed VALID ONLY FOR THE LIFE OF THE PROCEDURE* by the user program as it contains the necessary information to switch be EX. LCONS »p tween subroutines. ************************************************************************* ZLCONS MACRO LBLpVAL LBL SET VAL U — user stack pointer. Data that is ENDM passed to a called subroutine may be * found in this stack, and is referenced LCONS MACRO T1pT 2 pT3*T4»T5pT6 IF NARG.GE.1 by an offset from this register. The ZLCONS T l value stored in U should never be ENDIF IF NARG.GE.2 changed by the user; the macros ZLCONS T2 CALL and RETURN will alter U as ENDIF necessary. IF NARG.GE.3 ZLCONS T3 ENDIF X — a general purpose register IF NARG.GE.4 ZLCONS T4 available to the user program. This END IF register is saved and restored by the IF NARG.GE.S macros. ZLCONS T5 ENDIF IF NARG.EQ.6 Y — a general purpose register ZLCONS T 6 ENDIF available to the user program. This ENDM register is saved and restored by the PAGE macros. ************************************************************************ * PROC - A MACRO TO DEFINE PROCEDURE (SUBROUTINE) ENTRY POINTS * 8-bit COMPLETE WITH UP TO SIX PARAMETERS. NOTE IF DEFINED * WITH X PARAMETERS EACH CALL MUST USE X ALSO. * * DP — direct page register. Unused by NOTE 1. THESE PARAMETERS ARE REFERENCED BY »U * the stack machine. IF THE PROCEDURE NEEDS TEMPS THEY SHOULD BE * ALLOCATED USING THE LVAR MACRO. * * CC — condition code register. This 2. REGS X & Y ARE AUTOMATICALLY SAVED * contains flags pertaining to the ************************************************************************* results of the last instruction. This (-"PAR MAf'RD l.BL . SIZE (continued) register is not saved by the macros. No. 52 - September 1982 MICRO - The 6502/6809 Journal 59 Accumulator D (A and B) Listing 1 (continued) LBL SET ZZZPOS Accumulators A and B are each 8 ZZZPOS SET ZZZPOS+SIZE bits. Accumulator D is 16 bits, con ENDM sisting of the A and B accumulators. * SAVE EQU 1 These registers are considered tem porary and will be modified by the F:‘R(JC hACRU NA» FI»F2 1 F3 rFAtF 5 »F6 stack machine whenever a sub NA EQU * PROCEDURE NAME Z77FNC SET 0 TELL RETURN NO PARMS TO PASS routine is called. 77ZENV SET 0 ZZZSAV SET 1 IF NARG.GT.1 PASSING PARAMETERS ? Reserved Symbols PSHS U»X»Y YES - SAVE X»YrU RESET S LEAU AtS ZZZENV SET 1 SHOUTHAT THEY MUST BE CLEANED The following symbols are re 777P0S SET 4 FROM THE STACK. stricted to reference only, and must not IF NARG.GT.2 be redefined by the user's program: IF NARG.GT.3 [F NARG.GT.4 BYTE used to represent a length of 8 IF NARG.GT.5 bits. IF NARG.GT.6 FPAR f 6 ENDIF WORD used to represent a length of FPAR F5 ENDIF 16 bits (2 bytes]. FPAR F4 ENDIF REF used when passing parameters FPAR F3 ENDIF between subroutines. FPAR F2 ENDIF REGA used to pass the machine FPAR FI ELSE NO PARAMETERS PASSED - SAVE X*Y register A. PSHS X r Y ENDIF ZZZPOS SET -4 REGB used to pass the machine ENDM register B. PAGE ************************************************************************* FPROC - A MACRO TO DEFINE PROCEDURE (SUBROUTINE) ENTRY POINTS REGD used to pass the machine COMPLETE WITH UP TO SIX PARAMETERS. NOTE IF DEFINED registers A and B. WITH X PARAMETERS EACH CALL MUST USE X ALSO. NOTE - 1. THESE PARAMETERS ARE REFERENCED BY .U REGX used to pass the machine IF THE PROCEDURE NEEDS TEMPS THEY SHOULD BE register X. ALLOCATED USING THE LVAR MACRO. 2. REGS X % Y ARE NOT SAVED REGY used to pass the machine ************************************************************************* register Y. FPROC MACRO NA»F1 >F2*I 4.F5.F6 NA EQU * PROCEDURE NAME 2Z7FNC SET 0 TELL RETURN NO PARMS TO PASS The Macros Z77ENV SET 0 ZZZSAV SET 0 NOT SAVING REGS X.Y The following paragraphs describe IF NARG.GT.1 PASSING PARMS? PSHS U YES - SAVE U the available macros, their uses, calling LEAU OrS NO - DO NOTHING parameters, and an example. ZZZENV SET 1 THAT THEY MUST BE CLEANED Z77.P0S SET 4 FROM THE STACK. IF NARG.GT.2 PROG xxxx IF NARG.GT.3 IF NARG.GT.4 PROG: This macro expects one para IF NARG.GT.5 meter that will name the program. The IF NARG.GT«6 FPAR F 6 macro causes a jump to the symbol BE ENDIF GIN, which should be placed on the first FPAR F5 line of the main body of the program, ENDIF FPAR F4 ex. PROG TEST ENDIF FPAR F3 ENDIF CALL xxx, ,..., FPAR F2 ENDIF CALL: Performs the jump to sub FPAR FI routine xxx after all the optional passed ENDIF ZZZPOS SET 0 parameters are placed on the stack, ENDM PAGE ex. CALL COPY, , ************************************************************************ < TO, WORD > , < LEN, B YTE > FUNC - A MACRO TO DEFINE FUNCTION (SUBROUTINE) ENTRY POINTS COMPLETE UITH UP TO SIX PARAMETERS. NOTE IF DEFINED VAR ,..., WITH X PARAMETERS EACH CALL MUST USE X ALSO. BY DEFINITION A FUNCTION RETURNS A SINGLE VALUE. VAR: Defines variables that will be used NOTE - 1. THESE PARAMETERS ARE REFERENCED BY .U throughout the program, not just with IF THE FUNCTION NEEDS TEMPS THEY SHOULD BE in subroutines. ALLOCATED USING THE LVAR MACRO. ex. VAR ,< TEMPI, 2 . REGS X * Y ARE SAVED. WORD> ************************************************************************* FUNC MACRO NA. F I »F2. F3>F4, F5>F6 CONS ,..., NA EQU * FUNCTION NAME 60 MICRO - The 6502/6809 Journal No. 52 - September 1982 CONS: Defines constants that will be Listing 1 (continued) used throughout the program. 7ZZFNC SET 1 TELL RETURN NO PARMS TO PASS ex. CONS ,< FALSE,0>, ZZZENV SET 0 ZZZSAV SET 1 < MAYBE,3 > IF NARG.GT.1 PASSING PARAMETERS ? PSHS Ut X»Y YES - SAVE X»Y»U RESET S LEAU 4 ? S LCONS ,..., ZZZENV SET 1 THAT THEY MUST BE CLEANED LCONS: Defines local constants that ZZZPOS SET 4 FROM THE STACK. I f NARG.GT.2 are used within the current subroutine IF NARG.GT.3 definition only. IF NARG.GT.4 IF NARG.GT.5 ex. LCONS , IF NARG.GT. 6 FPAR FA ENDIF PROC xxx, < PI,TP>,..., FPAR F5 ENDIF PROC: Defines a procedure (sub FPAR F4 routine) . PROC must be followed by a ENDIF RETURN before the next PROC or FPAR F3 ENDIF FUNC macro usage, xxx gets assigned FPAR F2 to the entry point of the procedure. The ENDIF FPAR FI parameters P1-P6 get assigned as offsets ELSE NO - SAVE X»Y on the stack to allow referencing of the PSHS X » Y passed parameters at execution, ENDIF ZZZPOS SET -4 ex. PROC COPY, , ENDh < OUT, WORD > , < LEN,BYTE > PAGE ************************************************************************ FUNC xxx, ,..., * * FFUNC - A MACRO TO DEFINE FUNCTION (SUBROUTINE) ENTRY POINTS FUNC: Defines a subroutine that * COMPLETE WITH UP TO SIX PARAMETERS. NOTE IF DEFINED returns a value (function). This macro, * WITH X PARAMETERS EACH CALL MUST USE X ALSO. * BY DEFINITION A FUNCTION RETURNS A VALUE. like PROC, must be followed by the * RETURN macro before the next FUNC * NNOTE 0 T E - 1. THESE PARAMETERS ARE REFERENCED BY .U or PROC macro is used. The name xxx * IF THE FUNCTION NEEDS TEMPS THEY SHOULD BE * ALLOCATED USING THE LVAR MACRO. is assigned to the entry point of this X subroutine and the labels P1-P6 are * 2 . REGS X I Y ARE NOT SAWED * assigned as offsets to the stack for ac ********************* *************************************************** - cess to the passed data during execu FFUNC MACRO NA»F1f F2 > F3 f F4»F5f F6 tion. The results of the function are NA EQU * FUNCTION NAME 7.7 ZFNC SET 1 TELL RETURN NO PARMS TO PASS returned in machine register D. Z7ZENV SET 0 ex. FUNC SQR, ZZZSAV SET 0 NOT SAVING REGS X.Y IF NARG.GT.1 PASSING PARMS? PSHS U YES - SAVE U LVAR ,..., LEAU 0»S NO - DO NOTHING ZZZENV SET 1 THAT THEY MUST BE CLEANED LVAR: Defines up to six local variables ZZZPOS SET 4 FROM THE STACK. at one time. These variables can only IF NARG.GT.2 IF NARG.GT.3 be referenced within the definition of IF NARG.GT.4 this defining subroutine. Subroutines IF-' NARG.GT.5 IF NARG.GT.A called from within defining sub FPAR F6 routines may reference these variables ENDIF only if passed to the subroutine as a call FPAR F5 ENDIF parameter. LVAR, at this time, requires FPAR F4 parameters to be passed to the defining ENDIF subroutine to function properly, FPAR F3 ENDIF ex. LVAR , FPAR F2 ENDIF FPAR FI ENDIF RETURN data ZZZPOS SET 0 ENDM RETURN: Ends the previous FUNC- PAGE tion or PROCedure definition. It ************************************************************************ removes temporary variables as well as * passed parameters from the stack, re * LVAR A MACRO TO DEFINE TEMPORARY VARIABLES FOR A PARTICULAR stores the saved registers, and returns * PROCEDURE OR FUNCTION. THE TEMPS ARE ALLOCATED ON THE * SYSTEM STACK AND ARE REFERENCED BY ,U. THESE to the calling program. If the RETURN * VARIABLES ARE DISTROYED UPON EXIT OF THE PROCEDURE. is from a function, it also places the * * EX. returned value in the machine register D. * LVAR . ex. RETURN RESLT (from a function) * * LDD T2.U ex. RETURN [from a procedure) * * ************************************************************************* DPAR MACRO LBL.SIZE The author may be contacted at On-Going ZZZPOS SET ZZZPOS-SIZE Ideas, RD #1, Box 810, Starksboro, LBL SET ZZZPOS Vermont 05487. ENDM (continued) No. 52 - September 1982 MICRO - The 6502/6809 Journal 61 Listing 1 (continued) 1 M hz - 12 Bit A/D for your Apple II Computer * LVAR MACRO V1'V2'V3'V4'V5'V4 The APPLESC0PE-HR12 analog to digital converter uses IF ZZZENV.EG.0 a high stability buried zenervoitage reference and a flash ZZZENV SET -1 A/D to give 12 bit accuracy with a 14 bit dynamic range. PSHS U • DC to t Mhz Programmable Sample Rate LEAU 0'S • 2046 Sample Butter Memory ZZZPOS SET 0 • Pretrigger Viewing ENDIF • Continuous or Single Sweep IF NARG.GE.X • 4 Channel Software Support DPAR VI (requires additional power supply) IF NARG.GE.2 • External Trigger Input DPAR V2 The standard software provided w ith each APPLESCOPE- IF NARG.GE.3 HR 12 includes all of the functions necessary to turn your DPAR V3 Apple II computer into a high quality digital storage IF NARG.GE.4 oscilloscope. InadditionalloftheSCOPEDRIVERoptions DPAR V4 are being up-graded to handle the higher resolution data. IF NARG.GE.5 DPAR V5 Price per cnannei $698 IF NARG.GE. 6 DPAR V6 The original APPLESCOPE still provides the optimum ENDIF price /pe rform a nce trade oft for those users requiring 8 bit ENDIF converter resolution. ENDIF ENDIF APPLESCOPE INTERFACE ENDIF ENDIF LEAS ZZZPOSfU ENDH PAGE ************************************************************************ RETURN - A MACRO TO DEALLOCATE PASSED PARAMETER STACK SPACE UPON THE COMPLETION OF A FUNCTION OR PROCEDURE. NOTE- FUNCTION WILL RETURN A VALUE IN REGA OR REGD THIS VALUE IS SPECIFIED IN THE RETURN CALL. * * • OC to 3.5 Mhz sample rate EX. RETURN »W0RD * • 1024 byte buffer memory * • Pretrigger Viewing ******************************* ***************************************** • Programmable Scale Select RETURN MACRO VAL»TYPE • Continuous and Single Sweep Modes IF ZZZFNC•EQ•X FUNCTION RETURN? • Single or Dual Channel Trace IF NARG.EQ.O YES - BUT NO PARMS62 MICRO - The 6502/6809 Journal No. 52 - September 198 r ^ Listing 1 (continued) A harvest of SET 0 IF ZZZENV . LT . 0 LEAS 0 1 u savings from PULS u IF ZZZSAV PULS X>Y ENDIF ELSE IF ZZZENV,GT.O IF ZZZSAV LEAS -4 »U Apple*]jPTbee PULS c X -< ELSE LEAS 0'U PULS U Electronics ENDIF ELSE IF ZZZSAV SOFTWARE PULSX»Y APPLE. ATARI- TRS80 ■ IBM ENDIF ENDIF A fall line of software for business, games ENDIF and education up to 35% off! RTS ENDM MUSE KJS PAGE V1SICORP STONEWARE ************************************************************************ ON LINE SYNERGISTIC * * * RECORD DEFINITION MACROS * EDG-WARE HAYDEN * * HOWARD AND MANY MORE t************************************************************************ RECORD MACRO ZZZPOS SET 0 HARDWARE ENDM AMDEK. HAYES • MICROSOFT FIELD MACRONAME'SIZE NAME EQUZZZPOS List Our Price ZZZPOS SET ZZZP0S+SIZE ENDM 32K RAM card $293.00 $205.00 RECSIZ MACROSIZE Video Term $345.00 $279.00 SIZE EQUZZZPOS Lazer P rod u cts ------20% off------ENDM PAGE DISKS *********************************************************************** Maxell Box of 10,514", SS-DD $35.00 TABLE GENERATION HACROS Verbatim Box of 10, 5'A" , SS-DD $29.00 EACH TABLE MUST CONSIST OF: TABLE - TABLE HEADER (1) TABDTA - TABLE DATA ENTRIES (N) MONITORS TABSIZ - TABLE LENGTH AND END MARKER (1) LE MONITORS List Our Price *********************************************************************** $189.00 $159.00 TABLE MACR 9” Green ZZZTBL SET 0 \2" Green $199.00 $169.00 ENDM * ZENITH 12" Green $179.00 $129.00 TABDTA MACR VALUE t TYPE IF TYPE.EQ.BYTE Plus a full line of AMDEK Monitors DATAVALUE ZZZTBL SET ZZZTBL+1 PRINTERS ELSE IF TYPE.EQ.WORD PAPER TIGER List Our Price AC0N VALUE ZZZTBL SET ZZZTBL+2 460G $1,094.00 $950.00 ELSE 560G $1,394.00 $1,250.00 ERROR UNSPECIFIED DATA TYPE EPSON ENDIF ENDIF MX 70 $449.00 $395.00 ENDM MX80FT $745.00 $595.00 * MX I00FT $945.00 $795.00 TABSIZ MACRSIZE SIZE EQUZZZTBL CALL FOR THIS MONTHS SPECIAL ! DATA ♦FF ENDM PAGE 1-800-835-2246 EXT. 211 OR ************************************************************************* * * 702-452-5589 STORE A STRING No. 52 - September 1982 MICRO - The 6502/6809 Journal 63 computer mail order wes hs utr...... $24.00 Hunter...... Ghost Mouskattack $25.00 Climber...... Canyon Jawbreaker...... $27.00 rtco...... $24.00 Protector...... Star Raiders Star Asteroids...... $29.00 Missile Command Missile ars...... $32.00 M of Cevems $35.00 Centipede...... $35.00 PAC-MAN...... nhrMoe ...... $79.00 ...... odem M Anchor oainAut ...... $239.00 ...... to u A Novation A Hayes 830Modem 82S Printer...... $589.00 822 Printer...... $269.00 CX85316K RAM...... $77.95CX85316K 810 Drive Disc 410 Recorder...... $76.00 X0JyStc...... $18.00 tick...... CX40S Joy $169.00 850 Interlace...... 820 Printer...... $259.00 ...... $159.00 t...... a C hoorp...... $199.00 Chronograph...... $169.00 t...... a DC $309.00 100...... Micromodem $279.00 ...... I I Micromodem art...... $239.00Sm T elecommunications 2 ... . . 32K 8 ... . . 48K 6 ... . . 16K HOT ATARI _ ATARI HOT ...... $31.00 ...... $159.00 ...... Modems GAMES GAMES ...... 400 s389 s489 s269 JK $39.00 $449.00 ATARI A $29.00 8 Euao...... $130.00 Educator...... 482 8 rgamr...... $49.00 Programmer...... 483 One warranty...... $70.00 year extended 48KBoard...... $219.95 Intec $119.95 RAM...... 32K Microtek 8 omnctr...... $344.00 484 Communicator...... $69.00481 Entertainer...... Intec 32K...... $119.95 Intec (128K)...... $429.95 Ramdlsk $74.95 ...... RAM 16K Microtek Kstar Patrol...... $39.00 Kstar $39.00 K-razy Antics...... K-razyKritters...... $39.00 ut...... $39.00 O Krazy Shoot ARCADE ACTIONFROM YOUR ATARI JOYSTICK oo ...... $699.00 I I Color oo I...... $429.00 III...... Color $339.00 ...... I Color 300G...... $169.00 BMC 12" Green...... 12" BMC eih "Gen...... $119.00 "(Green)...... Zenith9 ROMCARTRIDGE GAMES 8 s769 . . 48K . 2 s724 . s649 . 32K . . . 16K . FOR YOUR ATARI MONITORS KBYTE TC TN ®.STICKSTAND B AMDEK i _ aim OTHERS 800 0OO' $009 ...... $85.00 810. read models drive dual and ORY PRICE! Will Atari for written disk! disks read all the of sides both 800/400.single Atari Both the ial, da ds die for drive disk dual a Finally, the ith w patable com peripheral pl I ad vn a sm fea Apple. the some on has found not even tures and II Apple adae sfwae and are softw Hardware, 7073 ...... $2399.007710/7730 ...... B10...... $179.00 JB-1201...... 02...... $549.00 8012...... 5033 ...... $1789.003510/3530 ...... 03 ...... $549.00 ...... 8023 C10 ...... $899.00JC-1202 ...... $349.00JC-1201...... A 8001- 01 ...... $749.00 ...... 8031 64KComputer Personal PEtiQOM l o frbe i !! e ric p t es b for now all C FRANKLIN CALL FOR INTRODUCT ...... $749.00 ...... ACE 1000ACE NEC COMPUTERS MONITORS PRINTERS o p t r al re eas order mail computer Commodore Business Machines CBM 6 4 ...... CALL 4032 ...... $969.00 3096 Upgrade K it...... $369.00 Super Pet...... $1599.00 2031 $529.00 8250 Doubled Sided Disk Drive...... $1699.00 HP»85 s1969 D9060 5 Megabyte Hard Disk...... $2399.00 D9090 7.5 Megabyte Hard Disk...... $2699.00 HP«87...... $1799.00 8050 ...... $1299.00 H P*125...... $1999.00 4040 ...... $969.00 HP*85 16K Memory Module ...... $169.00 Word Pro 5+ ...... *319.00 8300 (Letter Quality)...... $1799.00 5Y4” Dual Master Oise Drive ...... $1799.00 Word Pro 4 + ...... $299.00 8023 ...... $769.00 Hard Disk wI Floppy ...... $4349.00 Word Pro 3+ ...... $199.00 4022 ...... $499.00 Hard D isk...... $3549.00 The Administrator...... $379.00 Pet to IEEE Cable...... $37.00 "Sweet Ups” Plotter...... $1199.00 InfoPro P lus ...... $219.00 IEEE to IEEE Cable...... $46.00 80 Column Printer ...... $649.00 Power ...... $79.00 Tractor Feed for 8300...... $240.00 H E W L E T T mW U K tim 2 1 P A C K A R D Televideo VIC 20 - \ HP 41CV Terminals CALCULATOR s239 910 ...... $579 $239 912C ...... $699 VIC 1530 Commodore Datassette ...... $69.00 I 920C ...... $749 VIC 1540 Disk Drive...... $499.00 I 925C ...... $749 VIC 1515 VIC Graphic Printer...... $339.00 I 960 ...... $939 VIC 1210 3K Memory Expander...... $32.00 I HP 41C...... $189.00 VIC 110 8K Memory Expander...... $53.00 I HP 11C...... $79.00 | 16K VIC Expansion...... $94.00 I HP 12C...... $114.00 802...... $Call I VIC 1011 RS232C Terminal Interface...... $43.00 I NEW 15C...... $119.00 802H ...... $Call I VIC 112 VIC IEEE-488 Interface ...... $86.00 I NEW 16C...... $125.00 816 ...... $Call | VIC 1211 VIC 20 Super Expander ...... $53.00 I HPIL PERIPHERALS IN STOCK! 806 ...... $Calt VIC Mother Board...... $99.00 I CITOH Smith-Corona EPSON TP-I PRINTERS —. PRINTERSI $649 MX 80 w/Graftrax ...... $449 F10-40CPS...... $1439.00 MX 80 FT III...... CALL F10-55CPS...... CALL MX 100...... CALL Prowriter...... $499.00 Letter Quality ADA 1600 Parallel Printer to CBM ...... $119.00 ATC-1 Parallel Printer to A tari ...... $29.00 ADA 1450 Serial Printer to CBM ...... $139.00 I Daisy Wheel AP-80 Apple Parallel Card & Cable ...... $69.00 ATC-2 Serial Printer to A tari ...... $29.00 I IBM-1 Parallel Printer to IBM ...... $32.00 AP-S10 Apple Serial Card & Cable...... $95.00 12 CPS Text Printer In-stock items shipped same day you call. No risk, no deposit on C.O.D. orders. Pre-paid orders OKIDATA receive free shipping within the CENTRONICS continental United States with no PRINTERS waiting period for certified checks PRINTERS 82A ...... $489.00 or money orders/All prices shown 739-1 ...... $519 83A...... $729.00 are cash prices. Add 3% for 739-3 ...... $619 8 4 ...... $1099.00 Mastercard and Visa. NV and PA 2 Meter RS232-RS232 Cables ...... $29.95 NOTE residents add sales tax. All items - ALSO - All of the above OKIDATA Printers come equiped Diablo 630 Special...... $1799.00 subject to availability and price with both parallel ports & RS232 Serial ports. Talley 8024 L ...... $1629.00 change. IDS Prism...... CALL 8 0 0 - east 477 E. THIRD ST. IN PA Williamsport CALL PA 17701 (717)327 9575 ^ FLEX/UniFLEX \ DISK II SOFTWARE CABLES (long replacements up to 20 feet) THE TOTAL These NON-shielded cables are replacements, NOT SYSTEM extensions, and are tested seven different ways to insure reliability that can’t be acquired with extensions. These cables are available in one foot increments up to 20 feet long. Price varies with the length you require. The most STAND ALONE SOFTWARE popular length is four (4) feet long at $25.95. Add $1.50 VENDOR PROGRAM INVENTORY i ,[) SINGLE f NTRy I i DGEH per foot for additional length. (Shorter cables available PUHCHASF OROfcH INVtNTORY ( IVT.hi 11 *.ic f ui “ i I CHECK BALANO H also). flCCTS PAYABU. M F 1 (f xtunvw Mf() P Q | COSTING .-4 hSTlMAIING CUSTOMER PROGRAM HUl K MAILINGS CHURCH CON THIEUj TlON PKG 0R0ER FROM: OHDEH ENTRY MAINTENANCE SCHfcOUlfc CHURCH SC HI') Ol Fill. LING Master Manufacturing • Calif, residents add6 'h% sales tax ACCfS HFCFlVABlF DA f A HAST MGR FUND RAISING 14319 E. S w ift Drive • C.O.D. orders add $2.50 PAYROL I DATA BASF i Utili i CUSTOM PROGRAMMING La Mirada, CA 90638 • Sorry, no charge cards GENERAL LEDCFR INQUIRE ABOUT OUR COlOR COMPUTFH SOI T'.VARfc (213) 944-1069 • Dealer A distributor inquiries invited • AUTO REPEAT" INTRODUCING SOFTWARE for rev 7 & later ...... $19.95 DATA BASE MANAGER ...... 1 1 5 0 °° , • lower case EPROM C H U R C H C O N T R IB U T IO N P K G ...... M 5 0 °° OTHER \ lor rev 7 & later ...... $24.95 S IN G L E E N T R Y L E D G E R ...... *9500 M ASTER MFG. \ • HANGMAN PROOUCTS FOR THE I . USERS! READ m m m The Unofficial OSI Users Journal THE WORLD WIDE PUBLICATION EXCLUSIVELY DEDICATED TO OSI USERS! □ Hardware Mods. □ Peeks and Pokes □ Bugs and Fixes □ Software Exchange □ Software Reviews SEND $15.00 FOR 12 ISSUES TO: PEEK (65) P.O. BOX 347, OWINGS MILLS, MD 21117 (301) 363-3267 Maryland Subscribers Add 5%Tax Inquire for Foreign Rates 66 MICRO - The 6502/6809 Journal No. 52 - September 19£ Market Projection Program for the Color Computer by Leonard I. Suckle This sophisticated business either a conscious or subconcious hesi The total of all columns of data will program is implemented on an tation in the modification of data to be calculated upon request. Further inexpensive Color Computer provide more realistic interpretation of more, a top-down summation value system. It may be modified for the market conditions of the future. may be entered for TAM and NSB, and other computers. the difference between the actual and The intentr of this computer pro top-down summations will be dis Market Projection gram is to alleviate the tedious calcula played. Upon request, the computer tion and recalculation associated with will adjust the TAMs and NSBs, based requires: revisions. With the capability of making on product mix, so they equal the top- TRS-80 Color Computer changes and seeing theii immediate down value. with 16K effect on the rest of the data, more ac It does not require Extended curate decisions may be made in in Entering and working with two Color BASIC dustry planning functions. years of data at a time allows you to make projections and/or calculate The introduction of low-cost personal compound growth rates. Data from one computers has placed the capability of The market projection computer year may be projected by annual com huge computational powers within the program evaluates a market and share pound growth rate (96) to the other year economic reach of nearly everyone. of the market by year and by each of in memory. Select any of the nine para Unfortunately, many of the lower- many product categories. The market meters for projection. Calculations will priced systems are being promoted or parameters evaluated for each of the be done either on a product category received as either toys or games. product categories are shown in table 1. basis or for all product categories. If The computer refers to each of these data is entered for both years, the com The program described in this arti parameters by their item # (1 through puter can calculate the growth rate of cle is an example of how the Radio 9] shown in the table and in figure 1 in any data on an annual compound Shack Color Computer may be used in brackets. percentage. an actual business application. The computer used here is the 16K version without the Extended BASIC ROM. It Table 1: Market Parameters may be purchased for under $500. The 1. Company Market Share (NSB/TAM) in % addition of a line printer and a cassette 2. Total Available Market (TAM) in millions of $ tape recorder add approximately $300 3. Industry Product Mix |TAM of specific product/Total TAM) in % to provide for a complete, versatile 4. Industry Quantity in millions of units system. 5. Industry Average Selling Price (ASP) in $ 6. Company Sales (NSB) in millions of $ The program is written in BASIC 7. Company Product Mix (NSB of specific product/Total NSB) in % and may be used on any compatible 8. Company Quantity in millions of units system. Variations could easily be 9. Company Average Selling Price (ASP) in $ made to customize it to the users' specific needs. These applications should substantiate that the use of low- Data may be saved and loaded by Video Display Characteristics cost personal computers in business year from cassette. Two years of data should not be overlooked. may be stored in memory for entry and Data for each of the two years stored calculation. Within any one of the two in memory is presented in an array of Program Description years, data may be calculated based on pages for each year on the TV display of other data entered. This may be done the Color Computer. These pages are Making projections on industry and on a product category basis, or for all arranged in a 3 x N matrix, where N is company sales, when a multitude of product categories. For example, if the dependent upon the number of product product lines are involved, can be a units and ASP for industry have been categories. long and tedious task. A single change entered, the program will calculate the in value usually results in complete TAM. For expediency of operation, cal Three vertical pages can display a recalculation of the other parameters culations are made only when re maximum of 29 product categories. for each year of the projection. Knowl quested, rather than whenever new This example is shown in figure 1. The edge of the required changes causes data is entered. product categories are numbered and No. 52 - September 1982 MICRO - The 6502/6809 Journal 67 NEW LOW PRICE DIRECT FROM MANUFACTURER 16K RAM EXPANSION BOARD FOR THE APPLE II* $120.00 The Andromeda 16K RAM Expansion Board Now with One Year W arran ty . allows your Apple to use RAM memory in place of the BASIC Language ROMs giving you up to 64K of programmable memory. Separate /\N3flOMED/\ A pplesoft* or Integer BASIC ROM cards are no longer needed. The 16K RAM Expansion Board M INCORPORATED works with the Microsoft Z-80 card, Visicalc, Greensboro, NC. 27410 DOS 3-3, Pascal, Fortran, Pilot, and other 919 852-1482 P-O. Box 19144 software. A switch on the card selects either Price for Andromeda 16K RAM the RAM language or the mainboard ROMs expansion board now only S120.00. when you reset your Apple. Please add S5 for shipping and The Andromeda 16K RAM Expansion ~ handling. North Carolina residents Board has a proven record for reliability with a add 4% sales tax. thousands of satisfied customers. *DEALER INQUIRIES WELCOME. 68 MICRO - The 6502/6809 Journal No. 52 - September 1982 listed along the left side of the display, and the market parameters and their item numbers are displayed across the top. The two years stored in memory are defined as the primary and secondary years, and are located on pages 1 through 3, and 4 through 6, respectively. When in the display mode of the pro gram, the page being displayed may be changed by direct numerical entry of the desired page, or by indexing left, right, up, and down (see DISPLAY). Printer Output Data from either the primary or secondary year may be output to a printer connected to the Color Com puter. The Quick Printer II interfaces directly, and provides a 32-character line width. The program prints the data within the year last displayed on the video. All pages of the displayed year will be printed independent of the page shown on the video display. Operation The program is loaded from cassette tape into memory using the CLOAD command. Sufficient memory must be allocated to the program (13,700 bytes]. Although the program was writ ten with standard ROM, it will also operate with an extended ROM com puter, but a comparable amount of memory must be freed to permit opera tion. Extended BASIC will not free more memory than that amount created by the PCLEAR 1 command. This is not enough memory for this program, so an additional page of memory must be freed prior to loading. This may be done by entering the following command: ' ‘enter” key must be used when oper mediately upon depression of the ap POKE 25,6 (enter) ating in this routine. propriate key. DISPLAY Commands available from DIS PLAY are shown in table 3. After the program is loaded, entering The display routine outputs the RUN initiates operation. The screen data for the primary or secondary years ENTRY will clear and the program enters MAIN stored in memory to the video display. CONTROL. The program is initiated Operation in this routine is indicated The entry routine permits entry of with all data cleared, primary year = by an inverted-screen "D " in the lower data into the designated column of the 1981, secondary year =1986, and the left of the display. year last displayed on the video. An display page pointer set at 1,(1). inverted-screen "E ” is displayed in the lower left of the video screen to in As previously described under MAIN CONTROL Video Display Characteristics, each dicate operation in this routine. The year is displayed in a 3 x N matrix of "enter” key is required for entries in this routine. MAIN CONTROL is the principal pages. Any page may be immediately operating routine from which all other displayed by entering the horizontal routines may be activated. Operation is page number directly, and the vertical Upon entering this routine, the indicated by an inverted-screen (dark page number using the shift key. The display will prompt the user with the request: background) "M" in the lower left of display may also be changed by using the display, preceding the cursor. the arrow of the appropriate direction (up, down, left, right). The “ enter" key ROW(* OR YEAR), ITEM #(*), VALUE Commands available from MAIN is not needed with entries from DIS (OR 'YR'„YEARJ CONTROL are shown in table 2. The PLAY, and all actions will occur im (Continued on page 71) No. 52 - September 1982 MICRO - The 6502/6809 Journal 69 M.P. Computer Services Corporation APPLE II PERIPHERAL DEVELOPERS: 2396 Enclnal Station Your complex function prototype requires Sunnyvale, California 94087 the best wirewrap board available. (408) 735-0871 Retail Your Price SPECTRUM SYSTEMS ...... MAKES IT! laiaiaiaiaiaiBiliSiliRIAl P.F.S.II “NEW IMPROVED" $125.00 $ 96.00 P.F.S. REPORT 95.00 74.00 P.F.S. GRAPH "NEW” 125.00 96.00 Fully Extended Wirewrap Protoboard. (Interfaces with P.F.S. and VisiCalc) VISICALC 3.3 Size: 2.8 by 10.7 inch 2 layer PC. 250.00 225.00 VISITERM 100.00 80.00 Capacity: up to 58-16 pin or 12-40 pin VISIDEX 250.00 195.00 or any combination sockets inbetween. VISIPLOT 200.00 158.00 SUPER DISK COPY II 30.00 25.00 PRO EASYWRITER/MAILER COMBO 300.00 225.00 Carefully designed + 5 and GND planes provide for EASYSPELLER 175.00 137.00 the minimum electrical noise, low impedance, hi THE DICTIONARY 99.50 74.00 CREATIVE FINANCING 195.00 143.00 capacitance, and maximum versatility in the layout REAL ESTATE ANALYZER II 195.00 143.00 of IC’s, capacitors, discretes and I/O connectors. THE BOOKKEEPER MASTER 89.95 66.00 THE HOME ACCOUNTANT 74.95 60.00 TYPING TUTOR II 24.95 19.95 Wire-wrap technique documentation included. SUPER DISK COPY III 30.00 26.00 APPLE 21 24.95 21.95 Terms: CRAPS 24.95 21.95 CROSSFIRE 29.95 24.97 • $45.00 + ( 6 % Cat. Res. tax) + 52.00 S&H. SABOTAGE 24.95 21.95 • All payments must be in U.S. funds drawn on a U.S. THREE MILE ISLAND 39.95 33.97 STAR THIEF 29.95 23.97 bank. • Outside U.S. add 10%. Hardw are • Cashier check/money order allow 30 day ABO. EPSON MX 80 PRINTER 599.00 525.00 EPSON MX 100 PRINTER 995.00 799.00 • Personal checks add 2 weeks. OKIDATA 82A PRINTER 510.00 • No credit cards or cash, Please! OKIDATA 83A PRINTER 799.00 PROMETHEUS VERSAcard 199.00 167.00 16K RAM CARD 169.00 105.00 Spectrum Systems AMDEK VIDEO 100 MONITOR 179.00 117.00 AMDEK VIDEO 300 MONITOR 249.00 208.00 P.O.Box 2262 AMDEK COLOR I MONITOR 449.00 384.00 Santa Barbara, Ca. 9312Q Send check or money order. CA residents add 6 % sales tax. Add $2.00 for postage. All items subject to availability. Send $.50 for our catalog or a Apple II is a trademark ol Apple Computers. free catalog with your order. > Wb an m auttooriifd swieint Apple data lor Appk II & Ml PRINTERS Immediate delivery on al' mofels-wemat carry M enormous inventory of Apple products at all times! • DIABLO (Letter Quality) Retail Your Cost Immediate delivery 630 R102 bi-directnal/tractors 2965 00 2699.00 p u t e r .l6 K -3 2K -48 K -6 4K -P lu s o r Integer in stock! l640Kt09lteyboard, tractors 3072.00 2899.95 630 R0 Receive only 2710.00 2499 95 Urn inventoryof- NEW* IMPROVED APPLE 111 12BK VERSION 1650K136 keyboard/tractors 3220.00 2999.95 Oiikwitt)...... control!*;control)*; OOS 13 ATTENTION: Immediete delivery Sound Oisk Orim WE ALSO CARRY SOFTWARE! • CENTRONICSdot matrix — Piseal-Fortran-Cabal laniuafis Rational Software Dow Jane & Quota reporter Peach Traa Software 700-9 Parallel, heavy duty 1460.00 1199.95 Graphics Tablets Microsoft Viiiwc for Apple ll & III Mcropro 704-9 Serial, heavy duty 1795.00 1599.95 Smerttrm 10 eoiumn card 737 1 Parallel 995.00 799.95 Meromodain II by OC Hayes American 899.95 System Plus 737-3 Serial 1045.00 mm moft. . 704-11 Parallel 1870.00 1695.00 P I Electrostatic 495.00 189.95 a llAnrn Tirrn HEWLETT PACKARD 466 995.00 895.00 2 NEW C3£LUXE CAL CS FROM HP! Texas Instruments 460G graphics 1094.00 969.95 SHm, shlft-pocket styling 1982 Modal with Home Computer 560 1295.00 1099.00 NEW! HP-11 Your Cost: full typewriter-style keyboard, S60G graphics 1394.00 1195.00 Advanced Proffsmmsble TI-9I/4A U/L cue & more! Retail Yett Ccsi 445 795.00 695.00 Scientific LCD Rexaif.Sl30.00 $114.95 New KEYBOARD “ S950 00 S369.95! 445G 894.00 789.00 Your Cost NEW! HP-12C Your Cost: $ EPSON PRINTERS Retail: Advanced Programmable keyboard MX80 645.00 539.95 Main Showroom & Offices: Financial LCORet^l.-SfSO.O? $129.95 636995 Optional Graftrax Chip 90 95.00 10" color monitor lor 99/4 650 00 HP-125 New Microcomputer Retail Youf Cott 319.95 MX80 FT 745.00 659.95 216 South Oxford Avenue 64K CPU/Term|nal/Keyboard 32K Exp. mem module 399 95 31495 MX80 + GRAFTRAX 80 695.00 579.95 3750 00 3195.00 Extended Banc, < MUST lor 100 00 75 00 Los Angeles, CA 90004 HP-85 Microcomputer printer/monitor 32 K module MX80 FT* GRAFTRAX 80 795.00 689.95 3250.00 2499.00 Speech synthesiser 150 00 129.95 MX100 995.00 789.95 WE HONOR HP-13 Microcompum-built-in monitor 2250.00 1798JO We carry a large inventory ot software. & HP-2631 B Printer, dot dm* (ask for optns) 3950.00 3199.00 WE ALSO HAVE . . . VISA and MASTERCHARGE accessories Your Can • NOVATION Modems Retail Your Cost HP82905A 90 col prwtAr. dot matrix 945.00 755.00 TI-30-2 LCSStu Slide NEW J8.95 TELEX: 67 34 77 HP-2001 A Latter quality prter, daisy wheal 3495.00 TI-35SP LCO SCIENTIFIC 22.50 CAT 199 95 159.95 HP-82901M Dual masted (256KB disk drivel 2500.00 1999.00 0 CAT 199.95 159.95 OROER DESKS open 7 Days a Week! Call us for the lowest pilices on 7 disk driv*s Call us Call us TI-40 LCO Sei/NEW 28.95 -f- Tl-57 Prog. Scientific 39.95 APPLE CAT Direct connect 349 95 314.95 7:00 AM to 7:00 PM Mon thru Sat HP-41CV New! 2.2K bytes of memory 325 00 256.00 TI-58C 480 Step. Prog. Sunday Noon to 5:00 PM Canl Reeder for 41 CV 215.00 171.00 TI-59 960 Step. Proq. SANYO MONITORS High resolution Printer for 41 CV 385.00 294.00 PC 100C Print/Plot 13" Color (new) high quality 550 00 419.95 Order Desks: (213) 739-1130 Outd Ram 95.00 84.95 LCDProgtammet/NEW 12" Green phosphorous 360 00 259.95 TOLL-FREE TOLL-FREE Optical Wand for 41 CV 125.00 99.95 12" Black & whue 340 00 239.95 HP-41C Calculator 250 00 188.95 A ^ at M a Large inventory of periphls, access, etc. 15" Black & white 370 00 259.95 (outside Calif.) (within Calif.) Memory mod. for 41C 26.95 9” Black & white (the best seller) 235 00 169.95 HP-97 Progrmble prmtfr 750.00 579.95 A TAKI Computer R e fill Yi HP-34C Progrmble scientific 150 00 117.95 400 SPECIAL PRICE! 16K 595 00 339.95 AMDEK(leedex)High Quality Monitors 800-421-8045 800-252-2153 ness R/E 150.00 119.95 No language inc., opt'l basic, 54.95 HP 38C Progimblc bus 100 12" B/W. 12 MHz 179.00 139.95 NO ONE UNDERSELLS OLYMPIC SALES We have the complete line of accessories, etc. 800 16K Computer 1080 00 759.95 SPECIAL' 100-G 12" Green, 12 MHi 199.00 174.95 Write & request our new 112 pg catalog- 300-G 12" Green. 18 MHz 249.00 199.95 ATARI 800 48K Computer 1250.00 Color I 13" Color, NTSC comp, input, 449.00 339.95 please include $1.00 to defray postage & XEROX audio amp & speaker handling-includes many more Hems-from Color If 13" Color, B8 G input, 999.00 699.95 Model 820-1 <5’A") 8 “ S3750.00 OHIO SCIENTIFIC TV's to Watches! 64K COMPUTER & WORD PROCESSOR C8PDF-48K Retail:$3495.00Y/C: $3195.00 hi res graphics, speaker A ll goods subject to availability, this ad super AC | nuU aO Special discount available to • Dual 8 " Drives *6 4 col x 32 line/color nn Schools A Institutions-lnquirt! • H AZElTINE Video Display Terminals sedes all previous ads. we are not responsible $Z9«j5.(JU Required software add'!. • .7 MIPS -M S P ^ M a n y more stnd features for typographical errors; we will meet or beat • SHUGART Disk Drives any advertised prices if the competition has Fortran & Pascal available • DEC VT100 & VT103 NEW-FAMOUS tjORVUS OISK 0RIVES-5,10,20 Many other OSI products -a t discounted prices the g o o d s on hand. MEGABYTES with fantastic new OMNINET Network Call us for your DISCOUNTS D price TODAY! Minimum shipping and handling $4.95. Call us for the be« prices in the USA! Syttem A ll orders subject to verification and acceptance. NEW! From T l—Series 10 Personal Information Terminal Retail 995 00 your Cost 795.00 70 MICRO - The 6502/6809 Journal No. 52 - September 19 Data Entry Options CALCULATE Operation in this routine is in dicated by an inverted-screen "C " in a. Entry or change of specific data The calculate routine which gener the lower left of the display. Entry into within the displayed year: Enter the ates data within the displayed year, CALCULATE may be performed from location of the new data (row # projects data from the primary year to either MAIN CONTROL or DISPLAY, shown at left of screen, item § the secondary year using an entered an but exit is always to DISPLAY. shown at top of screen), followed by nual compound growth rate, or redis the new value of data. For example, tributes either the TAM or NSB of the Upon entry to CALCULATE, the to enter a value of 10 for TAM (item displayed year to equal an entered top- display will prompt the user with the §2J of product category #3, enter: down summation. The annual com following request: pound growth rate between items in 3,2,10 (enter) the primary and secondary years may DATA, RATE, PROJCTN, SPREAD? also be calculated. (continued) b. Entry or change of all values of a specific item § within the displayed Table 2: Commands Available from MAIN CONTROL year: Enter an for the row, followed by the item # and a comma. The program will then prompt the Command Routine Action user for the desired data value for each row (product category) by dis D DISPLAY Program enters video display routine. playing the name of theproduct cate E ENTER Program enters data entry routine. gory, and the present value (PVJ. C CALCULATE Program enters calculate routine, where new Three possible entries of data may be data is determined based on previously made: 1. the new value, 2. entei, entered data. which is accepted as a value of zero, and 3. " / ”, which retains the pres S Calculates sums of all columns within the ent value. year that is presently displayed on video. CLR CLEAR Permits clearing data in either primary or Example of entering data for secondary year, as specified. TAM for all product categories: R Displays previously calculated compound *,2, (enter) growth rates on video screen (see CALCULATE). c. Entry or change of all values of data P Data within vertical page last displayed is for a specific product category (row): output to the printer, as described in Enter the row #, followed by an PRINTER OUTPUT. for the item #, followed by a comma. RP Outputs previously calculated compound The program will then prompt the growth rates to the printer (see user to enter data for each of the nine CALCULATE). items for the specific product cate gory designated. A value must be LD LOAD Loads yearly data previously stored on entered for each item request. The cassette tape. "enter" key with no preceding value SAVE SAVE Saves primary or secondary year data on is interpreted as a value of zero. cassette tape. HEADER Cassette tape is prepared to receive data for a Example of requesting entry for year not previously stored. See "Tape all items for product category #14: Initialization" under SAVE. 14,*, (enter) d. Change of primary or secondary year: The value of the years for Table 3: Commands Available from DISPLAY primary and secondary display pages is initialized at 1981 and 1986, respectively. Either of these years Command Routine Action may be changed to any other year R Same as command described under MAIN value. The display should be set to CONTROL the year to be changed (pages 1 E ENTER Same as above through 3 for primary year, pages 4 through 6 for secondary year). The C CALCULATE Same as above enter command may then be used, as P Same as above shown in the following example, which changes the year to 1989: S Same as above + Special Sum — calculates sums of columns YR,,1989 (enter) between specific rows (product lines) designated by user. When any of the entry requests are Return to MAIN CONTROL. completed, the program will always Q return to DISPLAY. No. 52 - September 1982 MICRO - The 6502/6809 Journal 71 The user response must be followed by Appendix A an "enter" key. 1 CLEAR 9 ' MPP 10 ’ L.I.SUCKLE Calculate Options 12 ’ 12/00 IS ’ REVi10/19/81 D Data: Calculates data within the 20 • INITIALIZATION 29 '*****E N TE R NUMBER OF PRODUCT CATEGORIES IN LINE 30 displayed year based on existing data. 30 PC-6 Entry into this subroutine results in the 33 PT-PC+liPM-INT</ll>+l 40 DIM T(PT,ie>,Hl«(9),H2«(9) following request on the display: 43 DIM PL*(PT),SM(1B),RT(PT) 30 DIM TM<4) ROW(*), ITEM #? 60 H I*—"PRODUCT CAT." 80 DATA N 8B/TAM,TAM,MIX-T,UNITS,ASP 100 DATA NBB.MIX-N,UNITS,ASP The location of the desired parameter is 120 DATA X (1), (2), (3), (4), (3) 130 DATA (6 ) , ( 7 ) , , <9) entered using the row # shown on the 160 FOR N -l TO 9 left of the screen and the item # shown 160 READ H1«(N) at the top of the screen. If an entire col 200 NEXT N 220 FOR N -l TO 9 umn is to be calculated, an * may be used 240 READ H2«(N) in place of the row #. For example, to 260 NEXT N calculate the value of industry units 270 CLB 273 PB—liP P —1 (item 4] based on TAM and ASP, enter 280 V1-19B1 the following: 290 Y2-19B6 300 YR-Y1 320 SL—32*13 *,4 (enter) 330 ’ MtMENTER THE NAMES OF PRODUCT CATEGORIES IN LINES 340-400 340 DATA WIDGETS,THINGOTS,DIPSIES,DOODLES,WHATCHA, MACALLET9 410 FOR N -l TO PC The calculations for TAM and NSB 420 READ PL«(N) may be based on a variety of constants. 430 NEXT N 440 FX-10 Whenever a request for these calcula 430 GOSUB 9000 tions is made, the computer requests 460 FD-FN more information: 470 P L *(P T )-“ TOP-DOWN TOTALS" 460 JF-0 1000 REM MAIN CONTROL CONSTANT (3), (4)&(5), (1)? 1010 PRINT38L 1020 PRINT88L, "«i“ | 1040 INPUT 00« The item # to be held constant is 1033 0*-LEFT«(00«,l) entered using the "enter" key, and the 1060 IF Q*»"D" THEN 2000 1070 IF Q«-“E" THEN 7000 calculation is performed. 1060 IF QO*-MBAVE“ THEN 4000 1090 IF Q0*-"LD" THEN 3000 1093 IF QO*-"CLR“ THEN 11000 D134 Data: Automatically performs a 1100 IF Q«-"C" THEN 6000 series of calculations comparable to 1110 IF 0*-"P" THEN 6000 "D " for items 1, 3, and 4 for all product 1120 IF QO*—"HEADER" THEN lOOOO 1123 IF QO*-"RP“ THEN 2700 categories (rows|. 1130 IF Q«-"R" THEN Ll-1lL2-29lGOSUB 6340 1140 IF 0«-”8" THEN GOSUB 2300 D178 Data: Automatically performs a 1999 BOTO 1020 2000 REM LIST ROUTINE series of calculations comparable to 2020 CLS "D " for items 1, 7, and 8 for all product 2023 IF PG>3 THEN YR-Y2 ELSE YR-Y1 2030 ON PG GOTO 2038,2040,2030, 2032,2034,2036 categories (rows). 2038 8T-I 1 QOTO 2060 2040 ST-2iG0T0 2060 R Rate: Calculates the annual com 2030 8T-6 1GOTO 2060 2032 ST-lOiGOTO 2060 pound growth rate between primary 2034 ST-111 GOTO 2060 and secondary year data. Entry into this 2036 ST-13 2060 LB-1+11* subroutine results in the display of the 2070 IF PC,4) 2100 PRINT 9 3 2 ,M 3 THEN 81-S-9 EL 8E S l-S The growth rate for a particular product 2130 PRINT3L," ,,+Hl«<81) category (row) and item may be 2140 PRINT3L+32,“ ”+H2« entered, or all product categories for 2130 K—64 2133 IF L8 >PC THEN 2220 the specific item may be calculated by 2160 FOR P-LS TO LE using for the row #. The algorithm 2170 IF L -4 THEN PRINTSK.P 2173 T-INT(T(P,8)*100+.3)/100 for calculating the compound growth is 2180 PRINT9L+K,T| relatively slow, so an indication of 2190 K-K+32 which row is being calculated is shown 2200 NEXT P 2210 IF PPOPM THEN 2270 to indicate that the computer is oper 2220 IF L< >4 THEN 2260 ating. At the completion of the calcula 2230 PRINT3K+64,PT1 PRINT3K+6B, T < PT, B) tion, the value(s) are shown on the 2240 PRINT9K+96,"DLTA " 1 IF FS-1 THEN PRINT3K+100, INT <100$(T 72 MICRO - The 6502/6809 Journal No. 52 - September 1$ Appendix A (continued) When the entire column has been cal culated, a display page is filled and 2300 PRINTa9,Hl* 2310 PRINTS25, H1 *(1 ) waits for any key input before display 2330 PRINT®57, H2* <1) ing the next page. After the last data is 2340 K-64 displayed, any key entry returns the 2345 IF L8>PC THEN 2420 23S0 FOR P-LS TO LE operation to DISPLAY. The latest rate 2360 PRINTdK'P calculation may be reviewed from 2370 PRINT8K+4 , PL*(P) 2380 PRINT8K+25,INT(T(P,ST)<100+.5)/100 either DISPLAY or MAIN DISPLAY by 2390 K-K+32 entering “R” . The rate data may be 2400 NEXT P output to the printer by entering "RP" 2410 IF PPOPM THEN 2900 2420 PRINT8K+36,"SUMMATION" from MAIN CONTROL. 2430 IF FS-1 THEN PRINTdK+57,INT(SM(8T)*100+,5)/100 2440 PRINT3K+64,PT|" TOP-DOWN TOTAL" 24S0 PRINT 9K+100," DELTA" P Projection: Calculates a new value of 2460 GOTO 2900 data in the secondary year based on ex 2470 PRINT38L,"sun FIRST R0W.LA8T ROW” | isting data in the primary year and an 2480 INPUT J8,JE 2483 GOSUB 2S05 entered annual compound growth rate 2488 PP-3 in %. Entry into this subroutine results 2490 JF-1 in a displayed prompt: 2493 GOTO 2000 2500 PRINT98L,"CALCULATING SUMS" 2901 JS-1»JE-PC ROW(» OR S), ITEM, RATE? 2S02 JF -0 250S FOR N -l TO 18 2S10 SM(N)-0 2520 NEXT N 2530 FOR N-JS TO JE The specific row #, and annual rate are 2532 SM(3)-8M(3)+T(N,3) entered, followed by the "enter" key. 2535 SM(7)-SM(7) +T (N, 7) The calculated data is stored in the ap 2536 8M (12)«8M (12)+T(N#12) 2537 8M(16)-8M(16)+T(N?16) propriate location in the secondary year 2540 FOR J -2 TO 17 STEP 2 data table. Completion of the calcula 2550 SM(J)-SM(J)+T(N,J) tion returns the program to DISPLAY. 2560 IF J-8 THEN J-9 2570 NEXT J 2580 NEXT N Sample ENTRY: 2590 FOR J -0 TO 9 STEP 9 2600 IF SM(2+J)< >0 THEN SM<1+J)*100»SM(6+J)/8M(2+J) 2610 IF SM(4+J)<>0 THEN SM<5+J)-SM(2+J)/8M(4+J) 3,2,10 (enter) 2620 IF SM(8+J)<>0 THEN SM(9+J)-9M(6+J)/SM(8+J) 2630 NEXT J 2635 FS-1 Several options for "row #" are1 2640 RETURN 2700 REM RATE PRINT 2710 PRINT#-2,TAB(4)H1«(IR)| » Data for all product categories 2720 PRINT#-2,TAB <11)Y11 under the specified item # will be 2730 PRINT#-2,TAB(18)Y2| calculated. Using an entry, as 2740 PRINT# -2, TAB(25) "RATE" 2750 FOR N -l TO PC shown by example: 2760 PRINT#-2f CHR*(0 )| 2770 PRINT#-2»N|LEFT*(PL*(N),8 )| *,2, (enter) 2773 DR-N: D I- IRIG08UB9500 2774 PRINT#-2,TAB(11)D| 2777 D I- IR+9iG0SUB9500 will result in a display prompt for 2780 PRINT#-2,TAB(18)Dj 2790 PRINT#-2,TAB(25)INT(RT(N) * 10+.5 )/1 0 annual rate inputs in percent for 2800 NEXT N each product category. 2810 QOTO 1000 2900 PRINTd503,"PGMPG| 2901 PRINTSSL,"d"| S Data for all product categories 2902 IF JF-1 AND PP-3 THEN PRINTSSL,"mpeci*l mum R0WS"JS|" TO"|JE under the specified item # will be 2903 PRIlsTTSSL, " d "| 2904 X*-INKEY* calculated with identical growth 2905 IF X*-"" THEN 2902 rates equal to that value entered. An 2906 IF X*-"R" THEN L1-1IL2-PCIG0T06340 example for items 2 and 10% is: 2909 IF X*-"+" THEN 2470 2910 IF X*-"Q" THEN 1000 2911 IF X*-"E" THEN 7000 S,2,10 (enter) 2912 IF X*-”C" THEN 6000 2913 IF X*-"S" THEN GOSUB 2500 2914 IF X*-"P" THEN SOOO The growth rate previously calculated 2915 X-VAL(X*) with the “R " command under CALCU 2920 IF X>0 AND X<7 THEN PG-X 2925 Y*-CHR*(ASC(X«)+16) LATE may be used in place of an 2930 Y-VAL(Y«) entered value(s| for rate. This is per 2935 IF Y>0 AND Y<-PM THEN PP-Y formed by using "R " for the value of 2940 IF X*-CHR*(9) THEN IF PG<6 THEN PG-PG+1 2945 IF X*-CHR*(8) THEN IF PG>1 THEN PG-PG-1 the rate. An example of projecting an 2950 IF X*-CHR*(94) THEN IF PP>1THEN PP-PP-1 entire column of data is: 2955 IF X*-CHR*(10) THEN IF PPNo. 52 - September 1982 MICRO - The 6502/6809 Journal 73 or 7). Entry into this subroutine yields Appendix A (continued) the prompt: 3090 I -8 !GOSUB 6530 3100 G0T02000 ITEM # (2 OR 6)? 3200 IF VAL(R*)00 THEN 3240 3203 R*-”*“ 3210 IF I-IR THEN 6911 Either 2 or 6 will be accepted, using the 3220 PRINT"CALCULATE RATES FOR ITEM "|IR "enter" key, for spreading TAM or 3230 GOTO 1000 3240 Y3-VALIR*) NSB, respectively. The program checks 3250 R *-"*“ for a valid entry of top-down summa 3270 GOSUB 6225 tion, and if one exists, the calculation 3200 Y2-Y3 3290 G0T06911 is performed and the program returns to 4000 REM SAVE DISPLAY. If an invalid summation is 4005 DL-200 4010 PRINT9SL,"BAVE WHICH YEAR" | found (zero), the program requests that 4020 INPUT YS* a top-down entry be made and returns 4022 YS-VAL to MAIN CONTROL (indicated by 4030 IF YSOY1 AND YSOY2 THEN PRINT “DATA NOT AVAILABLE"! I SOTO 1000 4031 GOTO 4070 inverted-screen “ M” ). 4035 IF RI0HT*(YS*,1>-"X“ THEN 4070 4040 PRINT SSL, "REWIND TAPE i< ’ PLAY’ " 4050 FN*-"H"+STR* 4060 9KIPF FN* 4070 PRINT9SL,“ SET TO ’ RECORD’ & ENTER ’ READY’ " 4080 INPUT a * 4090 IF Q*0"READY“ THEN 1000 CLEAR 4100 IF YS-Y1 THEN S F -liE F -9 4110 IF YS-Y2 THEN SF-lOiEF-10 Data for either the primary or 4120 OPEN "0“ , - l , ”F“+STR*(YS) 4125 RP-1 secondary year may be reinitialized to 4160 FOR N-SF TO EF zero by entering CLR from MAIN 4170 FOR K - l TO PT CONTROL. The program will prompt 4175 ON RP SOTO 4100,4105 4180 PRINT#-1,T(K,N)I0OTO419O with: 4105 INPUT#-1,T(K,N) 4190 NEXT K 4200 NEXT N CLEAR WHICH YEAR? 4210 CL08E-1 4212 ON RP GOTO 4214,4220 The year is entered (using "enter” 4214 MOTCRON 4216 FOR T - l TO DL key) and if it corresponds with either 4217 NEXT T the primary or secondary year, all data 4218 MOTOROFF 4220 CLS in memory for that year will be cleared. 4230 PRINT996,"TURN RECORDER OFF” If an invalid year is entered, the display 4240 GOTO 1000 will indicate: 5000 REM LOAD 5005 CLS 5010 PRINT9SL,“LOAD WHICH YEAR,“ YEAR NOT IN DISPLAY 5015 PRINT “ INTO PAGES 1 -3 (1 ) OR 4-6<2) 5020 INPUT YS,YP 5030 IF YP<>1 AND YP<>2 THEN 1000 Exit from the routine is to 5035 IF YP-1 THEN SF-1lEF-9lYl-YB DISPLAY. 5037 IF YP-2 THEN SF-lOiEF-lBiY2-YS 5040 CLSfPRINT9SL, “REWIND TAPE Sc ’ PLAY’ " 5050 OPEN"I", - I , “F“+STR* 5060 RP-2 5070 GOTO 4160 6000 REM CALCULATE 6010 PRINT9SL,"c DATA, RATE, PROJCTN, 8PREAD" I LOAD 6020 INPUT 0 * 6022 FS-0 The load routine retrieves data 6025 IF Q*-“D134“ THEN 3010 6026 IF Q*-"D178" THEN 3060 previously stored on cassette tape and 6030 Q*-LEFT*IQ*,1) loads it into memory. Access to this 6040 IF Q«-"D" THEN OOSUB 6300 6030 IF Q *-"R “ THEN 0OSUB 62OOI0OTO 1000 routine may only be performed from 6060 IF Q*-"P" THEN 6900 MAIN CONTROL. Entering LD results 6070 IF Q*<>"S" THEN 2000 in the response: 6100 REM SPREAD 6105 PRINT98L 6110 PRINT98L,“e ITEM • <2 OR 6 )“ | LOAD WHICH YEAR INTO PAGES 6120 INPUT I 6130 IF 102 AND 106 THEN 1000 1-3(1) OR 4-6(2)? 6135 11—I 6140 IF Pfl>3 THEN I- I+ 9 Pages 1-3 represent the primary 6142 IF T IP T ,I> -0 THEN CLSiPRINT “ ENTER TOP-DOWN “ | H I * ( 11 ) iSOTO 1000 6145 0O8UB 2300 year, and 4-6 the secondary year. For 6150 D-TIPT,I)-BM(I) example, if data for 1984 is to be placed 6160 FOR N -l TO PC into the secondary year memory, the 6165 IF SM < I ) -0 THEN 6100 6170 TIN,I)-TIN,I)+D*T(N,I)/SMI I) following entry would be made: 6100 NEXT N 6105 GOSUB 2300 6190 OOTO 2000 1984,2 (enter) 6200 REM RATE 6205 PRINT9SL 6210 PRINT9SL, “ROW(OR ’ «’ >,ITEM#“ | The user is then prompted to "RE 6220 INPUT R * ,I WIND TAPE & PLAY” . After the data 6225 IR -I is loaded, the prompt, "TURN 6230 DY-Y2-Y1 6240 IF R*-"«" THEN Ll-1iL2-PCiGOTO 6270 RECORDER OFF” , is issued and the 6250 R-VAL74 MICRO - The 6502/6809 Journal No. 52 - September 19 Appendix A (continued^ SAVE 6270 FDR N-Ll TO L2 6273 IF T3 THEN V1-V1+9IV2-V2+9*11-11+9 6680 FOR R-Ll TO L2 Data is stored on a year-by-year 6690 ON EQ GOTO 6695,6710,6715,6725,6728,6705 basis, in a file named "F ", followed by 6695 IF T4 AND Vl<>8 THEN 6750 6790 V2-V1+1 be stored. 6800 EQ-6 6820 GOTO 6670 2. Set the tape recorder to the record 6900 REM PROJECTION 6901 W-0 mode. 6902 Y4-Y2 6905 PRINT©SL,"c projection ROW(* OR S) , ITEM, RATE'*| 6908 INPUT R*,I,RT* 3. Return the program to the MAIN 6909 IF RT*-'^*' THEN 3200 CONTROL routine. 6910 RT-VAL | |