micro 6502 journal july 1980

84
8/3/2019 Micro 6502 Journal July 1980 http://slidepdf.com/reader/full/micro-6502-journal-july-1980 1/84

Upload: cubemanpdx

Post on 06-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 1/84

Page 2: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 2/84

~~~~~~~~~~~~~~~~~~~~~~~~~~~*~ PLUG IN AND GO! ~~ Instant Video ~~ Theonly video board that works directly with the AIM or SYMMonitor, Editor, ~tt BASIC and Assembler. Simply connect to your system with our cable ~

~ assembly, initialize the ASK software, (available in EPROM) and all output ~t\ will appear on the monito.r. It is very easy to use with most KIM programs. '~

t\ VIDEO PLUSTM...$245 ASK EPROM....$45 ~~ Cable Assembly ....$15 See special offer below. ~

~ Total Expansion ~~ Many companies can sell you a RAM board! ~~ Many companies can sell you an EPROM board! ! )1 Many companies can sell you an EPROM Programmer! ~

::. Many companies can sell you a Prototyping board! i : t; Many companies can sell you an 1/0 board! t . t

~ Only The COMPUTERIST® offers all of these features on one high ~t . t quality board for less than others charge for a plain RAM board! Direct con- ! )~ nection to your AIM, SYM, or KIM via our Cable Assembly. t . tt) DRAM PLUSTM With 16K RAM.•.. $295 With 32K RAM.... $395 i : tr ) Price includes everything except EPROMs. r )

~ "Special Offer Below" ~A.. Mention MICRO. The 6502 Journal, when ordering a Cable Assembly with a VIDEO PLUS or .A.

'j,.j DRAM PLUS and you will receive the Cable Assembly for only $5, a savings of $10 off the ).._J

r ) regular price. Offer expires October 31,1980. 't)

~ Interface/Experiment ~t\ The AIMISYMIKIM I/O Board provides connect_ions for powel, tty, cassettes, ~

and includes relays to drive two cassettes fOI youl system. And, as discussed A

r ) in 'Programming and Interfacing the 6502, with Experiments' by Marvin L. ).._J

~ DeJong, contains switches and LEDs to perform the experiments. ~

r ) ASK I/OTM...$50 Assembled and Tested ~~ ~t\ Write tor your Free 1980Catalog which ShippingandHandling ~.A. describes these and our other products Priceslor u.S.andCanadaonly. A

)..,J for the AIM. SYM. AND KIM. in great other countries 10%higher. }...,f

r ) detail. Pricesdo not Includeshippingandhandl· it.A. DealerInquires invited. Ing.U.S.S3/board; Canada$6Iboard;other A

).4 write for rates. W

~ ~ ~ ~.~ J~(!)~~(!!}1J~(3~~1J ® gr ) - 34 Chelmsford St., Chelmsford, MA. 01824 617/256.3649 ! l 'r ) ~ ~ t . t r ) ~ ! ) ~ t . t r ) t . t r ) ~ ~ r ) r ) r ) r ) ~ r ) r ) i : t r ) ~ ~ r ) ~ ~ ~ ~ ~ ! l ' ~ ~ ~ ~

Page 3: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 3/84

APPLEIISOFIWAREFROM Ol\I..LINE SYSTEMS

PADDLE-GRAPmcs:The most powerful Hi-Res graphic development package available. Upper/lowercase maybe drawn on the Hi-Res screen in any size, direction or color. Pictures may be sketched and filled in with anyof21 colors (must beseen to believe I). Ashape may be constructed automatically from any object appeadng on the Hi -Res screen.

48K Applesoft/Machine I.anguage839.9S/disk

TABLET-GRAPmcs:All of the capabilities of PADDLE-GRAPHICS extended for use with APPLE'S GRAPHICS TABLET.

48K Applesoft/Machine Language849.95/disk

m-RES ADVENnJRE #1:

Your APPLE computer becomes your eyes and ears as you enter a spooky old mansion in search of treasure.

You el irect it in English to move you through the house which is portrayed in full HI-RES GRAPH! CS. You arein complete corntrol as you open caabtnets, smash vvalls and manipulate any items YOll mightfmd. Danger iseyer present as you find your friends being murdered one by one. This game will definitely challenge yourImagtnatron. French version available upon request.

Machine Language for the Apple II or II plus 48K8H.9S/disk

SIiEETSUODr:Areal-time Hi-Res graphic simulation of the sport of skeetshooting. This game has all the sounds, action, andexcitement of the real sport as well as the official firing positions. One to five players may compete.

Machine Language for the Apple II or II plus 48KSl.9.95/dlsk

TRAPSHOffr:One to five players compete at the sport of trapshooting. Fast action with many skill levels Including adjustableshotgun spray make this game a true challenge.

Machine Language for the Apple II or II plus 48KS14.95/dlsk

COMBINATION:1II ~RES ADVENTURE and SKEETSHOOT both on disk.

Machine language for the Apple II or II plus 48KS37.50/dlsk

Available at your local computer store.

ON-LINE SYSTEMS772 N. HOLBROOK ST.SIMI VALLEY, CA 93065

805-522-8772DeaIerlnquiries In,rfted

All orders shipped same day.Software may be ordered directly by calling/writing: 805~522-8772. Orders may be: COD/Cl IECK/~lASTERCr IAHGEj\ lSA. Add ~ I shipping_

Page 4: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 4/84

AIM 65 SUPPORT PACKAGES

HARDWARE

8K MEMORY EXPANSION CARD2114 RAMSCOMES READY TO USE ON 4K MACHINESINCLUDES 162114·300 N. SECSSTATIC RAMS $178.00*

3K PACKAGE OF 2114 RAMS FOR

INITIAL EXPANSION OF 1KMACHINESINCLUDES 6 2114·300 N.SECS.STATIC RAMS $48.00*

16 CHANNEL ANALOG TO DIGITALFOR 8 BIT PORT0.5% ± 1 BIT ACCURACY $168.00·

SEND $1.00 FOR A COpy OF

LINKAGE GENERALA Newsletter supporting AIM 65 Users

Articles Requested

P. O. BOX 641ORANGE, CA 92666

(714)771-4038

'SYSTEMS DES IGN

SOFTWARECASSETTES REQUIRING 4K MACHINE

WITH 8K BASIC

BASIC TECHNIQUESSELF TEACHI NG FOR TH E BEG INN ER $9.00"

BUSINESS LIBRARYINCLUDES:RISK ANALYSIS

INCOME STATEMENTINTEREST RATES ANALYSIS

BUDGET $11.50*

MATH LIBRARYINCLUDES: F RATIO

CORRELATION COEFFICIENTCURVE FITDETERM INANTSDIFFERENTIALEQUATIONSDERIVATIVE $9.95*

GAMES LIBRARYINCLUDES:CRAPS

CHECKERSSTUDENTBLACKJACKTIC TAC TOE $9.50*

CASSETTES REQUIRING 1K MACHINE

UPPERCLOCKS

MEMORY SOFTWARE

COMPATIBLE WITH BASICSPECIFY MEMORY SIZECOMES WITH UTILITIES AND

USER TIPS $8.30·

·CA. res add 6% sales tax,

Page 5: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 5/84

r

July 1980Issue Number 26

---StaffEditor/Publisher

Robert M. TrippAssociate Editor

Mary Ann Curtis

Assistant EdltorlAdvertising Manager

L. Catherine Bland

Circulation Manager

Carol A. Stark

Technical Assistant

Theresa MacMaster

Art/Advertising Coordinator

Terry Spillane

Comptroller

Donna M. Tripp

MICRO"' Is published monthly by:MICRO INK, lnc., Chelmsford, MA 01824

Second Class postage paid at:Chelmsford, MA 01824

Publication Number: COTR395770Subscription rates: U.S. $15.00per year

Foreign surface mall $18.00per yearCentral America air $27.00per year

Europe/Japan air $33.00peryearOther airmail $39.00per year

For back issues, subscriptions, change ofaddress or other Information, write to:

MICRO, P.O. Box 6502,Chelmsford, MA ()1824

or call6171256-5515

Copyright Cl1980by MICRO INK, Inc.All Rights Reserved

5 EditorialA MICRO Potpourri

by Robert M. Tripp7 SYM-1 Memory Search and Dlspla·y

Two useful monitor enhancements for the SYM-1by Nicholas Vrtls

13 Sorting RevealedAn extremely lucid discussionldemonstration of sorting

by Richard C. Vile, Jr.

31 Hello, WorldAdding a cheap analog interface to the PETby John Sherburne

37 Zoom and SqueezeTwo useful editing functions for the Apple /I

by Gary B. Little42 OSl's Small Systems Journal

Thenew Sixteen Pin 110Bus and other itemsby the OSI Staff

47 VISA-KIM

52

53

A super program for understanding the KIMby Joel Swank

Microbes and UpdatesChallenger II Communications

Use the OSl as a complete terminal systemby Peter Koski

LelterboxSuggestions for an improved 6502 microprocessor

by Micro's ReadersAIM-55 File Operations

A way to add file operations to the AIM BASICby Christopher J. Flynn

MICRO Club CircuitInformation about 6502 oriented clubs

by Mike RoweThe MICRO Software Catalog: XX I I

Continuing software product announcementsby Mike Rowe

6502 Bibliography: Part XXIIContinuing coverage of 6502 related periodicals

by Dr.William R. DialAdvertisers' Index

60

61

71

75

79

Page 6: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 6/84

Attention

BARGAIN HUNTERSReceive Hundreds of Classified Ads

Uke These Every Month

FOR SALE: Heath H9 video ter-minal, excellent condition, $175 or

offer. You ship. [214J 962-4484

COMPUTER AUTOMATION16; 16 k-word core memory,PF-R. Modified Mod. ASR-33Manuals utilities, assemblers

't'lon boards - 16 bit 1/0many op dO . 16 bit I/O Asynch rna emriver, ' . /0-., 64 bit output, 10 bit A

contr d n-O/A. Fairly complete. ocurne

. Up and running III Fort.ran.tatron. 51000Not much more than lTV at .Herb Sauer, 303-494-8724,

HEATHKIT H-11/DEC LSI-11system, 32K Byte storaae, reader 1punch, video terminal, completesoftware, Cost S4SOOassembled,$3500 kit, Like new. Sell for $2250,305-962.6677, 2056 Griffin Rd., Ft.Lauderdale, FL33312.

COMPUTER SHOPPER, the new buy, sell, and tradepublication, is ready to help you with the latest infor-

mation on personal, small business and large-systemcomputers , accessories and software.Each ad-packed issue is full of bargains you are

looking lor. Included are ads from individualsthroughout the United States who are selling theirgood, pre-owned equipment just so they can trade-upto new equipment cornlnp on the market.

But, COMPUTER SHOPPER'S bargains won', beyours unless you subscribe. This useful, money-saving publication can become your way to com-municate with other buyers, sellers, and traders all over the nation.

Whether you are a hobbyist or a part-time user, COMPUTERSHOPPER will put you in touch with the nationwide computermarketplace in time for you to take advantage of bargain oppor-tunities.

Have something to sell? A COMPUTER SHOPPER subscr iber pro-

bably wants to buy It.Looking for a part, component or even a complete system? A

COMPUTER SHOPPER subscriber probably wants to sell it.

COMPUTER SHOPPER is THE marketplace for anything in com-puters and is read by thousands of people who are ready to buy.

COMPUTER SHOPPER offers a unique format in which classifiedads are categorized for fast location of specific nerns. Combiningthis with low individual ad rates - 10 cents a word -

makes it the ideal place for buyers and sellers to com-municate. And, its mix of individual, dealer, and

manufacturer ads enable subscribers to find whatthey want at the best price possible.

COMPUTER SHOPPER will work for you in otherways, too. If you are just thinking about gelting intocomputers, it can help you learn product availabilityand prices before you make a decision. And, throughthe timely ads, COMPUTER SHOPPER will keep youabreast of changes in the market which could createbargain opportunities for you.

BUT COMPUTER SHOPPER cannot work for you unless yousubscribe.

Want to look us over first? We'll give you your first issue FREEand then bill you lor the next 12. If you are not convinced COM-PUTER SHOPPER suits your needs, just write "cancel" on the in-voice and return it.

And, to let COMPUTER SHOPPER start working for you right now,with a paid subscription we'll also give you a FREE classified ad to.sell your pre-owned equipment or to find equipment you want.

If you don't need to use the free classified ad now, use it anytimeduring your subscription.

Subscription: $10/year, 12 issues plus your firs! free one. Bankcards accepted. Money back guarantee.

~ The Na.tionWide Marketplace for Computer E.qulpment

~ COmpUTeR s,..,oppeRP.o. Box F22 • Titusville, Florida 32780

Telephone 305-269-3211

Page 7: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 7/84

A MICRO potpourriWhile cleanlt'lg out my desk, as part oJ adding offh;:e

space to MICRO, I uncovered a vast cache of notes that Ihad written to myself: -li tt le thlFlgS which I wanted to passon to MICRO's, readers.Canadian Mall: There seem to be problems with theCanadian mail service. In recerrt months we have beenreceiving mere reports of non-delivery from our northernneighbors than tram all of the-US subscribers. We nope

that the servlce gets better, and for now can only counselpatlence.i .f you magazine does not reach you by tfle mid-dle of the month, then complain to your postal service.Mailing Date: MICRO Is always In the man before thefirst of the-Issue month, The actual mailing date varies asa function of the mont!:!, but is gellerally I>etweenthe 24thand 28th. The Second Class mail, in the US, Is sURPosedto get to ail p.oin~sw[thin a week.Limerick Contest: Since I have been declared ineligibleby my staff to officially enter the MICRO limerick corttest[a most un1;:!ir rule I 'think], I am going toe-xce-.:clseediforfaJ perogatlve, If'hot editorial Judgment and presentIt here!

A clever. programmer named Mike Rawe,SajiJ, "I get double use 'rom each MICRO.First I learn wha~ to doWith my Sixty-Flve-Oh- TWO,Thea I use- it to paper train my crow!

[Now, don't you Just know that you can do better thanth~t1 Only ·a few weeks left to get your entry In.}Mike Rowe: The nrst Issue of MIC"RO,In October 1971,Gontalned the following 'biographical' notes about Mlk~BQwe: 'He prefers hexa~ecimal notation since he haseight fingers 'on each hand', and Is a 'Computer censu 1-hint forfheStarship Enterprise' . Apparently some readersmissed the first Issue, andlof have Dever said fhe nameout loud 'and discovered the hidden meaning. Mike RoweIs, of-course, the name used to Indicate thai an artlcLeha~b e e n -p~epared by ene or more members of the MICROStaff from material supplied by, others, The SoftwareCatalog is an example. We have been surprlseCl at theamount o-f man we get addressed to Mike Rowe-.Since

1977 we haye dlscove.red a, least three others: MichaelRoe - a subscriber; Mike Rowe Productions - also a

suHscrlber; and Mike Rowe who,! according to thenewspaper, l:s the best stock car driver In Maine. If youhappen 'to know of any other 'Mike Rowe', wewould like tohear about tUm.

""leRO AdVertising and Advertisers: Advertising Is veryImportant to MICRO for two reasons: first, it providessome very important and11mely information about what ISavailable, and, second! It supports the mag~zlne. Thereason that MICRO has been able ie grow trom 28 to 84pages, has be-endue to ttle terrific support. of the adver-tlsers. We hope this will continue to grow. You can l;1eJp.All it takes is informing an advertiser that you 'Saw It inMICRO'. That 's .all, Advertisers do not generally have anysimple w"ayto determine the effectiveness of a partioularad. Feedback from the buying public Is the most effectlveway of felling an advertiser that hts ad Is working. So,when you place an order, please mention MICRO,Read.- Feecfback: ThS'advertisers are not the only peo-ple Interesfed in hearing from y0U. Tbe MICRO staffWelC0mesreader feedback. What types of malerlal do youlike best? Which articlae hav(iIbeen most uS4[lful?Do YDUlike the format? Ho~ about the three-hole punch? Whatnew featur,es would you like to see? Let (IS know, Wewantto keep MICRO serving Its rsadersJllp effa~tlveIY.

Writing for MICRO: MICRO pays-top rates for artleres_ Uyou have good 6502 related Ideas, pro.grams, etc., con-slder wri ting at>out them for MIGflO. We have prepared aMICRO Writer's Guide to help. For your G O P Y,simply sel1da se~f-add/essed [we'll provide the stamp] eflVelope reoq~estlng the gurde.Free MICRO: If YQlJare a subs~rlber and know someone-who should be receiving 'MICRO [like the guy Who keeps'borrowing' your eopy], send us his name and addressalong with your subscription label. We will seRd one sam-ple copy. Since this does InvQlvea faframounf of time andexpense, we would appreciate your only sending Innamesof people who either owri 6502 equipment or who you feelate seriously Interested In the 6502 worl lil. This offer ex'pires August 15, 1980, so do It now.

~1t1,~

Graphic Data Retrieval Systems

This month's cover shows one type ofGraphic Data Retrieval System: a firedepartment system to keep track of theequipment available tor meeting variousemergency condllions. While the con-cept Is not new or specifiC to micros, it isa technique which can have broad ap-plication and which Isquite suited to thedisplay oriented microcomputers.

This Is a verydramatic example of thetechnique. Many other less dramatic butnonetheless important uses can be con-ceived for GDRS technique. The flow ofmaterial through any process, from anoilpipe line to aauto production facility, canbe tracked and displayed. The operatorcan 'zoom In' onanyparticular part of theoperation which is of Interest. The oro-gram can automatically display whateverportions of the process are most critical

at any time.GDRS basically combines graphicdata, such as a map, with alphanumericdata. In the coverexample, a map of thesection of the ci ty which contains anemergency condition, in this case a fire,is displayed to quickly show the operatorthe locations of relevant resources: a firestation, hospital, police, ambulance, etc.The status 01each potential resource Isgiven as alphanumeric I.nformation. Asthe operation progresses, this informa-tion can be continually updated eithermanually via. a keyboard 01, in a fancysystem, automatically via variousdevices which would track the vehicles.

Emergency MICRO

Cover ArtistTerry Spillane

One of the nice aspects 01performinga GDRS task on a micro IS that thegraphics do not generally haveto beveryfancy. A simple set of charactergraphics: horizontal, vertical, anddiagonal Iines, can usually provide all ofthe detail necessary.

TheGDRSmethod can beused to solvemany different types of problems. Thinkabout it application In your areas of in·tsrest. It can bean effective and efficientmethod.

Page 8: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 8/84

Expand~ththebeRFOB GBAPHICB ... lt's MIPLOT,

the intelligent plotterDestgn.ed. for s tra.1ght forward lnterfBCEI to

tmy miarooomputer that outputs tho ABCllcode, MIPWT can oven be used by operatorswith no plotter experience.

• IncorporateS pre-p.'Ogt'ammed "lnteWgem"run"etoos requ!red for producing graphs anddrawmgs

• SoUd a nd broken line t;ypes can be epeeu ted• Bul lT.In cttaraoter genel '8tO!' for leuers, numbers

and~bols• CharllCtGf"fl CAn be enlw'ged and rotal&d to lOW'oneruauons

• Special prin te r mode output s cbe rac ter caia as-Is• UIleScommonly l i. va ll ab le hard I lber-ti p pens• Maxlmum p IC, sp eed approXlIn&e1y 21nciles pars e c o n d

• Bull e In se lf -ooBL mode

FOB CHABACTEB GElIlDBU'IOll ... It's the newHALPCG 6500Programmable Character Generator

At 188t, avo .1 lable exolUSively a .t SystemsFormulate Corporation 18the HAL PeG 6500,a programmable oha.raoter generator foryour PET. With the PCG 6600, you canprogr8JIl 64 of your own.charec te rsmto the13j{Stem.. Other features:

• Bull\. In CB2 8< ,y \eround ampllJier

• l nt er fe ce to P E'l'/C BM w t1 .h 2 4 pi n H OMS• User p rog ram not required fo r d lspla, ylng

characters (only for programming Lhem!• Pul ly tndependenr. o f use r mamo, ry• All software needed to Wt 'M programs ustng

programmed characters lneluded

•••

1 . 11PI.Ol'It ; w=noo (DrporaLIon

Only $1,800at 8yBteIDB Formula.!<! Corporation

FOB MOBE IIBMOay ...Whet.hor for Apple, TR8- 80 , P ETor 8orcere,

you'll l1ke the reliability and price on th1e16K Dynamlo RAM Cera.mio Packa.ge byFq11tsu.

Only.eoat 8y8t81DBFormulate CorponltlOn

••

••

••••

*For more informa.tJon or to order by phone: (416) 326-9100

Wba!eIIar yow" 1!YBt.e",or oyBt8m 8Xp8I lBlon needs , g lVO! l,ys tems Formula lB a csn, we w1lI be h&ppy to &eOOo.longmore 1n(0rmatlOn to you or tolmyour phone ardar. w ehonor lIlasIer Cb& rC e .VIsa or w1lI 8h1pCOD.

_ Hour s: 1l0ndl ly·Saturda, y. 10'7.!I urnl8y iae

Page 9: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 9/84

SYM·1 Memory Search and Display

~~~~~~~~~~~~~~~~~~Add these two new commands to your SYM Monitor.They make it easy to locate any string in memory andprovide a means to display data as ASCII when desired.~~~~~~~~~~~~~~~~~~~~~~

Here are two more extensions forthe SYM monitor. They are

relocatable, and do not use anymemory other than that normally us-ed by the monitor. I decided to writethese two software "tools" because Ikept needing them and no one elseseemed to be writing anything closeto what I needed. The memory searchroutine was written because I need·ed some easy way to find locationsin programs after I have relocatedthem. I don't have a printer. so after Ihave made a couple of patches andmoves, it is sometimes. difficult tofind a particular place in the pro-gram. The command has also turned

out to be helpful when you have tofind references to a particular ad-dress so you can change it, as I hadto do when I got the new monitorROM.

The memory display routine wasdeveloped because I needed someeasy way to look at messages,source lines, and other charactertype data in memory. This wasespecially true when I started work-ing on a Tiny Basic IntermediateLanguage Assembler some time ago.The SYM monitor just doesn't have

any way of displaying memory ascharacters instead of hex digits, andI have trouble recognizing ASCII astwo hex digits.

The memory search routine willhandle up to an eight byte searchargument. This is normally entered inhex after the prompt from theroutine. If you want, you can enter aslash instead of the two hex digits.This indicates a "wild" character to

July 1980

the program. The definition of a"wild" character is that the position

is counted, but any character is avalid match. This does not mean thatyou can't search for a slashcharacter. The program will look for aslash if you enter it in hex as $2F.This means that the search argu-ment "2010C" will find the first oc-curance of any jump to a subroutineon page $OC, but "202FOC" wouldonly find a jump to the subroutine at$C2F. This neat little programmingtrick is accomplished with a "byteused bit map" (how's that for a threedollar phrase?). In simple terms,each bit is SCPBUD corresponds to

one byte in SCPBUF where thesearch key is saved. If the bit is on, itindicates that a "wild" character wasentered in that position. A zero in-dicates a normal character. Thedistinction between a slash and $2Fis actually made by INBYTE. Theslash is non-hex, so INBYTE returnswith the carry set. If the overflow isset, then the second character wasthe non-hex and it is an error. If theequal is set the character was thecarriage return, and the programuses that to mean the end of thesearch argument. Finally, if none ofthe above is true, then the characterthat was entered is compared to aslash (INBYTE conveniently leavesthe character in 'A'). For the slash,the carry is rolled into the bit map,setting the bit to a one. For normalhex bytes entered, the carry is clearon return from INBYTE, so when therotate is done, a zero Is se t Into thebit. The only other check made on ln -put is to watch for more than eightbytes being entered. The beeper is

Nicholas Vrtis

beeped, and the character is ignoredonce eight have been accepted.

To perform the search, the pro-gram moves the bit map to a workarea, since it will be destroyed in theprocess of the search. Each time wewant to make a comparison betweenthe key and memory, we first rotateone bit from the bit map work area in-to the carry. If the carry is set afterthe rotate, then the bit was on, andthe program just pretends it got anequal compare. If the carry wasn'tset, then the search byte is com-pared to memory for an equal. Sim-ple, isn't it? Each time an unequal is

found. the search address is in-cremented, and the search startsfrom position one of the key again.

Once the search argument isfound, it is simple to output the ad-dress and then the data frommemory (not from the search key,since it has the slashes in it).

There are a couple of not so ob-vious points to mention. The inputsearch key, the key length, and thebit map are retained in the SYM RAMscope buffer area. This means some

good news, and some bad news. Thegood news is that provided you don'tdo any output to the LED's, the argu-ment will still be there the next timeyou use the routine. Since the U4 op-tion with no parameters enteredstarts at the last used location plusone, using this option and entering acarriage return Immediately for thesearch key will find the next oc-curance of that string. The bad newsis that the routine won't work if you

26:7

Page 10: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 10/84

are using the hex keypad for entry.Actually, the three parameter optionwill work since it doesn't do any 1/0until after it has hit the end ofmemory, or found the string. The pro-blem is that any time you do outputto the LED's, that character also getsrotated into the scope buffer area, sothe process of entering the searchkey shifts it over. If you are using the

hex keypad and want to use thesearch routine, you will have to supp-Iy a 10 byte work area someplaceelse.

Finally, the value of "end ofmemory" is set to $OF at location$211 for my 4K system. If you havemore or less memory, set this to thehighest page number in your system.

As I mentioned earlier, the memorydisplay routine is primarily designedfor displaying ASCII type intorma-tion. It has also turned out to be

somewhat useful as a normalmemory display since it displaysmore bytes per line than does theVerify command. Another advantageis that it ends with the "OLD" ad-dress pointing to the next locationafter the last one displayed. Thismeans that repeated calls to thecommand without any argument willcontinue displaying memory.

The display format is a typicaldump format. Sixteen bytes of dataare displayed, first in hex, and thenas alpha. Before the alpha is output,

though, it is checked to make surethat it is a displayable character. Aswritten, this program translates con-trol characters, lower case character,and anything with the high order biton, to an underscore. On some ter-minals this will display as the back-arrow. The purpose is to occupy aposi tion with displayable charactersso you can count how manycharacters in you are from the startof the line. If your terminal willdisplay lower case, you may want tochange location $30C to the highestdisplayable character for your ter-

minal (lower case z is $7A). I wouldnot recommend by-passlnc thetranslation of the control characters.At best, most terminals don't evenprint a space in their place, and atworst, they do unexpected thingswhich make reading the line difficult.

For those of you who have put upthe other monitor extensions frommy article in the August issue, these

26:8

routines can be added very easily.Simply change the address in theJMP U1 instruction that was at $237in the listing, to a JMP U4 where U4is the address that the new routinesare moved to. Then change this pro-gram at $2AE to insert a JMP U1 inplace of the SEC·RTS·NOP, andpresto!-you have two new exten-sions. Both routines U4 and US arerelocatable, so you don't have tobother running them throughRelocate. Just block move them towhere you want them. I moved themto the front of the Execute setups soI wouldn't have to learn a new star-ting address.

For those of you who didn't readthe article, I will review some of thecomments about how to extend theSYM monitor. First let me say thatthese routines are relocatable, withthe only provision being that theymust be in the same relative posltlon

to each other, or the branch at $268will have to be adjusted. If youdecide to only use U4, change theabove location to a SEC-RTS ($3860).The US routine will operate by itselfwithout any changes. As I mentionedbefore, these routines use only thosememory locations normally reservedfor the monitor, so they shouldn'tconflict with your existing programs.Nor will they affect the operation ofany of the SYM commands, with theexception that the 'OLD' addressthat is referred to in the manual. willget changed by these commands in

additon to the standard commands.

The SYM monitor vectors all"unrecognized" commands via aRAM vector located aat $A66D. Themonitor considers anything it isn'tprogramed for as unrecognized.Normally, $A66D points to an SEC-RTS sequence. This indicates to theroutine ERMSG that the ER xxmessage should be printed. By theway, the xx is the hex digits for whatis in 'A' when ERMSG is called, sothis makes a handy error routine foryour oun programs. SinceSYNERTEK was nice enough to putthis vector in Ram, it can be chang-ed. Specifically in our case if it ischanged to poi nt out the starting ad-dress of U4, the monitor will branchthere instead of to the SEC·RTS. Ifyou will note, these routines ex-ecute and SEC·TRS whenever theyencounter an error, or the commandis not the cash value for U4 or US.For a normal return, they have to

MICRO -- The 6502 Journal

make sure the carry is clear or theerror message would get printed.

The monitor routines used in theseprograms are normal labels as defln-ed in the cross reference listing forthe monitor. In order to possibly savesome of your sanity when you look atthe code, I will mention that theparameter input areas are notnumbered the way you would expect.The monitor always accepts input ln-to the P3 area, and each time a newparameter is entered, it shifts the'Whole area up 16 bits. This meansthat if only one parameter is entered,it ends up in the P3 area, not in P1 asyou would expect. For twoparameters, the first parameter is inP2, and the second in P3. For threeparameters, the numbers come outright. It gets sort of contuslno thefirst time you try to figure it out, andthose are not memory locations you

can use any of the commands to lookat, since the monitor zeros them outat the start of each command.

These routines were written forversion 1.1 of the SYM monitor,which is a little different from version1.0. In V1.0, both unrecognized corn-mands and syntax errors (I.e. non-hexdigits) were vectored through $A66D,not just the unrecognized commandsas in V1.1. This means that jf youhave V1.0 you have to check to makesure that you are not there becauseof a syntax error. In order to make

these work for version 1.0, insert thefollowing Just before U4 and make itthe address that goes into $A66D:

CD 57 A6 CMP LSTCOMSee if command terminated properly

FO 02 BEQ U4 Branch if OK

38 SEC Else set the error flag

60 RTS and return to the monitor

This will take care of things for bothU4 and US. People whoaJready have

my other extensions up won't haveto bother, since UO already Checkfor this condition before it doesanything else.The sixteen bit checksum for$200·$31F is $8F1B.

.July 1980

Page 11: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 11/84

6502 ASSEMBLER - SUA~ II VERSIO~

LOC --- -08JICCT---- ST"'To e o o 1 .00002 • SYH-l USER HONITOR fUNCTION EXTENSIONS0001')3 • •000~4 • U4 - MF~ORY SEARCH •OOOOS. 0 PARMS SEARCH fROM 'CU'AO+l' TO 'END Of HE~ORY'OOO~6. I PARM SEARCH fROH PARH1 TO 'END Of HENDRY' •00007. 1 PAPHS SEARCH fROM PAR~I TO PARM 2 •01')00A. 3 PARMS SEARCH fOR PARM1 AS ADDRESS fRON PARM 2 TO PARN 3 •OOOOq. U5 - OISPLAY ALPHA MEMORY00010 • 0 PARMS DISPLAY1 LINE FROM 'CURAO' •00011 • I PARM OISPLAY 1 LINE FROM PARH 1 •00012 • 2 PARMS DISPLAY FROM PARHt TO PARM 2 ..(01)13 • •00014 . • • • • •• • • • • • •• • • • • •• • • • • • •• • • • • •• • • • • • •• • • • • •• • • • • • •• • • • • •• • • • • • •• • • • • ••

LOC000"00000200'

----OBJECT---- STMT000160001700018

SYH-t HONITOR EXTENSION ROUTINESTEXT .. . . . OBJECT CODEOF syflt-l MONITOR EXTENSIONS .. . . . . .TEXT ••••• INITIALIZATION MONITOR COMMANDS ••• ••••nRG SlOO

O"fFOOF~OOfe:

000'0 .00021 • PAGE lERO ADDRESS LOCATIONS00022 .00023 :t000 2 ft CURlD EQU0002'5 AD JUST"'T EQU00026 PlSCR fOU

SF E$F CSFC

SVM-l 'OlD' ADDRESS$Y"-I SCRATCH PAGEZERO A~EASYM-l SCRAT~H PAGE lERO AREA

LOC0 7 0')

----OIOlJECT---- STl'!T

OOO~80002qon030000310003201')033

0003ft00(13' j000~6')0037000~8OOD,!Q00040000410')1 '42' )0043000441)I ' )04' j000460') ' )471 )1 ) ( \48OD04,}00050

U4 - MfMDR.Y SEARCH SYM-l MONITOR EXTENSION

TEXT Uft MEMORY SEARCH SYS-l EXTENSION .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .III U4 MONITOR EXTENSION FOR .THE SYM-l -- NEMORY SEARCH. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .• •BY : 't. VRTJS - LSI /CCSD •

• •ACTION DEPENDS ON HUN8ER OF PARNS ENTERED• 0 PAR~S SEARCH FRO'" ' 'CURlD+I' TO 'END OF HENDRY'• 1 PAR'" SEARCH FROM PARM1 TO 'END OF "'E~RY' •• 2 P~R"'S SEARCH FROH PARM1 TO PARM 2 •• '3 PARMS SEARCH FOR PARM 1 AS ADDRESS fRON PAAN 2 TO PARM• •• NOTES: •• l ' EXCEPT FOR THE 3 PARH OPTION. A SLASH ENTERED' AS A SLASH• INSTEAD OF HEX 2FWil l BE CONSIDERED A 'WILD CHARACTER'• 21 IF NO SEARCH ARGUEMENT IS ENTERED. THE VALUES FRON LAST• WILL 8E USEO. •• 31 THIS ROUTtNE USES THE SYSTEM RA'" SCOPE BUFFER FOR SCRATCH• 'REAt S.O IT WILL ONLY WORK WITHA TERMINAL UNLESS ANOTHER.. SCRA CH AREA IS PROV·IDED. •• •. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

0'0(1 r.q \S ! ' )0 '1 '52 J4 eMP 'UR CHECI ( F OR ' U4' COMMAND02'1 ' 1)('1 64 OI)(I"~ RNE TOU5 TRY NEXT COM~ANO IF NOT THIS ONE

000'>4 •02')4 EO 01 0!)O"i5 CP X II SEE HOW MANY PARMS

0216 <:10 08 01)0'>6 BCC NOPRMS BRANCH IF lERO PARMS0208 [l 0 t7 00OS7 SNE TRYNXT all. IF MORE THAN1021'1" 20 "7 "'I'. 0000;8 J S I! . P3SCR MOVE STARTING ADDRESSTO 'CURA.O'0;>"'1 20 8E ~~ O'oOo;q J SR DECCHP BACI(UP 1 SO INC COMES OUT 01(02JO t,9 OF 00060 ~OPRMS LOA 1S0F ZERO PARMS - USE HIGHESTRAM ADDR.0712 8'1 4R H 00061 STA P3 H02lS r:f 4~ ~6 00062 !JEC P'3L HAI(E lOW ORR DEli. . $FFon!! 20 '\ 2 '1 2 01 )063 J SR fMCCMP 8UMP CURAD 8Y ONE02111 FO 2D 00064 "'EQ GEURG GET SEARCH IF NOT AT END02l!} QO IE 00 865 8ec GETARG021F 18 00 ( '6 CU : DONE IF ALREADY TO END OF MEMORY0220 60 00067 il lS RETURN TO HONITORon!. 8A aDOb8 TRVNXT TXA PRESERVE • OF PARMS ENTERED')272 '. 0 Cl C III 0006q J SR P2SCR P2 AREA HAS'FRON' FOR 2 t '3 PARMS02?o; Cq I');! 00070 eHP '2 CHECI ( WHJCH02 27 1"0 14 nOO7l 8EO GETARG GET ARGU MENT IF2 PARMS

1)0072 •02:>q AD 4£ ~6 00013 LOA P~ l ELSE MOYE PARMI TOSEARCH KEY02?C. 80 0' ) A6 0')074 STA S P8UF1l22F AO 4F ~6 00075 LOA P1H073? ao 01 H 00076 STA SCPBUF+l0230; 11 .9 (1) 01)071 LOA 1$00 INDICATE 8YTES USED0237 85 FC 00078 S T . " PZSCR073Q A2 02 00079 lOl( '2 MAKE X-2 AS LENGTH

LOr: ----P")PoJE: T ---- ST"IT U4 - " 'EMORY SEARCH SYM-l MONITQP EXTENSION,)23!! 00 20 00080 8NE GOTCR AND WE HAVE THE PARM INNOW

OOOAI •,:nil &2 0' ) OO!)!!2 GFTARG LOX '0 NUHBER OF 8YTES ENTEREDr:."2V: 1'l6 Fe 010A)' STlI PlSCR SET TO ALL8YTES USED0741 20 40 'n (1)0!!4 JSR CRLF START ON A NEW LINE')244 al 3F 0'001' .5 LOA ,,>, DISPLAY PR~"PT0746 70 47 'l A 0OO8t> J SR OUTCHR014'1 20 ')9 'It 1)1)087 GHOOP J r IN8YTE GET SEARCHINPUT"'4~ 1' .0 1C 1)1)0'18 II S w rHEX N~ED TO EECH FORI If NO N-HEX'624 fO 08 OOO"'Q rpl( S If G T ENOUGH ALREADY'2'5') RO l , ) 0')0<>0 RC S 8AOY CAN'T HANDLE ANY MORE02"? q') O~ '6 000'11 S TA SCPBUF,X ELSE SAVE THE BYTE:)? ' j ' j 26 F": OOOQ~ IH)LUN ROL PZSCII ROLL CARRY INTO BYTES USED07.57 Ell 01)0<>3 INX 8UMP FOR NEXT ONE0758 no EF ') '1, )94 ~NE GALOOP UNCOND I T r ONAL' ' '5~ 70 06 O')O<l ' j ONHEX I'IVS e .ADY I F SECOND 15 NON-HE X IT IS 8100 ,')?'5C FO ,) C (1')0<>6 8EQ GOTCR. 8RANCH IF IT WAS CARRIAGE RETURNO~5<= Cq 7.<= OOOQ7 CIIIP "/' ELSE CHECK FOR A SLASH~')? 6) Fn F3 ' )1)0<>8 "EO ROLLIN IF YES - CAR~Y IS seT FOR ROLLIN

Page 12: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 12/84

tilt,;>1');>~5:)-'1'l6

0 ? , , 1 3

";>IlA1 ) ;>< ' 9I).'6rJono1'1;>77

0;>-'0;"'1'8021~0;>11")0 2 - ' ' '0 2 " 11 ) ; > , , 1

0796O?91302,,9

O;>!lR0 2 ' 1 E0 2 " 1 10 2 " 1 ; >029402'H029802QB02 0 0'll"lFO"A,'"

O?U,);>H:

"2·\1'')2A.F0 7 ' \ 0

Ol"'~0;>" 1' )21'150 : : >1 ' 370?~9

0:>8902'1')OZ ' " " !02r:;>~2r:o;onaoz r «?zr."ozeo02'1002')?Olns02!17OZDA020')02P)02F202E4

8~H0210902E8071;'002 F F'32" 20''''';'3?F7O?FI!

~~~aO'FF-030-i(n)l

03"10315030101090".,801') '1030"Oltl

'0 721!190 E1r'l0 100

CA10 0'1BF r=A< ; FrAn 1 F-

A r I FAD IF8<; FC6" FC1;l1) 01"I FF-1)9 00

no 19A811) F;>

20 16;>0 42C8III FE20 Ff aCC 1 F90 F51 ' 1 ) ntil60

~3 2~HI COII!60

C9I'D

l'l60E~<,n

FOBO

EO1'0A5IlnA.o;e n201 1 3A56"11 3 0'10fl O1)02020

20A.2as48A548

;>0AD81~o;>1')90CA00

~g856880;A. 2..r990Co90A920

A6

93'11

III

A6

1"103

Ol

"7a1')II.

FEloAFI'413A7

FEtoloA0848069r:<)1

16,~~

F'F

4?OJFEFA!H01

E"3FFF

83

83

F"10FE2004I j l \n5F"1 BA

d~~SEQCLCR:TSTEXT U5 - Of S Pt.AY MEMORY Sy,,-t EXTENS10N ••••••••• *••• ** •••••••••••••••••••••••••••••••••••• ~••••••••••••••••••••••••

.. U 5 M '1NIT OR EXTENSION fOR THE SY It-I -- or SPLAY AlP.HA 14Ef110RY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. ." BY: "' . VR:TIS - lSI/CCSO •. . .~CTI'~: SlNULAR TO SYN 'V.ERIFY'L EXCEPT 'OLO' POINTS TO NEXT'" ADDRESS AFTER THE COMMAND.'" 0 0A~~S OISPLAY 1 LINE FROM 'CURAO'• I PA~M DISPLAY 1 LINE FROH PARM I.. ? PA~~s DISPLAY FROM PARM 1 TO PARM2 : •• •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

0 00 '1 9 I I6QY1 )0100o ot o iODIn?

g 6 1 ~ ~OrJlf '5001 ' : ' 6"'n01')1)1':'11001090 0 1 1 0 •00111 nCHST, 0 ' ) 11200113on 14 EACHCH0011'500116,)')117001111On19 tSMTtH00120

8 8 !H •001<'3001?4,),)I? 5 ! ' lUTlOP0011600121OOI2!!00129' )01300013100132'lOI33 •om 34 NO"4TCH0011500136001110013800141 ' 10')141

001420011.300144001450( ' )1460014701 )14800149,}01'50001"10 : " 11 5 2,)'}1i3

•TOU'5•GOTC~

O'}lo;'5'5001<;600157 •0 ' )1< ;8 U5FRQon '5 90016000161 •oo i s z U%TllT0: l l6301)164

01116 '50 ' )16600161 '"0:)1611(l')tf, 'Ionno0011100112 PII;M510017301')1740r'I115001"'600171001760')119001110 PR"4S2OOUliOOlf!.;> •00183 ' )rjIJUT0Ille4OOl1l500186OOUl7OOl l38OOtll<) •0 01 QO ANOn -IR0()19100192001"3001"14001<:>500-19600191Oot qa •88!66IASTPT00201OI'l?I)?00203: ) 0 2 0 "00205 ASCOUT00206onn1)0l013O()20901)210 IIIIAKSPC00211 01';00

JSR :CLCBCC

..NE

"EX!3-"41ST)(L I ') ASTALOYLOASTA11.011:BCSIDA':-"41>!>.NFDEY~P tJ SR .J SI! :I NYLOAJ SRt ttyCPYSCCseoCt CR:TS

ERROR CHAR: ACTER 9EE'P THE BEEPER:CLF.AR CARRYTO fORCE 8R: ANCHJUST PASS1 NG THROUGH ON WAY TO USEE IF GOT ANY SEARCH CHARACTERS8RANCH I f NOTELSE SAVE STRING LENGTHHOVE IIYlES USED TO HOLD AREA

BEEPGALOOP

U5

E.ACHSTSCPSTlPISCIISCP8UOSCPSTtSCPBUOPISCII:I>ISCIIrSMTCHICURAOI.YSCpSUF.YI'tOlilTCHEACHCHCRLFSISPACEICURAD).YOUTBYTS'cpsnDUTtOPOUllOP

START OF TAIL ENDOF STRINGMOVE SYTES USED MAP TO WORK AREAROIL 1 BIT OF HAP INTO CARRYIF oN IT WAS A SLASH AND IS MATCHEOTHERWI SE

COMPARE SEARCH KEY TO THIS 8YTE8R. .CH IF NOT A HATCHGOT A MATCH - NEXT SEARCH CHARCONTtNUE IF ~IIE IN STRINGELSE OUTPUT ADDRESS OF STARTPUT Y e AC.K TO ZEROlIST THE CHARAtTERS FOUND

DON'T FORGET THE' LAST IIYrECLEAR CARRYA foIDRETURN TO "ONl TOR

NO ~IIATCH -BUMP TO NE.XT START ADDRESSCONTINOE SEARCH IF "E"ORY LEFTELSE RETURNTO MONITOR

r:MP!lEOSE CRTS'lOll'

CPc(!lEOI3CSCPX'lEO

1 OA<;r&10,1,STAJ SRCLClOA~DCsu' ICC1NC'1NEJ SRJ,SR.

JSR:LOXU)a .PHa.LO . ..PHA

JSR:lOYlOa .JSII~.~~

OEXIlNE

JSRI I -L .ASTA.I>UST lLOXLOACMPIICCCIIIPBCCLO'"JSR

1St"U5STIH

CHEC~ FOR U5 HASH coDeBRANCH IF YESRAJSE THE EPROR FLAGAND RETURN TO NONITORso ABOVE CAN BECOME A JNPCHECK FOR 2 PAR~SBRANCH IF YESMORE IS TOO M6NY PARMSHOW A.BOUT 1 PAR'''4MANCH IF YEPGEE - MUST BE 0 PARMSMove CURRENT AOORESS TO p3AND FALL THROUGH AS IF 1 PARMIIIa veSTAPT ING AOOR ES S TO : P.t:COMPUTE 1 BYTE PAST ENDING ADORES••••• BYTES PER UN'E HERE •••••••••

DONE IF NO CARR:YELSE TA~ECAR:E OF CARRYAND THEN OONEZ PARHS HAS STARTING IN Pl - ENO-P3BUNP F.ND BY 1 FOR COMpARE

START ON A FRESH LINE••••• BYTES PEA: LINE HERE •••••••••SAVE ' STARTING ADDRESSWILL NEED IT LATER

' 2pRIIISlU'5ERRItI'R"SICUllADP3 LCURAO.lPlHP3S(;RCURADU6P3 LOOOUTP] HOOOUTP2SCRINCP3CRLFSI116CUUDCURAO.I

SP... .EfgURADloVOUTBYTINCCMPLASTPT

ANOTHRSPCZ(URAD.lCUIIAD116ICUII:AO•YIU;>O"AKSPCU5 BOKDOU5 FOUTCHR

SPACE BETWEEN CHARSMAKE SURE REGISTER IS IER:OGET A BYTE OF DATATHIS TIME IT IS OUTPl1T AS HEXBUNP TO NEXT BYTEnn aset r PART IF TO ENDELSE COUNT BYTES THIS LI~E00 ANOTHER IF IIOOM L'EFT

iE~~~C~ijRI8F~:eKAfSlhnfRTS

•••••. BYTES P.ER UNE HERE •••••••••GET CHARACTER TO GO AS ASCIIIIIA~ESURE NOTCONTR:OL ..IIIA~EIT SPECIAL IF SOAS SHOULD 00 FOR LOWER CASEBRANCH IF NOT SPECIALINSERT FILLER CHARACTEROUTPUT THE ASC r I

Page 13: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 13/84

031 20 ~ :z 8;> 0')212 JS R 'NCO"P BUMP TO NEXT BY TEg j j BO 0' ) °3211 R~ S U'500NE ~OME (F NOW TO THE ENDCA o 214 1 '1 . '( lS E NEXT AYTE1 ) 11 DO 109 00215 !HIE ..SCOUT SAME LINE IF NOT TO END031 1 '0 SF 0')216 II,EQ DOOUT ELSE STARTA NEil LINE

0');>17 •03! e 18 0')218 U50( ' lNf (; lC CLEAfI ERROR F l . . .031 F 60 00219 IITS ANO RETUR.N. TO MONlTOR031F oono PGMENO " 0 0 .-1 END OF PROGRA"'I"DDRESS MARKERlr w ----r lBJFCT---- ST~T WM SVSTEI'IADDRESS AND ROUTINES

81':1982911I;>9C82A 1B211?!PflF"1; '1 ' ~A~16A131'~342834')a97?IIA47

A60Q461FA61F464~&64'1!,64C4640&64E11.641'1 '111') F PASS Z-EPRODS~

00;>22 •• • • • •• • • • • • •• • • • • •• • • • • • •• • • • • •• • • • • • •• • • • • • •• • • • • •• • • • • • •• • • • • •• • • • • •00223 • SY"'ISYSTME ROUTINE ENTRV POINTS AND RAM ADDREsse s00214 .

002'2 ' TN8VTE "'QU .811)9 INPUT 2 HEX DIGITS ~NTO • A'0027.7 INCP3 Eeu $8293 INCREMENT 1'3 BY 10027.9 P 2SCR fOU .829C PUTPARMl f NTO' CU'UO'0022Q P1SCR EQU .82.1,7 PUT PARP'13 INTO ·CUR.AO'00230 INCC~P I: 'OLI .8282 BUMP 'CURAO' '" COMPARE TO PAR"'300131 nECCMP EOU t828E SUBTRACT 1 FROM 'CURAO'goz;P OUTBYT. ECUS82F

1A6

PI!tNT A. Il HEX DIGitS)02:>3 CR.lFSZ F.OU iS3 OUTPUT CR/lF ANO '(URAO'

007.34 S PCZ Eeu .8331' OUTPUT 2 SPACES0')235 SPACE Fau $8342 OUTPUT 1 SPACE00236 (RlF EQU .11340 OUTPUT CR/lF00231 BEEP EQU .8972 TOOT THE ON80ARD BEEPERO,", ?380UTCHR FOU .8.1,41 OUTPUT ASCII FRnM .. . . .00219 •••••••• ••••••••••••• •••••••••••• •••••••••••• ••••••••••• " .00<>40 SCPI'IUF Eeu $.10600 SCOPE OUTPUT BUf"HRAREA0~241 SCPBUD EOU 'A6tE BYTES USED BIT MAP0, ' )22 S C P S Tl f CU SA6lf SEA Re H STRJ NG LENGTH00143 Pll EOU .A64A INPUT PARAMETER VALUES00244 P 3H E QU S.Io64!!00245 P2l Foo U64C00246 PZH feu '164000241 Pil FQU .A64E00248 PIH fQU '.10641'0 '10' )0 .

Microcomputing is Nick vrtts' hobby.. He is employed byLear Siegler, Inc. as a Senior System SoftwareSpecialist. For this, he works mainly on operatingsystems on the company's IBM computers, but he alsodelves into GIGS and communication somewhat.

be expanded to 8K. He also has Synertek BASIC andhas played with Tom Pitman's Tiny Basic, which he hasdisassembled and modified. His current terminal is anold Detepoint 3300, and he also has a Radio ShackQuick Printer If hooked up through the TTY pot on theSYM. The assemblies that he gets are done with a crossassembler that he wrote to run on the IBM gear.is system at home is a $YM-1. It has 5K RAM, soon to

~IIIII I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I1111111111111111111111111111111111111: i- ;;;;- --6502 ENTHUSIASTS ~i ~:: A NEW KIT THAT GETS YOU INTO ~!iii SERIOUS MICROCOMPUTING FOR ONLY iiiiii _

~ $1495.00Kit $1695.00Assembled ~ii ii- -> 6502 CPU & DISK CONTROLLER CARD ~- > 16K RAM CARD •~ > 90K MINIFLOPPY DISK DRIVE !~ > DOS; 8K BASIC, ASSEMBLER/EDITOR !! > 8 SLOT MOTHERBOARD ::! > CHASSIS,. POWER SUPPLY, & CABLES ~!iii > MICRO-TERM ACT-I SERIAL TERMINAL •~ 16 X 64 CHARACTER DISPLAY !! Upper/Lower CASE !i ADDRESSABLE CURSOR !iii > GOLDSTAR TV/MONITOR !;;; HIGH QUALITY DISPLAY !iiiiii TV TUNER INTACT iii~ ~• Prices in fast month'S issue ~•••;;•; Tel+iii Aids! Industries Inc.•;;;!i i i!-iiiiii 44 Uni.~rsi!y Drive • Arlin810n H~i&hu. Ill. 60004 • (312) 870-7«Xl ~

;;;

-ii 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111ii

Programming and Interfacingthe 650.2,

With Experiments

By Marvin L. DeJong

An introductory text book that teaches you the fun-damental concepts of machine language programmingand Basic interfacing techniques.

Avai.lable for $13.95 from:

were in error.

Howard W . $ams & Go., Inc.4300 W .62nd Street

P. O. Box 7092Indianapolis, IN 46206

(317) 298-5400

-;;Master ChargeVISAC.O.D.

-•;;;;;;;;;;~-;;;;;;;;;;;;;;;;;ew Dimensions In.Electronics

Page 14: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 14/84

Page 15: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 15/84

Sorting Revealed

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

A truly fresh approach to understanding the basics ofsorting. In addition to a particularly lucid discussion ofvarious sorting methods, programs are presented whichdemonstrate the sorting algorithms in action .. . . . . . . . . . . . . . .,~~~~~~~~~~~.~~~~~~~~~~~~~

It has often been said that a pic-ture is worth a thousand words. Sad-ly, this maxim is frequently ignored

by professional educators, especial-ly when dealing with such bone-drysubjects as mathematics and com-puter science. This article will pre-sent a detailed example of the useof a simple, yet effective, visualtechnique for giving insight into thebasis for certain algorithms. Our ap-proach will be to show the algorithmin action. Our medium will be theApple II personal computer, but anycomputer which provides a memory-mapped display will do. The vehiclefor the demonstration will be one ofthe staples of the computer science

curriculum - the joy of pedants andthe bane of poor benighted students- viz. sorting algorithms.

Sorting Theory

Unfortunately, we must stoop topedantry to begin with. The readerwho is already well-versed in sortinglore may skip directly to Sorting Im-plemented.

Sorting is such a varied and vasttopic that large portions of entirebooks have been devoted to it.Perhaps the best known compen-dium of sorting facts and theory Isto be found in Knuth's robustvolume Sorting and Searching (TheArt of Computer Programming Vol.111, Addison Wesley, 1973). Ourdemonstration will be limited to justa few of the better known sortingalgorithms, although the techniquescould be applied to others as well.We shall provide programs thatallow the visualization of five dif-

July 1980

ferent sorting algorithms: bubblesort, Shell sort, insertion sort, selec-tion sort, and quicksort. Of these,

we shall discuss the bubble sortand quicksort in somedetail prior tothe presentation of the programs.Details of the others may be foundin almost any good introductorycomputer science text, as well as inmost texts on data structures.

Apart from the specific details ofthe algorithms used,the theory con-nected with sorting deals with effi-ciency.Whenpeoplewho are"in theknow" discuss sorting, they will fre-quently bandy about certain ter-minology which they don't bother to

explain. In hopes of increasing thenumber of cognoscenti involved insuch discussions, we shall nowat-tempt to layout some of the morecommon terms for you.

Tosimplify matters somewhat, letus assumethat all of our sorting willtake place entirely in memory. Sor-ting methods that involve storing in-termediate stages on disk files ormagnetic tape, so-called externalsorts, will be beyond our scope,although presumably not beyondour ken. The objects to be sortedwill be assumed to be' numbers,either integer or floating paint,stored in memory in an array of onedimension and of a given size. Thesizeof the array being sorted will bea hit personality throughout thediscussion, so we give it a name. Itwill be denoted by N.

Number of elements to sort = N

In order to fully comprehend one

MICRO -- The 6502 Journal

Richard C. Vi.le, Jr.

of the definitions to be oiven later, itis necessary to Indulgel in a bit ofmathematics. We shall need to

understand two functions. In par-ticular:

L092x = base 2 logarithm of xLXJ = floor of x

Actually, we are interested in thecombination of these functions asapplied to the friendly value N:

i.e. the floor of the base 2 logarithmof N. Before you run screaming tothe nearest math anxiety clinic, at

least read the next few sentences ofexplanation.

Suppose you have a pi Ie of Ncoconuts (why coconuts, you ask?Why not, we reply!). Think about thefollowing process:

1. Subdivide the pile Into two pileswhich are as nearly equal in size aspossible.

2. Take the smaller of the two pilesfrom step 1. If It consists of onecoconut, then stop. Otherwise,repeat from step 1.

Now how many times did you dostep 1? The answer is the value of[1092 N]! So, without worring aboutpicky details, the floor of the base2logarithm of N is the number oftimes you can divide N by 2 and stillretain a non-zeroquotient. Figure 1.pictures a Simple case.

An alternate way of thinking about

26:13

Page 16: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 16/84

the situation involves collectingcoconuts. The procedure is asfollows:

1. Begin with a single coconut.

2. If doubling the number, k, ofcoconuts which you already havewould cause your total to exceed Ncoconuts (2k is greater than or equal

to N), then stop.3. Collect k more coconuts, givingyou 2k, and repeat step 2 now think-ing of the new total as the value of k.

Now how many times did you ex-ecute step 3? The answer will againbe [1092 N]. Before you go on, try toconvince yourself (without flying toTahiti to collect real coconuts),thetwo procedures yield the sameresult.

We shall return to this value, the"coconut number", later.

In order to talk about the efficien-cy of any algorithm, we need somequantities that we can measure. Forsorting algorithms, we concentrateon two: the number of comparisonsand the number of interchanges.

A comparison occurs whenever amember of the collection ofnumbers is compared to somethingelse. The something else could be avalue fished out of a hat, or it couldbe another member of the collec-tion. Thus, a statement such as IF

A(I)> A(I+ 1 )THEN...counts as acomparison, as well as IF A(I) >MAX THEN ...

An interchange occurs whenevera member of the collection ofnumbers is moved from one place toanother in the computer's memory,and possibly some other numbertakes its place. The classic inter-change may be described by the se-quence of three statements:

TEMP =A(I)A(I) = A(J)

A(J) = TEMP(assuming, ofcourse, that I*J). Notall sorting algorithms use thisclassic form, but there is usually aneasily identified interchange stepwhose repetition we can count.

Trying to count the number ofcomparisons andlor interchangeswhich take place during the courseof execution of a sorting algorithm

26:14

N Starting Pile Pile 1 Pile 2

c2 :6 0 &> CD®

2

CD >0

01 0 STOP

Step 1. was performed 2 times_Therefore,

will give an approach to measuringthe efficiency of that algorithm. In

addition to comparisons and inter-changes, there will also be overheadinvolved in a sorting algorithm: l.e,the computing time used in loopcontrol, recursion, etc. This is moredifficult to measure theoreticallyand is therefore usually deducedfrom empiri.cal observations.

Being armed with a few ter-minological weapons, we may nowattack some of the more familiarsorting buzz phrases. Assume weare speaking of the number of com-parisons made during the execution

of some sorting algorith~. Then wemay speak of an N sortingalgorithm (pronounced N-squared).This means that "on the order of" Ntimes N comparisons will be madein the course of sorting an array ofsize N. Well, that was relativelypainless - at least as a definition!The interesting (painful) part comeswhen we try to pr~ve that a givenalgorithm is an N algorithm. Weshall get to that in the next section.

Another phrase which is frequent-ly encountered when casually "talk-

ing sorts" is: that's an N log N sort(pronounced N log NI). What that ac-tually means is that the expectednumber of comparisons in carryingout the sorting algorithm for an ar-ray of size N is:

N * ([1092 N J)

That is, N multiplied by the coconutnumber. Again, this is easy enoughto say, but perhaps a_bit harder 10

MICRO -- The 6502 Journal

Figure 1

appreciate than the N4 description.After all, why should we be concern-

ed with these numbers, and what isthe significance of the differencebetween them?

Consider brie~IY,Table 1. It showsvalues for N, N ,[1092 N], and N·[I092 N].Assuming that overhead isrelatively constant, or at leastnegligible from one algorithm to thenext, we see that there Is an ever in-creaslnq difference between N2and NlogN (from now on, weassume that 10gN means [1092 N]).To make the comparison more con-crete, let us assume that a com-

parison costs .001$, and that weneed to sort an array containing1,048,576 numbers. Using an N2sort will cost $10,995,116.27,whereas using an NlogN sort willonly put us out $209.72 Of course, asingle comparison of two numberson today's monster computers-or"big iron" as they are sometimesreferred to in the trade- costs con-siderably less than .. 001'. But evenat .0000001<per comparison· a rateof 10,000,000 comparisons perpenny- the cost differential will be 2"fo£ the NlogN sort-$1,099.51 for the

N sort! With that kind of com-parison, you can see why no com-mercially viable sort~g package isgoing to use the N sorting ap-proach.

Some Sorting Algorithms

We now present two of the morewell known sorting alqorithms insome detail. We wl.1fattempt Infofmally to prove that the first is an N

July 1980

Page 17: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 17/84

algorithm, The second algorithmdiscussed is an example of anNlogNalgorithm, but we shall sparethe reader any attempts at proof.

Bubble So.rt

This algorithm is probably themost widely known and loathed bystudents of introductory computer

science, Many an instructor hasdroned on about its properties tounwilling students of FORTRAN!For many of these students, it istheir only taste of the vast menu ofsorting techlnlques.

We' assume that N elements,which we shall denote by A(1),A(2),.... A{N), are to be arranged inascending order; in short, sorted.The bubble sort operates by makingrepeated "sweeps" through the ar-ray, causing various elements to"bubble - up" in the process. Weshall see that for each sweep, atleast one element is guaranteed tobe positioned in its correct final slotin the array.

The heart of each sweep is theidea of comparing two adjacent en-tries in the array:

A(I), A(I+1)

If A (I) has a greater value thanA(I +1),. then the two elements areknown to be out of correct order andneed to be swapped. This is ac-complished by the use of the classicinterchange, which we illustratehere in BASIC and Pascal:

N

- - - - - - ~ - - - ~ - - - ~ - - - - - ~ - - ~ - - , - - - - - - - - - - - - - - -N lo g N

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - ~ - - - -!

641282.56.512

1,0242,0484,0968,192

16,384.32,76865,536

131,072262,144524,288

1,048,576

409616,38465,536

262,1441,048,5764.,194,304

16,777,21667,108,864

268,435.,4561,073.,741,8244,294,967,296

17,179,869,18468,719,476,736

274,677,906,,9441,099,.511,626,776

Now consider the iterations ofthis fundamental step which arenecessary in order to bring the en-tire array into sorted order. First,suppose we are just beginning.Then we can make no assumptionsabout the sizes of the arrayelements, relative to their posltlonsin the array, Thus, suppose weiterate the fundamental compare-maybe-swap step over values of Iranging from 1 to N·1 (why not 1 toN?)., That is, we will successivelycompare A(1) and A(2),A(2) and A(3),and so on, until we reach A (N-1)andA(N). Positions of various elementswill change through swapping. Inparticular, the largest numericalvalue in the orignal array isguaranteed to wind up in A(N). Posi-tions of various elements willchange through swapping. In par-ticular, the largest numerical valueIn the original array is guaranteed to

T!'!F:1\l 14000110120130140

BASIC

IF A(I) <- A(I+l)TEMP == A(I)A(I) == A(l+l)A(I+l) = TEMP

Pascal

if A[I] > A[I+l] thenbegin

Figure 2The "Classic I.nterchange"

Temp : = =A [ I] ;A[I] r= A[I+l] i

A[I+l] e= Tempi

end;

678

9 '101112 !1314 J151617181920 J

384896

2,04'84,608

10,24022,52849,152

106,496229,376491.,520

1,0410,5762,228 ..22,44,718,5n9,961,472

20,971,520

Table 1wind up in A(N) after the sweep iscompleted, To convince yourself,that this is true, ask;"lf the largestvalue is originally in A{J), then whatother array entries will it be swap-ped with?"

The last paragraph has indicatedthat we can reach a picture such asthat shown in Figure 3, after onesweep of the array. What has beenaccompl.ished? We have partiallysorted the original, array. How muchof the resulting array is now in cor-rect order? One element - the last.Note that this is the same as thenumber of sweeps we have made.Now suppose we make a secondsweep through the array, comparingA(1) and A(2), A(2) and A(3), etc. untilwe reach A(N- 2) and A{N-1). It is notnecessary to compare A{N-1) andA{N), since we know that A{N) isalready in its correct final position.Moreover, A{N-1) is now alsoguaranteed to be the second largestelement in the array, and thereforein its correct final position. Thus theoriginal array has been divided intotwo pieces: the elements A(1), A(2),... A{N-2), still possibly unsorted, andthe elements A(N-1) and A(N), bothwhere they 'should be'. We havemade two passes and put twoelements in their correct positions.

Continuing this process by mak-ing. passes through less and less ofthe array will cause more and moreof the 'tail end' of the array to be incorrect final order and leave lessand less of the beginning of the ar-ray to still be sorted. Altogether itwill take N·1 passes through the ar-ray to guarantee that it Is totallysorted, The reason that it does notrequire N passes is that the lastpass causes two elements to wind

Page 18: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 18/84

1 3 N:

A

array.

Figure 3Array after sweep of Bubblesort

upin their correct places, instead ofjust one. Figure 4 gives both aBASIC and a Pascal version of thecomplete bubble sort algorithm.

Now let us see if we can count thenumber of comparisons that will bemade. Each sweep through the arraycorresponds to one pass throughthe inner loop of the alg.orithm. Thenumber of comparisons made willbe the same as the value of the up-per limit of this loop, which secor-ding to Figure 4. is N·!. The value of Iis varried by the outer loop and runsfrom 1 to N·1. Thus, there will be:N-l comparisons the first timethrough the loop.N-2 comparisons the second timethrough the loop.N-3 comparisons the third timethrough the loop.

N-{N-2);;;;:2 comparisons the (N-2)ndtime through the loopN-(N-1);;;;:1 comparisons the (N-1)sttime through the loop.The total number is therefore:(N-1)+ (N·.2)+ ... + 3 + 2 + 1This number is known In

mathematics as a 'trlang ular'number, and by a formula fromalgebra may be expre~sed solely interms of N as 1/2 (N .- N). Conse-quently,. there are about N2 com-parisons made.

The inefficiency of the bubblesort is compensated for by itssimplicity, especially from apedagogical point of view. It is total-Iy trivial to program, as we haveseen. Consequently, it is quite ac-ceptable for sorting tasks that onlyinvolve 'small' values of N.

Quicksort

Quicksort, invented by CAR.Hoare, is probably the most'elegant'of the sorting techniquesyet devised. It is an NlogN sort,which is based on a very simple ideaand in its most compact form maybe programmed in very few lines ofcode. In fact, probably the greatestdifficulty in grasping how it worksinvolves understanding the ad-ministrative details of how to applythe basic step which motivates its

BASIC

10 FOR I = 1 TO N-120 FOR J = 1 TO N-I30 IF A(J) <= A(J+l) THEN 7040 TEMP = A(J)50 A(J) = A(J~l)60 A(J+l) = TEMP70 NEXT J

80 NEXT I Pascal

for I := 1 to N-1 dofor J := 1 to N-I do

if A[J] > A[J+l] thenbegin

Temp :=A[J];A [J] := A[J+IJ i

A[J+ll := A[J] ;end;

Figure 4Bubble sort algorithm in both BASIC

and Pascal

operation. One has the tendency tosay, 'You mean, that's all there is toIt?', or 'But what do you mean bysimply apply the same procedure toboth halves?'. Nonetheless, onceappreciated, it is an algorithm youwill never forget. That should bereward enough for the effort expend-ed in understanding it in the firstplace.

The basic idea underlyingQuicksort is to perform inter-changes of non-adjacent arrayelements in hopes of bringing orderto the array more quickly (bubblesort has already demonstrated theinefficiency of Interchanging adja-cent entries). The idea is applied us-Ing the concept of a partition of thearray elements.

To partition the elements A(P),A(P + 1), ... , A(Q) of the array A,where p~1,p::sa,O::sN, requiresthat some value X which actually 00·curs as one of Iheentrles A(P), A(P+ 1),...,A(Q) be placed into its cor-rect final posltlon, say K, and thatthe remaining elements are arrang-ed so that A(I)::$A(K) for 0 < K andA(J)~ A(K) for J > K. The results arepictured in Figure 5.

For convenience in implementa-tion (although this may not be theoptimal choice in theory), we shall-always choose A(P) as the value X,which is to be inserted into its cor-rect final resting place, To ac-complish our end result, we adoptthe followi ng'double-barreled'scan:

Start with I ;;;;:P + 1 and J;;;;:O.Scan forward from I (i.e. in lncreas-ing I-value order) until we find A(I) forwhich A(I) .~ X. Scan backwardfrom J (l.e, ln decreasing J·valueorder) until we find A(J) for whichA(J) _5X.Then Interchange A(I) andA(J), since they are both in the'wrong halt' of tt~e partitionaccor-ding to the above definition. Con-tinue this procedure until J 51. As afinal act, interchange A(P) and A(I),where I now has its 'final' value. Thisputs X = A(P) into its correct finalposition in the array. You shouldconvince yourself that It alsoachieves the picture shown inFigure 5. Actually, there is one casewhich tails. See if you can discernwhat It Is - we'll come back to itlater on.

An example may make t.hlngs abit clearer. Figure 6 shows an un-

Page 19: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 19/84

sorted array of 16elements, which isto be partitioned for P = 1, Q = 16.Shown are the first values of I and Jfor which an interchang.eof the par-titioning process will take place.See if you can draw the final picture:showing the array with the partitioncomplete and the value of K. Theanswer is shown In Figurel.

When one gets down to program-ming the partitioning process,several details that may not havebeen previously obvious suddenlyforce themselves into the spotlight.In order to highlight these, we pre-sent in Figure 8 a Pascal procedurefor the partition step. The first Itemwhich may catch your eye is that ar-ray A is indicated in the parameterlist to be of size N + 1, instead at N.The reason may be seenbystudyingthe second repeat statement ofFigure 8:

repeat1:= I +1until A(I) 2 Value:

As with all loops, the programmershould be sure that there is a wayout! In this case, if the elements A(!),A(2),... , A(N)of the array are assum-ed to be randomly distributed

A; . . · . . . l.1-----1 _L._ __ .. .. LJl_ l.._.....I...

P P+l K QL ~~----_--~ L, ~------/

A(J) > A(K}(l) < A(I<)

Figure 5among all possible values, thenthere Is no guarantee that any ofthem satisfies the condition A(I) ; : , - : .Value. Thus, we have extended thearray and:stored a value in A(N + 1)which is guaranteed to be greaterthan or equal to any other value thatcould occur in the original array. InPascal, the predefined identifierMaxin! serves the purpose, and wemay assume that the asslqnrnentA[N + 1] : = Maxint; has occurred inthe cal.ling routine. Now, even if allelements of A are strictly less thanA(1), the repeat loop will terminate

A(P)-lO

§~12

Figure 6

when it bumps into the Maxint valuestored in A[N + 1] . Such a value,which is not part o fthe data beingmanipulated, but instead serves toprotect against some dire clr-cumstances, is known as a senttnet.

This approach raises two furtherquestions: first, do we face a similarproblem with J; and second, do weface the possibility of erroneouslyswapping A(N + 1) with some ele-ment of A. The first questloniseasl-Iy answered by reallzlng that Value: = A[Lower], Thus, if J Is decreasedso far that J : = Lower, then A[J]SValue is automatically true. Thus,the first repeat loop is guaranteed tostop because of this choice. Toanswer the second question, let'slook closely at what happens whenN '" Upper and A(I)-: Value for all I,I '" 2,3, ... ,N. The repeat statement:repeat

J:", J - 1until A[J]sValue

immediately succeeds. J starts atN + 1, J-1 = Nand A(N)<Value byour assumption. Thus, J stops at thevalue N after the first time throughthe loop. On the other hand, therepeat statement for I will continueto fail, again by our assumption, un-til I = '" + 1. Now I + N+1 and J '"N. This means that the test I<J willfail. Therefore, the interchangeshown inside the While loop will beskipped. Aha!, you say - caughtyou -nothing happens and Quicksortis a sh am!! Fortunatel y, that is nottrue. The last two statements in theprocedure:

A[Lower1: '" A[J];A[J] ; '" Value;

will be carried out, causing A[lower]and AIN] to be swapped.

To assimilate the code of the pro-

Page 20: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 20/84

AClJON, SlHATEGY, AND FANTAS¥-......lor the SERIOUS games plaYer

and his APPLE IIBrain Games - 1 demands ingenuity.

Two players bombard radioact ive material with protons

and electrons until it reaches critical mass and sets up aNuclear Reaction. Dodgem requires you to outmaneuveranother player to get your pieces across the board first.Dueling Digits and Parrot challenges your ability toreplicate number and letter sequences. Tones lets youmake music with your Apple (16K) CS·4004 $7.95. StrategyGames and Sraln Games are on one disk (16K) CS·4503$14.95.

Strategy Games - 1 keeps games players inYou and your opponent trail around the screen at a

quickening pace attempting to trap each other in yourSiockade. A 7 category quiz game will certify you as aGenius (or an errant knave!). Beginners will meet theirmaster in Checkers. Skunk and UFO complete this classic

collection (16K) CS-4003 $7.95

Know Yourself through these valid self-tests.Find out how your l ife style effects your Lite Expectancy

or explore the effects of Alcohol on your behavior. SexRole helps you to examine your behavior and attitudes inlight of society's concept of sex roles. .Psychotherapycompares your feelings, actions, and phobias to thepopulation's norms and Computer Literacy tests yourmicrocomputer savvy. A fun and instructional package(16K) CS-4301 $7.95. Know Yourself and CAl Programsare on one disk (16K) CS-4503 for $14. 95

EYou're in command in Space Games - 1.

Maneuver the TIE fighters into your blaster sights andzap them with your lasers to save the rebel base campfrom annihilation in Star Wars. Rocket Pilot is an ed-vanced real time take off and landing game. High resolu-tion graphics, exploding saucers and sound effects add tothe suspense as you repel the Saucer Inyas;on. Finally, abonus graphics demonstration, Dynamic Bouncer (16K)CS-4001 $7.95. Space Games and Sports Games are onone disk (16K) CS-4501 for $14. 95

Sports Gamf!s- 1 puts you in the Apple World SeriesTake the field in the Great American Computer Game.Mix up your pitches to keep the batter off balance. Moveyour fielders to snag the ball before he gets to first. Ballsand strikes, double plays, force outs, and errors let youplay with a real istic strategy. Also in the l ine up-Slalom,a championship downhill ski race, Torpedo Alley, andDarts (16K) CS-4002 $7.95. Space Games and SportsGames are on one diSK (16K) CS-4501 for $14.95

It's easy to order SENSATIONAL SOFlWAR£ for your Apple II.Send payment plus $1.00 shipping and handling In tne U,5. ($2.00 foreign) to

Creative Computing Software, P.O. Box 789·M, Morristown, N.J. 07960. N.J. residentsadd $1 .00 sal es tax. Visa, Master Charge and American Express orders may be cal led in tollfree to 800·631-8112 (in N.J. 201·540-0445),

Page 21: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 21/84

cedure, simulate its action onthe ar-ray of Figure 6. As a final note, theprocedure protects itself from funnyinitial values for Lower and Upper,by firsl checking to make sure thatLower < Upper.This will turn out tobe necessary in one version (therecursive one) of the completeQuicksort algorithm, but must bemoved back 10 the caller for theother version (the 'straight' oriterative one).

Now that we have studiedlhe in-nards of the Quicksort algorithm, itis time to investigate how the parti-tion step fits into the larger schemeof things. Once the original array Ahas been partitioned, we are leftwith one element in its correct finalresting place and two subarraysthat remain to be sorted. The beautyof Quicksort is that that is all thatremains to be done. Once the two

subarrays areboth sorted, the entirearray is automatically sorted.This istrue because of the conditionguaranteed by the partition step -thai all elements in the first half ofthe array arrs less than or equal toall the elements in the second halfof the array. Not convinced? Thinkabout it! Or, consider the followinganalogy: a school teacher wishes toarrange lest papers in alphabeticalorder. The papers are divided intotwo piles (partitioning step) with allpapers in the left-hand pile belonq-ing to students whose names beginwith letters A to M, and all papers inthe right-hand pile belonging tostudents with names beginn.ingwithletters N to Z. Now, if the left-handpile is arranged (by whatevermethod) into alphabetical order andlikewise the right·hand pile, then allthat remalnsto put t hewhole coIlec-tlon into alphabetical order is toplace the left-hand pile on top of theright-hand pile.

To continue the Quicksortalgorithm, one applies the basicstep to bOth subarrays obtainedfrom the first partitioning step. Thatwill produce in each case two newsubarrays (or better, sub-subarrays),to which the partitioning process isapplied in turn. Since we startedwith a finite number of elements inarray A, sooner or later this will pro-duce sub-sub...subarrays with 0elements. Such subarrays aresorted by default. Thus, they neednot be partitioned any further.Morever, when both subarrays of a

~ ~W ! J ~~@r rD1?~ ~ ~~ 60 ~ [3 [j0 C if3;f

Figure '1Partition step complete A(7) in cor-rect position.

procedure

Partition I

var A: array[l ..N+l] o£ integer;Lower, Upper: integer;

var J: integer );

var

Value,Temp: integer;

begin

if Lower < Upper then begin

I := Lower; {Lower bound in A for partition step}J : = Upper; {Upper bound in A for partition step}Value := A(Lower); {comparison value fOr partitioning}

while I < J do begin {Partitioning loop}

repeat {Find element in right half to switch}J .:= J-l

until A(J) <= Value;

repeat {Find element in left half to switch}I := 1+1

until A(I) >= ValUe;

if I <= J then begin {Perform the switch}

Temp := A(J) ;A(J) := A(1);All) := Temp

end {of if I <= J}

end {of while I < J)

A (Lower) := AIJ);AIJ) := Value;

{Insert A{Lower) into its }{correct final pos.ition in A}

end {of if Lower < uppe.rJ

end {of Procedure Partition};

FigureS

Page 22: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 22/84

procedure

Sort (

var A: a.rray[l. .N+l] of integer;Lower,Upper: integer );

var

J: integer;

begin

Partition(A,Lower,Upper,J);

Sort(A,Lower,J-l);Sort(A,J+l,Upper);

end {of Procedure Sort};

given subarray reach this state, theyform together with their partitionelement a sorted subarray, whichmay then be ignored while the reo

maining unsorted subarrays arepro-cessed. Eventually, the original twosubarrays will have been sorted andvollat, A will have been sorted.Figure 9 shows the implementationof this scheme as a Pascal pro-ceduremust beinvokedfrom outsideItself with lnltlai values for Lowerand Upper, which are presumably 1and N, in most cases. Once it getsgoing, it calls itself on behalf of thesubarrays, and the sub-subarrays,etc. until it completely sorts A.Figure 10 shows the progress of thesort as applied to a small array, withN = 8. Study it carefully. Figure 11presents the calling structure toSort for the array In figure 10. Theroot of the tree represents theoriginal call to Sort from outside.The interior nodes of the tree repre-sent calls to Sort from within itself.Eachnode is labeled with the valuesof Lower and Upper which werepassed on the corresponding call.The leaves of the tree representcalls to Sort in which the passedvalues of Lower and Upper corres-pond to subarrays with a elements.Such subarrays are already sortedand "nothing" will happen on thesecalls.

EXERCISE: Determine whether ornot the Partition procedure may bemodified to return whenever thepassed array has either 0 or 1elements. If so, make the necessarychanges to the code.

The recursive implementation ofQuicksort is without a doubt one of

26:20

{Partition A between }{A (Lower) and A(Upper) }{Sort the "left" subarray }{Sort the "right" subarray }

Figure 9

the most "beautiful" algorithms yetdevised in any branch of computerscience. Unfortunately, the perter-mance of Quicksort in such an im-plementation, even though superiorto most N2 algorithims, is stili notquite as good as it could be. Weshall not attempt to explain thetechnical reasons for this, otherthan to say that recursion involvesmore than a modicum of overhead.However, we shall attempt to for-mulate the algorithm in a non-recursive or Iterative fashion forcomparison.

Now look back at the recursiveimplementation of Quicksort shownin Figure 9. Since Sort calls itself,this means that the variable J,which is used locally within Sort,must be given a different "lncarna-tion" on each call. Otherwise, therecursive calls would cause itsformer value to be lost, which in turnwould mean that the procedurewould get mixed up about where thesubarrays began and ended. Inlanguages, such as Pascal, whichsupport recursive procedures, theuniqueness of J on each call isguaranteed. In a language likeBASIC, there aren't even pro-cedures, let alone recursive ones!Thus, in such a language, we must"fake it" in some way or another.

What is it about the variable Jthat's so important? It remembersthe dividing paint between the twosubarrays determined by any parti·tlon step. This enables the twohalves to be sorted separately bysucessive calls to Sort.Another wayto approach matters would be tosave information about subarrays

MICRO-- The 8502 Journal

that stili need sorting and retrieve itas necessary. An appropriate datastructure for preserving such infor-mation is a stack. The Lower andUpper values for one "half" of a par-titian may be saved by pushingthem onto the stack, while the other"half" is being sorted. When theother half has been completely

sorted, the Lower and Upper valuesfor the saved half may be popped offthe stack and the sorting of that halfcommenced.. Of course while sor-ting a given half, new pairs ofbounds for smaller subarrays will bedetermined and bounds for onesubarray of each such pair will inturn be pushed onto the stack. If apoint is reached at which we try topop the bounds of a subarray fromthe stack, and find that the stack Isempty, then we will know that theoriginal array is completely sorted.As a performance enhancement, weshall always sort the smaller of anygiven pair of subarrays first. This isin distinction to the algorithm ofFigure 9, which always sorts the leftsubarray first. Sorting the smallersubarray first will cause a minimumnumber of entries to be savedon thestack.

The actual codeof an iterative lrn-plementation of the Quicksortalgorithm is presented in Listing 5,using APPLE Integer BASIC.

Sorting Implemented

The APPLE II Integer BASIC pro-grams of Listings 1·5 provide lrn-plementations of visual sorts for thefollowing five methods: Bubble sort,straight insertion sort, selectionsort, Shell sort, and Quicksort. Thevisual display arranges the array tobe sorted as a table of up to 100positive two digit integers - the usermay request fewer i f so desired tospeed up the completion of thealgorithm. The basic table using therandom number generator for IN·TEGER BASIC. For skepticalviewers, the values 0 to N may begenerated in a permuted order andfilled into the first N + 1 slots of thetableau. The modiflcation'needed inorder to accomplish this is shown inFigure 12.Figure 13 shows a typicaltableau, this one prior to the beginn-ing of Shellsort. Notice that extra in-formation is displayed in the smallarea surrounding the display. Bystuding the listing and carefully

July 1980

Page 23: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 23/84

A

10 9 1 13 5 21 7 20

10 9 1 7 5 2l 13 20

5 9 1 7 [ill 21 13 20

5 9 1 7 rm21 13 205 1 9 7 1m 21 13 20

1 m 9 7 r IT J21 13 20

1 m 9 7 [!2] 21 13 20

IT] m 9 7 r roJ21 13 20

rn m 9 7 [!Q] 21 13 20

III m 7 I E I I IT 121 13 20

m IT) 7 rn[QJ 21 13 20

II I rn [I]m[Q] 21 13 20

m rn I T Im ! I T J 21 13 20

I T J [ } ]I T J [ I ] I !Q ] 20 13 1mITJ ITI m[2Jlrn 20 13 [ill

IT I IT ! CQ[!II!£] 13 ~@I)

mm lTI0[2J 13 §J[ffi[TIl}] 1IJ1Il1rn1ill~[illIIl~ 12J01'§[fTI~@J

Call

Partition (A,1,8) ;

Partition(A,1,4) ;

Partition {A,1,1) ;

Partition(A,3,4) ;

Partition(A,3,3) ;

Partition(A,5,4);

Partition(A,6,8) ;

Partition (A,6,7) ;

Partition(A,6,6) ;

Partition(A,8,7);

Partition(A,9,8);

Figure 10Complete trace of Quicksort for

N = 8 boxed entries are known to bein the correct slot.

monitoring this information, extra Each time a number is movedinsight into the nature of the from one place to another in the ar-algorithms may be gained. ray, that value is highlighted in the

display. This is accomplished bymomentarily displaying the value inreverse video, then switching backto normal mode. If your APPLE hasbeen modified for lower case, thisprobably won't work. You can get agood idea of how each algorithmdoes its job just by watching thepattern of flashes on the screen.· Inaddition to this, as mentionedabove, each sort prints on theborder of the display some addi-tional imtormation about what Ishappening. Each program beginswith a prologue giving the name ofthe sort and prompting the user forthe number of elements to besorted. The value of PDL(1) is usedby the programs 10 control thespeed at which the display isgenerated. Thus to slow down the

All values generated are positiveand less than 100. This is donebecause of horizontal space con-straints in the display and does notreflect any inherent limitations inthe algorithms themselves.

The programs each carry out oneof the sorting algorithms.As the ar-ray is sorted, the values displayedon the screen are modified to reflectthe changes taking place internally.Various devices are used tohighlight this: some visual andsome aural. The audio effects areprogrammed using theProgrammer's Aid ROM. Thus, youmay have to remove or modify cer-tain statements in order to run theprograms, if you don't own PA.

July 1980 MICRO '-- The 8502 Journal

progress of the program, simply turnup the PDL(1)control.

While each algorithm is in pro-gress, two tones will be soundedperiodically. One tone is generatedeach time an array element iscopied from one place to another,that Is, tor each interchange. A dif-ferent tone is sounded whenever anarray element is compared toanother or to a -fixed value, that is,for each comparison. Listening tothe pattern of sounds thus producedgives a very definite auditory tattooto each algorithm. The calls to Pro-grammer's Aid which produce thesetones are localized in subroutines tofacilitate their removal or replace-ment should you not have the PAROM. For example, in the bubblesort demo, you may defeat thesounds by inserting the twostatements:

901 RETURN951 RETURN

Even If you do have PA, you maywant to use these statements inorder to (a) speed up the program alittle or (b) hear only comparisons oronly interchanges.

*NOTE: If you stop the program witha Control-c at just the right (orwrong - depending on your point ofview) moment, you may find thateverything is being displayed Inreverse video. To return to normaldisplay mode, simply type:

POKE 50,255

and all should be well.

I hope that these demonstrationswill enhance your understandingand enjoyment of sortingalgorithms you may wish to imple-ment similar demos for other sor-ting algorithms, or if you are veryambitious, how about a way of hav-ing the various algorithms swap inand out while the same array issorted in stages? Happy viewing!

A complete package of twentydemonstration programs, includingthe ones listed here and variationsupon them may be obtained for$14.95 on a single diskette bywriting to the author.

3467 Yellowstone DriveAnn Arbor, MI 48105

28:21

Page 24: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 24/84

1,8

1,4 6,8

1,1

3,3 5,4 6,6 8,7

Figure 11Call tree for Figure 10.Each node islabelled with the values of LowerUpper for the corresponding call:The levels of the tree correspond 10the depth of Ihe recursion.

$ 1 2 3 4 5 6 7 8 9- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

fJ ! 12 72 14 68 54 23 32 3 56 24

1! 44 26 41 fO 87 67 8 81 39 392! 3 26 60 64 35 2.~ 39 78 65 26

3 ! 16 17 99 69 81 B8 65 32 5 68

4! 37 44 32 89 65 37 2$ 38 84 77

5!

61

7 !

8 !

9!

SHELL SORTSPAN = = 10

J = = l ~A ( J ) = = 4 4

Figure 13Just before the start of the shellsort. Fifty elements are beingsorted.

80 For I ",,0 TO N: Am =: NEXT I90 For I = 0 TO N100 L = RND (N + L): IF A(L)

> := :OTHEN 100105 A(L) - I: X= L: GOSUB

DISPLAY110 NEXT I

Figure 12Modification to Display generation:will seed the initial array with exact-ly the numbers 0 to Nin some per-muted order.

9,8

Richard Vile was educated inmathematics, earning a B.S. degree

from Michigan State University anda Ph:D. from Cornell University.

Richard taught mathematics atEastern Michigan University from1970 - 1977. While at Eastern, hebecame interested in computersand began studying and teachingcomputer science.

In early 1978, he took a leave ofabsence from, E.M.V. in order towork for SYCOR, Inc. and Ann Arbormanufacturer of distributed dataprocessing computer systems. He

enjoyed the work so much that hedid not return to the academicworld. He is currently employed bythe same company, known as Nor-thern Telecom Systems Corpora-tion, where he is engaged in thedevelopment of languages andlanguage related software: com-pilers, assemblers, linkage editors,etc.

Richard owns an APPLE /I corn-puter, which he puts to good usepreparing articles for MICRO andother personal computing journals.

Richard C. Vile,.Jr3467 Yellowstone Dr.Ann Arbor, Michigan 48105

Continued on page 24•.•

Page 25: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 25/84

• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •i Safloware far lhe Apple il !~~ !• SUPERCHECKBOOK-a program designed to be an electronic supplement to your checkbook :• register. It's disk oriented and allows information to bedisplayed on the video screen or printer. •• It's super fast in sorting and retrieving information and totals. As an added bonus the program• can optionally provide bar graphs to screen andlor pr.inter. The program performs all standard •

•check register operations, i .e. reconciliation. Minimum requirements are Disk II and only 32K •

• RAM memory if Applesoft is in ROM; $19.95. •

•ADDRESS FILE GENERATOR-a program that gives you complete control over 8 name and •

•address file at a very low price. The power and flexibility of this software system is unmatched' •

•even in programs costing much more. You are allowed up to eleven fields in each record and •you can search and sort on any of these fields. In fact you can sort up to three fields at once. •

• The program contains a powerful print format routine which allows you to print out any field in •• anv format you wish. Minimum requirements are Disk II and only 32K R.AM memory if •• Applesoft is in ROM; $19.95

• WORLDOFODYSSEY-an adventure game to which all others must be compared. It's by far :• the most complex game for the Apple II. It will probably drive you crazy and take several •

•months of play to completely traverse this world. You have 353 rooms on 6 different levels to •explore with myriads of treasures and dangers. The program allows you to stop play and to

• optionally save where you are so that you can resume play at a later time without having to •

• repeat previous explorations. It's been called the best edventure game yet! Minimum •• requirements are Disk II with 48K RAM and Applesoft II in ROM; $19.95. •

• REAL ESTATEANALYSIS PROGRAM-The Real Estate Analysis Program provides the user •• with three features. al A powerful real estate investment analysiS for buylsell decisions and •• time to hold decisions for optimal rental/commercial investments. bJGeneration of complete •• amorization schedules. c) Generation of depreciation schedules. All three features are designed •

•for video screen or printer output. In addition. the program will plot; cash flow before taxes vs. •

•years, cash flow aher taxes vs. years, adjusted basis vs. years. capital gains vs. years, pre-tax •proceeds vs. years, post-tax proceeds vs. years. and return on investment (%) vs. years.

• Minimum requirement Applesoft II, 16K; $14.95. •

•• DYNAMAZE-a dazzling new real-time game. Youmove in a rectangular game grid, drawing or ••erasing walls to reflect balls into your goal (or to deflect them from your opponent's goal).

• Every ball in your goal is worth 100 points, but you lose a point for each unit of elapsed time •• and another point for each time unit you are moving. Control the speed With a game paddle: •• plav as fast as ice hockey or 8S slowly and carefully as chess. Back up and replay any t.imeyou •• want to; it's a reversible game. Integer Basic (plus machine language): 32K; $9.95 •

• ULTRA BLOCKADE-the standard against which other versions have to be compared. Enjoy •• Blockade's superb cembmatlon of fast action Idon't be the one who crashes) and strategy (the •• key is accessible open space-maximize yours while minimizing your opponent's). Playagainst •• another person or the computer. New high resolution graphics lets you see how you filled in an

•area-or use reversibility to review a game in slow motion (or at top speed, if that's your style). ••This is a game that you won't soon get bored with! Interger Basic (plus machine language);

• 32K; $9.95. •

• What is a REVERSIBLEGAME? You Canstop the play at any point, back up and then do an •• "instant replay", analyzing your strategy. Or back up and resume the game at an earlier point, •• trying out a different strategy. Reversibility makes learning a challenging new game more fun. •• And helps you become a skilled player sooner. •

• •Available at your ProgramsA llai/able on Diskerte •

• local computer store ar $5.00 Addirional •DEALER INQUIRIES INVITED

• - Check or Money Order •

•Call or write for our free _ Include $1.00 for

-SOFTWARECATALOG POHTEH§OFT. INC. shipping and handling •

• 7 • C.O.D. '$1.15 add'tl. charge) •• Apple II is a registered P. O. BOX J 57 • Master Charge and VISA •

tnldemark of PITMAN, NEW JERSEY 08071 orders accepted• Apple Computer, lnc. (609) 589-5500 • New Jersey residents add •• 5% sales tax •

...............'

.

Page 26: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 26/84

Page 27: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 27/84

)" '1 ,:u :QLIS' I

lOB11()

:I .: ' ':;0:I .~ 5 : 1 ,

I :i41.~:i5

1 ~,:;6

l:,'jG1~;91601631.66160, " ' r;:,.I. I -,J

,i,7H

llJO

i a s: : ~ ( > ( Jz o z

Listing 2IN SE RTION SORT

( ; 1 :" :.1 : ::Y: :. : i '~~ DIM A( </5' ),~ KDI)::~' ' '16304:CU~::;u ' '16360~ITLL=:

50() i INTrW=10QO7 DIGPLA)~600 :WAl 'r=800 :COMPAR[=

~ )OO ; INTCI<:CHANGE=9508 MUSIC=-lQ473:TIME=166: 'CIMBRE=

765H'ITCH=7679 DELAY=975:ERA5E=65010 TEXT : CALL -93620 GOSUI~ INTRO50 GOSUB TITLEflO

1.0010~5

FOR R=O TO 99:A(R)=32767:RFOR 1=0 TO NACI)= RND (lOO):X=l: GOSUD

DlSPL?l'tIF N=O THEN 150NEXT IFUR 1=1 TO NIF I)N THEN 206:Y=A(I)VTAI-< 23: TAB 32: PiUNT "I::::";;: IF 1<10 THEN PIUNT lin ;: ~PfUNT I

VTAS 24: l 'AD 32: PRINT "Y="; ~ IF 1'<10 THENPIUNT II ";' ~

F ' f . : I N Ty ~GOSUD INTERCHANGEFOR J=I-l TO 0 STEP -1GOSUB DELAY:KEY= PEEK (KBD): IF KEY(128 ' fHEN 159F'ma:: Cu-~,Q; GOSUD WAITGOSU:O COMPAi~EIF Y>A( .1) THEN 2()2f;\ , , 1+1 ):::;M ,J )GOSUB INTERCHANGEPOKE 50~63X=J: GOSUB DISPLAY: GOSUB DELA~X:::,J+ 1: GOSUD D lSr-LAY: GOSUDDEL.AYPOKE 50~255' GOSUD DISPLAY:GOSUli DELAY

NI:XT

X=J! GOSUBERASENEXT ,JA( .J+1 )=y

203 POKE 50~63 : X=J+ l : GOSUB DISPLA204 GOSUB INTERCHANGE206 POKE 50y2551 GOSUB DISPLAY,2\16 NEXT I

520

525

530b O O61062063(>6:~~)6l ·O650655

500 TEXT : CALL -93651 0 VTAB 1: FOR 1=0 TO 9: ' r~B 7

+3*I: PRINT 1;: NEX1 ' I515 ViAD 2: TAB 7: FOR1=0 TO 9

: PRINT "---";: NEXT IFOR J=O TO 9: VTAB 3+2*J~ T~B+: PRINT .n"! lin NEXT JVTAE 23: TAB 13: PRINT ~INSERTN SORT"RETURNCOL=X MOD 1()ROW=X/10VTAB 2*ROW+3: TAB7t3*COLIF A(X)<i~ THEN PRINT ~ "iI : : 'R IN T A ( X );RETURNCOL=X MOD10:ROW=X/I0VTAB 2*ROW+3: TAB 7+3*COL

6bO PRINT II ";

670 RETUliN800 IF KEY<> ASC( "C~") THEN 810805 TEXT : CALL -936: END810 KEY= PEEK (KBD): IF~E'«128

THEN 81()

320 POKE CLR~O: RETURN900 REM * * * TO REMOVE SOUND FO

F'AfnSONS - INSERT 901 r<ETUHN**

9(J~j_91()9:iv

Qr;"r.:"I , ."" .J

960

<:IBO100()

:l (J o :J .

:l.()()2

1008

VTAE 24: TAB 15 : PRINT10:1.(;

"FINISHE H/12:L() 13'"

210 IF PEEK (KBD)(128 THEN 210220 POKE CLR,O: CALL -936: GOTO

20

:lo : l.sI ; 1 : . :? ( l

F'OI,(E PITCHdQ ~ POI\[ TniE~5:Uil.. L rlUS1C

GOEjUI! DELAYI~ETUF\NREM ***TO REMOVE SOUND FORn~CHANGE~J INSEf(l' 9:i1 r~ETW(N **POKE PITCH,49! POKE TIME,3 :CALL MUSIC

GObUB DELAYi~ETUr<NFOR DE;l TO PDL (1) : NEXT DEf<ETUF:NVTAB 10: TAB 5 : PRI~T "IWILL SORT UP TO 1()O POSITIVE"

TAb 5 ~prnNT II I NTEGEf~S INTU ANDING"TAB 5: F'HINT "OI:;:DEi~ USING THE5Ef~T I ON SORT +"

VTAB 15 : TAB 10:INPUT "VALUEN PLEASE",NUM; N=NUM-"l

I F N ) : : : : QTH EN 1 0 1 3TEXT :CALL - 9 3 6 : ENDIF NUM(=100 THENRE1'URNTAB :toPFUNT "TOO BIG! !! ! !"; GOlD1(J o 0

Page 28: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 28/84

Listing 3SELECTION SORT

F'F~~:OLIST

V l : : : , ] : : : : ' ( = : N

:! .( J (l2('2203

204

212

'5 D,nl A( 99 )6 KDD= -16384&CLR=-1636 e~T ITLE=

500:INTRO=lv(lO7 DISPLAY=600:WAIT=BOO;CMP=900: INT:; 950

8 MUSIC=-10473 :TIME=766 :TIMBRE=765tPITCH=767

9 DELAY=975~ERASE=65010 TEXT : CALL -93620 GOSUB I,NTRO

GOSUB TITLEFO R 1 : : : 0 TO NA( 1)= RND (100 ) : X=I; GOSUBDISPLAYNEXT IFm~ 1=0 TO N-lM~IX=O

501. ()O

105

1 .1 .01501 '"•.J J.

155

VT(-lB23 ; TAB 32: PIUNT "1="; : IF 1<10 THEN PRINT" "; ,F 'I=<INT I

For~ ,J=1 TO N-IKEY: ; PEEK (KBD): IF KEY(128THEN 158

POKE CLR,O: GOSUB WAITGOSUB DELAYGOSUB eMPIF A(J)<=A(MAX)THEN 2()0

MAX=.)VTAD 24; TAB 32: PRINT UM= "~: IF MAX<10 THEN PRINT" . .

'515

". ") r::, . .J . . .~.~..J

530

600610b2063(16:556~()

800no~581<1

VTAB 2: TAB 71 FOR 1=0 TO 9: PF<INT "----"; : NEXT rFOR J=O TO 9: VTAB 3+2*J: TAB-4 : P R I NT ,H"! ";: N EX T.JVTAB 23 : TAB 13 : PRINT

"'SELECTIO

N SORP'RETURNCOL=X MOD 10ROW=X/l .OVTAB 2*ROW+3: TAB 7+3*COLIF A( X )<10 THEN PIUNT II ";

PRINT A( XHRETURNIF ! ,EYi ASC( "0" ) THEN 810TEXT : CALL -936: ENDIF PEEK (KBD)(128 THEN 810

H15 POKE CU~,O849 RETURN900 REM *** TO REMOVE SOUND FO

PARISONS - INSERT901 RETURN **

9()2

90SS ' :1 . ( )

950

POKE PITCH,10; POKE TIME,S;CALLMUSIC

GOSUB DELAYRETURNREM ***TO REMOVE SOUND FORERCHANGES - INSERT951 RETURN *

*POKE PITCH,49: POKE TIME,3 :Cf~LL MUSIC

GOSLJB DELAYF < E TURNFOR DE=l TO PDL (1) : NEXT DERETURNVT~HI 10: TAD 5: PRINT "I WILL SRT UF' TO 100 POSITIVE"TAB 5 : PRINT "INTEGERS INTO ANDING"

1002 TAB 5 : PRINT "ORDER USING TH

LECTION SORT.II

1?5:5I?bO97~:;999

1 (l o0

ico i

: I. ( /(l B

.l(llOlOll

215 VTAB 24; TAB 15: PRINT II FINISHEr H)13"; J.(!l~':j

218 IF PEEK (KBD)(12B THEN 218 1020220 POKE CLR,O: CALL -936: GOTO

20500 TEXT : CALL -936510 UTAD 1 : FOR 1=0 TO 9: TAB 7

+ 3 * 1 : PRINT I ; : NEXT I

1.56

: 1 .571 sa159:160

.1.63165

; : PRINT MAX;168 F'O.KE50,631 7 5 X = : J : G O S UBDISPLAYJ7D1 B~:)

POI,E 5(1 ~25'5X = : J :GOSUB DISPLAYNEXT .JTEMP=A(MAX): GOSUB INTA(MAX)=A(N-I ) :X=MAX: POKE 50, 63 : GOSUB DISPLAY: GOSUB INT:POKE 50,255; GOSUB DISPLAY

ACN-I)=TEMP:X=N-I: POKE50~63 : GaSun DISPLAY: GOSUB INT:POKE 50,255: GOSUB DISPLAY

NEXT I

UTAB l.~;: TAB 10: INF'UT "VALUEN PLEASE",NIF N>O THEN 1013TEXT : CALL -936: ENDIF N<=99 THEN RETURNTAB 10Pf<INT "TOO BIG! ! ! ! ! 10 : GOTO1000

Page 29: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 29/84

>PR:B=O>I~1ST

100 DIM A(99),INCS(5)105 MUSIC=-10473:PITCH=767:TIME=

766: TIMBRE=765 : POKE TIMBRE,

: 1 . 1032KBD=-16384 :CLR=-1636S :TITLE=4()O:INTRO=1000DISPLAY=500;WAIT=800;CMP=900tINT=950

DELAY=975:ERASE=550TEXT : CALL -936GOSUB INTROGOSUB TITLEFOR 1=0 TO NAC I ) = RND (100 ) :X=I : GOSUBDISPLAYNEXT I

1.20

125J.301401501.60: 1 . 70

:1 .8(1190 INCS(1)=10 : rNCS(2)=6~INCS(3

)=4 : INCS(4 )=2 : INCS(5 )=1FOH 1=1 TO 55PAN=INCS( I)IF SPAN)N THEN370VTAB 24; TAB 12: PRINT;IF SPAN<10 THEN PI~INT "

2fJ()

zi o211215 "SPAN=II

. ,.. .~, .PRINT SPAN,

220 FOR J=SPAN TO N230 Y=Ae J) : GOSUB INT

~?'·H)2·i~!:5

?6(J~.~) ~~)27(1?U()285

287:H?O3(lO

30!:5~, o"',' -) ,.,:, ~.. '..I

3 ~2~.5~~~(;

3403~)o3b()~)/!O: : ; [ : )0

VTAfi 2 3: TAl~ 28: PfUNT ".J= II

, : IF J<10 THEN P1UNT " II; ~

prnNT .JTAB 26 : PR INT "A(.J ):::" ;: IFAeJ)(10 THEN PRINT II "iPOKE 50v63: PRINT A(J) ; : POKE50,255FOR K=J-SPAN TO 0 STEP -SPA~GDSUB Ci"lPIF Y>ACK) THEN 320POKE 50~·63GnSLlE< INTA( !\+SPAN )=A( K )X~K'~SPAN: GOSUB DISPLAYKEY= PEEK (KBD): IFKEY<128THEN 290

POKE CLR,O: GOSUa WAITGDSUB DELAYPOKE 50,255: GOSUB DISPLAY

X=:K: GOSUB ERASENEXT K

LiSting 4SH ELL SO RT

140400 TEXT : CALL -936420 VTAS 1: FOR 1=0 TO 9; TAB 7

+3*1: PRINT 1;; NEXT I430 VTAH 2: TAB 6: FOR 1=0 TO 9

: PRINT ".-_ " ; t NEXT I440 FOR J=O TO 9: VTAB 3+2*J' TAB

4: PRINT Jjll! "~: NEXT J

450 VTAE 23: TAB 10: PRINTU SHELL SORTII4·60 RETURN500 COL=XMOD 1051 0 ROW=X/l0520 VTAB 2*ROW+3: 'rAB7f3*COL530 IF A(X)<10 THEN PRINT II "~

540

c· ~:-l::-d.J.J

'560599800au~58:l.(J

f) ;~()v o o

?(i !: ; j

949

950

96(l( j ' t7~5?99\ 000

to 10

[02(l

POKE 50: t63GOSUl< INTACK+SPAN)=Y:X=K+SPAN: GOSUBDISPLAYG () SUB DELAYPOKE 5uy255: GOSUB DISPLAYNEXT .JNEXT IVTAS 24: TAB 12: PRIN'r uFINISH=·OOO

390 IF PEEK (KBD)(128 THEN 390

395 POKE CLR,O: CALL-936: GOTO

PRINT A( X HRETURNCOL=X MOD 10lROW=X/10VTAE 2*ROWt3: TAB 7+3*COLPf<INT" ";RETUI; :NIF KEY<> ASC(IIQ") THEN 810rEXT , CALL -936: ENDKEY= PEEK (KBD); IF KEY<128THEN 810

POKE CLR,O: RETURNREM ***TO REMOVE SOUND FORPf-' IRISONS- INSERT 9()1 f<ETU1~N

COM

**POKE PITCH,lO: POKE TIME,3:CALL MUSIC

GOSUBDELAYRETwm

REM ***TO REMOVE SOUND FORERCHANGES - INSERT 951 RE1'UR***POKE PITCH,49: POKE TIME,3:C tl LL MUS IC

GOSUB DELAYRETUF<NFOR DE;1 TO PDL (1) : NEX"f DERETUI~NVTAB 10: TAB : .: ;:i~INT "I WILL 50Fa UP TO 1(>0 POSITIVE"TM! 5: p r<IN T n INTEGEI;;:S INTO ASCENDING'I

TAB 5: PRINT "ORDER USING THEEl.L. SORTI!VTAB 15: TAB 10: INPUT "VALUEN PLEASE",N

IF N)O THEN 1060: CALL -936: END

1060 IF N(=99 THEN RETURNl()70 'H'IB 10ioac PF.:INT "TOO MANY!! ! ! !":

100(JPOKE CU<, ()

GOTO

z oH ) I··e-y :;::P!='FI\ (KBD)' IF K·E· 'T'128\t: .THEN 2010 •

2020 POKE CLR,O: RETURN

Page 30: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 30/84

>LIST

UsUng 5QUICKSORT

5 DIH A(200),STACK(24)6 KBD=-16384 :CLR=-16368:T ITLE~

5000: INTRO:;:l()(jOO7 DISPLAY=6000:CMP=6500:DELAY=

6600S MUS1C=-1 (1-473: TI H(>:7 66 ~T Ii·ii:n:~C·:::

765; P I TCI·-I' '=7.iJ/10 TEXT : CALL -936

20 GOSUE-i I j">lTno5 0 GO SUB T I TL E :1 0 0 FO F ~1==0 TO r · l105 A( I}:::: R N D (100 );X;:;;I~ CQSUfl

DISPLAY110 NEXT I115 A (N tl ) : : : 3276 7120 P=O:tl=N125 TOP=O :MAXTP=O130 IF P)=Q THEN 170135 K=CH-l137 VTAB 23 ~ TAB 34·: ::~RIN T :,e"~ L,

5 00 STACK (TOP tl )= Jt l505 STACK< TOPt2 >::: :Q510 Q=.,)-1515 GOSUE! 700 0599 RETURN1145 V=ACP): I =P : J=K1160 J: ;: J-l :IF A(J)(=V THEN 1170

1162 GOSUB DELAY1165 GOSUS CMP:GOTa 11601170 1=1+1: IF A(I)=V THEN 1180

1172 GOSUB [ IELAY1175 GOSUB eMP:GOTO 11701180 I F J(=I THEN 12001185 TEi" ' iP::;A()1186 ACI);A(J) :X=I: GOSUB DISPLAYI1B8 A(J)=TEMP: X=J: GDaUBDISPLAY1195 IF PEEK (KBD)(128 THEN 1160

;: IF P< lO() THENPRH·iT: IF P(:L(! THeN PHINT "P

" "1 1196I: ;, ~ I" ·r : : J : i> i · j11 99

1 ~ )OO

138 TAB 34-: PRINT "Q ;;;; ";: IF )\<100 THEN F'F:INT " "~t IF i,(lvTHEN PRINT ""~t PfG r-lT 1"<~

139 GOSU:O 1145140 IF J-P(Q-J Ti0EN 150143 GOSUB 4·()O14·4 GOlD 160150 GOS! . . J :O :jQ(J

IbO TOP==TOP+2161 IF TOP>MAXTPTHEN MAXTP=fO?

162 VTAB 24; TAB 23: PRINT(TUr l2);163 I F PEEK (1\£1[1 » = 1 ::'B THEN GO:3UB

8()OO165 GOTD 130170 IF TOP=O THEN 208175 Q=STACKCTOP) :P=STACKCTOP- l)

:TOP=TOP-2176 GOSUB7500177 VTAB 24: TAB 23 : PRINT (TOPI

2H179 IF PEEK (KFD»=128 THEN GQSUB 5099

8000 6000180 GOTD130 6010208 VTAE 24: TAB 4:PRINT "F IN ISHED" 6 02 0

; 60 :~.Q

209 T~IB 15: PRINT "MAXTOP= ";( MAXTP 60402); b050

210 IF PEEK (KBD)<128 THEN210 6060220 POKE CLR,O: CALL -936: GOTO 6070

20 6080400 STACK(TOPtl)=P 6090405 STACKCTOPt2l=J-l 6100410 P= . j t l415 GOSUl! 7000

499 RETURN

1202199~t50005010

5020

5030

GOBUB8(!00

GDTD 1160ACP)=A(J) :X=P: GaSUB DISPLAYA(J)=V:X=J! GOSUB DISPLAYRETURNTEXT : Ci~LL ·-936VTAD 1: FOr~ 1'.;:0 TO 9t T?'lB l

+3*1: PRINT I; : NEXT IVTAE 2: TAB 7: FOR 1=0 TO 9: PI:;;I NT u ,__ ._";: ~ NEXT IFor.;; ·J:~:O TO19: VTrUI J+,]: Tr4B3

~50:5~:i IF ,J < :1() THEN I:;'ru NT " LI;: PI1 I NT

J; " ! "~t NEXT J5040 VTAB 23 : TAB 3 : PRINT "QUICKSOFART IT I ON===~:::;:::::::::> "

504~'j

5050

5060

6110

VT{:\H L~~~: TAB 15: PfnNT "PENDING:0" ;VTAB 5~ TeUI3!Tt PHINT "S ": T f~B39~ PRINT "T": TI~B 39: F'f~INT"A" ~ TAD 39~ PRINT "C": T,~:O39: PRINT "K"FOR R=10 TO 22t TAB 39:PRIN1·" . " ' : NEXT R 'RETURNCOL=X MOD 10ROW;;;;X/10POKE 50,6.3VTAB ROW+3: TAB 7+3*COLIF A( X)(10 THEN PIUNT " II ~

PRINT A( XHPOKE 50,255VTAB ROWt3 : TAB 7t3*COLIF A( X )<1() THEN PRINT )1 "~

P R IN T A ( X );REM * * *TO REMOVE SOUNDFOR INERCHANGES -I NSEF<T 6 10 i RETURN*

* *POKE PITCH,49: POKE '· IME¥3 :CALL t-HJSIC

Page 31: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 31/84

61996500

6510

6599

6bOO669970007005

7010

7015

74997500

July 1880

RETURNREM ***TO REMOVE SOUNDFOR COMPARISONS - INSERT 6501 RETURN* **POKE PITCH, lO: POKE TIME,5 :CALL MUSIC

RETURN

FOR DE=O TO PDL (1 ) : NEXT DERETURNVTAH 21-TOP:TAB 37TOS=STACK(TOP+l) :NOS~STACK(TOP+2 )IF NOS<100 THEN PRINTII ";;

IF NOS(10 THEN PRINTII "i:PRINT NOS

TAB 37: IF T05 (100 THEN PRINT" "; : IF T08(10 THEN PRINT. . "; : PRINT TOS;RETURNVTAD 21-TOP; TAB 37:PRINT" ": TAB 37: PHIN T" " ;

79("/9 RETURN8000 POI,E CLR, 08005 IF PEEK (KBD)(128 THENB005

8(>10 POKE CLfi,O80 <[9 RETUI;:N

10000 VTAB10: TAB 5: PRINT "IWILL S

RT UP TO 1(>0 POSITIVE"10010 TAB 5; PRINT "INTEGERS INTONDING"

10020 TAB 5: PRINT "ORDER USING HS QU IC I'SORT."

10030 VTAH 151 TAB 10: INPUT »VALUN PLEASE I I ¥ N

10040 IF N)O THEN 1006010050 TEXT : CALL -936: END10060 IF N<=199 THEN RETURN10070 TAB 1(>:l (lOBO pr~INT "TOO DIG.! ! !. [": GOlD

1000(J

GraphicsNormal, Inverse,In 2 Sizes r

THE TX-80 MATRIX PRINTER

The Mp-250 PLOTTER

only $695.FEATURES: Plots 0 n sten <lard papersheet; compact IJni~ built-in home rune-non to lower left-hand comer; needs only 6bits of one parallel output port; choice ofpencolors and line widths; comes with lullvector software; driven by one parallel portor optional lnterfaces: easily changeablepens,

TRS 80 or APPLE Interfa .;es Available .

SPEED: 58LPM, 125 CPSINTERFACES: Parallel standard [EEE488 and serial RS·232

optional, (Apple type parallel card andcable _. _ $gg.)

CHARACTER SET: Full 96 Character ASCII Set (upper and

lower case with expanded print) .PRINT HEAD: 100 x 10 6 character life expectancy.

ORAFTRAX OPTION· full dot addressable graphicS (480dots/line) with Automatic print head pro-tection on dense pictures plus form feedand skip over perforation.

FREE! APPLESOFT-WAREfor graphics dump included

*UPDATE EARUER TX-80's TO GRAPHICS for 899. 00

SPECIFICA nONS:PAPER SIZE: B'/>" x 11".

or 11" wide continuous.RESOLUTION: .OO5"/s t.ep ACCORACY:±0.5%ID 17" Pl .OnING SPEED: Up to

(1.27mm/step). (43cm) or better. 2.5" (6.35cm) sec.

MICRO MOSIC BOARD for APPLE II $175.HAS 4 VOICES & BUILT-IN AMPUAER

SOFlWARE: ULTIMATETRANSFER ROAD RAllYEUNCOP'( - Make App le T.. lepnoneTr.m.*r program HIRES Driving Game

disks I l I 1COPY ' I I *82995 for APPLE n..", $25 :::~~t81495DC HAY E Sl'IItromodem • u"""""

Computer Comer of New Jersey439 Rt. 23. Pompton Plains. N.J. 07444 (201) 835·7080DE!dER II'IQ(llRIES tNVrTW MasteR:horge& VIsa O.K. PRICES SOBJtCT TO CHI\ l' 1GE

MICRO -. The 8502 Journal 26:29

Page 32: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 32/84

A C C O U N T IN G SO F T W A R EY O UO RACCOUNTS RECEIVABLE

Sound business management requires you to keepup-to-date reports regarding the status of your accountsreceivable.

Now, from the same company that revolutionized ac-count ing on the Apple II computer, with their conversionof the Osborne/McGraw-Hill General Ledger program,you may now obtain the Accounts Receivable package you

have been waiting for.Our package allows you to assign your own alpha-

numeric customer code up to six characters. Date of thelast activity, as well as amounts billed this year and last

year are maintained. This Accounts Receivable systemmaintains six digit invoice numbers, six digit job numbers,invoice amount: shipping charges, sales tax (automaticallycalculated), total payments as well as progress bil ling in-formation. You may enter an invoice at any time; beforeit's ready for billing, after you have billed it, and evenafter it's paid. This package also prints reports which listthe invoices you have not billed yet, open items, paiditems, and an aging analysis of open items.

In the final analysis. making your bookkeeping easier is what our software is aUabout. With our General Ledger packageyou can format your own balance sheet and income statement. Department financial statements may be formateddifferently. You have complete freedom to place litles and headings where you want them, skip lines or pa.ges betweenaccounts and generate subtotals and totals throughout the reports - up to ten levels if you need them. Accounts

Receivable is designed to provide you with complete up-to-date information. The program wil l print customer statementsas wfll as POSt invoice amounts to any of the 3.CCQUnlSmaintained by our General Ledger package. These packages willsupport any printer/interface combination. General Ledger requires one hundred ten columns, Accounts Receivablerequires one hundred thiny columns.

GENERAL LEDGERIf you are a business peTllOnwho is looking for ultimate

performance, take a look at [his outstanding GeneralLedger package from srnaU Business Com pUler Systems.

Our package features six digit account numbers. plusthirty-one character account names. We have ten levels ofsubtotals. giving you a more detailed income statementand balance sheet with up to nine departments. Ei ther

cash or accrual accounting methods may be used. Thecash journal allows a thirty-three character transactiondescription and automatically calculates the proper off-setting entry. You may print the balance sheet and incomestatement for the current month, quarter, or any of theprevious three quaners. Also, this year's or last year'stotal are included on the income statement , depending onthe current montb.

There is virtually no limit on entries, since you mayprocess them as often as you like. Two thousand (1,000from G/L. 1.000 from any external source) can be pro-cessed in one session.

Sua-eel R.otoil:Individ....uy '180.00T.,...w:r ._ .1550.00

SMALL BUSINESS COMPUTER SYSTEMS.1~Cren""ood

Lincoln, N<Ir.ub 68504(402) 4ti1·1878

A.ailabl. fmm your IocaJ AppleDeo"' r or con""" SBCS

fE T and ti?LE IIUsers

PASCAL

ABACUSSo t ' t w a r l !lakes av a i l ab l e its v l? rs iO llo f T IN Y

PAS CA l fo rL h eu s e r s o f lw oo f t~ n 0 5 tp ~p ~ la r p ers~ ~ ilCOII>Ut.ers I

T INY PA SCA L is a su b se t o f th e s tan ~ rd PA SCA L asdE! tined b ': lJen sen an dWirLh. It includes th e strudureJPrwiII.inS features: IF - THEN -ELSE , REP£AT -Um L, FG R TO I_ TO -DO , WH ILE-DO , C f\SE -O F- R S E , FUNea n dPRO t . Nc " ,! : IOUca n learn th e 1am il li l :lelhat is!ila ledt'l becll:iethEsu c c e sso r to B AS IC .

T IN Y PAS CA Lis a cOIPI l! teP a CK a ! et.h~ta l loss ' :IOUtocreaLe, caapile ande x e cu t e pro~ra.s wri t t en i n the PAS~ALla ng u ag e . Y o ucan s a v e source a nd o i: lje rtcllde en d i s t , e t t eor casselteCPET v~rsio:l o:lhil. Ihe clll,~('eih'nsivt1user'sl i n ~ a l c a nb e e xa a i n ed f e r $ 10 ( r e f~ n d ac le w i t h s c f tv ar e l .

R EQU I R EMENT SPETUM 3 2 KN eli R llM Sca s el t!! H '~PET16~/32kNewROMSdisr.elte $35A p p le II 3 2 kApplesofLROMw / DG S$35A p p l eII 4 2 kA pp le s c f t RA Mw /D l5 $ 35T IN Y PAS CA LUser's Man u a l $106 5 0 2In te rp re te r L is lin !l S 2 C

F RE Eposta~e inU . S .and CAN ~ DAAU order s f1'epai d or CDD

ABACUS SOFTWAREP. O. Box 7211Grand Rapids, Michigan 49510

DISK DRIVE WOES? PRINTER INTERACTION?MEMORY LOSS? ERRATIC OPERATION?

DON'T BLAME THE SOFTWARE!

~~O'2

Power Line Spikes. Surges & Hash could be the culprit!

Floppies. printers, memory & processor often interact!

Our unique ISOLATORS el irninate equipmen t interaction

AND curb damaging Power Line Spikes, Surges and Hash.

~ISO LATOR (ISO·1 AI 3 filter isolated 3·prong soc kets;inte9r;. Surge/Spike Suppression; 1875 WMaximum load,

1 KW load any socket $56.95·'SOLA TOR (150·2) 2 fi lter isolated 3.prOOjl socket banks;

(6 sockets total); inll!gral Spike/Surge Suppression;1875 WMax load, 1 KWeither bank. . . . . .. $56.95

·SUPER ISOLATOR (IS().3), similar to ISO·1Aexcept double fillering & Suppression .... $85.95

*ISOLATOR OSO·4), similar to ISO·1A exceptunit has 6 individually filtered sockets. . .. $96.95

·ISOLATOR IISO-5). similar to ISO-2 exceptunit has 3 socket banks, 9 sockets total ... $79.95

·CIRCUIT BREAKER, any model (add-CB) Add $ 7.00·CKTBRKR!SWITCH/P,LOT any model

(·CBS) Add $14.00

• PHONE ORDERS '-617-655-1532 ti iL£7 Electronic Specialists. Inc.

171South M.ln Streel, NatiCk, Mass. 01760DepL MI

Page 33: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 33/84

"Hello, World"

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ~ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .A very Inexpensive analog interface is presented thatcan be used with any microcomputer. Some PEToriented programs are provided, including a STAR ACEgame, to show how the device may be utilized.. . . . . . . . . . . . . . . . . . . .~ . . . . . . . . . . . . . . . . . . . . . . . . .~ . . . . . . . . . . . . . . . .

When I bought my PET,one of thethings I eventually wanted to dowasto interface the computer to the out-side world. Overthe two years sincethen I have seen interface devices ofone kind or another,but all of themhave been fairly expensive, andmost are designed for a single ap-plication. I have finaly found one ln-terface, however, which is cheap,Simple enough for even the laziestSunday solderer to build, and isuseful for a variety of real world ap-plications. Byplugging in a joystickor two, arcade-type games can becreated. If the interface is used todense switch settings, educationalprograms or game show reocreations can be easily made. Ad-ding a potetiometer or thermistor asa sensor permits measurement oftemperature, wind direction or otherexternal conditions. All in all, it isthe best way I have found for thePET owner with a tight budget tobranch out into new areas.

The interface uses a single in-tegrated circuit - an NE555 timer.The principle of operation is to hookup the timer as in Figure 1so that itemits a pulse when triggered by thePET. The duration of the pulsedepends upon the magnitude of theresistance, R1, in the circuit. Bytlrn-ing the pulse duration with the PETinternal clock, the resistance can bemeasured. Thus, any device whichtranslates an external quality into aresistance can be used as a sensor.Using the circuit requires three

July 1980

elements: a 5 volt DCpower supply,the 555-basedtimer and a sensor. Ifyou don't already havea power sup-ply there is no needto buy anexpen-sive one just for this application. Ifound that a small kit such as theJameco JE 200 is adequate, lnax-pensive ($14.95) and can be puttogether in less than an hour.As forsensors, the cost and availabilitydepend on what you want to do. Asimple measure of displacementcan be made with a potentiometercosting less than a dollar. Precisionprobes for temperature, onthe otherhand, may be expensive and hard tofind. The third element, the NE555,costs about 60· and a four timer in-terface with board, wire, connectorsand the like can be constructed forabout $10.

Interface to the PET is madethrough pins PAO - PA7 of theparalle! user port shown in Figure 2.These eight pins can be programm-ed for either input or output bychanging the contents of memorylocation 59459(E843).If bit n of thatlocation is a zero, PAnwill be an in-put pin. If bit n is a one.•PAnwill bean output pin. For example, POKE59459,15will make pins PAO- PA3output and pins PA4 - PA7 input.Onceprogrammed, the pins are reador driven via location 59471(E84F).In this way the user port can be pro-grammed so that one pin is used asoutput to trigger a 555 and anotherpin is used as .lnput to sense theduration of the timer pulse. Since

MICRO -- The 6502 Journal

John Sherburne

there are eight pins, four 555s canbe connected without resorting toencode/decode arrangements.

Figure 3 is a schematic of a four555 interface. The interface is suffi·cient to handle two joysticks -each of which has two poten-tiometers or four individual sensors.Two NES56s could also be usedsince the 556is a dual 555. The pinby pin connection for each of the555s is as follows:1 Connect to ground.

2 Trigger.Connect to output pinof users port. This pin is nor-mally high r+ 5V). Whenbrought momentarily toground, it starts the 555 out-put pulse.

3 Output. Connect to users portInput pin. This pin is normallylow (ground). During the out-put pulse it is high.

4 Connect to + 5V.

5 Connect to ground throughbypass capacitor C2

6 Connect to + 5V through sen-sor R1and connect to groundthrough timing capacitor C1.

7 Connect to pin 6.

8 Connect to + 5V.

Each of the four 555s in Figure 3

26:31

Page 34: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 34/84

"DOODLE"

10 RT=2 0: UP= 1220 POKE 59459 ,1530 REM CALIBRATE JOYSTICK IN CENTER40 PRINT lIC.c l e a r ]PLACE JOYSTICK IN CENTER.53 ANY KEY WHEN READy .1I50 GET A$: IF A$="" GOTO 5060 POKE 4 0, 16 : POKE 41, 1: SYs (9 77 )70 A=255-PEEK(42)+2S6*(2S5-PEEK(43»80 POKE 4 0, )2 : POKE 41, 2: S y s( 97 7)90 B=255-PEEK(42)+2S6*(255-PEEK(43»100 AL=.6*A:AH=1.2*A110 BL=.6*B:BH=1.2*B

is connected the same way. The fourtrigger pins (pin 2) are connected toPAO - PA3 and the four output pins(pin 3) are connected to PA4 - PA7.The PET ground is connectedthrough R2 to the IC ground (pin 1).

The output pulse duration of the555 is dependent both on Rt and C1.As C1 is increased in capacitance,

the pulse is longer. A .01 yfcapacitor works well for moderatesensor resistances (50K to 1 megohm). For lower resistances, ahigher capacitance is needed.Capacitors must be high qualitymylar for stability. The duration ofthe output pulse also increases asR1 increases. If there is noresistance at R1, that is, pin 7 isshorted to + 5V, the pulse durationwill be essentially zero. An open cir-cuit between pins 5 and 7 will causean almost unending pulse.

To measure the duration of thepulse, one of the timers associatedwith the parallel user port is access-ed. The timer is two bytes long anddecrements with every cycle of thePET clock (every microsecond). Theleast significant byte of the timer Isat locatlon 59464 (E848). It starts at255, counts down to zero andrecycles. The most significant byteis 59465. It starts at 255 and countsdown each time 59464 reaches zero.The speed ot the timer requires thatmachine language rather thanBASIC be used to access it Pro-

gram 1 is a simple assemblylanguage program which drives onepin of the user port low then high,starts the timer and waits for theend at the output pulse of the 555.The pulse length is then stored inlocations 42 and 43 (2A and 28). Thepins to be used for output and inputare determined by memory loca-tions 40 and 41 (28 and 29), respec-tively. For example, if bit 6 of loca-tion 41 is a one, then it takes 16clock cycles to start the outputpulse and check the input pin, 16microseconds is the minimum pulse

width that can be measured in in-crements of 7 cycles beginning at 16(16,23,30 ...).

Once the interface has been con-structed, Program 1 can be used totest its operation. First connect pin6 of each 555 to + 5V, then load Pro-gram 1 and key in the following:

10 POKE 59459,15

20 FOR I = 0 TO 330 POKE 40, 16*2

I;SYS(977)40 A = 255-PEEK

+ 256*(255-PEEK(43))50 PRINT A: NEXT

I:POKE 41,2

(42)

The result should be that A isabout equal to the minimum 16 ineach case. The program assumesthat four 555s are present with pin 2of each connected to one of the firsttour pins of the user port. Pin 3 oteach 555 is connected to one of thelast four pins of the user port. Thatis, if pin 2 of a 555 is connected toPAn, then pin 3 is connected toPAn + 4. If there is a mistake in wire-ing or software the result will pro-bably be a list cursor type crash.

The easiest sensor to connect inthe circuit is a simple switch. If a50K resistor is connected across thepoles of the switch, the switch will

present no resistance in one posi-tion and a resistance of 50K resistoris connected across the poles at theswitch, the switch will present noresistance in one position and aresistance at 50L in the other posi-tion. Connecting four such switchesIn series with a different resistanceacross each one enables the 555 todetermine which of the four swit-ches has been thrown. If normallyclosed push buttons are used withresistances of 50K, 150K, 300K and600K as buttons are pushed, aresistance of 50K when button #1 is

pushed, 150K tor #2, 200K for #1 and#2, and so forth. This arrangementcan be used as the basis tor quiz oreducational games where theplayers give their answers bypushing one of the buttons. Sinceonly one 555 is required for each setat switches, up to four players canplay at the same time.

Another useful switch arrange-ment is to connect a normally openpushbutton in place of Ri for each

555. If a 555 is triggered it will emitan output pulse which will continueuntil its pushbutton is pressed. Atest of reflex speed can be con-structed by triggering all four 555s,instruction the player to push oneof the buttons and then measuringthe time it takes him to respond.

Since the response time will be

longer than the timer at 59464 canhandle, the "jiffy" timer, TI, shouldbe used. Program 2 is an example ofhow the timer can be used. Therecheck procedure in lines 220 and230 is needed to correct for poorpushbutton action. The value Z inline 165 should be set to yield Y50when there is no time delay betweenasking for a response and pushingthe button. The same principle usedin the reflex test can be used alongwith CB2 sound to simulate theelectronic games which require theduplication of a series of sounds.

One of the more useful applica-tions of the 555 Interface is thejoystick. One 555 is used to sensethe position of each of the twopotentiometers in the joystick.There are two ways that the joystickposition can be translated into cur-sor movement. One is to move thecursor relative to some fixed posi-tion such as the center of thescreen. In this mode a given joystickposition always moves the cursor tothe same spot on the screen. Thetechnique is useful in obtaining in-

put tor games like Checkers orOthello. The other mode is to usethe Joystick position to indicatemovement relative to the currentpostion at the cursor.This techniqueis useful in manuevering through amaz.e or in other real-time games. Inthis mode moving the joystick in agiven direction moves the cursor inthat direction. As long as thejoystick is held in that positsion thecursor will continue to move. Retur-ning the joystick to the center stopsthe cursor. The following sequenceillustrates this technique:

PRE

Page 35: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 35/84

Of course, this routine must beused in conjunction with Program 1.The routine can easily be expandedto move the cursor more than onelocation at larger Joystickdisplacements. With some checksto keep the print position on thescreen added, the program can beused to draw pictures or "doodle".

p .,

John Sherburne is an operationsresearch specialist with the Depart-ment of Defense. He has a numberof years experience in mathematicalcomputer programming. Microcom-puting is his hobby.

1000 REM SENSE JOYSTICK POSITION1010 POKE 40 ,16 : POKE 4~,1 : SYS(977)1020 A=255-PEEK(42)+256*(255 -PEEK{4J»10)0 POKE 40 ,)2 : POKE 41,2 : SYS(977}1040 B=255 -PEEK(42)+2S6* (255 -PEEK(43»1050 REM.CALCULrlTE NEWPOSITION1060 R=-1:IF A>AL THENR=O:IF A>AH THENR=l1070 U=-l : IF B~BL THEN U=O: IF B>BH:THENU=11080 RT=RT+R :UP=U .P+U :PR IN T "[home]" ;1090 FOR 1=1 TO UP:PRINT:NEXT1100 PRINTTAB(RT) "X":GO TO 1000

PROGRAM 1 Assembly Language

0)01 A5 28 LOA IP ; }T :Load in pu t ma skOJOJ A6 29 LOX OPUT : Load o ut pu t ma sk0)05 8E 4F E8 STX PORT : Se t t r igg e r h igh0)08 AD 00 LOY # 00

OJDA 84 2A STY ANSR : Cl ea r r es ul tO)DC B4 26 STY ANSR+lOJDE Bc 48 E8 STY TIML : Cl ea r t im erOJEl 8e 49 &8 STY TIMM ;Cle a r& s t a r t t imer03E4 Be 4F E8 STY PORT :Br tng t r t gg e r l owOJE7 8E 4F &8 STX PORT :Re turn to h1ghOJEA 2C 4F EB WAIT 3 rT PORT :Wa it f o r e nd of pu l s e03ED DO FB BNE WAITOyEF AE 48 E8 LOX TIML : St or e r es ul tOJF2 AC 49 E8 LOY TIMM03P5 B6 2A STX ANSROJF7 84 28 STY ANSR+lOJF9 60 RTS

BASIC Program to LoadAssembly Language

10 DATA 165 ,40 .166 ,41 ,142 ,79 .212 .160 ,0 ,1 )2 , 42 , 132 ,4) , 140 ,72 ,232 .140 ,73 ,232 ,140

20 DATA 79, 2 )2 , 14 2, 79 , 2) 2 ,4 4. 79 , 23 2 , 20 8,251 ,174 .72 ,232 .172 ,7 ) . 2)2 , 134 .42 .132

)0 DATA 43 ,96

40 FOR 1: 977 TO 1017

50 READ A :POKE I ,A :N EXT

PROGRAM 2

10 POKE 59459,15,2=920 N(O)=219:N(1)=223 :N(2 )=191 :N(3 )=12725 1$ (0 )= " 'A' " L$ ( 1 )="8": 1$( 2)="C '":L$ ( 3) = "D"10 PRINT "[clear) THIS IS A TEST OF YOUR REAeTlON TIME"31 PR IN T "[down] WHEN YOU SEE A LETTER ON THESCREEN"

12 PRINT '"downl PRESS THE BUTTON WITHTHE SAME LETTER"33 PR IN T "[2 downlPREss ANY KEYWHEN YOU AREREADY"

Page 36: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 36/84

Program2 cont.

40 GET A$,IF A$="n GOTO 4060 I=999+ INT(500*RND(1»)70 FOR K=O TO IINEXT120 POKE 59471,151 22 I =INT (4*RND(1 »130 T I$="OOOOOO":E=O140 POKE 59471,0145 PRINT "(downl";L$(I)150 POKE 59471,15160 WAIT 59471,255 ,25 5170 R=PEEK(59471 )l8C IF R()N(I) GOTO 220190 Y=INT(Y*100/60) ! 100200 PRINT "YOU TOOK";Y;·SECONDS": END220 IF E=O THEN E=l :GOTO 1702)0 IF E=1 THEN E=2 ;POKE 59471,0 :GOTO 150100 PRINT "[clear] WHO1.'¥}BUTTON!":ENDNoles:Line 140 and line 150 start timerpulse.Line 160 wails until one of the pins PA4 . PA7 goes low.Ltne 180checks to see if proper button was pushed. Lines 220 and 230recheck for errors caused by poor pushbutton action.

STAR ACE

View of assembler four 555 inter'face de~lce.

10 DIM DN$(24) .FG$Ol I POKE 59459.1520 DATA" ..... Cdownl ..... (2 downl· ... (J down]", "[4 down] ","C5 downl"."(6 downJ","C7 down7"."r8 down1"~O DATA " [9 downJ","[10 downl"."Cll down1"• H [12 down] ", "nJ dow,-r40 DATA " (14 down]". "[15 downJ"• "[16 down1"50 DATA "[17 down]" ... [18 down)"• "[19 down]"60 DATA " [20 down]". "(21 downJ","[22 downJ"70 DATA "t2) downl" "[24 downl" [ '[ [ Je.0 DATA ·I-~owni[backl [space] [downlr backl[spacel downJ backl spac\'down1[baclc]/(j;ackltbaclcl-\back] (back]_lback] [backl_[baclU (bac51 "-[up) [back] [space1 [up] [back] (space] rt""lflowril (back]+rdown1 [back] [back](back] t .[uo) [back)+ 0" [. r . • :1 r :: ] . re.2 DATA "[spaceJ-.:..rdownl [2 back] rva] I.dow~ lbaclt] [01't'J- t .J back .. up]Ltorward] - •

90 FOR I=O TO 241BgAD DNS(I) I NEXT102 BEAD ST$IREAD TG_$110 DATA • [17e]"'[oft1····· (down1 [4 backl· ... -·. • •••• -[down1 [5 bactJ ...frvs]_.(ott) ", ".L. (down) (bacIQ •• [down] [4 back]'' '. [2 apace].[apace] ID back]."112 DATA "I- ~nace1· I eownl r2 bac,J -. [d own] [1 bac k1,.. [2 space]. /ld own 1 View o f assembled reflex testing(} back]"". "..,..(lpacel •• [down][J back]/<>[downlD back][rvsJ'[otdr2 space] device.·-flown] (1 back)." !'"P~"""""""'~-"--:Jrn~~~~~~~~~

114 DATA "~(space) *.[downJ[:'l back:l-[;;oaceJ. [down] [4 baCk] [rvs)" ."[sPBce)'- (down)(1 backl( rvs]"'[offJ" r: .,120 FOR 1=0 TO 5;READ E$(UINEXr LottJ180 PRINT H [clear) [) space1 YOURSHIP IS UNDERATTACK BY El'lE;IU"181 PRINI' "FIGHT.ERS. THE ENEMYFIGHTERS WILL BEn182 PRIN1' "IN RAI'lZE POR ONLYT>iO MINUTES YOU·18) PRINT "MUST DESTROYAS MANYAS POSSIBLE WHILE"184 PRINT "CONSERVIID LASER POWERFOR FUTURE USE"185 PRIm' "(down) [) space1 USE THE JOYS:rICK TO AIM YOURLASER...186 PRINT "(d ownl D s1Jlice] PRESS 'F' TO FIRE. R

187 PRINT N(down1(} space]PLACE JOYSTICK IN CENTER POSITION"

188 PRINT "AND PRESS ANY KEY TO BEnIN •. GOOD LUCK!"210 GET AS:I? AS = ~.. Goro 210220 POKE 40,16:POKE 41,1;SYS(97712}0 A=255-PEEK(42)+256.(255-PEEK(4J»240 POKE 40,}2IPOKE 41.2ISys(977)250 B",255-PEEK(42)+256·(255-PEEK(4))·260 Al=.J*A:31=.).32~1 A2=.7·A;92=.7.a252 A)=1.J.A;~3=1.J.q26) A4=1.7*A;S4=1.7*s280 H 1=0 ;SH=O I LM=·TI290 DY=12:RX=OIHO=20;VE=12295 FOB I=1 to 999:NEXTIPRINT n ·clear "100 Y=DY+RND(1)-.5:X=RX+2.RND(1))10 IF Y(2 THEN Y",2112 IF Y)21T~EN Y=21114 IF X>J5THEN PRINT "(clearl":GOTO 290

• 8

2 7 R1E3 555 6

+5V 5

Figure 1: Pinout diagram for theNE555

Page 37: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 37/84

400 POKE40,161POKE 41,lISX'S(977) 550 GET A$IIF A$O·F" GCTO)00410 A=255-POKE(42 )+256*( 255-POKE(4) ) 555 PRINT "(homel"; "LASER'S FIRED!" :SH=SH+l420 POKE40,321POKE 41,2:SYS(977) 556 C=PEEK()2580+40*V+H)410 B~255-POKE(42)+256*(255-POKE(4J» 560 IF e<>98 AND e ( )254 GOTO300440 H=2:IF A)Al THENH=l:IF A)A2 THENH=O:IF A)A3 THEN565 PRINT "Colearl";DN$(Y)TAB(X)E$CO)H=-1IIF A)A4 THEN H=-2 570 PRINT "[clear]";DNtCY)TAB(X)E$(l)450 V=21IF B>81 'THENV=I: IF !DS2 THEN V",O: IF 6)3) THEN575 FOR 1.. 1 TO 4V"-I,IF B>B4 THENV~-2 580 FOR J=2 TO 5460 H=HO+H,V=VE+V 590 PRINT ~[clear1";DN$(Y+I)TAB(X)E$(J)461 IF V)19 THEN V=19 595 NEXT J:NEXT I452 IF H>35 THEN 11=35 600 HI=HI+I:PRINT N[clearlHITs ";HIIPRINT "SHOTSFIRED ";SH464 IF H<Q THEN H=O 610 GOTO290466 IF V(O THEN v= o 700 SC=100*HI-(10*SH)520 PRINT "[olearl"; DN$(V)TAi3(H)ST$ 710 PRINT "YOURSCOREIS ";SC530 PRINT "[home)";DN$(Y)TAB(X)TG$ 720 IF Se)499 THEN PRINT "[3 down1ACE!! II eOI'lSRATUIATIONS.",

535 IF TI-LM)7200 GOTO700 END540 H<FHIVE=V:DY=YIRX=X 730 IF SC)249 THEN PRINT ,,[) down1Gooo SHOOTIt-G!":ENDSTARACErequiresuseofa joystick andthe assemblylanguage 740 IPse)o THENPRINT "[3 downJYOUNEEDMOREPRACTICE" ENDInterface programs. Brackets, O . are used to show special 750 IF sea THEN PRINT "[J down)YOU'RE LUCKYTO STILL BEcharacters. For example, [3down) means three down cursor ALIVE" I ENDcharacters.

Back of PET

G C t. ... .- .,Jf

N B PA7 _ PAOo 2

C GA N1 0

Figure 2: Rear view ot the PET Parallel User Port. Allpins are on the bottom of the edge card. PAO is to the

right.

50K 300K 600K50KFigure 4: Schematic of a response sensing device.

PAl PA6

Scree.n display from STAR ACEgame.

PAS PA4 GND

PA3 PA2 PAl PA¢

R 2 -l< pK ~

I'-" ~ ""'- :-

~D r--:1_n 11 II

4 3 Z I• IC2 • leI • rce •C3

5V S 6 78_J ~

W U~' - - f r(- - - 1- -

b 1- ~ l<{ r f. . .___

.oll(f T . r J l f . ( fr ·¢/l({f

, ( - ( lJ3 c::::= J2~ J1 c::= .) ~

G

~Figure 3: Schematic of a four device Interface. Connections to the computer are at the top. Jacks JOto J3 arephone Jacks tor connecting .ensors. All capacitors are Mylar.

Page 38: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 38/84

I N T R O D U C IN G .• . N IBH E R E F E R E N C E

F O R A P P L E C O M P U T IN~ N IB B L E IS :

A SOFTWARE GUIDE for high quality ApplicationsPrograms for your Home and Business.

N IB B L E IS :A REFERENCE GUIDE to new Programming Methods.

N . BL E I S :A BUYERS GUIDE for making purchase decisions onnew products.

N IB B L E IS :A CONSTRUCTION PROJECT COOKBOOK for addingfunction and value to the system you already own.

N IB B L E IS :A COMMUNICATfONS CLEARING HOUSE for users,vendors, and associations.

Each is~ue ofNIDBLE features at least one significant new application program ofcommercial quality. The programs inNIBBLE are surrounded with articles which showhow to USE the programming methods in your OWN programs.

Examp es of upcoming articles:o MOdeling and Forecasting Your Business 0 Build a Two-Tape Controller for $12o Arcade Shooting Gallery - Save Your Quarters! 0 Data Base ManagementSystem I, II, III

And many many more! NIBBLE will l iterally "Nibble Away" at the mysteries of yoursyste~ to help you USE IT MORE. In 1980, the principal featured system is the Apple Il.

Try. " I BB l f

nibble

1 - - - - - - - - - - - - - - - - - - - - - - ,I nibble I• BOX 325 Lincoln, Mass. 01773 •

I 1 'lI lP y N I BB l f! I• Enclosedism y 8 15 fo r 8I s s u e s . II 0 check 0 m oney o rder I• IN rune •

• Address •I •City _

© 1 9 80 b ym e re -So f t . .. .a r e Pub l i .h in gand ResearchCo..Lincoln . M_. 01773, All rigt>15resetVed.•Apple II is a reg;,;t""ed 1 m:le m att o fApple Computer Company

I •I State Zip •

1 ---------- 1

Page 39: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 39/84

Zoom And Squeeze

. . . . . . . . . ."''''''' . . . . . . . . .' ' ' ~ ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'A short program for the Apple II which makes it easier toedit BASIC programs. ZOOM provides a fast way to copyover a program line; SQUEEZE changes the screen widthto 33 characters and eliminates embedded blanks.

" ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ~ ~ ' ' ' " ' ' ' ' ' ' ' ' " ' ' ' ' ' ' ' ' ' ' ' ' ' ' '

ZOOM and SQUEEZE is a shortmachine-language routine writtenfor the APPLE microcomputer inorder to facilitate the editing ofBASIC programs. It recognizes twocommands: CTRL-Q and CTRL·Z.The CTRL-Qcommand causes thescreen window width to beautomatically set to 33 and theCTRL-Zcommand causes the cursor

to quickly copy over all text from itscurrent position to the end of theline.

The ZOOM Feature

In order to edit a program line onthe APPLE it is necessary to morethan simply move the cursor directlyto the area to be changed, make thechanges, and then press RETURN-the required procedure is to positionthe cursor at the beginning of theline number, copy down to the areato be changed (by using the right-

arrow and repeat keys, make thechanges, and enter the edited line. Ifthe line is a very long one, thecopying-over part of this proceduretakes up an enormous amount oftime which can be better used forother purposes.

The 'ZOOM' part of the ZOOMandSQUEEZE routine can be used tospeed up this copying tremendous-ly. By simply pressing CTRL-Z the

July1980

cursor can be moved virtually in-stantaneously from its current posi-tion to the right edge of the currentline while automatically copyingover all the text on the screen in be-tween. For example, to copy over aprogram line that takes up threelines on the video screen takes onlysix quick steps after the cursor hasbeen posttloned at the beginning of

the line number: CTRL·Z, right-arrow. CTRL-Z. right-arrow,CRLT-Z, RETURN. This takes ap-proximately 2 seconds to ac-complish. By way of contrast, tocopy over the line in the ordinaryway by using the rlqht-arrow key inconjunction with the repeat keytakes aproximately 13 seconds (seethe NOTEbelow!)

It is clear, then, that this featurecould save hours of debugging timefor a busy programmer.

The SQUEEZEFeature

When a line of a BASIC program islisted on the video screen with thewindow width set at its default valueof 40 columns, the output is careful-ly formatted by the APPLE byembedding blanks on the left andright sided of the listing. That istosay, there is not a continuous 'wrap-around' display of the informationthat you typed in to create the line.For example, if you enter the line

MICRO-- The8502Journal

Gary B. little

100 PRINT "THIS IN AN EXAMPLEOF A FORMATTEDLISTING"

and then LISTit, the APPLEwill res-pond with100 PRINT "THIS IS AN EXAMPLEOF A F**"***'ORMATTED LISTING"

where a •., indicates an embeddedblank. This formatting techniquemakes it very easy to read a LISTedline, but it can create a minor pro-blem when it becomes necessary toedit the line.

The problem arises when, as inthe example, the blanks are embed-ded between the quotation marksassociated with a PRINTstatement.If this line is to be edited withoutretyping it from scratch, the right·arrow key (in conjunction with therepeat key) must be used to copyover substantial portions of the lineand by so doing all 6 of the embedd-

ed blanks between 'F' and 'ORMAT-TED' will mysteriously appear in theargument of the PRINT statementUNLESS they are skipped over byperform ing pure-eursor movemenIs- i.e., repeated ESG-Acommandsor, for AUTOSTART ROM users,repeated K commands after ESChas been pressed. The need to per-form these pure-cursor movementsis annoying and inconvenient to saythe least.

28:37

Page 40: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 40/84

2345678910II

12lJ

I~151617I R192021

2223242526272829

0)00 A 'J 09 300)02 1\5 31t 31

0304 A9 03 320306: 85 39 330308: 60 340309: 20 III 1'0 3503OC: 09 91 3f,

030E: 0007 370310: A' ! 21 31 \0312 : 85 21 390314: AI )AO 40031~: 60 4J0317: C9 I) A 42flll'l: no IF 4303111: A~ 24 41 , .

0310 : BI 28 450311': 4 11 460320 : ns 24 470322 : E6 24 480324: AS 24 490326: C.5 21 500328: II(l Oil 51032A: C6 24 52032C: 68 53032.0: 90 00 02 540330: Elt 550331: DO ER 560133 : CA 570334 : 60 580335 : 611 59

0336 : C6 24 6003311: C6 24 61033A: 60 62

.... ".**.**** ••••• **** •.•* ' 11 :· . .. ZOOM MID SqU EEZE PR OCR AM . .• BY GARY LI1"TLE •.. '101-2044 w , 3R n AVE. . .. . VAN COUVH, II,C. •• CANAnA V6J IL5 ... . JANUARY 19110 •. . . ... ENTER '300r,3nor. ' TO Ar.TIVATf . •* (OR RRUN I'ROI! DISK), ... . .. .ENTER CTRL-Z TO 200!1 TIf[ ... . CI)RSOR TO nil: R!G"T-1I0ST ..* P051T10N Of' THE LI'!1': (TEXT IS... AllTO'IATICAL LY ~OPIF .O OVER). ..

•. . ENTER CTRL-O TO S'lUEI:7.r. TIlE .... CO LU }!N W IO TliTO Jj, •

. .

WIDTHCHlIAS).KSI,rtINKEYH I

EQU $21EQU $24f:I")U S 2~1'.!)U $3 11F.QII $200f.Q1J $f'I\I!lnRc, $300

LOA ,<l'l'!l(STA KSWL

LTlA ~>I'IT'IKSTA KSIIL+1RT5JSR !:EYIII

OW ~S <11B~'F. CTRL7.LM 0$21STII \.lIOTlILnA DSAO

INlIK

C"mL7. ClIP #S'i'AB!'.T. ~TSJLn y C'1OOPLM (llASL},Y

PH"IN C 01INC e nLOA e nCm > vmrnIICS PI"etc 01PLA

PI N

STA D!,XPIXllNr. LOOPDEXRTSPLADEC CI1nsc CI1RT~TS I

This problem can be avoided ifthe window width is 'squeezed' to 33columns before LiSTing the line andediting it. If this Is done, the embed·

ded blanks disappear and the linecan be edited without worryingabout the need to perform pure-cursor movements.

The window width can be chang-ed to 33 be entering the commandPOKE 33,33 from BASIC Irnrnedtate-execution mode. However, with theZOOM and SQUEEZE routine in ef·fect all that need be done is to pressCTRL·Q. The width can be returned

28:38

Wll':nmJ IJIOTII1I0R IZ Ot:TAL C UR SO RPO~ITInNSCI!.Ef.tl IIASE AnDRF.SS POINTf:RINPt1r 11001( (Lrl)

HlPlJT RllFl'F.~Y.EYPRf".SS ROllT! N F .

srT I IIPI JT HOOKTO SINHl '

GET A CHIIRAcrF.RCTRL-[1 PRESSED?II' NOT. CHECK f'QR CT1\L-2CIIANGr. IIUmQ!J l'IOn!

TO 33OTITPlIT A SPACF.

crPL-7. PIlf",SSr.!l?If NOT. RF-:·ITR1;,AKE A r:1IAPAcrf:l'

OfF vmeo Sr.P.f:EN

IF CURSOR POSlTIO!~ ISAT fAR nGHT,THf:tl f'I'IISIlF.1l

,STOR! ' CHARACTf.!lIN INPl'T PUFFER

GET ANOT'l~P. Cl·1ARAcrEROf'1' S(7I>.f.EN

; IIUl 'Ffl1 FULL,; SO RETUJ!N

Sr.T PROPER CllAJlAcrF.RPOSITION Mil

; Rl'TI!R~1

to its default value of 40 by simplyentering the command TEXT fromtmmedlate-executlon mode.

How ZOOM AND SQUEEZE WorksZOOM and SQUEEZE can be ac·

tivated by BRUNning it from disk orby loading it, entering the command300G from the monitor, and thenreturning to BASIC. The routineresides from $300 to $33A.

After it has been activated, theAPPLE's input hook at $38 (low), $39(high) is set equal to the ZOOM and

MICRO -- The 8502 Journal

SQUEEZE entry point at $309.Thereafter, all keyboard input ischecked to see whether CTRL·Q orCTRL·Z has been pressed; If not,then nothing special happens.

If CTRL·Q is pressed, the shortsubroutine beginning at $310 andending at $316 is executed. All thissubroutine does is store $21(decimal 33) at location $21 - thisis the location in the monitor thatcontains the current window width .A blank is then displayed on thescreen to indicated that this hasoccurred,

If CTRL-Z is pressed, thesubroutine beginning at $317 is ex-ecuted. What happens then is thatthe characters displayed on thescreen from the current cursor posl-tion to the end of the line are placedin the input buffer one-by-one, If the

buffer is overflowed, the programline will be backslashed andcancelled in the ordinary way.

Details of the programmingalgorithms involved can be easilydeduced by inspecting the accom-panying source listing for ZOOMand SQUEEZE.

NOTE: it is possible to speed up therepeat-kay tunctlon by soldering a100K resistor In parallel to theresistor at position R4 on the APPLEkeyboard unit. For details, see the

article 'REPEAT KEY SPEED·UP' byV.R. Little in the February 1980 edi-tion of APPLEGRAM, the newsletterof the Apples British ColumbiaComputer Society, Vancouver, B.C.

J . l .

Gary B. Little first became in-terested in computers by writingdata analysis programs in FOR-TRAN on an IBM 3701168 for an M.SC. degree in Physical Chemistry(Microwave Spectroscopy).

Ultimately he became interested inmicro computing and purchased anAPPLE-II micro 1'12years ago.

He was past president of APPLESBRITISH COLUMBIA COMPUTERSOCIETY, an an APPLE user grouplocated in Vancouver, B.C. Gary iscurrently the treasurer of this group.

July 1980

Page 41: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 41/84

EDUCATIONAL SOFTWAREfOl the A PPLE 'II and A PPLE 'II PLUS

VERBAL SKILLSDisk.",,,. with Rppl"soft Programs and data base can be used to Im-

prov" verbal .kill'lnteroctlvel~. Inter>ded"" .tudy old. fo' coll"9" boardt~pe exoms C f . G . .SRT. G R E .[ SAT, A CT , mAT. ET C),Progrom, Include Qreol-

d"nt edlto, fo' ... paneflng or modifyingdata Ii,t s, Reoliltlc mUkiplechalcequestloes Ole genefoted with seve(el options. Require.!. no compute, @)I.-

per len~ mokj ng It tdaol for students..

Voco.bulo.ry Builder. Over 1600 entries with op-tion of matching synonymsOf antonyms - l!lQ.Q5

Aflo.109!:1· Over 1200 word rel at ion·

shlps> l!lQ.Q5Sentence Completion. Equivalent to 6 SAT tests

·l!lQ.Q5Ve,bo.l Sk ill s Po.k · RI I three diskettes fo r Just

l!44.Q5

SLIWA ENTERPRISESfD UC RT IO NR l S OFTWR RE D EPR RT mE NT

PO ST O FF IC E B OXns«HAmPTON . V IRG IN IR2366b

• Apple I, 0 ,e9i""red t'odema,k of Apple Computer, Inc.

W RfT E o n C AL L FO R M onE IN fO RM AT IO N

SDuttlwesteRn Clata s.... stemsP.O. BOX 582-M • SANTEE, CA 92071 • 714/562-3670

HAS YOUR APPLE READ ANY GOODPROGRAMS LATELY?APPLE II DISK SOFTWARE

DATA BASE MANAGERIFO PROGRAMThe IFO (INFORMATION FILE ORGANIZER) can be used for many ep-pllcatlons such as sales activity, check reg Isters, balance sheets,client/patient records, labratory data reduction, perscrlptlon informa-tion, grade records, mailing lists, AIR, job costing and much more. Thiscan be accomplished easily and quickly without prior programmingknowledge.Up to 1000 records with a maximum of 20 headers (catagories) and 10report formats (user defined) can be stored on a single diskette, informa-tion can be sorted on any header, both ascending and descending inalpha/numeric field. Mathematical functions can be performed on any 2fields to manipulate the information. Information can be searched onany header using >, c, = >, = -c ,= . and first letter. Mailing list formatprovided. Fast assembly language sort, search and read routines. Manyerror protection devices provided. Put your application programto.ll.ether in minutes Instead of hours.PROGRAM DISKETTE and instruction manuaL._$100.00MAILING LIST PROGR.AM ... $40.00 .INVENTORY PROGRAM2 disk drives, menu-driven program. Inventory categories include;

STOCKII, DESCRIPTION, VENDOR. 10 , CLASS, LOCATION, REORDERPT., REORDER QTY, QTY ON HAND. All records can be entered, chang-ed, updated, deleted, or viewed. Reports can be sorted In ascen-ding/decendlng order by any category. There are 7 search repor ts (3automatic). Calculates $ VALUE of Irwentory and YTD, MTD, and perioditems sold, Accumulates inventory over a 13-month period. Plus muchmore. Requires a 132·column, serial/parallel printer, Complete turnkeyoperation with bootstrap diskette.Prog~am dlske tt and instruct ion manual .. .$140.00PAYROLL PACKAGE2 disk drives, menu-driven program. Employee history Include: NAME,ADDRESS II, ADDRESS #2 CITY, STATE, ZIP, FED EX, STATE EX.,SOCIAL SEC.iI,DATE EMPLOYED, DEPT II, CODE, EMPLOYEE ",STATUS, MARITAL STATUS, PAY RATE, OT RATE, VAC RATE, II VACHRS. and PENSION PLAN. Program can generate weekly or biweeklypayroll. Prints W-2, QTR REPORT, PAY CHECKS, MASTER AND CUR-RENT files. FEDERAL and STATE wltholding taxes are built into oro-gram. Maintains a CASH DISBURSEMENT Journal, Accumulates payrollfor a 53· week period, Generates numerous type ot payroll reports.Allows data to be searched, sorted and edited. Prints DEDUCTIONregister and more. Maintain up to 125 EMPLOYEES/EXPENSES forquick and easy PAYROLL. Numerous error protection devices provided.PROGRAM diskette and Instruction manual ... S2.40.00'PLEASE SPECIFY STATE WHEN ORDERINGAPARTMENT MANAGER

2 disk drive, menu driven program written in assembly language and AP-PLESOFT II. AU you will ever need to manage your apartment. Handlesup to 6 BUI LOr NGS with a maxi mum of 120 units each. Complete turn-key operation. Data categories include APT #, TYPE, TENANT NAME,PETS, CHILDREN, SECURITY DEP., PET DEPOSIT, POOL DEP, MISCDEP, RENT ALLOWANCES, DATE MOVED IN, VACANCY DATE, REF-FERAL, CONDITION OF APT, DAMAGE AMT and COMMENT LINE.Search, sort. enter, edit and vacate tenates. Maintains a MTD and YTDrent reclpts as well as complete utility reports, rent lost by vacancies.Maintains expenses, vacated tenants report and much more.PROGRAM DISKEITE and INSTRUCTION MANUAL...$350 .00PROFESSIONAL TIME AND BILLING2 disk drive program written in assembly language and APPLESOFT II.Completely menu-driven, Maintain all billing of clients and personnel.Generates and invoices. Numerous reports based on all types ofcriteria. Easy data entry tor RATES, CLIENTS, and MAnERS. HasSEARCH, SORT, CHANGE (on screen editing), VIEW and BALANCEFORWARD. IF your are a JOB CONTRACTOR, AITORNEY, ACCOUN·TANT, GEN ERAL CONSULTANT, or anyone that needs to charge tor

time, this program is a must. Complete turnkey operation. NumerousREPORTS are produced to aid in the TIME ANALYSIS PROCESS. All thisand much more.PROGRAM DISKEITE and INSTRUCTION MANUAL$325.00SPEED READINGPROGRAM DISKETTE AND INSTRUCTIONMANUAL...$100.00

ALL PROGRAMS REQUIRE 48K and APPLESOFT II ON ROM OR ANDAPPLE " PLUS. ALL SOFTWARE IS COMPATABLE WITH PASCALSYSTEMS. PROGRAMS RUN FROM ANY PORT OF THE COMPUTERWITH SERIAUPARALLEL PRINTERS. REQUIRES 1 DISK DRIVEUNLESS OTHERWISE NOTED.SEND CHECK/MONEY ORDER or C.O.D. To:SOFTWARE TECHNOLOGY for COMPUTERSP.O BOX 428BELMONT, MA 02178OR AVAILABLE FROM YOUR LOCAL DEALER.

Page 42: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 42/84

PROGRESSIVE SOFTWAREPresents

Software and Hardware for your APPLEMissile-Anti-Missile (Aplsft) Curve Fit

, .(]] - - -- r~ • •••

Polar Coordinator PlotBy Dave GarsonTape-$9.95 Disk-$14.95

by TD Moteles Tape-$9.95 Disk-$14.95

Sales Forecast provides the best forecast using the fourmost popular forecasting linear regression tachnques,Neil D Upson Tape-$9.95 Disk-$14.95Single Drive Copy is a utility program, written by VinceCorsetti in Integer BASIC, that will copy a diskette usingonly one drive. Tape-$19.95 Disk·$24.95Touch Typing Tutor teaches typing. Indicates speed anderrors made. Finger Bids, Gen.Typing, Basic Languageand User Supplied. Diskette. Written by Wm. A.Massena. $19.95Apple Menu Cookbook index-accessed datastorage/retrevial program. Recipes stored, unlimited linesper entry. Easy editing. Formulated after N.Y. TimesCookbook. Other useful features included. Written byWm. Merlino, M.D. $19.95Mailing List Program maintains complete record of name,address, phone no., mailing lables acommodated parallel

card or built-in printer, easy data entry.Diskette 32K $19.95Utility Pack combines five versiUle programs by VinceCorsetti, for any memory configuration. ApplesoftUpdate"lnteger-to Applesoft conversion • Integer BASICcopy • Binary Copy • DiskAppend Tape-$9.95 Disk-$14.95Solitare - Old European peg game, played by one(similar to Chinese checkers). Object - to finish with lastpeg in center. Written by Charles B.Smith Tape-$9.95 Disk-$14.95Water the Flowers - Math (add., subt., mull., div.,(grades1-6 (disk). A graphical program that teaches math.Judy Pegg . . $19.95Catch the Pig - Educ. Pkg, 2, An upper grade schoolgame that teaches all four quadrants of the cartesiancoordinate system. 4 students play at one time with manylevels of play. Aso included is a Linear Version for lowergrade school children. Written by Judy Pegg.

Tape-$9.95 Oisk-$14.95Financial Pak - 2. Calculates interest rates on bondsthat is based on due date and days between dates. ByNeil D. Lipson Disk-$14.95

. Programs accepted for pub lication

. Highest royalty paid

U.S. and foreign dealer and distributor inquires invitedAll programs require 16K memory unless specified

* *i: r FILES• Builds Serial Files'Changes Serial Files to random access Files• Adds to End of Serial Files• Record Insertion and deletion anywhere in Serial File."Move individual records or blocks of records withinSerial FilesA File manipulator that allows the user to search for a str-ing within a file, sort date by blocks handle many files at atime (without exiting the program and saves executedfiles. A tile can be saved under many names, viewed inseveral modes, and dumped (totally or partially to aprinter).

If you would like10

or work with files you must own thisprogram! Comes with 10-page doumentation in a binder.Because of the size and weight of this program postageand handling charge is necessary.FILES·Disk only_$49.95 plus $4.95 postage and handling.Written by Marc Goldfarb.

* i: r * ROSTER * i:r *• A complete package for Educators! Roster is a generalpurpose disk-based record·keeping program for teachersat all levels. It allows instructors to create and changeclass rosters label, enter and change tast or assignmentscores, sort the roster based on student number, studentname, or rank in class, assign character or numericgrades based on any of five criteria (raw score, percent,rank percantile rank or Z·score) and Lists scores, totals(or averages) , and for grades according to any of these op-tions.Roster on Disk (only) $49-95 plus $4.95Postage and Handling.Written by Douglas B. Eamon, Ph.D.

HardwareLight Pen with seven supporting routines. Some of theseare light meter, light calculator, Light pen, ;and Light penTIC TAC TOE. The light pen connects points in high or lowresolution graphics. Neil Lipson's program uses artificialintelligence; the pen is not confused by outside light. Re-quires 48K and Applesoft in ROM. $24.95Plus $3.00 Postage and handling.

TO ORDER

Send Check or Money Order to:

P_D Box 273Plymouth Meeting, PA 19462PA residents add 6% sales tax.

POSTAGE AND HANDLING

Please add $1.50 fo r th e first item and $1.00for each additional item.

Page 43: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 43/84

QUICK CHANGE ARTISTRY

~"":; .. ~~}~,: : ~

ENGINEERED SPECIFICALLY FORTHE KIM-1 MICRO COMPUTER

• Protection of Chips andOther Components

• Viewing Angle of ReadoutEnhanced• Improved Keyboard Positionfor Easier Operation

EASILY ASSEMBLED• Absolutely NoAI teration of KI M-1 Requ ired

• All Fasteners Provided• Goes Together in Minuteswith a Small Screwdriver

ATTRACTIVE FUNCTIONAL PACKAGE• Professional Appearance• Four Color Combinations• Improves Man/Machine Interface

MADE OF HIGH IMPACT STRENGTHTHERMOFORMED PLASTIC• Kydex 100-l<• Durable• Molded-In Color• Non-Conductive

AVAILABLE FROM STOCK• Allow Two to Three Weeks forProcessing and Delivery

• No COD's Please• Dealer Inquiries Invited

TO ORDER: 1. Fill in this Coupon (Print or Type Please)2. Attach Check or Money Order and Mail to:

NAME enclosuresgroup

STREET __

CITY __

~( TM Rohm & Haas Patent Applied For

STATE _ ZIP

Please ShiD Prepaid SKE 1-1(s)@ $24.50 Each

California Residents please pay

$26.09(lncludes Sales Tax)

771 bush street I san francisco, cal ifornia 94108

Color Desired blue 0 beige 0black 0 white 0

Page 44: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 44/84

Welcome to the second issue 01 Ihe Ohio Sc.ientilicSmall Systems Journal in Micro.

Please note that some of the HEAD END CARDS re-quire more power than may be practically carri.ed via Iheribbon cable alone. Therefore, some of the cards requireauxil iary power supplies.n this issue, Ohio Scientific is pleased to introduce a

new concept in computer lntertacinq - the Sixteen PinI/O BUS. The BUS concept as well as several boards and

applications are covered in the following pages.

Also in this Issue, a short, graphics oriented game inBASIC called 'FOO' Is presented.

CA·20 Board

The CA-20 board contains all the necessary logic todecodee.ight distinct HEAD END CARD interfaces. Theactual interconnect, as with the CA,15, ts via simple 16 pDIP sockets and standard 16 pin ribbon cables.

Reader suggestions on article content are welcome.Please submit them to:

Ohio Scientific, Inc.Small Systems Journal1333 S. Chillicothe Rd.Aurora, Ohio 44202

The Ohio SCientific Sixteen Pin I/O BUS

The CA-20 board also requires one slot 01 your corn-putsr's backplane. But remember, from this one slot yougain access to a maximum of eight accessory boards ..

The CA-20 is recommended for use in the Ohio Scien-tific C2 series and C3 series computers. It can also be istalled in C4P and C8P series systems with somemod.ification to the CA-15 Interface,

Ohio ScIentific is pleased to introduce a unique newproduct line - The 16 Pin 11 0 BUS. With this system it ispossible to add up to eight special function boards whileoccupying only one backplane slot.

Since the logic required for the 11 0 BUS interfacepretty simple, an additional feature was added to theCA-20 board - a crystal controlled 'ttrne-ot-day' clock(hardware) Subsystem. The operation of the clock, excep-tlng reading time and setting time, is totalty independentof the host computer ..As a matter of fact, with the includ-ed on-board, auto-recharqtnp, battery back-up, your corn-puter may actually be turned off for several monthswithout losinq time.

This is made possible by a novel BUS extensionmethod which allows decod.ing, timing and eight bils ofdata to be carried on standard, inexpensive 16 pin ribboncables.

Up 10 eight inexpensive 16 pin cab lies with standard DIPconnectors may be attached to a single CA-.20 boardwhich in turn occupies one slot 01 the standardChallenger backplane. Alternately, one 16 pin I/O BUScable may be attached to the CA-15 board at the rear of allC4P and C8P products. Note, in ths case of the C4P-MFthis allows system expansion beyond the normal lour slotbackplane.

The features of the clock subsystem are as follows:

Hours, minutes, seconds and 1/10 secondsDay of weekDay of monthMonth of yearFour Year calendar

Currently,live HEAD END CARDS are available for inter-connection to the system via the CA-20 or CA"15 boards.

If you happen to own (or use) a C2 series or C3 seriescomputer,the CA·2Q board can actually control the powercycling of the entire computer when equipped with an op-tional power sequencer package. This means you canpreset a time (month, day.hour.etc.) within the Clock sub-system and that preset time agrees with the actual' time,A.C. power is applied 10 the entire computer systemthrough the power sequencer .. A t a later time, the system'sA.C. power may also be removed and the system shutdown under software/clock subsystem control.

Computet Interface to Sixteen Pin 1/ 0 BUS

The 16 pin 110 BUS may be attached to your computervia two different boards - the CA·15 or the CA·20. Thedescrlptions of these boards are as follows:

CA·15 Board

The CA·15 board is a standard accessory interface in-stalled on the following Ohio Scientific. systems: C4P·MF,C4P·DMF, and C8p·DF.

For applicat'ions where the clock subsystem is not re-quired, the CA·20A will' perform all the Sixteen Pin I/O BUSlunctionsassociated with lull-feature CA-20_

HEAD END CARDSThe CA-15 is mounted at the rear of the computer and

contains the following interlace connections:Joystick and numeric keypadModem and serial printerSixteen PIA Jines (normally used for the Home Security

system - AC-17P)Sixteen Pin I/O BUS

HEAD END CARDS is a g.eneral name used. to describeany or all 01 the special functionboards which allachthe Ohio Scientific Sixteen Pin I/O BUS. There are current-Iy five such boards and, with the excepUon of the CA-22,they will only interface wltn the computer via the S:ixteePin I/O BUS.

Please note, as detai led earller.you must use a CA 15 ora CA·20 board at Ihe 'computer end' of the Sixteen PinBUS to complete the interface.

The interconnect for the Sixteen Pin I/O BUS is simply a16 pin DIP socket. To use the BUS, aU t hat you have to dois attach one end of the 16 pin ribbon cable to the CA-15board and the other end of the cable to one of IheHEADEND CARDS. In the following pages, a brief product and' applicatior

CALL 1·800·321·6850TOLL FREE

Page 45: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 45/84

SMALL SYSTEMS JOURNAL

description of the currently available HEAD END CARDSwill be presented.

Bit Switching and Sensing - Too CA·21

The CA-21 is a 48 Hne parallel I/O board featuring three

6821 PIAs (peripheral interlace adapters) and prototyp-ing/interconnect areas.

The use of PIAs in the design allows for maximum Inter-face versatility as you may configure anyone of the 48110lines as either an input or an output. As outputs, each lineis capable of driving a minimum of one standard TTL load.

Additional versatility is added because 24 of the lines,when configured as outputs, may simultaneously tunc-tion as inputs. This feature, although somewhat confus-ing, Is extremely useful for applications such as switchmatrix decoding.

Each of the 48 lines is brought out to two foil pads(suitable for wire wrap stakes) as well as a location on

one of fou r 12 pi n Molex-type female edge connectors.There are also eight 16 pin DIP sockellocations which areintended for use as prototyping areas. Additionally, the 12PIA 'hand-shaking' lines are brought to 12 single foil pads .

The CA-21, with proper buffering, may be used for vlr-tually any computer controlled bit switching or bit sens-ing application that you can imagine. With a full comple-ment of eight CA-21s interfaced via the CA-20, a total of384 individually controllable 110 lines are possible!

An interesting application using one CA·21 boardwould be a complete, is somewhat slow, emulation of thestandard Ohio Scientific BUS.

A more standard application might be augmenting thestandard Home Security System (AC-17P) with 'hard-wired '

sensors.

One type of sensor you could easily add is a standardwindor 'perimeter detector'. This could be done with corn-mercially avaltable adhesive toll tape. You could thendetect a break-in (through a broken window) by sensing abreak in the foil tape.

Another useful application you could set up in concertwith the AC·12P wireless A.C. Remote Control, might besensing when a room is entered. You could accomplishthis with pressure·switch door mats or door switches.When room entry is detected, the lights could be turnedon or, turned off on exit.

If you are designing any sort of dedicated controlsystem, Ihe CA-21 is an ideal choice. You can easJlysense innumerable types of input (pressure transducers,flow sensors, SWitches, etc.) while controlling outputsfrom a simple single LED display to a network of solidstate relays controlling A.C. power.

EPROM Programmer - The CA·2S

The CA·23 is an EPROM programmer designed for usewith the growing families of 5 volt only EPROMS. With theCA·23 you can program and verify all1K through 8K byteEPROMS of this type. Note these parts are often lden-

tilied as 8K - 64K bit EPROMS.

The CA·23 , c an program (Of verify) data in two basicmodes - EPROM to/from EPROM or EPROM lolfromcomputer RAM memory. Additionally, EPROM data maybe read directly into the computer's RAM memory.

There are four LED indicators on the CA-23. The first is'SOCKET UNSAFE'. This means that a programmingvoltage is present at the socket and if you insert orremove an EPROM it is likely to be damaged.

The second indicator is 'PROGRAMMING'. This meansthat your EPROM is currently being programmed.

The third indicator Is 'ERROR'. This means thatsomewhere along the line you r prog rammi ng attempt wasunsuccessful.

The final indicator is 'PROGRAM COMPLETE'. Thismeans that your program and verification was sue-cesstul,

The most intriguing application for this product is thecreation of 'custom' parts for your computer orperipherals. This could range from a new system monitorto a new high level language. It could even include a newcharacter generator for your CRT or printer. Nole,however, tinkering around with the Internals of computersand peripherals requires a fairly high degree of technicalexpertise. Also, most manufacturer's warranties are vold-ed by these types of modifications.

Several OEM (original equipment manufacture) andResearch/Development applications will be immediatelyobvious to those you involved in that work.

The CA·23, as previously mentioned, is designed foruse with 1K through 8K byte EPAOMS. These parts comein various package styles and have various product

names. For example, Intel's 2Kx8 part is the 2716, TexasInstruments' part is known as the 2516.

The CA-23 has both 24 pin and 28 pin zero insertionforce sockets for reading, programming and verifying theEPROMS.

Prototyping - The CA·24

The CA-24 is a solderless bread-board designed forproto- typing, experimental and educational applications.

The bread-boarding is made up of seven solderlessplug-strips of the type manufactured by AP Products. Twoof the pluq-atrips contain a connection matrix of 5 by 54 .connecions and are used as signal distribution points.Another pair of 96 location pluq-strfps are for poweringthe bread-board area. The actual experimenter area iscomprised of three plug-strips, each with a 10 by 64 loca-tion connection matrix. Additionally, sixteen LED in-dicators and sixteen DIP switch positions are provided forSignal observation and control functions.

Board 110 is via TTL latches and bi·directional PIA portsas well as direct (buffered) data, signal and control linesfrom the computer BUS. This method allows you 10 direct-ly interconnect devices such as 6850 ACIAs in addition todolnq more 'isolated' andlor independent circuits.

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

Page 46: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 46/84

Page 47: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 47/84

SMALL SYSTEMS JOURNAL

Summa.ry

With the introduction of the 16 pin 110BUS, Ohio scten-tific has opened a new world on interfacing capabili tiesfor both the large and the small computer user.

Systems ranging from totally automated sampling andcontrol stations to complete RIO setups to educationallab stations are now available to you via standardbuilding blocks and standard computer systems.

For pricing and availability, contact your nearest OhioScientific dealer.

FOO

This is an amusing graphics game that simulates atwisting road scrol ling up from the bottom of the screen.You must avoid going off the road. Speed and road widthare selectable. Pedestrians are also optional, with abizarre twist. At your option pedestrians are to be avoidedor run down for points. FOO runs on disk based C4P andC8P video systems. The tone generator is used to providesound. The program is easi ly adapted to OSI BASIC·in·ROM computers.

100 POKE2893 ,55:POKE2894 ,8:POKE2073,96110 BS"55040:SM~2 :MS~1:KY=57088 :ME=54144+15:MI=0 :RN"0115 ML%=O117 SN =255120 LP=5130 PL=2/LP135 PO KE 57 089,1140 P0K E9680,,32: PO KE56832, 2150 C ,,226155 KP=O160 IFA$= 'Y ' THENME=EM:I ,/ I= I< I F:GU=UG :GOT02701 70 FOR I= lT 03 0:P R INT:NEXT I180 PR IN T 'F 0 0'190 PR IN T: PR IN T ' RACEWAY '

200 PR IN T : PR IN T ' Y ou run at you r own risk ! '210 PR IN T:PR IN T' <~= LEFT= l R IG IiT~2 ==> ,2 15 PR INT:PR INT 'OVERDR lVE=RUBOUT '220 PR IN T :PR IN T 'S UG GE ST W ID TH =20, D EL AY ~20'230 PR IN T: IN PU T' IN IT IA L W ID TH (0-30} ':W I24 0 P RIN T : IN P UT 'D ELAY ( 1- 20)'; ME :EM=ME245 PR IN T2 50 GU=O:IN PUT 'P EOESTR IANS

(Y IN )' ;X $ : IF LE FT $(X $ ,l)~ 'Y 'T liEN G U= .,3255 U G=G U: PR IN T257 IF GU =O THEN 27 0260 KP=O: IN PUT' K IllER FOO

(Y IN ) , ; X $: IF LEFT $(X $,l)= 'Y 'T HEN PK =l270 PR IN T: PR IN T' Hidden wonders await

tile ' : P R IN T ' M as te rs I'2 8 0 FORI=IT0,30:PRINT:NEXTI29 0 I< ID -W I \o F=W I: M E= 55 104 +1 5-ME *64 : WT =( 30- I,/I) /229 5 IFA$ ~'Y 'THENRETURNJOO FORM=1TOLP:GOSUB600:GOSUB500:ML%=Ml%+1:NEXTM350 \H= III-13 60 L P~LP* 1.1437 0 IF I< /I > 4T HEN ,3003 8 0 SM=SM+.2:MS=MS+.14 00 F ORM=ITO L? : G OSUB 600 : G O SUB 50 0 :M L%=ML%+l N EX TM4 50 1 < 11 = 10 1 1 +1

460 LP=lP •• 8547 0 IF WI < IID THEN 400

4 75 IF lID < 2THEN lID = \( F480 W D =IID *.7 5490 GOT0300499 R EM OU TPUT A FR AME500 RN -RN +SM*RND (I)- MS510 W T =IIT +S GN (R N )

5 20 IF IIT +W I > 28 TH ENWT= IIT-1:R N = 0 :G O T052053 0 IF liT < OTHENWT=O:RN =O54 0 IFIll >8ANDRND(1) <GUTHENPOKEBS+WT+1+ INT

( I, /I *RND ( 1 ) ) ,2 405 50 PR .I NTS PC (I, /T ); '> < , ; SPC( III) ; t > < ,560 RETURN599 R EMM OV EB ALL600 POKEKY,128:K=PEEK (KY ) :KK=0 :POKEKY,64 :K2=PEEK (KY )610 I FKAND128THENME=ME-l :KK= - 1+0*RND! I)6 20 IFKAND64THENME=ME+1:KK=16 30 IF K2AND 4THENME=ME+KK640 IFPEEK (ME) < > 32THEN 700650 POK EHE,C660 RETURN7 00 GY=PEEK (ME ):I FGY=24 0ANDPKTHENKP=

KP+l:GOSUB2000:GOT0650710 POKE2 0 7 3 , 1 7 , 3

7 15 F OR I= 100T 0250ST EP5: PO KE57 089, I: N EX TI7 19 F OK E57 089,l720 PR IN T' Y OU B LEil ITI I I '725 PR IN T730 MI=Ml% *PL750 PR IN T'AFTER ' ;MI;' MILES'755 IFPK THEN PR IN T'AN D' ;K P;' K ILLS'757 P R I N T ; P R I N T ' TOT A L

POINTS : ' ;INT(MI+4*(1 -PK)*MI+I00*KP)760 GOSU BIOOO770 K=l7 80 F OR I= 1T 01000* K :N EX TI790 IFPEEK (K Y) < >1T HEN 7908 00 P0K E968 0,958 05 PO KE 57 08 9,l810 00T 050001000 I FPKTHEN l ID=KP :GOT010 ,3 01 01 0 Io ID =M I/WF1030 PRINT:PRINT 'Congra tu la t ionsl '1040 PR IN T'You m ay now call you rself'1050 PR IN T : PR IN T ' , ;1060 IF lID < 3T HENPR IN T ' L IT TL E' ; : G OT 0120010 70 IF lID < 5THEN PR IN T 'T END ER '; :G O T0 120010 80 IF lID < 12.5THEN PR IN T 'M ED IO CRE'; :G O T0120 01090 IF lID <25T HEN PR IN T 'B IG '; :G OT 0120011 00 IF lID < 3 8THEN PR IN T ' MAS TER' ; : G O T01 200111 0 IF lID < 50THEN PR IN T 'G RAND , ; :G O T01 2001120 PR INT 'CHEATER ';1200 PR IN T' FOO ';121 0 IF GY= 24 0THEN PR IN T ' K IllE R';1 22 0. P R INT 'I '1230 R ET UR N2000 SN =SN -5200 ,3 I FSN=5OTHENSN=2552 00 5 POKE57 08 9, SN2010 PO KE 57 089 .•12020 RETURN5 00 0 IN PUT 'AGA IN , ;A$ :A $ =1EFT$ (A $ ,l)5010 IFA$ <> 'Y 'THEN60005020 INPUT'SAME';A$ :A$=LEFT$(A$ ,l )5025 IFA$ <> 'Y ' THEN"CLEAR503 0 GOT 010 06000 EN D

OHIO SCIENTIFIC 1333 S. Chillcothe Road • Aurora, Ohio 44202 • (216) 831·5600

Page 48: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 48/84

One-Arm Bandit(32K,INT)Card Shark (INT)

HI- ROller(App,lesofl)Hi-Res Sub Game(32K)

Adull Game Pak (16K)

TEMA(16 to 4 e K,speclfy)

PC S Assembler (4BK)PCS Disassembler

(Our Assembler reQ'd) 14.95Programmer Pak

(Assemb Ie r & Ois asmb u) 46,95

A P PL ETAPE

9,.957.95

7.9514.95

7.'3519.9534.95

DIS K

14,959.959.95

19,959.95

24.9539.95

16.95

4995c

A 1M. KIM, SV MPC S Oi s a s s e r n b t a r 75.00

We a t s oHOE, Inc,

carr yI In e

the complete01 p r o d u c Ls .

CUSTOM PROGRAMMING

Progressive ComputerSoftware

405 Ccrb in R cadYork, PA 17403(717)845-4954

J Holtzman

6820 Delmar, 203

SI. Louis, MO 63130

314-863-5209

software and Hardwarefor Business EducationEntertainment

SYIII-I

,It 5Ta~ lC"l:(1( me eeun l t ]l /e1 . . jC>1 i ! e5 0cQlOi" vernon of tn i[>eeae~t"rt re t: ~ml i! T1' Ir~eouterenr K~IiIIc)i\ ececeeon Man."comm",ni;l p-erQljJatlljl!!'~ton" U~ Of we,apol'l§.to reonr ot tJilmag.@!!iUt!t!C iBI(ApPJ~! OftHOMDtSI " ..• . .. ", .•••• , .• $24.,95

-{ASH.ASTER tt 'teL,{ont counter C<I!.1'l :f(:9iner SYStem.eeccresUtl ( 0 100 tr an~aWo" S each - cay or sr ll ft. AttO un if lg O f 0 0 : 1 11 . . .1't1IO~ t ran~tioo!.al 'lo mvemcrv t tJm[}\ ll !!l' ". H(J!'Il~1000 il'l:lI't!rlt(lr ...lre:m~ I-iJ5cHI1E!rpowl:!rfulODti01'lS rff'e05.j\8J(:AD'Pte!.oFt ROM.[Juala is!!:Ch"""E'5 ,10ro ll \J~n erlnrer , , , • ••• , , , • •_•• , , . __$150:00

CASiH O$I 'AW:EIII'_ . '$1 '00 .00-+ OSO.oo Wooing

FQr sor tWii r' e ( :I n l. .- ,~tJrI '5- '2::00I).So)S o~,DOForE-I'lI 'n 5hl.,C1inlJ cnaraes.(:<Illfoml,;l resrcerns .add 6'h_Dol"Il ';oI!'1'_lwhil( y(ltl want here.THE)t" , rite or C;l11Q1jW for VOLJTRE-EsO'ftwatf "'!'IoG taruwarecilta)~

C<lrden Pljj-z,a S h OpO in o C e nt er~71gRl!!reda.BI\!d ...NOrtflrl(l¥'£!_cailf 91:52" DeoI. 7MIreieencne. tl111 ~49"S-SOO

INTERACTIVE TRACE/DEBUG

MONITOR ENTENS!ON COMMANDS

MONEX:"'NEW COMMANDS:'Dlsassem-

ble 'Relocate 'Find 'ASCII dump 'Trace

(Sym-Bug) 'Checksum calculator 'BRK

set/delete 'MoreSYM-BUG: Trace with dlssassemble and

register list: skip and continue subcom-

mands. BRK and Single Slep .

PRICES: CASSETTE $15.95 jat $200 or$3800)EPROM (2716-5V) (at $FOOO) $49.95

Commented Source $9.95 Custom

assembly: add $2.00. User Manual separate-

ly: $5.95 (applicable to purchase), All 1stclass PPD conllnental U.S. Other add $2.50

OTHER PRODUCTS: AIM - SYM - KIM

..... Oplimized" software for Optimal

Technology' s EP-2A prornmer. Includes

erase verify and full prompting. Let your

computer do Ihe work, Includes listing,

cassette, instructions. Speclty system.

$9.95

'' 'Complete hard-and software Interface

for Texas Instruments 12120column thermal

printer. Requires one eight bit por t. Perfect

tor dedicated control applications. Com-

ptate schematics, listings instruction.

Specify system. $9.95

32 K BYTEMEMORYRELIABLE AND COST EFFECTIVE RAM FOR6502 & 6800 BASED MICROCOMPUTERSAIM 65-*KIM*SYM

PET*S44-8US• PLU G C OM PATIBLE W ITH TH E AIM ·65ISYM E XPANS ION

C ONN EC TOR BYUSiNGA RIG HT ANG LE C ON NE CTORISUPPLIEDI MOUNTED ON THE BAC K Of THE MEMORYBOARO.

• MEMO RY BOARDE DG ECONN EeT0 R PL U GS I NT0 TH E0 &)0 S 4 4 BU S,

• CONNECTS TO PET OR KIM USING AN ADAPTOR CABLE,• RELIABLE-DYNAMIC RAMWITHON B O A R DINVISIBLE

REfRESH-LOOKS LIKE STATIC MEMORY BUT ATLOWER COST AN D A fRACTION OF THE POWER

REOUI RED FOR S TATI C BOARD S.• USES - svO NLY, S UPPL IE D FROM HOS T C OM PU TE R.• FULL DOCUMENTATION. ASSEMBLED AND TESTED

BOARDS ARE GUARANTEED FOR ONE YEAR ANDPURCHAS E PR IC EIS fULLY REFUNDABLE If BOARD ISRETURNEOUNOAMAGED W ITHI N14 DAYS.

A S S E M B L E DWITH 32 K RAM " " " & 4 1 9 . 0 0& WITH 16K RAM . 1 3 4 9 . 0 0

TESTED WITHOUT RAM CHIPS 1 2 7 9 . 0 0H ARD TO GET PARTS (NO RAM C HIPS)WITH BOARD AND MANUAL .•••••_ _ 1109 .00BAR E BOARD& MANUAL __ _ ._ _& 4 9 , 0 0

PET INTERFAC E KIT -C ONNEC TS TH E ~2K RAM BOARD TOA 4K OR 8KPH C ON TAIN S IN TE RFAC E G ABLE . BO ARDSTANDOFFS POWfA SUPP[ Y MODIFICATION KIT ANDCOMPLETE INSTRUCTIONS 149 .00

15K X 1 O IH ~M IC R AM

THE MK4116·3 IS II 16.3Il4 BIT HIGH SPEEDNMO S. D YN AM IC RAM,T H E YARE EQUIVALENTTO T HE M OS TE K. T EX AS IN ST RU I.IE NT S.ORMOTOROLA4116 - 3 ,• 200r ; s e cACCESS T IME .37 5NSEC CYCLE

T iM E ,• 1 6 P IN I TLCOMPATI BL [• BU RNE D IN AN D FU LLY TE STE D,• PA RT S R EPL AC EM EN T G UAR AN TE EDFO R

ONEYEAR1 8. 10 E~CH ' " QU ll IT lT IE S OF!

6502 & 68006 4K B YT E R AM A .N O C O NT RO LL ER 8 fT

M AKE 6 4K BYTE M EM ORY FOR YOU R 0800 OR6 502, T HI S CH IP S ET IN C LUDE S:• 32 M5K 4116·3 16KX1. 200 NSEC RAMS.~ I MC : l4 6 1 l ME M0 RY CONT ROLLER.~ 1 MC3242A MEMORY ADDRESS

MULT IPLEXER AND COUNTER .• D ATA AND APPLIC ATIO NS HEElS.

TESTEDAND GUARANTEED.S 2Q S .1 10 P fR S ET

Page 49: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 49/84

VIZA - KIM

A KIM Monitor extension program which provides theautomatic display of the important system parametersat each step. The discussion reveals some details of the6502 interrupt handling mechanism.

~""""""""""""""~""""""""~""""~

After reading George Lang's arti-cle on his U-PANEL project (MICRO·COfy1PUTING, January 1979), I decid-ed to implement his idea on myKIM-1 system. U-PANEL is a frontpanel display for KIM. It uses an ex-tension of the KIM single step cir-cuit (SST) and a small routine todump the processor registers inbinary to a panel of discrete LEDs.This is done by connecting theKIM SST signal on pin E-17 to theIRQ interrupt line on pin E-44. TheSST signal is generated every timethe CPU SYNC signal is generatedand the instruction being executedis not located in the KIM ROM.SYNC is generated with each op-code fetch. Normally during KIMsingle step operation the SST signalis switched to the nonmaskable in-terrupt (NM1) line. This causes an in-terrupt during the first cycle of eachinstruction. Since an instructioncannot be interrupted in the middle,the interrupt is recognized im-mediately after the instruction isfinished. The NMI vector cannot beset to a routine outside the KIMROM while the SST switch is onbecause the first instruction of thatroutine will also cause the NMI ln-terrupt to be taken, resulting in acontinuous loop. Instead of the NMIGeorge switched the SST signal tothe IRQ line, KIMs maskable inter-rupt. This allows the interrupt to bevectored to any routine anywhere inthe system rather than just the KIMAOM. The IRQ vector was changedto the register dump routine whichreturns control to KIM after output-tine the registers to U-PANEL Thisroutine must run with interruptsdisabled to prevent it from being in-terrupted.

July 1980

Since I don't particularly care forreading binary lights, I decided todump in HEX to my CRT terminal.This saves building the U-PANEL.and provides a more readabledisplay. The changes to George'sprogram were simple and I soon hadmy code ready to test, but I couldn' tget it to work properly. I doublechecked everything and it all lookedOK. So I started to analyze the pro-blem.

The register dump to the CRT wasworking, but the CPU was not beinginterrupted after each instruction. Itwould execute a few insturctionsand then stop. When I pushed GO itwould execute a few more and stop.After a little thought I decided to seewhich instructions were being ex-ecuted without being interrupted.

Joel Swank

Soon a pattern emerged. The CPUwas being interrupted only after in-structions whose execution timewere two cycles. Any instructionwhose execution time was 3 or morecycles was not being interrupted.Why? The answer lies in the MOSTechnology hardware manual. TheNMI interrupt is edge sensitive. Thatis, the interrupt is recognized by thechange from high to low not just thepresence of the low signal. Also,once the transition has occured theprocessor will be interrupted beforethe next instruction starts, no mat·ter what. The IRQ Is not edge sen-sitive. A low on the IRQ line mustcoincide with a zero in the pro-cessor interrupt flag and the last cy-cle of an instruction. If the IAQ linegoes low and high again while theCPU is not ready to accept inter-

MICRO -- The 6502 Journal 26:47

Page 50: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 50/84

rupts, the interrupt will be missed. Inthis case the SST signal because itis driven by SYNC will be low duringthe first cycle of an Instruction andbecause of propagation delay,slightly Into the second cycle.Therefore any Instruction that Is 3cycles or longer will cause the Inter-rupt to be missed. So the interruptoccurs only after two cycle instruc-tions (the 6502 has no one cycle i n-struct Ions),

To fix this problem the SST pulsemust be lengthened to last at leastas long as the 6502's longest in-struction. The circuit in figure onedoes this. It uses a one shot to ex-tend the pulse. This circuit producesa pulse of about one millisecond,much longer than needed, but itdoesn't matter as long as the pulseis long enough. This circuit will pro-vide a properly operating U-PANEL

After resolving the pulse lengthproblem I decided to add a slow mo-tion feature. This would be a modethat would execute an instructionand then, after dumping theregisters, instead of returning toKIM, would delay for a program-mable amount of time and executethe next instruction. This wouldallow the execution of a program inslow motion without pushing GObetween each instruction. The codeneeded to add this feature is fairlysimple and it was soon ready to test.I implemented it with a time value at$E9. This value is the delay time in

in quarter seconds. lero meansslow motion not in effect. On firsttry I set the delay to two secondsand started the program. The firstinstruction was executed and theregisters dumped, but there pro-gress stopped. The delay was work-ing properly and the display beingupdated every two seconds but thePC was not advancing. It was stuckon the second instruction. I stoppedexecution and started it again. Thistime the second instruction was ex-ec uted and it st uck on the th i rd.Once again the problem was in the

non edge sensitive IAQ interrupt.

When in normal mode, each in-struction in the dump routinegenerates a pulse. These pulses areignored during execution of thedump routine because it runs disabl-ed. The pulses stop once executionenters the KIM AOM. The ATI ln-struction that KIM executes as aresult of pushing GO enables theIAQ and the first instruction in the

26:48

object program generates a pulsethat causes an interrupt immediate-ly after it executes. The dumproutine is then executed, and con-trol is returned to KIM to wait for thenext GO. In slow motion mode theGO routine is executed via a JMP in-struction from the dump routine. Ifthe pulse generated is longer thanthe time needed to execute the GOroutine (about 38 microseconds) theIRO line will still be low from theJMP instruction when the ATI in-struction is executed. This willcause an interrupt immediately afterthe ATI instruction and no instruc-tion of the object program wi II be ex-ecuted. To solve this problem, thepulse must be shortened to lessthan the duration of the GO routine.This can be done by changing theresistor in figure one to 2K Ohms.This generates about a 35 microse-cond pulse, longer than the longest6502 instruction but shorter than theKIM GO routine.

I called my version of the programVilA-KIM. The code for version 1 isincluded. It provides a formatteddisplay on the CAT after each in-struction is executed. Version 2 hasbeen enhanced to display in largecharacters on my SWTPC GT-6144graphics board. This display on my19 inch TV can be read by an entireroom of people. VIZA-KIM makes anexecellent device for learning theoperation of the CPU. The exact ef-

fect of each instruction can be seen.

The VilA-KIM dump displays theprogram counter (PC) and the firstthree bytes of data at that location.A nice enhancement would be to in-clude a line for a disassembled in-struction. The next line is for thestack pointer (SP). The current stackpainter is displayed along with threebytes from the stack page. The firstbyte is where the next push opera-tion will store its data. The 6502stack pointer always points to thenext available byte. The next two

bytes are the data from the last twopush operations, or the data thatwill be read by the next two pulloperations. If the last push opera-tion was a jump subroutine (JSA) in-struction this will be the return ad-dress minus 1. Next are the Indexregisters (X and Y) and the ac-curnutator (A). Last is the processorstatus register (P). All data isdisplayed in HEX except for P. P isformatted In binary since its in-

MICRO ._ The 6502 Journal

dividual bits have separate mean-ings.

To use VilA-KIM set the lAO vec-tor ($17FE) to the address of thedump routine and turn on the newSST switch. Be sure the use Pregister at location $F1 has the in-terrupt flag (bit 2) set to zero, si ncethe object program must run with in-terrupts enabled. To use slow mo-tion mode set $E9 to the number ofquarter seconds of delay desired,enter the address of the object pro-gram and press GO. Instructionswill be executed one at a time afterthe desired delay. To stop executionhold down any key on the KIMkeyboard. To use normal mode clear$E9 to zero and enter the address ofthe object program. Operation willbe the same as in KIM SST mode.

VIZA-KIM makes one aware ofeach change of the state of the pro-cessor as each instruction is ex-ecuted. This makes bugs more easi-ly spotted as well as giving one abetter understanding of how the6502 works.

VIlA-KIM

PC OATA2~IH3 C11!1A9~

SP-FF 305748X-~6 Y-IiIA

A-01l'P

NV ElDIlC1 i I1 i1101 i11 i11 i11 i1

PC O,o ,T A201M 90F8B5

SP-FF 305748X .. 1iI6 Y.-IiIA

A-1iI0P

NV BOlle

10HHHHH~PC OAT A

2004 998[1HH~SP ..FF 305748X .. 1iI6 V-lilA

A-00P

NV flOlle, 1 1 !HHHl01i1

July 1980

Page 51: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 51/84

a ::

'"Ce'" u;[ 0..

I- ....2 2H H

a :: a ::0.. ...... a.

-- I- l-I- a:2

ClQ_~.a. . .Ul CJw c.,....::0"'::<<1.10::.> ~~:r: tl..'"

el-eou,Ow

xx~""'UJW I-

X ... .. I-Zw>-c(~OW 0Z (!)UH'\2

H:i:

::::Cl-I-ct<Z:x.a:WHc( O

...[r: ,._ a:Uo.OOn..

-- 'x .... -U 2>t-'I$II-Ic(

:JCiiiiIIO:1lawa.o..

>it :UeI-U >

X '"'" 0I- :rz u ..H W0 ~ :IJ

Cl 0.. --' WZ « I-H >it: > > -a u III< < a.w I- '" '"[ <1 .1

l- I-W a 2 za: : < . . . . . . . .0 0 a: : a:::i . . . . . . --' a. 0:.

--' .. .. a :: I-0 .. C !l '1 - ~a:: w >- x >-~:na...mjICrnOQl u H 0>

r " \ . . . J : ' ; ( ! 3 : : 1CJ~ . . . J " " ~-Im-J<! 5 a t l ( Q . . _ U ] Q _ U ) D . . a . . a : ::I15IIo..lI5iIIQ..[J)WOW.::r!O'):ltaa..a... OIDIl. wn. a..

a: : wa : : a : : 0 r

'" '" l- t- a: :I- .... e !oJ

'" '" --' . . . . I-

'" . . . . .... '" ::J 2 '"1'I Cl 2 ::0 H H. . . W w .... ::J :r '"a :: a: 0 U ~n... w ...

'" c U LU : ra : :w >< >- '" < ",0 e:r: :c 0..1- ~z

l- I- I- ::JH!oJ 2 Z W Z "'' '- I-Wa: .... . . . . a: : H >0 <a a: a: a a: : <0 0-2

'" . . . . . . a. . . . . . . 0.. '" "- a. "- "'-- ' "' ....~ ...J ~ ~ -J I- ~ ~ ~ ~ -J I-:J ~ ~ ~ I- ~ ~ I- ~ ~ ~ ~

~~~~~~m~~~~~mc.~~~ m~~~. ~M~m~w~~~mom~w~~~~~UI-~~~~~W&~~m~~~~2m2~OC~~~2wu~~m2mm~wU>X::iX::o><a . ... "' ...: : < > - a . < : : o c : : o c a . a . : : ; ; o . . : : o w a .

::0 '" '" " ' > - : : i : : i ' " " , : : i : : i > - : : i ' " ' " ' " ' " : : i ' " : : i ' " : : iH ~ 1-1 HH 1-1 H H H 1-1 ~H ~ M H ~ H H 1-1 H 1-1 H

c«<~~~oc><oc>~~~~<~«~<~«><~~>w~«~<~~c<~~~«<~<~<~<~~<<CrC~~O~Cc~z~zc~OWO~WCOOOl-ocmz~zc~cmc~OI-O~Omo~c~c~c~O~cc~- - , , , , - - , , , - - , , - - , - - , , HUu > - - , U> - - " - - ' U > ' - - " - - 'W- - , - - , ' HU 'W- - , w - - , , - - , , - - , < 1 . I - - , , - - , , - - ,W- - , , - - , , - - , w - - , , - - , - - , a .

0..::J

--'>it:I-m

a.::J--'

'"o ..'\

W !oJ . .. w

'". . . '"'I

~<~~w&ms<~ ~~U<~~Numm~-osu~ n~N<-~~~m<-~vwu<-~~mq<-~~-~W~C-N<~~U ~~5~~O~~~~<&W&~U ~~-W~O~M-W~C~~~wMC~~~W~O~~

~~~~s~mm-5m5m~~~m~~s~m~~~-&~_5~~~~~~~~~~~&~~~m~m~~~mN~m~m<NN~N~~Nuuc~ro<N<mNCN<~~~Nuuo~m<N<N~m~N<N<~<N<N<~~~<~q

~mC~N~~<UW~N~~m<u~-n~mwo~-~~~~ruc~-q~~~O~N~~~mO&N~~~W~mN_ _ _ _ NNNNNNM"~r ' lr ' lr ' lMM•• • • • • ~~~~~~~~~~~~~~~~~~~~~~IIl~~~~~~~.&m&~&&mmmS~m&m&5&.~&mm~~ssmm&~sm~5m~5S$.m~mmmaS&mm5&QS~~~~~~M~n~~~~~~M~~~~~~M~~~~~~~~~~~~~~~n~~Mn~n~~Mn~~n~~~

:.:to a.. U~z ........a:~S:JIII"'":::lo, •• a· 0

a.aa--'0.

'" ,.. . . . . . .....JU)..::(wcC.II:l(..JouaZCalwQ..OCCJ.J0)_.I1CCJ

a. .oa-- 'a.

w

-q-SN-$ ~~15Ii~mn~ lI..

..0l15li0'015110'-1$114(&Nm<o<n..u--

""",["--a-Q]C1'!S1.~~~~~~~ c <Qmll5illl5ll!Sil$!Q1IS:II

MI'""\p\t"\cr\r\~~

~;~;;;;~;~;;~;;;~~;~;;~;;=~~;;~;~;;;~~;~;;~;;;~~;;~~~~~~~~~~~~~~~IIl~~m~~IIlm~~~~~~~~~~mmmm.mmmmm NNNNNNNNNNm~~msmmS~I5Ii~mmm~s&m&5m&.s&m$s&mmSll5illm_~ ~ __ ~ ~_~r ~~ ~_~~G_mmssm~m$s.smmma5.mmm_ssmmmS&Smmm.&._.5mmmSmm$sm __ m&.5mm&5S$5S&

~. . . . .>it :,-c

'"..".0:'". .>

)-

a: :O'-ct:c(CUOw L .& . .WWWWUJWW ....ISI5iIIGI~II$l&1Sl ....1Sl.1ISIi'lS:l 1S I1IS I'IS II'15II HEAfA(9WWIfAEa CI

"":a ::cm:J). . .Uaa:a .

,,.. . . . ."

'"H

a: :,_j]L.,.

z" '....",0.-

"LL:Jo

,_"' ' ' '>-1->-czz--' ........... 0:::

" '<La .

a: :. . .,_ .z. . . .oa,

><w 0:.: :r:

0>0 : : : <I..i..l.UZ LuOIIB~HI- ZW

~ U;:I: ..... ,........~<~O::t: r-LiJ

L a . . . : : . r ~.:l:J..W:l:~~...J q;c(o :EwOXU4-:rUOH:: : : I : ! I : :EUf-WO< ...... -Jo-! H

H t-C)l.1->-1-1<-1-- I- t::Iz:x;;zzz ~O cH~HHH c(C[~c(a : ; : : : r r : : 3 : a : Z ~WHL . & Ja . Wa . . . a . I 1 . . H U l a : : ~ a :

me..:"' . . . . ."" .""I5iII1I$I.'ISI

...... w

l . i . ! . t . . w l S l l mCO£ ' . C " ' - - C J J < C .N~ -< ( ' I " \ C )m l l 5 i l l u . . a\ ' uU l , . . u lWWlJ J ( ' . [ " ' o o .C lA . ..r-..,...._ ._ .... ....... ..-

:t:C>-C

-::l%::JUU<;

:r: II:W UJI- ....:n z... ::J

'"0 W [.):t:

%: . r. :I c:C::J :t:

I- '"

'"0 _ :t:oil a,

s:wZHa]..

"U<0- ......: 0 . ...

WI. . . .

:t:al-H

Za:: r

. . .<.:)

«II:oI-

'"

I..i..ISI-Nn~I..r\L aJ . .. .. LLu..u . . .L l . .LL.ISlll:iJiISI&PSl.1E5II1!5lI15II1ISt~ISIiIlS:llIlSl.S

filStljt9u;aWB

* • • • • • •:r:w

t:;I...} (!It!!

. . . J : I lL J~OI .& J I . . .UUtJn:~UQ:a:Q.Q.Q. .UJct>-)(

. ..- - ' ' ' '> - 1 -ZZ

........00a. a.

. . .. • • • • • • • • • •

w><;:J)

.... w> >c c

'" '"

>-x

LUW»«<;t J) . .. .

w ,_, . .< 20n ...

L-

a '"w co "-z'"0I- a: :> < wW N

* • • • • • ..::t;.....JI

CI~I - t -:i:o..Cl..a.. OH>-

o Cl:JO...J::t:>...,I.:JJ:n:n:l.a.,c:tJ;I=S2::i:n..a.::n

~QQIISICIiiiIi~1ISI~ 1 I S I i 1 l 5 i l l 1 l S l 1 S i i l . 1 S I i 1 l S ; l

51 ISIi I I 5I i I ! 5l Im ~!ild!OI

NC\lNNNNn.I

"'.,.. . . . . ...... ,NN

ro--'

'"mc--'

I - ~ J -U>-t-2:c>-:n .... ~ ..... . i .I

. . . . . . : n . .UIDI -UJO) (~. . . J 1 ICC1 - . . . . I-H : i : J .W . . . .a : : I ' -O : : : Ja ; :ZH~O~UUl t l .CQ. I - l r- l - t nCl

'"""""'I. . .UU

<

--'J-Z

--''''''uo0.0..

xI-

Z-".":LI--lWUJU0 a::r::l.::l.>-X:

:.:UJ:J)

: 01 -::JH]..2

:1)H

1SL1SII1 ISIJ~$ ' IS : : I '151

1Sl1:Slo&&~1IS15I

st5llm&$l Slll ISlC\lC\lC\lNNNN

Ll

a:w IX: u,NU--,

."a:o

~ ' I I I ; « < . . : ( < ( o I I ; ( . : t : c ( > X x : : < o :~ _ .... _.J 1- .... _.I I- I- I>- .... ::.. ) - UJ:n o . . .U JQ ._ a JU ]Q . : t ' J t n . : : . o ~ I < - - : : n '

.0:N

H

>'-'a:H

oM lI..c( l'SlIm"3'rJ"'I NCD1 .1 .. u ... .WlL.. I.I..~LLLL ..... a:J

IJ'CD~COI.! ' \" ,Cl~iJ' \q. .o<. .o5co. .oCO'oCaJco\oQCOWalcomcoC\l

l I S ! ! s r v n l h . . . o w o ; : e : a ' l o . . . . . -- n o& S t S ; i , ' S I I S : I I I 5 i I ~ I ! ! i : I i I 5 i l o ' t 5 l $ . _ _ _iI5l 'C5l1Sl&&&twSf!..l:$$SS'flillaiiiIIr'\ ( 'f '\ ~ t"\ P'\ r~·H'··\ "'\ r"''''"'''d'''',,·"\ n r' \ " '"

~~; ; ;~ ; ; ; ;=~~ ; ;~~ ; ; ;~ ;~ ;~~~~ .m-Nr ' lC~~~~; ;~ ; ; ; ;~ ;~ ; ; ;~ ; ; ;~ ;~ ; ; ;~ ; ;~&$~I5I~~mm5--'_~~---~~NNNNNNNNNN~n~nM~MM~~~~~~~Q~~q~~~~~~~~~~~~~~~~~&m&s&ms~~&m&~Sm&m5m~Sm$msml5l~Ss~.&~~I5I&mmm~S~~~m&&&m~&msS~&&~~&S&m&&S~Qm~m& Gm&Gmms smmGs smm ss m.G mSI 5l .SG 5mm &l5I ~mS5S&& mS&mC$~m~~ &&mQ&&&m.

~ l S I Im l i S : l ' &~ I I ! i 3 I ' S ~ ' I SI I S I i l S l o l S l l m&G l S I I l S I l I S I i l $ : l l& I $I I i lS t1S l S IS I 1!IiI.15ii1Sli

NNC\lNNNr'\INNN

Page 52: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 52/84

oa ::< I 1 . aJ .a : . ..

... N U..J ..

oor:

mO NUa:; ... w.. II .. U.,J .. N

.111 III. 1. 1111.111111111 11. 1

.m_~C.oc ••• S.-C<.~~.N~~C~CC.SNNN~~a •• NNN~~~ __ N~~N~~~~~ •• N_W ~ - -N~~~~~~~C~UOW~.-N~~~~~~~<~~N~NNN~NNNN~~NNN~~~~~~~~~~~~. ~ ~ - ~ - ~ - - - - - - ~ - p - - - - - - - - - - - - ~~~~~~~~~~~~~~"M~~~~~~~~M~~~~

~~~.;;;~;;;;;;;;~~;;~;~;;;;~;NNNN~~Mn~nMnnnqqq~q ••••• ~~~~~NNNNNNNNNNNNNNNNNNNNNNNNNNNNN_ ._....- - -...- - - - -...- - - - - -..

oc. c:a : . .. .... II U,_J ..

o 0or: a:Wa; Ula. ...... c r . .. ..~ U N U..J"

oa: :

,..IW(ClL.II .. N J _.I

I I I I 1_ .' • I I I I • • • i I • if • • II • • I I I • I I •

'"D:Ii

11.III

I!lCD

:Ii>( ""D

:Ii)-

P'\'I51IIIIiIISli od'- .......- oc- m. c 'III( 1"\. C m C -<.m 0." 0-.0 m C {~~~~.V~q •• N··.~~~. __ ~~~_N~Mm __

.-N~~~~~~~<mUOW~.-NM~~~~m~cmuc_ ••••• _ •••• mm.m_~ ~ _

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -~Mn~~~MMnMn~M~nn~~nnnnnnMnnMn

...U

'". ....I.aJ

oz

<>UI.aJ...'": J-

:J:I: :JOW <>U.... w

:r 2~c(::r."'"c;(;:)W ....

"'2....... :1:: .. 0< . .. .. 0:J ............. ~% ....

:oO~ .....LI.IID I-.q;>-C(:.o~

0-

Z:>

'"u

e- -a. . .

C:nXJ)CCW W0:1: 0-

W~t-~~ .... uLaJ)-:JW~W~)(

~ Woc(> -m .."'-IZLlJOa :: <>-2

0-

><WZ

'"wZXO1 1. . .. .

0-...:r:;E

<>'_:s.",0",-,0a:::oz

Z:I::J,_wa: :

0-00 0 . - ~ c n

Cl :: : : l: . .. J "' - b .2 . : o O( Li L l J o : a _ ' . . J O " " ~ 2 : : : J 1: : : I : _ j o ; : r a ; : , . . J I . . . :t-t...Ja...:DZUU:1)II9 ~1-

~ U<w ow I-Q.l.{ ...J)(la..O:::::)- uv to LIJ ...J II(

~W""'DOa:1-1-[!JlAzt.!lum

::0 :: >. . . . ..<c<a7~~«<3XW~~W~~~- ' , _<>wm:J lcco -owwZJ )~Z 'CD: :O~ » Jm~~ . . . J . . J ~ _ jm c c ~ om~ ' ~

< : III11. n,:O J :J-' _

0- 0-

. ..'" . . . . . . . .

o_

:IJo;z

OWU-~--~~~~~Q~~m ~<~~m~~......NNI.aJ~&5 ... ~~-~UNq

D~~S_5~~oom<~s~muso~W<~NN«m<~uONuC~N~

~~~m<C.N~~CUC~NV~~U«««mmwmmmcmuuuuo~mmmmsm_m~~mm5~5&S&~~~~~n~~n~~M~~~~~~~

a:w0-J ). . .I!lwa: '"-

a:. . .a,totil, ..0-«

I!lZ. . .

0- a:;~ 0-~m~ U)

" '. . .'"a: « 0-III <I. til Z. . .

a:tl.

> - o : :> -wo -moo-[Q.. .J1r

0-a:;~ •'"to

« tJ)

CD 2a,

. . .wlIJW"'O'lw~m..t&I1)N«..o

. ... ... 'II I:t ~0000~5115111S'11r'i P'H""\cn

oC>Il')

+

d: l I : :o(0

'"D

..J

..J;;)

Z

«z. . . '". .. 0-J- 2:)- H

'" _

'"..J 11.a: W:Jw o-z . . .0- ~ I- ;z;z IDZH '". . 0 : : :E0 C( ,_ wn, ... x:

0- . .. .. . UH w:Ja: z:.: ",al. ,_ .

I 0::2 .Ja..J:.1l.. .. .. .. .. ::l :::tt-:l . .. . : : : : la. a . o u a . . . . . J t L . . . JClSCJCH~~:J~[Ot!D-WUl;:)WWt1)cn: : :E19220:l : : : l" ' ' ' '

2~.......ct:)-!I(oa:ULIJLJW~~OOWmZ;;1!';ZZi-LO_ . I . . . . Jm " " ' l I - - - !D lHwa : :

ml l S l c c a J ' S <MOJ t . & . .L ul lSwl lS l<: lL I . ....Wl LI

11\& ... 1 5 il ll S li . .. . ol lS l o ,£ l t I ii ii I Il S Ial<WI.i..NWOWC~

("'..O"(oOL....(\I'U"...oaJCOCOCClWWWlUl.LJSo I l S l i ' S l S l S I i l l 5 i t l 5 i l . l S I I l I S l &C"\P'\C"'\ t"\M"",,P"lP'\~~

XQI

o

10

-:ieo (3.. . C> ~Il')

iii::+ ;5s; . : .

II !!:lI$I& .

a:l.J....lI..l.LLL.lJ.. > Io-IN II:( I ~H~ (C~LL o,u _.J ....J ..J ..J _r • ._ ... ,_ 'I ,. '" . . U _ ~"

I • • • • I • • • • I • I , • • • • I • •

o~«<~&~~<~ow~oa~~&&&mS~&&&N~~~~N~~~m5~NN~

mucw~~~N~~~~~m~<muC~LL.WW WI.aJ ~ ~~~ ~ ~s&mS~mmm5s~m$~~s&m.m~~~~n~~~~~~~mM~~~~~~~n

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ~ •• •• _ •• _ •• _ _ ~ _ ._ ~ _ _ •• _ ~ _ _ _ _ _ •• _ " _ _ •• ~ _ r _ •• _ _ _ ._ ~ ~ ~ •• _ ~ _

~~N~ ...~~~~~m-N~C~~~~.5_N~q~"O~~~s_Nmq~"O~~.S-N~ ...~"O~~~&.N~C~~~I1).&-N~.~~~~~~~~~~~'U"~~'U"~~OVq~~~~~~~~~m~~~~~~~~~~~~~~~~~~~~~W~~~m~mmm~~~~~~~__ ~ ~r~~_~ __ ~~ ~ ... _~ ... r __ ...~~_~_ ......_ ... ~ ~~ _

sms_m_&&masmmsms.mmm.~mmmm5SS5t1iiii11S~s~m.~s5Smm&QSm55S&mGm&smmtliiiill5&mmSmG

I!lZ. . .>«III

> <W:.:

. . .zH

a:a.

NN..-(f)-I

~'II

N ...-N-I<t C O III ( .)

;;~~~;~~;~~~~;;~~~;~~~m;;~~~;~~ ~ .~ - .• . s ._ . .&~r-~~---~_N~NN~N~-~-~~~N~NNNNNNN~NN~~NN~NN~~~Nmmm m __ m ••••••••• __ ••• _

ZoH0-U;;)

a:0-

J)

ZH

". .W

oC>It}

+

:z:Jo

'"II'"

w. . .

'"oC(

U)

'":::I

I!lCD

'"'"

Page 53: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 53/84

Page 54: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 54/84

Microbes & Updates

Bill Watts of Provincetown, Mass phoned in thefollowing changes to Henk Wevers' article "Short-hand Commands for Superboard II and ChallengerC1P BASICs" (24:2S):

Page 26:

Line 028B Restore -tH 68

Line 028F should be 67

0291 should be 65,

0292: 61

0295: 64

0298: 62

029A: 63

02.9E: 66

Page 27: Line 0236 should read A2 58, instead ofA243.

With these changes, things should run smoothly.

Bif! Crouch from California writes:

Line 63000 of the program XFILE.MAKER (23:11)was sent as "63000 REM XFILE.MAKER". Thetypesetter dropped the line number and used it asa title. The programs wi II not work unless there is

a line 63000 in XFILE.MAKER so some of yourreaders might have problems with it.

Also, if you want to use REM KILLER on a pro-gram which has GOTO and GOSUB statementswhich refer to remark lines, you can change line310 of REM KILLER to read:

310 PRINT ARRAY(Y);CHR$(58)

26:52

This will replace the REM statements with a col-on. Although it doesn't save as much space as acomplete removal of the REMs, the program willstill work as before.

From Robert and Jon Prall of Silver Spring,Maryland found a problem in "Apple II Speed Tvp-ing Test with Input Time Clock" in the December

issue of 1979.

On page 19:69 line 8406 reads in the published ver-Sian, subtracting 159from ASCII numbers assign-ed to the individual characters does not cortes-pond to the position of characters the A$.

The inclusion of the quotation mark at positionthree in the string is logical, but impossiblebecause it causes a "Syntax Error" message, anda blank space should be substituted for it.

The corrected line should read:

8406 A$ =" ! #$%&'0* + ,-.f0123456789:; < = >

?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"

The position of the spaces in the string is essen-tial; the signs for greater than and less than mustbe included, as must the exclamation point. Theauthor's inclusion of the slash, the small 'm' amda space at the end of the string appear to be addi·tional errors.

With the corrections noted, the program runs verywell.

Rev. James Strasma sends this update to his erti-cle entitled "La wer Case Lister" (2 5 : 11):

A revised printer ROM is now available for CBMprinters without charge. It improves lower-caselistings. However, the 20 characters that failed toprint correctly in lower-case mode before stil fail."Lower Case Lister" IS compatible with the new'04' printer ROM., and corrects all characters.

MICRO -. The 6502 Journal JUly 1980

Page 55: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 55/84

Challenger II Communications

" ' " " ' " ~ " ' ' ' ' ~ ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' " ' " " ' " " ' " " ' " ' ' ' ~ ' ' ' ' ' ' ' ' 'Everything you need to turn your OSI with a 502 CPUboard into a 'standard' communications terminal:hardware changes and the software to run it.

" ' ' ' ' ' ' ' " ' " ~ ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' " ' " ' ' ' ' ~ ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '

As a co.llege student, timebecomes extremely valuable. A very

poor use of this time is sittingwaiting for a computer terminal.Corollary to Murphy's Law - thereare never enough terminals; andwho uses cards in this day and age?

Looking logically at the situation,there was only one answer, and myaS] Challenger II was it. Generouslyenough, Ohio Scientific has provid-ed their 502 CPU board with all thefoils needed tor serial lTURS·232inp utfoutput.

My answer was found. While

others are sitting at terminals tillthe wee hours of the morning, I canbehappHy talking to Myron (our resi-dent IBM) from the comfort of myroom. Stereo in the background,fridge to the right ... what a life!

Of course this also opens up awhole horizon of dial-up bulletinboard services as well as time-sharesystems. Options no computeristshould live without.

Hardware

Before any software can be writ-ten, we'd better have some hard-ware to play with. Convenientlyenough, the cassette port runs at300 baud. No problem here. Whatabout the -9 volts required byRS-232? Again we're allright: mostmodems only require a swing to zerolevel Great!

First, .Iet's start with the outputside of the problem. Locate, using

July 1980

OSI's 502 schematic package, thepositions of U31,R55, R5S, R57 and

Q2. Some boards mayor may nothave U31 on them already. If not, in-stall U31 using an I.C socket. Thevalues for the parts maybe sum-rnarlzed:

U31 7404R55,57 10KQR56 470Q02 2N5226

(hex inverter)(% watt)(% watt)

Carefully solder these to theboard, confirming the positions.Check for any solder bridges whichmay crop up.

Input becomes only a bit morecomplicated. In order to maintaincassette capability, a switch mustbe inserted in the ACIA input line(the cassette input clrult loads downthe line). Any SPOT switch whichfits on the rear apron will suffice(Radi.o Shack's paddle switches fitthe 3/4 inch holes perfectly). Installthe switch and we'll worry about wir·ing it later.

Again referr.ing to the 502 layoutsheet, locate U20, R61, R62, 03, and

04. As with U31, U20 mayor may notexist already. If not, be sure to use asocket when installing it. Once theirpositions are located, the followingparts may be installed:

U21R61R62D3Q4

740410KQ4.7KQ1N9142N5225

(hex inverter)(% watt)(% watt)

MICRO -- The 6502 Journal

Peter Koski

Be certain the board looks ri.ghtbefore continuing on.

Going to pin 2 of the ACIA (U3) isthe RX DATA foil. Cut thts foil atsome convenient point and solderthe center terminal lead of theswitch to the ACIA side of the cut.Solder one of the other leads to theother side, of the break. In thisswitch posttlon, cassette operationis as normal. Back to the newly in-stalled U20. Locate the foil from pin2 and cut it. To the U20 side of thisfoil, solder the remaining lead of theselect switch. In this swltcn posi-tion, RS-232 input will be routed tothe AGIA. A good thought would beto install a 3-pin in-line connectorsomewhere between the board andthe select switch.

A standard RS-232 connector mayalso be added to the rear apron. TheRX DATA is now at pin 1 of connec-torJ3 and TX DATA at Din 7 of J3. Allthe even pins of J3 are ground. (-9volts is bussed on the backplane,Just add your supply if needed).

Unless you feel confident in yoursoldering abilities, you may want tolet a trustworthy friend do the workfor you. It only takes half an hour orso, but errors could be disasterous- and it's your own fault.

What you are now left with is anRS-232 port which resides at FCOO(same as cassette port). The input isselectable: cassette or 300 baudRS-232. Output is always there,allowing for convenient printerlistings of programs being SAVEd to

26:53

Page 56: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 56/84

tape. The uses and tricks that canbeinplemented are too numerous tolist; you'll find them yourself.

As for the modem, the NovationCat is probably the top of the line ifyou can afford it. I have used it withexcellent results over phone lineswhich would have made speech

recognition rough, and I have notlost a bit. Plus it offers answer in ad-dition to originate mode.

Software

Two options are now possible,and I've tried both. OSI's BASIC isfast enough to service the port viaPEEKs and POKEs. However thedraw-back is that it is very difficultto output BASIC control symbols(comma or colon). A BASIC routineis the easiest route if you wish to setup a system for down·loading

locally-edltted files. This is a veryhandy routine which works welt Seethe two BASIC programs below.

On the other hand, the followingassembler routine turns yourbrilliant computer into an ignorantterminal. Running with this system,the Challenger II behaves like astandard ASCII terminal, except theobscure CTRL functions will appearas OSI graphics.

The package Includes a protectedfield at the top of the screen to pro-

vide a 'touch of class' without tak-ing too much screen space.

As written, the routine is loadedInto 2000 hex. However, it could berelocated fairly easily. The onlymonitor routine called is thekeyboard input routine, whose entrypoint in the 65V MONITOR is FEEDhex (should be the same for allsystems). The program continuallypolls both the port and thekeyboard, then displays or output(as the case may be) whichever is reoquesting service at the time. Auto-

line feed is provided only on out-put(as the case may be) whichever is reoquesting service at the time. Auto-line feed is provided only on out-putcarriage return. Most dial-ups willprovide line-feed with carriagereturn.

As an added note of interest, theRS-232 outputs trom both theChallenger II and modem are able tohandle two loads. This means that a

26:54

printer could be used on one line ..._~~"''''''''''''''''''--'''''' .....''(normally input) to provide hard- Peter is a sophomore at Rensselaercopy as desired. Certainly no corn- Polytecnic Institute majoring inputer system should be without Biomedical Engineering - Elec-RS-232 communications capablll- tronios option. His minor is in Com-ties. puter Systems. He hes an Ohio

Scientific Challenger C2-4P whichhe uses for both academic and hot»by purposes. Pete started his pro-gramming in BASIC and recently ad-ded assembler capability to hismachine's repetoire.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .' "

My system has behaved flawless-Iy through "rnsqa-houra" of hard

use. Good luck, and don't make MaBell too rich with your calls!

IJ .

1300~i -

5TRIKi r- t ]E I THER'S H iF f' K ttt E N TE R 'S

2 el~ 5 IF(Pill~(64512)p~,~nlTH a ~ PR i ~ ~TCH f.:~ ~EEK (64513));

2H; : :l j IF(ff[K(57ek~::)=l)THEN2 0 1 0

2B" ; i jI F F: . i: ( r : l[~~T:: '~$ ,1:~~ ) F J5 THEN PDKE fA 51 3] 1 26~GOlD210 f1 ,

ca95·t~i~E&451 : : : : iRSC( t~ ID$ ( r~ ; j : ;T; : : 11 ) )

MICRO -- The 8502 Journal July 1980

Page 57: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 57/84

P ET ER KC 6K I

U Jef i FILE E DIT ORI TEF. l 1 INMLS'r 'ST£HPHC r. J ~GE

1 01 9 f (JRl 1 S=1TO 2 0 : PR HIT : tD :T C L5

1 0 4 i 3 PRH · n : ? ~ n - n

1110 G J)T O 10 10

2~ 13 FO R CLS=l TO1 4 : PRH -H : r f l 1CLS

2 f ~15FOR( l l ; : !

2 D { aPR IHT: P R IHTIi

2 ~ - S ~ jF ~ ~ I HT:R I N 1 : LN= l

2112 U l=LH +l: U OT G[ ' I f~=0

} } ) LOC f inu [DITC1~

PR I t- IT : P R I N T

F R IN T : P R IN TII

3 11 3 P R IH T :Ff-~ lNT

July 1980

3 1E ;0 Itf 'U T · L U lE " iL HlE

3 2£ ~ ) F ORB =(LN+ l) TO (L!N [+ l) STEP-1

4 0 7 3 F ~ ~ I[ ~ T,P R IN T

MICRO --The 6502 Journal 26:55

Page 58: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 58/84

11

RS·232 DRIVER

Jl::'U~ T~

AS : : ( ~ l ID $ ( T~~ . $ ;r t : J 1:-) =1 ?2TfBit '1J f . . ., €A5 1 : 31 $ 3 : GOT ! )4 ; ~O0r41.j~u.. F ~ SC (M I[ : t$ (r ·~$I T:~•1) )=1~:~P" iHOJ~.kr&4 5 1 3 , 4 4 :GO rO4 2 uB..,....-"_,_

4 1 4 f 11 1 =ASC(r l ID$(T~~1'""_; j ) ;~il:~J. T~[NO"l1'J'r E . 4 5 1 3 1 ' 9 5 :GOTD"'-1:-'1-." ~ , - Ii . rr us : i '_"!~L 'tC,i'Ki

i CEI-·.-rr rnrLIJLT!L. i iL~

T O U ~

From Pin 1 on J3

+5V

To Pin 7 on J3

R57

5 iH3 !Il"" 1Eff'$qr~!i0~ TP £NTE~t : [ t- (H r-CHR$(liS)1 . 1 " '

51c1 5!F T EN P $( H)=~~ y T t £NTENP~-(H)=Cl l J . ~~1 2 4 )Ci·-rr= l~ TS 1p $ (H )==~ ; rTHENm-~~~~) =CHR . t . (;ru'" ))lC-) !! l.CO

5 15 5 F Q R ~ = 1 T O 1 2~ ~ 3~N E tJ~.ff

9 2

U20 U20

RS·232 RECEIVER

28:56 MICRO -- The 6502 JournalJuly 1980

Page 59: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 59/84

001(): CHALLENGERII 0540: 203C 59 'y

0020: TE RMINAL OPERATING SYSTEM0550: 203D 53 = 's0030: BY PE ' !'ERKOSKI 0560: 203E 54 "' 'T0040: 0570: 20 ')F 45 = 'E0050: 2000 TOS ORG $2000 0580: 2040 4D 'M

0060: 0590 : 204-1 1 , 2OE LDXIM $OE

0070: 2000 A9 20 LDAIM G;20 0600: 2043 BD 1920 LOOPBLDAX

$20190080: 2002 AO 08 LDYIMsoe 0610: 204-6 9 D EC DO STAX $DO0090: 2004- A2 00 LDXIM$00 0620: 2 049 CA DEX0100: 0630: 204A DO F7 ENE LOOP0110: 2006 9D 00 DO LOOP STAX$DOOO 064-0: 204C A2 19 LDXIM$190120: 2009 E8 INX 0650: 204E ED 27 20 LOOPC LDAX $20270130: 2001 , DO FA ENE LOOP 0660: 2051 9D 61 Dl STAX $D1610140: 200C EE 08 20 I N C $2008 0670: 2054 CA DEX0150: 200F 88 DEY 0680: 2055 DO F7 BNE LOO01FO: 2010 DO F4 ENE LOOP 0690: 2057 A2 40 LDXIM $400170: 2012 A9 DO LDAIM $DO 07 00: 2059 1,9 94- LDAIM $94C180: 2014 aD 08 20 STA $2008 0710: 205E 9D EFDl LOOPD STAX SD0190: 2017 4C 41 20 JMP $2041 0720: 2 05E CA DEX

0200: 201A 4" ' i 'c 0730: 205F DO FA BNE LOOP0210: 201B 48 ' H 0740: 2061 AD 00 FC LOOPE LDA $FCOO0220: 201C 41 'A 0750: 2064 41, LSRA0230: 201D 4C 'L 0760: 2065 BO 1E BCS LOCA0240: 201E 4C 'L 0770: 2067 EA NOP0250: 201F 45 'E 0780: 2068 A9 02 LDAIM$020260: 2020 4E 'N 0790: 2061 , 8D 00 DF STA $DFO0270: 2021 47 'G 0800: 206D AE 00 DF LDX $DFO0280: 2022 45 'E 0810: 2070 DO 20 ENE LOC0290: 2023 52 ' R 0820: 2072 OA ASLA07,00: 2024 20 0830: 2073 FO EC BEQ LOOP0310: 2025 20 0840: 2075 4C 6A 20 JMP $2060320: 2026 49 ' J 0850: 2078 AO B9 LDYIM$B90330: 2027 49 I J 0860: 207A A2 00 LDXIM $000340: 2028 54 'T 087 0: 207C Cfi LOOPF INY0350: 2029 45 'E 0880: 207D FO E2 BEQ LOO0360: 2021, 52 ' R 0890: 207F E8 INXo"Z ·70 202B 4D 'M 0900: 20P.0 FO FA BEQ LOOP0380: 20?C 49 'I 0910: 2082 4C 7F 20 JMP $207F07,90: 202D A E ' N 0920: 2085 AD 01 FC LOCA LDA $FC010400: 202E 41 ' A 0930: 2088 29 7F ANDIM $7F0410: 202F 4C 'L 0940: 208ft. FO D'S BEQ LOOP0420: 2030 20 0950: 20se 20 Be 20 JSR $20BC04" '0: 20 1 4F '0 0960: 20SF 4(: '; 1 20 JMP $20610440; 20 :2 50 'p 0970: 2092 20 ED FE LOCB JSR $FEED

0450: 2033 45 'E 0980: 2095 cg OD CMPIM$OD0460: 20:'4 52 'R 0990: 2097 FO 09 BEQ LOCD0470: 2035 41 ' A 1000: 2099 8D 01 FC STA $FC0Ot1RO: 2036 54 ' T 1010: 209C 20 BC 20 JSR $20BC0490: 2037 49 'I 1020: 209F 4C 78 2C JMP $20780500: 20 '384E 'N 1030: 20) ,2 8D 01 FC LoeD STA $FC010510: 2039 47 'e 1040: 201 ,5 20 BC 20 JSR $20EC0520: 2031, 20 1050: 20A8 AD OA LDYIM$01,0530 : 203B 5 : ' 1 's 1060: 20AA AD 00 Fe LOCE LDA $F

July 1980 MICRO -- The 8502 Journal 28:57

Page 60: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 60/84

1070: 20AD 4A Lt : :RA 1610: 212A Ee . INX1080: 20AE 4A LSRA 1620: 212B EO 40 CPXIM$401090: 20AF 90 F9 BCC LOCE 1630: 212D qO FS Bce LOOPZ1100: 20B1 8e 01 FC STY $FC01 1640' 212F A9 40 LDAIM~40111 0 ~ 20B4 A9 OA LDAIM$OA 1fi50: 2111 8D ED 20 STA $20ED1120: 2o.B6 20 BC 20 JSR 520BC 1660: 2134 A9 00 LDATM:!OO1110: 20B9 4C 78 20 JMP $207R 1670: 2136 aD FO 20 STA ~20FO1140: 20BC CQ OD CMPTJ'II 'OD 1680: 2139 A9 D2 LDAJr-!~D?1150: 20BE FO 19 BEQ LQCF 1690: 213B aD EE 20 STA S!20EE

1160: 20CQ C9 OA CMPIM$OA 1700: 21~E 8D F1 20 STA $20Fl117 0: 200.2 FO 28 BEQ LOCG 1710:2141 60 RTS1180: 20C4 AE De 20 LDX $20D8 ID'"1190: 20( '7 9D 00 D7 STAX $D7001200: 20CA Aq 20 LDAIM$201210: 20e c 9D 40 D7 STAX $D7 401220: 20eF EE DB20 INC :!'!20D812"0: 20D2 A9 87 LDAIM$871240: 20D4 9D 41 D7 STAX $D7411250: 20D7 60 RTS1260: 20DS 00 BRK

1'270: 20D9 A9 20 LoeF LDAIM $20 [M ]D ©~@ © [}{]~® ®1280: 20DB AED8 20 LDX $20D81290: 20DE 9D 40 D7 STAX $D740 for the AIM7,00: 20E1 A9 87 LDAIM~871310: 20E3 8D 40 D7 S~A : ! .D7401320: 20E6 A9 00 LDAIM$O()1330: 20EF 8D D820 STA $20D81340: 20EB 60 R'J 'S1350: 20EC AE 40 D2 Loce LDX $D2401360: 20EF 8E 00 D2 STX $D2001; '70: 20F2 18 eLC1380: 20F3 AD ED20 LDA $20ED

1390:20F6

69 01ADCIM$01

1400: 20F8 BD ED20 STA ~20ED1410: 20FB AD EE 20 LDA $20EE1420: 20FE 69 00 ADCIMSOC1430: 2100 RD EE20 STA $2CEE1440: 210: ' , 18 CLC1450: 2104- AD FO 20 LDA r 2 0FO1460: 2107 69 01 ADCJr i !$011470: 2109 8D FO 20 STA : f20FO1480: 210C AD Fl 20 LDA $20F11490: 210F 69 00 ADCIMq:OO

llim(!Sr;}®@l®~~WtAl;}l31500: 2111 8D F1 20 S'l'A ~20F'1510: 2114 AD EE 20 LDA ~,20EE

1520: 2117 C9 D7 CMPIM $D71530: 2119 90 T I l Bce LOeG1540: 211B AD ED20 LDA $20ED AIM MicroChess with Player's and Programmer's Manual,

1550: 211E cg :w CMPH1$:']F complete Source Listings, Object on Cassette Tape.

1560: 2120 EA NOP$15.00 plus shipping [$1.00 USI$2.:OOAnywhere Else]MICRO Software, P.O. Box 6502, Chelmsford, MA 01824

1570: 212] 90 cg Bc e LOCG1580: 2123 A2 00 LDXIM SOD1590: 2125 A9 20 LDAIM $201600: 2127 ~D 00 D'7 LOOPZ STAX$D7CO

28:58 MICRO -- The 8502 Journal July 1980

Page 61: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 61/84

Classified AdsKIM Basic users: upgrade t- o full-featrd Basic with renumb, append,improved editor, fire system $UP-porting PET·like file commands &more. Incl casstt, manual, sampleprogs, campi source list. Mal'lYpracttca] appllca to KIM Basic.Send $43. for packg or SASE for 3pg compl descr.

Sean McKenna64 Falf'lliew Av.Piedmont, CA 94610

PET MACIrlINE LANGUAGEGUIDE: Comprehensive manual toaid mach. lang. I' lrogrmmr. More·than 30 routns fully detailed:reader ea n put to immed. use. ForNew OJ Old FilOMS.$6.95 plus .75p&h. VISAlMastercharge accptd.

Abacus Software .P.O. Box 7211Grand Rafj)ids, MI 49510

Apple II Sweet 16 AssemblerSW16 in mach lang & 1ntg basicpmgs. Understjlnd & use powerful16 bit' processor. Incl In disk &casstt based text ed is SW16assemb. & users' man. Manualerrtns treatment of SW16prcessnq, OP code descr, &more.Send $15. (~5. for man appuc toasserne]

Scientiffc SoftwareP.O. Box 1WStowe, fA 19464

Britlsp Apple OwnerslUealers!Write now to MGA tor extensivelist of specialised software andhardware fo r your Apple or 2020.We promise yeu'It be surprtsedll

Michael GurT Associates140 High StreetTenterdan, KentTN30 6HT, Englar;'ld

OSI C1P Superboard II owners,you need the 96 page tuterialmanual 'Getting Staned with YourC1P'. Fundamentals of BASIC,

. cassette usage, subroutines , logic& control are described in step-by-step marmer.$5.95 of , $1 J'l&hform:

TISBox 921-1'.1Los Alamos, NM 87544

The Relationship life Dynamic(Apple II Plus, 48K,$15.95:djs~)A unique pr9gramfor those whodesire to experience transformation in their retatlenshfps wlo filay·ing the high costs of eomrnerotalIt,rips'. Incl games ~ HIRESgraphics animation. orser from:

Avant·Garde CreationsP.O. Box 30161, Dept. MCEugene, OR 97403

AIM·55 system for saleIncludes Power A Plus power supp-Iy. Used less than 5 hours. Alldocurnentatlon included: $375. Call(617).924-0972, 01 ' write-:

EdWin M. K-etloQg

100 Robbins RoadWatertown, MA 02172

OSI Machine Cod~ Renumber PrQ-gram: selective renurnb all, part efBaSic prog. Fast, easy, no moremodifiea req. Avail astt-toad.checksum tape, or disk.' Disk sys-jnel. utility routines. Tape:$6.95,Drsk:$9.95. Specify sys &. amt ofmemory.

L&.JPeFsonalCamputing2606 Grand Avenue .Grand Junetion, CO81501

Applen snape Table Editor makessRape constr & edlt easy. 11 editcommartds allow c(eation, modttcaof shapes. Sav&& retrtables to usewI DRWA, XDRAW & SHLOADcornmnoe .ot AP II Basic. Runsunder firmwr Apls;t fl pf Basicw/32K RAM. Cas'Sette &manual:$2R95, or $2 (refund wi pur-ehase) for rnaunal only.

Small Systems SoftwareP.O. Box 401'37Washington, DC 20016

,0.SI SOFTWAR~: tapes forchallenger C1 p. sl,lperboard. star-

trek; starfighter & lunar lander;egyptian ruler; home budget. Eaclr$7.50. catalog SASE.

JDS Software2334 Antigua ct.Reston, VA 22091

AIM 65 NeWSletter-hardware andSoftware, UtilitieS as well as Ap-plications. Keep up to date in tlte IAIM 65 world. Target is publlshsdbimonthly. Six Issues $6.00fn US &CAN ($12. e!lsewhere}

Targetelo Donald ClemRR Number 2Spencerville, 0H 4S8B7

TAPE MONITOR CONTROLC1P and Superboard usres. Turnsrecorder on and off with LOAD ~npSAVE. Adds on to, rather thanmodifying board. Parts cost about$10. Complete planS:$4.00

Bruce Miller13325 W. Crawford DriveNew Berlin WI 53151

TRACER ($11.95) and other pro-grams available. Phone or wrIte;

Quality Software3194 0spiKa PIPrince George, BCCanada V2N-2TS(604) 563'-9839

APPLE BARGAINS! EASYAS 1,2,3!

1)D.CHAYES MICROMODEM:$32O2)Z,·80SOFTCARD by MICROSOFT:RUnCPIM an APPLE: $320

3)APPLE DATA·GRAPH

Screen, only :$25,or FREE with hardware order!

C.O.D. okConnecticut Info. Systems218 Huntington RoadBridgeport, G-T06608(203)579,0472Cl0924 on SOURCE

ELCOMP.BDDksCa ,. a n dFo , .d l. ,. t l b. C ommodo.P£ TE " b t c h a 'i lt er 'S u p lo r !, ,! P E T h ,a r d" w i ri !!Includes r - e p at r a n d i n t er t ac ; i n gIn,

IO rm i3 10 0A . P ro g ra m m m !l: tr i th a nds th l £ !ma t i c s_DrdorliD. I~O 111.00!KMI"o.ol l USl t ~. I . .. . ceM ." ",Au l h o r i l J il 1 i' l l! r e l e re : n c em.an l l . a , 11 01 t h e o - rig in :a l M i cr o so f t. 4Iii .iln d 8 K 8 AS ICd , . . ' op .d fo rAlt.i, .1Idt a t e r compu l. " i n cl u di n gPEl . IRS·SO .'Ad OSI.O S I IlWI1I!iI$ p le a se { (I ke : n o t- e!

O rd.r " " 151 $ 9.9,II p.,, ,'.' H ," db . . ~ l or~502 . nd f ; 802( S ·A~ CO ldhi" "I) 0 " "iI!<,a! 01Ill ' to • & .5 ~ .~p,n S·~~ '" d , '"" .R A M . R O M .dig. 1 10 . M U X I AI. O . [ PR O M P ,o g . O le . W , th < ch em o li cs.ndIUIl>!::td e s c . r i p t i o n s ,A m u s t fo re '« !rrK IM , SY M and AIM ow ner.O,d., N o. 152 I !.I5Mic,ocomputer Applicat ion NotesR e pr in ' 0 1~nl-els'mos . l im" o r t i; l ll l - t a pphc . a . tiC l o no t e s .I nd u di ni 2 10 ;3 .,8G85 ,8255 . 8 251 ch, ps .Veryn ece ,, ,, ,y f o rth e h al d. .. .. b u HOld" N o. IS) S 9.9~Complt l Sound GenerahonNew, r f 'V ~ s . t !. d p ' P li c a ti o n s .manu a l fa r tn e I ex as In s l ru rne .nbS N 7 64 1]C omp i.. S eu nd G 'n er > t or, C i" ur t b o, ,~ a va ua bl e ( 58 .9 5)O,der N o. 1,4 s 6.SISmi l l B l I s lr.1 l 1! ! 5. Sfrolram.sComp l e t ep r- o ~' i II m s lo r t he b llsine 'S '50u s er . M i I!! 1ifiil:L IM . 1" 'I en lo ry , In\lQICl!

Wri bl 't g a nd m u ch m ot !.I n t r o d u c t i o nIllIG Busmess App l i t . a l i oBSMany11 :S; l i n~s .Old" Mo ,156 SI4 ,g ilTh. F i" IS oo k 0 1Oh i oS,iontil;o. ~oI. IC o .n li li ns a n i nH o ou cli on 1 0 p er so na I c o m p u te r 5I)fL~ d escn b esllie Oh i oS ci en ti fi c L itl e. C o nM i ns f lx pla na lo fY d ia g fa m s~ b lo ck , " oa: 5 o lOn ,r id ts .~ i i 1 l5 a n dman yin teJe 'S l ingl i s t i n g - ' S ,Ha ldwarea nd s . i J l fwa r t IA-i o .r m a tl o n n e tp rn lOu s l ) '. a 'Yai lab leII Ia ile c om p ac t 'S Ou rc e 1 92DaB! ! s . .OlderN o. 151 $ 1.95T he F ir !t B o o k .o l O h ioSt . i ' e n l i l i o£ : ,V~ i . 1 IVo l. I I w n l a in s " .e ry v a ll ia b lel n fo rma l i o l la b ou t O h i oS d e nt iH c . m i c :r o c Gm -pol" ",I,m,. Inlroduclion10OS-OSDand OS65·U.n.tw"! m~ and dist r i bt n ed P f O C l !s s in g " s y s te mSo sp ec : iT i c i l i l l o n s . bu s f n a s s.ap1 )1 ca t i o n s .n .ard -a n d SQ ltwa f e f li nt san d hps.0,;" N o. 1,8 l 1.95M 'i ll ,g L is t P ro g r.m f o ,C h ,U "I " C I ,t 18KO rd !!1 N o . 2 0 04 . P er so na .l Ver si onOrdel H e. 2005 . Bu! ine ,s , s~er s . iDn

S 9 .9 5

s ~95Ohic Scientific£lpansion InformationC on",,~,.' EfP ( C" . . U .) t o 5 2 ,2 6d"pl'J D"" ' e< !,t,p.ny·slep mstruchons f g o ldD t ib h n l lthe elP s peed and d ISp lay s lz e !OrdorMo. 1.105 112.00Impor l. n l So l lwar el ., CUM1~1V31KMost p.".rfol Edllor/A"emblellor C o.,m od ol.C 8M 16 /31K'0cassette.VeJ l '1 2 1'5 1 - E d it or d ~ id e s s c re en10'0 3 p ar ts . S tH illi n~ te xt 'W I nd ow ,dile: 'ct"c om m an ds , ~ g se ria lCOfMliUlds. s ta tu s a ndI !marme s s a g e s ,A s.s em e le r c an b e s ta rt ed d ir -e .c tf y f ro m th e td ito r o r ( ro m lh e TTra.nsl .al .csIn t h r eePo lSSe :50 .If an ~ r f o r 1 : 5 . : n c : o u n tt r eo .i l i l J tomii l l lc(HUIIl toIbe edi to r. C as se ~ .~ i 'h 0 M O .

Old., No .)276 $69.00A nE N TI ON IJ 'P lE U S ER SS.m. a s a bo ve 1 0' A pp leI Io r Appl . " plus,Old" liD. lSoo "9.00MOH . J AHA /I m i k u -Machin!'Lan luag l l ! !P ro g rJ m m in l e ,n y !I n o C 1 I1 I! 11E om mnd ere C BM th e re is as . pa l l ! !R OM 'S o cu tw.a i nng[ ar i tsM O N lA llA ! I . Ih. ne w M OHJ AN A l l M a c tn nel"i.al' M on"o r in ROMo ff e r smore IJsergUIdanceand debugg ingaids Iban any o lhefmomlora" ' i i i l l l~] .e .t-od .a 'Y,II i s . I nd ;s .p e f l . s .ab lc for ;anyo l le illte nd ~g toIiak e II II I a d·'" 'a l l lageo l t he c o m e ut er s f ea iu re s T r ac e . l in k . d is a; s.s .- em b le , {r e r o -cafe, h ne asse~ b" ! 3B dmudl rneie [ ve ry c omm an dJ u nc ti oi 'l h a s d e ·m an d p r in t ou tCl l ) t LO I 1P rIc e ~ d u de se l le r ' lSI 'Yi ! !m 1 I InJ3 1O,;e, No.2001 S9 3 .OOJANI\·Moni io r o . ncasse ttefin t b! : PETS im , l . .to MON IANA / I"'Y Q.w~"ul.Ord.r N o. 2002 $19.00

ELCOMP PUBLISHING Inc.3673L Schaeter Ave ..Ontno ell.91710 (714 ) 591.3130

P J~ s~ s end m e th ebooks /s . ol iwa l e md lc3 ledbelo . 'W

o I enclcse S ,eodposlpald

o S en d COD(S5 0.1,.)

o Ch"I' my 0 VISAA't! 110 _

E ~9 1[ d at e S "~ g lla U J re _

B o o .N o. B oo . H o

D IY ", sub ''''PU on 10tlcm~~N,w , ' '' ' '<~9.80Narne Phon, _

Addl" ' _

Clll 51>1, bp __

CA a .d dIJ'\ s a le s t ax . We - i !J ls oi3 1CCI !D Ir u m s ch e( ;~ A l l o rd e- floulSold! . ! U SAm (l s! a dd 1 5" 0 $ ht PP lf lg .

Page 62: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 62/84

The following letters are in response to theeditorial that appeared in the March issue ofMicro. The editorial encouraged readers to writeto us about what they'd like to see in a 6516. Hereare two of those responses.

Dear Bob,

I just read the March issue, and I am respondingto your editorial on the "want list" for a 6516.Here's my list, with the most-wanted featuresfi rst:

1.. Let all op-codes use all possible address-ing modes, so I won't need a wall chart to tell meif this op-code is allowed to use this addressingmode. Haven't you ever written a neat piece ofcode using, for example, ASUY (Indirect Indexed),only to find that ASLlY isn't alowed? I may neveruse INCAY (Absolute Indexed by V), but I sure

would like to know that it's there if I ever want it.In my opinion, this is the best feature of the new6809: there are no "holes" in the co-code-versus-address-mode matrix.

2. Change "Zero Page" to "Fast Page", andadd the instruction SFP XX (set Fast Page).Withthe 6502, page zero is prime real estate. With thischange, I can turn any page into prime real estate.

3. BRA (Branch Always). This only saves onebyte per use (over CLC, BCC), but those bytes doadd up.

4. BAS (Branch Always to Subroutine). Inother words, a relative JSR. This would allowrelocatable code without the hassle ofsubroutlne-aodress look-up tables and zero-pagetrickery.

5. INA, DEA. Increment and decrementaccumulator.

6. PHX,PLX,PHY,PLY. Pushand pull X and Y.

7. EAX, EAY, EXY.Exchange A&X, A&Y, X&Y.

8. SSPXX (Set Stack Page).This would makethe use of multipe stacks a lot easier.

9. DELXX(Delay XX Cycles). Better yet, makeit DEL XX XX. This would be neater than waitloops, or strings of NOPs and such when equaliz-

ing branches. Even better, DEL NN XX..., whereNN designates number of following bytes thatdefine delay time.

10. With all of the above, who needs 16bytes?

Mel EvansAnn Arbor, MI

Dear Dr.Tripp,

I am responding to your question concerning arevised or improved 6502. My first request wouldbe to fill in all those presently used OP codes. Ireally need more indirect addressing modes like

LOA ($1234)STA($1234)

[absolute indirect without index]

[ would also like an increment (and decrement) in-struction which automatically adds the carry intothe next byte. I guess this is a 16 byte instruction.

Of course PHX and PLXwould also be helpful tosave a few bytes. A new chip would have to be

hardware compatible with my present system or Iwould have no real interest in it.

[ heard that serveral years ago MOS Technologyhad some experimental improved 6502's However,this program ended when they were brought outby Commodore.

Dr.MorrisMidland, MI

I had really expected to receive more suggestionson improvements for the 6502. Does the limited

response indicate that you are all totally satisifiedwith the 6502 as it is? That would suprize me!Even if you only have one small but significantidea, let us know about it. It could make a dif-ference to the future development of the 6502.

28:80 MICRO -- The 8502 Journal July 1980

Page 63: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 63/84

AIM 65 File Operations

~~~~~~~~~~~~~~~~~~~~~

AIM BASIC does not have any file access statements. Adiscussion of this problem and programs to solve II arepresented. These programs will greatly enhance the AIMBASIC, and provide some insighlinlo the workings ofthe AIM.

Introduction

By now, most readers of MICRO

are familiar with the physicalcharacteristics of the Rockwell AIM65 microcomputer. The AIM 65 is acomputer which comes completewith keyboard, display, and aprinter. A few additionallCs will addMicrosoft BASIC, a two-passassembler, and an extra 3K of RAM.All of this can be housed in an at-tractive case. The result is a trulypersonal computer. It can be easilymoved around the home or office towhere the user is. There is no con-cern about detached videomanitors, expansion Interfaces,

cables, and the like. The AIM is in-deed a very versatile computingengine.

This attractiveness of the AIM 65hardware was the factor thatultimately prompted mywife andmeto purchase one.Wequickly learnedhow to operate it. It comes with aone inch thick users manual!Rockwell deserves a lot of credit fornot only paying attention todocumentation, but also for doingsuch a good job with it.

Upon contemplating our firsthome applications, we discoveredthat not much had been writtenabout the application softwarecapabilities of the AIM. We werehappily creating data baseswith thevery nifty built-in text editor. Our in-tention was to next use BASIC toperform the desired calculations onthe data. This is wherewe ran into aproblem. AIM's BASIC has no ftleaccess statements! Noneof the pro-

July 1980

vided documentation or any other6502 sources could provide ananswer to this dilemma. Did that

mean that all that data which wehad entered was useless? We willshow that the answer to this ques-tion is a resounding NO!

We have developed a simplemachine language subroutine. Thissubroutine will allow a BASIC pro-gram to read any AIM 65 text file.This includes data entered from thetext editor as well as BASICsourceprogram tapes themselves. Thesubroutine is easy to use. It doessome error checking to prevent sim-ple mistakes from ruining your day.

It will also tell BAS.ICwhen the endof a file has been reached. As abonus, the subroutine is completelyposltlon-independent and ROMable.

Definitions

Before describing our software,wewill define a few commonly usedterms in AIM 65 context. This willbenefit individuals who arejust tear-ning to use their AIM's and alsoMICRO readers who may not beaware of the AIM's capabilities.

File: A file is a collection of data.AIM65 files may reside on externalmedia such as audio tape or papertape. AIM65audio tape files may, inturn, be in AIM or KIM format. Wewill be concerned only with AIM 65format audio tape files.

Each file is given a file name.Thefile name may be trom one to fivecharacters long.

MICRO -- The 6502 Journal

Christopher J . Flynn

There are two types of AIM 65audio tape files. One type containsobject code data. The other type

contains text (or ASCII) data. Thesubroutine we are presenting willhandle only text files.

TheAIM65has a dual cassette in-terface. A file may be read (or writ-ten) from either drive number 1 ordrive number 2. lncidentauy, wehave found this feature to be veryhandy.

alack: A block ls the unit of in-formation transferred to and frommemory and the audio cassetterecorder.

All AIM format tape files areblocked. The format of text fileblocks is described in the UsersManual. Suffice it to say, eachblockin any given file will contain thesame number of bytes. (The exactblock length is a function of thenumber of leading SYNcharacters.)Eachblock, though, will always con-tain 79 bytes of text data. [fnecessary, the last block will bepadded with zeroes.

Line or Record: A line or record isthe unit of information transferredto and from a program and the AIMmonitor.

In a text file the lines will natural-ly contain ASCIIdata. Themaximumline length can vary. The text editorimposes a 60 character limit onlines, while BASIClimits lines to 72characters. The end of a line, ineither case, is marked with a car-riage return.

26:61

Page 64: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 64/84

Now here is where it gets tricky.Each block will always contain 79data bytes. Since the lines can varyin length, a line may be either whollycontained within a block or it mayspan a block. The machine decidesif a line will fit in a block. If not, theline is split in two. This may soundimposing, but don't worry about it.

We'll show how this situation ishandled later.

End of File: The occurrence of twosuccessive carriage returns on atext fi Ie denotes that there are nomore lines of data on the file. Upondetection of end of file, we want theBASIC program to stop and not toattempt any more read operations.

Machine Language Subroutine:"Although Basic is a high levellanguage, it does allow us to com-municate with routines that are writ-

ten in 6502 machine or assemblylanguage. Such routines are knownas machine language subroutines."

Appendix F of the BASICReference Manual goes into thedetails on how to make a machinelanguage subroutine and BASIC talkto each other.

Approach

Getting back on track now, theproblem we wish to solve is stated

as follows:Develop a capability for makingAIM 65 text files accessible toBASIC. One entire line of textshould be passed to BASIC at atime. Lastly, BASIC should beinformed when an end of filehas been detected.

Note that from our earlier defini·tions, a line may be wholly contain-ed in or may span a block. A key re-quirement that the subroutine mustmeet is the reconstruction of textlines when necessary. To satisfy allthese requirements both the

monitor subroutines and the BASICUSR function will be used.

Two AIM monitor subroutineswhich we chose for use in themachine language subroutine are:

WHEREI located at $E848

INALL located at $E993

These subroutines are described in

28:82

the Users Guide. WHEREI asks theuser what the current input devicewill be. Assuming that the userresponds with 'T' (for audio tape inAIM format), WHEREI will then askfor the name of the Ii Ie desired. Itwill then locate the file on the tape.INAlL reads a character from thecurrent input device. If the current

input device is an audio tape, INALLwill see to the tasks of properlyhandling lines. INALl will start andstop the tape recorder as necessaryin order to obtain a complete line.Thus, two of our requirements arealready solved.

Interfacing a machine languagesubroutine to BASIC is straight·forward. The BASIC program simplyhas to poke the address of themachine language program intomemory locations $04 and $05. The

next step is to invoke the USR func-tion. This will start up the machinelanguage subroutine. The BASICReference Manual tells us how topass a single numeric value to andfrom BASIC. We will use this featureto pass the line length and end offile indicator to BASIC.

There is one interface problem re-maining. That is, how do we passthe text line from the machinelanguage subroutine to BASIC? TheUSR function limits us to a numericvalue. Well, we will be bold and

make an assumption. Then we will. design the subroutine to fit theassumption. Assume that theBASIC program has defined acharacter string variable named A$.Furthermore, assume that the A$ is80 bytes long. We can then designthe machine language subroutineso that it will locate A$ in BASIC'smemory and store the text datathere. If A$ is guaranteed to be 80bytes long, we can be sure that texteditor and BASIC lines can be read.

There are other approaches to

reading these text files. For exam-ple, the USR function can be used tocall WHEREI. The AIM 65 can thenbe put in the tape mode. At thispoint, the BASIC program can issueINPUT statements to read datadirectly from the tape. This ap-proach is very simple and to thepoint However, it suffers from twodisadvantages. First of all, since theinput device was changed to a tape,the keyboard is deactivated for the

MICRO -- The 8502 Journel

entire duration of the file read. Thiscan be nasty, especailly if your pro-gram requires some input from theuser as it is running. The seconddisadvantage is that the data on thetape must be in the proper format tobe processed by the INPUT state-ment. This means that there mustbe commas between values and that

string data may need to be enclosedin quotation marks.

At the expense of a machinelanguage subroutine, we havedeveloped a method of reading AIMtext files which is completelygeneral. Any text file, includingBASIC source programs, can nowbe read with BASIC. We have ad-dressed the problems mentionedabove. The AIM 65 is put in the tapemode only as long as it takes to readone line. The data on the tape canbe in any format· you do not have to

worry about commas and quotationmarks.

Loading the Subroutine

Although our listings show thatthe subroutine is located at $7COO,the subroutine is completelypoaltion-independent. This meansthat you can put it anywhere inmemory that you like. You will nothave to change a single byte ofcode. Of course, you will have toremember where you put it becauseBASIC will need to know.

The hex dump in Figure 1 is pro-bably easier to work with when in-itially entering the machine code. Ifyou prefer to enter the code in in-struction format using Figure 2, justbe careful of the absolute ad-dresses which appear as branchoperands. For ease of future use,you will probably want to store themachine code on tape. Thereafter,the subroutine can be loaded withthe 'L' monitor command.

When bringing up BASIC, be sure

to respond properly to the MEMORYSIZE question. Respond with the dif-ference of the number of bytes ofRAM in your system minus 164bytes for the subroutine. For exam-ple, MEMORY SIZE in a 4K systemwould be 4096 - 164 or 3932.

Procedure

We hope that the subroutine hasbeen put together so that it is easy

July 1980

Page 65: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 65/84

to use. Only three steps are requiredto read AIM 65 text 'files:

1.. Open the file.2. Invoke the USR function.3. Test the USR function return

code.

Step 1 - Open the File

A file is opened by zeroingmemory location $F5 (245 decimal).This causes the subroutine to in-voke WHEREI in the AIM monitor. InBASIC we open a file as follows:

10 POKE 245,0

If you intend to read more than onefile in the same BASIC program, youmust open each one of them at theappropriate time with a POKE state-ment. Only one file can be open at atime.

Step 2 - Invoke the USR Function

One text line or record will bereturned to the BASIC program eachtime the USR function is used. Wewill illustrate this in BASIC:

20 A$ = ''''30 FOR I = 1 TO 8040 A$ = A$ + "*"50 NEXT60 POKE 4,070 POKE 5,12480 L = USR (0)

Lines 20 through 50 set up A$ as an80 byte character string in accor-dance with our design criteria. If theBASIC program does not alter thelength of A$ during subsequent pro-cessing, these lines could be movedto the section of the BASIC programthat opens the file. The importantthing to remember is that thesubroutine will insist that A$ is 80bytes long - no more or no less.

The contents of A$ prior to callingthe subroutine, however, do not mat-ter. Before giving you any data, thesubroutine will always blank out A$.Thus, you are guaranteed not to en-counter any data left over from aprevious l ine.

Lines 60 and 70 are very impor-tant! They tell BASIC where themachine language subroutine islocated. Line 60 POKEs the loworder byte of the address (expressedin decimal) into memory location$04. Similarly, line 70 POKEs the

July 1980

high order byte of the address intomemory location $05. In our exam-ple, the machine languagesubroutine is located at $7COO.Make sure you tailor lines 60 and 70for your system.

If this is the only machinelanguage program that your BASIC

program is using, the two POKEsmay also be included as part of thefile opening logic.

Finally, line 80 invokes the USRfunction. This causes BASIC to callour machine language proqrarn, Weare not passing a value to themachine language subroutine.The 0is just a dummy argument. Themachine language subroutine willread the next text line from tape andgive it back to us is A$. BASIC willresume processtnq with the nextstatement after line 80:

Step 3Test the USR Function Return Code

In line 80, the USR function pass-ed a value back to the variable L.Wecall this value a return code. It canbe aSSigned to any numeric variable. it doesn't have to be L The value ofthe return code tells us the status ofthe read operation.

a. Return code is less than 0If the return code is negative,

this means that an error condition

has been detected. Probable errorconditions are that A$ was undefin-ed or not 80 bytes long. (The AI Mmonitor worries about catching readerrors.)

b. Return code is equal to 0The return code will be set to

zero when end of file is reached. Nospecial action is required to "close"the file as it is done automatically.

c. Return code is greater than 0A successful read operation

will be signalled by a return codewhich is greater than zero. Further-more, the return code will tell youthe actual number of data byteswhich were stored in A$. In otherwords, it will tell you the line length.

WARNING: Under no circumstancesshould another read be executedafter end of file has been detected.If this should happen; you may haveto hit the reset switch to regain con-trol.

MICRO -- The 8502 Journal

We might finish our example thisway:

90 IF L < 0 THEN STOP100 IF L = ° THEN PRINT"DONE":END110 PRINT LEFT$(A$,L)120 GOTO 80

lines 90 and 100 terminate the pro-gram on an end of file or error condi-tion respectively. Line 110 prints thetext line. Une 120 branches back toread the next text line.

Summing It Up

Our sample program is printed inits entirety in Figure 3. Make a cou-ple test files with the text editor.Run the test files through our sam-

ple program. You should see thelines of data that you entered prln-ting out one by one. If you encounterany problems, go back and checkthe machine code carefully. Makesure that you've POKEd $04 and $05with the correct address.

We hope that this capability toread text files adds a new dimen-sion to your computing.

Figure 1

1t.·7eOO AO 12 A4 4Sc • 7e04 AS 7S 85 FOc » 7eOS AS 76 85 Flc • 7COe AS 77 es f ac ,. 7CI0 00 12 A5 78c ,. 7C14 C5 ,.DO OCc ,. 7C18 AO Fr A2 rrc ,. 7CIC 68 80 12 A4c • 7C20 8A 6C 08 BO< • 7C24 AO 00 81 fOc ,. lC28 C9 4. DO 07< ,.

7C2C C8 8 .1'0 C9c ,. 7C30 80 FO 00 18c ,. 7C34 AS '0 69 07c ,.7C38 85 '0 90 DOc » 1C3C E6 ,.,DO CC< » 7C40 AO 02 Sol FOc ,. 7C44 99 TO 00 CSc ,. 7e48 CO os DO ' 6,. 7C4C A4 F2 CO 50< ,. 7e50 DO C6 88 A9

28:83

Page 66: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 66/84

c • 7~54 20 91 F3 88c • 7CS8 10 FB AS'Sc » 7CSC DO 08 20 48c » 7C60 £8 AD 12 A4c » 7C64 85 '6 AO 00c » 7C68 AS '6 80 12c » 7C6C A4 20 93 £9c » 7C70 C9 OA YO '9c » 7C74 C9 00 DO OAc • 7C78 CS 'S 85 F5c » 7C7C '0 OS A2 00c » 7C80 Fa 9A 91 13c • 7C84 85 '5 C8 00c • ?C8S Df AO 00 ADc » 7ca c 34 A4 DO OAc > 7C90 AD 00 A8 09c • 7C94 10 80 00 A8c » 7C98 DO E4 AD 00c » 1C9C AS 09 20 80c > ?CAO 00 AS DO DA

c

Subroutine Logic

We've included in this section atechnical description of how themachine language subroutineoperates. This should give youenough information to modify thesubroutine to fit your particularneeds.

Figure 4 depicts the logic of themachine language subroutine. Thelogic is described through the use of

Warnier-Orr diagrams. Readers whoare not familiar with these diagramsshould refer to the December '77,January '78, and March '79 issues ofBYTE. Very basically, Warnier-Orrdiagrams are interpreted as follows.The sequence in which operationsare performed is given by readingfrom the top of the diagram to thebottom. The hierarchy of functionsflows from left to right. As we gothrough the actual subroutine logic,the power of this design techniquewill become more apparent.

Figure 5 summarizes the use ofzero page variables. These locationsare shared with the text editor.However, since the text editor andBASIC do not operate concurrently,there is no conflict.

Upon entry to the subroutine, anAIM monitor variable INFLG is sav-ed on the stack. INFLG tells AIMwhat the current input device is.Since the subroutine will change the

28:84

input device to audio tape, we haveto be careful here not to lose trackof input devices. The next task is toexamine BASIC's symbol table todetermIne If A$ has been defined asan 80 byte character string accor-ding to our design assumptions. Ineither case, the logic will proceed toa next lower hierarchical level. Thisis indicated by the next sets of

braces to the right. When control isreturned back to the first level, IN·FLG is restored from the stack.Most often, this will again put theAIM in the keyboard mode. Finally,the subroutine passes a return codeto BASIC. The 16 bit integer returncode In registers A,Y (MSB, LSB) isgiven to BASIC by a JMP Indirect tolocation $B008 in the BASIC ROM.

K~*·7COO140

7CQO AD7C03 487COli A57C06 85?COS AS

7COA 85?COC AS?COE C57CIC DO7C12 AS7CIII C57Ct6 DO7CIS AO7CIA A2?CIC 681C ID SD1C20 SA7C21 6C7C24 AO1C26 BI7C28 C97C2A DO7C2C C87C2D 81

7C2r C97e31 Fa7e33 187C34 AS7C36 697C38 85

7C3A 907C3C E67C3E DO7C40 AO7C42 B I7C411 997C47 C87CIIS CO7ellA DO7C4C A4

LDASTALOA

STALDACMP8NEl .DACMPaNEl.DYL.OXPL.ASTATXAJMP

l.OYL.DACMPBNEINYl .OACHPBEQC1..eLOAADC5TA

BeeIN CBNELDYLDASTAIN Ye p vSNE.LOY

LOA A412PHA

7S1076

F " 177FO7C2418117C24IFFIFF

A412

Figure 2

Save INFLG

Start of BASIC's symbol table

Reached end of symbol tab le?

No •••

No •••

Error ex it - se t re turn code to -1

Normal eri t

Re store INFLG

(B008 l Re turn to BASIC100(FOllY1417e33

(FO> .. Y1807C40

Have we found A$?

Point to next symbol tab le entryFO107FO

1COCF 11COe102 Found A$ •••(FO).I Y Ge t address and length of A$OOFO,Y

1057C42F2

MICRO -- The 8502 Journal July 1980

Page 67: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 67/84

Assuming A$ satisfies the designassumptions, the subroutine wil l setA$ to blanks. This is done every timethe subroutine is called. Next acou nter which counts the number ofdata characters read is zeroed. Thena test is performed to determine ifthe subroutine is being called forthe first time. (NOTE: the sucess ofthis test relies on the BASIC pro-gram to POKE location $F5 to 0.) IN-FLG is next restored from a tem-porary variable at $F6. The AIM

Figure 2 cont.

K>*·"ICllE140

7C4E CO7eSO 00'7C52 887CS3 A97CSS 91'7C57 887CSa 107CSA A57C5C DO7CSE 207efl AD7C64 857C66 AO7C68 AS7C6A 807C6D 20

7C70 C97C12 FO7C71.1 C97C76 DO7C78 CS7C7A 857C7C r o7C7£ A27CSO TO1C82 917CB4 857C86 CS7CB7 DO'7C89 AO7CBB AD

7C8E DO7C90 AD7C93 09'7C95 807C98 DO7C9A AD'7C90 097C9F 807CA2 DO

July 1980

should now be configured to acceptinput from audio tape. So then thecharacter read routine is calledrepeatedly until a carriage return isdetected and processed.

If A$ does not meet our designassumptions, the return code is setto -1. This should alert the BASICprogram of an error condition.

IF the subroutine is being calledfor the first time, the AIM subroutine

Is A$ 8Q byte s long?N t: l ,t he n e r ro rYe s, b lank .out A$

CFY ISOBN!: 7C18DEYL.OA 120STA (F3),,~DE.Y

B~L 7C55l.OA '-SBNt 7C66JSR E84BLOA A412SiA F6LOY 100LOA F6STA A4I12JSR E993CM~ lOAS·£Q 7C6DeM1=' laDBNt 7C82CMP FSSTA ,.5BE.Q 7 C89 Yes. '••l.OX 100 End of te x t lineSE.Q 7 C I C Re turn to BASIC5TA (r:3)" y Store the char in A$5TA F5INYBNELOYLDA

SNEL.OAORA5TASNELOAORASTASNE

7C68'00A.q34

7C9AA800110A8007C7EA800120ABOO7C7E

WHERE I

Is it the first t ime calle d?

store new I N F LGin a temporary

I NAL L

Restore INFLG from the temporaryvariable

Ignore line fe eds

No •••Is it a CR?

Was previous char a CR?

Now go read the next charEnd of file , ••Which tape drive are we using?

Turn dri ve 1 on

ExitTurn drive 2 on

Exit

MICRO -- The 6502 Journal

WHEREI is invoked. WHERE! issuesthe familiar prompt:

OUT=Normally the user responds with"T". The AIM monitor will then pro-mpt for the file name and tape drivenumber. When WHEREI finishes, IN-FLG, which was just set by WHEREI,will be stored in a temporary at $F6.This completes the initialization se-quence.

Figure 3

LIST

10 POKE 2'*5 .. 020 AS • - ..30 FOR 1 • 1 TO 801& 0 AS • AS • ..."SO NEXT60 POKE 4.. 070 POKE 5.. J2~80 L • USRCO)90 IF Lea THEN STOP100 I,. 1. • 0 TltDl PRINT

-DONE". UD110 PRINT LE'TS(AS4~)120 GOTO eoWARNING: Locations 4 and 5 mustbe POKEd with the physical addressof the machine languagesubroutine. In this program thesubroutine is at $7COO.

The read character routine calls alower level read routine until acharacter other than a line feed isfound. The purpose for skipping l inefeeds, is to facilitate the reading ofBASIC source program tapes.(BASIC prefixes each source pro-gram line with a line feed.) One oftwo lower level routines is then in-voked depending on whether thecharacter just obtained is a carriagereturn or not.

The lowest level read characterroutine is simply an invocation ofthe subroutine INALL. INALL will ob-tain a character from the current ln-put device.

If the character obtained is a car-riage return, the previously readcharacter is examined. If the currentcharacter is not a carriage return,the current character is stored in thenext available byte of A$ (pointed to

26:65

Page 68: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 68/84

by .$F3 and $F4}. The count of thenumber of characters read is up-dated.

If the current and previouscharacters are both carriagereturns, end of file has beendetected. The proper tape drive isturned back on (INALL turned it off)so the tape can be rewound. Thenthe return code is set to O .

If the current character is a car-riage return, but the previouscharacter was not, the end of a linehas been reached. The return codeis set to the count of the number ofcharacters read. Note: the carriagereturn is neither counted not storedin A$.

Christopher Flynn became in-terested in microoomputers whenne assembled a MITS Altair com-puter kit in 1976. Since then, he hasobtained a KIM-1 and an A/M-6S. HisKIM system interfaces to severalS-100 boards by means of a KIMSIMotherboard.

The AIM is his favorite system. Ithas 32K of RAM and uses a Model33 teletype for hardcopy output. Hissoftware interests includeAssembly language and BASIC.

Applications developed on the KIMand AIM range from an interpreter toa home budgeting and accountingsystem. To support this hobby,Chris is employed by the FairfaxCounty government as a systemsanalyst for the county's taxsystems.

Christopher's wife, Nancy, haslearned to program in BASIC. Theirtwo year old daughter, Becky, whenasked what her father's name is,has been known to respond,"6-5-0-2".

28:86

T.pe Re8 .dSubrouUn~

SO' l i'C IHn .Gall l!Ii.o_.ck

AS 13 d@lflned u00 h7t .e i!ltri.nf.

(0,1)

Sc l At t.o blan1t:!l

Set cha.rIIct.er count1.00

r1 r""t UI!Ie {!:I!!I.Uli!d

(0 ,1 )

nf':sLore l~FUI tlUlt.l!'ll'lporll.r:y

Figure 4

{

Call IIHER!:I

lRn.n to If!I!I)JOrII,f1'

ne t .I:lhnr~cLer(.>.lp L.r.) { toll l~LL

A$ h dfiril'M!!!d 1I.t !!

60 byte .trlQ8

(0,1)

~l!ItOn!! }:IIlno rTOl!l,.hf"k

He!.tum to PlSl C"'1111ot-~

'had II. cher eater-(until C.~.)

C h 8J '8 .:: tA !r 1 !! 1.

• C.R.CO• . I ' P""lOID" e~or { s~ t"l'turn cede

• C.R. t.o char C'fJ1D'l t .(0, 11

{S o tre tor n eeee 1 .0 - .

{Store char lh At

Coun t L tm cha r-CMna:l er 111C.~

{O,I)

Figure 5

SlM!AB $ P O , $ F l Pointer to BASIC symbol table

LEN $12 Length of A .$

APN! $F),$F4 Pointer to A$ in BASIC' 8 memory

T E M P $FS First time switch; hold area

TINFLG $F6 lNFLG hold area

MICRO -- The 6502 Journal July 1880

Page 69: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 69/84

BOX 120ALLAMUCHY, NJ 07820201-362-6574

inc.HUDSON DIGITAL ELECTRONICS INC.Make Interfacing Easy!

VIA WIW Prototyping Board Kit. In-cludes 6522 IC and full addressdecoding with prototyping area for upto 12·16 pin IC's.Duplicates AIM/SYMfKIM expansionconnector pinout. High quality doublesided 4.5"X4.5" board with 22/44 gold-plated card edged fingers.Price $69.95

COMING SOON!

omru

65IA (6522)contains two 8 bit program-

mableI/O ports with additional handshake lines, two timers, and a serial to

parallel/parallel to serial shift register.The VIA facilities interfacingkeyboards, printers, AID and DIA con-verters to the microprocessor system.

Expansion Bus Extender Kit3 female and 1 male connectorallows two or more cards to be con-nected to bus. Price $24.95.(Note: Bus extender and two cards willfit inside Enclosure Group AIM case.)

For 6502 Systems Development

Engineering Support

Word Processing Applications

The latest in a continuing series of

advanced hardware and computer pro-gram products for KIM, AIM, TIM, SYM.

Power Supply Kit for combined Analogand Digital projects 5v @ 300ma ±15v @ 50ma 2"X4" Price $32.95.

Money Order or certified check assures pro-mpt delivery. Personal checks must clearbefore shipment. California residents pleaseadd 6 % tax. $1.50 shipping and handling oneach order.

FALK·8AKER ASSOCIATES382 Franklin Ave., Nutley, NJ 07110

(201) 661·2430

PERRYPERtPHERALSP,O,Box 924, Mil!erPtace, NY11764

(516) 744-6462

PROGRESSIVE COMPUTERSYSlEMS

405 Corbin Rd., York, Pa. 17403(717) 845·4954

JOHNSON COMPUTERBox 523, Medina, Ohio 44256

(216) 725-4560

ARESCOP.O. Box 43, Audubon, Pa. 19407

(215) (131·9052

PLAINSMAN MICROSYSTEMSBox 1712. Auburn, Ala, 36830

(800) 633-8724

COMING SOON!

Single channel 25 usec 12 bit AID

16 channel 100 usee 8 bit AIDTMS 2532 Prom ProgrammerClocklCalendar with battery backup

Unique Concepts Corporation1157 Jordan LaneNapa, CA 94558(707) 253·8426

Page 70: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 70/84

MICRO Club CircuitHere is yet another installment 'of6502-related clubs. We continue to'be encouraged by the terrificresponse to our request for new

clubs. Now we have so many thatwe can't print them all in a Singletwo-page .Iisting!

If you have registered with USandyou are not presented here, do notbe dismayed. Next month you Wil!be first on the list! The mail has justbeen loaded with club information.

Those of you who are listed pleasetake a moment to make sure thatthe information is correct. Notify usof any errors. uc-dates should besent to us pertodlcally,

Does your club publish a newslet·ter? Do you need advertiser's? Wantto exchange an ad? If the answer toany of these questions is yes, thenlet us know!

To become an officially registeredclub please send for the correctform. This is the only way to get afree one year subscription for yourclub's library. Have your club listedto increase your membership.

Address any .information or re-

quests to:

MICRO Club CircuitP.O.Box 6502

Chelmsford, MA 01824

Western Educational ComputingConference, San .Diego, California

November 20,21

The theme of the seminar/exhibit is"Educational Computing in the'80's" and will feature papers andseminars on the useof computing inhigher education for instruction, ad-ministration, and research. Lun-cheon speakers will be Capt. GraceHopper, USN, and BernardLuscombe, President, CoastlineCollege. .For further information contact:

Ron Lang.leyDirector, Computer CenterCalifornia State University1250Bel.lflower BoulevardLong Beach, California90840

26:68

Texas A&M Micra Computer Club

This club meets everytwo weeks onWednesday nights. Conrad G.

Walton Jr. is the President of 80members. He can be contacted at:Box M·9Aggieland StaUon, TX77844

"The club owns 2 8K Pets and oneSWTPC 6800 system with Pencomdisk. Aim to provide education forthe community in the applicationsand use of micro-computers. "

Forth Interest Group

Thls educational club asserts thattheir world-wide membership is 950.

They meet on the fourth Saturday ofthe month. They list no contact per-son but the address for their club is

P.D.Box 1105San Carlos, CA 94070

Apple Inlormation and Data Ex ·change

Meets on the second Tuesday ofeach month at:

Computer Corner1800S. GeorgiaAmarillo, TX 79109

George Johnson is the President of

AIDE. Theiraddress is:5700 DixonAmarillo, TX79109

"Mutual aid and sharing of informa-tion. "

ApplePuget Sound Program

Meets on the second Tuesday ofeach month. Over 3000 members.Dick Hubert is the President.A.P.P.L.E. library Exchange. Con-tact:

Fred Merchant, Sec.517·11thAvenue EastSeattle, WA98102

"Assists its members in the use andunderstanding of the Apple Com-puter. One time Apple-Cation feeand annual dues.."

Madison Pet User's Club

Meets on the first Thursday of themonth at 7:30pm in the WashingtonSquare. Building. Membershiparound 50. Contact:

B.A Stewart

MICRO •• The 6502 Journal

501WillowW. Baraboo, WI 53913

"Exchange Information."

New Engla.nd Computer SocietyMeets on the first Wednesday of themonth at the Mitre CorporationCafeteria in Bedford, MA. RobertWaite is the President over 200members. Contact:

David Mitton, Sec.P.D.Box 198Bedford, Mass. 01730

"General purpose, personal/hobbycomputing, technical informationsharing."

San Francisco Apple Core

Meets first Saturday of the month.Randy Fields is President. Member-ship of over 800. Contact:

Randy FieldsP.o. Box 4816San Francisco, CA 94101

Winnipeg Apple Computer Group

Meets on the first Thursday of eachmonth at 7:30 in the ComputerlandStore. Acting President is Mike

Flood. Membership is stltl growing- over 30 currently. Contact Mikeat:

5-1730TaylorWinnipeg, ManitobaCanada, R3NON8

"Increase members knowledge ofprogramming, hardware, and dataproceseinq. Newsletter."

Burlington Micro Club

Meets on the last Wednesday of themonth at 7:30 pm at various loca-tions. William MorriS, President over

25 members. Contat him at67 Moxley DriveHamilton, OntarioCanada, L8T 3Y B

"Membership is open to everyone.Micro user '80, a club newsletter."

6502 Oornp-Olub

Meets at various places. Membersand those interested are notifiedthrough the mail as to the monthlyarrangements. Robert Wilson is

July 1980

Page 71: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 71/84

club President. Over 25 members.For current information contact:

R.WilsonBox 6007Lawrenceville, N.J. 08648

"Purpose: To consumate interestand to further knowledge of 6502computers. "

Erie Apple Crunchers

Rudy A. Guy is President over this

newly organized group of 25 avidusers. Contact them for more infor-mation:

P.O. Box 1575Erie, PA 16507

"Membership is open to alf Apple orBell & Howell Apple owners orusers. Developing a software libraryand we are willing to exchange sott-ware with other individuals orgroups."

N.I.C.H.E.Northern Indiana Computer

Hobbyist

Meets in the South Bend areaon thelast Monday of almost every month.Contact:

Eric Bean927 S 26 StreetSouth Bend, In 46615

"The meetings are open to all com-puter hobbyists, but is dominated

by PETs."Apple Byter 's Computer Club

Information regarding this clubshould be requested from S.E.Grove, Pres., Mail Station 33, BldgR-19

H.E.S.E.A.Hughes Aircraft2060 ImperialEI Sugundo,CA 90245

"A private club tor Hughes

Employees only but open to guests.Education of members in the use ofcomputers by programmers andothers. Buy at group rates, ex-change software in public domain,and member of the I.AC. (interna-tional Apple Core) Grow with othersin the Greatest Hobby EVER!"

UPDATES-UPDATES-UPDATES

OSlO

Washington, VA, MD group meetsthe first Tuesday of each month.Meets at the Walter Johnson HighSchool in Rockville, Md. Contact:

Wallace Kendall, Pres.9002 Dunloggin RoadEllicott City, MD 21043

"Study, advance, and promote theapplication of computers; publishnewsletters; sponsor conferences,workshops, symposia, aemonstre-

tions, and publications on com-puters, etc."

Apples British Col.umbiaComputer Society

Meets first Wednesday of everymonth at 7:30. Various locations.Gary Little is President for ·95members. Contact him at:

101-2044 West Third AveVancouver, B. C. CanadaV6J 1L5

"All members are Apple II owners,aim is to discuss software and n e r o -ware.."

Apple Sac

Meets on the first Tuesday and thirdWednesday of each month, withAssembly language classes on thethird Tuesday. Bill Norris is presl-dent. 80 plus members. Contact:

Jerry Jewell .Computerland ofSacramento1537 Howe AvenueSacramento, Ca 95825

"Fun, education, social, sharing ofideas and programs."

SERENDIPITY SYSTEMS:'PROGRAMS FOR

APPLE IICOMPUTERSYour Apple II computer can do more when you use professional softwareproducts from Serendipity Systems.Serenpipity has developed programs especially designed for the Apple II.such as a video message display syst rn, an interactive statistical

package. programs for bookkeeping .and inventory control.

r.t~.t'Eil"~~rJI~~~~~~ even a sophisticated program for advancedmathematical routines.

ndiplty's Apple II programs add a new dimensionto this exciting and versatile computer.

Our new 4s·page catalog has more details on theseother software solutions.Send S I for your copy

SERENDIPITYSystems Inc.

225 elmira rd, ithaca. ny14850 (607)277-4889

Page 72: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 72/84

[]5JVideo Games 1Head- On, Tank Battle, Trap!

$15

Video Games 2Gremlin Hunt, Indy 5000, Gunfight

Board Games 1 15Cubic, Mini- Gomoku

Dungeon Chase 10Areal-time,D&D,video game

C1 Short hand 12Two key command entry

One tape supports all recent ROM'systems.Color and sound on video games. Some

programs on disk.FREE CATALOG

Orion Software Associates

147 Main Stre'etOssining,NY 10562

051

15

Progressive Computing3336 Avondale Crt.Windsor, OntarioCANADA N9E 1X6

(519)969·2500

OHIO SCIENTIFIC

Hardware ..C1P Video-gives true 32 or 64 chrsllinewith guard bands. This is not a make-shift mod. Itmakes your video every bit as good as the 4P's plusyou have switch selectable 1,2 and 3 MHz. CPU clockas well as 300, 600 and 1200 baud for cassette and

serial port all crystal controlled.Complete plans-$18.95, Kit $39.95 or send in yourC1P to Personal & Business Computer Connection,38437Grand River, Farmington Hills, Mich 48018, andwe will install the Video mod for $79.95. Other modsavailable ..add sound; AS-232port cassette motor con-trol.

Software (with documentation) For C1, C2, 4P & 8PChess 1.9, Backgammon, excellent card games, a r-cade type games, utility programs, mini word pro-cessor memory maps, etc.Catalog with free program (hard copy) & memory mapfor BASIC in ROM models...$1.00

SOFTWARE FOR OS.We Have Over 100 High Quality Programs For Ohio Scientific Systems

051

ADVENTURES AND GAMESAdventur es - These i nteracti ve fantasies wi ll fitin SKI You give your computer plain engli shcommands as you try to survive.

ESCAPE FROM MARS

o5I

You awaken in a spaceship on Mars. You're Introubl e but expl06ng the nearby Martian citymay save you.

OEATHSHIP

This ISacruise you won't forget - if you survive it!

Adventures $14.95 Tape or 5Y.'" Disk$15.95 B" Disk

STARFIGHTER $5.95

Realtime space war with realistic weapons and aworki ng i nst rument p anel .

ALIEN INVADER 6,95 (7.95 for color and sound)

Rows of march ing munch lng monsters march onearth.

TIME TREK $9.95

A real lime Startrek with good graphics,

BATILEPAC $17.95

TEXT EDITORS FOR ALL SYSTEMS!!

These programs allow the editinq of basicprogram lines. All allow for insertion. deletion.and correction in the middle 01already enteredlines. No more retyping,

Cl P CURSOR CONTROL (TexI Editor) $9.95

Takes 166 bytes of RAM and adds. besides textediting. one key instant screen clear.

C2P/C4P CURSOR $9.95

Takes 366 BYTES to add PET like cursorfunctions. Enter or correct copy from any locationon the screen.

SUPERDISK $24,95 for 5" $26.95 for B"

Has a text editor for 650 plus a great newBEXEC·. a renumberer. search, a variable tablemaker and Oiskvu • lots of util ity for the money,

We also have 25 data sheets available such as:

IMPLEMENTING THE SECRETSOUND PORTONTHE Cl P $4.00

HOW TO DO HIGH SPEEDGRAPHICS IN BASIC$4.00

HOW TO READ A LINE OF MICROSOFT $1.00

for the bartlebuff. Contains Seawolfe. Starfighter, JOYSTICK INSTRUCTIONS AND PLANS FORBomber and Battlefleat. .£l!' $3 00

* ",V,"G om 0' w' "00 ._.)

And lots. lots. lots more! THE AARDVARK JOURNAL

A tutor ial birnonthlv journal 01 how to ar ticles- $9.00

Our $1.00 catalog cant. ins a free program listing. programming hints, lists of PEEKand POKElocations and other stuff that OSIforgot to mention and lOISmore programs like Modem Drivers. Terminal Programs. and Business Stuff.

Aardvark Technical Services 1690 Bolton, Walled Lake, MI48088 (313) 624-6316

o51

Page 73: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 73/84

The MICRO Software Catalog: XXII

~~~~~~

Software announcements for the 6502 based systems

Name:System:Memory:L.anguage:

ALGEBRAPET 20018K or moreBASIC, Machine

Description: A series of 7 programs(on one cassette) designed to assista student throug.h various levels ofthe subject. Topics include: Set

operations, signed arithmetic, linearequations, factoring, and quadraticequations. An example of eachclass of problem is given, followedby a changing sequence of pro-blems to be solved by the student.After each problem, as answer isprovided to check results. Other Petsoftware available.

Copies:Price:Author:Available:

New Release$19.95Len BugelTYCOM Associates68 Velma Avenue

Pittsfield, MA 01201Name: Computer Station

Single Disk CopyApple II or Apple IIPlus ..32KInteger Basic or Ap·plesoftApple II,Disk "

System:

Memory:Language:

Hardware:

Description: Program will copy acomplete diskette using an Apple IIwith only a single disk dr.ive. Theprogram will function properly on anApple liar Apple II Plus with orwithout the Applesoft ROM Card orthe Languag.e System. It will runwith DOS 3.1 ',DOS 3.2, or DOS 3.2.1and will run on either a 32Kor 48Ksystem. On a 32K system it will takefive passes for a full diskette whileonly three on with 48K. Requires amaximum of 3 passes on a 48Ksystem, does verification, will in-itializeif desired and I's faster thanApple's two disk copy.

July 1980

Price: $29.95, $2.00 slhIL residents add 5 %sales tax.Diskette, phamphletJoel UpchurchComputer Station12Crossroads PlazaGranite City, IL62040 .

AMATEU.R RADIOCOMMUNICATIONSPACKAGEApple II, Plus1 6 KIntergerRadcomPlus Card(supplied), Disk"

Includes:Author:Available:

Name:

System:Memory:Language:Hardware:

Description: Send·Reveive RnY andMorse Code. Interface installs lnSlot 2. Active bandpass filters. FSKoutput. Narrow Shift (170 HZ). LEDtuning Indicators. Scope monitor-

ing. Computer grade circuit board.Gold plated contacts. Assembledand tested. Baudot speeds con-tinuous 32 to 300 Baud. ASCIl to1200 Baud. Morse Code speeds 2 to125WPM. Split screen, receive, Xmltand Xmlt buffer. Save text from abuffer to the Disk. Load text fromDisk to a buffer (lx/RX). Display cur-rent system status or catalog. Nor·mal/Invert Rny Rx key control.Stored massages to limit of RAM.Much morel.

Copies:

Price:Includes:

Just released

$190.00AadcomPlus = Card, Soft-ware on D'isk.,doc.Radcom Plus Cardby Alex M. Mass.lmoAF6WSoftware by Dr.Chris H. Galfo WB4·JMDAlex M. Massimo4041 41st Street

Authors:

Available:

MICRO-- The 6502 Journal

Mike RoweP.o.. Box 6502Chelmsford, MA 01824

Name:

System:Memory:

Language:Hardware:

San Diego, CA92105

The Creativity LiteDynamic Pa.ckageApple II48K

Applesofl, MachineApple n, Disk II

Description: Draw, Write Music,Write Poetry!. Draw Circles, ellpses,triangles, frames, enclosures,fireworks, squares, etc. (manymore!) all at the touch of a key ortwo (without hitti.ng return). Fill orpartially fill any of the above figuresto create an infinite variety offigures. Change to and from Re-gressive & Symmetry Modes. Wr.iteMusic using your keyboard liKe apiano. Walch your notes be named

and written on a clefl. Easily changepitches and durations. Write apoem. Choose 1,2, or 3 forms, saveand play later! MUCH MORE!!

Copies:Price:includes:

Author:

Name:

System:Memory:Language:Hardware:

Many$19.95Disk., 88 page Prog.Manual, 2 drawingcards.Avant·Garde Crea~lionsP.O.Box 30161 MeCEugene, OR 97403

GAF Software Utili·ty Packages 1 & 2Apple II, Plus32KInteger, ApplesoftApple with Disk II

Description: A collection of usefulutility programs. UtHity 1: File Com-pare, a program that aHows cornpar-Ing of two versions of a program andreporting all differences to your

26:11

Page 74: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 74/84

screen, printer, or disk file. Menu, ageneral purpose HELLO programthat allows one keystroke programexecution. Reads any size catalogto produce menu. Applesoft & In-teger Sorts, fast implementation ofShell-Metzner sort can be adaptedto your programs. Convert-To-Text,turns Applsesoft and Integer pro-grams into text files. Util ity Package2 includes Multiple Disk Catalog,File Cabinet Fast Sort, File Copyand Food Pian.

Copies:Price:

Just released$30.00 each$50.00 bothGary A. FooteGAF Software127 Mt. Spring RoadTolland, CT 06084

Author:Available:

LCMOD for PascalAppleApple LanguageSystem

Description: Allows DIRECT entry ofupperllower case into the PascalEditor using the Paymar LCA. Usesthe ESC key for a shift key and theESC key Is now a Control Q to pre-vent accidental deletion of text.Also provides generation of left andright curly brackets for commentdelimiters and an underline forVARs, program names and tilenames.

Name:System:Hardware:

Price:Available:

$30.00Southeastern Soft-ware7270 CulpepperDriveNew Orleans, LA70126

Name:System:Hardware:

MAG FilesAppleDisk II

Description: Having trouble keepingtrack of all those magazine articlesyou read? Here is the answer. Enterthem once and use the searchmodules to find them again eitherby title or subject code. RequiresApplesoft II.

Price:Available:

$18.00Southeastern Soft-ware7270 CulpepperDriveNew Orleans, LA70126

2&:72

Name:System:Hardware:

Bad Buy DisketteAppleDisk II

Description: Of course it is a badbuy. If you had issues 2 through 11of the Southeastern SoftwareNEWSLETIER, you could type theseprograms in yourself. They are a mixof Integer, Applesoft II andassembly language programs andutilities.

Price:Available

$9.99 .Southeaster Soft-ware7270 Culpepper Dr.New Orleans, LA70126

Name: Double PrecisionFloating Point forApplesoftApple II, Plus32KAssemblylangu-age. Use with Ap-plesoft Programs_Disk II

System:Memory:Language:

Hardware:

Description: Provides 21 digit prect-sion for Applesoft programs.Arithmetic expressions, as well asINPUT and PRINT are supported.Applesoft subroutines for the stan-dard math functions are included.Nearly standard syntax is used, withthe ampersand feature. Efficientand compact, only 2048 bytes.Loads itself ber_)eathyour Applesoftprog. Works with Applesott ROMcard, with Applesoft in theLanguage System, or with RAM Ap-ptesott.

Copies: 25Price: $50.00Includes: Diskette, Reference

ManualAuthor: Bob Sander-

CederlofAvailable: S·C Software

P.O.Box 5537Richardson, TX75080

Name:System:Memory:Language:Hardware:

Letter PerfectApple II, PlusMin.32KMachineApple II, Plusl 32KminI Dan PaymarLower Case.

Description: A character orientatedword processor. It supports propor-

MICRO -- The 6502 Journal

tional spacing and is capable ofworking with any printer type. It isuser orientated and menu driven.Complete documentation. Supports:global and local searches, completeformatlng, full ASC II character setwith lower case on video display,headers, footers, page numbering,complete tormating within body ottext, top margin, and much more!Full cursor control.

Author:Available:

Name:System:Memory:Language:Hardware:

Kenneth leonhardllJK Enterprises,Inc.P.O.Box 10827St. Louis,MO 63129

Gus's Disk UtilityApple II16K, 32K, 48KMachineApple II, Disk II

Description: Program is designed tobe an easy to use aid to workingwith the Apple II DOS 3.1 or DOS 3.2.Restore those accidentially deletedfiles, remove DOS from yourdiskette for more room on your dataonly disks, read/write to any sector,print file attributes (catalogs yourdisk and allows to choose any fiteon the diskette to give you file type,track sector list, the sector listswhich contains your program),prints binary program parameters,and will map the free sectors of yourdiskette. Allows individual byte orsectors to be changed or transferedto another diskette.

Copies:Price:Author:Available:

Name:

System:

Memory:Language:Hardware:

Just released$45.00Ralph D. GustafsonRainy City Software4360 SW ParkviewPortland, OR 91225

- Disk.Apple-1I ReponTextwriter ·DARTApple II Or Apple IIPlus32KApplesoft IIDisk II, optional printerand lower caseadapter

Description: A program which com-poses reports, articles, letters andother documents, utilizing text filesgenerated by the "DOS Text Editor".Text may be input In free form for-mat, without regard to line length orpagination. Retrieves the data from

July 1980

Page 75: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 75/84

the file, formats it into lines ofdesired length, and displays it on aprinter or Apple CRT. Changing thetext requires only that the text filebe modified with EDIT-It, and DARTcalled to format and output a newreport. The variable input funcionallows form letters and standardtext to be modified from thekeyboard to produce custom lettersand reports. File chaining allows anunlimited amount of input text.

Price: $19.95 plus $1.25 s & h.Package special:EDIT·II "and DART$37.89Just releasedDiskette, user manual,and documentationRobert SteinServices Unique,lnc.2441,Rolling View Dr.Dayton, Ohio 45431

Disk Text Editor· Edit IIApple II or Apple IIPI u sMinimum 24KApplesolt BASICApple, disk and op-tional printer andlower case adapter.

Copies:Includes:

Author:Available:

Name:System:

Memory:Language:Hardware:

Description: An improved version ofthe DOS Text Editor, designed tocreate and facilitate changes todisk files, reports, lists, etc. Alsosupports the cassette as a filedevice. Includes 35 commands. Str-ing commands allow searching,changing, and listing of singlerecords or blocks of records tor aspecified word or phrase. User ln-put. File commands merge inputfrom various files, parts of files andtext buffers. Handles full upper andlower case ouput to print devices.Works with DART.

Copies: Over 200 of Edit·,Price: Cassette $19.95

Diskette $23.95Shipping $1.95

Includes: User manual and

docu mentat ionAuthor: Robert A Stein. Jr.Available: Apple Computer

Stores orServices Unique, Inc.2441 Rolling View Dr.Dayton, OH 45431

July 1980

Name:System:Memory:Language:Hardware:

Program WriterApple32K minimumApplesoft1 Disk Drive

Description: This program was writ·ten to speed up the process ofwriting advanced business program.It works as a data managementsystem, but also writes diskstatements. as permanent linenumber, if requested. Supports 20fields per entry, searching or sortingby any field, generating reports,packing numbers to increase diskspace, plus many more. Use for in-ventory, checks, phone bumbers,etc. Simple to use with instructions.

Price:Copies:Includes:

Author:Available:

Name:

$29.95Just releasedDiskette,instructions,examples

Willord NiepraschkWilford Niepraschk5921 Thurston AvenueVirginia Beach, Va23455

Visible MemoryRoutines8K PET2KMachine Language8K PET, MTU VisibleMemory Board

Description.: Machine language soft-ware easily accessable by BASIC.Package includes clear screen, plat-a-paint, line draw, and ROSE plot-ting programs. Other programsavailable to run with VM Routines:VM LlSS·3D space Art, VM Sprirals,Hi-resolution spirals, VM 3D Plots,same 3D images as seen in manyads. More coming. Send SASE forlist of these and other programs.Copies of MTU user's Notesavailable.

System:Memory:Language:Hardware:

Copies:Price:Includes:

Author:Available:

Name:System:Memory:Language:Hardware:

Just released$7.95 for VM RoutinesCassette, Documenta-

tionRussell A_Grokelt. Jr,Pet Library401 Monument RoadJacksonville, FL 32211

PSA/1Apple II, Plus16KApplesoft BasicApple II (Printer, opt)

MICRO-- The 8502 Journal

Description: A cassette-based in-troduction to computer scheduling.Using crttlcal-path schedulingtechniques, it allows the user todefine a project, input timeestimates for each job In the pro-ject, and then compute schedulesfor each job. Computes the earliestand latest each job can be started,finished, in order to meet deadlines.Also schedules delays without harmto other jobs. Displayed on video.

Copies:Price:Includes:Author:Available:

New Release$25.00 CNA add 5 %)Cassette,_User ManualDon TaylorExpress Marketing21866 Clear CreekRoadP.O.Box 1736/MSCPoulsbo, WA 98370

Name:System:

Memory:Language:Hardware:

FilesApple II 3.2 or 3.2.1DOS32K min.ApplesoftDisk necessary,Printer optional

Description: File is a modular Fileutility program which is designed toallow the user to build files, add toexi st i ng 1iles, correct records,delete, lock, unlock, insert records,move records, delete records, findrecords, sort, append files together,rename and save files, and view filedata.

Copies:Price:Includes:Author:

Just released$49.95Disk and manualMarc Goldfarb55 Pardee PlaceNew Haven, Conn.06515

~~~~~~~~~~~~~~~~~While we have been lenient in thepast regarding the length of the en-tries in the Software Catalog, wemust now insist that future entriesbe kept as brief as possible. We

think that twelve to fifteen lines Inthe "description" part of the entryshould keep it about right. The otherparts, as long as needed.We now have so many entries back-ed up, that we feel this policy is onlyfair to give everyone 'equal time'.We will be fored to edit, or returnany entries that we judge too long.

Mike Rowe~~~~~~~~~~~~~~~

26:73

Page 76: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 76/84

WP-6S0Za very fine word processor

for IIFIITape [C1,C2,C4] , $755" Disk [C1,C2,C41 $758" Disk for 650 $75

8" 650 & 65U ..... $125DescriptiveBrochure FREE

Dwo Quang Fok Lok'SowBox 4196, Grand Central Station

New York City, N.Y.1D163(2121 685-2188

Challenge your imagination with THE VOICE from MUSE Easilyrecord. edit and playback words or phrases through the Applespeaker Record your own vocabulary then add speech to yourBasic programs using Print statements. Guaranteed the best, easiest-to-use speech software. On disk. with documentation. for Apple IIand Apple II Plus with 48K. ($39,95)

ELEMENTARY MATH EDU-D.SK2+2

Designed and written by a professional educator. Four interactivelessons in elementary addit ion. subtract ion. multipl icat ion and divi-sion presented on nine skilllevels. Interactive lessons use extensivecolor graphics and computer voice to maintain student interest andreinforce basic concepts, Student scores are stored on disk and canbe accessed only by the teacher, Self-demonstrat ing: requires li ttle

or no instructor assistance, On disk. with comprehensive documen-tation. Requires Integer Basic and 48K. ($39.95)

ADDRESS BOOK-MAILING LISTStore 700 addresses per disk, Fast access for viewing, label print ingor automatic phone dialing. Select by name, initials, street. city. zip,or user-definable code. Ouickly sort your file in any order, The BESTmailing list program for the Apple, On disk with documentation.Requires Applesoft ROM and 48K ($49.95)

For FREE catalog and the address of your nearest MUSE Dealer contact :

MUS E'~0~y0S0FTWARE330 N Charles 51 Baltimore. MD 21201 (301) 659-7212

r·_·_·_·_·_··t A ll ABOUT i• OSI ,t BASiC-iN-ROM it BASIC and MONITOR REFE-• RENCE MANUAL for Ohio Sci- .,

tantlflo Microsoft BASIC--IN-ROM Version 1.0 Rev. 3.2

• Complete, Concise (not a

t tutorial), Accurate and Detail-ed. All statements and com-

., mands. Looping. Tapes:BASIC and homemade. Binaryrepresentation of floating

., point. Storage of source codeand variable tables above$0300. Maps of pages

'f · $00,01.,02. Routines in$AOOO-BFFF. Line by line

• description of pages: $8.95

t postpaid. Send a check, orCOD ($1.10 fee).

i Dealers' inquiries invited.

t• E.H. Carlson t3872 Raleigh Drive •

• Okemos, MI.48864 J~.- .-.-.-._.-;tl A '\\t;.. "... ~

. ,~1:~'"t~ Compute,.I '" '- " ',': ,!~ It. Gambllnl

~ . .. '< :4 Ii I. -" ,

PRESENTS:\;, MOloalne·PROIIIILlnHI ID .C a r p . I .D E lIC E IA 16K BAS IC PROGRAM FOR:

HO R S E R IC E HO D IC I PP IIThi s amazi ng p ro gr am wa s w ri tt en b y a p ro le ss io na t s oHwar

c on su lt an t t o TRW Sp ac e Sy sl em s andIs being in troduced' ?> 'lit.p ublishers 01 ~ ule rs a nd G am bling M a.g azin a, "PH [)-" Isl a f 9 t icomplex OOSlC program requJnnga lull 16K , IIis car.'ullyhU fl li l" l aC lo re d l ore3S"j use. Plm· I is a oompr~slve horserating s y s t emt or s po lt ln ~ o ve rl ay s I n l ho ro u gh br ef j s pr in t r ac es( le ss Ih an ,mile),Vou S Im p ly " ;1 d ow n w ~hyourCOO1pulerandI1M R ;,cing Form 1M nighl belor. Ihe ra re a nd a nswer 5 orqueslion.s aoout eaA:hnorsa 'spast pe t1om1an~. You r COOlpu te,tlle n a ex ura l8 ty p re dic ts tM w in p ro ba bility a nd o dd s·tin e10'each horseallowingyoolospo t overla id hor ses whi te a t the t rack ,The u ser s manua l conta in s a complete expla lla tion0 'overlay bet-ting.S taHs li "' ! lor I hou sand s01 o or se s w ere u se d 1 0devol.p thjsh and icapping sys lem.T h ea pp en dix 0 1 I he fIIi In ua t c on la in s adlllailefjta b r uno l a 100 OOI lS8CtJ t iv eaeesystem o rk o ul s how·Ing an IftIIllIIO 45% ~ rwIum (45c lor each $1.00wage<IOJ).A g rap h i s a ls e im :l ud ed Sh. ow in jl PHO- ' ' 5 c lo se l itI.t he I de al p re di el ed p ro bab ilHy v s. a el ua lWin pe1 " t : e f l t ag eCUM,Th is p rogr am lea tu res:0 J n p ro ba bi lity a nd o dd s l oreach

~8 0 Verillca tion displa y 01each h or se 's p a rame te rs p ri or 1 0e nlry lo r e asyerror correction0 8ubbll1'sot1routine l or f in a ld isp la y D Fa cil ity lo r lin e p rin le routput 0 c assen e A RCHIVEro ulin e t o sto re PH[)-1's o ut pu t l or l at er a na ly si s0 Completeu ser s manual .T he u se r: smanual f I IiIYb e ordered seperal8lyl or y ou rpurusal

! or $7.95an d wU Ibe c re d~ ed i ty o uPUrChaS8PHD-1.P H(l.l U ... • • 1 1 1 1... I I Id11K ~ 1Ir;

~"::t= ,r~~ ,(~~ .~~I: ..... ,.I2UMake c h ec k spayable to: C a. re s. a dd 6%

JO ECOI l l ' UTE I I22719 V_IMI .• SuIIt F. WIIdIInd H.. , CA tt354

·B I A W IN NE R:G e ton 11M!Clwnpulel !i and Gamb ling P roducts~I,," m a[~ng lisllar $3.00an d receive availab le. back issues.

tTRS·80 is a r eg i si er fl ll l.m iema ,k 01 Tandy CNpora lk Jn .

Page 77: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 77/84

6502 Bibliography: Part XXII

~~~~~~~~~~~~~~~~~~~~~~~~~~~

Continuing bibliography of 6502 related material~~~~~~~~~~~~~.~~~~

642. Appleseed (Soft$ide) (Jan. 1980)

Micklus, Lance and Summers, Murray, "Dog Star

Adventure," pg. 36·48.Rescue the Princess Leya.

643. Creative Computing 6, No.1 (Jan. 1980)

Howerton, Christopher, "Grandapple Clock," pg. 104·107.Now your Apple can tick, chime, and keep lime.

Carpenter, Chuck, "Apple-Cart," pg. 134·137.Discusses Keyword search, the MOD function, New Apple

products, etc.Yob, Gregory, "Personal Electronic Transactions," pg.

148·150Discusses short utility routines, a programming for for-

matting numbers, etc.

644. SYM-PHYSIS, Iss. 1 (Jan/Feb. 1980)

Anon., "2KSA Assembler/Editor," pg. 3-6.Assembly language program for the Sym-;.Anon., "Relocate for the SYM-1," pg. 7·12.

Machine language program for the Sym-1.

Gettys, Thomas, "MERGE/DELETE Program for SYM Basic,"pg. 13-16.

Utility routine.

645. Apple 1, No.3 (1979)

W!IIson, Dr. M. Joseph, "The Challenge to Personal corn-puters in Science and Industry," pg. 2·5.

The Apple II will be on board the Space Shuttle where itwill monitor scientific experiments.

Anon., "Applications of the Apple," pg. 7·18.Discussion of a number of applications including

evaluating paramedic and hospital procedures, endocrinelevels in the birth process, Pascal in Education, testingtelephone lines, use In the trucking industry, prospecting bycomputer and use In military games In "think tanks."

646. Recreational Computing 4, No.1 (Jan. 1980)

Mulder, David, "Merging on the PET," pg. 40·41.Put two programs together with this routine.

647. Recreational Computing 8, No.1 (Jan/Feb 1980)

Hall, David J., "Computing for Health and Equality," pg.8-11.

July 1980

D r.W illiam R . D ial438 Roslyn AvenueAkron, OH 44320

DAII about Hol istic Health and the PET.

Deliman, Tracy, "Holistic Computing· A Program Idea for

Healthy Living," pg. 12-14.A PET oriented program on holistic health.Thornburg, David D., "The Presto- Digitizer Tablel," pg. 16·18.

A low cost alternative to data entry keyboards.

Sevik, Jim and Eric, "A Learning Program for ProblemReaders," pg. 25-28.

A PET Program for readers with reading problems.

648. Kilobaud Microcomputing No. 37 (Jan. 1980)

Anon., "Ohio Scientific's Small Systems Journal," pg. 10·13.Discusses the OSI-DMS Quotation/Estimation System,

the Educational System, Inventory Control, PurchasingSystem, and Bills 01 Material System.

Baker, Robert W., "PET Pourri ," pg. 14·16.Discusses New Pet Products, A.xiom Printers, Programm·

ing Ideas and Tips.Schmeltz, Leslie R ., " 'Core' and More for Your Apple," pg.

110·114.Accessories for your Apple.

Freeman, Robert, "The Metamorphosis of a 'Custom' PET,"pg.116·118.

Customize your PET.Knapp, Jeff, "Darkroom Master," pg. 126-130.Use your PET in the Darkroom.

649. Stems From Apple 3, Iss. 1 (Jan. 1980)

Stein, Dick, "PASCAL Time," pg. 7·14.Three example programs which either reads or writes a

data file.

650. Kilobaud Mlcrocomputing Iss. 38 (Feb. 1980)

McCormack, Chris, "Microchess Modifications," pg. 68·69.Enchance this game for your KIM.

Ramsey, David, "Two Intriquing and Useful Apple IIPeripherals," pg. 70-74.

Getting 10 know Speechlab and Apple Clock.Sparks, Paul W., "Development of a Text-Handling Program:

A Learning Experience," pg. 112-118.Handling words on the PET.

Martellaro, John, "Apple's Hidden Floatlnq-Polnt Routines,"pg. 132-135.

MICR.O *- The 8502 Journal 28:75

Page 78: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 78/84

l:.ightning-fast number crunching.

Spisich, John, "Add a Digital Tape Index Counter to thePET," pg. 158·160.

Construct this counter for your PET cassette and locatefiles quickly and accurately.

Blalock, John M., "A Printer for the KIM or SYM," pg.186·192.

The Selectric finds another home.

651. Creative Computing 6, No.2 (Feb. 1980)Zimmerman, Mark, "Blackbox for the PET," pg. 112·117.

A game with graphics.

Carpenter, Chuck, "Apple-Cart," pg. 148-151.Hints on using diskettes, Apple I/O Circulls, tips on using

Pascal , Applesof t formatter.

652. The Target (Jan/Feb. 1980)

Bresson, Steve, "CHAIN," pg. 6·7.Controlled loading and execution of multiple files from

tape on the AIM 65.

653. Call-Apple 3, No.1 (Jan. 1980)

Spurlock, Loy, "Creating a Hi·Res Character Set," pg. 13·15.A Basic program for creating characters.

Hyde, Randall, "Assembler Maxi·Reviews," pg. 18·23.Reviews of the Microproducts Assembler, the SC·

Assembler II, ASM/65, EAT (Edit and Assemble Text), L1ZA,UCSD Adaptable Assembler (Pascal).

Konzen, Neil, "ZOOM," pg. 28-32.Two versions: one for Basic and one in assembly

language.

654. MICRO No. 21 (Feb. 1980)

Peck, Robert A., "Expanding the SYM-l ...Adding an ASCIIKeyboard," pg. 5·7.

Fair ly simple procedure.

Fam, Richard, "A HIRES Graph-Plotting Subroutine in In-teger Basic for the Apple II," pg. 9·10.

A Basic subroutine Is presented which permits graph plot-

ting.

Morris, E.D .• Jr., "Multiplexing PET's User Port," pg. 13·14.Multiplex when you need to Input or Output more bits of

data than your micro can handle.

Phillips, Robert, "The Binary Sort," pg. 15·16.A concise description of the Binary Sort concept and an

implemenatation In Basic.

DeJong, Marvin L. , "A Complete Morse Code Send/ReceivePackage for the Aim 65," pg. 19·26.

A valuable program for the Hams among the AIM users.

Swindell, Jack Robert, "The Great Superboard Speed-Upand Other RAMblings," pg. 31·32.

Here is all you need to make your OSI Model 600 board runtwice as fast as it normally does.

Urban, Michael, "KIM·1 Tape Recorder Controller," pg.35·39.

Some techniques for using a 6502 micro for controllingswitches are presented, as for example, controlling a tapedeck.

Tripp, Robert M. , "Ask the Doctor," pg. 41·43.Converting the SYM Tiny PILOT to work on KIM; Slow

Display for the AIM; Chart of the AIM, SYM and KIM expansionpinouts.

Taylor, William L. , "Graphics and the Challenger C1 P, Part3," pg. 47·53.

Third article shows how to put the pieces together.

Rowe, Mike (Staff), "The MICRO Software Cataloque XVII,"pg.55·56.

Nine New Programs for the 6502 micros.

Dial, William R ., "6502 Bibliography: Part XVII," pg. 59·62.Another 150 references are listed.

655. BYTE,S No.2 (Feb. 1980)

Newcomb, Robert K.. "Another Plotter to Toy With,Revisited," pg. 202-207

A plotter for the KIM.

656. Personal Computing 4, No.2 (Feb. 1980)

Wheeler, Dwight, "Mechanical Paintbrush," pg. 56·57.A graphics program for the PET.

657. Interface Age 5, No.3 (March 1980)

Baker, AI, "Game Corner," pg. 38·42.Time Trials is a new program for the Apple II.

Adler, Alfred, "The Micro·Malhematic.ian," pg. 44·55.A continuation of a Fourier Analysis program started

earlier.

658_ SoftSide (AppleSeed) (Feb. 198m

Dubnoff, Jerry, "Supernim," pg. 10-15.Adding a second dimension to this old Apple game.

Anon., "Elementary Math," pg. 22-23.A to-res graphics program with sound to assist in additon

drills, Apple.

Brandon, Jack, "State Capitals," pg. 27-29.An educational Apple game.

Anderson, Chip, "Connection," pg. 32·35.A to-res graphics program for the Apple.

Wagner, Roger, "Musical Scales," pg. 39·41.A program to teach musical scales with the Apple.

Anon., "Sort," pg. 47.A utility program for the Apple.

Anon., "The Vocal Apple," pg. 50·51.Short Utility to make the Apple more vocal and respon-

sive.

Anon., "Programming Tips for the Apple," pg. 54.How to avoid unwanted blanks when editing PRINT

statements.

659. On Computing 1, No.4 (Spring 1980)

Williams, Gregg, "The Ohio Scientific G4PMF," pg. 39-45.A review of a 6502 based microcomputer.

Hafner, Everett, "An Apple in Hanoi," pg. 70-78.An interesting account of bringing up and maintaining a

modern microcomputer in Southeast Asia.

660. Dr. Dobb's JournalS, Iss. 2 No. 42

Brown, Dewitt 5., "A User Interface to Apple II Program

Renumbering," pg. 26·31.Simplification of procedure for USing renumberingroutines.

Lindenschmitt, Gary, "Another Phone Dialer." pg. 43·44.A phone dialer for the PET.

661. Fort Worth Area Apple User Group Newsletter (Feb. 1980)

Meador, Lee, "More About Interupts," pg. 1·4.A tutorial on Interupts for the Apple.

Meador, Lee, "DOS Disassembly," pg. 4-9.Third Installment of the Assembly listing of the Apple II

DOS.

26:76 MICRO -- The 6502 Journal July 1980

Page 79: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 79/84

662. 6502 User Notes, No 17

Silvestri, Gino F., "Match This," pg. 1-3.An interactive game for the "naked" KIM.

Shijanowski, Rush, "How to Transfer Basic Programs fromPET to KIM," pg. 4-5.

A utility program for the KIM, modified by Eric Rehnke.

Deas, Glen, "Basic Cassette 110 Mods," pq. 5-7.Mods for lead and save cassette routines for the KIM.

Doutre, Ben, "Tiny Basic," pg. 7-10.Misc. notes on Tiny Basic for the KIM.

Silvestri, Gino, F., "Broaden Your 110 Cheaply with aNon-6500 PIA," pg. 14.

How to use 80BO peripherals with the KIM.

Gordon, H.T., "KIM Audible Warning Interface," pg. 15.Software and hardware for an audible KIM.

Clements, W.C., JR, "Interfacing the TVT·2 Video Board withthe KIM-t."

A How-to articled on interfacing.

Hogg, Frank, "Cassette Load Display on KIM LEDs," pg.16-17.

Load Memory from Tape with display.

Hooper, Philip K., "Cassette Save Using Alternate StartingAddress," pg. 17.

How to read a cassette file into a memory block otherthan than the one from which it was dumped.

Nelis, Jody, "AIM Info - AIM printer Modification," pg. 20.How to clear up wavy lines and how to get heavier print.

Bresson, Steve, "AIM 65 Basic-- Data Save/Load Scheme,"pg.20.

Save and Load strings and data in text form from Basic.

List, Gunnar, "TINY BASIC for SYM," pg. 2.2.Tiny Basic modified for the SYM.

Regal, Ron, "OSI Notes," pg. 22.Interfacing a 42K Ram board to the C-24P

Carlson, Edward, "Zero-Page Map for Basic in the C2·4P,"pg.23.

Memory Map.

Leasia, John D., "Pseudo Random Number Generator," pg.24.A utility routine.

Eaton, John, "KIMATH Support," pg. 24.A routine to find the Tangent of an angle.

Goenner, Markus, "Interrupt Routines and Breakpoint," pg.24.

KIM-1 IRQ routine.

Jordan, Doug, "Square-Waver II," pg. 26.A short routine for audio.

664. Abacus II , I ss. 1 (Jan. 1980)Davis, James P., "Two Diamonds - A Puzzle Game," pg. 4-7.

A game adapted for Applesoft.

Avelar, Ed, "Remote Control for the Apple II," pg. 4·7.

Special hardware to turn on a remole Apple by phone.Anon., "Nicer Menu," pg. 7.

Select from your apple disk catalog by designating a let-ter.

Anon., "Auxilliary Key Board Plug," pg. 8-9.A second Keyboard for the Apple is possible with this

plug.

Anon., "Math Section I (Addition)," pg. 10.An Addition program in Integer Basic for the Apple.

Wilkerson, David R ., "Apple Writer 1.0," pg. 12-13.A review of this word processor.

665. Dr. Dobb's Journal 5, Issue 3 (March, 1980)Cason, A. , "PET Tape CURE," pg. 43.

666. Stems from Apple 3, Issue 2 (Feb. 1980)

Hoggatt, Ken, "Ken's Korner-Basic and Pascal," pg. 3·7.Similarities between Basic and Pascal.

Pfeiffer, Jim, "How Applesoft Stores String Arrays," pg. 4-6.Discussion of String Arrays and how to clear such space.

Byerly, Kent, "Literal Input Fix," pg. 7.A fix for a program "Literal Input".

667. Byte 5 No.3 (March 1980)

Helmers, Carl, "Hunting the Computerized Eclipse," pg.6·12.

Use of the Apple in an Eclipse Monitor operation.

Matthews, Randall S., "Hydrocarbon MoleculeConstructor," pg. 156-166.

An OrganiC Chemistry teaching aid.

Couchman, James C., "KIM·1 Multiplication and Dlvlsicn,"pg. 212·216.

Routines to multiply and divide two l6-bit signed quan-tities.

Hooper, Phillip K., "The Correct Order of Operations CanShorten Code," pg. 242·244.

Painter decrementing on the 6502.

668. Nibble (Jan/Feb. 1980)

Anon., "Hi-Resolution Multi Color Kaleidoscope," pg. 7.Two Hi-res color programs for the Apple.

Anon., "Sort 'em Out," pg. 8.Discussion of Sort techniques on the Apple.

Anon., "Initialize New Files Automatically with ONERRGOTO," pg. 9.

How to use the ONERR GOTO instruction on the Apple.

GPIB for APPLE I ITMAre you smart enough to us e a dumb board

You be t you a re !

Wit.h two programmable 8 bi t 10 pOT ts teach IjojI j_th two

control l ine s , an e igh t b it sh ift reg is te r . a nd two

programmable counter-timers. this board can do too

many th ings for anyone t o s up pl y YOUT pTogram_ in ROM.

Bu~ y ou con contro l it USing BAS IC , F ORTH , PAS CAL o rm a~ hi ne l an gu ag e progTams-to input or putput da ta ,

control ext.erna I devices ~ to time internal or ext.e rnat

events J or to count ex te rna l events .

A large, a rea is available for any bu_ffe'rs t relay et.e .

that you mig ht ne ed fD'r th e control of e xe erna j. de vice s.

Supp lied comple te ly a ssemb led and te s ted. wi~h two

t o cables and extensive instructions.

Gold edge·connector for highest relia,bili ty.

One 1'$'8.1" war ranty, 30 day ~tBG.

Only $ 59. SO, post paid in c.crrt . USA

SASE for addi t Ienaj. da-ta or wi th ques t ions regs.'rdtng

y ou r s pe ci fi c a pp li ca tio n.

microAustin

POBox 14408

Aus ti n, Texas 78761

VIS.~e

Page 80: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 80/84

Page 81: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 81/84

Page 82: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 82/84

Decision

Systems

Pr~~f!1Jl lng lhe O ther S ide of the Apple 1/*

INDEXED FILES

ISAM·DS is an integr;at'ed set of routines for the creauon and manipulationof indexed files. ISAM-DS provides capabilities comparable to tnose onlarge mainframes. You can rapi dly retr ieve records by key value or part ial keyvalue (retrleves any record in a 200 record file, 60 char/record, in less than 3seconds compared to a maximum of 38 seconds for a DOS sequential Hie).Files neve, nave 10 be reorganized. Duplicale key values may be used,Records may also be retrieved in sequence. 'SAM~DS routines are easily in~teqrated into Apple.oft programs - t""y use less than 3K RAM plus an in-dex table.

Requires: Disk. Applesoft IllK R OM or 48 K RAMI

$50

STRUCTURED BASIC

PBASIC-OS is a scphlstlcated preprocessor for structured BASIC. Nowyou can gain the power of PASCAl·like logiCstructures at a fraction of thecos I. US<! all !'egular BASIC statements plus 14 commands and 11 nowstatements/structures (WHILE. UNTil. CASE. eic.). PBASIC·DS can beused to develop INTEGER or APPlESDFT programs. It is a great way tol earn and u se s tr uc tu red log ic co ncept s.

Req uires: Disk. Appiesoflt 32K ROM 0 r 48 KRA M I

$35

(Texas residents add 5% t;ax)

DecisIon SystemsP.O, Box 1300S

Denton. TX762Q3

•App le II isa reg isle .red trademark of the App le Computer Co.

051 C-1 Pl5UPERBOARDCan a cassette-based micro with a 24x24

display and 4K RAM make a practical terminal?

It can with CHAT (Challenger Terminal),the intelligent terminal.

In addition to ASCII communication via thekeyboard, CHAT also provides:

• Storage of received data in a buffer whose contents canlater be examined or saved on tape, Buffer automaticallyexpands on systems with more than 4K RAM.

• Direcl transmission of data stored on tape to othercorn p u t e rs.

• Full/haH duplex modes; selectable parity, data and stopbits,

• Standard ASCII keyboard layout wilh auto repsill andtransmit break key.

• Unique keyboard feature rarely seen on other terminal s -user modifiable key layout. CHAT allows you to reprogramthe keyboard so that you may choose where to localecharacters and control codes, Changes do not have to bereentered every time you load the program!

Requires RS232 mod.$24.95 ppd. mel. cassette and manual

Charles A. Shartsis9308 Cherry Hill Rd. #812College Park, MD. 20740

interactive video• Index and acccess multiple frames or seg-

ments of videotape by name or by framenumber from the Apple" keyboard or fromwithin a program

• Develop a comprehensive picture and textinformation storage and retrieval system

• Interfaces any VCR having a control pulse orsearch capability with the Apple Computer'

• Uses the same screen for computer and video

• Utilize extensive authoring software to easilywrite CAl

A complete package of all interfacinghardware, software, and connectors

available from

CavilSYSTEMS26 Trumbull Street, New Haven, CT 06511

or call (203) 562-9873"TM- AppleComputerCo.

CRAEA fast Co-Resident Applesofl Editor tor Applesoft pro-grammers. Now perform Global changes & finds toanything in your Applesoft program. Quote (copy) a rangeof lines from one part of your program to another. A fully

optimized stop-list command that lists your program tothe screen with no spaces added an d forty columns wide.Append Applesoft programs on disk to program inmemory. Formatted memory dump to aid debugging.Powerful renumber is five limes faster than mostavailable renumber routines. Auto line renumbering.CRAEneed be loaded only once and changes your Applesoft program right 1mmemory. 24K Apple II or Plus & Ap-plesoft ROM & Disk.

MeATMCATis a binary program which creates a master catalogreport. The first list is sorted by tlle names and the secondby volume number with sectors used indicated. Provi-sions for duplicate volume numbers, 600 file namescapacity on a 48K system. 200 lor a 32K system.CRAEon disk with 16 pagemanual $19.95MCATon disk with

10pagemanual

$14.95CRAEand MCATon one disk with manuals $29.95One manual $2 Both manuals $3CRAE/MCATmanuals include instructions for making abackup copy.See your local dealer or send checks to

HIGHLANDS COMPUTER SERVICES14422 S.E.132ND

RENTON, WASHINGTON 98055(206)228·6619Washington residents add 5.3% sales tax. Applesoft andAPPLE are registered trademarks of APPLE ComputersInc.

Page 83: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 83/84

Page 84: Micro 6502 Journal July 1980

8/3/2019 Micro 6502 Journal July 1980

http://slidepdf.com/reader/full/micro-6502-journal-july-1980 84/84

.~ ... • .~ ", . ( -,,",, r- -. _-,- _ 'iI ,..

T he hom e com putlrypu though t \ears awa is h ere. .----:/ '--~--~-.'~C·~_:"_s.,~~~;~

sOhio Scientific-'s top of the line personal com-puter, Ihe G8P DF. This system ineorperates~he most aqvanc,ed te~hnolo9Y now ayaila.pleIn standard configurations and,add-on options.The G8P OF has ful l-eagabi lj ties as a personalcomputer; a small busmees computer; a nomemonitor ing securl ty system and an advancedprocess controller.Personal Computer Fe~turesThe Gap DF featu(es ult ra- test program execu-non. The standard model is twice as fast asother personal computers such as the-Apple IIand PET.The computer system is availablewith a GT option which nearly doubles Ihespeed aqain makir lg i t eornparabls to t jigh end

The computer system tomes standajd With ahigtj·speed printer lntertaee and a modem lrr-terface. II features a fJJIl53-key ASCIIKeyb€lard as well as 2048 character displaywitf1 upae r and lower case to r bu sln es s andword processing applicatlons.Home ControlThe CSP OF has the most advanced homernonitorins and controlcapabl tlt ies everoffered in a computer-system. I t tncerporatesa real thile clock and a unique FOREGROUNDIBACKGR(')UNB opetatlnq system which al10WSIhe cornputer totunctlon with normal BASICprograms at Ihe same time it is rnonltoringexternal devices , The CBP OF comes standardwtth an AO' remote control in tertaee whichallows it to contrel a wide range of AC appll-ances and lights remotely without wiring al1d

1 .IILL IN GE lc D P o

accessory BUS connector is accessible at theback of the computer to plug in additional 48line~ of pa~anel I /O andlor a complete analogsignal 110board with AiD af,ld DIA andmu ltlolexers.Clearly. the C8P DF beats all eXisting smallcomputers ih conventional 'spe.cifications plusit has capabilities far beyond any other corn-puter system on the markel today.CSP OF tsan 8·s10t mainframe Glass computerwitt ;J32K stalic RAM, dual8" f loPfil ies , andseveral open slots for expansion.

c a pOr get started with a capwith cassette inter-