MacApple How BASIC Works More Output from your Micro C Cursor Control for the C1P The Atari Dulcimer KIM/SYM Home Accounting System You can use MICRO PLUS

! SINGLE BOARD COMPUTER

OEM BUI''

MICRO PLUS is a 6502-based Single Board Computer Ith extensive video capabilities, communications support and interlace. As an OEM Building Block, it allows selection of the I monitor, enclosure and power supply best suited to your application. As an Intelligent T erm in al,..tl, it provides------full RS232------and— 20 mA comm unication at baud r. from 50 to 19.2K, with superior text-editing features. It may be combined with F PLUS to form a Sophisticated System with 8” and 5% " diskettes, an IEEE-488 < numerous I/O ports, up to 56K

{«■ 4 ; V Video Features: • Programmable screen format Programmable baud rates from • Me m .v- h' v ■ up to 132 characters by 30 lines 50 to 19.2K baud • Auto-ir M U N • Reverse video on character-by- Parity generation and checking • Sine character basis - Programmable word length and • Brei ! be t • EPROM character set for user- stop bits • Break < 1K progra definable characters • Full-duplex or half-duplex ■ MicroMon < • RAM character set for operation software in E dynamically changing characters • Both RS232C and 20-milliamp Editor Features: > Can be directl under program control current loop interfaces provided • Cursor up, doi DRAM PLUS, FLEXI PLUS • Light pen input • ASCII keyboard interface home PROTO PLUS • Programmable character width • Scroll up/down • Single voltage required +5V • Up to 4K display memory Insert/delete line or < m

Call or write for free catalog Let us build your custom system. ■! \ f M ICRO PLUS TCB-111 $375 Communications option 50 * Documentation 10 For US, add $3.00 surface postage. Prices quoted are for US only. For 34 Chelmsford St., Chelmsford, MA 01824 foreign shipments write for rates. 617/256-3649 Massachusetts residents add 5% sales mm The SoftCard™ Solution. SoftCard BASIC included. A powerful tool, Basic Compiler and Assembly Lan­ turns your Apple into two computers. BASIC-80 is included in the SoftCard guage Development System. All, more A Z-80 and a 6502. By adding a Z-80 package. Running under CP/M, ANSI powerful tools for your Apple. microprocessor and CP/M to your S tandard B A S IC -80 is the m ost Seeing is believing. See the SoftCard Apple, SoftCard turns your Apple into powerful BASIC in operation at your Microsoft or Apple a CP/M based machine. That means available. It includes extensive disk I/O dealer. We think you'll agree that the you can access the single largest body statements, error trapping, integer SoftCard turns your Apple into the of microcomputer software in exist­ variables, 16-digit precision, exten­ world's most versatile personal ence. Two computers in one. And, the sive EDIT commands and string func­ computer. advantages of both. tions, high and low-res Apple graphics, Complete information? It's at your Plug and go. The SoftCard system PRINT USING, CHAIN and COM­ dealer's now. Or, we'll send it to you starts with a Z-80 based circuit card. MON, plus many additional com­ and include a dealer list. Write us. Call Just plug it into any slot (except 0) of mands. And, it's a BASIC you can us. Or, circle the reader service card your Apple. No modifications required. compile with Microsoft's BASIC number below. SoftCard supports most of your Apple Compiler. SoftCard is a trademark of Microsoft. Apple II and peripherals, and, in 6 5 0 2 -mode, your More languages. With SoftCard and Apple II Plus are registered trademarks of Apple Computer. Z-80 is a registered trademark of Zilog, Apple is still your Apple. CP/M, you can add Microsoft's ANSI Inc. CP/M is a registered trademark of Digital Standard COBOL, and FORTRAN, or CP/M for your Apple. You get CP/M Research, Inc. on disk with the SoftCard package. It's a powerful and simple-to-use operating system. It supports more software than any other microcomputer operat­ ing system. And that's the key to the c o n s u m e r ! PRODUCTS I versatility of the SoftCard/Apple. Microsoft Consumer Products, 400 108th Ave. N.E., CIRCLE READER SERVICE NUMBER Bellevue, WA 98004. (206) 454-1315 80 COLUMN GRAPHICS r

CBfYj The Integrated Visible Memory for vHF the PET has now been W redesigned for the new H 12" screen 80 column „ §■ and forthcoming 40 ~ ~ ! m M jm column PET computers * - _. JP - , W from Commodore. Like f earlier MTU units, the new K-1008-43 package ■ mounts inside the PET •"•H r case for total protection. i To make the power and flexibility of the 320 by 200 bit mapped pixel graphics display easily accessible, we have designed the Keyword Graphic Program. This adds 45 The image on the screen was created graphics commands to Commodore BASIC. If you have been by the program below. waiting for easy to use, high resolution graphics for your PET, isn’t it time you called MTU?

10 VISMEM: CLEAR K-1008-43M Manual only $10 (credited toward purchase) 2u P=160: Q*ICO 30 XP-144: XR=1.5*3.14i1<»2/ k-1008-43 Complete ready to install package $495 40 TfP*56: YR=L: ZP=64 50 XF-XS/XP: YF*YP/YH: ZF=XR/ZP Mastercharge and Visa accepted SO FOB ZI=-Q TO Q-l 70 IF ZI<-ZP OP I l i i P GOT': ibO Write or call today for our full line catalog describing all 80 IT-ifXP/ZPt ‘ fes-8I MTU 6502 products, including our high speed 8" Floppy 90 XLsIBT{.5+SQP(XP*XP-2T*ZTJ) 100 FOR XI=-XL TO .<„ Disk Controller for up to 4 megabytes of PET storage. 110 XT-SQK (XI*XI + fcT*?.Tj *Xl': XX = XI 120 YXMSItI(XT)+i4*SIN<3*XT) )*YJF 130 COSUB 170 140 W5XT XI 150 NEXT ZI 160 STOP 170 X1*XX+ZZ+P Micro Technology Unlimited 180 y i=y y-2Z+ q 190 GMODE 1; MOVE X I,V I: WRPIX 280b Hillshorouqh Strenl 200 IF X1=>0 GOTO'220 rP 0 Box I ? I OB 210 GMODE 2: LIN* X l,Y l-l,X lr0 R.ileiqh NC 27605 U S A 220 RETURN 1

NOW 80 COLUMN PETS CAN HAVE MTU HIGH RESOLUTION GRAPHICS

MICRO ■ The. jf; T!i, NO. 36 MAY 1981

/AlCftOTHE 6502JOURNAL STAFF CONTENTS Editor/Publisher ROBERT M. TRIPP Q MACAPPLE y Shorthand for commonly used Integer BASIC commands Associate Publisher By David Lubar RICHARD RETTIG . 0 KIM/SYM HOME ACCOUNTING SYSTEM Associate Editor MARY ANN CURTIS 1 O Simple application requiring little hardware By Robert Baker Special Projects Editor MARJORIE MORSE . n MORE OUTPUT FROM YOUR MICRO I y Add extra output bits to your AIM, SYM, KIM, Superboard or C1P Art Director By H.H. Aumann GARY W. FISH

Typesetting 0 0 APPLESOFT VARIABLE DUMP EMMALYN H. BENTLEY Handy debugging utility for Applesoft in ROM By Scott D. Schram Advertising Manager L. CATHERINE BLAND 0 . HOW MICROSOFT BASIC WORKS 0 1 Explanation of variables and FNX definitions Circulation Manager CAROL A. STARK By Greg Paris

MICRO Specialists o n SYM-1 COMMUNICATIONS INTERFACE APPLE: FORD CAVALLARI \ j y Direct messages to SYM or modem PET: LOREN WRIGHT By Nicholas J. Vrtis OSI: PAULGEFFEN A _ APPLE MEMORY MAPS, PART 2 Comptroller 4 0 Listing and program description of memory maps DONNA M. TRIPP By Peter A. Cook Bookkeeper c n THE ATARI DULCIMER KAY COLLINS O y Simulation of a 3-string dulcimer, in real time By Mike Dougherty AN INEXPENSIVE WORD PROCESSOR JMCRO™is published monthly by: MICRO INK, Inc., Chelmsford, MA 01824 0 0 Interface an IBM 2740 terminal to an 8-bit parallel port Second Class postage paid at: By William F. Pytlik Chelmsford, MA 01824 and Avon, MA 02322 - j H TINY PILOT FOLLOW-UP USPS Publication Number: 483470 ISSN: 0271-9002 ( 1 More information about Tiny, plus a programming example By Nicholas J. Vrtis Subscription Rates: Per Year CURSOR CONTROL FOR THE C1P U.S. $18.00 # O Give your C1P user-selectable windows, one-key screen clear, and the Foreign surface mail $21.00 Air mail: ability to edit Europe $36.00 By Kerry V. Lourash Mexico, Central America $39.00 Middle East, North Africa $42.00 O H PROTECTING MEMORY FROM DOS South America, Central Africa $51.00 0 1 Protect and use RAM above DOS South Africa, Far East, By Glenn R. Sogge Australasia $60.00

For back issues, subscriptions, change DEPARTMENTS______of address or other information, write to: MICRO P.O. Box 6502 5 Editorial — The Changing Scene — R.M. Tripp Chelmsford, MA 01824 6 Letterbox or call 17 Challenges — Paul Geffen 617/256-5515 25 Microprocessors in Medicine — Jerry W. Froelich, M.D. Copyright© 1981 by MICRO INK, Inc. All Rights Reserved 40 Annual Index 62 PET Vet — Loren Wright 72 Microbes 88 The MICRO Software Catalog: XXXII 92 6502 Bibliography: Part XXXII — William R. Dial 95 Advertisers’ Index

No. 36 - May 1981 MICRO - The 6502 Journal DATA CAPTURE 4.0 The most advanced and easiest to use telecommunications program for use with the MIICROMODEM II® or the Apple COMMUNICATIONS CARD®

Q. Will DATA CAPTURE 4.0 work with my Communica­ Q. What type files can I read and save with DATA tions Carets and a modem? CAPTURE 4.0? A. It makes using the Comm. Card almost as easy as using A. Any Apple DOS sequential text file. You can create and the Micromodem II. edit EXEC files, send or receive VISCiALC© data files, Q. Do I need an extra editor to prepare text for transmis­ send or receive text files created with any editor that uses sion to another computer? text files. A. No. DATA CAPTURE 4.0 gives you control of the text Q. Can t leave DATA CAPTURE 4.0 running on my Apple buffer. You can use DATA CAPTURE 4.0 to create text. at home and use it from another system? Q. Can I edit the text I have prepared? A. Yes. If you are using the Micromodem I)1® you can call DATA CAPTURE 4.0 from another system. This is handy if A. Yes. You can insert lines or delete any lines from the text. you are at work and want to transmit something to your Q. How about text I have captured. Can I edit that? unattended Apple at home. A. As easily as the text you have prepared yourself. You can delete any lines you don't want to print or save to a disk file. Q. Where can I buy DATA CAPTURE 4.0? You can also insert lines into the text. A. Your local Apple dealer. If he doesn’t have it ask him to order it. Or if you can’t wait order it directly from Southeast­ Q. Just how much text can I capture with DATA ern Software. The price is $65.00. To order the Dan CAPTURE 4.0? Paymar Lower Case Adapter add $64.95 and include the A. If the system with which you are communicating accepts a serial number of your Apple. stop character, most use a Control S, you can capture an unlimited amount of text. Q. If i order it directly how can I pay for it? A. W e accept Master Charge, Visa or your personal check. Q. How does that work? And do I have to keep an eye on You will get your order shipped within 3 working days of how much I have already captured? when we receive it no matter how you pay for it. Send your A. When the text buffer is full the stop character is output to order to us at the address shown or call either of the the other system. Then DATA CAPTURE 4.0 writes what numbers in this advertisement You can call anytime of has been captured up to that point to a disk file. This is day, evening or Saturdays. done automatically. Q. I bought DATA CAPTURE 3.0 and DATA CAPTURE 4.0 Q. Then what happens? sounds so good I want this version. What do I do to A. Control is returned to you and you can send the start upgrade? character to the other system. This generally requires A. Send us your original DATA CAPTURE 3.0 diskette and pressing any key, the RETURN key or a Control Q. documentation, the $35.00 price difference and $2.50 for Q. Are upper and lower case supported if I have a Lower postage and handling. We will send you DATA CAPTURE Case Adapter? 4.0 within 3 working days of receiving your order. A. Yes. If you don’t have the adapter an upper case only Q. What kind of support can I expect after I buy it? version is also provided on the diskette. A. If you have bought from Southeastern Software in the past Q. Do I need to have my printer card or Micromodem IP* you know we are always ready to answer any questions or Communications Card** In any special slot? about our products or how to use them. A. No. All this is taken care of when you first run a short program to configure DATA CAPTURE 4.0 to your system. Requires DISK II®, Applesoft ll« and 48K of Memory Then you don't have to be concerned with it again. If you move your cards around later you can reconfigure DATA CAPTURE 4.0. DATA CAPTURE 4.0© Q. Do I have to build a file on the other system to get K Copy righti'e. 1980-Southeastern Software sent to my Apple? A. No. If the other system can list it you can capture it. * Apple™, Apple II Plus™, Disk im and APPLESOFT I I * am trademarks o) Apple Q. How easy Is it to transmit text or data to another Compute* Company. system? ■ Micromodem IP» is a trademark of O.C. Hayes Asaoaataa, Inc. A. You can load the text or data into DATA CAPTURE 4.0 • Vmcalci.g<-Copynght by Software Ada. Inc. from the disk and transmit it. Or you can transmit what you have typed into DATA CAPTURE 4.0. Q. How can I be sure the other system receive* what I ■end it? A. If the other system works in Full Duplex, it ‘echoes' what laaaJ We welcome your personal you send it, then DATA CAPTURE 4.0 adjusts its sending check. We also accept Visa and Master Charge. speed to the other system and won’t send the next charac­ ter until it is sure the present one has been received. We call that 'Dynamic Sending Speed Adjustment'. Q. Whet if the other system works only in Half Duplex. Southeastern Software A. A different sending routine is provided for use with Half Duplex systems. O. What if I want to transmit a program to the other Dept. MK system? 6414 Derbyshire Drive • NewOrlear®, LA 70126 A. No problem. You make the program into a text file with a 504/246-8438 504/246-7937 program that is provided with DATA CAPTURE 4.0, load it into DATA CAPTURE 4.0 and transmit it.

MICRO-The 6502 Journal No. 36 - May The Present The new Apple HI and CBM pro­ ducts are definitely for the business­ Four years have witnessed the ex­ man, not the "hacker." These business plosion of the Apple n, the addition of users will require different levels of the AIM, SYM, Atari, OSI Superboard support than the current users. /AlCftO and Challenger systems, and the growth of the PET/CBM systems. Now Another group of users emerging is Editorial thousands of programs are available. the consumers—the home market. The The 6502 has moved from a poor third, Atari, VIC, and Intellivision are based behind the 8080 and 6800 in the per­ on pre-programmed packages which re­ sonal computing market, to a strong quire no user modification or program­ position ahead of both of these pro­ ming. Anyone can use them, instantly! cessors and equal to the Z80. Support The Changing Scene for the 6502 is much broader now. We have some ideas which will be There are many magazines devoted to implemented in MICRO over the com­ With this issue, MICRO completes the 6502 or one of its ; ing months. These include "bonus" its fourth volume. This fact inspired major microcomputer national maga­ sections providing focused coverage of me to spend some time reviewing zines now offer 6502-related material particular topics such as graphics, pro­ MICRO’S past, its position now, and its on a regular basis; book shelves are well gramming languages, games, printers, future. stocked with 6502 books. disk systems, art, business, education, and expanded coverage of the Apple, The Past The needs of today's 6502 users are PET/CBM, and other systems. We are changing. They are not buying a micro planning a MICROScan section which The microcomputer world of 1977 to get into microcomputers—they are will provide a systematic evaluation of was very different from today. The first buying micros to solve problems. To­ products within an area. We expect to wave of microcomputerists—the hard­ day's users are buying larger systems, cover the new microprocessors which ware types who could build a system and may require 80-character upper and may gradually supplant the 6502; as the from a kit or scratch—has started to lower case displays, quality keyboards, processors change, our readers will be decline in numbers and in importance. sophisticated disk systems, printers kept informed. A second generation has emerged, com­ and more. They need ready-to-use soft­ posed of individuals with computer ware, and are willing to pay for it. knowledge who are not interested in I am sure there are many other areas building a microcomputer. Early pur­ To serve this expanded 6502 in which MICRO can help serve its chasers of the 6502 were true pioneers. population, MICRO has made many readers. The staff of MICRO is very in­ There was no certainty that the new changes over the years, including the terested in hearing from you. Please 6502 would survive in the already addition of news and idea columns. write and let us know about your in­ established 8080/6800 world. There MICRO now includes articles which terests, how your use of the micro­ was little vendor support for the 6502, are less technical in nature, plus computer is cnanging, and how we at no books, and mysteriously little generalized material applicable to a MICRO can continue to support your material appearing about it in national number of microcomputers. efforts. computer magazines. MICRO was started to provide a for­ mal, regular publication with provision The Future for quality 6502-based advertising. Early MICRO articles- discussed prob­ The microcomputer market will lems encountered in getting systems to continue to change. Manufacturers are operate, and presented new 6502-based aiming many new products at the Robert M. Tripp products. MICRO was aimed at the business market and microcomputers Editor/Publisher knowledgeable user who possessed are now regularly advertised on the some programming skills, but might be financial pages of major newspapers a novice in the microcomputer field. and are featured in radio promotions.

About the Cover Infoimation Retrieval categories which he does not wish to select by entering a question mark. He could fur­ The cover depicts an information retrieval ther select the fields of each record by speci­ application in which a photographer with a fying key words which are to be matched collection of many photographs needs to once a record has passed the basic FLAG PHOTO LIBRARY CATALOG select a subset of particular categories. tests. The tests can be combined and can be These could include black and white or col­ FLAGS: C ? ? 0 78 81 as complex as necessary. SUBJECT: TRAVEL. HISTORIC/ TRAINS. or; a slide, negative, print or other; where it had been previously published; etc. Does this all sound very difficult? Not at DESCRIPTIW PHOTO * BY DATE FORMAT Categories dealing with subject matter all. A system with all of these features, and SANTA FE A-6502-1 LW 3/12/79 35M1 could be broken down to include more, was implemented on a KIM-1 with LITTLETCN W A-6502-Z LW 8/20/78 35m MT. RUSHM0RE B-6502-8 GF 5/09/80 35MM indoor/outdoor, people/scenic, day/night, IK of RAM. It provided six tests on the RIVERB0AT K-6502-5 MR 9/19/79 35W1 and others. A data base would consist of in­ FLAGS and one test on each of six data BIG SUR N-6502-3 MG 5/31/80 35M1 MN. TlOTO S-S809-7 HH 1/17/71 3X4 dividual records with FLAGS and a portion fields in the record. It provided up to 900 IC CHIP 1-6809-2 MT 12/12/72 4X5 which would contain other information entries on a single 30-minute cassette tape. WASHINGTON DC 1-1234-5 MT 11/11/77 3X4 CHELMSFORD MA 1-1234-7 MT 5/05/77 4X5 about the photo for sorting purposes. For ex­ The information retrieval process can be ample, the photographer could request applied to almost any data base. photos which are in color (C), scenic (S), outdoor (O), and so forth, skipping (Photo by Loren Wright.)

No. 3 6 -M a y 1981 MICRO-The 6502 Journal 5 I think the Apple is the best small computers, that is—should be 6502-based micro on the market, useful for something, and we really (that's why I bought itj, and I think it is ought to be able to help the small natural for it to receive extraordinary businessman drop $5,000 or $10,000 on /AlCftO coverage. Also, I still enjoy, and learn, small computer hardware and a like from the hardware articles which amount on software.) What we want to Letterbox appear in MICRO (such as Marvin read about is systems software, and Dejong's article on the 6522), and if FORTH, and UNIX, and C, and bubble you were to publish a separate memories, and Winchester disk drives magazine only on the Apple, I probably that cost less than $500, and color MICRO’S February editorial, “Too would subscribe to it, but would drop graphics systems, and music syn­ Many Apples!” brought us a flood ofMICRO, and would miss the 'hardware thesizers, and Dragons and Dungeons, responses. Here are just a few of the let­ stuff.' Since MICRO is the 6502 jour­ and Ethernet, and good text editors, ters offering comments and suggestions nal, it would be a shame to divide it in­ and material like that. on our Apple backlog problem. to a lesser pair of magazines. John P. Sohl Keep up the good work on MICRO, 20446 Orey Place Dear Editor: and don't be afraid to 'overload' with Canoga Park, California 91306 Apple stuff—there are a lot of Apples In regard to the editorial "Too out here! Many Apples!" my solicited comment as an avid reader of your magazine is Edward Janeczek Dear Editor: this: as an amateur futurologist, I 6121 Carnation Road predict your editorial of February 1983 Dayton, Ohio 45449 You backed me into a comer. When will be entitled: "Too Many PETs!" I looked toward the right, I saw the en­ ticement to renew for another year at It appears to me possible that the Dear Editor: the $15 rate. When I looked toward the $299 VIC 20 by Commodore may have left, I saw an ever-expanding Apple sold well over a million units by that I have been an avid reader of orchard. date and you will have an unwieldy ex­ MICRO since Issue #7, and it has never cess of good articles on this machine! been better than it is today. I'd like to I'm a single board man. I have a congratulate you on the vastly improved KIM and an AIM. I enjoy that level of George Earl appearance of the magazine. The typo­ computing. I'm not ignorant of the 1302 South General McMullen graphy is far better than it used to be capabilities of a larger system—I also San Antonio, Texas 78237 before last December. have a TRS-80 Level II. I get my satisfaction out of making a $200 KIM I own an Ohio Scientific C1P, and Ido the same things a $2000 Apple can was interested in your February do (almost!). Dear Editor: editorial about your surfeit of Apple articles. One of the reasons I like In your editorial, you asked for I have been reading and enjoying MICRO so well is that there are a opinions. I look to MICRO for ASK MICRO for several years, and have all number of articles every month that I articles. I've been with you since Issue the issues since the beginning. I have can use with my own computer. I #1. I've seen the larger systems come seen the magazine grow in size and would hate to see MICRO become down in price and increase in popu­ quality, and consider it my favorite of devoted entirely to the members of the larity. The days of every computer hob­ several magazines I read regularly. Apple corps. Still, I have always felt byist knowing what a KIM is are gone. more of a kinship to the Apple and KIM This letter is in response to your owners than to the PET owners, who Those days are gone, but your editorial, "Too Many Apples!” My first seem to dominate other magazines. readers, like myself, are not. I don't ask microcomputer was an AIM-65, and I for 100% ASK articles—that would be enjoyed reading MICRO, because it So what should MICRO do? Hard­unrealistic. What I do ask is that you didn’t ignore the board level computer. ware is interesting, particularly general keep the same carefully planned Now I have an Apple n, and I can ap­ purpose "how I connected a DAC to balance that you struck in Issue 33. If preciate your concern about giving my 6522" material. General short 6502 you find yourself overloaded with ex­ equal coverage to all the 6502-based software ("how to convert ASCII to cellent Apple articles, by all means, systems. EBCDIC in seven bytes of code") is publish them. But, go with the Apple usually interesting, but you shouldn't supplement idea—that looks best to Of the six options suggested in the include any listings that are more than me. This assumes that others, like editorial, allocating a larger portion of a page. Avoid "POKE 67 into location myself, will continue to keep you fed MICRO to Apple, I believe, is fair since $E5 on your Apple and see what hap­ with good articles on the various other it is the most popular 6502-based pens!" articles. Don't assume that systems. If that fails, you have no computer, and by your own admission, everyone has dual disk drives and a choice other than to become the has the most articles available. The Diablo printer. Avoid large turn-key II MICRO Apple." addition of 16 to 32 extra pages is type software for specific systems. something which is inevitable, if the (Nobody out here really cares about fody Nelis past growth of MICRO is any small business software, you know. 132 Autumn Drive indication. Some people think that computers— Trafford, Pennsylvania 15085

(Continued on page 16)

6 M ICRO-The 6502 Journal No. 3 6 -M a y 1981 1

W\R- ^ presents our valuable free catalog (over 100 pages). He prompts you to peek at the latest collection of software and hardware products for your APPLE ll™

VERSA WRITER II A draw ing tablet, A STELLAR TREK simply plugs into your game I/O port. Trace, draw, th e definitive Hi-Res design, or color any type of color version of th e classic graphic. Adds words to Startrek gam e. Three pictures. Creates schematics. different Klingon opponents. Computes Distance/Area of any Many command prerogatives figure. New - fill any area fro m use o f weapons to on the screen in seconds with repair of damages. Needs over 100 d iffe re n t and 48K Applesoft ROM. distinct colors. Needs 32K Disk... $24.95 Applesoft ROM and disk drive. A bargain at... $249.95

SUPER SOUND BOWLING DATA Musical rhythms, SYSTEM gunshots, sirens, laser blasts, This data m angem ent explosions... add these and program provides accurate many m o re exciting record keeping and report sounds to your Apple, use generation for bowling leagues th em in your programs, of up to 40 teams with or create your own 6 bowlers per team. SUPER SOUNDS. Needs Needs 80-column printer, 16K Applesoft. 32K Applesoft ROM. Have a blast for only D isk...$79.95 $12.95... Tape $16.95... Disk

ADD $2.00 U.S. S10.00 FOREIGN FOR SHIPPING CALIFORNIA RESIDENTS ADD. 6% SALES TAX Open Tues. - Sun. Don’t see what you want here, then write or call today for your free catalog, we're saving one just for you. CARDEN PLAZA SHOPPING CENTER 9719 RESEDA BOULEVARD DEPT. 1MI NORTH RIDGE, CALIFORNIA 91324 Visa/Mastercharge welcome. PHONE (213) 349-0300

No. 3 6 -M a y 1981 MICRO-The 6502 Journal 7 ARE YOU DEVELOPING SHIFT KEY SCHIZOPHRENIA?

Cure it with the lower case system from M&ZQF, GYGTCMG )

The Keyoard +Plus from Lazer Microsystems turns Best of all, the keyboard + Plus features a P.O.Box 55518 your Apple's shift key into a . . . shift key! typeahead buffer that gives you the ability to Riverside, Calif. 92517 The Keyboard +Plus transforms your Apple's continue typing even though the computer is busy (714) 682-5268 upper case only keyboard into a typewriter style performing other tasks such as accessing the disk. keyboard capable of entering all 128 ASCII The keyboard +Plus is the second component of * Keyboard +Plus $119.95 characters into your DOS, Pascal, and CP/M Lazer Microsystems' lower case system. When teamed applications programs. The use of the shift key is with the Lazer Microsystems' highly praised Lower * Lower Case 4Plus *69.95 automatic with most programs. You do not have to Case +Plus, the lower case system turns your Apple write complicated "driver programs" or fuss with into a sophisticated, user oriented, problem obscure "BIOS Batches" in order to fully utilize solving machine. * ?a U £ ' residents add 6% tax. this board. For those situations where upper case See the Lazer Microsystems' lower case system Shippinga-S’A- t extra add handling » 5-°° f°' only input is desired, the Keyboard +Plus supports at your local Apple dealer. If he is all out, you a caps lock mode that returns the Apple keyboard can order direct from us. fi extra foc checks to it's former state. * Hr/Sic?1' (Personal i business) eccepted. include card number, exp date, and signature. Lower Case +Plus, Keyboard +Plus and +pius are all trademarks of Lazer Microsystems Inc.

8 MICRO - The 6502 Journal No. 3 6 -M a y 1981 MacApple

This routine allows substitution How It Works back arrows, controls U and H, were of unreserved control keys as also left alone. The other reserved con­ shorthand for commonly used The table contains the ASCII values trol characters, B, C, D, and X, aren’t Integer BASIC commands. Since of the keywords. The end of an entry is essential, but I left them alone, giving It is table driven, extension to signalled with a null character ($80). the user the option to do as he wishes. Applesoft or machine language With a range of 26 letters, eight Once you're in BASIC, control-B isn’t characters per letter seemed like a good is possible. needed. Control-C can be replaced with amount of storage. The CALL 4383 a JSR from the monitor. Its other func­ changes the pointers at $38,$39, caus­ tion, stopping a program, can be re­ ing the monitor to go to MacApple placed with a brute-force RESET, instead of the normal KEYIN routine. though you lose the ability to see where David Lubar At the start of MacApple, the KEYIN the program stopped. Control-D is left 249 Loring Ave., Apt. 3 routine is duplicated in part, without free for disk users. Instead of control-X, Edison, New Jersey 08817 the portion that increments the ran­ you can cancel a line by adding a syntax dom number. If the ASCII value of the error. character entered is less than $9B, it is a control character. Other characters You can check for these reserved The program “Applesoft Shorthand" are sent back to KEYIN at the point characters by the series of CMP's and (23:5) was impressive. Here was a way where the strobe is reset. From there, BEQ's. The checks are written in to shorten those long hours spent they follow the normal path into the ascending order. The program can be thrusting two fingers at the keyboard. I buffer and onto the screen. speeded up (for those of you who can had several long programs to enter the count microseconds) by placing the other night, but they were in Integer most common ones (controls M, H, BASIC. This left two choices; wait un­ For control characters, a check has and UJ at the top of the series. til MICRO published what I needed, or to be made. Certain of these characters write it myself. I took the second op­ should be left alone. For example, Once an input passes this far, the tion. The program (minus the one bug control-M is the carriage return. This, heart of the program goes into action. which kept me up until 6:30 a.m. on a obviously, is needed. The front and First, the ASCII value is reduced from a bleary Sunday) is described in the following article. Since I didn't have the locations of Integer's keywords, I Table 1 took another approach, making a table from which the keywords are printed. Control Key Result Control Key Result While this lengthens the program, it A ASC("N NEXT also gives the program multilingual B reserved O COLOR5 potential—by changing the table, you C reserved P PRINT can use it with Applesoft or even D reserved Q PLOT assembly language. E PEEK R RETURN F POKE S SCRN( Using MacApple G GOTO T THEN H reserved U reserved MacApple loads from $1000.$1131. I INPUT V VLIN The table goes up to $10CF followed by J GOSUB W HLIN a $62 byte program. Turn it on with a K CALL X reserved CALL 4383, off with a CALL 4393. L LEN( Y REM Once MacApple is turned on, any con­ M reserved Z DIM trol key which is not reserved will pro­ duce a keyword. Using the $1000 area Note: Though not all keywords could be paired with their initial letter, an allows the program to lie between a attempt was made to produce a meaningful relation. For example, to remember BASIC program and the variable table. that f produces GOSUB, just think of GOSUB as JSR. Pairs were placed This way, you can leave it in memory together when possible (\TJN, HLIN and PEEK, POKE). while entering and modifying BASIC programs.

No. 36 - May 1981 MICRO - The 6502 Journal 9 range of $81-$9A to a range of $00-$19. Next, this value is multiplied by 8 with three ASL's. These steps result in a pointer to the character table. The pointer is put into the Y register. The A 08 0 0 ******************* register is loaded with DATA, Y, getting 0 8 0 0 ; * * the first character for the desired 0 8 0 0 , * M A C A P P L E * 0 8 0 0 ?* B Y DAVID LUBAR * keyword. This character is compared to 0 8 0 0 .. * * $80. If it isn't $80, the character is 08 0 0 ******************* 08.00 . * stored in the input buffer and sent to 0 8 0 0 . * the screen through the COUT1 routine 08 0 0 CH EPZ $24 080 0 BASL EPZ $28 in the monitor |FDF0). 0 8 0 0 KSWL EPZ $38 0 8 0 0 KSWH EPZ $39 0 8 0 0 IN E Q U $20 0 Note: No check is made to see if the 0 8 0 0 DATA E Q U $ 1 0 0 0 buffer has been filled. If a keyword puts 0 8 0 0 K B D E Q U $ C 0 0 0 080 0 STROBE EQU $C010 the buffer count too high, it will do a 08 0 0 KE Y 1 E Q U $ F D 2 B hatchet job on the line and begin filling 08 0 0 C O U T 1 E Q U $ F D F 0 08 0 0 the buffer from the start. Just keep this 080 0 . limitation in mind and there will be no 10D 0 O R G $ 1 0 D O 10 D 0 O B J $80 0 problems. 10D0 lODO •DATA GO FROM $1000-$10CF 10 D O 10 D 0 2 C 0 0 C 0 START B I T K B D ;K E Y D O W N ? 10D3 10 F B B P L S T A R T ;NO After this, Y is incremented to point 10 D 5 91 2 8 STA (BASL), Y ;YES. REPLACE CURSOR to the next character in the table, and X 10 D 7 A D O O C O LDA K B D /GET CHARACTER is incremented to point to the next 10 D A C 9 9 B CMP #$9B /CONTROL CHARACTER? 10 D C 90 0 3 BCC MAIN ; YES location in the buffer. Once the 10 D E 4 C 2 B F D BACK J M P KE Y 1 /NO. OUTPUT IT keyword has been output, there is an 10E1C982 MAIN C M P #$ 8 2 /CONTROL-B? 1 0 E 3 F 0 F 9 BEQ BACK ; YES $80 in the A register. It might seem 1 0 E 5 C 9 8 3 C M P <$ 8 3 ;CONTROL-C? that there would be no harm in sending 1 0 E 7 F 0 F 5 B E Q B A C K 10 E 9 C 9 8 4 C M P #$84 ?CONTROL-D? this null character out. In most cases, 10 E B F0F 1 B E Q B A C K this is true. But it could cause prob­ 1 0 E D C 9 8 8 C M P #$88 ,-CONTROL-H? 1 0 E F F 0 E D B E Q B A C K lems. For example, the ASC function 10F1 C 9 8 D C M P #$ 8 D /CONTROL-M? returns the value of the first character 10 F 3 F 0 E 9 B E Q B A C K 10 F 5 C 9 9 5 C M P #$ 9 5 ;CONTRQL-U? after the quote. If $80 is sent out, it 10 F 7 F 0 E 5 B E Q B A C K won't be on the screen, but it will 10 F 9 C9 9 8 C M P #$98 /CONTROL-X? 1 0 F B F0E 1 B E Q B A C K become the argument for the ASC func­ 1 0 F D 38 S E C /REDUCE VALUE TO A RANGE tion. No matter what letter follows, 1 0 F E E981 S B C #$81 t OF $00-$19 BASIC will return a decimal value of 1100 0A ASL /MULTIPLY BY 8 1101 0A ASL 128. To avoid this, the routine clears 110 2 0A ASL the strobe, resets the cursor, and goes 1103 A8 TAY 1104 B 9 0 0 1 0 LOOP LDA DATAfY ;GET TABLE ENTRY back for the next input. If the cursor 1107 C 9 8 0 CMP #$80 jEND OF ENTRY isn’t reset with LDY 24, strange things 110 9 F 0 0 B B E Q B A C K 1 ; YES H O B 9 D 0 0 0 2 S T A IN $X jNO. PUT CHARACTER IN BUFFER happen. Try deleting this command. 110 E 2 0 F 0 F D J S R C 0 U T 1 /PRINT CHARACTER Then, in BASIC with MacApple turned 1111 E8 INX ; INC BUFFER POINTER 1112 C8 INY /INC TABLE POINTER on, enter the control keys for PRINT 111 3 4C 0 4 1 1 J M P L O O P ;DO IT AGAIN followed by ASC(''. (Control-P, 1116 2C10C0 BACK1 BIT STROBE /CLEAR KEYBOARD STROBE 111 9 A 4 2 4 L D Y C H /RESET CURSOR VALUE control-A.) The next key entered will 111B 4 C D 0 1 0 J M P S T A R T /CURE FOR DEAD BATTERIES?! cause the T in PRINT to turn into a @ . 111 E EA NOP /EXTRA BYTE SO CALL FROM BASIC 111F /WILL BE AN EASY NUMBER 111F ;TO REMEMBER The Table 11 1 F 1 * 1 1 1 F ; * 1 1 1 F ;CALLS FROM BASIC ENTER HERE Changing the keywords, either for 1 1 1 F J* Integer or for other languages, is sim­ 1 1 1 F A 9 D 0 ON LDA # S T A R T /SET VALUES FOR INDIRECT JUMP 1121 85 3 8 S T A K S W L ple. You can either step through the 1123 A 9 1 0 LDA / S T A R T monitor or go directly to an entry. To 112 5 85 3 9 ST A K S W H 112 7 60 RTS step through the monitor, enter FFF 1128 EA NOP /ANOTHER FILLER BYTE and hit RETURN. Hitting RETURN 112 9 A 9 1 B OFF LDA #$ 1 B 112 B 85 3 8 ST A K S W L again will cause a list of bytes 112 D A 9 F D LD A # $ F D $1000-$1007. These locations contain 112 F 8 5 3 9 S T A K S W H the keyword printed by control-A. Each 1131 60 RTS RETURN will advance to the next let­ ter, up to $10C8-$10CF, which is the location for control-Z. If you don't feel like stepping through, the monitor, use the following method. Take the letter

MICRO - The 6502 Journal 10 No. 3 6 -M a y 1981 you want and subtract 1 from its loca­ tion in the alphabet. Then multiply Table 2: Keyword table. this by 8. Add this, in hex, to $1000. (Congratulations, you have just per­ formed a machine-language subroutine in your head.) That value gives the start A 1000 — Cl D3 C3 A8 A2 80 50 50 of the table for the desired letter. B 1008 — 80 50 50 50 50 50 50 50

Once you've found the starting C 1010 — 80 50 50 50 50 50 50 50 point, enter the ASCII values for the D 1018 — 80 50 50 50 50 50 50 50 desired keyword, followed by an $80. If E 1020 — DO C5 C5 CB 80 50 50 50 you don’t have an ASCII table, use the ASC function from BASIC, then con­ F 1028 — DO CF CB C5 80 50 50 50 vert the number to hex. For those of G 1030 — C7 CF D4 CF 80 50 50 50 you who are lazy, I've included an Integer BASIC program which con­ H 1038 — 80 50 50 50 50 50 50 50 structs keyword tables in listing 1. I 1040 — C9 CE DO D5 D4 80 50 50 While the op codes for assembly I 1048 — C7 CF D3 D5 C2 80 50 50 language are only three letters long, K 1050 — C3 C l CC CC 80 50 50 50 you could save some typing by putting together a table which included the L 1058 — cc: C5 CE A8 80 50 50 50 leading and trailing spaces and other M 1060 — 80 50 50 50 50 50 50 50 special characters. For example, — CE D8 D4 80 50 50 50 (space)LDA(space)#, for immediate N 1068 C5 commands could be printed with one O 1070 — C3 CF CC CF D2 BD 80 50 control character. P 1078 _ DO D2 C9 CE D4 80 50 50 Modifications Q 1080 — DCI CC CF D4 80 50 50 50 R 1088 — D2 C5 D4 D5 D2 CE 80 50 Relocating the program isn't dif­ ficult. Only a few changes are needed. S 1090 — D3 C3 D2 CE A8 80 50 50 The JMP LOOP and JMP START are the T 1098 — D4 C8 C5 CE 80 50 50 50 only jumps which refer to the program. The value of DATA would have to be U 10A0 — 80 50 50 50 50 50 50 50 changed, as would the values set by the V 10A8 — D6 CC C9 CE 80 50 50 50 ON portion. W 10B0 — C8 CC C9 CE 80 50 50 50 Final Notes X 10B8 — 80 50 50 50 50 50 50 50 Y 10C0 — D2 C5 CD 80 50 50 50 50 The pointers to the KEYIN routine cannot be reset in the direct mode. Sup­ Z 10C8 — C4 C9 CD 80 50 50 50 50 pose, for example, you change the lo byte with POKE 56,NN. So far, there is no problem. But as soon as you hit RETURN, the monitor will go to the in­ put routine. When it hits the indirect jump to KEYIN, it will find a value with a new lo byte and an old hi byte. Unless you are incredibly lucky, this new value will not be one which has 10 DIM A$ (26) ,B$ (10) anything to do with input. To see this 20 A$="ABCDEFGHIJKLMNOPQRSTUVWXYZ" in action, enter POKE 56,7. (You can 30 FOR 1=0 TO 25 reset the pointers with a line from 40 PRINT "ENTER KEYWORD FOR CONTROL ";A$(1+1,1+1) BASIC since the monitor won’t look for input during execution. ] 50 INPUT B$ 60 IF LEN(B$)>7 THEN 40 Disk users will have to add a CALL 70 FOR J=0 TO LEN(B$)-1 1002 after turning MacApple on or off. 80 IF LEN(B$)<1 THEN 110 90 POKE 4096+8*I+J, ASC(B$ (J+l, J+l)) Finally, if you use the front or back 100 NEXT J arrow immediately after a keyword, a @ will appear on the screen. This can 110 POKE 4096+8*1+1,128 be removed with the space bar. 120 NEXT I: PRINT "DONE": END

I hope this program will save you some time and effort. JMCftO

No. 36 - May 1981 MICRO - The 6502 Journal 11 M H. V '

D r. D oBB’S (OURNALof COMPUTER (_>alisthenics Orthodontia Running Light Without Overbyte

Twelve Times Per Year $21/1 Year — $39/2 Years

Recent issues have included:

ZX65: Simulating a Micro

EXOS-6500 Software Development Tool Kit

6502 Assembler—Pet 8K-32K

A Note on 6502 Indirect Addressing

The C Programming Language

What you see is what you get.

To subscribe, send your name and address to Dr. D obb’s Journal, Department V4, Post Office Box E, Menlo Park, CA 94025. We'll bill you.

12 MICRO - The 6502 Journal No. 3 6 -M a y 1981 KIM/SYM Home Accounting System

This program illustrates a very Table 1: Keyboard Commands (# = any decimal number 0-9) simple and basic application for a personal computer in the Input Operation/Display home that requires a minimum ##A Set account number '##' of hardware to implement. Display reads ‘AAAA ##' (no input) A Display current account number. Display reads 'AAAA ##’ Robert Baker 15 Windsor Drive (no input) + Increment account number & display new number. Atco, New Jersey 08004 If at last account "wrap” to account #0. Display reads 'AAAA ##' This article was originally written for B (any time) Display balance of current account. the KIM but will also run on the SYM Display reads '#### ##’ with the included routines. #### ##C Credit current account & display new balance. After acquiring a KIM-1 micro­ Display reads '#### ##' computer, this simple program was #### ##D Debit current account & display new balance. written to help justify its existence in Display reads '######' our home. The program was designed to do the bookkeeping for our family If current balance is less than amount to be deducted, item budget but could easily be used for will be disregarded and display will read 'EEEE EE' many other applications.

My goal was to write a program that 0800 0800 * * would not require any additional hard­ oeoo * KIM + 1 - ? * ware besides the very basic system 0800 * • containing a KIM-1 module, power 0800 * B Y FCBFFT RAKEF * 0800 * * supply, and cassette recorder. Thus, 0800 the program uses the on-board 0800 * keyboard for all input, and the 0800 * 7-segment displays for all output by 0800 It3H EPZ $F9 ;LSD 7-SEOlFNT DISPLAY 0800 POINTL EPZ $FA ;MIDDLE 2 DIGITS IN DISPLAY means of two of the monitor sub­ 0800 POINTHEPZ ?FB ;MSD IN DISPLAY routines in ROM. The positioning of 0800 SCANDS EQ U $1F1F ;SCAN DIGITS DISPLAY & LOCK FOR INPUT the 7-segment displays makes them 0800 GETKEY EQ U $1F6A ;READ KEYBOARD INPUT 0800 • ideal for displaying monetary values 0800 PTR EPZ $00 rTARLF POINTER with a small space between the 0800 AOCT EPZ $01 .•CURRENT AOCT t "dollars” digits and the "cents" digits, 0800 INFLG EPZ $02 ;INPUT FLAG but the program can also be used for 0800 WOW. EPZ $03 ; WORKING STORAGE 0000 various other applications, such as a 0200 ORG $200 parts inventory. 0200 ; 0200 OBJ $800 0200 A900 START LDA #$00 ;IMIT ACCT# = 0 The program itself resides in page 2 0202 85F9 SETA STA O T ;SFT AOCT# (Loc. 0200-02FF) of RAM and uses the 0204 8501 STA AOCT first locations of page zero for working 0206 29F0 SFTPTF AND #$F0 ;SFT POINTER - storage as shown in the program 0208 4A LSR rCCNVERT ACCT# 0209 4A LSR ; TO BINARY & listing. Page 3 (Loc. 0300-03FF] of RAM 020A 8503 STA WORK .•MULTIPLY BY 3 is used to store the balances of each 020C 4A LSR account with three bytes per account. 020D 8500 STA PTR 020F A501 LEA A CCT The first three locations of page 3 are 0211 38. SPC reserved for account #0 which is the 0212 E503 SPC WORK overall total of all existing accounts. 0214 F500 SEC PTR The remaining space of page 3 may be

No. 36 - May 1981 MICRO - The 6502 Journal 13 used as required for up to 84 individual accounts. The maximum number of 0216 8500 STA PTR accounts is determined by the value in 0218 0A ASL location 02BA, which should be one 0219 6500 aex: PTR 021B 8500 STA PTR greater (decimal) than the highest 021D A9AA LDA #$AA ;DISPLAY A’S account number desired. 021F 85FA CHRS STA POINTL rLOAD DISPLAY SPECIAL CHARACTERS 0221 85FB STA POINTH 0223 A901 CLFLG LTA #$01 ; CLEAR INPUT FLAG 0225 8502 STA INFLG After hand-loading the program the 0227 201F1F DSPLY JSR SCANTS ; DISPLAY DATA 022A ;POR SYM, SUBSTITUTE CODE AT $106 first time, be sure to clear all locations 022A DOFB BNE DSPLY of page 3 that are to be used for storage 022C 201F1F INFT JSR SCANES ;WAIT F OR INPUT of the account balances (Loc. 0300 to 022F ;FOR SYM, SUBSTITUTE CODE AT $106 0302 + (3 * #accounts) ). Also, don't 022F FOFB BEQ INPT 0231 206A1F JSR GETKEY ,-RFAD KEY forget to set the highest account 0234 ;P0F. SYM, SUBSTITUTF OODF AT $133 number plus one in location 02BA. The 0234 C90A CMP #$0A ; DIGIT? locations on page zero are initialized 0236 1018 BPL CNTL ; BRANCH IF CONTROL KEY 0238 A004 LDY #$04 ;SET NORMAL SHIFT COUNT by the program so there is no need to 023A C602 DEC INFLG ,-FIRST INPUT? set (or save) these. 023C C002 BNE SHFT 023E A018 U3Y #$18 ;YES, SE T SHIFT COUNT T O CL,FAR DISPLAY 0240 06F9 SHFT AS L INH ; SHIFT DIGITS 0242 26FA RCL POINTL 0244 26FB ROL POINTH When you are ready to run, load 0246 88 DFY address 0200 and depress "G O ” . The 0247 D0F7 BNE SHFT display should read ‘AAAA 00' to 0249 45F9 EOR INH ;ADD NEW DIGIT 024B 85F9 STA INH ; TO DISPLAY REGISTER indicate proper initialization with the 024D 4C2702 JMP DSPLY ;GET NEXT KEY current account number equated to 0250 C90B CNTL CMP #$0B ,-WANT BALANCE? zero. You're now ready to use the pro­ 0252 E00F BNF INCHK gram as desired. Table 1 gives a 0254 A400 BAL LD Y PTR rYES, GFT POINTER 0256 A202 LDX #$02 complete description of each of the 0258 B90203 MBAL LDA TBLH,Y ;M0VF BALANCE keyboard controls; keys 0-9 are used for 025B 95F9 STA INH,X ; TO DISPLAY input values and keys A,B,C,D, and + 025C 88 DEY 025E CA DEX are used for control. 025F 10F7 BPL MBAL 0261 D0C0 LINK BNE CLFLG ;CLFAR FLAG & WAIT 0263 C602 INCHK DEC INFLG ;ANY INPOT? 0265 F03E BED G ETA 0267 C9GA CMP #$0A ;YES, NE W ACCT# Each time a value is added to 0269 D004 EKE CRDT (credit) or subtract from (debit) an 026B A5F9 LDA INH ,-YFS, GE T NF W # individual account, it is also added/ 026D-104A BPL CHKA ;CHECK IT 026F A000 CRDT L D Y #$00 subtracted to account #0 to keep a run­ 0271 C400 CPY PTR rACCT #0? ning total of all account balances. This 0273 F0B2 BID DSPLY ;ERROR, CANNOT CR/DB ACCT #0 provides a simple method of comparing 0275 C90C CMP #$0C ; CREDIT ACCOUNT? 0277 D00A BNE DBT your checking and savings accounts 0279 20C002 JSR ADD ;YES, ADD TO ACCOUNT 0 with your budget balance. To keep 027C A400 L D Y PTR account #0 valid, the program will not 027E 20C002 JS R AD D ;ADD TO ACCOUNT allow you to credit/debit account #0 0281 F0D1 BEQ BAL ,-SHCW BALANCE 0283 C90D DBT CMP #$0D ; DEBIT ACCOUNT? directly. Also, if you try to debit an 0285 POAO BNE DSPLY ;NO, DISCARD KEY account with an amount greater than 0287 20C902 JSR SUB ;YES, SUB FRCM ACCOUNT #0 its current balance, the entry will be 028A BOOB BCS DBC5C ; NEGATIVE RESULT? 028C A000 DBFRR LTY #$00 ;YES, A D D # BACK disregarded and the display will read 028E 20C002 JS R AD D 'EEEE EE' to indicate the error. 0291 A9EE LTA #$EF ;PUT E'S I N DISPLAY 0293 85F9 STA INH 0295 C088 BNE CHRS ;SH0W ERROR (EEEE EE) 0297 M O O EBOK L T Y PTR 0299 20C902 J S R SUB ;SUB F RC M ACCOUNT 029C B0B6 BCS BAL ;SH0W BALANCE IF O.K. 029E A400 L D Y PTR ;ADD # BACK IF ERROR After each session of running the 02A0 20C002 J S R ADD program simply store the program on 02A3 F0E7 BED DBERR ;ADD BACK TO ACCT 0 & SHCW ERROR cassette following the standard pro­ 02A5 C9QA GETA CMP #$0A j DISPLAY ACCOUNT #? BN E NEKA cedures, locations 0200 to (0302 + (3 * 02A7 D005 02A9 A501 LDA ACCT ;YES, GET #? ^accounts) ). This will save the current 02AB 4C0202 SHCWA JM P SETA ;SH3W IT account balances plus the program 02AE C912 NEWA CMP #$12 ;INC ACCOUNT #? itself. Then, the next time you want to 02B0 D0AF BNE LINK ;NO, CLEAR INPUT FLAG & WAIT 02B2 A501 LDA ACCT ;YES, G ET ACCOUNT # run the program, simply load from 02B4 F8 SEE ;GO T O DECIMAL MDDE cassette and start at location 0200. 02B5 18 CLC ,-CLEAR CARRY Alternately, you can save pages 2 and 3 02B6 6901 ADC #$01 ;itc # CLD ■BACK TO BINARY MODE separately to conserve space on 02B8 D8 02B9 C9 CHKA EOT $C9 ;'CMP'--CHECK ACCOUNT # cassette, or to allow more program 02 B A 00 BYT $00 ;LAST ACOOUNT #1 + 1 GOES HERE flexibility for specific applications. 02BB ’

MICRO - The 6502 Journal No. 3 6 -M a y 1981 14 Charge MICRO 02BB 02BB 3 OIIE BMI SHCWA ;O.K., SHOW IT and MICRO Books! 02BD 4C0002 JM P START ;SET T O 0 IF T O O LARGE 02C0 02CX) • ADD/SUBTRACT ROUTINE 02C0 MICRO now accepts 02C0 A918 ADD ITR #$18 ; 'CLC'-SET INSTR FOR ADD MDDE VISA and Mastercard. 02C2 8DEA02 STA INSTRl 02C5 A 975 LDA #$75 r'ADC' Credit card holders 02C7 D007 EKE b'i'INST 02C9 A 938 SUB UA #$38 ;SET INSTR FOR SUB MODE around the world can 02CB 8DCA02 ST A DJSTR1 02CE A9F5 LCft #$F5 now order subscriptions 02D0 8DEE02 STINST STA HJSTR2 02D3 A203 U K #$03 ;SET LOOP COUNT and books by phone or 02D5 8603 STX WDFK mail. 02D7 A200 U X #$00 ;SBT INDEX X 02D9 re SET .•DECIMAL MODE 02DA 38 INSTRl SBC ; CLEAR/SET CARRY 02DB B90003 MATO IDA TBLL.Y • GET DIGITS Call (617) 256-5515 02DE F5F9 INSTR2 SBC IJW.X .•ADD/SUBTRACT between 9:00 A.M. and 02E0 990003 THT.L.Y ? STORE RESULT 02E3 E8 h k ,-INC INDEX REGISTERS 5:00 P.M. and say 02E4 C8 INY 02E5 C603 DEC WDFK ;DEC LOOP COUNT “Charge it!” 02E7 D0F2 EKE MATH .•CONTINUE 02E9 D8 rr.n ; RESET BINAKY MODE 02EA 60 RTS .•RETURN 02EB Or mail your order with 02EB •BEGINNING CF ACCOUNT DATA (3 BYTES/ACOOUOT) your credit card name, 02EB .•MAXIMUM CF 84 INDIVIDUAL ACCOUNTS + ACCOUNT #0 02EB number, and expiration 0300 ORG $300 0300 OBJ $800 date to: 0300 • 0300 00 TOLL BYT $00 ; ACCOUNT 0 —LSD 0301 00 BYT $00 0302 00 TBLH BYT $00 ; ACCOUNT 0 — MS D Order Department 0303 ; MICRO 0303 00 BYT $00 .•ACCOUNT 1 --LSD 0304 00 BYT $00 P.O. Box 6502 0305 00 BYT $00 ; ACCOUNT 1 —MSD 0306 Chelmsford, MA 0306 •AND S O O N..... 0306 01824

International Orders The following routines, provided by N ick Vrtis, originally appeared in his article “The First Book of KIM on a If you are outside the U.S., SYM” (MICRO 14:35) and reappeared you may pay by: in The Best of MICRO Volume 3. These routines allow you to use the program on a SYM. 1. VISA or Mastercard or 2. International Money Order 0800 0800 * * 0800 * SYM-1 VERSIONS OF * 0800 * VARIOUS KIM ROUTINES * We no longer accept bank 0800 * * 0800 * BY NICK VRTIS * drafts from foreign 0800 * * banks—even if the funds 0800 ************************ 0800 * are drawn on an account 0800 FOR FURTHER INFORMATION CONSULT THE 0800 ORIGINAL ARTICLE WHICH APPEARED IN: in a U.S. bank! The rising 0800 MICRO 14:35 0800 BEST OF M ICRO VOL. Ill P. 63 bank charges now make 0800 0800 ’RANSO EQU $0137 TRANSLATE TABLE LESS OFFSET $11 payment by this method 0800 PZSCR EPZ $FC RAGE ZERO SCRATCH LOCATION 0800 POINTH EPZ $FB EXECUTE RAM POINTER HIGH prohibitive. 0800 POINTL EPZ $FA EXECUTE RAM POINTER LOW 0800 INH EPZ $F9 TERMINAL CHARACTER INPUT 0800 SYMPAD EQU $A400 OUTPUT PORT A ON 6532 0800 SYMPBD EQU $A402 OUTPUT P ORT B ON 6532 0800 SYMDIS EQU $A640 DISPLAY BUFFER 0800 SYMSCA EQU $8906 LED OUTPUT DISPLAY BUFFER

No. 3 6 -M a y 1981 MICRO - The 6502 Journal 15 Letterbox (continued from page 6)

0800 STOREY EQU $8923 .-CHECK FOR A NY KEY DCWN Dear Editor: 0800 SYMLRN EQU $892C .-DETERMINE KEY PRESSED 0800 SYMSEG EQU $8C29 ;LED SECMENT CODES

I'm cheating, really... with regard to 0800 1 your "Too Many Apples!" editorial.... 0100 ORG $100 ;OUT OF THE WAY ON STACK PAGE 0100 OBJ $800 You asked for feedback from readers, 0100 and I'm not a regular MICRO reader. 0100 ;SYM-1 VERSION OF KIM SCAND & SCANDS ROUTINES

0100 f 0100 A000 SCAND LDY #$00 ; ENTER HERE TO GET BYTE I bought your February issue just for 0102 B1FA LDA (POINTL),Y .-ADDRESSED BY POINTL the “In the Heart of Applesoft” article. 0104 85F9 STA INH ;AND MOVE IT TO INH AREA

MICRO is a quality publication, but 0106 r there just isn't enough Apple-related 0106 A000 SCANDS LDY #$00 ; ENTER HERE IF INH ALREADY STORED 0108 A5FB LDA POINTH ; POINTH FIRST TO DISPLAY BUFFER material to justify my subscribing. 010A 201A01 JS R SPLITP 010D A 5FA LDA POINTL ,-THEN DO POINTL I think I might be fairly typical of 010F 201A01 JS R SPLITP the sort of reader who would buy 0112 A5F9 LDA INH ,-LAST, BUT NOT LEAST, DO INH 0114 201A01 JSR SPLITP MICRO (or its Apple edition) on a 0117 4C0689 JM P SYMSCA ;SET SYM MONITOR LIGHT & RETURN regular basis if there were enough 011A Apple coverage. 011A 48 SPLITP PHA .-SAVE ORIGINAL 01IB 4A LSR ; ON STACK FOR LATER 011C 4A LSR ; SHIFT HI HALF TO LO HALF Good grief—thousands of us have 011D 4A LSR kilobucks invested in Apple (it's the 011E 4A LSR .-WHICH IS 4 BITS DCWN 011F A A TAX .-PUT INTO X AS AN INDEX kind of computer that attracts in­ 0120 BD298C LDA SYMSEG,X ;GET APPROIRIATE SEGMENT CODE telligent laymen—no wonder so many 0123 9940A6 STA SYMDIS,Y ; AND PUT INTO DISPLAY BUFFER articles of high quality are submitted!). 0126 C8 INY ;BIMP Y FOR NEXT BYTE With Pascal, I can tackle projects that 0127 68 PLA ;NCW GET ORIGINAL VALUE BACK 0128 290F AN D #$0F .-KEEP ONLY LCW ORDER 4 BITS are light years beyond the scope of 012A A A TAX .-AND REPEAT SEGMENT PROCESS KIM, SYM, et. al. and I'm hungry for 012B BD298C LDA SYMSEG,X reading material! 012E 9940A6 STA SYMDIS, Y 0131 C8 INY ; INCLUDING BUMP FOR NEXT BYTE 0132 60 RTS ; A N D RETURN As far as I'm concerned, you can 0133 J publish just one more article for those 0133 ;SYM-1 VERSION OF GETKEY SUBROUTINE bare-board, skinflint, kitchen table 0133 I 0133 202C89 GETKEY JS R SYMLRN .-GET SYM VERSION OF THE KEY time-wasters—"How to Convert Your 0136 D003 BNE KEYDWN .-BRANCH IF A NY KEY IS DCWN KIM-1 Into a Dedicated Coffee Per­ 0138 A915 GKNONE LDA #$15 ,-ELSE SET TO KIM NO KEY DCWN colator." That's it—the final article! 013A 60 RTS ;AND RETURN 013B 8A KEYEWNTXA ;X HOLDS INDEX INTO ASCII TABLE 013C C911 CMP #$11 .-NEED TO FUDGE'KEY VALUE? Given the choice of publishing a 013E 9007 BCC GKRTS ;00-0F IS OK 10=AD(KIM)=CR(SYM) magazine for the relatively well-heeled 0140 C916 CMP #$16 ; CHECK FOR OUT OF KIM RANGE and serious users of what may well be 0142 B0F4 BCS GKNONE .-AND TREAT AS A 'NO KEY' 0144 AD3701 LDA TRANSO ;ELSE TRANSLATE THROUGH TABLE the "Model A" of computing versus 0147 60 GKRTSRTS ; AND RETURN publishing one for a minority of im­ 0148 poverished assembly language hob­ 0148 12 TRANST BYT $12 ' (KIM) = '-/+' (SYM) byists, it surprises me that you resist 0149 11 BYT $11 ;'DA' (KIM)=NO KEY (KIM) 014A 15 BYT $15 .-SHIFT (SYM)=NO KEY (KIM) the opportunity to publish more Apple- 014B 13 BYT $13 ; 'G' (KIM) = ,GO/LP' (SYM) based articles. 014C 14 BYT $14 ; 'PC' (Km) = 'REG/SP' (SYM) 014D / Where will KIM, SYM, PET and 014D ;SYM-1 VERSION OF KIM KEYIN SUBROUTINE 014D ! AIM be in ten years? Apple, and its pro­ 014D 202389 KEYIN JSR SYMKEY ;GET KEYBOARD STATUS geny, might well dominate the world of 0150 D003 BNE KEYIN2 (REVERSE ZERO FLAG microcomputing by that time. Will 0152 A2FF LDX #$FF ;KIM NOT ZERO—NO KEY—FF FOR LRNKEY 0154 60 RTS MICRO ride the bandwagon or drag its 0155 A 200 KEYIN2 LDX #$00 ;AND IS ZERO IF KEY IS DCWN heels? The choice is yours! 0157 60 RTS 0158 1 Please don't publish my name or ad­ 0158 ;SYM-1 VERSION OF KIM CONVD ROUTINES $1F48 & $1F4E 0158 t dress. I don't want my Apple stolen! 0158 84FC CONVD STY PZSCR jSAVE Y IN SCRATCH AREA 015A A8 TAY ;MOVE NIBBLE OF A TO INDEX REGISTER 015B B9298C LDA SYMSEG,Y ,-GET HEX SEGMENT CODES FRCM TABLE 015E 8E02A4 DISPCH STX SYMPBD ,-SELECT THE DIGIT 0161 8D00A4 STA SYMPAD .-OUTPUT THE SEOIENT CODES 0164 A 0 10 LDY #$10 ;HEEP IT LIT FOR A WHILE Editor’s Note: Beginning in June, 0166 88 LIGHT DEY MICRO will be expanding to include 0167 D0FD BNE LIGHT more Apple articles each month. We 0169 8COOA4 STY SYMPAD .-TURN ALL SEGMENTS OFF FOR NEXT ONE ;BUMP X TO NEXT DIGIT thank all who responded to the “Too 016C E8 INX 016D A4FC LDY PZSCR ; RESTORE THE Y REGISTER Many Apples!” editorial. 016F 60 RTS ,-AND RETURN

J U C f t O

16 MICRO - The 6502 Journal No. 3 6 -M a y 1981 Russell and David Schultz. This book parts lists, schematics, photos of the covers all the capabilities commands boards, and very little text. They are and keywords of OSI BASIC (with the essential for repairing the computers exception of the LJSR(X) function). The and helpful when modifying the cir­ AMCftO book is limited to the BASIC language cuitry. These manuals assume the and avoids machine level information reader has a good electronics Challenges so as not to confuse the reader. It is also background, the ability to read written specifically for OSI machines schematics, and a working knowledge and contains information peculiar to of digital electronics. The only item By Paul Geffen these machines, like how to get started mising from these manuals is a and what POKEs to use to change the schematic of the power supply, which Last month's column may have left the screen format. is represented as a "black box." impression that Ohio Scientific pro­ The second BASIC text is BASIC All of the above documentation is vides very little documentation for its and the Personal Computer by T.A. available from OSI dealers, separate products. This has been the case until Dwyer and M. Critchfeld. This book is recently . The new management at OSI four times as long as the one by Russell from the computers. In addition to these publications, OSI has expanded is making an effort to improve the and Schultz, and is much more detailed quantity and quality of its documenta­ as well as broader in scope. While the its customer service department and its tion. This effort, started last year, is former covers only the , the latter programming staff. If you own an OSI still underway. Here is a report on the includes chapters on applications like machine and have questions about results so far. word processing, games, art, simula­ hardware or software, write to the Last year OSI published a set of tion, data structures, sorting and files. Customer Service department, 1333 revised User’s Manuals for the C1P, In addition to providing an introduc­ South Chillicothe Road, Aurora, Ohio 44202, or call (216) 831-5600. C4P, and C8P personal computers. tion to computers and the BASIC These were a big improvement over the language, Dwyer and Critchfeld cover previous versions. The new User’s many of the possible applications of For the experienced assembly Manuals look better, contain more in­ personal computers. This book was not language programmer who wants to formation, and are much more reliable written for OSI computers. It is a know everything about the internal than the old ones. They also include general BASIC text for college courses operation of the OS65D V3.2 disk illustrations and photographs which published by Addison-Wesley with a operating system, a complete com­ are valuable to the beginner. These special cover for OSI. Some of the mented disassembly of OS65D V3.2 is manuals cover the middle ground material here applies to other versions available from Software Consultants, because they assume a certain amount of BASIC, but for the most part the 7053 Rose Trail, Memphis, Tennessee of knowledge about computers, but book is written for users of any 38134. This book has been praised in contain limited detail about the inner machine. Both texts assume very little all the newsletters. I have just received workings of the machines. initially, but the one by Dwyer and a copy and plan a full report in my next Critchfeld goes further and faster. column. More recently, OSI has published manuals for the novice as well as for For BASIC programmers who want The C2-4P the more advanced user. For the to learn about machine language, OSI novice, there is now a series of five publishes the 65VPrimer, an introduc­ This is a relatively old OSI personal Introductory Manuals, for the C1P, tion to machine code on the OSI per­ computer. It is no longer in production C4P, C4PMF, C4PDF and C8PDF. I sonal computers. OS 65V is the but since there are quite a few of them have seen only the first of these; the machine . level monitor program in around it deserves mention. This rest should be available by the time you ROM which provides the most fun­ model has since been upgraded to the read this. These manuals will be in­ damental support for other programs C4P. The only differences between the cluded with the computers, along with like BASIC. This book is also a good two are that the C2-4P has an older (rev the User’s Manual. These Introductory introduction to 6502 assembly or A) video display board without color, Manuals assume very little and are machine language programming. It and an older version of the CPU board designed for the beginner. They include describes all of the machine instruc­ with fewer I/O lines. Other than that, many photographs and provide detailed tions and contains many examples and the only difference is the enclosure. instructions on how to set up the exercises. It does not assume any C2-4P software will run on the C4P and machine and save programs. knowledge of computers, but it helps to most C4P software will run on the be able to program in BASIC before C2-4P unless it requires the I/O ports The manuals also provide very little reading this book. general information about BASIC. on the new CPU board. They serve to de-mystify the machine OSI has completed two new and make it accessible to someone who reference manuals which I have not A used C2-4P can be a very inexpen­ knows next to nothing about com­ seen but which should be available sive personal computer but it helps to puters. This approach is designed to shortly. One is a new and improved know how to maintain it. Schematics make OSI personal computers appeal to BASIC Reference Manual and the other for the older boards are not in the C4P the mass market, those people who is an Assembler/Editor/Extended servicing manual but can be obtained now form the fastest growing part of Monitor Reference Manual. I plan to from OSI directly. (Write to Bill Con­ the computer market. review these in a future column. rad at Customer Service.) Despite its For the hardware expert or repair­ age, this model is not obsolete. Much Also for the beginner, OSI publishes man, Ohio Scientific and Howard Sams software continues to be written on and two introductory BASIC texts. The first publish three detailed Servicing for this computer. And it can be con­ is Understanding Your Ohio Scientific Manuals for OSI personal (C1P and verted into a C4P by replacing the two C1P and C4P, A Workbook of Program­ C4P) and business computers (CH and boards mentioned above. ming Exercises in BASIC by Keith CHI). These contain block diagrams,

No. 36 - May 1981 MICRO - The 6502 Journal 17 1 1 NIBBLE IS TERRIFIC FF (For Your Apple) r

NIBBLE 18: The Reference for Apple computing!

NIBBLE IS: One of the Fastest Growing new Magazines in the Personal Computing Field.

HUBBLE 18: Providing Comprehensive, Usefuland Instructive Programs for the Home, Small Business, and Entertainment.

NIBBLE IS: A Reference to Graphics, Games, Systems Programming Tips, Product News and Reviews, Hardware Construction Projects, and a host of other features.

■ H W J B NIBBLE IS:A magazine suitable for both the Beginner and l U l U P the Advanced Programmer. Each issue of NIBBLE features significant new Programs of Commercial Quality. Here’s what some of our Readers say:

- “ Certainly the best magazine on the Apple II”

- “Programs remarkably easy to enter”

- “ Stimulating and Informative; So much so that this is the first computer magazine I've subscribed to!” - “Impressed with the quality and content.”

- “NIBBLE IS TERRIFIC!”

In coming issues, look for: □ Stocks and Commodities Charting □ Assembly Language Programming Column □ Pascal Programming Column □ Data Base Programs for Home and Business □ Personal Investment Analysis □ Electronic Secretary for Time M anagem ent □ The GIZMO Business Simulation Game And many many more! NIBBLE is focused completely nibble on the Apple Computer systems. Box 325, Lincoln, MA. 01773 (617) 259-9710 Buy N IBBLE through your local I'll try nibble! Apple Dealer or subscribe now with Enclosed is my $17.50 (for one year). the coupon below. (Outside U.S., see special rates on this page.) □ check □m oney order Try a NIBBLE! Your subscription will begin with the next issue published after receipt of your check/money order.

Name First Class or Air Mail is required for all APO. hPO and all foreign addresses with the following additional amounts Africa: North $32.00 Address_ - Europe $32.00 Central $43.00 — Mexico and Central America $21.00 South $43.00 C ity ____ - South America $32.00 Far East. Australia $43.00 — Middle East $35.00 Canada $18.00 All payments must be in U.S. funds drawn on a U.S. bank. S ta te . Zip_ C i) I9H0 hy MICRO-SPARC . INC.. Lincoln. Mass. <11773 All rights reserved 'Apple II is a registered trademark of Apple Computer Company L—.

18 MICRO - The €502 Journal No. 3 6 -M a y 1981 More Output from your Micro

Here is a simple way to add extra output bits to your single control with minimal effort and other purposes. Table 1 shows what board microcomputer. This without tying up your VIA. It consists addresses are unused on each micro and technique will work on the AIM, of one half of a 74LS107 dual JK flip- where the corresponding signals may SYM, KIM and OSI Superboard flop connected to unused address be found. or C1P. The method is similar to decode outputs from the computer. In that used on the Apple II for this case, the flip-flop is used to drive an audio amplifier and a speaker to Two of these decoder outputs are generating sound, and a provide sound output, but many other used to set and reset the flip-flop in “random beeper” program applications are possible. For example, figure 2. Almost any flip-flop may be concludes this article. the output bit could be used to control substituted, as shown. The output of a printer or other device. the flip-flop is the new output bit. If all H.H. Aumann you want to do is toggle the output 1262 Rubio Vista This is how it works. All then the decode line may be connected Altadena, California 91001 microcomputers use decoders to divide to the clock input of the flip-flop. In the 64K range of possible addresses into this case only one address is needed for The circuit in figure 1 provides an more manageable units. Some of the access but you may not be able to tell if independent output bit which can be outputs from these decoders are not the output bit is on or off. In the case of turned on and off under program used on the board and are available for sound output this is not important.

Figure 1

No. 36 - May 1981 MICRO - The 6502 Journal 19 Figure 2 If you use the circuit in figure 2, The following BASIC program then a read from an address generates random sound output on the decode output 1 corresponding to decode output 1 will OSI Superboard. The machine language turn on the output bit, and a read from program is relocatable and will ran on an address corresponding to decode any machine by changing the byte at a 2 PR output 2 will turn off the output bit. $0226. The BASIC program must be D changed to load the machine code in a convenient location. This is left to the reader as an exercise. 3 O 5 + 5 < o control output

Table 1 CLR AIM SYM KIM OSI $8000 A-18 $1000 A-F $0400 A-C $D400 write U20 - 9 decode output 2 $9000 A-19 $1400 A-H $0800 A-D $D800 write U20 - 10 7 $AOOO A-20 $1800 E-16 $0C00 A-E $D400 read U20 - 13 74LS74 $1C00 A-J $1000 A-F $D800 read U20 - 14

A - Application Connector E - Expansion Connector Note: U20 is a 74138 decoder chip on the OSI model 600 CPU board.

10 REM SIMPLE TONE GENERATOR DEMO 12 REM FOR OSI SUPERBOARD / C1P 20 FOR I = 548 TO 567: READ BI 25 POKE I, BI: NEXT : REM LOAD $224-237 30 POKE 11,36: POKE 12,2 35 REM SET ENTRY POINT FOR USR(l) 40 D = 256 * RND (1):P = 256 * RND (1) 50 POKE 546,P: POKE 547,D 55 REM SET PERIOD AND DURATION 60 X = USR (1): GOTO 40 70 DATA 173,0,216,136,208,5,206,35,2,240 74LS74 80 DATA 8,202,208,245,174,34,2,208,237,96

decode output 1

ORG $0222

PERIOD DFS 1 PR DURATNDFS 1 J 15 u AD00D8 SOUND LDA $D800 control DO 03 LOOP BNE SKIP CK output CE2302 DEC DURATN F008 SKIPBEQ DONE K CA DEX 16 D0F6 BNELOOP CLR AE2202 LDX PERIOD D0EE BNE SOUND 60 DONE RTS decode output 2 I 7476

AlCftO

20 MICRO - The 6502 Journal No. 3 6 -M a y 1981 0 5 1 SOFTWARE FOR OSI □ S i

A JOURNAL FOR OSI USERS!! ADVENTURES Adventures are interactive fantasies where you give the The Aardvark Journal is a bimonthly tutorial for OSI computer plain English commands (i.e. take the sword, users. It features programs customized for OSI and look at the control panel.) as you explore alien cities, has run articles like these: space ships, ancient pyramids and sunken subs. Average playing time is 30 to 40 hours in several sessions. 1) Using String Variables. There is literally nothing else like them — except being there yourself. We have six adventures available. ESCAPE FROM MARS — Explore an ancient 2) High Speed Basic On An OSI. Martian city while you prepare for your escape. NUCLEAR SUBMARINE - F ast moving 3) Hooking a Cheap Printer To An OSI. excitement at the bottom of the sea. P Y R A M ID — Our most advanced and most 4) An OSI Disk Primer. challenging adventure. Takes place in our own special ancient pyramid. 5) A Word Processor For Disk Or Tape Machines. V A M P IR E CASTLE - A day in old Drac's castle. But it's getting dark outside. 6) Moving The Disk Directory Off Track 12. D E A TH SHIP - It's a cruise ship — but it ain't the Love Boat and survival is far from certain. TR E K A D V E N T U R E — Takes place on a First year issues already available! familiar starship. Almost as $9.00 per year (6 issues) good as being there.

NEW SUPPORT ROMS FOR BASIC P.C. BOARDS SINGLE STEPPER / MONITOR IN ROM MACHINES MEMORY BOARDS!! - for the C IP. - and they This is probably the finest debugging tool for C1S — for the C1P only, this ROM adds full contain parallel ports! machine code ever offered for OSI systems. Its' screen edit functions (insert, delete, change Aardvarks new memory board supports 8K trace function allows you to single step through characters in a basic line). Softwave selectable of 2114’s and has provision for a PIA to give a a machine code program while it continuously scroll windows, two instant screen clears (scroll parallel ports! It sells as a bare board for $29.95. displays the A , X , Y and status registers and the window only and full screen), software chose of When assembled, the board plugs into the expan­ program and stack pointers. You can change any OSI or standard keyboard format. Bell support, sion connector on the 600 board. Available now! of the registers or pointers or any memory loca- 6 0 0 Baud cassette support, and a few other at any time under program control. It takes well features. It plugs in in place of the OSl R O M . PROM BURNER FOR THE C1P - Burns single under 1k and can be relocated anywhere in free N O T E : this ROM also supports video conversions supply 2716's. Bare board — $24.95. for 24, 32, 48 or 64 characters per line. Replaces memory. It is a fine tool for all systems — and video swap tape on C1P model 2. All that and it MOTHER BOARD — Expand your expansion the best news of all is the extremely low price we sells for a measly $39.95. connector from one to five connectors or use it put on it. — Tape $19.95 — Disk $24.95 C1E/C2E for C 1/C 2/C 4/C 8 Basic in R O M ma­ to adapt our C1P boards to your C4/8P. - $1435. chines. This ROM adds full screen editing, soft­ FOR DISK SYSTEMS - (65D, polled key­ ware selectable scroll windows, keyboard correc­ ARCADE AND VIDEO GAMES board and standard video only.) tion (software selectable), and contains an ex­ SUPERDISK. Contains a basic text editor with tended machine code monitor. It has breakpoint GALAXIA one of the fastest and finest arcade functions similar to the above programs and also utilities, machine code load and save, block games ever w ritten fo r the O S I, this one features contains a renumberer, variable table maker, memory move and hex dump utilities. A must for rows of evasive, hardhitting, dogfighting aliens the machine code programmer replaces OSI sup­ thirsty for your blood. For those who loved (and search and new B E XE C * programs. The B EXEC * port ROM. Requires installation of additional provides a directory, create, delete, and change tired of) Alien Invaders. — P.S. The price is a chip when installed in a C2 or C4. C1 installation utilities on one track and is worth having by requires only a jumper move. Specify system giveaway. SPECIFY SYSTEM! $59.95. Cassette $9.95 — Disk $12.95 itself. — $24.95 on 5” disk - $26.95 on 8". AARDVARK IS NOW AN OSI DEALER! TIME TREK (8K) — real time Startrek action. See your torpedoes move across the screen! Fleal Now you can buy from people who can support DISK UTILITIES graphics — no more scrolling displays. $9.95 your machine. SUPER COPY — Single Disk Copier IN TE R C E PTO R C1P O N L Y ! An all machine - THIS MONTH'S SPECIALS - This copy program makes multiple copies, code program as fast and smooth as the arcades. copies track zero, and copies all the tracks You use your interceptor to protect your cities Superboard II $279 that your memory can hold at one time — from hordes of enemy invaders. A pair of auto­ C1P Model II 429 up to 12 tracks at a pass. It's almost as fast matic cannons help out, but the action speeds up C4P 749 as dual disk copying. — $15.95 with each wave of incoming ships. The fastest 8K 610 board for C1P 269 and most exciting C1P game yet. MAXIPROSS (WORD PROCESSOR) - 65D Epson M X -8 0 printer w ith RS232 installed 595 C1P Cassette $19.95 polled keyboard only - has global and line edit, MINOS — A game with amazing 3D graphics. . . . and we'll include a free Text Editor Tape right and left margin justification, imbedded You see a maze from the to p, the screen blanks, with each machine! margin commands, choice of single, double or and then you are in the maze at ground level, triple spacing, file access capabilities and all the True 3 2 X 3 2 Video Mod Plans for C1P finding your way through on foot. Realistic features of a major word processor — and it's (4 Chips $3.00 Crystal Required) enough to cause claustrophobia. — $12.95 only $39.95. $7.95

This is only a partial listing of what we have to offer. We now offer over 100 programs, data sheets, ROMS, and boards for OSI systems. Our $ 1 .0 0 catalog lists it all and contains free program listings and programming hints to boot.

Aardvark Technical Services • 1690 Bolton • Walled Lake, Ml 48088 □ S I (313) 669-3110 / SPACE r U J flR

You're in command in SPACE WAR' Destroy your opponent s ship by forcing him to collide with the sun or to explode upon re-entry from hyperspace or challenge him face to face with missile lire You're ;n command of the speed and direction of your ship You control the timing of your missiles You select the game mode trom five options including Reverse Gravity, and the battle begins Accel­ erate to place your shots--and escape into hyperspace before your opponent comes within range But be wary he (or she') may circle out of sight ant! reappear on the opposite side of the galaxy' (This is the classic MIT game redesigned especially for the Apple > and SU PER IMURSIDM

• Super Invasion is the original invasion game, with the original moon creatures and faster action than any other invasion game. • Features superb high resolution graphics, nail-biting tension and hilarious antics by the moon creatures! • Self-running "attract mode" of operation for easy learning and demonstrating of the game.

• As good in every way as the famous Invaders arcade game.

• High speed action ! • Sound effects! m r • Runs on the Apple II and the Apple II Plus Fifty-five aliens advance and shower you with lethal writhing electric worms. As you pick off the aliens, one-by-one, they quicken their descent. They whiz across the screen wearing away your parapets, your only defense, coming closer and closer to f h ; -S C C ?E*d0u your level. Super invasion is the original invasion game with the original moon creatures and faster action than any other invasion game on the market. 0 * * A I n * Ej; Super Invasion is available for only $19.95 on cassette ** *» +* m m (CS-4006) for a 32K Apple II. Space War is $14.95 on cassette (CS-4009) for a 16K A pple II. Space War and Super Invasion are on V* <0* mr one disk (CS-4508) for a 48K Apple II for only $29.95. m m m Send payment plus $1.00 shipping and handling to Creative Computing Software, P.O. Box 789-M, Morristown, NJ 07960, NJ ? _ * residents add $1.00 sales tax. Bankcard orders may be called in 0 ° toll free to 800/631-8112. In NJ call 201/540-0445. r v* r c re a tiv e i t sensational c o m p a r i n g V r — - - — — - s o ftw a re s o ftw a re ,

22 MICRO - The 6502 Journal No. 36 - May 1981 Applesoft Variable Dump

0800 ROUTINE TO DUMP ALL SIMPLE VARIABLES TO CURRENT This handy debugging utility 0 8 0 0 OUTPUT DEVICE. presents you with a “DUMP” of 0 8 0 0 0 8 0 0 current variable values, for 08 0 0 Applesoft in ROM. 08 0 0 08 0 0 BY 0 8 0 0 0 8 0 0 SCOTT SCHRAM 0 8 0 0 0 8 0 0 0 8 0 0 0800 EQUATES Scott D. Schram 0 8 0 0 0 8 0 0 VARLEPZ $69 APSOFT’S POINTER TO SIMPLE 1201.Greenview Rd. 0 8 0 0 VARH EPZ $ 6A VARIABLE STORAGE. Collierville, Tennessee 38017 0 8 0 0 ARRAYLEPZ $6B APSOFT’S POINTER TO 0 8 0 0 ARRAYH EPZ $6C END OF SIMPLE STORAGE. 0 8 0 0 POINTL EPZ $06 P O I N T E R TO 0 8 0 0 POINTHEPZ $07 CURRENT VARIABLE. 0 3 0 0 S P L EPZ $9E STRING PRINT POINTER. 0 8 0 0 SPH EPZ S P L + $ 1 0 8 0 0 LEN EPZ S PH+$1 LENGTH OF STRING TO PRINT. 0 8 0 0 STROBE EQU $ C 0 1 0 KEYBOARD STROBE 0 8 0 0 KB0ARD EQU $COOO KEYBOARD This program searches through the 0 8 0 0 memory used by ROM Applesoft and 0 8 0 0 0 8 0 0 APPLESOFT EQUATES prints all non-subscripted variables. It 0 8 0 0 can mainly be used as a debugging tool 0 8 0 0 (SEE APPLE ORCHARD MAR/APR 1980) 0 8 0 0 to see what is going on inside a piece of 0 8 0 0 code. I chose not to print the array 0 8 0 0 GIVAYF EQU $E2F2 APSOFT'S INTERNAL NUMBER 0 8 0 0 PRTFAC EQU $ED2E HANDLING ROUTINES. variables because no great need for it 0 8 0 0 M 0 V E F M EQU $E A F 9 had come up. Also, array variable 0 8 0 0 OUTDOEQU I D B 5 C PRINT CHAR. IN A REG. storage is considerably more complex. 0 8 0 0 CRDO EQU $ D A F B , PRINT A CARRIAGE RETURN 0 8 0 0 OUTSPCEQU $ D B 5 7 ; PRINT A SPACE (See the Applesoft manual, p. 137.) 0 8 0 0 A P S 0 F T EQU $ D 4 3 C ; APSOFT'S WARM START 0 8 0 0 08 0 0 You may enter this program into 0 8 0 0 o © o your assembler from the listing or key 4 0 0 0 ORG 0 0 0 0 it in at $4000 using the monitor. This 4 0 0 0 location is right in the middle of 4 0 0 0 START: 4 0 0 0 2 0 F B D A JSRCRDO PRINT A C.R. memory and will rarely conflict with 4 0 0 3 A 5 6 9 LDA VARL M O V E B Y T E S the Applesoft unless you have a giant 4 0 0 5 8506 STAPOINTL FROM VARIABLE 4 0 0 7 A 5 6 A L DA VARH POINTERS INTO program with lots of strings. Save the 4 0 0 9 850 7 STA POINTH MY POINTER program on disk (BSAVE VARIABLE 4 0 0 B A 5 0 6 L O O P LDAPOINTL SEE IF DUMP,A$4000,L$CE) or tape (*4000. 400DC56B CMP ARRAYL I AM AT TOP 4 OOF DO 09 BNE PRINT1 NO 40CDW). 4011 A 5 0 7 LDA POINTH CHECK HIGH BYTE 4 0 1 3 C56C CMPARRAYH IF BOTH ARE EQUAL THEN NO MORE 4 0 1 5 D 0 0 3 BNE PRINT1 SIMPLE VARIABLES LEFT. To use the program, stop execution 4 0 1 7 4 C 3 C D 4 JMPAPS0FT DONE. of an Applesoft program and load the 4 0 1 A 4 0 1 A DETERMINE THE TYPE OF THE NEXT VARIABLE AND DISPATCH variable dump into memory. Then 401A TO THE CORRECT.ROUTINE. CALL 16384. You may BRUN 4 0 1 A 4 0 1 A P R I N T 1 VARIABLE DUMP from disk. See the 4 0 1 A AOOO L D Y # $ 0 0 sample run. Any simple variables will, 4 0 1 C B1 0 6 LDA (POINTL),Y THE HIGH ORDER BIT OF THE 40 1 E 30 0 8 BMI INTGER NAME DETERMINES THE TYPE. work even if defined in the immediate 40 2 0 C8 INY mode. 4021 B 1 0 6 LDA (POINTL)tY 4 0 2 3 1026 BPLREAL 4 0 2 5 4C 6 7 4 0 JMP STRIttG The screen may scroll too fast to 40 2 8 INTGER read, so hit any key to stop the listing. 40 2 8 C8 INY 40 2 9 B 1 0 6 LDA (POINTL),Y WEED OUT FUNCTION NAMES. Then hit any key to start it again. 402B105B BPLNXTS1 When the program is done, it will 40 2 D 2 0 9 9 4 0 JSR PRINTN INTEGER HANDLING STARTS HERE. 4 0 3 0 LDA return to Applesoft. A 9 2 5 # $ 2 5

No. 36 - May 1981 MICRO - The 6502 Journal 23 Note: This program is written to 1)032 205CDB J S R O U T D O work with ROM Applesoft. To convert '•035 2 0 5 7 D B J S R O U T S P C to disk or cassette would require con­ 4 0 3 8 A 0 0 2 L D Y #$0 2 4 0 3 A B I 06 LDA (POINTL),Y ; GET THE INTEGER siderable effort. If you want to convert 4 0 3 C AA TAX it you will have to figure out the 4 0 3 D C8 INY 403E B106 LDA (POINTL),Y equivalent addresses in RAM Applesoft 4 0 4 0 A 8 TAY and change the equates in the listing. 4041 8A TXA 4042 20F2E2 J S R G I V A Y F i CONVERT TO FLOATING POINT 4045 202EE0 J S R P R T F A C ; PRINT IT. I welcome any comments. Please 4048 4C8540 J M P N X T S I M send them to the address at the begin­ 40 4 B REAL: 404B 209940 J S R P R I N T N ; REAL HANDLING STARTS HERE. ning of the article and include a S.A.S.E 404E 2057DB J S R O U T S P C if you desire a reply. 4051 2057DB J S R O U T S P C 4 0 5 4 A 4 0 7 L D Y P O I N T H 4 0 5 6 A 5 0 6 L DA P O I N T L 4 0 5 8 18 CLC 4 0 5 9 6 9 0 2 A D C # $ 0 2 4 0 5 B 9001 B C C C O N T 4 0 5 D C8 I MY 405E 20F9EA C0MT JSR H0VEFM ; USE APSOFT INTERNALS TO 4061 202EED J S R P R T F A C ; DO THE DIRTY WORK. 4064 4C8540 J M P N X T S I M 40 6 7 STRING: 4067 209940 J S R P R I N T N 4 0 6 A A 9 2 4 L D A # $ 2 4 406C 205CDB JS R O U T D O 406F 2057DB JS R O U T S P C 4 0 7 2 A 0 0 2 L D Y # $ 0 2 4 0 7 4 B 1 0 6 LDA (POINTL),Y ; SET UP THE POINTERS FOR LIST 4 0 7 6 8 5 A 0 S T A L EN ; STROUT SUBROUTINE. 4 0 7 8 C8 INY 10 AA = 98E + 05 4079 BI06 LDA (POINTL),Y 4 0 7 B 8 5 9 E S T A S P L 20 R$ = "THIS IS A 4 0 7 D C8 INY 4 0 7 E B 1 0 6 LDA (POINTL),Y TEST" 4 0 8 0 8 5 9 F S T A S PH 4082 20AD40 J S R S T R O U T j PRINT THE STRING. 30 N% = 2341 4 0 8 5 40 RR = 12345 4085 NXTSIM SETS THE VARIABLE POINTER TO THE NEXT VARIABLE. 40 8 5 50 FOR I = 0 TO 10: 4 0 8 5 NXTSIM: 4085 20FBDA JSR CRDO NEXT I 4088 18 NXTS1 CLC 4 0 8 9 A 9 0 7 L D A #$ 0 7 60 END 4 0 8 B 65 0 6 A D C P O I N T L 4 0 8 D 85 0 6 S T A P O I N T L 4 0 8 F 9 0 0 2 B C C C O N T 2 ] RUN 4091 £607 INC POINTH 4093 20BD40 C0NT2 JSR WAIT 4096 4C0840 J M P L O O P 4 0 9 9 ]BRUN VARIABLE DUMP 4 0 9 9 PRINTN PRINTS THE NAME OF THE CURRENT VARIABLE. 4 0 9 9 AA 9800000 4 0 9 9 PRINTN: R $ THIS IS A TEST 4099 AOOO LDY #$00 ; I N D E X = 0 4 0 9 B B 1 0 6 LDA (POINTL),Y ; GET FIRST LETTER N % 2341 409D 205CDB J S R O U T D O 4 O A 0 C8 INY ; MOVE UP RR 12345 4 0A 1 B 1 0 6 LDA (POINTL),Y j GET NEXT CHAR IN NAME 4 0 A 3 2 9 7 F A N D # $ 7 F I 11 40A5 D002 BNE CONT3 ; IF THIS IS A SINGLE CHARACTER 4 0 A 7 A 9 A 0 L D A # $ A 0 ;NAME THEN PRINT A SPACE. 40A9 205CDB C0NT3 JSR OUTDO 4 0 A C 60 RTS 4 0 A D ]A = 3 4 5 6 7 .98 4 0 A D 4 0 A D ■STROUT PRINTS A STRING POINTED 4 0 A D TO BY SPL,SPH OF LENGTH LEN ]BB%=-32767 4 0 A D 4 0 A D 4 0 A D STROUT: 4 0 A D A O O O L D Y # $ 0 0 ]CC$-"MOOSE" 40AF C4A0 LOOP1 CPY LEN 40B1 F009 BEQ RTS 1 4 0 B 3 B 1 9 E L D A (SPL) ,Y ] DD==12324+98 40B5 205CDB J S R O U T D O 4 0 B 8 C8 INY 40B9 4CAF40 JMP LOOP1 40BC 60 RTS1 RTS ] N%==1232 4 0 B D 4 0 B D 40BD WAIT LOOKS AT THE KEYBOARD ]BRUN VARIABLE DUMP 40BD TO SEE IF A KEY WAS PRESSED. 40BD IF SO, IT WAITS FOR A SECOND A 34567.98 40BD KEY TO BE PRESSED BEFORE IT 40BD RETURNS. BB% -32767 4 0 B D 4 0 B D CC$ MOOSE 40BD ADOOCO WAIT LDA KBOARD DD 12422 40C0 10FA BPL RTS1 40C2 AD10C0 L D A S T R O B E N % 1232 40C5 ADOOCO WAIT1 LDA KBOARD 4 0 C 8 10 F B B P L H A I T I 4OCA AD10C0 L D A S T R O B E 4 0 C D 60 RTS

24 MICRO - The 6502 Journal No. 3 6 -M a y 1981 techniques to this problem, he was the dependent variables from the direct first to use a microprocessor at the measurements of patient clotting time “bedside” to guide the physician and (prothrombin time tests). Once these monitor anticoagulation therapy. The parameters have been determined, the MICRO next several paragraphs (which refer to initial dosage may be optimized for a figure 1) discuss the algorithm used to given patient. Subsequently, the pro­ Microprocessors in model anticoagulation therapy, talk gram will be able to monitor changes of Medicine: The 6502 about the computerization of the the patient's clotting time during the algorithm, and show the equations for maintenance phase of drug adminis­ the dynamic model of anticoagulation tration (the daily dosage required to therapy. keep the clotting time in the thera­ Jerry W. Froelich, M.D. peutic range]. 9 Brown Place Woburn, Massachusetts 01801 G = - G Kg + D(t) (1) Dr. Powers has analyzed three methods (1) to calculate the patient- Previously in this column we have not Q = G Kg - Ke Q (2) dependent parameters from Kg, Ke, etc. discussed applications where the com­ He also settled on a "tuned” extended puter helps in the ''direct'’ manage­ P = S m (l - F/F + Km) - KpP (3) Kalman filter method because it was ment of patient therapy. In this issue accurate and it could compute the we will describe a "PET" computer Where F approximately equal to 0.003 results within a few minutes, whereas which keeps track of patients' data who Q / Warfarin distribution volume other techniques require between 30 are being treated with a blood anti­ which is approximately equal to aQ. and 60 minutes of computer time per coagulant called warfarin [ coumadin]. Then, case.

Background P = Sm(l - Q/Q + K) - KpP (4) Overview of the Programs There are several medical condi­ Where K = Km / a tions where retarding of the rate at Dr. Powers has written a series of which blood clots is necessary to pre­ Figure 1: The basic equations for the programs. The early programs were vent further complications of the dynamic model of anticoagulation mainly concerned about the simulation disease. The drug warfarin is ad­ therapy. of the anticoagulation kinetics and ministered to "slow down" the blood estimation of the patient-dependent clotting mechanism. parameters. An example of the graph Equation (1) assumes that the rate generated by the Kalman filter program An example where anticoagulation of absorption of warfarin from the in­ is shown in figure 2. This graph is necessary is in a disease called “Deep testinal tract (the drug is taken by displays both the measured and the Venous Thrombophlebitis" (DVT) mouth) is proportional to the amount computed prothrombin complex ac­ where blood clots form in the deep in the intestine, G. tivities as a function of time. The veins of the legs. This condition is patient-dependent parameters are also potentially life threatening in that a The warfarin dosage schedule is displayed at the top of the figure. large blood clot may dislodge from the described by the function D( +). Equa­ leg, travel through the heart, and lodge tion (2) states that the instantaneous The most recently written program in the lung. If the clot is large enough it rate of change of the amount of war­ is appropriately titled MAIN­ may totally block the flow of blood to farin in the body, Q, is given by the dif­ TENANCE. This program is menu- the lungs resulting in shock or death, ference between the rate of absorption driven and interacts with the user due to asphyxiation. from the intestinal tract and its rate of promoting a better man-machine inter­ metabolism, the metabolism being a action. Figure 3 is an example of the Warfarin is used for the long-term first order process. menu. When the program is initially treatment of diseases, but warfarin run the program requests various infor­ itself may be life threatening if ad­ Equation (3) states the rate of the mation about the patient being ministered in incorrect dosages. If too prothrombin complex activity, (p), a monitored: the patient's full name, much drug is administered, blood blood clotting parameter that monitors phone number, parameters, and general vessels may bleed spontaneously. If too the extrinsic pathway of the coagula­ comments. The program then requests little, the clotting process won't be tion cascade and is equal to the dif­ the most recent laboratory values of the "slowed down.” Therefore, drug ference between the rate of synthesis of prothrombin complex activities. After dosage and drug breakdown (in the pa­ the complex and its rate of degradation. entering the measurements the pro­ tient) are critical to the use of warfarin. The reduction in the rate of prothrom­ gram can recommend a dosage and The predictable body metabolism of bin complex synthesis below the nor­ follow-up period (figure 4) from as few the drug makes it safe to use as long as mal value (Sm) due to inhibition by as four measurements. the patient is monitored closely. warfarin is given by a Michaelis- Menter formulation, in which (F) is the After each patient's data has been Model of Anticoagulation Therapy concentration of free warfarin and (Km) entered it can be saved on a floppy disk the Michaelis constant. so that when the patient returns for Dr. William F. Powers at the another visit, the data file can be recalled. University of Michigan has approached The parameters Kg, Ke, Kp, and K The program also flags such conditions anticoagulation therapy from the are subject-dependent parameters. One as an abnormal response to therapy. systems point of view. Although he of the goals of the program is to rapidly The data files can be backed up by was not the first to apply computer reach estimates of the subject- copying the disk.

No. 3 6 -M a y 1981 MICRO - The 6502 Journal 25 The program was not designed to replace the physician, but rather to assist the physician in the management :• R O T H P O M B IN C O M PLEX ft C T I V I T V ■ ' of patients. All recommendations h p =■ .2 6 K = J . 7 regarding therapy must be checked . U against the physician's understanding of the therapy. By managing the pa­ -4 4 tients in this manner the computer and physician check each other and there­ fore yield higher quality medicine.

Summary

The previous sections have described how an inexpensive microcomputer PR I OR I , X = MEASUREMEN T such as the Commodore PET 2001 can POSTERIORI be utilized with modem techniques to _ i__i... t i i i i i i i rapidly assess therapy and recommend dosages for patients receiving an­ ticoagulation therapy. The programs have been written in BASIC and the use Figure 2: Graphical display of the extend­ of the PET computer is straightforward. ed Kalman Filter values. Therefore, it requires only a matter of hours to teach medical personnel how to use the computer and programs.

In the application of the anti­ coagulation control problem, this model appears to be adequate for rapid­ ly identifying patients who become refractory to anticoagulation therapy, estimating the time to reach the therapeutic range, and determining the proper dosage schedules to maintain the desired prothrombin times. Fur­ thermore, this approach gives a systematic method for dealing with hard-to-control patients, and alerting the physician early in the therapy course that a particular patient may be difficult to anticoagulate.

Acknowledgement Figure 3: Example of the Menu selections To William F. Powers for his from the MAINTENANCE program. assistance in supplying the programs.

References

1. W.F. Powers, P.H. Abbrecht and D.G. Covell, "Systems and Microcom­ puter Approach to Anticoagulation I'ate I tro 1 I T i me I ric t I • T= 10 M«.> Therapy," IEEE Trans Biom edical -io-al in, 13 30, 8 5 I"2 1 T Engineering, Vol. 27, pp. 520-523, 2 Ii'j i , f T 1980. r , C" 2. W.T. Sawyers and A.L. Finn, 1 - 2 4 - 8 1 10 . 5 ± ^ > .3 h !•’ - T H I"-S r t "Digital Computer Assisted Warfarin: er T I I> <~1 r Comparison of Two Models," Com ­ 2 - 1 - 8 1 1 ft . 5 25 42 7 E"3 t puters and Biomedical Research, Vol. r - n v n a n 12, pp. 221-231, 1979. 2—15—81 10 . 5 13.5 77.7 6 r>.5 e- T 1 E"3 j. T 3. H. Wiegman and A. Vossepoel, A Computer Program for Long Term Anticoagulation Control, Vol. 5, p. ; t ES To Continue List,IS To Pet urn. 441, 1972. 4. W.F. Powers, Microcomputer Approach to Anticoagulation Therapy, Figure 4: Example of screen display for University of Michigan, Ann Arbor, recommended therapy from the mainte­ Rep. AE 80-1, February 1980. nance program.

26 MICRO - The 6502 Journal No. 36 - May 1981 ® UersaLUriter & APPLE II: The Keys to Unlimited Graphics

DRAWING TABLET GRAPHICS SOFTWARE Although VersaWriter operates on a Easily the most capable and com­ simple principle, it produces graphics plete graphics software for the home which match or exceed those of other computer available. Fast fill drawings digitizers. Rugged construction, trans­ in 100 colors. All text in five sizes, lucent base, easy to use — plugs compile and display shapes, edit, directly into APPLE II. move and much more!

UNIQUE OFFER See VersaWriter at your local dealer and pick up a copy of our demonstration disk. The complete VersaWriter hardware and software package is a real bargain at $249. For more information call or write:

Versa Computing, Inc. • 887 Conestoga Circle • Newbury Park, CA 91320 • (805) 498-1956

••SPECIAL INTRODUCTORY OFFER** Hardware: C1P Video Mod: Makes your 600 Video every Programmable Character Generator Board $89.95 bit as good as the 4P and 8P. Gives 32/64 CHR/Line with You can use OSI's characters or you can make your guardbands 1 and 2 Mhz. CPU clock with 300, 600 and own. Imagine you can now do true high resolution 1200 baud for Serial Port. Complete Plans $19.95 graphics 512 x 256 dots in the 64 x 32 screen format. KIT(Hardware and Software) $39.95 And all under your control! Installed: 32CHR — $79.95, 64CHR-$89.95 Other mods available — send for catalog. Extra K of Video RAM for 64CHR not included! Set of 3 ROMs available $75.00 SOFTWARE (with Documentation) C1P Sound Effects Board: Completely programmable! PC Chess V1.9 $14.95 For the discriminating hobbiest, the best board on the Play Chess against your computer! market for creating sound and music. Can be interrupt Helicopter Pilot: (64 CHR Video Only) $ 8.95 driven so that you can use it for gaming purposes. Has An Excellent Graphics Program! on board audio amp, 16 bit interval timer, 128 Bytes of Golf Challenger $14.95 RAM and two 8 bit parallel I/O Ports. From 1 to 4 players. Play a round of golf on your 18 hole Assembled and tested $89.95 Bare Board $39.95 golf course. One of the best programs I have ever seen! Both include Prog. Manual and Sample Software. You can even design your own course. Comes with full documentation (14 pages). C1P HI Speed Cassette Kit: Gives a reliable 300, 600, and 1200 Baud. No symmetry adjustments — the ideal Two Very Intricate Simulations! fix for OSI’s cassette interface. Easily implemented in Wild Weasel II: You operate a Sam Missile base during a 30 minutes. Will save you time and money even the first Nuclear War. Not as easy as you think! You must night you use it! $12.95 operate in a three dimensional environment. Many, many more. Send for Catalog with free program Failsafe II: The shoe is on the other foot! Here you are in (Hard Copy) and BASIC Memory Map. $1.00. Two the attacking bomber and you must penetrate deep into locations to serve you: enemy territory. Can you survive? An extremely complex Progressive Computing electronic warfare simulation! SPECIAL: both for 19.95 3336 Avondale Court, Windsor, Ontario Canada, N9E 1X6 (519) 969-2500 or 3281 Countryside Circle, Pontiac TWP, Ml 48057 VISA MASTER CHARGE (313) 373-0468

No. 36 - May 1981 MICRO - The 6502 Journal 27 Hot pursuit through space and the vortices o f tim e!

PRESENTS. . . S i n n : M The fallen Time Lord, who presumptuously calls himself The Master, is at large. The elders of Waldrom have supplied you with the hyperspace-worthy vessel Tardus, and commissioned you to eliminate the evil “Master”. Your resources include clones who will fight for you, the formidable CRASER weapons of the Tardus, and magic weapons such as Fusion Grenades and Borelian Matrix Crystals. Traveling through hyperspace in search of the evil one, you will encounter Time Eaters, Neutron Storms, and other alien creatures and phenomena. Entering real space to search planets, you will encounter still other dangers. You will enter native settlements to buy food and supplies — or to fight for survival. And once you find The Master can you destroy him? . Based on Dr. Who of PBS fame. ■ Apple Integer Basic, ___ Disk, 48K ... $29.95 TSGJHPIRDSIIX 6 South S i. Milford. NH 03055 (603)673-5144 TOLL FREE OUT-OF-STATE 1-800-25a-1790

MICHO - fhe 6502 Journal No. 36 - May 1981 TSE HARDSIDE HAS IT ALL IN ONE! How many times have you wished that there was a single source forv your personal computer needs? Well look no further, TSE­ HARDSIDE, located in pleasant New Hampshire, has virtually every conceivable item for your micro. Whether you’re shopping for your Apple, Pet, TRS-80™ or Atari, TSE-HARDSIDE has it all. We stock hardware, software, books, magazines and specialty items for all of the popular machines. So the next time you’re out shopping for your system don’t be surprised, be satisfied. Remember the name TSE­ HARDSIDE as your choice for quality, service and reliability.

TSeiHPIRDSID€ 6 South S t ,Mjlford. NH 03055 (603)673-5144 TOLL FREE OUT-OF-STATE 1-800-250-1790

W 5

No. 3 6 -M a y 1981 MICRO - The 6502 Journal 29 Photo credit: GREAT GALAXY IN ANDROMEDA Palomar Observatory, California Institute of Technology

THE MTU FLOPPY DISK CONTROLLER WITH 16K RAM GIVES YOUR AIM-65 ION DRIVE POWER? CODOS SOFTWARE HARDWARE CODOS DISK OPERATING SOFTWARE • 16K 2 PORT RAM ONBOARD WITH WRITE PROTECT 8K RAM RESIDENT ALLOWS UPGRADES • USES THE NEC-765 DISK CONTROLLER CHIP FINDS AND LOADS 32K BYTES IN 3 SECONDS • ROM BOOTSTRAP LOADER SPEEDS LOADING STARTUP FILE EXECUTES AT BOOT-UP • DMA OPERATION ALLOWS INTERRUPTS COMMAND FILE EXECUTION FROM DISK • SUPPORTS 8 INCH DRIVES 1 OR 2 SIDED DYNAMIC DISK STORAGE ALLOCATION • MAXIMUM STORAGE IS 4 MEGABYTES DEVICE-INDEPENDENT i/O • ANALOG PLL DATA SEPERATOR TRUE RANDOM ACCESS TO RECORD IN ONE ACCESS SYSTEM FEATURES MONITOR WITH 29 BUILT-IN COMMANDS • FORMAT UTILITY LOGS OUT DEFECTIVE SECTORS FULL ENGLISH ERROR MESSAGES • DISK/FILE COPY WITH WILDCARD SELECTION FILE NAMES 12 CHARACTERS + EXTENSIONS • SYSTEM CUSTOMIZATION UTILITY FILE SIZE UP TO 1 MEGABYTE • VISIBLE MEMORY TERMINAL DRIVER PROVIDED UP TO 247 FILES PER DISK DRIVE • INTERCHANGE CODOS SOFTWARE INDIVIDUAL WRITE PROTECT ON FILES AMONG KIM, SYM, AIM, PET SYSTEMS WORKS WITH AIM EDITOR, ASSEMBLER. • IN FIELD USE FOR OVER 6 MONTHS BASIC AND MONITOR ROMS SUPERVISOR CALLS AVAILABLE TO USER PROGRAM

K-1013M Hardware Manual-$10, K-1013-3M CODOS manual-$25, K-1013-3D RAM/Disk controller with CODOS-$595, Floppy drives, cables, power supply also available.

MASTERCARD & VISA accepted

WRITE OR CALL TODAY FOR OUR 48 PAGE FALL 1980 CATALOG DESCRIBING ALL MTU 6502 PRODUCTS, INCLUDING 320 BY 200 GRAPHICS, AIM GRAPHIC/TEXT PRINT SOFTWARE, BANK-SWITCHABLE RAM/ROM/I-O, AIM CARD FILE, POWER SUPPLY AND MORE! Micro Technology Unlimited • 2806 Hillsborough St. • P.O. Box 12106 • Raleigh, N.C. 27605 • (919)833-1458 How Microsoft BASIC Works

What is a variable? How are backgrounds, and obviously may be allowed 255 subscripts; the real restric­ variables manipulated? This skipped if you know the jargon. Next I tion is the line length which limits you article gives the answers to both will describe the actual formats of both to twenty or so. For example, DIM of these questions and numeric and string variables. Then I XI (2) allots space for a singly- discusses the similarity of FNx will give a brief discussion of how subscripted FP array, and has room for definitions to variables as well. BASIC uses RAM. Finally, I will com­ 3 numbers — X1(0), Xl|l), and Xl(2). bine all of the above to describe Further, DIM Xl%(20) allots space for variable storage formats, and explain an array of 21 integer variables, and Greg Paris their coding. DIM Xl$(10,3) partitions space for a 625 Main St., #642 doubly-subscripted array of 44 Roosevelt Island Definitions [(10+1) x (3 +1)] different strings. (A New York, New York 10044 technical note: if an array is not dimen­ I caution the more advanced reader sioned before it is used, the All computer languages are, to some that I am not a software development will automatically execute a DIM com­ extent, symbolic in nature. This means engineer, and may not use the approved mand and thus assign each subscript that addresses, constants and variables industry-standard terminology. the default value of 10.) may be used throughout a program and be manipulated by their labels, instead Legal Variable Name: The BASIC Header: I define a header as any in­ of using absolute or true values. manual defines a legal variable name to formation about a variable (how it is Although the use of symbols is often be “any alphabetic character, and [it] stored or referred to) that is stored merely convenient — as in assembler may be followed by any alphanumeric along with the data to which it refers. texts — in many circumstances the character... Any alphanumeric For example, if the interpreter requires concept permits manipulations which characters after the first two are ig­ information about an array, including otherwise would be impossible. nored." In addition, one cannot embed its size, how many subscripts, and the Algebraic variables in BASIC or reserved words into the variable name values of those subscripts, then the in­ FORTRAN are just one important case. |A$ and AAAAAAA are legal variable terpreter will group all this informa­ For these reasons, how a computer names; %A is not, and. neither is tion, along with the variable name, in­ language defines and manipulates sym­ AGOTO). to a header — the small block o f1 ‘data’' bols is fundamental to the structure which immediately preceeds the real and operation of whatever interfaces Variable: To the interpreter, a data in the array. A header may be as between the user and the opcodes — an variable is anything that is not an array short and simple as the 2 bytes of an en­ interpreter, compiler, etc. (no joke!). Any time you need to refer coded variable name, or as detailed as to only one number, or one string, or the example just given. The varieties of symbol types allowed one whatever, it will be called a in any language determine, to a great variable. For example, XI is a floating­ . WOR Address Format: When a extent, the power of that language to point (or FP) variable, XI % is an in­ 16-bit address is to be stored in an 8-bit solve certain programming problems. teger variable, and X l$ is a string machine, it can be stored first byte The inherent accuracy of mathematical variable. They are stored in different (MSB) first, second byte (LSB) second, calculations is another example where ways internally so the interpreter can­ or in the reverse order. In assembler the format of variable storage is not be confused by these three identical notation, the MSB-first arrangement is critical. variable symbols. You may be confused often referred to as ".D BY " (for "Dou­ however, so use caution in such cases. ble BYte''), whereas the reversed order For these reasons, a logical first step — LSB-fiist — is called ".WOR” order in dissecting the operation of the Array: An array is any group of (for “WORd” ). Almost all addresses BASIC interpreter is to find out how it variables which is referred to by a com­ handled by the BASIC interpreter are defines its symbols, and how it stores mon legal variable name, followed by a stored in .WOR format, including those them. The actual arithmetic and string list of subscripts — also called indices. that may be embedded in headers. manipulation is more complicated, and The BASIC manual sometimes refers to will be left for a later article. arrays as "matrices.” An array may Numeric Variables contain either integer or FP numeric This article is organized as follows. data or strings, but no more than one There are two types of numeric data First, I will make a few definitions. type per array. You are, in theory, allowed in BASIC: integer and floating­ This will level out most readers' point (FP). An integer number is stored

No. 36 - May 1981 MICRO - The 6502 Journal 31 in two bytes, and can represent any in­ need not confuse you, since in the FPA String Variables teger between +32,767 and -32,768. this bit is defined as being set, unless An FP number is stored in 5 bytes (4 the number equals zero. Therefore, if it The "value” of a string variable, bytes on OSI) and can represent will always be 1, then it can be ignored and the information stored in a string numbers between ±1.7xl038 and during storage and used for another pur­ variable (or array) in RAM, are two dif­ ± 2.94 x 10~39, and zero. This format pose, namely, to store the sign of the ferent things. The two items actually for FP numbers allows at least 9 mantissa compactly.) In addition, there stored in the "variable" or "array" are decimal digit accuracy at all times. is a byte (see figure 1-A) which actually a pointer (or a list of pointers) in .WOR extends the FPA mantissa by 8 bits. It format to the start of the string, and the Since FP arithmetic as done by the is used internally in all arithmetic length of the string. The string may be BASIC interpreter is not germane, I will operations, but is rounded off and strip­ embedded in a program line, or stored not detail its function in this article. ped whenever a variable is removed in "top free space" (high RAM). Suffice it to say that there exists, in from the FPA. The first byte of the FPA zero-page RAM, temporary storage is the exponent of the number plus $80. areas for two FP numbers. The one If the number equals zero, then this most used is the floating-point ac­ byte is zero. If the string is empty ("null"), then cumulator (or FPA) and is located at the the byte for string length is set to zero, addresses shown in figure 1-A. The FPA Both types of variables, if referred to and although it will then be ignored, is five to seven bytes long — the second before being assigned a specific both bytes of the pointer are zeroed. byte of the FPA contains the sign of the numeric value [i.e., if you use a The size of any string is limited to 255 mantissa, which is incorporated into previously undefined variable), will be characters because a single byte is used the leftmost bit (MSB) of the mantissa filled with 0's — hence, the default to indicate its length. whenever a number is removed from value in each case is zero. the FPA. (The use of this bit for the sign

Figure 1-A: Locations of Floating-Point Accumulators.

Computer: AIM 65 Applesoft OSI Old PET New PET (BASIC- (1.0) (2.0, 4.0) in-ROMJ Length of FPA 6 bytes 7 bytes 5 bytes 6 bytes 6 bytes Address of FPA $00A9-$00AE $009D-$00A3 $00AC-$00B0 $00B0-$00B5 $005E-$0063 FPA extension $00B8 ($00 A3) $00B2 $00B7 $0065

Figure 1-B: BASIC Utility Pointers.

Computer: AIM 65 Apple OSI Old PET New PET (BASIC-in-ROMJ Address of pointer to: Start of BASIC program $0073 $0067 $0079 $007A $0028 (address:) ($0212) ($0801) ($0301) ($0402) ($0402) Start of variable storage $0075 $0069 $007B $007C $002A ($PPPP) Start of array storage $0077 $006B $007D $007E $002C ($RRRR) Start of free space $0079 $006D $007F $0080 $002E ($UNUN) Top (end) of free space $007B $006F $0081 $0082 $0030 | $TTTT] Top of memory $007F $004C $0085 $0086 $0034 ($NONO)

32 MICRO - The 6502 Journal No. 3 6 -M a y 1981 User Functions Table 1: Format of encoding different types of variable names. DEF and FNx are BASIC program statements which allow a user to define If the legal variable name is AC, then: a unique function. Each FNx is labeled by a legal variable name, and this is if the variable is then the symbol is encoded why I discuss this statement in an arti­ as these two bytes: cle on variables. As detailed later, the BASIC interpreter stores a reference to a floating point numeric (no suffix) $41, $43 (MSB each byte clear) each function definition in a complex header, filed under the variable name an integer numeric (suffix = %) $C1, $C3 (MSB each byte set) which is assigned to it by the user. a string (suffix = $) $41, $C3 (MSB first byte clear, How BASIC Uses RAM MSB second byte set)

A memory map of how BASIC parti­ an FNx definition variable $C1, $43 (MSB first byte set, tions space for its various needs is MSB second byte clear) shown in figure 1-B. "Top free space” may be a new term to some readers. When BASIC is commanded to operate on strings, it designates an area in Figure 2: Variable and Array Storage Formats unused memory as work space [from $UNUN to $TTTT - 1), and then stores VARIABLES: the result of any operation in "top free space” (from $TTTT to $NONO — 1). Floating Point Numeric

Also listed in figure 1-B are the zero- M J Q j 5. page locations which are reserved by BASIC to store pointers to various ad­ encoded ^ dresses which are used frequently. variable floating point number in These pointers are initialized upon en­ name storage format try into BASIC, and are updated any time the program is changed or run. All pointers are stored in .WOR format. Integer Numeric XX XX _1_ 2_00 00 00 How Variable Names are Encoded L .— f '—- 1 <-W v___^---- encoded 'v variable integer allotted, but unused and BASIC reserves 2 bytes for the name number filled with zeros variable name (symbol). However, since the same name could refer either to an integer, FP variable, or a string, it String Header must distinguish between them. It does this by setting or clearing, in various XX XX i# PI P I’00 00 combinations, the otherwise unused leftmost bit (MSB) of each of the two encoded bytes in the name. All four possible variable number ►pointer, .WOR format permutations are used. The interpreter name of bytes to first byte in string performs this encoding during a RUN in string whenever a new variable name is en­ countered, and uses the format describ­ ed in table 1. If a variable name is only a single character, then the second FNx Header character space allotted to it is filled with 0's, except for the MSB, which is 30C XX P2P2P 3P3Q Q set or cleared as needed. Jffirst byte of actual / definition for this FNx Storage Formats pointer to first byte of FP number Most of the details of variable for­ used as dummy argument variable mat and variable name encoding have (byte numbered 1 above) been described. All that remains is to put the information together and pointer to the first byte of FNx describe what is actually found in definition in BASIC program storage memory from $PPPP to $UNUN - 1 .

No. 36 - May 1981 MICRO - The 6502 Journal 33 Variables are stored together, but separate from the airays. However, in­ Figure 2 continued teger numeric, FP numeric, string, and FNx definition variables are all inter­ ARRAYS: mixed. Arrays are stored in the next higher allocated RAM, and are also in­ Floating Point Numeric termixed. In both cases, the jumbled order is actually a function of when header they are defined during the RUNning of /— ------— / \ _ a program. Each variable or array that is j g o o c , ,## ## ## XNXNXMXM ■\ interpreted is assigned a space in the nr order in which it is encountered, with encoded number of the variables and the arrays, each shut­ variable subscripts tled off to their respective spaces. name dimensioned

There is a reason for separating five byte variables from arrays. Each item stored floating point as a variable takes up exactly 7 bytes. number This makes searching for variables very number of bytes in easy, as the interpreter's variable XN XN is the maximum index array, including header pointer need only increment by 7 bytes for each subscript (including and all subsequent to look for the next variable. Since ar­ zero): .WOR format bytes: .WOR format rays can vary greatly in size, this technique is not applicable, and scan­ ning for individual array entries is somewhat more time consuming.

Each time the program begins RUN­ Integer Numeric ning, it executes a CLEAR instruction, which erases any reference to any two byte integer number variables and arrays which may have (.DBY storage format) previously been defined. This CLEAR instruction sets the pointers located at X XX XX ## ## ## XN XN XM XM .... 12 $0075, $0077, and $0079 (on the AIM) to the same value — the address of the ■ last byte of program storage, plus one. header same as above; Similarly, the pointer at $007B ("top variable name encoded free space” ) is set to equal the address differently in $007F (top usable memory + 1).

String The headers for variables and ar­ number of rays, and the formats in which they are bytes in stored in RAM, are shown in figure 2. string

The definition of a header should be clearer now. In both types of numeric variables, the header is simply the 2 bytes of the encoded variable name. More complicated arrangements are seen in the FNx header and the various array headers.

Variables: For an FP variable, all 7 bytes are utilized. The last 5 bytes represent the FP number, in RAM two byte pointer storage form as described above. to string: .WOR format

34 MICRO - The 6502 Journal No. 3 6 -M a y 1981 Legend for Figure 3 An integer variable only uses 4 of the 7 bytes allotted to it. Use of integer A. Test program in BASIC. variables in your program therefore B. Zero page pointers to partitions in RAM (see figure 1-a). wastes some space, but could save time during interpretation. C. Dump of tokenized test program (partial). Note that D$ is found at $025B, and the definition of FNQ at $0241. The string "variable” has a 5-byte D. Dump of variable and array storage. header, made to fill 7 bytes by tacking a Note that the order of space assignment is identical to the discovered order bunch of zeros on the end. in the program. E. Contents of "top free space”, includes 'value' of E2$, found at $0FF1. The FNx header is very interesting. It is filed as a variable because it is defined with a variable name. Any legal A. variable name may be used as its label. In addition, any legal variable name 10 DIM A A (2),B% (2,3) may be used as the dummy argument 20 AA=2:B%=17 variable, even one used elsewhere in 30 DEF FNQ(X)=X*AA the program, because before the inter­ 40 C=5.7207 preter evaluates an FNx statement, it saves the value which was originally 50 D$="A STRING" stored in the dummy variable on the 60 DIM C (2) stack. If the dummy variable is a new 70 F%=-24 variable, it is automatically created, 80 E2$="IS NOT "+D$ allotted 7 bytes of space after the FNx 90 STOP header, and appropriately labeled as an FP variable. The FNx header is set up B. whenever a DEF FNx is performed. If this particular FNx is later redefined, == 0073 12 02 BASIC PROGRAM STARTS AT $0212 only the original header is changed. < > 0075 98 02 VARIABLES START AT $0298 The last byte in the header might not < > 0077 DO 02 ARRAYS START AT $02D0 be used by the interpreter; it seems to < > 0079 ID 03 FREE SPACE STARTS AS $031D be there only to clear the stack com­ pletely during the DEF FNx operation. < > 007B FIOF FREE SPACE ENDS AT $0FF1 < > 007F 00 10 TOP OF MEMORY IS $1000 Anays: Not only do arrays have longer headers, but they also utilize space more efficiently. There is no C. minimum allotment of space, and con­ =0212 26 02 NEXT LINE IS AT $0226 sequently, no filler bytes are necessary. < > 0214 0A 00 THIS IS LINE 10 FNx arrays are not supported in this < > 0216 85 20 'DIM 1 TOKEN, SPACE version of BASIC. < > 0218 41 41 'AA* < > 021A 28 32 ' (2 1 < > 021C 29 2C The headers for each type of array < > 021E 42 25 ' B % ' are essentially identical in format and < > 0220 28 32 • (2' content. The first two bytes are the en­ < > 0222 2C 33 ' ,3* coded array name (see table 1). The < > 0224 29 00 ') ' , END OF LINE next pair of bytes is a 16-bit number < > 0226 35 02 NEXT LINE IS AT $0235 (.WOR format), the total number of THIS IS LINE 20 bytes in the array. This includes the < > 0228 14 00 header with all its subscripts spelled < > 022A 41 41 'AA' 1 — 1 out, and all the space allotted for the < > 022C AC 32 TOKEN, '2' variables or string pointers. The fifth < > 022E 3A 42 ' : B ' byte represents the number of sub­ < > 0230 25 AC '%' , TOKEN scripts used. The remainder of the ' 17' header is a list of subscripts — a series < > 0232 31 37 of 16-bit numbers in .WOR format, one < > 0234 00 END OF LINE for each subscript — in an order that is < > 0235 46 02 NEXT LINE IS AT $0246 the REVERSE of the listed order in the < > 0237 IE 00 THIS IS LINE 30 DIM statement. < > 0239 95 20 'DEF ' TOKEN, SPACE < > 023B 9F 51 'FN' TOKEN, 'Q' < > 0 2 3D 28 58 ' (X'

No. 36 - May 1981 MICRO - The 6502 Journal 35 The actual storage format of the ar­ i — i ray contents is much the same as for a < > 023F 29 AC ') TOKEN single variable. Each member of an FP < > 0241 58 A6 ■X', • * • TOKEN array is allotted five bytes for storage, < > 0243 41 41 'AA' and each member of an integer array is < > 0245 00 END allotted two bytes. Therefore, in con­ < > 0246 53 02 NEXT trast to an integer variable, using in­ $0253 teger arrays not only saves interpreting < > 0248 28 00 THIS IS LINE 40 time but also a tremendous amount of < > 024A 43 AC 'C' , ’ = ' TOKEN space as well. Each entry in a string ar­ < > 024C 35 2E '5.' ray is allotted three bytes, as before. < > 024E 37 32 '72' < > 0250 30 37 '07' Within the array, individual members are ordered in straightforward < > 0252 00 END i fashion, but not as simply as you’d ex­ < > 0253 65 02 NEXT pect. Just as in the array header, the in­ < > 0255 32 00 THIS IS LINE 50 dividual members of an array are in a < > 0257 44 24 ' D$ ' ‘'reversed” ascending sequence. For < > 0259 AC 22 I .V I ■ n i example, if the statement DIM A(2,4) < > 025B 41 has been executed, then the order of 20 'A ' members in the array is A|0,0), A[ 1,0), < > 025D 53 54 'ST' A(2,0j, Af 0,1), A( 1,1), A(2,1), —, < > 025F 52 49 ' RI ' A(l,4), A(2,4). By analogy, this can be < > 0261 4E 47 'NG' extended to any number of subscripts. < > 0263 22 00 i ii i END OF LINE An example is seen in figure 3. This program is intended only to demon­ strate variable and array assignment. Note that all the pointers — FNQ and strings — point to the beginning of D. their respective referents. All the variables are ordered in the sequence in ==0298 41 41 FP VARIABLE 'AA' which they were interpreted; the arrays < > 029A 82 00 VALUE IS 2 are similarly arranged in higher RAM. < > 029C 00 00 Note the encoded variable names for 029E 00 each assignment. < > < > 029F C2 80 INTEGER VARIABLE 'B' < > 02A1 00 11 VALUE IS 17 < > 02A3 00 00 Summary < > 02A5 00 The following conclusions are of in­ < > 02A6 D1 00 FN 'Q' terest to anyone wishing to save execu­ < > 02A8 41 02 DEFINED AT $0241 tion time and/or memory space. 1) The < > 02AA AF 02 DUMMY VARIABLE VALUE AT $0 2AF use of an integer variable is generally a < > 02 AC 58 waste, for two reasons: the integer < > 02AD 58 00 FP VARIABLE 'X' must be defined by a ” % " each time it 02AF 00 00 occurs (at the cost of 1 byte per occur- < > VALUE IS 0 rance), and, since it takes up 5 bytes < > 02B1 00 00 anyway, even this doesn't save space. < > 02B3 00 2) An integer array really does save < > 02B4 43 00 FP VARIABLE 'C' space, if it is of sufficient size. 3) You < > 02B6 83 37 VALUE IS 5.7207 can save a few bytes, and shorten ex­ < > 02B8 OF F9 ecution time slightly, by using as a dummy argument variable one that has < > 02BA 73 already been used in the program. Its < > 02BB 44 80 STRING VARIABLE 'D' (D$) actual value will not be lost during the < > 02BD 08 8 BYTES OF DATA execution of an FNx. < > 02BE 5B 02 AT $025B < > 02C0 00 00 These storage formats are not specific to one machine, and apply to < > 02C2 C6 80 INTEGER VARIABLE 'F' (F%) those versions of Microsoft BASIC < > 02C4 FF E8 VALUE IS -24 which are used on AIM, SYM, PET, < > 02C6 00 00 OSI, Apple, etc. < > 02C8 00

36 M ICRO-The 6502 Journal No. 3 6 -M a y 1981 < > 02C9 45 B2 STRING VARIABLE '2' (E2$) Ed. Note: Integer variables are not < > 02CB OF 15 BYTES OF DATA supported by OSI and SYM BASIC. < > 02CC FI OF AT $0FF1 All you need to know about < > 02CE 00 00 variables is here. Now you can design an UNDIM command, or figure out < > 02D0 41 41 FP ARRAY 'AA' how to support FNx arrays. Or you can < > 02D2 16 00 USES 22 BYTES construct your own DATA SAVE and < > 02D4 01 1 SUBSCRIPT DATA LOAD routines for BASIC, link­ ing them to the USR function, if < > 02D5 00 03 SUBSCRIPT = 2 necessary. What you will need in addi­ < > 02D7 00 00 ARRAY ELEMENTS ARE ALL 0 tion to this article is the knowledge of which BASIC subroutines handle the < > 02E6 C2 80 INTEGER ARRAY 'B' (B%) finding of specific variables, or of < > 02E8 21 00 USES 33 BYTES specific entries in arrays, and how < > 02EA 02 2 SUBSCRIPTS these subroutines work. I plan to ad­ < > dress these and other topics in subse­ 02EB 00 04 SUBSCRIPT 2 = 3 quent articles. < > 02ED 00 03 SUBSCRIPT 1 = 2 < > 02EF 00 00 ARRAY ELEMENTS ARE ALL 0 rLt == 0FF1 49 53 'IS' < > 0FF3 20 4E ' N' Greg Paris has been doing postdoctoral research in neurobiology, and hopes to < > 0FF5 4F 54 'OT' program microcomputer-based < > 0FF7 20 41 ' A' instrumentation for a living. < > 0FF9 20 53 ' S' < > OFFB 54 52 'TR' JMCftO < > OFFD 49 4E ' IN' < > OFFF 47 'G'

I6K MEMORY 32 K BYTE MEMORY EXPANSION KIT RELIABLE AND COST EFFECTIVE RAM FOR 6502 & 6800 BASED MICROCOMPUTERS FOR APPLE, TRS-80 KEYBOARD, AIM 65-*KIM*SYM EXIDY, AND ALL OTHER 16K DYNAMIC SYSTEMS USING PET*S44-BUS M K 4116-3 OR EQUIVALENT DEVICES. * PLUG COMPATIBLE WITH THE AIM-65/SYM EXPANSION CONNECTOR 'BY USING A RIGHT ANGLE CONNECTOR * 200 NSEC ACCESS, 375 NSEC (SUPPLIED) MOUNTED ON THE BACK OF THE MEMORY CYCLE BOARD. * MEMORY BOARD EDGE CONNECTOR PLUGS INTO THE * BURNED-IN AND FULLY 6800 S 44 BUS. TESTED * CONNECTS TO PET OR KIM USING AN ADAPTOR CABLE. * RELIABLE— 0YNAMIC RAM WITH ON BOARD INVISIBLE * 1 YR. PARTS REPLACEMENT REFRESH-L00KS LJKE STATIC MEMORY BUT AT GUARANTEE LOWER COST AND A FRACTION OF THE POWER REQUIRED FOR STATIC BOARDS. * QTY. DISCOUNTS AVAILABLE * USES +5V ONLY, SUPPLIED FROM HOST COMPUTER. * FULL DOCUMENTATION. ASSEMBLED AND TESTED BOARDS ARE GUARANTEED FOR ONE YEAR ANO ALL ASSEMBLE!) BOARDS AND PURCHASE PRICE IS FULLY REFUNDABLE IF BOARD IS RETURNED UNOAMAGED WITHIN 14 DAYS. MEMORY CMPS CARRY A HILL ONE ASSEMBLED WITH 32K RAM ...... YEAR REPLACEMENT WARRANTY 4 WITH 16K RAM...... TESTED WITHOUT RAM CHIPS...... HARD TO GET PARTS (NO RAM CHIPS) WITH BOARD AND MANUAL ...... n r *=» BARE BOARD & MANUAL ......

I230 UU.COllinj fiVE. - -V.:EvT CONNECTS THt 32K R AM BOAhD to \ -FT CONTAINS PFACF CARi t BOARD S Sij^’iY M0tFiCAT-0N Kir ;.U0 ORAflGE, Cfl 912668 ' \ S ^ l C : '0N3 549 00 (714)633 7280 • 'Ms pii'H sc ddcl h s jIp s f

No. 36 - May 1981 MICRO-The 6502 Journal 37 SYM-1 Communications Interface

This program acts as a traffic The solution turned out to be There are three characters which cop in a three-way conversation shorter than I first expected. About half ,, have special meaning to these input between a SYM, a human at a of the work involved setting up the routines. The BELL character (hex $07 CRT, and another computer via a hardware and control bits the right — control G on my CRT) is used to in­ modem. It directs messages to way, and the other half was writing a dicate the start of a string to go to the either the SYM or the modem on short interface routine. Mechanically, monitor. The BELL is not sent to the the request of the human the modem and the CRT have to be set monitor, but all characters following it, operator, and makes sure the up in full duplex mode, so they don't up to and including the next carriage human gets to see both ends of echo any characters. The SYM monitor return (hex $0D), do get sent. The will take care of that if we set the high semicolon |hex $3B) is very similar in the conversation. order bit of TECHO on. The echo por­ meaning to the BELL, except that the tion of the SYM monitor terminal in­ semicolon itself is also returned to the Nicholas J. Vrtis put routine doesn't care where a bit monitor. This allows the transfer of 5863 Pinetree S.E. comes from when it echoes it. Bits four paper-tape-format hex dumps to the Kentwood, Michigan 49508 and five of TOUTFL control which SYM without requiring my program to device the input byte is echoed to. It precede each line with a BELL (and doesn't necessarily have to be the one it driving me crazy). I left four extra bytes It all started when I wanted to use an came from. If we set TOUTFL to enable in the program after the compare for accoustic coupler to transfer programs input from both the CRT and the TTY, the semicolon so you could change it to to my SYM from another computer. At but only output to the CRT, then look for a range of characters. If you first glance, it looks easy enough. Hook anything from either input device will patch the following in, you can check the modem to the 20 mA TTY port, and be echoed to the CRT. Setting TOUTFL for numerics as the key character in­ connect the CRT to the RS 232 port. this way also means that any output stead of the semicolon. The problem with this arrangement is from the monitor will only go to the that although the two devices are elec­ CRT port, and not to the modem. It CMP #‘0’ Check if less than tronically separate, the SYM monitor also means that anything entered at the ASCII zero doesn’t distinguish between data CRT will not get transmitted to the BCC TRYP Branch if less received from these two ports. There modem, so we will have to use soft­ are status bits in TOUTFL ($A654) ware later on to turn the TTY output CMP Colon is ASCII nine which will allow me to control input bit back on when we want it. Finally, + 1 and output to each of the devices this requires that the modem and the BCS TRYP Branch if greater separately, but the SYM still won't tell CRT are both operating at the same or equal me where a character came from. There baud rate. is also a bit in TECHO ($A653) which can be used to control echoing This arrangement would be useful characters to either the CRT or TTY. when transferring a BASIC program or The real problem though, is that I only other data with line numbers. Watch wanted som e data from the modem to Now that we have the system all out for the number of null characters be handed to the SYM monitor. It wired up, and the bits set, we find that which BASIC needs at the end of a line wouldn't have the foggiest idea what to things are arranged so anybody can talk for timing. The final special input do with a sign-on request from the to the CRT, but nobody can talk to character is the DLE [hex $10 — con­ other computer. The same is true for anybody else accidentally. Now for a trol P on my CRT). This performs the data from the CRT, only worse. Some little software to add some smarts to modem function corresponding to the of that had to go to the monitor to tell it the thing, and we are all set. The SYM BELL for the monitor. The method is to expect a program, and some had to vectors all input via an address in different, though. Instead of returning a go to the modem to tell the other com­ System RAM at $A661, called INVEC. character via an RTS, the DLE routine puter to start sending it. Finally, I By putting the address of our routine causes the TTY output enable bit to be wanted to see all the data from both the there, it will have a chance to look at turned on in TOUTFL. When this bit is monitor and modem on the CRT, and all the input and decide what to do with on, the SYM input routines will echo didn't want the monitor data to be it, to a certain extent. We won't bother all characters from the CRT to both the transmitted by the modem. For the with the output side; we just have to be CRT and the modem on the TTY port. same reason I couldn’t give data from careful not to go to the monitor with As with the BELL, the 'to modem' the modem to the monitor. the TTY output enable bit on. mode is in effect up to and including

38 MICRO - The 6502 Journal No. 3 6 -M a y 1981 the next carriage return. Unfortunate­ ly, there isn’t any way to implement a modem equivalent of the semicolon. 0800 1 >*** Once a character has been received 0800 2 * from the CRT, there just isn't enough 0800 3 ;* SYM-1 MODEM COMMUNICATIONS * time to turn around and transmit it via 0800 4 ;* INTERFACE ROUTINE * 0800 5 ;* * the TTY port. It technically could be 0800 6 ;* BY NICHOLAS J. VRTIS * done, but the person at the CRT would 0800 7 ;* * 0800 8 have to make sure that he waited at 0800 9 >* least one character time between each 0800 10 0800 11 MODFLG EPZ $FA SPARE SYM-1 P.Z. AREA keystroke. If you type too fast, you end 0600 12 TOUTFL EQU $A654 TERMINAL OUTPUT FLAG BYTE up transmitting garbage. 0800 13 INTCHR EQU $8A58 TERMINAL INPUT ROUTINE 0800 14 ACCESS EQU $8B86 0800 15 OFCO 16 ORG $FC0 BACK OUT OF THE WAY The special input characters are 0PC0 17 OBJ $800 looked for only when the output hasn't OFCO 18 OFCO 20588A 19 MODEM JSR INTCHR GET AN INPUT CHARACTER already been directed to either the 0FC3 297F 20 AND |$7F STRIP PARITY monitor or the modem. Similarly, the 0FC5 24FA 21 BIT MODFLG CHECK CURRENT MODE 0PC7 3027 22 BMI TCMON BRANCH IF T O THE MCNITOR carriage return is only meaningful if 0FC9 702C 23 BVS TCMOEM OR IF TO THE MODEM one of the output modes is set. Be 0PCB 24 0PCB C93B 25 CMP #*;1 IS THIS FOR THE MONITOR careful, though, because a carriage 0PCD D007 26 BNE TRYP NO return from either the modem or the 0FCF 27 CRT will reset the flags to output to 0FCF EAEAEA 28 HEX EAEAEAEA PATCH AREA FOR EXTRA COMPARE 0BD2 EA neither the monitor nor the modem. 0FD3 29 The special input characters don’ t have 0FD3 66FA 30 ROR MODFLG ROLL CARRY INTO FLAG FOR 'TO MONITOR* 0FD5 60 31 RTS AND THIS WILL GIVE IT TO MONITOR to be at the beginning of a line, so it is 0FD6 32 possible to have the 'to monitor mode’ 0FD6 C907 33 TRYP CMP |$07 MONITOR SELECT CODE ?? 0FD8 D004 34 BNE TRYS NO set accidentally by the other computer. 0FTA 66FA 35 ROR MODFLG ROLL CARRY TO SET 'TO MONITOR' BIT If you know, and/or think that these 0FDC D0E2 36 BNE MODEM AM) IQ40RE THIS CHARACTER 0FDE 37 .* characters might arrive unexpectedly OTOE C910 38 TOYS CMP #$10 MODEM SELECT CODE? from the other computer, you may 0FE0 DODE 39 BNE MODEM ' NO—IGNORE THIS CHARACTER 0FE2 40 .* want to change the character looked for 0FE2 A2F0 • 41 LDX #$F0 TURN ON TTY OUTPUT ALSO in the comparisons to something you 0FE4 A940 42 Lift #$40 YES—TURN ON 'TO MODEM' MODE 0FE6 20868B 43 STFLAG JSR ACCESS MAKE SURE CAN UPDATE SYSTEM RAM probably won’t be getting. The routines 0FE9 8E54A6 44 STX TOUTFL STORE NEW FLAG SETTING are not set up to allow a 'to modem' 0FEC 85FA 45 STA MODFLG STORE NEW MODE SETTING and ‘to monitor' mode at the same 0FEE DODO 46 BNE MODEM UNCONDITIONAL— IQWRE THIS ONE 0FF0 47 ! time. You can have one, or the other, or 0FF0 C90D 48 TCMON CMP #$0D IS THIS NEXT CARRIAGE RETURN? neither, but not both. If you want a pro­ 0FF2 D002 49 BNE *+4 NO—PASS IT CM 0FF4 85FA 50 STA MODFLG YES—SET MODE BITS OFF gram on the SYM to talk to the modem, 0FF6 60 51 RTS AMD RETURN TO THE MONITOR .* simply have it turn on the TTY output 0FF7 52 $ 0FF7 C90D 53 TCMCCM CMP #$0D WAS IT A CARRIAGE RETURN? bit in TOUTFL before outputting, and 0FF9 D0C5 54 BNE MODEM NO-IT IS ALREADY ECHOED TO THE TTY turn it off when done. OFFB A2DO 55 LDX i$D0 YES—TURN OFF TTY ECHO BIT 0FFD D0E7 56 BNE STFLAG NEW FLAG, $0D TURNS OFF MODE SET 0FFF 57 0FFF 58 ZZZEHD EQU *-1 LAST BYTE OF PROOttM My final disclaimer is that these routines were not designed for long in­ volved conversations between you and other computers. They were designed merely to transfer programs to the SYM. It can get rather tedious [not to mention noisy) preceding everything 3. TECHO must be set to $80 so input 9. No direct provision is made for the with BELL's and DLE. is echoed to the CRT. CPU to talk to the modem. Functions: 4. THE CRT must be in full duplex mode. V gets returned to the monitor and sets 'TO MONITOR' mode. SYM-1 Modem Communications Interface! 5. Address of 'MODEM' replaces address of 'UMTCHR' in 'INVEC'. All following characters to next C/R also go to monitor. Theory: 6. 'MODEM' is normally waiting to 1. The terminal is connected to the return a character to the monitor via Bell ($07) does not go to monitor, CRT RS-232 port, the modem is the RTS. but does set 'TO MONITOR' mode. All connected to the 1 1Y port. following characters to next C/R also 7. The CRT and TTY must be at the go to the monitor. 2. TOUTFL is set to $D0 — TTY and same speed. CRT input enabled, and TTY output DLE ($10) does not go to modem, disabled. Therefore any input from 8. To direct output to the modem from but does set 'TO MODEM' mode. All either TTY or CRT will appear on the CRT, the TTY echo bit is turned following characters to next C/R also the CRT. on in TOUTFL. go to the modem. JUCRO

No. 3 6 -M a y 1981 MICRO-The 6502 Journal 39 Annual Index June1980—May 1981 (Issues 25 - 36) ------Articles------

Title/Author Issue/Page AIM Share Your AIM Programs 25:23 A Better Apple SEARCH/CHANGE 32:17 Jody Nells J.D. Childress AIM-65 File Operations 26:61 Make a Clear, Plastic Cover for your Apple 32:53 Christopher J. Flynn E.J. Nelburger Satellite Tracking with the AIM-65 27:13 Searching String Arrays 33:57 C.R. MacCluer Gary B. Little Loading KIM-1 Tapes to AIM 28:19 A Simple Securities Manager for the Apple 33:7 Larry P. Gonzalez Ronald A. Quest Compact 28:25 In the Heart of Applesoft 33:31 Steve Bresson C. Bongers Tiny PI LOT for the AIM 28:59 UnwrApple 34:11 Larry Kollar and Carl Qutekunst David Lubar An improved Morse Code Receive Routine and Interface 29:23 Reset Protection for the Apple II 34:89 Marvin L. DeJong Joe Brady Biorhythm: An AIM BASIC Programming Exercise 29:51 S-C Assembled Modifications 35:7 P.E. Burcher Ned W. Rhodes AIM 65 File Operations: Writing Text Files with BASIC 30:65 Apple Memory Maps 35:27 Christopher J. Flynn Peter A. Cook A Random-Character Morse Code Teacher for the AIM 65 31:21 Integer Basic Internals (Apple) 35:65 Eugene V. Weiner, Marvin L. DeJong, Russell V. Lenth Glenn R. Sogge AIM 65 File Operations 32:29 MacApple 36:9 Christopher J. Flynn David Lubar One-Dimensional Life on the AIM 65 33:50 Applesoft Variable Dump 36:23 Larry Kollar Scott O. Schram A Relocating Loader for Al M Tape 34:25 Apple Memory Maps — Part 2 36:45 Mel Evans Peter A. Cook MEMSEARCH for the AIM 65 35:17 Protecting Memory from DOS 36:81 Bob Kovacs Glenn R. Sogge APPLE A Little Plus For Your Apple II 25:7 ATARI Craig Peterson Introducing the Atari 800 25:35 APPLE II Integer BASIC Program List by Page 25:37 William L. Colsher Dave Partyka Atari Notes 27:57 BASIC and Machine Language Transfers with William L. Colsher Micromodem II 25:47 A Versatile Hl-Res Function Plotter for the Atari George Dombrowski 400 & 800 30:47 TRACER: A Debugging Tool for the APPLE II 25:59 David P. Allen R. Kovacs Atari Bits 31:57 Zoom and Squeeze 26:37 Len Lindsay Gary B. Little Atari Real Time 32:35 Data Statements Revisited 27:7 Charlie and Mary Kozarski Virginia Lee Brady An Atari Assembler 33:17 Better Utilization of Apple Computer Renumber and William L Colsher Merge Program 27:17 Atari Error Messages 35:69 Frank D. Chipchase David P. Allen Solar System Simulation with or without an Apple II 27:33 The Atari Dulcimer 36:59 David A. Partyka Mike Dougherty Applesoft Floating Point Routines 27:53 R.M. Mottola KIM VISA— KIM 26:47 Business Dollars and Sense In Applesoft 27:65 Joel Swank Barton M. Bauers, Jr. A “Stop-on-Address” Routine for KIM 29:30 Creating Shape Tables, Improved! 28:7 R. MacDonald Peter A. Cook Full Disassembly Listing on Small Systems 32:37 A Versatile Hi-Res Function Plotter for the Apple II 28:49 Ralph Tenny David P. Allen Increase KIM-1 Versatility at Low Cost 33:57 Mean 14: A Pseudo-Machine Floating Point Processor for Ralph Tenny the Apple II 28:67 R.M. Mottola BASIC Program Converter Between SYM and KIM 35:79 Lee Chapel PRINT USING for Applesoft 29:14 Gary A. Morris KIM/SYM Home Accounting System 36:13 Robert Baker Paged Printer Output for the APPLE 29:47 Gary Little OHIO SCIENTIFIC Cassette Label Program 29:65 Put Your Hooks Into OSI BASIC 25:15 Dawn E. Ellis Edward H. Carlson Step and Trace for the APPLE II Plus 30:61 Hypocyclolds on the 540 25:57 Craig Peterson E.D. Morris Graphing Rational Functions 31:7 Challenger II Communications 26:53 Ron Carlson Peter Koskl An Apple Flavored Lifesaver 31:25 Interface of OSI C1P With Heath Printer 27:47 Gregory L. Tibbetts William L. Taylor Creating an Applesoft BASIC Subroutine Library 31:37 A C1P and H 14 System, Part 2 28:30 c N.R. McBurney William L. Taylor

40 MICRO - The 6502 Journal No. 3 6 -M a y 1981 An OSI Cheep Print 29*7 SYM Thomas Berger SYM-1 BASIC Pack Program 25:19 An Ultra-Fast Tape Storage System 30:11 George H. Wells, Jr. John E. Hart Slide Show for the SYM 25:53 Ohio Scientific Users: Stop those S ERRORS 30:37 David P. Kemp E.D. Morris, Jr. and Tim Flnkbelner SYM-1 Memory Search and Display 26:7 A C1P User's Notebook 31-11 Nicholas Vrtis Robert L. Elm SYM-Bell 30:17 Relocating OSI ROM BASIC Programs 31:61 Randy Sebra William L. Taylor Cassette I/O for SYM BASIC 31:65 Vectors and the Challenger 1P 32:21 Nicholas J. Vrtis Mike Bassman SYM Bridge Trainer 32:41 Fun with OSI 32:75 Len Green Leo Cain Improved Dual Tape Drive for SYM-1 BASIC 33:23 Why WAIT? 33-15 George Wells Robert L Elm SYM-pleSYM-on 34:15 A C IPSound Idea 33:71 Len Green David A. Ell SYM Time-Remaining Timer 35:37 Joysticks for the OSI C4 35:23 Ralph Orton Charles Platt SYM-1 Communications Interface 36:39 Oh No— It’s Garbage Collect 35:43 Nicholas J. Vrtis Gordon A. Campbell Tiny Pilot Follow-Up 36:71 Cursor Control for the C1P 3g.75 Nicholas J. Vrtis Kerry V. Lourash PET Lower Case Lister 25:11 GENERAL James Strasma 6502 Resource Update 25:65 PET-16 25:49 Dr. William R. Dial James Strasma Sorting Revealed 26:13 'Stop That PET’ - Update 25:64 Richard C. Vile, Jr. George R. Gaukel Variable Lister 27:19 Hello, World 26:31 Ray Cadmus John Sherburne Additions to Tiny Pilot 27:21 Son of Screen Print 27:61 Bob Applegate Kenneth Finn Nth Precision Add & Subtract With Adjusted Processor Auto-Run-Save, Y-t Plotter, Canary for the PET 28:14 Status 27:27 Werner Kolbe Lawrence R. Golla Define Your Own Function Key on PET 29:19 BCD Input to a 6502 Microprocessor 27:68 Werner Kolbe Richard Saltero For Multiple File Tape Backups 29:36 XREFER 28:34 G.R. Boynton Joel Swank Self-modifying PET Programs 30:29 Undedlcating a dedicated Microcomputer 29:27 P. Kenneth Morse David N. Borton Drawing a Line on PET’s 80 x 80 Grid 31:15 Tiny Pilot Complemental (Co-Pilot) 29:32 Harvey S. Davis Robert Schultz STUFFIT: A Time Saving Utility Program for PET Hexadecimal Printer 29:57 BASIC Flies 31:45 LeRoy Moyer Roger C. Crites Programming with Pascal 29:59 PET Symbolic Disassembler 32:23 John P. Mulligan Werner Kolbe How to Use the Hooks 30:7 PET String Flip 33:65 Richard Williams James Strasma John Conway's Game of Life Using Display Devices A Second Cassette for PET 34:81 With Automatic Scrolling 30:53 Jerry W. Froellch Theodore E. Bridge PRINT USING for the PET 35:13 Multiplying on the 6502 31:71 David Malmberg Brooke W. Boering An Inexpensive Word Processor 36:65 Keyboard Encoding 32:7 William F. Pytlik George Young

OHIO SCIENTIFIC USERS

SOFTWARE - GAME AND U T IL IT Y PROGRAMS FOR AS LOW AS $1.00. A L L WITH LISTINGS AND COMPLETE DOCUMENTATION.

KITS - UPDATE YOUR COMPUTER TO PLAY MUSIC, INCREASE OPERATING ME SPEED, HIGH RESOLUTION GRAPHICS AND MUCH MORE. KITS INCLUDE PARTS AND COMPLETE ASSEMBLY INSTRUCTIONS. LOW AS $3.00. £?2ili OUR $1.00 CATALOG INCLUDES OSI PROGRAMMING TIPS PLUS DESCRIPTIONS OF AVAILABLE PROGRAMS AND KITS. 3 N MITTENDORF ENGMEERMG 905 VLLA NUEVA DR. LfTCHFELD PARK,AZ 85340

No. 36 - May 1981 MICRO - The 6502 Journal 41 Interfacing the 6522 Versatile Interface Adapter 32:65 Automatic Keyboard 34:39 Marvin L DeJong Theo Schift Turning USR(X) Routines Into BASIC DATA Statements 33:21 The 6502 Dream Machine 34:67 Thomas Cheng Randall Hyde Does Anyone Really Know What Time it Is? 33:75 Add a Light Pen to your Micro 35:57 Randy Sebra Peter Alan Koski A 6502 Assembler In BASIC 34:7 More Output from Your Micro 36:19 Edward H. Carlson H.H. Aumann Rapid Bubble Sort of Numerical Elements Using How Microsoft BASIC Works 36:31 BASIC/ASL 34:21 Qreg Paris L S. Reich Encryption With RND and USR 34:35 Sherwood Hoyt

Departments Issue/Page

The MICRO Software Catalog 25:71/26:71/27:71/28:73 Letterbox 26:60/27:56/29:6/31:59 Mike Rowe' 29:73/30:72/31:79/32:87 32:6/33:6/34:6/35:6/36:6 33:87/34:93/35:83/36:88 Editorial 25:5/26:5/27:5/28:5 6502 Bibliography 25:75/26:75/27:75/28:76 Robert M. Tripp 29:5/30:5/31:5/32:5 Dr. William R. Dial 29:76/30:76/31:89/32:90 33:5/34:5/35:5/36:5 33:90/34:97/35:89/36:92 New Publications 31:51/32:36/33:54/34:79/35:47 MICRO Club Circuit 25:68/26:68/27:25/28:47 Mike Rowe’ Mike Rowe * 29:34/30:72/31:75/32:61 34:44/35:15 Challenges 34:46/35:77/36:17 •Paul Geffen MICROScope 27:31/28:57/29:49/30:33/31:43 Microbes 31:76/33:59/34:61 /35:81/36:72 Microprocessors in Medicine: The 6502 29:56/30:36 Jerry W. Froelich, M.D. 31:53/34:63/36:25 MICRO Dealers 35:51 Up From the Basements 27:59/29:72/30:51/31:87 Jeff Beamsley

PET Vet 28:48/29:39/30:27/31:33 -Loren Wright 32:51/33:68/34:59/35:55 36:62

'Mike Rowe is a pseudonym for material prepared by MICRO’S staff.

'MICRO’S volume year runs from June through May. Issue numbers span volumes consecutively, from MICRO’S first bimonthly issue (Oct./Nov. 1977) to the current monthly Issue (No. ??).

EDIT 6502 T.M. LJK Pass Assembler, Disassembler, and Editor Single Load Program DOS 33., 40/80 Columns, for Apple II or Apple II Plus*

A MUST FOR THE MACHINE LANGUAGE PROGRAMMER. Edit 6502* is a two pass Assem­ LOOK AT THESE KEY BOARO FUNCTIONS: Copy to the end of line and bler, Disassembler and text editor for the Apple computer. It is a single load program exit: Go to the beginning of the line: abort operation: delete a that only occupies 7K of memory. You can move freely between assembling and disas­ character at cursor location: go to end of line: find character after cursor location: non destructive backspace: insert a sembling. Editing is both character and line orientated, the two pass disassemblies character at cursor location: shift lock: shift release: forward create editable source files. The program is so written so as to encompass combined copy: delete line number: prefix special print characters. Com­ disassemblies of 6502 Code. ASCII text, hex data and Sweet 16 code. Edit 6502 makes the plete cursor control: home and clear, right, left down up. Scroll a user feel he has never left the environment of basic. It encompasses a large number of iine at a time. Never type a line number again. pseudo opcodes, allows linked assemblies, software stacking (single and multiple All this and much much more — Send for FREE Information. page) and complete control of printer (paganation and tab setting). User is free to move source, object and symbol table anywhere in memory. Requirements: 48K of Introductory Price $50.00. RAM, and ONE DISK DRIVE. Optional use of 80 column M&R board, or lower case availa­ ble with Paymar Lower Case Generator.

TAKE A LOOK AT JUST SOME OF THE EDITING COMMAND FEATURES. Insert at line » n Delete a character Insert a character Delete a line # n List line H nl, n2 to line H n3 Change line # nl to n2 "stringl" Search line It nl to n2 "stringl". LJK Enterprises Inc. P.O. Box 10827 St. Louis, MO 63129 <314)846-6124 COMPUTER BASED SOFTWARE 'Edit 6502 T.M. ol LJK Em. Inc. — ‘ Apple T.M. of Apple Computer Inc.

42 MICRO - The 6502 Journal No. 36 - May 1981 V * « < c « p t ***** m a jo r « •*«tordu

OPEN EVERY DAY 9 to 6 PST ORDER TOLL FREE California, Alaska b Foreign orders (714) 696-6099 Shipping Information or Backorders coll (714) 694-0260 Service Center ond for Technical Information (714) 460-6502 000 -654-6654

[cippkz computer w Authorized Dealer A ALL EQUIPMENT IS ATARI’ FCC APPROVED. MODEL 800 16K >799 APPLE II PLUS 1 6 K...... 1049 APPLE II PLUS 48K (APPLE M e m o ry )...... 1189 APPLE II Standard M o d e ls ... CALL Challenge/ 4P ...... 699 DISK II DRIVE & CONTROLLER. 529 C4PMF (Mini Floppy System). 1599 This model includes DOS 3.3 16 sector CIP M odel II ...... 449 TOT FIVE SELLERS Sargon II (Disk or Cassette).... 35 Language System W/Pascal...... 425 Fig Forth (Disk O n ly ) ...... 69 Silentype Printer W/tnterface ...... 549 Hayes Micromodem II...... 319 Atari 400 16K...... 499 Videx Videoterm 80 w/grophics...... 335 810 Disk Drive...... 499 Z-80 Microsoft Card...... 299 410 Program Recorder...... 69 APPLE COMPUTER INC. 650 Interface Module ...... 175 APPLE SOFTWARE Disk II Drive Only...... 445 822 Thermal Printer (40 col)...... 369 DOS Toolkit...... 65 Integer or Applesoft II Firmware Cord .. 155 825 Printer (80 col)...... 795 Appleplot...... 60 Graphics Tabtet...... 649 Atari 16K Rom Module...... 155 Tox Planner...... 99 Parallel Printer Interface Card ...... 155 Atari Light Pen...... 65 Apple Writer...... 65 Hi-Speed Serial Interface Card...... 155 V t stock oil Atari accessories 6 Apple Post...... 45 Smarterm 60 Column Video Cord ...... 335 software, pleas* call for more Info. D.J. Portfolio Evaluator...... 45 MOUNTAIN COMPUTER INC. D.J. News & Quotes Reporter...... 85 Music System (16 Voices)...... 479 Apple Fortran...... 165 A/D + D/A Interface...... 319 Apple Pilot...... 129 Expansion Chassis...... - ...... 555 PRINTERS DOS 3.3 Upgrade...... 49 lntrol/X-10 System ...... 249 Music Theory...... 45 Clock/Calendar Cord...... 239 The Controller Bus. Sys...... 519 Supertalker SD-200...... 249 Anadex DP-9500 W/2k Bu£ot_, ...... 1375 MISC. APPLICATIONS PACKAGES Romplus + Card...... 135 Anadex DP-9501 W/2K Buffer ...... 1450 Visicalc...... 125 Romwriter Cord...... 155 C. Itoh Storwriter 25 CPS...... 1750 Desktop Plan II...... 169 CALIFORNIA COMPUTER SYSTEMS C. Itoh Storwriter 45 CPS...... 2450 CCA Data Monagement DMS ...... 85 Clock/Calendar Module...... 109 Centronics 7 3 7 ...... 825 Easywriter Word Processor...... 225 GPIO IEEE-488 Cord...... 259 Epson MX-70 W/Graphics...... 449 ASCII Express...... 65 Asynchronous Serial Interface Card ...... 129 Epson MX-80 132 Col...... 620 Super Text II ...... 139 Centronics Parallel Interface Cord ...... 99 Paper Tiger tDS-445 W/Dot Plot ...... 749 Progrommo Apple Pie ...... 119 We carry all CCS hardware. Pleose call Paper Tiger IDS-460 W/Dot Plot ...... 1195 The Landlord Apt. Mgmt. Pkg ...... 649 MISC. APPLE HARDWARE Paper Tiger IDS-560 W/Dot Plot ...... 1495 Peachtree Business Software...... CALL 16K Ram Cord Microsoft...... 1fl9 Qume Sprint 5/45 Daisywheel...... 2550 Tax Preparer by HowardSoft ...... 89 ADT Numberic Keypod(old or new kybfd) 115 Silentype w/lnterface for Apple I I ...... 549 Applebug Assem/Disassm/Editor...... 75 ALF 3 Voice Music Cord...... 229 Watonabe Digiplot...... 1295 3-D Graphics By Bill Budge...... 53 Alpha Syntauri Keyboard System...... 1399 GAMES Corvus 10MB Hard Disk...... CALL Flight Simulator...... 34 Lazer Lower Case Plus...... 50 The Wizard ond The Princess ...... 32 Micro-Sci Disk Drives...... CALL VIDEO MONITORS Cosmos Mission (Spoce Invaders)...... 24 SSM AIO SeriaJ/Porallel Card A&T...... 189 Amdex/Leedex Video-100 1.2" B&W— 139 Sargon II Chess...... 32 Sup-R-Terminol 80 Col. Cord...... 339 Hitachi 13" Color...... 389 Hi-Res Football...... 39 SVA 8 inch Floppy Disk Controller ...... 345 NEC 12" P31 Green Phospher ...... CALL Adventure by Microsoft...... 27 Versowriter Digitizer Pad...... 229 Ponocolor 10" Color...... 375 Phontoms Five...... 39 Sonyo 9" B&W...... 179 Reversal (Othello)...... 34 WE HAVE MANY MORE ACCESORIES Sonyo 12" B&W...... 255 FOR THE APPLE I M STOCK— Sonyo 12" P31 Green Phospher...... 295 PLEASE CALL OR WRITE FOR A COMPLETE PLEASE CALL OR WRITE FOR A PRICE LIST. Sonyo 13” Color...... 445 SOFTWARE LIST.

ORDERING INFORMATION: Phone Orders invited using VISA, MASTERCARD, AMERICAN EXPRESS, DINERS CLUB, CARTE BLANCHE, or bank wire transfer. Credit cards subject to seivice charge, 2% for VISA & MC, 5% for AE, DC 6 CB. Moil Orders may send credit cord account number (include expiration dote), coshiers or certified check, money order, or personal check (allow 10 days to clear), Pleose include a telephone number with oil orders. Foreign orders (excluding Military PO's) odd 10% for shipping oil funds must be in U.S. dollars. Shipping, handling and insurance in U.S. odd 3% (minimum S4.0C). Californio residents odd 6% soles tox. We occept COD's under $500. OEMs, Institutions 6 Corporations please send for written quotation. All equipment is subject to price change and ovailobillty without notice. All equipment is new ond complete with manufacturer warranty (usually 90 days). We cannot guarantee merchontibility of ony products. We ship most orders within 2 days. WE ARE A MEMDER OF THE BETTER BUSINESS BUREAU AND THE CHAMBER OF COMMERCE SHOWROOM PRICES MAY DIFFER FROM MAIL ORDER PRICES. PLEASE SEND ORDERS TO: CONSUMER COMPUTERS MAIL ORDER 6014 PARKWAY DRIVE, 6ROSSMQNT SHOPPING CENTER NORTH LA MESA CALIF. 92041

No. 36 - May 1981 MICRO - The 6502 Journal 43 GET FREE ADS ON TV ! GET FREE SOFTWARE TOO!

How? Use our ADVERTISING SOFTWARE! You put it in the APPLE and produce colorful, dynamic adi on the screens of TV sets in your shop window. Evan if you are not a shop owner, you can use this software to broadcast m n in jti on TV screens in How? Order any of the items below, and for each $100 worth of merchandise ordered, »;hoois, hospitals, factories, ate The following meaage waking programs are available. we w ill give you one of the items at left for FREE! APPLE ADD-ONS SUPER MESSAGE: Creates m ewijei in full-page "chunks". Each name allows state­ ments o f mixed typettyles, typesizes and colors, in mixed upper & lower case. Five type- HAYES MICROMODEM for APPLE ...... $ 300. stykes arc available. They range from regular APPLE characters, up to double-size, Z80 SOFTCARD by MICROSOFT...... $ 275. double-width characters with a heavy, bold fo n t Six colors may be used for each 16KRAMCARD by MICROSOFT...... $ 159. different typestyle. Vertical & horizontal centering are available, and word-wrap is auto­ FORTRAN for APPLE by MICROSOFT...... $ 159. matic. Users can chain pages together to make multi-page messages. Pages can be advan­ COBOL for APPLE by MICROSOFT...... $ 599. ced manually or automatically. Multi-page masiaget can be stored to disc or recalled BASIC Comoiler for APPLE by MICROSOFT ...... $ 315. instantly. PRINTERS REQUIRES 48K & ROM APPLESOFT...... $ 6a CENTRONICS 737 (3 mo. warranty)...... $ 795. MULTI-MESSAGE with INTERLEAVED COLOR PATTERNS: Up to 10 messages can CENTRONICS 737 (15 mo. warranty) ...... $ 915. bit run in sequence.. Colorful, dynamic patterns (kaleidoscope or abstract art) can be EPSON,MX- 70with TRACTORS & GRAPHICS...... $ 4 0a interleaved between memgoT, at user option. Consists o f 28 crisp, readable characters/ EPSON MX-80 with TRACTORS & 132 C olum ns ...... S 515. lineX4 lines/pegeX3 pages of text per me rage. Characters are 1/8 screen-height and PAPER TIGER 460G with GRAPHICS & 2 K Buffer ...... $1135. “ p uff" onto the screen at comfortable reading speed. PAPER TIGER 445G w ith GRAPHICS & 2 K Buffer ...... $ 749. REQUIRES 32K & INTEGER BASIC...... $ 36. WORD PROCESSING HI-RES ALPHANUMERIC MESSAGE: Same as Multi-Manege above, but has only one message/set and no interleaved coior-patternt S till vary good general menage-maker} EZ WRITER PROFESSIONAL SYSTEM for A P P LE...... $ 239. THE SCROLLING WONDER: 4 brief messages appear in APPLE uppercase characters EZ MAILER (Interfaces to EZ WRITER above)...... $ 65. bv "floating" onto the screen from below. Mamget enter in random sequence, with ran. VIDEX VIDEOTERM (80-Column Card for A P P L E ) ...... $ $ 295. dom 50% of mewgai “ flash" A multipie-rainbow grand finale ends the program. Very VIDEX ViDEOTERM (Same as above with GRAPHICS) ...... $ 320. good program to run at point of purchase. SUP'RTERM (80-Column Card for APPLE) ...... $ 32a BUSINESS PROGRAMS far APPLE & TB-flO by SPECTRUM SOFTWARE GIANT LETTER: Brilliantly-colored letters, o f full screen height, appear one-at-a-time, in sequence, to spell out mewages. Successive words have different colors. A running MICROACCOUNTANT: An ideal package for the very small business, based upon classic summary of letters, in APPLE characters, appears in the bottom 4 lines o f the screen, as T-accounts & Double-Entry Bookkeeping. This efficient program records and produces the giant letters are presented. Vary good program fo r shop windows. reports on account balances, general ledger journals, revenues & expenses. 40-column or A LL 3 ABOVE TOGETHER, ON DISK, FOR 32K, INTEGER B A S IC...... $ 3 a screen report* Handles up to 1000 journal an tries/month, for up to 300 accounts. Includes a short primer in Financial Accounting. LET APPLE PLOT YOUR DATA AND KEEP VOUR RECORDS TOO) REQUIRES 48K & ROM APPLESOFT ...... $ 49. APPLE DATA GRAPH 2.1: Plots up to 3 superimposed curves on the Hi-res Screen BUSINESS CHECK-REGISTER with BUDGET: Unique system allows setting up pre­ both the X & Y axes dimensioned. Each curve consists o f up to 120 pieces of data. Graphs can be stored to disc and recalled immediately for updating. Up to I X graphs defined purpose & recipient accounts (60 aach). Supports unique names too. Rapid- ecceM to check-flles w ith scrolling display & 40-coL printout, if desired. Up to 100 can be stored on the same disc. Great for Stock-market Charting, Businaes Management, and Qessroom instruction! checks/ma + reconciliation + AUTOMATIC BUDGET VARIANCES! REQUIRES 4 8 K & ROM APPLESOFT ...... $ 4 a REQUIRES 48K & APPLESOFT ROM ...... $ 49. APPLE RECORD MANAGER: Allows complete files to be brought Into memory so that STOCK MARKET record Marches and manipulations are instantaneous. Records w ithin any file can contain STOCK MARKET ANALYSIS for APPLE by GALAXY ...... $ 49. up to 20 fields w ith user-defined headlngi Information cen be string o r numeric Users can bro wse thru files using page forward, papa backward or random search commands. COD'S & Personal Checks are Weicomel Records can easily be Marched, altered or sorted at wilL Files can be stored on iha same dr ive as the master propam, o r on another, if a second drive is available. Records or files can be printed, if desired. Additional modules cornu? are a STATISTICS INTERFACE, CHECKBOOK. MAILING UST& DATA-ENTRY. CONNECTICUT INFORMATION SYSTEMS CO. REQUIRES 48K & ROM APPLESOFT ...... $ 36. 218 Huntington Road, Bridgeport, CT 06608 (203) 579-0472 * A ll Software above on DU t fo r APPLE DOS 312

APPLE ARCADE

Asteron • The definitive hi­ res implementation of the As- Shooting Gallery l/TW F teroids arcade game. Fea­ 'Star Avenger -High speed tures: Ship movement, hyper- Shooting Gallery - a real guerrilla warfare in space pit­ space, alien saucers, sound time simulation of a midway ting you against your Apple. effects, graphic routines arcade. Features: row targets, Featuring a new universe allowing up to 25 objects to pop targets, different'skill each game and varying skill l)e displayed with real time re­ levels, and bonus time. May levels. Universe consists of sponse. Played from paddles be played using either game 16 hi-res screens with instant­ or keyboard. $27.50 paddles or joy sticks. $22.50 aneous crossover. $27.50

All Western MicroData game software is For U.S. and foreign orders, Available Now! written in assembly language for maximum prices are in U.S. dollars. For Canadian orders, prices are in speed. All programmes require 48K and Canadian dollars. Send cheque MultiBoot™ Upgrade DISK DRIVE and will work on standard or Postal Money Order only. Allow 3*4 weeks for cheque to Have you not wished that your Apple II, Apple II plus, and Pascal systems, clear if not certified and allow Elasic software would work in both with either DOS 3.2 or DOS 3.3. up to 4 weeks for delivery. DOS 3.2 and DOS 3.3? Tired of spending hours “Muffin”ing your Dealer and Computer Club en­ Western MicroData quiries invited. old programmes? Now your prob­ lems are solved with MultiBoot™ Enterprises Ltd. Upgrade. Upgrade a whole disc In Just seoonds and use your disc on P.O. Box G33, Postal Station G Apple is a registered trademark of any of DOS 3.3, DOS 3.2 and the Calgary, Alberta Apple Computer Inc. Language Card. Canada T3A 2W1 Disk II Is a registered trademark of $50.00 1-403-247-1621 Apple Computer Inc.

44 MICRO-The 6502 Journal No. 36 - May 1981 Apple Memory Maps, Part 2

Part 1 of this series (presented last month) gave several monitor, DOS, Integer BASIC, or long BASIC program. The changes Applesoft. They are listed in figure 18. required to do this would be many. examples of memory maps Most of the JSR and JMP addresses which showed where the Apple The program is entered from any would have to be changed, as well as stores its various program version of BASIC by a CALL 13000. An the string addresses and text page components. This concluding even number inside the range of locations. Also, the CALL instruction article contains a listing and program lines was chosen because it is would have to be placed in a different description of the program easy to remember. From this location it location, such as 25000. which produced the maps. jumps to $3200, the actual start of the program. Pointers Peter A. Cook 1443 N. 24th Street The program was assembled at The Apple remembers where it Mesa, Arizona 85203 $3200 to allow it to be used in as small stores the various components of a as a 16K machine, which ends at program by placing their starting $3FFF, and to permit RAM Applesoft to addresses in "pointers.” The pointers The Program remain intact, which ends at $3000. are locations in page zero of memory When MEMORY MAP is loaded it may which are set by the monitor in In order to draw a map of a BASIC overwrite part of the BASIC program, response to certain BASIC commands program, two programs must be stored but since the program pointers will not and control keys. Figure 19 lists the in memory at the same time. You must have changed, MEMORY MAP will pointers and other reference locations have the BASIC program which is to be operate correctly. Hi-Res graphics page used by the MEMORY MAP program. mapped, and the mapping program one, which extends from $2000-4000, itself. To achieve this, I first thought will definitely be overwritten. The only that an Integer BASIC and an Applesoft drawback is that if the BASIC program version of the mapping program would is overwritten, it will have to be loaded Loading Instructions have tO' be constructed and appended again following the use of MEMORY onto the program which was to be MAP. 1. Enter the hex values from observed. Another alternative was to listings 1, 2, and 3 into the computer write a machine language program For machines larger than 16K it using this format: which would work for either version of would be more advantageous to move BASIC, and wouldn't have to be the program to a higher location, such *3200:20 84 FE 20 2F FB . . . appended. Although this was obviously as above Hi-Res graphics page two. the better choice, it seemed a Then you could jump back and forth Up to 255 characters, or 85 hex pairs, formidable task to me because I had between the BASIC program and can be entered following the colon. never written a machine language MEMORY MAP without having to Then press the return key and start program before. It turned out to be reload them, even if you have a very with another colon to continue. much easier than expected, however, and if you've never tried it yourself, it's $1A Language: 0 Integer BASIC a lot like programming a programmable 1 RAM Applesoft calculator. 2 ROM Applesoft

Since I don't have an assembler, I $1B DOS: 0 Not loaded used the Apple’s mini-assembler to do 1 Loaded the job. The program is printed in listings 1, 2, and 3. Monitor routines $1C, ID String starting address were used wherever possible to keep the program short. $1E, IF Temporary usage $FA, FB Address of pointer's low byte Several storage locations in page zero of memory had to be used in order $FC, FD Address of pointer's high byte to facilitate the indirect mode of $FE, FF Constants for non-pointer addresses addressing. Locations were selected which do not interfere with the Figure 18: Page zero usage by MEMORY MAP.

No. 3 6 -M a y 1981 MICRO - The 6502 Journal 45 2. Save the program on disk using Integer BASIC Pointers BSAVE MEMORY MAP, A$3200, LOMEM 74, 75 $4A, 4B L$6E0, or you can save it on cassette HIMEM 76, 77 $4C, 4D using ‘ 3200.38DFW. Program pointer 202, 203 $CA, CB Free space pointer 204, 205 $CC, CD 3. To use the program, first load the BASIC program you wish to see Applesoft Pointers mapped. Run it through to the end using as many different branches of the Program pointer 103, 104 $67, 68 program as possible, to place all the Variable pointer (LOMEM) 105, 106 $69, 6A variables, arrays, and strings into Array pointer 107, 108 $6B, 6C storage. If the program doesn't end Free space pointer 109, 110 $6D, 6E automatically, terminate it with a String pointer 111, 112 $6F, 70 Control C. HIMEM 115, 116 $73, 74 End of program pointer 175, 176 $AF, B0 4. Load MEMORY MAP from disk using BLOAD MEMORY MAP, or from Other Data cassette using 3200.38DFR. Note: Language prompt 51 $33 MEMORY MAP may overwrite part of DOS slot number 1528 $5F8 the BASIC program. Be sure you have DOS file buffers (48K) 43607 $AA57 saved a good copy of it first. Figure 19: Pointers and other reference locations used by MEMORY MAP. 5. CALL 13000. The memory map will now appear on the screen. If you References wish to print it, press Y in response to the question at the bottom. If 1. Apple II Reference Manual, 4. The Apple II Monitor Peeled, MEMORY MAP is stored on disk, you Apple Computer Inc., 1979 (new William E. Dougherty, 1979. can use BRUN MEMORY MAP instead version). of the separate BLOAD and CALL 5. "What's Where in the Apple," commands. 2. Applesoft II Basic Programming William F. Luebbert, MICRO, August Reference Manual, Apple Computer 1979, p. 29. 6. If you wish to run the BASIC Inc., 1978. program over again, you may need to 6. "Disassembling the DOS 3.2," reload it first, depending on whether or 3. DOS Version 3.2 Instructional William Reynolds, MICRO, October not MEMORY MAP has overwritten and Reference Manual, Apple Com­ 1979, p. 7. part of it. puter Inc., 1979.

Program Remarks 321B- 05 33 LD0 $33 The following remarks explain what the different 321D- C9 DD CMP #$00 sections of the program are for, and how they work. 32 IF- D0 0B BNE $322C 3221- E6 10 INC $10 Listing 1: Disassembled MEMORY MAP program. 3223- 00 00 E0 LOO $E000 Clears the screen. Selects text mode, normal charac­ 3226- C9 4C CMP #$4C ters, and the full text window. 3228- D0 02 BNE $322C 20 84 FE JSR $FE84 3290- 3220- E6 10 INC $10 3203- 20 2F FB JSR $FB2F 3206- 20 93 FE JSR $FE93 3209- 20 89 FE JSR $FE89 Checks for maximum memory size by starting at 320C- 20 58 FC JSR $FC58 48Kand trying to store a 0 and a 1 in that location. If it can't, it keeps decreasing the address by 4K until it 320F- D8 CLD can. 3210- 09 00 LD0 #$00 LOO #$FF $FB 322C- 09 FF 3212- 85 FB STfl 322E- 85 FE STfl $FE 3214- 85 FD ST0 $F0 3230- 09 BF LOO #$BF $1B 3216- 85 IB STA 3232- 85 FF STO $FF 3218- 85 10 STfl $10 3234- BI FE LOO <$FE 3210- 08 TflV 3236- 85 IE STO $1E Checks the prompt character to see which language 3238- 09 00 LOO #$00 is in use. If it is Applesoft, it checks location $E000 3230- 91 FE STfl ($FE )»Y to see whether it contains a JMP instruction. If it 323C- 01 FE CMP <$FE>,V does, the Applesoft ROM is in use. If not, the Integer 323E- D0 08 BNE $3248 BASIC ROM is connected, so you are using RAM 3240- 09 01 L00 #$01 Applesoft. If you entered the program from the STfl <$FE>,V monitor or the mini-assembler, it will assume you 3242- 91 FE want Integer BASIC. 3244- 01 FE CMP <$FE>,Y

46 MICRO - The 6502 Journal No. 36 - May 1981 3246- F0 09 BEQ $3251 Prints the starting and ending addresses of the Hi- 3248- A5 FF LDA $FF Res graphics pages as a constant reminder of their 324A- 38 SEC location. Will not determine if Hi-Res is actually 324B- E9 10 SBC #$10 used, however. 3240- 85 FF STA $FF 3204- 20 6C 32 JSR $326C 324F- D0 E3 BNE $3234 32A7- E6 25 INC $25 3251- 85 IE LDA $1E 32A9- 20 22 FC JSR $FC22 3253- 91 FE STA <$FE>,Y 32AC- A5 1C LDA $1C 3255- E6 FE INC $FE 32AE- 18 CLC 3257- E6 FF INC $FF 32AF- 69 06 ADC #$06 32B1- 85 1C STA $1C 32B3- 60 RTS Checks location $5F8 to see if DOS has been loaded. 32B4- A9 07 LDA #$07 This location contains the slot number of the last 32B6- 20 5B FB JSR $FB5B DOS boot in the form $n0, so it is checked to see if it falls in the range $10 to $70. 32B9- A9 29 LDA #$29 3259- AD F8 05 LDA $05F8 32BB- 20 A4 32 JSR $32A4 325C- C9 10 CNR #$10 32BE- A2 03 LDX #$03 325E- 30 09 BMI $3269 32C0- 20 CB 32 JSR $32CB 3260- AD F8 05 LDA $05F8 32C3- CADEX 3263- C9 71 CMP #$71 32C4- D0 FA BNE $32C0 32C6- F011 BEQ $32D9 3265- 10 02 BPL $3269 3267- INC $1B 32C8- 4C 00 32 JMP $3200 E6 IB $25 3269- JMP $3286 32CB- E6 25 INC 4C 86 32 32CD- 20 22 FC JSR $FC22 32D0- A5 1C LDA $1C This subroutine selects and prints strings from the 32D2- 20 A4 32 JSR $32A4 list at the end of the program, using the starting ad­ 32D5- 20 A4 32 JSR $32A4 dress of the string as a pointer. The first byte con­ 32D8- RTS tains the horizontal tab, the second byte contains the number of characters, and the remaining bytes Draws two vertical lines to outline the memory map. hold the characters themselves in reverse order. 32D9- A2 02 LDX #$02 326C- 85 1C STA $1C 32DB- A9 09 #$38 LDA #$09 326E- A9 38 LDA 32DD- 85 24 STA $1D STA $24 3270- 85 ID 32DF- A0 14 LDV A0 00 LDV #$00 #$14 3272- 32E1- A9 02 LDA 3274- BI 1C LDA <$1C>,V #$02 32E3- 85 25 STA 3276- 85 24 STA $24 $25 32E5- 20 22 FC JSR $FC22 3278- E6 1C INC $1C 32E8- A9 A1 LDA <$1C>,Y LDA #$A1 327A- BI 1C 32EA- 20 ED FD JSR TAV $FDED 327C- A8 32ED- E6 25 INC 327D- BI 1C LDA <$1C>,Y $25 32EF- C6 24 DEC $24 327F- 20 ED FD JSR $FDED 32F1- DEV 88 DEV 3282- 88 32F2- D0 FI D0 F8 BNE $327D BNE $32E5 3283- 32F4- A9 16 LDA 3285- 60 RTS #$16 32F6- 85 24 STA $24 32F8- CA DEX Prints the title and the language in use. 32F9- D0 E4 BNE $32DF 3286- A9 00 LDA #$00 32FB- 4C AC 33 JMP $33AC 3288- 20 5B FB JSR $FB5B 3286- A9 LDA #$00 Subroutine for drawing horizontal lines on the map. 328D- 20 6C 32 JSR $326C 32FE- A9 0C LDA #$0C 3290- A5 1A LDA $1A 33R0- 85 IE STA $1E 3292- F0 08 BEQ $329C 3302- A9 0A LDA #$0A 3294- A9 0F LDA #$0F 3304- 85 24 STA $24 3296- 20 6C 32 JSR $3260 3306- A9AD LDA #$AD 3299- 4C B4 32 JMP $32B4 3308- 20 ED FD JSR $FDED 329C- A9 1A LDA #$1A 330B- C6 IE DEC $1E 329E- 20 6C 32 JSR $326C 330D- D0 F7 BNE $3306 32A1- 4f: B4 32 JMP $32B4 330F- 60 RTS

No. 36 - May 1981 MICRO-The 6502 Journal 47 Subroutine for converting hexadecimal numbers to 337C- 00 08 BNE $3788 decimal numbers, and printing them. Divides by 337E- 05 50 LDfl $50 10,000, 1000, 100, and 10 to obtain each digit, using 3380- 18 CLC the divide routine at $3779. Leading zeros are not 3381- 69 ODC #$B0 printed. Numbers are right-justified. B0 3383- 20 ED FD JSR $FDED 331 tV- ft9 IB LOO #$1B 3386- 60 RTS 3 3 12- 85 24 STfl $24 3314- 09 00 LOO #$00 Subroutine for printing the hex numbers used in 3316- 85 IE STfl $1E $3310. 3318- 85 53 STO $53 3387- 09 22 LDO #$22 3310- 85 52 STO $52 3389- 85 24 STfl $24 331C- 08 T0V 338B- 09 04 LDO #$04 3310- BI FC LD0 < $ F O , Y 3380- 20 ED FD JSR $FDED 3 3 1F- 85 51 STO $51 3390- 00 00 LDY #$00 3321- BI F0 LD0 ($FA)*Y 3392- LDO < $ F O , Y $50 BIFC 3323- 85 50 STO 3394- 20 Dfl FD JSR $FDD0 3325- 09 27 LD0 #$27 3397- BI FO LDfl <$F0>,Y 3327- 85 55 STO $55 3399- 20 DO FD JSR $FDD0 3329- 09 10 LDO #$10 339C- 60 RTS 332B- 85 54 STO $54 332D- 20 6E 33 JSR $336E 3330- 20 5F 33 JSR $335F Calls the three preceding subroutines. 3333- 09 03 LDO #$03 339D- 85 25 STO $25 3335- 85 55 STO $55 339F- 20 22 FC JSR $FC22 3337- 09 E8 LDO #$E8 3302- 20 FE 32 JSR $32FE 3339- 85 54 STO $54 3305- 20 10 33 JSR $3310 333B- 20 6E 33 JSR $336E 3308- 20 87 33 JSR $3387 333E- 20 5F 33 JSR $335F 330B- 60 RTS 3341- 09 00 LDO #$00 3343- 85 55 STO $55 Prints the top horizontal line, and its decimal and #$64 hex addresses. Each horizontal line on the map will 3345- 09 64 LDO represent the starting address of the block above it. 3347- 85 54 STO $54 Thus, the top line for a 48K machine will be 49152, 3349- 20 6E 33 JSR $336E or $C000. This is actually the first address of the 334C- 20 5F 33 JSR $335F ROM area. HIMEM is set to this value when the 334F- 09 00 LDO #$00 machine is first turned on. 3351- 85 54 STO $54 330C- 09 FE LDO #$FE 3353- 20 6E 33 JSR $336E 330E- 85 FO STfl $FH 3356- 05 52 LDO $52 33B0- 09 FF LDO #$FF 3358- 18 CLC 33B2- 85 FC STfl $FC 3359- 6 9 B0 ODC #$B0 33B4- 09 02 LDfl #$02 335B- 20 ED FD JSR $FDE0 33B6- 20 9D 33 JSR $3390 335E- 60 RTS 335F- 05 53 LDfl $53 Checks location $1B for a zero or a one to see if DO is loaded. 3361- 85 51 STO $51 33B9- 05 IB LDfl $1B 3363- 05 52 LDfl $52 33BB- 00 03 BNE $33C0 3365- 85 50 STO $50 33BD- 4C 56 34 JMP $3456 3367- 09 00 LDO #$00 3369- 85 53 STO $53 336B- 85 52 STfl $52 If it is, prints “DOS, FILES" in the top block. 336D- 60 RTS 33C0- E6 25 INC $25 336E- 20 79 37 JSR $3779 33C2- 20 22 FC JSR $FC22 3371- 05 50 LOO $50 33C5- 09 50 LDfl #$5fl 3373- 18 CLC 33C7- 20 6C 32 JSR $326C 3374- 65 IE ODC $1E 33C0- E6 25 INC $25 3376- 85 IE STfl $1E 33CC- 20 22 FC JSR $FC22 3378- 00 04 BNE $337E 33CF- 09 60 LDfl #$60 3370- E6 24 INC $24 3301- 20 6C 32 .JSR $326C

48 MICRO - The 6502 Journal No. 3 6 - May 1981 Checks location $AA57 in a 48K machine for the 3424- 09 53 LDfl #$53 number of DOS file buffers reserved. Three buffers 3426- 85 54 STO $54 are reserved when DOS is loaded, but the number 3428- 09 02 LDfl #$02 can vary from 1 to 16 if changed by a MAXFILES 3420- 85 55 STO $55 command. To find the location for your memory 342C- 20 5B 37 JSR $.375B size, subtract $15A9 from the top of memory. DOS 3.1 uses a different location for this value, but I don't Subtracts the length of DOS, $2307, from the top of know what it is. memory to find the top of the buffers. 3304- 05 FE LDfl $FE 342F- 05 FE LDO $FE 3306- 38 SEC 3431- 38 SEC 33D7- E9 09 SBC #$09 3432- E9 07 SBC #$07 3309- 85 IE STO $1E 3434- 85 FE STfl $FE 3308- 05 FF LDfl $FF 3436- 05 FF LDfl $FF 3300- E9 15 SBC #$15 3438- E9 23 SBC #$23 33DF- 85 IF STfl $1F 3430- 85 FF STO $FF Subtracts the length of the buffers to find their start­ ing address. Draws a horizontal line and prints the Converts the hex number of buffers to a decimal address. This is where HIMEM is set after a DOS number, and prints it. boot. The table in figure 20 shows the values of 33E1- 00 00 LDV #$00 HIMEM for different values of MAXFILES in a 48K 33E3- BI IE LDO ($1E >#Y machine. 33E5- 85 50 STO $50 343C- 05 FE LDA $FE 33E7- 98 TV0 343E- 38 SEC 33E8- 85 51 STO $51 343F- E5 50 SBC $50 33E0- 85 52 STfl $52 3441- 85 FE STA $FE 33EC- 85 53 STO $53 3443- 05 FF LDA $FF 33EE- 85 55 STO $55 3445- E5 51 SBC $51 33F0- 09 00 LDO #$00 3447- 85 FF STA $FF 33F2- 85 54 STfl $54 3449- 09 FE LDA #$FE 33F4- 20 79 37 JSR $3779 344B- 85 FA STA $F0 33F7- 09 04 LDfl #$04 3440- A9 FF LDA #$FF 33F9- 20 5B FB JSR $FB5B 344F- 85 FC STA $FC 33FC- 09 12 LDfl #$12 3451- A9 05 LDO #$05 33FE- 85 24 STfl $24 3453- 20 90 33 JSR $339D 3400- 05 50 LDfl $50 3402- F0 06 BEQ $340A 3404- 18 CLC LESHIMEM HIMEM 3405- 69 B0 ADC #$B0 (DEO (HEX) 3407- 20 E0 FD JSR $FDED 3400- 05 52 LDA $52 1 39590 9006 340C- 18 CLC 2 38995 9853 - j 3400- 69 B0 ADC #$B0 V 38400 9600 340F- 20 ED FD JSR $F0ED 4 37805 930D 3412- 09 09 LDA #$A9 5 37210 9150 3414- 20 EDFD JSR $FDED 6 36615 8F07 7 36020 8CB4 Multiplies the number of buffers by 595 to find their 8 35425 8061 total length in bytes, using the multiply routine at 9 34830 880E $375B. 10 34235 85BB 3417- A0 00 LDV #$00 11 33640 8368 3419- BI IE LDA ($1E),Y 12 33045 8115 341B- 85 50 STA $50 13 32450 7EC2 3410- 98 TVA 14 31855 7C6F 341E- 85 51 STO $51 15 31260 701C 3420- 85 52 STfl $52 16 30665 77C9 3422- 85 53 STfl $53 Figure 20: Values of HIMEM set by different MAXFILES.

No. 3 6 -M a y 1981 MICRO - The 6502 Journal 49 Checks location $1A to see which language is in use. Draws a horizontal line at the bottom of the map for If Integer BASIC, it branches to $368A. address 2048. This is the bottom of usable memory -3456- fl5 10 LDO $10 for BASIC programs. 3458- C9 00 CMP #$00 34B6- 20 BC 34 JSR $34BC 3450- D0 03 BNE $345F 34B9- 4C 02 34 JMP $3402 345C- 4C 80 36 JMP $3680 34BC- 09 08 LDfl #$08 34BE- 85 FF STO $FF Checks setting of HIMEM by looking at pointer ad­ 34C0- 09 0R LDfl #$00 dress $73,74. If same as bottom of DOS buffers, 34C2- 85 FE prints "HM". If a lower value has been set, draws STO $FE another horizontal line and prints the new address. 34C4- 09 FE LDO #$FE 345F- B1 F0 LDO < $F0 V 34C6- 85 FO STO $F0 3461- C5 73 CMP $73 34C8- 09 FF LDO #$FF 3463- D0 0C BNE $3471 34CA- 85 FC STO $FC 3465- BI FC LDO < $ F O , Y 34CC- 09 15 LDfl #$15 3467- C5 74 CMP $74 34CE- 20 90 33 JSR $339D 3469- D0 06 BNE $3471 34D1- 60 RTS 346B- 20 84 34 JSR $3484 346E- 4C 93 34 JMP $3493 3471- 09 73 LDfl #$73 Checks location $1A for a 1, to see if the language 3473- 85 F0 STfl $Ffl RAM Applesoft. If it is, it prints "APPLESOFT.'' 3475- 09 74 LDO #$74 34D2- 05 10 LDfl $10 3477- 85 FC STfl $FC 3404- C9 01 CMP #$01 3479- 20 7F 34 JSR $347F 34D6- D0 00 BNE $34E2 347C- 4C 93 34 JMP $3493 34D8- C6 25 DEC $25 34DA- 20 22 FC JSR $FC22 Subroutine for printing ‘'HM” 34DD- 09 72 LDfl #$72 347F- E6 25 INC $25 34DF- 20 6C 32 JSR $326C 3481- 20 9F 33 JSR $339F 3484- A9 18 LDA #$18 Checks the program pointer, $67,68 . If RAM Apple­ soft is loaded, the program will start at 12289. If 3486- 85 24 STA $24 ROM Applesoft is used, the program will start at 3488- A9 f:8 LDA #$C8 2049. Draws a horizontal line and prints the address. 3480- 20 ED FD JSR $FDED 34E2- 09 67 LDA #$67 348D- A9 CD LDA #$CD 34E4- 85 FO STO $F0 348F- 20 ED FD JSR $FDED 34E6- 09 68 LDfl #$68 3492- fifl RTS 34E8- 85 FC STO $FC $25 Checks string pointer $6F,70 to see if same as 34E0- C6 25 DEC HIMEM. 34EC- 20 9F 33 JSR $339F 3493- BI FA LDA <$FA>,Y 34EF- 20 F5 34 JSR $34F5 3495- C5 6F CMP $6F 34F2- 4C 14 35 JMP $3514 3497- D0 MH BNE $349F Subroutine : which checks the setting of LOMEM by 3499- BI FC LDA <$FC>,V ; 349B- C5 70 CMP $70 looking at pointer $69,6A. Prints "LM' 349D- F0 17 BEQ $34B6 34F5- BI FO LDfl <$Ffl>,V 34F7- C5 69 CMP $69 34F9- 00 09 BNE $3504 If not, prints "STRINGS". Draws horizontal line 34FB- BI FC LDfl ($FC and prints address. 34FD- C5 6fl CMP $6fi 349F- E6 25 INC $25 34FF- 00 03 BNE $3504 3401- 20 22 FC JSR $FC22 3501- 20 05 35 JSR $3505 3404- A9 69 LDA #$69 3504- 60 RTS 34A6- 20 6C 32 JSR $326C 3505- A9 18 LDfl #$18 34A9- A9 6F LDA #$6F 3507- 85 24 STfl $24 34AB- 85 FA STA $FA 3509- A9 CC LDfl #$CC 34A0- A9 70 LDA #$70 350B- 20 ED FD JSR $FDED 34AF- 85 FC STA $FC 350E- A9 CD LDfl #$CD 34B1- E6 25 INC $25 3510- 20 ED FD JSR $FDED 34B3- 20 9F 33 JSR $339F 3513- 60 RTS

50 MICRO - The 6502 Journal No. 36 - May 1981 CONTINENTAL SOFTWARE THE APPLE SOURCE.

For Apple owners only. Thor­ THE COMPUTER PROGRAMMED Disbursement Journals. Customized ACCOUNTANT FOUR MODULES journals. Allows simulation of manual oughly tested, well documented special journal entries. Prints Aging programs lor business and pleas­ Buy all four now—or add as you expand $175 each ($250 after 6/1/81) Report to 150 days, vendor list and ure. All written by professionals. labels and even a Cash Requirements Each checked out carefully by The first programs for your Apple that Report. Posts to General Ledger. experts in its field. your accountant will like as much as you do. Nobody makes it better—or HYPERSPACE WARS easier to use—than Continental Soft­ CPA4 PAYROLL 2 GAMES FOR THE PRICE OF 1 $ 2 9 .9 5 ware. Simple step-by-step instructions. Maintains personnel records for as 48K Trek. Stardate 3421. Excellent error checking. Modules can many as 100 employees. Quarter-to- The Terraunion is being attacked. be used individually, or integrated into date and year-to-date earnings and You command United Starship Excali- a complete Accounting System. deduction records. Employees are bur. Your mission: destroy the deadly Manuals only: just $15 each. departmentalized and designated Klepton invasion force. Four levels, hourly or salaried. Prints complete Novice to Master. CPA1GENERAL LEDGER. Payroll Checks, 941 information, W-2s, True double entry bookkeeping with Use your on-board^ State of California DE-3 information. 3-D Space Rattle. complete, accurate audit trails show­ scanners to search for alien ships in hi­ Prints Payroll Journal and posts to ing the source of each entry in the General Ledger. res three-dimensional space. Destroy general ledger. Concise, meaningful as many aliens as you can before you reports generated include Balance These are just some of the fea­ run out of fuel or your ship is destroyed. Sheet, Profit & Loss Summary, Trial tures of each CPA module. All require Hi-res graphics. Req. 48K, Applesoft in Balance and Complete Journal Activity 48K, Applesoft in Rom, Dos. 3.3, 2 disk Rom+1 disk drive. Dos. 3.2 or 3.3. Report. Reports show monthly, year-to- drives-(-printer. L.A. LAND MONOPOLY $ 2 9 .9 5 date and last year monthly+YTD for At your local dealer or fill out and Bankrupt your opponents while becom­ comparison. Custom charting feature mail today. Phone for immediate ing the richest player in the game. Buy, includes hi-res plotting of one or more delivery. sell, rent and trade to accumulate the accounts. ■■■■■■■■■■■■ most cash and property. Two to six may CPA2 ACCOUNTS RECE1VARLE play. Computer is banker. Create your Prints invoices on available custom ! OK, I’LL BYTE. ! own special version using streets in ■ ■ CSend — J me these______revolutionaryi . . « ______I your own town. | forms or on plain paper. Back orders I and extensions computed. Issues state­ ■ programs: I Hi-res graphics. Req. 48K, Applesoft ments for all customers, one or more | □ Hyperspace Wars. . . $___ ■ in Rom+1 disc drive. Dos. 3.2 or 3.3. customers, or only those with current, □ L.A. Land Monopoly. ___ HOME MONEY MINDER $ 3 4 .9 5 30-, 60-, 90- or 150-day balances. ■ □ Home Money Minder ___ B Maintain up to 300 customers. Custom­ ■ □ The Mailroom ...... Complete home financial system com­ I bines an excellent Home Checkbook ized journals. Allows simulation of _ □ CPA1 General Program with Budgeting. Transactions manual special journal entries. Posts to B Ledger ...... I | □ CPA2 Accts. Rec. . . ___ by month by budget category. Bank General Ledger. Prints aging report to I reconciliation. Budget for year. Total 150 days. Also prints customer lists _ □ CPA3 Accts. Pay. . . ___ expenses compared monthly and year- and labels. ■ □ CPA4 Payroll ...... I to-date. Plus much more. | No. C.O.D.s Subtotal ___ I CPA3 ACCOUNTS PAYARLE Cal. res. add 6% ___ Req. 48K, Applesoft in Rom, 1 disk Prints checks to vendors and non­ TOTAL ___ I drive+printer. Avail, in Dos. 3.3. vendors on available pre-printed Name ______checks or plain paper. Each check stub THE MAILROOM $ 3 4 .9 5 Address. shows invoice(s) paid, discounts taken, Stores up to 750 names per disk. Prints ,City_ .State____Zip net paid, Prints Purchases and Cash master lists and labels 1, 2 or 3 across. ard No.______Exp. Sorts in 5 seconds. Sort on any of 12 items, search any sorted item in 10-20 M15/81 seconds maximum. Easy editing, cus­ tomized inputs. CONTINENTAL I U j SOFTWARE Req. 48K, Applesoft in Rom, 1 disk drive+printer (132 column capability' 12101 Jefferson Blvd., (213) 371-5612 needed to print Master List.) in Dos. 3.3. Culver City, CA 90230

No. 3 6 -M a y 1981 MICRO-The 6502 Journal 51 Checks the end-of-program pointer $AF,BO. Prints 3570- A9 60 LDO #$60 “PROGRAM''. Draws a horizontal line above it and 3572- 85 FC STfl $FC prints the address. If no Applesoft program is loaded, 3574- C6 25 DEC $25 the end-of-program will be one or two bytes higher 3576- 20 9F 33 JSR $339F than the starting pointer. Checks the free space pointer $6D,6E to see if it is 3514- B1 F0 LDO <$F0>,V the same as the start of array space. If not, it prints 3516- C5 OF CMP $0F "ARRAYS" and draws a line above it. 3518- 00 06 BNE $3520 3579- BI FA LDO <$F0),Y 35 lfi- BI FC LDfl <$FC),Y 357B- 05 60 CMP $60 SSlC- C5 B0 CMP $60 3570- D0 06 BNE $3585 SS 1E- F0 10 BEQ $353A 357F- BI FC LDO <$FC),Y 3520- C6 25 DEC $25 3581- C5 6E CMP $6E 3522- 20 22 FC JSR $FC22 3583- F0 17 BEQ $3590 3525- 09 70 LDfl #$70 3585- 06 25 DEC $25 3527- 20 60 32 JSR $3260 3587- 20 22 FC JSR $FC22 3520- 09 OF LDO #$OF 3580- A9 91 LDO #$91 3520- 85 F0 STfl $Ffi 3580- 20 60 32 JSR $3260 352E- 09 B0 LDfl #$B0 358F- A9 60 LDO #$60 3530- 85 FC STfl $FC 3591- 85 FA STfl $F0 3532- 06 25 DEC $25 3593- A9 6E LDfl #$6E 3534- 20 9F 33 JSR $339F 3595- 85 FC STfl $FC 3537- 20 F5 34 JSR $34F5 3597- 06 25 DEC $25 3599- 20 9F 33 JSR $339F

Checks $69,6A for the setting of LOMEM. It should Computes the amount of free space by subtracting have been set automatically to the same position as the free space address from the string address. Prints the end-of-program pointer. If different, draws the amount in decimal and hex. This completes the another line and labels it "LM'' with the proper ad­ Applesoft map. dress. This is the starting location for variables. 353A- B1 Ffl LDO <$Ffl>,Y 3590- 20 02 35 JSR $3502 3530- 05 69 CMP $69 359F- 40 00 35 JMP $35ftU 353E- 00 06 BNE $3546 3502- A9 0A LDfl #$00 3540- BI FC LDO <$FC),Y 3504- 20 5B FB JSR $FB5B 3542- 05 6fl CMP $6fl 3507- A9 99 LDO #$99 3544- F0 10 BEQ $3556 3509- 20 60 32 JSR $3260 3546- fl9 69 LDfl #$69 3500- 60 RTS 3548- 85 Ffl STfl $F0 3500- A5 6F LDfl $6F 354A- fl9 6fi LDfl #$60 350F- 38 SEC 3540- 85 FC STfl $FC 35B0- E5 60 SBC $6D 354E- 06 25 DEC $25 35B2- 85 FE STO $FE 3550- 20 9F 33 JSR $339F 35B4- A5 70 LDO $70 3553- 20 F5 34 JSR $34F5 35B6- E5 6E SBC $6E 35B8- 85 FF STfl $FF Checks the array pointer $6B,6C to see if different 35B0- A9 FE LDO #$FE from LOMEM. If it is, prints “VARIABLES" and 35B0- 85 FA STO $F0 draws a line above it for the start of array space. 35BE- A9 FF LOO #$FF 3556- BI Ffl LDfl < $ F 0 ) j>V 3500- 85 FC STO $FC 3558- 05 6B CMP $6B 3502- 20 10 33 JSR $3310 355ft- 00 06 BNE $3562 3505- 20 87 33 JSR $3387 3550- BI FC LDO < $ F O , Y 355E- 05 60 CMP $60 The next part of the program allows you to print the 3560- F0 17 BEQ $3579 map on a printer, as was done for the illustrations in 3562- C6 25 DEC $25 this article. Places the input line "PRINT (Y)?" at 3564- 20 22 FC JSR $FC22 the bottom of the screen. 3567- A9 86 LDO #$86 3508- A9 17 LDfl #$17 3569- 20 60 32 JSR $3260 35CA- 20 5B FB JSR $FB5B 3560- A9 6B LDO #$6B 3500- A9 05 LDfl #$fl5 356E- 85 Ffl STfl $F0 35CF- 20 6C 32 JSR $3260

52 MICRO - The 6502 Journal No. 36 - May 1981 If the response is not a "Y”, erases the question, Subroutine for printing a blank line within vertical replaces it with the prompt character of the original border lines. BASIC program, and ends the MEMORY MAP 3628- 09 09 LDO #$09 program. 3620- 85 24 STO $2* 35D2- 20 IBFD JSR $FD1B 362C- 09 01 LDfl #$01 3505- C9 D9 CMP #$09 362E- 20 EDFDJSR $FDED 35D7- F0 IFBEQ $35F8 3631- 09 30 LDfl #$30 3509- 09 00 LDO #$00 3633- 85 24 STO $24 35DB- 85 24 STO $24 3635- 09 01 LDO #$01 350D- 20 9C FC JSR $FC9C 3637- 20 ED FD JSR $FDED 35E0- 09 IB LDO #$16 3630- 20 8E FDJSR $FD8E 35E2- 20 5B FB JSR $FB5B 3630- 60 RTS 35E5- 05 10 LDO $10 35E7- C9 01 CMP #$01 35E9- D0 03 BNE $35EE Selects the printer slot number in the form $Cn00. 35EB- 4C 3C 0C JMP $0C3C You will have to change location $3643 to a different number if your printer is not in slot # 2 . 35EE- 05 IB LDO $1B 35F0- F0 03 BEQ $35F5 363E- 09 00 LDO #$00 35F2- 4C D0 03 JMP $03D0 3640- 85 36 STO $36 35F5- 4C 03 E0 JMP $E003 3642- 09 C2 LDfl #$C2 3644- 85 37 STO $37

If the response is a "Y”, the program continues. It was designed for use with a Trendcom 200 printer. One of the features of this printer's interface card is Prints a border around the outside of the map. Prints that it prints a line of characters on the screen before the moved text page line-by-line using the starting it prints them on the paper. In order to print only the locations for each line stored at $38B2. memory map display from text page one, we have to 3646- 20 13 36 JSR $3613 move it first to another location before it becomes $3628 cluttered with extra characters from the printing 3649- 20 28 36 JSR process. The monitor MOVE routine is used here to 364C- 02 2E LDX #$2E move $400,800 to $3900.3D00. The MOVE routine 364E- 09 09 LDfl #$09 transfers bytes from the addresses contained in 3650- 85 24 STfl $24 $3C,3D through $3E,3F to the new address in 3652- 09 01 LDO #$fll $42,43. 3654- 20 ED FD JSR $FDED 35F8- 09 00 LDO #$00 3657- 09 0E LDO #$0E 35F0- 85 31": STfl $3C 3659- 85 24 STfl $24 35FC- 85 3E STfl $3E 365B- BD B0 38 LDfl $ 3 8 B 0 pX 35FE- 85 42 STfl $42 365E- 85 IE STfl $1E 3600- 08 TflV 3660— BD BI 38 LDfl $38B1,X 3601- 09 LDfl #$04 3663- 85 IF STfl $1F 3603— 85 3D STfl $3D 3665- 00 00 LDV #$00 3605- 09 08 LDfl #$08 3667- BI IE LDfl ($1E),V 3607- 85 3F STfl $3F 3669- 20 ED FD JSR $FDED 3609- 09 39 LDfl #$39 366C- C8 INV 360B- 85 43 STO $43 366D- C0 27 CPV #$27 360D- 20 2C FE JSR $FE2C 366F- 00 F6 BNE $3667 3610- 4C 3E 36 JMP $363E 3671- 09 30 LDfl #$30 3673- 85 24 STfl $24 Subroutine for printing a horizontal border line on 3675- 09 01 LDfl #$01 the finished map. 3677- 20 ED FD JSR $FDED 3613- 09 30 LDfl #$30 3670- 20 8E FD JSR $FD8E 3615- 85 IE STfl $1E 3670- CO DEX 3617- 09 00 LDfl #$0fl 367E- CO DEX 3619- 85 24 STO $24 367F- 00 CD BNE $364E 3 6 1B- 09 00 LDfl #$0D 3681- 20 13 36 JSR $3613 3610- 20 ED FD . ISR $FDED 3620- C6 IE DEC $1E Restores normal screen output at the end of printing, 3622- D0 F7 BNE $36 IB and returns to BASIC to end the program. 3624- 20 8E FD JSR $FD8E 3fi84- 20 93 FE JSR $FE93 3627- 60 RTS 3687- 4C E5 35 JMP $35E5

No. 36 - May 1981 MICRO-The 6502 Journal 53 AIM-65 Newsletter * * Target Spanish Hangman Target provides hardware and software 2,000 SPANISH words and sentences information useful for AIM-65 and 6502 taught in a fun way on the Apple. Send for users. The 1979 and 1980 back issues are your school's free 30-day evaluation iSC®MO available for $12.00 while a continuing diskette, from: subscription costs $6.00. fust write to: George Earl Target 1302 South General McMullen Classified Donald Clem San Antonio, Texas 78237 R oute 2 Spenserville, Ohio 45887 AIM/KIM/SYM Programmer Fatigue? OSI SUPERB/C1P • New MonltorROM NBS Computing gives you time! A battery SYM—BUG/MONEX adds 15 commands backed-up clock-calendar board that runs to SYM's repertoire including an inter­ You haven't seen a better utility ROM! on the application bus. The clock will run active trace/debug. Cassette @ $0200 or Exchange MonitorROM and get: Screen- for months without power and can $3800: $19.95. EPROM |2716-5v) @ editor (insert, delete), cursor control, f. generate interrupts on SYM systems. $F000-$F7FF: $39.95. Commented source 24/32/64 chr/line; cassette-sys. w. file $69.95 assembled, $34.95 bare board. Both listing: $9.95. RAE-l(/2) FORMAT name handler (3-4 times faster), handles include drivers. CASSETTE: $35 (requires 8KJ. Custom BASIC, Hexcode and variable arrays, and NBS Computing assembly add $2.00. Foreign add $2.00. more. Further applications and program 1674 E. M-36 SASE for more information. information $1 .00. Pinckney, Michigan 48169 Jeff Holtzman Gerwin Bleich 6820 Delmar-203 Boschstr. 1,3004 St. Louis, Missouri 63130 Isemhagen 1, West Germany ASTEROIDS for OSI

PET Machine Language Guide Enjoy the arcade game in the comfort of Quality Educational Courseware your home. Exciting and habit forming. Comprehensive manual to aid machine Elementary educational courseware for All in machine code. Specify system. Sorry language programmer. More than 30 the Apple n. All programs feature large NO 8" disks. $10.95 tape or disk. routines are fully detailed so that the lower-case letters, record keeping, and W.C. Software reader can put them to immediate use. documentation. All require Applesoft 48K, 1319 N. 16th OLD or NEW ROMS. $6.95 + .75 postage. disk. CLOCK: $29.95, PRESCRIPTIVE Grand Junction, CO 81501 VISA & Mastercharge accepted. MATH DRILL: $79.95. Write for catalog. Abacus Software Hartley Software P.O. Box 7211 3268 Coach Lane #2A Dept. M Grand Rapids, Michigan 49510 Kentwood, MI 49508 (Continued on page 80)

I

I Don’t buy Apple SoftwareI I

I ■ I

I I I I

I I I

I

I

B B until you read this bock. I B First check The Book—the one complete critical analysis of most Apple B Software available. Games, Educational, Business, Utility programs and AnnRFftft more. Each comprehensively rated on 11 separate points. Each reviewed by r.iTY RTATF ZIP B an expert in its field. Just $19.95. I Now you can compare and get more for your software dollar. Does the CARD NUMBER EXP B program you need exist? How good is it? Which software vendors offer the M15/’81 I B best support? Find out all this and much more. 1 MasterCard & Visa accepted. Fill out and mail today or call for shipment. TheBookCom pany B Calif, residents add 6% 16720 HAWTHORNE BLVD., LAWNDALE, CA 90260. (213) 371-4012. ■ The following routines check the Integer BASIC 36E3- B1 FA LDfl <$Ffl),V pointers, which are different from the ones used for •36E5- 05 4A CMP $4fi Applesoft. This one checks the setting of HIMEM, 36E7- 00 06 BNE $36EF $4C,4D. 36E9- BI FC LDO <$FC>,V 368A- B1 Ffl LDfl <$FA),Y 36EB- 05 4B CMP $46 3680- C5 4C CMP $40 36ED- F0 10 BEQ $36FF 368E- 00 0C BNE $369C 36EF- A9 4A LDO #$4fl 3690- BI FC LDfl < $FC 36F1- 85 FA STA $F0 3692- C5 40 CMP $4D 36F3- 09 4B LDA #$4B •3694- 00 06 BNE $3690 36F5- 85 FC STO $FC 3696- 20 84 34 JSR $3484 36F7- C6 25 DEC $25 3699- 4C A7 36 JMP $36A7 36F9- 20 9F 33 JSR $339F 3690- 09 4C LDfl #$40 36FC- 20 03 36 JSR $36D3 369E- 85 Ffl STfl $FA 36A0- P9 40 LDfl #$4D •36A2- 85 FC STfl $FC Checks the free space pointer $CC,CD to see where 7F 34 JSR $347F the variables end. 36A4- 20 3SFF- BI FA LDO <$F0),V 3701- C5 00 CMP $CC Checks the program pointer $CA,CB. 3703- D0 06 BNE $370B 36A7- B1 FA LDA <$FA>,V 3705- BI FC LDfl < $F0 >»V 36A9- C5 CA CMP $00 3787- 05 CD CMP $CD 36AB- 00 06 BNE $36B3 3709- F0 2F BEQ $3730 36AD- BI FC LDA ($FC).Y 370B- 06 25 DEC $25 36AF- 05 CB CMP $CB 3700- 20 22 FC JSR $FC22 36B1- F0 17 BEQ $36CA 3710- A9 69 LDO #$69 36B3- E6 25 INC $25 3712- 20 60 32 JSR $3260 36B5- 20 22 FC JSR $FC22 3715- 06 25 DEC $25 36B8- A9 70 LDA #$7D 3717- 06 25 DEC $25 36BA- 20 6C 32 JSR $3260 3719- 20 22 FC JSR $FC22 36BD- A9 CA LDA #$CA 371C- 09 91 LDfl #$91 36BF- 85 FA STA $FA 3 7 1E- 20 60 32 JSR $3260 3601- A9 08 LDA #$CB 3721- 06 25 DEC $25 3603- 85 FC STA $FC 3723- C6 25 DEC $25 3605- E6 25 INC $25 3725- 20 22 FC JSR $FC22 3607- 20 9F 33 JSR $339F 3728- 09 86 LDfl #$86 3720- 20 60 32 JSR $3260 Draws the bottom line at 2048. 372D- 09 00 LDO #$CC 36CA- 20 BC 34 JSR $34BC 372F- 85 FO STfl $F0 36CD- 20 D3 36 JSR $3603 3731- 09 CD LDO #$CD 36D0- 40 E3 36 JMP $36E3 3733- 85 FC STO $FC 3735- 06 25 DEC $25 3737- 20 9F 33 JSR $339F Checks the setting of LOMEM, $4A,4B. This is the beginning of storage for variables, arrays, and Computes the amount of free space by subtracting strings, which are all stored in the same area in the free space address from the program address. Integer BASIC. This completes the memory map for Integer BASIC. 3603- B1 FA LDA <$FA j u m p s back to $35C8 for the printer routine. 36D5- 05 4A CMP $4A 373A- 20 A2 35 JSR $3502 3607- D0 09 BNE $36E2 3730- 05 CA LDfl $CA 3609- BI FC LDA ( $ F O , V 373F- 38 SEC 36DB- 05 4B CMP $4B 3740- E5 CC SBC $CC 36DD- D0 03 BNE $36E2 3742- 85 FE STO $FE 36DF- 20 05 35 JSR $3505 3744- A5 CB LDO $CB 36E2- 60 RTS 3746- E5 CD SBC $CD

No. 36 - May 1981 MICRO - The 6502 Journal 55 3748- 85FF STO $FF 3740- 09 FELDO #$FE Listing 2: MEMORY MAP strings. 374C- 85FO STO $Ffl String data. All strings are stored with horizontal tab 374E- 09 FF LDO #$FF in first byte, length of string in second byte, and string characters in reverse order in the remaining 3750- 85 FC STO $FC bytes. Reverse order is used to allow simple decre­ 3752- 20 10 33 JSR $3310 menting of the counter instead of incrementing and 3755- 20 87 33 JSR $3387 comparing. 3758- 4C C8 35 JMP $35C8 3800- 00 0D 00 00 B0 D0 Cl CD 3808- 00 D9 D2 CF CD C5 CD 0D Subroutine for multiplying integers. This is the 3810- 09 D4 C6 CF D3 C5 CC D0 MUL routine from the old monitor ROM, in case 3818- D0 Cl 0D 00 C3 C9 D3 Cl you have the autostart ROM installed. Multiplies 3820- C2 00 02 C5 C7 C5 D4 CE number in $50,51 by number in $54,55 leaving 3828- C9 00 05 D3 C5 02 C9 C8 16-bit result in $50,51,52,53. 3830- 00 05 B6 B7 B5 B4 B2 00 3756- 00 10 LDV #$10 3838- 05 B0 B0 B0 B6 04 00 05 375D- 05 50 LDO $50 3840- B4 B8 B3 B6 BI 00 05 B0 375F- 40 LSR 3846- 60 B0 B4 04 00 05 B2 B9 3760- 90 0C BCC $376E 3850- BI B8 00 00 05 B0 B0 B0 3762- 18 CLC 3856- 62 04 0E 04 OC 03 CF C4 3763- 02 FE LDX #$FE 3860- 06 07 08 00 D3 C5 CC C9 3765- 65 54 LDO $54,X 3868- C6 0C 07 D3 C7 CE C9 02 3767- 75 56 ODC $56,X 3870- 04 D3 0B 09 D4 C6 CF 03 3769- 95 54 STfl $54,X 3878- C5 CC D0 D0 Cl 0C 07 CD 376B- E8 I NX 3880- Cl 02 C7 CF 02 00 06 09 376C- D0 F7 BNE $3765 3688- 03 C5 CC C2 Cl C9 02 Cl 376E- 02 03 LDX #$03 3890- D6 00 06 03 09 Cl 02 02 3770- 76 50 ROR $50, X 3898- Cl 06 00 C5 C3 Cl 00 03 3772- CO DEX 3800- 00 C5 C5 D2 C6 00 00 BF 3773- 10 FB BPL $3770 3608- 09 09 08 00 D4 CE C9 D2 3775- 88 DEV 3860- 00 FF 3776- D0 E5 BNE $3750 3778- 60 RTS

Subroutine for dividing integers. This is the DIV Listing 3: Starting locations for printing the moved text page. routine from the old monitor ROM. Divides 16-bit number in $50,51,52,53 by number in $54,55, leav­ Left edge locations of the top 23 lines of the moved ing quotient in $50,51 and remainder in $52,53. text page, in reverse order. The 24th line containing 3779- 00 10 LDV #$10 the "PRINT (Y)?'' statement is not printed. As an ex­ 377B- 06 50 ASL $50 ample, the last two bytes in this section are $ 0 0 and 3770- 26 51 ROL $51 $39, denoting the address $3900. This location holds 377F- 26 52 ROL $52 the byte moved from $400, the leftmost character on 3781- 26 53 ROL $53 the top line of text page one. 3783- 38 SEC 38B2- 50 3C D0 3B 50 36 3784- 05 52 LDA $52 3868- 00 30 50 30 00 39 50 39 3786- E5 54 sec $54 38C0- 08 3C 28 3C 08 36 28 36 3788- AA TAX 38C8- 08 3028 30 08 39 28 39 3789- A5 53 LDA $53 3800- 80 3C00 3C 80 36 00 36 3786- E5 55 sec $55 3808- 80 30 00 30 80 39 00 39 3780- 90 06 BCC $3795 378F- 86 52 STX $52 3791- 85 53 STO $53 This completes the description of the program. INC $50 Use the loading instructions which follow, then try 3793- E6 50 recreating the examples shown in Part 1 of this 3795- 88 DEV series. You will soon figure out many other ways to 3796- 06 E3 BNE $377B use memory maps as an aid in designing Integer 3798- 60 RTS BASIC and Applesoft programs.

56 MICRO - The 6502 Journal No. 3 6 -M a y 1981 LOOK!!! PET & APPLE II USERS AVANT-GARDE CREATIONS has SOFTWARE: EDUCATION T in y P a s c a l ART/DESIGN | Plus + GAMES. GRAPHICS BUSINESS UTILITIES SELF TRANSFORMATION

The TINY Pascal System turns your APPLE II micro into a 16-blt P-machine. You LOOK AGAIN!!! too can learn the language that Is slated to become the successor to BASIC. TINY Pascal offers the following: We have the following and MORE!: 5 Great Games! Animal Bingo, Jungle Safari, SpW:e Defense, * LINE EDITOR to create, modify and maintain source * COMPILER to produce P*code, the assembly iangauage ot the P-machine Sky Watcher, Air Traffic Controller $29.95 (or $9.95 each) * INTERPRETER to execute the compiled P-code (has TRACE) 5 More Great Games! Deep Sea Treasure, Mystery Code, * Structured programmed constructs: CASEOF-ELSE, WHILE-OO, IF-THEN- ELSE, REPEAT-UNTIL, FORTO/DOWNTO-DO, BEGJN-END, MEM, CONST, Depth Charge, The Mine Fields of Normalcy, Turn ’Em Loose VAR ARRAY $29.95 (or $9.95 each) Our new TINY Pascal PLUS+ provides graphics and other builtin functions: The Mailing Label & Filing SystemFiling, label-making, GRAPHICS, PLOT, POINT, TEXT, INKEY, ABS AND SQR. The PET version sup­ binary sort, dynamic sorting, directory, quick-find, more! $24.95 ports double density plotting on 40 column screen giving 80 x 50 plot positions. Sentence DiaaramminaEducational, grades 6-12 $19.95 The APPLE II version supports LORES and for ROM APPLESOFT owners the HIRES graphics plus other features with: COLOR, HGRAPHICS, HCOLOR, Action Sounds & Hi-Res Scrolling Designed to give your HPLOT, PDL and TONE. For those who do not require graphics capabilities, you program the excitement of action & sound $15.95 may still order our original Tiny Pascal package. Super Draw & Write Fonts, drawing, and useful utilities $15.95 TINY Pascal PLUS+ GRAPHICS VERSION- PET 32K NEW Roms cassette...... $55 Super Shape Draw!The best system yet, it works! PET 32K NEW Roms diskette...... $50 ...creates shape tables like a dream... $19.95 APPLE II 32K/48K w/DOS 3.2 or 3.3 ...... $50 The Creativity PackageDraw, write poetry, music $19.95 TINY Pascal NON-GRAPHICS VERSIONS- “...impressive...satisfying...interesting...fun!” Peelings (The Magazine of Software PET 16K/32K NEW Roms cassette...... $40 Reviews) PET 16K/32K NEW Roms diskette...... $35 “Truiy differenL..unlque...the program is an enjoyable one...cute...very interesting... APPLE II w/ROM Applesoft 32K w/DOS...... $35 new...nlce...a good value!” Apple Orchard (Winter) APPLE II w/RAM Applesoft 48K w/DOS...... $35 Demo Disk I Some of our best stuff $9.95 USER'S Manual (refundable with software order) ...... $10 6502 Assembly Listing of INTERPRETER-graphlcs...... $25 Demo Disk II More of our best $9.95 6502;Assembly Listing of INTERPRETER-non graphics.. $20 All of our software is written in Applesoft *, 48K , disk FREE poetage In U.S. and CANADA. Orders mar be prepaid of by bankcard (Include card number and expiration data). Michigan reaidenta Include 4% data m Im tax. Order* ac­ cepted via THE SOURCE • CL04S2. AVANT-GARDE CREATIONS DEALER INQUIRIES INVITED VISA/MASTERCARD ABACUS SOFTWARE P.O. Box 30160 P. O. Box 7211 Eugene, OR 97403 Dept, mi * Apple is a trademark Grand Rapids, Michigan 49510 (503) 345-3043 of Apple Computer, Inc. (12pm-6pm 7 days a week)

D e c i s i o n Decision Systems Presenting...... P.O. Box 13006 Sy s t e m s Denton, TX 76203 A-STAT™ 7 9 SOFTWARE FOR THE APPLE II* A Statistical Analysis and File Maintenance System ISAM -DS is an integrated set of Applesoft routines that gives indexed file capabilities tor the Apple II™ Microcomputer* to your BASIC programs. Retrieve by key, partial key or sequentially. Space from deleted records is automatically reused. Capabilities and performance that match A subset language of P-STAT™ 78 products costing twice as much. computes: $50 Disk, Applesoft. FREQUENCIES PBASIC-DS is a sophisticated preprocessor for structured BASIC. Use advanced logic constructs such as IF...ELSE..., CASE, SELECT, and many more. Develop BI-VARIATE TABLES - CHI SQUARES programs for Integer or Applesoft. Enjoy the power of structured logic at a fraction of CORRELATION MATRICES the cost of PASCAL. MULTIPLE REGRESSIONS $35. Disk, Applesoft (48K, ROM or Language Card). APPLE FILE CABINET INTERFACE DSA— DS is a dis-assembler for 6502 code. Now you can easily dis-assemble any COMPLETE VARIABLE TRANSFORMATIONS machine language program for the Apple and use the dis-assembled code directly as input to your assembler. Dis-assembles instructions and data. Produces code com­ patible with the S-C Assembler (version 4.0), Apple's Toolkit assembler and others. Uses Standard DOS Text Files and EXEC’s $25 Disk, Applesoft (32K, ROM or Language Card).

A-STAT™ 79 on disk with 80-page manual... $125.00 FORM-DS is a complete system for the definition of input and output froms. FORM- OS supplies the automatic checking of numeric input for acceptable range of values, automatic formatting of numeric output, and many more features. 48K version — All programs In Applesoft™ $25 Disk. Applesoft (32K, ROM or Language Card).

Available from: UTIL-DS is a set of routines for use with Applesoft to format numeric output, selec­ tively clear variables (Applesoft's CLEAR gets everything}, improve error handling, Rosen Grandon Associates and interface machine language with Applesoft programs. Includes a special load 296 Petsr Green Road routine for placing machine language routines underneath Applesoft programs. $25 Disk, Applesoft. Tolland, Connecticut 06084 (203) 875-3541 SPEED-DS is a routine to modify the statement linkage in an Applesoft program to speed its execution. Improvements of 5*20% are common. As a bonus, SPEED-DS includes machine language routines to speed string handling and reduce the need for garbage clean-up. Author: Lee Meador. * Apple II™ Is a trademark of the Apple Computer, Inc. $15 Disk, Applesoft (32K, ROM or Language Card). P-STAT™ 78 Is a trademark of P-STAT Inc., Princeton, N.J. A-STAT™ 79 Is copyrighted by Gary M. Grandon, Ph.D. (Add $4.00 for Foreign Mail) *Apple II is a registered trademark of the Apple Computer Co.

No. 3 6 -M a y 1981 MICRO - The 6502 Journal 57 / SOFTWARE UNLIMITED presenting the LARGEST SELECTION OF SOFTWARE EVER ASSEMBLED.

for ATARI® • APPLE® • PET® • and other Microcomputers at SUPER DISCOUNT PRICES! ATARI QUALITY SOFTWARE ON UNE SYSTEMS □ PHYSICS (AT) ...... 24.50 □ 6502 DISASSEMBLER (AT) ...... 10.55 Q HI-RES ADVEN. #0 (AP) [ D l...... 17.95 □ GREAT CLASSICS (A T )...... 24.50 □ ASTRO APPLE (A P )...... 13.55 □ HI-RES ADVEN. #1 [D] (A P )...... 22.50 □ BASIC PHYSCOLOGY (AT)...... 24.50 □ ASTRO APPLE (AP) [D] ...... 17.95 □ HI-RES ADVEN. #2 [D] (A P )...... 29.00 □ PRINCIPLES OF ECONOMICS (AT) . . 24.50 □ ASTEROIDS IN SPACE (Dj (AP) .... 17.95 □ HI-RES FOOTBALL #1 [D] (AP)...... 36.00 □ SPELLING (AT) ...... 25.50 □ ATARI ASSEMBLER. (AT)...... 22.50 □ HI-RES CRIBAGGE [DJ (AP)...... 22.50 □ BASIC ELECTRICTITY ( A T ) ...... 24.50 □ BABBLE (A P )...... 13.55 □ PADDLE GRAPHICS [DJ (A P )...... 36.00 □ SASIC ALGEBRA

Ship the above programs as checked to: Number of Programs Ordered— ------

Amount of order ...... M r./M rs .______

N Y. residents add SalesTax...... Address ______Check program desired. Add shipping anywhere in the U.S. ------Complete ordering information C i t y ______and mail entire ad. Total amount enclosed...... Immediate Shipments from stock. S tate______Z ip . Charge my: □ Master Charge G Visa KEY: I have a Signature A T-Atari name of Computer AP-Apple P-Pet w i t h __ k memory Card No. . Expires . D -on Disc. Personal Checks please allow 3 weeks. C-Cassette M ail to: If not marked-Cassette

ATARI is a trademark of ATARI INC. DIGIBYTE SYSTEMS CORP. APPLE is a trademark of APPLE COMPUTER, INC. PET is a trademark of COMMODORE BUSINESS MACHINES. 31 East 31st Street, New York, N.Y. 10016 ^ Prices subject to change without notice. Phone: (212) 889-6975 N.

MICRO - The 6502 Journal No. 3 6 -M a y 1981 The Atari Dulcimer

The Atari 800 comes with four 1 R E M — ATARI DULCIMER musical voices under program 2 R E M .. B Y M I K E D O U G H E R T Y 3 R E M control through BASIC. The 10 DIM NT(255): REM KEY/NOTE TABLE following program uses these 20 DIM LE(10): REM STRUM DURATION voices to simulate a three-string 100 GOSUB 10000: REM INITIALIZATION 1 0 0 0 REM plucked dulcimer, played in real 1 0 1 0 R E M ---- M A I N S O U N D L O O P time. 1 0 2 0 REM 1 1 0 0 FOR LOOP = 0 TO 1 STEP 0 1 2 0 0 FOR STRUM = 1 TO N 1 3 0 0 FOR DUR = 6 TO 1 STEP - LE(STRUM) 1 3 1 0 SOUND 0,163,10,DUR:SOUND 1,243,10,DUR:SOUND 2,161,10,DUR 1 4 0 0 FOR WAIT = 0 TO TEMPO Mike Dougherty 1 4 1 0 KEY = PEEK (764) Box 230, Rt. 5 1 4 2 0 S O U N D 3,NT(KEY),10,DUR+3 1 4 3 0 N E X T W A I T Kingston, Tennessee 37763 1 5 0 0 N E X T D U R 1 5 1 0 SOUND 0,0,0,0:SOUND 2,0,0,0:SOUND 3,0,0,0 1 6 0 0 N E X T S T R U M 1 6 1 0 IF PEEK (764) « 28 THEN GOTO 20000: REM RESTART PROGRAM 1 7 0 0 N E X T L O O P The Atari 800 personal computer has 1 0 0 0 0 REM 1 0 0 1 0 R E M --- INITIALIZE NOTES AND many outstanding features. The four 1 0 0 2 0 R E M --- VARIABLES FOR DULCIMER musical voices caught my attention 1 0 0 4 0 REM first for three reasons: I enjoy music, I 1 0 0 5 0 GOSUB 30000: REM PRINT KEYBOARD 10100 KEY « 255: REM INITIAL NOTE = NULL had not used a computer with musical 1 0 1 3 0 F O R I = 0 TO 22: READ T1,T2:NT(T1) = T2: NEXT I capability, and the sound voices were 1 0 2 0 0 D A T A 47,173,63,162,46,153 easy to control from BASIC. Having 1 0 2 1 0 D A T A 62,144,42,136,58,128 musical experience with a plucked 1 0 2 2 0 D A T A 56,121,45,114,61,108 1 0 2 3 0 D A T A 43,102,57,96,1,91 dulcimer, it was natural for me to 1 0 2 4 0 D A T A 13,85,5,81,8,76 attempt to simulate this instrument 1 0 2 5 0 DATA 0,72,10,68,2,64 with the Atari 800. 1 0 2 6 0 D A T A 6,60,15,57,7,53 1 0 2 7 0 D A T A 12,50,60,47 1 0 3 0 0 P R I N T "TEMPO INPUT TEMPO A traditional Appalachian-plucked 1 0 4 0 0 P R I N T *# OF STRUMS/LOOP (MAXIMUM 10) INPUT N dulcimer consists of a hollow, fretted 1 0 4 1 0 F O R I = 1 T O N fingerboard on top of a shallow sound 1 0 4 2 0 P R I N T ■LENGTH OF STRUM t " ; I; " INPUT T1:LE(I) = T1 10430 NEXT I box extending symmetrically on either 1 0 9 0 0 RETURN side. The three-string dulcimer utilizes 2 0 0 0 0 R E M a single string to carry the melody, 2 0 0 0 1 R E M - — CLEAN UP AND RESTART 2 0 0 0 2 R E M with the two remaining strings supply­ 2 0 0 1 0 S ing a background harmonic ‘'drone.” 2 0 0 2 0 R U N The plucked dulcimer is typically 3 0 0 0 0 R E M played on the lap, the right hand strum­ 3 0 0 0 1 R E M - 3 0 0 0 2 R E M - ming all of the strings with a pick, the 3 0 0 0 3 R E M - left hand pressing the melody string to 3 0 0 0 4 R F M the frets with a "noter” stick. A 3 0 0 0 6 G background rhythm is impressed on the 3 0 0 0 7 PRINT [ A T A R I D U C c T r EH": PRINT : PRINT 3 0 0 1 0 P R I N T "ATARI SHARP" background drone and melody by 3 0 0 2 0 P R I N T "KEYS: strumming across the strings at dif­ 3 0 0 2 5 P R I N T ferent rates. Most dulcimers have a 3 0 0 3 0 P R I N T NATURAL" scale consisting of approximately six­ 3 0 0 4 0 P R I N T 3 0 0 5 0 P R I N T 'MUSIC" teen notes with no sharps or flats. In 3 0 0 6 0 P R I N T 'NOTES: G A B C D E general, the dulcimer notes range from 3 0 0 7 0 P R I N T the G below middle C to the A in the 3 0 0 8 0 P R I N T I MIDDLE Cl 3 0 1 0 0 RETURN octave above middle C.

No. 3 6 -M a y 1981 MICRO - The 6502 Journal 59 Thus a simulation of a plucked A strumming effect is impressed TEMPO overall speed of the dulcimer must contain at least the upon the strings by allowing the Atari Dulcimer — the following elements: loudness to decrease linearly with limit of the innermost time. The length of the strum is deter­ loop 1. a single voice melody, mined by the step size of the loop: LOOP outermost sound loop 2 . a background drone of voices, index. LOOP uses a 3. a method to impress the strumming FOR DUR = 6 TOO STEP step size of zero to rhythm, -LENGTH(STRUM) form an infinite loop 4. the ability to do the above in real — this method is faster time. than the use of execute either GOTOs SOUND ",~,DUR + 3 or SOUND ~,~,DUR STRUM loop index for each user defined strum — The Atari 800 keyboard was chosen NEXT DUR the duration of each for the melody input. The Atari strum is controlled by Dulcimer maps the "standard key LENGTH(STRUM) row” of A, S, D, F, ..., +, *, (caps Thus LENGTH(STRUM) = 1 is the lower] onto the thirteen notes of G, A, slowest possible strum while DUR loop index for strum B, middle C, ..., E above middle C. In LENGTH(STRUM) = 6 is the fastest loop — DUR controls addition, the Atari Dulcimer also maps strum. (In general, 1 < = the overall loudness of the row of keys Q, W, E, ... =, (return) LENGTH(STRUM) < = 3 gives the the music voices onto the sharp notes. The mapping in­ best results.) The step size was chosen WAIT loop index for delaying formation is maintained in the 256 ele­ to control the duration of the loop in­ the innermost loop to ment "NTE" array. The value of the stead of the limit (fixed at 6 ) so that the limit of TEMPO current key pressed is determined by both short and long strums would start PEEK|764) and used as the index into at the same loudness. The current Atari “NTE” . Each element of "NTE” con­ Dulcimer allows for the definition of tains either the proper pitch for that up to 10 different length strums in a key, or a zero (which effectively turns song. off the melody voice). Thus the follow­ ing two BASIC lines read the keyboard The overall speed of the innermost and play either a note or a "rest” on the delay loop is controlled by the Table 2: Sample Song Parameters for the melody, voice #3: "TEMPO” variable. The fastest possi­ Atari Dulcimer ble tempo (speed) of the program is KEY = PEEK(764) with a zero "TEMPO". To play a song SOUND 3,NTE(KEY),10,~ with no strumming, simply use a large * £ value for "TEMPO". At the end of each _ H H set of strums, the keyboard is checked O O O for the escape key. If the dulcimer 2 2 2 Song Title WWW Note that the keyboard space bar player has played the note "ESC”, then makes a very convenient "rest note" the program stops all of the voices and for the Atari Dulcimer. Although only restarts. "Wildwood Flower” 1 3 1 3 3 23 of the 256 "NTE” elements repre­ "The Battle Hymn of sent actual notes, this method allows the Republic” 1 2 1 3 — direct table lookup of the pitch values for faster execution. Without this Table 1: Program Variables in Atari Dulcimer "O Come All Ye "wasteful” technique, real time play­ Faithful” 3 2 2 3 — KEY last keyboard key ing of the Atari Dulcimer would be pressed, stored in "Loch Lomand” 3 2 2 4 — severely hampered. internal code NT (255) for each key pressed, as determined by The background drone is simulated PEEK(764), NTE(KEY) with the three remaining Atari voices: is the pitch for the voice #1 sounding C below middle C, Mike Dougherty graduated from the sound command University of Tennessee in 1977 with a #0 #2 and voices and combining to N number of strums in M.S. in Computer Science, and has been sound G below middle C. The base G background harmonic employed by Union Carbide at the Oak was simulated by two voices, each drone Ridge National Laboratory since that time. voice one value off the "true” pitch. He has worked on several projects This small discord gives a proper LE (10) array containing the involving computers from the VAX "twang” for a string sound. To main­ step increment that 11/780, down to single board tain the background nature of the determines the microprocessors. His home-based system drone, each background voice is played duration of each presently consists of an Atari 800 with 24K bytes of memory. at a loudness of 3 levels below that of strum: 1< = LENGTH the melody voice. (STRUM) < = 6 JMCftO

60 MICRO - The 6502 Journal No. 36 - May 1981 Bio Savings On Atari & PET! No Risk - No Deposit On Phone Please Call Between 11 AM & 6PM Orders - Shipped Same Day You (Eastern Standard Time) Call° - C.O.D. or Credit Card ' On all in stock units (8 0 0 ) 2 3 3 - 8 9 5 0 ATARI® 800™ ATARI® 810T; /

PERSONAL COMPUTER DISC / L ~ List $1080 DRIVE $759 List $599.95 New Low Price only $489.00 A" Maxell Disks ...... 10 for $34 Sycom Disks ...... 10 tor 29 ATARI Atari Disks...... 5 for 22

400 8 K ...... $419 CX4115 Mortgage & Loan Analysis __ $13 400 1 6 K ...... 449 CX4101 An Invitation to Programming 1 .. . 17 CX8104 Atari 810 410 Recorder...... 62 CX4106An Invitation to Programming 2... 20 815 D isk...... 1199 CX4117 An Invitation to Programming 3... 20 Master Diskette II 822 Printer ...... 359 CX4107 Biorhythm ...... 13 825 Printer ...... 779 CX4103 Statistics I ...... 17 New DOS 2 Operating 830 Modem...... 159 CX4121 Energy C za r...... 13 System Master 850 Interface M o d u le ...... 179 CX4108 Hangman ...... 13 CX852 8K RAM ...... 94 CX4102 Kingdom ...... 13 only $21.00 CX853 16K RAM ...... 149 CX4112 States & Capitals ...... 13 CX70 Light Pen ...... 64 CX4114 European Countries CX30 Paddle ...... 18 & Captials ...... 13 Microtek RAM 16K or32K CX40 Joystick ...... 18 CX4105 Blackjack...... 13 CX86 Printer C able...... 42 CX4111 Space Invaders...... 18 • Full 1 year warranty C016345 822 Thermal CX8106 Bond A n alysis...... 20 • Compatible with 400 or 800 Printer Paper...... 5 CX8107 Stock Analysis...... 20 • Assembled and Tested CA016087 825 80-col. CX8108 Stock Charting...... 20 16K ...... $ 99 Printer Ribbon CX4104 Mailing L is t...... 17 32K...... 189 (3/box)...... 17 CX4110 Touch Typing ...... 20 CX4119 Conversational French ...... 45 CX8102 C a lcu la to r...... 24 CX4118 Conversational German __ 45 CX4109 Graph It ...... 17 CX4120 Conversational Spanish __ 45 CX4120 Conversational Spanish ...... 45 Atari Specialists ... CX4125 Conversational Italian ...... 45 Talk & Teach Courseware; CXL4009 Chess ...... 30 CX6001 thru CX6017 ...... ?3 CXL4011 Star Raiders'" ...... 45 W e C a r r y CXL4004 Basketball ...... 30 Combination Special! CXL4006 Super Breakout" ...... 30 CXL4010 3-D Tic-Tac-Toe...... 30 825 Printer&850 Interface I t A l l CXL4005 Video Easel" ...... 30 825 Lists for $1000 CXL4007 Music Composer ...... 45 Regular Mail Order Price: $779 CXL4015 TeleLink' ...... 20 850 Lists for $220. CXL4002 BASIC Computing Language . 46 Regular Mail Order Price: $179 CXL4001 Education System Software M aster...... 21 Save $20.00 CXL4003 Assembler Editor ...... 45 WordPro 3 (40 col.) ...... $186 Buy Both For Only $938 WordPro 4 (80 col.) ...... 279 WordPro 4 Plus (80 col.) ...... 339 EBS Accounts Receivable c o m m o d o r e Inventory System ...... $695 Dr. Daley Mailing List ...... 129 Visicalc - Apple...... $122 A tari...... 163 Dr. Daley Inventory ...... 89 PET ...... 163 Commodore Computers: OZZ Information S ystem ...... 329 BPI General L e d g e r ...... 329 4032 N ...... $1090 Tax Package ...... 399 4032 B ...... 1090 Dow Jones Portfolio Management __ 129 Printers 8032 ...... 1499 Pascal...... 239 NEC 5530...... $2495 Commodore Peripherals: PET to IEEE C a b le ...... 37 Diablo 6 3 0 ...... 2195 CBM 4022 Printer ...... 675 IEEE to IEEE C a b le ...... 46 Trendcom 100 ...... 299 CBM 4040 Dual Drive Floppy Disk ... 1090 NEW- Trendcom 200 ...... 489 CBM 8050 Dual Drive Floppy Disk ... 1420 Paper Tiger 4 4 5 G ...... 769 8 0 9 6 ...... 1890 CBM C2N Cassette Drive ...... 87 Paper Tiger 460G ...... 1219 Tally 8024 P rin te r...... 1679 VIC - 20 ...... 299 Epson MX-80 ...... 539 To Order: Computer Mail Order Phone orders invited (800 number is for order desk only). Or send checkor money order. 501 E. Third St. Equipment Shipped UPS collect. Pennsylvania residents add 6% sales tax. Add 3% for Williamsport, PA 17701 Visa or MC. Equipment is subject to price change and availability without notice. (717) 323-7921

No. 36 - May 1981 MICRO-The 6502 Journal 61 will also initialize the Toolkit, if it is PRINT# command. The Disk-O-Pro present. Disk-O-Pro is available from disk commands are recognized by Skyles Electric Works for $75. BASIC 4.0, and vice veisa. The slight differences in interpretation will not be /AlCftO The SEW [Skyles Electric Works) a problem for the average user. group includes a number of commands PET Vet not available in any Commodore There is some incompatibility be­ BASIC. A few of the commands need tween programs written with and more discussion than is presented in without Disk-O-Pro. When writing the table. The SCROLL command REM and DATA statements with Disk- By Loren Wright turns a BASIC program listing into a O-Pro, REM must be followed with a continuous cylinder, which can be quote and DATA must be tokenized as Upgrade Decisions moved through the screen, in either " \ ", otherwise these lines will be direction, with the cursor control keys. unreadable without Disk-O-Pro. Of The decision to upgrade from 1.0 to Also enabled by the SCROLL command course commands such as PRINT 2.0 ROMs was very easy for many PET are repeating keys and the ''softkey." USING and BEEP will not be recog­ users. 2.0 corrected several bugs in the nized without Disk-O-Pro. 1.0 ROMs, but the most significant reason to upgrade was to accommodate The "softkey" is a user-defined se­ The ROM occupies the same 4K a disk drive. Other users (without disk quence of characters, which is executed block as the protection ROMs for drives) stayed with the 1.0 ROMs and when the assigned key is hit. The max­ Wordpro and VisiCalc, but these ROMs have been putting up with the bugs. imum length of this sequence is 60 can be changed manually or by using a characters for Disk-O-Pro used with programmable ROM switch. Also, The arrival of the 4.0 ROMs the Toolkit, and 80 characters without Disk-O-Pro does not speed up garbage presents us with different kinds of deci­ the Toolkit. collection—a major feature of BASIC 4.0. sions. To be sure, Commodore has stopped making 2.0 ROM machines, PRINT USING is a command for and these will eventually receive less formatting output of strings and Finally, I should point out that support in hardware and software. That numbers. This is particularly useful Disk-O-Pro is not BASIC 4.0, even if it reason alone is not sufficient for an when handling dollar and cent figures. behaves that way. Commercial soft­ upgrade. After all, 1.0 ROM PETs are Lining up decimal points, embedding ware written specifically for BASIC 4.0 still alive and reasonably well. commas, and adding trailing zeroes won't run with BASIC 2.0 and Disk-O- after the decimal point, can be Pro. The most important reason is the automatically accomplished with a new DOS — 2.1 if you buy a 4040 disk single PRINT USING statement. Disk-O-Pro adds some really drive or upgrade a 2040, 2.5 if you buy outstanding capabilities to your PET. an 8050. BASIC 4.0 is built around BEEP controls a speaker connected However, you will have to make your DOS 2.1/2.5. All commands are handled to the CB2 line of the parallel user port. decision based on your own cir­ directly by the DOS, without com­ The STOP key acts like the DELETE cumstances. Disk-O-Pro offers com­ plicated secondary addresses or having key, except characters disappear to the patibility with DOS 2.1/2.5, BASIC to load a DOS program. A new, effi­ light of the cursor. 4.0, and the Programmer's Toolkit, cient, relative-record system has been along with many other useful features. added, and several other operations Because most of Disk O-Pro's com­ The price of Disk-O-Pro is slightly have been improved. Most commands mands work both in immediate and lower than that of a BASIC 4.0 upgrade. require only a file name. programmed modes, Disk-O-Pro has to If you already have a Toolkit, then the intercept the PET's command input price difference is more significant, The other major change with BASIC every time to check for its own com­ since you would then have to replace 4.0 is the improvement of the garbage mands. This means that: program ex­ your Toolkit with a 4.0 version. collection process. Every time memory ecution is slowed down—usually less However, if you need faster garbage col­ gets tight, BASIC has to clear memory than 2 0 %—but sometimes a lot more. lection, full-speed operation, full com­ of old copies of dynamic strings. With Fortunately, there is a KILL command, patibility with others' computers, and older BASICs, this could take up to 20 so that Disk-O-Pro can be disabled dur­ access to the latest commercial soft­ minutes. 4.0 BASIC collects its garbage ing those parts of the program where ware, then you need BASIC 4.0. in less than one second. execution speed is important. Command-O: Enhancements for Disk-O-Pio: An Alternative to a 4.0 The disk commands are essentially the 80-Column CBM Upgrade? the same, but there are minor dif­ ferences, which could pop up unex­ Command-O is also a 4K ROM, ad­ Disk-O-Pro combines the 4.0 pectedly. For instance, with Disk-O- dressed $9000 - $9FFF, but it is only for BASIC disk commands (for the 2.1/2.5 Pro, specifying the disk unit (.. .ON U9) 4.0 ROM machines—particularly the DOS) with several other commands resets the default device number to the CBM 8016/8032. It is available from and features. It is a 4K ROM, addressed one specified. In BASIC 4.0 the default Skyles Electric Works for $75. This $9000-$9FFF, and works with 2.0 ROM device number is always 8 . There are ROM includes the SEW commands (level m BASIC) PETs and CBMs. It is also differences in when the error chan­ described above for Disk-O-Pro. The designed to be compatible with the nel is checked, and whether a carriage only difference is that the "softkey" Toolkit. In fact, initializing Disk-O-Pro return has to be output after each may be SET to 190 characters. The rest

62 MICRO - The 6502 Journal No. 36 - May 1981 of the 4K ROM is occupied with the Editing/Debugging commands from the Programmer's Toolkit. $F000

2.0 2.0 2.0 4.0 4.0 4.0 There is also a MOVE command $E000 BASIC BASIC BASIC BASIC BASIC BASIC that allows you to position the cursor at any row, column-specified point on JDOOO the screen. The 'ESCAPE' key is con­ verted to a 'CONTROL' key, enabling $COOO more convenient use of the 8016/8032 screen functions. As examples, SBOOO | Toolkit Toolkit | 'ESCAPE-DELETE' deletes a text line, 'ESCAPE-G' sounds a beep, and | Toolkit" 'ESCAPE-CLEAR' sets the upper left $A000 comer of the window. Disk-O-Pro Disk-O-Pro Command-0 $9000

Three of the Toolkit commands are Toolkit $40 $ 40 $ 40 included in improved versions. FIND Disk-O-Pro $75 $ 75 and RENUMBER allow the operation to Command-O $ 75 be restricted to a specified range of line BASIC 4.0 Upgrade $89 $ 89 $ 89 numbers. TRACE displays each line before it is executed, and a STEP mode $40 $75 $115 $89 $129 $164 is included.

As with Disk-O-Pro there are poten­ Programmer's tial problems with slower execution Toolkit (available Disk-O-Pro Command-O speed and incompatibility with non- Command 1.0. 2.0. 4.0) (2.0 only) (4.0 only) 4.0 BASIC Description Command-O systems. Since most of SEW Group Command-O's commands apply only INITIALIZE X X Initialize disk|s|. in the immediate mode, it is more con­ MERGE X X Disk append (similar to Toolkit venient to turn the ROM off with the "APPEND"! or overlay. EXECUTE X X Load and run a program from KILL command when execution speed disk. is critical. The combination of the SEW SEND X X Send a disk command. commands and improved Toolkit com­ SCROLL X X Turn on enhanced screen editing (see text). mands makes Command-O a very SET X X Define softkey. significant addition to your system. OUT X X Turn off SCROLL functions. PRINT USING X X Formatted output of numbers and Unlike Disk-O-Pro, it is not being sold strings. as an alternative to a BASIC upgrade. BEEP X X Controls length and pitch of tone. KILL X X • Remove Disk-O-Pro or Command-0 from system.

DOS 2.1/2.5 Group Programmer's Toolkit: The Old CONCAT XX Concatenate one file to another. Standby DOPEN X 9 X Open disk file. rf DCLOSE X X Close disk file. RECORD X 55 X Position disk at desired relative The Programmer's Toolkit is a 2K < record. ROM, available in versions for all three HEADER X X Formats a disk. .5a Commodore BASICs. The price varies COLLECT X X Cleans up improperly closed files. BACKUP X •s X Duplicate one disk onto another. from $40 for just the ROM, to $60 for COPY X •g X Copies one disk to another the ROM with an adaptor board that .S without altering the second. connects to the memory expansion APPEND X •3 X Like DOPEN, b u t applies only to 1 sequential files. port. The addressing is $B000 - $B7FF DSAVE X B X Save a BASIC text file on disk. DLOAD X 1 X Load a BASIC text file from disk. for 1.0 and 2.0 ROMs, and $A000 CATALOG X U X Display disk directory. RENAME -$A7FF for 4:0. The Programmer’s X s X Change the name of a file. SCRATCH X X Remove a file from disk. Toolkit is manufactured by Palo Alto £H Integrated Circuits (PAICS) and sold DIRECTORY X X Display disk directory. not only by them, but also by dealers Editing and throughout the country. Debugging Group AUTO X X Automatic line numbering. DUMP X £ X List values of all non-array This product was reviewed in the o y variables. DELETE X X < Delete lines within range August, 1980 MICRO (27:31) by James 4 CQ a specified. Strasma. Unlike Disk-O-Pro and EIND o X ■s X Find command or string in BASIC program. Command-O, all its operations take % s2o place in the immediate mode. HELP XX Indicate errors in BASIC line. TRACE X i X J Display program line and execute through program. Therefore, there is no problem with in­ I compatibility or slowed execution. OFF X 1 X Turn off trace. RENUMBER X s X *5 Renumber program or program .ts segment. STEP X sS IX] § Step through program (included o H in Command-O TRACE). H APPEND X [X] Append program (included in Command-O MERGE).

No. 3 6 - May 1981 MICRO - The 6502 Journal 63 People Who Know Quality and Need Speed, Flexibility and Reliability

Demand

JINSAM 8 0

Data manager for 32K 8000 series Commodore computers. Want To Know Why? ★ Commodore approved software. ★ Unlimited definable categories. ★ Unlimited record length. ★ Unlimited data bases per disk. ★ Custom reports and labels. ★ Machine sorted by three categories at once. ★ Performs calculations and statistics. ★ Interface with Word Pro 4™ and/or Word Pro 4 + ™ ★ Recommended by Professional Software Want To Know Mote? See your local dealer, send for descriptive information, or send $15.00 for your own demonstration disk. Jini Micro Systems, Inc. Box 274 M.8 Riverdale, NY 10463

Word Pro and Word Pio 4 + axe Trademarks of Professional Software.

64 MICRO - The 6502 Journal No. 36 - May 1981 An Inexpensive Word Processor

Figure 1 presents a photograph of to the appropriate connector for that This circuit interfaces an IBM my system. Note the large keyboard in terminal. The solenoids are activated 2740 Communications Terminal front of my PET. This keyboard is a by grounding the proper solenoid. The to an 8-bit parallel port. Soft­ standard replacement part available proper activation of a combination of ware is included for a PET from the Commodore Service Depart­ four rotate solenoids and two tilt implementation, but is easily ment. The case must be fabricated solenoids results in a character being separately. The keyboard simply plugs typed. Additionally, several other converted to other micro­ into the PET main circuit board in solenoids are required for control computers. place of the small keyboard. The characters, etc. These include a check "black box" between the PET and the solenoid (required for all printable Selectric houses the interface characters), space, backspace, index, electronics. shift, and carriage return solenoids. William F. Pytlik Thus, a total of twelve solenoids must 9012 Maritime Court be addressed by the eight output port Springfield, VA 22153 The interface converts the user port lines. Consequently, a hardware TTL voltage levels to voltage levels decoding scheme is necessary. An required to drive the Selectric analysis of the schematic (figure 2 ) Of the many uses of personal solenoids. Figures 2 and 3 present the readily reveals the decoding scheme. computers, one of the most useful and schematic of interface and power sup­ about which much has been written is plies. I made my own printed circuit IC2 and IC3 (74LS126) simply act as word processing. For many, word board, but this circuit can be buffers between the PET and the inter­ processing is a "nice to have” feature, constructed using a general-purpose face. IC4, IC5, IC6 (74LS02) are used as and in most cases well outside financial hobbyist PC board or by wire- decoders and drivers for the solenoid means. Daisy Wheel printers and the wrapping. The interface converts the 5 drivers (transistors Q1 to Q12). Thus a associated hardware/software needed volt TTL levels of the PET to the " 0 " at the output port energizes a to use the PET for word processing may voltage level (35 to 55 VDC) required solenoid by turning on one of the tran­ cost in excess of $4000. by the Selectric solenoids. The voltage sistors. Transistors Q1 to Q12 is not critical — IBM uses 48 VDC. I (2N3904) are simple switching Fortunately, an alternative exists used a 27 volt transformer which I had transistors. I used 2N3904's because for those who wish to use their PETs available, resulting in a DC voltage of they were readily available. They work for limited word processing; that is, the 38 volts. The 38 VDC on my Selectric well switching the 38 volts. If higher 2 voltage levels are used, then a higher occasional letter, technical report, or is applied to pin of the "t" connector. Since other terminals may be different, voltage transistor must be used (i.e. magazine article. The alternative is based on the use of the IBM 2740 the positive voltage should be applied TIS95). Communications Terminal. These surplus terminals are available from a Figure 1 variety of sources and range in price from $ 1 0 0 to $600 (without interface electronics). All these terminals have one thing in common—they are heavy duty IBM Selectric typewriters, modified with solenoids, which ac­ tivate the proper mechanical action of the typewriter. Therefore, to use the PET for simple word processing is con­ ceptually simple. First an interface between the PET and the typewriter must be designed. Then appropriate software must be written that will per­ m it creation of text and, via the PET user port, drive the proper Selectric solenoids.

65 No. 3 6 -M a y 1981 MICRO - The 6502 Journal Two power supplies are required. A Q 1 - Q 1 2 one amp unregulated 35 to 55 VDC is TO required to drive the solenoids while a ^ SOLENOIDS regulated 5 VDC power supply is needed for the interface logic circuitry. P A 7 All components (with the exception of the 7500 microfarad, 50 volt capacitor) are mounted on the single PC board. Figure 4 presents a photograph of the completed board mounted in the chassis. P A 4 The capability to drive the solenoids now exists. The remaining problem is to provide the proper timing P A 5 and appropriate code to print the right character or effect proper operation. Table 1 presents the code conversion P A 3 details. To pick a solenoid requires approximately 10 miliseconds (ms). To complete the mechanical action of printing a character requires an addi­ tional 60 ms. The time the carriage return requires is considerably longer. P A 2 Since printing each character takes a 11 TRANSISTOR minimum of 70 ms, there is no need for DRIVERS AS a machine language program. A BASIC ABOVE program can adequately drive the typewriter at its maximum speed.

P A 1 Table 1: Code Selection Chart

0 0 1 1 T2 CR RRR SHIFT T1 0 1 0 1 k 5 2 2 1 NOTE: ON IC2, IC3 A PINS 1,4,10,13,1'4 at +5V PIN 7 at ground 1 1 U # t $ 0 1 1 ON IC4, IC5, IC6 N 9 Z r i 0 1 1 1 0 PIN 14 at +5V 6 0 0 1 0 1 1 PIN 7 at ground S w f CARRIAGE H 4 u m d 0 1 0 1 0 RETURN I 2 s k b 0 1 0 0 1 F 0 @ - & 0 1 0 0 0 T 8 y q h 0 0 1 1 0 Figure 2: Interface Logic E 7 X p g 0 0 0 1 1 D 5 v n e 0 0 0 1 0 3 t 1 c 0 0 0 0 1 T2 1 / j a 0 0 0 0 0

1 1 5 VAC '2 7 V —t T S 11 1 ! 0 1 1 1 1 C 4 + 38 VDC H I z R I 0 1 1 1 0 I 1 w O F 0 1 0 1 1 - i F u MD 0 1 0 1 0 T < S KB 0 1 0 0 1 E 1 + 0 1 0 0 0 D * Y Q H 0 0 1 1 0 > X P G 0 0 0 1 1 % VNE 0 0 0 1 0 ; T L C 0 0 0 0 1 7 J A 0 0 0 0 0

Note: The codes above must be sent to the interface for proper operation. To generate a space the NO-PRINT and Figure 3; Power Supplies CHECK solenoids must be picked.

66 MICRO - The 6502 Journal No. 36 - May 1981 Listing 1 presents the BASIC The PRINT program assumes that Both the CREATE and PRINT program required to read text from tape data is written on a file. The text is programs are slowed because of the and type it on paper. The program is then retrieved, one character at a time, many REM statements. To speed up well documented and needs little and printed. Thus, a program is program execution I recommend explanation. Some items should be required to create the text. Listing 2 removal of REM statements prior to noted. First, the shift solenoids are presents a simple approach to word use. latched; that is, once picked, the processing. Features include update typewriter remains in that case until capability. The program requires the the solenoid is picked again. The use of two cassette drives, but this can Using the Selectric to check your program keeps track of case and be changed if two cassettes are not draft is slow. Listing 3 presents a short appropriately picks the shift solenoid. available. The program is well program which provides a quick listing The program assumes that the documented. The following of the text on my AXIOM printer. The typewriter is in lower case when it is symbols/codes are used: program will only work with an turned on. There is no guarantee of AXIOM printer and must be modified this. Consequently, the program asks for use on other high speed printers. you to check for case at the beginning shifted & end of text In conclusion, the word processing of every page typed. This is simply backspace done by manually typing a character. capability is limited, but it is low cost. shifted $ underline Additional features can readily be Secondly, the code used in this program shifted " can be used in lieu of is for the BCD type ball only. The code added to the CREATE program, but, for space the average user, like myself, the may be changed to accommodate other cursor down index type elements, but the typewriter will limited capability provided in this arti­ cursor left deletes these cle is all that is really necessary. no longer function in the manual characters mode. To determine the proper code, delete deletes that line trial and error methods may be the return carriage return/end of best. Throughout the program a series line of delays are introduced. These are re­ quired to give adequate time for Ed. Note: To convert these programs to other solenoid activation. These may have to During Update only: be adjusted for a given terminal. machines, the following in­ formation will be useful. return line of text OK Reverse field characters per­ Finally, a word about the look-up A permits insertion of form cursor control func­ table. The code for shifted and additional text tions, such as clear screen, unshifted characters is the same—the retains previous line cursor right, and cursor position of the shift solenoid deter­ permits insertion of home. Decimal address mines case. Consequently, when the additional text 59459 is the data direction look-up table was developed, 64 was deletes previous line register for the PET's parallel subtracted from the code of the shifted shifted end of insertion port and 59471 is the write characters. This permits easy iden­ delete deletes that line address for the port. tification of shifted characters. Before home deletes displayed line the code is sent to the interface, 64 is —a new line must be added back. entered Figure 4 Parts List

T1 6.3 volt Transformer T2 27 volt Transformer IC1 7805 5 volt Voltage Regulator IC2,IC3 74LS126 Quad Buffers IC4-IC6 74LS02 Quad NOR Gates R1-R12 IK lA watt Resistor Q1-Q12 2N3904 BI 50 PIV 1 amp Bridge B2 100 PIV 1 amp Bridge Cl 5000 uf 12 volt Capacitor C2 .22 uf Capacitor C3 .1 uf Capacitor C4 7500 uf 50 volt Capacitor MISC Chassis, Wire, Sockets, etc.

No. 3 6 -M a y 1981 MICRO - The 6502 Journal 67 10 REM * * * SELECTRIC PRINT ROUTINE =*•+•♦ 510 GET D *:IF D*=,,n THEN 510 20 INPUT "til S TYPEWRITER IN LOWER CASE - 520 GET#1,A* - Y OR N " ;L C $ 530 PRINTAS; 30 IF LCt="H" THEN GOSUB 840 540 REM CHECK FOR END OF FILE 40 REM IF THE TYPEWRITER IS IN UPPER 550 IF ST>0 THEN 770 CASE THE SHIFT SOLENOID IS PICKED 560 REM IF CHARACTER IS RETURN THEN 50 POKE 59468,14 ACTIVATE CARRIAGE RETURN 60 REM PLACE PET IN LOWER CASE MODE 570 IF ASCCAf>=13 THEN POKE 59471,254:P 7 0 CODE’-:=0 OKE 59471,255:GOSUB810:GOTO520 80 REM IN ITIALIZE SHIFT CODE— 0=LOWER 580 REM IF CHARACTER IS A SPACE THEN CASE PRINT THE SPACE. THIS IS DONE UNIQUELY 90 INPUT"ti-NTER FILE NAME" ;TEXTS 590 REM BECAUSE ACRSCCfl$>> IS LESS THEN 1 0 0 P R IN T 64 BUT IS NOT A SHIFTED CHARACTER 110 DIM AC £20 > 600 IF fiSC=3£ THEN 690 ISO REM SELECTRIC CODE LOOK-UP TABLE 610 REM THE NEXT FEU LINES OF CODE 1 3 0 AC 13 >=£54:: RC 17 > = £ 5 1 : AC3 2 > = 6 1 :! CHECK FOR UPPER-SLOWER CASE RND SEND 4 7 620 REM APPROPRIATE CODE TO USER PORT 1 4 0 A< 34 >= 15:: AC 35 >= 79: AC36 >=111 630. IF AC ASCC A30X64 THEN 660 1 5 0 A< 3 7 >= 2 :: AC 3 8 > = 1 2 0 : AC 3 9 >= 11 640 IF C0DE>:=1 THEN CODE’;=0: GOSUB 840 1 6 0 AC 4 0 >= 1 4 ;; AC 41 >= 8 : AC 4 2 >= 6 650 GOTO 680 1 7 0 A< 43 >= 56:: AC44 >= 9 5 : AC 4 5 > = 1 0 4 660 IF CODEJ:=l THEN 680 i 8 0 AC 4 6 >= 1 £7 :: AC 4 7 >= 8 0 : AC 4 8 >= 7 2 670 CODE";=l: GOSUB 840 1 9 0 AC 4 9 >= 6 4 : : AC50 >= 73: AC 51 >= 6 5 680 IF CODE^=l THEN POKE 59471,AcASCCH* 200 ft<52 >= 74::fl< 53 >= 66:AC54 >= 75 >>+64:GOTO 710 210 AC55 >= 67:: AC56 >= 70: AC57 >= 7 8 690 POKE 59471, AC ASC< A f > > 2 2 0 AC 5 8 >= 1 0 :: AC59 >= 1: AC60 >= 9 700 FOR 1=1 TO 2 :NEXT! £ 3 0 AC 61 >= 0 718 POKE 59471,255 2 4 6 AC 6 2 >= 3 ::R< 63 >= 16:AC64 >= 8 8 720 REM DELAY TO PERMIT SOLENOIDS RND £ 5 0 AC65 >= 48: AC66 >= 57:AC67 >= 49 PRINT MECHANISM TO REACT £ 6 0 AC6 8 >= 5 8 : : AC 6 9 >= 5 0 : AC 7 0 >= 5 9 730 FOR 1=1 TO 8 :NEXT I £ 7 0 AC 71 >= 5 1 :i AC72 >= 54: AC 7 3 >= 6 2 7 4 0 REM CHECK FOR END OF PAGE 2 8 0 AC 7 4 >= 3 £ :: AC 7 5 >= 4 1 : AC 7 6 >= 3 3 750 IF THEN POKE 59471 ,£55: GOTO £ 9 0 AC 7 7 >= 4 2 : AC 7 8 >= 3 4 : AC 7 9 >= 4 3 7 8 0 3 0 0 AC 8 0 >= 3 5 : AC 81 >= 3 8 : AC 8 2 >= 4 6 760 GOTO 520 3 1 0 AC 8 3 >= £ 5 : AC 8 4 >= 1 7 : AC 8 5 >= 2 6 770 POKE 59471,255 3 2 0 AC 8 6 >= 1 8 : AC 8 7 >= 2 7 : AC 8 8 >= 19 780 CLOSE 1 3 3 0 AC 8 9 >= 2 2 :: AC 9 0 >= 3 0 : AC 91 >= 4 7 9 0 END 340 AC163 >= 4 0 :AC 93 >= 6 3 :AC 94>= 31 880 REM DELAY NEEDED FOR CARRIAGE 350 At 95 >=£47:AC 193>=112:At 194>=121 RETURN 360 AC195 >=113:AC196>=122:AC197>=114 810 FOR 1=1 TO 500:NEXT I 370 AC198>=123:AC199>=115:A<200>=118 820 RETURN 380 AC 201>=126:fl<20£>= 9 6 :fit 203>=105 830 REM SHIFT 390 AC £04 >= 9 7 :AC 205>=106:AC 206>= 98 840 POKE 59471,253:FOR 1=1TO 5 :NEXT I: 400 At £07 >=107:AC £08 >= 9 9 :AC 209>=102 POKE 59471,255:FOR 1=1 TO 10:NEXT I 410 AC 210 >= 110: AC 211>= 89:AC212>= 81 8 5 8 RETURN 420 At 213 >= 9 0 :AC 214 >= 82:A<£15>= 91 430 AC£16>= 8 3:AC £17 >= 86:A<218>= 94 440 AC123 >= 8 8 :R<164 >=40 450 REM PROGRAM OUTPUT PORT FOR WRITE 460 POKE 59459,£55 10 REM ***CREATE TEXT*#* 470 POKE 59471,£55 20 DIM TEXTSC 60 > 480 REM OPEN FILE WHICH CONTAINS TEXT 30 INPUT"LiENTER LENGTH OF LINE";LN 490 OPEN 1 ,1 ,0 ,TEXTS 40 INPUT"ENTER NUMBER OF LINES PER PAGE 500 PRINT“LINSERT PAPER AND PRESS RETUR ■ ;P L N WHEN READY” 50 X=0:X1=1

68 MICRO - The 6502 Journal No. 3 6 - May 1981 55 REM PLACE PET IN LOWER CASE MODE 485 REM IF CURSOR LEFT THEN PREVIOUS 60 POKE 59468,14 CHARACTERC S > IS DELETED 70 INPUT"ENTER FILE NAME” ;FIS 418 IF ASCC AS >=157 THEN TEXTSCXI>=LEFTS 80 INPUT“UPDATE Y OR N” ;UDS C TEXTSC X I> ,LENC TEXTSC X1> > -1 >:GOTO 340 108 PRINT"L" 4 2 0 I F HSCC AS > = 1 6 £ THEN AS=CHRSC3 2 > 105 REM OPEN CASSETTE S FOR WRITE 425 REM CREATE A LINE OF TEXT BY CON­ 116 OPEN £ ,2 ,1 ,FIS CATENATING INDIVIDUAL LETTERS 138 IF UDS="Nn THEN 310 430 TEXTSC XI>=TEXTSC XI>+AS 135 INPUT"INSERT ADDITIONAL TEXT BEFORE 440 GOTO 340 MAIN TEXT— IF YES ENTER R” ;US 445 REM END OF TEXT— SAVES DATA 136 REM OPEN CASSETTE 1 FOR READ 450 X1=X1+1: IF X1=PL+1 THEN PR IN T"***** 140 OPEN 1 ,1 ,0 ,FIS M e*********11: bOTO 49a 145 IF US="R” THEN 3i0 460 IF UDS="Y“ AND CUS=“A" OR US="I"> T 158 PR I NT “ Li" HEN 3 £ 0 155 REM GET ONE LINE OF TEXT ONE 470 IF UDS="Y" RND X=8 THEN 160 CHARACTER AT A TIME 480 GOTO 3£0 1 6 0 B S = " " 498 FOR 1=1 TO XI 170 GET#!,AS 500 PRINT#2,TEXTSCI> 180 IF ASCC AS >=13 THEN TEXTSC X1 >=BS: GOT 5 1 0 NEXT I O £10 5£0 CLOSE1: CL0SE2 190 BS=BS+AS 5 3 0 END £08 GOTO170 540 IF ASCCAS>>64 AND ASCCAS><91 THEN fl £10 IF ST=64 AND UDS="Y" THEN X=i:GOTO S=CHRSC RSCC AS > + 1 2 8 > : RETURN 3 1 0 55B IF RSCC AS >>192 AND ASCCASX£i9 THEN 215 REM PRINT LINE OF TEXT ON SCREEN AS=CHRSCASCC AS > -1 £ 8 > £28 PRINT TEXTSCXI> 5 6 0 RETURN 2£5 REM NEXT LINES DETERMINE WHAT IS TO BE DONE WITH LINE OF TEXT £30 GET US:IF US="“THEN £30 £40 IF ASCCUS>=13 THEN Xl=Xl+l:GOTO 160 10 REM *** PRINT ROUTINE FOR AXIuH 80IF' £58 IF RSCCUS>=£0 THEN 160 P R IN T E R *** £60 IF RSCCUS>=19 THEN 320 £8 PR I NT "Li" £70 IF US="A" THEN X1=X1+1:GOTO 320 3 0 D IM BSC 1 0 0 > £80 IF US="I” THEN 328 46 INPUT"FILE NAME"jFILES 290 PRINT"WRONG CODE— REENTER“ : GOTO 230 50 POKE 59468,14 306 GOTO160 6 0 1 = 1 310 PRINT-ENTER TEXT" 70 OPEN 1 ,1 ,0 ,FILES 3£0 TEXTSC X I>="" 8 0 B S = " " 325 REM SET RIGHT HAND MARGIN 98 GET#1,RS 330 FOR 1=1 TO LN:PRINT“E "; : NEXTI: PRINT 100 PRINTAS; " 1“ j :FOR 1 = 1 TO CLN+1>:PRINT“IT NEXTI 110 IF ST>0 THEN 180 335 REM GET CHARACTERS FROM KEYBOARD 128 IF ASCCAS>=13 THEN 158 USE "I" FOR END OF TEXT 13a BS=BS+fiS 340 GET AS: IF AS=B" THEN 340 140 GOTO 90 345 REM INDICATION FOR END OF INSERTION 1 5 8 BSC I> = B S 350 IF AS=*'»" THEN 168 1 6 0 1 = 1 + 1 360 IF AS="t" THEN 490 1 7 0 G OTO80 370 IF ASCC AS >=£0 THEN PRINTCHRSC13>:GO 1 8 0 C L O S E 1 TO 3 2 0 198 OPEN 4 ,4 :CMD4:PRINTCHRSC8 >:PRINTCHR 375 REM SUBROUTINE 540 MAKES PET K'EYBOR SC 1 1> :PRINTCHRSC14> RD LOOK LIKE H TYPEWRITER KEYBOAR 200 FOR A=1 TO I D 2 1 0 P R IN T BSC A > 380 GOSUB 540 2 2 0 NEXT A 390 PRINTRS; 230 PRINTS4:CL0SE4 408 IF ASCCAS>=13 THEN 450 2 4 0 END

No. 3 6 -M a y 1981 MICRO-The 6502 Journal 69 MOR€ SOFTUJflRC TOOLS _ _ _ FROM H€S FOR VOUR 8 K PET by Joy Bolakrlshnon M M M M HESEDIT: change 22 lines of data by merely over­ END FRUSTRA TIONH typing and insert, delete, and even duplicate lines- all at once! Scroll forwards or backwards by any FROM CASSETTE FAILURES amount — it's also easy to edit files bigger than your PERRY PERIPHERALS HAS memory. Why code a program to maintain each file? THE HDE SOLUTION Use HESEDIT for mailing lists, notes or prepare OMNIDISK SYSTEMS (5" and 8") assembler source for HESBAL. All keys repeat. FAST- written in BASIC and assembler. ONLY $12.95 ACCLAIMED HDE SOFTWARE • Assembler, Dynamic Debugging Tool, 6502 ASSEMBLER PACKAGE: HESBAL, a full-featured assembler with over 1200 bytes free (8K) & HESEDIT; Text Output Processor, Comprehensive for less than $25! HESBAL is THE best 8K assembler Memory Test available: it uses only 1 tape or disk, yet includes • HDE DISK BASIC NOW AVAILABLE variable symbol sizes, pseudo-opcodes, over 25 error PERRY PERIPHERALS S-100 PACKAGE messages and more than 70 pages of documentation. ONLY $23.95 Adds Omnidisk (5") to Your KIM /S-100 System HESLISTER: formats multi-statement line BASIC • Construction Manual—No Parts programs, shows logic structure (disk reqd.) $9.95 • FODS & TED Diskette GUARANTEED to load or replaced FREE • $20. +$2.postage & handling. (NY residents Order from your dealer or direct from us add 7% tax) (specify for 1 or 2 drive system) Plus $1.50 Postage (our doc. is heavy!) Place your order with: Disk - Add $3 . C alif Res. - 6% Sales Tax PERRY PERIPHERALS Human €ngineered Software P.O. Box 924 | |[ 3748 ingleuiood Blvd. Room 11 Miller Place, N.Y. 11764 Los Angeles, California 90066 (516) 744-6462 24 HOURS - (213) 398-7259 Dealer inquiries welcomed Your Full-Line HDE Distributor/Exporter

NIKROM TECHNICAL PRODUCTS PRESENTS A DIAGNOSTIC PACKAGE FOR THE APPLE II AND APPLE 11+ COMPUTER. “THE BRAIN SURGEON" All major computer systems are checked for functional hardware analysis on a regular basis for logical as well as some practical reasons. Finding what is exactly wrong can account for most of the money consuming down-time. The Most Powerful Disk-Based Apple Computer Co. has provided you with the best equipment available to date. Macro Assembler/Text Editor The Diagnostic's Package was designed to check every major area of your computer, detect errors, and report any malfunctions. The Brain Surgeon will put your system Available at A NY Price through exhaustive, thorough procedures, testing and reporting all findings. The Tests Include: Now includes the Simplified Text Processor (STP) • MOTHERBOARD ROM TEST FOR BOTH APPLE II AND APPLE II + For 32K PET, disk 48K APPLE II • APPLESOFT CARD TEST • INTEGER CARD TEST • MEMORY RAM TEST 3.0 or 4.0 ROMS or — OR — or APPLE II + • DISK DRIVE ANALYSIS • MONITOR ALIGNMENT 8032 (specify) and DISK II • DC HAYES MICRODOOEM H TEST MAE FEATURES System Diagnosis is an invaluable aid to your program library even if your system — Control Files for Assembling Multiple named source files is working fine. Hours have been wasted trying to track down a “program bug” when from disk — Sorted Symbol table — UP to 31 chars./label actually hardware could be the blame! — 27 Commands, 26 Pseudo-ops, 39 Error Codes The Brain Surgeon allows you to be confident of your system. This can be critical — Macros, Conditional Assembly, and a new feature we developed when file handling, sorts or backups are involved. You m u s t depend on your called Interactive Assembly computer during all these critical times. Running The Brain Surgeon prior to these — Relocatable Object Code important functions helps to insure that your system is — String search and replace, move, copy, automatic line operating at peak performance. numbering, etc. The Brain Surgeon is easy to use and supplied on diskette STP FEATURES with complete documentation. — 17 text processing macros — Right and left justification PRICE: $45.00 — Variable page lengths and widths REQUIRES: 48K U APPLESOFT in ROM, 1 Disk Drive ^ — Document size limited only by disk capacity DOS 3.2 or 3.3 — Software lower case provision for APPLE II without lower case modification Nikrom Technical Products ALSO INCLUDED iS PROSPECT STREET • LEOMINSTER, MA 01453 — Relocating Loader Order Toll-Free Anytime — Sweet 16 macro library for APPLE and PET Master Charge & VtSA users call: 1-800-835-2246 — Machine Language macro library Kansas Residents call: 1-600-362-2421 — Sample files for Assembly and text processing — Separate manuals for both APPLE and PET PRICE — MAE, STP, Relocating Loader, Library files, 50 page manual, diskette — $1 69.95 SEND FOR FREE DETAILED SPEC SHEET EASTERN HOUSE SOFTWARE 3239 LINDA DRIVE WINSTON-SALEM, N. C. 27106 (919) 924-2889 (919) 748-8446

70 MICRO - The 6502 Journal No. 3 6 -M a y 1981 Tiny Pilot Follow Up

MICRO has presented Tiny Pilot A — first half of the addition problem The next statement which needs for the SYM, KIM and AIM in B — second half of the problem explanation is C:$ = X. This is another previous articles.* Here is D — a work variable way of matching a variable value. Set­ additional information about W —count of wrong answers ting $ equal to X puts the character “Tiny” and a programming R — count of right answers string for X into the answer area, so example. X — alternates between 0 and 1 that the M:1 that follows will see if X was equal to 1. The purpose of X in the program is to add variety to the process. Labels used are: If it is equal to 1, the subroutine N adds 2 to variable A and sets X = 0 for the Q — start of the addition question next time. When X is equal to 0, B gets O — jumped to when answer is correct 1 added to it. Also, if X is equal to 1 and Nicholas J. Vrtis D — program wrap-up (done] the answer is correct, the program 5863 Pinetree S.E. N — start of subroutine to get next types out "VERY GOOD!" Kentwood, Michigan 49508 numbers for next problem B — jumped to, to add to B instead of A in subroutine

Note that there are no spaces in the compute statements. The state­ Here is the sample Tiny Pilot program a ment gets the operator's name so that it Finally, here are a couple of com­ number of you have asked for since the can be output in the T: statements with ments about the published version of original Tiny Pilot in the September the $? to personalize the whole thing. the program. MICRO did a very faithful 1979 issue of MICRO (16:41). It is not Further down in the program, the A: job of reassembling my source. The necessarily an example of "good" Pilot accepts the operator’s answer to the only problem I have heard about is that programming (unless you consider any­ addition problem as a character string. the at sign (@) did not print in the com­ thing that works "good” ]. It was writ­ The M:QU statement looks for any ments. This is the character used to ten for two reasons. First, as a simple, answer starting with these two letters. start the execution of the Tiny Pilot practical example of what to do with This is done to avoid problems with program. More than one person has got­ Pilot. Second, as a demonstration of spelling. If you wanted to get really ten a little confused about this. The most of the features of Tiny Pilot. Since fancy, you could put M:QU,I QU. This 16-bit checksum for the program is it uses most of the statement types and would match on either ''QUIT'' or "I $6278. This was found by keying in the features, it is also a good test program. QUIT." If the match statement is true, published code, and it agrees with my the program jumps to label D (for done), and wraps up. If this isn't the case, the TP program computes the cor­ The purpose of the demo program is rect answer and puts it into variable D. * "Tiny Pilot: An Educational a simple math drill. It asks the user for The following Match statement com­ Language for the 6502" by Nick Vrtis his name and then proceeds to ask addi­ pares the value in variable D with the (16:41). tion problems until he types in QUIT. string just entered. Note that leading "Tiny Pilot for KIM” by Bob Applegate At that point, it tells him how many zeros are ignored from D, but not from (21:41). answers he got right, and how many the input string. Thus, the answer 02 were incorrect. Sounds simple enough, would not match with the value 2. This "Tiny Pilot for the AIM" by Larry doesn't it? It really is! I added some is not much of a problem, since very Kollar and Carl Gutekunst (28:59). things mainly to demonstrate some few people put leading zeros in their "Tiny Pilot Complemental (Co-Pilot)" statement types. Variables used are: answers. by Robert Schultz (29:32).

No. 3 6 -M a y 1981 MICRO - The 6502 Journal 71 version. I know of one bug in the ver­ T:HOW MUCH IS $A + $B Microbes sion published; it has to. do with enter­ A: ing a line longer than 126 characters. The comments say you can go up to M:QU Mike Rowe 127, but don't believe everything you YJ:D Microbes read. The problem is that the end-of- P.O. Box 6502 line character never gets put into the C:D = A + B Chelmsford, MA 01824 Tiny Pilot program. This, in turn, M:$D Len Green of Haifa, Israel informed eventually causes the subroutine YJ:0 FWD1 to branch to SETBGN, which, in us of some one-byte errors. turn, resets CURAD back to the begin­ R:HERE THE ANSWER IS ning of the Tiny Pilot address space. WRONG In SYM Bridge Trainer (32:44) loca­ The easiest solution is to limit your tion 02FB must be changed to C9ED lines to less than 126 characters. If you CMP#$ED or the program will halt T:l AM SORRY, THE ANSWER after every North bid, including want to patch and/or re-assemble, the IS $D solution is to add a BNE $243 at loca­ ‘‘Pass.” tion $24D. This will force an end-of- C:W = W +1 line to be inserted into location 127 and U:N In SYM-ple Sym-on (34:18) location should keep everybody happy. Note 02AF should be A200 PLAYON that I have not bothered to try this. My J:Q LDX#$00, otherwise the program goes CRT is only 80 characters wide, so I R:HERE, THE ANWER IS bananas every time you run it. never run into the problem. [The only CORRECT David Lubar, of Edison, New Jersey, other problem I have heard about is *OT:THAT IS CORRECT $? that people with older KIMs don't have spotted this microbe in his article the rotate instructions.) C:$ = X “UnwrApple” (34:11): M:1 At the end of the listing, in the sec­ YT:VERY GOOD ! tion following the comment ;CALL Remember that after the S: state­ C:R = R + 1 FROM BASIC GOES HERE, only half ment is entered, you end up back in the the output hook is established. The editor, with the current address point­ U:N lines LDA #START, STA CSWL, ing to the beginning of the Tiny Pilot J:Q should be followed by LDA /START, program, so anything you type in will STA CSWH. overlay the program. There is no easy *DR:HE ASKED TO QUIT, TELL THE SCORE way to find the end of your program in order to save it on tape. You must T: MUSICAL COMPUTER I AND II display the whole program, stop the C:D = R + W program and look at CURAD. Learn How to Read Music! T:l ASKED YOU A TOTAL OF Written by an M.A. educator with over $D QUESTIONS 20 years of music experience. This two-program cassette provides an T.YOU ANSWERED $R alternative to music education. CORRECTLY, AND $W R:TINY PILOT MATH DRILL INCORRECTLY. • Treble & Bass Note Reading PROGRAM T:l HOPE YOU ENJOYED • Telling Time R:CHANGE THE FOLLOWING YOURSELF $?, I SURE DID. • Notes and Rests • Sharps and Flats TO CHANGE THE SERIES THANK YOU. • Signs and Symbols C:A=5 S: • Tempo Definitions • CHALLENGING Practice Testing C:B = A + 3 R:SUBROUTINE TO GET THE Opportunities NEXT SET OF NUMBERS T:HI THERE, PLEASE ENTER YOUR NAME *NC:$ = X $34.95 + $1 for postage and handling Check or Money Order Please ?: M:1 (Ml residents add 4 % sales tax) T:WELCOME TO THE MATH R:X GIVES VARIETY BY SPECIAL one-time introductory sample DRILL $?, I HOPE YOU DO ALTERNATING WHICH GETS price available to dealers only. Please WELL ADDED TO request on your dealer letterhead. T:WHEN YOU HAVE HAD YJ:B ENOUGH, ENTER QUIT Check: □ Apple II 32K C:A = A + 2 □ TRS-80 Level II 16K INSTEAD OF THE C:X= 1 □ ATARI 800 32K T:ANSWER, AND I WILL TELL N a m e : ...... YOU YOUR SCORE. E: A ddress:...... R:HERE IS THE START OF *BC:B = B + 1 EACH QUESTION C:X = 0 *QT: E: COMPUTER JUCftO APPLICATIONS TOMORROW M l480t2

72 MICRO - The 6502 Journal No. 3 6 -M a y 1981 Serendipity M a th Tools ,for your Powerful & Efficient Apple n Apple Software SDS Guarantees It.

INTER-STAT™ offers you a full range of interactive statistical analysis techniques, from averages and medians to binomial You depend on good software to save you time and to have your com­ and poisson distributions, correlation coefficients and one- and puter help you do a job more efficiently. Our software is designed to do two-way analysis of variance, $169. just that. We are one of the oldest companies supplying software tor the Apple ir, and one of the very few that offers an unconditional guarantee of satisfaction or your money back! Here are a few that you'll want to add to ADVANCED MATH ROUTINES is the mathematical tool kit your library: for common, yet complex numerical problems. Routines include: Super Terminal Software linear regression, matrix operations, numerical calculus, ASCII EXPRESS II. by Bill Blue: The most complete communications package differential equations and data set recall for iterative calculations. available for the Apple II. Designed for the most efficient transfer of data to or from practically any online computer. Fully supports upper/lower case. $169. Including characters normally unavailable: underscore, rubout. break, and most others. Keyboard macro* allow you to define dual keystrokes as Thoroughly tested, well documented and easy to master, each entire strings for fast sign-ons. sign-offs, and system commands. A 20K data buffer allows for large files, and a convenient line editor means easy package includes a 30+ page self-teaching manual. editing before and after transfer. Buffer can be output to printer, disk, or Serendipity’s complete line of software solutions for business, viewed at anytime. Supports Micromodem II* and most other communica­ education and professional applications are available at your tion devices. local Computerland or Apple dealer. Price: $64.95 on Disk. For a free brochure, or to order direct contact Serendipity And for the Z80 Apple... Systems, 225 Elmira Road, Ithaca, NY 14850. Z-TERM. by Bill Blue: A flexible communications package for the Apple II Phone 607-277-4889. Visa and MC accepted. equipped with Z80 Softcard* and the CP/M* environment. Allows file transfers to or from all types of dlal-in systems. Fully supports Micromodem ’"Apple Computer H and most other communication devices, as well as 80 column display boards and external terminals! Utilizes standard CP/M sequential text files, with up to a 40K internal buffer (using additional RAM or Language Card.) Supports multiple modes of data transfer and Includes keyboard SERENDIPITY SYSTEMS macros, autodial (with Micromodem II). and upper/lower case. Price $99.95 on 16 sector diskette. Also available... AFFLE-OOC. by Roger Wagner A set of several utilities to speed up software development and customization. Vardoc makes a list of all the variables In a program and every line on which they occur. Also allows you to create a list af descriptors of what each one does. Llnedoc makes a similar list for each line/subroutine called by a GOTO. GOSUB. etc. Condoc is similar but documents all numeric constants — great for scientific & business usesi Replace Is a powerful replacement editor which makes changing any occurance of a variable or group of statements a breeze! Y o u r C LIi sVi. ...Is fifty Command Price $34.95, Disk. Its oil in. a THE CORRESPONDENT, by Roger Wagner. An extremely versatile program! 24-pia Ponx Designed prlmdrily for writing letters dnd other documents in a very visual at GHS i r way. The Apple screen acts as a "window" onto a 40-80 column page. 4-dlrectional scrolling lets you see any part of the page just as it will be printed. Editor functions include full upper/lower case & control chars., block move/copy, split screen option, even math functions! Additional utilities & uses Include printing form letters, a free-form database, putting bi-directional scrolling In your own programs, single-dlsk copy program, DOS remove for greater storage on diskettes, and more! Price: $44.95 on Disk.

'Apple n b a registered trademart or Apple Computer Co. "PeV Otuners •Mtefomodem II Is a registered trademark o< Havei Microcomputer Products. me. *Z80 Softcard is a registered trademark of Mtawott Coosumar Proajcts. Inc Qrawted 3 CUi.i)ics: •CP/M Isa registered trademark of Digital Research, me J. T o iler Cassette Load 2-Actlo-rvvaat On.an1 All programs require 48K and Applesoft In ROM or language card. Specify 3.(T2e*)orij rrest and DOS 3.2 or 3.3. California residents add 6% to all prices. I S O ontfLonSs. See these and other S.D.S. products at your local dealer, or for mote Infor­ mation, write or call:

D 1

ROM and M A N U A L — $49.95 soutnuuesteRn data svstems Specify 3.0 or 4.0 Basic (Works with or without toolkit) PO Box 582-C2 • Santee. CA 92071 . (714) 562-3670

Ea s t e r n H o u s e So f t w a r e (919) 924-2889 3239 Linda Drive (919) 748-8446 Winston-Salem, N . C. 27106

No. 3 6 -M a y 1981 MICRO - The 6502 Journal 73 THE PERFORMANCE SLICE SBCS Singing the file transfer blues? Then... G e t B. I.T .S .!

Use your Micromodem H,1 A I 02Card. or Apple Comm Card3 Co:

Send data files, BASIC programs, even machine code n to most computers over phone lines. Copy anything you see

into a 31 K buffer then save it on disk and/or print it under your complete control.

Many more features! \ss3&sss£~1 V ies ca " 1 sion. « See it at your favorite com puter «— ------L J W n'« ta a in m e e d9d ‘ntorn>*ti0^ store today. ACCOUNTS ------PAYABLE COMING SOON! ★ CompleteComplete your accounting system with the soonsi to be released A/P package, featuring automatic application of credit and debit Trademarks held by: memos, open or closed item listing, full invoice aging, and 1 • Hayes Microcomputtr Products Inc. multiple reports that provide a complete transaction review. 2 - S S M ★ Ytair bookkttping doesn't lu w to l » a bulky, complicated proem . The 3- Apple Com puter Inc. SBCS Accounting System is designed for flexibility and high performance B. I.T.S. is a tradem ark of: with a cast effectlvenm sure to benefit your businessl MlcroBoftware Systems YOU NEED EXPERIENCE WORKING FOR YOU 7927 Jones Branch Dr. Suite 400 * Packagat available at your local Apple dealer. McLean, Virginia 22102 (703) 385-2944 SMALL BUSINESS COMPUTER SYSTEMS 4140GrL*f3niA/ood, Lincoln.I\JE68504(402)467-1878

For your AIM 65 / d i s k i MI-JI User applications connector — Convenient features —

MiC and EAR jacks for cassette recorders

A fantastic new game disk for OSI-C4P's RS232C or 2 0 mAmp serial ports running with DOS 3.2. Most of the 16 I/O lines + 4 control lines— VIA signals games on this disk are single player such as a multiple level Othello game, Solder pads for remote lines Cavern Chase, and more. Other games are designed for single or multiple VICHO INTE»fAC,H.. INC. W. J'■ players such as Tank, and Crystalize. Over seven games and variations in all. (Note that many of these games are in machine code for enhanced play-ability and speed.)

MICRO INTERFACES, Inc. Assembled, tested 2 9 .9 5 To oidei send $26 to: P.O. Box 14520 (90-day warranty) Minneapolis, MN 55414 Bore PC board 13.95 Simulations Rt. 2 Box 98 (612-426-4603) Burton, WA Programming 98013 Ask about our Microcomputer D C Control System (MCS) with ROM-based software for real-time control with BASIC

74 MICRO - The 6502 Journal No. 3 6 -M a y 1981 Cursor Control for the C1P

This V2 K utility provides the C1P SHIFT O Erase last character, move To change the line, simply type with some new abilities such as cursor back one space. over the characters you wish to change, editing, user-selectable 'CTRL E' to the end of the line, and hit windows, one-key screen clear, Other Commands 'RETURN'. To delete characters, move and a cassette “view” mode. the cursor over them with the RUBOUT Clear window cursor is in. 'CTRL>' instead of 'CTRL E'. To in­ CTRL V Display contents of tape sert, 'CTRL E' to the point where you Kerry V. Lourash want the insertion and use 'CTRL<' to 1220 North Dennis without loading into move backward the number of spaces Decatur, Illinois 62522 memory. your insertion will occupy. Type your insertion and 'CTRL E' to the end of Lack of an editing capability is perhaps the line. (I usually 'CTRLc' a little the most serious shortcoming of the Using the Cursor Control Program further than I think I have to go, type C1P and Superboard. OSI and Micro­ the insertion, and then 'CTRL > ' to the soft have provided a video routine You'll notice two changes to the point where I want to use the 'CTRL E'. ideally suited for a teletype, but lousy OSI format immediately. First, the This saves counting spaces.) Don't for a TV screen. I felt this situation was two-line 'OK' message has been replaced worry about the characters you type unbearable and designed my own ver­ by a one-character white block over when doing an insertion; they’re sion of what a video routine should be. (graphics character 161). At times, this already stored in memory and you're white block will appear at the end of an just changing the video display. If it’s The Cursor Control program error message or other line. If you wish necessary to combine two lines, use replaces OSI's cursor with a dynamic to save screen space, you may start typ­ 'CTRL E' to input part or all of the first super-cursor that can be moved ing without hitting 'RETURN'. The line, then use the cursor movement anywhere on the screen. The view second change is in the cursor. It's now keys to move to the second line. 'CTRL through the TV screen is dramatically a half-tone block (graphics character E’ over what you want in the second improved with the addition of two 187). line. user-selectable windows and a 'view' A word of caution — you can change mode that lets you look at programs on Check the cursor movement com­ tape without loading them into a line number by typing a different mands by pressing the keys for each of number before editing the rest of the memory. If you don't like what you the first four commands. Holding the see, a one-key screen clear whisks it line. The original line will still be in keys down will move the cursor at a memory, however, and must be away. There's even an edit command constant rate. If you should accidental­ for redecorating any line on the screen, deleted. I usually 'CTRL E' over the ly move the cursor past the top or bot­ original line number and hit and the space-gobbling 'OK' is banish­ tom of the screen, simply move the ed forever. 'RETURN'. This deletes the line. Then cursor in the opposite direction until it I go back to the line number, change it, reappears or hit the 'ESC' or and 'CTRL E' over the rest of the line. Cursor Movement Commands 'RUBOUT' key. CTRL < Move cursor back one Notice that when you edit lines and space. hit 'RETURN', the cursor moves to the Now for the edit commands. 'CTRL start of the next line and there is no CTRL > Move cursor forward one E' moves the cursor forward like scroll. To get back 'home1, hit the space. 'CTRL>', but it also enters characters 'ESC' key twice, or the 'RUBOUT' key CTRL U Move cursor up one line. into memory as the cursor passes over once. 'ESC' switches windows and them. It's just as if you had typed the CTRL D Move cursor down one homes the cursor (puts it at the start of character in yourself. To edit a line of line. the bottom line of the window). BASIC, first list the line. Use the cursor 'RUBOUT' clears the current window ESC Move cursor from one movement commands to put the cursor and homes the cursor. window to the other. at the start of the line number. Run the cursor over the line with 'CTRL E' un­ The 'SHIFT O' command erases the Edit Commands til you reach the part you want to letter to the left of the cursor from the change. You now have four options: to screen and from memory, and moves CTRL E Edit. Store character in change, delete, or insert characters, or the cursor back one space. Another cau­ memory. to combine two lines. tion here — if you haven't entered the

No. 36 - May 1981 MICRO - The 6502 Journal 75 character from the keyboard or 'CTRL E', don't try to erase it with 'SHIFT O'.

Finally, there is the 'CTRL V' com­ mand. 'CTRL V' lets you see what is on FIGURE 1 - ZERO PAGE USE a tape without actually loading it into memory. A tank character (255) is LOCATION DESCRIPTION CONTENTS printed to the left of each line to in­ (DECIMAL) (DEC) (HEX) dicate the view mode. You may want to 224 CURSOR POSITION 133 $85 change an address in the view routine 225 211 $D3 |$D384 in line 89] if the character isn't 226 START, TOP WINDOW visible. 128 $80 227 208 $D0 Ed. Note: to move the tank one 228 END, TOP WINDOW 128 $80 space to the right, change location 229 211 $D3 $1E9E from 84 to 85 and $1FAE from 230 START, BOT WINDOW 128 $80 1A to 19. Changing $1FAE moves the 231 cursor home column to prevent the 208 $D0 tank from being printed over the input 232 END, BOT WINDOW 128 $89 line. 233 211 $D3

Exit the view mode by typing a space, just as you would when in the LOAD mode. FIGURE 2 - WINDOW SETTINGS Using Windows

Windows are reserved areas of the POKES LINE (HEX) screen that act like separate, self- 0 208 1 $D000 contained displays. The Cursor Con­ 32 208 2 $D020 trol program has two scrolling win­ 64 208 3 $D040 dows, and a third, non-scrolling 96 208 4 $D060 window for graphics can be created by setting the scrolling windows to oc­ 128 208 5 $D080 (TOP LINE) cupy less than the whole screen. The 160 208 6 $D0A0 screen can be divided horizontally in 192 208 7 $D0C0 1-line increments. 224 208 8 $D0E0 You can set the bottom window to 0 209 9 $D100 be 4 lines high and do all your im­ 32 209 10 $D120 mediate mode commands such as 64 209 11 $D140 PEEK, LIST LOAD, or calculations and 96 209 12 $D160 then use the large top window to edit 128 209 13 $D180 BASIC lines. You can have two win­ dows of equal size and run two pro­ 160 209 14 $D1A0 grams alternately. Directions for a pro­ 192 209 15 $D1C0 gram can be displayed in one window 224 209 16 $D1E0 while the program is run in the other, 0 210 17 $D200 or graphics can be done in the non­ 32 $D220 scrolling window, and scores or input 210 18 displayed in the scrolling windows. 64 210 19 $D240 Unfortunately, I wasn't able to come 96 210 20 $D260 up with an easy way to set the win­ 128 210 21 $D280 dows. I was determined to keep the 160 210 22 $D2A0 Cursor Control down to V2 K of memory and it was like trying to close 192 210 23 $D2C0 an overstuffed suitcase — some things 224 210 24 $D2E0 had to be left out. Cl 211 25 $D300 32 211 26 $D320 Selecting Windows 64 211 27 $D340 Ten zero-page locations are used by 96 211 28 $D360 the Cursor Control to store the current 128 211 29 $D380 (BOTTOM) cursor location and the start and end 160 211 30 $D3A0 addresses of two scrolling windows (see 192 211 31 $D3C0 figure 1). To change the size of the win­ 224 211 32 $D3E0 dows, the values stored in these loca­ tions must be changed. Look at figure 2. The video display lines are numbered 1 to 32, with hex addresses

76 MICRO - The 6502 Journal No. 3 6 -M a y 1981 on the right. Not all of the lines are 0 8 0 0 ;CURSOR CONTROL FOR C1P displayed on the screen because the 0 8 0 0 ;BY LOURASH vertical retrace of the TV blanks out 0 8 0 0 ; M I C R O # 3 6 1 E 0 0 ORG $ 1 E 0 0 some lines. In the Cursor Control, both 1 E 0 0 OBJ $ 0 8 0 0 windows are initially set to cover the 1EOO CURSOREPZ $ E 0 screen from line 5 ($D080) to line 29 1 E 0 0 S T A R T E P Z $ E 2 ($D380). 1 E 0 0 ENDEPZ $E 4 1 E 0 0 • 1 E 0 0 2C0302 INPUT BIT $ 2 0 3 ;CHECK LOAD FLAG Let's change the windows so that 1 E 0 3 1 0 0 3 BPL IN the bottom window is 4 lines high and 1 E 0 5 4 C B F F F JMP $ F F B F X E 0 8 8 A INTXA the top window covers the rest of the 1 E 0 9 48 PHA screen. Counting up from the bottom 1 E 0 A 98 TYA line (2,9], we find that the boundary be­ 1 E 0 B 48 PHA tween the windows is between line 25 1 E 0 C 2 0 0 0 F D JSR $FD00 ;GET CHARACTER and 26. We set the end of the top win­ 1 E 0 F 1 E 0 F 4C121E PATCH JMP * + 3 dow (locations 228, 229) at line 25 and 1 E 1 2 t the start of the bottom window (loca­ 1 E 1 2 C 9 E C BACK C M P # $ E C ;C T R L < ? tions 230, 231) at line 26. The two 1 E 1 4 D 0 0 9 BNE UP 1 E 1 6 201F1F JSRPRINT numbers to POKE are listed at the left 1 E 1 9 20B01F JSRREVRSE ;CURSOR - 1 in figure 2. We type: 1 E 1 C 4 C 4 D 1 E JMP F 0 1 E 1 F t POKE 228,C):POKE 229,211: 1 E 1 F C 9 1 5 U P CMP #$15 ?CTRL U ? 1 E 2 1 D010 BNEDOWN POKE 230,32:POKE 231,211 1E23201F1F JSRPRINT 1 E 2 6 A 5 E 0 LDA CURSOR ;CURSOR - 20 1 E 2 8 38 SEC Maybe we would like two lines at 1 E 2 9 E 9 2 0 S B C # $ 2 0 1 E 2 B 8 5 E 0 STACURSOR the bottom of the screen in order to I E 2D B 0 1 E B C S F0 display scores and have the rest of the 1 E 2 F C 6 E 1 DEC CURSOR+1 screen free for graphics. In this case, 1 E 3 1 D 0 1 A BNEFO the start and end of each window would 1 E 3 3 ; 1E33C904 DOWN CMP#$04 ;CTRL D ? be the same. The cursor line should be 1 E 3 5 D 0 0 9 BNEFORWD below the bottom of the screen so that 1 E 3 7 2 0 1 F 1 F JSRPRINT we won't waste a line at the bottom. 1E3A207D1F JSRFEED ;CURSOR + 20 Lines 30-28 for both windows: 1 E 3 D 4 C 4 D 1 E J M P F0 1 E 4 0 / 1 E 4 0 C 9 E E FORWD CMP #$EE ;CTRL > ? POKE 226,96:POKE 227,211: 1 E 4 2 D 0 1 1 BNEEDIT POKE 228,160:POKE 229,211 1E44201F1F JSR PRINT 1 E 4 7 E 6 E 0 INC CURSOR ; CURSOR + 1 POKE 230,96:POKE 231,211: 1 E 4 9 D 0 0 2 B N E F0 POKE 232,160:POKE 233,211 1E4BE6E1 INCCURSOR+I 1 E 4 D 2 0 1 4 1 F F0 JSR PCURSR 1 E 5 0 A 9 0 1 LDA #$01 ;NON-PRINT CHAR To gain extra lines at the bottom (or 1 E 5 2 4 C B 7 F D F I ■ JMP$FDB7 ; EXIT top] of the screen, you can change the 1 E 5 5 • TABLE in the last line of the program. 1E55C905 EDIT CMP#$05 ;CTRL E ? 1 E 5 7 D 0 0 3 BNEESCAPE Also, you can change line length or 1 E 5 9 A D 0 1 0 2 LDA $ 2 0 1 ;CHAR INTO 201 position of lines on the screen to 1 E 5 C • customize the Cursor Control to your 1 E 5 C C91B ESCAPECMP#$1B ; ESC ? particular TV. The SBC #$1A instruc­ 1 E 5 E D 0 2 0 BNE RUBOUT 1 E 6 0 A 2 0 3 LDX #$03 ;SWITCH WINDOW tion in the RETURN subroutine deter­ 1 E 6 2 B 5 E 2 ES LDASTART,X;LOCATIONS mines the starting point of video lines. 1 E 6 4 48 PHA The SBC #2 instruction in the LETTER 1 E 6 5 B 5 E 6 LDA START+4 ,X 1 E 6 7 9 5 E 2 STASTART,X routine controls the end point of the 1 E 6 9 68 PLA lines. If you change the line length 1 E 6 A 9 5 E 6 STA START+4,X you'll also have to change the SBC in­ 1 E 6 C C A D E X struction in the REVRSE subroutine. If 1 E 6 D 1 0 F 3 BPLES 1E6F201F1F JSRPRINT you increase the line length, decrease 1 E 7 2 A 5 E 5 H O M E L D A E N D + 1 ;HOME CURSOR the SBC instruction by the same 1 E 7 4 8 5 E 1 STA CURSOR+1 amount, and vice versa. 1 E 7 6 A 5 E 4 LDA END 1E78 20AA1F JSR RETURN+2 1 E 7 B 8 5 E 0 STA CURSOR People who have video monitors 1 E 7 D 4 C 4 D 1 E JMP F0 without retrace blanking can eliminate 1 E 8 0 ; retrace smear by not setting windows 1 E 8 0 C 9 7 F RUBOUT CMP #$7F ;R U B O U T ? 1 E 8 2 D 0 0 9 BNEVIEW on lines smeared by the retrace. Users 1 E 8 4 2 0 8 9 1 F JSR CLEAR ;CLEAR WINDOW with 600 baud conversions might not 1 E 8 7 2 0 7 3 1 F JSR LINE ;CLEAR HOME LINE have to add NULLs when SAVEing if 1 E 8 A 4 C 7 2 1 E JMPHOME 1 E 8 D ; they use a small window (4 lines?] 1 E 8 D C 9 I 6 VIEW CMP # $ 1 6 ;C T R L V ? when LOADing. (This speeds up the 1 E 8 F D 0 C 1 BNEFI scroll routine.) 1 E 9 1 2 0 8 B F F JSR $FF8B ;TURN ON LOAD

No. 36 - May 1981 MICRO - The 6502 Journal Subroutines 1 E 9 4 2 0 B A F F VIJSR $ F F B A ;INPUT CHAR HOME Changes cursor location to 1 E 9 7 20A51E JSROUTPUT ;PRINT CHAR 1E9AAD0302 LDA $ 2 0 3 ;•LOAD’ FLAG home position and prints 1 E 9 D 8D84D3 STA$D384 ;P R I N T IT cursor. IE AOD0F2 BNEVI ;F L A G O N ? 1 E A 2 4C521E JMPFI ;NO, E X I T . PCURSR Saves character at cursor 1 E A 5 } address in location $201 and 1 E A 5 1 OUTPUT ROUTINE prints cursor 'over' the 1 E A 5 I 1 E A 5 8 D 0 2 0 2 OUTPUT STA $202 ;TEMP SAVE CHAR character. 1 E A 8 48 PHA PRINT Prints contents of $201 1 E A 9 8 A T X A 1 E A A 48 PHA (character 'underneath' the 1 E A B 98 T Y A cursor) at cursor location. 1 E A C 48 PHA 1EADAD0202 LDA$202 ;L O A D C H A R LOAD Initializes RAM locations 1 E B 0 F056 BEQEXIT ;IF NULL, EXIT $207-$20D for use in scroll, 1 E B 2 I clear screen routines. 1EB2 4CB51E PATCH2 JMP * + 3 1 E B 5 I SCROLL Goes through every byte in 1 E B 5 C 9 0 A LF C M P # $ 0 A ;LINE FEED ? window and puts the con­ 1 E B 7 F04F BEQEXIT tents in original location 1 E B 9 t 1 E B 9 C90D CR CMP#$0D (■RETU R N ’ ? + $ 2 0 (one line above). 1 E B B D 0 0 8 B N E ERASE 1 E B D A 9 2 0 LDA # $ 2 0 LINE Clears home line. 1 E B F 2 0 2 2 1 F J S R P R I N T + 3 FEED Moves cursor location down 1 E C 2 4 C E F 1 E JMPLO 1 E C 5 1 one line. 1 E C 5 C 9 5 F ERASECMP l $ 5 F ( S H I F T 0 7 CLEAR Clears window. 1 E C 7 D 0 1 3 BNELETTER 1 E C 9 C 6 0 E D E C $ 0 E (CHARACTER COUNTER RETURN Puts cursor at start of line. 1ECBA920 LDA#$20 (ERASE CHARACTER 1 E C D 8 D 0 1 0 2 S T A $ 2 0 1 (UNDER CURSOR SETUP Sets Cursor Control patches, 1 E D 0 2 0 2 2 1 F JSR P R I N T + 3 (ERASE CURSOR HIMEM, initializes stack. 1 E D 3 2 0 B 0 1 F JSR REVRSE 1 E D 6 2 0 1 B 1 F JSRPI (PRINT CURSOR REVRSE Moves cursor back one space. 1 E D 9 4 C 0 8 1 F JMP EXIT 1 E D C } 1 E D C 8 D 0 1 0 2 LETTERSTA $ 2 0 1 1EDF20221F JSR P R I N T + 3 How Cursor Control Works 1 E E 2 E 6 E 0 INCCURSOR 1E E 4 A5E0 LDACURSOR ( C U R S O R A T 1 E E 6 091F ORA#$1F (END OF LINE? First, the Cursor Control looks at 1 E E 8 38 S E C the LOAD flag and jumps to the LOAD 1 E E 9 E 9 0 2 S B C # $ 0 2 1EEBC5E0 CMPCURSOR routine if the flag is set. Otherwise, it 1 E E D D 0 1 6 B N E LE + 3 :NO, BRANCH checks input from the keyboard for 1 E E F 2 0 A 8 1 F LO JSR RETURN commands. The cursor movement 1EF285E0 STACURSOR commands change the location of the 1 E F 4 C 5 E 4 CMPEND ( I S C U R S O R 1 E F 6 A 5 E 1 LDA CURSOR+1 (ON HOME LINE? cursor (224,225 or hex $E0,E1) and load 1 E F 8 E 5 E 5 S B C E N D + 1 a non-printing character in the A 1 E F A B o o e BCS LE (YES, SCROLL register. This causes BASIC to ignore 1 E F C 207D1F JSRFEED (NO, DOWN ONE LINE 1 E F F 4 C 0 5 1 F J M P L E + 3 the character and loop back to the start 1 F 0 2 2 0 4 4 1 F LE JSR SCROLL of the input routine. 1 F 0 5 2 0 1 4 1 F JSRPCURSR 1 F 0 8 } The 'CTRL E' routine puts the 1F0868 EXIT PLA 1 F 0 9 A 8 TAY character 'underneath' the cursor into 1 F 0 A 68 PLA the A register, so that it's treated as if it 1 F 0 B A A TAX were a character typed from the 1 F 0 C 68 P L A keyboard. 1 F 0 D 4 C 6 C F F JMP $ F F 6 C (TO NORMAL OUTPUT 1 F 1 0 t 1 F 1 0 ; SUBROUTINES The 'ESCAPE' routine switches the 1 F 1 0 } contents of the window registers and 1 F 1 0 A 9 A 1 O K L D A # $ A 1 homes the cursor in the window thus 1 F 1 2 D 0 0 E B N E P R I N T + 3 1 F 1 4 i selected. 1F14AOOO PCURSR L D Y # $ 0 0 1 F 1 6 B1E0 LDA(CURSOR),Y ( S A V E C H A R The 'RUBOUT' routine clears the 1 F 1 8 8 D 0 1 0 2 S T A $ 2 0 1 (AT CURSOR LOC 1 F 1 B A 9 B B PI L D A # $ B B current window and homes the cursor. 1F1DD003 BNEPRINT+3 (PRINT CURSOR By the way, if you put the address of 1 F 1 F ; the CLEAR subroutine in locations 1F1F AD0102 PRINT L D A $ 2 0 1 ( G E T C H A R 11,12 you have a USR|X) screen clear. 1 F 2 2 AOOO L D Y # $ 0 0 1 F 2 4 91E0 STA(CURSOR),Y ( P R I N T IT 1 F 2 6 60 R T S The 'VIEW' routine bypasses the 1 F 2 7 ! routines that store data in memory and 1 F 2 7 A9AD LOAD LDA#$AD (LDA OP CODE prints data from tape on the screen only. 1 F 2 9 8 D 0 7 0 2 S T A $ 2 0 7 1 F 2 C A98D LDA#$8D (STA OP CODE 1 F 2 E 8D0A02 STA$20A

78 MICRO - The 6502 Journal No. 3 6 -M a y 1981 The 'LETTER' routine prints the ;RTS OP CODE character that has been input (from L D A # $ 6 0 1 F 3 1 A 9 6 0 keyboard ot tape] and increments the 1F33 8D0D02 S T A $ 2 0 D 1 F 3 6 A 5 E 3 LDA START+1 cursor location. If the cursor is not at 1F38 8D0902 S T A $ 2 0 9 the end of the line the routine prints 1F3B 8D0CO2 S T A $ 2 0 C the cursor at the new location and 1 F 3 E A 5 E 2 L D A S T A R T 1F40 8D0B02 S T A $ 2 0 B exits If the cursor is at the end of the 1 F 4 3 60 RTS line or 'RETURN' is hit, the cursor is 1 F 4 4 LOAD reset to the start of the line. Then, if 1F 4 4 2 0 2 7 1 F SCROLL JSR 1 F 4 7 18 C L C the cursor is on the home line, a scroll # $ 2 0 ,START + 20 1 F 4 8 6 9 2 0 A D C is done and the cursor is printed at 1 F 4 A 9 0 0 3 B C C 50 home. If the cursor is not on the home I N C $ 2 0 9 1F4C EE0902 line, the cursor is moved down one line 1F4F 8D0802 SO S T A $ 2 0 8 END 1 F 5 2 A 6 E 4 L D X and printed. L D Y E N D + 1 1 F 5 4 A 4 E 5 ;SCROLL ONE BYTE 1F56 200702 SI J S R $ 2 0 7 1F59 EE0802 I N C $ 2 0 8 Loading the Cursor Control 1 F 5 C D 0 0 3 B N E 5 2 1F5E EE0902 I N C $ 2 0 9 All directions are for an 8 K I N C $ 2 0 B 1F61 EE0B02 S 2 memory. First, enter the Cursor Con­ 1 F 6 4 D O 03 B N E 53 I N C $ 2 0 C trol into memory using the monitor (if 1F66 EE0C02 j LOW BYTE DONE? 1F69 EC0B02 S 3 C P X $ 2 0 B you use the OSI Assembler/Editor B N E 51 1 F 6 C D 0 E 8 ;HIGH BYTE DONE? you'll have to assemble the input and 1F6E CC0C02 C P Y $ 2 0 C B N E S I output routines separately from the 1 F 7 1 D 0 E 3 ;ERASE HOME LINE LINE L D Y * $ 2 0 subroutines, unless you have more 1 F 7 3 A 0 2 0 ;BLANK 1 F 7 5 A 9 2 0 L D A ♦ $2 0 than 8 K of memory!. After the program S T A (END),Y 1 F 7 7 9 1 E 4 LI is entered, double check to make sure 1 F 7 9 88 D E Y 1 F 7 A D O F B B N E LI you've done it right. 1 F 7 C 60 RTS 1 F 7 D Now hit 'BREAK C' and set FEED LDA CURSOR CURSOR DOWN 1 F 7 D A 5 E 0 O N E L I N E 1 F 7 F 18 CLC memory size to 7600. This initializes C U R S O R + 2 0 1 F 8 0 6 9 2 0 A D C # $ 2 0 the BASIC and temporarily protects the 1 F 8 2 8 5 E 0 STA CURSOR B C C F E Cursor Control from being written 1 F 8 4 9 0 0 2 over. Complete cold start then hit 1 F 8 6 E 6 E 1 INC CURSOR+1 1 F 8 8 60 FE RTS 'BREAK M'. Change location 1 to $C5 1 F 8 9 ;CLEAR WINDOW and location 2 to $1F. This points 1F89 20271F CLEAR JSR LOAD warm start to the SETUP routine. Hit 1 F 8 C A 4 E 4 L D Y E N D 1 F 8 E A 6 E 5 L D X E N D + 1 ‘BREAK W’. This initializes the Cursor L D A # $ 2 0 ;BLANK Control and a white square — the new 1 F 9 0 A 9 2 0 ;CLEAR ONE BYTE 1F92 200A02 CL JSR $20A 'OK' symbol — should appear in the 1F95 EE0B02 I N C $ 2 0 B 1 F 9 8 D 0 0 3 B N E Cl bottom left comer of the screen. Check 1F9A EEOC02 I N C $ 2 0 C all commands to make certain every­ ;LOW BYTE DONE? 1F9D CC0B02 Cl CPY $20B thing works. The 'ESC' key will not ap­ 1 F A 0 D O F O B N E C L ;HIGH BYTE DONE? 1FA2 EC0C02 C P X $ 2 0 C pear to do anything at this time because 1 F A 5 D O E B B N E C L the windows are both set to cover the 1 F A 7 60 RTS same area. 1 F A 8 1 F A 8 A 5 E 0 RETURN LDA CURSOR 1 F A A 0 9 1 F O R A # $ 1 F .-CURSOR TO START OF LINE Assuming all commands work, you 1 F A C 38 SEC are now faced with the problem of tap­ IFAD E91A ' S B C # $ 1 A ing the program. Die-hard BASIC 1 F A F 60 RTS 1 F B 0 hackers will want to convert the Cur­ 1FB0 20A81F REVRSE JSR RETURN ;MOVE BACK sor Control to DATA statements. This 1 F B 3 C 5 E 0 CMP CURSOR ; O N E S P A C E can be done with one of the programs 1 F B 5 D O O B B N E R E 1 F B 7 A 5 E 0 LDA CURSOR designed for that purpose. After your 1 F B 9 38 SEC BASIC program has POKEd the Cursor 1 F B A E 9 0 8 S B C # $ 0 8 Control into memory, have it POKE 1 F B C 8 5 E 0 STA CURSOR 1 F B E B 0 0 2 B C S R E l,197:POKE 2,31. A 'BREAK W' will 1 F C 0 C 6 E 1 DEC CURSOR+1 bring the Cursor Control to life. I prefer 1 F C 2 C 6 E 0 RE DEC CURSOR the machine language load method 1 F C 4 60 RTS 1 F C 5 because the Cursor Control can be 1 F C 5 A 2 0 9 SETUP L D X # $ 0 9 .•INITIALIZE loaded even if a BASIC program is -1FC7 BDF51F LDA TABLE,X already in memory. Use a routine such 1 F C A 9 S E 0 STA CURSOR,X as Hoyt's hex dump (Best of MICRO, 1 F C C C A DEX 1 F C D 1 0 F 8 BPL SETUP+2 vol. 2, p. 184) to save the Cursor Con­ 1 F C F A 9 0 0 LDA #INPUT trol in OSI format. After loading the 1FD1 8D1802 S T A $ 2 1 8 ;INPUT VECTOR Cursor Control (if you’ve used Hoyt's 1FD.4 8585 S T A $ 8 5 ; H I M E M S E T 1 F D 6 A 9 1 E LDA /INPUT program) change lcoation 0 to $4C, 1FD8 8D1902 S T A $219 location 1 to $C5, location 2 to $1F. 1 F D B 8 5 8 6 S T A $ 8 6 Now hit 'BREAK W' to initialize, and you're in business.

No. 36 - May 1981 MICRO - The 6502 Journal 79 The Cursor Control could be put in 1 F D D A 9 A 5 LDA I 0 U T P U T an EPROM. OSI's 2K monitor ROM 1 F D F 8 D 1 A 0 2 STA $ 2 1 A uses only three pages, $FD00-FFFF, 1 F E 2 A 9 1 E LDA /OUTPUT ;OUTPUT VECTOR plus a short routine at $FCB1 to sup­ 1 F E 4 8 D 1 B 0 2 S T A $ 2 1 B port the C1P. The remainder contains a 1 F E 7 A 9 1 0 LDA#OK ;1 OK ' MESSAGE 1 F E 9 8 5 0 4 S T A $0 4 ;VECTOR floppy bootstrap and routines for other 1 F E B A 9 1 F LDA /OK models of computers. With a 2716 1 F E D 8 5 0 5 STA $ 0 5 EPROM, you would have over IK for 1 F E F A 2 F E L D X # $ F E ;SET STACK POINTER your own routines. 1 F F 1 9A TXS 1 F F 2 4 C 7 4 A 2 J M P $ A 2 7 4 ;WARM START 1 F F 5 8 5 D 3 T A B L E A D R $ D 3 8 5 There is provision in both input and 1 F F 7 8 ODO A D R S D 0 8 0 output routines (PATCH , PATCH 2) 1 F F 9 8 0 D 3 ADR $ D 3 8 0 for JMP XXXX instructions. You can 1 F F B 8 0 D 0 ADR $ D 0 8 0 add extra features to the Cursor Con­ 1 F F D 8 0 D 3 ADR $ D 3 8 0 trol by JMPing to your code, executing it, and then JMPing back into the Cur­ sor Control. Stack initialization in the I don't have access to a C2P, so I criticism or improvements. Please send SETUP routine solves a small but an­ can't be specific, but with a few to me at the address given at the begin­ noying problem of warm start. Now changes the Cursor Control could run ning this article. you can do a PEEK or POKE without on a C2P. A disk system could use the getting an error message the first time. Cursor Control if zero page location The time delay for the video routine $E0-E9 were changed to addresses not Kerry Lourash has owned a Superboard n controlled by location $206 is not in­ used by disk BASIC. Also, location $0E for a year. He is interested in both hardware and software. Deciphering cluded in the Cursor Control. If you in the ERASE routine may be used dif­ BASIC-in-ROM and designing utilities are have room in RAM, a short BASIC pro­ ferently in disk BASIC. Finally, the his current obsessions. He is a board gram could be written to allow easier Cursor Control is by no means com­ member of the Macon County Computer manipulation of the windows. pleted. I welcome constructive Club. JMCftO

(Classified — continued from page 54)

TURNKEY MEDICAL BILLING SYSTEM STORMGATE: C1P Adventure Series in 8K OHIO SCIENTIFIC ’ Interactive data entry. Automated file S-FORTH — a full implemen­ management. Outputs: Patient state­ THAX—Wield mans' science, weapons tation of Fig-FORTH including ments, Universal Claim Forms, financial and mental forces in an ongoing space reports. Customized by user-developed editor, virtual disk sub-sys­ quest through a million locations of text files. Requires Apple, Applesoft, THAX. MINERVA - Your spacecraft is tem, and compatibility with printer. One disk drive manages 150 disabled on a barren world. Use your wits OS65D-3 on 5’/«" or 8" disk. accounts; 2 drives — 400 accounts. $350 and a robot to survive. Cassette, $6.50 $34.95. for programs and 25 pp documentation. each. Source listing $24.95. Jerome B. Blumenthal, M.D. STORMGATE SOFTWARE Both for $49.95. 7500 E. Heilman SYSTEMS TOUCH TYPING MADE EASY Rosemead, CA 91770 P.O. Box 801 — 15 lesson set teaches you Kirksville, Missouri 63501 to “touch type”. Now also OSI Accounting System available for the C1P. 8K. Small business double entry accounting $19.95. system based on MDMS structure prints TITANIC QUEST — a real time Income Statement, Trial Balance, Charts These low cost ads axe actually sub­ search where you risk your re­ of Accounts, and others. System is con­ sidized in part by MICRO allowing you maining supplies to find the figurable by user and requires only 65D the perfect place to announce special and MDMS capability plus minimum of Titanic. 8K. $6.95. club events, unusual promotions, or 8 K workspace. Program and data disks even want-ads. TEXT EDITOR - the best plus user guide $100.00. Listings sold separately for $20.00 each module. screen text editor available for Each classified ad costs only $10.00 OSI C4P, C8P disk systems. VIDEO VENTURES SOFTWARE per insertion, pre-paid with type­ $19.95. 1708 Beechwood Fullerton, CA 92635 written copy. Please lim it these entries Send for our FREE 14 page to less than 40 words. (Title line, name software and hardware cata­ and address not considered in count.) log. Includes photos and com­ Hockey for the Apple II Ads should be received before the 20th plete descriptions of all game, A two-player game using Integer BASIC of the month preceding the month of utility, and business software. and two machine language routines for publication, i.e. May 20th for the July issue. Aurora Software Associates smooth graphics. On cassette, $9.99. Arlan Henderson Rt. 2, Box 46 If you have any further questions, Saltville, Virginia 24370 please call (617)256-5512.

80 MICRO-The 6502 Journal No. 3 6 -M a y 1981 Protecting Memory from DOS

A technique is described to HIMEM and LOMEM, but that can be large portions of lower memory. This create a “Funny DOS” which inconvenient and easy to forget. It presents no problem. With your ‘funny automatically protects an area would be much nicer if DOS could do it DOS' running, just initialize a new of RAM above DOS. Examples for us automatically. Well, there is a disk. Now you have a 'funny DOS' that are given of the many uses for way to do it quite simply. boots right into the memory range you this protected RAM. picked for it, and only crashes pages $3,$8 , and $9 (the boot code and 'nib­ ble buffers'). Anything above the DOS If you take a look at the relocation location is still there. code that a master disk loads in at Glenn R. Sogge $1B00, you will see that the routine Fantasy Research & Development starting at $1B03 is a memory sizer. It You may have a problem if some of P.O. Box 203 starts in the highest possible page of your code depends upon DOS being at Evanston, IL 60204 RAM ($BF) and works its way down particular locations rather than utiliz­ until RAM is found. This page is the ing the jump vectors in page 3 or the highest page that the DOS can then HI- and LOMEM pointers in page 0. occupy. After finding this high page of Also, it would probably be a good idea As most users of the Apple DOS are RAM, the code relocates the DOS to sit to have your HELLO program print out probably aware, versions 3.2 and 3.2.1 from there down. As far as DOS is something like "40K DOS MASTER” come in two different flavors— concerned, then, there is no usable or "44K DOS SLAVE” to remind memory-size independent (a "master") RAM memory above itself. yourself of what is happening. and memory-size dependent (a “slave”). A slave disk is created with the ''INIT'' If we trick the relocater into starting command and produces a disk that will its search for room somewhere else, we always load the DOS into a specific can have some free memory that we Why Would You Want to Do This? region of memory. This region is defin­ (and our programs) know about but ed by where DOS is sitting when the DOS doesn’t. We will have essentially "INIT" command is given. Generally, protected some memory from en­ This section of 'protected memory' this region is at the top of available croachment. Fortunately, it only re­ is an ideal place to put printer and RAM in the machine. quires changing one byte to accomplish peripheral drivers, machine language our task. (Thank heavens for simply sorting routines, utility programs, structured code.) The byte to change is debug packages and the like. It can also When a master disk is booted on the the "$BF" at $1B04. If we change it to be used as a scratchpad memory area machine, the DOS gets loaded "$BE", we'll protect one page of RAM. that won't get in the way of other con­ underneath address $4000 (16K) and If we change it to “$9F", we'll have flicting uses. While running in BASIC, some relocation code gets loaded under free use of the RAM from $A000 to for example, it's not always very easy the DOS. This relocation routine finds $BFFF—8K of space. (All the examples to determine where the program and the top of RAM and moves the DOS to assume that you have a 48K machine,- variable spaces are, but with a section sit right underneath it. On a 16K the principles are the same for any of memory that BASIC doesn't know machine DOS stays where it is, on a memory size.) about, you can be sure that your data 32K machine it moves to under $8000, won't get clobbered. and on a 48K machine it moves to The way to accomplish this is to under $C000. The DOS then loads and change the byte on the master disk. The memory area becomes a runs the HELLO program. The byte is at track 0, sector A, byte 'systems memory area' with you, the $04. With the disk modified, whenever programmer, as the systems manager As you can see, a master disk clob­ it boots it will start its search for RAM —not DOS, not BASIC. Your HELLO bers a lot of memory, and once it is with whatever page number you have program could load a batch of utilities booted, all memory below the DOS is given it. You now have a relocating so they would always be there and available for use. The user can protect DOS that you have some control over. always be in the same place for use by memory from BASIC by setting But since it is a master, it still crashes many different programs—kind of a

No. 3 6 -M a y 1981 MICRO - The 6502 Journal 81 'writeable ROM’ like the language card If you have.updated a disk to a 'fun­ TAX ; RESTORE THE system, but with only software, not ny DOS' master, it will once again REGISTERS hardware protection. clobber lots of memory when booting, PLA but it will not crash the area above the PLP memory limit you set. RTS What Does DOESN'T KNOW ABOUT’ Mean? An Application Suggestion Although this type of routine is not BASIC and DOS don't know about Both BASICs, and usually any large the most efficient (all of page zero your hidden memory because it is out­ assembly language program, eat up a might not need to be saved), it does side of their HI- and LOMEM limits. huge portion of page zero memory. Par­ have the programming advaintage of Therefore, any functions which use ticularly with Applesoft, you might simplicity. If you don't have to those limits, like loading programs, want to use a good portion of that same remember which locations to be careful allocating buffers, creating variables in area for some machine language with, you can get on with the process of a program, etc., will not even look to utilities to sort strings or to utilize the writing the code to get the job done. As your locations. You can, of course, tell Sweet-16 interpreter. (Relocating the length and complexity of your them to if you like. Commands like Sweet-16 to run from RAM in your pro­ processing routine grows, so, probably, "BLOAD DEBUG,A$BF00" will still tected memory area would make it will your need for page zero locations. work like they always have because easily usable from both BASICs or The above routines solve the problem you are supplying DOS with the assembly language.) Rather than try to in one fell swoop. In addition, the time parameters. figure out which locations have to be spent in the transfer loops as a percent­ saved and which can. be used freely, age of the processing time will decrease Data and programs can be loaded why not use a brute force approach? as the routine grows in complexity. into, and saved from your protected The programming ease will greatly area without any problem. When you outweigh the almost negligible time Upon entering your utility, the first spent saving and restoring the page. give a DOS command with an address, thing that is done is to save all of page it blindly does what you tell it to, since This is particularly true if the routine is zero in some nice, safe place—like related to operator I/O. it assumes that you know best. Thus, above DOS in a hidden memory area. you can BLOAD a program to ROM if Now your routine can use any or all of By saving the registers, in addition you want. This kind of relinquishment page zero as it likes. When the routine of parameter checking is what allows to the page zero locations, the proces­ is done, it restores the old page zero and sing routine becomes completely us to create and use the hidden returns to the calling routine. memory. Since the BSAVE, BLOAD, transparent to the calling routine. and BRUN routines all use the address BASIC (or a machine language main­ information stored when the file is sav­ line) can call an extremely complex and ed, DOS just assumes that it is right powerful routine and not have to know and goes ahead with the command, ZTOBF PHP a thing about what it does or how it without checking it against what it (in­ PHA does it. All the ‘variables' (locations) correctly) knows about the machine’s TXA your routine uses are completely local memory. In short, just use the memory PHA ; SAVE THE REGISTERS to your routine with no global side area like you would any other area, TYA effects. (Your routine could alter loca­ DOS doesn’t care. PHA tions in the saved page to pass back LDX #$00 values, though.) ZTB2 LDA $00,X STA $BFOO,X; SAVE PAGE ZERO An extension of the procedure Updating 'Funny DOS' Disks INX ; AT $BF00-BFFF would be to swap copies of page zero BNE ZTB2 rather than just saving the 'main' copy. Your modified DOS disks will work This allows your routines to have their just fine with the Update 3.2 and 3.2.1 own page zero that is not altered by the programs. The Update program has to calling program. Passing values back be run with a master disk in the drive (YOUR PROCESSING HAPPENS and forth gets a little bit tricky then; because the first thing it does is load a HERE) you might want to dedicate the upper copy of the DOS image with the reloca­ half of page zero to 'private use' and tion code into memory. If the DOS pass values in the lower locations. image it loads is a normal, 48K (This means only saving or swapping relocating DOS, the disk will be up­ BFTOZ LDX #$00 half of the page which will also speed dated to a normal master disk. If, BFZ2 LDA $BFOO,X up the routines.) Another extension, of however, the Update program is loaded STA $00,X ; RESTORE PAGE course, of this concept is to save the and you then insert a ‘funny DOS' ZERO stack page, too. With an interrupt- master and then run the Update pro­ INX driven scheduler and multiple-save gram, it will create a 'funny DOS' BNE BFZ2 areas, time sharing and multi-tasking master. Only the DOS image on the PLA are just around the proverbial comer. disk is modified, so all your files will TAY still be the same. PLA JMCftO

82 MICRO - The 6502 Journal No. 3 6 -M a y 1981 DOUBLE DOS Pins #** $39 FOR APPLE COMPUTERS MICRO-WAREDISTRIBUTING lit

201-839-3478 WHY IS DOUBLE DOS PLUS BETTER D6M£R INQUIRES INVITEE 11 ■HE: tfHE it a rtfiit** trtfMa-t t< *Ftf OnTEt IK., WOTM, Cilitvtn •DOUBLE DOS PLUS REQUIRES APPLE DOS POMS

1) Nothing needs to be soldered, just plug and go.

2) Since all four ROMS are used, all software will work even early 3.1 DOS.

3) Because the ROMS fit on the tack of the board, it has the thinnest configuration allowing full use of slot #7.

4) One set of ROMS is powered up at time thereby saving power. 5) Full 90 day warranty FMH DOUBLE DOS PLUS - A piggyback board that plugs into the disk controller card so that you can switch select between DOS 3-2 and DOS 3*3- Works with the language system eliminating the need in many cases to boot the Basics disk. Mso iTVMflCl eliminates the chore of converting all of your 3-2 disks to 3*3-

Fast, inherently structured, programming system ready fa FROM Brtfderbund Software your APPLE II or II + (24K). STRATEGY FAST ACTION Extensive, professional, 100 page GAmES! GAfTlES! bound documentation. Cleanly interfaced to DOS 3.2 or 3.3. Files are completely compatible with DOS or BASIC. • Control C break and continue for reasonable debugging. • Built-in, convenient editor. • FORTH structured assembler. • The best blend of FORTH and the APPLE’S capabilities. THE SAGA CONTINUES • Supports games, music, I/O, IV TFIWfllfl'S LAST R6DOUBT graphics, disk, tape. The cruel Emperor Tawala has been forced from • Supplied on APPLE diskette. his throne on the world of Galactica and has fled Apple Galaxian — In brilliantly colored array, the • Excellent for applications or for his life to the planet of Farside, where he and Galaxians swoop down from all sides in a small bank of adherents prepare to make their dazzlingly swift attacks to do battle upon the systems programming. last stand. Extreme solar conditions have lone defender. This faithful rendition of that most • After two years, still $49.95 isolated Farside from the rest of the galaxy, and popular of all bar games may drive you around so it remains to Benthi, leader of the local insur­ the bend, but think of all the quarters you’ll be Calif, residents add $3.00 rectionists, to press the final assault on Tawala saving! Apple II Integer or Plus, 48K disk, $24.95. sales tax and his minions. From your dealer a direct from: TAWALA’S LAST REDOUBT puts you in the How to order: Ask your dealer or send check or position of rebel leader. You must intercept and money order for the exact retail price to: SOFTAPE, Dept. f. decipher Tawala’s secret messages to his sup­ 10432 Burbank Blvd. porters, form alliances with local chiefs, detect Tawala’s spies in your midst, separate hard intel­ W North Hollywood, CA 91601 ligence from enemy disinformation, avoid Ta- or Call: 1-213-985-5763 wala's military forays against you and, finally, Br0derbund Software lead the assault against the Prince's stronghold. Box 3266, €ugene, Oregon 97403 FOG-279 $49.95 Call (503) 343-9024 to order. NO CHARGE Minimum Configuration: FOR SHIPPING AND HANDLING! Master Charge/Visa Accepted. TRS-80 Cassette, 16K, Level II, $19.95 Visa and Mastercard accepted. TRS-80 Disk, 32K, $24.95 Apple is a registered trademark APPLE Disk, 48K with APPLESOFT, $29.95 Wa vs got moral Sand for our fraa catalog! of APPLE COMPUTER, INC. Apple, Apple II Plus and Applesoft are trademarks of Apple Computer Co. TRS-80 is a trademark of Radio Shack.'

83 No. 3 6 -M a y 1981 MICRO - The 6502 Journal Advertisement ©KID© ©©DiNTM©'

User Defined Routines Since the DRAWCHAR routine is reasonably in UCSD Pascal short, it would be relatively easy to type the above declaration in as part of any host program in The UCSD Pascal system has several features which it is needed. The purpose of this note is to which allow a user to create a collection of pro­ present several more sophisticated ways provided cedures and functions to be used as subroutines by the UCSD Pascal system of accomplishing the by other host Pascal programs. Such routines can same thing. be written using Pascal itself or using the 6502 assembler provided with the UCSD system. These Before proceeding, use the Editor to enter the capabilities will be illustrated in two parts. Pascal above procedure as a new workfile and write it subroutines are discussed in part one, which con­ out Into a disk file named DRAWCHAR.TEXT. stitutes the remainder of this note. Assembler Although it is not necessary to store the pro­ routines are discussed in part two, which will cedure in a file of the same name, doing so appear next month. It is assumed that the reader makes it easy to remember where it is stored. In is familiar with the UCSD Pascal system, especially the following section, two methods of including the use of the Editor, to create and store program this procedure as part of a host program are files. illustrated. Part One — Pascal Subroutines B. Including DRAWCHAR in a Host Pascal A. DRAWCHAR — A Simple Example of a Pascal Program Routine The following Pascal program displays a The C4P and C8P series of Ohio Scientific subset of the 256 graphics character set on the computers use a memory mapped video system screen, using the procedure DRAWCHAR. Use the which supports a character set of 256 graphics Editor to enter this program exactly as it is shown. characters. The C4P and C8P users’ manuals in­ clude tables listing the numeric equivalent for PROGRAM CHARSET; each of the graphics characters. The following VAR XCOOR.YCOOR,CHARNUM: INTEGER; Pascal procedure displays the graphics character BEGIN corresponding to a given CHARNUM at the screen location with coordinates (XCOOR.YCOOR) XCOOR: = 5; YCOOR: = 3; relative to the upper left-hand corner of the screen. CHARNUM: =32; (Note: Although the display screen on these REPEAT systems is nominally 32 rows x 64 columns, the REPEAT Pascal system allows the user to adjust the DRAWCHAR(CHARNUM, XCOOR.YCOOR); borders to accommodate minor variations be­ XCOOR: = XCOOR + 2; tween individual monitors.) CHARNUM: =CHARNUM +1 UNTIL XCOOR = 53; XCOOR: = 5; PROCEDURE DRAWCHAR YCOOR: = YC O O R + 2 (CHARNUM,XCOOR,YCOOR: INTEGER); UNTIL YCOOR = 21 BEGIN END. GOTO XY(XCOOR.YCOOR); WRITE (CHR(CHARNUM)) This program will not compile correctly in its END; current form since there is no declaration for the procedure DRAWCHAR. The following two sub­ This procedure uses the built-in UCSD Pascal sections illustrate two methods of correcting this routine GOTOXY to move the cursor to the desired problem. location and then uses the Pascal WRITE routine to display the desired character on the screen. 1. The C(opy Option of the Editor

The preceding version of the procedure The C(opy option of the Editor can be used DRAWCHAR does not yield the desired results for to physically copy the contents of a file into the CHARNUM values less than 32, since many of the workfile at the current location of the cursor. The corresponding characters are assigned special following series of steps will copy the procedure meanings by the UCSD Pascal input/output DRAWCHAR into the above program. system. Part two will include an alternate version of DRAWCHAR, which uses a POKE procedure a) Move the cursor to the beginning of the written in assembler to store the value CHARNUM row immediately above the BEGIN state­ in the memory location corresponding to the ment in the preceding program. screen position (XCOOR,YCOOR). This alternate version of DRAWCHAR works for all values of b) Depress “ C” to select the C(opy option CHARNUM and is considerably faster. of the Editor.

CALL 1-800-321-6850 TOLL FREE

84 MICRO - The 6502 Journal No. 36 - May 1981 Advertisement SMALL SYSTEMS JOURNAL

c) Answer the “ Copy: B(uffer F(rom file character stored at any location on the screen. As < esc> ” prompt by depressing “ F”. illustrated by this example there are two sections in a unit. The first is an INTERFACE section d) Answer the “ Copy: From what file which, in this case, declares the two procedures [marker,marker]?” by entering the file defined in this unit by giving their names and name DRAWCHAR.TEXT. describing their parameters. These declarations are automatically provided to any host program These steps physically copy the declaration which uses this unit. This allows the compiler to for the procedure DRAWCHAR into the program perform type checking for each invocation of the CHARSET. With this addition the program routines DRAWCHAR and ERASCHAR by the host CHARSET can be compiled and run. program. The second section is the IMPLEMENTA­ TION section which includes the actual programs 2. The $INCLUDE Compiler Directive defining DRAWCHAR and ERASCHAR.

The compiler directive (*$l DRAWCHAR. UNIT MYPLOT1; TEXT*) can be placed on the line above the BEGIN INTERFACE in the program CHARSET instead of physically PROCEDURE DRAWCHAR(CHARNUM,XCOOR.YCOOR: inserting the text of the procedure DRAWCHAR. INTEGER); This directive instructs the compiler to Include the PROCEDURE ERASCHAR(XCOOR,YCOOR: INTEGER); contents of DRAWCHAR.TEXT when the program IMPLEMENTATION is compiled. PROCEDURE DRAWCHAR; ('PARAMETERS DECLARED ABOVE*) 3. General Comments BEGIN GOTOXY(XCOOR,YCOOR); Regardless of which of the two approaches WRITE(CHR(CHARNUM)) given above is used, the results are essentially the END; same. The contents of the file DRAWCHAR.TEXT PROCEDURE ERASCHAR; (‘ PARAMETERS are compiled as part of the CODE file for the pro­ DECLARED ABOVE*) gram CHARSET. The SINCLUDE compiler directive BEGIN usually requires more memory at compile time DRAWCHAR(32,XCOOR,YCOOR) (* CHR(32) = than if the text is usually copied into the workfile. BLANK*) END; Consequently, on systems with 48K bytes of memory the $INCLUDE directive may not be END. (*END OF UNIT*) appropriate for larger programs. Before proceeding, use the Editor to enter this Each of the above approaches requires unit as a new workfile and write it into a file named DRAWCHAR to be compiled each time it is used. MYPLOT1.TEXT. The next section describes the The following section shows how to place a steps necessary to place this unit in the system compiled version of the routine in the SYSTEM. library. LIBRARY.

2. Adding MYPLOT1 to the SYSTEM.LIBRARY C. Adding DRAWCHAR to the SYSTEM.LIBRARY The MYPLOT1 unit must be compiled before The UCSD Pascal system allows the user to it can be added to the system library. Units are group a collection of related functions and pro­ compiled in the same manner as standard Pascal cedures together as a unit. Units are discussed in programs. Leave the Editor and enter the C(ompile chapter 9 of the Beginner’s Guide to the UCSD command. Answer each of the prompts (“ Compile Pascal System and in section 3.3 of the UCSD what text?” and “ To what codefile?”) by entering Pascal User’s Manual. The major difference be­ the file name MYPLOT1. The compiler will place tween using a unit and using a $INCLUDE com­ the object version of the MYPLOT1 unit in the file piler directive is that a unit can be separately named MYPLOT1.CODE. compiled and placed in the system library. The compiled routines in the unit are then auto­ The LIBRARY.CODE utility program supplied matically linked whenever a host program which with the UCSD Pascal system is used to modify uses them is run. the system library. The use of this utility is described in detail in section 4.1 of (2). The follow­ 1. MYPLOT1 — A UNIT containing two proce­ ing steps create a file named NEW.LIBRARY dures DRAWCHAR and ERASCHAR which includes all of the old SYSTEM.LIBRARY together with the MYPLOT1 unit. Before pro­ The following is a very simple example of a ceeding, use the FILER to verify that both the files unit containing two procedures. The first is the SYSTEM.LIBRARY and MYPLOT1.CODE are procedure DRAWCHAR introduced in section A. present on the disk in disk drive #4 (the top disk The other is a related procedure which erases the drive) and return to the system prompt line.

OHIO SCIENTIFIC 1333 S. Chillicothe Road • Aurora, Ohio 44402 • (216) 831-5600

No. 3 6 -M a y 1981 MICRO - The 6502 Journal Advertisement ©KID© g©DtimFD©s

a) Execute the program LIBRARY.CODE Once MYPLOT1 has been linked into NEW. by depressing “ X” and then typing LIBRARY, the segment map table will appear as “ LIBRARY” or “ #5:LIBRARY” if the file follows: LIBRARY.CODE is located on the disk in disk drive #5 (the lower disk drive) in 0 -TRANSCEN 1154 4 - 0 8 - 0 0 response to the prompt “ Execute what 1 - DECOPS 1750 5 - 0 9 - 0 0 file?” . 2 - PASCALIO 1838 6 - 0 1 0 - 0 0 3 - MYPLOT1 52 7 - 0 11 - 0 0 b) Enter the name NEW.LIBRARY as the name of the output codefile. At this point, enter “Q” to terminate the execu­ tion of the LIBRARY utility. When the “ Notice?” c) When the response “Link Code File prompt is displayed depress RETURN and the file - > ” is displayed, enter SYSTEM. NEW.LIBRARY will automatically be stored on LIBRARY. The following table of all the disk. The next section shows how to use the segments currently in SYSTEM.LIBRARY MYPLOT 1 unit in a Pascal program. will be displayed. 3. Using the MYPLOT1 Unit as a Pascal Program 0 - TRANSCEN 1154 4 - 0 8 - 0 0 1 - DECOPS 1750 5 - 0 9 - 0 0 The following Pascal program is a modifica­ 2 - PASCALIO 1838 6 - 0 1 0 - 0 0 tion of the program CHARSET presented in sec­ 3 - 0 7 - 0 11 - 0 0 tion B. Use the Editor to enter this program and then store it in the system file SYSTEM.WRK.TEXT and the prompt line by selecting the U(pdate option when you leave the Editor. Segment # to link and < SPACE > N(ew file, Q(uit, A(bort will be presented. PROGRAM CHARSET; USES MYPLOT1; VAR XCOOR,YCOOR,CHARNUM: INTEGER; The following sequence of responses links each of the segments currently in the SYSTEM. BEGIN LIBRARY into NEW.LIBRARY. ('DISPLAY CHARACTERS*) XCOOR: = 5; 0 < SPACE > YCOOR: = 3; CHARNUM: = 32; Seg to link into? 0 < SPACE > REPEAT 1 < SPACE > REPEAT Seg to link into? 1 < SPACE > DRAWCHAR(CHARNUM,XCOOR,YCOOR); 2 < SPACE > XCOOR: = XCOOR+ 2; Seg to link into? 2 < SPACE > CHARNUM: = CHARNUM + 1 UNTIL XCOOR = 53; XCOOR: = 5; YCOOR: = YCOOR+ 2 As each segment is linked, its name appears in UNTIL YCOOR = 21; a similar table for NEW.LIBRARY. Once the old SYSTEM.LIBRARY has been copied into the (•ERASE CHARACTERS*) NEW.LIBRARY type “ N” for N(ew file and then XCOOR: = 5; enter the file name MYPLOT1.CODE in response YCOOR: = 3; REPEAT to the prompt “ Link Code File - > ” . The previous REPEAT segment map for SYSTEM.LIBRARY is replaced by ERASCHAR(XCOOR,YCOOR); the following display: YCOOR: = YCOOR+ 2 UNTIL YCOOR = 21; 0 - 0 4 - 0 8 - 0 0 YCOOR: = 3; 1 - 0 5 - 0 9 - 0 0 XCOOR: = XCOOR+ 2 2 - 0 6 - 0 1 0 - 0 0 UNTIL XCOOR = 53 3 - 0 7 - MYPLOT1 52 11 - 0 0 END.

The final step in creating NEW.LIBRARY is to The second line in this program notifies the link the unit MYPLOT1 from segment 7 into seg­ compiler that this program uses the unit ment 3 of NEW.LIBRARY by entering MYPLOT1, which has been placed in the system library. This program uses DRAWCHAR to display 7 < SPACE > several lines of graphics characters and then uses Seg to link into? 3 < SPACE > ERASCHAR to erase them one at a time.

CALL 1-800-321-6850 TOLL FREE

MICRO - The 6502 Journal No. 36 - May 1981 Advertisement SMALL SYSTEMS JOURNAL

Before this program can be compiled and run it CONTROL-D Toggles the output back and forth is necessary to designate the file NEW.LIBRARY between full and half duplex mode. which contains the unit MYPLOT1 as the SYSTEM. (Sometimes echoed as a comma.) LIBRARY. Enter the FILER and use the C(hange CONTROL-B Returns to BASIC if the routine is option to first change the name of SYSTEM. operating on a cassette system, or LIBRARY to OLD.LIBRARY, and then change the runs “ BEXEC*” if it is operating on name of NEW.LIBRARY to SYSTEM.LIBRARY. a disk system, effectively ter­ minating the call.* To run this program depress “ R” . The follow­ ing sequence of events is automatically initiated. Shift-0 is still used to output a delete character code. Since ROM BASIC doesn’t process a a) The contents of SYSTEM.WRK.TEXT are backspace, the previous character will be omitted compiled and placed in SYSTEM.WRK. from the text, but not on the video screen. The CODE. During the compile, the INTER­ delete code will be displayed as a graphic FACE section of MYPLOT1 is accessed backspace, a forward space, and another graphic to verify the references to DRAWCHAR backspace on the ROM BASIC computers. and ERASCHAR. Note: If this program is to run on a disk system, b) The LINKER is invoked and the object create two buffers using the change utility before code of procedures referenced in the entering the program. system library (including DRAWCHAR and ERASCHAR) is linked into SYSTEM. *You must physically hang up the phone to WRK.CODE. complete call termination. c) Once the library routines are linked into the codefile, the file SYSTEM.WRK. CODE is executed.

Subsequent runs of the program simply ex­ 10 REM WODEM PROGRAM ecute the resultant SYSTEM.WRK.CODE file skip­ 20’ F 0 R I"lT 030i PRINT I NEXT t PRINT"MODEM ROUTINE LOADING” 30' Y«PEEK (2> I 2“ PEEK <64774) ping steps a and b. The automatic compile, link 40 IFZ-32TH£NGDSUB3000iSOT060 90 G08UB4000 and execute process can only be used for pro­ 60 FORI*lT032*PRINTiNEXT*PRINT“MODEM READY** 70 X-USR(X) grams stored in the system workfile. If the pro­ 80 RESTORE*G0SUB500iIFY-*THENRUN"BE*ECt" 9 0 END gram CHARSET is stored in a named file (CHAR- 500 PS-1iIFPEEK <9800)-32THENPS-2 510 IFY<>40RZ< >32THENF0RI«lT048iREADPiNEXTiRETURN SET.TEXT) which is not in the system workfile, 320 READP,C <1), C(2 )i1FPTHENP0KEP,C(PS)iG0T0S20 then separate commands must be given for the 5 3 0 RETURN 540 DATA 9730,8,16 compilation, the linking and the execution. 550 DATA 9743,7,15 560 DATA 9723,31,63 570 DATA 9736,31,63 580 DATA 9725,4,10 Bibliography 590 DATA 9738,29,59 610 DATA 9800,32,64 620 DATA 9636,101,75 Beginner’s Guide to the 630 DATA 9766,101,75 1. Bowles, Kenneth L., 640.DATA 9770,101,75 UCSD Pascal System, Peterborough: Byte Books, 650 DATA 9815,101,75 670 DATA 9670,125,123 1980. 680 DATA 9783,125,123 690 DATA 9682,95,164 990 DATA55296,0,1,0,0,0 1500 FORI-O+FTO 2 I 6+ F 1READX 2. UCSD Pascal User’s Manual, San Diego: 15110 IF X — 1 T H E N X -IN T U /2 5 6 ) 1520 POKEI, XiNEXT Softech Microsystems, 1978. 1530 RETURN 2000 DATA 32,13,37,173,0,240,74,144,6,173,1,240,32,67,35 20i:0 DATA 32,93,-1,240,239,201,2,240,22,201,4,240,21,72,32 2020 DATA 67,35,173,0,240,74,74,144,249,104,141,1,240,76,37 2030 DATA -1,76,13,37,173,63,-1,73,12,141,63,-1,208,225,138 2035 DATA 72,152,72 2040 DATA 169,1,32,190,252,32,198,252,208,5,10,208,245,240,83 2050 DATA 74,144,9,42,224,33,208,243,169,27,208,33,32,200,253 2060 DATA 152,141,19,2,10,10,10,56,237,19,2,141,19,2,168,138 2070 DATA 74,240,49,136,200,74,144,252,208,42,234,165,207,253,205 Universal Modem Program 2080 DATA 21,2,208,38,206,20,2,240,43,160,5,162,200,202,208,253 2090 DATA 136,208,248,240,67,201,1,240,53,160,0,201,2,240,54,160 2100 DATA 192,201,3?,240,48,169,0,141,22,2,141,21,2,169,2,141 2110 DATA 20,2,208,36,162,150,205,22,2,208,2,162,14,142,20,2 2120 DATA 141,22,2,169,1,32,190,252,32,207,252,74,144,3,76 Universal Modem Program 2130 DATA 143,253,208,194,160,32,76,167,253,169,0,76,183,253 3000 60SUB500 3005 IFY-4THENP0KE574,34 1P 0K E 575, 661F « 1 6 9 3 0 :GOTO1500 This is a BASIC program which will set up a 3 0 0 8 F“ 5 4 6 1GOSUB1500 3010 PQKE546,44*PQKE592,96 machine code modem routine designed for use 302 0 P0KE5S9,251i P0KE560,2 1P0KE576,251 1P 0K E 577,2 3030 P0KE763,41 1 PQKE764, 127iP0KE765,76*P0KE766,45sP0KE767,191 with a standard modem (with RS-232). The routine 3040 POKEI1 ,34> POKEI2 ,2iRETURN 4Q00 GOSUBSOOO will operate with the modem ports on the Ohio 4010 POKEF+65,141 1POKEF+66,0JPOKEF+67,223 4020 POKEF+68,174iPOKEF+69,Oj POKEF+70,223 Scientific C1P, C4P, and C8P computers. The 630 4030 POKEF*193,1411POKEF•M 9 4 ,O* POKEF♦195,223 4040 POKEF+196,173« POKEF+197,0 1POKEF*198,223 and UTI board modem ports are exceptions to this 4 0 5 0 POKEF + 1 ,6 8 1POKEF*2,38 and are not supported by this routine. 4060 POKEF+47,68iPOKEF+48,38 4 0 7 0 POKEF + 5 ,2 5 2 * POKEF+1 1 ,2 5 2 1POKEF + 3 4 ,2 5 2 5 POKEF+42,2 5 2 4080 IFY»4THENP0KE63235,52tP0KE64512,2 This is basically a dumb terminal routine with 4 0 9 0 RETURN only two local commands:

OHIO SCIENTIFIC 1333 S. Chllllcothe Road • Aurora, Ohio 44402 • (216) 831-5600

No. 36 - May 1981 MICRO - The 6502 Journal Mike Rowe P.O. Box 6502 /A lCftO Chelmsford, MA 01824 Software Catalog: XXXII

Name: AGS-1 Natal Horoscope Name: The Demo Disk Name: The Super Bar and Wine System: Apple II or TRS-80 System: Apple II Guide Memory: 48K RAM Memory: 48K System: Apple n Language: For Apple II, Applesoft in Language: Applesoft, Machine Memory: 48K ROM with DOS 3.2, for Hardware: Apple n, Disk n Language: Applesoft TRS-80, Disk Basic 2.3 Description: Contains a program ex­ Hardware: Disk 3.2, 3.3 Hardware: For Apple n, 1 disk drive emplifying usage of "Superfront'' let­ Description: The new Super Bar and and line printer, for ters and utilities from Super Draw and Wine Guide is an education in the art of TRS-80, 2 disk drives and Write disk. Also includes "Instant selecting and enjoying fine wines. This line printer Graphics (Sound Option)'' from same program places at your fingertips the Description: A very complete calcula­ disk. "Conditioning'' from our Con­ combined knowledge of wine experts, tion program for astrologers. Erects a ditioning Life Dynamics disk, and distributors and months of research, horoscope for any date and time from "Rationality?” from our Aliveness Life the most recent wine prices [1981], as A.D. 1800 to 2000, accurate to one Dynamic disk, are available, as well as well as fifty-four of the most popular minute of arc or better. Printout is in the incomparable "Jungle Safari'' from and well known red, white and special­ spoked wheel form with many extras: our Environment Life Dynamic disk. ty wines. Included are a complete detailed aspectarian, geocentric and You get the best of Avant-Garde Crea­ description of each wine, a Serving Sug­ heliocentric longitude and latitude, tions’ programs at an unbelievable gestions category that offers over two- right ascension and declination, price. hundred combinations of food and retrogrades, 24-hour distance traveled, Copies: Many wine, a Glossary of Terms section of dignities, and more. Each program has Price: $9.95 includes disk, game the most commonly used words, a two zodiacs and seven house systems card/drawing card complete Pronunciation Guide, a sec­ to choose from, and planet and sign Author: Avant-Garde Creations tion called Wine Tips that gives infor­ glyphs are available for some printers. Available: Avant-Garde Creations mation about usage of wine; and the NATAL HOROSCOPE feeds into 16 P.O. Box 30161 MCC newest addition is the Computer Wine other programs for further astrological Eugene, Oregon 97403 Steward, a program within itself! It lets calculations. the computer do the selecting from Copies: Must be special-ordered. over two-hundred 'brand name wines' We tailor to your system. and their most recent prices, from a Price: $125.00 Name: Chaos Version 2.1 Meal Selection menu of your favorite Author: Robert S. Hand System: OSI Superboard II or dishes (25 Dinner Selections). And Available: AGS Software Challenger 1-P finally, a Bartender’s Guide for forty of Box 28 Memory: 4K RAM or more the more popular mixed drinks. Orleans, MA 02653 Language: 6502 Machine Price: $24.95 includes yearly Hardware: Real-time Clock updates $5.00 [optional) Author: Donald E. Martin Description: CHAOS saves and loads Available: CINE-AERO Name: The Arrow BASIC programs up to 2 times faster 1821 N. Frederic St. System: CBM with new ROM's than BASIC, consuming up to 50% less Burbank, California 2.0 or 4.0 tape! Each program may be given a 91505 Memory: 8 - 32K unique file name of any length. The Language: Machine Language program is not listed as it is saved or Hardware: Contained in 2716 loaded. Do you have a real-time clock? EPROM CHAOS will save the date and time Name: Small Business Account Description: Save/Load at 3600 baud along with your program! Now for the ing (SBA) with your C2N cassette deck. BASIC best part: CHAOS does not me any System: OSI C4P MF programs, machine code blocks and BASIC programming memory! Stop Language: BASIC under OS65D data files plus Verify, Append and F. waiting for OSI BASIC — order CHAOS Hardware: Printer, 2 Disks (second Fwd tape positioning supported. Also today (or send an SASE for further optional) full 80 x 50 graphics and hex information). Description: Provides double-entry calculator. 10 new commands. Copies: On demand journal system for cash flow analysis Copies: Just released Price: $12.95 includes CHAOS and reports. Automatic checking of Price: $45 cassette and complete distribution account totals at time of Author: Milton Bathurst operating manual. entry. User-defined fields in data base Available: DataCap Author: Paul Morey files; up to 99 expense and income 73, rue du Village Available: PROCOM Software accounts, 999 vendor/customer B4545 Feueur 8 Hampton South accounts, with names up to 72 Belgium Southampton, MA 01073 characters. Six digit (XXXX.xx)

88 MICRO - The 6502 Journal No. 3 6 -M a y 1981 capability in base module is expand­ family, and Epson MX-70 and MX-80 Name: DOS/65 able. Prints Income Statement, Trial with graphic PROMs. System: All 65xx Balance, Charts of Accounts and Ven­ Price: $24.95 (+$1.65 in Ohio) Memory: minimum of 16K to 24K dor/Customer lists. Summary finan­ includes diskette and Language: machine cial information totalable by month, user's guide (specify DOS Hardware: 8 " single density, soft quarter, and Y'lD. Sorting is available release and printer sect disk on user specified fields. All records are model). Description: DOS/65 is a flexible disk MDMS-compatible and code allows Author: SmartWare operating system for the 6502 which user system configuration. Available: SmartWare allows the user to configure the system Price: $100.00 (3rd class mail 2281 Cobble Stone Court for his environment similar to what free, 1st class add $ 2 .0 0 ). Dayton, Ohio 45431 CP/M allows for the 8080/Z-80. In­ Includes: (1) program disk and (1J cluded are a two pass assembler, an data disk with sample editor, a debugger, a sysgen routine and Name: Journey to Mt. Doom file. User Manual and Ac­ other utilities. Standard system is con­ System: SYM with BAS-1 or KIM counting System Guide figured only for Tarbell controller but and sample source 8K BASIC at 2000 H. Memory: 16K full interface instructions are included. documents provided. Pro­ Copies: New Release Language: BASIC gram listings only are Price: $100-$150 (more for Hardware: Terminal using standard available for $ 20.00 each. custom) serial I/O ports on SYM Author: J.O. Rector Author: Richard A. Leary Available: Video Ventures or KIM Description: An adventure game in Available: Richard A. Leary 1708 Beechwood Avenue 1363 Nathan Hale Drive which you wander through a network Fullerton, California Phoenixville, PA 19460 92635 of caverns in search of the Necromancer's gold ring. Once you Name: Stand-Alone fig-FORTH find the ring you must then discover Name: Poker System: OSI, C l, C2, and C4 the secret way to Mt. Doom where the System: Apple n Plus minifloppy ring is to be destroyed. You'll en­ Memory: 48K w/ROM Applesoft Memory: 24K counter goblins and other creatures Language: Applesoft Hardware: No extra hardware required along the way and also find treasure. Hardware: Disk n Description: Complete FORTH high- You communicate with the computer Description: Tired of playing "Poker'' level language system—no operating with one and two word commands. games that amount to nothing more system needed. Disk files are OS-65D Copies: Just released than Blackjack? This game pits four compatible. Strictly adheres to FIG Price: $10.00 on cassette tape, computer opponents against you and standards. Includes disk, display and ppd. in U.S. only allows for up to three rounds of betting. keyboard drivers for OSI. A structured Author: l i e Chapel You can exchange cards, pass, bluff, 6502 macro-assembler and disk Available: Lee Associates call at anytime, and bet little, big or utilities are also included, plus the FIG 2349 Wiggins Ave. fold—and so can they. A detailed model portable line editor. These can all be in Springfield, IL 62704 of real poker. memory at once with plenty of room Copies: Just Released for applications. Complete technical Name: DISASM (2.0J Price: $15 documentation and a fig-FORTH System: Apple n or Apple n Plus Author: Jeff Brower glossary are included. Language: Machine Available: Galaxy Sales, Inc. Copies: fust released Hardware: Disk 30815 28th Avenue South Price: $49.95 check or money Description: DISASM serves as an in­ Federal Way, WA 98003 order, volume discounts valuable aid for understanding and for dealers. modifying machine language programs. Name: Disk Directory Author: Michael Butts and Forth It is a symbolic disassembler which System: Pet 16K/32K + 3040 Interest Group generates source code, with labels, Disk Drive Available: FORTH Tools directly compatible with DOS Toolkit, Memory: Minimum 16K Box 12054 Lisa and S-C assemblers. Default labels Language: BASIC Seattle, WA 98102 are catagorized as page zero, external or Description: Indexes on master internal. Optional user-defined label diskette (drive 0 ), the directory of name table permits substitution of diskette in drive 1. Enables all direc­ Name: GRAFPAK APPLE more meaningful label assignments. tories of all diskettes to be kept on one System: Apple II Monitor ROM label name table included master diskette. Options available: for­ Memory: 32K minimum with over 100 standard subroutine and mat diskette; update or create index; Language: BASIC or 6502 machine memory address names. Equate defini­ display single directory or all direc­ language tions generated in ascending order. No tories indexed. Search option: finds and Hardware: Disk and graphic printer restriction on disassembled block displays which diskette(s) holds a par­ Description: GRAFPAK is a family of length. Correctly disassembles displaced ticular programme; with auto load programs for reproducing the Hi-Res object code, auto source segmentation facility. Summary of all indexes: disk pages — using grab-the-wire printer for easier reading, and more! ID; name and bytes free; delete entry. graphics, lx and 2x scaling are stan­ Copies: Over 40 Price: $25 dard, and 3x and 5x are available with Price: $30.00 (Program diskette Author: D. Milnes some printers. Normal and inverse ink­ and user documentation) Available: 13, Delmont Close ing is selectable, and variable indent is Author: Bob Kovacs Whitelee Road provided. Features vary with make and Available: RAK-WARE Batley model of printer. Packages available for 41 Ralph Road West Yorkshire WF178AQ. IDS-440, 445 and 460, Anadex DP-9xxx West Orange, NJ 07052 England

No. 3 6 -M a y 1981 MICRO-The 6502 Journal 89 $T he Newest In Apple Fun Solar Energy For The Home------We’ve taken five of our most popular programs and With the price o f fossil fuels rising astronomically, solar space-heating systems are starting to become very combined them into one tremendous package full of attractive. But is solar heat cost-effective for you? This program can answer that question. fun and excitement. This disk-based package now of­ Just input this data for your home: location, size, interior details and amount o f window space, it will then fers you these great games: calculate your current heat loss and the amount of gain from any south facing windows. Then, enter the data Mimic—How good is your memory? Here’s a chance for the contemplated solar heating installation. The program will compute the NET heating gain, the cost of to find out! Your Apple will display a sequence of conventional fuels vs. solar heat, and the calculated payback period—showing if the investment will save you figures on a 3 x 3 grid. You must respond with the ex­ money. act same sequence, within the time limit. Solar Energy for the Home: It’s a natural for architects, designers, contractors, homeowners.. .anyone There are five different, increasingly difficult ver­ who wants to tap the limitless energy of our sun. sions o f the game, including one that will keep going Minimum system requirements are an Apple II or Apple II Plus with one disk drive and 28K of RAM indefinitely. Mimic is exciting, fast paced and Includes AppleDOS 3.2. challenging—fun for all! O der No. 0235AD (disk-based version) $34.95 Air Flight Simulation—Your mission: Take off and land your aircraft without crashing. You’re flying blind —on instruments only. A full tank of fuel gives you a maximum range of Math Fun about 50 miles. The computer will constantly display updates of your air speed, compass heading and The Math Fun package uses the techniques of immediate feedback and positive reinforcement so that altitude. Your most important instrument is the Angle students can improve their math skills while playing these games: of Ascent/Bank Indicator. It tells if the plane is climb­ Hanging—A little man is walking up the steps to the hangman’s noose. But YOU can save him by answering ing or descending, whether banking into a right or left the decimal math problems posed by the computer. Correct answers will move the man down the steps and turn. cheat the hangman. After you’ve acquired a few hours o f flying time, Spellbinder—You are a magician battling a computerized wizard. In order to cast death clouds, fireballs and you can try flying a course against a map or doing other magic spells on him, you must correctly answer problems involving fractions. aerobatic maneuvers. Get a little more flight time Whole Space—Pilot your space craft to attack the enemy planet. Each time you give a correct answer to the under your belt, the sky’s the limit. whole number problems, you can move your ship or fire. But for every wrong answer, the enemy gets a Cotormaster—Test your powers of deduction as you chance to fire at you. try to guess the secret color code in this Mastermind- Car Jump—Make your stunt car jump the ramps. Each correct answer will increase the number of buses your type game. There are two levels of difficulty, and three car must jump over. These problems involve calculating the areas of different geometric figures. options of play to vary your games. Not only can you Robot Duel—Fire your laser at the computer’s robot. If you give the correct answer to problems on calculat­ guess the computer’s color code, but it will guess ing volumes, your robot can shoot at his opponent. If you give the wrong answer, your shield power will be yours! It can also serve as referee in a game between depleted and the computer’s robot can shoot at yours. two human opponents. Can you make and break the Sub Attack—Practice using percentages as you maneuver your sub into the harbor. A correct answer lets you color code...? move your sub and fire at the enemy fleet. Star Ship Attack—Your mission is to protect our or­ All of these programs run in Applesoft BASIC, except Whole Space, which requires Integer BASIC. biting food station satellites from destruction by an Order No. 0160AD $19.95 enemy star ship. You must capture, destroy or drive off the attacking ship. If you fail, our planet is doom ed. . . Trilogy—This contest has its origins in the simple ---- Skybombers — game of tic-tac-toe. The object of the game is to place Two nations, seperated by The Big Green Moun­ three o f your colors, in a row, into the delta-like, mul­ tain, are in mortal combat! Because of the terrain, ti-level display. The rows may be horizontal, vertical, their’s is an aerial war—a war of SKYBOMBERS! diagonal and wrapped around, through the “third di­ In this two-player game, you and your opponent mension” . Your Apple will be trying to do the same. command opposing fleets of fighter-bombers armed You can even have your Apple play against itself! with bombs and missiles. Your orders? Fly over the Minimum system requirements are an Apple II or mountain and bomb the enemy blockhouse into dust! Apple U Plus computer with 32K of memory and one Flying a bombing mission over that innocent look­ minidisk drive. Mimic requires Applesoft in ROM, all ing mountain is no milk run. The opposition’s aircraft others run in RAM or ROM Applesoft. can fire missiles at you or you may even be destroyed Order No. 0161AD $19.95 by the bombs as they drop. Desperate pilots may even ram your plane or plunge into your blockhouse, sui- cidally. Paddle Fun Flight personnel are sometimes forced to parachute This new Apple disk package requires a steady eye and a quick hand at the game paddles! It includes: from badly damaged aircraft. As they float helplessly Invaders—You must destroy an invading fleet of 55 flying saucers while dodging the carpet of bombs they to earth, they become targets for enemy missiles. drop. Your bomb shelters will help you—for a while. Our version of a well known arcade game! Requires Ap­ The greater the damage you deal to your enemy, the plesoft in ROM. higher your score, which is constantly updated at the Howitzer—This is a one or two person game in which you must fire upon another howitzer position. This pro­ bottom of the display screen. gram is written in HIGH-RESOLUTION graphics using different terrain and wind conditions each round to The sounds o f battle, from exploding bombs to the make this a demanding game. The difficulty level can be altered to suit the ability of the players. Requires Ap­ pathetic screams from wounded parachutists, remind plesoft in ROM. each micro-commander of his bounden duty. Press Space W an—This program has three parts: (1) Two flying saucers meet in laser combat—for two players, (2) On, SKYBOMBERS—Press On! two saucers compete to see which can shoot out the most stars— for two players, and (3) one saucer shoots the Minimum system requirements: An Apple II or Ap­ stars in order to get a higher rank—for one player only. Requires Applesoft. ple II Plus, with 32K RAM, one disk drive and game Golf—Whether you win or lose, you’re bound to have fun on our 18 hole Apple golf course. Choose your paddles. club and your direction and hope to avoid the sandtraps. Losing too many strokes in the water hazards? You Order No. 0271AD (disk-based version) $19.95 can always increase your handicap. Get off the tee and onto the green with Apple Golf. Requires Applesoft. The minimum system requirement for this package is an Apple U or Apple II Plus computer with 32K of memory and one minidisk drive. Order No. 0163AD $19.95

*A trademark of Apple Computer Inc. PETERBOROUGH, N.H. 03458 Instant Software 603-924-7296 90 M ICRO-The 6502 Journal No. 3 6 -M a y 1981 Apple* Software From Instant Software ------Santa Paravia and Fiumaccio Buon giorno, signore! Welcome to the province of Santa Paravia. As your steward, I hope you will enjoy your reign here. I feel sure that you will find it, shall we say, profitable.

Perhaps I should acquaint you with our little domain. It is not a wealthy area, signore, but riches and glory are possible for one who is aware of political realities. These realities include your serfs. They constantly request more food from your grain reserves, grain that could be sold instead for gold florins. And should your justice become a trifle harsh, they will flee to other lands. Yet another concern is the weather. If it is good, so is the harvest. But the rats may eat much o f our surplus and we have had years of drought when famine threatened our population. Certainly, the administration of a growing city-state will require tax revenues. And where better to gather such funds than the local marketplaces and mills? You may find it necessary to increase custom duties or tax the incomes of the merchants and nobles. Whatever you do, there will be far- it, you can see how much land you hold, how much o f it is under the plow and how reaching consequences.. .and, perhaps, an elevation of your noble title. adequate your defenses are. We are unique in that here, the map IS the territory. Your standing will surely be enhanced by building a new palace or a magnificent I trust that I have been of help, signore. I look forward to the day when 1 may ad­ catledrale. You will do well to increase your landholdings, if you also equip a few dress you as His Royal Highness, King of Santa Paravia. Buona fortuna or, as you units of soldiers. There is, alas, no small need for soldiery here, for the unscrupulous say, “Good luck” . For the Apple 48K. Baron Peppone may invade you at any time. Order No. 0174A $9.95 (cassette version). To measure your progress, the official cartographer will draw you a mappa. From Order No. 0229AD $19.95 (disk version).

TO SEE YOUR LOCAL INSTANT SOFTWARE DEALER OR USE THE ORDER FORM BELOW ORDER For Fast 10 9 Service Toll-Free Name 1-800-258-5473 Address C ity . . State - - Z ip - Apple Cassettes □ Check □ MoneyOrder □ VISA □ AMEX □ MasterCharge Card No______Exp. Date ______0018A G olf ...... $7.95 0025A M imic...... $7.95 0040A Bowling/Trilogy...... $7.95 Signed Date 0073A Math Tutor I...... $7.95 0079A Oil Tycoon...... $9.95 0080A Sahara Warriors...... $7.95 Order your Instant Software today! 0088A Accounting Assistant...... $7.95 0094A Mortgage w/Prepayment Option/ Q uantity Order No. Program name Unit cost Total cost Financier...... $7.95 0096A Space Wars...... $7.95 0098A Math Tutor II ...... $7.95 0174A Santa Paravia and Fiumaccio...... $9.95 0148A Air Flight Simulation...... $9.95 We Guarantee It!

Guarantee : Shipping and handling $1.00 OUR PROGRAMS ARE GUARANTEED TO BE QUALITY PRODUCTS. IF NOT I ■ f l # 1 ■ Total order COMPLETELY SATISFIED YOU MAY RETURN THE PROGRAM WITHIN 60 instant borrwareinc DAYS. A CREDIT OR REPLACEMENT WILL BF. WILLINGLY GIVEN FOR Peterborough, N.H. 03458 ANY REASON.

No. 36 - May 1981 MICRO - The 6502 Journal 91 Dr. William R. Dial 438 Avenue /AlCftO Akron, Ohio 44320 6502 Bibliography: Part XXXII

926. Call Apple 3, No. 8 (October, 1980) Uhley, John, "DOS with Trace," pg. 12. Reynolds, Lee, "Hexadecimal and Binary Number A discussion of how this combination is achieved on Systems," pg. 7-10. the Apple. A tutorial on HEX/DEC and the Apple monitor. Nareff, Max J., "Program Decimal ROM," pg. 13-14. Weston, David, "Comparing Ten Sort Algorithms,” A Pascal program to convert decimal numbers to pg. 13-19. Roman Numerals. A good demo of various sort methods, with listings for Nareff, Max J., "Addfractns," pg. 14. the Apple. A program in Apple Pascal. Lee, Scott and Rose, Steve, "Demuffin!", pg. 21. Rowe, Pete, “The Mysterious Orange Vertical Line,” Use this DOS 3.3 program to transfer DOS 3.3 pro­ pg. 15. grams to DOS 3.2 disks. A discussion of a quirk of Apple Hi-Res. Robinson, Alan H., "Apple FORTRAN: First Rowe, Pete, "Apple ASCII/BASIC Token and Hi Res Impressions," pg. 23-24. Address Reference," pg. 16-17. A review of FORTRAN for the Apple. Reference information for Apple programmers. Manly, Kenneth, "Why Don't You Watch Where You’re Going?", pg. 25-28. 928. Apple Cookbook 1, No. 4 (November, 1980) A tutorial on the Apple Hi-Res Screen Function, with Weber, Stan, "Getting Fancy with Formats,” pg. 1-2. demo listings. A routine providing formatting for Apple programs. Anon., "Use FID with DOS 3.2!", pg. 34. Anon., "Informer Update," pg. 5-7. How to use the handy file handler with DOS 3.2 disks. An update routine for a previously published Apple Murdoch, David M., "&CATALOG," pg. 34. utility. A short POKE routine to enable the use of the Amper­ Busdiecker, Roy, "The Number Game: An Introduction sand to produce the Catalog command on the Apple. to Computer Arithmetic." Capes, Nelson R., "Data Communications with the Elec­ A tutorial with a listing to convert decimal numbers to tronic Systems Card,” pg. 37-41. binary equivalents. An inexpensive way to interface the Apple with a modem and download from other systems, with listing to implement the system. Huelsdonk, Bob, "Making BASIC Behave: Part VI," 929. The Seed 2, No. 11 (November, 1980) pg. 43-44. Anon., "Apple Pi Conventions,” pg. 2. Some handy Apple utilities and some input hints. A listing to assist programmers in writing credit lines Kluepfel, Charles, "Applesoft Program Splitter Mods," for programs submitted to newsletters. pg. 45-48. Dulk, G.A., "Use of Apple As A Word Processor" pg. 4-8. Some improvements on a previously published Apple The Pascal system has many of the desirable features of program. a word processor. Lewellen, Tom K., “A Patch for 80 Column Video Boards White, Harry, "DISK, Shape Up!!", pg. 9. and Apple Pascal,” pg. 51-52. A listing to permit a quick and dirty examination of Some hints for the Apple Pascal users. Apple Hi-Res shape tables. Reynolds, Lee, "Decimal Packing and Unpacking," Eliason, Andrew H., “The Apple n Hardware," pg. 11-13. pg. 55-56. A tutorial on the Apple n keyboard. A memory saving technique for the Apple. Duplissey, Claude, "Applesoft Strings,” pg. 14. Eckert, Paul and Bronstein, Neil, "GOTO A," pg. 56. A tutorial on Apple strings. How to use the forbidden variable in a GOTO on the Apple. Lustig, Henry G., "Line Number Cross Reference for 930. The Cider Press (August/September, 1980) Applesoft," pg. 58-59. A utility listing for the Apple. Silverman, Ken, "Configuring Your Apple—Don’t Overload Your Apple n ," pg. 6-7. 927. The Cider Press (July, 1980) A chart of the voltage and current requirements of various Apple boards and peripherals. Poindexter, Ed, "Machine Language Mysteries Revealed! A BASIC Approach," pg. 6-7. Weiglin, Peter C., "Build a Better Error Trap," pg. 8 . A tutorial on the Apple machine language. Help the Apple in its quest for valid data. Crossman, Craig, "Fun With Assembly Language," Rowe, Pete, "Int and FP Machine Language Interface," pg- 8-9. pg. 12-19. An interesting article discussing some simple assembly A tutorial for the Apple with several listings in machine language operations on the Apple. language. Uhley, John, "Credit Plus," pg. 10-12. Wilson, Gene, "Je M'Apple’ Pascal," pg. 20-23. A short machine language program to assist program­ A tutorial on Apple Pascal with a listing for a disk utility. mers in adding credit statements to their listings on the Norris, Paul, "Why Pascal? Why Not?", pg. 24. Apple. The pro’s and con’s of Apple Pascal are discussed. 92 MICRO-The 6502 Journal No. ao - May 1981 931. The Target (September/October, 1980) Kwok, Kin-Ping, "A BASIC Word Processing System," Hollibaugh, Larry, “Touch-Tone Dialer,” pg. 2-5. pg. 41-43. Generate touch-tones with the aid of XlM-65 and an Two BASIC programs providing a word processing AY-3-8910 programmable sound generator using this ar­ capability on the SYM-1. ticle and accompanying hardware and program listing. Staff, "How to 'Rewire' the VIA at $A800." Bresson, Steve, "Offset Load," pg. 6 . Two methods applicable to the SYM-1. Program for the AIM 65 to load an object program from Anon., "Mystery Program,” pg. 46-47. tape at an offset from the save address. SYM program for file handling. Buchen, D., "EPROM Programmer," pg. 8-14. A programmer for the AIM 65 to program EPROM's 938. Personal Computing 4, No. 12 (December, 1980) 2708, 2716, 2516 and 2532. Schlarb, Keith N., "Required Reading,” pg. 68-71. Apple program for storing information in the 932. Microcomputer Index 1, No. 2 (April-June, 1980) classroom. A subject index covering over 850 microcomputer Staff, "London’s World Micro Chess Champions,” magazine articles, many on 6502-related subjects. pg. 79-80. Chess programs based on the 6502 take most of the 933. Microcomputer Index 1, No. 3 (July-September, 1980) honors. A subject index covering over 1000 microcomputer magazine articles, many on 6502-related subjects. 939. Compute! 2, Issue7, No. 6 (November/December, 1980) 934. Softalk 1 (November, 1980) McNeil, Arthur L., "Small Computers and Small Stinson, Craig, "The All-American Apple Music Libraries," pg. 24-29. Machine,” pg. 14-21. A PET program to print out catalogue cards for the A discussion of the Apple and various systems for library. generating music on the Apple. Richter, Mike, "Efficiency with Subroutines," pg. 30-32. Wagner, Roger, "Assembly Lines," pg. 34-35. A tutorial for the PET system. Everyone's guide to machine language on the Apple, Flynn, Brian J., "Computing Correlation Coefficients," part 2 . pg. 36-41. Listing and explanation of a listing for 6502 micros. 935. Stems From Apple 3, Issue 11 (November, 1980) Baker, Al, "A1 Baker's Programming Hints: Apple," pg. 42-43. Dial, Wm. R., "Mystery Program," pg. 3. Exploring the Apple paddle and the joystick. A short whimsy for the Apple. Kelly, Derek A., "The Anatomy of a Word-Research Pro­ Ward, Dermis, "Dennis Does It Again,” pg. 7-9. cessing Program for the Apple,” pg. 44-49. Several short programs for the Apple. A model for structured programming. Hoggatt, Ken, "The Twelve Days of Christmas," Castevens, Philip, “Hard Disks for the Apple.” pg. 9-10. Discussion and directory of disk hardware. Listings for Apple Pascal and for Applesoft BASIC. Harris, Neil, "Times Square on your Atari,” pg. 56-58. Shelton, Janice and Hoggatt, Ken, “ Christmas Gift A scrolling program for the Atari. Exchange," pg. 11-12. Apple Pascal and Applesoft listings for Apple. Lindsay, Len, “Error Reporting System for the Atari,” pg. 58-59. Anon., "LAC Application Note: Program Transfer," Gives Atari error messages in plain language instead of pg. 14-20. just error numbers. An Apple Pascal routine for sending ana receiving files or whole volumes over serial lines. White, Jerry, "Monthly Bar Graph Program," pg. 61. An Atari BASIC tutorial with bar routine listing. 936. From The Core (November, 1980) Seivert, William D., "Card Games in Graphics Modes 1 and 2,” pg. 62-63. Budge, Joe, "Natterings from the Nabob," pg. 2. Hints for Atari game programmers. Among other tips a fix for a bus in early issues of DOS 3.3 for the Apple. Bruun, James L., "Using TAB in Atari BASIC," pg. 64. Create a TAB function for your Atari. Andrews, Wilbur C., "PTEXT," pg. 5. PTEXT is a text formatting program written in Apple Brannon, Charles, "Pokin’ Around," pg. 6 6 . Pascal. A tutorial on the Atari POKE function. Graham, Johnny, “ 16 to 13 Sector Hardware Mod," pg. 8 . Stewart, Charles, "Coded Data for OSI1P," pg. 70-71. A mod that allows switching the disk controller card in A program for OSI computers which hides data state­ the Apple Disk system from 13 to 16 sector and vice ments in ASCII code. versa. Garland, W. Blaine, "OSI Graphics Character Set,” pg. 71. 937. Sym-Physis Issue 5/6 (September-December, 1980) A demo program to show the characters and memory location. Cole, Stephen E., "Power-On Routine,” pg. ?. A power-on routine for the SYM-1. Stanford, Charles L., “Atari Joysticks on the OSI C1P,” pg. 72-77. Campbell, Hugh, "Apple Tape Loader Program," Interface the Atari joystick to the C1P, hardware and pg. 2 1 -2 2 . software. With a listing for a typical game with A loader for transferring Apple tapes to the SYM. joystick.

No. 3 6 -M a y 1981 MICRO-The 6502 Journal 93 941. KB Microcomputing No. 47 (December, 1980) Butterfield, Jim, "BASIC CBM 8010 Modem Routines,'' pg. 78. Baker, Robert W., "PET-Pourri," pg. 7-8. All about using the PET with a Modem, with listings of Discussion of PET ROM changes, character generator required software. ROMs, and programming hints. Busdeicker, Roy, "Programmer's Notes for the CBM Bendix, Peter, "Music Transcriber," pg. 43-63. 8032," pg. 80-82. Write sheet music instantly on your TV screen using Discussion and hints for using the CBM 8032 micro. the KIM and a piano-like keyboard. Brannon, Charles, "Keyprint," pg. 84-86. Kupke, D., "Super Sound with your Superboard II," A routine to enable the PET screen to be dumped to a pg. 130-131. printer at any time. A simple and inexpensive modification to unlock the Butterfield, Jim, "PET 4.0 ROM Routines," pg.’88-90. OSI Superboard II's secrets of sound generation. Addresses of PET ROM routines. Urschel, Robert, "The GI Programmable Sound Gener­ Butterfield, Jim, "BASIC 4.0 Memory Map," pg. 92-93. ator," pg. 134-140. Useful information for PET users. Use a music/sound effects chip with the Apple, with music generation program listing. Deal, Elizabeth, "Algebraic Expression Input for the PET, Version 2," pg. 94-96. Kelly, Derek A., "Computerized Project Management," Discussion of inputting on the PET with utility pg. 142-148. routine. A program for the Apple to help plan and schedule com­ plex projects. Winter, M.J., "Defining a Function Whilst Running a Program," pg. 96. Mendelsohn, Stephen, "Hard Copy for the OSI Chal­ A routine for the PET. lengers,” pg. 165-166. A simple modification accommodating both hard copy Butterfield, Jim, "Machine Language Addressing and cassette I/O on the Challenger IIP. Modes," pg. 98-100. A discussion of 6502 addressing modes, oriented to the Davison, John W., "Apple n Plus Plus," pg. 214. PET. Upgrade your Apple to Apple n Plus and more. Covitz, Frank, "Visible Memory Printer Dump," Piper, Neil, "Give Character to your PET Printer," pg. 104-109. pg. 218-220. Print Dump for the PET/MTU visible memory/CBM Creating user-defined characters on the Commodore 2 0 2 2 printer combination. 2022 and 2023 printers. Baker, Robert W., "Disk Lister," pg. 110-114. 942. BYTE 5, No. 12 (December, 1980) A disk cataloguing program for the PET and 2040 disk. Zumchak, Gene, "Nuts and Volts," pg. 116-121. Martellaro, John, "Sargonll," pg. 114-118. Discussion of the 6502/6522 combination for I/O An improved Chess-Playing program for the Apple II. functions. 943. L.A.U.G.H.S. 2, No. 7 (December, 1980) DeJong, Marvin L., "Interfacing the Am9511 Arithmetic Processing Unit,” pg. 122-127. Finn, Mike, "The RWTS Subroutine: Part I.” Use of the Am9511/6502 combination, with driver A tutorial for the Apple disk system. Includes a routines. diagnostic program. Butterfield, Jim, "Interfacing KIM/SYM/AIM/OSI with 944. Creative Computing 6, No. 12 (December, 1980) BASIC," pg. 128-131. Discussion of single board monitor systems. Berggren, Stephen R., "Christmas Tree," pg. 124-125. Herman, Harvey B., "KIM-1 Tidbits," pg. 134-136. Decorate the Christmas Tree with this program for the A program for KIM which makes data statements from Apple. a machine language program. Berggren, Stephen R., "Apple Nuclear Power Plant,” Flynn, Christopher J., "AIM 65 Tape Copy Utility," pg. 128-137. pg. 137-139. Try your skill in running a reactor. A short routine to make direct tape copying easy. Raymer, Paul, "Weather Station," pg. 142. Wells, George, "Combining BASIC and Machine- Bring your Apple in touch with the real world with this Language Programs on Tape,” pg. 140-142. weather program. A procedure for SYM-1 users to combine BASIC and Blank, George, "Outpost: Atari," pg. 200-201. machine language programs in a single cassette tape Programming hints 1 for the Atari microcomputer. file. Carpenter, Chuck, "Apple-Cart," pg. 202-207. Bean, Fred D., "Base Converter," pg. 144. Discussion of 6502 books, the Galfo/Massimo A PET program for converting decimal numbers to CW-RTTY communications programs, software by numbers with other bases. phone, new Apple boards, etc.

940. The Apple-Dillo (November, 1980) 945. Nibble No. 7 (December, 1980) Huffman, David, "PLE Notes," pg. 3-4. Weinstock, Michael D., "Apple A.I.M.," pg. 9-17. Some new functions possible with special macros Automatic Intelligent Mailing list and label program for entered into the Program Line Editor utility. the Apple. Teas, George, "Pascal Primer," pg. 5. Floeter, Alan D., "Apple Concordance,” pg. 21-26. Discussion of WAIT routine for Pascal users. An Apple Utility to locate variables in a listing. Bartley, David, "Getting There Faster in Applesoft: Part Reynolds, William, m, “Tough Plus!” , pg. 29-31, 43, 53. n ," pg. 5-7. New enhancements and a "Find and Replace.” Two machine-language enhancements for the Applesoft Guy, Rudy A., "Low Score II,” pg. 33-37. GOTO interpreter. A graphics game for the Apple.

94 MICRO-The 6502 Journal No. 3 6 -M a y 1981 INTRODUCING ADVERTISERS’ INDEX COGNIVOX S e rie s VIO-IOOO A Revolutionary New MAY 1981 Voice Input and Output Peripheral

Advertiser's Name Page I Aardvark Technical Services ...... 21 Abacus Software...... 57 I Aurora Software Associates...... 80 Avant-Garde Creations...... 57 Beta Computer Devices...... 37 The Book...... 54 Broderbund Software...... 83 Computer Applications Tomorrow...... 72 The Computerist, Inc...... IFC Computer Mail Order...... 61 Connecticut Information Systems ...... 44 High Fidelity Voice Response Consumer Computers...... 43 Industrial Quality Recognition Continental Software...... 51 Creative Computing...... 22 PET - AIM-65 — APPLE H Decision Systems...... 57 Digibyte Systems Corp ...... 58 COGNIVOX series VIO-IOOO is a top-of-the-line voice I/O Dr. Dobb's Journal ...... 12 peripheral for business and educational applications and the Eastern House Software...... 70, 73 demanding hobbyist. Human Engineered Software ...... 70 Instant Software ...... 90-91 It can be trained to recognize words or short phrases drawn Jini Micro Systems, Inc...... 64 from a vocabulary of 32 entries chosen by the user. It will talk Lazer Systems...... 8 back with up to 32 words or short phrases. In disk based systems, response vocabularies can be stored on the disk and brought to LJK Enterprises ...... 42 memory as needed, giving an effectively unlimited number of MICRO Ink, Inc...... 15, IBC vocabular y entries. The quality of voice response is excellent, MICRO Classifieds...... 54, 80 and it is far superior to that of speech synthesizers. Micro Interfaces, Inc...... 74 Microsoft Consumer Products...... 1 COGNIVOX series 1000 comes complete and ready to plug MicroSoftware Systems...... 74 into your computer (the computer must have at least 16K of Micro Technology Unlimited ...... 2, 30 RAM). It connects to the parallel I/O port of the PET, to the game paddle connector on the Apple and to the J1 port on the AIM-65. Micro-Ware Distributing ...... 83 Connectors are included as required. Also included are a Mittendorf Engineering...... 41 microphone, cassette with software and extensive user manual. Nibble...... 18 A built-in speaker/amplifier is provided as well as a jack for Nikrom Technical Products...... 70 connecting an external speaker or amplifier. Ohio Scientific...... BC Ohio Scientific "Small Systems Journal"...... 84-87 Software supplied with COGNIVOX includes two voice Perry Peripherals...... 70 operated, talking video games, VOTH and VOICETRAP. These games are absolutely captivating to play, and the only voice Progressive Computing...... 27 operated talking games that are commercially available. Rainbow Computing...... 7 Rosen Grandon Associates...... 57 Adding voice I /O to your own programs is very simple. A single Serendipity Systems, Inc...... 73 statement in BASIC is all that is required to say or to recognize a Simulations Programming...... 74 word. Complete instructions on how to do it are provided in the Small Business Computer Systems...... 74 manual. Softape...... 83 In keeping with the VOICETEK tradition of high performance at Southeastern Software ...... 4 affordable price, we have priced COGNIVOX series 1000 at the Southwestern Data Systems...... 73 unbelievably low, introductory price of $249 (plus $5 shipping in Strategic Simulations, Inc...... 22 the US, CA add 6% tax. Foreign orders welcome, add 10% for TSE-Hardside...... 28-29 handling and shipping via AIR MAI L). When ordering, please give Versa Computing ...... 27 the make and model of your computer, the amount of RAM and Voicetek...... 95 whether you have disks or not. Western Micro Data Enterprises ...... 44 In addition to COGNIVOX series VIO-1000, VOICETEK manufactures a complete line of voice I/O peripherals for most of the popular personal computers. Speech recognition-only peripherals are available for the 8K PET and the 4K AIM.

For more information call us at 805-685-1854 or write at the address below. Why Advertise in MICRO? Dealer Inquiries invited. Find Out! Dept E , P.O. Box 388 Call (617) 256-5515 VOICETEK Goleta, CA 93116 Ask for Cathi Bland

No. 36 - May 1981 MICRO - The 6502 Journal 95 Crossman, Craig, "Apple Tricks,” pg. 39. Anon., "Hello Program," pg. 9. A program routine to prevent an inadvertent 'reset' and An appealing Hello program for the Apple disk. a routine to clear the screen with the ampersand. Laird, Alexander, "Fun with the Apple Monitor," pg. 47. 949. Interactive Issue 3 (Winter, 1980) Discussion of the Apple assembler. Sellers, George, "Solving Simultaneous Equations Using Reynolds, William, III, "Tracing the Apple DOS 3.2 as it BASIC,” pg. 4-5. Boots," pg. 50. Use the AIM 65 to solve up to 20 equations and 20 Step-by-step description of what happens in booting unknowns. DOS. Evans, Mel, "Learn to Touch Type," pg. 6-7. Reynolds, William, HI, "Calling the RWTS from BASIC," An AIM 65 program to assist the typing learner. pg. 50. Smith, Gordon, "BASIC Time Saver," pg. 8-10. A short discussion of RWTS on the Apple. An AIM utility combining automatic line numbering Harvey, Mike, "Watch Out for Graphics Overflow," and common BASIC command automatic typist. pg. 61. DeJong, Marvin, "Interrupt Driven Keyboard," pg. 12. Tips for avoiding space problems in graphics programs. A listing of a routine that reads the AIM 65 keyboard on Laird, Alexander, "Get Controls, CHR$, and Things," an interrupt basis. One possible use is in sending Morse pg. 61. code. How to implement several useful commands on the Anon., "Super Simple Auto-Start," pg. 15. Apple. A short utility for the AIM 65. Anon., "Temperature Conversion Program," pg. 18. 946. The Harvest 2, No. 4 (December, 1980) A program for the AIM which prints out Fahrenheit/ Schumacher, Kurt G., "Applesoft Variable GOSUB,” Centigrade conversion tables. pg. 1-3. April, Georges-Emile, "BASIC USR Helper,” pg. 18-19- Hints on implementing the GOSUB command; with 3 Routines to ease the use of USR(X) on the AIM 65. listings for the Apple. Berges, Antonio, "BASIC Recovery Procedure," pg. 20. Russ, John, "Universal Input Function for Fortran,” How to recover from an error in hitting the wrong AIM pg. 7-8. key. An input program for Apple Fortran. Anon, "Ask Mr. Apple," pg. 9 950. Peek(65) 1, No. 11 (November, 1980) Some hints on speeding up Applesoft commands. Loos, James, "Modifying the OSI Video Display," Hartley, Tim, "Changing Volume Numbers,” pg. 9. pg. 2-8.. Change the number on your diskettes with this short How to change the OSI C1P from a 24 x 24 display to routine. 29x48. Dial, Wm. R., "Backwards Apple,” pg. 10. Jones, David A., "Cassette Comer," pg. 12-14. A short program demonstrating a seldom-used Hints for using cassettes with OSI systems. possibility of the Apple TAB function. Anon., "Not Another Hello Program!”, pg. 12. 951. The Cider Press (November, 1980) A Hello program for Apple disks. Anon., "DOM, Disk of the Month, November," pg. 4. Several useful utilities, for the Apple. Also a 16 sector (DOS 3.3) utility disk. 947. Interactive Issue 2 (Summer, 1980) Weiglin, Peter C., "Formatting: Part Two," pg. 6-7. A good tutorial on formatting on the Apple. Anon., "AIM 65 Graphics," pg. 4-5. Two plotting programs, AIMPLOT and AlMGRAPH, Anon., "Wow! Try These Patches on DOS 3.2," pg. 10. with listings. New features for the Apple DOS. Butterfield, Jim, "Inside BASIC," pg. 6-8. Anon., "Plug in a 6809E," pg. 11. BASIC Token List, Zero Page Usage, BASIC Entry The 6809E can execute programs faster than the 6502 Points, for the AIM 65. but can co-exist with the 6502 in the new mod. Anon., "AIM 65 Sound," pg. 8. Nareff, Max J., "Which DOS is Dat in Dere?", Add a speaker to your AIM 65. pg. 11. A short command to print whether the DOS is in effect Anon., "Disassembler Utility,” pg. 11. on your Apple is 3.0, 3.1, 3.2, 3.2.1 or 3.3. A utility for the AIM 65 to slow down the display of instructions. Pfeifer, Frank J., "Swatting Program Bugs," pg. 12. Fixes for bugs in some interesting Apple programs. Reo, Frank, "Offset Loader for AIM 65," pg. 13. A routine to load object code to a different location. Wilson, Gene, "JeM'apple,' Pascal," pg. 13-21. A group of Pascal programs: beginner's notes, using Brinkmann, G., "BASIC Banner Program," pg. 15. your printer, lower case for Pascal, ROM test, master Print out banners with this short routine for the AIM 65. catalog, etc. Reardon, Mark, "Parity Bit Generator Program," pg. 15. A short machine language program to generate odd or 952. Apple/Sass 2, No. 9 (December, 1980) even parity bits for the AIM ASCII characters. Espinosa, Chris and Wyman, Paul, "Peeks, Pokes and 948. The G.R.A.P.E. Vine (November,1980) Calls," pg. 6-7. A good reference for Apple programmers. Anon., "Free Disk Space," pg. 4. Burger, Mike and Lynch, Ron, "Scrolling Lo-Res," pg. 9. Two short programs for the Apple. A routine for the Apple graphics.

96 MICRO - The 6502 Journal No. 3 6 - May 1981 $ 2 4 . 9 5

h - ^ it h d f s k e t t e !

W M'c n o M p p )e ,

Than 30 prnn

ZF? "° h>* 6t MICR0 /A n . ' Untime Um fi Educa- p f t i c n o Cl' ^ l y ^ ° 2 A cost effective 10 megabyte system from the feeder in Winchester besed microcompoters.

Ohio Scientific has put a low-cost, high-perform­ ance 8" non-removable hard disk together with its popular desk-top micro­ computer system. This yields approximately 10 megabytes of fast C2-D hard disk capability at a tremendous Standard Features cost/performance benefit over ■ 52K RAM floppy based microcomputer ■ 8" floppy disk drive for program transport systems. and backup. ■ OS-65U small business operating system. C3-D ■ 9-digit precision BASIC by Microsoft. The 10 megabyte system is also ■ Available in OEM quantities at attractive available with the added advantage of discounts. triple microprocessors — the 6502A, For literature and the name of your local dealer, 68BOO and Z-80A. This allows you to CALL 1-800-321-6850 TOLL FREE. make maximum use of Ohio Scientific’s extensive software library as well as OHIO OCIEMTIFIC programs offered by independent a Company suppliers and publishers. $7,600. 1333 SOUTH CHILLICOTHE ROAD, AURORA, OH 4 4 2 0 2 • [216] 831 -56 0 0