micro 6502 journal october 1979

68
8/3/2019 Micro 6502 Journal October 1979 http://slidepdf.com/reader/full/micro-6502-journal-october-1979 1/68

Upload: cubemanpdx

Post on 06-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 1/68

Page 2: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 2/68

~•••••••••••••••••••••••••••••••••••••• *t NOW PRESENT ING .. • .... .: Apple software :t for your Entertainment" Business" Education :

.. *...

S'"rA "rllft/OII':F IL EM A ST ER 2 pro gram s: FORMAT & RETRIEVAL compr ise

a p ow erfu l da ta file m an ag er. G reat fo r eve ry th ing fro m p ho ne lists

to lega l ab strac ts. N eeds 32K . D esign your ow n data struc ture. U p

to 500 characters pe r record . U p to 15 searchab le fields in any com -

b ina tion . O n D isk . . . . . . . . . . . . . . . . . . . . . . . . . $ 34 .95

S PA C E M u lti·fac eted s im ulatio n o f life in in te rs tellar so cie ty . Y ou

and opponents m ust m ake life & d ea th d ec isio ns. I(eep s tra ck o f

you r p rog ress from one gam e to nex t. N eeds 48K and A ppleso ftROM . D isk ......•..................... $ 29 .95

Po t O 'G o ld lor ou r A ll N ew Pot 0 ' G old II A collection o f 49 p ro -

gram s fo r 16K A pp le . E ve ryth ing from Logic to ac tion gam es . O nly

a buck a gam e. Spec ify lor II . P rice each: Tape $49 .... D isk $54

A DV EN TU RE Figh t o ff p irates and v ic ious dw arfs. 700 trave l op -

tio ns , 14 0 location s, 64 ob jects . N eeds R OM & 48K . D isk .. $29 .95

16 K C AS SE TT E IN VE NT OR Y U se item n um ber, desc rip tion ,

sto ck am ou nt, reorder am ou nt, res to ck d ate , cos t & s ell p ri ce . H o ld s

up to 140 item s. T ape . . . • . . . . . . . . . . . . . . . . . . . . $ 35

3 2K D ISK IN VE NT OR Y: U se s tock nu mb ers desc rip tio n, v en do r,

record of pu rchase and sales date , am ount on hand , cos t & s e ll p ri ce ,

to ta l va lu e. H old s up to 300 item s. D isk ............•. $40

W ith Pa rts Explosion : D isk $50

3 2K D AT A B ASE C ro ss file fo r p ho ne lists , b ib liog rap hies , rec ipes.

Run up to 91 ines of 40 co lum ns each . Search by item anyw here.

D isk . $20

24K H I-RE S LIFE S IM ULA TIO N C onw ay 's equations on 296x180

screen . A m athem atica l sim ula tio n to dem o po pu latio n grow th w ith

b irth , dea th and surv iv al as factors. T ape ....• ..•..... $10

16K C IR CU IT L OG IC D EV ELO PM EN T A ID E va lua te circu its of

up to 255 gate s, in cluding A ND , OR , NO R, N AND , X OR , XN OR

and INVERTER . Tape ................•....... $ 10

16K M ORSE CODE TRA INER Learn M orse C ode, and tran sm it or

rece ive over rad io . T ape $10

16 K D EV IL 'S D UN GE ON : A dventure throu gh dark passag es w here

m on ste rs , dem on s, p oiso no us g as , dro poffs th rea ten ... a ll to d isco-

ver fan ta stic treasu res. C om es w ith in struc tion book. Tape ... $10

16 K P AC IF IC A: D isco ve r th e flo ating is land and rescu e the b eauti-

fu l princess. To w in you m ust recover the enchan ted c row n, bu t you

face the threa t of m agic spe lls and dem ons . T ape $9 .95

Don't see what you've been looking for, here?Then write for our FREE SOFTWARE CATALOG.We'resavingonejust for you!To order so ftw are , add $2 shipping . T o tran sfer tape ve r-

s ions to disk add $5. C a liforn ia re sid en ts add 6% sales tax .

S o rry , w e can no t sh ip to P . O . Boxes. V ISA /M ASTE RCHA RG E

We lc omed !

R A IN BOW 'S C A SIN O 9 g am blin g g am es: R ou lette , B la ck jac k,

C rap s, H orserace , an d a few o rig in als th at V eg as h asn 't h ea rd ab ou t.

N eed s 16K . T ape •........................ $29 .95

16K SPA CE W AR: Y ou in your space capsule ba ttle agains t th e

com pu ter 's sauce r in h i-re s graphic s. T ape __ $12

16K M EM OR Y V ERIFY D iagnostic routin e to check range of m em -

ory . Ind icate s faulty add resses, d ata in m em ory cell, and faulty d ata .

T ape ...•............................... $ 5

1 6K A PP LE O DIO N M u sic s yn th es is co mp ose s o rig in al Irish jig s.

E nte r your ow n m usic and save on tape o r d isk . In cludes 3 B ach

fugues . T ape. . . . . • . . . . . . . . . . . . . . . . . . . . . . . . $10

1 6K A PP LE VISIO N D em o fo r H i-R es g raph ics and m usic.

T ape ....•...•..................•...... $10

32K C DM PU -R EA D 5 program s to teach you speed reading , in

sta ge s. In clu des sy no ny m an d a nto ny m id en tifica tio n. Y ou co ntro l

you r rate o f speed , or keep up w ith th e com pu te r's p ace.

D isk . . • • • • . . . • . . . . . . . . . . . . . . . . . . . . . . . $ 24 .95

48K PE RC EPT IO N I, 11 ,111 random shapes and sizes m ust be

m atched . In III, you con tro l form at and disp lay tim e and ge t

w e ighted sco res . N eeds R OM . E ach D isk $24 .95

32K ST O R Y T EL L ER U se your bizarre im agina tion and input keyw ord s for fan tas tic and fu nn y tale s. N eve r th e sam e story tw ice.

Tape ...........•.................... $ 12 .95

32K W AR/RE SCU E E ngage in 10 ba ttles w ith you r in fan try agains t

the A pple ro bo ts. C alculate A pp le 's strateg y and w in m ore b attles

than th e com puter. Tape $12 .95

24K PO LA R PL OT P lot polar equa tions in H i-R es G raph ics .

T ape ..........••• ..• .......•......••.. $10

32K SH APE SC ALE R U tility to genera te and an im ate H i-R es

grap hic shapes. S im ple ro utine p ro vided to in sp ec t po sitio n o f

sh ap es , an d sp ecify p recise X /Y coo rdina tes and scale . N eed s R OM .

D isk . . . . . . . . . . . . • . . • . . . . . . . . . . . . . . . . . $13 .95

32K ZIN TA R/PR OPH ET G reat p arty gam e. U nder contro l o fth em igh ty Z i n ta r' s ed ict you take a ve ry specia l tr ip to the w orld of

K rin ta r. H eightened visual graphics. N eed s R OM . D isk .... $16 .95

A PPL E M ON IT OR PEE LED E very th ing you w anted to know abou t

the A pp le M onitor bu t cou ld n't figu re ou t. U se r-w ritten m an ua l in

p la in E ng lish clears your confusion . O n ly $9.95

G arden P laza Shopping C en te r, D ept. 11 A

9719 Reseda B lvd., N o rthridge, C a 91324

T elephone: (213) 349-5560

Page 3: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 3/68

~lJrIT~IS fJ~lJ[ l~~rnI(] Erl lEIr [J~I~ ir l r r r m r J E l l l J U J

a r [ l 1 J 1 1 J r n ~ i l r J l J ~

ar rn~il mnn[J(] ~ E I [ ] E l i l J E I I r t E i f J E l r s l J r I ~ 1

[JIJ r n I J UIE Ir [J~I~ I I J ~

ar E r 1 [ J

U J f l l l [)(]r1f1! . f J

~.A J_~nn: '"

!~~~~;;:l~~~~~f~:::;~c~·:mVPI_,_M.:.I I ,~nTII

s oftw ar e, s up plies a nd ac ce ss or ies . 0

This valuable catalog is FRE E so mail your or fc,ter ..... 11_ ......today.------- - - - - _ .._ - - - - - - .

ame __

Address _

City State Zip _

Do you own a computer? What type? _

Do you use your computer for: Business? _

Page 4: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 4/68

The Basic SwitcllMA ttenti on ''O ld '' P etlMOwners :

Not sure about the ROM Retrofit Kit from Cornrrv xlore?Now you can use both sets of Commodore ROf\ Isand others as well.

T he B a sic Sw itc h allows switch selection of eilh e r ROM set (your original set or

your retrofit set) 'from Commodore. Plus,Model 15-A includes an addi"tional zero

insertion force socket allowing easy use of ROM; like "theBASIC Programmer's Toolkit

...concurrently.

Model l4-E The economy model of The Ba sic Sw itc h. Stand alone board andharness without case and case he rcwore. The free standing unit isready to accept your ROMs.

Model l4-D Same as Model14-E but includes attroctlve protective case andmounted Bas ic SW i tch board.

Note that Model 14Series does not allow for exc ansion ROMs like the BASIC Pro-grammer's Toolkit.

M odell5-A The B asic SW itch plus ... includes.' sxponded cable assembly andzero insertion force socket. Your It th ROM simply plugs in ...enabled

while either ROM set isselected. Socket 15may be readdressed bythe user for additional flexibility.

Th e B a sic Sw itch issold in assembled form only. A.IImodels are designed for easyattachment to your Pet with a convenient coblo assembly. No soldering or drillingis required. T he B a sic Sw itc h mates with a cablE assembly at your primary board,and does not use the physical connectors of ar y Pet ports.

Model 15-A allows you to use "the BASIC Prograrr mer's Toolkit without "the need for

the additional S25.00 board or tying up your rx rts, And since we've designedthe 15th socket to be readdressable, watch for r lore ROM pacs later in the Fall.

The Ba sic Sw itc h:

Model l4-E

Model 14·D

$64.95

$77.95

With insta l le t t ROM

Retrofit Kit f r c ,mCornmooore :

$149.95

$162.95

With BASIC

Programmer's Joolklt '

Model 15·A S99.95 $184.95 $149.95

Model l5-A with installed ROM Retrofit and Basil~Programmer's Toolkit: $ 2 2 9 . 9 5

Model l5-A with installed ROM Retrofit and both Toolkits: $ 2 7 4 . 9 5

"Old" Pets were shipped with 24 or 28 pin ROMs. 'eu must check which you have,

and specify at time of order.

T he B a sic Sw itch ™isa product of

Sma ll S y s1em Se rv ic es , In c.900 Sprin ;; l Garden StreetGreensbo '0,North Carolina 27403Ielephone 919-272-4867

Pet™isa trademark of Commodore BusinessM<:chines, Inc. of Santa Clara, Calif.The BASIC Programmer's Toolkit isa product of Pa lo Alto IC's,A Division of Nestar

Systems, Inc. North Carolina residents add 4% sales tax. All ord lrsadd 52.50 shipping.

Page 5: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 5/68

Page 6: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 6/68

SUPER·TEXT is a professional word processing system for the Apple II and Apple II Plus computers.

SUPER·TEXT is the most innovative word processor avai lable on any personal microcomputer and includes

features previously found only on word processing systems costing thousands more I

An advanced multiple paging system allows you to view two text screens simultaneously You may keep notes

or instructions on one text screen while you edit on the other .

SUPER·TEXT is a character oriented editor with complete cursor controls to easily move the cursor to any position

in the text wi th a minimum of keystrokes.

Built in floating point math and automat ic tabbing facilitate the preparat ion of all manual reports including linancial

reports, insurance forms, real estate sett lements and more.

SUPER·TEXT is easier to operate than a typewriter yet challenges the flexibility of pencil and paper

SELECTED FEATURES:

EDITINI3 - Full f loating cursor. Cursor control-left,

r ight, up, down or to center of screen. Add or insert

a character, word or line. Automatic carriage return

eliminates a word breaking at the end of the screen

l ine. Delete a character, word, l ine or screen. Automatic

on screen tabbing and r ight or left justification of

columns. Unl imi ted text movement. Scroll either a page

or a line forward or back. Move to the beginning or end

of the text or screen. Move to the last change made

In the text. Move to a block marker. Global search andreplace (selective or ai l). Block operat ions - copy, delete

or save to disk. Select multiple or Single screen mode.

ADVANCED FILE HANDLING - Requires only two

keystrokes to load or save a file to disk. The file name

does not have to be entered which eliminates misspell ing

and "FILE NOT FOUND" errors. Save entire text

or portion of to disk. Complete fi le merging capabi li ties

MATH - Automatic column totals. Formula computations

User selectable number of decimal posit ions.

Automatically switches to scientific notation when

necessary. 14 significant digits.

PRINT CONTROLS - Upper and lower case pnnunq

without acdit ional hardware. Automatic paragraph

indentation. Single ordouble space printing Selectable

right just ificat ion of text . Variable page length and width.

Automatic page numbering. Selectable chapter-relativepage numcer inq Automatic print tabbing. Rlgrl1 or left

justif ication of columnar data. Single sheet or conunous

form printing. Superscnpunc and subscripting

Underscornq Line centering. Automatic link and printing

of multiple text files (48k) 99.95

MICRO INFORMATION SYSTEM,m(48k)$9995,sabreakthroughneuecuve m-lormauon systems 01any size. Trus one system handles accounts payable/receivable,

.nvcntones. appointment calendars, cost estimating, real estate listings. sales solicita-

t-ons. manpower accounting. selective mailings and label printing. dietary informa-

tion phone directories and more' Ondiskette

U·DRAW lI,m(32k)$39.95.acompleteqraphics packageortheAppleIIWithdiskYou can create a f igure and rotate, expand, contract or move It anywhere on your

vrdeo screen With a few simple keystrokes. Save mdivtdual f igures or complete draw-

.nqs on disk and recal l Ihem rarer. U·ORAW IIautomatically builds and edits multi-

nqure shape tables thai are directly t ransferable to your BASIC programs. You won't

t.nd bet teeqraphlcs capabilit ies at 100times the price!

APPILOT EDU-DISK!m(32k)$4995Acompletemutu-proqrarn CAl. systemor IheAPPLE II Inctudes program editor and APPILOT interpretor on diskette With exten-

s.ve on.tme HELP lessons plus documentation manual

THREEMILE ISLAN Dtm(48k)$3995 Isthe technology01anuclearreactor100rornptex :0nano!e" Now you have the opportunity todecide for yourself, With

ThREE MIL':: ISLAND a reausttc Simulat ion of apressurized nuclear reactor Four

spect acurar c.spiays rnomtor the containment building, turbines, tuters, condenser,

reactor cure and thl! pump house Valves, pumps. turbines. nuers and control rods

art! oov.ouanv acnvated by keyboard command. The comprehensive documentation

cescnbes u- oerau 'hp.operatmq mechanisms and component interactions

SUPER·LOAD CASSETTESU·DRAW16k)$1795ELECTRICCRAYON8k)$1795MAZEGAME8k)$12.95ESCAPE16k)$12.95SIDESHOWS8k)12.95TANKWAR(16k)$12.95MUSICBOX(8k)$12.95BASEBALL(16k)·1495

UNCLESAM'SJIGSAW132k)·$1295GLOBALWAR(32k)'$1795-s.os APPLESOf-T Saara

MUS E T MTHE LEADER IN QUALITY SOFTWARE

•vailable from dealers or write today to the

MUSE CO" 7112 Darlington Drive, Baltimore, MD 21234

Order by phone (301) 661-8531 MASTERCHARGE and VISA welcome

Page 7: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 7/68

Nicer Writer

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

Is screen wraparound a necessary fact of life? Or can

the computer adapt to conventional line ending rules?

This little BASIC output routine goes a long way toward

eliminating wraparound once and for all.

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

Has this ever happened to you: A

group of friends are admiring your ex-

pensive investment. With the flair of a

true computer expert, you press the ap-

propriate buttons, push RETURN, and

tell the expectant guests to watch the

screen. "Hi!", the computer prints.

"Thanks for answering the questions as

well as you did, Rick. I can state that you

should live 55.215677 more years and

have 2.15662 children."

You wait for the applause. Instead,

you hear, "How come the words run off

the end of the line?" Dead silence. Youare embarrassed-for your guests, of

course. Instead of seeing the brilliant

o REM NICER WRITER

5 REM

10 REM PROGRAM DEVELOPED

20 REM AND COPYRIGHT (C) 1979

30 REM BY M.R. "RICK" CONNOLLY

JR

40 REM 5009 RICKWOOD CT NW

45 REM: HUNTSVILLE, AL 35810

46 REM

49 REM

50 REM N$ IS THE STRING TO BE

PRINTED

60 REM CW IS THE COLUMN WIDTH

OF THE PRINTER OR MONITOR

70 REM M1 IS THE TAB INDENTATION

ON THE FIRST LINE

80 REM M2 IS THE TAB INDENTATION

ON SUBSEQUENT LINES (TAB 1

IS 0 INDENTATION ON THE AP-

PLE)

90 REM M3 IS THE NUMBER OF CHAR-

ACTERS PER LINE TO BE DIS-

PLAYED

91 REM

October, 1979

output of your sophisticated proqrarn,your guests saw:

H I ! T H A N K S F O R A N S W E R I N G T H E Q U E ~ T I O N S AS W E L L A S Y O U D I D , R I C K . I C A N S A T E T H AT Y O U S H O U L D L I V E 5 5 . 2 1 5 6 7 7 M O R E Y E A R S AN O H AV E 2 .1 56 6 2 C HI LD RE N.

Now, you and I know that screen

wraparound is a fact of life. Perh aps the

program concatinated a bit. Or,

possibly, it was adapted from ar article

written by some thoughtless autt or with

a 64 column screen or an 80 columnprinter. In either case, you probably will

soon tire of explaining that nothing is

100 N$ = "THIS IS AN EXAMPLE OF A

LONG SENTENCE THAT COOLD CO

M E EITHER FROM A PROGR&.M WRI

TTEN FOR A 64 OR 80 COLUMN S

CaEEN OR PRINTER, OR FROM ON

E THAT CONCATINATES. ,UPERC

ALIFRAGALISTICEXPIALIDJCIOUS, NO?"

110 M1 = 5:M2 = 1:M3 = 40:CW = 40

120 HOME: PRINT "PRINTOOT JF ST

RING N$ AS IT WOULD NOR- MALLY BE PRINTED FROM A P~OGRA

M:": PRINT: PRINT N$: ?RINT: PRINT

130 PRINT "NICER PRINTOUT 0< STR

ING N$:": PRINT: GOSUB 3500

0: PRINT: PRINT

140 PRINT "NICER PRINTOUT 0' STR

ING N$ ON LEFT HALF OF C

O LU MN :" : P RI NT :M1 = 3:0\2 =1:M3 = 20 : COSUB 3500 : 'RINT

: PRINT150 END

MICRO -- The 6502 Journal

Rick Connolly

41 Roland Drive

Bullwin, MO 63011

wrong with your magic machine; it just

prints funny, sometimes.

This is the wrong approach! We don't

adapt to the computer's idiosyncrasies;

it adapts to ours. Rillht? The little sub-

routine at lines 3500Clthru 35010 does a

lot to help the wraparound problem. It is

a human-oriented subroutine that prints

on the screen uslnq much the same

rules we would use with a typewriter.

Specifically,

It will break a line at a space, comma,

period, colon, hyphen, or othercharacter you specify.

If a word is longer than the allowable

line, it will be hyphenated (rather ar-

bitrarily, but this is a small sub-

routine).

At your pleasure, it will indent the first

line of the output. This helps increase

legibility.

Four variables control the output for-

mat. They may be entered once, at the

beginning of a program, or they may be

changed within the proqrarn if required.

The variables used are:

CW Column Width. This specifies

the maximum columnar width

of your output device, and is

used for error catching.

M1 Margin indent on the first line

printed.

M2 Margin indent on subsequent

lines. (Note: Left justif ication

17:5

Page 8: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 8/68

35000 IF H3 - Ml> CW OR M J - HZ

> C W THEN PRINT "LINE TO L

ONG FOR PRINTER. ":PRINT :PRINT

: END : REH CHECK FOR LINE

LENGTH35001 LN. LEN (N$): FOR 1 = M J -

M J . TO 1 STEP - l:BP$ = HID$

(NS,I,l): IF BP$ ~ " " OR BP$ ~ " ," OR BPS :: ":" OR BPS ::

"," OR BP$ 3 "-" OR LN < =M J - M J . ThEN 35003: REM FIN

o BR EA K P OIN T35002 NEXT 1 : HTAB M1: P RIN T L EF T$

(N$,MJ.- Ml - 1);: PRINT "-":1 = MJ - M1 - 1: GOTO 35004

: REM HYPHENATE LONG WORD

35003 HTAB M J . : PRINT LEFT$ (N$,

I): IF LN < = MJ - M J . TIlEN

RETURN

3 500 4 N 1$ = RIGHT$ (N$,LN - 1)

35005 IF LEFT$ (N1$, 1 ) = " " TIlEN

LN = LEN (N1$) - 1:N1$ = RIGHT$

(N1$,LN): GOTO 35005: REM

D EL ETE E XCE SS SP AC ES35006 LN s LEN (N1$): FOR 1 s H3

- H2 TO 1 STEP - l:BP$ = HID$(N1$,I,1); IF BP$ ~ " " OR B

P$ = "," OR BP$ s":" OR BP$= - " , " OR BPS = " _ " OR LN (

= MJ - H2 TI lEN 3 500 8: R EH

FIND BREAK POINT

on the apple is HTAS 1, notHTAS 0).

M3 Length of the line you wantedprinted.

N$ N$ is the dollar string you wantnicely printed. You can form N$through concatinat ion, or canmake it equal to another stringdeveloped within the program.

The word "Supercalifragalisticexpili-docious" (Does anyone really know howto spell it) is entered in the string N$ ofthe sample run to point out two charac-teristics of the nice print subroutine. Inthe first nice print example', the length ofthe word has forced it down one line,leaving the preceeding line rather short.In the second example, where the wordis longer than the allowable line length,super ... is arbitrarily hyphenated. A shortline should not appear too often with a40column line length, since most wordsare 10 letters or less in length.

Nicer writer is easy to incorporate into

a program, and fast in execution. It willmake your programs appear more pro-fessional and, best of all, it will keepyour friends from asking questions like

35007 NEXT 1. HTAB 1012 PRINT LEFT$

(N1$, M J - H2 - 1) : PRINT "-

..:I = H3 - 1012- 1 LN = LE N

(N1$): GOTO 35009 REH HYPH-

ENATE LONG WORD

35008 HTAB H2: PRINT LEFT$ (N1$

,1)

35009 IF LN < = MJ - H2 T HEN R EW RN

35010 N1$ ~ RIGHT$ (N1$,LN - I):G OT O 3 500 5

PRINTOUT OF STRING N$ AS IT WOULD NOR-

MALL'( BE PRINTED FROM A PROGRAM:

THIS IS AN EXAMPLE OF A LONG SENTENCE THAT COULD COME EIThER FROM A PROGRAM WRIT

TEN FOR A 64 OR 80 COLUMN SCREEN OR PRIN

TER, OR FROM ONE THAT CONCATINATES. SUP

E Re AL IF RA GA LI ST IC EX PI AL ID OC IO US , N O?

NICER PRINTOUT OF STRING N$:

THIS IS AN EXAMPLE OF A LONG

SENTENCE THAT COULD COME FROM EITHER A

PROGRAM WRITTEN FOR A 64 OR 80 COLUMN

SCREEN OR PRINTER, OR FROM ONE THAT

CONCATINATES.

S UP ER CA LI FR AG AL IS TI CE XP IA LI DO CI OU S, N O?

" W h y did it print 'C O

M P U T E R ' ? "

Page 9: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 9/68

Disassembling the DOS 3.2

You "Can't tell the players without a score card" and

you can not effectively use the Apple II DOS 3.2 without

this important information on its organization.

)

On the surface, DOS 3.2 is identical to

DOS 3.1. Upon booting, the DOS is load-

ed (slave or master), the greetings pro-

gram is run, MAXFILES defaults to 3,

and HIMEM is set at $9600. DOS 3.2 still

communicates with the rest of the AP·

PLE via input and output hooks at $36,

37, 38, and 39. (All addresses refer to a

48K machine.)

The differences are many: In Apple-

soft, DOS does the call 3314 or call

54514 automatically, volume checking is

ignored unless explicitly defined in the

command, and the system defaults to

NOMON C,I,O status. The hooks at $36

and 37 (the print routine) now contain

$9E81. The routine to restore DOS is now

at $9DBF. This can be called if page 3 is

overwritten. The command and error

message tables are in different toea-

tions. The command table is the same as

in the DOS 3.1. The error messages,

however, are quite different. After a

BLOAD, A$ is now found at $AA72,3; L$

is now found at $AA60,1.

When the keyboard input routine

(9E81), is called," DOS checks the mode.

If it is in direct mode, the DOS reads thekeyboard, then goes to the print routine.

The print routine has seven routines of

it's own, 0·6. It calls the correct one,

depending on whether the mode is

direct, deferred, execute, read or write,

etc. These routines are all inter- related.

In direct mode, when a return is

detected, DOS attempts to match the

string in the keyboard input buffer

($200·2FF) to a command in the table. In

October, 1979

the print mode, direct or deferred, it

stores all characters in the keyboard in-

put buffer until a return is detected. It

then checks for a CTRL·D as the first

character. If not found, DOS drops out

and returns control to wherever it came

from. However, if Control D is detected,

DOS attempts to match the string to the

command table. If a match is not made,

it prints "Syntax Error".

When DOS matches a command, it

then checks for names, if needed, or

numbers, if needed. After getting all

data required, a check for optional data

is made. After any optional data is read,

numbers are changed to hex if need be,

the maximum and minimum ranges are

compared, then if all data is OK, the

number is stored and DOS returns to

check for any other optional data.

A routine gets the correct address

from the stack, then executes the corn-

mand. I have highlighted a few of the

commands:

PR# and IN# do the same function as

in BASIC, except that DOS will set the

hooks properly before releastnq control.

MON and NOMON set a mask at

$AA74 as follows: 0 = monitor nothing,

$10 = monitor 0, $20 = monitor I, $40 =C, and combinations thereof.

MAXFILES resets HIMEM and PP (INT

BASIC) and allocates a file buffer via a

subroutine at $A7D4.

BRUN does a BLOAD then a JMP

($AA72).

MICRO -- The 6502 Journal

William Reynolds

1733 N. Ford Street

McMinnville, OR 97128

RUN does a load, then jumps to a

routine which executes the program.

Which routine is used is dependent

upon which language is being used,

BASIC, FP RAM, or FP ROM.

LOAD reads the file type and does

either INT or FP as needed, then loads

the program. When in FP mode, and

after the program is loaded, DOS does

the call 3314 or call 54514 as neecied to

set the program pointers for Applesoft.

FP attempts to find a ROM card and

turn it on. If possible, it sets the return

addresses via a routine at $9D84. If no

card is found, the DOS runs Applesoft,

then goes to a routine at $9DEA to set

return addresses correctly.

INT makes certain the ROM card is

off, then goes to $90084to set return ad-

dresses correctly.

If a person wishes to use DOS from a

language or operating system not stan-

dard to the APPLE, there is no problem,

unless an error is detected. If you do not

wish an error message to cause a return

to BASIC or Applesoft, the address at

$9D5E and F can be changed for your

particular system.

Whenever a change in language is

done, DOS updates it's return address

stack from" the stack for that particular

language. All commands except PR#,

IN#, MON, NOMON, INT, FP (if in ROM),

and MAXFILES go through routines that

use file butters.

17:7

Page 10: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 10/68

All commands may be called from

monitor or machine language, provided(1)A language change is not needed, (2)

the file names havebeen placed into thename buffer(s), and (3) that any other

parameters have been properly placed

into their locations as needed.

The disk controller card contains two(2) PROM's, 256 bytes each. One PROM

contains the program to start thebooting of the DOS.The other is used for

a program that, together with some

other IC's, actually controls the headposition, reading a bit, writing a bit, sen-ding the byte to the APPLE bus, and get-

ting a byte from the APPLE bus. The

following locations control the hardwarefunctions. Add OOSOo each address, S

= the slot number of the controller card.

C080-87 These addresses sequen-

tially step the motor that

moves the head back andforth. Odd addresses stepone way, and even ad-

dresses step the other way.

C088 Turns off the drive motor.

C089 Turns on the drive motor.

C08A Enables drive two.

C08B Enables drive one.

C08C,D Control connecting the AP-

PLEbus to the hardware forstrobing the byte inor out ofthe 74LS323 IC shift regis-

ter, depending upon the pre-viously set status of

C08E,F.

C08E,F Read/Write control.

I have documented all routines, sub-

routines, buffers, and other locations to

the best of my ability in the memorymaps that follow. Notes tell the functionand usage of each. Onmost items I havegiven only the starting address. The endaddress is implied to be the next

documented location minus one. On

stacks of addresses, the parenthesized

number is the number of addresses con-

tained in that stack. Remember that any

two-byte items are always stored lowbyte first. Documentation of addresses

in the BOOO-BFFFarea may be in error

because that area got too complex for

me to retain my sanity.

My thanks to my family for their time

and patience, to other persons for theirarticles on DOS functions, APPLE for

their excellent documentation, withoutwhich I would have had no idea what

was going on, and to Terry and Kent atComputerland of Portland, for use oftheir printer to obtain 60 feet of hardcopy, and their moral support.

APPLE II DOS 3_ 2 Memory Map

95FF

9600

9700

9800

9820

984B,C

984D,E

984F,O

9851,2

9853

9953

9A53

9A80

9A9E,F

9AAO,1

9AA2,3

9AA4,5

9AA6

9BA69CA6

9CD3

9CF1,2

9CF3,4

9CF5,6

9CF7,8

9CF9-9CFF

17:8

End of user RAM: HIMEM = 49151

Start of data buffer

Start of track and sector buffer

Start of miscellaneous info buffer

Start of name of file

Address of start of miscellaneous info buffer($9800)

Address of start of track and sector buffer ($9700)

Address of start of data buffer ($9600)

Address of start of namebuffer, next file ($0000=no more files)

Data

Track and sector

Miscellaneous

Name

Address of start of miscellaneous info buffer($9A53)

Address of start of track and sector buffer ($9953)

Address of start of data buffer ($9853)

Address of start of name buffer of next file down($9820)

Data

Track and sectorMiscellaneous

Name

Address of start of miscellaneous info buffer($9CA6)

Address of start of track and sector buffer ($9BA6)

Address of start of data buffer ($9AA6)

Address of start of name buffer of next file down($9A80)

Unused

9000

9002

9004

9006

9008

9DOA

9DOC

9DOE

9010

9D1E

9056

9062

9D6C

9078

9084

9DBF

9DEA

9E51

9E81

9EBD

9ED1

9EEB

9F12

9F23

9F2F

9F52

9F61

9F71

9F83

Address of name of first file

DOS keyin routine address

DOSprint routine address

Name number 1buffer address

Name number 2 buffer address

Bottom of DOS

Address stack for the internal print routines (7)

Address stack for the DOScommand routines (28)

Address stack for return to the current language(6 )

Address stack for return to Integer BASIC

Address stack for return to Applesoft ROM(6)

Address stack for return to Applesoft DIsk (6)

(3D3G)Control B, re-enters INT or FP(ROMonly)

(3DOG) Restores DOS and re-enters currentlanguage

Restores $300 - $3FF from $9E51- $9E80

Stack for the above routine

Keyboard input routine

Calls correct internal print routine, depending

upon modeRestores keyboard and print hooks

Internal routine for information from the disk

Internal routine for printing

Prints and exits DOS

Keyboard input internal routine

Internal routine for sending information to disk

Routine to correct internal routine

Used by the EXECcommand

Mask MON status, print and exit

MICRO -- The 6502 Journal October, 1979

Page 11: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 11/68

9FC8

9FCD

A229

A22E

A233

A23D

A251

A263

A271

A275

A27D

A281

A298

A2A3

A2EA

A331

A35D

A38E

A397

A413

A4D1

A4E5

A4FO

A4FC

A506

A510

A51B

A54F

A56E

A57A

A59E

A5C6

A5DDA60E

A626

A644

A65E

A679

A682

A69D

A6AB

A6C4

A6C8

A6CC

A6DOA6D5

A71A

A743

A74E

A764

October, 1979

Does a RETURN

Start of section that attempts to match to a com-

mand and get all information needed and all op-

tional information given_ Checks syntax and

ranges before execution.

PR# routine

IN# routine

MON routine

NOMON routine

MAXFILES routine

Start of DELETE routine

Start of LOCK routine

Start oi UNLOCK routine

Start of VERIFY routine

Start of RENAME routine

Start of APPEND routine

Start of OPEN routine

Start of CLOSE routine

BSAVE routine

BLOAD routine

BRUN routine

SAVE routine

LOAD routine

Run routine

Runs Integer BASIC program

CHAIN routine

Runs FP ROM program

Runs FP RAM program

WRITE routine (set up)

Read routine (set up)

INIT routine

Catalog routine

FP routine

INT routine

EXEC routine

Posit ion routineStarts the read process

Starts the write process

Stores data coming from text file into keyboard

buffer. Used by the EXEC command.

Error checking?

Closes files, exits DOS

Goes to hardware routines

Sets up address of name section of next file

Close the buffer last used

Prints, "SYNTAX ERROR"

Prints, "NO BUFFERS AVAILABLE"

Prints, "PROGRAM TOO LARGE"

Prints, "FILE TYPE MISMATCH"Prints other error messages by message number

contained in $AA5C

Moves parameters given to locations for use by

hardware routines

Moves name from the name buffer to the name

section of the file buffer

Moves addresses of sections of file buffers to

locations for use by hardware routines

Attempts to find a file buffer already in use by the

name given

A74F

A7C4

A7D4

A851

A884

A909

A941

A94A

A995

A971

AA3F

AA4F,50

AA51

AA52

AA53,4AA55,6

AA57

AA58

AA59-

AA5E

AA5F

AA60-

61

AA62-

65

AA66,7

AA68,9

AA6A,B

AA6C,D

AA6E,F

AA70,1

AA72,3

AA74

AA75

AA93

AAB1

AAB2

AAB3

AAB4,5

AAB6

AAB7

AAB8

AAC1,2

AAC3,4

AAC5,6

AAC7,8

AAC9

Checks file type

Sets up file buffers and addresses (used by MAX-

FILES)

Restores DOS hooks

Start of command table

This is a table of two-byte masks. One byte is us-

ed to determine what type of extra data is needed

by a command. The other byte is used by the hard-

ware routines for what file type to create or look

for.Table containing the letters V, D , S, L, R, B, A, C, I,

O. This is used when checking for optional data.

Table of bytes for deterrnlnlnq what type of op-

tional data to look for.

Table of minimum and maximum ranges for V, D,

S, L, R, B, A.

Start of error message table

Relative address of start of error message, i.e.

($A971,X)

Address of name section of next available file buf-

fer

Internal print routine number

PR# hooks out of DOSIN# hooks out of DOS

Number of total file buffers

Number of file buffers not in use

Temporary storage used by various routines

Mask for MON and NOMON

Command number

Found L$ from a BLOAD

Temporary storage used by various routines

Defined volume number

Defined drive number

Defined slot number

Defined length

Defined record number

Def ined byte number

Defined address

Start of file name buffer number 1

Start of file name buffer number 2

Control D

Mode (direct, deferred, etc.)

Value used for language, e.g. INT = 0, FP RAM =CO, FP ROM = 80

The name, "Applesoft"

Address of start of lOB (used by RWTS)

Address of start of buffer for track/sector list (us-

ed by RWTS)

Address of start of buffer for data (used by RWTS)

Top of total RAM in the APPLE II

Address stack for hardware routines (14)

AAD5 Address stack for hardware routines (6)

MICRO -- The 6502 Journal 17:9

Page 12: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 12/68

AAF1

AAFD

AB28

ABDC

AC06

AC3A

AC58

AC70

AC87

AC8A

AC93

AC96

ACA8

ACBB

ACBEACC7

ACCA

ACDA

ACEF

ACF6

AD12

AD18

AD2B

AD54

AD98

AE42

AE6A

AE7E

AE8E

AF08

AF1D

AF34

AF4B

AF5E

AFDC

AFE4

AFF7

AFFB

B011

17:10

Address stack for hardware routines (6)

Goes to the correct hardware routine

Reads VTOC and reads directory attempting to

find an entry with the same name as the one

given. If not found, checks the table of masks to

see if it is allowed to create a file. If it may, it does

so, and if not, it exits with "FILE NOT FOUND" or

"LANGUAGE NOT AVAILABLE"

Clears miscellaneous info hardware buffer; sets

volume number, drive number and slot number.

Close routine. Updates VTOC, track bit map, and

sector count of directory entry as needed.

Rename routine. Finds directory entry, stores new

name in entry, then writes that directory sector

back to disk.

Goes to correct hardware routine

Goes to correct hardware routine

Sets parameters for following routine

Actually reads text file

Sets parameters for following routine

Reads program or binary file

Puts byte being read into buffer

Sets parameters for following routine

Writes into text fileSets parameters for following routine

Writes program or binary file

Gets byte being written from buffer

Lock hardware routine

Unlock. hardware routine

Sets parameters for following routine

Verify hardware routine

Delete hardware routine

Part of delete routine,frees sectors used by

deleted file.

Catalog hardware routine

Part of catalog, prints the number in $44 as three

digit ASCII.

Moves miscellaneous info from the file buffer to

the hardware buffer.

Moves miscellaneous info from the file buffer to

the hardware buffer.

Initialize hardware routine

Sets 42 and 43 as pointers to sections of the file

buffer

Writes data section of file buffer to disk

Writes track/sector list section of file buffer to

disk

Sets hardware pointer to the track and sector list

section of the file buffer being used

Checks position in file. If out of current sector,

reads/writes next sector, updates VTOC buffer,

updates track/sector list section of file buffer if in

write mode.

Reads from disk into data section of file buffer

Sets hardware pointers to data section of file buf-

fer being used

Reads VTOC to its buffer ($B3BB - B4BA)

Writes VTOC from its buffer

Reads a dlrectorv vsector into its buffer

('B48B - B5BA). Initially reads sector A, suc-

cessive entries into this subroutine read suc-

cessive sectors from the disk. When all sectors

B037

B052

BOAO

BOA1

BOB6

B134B15B

B194

B1A2

B1B5

B1C9

B21E

B224

B2C3

B2DD

B300

B35F

B397 -

A6

B3A7-

AA

B3AB,C

83AD-

BA

B3BB

B4BB

B5BB-

DO

B5D1-

FF

B600B700

B74A

B793

B7B5

B7C2

B7DB

B7E7

B800

BA90-

FF

BBOO

BCOO

BDOO

BFD4

BFD5

BFFF

have been read and the subroutine is called again,

it will merely exit with the carry set.

Writes current directory sector from buffer to

disk.

Sets up lOB for directory sectors, goes to RWTS

End of above if no error

Start of error handling routine for above

Checks position in file, reads/writes next sector

as needed

Initializes data section of file buffer to all zeroesSets next position in file

Increments position in file

Sets next RAM address

Calculates how much RAM is left

Reads VTOC and successive entries, attempting

to find the specified file name.

Puts name of file into directory

Sets next sector, updates VTOC buffer

Updates VTOC

Calculates track bit map for VTOC

Sets/checks parameters for fi le?

Routine with different entry points to exit the

hardware routines with error

Temporary storage for hardware routines

T, I, A, B Used by catalog for file types

In reverse order, the string, "DISK VOLUME"

VTOC buffer

Directory buffer

Temporary storage for hardware routines

Miscellaneous info section of currently used file

Buffer. Purpose?Reads drive 1, current slot, $B1 sectors, track 0,

sector A into RAM starting at $1BOO. Boot

routine?

Writes $OA sectors, starting from $B600, then $1B

sectors, starting at $1BOO, beginning at track 0

sector O.

Increments track/sector as needed and data ad-

dress for above two routines

Calls RWTS, checks status upon return

Sets address of data buffer, and sets expected

volume number

Stores zeroes in one page, starting at the address

in $42, 43

Start of lOB and device characteristics table

Part of RWTS?

Temporary storage for RWTS?

One-page buffer (RWTS?)

One-page buffer (RWTS?)

Start of RWTS

End of RWTS

Various endings sections for the hardware

routines

End of RAM

MICRO -- The 6502 Journal October, 1979

Page 13: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 13/68

Hooking PET to Ma Bell

The dream of many microcomputerists to use their

system as a terminal connected to a large computer

system can become a pratical reality. The $50.00 hard-ware for any 6502 based system, and the software for a

PET, are fully described.

Having worked with my 8K PET for

almost a year, I havebecome hooked on

microcomputers and am enjoying learn-

ing and experimenting with a great

machine. like most microcomputerenthusiasts, I dream of more memory,

disks, printers, etc. However, attempting

to raise a family on a teacher's paymeans that I have limited funds. So Iwired up a PET to RS-232modern inter-

face, plugged into a modem, and

bingo - by dialing up the computer

system on the campus of ArkansasState University, I haveall of these plus

much more hooked to my PET. If you

have telephone access to a computer

system or a friend with an answer

modem on his computer, here is the

hardware and software to get youstarted communicating on thetelephone.

The interface shown in Figure 1 can

be built for under $50including connec-

tors, wiring, etc., and can be pluggedinto any RS-232modem (I have a U.S.

Robotics Model 310which lists for $149).

A TIL compatible modem can be wired

10 REM

20 R E M

30 R E M

40 RE M50 R E M

60 RE M

101 DATA

TERMINAL PROGRAM

BY C.H. SCANLON

P.O. BO X 22

STATE UNIVERSITY, ARKANSAS72467

173, 246, 191, 48, 3, 76, 133, 230, 173, 247,

191, 88, 41. 127, 170, 169, 32, 172, 226, 0

102 DATA 145, 224, 138, 32, 210. 255, 169, 160, 172,

226, 0, 145, 224, 76, 133, 230

105 FOR I a 82 6 TO 861: READ X: POKE I, X: NEXT

110 POKE 537, 58: POKE 538, 3

11 5 POKE 49142, 3

12 0 POKE 59468, 14

130 PRINT" (cs ) * * * * TERMINAL * * * *"140 PRINT "(cd)(cd) Type RUN 190 but don't hit the return yet".

150 PRINT "(cd) Dial 935-9372 and wait for the tone".

16 0 PRINT" (cd) Place receiver in holder and hit return".

18 0 STOP

190 POKE 49142, 129

19 5 FOR I a 1 TO 30 : NEXT: POKE 49143. 720 0 GET A$: IF A $ - " " GOTO 20021 0 IF ASC(A$) a "shift S" THEN PRINT "(cs)"

215 IF ASC(A$) < 192 GOTO 300

22 0 IF ASC(A$) > 244 GOTO 300

225 POKE 49143, ASC(A$) - 192: GOTO 200

30 0 POKE 49143, ASC(A$): GOTO 200

NOTE: (cs ) means clear screen and (cd) means cursor down.

Figure 2

October, 1979 MICRO -- The 6502Journal

C.H. ScanlonP.O. Box 22

Arkansas State UniversityState University, AR 72467

directly to pins 2 and 6 of the MC6850.

All the parts, except the crystal, are fair-

Iy common and can be ordered from

most mail order electronics parts firms.

The 1.229 megaHertz crystal can beordered from any crystal manufacturer

for around $10. This interface can be

connected to any 6502 or 6800 basedmicrocomputer that allows direct

access to the microprocessor bus, forexample, the APPLE, KIM, SYM, SWT,

OSI, etc.

The software is written in BASIC and

makes the PET act like a TIY type

"dumb" terminal. The control charactersare obtained by using the shift key. For

example, control S is simply shift S.

Although this program appears to limit

the PET, it really doesn't since you canhit the stop key,write and run a program

in the extra RAMand get back to the ter-

minal program with a RUN 190 or a

GOTO190.For example, you could writea BASIC program starting at line number

500,compute a bunch of data, POKEthe

data to the modem, and then return tothe terminal program with a GOTO190.

Software

The MC6850 Asynchronous Com-

munications Interface Adapter (or, in thebuzz words of computerland, simply

speak the letters A-C-I-A) is located in

page B and has multiple addresses. I

use hex BFF6=49142as the address toPOKE to the control register and to

PEEK at the status register. Address

BFF7=49143 is used to POKEa byte tothe modem and to PEEKat a byte fromthe modem.

The BASIC program provides direc-

tions for the operator, data transfer fromthe modem to PET, data transfer from

PET to the modem, and miscellaneousprogramming needs.

lines 101- 105 POKE a machine

language routine into the second

cassette buffer. and line 110POKEs the

17:11

Page 14: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 14/68

PET MEMORY EXPANSION PORT

address of this routine into the interrupt

address location of RAM so that, when

an interrupt occurs, PET will check the

ACIA before it checks the other possible

interrupt locations.

When the ACIA receives a serial byte

from the modem, it strips off the start

and stop bits, converts it to parallel, and

then interrupts the CPU. PET is then

routed to the routine beginning at 033A.

Lines 033A - 033C transfer the con-

tents of the ACIA status register, to

register X and lines 0330 - 033E cause abranch if bit 7 is set, indicating that the

ACIA did interrupt the CPU and has a

byte to transfer. Otherwise, lines

033F - 0341 transfer PET to the ROM in-

terrupt sequence. Lines 0342 - 0344

transfer a data byte froni the ACIA to

register A and line 0345 clears the CPU

interrupt to allow for other interrupts.

Lines 0346 - 0347 strip the parity bit

from the data byte and line 0348

transfers it to register X for temporary

storage.

17:12

15 K

+12

- = - MODEM

10 K 15 K CONNECTORTX D

GN D

RX D74 1

15 K+12 ~ +

2_7K100"I

-1 2-

9 810 711 a 612 -D

51 3 =r 4

0

14 u 315 2

16 1

6_8K

1N41'll

+12

Figure 1

Next, to erase the cursor, lines

0349 - 034A load A with $20 (rote that

CHR$(32)is a blank). Lines 034B - 0340

get the current position of the cursor on

the video line and lines 034E - 034F then

clear the cursor.

To type the character, line 0350

retrieves the data byte from register X

and stores it in register A and lines

0351 - 0353, then types the character in

the next print position.

To set the cursor, lines 03'54 - 0355

load register A with $AO (rote that

CHR$(160) = reverse blank), lines0356 - 0358 get the current position of

the cursor on the video line, and lines

0359 - 035A then set the cursor.

Lines 035B - 0350 then transfer con-

trol back to the PET interrupt routine.

Back in the BASIC program, line 115

POKEs 3 into the ACIA control register

which then resets the ACIA. Line 120

sets the lower case letter mode and then

lines 120 - 180 print instruct ons and

stop.

MICRO -- The 6502 Journal

Since the answer modem at Arkansas

State University uses seven bits plus

parity plus two stop bits, line 190 pro-

grams the ACIA to transfer data in this

mode. Reference 1 explains how to pro-

gram other modes. Also, since the

Arkansas State University computer in-

itially waits for a control G, line 195 has

a delay and then POKEs a 7 =ASCII

CTRL-G to the modem. Lines 200 - 300

then wait to get a character from the

keyboard, convert the character to

ASCII, and POKE it to the ACIA.

Hardware

The MC6850 is wired directly to the

CPU bus through the memory expansion

port. I use page B by wiring CS2 to SELB.

Details of programming the ACIA can be

found in reference 1.

The 1.229 megaHertz cystal and the

C4060 counter put out a 4800 Hertz

square wave to the ACIA. The ACIA fur-

ther divides it by 16 to obtain a baud rate

of 300. Reference 2 indicates how to get

October, 1979

Page 15: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 15/68

other baud rates. The 741 op ampconverts the RS-232 logic from themodem to TTL as described in reference3.

You will need a ±12 and +5 volt powersupply. If you use a TIL compatiblemodem, you won't need the '12 voltsupply and you can get +5 volts from thesecond cassette port.

QuestionsThere are lots of software questions Ihave not answered. For example, howcan a program be copied directly fromthe cassette to the modem? How can aprogram or data file be "saved" by sen-ding it to the storage facilities at theother end of the line and how can it beretrieved later? With the exception ofdisplaying more characters, what can anexpensive "smart" terminal do that PETcan't do? As I stated earlier, this art icleis merely a start.

References

1. An Introduction to Microcomputers

Volume II, by Osborn, Jacobson, andKane, Adam Osborne andAssociates, Incorporated.

MICRO-WARE ASSEM3LER 65XX-l.0 PAGE 01

001000200030 033A ORG $033A0040 033A AE F6 BF LDX $BFF6 GET STATUS REGISTER CF ACIA0050 033D 30 03 8MI $0342 BRANCH IF BIT 7 SET0060 033F 4C 85 E6 JMP $E685 JUMP TO PET INTERRUPT0070 0342 AD F7 BF LDA $BFF7 GET BYTE FROM ACIA0080 0345 58 CLI CLEAR INTERRUPT FLAG0090 0346 29 7F ANDIM $7F STRIP OFF PARITY BIT0100 0348 AA TAX STORE THE BYTE0110 0349 A9 20 LDAIM $20 CHR (32) = BLANK0120 034B A4 E2 LDY $00E2 GET CURSOR POSITION ON LINE0130 034D 91 EO STAIY $EO CLEAR CUR SOR0140 034F 8A TXA RETRIEVE THE BYTE FROM X0150 0350 20 D2 FF JSR $FFD2 TYPE IT AS A CHARACTER0160 0353 A9 AO LDAIM $AO CHR(160) = REVERSE BLANK0170 0355 A4 E2 LDY $00E2 GET CURSOR POSITION ON LINE0180 0357 91 EO STAIY $EO SET CURSOR0190 0359 4C 85 E6 JMP $E685 JUMP TO PET INTERRUPTID=

Figure 3

2. CMOS Cookbook by Don Lancaster,

Howard W. Sams and Company, In-corporated.

3. Peripheral Interfacing by Rod Hallen,

KILOBAUD Microcomputing, June1979.

T .O .O .

TA PE DA TA O lJERY

PET-8K SOL-lIA TRS-80-LEVEL II

* FILE MANAGEMENT SYSTEM-Utilizes Dual Audio Cassette Recorders

* INTERACTIVE QUERY LANGUAGE

=Engli sn-Like Commands

-Powerful Info Re trieval Capabili ty

* COMPUTERIZED BUSINESS & PERSONAL RECORDS-Customize Your Own File Structures

-Create & Maintain Data Files

-No Programming Experience Required

* IMPLEMENTED IN BASIC

T.D.Q. CASSETTE WITH MANUAL & REF. CARD $50.00

The Following Pre-Defined T .D.Q. File Struc turesAre Avai labl e To Solve Your Data Processing Needs:

INVENTORY CONTROLACCOUNTS RECEIVABLEACCOUNTS PAYABLEORDER PROCESSINGCUSTOMER DIRECTORY

APPOINTMENT SCHEDULINGEach With Cassette And Manual

$35.00$35.00$35.00$35.00$25.00

$25.00

Send Self-Addressed Stamped Envelope ForComplete Software Catalogue.Send Check Or Money-Order To:

H. GELLER COMPUTER SYSTEMSDEPT. M. P.O. BeX 350::--.lEWYORK. NY 10040

(New York Residents Add Applicable Sales Tax)

October, 1979

NOW AVA ILA BLE

Fo r SO L -IIA and PET -8K

GENERAL PACK 1 $11.00

(Checkbook Balancer, Tic Tac Toe, Metric Conversion)

GENERA~ PACK 2 $19.00

(Space Patrol, Biorhythm, Ba tt les tar , One ..Armed Bandit)

FINANCIAL PACK 1

(Loans, Depreciation, Inves trnents)

$13.00

FINANCIAL PACK 2 $13.00

(Mortgage & Loan Amortization, Future Projections,

Risk Analysts)

STATISTICS PACK 1 $19.00

(Mean & Deviation, Distribution, Linear Correlation &

Regr essi on, Contingency Table Analysis)

GAME PACK 1 $20.00

(Basketball, Object Removal, Bowling, Darts, Gopher)

GAME PACK 2 - (children - educational)

(Arithmetic God, Addition Dice , Travel)

$13.00

For the KIM-1

PCROS - A Real-Time Operating System in the

IK KIM RAM

Includes: Assembly listing; Cassette with user's

manual; Schematic for relay control board

$50.00

MICRO -- The 6502 Journal 17:13

Page 16: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 16/68

SoftlNare for the APPLE II

THE PLANETS $15.95

I J J 1 . " O! JC I

~~

I. ·11 UfII

I.•" "-

to I...

I. 11"

• no,

<101 .u•

.(~

'r ••• an.. It,.. 'to c.~'Ut\u )>1

ACTIVE FI LTERS $24.95

FOOTBALL PREDICTIONS $19.95

STATE CAPITALS $9.95

SPEEDWAY $15.95

.a d B eg in ad ju s tin g r ig h t m arg in s

.b p n B eg in p ag e n um b e red n

.b r C au se a lin e b re ak

.c e n C en te r n ex t n lin e s w ith o u t f il

.f i S ta r t f il l in g o u tp u t lin e s CANTER DOWNS $15.95

.f o t F o o t tit le b e com e s t

.h e H ead title b e com e s t

.i n n In d en t n sp a c e s from le f t m arg in

.I i n L ite ra l, n e x t n lin e s a re te x t

.1 1 n L in e len g th in c lu d in g in d en t is n

.I s n S e t lin e sp a c in g to n

.m l n T op sp a c in g in c lu d in g h e ad title

.m 2 n S pa c in g a f te r h e ad in g title

.m 3 n S p a c in g b e fo re fo o t tit le

.m 4 n B ottom sp a c in g in c lu d in g fo o t tit le

.n a S to p ad ju s tin g r ig h t m arg in s

.n f S to p f ill in g o u tp u t lin e s

.p l n P ag e le n g th is n lin e sBATTLEST AR I $15.95

.p p n B eg in p a ra g ra p h= .sp , .f i , .t i n

.s p n S p a c e d ow n n lin e s , e x c ep t a t to p

.t i n T em po ra ry in d en t o f n

.u l n U nd e r lin e n ex t n in p u t lin e s

FORMAT

PR OG RAM MA 's FO RM AT (V e rs io n 1 .0 )

is a c om mand o rie n te d te x t p ro c e sso r d e -

sign ed to b e fu lly com p a tib le w ith P I E(PR OG RA MM A Im pro v ed E d ito r) .

FO RM AT 's sy s tem o f im bed d ed com mand s

(w ith in th e te x t) g iv e it a n e a se o f o p e r-

a tio n s im ila r to te x t fo rm atte rs fo u n d o n

s om e m i ni -c om p u te rs .

FO RM AT fe a tu re s r ig h t m arg in ju s tif i-

c a tio n , c e n te r in g , p ag e n um be rin g , and

a uto -p ara gra ph in de nt.

T he fo llow in g com mand s a re av a ila b le

w ith FO RM AT :

All orders include 3% postage and handlinq,

Apple II is a registered trademark of Apple

Computer, Inc.

cal ifornia residents add 6% Sales Tax

VISA & MASTERCHARGE accepted.

JOY STICK $49.95

EXPAND-A PORT $49.95

l' « < ~ I.lc u.... )} } i

,r'Hr"s I sea" I '0110U

SAUCER WAR $15.95

LUNAR LANDER $9.95

PROGRAMMAINTERNATIONAL, Inc.3400 Wilshire Blvd.Los Angeles, CA 90010

(213) 384-0579

384·1116

384·1117

D eale r In qu ir ie s In vite d

l l U J, 0D~a . r tC En mr t ,I n m

Page 17: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 17/68

Spelunker

Spelunker is not for the faint of heart! It presents many

interesting and useful programming techniques in the

pleasant format of a game. As you play, keep tellingyourself "It's only a game, it's only a game ..."

This is an adventure fantasy series in

which you become directly involved in

exploration of a mysterious cavern in

southwest Kentucky called Devils'Delve. If you have never played before,

you should take a guide along. Theguidewill read the chamber descriptions as

you enter each room for the first time.

Hecan also supply somehints and clues

to help you when you are stuck. Only theguide should use the room descriptions,

word lists, and the map of the caverns.However, younger players may need

some of these aids to help them.

Spelunker is an interactive game. You

must converse with the program in order

to explore the caverns and locate their

treasures. You can talk in sentences, ifyou wish; but the program will use only

one verb and one noun to establishmeaning. For this reason, it is best to

converse in verb/noun phrases. In thecase of moving from chamber to

chamber, for example, enter "GO W" or

simply "W" and the verb "GO" will be

implied. The Spelunker program willmove you into the next room to the west

upon receiving this command. Other ex-amples might include "TAKE LIGHT" or"JUMP DOWN".

i

With this brief introduction you

should be ready to explore the caverns

of Spelunker. While you are about it, trydrawing a map of the cave. Youmay also

wish to discover exactly what

vocabulary is understood by the pro-gram. Thematerial that follows is for the

guide only - so don't ruin your firstadventure by peeking at it.

For the Guide Only

In the 16K APPLE II version of

Spelunker, the chamber descriptions arenot part of the program because of

limited memory size. These room

descriptions have been prepared for theadventurer's guide. The guide may read

each room description as the adventurerenters the chamber for the first time.

1. Mouth: You are at the mouth of a

large cavern. The sides of the en-

trance slope steeply upward, and amysterious passage leadswest into

the cave.

October, 1979

2. Tree room: A towering, withered

tree stands in what appears to be a

dried up river bed. Fromit you seemto hear echoing sounds saying,"Water ...water...water..."

3. Writing room: Do not read this

description if the room is dark. Thewriting room is a large, oval

chamber with tall ceilings andmassive stalagmites. The smooth

eastern wall has some writing onit - cryptic characters that spellout, "THE SPIRITSOF THEFRUIT."

4. Pit room: A small chamber with an

immense stalagtite hanging from

the center of the ceiling, directly

over the mouth of a bottomless pit.

5. South lake shore: You stand at theedge of a misty lake that stretches

endlessly out before you to thenorth.

6. West lake shore: You are standing

on a damp, sandy shoreline with a

very low passage leading off to thewest. A clammy draft issues from

the low-ceilinged passage.

7. North lake shore: A small, sandy

beach on the northernedgeof MistyLake.

8. Maze room: Also known as theswiss cheese room. You loose yoursense of direction because twisting

passages are coming and going at

all points of the compass.

9. Frozen river room: What appears tobe a petrified river bed slopes gent-

ly upward leading toward hewest. Ithas a low, four-foot ceiling.

10. SwifLriver room: You hear swiftly

running water, as you enter thisroom, and you see a narrow, churn-

ing, underground river flowing to

the south.

11. Hub room: A magnificentlydecorated chamber with crystalinedesigns and intricate rock forma-

tions. A narrow, fast moving river

flows through tbe hub room.

12. Ice room: Mysteriously, ice forms

MICRO -- The 6502Journal

Thomas R_Mlmlitch

1547Cunard Road

Columbus, OH 43227

very quickly in this chamber, encap-

sulating anything left there for too

long. There is so much ice that youcan't even get into the room;

however, you see an exit on theother side of the chamber.

13. Chimney room: A small, smoke fill-

ed chamber with a fire burning in a

natural fireplace in the north wall.Apparently, a chimney leads far up

through the rock and out of thecavern.

14. Gold room: As you enter this room,the first thing that you notice is a

pile of golden treasures nestled into

a nook on the far side. Before youtake another step, a foul-smelling

ogre jumps out from a hole in the

side wall and rushes forward to pro-tect his gold.

15. Bonesroom: Lining the walls of this

chamber are the skeletons ofpirates long since dead. An om-

nious curse is uttered by all of the

skeletons in unison, as you enterthe room, and the curse shadows

your travels throughout the cavern.

16. Bat room: The ceiling is all but in-

visible for the tens of thousands ofbats sleeping there. Inone corner of

this room lies an old, rusted chest.

As you open the chest, the batsbegin to stir. Inside the chest is aking's ransom in jewels: diamonds,

rubies and emeralds.

17. Ghost room: An eerie feeling ofdemonic power lurks in this

chamber.

18. Misty Lake:Youarein the middle of

Misty Lake. A stFange glowemanates from the bottom of thelake. You turn off your light and

notice an enormous, bright pearlnestling inside a gigantic clam. The

clam is at the bottom of the lake, in

only ten feet of water.

19. Swift River:This narrow, fast flow-ing river is outside the cavern. It

runs south for a few yards and thendisappears underground.

17:15

Page 18: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 18/68

Having been exposed to a fantasy pro-gram called Adventure which seems toreside on many large timesharing net-works, I was challenged to see if thistype of game could be handled on amicro. Thus the dream stage began. Ithought up monsters, treasures, a cavestructure, tools, tricks and batt les. Themajor goals emerged:

Pseudo-English input commands

(verb-noun phrases)

Interconnected rooms one couldtravel through

Objects one could take, put, carryand use

Monsters I treasures; do battle, takerewards

Secrets to be discovered

The obvious method was to tabularizeas much data as possible so that similarfunctions could be implemented assubroutines. This left only special handl-ing routines to be added.

The program was orqanized into fivemajor sect ions. Lines numbered 30xxxinitial ize the tables and variables. Linesnumbered 4xxx to 10xxx print out thecurrent location and status for theplayer. Lines numbered 1xxx read anddecode the input string. Lines in the2xxx range perform the command ac-tion, if possible. In lines with 3xxxnumbers the monsters have an oppor-tunity to react to their environment.Each of these sections was developed,

Table 1:Sample word tables for the guide.

The following lists of verbs and nouns are for use if you arehaving diff iculty in communicating with Spelunker. Not all ofthese words have meaning or ut ility in this adventure. I didn' twant to make it too easy!

VERBS

BITE CARRY CLIMB DIG DRINK DRIVEDROP EAT FIGHT GO HELP HITJUMP KILL PUT RUB RUN START

STOP TAKE THROW USE WALK WISH

NOUNS

APPLE AX BATS BOMB BONES CAVECHEST CLAM CURSE DOWN E FIREGHOST GOLD ICE KNIFE LAKE LAMPLIGHT N NE NW OGRE PEARLRAFT RIVER ROPE S SE SWTENT TREE TRUCK UP W WATER

tested and integrated separately fromthe others.

Input commands

A list of verbs and nouns was developedand categorized as to nature or function.After entering these tables into the pro-gram, I worked on the routine to readand decode input commands. Each wordwas picked out of the input string, thensearched for in the noun and verb lists.The first recognized verb and nounnumbers were the output of this routine,and this output controlled the actionroutines. I later added an edit to com-pare the noun type and verb type to seeif they were compatible.

Objects to take and put

Parallel to the noun list is the statuslist which gives the room number wherean object currently resides. A -1 in-

dicates that the object is in the posses-sion of the player. In the output sect ion,objects in the current room (LOC) wereprinted and the objects in the playerspossession were also reported. The se-cond action routine was added nex-t - the TAKE and PUT routine. TAKEchanged the status of a noun to - 1,while PUT set its status equal to LOC.Again I tested the program and playedwith it, moving things allover the caves.

Verb Table

Sensative Noun TypesVerb Type

Direction Location Weapon Monster Treasure Tools Foods

1 GO 1 x

2 JUMP 11 x x x

3 RUN 1 x

4 WALK 1 x

5 DRIVE 1 x

6 CLIMB 3 x x

7 DIG 2 x

8 CARRY 116 x x x x

9 DROP 116 x x x x

10 PUT 116 x x x x

11 TAKE 116 x x x x

12 USE 36 x x

13 WISH 36 x x14 THROW 4 x

15 HELP 8

16 KILL 8 x

17 STOP 40 x x

18 HIT 8 x

19 FIGHT 8 x

20 RUB 16 x

21 START 32 x

22 DRINK 64 x

23 EAT 64 x

24 BITE 64 x

17:16 MICRO -- The 6502 Journal October, 1979

Page 19: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 19/68

Cave room structure

The map was finalized, giving each rooma number. The interconnections wereentered into the N, E, Sand W arrays,with a positive number indicating an exitin that direction to the room numberspecified. A series of statements wereinserted in order to print out the currentroom descriptions, but at the time onlythe room name was printed. Later I

discovered that there was not enoughmemory to put in the complete descrip-t ions in any event.

The first of the action routines - theMOVE routine - was coded next. Ifthere was a possible move in the re-quested direction, the LOC variable wasset to the new room and its descriptionwas printed. This portion was a lot of funto test and debug.

Monsters, treasures and battles

The monsters and treasures weremerely noun objects in the caves, l ike allof the other things. A relationship wasdefined between the monster, his

treasure, the player, and the player's useof weapons. Thus grew up the monstertable and the weapons table. Themonster table identifies the monster,determines his strength, defines histreasure, identifies his home chamber,and determines how quickly he movesabout the caves. The monsters movethrough the caverns to find theirtreasures if they are stolen. In the tableare certain base probability factors forthe monster to kill the player, steal allthe player's treasures, or steal only thetreasure than originally belonged to themonster.

)

The weapons table details the power

of each of the player's weapons anddetermines which monsters they are ef-fective against. The next act ion routinewas ready to implement: the ATTACKroutine. This is invoked whenever aweapon is used, put, thrown, and so on.Any monsters in the room are attacked,and their life forces are decreased by arandom amount limited by the force ofthe weapon used. When a monster's lifeforce is reduced to zero, it is eliminated.

Of course, it is not fair to let the playercut the demons to shreds without allow-ing them to fight back. Thus came theREACTION routines. Happy monstersare those that have their own treasures

in their room and have not been attack-ed. Any monsters that are not happy willseek someone to vent their anger upon,and that person is the player. A very in-tricate set of probabilities decides theoutcome of this anger. The more themonster has been hurt bythe player's at-tacks, the weaker his counterattack willbecome. But also, the more times he hascountered in vain, the madder he gets!Nothing is more deadly than a madmonster.

October, 1979

Noun

1 N

2 NE3 E

4 SE5 S

6 SW

7 W8 NW9 UP10 DOWN11 CAVE12 LAKE13 RIVER14 TREE15 AX

16 BOMB17 CURSE18 FIRE19 KNIFE20 CLAM21 BATS22 BONES23 GHOST24 OGRE25 CHEST26 GOLD27 PEARL28 LAMP29 RAFT30 ROPE31 TENT32 TRUCK33 LIGHT34 WATER35 APPLE36 ICE

Room

1 Mouth2 Tree3 Writing4 Pit5 South Lake Shore6 West Lake Shore7 North Lake Shore8 Maze9 Frozen River10 Swift River Room11 Hub12 Ice13 Chimney

14 Gold15 Bones16 Bats17 Ghost18 Moosty Lake19 Swift River20 Intersect 121 Intersect 222 Intersect 349 Falls (Over)50 Home

MICRO -- The 6502 Journal

Room TableTunnel Connects

N E S W

50 19 23

2 10 20

Noun Table

Type

DirectionDirectionDirectionDirectionDirectionDirection

DirectionDirectionDirectionDirectionLocationLocationLocationLocationWeaponWeaponWeaponWeaponWeaponMonsterMonsterMonsterMonster

MonsterTreasureTreasureTreasureTreasureToolToolToolToolToolFoodFoodWater

20-18

Status (Location)

oooooo

oooooooo4 Pit3 Writing15 Bones13 = Chimney1 Mouth18 = Misty Lake16 = Bat15 = Bone17 = Ghost

14 = Gold16 = Bat14 = Gold18 = Misty Lake12 = Ice5 = South Shore9 = Frozen River1 Mouth1 Mouth1 Mouthoo12 Ice

Notes

Truck Tent Knife Light

1111

BombAx Use rope to go downRaft-north Rope-upRaft-eastRaft-southAll 45's return to MazeRopeRaft-south- 1522 12 (NE SE SW NW)Ice LampFire Rope-up

Gold OgreCurse BonesChest BatsGhostPearl Clam

-18 129 -188 9 8 207 1 8

3 -1113 14 -49 21

11 6

11

2221

7 5 6

1

8 3 411 22 17

11 16 21DeathEnd game

17:17

Page 20: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 20/68

Lots of testing and refinements later,

SPELUNKER took its maiden voyage.

Surely a program like this is never f inish-

ed. The framework has been laid for all

sorts of adventures, whatever one can

imagine. And, now that I have more

memory, I can expand the scope and

capabil ities of the program.

Monster name

Monster number

Reward

Reward number

Move delay

Move increment

Attack count

Kill probability

Steal all probability

Steal own probability

Home room number

Life force quotient

Weapon name

Weapon Number

Power

Attacks Monster No.1Attacks Monster No.2

Attacks Monster No.3

Monster Table

Ogre Bats Ghost Clam Ice Bones

24 21 23 20 36 22

Gold Chest Pearl Lamp

26 25 0 27 28 0

0 0 0 1 1 1

2 4 6 0 0 0

0 0 0 0 0 0

60 60 0 90 0 0

30 40 0 60 60 0

55 90 0 65 0 0

14 16 17 18 12 15

100 40 50 60 25 75

Weapon Table

Ax Bomb Fire Knife Light Ice

15 16 18 19 33 36

100 150 30 50 30 40

24 2421 24 23 21

22 22 20

36 36

Program Flow

Initialize - 30000'5

Dimension and set up data for nouns,

verbs, noun types, verb types, status or

location of nouns, noeth, south, east

and west tunnel connections, monster

life force tables, and weapons table.

Output - 4000's

Print room descriptions, possible exit

directions, and room contents as well as

your possessions.

InputfDecode . 1000's

Read your typed-in command, select

each word and scan it against the noun

and verb lists.The first valid noun and

verb are edited and used to control the

rest of the program.

Actions· 2000's

This routine handles takes and puts,

special verbs and nouns, your attacks

on life forces, and movement through

the caverns.

Reactions· 3000's

The demonic life forces who have been

attacked or who do not have their own

treasures fight back. Based on complex

probabilities, they either kill, steal your

treasures, or wander the caverns in

search of you.

Page 21: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 21/68

)

)LIST

13 REM SPELUNKER

1 C iOTO =13 (1 12 11 3:.H1 T O IN IT IALIZE

10(10 P F.:UH "':"".;: INPUT IN$: IN$( LEN ( Uu"· )+ i)= " GO N : t: ": 1=1

1131215OUN=13:VERB=13

1131 (1 130SUB151313 : 130SUB16121121:30SUB17121121

10213 I F ~E$#" * "THEr~ 113113

11215121TYP =NTYP (NOUN) :VTYP =VT YP(VER B)

11~160IF 0: : ',/H 'P r'1 (1 [) ( NH 'P * 2: :O ) )=NTYP THE r~ 2 13 12 11 21

1(17(1 P RIrH "I C H ',/ER ST EH E rn C HT "

10: : :121GOT O =:1312113

12 (113130TO 213 (1121

1~': '1~1I' :1D$="":S=0: FOR 1=1 TO LEr·hHU"·): IF 5=121THEN 1~:;212t: IF IN !·(!.. 1)= " " THE r·~

1580: IF S=5 THEN 1560: GOTO 15413

152[1 IF IrUd .. 1)= " " THEN 1~ ': '612t

1540 S=5+1:W3$(S)=IN$(I. I)

1 5613 r 'I E><T I

1 581 21 IF S (5 T HE N W 3$(5 +1 )= SP C $(S +1 )

1 :,90 R ET UR r~

1 6(1 121F ·r· IO UN #13T H EN R ET URN F OR J =l T O NUI'1N : IF l·1 3l#N OUNS :t·(_ l:t:: ,-4 ., J *~ 5) T H EN

r'E <T J : IF J :> =r· IU I· 1NT HEN F .:E T UF .:N NOUN=J : ~ 12 $= l· C$

1610 RET URN

17121121F VERB#12tTHEN RETURN: FOR J= l TO NUM V: IF W3$#VERBS$(J *5-4 .. J *5) THEN

N E::< T J : IF .J :> =N UI· WT H EN R ET URN : '., .'E F.:B =.Jl·l l$=l·C$

1716 F.:E TU RN2000 F.H1 r10VE201121NLOC=12t

2 02121 IF 1 ·IOU I·D ·8THEN 22121121

20={1 IF (N OUN 1'10[:02)=1 T HEN 210121

21214(1F LO C*11 AND LO C#8 T HEN 107121

211312130TO 21012t+NOUN*10

2 11 12 1N LOC=N (L OC ): GO TO 2 19 12 1

2128 N LO C=I2t: G OT O 2190

21]0 NLOC=E(LOO : (JOT O 2 19121

21 41 ':1N LO C= l~': ': IF LO C= :3 T HE N N LOC= 8: G OT O 21 91 212 15 12 1NLOC=~, (LO (: ): GOTO 2 19 0

216121NLO C=22: IF LO C=8 T HEN NLO C=8: G OT O 2190

217[1 NLO C=W LO C): G OT O 21902180 NLOC=12: IF LOC=8 THEN NLOC=8: GOTO 219121

2190 I F RAFT=1 T HEN NLOC= AB::, O ·ILOC ;'

2 19 1 RRFT = 0:P L OC=LOC

2192 IF NLO C)12tT HEN LO C=N LO C

219=: IF NLOC*12 THEN 290121

2194 IF "1(50)(5 THEN 2900

219~, IF P LOC=6 T HEN S(12)=0

2196 IF P LOC=ll T HEN ~H12)=e

2197 G OT O 290121

2200 IF (NOUN=9 OF: NOUN=10) AND ROP E=12tT HEN GOTO 1 (1 ?1 2t

22(15 IF NOUNt9 THEN 22513

2210 IF LOC#5 AND LOC#13 THEN 11370

222121 IF LO C=5 T HEN LO C=4

22=:13 IF LOC=B THEN LOC=50

224121GOTO 11210121

2250 IF NOUNU0 THEN 23'.00

226(1 IF LOC#4 THEN 1070

2270 LOC=5: GOTO 1000

n00 IF V ERB=8 OR VERB=ll THEN 2120: GOTO 2150

2320 IF NU I'1P =8 T HEN 1070

2125 IF NO llN=34 AND (LOC=19 OR LOC=10 OF: LOC=5 OR LOC=18 OR LOC=? OR LOC=

6 OR LOC=l1) THEN 2145

October, 1979 MICRO -- The 6502 Journal 17:19

Page 22: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 22/68

2330 IF STA(NOUN)~LOC THEN 1070

2:::::::::,IF r·!OUr·!=2:::AND 1'1(50»~~1 THm Hm3

2345 STA(NOl~)=-l: GOTO 3000

2350 IF VERB=9 OR VERB=10 OR VERB=14 THEN 2370: GOTO 2400

2370 IF STA(NOUN)~-l THEN 1070

2:::::::13STA(r'!OUN)=LOC

n::c IF r'!OUN~::::::::THEN 2420

2385 IF VERB#10 THEN STA(33)=0

2=~:: :7 L I G H T = ( t

23.9~j GOTO 2420

2400 IF VERB~12 THEN 29002410 IF STA(NOL~)~-l THEN 1070

242(j FOR m=l TO NUI'1L,j:+::,-4STEP :'

2425 IF NOUN~WT(WT) THEN 2480

2430 FOR D=2 TO 4

2435 IF (STA(WT(WT+D» MOD 1(0)~LOC THEN 2470

2440 FOR M=l TO NUMM*10-9 STEP 10

2445 IF WT(WT+D)~M(M) THEN 2460

2446 HT= RNO (WT(WT+l»!«(~RSE+l)

2448 M(M+9)=M(M+9)-HT

2449 IF M(M+4)=0 THEN M(M+4)=1

2450 PRIm "A::SRULT ON "; NOUNS$(1'1(1'1)*5-4 ..1'1(1'1)::,).; ", "; HT;" UNITS"

24:,;:: PF.:HH "ITS LIFE FORCE IS r·!ml U; 1'10'1+9),;";~"

2455 IF M(M+9»0 THEN 2460

24:,':, PRHIT r·!our·!S$(t'1(t'1):t:5-4 ..1'10'1):+:5).;" HAS BEEr·! ELHlINATED"

2457 STA(M(M»=0

2460 NE::<T 1'1

2470 NE::<T0

24:::0 r'E<:T (.IT

249(1 IF NOUN~16 OR VERB=l(1 THEN 2:,00

2492 STA(16)=0: GOTO 2493+ RNO (4)

2493 r'I(LOC)=0: GOTO 250(1

2494 E(LOC)=~3: GOTO 2:,00

2495 S(LOC)=0: GOTO 2500

2496 L,hLOC)=0

2500 IF NTYP~32 THEN 2900

2:.1(1 I F r'!Our'!~33 THEN 2520: IF ',lER8=12 THEN LI GHT=1: GOTO 290f:J

252~3 IF r'!Our'!~29 THEr·! 2:,30: RAFT=1: GOTO 29£102:,;)3 I F Nour'!~30 THEN 254~3: F.:OPE=l: GOTO 29(10

254~3 REI'1

2900 IF N(~N{ll THEN ROPE=0

2910 IF ::,TA(3:~~1)=LOCTHEN ROPE=l

2920 IF LOC=12 THEN ::::000

2930 W(12)=6:S(12)=11

3300 REM RE-ACTION

3:1310 FOR 1'1=1 TO NUI'1I'1*10-9 STEP 10

3020 IF STA(M(M»~O THEN GOSU8 3800

::::0::::0NE::<T 1'1

::::040 IF STAC:5)=~3 AND STACA)=2 THEN STAC~::,)=2

::::090 GOTO 4000

3:8(113REI'1 110NS SUB3:::(12 I1RI'1=STA(t'1(I1) 1'1OD10~3

:::::::10 IF (STAO'W'1+1) 1'10D1fj0)=11RI'1 AND 1'1<1'1+4)=0THEr·! 3900

::::82~3IF 1'1RI'1=LOCTHEN 38E,fj

:::::33:1j1'1(1'1+2)=(1'1(.11+2)+1'1(1'1+3» 1'100 6

3840 IF M(M+2)~fj THEN RETURN

::::845 GOTO 3850+ RND .;4)

1.85(1 NLoc=r·!O'lRI'D: GOTO 3855

::::::::,1 NLOC=E(I'lRI'1): GOTO ::::855

::::8:,2: r'!LOC=S(111":1'1):GOTO 3855

17:20 MICRO -- The 6502 Journal October, 1979

Page 23: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 23/68

18~5~:r·jLOC=Wr·lRI·1): GOTO ~:8~,5

1855 IF NLOC(l THEN RETURN

3858 STA(M(M»=NLOC+STA(M(M»-MRM: RETURN

3860 M(M+4)=M(M+4)+1

1865 KP=(M(M+5)-(STA(M(M+1»=-1)*40+9*(M(M+4)-2»*M(M+9)/100+CURSE

1866 IF KP)60 THEN KP=60

3870 SAP=(M(M+6)+9*(M(M+4)-2»*M(M+9)/100+0JRS~

1871 IF SAP)70 THEN SAP=70

3875 SRP=(M(M+7)+9*(M(M+4)-2»~~(M+9)!100+CURS~

3876 IF SRP)80 THEN SRP=80

3877 PRINT "ATTACK BY ";NOl~SS«M(M)-1)*5+1,M(~)*5)2:::::79fU= Rr-l[' (Hm): F.:2= Rr·j[, (H,'1(1). p~:= Rr~[) (lIX1)

: :: ::: :: ::1:1F KP)R1 THHj ~:920

: : : : 8 : : : : , IF SAP)R2 THEN ~:94~~1

is:::7 IF STAO'10'l+1) )#-1 THEN RETURN

::::890 IF SRP)FC THHj ~:96~~1

3:89~, F.:ETUFlj

3900 STA(M(M»=M(M+8)

3905 STA(M(M+1»=M(M+8)

::::910 RETURN

2:920 ',/TAB n: TAB L : PRI N T "THE "; NOUr6S'; (t'l (t'l) -1) :+:~,+Lt 'l (t 'l) *5); n KILLE[) 'T'OU'"

3924 PRINT KP.Rl

3:92:, Er·jD

~::94(1FOR I =1 TO r·jUr,m

3945 IF NTYP(I)=16 AND STA(I)=-l THEN STA(I)=M(M+8)

::::9~,0 r·jE::<TI

::: :9~,7PRHIT "ALL 'T'OUF.:FHJAF1!S STOLEr·j"

3958 PRINT SAP.R2

~:959 GOTO ~:900

~:960 PRHIT "HE TOOK BACK HIS VALUABLE"

3:962 PRI NT 5RP J R3 :

3:965 GOTO ~:9~j0

40~X1 FHl OUTPUT

4~~Oj FOR I=~: TO 9: ',lTAB I: TAB 2: PRHH "

I

4(150 IF LOC(1 OR LOC)50 THEr·j GOTO 4051

4060 GOTO 4000+10(1*LOC

407121POKE ~,121.3.: VTAB 2: TAB 2: PF.:HIT LOCS.;: POKE 50,255: F'RWT "

.' . NE>::T

n.J RETURr·j

4090 VTAB 23: TAB 1

4095 IF LIGHT=l OR LOCe OR LOC=19 THEr·j 9100

4097 PF.:INT "IT IS "lER'r' DARK"

4~399 GOTO 910(1

41~30 LOCS="1'10UTH GOSUB 412170

4199 GOTO 4~~190

4200 LOCS=IITREE ROOI'l II. GOSUE:407~j

4299 GOTO 4090

4~:0~~1OC$="I~RIT I NG ROOl'l ": GOSUE:4070

)

4399 GOTO 412190

44(1(1 LOCS= lip IT GOSUE:4071214499 GOTO 409~j

4500 LOC$= IISOUTH LAKE II. GOSUE:4071:1

4599 GOTO 4~j9(1

46~30 LOC$="I,JEST LAKE GOSUE:4~j70

4699 GOTO 4B9~j

47~j0 LOC$="NORTH LAKE II. GOSUE:41217121

4799 GOTO 4090

48~3(1 LOC$= IIl'lAZE ROO~l II. GOSUB 4070

4899 GOTO 4090

October, 1979 MICRO -- The 6502 Journal 17:21

Page 24: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 24/68

4gen3 LOC$= "FROZEN R I'· ,I ER " : ( JOSUE:4070

4999 GOTO 4~1 905(10(1 LOC$="RIVER R00l1 " . GOSUE: 407135£199 GOTO 413913

51013 LOC$= IIHUE: ROOt1 " . ( JOSUE:4t170:,199 GOTO 4090

5200 LO C$="IC E ROO I'1 II. ( JOSUE:41370

:,299 GOTO 409 0

53:1313LOC$= IICHI t '1NE 'r ' II. GOSUB 413713

5399 GOTO 413905400 LOC$= IIGOLD ROOl'1II • GOSUE: 41370

~i499 GOT O 40913

5501: :1LOC$="BONES II. GOSUE:413713

55113 IF STA(3S)I-l THEN CURSE=CURSE+15

5599 G OT O 413913

: ,6130 LOC$="BATS II. GOSUE:4070

5699 GOT O 41390

5 70 13 LOC$= IIGHOST F:Oot1 (JOSUE:4070

5799 GOTO 4090

5 :: :~1 I~1OC$="t 'l IST 'r ' LAKE II. GOSUB 407~1

:,899 G OT O 4139~1

5900 LOC$="S~.J IFT RIVER (JOSUE:4070

5999 G OT O 413913

6 001 ::1L OC $= " IIH ERSECT ION": GOSUE :4 07 06139~=lGOTO 409 13

t:W~1 (JOTO 6 (1 13 0

62B~1 GOTO 61313 (1

6999 GOT O 41390

8 90 0 LOC$= "O \· 'E F.: F AL LS II. GO::- .UE:41370

: : : :91(1 ' · iTAE: zi T AE: 1: GOT O 9(1913

913130LOC$= II'rOUR HOI'1E GOSUE:40713

9OC15 At '1T=0

91310 IF ST A(25)=-1 T HEN At1T =AI'lT +13:

9020 IF STA(26)=-1 THEN AI'1T =AI'1T+22

9030 IF STA(27)=-1 THEN AI'1T =AI'1T+8

9040 IF STA(28)=-1 THEN AI'1T =AI'1T+5

9 13 50 V TAE: n: T AE: 19136. 13I F A I'lT =13 THE I· J 9 1390

90713 P RW T "'r'O U HAV E FO UN [) $".; AI'lT .; " .. U; R ND .::9 t1 l: :n+ 1(n };" II -J TREASUF.:E S"

91 38 13 IF A I'lT :> 13: T HE N PR I N T "I· JI C E S PE LUNI<I I·J G "

9 09 ~1 P R I IH "GOOD-E :'r'EII

9 139 9 E ND

9100 FOR 1=2 TO 10: V TAE: I: TAE: 30: P RINT "

9105 IF LIGHT=0 AND LOC:>2 AND LOCI19 THEN 9290

9110 VTAE: 5: TAE: 33: PRINT "~": TAE: 3 3: PRINT "+": POKE 50 ..63

9141::, IF I·J (LO C)= 13 O R q ·J (LO C)« (1 A N[) R AFT =13) T HEN 91513: '· /T RB :::: : T AE :n: F'pu-n

9150

"N": TAE: : r 3 : PF. : IH II II

IF S(LOO=0 OR (S(LOC)(0 AND RAFT=13) T HEN 9 16 0: ' · /TAE: C O . TAB : :: :3 : : PRI IH. . . .II " TAB s.s : PRI IH I IS"

IF E(LOC)=I : : , OR (E(LOC)(0 AND RAFT=13) THEN 91713 '· /T AE: 6: T AE: 3:5: PRINT16tl II E ll

91713 IF W :LOC)=0 OR q·l<LCn ::)(tl AN[) RAFT=(D THEN 9180: V TAB 6: TAE: : : : : 1 : : , : F'RIIH

"~l "

91B(1 IF (.LOC=5 OF.: LOC=E) AN[: ' ROP E=l THEN 9185: GOTO 91913

91B5 VTAE: 2: TAE: 3:~;: P RINT "UP "

91913 IF LOCI4 OF: ROPE=0 THEN 9200

9195 VTAB 10: TAE: 3 :3 : P RINT "DOWN"

92130 IF LOC=l1 OF.: LOC=::: T HEN 92113: GOT O 9290

9210 VTAE: 3: TAB 30: PF.:INT "N ": TAB 313: PRINT " W It

9215 IF LOCI8 THEN 922(1: V TAE: J :: T AB 35: PR I NT " E": TAE: 3:5: P F:IIH "N "

17:22 MICRO -- The 6502 Journal October, 1979

Page 25: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 25/68

92213 VTAB 8: TAB 313: PRINT II W; : TAB 35: PRINT "5 II. TAB 30: PRIm "S II

: TAB 35: PRINT" E"

9290 POKE 50,255

9300 IF LIGHT==e AND LOD2 AND LOCI19 THEN 94013

9105 VTAB. 5: TAB 2:J==0

9~:10 FOR I ==1TO NUMN-l

9320 IF (STA( 1) nco 10~n#LOC THEN 9360

93313 PF:UH NOUNS$«I-l)*5+L 1*5);" ";

9348 J==(J+l) MOD 4: IF J#B THEN 9360

93:513PRINT "": TAB 29360 NEXT I

94130 VTAB 13: TAB 2: FOR 1=1 TO 12: PRINT"

9418 VTAB 13: TAB 2: PRINT "POSSESSIONS "; :NUt1P=0

9420 FOR 1=1 TO NUt1H-l

94313 IF STAe I )}=~1 THEN 9480

II••

.. .

9440 PRI NT NOUHSS«1-1 h5+L 1*5);" ";

9450 rU'lP=NUt'lP+1: 1F NUMP=4 THEN TAB 14

94813 NEXT 1

9900'VTAB 23: TAB 1: GOTO 10130

3€113130REt1 I N IT I ALI ZE ROUT!NE

300113 DIM !NS(40),NOUNSS(255),VERBS$(255) ..Wl$(5) ..W2$(5),W3S(5),NTYP(5e),VTYP(

50), STA(~,0)

313020 DIM N(50),E(50),S(50),W(50)

3(113:3:0TE;:':T : CALL -936

3:13040 DH1 LOCS(26), SpeS(5), POSS(1eL t'1(6;+;10)

3:t3050 spes="

:<[106(1 NUt'n~=6

1fJ065 [: 0 I t' l ur (5*NUt'lW)30070 LOC=l

31~111~113Et'l Ull T! ALI ZE VARI ABLE~,

20101 REM SHOULD BE REA[) AND DATA STI'lTS

301113 NOUNS$( LEN(NOUNSS)+l)=="N NE E

"

SE S

)

301213 NOUNSS( LEN(NOUNSS)+l)=="CAVE LAKE RIVERTREE "

301313 rKIIJNS$( LErv. NOUNSS)+1) =" A>;: BOI'18 CURSEFI RE KNI FE"

313140 r·mUHS$( LEr'I(NOllNS$)+1)="CLRt'l BATS Bor'~ESGHOSTOGRE"

:3:131513~OUNS$( LEwr'~OUNS$)+1)="CHESTGOL[i PEAPLLAMP "

31316(1 r'~OUNS$( LEN(NOUNSS)+1)=="RAFT ROPE TENT TRUCKLIGHT"

3:1317(1NOUNS$( LEr-H~~OU~~SS)+1)=" WATERAPPLEI CE "

3:0195 NOUNS$( LEN(I·lOur·lSS)+1) =="*****"

3t1199 WJt'1r'~=3?

3:13216 VERBS$( LEN("/ERBS$) +1) = = " GO JU~1P RUN l,lALK [ J f , : I VECLH1B"3022(1 VERBS$( LEH(VERBSS)+l)=="DIG "

3:(123:1~iVERBSS 0: : LEN(' ,/ERBSS) +1) =" CARR'T'DROPPUT TAKE USE l' l ISH THROW"

3:02413 ',/ERBSS( LEN(VERBSS)+1)="HELP KILL STOP HIT FIGHT"

3:02513 \IERBS$( LENC,,1ERBSS)+1)=="RUB "

3(12613 ',,1ER8SS LEN( .....RB~,S)+1) = = "STARH:oRI '.,IE"

30278 VERBSS( LEN(VERBSS)+1)="DRINKEAT BITE"

]J}2'3:, ',IERBS:f.( LEH(',/ERB5:f.)+1)=I*****"

30299 r~U~1V=262:I~Gl13FOP 1=1 TO 18: NT'T'P( I )=1: NE::<T I

::133213FOR 1=11 TO 14:rH't'P(l)=2: NE:X:T I

~)333.t1 FOR 1=15 TO 19:NT'T'P(1)=4: NEn 1

313::::413FOP 1=213 TO 24:NT'T'P(1)==8: r~E:x:TI

:3:03513FOR I =25 TO 28: NT'~P(l)=16: NE~n I

3:133:613FOR I =29 TO 33: NT'T'P 1) =32: NE:x:T I

:;)=:1378FOR 1=24 TO 3:5: NT'T'P(l )=64: NE;:':T I

301:::13 rH'T'P :;:6)=32

313410 FOF.: =1 TO 6: VT'T'P(l )=1: NEXT I

:3:13412VT'~P 2)=11: VT'T'P(6)=3:

October, 1979 MICRO -- The 6502 Journal 17:23

Page 26: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 26/68

30420 VT'T'P(7)=2

:::~34::0 FOP I =8 TO 11: VT'T'PI )=116: l-lE:n I30432 VT'y'P(12)=:::6: ',/WP(13:) =36 :VWP(14)=4

3:044.3 FOP 1=15 TO 19: VT'r'P(l )=8: NEi<T I

30442 VTYP(17)=40

30450 VTYP(20)=16

::)346~3FOR 1=21 TO 22: '·/T'T'P( )=3:2: NEin I

3:13470FOP I =23: TO 25: IITYP( 1) =EA: I-En I

:::135138Ol': 1=1 TO 14:STA(1)=0: NEin I

3:051~3STA(15)=4: STA(16)=3:: STA(17)=153:052~3STA(18)=E: STA(19)=1: STA(213)=18

3:053:0 5TAo::2D=16: STA(22)=15: STA<2:;:;)=17

3:0540 STA(24)=14: STA(25)=16: 5TA(26)=14

3:05:,0 STA(27 )=18: STA(28)=12: 5TA(29)=5

3:0560 STAo::3:tt)=9STACD=l: STA(2)=1

:;m57~~1TAC3:3:)=1 5TA0::3A)=8:STA(J5)=13

30~:':::0STAC:6)=12

3:06~3~3OR 1=1 TO :,13:I-l(l)=tt:EO)=0:S(l)=0:W(l)::0: 1-jE;:<:T

3(16113N(1)=50: NC)=2: I-H5)=-18: N(7)=9: W8)=8: W9)=7

3:136213N(10)=J: I-l(11) =13 :N(16)=22: NUB)=7

30630 N(19)=1:N(20)=8:N(22)=11~:tt64>3E(2)=1: E(4)=2£1: E(6)=-18: E(8)=9: E(9)=1: E':lD=14: E(17) =21: E(20)=J

3~3650 E (21) =113£1660 S(1)=19:S(2)=3:S(3)=1£1:S(7)=-18:S(S)=8:!;(10)=-11:S(11)=-49:5(12)=11:

S(13)=11:5(18)=5

3:0670 5(21)=22: 5(22)=16

~:£1680WD=2: 14(3)=2£1:W6)=12: W8)=20 -~l(9)=8: 140:11)=21

J~3690 ~1(12)=6: W14)=l1: W15)=11: 14(18)=6: W20)::4: 14(21)=17: ~·l(22)=21

3(m3(1 POKE :,13_.3

~:071'3 VTAB 24: GOSUB3:1999: IITAB 1: GOSUB319!~9: VTAE:11: GOSUE:3:1999: IITAB

lE.: (JOSUB3:1999

3~3720VTAB 2: TAB 1

3J373:~3OR 1=2 TO zr . PRINT" ";: TAB 29: IF 1-:11 THEN PPUH " U;: TAB~:9: PI':nH

3H74(1 POKE50, 255: POKE32, 1: POKE33,37: pm:: ! : 3:4 , 16: POKE35, 23: : VTAB 17:

TAB 23~3800FOF~1=1 TO 6~3:r·1(l)=13: NEi-::TI30810 M(1)=24:M(2)=26:M(4)=2:M(6)=60:M(7)=3£1:11(S)=55:M(9)=14:M(10)=100

308213M(11)=21:M(12)=25:M(14)=4:M(16)=60:M(17!=40:M(18)=90:M(19)=16:M(20)=

4.3

3:0::G0Mo::2D=23::t1(24)=6: r1o:29)=17:r'K:!:I3>50

3t184~1~l(1)=2t1: r'1(3:2)=27 :r'1(3)=1: r1(3:6)=913t'l(3:7'=60: t'1(38)=65: MC:9)=18: t1o:4.3)=

603:(1::::,~3W41)=3:6: t1(42)=28: t1(43)=1: t'1(47)=60 :t·1(49,=12 :W513)=25

3:0860 M(51)=22: t'l(53)=1: r'1(59)=15: [01(60)=75

2(18913NUt'U1=6

:;::0900 ~1T(1)=15:~.n (2)=1013: WT3:)=24: ~~T(4)=0: ~,nC»=0

30910 WT6)=16: ~1T(7)=150: WT(8)=24: ~11(9)=22: WT:1IZ!)=3:6

~:1392~3WT(11)=18: ~n(12)=3:0: ur (13:)=21: ut (14)=22 WT(15)=36

31393:0~1T(16)=19: ~n(17)=50: ~11(18)=24: 141(19)=213:~!H20)=0~:t194.3HH.21)=3:3:: ~JH22)=30: ~1T(n)=23:: 141(24)=0: IH(25)=i33.395.3 ut (26)=3:6: 141(27)=40: ~1T(28)=21: 141(29)=(1:!HC;0)=0

~~:j999 (lOTO4.300

3:1999 TAB 1: PRINT II "_; : PETUF~I-~3213013PRINT 0 :: PEEK (202)+ PEEK (2133)*256)-( ~~EK (204)+ PEEK (285)*256): END

17:24 MICRO -- The 6502 Journal October, 1979

Page 27: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 27/68

The COMPUTERIST' Has It All !!The leaders in Expansion Accessories for

AIM I SYM l KIMFeaturing a Power Supply/Enc~losure for the AIM 65

ENCLOSUREWITH BUILT IN

POWER SUPPLY

SPECIFICATIONS:

INPUT: 110/220 VAC 50/60 Hz

Now with-OVER · VOLTAGE a n d

S H O RT · CIR C U IT

Protection

OUTPUT: + 5V @ 5A

+24V @ 1AGROUNDEDTHREE·WIRE LINE CORD

ONIOFF SWITCH WITH PILOT LIGHT

Enclosure has room fortheAIM and one AI M ENCLOSU RE:additional board: MEMORY PLUS or VIDEO PLUS $4500

AIM PLUS: $11000 AIM and J~IM PLUS: $48500

Plus some very elegant expansion boards

FOR

AIM/SYM/KIM

8K STATIC RAM P~~~R

Sockets for 8K Eprom

6522 1/0 Port

ON BOARD REGULATORS

EPROM

PROGRAMMER

MEMORY PLUS: $20000 FULLY ASSEMBLED AND TESTED

tm

\9[I~[3® ~11[!!)@l FOR ,~IM/SYM/KIM

UPPER/l ower ceee ASCII

128 AddlUonal User Programmable

Characters: GRAPHICS-

SYMBOLS·F'JREIGN CHARACTERS

programmabie Screen Format up to

8 0 CHARACTERS · 2 4 LINES

KEYBOARD and L IGHT PEN Inter laces

Up 1 0 4K D ISPLA.Y RAM

Provision for2K EP~CM

Pr ov isi on t o ad d 650 2 f or

STAND·AUJNE SYSTEM

ASSEMBLED AND TESTED

WITH 2K DISPLAY RAM

VIDEO PLUS: $24500

Many other products available. Write for a complete catalog[or call if you are in a hurry !]

The prices listed above do

not include shipping and handling.

j

©@[M]~(!JJiJ§~I]~~

POBox 1 ~5 Chelmsford. r n A OI8'2~1

.17/25.-3.".

Page 28: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 28/68

REAL GRAPHICS FOR PET

SHOWN WITH :

K-1007-1INTERFACE

K-1008- IJ V ISIBLE MEMORY

K10 05 -P 5 SLOT CARD F ILE

K-100B-:3C DRIVER SOFTWARE

$99.00

$243.00

$80.00

$20.00

• T HE FLEXIB ILIT Y YOU HAVE DREAMED ABOUT IS NOW AVA IL;l,B LE !

• 320 W IDE X 200 HIGH IIESOLUT ION

• EACH DOT INDIV ID UALl Y ADDRESSABLE

• SO FTWARE SUP PORT - LEV EL 1 GIV ES GRAP HICS & TEXT CONTROL AT MACH INE

LANGUAGE SPEED BUT ACCESSABLE FROM BAS IC BY GOSUB AND VARIABLE

STATEMENTS.

• DUAL P ORT 8K BYT E M EM ORY ON BOARD ALLOWS FULL USE OF M EM ORY FOROTHER T ASKS (SEE YOUR PROGRAMS IN T HE IR D IG IT AL FORM IF YOU LIKE!)

• DOUBLES THE M EM OR) SIZE OF AN BK PET

• COMP LE TE LY TRANSPA ilENT SCREEN REFRESH - NO SNOW OFI B LIN KING EVER -

T HE PROPERWAY TO O J IT !

CALL O RWRIT E FOR OUR FULL LINE CAT ALOG OF P ET

EXPANSION PRODUCTS.

M IC RO 'rECH NO L OG Y UN LIM ITED841 GALAX Y WAY

PO BOX 4596

MANCHESTER , NH 031 08

(603) 627-1464

Page 29: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 29/68

6522 Timing and Oountlnq Techniques

While many 6502 computerists are becoming tamilar

with the 6522Versatile Interface Adapter, do you reallyknow how all of it features work or how to use them?

This tutorial will clear Lipthe mysteries of the 6522.

Applications that require interval

timers include everything from the pro-

duction of simple sound effects forgames to the implementation of

sophisticated data logging or controlprocesses. Because single-chip micro-computers, such as the Rockwell 6500/1

and the Intel 8048,are intended for highvolume, low cost applications, the fact

that they include counter/timer logic is atestimony to the importance ofcounter/timer functions for a large var-iety of applications. Several simple ap-plications will be explained.

The techniques will focus on thecounter/timers found on the 6522 Ver-

satile Interface Adapter. The 1)522 iscurrently popular in a number 01 micro-

computer systems that utilize the 6502,including the SYM-1,theAIM65,and theMICROPLUS.Expansionboards such as

the MEMORY PLUS also include the6522, and the 6522 can be easily inter-faced to the popular KIM-1 (see 6502User Notes, No.13,pg. 16).However,thetechniques that are described will fre-quently be applicable to any

Marvin L. De JongDepartment of Math and PhysicsThe School of the OzarksPoint Lookout, MO 65726

counter/timer with only minor modifica-tions in the hardware or the programs.

The basic features included in manycounter/timers (also called intervaltimers) are shown in Figure 1.This blockdiagram shows that a counter/timer con-

sists of three registers; the counterregister which is either an 8-bit registeror a 16-bit register, a flag register, and a

control register. A number, N, is loadedinto the counter register by a WRITE(typically an STA) instruction. If thecounter is a 16-bit register, then twowrite instructions are required. In 6502

C O U N T E R

REUISTER

FIAG f - - - . \REUISTER

I.-.-_------'~

DATA illS

·CIJXK

Figure 1. Block Diagram of a Typical Counter/Timer.

October, 1979 MICRO -- The 6502 Journal 17:27

Page 30: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 30/68

systems these registers are simply some

of the 65536 memory locations. After N

is loaded into the counter, it is

decremented at a rate determined by the

clock signal connected to the counter.

When N decrements through zero, one

of the bits in the flag reg ister is set to

logic one. Thus, the contents of the

counter register change as follows: N,

N·1, N·2, ... , 2 , 1, 0, and on the next clock

cycle the flag is set. Consequently it ac-

tually takes N + 1 clock cycles to "timeout." This summarizes the fundamentals

of the counting/timing process.

The control register is used to select

one of several modes available to the

programmer For example, in one mode

the contents of the counter register are

decremented at the same rate as the

system clock, while in another mode

pulses on an external pin cause the

counter to decrement, and in a third

mode the counter is automatically

reloaded after each time-out. The modes

available with a 6522 will be discussed in

more detail below.

The 6522 Interval Timers

The 6522 Versatile Interface Adapter

is a complex integrated circuit that in-

cludes two eight-bit I/O ports, four pins

associated with handshaking signals for

these two I/O ports, and two interval

timers. The I/O ports and handshaking

pins will only be of incidental interest,

and we will describe the use of a few of

these features as the need arises. Our

principal interest is in the two counter/

timers that are available on the 6522,

called T1 and T2 respectively. Of course,

the various registers needed to detect

timing-out and to select the various tim-

ing modes will also be of interest.

In most 6502 microcomputer systems,

the 6522 will be interfaced to occupy 16

contiguous memory locations. The AIM

65 and SYM-1, for example, use loca-

tions with addresses $AOOOto $AOOF for

the 6522. Table I summarizes the names

of each of these 16 locations, while

Table Ii lists the functions of the

registers. Of particular interest are the

timer locations $A004 through $A009,

the interrupt flag register (IFR), and the

control register (ACR). These correspond

precisely with the registers mentioned

above in connection with Figure 1. That

is, the IFR is the flag register and the

ACR is the control register.

Both counter/timers, T1 and T2, on the

6522 are 16-bit devices; that is, a 16-bit

number is loaded into the counter

register and then decremented unti I

time-out. Because the counter registers

are 16-bit registers, two WRITE opera-

tions are needed to load the counter

since only eight bits of data can be writ-

ten at one time.

To prevent one eight-bit number (the

low-order byte) from being decremented

17:28

YE S

Figure 2. Flowchart of c ' Simple

Interval Timer De/ay loop.

MICRO -- The 6502 Journal

while the other (the high-order byte) is

still not loaded, temporary storage tet-

ches are provided. Using the T2 timer as

an example, the low-order eight bits of

the number, N, to be loaded into the

counter are loaded into the low-order

byte of the T2 latch (T2LL). Nothing hap-

pens. Next, the high-order eight bits of N

are loaded into the high-order byte of the

T2 counter. Referring to Table II, this last

operation has three important and

simultaneous consequences:

• The byte stored in the T2 latch

(T2LL) is transferred to the low-

order byte of the T2 counter

(T2CL). T2 now contains a 16-bit

number.

• The interrupt flag that signals the

time-out, bit five of the IFR, is

cleared (set ito zero). It will be set

(to one) when the number N

decrements through zero.

• The countdown begins.

The T1 timer has two latches, one to

store the low-order byte to be transfer-

red to the counter, and one to store thehigh-order byte to Ibe transferred to the

counter. One reason for this difference

is that the T1 timer has a "free-running"

mode. At the end of one time-out, the

two bytes of data stored in the latches

are automatically transferred to the

ts-btt T1 counter to start a new timing in-

terval.

Furthermore, the values in the two lat-

ches may be changed during one timing

interval to give a new value for the next

interval. The examples that follow

should make these points clear. Addi-

tional discussion of the READ opera-

tions outlined in Table II will also be

posponed until required by a specificexample.

A Simple Delay Loop Using the T2 Timer

The most common application of

counter/timers is the implementation of

delay loops. The counter/timer replaces

a series of instructions that are design-

ed to waste time. The counter/timer

simplifies greatly the instructions that

are necessary to proqrarn a time delay,

and furthermore, the computer may ex-

ecute other tasks (Juring the delay pro-

duced by the timer, a feat that is much

more difficult to perform with a software

implemented delay loop.

An assembly language version of a

simple delay loop usinq the T2 timer on

the 6522 is listed in Table III. The

mnemonics are perfectly general for

6502 systems, but the addresses of the

registers of the 652~2are the ones given

in Table II for the AIM 65 and the SYM-1.

Programmers usino other systems need

only change the addresses to corres-

pond to the locations of the 6522

registers in the address space of their

October, 1979

Page 31: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 31/68

Table I. Memory Assignment Names for the 6522 VIA.

ADDRESS SYMBOL N A M E

$AOOO OEE Port B Input/Output Registers

$A001 OP.A Port A Input/Output Registers (with handshaking)

$AOO2 DDRB Port B Data Direction Register

$AOO3 DDRA Port A Data Direction register

$A0a. TlLL Timer 1 Latch Low-order Byte (WR.ITE)

$AOa. TlCL Timer 1 Counter Lo.....order Byte (REI\D)

$A005 TILH Timer 1 Latch High-order Byte (WRITE)

$A005 TICH Timer 1 Counter High-order Byte (REI\D)

$A006 TILL Timer 1 Latch Low-order Byte (READo r WRITE)

$AOO7 T1LH Timer 1 Latch High-order Byte (REI\D or WRITE)

$AOOB T2LL Timer 2 Latch Low-order Byte (WRITE)

$AOOB T2CL Timer 2 Counter Low-order Byte (REI\D)

$A009 T2CH Timer 2 Counter High-order Byte (REI\D or WRITE)

$AOOA SR Shift Register

$AOOB ACR Auxiliary Control Register (Control Register for T=uers)

$AOCC P CR Peripheral Control Register

$A()()[) IFR Interrupt Flag Register (Status Register)

$AOOE IER Interrupt Enable Register

$AOOF ORA Port A I/O Register (without handshaking)

Table II. Memory Assignments and Fu 1ctions of Some of the

Registers of the 6522 VIA.

FUOCTION

WRITE(STATlLL): Load an eight-bit number i. J to the low-order byte of the 'I'I latch.

READ (IDA TlCL): Read the contents of the Lov=order- byte of the Tl counter, and

~ the interrupt flag, b: t six of the Iffi.

WRITE(STATlLH): Load an eight-bit nwober i. J to the high-order byte of the Tl latch,

transfer the contents of bl th Tl latches to the Tl counters, clear

the Tl interrupt flag, and ~ the counting process.

Read the contents of the h~gh-order byte of the Tl counter.

Load an eight-bit number into the low-order byte of the natch.

Read the ccntents of the low-order byte of the TI latch.

Load an eight-bit number into the high-order byte of the Tl latch

and clear the Tl interrupt flag.

Read the contents of the high-order byte of the Tl latch"

Load an eight-bit number into the low-order byte of the T2 latch.

Read the contents of the low-order byte of the T2 counter, and clear

the interrupt flag, bit five of the Iffi.

Load and eight-bit munber into the high-order byte of the T2 counter,

transfer the contents of the IOW-Order byte in the T2 latch to the

low-order byte of the T2 counter, ~ the T2 interrupt flag, and

~ the counting process.

R E A D (IDA T2CH): Read the contents of the high-order byte of the T2 count.er-,

Bits five, six, and seven control the modes of Tl and T2.

Bit six equal to one signals a time-out of the Tl counter/timer. Bit

five equal to one signals a time-out of the T2 counterv't imer',

i ADDRESS SYMBOL

$AOa..

$AOO4

TlLL

TlCL

SA005 TILH

SA005 TlCH READ (IDA UCH):

SA006 TILL WRITE(STATILL):

SA00 6 TlLL READ (IDA TlLL):

SAOO? TlLH WRITE(STATlLH):

SAOOl TlLH R E A D (IDATILH):

$AOOS T2LL WRITE(STAT2LL):

SAOOS T2CL READ (IDA T2CL):

SAOO9 T2CH WRITE(STAT2CH):

)

$A009

SAOOB

SAOOD

T2CH

ACR

Iffi

October, 1979 MICRO -- The 6502 Joumal

systems. Pay careful attention to the

comments in Table III, because they

relate each step to points in our previous

discussion. Figure 2 is a flowchart of the

delay loop, and it has a box for each of

the instructions in Table III.

In the program listilng given in Table

III, timing begins at the completion of

the STA T2CH instruction. The program

waits in the loop consistlnq of the series

of instructions LOA IFR, AND $20, SEQ

WAIT until the time-out of the T2 timer

sets bit five of the interrupt flag register.

The formula for the time T required for

the interval timer to time-out is:

T = (N + 1)Tc

where N is the 16-bit number loaded into

the counter and Tc is the clock period

(typically one microsecond).

If the branch instructions (LOA IFR,

AND $20, SEQ WAIT) are taken into ac-

count, then the total loop time, T L' is

given by the expression:

(N + 6)Tc" TL ,,; (N + 14)Tc

The uncertainty of eight cycles in theloop time arises from the uncertainty of

where the T2 counterltimer actually

times out in the series of test and branch

instructions within the loop. For the

numbers that were used in Table III,

17:29

Page 32: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 32/68

Figure 3. 60 Hz Signal Conditioner for the Low Overhead C'ock. Acircuit based on the 555 timer and using only the + 5V sUPI,ly canbe found in Berlin's 555 Timer Applications Sourcebook, pr;s.2·13.

+12V to +l5V

6 . 3 V A C

T = ($C34E + 1)T = 0.05 seconds for

a one microseconJ clock. The loop time

is between 5 and 13 microseconds

longer. For many applications, this

uncertainty will be of no consequence.

As pointed out earlier, the

microprocessor need not be idle whilethe timer is timing out. For the particulardelay of 0.05 seconds programmed in

Table III, a total of 50,000clock cycles

elapse while the timer is running. Duringthat time, between 25,000and 10,000in-

structions could be executed by the

6502. These instructions would beplaced between the STAT2CH and the

2

+5V

3

-12V to -15V

LDA IFR instructions. This is the prln-cipal advantage of the counter/timer im-

plemented delay loop; that is, tile micro-

processor can beperforming meaninqtul

tasks during the timing-out process.

Counting Pulses - A 24-HoUirClock

TheT2timer can also beusee to countpulses from an external SOUrCf!.This is

useful for frequency counting (MICRO,

June 1979, pg. 41) or any other eventcounting application such H.S radio-

active half-life measurements The T2timer is placed in its pulse counting

mode by setting bit five in the auxiliary

Table III. A Simple Delay Loop Using the T2 Timer on the 5522.

$0300 A94E

$0302 8D 08 AO

$0305 A9 C3

$0307 8D 09 AO

S03OA. ADODAO

$030D 2920

s03OF Fa F9

START LOA$4E

STA T2LL

LOA:tC3

STA T2CH

WAIT LOA IFR

AND$20

EEQWAIT

17:30

Load the byte for the T2 latch 10''', then

transfer it into T2 latch low (T2:.L).

Load the byte for the T2 counter ligh,

then transfer it into T2 counter ugh (T2CH)

Read the flag register, IFR. Mask all bits

except bit five. Check to see ifbit five

is set. No, then wait. Yes, 1001) is finish

MICRO -- The 6502 Journal

control register (ACR) to logic one, andapplying the TTL level pulses to bit six of

port B, PB6.To illustrate this mode, andto illustrate how the timers can be used

to generate interrupt requests (IRQs),we

have chosen to describe a simple

24-hour clock that requires very little

computer time overhead.

The 60Hzpower line frequency is suf-

ficiently stable over long periods for

many clocks. Somewhere in your micro-

computer system you will probably beable to locate a low-voltage 60 Hz

source. This is conditioned by the circuit

shown in Figure 3 to produce a 60 Hzsquare wave, and the output is applied

to PB6 to be counted. Clearly there are3600($OE10)such pulses in a minute.

The T2 counter/timer will be program-

med to count 3600pulses followed byan

interrupt request. The interrupt routine

increments one location in memory to

keep track of minutes, and when this

location reaches 60, another location is

incremented to keep track of the hours.

At the beginning of the interrupt routine

the T2 counterltimer is reloaded with

3600for the next period.

The program is listed in Table IV. The

first two instructions set bit five of the

ACR to logic one. Next the timer is load-

ed with $OEOF.Note that $OEOF+ 1 =

3600.The LDA $AOand STAIER instruc-tions enable interrupts from bit five of

the interrupt flag register (IFR) of the

6522 to the 6502 microprocessor's IRQ

pin, a connection that is usually internalto the microcomputer system.

To enable interrupt request signals

from T2, bit five ot the IER (interruptenable register) must beset to logic one,with bit sevenof the IERalso set to logic

one.At the end of the timing interval, not

only will bit f ive of the IFR be set to one,but also the IRQ pin on the 6502 micro-

processor will be pulled to logiC zero,producing an interrupt request.

The next instruction after enabling the

interrupt from the 1'2timer is the CLI in-

struction that allows the 6502 torecognize these interrupts. The last in-

struction in the main program should

not be taken literally. It is simply an

infnite loop that represents the user's

main program, a FORTRAN interpreterfor example.

The interrupt routine is also given inTable IV. Timekeeping routines have

been described in several other articles(MICRO, March 1979, pg. 5), so the

details will not be repeated here. Notethat in order for the program to execute,

the IRQvector must point to the startingaddress of the interrupt request routine,

in our case $0300. Note also, that the

program could be easily modified tokeep track of seconds by counting only

60 pulses, something that can be done

with an eight-bit counter like the one onthe R650/1. The hours-minutes clock re-

quires only about 50microseconds per

October, 1979

Page 33: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 33/68

minute of computing time, truly a low-overhead clock.

To display the minutes and hours, theuser must provide a display routine that

takes the contents of locations $0000

and $0001and displays these numbers.Such a routine is not included inTable IV

since the instructions used will depend

on the microcomputer system, and

previously written clock programs have

included suitable display routines.

To summarize the operation of the T2

counter/timer on the 6522 we concludethis section with the following state-

ments:

• Todecrement the 16-bit number inthe T2counter at the system clock

rate, clear bit five of tt e ACA.

• Todecrement the 16-bi: number inthe T2 counter using externalpulses applied to PBI) (pin 6 ofPort B), set bit five of 1 he ACA.

• To produce an intern pt request(IRQ) when the courter decre-

ments through zero in Itither of its

modes, set bits five ar d seven ofthe lEA.

• To disable the interru pt feature,

set bit five of the IERa id clear bitseven of the lEA.

• A system RESET di: .ables thepulse-counting mode imd the in-

terrupt request feature Jyclearing

all the registers of the 5522.

MAIN

Table IV. Low Overhead 24-hour Clock_

$0200 A9 20

$0202 8D OEAO

$0205 A9 OF

$0207 8D 08 AO$02()\ A9 OE

$020::: 8D 09 AO

$020F A9 AO

$0211 8D OE AO

$0214 58

$02154C 15 02 H E R E

LDA$20

STA ACR

LDA$OF

STA T211LDA$OE

STA T2CH

LDA$AO

STA IER

cuJMF H E R E

INTERRUPTROUTINE

$0300 A9 O E J LDA$OE

$0302 8D 09 AO STA T2CH

$0305 18 CLC

$0306 F8 SED

$0307 A5 00 L D A M IN

$0309 69 01 ADC$01

$030B 85 00 STA M IN

$03OD C9 60 CMF$60

$030F DO 13 EN E DONE

$0311 A9 00 IDA. $00

$0313 85 00 STA M IN

$0315 18 CLC

$0316 A5 01 LDA HRS

$0318 69 01 ADC$01

$031A 85 01 STA HRS

$031C C9 2.4 CMF$2.4

$031E DO 04 ENE DONE

$0320 A9 00 L D A $00

$0322 85 01 STA HRS

$0324 D8 DONE CLD

$0325 40 RTI

)

October, 1979

Put T2 in its pulse-cour ting mode

by setting bit five to logic one.

Set up T2 to count 3600 pulses.

Set up interrupt enable register

to permit mQ from T2.

Allow 6502 to accept me; signals.

Loop here between interrupts.

Start counting pulses again by

loading T2CH.

Clear-carry for addition.

Set decimal mode for addition.

Get minutes.

Add one.

Is one hour complete?

No, get out of interrupt routine.

Yes, set minutes to zero.

Get hours.

Add one.

Is one day complete?

Clear hours.

Clear decimal mode.

Return to the main progra.m.

MICRO-- The 6502 Journal

Producing L.ongTime Delays

The maximum time delay that can be

produced with the T2 counter/timerwhen it is decrementing at the system

clock rate is approximately ($FFFF +1)Tc or 0.065536 seconds if Tc = 1

microsecond. In certain applications

longer time delays are necessary.Toob-tain these delays, the T1timer is used in

conjunction with the T2 counter/timer.

We digress for a moment to introduce

the T1 timer.

The T1 timer can be used to imple-

ment a simple delay loop in exactly the

sameway as the T2timer. Refer to TableIII. If the addresses $A004 and $A005

replace addresses $AOOaand $A009,

respectively, and if bit six of the inter-rupt flag register (IFR) is tested rather

than bit five, then the program in Table

III will work in exactly the same way ex-

cept that the T1 timer is being used.

The sameequation gives the loop time

and, as in the case of the T2 timer, the

maximum delay is about 0.065seconds.The T1 timer cannot, however, count

pulses. Consequently it cannot replacethe T2 timer in the program listed in

Table IV. In place of the pulse countingmode, the T1 timer has a free-running

mode, and it is capable of toggling thelogic leve.1on pin seven of Port B, PB7.

The inltiauzatlon of the free-runningmode with PB7 tClggling is illustrated in

a simple program shown in Table V.This

program will produce a square waveout-put on PB7. The period of the square

wave is given by the equation:

Tp = 2(N + 2)Tc

where Tp is the period of the square

wave, N IS the 16-bit number loaded into

the T1 timer, and Tc is the period of thesystem clock (Typically one micro-second). The frequency of the square

wave is f = 1 1 T p :

To initialize this mode, bits seven andsix of the auxiliary control register (ACR)must be set. Thus, the program in Table

V begins by loading $COinto the ACA.Timing is initiated by loading the high-

order byte of N into location $A005

which corresponds to T1LH. Once

started, the square wavewill run forever,no matter what else is happening in theprogram, provided the registers that

control the behavior of the T1 timer arenot changed. That is, after the timer"times out", it willi automatically reload

the two counter registers from the

numbers stored in its latches, T1 LL andT1LH.

The last instruction inTableV is an in-

finite loop that simulates the user's pro-

gram intended to run concurrently withgeneration of the square wave. Table VI

lists somevalues IlorN that are frequent-

ly used in timing applications. If youhave an oscilloscope, run the program

with various values of N and connect the

(Continued on page 34)

17:31

Page 34: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 34/68

ATARI® 4O0™

PERSONAL COMPUTERSYSTEM

PRICEINCLUDES:computer ConsoleBASICLanguage CartridgeBASICLanguage PrOgrammingManual (Wiley)400 operator's Manual withNote Bookpower SupplyTVSwitch Box

ATARI® 800™

PERSONAL COMPUTER SYSTEM

PRICEINCLUDES:

Computer ConsoleBASICLanguage CartridgeEducation System Master CartridgeBASICLanguage ProgrammingManual (Wiley)800 operator's Manual wi th Note BookATARI410 Program RecorderGuide to BASICPrOgramming Cassette8KRAMModule·power Supply.TVSwitch Box

$99999

WE PROM IS E TO I'E LIVE R!!!• We GUARANTEEship dates on prepaid computer svsten orders. Send your orders In now!!!• If for reasons beyond our control we miss a Ship date, ' ve will REFUNDhe shipping and

handling charges and give you a 10% DISCOUNTon any Future software purchases for yourATARI®System. *

• For prepaid system orders, get a FREEAccessory contrc lIer of your choice.

'Order must be prepaid by Cashier's Check made out to Computer como ments of Orange County.

ATARI USER'S GROUP INFORMATION. . CALL (714) 891-2584

PERIPHERALS AND ACC :SSORIESATARI® 810™DISC DRIVE*DISKETTES

C X 81 00 B LA N K D IS KE T T ES 'C X 81 01 D IS K F IL E MAN AGER'

55,OO/ea,

$749.99

ATARI® 820™PRINTER* $519.99

ACCESSORY CONTROLLERS

CX2C -0 1 DR IV I NG CONTROLLERPAI RC X 30 -0 4 P A DD LE CONTROl LE R P A IRCX40- 04 JOYST I CK CONTROLLERPAI R

519,95/ea_

SOFTWAREGAMES, . , , , , , , _ , . $49.9! lea.

CXL40 0 4 BASKETBALLCXL4005 LIFE .CX L 40 0 6 SUPERBREAKOUTTMC X 40 08 S U PER BUG TM ' ,

$39.99/ea.

CX6009 GREATCLASS ICSIENGLlSH )CX601 0 BUSI NESSCOMM UN ICAT IONSCX601 1 BASI C PSYCHOLOGYCX601 2 EFFECT IVEWR I T I NGC X 60 13 A U TO MECHAN IC SCX601 4 PR I NC I P LES OF ECONOM ICSCX601 5 SPELL INGCX601 6 BASI C ELECTR IC ITYC X 60 17 B AS IC A LG E BR A

ATARI® 410™PROGRAM RECORDER $S9.99ADD-ON MEMORY (SOOONLYI

C X852 8K RA M M EM ORY M OD ULE $124.99C X85 31 6K R AM M EM OR Y M O DU LE 5 24 9.99

II )1 ]1

(PI

. . « n

APPLICATION , . $69.99

C X L4 00 2 A T AR I B A S ICCXL40 0 3 ASSEMBLERDEBUG "C X L4 00 7 MU S IC COMPOSERCXL40 0 9 COMPUTERCHESS ' ,

6791 Westminster Ave., Westminster, CA9268 714-891-2584 Telex 182274Hours: ru e s - s r t 11:00 AM to 8:00 PM-Sat 10:00 AM to 6:00 M-Sun 12:00 to 4:00 PM (ClosedMonl

Master cnarqe, Visa, B of A are accepted. Allow 2 w ks for personal check to clear.Add $2.00 for handling and nostaqe. For computer svst ms please add $10.00 for shipping,

handling and insurance. California reside ts add 6% SalesTax.• MAILORDERLINE(714)891-2587or, ELEX182274.

ROM CARTRIDGES

C X L4 00 1 E DUCAT IO N S Y ST EM MAS TERCARTR IOGE .... .. ..... $34.99KEY: (j) = u ses J o ys ti Ck c o n trO ll er

Ipl = u se s p ad dl e c on tr ol le r(d l = u se s d riv in g c on tr ol le r

EDUCATION SYSTEM CASSETTE PROCRAMS

C X 60 01 U .S . H IS TOR YC X 60 02 U .S . G O V ERNMEN TCX600 3 SUPERV I SORYSK I L LSC X 60 04 WORLD H IS TOR Y (W EST ERN ICX 600 5 BASI C SOC IO LOGYCX600 6 COUNSELI NG PROCEDURESCX600 7 PR I NC IP LESOF ACCOUNT INGC X 60 08 P H YS IC S

1 ]1

BASIC GAME ANDPROGRAM CASSETTES

C X 41 01 G U ID E TO B A SI C P ROGRAMM ING 'C X 41 02 B AS IC G AME PROGRAMS '

529.95/ea.

'O c tober Delivery , 'Novem ber Delivery

-Prices subject to change.-

COMPUTER COMPONENTS 0 ORANGE COUNTY

V AN N UYS

(213) 786-7411BURBANK

(213) 848·5521LAWNDALE

(213) 370-4842O RA NG E COUNT Y(714) 891- 2584

IRV INE(714) 891-2589

Page 35: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 35/68

In Southern California we're Number One!!COMPUTERCOMPONENTS (CCI)OF ORANGECOUNTY r your full

support computer store presents the finest in personal computers

AN INDUST RY ST ANDARD

Send for our 36 page fUlly illustrated catalog $300• Save 50( by sending the top one inch of this ad with your order •

ppkz®compu t cz r

INTE RFAC E : AIDSPrototYpin{11 Hobby cardParal le l P rl n ter Inter face CardCommunications card & OB15Connector Gable

High-Speed seria l Interface cardl~.r3~~X~'g~~,~~Wufr~citApp lesO ft I I f irmware Card16tnput An, ll og Card

$ 24 _0 0180.00

225.00195_00

495.00

200.00

295.00

PRINTER SPECIALS FOR APPLE AND PET

TRENDCOM100 w ith Inter face forAnn re o r PETL ITEPENused w lt tl TVo r mon itorscreenALF Music Synthesizer Boardssccertane-Anadex OP-8000 w ith r racrerS'· paper width and Interface

tDAPPleCe nt ro ni cs 779 -2 t or ADpi e I Iwith uarauetintertace

65.00

SOFTWARE (Send 'For complete SoftwareCatalog $1.001

Dow Jones Portfolio Evaluator!Stock eucre eeccrte- DiskMlcrochess 2_0 Chess DiskDiskUtil ity Pack wrtn DOS3,2The controller (General BusinessSystem) 625.00Apple post (Mallln~1 List System) 49.95Bowling Program Diskette 15.00The Cashier IRetall Store Management 250.00cneceocce Cassette 20.00Applesoft II language & DemoCassetteRAMTest Tape with ManualFinance '-2 cassette Packageuatamcvervtereoonq cassette«om. Card & Modem ReQ·O)

Mlcrochess 2.0ChE'SSTapeBowling Program TapePascal with Language System148K RAM & Disk II ReQuired)

450,00

34.95

265_00279.00

SPECIAL13" Color TVcompatible

with Apple IIonly 9900

with systempurchase

ACCE5SQRIE~;DISk1I-0rlvf~OnIVDisk 1I-0rl"\jl! & Controller 132KMin.RAMRecor~mendedJ 595.00Vinyl carryil1g Case 30.00

Tape Recorcter 40.00ProgrammEr'S Aid No.1 Firmware (Foruse with mteaer BASIC) 50.00Ciock/Calerl1arCard 199_00Auto-Stan RO M Package (For

Apple IIOnlylDig/kltlzer F'OIdlV taros(Kltforml .High e e senmcn l ight pen.Mlcromode·,' IO.C.HaveS)

12'· BtW lef:'IJeXMonitorCatlle from 1o10nltorto Apple II13··Color TIl Compatible with

Apple IISup-R_-Modurater (RF)

495.00

499.00199.00379.00149.009.95

290.0025.00

SOFTWARE lOR APPLIn

PASCALtror- Programma 49.95FORTH 49.95liSP-from ,lpple Software Bk No. 3 NtClISA-lnter;;;I!:tlve disk assembler 34.95

WHATSIT-E~ce"ent conversational database manager 32K 100.00 48K 125.00

S~~~N~i:ra~rrr 2nd west Coast 19_95APPlE PIE-:xcellent text editor 24.95FORTE-MusiC editor In hires 19.95FASTGAMM(JN-Excellent baCkgammongame wltn g raphiCS Tape 20.00 Disle25.00APPLE 21-£ xcenene tllackJack game 9.95BRIDGECHA(_LENCER-Computer bndge 14.95

FINANCIAL MANAGEMENTSYSTEM• Accounts Payable • ledger Processing• Accounts ReCeivable • Payroll

: ~n2~~n~~~~~~~~~e :~~~g~~f~~~~

MISCELLANEOUS

Vinyl Diskette a c re e r PagesIPkgof101 8.50

Diskette Boxes ISA Plastic) 4,SODiskettes (5··)

Apple IBox of 10) 50,00Verbatim IBox of 101 34.00nvsan (Box of 5) 25.00Decals (Rainbow Apple!Inside Window 12·) 10COutsldeWlndowI2··, 10COutsldeWlndowI1") 5CApplE lOgo (Rainbow) r-snrrts 6.00Specl fv-Men. women. or Chi ld (smal l,

medium, or larg~!)

1050.00

1245,00

50.0025.0025.00

20.007.5025.00

7,5020001500

495.00

Apple II orApple II Pluswith 16K51195

APPLEII will change the way you think about computers.

That's because it isspecifically designed to handle theday to day tasksof education, financial planning,building security, scientific calculation, andentertainment. APPLEII isappealing and comfortable(like other appliances that make your life easier);and itbrings to personal computing a new level of simplicitythrough hardware and software sophistication.

Reference Books for Apple and PET Owners· .. $12.00· 12.00· 9.95. ... "l2.95· . ... 9.95

Programming Manual (MOSTEK)Hardware Manual (MOSTEK)....programming the 6502 (ZAKSI.6502 Application Book (ZAKS) .Programming aMicro computer: 6502 (FUSTER)

PET owners OnlyPETuser Manual .Handson BASICwith a PET. .PETMachine Language Culde .

· $9.95· 14.95· 9.95

Apple Owners OnlyApple II RE!ferenceManualApple soft Manual .Programmer's Culde (Computer Station) .APPle IIM'Dnltor peeled .....SOftware Directory for Apple• Business,Finance & utility• Carnes,Demo, Uti li ty ... .Best of Contact 78 . . . . . . . . . .. .programming In PASCALCrogonol .

.. $10.00.10.00

. ... 5.959.95

4.954.95.. 2.509.90

)

A PROFESS IONA L BUS IN ES S SYST EM

~c~rnrnodDre CBM™341K

DUALDRIVE"

2001-16B$995

CBM2040$1295

CMB2022$995

Also2001-8 ..2001·16N

2001·32N2oo1-32B

AlsoExternalca sse tte . . . . . . $9 5

PETto IEEEcable $39.95

AlsoCBM2023Printer $849

IEEEto IEEEcable $49.95

.. $795

.. $995

.$1295.$1295.. . - . - .... - .. II :

ACCESSORIES FOR PETCommodore PETservice Kit .Beeper·- Tells when tape IsLoadedpetunl;I-Play music with PET . . . . .. .Video Buffer-Attach another display.Combo·-petunla and Video Buffer

.$30.00.. . 24.9529.9529.9549.95

SOFTWARE FOR PETMirrors andLenses. 19.95 Checkersand Baccarat .... 7.95The States . 14.95 Chess 19.95RealEstate 1 & 2 59.95 series and parallelMomentum and Energy .. 19.95 Circuit Analysis ... 19.95projectile Motion 19.95 Home Accounting .. 9.95Mortga!~e. . .14.95 BASICMath 29.95DOwJones 7.95 Came Playing with BASICpetunia Player SftWr .. .14.95 Vol.I, II, III .9.95 each

I'lus many more. send for SoftWare catalog $1.00.-prices subject to change-

COMPUTER COMPONENTS OF ORANGE COUNTY

6791 Westminster Ave., westminster, CA92683 714-891-2584 Telex 182274Hours: Tues-Fri -'1:00 AM to 8:00 PM-Sat 10:00 AM to 6:00 PM-sun 12:00 to 4:00 PM (Closed Man)

Master Charge, Visa, B of A are accepted. Allow 2 weeks for personal check to clear.Add $2.00 for handling and postage. For computer systems please add $10.00 for shjpping,

handling and insurance. California residents add 6% Sales Tax.

Page 36: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 36/68

input of the oscilloscope to PB7 tomonitor the square wave. You can usethe program to calibrate youroscilloscope sweep time. If you have a

frequency counter, measure the frequen-cy of the square wave at PB7 to verifythe equation, using the values for Ngiven in Table VI. N is the number to be

loaded into T1.

Note that the frequency of the squarewave produced at PB7 by the program

listed in Table V is as precise as thecrystal oscillator frequency used for thesystem clock. This is because thesquare wave frequency is independent

of any instruction length. The principaladvantage of the free-running mode ofthe T1timer is that the time between in-terrupt flag settings (or the frequency ofthe square wave on PB7)is independent

of any instruction len.gth.Thus, one canconstruct very precise time-keeping

routines (MICRO, March 1979, pg. 5) ortime measuring routines.

To produce simple delay loops forlong time intervals, the pulses from PB7

are fed to PB6. Timer T1 operates in itsfree-running mode, and timer T2operates in its pulse counting mode.Consequently, T2counts the pulses pro-

duced by T1 on PB7. A program to pro-duce a delay of one hour is given in

Table V!I. This program may be easilymodified to produce delays of 1, 10,60,

100, 1000, 10000, 36000, or 65536

seconds.

Timer T1 produces a square wavewhose period is 0.1 second. Thesepulses are counted by the T2 counterltimer. If nine is loaded into T2, then 10pulses, each of 0.1second duration, willbe counted, giving a delay of one se-cond. Other time intervals are program-med accordingly. Of course, there is an

uncertainty of several microseconds inthe actual loop time, but this uncertaintywill be unimportant for most applica-

tions.

If the program in Table V II is modifiedto allow T2to produce interrupt requests(lAOs) by loading $AOinto the interruptenable register (lEA) at location $AOOE(refer to Table I V ) , then it could be usedin connection with the interrupt routine

given in Table IV to produce a 24-hourclock program. To generate an interruptevery minute, as required by the low-overhead clock, T1should count to 600.LoadT1with $0257instead of $C39Fasshown inTable V II and your clock should

run. These modifications are shown inthe AIM 65 disassembly format.

Sound Effects

The T1 timer can be used in its free-running mode to toggle PB7, and PB7can be used to drive an amplifier. If the

frequency is in the audible range,then atone will beheard. A series of tones maymake up a song. Table V I I I lists the fre-quencies necessary to produce three oc-

17:34

~T _ J

10,---GY

T I M I N G I I

P U L S E I>~I N PUT

__UIL ~[00>

Figure 6.Circuit to measure the time duration, T,of a positive pulse.

The CB1 pin must be pmgrammed to produce an interrupt on thenegative transition of tne pulse by loading PCR4 with a zero.

Change the byte at $021 i' from $10 to $00 in the listing in Table X toaccomplish this.

S0200 A9 co START LD A se c Set bits seven and six of the ACR,

$0202 8D OBAO STA,.CR putting the T1 timer in its free-running

S0205 A9 4D LOA::4D mode with a square wave output on PB7.

S0207 8D 06 AO STA "lLL Let N = SOO4D. Tp = 2($50) microseconds

$0201\ A9 00 LDA :00 ~ 160 microseconds.

S020C 8D 05 AO STA "lLH Start timer.

$020F 4C OF 02 LOOP JMP lOOP Dummy loop simulates rellainder of a program.

Table V. Program to Produce a Square Wave Output on PB7.

F R E Q U E N C Y PIRIOD N + 2 N---f T Decimal Hex Hex

p

10 Hz (l.10 sec 50000 $C350 $:::34D

100 Hz (1.01 sec 5000 = $1388 $1386

1000 Hz 1.00 ms 500 $01Fh $01F2

10 kHz (1.10 m s 50 = $0032 $0030

100 kHz (1.01 ms5 =

$0005 $0003

250 kHz z . o o us 2 = $0002 $0000

Table VI. Table for Producing Various Square Wave Frequencies.

$0200 A9 EO

$0202 8D ClB AO

$0205 A9 4 D

$0207 8D 06 AO

$02OA.A9 C3

$02CC 8D 05 AO

$02OF A9 9F

$0211 8D 08 AO

$0214 A9 8C

$0216 8D 09 AO

$0219 A9 20

$021B 2C O D AO

$021E FOFB

$0220 00

START LJlA$EO

S~'AACR

L J I A $40

S~'AT111

LJlA$C3

S~:AT1LH

IJIA $9F

S~'AT211

I J IA$8C

S1:AT2CH

IJ~ $20

BJ'l ' IFR

Start counting. Cl,ear 1FR.

Check interrupt flag register to see if

bit five has been set, indicating that

T2 has count.ed 36000 pulses.

Load ACRto put Tl infree-running mode

and T2 in pulse counting mode.

Initialize T1 timer to run with a period

of 2(SC34D + 2) = 100000 microseconds

= 0.1 second.

Start timer toggling PB7.

Set up T2 to countS8C9F + 1 = 36000

counts. (36000)(0.lsec) = 1 hour.

TEST

m :Q TEST

B E K Break to the monitor at the end of an hour

Table VII. Program to Produce a One-Hour Delay.

MICRO-- The 6502Jour 181 October, 1979

Page 37: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 37/68

taves of notes on the equally temperedscale (note middle A corresponds to 440Hz and successive note frequencies arerelated by a factor equal to the 12th rootof two). Also listed in Table VIII are thehalf periods in microseconds; that is, thenumbers that must be loaded into the T1timer to produce the notes. Since theperiod of the square wave is (N + 2)Tc -each of the numbers in the last columnof Table VIII should be decremented by

two.

A program to play songs using thenotes in Table VIII is listed in Table IX.The identification numbers (I.D. num-bers) of the notes in the song to beplayed are stored in a song table star-ting at $0400. Actually, the song couldbe stored anywhere in memory that isconvenient, simply bychanging the baseaddress of the song table. The base ad-dress of the song table is storeel in $0050and $0051, called SONGand SONG + 1,

respectively.

)

Table VIII. Note Table for Producing Tones on the Equally Tempered

Scale.

LD. NUMBER NOTE FREQUENCY PERIOD/2

He x Hertz Microseconds

$00 C 130.813 $OEEE0

$01 Co# 138.591 $0E18

$02 D 146.832 $OD4D0

$03 D l 155.563 $a:8E

$04 E 164.814 $OBDA0

$O~, F 174.614 $OB2F0

$06 F# 184.997 $Q\8F0

$07 G 195.998 $09F70

$08 G# 207.652 $09680

$09 A 220.000 $0BE10

$Q\ A l 233.082 $0861

SOB B 246.945 $07E90

$CC (middle) C1 261.626 $0777

$OD C l 277.183 $07a:

$OE D1 293.665 S())A7

$OF D l 311.127 $())47

$10 E 329.628 $05ED1$11 F1 349.228 $0598

$12 F_# 369.995 $0548.1 .

$13 G1 391. 995 $04FC

$14 G l 415.304 $04B4

$15 A1 440.000 $0470

$16 A l 466.164 $0431

$17 B1 493.883 $03F4

$18 C2 523.251 $03a ::

$19 C~ 554.365 $0386

$1A D2 587.330 $0353

$lB D2# 622.254 $0323

s a c E2 659.255 $02F6$lD F2 698.456 $02CC

$lE F~ 739.989 $02A.4

$lF G;.2 783.991 $027E

$20 G~ 830.609 $025A

$21 A2 880.000 $0238

$22 A~ 932.328 $0218

$23 B2 987.767 $OlFA

October, 1979 MICRO -- The 6502 Journal

The identification numbers ($00- $23)found in the song table are used to indexa note table found in page zero, from$0000 to $0047. The 110tetable containsthe half-periods 01' the frequenciesfound in the fourth column of Table VIII ,corrected for the fact that the half-period is (N + 2)Tc rather than (N)T .The low-order bytes of the half-periocfsare found from $0000 to $0023 in thenote table, while the high-order bytes are

found from $0024 to $0047.

The program first locates an iden-tification number for a note from thesong table. It then loads the latches onthe T1 timer with the correct half period,and the note begins to play. The dura-tion of the note is determined by anumber found in the duration table, call-ed OUR , and located from $0800 upward.There must be one duration number foreach note. The duration of a note isbasically the number of times the T2timer is allowed to time out. If $01represents a sixteenth note, then $02 isan eighth note, $04 is a quarter note, $08a half note, and $10 a whole note. The

tempo may be changed by changing thebytes loaded into the T2 timer at loca-t ions $021E through $0227 in the pro-gram listed in Table IX.

The song table givl3nin Table IX simp-ly plays the three octave scale fromTable VIII with a variety of durations asindicated by the duration table. You areinvited to make your own song ortranslate someone else's song into 1.0.numbers. Better yet, write a song inter-preter that does the translat ion for you.

Your interpreter should take akeyboard entry for a note and place theI.D. number into the song table. It shouldtake another keyboard entry for the timevalue of the note and place i t in the dura-tion table. With several 6522s, you couldplay four-part harmony! With a DIA con-verter and a voltage controlled amplifieryou could also control the noteenvelopes, giving an elementary syn-thesizer.

For my interface circuit, I used the7404 inverter connected to PB7.The out-put from the 7404 was connected to onelead of a 1'12inch speaker and the otherlead was connected to + 5 volts. Betterinterfacing circuits to drive speakershave appeared in various articles andbooks (see Caxton Foster's Programm-

ing a Microcomputer).

Measuring the Time Between Events

A number of applications require thatthe time between two successive eventsbe measured. The events might be thestart and finish of a race, the arrival ofcosmic rays, two heartbeats of ananimal, and many others. If the eventsare periodic, then the time betweenevents can be obtained by first rneasur-ing the frequency of the events with a

17:35

Page 38: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 38/68

START

Table IX. Program to Playa Song.

$0050 = S ON :;, [S ON :; J = $00

$0051 = SON: ; + 1, [SON: ; + 1J - $04

$0052 = OOR, [DURJ • $00

$0053 = OOR+ 1, [OUR+ 1J = $08

$0000 • NOTE(See Note Table)

$0200 A9 CO

$0202 8D OBAO

$0205 AO 00

$ 0 2 r : t 7 B1 50 IDRE

$0209 A A

$020\. B5 00

$020:: 8D 06 AO

$020F S A

$0210 18

$0211 69 24

$0213 A A

$0214 B5 00

$0216 8D 05 AO

$0219 B1 52

$021B FO24

$021D A A

$021E A9 FF

$ 0 2 2 0 80 08 AO

$0223 A9 FF

$0225 8D 09 AO

$0228 A9 20

$022A 2C aD A 0 BACK

NOTETABLE

$0000 EC 16 1 .£ OC 08 2D SO F5

$0008 66 OF 5F E7 75 0\. A5 45

$0010 EB 9 6 46 FA B2 6E 2F F2

$0018 B A 84 51 21 F4 CAA2 7C

$0020 58 36 16 F8 O E O E aD 0::

$0028 OBOBe l l . 09 0 9 08 08 ot

$ 0 0 3 0 r : t7 r : t 7 c6 06 05 05 05 04

$0038 04 04 04 03 03 03 03 03

$0040 02 02 02 02 02 02 02 01

A G N

DURATIONA B L E

$0800 01 02 0 4 08 1020 10 08

$0008 04 02 01 02 04 00 10 20

$0810 10 08 C i4 02 01 02 04 08

$0018 10 20 40 80 40 20 10 08

$0820 04 02 01 01 00

$0220 FO FE

$022F C A

$0230 DOE C

$0232 E 6 50

$0234 DO02

$0236 E 6 51

$0238 E6 52

$023A DO02

$023C E6 53

$023E 4 C r : t 7 02

$0241 A9 00

$0243 8D OBAO

$0246 00

T H E R E

O I I T

PAST

SONG TABLE(Plays scale)

$0400 00 01 02 03 04 05 06 r : t 7

$0408 08 09 0\. D B e x ; aD O E O F

$0410 1011 12 13 1415 16 17

$0418 18 19 LA 1B lC 10 1E 1F

$0420 20 21 22 23

INPU' I '

TIMIt l . : ; :

!\JIBES

+5 V

crn IQ

5

CK3

7 4 7 4

L O A ! i C O

STAiLCR

LOY:;oo

Initialize ACRto put T1 in free-running

mode.

Indirect indexed mode with index = o .

L O A :SOIii),Y Get note I.D. from song table.

TA X

L O A !lOTE,!

STAULL

TX A

CLC

A O C l:24

TA X

L O A NOTE,!

STA nL H

LIlA (OUR),Y

BEQ CU T

TA X

LI lA $FF

STA12LL

LIlA $FF

STA'I2CH

LOA $20

BIT IFR

B E l ' ; l EIlCK

DEl(

ENE A}N

INC SJIii

Use it as an index to look up note

in the note table.

Put low-order byte into TlLL

Transfer X back to A to find high-order

byte, which is $24 locat:Lons higher

in page zero.

Back into! to become index to fetch

high-order byte of half-l:leriod.

Result into T1 timer Iat ch high. Note

begins to play. Get dura't i.cn,

If duration is zero, end of song.

Duration into X to serve as count.e r ,

Set up T2 for a time per:Lod that determines

the tempo.

Start the T2 timer.

Test to see if T2 has tiDled-out.

Is bit five of the IT R set.?

No, wait for it and play note.

Decrement duration ccunt.er unt.Ll.

it is zero, then note is finished.

Get another note from the song table.

EN E P~ST If song is zero, then get the next note from

INC SJIii + 1 next page of song table.

Get another duration fronl the table.NC DJR

E NE T 'I ER E

INC D',JR + 1

JM P M lRE Play this note.

LOA$,)0 Clear the ACRto finish playing notes.

STAAGR

BRK Jump to the monitor when finished.

PB:~~--------------------~

~~ -ILnJL_~ ~

}-)------GY

Figure 4. Circuit to measure the time interval,

T, between two successive pulses.

Page 39: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 39/68

Table X . Program to Measure the Time Between Two Pulse»:

\j

$C200 A9 00 START

$0202 85 01

$02C4 85 C2

$C2C6 85 03

$0208 A9 01

$02CA 8D 02 AO

$C2CD8D 00 AO

$0210 CE 00 AO

$0213 EE 00 AO

$C216 A9 10

$C218 8D c : c AO

$C21BA9 EO

$021D 8D 00 AO

$0220 A9 86

$C222 8D C6 AO

$0225 A9 13

$0227 8D 05 AO

$022A A 9 IT NEXT

$C22C 8D 08 AO

$022F 8D 09 AO

$0232 AD 00 AO

$0235 AD00 AO TEST

$C238 29 10

$023A Fo F9

s C23C20 00 03

$023F CE 00 AO

$0242 EE 00 AO

$0245 4C 2A 02

SUBROUTINENVD

$0300 38

$0301 A9 IT

$0303 E D 09 AO

$0305 85 11

$0308 A9 IT

s O 3O A . E D 08 AO

$0300 85 10

$030F F8

$0310 AO10

$0312 C6 10

$0314 26 11

$0316 A2 FD

$0318 B5 C4

$031A 75 C4

$031C 95 C4

$031E E8

$031F DOF7

$0321 88

$0322 DOEE

$0324 20 40 03

$0327 A9 00

$0329 85 01

$032B 85 02

$032D 85 03

$032F 60

CNVD

lURE

AGIN

October, 1979

WA $00

STALEAST

STAMIDST

STAlUST

WA $01

STADDRB

STAPED

DEl::PED

INCPED

WA $10

STAPCR

WA $EO

STAACR

WA $86

STAT1LL

LDA$13

STATlLH

LDA$IT

STAT2LL

STAT2CH

L D A PED

LDAIFR

A N D $10

BE Q TEST

JSR CNVD

DEl::PED

INCPED

JM P NEXT

SEC

LDA$IT

SBCT2CH

STA,CNTHI

L D A $IT

SBCT2CL

STA CNTW

S E D

LDY$10

ASL CNTW

ROLCNTHI

LDX $FD

L D A DAT,X

ADCDAT,X

STADAT,X

INX

BNE AGIN

D E Y

EN E IDRE

JSR AIMDSP

LDA$00

STALEAST

STAMIDST

STAIDST

RT S

Slear display registers.

Least-s i.gni.ficant byte of time.

Middle byte.

Most-significant byte of time.

Initialize PB¢ to be an output piI .•

Initialize PB¢ to logic one, then toggle

it to preset the 7474 flip-flop.

Set bit four of the peripheral control

register (peR) to set interrupt flag on

a positive transition on pin CBl.

T1 in free-running mode, T2 counts pulses.

Set period of square wave on PB7 so that

Tp = 0.01 second.

$1386 + 2 = 5000, SO f = 100 Hz, lp ~ O.01s.

Start square wave running.

Set up pulse counter T2 to start at $FFFF.

Start counting pulses when the event pulse

clocks the 7474 flip-flop. Clear IFR4 flag.

Read the interrupt flag register. M3.sk

all except IFR4. Wait until flag is set,

then timing is finished, SO convert the

answer to decimal and display it.

Preset the flip-flop by toggling PB¢.

Measure another interval.

Set carry for subtractions that fc,llow.

Find ($FFFF - N2) = number of pulses counted.

Higil-oroer byte stored in CNTHr.

Nowget the low-order byte of the count.

Low-order byte stored in CNTLO .

Conversion of hex to decimal starts here.

Y contains number of bits to convert.

Shift one bit at a time into the carry flag.

x will serve as a counter for a tI'iple-

precision addition, with LE.\ST, MIDST,

and IDST holding the answer.

Increment X to zero, then three b,tes

have been added.

Decrement Y until all the bits have been used.

WhenY • 0, conversion is complete.

Jump to AIM65 Display Routine.

Nowclear the counter loeations tc get

the time for the next two pulses.

Return to the timing program.

MICRO -- The 6502 Journal

frequency counter and then applying the

relation T = 1/f,where T is the time bet-

ween successive events and f is the fre-

quency of the evenIts.For low frequency

periodic events, SUGhas a race, the only

choice is to measure the time interval

directly.

We will assume that the events pro-

duce positive pulses, and we will not try

to describe how the positive pulses can

be produced. Rather, our problem will berestricted to measuring the time bet-

ween two successive positive pulses. A

circuit and a program to accomplish thisare shown in Figure 4 and Table X,

respectively.

The circuit was inspired by Carlin's

and Howard's article on the Intel 8253inComputer Design, May 1979, pg. 213.

The positive pulses clock a 7474 flip-

flop, produclnq a logic-one voltage at

the Q output of the 7474for the time in-

terval between the leading edges of the

two pulses. With the T1timer producingsquare waves on PB7, the logic-one

voltage on the Q output gates th e pulses

to PB6 (by means of the 7400 NANDgate), where they are counted by the T2counter/timer. For example, if a square

wave whose frequency is 10Hz (T = 0.1

second) is applied to the 7400 NAND

gate, and 250 such pulses are countedon PB6,then the corresponding time in-

terval is (250)(0.1)= = 25.0seconds, with a

resolution of 0.1second.

Clearly, no software is required to

detect the pulses, and consequently

very narrow pulses can be detected.Also, the programmer has control over

the frequency of tlhe square wave ap-plied to the NAND gate. The resolution

can be changed from 4.0 microseconds

to 0.10 microseconds by varying thenumber loaded into T1.

Refer again to Table VI for a choice of

frequencies for the free-running modeofthe T1 t imer that might be appropriate

for a given application. Since the T2

timer is capable of counting to 65536,

the maximum t ime interval that can be

measured with a square wave whose

period is Tpis:

Tmax = = 65536(Tp)

= 65536(:~)(N+ 2)Tc

where Tmax is the rnaximum time inter-val that can be measured, Tp is the

period of the square wave (TD = 1/f) onPB7,N is the number loaded ihto T1, and

Tc is the system clock period.

Refer again to Fiqure 4.When the se-

cond pulse occurs, the Q output of the

7474flip-flop makes a transition to logiCone. This also signals the conclusion of

the timing interval. If Q is connected toCB1, th e 6522can be programmed to seta flag in the IFRwhen the logic-zero-to-

logic-one transition on CB1 occurs. At

this time the T2 counter/timer can beread, the result converted to decimal,

17:37

Page 40: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 40/68

APPENDIX A. LOW-OVERHEAD CLOCK MODIFICATION

SUBRDUTINE AIMDSP

$0340 A5 LDA 01

$0342 85 STA 04$0344 A5 LDA 02

$0346 85 STA 05

$0348 A 5 LDA 03

$034A 85 STA c6$034C A2 LDX #13

$034E S A T X A

$034F 48 PHA$0350 AO LDY #04$0352 A5 LDA 04$0354 29 AND #OF'

$0356 18 CLC

$0357 69 ADC #30

$0359 09 ORA#80

$035B 20 JSR E F 7 B$03% 46 LSR c6$0360 66 ROR 05

$0362 66 IDR 04

$0364 88 DEY

$0365 DO ENE 03%$0367 68 PIA

$0368 AA TAX

$0369 C A DEI$036A EO CP X #OE

$036C BO BCS 034E

$036E 60 RTS

and the answer can bedisplayed or logg-

ed for the next set of pulses. All of this is

accomplished with the routines given in

Table X,a program that was designed to

operate inconjunction with the circuit ofFigure 4.An explanation of this program

follows.

The largest number of pulses fromPB7 that can be counted on pin PB6 by

the T2 counter/timer is $FFFF + 1 or

65536.Each memory location is capableof storing two BCD digits, thus three

memory locations are required to store a

number as large as 65536. These three

memory locations haveaddresses $0001

through $0003 in the program shown in

Table X, and they are used to store the

decimal equivalent of the count made bythe T2 counter/timer. The initializationsteps, display registers cleared, flip-flop

preset, timers loaded, control registers

set, etc., require the first $34bytes in the

program. After that, the interrupt flag

register (lFR) is watched to see when a

positive transition on CB1occurs. Whenit does, a jump to the conversion

subroutine, CNVD, occurs.

The function of the conversion

subroutine is to convert the contents of

the T2 counter/timer registers to an ac-

tual count in decimal. This count

represents the number of periods of the

square wave on PB7that haveoccurredbetween the events being timed. Theprogram in Table X uses a square wave

whose period is 0.01 seconds, thus the

17:38

0200 78 SEI

0201 A9 LD A #AO

0203 8D STA AOOE

02c6 A9 LD A #E O

0208 8D STA AOOB

O2OBA9 LDA #4D

O2OD 8D STA A~

0210 A9 LDA #C3

0212 8D STA AOO5

0215 A9 LD A #57

0217 8D STA A O O S

O21A A9 LDA #02

021C 8D STA AOO9

021F 58 CU

0220 4C JM P 0220

Th'TERRUPT

ROUTINE 0300 A9 LIlA #02

0302 8D STA A009

0305 18 C:U:::

03c6 F8 SED

0307 A5 LDA 00

0309 69 ADC #01

0300 85 STA 00

0300 C9 CMF'#60

030F' DO ENE 0:;:24

0311 A 9 LDA #00

0313 85 STA 0(1

0315 18 C:U:::

0316 A5 LD A 01

0318 69 ADC #01

O31A 85 STA 01

031C C9 CMF'#24

031E DO ENE 0324

0320 A9 LD A #CO

0322 85 STA 01

0324 D8 CLD

0325 40 RTI

MICRO -- The 6502 Journal

number of counts in T2 represents the

number of hundredths of seconds that

occurred between the two positivepulses on the clock input of the 7474flip-

flop.

The time between the leading edges

of the positive PUISElSroduced by the

events (call this time T ) as measured by

the program in Table X is given by the

formula:

Tm = Tp($FFFF- N2)

= 2(N1 + 2)($FFFF- N2)tc

where T is the period of the square

wave on~B7, N2 is the number in the T2counter/timer at the conclusion of the

timing interval, and N1 is the number in

the T1 timer. Refer to Table VI for the

necessary N1 to produce a suitable T .

Values of TJlthat are multiples of ten a P emost usef . The origin of the number

$FFFF in the equation lies in the fact

that the T2 counter/tiimer is loaded with

$FFFF before tlrnlnq begins. For thelisting shown in Table X, Tp is 0.01

seconds, so the equation becomes:

Tm = 0.01($FFFF'- N2) seconds

The precision with which one canmeasure the true time T between the

events depends on the resolution, Tp'

since clearly the true time need not oean exact integral number of T . Our

analysis shows that the actual ti~e, T,is

given by the expression:

Tm-11I2Tp~T'';Tm + Y2Tp

Thus, if greater prsclslon is required,

then Tp can be reduced.

The conversion subroutine, CNVD,

performs the operation ($FFFF - N;2)

shown in the equations. To get T, thisnumber must be converted to decimal

and then multiplied by T which, in our

case, is 0.01 seconds. nPe hexadecimalto decimal conversion algorithm used in

CNVD is from Peatman's book Micro-computer Based Design, while the

coding used is from Butterfield's "Multi-

Mode Adder" in 6502 User Notes, No. 13,pg.23.

Subroutine CNVD also calls asubroutine named AIMDSP.This routine

displays the contents of locations with

addresses $0001, $0002, and $0003;

namely those locations that contain thetime T, now in decimal. No attempt has

beenmade to locate the decimal point in

these subroutines. As long as theperiod, T ,if the squarewaveonPB7is a

multiple gf ten, 0.01second for example,

the user should have no trouble placing

his decimal point mentally.

In any case, subroutine AIMDSP is an

AIM 65 dependent subroutine that has

been published previously, so only itsAIM 65mini-disassembly format is givenhere. Owners of other microcomputer

systems will want to substitute a

suitable routine to display the contents

October, 1979

Page 41: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 41/68

1

N••

TO CLOCK T ON

THE 7474 FLIP-FLOP

Figure 5. S to pw atch In terface fo r the C ircuit in F ig ure 4. T he s «ncnis no rma lly c lo 's ed (N .C. ). To produce a p ulse w he n an event oc curs,

the n orm ally o pen (N . O .) co ntact is closed m om entarily.

of the three locations mentioned. Such

routines for the KIM-1 and SYM-1 are

readily available.

The time interval chosen for the listing

in Table X is suitable for "stopwatch"

functions, and a suitable stopwatch in-

terface to the circuit of Figure 4 is givenin Figure 5. This circuit simply de-

bounces the switch when it is momen-tarily closed at the beginning and the

end of the interval to be timed.Phototransistor circuits can also be us-

ed to produce positive pulseswt en light

beams are interrupted. A photo-

plethysmograph can beused to r ieasurethe time interval between heartbeats,

turning the circuit of Figure ~ into acardiotachometer.

One way to test the circuit of ! 'igure 4and the program in Table X is to apply a

0200 A9 LDA#010202 8D STAAOO2

0205 8D STA AOOO

0208 CE DECAOOO

020B A9 LDA#EO

O2OD8D STA AOOB

0210 A9 LDA#4J)

0212 8D STA AOO6

0215 A9 LDA#C3

0217 8D STA A005

O21AA9 LDA#9F

021C 8D STA AOO8

021F A9 LDA#8C

0221 8D STA A009

C l 2 2 4 A9 LDA#A0

0226 8D STA AOOE

0229 58 CU

Set up the Port B DDRwith a one in bit zero.

Start with pin PB¢ '" 1 to preset 7490.

Allow 7490 to count.

Initialize ACR to put T1 in free-running mode, T1 C01.U'lts

Frequency of square wave on FB7 = 10 H z, T = O. l second.p

StartTl running,

Set up T2.

T = 20(N1

+ 2)(N2

+ l)Tc

Start count.Lng ,

Set up interrupt enable register (lER) to allow .in

interrupt request (IRQ) when T2 times out.

(Note: The interrupt routine should reload T2CH with $8C to clear t ie IFR

and allow c ount.Lng to proceed again, if equally spaced, 10-h)Ur

interrupts are desired.)

October, 1979 M ICRO -- The 6502 Jour rial

Q +5 V

I

~

~6_',

~ I

i7490

i

lo--_

¢

square wave of known frequency to the

clock input on the 7474.For example, ifthe pulses from the signal conditioner

shown in Figure 3 are applied to the

7474, then the time interval should be1/60 of a second. slnce 1/60 = 0.01666,and if T = 0.0001second (N1 = $0030

from TJble VI), then the number 1666

should be displayed for the time bet-

ween successive posltlve pulses. Be

sure to change the bytes at $0221 and$0226 to $30 and $00, respectively, in

Table X if you make this test.

Finally, if anevent can bemadeto pro-

duce a Single posltlve pulse for its dura-

tion, the length of the event may be

measured using a slightly modified form

of the program in Table X and the circuitshown in Figure 6.

In conclusion I should like to point out

that the programs and circuits given are

the Simplest ones I could construct. You

will want to add more elegant features.

The purpose of this article was to in-

troduce a few basic techniques, not topresent elaborate designs. If you come

up with a neat design as a result of

something you learned here, I would bevery interested in getting a letter from

you. Better yet, write up your circuit and

program and publish both in MICRO.

Although the circuits and programs

described here were intended to bebuilding blocks for more elaborate

microprocessor baseddesigns, the stop-

watch interface and timing programcould be used for "time and motion"

studies around the house. Just make

sure your spouse's motions do not make

you lose track of the time!

Editor: Port ions of this article are fromDr. De Jong's forthcoming book ten-tatively entitled 6502 Microcomputing,to be published by Howard W.Sams andCompany, and scheduled for releaselater this autumn.

17:39

Page 42: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 42/68

BOX 120

ALLAMUCHY, N.J. 07820

201-362- 3574

H U D S O N D IG IT A L E L E C T R O N IC S IN C .

inc.

TH E HDE MIN I-DI~SKSYSTEM

VERSIONS

KIM

TIM

AIM 65 - 4th Qtr. '79

SYM - 1st Qtr. '80

SINGLE DRIVE

DUAL DRIVE

$ 795.00

$1195.00

Complete with all hardware.

Interconnecting cables, FODS,

text editor and user and instal"

lation manuals.

The HDE DM816"MD1 Mini Disk System is the per"

ipheral you have been waiting for. No longer bounded

by 10nfJ and unreliable cassette saves and loads, your

computer becomes a sophisticated system for program

development or general purpose use. With the HDE

Mini-Disk you load and save programs in seconds, not

minutes or hours. And. since all transfers to and from

the Mini-Disk are verified for accuracy, the data will be

there when you need it.

The HDE DM816"MD1 Mini-Disk has been "systems"

engineered to provide a complete and integrated capa-

bility. Software and hardware have been built as a team

using the most reliable components available. The sys-

tems software includes the acclaimed and proven

HDE File Oriented Disk System and Text EDitor, requir-

ing only 8K for the operating software and overlay area.

Systems expanding programs available include the

two-pa..s HDE assembler, the Text Output ProcessingSysterr and Dynamic Debugging Tool. Hardware 111-

cludes a Western Digital 1771 based controller in a

state-oithe-art 4'12 x 6 '12" card Size, Shuqart SA 400 drive

and th e Alpha power supply.

The storaqe media for the DM816-MD1 is the stan-

dard, s.>Itsectored 5'/.' mini diskette readily available

at mos computer stores. and HDE has designed the

system so that the diskettes rotate onty durmq disk

transac tions, favorably extending media life. A disk

formatt sr routine included with the system, formats the

diskett is, verifies media integrity by a comprehensive

R/W ts st and checks drive RPM. Additional utilities

provide ascending or descending alpha numeric sort,

disk p, cking, text output formatting, file renaming,

file adc ressing and other capabilities.

HDE PRODUCTS. BUILT TO BE USED WITH CONFIDENCE.

AVAILABLE DIRECT OR FROM THESE FINE DEALERS:

LONG ISLAND

CO APUTER GENERAL STORE LONE STt,R ELECTRONICSOHNSON COMPUTER PLAINSMAN MICROSYSTEM'S ARESCO

PO. Box 43

Audubon. Pa. 19407

215-631-9052

103 Atlantic Avenue

Lynbrook. NY 11563

516-887-1500

Box 488

Manchaca. Texas 78652

61~)-282-3570

Box 523

Medina. Ohro 44256

216-n5-4560

Box 1712

Auburn. Ala. 36830

800-633-8724

Page 43: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 43/68

Card Shuffling Program for KIM - 1

Your 6502 might play poker like Amarillo KIM, but does it

always have to pass the deal? Not if you teach it to

shuffle cards!

Hark Chan

P.O. Box 714

Cambridge, MA 02139

Entertaining friends with computer

games certainly makes all the effort of 0120: 0200 ORG $0200assembling a personal computer worth·

0130: 0200 A2 36 LDXIM $36while. However, if you happen to have a

small microcomputer with limited mem- 0140: 0202 8A L1 TXAory and very few software tools, there 0150: 0203 95 00 STAZX $00are not many games available. As an

0160: 0205 CA DEXexample, most card games need a ran-

dom number generator to shuffle cards. 0170: 0206 DO FA BNE L1

The standard method to generate ran-

0180: 0208 86 38 STXZ $38

dom numbers (as used in most BASIC 0190: 020A A5 35 LOOP LDAZ $35interpreters) is not suitable for this pur- 0200: 020C 38 L2 SECpose. Since some of the bare-bone com- 0210: 020D E9 34 SBCIM $34puters do not even have the software to

perform multiplication, it is asking too 0220: 020F BO FB BCS L2much for them to generate floating- 0230: 0211 18 CLCpoint random numbers. To make these 0240: 0212 69 35 ADCIM $35small computers more entertaining, a

simple method to shuffle cards is de- 0250: 0214 AA TAXscribed here. This method is implement- 0260: 0215 85 35 STAZ $35ed in a KIM. The machine instructions

0270: 0217 B5 00 LDAZX $00use about 80 bytes. There is lots of mem-

ory left for playing card games. The only 0280:·0219 85 37 STAZ $37drawback is that it requires the operator 0290: 021B A5 36 LDAZ $36to press the interrupt key in order to stop 0300: 021D OA ASLAthe program.

0310: 021E OA ASLAThe card shuffling program consists of 0320: 021F 18 CLCtwo portions. The second portion is the

0330: 0220 65 36 ADCZ $36main program thai shuffles cards. It just

keeps on shuffling until the interrupt key 0340: 0222 18 CLCis pressed. The first portion is an inter- 0350: 0223 69 01 ADCIM $01rupt service routine used to ensure an 0360: 0225 85 36 STAZ $36orderly ending of the prog-ram. The pro-

0370: 0227 18 CLCram is relocatable, and the two port ions

can be in separate locations. 0380: 0228 65 35 ADCZ $35

This feature makes it easy to incorporate 0390: 022A 38 L3 SEC

the shuffling program into a complete 0400: 022B E9 33 SBCIM $33card-playing program. However, it is irn- 0410: 022D BO FB BCS L3portant that the user initialize the inter-

0420: 022F 18 CLCrupt vectors to jump to the interrupt ser-

vice routine. 0430: 0230 69 34 ADCIM $34

To keep the computer code relocatable, 0440: 0232 AA TAXthe initialization of the 2 byte address is 0450: 0233 B4 00 LDYZX $00left to the user. The storage area for the 0460: 0235 A5 37 LDAZ $37cards, together with 4 bytes of working

0470: 0237 95 00 STAZX $00space, are in page O . In this program, the

storage area starts at address 0001. 0480: 0239 A6 35 LDXZ $35However, the program can be changed 0490: 023B 94 00 STYZX $00easily to move the storage area to other

0500: 023D A5 38 LDAZ $38locations in page o .

0510: 023F C9 00 CMPIM $00

) The deck of cards is stored in an array at 0520: 0241 FO C7 BEQ LOOPlocations (hex) 0001 to 0034. The value of

October, 1979 MICRO -- The 6502 Journal 17:41

Page 44: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 44/68

0010:

0020: * INTERRUPT SERVICE ROUTINi~

0030:0040: 0243 A5 F3 LDAZ $F3

0050: 0245 A4 F4 LDYZ $F4

0060: 0247 A6 F5 LDXZ $F5

0070: 0249 E6 38 INCZ $38

0080: 024B 40 RTI

each address is distinct and is between

hex 1 to 34 (decimal 1 to 52). After the in-

terrupt key is pressed, the content of

these addresses represents a deck of

random cards.

The program uses a simple random num-

ber generator to generate random point-

ers with values between 1 and 52. The

first card in the deck is interchanged

with the card selected by the random

pointer. The position of all the cards is

next shifted one place so that the last

card becomes the first, the first card

becomes the second, and so on. This is

to make sure that the first card is always

changing, and a different card is inter-changed with each randomly selected

card. A random pointer is again

generated and the whole operation is

repeated.

After a sufficient number of operations,

the deck is suitable for card games. One

or two hundred shufflings are sufficient.

When the interrupt key is press ed, the

interrupt service routine sets a nemory

location, hex 0038, that serves a; a flag

to signal the end of the shufflir g. This

routine also restores the accu nulator

and the X and Y registers. It is im oortant

that the user initialize the interrupt vee-

tor to address the service rouine In-

stead of the operating system.

The sequence of cards being shu I fled is

actually predetermined because it is

calculated from a prescribed se"ies of

operations. However, if the stop com-

mand is activated by a human operator

the cards can be very random. I takes

about 10.4 second to do one s huffle.

The time to activate the stop command

can easily vary by more than 0.1 second.

Thus, the number of shufflings can be

uncertain by about 1000, which s sut-

ficient to generate a deck of r mdorn

cards.

I ni t ia li ze i nt er ru pt

vec t or t o ad d r e~~ of

~ er vi ce r ou ti ne

In it iali ze c ar d ar ray

an d page zer-o. work

K IM /S Y M /A IM -6 5 - 3 2 K E X P A N D A B L E ~ A M

D Y N A M IC R A M W I T H O N B O A R D T R A N S P A R A N T R E F R E S HT H A T IS C O M P A T IB L E W I T H K IM /S Y M /A II V I - 6 5A N D O T H E R 6 5 0 2 B A S E D M IC R O C O M P U T E R S .

* P L U G C O M P A T IB L E W I T H K I M !S Y M / A IA , -6 5 .M A Y B E C O N N E C T E D T O P E T U S .IN G A DA F f O RC A B LE . S 5 44 -E B U S E D G E C O NN E C TO R* l I S tS + 5V O N L Y ( S U P P l iE D F RO M H lIS T

C O M PU T E R B U S ). 4 W A n S M A X I M U M .* B O A RD A D O R ES S A B L E I N 4 K B Y TE B LO . : K S

W H I C H C A N B E I ND E P EN D E NT LY P l A C E l1 O N4 K B YT E B O U N D A R IE S A N YW H E R E I N A > lKB Y TE A D D RE S S S P A C E .* B U S B U FF E RE D W I T H 1 LS n LL O A O .* 2 00 N SE C 4 1 16 R A M S .* F U L L D O C U M E N T A T IO N* A SS EM B L E D A ND T E S T E D B OA R D S I R E

G U A R A N T E E D F O R O N E Y E A R . ) N OP U R C H A S E P R IC E I S F U L L Y R E F U N D A BL , : IFB O A R O I S R E T U R N E D U N D A M A G E D W i ll i lN1 4 D A Y S .

A S S E ! I B l E D /

T E ~ rE D K IT

W IT H 3 2 K R A M l 4I l iOO 1 4 5 9 . 0 0

W IT H 1 6 K R A M $4! 1 i . 0 0 1389 . 00W IT H O U T R A M C H IP S W li.O O 13 19 .00H A RD T O G E T P A R TS O NL Y (N O R A M C H IP S ) • • . " ' " $ 1 8 0 . 0 0

B A R E B O A R D A ND M A N U A L 185 . 00

C O NN EC T S T HE A B OV E 3 2 K E X P A N D A B L E R A M T i l A 4 K O R 8 K P ET .

C O N T A I N S E X P A N S I O I I I I I T E R FA C E C A BL E . B I I A R D S T A N D O F F S ,

P O W E R S U PP LY M D O IF IC A T IO N K IT A N D C O M PL TE IN S TR UC T IO N S .

BETA COMPUTER DEVICES - - • • A LL A SS E M B L E D ~ ~A R D S A ND M E MPO BCX 3 4 6 S " . C ,. O R Y C H IP S C A R RY ~ F U LL O N E Y E A R

ORANG~71;;~~~07~~~A 91665 .' ',-- -: • R E PL A C EM E N T W A N A N TY

In t e r r u p t

Key

Pr e s s e d

R es t or e a c cu m ul at o r

R es to re X l "e g. Ls te rRe~t or e Y r egi s t e r

Set flag t o

Ret ur n fr om i nt er rupt

1 6 K X 1 D Y I A M IC R A ilT HE M K 4 11 6 - 3 I S A 1 6 ,3 8 4 B IT H IG H S PE E DN M O S , D Y N A M IC R A M . T H E Y A R E E Q U IV A LE N TT O T HE M O S T EK , T EX A S IN S T RU M EN TS . O RM O T O R O L A 4 1 1 6 · 3 .* 2 00 N S E C A C C E S S T I M E , 3 7 5 N S E C C Y C L E

T I M E .* 1 6 P IN rn C O M P A T I B L E .* B U R N E D I N A N D F U L L Y T E S TE D .* P A R T S R E PL A C E M EN T G U AR A NT EE D F O R

O N E Y E A R .S 9 . 5 0 E A C H IN Q U A N T I T IE S O F 8

M O T O R O L A I I I E M O R , ( A D D R E S S M U L T I P L E X E R -I I IC 3 2 4 2 A

T HE M C 3 24 2A I S A N A D DR E SS M U LT IP LE X ERA ND R E F R E S H C O U NT E R F O R 1 6 P IN , 1 6 KD Y N A M IC R A M S T HA T R E QU IR E A 1 28 C Y C L ER E F R E S H .* C O N T A IN S M E M O R Y R E F R E S H C O U N T E R .* M U LT IP LE X E S S Y S T E M l ' B IT A D DR E SS TO

T H E 7 A D D R E S S P IN S O F T H E R A M S* C D M P A T I8 L E W I T H 34m M E M O R Y

C O N T R O L L E R .* P A R T IS G U A R A N T E E .O .

1 1 2 .5 0 E A C H

M O T O R O L AD Y I A M IC M E I I I D R Y C O N T R O L L E R ·M C 3 4 8 0 L

M E M O R Y C O N T R O L L E R D E S I G N E D T O S 1 M P L I F YC O N TR O L O F 1 6 P I N 4 K O R 1 6 K D Y NA M IC R A M S .* G E N E R A T E S R A S /C A S A N D R E F R E S H TI M IN G

S IG N A L S F D R 1 6 K T 0 6 4 K B Y T E M E M O R I E S .* G E N E R A T E S M E M O R Y R E A D / W R I T E T I M IN G .* D IR E C T I N TE R F A C E W IT H M O TO R O L A O R

IN T E L 3 24 2A A D DR E SS M U X A N D R E FR E SHC O U N T E R .* P A R T G U A R A N T E E D .

S 1 3 . 1 1 5 A C H

6 50 Z .8 4 K B Y TE R A il A K D C O N TR B lL E RS HM A KE 6 4 K B YT E M E M O R Y F OR Y O U R 6 80 0 O R6 5 0 2. T H IS C H I P S E T IN C L U D E S :* 3 2 M 5 K 4 1 16 ·3 1 6K X1 , 2 0 0 N S EC R A M S .* 1 M C 34 80 M E M O R Y C O N TR O L L E R .* 1 M C 32 4 2A M E M O R Y A DD RE SS

M U L T IP L E X E R A N D G O U N T E R .* D A TA A N D A P P L IC A T I O N S H EE T S . P A R T S

T E S T E D A N D G U A R A N T =E O .

$ 32 5 .0 0 P ER S ET

E P R O M2 7 1 6 - 4 5 0 N S E C . . .. . . . . . . . . . . . 1 4 9 . 0 1 1

Page 45: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 45/68

How Do You Connect Peripheralsto Your Superboard II

The OSISuperboard has a wealth of I/O ports, but often

the effective use of them is "Left as an exercise for the

reader". Here is some concise information on tile con-

figuration and use of the I/O ports.

Since I wrote "A Close Look at the

Superboard II", MICRO 11:15, I have

received several calls and letters asking

for more information concerning inter-

facing the Superboard II to various

peripherals - printers, memory boards

and so on. Because of the continuing

lack of information available from OSI,

the manufacturer of the Superboard and

the Challenger 1P, I have decided that it

would be good to give some basic and

rather general pointers on the use of the

Superboard ports.

Since there are many different

peripherals (understatement of the cen-

tury) and since each one has its own

requirements, I cannot be very specific

about your particular device. Instead, I

hope to describe the signals available

on the Superboard in some detail, so

that you will at least know somethingabout i ts interfacing possibi li ties.

The J2 Port

,~}

There are four ports on the Super-

board. Three of them are 12-pin Molex

connectors and one of them is a 40-pin

DIP socket. They are numbered J1

through J4. I shall begin with J2, since

you are already using that one to inter-

face your video monitor and your

cassette. You will find a listing of the pin

outs for J2 in Figure 1. Pins 7 through 10

are used for the cassette. Pins 11 and 12

are used for the video output.

I assume that you understand thebasic use of these pins; and so, I will on-

ly mention that the signals generated for

the cassette come from an on-board in-

terface consisting of a Motorola 6850

ACIA and a couple of flip flops (U64). The

audio input goes through an RCA 3130

which triggers a monostable one-shot

and sets or resets a flip flop. This signal

is then fed to the 6850.

The signals at the 6850 are designated

as RxData and TxData. The 6850 also

has two control signals which are not

October, 1979

used by the cassette inter face t ut might

be useful to your peripheral. "hey aredesignated as RTS and CTS on the

schematics.

Finally, there are two separate clocks

which drive the 6850: TxCLK anc ' RxCLK.These clocks set the baud rate a t whichthe 6850 operates. For precise in forma-

tion on the 6850, I suggest that} ou get a

copy of the manufacturer's SP,)c sheet

on this ACIA. Your dealer should have it.

I mention all of this simply oecausethese six signals are present as TTL

signals on J2, pins 1 through E . If your

peripheral requires TTL level serial data,

then you will connect it to these pins.

But there is more to it than just con-

necting your peripheral's cable to the

right pins on J2. My Superboard II came

with several parts missing. You will needto install a 7417 at U68 and a 7'·LS14 at

U67. You will also have to instal the 220

and 390 ohm resistors at R38 through

R49.

Next, notice that the RxData lind CTS

signals coming in on pins 1 and 3

respectively are called RxData3 and

CTS3 after they come from U67. "hey arethen routed to jumper locations 1V10 (the

upper W10 to the right of Q~ in the

schematic sheet 6) and W11. Th« reason

for this is that you don't want Input com-

ing from two or three different sources

going to the 6850.

I recommend that you install a DP3T

(double pole three throw) switch so that

you can switch the RxData line !loing to

the 6850 between RxData1, which is the

cassette input; RxData3, wntcr is the

TTL level input from J2; and the RS-232

input which will be described shortly.

The other pole of this switch can be

used to switch CTS approprtatety. To in-

stall this switch you only have to cut the

trace connecting the RxData llne to Rx-

Data1 at W10.

With this switch installed, YJU can

switch lines between three sources of in-

MICRO -- The 6502 Journal

Bruce Hoyt

Route 1

Brighton, TN 38011

put: the cassette, your peripheral on TTL

level lines at J2, and some other

peripheral that uses RS-232 on J3.

One more change may be needed atjumper location W5, also on sheet six of

the schematic. Here, the TxCLK is wired

to the RxCLK. To separate them, you

merely have to cut the diagonal trace

connecting them and install another

switch to switch the RxCLK line on the

6850 between the TxCLK line and the Rx·

CLK input. I recommend, however, that

you not make this modification unless

you need separate clocks for your

peripheral. If your peripheral is pretty

stable and close to 300 baud, you can

probably get by as is. But if you have a

peripheral that has a clock rate different

from 300 baud, you will need to make

this modification.

You may now ask what the RTS and

CTS signals are used for. If your

peripheral is a printer, it may send out a

busy signal whenever it is not ready to

receive another character. This signal

should be active high. It should be con-

nected to the CTS on the 6850 - that is,

it should be connected to J2 pin 3. You

will have to switch W11 properly, since

the CTS goes through this junction. You

may also have a TTL line which controls

the power onloff on your peripheral.

Maybe you would like to control the

cassette motor. You can do this with the

RTS signal. It is a signal provided by the

6850 under software control; that is,

your software, since OSI doesn't sup-port this function.

Because it is fed through a 7417 buffer

which is capable of sinking 30

milliamps, you can use it to drive a small

reed relay. I purchased just such a relay,

which operates on 5 volts at about 20

milliamps, and have used it to turn my

cassette on and off. See Figure 2 lor a

schematic used to connect a relay to theRTS signal.

Now all the connections are made, but

how do you instruct the computer to

17:43

Page 46: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 46/68

transmit and receive these signals?

Remember that the cassette is also con-

nected to the 6850; and so, as far as soft-

ware is concerned, the peripheral will

work just like the cassette. Whatever

you write to your cassette will go to the

TxData line and to your peripheral. You

read your peripheral just as you would

read from the cassette (after you switch

W10 over).

Let us suppose that you have a printer

connected to the TxData line and that itsends a busy signal back over the CTS

line when it is working. Whenever you

give the command to "SAVE" in BASIC,

this will activate the printer just as it

does the cassette, so that any

characters output by BASIC will be sent

to both printer and cassette. If either of

them is turned on, it will print or record

the data sent. And how can one tell

whether the printer is busy or not? You

can't without writing some of your own

software.

You see, Microsott BASIC does not

actually do any I/O; it merely jumps out

to the I/O routine provided by OSI in the

monitor. There are four routines thatBASIC jumps to for I/O: one which inputs

a character, one which outputs a

character, one which is executed

whenever the LOAD command is given,

and one which is executed whenever the

SAVE command is given. BASIC jumps

to the following addresses which have

instructions as shown:

Input

Output

Load

Save

JMPI

JMPI

JMPI

JMPI

$0218

$021A

$021E

$0220

FFEB

FFEE

FFF4

FFF7

The monitor stores the addresses of

the input, output, load, and saveroutines at the locations $0218, $021A,

$021 E, and $0220 respectively every time

the BREAK key is pressed. This makes

BASIC transfer control to these routines

when it needs I/O.

Of course, it would be easy to write

your own routine and POKE the address

of it in one of these locations so BASIC

would then jump to your routine instead

of the one in the monitor. You can

disassemble the routines in the monitor,

if you want to find out just what they do,

but I will describe their functions here.

The input routine, located at $FFBA,

checks the load flag at $0203. If it is

zero, the routine jumps to the keyboard

input routine at $FDOO to input a

character from the keyboard. If the flag

is non-zero, the input routine checks to

see if the spacebar is pressed and, if

not, it inputs one character from the

6850 and returns. If the spacebar is

pressed, it sets the load flag to zero and

inputs a character (which will be a space

since the spacebar is pressed) from the

keyboard. This is why pressing the

spacebar will stop reading from the

cassette.

17:44

The output routine, located at $FF69,

jumps to the CRT simulator routine at

$BF2D which outputs a character to the

screen and then checks the save flag at

$0205. If the save flag is 0 it returns. If

the save flag is non-zero, it outputs the

character to the 6850. If this character

was a carriage return (that is, $00) then

it also sends out 10 nulls ($00).

The load routine, located at $FF96,

sets the save flag to 1. When you give

the SAVE command, BASIC jumps to thesave routine which sets the save flag.

Then, whenever you output any

character, BASIC jumps to the output

routine which' sends the character not

only to the CRT, but also to the 6850.

This will send it to the cassette and also

to your printer. If you don't turn on your

cassette, the character will only be

printed by the printer.

But I still haven't described how you

know when the printer is busy. You can

PEEK at the 6850 control status register

to see whether the CTS bit is low. Then

you will know the the printer is ready.

But this is not a very good way to do it.

since you would have to do such PEEK-ing prior to every print command! The

better way is to write a short output

routine which checks this bit for itself.

The 6850 occupies two address loca-

tions: $FOOO and $F001. The first of

these is the control register of the 6850

and, by writing and reading this address,

one can send and receive control

signals. $F001 is the data register and,

by writing or reading this address, one

can send and receive data from the 6850.

The short output routine shown here

illustrates how one might check for a

printer busy signal. The listing includes

two small programs that turn the RTS

signal off and on. The latter might be

employed to write a SAVE routine that

could be called from BASIC and would

turn the cassette or printer on

automatically. Hernernber that you will

have to put the addresses of your I/O

routines in locations $0218, $021A,

$021 E and $0220 after each time you

depress the BREAK key.

The J~IPort

The main purpose for J3 is to interface

peripherals which require RS-232signals. As can be seen in Figure 1, pins

2 and 3 are the data out and in pins. Pin 7

provides a neqatlvs voltage for the

RS-232 interface. To use this, however,

you will have to open the ground at

jumper W10, the lower one under 01.Even more than this, you will have to in-

stall all the hardware for the RS-232

signal level generation; that is, 01 and

02 and their associated resistors and

diode. Once again you must set up W10

and W11 with the proper switch, asdescribed previously, so that you can

switch between the cassette and your

peripheral. I believe that the description

for J2 was sufficient to qet you going onthe software you mi(lht need to use this

port.

The J4 Port

In the OSI manual on the Superboard,

J4 is described as a "joystick" and

"noise" port. The noise is made by turn-

ing on and off four of the keyboard

2 9 50

J2

Figure 2J2 PIN 6 RT S

MICRO -- The 6502 Journal

8 6

J Figure 4

+5 V

REED

RELAY

: : ; rl N9 1 4

CASSETTER E M O T EPLUG

October, 1979

Page 47: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 47/68

J

Pin

123

4

5

6

7

8

9

10

11

12

1314

15

16

1718

19

20212223

24252627282930

31

3233

3435363738

3940

)

October, 1979

J1

Figure 1: Superboard 110 Ports

J2

Signal

IRQNMI

DO

BOO

B01B02B03GNO

GND

GNO

unused

A2

A1

AOA3

A4

A5

A6

A7

A8

A9

A10

A 11

A12

A13

A14

A15

GNO

GNO

GNO

02R/W

B07B06B05B04GNO

GNO

GNOGNO

Pin

12

3

4

5

6

7

8

9

10

11

12

Pin

1

2

3

4

5

6

7

8

9

10

11

12

Pin

1

2

3

4

5

6

78

9

10

11

12

Signal

RxOataRxCLK

CTS

TxOata

TxCLK

RTS

Mic .05 volt

GNO

AUX 0.5 volt

Audio in

GNO

Video out

J3

Signal

GNO

RS232 out

RS232 in

RxOata

RxOata1

RxOata2

-V in for RS232 inte 'face

unused

CTS

CTs2unused

unused

J4

Signal

R1

R7

C1

C2

C3

4

C5C6

C7

R6

GNO

Noise

MICRO -- The 6502 Journ ~I

latches. These am coupled through

resistors and a capacitor to pin 12 of J4.The main problem is that the resistors

are not installed, nor are their values

given. I have not experimented enough

with these to determine what values

would work best to give four bit analog

output.

The main reason I have not done this

experimentation is that I have not

thought the "noise" would be very

useful because it is coupled to the

keyboard. For this reason, whenever the

keyboard input routine is called, a tone

is generated by a loop in that routine

which sets and resets the keyboard tat-

ches.

If you wanted to produce some music,

you could do so by choosing proper

values for these resistors and then

writing a small program to turn on and

off these latches by writing to address

$DFOO. I would advise installing a switch

between the output of pin 12 and your

amplifier since you will want to turn off

this noise whenever you are not

generating some music or gamingsound effects. The keyboard routine's

continuous tone is ra.ther annoying after

a while!

If you want a beeper to signal various

conditions audibly, then I recommend

that you use the RTS output at J2. It

comes from a heavy buffer which could

be connected through a 100 ohm

resistor and a small speaker to the 5 volt

line. When this RTS signal is turned on

and off at the proper rate, it would make

a nice beeper without the need for the

amplifier that the output at J4 pin 12 re-quires. Also, there would be no annoying

continuous tone.

The other pins on J4 are quite useful

because they are connected directly to

the keyboard matrix. The graphics

manual has a short description of how

to deactivate the CTRL-C routine and

how to check for a key depressed. If you

were to connect lines 1 through 11 on J4to some switches, you could use the pro-

cedure to determine whether the swit-

ches were closed. In this way, one might

simulate a joystick.

By using four switches you could in-

dicate eight directions. North, east,

south and west could be indicated when

exactly one switch was closed - the

switch in that particular direction on

your joystick. Northeast, southeast,southwest and northwest could be in-

dicated by two adjacent switches being

closed at the same time. By this means

you could move a point on the screen in

any of eight directions.

Another very good use for these lines

would be to add a numeric keypad 'In

parallel with the keyboard. To do so, you

need only wire the switches on the

keypad so they are in parallel with the

corresponding keys on the keyboard as

shown in the schema.tic, sheet 12. See

17:45

Page 48: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 48/68

Figure 4 for a diagram of these switches.

By doing this and writing a short BASIC

program, you could imitate a very power-

ful calculator.

The J1 Port

This port is what OSI uses for expan-

sion. It has all the data and address

lines in addition to several of the control

lines that the 6502 produces. I sug-

gested in my previous article that thissocket could be connected to a KIM type

connector to make a KIM expansion

port. That is more or less true but, as you

will see from checking the signals

available on ,11 and the required signals

on the KIM expansion port, there are a

few missing. The most important ones

are there, and it just may be that the

ones you need to operate your

peripheral memory board or whatever

are present.

Pin 3, the 00 line, needs some ex-

planation. This line is an incoming

Signal that is used to control the data

buffers U6 and U7. This line must be

driven by the R iW signal, so I suggestthat you connect both the r r !W signal

(that you get from U2~n 6) and the line

from J1 pin 3 to the FfIW pin on the KIMexpansion connector.

I think a 40 wire ribbon cat Ie with a

OIP plug on the end of it wou d be the

best thing to make the connec ion from

J1 to the KIM connector. 0course,

some of the wires won't be use. I; a nd so,

you might be able to pull sor Ie of theunused wires out and solder th un to thepoints on the Superboard wher lyou are

going to get the missing signa s.

The missing Signals can be found at

the following places: f ! f t i 1 i i on 1121 pin 6as mentioned above, 0 2 on U ~1 pin 4,R S T on the high (non-ground) s: de of theBREAK key, VCC where the r 1d 5 volt

supply line enters the board, 'ISS any

place along the edge of the bo a rd wherethe ground plane is, SYNC on J8 pin 7,

and 01 on U8 pin 3. If you need the ROYsignal, you have to make a ct ange on

the Superboard. Open the sh ir t tracecoming from U8 pin 2, which is the ROY

line on the 6502, and put a 4.71 ( pull up

resistor in the opening you h a ' 'e made.This will enable any peripht ral that

needs to use the ROY line to pull it low.

After installing the resistor, you can wire

the ROY line to U8 pin 2.

There are also RO, K6, S: rr OUT,RAM/RiW, and PLL TEST llne.. on the

KIM expansion connector, but y ou won'tbe able to get these from th 1 Super-

board. I doubt that any of the peripherals

you might be interested in will require

them since they are rather peculiar tothe KIM.

This method of directly wiring a KIM

socket to the appropriate Signals on the

Superboard will give you a workable KIM

expansion connector even though it may

look a little messy since you have to run

wires to several points on the Super-

board. If you plan to use several boardssimultaneously, you will want to make

your connections to a KIM compatiblemotherboard.

You may ask if all this wiring is worth

the effort, since OSI sells a 610 expander

board which plugs directly into the J 1

socket and which will then connect to

the OSI 48-pin bus. I think that it is

because I like to work with hardware and

software together. OSI doesn't offer

everything that I need, and their price is

somewhat high for what I want. You may

wish to investigate just what OSI offers

in the way of peripherals before you

make any of these changes and addi-

tions to your Superboard. In any case, I

hope that you now understand a little

more about how your Superboard works

and how you might go about connecting

some peripherals to lit.

P R I N T C R G ( W h e r e v e r you want it)

C R T E Q U $ B F 2 D

S T A T U S E Q U $ F O O O

PYGMYD A T A E Q U $ F O O l

S A V F L G [ Q U $ 0 2 0 5

PROGRAMMING : S R C R T O U T P U T T O C R T

F H A S A VE C H AR A C T E R

* PRESENTS *L D A S A V F L G C H E C K S A V E F L A GB E Q R T N I F 0 N O 6 8 5 0 O U T P U T

APPLE BUSINESS SOFTWARE W A I T U A S T A T U S W A I T F O RA P P L E - D M S © 4 8 k & d i s k r e q u i r e d S 4 9 . 0 0 L S R A C H A R A C T E RA pple data m an agem en t system ... the ultim ate in free- L S R A T O B E T R A N S M I T T E Dform system s. You define the n am e an d length of fields

B e C W A I Tw ith in e ac h re co rd . M u lti d is k c ap ab ility g iv es y ou a cc es s

W A I T 1 l ) A S T A T U S W A I T F O Ro thousands of records at on ce w ith the in c luded

so rt/e dit fea tu res! T he p rin t form at is a iso d efin ed by th e A \ J D I M $ 0 8 P R I N T E : Ruser for c usto m re po rt g en eration . U ses in clu de m ailin g B \ J [ W A I T 1 R E A D Ylabels, inven tory, personnel data and other record

R E A D Y P _ A W H E N R H D Ykeep in g f un c tio n s.

S r A D A T A O U T P U r D A T AA P P L E - S C : R I B E - 2 © d i s k o r c a s s e t t e $ 4 9 . 0 0

R T N R T ST ext proc essor ... the perfec t add ition to an y busin ess

system . Th is is a non -lin e orien ted editor that a llow sL ) A I M $ 5 1pper and low er case letters, an y w idth paper an d an y C A S O F F

len gth p ag e. In clu de d fe ature s a re au to ma tic he ad in gs,S r A S T A T U S

date an d page n um ber, righ t han d justific ation , searc hR r sith un iv ersal or in div idu al rep la ce men ts. T ext is sto red

on disk or c assette for easy retrieval.

P.O. Box 3078. Scottsdale, AZ 85257 C A S O N U A I M $ 1 1

S r A S T A T U S

R r S Figure 3

17:46 MICRO -- The 6502 JouI1s1 October, 1979

Page 49: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 49/68

WE'VE

C O M P U T E RC1 P:$349 ! A dramatic breakthrough in price and per-

formance. Features OSI's ultra-fast BASIC-in-ROM, full graphics

display capabil ity, and large libraryof software on cassette and

disk, including entertainment programs, personal finance,

small business, and home applications. It's a complete pro-

grammable computer system ready to go. Just plug-in a video

monitor or TVthrough an RF converter, and be upand running.

15K total memory including SK BASIC and 4K RAM-

expandable to SK.

C1 P M F: $995! First floppy disk based computerfor under$1000! Same great features as the C1P plus morememory and instant program and data retrieval. Can be

expanded to 32K static RAM and a second mini-floppy.

Italso supports a printer,

modem, real time clock,

and AC remote interface,

as well as OS-650

V3.0 developmentdisk operatingsystem.

C2·4P: $598 ! The professional portable that has over 3-times the displaycapability of 1P's. Features 32 x 64 character display capability, graph,ics, full

computer type keyboard, audio cassette port, and 4 slot BUS (only two used inbase machine). I t has SK BASIC, 4K RAM, and can

be expanded to 32K RAM, dual mini-floppies anda printer.

)

C2·4P MF: $1533 ! It'sabigpersonalcomputing mini-floppy system at a special package

price. Contains the famous C2-4P microcomputer

with 20K static RAM, 5" mini-floppy unit for instant

program and data loading, RS-232 circuitry (for optional modem

and printer), 'and diskettes featuring exciting games, personal,business and education applications.

C2·8P OF: $2599! A full business system avail-able at a personal computer price! The system includes the

powerful C2-8P microcomputer (32K RAM expandable to

4SK), dualS" floppy unit (stores S-times as much information

as a mini-floppy), and 3 disks of personal, educational and

small business applications software. Has all the capa-

bil it ies of a personal system including graphics plus

the ability to perform Accounting, Information Manage-

ment, and Word Processing tasks for small business.

C2·8P: $799! The personal class computer thatcan be expanded to a ful l business system. Has all the

features of the C2-4P plus an

Sslot BUS (3-times greaterexpansion ability than the

C2-4P). Can be expanded to 4SK

RAM, dual floppies, hard disk,

printer and business software.

I 'm interested in OSI Computers. Send me information on:o Personal Computers 0 Small Business Computers[] Educational Systems 0 Industrial Development Systems

)

Name

Address

CIty

State

-- cDmpuTE~sHDPBoston Um on N H Cam bridge

Zip 590 Comm . Ave. R le 168 288 Norto lk S I

( ac ro ss tr om B .U .) 6 03 ·4 73 -2 32 3 ( ne ar M .L T. 1_ 247·0700 661-2670hone _

Page 50: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 50/68

Presents

Softw are an d Hardw are for your AP PLE

SALES FORECAST provides the best forecast uslnq the fourmost popular forecasting techniques: linear regression, log

trend, power curve trend, and exponential smoothing. Neil D.Lipson's program uses artificial intelligence to determine thebest fit and displays all results for manual intervention. $9.95

CURVE FIT accepts any number of data points, 'tf.istributed in

any tasslon, and fits a curve to the set of points usinq log

curve 1 ! i I , exponential curve fit, least squares, or a power curve

fit. It will compute the best fit or employ a specific type of fit,

and display a graph of the result. By Dave Garson. $9.95

PERPETUAL CALENDAR may be used with or without aprinter. Apart from the usual calendar functions, it computes

the number of days between any two dates and displays suc-cessive months in response to a single keystroke. Written by

Ed Hanley. $9.95

STARWARS is Bob Bishop's version of the original and best

game elf intergallactic combat. You fire on the invader after

aligning his fighter in your crosshairs. This is a high resolutiongame, in full color, that uses the paddles. $9.95

ROCKET PILOT is an exciting game that simulates blasting off

in a rocket ship. The rocket actually accelerates you up and

over a mountain; but if you are not careful, you will run out ofsky. Bob Bishop's program changes the contour of the land

every time you play the game. $9.95

SPACE MAZE puts you in control ot a rocket ship that you

must steer out of a maze using paddles or a joystick. It is a realchallenge, designed by Bob Bishop using high resolution

graphics and full color. $9.95

MISSILE ANTI·MISSILE displays a target on the screen and athree dimensional map of the United States. A hostile sub-

marine appears and launches a pre-emptive nuclear attack

controlled by paddle 1. As soon as the hostile missile is fired,the U.S. launches its anti-missile controlled by paddle O . Dave

Moteles' program offers high resolution and many levels of

play. $9.95

MORSE CODE helps you learn telegraphy by entering letters,

words or sentences, in English, which are plotted on thescreen using dots and dashes. Ed Hanley's program alsogenerates sounds to match the screen display, at several

transmission speed levels. $9.95

POLAR COORDINATE PLOT is a high resolution graphics

routine that displays five classic polar plots and also permitsthe operator to enter his own equation. Dave Moteles' programwill plot. the equation on a scaled grid and then flash a table of

data points required to construct a similar plot on paper. $9.95

UTILITY PACK 1 combines four versatile programs by Vince

Corsetti , for any memory configuration.

POSTAGE AND HANDL ING

P lease add $1.00 for the first itemand $.50 for each additional item .

• P rogram s acc epted for publication

• Highest royalty paid

o Integer to Applesoft conversion: Encounter only thosesyntax errors unique to Applesoft after using this program

to convert any Integer BASIC source.

o Disk Append: Merge any two Integer BASIC sources into asingle program on disk.

o Integer BASIC copy: Replicate an Integer BASIC program

from one disk to another, as often as required, with a

single keystroke.o Applesoft Update: Modify Applesofl on the disk to elimin-ate the heading always produced when it is first run.

o Binary Copy: Automatically determines the length and

starting address of a program while copying its binary filefrom one disk to another in response to a Single key-stroke. $9.95

BLOCKADE lets two players compete by building walls toobstruct each other. An exciting game written In IntegerBASIC by Vince Corsetti. $9.95

TABLE GENERATOR forms shape tables with ease from direc-

tional vectors and adds additional information such as star-ting address, length and position of each shape. Murray Sum-

mers' Applesoft program will save the shape table anywhere in

usable memory. $9.95

OTHELLO may be played by one or two players and is similar

to chess in strategy. Once a piece has been played, its colormay be reversed many times, and there are also suddenreverses of luck. You can win with a single move. Vince Corset-

ti's program does all the work of keeping board details and

flipping pieces. $9.95

SINGLE DRIVE COpy is a special utility program, written by

Vince Corsetti in Integer BASIC, that will copy a diskette using

only one drive. It is supplied on tape and should be loaded ontoa diskette. It automatically adjusts for APPLE memory size

and should be used with DOS 3.2. $19.95

SAUCER INVASION lets you defend the empire by shootingdown a flying saucer You control your position with the pad-

dle while firing your missile at the invader. Written by Bob

Bishop. $9.95

HARDWARELIGHT PEN with seven supporting routines. The light meter

takes intensity readings every fraction of a second from 0 to

588. The light graph generates a display of light intensity onthe screen. The light pen connects points that have beendrawn on the screen, in low or high resolution, and displays

their coordinates. A special utility displays any number of

pomts on the screen, for use in menu selection or games, andselects a point when the light pen touches it. The package in-

cludes a light pen calculator and light pen TIC TAC TOE. Neil

D. Lipson's programs use artificial intelligence and are notconfused by outside light. The hi-res light pen, only. requires

48K and ROM card. $34.95

TO ORDER

Send check or m oney order to:

P .O. Box 273P lym outh M eetin g, P A 19462

P A residents add 6% sales tax.

U.S. an d foreign dealer an d distributor in quiries in vited

All program s require 16K m em ory un less specified

Page 51: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 51/68

The MICRO Software~Catalog: XIII

Mike RoweP.O. Box 6502

Chelmsford, MA 01824

j

Name: Text Processing System (Editor and Assembler)System: APPLE II

Memory: 24KLanguage: Integer BASIC and Machine LanguageHardware: APPLE II, 24K and Disk"

Description: This disk based system allows you tocreate and edit Applesoft, Integer BASIC, assemblylanguage, and APPLE DOS exec files. The text editorprovides capabilities to create load, modify and saveAPPLE II disk operating system text files. Editingfeatures include simple-to-use data entry, extenssrecharacter and string searches and replacement, blockline movement, and simple single line macros. Textcreation and modification is further simplified withsuch features as tabbing, specif ic search windows, filemerging, and line deletion. The text editor supports

systems equipped with a printer to create permanentlistings of text files.

The assembler is a complete, disk-based, two passsymbolic assembler. You can assemble up to ten disk-based text fi les at anyone time. The assembler willgenerate disk based binary files that can be executedvia the APPLE DOS "BLOAD" or "BRUN" commands.Eight character symbols allow for meaningful variableand routine names. The assembler supports all 56 stan-dard 6502 opcodes and six additional pseudo-opcodesused to define constants, labels, program addresses,etc. Meaningful error messages are generated to helplocate program mistakes. The assembler can generateboth program and symbol table listings, with optionalline printer output.

Copies: 200

Price: $55_00plus $1_00shipping and handlingCalifornia residents add 6 per cent sales tax

Includes: All programs on a diskette and a complete60-page user's manual.

Author: Jeffrey GoldAvailable from:Software ConceptsBox 1112Cupertino, CA 95014

October, 1979

Name: ~Iousehold Finance ProgramSystem: APPLE IIMemory 32Kt.anquat e: Integer BASIC and Machine LanguageHardwar e: APPLE II, 32K, and Disk II

Description: The household finance program is a com-prehensive household record maintenance and budgetrnanaqement program. This disk based system providesthe caps bility to maintain 175 records a month for 12months that's over 2000 records on a single diskette).With a s mple to use data entry mode, a user can entercheck transactions, deposits, and cash expenditures.

Error C( rrecting is a simple matter with a complete setof editillg features. Twelve user definable budgetcatagorios are available to allow a family to plan and

analyze spending patterns. Check and cash expen-ditures can be assigned to any budget category. Bothmonth-to-date and year-to-date budget summaries areavailable, Additionally, the program will provide data onhow well the family is keeping to its established mon-thly buduets, Previously entered financial records canbe retrlei ed via a comprehensive data Iisting mode.

Other piogram features include checkbook balancing,tax deductlble classification, and single disk drive copy(backup) : 0 protect against data loss. The program sup-ports systems equipped with a printer and can provideuser sele cted permanent list ing via a unique page printmode. Tt is software package is the most complete,easy-to-u ,e home financial program available today.

Copies: 2()

Price: $3L95 plus $1.00 postage and handlingCal i f ornla residents must add 6 per cent sales tax

Includes: All software supplied on a program diskettewith a complete 32-page user's manual.

Author: Jllffrey Gold

Available from:Sottwat e ConceptsBox 11' 2Cuperti 10, CA 95014

MICRO -- The 6502 Jour tal 17:49

Page 52: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 52/68

Name: Belais' Master Index to Computer Programs inBASICSystem: AllMemory: N /ALanguage: BASIC (a few programs require machinelanguage routines)

Hardware: N /A

Description: A directory of computer programs writtenin BASIC. The programs are ones that have appeared inten major home computer magazines. They cover both

business and personal applications. All major computersystems are included. Many of the programs are writtenspecifically to take advantage of the capabilities ofsuch 6502-based computers as the PET and the APPLEII. The reviews provide detailed information about whateach program does, and what hardware and software itneeds. Program listings are not provided, but informa-tion is given on where to get them.

Price: $9_95plus $1.00 shippingCalifornia residents must include 6 per cent sales

tax.Includes: BookOrder info: VISA/Master Charge accepted (give account

number, expiration date, and Signature).

Author: Paul BelaisAvailable from:Falcon PublishingDept. YP.O. Box 688Ben Lomond, CA 95005

Name: Mailing List ProgramMemory: 48K with DOS and Applesoft ROMLanguage: Applesoft IIHardware: APPLE II, disk drive, printer

Description: The mailing list program is a disk based,menu driven program written in Applesoft II. In order touse the program, a 48K system with Applesoft II on firm-ware along with one disk drive and DOS 3.2 is required.

If your system does not have Applesoft II on firmware,the mailing list program can still be used but thenumber of entries will be greatly reduced.

The program is able to maintain a complete mailinglist. The mailing list data base can be changed, sorted,searched, added, deleted and reformatted. There arefive types of sort and five types of search. Labels can beprinted out on a 40,80 or 132 character printer and alsoviewed on the screen for rapid editing. The program ac-comodates zip codes with seven digits for use outsidethe U.S.A.

There is a routine for lining up the labels and for set-ting the spaces between the labels. Provision has alsobeen made to make a backup copy of the data with a

single disk drive. The mailing list program makesgeneration and maintenance of a mailing list very quickand simple.

Price: $34.95 for diskette plus $1.25 shippingIncludes: User manual and documentation.

Author: Gary E. HaffeFAvailable from:Software Technology for ComputersP.O. Box 428Belmont, MA 02178

17:50

Name Black BoxSystei n: APPLE IIMemory: 16KLanguage: Integer BASICHardware: Cassette

Descr ption: The program Black Box is based on theParke: Brother's game of the same name. The object ofthe game is to guess the positions of marbles that arebidden on an eight by eight board. To help you find themarbles, rays are sent into the box. These rays can hit a

marble, be deflected by a marble, be absorbed into thebox,oany combination of these! There are full instruc-tions inside the program, and a sample game to get yougoing. Test your reasoning power against the mysticalBlack Box!

Price: $8.00Includ es: Verified cassette, postage and handling

Autho: Robin HodgsonAvailable from:The AppleCorp103 Horizon 14723 14th St. N.W.Calqary, AlbertaCanada

T2N 2A4

Name: APPLE-DOCSysten: APPLE IIMemory: 3.5 to 5.8K depending on options.l.anqu.sqe: Applesoft II

Descr ption: Set of three programs-VARDOC,LlNED:>C, and REPLACE.

VAR[OC produces a list of every variable used in yourproqra n and all the lines each is used on. Screen and/orprinter output can include optional descriptors of eachvariable.

LlNEDOC produces a list of every line called by aGOTO, GOSUB, etc, and all the lines each is calledfrom. You are even alerted to calls to lines no longer inthe lls ting. Optional descriptors are for each linenumber.

REPLt\CE allows you to easily rename any or all oc-curances of any variable in your program. Even changevariable types! Can also be used to replace constantsor referenced line numbers within the listing. The LiteralMode allows you to replace any set of characters orBASIC statements with any other set. This program isespecl.ally useful when appending subroutines withconflicting variable use.

Price: ~i9.95for cassette, $13.95 for diskette.California residents must add 6 per cent salestax.

lncludes: Three programs plus documentation.

Author Roger WagnerAvailable from:Loca I Computer Stores orSout hwestern Data SystemsP.O. Box 582Sant ee, CA 92071(714) 562-3670, SASE for free information

MICRO -- The 6502 Journal October, 1979

Page 53: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 53/68

Name: Roger's EaselSystem: Apple IIMemory: 16K for Integer and Applesoft ROM, 20K for Ap-

plesoft ,RAM

Description: Set of three programs: Roger's Easel, Lo-Res Link-Integer, and Lo-Res Link-Applesoft. A paddleoriented sketching program using the color graphics ofthe APPLE II..The unique features of this set include theability to store and retrieve user created pictures from

tape or disk, ability to erase with a single keystroke,resuming original color when done, and immediate ac-cess to a detailed help list while in the program. Themost outstanding feature is the option of permanentlylinking up to 41 pictures to any Integer or Applesoft pro-gram for instant recall at any time. Besides being justplain fun, applications range from putting more creativescreen images in your game programs to educationalprograms for younger children involving shape or colorrecognition.

Price: $9.95 on cassette, $13.95 on disketteCalifornia residents add 6 per cent sales tax

Includes: Three program set with ten-page manual.

Author: Roger Wagner

Available from:Local APPLE dealers or:Southwestern Data SystemsP.O. Box 582-MCSantee, CA 92071(714) 562·3670

)

Name: Programmer's Utility PackSystem: APPLE IIMemory: 4K to 6K (for the prog. itself) depending on

the program used.Language: Integer and ApplesoftHardware: APPLE II with cassette or disk drive

Description: Set of 11 programs. Appends, STR$()and VAL() are on printed documentation with thetape version" Programs include: Renumber - Integer& Applesott, Append - Integer and Applesoft, LineFind - Integer and Applesoft, Address/HEXConverter, Screen Find, Memory Move, and theSTR$() and VAL() function simulations for Integer.

By using the various programs one can renumberInteger and Applesoft programs with all GOTO's, etc,being renumbered and the user alerted to unusualsituations in the program. These include referenceline numbers not in the program, lines referenced bya variable or expression, and a number of others.

Line Find allows the user to locate the actualaddress range of a line in memory so as to be able toinsert CLR, HIMEM:, etc. It can also be used onoccasion to recover programs garbaged by droppedbits. Address/HEX Converter converts between theHEX, Integer, and Applesoft address formats. It alsoprovides the two byte breakdown of numbers greaterthan 256 for use in pointers, etc.

Screen Find is used for printing directly on thescreen by POKEing appropriate values into the properlocations in memory. Screen Find gives these valuesand locations when the characters desired and thehorizontal and vertical screen positions are input.Memory Move allows one to move blocks of memory

October, 1979

up or down any number of bytes from Integer orApplesoft. The Monitor has a routine similar to this,but it cannot be used to move blocks up a smalldistance and it is not possible to use it directly fromApplesoft.

STR$() simulates the function of this name inApplesoft for use in Integer programs. STR$() inApplesoft converts a number to a string. VAL() issimilar but converts strings to numbers.

Copies: Just ReleasedPrice: $16.95. Calif. residents add 6 per cent sales

tax.

Includes: Two cassettes or one diskette plusdoc rrnentatlon.

Author: ",oger WagnerAvallabln from:Local Apple dealers, or:Southwestern Data SystemsP.O. E ox 582-MCSantee, CA 92071(714) !,62-3670

Name: Softtouch Utility Pac II

System: APPLE IIMemory: 24K with DOSLanguage: Integer and Applesoft BASICHardware: Disk drive

Descript on: Set of nine programs on disk. Programsinclude iheckbook update to DOS, update electronicindex fil s, auto-write instructions, f ind hidden controlcharacters, slow/stop list, disk space, listing headers

and exec reader. A complete listing is provided for allprogram; and programming.

Checkbook update rewrites your original checkbookprogram for use with the disk drive. Routines havebeen added to change accounts or list bank nameswith ace aunt numbers, etc. Index update rewrites BobBishop':; electronic index file for completeautomation. A printing routine has been added forhard con.

Auto wrlte appends subroutines to existingprograms, converts integer BASIC listings toApplesoft or vice versa. Auto write documentationgives detailed instructions for using the program topatch in lines in any part of a program or deleteiUegal lilies such as 65535, etc. Find hidden controlcharacte displays any control character burried in acatalog name or any listing for both integer orApplesoft BASIC. Disk space is written in Applesoftand gives sectors and bytes left on a diskette. Notext files are created by the program and operating

time is three seconds. Slow/stop list may be loadedin and used continuously after switching disks orlanguages. Exec reader will read text files for all ofthe above with the exception of index file.

Price: $1 ~.95Includes: One diskette plus documentation.

Author: [Jr. Nick RomanoAvailable from:SofttouchP.O. a» 511Leominster, MA 01453

MICRO-- The6502 Jourr,al 17:51

Page 54: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 54/68

A Warning:

T he MACROTEA™is for ProfessionalProgrammers - and VerySerious Amateurs - Only

HypocycloldsE.D. Morris

3200 Washington StreetMidland, MI 48640

A modification to John Sherburne's original program

plots hypocycloids quite a bit faster, on the OSI, by

reducing the number of revolutions required. The

technique may be used on any micro.

I had just added the e::tra 2K ofmemory to my Ohio Sclentltl-i 440 videoboard to implement the graptics option,and was wondering what 10 do withthose 16,384 dots (128 x 1:!8) staringout from my monitor. I happe red to pickupthe March 79issue of MICFIOand wasintrigued by John Sherburne'; article on

plotting hypocycloids. A hypocycloid, ifyou don't remember, is what you getwhen one circle rolls inside another as inthe "Spirograph" toy. I immediately ac-cepted the challenge that if it can bedone on a PET, I could do it better on mymicro.

VISA, Mastercharge orders call (SOD)27-8398(ExceptCalif.)California orders please call (415)494-1210.

Skyles Electric Works10301Stonydale Drive,Cupertino, CA 95014,(408)735-7891

Now: a machine language pro-gramming powerhouse for the

knowledgeable programmer whowants to extend the PET's capa-bilities to the maximum. TheMacroTeA, the Relocating MacroText Editor:Assembler from SkylesElectric Works.

The Skyles MacroTeA is a superpowertul text editor. 26 powerfulediting commands. String search andreplace capability. Manuscript featurefor letters and other text. Text loadingand storage on tape or discs. Supportstape drives, discs, CRT, printers andkeyboard.

The Skyles MacroTeA is a relocatingmachine languageassemblerwith truemacro capabilities. A single nameidentifies a whole body of lines. Youwrite in big chunks, examine, modifyand assemble the complete program.And, when loading, the MacroTeAgoeswhere you want it to go. Macro andconditional assembly support. Auto-matic line numbering. Labels up to 10characters long.

The Skyles MacroTeAis an enhanceMonitor. 11 powerful commands toease you past the rough spots ofprogram debugging.

The Skyles MacroTeA is a wannstart button. Over 1700 bytes ofprotected RAMmemory for your objectcode.

There's no tape loading and nooccupying of valuable RAM memoryspace:The Skyles MacroTeAputs 10Kbytes of executable machine languagecode in ROM (from 9800 to BFFF-directly below the BASIC interpreter).2K bytes of RAM (9000 to 97FF).

Like all Skyles Products for the PET,it's practically plug inand go. No tools are needed: And, faster than loading an .equivalent size assernblerredltor from tape, the MacroTeAISinstalled permanently.

The Skyles MacroTeA: 13chips on a single PCB. Operatesinterfaced with the PET's parallel address and data bus or withthe Skyles Memory Connector. (When ordering, indicate if theMacroTeAwill interface with a Skyles Memory Expansion

System. You can save$20.) Specifications and engineering areup to the provenSkyles quality standards. Fully warr~nted.for 90days. And, as with all Skyles products, fully and Intelligently

documented.

ASSEM BLE LIST

~H'J~ :M OVE TBL 1 TO TBL2

~110 . BA $4~0

~40fl- AI IDB 0120 LOOP LO Y 1100

04~2- B9 illB 04 ~130 LO A TBL1.Y~40!i- 89 0B 05 0140 ST A TBL2Y

M 08- C8 015~ IN Y

Q)4 ID9 O (lJ F7 ID16(lJ BN E LOOP

(lJ17(lJ

0408 0180 TBL1 .OS 256

(lJ508 019(lJ TBL2 OS 25 6

(lJ2~(lJ

021(lJ EN

LABEL FILE 1 = =EXTERNAL

START==040~ LOOP==M ~2

T B~2 '" 0 5(lJ B110~(/J0,(/J6(/JB(/J6Q)B

T BL 1 = =Q )4 (lJ B

Page 55: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 55/68

The original hypocycloid program suf-fered greatly from lack of speed sinceeach point was calculated using fourtrigonometric functions. Approximately300 points per revolution were required.Even then, some gaps appeared in theresulting pattern. I was able to reducethe number of points calculated perrevolut ion to 30 by drawing straight linesegments between calculated points.This makes the resulting curves notquite as smooth, but very acceptable as

the accompanying photos illustrate. Thenumber appearing in the lower left cor-

ner indicates the number of revolutlonsrequired to complete the figure,

Below is the subprogram I used to fillin the space between calculated points(X1,Y1) and (X2,Y2). A different pro-cedure is used depending whether theslope of the plotted line is nearer the Xaxis or Y axis. Lines 1060-1065 and1160-1165 store the bit in merrory andare specific to my graphics ooard. Iwould be happy to provide a copy of thefull program to anyone who is uslnq the015 440 board with graphics.

1000 IF Xl=X2 THEN 11001010 A=(Y2-Yl)/(X2-Xl)1015 IF ABS(A»l THEN 11001020 B=Yl-A*Xl.0_51030 FOR X3=X2 TO Xl STEP SGN(Xl-X2)1040 Y3=INT(B+A*X3)1060 M=54272.16*Y3.INT(X3/B)1065 POKEM,PEEK(M)ORS(X3AND7)1070 NEXTX3:RETURN~100 IF Yl=Y2 THEN RETURN1110 A=(X2-Xl )/(Y2-Yl)

1120 B=Xl-A*Yl.0.51130 FOR Y3=Y2 TO Y1 STEP SGN(Yl-Y2)1'40 X3=INT(B+A*Y3)1160 M=54272.16*Y3+INT(X3/8)1165 POKEM,PEEK(M)ORS(X3AND7)1170 NEXT!31180 RETURN

1

J

To Order PROGRAMMER'S TOOLKIT or MACROTEA-

Custom designed to plug into your PET. So, when ordering, please indic at e if yourToolkit:,., will be used with the Skyles Memory Expansion System, or S80.00·

,.. will be used with the ExpandaPet, or Expandmem S80.00·,..will be used with the PET2001·8alone $80,00'

Your MacroTeA. Custom desiqned for your PET.So specify your PETmodel when orde ing.S395.00·

(Important Savings: If i t's to be used with a Skyles Memory Expansion System, the Ml croTeA canplug directly into the Skyles connector. So you save $20.The Skyles MacroTeA is ( nly $375.00when interfaced with the Skyles Memory Expansion System.)

Send your check or money order to Skyles Electric Werks, VISA, Mastercharge orders may call (800)227-8398. (California residents: please phone (415)494-12' 0.)Ten Day Unconditional Money-Back Guarantee on all products s lId by Skyles Electric Works, except chip ontv.

California residents: please add 6·6'h% California sales tax.

Skyles Electric Works 10301Stonydale Drive, ( upertlno, CA 95014,(408)735-7891

(We furnish connectors to the memory expansion bus and to the second casset te inter face.

... will be used with the PET2001·16,-32(chip only)

... wil l be used with Skyles MacroTeA

S50.OO·

$50.00'

Is Programming Fun?

Have More Fun,Make Fewer Errors,Complete Programs MuchFoster ... with the

BASICPROGRAMMER'S

TOOlKIT™

Now you can modify, polish, simplify,add new features to your PET pro-grams far more quickly while reducingthe potential for error.That all adds upto more fun . . . and the BASICProgrammer's ToolKit.The magic of the ToolKit: 2KB ofROM firmware on a single chip with acollection of machine language pro-grams available to you from the timeyou turn on your PETto the time youshut if off. No tapes to load or tointerfere with any running programs.And the Programmer's ToolKit installsin minutes, without tools.Hereare the 10commands that can

be yours instantly and automatically... guaranteed to make your BASICprogramming a pleasure:

AUTO RENUMBERHELP TRACEOFF APPENDFIND

DELETESTEPDUMP

Every one a powerful command toinsure more effective programming.Like the HELP command that showsthe line on which the error occurs... and the erroneous portion isindicated in reverse video:

HELP500 J = SQR(A 'B/~Ij)

READY

... Or the TRACE command thatlets you see the sequence in whichyour program is being executed in awindow in the upper corner of yourCRT:

The Programmer's ToolKit is aproduct of Harry Saal and his

associates at Palo Alto ICs.So, if you really want to be into

BASICprogramming - and you wantto havefun while you're doing it, orderyour BASIC Programmer's Toolkitnow. We guarantee you'll be de-lighted with it.

Page 56: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 56/68

rf::l"l~JRS-232

INTERFACE MODULE

r::ht:JGPIB OEEE-488)INTERFACE MODULE

CONNECTICUT microC()MPUTER, Inc.

150POCONO ROAD BROOKFIELD, CONNECTICUT 06804

@ ) [R ] ~ ~eVIIT.Me

TEL: (2 03 ) 7 75 -9 659 TW X: 71 0-456-0052

PETMOD

B8SENSORS

• TEMPERATURE

• VELOCITY

• PRESSURE

• db• pH• ACCELERATION

• HUMIDITY

• LIGHT LEVEL

• FLUID LEVEL

• ETC. ..

PET INTERFACE

nIMMOD

c;ruOKIM INTERFACE

~ q : = ~NALOG

MANIFOLDMODULE

~TRQMOD

TRS-80 INTERFACE

{ = : ~XPANDER

MODULETC.

MANUAL ANDDISPLAY MODULE

DAM SYSTEMS b", III,e

A co.pl ..hs~st ... of .odul ..s to let YOU co.puter listen

to the real world.

DAM SYSTEMS PRICE LIST

CABLE "AI' rnLerconnec~ Cables

e a on .. , 1 ; C O lf 'l lt .e r i nt .e rf iC O t o A I" !6 , I lA H D IS lo X P A H U l h . t.c.

$17<;>.00 CABLE A:';'~4 Int~Er'CGnnect C;:ablf~ ':.61'7'.9':.'J

2 . i ne t c ab l. w il.1 I i nt.e rf a< i! c oo n..,to r o n o no i! !1 d an d a n O C O N

. .. ivaJ nl on U 1 t olhor.

AIM161 - Analog Input Module

! . 9 -1 oi l a na lO !l in ts - !oo .ic r~ d coo 'ien li .. - 3

. law . ..lPul - r iro s an . 9 -Io il coo ...t .e r lPu l ... . l fo r

CIII lrol an d ano 9 -Io i l ~ t.er in flll PO I 'l fo r data.

POWl - Powel~ Module

Su~li .. f1IIOr fo r an . A I"!6 dol ••

$1.4.9~;MANIiI:~. ._Manual dn(j Dj.!;;~-;..l.al;:~odule TF.'~1

C c nn .. ,1 ' b e lw o on U 1 t A I" !6 a nd I . h o COI f I I t .e r , n t .e r f ace . 1U1_

l aRua l r c o o. .. t. er c e nl ro l of U 1 t A I H 16 . ~ i . . la"" cI\ ionnol

n u o b o r nd data.$9.95CON - Input Connector

F or c cn n..,lin S an alo s in ... ls to U 1 t A IM 6 - 20 p in card odSo

c cn n..,l or - s old or _ I.l s.

GPIB IOD - GPIB (IEEE-488) Interface

Al lows h o I lA I IS Y S TE l tS II ll tl lS t o b e u so d w i lh U 1 t bPIB bu.

i n .Wad of a c oo ...t.er 's o lho r I/O .... l • •

a'A

DeON - Output ConnEctorF o r " " ,n o o li n g 1 1 " , . A IM16 to a coo ...t .e r - 20 .in ea rd _

Cl llnoc: t .. r - " ,I do r O Y O lo ls .

RS232 MOD - RS232 lnl~r'face ModLlle

Al lows lie 1 M S Y ST E1 15 Il Il .U S t o b e u so d w ilh a n R S-2 32 ... . l

o r t.e r. ,a l.

TBA

$~:.:j9.~;MANMODl - Manifold Mc)dLlle

u . . . in .1 of I CON . Screw t . er . inal Oar., lr, . . fO l'

C IIIn ..,lin s llch . P<lW nli_t.e rs . 'lO ll sou rces, ot.c .

Hi. ,nOw. lho _ fO l' sold orin !. ? lu "" in to lho MM6 .

XPANlli1 - Expander Module

Al lows I' to !2 9 8 -b i l an alO S in flll . (a A I" !6 I 'o Id ul o. ) t o b e

ccnnec t . j to eno . ~ I a .fBA

ANAMAN1 - Ana.log Manifold Module 'fBA

1M in p I .... of ICO N . C cnnoo l. 1M SY SID IS ~ to lho AI" !6

w ilh au l so ld or,n S - " " ' § O r cab l .. ... .. l .luS in . ?Iu s . into U 1 t

AlIIl6orl.ho~!.

TEA DAM !YSTEMS setsSENSORSSonso r. fo r _a lu ro , p res .. ro. flow . Ill.id ilo . 1.... .. 1. PH .

I oO li e n , o t .c .AIM16: Starter Set

I nc lu d e O l IO A II I1 6 !, OlIO P Il I! , o no I C I I I an d en o o c i JN .$189.00

COMPUTER INTERFACE~; TE lA

Fo r U 1 t PET , KI", TRS -BO , o t .c . \J!;o in .Ia ce of 0CtII . Eli. inaw.

I . h o ROOd f or " ' Id o r in ~ 01' 5H !C ia l c e n .l r uc l ie n . AIM161 Starter Set 2

Indude one A III161 , eno PIII l, eno 1W IIlD ! and eno O CO H.

PETMOD - PET Interface Module $49.95GiV lS tw o IE EE .... l ., en , u ... . P OI 'l a nd C lIO 1M S YS ID tS

i nt .e rf ac o P O I' l. Saws w ea r a nd w ar 11 \ I . h o P ET '. p ri nW d

c irc uil b oard . A lso c allod I . h o PETS!M! .

PETSElla

Ind_ OlIO PETIIJD, OlIO CAlli 112. , lilt A I" !6 !, en , P IlI! and

OlIO MIl m i.

KIMSElla

l oc lu do ! O lI OK II II ID , e n, C A B LE 11 2., lilt AI"16!, e no P IlI! a nd

OlIO 1WI1l1.

$;285. o o

i nt .e rf ac o P O I' l.

KIMMOD - KIM Interface Module $39.95

Gi... . . OlIO _lie alion ca nn ..,lo r P OI'l a nd o no IlA II ST SID tS

Page 57: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 57/68

SYM·1 6532 Programmable Timer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

The 6532 interval timer is useful as a backup tlmek: ieper

or as a loop controller. It can be accessed in two, lIays,

independent of the interrupt system, and employ sd to

meet a variety of realtime program requirements .

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

In addition to the programmable ports

and interval timers located in the 6522s,

the SYM-1 has an interval timer in the

6532_ The 6532-style device is also used

on the KIM-1, and so knowing how to use

the SYM timer properly will help in

understanding KIM programs and

enable the SYM programmer t" adapt

KIM programs for use on his SYM more

easlty,

The 6532 timer does not have its IRQ

line connected to the IRQ input of the

6502_Therefore, lacking direct access to

the interrupt structure, we are unable to

get as precise a level of timing as with

the onboard 65225_ However, if an extra

timer or loop controller is required, the

6532 may prove to be useful.

Before using the timer in the 6532, one

must first clear the interrupt tlaqs. Since

all of the features we intend to use are

part of the write-protected memory, we

must first of all allow access to this

area, This is accomplished by:

20 868B JSR ACCESS

Then, to clear the interrupt flag (PA7

flag), we will read the interrupt flag

register. This may be accomplished by

reading anyone of four locations: A405,

A407, A410 or A41 F, typically by execut-

ing the instruction:

AD 05 A4 LOA INTREG

After this instruction is executed, the

interrupt flag register will contain " B O " _

This register will be cleared to "00"

when we write a value into the timer

register. We may then go back occa-

sionally during program execution, test

to see if the flag register is still zero, andbranch if it is not zero.

)

As another alternative, we can do a

BIT test on the flag location, checking

only the timer flag for the branch condi-

tion. This method has been used in the

sample proqrarn. If the BIT test is used,

it is not necessry to read the interrupt

register in order to clear the PA7 flag

because this flag will not be tested, Theinitial read instruction then becomes

redundant.

October, 1979

At this point, we must dec ide how

many clock cycles are to elaps e before

the timer flag becomes set. The 1we willwrite the selected value into the counter.

There ar-e four different p lints at

which to enter data into the counter,

A41C, A41O, A41E and A41F_ T,ese are

indicated in the manual as HT, 64T

and 1024T. These multiples m Ian that

any data which is entered nto the

counter will begin at that p srtlcutar

count and decrement at the ra e of the

clock frequency (H), or at on ~ decre-

ment for each eight clock cye les (8T),

one decrement for each 64 c loc K cycles(64T) or one decrement for es ch 1024

clock cycles (1024T)_

There is only one timer regi: iter, but

the four addresses mentioned a love are

the means by which the treque lCY pre-

divider is set. For example, if - s e write

"01" into location A41E, the timor flag is

reset and, 64 clock cycles later, t le timer

flag is set again. If we write" )1" into

location A41 F, instead, then II e timer

flag will not be reset until 10: 4 clockcycles have elapsed.

Just as an example, let's say we

wanted B O O clock cycles to elapse

before the timer flag is set. WE will be

reading the flag register period cally to

see if it is non-zero, determine whether

the flag gets set, and branch on he non-

zero condition. Writing decimal 00 (hex64) into location A410 sets 116 pre-

divider; to 8 then, 8 x 100 = 810 ticks

later, the timer reaches zero and the flag

is set.

While the counter is lndeps ndently

decrementing, we can determine the cur-

rent timer contents at any t me byreading one of these four 10' :ations:A404, A406, A41C, A41E. There Ire four

readable locations due to "don t care"

addressing modes or incompl s te ad-

dress decoding.

One might be tempted to 1001 at the

timer contents, occaalonallj , and

branch when the count reache s zero.

This does not offer a good cha lee for

success as the following exam ite will

show.

MICRO -- The 6502 Jour tal

Robert A_ Peck

1276 RieSling Terrace

Sunnyvale, CA 94087

Let's say we've written "OA" (decimal

10) into location A410 (8T) so that 80

cycles later the timer will count down to

zero. Suppose we do the following dur-

ing the counting period:

(A) Increment a memory location

(B) Test timer contents

(C) Branch back if non-zero

If the sequence of operations takes

seven machine cycles, then after 77

cycles the timer will still be at "01" and

after 77 + 7 = 84 cycles the timer will

contain a count of zero since more than

80 cycles have elapsed, right? Wrong!

Unfortunately, it will contain "FC" in-

stead! The limitation of this counter is

that, as soon as zero is reached and the

flag is set, the counter continues to

decrement, but it no longer matters

which counter multiple was being used

because as the counter immediately

begins to free-run decrement at the H

rate_

To overcome this limitation, since we

do not use the IRQ and since we only

sample occasionally, we Will generally

read the interrupt register, testing for a

non-zero figure, rather than reading the

timer and looking for zero contents as

shown above.

Now we come to an example program

which ties everything together and

demonstrates the use of this timer.

Location 200 may be set for any desired

timer value. Location 20F may be set to

1C, 10, 12E, or 1F dependinq upon

whether you want to operate the timer

with a predivide of H, 8T, 64T, or 1024T.

You will notice that the loop of instruc-

tions between locations 211 and 224

takes a total of 28 machine cycles to ex-

ecute.

Begin program execution at location

200. The display will light, upon comple-

tion indicating how many times the pro-

gram was able to .traverse the loop

before the timer flag became set.

17:55

Page 58: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 58/68

Letters

Having trouble running mnemonically-

entered programs on your AIM-65?Thismight be one source of the problem.

According to the AIM-55 User's Guide,

indirect indexed addressing mode may

be entered by using either "(HH,Y" or"(HH)Y" where "HH" is a hexadecimal

byte, The AIM-55Summary Card lists thealternatives "(HH,Y" or "(HH,Y)"_

However, only the format "(HH)Y" willassemble correctly.

The formats (HH,Y and (HH, 'f) will beassembled incorrectly as indexed in-direct instructions, "(HH,X)".

Don Stein6012Chatsworth Lane

Bethesda, MD 20014

DON L A N C A S T E R ' S

I N C R E D I B L E S E C R E T

M O N E Y M A C H I N E

A cookbook for creatingyour own computer or

tech venture.

, \ I - :r Y"

~~~, \\ $6.95Autographed

andPostpaid

S Y N E R C i E T I C S BOX1077 M

THATCHER,AZ 85552

I Send__ ISMM's ( I Check ( I Visa

I Send FREELancaster Booklist

Name __

Address _

Cttv Stare __ ZIP _

Visa - - - _

Exp__ Siqnature _

17:56

• P OGRAHMABLE TIMER DEMONSTRATION PROGRAM

•• B' ROBERT A. PECK• M < DIFIED BY MICRO STAFF'

•0241024102410241

ACCISS· $8B86

OUTISP • $89Cl

OUTI I T • $82FAS CA t D • $8906

ORG $0200LDAIM $00 STORE ZERO INSTA $OOAO AREA RESERVED FOR TOTAL

STA $OOA 1JSR ACCESS UNPROTECT SYSTEM RAMLD A $A41F CLEAR PA7 FLAG, OPTIONAL HERE

LDAIM $FF LOAD TIMER PRESE1 NUMBERSTA $A41D ESTABLISH 8 AS PRE-DIVIDE

TMIN SED TIME = 25 5 * 8T = 2 040 C YCL ESLDA $OOAO SET DECIMAL MODEADCIM $01 LOAD AO AND ADD ONESTA $OOAO PUT IT BACK

LDA $OOAl IF THERE'S A CARRYADCIM $00 ADD IT INST A $00A1 AND RESTORE

02000200 A9 00

0202 85 AO0204 85 A 10206 20 86 8B0209 AD lF A4

020C A9 FF020E 8D 1D A4( )2 11 F 8

0212 AS AO0214 69 010216 8S AO

0218 AS Al021A 69 00021C 85 A1021E D8

021F 2C OS A40222 30 030224 4C 11 020227 A9 20 TMOU'0229 20 C1 89

022C A5 A 1022E 20 FA 820231 A5 AO

0233 20 FA 820236 A9 200238 20 C1 89

023B 20 06 89 DSCAt023E 4C 3B 02

CLD CLEAR DECIMAL MODE

BIT $A40S TEST TIMER FLAGBMI TMOUT BRANCH IF MINUS FLAG IS SET

JMP TMIN JUMP BACK AND DO IT AGAINLDAIM $20 ASCII BLANKJSR OUTDSP SEND IT TO DISBUF

LDA $OOA 1 GET CONTENTS OF A 1JSR OUTBn SEND IT TO DISBUFLDA $OOAO NOW GET AO

JSR OUTBYTLDAIM $20 ASCII BLANKJSR OUTDSP

JSR SCAND SCAN THE DISPLAYJMP DSCAN DO IT CONTINUOUSLY

SYMBOL TABLE 2000 2' 2A

ACCESS 8886 DSCAJ 0238SCAND 8906 TMIN 0211

OUTBYT 82FATI'10U1 0227

OU'TDSP 89Cl

a program, in BASIC, to print it whenneeded.

While working on a lea ,ing ratecalculation program in Kim BASIC I

found the need for a list of variablesavailable so that Icould crcs ;;out theones I used in my program. I f( und sucha list in MICRO 4:4 and decide j to write

Henri Reiher4236MadisonMontreal, QUEBEC

CANADA H4B2T9

100 REM PROG TO SHOW I UMERICAL AND STRING VARIABLES AVAILABLE IN110 REM MICROSOFT BAS]: AS USED IN PET-APPLE-TRS80 AND OTHERS115 REM REF: M I C R ) APRIL-MAY 78 PAGE 4:4

120 FOR X = 65 TO 90

1 25 P RI NT13 0 P RI NT CH R(X );" " ;140 FOR Y = 0 TO 9145 Y$ = CHR(X) + N UM ( r ) + " "

147 REM INSTEAD OF NU~ :Y) YOU CAN USE STR$(Y)150 PRINT Y$;155 NEXT Y160 FOR Z = 65 TO 901 70 P RI NT C HR (X ); CH R( ZI ;" " ;180 NEXT Z20 0 P RI NT210 NEXT X220 END

MICRO-- The 6502 JOL mal October, 1979

Page 59: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 59/68

More LETTERS

I have a SYM-1. While debugging aprogram that usesthe timer in the 6532Ifound out that the IRO pin is not con-

nected to the IRO bus. Rather than

spend a lot of time finding the neatest

way to connect the 6532 IRO pin to theIRO bus, I simply ran a piece of wirewrap stock between the IRO pin on the

6532 to the nearby 6522. Now I can use

the interrupt feature of the 6532.I do not

knowwhether Synertekdid this for a par-

ticular reason IbutI havenot had any pro-

blems since making this little modifica-tion. Perhaps you are already aware ofthis. I just thought I would pass it along,for what it is worth.

Keith Le Baron1260 S. BlackhawkFreeport, IL 61032

There is a useful, but unadvertised,display subroutine in the AIM-65

Monitor. It is labeled OUTDD1,and can

becalled by a JSR instruction to hexad-dress EF7B.

[Editor's Note: Marvin De Jong

demonstrated the USE! of this subroutinein an earlier issue of MICRO. Since,

however, Don Stein independently

"found" it and thinks that it is importantenough to point out to other AIM users,

we are printing his letter.]he subroutine displays the ASCIIcharacter which is in the accumulator,

at the relative position (0 - 19decimal, oro - 13 hexadecimal) indicated by the Xregister. It returns with A and X contentsintact.

[Editor's Note: If you have some smallbit (byte?) of information that you wish

to pass on to fellow computerists, a

short letter to MICRO is one simple wayto "pass the word along".]

Before calling the subroutine, be sureto ORA #80, or else the hardware cursorwill be displayed.

Don Stein6012 Cilatsworth LaneBethesda, MD 20014

)I

TEXTCAST~1!!l

Turn your PET into a WORD PROCESSORcomparable to large systems for a fractionof the cost!

CREATE-REVIEW-EDIT FILESON TAPES OR DISKS

PRINT TEXT-LETTERS-FORMS-TABLES

TEXTCAST FITS YOUR PETSYSTEM, OLD AND NEW ROMS

CLEAR INSTRUCTIONS!

Prices: Tape plus manual, $60.

Diskette plus manual, $65.Manual separately, $20.

Write: Cognitive ProductsP.O. Box 2592CHAPEL HILL, N_C. 27514

PETTrademark of Commodore BusinessMachines, Inc.

)

October, 1979

DISK DRIVE WOES? PRINTER INTERACTION?

MEMORY LOSS? ERRATIC OPERATION?

DON'T BLAME THE SOFTWARE!

~

~~

. ISO-1Power Line Spikes. Surges& Hashcould be the CUlprit!

Floppies, printers, memory & processor often interact!

Our unique ISOLATORS eliminate equipmen t interaction

AND curb damaging Power Line Spikes, Surgesand Hash.

*ISOLA TOR OSO-l A) 3 filter isolated 3-prong sockets;

integral Surge/Spike Suppression; 1875 W Maximum load,

1 KW load-any socket _ ..... _ . . . . . . .. $54.95

*ISOLATOR (lSO-2) 2 filter isolated 3-pron:~ socket banks;

(6 sockets total-); integral Spike/Surge Suppression;

1875 W Max load, 1 KW either bank. . . . . .. $54.95

"SUPER ISOLATOR (ISO-3), simil_arto ISO·1A

except double filtering & Suppression . . .. $79.95

"ISOLA TOR (150-4), similar to 150-1 A except

unit has 6 individually filtered sockets. . .. $93.95

"ISOLATOR (lSO-5), similar to ISO-2 except

unit has 3 socket banks. 9 sockets total ... $76.95

"CIRCUIT BREAKER, any model (add-CBI Add $ 6_00

*CKT BRKRISWITCH/PILOT any model

(-CBS) •.•...••.•••.•... . Add $11.00

• PHONE ORDERS 1-617-655-1532 ..

BZ7Electronic Specialists~, Inc. -171South Main Street. Natick. Mass. 01760

Dept.mi

MICRO -- The 6502 Journal 17:57

Page 60: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 60/68

F R E E ' up to S170 in merchandise• with the purchase of PET-CBM

= - - - = - = - = = - = . : . item!!! FREEMERCH.

PET 16K large Keyboard $ 995 $130

PET 3 2K large Keyboard $1295 $170PET8K $ 795 $100P ET 2040 D ual Disk (343K) $1295 $170

PET 2 02 3 P rin te r (p re s fe ed ) $ 849 $110PET 2 02 2 P rin te r ( tr ae fe ed ) $ 995 $130

KIM -1 $159 ( Ad d $ 30 f or P o we r S up pl y) SYM-1

6500 P roq rarn rn in q M an ua l2114 L 450 ns 5.90 24/5.15

2716 EP ROM (5 V olt)6550 RAM (fo r B K P ET)6502 M ic ropro cesso r C hip6522 V IA6520 P IAP ET 4 V oice M usic Board (M TUK-1002-2)M usic Softw are (K-1002-3C) for P ETP rogram mers T oolkit - P ET RO M UtilitiesM icrochess 2.0 for PET or AP PLEP ET W ore! P rocessor - M achin e Lan guage

3M "Scotch" 8" disks3M "S co tc h" 5 " diske tte sVe rbatim 5 " d iske ttes 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Cassettes (a ll ta pe s g ua ra nte ed )

P rem ium quality, high output lown oise in 5 sc rewhousin g w ith la bels:

C-10 10/5.95 50/25.00 100/48 .00

C-30 1017.00 50/30.00 100/57.00

WRI TE FOR 6 50 2 AND S -IOO PRODUCT L IS T

1 15 ~B E . S tump Road

A B Compute rs Mon tg ome ry ville . PA 1 89 36699-8386

S A L E

$222.00

6.50100/4.45

42.0012.709.759.755.50

$ 49.00$ 19.00$ 45.0017.~024.00

10/$31 _

10/$35 §10/$27 §

PRESENTS IT'S

• • • • • • • U T I L I T Y P A C I I • • • • • • •

CHECKBOOK UPDATE TO DOS

AN EXEC FILE WRITES OVER YOUR CHECKBOOKPROGRAM TO AUTOMATICALLY UPDATE IT TO DOS

IND EX F I I~E UPDATEAUTOMATES BISHOP'S INDEX FILE

• F I N O CON 'rROL CHARACTERWILL DISPLAY CONTROL CHARACTERS ON ANYCATALOG OR PROGRAM LISTING

SLOW L ISTFULL STOP & START CONTROL WITH EXIT. WORKSWITH APPLESOFT OR INTEGER BASIC

LI ST HEADERSPUT HEADERS ON YOUR LISTINGS WITH NO LINE

NUMBERS OR REM STATEMENTS. AP II

A UTO W RITE

AUTO WR lTE I N STRUCTl ONSUSE EXEC FILES TO APPEND, ADD SUBROUTINES,OR EDIT PROGRAMS. CONVERT INTEGER TO APPLE-

SOFT. DELETE ILLEGAL LINE NUMBERS ETC. ETC.

EX EC REA DE RREADS TEXT FILES FOR ABOVE

DISC SPACECOMPLETELY WRITTEN IN APPLESOFT. WORKS

IN 3 SECONDS. GIVES FREE SECTORS AND BYTES

W ITH LIST INGS AND DOCUM -ENTATlON , PR ICE $19 ,95. . . . . . . . . . D I S C M A N A G E M E N T S Y S T E M . .

EIGHT PROGRAMS ON DISK TO PROVIDE THE USER WITH ACOMPLETE UNOERSTANDING OF THE DISK DRIVE COMMANDS

PLUS A UTILITY PACKAGE TO INDEX & CATAGORIZE ALLPROGRAMS WRITTEN FOR THE APPLE II COMPUTER. THE

SYSTEM PROVIDES FULL SEARCH, EDITING AN.D DATA

T RA NS FE R C AP AB IL IT IE S.

A TWENTY-SII PAGE BOOKLET PROVIDES DETAILED,EDUCATIONAL TEQUNIQUES GIVING A THROUGH UNDERSTAND-

LNG OF THE DOS COMMANDS.

SYSTEM REQUIREMENTS: DISK II & APPLESOFT TAPE OR ROM

PRICE $19.95 ON DISK FOR EITHER OF ABOVE

(PROCESSED & SHIPPED WITHIN 4 DAYS)

SEND CHECK OR MONEY ORDER TO:

~ SOFTOUCH •.. P.O. BO'X 511 '

LEOMINSTER, MASS. 01453 ~,

Put Yourself in Control with the

-APPLETHROTTLEThat's ightl The APPLE THROTTLE will tum

your g1me paddles into a speed con troUer.

By sim )ly pushing a button, you can stop

your cc mputer for as long as you want.

Relel lS< the button, and your computer

enters Islo....motion mode with one

paddle contro lling the speed. And if that

i sn 't en ough, look a t these additi onal

feature,,,

• Plug" into any slot

• Worl s wi th machine language , Integer

BASiC, and Applesoft

• Nornal . s low . stop

• Use '0UST, TRACE, RUN, et c.

• NO :;oFTWARE to load

• Unvei l progrem secre ts =AP PLETH RO TTLE ..... $89.95

And th. re's more! No more multiple UST commands to v iew small program

section". With t he APPlE T HR O T TL E , you'll be able to list or trace long

progran IS while watching your program flow in slow·motion. So get in control

wi th the APPI.E .THROTTLE and order yours today!

PROTOBOARD,with <Ner 1300

holes on 0. 1 centers for designing

your own circuits,

APB·1Protoboard .... $17.95

APPLlnIME,a Real TIme Cock

for the J pple U.Plugs directly into any

slot an:l keeps time even when

com put er is off. Features 12/24Hour, E COl ASOI data format, and

AC/Cry. tal time base selection .

Include software examples for

~hi",' language and BASIC pro.

grams. Completely assembled and

tested.

APT·1 Real TIme Clock $79.95

VERBATIM 5'1." DISKETTESSoft-Sector B ox of 1 0 ... $34.50

(plastic file case included)

P V E N T U R EGAMES OF HIGH ADVENTURE

FOR THE APPLE II FROM

sYNERGISTIC !:¥lFTWARE

5221 120th Ave. S.£.

Bellevue, WA 98006

The II,pventure games combine the exciting graphics andsound effects capabilities of the APPLE II with the fas-cina1ing complexity of a mythical adventure game.Mon iters, hazards, obstacles, weapons, magical devicesand nvil powers confront the player at every turn asyou J8ther treasure and try to reach your goal. Twoadve rtures are now available:

DUNGEON CAMPAIGN· Full color graphicssubterranean adventure. 16K required.

CASS, $12.50 DISK $15.00

'IVILDERNESS CAMPAIGN· HIRES graphics;;urface adventure. 48K required.

CASSo $15.00 DISK $17.50

GET BOTH ON ONE. DISK FOR $:10.00

(WA Res. add 5.3% sales tax)

Page 61: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 61/68

A Real·Time Clock for OS;I Disk Systems

Did you know that your OSI disk·based system has mostof the hardware you need for a realtime clock already

built in? Here is information on how to use it.

For most personal and business

applications, the need for keeping track

of time is either not verygreat or can behandled by special software routines for

particular applications. Where micro-

computers are involved in process con-trol operations, however, such as in thereal-tlrne control of laboratory ex-periments, precise timekeeping is a

must. Here the initiation and sequencing

of most computer-controlled events

must be held in tight lock-step with areal rime clock.

Owners of Ohio Scientific ChallengerII and III disk-based systems may not be

aware that provision for a real-time clockalready exists on their 470 disk con-

troller board. The bottom middle section

of this board contains the PC foilS to

mount three 74390decade counter IC's.

These divide the on-board 1MHzcrystalclock to provide pulses ranging from 1to

100,000 per second, selectable at the

user's option.

Timing pulsesmay befed into the NMIor IRQ lines of the OSIbus (pins 2 or 3)

where the 6502will seethem as interrupt

Signals. The software to handle an

interrupt-driven, time keeping routine

must have been loaded into memoryprior to turning the clock on, or it maybe

permanently located in PROMat a con-venient memory address.

One example of how the hardwaremay be implemented is shown in Figure1. A 0.1 Hz clock pulse from the third

NMI

'-. < C L O C KswPIA-PORT B

BIT " 4 > "

3 2

74¢¢

8 9 10 II 12 13 14

270 JI. . .

+5

Figure 1

October, 1979 MICRO -- The 6502Journal

Robert T. Kintz104Council Rock Avenue

Rochester, NY 14610

74390is fed into both inputs of a two-

input nand gate (7.'00) after passing

through a switch located on the frontpanel. The 7400 may be convenientlylocated in the prototyping area just

below the three 74390's on the 470board.

The second input to the two nandgates is taken from bit "0" of a 6821PIA

located on the500or !510CPUboard.The

outputs of the two 7400gates are fed to

the NMI bus line and a front panel LED,

respectively. The brlqhtly flashing LEDserves as a reminder that the clock isrunning, following turning the switch

"on" and setting bit "0" high.

The actual interrupt handling andclock routines have been written inmachine language, as shown, where

they have been assarnbled to start at$6900 (26880).Of course, relocation of

these routines, as well as the clock

counters, is entirely optional. Be sure,

however, that they are!located above theworkspace occupied by BASIC or other

applications programs.

A BASIC demonstration program in-corporating the clock is also shown.Lines 50-70set up the PIA on the CPU

board (63232)so that ports A and Bareconfigured as inputs and outputs,respectively. Since OSI's PROMmonitorvectors to $0130on receipt of an NMI in-

terrupt, lines 90·100POKEa jump to thestart of the interrupt handling routine.

Next, in lines 120·140, the machine

language object code is read as dataand POKEd into high memory. The

decimal equivalents of the object code

are represented as DATA in lines

9010-9110. Lines 200··220now set the

clock counter locations to "0" and weare ready to turn the clock switch "ON".

Once this is accomplished, the clockis under program and/or keyboard con-

trol via POKEs to the PIA PORT B, bit"0." Applications proqrarns inserted atline 300mayuse the clock byPEEKingat

the appropriate clock counter locations.

17:59

Page 62: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 62/68

695'7 HOURS • $69786957 MIN • $69796957 SECS • $697A5957 FSEC • $6978 10 PRIN ':PRINT"REAL-T INE CLOCK FOR DISK-BASED OSI SYSTEM S'

5900 ORG $6900 20 PRIN':PRINT"ROBERT T. KINTZ, ROCHESTER, NEU YORK"

5900 48 START PHA30 P RIN ':P RIN T"RUNS U HDER OSI O PERAT ING SYST EN O S-65D,V .l.0"

590 I 8A TX A40 REft ' •• SET UP P lAiPORT A=INPUT ,PORT B=OUTPUT U....~.H.

690;? 48 PHA ~o X '6] !32:REft P IA ADDRESS OF ~OO OR 510 CPU BOARD

6903 98 TY A 60 POKE X 'I,O:POKE X 'J,O:POKE X ,O

69 0 11 48 PHA70 POKE X '2,255:POKE X 'I,4,POKE X+3,4,POKE X '2,0

6905 20 OE 69 JS R CLOCK80 REN ••• SET UP CLOCK ROUTINE .......... ,.. ~ ...... ,., ..........

6908 68 PLA90 REN INI V ECT ORS TO 10130(304)

6909 A8 TAY100 REN 16900(26880)=START OF CLOCK ROUTINE

6901 1.68 PLA110 POK 304,76:P OKE 305,O:P OKE 306,105

690B AA TAX 120 REN ••• READ IN NAC CODE AS DATA ••• *.****.***' ••:••, . * . * * , .690e 68 PLA 130 fOR CLK=26B80 TO 26964

690D 40 RTI 140 REA ftAC:POKE CLK,NAC,NEXT CLK

690E 78 CLOCK SE I 1~0 REft ... CLOCK COUNTER LOCATIONS ;•• :i'" ••• *••• :i:i***"* .:i••••690F F8 SE D

1 60 REN 1 69 78 (2 70 00 )= HOURS

691 o 18 CL C 170 REN S6979( 27001 )=N INUTES

6911 AD 7B 69 LOA FSEC 180 REN 1697A (2 7002) =SECONDS

6914 69 01 ADCIM $ 01 1 90 RE ft 1 69 7' (2 70 03 )= TENTHS

6916 80 78 69 STA FSEC 200 REN ••• P OKE RESET INTO COUNTER LOCAT IONS , , , .: i :;***.*** .,* *

6919 38 SE C 210 FOR CL=27000 TO 27003

691A E9 10 SBCIM $0010 220 POKI CL,O,NEXT CL

691 C DO 36 BNE END 210 REN ••• TURN THE CLOCK SUITCH TO 'ON' .. u.........'•••••

691 E 80 7B 69 STA FSEC 240 PHil T :PRINT"TURN THE CLOCK SUITCH TO 'ON' ••• "

6921 AD 7A 69 LOA SECS 250 PRII T "THEN PRESS 'G ', 'RETURN'": INPUT A t

6924 18 CLC 260 IF! H>'G' THEN 250

6925 69 01 ADCIM $01270 R Eft ••• P OKE ST ART INT O CLOC K GAT E •••••••••••••••••••••

6927 80 7A 69 STA SECS 280 P OK( X'2,1

692A 38 SEC 290 P RII T :P RINT 'CLOCK LED SHOULD NOU BE BLiNIKING"

692B E960

SBCIM$0060 3 0 0 R E" • • • •• • •• • •• •

~ . * . . . . . . . . . . . . . . ..* •• * ," * * • • * * . * . * * . * . ~

6920 DO 2'5 BNE END 350 REN USER'S PROGRAM CAN BE INSERTED HEKE

692F 80 7A 69 STA SECS 400 REK TO USE CLOCK, P EEK AT COUNTER LOCAT IONS

6932 AD 79 69 LOA MIN 500 REH ***.* •• * *. ** * • •• * • • • • • • • • • • • • * . * * . ~ . * . * . : . * . * * • • ~**~*

6935 18 CLC 8999 REI ••• HAC CODE DATA FOR CLOCK ROUTINE . .. * : f :. * ·H : " • • * :t;·t ..

6936 69 01 ADCIM $01 9010 DA1~ 72 ,1 38 ,7 2 ,1 52 ,7 2 ,3 2, (4 ,1 0 5

6938 80 79 69 STA MI N 9 02 0 DAH 1 0~ ,1 08 ,I O~ ,1 70 ,1 0~ ,H ,1 20

693B 38 SEC 9030 DA lI 2 4, 1 73 ,1 23 , 10 5, 10 5 ,1 ,1 41 , 12 3

693C E9 60 SBCIM $0060 9040 DAH 105 ,~ 6 ,2 33 ,IO ,2 08 ,5 4 ,1 41 ,1 2 3, I0 5

693E DO 14 BNE END 9 05 0 DAl I 1 73 ,1 22 ,1 05 ,2 4, 10 5, 1, 14 (, 12 2

6940 8D 79 69 STA MIN 9060 DA11 105 , 56 ,2 33 , 60 ,2 08 , 37 ,1 41 , 12 2

6943 AD 18 69 LOA HOURS 9070 DA11 105 ,1 7 3, 12 1, 1 0~ ,2 4, 1 05 ,1 ,1 4 1

6946 18 CLC 9 00 0 DAn 1 2I ,1 05 ,5 6, 23 3, 60 ,2 08 ,2 0, 1~ 1

6947 59 01 ADCIM $0 1 9 09 0 DAn 1 21 ,1 05 ,1 73 ,( 20 ,1 05 ,2 4, 10 5, 1

6949 80 78 69 STA HOURS 9100 DA1\ 1 41 , 12 0, 10 5 ,5 6, 23 3 ,2 ~, 20 8 ,3

6 9 u C 38 SEC 9 11 0 D An 1 ~1 ,1 20 ,1 05 ,2 16 ,9 6

69 11 D E9 24 SBCIM $24 9120 Rn ••• TURN 'OFF' THE CLOCK .' ••••• '••••. 1 • • • • • • • • • • ' . " ' • • • •

694F DO 03 BNE END 9130 f'O~: X t2,O

6951 80 78 69 STA HOURS 9140 RE~ ii . " :f • • • 1 : . " . . **..... * . . . . . . . . . . . . . . . * • • : t; . ~ ,. : ., .. : •• ** ......1 1 : . " "

69511 08 END CLD 9999 END

6955 58 CLI6956 60 RTS

ODDoltfOlflNG ( : P

17:60 MICRO -- The 6502 JOl mal

MOVING?

Please notify MICRO of any

change of address so that you will

not miss any issues, If we receive

the Ghange of address informa-

tion by the 10th 01 ' the month, then

the next issue 01 ' MICRO will be

sent to the new address. We can

not be responsible for teotectnt;

Issues which are missed due to

changes of address which you do

not send in time, The Post Officedoes NOT return tile undeliverable

copies - so we lose both the

postage and the magazine,

Send change of address to:

MICRO

P,O, Box 6502

Chelmsford, MA 01824

Please include old label or your

subscription number.

October, 1979

Page 63: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 63/68

6502 Bibliography: Part XIII

Dr. William R. Dial

438 Roslyn Avenue

Akron, OH 44320

478. The Cider Press 2 No.1 (April, 1979)

Scribblernonger, John, "FORTH, Ver 1.6", pg. 1.

Forth for the APPLE is 20 times faster than BASIC.

Silverman, Ken, "Computer Terms". pg. 2.

APPLE terms defined and explained.

Nareff, Max J., "Max your APPLE", pg. 2

Another in a series' of articles designed to simulate

the various MAtriX functions on the APPLE.

Larsen, Leroy W., "Still another BSTAT", pg. 2.

This BSTAT offers choice of hex or decimal and gives you

CATALOG so you can enter the name of the program

exactly with the cursor and save the program with another

cursor move on the APPLE.

Bernard, Phil, "Storing Strings on Tape, or, Is Disk

Necessary?", pg. 3.

Anon, "Disk of the Month", pg. 3.

Twenty-five programs on disk.

Vrooman, Gerry, "The APPLE II Memory Map De-Fogger",

pg.4.

Explanation of where various functions are in memory.

Rahl, Robert R., "N·N-N-N-N-N-N-N-N", pg. 6.

Another version of the Hello program for the APPLE

disk combining a few new gimmicks.

479. Byte 4 No 4 (April, 1979)

Campbell, Richard, "Cross Pollinating the APPLE II", pgs.20-25.

A serial I/O port based on an Intel 8251 with RS-232

output.

Zimmerman, Mark, "Simulating Physical Systems - The

Two-Dimensional Ideal Gas", pgs. 26-41.

Use yOUI"PET to experiment with physical models.

Meushaw, Robert V. "The Standard Data Encryption

Algorithm", pgs. 110-126.

Using the KIM-1 in encryption.

480. KB Microcomputing (formerly Kilobaud) No 29 (May,1979)

Lindsay, Len, "PET-Pourri", pgs. 6-7.New PET versions of the Microtechnology Unlimited

KIM music board and visible memory are in the offing.

More on tape head alignment on the PET. A TAPE TEST

program from Jim Butterfield is listed.

Anon., "OSI Small Systems Journal", pgs. 8.11

The OSI Small Systems Journal is now published as a

section of Microcomputing.

Anon., "New Products", pgs. 14-25.

A new control board for PET, An ADC Adapter module

for PET, and Superchip for the APPLE.

Knox, Thomas; Brazil, Ray H.; and Richardson, Robert M.

"Letters to the Editor". DOS.23-24.

October, 1979

l.ntters discuss advantages and disa.dvantages of APPLE

II and TRS-80.

Pepper, Clement S., "KIMCTR", pgs. 34-38.

Hils KIM-1 frequency counter/timer can be used with any

m cro with comparable features.

481. Southeastern Software Newsletter Nlo 8 (April 1979)

McClelland, Geo., "A Fast Circle Drawing Program", pg.2.Or! the APPLE Use $FDOC, RDKEY. With several exam-

ples, a good tutorial. Also explains exclusive OR.

McClelland, Geo., "Program to Print Applesoft Tokens",

pg.4.

LiBting of a program to supplement an earlier program to

pri nt Integer BASIC tokens.

McC eiland, Geo., "Searching for a Small String Embodied

in a Larger String", pg. 5.

Sirnple listing to use with files or data statements,

etc.

McClelland, Geo., "Running Disk Programs the Easy Way",

pg 6.US3 of the cursor makes reading in those program titles

easy.

482_ 6!i02 User Notes No 14 (April 1979)

Zube, Jim, "KIM-1 Banner", pgs. 1-9.

De siqned for a 40-column printer.

Larrabee, Robert D., "Check-Out", pgs. 9-14.

How to check out a new program on the KIM without

hal'ing to continually hit the plus key. Back up feature.

And ability to ADD some material in the middle of a pro-gram.

Schilling, Heinz Joachim, "BASIC Mod and ProgrammingHirt", pg 12.

A modification to correct a problem of reloading

programs on the KIM using Microsoft BASIC.

Grabowsky, Dick, "BASIC Output Pagin9 Mod", pgs 12-13.

How to limit program listing to 16 lines at a time on the

Killil using Microsoft BASIC.McKenna, Sean, "Automatic Line Number Entry Prompt forBA!)JC", pg 13.

An automatic line numbering input routine for 9-digit KIMBABIC.

Herman, Harvey, "Renumber Addendum and Some Mods",

pg.13.

Hins for KIM Microsoft BASIC.

Grabowsky, Dick, "A New Command for BASIC", pg 15.

Implementing the GET command in KIM BASIC.

Anon, "Computer Language Forum", pg. 17.

NOt'lS and discussions of FOCAL, Tiny BASIC, FORTHand XPLO.

MICRO -- The 6502 Journal 17:61

Page 64: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 64/68

Mackay, !I,.M., "Accessing the SYM Displays", pg. 18.

A program to output characters on the display.

Kingston, C., "SYM Notes and KIM·4 Compatibility", pg. 18.

Interfacing details for these two units.

Adams, Jim, "Wumpus and Music Box for SYM", pg. 20.

Modifications to implement these two programs on the

SYM.

Nelis, Jody, "Manual Corrections", pgs. 20-?3.

Corrections for the AIM User's Manual.

Merhar, Milan, "TVT-6 Notes and RAM Expansion", pgs.24-25.

TVT-6 discussion and a way to fill the lower 4K in KIM.

McCormack, Chris, "Cassette Directory Printout Program",

pgs. 25-:26.

Prints your tape directory on your TTY or terminal.

483. Stems from Apple 2 No 4 (April, 1979)

Gustafson, Gus, "INT/FP Stop List Program", pg. 4.

BASIC programs for Stop List.

Gustafson, Gus, "Apple Disk Copy Program", pg. 5.

Modified program to permit using two cards and multiple

drives.

Sittel, Randy, "Program FRE(O)", pg. 5.

Routines for free bytes no matter what the memory.

484. Circuit News, April 15, 1979

Anon., "Microcomputers Monitor Oil Well Operation"

APPLE II is used in monitoring off shore oil well drilling

processes, displaying information continuously on a silent 700

printer and an H-P X-Y plotter.

485. The Pet Gazette, Spring, 1979

Anon., "Beautiful Music", pg 1, 21.

Micro Technology Unlimited is coming out with a PET

version of the KIM music board (DAC) and the visible

memory.

Butterfield, Jim, 'Routines from PET BASIC", pgs. 2-6.

A listing of a large number of routines from PET BASIC.

Anon., "PET Tokens", pg. 8.

A listing of the 255 PET Tokens.

Butterfield, Jim, "Thoughts on PET BASIC", pgs. 10-12.

Hints for PET users, GET statements, the PET timer,

precautions for amateur mechaniCS, print suppression,

etc.

Sherman, H., "Machine Language Load Program", pg. 14.

A BASIC program which loads a machine language

routine into the PET.

Anon., "Trace", pg. 18.

A machine language program for tracing the progress of a

BASIC program.

Strasma, Jim, "Installing a Second Keyboard", pgs. 20-21.

Instructions and discussion of the keyboard installation.

Butterfield, Jim, "Unlist-List Protection", pg. 21.

How to protect your program listing.

Albrecht, Bob and' Karl, "PET BASIC for Parents and

Teachers", pgs. 24-25.Part 6 of this continuing tutorial.

Butterfield, Jim, "PET Memory Locations", pgs. 26-28.

Listing of a large number of key locations and functions.

Butterfield, Jim, "Tape Head Alignment", pg 32.

Procedure and program listing of a tape test to help

solve this important problem.

486. Design News, April 23, 1979

Stefanides, E.J., "Personal Computers Become Tool of the

Average Man", pgs. 42-48.

17:62

487. B) te 4 No 5 (May, 1979)

Pfeif 'er, Erich A., "Aids for Hand Assembling Programs",

pg s. 238-244.

Th 3 article's assembly method is used for program

de lelopment on a KIM-l microcomputer.

488. Southeastern Software Newsletter Issue No 9 (May, 1979)

Hartley, Tim, "Stop-List", pg. 1.

St. ip-List which works with Applesoft.

Hartley, Tim, and McClelland, Geo., "Character Set", pg. 2.A nachine code program to print the entire character

se . Also a discussion of how the program works and the

us lof the disassembler.

Anor., "Applesoft II Merge Program", pg. 3.

Fo disk or tape versions or ROM version AS II.

Hartt ay . Tim, "HI-Res Drawing Program", pgs. 4-5.

Wr tten for a disk system with the AS II ROM card but

me ds are given to change it for use on other combina-

tio is.

Anon., "Correcting Disk Files", pgs. 5-?

An addition to the NAMES FILES program given in

earner issues.

489. MI'~RO No_ 12 (May, 1979)

Burrutt, Joe, "An AIM 65 User's Notes", pgs. 5-7.

No es on getting started with the AIM 65.

Ca r p s nter, Chuck, "S-C Assembler II - Super APPLE II

Asrernbler", pgs 9-11.

Ma rhine or assembly language codinq is as easy as

BA ,IC with this assembler.

Dona 0, Joseph, "A PET Hex Dump Program", pgs. 13·15.

No v you can look at your BASIC in ROM or other

lntrrestlnq codes in machine ianpuaqe.

Giery c, Jack, "Super HI-LO for the SYM-l", pgs. 17-22.

H 1 - _ 0 with a new twist to the game.

Willia l1S, J.C., "A 100 us 16-Channel Analog-to-Digital

Converter for 65XX Microcomputer Systems", pg. 25-29.

How real-time games can be written for the OSI

Ch..llenqer systems which use a serial terminal run from

the ACIA.

Tripp, Robert M., "ASK the Doctor - Part IV. Good News,Bac News", pgs 35-36.GOI,d news is that only two minor hardware changes

irnc rove the high-speed cassette read/write. The KIM read

rou ine is also improved, new uses for the BREAK

con rrnand are given, and now the register name is

dlsulayed during the R command.

Rowe. Mike (Staff), "The MICRO Software Catalog: VIII",

pgs 37-38.

Ele' en new programs are described.

Doutr», Ben, "Inside the KIM TTY Service", pgs. 39-40.

HOI' to operate the KIM TTY link at 91300 baud.

Kirsct ner, Frank D., "The Integer BASIC Token System In

the APPLE II", pgs. 41-43.

Hovr APPLE stores characters. A meaty article showing

hov to exercise considerably more control over the BASIC

inte 'preter in your microcomputer.

Carpe iter, Chuck, "Renumber Applesoft", pgs. 45-46.

Ape end and renumber routines.

Anon. "Classified Index for Issues 7 to 12", pgs. 47-48.

lnde x is broken down by system - APPLE, OSI, General.

KIM'TIM, SYM/AIM, and so on.

490_ 73 I~agazine No 12 (May, 1979)

Schm dt, Bill and Shattuck, Bob, "RTTY Transceive for theKI~-l", pgs. 78-82.

Thl: program requires a video terminal and AFSK genera-

tor.

MICRO -- The 6502 Jou 'nal October, 1979

Page 65: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 65/68

L iftle B uffered M otherThe ultimate Motherboard for any KIM-1,SYM-1,or AIM-65 system

Features:

• 4K Static RAM on board

• +5V, +12V,and -12Vregulatorsonboard

• 4 + 1 buffered expansion slots

• Accepts KIM-4 compatible boards

• Full access to application & expansionconnector

• LEDindicators for IRQ, NMI, and power-on

• Also compatible with SEA-1,SEA-16, thePROMMER, SEA-PROTO,SEA-ISDC, and more

For further information contact:

SEAWELLMarketing Inc.

P.O. Box 17006Seattle, WA 98107

• Onboc rd hardware for optional use of

(128K c ddressing limit)

• Mounfs like KIM-4 or with CPU board stand-ingup

• 10 slot lv1otherboard expansion available -SEAWEl.L'sMaxi Mother

Standard $139

w 14K RAM. . . . . . . . . . . . . . . . . . $189

Assembled Only

SEAWELLMarketing Inc.

315 N.W. 85th

Seattle, WA98117(206) 782-9480

Page 66: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 66/68

POWEB§OF~INC.P. O. BOX 157PITMAN, NEW JERSEY 08071

(609) 589-5500

APPLESOFT II UTILITY

products for the

APPLEII

(Diskette Only) $12.45

The Applesoft II Utility program provides the user with the following features. a) Complete automatic renumbering of any Applesoft II

program. b) The creation of an EXEC File for subroutine file creation. This feature allows you to incorporate the same subroutine in various pro-

grams. c) NCImodification of the program in machine memory (RAM). d) Automatic running of the program. No programmer should be without

this excellent uti lity program. REQUIREMENTS: Disk II, Applesoft II, 16K of memory.

REAL ESTATE ANALYSIS PROGRAM $14.95

The Real Estate Analysis Program provides the user wi th three features. a) A pcwerful real estate investment analysis for buy/sell decisions

and time to hold decisions for opt imal rental /commercial investments. b) Generation of complete amorization schedules consistent with banking

practices and schedules. c) Generation of depreciation schedules for selecting the best depreciation schedule for your use and a determination of

optimal swi tch over points to straight line to maximize depreciation. All three features li re designed for video screen or printer output. In addition,

the program wi ll plot; cash flow before taxes vs. years, cash flow after taxes vs. years, adjusted basis vs. years, capital gains vs.years, pre-tax pro-

ceeds vs. years, post-tax proceeds vs. years, and return on investment (%) vs. years. RECUIREMENTS: Applesoft II, 16K of memory without DOS

or 32K of memory with DOS (Disk II).

ADDRESS FILE GENERATOR $19.95

A professional piece of software which allows the user to create four different types of address files: a) Holiday File, b) Birthday File,

c) Home Address File, and d) Commercial Address File. The program contains a menu af seven major commands: 1) Create a File, 2) Add to File,

3) Edit File, 4) Display File, 5) Search File, 6) Sort File, and 7) Reorganize File. Most of the major commands have subordinate commands which

adds to the flexibility of this powerful software system. We doubt you could buy a better program for maintaining and printing address files.

REQUIREMENTS: Disk II, Apple Printer Card, 32K of memory with Applesoft Rm. Card or 48K of memory without Applesoft ROM Card.

SUPER CHECKBOOK $19.95

A totally new checkbook program with a unique option ... Bar Graphs. These bar graphs, outputed to a printer orvideo screen, provide

trend analysis data on code expense, income, expenses. or gain/loss on a month by month basis. The program contains a total of fourteen options:

1) Check/Deposit Entry & Modification, 2) Reconciliation of Checks or Deposits, 3) S<'rt by Check Number, 4) Sort by Code for Year, 5) Sort by

Code for Month, 6) Output Year to Date, 7) Output Month Activity, 8-11) PrinterlVicleo Plot Trend Analysis-Bar Graphs, 12) Account Status,

13) Reconci led Check Status, and 14) Quit. An excel lent program for maintaining your ;heckbook, or that of a smal l business. RIEQUIREMENTS:

Disk II, 32K of memory with Applesoft ROM Card or 48K of memory without Appleso1t ROM Card.

FUNCTION GRAPHS AND TRANSFORMATIONS $14.95

This program uses the Apple II high resolution graphics capabilities to draw detailed

graphs of mathematical functions which the user defines in Basic syntax. The graphs app lar in a

large rectangle whose edges are X and Y scales (with values labeled by up to 6 digits). Graphs

can be superimposed, erased, drawn asdashed (rather than sol id) curves, and transformed. The

transformations available are ref lect ion about anaxis, stretching or compressing (change of scale),

and sliding (translation). The user can alternate between the graphic display and a text c lisplay

which lists the available commands and the more recent interactions between user and program.

Expected users are engineers, mathematicians, and researchers in the natural and social sriences;

in addition, teachers and students can use the program to approach topics in Itor enmple)

algebra, trigonometry, and analytic geometry in a visual, intuitive, and experimental wa\ which

complements the traditional, primarily symbolic orientation. REQUIREMENTS: 16K of

memory with Applesoft ROM Card or 32K of memory without Applesoft ROM Card.

• I \ I

• J'_,'. . . . . -,I.. III.. ,. . . .

4 ""

Available at your local compute. store

Call or write for our freeSOFTWARE & ACCE,iSOR/ES CATALOG

DEALER INQUIRIES INV~

POWEH§OFT, INC.P. o. BOX 157

PITMAN, NEW JERSEY 08071

(609) 589-5500Apple II isa reginared

trademark of Apple c.omputer, Inc.

• Check or Monay Order

• Inelude $1.00 forshipping and handling

• C.O.D. ($1.00 add'tl . charge)

• Master Char~leand VISAorders accepted

• Naw Jersay residents add5% sales tax

Programs Available on Disketteat $5.00 Additional

Page 67: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 67/68

softside-sorrware0~ Riveuide Drive New York. N.Y. 1002~

t le · -et progeam,1

GRAPHICS PAC 2 Quadruple your PET's graphic resolution. Why be

stuck with the PET's cumbersome 25 x 40 1000 pointdisplay. With Gr aphics Pac you can directly control

(set and clear) 4000 points on screen. It's great for grep, ling, plotting, and gaming. Graphics

Pac allows you to plot in any combination of two modes: t Quadrant graphing with (0,0) center

screen, and Standard graphing with (0,0) plotted in the upper left hand corner. Complete docu-

mentation shows how you can merge this useful routine vi th any of your own programs with-

out retyping either one! All this on a high quality Mil .rosette for only $9.95.

New Version

2ASSEMBLER 2001 A full featured a ssernb ler for your PET microcompu-

ter that follows he standard set of 6502 mnemonics.

Now vou can ta ce full advantage of the computingabilities of your PET. Store and load via tape, run throug h the SYS or USR functions. List and

edit too with this powerful assembler. No other commerc ial PETassembler gives you all these

features plus the ability to look at the PET'S secret Basic ROMs all in one program. This valu-

able program is offered at $15.95

3nventory. workers. prices. machines. and ad campa gns to keep your enterprise in the

black. Bike is dangerously addictive. Once you start a game you will not want to stop. To

allow you to take short rest breaks. Bike lets you stor.: the data from your game on a tape

so you can continue where you left off next time you vish to play. Worth a million in fun,

we'll offer BIKE at $995.

PINBALL

BIKE An exciting n sw simulation that puts you In

charge of a bic: 'cle manufacturing empire. Juggle

inflation, br eak downs, seasonal sales variations,

4Dynamic u sag. of the PET's graphics features

when combined with the fun of the number 1arcade

game equals ar action packed video spectacle for

your computer. Bumpers. chutes. flippers. free balls gates. a jackpot. and a little luckgua rantee a great game for all. $995.

A uthors: Our ro

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ties are unbeatable

*SPECIAL****** MUSICAL MADDNESS ******

add an exciting new dimension to ~our PET computer

with Soundwares soundsatior al music boxand sonic sound software from Sof1side & Soundware

*OUND

*THE SOUNDWORKS *The Soundware music box for your PET

comes complete with controllable volume.

an earphone jack, a demo tape with two

programs, an instruction book, and a one

year warranty. this sturdy unit is enclosed

in an attractive plastic case. Notes tell

how to program your own sound effects.

All this during our musical madness for

just 29.95

*MUSICAL SOFTWARE ,ZACTIOl1 PACK: Breakthru + Target ~

Catterpllar: non stop graphic action 9.95

PINBA ~L: a video action spectacle with

real tin e flippers, chutes gates. bumpers.

tags etr . . 9.95

CLASSCS: Checkers + Backgammon

Board -Piano Player; checkers VS. com-

puter 0:' friend. Piano plays Minute Waltz9.95

MUSIC MANIA: Try to repeat a growing

sequent e of tones. With graphics .. Chal-

lenge t(, the best ear 9.95wo rm FUN: Speller: fun ways to practice

spelling + Scramble + Flashcards 9.95

Page 68: Micro 6502 Journal October 1979

8/3/2019 Micro 6502 Journal October 1979

http://slidepdf.com/reader/full/micro-6502-journal-october-1979 68/68

Skyles Electric Works

You love your PET , but you'll

love it more with this BigKeyboardl

74KB Big KeyBoards @ $125.00 (Plus $5.00 shipping & handling)

The Skyles Big KeyBoard™. More than 15 inches wide. A layout nearly ~

identical to the PET Keyboard and with all functions-alpha, numeric, Sgraphics, special symbols, lower case alpha -on full-sized, almost plump, .

key-tops double-shot to guarantee lifetime durability.Actual size

Would you like to turn on your PET

. . . and see thisaKB 8K Memory Expansion Systems @ $250.00

(Plus $3.50 shipping & handling)

l6KS 16KMemory Expansion Systems @ $450.00(Plus $5.00 shipping & handling)

24KB 24K Memory Expansion Systems @ $650.00(Plus $5.00 shipping & handling)

Skyles Memory Expansion Systems are complete; nothing more to buy .• First quality

static RAMs. Solid soldered on first quality glass epoxy board. Separate PET AdapterPrinted Circuit Board connects directly to data bus on your PET - no rat's nest of hang-ing hand-wiring. Ribbon cable and 50 pin connectors that keep your PET open to the

outside world (one on the 8KB; two on the 16KB and 24KB).

__ 8KBMemory Expansion System(s) at $250 each. $ _(Adds 8,192 bytes; total15,3 59)(shipping and handling $3.50 each)

__ 16KBMemory Expansion System(s) at $450 each. $ _

(Adds 16,384 bytes; total 23,551) (shipping and handling $5.00 each)

__ 24KB Memory Expansion System(s) at $650 each. $ _(Adds 14,576 bytes; total 31,743) (shipping and handling $7.00 each)

_._74KB BigKey Board(s) at $125 $ _