micro 6502 journal october 1978

60
8/3/2019 Micro 6502 Journal October 1978 http://slidepdf.com/reader/full/micro-6502-journal-october-1978 1/60 I •• ~ The Magaz.ine of the APPLE. KIM, PET and Other @l~C!)~ Systems Rockwell & Synertek EXPAND THE 6502 WORLD NO 7 51.50

Upload: cubemanpdx

Post on 06-Apr-2018

240 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 1/60

I •• ~

The Magaz.ine of the APPLE. KIM, PET

and Other @l~C! )~ Systems

Rockwell & Synertek

EXPAND THE 6502 WORLD

NO 7 51.50

Page 2: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 2/60

NOW AT F I N ECOM PUTER STO RES

SPEAKEASY SOFTWARE LTD.

BOX 1220. KEMPTVILLE. ONTARIO

KOG 1JO

***************************NOW AT MOST APPLE-II DEALERS***************************

kidstuff

/~~"\~ ____ "--,~ ,~ ' 0..6 ' • _~_

Page 3: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 3/60

O CT OB ER /N OV EM BE R 1 97 8

ISSUE NUMBER SEVEN

4e're Still Number One!by Robert M. Tripp

BREAKER: An Apple II Debugging Aidby Rick Auricchio

MoS 16K RAM for the Apple IIby Allen Watson III

PET Update

by Gary Creighton

6502 Interfacing for Beginners: The Control Signals

by Marvin L. D e Jong

5

12

13

17

650X opcode Sequence Matcher

by J. S. Green

A Memory Test Program for the Commodore PET"by Michael McCann

MICROBES, A Suggestion, and an Apology

The MICRO Software Catalog IV

by Mike Rowe

Apple Calls and Hex-Decimal Conversionby Marc Schwartz

6502 Bibliography - Part VIby William R. Dial

6 50 2 I nfo rm at io n R eso ur ce sby William R. Dial

KIM-l as a Digital Voltmeterby Joseph L. Powlette and Charles T. Wright

Ca ss et te T ap e C on tr ol le rby Fred Miller

Apple II High Resolution Graphics Memory Organization

by Andrew H. Eliason

A Digital Clock Program for the AYM-l

by Chris Sullivan

Peeking at PET's BASICby Harvey B. Herman

KIMBASEby Dr. Barry Tepperman

19

25

27

29

31

33

35

37

39

43

45

47

49

A dv er ti se r' s I nd ex

IFC Connecticut microComputer11 CGRS

26 Computer Shop

48 Synertek SystemsBC

S pe ak ea sy S of tw ar eMicrocomputer Camp. Spec.

Smith Business Services

The Computerist, Inc.C om pu te r C om po ne nt s

2

16

28

IBCEditor/Publisher

Robert M. Tripp

Prod uction Mana gerP et er R . W oo db ur y

B usiness HanagerDon na M. Tripp

A dministrative Assis tantSus an K. Lacom be

CirculationEil een H. Enos

Micro-System s LabRobert J . Gnudet

MailroomCheryl Lyn Loyd

MICRO is published bi-monthly byThe CoMPUTERIST, Inc., P.O. Box 3, So. Chelmsford, MA 01824.Controlled Circulation postage paid at Chelmsford, MA 01824.

Publication Number: CoTR 395770. Subscription in U.S. $6.00/6 issues.Entire contents copyright 1978 by The CoMPUTERIST, Inc.

Please address all correspondence, subscriptions, and addresschanges to: MICRO, P.O. Box 3, So. Chelmsford, MA 01824.

Gofer

F re d D av is

Page 4: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 4/60

C O M M O D O R E P E T H A R D C O P Y O U T P U T U S IN G P E T A D A 1 2 0 0

:.":: :~~~:n ... ~Li~n5 FUI4CTl_nl~5 FCIR THE CrulluHlUtE PEr

711 Ai·.. -L131t.d on • (iE Tu ..UI.t J""

•• I,lll "u.lnq 8 C< ADA12...... . " ' .• RE_ OPEN nUTPUT FILE ON DE 'IICF. ,e .

II.nPEN!I.1

128 IIEll~_ AU GET " ~I ME VALUE

~I. lNPUT S

~2. e-s~)aI I I E M

, .... 110 THE !lUll' OF THE ANCiL£ 15 5

,el. AU IF THE ~J" IS IN THE .ANCE nF -, ro I. TlIFN CIIl'.PUTE.

,ft2_ IF ~c I AND 5.-' onTO H75.I.J. "'~.O.'GUTn2"", .. " IEM TIlE AweSINE 15 A~

'"~. AS-AYNeS/If 1-5.5''''.!I))

IN _ HEM THE AE!iU LT IS 1M HAOUMS. CnNYEHT ro OEGHH~.

lallt .4.5...5., ......

2". AU nil cn~INE Of' THE AIIClE 1: -; ClWl. AEM IF THE e MINE 15 IN mE HAHG£ Of -I TO r ,

2"'1 IIEM AND HOT . 11 '1 If. T II EN C OM P UT E

""2" IF CC,.. THEN2 ' ' .283. AC-OM'Gun) Jeet21 141 1 IF eel AND C .-I THEN 287.

21JS'I ,lC-a.cnTO Jf!M

286_ RE. TH£ AIfCCOS I!> AC2tt711!AC·ATNfll~·C)".!lJC)

2 ... REM THE RESUlT IS IN HAOUN5. COfNEHT rn DEGIfHS.

2"". AC·...C·18.'l"" " PAINTI!>.· ~IN.C[}5 "RCSIN ... lK:CUS·

ltI'" PAINlIIS. S.lit2" FUN ,..1 TIl Il-LEJlfsnIUS),IPP.INT.!>.- -"IiEn

lltl'" PIUNTIf!>....51lQil. ,nlf 11 '-111 '1 I J-(ENISTAIIAS,),PAI ITI !>.· - 'INEIT

l~" P1tINH'S ....CJINGf1T1' !INI,UC"l.

211I I TYPE C

I

I n TYPE.

. . .lU 0011

••• !XIII

II. II. Unt') finn

I~! I TYPE'" UI III IU uno nnu IInuI,.. flO,1 non nell e .WI !)Ir l

,.If nno 0l~1 0)(' 11M)oll n.UI ncr. eoo IIIXI orXI IX10IIInon 1)t~1non nnn rxlCIIII III

I~ .,.. non nno 'XIO IJIX, III III In

If.. OIXIoon onu 111 III III 111 111

IU)(I ooo nul') In 111 III III III 111

,,. ,.If oun 'XI() III 111 III 111 III III In

!", roc ()()(I fKlOIII III III 111 III 111 III 111

S!O,XI exlO11011III 111 III III III 111 111 111 111

!IXXI 111 111 111 111 111 III 111 III III 111 111

! III 111 III III 111 III III III 111 111 111 111

!III 111 III 111 III III III III 111 III 111 111

!III 111 III 111 III III III III III 111 III IU

- - - - _ . ----------------- - - - - - - -- - - --------- ----!J"U HI ....., ...PO MAYJUN JUL AU G 5~P neT NIIV CEC

'-2 '-J I-PI 1-!l.2!1 I -. S. • • • • •. 2'''' 12!1"" 117SI116.221 I.lfIOIJ7J!I 7."71n67111I•• I.... IfKWlMMt 101087.! l8 l .16221 '76H'· IIPI I.

" . 22SBM Jl1S64MA 68611171.28 2.6S1SlS72E·11 12.27"87

2"" . . . . . . 8.....-_ I ...OJO·JS.J 1.2.:00200E·12 II. '" tJ"J6

2'. . . . . . IS62SReA JI 68SS.2 J.IIJI "J181E.12 IS.I"JII8JJ....

. _27N1Ci!Jf'AM 6~·88S·.8 1•• ,tll"JJ2E·ll 11.J2r,,_81

" . I22SeI • 28l'''J ''''' 08211"".8 2.2111)21)E.I) 18.1"8~69

'M . ' . - 6'''''''PIfIiA I '9'9Ml" '.~70·612Je·IJ 2', . 2~~~ 9112"J"""" 216'21/11 8. '080"J829f.l) '1.21]1-)1,. . ._ .'~""M""" JI II )lS2 " I .'171.1121E.I 12. ]6<6108

" . ).~ . . . 166Jl'''Ji*tM .Ato!>..... 2.• )1~126er:.1. 1.l.'''J1Itl',,8. . . 3d ... .. . 216~"*' "J)) 2)MI J.88!>12I"E·" 2'.'9'8911. , . '22!>_ 21162!>MM 6811126)1 !>.tI~8~1122~·I '''J.'9..,.·916,. . .- ). l",oc.fW! 861219~91 1...·99·)E.I. .i'6.'''J7!>I JI

" . !>62. ., .. . '21 i1n~~ 1.""I.119"E·ca9 1.2·18!>11,c·l!> 11.)8,'219

HS-.!3:< PIHNTEI< ADAPTER FOk THE COMMODOREPET

, . .. .. REMTHl i. FU tC lI j l. . PLnTTal I 5 'IItlIf Y-I.!UU e , iI.1I

l I £AOY.

~ ,I I· ------ _.

1

.2

.J. .

.e. .1

.e

.9,1.1

1.2

'-'I.'.,I.',.1I.''. 9

22.1

'.22.J2. '2.'2 ••2.1

2 ••O!.~J

J.I

J.2

J.J

J.'J.'J••

l.69999"9l.7""","l.S9999999l.99099"9',119999999•• 19999999

• •.2"99999' . l " 9 9 9 ' X I' ••"99999..!t0999999• .69999'199'.19999999e ,11"99999'.99999999!t.,,"99999

The CONNECTICUT microCOMPUTEi( ALJApter model 1200 is the first in a line of peripheral adapters tor the

COMMOr.okE PET. The CmC ADA 12"'''' dr i ves an k5-232 pr inter trom t he PET I EIOE-488 bus. The CmC ADA 12~ allowsthe PET owner to outain hard copy program listings. end to type letters. menuscripts. mailing labels. tablesof dat~. pictures. invoices. grEphs. checks. needlepoint patterns. etc •• using a standard RS-232 printer.

The cmC ArA model 12008 comes pssembled and tested. without power supplies. case, or RS-232 connectorfor $9~.5"'. The CmC ADA 1200C comes complete for SI69.0"'. ~ecifY baud rate when ordering. (300 baud issupplied unless otherwise requested. Instructions for changing the baud rate are included.)

lVllflD PROCESSOfl FOfl THE COMMODOREPET

CONNECTICUT microCOMPUTER now has a word proce~sor program for the COMMODOREPET. This proaram permitsconpo s Lrio and or int ino letters. flyers, advertisements, manuscripts. articles, etc., using the COMMOO'lkE PETand an kS-232 printer.

Script directives include line length, left margin. centering, end skip. Edit commands allow the user toinsert lines. de l e te lines. move lines, chen'll! strings. save onto cassette. load from cassette. move up. movedown. print and type.

The CmC Word Pr oc e s so r Proaram addresses en RS-232 printer through a CmC printer adapter.The CmC Word Processor ~roaram is available for S29.50.

I1S-232 TO CUI~kENT L(10P/TTL ADAPTEfl

The CrnC ArApter model 400 has two circuits. The first converts en R5-232 signal to a 20 rna current loops Lun aI , and the s e cond converts a 20 ma current loop signal to an fl5-232 signal. With this device acOl'lputer's telp.type port can be used to drive an fl5-232 terminal. or vice versa. without modification of theport. The emc ADA 4~0 can also he par~lelled to drive a teletype or kS-232 printer w~ile still using thecomputer's r e ou l ar t e r n t na L, The CrnC ADA 400 can easily be modified to become an fl~-.<32 to TTL and TIl. to11:;-232 AfApter. The CmC A'JA 40'" does not alter the baud r a te and uses standard power supplies. The currentloop is isolatpd from the RS-232 signal by optoisolctors.

The emc ALJA4'~lI) is the perfect partner for KIM if vou want to use an R~-232 terminal instead of acurrent loop te l e tvp e.•

The CrtC A'JA 401-1S comes "ith drilled. plated through solder pads and s e l l s for $24.5V1. The crne ADA 4"1"'8cortes with harrit!r strips and screw terl'linals and sells for S29.5"1. , - = = = = - ,

, < : : : : ' \ , '~ : : : : "", - \ ,- ",,,---._..-----.., ,

·ll\ " '.

0'" \ "'"",., , ""0",-, "-'". . . . \ "

::';: ~ ,,:::: ; ~-.- ...!~~~--•••• ' '.

" : \ : / " : : _ y : ; : ; ' : '

This ennoun c eme n t '."S compns e o on a COMMO[)"JflEPET and printed on a GETe rmt Ne t us in.; [' CmC AlJA 120~C printer adapter and the CmC Word Pr o c e ss o r~roori!rt.

: :~~:: : :~: : : :: : : :~~ ~~ :~:~::~~ ~::~~ ::~: :=~ ~:: : :~: : : :~: : : : : :: : : :: : : :: : : ::~: : : : :: : : :: : :~: :~: :~~:: : : : :: : :~~!...~..-~!~~~~~~~---------.---------~--~~~~-~~~-~--~~~~-. . . . - : ~ : ~ - - : - -.- ~ ~ ~ ~ : ~ ~ ~ ~ ~ ~ : ~ ~ ~ ~ ~ - ~ - ~ ~ ~ ~ ~ ~ - ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ - - - - - - - - - -._ - - . . . . . . ._ - - - - - - - - - - - -----~.:~-~~-~~~...!-~~~~~~---------~--------------~-~~~~-:--------:--~ . . CON NEe TIC UT mic ro COM PU r ER----~_:~~~_~~~:~~~~~:~~~_~~~~:~_:..u~JJC 150 Pocono Road, Roome

_----~-:~~~~-~~~~~~~~~~!~~-~~~~~~~~:-- ---------..-~~~::-~..----- ~-- ~ --- I ? ! ? _ C ? ~ ~L~~ _ : . _ S _ ~!1~..:_~~Q _4_ .._... _1 e -c ...Ol '"5 Iiold.r pldS) I .2.SIiJ I t . . . . . . e- - - . .- - - - - - - - - - - - - - . .- - - - - - - - - - - - - _ _ . . . . . . . . . . . - . .- - - - - - - - - - - - - - . .- - - - - - - - - - - - - - - - - - - - - - 1 0 0 . . . . . . . . . _I CIiIC..Ol '''8 Ib.rrl.r ,trlp.1 I '29.!lA I I cnIllP...NY

--------- ------------- ------- -------- ----~~~;~7----------- --;-- ---- -;-- - - ; ; ; o ;E 5 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - . . . - - - - - - - - - - - - - - - - - - - - - -

-------------------~;=;;~;:;-;:;~~;~;;-;;~-;;-;;~;;-;:;---j-------'-j---------------------------+-------------------------------------------------------- '~

: = : = = - - = ~ ~ = = : = = : : = ~ ~ ~ } ; ~ ~ ~ ~ ~ f ~ ~ i : ; ? ~ ~ ~ ~ ~ ~ f ~ ~ ~ = : : ~ ~ : : ~ ~ ~ ~ ~ - = : : g ~ ~ ~ : : ~ := ~ = : : ~ = - ~ = = = = = ~ ~ = ~ ~ = ~ ~ ~ ~ ~ = ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ; ; - ; ~ ~ ~ ~ ~ ~ = ~ ~ ~ = ~ ~ ~:~~!'~:~:~_---~~~~~~~~~-----~:~~~~~~~-~~~~:~---------~~~~~~~~~~-~~~~---------------~-----------------------------------

~~~..~~~~~~~~--------------------------------------------.----------------------~- .. --------- .. .-------------------------------- . .----_ . . -~~~~~~~------------------------------------------.:..----------------._ - - - - - - - - - - - - - - - - - - - - - - - - - - . . , - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _ . . . . . _ - - - _ .. - . . . . . . . _ - . . . . . .-

Page 5: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 5/60

IN THIS ISSUE _ _ _

With this issue we introduce a new format for

MICRO. We were dissatisfied with the quality ofthe last couple of issues of MICRO, particularlythe last issue, and dec ided to try a differenttype of printing. This new format is similarto the old, but is on lighter paper, printed ona web press, saddle stiched instead of sidestapled, and does not have the old MICRO border.We have kept the features that most people saidthey wanted - especially the three hole punch.Of course, we will not know the quality of thenew printer's product until after this goes topress. If you have any comments, let us hearfrom you.

Rick Auricchio, who wrote "An Apple II Program-mer's Guide" in MICRO number 4, has providedanother super article in "BREAKER: An Apple IIDebugging Aid". This article/program allows the

Apple user to debug his program with real break-points which permit the user to interrupt hisprogram at any point, gain control, and thencontinue execution. The program, written inassembler has a lot of useful techniques and ispresented in its entirety.

Those of you planning to add more RAM to yourApple II will find some valuable comparati veinformation about 16K RAMS in Allen Watson Ill'sarticle on "MOS 16K RAMfor the Apple U". Thisinfo includes a table on how to decode how thevarious manufacturers encode their access times.

Ever have doubts about your PET's memory? Then

you will want to try "A Memory Test Program forthe Commodore Pet" by Michael J. McCann. Theprogram requires that the lowest 4K of memory beworking and can be used to test all other memoryin the PET.

Marc Schwartz presents some rules and ideas for"Apple Calls and Hex-Decimal Conversion", a use-ful tool when trying to generate the decimalequivalents for hex codes.

Once upon a time there were hardly any articlesabout 6502s at all. Now William R. Dial's "6502Bibliography" is up to reference number 379, andthis inc ludes many multiple references. Sincea reference of interest is of limited value ifyou do not know where to find the original, alist of "6502 Information Resources" has been

compiled by William R. Dial that tells where toobtain the various magazines he has been usingin the bibliography and how much they cost.

Every once in a while someone will ask "What canyou do with a KIM-l now that the PET is here?"Joseph L. Powlette and Charles T . Wright show

how 10 use the "KIM-l as a Digital Voltmeter".

An automated "Cassette Tape Controller" is thesubject of Fred Miller's KIM article. He pre-sents a complete hardware/software system to aidthe user who wants to control cassette tapesfrom his KIM.illiam M. Shryock Jr. presents an "Improved

Star Battle Sound Effects" program for the AppleII based on the original article by Andrew H.Eliason in issue number 6.

Andrew H. Eliason discusses the "Apple II HighResolution Graphics Memory Organization", and

presents a few short programs that help to un-derstand and use this feature of the Apple.

Chris Sullivan presents the first program thathe wrote for the new Synertek SYM-l, "A DigitalClock Program for the SYM-I". The program is a24 hour clock and has a number of SYM specificsubroutine calls and special locations whichmake it a good introduction for the SYMowner.

Commodore thought they were being pretty smartmaking the PEEK in BASIC incapable of PEEKing atBASIC itself. Harvey B. Herman was even smarterand shows how he is "Peeking at PET's BASIC".He raises some questions about Commodore'S basicstrategy.

"KIMBASE" is a major program by Dr. Barry Tep-

perman. While the purpose of the program is toconvert from almost any number system to anyother, its main value to many readers may be inthe numerous subroutines which provide supportmultiplying, dividing, and other functions.

Gary A. Creighton has a number of items for thePET under the title "PET Update". Included area discussion of the RND (Random Number) Functionuse, a short program for Machine Language Stor-ing in BASIC, some rules for USR Parameter Pass-ing, and a machine language program to SaveMancine Language and Load Directly. A most use-'ful set of goodies for the PET user.

Marvin L. D e Jong's series on "6502 Interfacingfor Beginners" continues with a discussion of"The Control Signals". The article presents thebasic theoretical information, and then a pro-gram and hardware test configuration for ex-perimenting with the control signals.

Quite often you may find that you have two sets

of object code that are very similar, but notidentical. It would be useful to have some wayto let the computer compare the two sets of codeand display the differences. This may soundsimple, but since the addition of a sin91e line

of code wouId make all subsequent lines "differ-ent" even though they were identical except forthe slight offset, it is not so simple. J. S.Green presents the solution and a program in"6502 Opcode Sequence Matcher".

~._ ~ ~~ ~(!J 7: 3 _ 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 i i i i l

Page 6: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 6/60

~£'R[ STILL NUM8[R ONE

Robert M. Tripp, Editor

It's been a whole year since I sat down to write"We're Number One!" for the first issue ofMICRO. Since then a lot has happened within the

microprocessor /microcomputer world, and if any-thing, the position of the 6502 as the leaderhas been strengthened.

THE 6502 MICROPROCESSORFAMILY

There have been a couple of major changes in thebasic 6500 family of microprocessor products.Most significant has been the emergence ofSynertek and Rockwell International as majorproducers of 6500 type products. While manycompanies recognized that the 6500 ser ies 0 fproducts being developed by MoS Technology werein many technical aspects superior to the BoBoand 6Boo product lines, they were reluctant tocommit to a sole source product manufactured bya relatively small company. Now that Synertekand Rockwell have made major commitments to de-velop and support the 6500 line, its growth andacceptance should accelerate.

Rockwell and Synertek are not simply secondsourcing existing MOS Technology products, butare undertaking a number of significant new 6500related product developments. Rockwell has in-troduced the R65oo/1 one-chip microcomputer.Synertek is soon to announce a 6551 ACIA. Alsoin the works by Rockwell and/or Synertek area 6545 CRT Controller, a 6509 16 bit micro-processor, and a number of other products. It

looks as though most development work at MOSTechnology has slowed or stopped and that mostof their efforts are devoted to supporting thePET and KIM-l systems.

A searing blast at the 6502 microprocessor whichwas written by Jack Hemenway and appeared in EONwas very solidly "put down" by articles by

several qualified writers which appeared in alater issue.

THE 6502 MICROCOMPUTERS

This has been a very big year for 6502 basedsystems. Most of the trade tal k and magazinearticles are about the PET, TRS-Bo, and theApple II, and two-out -of -three ain't bad! TheApple II was just becoming available a year agowhen MICRO started ,and in fact was featured onthe first MICRO cover. Since then the growth ofthe Apple II has been one of the brightest suc-cess stories of the year. In a year when manyof the original BoBo based companies found them-

selves in deep trouble, the 6502 based AppleComputer Company flourished. A year ago it wasimpossible to get a Commodore PET. They hadbeen demonstrated at some computer shows, butwere not yet available. Since then they havecome on strong. The "grass roots" support forthe PET seems very strong, judging from the num-ber of small magazines that have sprung up de-voted to the PET.

As our new years starts, there are two major new6502 system developments. The Synertek SYM-l isa single board computer which is essentially anupgrade of the KIM-I. It has more RAM, ROM, andI / O than the KIM, plus a much more powerful mon-itor program, plus a number of other features.It is just becoming available now, and selling

for $269 with ]K RAM, is hoped to do for Syner-

tek what the KIM-l did for MOS Technology. TheAIM 65 is Rockwell's way of announcing itsse r ious entry into the 6502 world. This single

board system includes a full typewriter stylekeyboard, twenty character LED display and atwenty column printer, plus room for 4K RAM, upto 20K ROM, and an extensive BK monitor. Thisproduct is sure to generate a great deal of in-terest in the 6502 from a variety of users.Both Synertek and Rockwell will be sellingan assembler in ROM and an BK BASIC in ROM bythe end of the year.

In addition to these major 6502 microcomputersystems, a number of other smaller manufacturershave introduced 6502 based systems in the pastyear. The onl y major drop-out during the yearwas ECD's MICRoMIND. Since this system wasnever really delivered from production to anycustomers, it's loss was probably of little sig-nificance, except to those loyal customers whohad their money tied up for a year or so.

6502 SOFTWARE

Whereas a year ago there were only a small hand-ful of programs available for the 6502, theremust by now be hundreds of them. Both the PETand the Apple II have generated large marketsfor 6502 based software, and many stores nowhave large quantities of programs for sale.

MICRO

We have been very pleased with the growth ofMICRO in its first year. The first issue was2B pages long and went to about 450 subscribersand stores. This issue is twice the size andwill immediately go out to about 2000 subscrib-ers and about 1500 more copies will go to thecomputer stores. A distributorship has beenestablished in Europe to handle the growing in-terest over there. And, due to popular demand,"The BEST of MICRO" will soon be published sothat new subsc r ibers can get the informat ionfrom the first year of MICRO. Over 3000 copiesof each issue have been distributed, many as"bac k issues" to new subsc r ibers. We are al soquite proud of the quality of the articleswhich have been contributed over the year. Weanticipate similar growth during the coming yearas the 6502 continues in phenomenal expansion.

Our plans for the coming year include increasingthe size of MICRO as required to print all ofthe worthwhile articles we receive. Our new

printing format will permit us some increase insize without requiring an increase in price. Ifwe continue to receive more good stuff than wecan print, then we will consider becoming amonthly pUblication. In order to serve the fastgrowing European market, we have arranged tohave MICRO distr ibuted by L P Enterprises inBritain. This will help keep the cost to 6502owners in Europe reasonable.

Our success in the coming year depends on yourinput. We can be no bet ter than the mater ialsubmitted to us. You have done a great job sofar, so keep up the good work.

Page 7: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 7/60

BR£AK£R: AN APPL£ II D£BUGGING AID

Rick Auricchio59 Plymouth Ave.

Maplewood, NJ 07040

When debugging an Assembly-language program, oneof the easiest tools the programmer can use is

the Breakpoint. In its most basic form, theBreakpoint consists of a hardware feature which

stops the CPUupon accessing a certain address;

a "deluxe" version might even use the Read/Writeand Sync (instruction fetch) lines to allowstopping on a particular instruction, the load-ing of a byte, or the storing of a byte in mem-ory. Since software is often easier to createthan hardware (and cheaper for some of us t ) , abetter method might be to implement the Break-point with software, making use of the BRKop-code of the 6502 CPU.

)

A Breakpoint, in practice, is simply a BRKop-code inserted over an existing program instruct-

ion. When the-user program's execution hits theBRK, a trap to the Monitor (via the IRQ vector

$FFFE/FFFF) will occur. In the APPLE, the Mon-itor saves the user program's status and regis-ters, then prints the registers and returns con-

trol to the keyboard. The difficult part, how-

ever, comes when we wish to resume execution ofthe program: the BRKmust be removed and theoriginal instruction replaced, and the registersmust be restored prior to continuing execut-ion. If we merely replace the original opcode,

however, the BRKwill not be there should theprogram run through that address again.

The answer to this problem is BREAKER:a soft-ware routine to manage Breakpoints. What thedebugger does is quite simple: it manages theinsertion and removal of breakpoints, and it

correctly resumes a user program after hittinga breakpoint. The original instruction will beexecuted automatically when the program is res-umed!

Is it Magic?

No, it's not magic, but a way of having thecomputer remember where the breakpoints are!If the debugger knows where the breakpoints are,

then it should also know what the original in-struction was. Armed with that information,managing the breakpo ints is easy. Here's howthe debugger works:

During initialization, BREAKERs "hooked-in" to

the APPLE monitor via the Control-Y user com-mand exit, and via the COUTuser exit. The con-trol- Y exit is used to process debugger com-mands, and the COUTexit is used to "steal con-

trol" from the Monitor when a BRKoccurs.

Breakpoint information is kept in tables: the

LOCTABis a table of 2-byte addresses--it con-tains the address at which a breakpoint has beenplaced. The ADTABis a table of 1-byte low-order address bytes; it is used to locate aBreak Table Entry (BTE for short). The BTE is12 bytes long (only the first 9 are used, but 12is a reasonably round number) and it containsthe following items:

• Original user-program instruction• JMP back to user-program• JMPback for relative branch targets

When adding a breakpoint, we must build the BTEcorrectly, and place the user-program break add-

ress in to the LOCTAB. There are eight (a)breakpoints allowed, so that we have a 16-byteLOCTAB,a-byte ADTAB,and 96 bytes of BTE's.

As the breakpoint is added, the original inst-

ruction is copied to the first 3 bytes of theBTE, and it is "padded" with NOP instructions($EA) in case it is a 1 or 2-byte instruction.A BRKopcode ($00) is placed into the user pro-gram in place of the original instruction's op-code (other instruction bytes are not altered).The next 3 bytes of the BTE will contain a JMP

instruction back to the next user-program inst-ruction.

If the original instruction was a RelativeBranch, one more thing must be considered: ifwe remove the relative branch to the BTE, howwill it branch correctly? This problem is sol-ved by installing another JMP instruction intothe BTE for a relative branch--back to the Tar-get of the branch, which is computed by addingthe original PC of the branch, +2, +offset.

This Absolute address will be placed into theJMP at bytes 7-9 of the BTE. The offset whichwas copied from the original instruction will bechanged to $04 so that it will now branch tothat second JMP instruction within the BTE; theJMP will get us to the intended target of theoriginal Relative Branch.

A call to the routine "INSDS2n in the Monitorreturns the length and type of an instructionfor the "add" function. The opcode is suppliedin the AC, and LENGTH& FORMATare set approp-riately by the routine.

Removal of a breakpoint involves simply rest-oring the original opcode, and clearing the

LOCTABo free this breakpoint's BTE.

Displaying of breakpoints prints the user-prog-ram address of a breakpoint, followed by theaddress of the BTE associated with the break-point (the BTE address is useful--its importancewill be described later).

When the breakpoint is executed, a BRKoccursand the APPLEMonitor gets control. The monitorwill "beep" and print the user program's regis-ters. During printing of the registers, BREAKERwill take control via the COUTexit. (Remember,we get control on every character printed - butit's only important when the registers are beingprinted. That's when we're at a breakpoint).While it has control, BREAKERwill grab theuser-program's PC and save it (we must subtract2 because of the action of the BRKinstruction).If no breakpoint exists at this PC (we scan LOC-TAB), then the Mointor is continued. If a

breakpoint does exist here, then the BTE ad-dress is set as the "continue PC". In otherwords, when we continue the user program after"

the break, we will go to the BTE; the originalinstruction will now be executed, and we willbranch back to the rest of the user program.

Using BREAKER

The first thing to do is to load BREAKERntohigh memory. It must then be initialized viaentry at the start address. This sets up theexits from the Monitor. After a Reset, you mustre-initialize via "YcI" to set up the COUTexit

Page 8: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 8/60

again. Upon entry at the start address, all

breakpoints are cleared; after "YcI", they re-

main in effect.

To add a breakpoint, type: aaaaYcA. (Yc is

control-Y). This will add a breakpoint ataddress 'aaaa' in the user program. A' beep'indicates an error; you already have a break-point at that address. To remove a breakpoint,type: aaaaYcR. This will remove the breakpointat address 'aaaa' and restore the original op-

code. A 'beep' means that there was none thereto start with .

Run your user-program via the Monitor's "G" com-

mand. Upon hitting a breakpoint, you will getthe registers printed, and control will go backto the monitor as it does normally. At thispoint, all regular Monitor commands are valid,including "YcA", "YcR", and "YcD" for BREAKER.

To continue execut.ion (after looking at stuffmaybe modifying some things), type: fCG. Thisinstructs BREAKERo resume execution at the BTE(to execute the original instruction), then to

transfer control back to the user program. Do

not resume via Monitor "G" command--it won'twork croperly, since the monitor knows nothing

of breakpoints. To display all breakpoints,type: YcD. This will give a display of up to 8

breakpoints, with the address of the associatedBTE for each one.

Caveats

Some care must be taken when using BREAKERodebug a program. First, there is the case ofBREAKERnot being initialized when you run theuser program. . This isn't a problem when youstart, because you'll not be able to use the Yccommands. But if you should hit Reset duringtesting, you must re-activate via "YcI" ,otherwise BREAKERwon't get control on a break-point. If you try a YcG, unpredictable thingswill happen. If you know that you hit a break-point while BREAKERwas not active, you canrecover. Simply do a "YcI", and then displaythe br-eakpoLnt.s (YcD). Resume the user-pro-

gram by issuing a Monitor "G" command to the BTEfor the breakpoint that was hit (since BREAKERwasn't around when you hit the breakpoint, you

have to manually resume execution at theBTE). Now all is back to normal. You can tell

if BREAKER is active by displaying loc-ations $38 and $39. If not active, they w11l

contain $FO FD.

It's also important to note that any user pro-

gram which makes use of either the Control-Y orCOUTexits can't be debugged with BREAKER. Oncethese exits are changed, BREAKERwon't get con-

trol when it's supposed to.

BREAKERDEBUGGER: Routines to Handle up to 8Breakpoints, for use in Debugging of User Code.

***** A PP L E- 2 M ON I TO R EQUA T ES

0 0 2 E1 ' l 1 ' l 2 F

1 ' l 1 i l 3 C1 ' l 0 3 D1 ' l 0 3 E1 i l 0 3 F1 i l040

iHI41

F O R M A T

L E N G T HA I LAI HA 2 LA 2 HA3 LA3 H

E OUE OUE CUEC UEQU

EO UE QU

E CU

EQU

f QU

*0 1 ' l 3 6

0 0 3 7

C S W L

C S W H*

F 8 8 EF 9 4 0F D D AF D E DF F 6 , )F F 6 9

I N S D S 2P R N T Y XP R P Y T EC O U TR E S E T

E QUEQUEC UE CUE QUE OU

*

X ' 2 E 'X ' 2 F 'X ' 3 C 'X ' 3 D '

X ' 3 E 'X ' 3 F 'X ' 4 0 'X ' 41'

I NS T RU C TI ON FO R MA TI N ST R UC TI O N LE NG T HW OR K AR E A

X ' 3 6 '

X ' 3 7 '

C OU T S W IT C H WO R D

X ' F 8 8 E '

X ' F 9 4 0 'X ' F D DA 'X ' F D E D 'X ' F F 6 5 'X ' F F 6 9 '

D I S A S S E M E L E RP RI N T Y / X RE G S I N HE XP RI N T ' :' CI N HE XC HA R O U TM O NI T OR RE S ETH O Nn O R EN T RY

* C H AN GE 'L O ~P ': ' GE ' r o L OC AT E* E LS E WH E RE I N r E MC RY . IT I S* N OW S E T FO R rl 3 2 K SY S TE M.

*tHhhHHJ7C

7CiHl

7D 0 0 4C 36 7 F

L O l " P A G E EO UO RG

H;'IT J MP

*

X'7C'LOV 7PACE** 8

I N ! T X

3 PGS F E FO RE E ND M EM O RYO RG OU T T O M EM O RY T O Ps)I NI TI A LI ZAT IO N EN T RY

* --- r A TA AP E ': ' S **

7 D I ' l 37 D 0 47D 0 :5

7D~ 6

F W IF~ :2

PC LP CB

*

D CD CD CD C

, F I NI : : PC ' \ 'i O R K E Y T E I

' F IN DP C ' WO R K B Y TE 2

' G O' PC L O' G O' P C HI

** S K E L E T O N B R E A K - T A E L E EN T RY (ET E ) **

*7D07 Iillil S K E L D C 0 S K E L E T O N P T E

70e8 N O P N OP S F OR P A D D I N G ""A7 C 1 i l 9 EA N O P- /DI1A 4C 0 0 0 0 J!· 1P 0 J m ' p BACK I N L I N E

7D I' l D 4C DC X ' 4 C ' J m l p OP CO D E F O R B R A N C H E : : ;

*

~~@JC3(!) 7 : 6

Page 9: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 9/60

** -- L O A D D R E S S O F B T E ' S K E P T I N A D T A B -- **

7 D 0 E 2 6 A D T A B D C B T E I i l &2 5 5 L O A D D R E S S'l ' 7 D 0 F 3 2 D C B T E l &2 5 5

1 D U 3 E D C B T E 2 & 2 5 5gDll 4 A D C E T E 3 & 2 5 57 0 1 2 5 6 D C B T E 4 & 2 5 51 0 1 3 6 2 D C B T E 5 & 2 5 51 0 1 4 6 E D C B T E 6 & 2 5 51 0 1 5 ' 7 A D C B T E 7 & 2 5 5

*** L O C T A B C O N T A I N S A D D R E S S O F U S E R - P R O G R A M I N S T R U C T I O N* W H E R E W E P L A C E D T H E B R E A K P O I N T I N T H E F I R S T P L A C E .*

1 0 1 6 L O C T A B D S 2 *8 S P A C E F O R 1 6 P C H / L P A I R S*** -- B R E A K - T A B L E E N T R I E S { B T E ' S ) --- **

1 0 2 6 B T E i (J OS 1 2 1 2- BY T ES R ES ER VE D1 0 3 2 B T E I OS 1 21 0 3 E B T E 2 OS 1 2g D 4 A B T E 3 OS 1 27 0 5 6 B T E 4 OS 1 27 0 6 2 B T E 5 OS 1 2' 1 D 6 E B T E 6 DS 1 27 D ' 1 A B T E 7 DS 1 2 E N O U G H F O R 8 B R E A K P O I N T S

** E N D O F D A T A A R E A S* T H E R E S T I S R O M - A B L E .

*

****************************************************************** N A M E : F I N D P C* P U R P O S E : C H E C K I F P C I N F W 1 / F W 2 " l A T C H E S A N Y I N L O C T A B* R E T U R N S : C A R R Y SET I F Y ES ; X R EG zA DT AE I N D E X 0 - 1* C A R R Y C L R I F N OT ; X RE Ga :G AR BA GE* V OL AT IL E : DE ST RO YS A C*****************************************************************

1CB6 A 2 0 F F I N D P C L D X l f . ' 1 5 P , Y T E - H ' D E X T O E N D O F T A B L E7 D 8 8 ..10 0 4 7 D F P C 0 0 L D A F ~' ;2 G E T F O F : c m ' P A R E

nSF C D 1 6 7 C C ~ I P X L O C T A E A P C R , . . A T C H ?n 8 E D 0 0 8 P N E F P C 0 2 =>NO. T R Y N E X T 2 - P Y T E E N T R Y7 D 9 0 A D 0 3 7 D L O A F W 1 G E T P C L NO\' I

7 0 9 3 D D 1 ' ) 1 D C M P X L O C T A E - 1 A P C L ~l A T C H ?7 0 9 6 F kl 0 6 E E C F P C k l 4 =>Y E S ! W E H A V E A B R E A K P O I N T !1 D 9 8 C A F F C 0 2 D E X P A C K U F O N EJ e 9 9

, . , .D E X A N D A N O T H E R-.-I

7 C 9 A 1 0 E C E P L F F C 0 0 =)00 E N T I R E T A B L E S C A N1 0 9 C 1 8 C L C z > D O N E ; S C A N F A I L E D7 C 9 D 6 k l RTS

*7 C 9 E 4 8 F P C 0 4 P H A H O L D AC

7 D 9 F 8A r X A H A L V E V A L U E I N X R E G7 D A i ( J 4 . : - L S R A S I N C E IT'S 2 - E Y T E I N D E X7 0 A 1 A A T A X7 D A 2 6 8 P L A7 C A 3 3 8 S E C S E T ' S U C C E S S '7 D A 4 60 R T S

****************************************************************** N A P E :* P U R P O S E :* N O T E ·****

E R E A KH A N D L E E N T F Y A T E R K A N D P R O C E S S B R E A K P O I N T ST H I S R O U T I N E G E r S E N T E R E D O N *E V E R Y * ' c o u r 'C A j_, L - - I T x ro v s " P O U T ! 3 R K P E C A U S E T H E r t O N I T O R ' SR E G I S r E R S A r E S E T U P T O P R I N T U S E R R E G C O N T E N T S .A F T E R P R O C E S S I N C I S C O N E , I T R E S T O R E S THE M O N I T O R ' SR E C S A N D R E T U R N S .

*****************************************************************E0 F P PREAK

C k : ln

C P X H '

E N E

X ' F E '

P R K X X

IS XFEG S E T F O R E X A ~' I N E - R E G S ?

- >N O G E T o u r N O K .

Page 10: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 10/60

7 D A 9 C 9 . 1 0 B R K 0 2 C M P I M X ' A 0 ' I S A C S E T U P C O R R E C T L Y T O O ?7 D A B D 0 2 3 B N E B R K X X =>N O P E . F A LS E A L A Rl o' !1 D A D A S 3 C L D A Z A l L G E T U S E R P C L7 D A F 3 8 S E C A N D B A C K 1 ' 1'U P

~

7 D B 0 E 9 0 2 S E c n T 2 E Y 2 B Y T E S S I N C E7 C B 2 8 D 0 3 7 D S T A nn B R K B U M P E D I T !' 7 D B S A S 3 D L D A Z A I R G E T P C H7 D B 7 E 9 0 0 S B C I I ' ! 0 D O T H E C A R R Y7 D B 9 8 D 0 4 7 D S T A F W 2 A N D S A V E T H A T T O O7 D B C 2 0 8 6 7 D J S R F I N D P C A E R E A K E R O F O U R S H E R E ?

J D B F 9 0 0 B B C C B R K 0 4 =>NOPE. K E W O N ' T H A N D L E I T !7 D C l B D 0 E 7 D L D A X A D T A B Y E S ; G E T B T E A D D R E S S T H E t ' :7 D C 4 8 D 0 5 7 D S T A P C L A N D S E T I T A S T H E ' G O '7 D C 7 . 1 9 7 D L D A H " L O \' ;' P A G E P C F O R T H E ' G O ' c m ~M A N D .7 D C 9 8 D 0 6 7 D S T A P C H {OUR P A G E F O R B T E ' S )

*7 D C C . 19 . 10 B R K 0 4 L D A I M X'A0 ' S E T AC E A C K F O R M O N I T O R7 D C E A 2 F B L D X I M ' X ' F B ' A N D X R E G T O O7 D D 0 4 C F 0 F D B R K X X J M P X ' F D F 0 ' =)NO. R I G H T BACK T O C O U T R O U T I N E !

1 D D 37 D D 6' 7 D D 87 D D B7 D D D

A D 1 I l 5 7 D8 5 3 CA D 0 6 7 D8 5 3 D4 C B 9 F E

7 D E 0

7 D E 2

7 D E 37 D E 6

7 D E 87 D E A7 D E B7 D E E

. 1 2 F F

E 8

B D 0 0 0 2C 9 9 9D 0 F 8E 8B D 0 0 1 I l 2

C 9 C 7

7 D F 07 D F 2

7 D F 4

7 D F 6" l D F 87 D F A7 D F C7 D F E

7 E~""7 E I I l 2

F 0 B lC 9 C lF 0 1 8

C 9 C 4F 0 I I l BC 9 D 2F 0 0 . 1C 9 C 9

F 0 0 94 C 6 5 F F

7 E 0 57 E I t l 87 E I t l B

4 C . 1 8 7 E4 C 1 t l 8" I F4 C 4 F ' I F

*****************************************************************

*** P R O C E S S T H E ' G O ' C O M M A N D (R E S U M E U S E R E X E C U T I O N ) *** C O M M A N D F O R M A T : { * Y c G )

*****************************************************************C M D G O P C L

A l LP C HA I HX ' F E B 9 '

L D AS T A Z

L D AS T A ZJ M P

G E T R E s m ~E P C LA N D S E T U P F O R M O N I T O R

T O S I M U L A T E A N ' X X X X G ' C O M M A N DN O R M . A L L Y .

- >S A I L I N T O M O N I T O R ' S ' G O '

******************************************************************* W E G E T C O N T R O L H E R E O N T H E C O N T R O L - Y U S E R E X I T F R O M T H E* M O N I T O R (O N K E Y I N S ). A L L C O M M A N D S A R E S C A N N E D H E R E ;* C O N T R O L W I L L PASS T O T H E A P P R O P R I A T E R O U T I N E .*****************************************************************K E Y I N L D X I M

K E Y I N I t l I t l I N X

L D A XC f ' ! P D 1B N EI N XL D A X

C M P I M

X ' F F ' C H A R I N D E X

S E T N E X T C H A R A C T E R

G E T C H A R F R O M K E Y I N E U F F E RC ON TR OL - Y C HA RA CT E R?- >N O . K E E P S C A N N I N GB m l P O V E R C T L - YG R A E C O M M A N D C H A R A C T E RI S I T ' G ' {G O } ?

X ' 1 t l 2 0 0 'X ' 9 9 'K E Y I N I I J I I J

X ' I I J 2 1 1 J I t l 'X ' C 7 '

** rl B R A N C H - T A B L E I ' J O U L D B E

* N E A T E R , B U T I T W O U L D* T A K E U P r ~O R E C O D E F O R* T H E F E W O P T I O N S W E H A V E .

*

E A D C M D

B E QC M P I M

B E Q

O : P H lB E QO ' P I MB E QC M P I t - '

B E QJ I ' l P

cnccoX ' C l 'C M D A D D

X ' C 4 'X X D I S PX ' D 2 'X X R E r - ~ O V EX ' C 9 '

X X I N I TR E S E ' T

" ) Y F S .I S I T 'A' {A D D } ?

- ) Y E S .

I S I T 'e' { D I S P L A Y ) ?=)YES.

I S I T 'P' (R E r O V E ) ?" ' ) Y E S .I S I T ' I ' {I N I I ' } ?

=)YES.N O T H I N G ; I G N O R E I T !

*X X D I S P J I ~PX XP Er -m VE J ~' Pxxrnr I' J I 1 P

C M D D I S PC ~ : D R E M O VC M C I N I T

E X T E N D E D E ' P r i N C EE X T E ND E D E P A N C HE X T El - ' DE D B P A NC H

Page 11: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 11/60

)

7 E I ! ! E7 E 1 0

7 E 1 2

7 E 1 47 E 1 67£19!FIP

7 E 1£

7 E 2 07 E 2 17 E 2 2

7 E 2 4

7 E 2 67 E 2 87 E 2 P7 E 2 E7£307 E 3 3

7 E 3 67 E 3 77 E 3 87 E 3 97 E 3 E7 E 3 07 E 4 07 E 4 27 E 4 4

7 E 4 77 E 4 97 E 4 A

7 E 4 C7 E ' 4 07 E 4 fn'Sl

7£547£'S6

7E~87 E 5 A

nSE

7 E ')[7 E ')F- I E 6 1- I E 6 2

7 E 6 4

AO 0 0

PI 3 E

F 0 E E

A2

0 FE D 1 6 -/D

C~ 0)

PO 15 7 0

F 0 0 6CAC A1 0 F 2

3 0 D C

_A 5 3 E

9 D 15 7 08 D 0 E 7 DA5 3 F9 0 16 7 e8 D ec 7C

8 A4AAA

A9 7 D8 5 4 1E D 0 E 7 D8 ') 4 0

AI:l07B 9 0 7 7 D

9 1 4 08 81 0 F 8

C 8E l 3£9 1 4 02 0 8 E F 8

A9 ~109 1 3 EA :; 2 F3 8

rltJ04n 40

9 1 4~C 8P1 4t1

6 9 ~0

*****************************************************************

**

**

*

P R O C E S S T H E ' A D D ' C O~M A N D . . A D D A P R E A K P O I N T A I 'L O C A T I O N S P E C I F I E D I N C O~M A N OC O M~A N D f O R M A T : ( * dddd Y c A )

C~' C ';D D*****************************************************************

L C Y H~

L D A I Y

P E O**

I)

A 2 LE;>'Dom

C P E C K O P C O D E F I R S TO P ;>'1 ';A A A .; B R K A L R E AD Y?=)YE S . I L L E G A L !

S C A N L o c r ' ;B F O P A N A V A I L A C L E B r E T O U S E - - - *

15L O C T A P' : ' C C 0 2L O C T A P - l

A c r 0 4

E Y T E I N D E X T O L O C T A E E N DG E r , : ,E Y T E=)IN U S EG E r H I H A L F

=) EO T H ZE R O; U S E I T !r ' O V E P A C K T ON E X T L O C T A B E N T R Y

A N D K E E P T R Y I N G !

=)OO N E? AL L F U L L ! R E J E C T I·".

*

':'CNJ 2

L D X H 'L D ';XBt-!E

L D A X

P E OD E XD E X

E P LprE

, : , c e l : l 0

E A D c r·~D

A 2 LL O C T ' : ' P - lS K E L+ 4A 2 t lL O C T ' : ' BS K E L+ 5

G E T dddd V A L U ES A V E L a H A L FS T U F F L a A D D R I N T O E T EG E T dddd V A L U ES A V E H I H A L E 'S T U F F H I A D O R I N T O E r E

G R A B I N D E X F O R L O C T A BM A K E A O T A S I N D E XA N D S T U F F R A C K I N T O X R E F

B T E ' S H I ' : ' C C R E S S V A L U EH O L D I N W O R K A R E AG E T E T E L a A C D R F R m : A D T A BS A V E I N W O R K A R E ' : '

7 - E Y T E M O V E F O R S K E L B T EG F T S K E L p y r E

~' O V E T O E ' T ES E T N E X T=) MO V E E N T I R E S K E L E T O N

*riC00 4 L D AZ

S I ' A XS I 'AL O AZS T A XST r l

T X AL S R AT A XL O A H ,

S T AZL D ' : ' XS T r iZL D Y H 'L D ' : ' Y

S I ' ' : ' I YC E YF P L

I N YL D A I YS T ' : ' I YJ S R

L e A H 'S T A I YL D ' : 'Z

L O I " ' P A G Er i 3 HADT;>'P

A 3 L7

: : : K E L.;3L

A 2 LA 3 LI N S D S 2

eA 2 LL E N C I ' P

G E T O R I G I N A L O P C O C EI N T O F T E

I N S C S 2 (TO D I S A~S E M B L E)

S E T B E K O P C O D EO V E R O R I G I N A L O P C O C E

G E T I N S T R U C T I O N L E N G T H

';C D 0 6

t ;EC

** S E T U P J f P r o N E X T I N s r . I N T H E e T E - - - *

*L D Y H :A c e r Y

S T ' : ' I YI N YL D A I YA D C I M

4' : ' 3 Lr l 3 L

A D D I ' D P C F O R C E s r I N A T I O Ns rur r m ro ers

' : ' 3 Ltl

R U N U P r H E C A R R YP I e p r H E R E

*****************************************************************

* C I S F L A Y riLL A C T I V E QR E AK P O I N TS* c m T ' : ' l ' : D f O W A 1': (* Y c C )*****************************************************************

7 E ' r l R .;2 ~F U ' O C I :;F LDYHl 1 5 H 1 C E X T O L O C T A P . E N Di E ';A rc 1 6 7 C C I 8 P~h] L C ' : ' X i.cc r.,r G E T ,:, P Y T E7 f A C Dl~ ~ , p E}'E C·I~p I : l 4 =)IN U S E7 E ';f F C b7 ' 2 L C ';X L O C : ' A E - l T R Y P O T H E Y T E S T O F E : : : U R El E P 2 D.1 ~16 E n E r I S P 0 4 =) CE f I N I T E L Y I N U S E .-; EP . 4 C A r;I S H' X T t E ' X S E T N E X T E N T R Y" lEP:_ ' CA [\E' X I N L O C T ': ' P7 E P . 6 1 1 ~ F 2 PP L D I S P~0 =) ro P E ' T O G OncB 3 ~1 (;7 errI CI'eREI' = )[0' E.- E X I I' T O ~' O N I T O R

*

~ ~ ~ ~C ! ) 7:9

Page 12: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 12/60

7 E B A

7 E E B7 E B C7 E BF

7 E C 27 E C 47 E C 67 E C 7

7 E C A7 E C C7 E C F7 E D 0

7 E D 17 E D 27 E D 37 E D 57 E D 87 E D A7 E D C7 E D F

7 E E 27 E E 4

7 E E 7

7 E E 9

8 0 ' 1

4 8B C 1 6 7 DBD 1 5 7D

8 4 3 B8 5 3 0 ' 10 ' 1 0 ' 12 1 -14 k l F 9A9 0 ' 1 1 - 12 1 - 1E D F D

6 84 8

4 AA AA 9 B C2~ J E D F D

0 ' 1 9 7 D8 5 3 F2 0 D A F DBD 0 E 7 0

8 5 3 E2 1 - 1D A F D

A 9 B E2 0 E D F D

D I S P 0 4 I ' X A

P H AL D Y XL D A X

S I ' YZS T AZT A X

J S RL D A I MJ S RP L AP E A

L S R AT A XL D A I MJ S RL D A I MSTAZ

J S RL D A XS I ' AZJ S HL D A I r - ' f

J S H

L O C T A SL C C T A B - lX ' 3 B 'X ' 3 A '

G E T I N D E X

S A V E I TG E T S U B J E C T - I N S T P C EAND I T S P C L

S E T U P P C H / P C L F O RD IS AS SE ~~B LE R . ..

7 E E C7 E E E7 E F 17 E F 37 E F 5

7 E F 87 E F A7 E F D7 F 0 07 F 0 17 F 0 2

A9 . ' I e2 0 E D F D. ' I e 0 0B 1 3 E2 0 D A F D8 1 3 E2 k l 8 E F 82 0 1 - 1 47 F6 8A A1 0 B 0

*

P R N T Y X

X ' A0'C O U T

P R I N T Y , X B Y T E S I N H E XP R I N T O N ES P A C E H E R E

R E S T O R E I N D E X

C O N V E R T T O A C T A S I N E X

X ' B C 'C O U TL O l ' l P A G EA 2 HP R B Y T EA D T A SA 2 LP R E Y T EX ' B E '

C O U T

'<' C H A R A C T E RP R I N T I T

E T E H I A D D R E S SS E T I N D I R E C T P O I N T E RP R I N T H E X E Y T EG E T E T E L O r i D D RS E T I N D I R E C T P O I N T E RP R I N T B T E F U L L A D D R E S S' )' C fI AP ~C TE R

P R I N T I T

7 F 0 4

7 F 0 5

4 8

4 C D 9 F 8

* D I S A S S E M B L E T H E O R I G I N A L I N S T R U C T I O N . P I C K U P* O R I G I N A L O P C O D E F R O~ 8 T E , O R I G I N A L A D D R E S S* F I E L D F R O M U S E R P R O G R A / 1 L O C A T I O N .

*L D A I~J S RL D Y I r -<L D A I YJ S F~L D A I YJ S F tJ S RPkl,

T A XE P r ,

**----------_._-

X ' A 0 'C O U TeA 2 LPREYTE

A 2 LI N S D S 2J S R K L U G E

P R I N T O N ES P A C E H E R E

I N D E XG E T O P C O D E F R O M P T EP R I N T O P C O D EG E T O P C O D E F R O ~ E T EA N D ct r F O R~ 'r l T/ LE N G. rI - '

S N E A K I N T O I N s r s p @ F 8 r 9

D I S P N X TR E S T O R E L O C T A C I~D E X=) DI S P L A Y I ' H E R E S I ' !

* K L U G E E N T R Y I N I ' O S U B R O U T I N E

* W H I C H F O B C E S J S R P R I O R T O* A P E A I N S T R U C T I O N . W E H A V E

* T O J S R T O T H I S J M P !

*J S R K L U G E P H A

J r , " p X ' F 8 D 9 '******** END O F K L U G E ! *****

F U S H ~N E P O N I C I N D E XC O N T I N U E ~I T B I N S T D S F

*****************************************************************

* R EI -l OV E A B RE AK PO IN T ri T L O C X~' I O N aadd

* c m~/ ' : r l N D F O Rf':rl l': ( aada Y o;;R )

*****************************************************************

7 F 0 8 A 5 3 E C M D R H 1 0 V L D AZ A 2 L G E T A C[ , R E S S L C7 F i J A 8 0 0 3 7 0 S T A F W 1 H O L D I T fOR F I N C P C . '

7 F 0 0 A5 3 F L D AZ A 2 H G E T " C C R E S S H I

- ' F 0 F 8 D 0 4 7 D S I'A F l ' i 27 F l 2 2 0 8 6 7 D J S R F I N D P C A E RE ;;f (P CI NT f : E F E?-,F 15 E 0 IB E C S R E r - 1 0 V 0 2 =)YE S

7 F 1 " I 4 C 6 5 F F J I ' P R E S E r =)NO : P E L L F O R Y O l l !

*7 F 1A EO 0 E 7[; R E I - ' O V 0 2 L D A X A D T A E G E T T P£ L O C T A I : ' E N ! R Y

"IF 1 0 85 4 0 S T AZ A 3 L H O L C I T7 F l F 8A r X A Nm: C R f A T E LCc:r,:,[' I N C E X

7 F 2 1 - 1 I : l A A S L r i

7 F 2 1 AA T A X .:~

7 F 2 2 A 9 0 0 L D r i I r - ' I : l C L E A R O U T I'p.£

H 2 4 A8 I ' A Y A F P r O P R I A T E

7 F 2 5 9 D 1 6 7 0 S T A X L O C T A P L O C T r l P E N T R Y7 F 2 8 90 1 7 ·'0 SI'AX L O C T A B +1 F O P T i n s E K P : '

~~~~!!) 7:10

Page 13: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 13/60

7 F 2 E A 9 70 L D A l l ' ! L O P P A G E H I A D D R F O R B T E7 F 2 D 85 4 1 S - I ' A A3H H O L D F O R A D D R E S S I N G7 F 2 F E l 4 0 L D A I Y A 3 L G E T O P C O D E O U T O F [H E7 F 3 1 9 1 3 E STAIY .; 2L A N D P U T B A C K H i r e O R I G I N A L I N ~r

- ) 7 F 3 3 4 C 6 9 F F J I " P r - 1 0 N =)ALL D O N E .

*****************************************************************

* I N I T I A L I ZA T I O N C O D E . E N T E R E D -" START AD D R T O I N I T I A L I Z E .l~

* I I 'C L E A R S L O C1 ' A P , S E T S U P T H E Y c A N D ' C O U T ' E X I T S .

** A F T E R E V E R Y ' R E S E T ' , ~WST R E S E T U P \ ' , I 1 ' H* Y c I*****************************************************************

7 F 3 6 A 9 4 C I K ' l T X r 4 D A n ~ x ' 4C ' J M P O P C O DE7 F 3 8 8 D F 8 0 3 STA X ' 3 F 8 ' S T U F F I N Y c E X I T L O C7 F 3 8 A 9 7C L D A I M K E Y I N / 2 5 6 K E Y l N : P I A D D R E S S7 F 3 D 8 0 FA 0 3 S ' T " X ' 3 F A ' S T U F F I N T O Jr·~prl

7 F 4 t : ' A 9 E 0 L D A n ! K E Y I N&X ' F F ' K E Y I N : 10 A D D R E S S7 F 4 2 8 D F 9 0 3 S " ' X ' 3 F 9 ' S T U F F I N T O J M P " , D D R E S Srl

7 F 4 , ) A 9 0 0 L D A I M 1 0

7 F 4 7 A 2 -1 1 F i .ox r r 1') I N D E X 1'0 L O C 1 ' A 8 E N D7 F 4 9 9 D 1 6 7D I N I I ' 0 0 S T A X L O C T A B C L E A R I I ' OU T7 F 4 C C A DE X S O T B E R E A R E7 F 4 D a F A EF L I N I I ' 0 ~ N O E RE AK PO IN TS

** E N T ER H E R E A F TE R H I T T I N G ' R E S E T' K E Y , P L E A S E ---

**7 F 4 F A9 A 5 C ~~D I N I ' I ' LD A H l E R E A K&2 5 5 E R E A K : LO A D D R E S S7 F 5 1 8 5 3 6 STAZ CS\~ L S T U F F I N T O ' C O U T ' E X I T H O O K7 F 5 3 A 9 7 D L D r l H ~ C R E A K / 2 5 6 B R E A K : H I A D D R E S S7 F 5 5 8 5 3 7 S T A Z CS\\ H S T U F F I N T O ' C O U T ' E X I T H O O K7 F 5 7 4 C 69 F F J I - ' P peN I N I T D O N E ; e A C K 1'0 ~'ON.

E N D

T a b l e 1 - B RE AK ER C om ma nd S um ma ryL i s ti n g 1 - B R E AK E R Pr o g r am f o r A pp l e I I

Co m m a nd F u n c ti o nN ot e s o n h o w t o r e a d t he a s s e mb l e r li s t in g :

a aa a Yc A

Y c D

Ad d b r ea k p o in t at l o c at i o n aa a a .W on ' t a ll o w y ou t o a dd o n e ov e r

a n a lre ad y ex is ti ng b re akp oi nt .M a x im u m of 8 b re ak po in ts a ll ow ed .

D is pl ay a ll b re ak po in ts .

I n it i a l iz e a ft e r R E S E T k ey . Ju s ts e t s u p ' CO U T ' e x it a ga i n w it h o utr es et ti ng a ny b re ak po in ts .

A fe w of t h e s yn t a x e x p re s s io n s a ll o w e d b y m y

t ime -s har in g cr os s as se mb le r m ay a pp ear cr yp tic .H e re ' s a k e y t o t h ei r m ea n i ng s :

1. Al l H EX nu m b er s a p p ea r as X ' r at h e r t h a n $e x p r e s s i o n s .

Y c I2 . T he a mp er sa nd (&) m e a ns l og i c al "A N D " th u s :

K E Y I N& X' F F '

aa a a Y c R R emo ve br ea kp oi nt f ro m lo ca ti onaa a a . R e s to r e s o r i gi n a l o p c o de .

r e so l v e s t o t h e l o w- o r de r 8 b i t s o f t h e K EY I Na d d r e s s .

j

At $190 for 16K, NOBODY can beat us!

CONTACT

G E T sorns ( O R E

F O R

Y O U R A P P L E

F ul l i ns tr uc ti on s i nc lu de d.

Now there's no excuse.

M ic ro pr oc es so r C om po ne nt S pe ci al is t70 West Fairview

Springfield, IL 62707

217/529-2992

Page 14: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 14/60

MOS 16K R A M rOR TH£ A P P L £ II

Allen Watson III430 Lakeview Way

Redwood City, CA 94062

MO S 1 6K d y na mi c R AM i s ge t ti ng c he a pe r. At t h et im e o f th is wr i ti n g, on e ma i l- or d er h o us e i sof fe r in g 16 K by t es o f R AM (e i gh t d e vi c es ) f or$1 20 . A p pl e I I o w ne r s c an n ow e n ha nc e th ei rs y st em s f o r l e ss t ha n t h e Ap p le d ea le r s' p ri c e.H o we ve r , th er e i s a po te n ti a l d ra wb a ck t o t h e

p u rc ha s e o f yo ur o wn 1 6K R AM ch ip s : s p ee d . Yo um ay w o nd er w hy , s in ce t h e A pp l e' s 6 5 02 CP U i sru n ni ng a t o nl y ab ou t 1 M H z, b u t th i ng s ar en ' tqu it e th at si mp le.

To be gi n wi t h, t he Ap pl e II co nt i nu a ll y re f re s h-es i ts vi de o d is p la y a nd d yn am i c R A M. It do esth is by sh a ri ng e ve r y c y cl e b et w ee n th e C PU an dth e r ef re s h ci rc u it r y, a h al f -c yc l e f o r e ac h.Th i s me a ns th at th e R A M i s be in g ac c es s ed a t a2 MH z ra t e.

Th a t do es n 't so u nd t oo fa s t, wi t h th e s lo w es t16 K p a rt s ra te d a t 3 00 n s a c ce ss ti m e; b u t yo uha ve t o r em em b er th a t t h e RA M c hi ps a r e l6 -p i npa rt s by v i rt ue o f a m ul t ip le x ed a d dr e ss bu s.Th er e a re t wo a dd re ss- str ob e si gn als d ur ing e ac hm em o ry ac ce s s c yc l e, an d t he a cc es s -t i me s pe c if -ic at i on wi l l b e me t o nl y i f t h e de l ay b et w ee n

th ese st rob e s ign al s is w it hin sp ec ifi ed l imi ts.In th e Ap p le II th i s d el ay i s l 4 0n s, w h ic h i sto o l on g. F ur th e rm or e , t h e A pp le II t im i ngd oe sn ' t a ll o w l o ng e no u gh R A S p r ec h ar ge o r ro w-ad d re ss h o ld ti m e f o r th e s lo w pa r ts . J ud g-i ng by t he sp ec s he e ts , 2 00 ns pa r ts a re pr ef e r-ab l e t o 2 50 ns pa r ts , a nd 3 0 0n s p ar t s sh ou l dn 'tbe us ed at al l . In m y A p pl e, 3 00 ns p a rt s ca u se da z er o t o t ur n i n to a o n e o nc e in a wh il e .

M an y m ai l- o rd e r ho u se s d o no t me n ti on d ev ic es pe e ds in t he i r ad s . T he be s t th in g to d o is t ode al o n ly w i th t h os e s up pl i er s w ho s pe c if ys pe e ds , b ut fo r t h os e wh o d i dn 't , th e t ab leb el o w s ho w s t he co de s us e d by so m e 1 6K d yn am i cR AM ma n uf ac t ur e rs t o in di c at e th e sp e ed s o f

t he ir de v ic e s. Go od lu ck , a nd ca ve a t e mp t or !

S PE ED C OD ES U SE D B Y 1 6 K D YN A MI C R AM MA N UF AC T UR ER S

A cc es s T im e ( ns)M a n u f a c t u r e r P a r t No . 15 0 2 0 0 2 5 0 3 00

A M D 9 0 1 6 -F - E -D - C

F a i r c h i l d F 1 6 K -2 - 3 - 4 - 5

I n t e l 2 1 1 7 -2 - 3 -4

MO S TE K 4 1 16 -2 - 3 -4

M o t o r o l a M C M 4 1 1 6 C -1 5 -2 0 -2 5 - 3 0N a t i o n a l M M 5 2 9 0 -2 -3 -4

N E C ) lD416 - 3 -2 -1

T I 4 1 1 6 -1 5 -2 0 -2 5

Z ilog Z 6166 -2 -3 -4

"

IMP R OVED STA R R A TTLE SOU~D ErrECTS

Will iam M. Shryock, Jr.P .O . Box 126

Williston, NO 58801

10 PO K E 0, 1 60 : P OK E 1, 1: P O KE2 ,1 62 : P O KE 3 ,0 : P OK E 4 ,1 3 8: PO K E 5 , 24 : PO KE 6, 23 3 : P OK E7 ,1 : PO KE 8 , 20 8 : P OK E 9 , 25 2: P O KE 1 0 ,1 41

2 0 PO K E 11 , 48 : P OK E 12 ,1 9 2: P OK E1 3, 2 32 : PO K E 14 ,2 2 4: PO K E 1 5,1 5 0: P OK E 16 , 20 8 : P OK E 1 7,2 42 : PO KE 1 8 ,1 3 6: PO KE 19 , 20 8: P O KE 2 0 ,2 37 : P O KE 21 ,9 6

3 0 CA L L -9 3 6: V TA B 1 2: TA B 9 : P RI NT"S TAR B AT TLE SO UN D E FF ECT S"

4 0 S HO TS= R N D (1 5)+15 0 LE N GT H= RN D (1 1 )·10 +12 06 0 PO K E 1, S HO T S: PO K E 15 ,L EN G TH :

CA L L 07 0 FO R D E LA Y=l T O R N D (1 0 00 ): N EX T

D E L A Y8 0 G OT O 40

T hi s ve r si on ca n b e us e d in l ow re s. p ro gr a msw i th o ut h a vi n g t o r e se t H I ME M. A l so it c an al lbe lo ad e d f ro m BA S IC . -~

Page 15: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 15/60

J

II"E T U P DA T E

Cary A. Creighton625 Orange Street, No. 43

New Haven, CT 06510

I a m w r i t i n g t h i s a r t i c l e b e c a u s e I ' m t i r e d o fs e e i n g t h e s a m e r e h a s h o f p s e u d o - f a c t s b e i n g r e -p e a t e d a b o u t t h e P E T . If I r e a d o n e m o r e t i m ea b o u t t h e s m a l l k e y b o a r d o r t h e R N D f u n c t i o n n o t

w or ki ng c or re ct ly . .. ! A s y o u w i l l s e e , t h e 2 0 0 1h a s a n e x t r e me l y w el l d e si g n e d I n t er p r et e r w h i chc a n b e u s e d e f f e c t i v e l y a s s u b r o u t i n e s e i t h e rf r o m t h e S Y S c o m m a n d , o r t h e U S R c o m m a n d . P a r -a m e t e r p a s s i n g w i l l b e r e v e a l e d a s a n e a s y o p e r -a t i o n a n d r e t u r n i n g U S R w i t h a v a l u e i s jus t a ss i m p l~. T h e R N D f u n c t i o n m a y b e s u b s t i t u t e dw i t h a t w e l v e b y t e U S R p r o g r a m t o m a k e i t c o m -p l e t e l y r a n d o m a n d n o n - r e p e a t i n g (a s i t s t a n d s ,i t r e p e a t s e v e r y 2 4 0 8 4 t i m e s t h r o u g h) a n d I w i l ls h o w t h e u s e o f n e g a t i v e a r g u m e n t s . U n f o r t u n -a t el y , R ND(O ) w as a pp a r e nt l y a . m i s - ca l c u la t i ono n M i c r o s o f t ' s p a r t . T h e y f ' L gu r - ed t h a t R O Me m p t y l o c a t i o n s w o u l d t u r n o u t t o b e m o r e r a n d o mt h a n t h e e n d p r o d uc t s h o w s . T h e y l o a d n o n - e x i s -t e n t m e m o r y l o c a t i o n s i n t o t h e R N D s t o r e a r e a(2 1 8 - 2 2 2) t h u s c a u s i n g a r e s u l t i n g R N D v a l u ew h ic h f l u c tu a t es b e t w e en a f e w d if f e re n t v al u e s.

W h e n R O M i s f i n a l l y i n s t a l l e d i n t h a t a r e a(3 6 9 3 2) t h e R N D(O) w i l l h a v e t h e d u b i o u s q u a l i t yo f b e i n g s o m e f i x e d n u m b e r .

R N D F U N C T I O N U S E

T h e R N D f u n c t i o n m a y b e s e t a t a n y t i m e t o e x e c -u t e a k n o w n s e r i e s o f R N D II's b y u s i n g a k n o w nn e g a t i v e a r g u m e n t jus t b e f o r e R N D w i t h a p o s i -t i v e o n e . T h e a b i l i t y t o h a v e a v a i l a b l e a k n o w nl i s t o f r a n d o m n u m b e r s i s v e r y i m p o r t a n t i n al o t o f s c i e n ce s .

1 0 R =R N D( -l )2 0 F O R X=l T O 53 0 P RI N T I N T( lO O O* RN D (l )+ l) ,4 0 N E X T X

G i v e s t h e s e q u e n c e : 7 3 6 , 3 5 5 , 7 4 8 , 1 6 6 , 6 2 9

S i n c e R N D( -l o w l l) g i v e s s u c h a s m a l l v a l u e , u s ea n e g a t i v e a r g u m e n t i n t h e r a n g e (- 1 E 1 0 t o -1E 3 0) it' y o u n e e d o n e r e p e a t a b l e R N D n u m b e r w i t ha u s e f u l v a l u e , e . g . , R N D(- l E 2 0)= .8 1 1 6 7 5 2 3 8 .

C o n c e r n i n g t h e t r u e r a n d o m n a t u r e o f R N D a n di t ' s a b i l i t y t o a c t r a n d o m l y a t a l l t i m e s; t i m em u s t b e c o m b i n e d w i t h R N D . T h i s i s p o s s i b l ew i t h a R A N D O M IZE s u b r o u t i n e o r f a s t e r s t i l l , r e -d O i n g R N D(+) w i t h a U S R r o u t i n e .

1 00 00 R EM ( RA ND OM IZE )1 00 10 R l=P EE K(5 14 ) R 2=P EE K(5 17 )1 0 0 2 0 P O K E 2 2 0 , R 1 : P O K E 2 2 1 , R 21 00 30 R ET UR N

T h i s r o u t i n e m a y b e u s e d a t p r o g r a m i n i t i a l i z a -t i o n a n d a s t h e p r o g r a m h a l t s f o r a n I N P U T . It

w i l l s t a r t a n e w s e q u e n c e o f R N D n u m b e r s w h e n -e ve r c al le d.

W h e n t h e c o m p u t e r d o e s a s e q u e n c e w i t h o u t i n t e r -v e n t i o n t h e f o l l o w i n g U S R p r o g r a m i s s u g g e s t e dw h i c h w i l l r e t u r n a t r u l y r a n d o m n u m b e r q u i c k l y;w it h ou t r ep e at in g .

1 0 R E M (T R U E R N D U S I N G U S R F U N C T I O N)2 0 P O K E 1 3 4 , 2 1 4 : P O K E 1 3 5 , 3 1 : C L R3 0 F O R X =81 5 0 T O 8 1 6 54 0 R E A D B Y T E : P O K E X . B Y T E

5 0 N E X T X6 0 D A T A 1 7 3 ,2 , 2 ,1 3 3 ,2 2 0, 1 7 3, 5 , 2, 1 3 3, 2 2 1, 7 66 5 D AT A 6 9, 22 3, 0, 0, 07 0 P O K E 1 " 2 1 4 : P O K E 2 , 3 1

M A C H IN E L AN G U AG E S T O R IN G I N B AS I C

W h e n u s i n g m a c h i n e l a n g u a g e , a l w a y s p r e c e d es t o r i n g b y s e t t i n g u p B A S I C ' s u p p e r b o u n d a r y .T h i s i s d o n e b y :

P O K E 1 3 4 , I T E M : P O K E 1 3 5 , P A G E : C L Re . g . P O K E 1 3 4 , 0 : P O K E 1 3 5 , 2 5 C L Rs e t s u p p e r b o u n d a r y t o 6 4 0 0 a n d B A S I C u s e w i l lb e c o n f i n e d t o 1 0 2 4 t o 6 3 9 9 u n l e s s r e s e t o rt ur ne d o ff .

Y o u c a n u s e t h e f o l l o w i n g p r o g r a m f o r s t o r i n gd e c i m a l . C h a n g i n g I N D E X t o 1 0 0 0 0 t o a p p r o p r i a t ep o s i t i o n a n d t y p i n g i n D A T A l i n e s i n 1 0 0 t o9 9 9 7 .

o R EM (" MA CH IN E S TO RE ")1 R E M W R I T T E N B Y G A R Y A . C R E I G H T O N , J U L Y 7 82 R E M ( S E T I N D E X =OR I G I N I N L I N E 1 0 0 0 0 )3:1 5 R E M F I X U P P E R S T R I N G B O U N D A R Y2 0 G O S U B 1 0 0 0 02 5 X =IN D E X / 2 5 63 0 P A GE =I N T( X)3 5 I TE M=(X -P AG E)* 2 564 0 P O K E 1 3 4 , I T E M4 5 P O K E 1 3 5 , P A G E5 0 C L R5 56 0 R E M L O A D M A C H I N E L A N G U A G E6 5 G O S U B 1 0 0 0 0 : L O C=IN D E X7 0 R E A D B Y T E : I F B Y T E<O T H E N E N D7 5 P O K E L O C , B Y T E8 0 L O C=L O C+l : G O T O 7 08 5 :9 0 R E M M A C H I N E L A N G U A G E D A T A1 0 0 D A T A

9 9 9 7 D A T A9 9 9 8 D A T A 0 , 0 , 0 ,- 19 9 9 91 00 00 I ND EX =(S TA RT O F M AC HI NE L AN GU AG E)1 00 10 R ET UR N

U SR P AR AM ET ER P AS SI NG

T h e f o l l o w i n g a r e p a r a m e t e r p a s s i n g r u l e s f o rt h e U S R f u n c t i o n a n d s h o u l d b e a d d e d t o t h e" MA CH IN E S TO RE " p ro gr am .

o R E M (" U S R(O T O 2 5 5)")4 6 P O K E 1 , I T E M4 8 P O K E 2 , P A G E1 0 0 R E M (U S R I N P U T 0 - 2 5 5; O U T P U T 0 - 2 5 5)1 1 0 D A T A 3 2 , 1 2 1 , 2 1 4 : R E M J S R 5 4 9 0 5

1 2 0 D A T A (Y o u r p r o g r a m u s i n g i n p u t v a l u e )

5 0 0 0 D A T A (S e t u p o u t p u t v a l u e i n A c c u m .)5 0 1 0 D A T A 7 6 , 2 4 5 , 2 1 4 : R E M J M P 5 5 0 2 91 00 0 0 I ND E X 6 4 0 0

Page 16: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 16/60

OR

o REM ("USR(O TO 65535)")46 POKE 1, ITEM48 POKE 2, PAGE100 REM (USR INPUT 0-65535;OUTPUT 0-65535)110 DATA 32,208,214 : REM JSR 54992

(Note: Check if 0-65535. RTS with:Y and M(8)= ITEMA and M(9)= PAGE

120 DATA (Your program using 2 byte passedv al u e)

5000 DATA (Setup output vlaue ITEM in Y;PAGE in A)

5010 DATA 132,178 REM STYZ 1785020 DATA 133,177 REM STAZ 1775030 DATA 162,144 REM LDXIM 1445040 DATA 56 REM S EC5050 DATA 76,27,219 : REM JMP 56091

(Setup output value and RTS)

OVER

o R EM (" SA VE M" )

100 REM ERAM=31 (or110 DATA 32,200,0120 DATA 208,3

1 30 D AT A 7 6, 15 8, 24 61 40 D AT A 3 2, 17 ,2 06

1 50 D AT A 3 2, 16 4, 20 41 60 D AT A 3 2, 20 8, 21 4170 DATA 132,247180 DATA 133,248190 DATA 170200 DATA 152210 DATA 208,1220 DATA 202230 DATA 136

240 DATA 132,80250 DATA 134,81260 DATA 169,173

270 DATA 133,79280 DATA 169,96

290 DATA 133,82300 DATA 32,200,0310 DATA 201,44320 DATA 208,3330 DATA 32,194,0340 DATA 32,51,244

350 DATA 230,80360 DATA 208,2

370 DATA 230,81380 DATA 32,79,0

390 DATA 208,27400 DATA 160,1410 DATA 177,80420 DATA 208,21

430 DATA 200440 DA T A 177,80

450 DATA 208,16460 DATA470 DATA

480 DATA490 DATA460 DATA 24

470 DATA 165,80480 DATA 105,4490 DATA 133,299500 DATA 165,81510 DATA 105,0520 DATA 133,2305 30 D AT A 7 6, 17 7, 24 6

. O V R 2

OVR3AGAIN

OVR4

RAM on your PET)200 check if : or end of line

OVER

631345275352388

54992247248

last page of

REM JSR

REM BNE

REM JMPREM JSRREM JSR

REM JSRREM SYTZREM STAZREM TAXREM TYAREM BNE OVR2REM DEX

REM DEYREM STYZ 80REM STXZ 81REM LDAIM 173

REM STAZ 79REM LDAIM 96

REM STAZ 82REM JSR 200REM CMPIM 44REM BNEREM JSRREM JSRREM INCZ

REM BNEREM INCZREM JSR

OVR3

1946251580OVR481

79

The input parameter may be any complex express-ion and you can of course:

input 0-255 and output 0-65535, orinput 0-65535 and output 0-255.

SAVE MACHINE LANGUAGE AND LOAD DIRECTLY

The reason for the 0,0,0 at the end of the pre-ceding machine language programs is that the

saving routine described next SAVES machinelanguage until 0,0,0 or an ERROR is printed.After it has been saved in this way, it may beLOADED and VERIFIED with little effort.

Add to "MACHINE STORE" program (all assembl y isi n d ec im al ).

jump 'SAVE' if SYS 8000 onlycheck if ','a na ly ze a ri th me ti ca l a rg um en t

check if 0-65535'save from' item'save from' page

back up 1initialize CHK pointer iteminitialize CHK pointer page

LDA instruction in 0079

RTS instruction in 82

check if ',' before filename

move code pointer over

get options for "SAVE'

, ,,

add 1 to CHK pointerlook at next CHK code

REM BNE CHENDREM LDYIM 1 check for 0,0,0

REM LDAIY 80REM BNE CHEND

REMREM

REM24165,80105,4

13REM

INYLDAIY 80

BNE CHENDREM CLCREM LDAZ 80REM ADCIM 4

CLC

REM LDAZ 80REM ADCIM 4REM STAZ 229REM LDAZ 81

REM ADCIM °REM STAZ 230REt1 JMP 63153

'save to' item

'save to' page

c om pl et e ' SA VE '

I: 14

Page 17: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 17/60

CHEND 540 DATA 165,81 REM LDAZ 81

550 DATA 201,31 REM CMPIM ERAM

560 DATA 240,10 REM BEQ CHKNF check: 'not found' if last

510 DATA 144,210 REM BCC AGAIN look at next if less than

580 DATA 32,184,31 REM JSR END

590 DATA 162,85 REM LDXIM 85

600 D AT A 1 6, 10 8, 19 5 REM JMP 10028 (n1END) NOT FOUND ERRORn

CHKNF 610 DATA 165,80 REM LDAZ 80

620 DATA 201,253 REM CMPIM 253

630 D AT A 1 44 ,1 96 REM BCC AGAIN again if enough room

640 DATA 32,184,31 REM JRS END

650 DATA 160,40 REM LDYIM 40

660 DATA 16,133,245 REM JM P 62853 (n?END) NOT FOUND ERRORnEND 610 DATA 169,13 REM LDAIM 13

680 DATA 32,234,221 REM JSR 58346

690 DATA 169,63 REM LDAIM 63

100 DATA 32,234,221 REM JSR 58346

110 DATA 169,69 REM LDAIM 69

120 DATA 32,234,221 REM JSR 58346

130 DATA 169,18 REM LDAIM 18

140 DATA 32,234,221 REM JSR 58346

150 DATA 169,68 REM LDAIM 68

160 DATA 32,234,221 REM JSR 58346 n?ENDn

110 DATA 96 REM RTS180 REM (FORMAT: SYS 8000,INDEX,nFILENAMEn,DEVICEI,I/0 OPTION)

)

After typing and saving normally, type RUN whenREADY. Save n SA vmtn using itsel f to save itsel fb y t ypi ng :

SYS 8000,8000, nSAVE(SYS 8000)n

when READY., REWIND TAPE #1 and type:

VERIFY nSAVE(SYS 8000)n

Loading machine language before BASIC prosram:

LOAD nmachine language naae"NEWA =P E EK ( 2 4 1)POKE 134,APOKE 1,ACLR

:B=PEEK(248): PO KE 1 35 ,B:POKE 2,B (only if USR, not SYS)

Then LOAD BASIC Program.

Loading machine language from BASIC program:MACHINE LANGUAGE LOAD PROCEDURE

After SAVE1ng machine language, you have thecapability of LOADing directly if you followt he se r ul es.

o IF OK THEN RUN 6

1 OK=-1 : PRINT npRESS REWIND ON TAPE #1n2 WAIT 519,4,4 : REM wait til stop if play down but not motor3 WAIT 59411,8,8 : REM wait til key on cassette pushed

4 WAIT 59411,8 : REM wait til stop on cassette pushed5 LOAD nmachine language namen

6 A=PEEK(241) B=PEEK(248)

1 POKE 134,A : POKE 135,B8 POKE 1,A : POKE 2,B : REM (only if USR, not SYS)9 CLR10 REM (BEGIN BASIC PROGRAM, MACHINE LANGUAGE LOADED)

Page 18: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 18/60

•THE ULTIMATE FOR PET --

EXS~CC- S100 ADAPTER

FLOPPYDISKCONTROLLER

The EXS100 is both a SlOO ADAPTER and a FLOPPY DISK CONTROLLER on a single board .....

The EXSIOO can be used to interface the PE'r* to the 3100 BUS, making available the s eeming l.y

.infi n.i te amount of 3100 accessories u::ing the PET * memory expansion connector.

The EXSICO board has a complete FLOPPY DOSK CONTROLLER on-board all set up ready to corrt r-o L

up to three mini-floppy disks.

S100 ADAPTER -5195- ASSEMBL.EO TESTEO

The EXSIOO board built as a stand alone 5100 BUS Adapter. (Floppy Disk Controller part s mi s sing )

Ready to plug into any S100 mainframe to expand the PET*.

FLOPPY CISK PACKAGE -$695-The EXS100 boar-d., cable to the PET, SA400 MINI-FLOPPY DISK DRIVE, Power Supply, and Cabinet ..

A Disk System all ready to go, a disk system that can be later expanded into a full S100 Mainframe.

S'IOOMAINFRAME, CISK -$ 990-The EXSIOO board Lnst.a.Ll ed in a CGRS SlOO Mainframe. Complete with SlOO Power Supply, and

a SA400 yCNI-FLOPPY DISK DRIVE installed in the c abine t . This system is not only a Disk C G R S MICROTECHP.O. Box 368

SOUTHAMPTON, PA. 18966System but a complete SlOO Mainframe ready to accept more RAM,ROM,Printer,the works.". ,.

• TFlAOEMAFlK OFCOMMOOOFIE(215] 757-0284

SUBS[RIPTIO~ A~D RENEWAL INFORMATIC~

I f y o u a r e a s u b s c r i b e r t o M I C R O , t h e n t h e c o d ef o l l o w i n g y o u r n a m e o n t h e m a i l i n g l a b e l i s t h en u m b e r o f t h e l a s t i s s u e y o u r c u r r e n t s u b s c r i p -t i o n c o v e r s . I f y o u r c o d e i s 0 7 , t h e n t h i s i sy o u r l a s t i s s u e . M I C R O w i l l N O T s e n d o u tr e n e w a l n o t i c e s . S o , i f y o u r n u m b e r i s c o m i n gu p , g e t y o u r s u b s c r i p t i o n r e n e w a l i n s o o n . a n d ,p l e a s e c h e c k y o u r l a b e l f o r c o r r e c t a d d r e s s a n dn o t i f y u s o f a n y c o r r e c t i o n s o r c h a n g e s .

N a m e :

A d d r :

C i t y :

S t a t e : Zip:

C o u n t r y :

M I C R O i s c u r r e n t l y p u b l i s h e d b i - m o n t h l y . T h ef i r s t i s s u e w a s O C T / N O V 1 9 7 7 . T h e s i n g l e c o p yp r i c e i s $ 1 . 5 0 . S u b s c r i p t i o n s a r e $ 6 . 0 0 f o r s i xi s s u e s i n t h e U S A . S i x i s s u e s u b s c r i p t i o n s t oo t h e r c o u n t r i e s a r e l i s t e d b e l o w .

[P ay m e n t m u s t b e i n U S $.]

A m o u n t : $ S t ar t M IC RO /1 :

S e n d p a y m e n t t o :

M I C R O , P . O . B o x 3 , S . C h e l m s f o r d , M A 0 1 8 2 4 , U S A

S ur f ac e: C an ad a/ M ex ic oA l l o t h e r c o u n t r i e s

$ 7 . 0 0$ 8 . 0 0

Y o u r n a m e a n d a d d r e s s w i l l b e m a d e a v a i l a b l e t ol e g i t i m a t e d e a l e r s , s u p p l i e r s , a n d o t h e r 6 5 0 2i n t e r e s t s s o t h a t y o u m a y b e k e p t i n f o r m e d o fn e w p r o d u c t s , c u r r e n t d e v e l o p m e n t s , a n d s o f c r t h

_ u n l es s y o u s p e c i f y t h a t y o u d o n o t w i s h y o u rn a m e r e l e a s e d t o t h e s e o u t s i d e s o u r c e s .

A i r M a i l : E u r o p e S e eS ou th A me r ic a

C e nt ra l A me ri caA l l o t h e r c o u n t r i e s

E ur op ea n D is tr ib ut or$ 1 4 . 0 0$ 1 2 . 0 0$ 1 6 . 0 0

R a t e s

~ - - - - - - - - - - - - - - - - - - - - - - 7 : 1 6

Page 19: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 19/60

6502 INTER FA CING FOR B EG INNER S;THE CONTR OL SIG NA L S

Marvin L. De JongDept:. of Math-PhYSICS

The School of the Ozarks

Pt. Lookout, MO65726

By now your breadboard shoulq look like a rat's

nest so we shall add just a few more wires. Sofar you have used several decoding chips to pro-

duce device select pulses (also called chip sel-

ects, port selects, etc.) These pulses activate

a particular I/O port, memory chip, PIA device,interval timer or another microcomputer compon-ent. Almost all of these components must "know"more than that they have been addressed. Theymust know if the microprocessor is going to READ

data from them or WRITE to them. The R/W con-trol line coming from the R/W pin on the 6502

provides this information. It is at logic 1 fora READ(typically LDAXXXX) and at logic 0 for

a WRITE(typically STA XXXX).

)

If you have ever tried to wrap your mind aroundtiming diagrams for microcomputer systems you

soon realize that system timing is also import-ant. Suppose that a memory chip is selected by

a device select pulse. A 21L02 chip, afterbeing selected, must decode the lowest 10 add-ress lines itself to decide which of its 1024

flip-flops will become the output data. This

takes time, so the data at the output pin is not

ready instantaneously. The 6502 simply waitsfor a specified amount of time, and at the endof this period it reads the information on thedata bus. If the access time of the chip is too

long, the 6502 will read garbage; otherwise itwill get valid data.

Likewise, during a WRITEcycle, the microproces-sor brings the R/W line to logic 0, selects thedevice which is to receive the data, and at the

end of a cycle it signals the divice to read the

data which the 6502 has put on the data bU3.

The signal which successfully concludes both aREADand a WRITE instruction is the so-called

phase-two clock signal symbolized by O~. Inparticular, it is the trailing edge (positive tozero transition) of this signal which is used.

All the timing for the microcomputer is done bythe crystal oscillator on the microcomputer

board and the clock circuitry on the micropro-cessor itself. A clock frequency of 1 MHz pro-

duces a machine cycle of 1 microsecond in dura-tion. Near the beginning of the cycle the ad-

dress lines change to select the di vice whichwas addressed, and the R/W goes to logic 1 orlogic 0 depending on whether a READor a WRITE

was requested. If a READwas requested, somedevice in the system responds by putting data onthe data bus. Typically this happens during the

second half of the cycle when O~ is at logic 1.Finally, at the end of the cycle, but before the

address lines or the R/W line have changed, Oz.changes from logic 1 to logic 0, clocking thedata into the 6502. The same kinds of things

happen during a WRITEcycle, except that now the

external device uses the trailing edge of the Oz.signal to clock the data, while the 6502 putsthe data on the bus at a slightly earlier timein the cy_cle. For details refer to the 6502

HARDWAREANUAL.

The circui ts you have built so far, togetherwith a few more chips, will demonstrate the eff-ect of the control signals. Refer to Figure 1of the last installment of thi s col umn (MICRO,Issue 6, p. 30), and to Figure 1 of this Lssue ,You will see the LS145 and the LS138 have notbeen changed too much, in fact all of the conn-

ections to the LS145 should stay the same. Thedevice select pulse from the LS145 goes to G2A

as before, but another signal goes to G2B in thenew Figure 1. For the moment disregard the low-

er LS138 and LS367 in Figure 1 of this issue.

The new signal to G2B of the LS138 is our WRITEsignal. It is produced by NANDINGhe l7V sig-nal with OL and it is an active-low signal. Onthe KIM-1 it is called RAM-R/Wand is available

on the expansion connector. Most other 6502systems I{ill very likely also have a RAM-R/Wsignal.

Its effect in Figure 1 is to inhibit the device

select pulse from the LS138 whenever the R/Wline is high (during all READ instructions),

but to a:.low the device select pulse to occur

when the R/W line is low.m& 0" is high. Thus,

the top Ls138 in Figure 1 selects output portsonly, and the device select pulse from it term-inates on the trailin~ ed~e of the Oz.. producinga logic 0 to logic 1 transition simultaneously

(almost) 'iolith Of.. This pulse is inverted by the

LS04. Consequently, a WRITE instruction pro-duces a positive pulse at the G inputs of theLS75 whose duration is about 1/2 microsecond andwhose trailing edge coincides with O

2,

The 74LS75 is a 4-bit bistable latch whose Q

outputs follow the D (data) inputs only when theG inputs are at logic 1, in other words during

the device select pulse from the LS04 inverter.The trailing edge of this pulse latches the Q

outputs to the value of the D inputs during thedevice select pulse. If you had a great deal of

trouble following this, you may want to checkthe reverse side of this page to make sure there

is nothing valuable on it and then destroy thisby burning or shredding! Otherwise proceed toto the eXperiment below.

Connect the circuit shown in Figure 1, omittingfor the time being the lower LS138 and theLS367. You can also omit the connection of add-

ress line A3 to G1 on the top LS138 if G1 isconnected to +5V as was indicated in the last

issue. In other words, simply add the LS04 andthe LS75 to your circuit of the last issue. TheRAM-R/WSignal must also be generated if your6502 board does not have one. Simply use oneinverter on the LS04 to invert the R/W signal toR/W, then NANDt with the 0 , and run the out-

put of the NANDgate to the G2B pin on the LS138.

The address of the device is 800F if the connec-tions are made as shown in the figure. If other

pins on either the LS145 and/or the LS138 arechanged the address will be different. Theswitches shown connected to the D inputs may be

implemented with a DIP switch or jumper wires.An open switch corresponds to a logic 1 while a

closed switch is logic O. Set the 4 switches toany combination then load and run the following

program:

0200 8D OF 80 STADSF.

The LEDs should indicate the state of theswitches. If you add the statements

0203 4C 00 02 JMP START

then you should be able to change the switchesand the LEDs will follow the switches. Try sub-stituting an ADOF 80 (LDADSF) for the 8D OF 80instruction. Nothing should happen, even though

the same address is being selected, because onLDAinstruction the R/Wline is high, inhibiting

the LS138 from producing a device select. Fin-

Page 20: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 20/60

a ll y, c o nn ec t t h e da ta li n es DO -3 f ro m t h e 65 02to th e D- i np ut s o f t h e L S 75 , m a ki n g v er y s u reth a t t h e L S1 4 5 is de - se l ec ti n g o th e r l oc a t-i o n s . On t h e K IM - 1 t hi s m ea ns th a t p i n 1 o f th eL S1 45 is co n ne c te d to p i n K o n t h e a pp l ic a ti onc on n ec t or an d p i n 9 o f t he LS 1 4 5 is c on n ec t edt o p i n J . T he a pp ro p ri a te pu l l- u p r es is t or sm u st a ls o b e a d de d . W i th th e d at a l i ne s c o nn e-c te d r un t h e fo ll o wi n g pr og r am :

0 2 00 A9 04 L D AI M $0 40 2 02 8 D OF 80 S TA DS F .

P la y a r ou nd w it h d if f er en t nu m be rs in LD AI M i ns -tr u ct io n a nd e xp la i n yo ur r e su lt s . If no t hi ngse e ms t o m a ke s e ns e, it m ay be t h at y ou r d at ali n es n ee d t o be b uf f er e d, a t o pi c w e w il l t a keu p n ex t i ss ue . If y o ur r e su lt s m ak e s e ns e y ouw il l h a ve d i sc o ve re d th a t we h av e c on f ig ur e d a4 -b it ou t pu t p or t w ho s e ad d re ss i s 80 0 F. A dd in gan ot h er L S 75 t o c o nn ec t to da t a l in e s D4 -D 7 an dw h o s e G c on ne c ti o ns a l so go t o t h e o u tp ut o f th eLS 0 4 w il l gi v e a n 8- bi t o ut pu t p o rt . S ev e no the r o utp ut p or ts , ad dre sse s 80 08 t hro ugh 80 0E,co u ld b e ad d ed u si ng t h e ot he r de v ic e se le c tsi g na l s f r om t h e L S1 3 8, ~S 04 i nv er t er s, a nd L S7 5l a t c h e s .

If y o u w a nt t o m ak e a n i np u t p or t w ir e t he ci r -c u it f o r th e l ow e r LS 1 38 i n F i gu re 1. If y o u

0 2 0 0020302050 2 0 8

AD 0 7 8 085 F 92 0 1F 1F4C 0 0 0 2

L D A DS 7ST A D IS PJ SR S CA ND SJM P S TA RT

S T A R T

+S V

A o A

~8

Y 1

A I

S c~/.38

A1

All> " G I

0-62f}

GZA

AI

F i gu re 1. A f ou r -b it i np u t p or t an d ou t p u t ,p o rt i nt e rf a ce fo r th e 6 5 02 .

do n' t ha v e m u ch m or e r o om o n yo ur c ir c ui t bo a rdy o u m ig h t w an t t o s im p ly r e co nn e ct t h e u pp er L S-13 8 to be c om e th e l o we r LS 1 38 . A c ou p le o f co n -n e ct io n s d o th e t r ic k . Se t th e s wi tc h es to an y -t h in g yo u l i ke a n d ru n t h e pr o gr a m b e lo w.

K I M- 1 us er s sh ou l d se e t h e h ex eq ui v al e nt o f th es wi t ch se t ti n gs a pp e ar i n t he ri gh t -m o st d i gi ton t he di s pl ay . Ow n er s of o t he r s y st em s c anom it t he l as t tw o l i ne s o f t he pr og r am , s t op i t,an d e xa m in e t h e l oc a ti o n 0 0F 9 t o s ee th at t hel o we st f o ur bi t s a g re e wi th t h e sw i tc h se tt i ng s.E x pe ri m en t w i th o th e r s wi t ch se tt i ng s to m a kes ur e t ha t e ver yt hin g is o pe rat ing c or rec tl y.

T h e co mp l et e d c ir c ui t o f Fi gu r e 1 gi v es o n e 4 -b i t o ut p ut po r t (p r ov id e d th e da t a l i ne s a reco nn e ct e d to t he D i np ut s of t he L S 7 5) a nd o ne4 - bi t i n pu t p or t, a dd re s se s 8 0 0F a nd 8 00 7 r es p -ec ti v el y . Th e se t wo p or t s a r e ea s il y e x pa nd e d(t w o m o re ch i ps ) to b ec om e 8 -b i t p or t s. L ik e -w i se th e c ir c ui t o f F i gu r e 1 co ul d b e e xp a nd edt o g i ve a t o ta l o f e i gh t 8- b it i np u t po r ts a nde igh t 8- bit o ut pu t po rt s.

N ex t is s ue we wi ll l oo k at a s l ig h tl y d if f er en ti np u t p o rt , a nd we wi l l l oo k in mo r e de ta i l i n tot hr e e- s ta te d ev i ce s an d th e d a ta b u s. Yo u ma ywa nt t o ke ep yo u r c ir c ui t t og et h er u n ti l th en .

R ea d in p ut p o rt d at aa n d s t or e i t i n l oc at i on 0 0F 9 .J um p t o K IM d isp lay s ubr ou tin e.R ep ea t p ro gr am .

t-SV

OUTPUT PORT

1..S7S

QO 16

+ O " v

/6

LS367

L..JJ

03

INPUTPOIff

~00

Of

tJ2.

10

Page 21: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 21/60

)

65~X ~P[OD[S[QU[~[[M~T(HER

J . 5 . G r e e n8 0 7 B ri dg e S tr ee t

B e t h l e h e m , P A 1 8 0 1 8

T h e m o t i v a t i o n f o r w r i t i n g t h i s p r o g r a m s t e m m e df r o m t h e f a c t t h a t I h a v e t w o m a c h i n e c o d " v e r -s i o n s o f t h e s a m e 6 5 0 X a s s e m b l e r (A S M 6 5 b y W a y n eW a l l , d a t e d 1 M a y 7 7 a n d 1 3 J u n 7 7 r e s p e c t i v e l y )b u t I o n l y h a v e a l i s t i n g o f t h e o l d e r v e r s i o n .B o t h a r e ju s t s h o r t o f 4 K b y t e s l o n g . I w i s h e d

t o m a k e s o m e l o c a l c h a n g e s t o t h e n e w e r v e r s i o na n d t h e r e f o r e n e e d e d t o e s t a b l i s h a m e a n s o fc o r r e s p o n d e n c e b e t w e e n i t a n d t h e l i s t i n g . Ad i s a s s e m b l e r i s h e l p f u l h e r e b u t n o t a d e q u a t eb e c a u s e o f d i s c o n t i n u i t i e s i n t h e t w o c o d e sw h i c h m a k e f o r w a r d r e f e r e n c e s v e r y d i f f i c u I t t oc or re la te m an ua ll y.

I f e l t t h a t w h e n a p r o g r a m h a s b e e n h e a v i l y m o d -i f i e d , m a n y o p c o d e s e q u e n c e s e g m e n t s w h o u l d r e m -a i n c o n s t a n t e v e n w h i l e t h e i r r e s p e c t i v e o p e r -a n d s d i f f e r . T h e r e f o r e , w h a t w a s n e e d e d w a s ap r o g r a m t h a t w o u l d c o r r e l a t e a n d p o in t t o p a r -a l l e l s e q u e n c e s o f o p c o d e s .

S e v e r a l a s s u m p t i o n s w e r e m a d e i n o r d e r t o s i m -

p l i f y t h e p r c g r am m i . n g t a s k . I t w a s p r e s u m e dt h a t t h e b a s i c o r d e r o f a p p e a r a n c e o f m a jo r p or -

t i o n s o f t h e c o d e w o u l d b e t h e s a m e s i n c e t h e r es e e m e d t o b e l i t t l e a d v a n t a g e i n s h u f f l i n g t h ed e c k , a s i t w e r e . A l s o , i n o r d e r t o m i n i m i z et h e e f f e c t o f s p u r i o u s m a t c h e s , i t w a s d e c i d e dt h a t o n l y s i g n i f i c a n t s e q u e n c e s n e e d b e r e p o r t e da n d t h a t n o p o r t i o n o f t h e c o d e w o u l d b e r e p o r t -e d a s a m a t c h m o r e t h a n o n c e . T h i s p o s i t i o ns a v e s t h e p r o g r a m , f o r e x a m p l e , f r o m r e p o r t i n ge v e r y p o s s i b l e L D A , S T A o p c o d e s e q u e n c e p a i r i n g(o r e v e n a l l o f t h o s e o f t h e s a m e a d d r e s s m o d e).

P ro ce ss D es cr ip ti on

A s w r i t t e n , t h e s c a n n i n g p r o c e s s o f t h e m a t c h i n gp r o g r a m s t a r t s a t t h e b e g i n n i n g o f t h e t w o c o d es t r i n g s , A a n d B , t o b e e x a m i n e d . B o t h i n i t i a lp o s i t i o n s a r e a s s u m e d t o c o n t i a n o p c o d e s . An i n -d e x o r p o i n t e r t o t h e B s t r i n g i s , i n e f f e c t ,m o v e d a l o n g B , f r o m o p c o d e t o o p c o d e , u n t i l am a t c h w i t h t h e c u r r e n t A s t r i n g o p c o d e i s f o u n d .I f n o m a t c h i s f o u n d b e f o r e t h e B l i s t i s ex-

h a u s t e d , t h e A p O i n t e r i s m o v e d t o t h e n e x t Ao p c o d e p o s i t i o n w h i l e t h e B p o i n t e r i s r e s e t t oi t s p r e v i o u s s t a r t i n g p o i n t . T h i s g e n e r a l p r o c e -d u r e i s r e p e a t e d u n t i l t h e A l i s t i s e x h a u s t e d ,a t w h i c h t i m e t h e p r o g r a m t e r m i n a t e s .

W h e n a m a t c h i s f o u n d , b o t h p o i n t e r s a r e m o v e dt o g e t h e r a l o n g t h e i r r e s p e c t i v e l i s t s , f r o mo p c o d e t o o p c o d e , u n t i l t h e o p c o d e s f a i l t om a t c h e a c h o t h e r . I f t h e m a t c h i n g s e q u e n c ei s s i g n i f i c a n t l y l o n g t h e s i z e a n d t h e s t a r ta n d e n d o f b o t h s e g m e n t s i s d i s p l a y e d . T h es e a r c h f o r a d d i t i o n a l m a t c h i n g s e g m e n t s i s r e s -u m e d f r o m t h e e n d o f t h e ju s t - r e p o r t e d s e g m e n t ss o t h a t t h e i r o p c o d e e l e m e n t s c a n n o t b e m a t c h e d

m o r e t h a n o n c e .

I f t h e c o m p l e t e d s e q u e n c e i s n o t s i g n i f i c a n t , i ti s n o t d i s p l a y e d a n d t h e s e a r c h i s r e s u m e d f r o mw h e r e t h e s h o r t s e q u e n c e b e g a n , a s i f t h e r eh a d b e e n n o m a t c h a t a l l .

T h e d e f i n i t i o n o f s i g n i f i c a n c e r e f e r s t o t h em i n i m u m a c c e p t a b l e n u m b e r o f m a t c h i n g c o d e s i n ac o n t i n u o u s s e q u e n c e . T h e p a r t i c u l a r v a l u e s u s e da r e l e f t t o t h e u s e r . W h i l e o u r e x p e r i e n c e h a ss h o w n a m i n i m u m v a l u e o f e i g h t t o b e u s e f u l , t h ea c t u a l v a l u e s s h o u l d r e f l e c t t . h e l e n g t h o f t h ec o d e b e i n g e x a m i n e d a n d t h e d e g r e e t o w h i c h i t

h a s b e e n h a c k e d u p .

T h e e f f e c t o f a t o o - l o w s i g n i f i c a n c e v a l u e o f t e nr e s u l t s i : 1 a f e w e r n u m b e r o f m a t c h e s b e i n g r e p -

7: 19

o r t e d , r a t h e r t h a n m o r e a s o n e m i g h t e x p e c t .T h i s i s b e c a u s e a s p u r i o u s m a t c h o f s h o r t s e g m -e n t s c a n h a v e t h e e f f e c t o f m a s k i n g o u t l o n g e rp o s s i b l e m a t c h e s w h i c h w o u l d u s e t h e s a m e c o d ei t e m s w e r e t h e y s t i l l a v a i l a b l e .

O p e r a t i o n

T o o p e r a t e t h e o p c o d e m a t c h i n g p r o g r a m b o t hl i s t s o f c o d e m u s t b e i n m e m o r y . T h e y m a y b e i nR O M . T h e y n e e d n o t b e a t t h e i r o p e r a t i n g a d d r -e s s . (I n d e e d , i f t h e y h a v e t h e s a m e a d d r e s s a tl e a s t o n e m u s t b e s o m e w h e r e e l s e a n y w a y). S i n c et h e m a t c h i n g p r o g r a m r e p o r t s s t o r a g e , r a t h e rt h a n o p e r a t i n g a d d r e s s e s i t i s u s e f u l t o c h o o s es t o r a g e a d d r e s s e s t h a t h a v e s o m e d e g r e e o f c o r r -e s p o n d e n c e t o t h e o p e r a t i n g a d d r e s s e s , e . g . ,c o d e o p e r a t i n g a t $ 2 1 E 3 m i g h t b e s t o r e d a t

$ 4 1 E 3 .

E n t e r i n i t i a l v a l u e s (a l l i n h e x L O , H I ) a s fo l -l o w s :

$ 0 0 0 0 , 0 1

$ 0 0 0 2 , 0 3$ 0 0 0 4 , 0 5$ 0 0 0 6 , 0 7$ 0 0 0 8 , 0 9

S i gn if ic an ce v al ue

S t a r t o f l i s t AS t a r t o f l i s t BE n d o f l i s t AE n d o f l i s t B

O n l y t h e s t a r t i n g a d d r e s s w i l l b e m o d i f i e d d u r -i n g p r o g r a m e x e c u t i o n . T h e p r o g r a m w i l l i n i t -i a l l y a s s u m e t h a t t h e v a l u e a t t h e s t a r t l o c a t -i o n i s a n o p c o d e .

T o r u n t h e p r o g r a m e n t e r a t O P M A C H . A s w r i t t e n ,i t w i l l t e r m i n a t e b y ju m p in g t o t h e m o n i t o r f r o mE N D 0 1 . T h e r o u t i n e m a y b e m a d e i n t o a s u b r o u t -i n e b y p l a c i n g a n R T S h e r e .

S i n c e t h e p r o g r a m c r a n k s t h e d a t a a l o t , t h e r ew i l l b e w h a t s e e m t o b e l o n g p a u s e s b e t w e e n o u t -p u t s . T h e p r o g r a m r e q u i r e s a b o u t 2 m i n u t e s t o

c om pa r e t he a fo re me nt io ne d a ss em b le rs .

R e s u l t s

S e v e r a l s e t s o f r e s u l t s , u s i n g s i g n i f i c a n c e v a l -u e s o f $ 0 6 , $ 0 8 a n d $ O A a r e s h o w n b e l o w . I n o r d -e r t o h a v e b o t h v e r s i o n s o f c o d e r e s i d e n t a t t h es a m e t i m e , i t w a s n e c e s s a r y t o s t o r e o n e v e r -s i o n , a t a d d r e s s $ 4 0 0 0 .

A b o u t 6 4 p e r c e n t o f t h e c o d e o f t h e t w o v e r s i o n so f t h e a s s e m b l e r c o r r e l a t e w h e n a s i g n i f i c a n c ev a l u e o f 8 i s u s e d . T h i s i s a r e a s o n a b l e p e r -c e n t a g e w h e n o n e c o n s i d e r s t h e f a c t t h a t t h en o n - s i g n i f i c a n t , n o n - r e p o r t e d , s e q u e n c e s a r ee a s i l y i d e n t i f i e d s i n c e t h e y l i e i n t h e s a m er e l a t i v e p o s i t i o n b e t w e e n r e p o r t e d s e q u e n c e s .

A n e x t e n s i v e m a n u a l c o m p a r i s o n o f t h e t w o c o d es e t s w a s m a d e . (So mu c h f o r t h e w o r k - s a v i n g a s -p e c t s o f t h e p r o g r a m ! ) N o f a l s e m a t c h e s w e r ei d e n t i f i e d w h e n a s i g n i f i c a n c e v a l u e o f 8 w a su s e d .

V a r i a t i o n s f o r T e x t P r o c e s s i n g

I n t e r e s t i n g v a r i a n t s o f t h e p r o g r a m a r e p o s -s i b l e . B y a l t e r i n g o r r e p l a c i n g t h e l i s t p o i n t -e r i n c r e m e n t r o u t i n e s , A I N C a n d B I N C , t h e n a t u r eo f t h e l i s t p o i n t e r i n c r e m e n t a t i o n m a y b e c n a n g -e d f r o m t h e c u r r e n t c o n d i t i o n a l i n c r e m e n t b a s e do n o p c o d e t o s o m e o t h e r c o n d i t i o n o r t o a c o n -s t a n t s u c h a s p l u s o n e .

W i t h a c o n s t a n t i n c r e m e n t o f o n e , t h e m a t c ru n gp r o g r a m m a y b e u s e d t o c o m p a r e s e q u e n c e s o f a n y

Page 22: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 22/60

t e x t ur a l m a te r i a l i n a s o m ew h a t c r u d e , o n e f oro ne f as hi on .

By h a v in g s ep a r a te i n c re m e n t s u b r ou t i n es w h e ns ee k i n g t o l o c at e t h e s t a r t o f a m a t c hi n g s e g -m e n t i n co n t r a st t o t h e i nc r e m en t a l r o u ti n e sus e d wh e n " r u nn i n g -o u t " a s e q ue n c e , s o me f ai . r l yp o we r f u l t ex t p ro c e s si n g c a pa b i l i ti e s ma y b e o b-t ai n e d a t li t t l e a d d i t io n a l c o s t . F or e x a mp l e ,w h e n se e k i n g t o lo c a t e m a tc h i n g se g m e n ts i n na t -u r al l a ng u a g e t e x t, w e m i g ht wi s h t o s ta r t wi t ht h e i n i t i al c h a r ac t e r o f a lp h a b et i c s t r in g s ,i . e. , w o r d s. T h e r ef o r e , b y i n c re m e n ti n g pa s ta l l no n - a l ph a b e t ic c h a r ac t e r s t o t h e n e x t a l p ha -b e t ic ch a r a c te r w e c a n b ot h sp e e d u p t he p r o c e ssa n d i n s ur e t h a t o u r s eq u e n c es st a r t w i t h (wh a tw e ha v e o p e r a ti o n a ll y de f i n e d as) w o r ds .

S i mi l a r t e c h ni q u e s m a y b e e m p l oy e d i n t he I: n o w

s e p ar a t e) w i t h in s e q ue n c e i n cr e m e n t r o u ti n e s t oi ng or e, (i .e ., i nc re me nt p as t;) a n y n on -a lp ha be t-i c c ha r a c t er s s u c h a s c o nt r o l c h ar a c t e rs n u m -be r s , p u nc t u a ti o n o r wh a t e ve r w e li k e . T h u s wea re a b l e to o b t a i n a f a r m o re f l e xi b l e a n d h o p e -f u l ly m o r e u s ef u l d e f in i t i o n o f a ma t c h i ng s e q-u e n c e .

C o n c l u s i o n s

Th e g e n e r al t ec h n i q ue s i l l u st r a t e d he r e a r e b o the ff e c t i ve a nd u s e f ul . T h e co n d i t io n a l m a t c hi n~a p pr o a c h h a s n o t b e e n f u l l y ex p l o r ed , b u t i t i sc l ea r t h at i t h a s i n t e r es t i n g p o ss i b i l it i e s inth e a r e a o f te x t p r o c es s i n g . I n t he p r es e n ta p p l ic a t i on , c o r r e la t i n g t wo l en g h t y s t ri n g s o fm ac h i n e co d e , t he a p p r oa c h m a de p r ac t i c a l w h a to t he r w i s e w o u l d h a v e b e e n a d i f f i cu l t a n d du l lt a s k .

**** O P CO D E S EQU E N C E M A TC H E R ***~V E R S IO N 1 . 0 4. 1 8 A U G 78

C O P Y R I G H T . 1 9 7 8

C O M M ER C I A L RI G H T S R E S E RV E DE X CE P T AS N O T E D B Y

J. S . GR E E~. CO M P U 7 ER S Y S T E MS8 0 7 B RI D G E S T RE E T

B E T H LE H E M . P A 1 8 01 8(2 1 5) 8 6 7- 0 9 2 4

N OT E : T H E B YT C N T S U B RO U T I N E I S F RO MH. T . G OR D O N I N D D J. # 2 2 P . S.(C O P Y RI G H T B Y P E OP L E ' S C O M PU T E R C O M P A NY)

. L O C $ 0 0 1 H : : I

U S E R D E F I N E D V A RI A B L E S (L O , HI)0 1 H l 0 00 0 0 S I G NI F : . W O R D i S I G N I F I C A N C El i H l 0 2 l -Hl 0 0 . l\B A SE : . W O R D i S T A R T O F LI S T Ak H i 0 4 1 1 ~ 0 0 B B A SE : . W O R D i S T A R T O F L I S T B

e a e s 00 00 A M A X : . W O R D i E N D O F L IS T AIHHH! 00 0 0 B~I AX : . W O R D i E N D O F L I S T B

O T H ER P R O GR M l V A R I A BL E SI H l 0 A 0 0 00 AP O I N T : . W O R D i L I S T A P O IN T E RI H l 0 C 00 00 B P O I N T: . W O R D i L I S T B P O IN T E R0 0 0 E I :HI 0 0 A S A V E : .W O R D i L I S T A S EQU E N C E ST.~RT~H1 l 0 0 0 0 0 B S A V E : . W O R D i L I S T B S EQU EN C E S ' r A R T0 0 1 2 IH 1 0 0 CO U N T : . W O R D i S EQU EN C E C O U NT E R

E X T E R N A L S U B R O U T I N E S (I N K I M). D E F S T A RT=$I C4 F i M O N I T O R R E T U R N !?OIL~T. D E F CRLF=$IE2F i C A R R I A G E R E T U R N. D E F OU'rCH=$lEA0 i D I S PL A A C H A R. D E F PRTBYT=$IE3B i D I S P L A f lEX B YT E. D E F ou'rSP=$lE9E iDISJ?LA A S PA C E

. L O C $ 0 2 0 0

02 0 0 2 1 1 2 F IE O J?MA C H : J S R C R L F

0 2 0 3 A 2 29 L O X , $2 9 i S I G N + H E A D E R C O U N T0 2 0 5 BD 4 F 0 3 OP M C H l : L O A X S I G N i D IS l l L AY H E A D E R0 2 08 2 0 A0 I E JS R OU T C Ho 2 0B CA D E Xo 2 1 ' l C10 F7 B l lL O J?lK H Io 2 0E A 5 1 1 1 L O A S I G N I F - t - l0 2 H l 2 1 1 3 B I E J S R l l R T B ' l T i D I S PL A Y S I G N If H I0 2 1 3 A S ~0 LO A S I G N I F0 21 5 2 0 3 B I E J SR P H ' r B Y ' l ' i D I SP L A Y S I G Cl I F LO0 2 18 2 0 2 F I E J S R C R L F~21B 2 0 3 8 03 J S R B A S P : - l T ;J?OINTERS=3?3ES

~~(!J~l!) 7 : 2 0

Page 23: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 23/60

0 21 E AS 0 3 0 0 1 : L OA ABASE+l0 2 2 0 C 5 1 07 C MP AMAX+l0 22 2 3 0 0 9 B MI I Fl ;BR I F WH O LE J OB scr D O N E~ 224 A S 0 2 LO A A B A S E0 2 2 6 C 5 0 6 C MP ANAX

1 0 2 2 8 3 0 03 B MI I F l ;BR I F WH O LE JO B N OT D O N E0 2 2A 4 C B 7 0 2 J M P E ND O l ;HE R E I F W HO L E JO B DO NE0 2 20 A 2 0 1 1 IF 1 : L D X ~ 0 ;OO ES C U RR EN T PA I R MA ' rC H '0 22 F A l 0 A L DA Xi § A PO IN T0 23 1 C l 0 C C M P X I § B P O I N T0 23 3 0 11 64 B NE E LS l ;BR I F so r T HE S AM E0 2 3 5 86 12 T HE N 1 : S TX C O UN T ;HE RE ON S A M E

0 2 3 7 8 6 13 S TX C O UN T+l ;CL E AR T HE C O U N T E R0 2 3 ~ A 2 0 3 L O X # 30 2 38 B5 0 A TH N IA : L O A X AJ?OINT ; SAVES=POINTERS0 23 0 9 5 0E S T A X A S A V E0 2 3 F C A D EX0 2 4 0 hJ F9 B PL TH N IA0 2 42 A 2 l : H l 0 0 2 : L OU 0 ; D O T IL L s o r T HE S AM E0 24 4 A l I 1 A L D A X @ A P O I N T1 12 4 6 C l 0 C C M PX @ B P OI NT02 4 8 00 2 6 B NE E NO O 2 ;BR I F NO T ' r HE S AM E0 2 4A A S 0 B L OA AP O IN T +l0 2 4C C 5 07 C M P AMAX+l0 24 E 30 06 B MI E XP 2 1 ;BR I F L ES S TH AN

0 2 50 A S I : lA L OA AP OI N T1 1 2 5 2 C 5 0 6 C MP A M A X

0 25 4 1 0 l A B PL E N D 0 2 i BR T O E N OO0 2 56 A S 00 E X P2 1 : L OA B PO I NT +l0 25 8 C 5 0 9 C M P B M AX +l0 2 5 A 30 0 6 B MI E XP 2 2 ;BR I F L E SS TH AN0 2 5 C A S 0 C L OA B PO IN T0 25 E C 5 0 8 C MP 8 MA X0 26 0 10 0E B PL E N0 02 ;BR T O E NO O IF L IM IT R E AC H ED0 26 2 2 0 BA 0 2 E XP 2 2: J S R AI NC i M O V E A P OI N TE R T O N EX T A O PC OO E0 2 65 2 0 C E 02 J S R B IN C i MO V E B P OI N TE R T O N EX T B O PC OO E

) 0 2 6 8 E6 1 2 IN C C O U N T0 2 6 A 0 0 06 B NE 0 020 26 C E6 13 I N C C OU N T+l0 26 E 0 10 02 B NE 0 02 ;B R AL W AY S T O TOP OF D O0 27 0 EA E N0 0 2 : N ap ;A W A ST E D B YT E F OH . " S T R u C ' r U R E "0 27 1 A S 13 IF 2 : LO A C O UN T+l0 27 3 C 5 0 1 C MP S IG NI F +l

1 027 5 3 0 0 F BM I E L S 2 ;BR I F NO T S I G N I F0 27 7 A S 1 2 L O A C O U N T02 7 9 C 5 1 00 C Mf ' S IG NI F0 2 7 B 3ti 0 ' : : 1 B MI E LS 20 2 7 0 2 0 FE 0 2 TH EN 2 : J SR R Ef ' OR T i HE R E ON S I G N I F . O U T P U T R E S U L T1 02 80 2 0 4 5 1 63 J SR P N T B A S iPOINTERS=BASES'1 028 3 4 C 9 6 0 2 J t- t J? E N O I F 20 2 8 6 A 2 0 1 EL S 2 : L O X l I 102 8 8 2 0 3 D 0 3 J SR BA S PT l i AP O IN T=A BA S Eo 2 8B AS 10 L O A B S A V E0 28 0 8 5 0C ST A B PO IN T0 2 8 E ' AS 11 L O A B SA V E+l0 2 9 1 8 5 1 00 srx BPOI:>lT+l112 9 3 2 0 CE 0 2 J SR B I N C0 2 % 4 C 9 C 3 2 EN O IE ' 2: J MP E N O I F l

02 9 9 2 0 C : : :0 2 EL Sl : J SR B H I C ie 2 ' :! C2,J;, EN O IF 1 : N OP i AN OT H ER S OP T O -s r EU Cc U R £"0 2 9 D A S 0 0 I F 3 : L O A BP O IN T+l0 2 9F C 5 ()9 C MP Bt-IAX+l1 1 2A l 31 0 11 B M I E N DH 3 ;B R IF No 'r DO NE0 2 A 3 AS : i J C L O A B P O I N T0 2 A 5 C5 08 C ! - I P B~jAX0 2A 7 3 0 0B aa r E N O I F 3 iB R IF N OT D O NE021>.'::1tJ 3B 0 3 TH E :O : J SR BA S PN T

,)0 2A C 21 1 BA 02 J SR A I N e1 1 2 M P ,2 11 1 LOXjf 102 B l 2 0 47 03 JS R P N T B S I0 2 84 4C lE 0 2 ENOIE']: J['lP 0 011 : l 2 B 7 4C 4F I e E NO O l : J M P S T A R T

Page 24: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 24/60

S U B R O U T I N E S F O L L O\~

M O V E T O N E :X ' rA O P C O O E0 2 8 A A 2 0 0 A I N C : L D X # 00 2 B C A l 0 A L D . l ! , X@A P O I N T ;G E T O P C O O E0 2 B E 2 0 E 2 0 2 J S F l B 1 ' T C N T ;C A L C U L A T E SIZE0 2 C 1 8 A ' f X A i R E S U L T R E T U R N E D I N X0 2 C 2 1 8 C L C0 2 C 3 6 5 t J A A D C A P O I N T i A D D R E S U L T T O P O I N T E R0 2 C 5 8 5 0 A S T A A . i?OI N Te 2C 7 A 5 0 B L O t i , A P O I N T+ lo 2C 9 6 9 0 0 A D C l I 00 2 C B 8 5 0 B S T A A P O I N T+ l0 2 C D 60 R T S

; M O V E T O N E X T B O P C O D E0 2 C E A 2 ~0 B I N C : L D X # 00 2 0 0 A l 0 C L D A X@ B . i?OI N T i G E T O P C O D E0 2 D 2 2 0 E 2 0 2 J S R B Y T C N T i C A L C[ J L A T E S IZE0 2 0 5 8 A T X A i R E S U L T R E ' l ' U R 0 i E D I N X0 2 0 6 1 8 C L C0 2 D 7 6 5 0 C A D C B P O I N T i A D D R£S U L ' f T O P O I N T E R0 2 D 9 8 5 0 C S T A B P O I N T0 2 D B A S 0 D L O A B P O I N ' f+l0 2 0 0 6 9 kit) A D C # 00 2 0 F 8 5 0 D S T A B P O I N T+l0 2 E l 6 0 R T S

C A L C U L A T E S IZE O F O P E R A N D (+1 )B Y H. T . G O R D O N (S E E D D J # 2 2 . P . 5 )

0 2 E 2 A 2 0 1 B 1 ' T C N T : L D X # 1e 2E 4 2 C E 8 0 2 B I ' r B 1 ' T C N T +6 i T E S T B I T ' 30 2 E 7 D 0 0 8 B N E H A F O P i A L L X (8 -F )0 2 E 9 C 9 2 0 O l P # s 2 0g 2 E B F 0 0 E B EQ ' r H R E E i O N L 1 ' $ 2 00 2 E D 2 9 9 F A N D l I $ 9 F i B I T S 5 . 6 O U ' I '0 2 E F D 0 I 1 B B N E rw o i A L L E X C E P T (0 . 4 . 6) 00 2 F l 2 9 1 5 H A F O P : A N D # $ 1 5 ;R E T A I N S O N L Y B I T S 0 . 2 . 40 2 F 3 C 9 0 1 C M P i I 1e 2 F 5 F 0 05 B EQ T W O iX (9. B)

o 2 F 7 2 9 0 5 A N D # 5 ;8 I T 4 O U T0 2 F 9 F 0 0 2 8 EQ O N E ;X (8 . A) Al'lD ( ; i ) .1'.• 6 ) 0

0 2 F B E 8 T H R E E : I N X i R E S I D . X(9 - F)<J 2 F C E 8 T W O : H l X0 2 f D 60 O N E : R T S

; D IS PL A' 1 S IG NI FI CA NT S EQu E N C E L P 1 1 . 1 ' : o

0 2 F E A 2 0 1 R E P O R ' f : L D X # 1

0 3 0 0 B 5 1 2 R E P T 1 : L D A X C O U N T ;O U T P U T E X T E e l' ;:F ~A'l'CH

0 3 0 2 2 0 3 B 1£ J S R . i?R' r 8 x " r

0 3 0 5 C A D E X

0 3 c b 10 F a 8 P L R E P T IO U T P U T M U L T I P L E S P A C E S

0 3 0 8 2 0 3 1 0 3 J S R O U T S P 4 ;F O U R S P A C E S

0 3 0 8 A 2 0 0 L D X # 0

0 3 0 0 8 5 0 F R E P ' r 2: L D A X A S A v E+ l .ourvcr S T A R T A N D

0 3 0 F 2 0 3 B I E J S R . l : ' R T B ' 1 T E N D A D D R O F

0 3 1 2 B 5 0 E L D A X A S A v E ; B O T H S E G M E N T S

0 3 1 4 2 0 3 8 I E J S R f ' R ' I ' 8 ' 1 T\1317 2 0 3 4 ' 0 3 J S P . O U T S P 2

0 3 1 A B 5 0 8 L D A X A P O I N T+ l

0 3 1 C 2 6 3 8 I E J S R P R T B 1 ' T

e 3 lF 8 5 0 A L D A X A P O I N T

0 3 2 1 2 0 3 8 1£ J S R f ' R T 8 1 ' T

1 1 3 2 4 2 t l 3 1 0 3 J S R O U T S J?4

0 3 2 7 E 8 I N X

0 3 2 b E 8 I N X

0 3 2 9 E I 1 0 3 C P X # 3

0 3 2 8 3 0 E 0 8 M I R E P T 2

0 3 2 D 2 0 2 F I E J S R C R L F

0 3 3 0 6 0 R T S

Page 25: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 25/60

11331 20 34 03 OUTSP4: JSR OUTSP2 ;4 SPACES0334 20 9E IE OUTSP2 JSR OUTSP ;2 SPACES0337 20 9E IE JSR OOTSP033A 60 RTS

i MOVE ABASE & BBASE TO APOINT & BPOINT033B A2 03 BASPNT: LOXi 30330 B5 02 BASPTI LOAX ABASE033F 95 0A STAX APOINT0341 CA OEX0342 10 F9 BPL BASP'r10344 60 RTS

; MOVE APOINT & BPOIN'r 'roABASE & BBASE0345 A2 03 PNTBAS: LOU 30347 B5 0A PNTBSI : LOAX APOINT~349 95 02 STAX ABASE034B CA OEX034C 10 F9 BPL PNTBSIt134E 60 RTS

;

SIGN: .ASCII FINGIS034f ·200350 3D0351 200352 460353 490354 4E

0355 470356 490357 530358 203359 20

HEADER: .ASCII 'OT MORF or ~IORF EZIS035A 4F

) 0358 54035C 200350 20035E 20

035f 400360 4F0361 52 0379

0362 46 0000 SIGNIF 02BA AINe0363 20 0002 ABASE 02CE BINC0364 2~ 0004 BBASE 11271IF20365 20 0006 AMAX o 2 86 : : : :LS20366 20 0008 BMAX 02BA AINC0367 20 000A APOINT k:J2CEBINC036Cl 4F 000C BPOINT 0271 IF20369 54 000E ASAvE 0286 ELS2036A 20 0010 BSAvE 0270 THEN20368 20 0012 COUNT 02FE REPORT036C 20 lC4F START 0345 PNTBAS0360 40 lE2F CRLF 0296 ENOIF2036E 4F lEAIiiOUTCH 0330 BASPTI036F 52 lE3B PR'rBYT 1il29CENDIFl0370 46 lE9E OUTSP 0290 IF30371 20 0200 OPMACH

02B4 ENOIF30372 20 0205 OPMCHI 02A9 THEN30373 20 034F SIGN 0347 l?NTBSl0374 20 0338 BASPNT 02E2 BYTCN'r0375 45 1'J21E001 02Fl HAfOP0376 5A 0220 IFI 02FB THREE0377 49 02B7 ENOOI 02fC 'rwo0378 53 0299 ELSI 02FO ONE

0235 'rHENl 11300REPTI~23B 'fHNIA 0331 00'fSP4~) .ENO 0242 002 0300 REJ?'f2~270 EN002 0334 OUTSJ?20256 EXP21 t135AHEADER0262 EXP22

Page 26: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 26/60

S I ZE F R O M T O F R O M ro S I G N I F 0 0 0 60 0 2 6 2 1 H l 0 2 0 5 2 4 0 0 0 4 0 5 2

x 0 0 0 7 2 0 6 9 2 0 7 B 4 0 9 3 4 0 A 5

x 0 0 0 6 2 0 9 9 2 0 A S 4 2 C 2 4 2 C EN o t e :

x 0 0 0 6 2 2 2 4 2 2 3 4 4 3 7 C 4 3 8 Cx 0 0 0 A 2 2 3 7 2 2 4 0 4 7 8 4 4 7 9 A i t e m s t a g g e d w i t h

x 0 0 0 B 2 7 4 E 2 7 6 1 4 7 9 0 4 7 8 0 a n 'x ' r e p r e s e n t

x 0 0 1 3 8 2 7 9 0 2 7 A C 4 7 B B 4 7 C [> . . f a l s e m a t c h e s .

0 0 7 A 2 8 0 1 2 9 B E 4 7 C F 4 8 B C0 0 0 8 2 9 B F 2 9 0 1 4 8 B C 4 8 C E

0 0 1 9 2 9 0 8 2 A 0 0 4 B C E 4 9 1 0 00 0 4 0 2 A 1 7 2 A C 6 4 9 2 0 4 9 0 C0 0 2 E 2 A C B 2 B 3 3 4 9 E l 4 A 4 9

0 0 3 5 2 8 6 E 2 B E 5 4 , 1 1 . 4 9 4 A C 00 0 0 C 2 8 F 2 2 C 0 4 4 A C O 4 A O F1 1 1 0 6 2 C E 2 2 F 0 1 4 1 3 2 7 4 0 4 6

SIZ E F R O M ro F R O M T O S I G N I F = 0 0 0 80 0 2 6 2 0 0 0 2 0 5 2 4 0 0 0 4 0 5 2I : H J 3 0 2 0 6 C 2 0 r ' 0 4 0 5 2 4 0 0 60 0 2 0 2 0 F 3 2 1 3 C 4 0 0 6 4 1 1 F0 0 l F 2 1 3 C 2 1 8 0 4 1 2 2 4 1 6 60 0 0 E 2 1 8 7 2 1 A 7 4 1 6 0 4 1 8 00 0 4 6 2 1 A A 2 2 4 0 4 1 9 8 4 2 3 B0 0 8 7 2 2 7 5 2 3 9 4 4 2 5 8 4 3 7 7

0 1 : ) 0 9 2 3 M 2 3 B B 4 3 8 F 4 3 A 20 1 2 6 2 3 C 0 2 5 E 6 4 3 A 2 4 5 C 8

0 0 4 C 2 5 F l 2 6 9 F 4 5 C 8 4 6 7 60 0 8 7 2 6 C l 2 7 C l 4 6 9 2 4 7 9 20 0 0 E 2 7 C 8 2 7 E 2 4 7 9 0 4 7 B 70 0 0 C 2 7 £5 2 7 F 9 4 7 8 B 4 7 C F0 0 7 A 2 8 0 1 2 9 B E 4 7 C F 4 8 B C1 1 0 0 8 2 9 B F 2 9 0 1 4 8 a C 4 8 C E0 0 1 9 2 0 ;, 0 B 2 A 0 0 4 8 C E 4 9 0 00 0 4 0 2 A 1 7 2 A C 6 4 9 2 0 4 9 0 C1 i i 0 2 E 2 A C B 2 B 3 3 4 9 E l 4 A 4 90 0 3 5 2 B 6 E 2 B E 5 4 A 4 9 4 A C I : )0 0 0 C 2 B F 2 2 C 0 4 4 A C O 4 A O F

0 0 8 7 2 0 £5 2 F 0 1 4 C 2 A 4 0 4 6

S I ZE f R O M ro F R O M T O S I G N l F 0 0 0 A

0 0 2 6 2 0 0 0 2 0 5 2 4 0 1 : Hj 4 0 5 20 0 3 0 2 0 6 C 2 0 F 0 4 0 5 2 4 0 0 60 1 ! l 2 0 2 0 F 3 2 1 3 C 4 1 1 0 6 4 1 1 F0 0 l F 2 1 3 C 2 1 8 0 4 1 2 2 4 1 6 60 0 0 £ 2 1 8 7 2 1 A 7 4 J . 6 0 4 1 8 01 1 0 4 6 2 1 A A 2 2 4 0 4 J . 9 8 4 2 3 B1j 0 8 9 2 2 7 1 2 3 ! : 1 4 4 2 5 4 4 3 7 70 1 2 6 2 3 C I 1 2 5 £6 4 3 A 2 4 5 C 8I : H J 4 C 2 5 F l 2 6 ! : 1 F 4 5 C 8 4 6 7 6

I H l 8 9 2 6 B C 2 7 C l 4 6 8 0 4 7 9 2

0 0 0 E 2 7 C 8 2 7 £ 2 4 7 9 0 4 7 8 7

0 0 0 C 2 7 E 5 2 7 F 9 4 7 B B 4 7 C F

0 0 7 A 2 8 0 1 2 9 B E 4 7 C F 4 8 B C

1 1 0 1 0 2 ' : 1 0 1 2 M J O 4 8 C 4 4 9 0 0

0 0 4 0 2 . 1 1 . 1 7 2 A C 6 4 9 2 0 4 9 0 C

0 0 2 E 2 A C B 2 8 3 3 4 9 £1 4 A 4 90 0 3 5 2 B 6 e ; 2 E E 5 4 f! , 49 4 AC 0l ' l 0 0 C 2 B F 2 2 C 0 4 4 l , C O 4 A O F( .\ 089 2 0 E l 2 F ! ' l 1 4 ( : 2 6 4 0 4 6

Page 27: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 27/60

)

A MEMOR Y TEST P R OG HA " FOR

THE COMMOD OR E P ET

Michael J . McCann2 8 R av en sw oo d T er ra ceC he ekt ow ag a, NY 14 225

I t w oul d b e use fu l an d co nv en ien t to be a bl e tot es t PET 's me mo ry w ith a t es tin g p ro gra m ra th ert ha n se nd ing th e ma chi ne ba ck t o C omm od or e f ors er vi ce. To wa rd s t hi s e nd I ha ve w ri tt en am emo ry t es t pro gr am in C om mo dor e B ASI C fo r th ePE T. The p ro gra m is we ll c om men te d, a nd sh ou ldbe se lf d ocu me nt ing . (se e li st ing)

Si nce t he pro gr am oc cup ie s t he lo we st 4K o fPE T's mem or y, us e o f t he pr og ra m wil l re qu ireth at th e l ow es t 4 K o f m em ory b e o per at in g nor m-al ly . Th e amo un t o f ti me r equ ir ed to r un th ispr ogr am r api dl y in cr ea ses as th e nu mb er of byt esu nde r t est i s inc re as ed (s ee F ig ur e 1.)

T es ti ng l arg e b lo cks o f me mor y re sul ts i n m or er ig or ous te sti ng a t th e exp en se of ti me . Th ere -f ore , w he n u si ng t hi s pro gr am the us er w illhav e t o m ake a d ec is ion re gar di ng ri gor v s.t ime . As a ba re mi ni mum , I wo ul d s ug ges t te st -

ing 100 by te s a t a ti me .

In c los in g I w ou ld su gge st tha t y ou g et th ispr ogr am up a nd r un nin g b efo re y ou hav e a p ro b-le m. It m ay pr ov e di ff icu lt t o g et a n ew pr o-g ra m w ork in g w hen y ou hav e a major s ys tem p rob -lem.

10 RE M ME MOR Y TE ST PR OGR AM FO R THE C OMM OD OR E PE T20 R EM PR OG RA M WI LL R UN ON 8K PE T30 RE M BY MI CH AE L J MCCANN4 0 P R IN T C H R$ (1 4 7) :E E =0 : I=050 IN PUT " STA RT AD DR ESS "· SA

60 I F S A<409 7 OR S A>65 535 GO TO 5070 IN PU T " ST OP AD DRE SS "· S P80 I F S T>655 35 OR SP<SA 'G OT O 7 09 0 P R IN T C H R$ (1 47 ): P RI NT : PR I NT1 00 P RI NT T AB ( 5 ) "W OR KI NG "1 05 P RI NT :P RI NT "F AU LT I N A DD RE SS :" ;1 10 REM M EM ORY AC CES S AN D LO GIC C IR CUI TR Y T EST1 20 R EM W RI TE A LL 013 0 FOR A=SA TO SP14 0 P OK E A ,O15 0 N EXT16 0 R EM CHE CK FO R C OR REC TN ES S (=0)17 0 F OR A=SA T O SP18 0 I F P EE K(A)<>O TH EN EE=1: GO SUB 80 019 0 N EX T20 0 R EM WR IT E AL L 2 55210 F OR A=SA T O SP22 0 P OK E A ,25 5

2 30 N EXT240 R EM C HE CK FO R C ORR EC TN ESS (=255 )25 0 F OR A=SA T O SP26 0 IF PE EK(A)<>25 5 T HE N E E=1:G OS UB 8 002 70 N EXT28 0 R EM BE AT TE STS29 0 R EM WR IT E AL L 0300 F OR A=SA TO SP310 POK E A, O32 0 NEX T33 0 REM B EA T ON E A DDR ES S WIT H 2 553 35 A D=S A+I340 POK E A D,2 55350 P OKE AD ,25 53 60 P OKE AD ,25 53 70 PO KE A D, 25 53 80 POK E A D, 25 5

39 0 RE M CH ECK A LL FO R 0 E XCE PT TH E AD DRE SSB EA T W IT H 2 55

40 0 F OR A=SA TO S P41 0 I F A=AD GO TO 4 3042 0 I F P EE K(A)<>O TH EN EE=1: GO SU B 8 004 30 NE XT44 0 I F AD=SP+1 TH EN PO KE AD ,O: 1=1+1: GOT O 3 3545 0 1=046 0 R EM W RIT E A LL 2 5547 0 F OR A=SA TO S P48 0 P OK E A ,2 5549 0 N EX T50 0 RE M BE AT ON E A DD RES S WI TH 05 05 A D=S A+I51 0 P OK E A D, 052 0 P OK E A D , 053 0 P OK E AD, O54 0 P OK E A D, O55 0 P OK E A D, O56 0 R EM CH ECK A LL FO R 2 55 E XCE PT T HE AD DRE SS

BE AT W IT H 057 0 F OR A=SA TO S P58 0 I F A=AD GO TO 60059 0 I F P EE K(A)<>255 TH EN EE=1: GO SU B 8 0060 0 N EX T61 0 I F AD<>SP+1 T HEN I=I+1:P OK E A D, 25 5:G OT O 50562 0 R EM AD DR ES SIN G T ES T63 0 RE M WR IT E C ONS EC UT IVE IN TEG ER S (0 -2 55) IN

A LL LO CA TI ONS UN DE R T ES T64 0 1=065 0 F OR A=SA TO S P66 0 IF 1=256 TH EN 1=067 0 P OK E A ,I6 80 1 =1 +1

69 0 N EX T700 R EM CH EC K FOR CO RR EC TNE SS70 5 1=071 0 FOR A=SA T O S P

72 0 I F 1=25 6 T HEN 1=073 0 I F P EE K(A)<>I TH EN EE=1 : GOS UB 8 0074 0 1 =1+175 0 N EX T76 0 P RIN T7 70 I F EE=O TH EN P RI NT " NO MEM OR Y PR OBL EM S D E-

TECTED"78 0 E ND80 0 P RI NT A;81 0 R ET URN

o /00 200 300

BYTES T£.5TF-D

Fi gur e 1. G ra ph of Lo g(Tim e R equ ir ed) vs .Nu mbe r of By te s T est ed . (T im e in S ec ond s)

I~~~~® 7:25

Page 28: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 28/60

SM ITHWARE FOR YOUR PET .

T E S T E D , R E L I A B L E S O F T W A R E

FROM S B S

S B 7 - - L I F E b y D r . F r a n k C o v i t z .F a s C " i n a t i n g s i m u l a t i o n o f c e l l c o l o n y g r o w t h . K a l e i d o s c o p i cp a t t e r n s . W r i t t e n i n m a c h i n e l a n g u a g e w i t h a B a s i c d r i v e r .1 - 2 g e n e r a t i o n s p e r s e c o n d ! T w o v e r s i o n s i n c l u d e d :L I F E 4 0 * 2 5 a n d L I F E 6 4 * 6 4 . O u t s t a n d i n g !

S B 5 - - B L O C K A D E .A r e a l - t i m e s p a c e w a r g a m e . D e f e n d t h e r e b e l s t r o n g h o l da g a i n s t b l o c k a d e b y t h e e v " i l e m p i r e . Y o u r s t a r c r u i s e r i s

t h e r e b e l s ' l a s t h o p e . S e e a l l t h e a c t i o n o n y o u r s c r e e n - -y o u r k e y b o a r d i s y o u r c o n t r o l p a n e l . A r e a l c h a l l e n g e r !

S B 4 - - U T I L I T Y P A C K A G E .A l l t h e r o u t i n e s y o u n e e d f o r r e l i a b l e t a p e I / O . P l u s at a p e d u m p , t a p e o u t p u t d e m o , t w o m a n o r y d u m p s ( D i s p l a ym e m o r y o n t h e s c r e e n i n h e x a n d A S C I I o r d e c i m a l a n d A S C I I ) ,a m e m o r y t e s t , a n d t w o s h o r t d e m o p r o g r a m s . W o r t h i t sw e i g h t i n g o l d !

S B 6 - - M O N I T O R .3 , 8 0 0 b y t e s f r e e f o r m a c h i n e l a n g u a g e p r o g r a m s . S a v e & l o a da b s o l u t e f i l e s , m o v e , v e r i f y , a n d d i s p l a y a b l o c k o f m e m o r y ,

e n t e r , j u m p t o p r o g r a m , g o - s u b t o s u b r o u t i n e . A l l i n h e xf o r m a t , w r i t t e n i n B a s i c . A m u s t f o r a n y s e r i o u s c o m p u t e rb u f f !

S B 2 - - S T A R T R E K .T h e c l a s s i c c o m p u t e r g a m e o f s t r a t e g y a n d t a c t i c s - - v e r yc o m p l e t e . D e f e n d t h e F e d e r a t i o n a g a i n s t t h e K l i n g o n m e n a c e !Y o u h a v e w a r p e n g i n e s , l o n g a n d s h o r t r a n g e s e n s o r s ,g a l a c t i c r e c o r d s , p h a s e r s , a n d p h o t o n t o r p e d o e s . B a t t l er a t i n g c o n t r o l s g a m e ' s d i f f i c u l t y . W A R N I N G ! T h i s g a m e m a yb e a d d i c t i v e !

S O M E O R A L L O F T H E S E F I N E C A S S E T T E S A R E A V A I L A B L E A T :T h e C o m p u t e r S t o r e , S a n t a M o n i c a , C a l i f o r n i aC o m p u t e r C o m p o n e n t s , V a n N u y s , C a l H o r n i aA d v a n c e d C o m p u t e r P r o d u c t s . S a n t a A n a , C a l i f o r n i aP e r s o n a l C o m p u t e r C o r p o r a t i o n . F r a z i e r , P e n n s y l v a n i a

O R S E N D C H E C K O R M O N E Y O R D E R T O :

S M I T H B U S I N E S S S E R V I C E SP . O . B o x 1 1 2 5

R e s e d a . C A 9 1 3 3 5

( C a l H o r n i a r e s i d e n t s a d d 6 % s a l e s t a x )

D e a l e r I n q u i r i e s I n v i t e d

' $ 1 0 . 0 0

$ 8 . 0 0

$ 8 . 0 0

$ 1 2 . 0 0

$ 8 . 0 0

Page 29: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 29/60

M I [ R O B E S , A 5 U t t E S T I O ~ , A ~ D A ~ . A P O l O G Y

H I C R ( ] J 8 E S

Ah, how often it is the things in life whichappear so simple that cause us great anguish andgnashing of teeth. We presen~ here what we hopeis the last microbe in '''A KIM Beeper" 4:43:

Th e beeper (MlClZo 5: Z4-JstLU

does,,·t beep - iT 0"'3 dick's ~

Th,~ res,dts .fYbll( the. EolZ~~a . : l J res» 01.0J > , Dperati"~ DfI two

iJentt.c.a1 opeYa"Js e.xce.p-t.for rite+irst iU~auDH t .K eect« "beef':

Thi~ res14{b iK a ee.robe.iK1

sforeJ Ik PB1J, i.e-, n» &1:J/ill!l --rhe lew-order bi.t- ~ A slco_lel

~ set:: ~e.~re ~c" EaR. '8KTJ

mbre si""P"~ f:olZ f'gp~STA fSJ)

m~!J f,e.. re.placeJ ~:I INC f'SJ>

(3ttd ~ lVof'~ ~ prt!St!"',e V & c bra.cIt)

" T h e . . 13~-to-c.k.anje 's testeJ

anA beep, ....S ih - t h e . . - " a c . " 3Yout\ .& .

Cej.:I t-ds"

12ahJ~ G-rdves

Even "Apple Pi" isn't simple any more! NeH O.Lipson of the Philadelphia Apple Users Group

writes that "The Pi article by Bob Bishop (MICRO6:15) is missing one thing. Add HIMEM:4096."But, that's not all' John Paladini writes that:"The value of Pi was not computed to 1000 deci-mal places, but ra the r 998. Such inaccurac iesoccur when computing a series where billions ofcalculations are required. My best guess is thatin order to calculate Pi to 1, DOD places usingthe given series one would have to compute to1,004 places. The last two digits should read89 not 96."

Although we made special efforts to make theMcCann article "A Simple 6502 Assembler for thePET" error free, including careful proofing byus and the author, a couple of microbes slippedthrough. C. E. White and David Hustvedt wrc t eabout the following problems:

1. After entering the program from the keyboardyour must save it on tape before going through"RUN" again. If you don't EN and Z Z are set tozero.

2. Errors in the typed1040 HX$+sX$ .4030 jMN$(lB)j .5020 jTAB(27) OP6060 .•. NULL,O,NULL,O6100 DATACLC,l, ...6120 .. JMI,3, •..6250 ... CPX, 2, ..•14350 GOTO 14380

listings/Bs/Bs/Bs/Bs/Bs/Bs/Bs/B

are:HX$=sX$jMN$(IB) jjTAB(27)jOPthree NULL,O'sDATACLI,l,•.. JMPI,3,., .CPXZ, 2,GOTO 14480

~----------~~ ~~~

3. When using the "BRK" command the system out-puts the error statement "ILLEGAL QUANTITYERROR IN 10020", READY.

A S l . D G G E S T H U I L

We finally heard from an 051 owner. JohnSheffield writes that the BASIC Disassembler forApple and PET by McCann (MICRO 5:25) can work onan OSI Challenger lIP with only a small change:"In each line where BY?; appears (lines 10, 30,3050) just change it to BY and everything worksfine. Change to read like this:10 DIM MN$(256),BY(256),CO$(16)30 READMN$(E),BY(E)

delete line 1003050 ON BY(IB) GOTO 3060,3090,4050

That's all that is needed. By the way that pro-gram works on rIP's with BK of RAMor more .. "I would be lead to believe that the BASIC Assem-bler would work with similar modifications.

John Sheffield had a "p.s." on his letter whichsaid "don't let the II P be bur ied under all :heApples and PETs". The staff of MICRO would loveto publish material about the 051 products, ifonly we had some to print' In our first year wereceived only two articles about 051. The firstwas one we "leaned on" a f r iend f' o r when ~lICROwas just starting and needed material. Thesecond was a scathing blast at 051 from top tobottom by an obviously disgruntled customer' We

do not publish stronqly negative material on

the basis of a single input, and therefore thisarticle was not published. If there are 051owners with something to share, MICRO will bemost happy to hear from you and print your info.

"IN! I l . P I I l I U I G Y

One Of the trade marks of MICRO has been qual-ity. We have made a great effort to obtain goodarticles and to present them in a high qualitypublication. We must therefore aco l cc ize forthe printing quality of MICRO number 6. By

the time we got the material back from theprinter, who had done a reasonably good Job onissues number 4 and 5, it was too late to doanything about the inferior quality Of the prod-uct except to throw out obv ious l y bad copies.We have gotten some letters and calls fromreaders \-Iho received incomplete or unreadcblecopies. If you have such a problem, pleasenotify us by mail indicating which pages weredefective, and we will promptly replace t + e m .

We apologize for the poor quality of is sur 6.We have changed printers starting with thisissue, and hope that the quality will be better.

7:27

Page 30: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 30/60

COMPUTERS H 0 P

288 NORFOLK ST . C AMBR IDGE , MASS . 02139 Jcorner of Hampshire & Norfolk St. 617-661-2670

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

C3-S1 Challenger III System withDual Drive Floppy Complete with 32K RAMMemory, Dual Drive

$3 590 00 Floppy, Serial Port, cabinets and power supplies.

,. This Challenger III features an eight slot heavy-:

duty main frame. You add only a serial

ASCII Terminal.

NO W W E H A V E 0 S I

C2·S2S 32K RAM Serial Challenger II withDual Drive Floppy Comes complete with 32K RAM Memory. Dual

$309000 Drive Floppy Disk (500,000 characters storage).,. 6502 processor and serial port. You add only a

serial ASCII Terminal to be up and running.

C2·S1S Serial Challenger II with

Single Drive Floppy Comes complete with 16K RAM Memory. SinglE!

$199000 Drive Floppy Disk (250,000 characters storage).

,. 6502 processor and serial port. You need to add

only Serial ASCII Terminal.

C2-S1V Video Challenger II withSingle Drive Floppy Comes complete with 16K RAM Memory. Single

$2 49000 Drive Floppy Disk, 6502 processor. Challenger

,. liP type Video Interface and high quality key-

board. You add only a Video Monitor (or RF

generator and tv set).

~ _ _;..... ._..._.",--"""...2.8P Offers all features of the Challenger liP plus more

Ch II liProom for expansion. The keyboard has a separate

a enger case with connector cable. The roomy cabinet

with 8 Slot Cabinet and heavy duty power supply are designed to

LJ. $82500 handle up to ei~ht system boards (allowing for E i_____ ..; .;..........,; .1 · slots of expansion).

BAC,V ISA,MC NO

SIGNATURE ...... , ..

N AME .

ADDRESS ..

C iTy ......

C2-4P

Challenger liP$598.00

K I M S A N D U P G R A D E SV F8 4K M emory assembled & tested 129.00

for low pow er RAM add 10.00

same in kit form 74.50

full se t o f sockets fo r K it 10 .00

V F8 Motherboard buffered fo r 4 Boards 65 .00

Connec tor A ssembly fo r K IM to V F8 20.008K S 100 M emory Board w ith instruc tions.1( 165.00

same but fu lly assembled and tested _ 199.00

CS100 C abinet cut out fo r K IM 129 . .00

3 Connec to r S100 M otherboard Assembly 75.00CGRS S100 TIM K it 129.00

CGRS S 100 6502 CP U Kit 179 .00

. .,,, CGRS S100 Fron t Panel K it 129.00

X ITEX V ideo Term inal Board 16X 64K 155.00

X ITEX V ideo Term inal Board A ssembled 185.00..· .. ··· .. · .. ···K IM -l 245.00

CS100 w ith CGRS,X itex ,16KRAM ,TV ,KB 1529.00

Same but A ssembled 1989 .00,,· .. ·· .... ·· ........ ·· .... .,PS-5 Pw r Supp. 5V 5A9V 1A -12V 1A6x 6X 2 75.00

PS-5 A ssembled 90.00

., ,. To tal o f O rder .. C irc le Item s wQ nted.~ .

M ass. R esidents Sales Tax 5% $ ..

Shipping, 1% ($2.00 m in.) $ ..STATE " " ZIP " Tota l Rem ittance or Charge $ )

____.J

Page 31: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 31/60

o

THE MICRO SOfTWA RE CATA L OG : IV

M ik e R -o weP. O . B ox 3

S o. C he lm sf or d, M A 01824

Na me : B ri d ge C ha l le ng e rS ys t em : P E T o r Ap p le IIM e mo ry : 8 K PE T o r 1 6 K A p pl e I IL an gu age : N ot s pec if iedH ar dwa re : N ot sp ec ifi ed

D es c ri pt i on : B r id ge Ch al l en ge r le t s y ou a nd t hed u mm y pl ay f o ur pe r so n Co n tr ac t B ri d ge ag a in stt he c om p ut e r. T he pr og r am w il l d ea l ha n ds a tr a nd om or ac c or d in g t o y ou r cr i te r io n f OI ' hig hca rd p oi n ts , an d y ou c a n s av e ha nd s on ca ss e tt ea n d r el oa d th e m f or l a te r pl a y. Y ou c an : re v ie wt ri cks , r ota te h an ds E as t- Wes t, sh uff le o nly t hede fe n se h an d s, or r e pl ay h an d s wh en th e ca r dsar e kn own .C op i es : No t s pe ci f ie dP ri c e: $ 14 .9 5I nc lud es : N ot s pe ci fie dA ut h or : N o t s pe ci f ie dA va il ab le f ro m:

P er so na l S of tw ar eP .O . B ox 1 36C am bri dge , MA 0 21 386 1 7 / 7 8 3 - 0 6 9 4

N am e: CU RS O R - Pr o gr a ms fo r P ET C om pu t er sS ys t em : P E TM e mo ry : 8 KL a ng ua g e: B AS I C a n d As s em bl y L an g ua geH ar d wa re : S ta n da r d P E TD e sc ri p ti o n: C UR S OR is a ca s se t te ma g az in e wi thp r ov en p ro g ra m s w ri t te n ju s t f or th e 8 K PE T.E a ch m o nt h t h e su bs c ri b er r ec e iv es a C - 30 ca s -s e tt e w i th f i ve or m o re hi g h qu a li ty pr o gr a msf or t h e P E T. Pe o pl e ca n 't re a d th is "m a gn et i cma g az i ne ", bu t t he P ET ca n! Th e C U RS O R s ta f fi ncl ud es pr ofe ss ion al p ro gra mm ers wh o de si gn a ndwr it e m a ny of th e pr o gr a ms . Th e y al so c ar e. f ul lye di t p r og ra m s wh i ch a re p ur ch a se d f ro m in d ivi d -u al a ut ho rs .

C o pi es : No t s pe ci f ie dP ri c e: $ 24 fo r 12 mo n th ly i ss u esI ncl ud es: C as set teA u th or s : M a ny a nd v a ri e dA va il ab le f ro m:

R on J ef fr ie s, P ub li sh erC U R S O RP . O. B o x 55 0Go l et a, C A 93 0 178 0 5 / 9 6 7 - 0 9 0 5

N am e : P E T S ch e ma t ic s a nd P E T RO M R o ut in e sS ys t em : P E TMe m or y : N on eL an g ua ge : N on eH ar d wa re : N on e

D es c ri pt i on : P E T S c hm at i cs i s a v er y c om pl e tese t of a cc ur ate ly an d pa ins tak in gly d raw n s ch em-a ti c s a bo u t y o ur PE T. It in cl ud e s a 24 " x 3 0"CP U bo ar d , p lu s o ve r si z ed d r aw in g s o f th e Vi de oM on i to r a nd Ta p e Re co r de r , p lu s c om pl e te P a rt sl ay o ut - a l l t he t hi ng s y ou h o pe d t o g e t fr o mC om mo do re , b ut d id n' t!

P E T R O M R ou ti n es ar e c om p le te a s -se m bl y l i st in g s o f al l 7 R OM s, pl u s id e nt if i eds ub ro ut in e e nt ry p oi nt s.Co p ie s : N ot sp e ci fi e d.P ri c e: PE T Sc he m at i cs - $3 4 .9 5

PE T R O M Ro u ti n es - $ 1 9. 9 5A va il ab le f ro m:

P ET -S HA CK S of tw ar e H ou seM ar ket ing a nd R ese arc h Co .P. O . Bo x 9 6 6M is ha w ak a , IN 4 65 4 4

N am e : S- C A ss em b le r IIS y st em : A p pl e I IMe mo r y: 8KL an gua ge : A ss emb ly la ng uag eH a rd wa r e: A pp l e I I , o p ti on a l pr i nt er

D es cri pt ion : C omb in ed te xt e di to r an d a sse mb lerca re ful ly in teg rat ed w it h t he A ppl e I I R OM- ba sedro ut i ne s. Ed i t or in cl u es f u ll A p pl e I I sc r ee ne di t in g, B AS I C- l ik e li n e- nu m be r ed i ti n g, ta bs t op s, a nd re nu m be r in g. LO AD , SA VE , a nd AP PE N Dco m ma nd s fo r c as se t te st or a ge . S ta n da rd A pp l eI I sy n ta x fo r op co d es an d a dd r es s m od e s. L ab e ls(1 to 4 ch ara ct ers ), ar it hme tic ex pre ss ion s, a ndc om me n ts . En g li sh l a ng u ag e e r ro r m e ss ag e s.Mo n it or c om ma n ds di re c tl y a va i la bl e w it h in a s-s e mb le r . S pe ed a nd s us p en s io n c o nt r ol o ve rl is ti ng a nd a ss em bl y.C o pi es : Ju s t re l ea se d , ov e r 10 0 so ld .P r ic e: $ 2 0. 00 (T ex a s r es id e nt s a dd 5% ta x )I n cl ud e s: C as s et t e in Ap p le I I f o rm a t an d

a 2 8 p a ge r e fe re n ce m an ua l .A ut ho r: B ob S an de r- Ce de rl ofA va il ab le f ro m:

S -C S of tw ar eP . O. B ox 55 3 7R ic ha rd so n, T X 7 50 80

Na me : PL / 65 o r C SL / 65

S ys te m : S Y ST EM 6 5 o r P DP 1 1M em o ry : 16 K b yt e s RA ML an gu ag e: M ac hi ne l an gu ag e.H ar d wa r e: Ro c kw e ll SY S TE M 6 5D e sc r ip ti o n: A hi gh - le v el l an g ua ge r es e mb li n gP L/ l a nd A L GO L is n ow a v ai l ab le t o d es ig n er s de -v el o pi n g pr o gr a ms f or t he 6 50 0 mi c ro p ro ce s so r

f am il y us in g ei t he r th e S YS TE M 65 d ev el o pm e nts ys te m of th e P DP 11 c o mp ut e r. P L/ 6 5 is c on s id -e ra b ly e as ie r to u s e t h an a s se m bl y la ng u ag e o ro bje c t c o de . T he PL / 65 co m pi le r ou t pu t s s o ur cec o de to th e SY S TE M 65 ' s r es i de nt a s se m bl er .T h is p e rm i ts en ha n ci ng o r de b ug g in g at t he a s-s em b le r l e ve l b ef or e o bje ct c o de is ge ne r at e d.I n ad d it io n , P L/ 65 st at e me nt s ma y b e m ix e d wi tha ss e mb l y l an g ua ge i n st ru c ti o ns f or t im in g o rc o de o p ti m iz a ti o n.C op ie s : N o t s pe c if ie d .P ri ce : No t s pe c if ie d fr om Ro c kw el l .

$ 500 f ro m C OM PAS .I nc lu de s: M in if lo pp y d is ke tt e.Au tho rs : N ot s pe cif ied .A va il ab le f ro m:

E le ct ro ni c D ev ic es D iv is io nR o ck w el l I n te r na t io n sa l

P .O . B ox 3 6 69A na hei m, C A 9 280 37 14 /6 32 -2 32 1 (L eo S ca nl on )2 13 /3 86 -8 77 6 (D an S eh lo sk y)

CO MPA S - C om put er Ap pl ica tio ns Co rp .4 13 K el lo ggP .O . B ox 68 7A me s , IA 5 00 1 05 15 /2 32 -8 18 1 (M ic ha el R . C or de r)

Page 32: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 32/60

Name: PRO-CALISystem: PET

Memory: Not specified.Language: BASICand machine language.

Hardware: Not specified.Description: A reverse polish scientific

calculator program, ideally suited for scientif-ic and educational applications. Supports sing-

le key execution of more than 50 forward and in-verse arithmetic, algebraic, trigonometric and

exponential functions. It implements calcula-

tions in binary, octal, decimal, and hexidecimalmodes with single keystroke conversion betweenmodes and simul taneous decimal equi valen dis-play. It also allows the recording and playbackof calculator programs on cassette tape permit-ting the use of most calculator software already

in existance up to a limit of 255 steps.Copies: Not specified.Price: $26.00 domestic, $28.00 foreign.Includes: Software on cassette and an operating

manual.

Authors: Not specified.Available from:

Applications Research

13460 Robleda Road

Los Altos Hills, CA

I

Co.

94022

Name: Financial SoftwareSystem: Apple II (easily modified for PET)

Language: Applesoft IIHardware: Apple II

Description: Sophisticated financial programsused to aid in investment analysis. The follow-

ing programs are currentl y available: Black-Scholes Option Analysis, Secur Lt y Analysis using

the Capital Asset Pricing Model, Bond PriCing Iand II, Cash Flow and Present Value Analysis Iand II, Stock Valuation, Rates of Return, Calcu-

lations and Mortgage Analysis.Copies: Just released.

Price: $15.00 each or $50.00 for all g programs

Includes: Cassette, annotated source listings,

operating and modifying instructions,sample runs and backgroud informati.on.

Author: Eric RosenfeldAvailable from:

Eric Rosenfeld

70 Lancaster RoadArlington, MA 02174

Name: MICROCHESSSystems: PETand Apple IIMemory: PET - 8K/Apple II 16K

Language: 6502 Machine LanguageHardware: Standard PET or Apple II

Description: MICROCHESSs the culmination oftwo years of chessplaying program development by

Peter Jennings, author of the famous 1K bytechess program for the KIM-1. MICROCHESSofferseight levels of play to suit everyone from thebeg inner- learning chess to the serious player.

It examines positions as many as 6 moves ahead,and includes a chess clock for tournament play.Every move is checked for legality and the

current position is display on a graphic chess-board. You can play White or Black, set up andplay from special board positions, or even watch

the computer play against itself.

Copies: Not specified.

Price: $19.95Includes: Not specified.

Author: Peter JenningsAvailable from:

Personal Soft ware

P.O. Box 136Cambridge, MA02138

617/783-0694

Name: Apple II BASEBALL

System: Apple IIMemory: 16K or more

Language: Integer BASICHardware: Standard Apple II

Description: An interactive baseball game thatuses color graphics extensively. You can playa

7 or 9 inning game with a friend, (it will han-dle extra innings), or play alone against the

computer. Has sound effects with men runningbases. Keeps track of team runs, hits, innings,

balls and strikes, outs, batter-up and uses pad.-dle input to interact with the game. Uses evecyavailable byte of memory.Copies: Just released.

(Dealers inquiries invited)Price: $12.50

Includes; Game Cassette, User Bookelt with corl-plete BASIC listing.

Authors: Pat Chirichella and Annette NappiAvailable from:

Pat Chirichella

50 6 Fairview AvenueRidgewood, NY 11237

Name: DDT-65 Dynamic Debugging Tool

System: Any 6502 based system

Memory: 3K RAM/1KRAMfor loaderLanguage: Machine LanguageHardware: 32 char/line terminal

Description:: DDT-65 is an advanced debuggertha t allows easy assembl y and disassembl y in

650X mnemonics. Software single-stepping andautomatic breakpoint insertion/deletion allow

debuffing of code even in PROM. DDT-65 comes ina relocatable form on tape for loading into any

memory or for PROMprogramming.

Copies: 11...Price: $25.00Include: 10 page manual, relocating tape

cassette.Ordering Info: KIM format cassette - KKansas City at 300 baud for OSI - 0

Kansas City at 300 baud for TIM/JOLT - TAuthor: Rich ChallenAvailable from:

Rich Challen939 Indian Ridge DriveLynchburg, VA 24502

Page 33: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 33/60

APPL[ CALLS AND H[X-D[CIMAL CONVERSION

Marc Schwartz220 Everit StreetNew Haven, CT 06511

Rich Auricchio's "Programmer's Guide to theApple II" (MICRO 14, AprillMay 1918) is a veryuseful step in getting out printed materials to

help users fully exploit the Apple's potential.That his table of monitor routines can be usedin BASIC programming is worth noting.

Many monitor routines can be accessed in BASICby CALL commands addressed to the location ofthe first step of the routine. If the routine

is located in hex locations 0000 to 4000, it isnecessary only to convert the hex location todecimal and write CALLbefore the decimal num-ber. Thus a routine located at hex lE would be

accessed by the command: CALL30, since hex 001E= decimal 30.

If you do nat have a hex-decimal conversiontable handy, you can convert larger numbers todecimal with the help of the Apple by the fol-lowing steps:

1. Start in BASIC (necessary for step 2)

2. Multiply the first (of four) hex digi.tsby 4096, the second by 256, the third by 16 andthe fourth by one. Add the four numbers to getthe decimal equivalent. For example, to get the

decimal conversion of 03E7, with the Apple inBASIC, press ControllC and type

)PRINT 0*4096 + 3*256 + 14*16 + 1then press RETURN. You'll get your decimal

answer: 839. To begin a monitor routine youwrote starting at 03E1, merely put CALL839 in,your program.

If the hex location of the routine is between

COOOand FFFF, then another method of figuringout the corresponding decimal location must beused.

1. Start in BASIC

2. Press the RESETbutton.

3. Take the hex location of the routine andsubtract if from FFFF. The Apple will help you

do this; subtract each pair of hex digits fromFF and press RETURN. The Apple will print theanswer to each subtraction for you. For examplethe hex location of the routine to home cursorand clear screen is $FC58.

* FF - FC RETURN

= 03* FF - 58 RETURN

= A1

S o , $FFFF - $FC58 = $03A1.

Now convert to decimal as above, using BASIC

(control/C) to assist you.

)PRINT 0*4096 + 3*256 + 10*16 + 1

and after pressing RETURNyou will have your

answer, 935.

4. Add one to the total, here giving 936.5. Make the new total negative, or -936.

6. That's it. Now just put a CALLin front

of the number: CALL-936.

Of course, these steps of converting hex loca-

tions to decimal are the same ones to take if

you want to access the PEEKor POKE functions of

the Apple. In all, they allow the BASIC pro-grammer to take much fuller advantage of thecapabilities of the computer.

And while on the subject of hex-decimal conver-sion, the Apple can help in decimal to hex con-

version as well. For example to find the hex ofa number, say 8165:

1. Start in BASIC

2. Divide the number by 4096, then find the

remainder:

)PRINT 8165/4096,8165MOD4096 (return)

2 513

3. Repeat the process with 256 and16:

)PRINT

2)PRINT

3

513/256,513MOD256 (return)61

61116, 61 MOD16 (return)

13

... giving 2 2 3 13 or 223C.

Q

WRITING FOR M I ~ R O

One of the reasons we 1ike the 6502 is that it

seems to attract a lot of very interesting, act-ive, enthusiastic users. We spend several hourseach week talking to people who are so excitedabout what they are doing with thei.r system thatthey just have to talk to someone. Oh, some-times they pretend they have some "burning"question or whant to order some small item, butreall y they most 1y want to te 11 someone aboutall of the fun they are having or the discover-ies they are making.

While we enjoy these conversations, and considerthem one of the "Fringe benefits" of editingMICRO, it disturbs us that many of these enthus-iasts who are willing to spend five to ten dol-lars on a phone call to us, are not willing tospend a little time writing down their informa-

~ ~ - - - - - - - - - - - - - - - - - - - - -

tion for publication in MICRO where thousands

can share it (and they can earn a few dollars).

MICRO, in order to serve its main purpose ofpresenting information about all aspects of the6502 world, needs to rece i ve information from awide variety of sources. To achieve a more bal-anced content, we desparately need articles on:industrial, educational, business, home, andother real applications of systems; non-KIM,-A,PPLE, -PET systems, homebrew and commerc ial;techniques for programming, interfacing, and ex-panding systems; and many other topics. Look toyour own exper ience. If you have anything toshare, then take the time to write it down. The"Manuscript Cover Sheet" on the next page should

serve as a guide and make it a little easier tosubmit your article.

-

Page 34: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 34/60

M A N U S C R I P T C O V E R S H E E T

P l e a s e c o m p l e t e a l l i n f o r m a t i o n r e q u e s t e d o n t h i s c o v e r s h e e t .

D at e S ub mi tt ed :

P ro po se d T it le :

A ut ho r(s ) N am e(s ):

M ai li ng A dd re s s:

(T h i s w i l l b e p u b l i s h e d . )

A r e a C o d e : P h o n e :

(T h i s w i l l N O T b e p u b l i s h e d . )

A U T H O R ' S D E C L A R A T I O N O F O W N E R S H I P O F M A N U S C R I P T R I G H T S : T h i s m a n u s c r i p t i s m y / o u ro r i g i n a l w o r k a n d is n o t c u r r e n t l y o w n e d o r b e i n g c o n s i d e r e d f o r p u b l i c a t i o n b ya n o t h e r p u b l i s h e r a n d h a s n o t b e e n p r e v i o u s l y p u b l i s h e d i n w h o l e o r i n p a r t i n

a n y o t h e r p u b l i c a t i o n . I / w e h a v e w r i t t e n p e r m i s s i o n f r o m t h e l e g a l o w n e r (s ) t ou s e a n y i l l u s t r a t i o n s , p h o t o g r a p h s , o r o t h e r s o u r c e m a t e r i a l a p p e a r i n g i n t h i sm a n u s c r i p t w h i c h i s n o t m y / o u r p r o p e r t y . I f r e q u i r e d , t h e m a n u s c r i p t h a s b e e nc l e a r e d f o r p u b l i c a t i o n b y m y / o u r e m p l o y e r (s ). N o t e a n y e x c e p t i o n s t o t h e a b o v e(s u c h a s m a t e r i a l h a s b e e n p u b l i s h e d i n a c l u b n e w s l e t t e r b u t y o u s t i l l r e t a i no wn e rs hi p ) h er e:

S ig na tu re (s ) :

D a t e :

A n y m a t e r i a l w h i c h y o u a r e p a i d f o r b y T h e C O M P U T E R 1 S T , w h e t h e r o r n o t i t i sp u b l i s h e d i n M I C R O , b e c o m e s t h e e x c l u s i v e p r o p e r t y o f T h e C O M P U T E R I S T , w i t h a l lr ig ht s r es er ve d.

A F e w S u g g e s t i o n s

A l l t e x t m a t e r i a l w i l l b e r e t y p e d . T h e r e f o r e y o u r f o r m a t d o e s n o t m a t t e r a s l o n g

a s i t i s r e a d a b l e . D o u b l e s p a c e d , t y p e d , i s p r e f e r a b l e , b u t n o t r e q u i r e d . A n yf i g u r e s s h o u l d b e n e a t l y d r a w n £0 s c a l e a s t h e y w i l l a p p e a r i n M I C R O . I f w e h a v et o r e d r a w t h e f i g u r e s a n d d i a g r a m s , t h e n w e n o r m a l l y w i l l p a y l e s s f o r t h a t p a g e .P h o t o g r a p h s s h o u l d b e g l o s s y p r i n t s e i t h e r t h e s a m e s i z e a s t h e f i n a l w i l l b e o rt w i c e t h e f i n a l s i z e . W e w i l l r e - a s s e m b l e a l l p r o g r a m s t o o b t a i n c l e a n l i s t i n g s

u s i n g t h e s y n t a x w e h a v e a d o p t e d (s e e i n s i d e b a c k c o v e r - M I C R O 11). S in ce o t he rsw i l l b e c o p y i n g y o u r c o d e , p l e a s e t r y t o t h o r o u g h l y t e s t i t a n d m a k e s u r e i ti s a s e r r o r f r e e a s p o s s i b l e . S u b m i t y o u r a r t i c l e s e a r l y . W e w i l l t r y t o g e t a

p r o o f b a c k t o y o u f o r f i n a l c o r r e c t i o n , b u t w i t h o u r t i g h t s c h e d u l e t h i s m a y n o ta l w a y s b e p o s s i b l e . S e n d y o u r m a n u s c r i p t s t o :

R o b e r t M . T r i p p , E d i t o r , M I C R O , P . O . B o x 3 , S o . C h e l m s f o r d , M A 01824, U . S . A .

Page 35: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 35/60

6 S0 2 B IB L IO G R A PH'PART VI

William R. Dial43 8 Roslyn Ave.

Akron, O H 44 32 0

361. Bridge, Theodore E. "High Speed Cassette I/O for the KIM-I", DDJ3 Issue 6 No 26, Pg 24-25,

(June/July, 1978). Will load or dump at 12 times the speed of KIM-l. Supplements the

MICRO-ADEEditor-Assembler.

362. Baker, Robert "KIMER: A KIM-l Timer", Byte 3 No 7 Pg 12, (July, 1978). The program converts

the KIM-l into a 24-hr digital clock.

363. Conley, David M. "Roulette on Your PET with Bells and Whistles", Personal Computing 2. No 7 Pg 22-24 (July, 1978). How to add extras in a program for added interest.

364. KIM-l/6502 User Notes, Issue 11, (May, 1978)

Lewart, Cass R. "An LEDProvides Visual Indication of Tape Input". An LEDallows you to see

that the tape recorder is feeding proper Signals to KIM.

Rehnke, E. "Hardware Comparison". The editor compares KIMSI vs. KIM-4 as expansion for KIM.

Rehnke, E. "Software Comparison". The editor compares the MOSTechnology Assembler/Editor

from ARESCOversus the MICRO-ADEAssembler/Disassembler/Editor from Peter Jennings,

Toronto.

Edwards, Lew "Skeet Shoot, with Sound". Butterfield's "Skeet Shoot" modified with the Kush-

nier's phaser sound routine, for KIM.

DeJong, Marvin "Digital Cardiotachtometer". KIMcounts heartbeats per minute and displays

count while measuring next pulse period.Rehnke, E. "Book review: 'Programming a Microcomputer: 6502'". Foster Caxton's recent book

is highly recommended.

Coppola, Vince "Loan Program in FOC.A.L". FOCAL-65 is used to figure interest on a loan.

FIacco, Roy "Joystick Interface". A joystick, some hardware, are used to put the Lunar

Lander (First Book of KIM) on the face of a Scope.

Kurtz, Bob "Morse Code Reader Program". Use KIM in the hamshack.

Zuber, Jim "Interfacing the SWTPCPR-40 Printer to KIM-l". An easy way to use this low cost

printer.

Nelis, Jody "Revision to Battleship Game". Modification to correct a small defect in the

original program.

365. People's Computers 1. No 1 (July/Aug, 1978).

Cole, Phyllis "SPOT". Several notes and tips of interest to PET owners.

Cole, Phyllis "Tape Talk". Notes on problems associated with tape I/O on the PET.

Gash, Philip "PLOT". Program plots any single-valued function s! x) on a grid.

Julin, Randall "Video Mixer". A circuit to mix the three video signals put out by thePET's IEEE 488-bus.

Bueck/Jenkins "PETting a DIABLO". How to make PET write using a Diablo daisy wheel printer.

366. Harr, Robt. Jr. and Poas , Gary F. "TV Pattern Generator", Interface Age 3 Issue 8 Pg 80-82; 160,

(Aug, 1978). Pattern generator in gr-apht.cs for the Apple II monitor.

367· Per~onal Computing 2. No 8 (Aug, 1978) .

..Maloof, Darryl M. "PET Strings" (letter to Editor). Note on changing a character string

to numeric values and vice-versa.

Connors, Bob "PET Strings" (letter to Editor). More on changing character strings to

numeric values.

Bueck/Jenkins "Talking PET" (letter' to the Editor). Notes on the interfacing of a Diablo

daisy wheel printer with PET t.hr-ough the PET ADAdevice.

368. Lasher, Dana "The Kalculating KIM-l", '1 3 MagaZine, No 215 Pg 100-104 (Aug, 1978). Calculator

versatility for any KIM is provided by interfacing a calculator chip and a scanning routinewith KIM.

369. OSI-Small Systems Journal 2. No 2 (Mar/Apt', 1978).

Anon. "The 542 Polled Keyboard Interface". Polled keyboards have many advantages over

standard ASCII keyboards.

Anon. "Basic and Machine Code Interfaces". This is the first in a series of articles on

BASIC and machine code.

Anon. "Using the Model 22 OKIDATAPrinter", A quick and dirty way to use those special

font and scroll commands of the Model 22 OKIDATAPrinter.

Page 36: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 36/60

3 7 0 . D r . D o bb s J o ur n a l .3 .Is s u e 7 N o 2 7 (A u g , 1 9 7 8).M os e r , C a r l " F a s t C as s e t t e I n t er f a c e fo r t he 6 5 0 2 ". R e c o rd a n d l o a d a t 1 6 0 0 ba u d .M ey e r , B e n n et t "Y e t A no t h e r 6 50 2 Di s a s s em b l e r F i x " . Ch a n g es t o co r r e ct a n u m b e r o f e r r o rs

i n t h e f iv e d i g i t c od e s u se d f o r d e c i ph e r i n g th e i n s t ru c t i o ns i n t h e B A S IC l a n g ua g ed is a s s e mb l e r pu b l i s he d ea r l i e r i n D D J . 3 . No 1 .

A no n . " A p p le U s er s C a n A c ce s s D o w J o ne s I n f or m a t i on S e r vi c e " . W i th a te l e p ho n e l i nk - u p ,Ap p l e II u s e rs ca n d i a l D o w J o n e s I n f o r ma t i o n S e r v i ce .

3 7 1. K i l o b au d I s s u e 2 1 (S e p t , 1 97 8).W el l s , R a l p h " T ro u b l e S ho o t e rs ' C o r n er " . A n o t h er ch a p t e r i n t h e s a g a o f t h e c om p a t i bi l i t y

o f th e A p p le I I w i t h a V IA / P I A . S e e E DN M ay 2 0 ,1 9 7 8; M I C RO I s s ue 5 , P g 1 8 , J u ne / J u l y,

1 9 7 8 .T e nn y , R a l p h " T r ou b l e s ho o t e r s' G u i d e" . Us e f u l s u g g es t i o n s f o r t h os e t a c k l in g r e p a ir a nd

i nt er fa ci ng p ro bl em s.

Y o un g , Ge o r g e "D o - I t- A I I E xp a n s i on B o a r d f or KI M " . H o w t o m a k e an e x pa n s i on b oa r d , e x p a n -s io n p o we r s u pp l y , n e w e nc l o s u re , e t c. , f o r y o ur K IM - l .

K et c h u m, D o n " K IM O r ga n " . P l a y t u ne s d i re c t l y f ro m t h e K I M ke y b o a rd .

G r in a , J a m e s " S up e r C h e a p 2708 P ro g r a m me r " . A n ea s y - t o- b u i l d P R O M pr o g r a mm e r d r i v e n by

th e K IM -l.

37 2 . C o n w ay , J o h n " G l i t ch e s C a n T u r n Y ou r Si m p l e I n t e r fa c e T a s k i n t o a Ni g h t m ar e " . Di f f i c ul t i e si n u s i n g a n A p pl e II w i t h a P I A i n a n I / O i n t er f a c e, a p p a re n t l y c a u se d b y a c l o ck s i g na la r ri v i n g a l i tt l e e a r ly .

3 7 3 . No t l e y , M. G ar t h " P l u gg i n g t h e KI M - 2 G a p ". B y te . 3 . No 9 P g 1 23 (Se p t , 1 9 7 8). H o w t o m ap t h e

K I M- l a d d r e ss r a n g e o f 0 4 00 to 1 3F F in t o a K I M- 2 a d dr e s s r a n ge o f 1 0 00 t o l F F F.

3 7 4 . T u r ne r , B i l l a n d Wa r r e n , C a r l "H o w t o L o a d F lo p p y R O M N o 5 " , I nt e r f a ce A g e . 3 .N o 9 Pg 6 0- 6 1(S e p t , 1 9 7 8). S i d e N o 1 is i n A p p le I I f or m a t at 1 20 0 b au d , " T h e Au t o m at e d D re s s P a t t e rn " .

3 75 . Sm i t h , W m . V . R. II I " T h e Au t o m at e d D r e s s P at t e r n f o r t h e A p pl e I I " . I nt e r f a ce A g e. 3 . No 9P g 7 6 - 8 1 (S ep t , 1 9 7 8). A M c C a l ls p a tt e r n i s th e b a s is f o r t he p ro g r a m a n d a c co m p a ny i n gF lo pp y R OM.

3 7 6 . M I C R O I ss u e 6 (A u g / S ep t , 1 9 7 8).H u s ba n d s , C h a rl e s R . " De s i g n o f a P E T / TT Y In t e r f ac e " . D e sc r i b es t h e h a rd w a r e i n t e rf a c e a n d

s o f tw a r e to u s e t h e A S R 3 3 T e l e ty p e a s a p r in t i n g f a c i li t y f o r t h e PE T .F a r a da y , M i ch a e l " S ha p i n g Up Y ou r A p p l e" . I n f or m a t i on o n u s i n g A pp l e I I ' s H i g h R e s ol u t i o n

G r a p h i c s .E l i a so n , A n dr e w H. " A pp l e I I S ta r w a rs T h e m e" . D i sa s s e mb l e r l i s ti n g of t h em e f r om S t ar W a r s.

Bi s h o p, Ro b e r t J . "A p p l e P I " . H o w t o c a l c u la t e P I t o 10 0 0 p la c e s o n y o u r A p pl e I I .

M cC a n n , Mi c h a el J. " A S i m p le 6502 A ss e m b l er fo r t h e P E T" . L ea r n t o us e M a c h in e la n g u a gew it h t hi s a ss emb le r.

R o w e , M i ke " Th e M i c ro S o f t wa r e C a t a lo g : I I I ". S o f tw a r e l is t i n g f or 6 5 02 s ys t e m s .G as p a r , A lb e r t "A De b u g g in g A i d f o r th e KI M - l ". A pr o g r a m d e s ig n e d to a s si s t t he u s e r i n

d eb ug gi ng a nd m an ip ul at in g p ro gr am s.

De Jo n g , M ar v i n L . "6502 I n t er f a c i ng f o r Be g i n ne r s : Ad d r e s s D ec o d i n g II " . G o o d t u to r i a la r t i c l e .

Su i to r , R i c h ar d F . " Br o w n a nd W h i te a nd C o l or e d A l l O v er " . D i s c u ss i o n o f t h e c ol o r s i n t h eA p p l e a n d t h ei r re l a t i on t o e ac h o t h e r a n d t h e c ol o r n u m b er s .

W i tt , J a me s R . " P ro g r a mm i n g a M ic r o - Co m p u t er : 6 5 02 b y C a x to n F o st e r " . Mo r e a c c o l ad e s f o rth i s f i n e b oo k .

M e r r i tt , C a l E . " P E T C o m p os i t e V i d eo O u tp u t " . Ho w t o g et v i d eo ou t p u t f o r a d di t i o na lm o n i t o r s .

Qu o si g , K a rl E . " P o w er f r om t he P E T " . H o w t o t a p th e u n r eg u l a t ed 8v an d r e g ul a t e t o 5 v.S u it o r , R i ch a r d F . " A p p l e I nt e g e r B A S I C S u br o u t in e P a ck a n d L oa d " . L o a d in g a s s e mb l y

l a n gu a g e p r o gr a m s w it h a B A S I C p ro g r a m .C r ei g h t o n, G a r y A . " A P ar t i a l L is t o f P E T Sc r a t c h P a d M e m o ry " . T a b u la t i o n o f a n u m be r o fi m po r ta n t a d dr e ss e s.

3 77 . C o r b e tt , C . " A M i gh t y M I C R O MI T E " . P e r so n a l Co m p u t er W or l d .1 N o 4 Pg 1 2 (Au g , 19 7 8). D e scr-Lpt.Lve

a r t i c le o n t h e K IM - l f or t h e E u ro p e a n a n d Br i t i sh r e a d e rs .

3 78 . C o l l , J o hn a n d S w e e te n , C ha r l e s " C ol o u r is a n A p pl e I I " . Pe r s o n al C o mp u t i n g Wo r l d .L No 4 P g5 0 - 55 (A ug , 1 97 8). D es c r i p ti o n of th e A p p l e II .

3 79 . N o rt h , S t e v e " P ET C as s e t t es fr o m Pe n i n s ul a S ch o o l " . Cr e a t i ve C o mp u t i n g. ! ! .N o 5 P g 68 (S ep t / O c t,19 7 8). A n u m b e r o f p r og r a m s w r i t te n i n P IL O T , a la n g u a ge d e s i gn e d f o r C A l d i a l og ap p l i 8 a-t i o n s . T h i s r e q u ir e s a p r o g r am t o i nt e r p r et P I LO T i n Ba s i c .

Page 37: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 37/60

o

65~2 I~F~R"ATIO~ RESOURCES

W il l ia m R . D i al438 R os ly n A ve .A k ro n, OH 44320

D i d yo u e ve r w on d er ju st wh a t m ag a zi ne s we re t h er i ch e st so ur c es of in fo r ma t io n on t he 65 0 2m ic ro pr oc es so r, 6 50 2- ba se d m ic ro co mp ut er s, a cc -e s so r y h ar d wa r e an d so ft w ar e? Fo r s e ve r al y ea rst hi s w r it e r h as b e en as s em bl i ng a b ib l io gr a ph y6 50 2 r e fe r en ce s r e la t ed to ho bb v c om o ut er s an d

s ma l l bu s in es s sy s te ms (se e MI C RO N o 's 1 , 3 ,4, 5, a nd 6). A r ev ie w of th e n u mb e r of ti me sv a ri o us m ag az i ne s a re ci t ed in th e b ib l io gr a ph ygi ve s a ro ug h m ea su r e o f t he co v er a ge of t he sem ag a zi ne s o f 6 50 2 r el a te d su bje ct s . E ve n a ft e rs uc h a fe q ue nc y c h ar t is co m pi le d , a n ac c ur at ec o mp a ri so n i s d if fi c ul t . So me o f th e ma ga z in e sh a ve b ee n pu bl i sh ed l o ng er t ha n o t he rs . S om ep eri odi ca ls h av e b ee n d is con ti nue d, ot he rs h av ebe e n me r ge d w it h c on ti n ui n g p ub li c at io n s. S om egi v e a lo t o f i n fo r ma ti o n in t he f o rm of a d s,o th e rs ar e d e vo te d m o st l y to au th o re d ar ti c le s .Re ga r dl e ss o f th e b as i s o f th e t ab u la t io n o fre fe r en c es , h ow e ve r , so m e p ub l ic at i on s ar ecl e ar l y mo r e us ef u l so u rc es of i n fo rm a ti o n o nth e 6 50 2 t ha n ot h er s .

B Y T E$ 1 2. 0 0 p er ye a r

B yt e P ub li ca ti on s, I nc .70 M ai n S t .P et er bo ro ug h, N H 0 34 58

DR . D OB B'S JO URN AL$ 1 2. 0 0 p er y e ar (10 is s ue s )

P eo pl e' s C om pu te r C o.Bo x E12 63 E l C a mi no R ea l

Me n lo Pa rk , C A 9 4 02 5

O N - L I N E$ 3. 7 5 pe r y ea r (1 8 i s su es )

D . H . Be e tl e

2 4 69 5 Sa n ta Cr u z Hw yLo s G at o s, C A 95 0 30

P EO PL E' S C OM PU TE RS (F or me rl y P CC )$ 8 .0 0 p er y e ar (6 i s su e s)

P eo pl e' s C om pu te r C o.1 2 63 E l C am i no R ea lBo x EM en l o P ar k , C A 9 4 02 5

Th e ac c om p an yi n g l is t of m ag a zi ne s ha s b ee n

co m pi l ed f r om t he b i bl i og ra p hy . A t th e to p o fth e l ist a re s eve ral p ubl ica ti ons wh ich s pe ci al-i z e i n 6 50 2- r el a te d s ubjec ts . Th e se i n cl ud eth is p ub l ic a ti on , MI C RO , a s w el l a s t he K IM - 116502 US E R NO T ES . Al s o i n t h is c at eg o ry isOH IO SC IE N TI F IC 'S S M AL L S YS T EM S JO UR N AL , apu bl i ca t io n w h ic h co ve r s h a rd wa r e a nd so f tw ar ef or t h e O hi o S ci e nt if i c 6 50 2 -b a se d c om p ut er s .KI LO B AU D , B YT E an d D R . D O BB ' S JO U RN A L a ll g iv eg oo d c o ve r ag e o n t he 6 50 2 as we ll a s o t he rm i cr op r oc e ss or s . KI LO B AU D h as mo r e ha rd w ar e a ndc on str uc tio nal ar tic le s t ha n mo st c om put er m ag -a zi n es . ON - LI NE i s d ev ot e d ma in l y to n ew p ro -d uc t a nn o un ce m en ts a nd ha s v e ry f r eq ue n t r ef er -en c es to 65 0 2 re la t ed it em s . Fo l lo w in g t he s ec om e a gr ou p of m a ga z in es wi t h s o me w ha t le s sf r eq u en t r e fe r en ce s t o t he 6 50 2. Fi na l ly t ow ar dth e e nd o f th e 1 i st ar e th o se ma ga z in e s wi t h

o nl y oc c as io n al o r t ri vi a l r ef er e nc e s to t he65 0 2. An a tt e mp t h as be e n m ad e t o gi ve u p- to -d a te ad d re s se s a nd su bs c ri p ti on r a te s f or th em ag az in es c it ed .

I NT ER FA CE A GE$1 4 .0 0 pe r y ea r

M cP he te rs , W ol fe & J o n e s1 67 04 M ar qu ar dt A ve .Ce rri tos , CA 9 07 01

P O PU L AR E L EC T RO N IC S$ 12 .0 0 pe r y e ar

P o pu l ar E l ec t ro n ic sOn e Pa r k Av e .N e w Yo r k, N Y 1 0 01 6

P ER SO NA L C OM PU TI NG (F or me rl y M IC RO TR EK )$1 4 .0 0 pe r y ea r

B en wi ll P ub li sh in g C or p.1 05 0 C om mo nw ea lt h A ve .

B os t on , M A 0 22 1 5

M I C R O$ 6 .0 0 p er 6 is s ue s

M I C R OP. O. Bo x 3S . Ch e lm sf o rd , M A 01 82 4

7 3 M AG AZI NE$ 15 .0 0 pe r y e ar

7 3 , I n c.P et er bo ro ug h, N H

K IM -1 /6 50 2 U SE R N OT ES$ 5 .0 0 p er 6 i ss ue s

E ri c R eh nk eP . O. B o x 33 0 77R oya lt on, O H 4 41 33

C R EA T IV E C O MP U TI N G$ 1 5. 0 0 p e r ye a r

C r ea t iv e C o mp u ti n g

P. O. Bo x 7 8 9- MM or ri st ow n, N J 0 79 60

O HI O S CI EN TI FI C- -S MA LL S YS TE MS J OU RN AL$6 . 00 p er ye a r (6 i ss u es )

O hi o S ci en ti fi c1 33 3 S . Ch il l ic o th e R d.Au r or a , O H 44 2 02

SSSC I N T E R F A C E(W ri te f or i nf or ma ti on )

S ou th er n C al if or ni a C om pu te r S oc .1 70 2 A sh la ndS a nt a Mo n ic a, C A 90 40 5

K I L O B A U D$ 15 .0 0 pe r y ea r

K i lo b au d M a ga z in eP et er bo ro ug h, N H 0 34 58

E DN (El ect ron ic De si gn N ew s)$ 25 . 00 p er ye a r(W ri te f or s ub sc ri pt io n i nf o)

C ah ne rs P ub li sh in g C o.

27 0 S t P au l S t.De nve r, CO 8 02 06

Page 38: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 38/60

R A DI O E L EC TR O NI C S

$ 8.7 5 pe r y earG er ns ba ck P ub li ca ti on s, I nc .

2 00 P ark Av e. , So uthNew Yo rk, NY 10 00 3

C OM PU TE R M US IC J OU RN AL$14 .0 0 p er yea r (6 i ssu es)

Pe opl e' s Com pu ter Co .Bo x E10 10 Doy le St .

M enl o Pa rk, CA 9 402 5

QS T$ 12 .00 per y ear

A me ric an R ad io R el ay Lea gue2 25 M ain S t.New in gto n, CT 06 11 1

P OP UL AR C OM PU TI NG

$ 18. 00 per y ea rP op ul ar C om pu ti ngB ox 27 2C al aba sas , C A 913 02

I EE E C om pu te r(W ri te f or sub sc rip tio n in fo)

IEEE34 5 E . 47t h S t.N ew Y or k, N Y 1 001 7

M IN I- MI CR O S YS TE MS$18 .0 0 p er y ea r

Mo der n Da ta Se rvi ce

5 Kan e Ind us tri al Dr iveHu dso n, MA 0 174 9

ELECTRONICS$1 4. 00 p er yea r

E l e c t r o n i c sM cGr aw H ill Bl dg.12 21 Av e. o f Am er ica s

Ne w Y ork , NY 10 02 0

D IG IT AL D ES IG N

$20 .0 0 p er ye ar(Wr ite f or su bsc ri pti on in fo)

B en wi ll P ub li sh in g C or p.1 05 0 C om mo nw ea lt h A ve .B ost on, M A 02 215

POLYPHONY

$4 .0 0 per y earPAI A E lec tr oni cs, In c.10 20 W . W ils hir e Bl vd.

O kl aho ma Ci ty , O K 7 31 16

E LE CT RO NI C D ES IG N(26 i ss ues p er y ea r)

(Wr it e f or s ubs cri pti on i nfo )Hay den Pu bli shi ng C o., In c50 E sse x St.R och el le P ar k, NJ 076 62

C AL C UL A TO RS , C O MP U TE R S$1 2. 00 p er y ea r (7 iss ues)

D y n a xP. O. Bo x 31 0M en lo Pa rk, CA 94 025

H AM R ADI O$ 12. 00 p er ye ar

C o mm u ni c at i on s T e ch n ol og yG ree nv ill e, NH 0 304 8

C OM PU TE R W OR LD$1 2. 00 per ye ar (t rad e we ekl y)(Wr ite fo r su bsc rip ti on inf o)

C om pu te r W or ld

7 97 Was hin gt on S t.Ne wt on, M A 02 160

E di tor 's Not e: In a ddi tio n to the m aga zin esreg ul arl y c ove red by the 650 2 Bib lio gr aph y, thef ol low ing ma gaz in es ma y als o be o f int er est tova rio us 6 502 rea der s:

P ET G AZE TT EF re e b i- mo nt hl y (C on tr ib ut io ns A cc ep te d)

M ic ro co mp ut er R es ou rc e C en te r19 29 No rth po rt D ri ve, Roo m 6M adi son , WI 5 37 04

TH E PA PER$15 .00 pe r y ea r (10 i ssu es)

The PA PERP.O . Box 43Aud ub on, PA 19 407

Ro ber t P urs er' s RE FER EN CE L ISTO F CO MP UTE R CAS SE TTE S

N ov 197 8 $2 .0 0/F eb 1 97 9 $4. 00R ob er t P ur se rP .O. Bo x 4 66El Do ra do, CA 95 623

P ET U SER NO TES$ 5.0 0 p er y ea r (6 o r mo re i ssu es)

P ET U se r Gro upP. O. Bo x 37 1M on tg om er yv il le , P A 1 89 36

T HE SO FTW AR E EXC HAN GE$ 5. 00 p er yea r (6 is sue s)

The Sof twa re E xch ang eP .O. Bo x 5 50 56Val enc ia , CA 913 55

C AL L A .P .P .L .E$ 10 .00 pe r y ea r (in clu de s du es)

App le Pu get Sou nd Pr ogr am Lib rar y Ex cha r67 08 3 9th Av e. SWSe att le , WA 98 136

Page 39: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 39/60

o

K IM-I A S A D ICITA L YOL TMETER

Joseph L. Powlette and Charles T. WrightHall of Science, Moravian College

Bethlehem, PA 18018

Several programs have been described in the lit-erature which turn a KIM-l microcomputer into adirect reading frequency counter. In "A Simple

Frequency Counter Using the KIM-l" by Charles

Husbands (MICRO, NO.3. Pp. 29-32, Feb/Mar,1978)

and in "Here's a Way to Turn KIM Into a Freq-

uency Counter" by Joe Laughter (KIM User's NoteIssue 3, Jan, 1977), good use is made of KIM-l'sinterval timers and decimal mode to produce auseful laboratory instrument. A simple changein hard ware will allow these same programs toserve as the basis of a direc t reading digital

vol tmeter. This article describes an inexpen-si ve vol tage-to-frequency converter (VFC) cir-cuit which is compatible with these programs andalso describes some software modifications whichwill allow Husband s ' program to operate down tolow frequency (10 HZ) values.

Hardware Configuration

The VFCcircuit is shown in Figure 1. The 4151chip is manufactured by Raytheon and is avail-

able from Act Lve Electronic Sales Corp., P.O.

Box 1035, Framingham, MA01701 for $5.00 or fromJameco Electronics, 1021 Howard Street, San

Carlos, CA94070 for $5.95. The circuit param-eters given in Figure 1 have been modified fromthe values suggested by the manufacturer in

~er to match the pulse requirement for the KIMIRQ signal. The frequency of the output pulseis proportional to the input voltage and the lK~

(multiturn) trimpot is used to adj ust the full-scale conversion so that 10 volts corresponds toa frequency of 10 KHz. It Isnot n-ecessary tocalibrate the KIM-l as a frequency meter sinceany variation in its timing can be compensatedfor by the trimpot. A known potential is con-nected to the VFC input and the trimpot adjust-ed until the KIM readout agrees with the knownvoltage value. The linearity of the VFC isbetter than 1%down to 10 mv (linearity of 0.05%

can be achieved in a "precision mode" which isdescribed in the Raytheon literature). The

circ uit will not respond to negative vol tagesand protection of the chip is provided by the

lN914 diode. If negative voltage readings arealso required, the input to the VFCcan be pre-

+12V

" 5

+12V

ceded by an absolute value circuit (see IC op-AMPcookbook by Jung, p. 193, Sams Pub.).

To operate the system using Laughter's softwarethe following connec tions should be made: 1)

the output (pin 3) of the VFC to the PBO input

of KIM (pin 9 on the application connector) and2) PB7 on the KIM to IRQ on the KIM (A-15 to E-4) . Execution of the program should cause thevoltage to flash on the KIM display in one sec-ond intervals.

The software described in Husbands' article willnot operate below 500 Hz. This limit is causedby the fact that the contents of the intervaltimer are read to determine if the 100 millisec-ond interval has elapsed and since the intervalcounter continues to count (at a lT rate) afterthe interval has timed out, there are times whenthe contents of the interval timer are againpositive. If the interrupt should sample duringthis time, the branch on minus instruction will

not recognize that the interval has elapsed.This problem will manifest itself as a fluctuat-

ing val ue in the display and is most likel y tooccur at low frequencies. One sol ution is toestablish the interval timer in the interruptmode and then allow the program to arbitrate the

interrupt, i.e., to determine whether the inter-rupt was due to the input pulse or the expira-

tion of the 100 millisecond interval timer. Thenecessary changes to Husbands' program are givenin Figure 2. The hardware connections are: 1)output of the VFC (pin 3) to the KIM IRQ (pin 4on the KIM ~nsion connector), and 2) PB7 onthe KIM to IRQ on the KIM (A-15 to E-4). Themodified program starts at 0004 with a clearinterrupt instruction. Locations 17FE and 17FFshould contain 21 00 and 17FA and 17FB shouldhave values 00 10 (or 00 lC).

T O P IN 6

IK T R IM P O T

5K

f re que ncyoutput

If

4

Figure 1. Voltage-to-Frequency Converter (VFC)circui t.

Page 40: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 40/60

A dd it io na l C om me nt s

T h e p r o g r a m m o d i f i c a t i o n s a b o v e w i l l a l s o e x t e n dH u s b a n d s ' f r e q u e n c y c o u n t e r c i r c u i t d o w n t o 1 0H z (c or r e s p o n d i n g t o 1 i n p u t i n t e r r u p t i n 1 0 0m i l l i s e c o n d s ). Si n c e t h e 7 4 1 2 1 m o n o s t a b l e m u l -t i v i b r a t o r d o e s n o t h a v e a n o p e n c o l l e c t o ro u t p u t , P B 7 s h o u l d n o t b e c o n n e c t e d (al on g w i t ht h e 7 4 1 2 1 o u t p u t ) d ir e c t l y t o t h e K I M I R Q. Tw os ol u ti on s a re :

1 . L e a v e P B 7 u n c o n n e c t e d . T h e e x p i r -a t i o n o f t h e 1 0 0 m i l l i s e c o n d c l o c k w i l l

b e r e c o g n i z e d o n t h e n e x t i n p u t i n t e r r u p ta f t e r t h e t i m e r h a s t i m e d o u t . T h e i n t -e r v a l t i m e r w i l l n o t i n t e r r u p t t h e m i c r o -p ro ce ss or , h ow ev er .

2 . C o n n e c t P B '{ to on e i n p u t o f a t w o i n p u tA N D g a t e a n d t h e o u t p u t o f t h e m o n o s t a b l et o t h e s e c o n d i n p u t . T h e o u t p u t o f t h eA N D g a t e s h o u l d b e c o n n e c t e d t o t h e K I MI R Q. T he e x p i r a t i o n o f t h e 1 0 0 m i l l i s e c -o n d i n t e r v a l w i l l n o w a l s o i n t e r r u p t t h ep r o c e s s o r a n d w i l l r e s u l t i n a f a s t e rr e s p o n s e t o a c h a n g e i n f r e q u e n c y v a l u e s(fr om h i g h t o v e r y l o w) a s w e l l a s a m o r ea c c u r a t e l o w f r e q u e n c y c o u n t .

T h e a u t h o r s w o u l d l i k e t o t h a n k C h a r l e s H u s b a n d sf o r t a k i n g t h e t i m e t o a n s w e r o u r q u e s t i o n s a n df o r p o i n t i n g o u t t h e a r t i c l e b y L a u g h t e r .

O R G $ 0 0 0 4

0 0 0 4 5 8 C L I c l e a r i n t e r r u p t f l a g

0 0 1 4 8 D O F 17 S T A c l o c k i n i n t e r r u p t m o d e

0 0 2 4 A D 0 7 17 L D A r e a d i n t e r r u p t f l a g b i t 7

0 0 3 C 8 D O F 1 7 S T A c l o c k i n i n t e r r u p t m o d e

F i g u r e 2 . C h a n g e s i n H u s b a n d s ' p r o g r a m t o e x t -e n d t h e l o w f r e q u e n c y r a n g e t o 1 0 H z .

HICRO is published for a number of reasons. Onevery important reason is to provide a means forthe distribution of information about 6502 re-lated products. Our advertising rates are verylow in relation to our circulation and special-ized audience, and we we I come your money, butthat. is not what we want to discuss here. MICROoffers several ways for you to geL good public-ity - FREE I It will take a little work on yourpart, but the pr ice is right. There are threeregular ways to get coverage in MICRO: the soft-ware catalog, the hardware catalog, and the listof 6502 related companies.

THE MICRO SOFTWARE CATALOG

Appearinq regularly since issue number 4, thesoftware catalog provides a brief, standardized,description of currently available 6502 soft-ware. We were a bi t surpr i zed to find that. thesoftware catalog was one of the most often men-tioned articles in the recent MICRO Reader Feed-back. To participate in this catalog, you mustfollow a few simple rules:

1. The program must be currently available,n ot " un de r d ev el op me nt ".

2. You must provide the write-up followingthe standard format which is:

Name of program:6502 system (s) it works on:

r ~e m o ry r e q ui r e d:L angu age us ed (As semb ler, BASI C, .. . ):H ar dw ar e r eq ui re d:

Des cript ion o f p rogr am:Number of copies in circulation:Price:In clud es: (Cas sette , Sour ce lis ting s, ... )Author:A va il ab le f ro m:

THE MICRO HARDWARE CATALOG

In issue number 6 we printed a call for hardwareinformation for a Hardware Cataloq. The formatsof the material we received WilS so varied, thatViC' have dec ided to impose M f a rt na l.f or t he s ak eof 'J ~~re useful prescntat ion of the mat c r ial .To participate in this catalog, you must f n I l o wt he se r ul es :

1. The product must be currently available,either in stock or within four weeksdelivery on new orders. Some units musthave already been successfully delivered.

2. You must provide the write-up followingthe standard format which is:

Name of product:6502 systems it works with:O ther hardw are requ ired :P o we r r e qu ir e me nt s :De scrip tion of pro duct :Number of units delivered to date:Price :In clude s: (Manu als, Cabl es, ... )Devel oped b y:A va il ab le f ro m:

A lot of material that has been received for theCata logs has not been in o useab 1 e fo rmat . Weare not trying to make .it difficult for you tosubmit your material. We are trying to make iteasy for the readers to understand your product.We do not understand your product as well as youdo and can not therefore do as good a write-upas you can. And, we don't nave any more timethan you do I 50, please submi t your stuff Inthe requested formDt and wc will print it.

6 502 RELA TED COMPA NIES

In issue number I we printed R lis t of c ompa niesthat we were aware of which produced products ofinterest to the 6502 world. It is timc to up-date the list. If you f cc l that your companyshould be on t-he lis t , then send in the follow-i ng i n fo rm a ti on DS soon as possible:

Name of company:Address:Tel epho ne : (Opti ona 1 )Person to contact: (Optional)Brief list of 6502 products: (Maximum of

five typed lincs, please)

While the Software and Hardware Catalogs will beappearing regularly in every issue, this list of65 02 Re late d I 'ompa nie s will only ~lPpC81'once, inissue number 8, the Dcc/Jim issue. Tbe r-e o r-e,send your information in as 130011 a s p os si bl e.

i i)

Page 41: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 41/60

CA SSETTE TA PE CONTR OL LER

F re d M il le r7 T e m p l a r W a y

P ar si pp an y, N J 0 70 54

T h e i d e a l t a p e s t o r a g e f a c i l i t y f o r m i c r o - s y s -t e m s w o u l d b e o n e i n w h i c h t h e m i c r o h a s c o m p -l e t e c o n t r o l o f a l l t a p e m o v e m e n t a n d p l a y /r ec or d f un ct io ns w it ho ut " op er at or i nt er ve nt io n"e . g . p u s h i n g b u t t o n s . U n f o r t u n a t e l y m o s t o f u sh a v e b u d g e t s w h i c h o n l y a l l o w u s e o f l o w e r c o s ta u d i o c a s s e t t e u n i t s . S h o r t o f m a s s i v e m e c h a n -

i c a l r e b u i l di n g , t h e s e u n i t s c a n o n l y b e e x t e r n -a l l y c o n t r o l l e d w i t h a m o t o r o n / o f f f u n c t i o na f t e r t n e " o p e r a t o r " h a s s e t t h e p r o p e r r e c o r d /p l a y k e y s . A l l t o o o f t e n w e g o o f a n d p r e s s t h ew r o n g b u t t o n , h a v e t o m o v e c a s s e t t e s f r o m o n eu n i t t o a n o t h e r , o r s i m p l y f o r g e t t o s e t u p t h eu n i t s a t t h e r i g h t t i m e .

T h e C a s s e t t e T a p e C o n t r o l l e r (C T C ) d e s c r i b e db e l o w o f f e r s a r e a s o n a b l y i n e x p e n s i v e c a p a b i l -i t y a s a c o m p r o m i s e i n t h e p r o v i s i o n o f a u t o m a t -i c t a p e c o n t r o l f o r a K I M - l s y s t e m . C T C i s ac o m b i n a t i o n o f a s e v e n - I C h a r d w a r e b o a r d a n ds u p p o r t i n g s o ft w a r e r o u t i n e s . I t w a s d e v e l o p e dt o c o n t r o l t w o P i o n e e r C e n t r e x K D - 1 2 c a s s e t t eu n i t s . T h e c o n c e p t c o u l d b e e x t e n d e d t o m o r et h a n t w o u n i t s o r p e r h a p s o t h e r m o d e l s .

A s u m m a r y o f t h e f u n c t i o n s p r o v i d e d a r e :(1 ) P ro vi de s of tw ar e- dr iv en c ap ab il it y t o s ta rta n d s t o p a s p e c i f i c t a p e r e c o r d e r b y o p e n i n g /c l o s i n g t h e " r e m o t e c o n t r o l " c i r c u i t o f t h e r e -c o r d e r (n o r m a l l y c o n t r o l l e d b y a s w i t c h o n a ne x te r na l m i cr o ph o ne ).

(2 ) P ro vi de s of tw ar e- dr iv en c ap ab il it y t o r ou tet h e i n p u t (r e c o rd ) o r o u t p u t (p l a y b ac k ) s i g n a l sa s a pp ro pr ia te .

(3) P r o v id e o v e r r i d e m a n u a l c o n t r o l s (t o g g l e s )t o a l s o a c c o m p l i s h (1 ) a n d (2 ), a b o v e .

(4 ) L i g h t p a n e l i n d i c a t o r s (L E D s ) a s s o c i a t e dw i t h t h e p l a y o r r e c o r d f u n c t i o n s s e l e c t e d f o re a c h c a s s e t t e u n i t a s s e t b y s o f t w a r e o r m a n u a lc o n t r o l s .

(5 ) S e n s e w h e t h e r t h e s e l e c t e d t a p e r e c o r d e r i ss e t t o p l a y o r r e c o r d , o r n e i t h e r .

(6 ) S e n s e t h e p o s i t i o n o f a u x i l i a r y t o g g l e s f o rs e t t i n g s o f t w a r e o p t i o n s , e t c . , (o p t i o ns w i t c h e s .

(7 ) L i g h t i n d i c a t o r s (L E D s ) a s s o c i a t e d w i t h t h ea ux il ia ry t og gl es f or o pe ra to r c om mu ni ca ti on s.

(8 ) P r o v i d e a n a u d i b l e " b e e p " u n d e r s o f t w a r ec o n t r o l .

C TC G en er al D es cr ip ti on

T he C as se tt e T ap e C on tr ol le r i s a h ar dw ar e/ so ft -w a r e f a c i l i t y t o a s s i s t i n t h e o p e r a t i o n a n d u s eo f a u d i o c a s s e t t e t a p e r e c o r d e r s f o r d a t a r e a d /w r i t e f u n c t i o n s . T h e h a r d w a r e p r o v i d e s t h e i n t -e r f a c e f r o m a K I M - l t o t w o P i o n e e r C e n t r e x K D - 1 2t a p e r e c o r d e r s . B e s i d e s t h e c a s s e t t e i n p u t a n do u t p u t l i n e s f r o m K I M - l f o u r o t h e r l i n e s (b i tp o r t s ) a r e r e q u i r e d f o r s o f t w a r e c o n t r o l o f t h eh a r d w a r e .

T he s of tw ar e a nd h ar dw ar e c on tr ol t he r ec or de r' sm o t o r c i r c u i t s a n d d e t e r m i n e i f t h e a p p r o p r i a t em a n u a l k e y s o n t h e r e c o r d e r a r e s e t c o r r e c tl y .T h e s o f t w a r e c a n p r o v i d e a l t e r n a t i v e a c t i o n(a l e r t t h e o p e r a t o r o r t r y a n o t h e r u n i t ) i n t h ec a s e o f i m p r o p e r l y s e t k e y s .

T he s pe ci fi c s of tw ar e i ll us tr at ed b el ow i s w ri t-t e n t o " s e a r c h " f o r a u n i t w h i c h i s s e t i n e i t h -a " r e a d " (p l a y b a c k ) o r " w r i t e " (r e c o r d ) m o d e .

I f n o n e i s f o u n d i n t h e d e s i r e d m o d e , a n a u d i b l et o n e i s s o u n d e d a n d t h e s e a r c h i s c o n t i n u e d .T h e v i s i b l e i n d i c a t i o n o f e a c h o f t h e " r e a d " o r" w r i t e " L E D s b l i n k i n g a l o n g w i t h t h e a u d i b l et o n e p r o v i d e s t h e o p e r a t o r w i t h a q u i c k c l u e a st o t h e e r r o n e o u s s e t t i n g s . I f t h e a p p r o p r i a t et ap es a re " mo un te d" t he o pe ra to r s im pl y d ep re ss -

e s t h e " r e q u e s t e d " c a s s e t t e u n i t k e y . S u b s e -q u e n t r e f e r e n c e s b y t h e s o f t w a r e w o u l d l o c a t et h e p r e s e t u n i t w i t h o u t c o m m u n i c a t i n g t o t h eo p e r a t o r .

A d d i t i o n a l f a c i l i t i e s a r e b u i l t i n t o t h e C T Ch a r d w a r e / s o f t w a r e a t l i t t l e e x t r a c o s t . T h e s ei n c l ud e t h e s e p a r a t e l y a c c e s s i b l e a u d i b l e t o n ea n d t w o o p t i o n t o g g l e s w i t h a c c o m p a n y i n g p a n e li n d i c a t o r L E D s . T h e t o g g l e s c a n b e u s e d f o r s e t -t i n g o p t i o n s s e l e c t e d b y t h e o p e r a t o r a n d t e s t -e d b y t h e s o f t w a r e . T h e a s s o c i a t e d i n d i c a t o r sc a n a l s o b e u s e d f o r s o m e o p t io n a l c om m u n i c a t i o np u r p o s e s . A t h i r d s w i t c h (m o m e n t a r y t o g g l e o rp u s h b u t t o n ) i s u s e d a s a " b r e a k " c o m m a n d f o rs o f t w a r e t e s t i n g . A l a y o u t o f t h e r e l a t e d h a r d -w a r e c o n t r o l p a n e l i s s h o w n i n F i g . 1 .

READ WRITE

( Q )UNIT UNIT 2

C ASSE TTE TAPE C ON TRO LLE R

OPTION A B 8R:O:A K

F i g u r e 1 .

S ug ge st ed P an el L ay ou tf or C as se tt e T ap e C on tr ol le r

H a rd w ar e D e sc r ip t io n

A k e y t o t h e l o g i c o f C T C i s t h e a b i l i t y t o s e n -s e a c t u a l c a s s e t t e u n i t k e y s e t t i n g s . B y s e n s -i n g v o l t a g e l e v e l s a t t w o e x t e r n a l l y a c c e s s i b l ep O i n t s i n t h e K D - 1 2 c i r c u i t r y i t i s p o s s i b l e t od e t e r m i n e o n e o f t h e f o l l o w i n g s t a t e s :

(1 ) u n i t s e t f o r r e a d (p l a y b a c k )o r f a s t f o r w a r d o r r e w i n d

(2 ) u n i t s e t f o r w r i t e (r e c o r d )

(3 ) n o k e y s d e p r e s se d

T h e c i r c u i t s h o w n i n F i g . 2 u s e s t w o r c s t o a d -d r e s s a f u n c t i o n , o n e t o e n a b l e a n d t h e o t h e r t os e n s e r e s u l t s o f e n a b l i n g . T h i s l o g i c i s f u r -t h e r d e s c r i b e d i n t h e c o m m e n t s a c c o m p a n y i n g t h es of tw ar e s ou rc e l is ti ng . F ou r n on -c ri ti ca l D PD Tr e l a y s a r e u s e d t o a l l o c a t e s i g n a l s a n d c o n t r o l

7 : 3 9

Page 42: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 42/60

Page 43: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 43/60

0010: 0200 KXFTf:..P ORG $0200

0020 :

0030 : ********************0(4C: * *

tl 0050 : * C.4S5£TT£ TAPE *0060: * CONTPOLLEF ( eTC) *0070: * E:" F.M1LLE~ *0080: * *0090 : ********************0100:01 10 : *** KIN & ZERO ~?GE Pp .. FiA:1£TEF S *",*

0120:

0130: 0200 PEL * 11702

0140: 0200 PE[[ * $1703

0150: 0200 TFFCT * $OO£f

0160: 0200 INIT * $1 E6 C

1[;=02

0010: *** TJ\PE CP-.S5 ET TE READ FOl'T I NE~ ***0020 :

0030 : 0200 [,8 PLTAP£ CLL

0040 : 0201 10.9 02 L [AH-l $02 T£ST For l'N IT" 1 F.EP,[':"

0050 : 0203 20 IE 02 JSF. TP';EST FOE F.EAD?

0060: 0206 FO CC E£Q Cf:£.C,[ • •• YE.5

0070: 0208 ;'.9 OLl L [Art-: $04 • •• r~0 I l'NIT#2 PEf:..DY?

0080: 020A 20 IE 02 J SF TFTEST

0090 : 020D FO 05 BEQ CRE.A[ • •• YE':

0100: 02C F 20 23 02 'Cr- EELL • •• NOI soum SIGNAL AND_•.

01 1C: 0212 C O F e E N E pLTf~FE Tev AGAIN.. .0 0120:

0130: 0214 E .A CPE?[ NOF

0140:

0150:

0160: · EOCTI ~J E FOP FEArl NG TAFE

0170: • GOES HEFt.0180: •0190:

0200 :

0210: 0215 20 33 02 J SF CTLOFF H"F:N OFF CASSETTE MOTO?

0220 : 0218 LJC BC 1E S[[XI T J:V;F ail T M,' L r rn.FN 1/1 ;:, hIt'-l INIT

ID= 03

OC10: *** CA55ETTE 5lFFOfT PTNS ***C020:

0030 : 0215 85 EF TFTEST 5TA TPFCT SAVE l'NIT/FeT

0040: 021C 6[02 17 :2Tf:.. FEL FOPT E : COl\TEOL [ATA

0050 : 0220 20 3C 02 J 5 :f LELP,Y f:..LLO~',· RELAY SETTLE

OC C (.: 0223 AL 02 17 LLA PEL Ct{ EITS 0- 3 = TO0070 : 0226 29 OF Ar: LI t·1 ~OF OFIGINAL L"t'H T I FCT

0030 : 0228 C5 EF CY.F TfFCT

0090: 022A 6 C r:T 5 : EG:L4L :'1EANs l"[JI T FEf:..I::"

0100 :

0110: 022[; A9 CC SELL L LP.I:1 $(,0

0120: 022D 8L 02 17 STf:.. PE t ZEFO FCT SETS TONE, 0130: 0230 20 2C 02 J5E [ELAY v.'/d T J ~.ESE:· & EXIT

0140:

01 50: 0233 A9 07 CTLO FF L L?,H1 107 s r T S r-.: r-. TO O I Fc.

C160: 0235 8[03 17 STA FEL[

0170: 0233 6L 02 17 STIt FEL SET TO FCT#7 ( OFF)

01EO : 0225 60 ' ; ' : ' ' ' ' !' ' 'C '_. . . . . .

~ '~~ [ ; JC ! ) 7:41

Page 44: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 44/60

0190:

0200: 023C A9 FF L'ELAY LLAIM $fF

0210: 023E 8D 07 17 ~TA 11707 SET TH1ES TO 1/4 SEC

0220: 0241 2C 07 17 EIT $1707

0230 : 0244 10 FE DPL LELAY +05

0240: 0246 60 RTS

0250:

0260: 0247 20 33 02 ERKCK J SF. CTLO fF EN5t:F.E O F F

0270: 02411. 18 CLC

0280: 024E AD 02 17 LLA PE[

0290: 024E 29 08 ANUM $08 EIT 3 HI GH >lEA~; S NO B P K0300 : 0250 DO 01 BNE ~KEXI T

0310: 0252 38 SEC

0320: 0253 60 EKEXIT PT S NO CARF'':' t-1EAK5 N O EEK

ID=04

0010:

0020 : *** CASSETTE ~:RI TE EOCTINE * * *0030:

0040: 0254 D8 ~:RTAPE CLL

0050: 0255 11.9 01 L [1>.111 $01 TESTfa P . u·aTill FUrY

0060: 0257 20 IE 02 JSR TF-TEST FOE '!tIFI TE?

0070: 02511. FO OC BEG: C11;FIrr • •• YES

0080: 025C 11.9 03 L [Ali"! $03 • •• tJO ~ TEST t'NI T # :2

0090: 025E 20 IE 02 JSR TFTEST

0100: 0261 FO 05 BEQ Cl.T:I Tf. ••• YES

0110: 0263 20 25 02 J5F EELL • •• NOISOL'Nt SIGNAL t -s : [ , TEY

0120: 0266 DO E.C ENE VETAPE AGAlt- i

0130:

0140: 0268 EA Cv,'RITE Nap

0150:

0160:

0170: . CASSETTE t;;EI TE FOl'TI NE

0180:

.GOES EEPE

0190:

0200:

0210: 0269 20 33 C2 JSF. CTLOFf TtTJ"; OFf ~'1OTOFS

0220: 026C 4C BC IE. JMP INIT ANL· s.ETun: VIA lur1ID=05

0010: * " ' * AL T. sv TEST 6. LI GET * * *0020 :

0030: 026F 11.9 C6 T5T S:FJ\ LLAIH $06 SET FOF. ALT. SF it 1

0040: 0271 DC 02 ENE TSTSVE +02

0050:

0060: 0273 11.9 05 T5T 5\·:3 LLAIM £05 SET Fa::. { : ' . L T. SV 1 1 2

0070: 0275 48 FEA SAVE COLE

0080: 0276 20 33 02 JSF. CTLO fF INITL FOETS

0090: 0279 68 ELf. ~ET!:IEVE co LE

0100: 027A 20 IE 02 JSF. T--r-,:c-r"'.f:: L TES7 SF- ..__ l

0110: 027[ 18 CLC

0120: 027E La 01 cr·;E T~TX IF [WT U:Cf.L

0130 : 0280 38 SEC t-i EAr·.s SF IS NO:- SET

0140: 0281 lo C 33 02 TSTX JNF CTLOfF cr.r.rv r -l E t :. r· ·i s sv lor··; I

ID=

Page 45: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 45/60

A P P l[ II HIG H R[SOlUTIO~ GRAP~![S

~[NORY ~RGA~IIATIij~

A n d r e w H . E l i a s o n2 8 C h a r l e s L a n e

F a l m o u t h , M A 0 2 5 4 0

O n e o f t h e m o s t i n t e r e s t i n g , t h o u g h n e g l e c t e d ,f e a t u r e s f o t h e A p p l e I I c o m p u t e r i s i t s a b i l i t yt o p l o t o n t h e t e l e v i s i o n s c r e e n i n a h i g h r e s -

o l u t i o n m o d e . I n t h i s m o d e , t h e c o m p u t e r c a np l o t l i n e s , p O i n t s a n d s h a p e s o n t h e T V d i s p l a ya r e a i n g r e a t e r d e t a i l t h a n i s p o s s i b l e i n t h ec o l o r g r a p h i c s m o d e (G R) wh i c h h a s a r e s o l u t i o no f 4 0 x 4 8 m a x i m u m .

I n t h e h i g h r e s o l u t i o n (H I R E S ) m od e , t h e c o m p u -t e r c a n p l o t t o a n y p o i n t w i t h i n a d i s p l a y a r e a2 8 0 p o i n t s w i d e a n d 1 9 2 p o i n t s h i g h . W h i l e t h i sr e s o l u t i o n m a y n o t s e e m i m p r e s s i v e t o t h o s e w h oh a v e u s e d p l o t t e r s a n d d i s p l a y s c a p a b l e o f p l o t -t i n g h u n d r e d s o f u n i t s p e r i n c h , i t i s n o n e t h e -l e s s c a p a b l e o f p r o d u c i n g a v e r y c o m p l e x g r a p h i cp r e s e n t a t i o n . T h i s m a y b e e a s i l y v i s u a l i z e d b yc o n s i d e r i n g t h a t a f u l l s c r e e n d i s p l a y o f 2 4l i n e s o f 4 0 c h a r a c t e r s i s " p l o t t e d " a t t h e s a m er e s o l u t i o n . A n e x c e l l e n t e x a m p l e o f t h e H I R E Sc a p a b i l i t y i s i n c l u d e d i n c u r r e n t A p p l e I I a d -v e r t i s e m e n t s .

o

W h y , t h e n , h a s r e l e t i v e l y l i t t l e s o f t w a r e a p p -e a r e d t h a t u s e s t h e H I R E S f e a t u r e s ? O n e o f t h er e a s o n s m a y b e t h a t l i t t l e i n f o r m a t i o n h a s b e e na v a i l a b l e r e g a r d i n g t h e s t r u c t u r e a n d p l a c e m e n to f w o r d s i n m e m o r y w h i c h a r e i n t e r p r e t e d b y H I -R E S h a r d w a r e . I n f o r m a t i o n e s s e n t i a l t o t h e u s e rw h o w i s h e s t o a u g m e n t t h e A p p l e H I R E S r o u t i n e sw i t h h i s o w n , o r t o e x p l o r e t h e p l o t t i n g p o s s i b -i l i t i e s d i r e c t l y f r o m B A S I C . I n a f i t o f c u r -i o s i t y a n d A p p l e - i n s o m n i a , I h a v e P E E K e d a n dP O K E d a r o u n d i n t h e H I R E S m e m o r y a r e a . T h e f o l -l o w i n g i s a s u m m a r y o f m y f i n d i n g s . H a p p y p l o t -t i n g !

E a c h p a g e o f H I R E S G r a p h i c s M e m o r y c o n t a i n s 8 1 9 2b y t e s . S e v e n b i t s o f e a c h b y t e a r e u s e d t o i n d -

i c a t e a s i n g l e s c r e e n p o s i t i o n p e r b i t i n a m a -t r i x o f 2 8 0 H x 1 9 2 V . T h e e i g h t h b i t o f e a c hb y t e i s n o t u s e d i n H I R E S a n d t h e l a s t e i g h tb y t e s o f e v e r y 1 2 8 a r e n o t u s e d .

T h e b i t s i n e a c h b y t e a n d t h e b y t e s i n e a c hg r o u p a r e p l o t t e d i n a s c e n d i n g o r d e r i n t h e f o l -

l o w i n g m a n n e r . F i r s t c o n s i d e r t h e f i r s t t w ob y t e s o f p a g e 1 . (P a g e 2 i s a v a i l a b l e o n l y i nm a c h i n e s w i t h a t l e a s t 2 4 K ).

B Y T E 8 1 9 2 8 1 9 3

S C R E E N

P O S I T I O N 0 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1~B I T 0 1 2 3 4 5 6 0 1 2 3 4 5 6

I v G V G V G[jG V G V G V

E J(Bit 7 n o t u s e d ) 7 7

V

G

V I O L E T

G R E E N

F i g u r e 1 r e p r e s e n t s t h e s c r e e n p o s i t i o n a n d r e s -p e c t i v e b i t & w o r d p o s i t i o n s f o r t h e f i r s t 1 4p l o t p o s i t i o n s o f t h e f i r s t h o r i z o n t a l l i n e . I f

t h e b i t i s s e t t o 1 t h e n t h e c o l o r w i t h i n t h eb l o c k w i l l b e p l o t t e d a t t h e p o s i t i o n I n d ica t e d ,If t h e b i t i s z e r o , t h e n b l a c k w i l l b e p l o t t e da t t h e i n d i c a t e d p o sitic n . It c a n b e s e e n t h a te v e n b i t s i n e v e n b y t e s p l o t v i o l e t , e v e n b i t si n o d d b y t e s p l o t g r e e n a n d v i c e v e r s a . T h u sa l l e v e n h o r i z o n t a l p o s i t i o n s p l o t v i o l e t a n da l l o d d h o r i z o n t a l p o l i t i o n s p l o t g r e e n . T op l o t a s i n g l e w h i t e p o i n t , o n e m u s t p l o t t h en e x t h i g h e r o r l o w e r h o r i z o n t a l p o s iti .o n a lo ngw i t h t h e p o i n t , s o t h a t t h e a d d i t i v e c o l o r p r o d -u c e d i s w h i t e . T h i s i s a l s o t r u e w h e n p l o t t i n gs i n g l e v e r t i c a l l i n e s .

T h e m e m o r y o r g a n i z a t i o n f o r H I R E S i s , f o r d e s i g na n d p r o g r a m m i n g c o n s i d e r a t i o n s , a s f o l l o w s :

S t a r t i n g a t t h e f i r s t w o r d , t h e f i r s t 4 0 b y t e s

(0- 3 9 ) r e p r e s e n t t h e t o p l i n e o f t h e s c r e e n (40b y t e s x 7 b i t s = 2 8 0 ). T h e n e x t 4 0 b y t e s , h o w -e v e r , r e p r e s e n t t h e 6 5 t h l i n e (i. e. , v e r t i c a lp o s i t i o n 6 4). Th e n e x t 4 0 b y t e s r e p r e s e n t t h el i n e a t p o s i t i o n 1 2 8 a n d t h e n e x t 8 b y t e s a r ei g n o r e d . T h e n e x t g r o u p o f 1 2 8 b y t e s r e p r e s e n tt h r e e l i n e s a t p o s i t i o n s 8 , 7 2 a n d 1 3 6 , t h e n e x tg r o u p a t p O S i t i o n s 1 6 , s o a n d 1 4 2 , a n d s o o n u n -t i l 1 0 2 4 b y t e s h a v e b e e n u s e d . T h e n e x t 1 0 2 4b y t e s r e p r e s e n t t h e l i n e s t a r t i n g a t v e r t i c a lp o sit i o n 1 (se c o n d l i n e d o w n ) i n th e s a m e m a n -n e r . E i g h t g r o u p s o f 1 0 2 4 r e p r e s e n t t h e e n t i r es c r e e n . T h e f o l l o w i n g S i m p l e p o r g r a m p r o v i d e s ag o o d g r a p h i c p r e s e n t a t i o n a s a n a i d t o u n d e r -s t a n d i n g t h e a b o v e d e s c r i p t i o n . N o t e t h a t t h e r ei s n o n e e d t o l o a d t h e H I R E S m a c h i n e l a n g u a g er o u t i n e s w i t h t h i s p r o g r a m . S e t H I M E M : S 1 9 1b e f o r e y o u t y p e i n t h e p r o g r a m .

1 0 0 R E M S E T H I M E M : 8 1 9 1

1 1 0 R E M H I R E S G R A P H I C S L E A R N I N G A I D

1 2 0 P O K E - 1 6 3 0 4 , 0 : R E M S E T G R A P H I C S M O D E

1 3 0 P O K E - 1 6 2 9 7 , 0 : R E M S E T H I R E S M O D E

1 4 0 R E M C L E A R P A G E - T A K E S 2 0 S E C O N D S

1 5 0 F O R 1=8 1 9 2 T O 1 6 3 8 3 : P O K E I , D : N E X T I

1 6 0 I N P U T " E N T E R B Y T E (1 t o 1 2 7 )" , B Y T E

1 7 0 P O K E - 1 6 3 0 2 , 0 : R E M C L E A R M I X E D G R A P H I C S

1 8 0 F O R J =81 9 2 T O 1 6 3 8 3 : R E M A D D R E S S '1 9 0 P O K E J , B Y T E : R E M D E P O S I T B Y T E I N A D D R E S S2 0 0 N E X T J2 1 0 P O K E - 1 6 3 0 1 , 0 : R E M S E T M I X E D G R A P H I C S

2 2 0 G O T O 1 6 09 9 9 E N D

A n u n d e r s t a n d i n g o f t h e a b o v e , a l o n g w i t h t h ef o l l o w i n g e q u a t i o n s w i l l a l l o w y o u t o s u p p l e m e n t

t h e H I R E S g r a p h i c s r o u t i n e s f o r m e m o r y e f f i c i e n tp r o g r a m m i n g o f s u c h t h i n g s a s : t a r g e t g a m e s , 3 Dp l o t w i t h h i d d e n l i n e s u p r e s s i o n a n d 3 D r o t a -t i o n , s i m u l a t i o n o f t h e l o w r e s o l u t i o n C=S C R N(X , Y ) f u nc t i o n , e t c . A l s o , y o u m a y w a n t t o d os o m e c l e v e r p r o g r a m m i n g t o p u t F l a g s , e t.o . , i nt h e u n u s e d 8 1 2 8 b i t s a n d 5 1 2 b y t e s o f m e m o r y !

Page 46: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 46/60

HI RES Graphics Equations and Algorithms

Where:

FB = ADDRESSOF FIRST BYTE OF PAGE.PAGEl = 8192 PAGE2 = 16384

LH = HORIZONTALPLOT COORDINATE.0 TO 279LV = VERTICALPLOT COORDINATE.a TO 191

BV = ADDRESSOF FIRST BYTE IN THE LINE OF

40BY = ADDRESSOF THE BYTEWITHIN THE LINE

AT BVBI = VALUEOF THE BIT WITHIN THE BYTE

WHICHCORRESPONDSTO THE EXACTPOINT

TO BE PLOTTED.

Given: FB,LH,LV

BV = LV MOD8 • 1024 + (LV/8) MOD8 • 128+ (LN/64) • 40 + FB

BY LH/7 + BVBI = 2A(LH MOD7)

To Plot a Point (Without HIRES Plot Routine):

LH X MOD280 : LV = Y MOD192 ( O R )LV = 192-Y MOD192

FB 8192

BV LV MOD8 • 1024 + (LV/8) MOD8 • 128 +

(LV/64) • 40 + FBBY LHI7 + BVBI = 2A(LH MOD7)

WO PEEK (BY)IF (WO/BI) MOD2 THEN (LINE NUMBER+ 2)

POKEBY, BI + WORETURN

To Remove a Point, Substitute:

IF (WO/Br) MOD2 = 0 THEN (LINE NUMBER+ 2)POKEBY, WO-BI

To Test a Point for Validity, the Statement:

"IF (WO/BI) MOD2" IS TRUEFOR A PLOTTEDPOINT

ANDFALSE (=0) FOR A NONPLOTTEDPOINT.

RIVERSIDE [LE[TRO~IC DESIG~'S KE~ A~D HVH-I024:

A USER 'S EVALUATIO~

Marvin L. De JongDept. of Math-Physics

The School of the OzarksPt. Lookout, MO65726

The price and availability of a variety ofmemory and application boards for the S 100 bus

will make many KIM-l owners think about expand-ind their systems to be compatible with this

bus. The KIM Expansion Module (KEM) does thetrick. In addition, one of the most attractive

I/O modes is the keyboard/video monitor team.Riverside's MVM-l024, which interfaces neatly

with the KEM, provides all the necessary cir-cuitry to provide a 16 line by 64 character dis-play on a video monitor. Programs which give

the user a variety of display functions (homing

the cursor, bac kspace, erase-a-line, etc.) and

allow the user to communicate with the computer

by way of the keyboard are also available from

Riverside. Finally, all of the hardware andsoftware is well documented in a series of

application notes.

Space does not allow a complete description ofall of the packages mentioned above. The reader

should obtain the application notes and descrip-tions from Riverside if he is contemplating ex-

pansion. Summaril y, the KEMbuffers all of theaddress and data lines from the KIM-l, separat-ing the latter into IN and OUT busses as requir-

ed by the S 100; provides the necessary memory-mapped I/O ports for the keyboard, cursor, and

video display; provides the logic for the S 100signals; and provides four locations for the lK

2708 EPROMs, in which may be stored display/moni tor programs, PROMprogrammer software, or

your favorite games.

The KEMdoes all of this without affecting anyof the I/O ports on the KIM-l. That is, PADandPBD may still be accessed from a connector on

the KEM. The MVM-l024 contains its own memoryand does not use any of the memory on the KIM-l.ASCII from the keyboard is loaded from address13F8. To display a character, ASCII code forthe character is stored in location 13FB. The

cursor is controlled by the contents of twolocations, 13F9 which contains a six bit word

which determines the location of the characterin a line, and 13FA which contains a four bit

word which determines the line being used. Ofcourse, the display /moni tor programs do all ofthe necessary loading (LDA) and storing (STA)for you, but it is particularly easy to write

short programs or subroutines which read thekeyboard and/or output data on the video monitor

The danger in writing an equipment eval uation

like this is in making it so concise that it isGreek to everyone except the hardened computer

addict. So, I will concl ude by saying that Iwas very satisfied with the performance of the

Riverside hardware and software. I particularlyliked their use of premium components such as LS

TTL, the fact that the KIM-l I/O ports are still

available for applications, the keyboard pollingsoftware which allows the user to use NMI orIRQ interrupts for applications and the 4K ofPROMspace. Also, it is much easier to enter

and de-bug programs with the display/monitorsoftware. My only criticism is that it is not

easy to layout the system in a small pac kageform.

f i " i H l iH~liI 7: 44

f\

Page 47: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 47/60

A D ICITAL CL OCK PR D CR A M rOR THE 5Y"-1

Chris Sullivan9 Galsworthy PlaceBucklands Beach

Aukland, New Zealand

T h e S Y M - 1 i s a o n e b o a r d h o b b y i s t c o m p u t e rs i m i l i a r t o t h e K I M b u t w i t h a n u m b e r o fa d d i t i o n a l f e a t u r e s . S i n c e b u y i n g t h e S Y M - 1I h a v e h a d a g r e a t d e a l o f f u n p l a y i n g a -

r o u n d w i t h b o t h t h e s o f t w a r e a n d h a r d w a r es i d e s o f i t . T h e S Y M - 1 m o n i t o r , S u p e r m o n , i s a ni n c r e d i b l e m o n i t o r i n 4 K R O M , s o m e o f i t ' s s u b -r o u t i n e s a r e c a l l e d b y t h e f o l l o w i n g p r o g r a m .

T h i s p r o g r a m s t a r t e d o f f a s a l e s s o n i nf a m i l i a r i t y w i t h t h e 6 5 0 2 i n s t r u c t i o n s e t a n du s i n g t h e S u p e r m o n s u b r o u t i n e s t o a d v a n t a g e ,b u t t h e p r e s e n t v e r s i o n h a s b e e n m o d i f i e d m a n yt i m e s i n o r d e r t o i n c r e a s e t h e c l o c k a c c u r a c ya n d , a s m y k n o w l e d g e o f t h e 6 5 0 2 i n s t r u c t i o n s e tg r o w s , i n c r e a s e c o d i n g e f f i c i e n c y . T o u s e i to n e s h o u l d s t a r t e x e c u t i o n a t : 2 0 0 . T h e n e n t e ra n " A " o r " P " (S h i f t A S C I I 5 0 ) t o s i g n i f y A Mo r P M . T h e n e n t e r t h e h o u r s (t w o d i g i t s ), t h ep r o g r a m t h e n o u t p u t s a s p a c e t o s e p a r a t e t h eh o u r s f r o m t h e m i n u t e s . F i n a l l y e n t e r 2d i g i t s t o s i g n i f y t h e m i n u t e s , t h e p r o g r a m w i l l

t h e n i n c r e m e n t t h e m i n u t e s b y 1 , a n d b e g i n t h ec l o c k s e q u e n c e . T h i s s l i g h t q u i r k m a k e s i te a s i e r t o s e t t h e c l o c k u s i n g a n o t h e r c l o c k , s e tu p t h e " A " o r " P " , h o u r s a n d f i r s t d i g i t o f t h em i n u t e s , t h e n e n t e r t h e l a s t d i g i t o f t h em i n u t e s a s t h e s e c o n d s c o u n t e r o f y o u r s e t t i n gc l o c k r e a c h e s O .

oT h e r e i s a n o t h e r s l i g h t q u i r k i n t h a t t h e c l o c kc o u n t s " A l l 5 9 " , " A 1 2 0 0 " , " A 1 2 0 1 " , . . . . ," A 1 2 5 9 " , " P 0 1 0 0 " , " P 0 1 0 1 " . . . . . T h i s s i m p l i -f i e s t h e p r o g r a m m i n g a n d m e a n s t h a t 1 2 :3 0 n e a rm i d d a y i s i n f a c t , 1 2 :3 0 A M a c c o r d i n g t o t h i sc l o c k ! H o w e v e r t h i s i s n o t l i k e l y t o c o n f u s em an y p eo pl e.

A f t e r s e t t i n g u p t h e i n i t i a l t i m e , t h e p r o g r a m

a d d s 1 t o t h e m i n u t e s a n d t h e n c a r r i e s o n a n yc a r r y i n t o t h e h o u r s , p o s s i b l y c h a n g i n g " A " t o" P " o r v i c e v e r s a . T h i s s e c t i o n o f t h e p r o g r a mc o u l d b e m a d e m o r e e f f i c i e n t w i t h f u l l e x p l o i t a -

S YM -1 E LE CT RO NI C C LO CK

t i o n o f t h e 6 5 0 2 i n s t r u c t i o n s e t . T h e l a s t s e c -t i o n i n t h e p r o g r a m i s a 1 m i n u t e d e l a y . I h a v er e w r i t t e n t h i s s e c t i o n m a n y t i m e s i n a s e a r c hf o r a n a c c u r a t e 1 m i n u t e d e l a y . T h e f i r s t p a r t

i s a d o u b l e l o o p w h i c h a l s o s c a n s t h e c l o c k d i s -p l a y , t h i s l o o p t a k e s a b o u t 5 9 . 8 s e c o n d s . T h es e c o n d p a r t i s a d o u b l e l o o p t o " t w e a k " t h e d e -l a y u p t o 6 0 s e c o n d s a n d c o n s i s t s o f 2 d e l a y su s i n g t h e o n b o a r d 6 5 3 2 t i m e r . T h i s t i m e r i s i n -i t i a l i s e d i n 1 o f 4 m e m o r y l o c a t i o n s , s p e c i f y i n g+1 0 2 4 , f 6 4 , f 8 , o r ~1 t i m i n g , e . g . , t h e l o c a t i o nt o w r i t e t o if o ne w an ts . ;. 10 24t im in g i s A 41 7.T h i s l o c a t i o n t h u s i n i t i a l i s e d i s c o u n t e d d o w ni n t h e 6 5 3 2 . T h e p r o g r a m r e a d s t h i s v a l u e u n t i li t b e c o m e s n e g a t i v e , a t w h i c h t i m e t h e d e l a y i so v e r .

S o m e i m p r o v e m e n t s t o t h e p r o g r a m c o u l d b e m a d e ,f o r e x a m p l e b e t t e r c o d i n g i n t h e i n c r e m e n t m i n -u t e s s e c t i o n . O n e c o u l d a l s o a d d a n a l a r m f e a -t u r e , p o s s i b l y u s i n g t h e o n b o a r d b e e p e r . T h eT h e s e c t i o n t o u p d a t e t h e t i m e b y o n e m i n u t e

c o u l d b e u s e d a s a p a r t o f a b a c k g r o u n d r e a lt i m e c l o c k , b e i n g c a l l e d b y a o n c e - a - m i n u t eh a r d w a r e i n t e r u p t g e n e r a t e d b y a n o n b o a r d 6 5 2 2t i m e r c h i p . O n c e a m i n u t e , p r o c e s s i n g w o u l d b ei n t e r u p t e d f o r 1 0 0 c y c l e s o r s o i n o r d e r t o u p -d a t e t h e r e a l t i m e c l o c k . S u c h c l o c k s h a v e m a n yu s e s , o n e o f w h i c h i s t o e n s u r e t h a t c e r t a i nn u m b e r - c r u n c h i n g p r o g r a m s d o n ' t g e t t i e d d o w ni n b i g l o o p s .

T h i s i m p r o v e d v e r s i o n o c c u p i e s l e s s R A M b y u s i n gju m p s t o I N B Y T E r a t h e r t h a n I N C H A R a n d m e s s y b i tm a n i p u l a t i o n s . T h e d e l a y r o u t i n e h a s b e e ni m p r o v e d t o u s e t h e o n b o a r d 6 5 3 2 t i m e r , a n da l s o g i v e g r e a t e r r e s o l u t i o n a n d h e n c e g r e a t e rt im in g a cc ur ac y.

Editor's Note: This program is present primar-ily for its value in showing how to access theSYM's monitor for some of the routines. It isnot an "optimal" program for a 24 hour clock,but should be a good starting point for ownersof SYMs who wish to write similar programs.

B Y C H R I S S U L L I V A N A U G U S T 2 7 , 1 9 7 8

O R G $ 0 2 0 0

S P A C E * $ 0 0 2 0 A SC II S PA CE

A C C E S S * $ 8 B 8 6I N C H A R * $ 8 A 1 BI N B Y T E * $ 8 1 D 9

O U T C H R * $ 8 A 4 7O U T B Y T * $ 8 2 F A

B E G I N J S R A C C E S SJ S R I N C H A R G E T A O R PS T A Z $ 0 0C L CJ S R I N B Y T E G E T H O U R SS T A Z $ 0 1L DA IM S PA CE S PA CE C HA RA CT ERJ S R O U T C H R O U T P U T A S P A C EJ S R I N B Y T E G E T M I N U T E SS T A Z $ 0 2S E D S ET D EC IM Al .M OD E F OR R EM AI ND ER O F P RO GR AM

,0 2 0 0 2 0 8 6 8 B

0 2 0 3 2 0 1 B 8 A0 2 0 6 8 5 0 0

0 2 0 8 1 80 2 0 9 2 0 D 9 8 10 2 0 C 8 5 0 10 2 0 E A 9 2 00 2 1 0 2 0 4 7 8 A0 2 1 3 2 0 D 9 8 1

0 2 1 6 8 5 0 20 2 1 8 F 8

Page 48: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 48/60

H A V IN G S ET T H E IN I T I AL T I ME (L E S S 1 MI N U T E)

U P D AT E T HE T I M E :

0 2 1 9 18 T I M LO P CL C

0 2 1 A A 5 02 L D AZ $ 02 G ET M IN UT ES

0 2 1 C 6 9 01 A D C I M $ 01 I N C R E M E N T

0 2 1 E 8 5 02 S T AZ $ 02

0 2 2 0 3 8 S EC0 2 2 1 E 9 60 S B C IM $ 60 T E ST I F N E W HO U R

0 2 2 3 F O 03 B EQ T I M E X

0 2 2 5 4 C 5 0 0 2 J MP N O R SE T I F N O T A N E W H O UR

0 2 2 8 A 9 00 T I M EX L DA I M $ 000 2 2 A 85 02 ST AZ $0 2 S E T MI N U T E S TO 0 00 2 2 C 1 8 CL C

0 2 2 D A 5 0 1 LD AZ $0 10 2 2 F 6 9 01 AD C I M $0 1 I NCR H OU RS

0 2 3 1 8 5 01 ST AZ $0 1

0 2 3 3 3 8 S EC0 2 3 4 E 9 1 3 S BC I M $1 3 T EST H OU RS = 1 30 2 3 6 F O 0 3 B EQ T I M EY

0 2 3 8 4 C 5 0 0 2 JM P N O R S E T

023B A 9 0 1

0 2 3 D 8 5 0 10 2 3 F A 5 0 00 2 4 1 4 9 5 00 2 4 3 F O 0 7

0 2 4 5 A 9 5 00 2 4 7 8 5 0 0

0 2 4 9 4 C 5 0 0 20 2 4 C A 9 4 10 2 4 E 8 5 0 0

0 2 5 0 A 5 0 00 2 5 2 2 0 4 7 8 A

0 2 5 5 A 5 0 10 2 5 7 2 0 F A 820 2 5A A 9 2 00 2 5 C 2 0 4 7 8 A0 2 5 F A 5 0 20 2 6 1 2 0 F A 82

0 2 64 D 80 2 6 5 A 2 C O0 2 6 7 A O 7 D

0 2 6 9 A 9 0 1026B 2 0 4 7 8A0 2 6 E 8 80 2 6 F DO F80 2 7 1 C A0 2 7 2 DO F30 2 7 4 A 2 0 20 2 7 6 A9 4 D0 2 7 8 8D 1 7 A4

027B A D 0 6 A40 2 7 E 1 0 F B0 2 8 0 C A

0 2 8 1 D O F 30 2 8 3 F 80 2 8 4 4 C 1 9 02

T I ME Y LD A I M $0 1

ST AZ $0 1LD AZ $0 0EO R I M $5 0BEQ T IM EZ

LD A I M $5 0S TAZ $0 0

JM P NO R S E T

T I M EZ L D A I M $4 1S T AZ $ 0 0

Y E S , S E T H O UR S T O

G E T A O R PA S CI I PIS 0 0 = A SC I I P?

NO , T H E N S E T 0 0 T O P

Y E S, T HE N S E T 0 0 TO A

N O R SE T L D AZ $0 0 G E T A O R PJ S R O U T CH R

LD AZ $0 1 G E T H O U R SJS R O U T BY TLD AI M SP AC EJS R O U TC H RLD AZ $0 2 G E T MI N U T E SJS R O U T BY T

C L D C L EA R D E CI M A L MO D ELD X I M $C O S E TU P F O R AL M O S T 60 S E C W AI T

W A l T A L D Y I M $7 D C OU N T E RW A I T B LD A I M $0 1 N O N -D I S P L AY I N G CH A R A CT E R

J S R O U TC H R R EF R E S H D IS P L A YD E YBN E W A I TB L OW O R D E R CO U N T E RDE X H I GH O R D ER C O U N TE RB N E W A l TALD X I M $0 2 T W EA K T I M E U P TO 60 S E CO N D S

W A I T C L D A I M $ 4 DST A $ A 41 7 D I V ID E B Y 1 0 24 T IM E R

W A I T D LD A $ A 40 6 R E GI S T E R OF 65 3 2BP L W A I T DDE X

BN E W A I T CS E DJM P T I M LO P

V E R IF Y f r o m 0 2 00 t h r u 0 2 8 6 is 3 5 6F .

T h e f o l l ow i n g s u br o u t i ne s ca l l e d f o r m p a r t o ft h e S Y M -l ' s S UP ER MO N m on it or :

AC C E S S E n ab l e s t h e u s e r pr o g r a m t o w r i t e t os y st e m R A M , i . e . t h e R AM c o n ta i n e d o n th e 6 5 3 2.It is n e c e s sa r y t o c a ll A C C E S S be f o r e ca l l i n gm o s t o f th e o t h e r s y s t em s ub r o u t in e s .

I N CH A R G e t o ne A S C I I c h a rc t e r fr o m t he i n pu td e v ice (h er e th e h e x k ey p a d) a n d r e t u rn wi t h it

i n t he A r e g i st e r .

IN B Y T E G e t t w o A SC I I c h a ra c t e rs f r om t h e i n pu td e Vi c e , us i n g I N CH A R a nd p a ck i nt o a s i n g l e b y t e

i n t he A r e g i st e r .

O U TC H R O ut p u t t he A SC I I d a t a i n t h e A r eg i s t e rt o th e o u tp u t d ev i c e (h e r e t h e s i x d ig i t L EDd i s p l a y).

O U T B Y T C on v e r t t h e by t e i n th e A r e g i s te r i n t ot wo A S C I I ch a r a c te r s a n d o u tp u t t he s e to t h eo ut pu t d ev ic e.

L oc a t i o n A4 1 7 i s u s e d to i n i ti a l i s e t h e 65 3 2t im e r t o c o u n t d o w n f r o m t h e v a l ue s to r e d i nA 41 7 , wi t h a d i vi d e b y 1 0 2 4 cy c l e s . T h u s t h et i me r r e g i st e r o n t h e 6 5 3 2 i s d e c r em e n t e d b y o n ee v er y 1 02 4 c l o ck c yc l e s . Th e t im e r r eg i s t e rs i ts a t l o c a t io n A4 0 6 , an d t he t i m e i s c o ns i d e r -e d t o b e "u p " w h e n t h e va l u e a t A 4 06 b e c o m esn e g a t i v e .

Page 49: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 49/60

o

P EEK ING A T P ET'S B A SIC

Harvey B. HermanChemistry Department, U. of N. Carolina

Greensboro. NC 27412

C o m m o d o r e , f o r r e a s o n s b e s t k n o w n t o t h e m , h a ss e e n f i t t o p r e v e n t u s e r s f r o m P E E K i n g a t P E T ' sR O M l o c a t e d , 8 K B A S I C . I f y o u t r y t o r u n a p r o -g r a m t h a t s a y s , P R I N T P E E K (4 9 1 5 2 ), t h e a n s w e r

r e t u r n e d w i l l b e z e r o i n s t e a d o f t h e a c t u a l i n s -t r u c t i o n o r d a t a i n d e c i m a l . D i s a s s e m b l e r sw r i t t e n i n B A S I C w i l l t h e r e f o r e n o t w o r k p r o p -e r l y i f t h e y u s e t h e P E E K c o m m a n d a n d t r y t od i s a ss e m bl e 8 K B AS I C (d ec i m a l l o c at i o n s 4 9 1 52 t o5 7 5 2 0) . I w a s c u r i o u s t o s e e h o w t h e P E T ' s 8 KB A S I C w a s i m p l e m e n t e d a n d d e c i d e d t o w r i t e a m a -c h i n e l a n g u ag e p r o g ra m w h ic h c i r c u mv e n ts t h e r e -s t r i c t i o n .

A l i s t i n g o f t h e a b o v e p r o g r a m w h i c h I h a v e c a l -l e d M E M P E E K f o l l o w s . It i s d e c i m a l 2 2 b y t e sl o n g , r e l o c a t a b l e , a n d c a n b e s t o r e d i n t o a n yc o n v e n i e n t a r e a o f m e m o r y . I h a v e c h o s e n t o u s et h e a r e a d e v o t e d t o t h e s e c o n d c a s s e t t e b u f -f e r s t a r t i n g a t h e x 3 3 A . A s l o n g a s t h e s e c o n dc a s s e t t e i s n o t u s e d t h e p r o g r a m s h o u l d r e m a i ni n v i o l a t e u n t i l t h e P E T i s t u r n e d o f f . S t o r i n gt h e p r o g r a m i n m e m o r y i s t r i v i a l if a m a c hi n el a n g u a g e m o n i t o r i s a v a i l a b l e . O t h e r w i s e c o n -v e r t t h e h e x v a l u e s t o d e c i m a l a n d m a n u a l l y p o k et h e v a l ue s i n t o m e m o r y . A s o f t h i s w r i t i n g ,C om mo do re 's f re e, l on g- aw ai te d, T IM -l ik e m on it orh a s n o t a r r i v e d b u t I c o n t i n u e t o h o p e .

M E M P E E K u t i l i z e s t h e u s e r f u n c t i o n (U S R ) w h i c hjum p s t o t h e l o c a t i o n s t o r e d i n m e m o r y l o c a t i o n s1 a n d 2 . If M E M P E E K i s s t o r e d i n t h e s e c o n dc a s s e t t e b u f f e r (h e x 3 3 A ) i n i t i a l i z e l o c a t i o n s1 a n d :2 t o d e c i m a l 5 8 a n d 3 r e s p e c t i v e l y . M E M -P E E K w&s w r i t t e n s o t h a t t h e u s e r f u n c t i o n r e -t u r n s t h e d e c i m a l v a l u e o f t h e i n s t r u c t i o n g i v e nb y i t s a r g u m e n t (a d d r e s s). F o r e x a m p l e , i f y o uw a n t t o p e e k a t a n a d d r e s s l e s s t h a n d e c i m a l3 2 7 6 8 (n o t p a r t o f t h e B A S I C R O M s ) u s e i n y o u rp r o g r a m Y=US R (a d d r e s s), w h e r e a d d r e s s i s t h el o c a t i o n o f i n t e r e s t a n d t h e v a l u e o f Y i s s e tt o t h e i n s t r u c t i o n a t t h a t a d d r e s s . S i n c e t h ea r g u m e n t o f t h e u s e r f u n c t i o n i s l i m i t e d t o+3 2 7 6 7 , u s e a d d r e s s - 6 5 5 3 6 f o r a d d r e s s e s l a r g e rt h a n 3 2 7 6 8 . T h u s t o l o o k a t l o c a t i o n s i n t h eB A S I C R O M s (a l l a b o v e 3 2 7 6 8 a n d w h e r e M E M P E E K i sp ar ti cu la rl y u se fu l) u se Y =U SR (a dd re ss - 65 53 6).It i s n o t p o s s i b l e t o l o o k a t l o c a t i o n 3 2 7 6 8(t h e s t a r t o f t h e s c r e e n m e m o r y) w i t h t h i s p r o -g r a m b u t t h i s s h o u l d p r o v e n o h a n d i c a p a s P E E Kc o u l d b e u s e d .

M E M P E E K t a k e s a d v a n t a g e o f t w o s u b r o u t i n e s i nt h e P E T o p e r a t i n g s y s t e m . T h e f i r s t (l o c a t e d a th e x D O A n t a k e s t h e a r g u m e n t (a d d r e s s) i n t h ef lo at in g p oi nt a cc um ul at or (c on ve ni en tl y p la ce d

t h e r e b y t h e u s e r f u n c t i o n) a n d c o n v e r t s i t i n t oa t w o b y t e i n t e g e r s t o r e d a t h e x B 3 a n d B 4 .S i n c e I c h o o s e t o u s e a n i n d i r e c t i n d e x e d i n s t r -u c t i o n t o f i n d t h e d e s i r e d i n s t r u c t i o n t h e o r d e ro f t h e t w o b y t e s a t h e x B 3 (M S B ) a n d B 4 (L S B)n e e d t o b e r e v e r s e d . T h e s e c o n d s u b r o u t i n e a th e x D 2 7 8 c o n v e r t s a 2 b y t e i n t e g e r r e p r e s e n t i n gt h e i n s t r u c t i o n f r o m t h e a c c u m u l a t o r (M S B) a n dt h e Y r e g i s t e r (L S B) t o f l o a t i n g p oin t f o r m a n ds t o r e s i t i n t h e f l o a t i n g p o i n t a c c u m u l a t o r .T h i s v a l u e , t h e i n s t r u c t i o n , i s r e t u r n e d t oB A S I C a s t h e r e s u l t o f t h e u s e r f u n c t i o n .

T h e p r o g r a m , M E M P E E K , i s f a i r l y s i m p l e b u t w o u l db e u n n e s s a r y i f t h e a r b i t r a r y r e s t r i c t i o n o nP E E K i n g a t B A S I C w a s r e m o v e d . T h e r e s t r i c t i o nm a k e s n o s e n s e t o m e a s e v e n a r e l a t i v e l y i n e x -p e r i e nc e d m a ch i n e l an g u a ge p r og r a mm e r (m y s e lf)w a s a b l e t o g e t a r o u n d i t . T h i s t y p e o f p r o g r a mw o u l d o f c o u r s e n o t b e d i f f i c u l t f o r c o m p e t i t o r so f C o m m o d o r e t o w r i t e . I w r o t e t h i s p r o g r a m f o rt h e f u n o f i t , t o t r y t o u n d e r s t a n d h o w B A S I Cw o r k s a n d i n t h e h o p e o t h e r s w i l l f i n d i t u s e -f u l . F u r t h e r m o r e , I h o p e I c a n d i s c o u r a g e o t h e rm an u f a ct u r er s l i ke C o m m od o r e f r o m t r yi n g t o k e e ph o b b y i s t s f r o m a r e a l u n d e r s t a n d i n g o f t h e i rs of tw ar e b y a rb it ra ry r es tr ic ti on s.

M EM PE EK P ro gr am

0 3 3 A 1 ·=$33A0 3 3 A 2 0 A 7 D O 2 J S R $ D O A 7 c o n ve r t t o i n te g e r

0 3 3 D A 6 B 3 3 L D X $ B 3 i nt er ch an ge -

0 3 3 F A 4 B 4 4 L D Y $ B 4 $ B 3 a n d $ B 40 3 4 1 8 6 B 4 5 S T X $ B 4

0 3 4 3 8 4 B 3 5 S T Y $ B 3

0 3 4 5 A 2 0 0 7 L D X 1 /0 ; i ni ti al iz e i nd ex

0 3 4 7 A 1 B 3 8 L D A ($ B 3 , X); f in d i n st ru c ti o n

0 3 4 9 A 8 9 T A Y0 3 4 A A 9 0 0 1 0 L D A 1 1 0

0 3 4 C 2 0 7 8 D 2 1 1 J S R $ D 2 7 8 c on ve rt t o f lo at in g

0 3 4 F 6 0 1 2 R T S r e t u rn t o B A SI C

0 3 5 0 1 3 E N D

MICRO GOES TO EUROPE

In order to better serve the European6502 market, MICRO has selected L.P.Enterprises to be its sale distributorin Britain and Europe. All sales todealers and all new subscriptions willbe handled by L.P. Enterprises. Thiswill result is significantly lower costof MICRO. The prices of MICRO will be:

Single Copy Retail: approx.Six Copy Subscription:

$2.00$10.00

For subscr iption or dealer information,please contact:

L.P. Enterprises313 Kingston Road, Il fordEssex, IGl lPJ England

Page 50: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 50/60

ROCKWELL AJM 65 LOW-COST M1CROCOMPUTER

AVAILABLE LATE OCTOBER FROM

$375.00

Page 51: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 51/60

KIMBAS[

D r . B a r r y T e p p e r m a n2 5 S t . M a r y S t . , N o . 4 1 1T o r o n t o , O n t a r i o M 4 Y 1 R 2

C a n a d a

K I M B A S E i s a n a p p l i c a t i o n p r o g r a m w r i t t e n i n t h e6 5 0 2 m i c r o p r o c e s s o r m a c hi n e l a n g u a g e , d e s i g n edt o m a k e u s e o f t h e m o n i t o r s u b r o u t i n e s a n d m e m -o r y c o n f i g u r a t i o n o f t h e K I M - l m i c r o c o m p u t e r ,f o r c o n v e r s i o n o f u n s i g n e d i n t e g e r s f r o m o n eb a s e t o a n o t h e r . T h e i n p u t i n t e g e r (d e s i g n a t e dN U M B E R i s t o b e n o g r e a t e r t h a n 6 d i g i t s i n l e n -

g t h j la r g e 6 - d i g i t i n t e g e r s m a y c a u s e o v e r f l o wi n t h e m u l ti p l i c a t i o n s ub r o u t i n e s w i t h c o n s e q u -e n t e r r o r s i n c o n v e r s i o n . T h e b a s e t o b e c o n -v e r t e d f r o m (d e s i g n a t e d B A S E 1 ) a n d t o b e c o n -v e r t e d t o (B A S E 2) a r e e a c h i n t h e r a n g e f r o m 0 2 Ht o 1 0 1 1j th e l o w e r l i m i t i s s e t b y m a t h e m a t i c a lr e a l i t y a n d t h e u p p e r b y t h e l i m i t e d e n u m e r -a t i o n a v a i l a b l e f r o m t h e K I M - l k e y p a d .

T h e p r o g r a m i s s t a r t e d b y p l a c i n g N U M B E R , l o w e s to r d e r b y t e l a s t , i n p a g e z e r o 4 C - 4 E , B A S E l (e x p -r e s s e d i n h e x a d e c i m a l) i n 4 A , a n d B A S E 2 (a l s o i nh e x a d e c i m a l) i n 4 B . T h e p r o g r a m s t a r t s a t 0 2 0 0 ,a n d w i l l l i g h t u p t h e K I M - l L E D d i s p l a y w i t he i t h e r a n e r r o r m e s s a g e (a c c o r d i n g t o a n e r r o rf l a g s t o r e d i n z e r o p a g e 0 2 , c a l l e d E R R O R), o r

a r e s u l t d i s p l a y w i t h t h e i n p u t d a t a a n d a f i n a lr e s u l t u p t o 1 8 H d i g i t s i n l e n g t h (R E S U L T s t o r e d

i n 0 3 - 0 E) i n s u c c e s s i v e s e g m e n t s i n a f o r m a tt o b e d i s c u s s e d b e l o w , o r a c o m b i n a t i o n o f b o t hd i s p l a y s , i n a n e n d l e s s l o o p u n t i l t h e R S k e y i sp r e s s e d .

P ro gr am F un ct i on

A f t e r i n i ti a l i z a t i o n o f d a t a w o r k s p a c e, s e v e r a lt e s t s o f i n p u t d a t a v a l i d i t y a r e c o n d u c t e d .K I M B A S E r e c o g n i z e s f o u r e r r o r s t a t e s :

a) N U M B E R w i l l r e m a i n s a m e a f t e r c o n v e r s i o n(i . e . N U M B E R=OO O O O x w h e r e x i s l e s s t h a n e i t h e rb a s e) . K I M B A S E s e t s E R R O R=O 1 , R E S U L T=NU M B E R ,a n d s h o w s b o t h e r r o r a n d r e s u l t d i s p l a y s .

b) E i t h e r o r b o t h b a s e s a r e o u t s i d e t h e p e r m i s -s a b l e l i m i t s o f 0 2 - 1 0 . . . . K I M B A S E r e s e t s b a s e su n d e r 0 2 t o e q u a l 0 2 a n d b a s e s e x c e e d i n g 1 0 H t o

e q u a l 1 0. . . a n d e x e c u t e s p r o g r a m t o d i s p l a y r e s -u l t w i t h o u t a n e r r o r d i s p l a y .

c) B A S E 1=BA S E 2 . K I M B A S E s e t s E R R O R=02 ,R E S U L T=N U M B E R , a n d s h o w s e r r o r a n d r e s u l t d i s -p l a y s .

d) N U M B E R e n u m e r a t i o n i s i m p e r m i s s a b l e , a s o n eo r m o r e d i g i t s =BA S E l (e . g . , a t t e m p t i n g N U M -B E R : 1 C 3 5 2 A w i t h B A S E 1 : 0 5 ) . K I M B A S E s e t s E R R O R=03 , s h o w s e r r o r d i s p l a y , a n d a b o r t s f u r t h e r e x e -c u t i o n .

N o t e t h a t e r r o r s t a t e s " a " a n d "c'", a b o v e , a r en o t m u t u a l l y e x c l u s i v e , a n d t h a t K I M B A S E s e t st h e e r r o r f l a g E R R O R a n d g o e s t o t h e a p p r o p r i a t er e s p o n s e r o u t i n e a f t e r o n l y o n e p o s i t i ve t e s t .E r r o r s a r e d i s p l a y e d a s a c o n t i n u o u s f l a s h i n gL E D r e a do u t " E r r o r Y " w h e r e Y=ER R O R .

KIMB ASE - M AIN PROGRA M LISTING

F o l l ow i n g t h e t e s t r o u t i n es , if B AS E 1 ; lO H, K IM -B A S E c o n v e r t s N U M B E R i nt o i ts h e x a d e c i m a l e q u i v -a l e n t b y s u c c e s s i v e g e n e r a t i o n o f p o w e r s o fB A S E l, m ul t i p l i c a t i o n o f t h e a p p r o p r i a t e p o w e rb y t h e i n d i vi d ua l d i g i t s o f N U M B E R (r e m a p p e d b ym a s k i n g a n d s h i f t i n g i n t o a r r a y N), a n d s u c -c e s s i v e a d d i t i o n o f a l l t h e h e x a d e c i m a l p r o d -

u c t s . T h i s i n t e r m e d i a t e r e s u l t i s p l a c e d i na r r a y H E X C O N . A s u c c e s s i v e l o o p a l g o r i t h m w a su s e d f o r m u l t i p l i ca t i o n r a t h e r t h a n a s h i f t - a n d -b i n a r y - a d d a l g o r i t h m f or e c o n o m y o f c o d i n g .

H E X C O N = [ t . . N (Y ) • B AS E1 (Y -l ~y=1-6 j 1 0

T h i s c a l c u l a t i o n i s b y p a s s e d a n d N U M B E R e n t e r e dd ir ec tl y i nt o H EX CO N if BASE1=10 H .

A f t e r t h e c o n v e r s i o n t o h e x a d e c i m a l , i f B A S E 2=10 1 1 ' K I M B A S E s e t s R E S U L T=HE X C O N a n d t h e r e s u~ td i s p l a y i s i n i t i a t e d . I f B A S E 2;l O I f ' H E X CO N 1S

c o n v e r t e d i n t o B A S E 2 b y t h e c o m m o n s u c c e s s i v e

d i v i s i o n p r o c e d u r e b y B A S E 2 w i t h m a p p i n g o f r e m -a i n d e r s t h r o u g h a n i n t e r m e d i a t e a r r a y i n t oR U S U L T .

R e s u l t s a r e d i s p l a y e d o n t h e K I M - l 6 - d i g i t d i s -p l a y a s s u c c e s s i v e l - s e c o n d d i s p l a y s o f N U M B E R ,B A S E l a n d B A S E 2 , a n d R E S U L T d i v i d e d i n t o 6 - d i g i ts e g m e nt s , i n t h e f o r m a t :

N N N N N NI I b b O OR R R R R RR R R R R RR R R R R RR R R R R R

(N U M B E R 1 - N U M B E R 3)( I I =B A S E l j O O =B A S E 2 )(R E S U L T 1 - R E S U L T 3)(R E S U L T 4 - R E S U L T 6)(R E S U L T 7 - R R S U L T 9)(R E S U L T A - R E S U L T C)

w h i c h l o o p s e n d l e s s l y . W h e r e E R R O R=Ol o r 0 2 ,

t h e e r r o r m e s s a g e p r e c e d e s t h e r e s u l t d i s p l a y ,a n d l o o p s e n d l e s s l y i n t h e d i s p l a y .

A l l i n t e r m e d i a t e a r r a y s a n d p r o d u c t s h a v e b e e nr e t a i n e d i n t h e z e r o p a g e d a t a w o r k s p a c e t o f a c -i l i t a t e a n y d e b u g g i n g o r f u r t h e r e l a b o r a t i o n o ft h e p r o g r a m t h a t o t h e r u s e r s m a y f i n d n e c e s s a r y .

U s e r s o f n o n - K I M 6 5 0 2 - b a s e d m i c r o c o m p u t e r s m a yi m p l e me n t K I M B A S E e a s i l y w i t h a p p ro p r i a t e r e l o -c a t i o n o f p r o g r a m a n d w o r k s p a c e (i f n e c e s s a r y)a n d r e p l a c e m e n t o f t h e d i s p l a y s u b r o u t i n e s(S HO WE R- TI ME R 1 , S HO RE S- TI ME R2 ) w it h a pp ro pr ia tem a c h i n e - d e p e n d an t o u t p u t r o u t i n e s (o r b y B R K i n -s t r u c t i o n s w i t h m a n u a l i n t e r r o g a t i o n o f t h e a p -p ro pr ia te a rr ay s t o d et er mi ne o ut pu t).

*************** this section initializes data workspace and constants **********

CLD (12(1(1 D8 select binary rrode

LDX $#48 (11 A2 48 set workspace by te counter

ZEROl LDA $#(1(1 (13 A9 (1(1

STA ARRAY, X (15 95 (1 1 zero common workspace

DE X (17 CA d ec re me nt c ou nt er

BNE Z ERO 1 (18 D( I F9 if t(l loop back

LDA $#(lF (lA A9 (IF

STA M ASKl (lC 85 (I F s et M ASK 1= (l F

LDA $#F(I (IE A9 F( I

STA M ASK2 1(1 85 1( 1 s et M ASK 2= F( I

~~~f;lf!l 7:49

Page 52: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 52/60

LDA $#~5

STA PWR

LDX $#FF

TXS

12

14

16

18

A 9 ~5

85 11~

A 2 FF

9A

set PWR=~5

TST1NR

~~~************ t hi s s ec ti on tests i n put d at a vali d i t y *************************

set s ta ck p oi nt er =F F

CORRl

TST1BS

TST1B2

CORR2B

CORR2A

RESETl

TST2BS

CORR3

CORR3A

CORR3J1

TST3BS

HEXMAP

TST2NR

TLP2

TLPl

TRESET

CORR4

LDA $#fJfJ

C M P NUM B ERl

B NE TST1B S

C M F NUM B ER2

B NE TST1B SLDA NUM B ER3

C M P B A SE2

B C C C ORRl

JM P TST1B S

LDA $#l1l

STA ERROR

JM P C ORR3A

LDX $#fJ2

LDA B A SE, X

C M P $#fJ2

B e C C ORR2A

C M P $#11

B e C RESETl

LDA $#lfJ

STA B A SE, X

JM P RESETl

LDA $#~2

STA B A SE, X

DEX

B NE TST1B 2

LDA B A SE2

C M P B A SEl

B EQ C ORR3

JM P TST3B S

LDA $#~2

STA ERROR

LDX $#~3

LDY $#fJC

LDA NUM B ER, X

STA RESULT, Y

DEY

DEX

B NE C ORR3JJJSR SHOWERLDA B A SEl

C M P $#l~

B C C TST2NR

LDX $#fJ3

LDA NUM B ER, X

STA HEXC ON , X

DEX

B NE HEXM A P

JM P HEXl

LDA B A SEl

STA B STRl

A SL A SL

A SL A SLSTA B STR2

LDY $#~2LDX $#fJ3

LDA NUM B ER, X

A ND M A SK , Y

C M P B STR, Y

B C C TRESET

JM P C ORR4

DEX

B NE TLPlDEY

B NE TLP2

JM P REM A P

LDA $#~3

STA ERRORJSR SHOWER

19

lB

lD

IF

2123

25

27

29

2C

2E

3~

33

35

37

39

3B

3D

3F

41

43

46

48

4A

4B

4D

4F

5 1

53

5658

5 A

5C

5 E

6~

63

64

65

67

~~6A

6C

6E

7~72

74

76

77

79

7C

7E

8~

82

84

8688

8A

8C

8F

92

94

97

989A

9B

9D

A I}

A 2

A 4

A 9 fJ~

C5 4CDI} 14

C5 4D

DI} lfJA 5 4E

C5 4B

9fJ YJ3

4C 33

A 9 YJl

85 fJ2

4C 5 A

A 2 YJ2

B 5 49

C9 YJ2

9~ ~B

C9 11

9fJ ~B

A 9 lYJ

95 49

4C 4A

A 9 YJ2

95 49

C A

D 9 E8

A 5 4B

C5 4A

F~ ~3

4C 6A

A 9 YJ285 YJ2

A 2 YJ3

M ~C

B 5 4B

99 YJ2

88

C A

D~ F7

2fJ A YJA 5 4A

C9 lYJ

9YJ I}C

A 2 1}3

B 5 4B

95 25

C A

D Y 14C IF

A 5 4A

85 11

Y 1 A YJA

fJA YJA85 12

A YJ YJ2.A 2 1}3

B 5 4B

39 fJE I}YJ

D9 11} fJ~

9~ ~3

4C A y J

C A

D Y 188

Dy J EB

4C A7

YJ385 y J2

2y J A ~

A 9

TEST - ERROR STA TE "a"

NUMBER1=YJYJ?

no? go to next test

NUMBER2=YJYJ?

no? go to next test

N U M B ER 3 <' B A S E2?

yes? go to c or re ct io n r ou ti ne

Y J 2g o to next test

s et ER RO R= ~l

YJ2 an d jump to CORR3A

TEST - ERROR STA TE "b"

B ASE ( X) < YJ2?

y e s ? go to c or re ct io n r ou ti ne

B ASE( X)~ l l?

n o? by pas s c orre ct ion

otherwise set B ASE(X) =lYJ

~2 an d by pa s s n ext c orre c t i on

set B ASE(X) =YJ2

d ec re me nt loop c oun te r

an d go bac k i f IYJ

TEST - ERROR STA TE "c"

BASE2=BASE1?

y e s? go to c or re ct io n r ou ti ne

fJ 2o t h e r w i s e bypass

set ERROR=YJ2

re ad NUM BER

Y JY J i n t o R ES UL T

d ec re me nt c ou nt ers

an d loop un t i l c omple t e

Y JI }d is pl ay e rr or m es sa ge

BASE1=lfJ?

no? go to next test

yes? re ad NUM BER

i nt o HEX CON

F9 for all 3 b y t e s

~3 an d bypass h ex c on ve rs io n

TEST - ERROR STA TE "d"

s to re B ASEl

an d le ft s hi ft 4 b i t sto store BSTR2=(1~*BASE1)

i s olat e e ac h d igi t NUM BER(X)

by mas ki ng

an d c ompare wi t h B STR

i f less, reset loop

fJ2 ot he rwi se i mpe rmi ss able - c orre ct

d ec re me nt c oun te r NVM BER

an d re pe at for c orre s pon d i ng d igi t sd ec re me nt c ou nt er B STR/ MA SK

an d re pe at for re mai n i ng d igi t s

y J2 go to REMAP

set ERROR=fJ3

y Jy Jan d d is play e rror me ss age

Page 53: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 53/60

*************** this section remaps NUMBER for conversion to hex ***************

REMAP

REMAPl

MASKSl

REMAP2

LDX $#~3

LDA NUMBER,X

STA NHI,X

STA NLO,X

DEX

BNE REMAPl

LDX $#~3

LSR NHI,X

LSR NHI,X

LSR NHI,X

LSR NHI,X

LDA NW,X

AND MASKl

STA NLO,X

DEX

BNE MASKSl

LDY $#~l

LDX $#~3

LDA NLO,X

STA N,Y

INY

LDA NHI,X

STA N,Y

INY

DEX

BNE REMAP2

A7

A9

AB

AD

AF

B~

B2

B4

B6

B8

BA

BC

BE

C~

C2

C3

C5

C7C9

CB

CE

CF

Dl

D4

D5

D6

A2 ~3

B5 4B

95 12

95 15

CA

D¢ F7

A2 ~3

56 12

56 12

56 12

56 12

B5 15

25 ~F

95 15

CA

D~ EF

A~ e iA2 ~3

B5 15

99 18 ~~

C8

B5 12

99 18 ~~

C8

CA

D¢ Fl

load NUMBER

into NHI

and into NW

loop until done

right shift

NHI

4 bits

isolate right digit NW

loop until done

store NLO into N

alternately

with NHI

and in inverse order

*************** this section converts N into hexadecimal ***************************

loop until done

HEXCNV

LP1PWR

RESET2

RESET3

RESET4

RESET5

RESET6

LDY $#~6

JSR PWRGEN

LDA N,Y

CMP $#~l

BEQ RESET3

BCC RESET5

STA MULTP

TYA

PHA

JSR MULT

PLA

TAY

CLC

LDX $#~3LDA MULTC,X

ADC HEXCON,X

STA HEXCON ,xDEX

BNE RESET4

DEY

BEQ HEXl

DEC PWR

LDA PWR

CMP $#~l

BEQ RESET6

BCS LP1PWR

LDA N,Y

STA MULTC3

LDA $#~f'

STA MULTCl

STA MULTC2

LDA BASEl

STA MULTP

LDA PWR

CMF $#~l

BEQ RESET2

BCC RESET3

***************

~2D8

DA

DD

E~

E2

E4

E6

E8

E9

EAED

EE

EF

F~F2

F4F6

F8

F9FB

FC

FE

~3~~

~2

~4

~6

~8

~B

~D

~F

11

13

15

17

19

lB

lD

A~ ~6

2~ 6~ ~f'B9 18 ~~

C9 ~l

F~ ~B

9~ 15

85 IF

98

48

2~ 8~ ~~68

A8

18

A2 ~3B5 IF

75 25

95 25

CA

D~ F7

88

F~ 21

C6 ~~

A5 ~~

C9 e:F~ ~2

B~ D2

B9 18 ~~

85 22

A9 ~~

85 2~

85 21

A5 4A

85 IF

A5 ~~

C9 ~l

F~ CB

9~ D~

for six places

generate powers of BASEl

N(Y)=~l?

if equal, go to RESET3

if less, go to RESET5

set MULTP=N(Y)

put index Y into accumulator

and push onto stack

multiply power by N(Y)

pull accumulator from stack

and restore to Y

add new product

to intermediate product

and store as intermediate product

loop until done

for next place

if counter=~ bypass

reduce power to be generated

PWR=~l?

yes? go to RESET6

greater? loop back to new conversion

set MULTC=N (Y)

set MULTP=BASEl

PWR=~l?

yes? go to RESET2

less? go to RESET3

this section produces result from HEXCON when BASE2=1~ *************

HEXl LDA

CMP

BCC

LDY

LDX

BASE2

$#l~

ZER02

$#~C

$#~3

IF

21

23

25

27

A5 4B

C9 l~

9$ l~

M ~C

A2 ~3

BASE2=1~?

no? go to ZER02

7:51

Page 54: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 54/60

HEX2 LDA HEXC ON ,xSTA RESULT, Y

DEY

DEX

B NE HEX2

JSR SHORES

29

2B

2E

2F

311

32

B 5 25

99 1)2 1111

88

C A

DI1 F7

211 911 1)3

s to re HEX CON

i nt o RESUL T

loop un t i l d on e

an d d i splay re s ult

ZER02

*************** t hi s s e c t i on d ivi d e s HEXC ON b y B A SE2 for crud e c onvers i on ***********

s e t D IV IS = BA SE 2

LP1DIV

LP2DIV

TST1QO

RESET7RST7A

ENDDIV

STA DIVIS

LDX $#1)3

LDA HEXC ON ,x

STA DIVD, XDEX

B NE LP1DIV

LDy $#18

JSR DIVIDE

LDA RDR

STA RSTOR, Y

LDX $#112LDA QUO, X

C M P $#111

B C S RESET7

DEX

B NE TST1QO

LDA QU03

C M P DIVIS

B C C ENDDIV

LDX $ #113LDA QUO, X

STA DIVD, X

LDA $ #1111

STA QUO, X

DEX

B NE RST7A

STA RDR

DEY

B EQ ENDV2

JM P LP2DIV

DEY

LDA QUO 3

STA RSTOR, Y

11335

37

39

3B3D

3E

41 1

42

45

47

4A

4C

4E

511

52

53

55

57

59

SB5 D

5F

6163

65

6668

6 A

6 B

6 D

711

71

73

85 2C

A 2 113

B 5 25

95 28C A

D IJ F9

A I1 18

211 11) 111

A 5 31)

99 311 1111

A 2 112

B 5 2C

C9 111

B I1 119

C A

D IJ F7A 5 2F

C5 2C

911 15

A 2 1)3B 5 2C

95 28

A 9 1)11

95 2C

C A

D I J F585 31)

88

FI 1 119

4C 42 113

88

A 5 2F

99 311 1111

l oa d HEX CON

i n to DIVD

loop u n t i l d o n e

f or 18 p l a c e s

e xe c ut ~ d i vi si on

load RDR

i nt o RSTOR

QUO(l or 2)~1)1?

y e s? go to RESET7

loop u n t i l d on e

QU03=DIVIS?

le s s ? go to ENDDIV

load QUO

i n t o DIVD

zero QU O

lo op un t i l d on e

zero RDR

d ec re me nt pla ce c oun te r

i f =1 1 go to ENDV2

ot he rwi se bac k to d ivi de ro ut in e

d ec re me nt pla ce c oun te r

lo ad QU03

i n t o n ext RSTOR s lot

ENDV2

*************** t hi s s e c t i o n maps RSTOR i n t o RESULT fo r fi n al re s ult ****************

REMAP3

1. PWRGEN

LDY $#I)C

LDX $#18

CLC

DEX

LDA RSTOR, X

A SL A SL

A SL A SL

INX

AOC RSTOR ,X

STA RESULT, Y

DEY

DEX

DEX

B NE REM A P3

JSR SHORES

76

78

7A

7B

7C7E

81)

82

83

85

88

89

8A

8B

8D

A I1 I1C

A 2 18

18

C A

B 5 30

I1A I1A

I)A I)A

E8

75 31)

99 112 1111

88

C A

C A

DI1 EE

211 91) 1)3

le ft s hi ft al t e rn a t e b y t e s

RSTOR 4 b y t e s

ad d to n ext by t e RSTOR

an d s t ore as RESULT

loop un t i l d on e

an d d i s pl ay re s ul t

Subroutine to ge n e rat e ab

by s uc c e s s ive i t e rat i on s of mult i pli c a t i on s u brout i n e M UL T

wi t h re s e t t i ng of c oun t e rs a n d i n t e rme d i at e prod uc t s ; a llows un s i gn e d bi n ary or

d e c i m al a ri t hme t i c i n 6 5 1)2 i n s t ru c t i on s e t ; maximum re s ul t me mor y al loc at e d 18H

b i t s .

Re qu ire s: s ub rout in es : M ULT

d at a array s: B A SEl

PW R

PWRS

MULTP

MULTC

11114A

111)111)

1111111

11111F

111121)-111122

Inapplicable to PWR= I1I1, l)l; alli ng program mus t t es t an d by pas s.

Page 55: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 55/60

PWRGEN LDA PWR 1)1)61) AS 1)1) load power

STA PWRS 62 85 1)1 store in counter

DEC PWRS 64 C6 1)1 decrement counter

LDA BASEl 66 AS 4A

STA MULTP 68 85 lF set mul tiplier=base

STA MULTC3 6A 85 22 set multiplicand=base

LDA $#1)1) 6C A9 1)1)

STA MULTCl 6E 85 21) zero 2 high-order bytes

STA MULTC2 71) 85 21 of mul tiplicand

TYA 72 98 transfer index Y to accumulator

PHA 73 48 and onto stack

JSR MULT 74 21) 81) 1)1)jump to MULT

DEC PWRS 77 C6 1)1 decrement counterBNE MULTCL 79 DI) F9 if II) return to MULTCL

PLA 7B 68 pull accumulator from stack

TAY 7C A8 and restore to index Y

RTS 7D 61) return to main program

MULTCL

2. MULT

Subroutine multiplies 24-bit number (MUL1'C) by 8-bit number (MULTP) to

yield 24-bit final product (MULTC) by successive iterations of nested

addition loops. Intermediate product storage in MIDPRO. Allows unsigned

decimal or binary operation in 651)2 instruction set.

Requires data arrays MULTP

MULTC

MIDPRO

I)I)1F

1)1)21)-~11)22

1)1)23-~11)25

Inapplicable to MULTP less than 1)2; calling program to test and bypass

MULT LDY MULTP 1)1)81) A4 lF loop counter=multiplier

DEY 82 88 decrement loop counter

0LDX $#1)3 83 A2 (J3 set byte counter in loop

REDIST LDA MULTC,X 85 B t: lF set intermediate register-'STA MIDPRO,X 87 9S 22 =multiplier

DEX 89 CA for each byte in array

BNE REDIST 8A D(l,19 loop until x=1)

ADLP2 LDX $#1)3 8C A2 1)3 set byte counter in loop

CLC 8E 18 clear carry

ADLPl LDA MULTC,X 8F B5 lF add multiplicand

ADC MIDPRO,X 91 75 22 to intermediate product

STA MULTC ,x 93 9S lF store as new multiplicand

DEX 95 CA. for each byte in array

BNE ADLPl 96 D(J'F7 loop until x=1)

DEY 98 88 decrement loop counter

BNE ADLP2 99 D(l,'l another loop if YItJ

RTS 9B 6(1,' return to main program

3. DIVIDE

Subroutine to divide 24-bit dividend (DIVD) by 8-bit divisor (DIVIS) to

yield 24-bit quotient (QUO) and 8-bit remainder (RDR) by successive shift

and subtraction processes; unsigned binary arithmetic only in 651)2 instruction

set. Intermediate quotient storage in QUO. Requires initialization of RDR

and array QUO to I) by calling program, DIVISII).

Requires da ta arrays DIVD 1)1)29-1)1)2B

DIVIS 1)1)2C

QUO 1)1)2D-1)1)2F

RDR 1)1)31)

DIVIDE LDX $#19 I)1 11) A2 19

LOOPl ASL RDR 12 1)6 31)

ASL QU03 14 1)6 2F

LOOP1A BCS HIQUOl 16 BI) 28

ASL QU02 18 1)6 2E

BCS HIQU02 1/1 BI) 2F

ASL QUOl lC 1)6 2D

~~(!j~l!) 7 : 5 3

load shift counter

left shift remainder

left shift quotient LSB

go to incrementing routine

if carry set

left shift quotient mid-byte

go to incrementing routine

if carry set

left shift quotient MSB

Page 56: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 56/60

LOOP2

LOOPJ

LOOP4

HIQUOl

HIQU02

HIORDl

HIORD2

INCR

FINIS

CLC

ASL

BCS

DIVDJ

HIORDl

ASL

BCS

DIVD2

HIORD2

ASL

BCS

DIVDl

INCR

DEX

BEQ

SEC

LDA

SBC

BMI

STA

ASL

ASL

INC

Jl1P

ASL

INC

BCS

FINIS

RDR

DIVIS

LOOPl

RDR

RDR

QUOJ

QUOJ

LOOP1A

QU02

QU02

HIQU02

ASL

JMP

ASL

INC

JMP

ASL

INC

BCS

QUOl

LOOP2

QUOl

QUOl

LOOP2

DIVD2

DIVD2

HIORD2

ASL

JMP

ASL

INC

JMP

INC

JMP

LSR

RTS

DIVDl

LOOPJ

DIVDl

DIVDl

LOOPJ

RDR

LOOP4RDR

4. SHOWER & TIMERl

58

5 A

/ 1 l 5 D

5F

61

64

6669

6 B

lE

IF

21

18

/ 1 6 2B

B / 1 2F

clear carry

left shift dividend LSB

go to incrementing routine

if carry set

left shift dividend mid-byte

go to incrementing routine

if carry set

left shift dividend MSB

go to incrementing routine

if carry set

decrement shift counter

jump to end if X=¢

set carry

from current remainder

subtract divisor

back to LOOPl if negative

store difference as remainder

left shift remainder

left shift quotient LSB

increment quotient LSB

and go back to LOOP1A

left shift quotient mid-byte

and increment it

go to further incrementing

routine if carryleft shift quotient MSB

and back to LOOP2 (if C=¢)

left shift quotient MSB

increment quotient MSB

and back to LOOP2

left shift dividend mid-byte

increment dividend mid-byte

go to further incrementing

routine if carry

left shift dividend MSB

and back to LOOPJ (if C=¢)

left shift dividend MSB

increment dividend MSB

and back to LOOPJ

increment remainder

and back to LOOP4

right shift remainder to end

return to main program

Subroutines to generate error message for display on the KIM-l 6-digi t LED readout

by successive lighting of appropriate segments of the individual digits using a

message lookup table.

SHOWER requires: subroutines: TIMERl

SHORES

SHOWER

DISP2

DISPl

data arrays: SADD

SBDD

SADSBD

ERROR

MSGERR

MSGNUM

LDA $#7F

STA SADD

LDA $#lE

STA SBDD

LDY $#¢8

LDX $#¢5

STY SBD

LDA MSGERR,X

STA SAD

JSR TIMERl

INY

¢¢A¢

A2

A 5

A7

AA

AC

AE

B l

BJ

B 6

B9

2J

25

/ 1 6 2A

B / 1 J6

27

29¢6 29B¢ J9

2B

2C

2E

2F

Jl

JJ

J5

J7

J9

JD

J D

4 !J

42

44

C' A

F¢ JB

38

A ,5 J¢

£5 2C

3(1 DD

115 J¢

~'6 J¢

~16 2F

E6 2F

,IC 16 e i¢6 2E

E6. 2E

B¢ ¢5

46

484B

4D

4T

52

54

56

116 2D

·4C lE e i1;16 2D

E '6 2D

4C lE $1

(J6 2A

E6 2A

B¢ ¢5

¢6 294C 29 ¢1

/16 29E6 29

4C 29 (ill

E6 J¢

4 C 2B (ill46 J¢

6(i1

¢¢DE-$¢E9

¢J911-¢JCF

174.1

1

1743

l74!~1742

¢$¢2

$¢D6-¢¢DA

¢¢DB-¢(ilDD

A9 7F

8D 41 17

A9 lE

8D 4J 17

A¢ (il8

A2 ¢5

8C 42 17

B5 D5

8D 4¢ 17

2(i1 DE ¢¢C8

timing loop for display

result display for ERROR=¢l or ¢2

monitor storage for readout

set output directional vector A=7F

set output directional vector B=lE

set digit selection counter

set loop counter

select digi t

select segments

to be lit (from lookup table)

and jump to timing loop

select next digi t

7 ~/r

Page 57: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 57/60

I NY B A C8

DEX B B C A d ec re me nt l oo p c oun te r

B NE DISPl B C D~ F~' i f t~ lo op agai nLDA $ #12 B E A 9 1".

n STA SB D C~ 8D 42 17 for s ixt h d i gi t

LDX ERROR C3 A 6 ~., s e t i n d ex to e rro r fl ag.

LDA M SGNUM , X C5 B 5 Dli an d s el ec t s egm en ts

STA SA D C7 8D 4~' 17 to be l i t (f rom l oo ku p t a bl e )

JSR TIM ERl C A 2~ DB ~~ an d ju m p to t imi ng l oop

LDA ERROR C D A 5 ~.,.C M P $#~3 CF C9 ~3 i f ERR OR =~3

B EQ DISP2 Dl F~D7

l oo p s a m e d i s pl ay aga i nJM P SHORES D3 4C 9~' ~3 o th erwi se jum p to s how re su lt

l oo ku p t ab le s:

~ ' D 6 D I I DC D~ D II F9 MSGERR

~'DB 86 DB CF MSGNUM

TIMERl r eq u ir e s: i n t e r v a l t im e r lo c a t i on l7~i '

TIMERl LDA $ # F F ~~DE A 9 rr s e t t i me r fo r ap proxi ma t e ly

STA l7~7 E~ 8D ~7 17 200 m il l i s e c on d s pe r d igi t

DEL A Yl NOP E3 EA d o n ot hi ng b ut l ight s e gm e n t s

B IT l7~7 E4 2C ~7 17 t i m e up?

B PL DEL A Yl E7 l~ rn n o? k e e p li t

RTS E9 6~ y es ? ba c k to SHOWER f or n ext d igi t

5 . SHOR ES & TIMER2

S u b r o u t i n e s to ge n e ra t e re s ul t d i s pl ay on t h e K I M - l 6 - d i gi t LED re ad o ut b y l oa d i ng

a pp rop ri at e d at a i n t o a rray DISP f or d i s p la y by K I M m on i t o r s ub rou t i n e SC A NDS.

SHORES re qu ire s: s ubrou ti ne s: TIM ER2

SHOWER

SHORES

WADNl

WADN3

WADN2

da t a arra y s: ERROR

RESULT

BASE

NUMBER

DISP

$#~l

$#~3

NUMBER ,X

DISP,Y

~39~

92

94

96

99

9A

9 B

9D

A~

A 2

A 4A 6

A 8

AA

A C

A F

B l

B 3

B 5

B 8

B 9

BA

B C

LDY

LDX

LDA

ST A

INY

DEX

B NE

JSR

LDA

ST A

LDAST A

LDA

ST A

JS R

LDX

LDY

LDA

STA

INX

DEY

B NE LOA DN2

LOADNl

TIMER2

BASEl

POINTH

$ # B BPOINTL

BASE2

INH

TDfER2

$#~l

$#~3

RESULT, X

DISP,Y

TX A

~3D~·-~3E5

~~A~'-~~D5

t i m i n g lo o p fo r d i s p la y

e rro r d i sp la y fo r ERROR= ~l or ~2

~~~2

~~~3'-~~~E

~~4A·-~~4B

~~4C'-~~4E~~F9'-~~FA m o n i t o r

~~F9

~~FA

~~FB

s torage f or re ad out :

INH

POINTL

POINTH

A~

A 2

B 5

99

C8

C A

D II2~

A 5

85

A 985

A 5

85

2~

A 2

A~

B 5

99

E8

88

D I I F7

~l

~3

4B

F8

s e t i n d ex fo r DISP

s e t i n d ex fo r NUM B ER

pu t NUM B ER i n t o DISP

~3

i n cre m e n t DISP i nd ex

d e cre m e n t NUM BER i nd ex

l oo p u n t i l DISP i s f ul l

a n d ju mp to t im in g/ di sp la y l oo p

l oa d B ASEl

i n t o t w o h igh e s t d i gi t s

lo ad B Bi n t o t w o mi d d le d igi t s

l oa d B ASE2

i n t o t w o l ow e s t d i gi t s

an d jum p to t im in g/ di sp la y l oo p

s e t i n d ex fo r RESULT

s e t i n d e x f or DISP

p ut RESUL T (3 b y t e s at a t i m e )

i n t o DISP

i n cre me nt RESULT i nd e x

d ec re me nt DISP i n de x

lo op u n t i l DISP i s fu l l

p ut RESULT i nd e x i nt o ac cu mu la t o r

4A

FB

B BFA

4B

F9

D II~l

~3

~2

~3

F8

8A

Page 58: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 58/60

PHA B D 4 8 an d pus h on t o s t ac k

JS R TIM ER2 B E 2r) Dr) r )3 now jump to t i m i ng / d i s p l a y loop

PLA C 1 6 8 pull ac c umulat or from s t ac k

TA X C 2 AA an d put i n RESULT i n d ex X

C PX $#(/ D C 3 E( / (/D i s X> ac:B C C LOA DN3 C 5 9r) EA . i f n ot , loop b ac k to load DISPLDA ERROR C 7 A 5 (/2 i f y es , d oe s ERROR= r)(J?

C M P $#(/(/ C 9 C 9 r)~'B EQ SHORES C B Fr) C 3 i f y e s , l oop agai n for w ho ie d is pl ay

JM P SHOWER C D 4 C M' r)r) ot he rwi s e s how e rror

T IM ER 2 r eq ui re s : s u b r o u t i n e s: SCANDS 1FlF m o n i t o r d is pl ay s ub ro ut in e

d at a array s: C TLP (/(3 4 9

interval t im er l oc at io n 1 7( / : 7

TIM ER2 LDA $ #( / 5 (/3D(3 A 9 r)SST A CTLP D 2 8 5 4 9 set l oo p c ou nt er

DSPN2 LDA $ # F F r)3D4 A 9 F C ' set t i me r for maximum runST A 1 7( / 7 D 6 8 D (/ 7 1 7

DSPN1 JSR SCANDS D 9 2 (/ 1 F 1F an d c all d is play s ubrout in e

B IT 1 7( / 7 tx: 2 C (/ 7 1 7 t i me up?

B PL DSPN1 D F 1{J F8 no? mai nt ai n d i s play

DEC CTLP E1 C 6 4 9 d e c r e m e n t l oo p c ou nt er

B NE DSPN2 E3 Dr) EF i f 1(/, r e s e t t i me r an d ma i n t ai n d i s playRTS E5 6 r) ot he rwi se bac k to SHORES for n ext e n t ry

Even though we had extra copies of MICRO printedwe could not keep up with the demand for backissues. We have run out of all back issues andall copies of "All of MICRO Volume 1". Since alot of people who are just finding out aboutMICRO or are just getting into the 6502 worldstill want the information which was containedin the first year of MICRO, we have decided toprint "The BEST of MICRO Volume 1".

This will contain most of the articles but noneof the advertising. A few articles which weretopical and are now out-of-date will be droppedand all known microbes will be corrected back inthe original articles. The book will beorganized by subject. Aside from these minor

changes, the content will be identical to thatof MICRO numbers 1 through 6. If you alreadyhave them, you will not profit by getting thenew edition. If you do not have them, then thiswill be the only way to get the information.

"The BEST of MICRO Volume 1" will be availableabout the first of November. It will be about160 page long in an 8 by 11 format, soft cover.The price will be $6.00 (plus $1.00 postage US)

Send your Check or Money Order to:

The BEST of MICROP. O. Box 3

So. Chelmsford, MA 01824

ADV[RTISING IN ~ICRO

It doesn It COST to advertise in ~lICRO, it PAYS!

MICRO us currentl y pr int ing 10,000 copies fordistribution. 3000+ will go immediately to sub-scribers and dealers. The remainder will go tonew subscribers and to replenish dealer stockthroughout the coming year - so you get a lot ofcoverage for your dollar, into a readership thatis eager to know about 6502 oriented products.

DEADLINES for Issue Number 8 - December/January

Ad Reservation by 6 NovemberAd Copy by 13 November

The rates are very re3sonable for the coverage:

(4 x 5)(8 x 5)(8 x 10)

Quarter PageHal f PageFull Page

$50.00$75.00

$125.00

10% discount on six consecu.tive insertions.

Send Ad copy to:

MICRO, P.O. Box 3, So. Chelmsford, MA 01824

or call for info or Ad reservation:

617/256-3649

Page 59: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 59/60

I

In perlormance. In quality. In availability. OEMs, educa-

tors, engineers, hobbyists, students, industrial users:

Our Versatile Interlace Module, SYM-l, is a fully-

assembled, tested and warranted microcomputer board

that's a true single-board computer, complete with

keyboard and display. All you do is provide a + 5Vpower supply and SYM-l gives you the rest-and that

includes fast delivery and superior quality.

Key features include:

• Hardware compatibility with KIM-l (MOS Techno]-

ogy) products.

• Standard interlaces include audio cassette with

remote control: both 8 bytes/second (KIM) and 185

bytes/second (SYM-l) cassette formats; TrY and

RS232: system expansion bus: TV/KE expansionboard interlace: four VO buffers: and an oscilloscope

single- line display.

To place your order now, contact your local area distributor or dealer

OEM Distributors Technico

Kierulff Electconics General Radio

Steriing Electronics (Seattle only)

Zeus Components

Western Microtechnoloqy

Future Electronics

Alliance Electronics

Arrow Electronics.ionex

Personal Computer Dealers

(~.ie.·/Ti""!cn Computer ExchanGe

~_;-::l , , , ,:-,[i:;'CL :"::iC:~\~G!';

• 28 double-function keypad with audio response.

• 4K byte ROM resident SUPERMON mon itor includ-ing over 30 standard monitor functions and user

expandable.• Three ROM/EPROM expansion sockets u , _ ) lC

24K bytes total program size.

• lK bytes 2114 static RAM, expandable to-~( t"c

on-board and more off-board.

• 50 I/O lines expandable to 70.

• Single + 5V power requirements.• Priced attractively in single unit quantities

without keyboard/display, with OEM disu:ii

larger quantities.

§Synertek SystemsCOrporation.150·160 S.Wolfe Road. Sunnyvale, Cali fornia 9408. ';

(408) 9885690.

Technico

Columbia. Maryland

Computerland

Mayfield Heights. Ohio

RNB Enterprises

King of Prussia. Pennsylvania

Computer Shop

Cambridge, lv1assachusetts

C oropu ter Cash

Ancrona

Culver City. Ce.n.

General Radio

Camden, New

Advanced CorPf:"_::'"

Santa Ana, Califr': ce,

Computer COPl'

/~!!t!"onic:,

Page 60: Micro 6502 Journal October 1978

8/3/2019 Micro 6502 Journal October 1978

http://slidepdf.com/reader/full/micro-6502-journal-october-1978 60/60

SYSTEMS·Apple II 16K RAM5119500 • Commodore PETBKRAM579500 • Commodore KIM I 517500

svnertek VIM s26900 • Microproducts super KIM s39500

*Deliverv on most systems is usually stock to 2 weeks. Callor write for specific information.

H A R D W A R E

CLASSES AND WORKS'HOPSAll classesand workshops listed here are free of charge but have limited enrollment. Preference will be given toregular CCIcustomers in the event of an overflow crowd.

WORKSHOPS: Call for detailS.KIM-2nd Saturday of the Month • PET-3rd Saturday of the Month

APPLE-4th Saturday of the Month

CLASSES:Apple TopicsWe offer a series of free classeson APPle II to acuatnt owners with some of the unique features and capabu t t resof their system. Topics covered are Apple sounds, Low Res.Graphics, Hi Res.oraprucs, Diskaaslcs, and How to Use

Your Reference Material Sessionsare held every Thursday Night at 7:00 o.rn.

WHY .S,HOULDYOU BUY FROM US?

S O F T W A R EWenow have a complete software catalog.IIPPl~:APPletalker'Bomber'

space Male'Applevl~lon .

COlOrorgan'

tas Vegas SI"[~ Jack

Name an r r Addresso t neuoMicrocrco ucts Assern bler- TapeMicrccroc urrs Alsem OIer-DI~k

RAM restROMTest

APPle MUSICscrrape Insranr library

1 8 tapes ptus s or ta pe r n er nn e rs m pn0 1 1 1 DISK:Inventorv SystemText Editor

Mailing lil t8~"ordN RepOrtE rec r ro ruc mcex Card File'

Best of BI~hOP'[6 proqrams on one o Iskl

.P rograms ov Sob B IsllOP

PET:Fln~nceDrawotneuoSlaCk JaCk

life

Star wa r sstar rrevMugwump,

Read Iw" te MemOryG a la x v G a rn e s

Off rn e W<JII'ra rce r pongMortgJgeDiet Planner: aiorvtnrn

BaSICBASICpet system Mon i torPOint & Figure StOCkMarke[ PlotTNT Game pan 1

TNT Game P"c~ -2

515.95

9.95

1000

5.009.,"5

10.0010.0010.00

'19.952a.95

7.507.5015.00

3995

1250050.00

30.0050.0019.95~9.95

$"1.95

500500sao500

5.00500

5.00

1000

995

99514.951a 9S

M 9519.95

7.5010.0010.00

APPLE II HAAOWAAE;, Programmable printer Interface IPara:llell

on noarc eororn printer cnver. full handshake logic. driver program for

Centronics, A>10m,II, SWTPCPR'~O,ana others assemoieo & cestec 580.00

Power contrOl lnterFac'e r=rom T W C . ProductS)UP to 16 Channel; of A c _ control per card. contrcuec from BASIC .acnchannei capable of 12 amps at 110V. oorrcauv Isolated from A.C. nne ilLloads <Ire swucneo via a lOw D_(_ volwge on a ribbon cable rcabreinc luctedl complete sYstem eQLllppect fo r a A.C ct rcu ics .Kit $95.00

Assembled S13S.oo

AaClIClOnal 4 c ircuit A .C Power ModulesKit $35.00

Assernoreo S55 00

Joynick Wlcn 3 switcnesGreat For APple Games lIke star wars mciuces trimmers to cauorate forfull deflection 535.00

Upper & lower case ,lIoard

NOw you can 0lsolav bath UDPer and lower case characte rs on vour vioeo

with the Apple II. mciuces assembled circult o oam and samplesot rwars 549.9S

Apple Disk II " $595.00

App lesoft ROM care-

• Heuristics Speechlab

Apple High speed Serial Interface •

520000

5189.00

518000

Apple,communicatlons card' $180.00

Apple Pro to typlna, Board 524.95, we are assurn l ng r na r these I[ems Wil l be available f rom s r ock bv tile tl m e

rn ISIS ouousneo

PET HA.IlOWAAEBeeper 52495

529.95etunia-for compute r generated sounds

Video BufFer - co put vou r pen pictures on a teleVISIOn set or

rnorutcr 529.95

JOystlek-wlm four swrrcnss. speaker, and VOlume con troi Sa9 9 5

;PR·IIDprinter-with cable for per and pri nter criver sortwareSoftware K r '5;00.00

A5sembled 5425 00

centronics P·1 Mlcroprlnter-wlrn cable and software for pet 5510.00

COmmodore Hardeo.PY' Prlnter-1available No~ember <; > I 5695.00