<<

, !.50 NO. 55 DECEMBER 1982

THE 6502/6809 JOURNAL

__ ©®om(nra®dl®ir® ATARI Graphics APPLESOFT GOTO/GOSUB Checker 68000 Logic Instructions i u a

RETURNS AND ALLOWANCES SALES 37722 70 95482 60 26473 61 7«53c7 Si.ff.TC: 89000 2733 65 0 00 0 03 AND AiLCTA'ANCES 45 00 45 CO 723 00 47300 SOLO COST OF SALES 33S6/.T: 9776125 26696 61 Txo.'bT FREIGHT OTHER COST OF SALES COST OF G0005 StA.0 COST ' SALES 5978 89 17^379 473382 14242 84 TOGHT 3647Q 31345 23754 1A531 OMR COST SALf S 2700 ’20 0 00 OCO SALARIES PAYROLL TAXES 2719711 79563 71 RENT OFFICE EXPENSES

VisiCalc

< - You Won’t Need VisiCal

Pr- H BH / B B H B p i . /..//. Dy fully utiltangjL™. ■-> hardware breakthroushs—without your having to break the bank to MAGICALC includes: • 70-column upper- and lower-case video • ______Invisible ______c< display Full cor • Full 80-column board display ■ ’ S0®SlS 40-column standard display Individual column widths

. MAGICALC—An outstanding produc

$ < 1 4 9 9 5

Breakthrough to today’s technology by contacting: i

__ _ ■ __ _ _« 5547 satsumo avenue • north hollywood, California 91601 • 213/985 2922

VisiCalc is a registered trademark of VisiCorp. MAGICALC is a trademark of Artsci, Inc. FLEX - -9 LEVEL ONE - UNIFLEX - OS-9 LEVEL TWO ONLY GIMIX Systems can be configured to run any of these.

GIMIX systems utilize the most powerful 6809 operating systems: FLEX, UniFLEX, OS-9 LEVEL ONE and TWO - the systems the PROs use. This means a wide selection of software to choose from as well the ability to develop sophisticated, multi­ user/multi-tasking programs on your GIMIX System.

The GIMIX CLASSY CHASSIS™1 consists of a heavy-weight aluminum mainframe cabinet which provides more than ample protection for the electronics and 1 or 2 optional 5 1/'’ drives. , Backpanel connectors can be added for convenient connection of terminals, printers. I drives and other peripherals. A 3 position locking keyswitch enables users to disable the front panel reset button to pre­ vent accidental or unauthorized tampering with the system. The GIMIX system mother board provides fifteen 50 pin slots and eight 30 pin I/O slots -- :------the most room for expansion of any SS50 system available. The on board baud rate generator features 11 standard baud rates, 75 to 38.4K, for maximum versatility and compatibility with other systems. Extend­ ed address decoding allows the I/O block to be addressed anywhere in the 1 megabyte address space. All components feature Gold plated connectors for a lifetime of solid connections. All boards are fully buffered for maximum system expansion. Each GIMIX Mainframe System is equipped with an industrial quality power supply featuring a ferro-resonant constant voltage transformer to insure against problems caused by adverse power input conditions such as A.C. line voltage fluctua­ tions etc. The supply provides 8 volts at 30 amps and plus or minus 16 volts at 5 amps, more than enough capacity to power a fully loaded system and two internal drives.

The 2MHz GIMIX 6809 PLUS CPU board includes a time of day clock with battery back-up and 6840 pro­ grammable timer to provide the programmer with convenient, accurate time reference. Later addition of 9511 or 9512 arithmetic processors is provided for on the board. The unique GIMIX design enables software selection of either OS-9 or FLEX, both included in many complete GIMIX systems. GIMIX STATIC RAM boards require no complicated refresh timing cycles or clocks for data retention. GIMIX memory boards are guaranteed for 2 MHz operation with no wait state or clock stretching required. Our low power NMOS RAM requires less than 3/4 amp at 8V for a fully populated 64K board. For critical situations, our non­ volatile 64K byte CMOS static RAM boards with built in battery back-up retain data even with system power removed. A fully charged battery will power this board for a minimum of 21 days. A write protect switch permits CMOS boards to be used for PROM/ROM emulation and software debugging.

The GIMIX DMA controller leaves the processor free to perform other tasks during disk transfers - an impor­ tant feature for multi-user/multi-tasking systems where processor time allocation is critical. The DMA board will accomodate up to 4 drives 5Vi” or 8” in any combination running single or double density single or double headed. Programmed I/O Disk Controllers are also available.

GIMIX systems are designed with ultimate RELIABILITY in mind. You can choose from the below featured systems or select from our wide variety of components to build a custom package to suit your needs. GIMIX 2MHz 6809 System including: CLASSY CHASSIS, 6809 PLUS CPU BOARD, 56KB STATIC RAM, 2 SERIAL PORTS W/CABLES, GMXBUG MONITOR, FLEX, and OS-9 LEVEL 1 ...... $3248.49 FOR TWO 5 'A " 40 TRACK DSDD DRIVES A D D ...... $ 900.00 GIMIX 128KB WINCHESTER SYSTEM including: CLASSY CHASSIS, 6809 PLUS CPU BOARD, 128KB STATIC RAM, 4 SERIAL PORTS W/CABLES, 5 'A” 80 TRACK DSDD FLOPPY DISK DRIVE, 19MB 5 V4” WINCHESTER HARD DISK, OS9 LEVEL 2, EDITOR AND ASSEMBLER...... $8998.09 50HZ Versions Available, 8” Drives Available — Contact GIMIX for Prices and Information. The Sun Never Sets On A GIMIX! GIMIX users are found on every continent, including Antarctica. A representative group of GIMIX users includes: Government Research and Scientific Organizations in Australia, Canada, U.. and in the U.S.; a t NASA, Oak Ridge, White Plains, Fermilab, Argonne, Scripps, Sloan Kettering, Los Alamos National Labs, I& k. AURA. Universities: Carleton, Waterloo, Royal Military College, in Canada; Trier in Germany; and in the U.S.; Stanford, SUNY, Harvard, UCSD, Mississippi, Georgia Tech. Industrial users in Hong Kong, Malaysia, South Africa, Germany, Sweden, and in the U.S.; GTE, Becton Dickinson, American Hoechst, v Monsanto, Allied, Honeywell, Perkin Elmer, Johnson Controls, Associated Press, Aydin, Newkirk Electric, Revere Sugar, HI-/AMS Controls, Chevron. Computer mainframe and peripheral manufacturers, IBM, OKI, Computer Peripherals Inc., Qume, Floating Point Systems. Software houses; Microware, T.S.C., Lucidata, Norpak, Talbot, Stylo Systems, AAA, HHH, Frank Hogg Labs, Epstein Associates, Softwest, Dynasoft. Research Resources U.K.. Microworks. Meta Lab. Computerized Business Systems.

GIMIX Inc. reserves the right to change pricing and product H ____l T l I 11 * speecifications at any time without further notice. 1337 WEST 37th PLACE I I I CHICAGO, ILLINOIS 60609 I ■ U GIMIX® and GHOST® are registered trademarks of GIMIX Inc. -r- .r* FLEX and UniFLEX are trademarks of Technical Systems Consultants Inc (312) 927-5510 The Company that delivers OS-9 is a trademark of Microware Inc. TWX 910-221-4055 Quality Electronic products since 7 9 75. © 1982 GIMIX Inc.

No. 55 - December 1982 MICRO - The 6502/6809 Journal 1 ANmmcimElectroScreen the Super ior Alter native to the Traditional Alphanumeric Terminals

The ElectroScreen™ Intelligent Graphics Board Features: Graphics Terminal • 512 x 480 resolution bit-mapped display • Terminal emulation on power-up • Interleaved memory access — fast, snow-free updates • 83 characters by 48 lines display Intelligence • Easy switching among user-defined character sets • Fast hardware scrolling • 6809 on-board mpu • 6K on-board firmware Additional Features • STD syntax high level graphics command set • -50C and SS-64 compatible board • Removes host graphics software burden • Board communicates with host through parallel latches • Flexible text and graphics integration • Composite and TTL level video output • Multiple character sizes • 8 channel 8 bit A/D converter • User programs can be run on-board • Board occupies 4 address bytes See your dealer today! The ElectroScreen manual is available for $10, credited toward purchase of the board.

The ElectroScreen has a 90 day warranty from purchase date. Dealers, please contact us for our Privac Inc(703)671-3900 special introductory package. 3711 S. George Mason Dr., Falls Church, Va. 22041

2 MICRO - The 6502/6809 Journal No. 55 - December 1982 MICRO December Highlights

Commodore Machines Featured Expand Your Computer's Capabilities with New Hardware This month we cover the full range of Commodore's machines: the PET, VIC, SuperPET, and the exciting new The BSR X-10 allows you to control remotely a wide . Each machine has its own distinct variety of electrical devices in your home. There are two features, but also shares characteristics with the other versions available; one sends its signals using power lines Commodore family members. CBM users will want to as antennas, and another uses ultrasonic signals. Each read all the Commodore related articles in this issue. light or appliance is connected to its own receiver module. John Krout's "Home Control Interface for C1P" (p. 77) The second part of the University of Rochester's series shows how to add ultrasonic circuitry to your computer at |p. 59) discusses the use of an inexpensive device, the a cost much less than the BSR ultrasonic option. David analog transducer, which can be applied to many problems Hayes's "Atari Meets the BSR X-10” (p. 82) shows how to outside the college teaching laboratory. The analog convert the unit for control from Atari's controller ports. transducer makes it possible for your digital computer to deal with quantities measured on a continuous scale — If you've ever looked at a 6502 programming manual, light, voltages, densities. you might have noticed all the unused op codes. Now you can use those codes to execute your own machine-language Contributing Editor Jim Strasma starts on a six-part routines. Curt Nelson and his associates ("Utilizing series (p. 37) that will help you write better program 6502's Undefined Operations,” p. 93) present a circuit packages. In particular, it will cover CBM’s powerful, yet that causes the 6502 to execute your code, instead of poorly understood, relative record system. The first part, crashing, when it encounters an unused op code. however, deals with designing a modular program package, setting things up, and passing parameters. Jim uses por­ In "Programmable Character Generator for OSI" Colin tions of the public domain program "Bennett's Mail List Macauley demonstrates how to define your own 4040" to illustrate his points. characters (p. 88). OSI readers shuld turn to our OSI book announcement on page 25. We also offer a number of utilities for Commodore Joe Hootman's in-depth coverage of the 68000's in­ machines. Hans Hoogstraat's "BASIC Squeeze for PET" struction set continues (p. 85! with a discussion of the (p. 42) is a cassette buffer-sized program that can be saved logic instructions. As usual, convenient reference tables with a fully expanded and commented BASIC program. are included. When the program is run, it makes a call to the squeeze routine, which compresses the program to take less space Apple and Atari and run faster. Troup and Strasma's "SO U P " (p. 52) is a compare program for machine-language routines saved on Paul Swanson concludes his three-part series on Atari's disk. Thomas Henry's “BASIC Line Delete for PET and character graphics (p. 22) with a demonstration of patch­ VIC1' (p. 47) adds the capability of deleting more than one ing into Atari's vertical blank interrupt routine. His BASIC program line at a time. "From Here to Atari" column (p. 32) covers a variety of topics, including Atari's new software acquisition centers In our "Short Subjects” section |p. 97) we have two and some technical tidbits. items of interest to users of Commodore machines. Terry Peterson explains the ASCII character set on the SuperPET Peter Meyer presents an "Applesoft GOTO/GOSUB and reveals some hidden features. "VIC Jitter Fixer," by Checking Routine” (p. 26) that displays all incorrect Contributing Editor Dave Malmberg, can be added to your GOTO and GOSUB references. "ILISZT for Integer paddle, joystick, and light-pen programs to give you more BASIC,” by Leonard Anderson, is a follow up to a similar reliable readings from these devices. program he presented for Applesoft (p. 13). It produces an attractive, formatted listing of your Integer BASIC pro­ Finally, we feature the new Commodore 64 computer gram, complete with indentation, paging, and other fancy in both "PET Vet" and on our data sheet. Loren Wright's features. Tim Osborn's "Apple Slices" [p. 65) presents a column (p. 54) reviews the graphic capabilities of this general-purpose binary search routine that can be called exciting new computer, and the data sheep (p. 109) pro­ using the & vector. vides a memory map, interfacing information, and lists of JMCftO graphics and sound registers.

No. 55 - December 1982 MICRO - The 6502/6809 Journal 3 f .FOR YOUR APPLE II Industry standard products at super saver discount prices

80 COLUMN SPECIAL AND NEW VIDEO DISPLAYS FOR APPLE II 5 MEGABYTE HARD DISK For Apple II. Supplied with controller. Use with SMARTERM CP/, Apple DOS, & Apple Pascal ...... $1995 (Not to be confused with SUPRTERM) PARALLEL PRINTERS 51/4” DISK DRIVE Software switching from 80 to 40 and 40 to 80 NEC 8023 or C-ITOH 8510 characters. 9 new characters not found on the Use with standard Apple II disk controller. .$295 Apple keyboard. Fully compatible with CP/M' and (Virtually identical) Specifications: • 100 CPS dot Apple PASCAL'. With lowest power consumption matrix printer • 80 column p rin t-136 characters 51/4” FLOPPY DISKS of only 2.5 watts. per line • Tractor/friction feed • 7 different print With hub rings.Box of 10. (List: $ 3 4 5 )...... $225 fonts included • 2K printer buffer • Proportional spacing • Bit image graphics and graphic symbols. With other purchase ...... $19.95 Without purchase ...... $23.00 SMARTERM EXPANDED CHARACTER SET NEC 8023 or C-ITOH...... $495 16K MEMORY EXPANSION MODULE 7" x 11” matrix with true decenders Add to above...... $40 NEC 8023 or C-ITOH 8510 with The preferred 16K RAM Expansion Module from Parallel Interface and C a b le ...... $550 PROMETHEUS. Fully compatible with CP/M' and „ , Combination SMARTERM and EPSON 100 with Parallel Interface Apple Pascal'. With full 1-year parts and labor Best Buy! EXPANDED CHARACTER SET and C able...... $749 warranty. (List: $169) ...... $75 Special a t ...... $260 VIDEX, VIDEOTERM...... $249 WORD PROCESSING SPECIAL VIDEX ENHANCER I I ...... $119 -80 CARD FOR YOUR APPLE WITH WORDSTAR AND SUPERCALC! MICROSOFT SOFTCARD Do professional word processing on your APPLE. CENTRONICS COMPATIBLE With CP/M' and MBASIC. All necessaro hardware and software included. Complete 80 column video display, enhanced W PARALLEL INTERFACE (List: $399) ...... $289 character set, 16K memory board, Z-Card with From PROMETHEUS. For use with Epson, NEC, BestBuy!!! CP/M' software, Wordstar and word processing C-ITOH, and other printers. Fully compatible with software and SuperCALC. CP/M* and Apple Pascal*. m ' ADVANCED LOGIC SYSTEM (List: $1,128)___ Special at $695 PRT-1, O ly ...... $69 Z-CARD W ithC-PM- Has everything the Softcard has except MBASIC. GRAPH ITTI CARD Works with Microsoft’s disks too. from Prometheus! Expa nda RAM Prints HIRES page 1 or 2 from onboard firmware. Features: True 1:1 aspect ratio, prints emphasized (List $ 2 6 9 )...... Special at $195 The only 128K RAM card that lets you start with 16K, 32K, or 64K of memory now and expand to mode, reverse mode, rotates 90 degrees.. . plus more. Compare all this with the Grappler. We think ALS SYNERGIZER the full 128K later. Fully compatible with Apple Pascal, CP/M-, and Visacalc. No Apple modifi­ you’ll agree that this is the best graphics card on CP/M- operating package with an 80 column cation required. Memory management system in­ the market. Specify for use with EPSON, NEC- video board, CP/M' interface, and 16K memory cluded with all ExpandaRAMs. Disk emulators 8023, C-ITOH Prowriter, orOkidata. expansion for Apple II. Permits use of the full included with 64K and 128K versions. (List: $125) range of CP/M- software on Apple II. Includes ...... $89 SuperCALC. MEM-32 Two rows of 16K RAMS (List: $749) ...... $549 make a 32K RAM C ard...... $209 SOFTWARE MEM-64 One row of 64K RAM. WORDSTAR...... Special at $195 U-Z-80 PROCESSOR BOARD With DOS 3.3 disk em u la to r...... $299 SPELLSTAR ...... $125 (From Europe) MEM-128 Two rows of 64K RAMS installed SUPERCALC...... $175 Software compatible with Softcard and make a 128K Card. D BASE I I ...... $525 ALS Software ...... $149 With DOS 3.3 disk emulator...... $399 VISICALC...... $149 MEM-RKT 64K RAM Add-On-Kits- DB MASTER ...... $189 MICROSOFT + PREMIUM SYSTEM 64K Dynamic RAMS. Each...... $125 Includes Videx Videoterm, Softswitch, Microsoft VISICALC Expansion Program All equipment shipped factory fresh. Manufacturers' warranties and Softcard, Microsoft and Z-80 Card, and for M E M -1 2 8 ...... $75 included. Please add $3.00 Der product for shipping and handling. Osborn CP/M' M anual ...... 5 5 9 5 MEM-PSL Pascal disk emulator for California, add 6% tax; BARt Counties: 6V2%. M E M -12 8 ...... $45 All items are normally in stock

\ JOYSTICK MODEMS FOR YOUR APPLE II Phone far Quick HAYES Smartmodem...... $229 1 ——« Takes the place of two MICROMODEM I I ...... $279 Shipment! Apple Paddle Controllers. From BMP Enterprises. Heavy duty industrial con­ [415) 490-3420 struction and cable. Non-self centering. With ... And we’ll be here to help after you polarity switches for consistent motion control. receive your order. Feel free to call the SGC (List: $59) ...... $39 Technical Staff for assistance.

MONITORS FOR YOUR APPLE VERSAcard FROM PROMETHEUS AMDEK300G Four cards on one! With true simultaneous opera­ tion. Includes: (1) Serial Input/Output Interface, (18MHZ Anti-Glare Screen) ...... $179 (2) Parallel Output Interface, (3) Precision Clock/ NEC 12” HIRES GREEN...... $179 Calendar, and (4) BSR Control. All on one card. Fully compatible with CP/M' and Apple Pascal'. sThe m ail e order specialists e SUPER SPECIAL! SPECIAL 12" GREEN MONITOR ...... $99 (List: $249) ...... $169 342 Quartz Circle, Livermore, CA 94550

4 MICRO - The 6502/6809 Journal No. 55 - December 1982 NO. 55 DECEMBER 1982

/ A l C f t O ______THE 65 0 2/6 8 0 9 JOURNAL STAFF COMMODORE FEATURE President/Editor-in-Chief ROBERT M. TRIPP It’s All Relative — CBM Disk Techniques, Publisher 37 Part 1...... James Strasma MARY GRACE SMITH Get the most from CBM’s powerful disk operating system Editorial Staff A n Squeeze for PET Programs ...... Hans Hoogstraat PHIL DALEY — Technical editor Squeeze out imbedded blanks, line separators, and comments JOHN HEDDERMAN — Jr. programmer MARJORIE MORSE — Editor BASIC Line Delete for PET/CBM and VIC...... Thomas Henry JOAN WITHAM — Editorial assistant 47 LOREN WRIGHT — Technical editor A machine-language program to delete blocks of BASIC lines Graphics Department SOUP: A CBM Machine-Language HELEN BETZ — Director Oc. Compare Program ...... Henry Troup and James Strasma PAULA M. KRAMER — Production mgr. A compare program for machine-language program files EMMALYN H. BENTLEY — Typesetter Sales and Marketing Microcomputers in a College Teaching Laboratory, CATHI BLAND — Advertising mgr. Part 2...... Richard Heist, Thor Olsen, and Howard Saltsburg CAROL A. STARK — Circulation mgr. 59 LINDA HENSDILL — Dealer sales Analog transducers in a digital world MAUREEN DUBE — Promotion Accounting Department BASIC AIDS DONNA M. TRIPP — Comptroller KAY COLLINS — Bookkeeper -j o APPLE ILISZT for Integer BASIC Programs . . . Leonard Anderson EILEEN ENOS — Bookkeeper * & Print your program in a clear, structured format and detect embedded binary code

Contributing Editors BASIC Macro Function for Cursor Control CORNELIS BONGERS 19 On the OSI...... Kerry Lourash DAVE MALMBERG Insert statements with just two keys JOHN STEINER JIM STRASMA o o ATARI Character Graphics from BASIC, Part 3 . . . Paul Swanson PAUL SWANSON RICHARD VILE Add to ATARI’S vertical blank interrupt routines

Subscription/Dealer inquiries nio APPLESOFT GOTO/GOSUB Checking Routine . Peter j.g . M eyer (617) 256-5515 Verify all GOTO and GOSUB references in your program

HARDWARE DEPARTMENTS e Adding Voice to a Computer ...... M ichael e. Valdez 3 December Highlights V** A low-cost procedure for sampling and reproducing voice 7 Editorial 9 Letterbox Enhanced Video for OSI C1P ...... David Cantrell and Terry Terrence 30 CoCo Bits 74 Add five chips — and several features 32 From Here to ATARI 35 MICRO News Home Control Interface for C1P ...... John Krout 54 PET Vet 77 Add your own ultrasonic control 65 APPLE Slices David A. Hayes 91 Updates/Microbes ATARI Meets the BSR X-10...... 82 Use ATARI'S controller ports 97 Short Subjects 99 New Publications o c 68000 Logic Instructions...... Joe Hootman 100 Reviews in Brief Our discussion of the 68000 instruction set continues 103 Software Catalog 107 Hardware Catalog QQ Programmable Character Generator for OSI Colin Macauley 108 6809 Bibliography Design your own character set 109 Data Sheet 111 Advertiser’s Index g o Utilizing the 6502’s Undefined 112 Next Month in MICRO Operation Codes ...... Curtis Nelson, Richard Villarreal, and Rod Heisler Hardware to use these op codes for new pseudo-instructions

No. 55 - December 1982 MICRO - The 6502/6809 Journal 5 L c o Computer Marketing & Consultants TO ORDER TOLL FREE 800-233-8760 CALL US In PA 1-71 7-398-4079

December 810 Disk Drive ... $429.00 ATARI 32K RAM ...... $ 79.00 SPECIALS 40032KRAM ...$349.00 80048K... $609.00 ATARI PERCOM : In Stock ATARI HARDWARE A WSmer Communications Company Single Drive ...... CALL Dual D riv e ...... CALL 410 Cassette Recorder ...... $75.00 (Read alt Atari Diaka) 825 Printer ...... - $585.00 THIRD PARTY SOFTWARE 830 Phone Modem ...... $149.00 for atari 800 or 400 850 In te rfa c e ...... $164.00 KBYTE PRINTERS : In Stock PACKAGES KRAZY SHOOTOUT...... $35.00 Epson Mx 80 ...... *449.00 CX481 E n te rta in e r ...... $69.00 K DOS...... $65.00 Epson Mx 80 FT I I I ...... *499.00 CX482 Educator ...... $ 1 2 5 .0 0 K-STAR PATROL...... $37.75 Okidata 82A ...... *479.00 CX483 Programmer ...... $49.00K RAZY ANTICS...... $37 75 Okidata 83A ...... *719.00 CX494 Communicator ...... $325.00K RAZY KRITTERS...... $37.75 Okidata 84 ...... *1089.00 Q-BALL JOYSTICK K IT...... $6.75 Cltoh ...... CALL SOFTWARE CXL4012 MISSILE COMMAND...... $28.75 Prowriter I ...... *4 9 9.00 AUTOMATIED SIMULATIONS CXL4013 ASTEROID...... $28.75 Prowriter II ...... CALL Star W arrior ...... $28.00 CXL4020 CENTIPEDE...... $32.75 SMITH CORONA TP-1 ...... *6 2 5.00 Crush. Crumble A Chomp ...... $23.00 CXL4022 PACMAN...... $32.75 NEC ...... CALL CXL4011 STAR RAIDER...... $34.75 WE CARRY MANY OTHER THIRD PARTY PRODUCTS (Interfacing Available) CXL4004 BASKETBALL...... $26.75 YOU CAN CALL FOR PRICES ON AND ASK FOR CXL4006 SUPER BREAKOUT...... $28.75 YOUR FREE ATARI PRODUCT CATALOG. CXL4008 SPACE INVADER ...... $28.75 JOYSTICKS : In Stock CX8130 CAVERNS OF MARS ...... $31.75 CX4106 HANGMAN...... $12.75 Atari CX-40...... *18.00 CX4102 KINGDOM...... $12.75 Q commodore L e S tic k ...... *34.00 CX4112 STATES 4 CAPITALS...... $12.75 Wlco Command Control ...... *24.00 CX4114 EUROPEAN COUNTRIES .$12.75 VIC-20 ...... $189.00 WICO RED BALL ...... *27.95 CX4109 GRAPHIT...... $16.75 STICK STAND ...... * 6.75 VIC1530 DATASSETTE ...... $67.00 CX4121 ENERGY CZAR...... $12.75 VIC1 540 DISK DRIVE ...... $499.00 CX4123 SCRAM...... $19.75 VIC1515 PRINTER ...... $355.00 CX4101 PROGRAMMING!...... $19.75 Computer Covers VIC1210 3K RAM ...... $35.00 CX4106 PROGRAMMING II ...... $22.75 VIC1110 8K RAM ...... $52.00 CX4117 PROGRAMMING III 800 ...... *6.99 ...... $22.75 VIC1211ASUPER EXPANDER ...... $53.00 CXL4015 TELE LINK...... $21.75 400 ...... *6.99 VIC-20 SOFTWARE ®10 ...... *6.99 CX4119 FRENCH...... $39.75 VIC1212 PROGRAMMER AID ...... $45 00 CX4118 GERMAN ...... $39.75 VIC1213 VICMON ...... $45.00 CX4120 SPANISH...... $39.75 VIC1906 SUPER ALIEN ...... $23 -00 DISKETTES : In Stock CX4120 SPANISH...... $39.75 VIC1914 ADVENTURE CXL4007 MUSIC COMPOSER...... $33.75 Maxell MD1 ...(1 0 ) ...... *34 .00 LAND ADVENTURE...... $35-00 CXL4002 ATARI BASIC...... $45.75 Maxell M02 - ■ .(1 0 ) ...... $44.00 VIC191 5 PRIVATE COVE CX8128 MICROSOFT BASIC ...... $65.75 E lep h a nt. . .(10) ...... $21.00 ADVENTURE...... $35-00 CXL4003 ASSEMBLER EDITOR...... $45.75 VIC1916 MISSION IMPOSSIBLE ...... $35-00 I CX8126 MACROASSEMBLER ...... $69.75 VIC1917 THE COUNT ADVENTURE .... $35.00 | CXL4018 PILOT HOME...... $65.75 THIRD PARTY SOFTWARE VIC1919 SARGON II CHESS ...... $35 00 CX405 PILOT EDUCATOR...... $99.75 ATARI PROGRAM EXCHANGE THIRD PARTY SOFTWARE CX415 HOME FILING MANAGER $41.75 ALIEN BLITZ ...... $21.00 Eastern Front 1941 ...... $25.50 CX414 BOOKEEPER...... $119.75 Omega Race ...... $35.00 Avalsnche ...... $15.50 NEW RELEASES ...... $32.00 Outlaw/Howitzer ...... $1 5 .5 0 16K RAM/ROM...... $99.00 OogOaze ...... $15.50 CHOP LIFTER...... $27.75 AMOK ...... $21.00 Wizard of W ar ...... $3 1 .00 APPLE PANIC...... $23.75 SUPER HANGMAN ...... $16.00 Gorf ...... $31.00 PREPPIE...... $19.95 SPIDERS OF MARS ...... $45.00 Frogger ...... $26.00 BUSINESS SOFTWARE : In Stock TO ORDER Atari Word Processing ...... $109.00 Letter P e rfe c t...... $129.00 POLICY CALL TOLL FREE Test Wlzzard ...... $ 89.00 800-233-8760 Datasam/65 ...... $1 25.00 [ In-Stock items shipped within 24 hours of order* | In PA 1-717-398-4079 Interlisp ...... $125.00 Personal checks require four weeks clearance or send order to Monkey Wrench ...... $ 4 2 .00 | before shipping . PA residents add sales tax. Lyco Computer Utility Disk ...... % 36.50 All products subject to availability and price P.O. Box 5088 Ultimate Renumber ...... $ 15.50 | change. Add 4 % for Mastercard and Visa. Jersey Shore, PA 17740 clutter up the magazine with informa­ About the Cover tion you already have — you've learned a lot over the last few years and we want to help you build on that knowl­ edge. You've matured, the market has 100 /AlCftO matured, and MICRO is growing along 200^u J Li y 0 u !’J o t i. with you. The system-specific maga­ 300 Fe 1 ic Pa scu a s Editorial 400 Buon Natale zines are a great place to get hints, cor­ 500 Happy Holiday's Getting to Know You rections, fixes, and details about your "It's more useful than my Swiss army own equipment — the kind of material knife.” Now that's what we like to it made sense for us to publish back in hear about MICRO and that's what one 1977 when no one else coverd the 6502. of you said in response to our reader But now that manufacturers are doing a survey. But we did the survey for more better job of providing documentation than a pat on the back. and there are lots of publications for We did the survey to find out just as beginners, we want to concentrate on more advanced issues that cut across This month MICRO is taking a holiday much as we can about who you are and what kind of information, both in machine and processor lines, that keep from presenting a graphic with a you abreast of new developments and computer theme on our cover. Instead, editorial content and advertising, you need and want. stretch your knowledge into new areas. we want to offer our warmest greetings MICRO'S editorial schedule for the — in five languages. The colorful lights We discovered that you are an ex­ tremely well-educated, affluent, gain­ next year reflects that concern. This is in the picture belong to the city of the last system-specific feature we'll be Frankfurt, Germany and symbolize the fully employed bunch of people with a great deal of technical computer running. Upcoming issues will feature festive glow of the holiday season. various kinds of peripherals, languages, Froliche Weinachten! knowledge at your command — and you want more. operating systems, communications. With your strong engineering back­ Cover photo by Phil Daley 33% of you have advanced degrees 70% have incomes over $25,000 ground you'll want to know what new 60% are programmer/analysts, en­ processors are being developed and how gineers, or technicians, and they can be used even before they're 90% of you have intermediate to ad­ available in complete systems. There vanced knowledge of software and are new programming languages being 80% of hardware. developed — we will look at what they No wonder only 6% of our readers are, which ones are worth pursuing for consider MICRO too technical. Your what purposes, etc. We will provide in­ biggest beef? Not enough information formation in the form of data sheets on your own system — whatever that and information sheets on a variety of may be. Too much Apple, not enough products and issues. And most in­ AlCftO is published monthly by: Apple, not enough Atari, not enough teresting of all we will explore new MICRO INK, Chelmsford, MA 01824 OSI. Now we know that that is going to modes of computer use: e.g., networks, Second Class postage paid at: communications, automated offices, Chelmsford, MA 01824 and additional be something of a problem in a publica­ mailing offices tion that covers more than one system, and industrial control systems. USPS Publication Number: 483470 or more than one chip, but we think We think that advanced computer ISSN: 0271-9002 it's important to cross-fertilize, to expertise is best imparted in a journal generalize, to bring you knowledge and that doesn't limit itself to one system Send subscriptions, change of address, USPS information that is transferable. Our or one chip or one operating system. Form 3579, requests for back issues and all goal is to make at least half of the After all, the whole industry is moving other fulfillment questions to magazine non-system specific, while toward compatibility and we think that MICRO INK is a step in the right direction. In light 34 Chelmsford Street dividing the other half in much the way P.O. Box 6502 our readers are divided — about half of that fact, and as a result of all we’ve Chelmsford, MA 01824 Apple and the other half heavily learned about you and your interests or call weighted toward OSI, Commodore, from the survey, as of next month (i.e., 617/256-5515 with the January 1983 issue), we will Telex: 955329 TLX SRVC Atari, and 6809 systems. Interest in the 800-227-1617 6809 and 68000 remains high, especially change MICRO'S subtitle to "Advancing among users who are adding boards and Computer Knowledge." We are in no processors to 6502 machines. way abandoning the 6502 or the 6809 Subscription Rates Pei Yeai A great many of you (62%) use more or any of the specific systems we've U.S. $24.00 been covering. We are, instead, making 2 yr. / $42.00 than one kind of system and 46% have a statement about your technical exper­ Foreign surface mail $27.00 systems both at home and at work; tise, your maturity and the industry's, Air mail: nearly all of you plan to spend money Europe $42.00 adding more equipment during the and our desire to move toward ever in­ Mexico, Central America, coming year. We trust that the reviews, creasing compatibility and wider pro­ Middle East, North Africa, hardware and software catalogs, and liferation of advanced information and Central Africa $48.00 knowledge. You — the sophisticated South America, South Africa, advertisements are helping you make Far East, Australasia, those purchases. user — need your own publication; we New Zealand $72.00 There is a great proliferation of hope it's MICRO. ^ system-specific publications and more Copyright© 1982 by MICRO INK All Rights Reserved and more information for the beginning computer user. We are trying not to

No. 55 - December 1982 MICRO - The 6502/6809 Journal I 10 1 I

FOR PRINTER VALUE THAT’S OUT OF THIS WORLD

Over thirty years of down-to-earth experi­ feature is a 2.3K buffer. An additional 4K ence as a precision parts manufacturer has is optional. That’s twice the memory of lead­ enabled Star to produce the Gemini series ing, comparable printers. And Gemini is of dot matrix printers—a stellar combina­ compatible with most software packages tion of printer quality, flexibility, and reliabil­ that support the leading printers. ity. And for a list price of nearly 25% less Gemini reliability is more than just a than the best selling competitor. promise. It’s as concrete as a 180 day war­ The Gemini 10 has a 10" carriage and ranty (90 days for ribbon and print head), a the Gemini 15 a 15!/2" carriage. Plus, the mean time between failure rate of 5 million Gemini 15 has the added capability of a bot­ lines, a print head life of over 100 million tom paper feed. In both models, Gemini characters, and a 100% duty cycle that quality means a print speed of 100 cps, high- allows the Gemini to print continuously. resolution bit image and block graphics, Plus, prompt, nationwide service is readily and extra fast forms feed. available. Gemini’s flexibility is embodied in So if you’re looking for an incredibly its diverse specialized printing ■ | a high-quality, low-cost printer capabilities such as super/ f " " * I k k I that’s out of this world, look sub script, underlining, back- I W " i ■ I to the manufacturer with its spacing, double strike mode I I I feet on the ground—Star and and emphasized print mode. An- IBB-j the Gemini 10, Gemini 15 dot other extraordinary standard mm ic i c roro n n ii c s • i n c matrix printers. MAKING A NAME FOR OURSELVES 1120 Empire Central Place, Suite 216, Dallas, TX 75247 For more information, please call Bob Hazzard, Vice President, at (214) 631-8560. /AICRO Letterbox

Back and FORTH comments on page 68 regarding how by the author, Timothy Stryker, which hard it was to come up with a FORTH require rebuttal. Dear Editor: implementation, show a decided lack Mr. Stryker states that program I was quite pleased with the two of understanding of structured pro­ modules in RPL do not execute directly articles on FORTH in the June issue of gramming! Listing 3A shows the same but rather place their address on the MICRO. Regarding the benchmark lack of structure that can be no way stack where a second call operator (&J comparisons of BASIC, FORTH, and blamed on BASIC itself. After ana­ actually executes this address. As cor­ RPL (page 63], I would have to say that lyzing what the program is supposed to rectly noted, this is in contrast to Mr. Stryker is apparently somewhat do, the following structured code FORTH where the defined word directly biased in his viewpoint, since he is the would have been much clearer: executes; it does not need a second ex­ father of RPL. What he appears to have ecute operator. This allows all FORTH done is take perfectly readable FQRTH 1010 DC = 20:FOR Z = 20 TO 255 definitions to be treated as and translate it into hieroglyphics. 1020 DC = DC — Z syntactically equal. Programmers may Surely, the FORTH word DUP is more 1030 IF DC > = 0THEN 1020 freely mix FORTH language words meaningful as a stack operator than 1040 POKE 59464,Z with their own new definitions — in­ and who would ever guess what 1050 DC = DC+ 256 deed, there is no difference in the inter­ and " % ” have to do with 1060 NEXT nal dictionary structure between these anything? Single-character words are 1070 POKE 59467,0.’POKE two parts. very useful for lazy typists, but they do 59466,0:RETURN On the other hand, RPL forces us to tend to produce "w rite-only" code for use (&) for execution of all new words those who need to determine what a The same code written in FORTH while pre-existing ones are immune to program is doing. looks like this: this rule and execute directly, creating Every FORTH implementation I an inconsistent syntax. That this is have ever seen has a machine-language : TONE 0 59464 C! 16 59467 C! memory efficient is doubtful. The primitive to handle block moves on a 170 59466 C! 20 256 OVER DO higher level definitions of any non­ character basis. Why do we go through BEGIN I - DUP 0 < trivial application program can consist the gyrations of listing IB when the UNTIL of a large proportion of user-defined word CMOVE would do just as well I 59464 C! 256 + operators, each one of which would re­ (actually better!)? Even without using LOOP DROP 0 59466 ! ; quire the addition of this execute CMOVE, the word BLKM would ex­ operator in RPL. This probably con­ ecute faster and with fewer FORTH Notice that we use 0 59466 ! to reset sumes some memory in the compiled words if it were written: both 59466 and 59467 to zero, since form and it certainly and unnecessarily FORTH inherently works with 16-bit clutters up the source code. With : BLKM OVER + SWAP numbers and uses 8-bit numbers only FORTH, the address of any definition DO DUP C@ I C! 1 + occasionally. I would probably do the can be placed on the stack with LOOP DROP ; same thing at the beginning of TONE an additional operator when it is to set up 59466 and 59467 initially, desired, although this function is This word expects a slightly dif­ assuming this is a PIA register address seldom needed. ferent order of things to be on the stack of some sort. At any rate, the structure It is true that FORTH handles sym­ than originally specified: FROM TO is there and can also be used in the RPL bols differently depending on whether and COUNT (634 826 150 using his version, I'm sure. they are variables, constants, or ex­ numbers). This is the same order that ecuting subroutine names. This is part CMOVE would expect them also. I am Edward B. Beach of the beauty of the language, not a sure that this arrangement would be of 5112 Williamsburg Blvd. weakness. Each type of has a benefit for RPL as well. Arlington, VA 22207 different function. Subroutine names Regarding the SHUFFLER bench­ execute, constants leave their value on mark; first of all, it appears there is a the stack, and variables leave their ad­ typographical error of omission in line Dear Editor: dress so we can suffix them with load 8 of listing 2B, since the word MOD In "BASIC, FORTH, and RPL" or store operators. Nothing could be referred to in the text is not there. Even (MICRO 49:63), three different com­ simpler or more efficient: uniformity of so, however, the way the routine was puter languages are compared in terms function by means of inconsistent in­ implemented can do nothing but slow of speed and memory economy using ternal operation. RPL reverses this, it down. three benchmark programs. However, giving us consistent internal operation Finally, regarding the Falling-Tone within the text of the article there were while forsaking clarity of function at benchmark, I certainly feel the author's some comments made about FORTH the programmer's level. This forces us

No. 55 - December 1982 MICRO - The 6502/6809 Journal 9 Letterbox (continued) Some additional points: The mod­ favor of RPL. In fact, precisely because ulo primitive in the fig-FORTH 6502 I knew that this objection might be to be even more aware of what each model takes 1.2 milliseconds to ex­ raised, I bent over backward to give the definition does — something I would ecute. No random-number generator is benefit of every doubt to FORTH. This prefer to be left up to my compiler. defined by the Group, so the poor speed may not be immediately apparent in As Mr. Stryker correctly states, the of this word in Mr. Stryker's unnamed the article because I did not make a FORTH string literal print word (.") FORTH version was not optimized for point of saying so, but, for example, and the numeric print words never speed by whomever wrote it. wherever my measured execution leave their output string on the stack. Language experimentation and times varied slightly from one run to This is seldom needed and would comparison is certainly needed to fuel the next, I uniformly presented possibly slow down the system. the evolutionary process of computer FORTH's fastest time, and RPL's Besides, the stack may not be large technology. But it should best be done slowest; for another, I specifically ex­ enough to safely handle this, since on with the full understanding of each cluded from consideration any bench­ the 6502 the FORTH stack is placed in language involved. marks involving manipulation of page zero (shared with a few other character strings, stack-resident arrays, FORTH locations and probably some Raymond Weisling finite-state automata, and other opera­ used by the host computer for disk Jalan Citropuran No. 23 tions that RPL handles much more or terminal I/O). If we need to alter the Solo, Jawa Tengah naturally than FORTH. Further evi­ string in numeric conversion and print­ Indonesia dence of this concern will become ap­ ing, FORTH has some primitives avail­ parent below. able for inserting additional characters First I'll address Mr. Beach and his in the string. With a minor effort we Dear MICRO: comments on the use of single-character can add print using to an application Thanks very much for the chance to operator-tokens. I do agree that RPL program or make it a permanent part of respond to Mr. Beach and Mr. Weisling source must look like hieroglyphics to the FORTH we use each day. Other in regard to their letters concerning my a person versed in FORTH — but than the string literal defining word recent article. perhaps you remember what FORTH (.”), there are no other string operators First of all, I take exception to the (or any computer language) looked like defined in the FORTH standards, but contention in both of these letters that before you became fluent in it. Ex­ these are not difficult to add to such an I unjustly biased the benchmarks and perienced RPL users have as little dif­ easily extensible language. the conclusions drawn therefrom in ficulty reading RPL source as you do

OMNIFILE • full-featured file manager and report generator for home, busi­ ness, school, or scientific applications • user-definable file structures • powerful search and edit, including global change and delete • built-in statistical analysis • flexible tabular report and mailing label capabilities, complete with search/sort capabilities on any field OMNITREND • powerful multiple regression trend analysis tool for business or technical data • sophisticated least squares fitting algorithm — faster and more accurate than usual techniques • includes descriptive statistics and bivariate analysis • built-in data management and file editing • extensive built-in hi-res graphics to aid in data analysis

• Professional quality * Jnlocked diskettes • Apple II Requires Applesoft in ROM. 48tC,RAjyii, Apple III Requires Business Basic and Mnrinuirn<‘ Distributed by '' 1 Educational Computing System*] 106 Fairbanks Rd. Oak Ridge, TN 378?0.'*

Apple III ^ OMNICOMP • powerful data manipulation and numerical analysis system S74 95 • performs polynomial curve fitting, numerical interpolation, $74 95 numerical integration, numerical differentiation and statistical $64.95 calculations using entire data file or selected subsets 2995 $169.95 • extensive built-in hi-res graphics '* ‘$79 95 $99.95 • mathematical data transformations, plus averaging, smoothing, and lag/lead nrppmg, m TN add 4'/2% tax • data files interchangeable with OMNIPACK programs QMNI is a tradmark ofENDAC/lnc.

10 MICRO - The 6502/6809 Journal No. 55 - December 1982 Letterbox (continued) The new FORTH TONE routine yon equivalent program, had it been de­ exhibit takes only 3465 jiffies, and re­ signed in RPL to begin with. reading FORTH. The advantages of quires only 130 bytes of program space. Next, a discussion on symbol single-character operator-tokens are The corresponding RPL routine is: handling. The fact that RPL is more ef­ three: 1. as you acknowledge, they cut ficient has been demonstrated already. down on typing time; 2. they cut down TONE: 0 59464 POKE 16 59467 POKE That it is simpler may be difficult to on the physical size of the source, so 170 59466 POKE 20 256 ; FOR appreciate second-hand like this, but that more source can be fit into LOOP: FN - # 0 < IF RPL "gives us consistent internal oper­ memory at once when undertaking FN 59464 POKE 256 + ation" without forsaking "clarity of nontrivial applications; and 3. they THEN LOOP GOTO END function at the programmer's level.” speed up compilation by cutting down NEXT . 0 59466 ! RETURN The question of how aware the program­ on the operator-token search time. mer needs to be as to "what each defini­ Thank you for pointing out a better which requires 83 bytes of storage and tion does" has nothing to do with it. method of doing block moves in both executes in 3338 jiffies. The resulting The ability to manipulate character FORTH and RPL. In writing the bench­ merit ratio of 1.62 to 1 represents a con­ strings conveniently is fundamental to marks, I was primarily concerned about siderable improvement. You were right, most user-oriented software develop­ making sure that the FORTH and RPL incidentally, not to condense the ment. Indeed, your remark about the versions were as close to identical in leading POKEs of 59467 and 59466 into size and location of the FORTH stack approach as possible, so I missed seeing a single store — the order of the POKEs points up the fact that this is one area that the block move could be done into those 6522 VIA registers makes a in which FORTH's extensibility does it more efficiently in the way you sug­ big difference. little good. RPL locates both stacks in gest. You may be interested to know, page one: the parameter stack is the though, that the FORTH source you On to Mr. Weisling's letter. Pro­ hardware stack, and the return stack is show for this routine yields an execu­ grammers who are bothered by the an indexed sort of affair down below it. tion jiffy-count of 717, considerably in necessity of suffixing their subroutine Stack-resident strings up to 60 charac­ excess of the 591 given for FORTH in references with an in RPL ters long or so can be manipulated free­ the article. The reason? Your use of the are free to eliminate the space ly without fear of crashing the machine composite "1 + ” operator in the separating the two and thereby regard — and execution is brought to a con­ innermost loop. When the sequence the composite "SLTBRNAME&” as just trolled halt if the 64-word stack entry "1 + ” is substituted for this, the ex­ a one-keystroke-longer method of in­ limit is exceeded. ecution time falls to 584 jiffies. Spaces, voking the routine. You doubt that this And on your last point: under my as you note in your letter are important is memory efficient. Please find out for version of FORTH, a public-domain in FORTH — one might even say, alarm­ certain by way of the following pro­ version identifying itself simply as ingly so. They make no difference in cedure: take any nontrivial FORTH ap­ "fig-FORTH 1.0" (which, however, in­ RPL. Unfortunately, the use of even the plication program to which you have cludes such exotic facilities as double­ sped-up form of your block-move algo­ access and count up the number of precision and floating-point math, rithm does not change the standings. occurrences of (A) invocations of the IEEE-488 1/0, etc.), the following FORTH requires 84 program bytes to thirty or forty real low-level FORTH routine, as timed with an actual watch, do it in 584 jiffies, whereas the follow­ "prim itives" such as DUP, " = " , IF, takes 2 minutes and 40 seconds to ing RPL equivalent: DO, " @ " , and things of that nature execute: (including but not including BLKM: ; + 1 - % FOR # PEEK FN (B) references to literal numeric quan­ : TEST 30000 0 DO 6543 52 MOD DROP POKE 1 + NEXT. RETURN tities, whether CONSTANTS or not, it LOOP ; does not matter, which fall in the range requires only 52 bytes to do it in 508, a from 0 to 63; (CJ references to literal When the MOD is replaced with an­ “merit ratio11 of 1.85 to 1. numeric quantities greater than 63 but other DROP, it takes 14 seconds. I leave less than 32768, plus all references to you to draw your own conclusions. Now, there seems to be some con­ VARIABLES, CVARIABLEs, and what­ fusion in your letter regarding various not; (D) all references to literal Timothy Stryker aspects of the SHUFFLER benchmark. numeric quantities not covered under B Samurai Software To begin with, there are no typos any­ or C; and (E) all routine-invocations P.O. Box 2902 where in the article. The MOD routine (other than " :'') not covered under A. Pompano Beach, FL 33062 is, as stated, internal to the RND Be sure, if you count a routine- routine I used. This RND routine, invocation under E, that you also con­ JMCRO modeled after that available under sider the body of that routine part of the MMSFORTH, expects an integer passed program source. Now form the sum to it on the stack, and returns a random A + B + 2»C + 3*D + 3*E. This is a number in the range from 0 up to that rough approximation of the number of integer minus 1 — hence, the MOD. object program bytes that would be re­ Moving on to your comments re­ quired, were the program translated, Your opinions, comments, and garding the third benchmark: you are absolutely mechanically from FORTH criticisms can be aiied in MICRO too. right. There was no need for me to in­ into RPL. Multiply this by about 0.8 to Send m ail to Letterbox, MICRO, P.O. troduce unstructured code in this case. arrive at the memory size of the Box 6502, Chelmsford, MA 01824.

No. 55 - December 1982 MICRO - The 6502/6809 Journal 11 Lisa 59.95/79.95 Lisa Educational Pak 79.95/119.95 Alien Ambush 19.95/29.95 Bandits 19.95/29.95 Cannonball Blitz 24.95/34.95 County Fair 19.95/29.95 Cranston Manor 24.95/34.95 Cyclod 19.95/29.95 CHRISTMAS SEASON David’s Midnight Magic 24.95/34.95 Dosource 3.3 24.95/39.95 SPECIALS! Dueling Digits 19.95/29.95 Let ARK COMPUTING Make This Your Falcons 21.95/29.95 Best Christmas Ever! Firebird 21.95/29.95 Foosball 19.95/29.95 Horizon V 25.95/34.95 Super Fan II by R.H. Electronics 59.95/79.95 Genetic Drift 19.95/29.95 Kabul Spy 24.95/34.95 Applicard, a high performance Z-80 card Jelly Fish 19.95/29.95 with 64K Ram, complete with CP/M Lemmings 19.95/29.95 4 mhz 324.95/445.00 Labyrinth 19.95/29.95 6 mhz 395.00/595.00 Mouskattack 24.95/34.95 Outpost 19.95/29.95 Microsoft Z-80 card with CP/M and Red Alert 19.95/29.95 Microsoft Basic Pig Pen 24.95/34.95 2 mhz 269.95/395.00 Russki Duck 25.95/34.95 Microtek Parallel Printer Interface complete MinatOr 24.95/34.95 with centronic compatible connector Track Attack 19.95/29.95 64.95/79.95 Thief 17.95/29.95 Space Quarks 19.95/29.95 Lazer Lower Case +Plus with Character Snack Attack 19.95/29.95 Set +Plus 49.95/84.90 Swash Buckler 24.95/34.95 Lower Case +Plus alone 39.95/59.95 Gin Rummy 24.95/34.95 The Dictionary 69.95/99.95 Lazer Graphics +Plus 99.95/159.95 General Manager 99.95/149.95 Graphics +Plus and 4 Ft. Disk Cable 19.95/29.95 LowerCase +PIUS 134.95/219.90 Visicalc 179.95/250.00 Using 6502 Assembly Computer Stop 16K Ram Board 69.95/149.95 Language Book 14.95/19.95 Computer Stop Omnivision 80 Column board Kids and The Apple 129.95/295.00 Computer Book 15.95/19.95 Apple Panic 19.95/29.95 Videx Video-term with softswitch, inverse Kraft Joystick 49.95/69.95 character set and 80 column Visicalc preboot 295.00/450.00

Wizard BPO 16K buffered printer interface (expandable to 32 K) 134.95/179.95 Your Salvation In The Sea Of Wizard 80, 80 column board 195.00/295.00 Inflation. Lazer Pascal 29.9'5/39.95 714735-2250 Anix 1.0 34.95/49.95 P.O. Box 2025 Lazer Forth 44.95/59.95

D Tack 68000 board for the Apple II Corona, CA 91720 with 4K Ram 895.00

Lazer Model/32 (16032 board for the Apple II) CALL!

12 MICRO - The 6502/6809 Journal No. 55 - December 1982 APPLE I LISZT for Integer BASIC Programs

by Leonard Anderson

ILISZT prints an Integer BASIC Since Integer BASIC differs from Apple­ of 128 and 255. Token and character program in a clear, structured soft, a brief review of Integer structure values are opposite that of Applesoft. format with the ability to detect will help provide an Understanding of A major difference also exists in embedded or attached BINARY ILISZTER. handling numeric constants within In­ code. teger. Certain functions permit a Integer BASIC Source Code following numeric constant or variable Figure 1 shows one line number of name. Distinction of a numeric con­ ILISZT source code in Integer. The first byte stant is done by making the first byte requires: contains the number of bytes per line following an ASCII number [$B0 to with the next two bytes having the line $B9, not allowed as first letter of a Apple II with botli number in binary. End-of-line is variable) with the next two bytes con­ Integer and Applesoft signified by the end byte having a value taining the numeric constant in binary. Disk drive of one. Integer BASIC is located just below Printer Each entered line is immediately the highest free memory address. In­ checked for syntax. Line numbers are teger does not need the three-null end The purchase of several disks at the end limited to 32767 but may be modified of program marker required by Apple­ of 1981 added a number of Integer by utilities. Numeric constants are soft. Other details may be found in BASIC programs to my Apple II library. converted to binary on entry, an advan­ earlier publications.3' 4' 5 No listings were available and I decided tage for program execution time. to print all of them .1 Several had All function words are stored as An EXEC File for Glue embedded binary code, a condition that one-byte "tokens” in the range of zero If an Integer program exists in caused much "nonsense” display on to 127 decimal. Punctuation, arith­ memory, loading an Applesoft program both screen and printer. "LISZ T” was metic, and logical operators are also will not destroy the Integer source code. already up and running (MICRO tokens. Eight tokens are unused and Loading does change the Integer start-of- 48:371, so it seemed logical to modify three others are used only with key­ program pointer at $CB, $CA (203, 202). this Applesoft program to format In­ board entries. ASCII characters have Integer end-of-program, or HIMEM at teger listings. The ILISZT result kept the high bit set to use the decimal range $4D, $4C (77, 76) remains unchanged. the original format and added the abili­ ty to find exact binary code addresses. ILISZTER is the formatting and Figure 1: Source code structure on one line number in Integer printing program, run by EXEC file ILISZT. ILISZTER is Applesoft rather END-OF-LINE than Integer. While an Integer program LINE NUMBER MARKER might seem better, many Apple II (16-BIT BINARY) owners possess ROM or RAM cards for J language duality and ILISZTER seems 1 1 1 more compact in Applesoft due to BYTE LOW HIGH STATEMENT BYTES $01 COUNT string-handling capability. Another ad­ 1 ( 1 vantage is that ILISZTER can be re-run without disk operations or loss of In­ teger source code. ILISZTER retains the original features such as separation of con­ ^ n NF I INE Ml IMBER catenated statements, indenting, and remark highlighting. Multiple-iterator NEXT statement handling for restoring FOR-NEXT loop indents is an improve­ INCREASING ment. The added binary code deter­ MEMORY ADDRESS mination and restoration routine is useful for listing certain utilities.2

No. 55 - December 1982 MICRO - The 6502/6809 Journal 13 HIMEM will restore to the end of free ILISZTER memory on re-loading an Integer pro­ 0 = FEEK (77) * 256 + PEEK (76) - 1: HIMEM: PS: GOTO 82 gram; the mechanism is unknown but 1 REM "GETT BYTE" SUBROUTINE * confirmed through experiments. 2 P = P + 1 :B = PEEK (P ): RETURN 3 REM "blank : LINE PRBTT" SUBROUTINE * EXEC file ILISZT is executed after 4 D = 0 : GOSUB 6 : PRINT S $ : REIURN loading the Integer program to be 5 REM "TEST PAGE SUBROUTINE * 6 I C = L C + 1 : I F I C = < LP THEN RETURN : REM NOT A NEW PAGE listed. The first two POKEs in ILISZT 7 GOSUB 17:LC - 6:PC = PC + 1: PRINT S$: PF1IOT BBS;LB$; " " generator MAKE ILISZT will move the 8 REM A FORM-FEED FOR TOP OF NEXT PAGE; ALLOWS VARIATION TOR DIFFERENT P Integer HIMEM pointer into the RIOTERS. 9 FOR K = 1 TO 4 : PRINT S $ : NEXT LOMEM space at $4B, $4A (75, 74). 10 REM PRINT THE HEADER LOMEM also restores on Integer re­ 11 H$(4) = "Integer Page " + STR$ (PC): FOR K = 1 TO 4:E = IOT ((LL - LEN (H $(K ))) / 2) + 1 : PRINT M$; LEFTS (BB$,E) ;H$(K) : NEXT :K = FRE load. The last two POKEs move the ( 0 ) : PRIOT S $ : IF NOT D THEN REHURN start-of-program into the space nor­ 12 REM PUT LINE: NUMBER IN BRACKETTS AS A STATEMENT IDENTIFICATION ON NEXT PRINT PAGE mally used for Integer HIMEM. 13 N$ = STR$ ( VAL (N $)):K = LEN (N $): RIM N$ IS NOW WITHOUT SPACES; BR Running ILISZTER will automatic­ ACKET N$ AND ATTACH TO STATEMENT CHARACTERS ally switch over to Applesoft without 14 C$ = RIGHTS (( LEFTS (UBS,(6 - K)) + CHRS (91) + N$ + CHRS (93) + S $),8) + RIGfTTS (C$,( LEN (C$) - 8)):K = FRE (0): RETURN disturbing the new Integer start and 15 REM * * MX-80 STANDARD/ITALICS SUBROUTINES » » » end addresses. MAKE ILISZT can be 16 REM "GRAFTRAX" Oily. Single-character-set printers should DELETE the se calls throughout if not used for other print functions. deleted when EXEC text file ILISZT is 17 PRIOT CHR$ ( 2 7 ) " 5 " ; : RETURN : REM ESC-5 IS STANDARD SETT generated. 18 GOSUB 17: IF RF THEN PRINT CHRS (27)"4";: REM ESC-4 IS ITALICS SETT 19 RETURN Starting ILISZTER 20 REM OCNVERT SUBROUTINE * 21 AS = REM ENTER WITO 'L ' AS DECIMAL NUMBER, RETURN IN 'AS' The first line resets Applesoft high 22 FOR K = 1 TO 4:D = IOT (L / 16) :E = INT ( (L - (D * 1 6 )) + 1 ):L = D: memory to prevent string operations A? = MID$ (X SfE, 1). + AS: NEXT : REM PREFIX THE HEX NOTATION 23 AS = "$" + A$:K = FRE (0): RETURN from overwriting the Integer source. 24 REM BEGIN A NEW LINE NUMBER WITO TEST OF NUMBER OF BYTES IN LINE FRCM Token words are initialized at line 91. FIRST BYTE, THEN CONVERT BINARY LINE NUMBER TO DECIMAL Since quotes are tokens if not in a 25 GOSUB 2 : Iff P = > PE GOTO 123: REM POIOTER EQUAL TO OR BETfOND END OF IOTEEER PROGRAM remark, the DATA declaration uses an 26 LA = P:BC == B : IF B > 127 GOTO 114: REM BYTE OOUOT TOO LARGE, PROBABLE symbol with conversion via the IF ATTACHED BINARY 27 TN = TO + 1 : REM BUMP LINE NUMBERS, THEN MAKE LINE NUMBER STRING and CHR$(34) statement. 28 GOSUB 2:L = B: GOSUB 2:L = B * 256 + L:B = LEN ( STRS (L)):N$ = RIGHTS A token evaluation array is gener­ (( LEFTS (UBS, (7 - B )) + STR$ (L) + " " ) ,8 ) ated in V at line 96. The V array is used 29 RIM BEGIN STATEMENT LINE PARSING WITH FIRST-BYTE DECISION 30 D = 0 : GOSUB 2 : IF B = 93 AND NOT RF THEN GOSUB 4 : GOTO 3 4 : REM SEPA in line parsing to test unused tokens RATE REM-GROUPS BY BLANK LINES and tokens that may have following 31 IF B = 93 AND RF GOTO 34 32 IF RF THEN RF = 0 : GOSUB 4 numeric constants. Unused tokens 33 REM RE-ENTRY POINT FOR NEXT BYTE IN STATEMENT DECISION (V = 2) may be nulls or single spaces; 34 IF B < 128 GOTO 3 9 : REM BYTE IS A TOKEN 35 IF B = 255 TOEN B = 1 5 9 : REM RUBOUT ($FF) BECOMES UNDERLINE BETWEIN B spaces were written just in case the ARS binary-insert routine crashed. 36 B = B - 128: IF B < 32 THEN B = B + 64:G$ = GS + CHRS (124) + CHRS ( The choice of lower-case characters B) :B = 124: REM PUT CCNTROL CHARACTERS BETWEEN BARS 37 G$ = G$ + CHRS (B) : GOSUB 2 : GOTO 34 in token words is up to the user. 38 REM TOKENS Mixed-case token words give distinc­ 39 IF V(B) > 1 THEN G$ = GOTO 114: REM UNUSED TOKEN, PROBABLE BINARY tion from normal upper-case variables. PROGRAM ATTACHED SO GATHERING IS NULLED 40 IF B = 1 OR B = 3 THEN GS = GS + S$ : GOTO 57: REM FORCE A NEW PRIOT L Available utilities can edit upper-case INE ON E-O-L OR A DEUMITER; SPACE ATTACHED TO PREVENT PRIOT-L source code by adding hexadecimal $20 INE CRASH 41 IF B = 93 THEN TR = TR + 1:RF = 1:RS = 1: REM A "REM" to each desired lower-case letter.6 42 IF B = 37 AND PEEK (P + 1) = 85 THEN G$ = G$ + T$(B):CF = 1: GOTO 57 Initial display at line 98 is optional : REM FORCE A NEW LINE ON "TOEN" FOLLOWED BY "FOR", SET CONDITIONAL FLAG but it does indicate proper location and 43 IF B = 85 THEN FF = 1 : REM A "FOR" operation. The "DIFFERENT START 44 IF B < >8 9 GOTO 5 1 : REM SKIP AROUND A "NEXT" ADDRESS” prompt allows listing to 45FS=FS-1:PT = P+1: I F C F TOEN FS =* FS - 1 : REM DECREMENT "FOR" SP ACER CN "IF " FLAG SETT, BEGIN SCANNING AHEAD FOR 2 OR MORE ITERATORS begin after an embedded binary; binary 46 BT = PEEK (P T ): IFBT = 10RBT = 3 GOTO 4 9 : RIM NO OTOER ITERATOR addresses will appear in normal print­ 47 IF BT = 90 THEN FS = FS - 1 : RIM CCMMA FCUND, DECREMENT "FOR" SPACER 48PT = PT + 1:IFPT< =(IA + BC) GOTO 4 6 : RIM CHECK AGAIN FOR ANOTHER outs. ILISZTER can be RUN after any OOMA WITHLN LINE RESET or list completion without 49 IF FS < 0 THEN FS = 0 disturbing Integer source code. 50 REM GATHER TOKEN THEN TEST ETDR A FOLLOWING 3-BYTE NUMBER GROUP 51 GS = G$ + T $ (B ):L = B: GOSUB 2 : IF V(L) = 0 GOTO 3 4 : REM NO NUMBER SH3 Printer control in lines 107 to 110 UIX> FOLLOW should be set to your particular printer 52 IF B < 176 OR B > 185 GOTO 3 4 : REM THE $B0-$B9 FIRST-BYTE NOT THERE S O NO NUMBEK FOLLOWS. FALL-THROUGH IGNORES FIRST-BYTE AND DOES DECIM and interface. Subroutines at lines 17 AL STRING CONVERSION and 18 can be changed to other runtime 53 GOSUB 2:L = B: GOSUB 2:L = B * 256 + L:G$ = G$ + STR? (L) : GOSUB 2: GOTO control. Source code control characters 34 54 REM ADD EXTRA INDENT EACH SPLIT LINE, LIMITING ON "REM" STATEMENTS are converted to letters before output. 55 TS = TS - 1 :SF = 0:RS = RS + 1: IF RS > 2 THEN RS = 2 56 REM FIRST ENTRY TO PRINT-LINE BUILD, GET TOTAL INDENT SPACES PLUS SPL IT-POIOT LOW LIMIT 'E' Lines that Parse in the Right 57TS=TS+1:K=IM* (FS + RS) :E = K + 13: IF K > 0 TOEN GS = LEFTS ( A source code line parse begins at BB$,K) + G$

14 MICRO - The 6502/6809 Journal No. 55 - December 1982 (continued) 58 RIM BUILD TOTAL PRINT-LINE STRING line 25. Integer does not allow a byte 59 IF NOT D THEN C$ = N$ + G? count larger than 127. (The actual 60 IF D THEN C$ = LB$ + G$ 61 REM TEST FDR LONG LINE, SPLIT IF NECESSARY number is 255. The 127-byte limit [line 62 K = LEN (C$) - LL: IF K < 1 GOTO 7 4 : RIM NOT A SPLIT LINE 26) is for print-line reconstruction, 63 G$ = RIGHT? (C?,K):C? = LEFT? (C$,LL):SF = 1 usually longer than source-code line 64 RIM BEGIN SPLITTING WITH SEARCH FDR A SPACE 65 D = LL length.) A byte count that is too large 66 IF MID$ (C$,D,1) = S$ GOTO 72 will jump to the binary-insert routine 67 D = D - 1: IF D > E GOTO 66 68 D = LL: REM SPLIT NEXT AT ARITHMETIC OPERATOR OR OCMMA at line 114. Line numbers up to 65535 69 K = ASC ( MID$ (C?,D, 1)): IF K = 42 OR K = 43 OR K = 44 OR K = 45 OR will output whether they are actual K = 47 OR K = 124 GOTO 72 line numbers or a chance byte-pair in 70 D = D - 1: IF D > E GOTO 6 9 : RIM FALL-THROUGH IS NO SPLIT 71 GOTO 74: RIM NEXT LINE IS SPLITTING INSTRUCTION binary. A test of number magnitude 72 K = LL - D: IF K > 0 THIN G$ = RIGHT? (C$,K) + G$:C$ = LEFT? (C?,D) was included in an earlier version but 73 REM TEST PAGE LINE-OOUOT, INSERT SPACES AS REQUIRED, THIN PRINT 74 GOSUB 6:K = I£N (C$): IF SF = 0 OR K < 2 OR RF THEN 7 7 : REM FORGET M then disregarded due to the large ARKENG UNDERLINING ON "REM"S number of starting prompts. 75 IF MID$ (C?,K, 1) = S? THEN C$ = LEFT? (C$,(K - 1)) + CHR$ (95): RIM PUT A TRAILING UNDERLINE AT IAST SPACE AS A MARKER FOR THE LEFT-HAND Remark checking in lines 30 to 32 is STRING part of the blank-line separation for 76 IF I f f l (G?) > 2 AND LEFT$ (G$,l) = S? THEN G$ = CHR$ (95) + RIGHT? (G?, ( I£N (G?) - 1 )) : REM PUT A LEADING UNDERLINE AT FIRST SPACE OF REMs. Removing separation would RIGHT-HAND STRING AS A MARKER delete all but the "D = 0 " statement; D 77 GOSUB 17:K = UN (C$): PRINT M$; LEFT? (C$,8);: GOSUB 18: PRIOT RIGHT? must remain for line number printing. (C$,(K - 8)) :K = FRE (0): IF SF THEN D = 1 : GOTO 5 5 : RIM PRINT REST OF A SPLIT LINE Statements begin parsing in line 34. 78 RS = 0: IF FF THEN FS = FS+1:FF = 0 ASCn characters are restored for print­ 79 D = 0 :SF = 0:G $ = IF B = 1 GOTO 2 5 : RIM GET ANOTHER LINE NUMBER IF ing but control characters are upper­ E-O-L, ELSE FALL THROUGH AND GE7T ANOTHER STATEMENT 80 GOSUB 2:D = 1 : GOTO 34 case between vertical bars. Source code 81 RIM INITIALIZATION OF VARIABLES rubouts are included to fill out lines in 82 DIM T?(127) ,H?(4) ,V(127) 83 RIM INITIAL VARIABLE SETTING HAS AN 80-CHARACTER WIDE PRIOT LINE AND certain programs.2 82-LINE PAGE LfNSIH (MCLUDIN3 HEADER, EXCLUDING 'CONTINUED1 INDICAT Token parsing begins at line 39 with OR); CHANGE LL AND LP AS DESIRED FOR OTHER FOEMAT SIZE. a test for unused tokens. The added 84 PE = EEEK (75) * 256 + EEEK (74) - 1:P = PS: RIM PS = INTEGER PRCGRA M START ADDRESS MINUS CHE, PE = INTEGER PROGRAM STOP ADDRESS MINUS O space to the gather string at line 40 NE prevents a crash during a binary code 85 B = 0:LL = 80:LP = 82:IM = 4:TO = 0:TS = 0:TR = 0:S$ = " " :X$ = "01234 56789ABCDEF" :C? = "":G $ = :N$ = " “ :M$ = " " : I £ ? = " ":B B ? = test; a rare condition, but it was found in two listings. 86 REM 'T ? ' ARRAY STRING OCMSTAOTS FOR PRINTING TOKENS Three programs were found with a 87 DATA " "load 'V'Save ", " C o n ", "Run " , "R un","D el New”,"Clear" , "Auto "Man "/'Himem : ","Lanetn : ", "+", ,“/ FOR loop starting on an IF-true condi­ >= " , " > <= <> And Or Med tion. Line 42 solves indenting and " , " (11, " ,11, " Then " 88 DATA " Then ","(", "Peek" , "Rnd", "Sg n ", "Abs restoration on this rare case. Integer ","Pdl"," ","(", "Not ","("," = # ", "L en (" , "Asc( " , " S c m (" normally executes only one IF-true " ; " , " ; "Text", "Gr" , "Ca condition but, apparently, a FOR loop 11 ","Dim ","Dim ","Tab " will execute until completed. 89 DATA "End", "Input Input "/'Input " , "For T o Step " , "N ext "Return"," Gosub "," Gcflb ","If "/'Print ","Pri nt ", "Print", "Poke "/'/'/'Color = "/'Plot ",",","HLin At Two or More Iterators VLin " At ", "VTab '' The printout indent restoration of 90 DATA " = "/'List /'List","Pop"/'NoDsp "/'IfoDsp "/' ItoTrace", "Dsp ","Dsp " ,"Trace","Pr # ","In # " statements such as "NEXT J,K" is 91 FDR K = 0 TO 127: READ T$(K) : IF T$(K) = THIN T?(K) = CHR? (34): solved by the search routine in lines 45 REM ONE WAY TO GET A DOUBLE QUOTE INTO A STRING 92 NEXT to 49. Of several tokens, only 93 REM 'V ' ARRAY CONSTANTS FOR TOKEN TESTING decimal value 90 is the comma in a 94 DATA 2,0,2,0,0,0,0,1,0,1,1,0,0,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, multiple-variable NEXT statement. 1,2,1,1,1,0,0,0,0,0,1,2,2,1,0,0,0,0,0,2,1,1,1,1,1,0,0,0,0,1,1,1,0,2, 1,1,1,0,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,1,0,0,1,1,0,1,0 This search and find will restore global 95 DATA 1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,2,1,1,0,0,0,0,0,0,0,0,1,1 indenting of FOR loops. It can also be 96 FDR K = 0 TO 127: READ V(K): NEXT patched into the original LISZTER to 97 REM SCREEN PRCMPTS AND OPERATOR ALTERNATES solve an oversight.7 98 HCME : TEXT : VTAB 2 : HTAB 1 2 : INVERSE : PRIOT " ILISZTER ACTIVE " : NORMAL : VTAB 4 :L = PS + 1 : GOSUB 2 1 : PRIOT “START OF INTEGER PROGRAM: ";AS :L = PE: GOSUB 2 1 : PRIOT " END OF INTEGER PROGRAM: ";AS: REM OPTION Numbers Following You? AL TO CHECK APPROXIMATE ADDRESS LOCATION Some tokens allow following 99 PRIOT : INPUT "PROGRAM NAME: ";H?(1): INPUT " PROGRAfrMER: ";H$(2): INPUT CATE: ";H?(3): REM REQUIRED FOR HEADER ON EACH PAGE numeric constants. Integer BASIC flags 100 PRIOT : PRINT "WANT DIFFERENT START ADDRESS ? " : GET A?: IF AS < > “ a numeric constant with a $B0 to $B9 Y" GOTO 103 101 INPUT " START ADDRESS (HEX): ”;AS:D = 1:BT = 0: FDR K = LEN (A?) TO prefix (ASCII numbers 0 to 9). The test 1 STEP - 1 : FOR E = 1 TO 16: IF MID? (A$,K,1) = MID? (X?,E,1) THEN in lines 51 and 52 check for token and BT = D * (E - 1) + BT 102 NEXT E:D = D * 1 6 : NEXT K: PRIOT :P = BT - 1 :L = BT: GOSUB 21: PRINT prefix, ignoring the prefix if it exists. HEX ADDRESS = ";A$;" CHANCT: ? " : GET A?: IF A? = "Y" GOTO 101 Line 53 builds the numeric constant 103 PRIOT : PRIOT "NO LEFT MARGIN, WANT ONE ? " : GET A?: IF A? = "Y" THEN string and gathers it in G$. Flow must INRJT " MARGIN SPACES: ";K: IF K > 0 AND K < 49 THEN M? = LEFT? ( BB?, K ):L L = LL - K return to line 34 afterwards. The next 104 REM REMINDER FOR PRINTER SET-UP , (continued) byte can be either a token or a char-

No. 55 - December 1982 MICRO - The 6502/6809 Journal 15 acter; variable names are ASCII (continued) characters. 105 HCME : INVERSE : PRINT " SET PAPER TO TOP OF FORM " : PRINT " The Final Print Line THEN " : PRINT " TORN PRINTER " : NORMAL : PRINT Lines 55 to 80 form the output print : GET AS 106 REM SET SCREEN WIDTH, TORN ON PROPER PORT line, splitting and indenting as in the 107 HCME : POKE 33,30: PR# 1 original LISZTER. First-priority split is 108 REM CONTROL CHARACTERS FOR MX-80 WITH "GRAPPLER" CARD. CHRS(9)=CTRL still a space, but second-priority split - I , CHRS(27)=ESC 109 PRINT CHRS (9)"82N " CHRS (27)"0" CHRS (9)"I" has a added to line 69. Con­ 110 REM trol characters seem to be used more in 111 REM SET-UP TO START FIRST PRINT PAGE 112 IC = 6 : PC = 1 :D = 0 : GOSUB 11: GOTO 25 Integer. At this point they have been 113 REM POSSIBLE-BINARY INSEHT/ADDITION ROUTINE converted to upper-case letters between 114 RF = 1 : GOSUB 1 8 :L = LA: GOSUB 2 1 : GOSUB '5: PRINT MS;LBS;" >>> P ossib bars and will not upset printer control. le Binary from ";A$;" to "; 115 IF P > PE GOTO 121 The complex print statement group 116 IF B > 127 THEN GOSUB 2: GOTO 115: REM BYTE-COUNT TOO LARGE in line 77 is solely for the italics 117 PT = P + B -1 :B T = HEK (PT) : IF FT > PE GOTO 121 118 IF BT < > 1 OR B < 5 THEN GOSUB 2 : GOTO 115: REM NO E-O-L OR BYTE- capability of the Epson printer. A QOUNT TOO SMALL single-character-set printer can 119 IF IA = (P - 1) THEN GOSUB 2 : GOTO 115: REM ATOID REPETITION; SCMEH OW THE POINTER DIDN'T ADVANCE substitute a simple "PRINT M$; C$” 120 P = P - 1 :L = P: GOSUB 2 1 : PRINT AS:D = 0 :G$ = GOTO 2 5 : REM RETUR for both GOSUBs and PRINTs. N TO LINE-NUMBER START 121 L = PE: GOSUB 2 1 : PRINT AS 122 HEM ENDING ROUTINE Possible Binary? 123 QOSUB 4: GOSUB 17: PRINT MS;LBS;"End of Listing" An IF-true test at lines 26 or 39 in­ 124 REM OPTIONAL STATISTICS 125 GOSUB 4 : PRINT MS; "Program Length = ";(PE - PS);'' Bytes, Tbtal of " dicates something is wrong with the In­ ;TN;" L in e N unbers": GOSUB 4: PRINT M$;(TS - TR);" T b ta l Non-Rem Sta teger source code. More than likely it is tem ents, ";TR;" Tbtal Remarks" due to embedding binary code with in­ 126 REM TURN OFF PRINTER, RESET SCREEN AND SHOW COMPLETION teger. The routine at lines 114 to 120 127. PR# 0: POKE 33,40: HCME : VTAB 1 2 : HTAB .10: INVERSE : PRIOT " END ILISZTING NORMAL : END checks this condition. 128 REM "ILISZTER" program to re-format INTEGER BASIC listin g prints Variable LA is made np of the ad­ 129 REM by Leonard H. Anderson Version 2.8.8, 15 May 1982 dress of each new source line number 130 REM l c * e r c a se and i t a l i c s fo r MX--80 & "GRAFTRAX" 131 REM K>ss>ible-Bir\ary routines added to 2.8.1 (21 March 1982) start. That address is converted to hex­ 132 REM adecimal and printed with the "Possi­ 133 REM DESCRIPTION OF VARIABLES: 134 REM ble Binary From" indicator. A search 135 REM A$ TEMPORARY STRING, PARTLY FOR HEX CONVERSION now begins for any byte group meeting 136 REM B PROGRAM BYTE VALUE IN DECIMAL the following: the group is below 137 REM BB$ ■BIG BLANK1 STRING OF 48 SPACES 138 REM BC BYTE-COUNT CF A LINE, DECIMAL HIMEM, the group is less than 128 139 REM BT TEMPORARY PROGRAM BYTE VALUE IN DECIMAL bytes long, and the end-of-line byte 140 'REM CF "IF " FLAG: SETT ONLY ON "IF " FOLLOWED BY "FDR" 141 REM C$ CHARACTER AND TOKEN STRING TO BE PRINTED value is found from the first-byte ad­ 142 REM D TEMPORARY, PARTLY FOR ’ DIRECTION1 dress plus value. A successful search 143 REM E TEMPORARY, PARTLY FOR SPLIT-LINE LIMITS will print the byte group last address in 144 REM FF "FOR” FLAG: 1 = "FDR" STARTED, 0 = NO "FDR" 145 REM FS "EOR" INDENT SPACE COUNTER hex to complete the indicator, then 146 REM G$ 'GATHER1 STRING TO BUILD A STATEMENT return to line 25 for a new source line 147 REM H$ HEADER ARRAY FOR PRINT-PAGE TITLE' 148 REM IM INDENT SPACE MULTIPLIER number. 149 REM K TEMPORARY The indicator may be printed 150 REM L TEMPORARY, PARTLY FOR LOW-BYTE VALUE several times before a correct source 151 REM IA LINE NUMBER BEGINNING ADDRESS 152 REM IT LINE COUNTER FDR PAGINATION line is found. The number of prints will 153 REM LL LINE-IZNGTH CONSTANT be dependent on binary content but a 154 REM LB$ ’ LITTLE BLANK1 STRING OF 8 SPACES! 155 REM M$ IZFT MARGIN SPACING STRING correct Integer source line will always 156 REM N$ LINE NUMBER STRING follow embedded binary. 157 REM P POINTER TO PROGRAM BYTE, DECIMAL A possibility is a bit error in 158 REM PC PAGE COUNTER FDR PRINT-PAGE HEADER 159 REM PE INTEGER PROGRAM END ADDRESS, DECIMAL memory that can yield another possible 160 REM PS INTEGER PROGRAM START ADDRESS, DECIMAL binary print line. An advantage is that a 161 REM FT TEMPORARY POINTER TO PROGRAM BYTE:, DECIMAL 162 REM RF "REM" FLAG: 1 = "REM” STARTED, 0 = NO "REM" printout will show beginning and end­ 163 REM RS "REM" INDENT SPACE COUNTER ing addresses for closer examination. 164 REM SF SPLIT-LINE FLAG: SETT IF PRINT LINE MUST BE SPLIT An "attached” binary program will 165 REM S$ SINGLE-SPACE STRING 166 REN TO TOTAL LINE NUMBER COUNTER terminate at highest available memory. 167 REM TR TOTAL REMARKS COUNTER The possible binary last print will in­ 168 REM TS TOTAL STATEMENTS COUNTEIR dicate this as $95FF with standard DOS. 169 REM T$ TOKEN STRING ARRAY 170 REM V ARRAY FDR TOKEN EVALUATION: 171 REM 0 = NO BINARY NUMBER FOIXOWS TOKEN Alternatives 172 REM 1 = A 3-BYTE BINARY NUMBER FOIIOWS A purely Integer version of 173 REM 2 = UNUSED/INTERNAL, DO NOT PRINT 174 REM X$ HEX CHARACTER STRING FDR CONVERSIONS ILISZTER can be written by translation of the general structure. Page zero loca­ tions $69 through $6D can be used for

16 MICRO - The 6502/6809 Journal No. 55 - December 1 Make ILISZT 200 * TEXT FILE GENERATOR TOR "ILISZT" sound Program Library Exchange, 210 * VERSION 3.0, 16 APRIL 1982 IilA 1979.

220 D$ = "| D| " 5. What’s Where in the Apple!, 230 Print D$; "OPEN ILISZT" William F. Luebbert, MICRO INK. 240 P r in t D$; "WRITE ILISZT" For address locations only.

250 * MAKE INTEGER IXMEM POINTER HCSJ5 ENDING OF INTEGER PROGRAM 6. "The Inspector," Omega Micro­ ware, Inc., is one example of a disk 260 Print "P0KE74, H IX(76)" or memory byte-changer utility. 270 P r in t "POKE75, V E £ X ( 7 7 ) “ Although the author has upper-/ 280 * MAKE INTEGER HIMEM POINTER BOLD START OF INTEGER PROOWM lower-case conversion on the key­ 290 Print "POKE76,PEEX(202)" board, this utility was used to cor­ 300 Print ”POKE77,PEEK(203)" rect typos in ILISZTER’s DATA 310 Print "RUN ILISZTER" statements. 320 P rin t D$;"CLOSE" 330 End 7. "LISZT with Strings," Richard F. Searle, Don Cohen, Leonard H. Anderson, MICRO, May 1982, listing pointer re-arrangement as in the LISZT Exchange "public domain" disks 2 on page 41. The easiest patch is a predecessor. Total code will probably (members only). Printouts of 1057 GOSUB in line 45 just after the exceed the 4.5K bytes of a "REM-less” programs fill three large loose-leaf "CF = 1" statement; the subroutine ILISZTER in Applesoft. MAKE ILISZT notebooks; about a quarter are would look for a delimiter comma in can be either language; the created text Integer. ASCII, such as "B T = 4 4 ", to decre­ file will be the same. 2. "Higher T ext" by Ron and Darrell ment the FOR spacer. ILISZTER has successfully handled Aldrich, Call —A.P.P.L.E. version. a 23K Integer program printout plus One Integer program has two binary one program with two embedded embedments. You may contact Mr. Anderson at 10048 binary code sections. 3. Volume 1, MICRO on the Apple, Lanark St., Sun Valley, CA 91352. MICRO INK, pages 198-203. References 4. PEEKing at Call —A.P.P.L.E . , JMCftO 1. Apple Pugetsound Program Library Volume 2, pages 44-61, Apple Puget­

EVER WONDER HOW YOUR APPLE II WORKS? QUICKTRACE will show you! And it can show you WHY when it doesn’t!

This relocatable program traces and displays the actual machine operations, while it is running and without interfering with those operations. Look at these FEATURES:

8lngl*-8t*p mode displays the last instruction, QUICKTRACE allows changes to the stack, QUICKTRACE is relocatable to any free part of next instruction, registers, flags, stack contents, registers, stopping conditions, addresses to be memory. Its output can be sent to any slot or to and six user-definable memory locations. displayed, and output destinations for all this the screen. Traca mode gives a running display of the Single • information. All this can be done in Single-Step QUICKTRACE is completely compatible with Step information and can be made to stop upon mode while running. programs using Applesoft and Integer BASICs, encountering any of nine user-definable Two optional dlaptay lormata can show a sequence graphics, and DOS. (Time dependent DOS conditions. of operations at once. Usually, the information operations can be bypassed.) It will display the Background mode permits tracing with no display is given in four lines at the bottom of the screen. graphics; on the screen while QUICKTRACE is until it is desired. Debugged routines run at near QUICKTRACE is completely transparent to the alive. normal speed until one of the stopping cond­ program being traced. It will not interfere with QUICKTRACE is a beautiful way to show the itions is met, which causes the program to return the-stack, program, or I/O. incredibly complex sequence of operations that to Single-Step. a computer goes through in executing a program

P ric e : $ 5 0 QUICKTRACE requires 3548 ($EOO) bytes (14 pages) ot memory and some knowledge of machine language programming. QUICKTRACE was written by John Rogers. It will run on any Apple II or Apple II Plus computer andean be loaded from disk or tape, it is supplied on disk with DOS 3.3. Q U IC K T R A C E is a trade m ark o f A n th ro -D ig ita l. Inc. QUICKTRACE DEBUGGER

Last addnss Disassembly Last Instruction FrF 6 9 - A? A A LDA #$AA

Top seven bytes of stack Processor codag User defined location & Contents S ta c k 5T=:7C A: D5 43 D4 Cl NV-BDIZC 0000=4C

Accumulator X rag. Y rag. Stack pointer Processor status Content ol raferancad address Contents A—AA X—98 Y—25 SF-F2 PS=10110001 [ ] =DD Disassembly Reference address Anthro-Digital, Inc. Next Instruction F F 6 B - Bl STA $33 [$0033] P.O. Box 1385 F’ittsfield, MA 01202 413-448-8278

No. 55 - December 1982 MICRO - The 6502/6809 Journal 17 EXPANSION

Tired of trying to run your word processor or your DMB on an columns; handle 50 Hz European formats; accomodate custom OSI 64 character video screen? Now there's the SEB-3, THE characters or character cell sizes larger or smaller than 8x8 most versatile 80x24 video board anywhere is available for OSI and transparently access the screen to eliminate screen 48 pin BUSS systems. No longer will you have to consider con­ “ glitches''. In short, the SEB-3 will meet any demands your verting your video-based system to a serial terminal because system may place on it now and in the future. The SEB-3 also you’ve found 64 characters stifling for serious business use. supports an OSI-style floppy disk interface which can handle Nor need you give up compatibility with any existing graphics two 5" or 8" drives. Like all of the boards in the SEB series, software because the SEB-3 allows you to choose ANY screen the SEB-3 simply “ plugs in" to your machine — there are format up to 80x24 including 32x32 and 64x32. Since the absolutely NO hardware changes. The SEB-3 is designed to SEB-3's screen format can be changed at any time under soft­ replace your outmoded 540 board so you don’t even lose a ware control, even gaming displays can benefit from screens backplane slot. Your keyboard input now also plugs into custom tailored to the game itself. The SEB-3 is so the SEB-3 — load one of the software drivers and you’re well designed and so versatile that it will not need ready to go! to be replaced — ever. Simple changes in software and/or SEB-3 Assembled $259.00 Bare Board $59.00 hardware will allow the SEB-3 to: generate displays up to 256 Kit $220.00 Manual only $5.00

If your Challenger can't generate displays like those shown Installation of either board requires absolutely NO modification of above WHAT ARE YOU WAITING FOR? The SEB-1 High your computer—they just ‘plug-in’. Nor do they preclude your Resolution Graphics and Memory Board (for C1P and using any other OSI-compatible hardware or software. In addition Superboard II) and the SEB-2 High Resolution Graphics and to the Hi-Res Graphics the SEB-1 gives C1 & Superboard II users Disk Controller Board (for C2/4/8) simply ‘plug-in’ to your 16K of additional user memory (over and above that memory computer and give you instant access to over 49000 devoted to the graphics), two 16 bit timers/counters, an on-board individually addressable pixels in up to 8 colors! Your Hi-Res RF modulator, and a parallel port with handshaking. The SEB-2 screen can go from 32 x 16 alphanumerics to 256 x 192 point gives OSI 48-pin BUS users an OSI hardware/software graphics in 11 software selectable modes. The standard video compatible Disk controller, and an RF modulator that can be of your computer is left intact, so that none of your current user-populated. software library is outmoded. Use the graphics for Business, FOR OSI IP, 2-4P , 2 -8 P , C4P, C8P Scientific, Education, or Gaming displays that were impossible — until now! SEB-1 ______SEB-2 SEB-1 SEB-2 Assembled and Tested $249.00 (5K RAM) $239.00 (1K RAM) Bare Board & Manual $ 59.00 $ 59.00 Kit $165.00 (No RAM) $199.00 (No RAM) Manual only $ 5.00 $ 5.00

COMING: SEB-3 SO x24 VideolDisk C ontroller (C2I4I8), SEB-4 48K Memory RAMIROM (C2I4I8), SEBS 8K RAUIDisklSoundlClocklVoice (C1 4 Superboard).

Write for FREE catalog International Requests please SOFTWARE ASSOC. supply 2 International Response Coupons ORION P.O. BOX 310, OSSINING, NY 10562 914-762-5636

18 MICRO - The 6502/6809 Journal No. 55 - December 1982 BASIC Macro Function for Cursor Control

by Kerry Lourash

BASIC Macro is a machine- When designing Macro, I had plans at location $1E0F to JMP $0222 instead language program similar in for a sophisticated phrase storage area of JMP $1E12. function to the macro option of with variable-length storage space. Macro finds the BASIC line you some assemblers. It enables After I'd written the code to find and specify, prints it on the screen, and Cursor Control users to insert print the phrases, which was the lesser stores it in the input buffer. If the addi­ often-used statements with only half of the program, I found that I'd tion of the phrase makes the line too two keys when typing BASIC used over half a page of memory. This long, the 'BEL' character is printed. To programs. ERGO, a routine for approach was going to cost me well use BASIC lines 0-9 as storage space, it all C1P users, eliminates the over the page of memory I had allotted was necessary to teach Macro how to graphic character in error for program and storage space! So I let convert tokens to keywords, but the messages. BASIC keep track of the phrases. final program is still much shorter than To patch Macro into Cursor Con­ my first attempt. The WINDUP rou­ trol, change the input routine PATCH tine finds the buffer count in the stack, BASIC Macro and ERGO BASIC Macro Listing 10 oooo JBASIC MACRO FOR CC require: 20 0000 PATCH=$1E0F OSI C1P 30 0000 0K=$1F10 40 0222 *-$0222 50 0222 C912 MACRO CMP ** 1 2 > CTRL. R? As a C IP owner, I type in a lot of BASIC 60 0224 15061 BNE RESUME 70 0226 20101F JSR OK programs, mainly because neither OSI SPRINT WHITE BLOCK 80 0229 2000FD MAC JSR *FD00 iGET MACRO NUMBER nor independent vendors have the pro­ 90 022C C93A CMP **3 A iI F MOT A NUMBER grams I want. While I pounded my 100 022E B057 BCS RESUME iTHEN EXIT 110 0230 fingers to the bone and cursed my two­ C930 CMP * * 3 0 120 0232 9053 BCC RESUME fingered typing speed, I wished for a 130 0234 E930 SBC * * 3 0 »A S C II TO BINARY' utility similar to the macro function of 140 0236 8511 3TA *11 JL00K FOR LINE * 150 0238 some assemblers. After punching out A900 LDA *0 160 0 23A 3512 STA *12 ''GOSUB8000:GC)T0650" for the 20th 170 023C 2032A4 JSR *A432 time in a program, I was inspired to 180 023F 90E8 BCC MAC iTRY AGAIN write BASIC Macro. 190 0241 f 200 0241 A003 LliY *3 JTQ START OF LINE Macro is an extension of the Cursor 210 0243 CB FOUND I NY ,‘NEXT CHAR. Control program (MICRO 36:75). It 220 0244 8497 STY *97 iSAYE Y REGISTER lets you insert one of ten macros up to 230 0246 B1AA LDA ( $AA ) , Y rGET CHAR. 240 0248 F 035 BEG WINDUP iQUIT IF NULL 70 characters long in a BASIC line with 250 024A 3007 BMI TOKEN ! CONVERT IF TOKEN only two keystrokes (three, if you 260 024C A497 FNB LtlY *97 »RESTORE Y REGISTER count CTRL R as two keys). If a phrase 270 024E 206F02 JSR STORE 280 0251 B0F0 . BNE FOUND iBRANCH ALWAYS (such as GOSUB8000:GOT0650) oc­ 290 0253 curs frequently in a program you're typ­ 3 00 0253 38 TOKEN SEC fF IN B & CONVERT TOKEN ing, store it in a BASIC line 0-9 (1 310 0254 E97F SBC **7 F »TOKEN MINUS 7F 320 0256 AA TAX iTOKEN INDEX IN A REG G O SU B8000:G O T0650). Now, as you 330 0257 A0FF LDY **F F encounter that phrase, hit CTRL R. A 340 0259 CA TO HEX white block will appear. Type '1' and 350 025A F008 BEG T2 JFOUND TOKEN IN TABLE? the phrase will be printed on the screen 360 025C C8 T 1 INY ; n o , n e xt l e t t e r 370 025D B984A0 LDA *A 0 8 4 , Y and stored in the input buffer. Should 380 0260 10FA BPL T1 5L00P S. GET NEXT CHAR. you type a line number that doesn't 3 90 0262 30F5 BMI TO »LOOP TO NEXT TOKEN exist, Macro will wait for another 400 0264 C3 T2 INY 4 1 0 0265 B984A0 LDA *A 0 8 4 , Y iGET LETTER number. If you type a letter, Macro 420 0268 30E2 BMI FND ,‘ LAST LETTER OF TOKEN? assumes you've changed your mind 430 026A 206F02 JSR STORE about calling a macro, and exits. CTRL 4 40 026H C0F5 BNE T2 450 026F f R stands for repeat. 460 026F A60E STORE LDX tOE »STORE CHAR. IN BUFFER

No. 55 - December 1982 MICRO - The 6502/6809 Journal 19 where it was stored at the start of the BASIC Macro Listing (Continued) INPUT routine (the X register). Loca­ 470 0271 E047 CF'X *$ 4 7 tion $0E, the screen character counter, 480 0273 BOOS BCS ST0+1 490 0275 297F AND ♦$7F .ZERO HI BIT is loaded into the stack to update the 500 0277 9513 STA $ 1 3 ,X buffer count. 5 10 027? 2CA907 ST0 BIT $07 A 9 ; b e l c h a r , i f :>71 For those unfortunates who have 520 027C 4CE5A8 JMP $A8E5 5PRINT CHAR. 530 027F r not been converted to Cursor Control, I 540 027F BA UINDUF' TSX ?UPDATE BUFFER COUNT whipped up a short patch to the stock 550 0280 A50E LDA $0E .‘LINE COUNT IN STACK output routine that prints C1P error 560 0282 9D0201 STA $ 0 1 0 2 .X 570 0285 A901 LDA messages correctly. As the output rou­ t l ; non- p r in t in g CHAR. 580 0287 4C121E RESUME JMP PATCH+3 .BACK TO CC tine prints characters on the screen, ERGO checks every carriage return to ERGO Listing 10 0000 J ERGO ROUTINE see if it comes from the error message 20 routine. If so, ERGO steps in and prints 30 0222 *=$0222 the second letter of the error message as 40 0222 C90D CMP #13 IS CHAR A CR ? 50 0224 D015 BNE EXIT a letter, not a graphics character. The 60 0226 8650 STX $50 SAVE X REG. stock carriage retum/line feed is omit­ 70 0228 BA TSX GET STACK POINTER 80 0229 BD0501 LDA $105,X CALLING ADDRESS $A252‘ ted to save space on the screen. To 90 022C C952 CMP #$52 patch ERGO into the output routine, 100 022E D007 BNE N0ERR change the contents of the output vec­ 110 0230 BD0601 LDA $106,X 120 0233 C9A2 CMP #$A2 tor to the start of ERGO ($021A = 22, 130 0235 F007 BEQ ERGO YES, PRINT ERR MESS* $021B =02). 140 0237 A650 N0ERR LDX $50 RESTORE A8cX REGS. 150 0239 A90D LDA m 160 023B 4C69FF EXIT JMP $FF69 TO REGULAR OUTPUT 170 180 023E A650 ERGO LDX $50 RESTORE X REG. You may contact Kerry Lourash at 1220 190 0240 20E3A8 JSR $A8E3 PRINT '?' North Dennis, Decatur, IL 62522. 200 0243 BD64A1 LDA $A164,X FIND 1ST LETTER 210 0246 20E5A8 JSR $A8E5 PRINT IT 220 003F BD65A1 LDA $Al65,X FIND 2ND LETTER JMCRO 230 024C 297F AND #$7F ZERO HI BIT 240 024E 4C5FA2 JMP $A25F TO REG. ERR ROUTINE

"|T Stankievvicz & Robinson, tT' ^ 1 1 I authors of MINOS. NIGHT RIDER, etc.. 1 _ I W* proudly present to you: 34 original PRO GRAM S on tape all tor the unbelievably low price of $29.95!! That's lass than Si each! tm

PINBAI.L MINOS M \/l i XIGHT r IDFr RIDGF CRITSKR ARCADE TYPE STRATEGY I'TILJTIKS MISCELLANEOUS NIGHT RIDER* '1 AKK I- O (' R LAi’r; \'e r if if :r MESSAGE ENCODER COSMIC DEBRIS' MIMIC LISTING LINL. RE TYPING 'IT ’TOR MINOS* MANGA I. A VERSATILE LINE PHONE Nl'MHER STREET SWEEPERS NE1GI I HORS LINE L( X IA TOR DEIH DRATION RIDGE CRi.TSFR HA R BLACK | AC I k DRILL CAGE* LIFE FOR TWO* STATISTICS PINBAL!, CHI SQl ARE I * Prr\ iousl\ sold OSI GRAND* KALEIDOSCOPIC I I NC I ION P I)v AARDVARK v I MINE FIELD WORM FIVING PAT I ERNS BETTER R\D I’K( JliAHILI'lA DEPTH CHARGE KALEIDOSCOPE GOTCHA! DKAU ML SLIP postage , iI |>it ;isi' add t)M All programs v\ill run on 8k C ustomers ini.Ill Many are compatible lor C~ 4 \pir, Oat and run in 4k. VICTORY SOFTWARE CORP. 2027-A S.(. RUSSELL CIRCLE SOFTWARE E L K IN S PARK. PA 19117 (215) 576-5625

20 MICRO - The 6502/6809 Journal No. 55 - December 1982 NEW FROM D & N MICRO PRODUCTS, INC. Z80A CPU with 4MHz clock and CP/M 2.2 aluminum with vinyl woodgrain decorative operating system. 64K of low power static finish. 8 slot backplane for expansion. 48 RAM. Calendar real time clock. Centronics pin buss is com patible w ith most OSI type parallel printer interface. Serial inter­ boards. Uses all standard IBM format CP/M face for terminal communications, dip software. switch baud rates of 150 to 9600.4" cooling fan with air intake on back of computer and Model 80-1200 $2995 discharge through ventilation in the bot­ 2 8" single sided drives, 1.2 meg of tom. No holes on computer top or side for storage entry of foreign object. Two 8" single or Model 80-2400 $3495 double sided floppy disk drives. IBM single 2 8 ” double sided drives, 2.4 meg of density 3740 format for 243K of storage on storage each drive. Using double density with 1K Option 001 $ 95 sectors 608K of storage is available on a Serial printer port, dip switch baud rate single sided drive of 1.2 meg on a double settings MICRO-80 COMPUTER sided drive. Satin finish extruded Software available in IBM single density 8" format Microsoft Digital Research Mlcropro Basic-80 $289 PL/1-80 $459 Wordstar $299 BasicCompiler $329 Mac $ 85 Mail-Merge $109 Fortran-80 $410 Sid $ 78 Spellstar $175 Cobol-80 $574 Z-Sid $ 95 Super Sort I $195 Macro-80 $175 C Basic-2 $110 Pascal Edit-80 $105 Tex $ 90 Pascal/MT + $429 Mu Simp/Mu Math $224 DeSpool $ 50 Pascal Z $349 Mu Lisp-80 $174 Ashton-Tate Pascal M $355 dBase II $595 Convert almost any static memory OSI machine to CP/M® with the D & N-80 CPU Board.

Z80A CPU with 4MHz clock. 2716 EPROM plete with 10 ft. cable. Optional Real Time with monitor and bootstrap loader. RS-232 Calendar Clock may be set or read using serial interface for terminal communica­ ‘CALL’ function in high level languages. tions or use as a serial printer interface in a Power requirements are only 5 volts at 1.4 VIDEO system. Disk controller Is an Intel amps. Available with WORDSTAR for serial 8272 chip to provide single or double densi­ terminal systems. ty disk format. 243K single density or608K INCLUDES CPM 2.2 double density of disk storage on a single D & N-80 serial $695 sided 8” drive. A double sided drive pro­ D & N-80 serial w/Wordstar $870 vides 1.2 meg of storage. DMA used with D & N-80 video $695 disk controller to unload CPU during block OptionOOl $ 80 transfers from the disk drives. Optional parallel printer and real time Centronics type parallel printer port com­ calendar clock D & N-80 CPU BOARD OTHER OSI COMPATIBLE HARDWARE IO-CA1 OX Serial Printer Port $125 C1P-EXP Expansion Interface $ 65 Compatible with OS-65U and OS-65D soft­ Expansion for C1P 600 or 610 board to the Disk Drives and Cables ware OSI 48 pin buss. Requires one slot in 8'ShugartSA801 singlesided $395 IO-CA9 Parallel Printer Port $175 backplane. Use with BP-580 backplane 8 ' Shugart SA851 dou ble sided $585 Centronics standard parallel printer inter­ BIO-1600 Bare IO card $ 50 FLC-66ft. cable from D & N or OSI $ 69 face with 10 ft. flat cable Supports 8K of memory, 2 16 bit parallel controller to 8" disk drive BP-580 8 Slot Backplane $ 47 ports may be used as printer interfaces. 5 51/4'MPIB51 with cable, power $450 Assembled 8 slot backplane for OSI 48 pin RS-232 serial ports, with manual and Molex supply and cabinet buss connectors FLC-51/48ft.cableforconnection $ 75 24MEM-CM9 $380 24MEM-CM9F $530 DSK-SW Disk Switch $ 29 to 5 1/4 drive and D & N or OSI 16MEM-CM9 $300 16MEM-CM9F $450 Extends life of drive and media. Shuts off controller, with data separator and 8MEM-CM9 $210 8MEM-CM9F $360 minifloppy spindle motor when system is disk switch BMEM-CM9F $ 50 FL470 $180 not accessing the drive. Complete KIT and Okidata Mlcrollne Printers 24K memory/floppy controller card sup­ manual ML82A Dot Matrix Printer $534 ports up to 24K of 2114 memory chips and 120 CPS, 80/120 columns, 9.5" paper width, an OSI type floppy disk controller. D & N Micro Products, Inc. friction or pin feed Available fully assembled and tested with 3684 N. Wells St. ML 83A Same as 82A except $895 8, 16, or 24K of memory, with floppy con­ Fort Wayne, Ind. 46808 16' paper width, 132/232 columns with troller (F). Controller supports 2 drives. tractor feed Needs separated clock and data inputs. (219) 485-6414 ML84Sameas82Aexcept200CPS, $1152 Available Bare (BMEM-CM9F) or controller 16' paper width, 132/232 columns, 2K buf­ only (FL-470). Ideal way to upgrade TERMS $2.50 shipping, Foreign orders add 15%. fer, dot addressable graphics, with tractor cassette based system Indiana residents add 4% sales tax. feed

No. 55 - December 1982 MICRO - The 6502/6809 Journal 21 ATARI Character Graphics from BASIC, Part 3

by Paul Swanson

You can remove the screen terrupt routine happens at the end of [decimal]. It adds one each frame so flicker by adding a short every sweep of the electron beam, or that PEEK(20) + PEEK(19)«256 + PEEK machine-language program to exactly sixty times per second. (18) *65536 always reveals the elapsed Atari’s vertical blank interrupt time in sixtieths of a second. routine. The Vertical Blank Interrupt The second routine is tacked on to Routine the end of the first one. This second Character Graphics Every sixtieth of a second your pro­ part is called the deferred vertical blank requires: gram, whether in BASIC or machine interrupt routine. You can easily stop language, gets interrupted for this this routine from running by setting Atari 400/800 special routine. Actually, there are two the critical flag (a 1 into location 66). In routines. The first one, which almost addition to writing the shadowed infor­ Last month I explained how to enable always runs, is called the immediate mation to the hardware registers, this and use Atari's fine scrolling function vertical blank interrupt routine. It second part also updates a few other (:]. The only big problem was that the takes care of all of the timers in the timers, maintains the keyboard auto­ screen flickered a little because you had system, which includes the real time repeat and debounce functions, and to shut off ANTIC, along with the dis­ clock in locations 18 through 20 reads and interprets the game con­ play, in order to alter the horizontal trollers into special memory locations. scroll register. Listing 1: Routine to shadow the fine By altering two vector locations, you There are several registers like that— scrolling registers. The JMP location can replace or add to the existing inter­ you can't write to them while ANTIC xxxx will be the vector value at location rupt routines. Each vector is a two-byte is displaying a screen or you get strange $224. The shadow registers will be at address stored in low, high order. effects. Most of these are taken care of locations $610 and $611. The vertical blank interrupt starts with a signal generated by ANTIC at by shadowing. However, the horizontal 0 6 0 0 AD 11 06 LDA $611 scroll register is not shadowed, so we 0603 8D 05 D4 STA HD405 the end of the display. This signal can need a different technique. 0 6 0 6 AD 1 0 0 6 L D A * 6 1 0 be masked by the hardware register 0 6 0 9 3 D 0 4 D 4 S T A H D 4 0 4 NMIEN (decimal location 54286). If Shadowing 0 6 0 C 4 C JMP the contents last written here were 64, Shadowing is a method of updating video-related registers without inter­ rupting the display in progress. Certain Listing 2 memory locations ("shadow" registers) 1 REM ((* Custom Character Set *** are set aside to represent the actual 2 REM *** Vertical Blank *** video registers. When ANTIC com­ 3 REM *** Interrupt routine *** 4 REM pletes the job of displaying one screen, 5 REM t t t Program by... *** it sends an interrupt signal to the 6502. h REM*** Paul S. Swanson *** Since ANTIC is not doing anything but 7 REM 8 REM waiting for the electron beam to return 9 REM ---- Calc, position in mem. ---- to the upper left comer of the screen, 10 DIM S*(1024) the 6502 has time to execute many in­ 20 A=ADR(SS) 30 B=INT(A/512+1)*2 structions. Among the things accom­ 40 CBASE=B*25A-A+1 plished during this vertical blank 47 REM period is an update of the actual video 48 REM 49 REM ---- Clear S string ------registers from the contents of the 50 S*(1)=CHR*<0) shadow reigsters. This guarantees that 60 3*(1024)=CHR*(0) all of the hardware registers are written 70 S*(2)=S*(1) while ANTIC is not drawing on the 77 REM 78 REM screen. At the end of the interrupt rou­ 79 REM --- Move standard set down----- tine, the 6502 automatically returns to BO FOR 1=0 TO 511 whatever it was doing before the inter­ 90 S*(CBASE+I,CBASE+I)=CHR*(PEEK(1+57344}) 100 NEXT I rupt occurred, so this process is almost 107 REM invisible to the main program. This in­ 108 REM (continued)

22 MICRO - The 6502/6809 Journal No. 55 - December 1982 Listing 2 (continued) the interrupt will happen. Writing a zero will prevent the interrupt. 109 REM ---- Set # to character 110 FDR 1=24 TO 31 If the signal is not masked by 120 READ N NMIEN, the 6502 is interrupted and a 130 S$(I+CBASE,I+CBASE)=CHR$(N) branch to the immediate vertical blank 140 NEXT I 147 REM interrupt routine occurs. This updates 143 REM the real time clock, processes the at­ 149 REM ---- GR.2 - No text window---- tract mode, and maintains a special 150 GRAPHICS IS system timer, CDTM VI (refer to Atari 152 GOSUB 500 157 REM manuals). 158 REM When the immediate mode vertical 159 REM ---- Find Display List ---- blank routine is completed, the flag 160 DLIST=PEEK(560)+PEEK < 561 )*256 162 SL0C=FEEK (DLIST+4) +PEEK (DLIST+5)* 256 CRITIC (memory location 66) is 167 REM checked, as is the processor interrupt 168 REM bit I. If either is non-zero, the interrupt 169 REM ---- Set scroll enables ---- 170 POKE DLI3T + 3,F'EEK(DLIST+3)+43 sequence is terminated with a return to 180 FOR 1=6 TO 16 the main program 6502 instruction 190 POKE DLIST+I,PEEK(DLIST+I)+48 RTI. Otherwise, the interrupt routine 200 NEXT I 207 REM continues with the deferred portion. 203 REM This second part moves all the 209 REM ---- Initialize position shadow registers into the hardware 210 VP0S=96 registers, updates a few other system 220 HP0S=80 222 POKE 756. B timers, and decodes the results read 224 WING=1 from the game controllers. When it has 226 S=14 finished, it branches through the vector 227 REM 228 REM at location 548 (decimal — 2 bytes]. 229 REM ---- Draw character in position ---- Unless you alter it, this location points 230 V= I NT ( V F ’OS / 16) to an RTI routine. 232 IF WING=1 THEN SOUND 0,10,0,6 240 VSCR0L=VP0S-V*16 Every time there is a vertical blank 250 H=INT (HF'OS/8) interrupt, the computer uses the ad­ 260 HSCRQL=HF'QS-H*8 dress at location 546 to find the im­ 262 IF WING=1 THEN WING=2:S*(CBASE+25,CBASE+25)=CHR*(0) : S* (CBASE+26, CBASE+24 AND S<8 THEN HM0VE=1 BLanK Deferred routine — this is the 370 IF S>8 AND S<12 THEN HM0VE=-1 one at location 548). 380 IF VMOVE+VF'OS>=0 AND VMOVE+VPOS<191 THEN VP0S=VP0S+VM0VE 390 IF HMOVE+HPOS>=0 AND HM0VE+HP0S<192 THEN HP0S=HP0S+HM0VE First you must write your routine in 400 IF VMGVE=2 THEN WING=2 machine language and store it in a fixed 410 GOTO 230 place in memory. In the sample pro­ 497 REM 498 REM gram, the routine requires 15 bytes and 499 R E M ----SET UP VBLANK ROUTINE ------starts at location $600 (1536 in 500 FOR 1=1 TO 13 decimal). A BASIC POKE routine may 510 READ N 520 POKE 1535+1,N be used to install this code. 530 NEXT I Since BASIC is so slow, you must 540 POKE 66,1 make allowances for certain odd occur­ 550 POKE 1549,PEEK(548) rences. What happens if a vertical 560 POKE 1550,PEEK(549) 570 POKE 548,0 blank routine tries to use a vector be­ 580 POKE 549,6 tween the time you write one byte and 590 POKE 66,0 the time you write the next byte? Your 600 RETURN 1000 DATA 0,195,36,24,24,36,0,0 program crashes! To get around this 1010 DATA 173,17,6,141,5,212,173,16,6,141,4,212,76 potential catastrophe, you can shut the

No. 55 - December 1982 MICRO - The 6502/6809 Journal 23 second part of the vertical blank inter­ the normal interrupt routine to jump to chosen. Line 540 turns off the deferred rupt routine off so that it does not even your routine in the first place, POKE a vertical blank interrupt routine so that look at this vector. This is accomplished zero in location 548 and a 6 in location the computer will not try to branch by setting the critical flag (a 1 into loca­ 549. This puts 1536 ($600) into the through the vector that needs changing. tion 66). You then make the changes to VVBLKD locations. Lines 550 and 560 copy the current con­ the vector at location 548, then restore The machine-language program tents of that vector into the JMP in­ the critical flag with a zero into loca­ takes the values in locations $610 and struction of our machine-language rou­ tion 66. This needs to be done only $611 (decimal 1552 and 1553) and tine and then change the vector to once — while you change the contents stores them into the horizontal and ver­ point to location $600 (1536 decimal). of the vector. tical scroll hardware registers. Then it Line 590 turns off the flag, enabling the If you want to add to the beginning jumps back into the vertical blank in­ new routine, and RETURNS. of the immediate vertical blank inter­ terrupt routine where we first inter­ Note that the second DATA state­ rupt, first POKE 54286 [NMIEN] with a rupted it. Locations 1552 and 1553 ment READ happens after the READ for zero. This disables the vertical blank (decimal) now act as shadow registers the first one. If you rearrange the pro­ interrupt. Next, make the appropriate for horizontal and vertical scroll gram, make sure you pay attention to changes to the vector at 546, and then values, respectively. the DATA pointer so that you don't in­ POKE 54286 with a 64 to re-enable the sert the shape of the bird where the vertical blank interrupt. The BASIC Piogram machine-language routine should go. Listing 1 shows the routine used to Listing 2 enhances the program There are a few other changes made form shadow registers for the fine presented in last month's article by ad­ to the portion that scrolls the bird. scrolling hardware registers. You must ding the shadowing routine. The Lines 266 through 292 are altered. Line POKE the first 13 bytes into memory, machine-language routine is converted 266 now calculates the new position. If then copy locations 548 and 549 into to decimal and included as line 1010 in it is the same as the old position except bytes 14 and 15. This causes the rou­ a DATA statement. A new subroutine, for the scrolling values, the character is tine to jump to the location that the called at line 152, has been added at not erased. It is erased only when the vertical blank interrupt routine nor­ line 500. It first READs the machine- position value has changed; this limits mally jumps to on completion. To get language routine into the locations the flickering substantially.

m a x e ll “INTERESTING SOFTWARE" 8781 Troy St. • Spring Valley, CA 92077 (619) 466-2200 WORLD ALPHABETS I r f-JL I i. I J - I 0 -1! if Ti

Ten type fonts allow user to create text or use pro­ nunciation tables in Arabic, Cherokee Indian, Hieroglyphics, Greek, Hebrew, Japanese, Rus­ sian, Sanskrit or Roman. Author: W.C. Jones the top of the line Diskette $89.95 in floppy diskettes BASIC LEARNING PACKAGE Write for free catalog with more than 400 fantastic values for all your word and data processing needs. An introduction to the Apple II or II Plus Computer. Outside USA. enclose $1.00 . Teaches beginner to program in BASIC. Author: J.J. Sudikatus ABM PRODUCTS Diskette $49.95 8868 CLAIREMONT MESA BLVD. SAN DIEGO, CALIFORNIA 92123 Both require an Apple II with Applesoft, 48K, plus disk drive. Epsom printer with Graftrax is optional. Toll Free 800-854-1555 Orders Only Apple II or II Plus and Applesoft are trademarks of Apple Computer, inc. For information or California Orders (714) 268-3537

24 MICRO - The 6502/6809 Journal No. 55 - December 1982 Lines 550 and 560 are altered to screen position and the fine scrolling POKE into the new shadow registers. values. BASIC is a much easier lan­ ANTIC is not turned off at all. Line 291 guage in which to create programs, but IM CftO is added to update the position value P a little machine language now and then and cause a slight delay if the position can help smooth out the rough edges. If is publishing value were changed. This delay guaran­ you can get away with routines as short tees that there has been at least one ver­ as the one in listing 1, it is certainly tical blank interrupt routine since the worth it. an OSI book! new values were written to the shadow OSI users will be getting a book of registers. The hardware registers are What To Do With This Information their own. Early in 1983, MICRO updated before line 292 is executed. The character graphics example magazine plans to publish a strictly Line 292 puts the bird on the screen in here was intended for instruction only. OSI volum e! the position indicated by P. If the posi­ However, the shadowing described in tion were not altered, this line doesn’t this article, combined with the custom We will include a variety of topics — actually do anything. If the position character set and fine scrolling describ­ BASIC Enhancements, Machine- value has been changed, it draws the ed in parts 1 and 2, needs only to be Language Aids, Hardware, I/O bird in the new position. combined with a little imagination to Enhancements, and a "W h a t’s There is still a slight flicker every produce some elegant software. Where in the OSI" reference once in awhile, but this will not be guide. We'll supply more details noticeable if other things are happening soon. at the same time. The only way to eliminate the flicker altogether is to Let us know what yo u would like to use machine language to update the Paul Swanson is our Atari columnist. You may contact him at 97 Jackson Street, see in this book. Or, if you’ve written bird as well. By using shadow registers Cambridge, MA 02140. an article/program that you think you could write a vertical blank inter­ should be a1 part of this volume, rupt routine that would take your posi­ send it in now! tion values and reduce them to the JMCftO

UPGRADE YOUR AIM-65* INSTANTLY *A trademark of Rockwell Inc.

INTRODUCTORY PRICE To A 6809 Development System $239. With The Plus $6 U.P.S. “ MACH-9’ And Handling From Includes:

M M S Inc. *6809 CPU Plug-in Assembly 'Super-set of AIM Monitor *Two-Pass Symbolic Assembler 'Complete Monitor Source Listings 'Enhanced Cut & Paste Editor *200 Page Manual 'Full I/O Control

MACH-9” is assembled and tested with local BUS, 5 locking low force ROM sockets and 2K Static RAM

M M S Inc. 1 1 1 0 E. P ennsylvania St. T u c s o n , AZ 85714 (602) 746-0418 VISA'

No. 55 - December 1982 MICRO - The 6502/6809 Journal 25 APPLESOFT GOTO/GOSUB Checking Routine

by Peter J.G. Meyer

This 194-byte machine-language exists as bytes in RAM, consists of four final statement in the line is followed, routine will check all GOTO and consecutive parts: not by an end-of-statement token, but GOSUB references in an 1. Two bytes containing the address of by the end-of-line token. Applesoft program and display the following line (low byte then For example, suppose the program any that refer to non-existent high byte, as usual). line "10 IF A = 0 THEN GOSUB 120: lines. The source program also 2. Two bytes containing the line num­ ON B GOTO 340,560” is the first in a demonstrates how to make use ber in hexadecimal. program. It will (normally) occur at of the machine-language 3. The tokenized text of the line (in $0801 and be represented in RAM as subroutines available in the which, for example, GOTO is shown in figure 1. Applesoft Interpreter. represented by the token byte $AB). Good programming style is simply 4. The end-of-line token, $00. knowing what you want to do, and The text of the line may consist of stating clearly how to do it. In this GOTO/GOSUB Checker several statements. In this case each case, what we want to do is as follows. requires: statement (except the last] is followed For each line in the Applesoft program: Apple II with Applesoft by the end-of-statement token, $3A 1. Inspect the line for GOTOs ($AB (which is the byte used as the ASCII tokens), THENs |$C4 tokens), and In a previous article (MICRO 43:101) I representation of the colon, ':'). The GOSUBs ($B0 tokens). presented a short assembly-language program for a utility that would display Figure 1 the bytes constituting a specified line in an Applesoft program. That utility 801 - IA 08 pointer to next line was constructed using eight machine- 803 - 0A 00 "10" in hexadecimal "IF A = 1" language subroutines available in the 805 - AD 41 DO 30 809 - C4 B0 31 32 30 3A "THEN GOSUB 120:" Applesoft Interpreter and the Apple 8OF - B4 42 AB 33 34 30 2C 35 36 30 "ON B GOTO 340,560" Monitor. 819 - 00 end-of-line token In this article I will use two of those routines (LINGET and FNDLIN] together with six others to construct a Listing 1 utility for checking the GOTO and 2 GOSUB references in an Applesoft pro­ 3 * 4 * qoto/gosub checker gram. This utility does the useful task 5 * of going through an Applesoft program 6 * B i PETER MEYER * looking for GOTOs and GOSUBs. 7 8 * APRIL 1982 When it finds one, it searches the pro­ 9 * gram for the referenced line. If the line 10 11 does not exist, it displays the offending 12 * APPLESOFT SUBROUrrreS statement with the line number in 13 which it occurs. 14 CHRGET EPZ $B1 15 CHKGOT EPZ $B7 To understand the assembly-lan­ 16 FNDUN EOT $D61A guage program presented here, it is 17 STXTPT H3U $D697 18 UNGET EOT $DA0C necessary only to understand the struc­ 19 CRDO EOT $DAFB ture of an Applesoft line in RAM and 20 STOOOT EOT $DB3A the function of the eight Applesoft 21 LINPRT EOT $ED24 22 STANDARD ZERO PAGE IflCATIONS subroutines that are employed. Of 23 course, it also helps to know a little 24 UNNUM EPZ $50 25 TXTIftB EPZ $67 about 6502 assembly-language pro­ 26 TC1VTR EPZ $B8 gramming, but novices should not be 27 * deterred. 28 SPECIAL ZERO PAGE LOCATIONS 29 An Applesoft program line, as it 30 TCKEN EPZ $F9

26 MICRO - The 6502/6809 Journal No. 55 - December 1982 2. If none are found, continue with the Listing 1 (continued) next line, until the end of the pro­ 31 LN1 EPZ 5FA 32 IN2 EPZ $PC gram is reached. 33 3. If a GOTO, THEN, or GOSUB token 34 ; * OTHER LOCATIONS is found, read the line number 35 36 DOS 'WS EOT 53DO ;DOS WAIW ST5\RT VECTOR following the token. 37 SPEAKER EOT SC030 4. Search through the program for a 38 39 line so numbered. 40 5. If the line is found, continue inspect­ 41 ORG 5300 7 OR ANYWHERE CONVENIENT ing the current line for GOTOs, 0300 42 BEGIN: 0300 20 FB DA 43 JSR CRDO 7 PRINT THENs, and GOSUBs. 0303 44 ;SET TOIPTR TO BYTE PRECEEDING LINK FIELD OF FIRST LINE 6. If no such line is found, report this 0303 20 97 D6 45 JSR SDCIPT 0306 46 NBfTLINE: fact by displaying the current line 0306 20 B1 00 47 R OIRGET number and the offending GOTO, 0309 A0 01 48 LEY #1 END-OF-PROGRAM DOUBLE 00 THEN, or GOSUB statement (then 030B B1 BB 49 U3A (TXTPTR) ,Y REACHED YET? 030D DO 06 50 ENE SAVLINNO IF NOT continue the inspection]. 030F 20 FB DA 51 JSR CRDO PRINT FINAL To go through RAM one byte at a 0312 4C DO 03 52 JMP DOS'WS BACK TO BASIC 0315 53 SAVLINNO time, Applesoft has the subroutine 0315 54 7 IN CASE WE NEED TO PRINT IT LATER CHRGET, which is located on page 0315 C8 55 INY zero (at $B 1 ]. This routine makes use of 0316 B1 B8 56 LDA (TXTPTR) ,Y 0318 85 FA 57 STA INI the two-byte pointer called TXTPTR 031A C8 58 INY [at $B8,B9). TXTPTR is usually point­ 031B B1 B8 59 U3A (TXTPTR) ,Y 03 ID 85 FB 60 STA LN1+1 ing to a byte somewhere in the Apple­ 031F 61 ; ADVANCE TXTPTR TO FIRST BYTE IN TEXT OF LINE soft program in RAM. The effect of CHRGET is to advance TXTPTR to the 031F A5 B8 62 LDA TXTPTR 0321 18 63 r r r . next byte and to load that byte into the 0322 69 03 64 ADC #3 accumulator (setting certain flags along 0324 85 B8 65 STA TXTPTR 0326 9 0 02 66 BCE OOTHRUIN the way]. Thus, by repeatedly invoking 0328 E6 B9 67 IfC TXTPTR+1 CHRGET we can go through each pro­ 032A 68 GOTH RUIN 032A 69 ; INSPECTING EACH BOTE IN TURN gram line looking for GOTO and 032A 20 B1 00 70 JS R CHRGET GOSUB tokens. (CHRGOT, at $B7, is 032D C9 00 71 CMP #0 END-OF-LINE TOKEN? CHRGET without the initial advance 032F F0 D5 72 BED NEXTUNE IF SO 0331 C9 C4 73 CMP #5C4 'THEN' TOKEN of TXTPTR. It simply loads the 0333 DO OF 74 a re next accumulator with whatever byte 0335 AO 01 75 LDY #1 0337 B1 B8 76 U3A (TXTPTR) ,Y TXTPTR is pointing to.) 0339 38 77 SEC Having found a GOTO, THEN, or a 033A E9 30 78 SBC #530 GOSUB token, we can then use the 033C C9 OA 79 CMP #50A 033E BO EA 80 BCS GOTH RUIN subroutine LINGET (at $DA0C) to read 0340 A9 C4 81 U3A #5C4 'THIN' TOKEN the line number and place it (in hex­ 0342 DO 08 82 a re store AIWfYS 0344 C9 AB 83 NEXT CMP #5AB 'GOTO' TOKEN adecimal form) in the zero-page loca­ 0346 FO 04 84 BED STORE tion LINNUM ($50,51). We can use 0348 C9 BO 85 CMP #5B0 'GOSUB' TOKEN 034A DO DE 86 ENE GOTH RUIN LINGET for this purpose because this is 034C 85 TO 87 STORE STA TOKEN precisely what LINGET was designed 034E 88 READINNO to do. 034E 20 B1 00 89 JS R CHRGET ;ADVANCE TXTPTR TO LINE NO. 0351 20 OC DA 90 JSR LTNGETT ;REAI> LINE NO.,STORE IN LINNUM To help you search through a pro­ 0354 A5 50 91 U3A LINNUM gram to find a line whose number is at 0356 A4 51 92 I£IY LINNUW-1 0358 85 PC 93 STA IN2 rSAVE LINNUM IN LN2 LINNUM, there is-the routine FNDLIN 035A 84 ID 94 STY IN2+1 (at $D61A). When this routine returns, 035C AD 30 CO 95 UHA SPEAKER EACH CLICK MEANS A PROG SEARCH the carry flag is set if such a line was 035F 20 IA D6 96 JSR FNDLIN SEARCH PROGRAM FOR A LINE 0362 BO 30 97 BCS OBCCCMMA IF LINE FTXJND found, otherwise the carry flag is clear. 0364 98 LINNOTFD In the latter case we precede using 0364 20 FB DA 99 JS R CRDO ; PRINT 0367 A5 FB 100 UHA IN1+1 CHRGET to look for further GOTOs 0369 A6 FA 101 U K INI and GOSUBs. 036B 20 24 ED 102 JS R LINPRT If FNDLIN returns with the carry 036E A5 F9 103 LDA TOKEN 0370 C9 C4 104 CMP #5C4 'THEN' TOKEN flag set, then we have found a reference 0372 DO 07 105 BSE NEXT1 to a non-existent line and a report to 0374 A9 B9 106 U » #THEN 0376 AO 03 107 LDY /THEN this effect is in order. This report only 0378 4C 8A 03 108 JMP PRINT needs to consist of 1. the number of the 037B C9 BO 109 NEXT1 CMP #5B0 'GOSUB' line containing the offending state­ 037D FO 07 110 BED NEXT2 037F A9 A6 111 UHA #GOTO ment, 2. the word GOTO, THEN, or 0381 AO 03 112 LDY /GOTO GOSUB, followed by 3. the number of 0383 4C 8A 03 113 JMP PRINT 0386 A9 AF 114 NEXT2 LEA #G0SUB the non-existent line referred to. 0388 AO 03 115 UK /GOSUB For printing numbers we have the 039^ 20 3A DB 116 PRINT JSR STROOT PRINT GOTO OR GOSUB

No. 55 - December 1982 MICRO - The 6502/6809 Journal 27 Applesoft routine LINPRT (at $ED24), L istin g 1 (continued') which prints, in decimal form, the hex­ 038D AS FD 117 IDA IN2+1 038F A6 EC 118 IXOC IN2 adecimal number whose high byte is in 0391 20 24 ED 119 JSR LINPRT : PRINT LINE REFERRED TO the accumulator and whose low byte is 0394 120 CHK C C f M A : 0394 121 ;IN CASE OF MULTIPLE GOTO,OR GOSUB in the X-register. For printing text we 0394 20 B7 00 122 JSR CHRGOT have the routine STROUT (at $DB3A), 0397 C9 2C 123 CMP #$2C ;CCMMA? which will print the string pointed to 0399 F0 B3 124 BED READINNO ;I F SO 039B AS B9 125 LDA TX'IVl'R+l ; DECREMENT TX'lVl'R IN PREP by the Y-register (high byte) and the ac­ 039D DO 02 126 ENE NEXT3 ;FOR NEXT USE OF OTRGET cumulator (low byte). (The string must 039F C6 B9 127 DEE TXTPTR+1 03A1 C6 B8 128 NEXT3 be terminated by a $00 or a $22.) DEE W IT O 03A3 4C 2A 03 129 JMP GOIH RUIN Thus, Applesoft provides us with all 03A6 130 ; the routines we need for the job. With a 03A6 133 03S6 134 ; * STRINGS good assembler and some attention to 03A6 20 20 20 135 GOTO • DA 4 GOTO detail, these can be put together to pro­ 03A9 47 4F 54 duce a machine-language routine to 03fC 4F 20 22 03AF 20 20 20 136 GOSUB • DA ' GOSUB perform the required task. The source 03B2 47 4F 53 ' program in listing 1 demonstrates how 03B5 55 42 20 03B8 22 this can be done. 03B9 20 20 20 137 THIN • DA ' THIN 03K! 54 48 45 Once assembled and BSAVEd, this 03BF 4E 20 22 utility is used as follows: LOAD your 03C2 138 END program into RAM and BRUN the routine or, if it is already installed, simply CALL it. Line references in ONERR GOTOs and GOSUBs will also Peter Meyer is the author of Agenda Files, in Europe. You may contact him at 55 from Special Delivery Software, and be checked, as will all line references Sutter St., Suite 608, San Francisco, CA Routine Machine, recently released by 94104. (not just the first) in ON X GOTOs and Southwestern Data Systems. He is GOSUBs. currently designing applications software JMCftO

* * * RIM + POWER * * Ver. 2 For your APPLE II/II+ * from The complete professional software system, that meets * COMPUTECH ALL provisions of the FORTH—79 Standard (adopted Oct. * * 1980). Compare the many advanced features of FORTH- * 79 w ith the FORTH you are now using, or plan to buy! * All prices C heck the FEATURES OURS OTHERS * p o s t p a i d outstanding 79-Standard system gives source portability. YES * (Continental documenta­ * Professionally written tutorial & user manual 200 PG. * U.S.- tion supplied * Screen editor with user-definable controls. YES * otherwise with AIM65! * Macro-assembler with local labels. YES Virtual memory. YES * * s2 credit) Both 13 & 16-sector format. YES * * Multiple disk drives. YES * * Double-number Standard & String extensions. YES * Top quality power supply designed to Rockwell’s specs for fully Upper/lowercase keyboard input. YES LO-Res graphics. YES * populated AIM65 — includes overvoltage protection, transient sup­ * pression, metal case and power cable: 80 column display capability YES * * Z-80 CP/M Ver. 2.x & Northstar also available YES PSSBC-A (5V 2A Reg; 24V ,5A Avg, 2.5A Peak, Unreg) .... *64.95 * * Affordable! $99.95 Same but an e*tra AMP at 5 volts to drive your extra boards: Low cost enhancement option: * PSSBC-3 (5V 3A Reg; 24V ,5A Avg, 2.5A Peak, Unreg) .... ’74.95 * Hi-Res turtle-graphics. YES * * The professional’s choice in microcomputers: Floating-point mathematics. YES * AIM65/1K RAM ...... ’429.95 BASIC (2 ROMS) ...... *59.95 Powerful package with own manual, * AIM65/4K RAM ...... ’464.95 ASSEMBLER (1 ROM ) *32.95 50 functions in all, * FORTH (2 ROMS) ...... *59.95. AM9511 compatible. * FORTH—79 V.2 (requires 48K & 1 disk drive) 99.95 SAVE EVEN MORE ON COMBINATIONS ■¥ * ENHANCEMENT PACKAGE FOR V.2 AIM65/1K + PSSBC-A ... *479.95 AIM65/4K+PSSBC-3 ...*524.95 Floating point & Hi-Res turtle-graphics 49.95 * We gladly quote on all AIM65/40 and RM65 items as well. ■¥ COMBINATION PACKAGE $139.95 * (CA res. add 6% tax: COD accepted)' ORDERS: (714) 369-1084 * ■¥ P.O. Box 20054 • Riverside, CA 92516 MicroMotion * California residents add 6% sales tax 12077 Wilshire Blvd. #.506 * ■¥ L.A..CA 90025 (213)821-4340 * Specify APPLE. CP/M or Nor:hstar Dealer inquiries invited. ______

.28 MICRO - The 6502/6809 Journal No. 55 - December 1982 Chances are, when you Siemens system with over A special introductory offer bought your first disk drive, it 10,000 lifetime hours. Shielded when you order Apple-Mate was an Apple. Now that you're connecting cable also attached. directly from us. ready for a second, take a look So when you're ready to boost LONG TERM at Quentin. the juice on your Apple, add-on DEPENDABILITY Our Apple*-Mate™ 51A" Disk the Quentin Apple-Mate. MTBF (Mean Time Between Drive is fully software transparent To order: Check, money order, Failures)—8,500 power-on hours, with Apple's DOS 3.3 operating Visa or Mastercard number. Calif, and the unit has a one-year system in full and half track residents add 6% sales tax. warranty. operation. Allow one week delivery. Add it to your present drive for COUNT ON QUENTIN greater capacity and faster access. FOR QUALITY Just plug it in and go to work. Quentin Research was building And the Apple-Mate has these disk systems for the computer High Performance advantages: industry when Apple was a little .— s ON TRACK HEAD SEEK bud on the big computer tree. We're known for product reliabil­ (ouenfin) A precision lead screw positions RESEARCH, INC.- ity and stand behind every system the head onto the correct track. we sell you. 19355 Business Center Drive Time-consuming retries and Northridge, California 91324 disk-to-disk copying errors are But the best news may be the (213) 701-1006 virtually eliminated. price—only $335.00 (40 tracks). SIEMENS* DISK DRIVE The apple-beige unit is built around the highly reliable

Special Introductory Price: $335.00

® Apple is a registered trademark of Apple Computer, Inc fSiemens is a trademark o f Siemens Corporation. ‘ Apple-Mate is a trademark o f Quentin Research, Inc., which does not manufacture Apple computers. /MCftO CoCo Bits

By John Steiner

This month's CoCo Bits re-examines DSKI$ is used in a loop to read the sec­ wishing to pass along similar informa­ the single disk COPY command. In ad­ tors in the directory track. It is the only tion can contact me directly at the ad­ dition, I have noted a few CoCo-related BASIC command that can directly read dress shown below. It will take two to news items. One item I did not men­ the directory. The routine that reads three months for your notice to appeal tion last month regards the transfer of and stores the filenames is modified in MICRO. machine-language files to disk. Before from the routine provided on page 62 of Rumors are that Tandy has signed loading the routines into memory, be the COCO disk manual. By the way, an agreement with a group of RCA sure to reserve enough memory space there is a slight error in the routine that distributors to market the Color Com­ so BASIC will not overwrite your pro­ will cause it to miss several files. Line puter in retail outlets not handling gram. Also, before loading and ex­ 60 reads FOR N = 1 TO 7; it should read Radio Shack products. The new Coloi ecuting the modified BEDLAM from FOR N = 0 TO 7. Computer will have a different coloi disk, a CLEAR 200, 16384 will protect The selective backup program case and new name. If you have more the program from BASIC. Without this routine uses several small arrays to details On this, or any other news re­ command, the program seems to ex­ read and identify the files that exist on garding CoCo, pass it along. ecute properly but does not print the a particular disk. Upon execution of Recently, I received an interestinj opening message. line 160, the array FI$ contains the musical program cassette. The classical As I mentioned last month, the filenames of the program on the disk. rendition with four-voice organ music single disk COPY command is avail­ Lines 170 to 230 present the filenames is the highest quality music routine ! able and willnot destroy a program that and invoke the copy command if have heard, and I was impressed w itl is in memory (like DSKINI and necessary. This routine has saved me a the thought that most programmers ar< BACKUP]. This opens the door to a lot of time and hassle. not using CoCo's sound abilities tc useful routine for selective backup of A Color Computer user's group has their fullest. Several musical selection; program and data files. The backup been formed in the Toronto, Ontario, are available from Classical Software command is appropriate for archives Canada area. If you are interested in 8931 Comanche Road, Longmont, Col and duplication purposes. COPY is joining, you may contact Patricia orado 80501. They plan to announce i useful when only a few files require Jackson at (416) 425-1116. Call week music editor with four-part tonal struc transfer, or if program data must be days after 6:00 p.m., or on the ture that will allow the user to enter anc transferred to a disk without destroying weekend. There is also a user's group play notes directly from sheet music. already existing files. in the Fargo, North Dakota area. Con­ I own one of the early model Coloi If several files must be transferred, tact me and I will put your name on the Computers (serial number 337) anc however, it is tiresome to enter the meeting notice mailing list. Anyone follow news about theUadio Shack 32K files one by one using COPY "filename/ext". The program in listing 1 provides a selective backup Listing 1: COPY routine. It reads the disk directory 10 CLS : PR I NT3>4„ "SELECTIVE BACKUP PROGRAM" track and stores all the program names 20 PRINT340,"BY JOHN STEINER" in a string array. The array holds up to 30 PCLEAR 1 40 CLEAR 2000 : DIM F I* (67) 68 file names, the maximum number a 50 FOR X = 3 TO 11 CoCo disk can hold. After reading the 60 DSKI* 0,17,X,A*,B* 70 C*=A* + LEFT*(B*,127) filenames, each name is presented. BO N * < 0 ) - L E F T * < C * , 8 ) Pressing "Y ” invokes the COPY com­ 90 EX*(0)=M ID*(C*,9,3) 100 FOR N=0 TO 7 mand and the file is read into memory. 110 N*(N)=MID*(C*,N*32+1,B) You are prompted to switch disks, and 120 EX* 130 IF LEFT*(N*(N) , 1K>CHR*(0) AND LEFT* (N* (N> , 1 X >CHR* (255) if all goes well, told that the copy is THEN FI*(K)=N *(N )+" /"+EX*(N> : K=K+1 complete. If you don't wish to copy a 140 NEXT N 1 5 0 NEXT X file press any other key. The next file in 160 CLS-.PRIMT364, "ENTER Y TO COPY" line is then presented for your decision. 1 7 0 FOR J = 0 TO K 1 SO PR I NTS)224, F I * ( J ) Be sure to reinstall your source disk 190 Z*=INKEY* : IF Z*="" THEN 190 before pressing “Y” . 200 IF Z*="Y" THEN COPY FI*(J) 210 IF Z*="Y" THEN CLS : PRINT3224, FI*(J) " COPIED" : FOR 1=1 TO 400 In addition to the COPY command, : NEXT I the simple program makes use of 220 IF Z*="Y" THEN PRINTSO,"PLEASE REINSERT SOURCE DISK" 230 NEXT J. another powerful disk command.

30 MICRO - The 6502/6809 Journal No. 55 - December 1982 to the printer port. This allows CoCo C o C o B i t s (continued) to send graphics or special characters to the printer without loading Tandy's TIRED OF TYPING? modifications. I have wanted to PTFX program. MICRO has the solution. upgrade to the new version for a while, I am interested in hearing from but have not wanted to be without anyone who has modified a Color Com­ Order a diskette of three recent CoCo for the time it would take to puter to 64K without converting to utility programs for the Apple. For make the change. I did increase the E board. I would also like to hear only $10.00, plus $2.00 shipping memory capacity by piggy-backing ex­ from FLEX and OS-9 users who suc­ and handling, you will receive a isting memory with 16K chips. It is a cessfully run their programs on CoCo. DOS 3.3 diskette containing the relatively inexpensive procedure and The added power and software com- assembled listings of: works well, giving fewer OM errors. patability is a major step for Color Applesoft Variable Dump by One of the major disadvantages of this Computer programmers. Philippe Francois (MICRO, April Next month, in addition to CoCo modification is that Radio Shack is 1982) replacing the early boards with an up­ news, I will discuss some books avail­ Straightforward Garbage Collec­ dated processor board and 64K RAM able for Color Computer users. I will tion for the Apple by Comelis chips. The 64K chips are permanently also take a look at medium- and high- Bongers (MICRO, August 1982) wired making the upper 32K bank inac­ resolution graphics modes available in COMPRESS by Barton Bauers cessible. A few simple changes allow Extended BASIC. (MICRO, October, 1982) you to restore the upper bank and deselect the ROMs that normally reside Please send check, money order, or VISA or MasterCard number. Only there. The user can then load another prepaid orders accepted. If you DOS, modify BASIC, or change the en­ missed the above issues of MICRO tire character of CoCo. When Radio You may contact the author at 508 Fourth they can be ordered now! Include Shack changed the memory chips, the Avenue NW, Riverside, ND 58078. $2.50 for each issue. company had to issue a new Color Send orders to: BASIC ROM. Color BASIC 1.1, in addi­ JMGRO Apple Utility Disk tion to checking for and using 32K, has MICRO, P.O. Box 6502, a few of the previous bugs removed. Chelmsford, MA 01824 The 1.1 ROM will send 8-bit serial data

FRANKLIN

A powerful utility that ACE10OO opens a window Apple II compatible in to the Color 64K of RAM $1199.00 Computer’s disks. Upper and lower case COLORZAP uses the power of the Typewriter-style keyboard Color Computer to provide both 12-key numeric pad rapid scanning and full screen modifi- Alpha lock key M X -80FT cation capabilities. You can nowexamine, VisiCalc keys w/Graphics modify, and copy programs or data while 50-watt power supply they're stored on disk. Access them by filename ■ location. Built-in fan $544.00 COLORZAP is programmed largely in BASIC so that you can modify it if you'd like, but part of it is in machine language to provide fast response. All accesses to disk are AIM-65,4K RAM $465.00 performed with standard interfaces, so any standard Color Computer disk can be examired. You can directly access the disk's directory and control information to examine a clobbered disk, recover a killed file, or find parts of a file COMPLETE CATALOG - - FREE when other parts have been lost. With this new window into COMPUTERS PRINTERS MONITORS its disks, the Color Computer sheds its image as a toy Now you can use this exciting machine like other powerful MICROPROCESSOR COMPONENTS microcomputers. For the TRS-80 Color Computer. Available on disk with an accompanying manual from Software Options, 19 Rector Street. New York, N.Y. 10006. 212-785-8285. toll-free order Bedford Micro Systems line: 800-221-1624. Price: $49.95 (plus $3.00 per P.O. Box 1182, Bedford, Texas 76021 order shipping and handling). New York ------State residents add sales tax. Visa/Master­ (817) 283-0013 card accepted. « 1

No. 55 - December 1982 MICRO - The 6502/6809 Journal 31 /MCftO From Here to Atari

By Paul S. Swanson

POKE the screen location with input. For this, remember to display Atari News N + FLAG. FLAG will equal 128 for in­ the characters on the screen and to I was pleased to see that Atari, Inc.,verse video characters and will equal make allowances for backspaces. Now recently established two regional soft­ zero for normal video characters in your program will not produce a click ware acquisition centers located in mode 0. There are two bits in modes 1 with each keystroke. Cambridge, Massachusetts and London, and 2 that determine the color, but the The only other common code con­ England. The centers were set up to ac­ conversion routine in the above IF versions required are for the graphics quire software by contracting out for statements will interpret them both screens. Those are simpler than the specific programs, or by buying software correctly. other conversions. If you are using the that has already been developed in­ The other code conversion would be standard screen set up by BASIC, it is dependently. more centers are planned for characters read from the keyboard. much easier to use standard BASIC for the future; I'll let you know where Several people have asked me how to statements like PLOT and DRAWTO. they will be as soon as Atari annouces eliminate the keyboard click. The only If you want to set up a specific shape that information. way to completely eliminate it would that would require a lot of DRAWTO be to disconnect the keyboard speaker, commands for a relatively small area, Technical Tidbits but you can use another method if you you may want to use PRINT. Code conversion is required in two write your programs to accommodate Although converting to exact byte areas when you're programming the it. Instead of using INPUT and GET to values to POKE onto the screen is Atari. The "norm al'' character code, obtain information from the keyboard, possible, PRINT allows you to address called ATASCII, is a variation of ASCII. you can PEEK location 764. This loca­ each individual pixel on the screen. There are two other character codes tion contains the keyboard code of the You PRINT an alphanumeric string to used by the system. One is used to last key pressed on the keyboard. You the screen through channel six. In write characters to the screen. The must read this location, then POKE mode 3, POSITION the graphics cursor screen handler does this conversion 764,255. If the location contains 255 at the beginning of one of the lines in automatically when you PRINT to the you know that no key has been pressed the image, then PRINT #6; "112233" screen, but if you use your own since the last time you read it. for two pixels each of colors 1, 2, and 3. routines and put the characters directly The problem with this method is To print the background color, which on the screen with POKE or a similar that the code you read is neither will allow you to erase an image, use method, you need to convert to this ATASCII nor the internal code. You zero, four, or a space. In two-color screen code. can get the values of all of these codes modes, use only zero and one. This The operating system manual in­ by running the following program: method will save you substantial con­ cludes a table that shows you the cor­ version over PEEKing and POKEing and respondence between ATASCII and the 10 REM ** KEYBOARD CODES ** will, in some cases, run much faster screen code (which they call the "Inter­ 11 REM ** STOP BY PRESSING BREAK than ** the equivalent PLOT and nal Code"). You can form a look-up 12 REM ** DRAWTO statements. You don't need table if you want by using a 256-byte 13 REM ** a COLOR statement for the PRINT string. Set it up so the value to POKE is 20 PRINT “ PRESS KEY AND THIS PROGRAM method because you specify the color the ASC( value of the byte in the string 30 PRINT "WILL DISPLAY THE register directly, and there is an addi­ found at AVAL + 1, where AVAL is the 40 PRINT “ CORRESPONDING KEYBOARD tional advantage to providing a version ASC( value of the ATASCII character to CODE AS A DECIMAL VALUE:’’ of the image right in the program (in­ be displayed. 50 N = PEEK(764) valuable in debugging). An alternative approach, which 60 IF N = 255 THEN 50 consumes less memory than the look­ 70 POKE 764,255 up table, is using dependent IF 80 ? N;“ Next Month statements. Using N as the ATASCII 90 GOTO 50 My January column will introduce value to display : the Operating System and Hardware manuals and a few other sources of more FLAG = INT(N/128):N = N - FLAG + 64: If you use this program as a sub­ technical information on the Atari. I If N > 95 THEN N = N - 96: IF N > 64 routine by itself, it will act as a GET plan to make the Technical Tidbits a reg­ THEN N = N + 32 statement. Putting the subroutine in a ular feature, so send in your questions. loop that stacks the codes in a string After you execute that one line of until it gets a RETURN code will act as code (it must be in one program line], an INPUT statement for alphanumeric AMCftO

32 MICRO - The 6502/6809 Journal No. 55 - December 1982 monsTER mflSH

It is late at night in a monster infested graveyard and you have been given the job of keeping the monsters in. All you have between you and complete chaos is a new MonsterMasher System and quick reflexes. Monster Mash is an original and unique arcade action game written in The Software Farm assembly language for the Apple II and Apple / / / (in emulation mode). 3901 So. Elkhart Aurora, CO. 80014 PH: (303) 690-7559 $29.95

No. 55 - December 1982 MICRO - The 6502/6809 Journal 33 When all hell breaks loose. Pandora’s box is open. And all the evil of the past are loosed upon mankini Armed with bolts of lightning, you have the chance to recapture an< return these corrupt creatures of doom to the prison of Pandora’s box. Time is short. The world is already changing for the worst. Your skills and courageiire needed. Computer Stations, Inc., of Granite City, IL, and a D.C. ' Hayes Associates, Inc., microcoupler. Our telephone number is (617] 256-1446. After dialing into the Net-Works program, a self- ex­ /AlCftO planatory menu is presented. The option (C)hat will not be News supported. The first time that you log on you will be ex­ pected to leave your name, etc., for subscription verification. by Phil Daley, MICRO Staff Editor This check will take at least one day. You will have only limited access to the system until your name has been verified and added to the queue of valid users. Please Apple Bits and Pieces write down the password that the system assigns to you so As the release date for a new APPLE approaches, rumors that you can use it for future calls. A “ < Ctrl > S" will tem­ fly fast and furious. Apple is securing sources for one porarily stop the system in case it is scrolling too fast to million 68000 microprocessors, leading me to believe that read. Generally, new users may read the system, but not the "L isa" model (APPLE IV?) will be the first out, write to the system until verified. We are planning a com­ probably this Spring. It is to sell for approximately $8000 munications issue for April with articles on all aspects of and to be pitched at the business person who knows little computer communications. If you have written an article about computers. At least, those are the rumors. or have any suggestions or criticisms, please send them to us here at MICRO. • •• • •• The "Seem alike” Franklin ACE 1000 may prompt Apple to release the Super Apple II sooner than originally an­ A Computer Center ticipated. In addition to having 64K standard, rumor has it that the Super Apple II will contain far fewer chips on the A new resource center has been opened in Newton, MA, to mother board and will sell for substantially less. meet the educational and instructional needs of executives The Franklin looks like an Apple U, especially when who are interested in learning how to make effective use of you take the cover off (the only noticeable difference is the desktop computers. Called The Computer Forum, this larger power supply). The mother board looks almost educational institution will offer integrated courses, soft­ identical, although somewhat enlarged. The chips are all ware selection, continuing help, and customized seminars the same and the I/O slots are similar. The Franklin is to interested individuals and businesses. Course offerings delivered with Applesoft and the Apple monitor ROMs in­ will include How to Make Computers Work for You, stalled. The other principal differences are that the Franklin Using Your Apple, Programming in BASIC, Data Bases, accepts and displays lower case and has no color capabili­ Using Business Graphics, The Electronic Spreadsheet, Ad­ ties, soon to be remedied according to the manufacturer. vanced VisiCalc Techniques, and Management and Having lost the preliminary injunction ruling against Analysis Using VisiCalc. The Forum has several class­ Franklin, Apple is asking for a reconsideration due to a rooms, one for each system. Currently, only the Apple similar case that ruled in favor of the manufacturer. room is fully equipped, but plans call for an IBM PC room Apple's position is that object code is copyrightable, and and possibly a XEROX room. Sign-up for the first schedule therefore proprietary and not usable by others. of courses has been brisk. We wish the Forum much suc­ Just to make the issue more complicated, Franklin is cess and hope that additional centers can be opened around suing Apple for price manipulation and threatening Apple the country. JMCBO dealers who want to carry Franklin products. Also pushing on the retail price are the Far East imita­ tions, yet to be seen in the U.S., which are selling at one- Statement of ownership, management, etc., required by the act of Congress of October 23, 1962, of MICRO, published monthly at fifth the normal European selling price. Chelmsford, Massachusetts, for November 1982. The name and address of the publisher is MICRO INK, 34 • •• Chelmsford Street, Chelmsford, Massachusetts. The President/ Editor-in-Chief is Robert M. Tripp of Chelmsford, Massachusetts. There are rumors that the Mackintosh (also from Apple), a The owner is THE COMPUTERIST, Chelmsford, Massachusetts cheaper, simpler version of Lisa, is still in the develop­ and the names and addresses of stockholders owning or holding one percent or more of the total amount of stock are: Robert M. mental stage and is not expected until the end of next year Tripp and Donna M. Tripp of Chelmsford, Massachusetts. at the earliest. The known bondholders, mortgagees and other security holders owning one percent or more of the total amount of bonds, mort­ • •• gages or other securities are: none. The average number of copies of each issue of this publication MICRO Bulletin Board sold or distributed through the mails or otherwise to paid subscribers during the twelve months preceding the date shown above is: 23,292. MICRO has instituted a sophisticated Bulletin Board/ Information Service System on our Apple II, which will be I certify that the statements made by me above are correct and complete. available to subscribers Monday through Thursday nights Signed: Robert M. Tripp from 5:00 PM to 8:00 AM Eastern Time. The MICRO President/Editor-in-Chief is using software developed by

No. 55 - December 1982 MICRO - The 6502/6809 Journal 35 PIE WRIliR.

Just how functional: is P IE W R IT E R ? PEELINGS II Magazine did just that Try these with any other word processor: against 9 others. And PIE WRITER came out on top, rated AA+. s r Character, word, line and paragraph editing ; Global word search and replace Why? Because PIE W RITER does every­ ; e Automatic centering thing a writer needs done, quickly, easily and Justify right and left plus incremental inexpensively If you can type, even with just spacing two fingers, you’ll be working comfortably < " “Help” screen for quick reference with PIE within fifteen minutes. v * Cut and paste Begin immediately typing text onto the Automatic wrap around screen. You can add or delete characters, i Forward and backward page scrolling words... sentences... paragraphs with ^ - Custom form letters and mailing lists one simple key stroke. ' J Full format control Misspellings? PIE W RITER’S “search and V s5 Status display replace” command corrects the word where Full control over page numbering, bottom you spot it... and then makes it correct and top headers throughout the entire text—be it a paragraph Save a segment of text on another file or a million dollar presentation. ^ ' Insert text from another file When your document is finished, a touch of ^ Underlining the key will print out 1 or 99 copies. .. in the > " Control page breaks format you want... neat, precise and always • Tabbing by word or moveable tab marks accurate. ^ Built-in training lessons ; " And Pie Writer’s comprehensive, indexed manual and quick reference card make it Y ou can start using PIE W RITER on your easy to use; it is very writer-friendly basic Apple II system the moment you get it home. Nothing extra to buy. But you’ll never outgrow PIE because it works with just The best word processor available: about anything you might want to add: PIE WRITER. For • 80-column boards • shift-key modification you just can’t afford to buy anything else. • lower case adapter • spelling checker • hard disks • VisiCalc* files All you need to start is an Apple II with • modems • program source files 48K, 3.3 DOS, one disk drive, a monitor and printer. “VisiCalc is a registered trademark of VISICorp Available at your local computer store, or call 1-800-343-1218 (in MA, call 617/937-0200) HAYDEN It’s All Relative— CBM Disk Techniques, Part I

by Jim Strasma

Contributing editor Jim Strasma process, I will: 1. show how to mix loaded. If not, MEMSIZ, the zero-page begins a series that explains BASIC and machine language, 2. have location that controls top-of-memory how to get the most from CBM’s one program load another without stop­ pointers, is lowered along with powerful disk operating system. ping or losing variables [called chain­ FRETOP, the top-of-dynamic strings Examples are drawn from a well- ing] , and 3. explain the use of global pointer. (On the VIC, MEMSIZ is at written mailing list package that variables (called soft coding ]. $37 and FRETOP is at $33.) is both inexpensive and widely Because of the general availability The two POKEs protect the available. In Part 1 Jim covers of Bennett's "Mail List," a full listing machine code from BASIC's dynamic global variables, combining will not be presented here. However, string variables. Note that if only BASIC with machine language, you don't need the program to under­ MEMSIZ were altered, BASIC would and chaining of program stand the articles. If you do wish to think it had a negative amount of modules. obtain the program, see the box on memory free. Since changing these page 41. pointers ruins any variables already in the top of memory, it is essential to do Editor’s Note: To implement all of Mixing BASIC and it only at the beginning of the first pro­ these techniques you should have a Machine Language gram module. DOS 2.0 (or later) disk drive. BASIC 4.0 One of the more difficult tasks in is also assumed. However, ways to programming is mixing BASIC and 1030 REM LOAD OBJECT PORTION emulate BASIC 4.0 disk commands machine-language code gracefully. IF HAVEN’T from Upgrade BASIC and VIC BASIC When first released, the mail list used 1040 IF PEEK(31232) < > 76 THEN are summarized. one common method, reading the POKE 53,122:POKE 49,122 machine-language portion from data :DLOAD "OBJECT CODE" One of the best features of Com­ statements and POKEing it into work­ modore's BASIC 4.0 and DOS 2 is its ing locations. This method easily After resetting the memory use of relative records for data files. allows changes to the BASIC program. pointers, line 1040 loads the machine- This is a very powerful technique, not However, if the machine-language por­ language portion from disk as a pro­ well matched by competing computers tion is sizeable it can be slow; incor­ gram named "object code." Usually in Commodore's price range. However, porating substantial changes from a loading a new program destroys the old relative records can be quite confusing, new assembly of the machine-language one, but not this time. "Object code” and though they have been around for portion would be tedious at best. loads very high in memory, beginning two years now, are largely used in com­ Next, I tried attaching the machine- at location 31232, ($7A00). It will over­ mercial programs. However, there is language portion to the end of the write anything else up there, such as one large program package freely BASIC code and using a machine- Universal DOS support, but not BASIC available that uses relative records — language SYS call to boot it into work­ programs located lower in memory. Chris Bennett's "Mail List 4040." In ing location. This method is fast. How­ Since the DLOAD command was one form or another it has been around ever, it makes modifications to the part of a running program, BASIC at­ for about two years. For much of that BASIC program difficult, as any change tempts to execute "object code” as time I have been modifying and in the length of the program also moves soon as it is fully loaded. However, documenting it. the machine code, guaranteeing a crash BASIC assumes its programs begin With the help of the mail list, this when the new version is used. where another pointer, TXTTAB series of six articles will thoroughly Now I use a small trick to load the points. In this case, we've left it alone. explain the use of relative records. It machine-language portion separately This means that BASIC will execute will also cover some programming from the BASIC part. This method is "m ail list 4040” again. That is the techniques for large packages and a quick and allows easy changes to both main reason for checking to see machine-language program that takes the BASIC and machine-language por­ whether "object code" has already much of the drudgery out of data entry tions of the program. been loaded. Otherwise we would programming. Line 1040 checks to see whether a never get past line 1040. In this first article I will prepare the key location contains the value it does After the load the IF test in line computer to run the mail list. In the when the machine code has been 1040 fails and the program continues.

No. 55 - December 1982 MICRO - The 6502/6809 Journal 37 Chaining Don’t make program changes to any For reasons that make sense only to Line 1060 is another line that must module after loading it via a chain. Commodore, Fat 40’s, (the 4016 and appear at the beginning of the first pro­ BASIC no longer knows the module's 4032 with 12” monitor), are adjusted gram module. For program chaining to true size. Instead, reload the module on the assembly line so that printing work correctly, we must either make from disk in immediate mode and then CHR$(14] zooms the top and bottom the first program the largest one, or else make the changes. This is especially lines off the screen. The IF test in line convince BASIC that this is so. We important if you have used line 10 1090 prevents this. However, there is could do this by adding dozens of long above. EAL isn't changed by line also a hardware fix. On the underside of lines to the program as ballast. How­ editing. If EAL points lower than the the video display board is a hole labeled ever, this would add to its loading end of a modified BASIC program, line "height.” Your dealer can adjust your time, and take up more storage space 10 would force the variables to begin display in about 30 seconds to restore on the disk. I have only followed that being stored on top of the last lines, the lost top and bottom lines per­ idea to the extent of coding this module ruining them. To prevent such dis­ manently. If you do it yourself, remem­ very loosely, with mostly single-state­ asters, it’s always a good idea to save a ber that metal screwdrivers are good ment lines and lots of REMark state­ modified program to disk before trying conductors and the video board carries ments. The added clarity is worth the to run it. 10,000 volts. One slip could do more slight waste. I also started with line The actual chaining happens in line than violate your warranty. number 1000 to keep all line numbers 2060: The CHRS(14) is especially needed the same length, again for clarity. by 80-column models. If you leave it In early versions of the mail list, 2060 DLOAD D(PD), "4040 MENU” out and the machine was previously in chaining worked by altering the file ON U(UN) graphic mode, lines will appear squished size pointer, VARTAB at location 42 together. ($2A), as each module began. This For BASIC 2.0 and the VIC use: The matching lines to enable the worked because BASIC keeps track of graphic character set are: the actual file size in pointer EAL, at 2060 LOAD STR$(PD) + “ :4040 location 201 ($C9), during a load. [On MENU” ,UN 1070 REM SET GRAPHIC MODE VIC, VARTAB is at $2D and EAL is at 1080 POKE 59468,12 $AE.| We simply had a line like the one Soft Coding 1090 PRINT CHR$(142) below at the start of each module. Notice the variables used in line 2060 above: PD and UN (program drive Leaving out the CHR$(142) on 10 POKE 42,PEEK(201):PC)KE 43, and disk unit number]. They are set 80-column models leaves them with a PEEK(202):CLR earlier in the program, in lines 1220 Venetian blind effect, separating lines and 1230: of graphic characters. No Fat 40 fix is Unfortunately, it won't work without needed this time. (Line 1080 should the CLR, and once CLR is used, the old 1220 UN = 8:REM DISK UNIT still be omitted on the VIC.) variables are gone. This means that a 1230 PD = 0:REM PROGRAM DRIVE Always establish one character set separate disk file has to be established or the other at the start of any program and loaded by each module to remem­ By setting them there and using package. CBM models start up in text ber global variables, or the variables only the variable names everywhere mode, but PET models start in graphic have to be hidden from BASIC and else in the program package, it is easy mode. PEEKed. Either method is slow. to change the package to work with dif­ By POKEing VARTAB with a value ferent equipment, such as a disk drive at least as large as it would need to run that answers to device 9 instead of 8. Initialization the largest module, we can use line We will have more to say about soft At this point the machine is ready. 1060 instead of line 10, and need it only coding shortly, but first we need to The machine-language portion is in and in the first module. finish setting up. protected. The file pointers have been set for successful chaining and the 1060 POKE 42,0:POKE 43,53:CLR Setting Text Mode character set is correct. Now the pro­ One other task awaits us in prepar­ gram begins a long process of initial­ To determine the correct values to ing the machine. Commodore com­ izing variables. Because this takes use here, load the longest module in puters have two character sets, one for about five seconds, it is wise to give the your program, and enter: graphics and one for upper- and lower­ user something to look at meanwhile. case text. Since this program uses text, The mail list starts with a copyright ?PEEK(43) we must enable the text character set. message and then a status line: A method that works for all CBM and Add two to the result and write it PET models is given in lines 1080 and 1200 PRINT” INITIALIZING down. Use that number in place of 53 1090 below. (On the VIC, leave out line in line 1060. Note that we could have 1080.] This assures the user that the program also PEEKed at 42, but I prefer to 1070 REM SET TEXT MODE hasn't died. If the delay will be more overstate slightly the required 1080 POKE 59468,14 than half a minute, also give the user memory. This allows minor additions 1090 IF PEEK(57345) < > 54 THEN an estimate as to how long the task to that longest module without also re­ PRINT CHR$(14):REM UNLESS should take and an occasional progress quiring a change here. FAT 40 report.

38 MICRO - The 6502/6809 Journal No. 55 - December 1982 More on Soft Coding represent literal cursor charac­ something quite different, and the In the lines following 200 in this ters. The codes stand for one home string would be ruined. Adding the null first module, the global variables are character, followed by 23 cursor string forces it into high memory where defined. Because they are not cleared downs, followed by seven cursor rights. it is safe. by later modules, the way the entire In the actual mail list, the literal The second category of variables is package works can be modified characters are used and the codes are in illustrated by line 1830: drastically by changing a single line in a REMark statement at the end of the this module. Naturally, the other line. Always try to explain lengthy 1830 QT$ == CHR$(34) modules have to be carefully written to strings made up of cursor controls, take advantage of this power. We will especially if anyone will ever need to This is the quote character. It is needed see how this is done later in this series list your program to a non-Commodore later to allow INPUT# statements to of articles. printer. read past troublesome characters like The global variables used tend to Later lines select needed portions of . We could use CHR$(34| fall into three categories: those that the program with LEFTS, as in line everywhere instead, but CHRS is a define messages, those that define 1940: slow command in BASIC. Predefining special characters, and those that act as QT$ is at least ten times faster overall. flags to control the program. The first 1940 M2$ = LEFT$(PO$,8) + “ START Other characters the mail list pre­ category allows easy changes to such POSITION defines include RETURN, SHIFTED- things as field names or default field RETURN, and SHIFTED SPACE. We contents. These messages may also in­ However, we must be sure the will explain how each is used later in clude cursor control characters to be messages are stored in high memory this series of articles. sure they appear at the correct location where they will chain correctly. To do The third class of global variables is on the screen. To ease this task, the this, we concatenate a null string to the controllers. These include both mail list predefines a position string of each literal string in the program, as numeric and string variables, used in IF cursor controls in line 1880: shown at the end of line 1880. tests and within expressions later in If we didn't add the null string, the program. For instance, line 1210 1880 PO$= “ [HOME.23DOWN, BASIC would save space by pointing flags whether or not you want to allow 7RIGHT]“ + ” ” variable POS at its original memory the user to get out of the program by location in line 1880. After chaining, pressing STOP: The characters shown in square this location would likely contain (continued)

SIGNALMAN MARK I DIRECT CONNECT MAE SOFTWARE DEVELOPMENT SYSTEM PET BASIC SCROLL PROGRAM MODEM - $89.50 FOR PET. APPLE. ATARI Scroll thru basic program using Cursor up/down keys. Standard 300-baud, full duplex, 'The Compatible Assembler" Specify computer. $6.00 on cassette, $9.00 on disk. answer/originate. Powered by • Professional system for development of Machine Lan­ guage Programs. 31 Characters per label. long lasting 9-volt battery Inot Flip ‘N’ File diskette storage case (50-6U disks )- • Macro Assembler/Text Editor for Disk-based systems. included). Cable and RS-232 $21.95 connector included. • Includes Word Processor for preparation of Manuals, etc. • Standard Mnemonics - Ex.: LDA (LABEL), Y Memory Test for Apple on Disk $9.95, on Tape • Conditional Assembly, Interactive Assembly. EPROMS - HIGH QUALITY. NOT JUNK = $6.95 • Editor has string search/search and replace, auto line Use with PET, APPLE, ATARI, SYM, AIM, etc. 450 . $6.50 numbering, move, copy, delete, uc/lc capability. System Saver for Apple - Fan, Surge Protection, 2 for 2716, $12.50 for 2532. We sell EPROM programmers • Relocating Loader to relocate object modules. for PET and ATARI extra outlets, Apple power cord = $75.00 • Oesigned with Human Factors Considerations. 5% INCH SOFT $169.95 BMC Green Screen Video Monitor. SECTORED DISKETTES FLASH!! EHS Management has decided to allow $50.00 credit 12 inch CRT, sharp, crisp 40 or 80 column display. to ASM/TED owners who want to upgrade to MAE. To get this = $90.00 Highest quality. We use them on credit, return ASM/TED manual with order for MAE. our PETs, APPLEs, ATARIs, and other ATARI AND PET DC Hayes Smart Modem = $235.00, Micro Modem computers. $22.50/10 or $44.50/20 EPROM PROGRAMMER II = $289.00, Chronograph = $225.00 NEW! C. IT0H STARWRITER F 10 Programs 2716 and 2532 1ft C. Itoh Prowriter Printer. Better than MX80. We use DAISY WHEEL PRINTER EPROMs. Includes hardware constantly with our Apple and PET. Can be used on and software. PET = $75.00 - Letter quality, flawiess copy at 40 char/sec. Bidirectional IBM, Atari, TRS-80, etc. 120cps, friction and tractor ATARI (includes sophisticated printing, 15-inch carriage, uses standard Diablo ribbons feeds, hi resolution dot graphics, nice looking, high and print wheels. a TtS~9g~ machine language monitor) = quality construction. Parallel - $499.00, with IEEE !S 9 < $119.95 RACTDRS - $210PARALLEL - $1495, RS-232 RACTDRS - $210PARALLEL interface for commodore - $599.00, RS232 - $660.00

3239 Linda Dr. Winston-Salem, N.C. 27106 r n (919)924-2889 (919)748-8446 Send for free catalog!

No. 55 - December 1982 MICRO - The 6502/6809 Journal' 39 1210 NS = 0:REM NON-STOP? 1800 C4$ = C2$ or a PET printer, as we saw in line 1810 SYS SM,2,C4$ 1310. However, it doesn't simply If NS = 1, the program becomes non­ assume the printer is on, but goes to stop; a great idea when using untrained My personal copy of the mail list the trouble of checking, in lines operators, but a terrible idea when a carries the control variable idea a step 1350-1380: skilled user is trying to modify the further by using the variable TY to package. select between using the package as a 1300 DV = 4:REM PRINTER An example of a string variable used church mail list, a computer users' as a control is PZ$, defined in line mail list, and a sermon file, depending 1310: on whether TYpe = 1, 2, or 3 in a new line added to this module. 1340 REM BE SURE PRINTER IS ON 1310 PZ$ = “ A” :REM ASCII, P = PET The other special options set by the 1350 OPEN 4,DV global variables are explained in the in­ 1360 PRINT#4,CHR$(7);:REM BELL One of the skills of the machine- structions that come with the mail list 1370 IF ST THEN PZ$ = “ N": language portion of the package is that package, so I won't take space for them PRINT” PRINTER IS OFF it can convert strings from PET ASCII here. However, if you do get the pro­ 1380 CLOSE 4 to true ASCH codes and back again. gram, notice that all the simple vari­ This is useful when working with a ables are defined before the arrays are Line 1360 tries to print a BELL modem or a non-Commodore printer. defined. Doing things in this order cuts character to the selected printer device. Line 1760 shows how this feature is the initialization delay by 2.5 seconds. If it succeeds, the IF test of the status used or skipped, depending on the con­ Further speed gains are possible by ar­ variable will fail in line 1370. Other­ tents of PZ$: ranging the lines so the most-used wise, a warning is printed and the variables and arrays are defined before printer control variable is set to show 1750 REM FLIP CASE OF ASCII those used less often. The ones most no printer is on line. This allows users PRINTER PROMPTS heavily used are usually inside nested without a printer to safely use the 1760 IF P Z$< > “ A" THEN 1830 loops and often-used subroutines. package. 1770 SYS SM,1 ,NA$ A similar technique is used in lines 1780 C3$ = C1$ Using Program Intelligence 1250-1290: 1790 SYS SM,2,C3$ The program selects either an ASCII (continued)

P E T/C B M ™ SOFTWARE SELECT!

8 0 3 2 o r 4 0 3 2 Quit Playing Games . . . Disk Based Software to Make Your DISPLAY DISPLAY Computer Get Down to Business Disk Based Data Manager—Create and manage your own FROM THE KEYBOARD OR PROGRAM data base. Allows you to create, add, change, delete, search, sort, print, etc. Available for VIC-20, Commo­ NOW RUN WORD PRO 3 OR WORD PRO 4 dore 64, any CBM or Pet, and IBM Personal Computer. VIC-20 59.95 All others 79.95 Inventory Control Manager—Fast, efficient inventory FROM THE SAME MACHINE package which will manage your day to day Inventory requirem ents. Provides in fo rm a tio n on sales and movement of items. Available for either 4000 or 8000 Series M a ilin g L is t Manager—4,050 item s per SOSO disk, 1,300 on 4049 d isk and 1,200 on 1540/1541 disk. User defined ALSO: label form at (1—4 ) across. Payroll System—Full featured complete Payroll System. Up to 350 em ployees on a 8050 disk. P rints checks, 941 ‘s For 2001 / 3000 Series Computers and W-2's. For the CBM 8032/8050, 4032/4040, Commo­ dore 64 A M I . Operate these Models in a Full 8 0 3 2 Like Hospitality Payroll—The most complete payroll system written specifically for the Restaurant Industry available Display For Word Pro 4* today. Recognizes tip and meal credits, pay advances, salaried and hourly employees, etc. For the CBM and all other 80 Column Software 8032/8050. All installation instructions included. CONTACT US FOR ALL YOUR DISK BASED SOFTWARE NEEDS Call for specifics on Hardware Configurations. Send Self-Addressed Stamped Envelope for EXECOM CORP. Catalogue of Games and other Applications 1901 Polaris Ave. DEALER INQUIRIES WELCOME Racine, Wl 53404 Ph.414-632-1004 2905 Ports O'Call Court Plano, Texas 75075 PET/CBM a trademark of Commodore Business Machines (214) 867-1333 ‘ trademark of Professional Software, Inc. VISA and MASTERCARD Accepted

40 MICRO - The 6502/6809 Journal No. 55 - December 1982 1240 REM SELECTS DATA DRIVE speed and a great cost in clarity.) 1250 DD = 1 Next time we will begin working STATISTICS 1260 OPEN 15,UN,15 with relative records — creating the 1270 PRINT#15,"INITIALIZE” + files needed by the mail list package. PURE AND SIMPLE STR$(DD) 1280 IF DS = 74 THEN DD = 0:REM IF AlCftO SINGLE DRIVE 1290 CLOSE 15

As these lines initialize disk drive one, How to Obtain Human Systems Dynamics programs offer you they identify single drive units and flexibility, accuracy, and ease of use. You can prepare the program to work with Bennett’s “ Mail List” purchase from the HSD statistics specialists Many users' groups will have this either single or dual drives. with complete confidence. Any program that program in their libraries. It is also doesn't suit your needs can be returned within An earlier version of the program available from ATUG (200 S. Cen­ 10 days for full refund. had the user select one or two drives tury, Rantoul, IL 61866), TPUG (381 manually by changing line 250. How­ Laurence Ave W., Toronto, Ontario NEW ever, I use both single and dual drives M5M 1B9, Canada), or from the STATS PLUS $200.00 often, and decided it made more sense author as part of his HELP disk. The to let the computer use its own in­ HELP disk is a companion to the Complete General Statistics Package Research Data Base Management telligence to work with all Commodore third edition of Osborne/McGraw- Hill’s CBM and PET Computer Design and Restructure Your Files disk drives. This kind of intelligence in Count, Search, Sort, Review/Edit Guide (edited by the author). a program means more work for the Add, Delete, Merge Files To obtain the HELP disk send programmer once,"but less work for all Compute Data Fields, Create Subfiles $15 to the address below. Specify Interface with other HSD programs the users for years to come. Programs 4040/2031 or 8050 format. Produce Hi Res bargraphs, plots you expect to give or sell to others HELP Disk 1—5 way Crosstabulation should work on all existing and likely Jim Strasma Descriptive Statistics for all Fields models. (If I followed that advice fully, 1280 Richland Ave. Chi-Square, Fisher Exact, Signed Ranks Mann-Whitney, Kruskal-Wallis, Rank Sum this program would have used BASIC Lincoln, IL 62656 Friedman Anova by Ranks 2.0 disk commands, at some cost in 10 Data Transformations Frequency Distribution Correlation Matrix, 2 way Anova r, Rho, Tau, Partial Correlation WHAT’S WHERE IN THE APPLE, 3 Variable Regression, 3 t-Tests A Complete Guide to the Apple Computer ANOVA II $150.00 This REVISED EDITION of the “ “ * - Complete Analysis of Variance Package famous Apple Atlas provides Apple Analysis of Covariance, Randomized Designs computerists with a framework for APPLE Repeated measures Designs. Split Plot Designs un>ler!>tanding both the overall 1 to 5 Factors, 2 to 12 Levels Per Factor organization and structure of the Equal N or Unequal N, Anoua Table Apple system and programming Descriptive Statistics, Marginal Means techniques that exploit that Cell Sums of Squares, Data File Creation Data Review/Edit, Data Transformations knowledge. File Combinations, All Interactions Tested Wftaf’s Where In the Apple contains High Resolution Mean Plots, Bargraphs the most complete memory map p»er published as well as detailed $ 9 9 .9 5 information needed for actual □ HSD REGRESS programming A Guide to Complete Multiple Regression Analysis Up to 25 Variables, 300 Cases/Variable All for only $24.95 Correlation Matrices, Descriptive Statistics (plus $5 00 s/hl Predicted & Residual Scores, File Creation Regression on Any Subset of Variables For owneis of the original edition, MICRO makes it easy to order? Regression on Any Order of Variables MICRO is offering a companion Hi-Res Scatterplot & Residual Plot book, THE GUIDE to What's Where Send check to: Keyboard or Disk Data Input In the Apple, for only S9.95 (plus M IC R O IN K Case x Case Variable x Variable Input $2.09 s/h) P.O. Box 6502 Apple II, 48K 1 or 2 Disk Drives TH E G U ID E contains all new 3.3. DOS, ROM Applesoft material that explains and Chelmsford, MA 01824 Call (213) 993-8536 to Order demonstrates how to use the atlas and gazetteer published in the Or call our toll-free number: or Write: oriqinal volume of What's Where in HUMAN SYSTEMS DYNAMICS the A pple* 1-800-345-8112 9249 Reseda Blvd., Suite 107 (In PA, 1-800-662-2444} ' Northndge, CA 91324^ VISA VISA and MasterCard accepted MA residents add 5% sales tax

No. 55 - December 1982 MICRO - The 6502/6809 Journal 41 Squeeze for PET BASIC Program

by Hans Hoogstraat

This short routine removes the 65 : 3. Type SYS4, which will display (4.0 unnecessary spaces, REMs, and 70 I = 1:::B = 1:: REM NONSENSE ROM) blank lines from a BASIC 75 : PC IRQ SR AC XR YR SP program. It is relocatable and 80 END • ; 0005 E455 30 00 5E 04 F0 does not require maintaining 4. Type .M 002A 002B to display the two versions of the BASIC After the SYSXXX squeeze call, the start-of-BASIC variables pointer, program. program continues execution with the which is usually the same as the following BASIC code: end-of-BASIC text pointer. Assume the following display from the above 10 SYSXXX command: SQUEEZE 30 PRINT'EXAMPLE PROGRAM" .M 002A002B requires: 40 FORI = 1T010 .; 002A 4B 04 4B 04 4B 04 00 80 PET/CBM — original, upgrade, 45 PRINTI,SQR(I) 5. Now, to save the BASIC program and or 4.0 ROMs 50 NEXT the SQUEEZE routine together on 60 I FI < > 0THEN80 disk assuming SQUEEZE was loaded 70 I = 1:8=1 in the first cassette buffer, type This routine squeezes all the imbedded 80 END blanks, line separators, and comments .S “ 0:EXAMPLE” ,08,027A,044B from a BASIC program. In addition, the Cautions: following syntax corrections are made: 1. Do not use SYS XXX; any blanks 027A = Start address of first cas­ 1. GO TO ...... = GOTO between SYS and XXX can confuse sette buffer. 2. IF ...... GOTO = IF .. THEN the BASIC run-time pointers. 044B = Contents of end-of-BASIC 3. IF .. THEN GOTO = IF .. THEN 2. Any GOTO, GOSUB, or THEN text pointer as displayed in SQUEEZE is relocatable and can be references to REM-commented lines locations $002B-$002A. stored in either cassette buffer. It is or : null lines will become erroneous For tape use 01 instead of 08. designed to be called with a SYS com­ due to the deletion of these lines. mand in the first line of your BASIC (Ed. note: SQUEEZE does not handle General Information program. This means that you need to these references.] All CBM system labels references store only one copy — fully com­ SQUEEZE can be loaded into the are consistent with the labels specified mented and expanded — of your pro­ first or second cassette buffer and can in Appendix F of the PET/CBM Per­ gram on tape or disk. When you run the then be permanently saved with the sonal Computer Guide by A. Osborne. program, it is automatically com­ BASIC program using the machine- Hexadecimal dumps of the routine pressed first. language monitor SAVE command, or assembled for the three different ver­ it can be made part of the program with sions of the PET ROMs are included in BASIC Example Program: DATA statements containing the this article. (XXX = ADDRESS OF SQUEEZE machine-language code to be transfer­ With some minor pointer modifica­ ROUTINE) red to a suitable spot in memory using tions, the SQUEEZE routine should alsc POKE commands. operate on most other 6502 systems. 10 SYSXXX Here is the procedure to save a 15 : BASIC program with SQUEEZE in the 20 REM EXAMPLE PROGRAM cassette buffer. (Original ROM: use 25 : first cassette buffer — $027A - $0339; 30 PRINT “ EXAMPLE PROGRAM” upgrade ROM: use either cassette buf­ 35 : fer — $027A - $0339 or $033A - $03F9; Hans Hoogstraat is a scientific research 40 FOR I = 1 TO 10 4.0 ROM: use second cassette buffer and— systems development software and 45 :::PRINT I, SQR(I)::REM ROOTS $033A - $03F9.| hardware consultant to the petroleum in­ 50 NEXT dustry. You may contact him at Box 20, 1. Load SQUEEZE routine into correct Site 7, SS 1, Calgary, Alberta, Canada 55 : buffer. T2M 4N3. 60 IF I < > 0 THEN TO TO 80 :: 2. Type NEW and load BASIC program.

42 MICRO - The 6502/6809 Journal No. 55 - December 198! Listing 1: SQUEEZE Assembled for 4.0 ROMs 0010 ; SYSTEM EQUATES TURN AN EPSON PRINTER 0020 0030 BASIC . 01 1 ^ORIGINAL ROM INTO A DAISY. . . 0 0 4 0 jB R S IC .D I 3 ; UPGRADE ROM 0050 jBASIC. .01 4 ? BAS IC 4 .0 0060 } with the 0070 BASIC .DI 4 SUPER-MX CARD 0 0 8 0 ; 005*0 ------for the APPLE II. 0 1 0 0 ; ------S Q U E E Z E ------0110 ------The standard of printing excellence is the 0120 t daisy-wheel printer. The SUPER-MX card 0130 :THIS ROUTINE SQUEEZES A BASIC PROGRAM FROM ALL ITS 0 1 4 0 IMBEDDED BLANKS, L IN E SEPARATORS AND COMMENTS. provides the Epson printers with just 0150 ; about the same quality print as the 0160 JIN ADDITION THE FOLLOWING SYNTAX CORRECTIONS ARE MADEi 0 17 0 daisy-wheels! 0 1 8 0 ?1 . GO TO ...... * GOTO 015*0 y Z . I F ...... GOTO = IF . . THEN SUPER-MX Roman fo n t is 0 2 0 0 ; 3 . I F . . THEN GOTO = IF . . THEN 0210 ; the standard. 0220 .»BASIC REFERENCES. Epsons can now print E lite 0 2 3 0 s 0 2 4 0 IFE BASIC-1 with the SUPER-MX card. 0250 BPOINT . D I * 7 A 0 2 6 0 WORK . D I *A 6 Other optional font styles are available 0270 LNKPRG .D E *C 4 3 0 in addition to the standard Roman font 0 2 8 0 0 2 9 0 that just plug into the extra sockets pro­ 0 3 0 0 IFE BRSIC-3 vided. They come in pairs so you can add 0310 BPOINT . D I * 2 3 0 3 2 0 WORK . D I * 5 4 a total of four extra fonts. Orator Large 0330 LNKPRG . DE *C 4 4 2 comes with Letter Gothic. Script comes 0 3 4 0 0 3 5 0 ; with Olde English. 0 3 6 0 IFE BftSIC-4 i s 0370 BPOINT .01 *28 LETTER GOTHIC 0 3 8 0 WORK . D I * 5 4 modern Iook i n g . 0390 LNKPRG .DE *B4B6 0 4 0 0 ORATOR is easy to read 0 4 1 0 ; 0 4 2 0 .B A BPO INT and 9ood for speeches. 0 4 3 0 ; 0G C 8- 0440 TXTTAB .OS 2 ; POINTER TO START OF B A S IC SCRIPT adcLe> *.he 0 0 2 A - 0450 VARTAB .OS 2 ?POINTER TO START OF VAR. pesLbcmaJi A.ouch. 0 0 2 C - 0460 ftRYTAB .DS 2 sPNTR TO START OF ARRAY TA 0 0 2 E - 0470 STREND .D S 2 ; POINTER TO END OF VAR. (0CD£ CNSOSH is very 0 4 8 0 ; 0 4 9 0 : PAGE ZERO WORK AREAS. formal anti elegant . 0 5 0 0 0 5 1 0 .B A WORK 0 5 2 0 ; 0 0 5 4 - 0530 INPPTR .D S 2 ; INPUT LINE POINTER. 0 0 5 6 - 0540 NXTLIN .DS 2 JNEXT BASIC LINE ADDRESS 0550 OUTPTR . D I VARTAB ; OUTPUT LINE POINTER. 0 0 5 8 - 0560 INPIND .DS 1 ; INPUT TEXT INDEX. 0 0 5 9 - 0570 OUTINO .DS 1 jOUTPUT TEXT INDEX. 0 0 5 ft- 0 5 8 0 GUTSEG .D S 1 ; OUTPUT L IN E SEGMENT LENGT 0 0 5 B - 0590 QTFLAG .OS 1 ;QUOT FOUND FLAG. Apple Hi-Res graphics is fully sup­ 005C- 0600 PRVOUT .DS 1 jPREVIOUS OUTPUT CHARACTER 0050- 0610 IFFLRG .D S 1 ; I F TOKEN FOUND FLAG. ported with a wide variety of commands 0 6 2 0 ; including: double dumps (both pages 0 6 3 0 RAMLOC . D I * 4 0 0 ;START BASIC TEXT 0 6 4 0 ; side by side), dump from page 1 or 2, 0650 ?BASIC TOKEN EQUATIONS. double size, emphasized, rotated, strip 0 6 6 0 ; 0 6 7 0 GOTOTK . D I * 8 9 sGO TO chart recorder mode, and text screen 0680 IFTK .01 *8B ; IF dump. 0690 REMTK .DI *8F ;REM 0700 TOTK .DI *A4 ;T 0 The two expansion sockets allow 0710 THENTK .DI *A7 THEN EPROM expansion to 12K to insure you 0 7 2 0 GOTK . D I *C B • GO 0 7 3 0 ; that the SUPER-MX card will remain the most intelligent interface around. 0 7 5 0 ; An Epson MX-80 needs Graftrax or 0760 .BA *33A 0 7 7 0 • Graftrax-Plus. An MX-100 requires Graf- 0730 :SET BASIC OUTPUT LINE ADDRESS POINTER. trax-Plus. Warranty is 90 days. 0 7 9 0 ? 0 3 3 A - A9 01 0800 SQUEEZE LDA #LrRAMLOC+l 0 3 3 C - 8 5 2A 0 8 1 0 STA *0UTPTR SUPER-MX card with cable ___ $175.00 033E— H0 04 0820 LDY #HrRAMLOC+l Orator and Letter Gothic Fonts .. $30.00 0340- 84 2B 0830 STY *OUTPTR+l 0 8 4 0 ; Script and Olde English ...... $30.00 0850 :SET BASIC INPUT LINE ADDRESS POINTER. 0 8 6 0 ; Cash, cashiers check or money order. 0342- 85 54 0870 NEXTLIN STA *INPPTR Personal checks will require 2 weeks to 0 3 4 4 - 84 55 0 8 8 0 STY #INPPTR+1 0 8 9 0 ? clear. California residents add 6!6% 0900 ;RESET ALL BASIC SCAN LINE FLAGS. sales tax. 0 9 1 0 : 0 3 4 6 - A0 00 0 9 2 0 LDY # 0 Spies Laboratories 0348- A2 00 0930 LDX # 0 (pronounced “speez”) 0 9 4 0 • 0 9 5 0 ^COPY B A S IC L IN K AND L IN E NUMBER FROM INPU T TO OUTPUT. P.O. Box 336 0 9 6 0 ; Lawndale, CA 90260 034A- B1 54 0970 COPVLNK LDfl ,Y 0 3 4 C - 91 2A 0 9 8 0 STA <0UTPTR> (213) 644-0056 0 3 4 E - 9 9 56 00 0990 STA NXTLIN,Y (Continued on next page) Apple II is a TM of Apple Computer, Inc. Graftrax is a TM of Epson America, Inc.

No. 55 - December 1982 MICRO - The 6502/6809 Journal 43 commodore

Listing 1 (continued)

0 3 5 1 - 9 6 5A 1000 STX ♦OUTSEG, V Announcing 0 3 5 3 — 1010 IN V - 0 3 5 4 - C0 04 1020 CPV #4 0 3 3 6 - 9 0 F2 1030 BCC COPYLNK THE GUIDE 1040 ) 1050 ------CARRV SET A Complete Guide 1060 j 1070 jSET START BASIC INPUT AND OUTPUT TEXT INDEXES. to the Apple Computer 1080 ) 0 3 5 8 - 84 58 1090 STY ♦ IN P IN D 0 3 5 A - 84 59 1 100 STY ♦OUTIND 1 110 ; 1120 ; CHECK FOR END OF B A S IC TE XT. 1130 ; 0 3 5 C - A0 01 1140 LDY t t l 0 3 5 E - B1 2A 1150 LDA< OUTPTR>,Y 0 3 6 0 - D0 16 1160 BNE SCAN 1170 1180 ; ADJUST START OF VARIABLE ADORESS. 1190 } 0 3 6 2 - A2 03 1200 LDX#5 121 0 0 3 6 4 - fi4 28 1220 LDY♦VflRTAB-M 0 3 6 6 - fi5 2A 1230 LDA ♦VARTAB 0 3 6 8 - 6 9 01 1240 ADC ttl ;WITH CARRY SET » ADC tt2. 0 3 6 ft- 9 0 01 1250 BCC CLR 036C- ce 1260 I NY - 1270 ; 1280 ; PERFORM BA SIC CLR 1290 } 0 3 6 0 - 94 2A 1300 CLR STY ♦OUTPTR.X 0 3 6 F - CA 1310 OEX - 0 3 7 0 - 9 5 2A 1320 STA ♦•GUTPTRX 0 3 7 2 - CA 1330 OEX - 0 3 7 3 - 10 F8 1340 BPL CLR If You Own the Original 1350 j 1360 jFIX BASIC L IN K S AND RETURN TO CALLER. What’s Where in the 1370 0375- 4C B6 64 1380 LINK JMP LNKPRG APPLE? 1390 1400 You Will Want 1410 1420 ;SCAN BASIC INPUT TEXT LINE. 1430 THE GUIDE 0 3 7 8 - A4 58 1440 SCAN LDY *IHPINO ;.GET AN INPUT TEXT CHARA( A Complete Guide 0 3 7 A - B1 54 1450 LOA ,Y 0 3 7 C - E6 58 1460 INC ♦ IN P IN O t BOOST INPU T TEXT IN D E X . to the Apple Computer 1470 0 3 7 E - A6 5B 1480 LDX ♦QTFLAG ; B A S IC QUOT FOUND FLAG Of only $9.95* 0 3 8 0 - D0 45 1490 BNE OUTTEXT ; YES . . COPY ALL TEXT CHI 1500 The Guide provides full explanatory 0 3 8 2 - C9 20 1510 CMP t t ' ; TEXT = BLANK ? 0 3 8 4 - F0 F2 1520 BEQ SCAN ; YES . . IGNORE BLANKS. text to lead you through the most 1530 ; complete Apple memory map ever 0 3 8 6 - C9 8F 1540 CMP ttREMTK ;T E X T = REM ? 0 3 8 8 - D0 01 1550 BNE CKSEG ;NO ... NEXT CHECK. published! 1560 0 3 8 A - 8A 157 0 TXA - ; YES . . FORCE E N O -O F -L IN I The Guide explains and 1580 demonstrates how to use the atlas 038B- C9 3fl 1590 CKSEG CMP t t ' : ; END OF TEXT L IN E SEGMEK 0 3 8 D - 0 0 0B 1600 BNE CKEOL ;NO ... NEXT CHECK. and gazeteer published in the 161 0 original volume! 162 0 ; ------CARRV SET ------. 1630 ; If you missed the first edition of 0 3 6 F — 86 50 1640 STX • IFFLAC- ;YES .. RESET IF FLAG. 1650 • What’s Where in the Apple?, a new 0 3 9 1 - R4 5A 1660 LOY ♦•OUTSEG ; ANY SEGM. CHARS. ON OUTi revised edition containing BOTH the 0 3 9 3 - F0 E3 1670 BEQ SCAN ;NO ... IGNORE SEGM. SEPl original atlas and gazeteer AND the 1 68 0 0 3 9 5 - CA 1 69 0 OEX - ;V E S . . TRIGGER ZERO SEC all new Guide is available in one 0 3 9 6 — 86 5A 1 70 0 STX ★OUTSEG 256-page, Wire-O-Bound book for 1710 1720 • ------CARRV S T IL L SET ------. only $24.95! 1738 0 3 9 8 - 90 A8 1740 N E X T L IN J BCC N E X TLIN ;LONG JUMP ACCOMODATION. MICRO makes it easy to order: 1750 0 3 9 A - AA 1760 CKEOL TAX - TEXT = END-OF-LINE ? Send check (payable to MICRO) to: 0 3 9 B - F0 2A 1 770 BEQ OUTTEXT ? VES . . COPY E O L-TEX T CH 1780 0 3 9 0 - E6 5A 1 79 0 INC ♦OUTSEG siN C R . OUTPUT SEGMENT CH MICRO INK 1800 0 3 9 F - A4 5C 1810 LOY ♦PRVQUT jGET PREVIOUS OUTPUT CHA P.O. Box 6502 1820 0 3 A 1 - C9 SB 1 83 0 C K IF CMP ttlF T K ;TEXT = IF TOKEN ? Chelmsford, MA 01824 0 3 A 3 - 0 0 02 1840 BNE CKGO ?NO ... NEXT CHECK. Call our number: 1350 toll-free 0 3 A 5 - 8 5 50 I8 6 0 ST A ♦ IFFLA G j FLAG HAPPENING. 1870 1-800-345-8112 0 3 A 7 - C9 CB 1 88 0 CKGO CMP ttGOTK j TEXT = GO TOKEN ? (In PA, 1-800-662-2444) 0 3 A 9 - 00 82 1890 BNE CKTO ;NO ... NEXT CHECK. 1900 VISA and MasterCard accepted 0 3 A B - A9 89 1910 LOA ttGOTOTK ; VES . . REPLACE BY GOTO 1 92 0 'Add $2.00 shipping per book. 0 3 A D - C9 R4 1930 CKTO CMP ttTOTK j TEXT = TO TOKEN ? 0 3 A F - 0 0 08 1 94 0 BNE CKIFGO ;NO ... NEXT CHECK. MA residents add 5%. 1 95 0 0 3 B 1 - C0 39 I9 6 0 CPV ttGOTOTK .jF'RECEEDED BY GOTO TKEN ’ 83-370 0 3 B 3 - F® C3 1970 BEQ SCAN ? VES .. IGNORE INPUT TO 19S0

44 MICRO - The 6502/6809 Journal No. 55 - December 19 commodore

L i s t i n g 1 (continued) 0 3 B 5 - C0 A7 1 99 0 CPV #THENTK sPRECEEDEO BY THEN TOKEN ? 0 3 B 7 - F0 BF 200G BEQ SCAN jVES . . IGNORE INPU T TO TO 2 0 1 0 0 3 B 9 - A6 50 2 0 2 0 CKIFGO LOX ♦IFFLR G ; IF TOKEN FOUND ? Our Current 0 3 B B - F0 0A 2 0 3 0 BEQ OUTTEXT : NO . . . COPY TEXT CHRRRCER 2 0 4 0 0 3B O - C9 89 2 0 5 0 CKGOTO CMP #GGTGTK .8 TEXT = GOTO TOKEN ? 03B F — 00 0b 2 0 6 0 BNE OUTTEXT } NO . . . COPY TEXT CHRRRCTE 2 0 7 0 Best-Seller 0 3 C 1 - 00 R7 2 0 8 0 CPV #THENTK sPRECEEOED 8V THEN TOKEN ? 6 3 C 3 - FO B3 2 0 9 0 BEQ SCAN ; VES . . IGNORE INPUT GOTO 2 1 00 0 3 C 5 - R 9 R7 2 1 1 0 LOR #THENTK ; VES . . REPL. GOTO BV THEN 2 1 2 0 0 3 C 7 - R4 59 21 -3© OUTTEXT LDY ♦OUT IHD ; COPY TEXT CHRRRCTER TO OU IMCftO 0 3 C 9 - 91 21=1 2 1 4 0 STA . y 0 3 C B - 5C 21 50 STA ♦PRVOUT ;SRVE RS PREVIOUS OUTPUT C 03C O - E6 59 2 1 6 0 INC ♦OUTIND ; BOOST OUTPUT TEXT INDEX. on the Apple 21 70 V o lu m e O I includes 0 3 C F - C9 22 2 1 8 0 CMP # ' " ; A B A S IC GUOT COPIED ? | DISKETTE M | 0301 - 00 04 2 1 9 0 BNE CKEND : NO . . . CONTINUE 2 2 0 0 0 3 0 3 - 45 5B 2 2 1 0 EOR ♦QTFLAG ;S E T B A S IC QUOT FOUND FLRG 0 3 0 5 - 35 58 2 2 2 0 STR ♦QTFLAG ;TCi EITHER ON OR OFF. 2 2 3 0 03D7- !=I5 5C 2 2 4 0 CKEND LDA ♦PRVOUT } END-OF-LINE RERCHED ? 0 3 0 9 - 00 9D 2 2 5 0 BNESCAN ;NO ... CONTINUE SCAN. 2 2 6 0 2 2 7 6 ,s OUTPUT TEXT LINE CLEANUP 2 2 3 0 0 3O B - C0 05 2 2 9 0 CLERNUPCPV # 5 ANY OUTPUT L IN E CHRRRCTER 0 3 0 0 - 9 0 1 1 2 3 0 0 BCC NEXT IN }NO ... DELETE LINE. 2 3 1 0 2 3 2 0 .J------CRRRY SET ------. 2 3 3 0 0 3 O F - R6 5R 2 3 4 0 LDX ♦OUTSEG ;RNV OUTPUT L IN E SEGMENT C 0 3 E 1 - D0 04 2 3 5 6 BNE NEXTOUT ;VES .. VALID LINE. 2 3 6 0 0 3 E 3 - 38 23 7G DELCHR DEV - .? DELETE LAST OUTPUT CHRRRC 0 3 E 4 - SA 2 3 8 0 TXA - 0 3 E 5 - 91 2R 2 3 9 0 STR <0UTPTR> ,r V 2 4 0 0 0 3 E 7 - 98 2 4 1 0 NEXTOUT TYR - $24.95 = 0 3 E 8 - 65 2R 2 4 2 0 ADC ♦GUTPTR jUITH CRRRY SET = +l+OU 03E R — 85 2R 2 4 3 0 STR ♦OUTPTR 0 3 E C - 90 02 2 4 4 0 BCC NEXT IN 0 3 E E - E6 2B 2 4 5 0 INC ♦OUTPTR+1 2 4 6 0 ; More than 40 new programs on 2 4 7 0 ;G ET THE NEXT BASIC INPUT LINE POINTER. 2 4 3 0 ; diskette to help you get more from 0 3 F 0 - AS 56 2 4 9 0 NEXTINLOR ♦ N X TLIN your Apple: 0 3 F 2 - fl4 5 7 2 5 0 0 LDV ♦N XTLIN +1 2 5 1 0 • Machine-Language Aids 0 3 F 4 - 18 2 5 2 0 CLC • I/O Enhancements 0 3 F 5 - 90 R1 2 5 3 0 BCC N E X T L IN J jRND CONTINUE SQUEEZING. 2 5 4 0 • Applesoft Aids 2 5 5 0 .EN • Graphics and Games • Reference Information 19 choice articles Listing 2: Version for BASIC 1.0 Listing 3: Version for BASIC 3.0 43 tested programs on diskette Original ROM Upgrade ROM1 (16 sector DOS 3.3 format)

000 ft 9 01 8 5 7 C f t 0 0 4 8 4 7 D 0 0 0 f l 9 0 1 OJ 2 f t f t ® 0 4 8 4 2 B Volumes 1 & 2 also available at $24.95' 0 0 £ 1 0 8 8 5 ft6 84 ft7 ft0 0 0 f t 2 0 0 a 8 5 5 4 8 4 5 5 f t © 0 0 f t 2 0 0 Together MICRO on the Apple 1, 0 1 0 B 1 R 6 9 1 7 C 9 9 f t 8 0 0 0 1 0 B 1 5 4 9 1 2 f t 9 9 5 6 0 0 9 6 2, & 3 provide more than 110 pro­ 8 4 5 8 0 1 8 f t C C 8 C 8 0 4 9 0 F 2 8 4 H H 0 1 S Sfl C8 C0 0 4 9 0 F 2 grams on diskette for less than 8 4 5 9 0 1 B 1 2 f t D O 1 6 0 2 0 84 ft B ftO 01 B 1 7 C D 0 1 6 0 2 0 f t © $1.00 each. No need to type in 0 2 8 f t 2 0 5 7 0 7 C 0 1 0 2 8 f l 2 0 5 f t 4 2 B f t 5 2 f t 6 9 0 1 f t 4 f t 5 hundreds of lines of code. 0 3 0 9 0 0 I C 3 9 4 7 C C f t 9 5 7 C 0 3 0 9 0 0 1 L o 9 4 2 f t C f t 9 5 2 f t 0 3 8 C f t 1 0 F 8 4 C 3 0 C 4 H 4 H H 0 3 8 C f l 1 0 F 8 4 C 4 2 C -4 f t 4 5 8 MICRO makes it easy to order: 0 4 0 8 1 f t 6 E 6 ftft f t 6 f t D D 0 4 5 0 4 0 B 1 5 4 E 6 5 8 f t 6 5 B D 0 4 5 Send check (payable to MICRO) to: 0 4 8 C 9 2 0 F 0 F 2 C 9 8 F D 0 0 1 0 4 8 C 9 2 0 F 0 F 2 C 9 8 F D 0 0 1 □ 0 C 9 3 f t D 0 8 6 5 D f t 4 0 5 0 8 f t C 9 3 f t 0 B 8 6 R F H 4 0 5 0 S f l 0 B MICRO INK 0 5 8 f t C F 0 E 3 C f t 8 6 f t C 9 0 0 8 0 5 8 5 F I F0 E3 Cft 86 5ft 9 0 f t 8 0 6 0 ftft F 0 2 f t E 6 ftC - f t 4 H E C 9 0 6 0 f lf l F 0 2 f t E 6 5 f t f t 4 5 C 0 9 P.O. Box 6502 PjCSJ 0 6 8 8 8 D 0 0 2 f t F C 9 C B D 0 0 6 8 8 B D 0 0 2 8 5 5 D C 9 CB D 0 Chelmsford, MA 01824 0 7 0 f t 9 0 7 0 0 2 f l 9 8 9 0 9 1=14 D 0 0 8 C 0 0 2 8 9 C 9 f t 4 D 0 0 S C .0 Call our toll-free number: 0 7 8 8 9 F 0 C 3 C 0 f t 7 F 0 B F f l 6 0 7 8 8 9 F 0 C 3 C 0 f t ? F 0 B F f t 6 0 8 0 f t F F 0 0 f t C 9 8 9 D 0 0 6 C 0 0 8 0 5 D F 0 0 f t C 9 8 9 D 0 0 6 C 0 1-800-345-8112 0 8 8 f t ? F0 B3 ft9 ft7 ft4 f l B 9 1 0 8 8 f l 7 F 0 8 3 1=19 f t ? f t 4 5 9 9 1 (In PA, 1-800-662-2444) 0 * 3 0 7 C 8 5 f t E E 6 I=IB C 9 D 0 0 9 0 2 f l 5 C E 6 5 9 C 9 2 2 D 0 i-i«r VISA and MasterCard accepted 0 9 8 0 4 4 5 f t D f t D f t 5 H E D 0 0 9 8 0 4 4 5 5 B 8 5 5 B f t 5 5 C D 0 0 f i 0 9 0 C 0 0 5 9 0 1 1 f t 6 H C D 0 0 f l 0 9 0 C 0 0 5 9 0 1 1 f l 6 5 f t D 0 Also available at your local computer store. 0 f t 8 0 4 y y 8 f t 9 1 7 C 9 8 6 5 7 C 0 f lW 0 4 y y 8 f t 9 1 2 f t 9 8 6 5 2 f t 'Add $2.00 shipping per book. 0 B 0 8 5 7 C 9 0 0 2 f l 5 f l 8 E 6 7 D 0 8 0 8 5 2 f t 9 0 0 2 E 6 2 B f t 5 5 6 MA residents add 5%. 0 8 8 f t 4 f t 9 I S 9 0 f t l 0 B 8 H 4 5 7 1 8 9 0 f t l A lC ftO

No. 55 - December 1982 MICRO - The 6502/6809 Journal 45 Skyles Electric Works Presents

The VicTree" .. .Leaves your new Vic (or CBM 64) with 35 additional commands. .. .Branches out to most BASIC 4.0 programs. ... Roots into most printers. New from Skyles: the VicTree, a coordinated hardware and software package that allows your Vic to branch out in unbelievable directions and makes it easier than ever to do BASIC programming debugging and to access your disk. And the new VicTree provides routines to interface the Vic to the powerful ProMet local network. 8kb of ROM — 4kb for the BASIC commands, 4kb for disk commands and interfacing to ProNet — plus 4kb of RAM for miscellaneous storage. Perfect not only for the new Vic but also for the Commodore 64. Unbelievably simple to use and to install, th< VicTree gives you all the additional BASIC 4.0 commands to allow most BASIC 4.0 programs to work on your new Vic or CBM 64. Mow only $89.95...or $99.95 complete with Centronics standard printer cable. (Cable alone $ 19.95.) Available now from your local dealer or order through your Visa or MasterCard toll free: (800) 227-9998 (California, Canada, Alaska, Hawaii: (415) 965-1735) or send check or money order directly to:

23IE South Whisman Road — 4 . •« r •* Mountain View, CA 94041 Skyles Electric Works 415 ( )965-1735 46 MICRO - The 6502/6809 Journal No. 55 - December 19S BASIC Line Delete for PET/CBM and VIC

by Thomas Henry

Use this convenient utility still use it simply by employing a Proper Improper during your BASIC program BASIC loader that POKEs the required < 100-200 < development. It allows you to data into memory. I will present a pro­ <100- <- delete a whole range of lines, gram to do this later in the article. <-200 <100 rather than just one at a time. Even if you don’t want or need a < - BASIC Line Delete, you may want to etc. look over the program description any­ BASIC Line Delete way. Several interesting routines are The first statement under proper syn­ presented that could be put to other tax will delete lines 100 through 200 requires: uses. In addition, you may want to see inclusive. The second one will delete Upgrade or 4.0 PET/CBM how the program implements error all statements from 100 on. The last or VIC checking and apply it to your own work. one will delete all statements up to line 200 inclusive. And just like the LIST Format of the New Command command, there doesn't have to be any "BASIC Line Delete," a command you To get a feel for how the program line number 100 or 200 for this to can add to your Commodore computer's works, let's examine how it should work. Suppose the first line number resident BASIC, deletes blocks of look to the user. The " < ” sign in­ past 90 in your program is actually 122 BASIC lines instantly. For example, dicates the function, although other and the last one before line 210 is 186. suppose you wish to delete line num­ keys could be used by making one Then "<100-200" will still delete all bers 1000 through 5000 in a BASIC pro­ small change in the program. As men­ of the lines between this range, mean­ gram. Simply type " <1000-5000" and tioned before, the format is identical to ing that actually lines 122 through 186 hit [return] and all those lines will be that used for the LIST command. Let's are deleted. deleted instantly! This BASIC Line summarize all proper uses of the BASIC The second column shows some of Delete function is easy to use since the Line Delete: the possible statements with improper syntax is the same as that found for the LIST command. In addition, extensive error checking is employed to avoid Figure 1 How BASIC Is Stored and Principle of DELETE disasters. You can consider BASIC Line FORWARD LINE END OF LINE SIGN ~ Delete as an addition to the computer's LINK NUMBER BASIC language. It is loaded into the LO HI LO HI TOKENIZED AND COMPRESSED BASIC LINE C computer at the start of a session and BYTE BYTE BYTE BYTE can be invoked at any time, in the im­ mediate mode, to perform its task. Because this 177 byte-long machine- (2) language program sits at the top of memory with memory pointers lowered accordingly, it can peacefully coexist with any BASIC program. The original program was written (3) on a CBM-8032 with 4.0 ROMs. How­ LINES ever, it should be easy to convert to any TO BE DELETED type of Commodore computer since the ROM routines used are common to all (4) models — only the addresses are dif­ ferent. In addition, it is likely that other Microsoft BASIC machines can use this program with a few changes. When we examine the ROM routines (5) you will note that they are routines that any BASIC interpreter must have. END OF VIC-20 owners shouldn't feel left SASIC SIGN (6) out either. Even though the program is in machine language, the VIC-20 can

No. 55 - December 1982 MICRO - The 6502/6809 Journal 47 syntax. If you type any of these, the Figure 2 operation will be aborted and a "?SYN- OOOOl 0 0 0 0 *********************************** TAX ERROR" message will be returned. 00002 0 0 0 0 * * It is important to have this feature 00003 0 0 0 0 * BASIC LINE DELETE UTILITY * 00004 0 0 0 0 * * since a delete function could have 00005 0 0 0 0 * ASSEMBLER CODE FOR CBM—8032 * potentially catastrophic results if 00006 0 0 0 0 * THOMAS HENRY * * * improperly used. So, essentially the 00007 0 0 0 0 00008 0 0 0 0 statements shown in column one all 00009 oooo have proper syntax and will produce 00010 0 0 0 0 00011 oooo VALUE = *11 ; INTEGER VALUE. meaningful results from the computer, 00012 oooo VARBLE = * 2 A ; POINTER TO VARIABLES. while all other statements will not 00013 oooo MEMTOP = * 3 4 STOP OF MEMORY P O IN T E R . execute and will produce a syntax error 00014 oooo SAVE = *59 5SAVE START ADDRESS. 00015 oooo ADDRES = *5 C ; ADDRESS OF FOUND LINE #. message. 00016 oooo CHRGET = *70 JBASIC CHRGET ROUTINE. If the range is "backwards" (e.g., 00017 oooo CHRGOT = *76 ;BASIC CHRGOT ROUTINE. 00018 oooo POINTR = *77 ; CHRGET POINTER. <200-100), an error message will again 00019 oooo WEDGE = * 7 9 ; WEDGE GOES HERE. be produced. Finally, I feel so strongly 0 0 0 2 0 oooo RETURN = *7D ;RETURN TO CHRGET ROUTINE. about error checking that I incor­ 00021 oooo FIXUP = *B4AD ;ADJUST POINTERS. 0 0 0 2 2 oooo CHAIN = « B 4 B 6 »REBUILD LINE CHAINING. porated one more feature. After enter­ 0 0 0 2 3 oooo SEARCH = *B5A3 ;SEARCH FOR BASIC LINE. ing a valid delete command, the com­ 0 0 0 2 4 oooo INTEGR = *B8F6 ;FETCH INTEGER INPUT. puter will respond with "ARE YOU 0 0 0 2 5 oooo ERROR = * B F 0 0 JSYNTAX ERROR ROUTINE. 00026 oooo QUERY = *DB9E ; ' ARE YOU SURE?’ SURE?", giving you one last chance to 0 0 0 2 7 oooo CHROUT = *E202 ;PRINT CHARACTER TO SCREEN, change your mind! This feature is only 0 0 0 2 8 oooo 0 0 0 2 9 oooo available to users with 4.0 operating 0 0 0 3 0 oooo * = * 7 F 5 2 systems since the "ARE YOU SURE?" 00031 7 F 5 2 routine is part of the normal SCRATCH 0 0 0 3 2 7 F 5 2 A 9 4C SETUP LDA #*4C ;OP-CODE FOR •' JMP’ . 0 0 0 3 3 7 F 5 4 8 5 7 9 STA WEDGE and HEADER commands. 00034 7F56 A9 63 LDA #ENTRY SHIGH BYTE OF ENTRY. 0 0 0 3 8 7 F 5 E 8 5 3 5 STA MEMTOP+1 ; LOWER MEMORY TO PR OTECT. Figure 1 illustrates the principle. As 0 0 0 3 9 7 F 6 0 8 5 7B STA WEDGE+2 you probably know, a BASIC line is 00040 7F62 60 RTS ; INITIALIZATION COMPLETE. 00041 7 F 6 3 stored in the computer in a specific 0 0 0 4 2 7 F 6 3 00043 7F63 C9 3C ENTRY CMP #’< ;LOOK FOR DELETE SYMBOL. form. As shown in the illustration, two 00044 7F65 DO 08 BNE COMMON ; SORRY, NOT HERE. bytes are devoted to storing the forward 00045 7F67 48 PHA ;YES, IT7 S HERE. SAVE. 00046 7F68 A577 LDA POINTR link address, which is nothing more 0 0 0 4 7 7 F 6 A C9 0 0 CMP # * 0 0 ; CHECK FOR IMMEDIATE MODE. than a pointer to the following line in 0 0 0 4 8 7F6C FO09 BEQ DELETE ;DO DELETE IF IMMEDIATE. 0 0 0 4 9 7 F 6 E 6 8 PLA ; DON* T DO IN PROGRAM MODE. memory. The next two bytes contain 0 0 0 5 0 7 F 6 F C9 3A COMMON CMP # * 3 A ; COMPLETE CHRGET ROUTINE. the line number. The next area, vari­ 00051 7F71 90 01 BCC F IN IS H 0 0 0 5 2 7 F 7 3 6 0 RTS able in size, contains the compressed or 0 0 0 5 3 7F74 4C 7D 00 FINISH JMP RETURN tokenized BASIC statement. This is 0 0 0 5 4 7 F 7 7 0 0 0 5 5 7 F 7 7 polished off with a zero byte to indicate 0 0 0 5 6 7 F 7 7 2 0 7 0 0 0 DELETE JS R CHRGET ; FETCH FIRST CHARACTER. the end of a line. This format is fol­ 0 0 0 5 7 7 F 7 A 9 0 OD BCC F IR S T ; IT ’S A NUMBER. 0 0 0 5 8 7F7C FO IE BEQ M ID D LE ;NULL INPUT IS ERROR. lowed throughout memory until the 0 0 0 5 9 7F 7 E C9 2D CMP # ?- ; IS IT A MINUS SIGN? last line is hit. A pair of zeros is in­ 0 0 0 6 0 7 F 8 0 DO IE BNE BYPASS ; NO, ERROR! 0 0 0 6 1 7 F 8 2 2 0 7 0 0 0 JS R CHRGET ; FETCH NEXT CHARACTER. cluded at the end of the last line to in­ 0 0 0 6 2 7 F 8 5 C9 2D CMP # ?- ; IS IT ANOTHER MINUS SIGN? dicate the end of the program. (Actually 00063 7F87 FO 73 BEQ BAD ; IF IT IS, THEN ERROR. 0 0 0 6 4 7 F 8 9 2 0 F 6 B8 FIRST JSR INTEGR ; ACCEPT INTEGER INPUT. there are three zeros here, if you count 0 0 0 6 5 7F8C 2 0 A3 B 5 JS R SEARCH ; FIND THE LINE NUMBER, the normal end-of-the-line zero). Sup­ 0 0 0 6 6 7 F 8 F A6 5C LDX ADDRES ;AND SAVE ITS ADDRESS. 0 0 0 6 7 7F 9 1 A4 5D LDY ADDRES+l pose we wish to delete lines 3 and 4 as 0 0 0 6 8 7F93 8659 STX SAVE indicated in figure 1. What we will do 0 0 0 6 9 7 F 9 5 8 4 5A STY SAVE+1 0 0 0 7 0 7 F 9 7 2 0 7 6 0 0 JS R CHRGOT ; LOOK AGAIN AT CHAR. is pick up everything from point B to 0 0 0 7 1 7F 9 A 9 0 13 BCC LA S T ;GO GET LAST LINE NUMBER. the end of BASIC and put it back down 0 0 0 7 2 7F9C FO 5 E MIDDLE BEQ BAD 00073 7F9E C9 2D CMP # ’ - ; IS IT A MINUS SIGN? again at point A. Lines 3 and 4 will be 0 0 0 7 4 7F A 0 DO 5A BYPASS BNE BAD JNO, ERROR! written over in this step. At this point 00075 7FA2 20 70 00 JS R CHRGET ;YES, FETCH NEXT CHAR. 0 0 0 7 6 7 F A 5 DO 0 8 BNE LA S T ; IF PR ES EN T, GO ON. we have just transferred some memory. 0 0 0 7 7 7FA7 A2FF LDX #*FF ; O THERW ISE DE FAU LT TO The link addresses will now be all wrong 0 0 0 7 8 7F A 9 8 6 11 STX VALUE ;LINE NUMBER *FFFF. 00079 7FAB 86 12 STX VALUE+1 for the new locations. Fortunately, 0 0 0 8 0 7FAD DO 0 3 BNE D E FA LT ; BRANCH ALWAYS. there is a routine in the ROMs that will 0 0 0 8 1 7FA F 2 0 F 6 B8 LAST JSR INTEGR ;GET LAST LINE #. 0 0 0 8 2 7F B 2 2 0 A 3 B5 DEFALT JS R SEARCH JFIND ADDRESS OF LINE #. rebuild the link addresses for us auto­ 0 0 0 8 3 7 F B 5 9 0 OC BCC CHECK ; BRANCH, LINE NOT FOUND. 0 0 0 8 4 7F B 7 AO 0 0 LDY # * 0 0 matically. After this routine is called 0 0 0 8 5 7 F B 9 B1 5C LDA (ADDRES) ,Y ;GET FORWARD LINK TO the delete has been performed and the 00086 7FBB AA TAX ;POINT TO NEXT LINE IN 00087 7FBC C8 INY ;MEMORY. BASIC program is all set to go again! 00088 7FBD B1 5C LDA (ADDRES) , Y Figure 2 is an assembler listing of 0 0 0 8 9 7FB F 8 6 5C STX ADDRES 0 0 0 9 0 7FC1 8 5 5D STA ADDRES+l the BASIC Line Delete program. As 0 0 0 9 1 7FC 3 3 8 CHECK SEC JCHECK TO SEE THAT THE mentioned above, the error checking is 0 0 0 9 2 7 F C 4 AS 5C LDA ADDRES ; START NUMBER IS LOWER 00093 7FC6 E5 5 9 SBC SAVE ; THAN THE STOP NUMBER. the only hard part of the program; the

48 MICRO - The 6502/6809 Journal No. 55 - December 19J Figure 2 (continued) with zeros in $11 and $12. You can con­ 0 0 0 9 4 7 F C 8 A5 5D LDA ADDRES+l sider this as a default lower line number. 00095 7FCA E5 5A SBC SAVE+1 00096 7FCC 90 2E BCC BAD SIT'S NOT, SO ERROR. Given a line number, routine 0 0 0 9 7 7FC E 2 0 9E DB JSR QUERY 5 IT IS. LAST CHANCE $B5A3 will find where in memory that 0 0 0 9 8 7FD 1 BO 21 BCSDONE ; TO CHANGE YOUR MIND. 0 0 0 9 9 7 F D 3 AO OO MOVE LDY # * 0 0 BASIC line sits. Simply put the desired OOIOO 7FD5 B1 5 C LDA(ADDRES).Y 5 SHIFT BYTES BACK, line number in locations $11 and $12 00101 7FD7 91 59 STA(SAVE),Y ;ONE BY ONE. 00102 7FD9 E6 59 INCSAVE ; INCREMENT START ADDRESS. and call routine $B5A3. The routine 0 0 1 0 3 7FD B DO 0 2 BNE NOCAR1 00104 7FDD E6 5A IN C SAVE+1 will return with the address of the first 00105 7FDF E6 5C NOCAR1 INC ADDRES ; INCREMENT END ADDRESS. byte of the desired line in locations $5C 0 0 1 0 6 7FE 1 DO 0 2 BNE N0CAR 2 0 0 1 0 7 7 F E 3 E6 5D INC A D D R E S + l and $5D. You will note that the routine 00108 7FE5 AS 5C NDCAR2 LDA ADDRES ; IS END ADDRESS TOUCHING described in the preceding paragraph 00109 7FE7 C5 2A CMP VARBLE ;THE START OF VARIABLES YET? 0 0 1 1 0 7 F E 9 DO E8 BNEMOVE 5 IF IT ISN'T, DO MORE. ends with the desired data in locations 0 0 1 1 1 7FE B A5 5D LDA A D D R E S + l $11 and $12, whereas this routine 00112 7FED C5 2B CMP V A R B LE+1 00113 7FEF DO E2 BNE MOVE begins with data in these locations. 0 0 1 1 4 7FF 1 2 0 B 6 B4 JSR CHAIN ;REBUILD CHAINING OF LINES. This means that we can chain the two 0 0 1 1 5 7 F F 4 A9 OD DONELDA «*0D SPRINT CARRIAGE RETURN. 00116 7FF6 20 02 E2 JSRCHROUT routines without saving any inter­ 0 0 1 1 7 7 F F 9 4C AD B4 JMP FIXUP ;CLEAN UP POINTERS, ETC. mediate results! 00118 7FFC 4C 0 0 BF BAD JMP ERROR 0 0 1 1 9 7 F F F .END An interesting feature of this line- finding routine is its ability to adapt to delete part is quite easy. I will let you routine (at $70) is called first and this non-existent line numbers. For exam­ examine the assembler listing, but as causes locations $77 and $78 to point ple, suppose you tell it to find line 100 an aid to understanding, let me to the start of the integer (which is in but no such number exists in your pro­ describe the key ROM routines used in ASCII). After a JSR $B8F6, the ASCII gram. However, your program does it. You may want to jot these down in representation is converted to a binary contain a statement with line number your notebook for future reference, form and the result is deposited in loca­ 110, When you call the routine it will since I'm sure these routines have tions $11 and $12 (low byte and high look for number 100 and won't find it. many more valuable uses. byte, respectively). If $77 and $78 point But it will continue to look for the first The routine at $B8F6 will get an in­ to the sign [as in the command line number beyond 100 (in this case teger from the screen. The CHRGET “ <-200"), the subroutine will return 110) and return with its address in-

► / ------> / The h'-CQ/HPU SENSEi:.'1 CARDC Products For the Vic-20® PAPER VIC-20* is a registered trademark of Commodore. ______J CARDBOARD 6 Expand your Vic-20® to accept 6 game cartridges or an additional 35K of RAM memory. Until De­ cember 15,1982, a SPECIAL CHRISTMAS PRICE $79.95, Five years of service to the PET community. thereafter $99.95 CARDBOARD 3 An economy memory expanderto 35KAM or 3 game cartridges $29.95 CARDPRINT Printer interface—Vic to Centronics type parallel input printer. This unit uses the regular Vic printer out put port and uses normal Vic print commands $79.95 CARDRITER A light pen with 6 software programs includ­ ing a full screen drawing tablet, a light pen instruction pro­ gram, and some games $29.95 Cardette universal cassette interface for the Vic. Allows any standard cassette player/recorder to be used in place of the Vic Dattasette, $29.95 We carry a full line of Vic-20® hardware and software. We have a full line of other software including the exciting NEW SOFT$EN$E LINE of Small Business or personal business programs. SEND FOR OUR CATALOG To Order: The Independent U.S. magazine for P.O. Box 18765 Wichita, 67218 users of Commodore brand computers. (316) 684-9660 Personal Checks Accepted (Allow 3 Weeks), or C.O.D. EDITORS: Jim and Ellen Strasma Handling Charges $1.50 Sample Issue free on request, from: Prices Subject to Change without notice 635 MAPLE □ MT. ZION, IL 62549 USA

No. 55 - December 1982 MICRO - The 6502/6809 Journal 49 stead. You can see that this is exactly Figure 3 what the BASIC Line Delete program 100 REM **************************************** 1 1 0 REM * needs! One other feature is that if the 120 REM * BASIC LINE DELETE: exact line number specified was found, 130 REM * VIC-20 VERSION 1 4 0 REM * then the carry flag is set. Otherwise, as 150 REM * THOMAS HENRY in our example here, the carry flag will 1 6 0 REM * 170 REM * TRANSONIC LABORATORIES be cleared. 180 REM * 249 NORTON STREET In the program, if no last line 190 REM * MANKATO, MN 56001 2 0 0 REM * number is specified, a default number 210 REM ***************************************** of $FFFF (65535 decimal) is specified. 2 2 0 REM 2 3 0 REM Notice what happens when this 240 PR I NT "WAIT A MOMENT...’* number is acted on by subroutine 250 X=PEEK(55)+256

LDA #$0D Now type over what the computer VIC-20 JSR SE202 shows, using the byte values generated in the assembly in figure 2 as a guide. | VIC-20 INTERFACING BLUE BOOK Did you know that your VIC can be used to To rebuild the forward link chain­ When you are done, save the program control a 99

50 MICRO - The 6502/6809 Journal No. 55 - December 1982 Add-on, starting at $7F63 in this case. called are quite powerful and probably Everything else remains the same. This have many other uses. In addition, the is due to extensive use of relative ad­ program itself could serve as an exam­ A harvest of dressing; there are no internal JSR or ple of how to incorporate worst-case er­ JMP commands to be altered. Simply ror checking into your own routines. savings from transfer the program, change the two bytes mentioned, and run it using the Acknowledgements new SYS address! I owe a big debt of gratitude to Dick VIC-20 owners need a different way Immers of the Central Illinois PET to get the program into memory since User's Group for explaining some of Apple the VIC has no resident machine- the quirks of the CBM-8032 machine- language monitor. Figure 3 shows a language tape-save routine. Thanks loader program that will enter an also go to Dr. Kenneth Good, Mankato equivalent BASIC Line Delete into State University, for putting early ver­ SOFTWARE memory. Note that this loader is com­ sions of this program to the acid test. pletely automatic since it not only He found several conditions that could APPLE-ATARI-TRS80-IBM loads the program but also instantly ad­ have caused users real troubles were A full line erf software for business, games aid education justs to VIC-20s with any amount of they not flagged with "SYNTAX ER­ up to 35% off! add-on memory. In addition, the pro­ ROR" statements. MUSE KJS STONEWARE gram automatically does a SYS to the VISICORP ON UME S tfC R O S m C right address. All the user has to do is EDU-W\RE HAYDEN Thomas Henry is a professional writer in LOAD the program and RUN it! HOWARD AND MANY MORE Now you have a new command for the areas of electronic music, circuit design, and Commodore computers. He your Commodore computer. You don't may be contacted at Transonic HARDWARE really have to understand how it works Laboratories, 249 Norton Street, Mankato, AMDEK • HAVES ■ MICROSOFT to use it, but I recommend you look MN 56001. over the assembly listing again. As FRANKLIN COMPUTER mentioned before, the ROM routines JMCftO SYSTEM ACE lOOO • $1,795.00 DISKS Maxell Box of 10,514", SS-DD $35.00 Verbatim Box of 10,5!4", SS-DD $29.00 MONITORS LE MONITORS List Our Price 70 INCOME TAX PROGRAMS 9" Green $189.00 $ 1 5 9 .0 0 (For Filing by April 15,1983) 12" Green $199.00 $ 1 6 9 .0 0 ZENITH For APPLE ll/ll* (DOS 3.3,16-Sector) 12" Green $179.00 $129.00 Plus a fu ll line o f AMDEK M onitors Helpful programs to calculate and print the many Tax FEATURES:- Forms and Schedules. Ideal for the Tax Preparer, PRINTERS 1. Menu Driven. C.P.A. and Individuals. For just $24.75 per disk, post­ 2. 70+ Tax Programs. paid (in 3.3 DOS; 16-Sector disks). PAPER TIGER List Our Price 3. Basic; Unlocked; Listable. Programs are designed for easy-use, with check­ 46QG $1,094.00 $950.00 4. Name/SS No./FS carried points to correct parts as needed. Results on screen 560G $1,394.00 $1,250.00 over. for checking before printing. EPSON 5. Inputs can be checked. In all, there are more than 70 individual Tax Programs. MX 70 $449.00 $395.00 MX80FT $745.00 $595.00 6. Inputs can be changed. These include Form 1040, 1040A, 1040EZ, 1120, 1120S, 1041 and 1065. Also Schedules A, B, C, D, E, MX 100FT $945.00 $795.00 7. I.R.S. approved REVPROC format. F, G, R, RPand SE. And, Forms 1116, 2106, 2119, 2210, 2440, 3468, 3903 , 4255, 4562, 4797, 4835, CALL FOR THIS MONTHS SPECIAL ! 8. Prints entire Form/Schedule. 4972, 5695, 6251 and 6252. 9. Calculates Taxes, etc. And, we have a disk we call “ THE TAX PREPARER’S 1800835 2246 EXT. 211 OR 10. In 3.3 DOS, 16-Sector. HELPER” which has programs for INCOME STATE­ 11. Fast calculations. MENTS, RENTAL STATEMENTS, SUPPORTING STATE­ 7024594114 12. Use GREENBAR in triplicate MENTS, IRA, ACRS, 1040/ES, ADD W-2's and PRINT 5130 East Charieston Blvd. — don't change paper all W-2's. Suite 5M1 season! TRY ONE DISK AND SEE FOR YOURSELF. ONLY $24.75 Las Sfegas, N»ada 39122 POSTPAID. Phone orders welcome. Mail orders may send 13. Our 4th Year in Tax charge card number (include expiration date), Programs. First disk is AP#1, and includes Form 1040 and cashiers check, money order or personal check 14 We back up our ProgramsI Schedules A, B, C, D and G. $24.75 POSTPAID. (allow ten business days for personal or com­ pany checks to clear). Add $3.00 for shipping, W rite :— Handling and insurance. Nevada residents acfd b. 75% sates tax. Please include phone number. GOOTH TAX PROGRAMS VISA All equipment; is in factory cartons with manu­ facturers warranty. Equipment subject to price 931 So. Bemiston • St. Louis, Mo. 63105 change and availability. Call or write for price list

No. 55 - December 1982 MICRO - The 6502/6809 Journal 51 SOUP: A CBM Machine-Language Compare Program

by Henry Troup and Jim Strasma

SOUP is an efficient compare change lines 690 and 710 to allow the Most likely the error will be fatal, and program for machine-language device number you need. If your paper you will have to start over again after program files on Commodore is not the 11-inch variety common in correcting the problem. disk. It uses BASIC 4.0 disk the U.S., change line 350 to adjust the The program uses only a few special commands, but is otherwise lines printed per page to your needs. characters. In lines 670, 730, 740, 780, compatible with other Microsoft To better explain its workings, the and 790 notice the three equal signs in BASICs. program as printed here is heavily com­ a row (= = =). These represent three mented and uses fewer multiple state­ [cursor left] characters. These charac­ SOUP ment lines than it could. Feel free to ters place the flashing input cursor over requires: omit remark statements and lines con­ a likely default answer. They also pro­ taining only a colon; none is referenced tect the user from accidentally falling PET/CBM by other lines. You may also be able to out of the program. Even so, you may disk drives combine some lines. For example, the omit them. printer (optional) subroutine beginning in line 460 could To use this program with other be reduced to four lines. Likewise, the computers or disk drives, you will need This program, originally adapted by spaces that are not within quotation only to substitute your disk commands Henry Troup from a similar mini­ marks may safely be left out. However, for Commodore's. The most difficult computer utility, compares two ver­ you may find it better to leave the pro­ task for other disk operating systems is sions of a machine-language program gram as listed here and compile it. likely to be reading in the program files on disk and prints out any lines that In the interest of speeding up the one character at a time. The other differ between the two versions. All program, often-used constants are re­ essential task is to detect the end of file you need to use SOUP are disk copies placed by variables, seldom-used lines when it is reached. If you know how to of the two machine-language programs are moved to the end of the listing, and do these tasks on your machine, you to be compared. The only other restric­ disk status is left unchecked once the can probably make SOUP work for you. tion is that they must begin loading at needed files are successfully opened. If the same address. you notice that the program seems to To use the program, place the disk have halted with the disk error light on, Henry Troup and Jim Strasma may be or disks with the files to compare in hit the [stop] key, and check the disk contacted at 1280 Richland Ave., Lincoln, your disk unit. Also prepare your status in immediate mode: IL 62656. printer, if you are using one. At start ?ds$ up, you will be asked the name and drive number of the two files. This is Listing 1 the only time in the program that disk status is checked. If an error is found 100 REM SOUP — AS OF 7 SEPT 82 here, repair the cause and re-enter the 110 GOSUB 6 3 0 :REM PUT MOST-USED LINES AT START FOR SPEED 120 REM MAIN ROUTINE file name and drive number. 130 NM$="SOUP: FILE A="+CF$+" & FILE B="+PF$:REMTITLE From here on, operation is automatic. 140 PRINT#4,NM$:REM START NEW PAGE As differences are discovered they are 150 GETJ1,A$:REM READ A CHARACTER FROM FILE A 160 S1=ST:REM REMEMBER I/O STATUS OF A listed either to the screen or printer. 170 IF A$=NL$ THEN A$=ZE$:REM TRAP NULL DATA BUG You may wish to make some changes 1 8 0 GET#1, B $ : REM READ A CHARACTER FROM FILE B in the formatting used here. Lines 700 190 S2=ST: REM REMEMBER I/O STATUS OF B 200 IF B$=NL$ THEN B$=ZE$:REM FIX NULL DATA BUG and 710 set the maximum fields per 2 1 0 I F A$=B$ GOTO 420:REM ONLV REPORT DIFFERENCES line for screen and printer respectively. 220 A=ASC(A$):B=ASC(B$):REM CONVERT TO DECIMAL CODE If your screen has over 40 columns, or 230 N=AD:GOSUB 490-.REM CONVERT ADDRESS TO HEXADECIMAL your printer over 80, you may increase 240 PRIN T#4,"@ "H X$",A =";: REM PRINT MISMATCH 250 N=A:GOSUB 490:REM CONVERT A'S VALUE TO HEX the value given to variable mf. Like­ 260 PRINT#4 , HX$"+B = "; :REM S. PRINT IT wise, if your printer is not device #4, 270 N=B: GOSUB 4 9 0 :REM THEN CONVERT B 'S

52 MICRO - The 6502/6809 Journal No. 55 - December 1982 Listing 1 (continued) 280 PRINT#4,HX$;:REM & PRINT IT 290 FC=FC+1: REM PRINT 4 MISMATCHES PER LINE It Pays to Write 300 REM TAB IF HAVE ROOM FOR ANOTHER ON LINE 310 IF FC9) ) May — Wave of New Computers 570 : N=N-Q%*P June — Operating Systems 580 NEXT July — Hardware 590 IF LEN(HX$)=1 THEN HX$=" 0 "+HX$: REM FORMAT 1 CHARACTER August — Word Processing 600 HX$="$"+HX$ September — Education 610 RETURN October — Programming 620 REM SETUP SUBROUTINE Techniques 630 PRINT’ SOUP BY HENRY TROUP & JIM STRASMA November — Games 640 PRINT”COMPARES MACHINE-LANGUAGE PROGRAMS December — New Microprocessors 650 REM PRESET VARIABLES TO GAIN SPEED S6C NL$="":ZE$=CHR$(0) 670 IN PUT"OUTPUT DEVICE: 3 = SCREEN, 4 = PRINTER 3===";OT$ 680 DV=VAL(OT$) : REM CONVERT TO NUMBER 690 IF DV<3 OR DV>4 GOTO 670:REM VALIDATE 700 MF=2:REM 2 FIELDS PER LINE ON SCREEN 710 IF DV<>3 THEN MF=4: REM 4 FOR PRINTER 720 CLOSE 4 : OPEN 4,DV:REM HELLO DEVICE 730 INPUT"FILE A'S NAME +===",-CF$ 740 INPUT"ON DRIVE 0===";R1 750 IF R 1O 0 AND R I O l THEN 740:REM VALIDATE 760 DOPEN #1, (CF$) ,D (Rl) :REM HELLO FILE A 770 IF DS THEN PRINT DS$:GOTO 730:REM ON ERROR 780 INPUT"FILE B ’ S NAME +===",-PF$ 790 INPUT"ON DRIVE 0===";R2 800 IF R 2 O 0 AND R2<>1 THEN 790:REM VALIDATE 810 DOPEN #2, (PF$ ) ,D(R2) :REM HELLO FILE B 820 IF DS THEN PRINT DS$:GOTO 78fl:REM ON ERROR 830 GET#l,Al$:GET#l,A2$:REM READ A'S LOAD ADDRESS 840 GET#2,B1$:GET#2,B2$:REM & B'S 850 REM TRAP ZERO DATA BUG 860 IF A1$=NL$ THEN Al$=ZE$ 870 IF A2$=NL$ THEN A2$=ZE$ 880 IF B1$=NL$ THEN Bl$=ZE$ 890 IF B2$=NL$ THEN B2$=ZE$ 900 REM CALCULATE LOAD ADDRESSES 910 AD=ASC(Al$)+ASC(A2$)*256 920 A2=ASC(Bl$)+ASC(B2$)*256 9 30 IF AD=A2 THEN RETURN:REM IF MATCH, BEGIN 940 PRINT"START ADDRESSES DON'T MATCH 950 DCLOSE: REM ELSE CLOSE DISK FILES 960 END: REM & ABORT

SOUP Sample Run SOUP: FILE A=SOUP & FILE B=SOUP 7SE82 @$401,A=$1B+B=$04 @$402,A=$64+B=$00 @$403,A=$8F+B=$20 @$405,A=$20+B=$43 @$406,A=$45+B=$20 @$407,A=$28+B=$41 @$408,A=$44+B=$2C @S409,A=$4E+B=$2C @$40A,A=S44+B=$2C @$40B,A=$50+B=$2C @$40C,A=$41+B=$32 0S40D,A=$29+B=$00 ®$40E,A=$43+B=$04 @$40F,A=$6E+B=$00 @$410,A=$8F+B=$20 @$411,A=$50+B=$52 @$412,A=$49+B=$4F @$413,A=$52+B=$20 @$414,A=$4C+B=$49 S$415,A=$4E+B=S45 0$416,A=$20+B=$4E @$418,A=$44+B=$45 @$419,A=$44+B=$20 @S41A,A=$42+B=$59 @$41B,A=$20+B=$44 @$41C,A=$54+B=$4C @$41D,A=$20+B=$43 0S4lE,A=$4f+B=$4D @$41F,A=$50+B=$49 S$420,A=$4C+B=$45 @$421,A=$52+B=$00 @$422,A=$76+B=$04 iM C R O

No. 55 - December 1982 MICRO - The 6502/6809 Journal 53 /AICRO PET Vet

1000 4-bit locations at $D800, each the TV screen in the current graphics By Loren Wright corresponding to a location in screen mode.) The bits of each byte in charac­ memory. Four bits is enough to code ter memory are considered in pairs for sixteen different colors. rather than individually. Each of the The VIC II uses the different bits of four possible bit combinations for a bit two control registers to select nearly all pair determines where to get the color of the graphics modes. Other registers for the double-wide pixel on the screen. are used to control positions and colors Combinations 00, 01, and 10 get the Graphics on the Commodore 64 of sprites, to read light pens, and to color from background registers 0, 1, The Commodore 64 offers a lot of com­ select background colors. This month's and 2, respectively, and 11 gets the color puting power in its small package. data sheet [p. 109 ) lists the control from the appropriate location in color There are 64K of RAM, CP/M capa­ registers for the 64. I will refer to them memory. Since any background color bility, and sophisticated sound fea­ here only by name. can be changed with a single POKE, tures. But the most outstanding feature parts of all the characters on the screen is the graphics. To sum it up, the 64 Character Modes can be changed at once! This mode is offers considerably more graphics capa­ The 64's characters are normally probably best used with custom charac­ bilities than the Apple in this area and read from the character ROM and the ters, since this way of interpreting the rivals the Atari 800, at a price that beats color is determined by the contents of character data would make most stan­ them both. the corresponding location in color dard characters nearly unrecognizable. What, exactly, does the 64 do in the memory. The pointer to the character The VIC uses a similar scheme in its way of graphics? I've been studying a ROM can be altered to point to RAM, multicolor mode. preliminary draft of the Commodoie 64 where you can design custom charac­ Extended background mode allows Programmer's Reference Guide and ters. There’s plenty of memory to play the background for each screen location have begun to learn about all the with, so this is a lot more practical than to be any of four different colors. The graphics on my own 64. on an unexpanded VIC! sacrifice is that only the first 64 The 64 has the following modes, Multicolor character mode has a lot characters in character memory can be some of which can be mixed on the of possibilities. Standard characters used. Bits 6 and 7, which would nor­ same screen: consist of eight rows of eight pixels, mally select the other 192 characters, 1. Standard character mode while multicolor characters consist of determine the background color instead. a. ROM characters eight rows of four double-width pixels. The background color is read from b. Programmable RAM characters (A pixel is the smallest dot of light on background color register 0, 1, 2, or 3. 2. Multicolor character mode (both ROM and RAM) 3. Extended background color mode Figure 1. Multicolor Character Mode a) Bits in character memory are considered in pairs, b) Each bit combination indicates a diferent source for the color, c) The final (both ROM and RAM) character displayed with double-width pixels. 4. Standard bit-map mode (320 x 200 resolution) 0 0 0 1 0 1 0 0 5. Multicolor bit-map mode (160 x 0 1 0 0 1 0 0 1 c) 200 resolution) 0 0 0 0 1 0 1 0 6. Sprites (both standard and multi­ - color modes) 0 1 1 1 1 1 0 1 Various blocks of memory and con­ 0 1 1 1 1 1 0 1 trol registers are involved in pulling off 1 0 1 0 0 0 0 0 all these different modes. Screen mem­ 0 1 1 0 0 0 0 1 §§gj§ ory consists of 1000 bytes, normally 0 0 0 1 0 1 0 0 located at $400, and these usually jlfllf determine what characters will appear b) 00 Background 0 | | on the screen. There is a character ROM, which contains two complete 01 Background 1 nnm character sets, as on the PET and VIC. 10 Background 2 |~ j Pointers may be altered so that custom characters can be set up in RAM. Color 11 4-bit color k \ 1 location memory, which can’t be moved, is

54 MICRO - The 6502/6809 Journal No. 55 - December 1982 PET Vet (continued) Sprites multicolor register #1. As with the Bit-mapped Modes What is a sprite? The name doesn't other multicolor modes, the horizontal Standard bit-map (or high- really mean much, but the concept is resolution is decreased and the sprites resolution) mode allows control of each similar to "Player/Missile Graphics” are displayed using double-width pixels. individual pixel on the screen, with a on Atari computers. Each sprite is a Each sprite can be expanded to dou­ resolution of 320 by 200. 8K of RAM, high-resolution entity, 24 by 21 pixels, ble its horizontal or vertical dimension normally taken from the top of BASIC maintained by the VIC II chip. To pro­ or both. RAM, is used for high-resolution gram one all you need to do is define its To handle smoothly the entry and graphics. The bytes are arranged in the bit pattern, select its color, select its exit of sprites on the screen, the possi­ same way the pixels of characters are X-Y position, and turn it on. By ble X and Y positions actually extend coded. That is, the first byte in hi-res changing the X and Y values you can beyond the visible portion of the memory codes for the first eight pixels move the sprite to any position on (or screen. That way it is possible to have a in the first row of pixels on the screen, off) the screen. comer or an edge appear first, followed and the second codes for the first eight Now, for the details... Eight sprites smoothly by the rest of the sprite. pixels in the second row. The ninth may be displayed on the screen at one I mentioned priorities earlier. The byte codes for the ninth through six­ time. Each sprite has a one-byte pointer sprites themselves have fixed priorities teenth pixels of the first row. What this at the top of the screen RAM block. The with respect to each other: sprite 0 is means is that you have to go through a pointer indicates a 64-byte block higher priority than sprite 1, 1 higher little arithmetic to find the correct bit within the 16K bank currently selected than 2, and so on. However, each sprite to change in hi-res memory, given X (in for the VIC II. The last byte of the 64 is may be selected to be higher or lower in the range of 0 to 319] and Y (in the a control byte; the others contain the priority with respect to the background range of 0 to 199). pixel data for the screen representation data. Objects of higher priority will Screen memory is used to deter­ of the sprite. Each three bytes represent overwrite objects of lower priority. mine the color of the pixels in the area a 24-pixel row in the sprite. In the stan­ Collisions are detected by the VIC II normally occupied by a character. The dard mode, a bit set to 1 displays a pixel and appropriate bits are set in two high nibble determines the color of all of the selected color and a bit set to 0 registers. If the corresponding sprite is the bits set to 1, and the low nibble displays what's under it (usually the involved in a collision, then its bit will determines the color for the 0's. background, but it could be part of a be set in the register. The bits in the Multicolor bit-map mode reduces sprite of lower priority!). register will remain set until the the resolution to 160 by 200. As with Associated with each sprite are register's contents are read by your pro­ multicolor character mode, the bits in several other memory locations in the gram. Then the whole register is hi-res memory are considered in pairs VIC II chip. The sprite display enable cleared. There is one register for sprite- to determine the color of the correspon­ register has a bit for each sprite, as do to-sprite collisions and another for ding double-width pixel on the screen. the sprite multicolor enable, sprite ex­ sprite-to-background collisions. Combination 00 selects the screen color pand 2X horizonal, sprite expand 2X Some of the limitations can be cir­ (background 0), 01 gets the color from vertical, sprite-to-background priority, cumvented with more sophisticated the high nibble of the appropriate byte sprite-to-sprite collision detect, and programming. For instance, it is possi­ in screen memory, 10 gets the color sprite-to-background registers. Also, ble to display more than eight sprites at from the low nibble in screen memory, there is a byte for each sprite's vertical once using raster interrupt techniques. and 11 gets the color from the 4-bit position, and a byte for each sprite's Also, because there is so much mem­ color memory location. horizontal position. Since there are ory, you can have lots of sprite defini­ Commodore plans a VSP Cartridge, more than 256 possible horizontal posi­ tions stored and only alter the pointers. which will include convenient com­ tions, there is also a byte containing a If the fixed sprite priorities are a prob­ mands for high-resolution graphics. ninth X-position bit for each sprite. It lem, just swap the pointers and the ap­ sounds — and is — complicated. How­ propriate bits and registers. Fine Scrolling ever, this complexity is required to T h e P ro g ra m m er’s Reference The VIC II chip allows the whole maintain such a powerful graphics Manual gives all the details of the screen to be scrolled up, down, left, or mode. Read on for details of the dif­ various graphic modes, along with sam­ right by only one pixel. To make this ferent capabilities of sprite graphics. ple programs. Even the little quirks of work smoothly, there are provisions to Standard sprites can be displayed in the system (and ways to get around reduce the width of the screen to 38 any one of the sixteen colors in a them) are mentioned. It is good to see columns and to reduce the height to 24 resolution equivalent to the standard Commodore finally paying attention to columns. That allows two columns bit-map mode. Multicolor mode allows quality documentation with the (and/or one row) to be hidden, while up to four colors in each sprite, and the VIC-20 and Commodore 64 Program­ characters are lined up before fine colors are determined by considering mer’s Reference Guides. The Guide for scrolling into the visible area of the bit pairs in the sprite definition. 00 the 64 should be available in early screen. The programming for this selects screen color, 01 the color in December. smooth scrolling is best accomplished sprite multicolor register #0, 10 the col­ JMCftO with some simple machine-language or in the appropriate sprite's color routines. register, and 11 the color in sprite

No. 55 - December 1982 MICRO - The 6502/6809 Journal 55 computer mail order w es et izard...... $89.00 W Text M icro Painter $25 00 $25 ...... $34.00 p te S Next The izard...... $64.00 W Spell Painter icro M cken...... $26.00 n e k ic h C enerator G Graphic $30.00 aster...... M $25.00 Graphic alloons...... B and Clowns ...... $25.00 s g u B Tumble r...... $25.00 e b lim C Canyon zr n h Princess the and izard W breaker...... $27.00 Jaw Synassem bler $30 00 $30 ...... s u $26.00 m a h S bler Synassem r...... $26.00 ce a R Dodge quare S Bishop's ...... e $25.00 d a rc A Shooting aiders...... $35.00 R Star ieMaae 0 ...... $79.00 800 anager M File ftporn...... $27.00 o S Page 6 .. $19 00 $19 ...... $32.00 s tic n A K-razy e...... $26.00 lim S r...... $26.00 to c te ro P .. 6 Page id ro te s A ission M e d e tip n e C aii os Hgwy...... $25.00 Highway...... Coast Pacific and...... $29.00 m m o C issile M $29.00 steroids...... A -trPatrol...... $32.00 a P K-star ...... $32.00 rs ritte K K-razy $32.00 ut...... O Shoot Krazy r...... $24.00 e g a n a M Disk ...... s $26.00 tilu u a N ...... $31.00 k c tta a k s u o M $32.00 ars...... M of Caverns a Man...... $35.00 M Pac 76.00 er...... $ cord e R 0 1 4 X5 tr 1K ...... $77.95 m a R 16K Atari CX853 CX40 Joysticks (Pair) Joysticks e CX40 c rfa te In 850 rinter...... $589.00 P 825 ter...... $269.00 rin P e 822 riv D Disk 810 0Printer...... $259.00 P 20 8 ...... $159.00 odem M 830 TC STANDSTICK : t s e w ... *429 ...... K 8 4 ... *349 ...... K 2 3 for certified checks or money orders. Add 3% (minimum $3.00) shipping and handling on all C.O.D. and Credit Card orders. NV and PA residents add sales tax. AM items subject AMtax. subject sales items add PA residents NV and orders. Card Credit C.O.D. and all on handling and shipping $3.00) (minimum 3% Add orders. money or checks certified for In-stock items shipped same day you call. No risk, no deposit on C-O.D. orders. Pre-paid orders receive free shipping within the continental United States with no waiting period period no waiting with States United continental the within shipping free receive orders Pre-paid C-O.D. on orders. deposit no risk, No call. you day same shipped items In-stock to availability and price change. change. price and availability to 16K " 6 $ ...... $35.00 ...... DATASOFT ...... $22.00 400 ...... SYNAPSE ON-LINE K-BYTE ATARI ...... 800-648-3311 *269 m ...... ATARI NOTBi NOTBi $13.00 % $169.00 $449.00 $29.00 $25.00 18.00 $ e tc mauatrrs n tid at sfwr fr ot l cmues n h mre! al oa fror e catalogue. new our for today Call market! the on computers all most for software party third and anufacturer's m stock We A

P.O.BOXSTATE 888S LINE,NV. 89449 EVER! PRICE LOWEST h o cutn I )...... $119.00 M (IB ccountant A e Hom The s Mail a M Class 1st The Home Accountant (Apple/Franklin) Accountant Home The eYa xeddWarranty W Extended Year ne O $429.95 )...... (128K Ramdisk Axlon ne 2 Boar ...... $ 74.00 ...... $ rd a o B 32K Intek 5 1/4" SS DD SS 1/4" 5 00 $26 ...... DD SS 1/4" 5 00 $44 nsity) e D ouble D (8" II MFD ...... (8”) I ) MFD 0 1 of (Box II MD ) 10 of (Box I MD ne 8 Boar ...... $159.00 rd a o B 48K Intec 74.95 ...... $ Ram 16K icrotek M 5 1/4" D S D D ...... $36 00 $36 ...... D D S D 1/4" 5 spo...... $159.00 isiplot...... V x...... $189.00 iside V sir Pl t...... $229.00 lo /P d n itre is V ...... $189.00 isiterm V Visifile...... $189.00 Package Educator ckage a P CX482 Entertainer CX481 X44Cmmuiao k e g cka a P ...... $54.00 unicator e m g Com cka a P 484 CX mer Program 483 CX sSchedule...... $229.00 isiS V eko an...... $189.00 n la P Desktop o Ape I ls Aai CM IBM & CBM Atari, plus, II Apple for tr 1 utCover...... $6.99 e v o C Dust 810 Atari r...... $6.99 e v o C Dust 800 Atari IIAC ...... $179.00 VISICALC Franklin IBM, Apple, For tr 0 utCover...... $6.99 e v o C Dust 400 Atari Callpriceandfor availability IN NV.IN CALL B88-B8B4 (702] IE SNLI lOOO SINCLAIR TIMEX 80048K — R A T S H T R O N P R O C I S I V on models.all ...... Continental Y P P O L F ...... Verbatum S K S I D S O T L A Elephant X E M I T Maxell 0 0 . 9 8 $ ...... $344.00 $19.99 ...... $54 00 $54 00 $36 $46.00 $59.00 $130.00 $ 69.00 $ 70.00 $ $59.00

1 d-n rive...... $339.00 D Add-on A1 2 ul i ...... $879.00 e riv D Dual 52 ...... $509.00 e iv r D Singli- 51 Computers Atari For Drives Disk Single Side Dual Head .. $679.00 $679.00 .. Head Dual Side Single Dual Drive Dual H e a d ... $1046.00 ... d a e H Dual Drive Dual ...... $144.00 t...... a C $199.00 ...... h p ra g o n ro h C T10 ul d oo...... $299.00 Color...... ode M 159.00 n)...... S Dual ree G CT-160 Res. (High MIP TR-120 *2 uoCat C Au:o 2 2* $219.00 t...... a C Auto Smart 1200 (1200 baud)...... $ 549 00 549 baud)...... $ (1200 1200 Smart S239.00 rt...... a m S pl a It...... $339.00 ...... t I Cat Apple Vl PwrSupply p p u S Power Volt 9 $179.00 (IBM-PC)...... VI ) ark E M N R O B S (O V ark M D -C a t...... $159 00 $159 $279.00 t...... a -C D 0 0 1 m e d ro ic M ...... I I icrodem M 21 2 Apple Cat I I ...... $609 00 $609 ...... I I Cat Apple 2 21 M ark VII {Auto A n sw er/D ial)...... $ i 19 00 19 i ial)...... $ er/D sw n A {Auto VII ark M ak I(tr)...... $7900 0 $79.00 9 7 $ (Atari)...... II Mark )...... -232 S R M Mark ak I T-9...... $109.00 ) T E /P M B (C IV Mark (TI-99)...... II Mark 0G...... $169.00 I Color ...... 300G Color II...... $699.00 Color oo I...... II $429.00 I Color V 121...... S99.00 ZVM 3 oo 10 ...... $279.00 1400 Color 13„ hr 1”ClrTV...... $275.00 V T Color 13” Sharp es)...... $369.00 R (Mid 1401 Color 13” ...... $ n 85.00 e re G 12" PERGOM ...... $339.00 S R O T I N O M ...... $589.00 ...... PANASONIC S M E D O M ...... /J-SCl Novation ZENITH AMDEK SHARP Anchor 2Contoler lle tro n o C C2 ...... $499.00 0 7 A ...... $369.00 0 4 A 4 r l r lle tro n o C C47 2...... $319.00 A For Drives Disk CRO-SCI C S - O R IC M Franklin & Apple & Franklin ...... Hayes BMC ......

; t s e w $309.00 ...... $125 00 $125 $95.00

$9.00 $79.00 $89.00

| P FRANKLIN E3GLE c o m m o d o r e 8 0 3 2 ...... $999.00 CBM 6 4 ...... CALL tACEKXX) C O n iP U T E R 4032 ...... $749 00 8096 Upgrade Kit ...... $369.00 Super Pet...... $1 599.00 2031 ...... $369 00 8250 Double Sided Disk Drive $1699.00 \ D9060 5 Megabyte Hard Disk $2399.00 D9090 7.5 Megabyte Hard Disk $2699.00 8050 ...... $1 299.00 h 4 0 4 0 ...... $969.00 8300 (Letter Quality) $ 1 549.00 8 0 2 3 ...... $599.00 4022 ...... $ 3 9 9 0 0 o New Z-Ram. Adds CP/M and 64K Ram $549.00 64K RAM The M anager...... $209.00 M agis...... CALL 780 KB Disk Storage Word Pro 5 plus...... $319.00 64K Personal Computer Word Processing, Ultracalc CP/M, Word Pro 4 plus ...... $299 00 3 Hardware, Software and C Basic Software Word Pro 3 p lu s ...... $199.00 The Admmistator $379.00 peripheral compatable with the Smith Corona TP1 InfoPro Plus ...... $219 00 Apple II and even has some Letter Quality Printer Q y |- PejQ© P o w e r...... $79.00 features not found on the Apple. VIC 20 Dust Cover ...... $6.99 Retail Value $4895.00 $ 2 9 9 5 *0 0 CBM 8032 Dust Cover ...... $14.99 CBM 8050/4040 Dust Cover ...... $10.9 HEWLETT PACKARD V IC ZO ,,£=£1 m 1^ *179 H P * 85 VIC 1530 Commodore Daiassette ...... $69.00 PC SIC 1 540 Disk Drive ...... $339.00 VIC 1541 {64 Disk Drive)...... CALL s1969 VIC 1525 Graphic Printer ...... $339.00 H P -1 25...... $1969.00 Call... VIC 1210 3K Memory Expander...... $32.00 HP-85 16K Memory Module ...... $169.00 VIC 11 10 8K Memory Expander...... $53.00 5 1/4" Dual M aster Disk D riv e ...... $1799.00 for price and availability 16K VIC Expansion...... $94.00 Hard Disk w/ Floppy ...... $4349.00 on IBM-PC hardware, soft VIC 1011 RS232C Terminal In te rfa c e ...... $43.00 Hard D isk...... $3549.00 VIC 111 2 VIC IEEE-488 In te rfa c e ...... $86.00 "Sweet Lips" Plotter ...... $ 1199.00 ware and peripherals. VIC 1211 VIC 20 Super Expander ...... $53.00 80 Column Printer ...... $649.00 NEC 3550 Printer (for IB M ) ...... $2099.00 VIC M other B o a rd ...... $99.00

T A ttt HEW LETT PRINTERS m U K M PACKARD Televideo Terminals HP 41CV 9 1 0 ...... $579.00 Smith-Corona CALCULATOR 91 2 C ...... $699.00 9 2 0 C ...... $749.00 TP-1 9 2 5 C ...... $749.00 9 5 0 ...... $950.00 H P 4 1 C$209 ...... $149.00 *599 HP 10C...... $69.00 HP 11C...... $79.00 8 0 0 A ...... $1319.00 HP 1 2 C ...... $114.00 8 0 2 ...... $2649.00 8 0 2 H ...... $4695.00 C-ITOH (TEC) NEW 115C ...... $109.00 Starwriter (F10-40CPS) ...... $1399.00 8 0 6 ...... $5795.00 NEW 1 6 C ...... $114.00 Printmaster (F10-55CPS)...... $ 1749.00 8 1 6 ...... $9495.00 HPIL PERIPHERALS IN STOCK! Prowriter 80 Col (P) ...... $499.00 Prowriter 80 Col (S) ...... $629.00 Prowriter 2 (132 Col) ...... $799.00 Okidata NEC 8 2A ...... $429 00 . COMPUTERS 8 00 1-A...... $749.00 8 3 A ...... $659 00 8 0 3 1 ...... $749.00 84P...... $107900 80". 2 ...... $549.00 84S...... $119900 PC-1500 Printers IDS 8 0 2 3 ...... $549.00 132 (fully configured)...... $ 1599.00 POCKET COMPUTER 7 71 0/77 30 ...... $2399.00 80 (fully configured) ...... $1399.00 ALSO AVAILABLE: 3 51 0/35 30 ...... $1599.00 Call for other configurations. Printer w/cassette interface 0 Monitors JB-1201 ...... 1159.00 Daisywriter cassette tape recorder JC-1201 ...... $329.00 Letter Quality...... $ 1049.00 and 4K and 8K RAM EXTENSIONS JC-1202 ...... $899.00

e a s t 800-233-8950 IN PA. CALL [717] 3B7-9S76 477 E. THIRD ST., WILLIAMSPORT, PA. 17701 In-stock items shipped same day you call. No risk, no deposit on C.O.D. orders. Pre-paid orders receive free shipping within the continental United States with no waiting period forcertified checks or money orders. Add 3% (minimum $3.00) shipping and handling on all C.O.D. and Credit Card orders. NV and PA residents add sales tax. All items subject to availability and price change. NOTBi We stock manufacturer's and third party software for most all computers on the market! Call today for our new catalogue. samesi

a .o ° 4 < o 1 ^.o'09 \\9'°^«

.«v»° JJ*1 r 0 < $ > 9 jo**>rfT^ - ^ V^v . -v >*>■

For PET and CBM owners el* • f S ' T |\CS o n ly : <8# This is just 1 of 20 pages of the newest and biggest Skyles catalog, hot off the press. From Skyles We know you’ll want Electric Works, the this page, in its full oldest and largest 8V2 x 10 splendor, professional and another 19 you your very own specialists in the pages of peripherals, copy within the last business. software and books few weeks, call us at that will make your (800) 227-9998 PET or CBM (unless you live computer even nicer in California, in Q Skyles Electric Works to live with. So, if which case call M 231-E S. Whisman Road we missed sending (415) 965 1735. Mountain View, California 94041 Microcomputers in a College Teaching Laboratory, Part 2

by Richard Heist, Thor Olsen, and Howard Salts burg

Many laboratory situations design or construction of the devices, computer that conversion is complete involve measuring continuous which are very simple. (end of conversion, EOC). ranges of light, heat, and sound. The computer is programmed to An inexpensive device to help Analog Signals and measure the length of the timing cycle the digital computer deal with A/D Converters by repeatedly incrementing the micro­ these analog quantities is the When the transducer of interest pro­ processor index registers until the EOC analog transducer. Specific duces an electrical signal, the problem signal is received. The microprocessor applications to temperature and of property measurement is reduced to requires a fixed number of machine light intensity measurement one of measuring that signal (usually cycles to run through the program loop are discussed. voltage, current, or resistance) to the in which it tests for EOC and incre­ desired degree of accuracy and at an ap­ ments the index registers. Since these Part 1 of this series (MICRO 53:53)* propriate rate. Many laboratory meas­ cycles are accurately timed by the in­ gave an overview of the microcomputer urements require only slow ( < 50 Hz) ternal crystal oscillator, the count ac­ laboratory program at the University of data acquisition rates or low (8-bit) cumulated in the index registers is pro­ Rochester, Department of Chemical precision. The actual requirements portional to the elapsed time. By Engineering. In this article the prob­ should be evaluated carefully and suitable calibration, this count can be lems of measuring physical, chemical, realistically since they have an impor­ converted to the desired data format, and mechanical properties will be ad­ tant bearing on the technique and in­ and the measurement is complete. dressed, since such problems are com­ strumentation used to measure the Typical resolution can range from mon to most engineering and scientific electrical quantities. eight to 12 bits; the corresponding con­ laboratories. Temperature, pressure, When high-speed data acquisition version times are approximately three flow, and light intensity are typical and high resolution are not needed, it is to 200 milliseconds. The ability to quantities of interest, and in many remarkably easy to interface many trade off conversion time for resolution cases the required information is pro­ laboratory experiments and measuring gives these simple devices a flexibility vided by a transducer in the form of an devices to the computer. As will be not shared by other kinds of A/D con­ analog signal, usually electrical in demonstrated, an appropriate A/D con­ verters and makes them feasible for nature. Difficulties in the measure­ verter, selected for its flexibility, com­ many laboratory applications. ment and conversion to the desired bined with a microcomputer and a The device used for voltage meas­ physical or chemical quantity of these high-resolution dot matrix printer, urements is a QM-100 A/D converter signals may tend to obscure the pur­ becomes a versatile data acquisition (Analog Systems, P.O. Box 35879, Tuc­ pose of the measurement. The micro­ system (the universal instrument refer­ son AZ). This device has three indepen­ computer often offers a simpler alter­ red to in the first article in this series dent A/D channels, each with a 0 to 10 native to more conventional laboratory (MICRO 53:53). This combination can VDC input range. In operation, a instrumentation, thus making it easier be used effectively and inexpensively voltage ramp generator is triggered by for the user to maintain a focus on the to solve many laboratory measurement the computer, and its output is com­ purpose of the measurements. Further­ problems. pared to the transducer voltage. A com­ more, it combines this decrease in The two types of A/D converters, parator signals the computer when the complexity with low cost, high speed, which have been widely used in the ramp just exceeds the transducer reliability, and precision. Rochester program, both employ a voltage (EOC]. In what follows, the use of simple pulse-width technique for data conver­ For resistance measurements, a interfacing devices will be discussed. sion, even though one is used to simple A/D method outlined in an arti­ These devices were selected for their measure voltage and the other resis­ cle in MICRO2 was chosen. It uses a flexible operating characteristics, tance. Each device, upon command 555 timer IC in the configuration which give them quite general utility. from the computer (a trigger pulse) shown in figure 1. The conversion Examples will illustrate their applica­ begins a timing cycle, the length of method involves charging the timing tion to the measurement of tempera­ which is proportional to the magnitude capacitor, Cl, to a fixed voltage ture and light intensity. The emphasis of the applied analog signal. At the end through the transducer resistance, R, will be on specific applications, not on of the cycle, the converter signals the and measuring the charging time with

No. 55 - December 1982 MICRO - The 6502/6809 Journal 59 ■5VDC Construction details have not been discussed at length since they are ade­ quately described in the microcom­ puter and electronics literature5, but good construction techniques must not be underemphasized, particularly for applications requiring higher precision. The important construction practices TRIGGER are documented in the literature and are well known to experienced person­ nel. Do not hesitate to ask for advice. OUTPUT Some care should be exercised in (EOC) the use of the converters. For instance, the characteristics of all electronic components are, to some extent, tem­ perature-dependent. Therefore, large fluctuations in ambient temperature should be avoided during data collec­ tion or between calibration and actual use. Another point concerns the use of Figure 1: A S5S timer wired as a monostable multivibrator. A typical the 555-based converter in the triggered value for C2 is .01 The value chosen for C1 depends upon R. For Instance, If R = mode described above. When the EOC 150 K S and 10-bit conversion is desired (1024 counts, see text), then C1 should be about 0.1 (see reference 3). is reached, the 555 IC starts discharging the timing capacitor and the system the computer. The computer triggers multiplexer. A similar circuit, based on will remain in discharge mode until it the charging process and is then sig­ the 75151 IC, can be used to construct is triggered again. If the time between naled by the 555 timer when conver­ an 8-channel device. Both multiplexer EOC and the next trigger pulse varies, sion is complete. By choosing the ap­ ICs and their operation are described in the circuit may operate with varying propriate combination of transducer detail in the literature listed in levels of residual charge on the timing and timing capacitor for a specific ap­ reference 4. capacitor. The result will be timing er- plication3, you have a simple and inex­ pensive data acquisition system.

While the examples described here P A 7 > are specific to temperature and light- intensity measurements, the concepts are general. These interfacing methods can be extended to virtually any kind of voltage or resistance measurement. Moreover, it is clear that the use of a resistance transducer, when appropri­ ate, can result in a significant simplifi­ cation of hardware, compared to other techniques, and it will often pay to change to sensors of this type. One additional point that should be made in connection with the pulse- width A/D converters is the ease with R0 - which these devices can be multi­ plexed. Many times it is necessary to measure a number of inputs simultane­ ously. Since most microcomputers will V a THE NETWORK OF FOUR 555'' support only a limited number of I/O j TIMERS SHOWN ABOVE fS lines, it is useful to be able to switch- f * ’REPLATED THREE TIMES select devices automatically (multi­ ■ - , GIVING 16 SEf ARATE UNITS ;i '>,*4 plex). Examples of this include the simultaneous monitoring of the tem­ V ,! perature of each tray of a multistage distillation column and multiple con­ Figure 2: A 16-channel multiplexer circuit based on a 74150 TTL Integrated circuit. centration profile measurements along The end-of-conversion signal, pin 3, of any of the 555 timers can be accessed by a tubular reactor. The circuit shown in placing the appropriate binary number (0-15) on the input pins (15, 14, 13, and 11, respectively) of the 74150. In the diagram, PA0 - PA4 and PA7 represent PET parallel figure 2 has been used to multiplex the port connections. The output from the 74150 Is available at pin 10. The resistance sensors in several experiments. It is value of the transducers, R0 - R15, will determine the value of the charging capacitor, based on the 74150 IC, a 16-channel C (see figure 1). A typical value is 0.22 ^F (see reference 3).

60 MICRO - The 6502/6809 Journal No. 55 - December 1982 Figure 3: A two-stage voltage amplifier. The overall gain ranges from 630 to 1260, depending upon the setting of the 20 Ks variable resistor in the feedback loop of the second stage. The optional diode network ensures that the output voltage will be positive (D1) and will not exceed 10VDC (D2). This is a requirement for proper operation of the QM-100 A/D converter. D3 is used to indicate over-ranging. rors, leading to poor reproduction of the the output voltages. The millivolt-level tubes (e.g., colorimeters and spectro­ data. The problem can be circumvented signals generally available must be photometers). It has proven to be easy by introducing a sufficient delay be­ amplified to the 0.5 to 10 VDC range to use either the QM-100 or the 555 tween measurements to assure total before A/D conversion can be performed converter to interface the micro­ discharge, or by operating the system satisfactorily. Fortunately, the fre­ computer to such optical instruments. with reproducible discharge time. quency response requirements are min­ In fact, inexpensive colorimeters based Temperature Measurement imal for most applications, so large- on a 555 timer/photoresistor circuit Two analog electrical signals com­ gain amplifiers (100X - 2000X) are can be built to almost any geometry re­ monly associated with temperature are relatively simple to build6. See figure 3 quired by an intended application. thermocouple voltage and thermistor for a typical example. When adjustable For photomultiplier-equipped spec­ resistance. The problem is to provide a gain is included, the combination trophotometers where the output sig­ convenient method for measuring amplifier and QM-100 converter be­ nal is a current, a simple circuit can be these analog signals, then convert the comes an A/D system that is inexpen­ used to convert the transducer output results to temperature. sive, versatile, and reliable. to a voltage6. A typical example of a Consider, for example, a tempera­ Thermistors, in contrast to thermo­ current-to-voltage converter circuit is ture measurement in which a precision couples, can be manufactured to pro­ shown in figure 4. Once a voltage is of one degree Celsius is desired at a vide large resistance changes for small available, the procedure for using the temperature of 100 degrees. If the sen­ temperature differences. Unfortunately, QM-100 is the same as described above. sor is a thermocouple, the transducer the response is highly non-linear, and A major use of this type of optical output will be in the low millivolt the response characteristics tend to be instrumentation is in measuring the range and a difference of one degree in non-uniform, even among thermistors concentration of light-absorbing temperature would produce a voltage of the same kind. These properties chemicals in liquids and gases. Nor­ difference of, at most, a few tens of make it difficult and expensive to mally, the response of such instru­ microvolts — beyond the direct resolu­ reduce thermistor output to tempera­ ments is proportional to the inverse ex­ tion of most analog meters. As the ture with analog hardware. Using a ponential function of the concentra­ precision requirement of an experiment microcomputer with the 555 timer tion. Thus, should a linear response be increases, conventional thermocouple A/D, on the other hand, you can easily required when using a chart recorder instrumentation becomes costly. handle these complex relationships with for data acquisition, an expensive With digital instrumentation, this appropriate software modifications. linearizing module must be added. precision is not difficult to achieve. In some cases, not only is a linear Provided the input signal at 100 degrees Light-Intensity Measurement response required, but the quantity of is within the upper half of the con­ Another property commonly meas­ interest is the total amount of a verter's input range, all that is required ured in laboratories is light intensity. chemical that has passed through the is an eight-bit A/D converter. An ob­ In chemical laboratories, this measure­ detector. This type of measurement re­ vious problem, then, in interfacing ment is usually made with commer­ quires the capability to integrate a thermocouples (and many other labora­ cially available instrumentation equip­ response over time — another module tory devices as well) is the low level of ped with photocells or photomultiplier to add to the recorder.

No. 55 - December 1982 MICRO - The 6502/6809 Journal 61 The simplicity of microcomputer- 1 Ki» based systems can best be illustrated by the measurement of optical density of fluids. An extremely simple colori­ meter, useful for many chemical con­ centration measurements, can be con­ structed from a suitable light source, such as a light-emitting diode, and a photoresistor, placed on opposite sides of a translucent vessel containing the fluid to be studied. The photoresistor is interfaced via the 555 A/D converter. Since the components (light source and photoresistor) can be very small, e.g. three mm diameter, and the units are so simple, a variety of geometries can be accommodated. Thus, a chemical reaction involving a color change can be followed in situ in a small test tube. Figure 4: A current to voltage converter. The circuit shown here will typically produce There is no need to disturb the process millivolt-level output for microampere-level input with good frequency response. by withdrawing samples for analysis. Another example is the study of the When the microcomputer is used to dated without additional cost as long as dispersion of a dye in a liquid flowing monitor such instruments, these con­ the relationship can be adequately des­ in a long tube. It is a simple matter to versions require only a few lines of ad­ cribed by mathematical expressions. place these LED-photoresistor color­ ditional code in the applications pro­ Also, since the computer can store imeters in collars clamped around the gram. Within the limits of the micro­ spectral data between scans, it is possi­ tube, at intervals, and observe the computer's capabilities, any relation­ ble through computer interfacing to dispersion effect without disturbing the ship between sensor output and the convert a single-beam spectrophoto­ flow. quantity of interest can be accommo­ meter into a pseudo dual-beam device. Note that when a LED is used in

SOPHISTICATED TELE-COMMUNICATION IS HERE PREMIER THE COMMUNICATOR ISSUE for 4.0 Commodore Computers With: HIGHER SPEED MORE SOPHISTICATED CONTROL LOWER PRICE o m m a n d e r THE HARDWARE — A printed circuit board; easily installed in the CBM. It uses no CBM connectors; gives a serial port with true RS232C standard. The board alone is capable of running up to 9600 THE MONTHLY JOURNAL FOR baud. With the software it will run up to 4800 baud. THE SOFTWARE - COMMODORE — Emulates the ADDS Regent 100, ADM 31 and/or the TeleVideo 950.’ Or choose the VT100 model for use with DEC and VAX COMPUTER USERS computers. — Runs coresident with BASIC programs; lets BASIC programs 64 PET/Cb and program on host computer communicate to develop really sophisticated communication and control capabilities. — The program is on ROM at either address; no disk loading re­ MAX MACHINE quired. Uses only 512 bytes of RAM; will relocate itself around ‘COMMA/VD£H u/>/f dedicated ro communicating rh*fun of, as weil as (he any other machine language program at top of memory. latest information about the COMMODORE COMPUTERS. ’ — Will upload and download and run BASIC programs. With BASIC program will upload and download standard data files. 100 page GET YOUR MONEY'S WORTH manual gives program listing for BASIC programs. You’ve probably made a sizeable investment in your computer Excellent text editor designed to work with THE COMMUNICATOR equipment. COMMANDER can help you make the most of ii. Each THE COMMUNICATOR $200 THE COMMUNICATOR and issue bnngs you the no-nonsense advice you need to stay on the Text Editor $ 40 U.D.S. 1200 baud modem $625 leading edge of this constantly changing field. COMMANDER will be U,D.S. 1200 baud $450 THE COMMUNICATOR and Hayes your reference source to the world of computers wih the best. most Hayes 300/1 200 baud $595 300/1200 baud modem $770 comprehensive coverage you can geti! PREMIER ISSUE CJ 1 YRJ22 Q 2 YR. $40 Q 3 YR. 4M We sell U.D.S. and Hayes 300 baud modems at excellent prices to DISC OUNT lWC£SDO /vorINCLUDE W DISCOUNT) COMMANDER AMPLIFY, INC. Sw4>*£np

62 MICRO - The 6502/6809 Journal No. 55 - December 1982 this mode it is important that it is sup­ V„ (+5 to 4QV) plied a constant current. A simple cir­ cuit that will accomplish this7 is shown in figure 5. PROFESSIONAL WORD PROCESSOR Concluding Comments Doubt*.' Columns ' P;ige by Pardqr.'iph The general utility of the A/D con­ • Hfqht Justification Line Centering Printer Graphic? ' Shorthand verter (computer) printer combination Variable Line Space Margin Control deserves reiteration. In going from one > Printer Control Code ' Form Letters application to another, only portions of FOR APPLE/PET/CBM the applications program need to be COPY-WRITER changed; the data acquisition routines on ly $1 8 5 .0 0 remain unaltered. The A/D devices previously described can be adapted to EXCHANGE DATA w IBM 3740 ..K'- . PEDISK II 877 FLOPPY DISK Sys- a variety of resistance, voltage, and cur­ m:-' f$fns can now read and write records rent measurements with little or no LED J-l from IBM “ Basic Data Exchange" for V„ = 5V and 2 LEOs ■ y type diskettes. FILEX software from modification. The flexibility of these in series R = 5-1012 ,v' * ' WILSERVE does all the work! Con- A/D converters, the computational - ' ■ verts EBCDIC - ASCII. capability of the microcomputer in the E X C w h W A jjftffi (877/FILEX)...... S1295. Figure 5: A current regulator. The LM334 is PEDISK 877-1 8’ Floppy for PET ...... $ 995. reduction of data, and the high- PEDISK 540-1 5’ Floppy for PET ...... $ 595. an adjustable current source with good CONTROLLER BOARD w POOS...... $ 229. resolution hard copy capability of the current regulation. A typical value for R PEDISK II is a high performance floppy disk dot-matrix printer are combined to with two LEDs In series is 5 to 10 ohms. system designed for the Commodore PET/CBM, The two LEDs in series are used to provide Rockwell AIM and Synertek SYM. it features high make the system an inexpensive but performance, simple reliable design and IBM for­ a sample signal and a reference signal for powerful universal data acquisition mat. the colorimeter applications discussed in instrument. SOFTWARE FOR PEDISK II the text. COPYWRITER Pro Word Processor...... $185. Once it is realized that resistance Francisco, 1978); "The TTL Data MAE Macro Assembler Editor by EHS ...... $170. and voltage can be measured so easily FLEXFILE II Data Base Manager ...... $ 80. Book," (Texas Instrument, Inc., PAPERMATE Word Processor ...... $ 60. with the microcomputer, you may 1976), 2nd ed.; D. Lancaster, "The DISK UTILITY PACK...... $ 25. wish to redesign existing experiments FASTFILE Data Base...... $100. TTL Cookbook,” (Howard W. Sams FILEX IBM Access Routines ...... $245. to match the output to the interface, MENU LOAD...... $10. and Co. Inc., Indianapolis, 1979). fullFORTH+...... $100. rather than the other way around. In 5. See, for example, P. Horowitz and particular, it may be advantageous to W. Hill, "T h e Art of Electronics," Commodore Communicates! generate resistance, rather than current (Cambridge University Press, Cam­ COMPACK $129. or low-level voltage; e.g., use thermis­ bridge, 1980); F.M. Mims, "Engi­ Intelligent Temmal Package including ACIA based interface tors instead of thermocouples. neer's Notebook II. Integrated Cir­ At moderate expense, the system DB25 cable cuit Applications," (Tandy Corpora­ STCP software can be expanded further to provide the tion, 1981); Z.H. Meiksin and P.C. Remote Telemetry > XON-XOFF C o n tro l capability to feed back information and ' Transfer to/fr Disk ' User Program Cntl Thackary, "Electronic Design with ' Printer Output ' Status Line change the operating conditions of the Off-the-Shelf Integrated Circuits,” device it monitors. Digital to analog (Parker Publishing Co. Inc., West $139 COLOR CHART conversion and control will be dis­ AIM/SYM system video display, 64 x 16 Nyack, NY, 1980); S.A. Hoenig, characters, 8 colors, plugs into ROM cussed in a subsequent paper. "How to Build and Use Electronic socket, 4K RAM Multiple modes; semi The role of the computer in the graphics, alpha. Devices without Frustration, Panic, PET/CBM color graphic display, 128 x laboratoy is that of a tool. Certainly it Mountains of Money or an Engineer­ 192 pixels, generate color bar graphs is a remarkable tool in terms of power on one screen with data on main ing Degree," (Little, Brown and Co., screen. RS170 video color chart. and capability; but nevertheless, it is a Boston, 1980) 2nd ed. 6847 based video output. means to an end and not the end in it­ 6. See, for example, W. Jung, "IC Op- COLOR VIDEO FOR PET/CBM/AIM/SYM self. This point is sometimes too easily amp Cookbook,” (Howard W. Sams ROMSWITCH -4 ROMS IN 1 forgotten. and Co. Inc., Indianapolis, 1979); SPACEMAKER $39.95 "Operational Amplifiers: Design Switch 4 ROMs into the same socket References A slide switch activates one of four and Application," (McGraw-Hill Electronic controls insure no glitches 1. H. Saltsburg, R.H. Heist, and T. Book Company, New York, 1971), and allow ROM switching under soft­ Olsen, MICRO, The 6502/6809 ware control ROMs can be switched edited by J.G. Graeme, G.E., Tobey, from the keyboard Journal, (53:53). and L.P. Huelsman. 2. J. Sherburne, MICRO, The 6502/ fullFORTH+ for APPLE/PET 7 F.M. Mims, "Engineer's Notebook FULL FiG FORTH implementation plus 6809 Journal, (26:31). II. Integrated Circuit Applications,” conditional assembler, floating point, 3. See, for example, H. Berlin, "The (Tandy Corporation, 1982) p. 116. string handling, multidimensional arrays, 555 Timer Applications Sourcebook and disk virtual mamory. fuliFORTHt from IDPC Co $100. with Experiments," (Howard W. You may contact the authors at the Target Compiler . . $ 5 0 Sams and Co. Inc., Indianapolis, Department of Chemical Engineering, SEE YOUR DEALER OR: 1979). University of Rochester, Rochester, NY /»!■! • v P.O.K.u. BoxBOX 102 H 14627. 1 M IC R O T E C H ] Langhorne, Pa. 19047 4. See, for example, " Signetics Logic — > ^ 215-757-OJ215-757-0284 DEALER INQUIRIES INVITED TTL Data Manual," (Uniplan, San JMCftO

No. 55 - December 1982 MICRO - The 6502/6809 Journal 63 Arcade Joysticks — Heavy duty with 2 firing buttons! Great for the VIC or 64 SuperPET (5 languages, 2 processors) CBM 8032 Computer, 80 c o lu m n ...... CBM Memory Expansion, 64K ...... MasterCard, Visa, Money Order, Bank Check PET 4032, 40 C o lu m n ...... COD (add $5) accepted. CBM 8050, 1 Mg Dual Drive ...... Add 3% surcharge for credit cards. CBM D9060. 5 Mg Hard D is k ...... In stock items shipped within 48 hours, FO 8.. Dallas, TX CBM 09090. 7 5 Mg. Hard D is k ...... All products shipped with manufacturer's warranty. CBM 4040 340K Dual D rive ...... TO ORDER CALL TOLL FREE CBM 2031, 170K Single D rive ...... PRINTERS — LETTER QUALITY 800-527-4893 800-442-1048 (Within Texas) CBM 8300.40cps ...... SJB will meet any competitive price under Diablo 620,25cps ...... similar in-stock conditions, / Nec Spm writer 7 700.5 5 c p s ...... SJB DISTRIBUTORS, IHC./* Nec Spm w riter 3 5 0 0 ,3 5 c p s ...... PRINTERS— DOT MATRIX 10520 Plano Road, Suite 206 CBM 40 2 2,80cps,graphics ...... Dallas, Texas 75238 ^ CBM 8023,150 cps g ra p h ic s ...... (214) 343-1328 Okidata 82A.120cps

GA MICRO - The 6502/6809 Journal No. 55 - December 19f /AICRO Apple Slices

APPLE SLICES BINARY — SEA1 T. S. 0.

ZERO PAGE EQUATES By Tim Osborn 7 IflWTR EPZ $9B WORK POIWIBl 8 VARNAM EPZ $81 CONTAINS LAST USED VAREABIZ NAME 9 VARAD EPZ $83 ADDRESS OF PASSED STRING 10 CHtiiET EPZ $B1 APPI£SOFT’ S ROUTINE TO GET A BYTE 11 One of the fastest techniques that lets 12 j EDIMTS you search for a specific occurrence of 14 AMPERV EQU $3F5 AMPERSAND VECTOR DXATCD HERE 15 FIND EQU $E053 ROUTINE TO LOCATE ’VARIABLE DESCRIPTOR j an item within a sorted set is the binary 16 CHKDTO EQU SDEBB CHEEK FDR OPEN PAREN search. This month's column presents 17 GETAKYPT EQU $F7D9 ROUTINE TO FIND ARRAY DESCRIPTOR 18 CHKCCM EQU $DEBE CHECK TOR CX*WA a subroutine (BINARY-SEARCH) that 19 SYNEBR EQU $DEE9 DISPLAY SYNTAX ERfOR 20 DATA . EQU $D995 ADVANCE TXTPTR TO END OF STATEMENT you may call from your BASIC pro­ 21 grams to perform a binary search on a 9400 22 ORG $9400 9400 23 OBJ $800 FDR LISA sorted (ascending) string array. The ad­ 9400 24 vantages of a binary search over a serial 9400 A9 4C 25 striv u : LDA #$4C JIMP ABSOLUTE INSTRUCTION 9402 8D F5 03 26 STA AMTCRV search increase as the number of items 9405 A9 10 27 LDA #ENTW LSB OF ENTRY ADDRESS 9407 8D F6 03 28 STA AMPEKV+1 in the array grows. For example, an ar­ 940A A9 94 29 txft / o n ro MSB OF ENTRY ADDRESS ray of 4096 items can be searched in 940C 8D F7 03 30 STA AMPERV+2 940F 60 31 RTS less than 11 tries. 9410 32 9410 20 Bl 00 33 entry JS R CHRGET •(TFT OTARJtTER 9413 20 BB DE 34 JS R CHKDTO ;SKJULD BE OPEN PAREN The Method 9416 20 09 F7 35 JS R GETAFffPT ;C2T ARRAY DESCRIPTOR 9419 AO 04 36 UH #4 A binary search tests the middle ele­ 941B B l 9B 37 LDA (iOtfTRhY j SHOUID BE A ONE DIMENSION ARRAY 94 ID C9 01 38 CMP #1 ment in the remaining part of the array. 9 4 IF FO 03 39 BEQ ENTRY1 If the element is higher than the search 9421 40 C9 DE 40 JMP SYNERR ;E ISE DISPIAY ERROR MESSAGE j 9424 AS 9B 41 ENTRY1 LDA LCWTR ;SAVE ARRAY DESCRIPTOR ADRS. : j argument (the value being searched 9426 8D 7B 95 42 STA SAVARRAY ;IS B ' 9429 A5 9C 43 txft irwiw-i :! for), the part of the array from this ele­ 942B 8D 7C 95 44 STA SAVARRAY+1 rMSB ; ment upward is left out of the search by 942E 20 BE DE 45 JS R CHKOCM ;CHK FOR C0W1A + IX1AD A W/NEXT BYTE 9431 85 81 46 STA VARNAM resetting the upper limit to the index of 9433 20 Bl 00 47 JS R CHRGET •GET NEXT BYTE 9436 DO 03 48 W E ENTRY2 jffiOUlD NOT BE END OF STATEMENT the element. If the element is lower 9438 4C C9 DE 49 ERROR JMP SYNERR ; DISPIAY SYNTAX ERROR MESSAGE than the search argument, the part of 943B C9 24 50 a m cre CMP #'$■ ;DOUAR SIQ? 943D DO 02 51 a r e NAMING ;NO, MU5T BE TWO CHARACTER NAME i the array from this element downward 943F A9 00 52 LTA #$00 9441 09 80 53 NAMING ORA #$80 ;NEGATIVE ASCII is left out by resetting the lower limit 9443 85 82 54 STA VARNAW-1 to the index of this element. The pro­ 9445 20 53 EO 55 JS R FIND ; FIND DESCRIPTOR 9448 AO 02 56 LOT #2 ' gram then finds the average of the up­ 944A B l 9B 57 LDA (IOtfTRhY ;CZT + SAVE THE : | 944C 8D 74 95 58 STA VARLN ; T JNT7TH OF PASSED STRING ! per limit and the lower lim it and 944F C8 59 INY searches the element at this location. 9450 B l 9B 60 LDA (l£WTR).Y •GET + SAVE THE | 9452 85 83 61 STA VARAD ;ADCRESS OF PASSED STRING The procedure continues until the ele­ 9454 C8 62 INY 9455 B l 9B 63 LXft (I£WTR),Y ment is found or until it discovers that 9457 85 84 64 STA VARADfl the upper and lower limits have con­ 9459 AD 7B 95 65 LDA SAVARRAY ;R^STABLISH LCH^TR TO 945C 85 9B 66 STA UVTR ;ADCRESS OP ARRAY DESCRIPTOR verged without finding the element. 945E AD 7C 95 67 LDA SAVARRAY+1 9461 85 9C 68 STA ITWTR+1 9463 AO 05 69 UN #5 ;CZT UPPER UM . OF DIM (LOW BYTE) The Subroutine 9465 B l 9B 70 LDA (UVTR),Y 9467 8D 78 95 71 STA UPUW-1 ;MAKE I0W-HKH The syntax for the binary search is: 946A C8 72 INY 946B B l 9B 73 u a ( iow tr), y 946D 8D 77 95 74 STA UPLEM & GET (XX$,YY$) 9470 A9 00 75 U A #$00 ; INITIALIZE UDWER LIMIT 9472 8D 79 95 76 STA IflWLIM 9475 8D 7A 95 77 STA LOMUM+1 ; where 1. XX$ represents any legal 9478 20 31 95 78 SEAROTIP JS R CQMPIIX INDEX* (UPLIM+ICWLIM) /2 947B 20 56 95 79 JS R BY3 ; MULTI PLY INDEX BY 3 (ifNGIH OF PTR. ENTRIES) string array name, and 2. YY$ 947E 18 80 e r r . | 947F A5 9B 81 LDA IXVTR ?ADO BASE TO INDEX! represents any legal string variable 9481 6D 7B 95 82 ADC SAVARRAY name. This subroutine will return in 9484 85 9B 83 STA IXVTR ;T 0 OBTAIN POINTER TO ELEMENT 9486 A5 9C 84 UA IXWTR+1 SS% the index number of the element 9488 6D 7C 95 85 ADC SAVARRAY+1 948B 85 9C 86 STA LTWTR+1 in XX$ that has a value equal to YY$ if 948D AO 07 87 LDY #7 rOFFSET TO IZNGIH OF EUMENT the item is found. If the item is not 948F B l 9B 88 LDA (UVTR),Y 9491 8D 7D 95 89 STA ARRAYEN found the subroutine will return a -1 9494 O) 74 95 90 CMP VARLM ;FIND SHORTEST ARGUMENT

{ No. 55 - December 1982 MICRO - The 6502/6809 Journal 65 J 9497 30 06 91 BMI ARRAYST ;EL£MEt7T SHORTEST in SS%. To use the & feature you must 9499 AE 74 95 92 U K VARLN ; STRING SHORTEST 949C 4C AO 94 93 jm p c a m BRUN the object program. The other 949F AA 94 ARRAYST TAX ;PUT ELEMENT LfiJGIH IN X choice is to BLOAD the program and 94 A0 ca 95 CONTI INY ;0FFSE7T TO ADDRESS 94 A1 Bl 9B 96 LDA (LOWTR) ,Y ;GET LOW BYTE OF ADDRESS use CALL -27632 in place of the 94A3 8D 7F 95 97 STA ARRAYAD 94 A6 ca 9a INY ampersand. This will allow you to use 94A7 Bl 9B 99 LDA (I£WTR),Y ;GET HIQi BYTE this subroutine in conjunction with 94A9 8D 80 95 100 STA ARRAYAD+1 94PC AO 00 101 LOT #500 ; INITIALIZE Y another ampersand routine. 94AE AD 7F 95 102 LOA ARRAYAD rSET UP LCWTR AS 94B1 85 9B 103 STA LOWTR ;ZERD PAGE PTR. TOR ARRAYAD Upon entering the subroutine at 94B3 AD 80 95 104 LDA ARRAYAD+1 ENTRY the TXTPTR (see July Apple 94B6 85 9C 105 STA I£WTR+1 94B8 Bl 9B 106 COMPEL LDA (U V TR ),Y ;CCMPARE ARRAY TO Slices for an explanation of TXTPTR, 94BA DI 83 107 CMP (VARAD),Y ;STOING FIND, CHRGET, DATA, and VAR­ 94 EC 30 2F 108 BMI STRNCHI ? STRING IS GREATER 94 BE FO 03 109 BED CCMP1 NAM) is advanced to point at the first 94C0 4C OF 95 110 JMP STTOGLO ;STOING I S LOWER 94C3 c a 111 CCMP1 INY character past the GET token. Next, a 94C4 CA 112 DEX JSR to CHKOPN (an Applesoft built-in 94C5DOFI 113 a r e OCKPIP rCOWITNUE COMPARE 94C7 AD 7D 95 114 LEA ARRAYtN routine) is performed, which checks for 94CA CD 74 95 115 CMP VAHUN ; COMPARE STRING + EUOTHT LENGIH 94CD 30 IE 116 BMI STTOOII ;I F STRING IS LONGER an open parenthesis. The JSR to GET- 94CF FO 03 117 BED EXIT r FOUND THE EXfMEOT ARYPT (Applesoft built-in routine) 94D1 4C OF 95 118 JMP STTOGUD ; STRING IS 5K5RTER 94D4 A9 D3 119 EXIT LEA *503 ;FIND OR CREATE A DESCRIPTOR returns with the address of the descrip­ 94D6 85 81 120 STA VARNAM ;TOR SS% INTEGER 94D8 85 92 121 STA VARNAMH tor for XX$ in LOWTR (9B$ - 9C$). If 94DA 20 53 EO 122 JSR FIND • BY JS R TO FIND the array cannot be found an "O U T OF 94DD AO 02 123 U3Y #2 94DF AD 76 95 124 IDA INDEX+1 ; STORE H I® BYTE OP INDEX DATA IN LINE nnn" error message is 94E2 91 9B 125 STA (IXWTR) ,Y ; FIRST produced. 94E4 C8 126 INY 94E5 AD 75 95 127 L A INDEX ;TH0J UM BYTE Lines 36-40 check the number of 94 E8 91 9B 128 STA (UMTR),Y 94EA 4C 95 D9 129 JMP DATA r RESET TXTPTR + RETURN TO BASIC dimensions to be sure that this is a one­ 94 ED AD 79 95 130 STWiGil LDA UMLJM ,-IF LOWUM = INDEX 94P0 CD 75 95 131 CMP INDEX ;THAN E tO d n 1 CAN'T BE POUND dimensional array. If it is not, a syntax 94F3 DO OB 132 a?E HI2 error message is produced (line 40). The 94F5 AD 7A 95 133 LDA LOWLB+H 94F8 CD76 95 134 CMP INDEX+1 array descriptor address is then saved 94FBDO03 135 a r e HI2 94FD 4C 4B 95 136 JMP NOTEOUND ;S 0 BRANCH TO NOTEOIWD RTN. for future use in SAVARRAY (lines 41 9500 AD 75 95 137 H I2 IDA INDEX r RESET LOWER LIMIT through 44). A JSR to CHKCOM en­ 9503 8D 79 95 138 STA UDWUM 9506 AD 76 95 139 LEA INDEX+1 sures that a comma separates the two 9509 8D 7A 95 140 STA IDWUMfl 950C 4C 78 94 141 JMP SEARCHLi1 C0OTINUE SBUO J parameters and loads the accumulator 950F AD 77 95 142 STTOGLD IDA UPUM IF UPLI^INDEX with the first byte following the com­ 9512 CD 75 95 143 CMP INDEX THEN ELfMBff CAN'T BE FOUND 9515 DO OB 144 BJE L02 ma. This byte is stored at VARNAM. 9517 AD 78 95 145 LDA UPUM+1 951A CD 76 95 146 CMP INDEX+1 Lines 47 through 54 load VARNAM + 951D DO 03 147 a r e W 2 1 with either the negative ASCII of the 951F 4C 4B 95 148 JMP MOTTOGND ;SO BRANCH TO NOTPDUND ROUTINE 9522 AD 75 95 149 102 LDA INDEX ; RESET UPPER LIMIT second byte of the two-byte or longer 9525 8D 77 95 150 STA UPUM 9528 AD76 95 151 IDA INDEX+1 variable name, or $80 if the variable 952B 8D 78 95 152 STA UPUM+1 name is only one byte long. 95 2E 4C 78 94 153 JMP SEARCH LP ; CONTINUE SEARffl 9531 154 A JSR to FIND loads LOWTR with 9531 155 ?CCMPUTE NW INDEX the address of the descriptor of the 9531 18 156 CCMPIOC CLC ; INDElC=(UPIJ>H-LfMIJM)/2 9532 AD 77 95 157 LEA UPUM ;ADD UPUM TO IOWIJM passed variable. Lines 56 through 64 9535 6 d 79 95 158 ADC LOWLJM 9538 8 d 75 95 159 STA INDEX ;SND STOR IN INDEX load and save the length and address of 953B AD 78 95 160 LDA UPUM+-1 the passed variable in VARLN and 953E 6D 7A 95 161 ADC ICWUM+1 9541 8D 76 95 162 STA INDEX+1 VARAD respectively. Lines 65 through 9544 4E 76 95 163 LSR INDEX+1 ; DIVIDE By TOO 9547 6E 75 95 164 ROR INDEX 74 re-establish LOWTR to the address 954A 60 165 RTS of the array’s descriptor (SAVARRAY) 954B A9 FF 166 NOTTOUND LDA *$FF ; - l MEANS NCTOOUID 9540 8D 75 95 167 STA INDEX and initialize the upper lim it (UPLIM) 9550 8D 76 95 168 STA INDEX+1 9553 4C D4 94 169 JMP EXIT to the size of the array. The lower lim it 9556 170 (LOWLIM) is then initialized to zero, 9556 AD 75 95 171 BY3 LEA INDBC ;IJ3WrR=(INDEX*3) 9559 85 9B 172 STA LOWTR and the main search loop (SEARCHLPJ 955B 06 9B 173 ASL LCWTR ;(I£WTK*2) 955D AD 76 95 174 LEA INDEX+1 is entered. First there is a JSR to 9560 85 9C 175 STA LCWTftfl COMPIDX, which is an internal rou­ 9562 26 9C 176 ROL LCVTftfl 9564 18 177 r r r tine that takes the average of the upper 9565 AD75 95 178 LEA INDEX = tP STA IOWTB 956C AD 76 95 181 LDA INDEX+1 and lower limits and stores the result 956F 65 9C 182 ADC EOWIRH at INDEX. INDEX will be used as the 9571 85 9C 183 STA icw n a-i 9573 60 184 RTS current position in the array of the 9574 185 9574 186 IOTQoJAL STORAGE: AREAS binary search. 9574 187 Now SEARCHLP takes the current 9574 188 VARLN DPS $1 VARIABLES U 30IH 9575 189 INDEX DPS $2 SEMEH INDEX value of the INDEX field and multiplies 9577 190 UPLIM DPS 52 H lfflEST POSSIBLE POSITION FOR SEARCH 9579 191 LOWLIM DPS $2 LOWEST POSSIBLE POSITION TOR SEARCH it by three (JSR BY3), placing the result 957B 192 SAVARRAY DPS $2 MDFK ARBV in LOWTR. This is done because each 957D 193 ARRAYUf DPS $2 l o o i h a e c u r s jm array element 957F 194 ARRAYAD DPS 52 ad d ress a? cw rsjt array eument string element in the array has a three- 9581 195 9581 196 3*D byte entry in the array descriptor, s

66 MICRO - The 6502/6809 Journal No. 55 - December 1987 length byte followed by a two-byte X-register as a counter). If the string is and JMPs to EXIT where INDEX is address. To find the displacement of lower in value than the array element a passed to the SS% parameter as de­ the individual element's entry from the JMP to STRNGLO is performed (line scribed above. base address of the array's descriptor, 110). If the string is higher in value, If the upper and lower limits have it is necessary to multiply INDEX then a JMP to STRNGHI is performed not converged, STRNGHI then resets by three. (line 108). If the two items are equal the lower limit by moving INDEX LOWTR is then added to the base (line 109) the lengths are compared. If (lines 137 through 140). STRNGHI address of the array's descriptor the string is shorter it is considered to then returns to the main search loop (SAVARRAY); the result is stored back be lower in value and a JMP to (SEARCHLP) to continue the search. in LOWTR. The length of the searched STRNGLO is performed (line 116). If STRNGLO works essentially like element is then found and saved in the two items are of equal length then a STRNGHI except it tests for con­ ARRAYLN (lines 88 through 89). The branch to EXIT is performed, which vergence by checking to see if INDEX is seven-byte Y-index value is needed sets up an integer variable SS% and equal to the upper limit. If it is not, because the individual string array en­ loads it with the current value of IN­ STRNGLO resets the upper lim it to tries start seven bytes from the begin­ DEX. This value is the location of the INDEX instead of the lower limit. ning of the array descriptor in any one­ search argument in the array. The last dimensional array. The X-register will thing EXIT does is JMP to DATA, Subroutine Hints be used as the number of bytes left in which is Applesoft's routine to advance Before using BINARY-SEARCH you the array element and string variable to the TXTPTR to the end of the current should set HIMEM to 37888 or lower (if compare. It is initialized to the lower of statement (lines 119 through 129). you decide to load the routine at the VARLN and ARRAYLN internal STRNGHI first compares the lower $9400). I could have set HIMEM for parameters (lines 90 through 94). lim it of the search (LOWLIM) to the you in SETVEC, but I believe that Next, the address of the array ele­ INDEX. If they are equal then the upper leaving this task to you allows more ment is found and placed in LOWTR lim it and the lower lim it have con­ flexibility; you can BLOAD and CALL (lines 95 through 104). The compare verged, which means the element the routine instead of using the & loop |COMPLP) then compares the ar­ could not be found. Under this condi­ feature. You can also BRUN the ray element to the string variable, byte tion a JMP to the internal routine NOT- subroutine from anywhere in your for byte, up to the length of the shortest FOUND is performed [lines 130-136). BASIC program, instead of just from of the two elements (using the NOTFOUND loads INDEX with a - 1 the first line. J9MCRO

ANNOUNCING A NEW JOURNAL ^ ^ • cisio n D«ci«ion Syst«m« Q P.O. Box 13006 DEVOTED TO ALL ASPECTS Systems D«nton, TX 76203

' Q u OF MICROCOMPUTER SOFTWARE FOR THE APPLE II*

ISAM -O S is an integrated set of Applesoft rou'mes that gives indexed file capabilities to your BASIC programs. Retrieve by key, partial key or sequentially Space from deleted records is automatically reused Capabilities and performance that match ^ « L USE 1THE products costing twice as much. UNDERGRADUATE $50 Disk. Applesoft. PBASIC-DS is a sophisticated preprocessor for structured BASiC Use advanced logic constructs such as IF . ELSE..., CASE, SELECT, and many more. Develop programs for Integer or Applesoft. Enjoy the power of structured logic at a fraction ol the c o s t o f P A S C A L . 135. Disk, Applesoft I48K. ROM or Language Card) PREMIER I A V DSA — DS is a disassembler for 6502 code. Now you can easily dis assemble any machine language program for the Apple and use the dis assembled codt directly as input to your assembler Dis-asserrbles instruc tions and data. Produces code com patible w ith the S-C Assembler (version 4 0), Apple's Toolkit assembler and others f a >25 Disk. Applesoft (32K, ROM or Language Card) FORM-DS is a complete system for me definition of input and output froms. FORM DS supplies the automatic checking of numeric mout lor acceptable range of values, FEBRUARY 1983 automatic formatting of numeric output, and many more features $25 Disk. Applesoft (32K, ROM or Language Card)

UTIL-DS is a set of routines for use with Applesoft to format numeric output, selec wrIte: tively clear variables (Applesoft's CLEAR gets everything), improve error handling, and interface machine language with Applesoft programs. Includes a special load routine for placing machine language routines underneath Applesoft programs Collegiate Microcomputer $25 Disk. Applesoft SPEED-DS is a routine to modify the statement linkage m an Applesoft program to speed its execution improvements of 5-20% are common. As a bonus, SPEED-DS Rose-Hulman In stitu te of Technology includes machine language routines to speed srm g handling and reduce the need fo' garbage clean-up Author Lee Meador $15 Disk. Applesoft (32K, ROM or Language Card). Terre Haute IN 47803 USA

(Add $4.00 for Foreign Mail)

Prospectus sent upon request. "Apple II is a registered trademark of the AppluComputer Co

No. 55 - December 1982 MICRO - The 6502/6809 Journal 67 BOX 120 ALLAMUCHY, N.J. 07820 201-362-6574 HUDSON DIGITAL ELECTRONICS INC THE TASK* MASTERS

HDE supports the *TIM, AIM, SYM and KIM (TASK) with a growing line of computer programs and peripheral components. All HDE component boards are state-of-the-art 4V2” x 6V2”, with on board regulation of all required voltages, fully compatible with the KIM-4 bus.

OMNIDISK 65/8 and 65/5 HDE DISK BASIC Single and dual drive 8” and 51A” disk systems. A full range disk BASIC for KIM based systems. Complete, ready to plug in, bootstrap and run. Includes PRINT USING, IF ... THEN ... ELSE. Include HDE’s proprietary operating system, Sequential and random file access and much FODS (File Oriented Disk System). more. $175.00 HDE ADVANCED INTERACTIVE DM816-M8A DISASSEMBLER (AID) An 8Kstatic RAM board tested fora minimum of Two pass disassembler assigns labels and con­ 100 hours and warranted for a full 6 months. structs source files for any object program. Saves multiple files to disk. TIM, AIM, SYM, KIM versions. $95.00

HDE ASSEMBLER DM816-UB1 Advanced, two pass assembler with standard A prototyping card with on-board 5V regulator mnemonics. KIM, TIM, SYM and KIM cassette and address selection. You add the application. versions. $75.00 ($80.00 cassette)

HDE TEXT OUTPUT PROCESSING SYSTEM (TOPS) DM816-P8 A comprehensive text processor with over 30 A 4/8K EPROM card for 2708 or 2716 circuits. commands to format and output letters, docu­ On board regulation of all required voltages. ments, manuscripts. KIM, TIM and KIM cassette Supplied without EPROMS. versions. $135.00 ($142.50 cassette) HDE DYNAMIC DEBUGGING TOOL (DDT) Built in assembler/disassembler with program DM816-CC15 controlled single step and dynamic breakpoint A 15 position motherboard mounted in a 19” entry/deletion. TIM, AIM, SYM, KIM AND KIM RETMA standard card cage, with power supply. cassette versions. $65.00 ($68.50 cassette) KIM, AIM and SYM versions. HDE COMPREHENSIVE MEMORY TEST (CMT) DISK PROGRAM LIBRARY Eight separate diagnostic routines for both Offers exchange of user contributed routines static and dynamic memory. TIM, AIM, SYM, and programs for HDE Disk Systems. Contact KIM and KIM cassette versions. $65.00 ($68.50 Progressive Computer Software, Inc. for details. cassette) AVAILABLE DIRECT OR FROM THESE FINE DEALERS:

Progressive Computer Software Johnson computers Falk-Baker Associates Perry Peripherals 405 Corbin Road Box 523 382 Franklin Avenue P.O. Box 924 York, PA 17403 Medina, Ohio 44256 Nutley, NJ 07110 Miller Place, NY 11764 (717)845-4954 (216) 725-4560 (201)661-2430 (516) 744-6462 Lux Associates Laboratory Microcomputer Consultants 20 Sunland Drive P.O. Box 84 Chico, CA 95926 East Amherst, NY 14051 (916) 343-5033 (716) 689-7344 Adding Voice to a Computer

by Michael E. Valdez

A low-cost procedure for the only method available today that cal but it is important to recognize that sampling and reproducing voice permits the user to sample his own this is the only real synthesis procedure with a computer including the speech. The unit to be described in this for the production of speech by a com­ required hardware and software. article is inexpensive (fifteen dollars for puter; that is, it is not necessary to parts), and the knowledge require­ sample speech to obtain data to be Voice ments of acoustics and linguistics are reproduced by the computer as in the requires: minimal. The user should know how to other methods. The voice is generated use a tape recorder and write some sim­ by entering numbers into the computer A computer with a 4-bit port ple programs. The hardest requirement and the SC01, or any other device. available and a Motorola 3417 is the timing of the loops. The quality Naturally, since this method does not speech/digital converter of reproduction is quite good and reproduce speech, the generated voice depends heavily on the quality of the does not resemble the voice of the Several methods are available today to tape recording equipment. The digital operator, or anybody else. In its most add voice to a computer. The method data can be stored in read-write or read­ elementary use, the voice can be developed by uses a only memory, or it can be saved on described as robot-like because of the model of the mouth and generates the magnetic tape or disk. lack of intonation and inflections. With necessary parameters by linear predic­ The phoneme concatenation additional work and knowledge, it is tive coding. This method gives excel­ method uses the SC01 phoneme syn­ possible to obtain better results. The lent results producing isolated words thesizer developed by Votrax. The cost of a simple unit is under one hun­ with very high quality, but is expen­ results of this procedure are mechani­ dred dollars. The use of this method re- sive. Another problem is that it is necessary to have a read-only memory Listing 1: Program for Adding Voice to a Computer with the parameters of the words to be used; this read-only memory can be i o o o: 2 ORG $1000 1000: 3 * MODIFY TO SUIT INSTALLATION produced only by Texas Instruments. It 1000: 4 ******************************* has several ready-made, read-only 1000: 5 XX l oo q : 6 X X memories with standard vocabularies l o oo: 7 X PROGRAM TO ADD VOICE TO AN'Y x at a very reasonable price. Using this l o o o: 8 XX io o o : 9 XX method requires minimal knowledge of 1000: 10 x COMPUTER X acoustics and linguistics. The user has iooo: 11 X X iooo: 12 X X to write some simple programs to con­ iooo: 13 ******************************* trol the unit, the worst requirement be­ iooo: 14 MSB OFF ing to prevent the words from running iooo: 15 X iooo: 16 x STORAGE LOCATION MUST■ BE MODIFIED together. iooo: 17 x TO S U IT SYSTEM The signal compression and delta iooo: 18 X ooio: 19 PNT EQU $10 modulation method developed by Na­ 0012: 20 END EOU $12 tional Semiconductors, although very o o n : 21 BITS EQU $14 iooo: nn X different technically, is similar from iooo: 23 x SYSTEM SUBROUTINES the user’s point of view to the one iooo: 24 X developed by Texas Instruments. With F8B 2: 25 KKK EQU $F8B2 KEYBOARD INPUT IN A S C II f a s f : 26 OUT EQU $FA5F OUTPUT IN A S C II this method it is also necessary to use a iooo: 27 X read-only memory produced by the iooo: 28 * LOCATIONS OF I/O PORT iooo: 29 X manufacturer, and the cost is also in e f b o : 30 DELR EQU $EF80 65 22 PORT the same range (around two hundred E F 8 2 : 31 DELDR EQU $EF82 6522 DATA DIRECTION REGISTER iooo: 32 X dollars). But, the results are somewhat iooo: 33 X robotic. iooo: 34 x PROGRAM START iooo: 35 X A continuously variable slope delta iooo: 36 X modulation developed by Motorola io o o : a 2 00 37 DELTA LDX *0 BEGINNING OF BUFFER uses the same integrated circuit for io o 2 : bd 52 11 38 DELI LDA DLM,X 1 0 0 5 :C 9 IF 39 CMP *$ 1 F storing and reproducing speech. This is io o 7 : fo 06 40 BEQ DEL4 (continued)

No. 55 - December 1982 MICRO - The 6502/6809 Journal 69 quires some knowledge of linguistics Listing 1 (continued) 1009 20 5F FA 41 JSROUT and phonetics if good results are 100C E8 42 INX desired, but the manufacturer provides 100D DO F3 43 BNEDELI 100F A9 0E 44 DEL4 LDA t$E INITIALIZE PORT substantial support. i o n 8D 82 EF 45 STA DELDR Intel has developed what they call 1014 20 02 11 46 JSR ADRS an analog microprocessor — a single­ 1017 DO 01 47 BNE DEL2 1019 48 * PROGRAM ENDS WHEN THE INITIAL ADDRESS IS chip device to work with analog 1019 60 49 RTS signals. This unit, the 2920, can be 10 1A C9 FF 50 DEL2 CMP t*FF STANDARD FILE 101C F0 IA 51 BEQ DEL3 used for or reproduc­ 10 IE A5 13 52 LDA END+1 MOVE TO POINTER tion, but its use is limited to those per­ 1020 85 11 53 STA PNT + 1 1022 A5 12 54 LDAEND sons with a substantial knowledge of 1024 85 10 55 STAPNT acoustics, linguistics, physics, mathe­ 1026 A2 00 56 LDX to END OF BUFFER matics, and a high level of program­ 1028 BO FA 11 57 DELS LDA DLM3,X 102B C9 IF 58 CMP t tlF ming proficiency. This unit is for the 1020 F0 06 59 BEQ DEL6 serious user. There are several other 102F 20 5F FA 60 JSROUT 1032 E8 61 INX units in this category, manufactured by 1033 DO F3 62 BNE DELS TRW, Harris, and others. 1035 20 02 11 63 DEL6 JSR ADRS 1038 A2 00 64 DEL3 LDX to INPUT OR OUTPUT? 103A BD El 11 65 DEL7 LDA D L M 1 tX The Motorola 3417 1030 C9 IF 66 CMP t*lF The Motorola 3417 is a linear 103F F0 06 67 BEQ DEL8 1041 20 5F FA 68 JSR OUT bipolar chip housed in a 16-pin dual in 1044 E8 69 INX line package, which is compatible with 1045 DO F3 70 BNE DEL7 1047 20 B2 F8 71 DEL8 JSR KKK both TTL and CMOS technologies. The 104A C9 4F 72 CMP t*4F ASCII O 16-pin package makes it easy to mount 104C F0 5 Ei 73 BEQOUTPUT 104E C9 49 74 CMP **49 ASCII I since sockets are available everywhere. 1050 DO E6 75 BNE DEL3 The chip has the circuitry for the en­ 1052 76 * coder (speech to digital) and decoder 1052 77 * 1052 78 * INPUT ROUTINE (digital to speech) conversions. 1052 79 * Pins 1 and 7 are the speech input 1052 80 * 1052 A2 00 81 LDX to SIGNAL WHEN READY and output while pins 13 and 9 are the 1054 BD 16 12 82 INF'O LDA D L M 2 ,X digital input and output, respectively. 1057 C9 IF 83 CMP t*lF 1059 F0 06 84 BEQ ' INP4 Data then travels in the chip from pin 1 105E1 20 5F FA 85 JSROUT to pin 9 or from pin 13 to pin 7 depend­ 105E E8 86 INX ing on the input to pin 15, encode/ 105F DO F3 87 BNE INP0 1061 20 B2 F8 88 INP4 JSRKKK decode. A high in pin 15 makes the chip 1064 A9 OC 89 LDA t*C START CLOCK encode the speech input to pin 1 giving 1066 8D 80 EF 90 STA DELR 1069 A0 00 91 LDY to a digital output through pin 9. A low in 106B A2 08 92 INPUT LDX #8 EIGTH BITS pin 15 converts digital input through 106D A9 04 93 INP1 LDA *4 CLOCK LOW 106F 8D 80 EF 94 STA DELR pin 13 to a speech output in pin 7. 1072 EA 95 NOP DUMMY The chip provides for positive and 1073 EA 96 NOPDUMMY negative excursion of the speech signal 1074 AD so EF 97 LDADELR GET NEXT BIT 1077 4A 98 LSR A MOVE TO CARRY FLAG with a regulated voltage at half of the 1078 26 14 99 ROLBITS ASSEMBLE WORD supply voltage that is used as zero for 107A A9 OC 100 LDA **C CLOCK HIGH 107C 8D 80 EF 101 STADELR the speech input or output. The chip 107F CA 102 DEX COUNT BITS also provides pin 12 to set the threshold 103P DO 18 103 BNE INP3 CYCLE EIGHT TIMES 1082 A5 14 104 LDA BITS RECOVER WORD between digital zero and one, to adjust 1084 91 10 105 STA (PNT >,Y SAVE IN BUFFER the chip to different technologies. The 1086 E6 10 106 INC PNT INCREMENT POINTER 1088 DO 02- 107 BNE 1N P 2 feedback point of the output amplifier 108A E6 11 108 INC PNT + 1 is accessible in pin 6 to include a filter 108C 38 109 INP2 SEC TEST FOR BUFFER FULL if desired. Pins 3, 4, and 11 provide ac­ 108D AS 12 110 LDA END 108F E5 10 111 SBC PNT cess to the integrator to permit the ad­ 1091 A5 13 112 LDA END+1 dition of a syllabic filter. The Motorola 1093 E5 11 113 SBC PNT + 1 1095 B0 D4 114 BCS INPUT GO BACK FOR MORE 3417 works with a single supply 1097 4C 00 10 115 JMP DELTAEND voltage and requires a 16 Khz clock in­ 109A A1 14 116 INP3 LDA < BI T S , X) DUMMY put at pin 14. 109C A1 14 117 LDA < BITS tX ) DUMMY 109E A1 14 118 LDA (BITS tX > DUMMY The data sheet provides a full ex­ 10A0 A1 14 119 LDA (BITS f X) DUMMY planation of the theory of continuously 10A2 B5 14 120 LDA BITS f X DUMMY 10A4 B5 14 121 LDA BITS r X DUMMY variable delta modulation as well as a 10A6 4C 6D 10 122 JMP INP1 CONTINUE variety of circuit information. 10A9 123 * 10A9 124 * 10A9 125 * OUTPUT ROUTINE 10A9 126 * Hardware 10A9 127 * For reasons of simplicity and low 10A9 A9 00 128 OUTPUT LDA to CLOCK LOW cost, the unit described in this article 10AB 8D 80 EF 129 STA DELR

70 MICRO - The 6502/6809 Journal No. 55 - December 1 Listing 1 (continued) uses the Motorola MC3417 continu­ 10AE A2 00 130 LDX *0 SIGNAL WHEN READY 10B0 BD 16 12 131 OUT 4 LDA DLM2 r X ously variable delta modulator/demod­ 10B3 C9 IF 132 CMP *$1F ulator. The Harris HC55516 could also 10B5 F0 06 133 BEQ OUTS be used but the circuit must be rede­ 10B7 20 5F FA 134 JSR OUT 10BA E8 135 INX signed to account for the fact that the 10BB DO F3 136 BNE OUT 4 55516 is a CMOS chip. If the computer 10BD 20 B2 F8 137 □UTS JSR KKK 10C0 A0 00 138 LDY *0 to be used has an available port with 10C2 Bl 10 139 OUTOLDA ( P N T ) fY GET NEXT WORD four free bits, very few additional com­ 10C4 85 14 140 STA BITS SAVE IT IN BITS ponents are needed. Furthermore, none 10C6 E6 10 141 INCPNT INCREMENT POINTER 1GC8 DO 02 142 BNE OUT 1 of the components shown on the cir­ 1 OCA E6 11 143 INC PNT + 1 cuit is critical and the values can vary 10CC A2 08 144 OUT 1 LDX #8 SEND EIGHT BITS 10CE A9 08 145 0UT2 LDA *8 CLOCK HIGH before the quality of the results is 10D0 8D 80 EF 146 STA DELR degraded. Normally, the noise and the 10D3 A9 02 147 LDA *2 PREPARE ACCUMULATOR 10D5 06 14 148 ASLBITS GET BIT quality of the tape recording equipment 10D7 2A 149 ROL A INTO ACCUMULATOR will be the limiting factors for the 10D8 2A 150 ROLA SHIFT ONE MORE quality of the reproduction. The circuit 10D9 8D 8 0 EF 151 STA DELR SEND TO 3417 10DC 29 02 152 AND *2 CLEAR CLOCK shows part of a 6522 Versatile Interface 1 ODE 8D 80 EF 153 STA DELR CLOCK LOW Adapter controlling the 3417, but the 10E1 CA 154 DEX EIGHT BITS? 10E2 DO 0E 155 BNE 0UT3 GO FOR MORE job can be done with any other pro­ 10E4 38 156 SEC TEST FOR BUFFER FULL grammable parallel port, or with three 10E5 A5 * -7 157 LDA END 10E7 E5 10 158 SBC PNT flip-flops and one tri-state unit. If the 10E9 A 5 13 1 5 9 LDA END+1 program presented with this article is 10EB E5 11 160 SBC PNT + 1 to be used, the location of each signal 10 ED B0 D3 161 BCSOUTO GO FOR MORE 10EF 4C 00 10 162 JMP DELTA in the word must be respected. Bit zero 10F2 A 1 14 163' OUT 3 LDA (BITS t X) DUMMY is the digital output from the chip, bit 10F4 A 1 14 164 LDA (BITS f X) DUMMY 10F6 A 1 14 165 LDA < BI T S » X) DUMMY one is the digital input to the chip, bit 10F8 Bl 14 166 LDA ( B I T S ) ,Y DUMMY two is the encode/decode control, and 10FA B5 14 167 LDA B I T S ,X DUMMY bit three is the clock. Bit zero must be 10FC B5 14 168 LDA BITS tX DUMMY 10FE EA 169 NOP DUMMY programmed as input and the other 10FF 4C CE 10 170 JMP OUT2 CONTINUE three as outputs. 1102 171 X 1102 172 X One interesting point to mention in 1102 173 * GET ADDRESS SUBROUTINE this circuit is the lack of a clock. The, 1102 174 X 1102 175 X 3417 requires a 16 Khz clock; in this 1102 A9 00 176 ADRS LDA to circuit the clock is produced in soft­ 1104 85 12 177 STAEND ware thereby avoiding the problems of 1106 85 13 178 STA END+1 1108 20 B2 F8 179 ADR0 JSRKKK GET CHARACTER synchronization. If an independent 110B 20 5F FA 180 JSROUT DISPLAY IT clock is used, it is necessary to sample 110E C9 53 181 CMP *$53 CHECK IF S 1110 DO 11 182 BNE ADR1 it to send and recover the bits at the 1112 A9 00 183 LDA *0 STANDARD BUFFER proper time. 1114 85 10 184 STA PNT 1116 84 12 185 STY END CHANGE VALUES The audio amplifier shown on the 1118 A9 04 186 LDA *4 circuit is very simple and includes an 111A 85 11 187 STA PNT + 1 PER INSTALLATION elementary filter to reduce the digitiz­ m e A9 40 188 LDA *$40 H I E 85 13 189 STA END+1 ing noise. Notice the capacitor in 1120 A9 FF 190 LDA *$FF parallel with the speaker for the same 1122 60 191 RTS 1123 C9 0D 192 ADR1 CMP *$D CHECK FOR CAR RET reason. Some experimentation with the 1125 F0 26 193 BEQ ADR3 values used in a particular circuit 1127 C9 30 194 CMP *$30 TEST IF NUMBER 1129 90 DD 195 BCC ADR0 IGNORE IF NOT might improve the quality of reproduc­ 112B C9 3A 196 CMP *$3A tion. The circuit can be built in the ex­ 112D 90 OC 197 BCC PKA isting board of the computer, if there is 11ZF C9 41 198 CMP *$41 TEST IF HEXA LETTER 1131 90 D5 199 BCC ADR0 IGNORE IF NOT room, or wire wrapped in a small board 1133 29 5F 200 AND *$5F CONVERT TO UPPER CASE and connected as convenient. Only five 1135 C9 47 201 CMP *$47 1137 B0 CF 202 BCS ADR0 volts are required to power the unit. 1139 69 09 203 ADC *9 113B 29 OF 204 PKA AND *$F 113D OA 205 ASLA ROL INTO END, END+1 Software 113E 0A 206 ASLA The software presented with this ar­ 113F OA 207 ASLA ticle is self explanatory. The user must 1140 0A 208 ASLA 1141 A2 04 209 LDX *4 adjust the memory locations to match 1143 OA 210 ADR2 ASL A his system. The subroutine KKK reads 1144 26 12 211 ROLEND 1146 26 13 ROL END+1 the keyboard and returns with the 1148 CA 213 DEX ASCII character in the accumulator; 1149 DO F8 214 BNE ADR2 114B F0 BB 215 BEQ ADR0 the subroutine OUT displays the 114D A5 12 216 ADR3 LDA END GET IF ZERO accumulator. 114F 05 13 217 ORA END+1 The only part of the program that 1151 60 218 RTS (continued)

No. 55 - December 1982 MICRO - The 6502/6809 Journal 71 should be treated carefully is the Listing 1 (continued) generation of the clock. It is important 1 1 5 2 : 219 * to maintain the sampling and reproduc­ 1 1 5 2 :5 3 50 45 220 DLM ASC "SPEECH ANALYSIS AND SYNTHESIS USING" 1 1 5 5 I4 J 43 48 tion clocks as close as possible. Large 1 1 5 8 :2 0 41 4E variations produce unpleasant results. 1 1 5 B :4 1 4C 59 115E:53 49 53 The program presented here has 1 1 4 1 :2 0 41 4E been written for the 6502. Converting 1164:44 20 53 the code to any other microprocessor 1167:59 4E 54 116A:48 45 53 requires only limited programming 116D:49 53 20 ability. 1170.'55 53 49 1173 J 4E 47 1175.*0D 221 DFB 13 The Use of the Unit 1 1 7 6 :4 3 4F 4E 7*77 ASC "CONTINUOUSLY VARIABLE SLOPE DELTA The unit is very simple to use. A MODULATION'1 1179 54 49 4E cassette or any tape recorder records 117C 55 4F 55 the words of messages to be stored for 117F 53 4C 59 1182 20 5 6 41 later reproduction. It is good to leave 1185 52 49 41 pauses before and after each part to aid 1188 42 4C 45 118B 20 53 4C in recognition. When an acceptable 118E 4F 50 45 record has been obtained, especially 1191 20 44 45 without too much background noise, 1194 4C 54 41 1197 20 4D 4F the output of the tape recorder is con­ 119A 44 55 4C nected to the input of the unit, and the 119D 41 54 49 11A0 4F 4E program is run. 11A2 0D 223 DFB 13 Some practice is required to start 11 A3 57 49 54 224 ASC "W ITH THE MOTOROLA MC3417 IC . 11A6 48 20 54 the tape recorder and to signal the com­ 11A9 48 45 20 puter such that the whole record is 11 AC 4D 4F 54 11AF 4F 52 4F sampled; this is especially true when 11B2 4C 41 20 the record is long and the buffer is 11B5 4D 43 33 small. Recall that 2K of memory is 1168 34 31 37 1 IBB 20 49 43 needed for each second of speech. The 11BE 2E program permits finding the initial and 1 1BF 0D 0D 225 DFB 1 3 ,1 3 11C1 50 4C 45 226 DLM0 ASC "PLEASE, ENTER BEGINING ADDRESS1' final location of memory used by the 11C4 41 53 45 11C7 2C 20 45 11CA 4E 54 45 11CD 52 20 42 U D 0 45 47 49 11D3 4E 49 4E 11D6 47 20 41 S c o I c k \ 11D9 44 44 5 ° 11 DC 45 53 53 1 IDF 0D IF 227 DFB 13,* IF MEMOREX 11E1 228 * 11E1 0D 229 DLM1 DFB 13 11E2 49 53 20 230 ASC " I S IT INPUT OR OUTPUT?" \ferbatim U E 5 49 54 20 11E8 49 4E 50 11EB 55 54 20 11EE 4F 52 20 maxell 11F1 4F 55 54 11F4 50 55 54 11F7 3F 11F8 0D IF 231 DFB 1 3 , * IF BASF UFA 232 * U F A 50 4C 45 233 DLM3 ASC "PLEASE, ENTER LAST ADDRESS" 11FD 41 53 45 1200 2C 20 45 wabash 1203 4E 54 45 1206 52 20 4C 1209 41 53 54 Diskettes and all your media needs 120C 20 41 44 Our REGULAR prices are SPECIAL 120F 44 52 45 1212 53 53 C A LL FREE (8001421-3957 I 1214 0D IF 234 DFB 1 3 , *1 F 1216 235 * C.O.D. charge cards accepted. 1216 50 4C 45 236 DLM2 ASC "PLEASE, SIGNAL WHEN READY' Excellent dealer program. 1219 41 53 45 121C 2C 20 53 121F 49 47 4E 1222 41 4C 20 1225 57 48 45 1418 West Shaw Avenue 1228 4E 20 52 Fresno, CA 93711 122B 45 41 44 122E 59 122F 0D IF 237 DFB 1 3 , *1 F 1231 238 * * ** SUCCESSFUL a s s e m b l y : NO ERRORS

72 MICRO - The 6502/6809 Journal No. 55 - December 19; Voice Output Circuit sample, by changing the initial and final locations of the part to be reproduced. If the message has pauses, it is possible to save memory by converting the reproduction program into a sub­ routine, making a call for each one of the parts, with appropriate waiting loops separating them. If it is better to leave the pauses in, clear the tape noise by storing hexadecimal 55 in all the locations of the pause. Now it is possi­ ble to see how little noise the process itself introduces! When the message is to be stored in permanent memory and used many times, it is ad visable to use a good high­ speed tape recorder and a person with a pleasant voice to produce the originals. With several messages stored on disk it is possible to write a routine that calls the proper message into a standard area of memory and reproduces it. In this way, the same routine can handle many messages in an economical way.

You may contact Mr. Valdez at 1001 Flotilla, Indian Harbour Beach, FL 32937.

JMCftO

P e r r y PeRiphERAls R e p a ir s K I M s !! (SYMs ANd AIMs Too) • We will Diagnose, Repair, and Completely Test your Single Board Computer • We Socket all replaced Integrated Circuits • You receive a 30-day Parts and Labor Warranty • Your repaired S.B.C. returned via U.P.S. — C.O.D., Cash Don’t delay! Send us your S.B.C. for repair today Ship To: (Preferably via U.P.S.) P e r r y PcRiphcRAls 6 Brookhaven Drive Rocky Point, NY 11778

K IM - 1 R e p I a c e m c n t M o d u U s • Exact replacement for MOS/Commodore KIM-1 S.B.C. • Original KIM-1 firmware — 1K and 4K RAM versions

R e p I a c e m e n t KIM-1 KEyboARds • Identical to those on early KIMS — SST switch in top right corner • Easily installed in later model KIMs

Perry Peripherals is an authorized HDE factory service center. Perry Peripherals carries a full line of the acclaimed HDE expansion components for you KIM, SYM, and AIM, including RAM boards, Disk Systems, and Software like HDE Disk BASIC V1.1. Yes, we also have diskettes. For more information write to: P.O Box 924, Miller Place, NY 11764, or Phone (516) 744-6462.

No. 55 - December 1982 MICRO - The 6502/6809 Journal 73 Enhanced Video for OSI CIP

by David Cantrell and Terry Terrance

Add a screen blanker, inverse discuss OSI’s video as implemented on spaced dots — no blank spaces appear upper case, and dim character the CIP. Even though we've spent the between cells. As the rows of dots of set to your Challenger. past couple of years squinting at our each character are clocked out of the C IP 's screen almost daily, some of its shift register U42, the first dot in each subtleties have escaped us. When the row is held only one-third as long as the Enhanced Video screen is filled with CHR$(161) (OSI's others in that row. Since this happens requires: solid white block character) and is for the first dot of each row and for each viewed from about two feet away, all character, the end result is faint dark OSI C1P but the poorest TV or video monitor bars when viewed from a distance. hardware modification will show faint dark vertical lines on This is the subtle video defect al­ character cell boundaries. You may luded to before. It's so subtle that most have attributed these lines to a one-dot- OSIers do not notice it, or pass it off as By adding five chips and cutting only wide intercell space. intercell spacing. If C4 users are won­ two traces, you can add several features Closer inspection reveals that the dering why this effect can't be seen, the to your CIP video section. There will whole screen is filled with evenly effect is reversed on the C4. The first be a trade-off for these features, how­ ever. To keep the hardware and soft­ ware as simple as possible, you lose Figure 1: Schematic for Enhanced Video lower-case alphanumerics when these features are implemented. But, no soft­ ware support is necessary; no cumber­ some POKEing and no software drivers to scroll a background screen (because there isn’t any). You simply release your SHIFT-LOCK key whenever you want to enter modified video. Your machine's video will interpret lower­ case characters as modified video whenever this modification is enabled. Since the rest of your machine simply "sees1' lower-case alphanumerics, they can be put into strings and then simply PRINTed to the screen. The video mod­ ification can be disabled with either a hardware or software switch. The circuit keys on Video Data Bit 5 (VD5J and Video Data Bit 6 (VD6). Whenever these bits are high and the modification is enabled, VD5 and VD6 will be masked, turning lower case into upper case, and an upper-case character in the selected "mode" (i.e., inverse, dim, etc.) will be displayed instead of the lower-case character. Since charac­ ters above 128 also have VD5 and/or VD6 set, gating is used to restore VD5 and VD6 and disable the modification whenever VD7 is set, retaining your graphics characters. Before we get into soldering, let's

74 MICRO - The 6502/6809 Journal No. 55 - December 198 dot is accentuated giving rise to bright W e'll stop for a moment and ex­ with your system's clock, to produce vertical lines. This minor problem plain what this part of the circuit does. the blank screen option mentioned wouldn't be worth mentioning except U25 pin 3 is VD5 and U41 pin 22 is earlier. When SW1 is high, your screen the timing defect that causes it must be VD6, the data bits that the circuit keys will not show any display. Video fixed if we are to add our modified video. on to know whether to output modified memory will still be updated, however, Before you begin construction, here video. U41 pin 19 is VD7. Three gates so that whenever SW1 is brought low are a few warnings. Keep all wires as of U1 and two gates of U2 perform logic the whole screen will be restored. This short and as direct as possible. You'll to accomplish the following functions. could be handy to do screen set-ups, be dealing with your video signal at RF If VD5 and VD6 are high and SW2 is hide your game moves in a two-player frequencies. You'll want to avoid re- high and VD7 is low, U1 pin 6 is low game, etc. radiating your game of invaders all over causing lower-case characters to be your house and quite possibly to the read as upper case and activating the Table 1 offers a recap on the opera­ neighbors' too. Do not substitute rest of the circuit via U2 pins 9 and 10. tion of switches SW1-SW4. 74LSXX series components for 74XX If either VD6 or VD5 is low or SW2 is series components or vice versa. This low, U1 pin 6 will be high and the Table 1 circuit is carefully balanced regarding screen will behave normally. timing and current drive capabilities,- Continuing with conections, U42 SWITCH # MODE tampering will probably overheat all of pin 9 is brought into U3 pin 12. U42 1 2 3 4 the components in the circuit. pin 1 is brought into U4 pin 11; U42 The parts list is'short; you will need pin 7 is brought into U3 pin 5. Connect H X X X BLANK SCREEN U1 74LS08 Quad 2-Input And U42 pin 2 to U5 pin 3 and connect U42 L L X X NORMAL SCREEN Gates pin 2 to U5 pin 8. Signals coming out of L H L L UPPER CASE ONLY U2, U3 74LS00 Quad 2-Input Nand the circuit on U5 pin 5 must be con­ L H H L INVERSE UPPER CASE Gates nected to U70 pin 2. The output of the L H L H DIM UPPER CASE U4, U5 7474 Dual D Flip-Flop potentiometer R2 should be brought to L H H H DIM INVERSE UPPER R1 150 Ohm resistor U70 pin 6. CASE R2 5K Ohm This is where our circuit starts potentiometer modifying video. If the first part of the H = High, L = Low, X = Don't care SW1-SW4 SPST switch circuit has recognized a modified video Since there are five chips in the cir­ situation (i.e., VD5 VD6 VD7 SW2), To test the modification, be sure all cuit, it cannot be assembled in the pro­ then U2 pin 8 goes high. The signal is of the mode selection switches [SW1- to area of your CIP. You can assemble now fed to parts of U2 and U3 where, SW4) are in the low state; this will en­ the circuit on perfboard or solderless combined with the states of switches sure that you will have a normal screen breadboard using wire-wrap (or any SW3 and SW4, the inverse and dim op­ to look at while you're setting up. technique you prefer). The circuit tions are selected. If dim is selected, We'll write a little program to fill the assembles in a straightforward manner. either alone or in combination with in­ screen with mixed upper- and lower­ In figure 1 the chips numbered U1-U5 verse, the signal on U2 pin 11 is used to case characters like the one below: refer to the components of our modifi­ enable the flip-flop U4, which is clocked cation; all other "U " numbers refer to at the shift-load rate (i.e., CLK/8J and 10 FORX= 1T012 chips on your CIP. through the R1-R2 network modulates 20 PRINr'AaBbCcDdEeFfGgHhliJj” The schematic does not show how the video for a dimming effect. R2 con­ 30 NEXT to wire in SW1-SW4. SW1-SW4 are the trols the level of brightness from mode slection switches,- each one almost fully bright to almost dark. SW3 This should fill your screen with alter­ should connect its associated line to controls the inverse option. If it is low, nating upper- and lower-case letters. ground. We have not found it neces­ the normal video signal is passed from Using the mode selection switches, sary, but good circuit design would dic­ U42 pin 9 out to U5 pin 5 without in­ select inverse upper case; according to tate that the lines SW1-SW4 should be version (but with latching as we will table 1 this should be L H H L. With the pulled up to + 5 by 3.3K pull-up see in a moment). When SW3 is high, switches thus set, all lower-case letters resistors. Figure 1 does not show sup­ the shift-load clock (from U42 pin 1] should now be displayed as inverse up­ plying + 5V and ground to all of the and the inverse shift register output are per case. Step through all the other chips in the circuit. All the chips used combined by sections of U4 and U3 to modes to ascertain that they are work­ have the standard DIP power and produce inverse video. The section of ing properly. If not, carefully check ground pins. For 14-pin packages, all U5 that immediately follows fixes the your wiring of both the circuit board pins 7 should be wired to ground and all video defect we mentioned earlier. In­ and its interconnections to your CIP. pins 14 should be supplied with + 5V. stead of the dots being cut off by the Once the circuit is assembled, you video chain clock, it is now latched for must splice it onto your CIP. Cut the the whole period of the system clock trace running from U41 pin 23 to U40 and, therefore, maintains full bright­ You may contact the authors at Orion pin 13, and the trace running from U42 ness. This part of the circuit operates Software Assocs., 147 Main St., P.O. Box 310, Ossining, NY 10562. pin 9 to U70 pin 2. Connect U25 pin 3 regardless of whether any modified to U1 pin 1. Connect U41 pin 22 to U1 video options are selected. pin 9 and U41 pin 19 to U2 pin 2. Con­ We haven't forgotten SW1 and the JMCftO nect U1 pin 6 to U41 pin 23. other half of U5. They combine, along

No. 55 - December 1982 MICRO - The 6502/6809 Journal 75 AARDVARK TRS-80 COLOR OSI VIC-64 VIC-20 SINCLAIR TIMEX

TUBE FRENZY (by Dave Edson) This is an almost indescribably fast action arctide game. It has fast action, an all new concept in play, simple rules, and 63 levels of difficulty. All machine code, requires Joysticks. Another great game by Dave Edson. TRS 80 COLOR ONLY. 16k and Joysticks required. $19.95.

CATERPILLAR QUEST - A NEW IDEA IN ADVENTURE GAMES! Different from all the others. O.K., the Caterpillar does look a lot like a Centipede. We have spiders, falling fleas, Quest is played on a computer generated monsters traipsing across the screen, poison map of Alesia. Your job is to gather men mushrooms, and a lot of other familiar and supplies by combat, bargaining, explor­ stuff. COLOR 80 requires 16k and Joy­ ation of ruins and temples and outright banditry. When your force is strong enough, sticks. This is Edson's best game to date. $19.95 for TRS 80 COLOR. you attack the Citadel of Moorlock in a life or death battle to the finish. Playable in 2 to 5 hours, this one js different every PROGRAMMERS! time. 16k TRS-80, TRS-80 Color, and Sin­ SEE YOUR PROGRAM IN THIS SPACE!! Aardvark traditionally pays the highest com­ clair. 13K VIC-20. $14.95 each. missions in the industry and gives programs the widest possible coverage. Quality is the keyword. If your program is good and you CATCH'EM want it presented by the best, send it to A ardvark. (by Dave Edson) One of our simplest, fastest, funnest, all machine code arcade games. Raindrops and ESCAPE FROM MARS an incredibe variety of other things come (by Rodger Olsen) falling down on your head. Use the Joy­ This ADVENTURE takes place on the RED sticks to Catch'em. It's a BALL! — and a PLANET, You'll have to explore a Martian flying saucer! — and a Flying Y l— and so city and deal with possibly hostile aliens to on. TRS 80 COLOR. $19.95. survive this one. A good first adventure. PYRAMID (by Rodger Olsen) BASIC THAT ZOOOMMSM This is our most challenging ADVENTURE. AT LAST AN AFFORDABLE COMPILER! It is a treasure hunt in a pyramid full of The compiler allows you to write youi problems. Exciting and tough! programs in easy BASIC and then auto­ matically generates a machine code equiv­ HAUNTED HOUSE (by Bob Anderson) alent that runs 50 to 150 times faster. It's a real adventure—with ghosts and ghouls It does have some limitations. It takes a- and goblins and treasures and problems — least 8k of RAM to run the compiler and i ADVENTURES!!! but it is for kids. Designed for the 8 to 12 does only support a subset of BASIC- These Adventures are written in BASIC, are year old population and those who haven't about 20 commands including FOR, NEXT full featured, fast action, full plotted ad­ tried Adventure before and want to start END,GOSUB,GOTO, IF,THEN, RETURN ventures that take 30-50 hours to play. (Ad­ out real easy. END, PRINT, STOP, USR (X), PEEK ventures are interactive fantasies. It's like DERELICT POKE, > , < ,=, VARIABLE reading a book except that you are the main (by Rodger Olsen & Bob Anderson) NAMES A-Z, SUBSCRIPTED VARIABLES character as you give the computer com­ New winner in the toughest adventure from and INTEGER NUMBERS FORM 0-64K. mands like "Look in the Coffin" and Aardvark sweepstakes. This one takes place TINY COMPILER is written in BASIC. I "Light the torch.") on an alien ship that has been deserted for a generates native, relocatable 6502 or 680! Adventures require 16k on TRS80, TRS80 thousand years — and is still dangerous! code. It comes with a 20-page manual am color, and Sinclair. They require 8k on OSI can be modified or augmented by the usei and 13k on Vic-20. Derelict takes 12k on $24.95 on tape or disk for OSI, TRS-8 OSI. $14.95 each. Color, or VIC. Please specify system on all orders ALSO FROM AARDVARK - This is only a partial list of what we carry. We have a lot of other games (particularly for the TRS-80 Color and OSI), business programs, blank tapes and disks and hardware. Send $1.00 for our complete catalog. AARDVARK- 80 2352 S. Commerce, Walled Lake, Ml 48088 (313) 669-3110 Phone Orders Accepted 8:00 a.m. to 4:00p.m. EST. Mon.-Fri.

76 MICRO - The 6502/6809 Journal No. 55 - December 1 Home Control Interface for C IP

by John Krout

A circuit is presented that uses and a third form replaces a wall switch. code used by BSR, a few hardware mod­ the C1 P’s ACIA to control an Each control module is a radio receiver, ifications in your CIP will allow com­ ultrasonic transducer. The which accepts transmitted commands puter generation of the same codes, transducer generates signals only after receiving its own unit code. through an ultrasonic transducer, to that control the receiver The command console is the trans­ transmit to the command console. modules. mitter, utilizing home power lines as Figure 1 shows the various com­ an antenna. ponents of a single word of BSR code. Ohio Scientific was probably the The code is binary, with each bit BSR X-10 DRIVER first computer manufacturer to represented by an 8-ms pattern of requires: recognize the value of interfacing the sound. A bit with value 1 is sent as 4 X-10 command console to a personal OSI C1P ms of tone followed by 4 ms of silence. computer. OSI now offers a hardware BSR X-10 A bit with value 0 is sent as 1.2 ms of interface and a disk operating system to tone followed by 6.8 ms of silence. The hardware modifications support the X-10. However, OSI data word begins with a 1 bit, followed charges a premium price for these by five bits of data, followed by five in­ items, and offers nothing to those using verted bits of the same data, and com­ Perhaps the greatest untapped potential BASIC-in-ROM. pleted with 16 ms of tone and 24 ms of of personal computers is control of An optional feature of the command silence. The tone itself is 40 KHz. The common household devices such as console provides the key to a simple five-bit code for each control module lamps, air conditioners, and TV sets. A and inexpensive interface to a com­ and function is shown in table 1. computer that turns an air conditioner puter. BSR also developed an ultrasonic A single latched output bit in the off after you leave for work and on hand-held command unit and combined computer is all you need to transmit before you return will rapidly pay for the console with an ultrasonic receiver. the code. The CIP uses latched output itself in energy savings; and one that This allows wireless control at a dis­ bits to scan the keyboard and joysticks handles lights and entertainment tance (like the ultrasonic hand-held TV as well as drive a digital-to-analog con­ equipment on a schedule will dis­ controller). If you know the ultrasonic verter (D/A) circuit. However, BASIC courage burglars who prefer to enter unoccupied homes. You can probably think of more uses. Figure 1 BSR markets the X-10 Control LOGIC 1 OR LOGIC 0 System through the mail and in Sears and Radio Shack stores. This remark­ able system consists of a central com­ - EACH 8 ms BIT N mand console about the size of a 3 ” x 5" COMPRISES file box, and up to 16 control modules, 4 ms TONE 1.2 ms TONE + 4 ms SILENCE + 6.8 rns SILENCE each the size of a pack of cigarettes. An appliance is plugged into a control module, which in turn is plugged into a power outlet. A control dial on each m control module allows the user to set a unique unit code, ranging from 1 to 16, for that module. The user may control the module remotely via the console by LOGIC 1 MESSAGE pushing a button to specify the unit HEADER — FIVE BINARY CODE BITS . FIVE INVERTED code. Another button turns the selected CODE BITS - 16 ms control module on or off. TONE — 24 ms A second form of control module in­ SILENCE cludes a dimming control for lamps,

No. 55 - December 1982 MICRO - The 6502/6809 Journal 77 Figure 2 + 5V Table 2

Item Value IC1 4001 CMOS quad NOR gate 14-pin DIP R1 2.2K resistor R2 2.2K resistor R3 2.2K resistor R4 12K resistor R5 50K trim potentiometer R6 330K resistor Cl 330 pF capacitor Sylvania ECG123A transistor UT Q1 or equivalent UT 40 KHz ultrasonic transducer

Table 1 the 6850 Asynchronous Serial Com­ address 61440 ($F000). Unit Code Binary Code munications Interface chip [ACIA) used The RTS line can be toggled at a 1 0 1 1 0 0 in the CIP to exchange data with a cas­ 40-KHz rate to produce the BSR code. sette machine, modem, or printer. This Since the CIP uses a standard clock 2 1 1 1 0 0 particular line is not used by the CIP, rate of 1 MHz, the wavelength of a 3 0 0 1 0 0 although the ACIA designers provide it 40-KHz tone is precisely 25 clock 4 1 0 1 0 0 5 0 0 0 1 0 so that a computer can indicate whether cycles. However, I found by timing my or not it is ready to receive data. CIP with an oscilloscope that its clock 6 1 0 0 1 0 The control register of the ACIA is running about 4% slow. Thus, I 7 0 1 0 1 0 chip controls the status of the RTS line, could produce the tone using a 24-clock 8 1 1 0 1 0 among other ACIA activities. In cycle wavelength. Instead, I chose to 9 0 1 1 1 0 BASIC, whenever the Break key is de­ build a free-running 40-KHz oscillator 10 1 1 1 1 0 pressed, the control register is reset to a and use the RTS line to switch the 11 0 0 1 1 0 value of 17 and RTS goes low. If you oscillator output to an ultrasonic 12 1 0 1 1 0 POKE a value of 64 to the register, then transducer. 13 0 0 0 0 0 RTS will go high and stay there until The oscillator circuit is shown in 14 1 0 0 0 0 another value is stored in the register. figure 2, and the parts are listed in table 15 0 1 0 0 0 One advantage of this bit in the BSR in­ 2. The only part not universally avail­ 16 1 1 0 0 0 terface is that it will automatically turn able is the ultrasonic transducer, a off when Break is depressed. The ACIA capacitive loudspeaker that creates the Function Code Binary Code control register is located in the CIP at actual tone. Since these devices are 17/All Units Off 0 0 0 0 1 18/All Lights On 0 0 0 1 1 19/On 0 0 1 0 1 Listing 1

20/Off 0 0 1 1 1 10 ; ASSEMBLY LISTING 21/Dim 0 1 0 0 1 2 0 30 ; BY JOHN KROUT 22/Bright 0 1 0 1 1 4 0 5 0 * = $ 0 2 2 2 6 0 DELAY=$FC91 7 0 ; 8 0 START JSR $AE05 continually scans the keyboard (unless 9 0 LD X $ A F the Control-C break is disabled by an 1 0 0 LD A T A B L E - 1 1 1 0 S T A $ A F ; appropriate POKE] so some sort of tone 120 LD A # 5 is almost always being produced on the 1 3 0 STA $ 1 5 1 4 0 MASTER JSR WORD D/A output while BASIC, or any other 150 DEC $ 1 5 ; counts data words sent keyboard-oriented program, is being 1 6 0 BNE MASTER used. This makes using the D/A un­ 1 7 0 RTS ; return to Basic ISO pleasant for music composition and 1 9 0 playback. 2 0 0 WORD JSR Loerci 2 1 0 LD A $AF command code into accumi.il ator A less well-known bit of latched out­ 2 2 0 J S R SEND send top 5 accumulator bits put exists in the CIP. This is the RTS 2 3 0 LDA*AF reload accumulstar (Request-To-Send) line associated with (continued)

78 MICRO - The 6502/6809 Journal No. 55 - December 198< Listing 1 (continued) pretuned to a specific frequency, be 240 EOR #255 ; invert accumulator bits sure the one you buy is set to 40 KHz. 250 JSR SEND ; send 5 inverted bits One transducer that costs less than $10 260 LDA #64 270 STA $ F000 ; begin 16 ms tone is #J4-815 in the Calectro catalog. 230 LDX #4 The circuit can be installed on any 290 STX 416 300 LOOP 1 JSR MS4 of the unconnected prototype sockets 310 DEC $16 adjacent to the ACIA, with a pair of 320 BNE LOOP 1 output lines running out of the com­ 33'j LDA #17 340 STA $FOOO ; begin 24 ms silence puter case to the transducer. Or the cir­ 350 LDX #5 cuit can be placed externally on perf- 360 STX *16 3 7 0 LOCF'2 JSR MS4 board, with connection lines for power, 3S0 DEC $16 ground, and RTS. Because my C IP 390 BNE LOOP2 board is crowded with add-ons, I chose 400 JMP MS4 410 ; the latter method. I recommend that 420 SEND STA $13 you do not mount the transducer to the 430 LDA #5 C IP case because it has to be in a fairly 440 STA $14 ; counter for bits sent 450 ROLLROL $13 ; p lace bit in Carry direct line with the receiver micro­ 460 BCC ZERO ; branch if Carry=0 phone grid on the front face of the com­ 470 JSR LOG IC 1 ; send logic 1 430 JMP COUNT mand console for transmission to be 49Q ZERO JSR L O G I C O ; send logic 0 reliable. To preserve aiming flexibility, 500 COUNT DEC *14 put the transducer on a lengthy flexible 5 1 0 BNE ROLL ; branch until 5 bits sent RTS signal cable. You can secure it to the --o command console grid, if you wish. 540 L O G I C 1 LDA #64 550 STA $F000 ; begi. n 4 ms tone A USR software-driver routine for 560 JSR MS4 the interface appears in listing 1. This 570 LDA #17 routine begins by calling the ROM 530 STA $FOOO ; begin 4 ms silence 590 JMP MS4 BASIC subroutine at address $AE05, 600 ; which deciphers the argument value 61. 0 LOG ICO LDA #64 620 STA $FOOO ; begin 1.2 ms tone within the parentheses following the 630 JSR MSI . 2 USR call in BASIC text, and puts that 640 LDA #17 value in locations $AE and $AF in the 650 STA $F000 ; begin 6 .Q ms silence 660 JMP M S 6 , 8 form of a 15-bit integer with a sign bit. 670 ; Any argument value outside the range 6S0 MS4 LDX #15 690 L00P3 DEX of -32768 to +32767 will cause a 700 BNE L00P3 function call error if the $AE05 routine 710 LDX #3 720 JMPDELAY is called. 730 ; The USR routine assumes that the 740 MS 1 „ 2 LDX #228 argument is a number between 1 and 750 L00P4 DEX 760 BNE L0QP4 22, corresponding to a BSR unit or com­ 770 RTS mand number. Lines 90 through 110 ; 7S0 look up the appropriate five-bit com­ 790 M S 6 . 8 LDX #52 800 LOOPS DEX mand code in a data table and replace 810 BNE LOOF‘5 the original argument value with the 820 LDX #5 830 JMPDELAY code. Lines 120 through 160 produce 840 j five repetitions of code transmission, a 350 TABLE .BYTE 76,224,.32,160,16,144,80,208 factor which, was found reliable when 860 .BYTE 112,240,48,176,0,12B,64,192 870 .BYTE e,24,40,56,72,SS used in a BASIC program that turned house lights on and off over a two-hour period. This means that each USR call takes about 640 ms. Listing 2 Listing 3 The main subroutine WORD begins at line 200 with transmission of the PC 9 1 AOFS LDY #$F8 1 00 * = $(,222 single-bit prefix, a logic 1. Then the F C73 oq DEY 1 1 0 START LDX #64 command code is loaded and trans­ FC94 DOFD BNE $FC93 120 STX $F 000 FC96 55FF EOR $FF,X 130 NOP mitted once, reloaded, inverted in line FC98 CA DEX 140 LDX #i9e 240, and transmitted again. The code­ C POO DOF6 BNE $ F C 9 1 150 XI DEX word suffix is sent by the remainder of FC9B 60 RTS 160 BNE XI 170 STX * F000 WORD. ISO LDX $3 Subroutine SEND analyzes each bit 190 LDX #198 200 X2 DEX of the five-bit command code and trans­ 210 BNE X2 mits the appropriate tone sequence. In 220 JMP START line 450, ROL $13 places each com­ mand bit into the Carry bit of the 6502

No. 55 - December 1982 MICRO - The 6502/6809 Journal 79 status register and, in line 460, BCC Listing 4 Listing 5 j branches if the Carry bit is zero. Subroutine LOGIC 1 turns on the 10 PRINV'Enter your CIP clock" 5 X-546:Z=60000 RTS line, waits 4 ms, turns off the RTS 15 FRINT"rate as a decimal frsc-" 7 SAVE 20 PRINT”tion c-f the standard 1" 9 PRINT:PRINT line, and waits another 4 ms. LOGICO 25 PRINT""; PRINTZ;“DATA"; : Z=Z+5:GQT030 j then waits 6.8 ms after turning off RTS. 40 INPUT 0 25 PRINT".,"; | The three timing subroutines MS4, 45 M4=INT<4000#Q)-12 3 0 A *= S T R * (P E E K C I+ X ) ) : PR I NTR I GHlj MSI.2, and MS6.8 handle the precise 50 M1=INT(1200*Q>-7 * (A*,LEN(A*)-1); ! 55 M6=INT<6800*Q>-12 4 0 NEXT ! waiting periods required by the other 60 D - 1250 5 0 P R IN T j subroutines. Each includes a DEX/BNE 65 '04= I NT : R4=INT ( (M4-D4*D> /5> 60 FRI NT " 20 POKE 11,34: POKE 12,2" 70 Rl=INT(Ml/5) 70 PRI NT"30 FQRI=0TQ175:READA: loop that takes five clock cycles per 75 D6=INT(M6/D):R6=INT( POKE I + 5 4 6 , A : N E X T" iteration, except that only four are used 3 0 P Q K E 6 7 5 R 4 : P Q K E 6B 0, D4 SO PRINT"40 NEW" when BNE does not branch. The prior 85 PCKE6S5

Plus Sensational Limited-Time Savings On Ohio Scientific C1P Series personal Cleveland Consumer Computers & Components 1333 S. Chillicothe Road, Aurora, OH 44202 computers, Superboard and C1P TO ORDER: CALL 1-800-321-5805 TOLL FREE accessories, spare replacement parts, (Ohio Residents Call 216-562-4136) printers, monitors, integrated circuits, $149.96 and other computer-related components. □ s u p e r b o a r d ii,jsao&ee— To Order □ Send Detailed Catalog/Order Form Call us directly or return order coupon with your check, money order, or Mastercard or N am e ______Visa Account Number. Orders will normally be Address . shipped within 48 hours after receipt. $100.00 minimum order. City ______State_ _Zip^ Payment by enclosed check or money order or charge to: FREE Sampler Cassettes with each Superboard II and □ MasterCard □ VISA C1P series order! Account #______Expiration Date

Taxi (Game), Electronic Equations, Loan Finance, Straight Total Amount Charged or Enclosed $ ______and Constant Depreciation, Uneven Cash Flows Tiger Tank, Flip Flop, (Logic Game), Hectic, Black Jack, Ohio Residents Add 5.5% Sales Tax. All Orders Will Be Shipped Insured By UPS Unless Master Mind Requested Otherwise.

80 MICRO - The 6502/6809 Journal No. 55 - December 1981 non-permanent basis. Alternatives in­ Listing 7 clude stack storage and replacing DELAY with your own non-destructive 5 G G T02000 time delay. L Because my CIP runs about 4% 10 REM ... LITESHOW CONTROL PROGRAM ... slow, the time delays in MS4, MS6.8, 12 REM ... FOR BSR X-10 INTERFACE .... 14 REM ... BY JOHN KROUT MS 1.2, and the message suffix portion 99 : of WORD have been shortened about i 100 REM SPOTS: 1 ON, 1 OFF 4% to compensate. If you can obtain an 101 : oscilloscope, listing 3 will load and ex­ 110 FORA=1T03:B=A+1:IFA=3THENB=1 120 Y=USR(B):IFPEEK(G)=EGOTO1000 ecute a useful infinite loop USR rou­ 130 Y=USRCA):IFPEEKCD)=EG0T01000 tine. This routine turns on RTS for 140 NEXT-.BOTOllO precisely 999 cycles, and then turns off 199 : RTS for 1001 cycles, giving an overall j 200 REM SPOTS: 2 ON, 1 OFF ) 2 0 :l : wavelength of exactly 2 ms for a 210 F0RA=1T03 machine running at exactly 1 MHz. If 220 Y=USR <13): IFPEEK(Q>=E60T01000s REM ALL SPOTS ON your machine is running a few percent 230 Y = U S R iA):Y=USR(20):IFPEEK < Q ) =EGQT01000: REM 1 OFF slow or fast, listing 4 will compute and 235 FORI=1T01000:NEXT:REM TIME DELAY 240 N E X T :G 0 T G 2 10 POKE the necessary loop constant al­ C3 CD terations to the BSR X-10 driver 300 REM KEYBOARD CONTROL routine. 302 G0SUB4000:PRINT" SPOTS":PR I NT:PR INT"STROBES":PRINT:PR INT"PROJEOTOr! As with many USR routines, it is 304 POKEG, S9: PC KE G + 2 66: POKEG+4, 82 convenient to place the driver in un­ 310 POKE530, 1:F0KE57088 , 127:P-FEEK(570S8) :P0KE530,0 used memory below BASIC text, start­ 315 IF P E E K(Q )-EGOTO 10 0 0 ing at $0222. Because the OSI Assem­ 320 FORA—1T07:IFS(A,1)=PGOT0335 325 N E X T :G 0 T0310 bler occupies this space and cannot 335 Y=USR(A) :I F S ( A , 0 ) = 0 T H E N Y =U S R (19) : S (A , 0 ) - 1 :P OKES CA,2) ,4 3 sS0T0310 directly assemble the routine there, a 340 Y = U S R (20) :S (A , 0)=0:P O K E S ( A,2) ,32:G D T 0 3 10 loader in BASIC is useful. Listing 6 "T C3 CJ uses the familiar method of POKEing 400 REM STROBES: 1 ON, 1 OFF ; 401 : numbers from DATA statements to I 410 F0RA=4T0o: B=A+1 : IFA-6THENB=4 memory, and is itself a product of 420 Y~USR ( B ) : Y=USR ( 19) : IFPEEK (Q ) =EGOTO 1000 listing 5, a BASIC program generator. 430 Y--USR ( A ) : Y~USR<20) : IFPEEK CQ ; -EGOTO 1000 Listing 5 includes the very advan­ 440 NEXT: GC1TCI410 499 : tageous features of placing two 1000 REM MAIN MENU immediate-mode commands at the end 1020 FOR 1 = 1TO 7:S (I,0)-0:NEXT:REM STATUS RESET of listing 6: a POKE to terminate 1025 60SUB4OOO 1030 PR INT”MAIN M E N U : ":PR I NT LOAD, and RUN. Since the DATA 1040 PRINT1'!. SPOTS: 1 ON, 1 OFF" : FRI NTs PRINT statements are so long in this case, the 1042 PR I NT ”2. SPOTS 'i 2 ON, 1 OFF" : PR I NT : PRINT NEW statement in line 40 of listing 6 1044 PR I NT"3. KEYBOARD CONTROL":PRINT:PRINT erases listing 6 after its work is done, 1046 PRINT"4. STROBES: 1 ON, 1 OFF":PRINT:PRINT 1 1 00 I NPl.1T " f Line: t ion number " ; F : PR I NT leaving behind the driver routine and 1 1 1 0 I FF 1ORF :• 1 OORF > I NT (F ) GOTO 1.100 the data in locations 11 and 12 that tell 1115 Y--UGR (17): REM S H UTDOWN BASIC where the USR routine begins. 1120 ONFGGTQ100,200,300,400 1200 END Listing 7 is a BASIC light show con­ 2000 REM IN IT trol program, which is loaded after 2 010 D I M S (7,2) listing 6 has finished. The program pre­ 2020 SCI,1)=127 2030 S (2,1)=191 sumes that X-10 lamp modules 1,2, and 2040 S (3,1>=223 3 control colored spotlights, that appli­ 2050 S (4,1)=239 2060 5(5,1)=247 ance modules 4, 5, and 6 control colored 2070 S(6,l>=251 strobe lights, and that appliance module 2000 S (7,1)=253 7 controls the lamp of a slide projector. 2100 0=57100:E=222 2110 G=53901 Projector lamps usually exceed 300 2120 S ( 1, 2 ) =G+64 watts. You should keep the projector fan 2130 S (2,2)=6+66 2140 S (3,2)=G+68 running even when the lamp is off to 2150 S (4,2)=6+12S cool the lamp and avoid a blowout. 2160 S (5,2)=G+130 Would you like some automation in 2170 S (6,2)=G+132 21 BO S (7,2)=6+194 your life? Perhaps you need a timer for 2999 GOTO 1000 your toaster, or a security system for 4000 REM SCREEN CLR SUB your office copier. Computer in­ 4010 FOR I=1T02S:FRINT:NEXT:RETURN telligence plus BSR X-10 versatility can do it for you. accumulator. The latter could have words sent, and the number of bits been avoided by using a few NOPs in­ sent. Since BASIC does not use the in­ The author may be contacted at 5108 N. stead of the EOR. In the USR routine, put buffer beginning at $13 for anything 23rd Rd., Arlington, VA 22207. whenever a delay routine is called, this other than input, USR can access that problem forces storage in memory of space with compact and speedy page the command word, the number of zero addressing for data storage on a MICRO

No. 55 - December 1982 MICRO - The 6502/6809 Journal 81 ATARI Meets the BSR X-10

by David A. Hayes

A circuit is presented to 120 X = USR{1536,0,0,0,128,0,123, interface the ultrasonic version 128.128.0.128):REM SELECT The author may be contacted at 2004 of the BSR X-10 home control CHANNEL 5 Woody Drive, Kingston, TN 37763. system to Atari computers. 130 X = USR(1536,0,0,128,0,128,128, Programming information and a 128.0.128.0):REM TURN ON (Continued on next page) sample program are included.

Demo Program Table 1 requires: Atari 400/800 FUNCTION X = USR(1536,A,B,C,D,E,F,G,H,IJ) BSR X-10 ALL LIGHTS ON 0,0,0,128,128,128,128,128,0,0 ALL OFF 0,0,0,0,128,128,128,128,128,0 ON 0,0,128,0,128,128,128,0,128,0 OFF 0,0,128,128,128,128,128,0,0,0 To use the BSR X-10 home control BRIGHTEN 0,128,0,128,128,128,0,128,0,0 device, many computers require a hard­ DIM 0,128,0,0,128,128,0,128,128,0 ware modification. David Staehlin presented a circuit, in the January 1982 CHANNEL issue of BYTE magazine, which will 1 0,128,128,0,0,128,0,0,128,128 couple a non-ultrasonic BSR X-10 to an 2 128,128,128,0,0,0,0,0,128,128 RS-232 port. I have interfaced the 3 0,0,128,0,0,128,128,0,128,128 Atari's controller jack port to the more 4 128,0,128,0,0,0,128,0,128,128 common ultrasonic version of the BSR 5 0,0,0,128,0,128,128,128,0,128 6 128,0,0,128,0,0,128,128,0,128 X-10. Figure 1 shows the complete in­ 7 0,128,0,128,0,128,0,128,0,128 terface circuit required for this purpose. 8 128,128,0,128,0,0,0,128,0,128 Modification of the BSR X-10 is not 9 0,128,128,128,0,128,0,0,0,128 trivial and should be performed by 10 128,128,128,128,0,0,0,0,0,128 competent technicians only. 11 0,0,128,128,0,128,128,0,0,128 The program in listing 1 loads a 12 128,0,128,128,0,0,128,0,0,128 machine-language program into page 6 13 0,0,0,0,0,128,128,128,128,128 of memory. Line 100 sets up controller 14 128,0,0,0,0,0,128,128,128,128 jack 1, pin 1, as output. Table 1 lists 15 0,128,0,0,0,128,0,128,128,128 the code that the BSR X-10 understands. 16 128,128,0,0,0,0,0,128,128,128 The machine-language program sends this code out controller jack 1, pin 1, whenever it is called by the USR routine. Figure 1 BSR + VDO For example, if you have made the ap­ propriate hardware modifications, have 1.8K typed in the program in listing 1, and CD4001 now want to turn all lights on, line 110 GREEN WIRE - O GOING TO of your program should look like this: KEYBOARD

110 X = USR(1536,0,0,0,128,128, s r ^ 39 K * 10K 0.001 IX F 128,128,128,0,0) 1N4148 TIL 117 J - VSS BSR Now turn on channel five.

82 MICRO - The 6502/6809 Journal No. 55 - December 198 /-O H IO SCIENTIFIC Listing 1

10 FOR RDD=1536 TO 1756: READ INST: POKE HDD,INST: NEXT HDD NEW PROGRAMS! 20 DOTH 1 0 4 , 3 2 , 1 3 8 , 6 , 1 04,104,48,6,32,169,6,76,17,6,32,133,6 , 104.104.43.6.32.169 SCOUT —Full color, machine i=^5 DflTfl 6 ,7 6 , 30 , 6 , 32 , 138 , 6 , 104 , 104 language, fast action and 30 DFlTFl 43 ,6 , 32 , 163 ,6 ,7 6 ,4 3 ,6 , 32 , 133 ,6 ,1 0 4 , 104 , 43 , 6 , 32 ,169 . graphics! After a year of 6,76,56,6,32,138,6 development, comes the all 35 DflTfl 104 , 104 ,4 3 , 6 , 3ci‘, 169 , 6 , 76 , 69 machine language 40 DflTfl 6 , 32 , 138 ,6 ,1 0 4 ,1 0 4 , 48 , 6 , 32 , 169, 6 , 76 , 82 , 6 , 32 , 133 , 6 , SCOUT. 104.104.48.6.32.169 Patrol the planet surface pro­ 45 DflTfl 6,76,95,6,32,133,6,104,104 tecting and saving the human 50 DflTfi 43, 6 , 32 , 1 6 9 ,6 ,7 6 , 108 , 6 , 32 , 138 ,6 r 104 ,104 ,43 , 6 ,32 , population from abductors. 169,6,76,121,6,32,138 Turn your OSI into a real ar­ 55 DflTfl 6,104,104,48,6,32,169,6,76 cade! 60 DflTfl 134,6,32,138,6,32,200,6,96,169,254,141,0,211,162, 120,160,10,136,208 $24.95 C4PMF, C8PDF. 65 DflTfl 253,202,203,248,169,255,141,0,211,162 70 DflTfl 120 , 160,10,136,203,253,202,203,248,96,169,254,141 r Send for our FREE catalog. 0,211,162,40,160,10 We have what you want for 75 DflTfl 136, 208 , 253 , 202 ,208,248,169 , 255 ,141 less: S-FORTH $39, FULL 80 DflTfl 0 ,2 11,1 62,3 1,16 0 , 70 , 136 , 203 , 253, 202 , 208 ,248 ,9 6 , 169 , 254,141,0,211,162 SCREEN EDITOR $19, 85 DflTfl 54,160,70,136,208,253,202,208,248 ADVENTURE $19, SKYHAWK 90 DflTfl 169,255,141,0,211,96 $8, TOUCH TYPING $19, IN­ 100 POKE 54fc! 13,56: F’OKE 54016,1 : POKE 54018,60: POKE 54016,1 TELLIGENT TERMINAL $24, THE W IZARD’S CITY $12, UTILITIES, and much more for the C1P to the C8PDF. JMCftO (312) 259-3150 AURORA SOFTWARE 37 S. M itchell Arlington Heights, ISB^ Illinois 60005

OSI Disk Users APPLE II PERIPHERAL DEVELOPERS: Your complex function prototype requires the best wirewrap board available. Double your disk storage capacity Without adding disk drives SPECTRUM SYSTEMS ...... MAKES IT! Now you can more than double your usable floppy disk storage capacity—for a fraction of the cost of additional Fully Extended Wirewrap Protoboard. disk drives. Modular Systems’DiskDoubler™ is adouble- density adapter th at doubles the storage capacity of Size: 2.8 by 10.7 inch 2 layer PC. each disk track. The D iskDoubler plugs directly into an Capacity: up to 58*16 pin or12*40 pin OSI disk interface board. No changes to hardware or or any combination sockets inbetween. software are required. Carefully designed + 5 and GND planes provide for The DiskDoubler increases total disk space under OS- the minimum electrical noise, low impedance, hi 65U to 550K; under OS-65D to 473K for 8-inch floppies, capacitance, and maximum versatility in the layout to 163K for mini-floppies. With the DiskDoubler, each of IC’s, capacitors, discretes and I/O connectors. drive does the work of two. You can have m ore and larger programs, related files, and disk utilities on Wire-wrap technique documentation included. the same disk—for easier operation without constant disk changes. Terms: • $45.00 + (6% Cat. Res. tax) + $2.00 SSH. Your OSI system is an investment in computing power. • All payments must be in U.S. funds drawn on a U.S. Get the full value from the d isk hardw are and softw are bank. that you already own. Ju s t write to us, and we’ll send you the full story on the DiskDoubler, along with the rest • Outside U.S. add 10%. of our growing family of products for OSI disk systems. • Cashier check/money order allow 30 day AR0. • Personal checks add 2 weeks. ™DiskDoubler is a trademark of Modular Systems. • No credit cards or cash, Please!

Post O ffice Box 16 C Spectrum Systems Oradell, NJ 07649.0016 Telephone 201 262.0093 P.O. Box 2262 Santa Barbara, Ca. 93120

Apple II is s trademark of Apple Compuiers

No. 55 - December 1982 MICRO - The 6502/6809 Journal 83 The 68000 DREAM MACHINE

WE (SORT OF) LIED: Motorola has been promoting its advanced microprocessor 2) 68000 source code for the PROM monitor. 35 sectors. chip as a vehicle for large, complex systems exclusively. Now, the 68000 does work well as the heart of big, complex 3) 68000 source code for a very high speed interactive 3-D systems. But their promotional literature implies that one graphics demo. 115 sectors. can only build big, complex systems with the 68000, and that 4) 68000 source code for the HALGOL threaded interpreter. is dead wrong (in our opinion). Nevertheless, the public Works with the 68000 floating point package. 56 sectors. (that's you!) perception of the 68000 follows Motorola's line: Big systems. Complex systems. 5) 6502 source code for the utilities to link into the BASIC floating point routines and utility and debug code to link into Our boards are not complex and not necessarily big (starting the 68000 PROM monitor. 113 sectors. at 4K). Our newsletter is subtitled “ The Journal of Simple 68000 Systems.” But since the public has become condi­ The above routines almost fill a standard Apple DOS 3.3 flop­ tioned to the 68000 as a vehicle for FORTRAN, UNIX, LISP, py. We provide a second disk (very nearly filled) with various PASCAL and SMALLTALK people naturally expect all these utility and demonstration programs. with our $595 (starting price) simple attached processor. Wrong! SWIFTUS MAXIMUS: Our last advertisement implied that we sold 8MHz boards to We wrote our last ad to understate the software we have hackers and 12.5MHz boards to businesses. That was sort of available because we wanted to get rid of all those guys who true because when that ad was written the 12.5MHz 68000 want to run (multi-user, multi-tasking) UNIX on their Apple II was a very expensive part (list $332 ea). Motorola has now and two floppy disks. Running UNIX using two 143K floppies dropped the price to $111 and we have adjusted our prices ac­ is, well, absurd. The utilities alone require more than 5 cordingly. So now even hackers can afford a 12.5MHz 68000 megabytes of hard disk. board. With, we remind you, absolutely zero wait states.

HERE’S THE TRUTH: ‘Swiftus maximus’? Do you know of any other We do have some very useful 68000 utility programs. One of microprocessor based product that can do a 32 bit add in 0.48 these will provide, in conjunction with a suitable BASIC com­ microseconds? piler such as PETSPEED (Pet/CBM) or TASC (Apple II), a five to twelve times speedup of your BASIC program. If you have AN EDUCATIONAL BOARD? read a serious compiler review, you will have learned that If you want to learn how to program the 68000 at the compilers cannot speed up floating point operations assembly language level there is no better way than to have (especially transcendentals). Our board, and the utility soft­ one disk full of demonstration programs and another disk full ware we provide, does speed up those operations. of machine readable (and user-modifiable) 68000 source code. Add this line in front of an Applesoft program: Those other ‘educational boards’ have 4MHz clock signals 5 PRINT CHR$(4);“ BLOADUTIL4,A$8600":SYS38383 (even the one promoted as having a 6MHz CPU, honest!) so we'll call them slow learners. They do not come with any That’s all it takes to link our board into Applesoft (assuming significant amount of demo or utility software. And they com­ you have Applesoft loaded into a 16K RAM card). Now run municate with the host computer via RS 232, 9600 baud max. your program as is for faster number-crunching or compile it That's 1K byte/sec. Our board communicates over a parallel to add the benefit of faster “ interpretation". Operation with port with hardware AND software handshake, at 71K the Pet/CBM is similar. bytes/sec! We’ll call those other boards handicapped learners. 68000 SOURCE CODE: For Apple II users only, we provide a nearly full disk of un­ Our board is definitely not for everyone. But some people find protected 68000 source code. To use it you will have to have it very, very useful. Which group do you fit into? DOS toolkit ($75) and ASSEM68K ($95), both available from third parties. Here's what you get: DIGITAL ACOUSTICS 1) 68000 source code for our Microsoft compatible floating 1415 E. McFadden, Ste. F point package, including LOG, EXP, SQR, SIN, COS, TAN, Santa Ana, CA 92705 ATN along with the basic four functions. The code is set up to work either linked into BASIC or with our developmental (714) 835-4884 HALGOL language. 85 sectors.

Apple, Applesott and Apple II are trademarks of Apple Computer Company. Pet is a trademark of Commodore Business Machines.—

84 MICRO - The 6502/6809 Journal No. 55 - December 19 68000 Logic Instructions

by Joe Hootman

This is the third in a series of articles Table 1: Logic Instructions on programming the 68000. Professor Hootman is presenting the instruction Mnemonic Data Size/CCR Name Comments set of the 68000 microprocessor and AND 8, 16, 32 Logical The source and destination are logically ANDed will then consider the addressing CCR AND and the result stored in the destination. XNZVC Opword Format modes and how they apply to the . . 0 0 various instructions. This month’s IS 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 topic is the logical instructions. 1 1 0 0 Register Op Mode Effective Address Mode | Register

Register — Any of the eight:data registers. The logic instructions implemented Op Mode field in the 68000 are given in table 1. These Byte Word Long word Af 000 001 010 Data register ANDed instructions are the AND, the OR, the with the EA and NOT, and the EOR. The implementa­ result left in the data tion of the logical operations is register. straightforward. The logic operations B| 100 101 110 EA ANDed with the data register and affect the CCR depending on the results result left in thes EA. of the operation. It should be noted that For case A of the Op Modes the following the logical operations do not operate on effective addressing modes cannot be used:12, 13, the address registers directly. 14.* For case B of the Op Modes the following effective addressing modes cannot be used: 1, 2, The logic operations on the status 10, II, 12, 13, 14.* register are privileged. Logical opera­ ANDI 8, 16, 32 AND The immediate data and the destination are tions on the user condition code CCR Immediate logically ANDed and the result stored in the register are not privileged. XNZVC destination. - * . 0 0 Opword Format 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

l! ii fa 0 ;Q 1 0 Size Effective; Address Mode j Register

;Wor&Jdata: (16 bits Byte data (8 bits) : including the first ?^8'Mtsfi;Hii- \ — ; r Long1 data f32 bits including the previous bits)

:■ Size: field-,' : 00 - Byte 01 - Word 10 - Long word The following addressing modes cannot be used: 2, 10, II, 12, 13, 14.*

ANDI 8 AND The immediate data is ANDed with the CCR and to CCR CCR Immediate the results stored in the CCR. The state of the XNZVC to Condition CCR after the operation depends on the previous ***** Code data in the CCR and the immediate data Register in the operation. Opword Format foe Hootman can be contacted at the 1 5 1 4 13 1 2 11 10 9 :7" !6: "5, 4 3 2 1 0 University of North Dakota, Department 0 0 1 0 I 1 0: 0 of Electrical Engineering, University & ps! m ■;,0: 0 0 1 1 Station, Grand Forks, North Dakota f t r 0 0 0 .0 o Byte Data 58202. $ % (continued)

No. 55 - December 1982 MICRO - The 6502/6809 Journal 85 Table 1 (continued) M I C R O b i t s (continued) Mnemonic Data Size/CCR Name Comments

EOR 8, 16, 32 Exclusive The source and the destination are exclusively VisiCalc To Apple Plot CCR OR ORed together and the result stored in the Interface translates from VisiCalc to XNZVC Logical destination [Data registers only for source data.I Apple Plot, prevents erroneous - . . 0 0 Opword Format graphs, fits curves to data, and supplements VisiCalc with rank IS 14 1.? 12 11 10 9 8 T 6 5 4 J 2 I 0 ordering and alphabetizing. Send T TR 11 llRegister .Op Model Effective Address SASE for details or $30.00 for the HEj j | J AlodeJ Register | copyable program. Bill Starbuck Register field — Anv one of the eight data 2100 E. Edgewood registers can he specuied Shoiewood, WI 53211 Op Mode field (414) 963-9750 100 - Byte 101 - Word 110 - Long word VisiCalc To Apple Writer The effective address specifies the destination of the result of the operation and the following Veecee-Writer translated VisiCalc addressing modes cannot be used- 2, 10, 11, 12, (/PF) files for Apple Writer 1. Send 13, 14.* $15.00 for the copyable program. Bill Starbuck 2100 E. Edgewood EORI 8, 16, 32 ; Exclusive The immediate data and the des data is Shorewood, WI 53211 CCR OR exclusively ORed together and the alt (414) 963-9750 XNZVC Immediate stored in the destination -V. . 0 0 Opword Format TRS-80 Color Computer 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Expand your 4K system to 16K for U V u * 0 1 0 Size | Effective AddresT) $29.95. Expand 4K or 16K to a 32K [Mode |_Registerj I [III 1 system for only $99. Obtain better Word data (16 bits) Byte data |i) bits) ! color graphics. Full instruction/ documentation provided in each kit. Long data |32 hitsj j Two- to three-week delivery time. $3 postage/handling charge. Size field Dick Williams 00 - Byte The data is in the lower order Computer Sbed byte of the immediate word. Lane 2-1 01 - Word The data is the entire immediate word. Derry, NH 03038 10 - Long word The data is contained m the (603) 432-3634 next two immediate words. The ctfective address specifics the destination of the result of the operation and the following Unique VIC-20 User Group addressing modes cannot be used 2, 10, 11, 12, Borrow any program from our extensive loan library for only 10% of cost and get free newsletter and EORI Exclusive The immediate data is exclusively ORed with the to CCR CCR OR CCR and the result stored in the CCR. special purchase prices on all VIC-20 X N Z V C Immediate hardware and software from our huge to Opword Format catalog. Membership only $25 by Condition 15 14 13 12 11 10 9 8 7 6 5 4 1 2 1 0 check, VISA, MasterCard. Software To Go Register 0 O 0 0 1 0 1 0 o i l 1 1 1 0 0 0. Rt. 3, Box 309 A 52 0 0 0 0 0 0 0 Bvte Data Clinton, TN 37716 (615) 457-5068 (615) 584-0022

NOT, 8, 16, 31 Logical The ones ocmplcmeni at tilt- destination is CCR Complement taken and the results stored in the 68000 Software XNZVC destination - * . 0 0 For Apple-compatible boards Opword Format (DTACK). The M oose: professional 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 and only available 68000 chess program — $67. MUXA68: UCSD ! 0 1 iT o J o f 0 1 I 11 0 : Size TlLffective Address j 68000 Crossassembler — $70. KLLL|_j J__ J J Mode | Register J 68TICID: Debugger — $47. PCON68: UCSD-Interface for DTACK board — Size field $30. $10 shipping and handling. 00 Bvtc 01 - Word Moose Systems 10 - Long word Steenbargkoppel 21 D-2000 Hamburg 65 The effective address specifics the destination and the following addressing modes cannot he Germany used: 2, 10, 11, 12, 15, 1 4 .' (continued) (Continued)

MICRO - The 6502/6809 Journal No. 55 - December 1982 Table 1 (continued) M I C R O b i t s Mnemonic Data Size/CCR Function Comments (continued)

OSI Peter Packer OR 8, 16, 32 Inclusive The inclusive OR operation performs the OR CCR OR operation un the source data and the Pack widgits into boxes and ship XNZVC Logical destination data The result is left in the them out in the elevators before your - * * 0 0 destination defective robot assistant unpacks them or packs you! An original arcade game of cunning and skill that Opword Format increases in difficulty each round. 8K 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 tape $14.95. Watts Ware 1 0 0 0 Register lop Mode Effective Address 1 153 Madrona Drive Mode | Register j | Anacortes, WA 98221

Register field specifies any of the 8 data registers. Op Mode held OSI - Affordable DBMgr 000:- Bvtc 8 " single/dual floppy under OS65D 001 ■ Word V3.3 video. User-defined files with 010 - Long word formatted screen viewing and I he result is scored in the specified data register inputting. Features: find, update, The etfeccive address specifies the source and the delete, paging, coding, and 'screen/ loilowing addressing modes cannot be used 2, 'quick,' and format' dump. $55.00. 13, 14.* Label print option — $25.00. Report Op Mode field Generator (January 1983), manual 100 - Byte only — $10.00. 1 0 1 -W ord 110 - Long word Bunin & Ward Computer Services P.O. Box 895 Church Street Sta. The result is stored in the effective address and New York, NY 10008 the following addressing modes cannot be used: 1,2,13,14.* |212) 434-5760

Low-Cost Software OR! 8, 16, 32 InJusivt' The immediate data is inclusive ORed with the Unique programs and hardware kits CCR OK d.it.1 in the destination and the result is left to adapt small computers to the real X N Z V C Immediate in the destination. world. Control machines, make . . . Q 0 music, build test equipment and Opword Format security systems, etc. For 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 information, write to us describing your system and interests. Include 0 0 0 0 0 0 Size Effective Address stamped self-addressed envelope. __ Mode | Register S.W. Associates Word uata 116 hit.«| Byte data ;8 bits I 45 Furman Drive Long data (32 bits) Wayne, NJ 07470

Size field ■ OSI Super Defender 00 - Byte The data is the lower byte ol the data word. Play this great arcade game at home. 01 - Word The data is the entire 16 bits All machine code includes: scanner, of the data word smart bombs, laser fire, moving 10 - Long word The data is the two immediate mountains, and more. Save your words humanoids from the alien landers. 1 he effective address is the destination and the Very smooth (half-character moves) following addressing modes cannot be used. 2. graphics. $14.95 for C l, 2, 4 tape or 10, 11, 12, 13, 14 * 5 Vt" disk. DMP Systems 319 Hampton Blvd. Rochester, N.Y. 14612 OR! Inclusive I he immediate data is inclusive ORed with : tO CCR OR the CCR and the result left in the CCR CCR X N Z V C Immediate ***** data to Opword Format Dynamite PET/CBM Accessories! Condition Code 15 14 13 12 11 10 y 8 7 6 5 4 3 2 1 0 Write-protect switches/indicators for Register 'J 2040/4040 disk drives. Real world ol 0 0 0 0 0 0 0 ol 0 1 1 1 ilo software at low cost. 2114 RAM 0 0 0 0 0 0 0 0 Byte Data |f> bus! adapter (replaces obsolete 6550's) and : i 4K memory expansion for "o ld " 8K PETs. Hundreds of satisfied customers. Write for free catalog! •T h e addressing modes w iii be covered in fu tu re i. jUCftO" Optimized Data Systems Dept. M, Box 595 Placentia, CA 92670

/MCftO

No. 55 - December 1982 MICRO - The 6502/6809 Journal 87 Programmable Character Generator for OSI

by Colin Macau ley

Design your own character set The key commands available for "R" A prompt for the number of a and save the characters in a manipulating the cursor are as follows: predefined character will be re­ quested. This character will form suitable for incorporation " I ” The indicated bit is set and the then be displayed and may be into an EPROM. cursor is shifted. A block char­ modified to form the basis of a acter will be inserted at the new character. former cursor position. Character Generator Set bits will be indicated by a block " 0 ” The indicated bit is cleared and and cleared bits will be blanked to requires: the cursor is shifted. A blank allow for an enlarged graphical repre­ OSI Superboard character will be inserted at the sentation of the character being former cursor position. created. The cursor will be either a 1' 1” While developing software for a mini­ "H " The cursor will move from its or a "0 ” to enable the condition of that mum chip homebrew 6502 system, it present position to its home po­ bit to be readily identified. The 2K was necessary to produce a character sition (i.e., top left-hand comer character generator may be saved on generator. I wrote the program for an of display). cassette, using well-known machine 8K OSI Superboard II to draw characters code save programs, or used directly by "D " The cursor will move down a on the OSI video and save these charac­ an EPROM programmer. row of the display. ters in RAM. The characters could then be incorporated in an EPROM, or trans­ "F ” The cursor will be shifted to the ferred to the homebrew system. The next bit without modifying the Colin Macauley is a member of the firm of program was made fairly general, as the status of the previous bit. Callinan and Associates, Patent Attorneys and a physicist. He uses a modified OSI homebrew computer included the capa­ "ESC" Return to BASIC. Superboard II and is interested in utility- bility of a variable character depth, type programming. He may be contacted whereas the OSI is restricted to 8 x 8 "C R " Enter displayed character into at 39 Shoalhaven St., Werribee, Victoria characters. Although the program was "character-generator" RAM at 3030, Australia. intended for a specific purpose, it is nominated position. equally useful in developing alternate character generators for an OSI. Thus, if games are a major attraction you may wish to define new characters (e.g., Space Invader aliens) for unused char­ ■JH O w m w acters in your OSI character set. Ac­ '■ 1 2 3*.4 5 6 7 4 cordingly, the new character set may then be loaded into a 2K EPROM (2716) 2 ’| and replace the original OSI character- generator ROM. The MEMORY SIZE? cold start prompt should be restricted to 6000. This will prevent overwriting the character-generator RAM that com­ mences at $1800 (6144 decimal), allow­ ing the number of characters to be 256 with a character depth of 8. The re­ quired character number is input and a display will appear on the screen to CHARACTER NO 2 assist in the graphing of the intended character. A cursor in the top left-hand corner indicates the bit currently being The figure HftistrateV cite of fh» program In constructing a “car" char altered. has been set.

88 MICRO - The 6502/6809 Journal No. 55 - December 1982 Listing 1: Programmable Character Generator Listing 1 (continued) 4 RErl LOA.U USR l-'OUTINE 470 POKEY.E:Y=Y-33 i?1 .*&U 3 ■ j 480 A$="CUhMAND'" 10 !'0RX=1 ro.32 : PR IN T: r(EX Tx 485 PRINTCHR?(13)" CHARACTER Nfl.":H; 23 PR [NT"PROGRAMMABLE CHARACTER GENERA FOR" :PR TNT 690 FORX=1T08: POKE54353+X , ASC (N IDt!At.X,1J} :NEX TX :RE TIJRN 30 PR I NT "COPYRIGHT l«i)1 COLIN riflCAULEY" : PR IN [ 495 REN SUBR. FOR "CR" KEY 40 INPUT“NO. OF CHARACTERS, Ifl GROUPS OF 1 2 j 4 T H E N 4 3 700 POKFV.UC 55 POKE 11,1 <42:POKE 12,2 710 Z=Y 40 PRINT :INPUT"CHARACIER OEPTH. I TO I 6" : b 720 F0RX= I TUB 70 IFEO I6THEN63 730 F=Z+(32*X):G=0 30 PRINT:INPUT"NEU CHARACTER SET (Y/H)":A< 740 F0RH=1T08 90 IFNID$(A$,1. I )O"Y"THEN113 750 I=PEEK(F + H):J=0:TFI=141 THEW.J=1 93 REN BLANK CHAR. GEN. RAH 760 G=G+J:IFH=8THEN780 130 F0RX=61 44T081 ? ! :POKEX,32:NEXTX 770 G=2*G 110 C = 4 I 4 3 783 NEXTH 123 PRINT: INPU P'CHARACTER N0.":0 790 POKEC+t\X-1 >*A)+D,G 130 IF0'>ATHEN I 23 800 NEXTX 135 REM SET UP SCREEN 805 PRINT 143 GOSUB403 810 INPUP'NEXT CHARACTER NQ.";D 213 REN USR ROUTINE SAVES REGISTERS i GETS CHAR. FROM KEYED 820 RETURN 220 Z-USR(Z): H = 0 880 REM SUBR. FOR "R" KEY-DRAIJS REQUIRED CHAR. ON SCREEN 233 U = PEEIATHEN900 234 REN "3" KEY? 920 GOSUB400:Z=Y 243 IFUO48THEN260 930 FORX=ITOB 245 O=32:G0SUB4M:G0TO22« •943 F = C+! 2 i 298 REM "ESC" KEY? 303 IFIJ = 2’THENENB 305 REM "CR" KEY' 310 IFUO I 3 THEN323 CSE means OSI 315 GOSUB700:GDT0130 Software and Hardware 318 REh "R" KEV? 320 IFU=82THENGOSUB900 Specializing in C1P and C4P machines 330 GOTO220 3 43 REM LOAD USR SUBR. 350 X=474:F0RY=3T015:READA:P0KEX+Y.A:NEXTY Basic Load/SAVE: 360 DATA72,138,72,152.72,32,136,255,133,216.104,148,104, Employs token loader system. 50-100% faster 1 70,104,96 than the old indirect ASCII system. Maintains a 370 RETURN listing of file names found on the tape 390 REM SUBR. FOR KEYS "0,1 OR F" C1P...... $10.95 395 REh SHIFTS CURSOR 3 SETS OR RESETS INDICATED BITS 400 X=Y + (L*32) + 8:P = V + I : IFP; XTHENfi = L+I C4P...... $19.95* 410 POKEV,Q:IFMXBTHEN480 423 IFM>0ANDMOLTHEN440 Basic Enhancer: 430 V=P:G0T0453 Renumber, Auto Sequencer, Screen Control func­ 443 V=Y+l+(M*32):L=M tions, and tape I/O system that is faster and has file 453 UC=PEEK(V> :E = 48 names 4.-S0 IFUC= I 61THENE-49 C1P...... $21.95 470 GO 10490 C4P...... $29.95* 480 UC=PEEK(V):E=48:IFUC=141ORUC=49THENE=49 485 IFUC =48THENUC=32 ‘ comes with required modified monitor Rom chip 490 PQKEV ,E :RE'IURM 495 REM SUBR. FOR "D" KEY-SHIFTS CURSOR BOUN A LINE NEW! NEW! NEW! 500 L = L+I:IFL: BTHENL-L-I:GOTO540 ANCHOR SIGNALMAN MODEMS ...... $95.00 510 P0KEV.UC:V=V+32:UC=PEEK(V>:E=48 520 IFUC = 161THENE-49 Please write for more info on new disk programs or 530 POKEU.E send $2.00 for catalog. Please include $2.00 shipping 540 RETURN ($4.00 for modems). 593 SUBR. FOR BRAUING UORKSHEET FOR CHAR. 600 F0RX=1T032:PRINT:NEXTX 410 X-53415rF = 48 Computer 420 F0RZ=1T08:P0KEX+Z.F+Z:NEXTZ 643 FURZ = 1 TOB :ll-Z: 1FU>9THENU=IJ~ 1 0 Science 645 P0KEX+<32*Z),4B+U:NEXTZ Engineering 650 Y = 5,3448:UC = PEEK(Y):L=I :V = Y:E = 48 660 IFUC = 161IHENE=49 Box 50 • 291 Huntington Ave. Boston 02115

No. 55 - December 1982 MICRO - The 6502/6809 Journal 89 t AM IBM-PC

HOWTO WRITE AN APPLE

3 exceptional books join the DATAMOST library

1-wonder why you were ever intimidated Here is a series of easy to read, easy to ’ :by the thought of programming! use, easy to understand books, which teach you how to write usable, useful If you want to get the very most out of programs on your computer. And you vour Apple, IBM-PC or TRS-80 then you don’t have to worry about irrelevant really want HOW TO WRITE A PRO­ material which has no interest for you, GRAM. Before you're past Chapter 2 because there are three specific volumes. you’ll be programming. By the end of the One for the Apple* one for the IBM-PC: book you’ll be willing to tackle business and one for the TRS-80 * programs, personal use programs and In each of these books author Ed Faulk even games and adventures! $14.95 leads you through your favorite com­ Get your copy now. Available at computer puter and takes the mystery out of writing and book stores, or: programs for it. As you proceed, interest­ ing chapter by interesting chapter, you’ll E DATAMOST* (213) 709-1202 Reston Publishing Comp 9748 Cozycroft Ave.. Chatsworth, CA 91311 A Prentice-Hall Compan) Reston, Virginia of IBM Corp. TRS-80 is a trademark of Tandy Corp. •Apple is a trademark o f Apple Computer. Inc., IBM-PC is a trademark Toll free (800) 336-0338 (California residents add 6' sales tax.) VISAM ASTERC H AR G E accepted S2.0Q shipping-handling charge. /AICRO U p d ates and Microbes

Updates 1 0 0 0 *************** ZAP BYPASS FOR LISZT John Beckett of Collegedale, TN, 1005 D* = Chr*<4> sent in this revision to “A Homespun Q T * = Chr*(16£) BR* = QT* + V 32K Color Computer" (53:91). 1010 Print D*"OPENDF" Print D*"DELETEDF" Solder the chips together rather Print D*"OPENDF" Print D*"WRITEDF" than expecting hand-bent pins to make 1015 Print "SAVELISZTER.PATCH good contact. It is best to put a ferrite 1020 Print 87"DATA"; A = 1 bead around the wire connected to the B = £5 6883 chip, just before it reaches the Gosub £005 10£5 Print SQ"DATA"; 6883. Failing this, use a 33-ohm re­ A = £6 sistor. This is done in Tandy’s 32K ver­ B = 50 sion and is recommended by Motorola Gosub £005 1030 Print Q9"DATA"; in their 6883 data sheet. Later models A = 51 of the PC board have a place on the PC B = 51 Gosub £005 board where you may connect the lead 1035 Print 90UDATA"; from the extra bunk of chips, that A — 5 c! avoids soldering directly to the 6883. B = 75 Gosub £005 1040 Print 91"DATA"; A = 76 B = 107 Myron Pulier, M.D., from Teaneck, Gosub £005 Nf, sent in this update: 1 0 4 5 Print "DtL 1000,3040" Print " INVERSE: ?"QT*"DATA CONVERTED" 1 0 5 0 Print "NORMAL:SPEED= 1Q0:LIS1 87-91 :SPEED=£55 The LISZT program in the May, 1055 Print Df'CLDSE" Print DV'EXEC DF" 1982 issue of MICRO (48:37) makes 1 0 6 0 End readable BASIC listings. The authors used a disk zap utility program to get £ 0 0 0 CONVERT ONE LINE lower-case characters in the DATA £ 0 0 5 For J = A To B statements. Lacking such, I used the £ 0 1 0 Read ST* temporary patch, shown in listing 1, Print QT*; £ 0 1 5 LF = 0 appended to LISZTER. L = Ler, (ST*) This patch creates new DATA £0£0 If L Then strings after converting all alphabetic Gosub 3005 £0£5 If J = B Then characters to lower case except the first Print QT* one in each string. These new strings £030 If J < B Then Print BR*; are read into a TEXT file named "D F ” . £035 Next When this file is EXECed it replaces the 8040 Ret urn

LISZTER DATA statements with the 3 0 0 0 CONVERT ONE STRING new ones and displays the result for 3005 For I = 1 To L confirmation. The patch itself is 3010 C* = Mid*(ST*,I, 1) removed so the converted program may 3015 If "(?" ( C* And C* ( Chr*(£19) Then C$ = Chr*(Asc

(Continued on page 98) END

No. 55 - December 1982 MICRO - The 6502/6809 Journal 91 ing like it before. Nothing else like it noT

brings you continuous Hi-Res action-animation in every adv< turous moment! And, real running, leaping, crawling. Real fighti shooting, stabbing, dynamiting. Real wounding, poisonn killing. Real action, excitement, mystery! All in a real-ti challenging adventure that’s the wave of the futi

'V Paul Stevenson’s graphic genius, first displayed in I I ? /‘s , best selling “Swashbuckler” sword fighting gar I® * , outdoes itself in AZTEC. You re inside an and ■ i Aztec pyramid searching for the golden it ' Descend deep into the heart of the tempi' meet cobras, scorpions, giant lizat hostile Aztec guardians and more. Wa J t for hidden trapdoors and strange des ■7* rooms. Be ready to fight, or run. craw l i t jump to possible safety. The menac I f real, the options and strategy are yoi * You’ve never seen an adventure > § Aztec! You'll never tire of its amaz action-anim ation and exciting challe ■HjpcSL $39.95forthe Apple IT At 1/ computer stor

* Utilizing the 6502’s Undefined Operation Codes

by Curt Nelson, Richard Villarreal , and Rod Heisler

This method allows you to use mum of 525 nano seconds for the mem­ itiates the timing cycle for IC1, a the 6502’s undefined op codes ory to present valid data to the data bus. monostable multivibrator. The output to design new and individualized This, of course, precludes the use of of IC1 goes high after a period of time pseudo-instructions under very slow memory devices but is ade­ determined by the RC network. The program control. A simple quate for most microcomputer systems. time-out is set for approximately 750 hardware device attached to the nano seconds. The leading edge time data bus forces a simulated Hardware out from IC1 is used to clock IC2, a BRK command when an illegal The Trapper (figure 2) samples the dual D flip-flop. The SYNC line is tied op code is detected. data bus in a parallel mode. The data to the clear input of IC2 through two lines are first buffered through IC4 and buffers. This combination of inputs to Utilizing Undefined IC5 and then used to form the address IC2 assures that its output will go high Op Codes to IC3, a 256 x 4 PROM. IC3 is always only if these three conditions are met: requires: enabled and is programmed to output a the SYNC line is high (fetch cycle], an Hardware modification to a logic state one for an illegal op code and illegal op code has been fetched, and 6502 microcomputer a logic state zero for a legal code. Only IC1 has timed out. one of the three PROM outputs is used; The outputs of IC2 are used to drive Fetch Cycle the others are not programmed. open collector inverters tied directly to Before the Central Processing Unit The falling edge of the 02 clock in­ the data bus. When the inputs to the in- (CPU) can execute an instruction it must first get the hexadecimal code from memory. This process is called a fetch cycle. The fetch cycle is identical Flgure 1: Timing Diagram for the 6502 Fetch Cycle (All times In nano (10-1) seconds) to the data read cycle except for the SYNC line operation, which rises to a logic level one (5V) shortly after the 1000 MIN fetch cycle is initiated. The fetch cycle (figure 1) starts when the system clock, $2, falls to a SYSTEM CLOCK logic level 0 (0V). For a 1MHz system clock the fetch cycle normally requires 350 MAX 1000 nano seconds, or one micro sec­ SYNC ond. During this 1000 nano-second (FETCH CYCLE) period several events occur in well- ordered sequence. First, the CPU out­ puts the current value of the program 2 25 MAX counter on the address bus. This is the ADDRESS address location of the next instruc­ FROM CPU tion. The specified memory then out­ puts the op code to the data bus. The 525 MIN CPU reads the op code from the data DATA FROM bus just before the end of the cycle. MEMORY The interval in which the Trapper 100 Mil has to operate extends from the time the memory device presents the op code to the data bus until the CPU DATA READ latches it internally. In this time it BY CPU must determine if the op code is valid or not, and force a BRK (00) if it is il­ 150 MAX OPERATION TIME OF ILLEGAL OP CODE TRAPPER legal. The Trapper described in the next section requires a maximum of 150 nano seconds to operate, leaving a mini­

No. 55 - December 1982 MICRO - The 6502/6809 Journal 9 3 verters are high (illegal op code), the Figure 2: Schematic diagram of the illegal op code Trapper. The board is compatible outputs force the data lines to a logic with any 6502 system bus. All lines to the board are generated by the 6502 CPU. C1 is state zero, simulating a BRK command. a silver mica capacitor and R1 is a low-temperature coefficient, precision resistor.

When the inputs to the inverters are C l R l low, as under non-trapping conditions, 68 pF 20K + 5 the output appears as a high impedance —| {—f-vWvM> to the data bus. If the data lines are 14 15 D0-D7 pulled low, they are released when the O 74S287 256 X 4 PROM IC1 SYNC line goes low during the next 74LS123 DO 5 clock cycle. \ ■ 4 c > o - A CS1 Software B CS2 f 3 7 + 5 \ D2 11 r \ 10 IC3 r h The task of the software is two-fold. ' ------A e^ o- C

First, it must determine if the break \ D3 k + 5 n 12 was the result of an illegal op code or a -4 b > o - 10 I 74LS74 12 SET 9 BRK instruction. Second, if the Trapper E Y2 D O IC2a forced the break, it must retrieve the il­ \ D5 11 - 5 e . C O legal op code and direct the CPU to the RES proper software routines. G Y4

The CPU handles the software BRK D7 3 r \ . 15 and an IRQ (Interrupt ReQuest) sim i­ ------5b>o- H 1 + 5 larly, except for one small feature. A _____. SYNC BRK command sets the break bit (bit D SET o l5 four) in the processor status register. IC2b The CPU will then do an indirect jump DO 6 C RES^1 through the IRQ vector at FFFE and \ D1 10 11 FFFF. The user must load the address of the break-handling routine into the \ D2 8 IRQ vector prior to the detection of an \ D3 4 j6b- illegal op code, to direct the CPU to the user routine. Listing 1 shows the soft­ ware used to change the IRQ vector. A \ D5 10 starting address of $0300 was used for the break service routine, but this is arbitrary. The user's break-handling routine must determine whether a BRK or an IRQ was encountered. This is done by retrieving the processor status from the you may want to use a jump table to codes become the address to this stack (it was automatically pushed build this case/select structure. device. Therefore, all legal op code­ there when the break occurred) and ex­ The break service routine in listing based addresses store 0000 and all il­ amining the break bit. If it is determined 2 is completely transparent (i.e., all legal addresses store 0001. that bit four is set and hence a break registers are preserved). The illegal op has occurred, it retrieves the last op code is returned at address $0042. The Conclusion code. This is easily done because the address is arbitrary and can be changed This method of detecting illegal op address of this instruction plus two was to any convenient location. codes is really a hardware implementa­ also pushed on the stack when the pro­ If the user exits the break service tion of a macro assembler directive. gram was interrupted. If this instruc­ routine at line 23, indicating an IRQ, he Although the execution time and mem­ tion was a BRK, control is passed back should use the following sequence to ory space required are more than the to the system monitor. If, on the other restore the original registers: standard JSR technique, writing and hand, it was an illegal op code, control PLA debugging programs is more straight­ is passed to a user program that imple­ TAX forward when microcoded routines are ments new micro-coded instructions. PLP There are several methods to jump PLA to the user code corresponding to each If the routine is exited at line 40, in­ Figure 3 new instruction. The most straight­ dicating a normal BRK command, the Number Type + 5V Gnd forward way is to use a CMP instruc­ following sequence should be used: tion followed by a BEQ for each ele­ PLP IC1 74LS123 16 8 ment in a list of new hex op codes. If PLA IC2 74LS74 14 7 IC3 74S287 16 8 more than just a few instructions are Programming the PROM is under­ IC4,5 74LS04 14 7 added, a more elaborate scheme may be stood by examining figure 2. Since the ic e ,7 7405 14 7 necessary to reduce the execution time system data bus is connected to the ad­ and program length. In this situation dress lines of the PROM, the hex op

94 MICRO - The 6502/6809 Journal No. 55 - December 198 Listing 1: Software to modify the IRQ vector to point to a user program. 0800 1 SUITING UP THE IRQ VECTOR incorporated into your program as sim­ 0800 2 ple instructions. 0800 3 A few words of caution: first, it is 4 OKG $200 0200 necessary to acquaint yourself with the 0300 5 USRPRG EQU $0300 ADDRESS OF USER PROGRAM bVb'E 6 IRQICW EOT $FFFE LOW ADDRESS OF IRQ VECTOR user-available monitor subroutines on FEW 7 ItlCHIG EOT IRQLO»+-$l 4ICH ADDRESS OF IRQ VECTOR your system. The SYM-1, for example, 0200 8 has monitor routines to do some of the 0200 9 0200 10 INITIALIZATION functions in listing 2. The Apple, as 0200 11 well, has monitor routines that can be 0200 12 used to shorten this program. Second, 0200 A9 00 13 IDA ft USRPRG ;SET IRQ VECTOR TO USER BREAK. ROUTINE the illegal op code FF rearranges the 0202 8D FE FF 14 STA IRQLOW stack and hence should be avoided. 0205 A9 15 03 IDA /USRPRG You are now in a position to expand 0207 8D FF FF 16 STR IROJIG 020A 17 the instruction set of your 6502-based 020A 18 system. Whai: instructions should you 020A 19 add? Here are a few suggestions: integer 020A 20 020A 21 MAIN PROGRAM multiply and divide, double precision math operations, jump indirect-indexed, Listing 2: Program to handle a break service routine. Determines whether a break or push and pull to a user stack, and an IRQ has interrupted the system and transfers control to the proper location. memory to memory transfer. You can 0800 1 BREAK SERVICE ROUTINE even add a pseudo B accumulator and a 0800 2 0800 3 16-bit index register. 0800 4 0300 5 ORG $300 0380 6 IRQSER EOT $380 ; STANDARD IRQ SERVICE O3A0 7 USRBRK EOT $3AO ; STANDARD BREAK SERVICE The authors may be contacted at the 0040 8 SAVU3W EPZ $40 School of Engineering, Walla Walla EPZ SAVLOW+$l 0041 9 SAVHIG College, College Place, Washington 99324. 0042 10 SAVDPC EPZ SAWIG*-$1 0104 11 FIAG EOT $104 0105 L2 ADDLOW EOT $105 JMCOO 0106 13 ADOTIG EOT ADDI£Wf$l 0300 14 0300 15 0300 48 16 WA PRESERVE ACC .SntmHting §nflinare ^ 0301 08 17 HIP ; PRESERVE FLAGS 0302 8A 18 TXA presents 0303 48 19 MA ; PRESERVE X 0304 BA 20 TSX OSI C4P-MF SOFTWARE 0305 BD 04 01 21 IDA FIAG,X ;GET FIAGS 0308 29 LO 22 AND #$10 030A FO 74 23 BED IRQSER 030C BD 06 01 24 IDA ADCHIG,X ;GET ADD + 2 FROM STACK 030F 85 41 25 STA SAU1IG 0311 ED 05 01 26 IDA ADDIOW,X 0314 85 40 27 STA SAVLOW 0316 DO 02 28 BNE SKIP BR IF NOT ON PAGE BOUNDRY Cb 4L 29 DEC SAVHIG DEC PAGE 03 IA C6 40 30 SKIP DEC SAVLOW DEC ILLEGAL OPCODE ADDRESS 031C DO 02 31 BNE SKI PI BR IF MO PAGE CROSSED 031E C6 41 32 DEC SA\MIG DEC PAGE 0320 C6 40 33 SKI PI DEC SAVLOW DEC ADDRESS AGAIN 0322 A2 00 .34 LDX *$00 INDEX 0324 A1 40 35 IDA (SAVU3W.X) GET ILU33AL OP CODE » UJ’ tt 0326 85 42 36 STA SAVDPC PRESERVE IT YOU MUST PILOT YOUR WWII VINTAGE 37 0328 68 PIA AIRCRAFT ACROSS A SCROLLING LAND­ RESTORE X 0329 AA 38 TAX SCAPE AND RESCUE POW'S IN ENEMY 032A A542 39 IDA SAVDPC RETRIEVE ILLEGAL OP CODE TERRITORY. SOME OF THE SMOOTHEST 032C FO 72 40 BED UBRBRK BR TOR NORMAL BREAK GRAPHICS EVER SEEN ON AN OSI! IT 032E28 41 PIi> RESTORE FIAGS ALSO USES A NEW TECHNIQUE OF 032F 68 42 PIA RESTORE ACC USING "LARGE" MULTI-CHARACTER 0330 43 SHAPES FOR A REALISTIC GAME. YOU 0330 44 WILL REALLY LOVE THIS ONE! PLEASE 0330 45 SPECIFY WHETHER YOU WANT JOY­ 0330 46 USER ROUTINES STICK OR KEYBOARD OPTIONS. THIS 0330 47 GAME IS SO EXTENSIVE THAT IT TAKES 0330 48 UP THE ENTIRE DISK! 0330 49 ALLTHIS FOR O N L Y...... $19.95 0330 50 RE7HJRN TO MAIN PROGRAM 0330 51 SEND TO: Calif, residents 0330 52 INTERESTING SOFTWARE add sales tax HARVARD BLVD. 0330 E6 40 53 ItC SAVLOW BIWP ICW ADDRESS 21101 s. TORRANCE, CA 90501 03 \ l 00 02 54 a r e s k ip 2 BR IF NO PA® CROSSED (213) 328-9422 0334 E6 41 55 INC SA\MIG BUMP PAGE 0336 6C 40 00 56 SKEP2 JMP (SAVLCW) 0339 57 END

No. 55 - December 1982 MICRO - The 6502/6809 Journal 95 [ SIG-FORTH V 1.0 ] BY A PLASTIC CASE The only stand-alone Forth system tor O.S.I. serial machines

Features: Complete Forth source code Advanced Screen editor w/source 6502 macro assembler w/source Double number and CASE extensions Vectored boot capability Several Utility Screens Complete glossary

Dos Includes: Were you ever frightened to carry your 5’A floppies out of (he security of your home or office, because of that flimsy plastic case you Bi-Directional NEC driver keep your discs in. 65U read capability $100.00 Store and carry 100 discs safely and securely. Each disc pocket is surrounded 3y an inch of high density foam. NMHZ Capability ^ „ GE Inhibits crushing, jarring, summer's heat, and winter’s cold. 100 disc 51A floppy carrying case $39.95 ea. Dealer Inquiries Invited. Phone or mail orders accepted. DIGI COM ENGINEERING, INC. Check, Money order, MasterCard, Visa For Shipping add $2.00, N.Y. State residents Add Sales Tax P.O. Box 1656 Product Design and Copyright c 1982 By Greg Cartxjnaro Kodiak, Alaska *9615

ORDERING INFORMATION: Check, money order or C.O.D.’s accepted. Unique Sojifxoarce Inc. . Shipment VIA first class mail. Allow approximately m e week for delivery. POST OFFICE BOX N, DEER PARK, NEW YORK 11729 (516) 666-757?

THE TACKLER - DUAL . MODE PARALLEL Super Pix Hires screendump software for the Epson, OK!, C. Itoh and Nec 8023. Use with Jymac PPC-100. INTERFACE FOR THE APPLE" 2 BOARDS IN ONE FOR NO MORE Special $19.95 (Specify Printer) ______COMPATIBILITY PROBLEMS! An intelligent board to provide easy control of your printer s full potential. - Customer Contact Profiler & Mailer Plus a standard parallel board at the flip of a switch - your assurance of Mr. Lister A Super Mail List Plus more — up to 1000 Entries on single 3.3 Disk (only 1 Drive required) — 2 compatibility with essentially all software for the APPLE*. Hires printing second access time to any name — full sort capabilities — Dual Index Modes — supports new 9 with simple keyboard commands that replace hard to use software digit Zip. Easy to follow manual — Not Copy Protected — 4 user defined tables with 26 sort routines. No disks to load. Special features include inverse, doubled, and rotated graphics and many text control features, available through easy selections per table — Beta tested for 6 months — user defined label generation. keyboard or software commands. Uses Industry standard graphics Introductory Price $135. $99,00 Dealer &: Dist. Inquiries Invited. commands. This is the first truly universal intelligent parallel interface! Change printers - no reed to buy another board. Jus! plug in one of our APPLE LINK ROM’S and you're all set. ROM’S available for Epson, C. Itoh, NEC, and A communications system tor the Apple® (Requires Hayes Micro Modem) Transmit and receive any Okidata - others available soon. Specify printer when ordering. Call for type of file between APPLES®, Automatic m ulti-file transfer, real time clock indicating tile transfer Price. time. Complete error check. Plus conversation mode. Only one package needed for full transfers. Compatable with all DOS file types, (requires Hayes Micro M ode m )______$59.00 THE UPGRADEABLE PPC-100 PARALLEL PRINTER CARD THE APPLE CARD/ATARI CARD A Universal Centronics type parallel printer board complete with cable Two sided 100% plastic reference card Loaded with information of interest to all Apple and Atari $3 98 and connector This unique board allows you to turn o r and off the high nwnorc * bit so that you can access additional features in many printers. Easily upgradeable to a fully intelligent printer board with graphics and text NIBBLES AWAY II dumps. Use with EPSON, C. ITOH, ANADEX, STAR-WRITER, NEC, OKI AGAIN! Ahead of all others. and others with standard Centronics configuration. $139.00 . AUTO-LOAD PARAMETERS . . . Free's the user from having to Manually Key in Param values used with the more popular software packages available for the Apple II. IF YOU WANT GRAPHICS AND FORMATTING THEN . EXPANDED USER MANUAL . . . incorporates new Tutorials for all levels of CHOOSE THE PERFORMER expertice; Beginners Flowchart for 'where do I begin’ to ‘Advanced Disk Analysts is included. for Epson, OKI, NEC 8023, C. ITOH 8510 provides resident HIRES screen dump and print formatting in firmware. Plugs into Apple slot and easy • TRACK/SECTOR EDITOR . . . An all new Track/Sector Editor, including the access to all printer fonts through menu with PR// command. Use with following features: Read, Write, Insert, Delete Search, and impressive Print capabilities! standard printer cards to add intelligence $49.00 specify printer. • DISK DIAGNOSTICS . . Checks such things as: Drive Speed, Diskette Media THE MIRROR FIRMWARE FOR NOVATION APPLE CAT II® Reliability, and Erasing Diskettes. The Data Communication Handler ROM Emulates syntax of an other popular Apple Modem product .HIGHEST RATED. . . Best back up Program in Softalk Poll (Rated 8.25 out of 10). with improvements. Plugs directly on Apple CAT II Board Supports Videx and Smarterm 80 column . . Available from Computer Applications and new listings cards, touch tone and rotary dial, remote terminal, voice toggle, easy printer access and much more. .CONTINUALUPDATES. List $39 00 Introductory Price J29.00 on the source. ______. ____ S69_95_ Dealer and Distributor Inquiries Invited. MINI ROM BOARDS DOUBLE DOS Plus Place your 2K program on our Mini Rom A piggy-back board that plugs into the disk- /MICRO-WARE DIST. INC. Board. Room for one 2716 EPROM. Use in any controller card so that you can switch select P.O. BOX 113 POMPTON PLAINS, N.J. 07444 slot but zero. Only $34.95 between DOS 3.2 and DOS 3.3 DOUBLE DOS Plus requires APPLE DOS ROMS. $39.00 201-838-9027

No. 55 - December 198 96 MICRO - The 6502/6809 Journal by David Malm berg /AICRO ™j“ r „ by Terry M. Peterson Short Subjects

SuperPET Characters neatly formatted CRT output into didn't usurp the RVS key for another Terry M. Peterson, 8628 Edgehill Ct., neatly formatted hardcopy on an ASCII function), Waterloo ASCII apparently printer (like the MX-80] is much easier El Cerrito, CA 94530 has no reverse control code such as in than with the CBM character set (the the CBM character set. Therefore, to one Gary Huckel of TNW so appropri­ print a reverse-field string, each ately calls 'half-ASCII']. character must be extracted from the Notice I said the printable charac­ string and transformed by adding 128. ters, 32 to 127, have the same PRINT For example in microBASIC: The SuperPET contains a 4K character- and POKE codes; but what about generator ROM in place of the 2K ROM POKEing the ASCII control codes 0 to found in normal CBM 8032s. The 4K 31? By experiment you will find these FOR I = 1 TO LEN(CHARSTRING$) ROM contains four character sets. In codes do not all cause the same action CHARS = STR$(CHARSTRING$,I,1) addition to the two PET/CBM charac­ when POKEd as when PRINTed. The RVSCHARS CHR$(128 + ORD ter sets found in the 2K ROM, there are POKE characters and PRINT actions of (CHAR$)) two new sets designed by Waterloo these codes are shown in table 1. The PRINT RVSCHARS; Computing Systems — ASCII and APL. codes 0 and 14-30 give an odd little NEXT I The Waterloo ASCII character set is white box when POKEd or PRINTed. used in the SuperPET by all the Code 31 gives the Greek letter \i, Perhaps this encumbrance is the reason Waterloo Micro languages except POKEd or PRINTed. Codes 1-11, when reverse-field characters aren’t men­ MicroAPL. This article describes some POKEd, give eleven line graphic char­ tioned in Waterloo's documentation? of the features of the Waterloo ASCII acters that are useful for drawing out­ character set that are not well-covered line boxes or grids. These characters are in the Waterloo documentation accom­ similar to the graphics characters avail­ panying the SuperPET. able on the Epson MX printers with All the printable ASCII characters Graphtrax Plus. They are also very like — codes 32 to 127 — in the Waterloo one subset of the CBM graphics charac­ VIC Jitter Fix ASCII set are pure ASCII. By this I ters; the shifted-zero is an example (see David Malmberg, 43064 Via Moraga, mean they are all recognizable dupli­ table 1). When PRINTed, most of the Fremont, CA 94539 cates of the corresponding character codes from 1 to 13 perform some sort of found in an ASCII table. Furthermore, control function, as shown in table 1. the PRINTed codes are identical to the What about the high-order bit that screen POKE codes for a given charac­ gives the codes 128 to 255? Either In my October 1981 MICRO article ter! Many of the screen control codes PRINTed or POKEd, all the codes from (41:54), "VIC Light Pen-Manship,” I are consistent with normal printer 128 to 255 reproduce, in reverse field, pointed out that the locations in the usage,- e.g., cursor-down = 10 (LF), their X-minus-128 POKEd counter­ VIC chip that return the light pen’s cursor-back = 8 (BS), and clear-screen parts. Although all these revers e-field horizontal screen position ($9006) and = 12 (FF). This means that turning characters are available (and Waterloo vertical screen position ($9007) are

Table 1 Epson CBM Graphics Graphtrax + Code Mnemonic ASCn Name Print Action POKE Character Equivalent Equivalent 1 SOH Start Heading Home cursor Vertical line CHR$(221) CHR$(156) 2 STX Start TeXt ? (Run) Horizontal line CHR$(195) CHR$(157) 3 ETX End TeXt ? (Stop) Lower right comer CHR$(189) CHRS (154) 4 EOT End Transmission Delete Lower left comer CHR$(173) CHRS(153) 5 ENQ ENQuiry Insert Upper left comer CHR$(176) CHRS (134) 6 ACK ACKnowledge Erase to EOL Upper right comer CHR$(174) CHRS (149) 7 BEL ring BEL1 Cursor right)!) Bottom middle comer CHR$(177) CHR$(158) 8 BS Back Space Cursor left Left middle comer CHR$(171) CHR$(150) 9 HT Horizontal Tab Tab Top middle comer CHR$(178) CHRS (152) 10 LF Line Feed Cursor down Right middle comer CHR$(179) CHR$(151) 11 VT Vertical Tab Cursor up Cross CHR$(219) CHR$(159) 12 FF Form Feed Clear screen Little white box 13 CR Carriage Return Carriage return Little white box

No. 55 - December 1982 MICRO - The 6502/6809 Journal 97 Updates and Microbes Short Subjects (continued) (Continued from page 91 Robert R. Ringel of Comstock Park, MI, found a bug in COMPRESS (52:89): If COMPRESS is processing the subject to noise. These noisy registers paddle programs, follow these steps: token for NEXT ($82] one byte before a can cause the pen's readings to jitter 1. append the subroutine to your game page boundary, it can lose that token about the screen. The October article paddle program, 2. GOSUB 1000 at the when it goes to update its addresses for presented a machine-language routine start of the program to load the the new page. that eliminated this jitter problem by machine code into the cassette buffer, To correct this problem, replace the taking seven separate readings of the 3. SYS(828) to read both paddle STX instruction at $9088 with $86E3 pen's coordinates, sorting them, and registers, and 4. get the left paddle's and the corresponding LDX instruction returning the median readings (thus ig­ un-jittered reading by PEEKing 936 and at $908E with $A6E3. Zero page loca­ noring the jittery readings that should the right by PEEKing 937. Be sure to tion $E3 is an unused location that be at one extreme or the other of the use this routine cautiously in any pro­ works well for a temporary location in sorted list). This routine also calcu­ gram that is doing tape input or output this instance. lated the light pen’s screen row and col­ because of the risk of clobbering the umn for the special case of an Atari or machine code in the cassette buffer. COMPRESS Removes Variables Commodore light pen. This same routine may also be used Warren Friedman, from Berkeley, Having recently experimented with to un-jitter the light pen reigsters by CA, sent in this update: the use of the Atari VCS's game paddles deleting lines 1190 and 1200. The The program COMPRESS, well with the VIC, I discovered that the left resulting machine code is more uni­ written and clearly described by Barton ($9008) and right ($9009) game paddle versal than the version given in the M. Bauers (MICRO 52:89) removes any registers also suffer from jitter prob­ October 1981 article because it can be variable names appearing after NEXT lems. This can be very frustrating when used with any light pen, rather than statements. It does this by ignoring all you are playing a paddle game like just the Atari and Commodore pens. characters until the following colon or PONG or BREAKOUT and the paddles Should other VIC chip registers be the end of the program line (see $93EC - occasionally bounce around the screen discovered that suffer from jitter, they $93EF). This could cause problems in as if they were possessed by evil com­ can be easily handled with this routine two cases. puter spirits. The severity of the prob­ by merely POKEing the low byte of The first problem occurs when lem seems to be a function of the game their addresses into locations 835 and several variables are used with one paddle unit itself — my neighbor's pad­ 857. See line 1190 of the listing where NEXT, as in NEXT IJ. The second case dles are much noisier than mine. this is done for the game-paddle is when a NEXT variable must be The BASIC subroutine, given in registers. stated. This may occur with nested listing 1, POKEs into the VICs cassette Because this program is very similar loops in which the inner loop NEXT is buffer a machine-language routine that to the one presented in my previous the result of an IF...THEN statement. provides a general solution to this jitter article, a full assembly listing is not (Editor’s note: A poor programming problem. To use the routine in your given. practice. Loops should be cleared before exiting or else stack overflow can occur.) These problems with NEXT can be solved by treating NEXT in the same way an IF statement is dealt with, which is to leave it as the programmer wrote it. (Bauers calls this a Terminal Jitter Fixer Subroutine Command.) This is done by changing

one byte of COMPRESS. First BLOAD 1000 REM MACHINE LANGUAGE ROUTINE TO READ ' JITTERY ' '.'IC LOCATIONS COMPRESS, then, in BASIC, POKE 1 0 1 0 REM SUCH AS L IG H T PEN C O O RDINATES OR GAME PADDLE S E T T IN G S 102O REM SYSi.'82S) TO READ ------1,'ALUES RETURNED IN LOCATIONS 934 AND 937 37871,72 (or, in the monitor, enter 1030 FOR 1= 823 TO 93S :REflD DC:POKE I.DC:NEHT I 93EF:48). Then BSAVE COMPRESS, 1040 DATA 142,0.140,3,132,152,173,4,144 1050 DATA 140,171,132,151,32,133,3,145 A$9000,L$600. 1040 DATA 181,24,109,170,3,133,151,144,2 Similarly, programmers who use & 107® DATA 230, 152, 173,7, 144,32, 133,3,232,234 1080 DATA 170,3,240,9,145,142,197,142,240 statements (and who do not mind have- 1090 DATA 252,74,42,3,173,170,3,74.143 ing LET statements remain in the pro­ 1100 DATA 177,151,141,149,3,149,171,133 1110 DATA 151,149,3,133,152,177,151.141 gram, if there are any) can change lines 1120 DATA 148,3,94,142,143,3,172,145,3 460 and 461. In BASIC, POKE 1130 DATA 192,0,240,22,136,209,151,200 1140 DATA 174,14,134,141,145,3,177,151 37873,202 : POKE 37874,240 : POKE 1150 DATA 200,145,151,134,173,143,3,54 37875,68 (or, in the monitor, enter 1140 DATA 174,230,145,151,94,0,0,7 1170 REM ROUTINE WILL NORMALLY READ GAME PADDLES 93F1.CA FO 44). The two lines of 1180 REM TO READ LIGHT PEN COORDINATES, DELETE THE NEXT TWO STATEMENTS COMPRESS become 1190 POKE 835.S:POKE 857,9 1200 POKE 848,149:POKE 849,255 :POKE 87® .2-33:POKE 8 71 .1sPOKE 872 .296 C9 CA CMP #$CA ;is it '& ’? 1210 RETURN FO 44 BEQ IF ;yes JMCftO JMCftO

98 MICRO - The 6502/6809 Journal No. 55 - December 198; Atari Sound and Graphics, by Herb Computers for Kids, by Sally Green­ Moore, Judy Lower, and Bob Albrecht. wood Larson. Creative Computing John Wiley & Sons, Inc. (605 Third Press (P.O. Box 789-M, Morristown, Ave., N.Y.C., NY 10158), 1982, 234 NJ 07960), 1981, 73 pages, paperback. /AlCftO ISBN: 0-916638-21-6 $4.95 pages, paperback. New Publications ISBN: 0-471-09593-1 $9.95 Ciarcia's Circuit Cellar, Volume ID, by Steve Ciarcia BYTE/McGraw-Hill (70 So we can list moie of the many new The Creative Apple, Edited by Mark books now available, we axe offering Main St., Peterborough, NH 03458), Pelczarski and Joe Tate. Creative Com­ 1982, 228 pages, 814 x 11 inches, New Publications in a different format. puting Press (Morris Plains, NJ), 1982, paperback. We think you’ll find this increased 448 pages, paperback. ISBN: 0-07-010965-6 $12.95 sampling of computer literature useful. ISBN: 0-916688-25-9 $15.95 Library of PET Subroutines, by Nick Techniques for Creating Golden Deli­ cious Games for the Apple Computer, Hampshire. Hayden Book Company, The VisiCalc Book, Apple Edition, by by Howard M. Franklin, Joanne Kolt- Inc. (Rochelle Park, NJ), 1982, 140 Donald H. Beil, Reston Publishing now, and Leroy Finkel. John Wiley and pages, paperback. Company, Inc. (Reston, VA], 1982, 301 Sons, Inc. (605 Third Ave., N.Y.C., NY ISBN: 0-8104-1050-8 $14.95 pages, paperback. 10158), 1982, 150 pages, paperback. ISBN: 0-8359-8398-6 $14.95 ISBN: 0-471-09083-2 $12.95 PET Graphics, by Nick Hampshire. Hayden Book Co., Inc. (Rochelle Park, The Third Book of Ohio Scientific, by BASIC for Business by Douglas Hergert. SYBEX (2344 Sixth Street, NJ), 1982, 218 pages, paperback. S. Roberts. ELCOMP Publishing, Inc. Berkeley, CA 94710), 1982, 223 pages, ISBN: 0-8104-1051-6 $16.95 (Postbox 1194, Pomona, CA 91769), 1982, 137 pages, 5W x 8W inches, 7 x 9 inches, paperback. paperback. ISBN 0-89588-080-6 $12.95 Computer Consciousness: Surviving ISBN: 3-921682-77-0 $17.95 the Automated 80’s, by H. Dominic Computers for People by Jerry Willis and Merl Miller. Dilithium Press (P.O. Covvey and Neil Harding McAlister, Kilobaud Klassroom, by George Young Box 606, Beaverton, OR 97075), 1982, Addison-Wesley Publishing Company, and Peter Stark. Wayne Green Books 200 pages, 5 54 x 8 Vi inches, paperback. Inc. |Reading, MA], 1982, 211 pages, (Peterborough, NH 03458), 1982, 419 ISBN: 0-918398-64-9 $7.95 paperback. pages, 6 x 9 inches, paperback. ISBN: 0-201-01939-6 $6.95 ISBN: 0-88006-027-1 $14.95 4MCRO

QCB-9 SINGLE BOARD COMPUTER BUY! SELL! TRADE! 6809 BASED COMPUTER & HAM EQUIPMENT RUNS TSC FLEX DOS $149.00 ★ QCB-9/1 S-100 BUS * PAR TIAL KIT ★ QCB-9/2 SS-50 BUS FEATURES Q COMPUTER* • 5Vi" Floppy Controller • Serial RS-232 Port • Centronics Type Printer Port T TRADER • Keyboard/Parallel Port • 24K Bytes of Memory • QBUG Resident Monitor • 6802 Adaptor PERMANENT FULLY ASSEMBLED & TESTED $389.00 SUBSCRIPTION » 48-hour Burn-in » 90 Day Warranty NAKED-09 SS-50 6809 CPU CARD $49.95* $10.00 Ttr 1K OF RANI AT E400 Assembled & Tested 1149.00 Documentation * 6K OF EPROM AT E800-FFFF 2 MHZ Version $189.00 Only Low Ad Rates — Mailed Monthly * HIGH QUALITY DOUBLE SIDED PCB * SOLDER MASKED * SILK SCREENED TSC, FLEX DOS, ASSEMBLER, EDITOR $150.00 FOREIGN SUBSCRIPTIONS $25.00 YEAR Q B U G RESIDENT MONITOR $50.00 * Disc Boot * Memory Test * Break Points COMPUTER TRADER® * Memory Exam & Exchange * Zero Memory * Jump to User Program * Memory Dump * Fill Memory * Register Display & Change Chet Larrtbert, W4WDR QBUG IS A TRADEMARK OF LOGICAL DEVICES INC., ‘ Copyright 1981 1704 Sam Drive • Birmingham, AL 35235 ______PHONE ORDERS: (305) 776-5870 ______(205) 854-0271 LOGICAL D EVICES INC. COMPUTER PRODUCTS DIVISION Please include your Name, Address, Call Sign or Phone Number 781 W. OAKLAND PARK BLVD. • FT. LAUDERDALE, FL 33311 TWX: 510-955-9496 • WE ACCEPT VISA, MC, CHECKS, C.O.D., MONEY ORDER

No. 55 - December 1982 MICRO - The 6502/6809 Journal 99 /AlCftO Reviews in Brief

Product Name: Spellmaster Pluses: An external speaker can be used to improve fidelity Equip, req'd: Commodore 80-column screen and via the cassette port. The package includes a music editor dual disk (40- and 64-column versions for constructing tunes, with several sample tunes. A com­ expected soon) bined display allows for the simultaneous entering and For Wordpro files (Wordcraft & Silicon playing of music. Entered scores can be transposed both in Office versions planned) key and in tempo. Each note played may have one of four Uses functional 4K ROM at $9000 voices. Notes can be entered either into an editor or played Price: $195 directly from the keyboard. Then the music can be incor­ $ 75 for legal or medical dictionary porated directly into user programs! The storage format of options the music is described for the more advanced programmer Manufacturer: Management Systems Alternatives who may wish to access the binary score directly. 6219 Thirteenth Avenue South Minuses: The manual is brief (17 pages) but complete. Gulfport, FL 33707 Although the author has permitted the user to play music Description: Finally, a decent spelling checker for CBM directly from the Apple keyboard (using the upper row of computers! Highly recommended for word-processing keys for one note and the lower for the other), I personally writers who do not spell well. found this feature awkward to use. The editor is much more complete for entering music from the keyboard. As Pluses: It is far faster than its only competitor and has an mentioned in the manual it is included only for familiari­ honest 40,000-word dictionary. presents Spellmaster zation. Deletion of a line using the music editor is not a suspect words for editing in context in reverse field on a single stroke command. To accomplish a line deletion, a typical Wordpro screen display. Suspect words may then file must be opened so that the line to be deleted is the be easily corrected or added to the dictionary for future last. Then deletion will remove it. After working with reference (up to 3,000 more words on the 4040, and 20,000 Musicomp, Paul Lutus1 first music editor, I was spoiled by more on the 8050). Corrected files are resaved to disk, his hi-res display of notes in motion. I would love to have avoiding the hassle of reloading the word processor and seen that feature retained in Electric Duet. However, by searching for the errors. The program is mostly self- obtaining 2-part music with no hardware, at a fraction of documenting, though it comes with a typical manual. the cost of popular music: boards, this program should be There is a HELP screen in the program and useful prompts considered carefully before investing in more expensive throughout. alternatives. Minuses: When editing, it is easy to skip past a word that Skill level required: Fairly easy for the novice to master needs to be repaired or added to the dictionary. At present, with a little practice. there is no way to back up except by aborting and restarting Reviewer: David Morganstein the edit. The company is attempting a fix.

Skill level required: Users should be fairly familiar with Wordpro and willing to spend about an hour reading the Spellmaster manual before use.

Reviewer: Jim Strasma Product Name: Terminal-40 Equip, req'd: VIC-20 8K (or more) of extra memory VICMODEM or RS-232 compatible modem Price: $29.92 Manufacturer: Midwest Micro Associates Product Name: Electric Duet P.O. Box 6148 Equip, req'd: Apple II or Apple II Plus Kansas City, MO 64110 Price: $29.95 Author: Dr. Jim Rothwell Manufacturer: Insoft Description: Terminal-40 is an extremely powerful 10175 Barbur Blvd., Suite 202B telecommunications program for the VIC-20. This Portland, OR 97219 machine-language program is fast enough to support up to Author: Paul Lutus 2400 baud, is quite flexible, and allows you to specify Copy Protection: Yes duplex, parity, wordsize, stopbits, linefeed, and baud rate Language: 6502 Assembly options. Through software, Terminal-40 displays a Description: A software-only music synthesis system for 40-character line with each character represented by a 3 x 6 generating 2-part music on an Apple with no additional matrix. All characters are shown as upper case and are hardware required. quite readable. Terminal-40 also has a 4K oi larger buffer,

1 0 0 MICRO - The 6502/6809 Journal No. 55 - December 1982 Reviews in Brief (continued) which can be used to capture copies of the material being 6502 DEBUG! transmitted or received for later study or dumping to the printer. FAST’n EASY Pluses: A versatile and exceedingly well-done package. The 40-column display is great! T h e PTD L a n g u a g e Way Minuses: Although Terminal-40 supports the printer, it does not handle the disk, nor is there any way to use it to transmit or receive a program. The program comes on an "auto-start" tape and cannot be copied to disk or another tape. 0 5 LOCI = % 7 C 80 Documentation: The 20-page manual is clear and comprehensive. 10 PC = S3FC7 f/-* »• f | l 20 LABL: STEP 100 NODISP No special skills required. 30 IF X<*3E OR @LCIC1#*17 THEN GOTO LABL Reviewer: David Malmberg 40 PRINT "HERE IS THE CULPRIT"

50 SHOWC100

Product Name. Doubletime Printer Equip, req'd: Apple II Plus Any of the popular printers L PTD-6502 is a high speed, compiled BASIC-like lan­ Price: $99.95 guage, light years ahead of the Apple II Single Stepper Manufacturer: Southwestern Data Systems and far more sophisticated than any other 6502 de­ P.O. Box 582 bugger available. It allows you to sit back effortlessly Santee, CA 92071 while your computer glides through your code at a thou­ (714) 562-3221 sand instructions per second looking for your bugs. Or Description: Double Printer permits printing to take place you can select a slower speed with updated display of as a background task. You can continue to use your com­ memory. A paddle-controlled! single stepper mode is puter while it is printing rather than being "frozen out.” also available. At either of the slower speeds, the This should prove particularly valuable in word processing PTD-6502 monitors and saves the last 128 instructions applications. executed for review at any time. Virtually unlimited breakpoint complexity is per­ Pluses: The product is extremely versatile. Applesoft, mitted with the PTD-6502. IF statements with mixed binary, or text files are printed without conversion. For­ AND’s and OR’s can be created to test conditions such matting commands are available and easy to use. as memory change, memory = value, instruction loca­ tion, ... and many others. You can have as many named Minuses: The product is not easy to get up and running. It breakpoints as you wish in both ROM and RAM. requires a ROM chip change, a board installation, and a Some other features of the PTD-6502 include • Fast diskette boot. All this could be dealer-performed for the subroutine execution. • Hex calculator/converter. more timid user. It is worth the trouble. • Hex/ASCII memory dump. • Up to 16 machine lan­ guage cycle timers. • Ability to monitor specific labeled Documentation: The instructions are well-written but areas in memory while stepping. • Effective address. quite technical. • Accessible monitor commands. • A documented mod­ ule for relocation of the PTD-6502 to virtually any loca­ Skill level required: An intermediate familiarity with the tion (source code supplied). Apple is necessary. The debugging program shown on the monitor is a simple example; it could be far more complex. If you can Reviewer: Chris Williams think of it, you can probably scan for it at 1000 instruc­ tions per second. If you’re a professional, the PTD-6205 can pay for itself in the first few hours of use. If you’re a novice, you’ll soon be debugging like a pro.

Product Name: Apple-Cillin II ORDER: PTD-6502 Debugger Equip, req'd: Apple II or Apple II Plus with disk including DOS 3.3 Disk drive (13- or 16-sector) and instruction manual ...... $49.95 Price: $49.95 (Note that disk is not copy protected. Order only one for each business or institution.) In Califor­ Manufacturer: XPS, Inc. nia, add 6.5% sales tax. 323 York Road PTD-6502 requires Autostart ROM for fast breakpoint. Carlisle, PA 17013 Description: This diagnostic utility tests RAM and ROM chips, the disk system, peripheral cards, keyboard, CRT PTERODACTYL display, printer, tape recorder, game controls, and CPU SOFfWAR€ (C ontinued on n ext page) 1452 Portland Ave. • Albany CA 94706 • (415) 525-1605

No. 55 - December 1982 MICRO - The 6502/6809 Journal 101 Reviews in Brief (continued)

registers. Disk tests include sequential and random writing and reading, random track seeking, and drive speed.

Pluses: Single or multiple tests may be repeated con­ tinuously, with results optionally printed. The program is menu-driven, user-friendly, fast, and crash-resistant.

Minuses: The style and depth of the documentation are marginal.

Documentation: The 24-page manual is neatly formatted and printed. The writing is comprehensible but often awkward and unpolished. It describes in detail how to use the program, but gives almost no help to analyze and cor­ rect problems it finds.

Skill level required: Little skill is needed to run it, but moderate hardware knowledge is required to know what to do about reported problems.

Reviewer: Jon R. Voskuil

Product Name: SPELL 'N FIX Equip, req'd: TRS-80C, with disk or cassette, 32K; other versions available for FLEX, OS-9, and other systems. Price: $69.29 (FLEX version $89.29| Manufacturer: Star Kits P.O. Box 209 AIM HIGH Mt. Kisco, NY 10549 Let Unique Data Systems help you raise your sights on AIM 65 Description: SPELL 'N FIX is a package of program files applications with our versatile family of AIM support products. that provides a dictionary for Color Computer text files. •Go for high quality with our ACE-100 Enclosure. It accom­ The main program, SPELLFIX, loads and executes a 6809 modates the AIM 65 perfectly, without modification, and features machine-language dictionary look-up program. A easy access two board add-on space, plus a 3" x 5" x 17" and a 20,000-word dictionary file is used to check ASCII files for 4" x 5" x 15.5" area for power supplies and other com­ ponents. $186.00. spelling and typographical errors. Other files included are • Get high capability with Unique Data System's add-on boards. utilities for writing and reading ASCII files, a sample text The UDS-100 Series Memory-I/O boards add up to 16K bytes of RAM memory or up to 48K bytes ROM/PROM/EPROM to your file, binary-to-ASCn conversion programs, and a program Rockwell AIM 65. You also get 20 independently programmable to expand the dictionary. These programs allow you to use parallel I/O lines with an additional user-dedicated 6522 VIA, two SPELLFIX with processors that create binary files. independent RS-232 channels with 16 switch-selectable baud rates (50 to 19.2K baud), and a large on-board prototyping area. Pluses: The dictionary program is expandable when using Prices start at $259.00. • If you need to protect against RAM data loss, the UDS-100B of­ the disk version, and you can create your own dictionary fers an on-board battery and charger/switchover circuit. $296.00. that fits your writing style. Questionable words are dis­ • Heighten your AIM 65’s communications range by adding the played, and/or printed in alphabetical order for checking. UDS-200 Modem board. It features full compatibility with Bell System 103 type modems and can be plugged directly into a The disk version also allows marking of questionable home telephone jack via a permissive mode DAA. No need for a words for later correction, or they may be corrected data jack or acoustic coupler. The UDS-200 also has software- immediately. Large files usually take only slightly longer selectable Autoanswer and Autodial capability with dial tone detector. The modem interfaces via the AIM 65 expansion bus, to correct than smaller files. It will work on most files that with the on-board UART and baud rate generator eliminating the are larger than RAM memory. The disk version can be need for an RS-232 channel. $278.00. easily converted to tape, and vice versa. • The UDS-300 Wire Wrap board accepts all .300/.600/.900 IC sockets from 8 to 64 pins. Its features include an intermeshed Minuses: The tape version cannot mark or immediately power distribution system and dual 44-pin card edge connectors for bus and I/O signal connections. $45.00. correct text files. Not directly compatible with Color • Get high performance with the ACE-100-07 compact 4” x 5' x Scripsit files, though, Scripsit can print an ASCII file to 1.7" switching power supply, delivering + 5V @ 6A, +12V @ 1 A, tape, which can be read by the dictionary. and + 24V for the AIM printer. $118.00. Installation kits and other related accessories are also avail­ Documentation: A 25-page manual is included that able to implement your AIM expansion plans. Custom hard­ thoroughly explains the proper operation of the programs. ware design, programming, and assembled systems are also available. High quality, hign capability, high performance, with Information is also provided on modifying and creating high reliability... all from Unique Data Systems. Call or write new dictionaries. No instructions were included foj for additional information. removing words from the dictionary. Unique Data Systems Inc. Skill level required: With only a few minutes of study 1600 Miraloma Avenue, Placentia, CA 92670 anyone should be able to operate the program. (714) 630-1430 Reviewer: John Steiner JMCRO

1 0 2 MICRO - The 6502/6809 Journal No. 55 - December 1982 A M C ftO Software Catalog

Name: Data Tape Maker Name: Spellmaster Name: K-Star Patrol™ Name: Single Entry System: OSI (ProofReading System: Atari 400/800 Ledger CIP/Superboard II Software) Memory: 8K System: 6809 Using FLEX Memory: 4K System: CBM 8032, CBM Language: Machine Code or UniFLEX, Language: 8K BASIC in ROM 8096, SuperPET, Hardware: ROM cartridge TRS-80 Model III Description: Data Tape Makei Commodore 64 Description: An exciting galac­ and Color is a relatively short program Memory: 32K minimum tic encounter between the Computer that allows you to save Language: Assembly (6502) player's patrol flight and an Memory: 56K machine-language code or any Description: Spellmaster iden­ onslaught of attacking alien Language: Extended BASIC other data stored in con­ tifies and allows correction of craft. The player's mission is Hardware: 8 " or 5 Vi" disk secutive memory locations in misspellings from wordproces- further complicated by a Description: Single Entry DATA statements on tape. sing text. It has a 40,000-word voracious intergalactic leech, Ledger is a simple bookkeeping The sign space for each capacity on the CBM 8050. and the aliens' low-level system for tracking income number is eliminated to allow Suspect words are displayed on avoidance system. High degree and expenses. It is an ideal ac­ for compact storage of data. A screen, and direct screen of challenge and entertain­ counting system for tax pur­ FOR/NEXT loop is automatic­ editing of mistakes is pro­ ment for even the most ex­ poses saving the user both ally generated to restore the vided. Available for WordPro, perienced player. time and money. The data files data into memory at a later Wordcraft, Silicon Office. It Price: $39.95 suggested retail may contain any number of ac­ time. will proofread a large WordPro Includes ROM cartridge and counts or transactions. Any Price: $4.00 for tape file in two minutes or less. full color instruction number of reports may also be $3.00 for listing Legal and medical dictionaries booklet. written from comparison are available for $75. reports of the previous year to Author: Brian Zupke Author: Dr. Keith Dreyer and Price: $199.00 Torre Meeder transactions by account Available: number. B.C. Software Author: Dwight Huff and Available: 5152 Marcell Ave. Joe Spatafora K-Byte Price: $95.00 Includes disk and manual. Cypress, CA 90630 Available: 1705 Austin Spellmaster Systems Troy, MI 48084 Author: K. Orlowski Software or your local computer Available: 6219 13th Avenue South software retailer Universal Data Research Inc. Name: Air Navigation Gulfport, FL 33707 Dept. A Trainer (813) 347-6733 2457 Wehrle Drive System: Apple II or Apple Name: Death Race '82 Buffalo, NY 14221 II Plus, Applesoft System: Apple II with in ROM or Applesoft in ROM Language Card Name: Rail Runner Memory: 48K Name: Prelab Studies in Memory: 48K System: TRS-80 Color Language: BASIC/Assembler General Organic Language: Applesoft and Computer or TDP Hardware: One disk drive, and Biological Machine Language System 100 game paddles Chemistry Hardware: One disk drive Memory: 16K Description: Death Race ’82 System: Apple II with (DOS 3.3) and Language: Assembly combines the skill of perilous 3.3 DOS game paddles Hardware: Cassette or disk driving with the thrill of a Memory: 48K Description: Air Navigation Description: Your railroad high-speed chase. Behind you Language: Applesoft Trainer is a real-time simula­ engineer must scurry over the is a robot car fully equipped Description: This package pro­ tion of aircraft navigation with track of the busiest train with high-technology lasers. vides a review of selected hi-res instrumentation and switchyard ever, dodging Your successful escape de­ chemical concepts highlight­ ground-track map, sound ef­ speeding trains and handcars, pends on maneuvering your ing important ideas, tech­ fects [including station IDs), to rescue the poor little hoboes turbo car through the enig­ niques, and calculations en­ dial-in wind magnitude and on the wrong side of the matic curves of ten con­ countered in the laboratory. direction, four different simu­ tracks. You have only so much secutive mazes, and foiling The programs are in a tutorial lations, dual independent time to save all the hoboes! your pursuer through the format, using demonstrations, VORs (VHF Omnirange Radar] With many levels of difficulty, clever use of bazooka rockets interactive exercises, animated with adjustable OBS (just like this action graphics game is and oil slicks. Ten different sequences, and simulations. the real thing], ADF, NDBs, fun for everyone. speeds ranging from novice to Price: $550.00 (tentative) and more. Price: $21.95 cassette expert offer hours of fun before Includes nine disks and Price: $40.00 $26.95 disk proficiency is achieved. complete documentation. Includes program diskette plus $2 shipping Price: $29.95 Author: Sandra L. Olmsted and full documentation. Includes cassette or disk Includes disk and and Richard D. Olmsted (Not for pilots only!) with instructions. documentation. Available: Author: Ken Winograd Author: BJ Author: Don Fudge John Wiley & Sons, Inc. Available: Available: Available: Eastern Distribution Center Space-Time Associates Computerware Avant-Garde Creations Order Processing 20-39 Country Club Drive Box 668 P.O. Box 30160 Department Manchester, NH 03102 Encinitas, CA 92024 Eugene, OR 97403 1 Wiley Drive (603) 625-1094 (714) 436-3512 or local dealers Somerset, NJ 08873

No. 55 - December 1982 MICRO - The 6502/6809 Journal 103 Software Catalog(continued) Description: This collection of Name: The Apple Family native code-generating macro Sing-Along cross-assemblers allows you to Christmas Disk Name: System/ASM 3A the coolant water. Unfor­ program on the host machine System: Apple II, Apple II System: Apple II Plus tunately, there isn't time to of your choice for the object: Plus, Apple III Memory: 48K minimum. disarm the security Androids machine of your choice. Memory: 48K Language card is guarding the installation, so Price: $375.00 Language: Applesoft or supported. you’ll have to fight your way Includes object code. Integer Basic Language: Assembly down. Once you've released Available: (runs in emulation mode Hardware: Disk II required, the water, you've got to get SofTech Microsystems, Inc. on Apple III) Silentype printer back out before you drown! 9494 Black Mountain Rd. optional Android Attack has electric San Diego, CA 92126 Hardware: Disk drive Description: System/ASM 3A robots and walls, bonus points, (714) 578-6105 Description: Sixteen favorite is an assembly-language devel­ and up to eight different levels carols, complete with words to opment system that features a to challenge you! all the verses, containing two-pass assembler, full screen Price: $18.95 plus $2 shipping multiple-voices and four-part editor, and disk-file manage­ (Mail order price) Name: Galactic harmony, are pitched so you Gladiators can sing along if you want to. ment system. The system is Author: John Wilson easy to use but powerful System: Apple II with The choice of an internal Available: enough to write very complex Applesoft ROM speaker or cassette port output Pretzelland Software programs. System/ASM 3A is card, Apple II is given. The Christmas music 2005 D. Whittaker Rd. written in its own assembly Plus, or Apple III is tuneful, well arranged, and Ypsilanti, MI 48197 language and is DOS Memory: 48K lots of fun to listen to. Just the (313) 483-7358 3.3-compatible. Hardware: Monitor and disk thing to lend novelty and a or local dealers drive festive background to Price: $35.00 Description: Galactic Gladi­ Christmas parties, office par­ $5.00 for manual only ators is a fast and furious com ­ ties, and Apple family get- Includes no shipping and Name: The Last One puter game of alien combat for togethers. handling charges. Ohio System: Apple II Plus two players or against the com­ residents add appropriate Price: $24,50 Memory: 48K puter. The creatures are rated sales tax. Includes everything needed Language: BASIC/Machine for strength, endurance, speed, to play the songs — no hard­ Available: Hardware: Two disk drives, dexterity, experience, weapons, ware required. The Mike Piaser Company printer optional skill, and armor. The scenario Author: Product of the M usic 15401 Maple Park Drive #11 Description: The Last One is a permutations are as infinite as M aker™ utility from Maple Heights, OH 44137 computer program code gener­ the Universe. SubLogic ator that designs a program and Price: $39.95 Communications Corp. enters flowchart-type state­ Includes rulebook, disk, and Available: Name: Factoring Whole ments in an easy-to-use menu data card. Solutions Softworks Numbers style. The Last One then Author: Tom Reamy System: PET DOS 2.1 begins to code the program, Box 72280 Available: Memory: 16K asking the user questions Roselle, IL 60172 Strategic Simulations Inc. Language: BASIC about “where to branch," etc. $1.50 shipping costs 465 Fairchild Dr. Hardware: Disk drive or A BASIC program is created as or from Apple dealers Suite 108 cassette output which then can be run, Mountain View, CA 94043 Description: Twelve programs listed, or modified like any Name: Anova II (415) 964-1353 (on six tapes or three diskettes] other BASIC program. The System: Apple II or Apple present the concepts of factor­ Last One is not required to ex­ II Plus ing in a carefully-designed se­ ecute the output program. Memory: 48K Name: The Animator Language: ROM Applesoft quential preparation for frac­ Price: $600.00 System: Apple II or Apple tions and algebraic expres­ Includes complete Hardware: One or two disk II Plus sions. A tutorial and practice documentation, numerous drives, printer Memory: 48K program precedes six moti­ sample flowcharts that will optional Language: Applesoft/ vating and interactive enrich­ produce software worth Description: Anova II performs Assembly ment programs. several hundred dollars. up to a five-way analysis of Hardware: Disk drive variance with equal or unequal Price: $90.00 Author: D.J. ‘AT Systems Ltd. Description: This program pro­ numbers. It can analyze ran­ Includes diskettes or tapes Available: duces animated 'film' strips domized designs, between and and a teacher’s guide. Krown Computing that enter only key frames, within designs, and repeated Author: Joanne Benton 1282 Conference Dr. then The Animator calculates measures of designs. Anova II Available: Scotts Valley, CA 95066 the in-between frames. The can also perform an analysis of Quality Educational Designs (408) 335-3133 key frames are easily entered co-variance for all designs. The P.O. Box 12486 — either visually, numerically, Anova table output tests all Portland, OR 97212 or from a library. The demo in­ factors and interactions. cludes a ballet sequence show­ Price: $150.00 Name: Assemblers ing a ballerina with 12 inde­ Includes program disk and Name: Android Attack Package t pendently moving body parts. backup disk, documentation, System: Atari 400/800 System: The UCSD Price: $51.95 and binder. Memory: 16K cassette p-System™ Includes 57-page manual, Authors: Stephen Madigan, 32K disk Memory: 48Kb runtime three tutorials, and a shape Ph.D. and Virginia Language: Hybrid environment; generator. Lawrence, Ph.D. Hardware: Cassette or disk 64Kb development Author: Ray Balbes system environment Available: Description: The nuclear re­ Language: Assembly Available: Human Systems Dynamics actor in our top-secret under­ Hardware: 8086, Z80, 8080, Balbesoftware Systems 9249 Reseda Blvd. ground lab is in danger of 8085, 6502, 9900, #6 White Plains Dr. Suite 107 melting down! Only you can 6809, 68000, and St. Louis, MO 63017 Northridge, CA 91324 save it by manually releasing LSI-ll/PDP-11 (314) 532-5377 (continued/

104 MICRO - The 6502/6809 Journal No. 55 - December 1982 Software Catalog(continued)

Name: UniFLEX Price: $29.95 W hat’s e a tin g System: Gimix 6809 Includes program disk and Winchester written instructions. Systems Author: Stanley Crane Memory: 128K minimum Available: Language: Available: BASIC, Alpine Software, Inc. Pascal, Assembler, 2120 Academy Circle, Suite E FORTRAN 77, C your Apple? Colorado Springs, CO 80909 Hardware: 2MHZ 6809 CPU (303) 591-9874 with memory, disk controllers, 19MB 5 Vt" Name: The Football Winchester Comput-Stat Find out with Apple-Cillin II™ Description: UniFLEX is a true System: Apple II, IBM PC, multi-tasking, multi-user Radio Shack M in operating system. Each user Memory: 48K If you use your Apple for your business or communicates with the Language: BASIC profession, you probably rely on it to save you system through a terminal and Hardware: One disk drive, may execute any of the printer optional time and money. You can’t afford to guess available system programs. Description: Compu-Stat con­ whether it is working properly or not. Now you This implies that one user may tains programs and related data be running the text editor for the analysis of pro- don’t have to guess. Now you can find out while another is running football's regular season — with Apple-Cillin II. BASIC while still another is both point-spread records and running the C compiler. Not the underlying box-score sta­ Apple-Cillin II is the comprehensive diagnostic only may different users ran tistics. It performs analyses for different programs simultane­ the 1981 and 1982 regular sea­ system developed by XPS to check the ously, but one user may be sons. A related program prod­ performance of your Apple II computer system. running several programs at a uct, Tally Sheet, keeps a run­ time. ning tally on your predictions. Apple-Cillin II contains 21 menu driven utilities Price: $550.00 Price: $100 - $3500 depending including tests for RAM memory, ROM Includes UniFLEX Operating on programs and equipment memory, Language Cards, Memory Cards, System, documentation. ordered. DISK system , Drive Speed, Keyboard, Printer, Author: Technical Systems Includes user manual, Consultants, Inc. program diskette, and CPU, Peripherals, Tape Ports, Monitors and security chip. Available: more. These tests will thoroughly test the Author: Dr. John Page Gim ix Inc. operation of your Apple, and either identify a 1337 W. 37th St. Available: Chicago, IL 60609 Interactive Sports Systems specific problem area or give your system a [312) 927-5510 P.O. Box 15952 clean bill of health. You can even log the test New Orleans, LA 70175 Price: $99.95/Sinclair tape results to your printer for a permanent record. $129.95/Apple/Atari disk $129.95/Atari tape Apple-Cillin II works with any 48K Apple system Includes 34 pages of Name: Elements of Mathematics documentation. equipped with one or more disk drives. System: Apple II Author: Bob Nadler Memory: 48K To order Apple-Cillin II - and to receive Available: Language: BASIC F/22 Press Hardware: One disk drive information about our other products - Call P.O. Box 141 Description: This program was XPS Toll-Free: 1-800-233-7512. In Pennsylania: Leonia, NJ 07605 developed to assist students in 1-717-243-5373. adding fractions, reducing frac­ tions, and adding fractions with unlike denominators. Apple-Cillin II: $49.95. PA residents add 6% Name: Lovers or Materials were developed and State Sales Tax. Strangers tested by the authors before be­ System: Apple II ing published. Memory: 48K Price: $90.00 Language: Applesoft Author: Ray E. Zubler XPS, Inc. Hardware: One disk drive Susan Sarapata 323 York Hoad Description: L o v e r s or Available: Strangers is a computer game Carlisle, Pennsylvania 1/013 Electronic Courseware with a serious side. It is a com- Systems, Inc. 800-233-7512 patiblity evaluator that tells P.O. Box 2374, Station A XPS 717-243-53/3 two people how likely they are Champaign, IL 61820 to have a successful relation­ (217) 359-7099 ship. A couple's likes and or computer retail stores and dislikes, philosophies, and book stores lifestyles in seven major areas of compatibility are explored. (continued) Ao& II 15 a trademark q1 Appte Computer Inc

No. 55 - December 1982 MICRO - The 6502/6809 Journal 105 Software Catalog(continued)

TIRED OF ALL THE Name: Basic Aid operate general ledger with System: TRS-80 Color built in receivables and "EXCEPT FOR... "S? Computer payables. Reports include Memory: 16K - 64K general ledger, month's jour­ WITH THE NEW PRINTOGRAPHER Language: 6809 Machine nal, balance sheet, income GRAPHICS PRINTING SYSTEM. Language statem ent, aged receivables WE'VE GOT YOU COVERED! Hardware: ROMPAK and payables, receivable and Description: B asic Aid is a payable detail, and more! utility program to help and Price: $495.00 assist Color BASIC and Ex­ Includes operator's manual, tended BASIC users. Some of programs, and sample PONT the features are: automatic line company data. numbering, program merging, Author: Dan Sargent and moving program seg­ Available: ments. It comes with a plastic Great Divide Software keyboard overlay that contains 8060 W. Woodard Dr. most of Extended Color Lakewood, CO 80227 BASIC's commands. Price: $34.95 Includes detailed instruction Name: Borg System: Apple II or Apple manual, plastic keyboard II Plus overlay. Memory: 48K Author: Eigen Systems Language: Assembly Available: Hardware: One disk drive, Spectrum Projects paddle or joystick 93-1586 Drive Description: Deranged Grud Woodhaven, NY 11421 Terrorizes Countryside! Pro­ tected by Borg, the invincible Name: S-C Macro Cross Drageroo, a notorious band of PRICE: $4 9 .9 5 Assemblers 6800, dragons, the infamous Grud (Californio- Residents odd 6% sotes rax.} 6809, and Z-80 has surrounded his hide-out System: Apple II or Apple with electrified mazes. Can no one crack the code and rid us of The PRINTOGRAPHER is designed ro fill all of your gropnic printing II Plus needs, without having ro worry abour running inro the problem of if Memory: 48K (RAM card this menace? almost working, "except onyour printer", or "except for rhe lock of version included) Price: $29.95 itiar particular feature". 'Whether you have a daisy wheel or dor matrix Language: Machine Author: Dan Thompson printer, the standard version of PRINTOGRAPHER works on any printer Hardware: Disk drive and interface combination with graphics capabilities. In many cases, Description: You can easily Available: Sirius Software, Inc. this includes printers you may not even have thought could prmr develop programs for 6800, 10364 Rockingham Dr. graphics. 6809, or Z-80 computers with Sacramento, CA 95827 powerful macros, conditional Jusr o FEW of rhe possible printers include: EPSON, PAPER TIGER, ANAOEX, |916) 366-1195 NEC, DIABLO, QUME. MP1, 5ILENTYPE. OKIDATA MAUBU, interface cards assembly, 20 directives, and 29 Include: APPLE. S5M, CCS, MTN COMP. CPS, MPI, GRAPPLER. TYMAC commands (including a power­ PROMETHEUS and more! ful EDIT command with 15 Name: D.F.T subcommands). It allows very System: TRS-80 Color In addition to versatile print options (easy cropping, variable i fast cycles of modification, re­ Computer cations, normal/reverse inking, vertical/horizontal format, etc.) assembly, and testing. Memory: 16K PRINTOGRAPHER offers such unique features as the ability ro print Language: Machine pictures directly from disk (without loading a file), spooling via our Price: $110.00 each. Hardware: Cassette recorder DOUDLETIME PRINTER package, or sending pictures over a phone line Registered owners of the S-C using ASCII EXPRESS. You can even pur graphics in your rexr documents Macro Assembler pay $32.50 Description: This terminal with our text editor software, THE CORRESPONDENT As if that wasn’t each. program allows you to down­ enough, w e've m ade It easy to put the PRINTOGRAPHER routines nghr Includes diskette with load any type of program — BASIC or machine language — in your own programs to do Hi-Res printing im m ediately during their regular and RAM card or ASCII with no conversion. It operation, without having to save screen images ro disk! versions, 100 + -page allows transfer of programs manual. W e also know you see a lot of advertising these days for a rruiy over­ between TRS-80 Mod I's, Mod whelming volume of soffware all claiming to be the best so we make Available: Ill’s, and the Color Computer. this simple guarantee: S-C Software Corporation P.O. Box 280300 Price: $19.95 IF YOU CAN FIND A BETTER PACKAGE THAN (OR ARE AT A ll UNSATISFIED 2331 Gus Thomasson Includes one tape. WITH) THE PRINTOGRAPHER WITHIN 3 0 DAYS OF PURCHASE, SIMPLY Suite 125 Author: Bob Withers RETURN THE PACKAGE FOR A COMPLETE REFUND. NO QUESTIONS Dallas, TX 75228 Available: ASKED! (214) 324-2050 Computer Shack For more information, see your local dealer, or write SOUTHWESTERN 1691 Eason DATA SYSTEMS for a free catalog If your dealer is our of stock, w e con Name: GL-PLUS Pontiac, MI 48054 ship PRINTOGRAPHER to him within 24 hours of a call ro our offices. System: Apple III Collection: The software Memory: 128K listing for Jinsam Executive REMEMBERr WITH PRINTOGRAPHER. YOU'RE PICTURE PERFECT! Language: Business BASIC (52:116) from JINI Micro­ Hardware: 132-column systems, Inc., should have printer and either read 32K for CBM w/8050, soutnuuesteRn second diskette and 128K IBM PC for BASIC drive or hard and machine language. It is data svstems drive. available from the company Description: GL-PLUS is an 10761-E Woodside Avenue • 5anree, California 92071 and participating dealers. extremely flexible and easy to Telephone: 714/562-3670 /A iefto

106 MICRO - The 6502/6809 Journal No. 55 - December 1S82 /AtCftO Hardware Catalog

Name: Guild Computei manent storage. The many is all set for precision arcade via SVA’s innovative Smart- Rack software options include inter- action. Cable. System: Apple II rup handling and 12/24 hour Price: $6.99 suggested retail Price: $695.00 Description: The Guild Rack f o r m a t s . Includes base stand and Available: comes in a choice of beautifully Price: $99.95 fastball knob. SVA Sorrento Valley finished mahogany or ash. No Includes Versaclock Available: Associates, Inc. assembly is required. It fits cartridge, full instructions. John Mathias 11722 Sorrento Valley Rd. comfortably over the Apple II Available: K-Byte™ San Diego, CA 92121 keyboard, holds one or two Maple Leaf Systems Div. of Kay Enterprises Co. Apple dealers, Micro-D, disk drives, and easily supports Box 2190 P.O. Box 456 Micro House, U.S. Micro a monitor on top. Station "C ", Downsview 1705 Austin Sales Price: $54.95 - ash Ontario, Canada M2N-2S9 Troy, MI 48099 $69.95 - mahogany (313) 524-9878 Available: or your local computer Name: Ramex 128 Guild Computer Rack retailer System: Apple II or Apple Name: Coloi Graphic II Plus 225 West Grand Street Printer (26-1192) Elizabeth, NJ 07202 Memory: 48K System: Compatible with Name: Fast Load — Fast Description: This 128K RAM (201) 351-3002 TRS-80 Models I, Save Cassette expansion board includes disk- II, HI, and Model System emulation software that fea­ 16 computers, and System: OSI - CIP or tures super-fast mounts and Name: Disk Interface/ DT-I Data Superboard n dumps from card to disk (20-25 ROMpak Terminal Description: Load BASIC or seconds for an entire 128K). Extender Description: The TRS-80 Col- System: Color Computer machine-language programs in Also available for VisiCalc is o t Giaphic Printer can create your 8K memory in less than super expander software that Memory: 4K and up anything from doodles to four- 30 seconds at a speed of 2400 gives the same super-fast Hardware: Three-foot color pie charts, as well as bits per second input/output loading and saves of VisiCalc extender cable more standard text and data rate. Customer supplies files (136K in 20 seconds). Description: The Disk Intel- graphcis. Ninety-six ASCII own tape recorder. The unit in­ face/ROMpak Extender is a characters are available in four Price: $499.00 cludes a 2K RAM fully decoded 40-pin ribbon cable that plugs colors (red, blue, green, black). Includes disk emulation which may be used to hold into the ROMpak port and ter­ Special graphic commands in­ software and memory machine-language programs. minates three feet later with a clude , reverse line management. Unit plugs directly into your 40-pin female connector to feed, change colors, change Available: CIP or Superboard n. connect ROMpaks and the line type (solid or 15 types of Omega Microware, Inc. disk interface. Gold-plated dashed lines), change print Price: $69.95 fully assembled 222 S. Riverside Plaza contacts eliminate corrosion. direction |normal left-to-right, $59.95 with cashier's check Chicago, IL 60606 Price: $29.95 plus $1 for S/H top-to-bottom, upside down or or money order. Includes male and female bottom-to-top), move without $62.95 kit connector, three feet of drawing, draw between points $52.95 with cashier's check 40-conductor cable. and draw axes. The RS232-C or money order. Name: Multi-Port 232 Description: The Multi-Port Available: serial interface is compatible Includes printed circuit 232 is a 4- or 8-port multidrop Spectrum Projects with Radio Shack TRS-80 Col­ board, cassette tape program, data router that allows merg­ 93 - 1586 Drive or Computers. self-contained R/W memory, ing or splitting of RS232, fiber Woodhaven, NY 11421 connectors, and user's Price: $249.95 optic, and current loop in any (212) 441-2807 Voice manual. Available: source/destination combina­ Available: (212) 441-3755 Computer Radio Shack Stores, Word-Com tion. It provides local network­ computer centers, and P.O. Box 1122 - 28 ing for word processors, participating dealers printers, modems, video dis­ Name: Veisaclock Park Plaza Offices plays, computers, teletypes, System: TRS-80 Color 303 Williams Ave. and instruments. Computer Name: K-Byte Stick Huntsville, AL 35801 Memory: 4K and up Stand with Price: $435.00 - 4-port Language: BASIC or Fastball Easy-Grip VISA/Master Charge Extended BASIC Control Knob. Name: Pro-Guard 8” Includes nine user-selectable Description: The Veisaclock is Description: K-Bytes unique Floppy Controller preprogrammed routes. a full-featured, highly accurate Stick Stand with the Fastball System: Apple in Available: hardware clock for the Color Easy-Grip Control Knob Memory: Up to 2.2 Park Computer Corporation Computer. It provides time of reduces hand and wrist fatigue megabytes Box 13010 day, date, month, and year and frees one hand for a more Language: SOS, DOS 3.3, Minneapolis, MN 55414 with automatic daylight sav­ skillful operation of the Pascal ings time and leap year com­ firebutton. This combination Hardware: Controls two 8" pensation. The clock is battery allows players to increase their Shugart- backed-up to allow removal physical dexterity and achieve compatible drives JAICftO from computer without loss of higher scores. By just snapping Description: This 8 " floppy data. The clock also contains the fastball onto the joystick controller resides in-line be­ 50 bytes of battery backed-up and then snapping the joystick tween Apple HI and the drive RAM for general purpose per­ into the stick stand, the player system and connects to slot 2

No. 55 - December 1982 MICRO - The 6502/6809 Journal 107 Dr. William R. Dial 438 Roslyn Avenue /AlCftO Akron, OH 44320 6809 Bibliography

Boston, William, "Here's An Easy Way to Place Orders by 86. Color Computer News, Issue No. 11 (August, 1982) M ail," pg. 19-20. Ostrom, Steven M., "Graphics and Animation for the Color An order-writing program for the Color Computer. Computer," pg. 30-42. Lewandowski, Dennis S., "The Assembly Corner," pg. 22-25. A tutorial for the TRS-80 Color Computer graphics with a A tutorial on 6809 assembly-language programming. number of demo routines. Clements, Bill, "Rockin' Through the ROM," pg. 29-30. Dawson, Don, "Color Yahtzee," pg. 44-47. Documenting the ROM routines of the TRS-80 Color A game for the 6809-based Color Computer. Computer. Phelps, Andrew, "Com m ent C om er," pg. 49-50. Preble, Laurence D., "FLEX System is Powerful Addition to A tutorial on RAM hooks, places where the program jumps, World of 80C ,” pg. 32-33. and which then jump elsewhere in memory. All about the FLEX system for the 6809 micro. McClenahan, Shawn A., "A Real Keyboard for the Color Com­ Scerbo, Fred B., "Alpine Aliens," pg. 34-37. puter," pg. 55-60. A game for the Color Computer. A hardware project for the Color Computer. Blyn, Steve, "Good Reinforcement Means You Can’t Frown at Field, E.C., "Electro-Sketch," pg. 67-69. M e!", pg. 41-46. A graphics program for the 6809-based Color Computer Tips and demo program for educational use. which allows one to draw simple schematics and save or Mir, Jorge, "Now, Make Your Own Adventure with print them. ADVMAKER,” pg. 47-53. Lee, Paul, "Educating Your Preschooler with the Color Com­ A program designed to simplify the programming of Adven­ puter," pg. 71. tures written for the Color Computer. A simple teaching program for young children using the Col­ Nolan, Bill, "Dragons Are Nice Folks, Too... Almost All 1,440 or Computer. of T h em ," pg. 62-69. Weiss, Arnold, "Cryptogram ," pg. 72-76. The program "Dragon Roller” will assist with the chore of A program to present cryptograms on the TRS-80 Color Com­ devising a dragon for your dungeon program. puter screen or to make printed copies. Harper, Jeff, "Word Processor," pg. 77-79. 89. Byte, 7, No. 8 (August, 1982) A word-processor program for the 16K or 32K Extended Williams, Gregg, "LOGO for the Apple II, the T1-99/4A, and BASIC Color Computer. the TRS-80 Color Computer," pg. 230-290. Foster, Robert D., "Monitor," pg. 81-82. Discussion of LOGO for several micros, including the A simple monitor to allow one to see how the Color Com­ 6809-based Color Computer. puter actually works. Tenny, Ralph, "Extra Tricks with Color Scripsit," pg. 84-85. 90. The Target (March/April, 1982) An accessory listing to aid in using Color Scripsit. Staff, "N ew s” , pg. 1. Aldrich, F.C., "Magic Square," pg. 87-89. An assembly which converts an AIM 65 into a 6809-based A contest-winning listing for the 6809-based Color Computer. computer.

87. '68' Micro Journal, 4, Issue 8 (August, 1982) 91. Compute! 4, No. 8 (August, 1982) Anderson, Ronald W., "FLEX User Notes," pg. 11-14. Chastain, Linton S., "Energy Monitor," pg. 116-118. Miscellaneous notes on FLEX for the 6809-based systems. In­ This program for the TRS-80 Color Computer will show you cludes a multiply program in assembly language. the effects of home energy conservation. Nay, Robert L., "COLOR User Notes," pg. 14-16. Discussion of some new items for the 6809-based Color 92. Microcomputing, 6, No. 9 (September, 1982) Computer. Avery, Mike, “ Prime Number N onsense," pg. 16. Abrams, Clayton W., "F-Mate," pg. 16-17. Comments on the 6809 versus the 6502, Z-80, or 6800 A utilities package for the TRS-80 Color Computer. microprocessors. Distefano, Tony, "Color Clinic,'' pg. 17-18. 93. Color Computer News (August, 1982) Discussion of hardware modifications for the TRS-80 Color Computer. Sias, Bill, "REM arks,” pg. 6-7. Announcement of the 6809 Achievement Award being given Commo, Norm, " 'C' User Notes," pg. 19-24. monthly to the most innovative use for a 6809. Discussion of major C compilers for 6809 systems. Gray, Don, "Number Conversion,” pg. 7-8. Watson, Ernest Steve, "Home Accounting Program — Part II,” Three listings for number conversion programs for the pg. 25-28. 6809-based TRS-80 Color Computer. A program for 6809 systems. Anon, "Color Computer Bulletin Board System," pg. 11. Hartman, William, "Diskfix9," pg. 29-36. A BBS for the Color Computer is up in the Toronto area. Call A utility for 6809-based systems. (416) 494-7001 evenings and weekends. 88. The Rainbow, 2, No. 2 (August, 1982J Donahue, Mike, "Cross-Reference Generator," pg. 15-25. Nolan, Bill, "Let's Call JO YIN To Learn ROM Call A utility for the 6809-based TRS-80 Color Computer. Technique," pg. 8. Grady, Larry, "Review of Master Control," pg. 29-33. A short program illustrating how to call one of the built-in Problems encountered with the program "Master Control" ROM routines in the TRS-80 Color Computer. and some reprogrammed sections to alleviate difficulties. Lishnak, Pat, "Sort Numeric Arrays Fast with Machine Graham, Randy W., "Modems, Terminals, and Bulletin Language," pg. 9. Boards," pg. 35-38. A bubble sort technique for the Color Computer. Using the Color Computer in telecommunications,

108 MICRO - The 6502/6809 Journal No. 55 - December 1982 COMMODORE 64

The Commodore 64 is a 6510-based color- Commodore 64 Memory Map and-sound computer that connects to a color TV via an RF modulator. 64K RAM is,standard, Address Function with 39K of it available for BASIC programs. $00-$FF Page zero, operating system storage, pointers, floating point accumulators, flags, etc. Graphics $100-$1FF Microprocessor system stack 3 character modes $100-$10A Floating-to-string work area 2 bit-map modes $100-$13E Tape input error log sprite graphics $200-$2FF Operating system buffers, tables, vectors, I/O flags, keyboard

handling 64 COMMODORE Sound $300-$3FF Vectors, tape I/O

4 programmable voices $400-$7FF Normally video memory, sprite data pointers, etc. *11 Sheet Data " O R O M attack, sustain, decay, and release $800-$9FFF Normally BASIC program space output compatible with stereos $8000-$9FFF VSP Cartridge ROM $A000-$BFFF BASIC ROM Z-80 option for CP/M $C000-$CFFF RAM RS-232, expansion/cartridge, parallel, cassette $D000-$DFFF I/O devices and color RAM or character-generator ROM and controller interfaces $E000-$FFFF Kernal ROM

Control Pori 1 Control Port 2 Cartridge Expansion Slot ?PIn Function Pin Function Pin Function Pin Function t JOYAO 1 JOYBO 1 GND A GND 2 JOYA1 2 JOYB1 a + 5V B ROMH 3 JOYA2 3 JOYB2 3 + 5V C RESET 4 JOY A3 .4 JOYB3 4 IRQ 0 NMI '5 POT AY 5 POT BY 5 CR/W E S02 6 BUTTON A/LP 6 BUTTON B 6 Dot Clock F A15 7 ' +5V 7 + 5V 7 1/01 H A14 8 GND a GND 8 GAME J A13 9 POT AX 9 POT BX 9 EX ROM K A12 10 + 1/02 L A11 11 ROML M A10 12 BA N A9 13 DMA P AS 14 D7 R A7 15 D6 S A6 16 D5 T A5 17 D4 U A4 18 D3 V A3 19 D2 w A2 20 D1 X A1 21 DO Y AO Audio/Video 22 GND z GND Pin Function 1 2 3 4 5 6 7 8 9 10 : -i . LUMINANCE 2 GND 3 AUDIO OUT _ _ _ _ 4 VIDEO OUT ABCDEFHJKLMNPRSTUVWXYZ 5 AUDIO IN

Serial I/O Pin Function Cassette 1 SERIAL SRQIN GND Pin Function / 2 1 2 3 4 5 6 \ 3 SERIAL ATN IN/OUT • 4 ,;■■■ A-1 . GND ■ ■_■_■_■_■ SERIAL CLK IN/OUT B-2 + 5V SERIAL DATA IN/OUT 5 ■ C-3 CASSETTE MOTOR 6 ' RESET ' D-4 CASSETTE READ A B C D E F r e S r.p CASSETTE WRITE User I/O iVF&V CASSETTE SENSE Pin Function Pin Function 1 'V* GND A GND 2 V- + 5V B FLAG2 3 RESET C PBO 4 ' CNT1 D PB1 1 2 3 4 5 6 7 8 9 10 11 12 5 SP1 E PB2 ■ ■ ■ ■ __■ __■ _■ __■ __■ __■ — ■ — ■ 6 CNT2 F PB3 7 SP2 H PB4 8 PC2 J PB5 9 SER. ATN IN K PB6 ABCDEFHJKLMN 10 9 VAC L PB7 11 9 VAC M PA2 12 GND N GND

4 M C O O Data Sheet #11 COMMODORE 64

5 U) Q. a> - r-. o' « 3 * O o Q) Q) N. ' § c = £ ±= CO "O ■ ! c O i « I • 5u oCO k-N >N § SJ ° i 2. 2. © 0) 8 » j£ “ ° x o O • E X . OOOOOOi-t-1-fc.t-h.t-w. cr cr co ~ "d a: © *c ■o*o*o*o££20oooooo «? © H © o S' — 3 >n-*t CCCC^—OOOOOOOO 2 2 3 3 .N T_ O’ CO O 33333300000000 ll £ a. "o c ,. q) t: a) o o ~ q. co *o 2 2 2 2 E Eot-cmcotj-ldcon ^ ^ -O E £ -Q o - - (0 C^^ © SSSS b b b b b b b b b b CD ® 0) MCD CD O o o •c "2 O O O O t t ? 1: C C c *c c O O O 3 O O Q) Q) Q) -Si CO ? a a. « ■ Q . Q . I L a o co CO CO CO Q.O.Q.Q-Q.Q.Q.Q.Q.Q. o o o c ‘o o © © © a) © .E >, ra c £ £ i co co c : CO CO C i co camaQmmcocococococococococo > > > 3 > > COCO COCO f—a: co C3 uj co co-

r-~ cd m *t m oj ■

^in(ONcooiO'-rjn'»in(DMOOiOT-Mn'r IP CM CO to hoh-hoh-hoh-COCOCOOOCOCOCOCOCOCOOJOiOiOJOJ . r- r- r*- r- CMCMCMCMCMCMCMCMCMCMCMCMCMCMCMCMCMCMCMCMCM O CM CM CM CM cococococococococococococococococococococoIOLOLOLOLOLOLOLOLOIOLOLOLOLOLOLOLOLOLOLOLO a m lo m lo

a CO ■O CO E CD O o 0) OC . o J3 lO — ■O CO CM p CVi || CO CO c o> CO 11 r . % % x ^ 5 ® CO E T3 (0 OL 11 II S.S- 8 p CO COCO COCO COCO COCO COCO COw W CO w CO «. oc x O i2 s ® s | o X>-X>-X>-X>-X>-X>-X>-X>-X l o o 2 o 1 ® >> CJ a a -o E e o ° E § CO ^ 3 o co 2> 05 ■§ § ^ -O ^ O Q) SSf o El c O o ® © O -Q E 2 r r co .tr C C . C O . f c CO o 00 c O E “ £ ® ® © a? CM CO C ° o CO ® 2 CB o «- *o "© a> cd CD §1E ® o_ y a) o E Q.y 5 2 d X o o o O 3 CO co CO CO CO CO CO CO CO CO CO CO CO CO CO CO > OC LU CQ COCO CO oc 1j _i CO > 3 II CO ^ CO CO > U) o CO 0 (/) ■o o CD 9 n - lo r r co S n- CM co ^ LO CD > CO 0) o _ Z “ COOJO-'-CMCO^LOCOh-COOJO'i-CNJCO^LO (D N CO 05 O T - cm E ■^■tJ-lOlOLOlOlOiOlOlolOlOCOCDCOCDCDCO CO CD CD CD h- r*^ o CMCMCVJCVJOiCNJCViCNJCNJCVJCNJCViCViCViCViOJCVJOJ CM CvJ CM CM OO CM CM « cocococococococococococococococococo CO CO CO CO CO CO CO ■ ■■'O’ o LOLOLOLOLOLOLOlOlOIOLOlOLOLOlOLOLOlO lO LO LO LO LO LO LO

Oi-CMCO,tlfiCDSCO O )

JMCftO Data Sheet #11 Advertiser’s Index Aardvark Technical Services, Ltd...... 76 NEW SOFTWARE ABM Products...... 24 Amplify Inc...... 62 for TRS 80 Model III Anthro-Digital Software...... 17 Apex Co...... 24 and the Color Computer Appletree Electronics...... 51 Ark Computing...... 12 ■ Church Contribution System Artsci, Inc...... IFC designed to simplify and facilitate the tedi­ Aurora Software Associates...... 83 ous chore of recording envelopes. Provides a Bedford Micro System s...... 31 variety of reports. Maintains its own data­ CGRS M icrotech...... 63 files. Only $ 1 5 0 Cleveland Consumer Computer Components...... 80 Collegiate Microcomputer...... 67 ■ Data Base Manager Com m ander...... 62 designed to help organize all your data and pro­ Compu $ense...... 49 vide you with meaningful reports. Add or delete C om puTech...... 28 any information. New files can be created and Computer Mail Order...... 56-57 old information transferred. Only $150 Computer Science Engineering...... 89 ■ Single Entry Ledger Computer Trader...... 99 designed as an uncomplicated control of Datamost, Inc...... 34, 90, 92, IBC finances for home or small business. Add, de­ Decision Systems...... 67 lete, edit at any time. Compatible with Digicom Engineering, Inc...... 96 Digital Acoustics...... 84 DBM. Only $ 9 5 D&N Micro Products, Inc...... 21 Write or phone for complete software price list. Eastern House Software...... 39 Educational Computing Systems...... 10 Execom Corp...... 40 VISA' Gim ix, Inc...... 1 Dept. Ml 2 Gooth Software...... 51 2457 Wehrle Drive Hayden Software...... 36 Amherst, NY 14221 Hudson Digital Electronics Inc...... 68 716/631-3011 Human Systems Dynamic...... 41 Interesting Software...... 95 Leading Edge...... BC Logical Devices...... 99 Lyco Computer...... 6 SeaFORTH for the Apple computer MICRObits (Classifieds)...... 53, 86, 87 MICRO IN K...... 25, 31, 41, 44, 45 Is a consistent structured operating system providing the advanced programmer with the tool to easily develop Micro M otion...... 28 programs from machine language to high level compiled Micro Signal...... 50 applications. W ith SeaFORTH, the edit-compile-execute- Micro-Spec, Ltd...... 40 edit cycle is measured in seconds, not minutes. Micro-Ware Distributing Inc...... 96 The integrated SeaFORTH package includes: Midnight Software...... 49 • Editor • Disc I/O MMS, Inc...... 25 • Assembler Modular System s...... 83 • Hi-res Graphics Orion Software...... 18 • Transcendental Floating Point Perry Peripherals...... 73 • Command Line Input w ith Editing • Detailed I 50 Page Technical Manual with Privac, Inc...... 2 Comp/ete Source Listing! Pterodactyl Software...... 105 Implemented as a true incremental compiler, SeaFORTH Quentin Research...... 29 generates machine code, not interpreted address lists. S G C ...... 4 SeaFORTH’s direct-threaded-subroutine implementation SJB Distributing...... 64 executes faster than interpreted address-list versions. Skyles Electric W orks...... 46, 58 Apple SeaFORTH requires a 48K Apple ]( + , with DOS Softel...... ••.... 72 3.3. Manual and copyable disk are available fo r only Software Farm ...... 33 $100.00 Software Options...... 31 Compatible SeaFORTH for the AIM requires a terminal Southwestern Data Systems...... 106 and is only available in EPROMs. Manual and EPROMs $150.00 Spectrum System s...... 83 Spies^ Laboratories...... 43 Manuals available, separately, fo r only $30.00 A ll paces include UPS shipping. Star M icrom cs...... 8 VISA o r M ASTER C H A R G E we/come. Tau Lambda...... I l l

(Dealer Inquiries W elcome) Unique Data System s...... 102 Unique Software...... ,...... 96 TAU LAMBDA Universal Data Research...... I l l P.O. Box 808, Poulsbo, Washington 98370 Victory Software...... 20 (206) 598-4863 XPS, Inc...... 101

Apple ][ + and AIM are registered trademarks of MICRO INK is J Hit responsible tur claims made by its advertisers. Any Apple Computer and Rockwell complaint should be submitted directly to the advertiser. Please also send written notification to MICRO.

No. 55 - December 1982 MICRO - The 6502/6809 Journal 111 Next Month in MICRO January: Simulations/Applications/Math

• Apple Math Editor — This Apple Pascal program • Discrete Event Simulation on the Apple — An allows you to construct, edit, and print explanation of techniques used in simulating real- mathematical formulas easily. world situations on a computer. An example program involving the flow of bank customers is • Sun and Moon — This Applesoft program presented. produces a high-resolution graphic simulation of the apparent orbits of the sun and moon with Department Highlights respect to the Earth. Apple Slices • Measurement ot a 35mm Focal Plane Shutter — PET Vet The program SHUTTER uses inexpensive From Here to Atari hardware to measure the accuracy and CoCo Bits repeatability of a focal plane shutter commonly Reviews in Brief found in 35mm cameras. Although written for the Software and Hardware Catalogs Atari 800, the program can be modified for any computer if you have access to three input pins.a ground, and the + 5V power supply. Plus... VIC Hi-Res Graphics Explained • Methods to Evaluate Complex Roots — A Dealing with Atari’s New. Languages standard procedure to compute complex roots of Microcomputer Design of Transistor Amplifiers polynomial equation. More 68000 Instruction Set Tables

More MICRO for Less Money 20% OFF When You Subscribe Your money goes farther when you sub­ But on the newsstand — if you can locate the scribe. During the course of a year, when you issue you want — you pay $30.00 a year ($2.50 subscribe, you save 20% (in the U.S.). a copy). Pay only $24.00 ($2.00 a copy) for 12 monthly Special Offer — Subscribe for 2 years ($42.00) issues of MICRO sent directly to your home or and get 30% off the single issue price. office in the U.S. Subscribe to MICRO today.

MICRO 34 Chelmsford Street Subscription Rates Effective January 1,1982 P.O. Box 6502 Country ______Rate______Chelmsford, MA 01824 United States $24.00 1 yr. Please send me MICRO fo r __1 y e a r___2 years 42.00 2 yr. NOTE: Airmail subscriptions accepted for 1 y e a only. r Foreign surface mail 27.00 Europe (air) 42.00 Check enclosed $ ______Mexico. Central America. Mid East, Charge m y ______VISA account N. & C. Africa 48.00 ______Mastercard account South Am.. S. Afr., Far East, Australasia, New Zealand______72.00______No. ■ ______* Airmail subscriptions accepted for only 1 year. Expiration date.'" v ______For U.S. and Canadian 2-year rates, multiply by 2. Name -' ■- ______Address, y'.W- Job T i t l e ' ______City/State ______Z i p _____ Type of Business/Industry*

1 1 2 MICRO - The 6502/6809 Journal No. 55 - December 1982 By the Cardmaster—original Cribbage and 4 Solitaire gamesl

When you’re tired, upset, bored ... in need of a chal­ On a scale of 1 to 10. these card stars rate a big 11!. ....for. lenge, or just relief from the ordinary there's nothing to com­ sheer enjoyment and unmatched value. Think of it, five of the pare with the fun and involvement of Solitaire or Cribbage. Cardmaster’s best games at the price you’d expect to pay for Within seconds you’ve forgotton the world and are absorbed just one! It includes original Cribbage, with your strategy in the play of the cards. And the brilliant way the Cardmaster against the Apple... plus 4 Solitaire games: Klondike, the all jJ programmed these games has taken out the effort and dis­ time standard, in 2 versions (1 or 3 cards at a time), exciting tractions but left in all the fun and challenge. Picture Frame and the challenging Pyramid! If you or your family like cards at all, this is the one disk you must get!

O nly $34.95 for the Apple II* at your computer store or:

VISA/ MASTERCARD accepted. S2.00 shipping/handling charge. (California residents add 6 '/z% sales tax.) 9?48 Cozycroft Ave., Chatsworth,CA913ll (213) 709-1202. * Apple II is a trademark o f Apple Com puter, Inc. THEPRGWRITERCOMEIH (And It Cometh On Like CangbustersJ

Evolution. It’s inevitable. An eternal verity. Just when you think you’ve got it knocked, and you’re resting on your laurels, some­ body comes along and makes a dinosaur out of you. Witness what happened to the Centronics printer when the Epson MX-80 came along in 1981. And now, witness what’s happening to the MX-80 as the ProWriter cometh to be the foremost printer of the decade. SPEED M X -80:80 cps, for 46 full lines per minute throughput. PROWRITER: 120 cps, for 63 full lines per minute throughput. GRAPHICS MX-80: Block graphics standard, fine for things like bar graphs. PROWRITER: High-resolu- tion graphics features, fine for bar graphs, smooth curves, thin lines, intricate details, etc. PRINTING MX-80: Dot matrix business quality. PROWRITER: Dot matrix correspondence quality, with incremental printing capability standard. FEED MX-80: Tractor feed standard; optional friction-feed kit for about $75 extra. PROWRITER: Both tractor and friction feed standard. INTERFACE MX-80: Parallel interface standard; optional serial interface for about $75 extra. PROWRITER: Parallel and serial interface standard. WARRANTY MX-80: 90 days, from Epson. PROWRITER: One full year, from Leading Edge. PRICE Heh. heh. Distributed Exclusively by Leading Edge Products, Inc., 225 Turnpike Street, Canton. Massachusetts 02021. Call: toll-free 1-800-343-6833: or in Massachusetts call collect 1617) 828-8150. Telex 951-624. LEADING EDGE For a free poster of “Ace" (Prowriter's pilot) doing his thing, please write us.