Transcript
Page 1: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 1/86

$2.50$3,00

C f J

oI-«~wII-«~

o

NO. 70 MATHEMATICS

for the Serious Coml?_uterist

* Bezier Curves* Credit Card Register* Plotting Fractals* Multiplication on 6809 vs. 6502* Compiling BASIC Subroutines

Page 2: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 2/86

Page 3: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 3/86

CAD / CAM ! DON 'T SPEND 25k , 50kr $500 ,000 BEFORE YOU SPEND $79 00

s book w ill provide m anagers.

n ee rs . ma nu fa ctu rin g p ers on ne lany inte rested persons an

rs ta nd in g o f th e fu nd amenta ls o f

m puter A ided D esign [CA D] and

t er A id edmanu fa c tu rin g [CAM ]

ca t ions and techno logy.

program w ill expose you to the

io u s CAD /CAM term in o lo g ie s u sed .

dw are a nd s oftw a re c omparis on sbe e xplo re d w it h heavyemphasis on

ir a dv an ta ge s a nd d is ad va nta ge s.

ju s tif ic a tio n and imp lementat io n

p re se nte d u sin g c as e s tu die s.

course is des igned fo r bu t no tto:

T hose m anagers. eng ineers and

ch pro fess iona ls assoc iated w i thmanu fa c tu rin g in dus tr y.

Personnel from P roduct. Tools ign. P lan t Layou t and P lan t

g ineering who are inte rested in

ND RESULTwi llenab lepar t ic ipan ts to :

L ea rn b as ic CAD /CAM Vo ca bu la ry .e tt er u nde rs ta nd t he va rio u s ha rd -

re a nd s oftw are c omp on en ts u s-

d in a ty pic al C AD w ork s ta tio n.

e lect the ex is ting CAD /CAM

ystem m ost appropriate fo r cur-

e nt a nd p ro je cte d n ee ds .

a ke a n e ffe ctiv e c os t ju stific atio n

s to W hy they SHOULD orHOULD NOT imp lement a

CAM sys tem .

5 . A p ply a nd u se c ompute r g ra ph ic s a s

a p roduc tiv it y t oo l.

PROGRAMCONTENT1 . Int roduct ion

a . H is to ry o f C AD/C AM

b . Im p orta nc e o f C AD/C AM

2 . G ra ph ic s w o rk s ta tio n p erip he ra ls

a . In pu t

b . O u tp ut

c . Ad van ta ges and d isadvanta ges

o f in pu t a nd o utp ut d ev ic es .

3. Computer G r aph ic s Sys tems[Hardware]

a . M i cr os

b . M in is

c. M ain F ra me s

d . Tu rn key G r aph ic s syst ems

4. Softwarea . Ope ra tin g systems

b . G r aph ic s Packages

c . G ra ph ic s Mo du le s

5 . C omp ute r A id ed D es ig na . Geome tr ic De fin it io n s

[Po in ts . L in e s. C ir cle s . ETC. .)

b . Con tr ol f un c tio n s

c . G raph ics Man ipu la ti ons

d . D ra ft in g Func tio n s

e . F i ling funct ions

f. Appl icat ions

z 0

rm·,:I

·,,c

li,i,•I CONTINUING EDUCATION FOil BETTEIl:! C A D I C A M :l; A P R O D U C T IV IT Y! r : m E N H A N C EM E N T T O O L

. . .

6 . Imp lemen tat iona . D e te rm in in g n ee ds

b . Pu rchas in g and In s ta llin g

c . G e ttin g S ta rte d

7 . C o st J us tific atio n a nd Su rv ey

a . C ost com parisons o f tw o and four

w o rk s ta tio n s ys tems.

b. P resenta tion of recent survey of

C AD s ys tem u se rs

ZAN IM SYSTEMS MAKESTH ISSPEC IAL

OFFER: IF YOU BUY CAD /CAM : A

PR OD UC TIV IT Y E NH AN CEME NT

T OOL BEFOR EAPR IL 1 5T H. W E W IL L

INCLUDE F R E E OFCHARGETHESE TWO

PAPERS PUBL ISHED NATIONAL LY BY

Z AN IM SYS TEMS C AD /C AM EXPER T.

1. "C re atio n o f a L arg e D ata B ase fo r

a Sma ll G ra ph ic s S y stem "

2 . "S ho rte st P ath A lg orith m U sin g

Compute r G r aph ic s "O f course you cou ld spend as m uch as

$495. $595 or $695 for a s im ilar 3 day

sem inar even though th is book is not a

computer p ro g ram .

W e te ll you April 15th fo r a spec ia l

reason ... th is p roduct m ay be tax

deductib le depend ing on your fie ld or

n ee ds . T his 1 70 p ag e c ou rs e w ill s atis fy

any o f your CAD /CAM needs. W e

guar an te e it .

P le ase se nd $ 79 to :

ZAN 1M SYSTEMS

CAD/CAM GROUP

P.O. BOX 4384

FLINT IMI48504

(313) 233-5731

Q U A N T IT Y D IS C O U N TS A V A IL A B L E F O R C O LL E G E S •

U N IV E R S IT IE S A N D IO R S E M IN A R U S E .

r

f !I

\

II

Ii

I ~

Page 4: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 4/86

I A l C A O ' ·

A Simple Assembly Listing ...

Having recently improved our

techniques for producing BASIC

listings, MICRO focused its attentionthis month on improving the Assembly

Listing process. Producing an assembly

listing may appear to be a fairly trivial

task for a magazine. The author sends

in a copy of his assembler's printout

and you print it. This may not provide

the reader with the best listings due to

variations in quality, size, type of

information output, and variations in

listings by different assemblers.

MICRO has taken a number of steps to

improve the assembly listings which

involved custom programming and a

lot of work, but we believe the end

result is worth it.

Transferring to FOCUS

The first step is to get the original

listing, provided by the author in some

machine readable media, onto our

6809-based FOCUS system.

Techniques have been developed to

transfer text between the FOCUS and

the Apple, At ar i, Coco and

Commodore computers.

Editorial

Listing Standardization

The FOCUS word processor is used to

'standardize' the listings. Its

search/replace function is used to

make changes quickly and accurately.

The 'standard' that has been selected is

the LISA 2.5 running on the Apple II.

Rather than discuss the minor

eccentricities of the LISA,I suggest you

look at some of the listings in this issue

tosee the standards. A couple are worth

mentioning. The LISAdoes not require

(or accept) the Aregister designation in

the ROL, ROR, LSR,or ASL

instructions. It requires a special

pseudo-op, EPZ to equate page zero

addresses. These, and other minor

changes, are made. Then the LISA-fied

text file is transmitted to the Apple II.

Running LISA

LISAis instructed to accept input from

the serial port by a CTRL-D, IN#2,

RETURN. A transmit program on the

FOCUS sends a line of text tothe Apple

at 1200 baud, and then waits

approximately 1.5 seconds between

lines to permit LISA to do its

housekeeping.

LISA is instructed to assemble the

file with the output directed to the

FOCUS via serial port by the command

CTRL·D, PR#2, RETURN.

MICRO·izing the Listing

LISA output contains more than we

need for the magazine listing. A

FOCUS program converts LISAoutput

to a 'MICRO' format. The example

below shows the difference in output.

Is ItWorth It?

It takes a lot of work to get the listings

right. Now that the special programs

have been written it is easier, but still

requires time and effort. Is it worth it?I

think so. An important feature of

MICRO is its support of assembly

language programming. It is important

that the listings are not only accurate,

but that they are in a form that is easy

for all readers to understand. We

welcome, as always, your comments

and suggestions.

Editor-in-Chief

0 8 0 0 4 ; R E Q U I R E S 0 0 5 + U T I L I T I E S @ S C X X X0 8 0 0 5 ;

C O O O 9 O R G S C O O vC O O O 1 0 O B J S 0 8 0 0C O O O 1 1 ,O O F D 1 2 N U H L E P Z $ F OO O F E 1 3 N U H H E P r S F EC 8 8 F 1 5 0 4 E Q U $ C 8 8 F ; D O S P L U S R O U T I N E S . R E Q U I R E S O O S + U T I L I T I E S @ i C X X X

C F B I 2 1 S C R R C L E Q U $ C F B Ij

C O O O 3 1 j C O O O O R G i C O O I )

C O O O 2 0 9 9 C F 3 2 F R H P T R J S R S C R S A V : ~ A K E S U R E ;

C 0 0 3 A 9 4 5 3 3 L O A 1 $ 4 5 ; D E F A U L T I S O O F D N U H L E Q U $ F O

C 0 4 1 5 0 5 2 4 F 5 2 I l S C P R O W R I T E R - - C O N N E C T I O N ' O O F E N U H H E Q U $ F E

C 0 4 4 5 7 5 2 4 9 C 8 8 F 0 4 E Q U i C 8 8 F j O O S P L U s R O U T I N E S

C I ) 4 7 5 4 4 5 5 2 C F B I S C R R C L E Q U f C F B I

C 0 4 A 2 0 2 D 4 3 ;

C 0 4 0 4 F 4 E 4 E C O O O 2 C > 9 9 C F F R H P T R J S R S C R S A V ; H A K E S U R E

C O S O 4 S 4 3 5 4 C 0 0 3 A 9 4 5 L O A 1 $ 4 5 j O E F A U L T 1 5

C 0 5 3 4 9 4 F 4 E C 0 4 1 5 0 5 2 4 F A S C ' P R O W R I T E R - · C D N N E C T I O N '

C 0 5 6 9 2 0 0 0 0 5 3 B Y T i 9 2 . $ 0 0 , i O O C O 5 6 9 2 0 0 0 0 B Y T $ 9 2 , $ O O , $ O D

C 4 F 7 3 6 2 E N D C 4 F i E N D

2 MICRONo. 70 - March 1984

Page 5: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 5/86

Page 6: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 6/86

MICROP.O. Box 6502

Chelmsford, MA 01824617/256-3649

PubllsherIEdltor·ln·ChlefRobert M. Tripp

Associate PublisherCindy Kocher

Production ManagerJennifer Collins

Technical EditorMark Morano

Advertising ManagerCindy Kocher

Sales ManagerC. Skip Bentle

Circulation ManagerLinda Hensdill

Customer ServiceKim Dundas

AccountingDonna M. Tripp

Contributing EditorsCornel is Bongers

Phil DaleyDavid Malmberg

John Steiner

Jim StrasmaPaul SwansonRichard C. Vile, Jr.

Loren Wright

MICRO is published monthly by:

MICRO, Chelmsford, MA01824.

Second Class postage paid at:

Chelmsford, MA 01824 and additional

mailing offices.

USPS Publication Number: 483470.

ISSN: 0271-9002.

Send subscriptions, change of address,

USPS Form 3579, requests for back issues

and all othe fulfillment questions to:

MICRO

P.O.Box 6502Chelmsford, MA 01824

or call 617/256-3649.

Subscription Rates: (per year):U.S. $24.00or $42.00 for two yearsForeign surface mail: $27.00Air mail: Europe $42.00Mexico, Central America, Middle East,North Africa, Central Africa $48.00

South America, South Africa, Far East,Australia, New Zealand $72.00

Copyright © 1984 by MICRO.Ali Rights Reserved.

4

for the Serious Computerist

Features15 Least-SquaresCurve FitterBrian Flynn

Plot and depict theapparent trend betweenvariables (such as stocksand interest rates)

26 Credit RegisterJoseph Kattan

Keep track of credit cardpurchases as they occur

35 DOSPLUS forCommodore 64,Part 3Michael J. KeryanA machine languagemonitor, a printerformatting program, arepeat key toggle, and akill function.

42 Bezier Curves:Richard H. Turpin

The Bezier method allowsa curve to be representedwith a minimum amountof data.

50 PEEKing Tom:PI.ayingwithBASIC's InternalsMark Johansen

Find how and wherethings are done withinalmost any system.

62 On Multiplication:The 6809 Versusthe 6502Comelis Bongers

A new board allows aninteresting experiment.

70 Compile YourBASIC SubroutinesAnn Marie Lancaster

and Cliff Long

Combining Interpreted andCompiled BASIC can givea fast, easy method ofworking

74 Plotting FractalsOn Your Computer

Simon WardropPlotting fractals (irregularshapes) can often producebeautiful results; they callinto question ourdefinition of length

Departments

2 Editorial

6 Reviews in Brief24 Graphics ContestWinners

32 CoCo BitsJohn Steiner

41 From Here to AtariPaul S. Swanson

54 Interface ClinicRalph Tenny

59 Commodore CompassLoren Wright

78 From Here to AtariPaul S. Swanson

79 Listing Conventions

80 Advertiser Index

MICRO No. 70· March 1984

Page 7: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 7/86

This famous book now contains the most comprehensive description of firmwareand hardware ever published for the whole Apple 1 / family. A new section withguide, atlas and gazeteer now provides Apple lie specific information.

• Gives names and locations of various Monitor,

DOS, Integer BASIC and Applesoft routines andtells what they're used for

• Lists Peeks, Pokes and Calls in over 2000memory locations

This expanded edition is available at the new low price of only $19.95

• Allows easy movement between BASIC and

Machine Language• Explains how to use the information for easier,better, faster software writing

For the 35,000 people who already own previous editions,the lie Appendix is available separately for just $5.00.

~ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ~Please send me:___ What's Where In the Apple @ $19.95ea.

(Plus $2.00 per copy shipping/handling) Name

___ Apple lie Appendix @ $5.00 ea.

(includes shipping charges)

Mass residents add 5% sales tax $

Address

State Zipity

Total Enclosed $ Signature _

o Cheek 0 VISA 0 MasterCard

For faster servicePhone 617/256-3649

Acet # _ Expires _

I

: MICRO, P.O. Box 6502, Chelmsford, MA 01824

I ~

r

!

Page 8: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 8/86

I A l eAO"R eviews in B rie fProduct Name:

Equip. Req'd:

Price:

Manufacturer:

ANA-LIST

Apple II+ 48K, Disk Drive

$150

Synoptic Software, Inc.57 Reservior Lane

Chestnut Hill, MA 02167

Dot addressable graphics are supported and an Ap-pak is

available for Apple owners with full software support for

screen dumps including different sizes and alignment.

Pluses: A very nice, quiet, high quality printer. The

graphics software is easy to use.

Minuses: The plastic cover to deaden the printing sound

is inconvenient to feed the paper through.

Documentation: An 80+ page technical manual and a50+ pageAp-pak reference manual are included. They areterse, well written manuals.

Skill level: No prior knowledge necessary.

Reviewer: Phil Daley

Product Name:

Equip. Req'd:

Price:

Aztec C

Apple II, II+, or lIe with 2 disks

$199 (diskettes with software and

manual in notebook

Manx Software Systems

P.O. Box 55

Shrewsbury, N J 07701

Description: A new list management program. It takes

lists or tables of data and allows the user to rearrange the

entries to his liking. The program will take advantage of

the existence of a 16K card by expanding the maximum

number of items in a list that can be handled.

Pluses: Without question, this program's greatest plus is

its ability touse input data structured in DIFformat. This,

of course, makes Visicalc data entirely manageable. Few

other pure data base management packages I've seen can

do that. Congratulations to Synoptic for spotting an

unfilled niche in the market. Another nice feature worth

mentioning is the program's speed. Things happen fast.

Minuses: It is somewhat surprising that a package being

released now by a company that has clearly done its

marketing homework does not have features specifically

designed to take advantage of Apple lIe capabilities. In

fact, the lIe isn't enen mentioned in the manual so, if you

have a Ile, you would be wise to check with the company

about possible idiosyncrasies. Additionally, I thought the

package was overpriced, though not so much as other

similar items.

Documentation: Overall, I was pleased with the manual.

The manufacturer resisted the temptation to fill the

tutorial with banalities and has kept each chapter

functional. I do have one complaint. For $150 the user

surely deserves better paper for the manual, and he

certainly deserves index tabs of plastic. The paper ones

supplied will tear off within a few days of constant use.

But it really is quite good.

Skill level: A novice who follows the manual should have

no trouble using the product.

Reviewer: Chris Williams

Printmate 99 Printer

Serial, Parallel or IEEEInterface

Product Name:

Equip. Req'd:

Price:

Manufacturer:

*

Micro Peripherals, Inc.

4426 Century Drive

Salt Lake City, UT 84107

Description: A high quality dot-matrix printer with bi-

directional printing, true descenders and one-pass

underlining capability, the 99prints 80characters per line.

While printing normally with a 5 x 9 dot matrix, a serif

font is included for letter quality type in an 11 x 9 matrix.

6

Manufacturer:

Description: Aztec C is a complete development system

for writing C language programs on the Apple II. There are

3 diskettes full of goodies: two C compilers, a 6502

assembler, a pseudo-code assembler for assembling the

pseudo-code generated by one of the two compilers, a

linker, several runtime libraries, a full-screen editor, a

command interpreter (called SHELL, after the UNIX

command interpreter), utilities for constructing object

libraries and source archives, and various other programs.

The implementation of the C language seems to support

the full language as specified in the book byKernighan and

Ritchie. The system uses and produces files which are in

DOS 3.3 format on the disk. However, you must BRUN

SHELL in order to interact most conveniently with the

system.

Pluses: This is a complete development system. The only

software that I can think of that rivals it for the price

would be Apple Pascal(or the UCSD P-System). The

system provides a bare bones UNIX-like environment: the

SHELLprovides the 5 or 6most popular UNIX commands.

You get C source code for a large part of the software

provided with the system, somodifications are possible.

Minuses: You have to think hard to find any. There are

some bugs in the native code generated by the C65

compiler. However, Manx is fixing them and provides

updated software. Disk access performance is not

optimized sothere is painfully slow development time. To

prepare a few line program takes almost 5 minutes

MICRO No. 70 - March 1984

Page 9: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 9/86

(compare to UCSD's less than a minute).

Documentation: A notebook with 8 112 x 11 pages has 5

ample sections and two appendices. A bit terse forbeginners, but adequate for seasoned programmers. There

is a tutorial sections and one on technical information

which provides details of system and compiler operation

for more advanced users.

Skill level: Experience in using operating systems and

high-level language coding and program preparation (e.g.,

good knowledge of Applee Pascal would be typical of level

needed). Knowledge of C language is a must; buy the

package and buy and read Kernighan and Ritchie.

Reviewer: Richard C. Vile, Jr.

Product Name: DISKEDT

Equip. Req'd: 16Kor 32K Color Computer with 1disk

Price: $24.95

Manufacturer: Spectral Associates

141 Harvard Avenue

Tacoma, WA 98466

Description: DISKEDT is a disk editor which ismore than

just a repair program. Two versions of the program are

furnished on the same disk, with the 32K version having

more capabilities and protection against mistakes than the

16K version. DISKEDT allows direct access, viewing and

editing of any part of the disk, by track, sector or filename,

which is somewhat unusual for this type of program. Disk

data is displayed in either Hexadecimal or ASCII, and

single-key commands allow moving forward or back

through a disk or file. This moving around can be random

access (specify track and sector), step-by-step or "skip to"

movement. Besides the disk data, there is a constantly

updated display of drive, track and sector, plus three

special characters which aid in editing and generating disk

data. A truly impressive set of editing capabilities are

available; in fact, there are editing capabilities for which I

can'timagine the purpose!

Pluses: This program works well, has very powerful

capabilities and is inexpensive for all it does. Also, the

display update is quite rapid so that a minimum of time is

wasted.

Minuses: Although the program has considerable

capability for simple disk file "repair", this topic is

completely ignored. The display is highly readable, but is

presented in a lO-column width. As a result, directory

displays are very difficult to interpret, since the next file

name occurs 32 characters "down the line".

Documentation: Well written and suitable for the disk

format expert. Directions are given with the assumption

that the user is intimately familiar with all facets of the

No. 70 - March 1984 MICRO

METALOGICP ro gr am y ou r own 3D g ra ph ic s q u ic kl y a nd e as ily w it h t his Sub LDGICA2·3D2 in te rface• Easy to learn •.& .• commands imbed into your BASIC program

• NO machine language. NO hex math. NO PEEKs. NO POKEs• Games. demos. animation. CAD - unl imited applica tions• Detai led manual - sample documented programs• Requires: SubLOGIC A2·302: ROM Applesoft & RAM Card (or App le I Ie): DOS 3.3

Only $75; $ 18 0 i nc lu d in g c om p le te A 2 -3D2 g ra ph ic s p a ck ag e

TELEPHILEA database to k eep tabs on a ll y ou r impor tant c on ta c ts - f ri ends , r el at iv es ,bus iness associates

• Simp le touse• Complete screen edi ting• Search capabilities

• App rox . 200 116 ·cha rac te r recordsavailable in each file• Hardcopy in variable formats• Inc ludes Name. Address . Phone& Comment fields

• ReQuires: PascalnlyS20

PASCATCa ta log a ll y ou r f >ASCALd is k s l or eas y r efer ence• Automatical ly reads and sorts a ll f iles • F lexible search capabil it ies-

• Rapidsort by any field including wildcards• Screen list or hardcopy • Requires: Pascal

Only $25

SCREEN UNITTermina l 110uni t a must f or y our PASCAL Hb ra ry• Device Independent• F ie ld oriented with opt iona l defau lts• Built-in editor (insert. replace.delete. clear. etc.)

OnlyS45

• Source and objec t code inc luded• Input check ing pre\lents user error• No l icens ing fee for commercial use• Requires: Pascal

A) A R T E M IS S Y S T E M S , IN C .41 Parkview Drive, Millburn, N.J. 07041

o r CALL(201) 564-9333Al l So ftware Unpro tec ted ! VISA/MC accepted

..... 3rd Class P.P. NJ RES. ADD 6% ~

089

APPLICATIONSOFTWAREACCOUNTS

PAYABLE

PAYROLLGENERAL

LEDGER $499$299 with

CASH SMALL

JOURNAL BU~NESS

$399 INVENTORY

$299

ACCOUNTS

RECEIVABLE

$299COMPLETE DOCUMEI\lTATIOI\l $19.95

OS9 & BASIC 09 ARE TRADEMARK OF

MICROWARE. INC. & MOTOROLA CORP.

SPECIALTY

ELECTRONICS

(405) 233-5564

2110 W. WILLOW - ENID, OK 73701

7

Page 10: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 10/86

Radio Shack format and disk files in general. Although

some specific examples are given, a larger number and

more basic examples would have greatly enhanced the

product.

Skill level: Very advanced programmers will derive much

use from this product, but a dedicated computer hacker

with plenty of time for study can derive experience andbenefits from it.

Reviewer: Ralph Tenny

Product Name:

Equip. Req'd:

STARDOS 64

64KTRS-80C Color Computer with 1

disk drive

$49.95 (Disk only)

Star Kits

P.O. Box 209

Mt. Kisco, NY 10549

Minuses: The only minus I have noted is that STAROOS

does not have a large stable of programs to support it.

However, some FLEXprograms will run unmodified under

STAROOS and others can be converted using instructions

furnished. Finally, more programs are being added as time

goes on.

Documentation: An 80 page manual is furnished whichexplains how to use and expand STAROOS, and how to

convert FLEXprograms. Italsogives considerable detail on

proper and efficient use of a DOS. This manual is well

organized, thorough and well written in a highly readable

style. The manual covers both regular STAROOS (runs on

unmodified 16Kand 32K computers, and furnished on the

same disk) and STAROOS 64.

Skill level: A DOS is essentially useless for BASIC-only

operation, and almost indispensable for the assembly

language programmer who does more than dabble in

programming. All experience levels can benefit, but the

advanced programmer will make greater use of STAROOS

initially.

Reviewer: Ralph Tenny

Product Name:

Equip. Req'd:

MATHMENU 1.0

TRS-80 Color Computer with 16K

memory (tape version)

TRS-80 Color Computer with disk and

32K memory (disk version)

$44.95 tape, $49.95 disk

INTER +ACTION113 Ward Street

New Haven, CT 06519

Price:

Manufacturer:

Description: STAROOS 64 is a true Disk Operating

System which will run on the Color Computer if it has

64Kof read-write memory. Ituses the same disk format as

the Radio Shack DOS. The advantage of STAROOS is that

it provides the following features: provision for multiple

320 byte File Control Blocks, routines which open, read,

write and close named files, rename or delete files, read or

write single sectors, search or modify the directory and

other functions. STAROOS 64 will support single or

double density disks, 35, 40 and 80 track disk drives,

single or double sided. Finally, it has utilities which allow

it to read FLEXdisks and convert them to STAROOS/RS

format. This means that data files and source files can be

transferred from FLEX to STAROOS and then to RS Disk

Basic. The standard entry points for its internal routines

are the same as for the same functions in FLEX, which

opens up the possibility of running some FLEXprograms

under STARDOS 64.

The following memory-resident commands are

available: GET (load a binary file), XEQ (similar toBASIC

EXEq, BAS (return to BASIq, PNS (Printer Non-

Standard; adjusts for special printer protocols], VON and

VOF(control disk verify), and V32, V40, V51, V64 (control

special hi-res display character fonts). In addition, disk

resident commands allow the user to BACKUP disks,

BUILD simple text files, print a CATalog or DIRectory of

disk files to screen or printer, COMPARE two disks (two

drives are required), COpy files, DELETE files,

DISKCHEK (test) disks for errors, LIST test files,RENAME files, SAVEM binary files and DSKINI disks.

PEEK and POKE work the same as in BASIC, while

ACONVERT converts FLEX ASCII files to STAROOS,

BCONVERT changes binary files and FCAT reads the

directory of a FLEX disk. SETMAX sets the number of

tracks used on a disk, provided the drive can handle greater

than 35 tracks.

Pluses: STAROOS 64 is a low cost, highly versatile DOS

which is easy to use and runs on the standard 64K Color

Computer. Directions are given for adding user disk

commands for system expansion.

Price:

Manufacturer:

Description: MATHMENU is a collection of 15 different

engineering and math programs. The programs included

will perform the following functions: Plot (both two

dimensional and three dimensional); Matrix Operations

(performs 8 standard matrix operations on amatrix as large

as 8 x 8); Vector Operations (eight separate operations may

be performed on vectors consisting of up to 20 elements

each; Numerical Differentiation and Integration; Least

Squares (performs least squares curve fitting); Number

Base Conversions; Reverse Polish Calculation (acts as a

calculator with stacks and memory visible on the screen);

Binomial Expansion; Prime Number Checking; LargeAdd

and Multiply (substitutes digits for scientific notation on

large numbers); Rectangular and Polar Conversion;Quadratic Root Computation.

Pluses: Menu driven for ease of use (disk version). RPL

calculator is useful and well done. Some documentation is

presented on-line for each function. Algorithms used

appear to run relatively fast in benchmark tests.

Minuses: Many assumptions of user knowledge level are

made in the documentation. The tape version is difficult

to use because programs must be separately loaded. The

experienced user should have the option of skipping online

documentation.

8 MICRO No. 70 - March 1984

Page 11: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 11/86

Documentation: A 24 page manual provides a general

summary of functions and at least one page of detail on

each program. It lacks examples and assumes a high level

of math expertise, but is generally adequate in its

explanations of how to use the programs.

Skill Level: These programs require a high level of math

applications skills. No programming skills are required to

run them.

Reviewer: Norman Garrett

Product Name:

Equip. Req'd:

Homebase

TRS-80 Color Computer; 32K Disk

BASIC (I drive required)

$79.95 disk

Homebase Computer Systems

P.O. Box 3448

Durham, NC 27702

Price:

Manufacturer:

Description: Homebase is a complete database managerdivided into three separate parts which will work alone or

in unison and which may be purchased separately or as a

single unit. The division has separated the package into

the Data Management function, the Custom Reporting

Function and the Text/Word Processing Function. A

tutorial program is included which allows the new user to

learn the main features of Homebase while experimenting

with the pre-established database.

Database functions of formatting, adding, changing

and deleting records are performed, and utilities are also

included for selection, ascending or decending sorts,

merges, filecopies and file synchronization. Data entry

screens can be customized. Full computational functions

are available, as well as a report writer that includes formletter management and full interface with the text

processor and data manager, and a mailing label printing

routine.

Pluses: Complete, easy-to-use tutorials are included on a

separate disk and include documentation. The database is

menu driven, making access rapid and efficient. The

system is set up to function with Epson, Radio Shack,

Okidata and NEC printers with good documentation on

other models. The database manager itself is versatile and

contains a number of utilities which enhance the ability to

manipulate data. Another plus is the ability to backup files

to and reload from cassette tape. Data entry is

accomplished via user-designed data entry screens.Calculations use predefined or user-defined formulas. The

report writer allows form letters using database fields and

in conjunction with the text processing facility, with label

printing routine built in.

Minuses: On some of the tutorial screens, words are

wrapped rather than divided. The use of color and reverse

video on tutorial and mainscreens is excessive and can be

difficult to read. Record design is limiting with character

fields being fixed length 5 byte fields. A logical record

cannot exceed 255 characters although you are allowed up

to 49 fields per record.

No. 70 - March 1984 MICRO

Te lecommun

w ith a diffe rence !Unexcelled communications power and

compatibil ity, especially for professionals and

serious computer users. Look us over; SuperTerm

isn't just "another" terminal program. Like our

famous Terminal-40, It's the one others will be

judged by.

• EMULATION-Most popular terminalprotocols:cursor addressing, clear, home, etc.• EDITING-Full-screen editing of ReceiveBuffer• UP/DOWNLOAD FORMATS-CBM, Xon-Xoff,ACK-NAK,CompuServe,etc.• FLEXIBIUTYSelect baud, duplex,parity,stopbits,etc. Evenwork off-line,then upload to system!

• DISPLAYMODES-40 column;80/132 withside-scrolling

• FUNCTIONKEYS-B standard, 52 user-defined• BUFFERS-Receive, Transmit,Program,and Screen• PRINTING-Continuous printingwith SmartASCIIinterface and parallelprinter; buffered printingotherwise

• DISKSUPPORT-Directory, Copy, Rename,Scratch

Options are selected by menus and EXECfile.Softwareon diskwith specialcartridge module.CompatIble wIthCBMand HESAutomodems; select ORIG/ANSmode,manual or autodial.

Write for the full story on SuperTerm; or, Ifyoualready want that dIfference, order todayl

Requires: Commodore 64 or VIC-20. disk drive or Dacasette. and

compatible modem. VIC version requires 16Kmemory expansion. Please

specify VIC or 64 when ordering.

Sm art A S C II P lus ... S59~The only Interface which supports streaming -sending

characters simultaneously to the screen and printer - with

SuperTerm.Also great for use with your own programs or most

application programs, i .e., word processors. Print modes:

CBM Graphics (w/many dot-addr printers), TRANSLATE,

DaisyTRANSLATE,CBM/True ASCII, and PIPELINE.

Complete with printer cable and manual. On disk or cassette.

VI C :!Il and Commodore 64 are trademarks of Commodore Electronics, Ud .

1. .· 1Ii

9

Page 12: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 12/86

Documentation: A loose leaf notebook contains 147pages

for all features of Homebase, including the tutorial. The

documentation could be more compact if printed on both

sides of the sheet, but it is good quality and well

organized.

Skill level: While programming skills are certainly not

required to use the package, a basic knowledge ofcomputer files is essential in order to properly design file

formats. A novice user could, however, learn to use the

package fairly quickly due to good documentation which

presupposes no expertise.

Reviewer: Norman Garrett

Product Name:

Equip. Req'd:

Price:

Manufacturer:

Parallel Printer Switch

Two Centronics-type Printers

$39.95 plus $2 shipping

Ken Branscome Associates

368 N. Walnut Grove Road

Midlothian, TX 76065

Description: This piece of hardware consists of a

Centronics-type female connector which will plug onto

the end of any Centronics parallel interface cable. The

"parallel printer switch" allows the user to connect an

existing Centronics type printer cable to the printer

switch. By using two flat cable extensions, two printers

with Centronics type interface can be connected to the

printer switch. A switch on the PC card will allow the

computer output to be directed to either printer. Thus, if

both dot-matrix and letter-quality printers are available,

draft copies can be run in dot matrix and final copies with

letter quality.

Pluses: This accessory eliminates cable swapping; the

design allows easy home-brew flat cables or the option of

purchasing standard Radio Shack Model I or Model III

cables to interconnect any two printers with standard

Centronics interfaces. Two versions are available; one

switches the BUSY line and the switches the ACK line, so

specify the one you need (check the printer driver protocol

of your computer). Ready-made 5' cables are alsoavailable

at $39.95 each; two cables and the Printer Switch are

available for $100 pp.

Minuses: None noted

Skill level: None

Documentation: None furnished or needed

Reviewer: Ralph Tenny

Product Name:

Equip. req'd:

Price:

Manufacturer:

MMG Form Letter Writer

Atari 400/800 with 40K disc drive

printer

$29.95

MMG Micro Software

P.o. Box 131

Marlboro, N T 07746

Description: Form Letter Writer produces letters which

can be merged with MMG Data Manager, Mail List, MMG

Accounts Receivable, Accounts Payable, MMG Payroll

and MMG Inventory programs. This means that owners of

these other products now may send form letters to their

client base without typing in the names, etc. .

Pluses: The program allows printer codes to be entered soit can be configured to work with any printer. The codes

can be placed anywhere in the text and will not be printed

with the text, but will be sent to the printer. This allows

print type to be changed or any special print codes to be

sent from within the body of the letter. Form letters can be

personalized in the same manner as is done by professional

mailers.

Minuses: The text is listed continuously on the screen

with an inverse " 11 symbol marking the end of

paragraphs. According to information furnished in the in-

struction manual, this allows more text to be stored than

with the normal format. This special format does take some

getting used to. Proportional printer is not supported.

Documentation: The seven pagemanual explaining use of

the program does not cover the interfacing with the pro-

grams that it works with as well as it could.

Skill level required: A user with some experience.

Reviewer: Richard E. DeVore

Product Name: Decimal Practice-Plato Educational

Software

Equip. req'd: Atari 400/800/1200XL with 48K disc

drive

Price: ?

Manufacturer: Control Data Publication Co., Inc.

P.O. Box 261127

San Diego, CA 92126

Description: Decimal Practice is one of the sixteen educa-

tional programs in the Plato Educational Software series.

As the title implies, the program is designed to teach

decimals to elementary math students.

Decimal Practice uses a number line with colored

balloons "pinned" at different locations along the line.

The object is toestimate where the balloons are positioned

on the number line. The student enters an estimate of the

location of the balloons from the keyboard and a dart is

"thrown" at the balloons. If the aim is good, the balloon

bursts and the location is printed. If the dart misses, it

sticks in the number line, and the location is printed. This

helps learn the relationship between parts and the whole.

The program is divided into two lessons with 8 prob-

lems in the first lesson and ten in the second. The prob-

lems in the first lesson have whole numbers at each end of

the number line and the student can select whether all of

the problems should have positive numbers or a mix of

positive and negative numbers. The problems in the sec-

ond lessons are more difficult and have decimal numbers.

10 MICRO No. 70- March 1984

Page 13: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 13/86

Pluses: Decimals Practice uses proven teaching methods

to instruct students while providing positive feedback by

making the student think he is playing a game. The pro-

gram features a "help" function accessible by typing an

"h" instead of a number. When the "h" is pushed the

computer will shoot a dan at the number line which will

give the student another reference point to use in

estimating the location of the balloons.

Minuses: The program was developed using BASIC A+

and loads the language as well as the program so it takes

some time to load.

Documentation: There is a forty page booklet furnished

with the program. There are sections covering Classroom

Strategies, Sample Activities, Student Practice Activities

and a Student Record sheet. It is well done and easy

to follow.

Skill level required: Elementary School Students.

Reviewer: Richard E. DeVore

Product Name:

Equip. req'd:

KoalaPad

Atari Computer with min. 16K, 32K for

disk storage disk drive for disk version

(tested)

$99.95

Koala Technologies

253 Martens Ave.

Mt. View, CA 94040

Price:

Manufacturer:

Product Name:

Equip. req'd:

Price:

Manufacturer:

DataFax

Apple ITor Apple IT+?

Link Systems

1655 26th St.

Santa Monica, CA 90404

Description: DataFax is a data base management systemthat runs on the Apple Pascal Operating System. Ituses a

highly flexible filing process based on keywords within a

data record, or folder. The user can select any word or

phrase, of variable lengths, to be keys for the folder; they

are in turn used to retrieve desired folders for editing

or printing.

Pluses: DataFax is designed to handle unstructured data,

so nearly anything one can type in can be filed and re-

trieved with ease. Folders are scanned for on single keys or

combinations of keys, boolean operators, and wildcard

symbols that are easy towork with because they are writ-

ten in English, not special computer codes. The control

keys that function in the Editor may be customized for

any system.

Documentation: Over 200 pages of documentation are pro-

vided with the DataFax package. The manual includes a

tutorial section for beginners, a reference section for the

basic commands and functions, and Advanced Techniques

section for using DataFax in conjunction with the USCD

Pascal System, and appendices covering hardware re-

quirements, trouble shooting, and a list of all possible

error messages and their meanings.

Description: The KoalaPad is a touch tablet designed tobe Skill level required: Easy to learn and use for everyone.used from joyport 1 of an Atari 400 or 800 computer. It

may be operated using your finger or the provided stylus, Reviewer: John Hedderman

any other object is not recommended. The unit is small,

measuring 6" x 8" X I" with an active tablet surface area I\ICRO'.of 4\4 " x 4\4". The KoalaPad is supplied with a program

disk called the "Micro Illustrator". This program along

with others soon to be available allow easy use of the

touch pad.

Pluses: The touch pad is extremely easy to use with the

supplied software. The brief (14 page) owners manual

.states how to hook the unit to the computer while the 16

page software manual tells how to load the program and

use it. In less than 3 minutes a child who had never seen

the tablet before had it connected and was drawing on it.

Minuses: Could not find any. It worked exactly as

presented.

Documentation: The two manuals supplied with the

touch pad and the program disk, while brief, showed clear-

ly how to connect and use the unit.

Skill level required: Beginning computer user.

Reviewer: Richard DeVore

No. 70 - March 1984 MICRO

I,

11

I

Page 14: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 14/86

NEC PRINTERS

NEC 2050 $999.00

NEC 3550 $1699.00

PERCOM/TANOON

ORIVES

5'1. 320K Floppy.. . $229.00

5Meg Hardw/Controlier $1399.00

10Meg Hardw/Controller $1699.oo

15Meg Hard w/Controller $2095.oo

20Meg Hard w/Controller $2399.oo

AMOEK

310A Amber Monitor $169.00

DXY 100 Planer $599.00

Color II $399.00

AST RESEARCH

Six Pak Plus trom 5279.00

Combo Plus 11.. from $279.00

Mega Plus from $309.00

I/O Plus from $139.00

GUAORAM

Quadlink 1499.00

Quadboard as low as 5289.00

Quad 512 Plus...as low a5 $249.oo

Quadcolor as low as 5219.00

Chronograph $89.00

Parallel Interlace Board 589.00

64K RAM Chips Kit. $59.00

MCROPRO

WordStar/MailMerge $349.00

Info Star $299.00

SpeIiStar $159.00

CalcStar $99.00MCROSTUF

Crosstalk $105.00

MCROSOFT

Multiplan $159.00

ASHTON TATE

dBASE II $389.00

Friday! $185.00 .Call On Titles

IUS

EasyWriter II ...............• $249.00 1.2-3 ~ C J ~ ~ . t : I $319.00

EasySpelier $119.00 PROFESSIONAL SOFTWARE

E~ci~~;.;.-~.:.;:.:.;.:;._'s;;,~:':!:!~~ PCPlus/The Boss $349.oo

1st Class Mail/Form Letter $79.oo SYNAPSEThe Home Ace"t. Plus 588.00 File Manag.r 589.00

PRINTER

VisiCalc

VisiCalc 4

VisiCalc·Advanced

VisiWord/Spell

Visitrend/Plot

VisiLink

VisiFile

VisiSchedule

laM APPLE

159.00

Visidex

VisiPlot

159.00

269.00

249.00

199.00 199.00

16.9.00

199.00 169.00

199.00 199.00

159.00

135.00

75.00

169.00

75.00

75.00

59.00

75.00

59.00

VisiTerm

Desktop Plan

Bus. Forecast Model

Stretch Calc

VisiTutor Calc

VisiTutor~Advanced

VisiTutor Word

Vision Calc

Vision Graph

Vision Mouse

Vision Host

199.00

75.00

75.00

59.00

75.00

59.00

249.00

129.00

159.00

319.00

pf.

Write:

Graph:

Report:

File:

APPLE

79.00

79.00

79.00

79.00

16.00

laM

89.00

89.00

79.00

89.00

16.00olutions·: as low as

AXIOM NEC

2010/2030 . .. .. .. .•. .. .. .. .. $899.00

8023 Dot Matrix $379.00

8025 Dot Matrix $669.00

3510 Serial/Lener Quality $1449.00

3530 Parallel/leiter Quality $1499.00

7710/7730 Serial/Parallel $1949.00

OKIOATA

82.83.84.92.93.2350.2410 ... CALL

SMTH CORONA

TP'2 ... •......... ...........• $399.00

Tractor Feed $119.00

SILVER REED

500 Lener Quality $469.00

550 Letter Quality $699.00

STAR

Gemini lOX $299.00

Gemini PI5X $399.00

Delta 10 $559.00

Serial Board $75.00

AT·loo Atari Interface $239.00

CD-l 00 CBM 64/VIC 20 $239.00

GP-loo Parallel Interface $199.oo

SMC

401 Lener Quality $589.00

BX·80 Dot Matrix $269.00

CENTRONICS

122 Parallel $399.00

739-1 Parallel $299.00

739-3 Serial $349.00

C.ITOH

Gorilla Banana 5209.00

Prowriter8510P $379.00

Prowriter 1550P $679.00

Al0 (18 cps) 569.oo

F1Q-40 .. $999.00

Fl0-55 $1499.oo

COMREX

ComWrit.r IILenerQuality ... $499.00

OIABLO

620 Lener Quality $949.00

630 Letter Quality $1749.00

OAISYWRITER

2000 $999.00

Tractor Feed S109.00

EPSON

MX-80FT, MX·l 00. ·RX·80. RX·80FT.

FX-8O. FX·loo CALL

TOSHISA •••_.. .CALL

TRANSTAR ... •••. CALL

'PRINTER CASLES

Available for Atari, Commodore, IBM,

Apple, Epson,Kaypro.Televideo. Frank-

l in, Eagle, Sanyo, Osborne, NEe.

Zenith and many others. We supply allyour computer needs!OS

Prism 8O.. _For Configurations CAL,L

Prism 32.. .ForContigurations CALL

MANNESMAN TALLY

160L $589.oo

180L . .. .. .. .. .. .. .. .. .. .. •. .. $799.oo

PAPER SUPPLIES

l000ahts.8'hxll Tractor Paper...19.99

l000_.14'hxlITractorPaper ..$24.99

lor 2" Address Labels . .. .. .. . $9.99

MBC-SSO PC •••CALL

MBC-SSS PC •••CALLMBC 1100 $1499.00

FDD 32oo-320K Drive $389.00

MBC 1150 $1899.00

MBC 1200 $1849.00

FDD6400-640K Drive $469.00

MBC 1250 $2099.00

.MPR5500 Printer $599.Q()~'_"~=

- - .

~--::~-- -.-

TERMNALS

914 $569.00

924 $689.00

925 $739.00

950 $929.00

970 $1039.00

COMPUTERS

Tel.port Portable CALL

BOOA $1099.00

802 .•. .. .. .. .. .. .. .. .. .. .. .. $2699.00

803 $1949.00

802H $4695.00

806/20 $4999.00

816/40 $9199.00

1602 $3399.00

1603 CALL

MONITORSAMOEK

300 Green $149.00

300 Amber $159.00

310 Amber $169.00

Color 1 $279.00

Color 1 Plus $299.00

Color 2 $399 .00

Color 2 Plus $419.00

Color 3 $349.00

Color 4 $699.00

SMC

12" Green $79.99

12" Green HI-RES $119.99

9191-13" Color $249.99

GORILLA

12" Green $88.99

12" Amber $95.99

NEC

JB 1260Green $109.99

JB 1201 Green $149.99

JB 1205 Amber $159.99

JC 1215 Color $299.99

JC 1216 RGB $429.99

PRINCETON GRAPHICSHX-l: RGB $519.00

SAKATA100 $269.00

TAXAN12" Green .•. .. .. .. .. .. .. .. .. $119.0012" Amber $129.00Taxan 1 RGB $279.00Taxan 210 $299.00

USI

Pi 1,9" Green $99.99Pi 2,12" Green $119.99Pi 3,12" Amber $149.99Pi 4,9" Amber $139.991400 Color $269.99

ZENITHZVM 122 Amber $109.00ZVM 123 Green $89.99ZVM 135 Color/RGB $469.99

Spirit XL Portable $3999.00

IIE·I............ .. $1569.00

IIE·2............ ....... .. $1899.00

IIE·3 $2399.00

IIE·4.. .. $3299.00

PC·E $1579.00

PC·l $2399.oo

PC·2...... . $2799.00

PC·XL .. $3599.00

1620 $3599.00

1630 $5499.00

1640 $6499.00

Cyma Software CALL

oTelt.4lideo

MOOEMSANCHOR

Mark I (RS-232) $79.00Mark II (Atari) $79.00Mark III (TI·99) $109.00Mark IV (CBM/PET) $125.00Mark V (Osborne) $95.00Mark VI (IBM-PC) $169.00Mark VII(AutoAns/Auto Dial) $119.00Mark XII (1200 Baud) $299.ooTRS-80 Color Computer $99.009 Volt Power Supply $9.00

HAYESSmartmodem 300 $219.00Smart modem 1200 $509.00Smart modem 1200B $459.00Micromodem II $265.00Micromodem II Plus 5299.00Micromodem IIE 5269.00Micromodem 100 $299.00Smart Com II $89.00Chronograph $199.00

NOVATIONJ·Cat $99.99SmartCat 103 $179.00SmartCat 103/212 $399.00AutoCat $219.00212 AutoCal.. $549.00Apple Cat II $249.00212 Apple Cat $569.00Apple Cat 212 Upgrade $309.00Cat $139.99D-Cat............... .. $149.00PC-Cat $339.00

ZENITHZT·l $309.00ZT·l 0 $339.00ZT·ll $369.00

APPLE INTERFACE

CAROS &SUFFERS

Choose from PKASQ, Orange Micro,

MPC. MicroMa ....Tymac, auadram &Practical Peripherals CALL

Page 15: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 15/86

MCRO-SCI

2 5219.00

40 5299.00

70 5319.00

2 Controller 579.00

47 Controller 589.00RANA

lite 1 5279.00

lite 2 . 5389.00

lite 3 5569.00

PPLE II.. STARTER PACK

K Apple lie, Disk Drive & Controller.

lumn Card, Monitor II& DOS 3.3MPLETE ••........•. S, , 99.00

ACE 1000 Color Computer CALL

ACE Family Pack System CALL

ACEPROPLUS System: CALL

ACE12000tlice M9mt. System CALL

"NOT liE EXPENSIVE"

BM 8023 •••5599

commodore

SX-S4

BM 4032 5599.00

BM 8096 5869.00

BM 9000 5999.00

I28-80 .. .. .. .. .. ... .. .. .. .• 5769.00

BM 64K Memory Board 5269.00

032 to 9000 Up9rade 5269.00

031 LP Disk Drive 5299.00

050 Disk Drive 5949.00

250 Disk Drive 51199.00

023 Printer 5379.00

023 Printer ... .. .. .. .. .. .. .• 5569.00

400 Printer 51399.00

·RAM 5499.00

ilicon Office 5699.00

he Manager 5199.00

oH ROM 5125.00

isiCalc 5159.00

PROFESSIONAL

SOFTWARE

ord Pro 2 Plus 5159.00

ord Pro 3 Plus 5189.00

Pro 4Plus/5 Plus each 5279.00

nloPro , 5179.00

dministrator S399.00

ower _ 579.00

sa6s00

VIC 20 ..•.•.•..•. CALL

CBM 64 •.•.••••• $199

MSDSOl Disk DriveIC·54) 5349,00C1541 Disk Drive 5249.00

C1530 Datasette 569.00

CI520ColorPrinter/Piotler .•. 5169.00

M-801 Dot Matri. Printer ... 5219.00

C1526 Dot Matri./Serial. •.. 5279.00

C1702 Color Monitor 5249.00

C1311 Joystick 54.99

C1312 Paddles 511.99

C1600 VIC Modem ..... .. .•.. 559.00

C1650 Auto Modem 589.00

L090 64 549.00

Pilot 64 539.00

Simon's Basic $19.00

Word Pro 64 Plus 559.00

Paral lel Printer Interface $49.00

Calc Result 64 5129.00

Codewriter 64 .. .. ... .. .. .. .. • 575.00

Quick Brown Fo•. .. ... .. .. .. . 549.00

Word Pro 64 Plus 559.00

We stock a full inventory of software for Commodore, such as:

Artworx, Broderbund, Commercial Data, Creative Software

Epyx, HES, MicroSpec, Nufekop, Romox, Sirius, Synapse:Thorn EMI, Tronix, UMI, Victory, Spinnaker, Rainbow & Timeworks!

CALL FOR DETAILS!

HANDHELD

(h~ C~ERS

CX••••••• $249.99 SHARP1 CV••.•... 5199.99

1C •.••.•.•. 5144.99P IOC 551.99

PI1C 569.99

P 12C 588.99

PI5C 588.99

P 16C 588.99

P 75C 5749.99

PIL Module 598.99

IL Casso or Printer S359. 99

ard Reader 5143.99

xtended Function Module 583.99

ime Module 583.99

NEC-B201Per.ional Computer 5599.00

C·8221 AThermal Printer 5149.00

C'8281 A Data Recorder 599.00

·8201·068KRAMChips 5105.00

8206A32K RAMCartridge •..S329.oo

PC-1500A .••$165.99

PC-1250A •... $BB.99

CE·125 Printer/Casselle 5128.99

CE·15OColorPrinter/CassetIe 5171.99

CE·155 8K RAM 593.99

CE 161 16K RAM 5134.99

CE 500 ROM Library 529.99

TIMEX/SINCLAIRTime./Sinclair 1000 ..... .. .• 524.99

Time./Sinclair 2086 CALL

16K Memory 525.00

2040 Printer . ... .. ... .. .•. .. .. 599. 99

VuCalc . .. .. .. .. .. .. .. ... .. •. .. 517.99

Mindwar. Printer S99. 99

HOME

..A_CDMPUTERS

A T A R I 'SDDXL•..... $1S9

SDDXL•..•.. $299

1010 Recorder 574.00

1020 Color Printer 5249.00

1025 Dot Matrix Printer ..•.. $449.00

1027 Letter Qualily ....•..•. 5299.00

1030 Direct Connect Modem ... CALL

1050 Disk Drive ..... .•.. .. .. 5379.00

CX30 Paddle 512.00

CX40 Joystick .. .. .•.. .. each 58.00

CX77 Touch Tablet 564.00

CX80 Trak Ball ... .. .. .. .•..•. 54B.00

CX85 Keypad 5105.00488 Communicator 11. 5229.00

4003 Assorted Education •..• 547.00

4011 Star Raiders 533.00

4012 Missile Command 529.00

4013 Asteroids 529.00

5049 VisiCalc 5159.00

7097 L090 579.00

7101 Ent.rtain.r S69.00

7102 Arcade Champ ..... .. .• 575.00

8026 Di9 DU9 ... .. .. .•.. .. •. . 533.00

8030 E.T. Phone Home 533.00

8031 Donkey Kon9 ..... .. .. .• 539.00

8033 Robotron 535.00

8034 Pole Position .•... .. .. .. 539.00

8036 Atari Writer ... .. .. .. .•.. 579.00

8040 Donkey Kon9, Jr 539.00

8043 Ms. PacMan •.... .•.. .. . 539.00

8044 Joust . .. ... .. .. .. .•. ... . 539.00

DISKETTESMAXELL

5'/." MD·l 529.00

5'/." MD-2 539.00

8" FD·l ISS/DO) 539.00

B" FD-2 (DS/DD) 549.00

VERBATIM

5'1." SS/DD 526.99

5'/." DS/DD 536.99

ELEPHANT

5'/." SS/SD 518.49

5'/. " SS/DD .. .. .. .. .. .. .. .. ..• 522.99

5'1." DS/DD .. .. .. .. .•. ... .. .. • 528.99

HEAD

511." Disk Head CI.aner S14.99

DISK HOLDERSINNOVATtVE CONCEPTS

Flip·n·Fi le 10 . .. .. .. .. .. .. .. .•. 53.99

Flip·n-File 50 517.99

Flip-n-Filel400i8OOROM)Holder..517.99

WK ENTERPRIBEB

Alan LetterPertect-Disk(4OI8O) 579.99

Alan Letter Perfect-ROM(4Oc:ol) 579.99

Alan Letter Pertect-ROM(BO o Q • .• 579.99Alan Data Pertect-ROM(BOcoI) 579.99

Atari Spell Perfect·DISK 559.99

Atari Utilily/MaiIMerge 521.00

Apple Letter Perfect 599.00

Apple Data Perfect ... .•.. .. .. 575.00

Apple LJK Utility 521.00

Apple La_rCase Generator 519.00

12DDXL ••.. CALL

14DDXL •... CALL

[~EfU]UM]AT 88-S1 5389.00

AT 88-A2 5259.00

AT 88·S2 5529.00

AT 88·S1 PD 5429.00

AT 88-DDA 5119.00

RFD 40-S1 5449.00

RFD 40-A 1 5269.00

RFD 40-S2 5899.00

RFD 44'SI 5539.00

RFD 44'S2 . .. ... .. .. .. .. ..•. 5889.00

TEXAS INSTRUMENTS

TX99'SI ............•....... 5279.00

RANA

1000 5319.00

TRAK

AT·D2 5389.00

MEMORY BOARDSA.lon 32K 559.00

A.lon 48K 599.00

Axlon 128K 5299.00

Intec 32K .. .. .. .. .. ... .. .. .. .• 559.00

Intec 48K 585.00

Intec 64K 599.00

Intec Real Time Clock 529.00

ALIEN VOICE SOX

Atari 5119.00

Apple 5149.00

KOALA PAD

Atari. 575.00

Apple .•....................... 585.00IBM .•......................... 595.00

CBM 64 575.00

CONTROLLERS &

.JOYSTICKSWICO

Joystick . .. .. .. •. .. .. .. .. .. .. . 521.99

3·way Joystick '" 522.99

Famous Red Ball. 523.99

Power Grip 521.99

BOSS Joystick 517.99

ATARI/VIC Trak Ball 534.99

Apple Trak Ball 554.99

Apple Adapter 515.99

Apple AnaI09·.····.··········537.99

KRAFT

Joystick 541.99

Atari Sin91e Fire 512.99

Atari Switch Hitter 515.99

Apple Paddles 534.99

IBM Paddles 534.99

IBM Joystick 546.99

AMIGiA

3100 Sin91e 513.99

3101 Pair 519.99

Joyboard 537.99

TG

Atari Trak 8all 547.99

Apple Joystick 547.99

Apple Trak Bal l . .. .. .. .. .•. ... 547.99

Page 16: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 16/86

Page 17: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 17/86

Least-Squares

Curve

Fitter

by Brian Flynn

Plot and depict the apparent trend betweenvariables (such as stocks and interest rates) withthe statistical routine

The urge is almost irresistible. You see A Real-World Example

a plot of points between two variables,

such as incidents of heart disease and According to many Wall Street gurus,

frequency of cigarette smoking, or the only sure thing about the stock

wheat harvest and yearly rainfall, or market is that it will fluctuate. The

stock prices and interest rates. And you only certainty, in other words, is

want to draw a line through the points change. Nevertheless, is it not possible

to depict the apparent trend, as Figure 1 to devise an investment strategy that

shows. Least-Squares Curve Fitter is a will work successfully on average, and

statistical routine which will enable over the long haul? With painstaking

you to satisfy your desire for a line in a work and steady nerves, is it notwide range of circumstances. More possible to tilt the merciless roulette

technically, Curve Fitter estimates a wheel of Wall Street in our favor for

multiple linear regression equation in once?

Apple II Basic. With little Perhaps it is. Many of us have

modification, the program will run on probably noted that stock prices tend to

non-Apple systems as well. This article fall when interest rates rise, and

will explain the use of Curve Fitter by conversely, that stock prices tend to

presenting a real-world example. rise when interest rates fall. In short,

Regression statistics will then be the two variables seem inversely

interpreted. related. When one goes up the other

Drawing a Line 01 Best Fit

The Trend Line

•Plot 01Points

• •• •

• ••••

Figure 1

No. 70· March 1984 MICRO

goes down, and vice versa.

To test our hypothesis about stock

prices and interest rates, we first gather

the observations shown in Table 1, and

then run Curve Fitter. The computer

soon displays

The Maximum Allowable Numbers ofObservations and ExplanatoryVariables Are:

Observations =50Exp. Variables = 6

Change the Values in Line 2020 for

Different Limits

"Stock Prices" is called the dependent

variable, or Y. Our goal is to explain

changes in Standard and Poor's Index of

500 Leading Stocks from January 1982

to June 1983, or for 18 months in all.

The term todo the explaining is called,

logically enough, the explanatory

variable, or X. In our case, we have only

one X, namely "Interest Rates."

The computer now asks us to enter

our data. First comes the dependentvariable. Starting with January 1982,

we key-in 100.0 for Y(IJ, 97.6 for Y(2),

and so on down the list, all the way to

141.9 for Y(18J, or June 1983. When the

computer asks for Y(19), we simply hit

RETURN without entering a number

beforehand. This tells the computer

that we have 18 observations. Data on

interest rates are entered similarly.

After we have entered the values of

Table 1, the computer displays what

we have keyed-in, and gives us a

15

Page 18: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 18/86

T a b J ~ 1

S t o c k P r i c e s a n d I n t ~ r e s t R a t e s

Y e a r S , P 5 0 0 3 " o n t ha n d S t o c k I n d e x T-Bm

" o n t h R a t e

8 2 : 1 1 0 0 . 0 1 2 . 3 %

: 29 7 . b

1 3 . 5: 3 9 4 . 5 1 2 . 7

: 4 9 9 . 2 1 2 . 7: 5 9 9 . 2 1 2 . 1: b 9 3 . 5 1 2 . 5: 7 9 3 . 3 1 1 . 4

: 8 9 3 . 5 8 . 7: 9 1 0 4 . 4 7 . 9: 1 0 1 1 3 . 1 7 . 7: 1 1 1 1 7 . 8 8 . 1: 1 2 I I B . 8 7 . 9

8 3 : 1 1 2 3 . 0 7 . 9: 2 1 2 5 . 2 8 . 1

: 3 1 2 9 . 5 8 . 4: 4 1 3 4 . 5 8 . 2: 5 1 3 9 . 9 B . 2

: b 1 4 1 . 9 8 . 8

chance to make corrections. Ten

observations are shown at a time on the

screen, sodonot worry about scrolling.

The computer now estimates our

regression equation, and then displays

R e Q r e s 5 i o n R e s u l t s

T e r lB O8 1

t - S h t i l t i c1 1 . 9 9 b

- 3 . 9 7 9

Y a l u e1 6 5 . 9 4 5- 5 . 4 6 7

R - S q u a r e dF - S t a t i s t i c

. . 0 . 4 9 7

II 1 5 . 8 3 0

S t a n d a r d E r r o r o ft h e E s t i l a h . . 1 2 . 4 5 5

D u r b i n - W a t s o nS t a t i s t i c = 0 . 2 6 3

These statistics are interpreted as

follows. First, BOis the Y-intercept of

our equation and Bl the slope, as Figure

2 illustrates. The Y-intercept of 165.9

means that, if interest rates were zero,

our index of stock prices would equal

165.9, or so we estimate. The slope of

-5.5 means that a one percentage point

rise in interest rates will induce an

estimated 5.5 unit drop in the Index of

500 Leading Stocks. In short, the

relationship between stock prices and

interest rates is indeed negative, as

conjectured.

16

Trend Line

Regression Equation

Stock Prices

I S O ,tV Y·intercept

1 M

I4 D

1 2 1 >

1 0 0

Figure 2. The slope of a line is the change in Y (denoted

by A Y ) divided by tbe change in X (denoted by Il.X ).

These values of BO and B1 are

merely best guesses rather than perfect

measurements, however. The true

values are always unknown and mustbe estimated. But this, after all, is the

purpose of regression analysis.

The t-statistics indicate how precise

the estimates of BOand B1 are. As a

rough rule of thumb, a t-value greater

than two in absolute value means that

an explanatory variable is statistically

significant in explaining changes in Y.

The next three values are goodness-

of-fit statistics. The R-squared, also

called the coefficient of determination,

is the proportion of variation in the

dependent variable explained by the

regression equation. It ranges from 0 to1, with a value close to 0 meaning that

the equation fits the data poorly, and

with a value close to 1meaning that it

fits the data well. Figure 3 illustrates

this. The R-squared of 0.497 in our

example means that changes in interest

rates explain roughly 50% of the total

variation in stock prices. The source of

the other 50% of the variation is

unfortunately unknown.

Next, the F-statistic is the ratio of

the explained to the unexplainedvariance in Y. The higher the value of

F, the better does the regression

equation explain changes in the

dependent variable. The standard error

of the estimate is a measure of the

average error made in predicting Y

using the regression equation, or 12.5

index points in our example.

Finally, the Du rb in-Watson

statistic is used in testing for first-order

serial correlation among regression

residuals. A residual, let me hasten to

explain, is an actual value of Y minus

the corresponding value of Y predictedby the regression equation, as Figure 4

shows. As a rough rule of thumb, a OW

value of around 2 means that serial

correlation is not a problem. The

miserly value of 0.263 in our example

warns us that some systematic

variation in stock prices is unexplained

by interest rates.

Goodness of Fit

Figure 3.A high R 2 means that the regression line fits

the data well. A low R 2 means that the regression line

fits the data poorly.

y High R'

L-----------------x

y low R 2 •

L- x

MICRO No. 70· March 1984

Page 19: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 19/86

Regression Residuals

y

,f ',

T, I

,I!

l ~

Figure 4. A residual is the vertical dtstance between anactual value of Y and the estimated regression line.

1 R E M F L Y N N M A R C H 1 9 8 41 0 R E M M U L T I P L E L I N E A R R E G R E S S I O N2 0 R E M B R I A N J, F L Y N N3 0 R E M N O Y E M B E R 1 9 8 34 0 R E M I N T I A L I Z E5 0 B O S U B 1 0 0 06 0 R E M E N T E R ~ E D I T D A T A7 0 B O S U B 3 0 0 08 0 R E M C O M P U T E9 0 B O S U B 7 0 0 0

1 0 0 R E M D I S P L A Y R E S U L T S1 1 0 B O S U B 1 2 5 0 01 2 0 E N D

ffttffftftttfttttfttfffffftftfff

f I N S E R T C O M P U T E R S P E C I F I C f

f D R I Y E R S H E R E t

f ( S E E T A B L E O F S U B R O U T I N E S ) f

tftffftftftfftftfftffffffffftfft

1 0 0 0 R E M I N I T I A L I Z E1 0 1 0 R E M H E A D I N B1 0 2 0 B O S U B 1 5 0 01 0 3 0 R E M I N I T I A L V A L U E S1 0 4 0 B O S U B 2 0 0 01 0 5 0 R E M I N T R O D U C T I O Nl O b O B O S U B 2 5 0 01 0 7 0 R E T U R N1 5 0 0 R E M H E A D I N G1 5 1 0 G O S U B 3 0 01 5 2 0 Y T = I I : H T = 1 5 : G O S U B 4 0 0 : P R I N T · M U L T I P L E ·1 5 3 0 Y T = 1 2 : H T = l b : G O S U B 4 0 0 : P R I N T - L I N E A R "1 5 4 0 Y T = 1 3 : H T = 1 7 : G O S U B 4 0 0 : P R I N T · R E G R E S S I O N ·1 5 5 0 F O R D = 1 T O 7 5 0 : N E X T D1 5 6 0 R E T U R N2 0 0 0 R E M I N I T I A L V A L U E S2 0 1 0 R E M M A X N U M B E R O F O B S E R V A T I O N S ~ X ' S2 0 2 0 D A T A 5 0 , b

k----------------- x

Summary

In summary, our regression results are

only fair. Changes in interest rates

account for roughly half of the

fluctuation in stock prices over the last

18months. A large part of the market's

movement, then, is left unexplained.

Hence, trying to predict the future

course of the stock market using

interest rates alone is a risky businessindeed. Perhaps Madame Zelna's

crystal ball can defeat the dark forces of

ignorance and uncertainty, and shed

light on the problem.

2 0 3 0 R E A D N X , K X2 0 4 0 P X = K X + l2 0 5 0 D I M C ( P X ) , X ( N X , P X ) , R ( P X , 2 fP X ) , E ( N X ) , B $ ( K X ) , Y $ ( K X )2 0 5 5 D I M T ( P X ) , S ( P X )2 0 6 0 R E M C O E F F I C I E N T S Y M B O L S2 0 7 0 F O R 1 = 0 T O K X2 0 8 0 B $ ( I ) = · B · + S T R $ ( I )2 0 9 0 N E X T I2 1 0 0 R E M Y A R I A B L E S Y M B O L S2 1 1 0 Y $ ( 0 1 = · V -

2 1 2 0 F O R 1 = 1 T O K X

2 1 3 0 Y $ ( I ) = ' X · + S T R $ ( I )2 1 4 0 N E X T I2 1 5 0 R E T U R N2 5 0 0 R E M I N T R O D U C T I O N2 5 1 0 G O S U S 3 0 02 5 2 0 P R I N T · T H I S P R O G R A M E S T I M A T E S A M U L T I P L E '2 5 3 0 P R I N T · L I N E A R R E G R E S S I O N E Q U A T I O N , ·2 5 4 0 P R I N T2 5 5 0 P R I N T · T H E M A X I M U M A L L O N A B L E N U M B E R S O F ·2 5 6 0 P R I N T · O B S E R Y A T I O N S ~ E X P L A N A T O R Y V A R I A B L E S '2 5 7 0 P R I N T · A R E : -2 5 8 0 P R I N T2 5 9 0 P R I N T · · O B S E R Y A T l O N S = · ; N X2 5 9 5 P R I N T - E X P L A N A T O R V Y A R I A B L E S = " ; K X

2 6 0 0 P R I N T2 b l 0 P R I N T · C H A N G E T H E V A L U E S I N L I N E 2 0 2 0 ·

2 6 2 0 P R I N T · F O R D I F F E R E N T L I M I T S , ·2 b 3 0 Y T = 2 2 : H T = b : G O S U B 4 0 0

2 b 4 0 P R I N T · H I T A N Y K E Y T O C O N T I N U E " ;2 b 5 0 G O S U B 6 0 0 : Z $ = X X $2 b 6 0 R E T U R N3 0 0 0 R E M E N T E R ~ E D I T D A T A3 0 1 0 R E M N U M B E R O F X ' S3 0 1 5 G O S U B 3 2 5 03 0 2 0 R E M D A T A O N Y3 0 3 0 G O S U B 3 5 0 0

.,

I

No. 70 . March 1984 MICRO 17

Page 20: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 20/86

3 0 4 0 R E ~ D A T A O N T H E X ' S3 0 5 0 S O S U B 4 0 0 03 0 6 0 R E ~ E D I T3 0 7 0 S O S U B 4 5 0 03 0 8 0 R E T U R N3 2 5 0 R E ~ N U ~ B E R O F X ' S3 2 6 0 S O S U B 3 0 03 2 7 0 V T = I : H T = I : S O S U B 4 0 03 2 8 0 P R I N T · H O W ~ A N Y E X P L A N A T O R Y V A R I A B L E S ·3 2 9 0 P R I N T · A R E I N Y O U R R E S R E S S I O N E Q U A T I O N , "

3 3 0 0 P R I N T · C O N S T A N T T E R ~ E X C L U D E D ? " j3 3 1 0 S O S U B 6 0 0 : K $ = X X $3 3 2 0 K = V A L ( K $ )3 3 3 0 R E ~ C H E C K F O R L E S A L N U ~ B E R3 3 4 0 I F K ) O A N D K ( = K X T H E N 3 4 0 03 3 5 0 V T = 2 2 : H T = 7 : B O S U B 4 0 03 3 6 0 I F K ( I T H E N P R I N T · A T L E A S T O N E X I S N E E D E D ! "3 3 7 0 I F K ) K X T H E N P R I N T ' S O R R Y , O N L Y " j K X j

• X ' S A L L O W E D ! "3 3 8 0 F O R D = I T O 5 : G O S U B 8 0 0 : N E X T 03 3 9 0 S O T O 3 2 7 03 4 0 0 R E T U R N3 5 0 0 R E ~ D A T A O N Y3 5 1 0 S O S U B 3 0 03 5 2 0 P R I N T ' P L E A S E E N T E R D A T A O N T H E D E P E N D E N T ·3 5 3 0 P R I N T · V A R I A B L E , O R y , H I T ' R E T U R N ' ·3 5 4 0 P R I N T ' W H E N T H R O U G H , '3 5 5 0 N = N X3 5 6 0 F O R 1 = 1 T O N X3 5 7 0 V T = 5 : H T = 1 0 : S P = 1 5 : S O S U B 5 0 03 5 8 0 V T = 5 : H T = 2 : S O S U B 4 0 0 : P R I N T " Y ( " ; 1 ; T A B ( 8 ) ; n ) = ' ;3 5 9 0 S O S U B 7 0 0 : Z $ = X X $3 6 0 0 I F Z $ = ' · T H E N N = I - I : I = N X : S O T O 3 6 2 03 6 1 0 X ( I , O ) = V A L ( Z $ )3 6 2 0 N E X T I3 6 3 0 I F N ) 2 T H E N 3 6 6 03 6 4 0 V T = 2 2 : H T = 5 : S O S U B 4 0 0

3 6 4 5 P R I N T " A T L E A S T 3 O B S E R V A T I O N S N E E D E D!"

3 6 5 0 F O R 0 = 1 T O 2 0 : S O S U B 9 0 0 : N E X T D3 6 5 5 S O T O 3 5 1 03 6 6 0 R E T U R N4 0 0 0 R E ~ D A T A O N T H E X ' S4 0 1 0 f O R 1 = 1 T O K4 0 2 0 6 0 S U B 3 0 04 0 3 0 P R I N T ' P L E A S E E N T E R D A T A F O R ' j V $ ( I l j · : "4 0 4 0 F O R J = I T O N4 0 5 0 V T = 5 : H T = 1 0 : S P = 2 0 : S O S U B 5 0 04 0 6 0 V T = 5 : H T = I : 6 0 S U B 4 0 04 0 6 5 P R I N T V $ ( I ) ; ' ( ' j J j T A B ( 8 ) j ' ) = ' j4 0 7 0 S O S U B 7 0 0 : Z $ = X X $4 0 8 0 X ( J , I ) = V A L ( Z $ )

4 0 9 0 N E X T J : N E X T I4 1 0 0 R E T U R N4 5 0 0 R E ~ E D I T D A T A4 5 1 0 F O R 1 = 0 T O K4 5 2 0 F O R L = O T O I N T ( ( N - I ) / I O )4 5 3 0 R E ~ D I S P L A Y D A T A4 5 4 0 S O S U B 5 0 0 04 5 5 0 R E ~ C O R R E C T D A T A4 5 6 0 S O S U B 5 5 0 04 5 7 0 N E X T L : N E X T I4 5 8 0 R E T U R N5 0 0 0 R E ~ D I S P L A Y D A T A5 0 1 0 R E ~ D I S P L A Y l i P T O 1 0 O B S E R V A T I O N S A T A T I ~ E

5 0 2 0 S O S U B 3 0 05 0 3 0 P R I N T ' T H E S E A R E V A L U E S O F ' j V $ ( I l j ' : "5 0 4 0 P R I N T5 0 5 0 F O R J = I T O 1 05 0 6 0 I F J + L i I O ( = N T H E N P R I N T V $ ( I ) ; " ( " j J + L i I 0 ; T A B ( 8 I j

• I = . j X (J + L u o , I I5 0 7 0 N E X T J

5 0 8 0 R E T U R N5 5 0 0 R E ~ C O R R E C T D A T A5 5 1 0 S O S U B 8 0 0

5 5 2 0 V T = 1 9 : H T s l : S O S U B 4 0 0 : P R I N T · C O R R E C T I O N S ( Y / N I H ;5 5 3 0 S O S U B 6 0 0 : A $ = X X $5 5 4 0 I F A $ = ' N ' T H E N 5 6 7 0

5 5 5 0 I F A $ ( ) · Y · T H E N 5 5 1 05 5 6 0 V T = 2 1 : H T = 1 8 : S P = 2 0 : S O S U B 5 0 05 5 6 5 V T = 2 2 : H T = 1 8 : S P = 2 0 : 6 0 S U B 5 0 05 5 6 7 P R I N T C H R $ ( S L )5 5 7 0 V T = 2 2 : H T = I : S O S U B 4 0 0 : P R I N T ' T O B E C O R R E C T E D " j

5 5 9 0 S O S U B 7 0 0 : S $ = X X $5 6 0 0 Q = I N T ( V A L ( S $ ) )5 6 1 0 I F Q « ( I + L f I O ) O R Q ) N O R Q } ( I O + L i I O ) T H E N S O T O 5 7 0 05 6 2 0 V T = 2 4 : H T = I : G O S U S 4 0 0 :

P R I N T ' W H A T S H O U L D T H E V A L U E B E ' j5 6 3 0 S O S U B 8 0 05 6 4 0 S O S U B 7 0 0 : S $ = X X $5 6 5 0 X ( Q , I I = V A L ( S $ )5 6 6 0 B O S U B 5 0 0 0 : S O T O 5 5 1 05 6 7 0 R E T U R N5 7 0 0 V T = 2 2 : H T = 1 8 : S O S U B 4 0 0 : P R I N T • O U T O F B O U N D S I'

5 7 1 0 F O R D = I T O 1 0 0 0 : N E X T D : S O T O 5 5 6 57 0 0 0 R E ~ C O ~ P U T E7 0 1 0 R E ~ D E S R E E S O F F R E E D O ~7 0 2 0 S O S U B 7 5 0 07 0 2 5 R E ~ I N S E R T V E C T O R O F I ' S F O R C O N S T A N T T E R ~7 0 2 7 S O S U B 7 7 5 0

7 0 3 0 R E M T A L L Y ~ A T R I X O F C R O S S P R O D U C T S7 0 4 0 S O S U B 8 0 0 0

7 0 5 0 R E ~ I N V E R T ~ A T R I X7 0 6 0 S O S U B 8 5 0 07 0 7 0 R E M C O ~ P U T E C O E F F I C I E N T S7 0 8 0 S O S U B 9 0 0 07 0 9 0 R E ~ C O ~ P U T E A N O V A S T A T I S T I C S7 1 0 0 S O S U B 9 5 0 07 i l 0 R E M C O ~ P U T E T - S T A T I S T I C S7 1 2 0 S O S U B 1 2 0 0 07 1 3 0 R E T U R N7 5 0 0 R E ~ D E S R E E S O F F R E E D O M7 5 1 0 V = N - K - I7 5 2 0 S O S U B 3 0 07 5 3 0 I F V C I T H E N S O T O 7 6 0 07 5 4 0 R E T U R N

7 6 0 0 P R I N T · Y O U H A V E O N L Y " j V ; · D E S R E E S O F F R E E D O M I":S T O P7 6 1 0 R E T U R N7 7 5 0 R E ~ V E C T O R O F I ' S7 7 6 0 R E ~ ~ A K E R O O ~7 7 7 0 F O R I = K T O 1 S T E P - I7 7 8 0 F O R J = I T O N7 7 9 0 X ( J , I + I I = X ( J , I I7 8 0 0 N E X T J : N E X T I7 8 1 0 R E ~ I N S E R T7 8 2 0 F O R J = 1 T O N7 8 3 0 X ( J , 1 ) = 17 8 4 0 N E X T J

18 MICRO No. 70 - March 1984

Page 21: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 21/86

7 8 5 0 P = I ( + 1 1 0 0 7 0 R E M E R R O R S U M O F S Q U A R E S7 8 6 0 R E T U R N 1 0 0 8 0 E 5 = 08 0 0 0 R E M M A T R I X O F C R O S S P R O D U C T S 1 0 0 9 0 F O R 1 = 1 T O N8 0 1 0 V T = 1 2 : H T = 0 : S O S U B 4 0 0 : P R I N T • C O M P U T I N S • • . • 1 0 1 0 0 E S = E S + E ( I ) t E ( I )8 0 2 0 F O R 1 = 1 T O P 1 0 1 1 0 N E X T I8 0 3 0 F O R J = 1 T O P 1 0 1 2 0 R E M R E S I D U A L V A R I A N C E8 0 4 0 R ( ! , J ) = O 1 0 1 3 0 R Y = E S / Y8 0 5 0 F O R L = 1 T O N 1 0 1 4 0 R E T U R N8 0 6 0 R ( I , J ) = R ( I , J ) + X ( L , I ) t X ( L , J I 1 0 5 0 0 R E M A N O V A T E R M S

8 0 7 0 N E X T L : N E X T J : N E X T I 1 0 5 1 0 R E M T f l T A L S U M O F S Q U A R E S8 0 8 0 R E T U R N 1 0 5 2 0 S O S U B 1 1 0 0 08 5 Q O R E M I N Y E R T H A T R I X 1 0 5 3 0 R E M R E S R E S S I O N S U M O F S Q U A R E S8 5 1 0 R E M T A C K O N I D E N T I T Y M A T R I X 1 0 5 4 0 R s = T S - E S8 5 2 0 F O R 1 = 1 T O P 1 0 5 5 0 R E M S T A N D A R D E R R O R O F T H E E S T I M A T E8 5 3 0 F O R J = 1 T O P 1 0 5 0 0 S E = S Q R ( R Y )8 5 4 0 I F I = J T H E N R ( I , J + P I = 1 1 0 5 7 0 R E M F - S T A T I S T I C8 5 4 5 I F I < > J T H E N R ( I , J + P ) = O 1 0 5 8 0 F = ( R S / K I / R Y8 5 5 0 N E X T J : N E X T I 1 0 5 9 0 R E M R - S Q U A R E D8 5 0 0 R E M I N Y E R T 1 0 0 0 0 R Q = R S / T S8 5 7 0 F O R 1 = 1 T O P 1 0 b l 0 R E T U R N8 5 8 0 R E M A D J U S T K E Y R O W 1 1 0 0 0 R E M T O T A L S U M O F S Q U A R E S8 5 9 0 C = R ( I , 1 i 1 1 0 1 0 S = O : S Q = O8 6 0 0 F O R J = I T O 2 t P 1 1 0 2 0 F O R 1 = 1 T O N8 0 1 0 R ( I , J I = R ( J , J ) I C 1 1 0 3 0 S = S + X ( I , O )8 0 2 0 N E X T J 1 1 0 4 0 s Q = S Q + X ( I , O ) " 28 0 3 0 R E M A D J U S T R E M A I N I N S R O W S 1 1 0 5 0 N E X T I8 0 4 0 F O R J = 1 T O P 1 1 0 0 0 T s = S Q - S t S / N8 0 5 0 X = R ( J , J)~ 1 1 0 7 0 R E T U R N8 0 0 0 F O R L = I T O 2 t p 1 1 5 0 0 R E M D U R B I N - W A T S O N S T A T I S T I C8 0 7 0 I F J ( } I T H E N R ( J , L I = R ( J , L ) - X t R ( I , L ) 1 1 5 1 0 R E M N U M E R A T O R8 b 8 0 N E X T L : N E X T J : N E X T I 1 1 5 2 0 5 = 08 0 9 0 R E T U R N 1 1 5 3 0 F O R 1 = 2 T O N9 0 0 0 R E M T A L L Y C O E F F I C I E N T S 1 1 5 4 0 S = S + ( E ( I ) - E ( I - l ) ) " 29 0 0 5 R E M X ' Y Y E C T O R 1 1 5 5 0 N E X T I9 0 1 0 F O R 1 = 1 T O P 1 1 5 6 0 R E M Y A L U E9 0 2 0 C ( 1 1 = 0 1 1 5 7 0 D I I = s / E S

9 0 3 0 F O R J = 1 T O N 1 1 5 8 0 R E T U R N9 0 4 0 C ( I ) = C ( I ) + X ( J , I ) t X ( J , O ) 1 2 0 0 0 R E M T - s T A T I S T I C S9 0 5 0 N E X T J : N E X T I 1 2 0 1 0 F O R 1 = 1 T O P9 0 6 0 R E M C O E F F I C I E N T S 1 2 0 2 0 T ( I ) = B ( I I / S Q R ( R Y I R ( I , I + P ) )9 0 7 0 F O R 1 = 1 T O P 1 2 0 3 0 N E X T I9 0 8 0 B ( 1 ) = 0 1 1 0 4 0 R E T U R N9 0 9 0 F O R J = 1 T O P 1 2 5 0 0 R E M D I S P L A Y R E S U L T S9 1 0 0 B ( I ) = 8 ( 1 ) + R ( I , J + P ) t C ( J I 1 2 5 1 0 R E M E Q U A T I O N9 1 1 0 N E X T J : N E X T I 1 2 5 2 0 S O S U B 1 3 0 0 09 1 2 0 R E T U R N 1 2 5 3 0 R E M S U M M A R Y S T A T I S T I C S9 5 0 0 R E M A N O Y A S T A T I S T I C S 1 2 5 4 0 S O s U B 1 3 5 0 09 5 1 0 R E M R E S I D U A L V A R I A N C E 1 2 5 5 0 R E T U R N9 5 2 0 S O S U B 1 0 0 0 0 1 3 0 0 0 R E M E Q U A T I O N9 5 3 0 R E M S l i M M A R Y S T A T I S T I C S 1 3 0 1 0 S O s U B 3 0 0

9 5 4 0 S O S U B 1 0 5 0 0 1 3 0 2 0 P R I N T T A B ( 9 ) W R E S R E s S I O N R E S U L T S ·9 5 5 0 R E M D U R B I N - W A T S O N S T A T I S T I C 1 3 0 3 0 P R I N T9 5 6 0 S O S U S 1 1 5 0 0 1 3 0 4 0 P R I N T " T E R M " ; T A B ( 1 2 ) ' Y A L U E ' j9 5 7 0 R E T U R N T A B ( 2 4 ) - T - s T A T I S T I C '

1 0 0 0 0 R E M R E S I D U A L Y A R I A N C E 1 3 0 5 0 P R I N T " - - - - " ; T A B ( 1 2 ' · - - - - - · ;1 0 0 1 0 R E M Y E C T O R O F R E S I D U A L S T A B ( 2 4 ) , - - - - - - - - - - - "1 0 0 2 0 F O R 1 = 1 T O N 1 3 0 6 0 P R I N T1 0 0 3 0 Y H = O 1 3 0 7 0 F O R 1 = 1 T O P1 0 0 4 0 F O R J = 1 T O P 1 3 0 8 0 P R I N T B $ ( I - l ' ; T A B ( 9 ) B ( I ) ; T A B ( 2 4 ) T ( I )

' 1 0 0 5 0 Y H = Y H + X ( I , J ) I B ( J ) 1 3 0 9 0 N E X T I1 0 0 6 0 N E X T J 1 3 1 0 0 Y T = 2 2 : H T = 6 : S O S U B 4 0 01 0 0 6 5 E ( J ) = X ! I , O ) - Y H 1 3 1 1 0 P R I N T - H I T A N Y K E Y T O C O N T I N U E O J

1 0 0 0 7 N E X T I 1 3 1 2 0 s o s u e b O O : Z $ = X X $

No. 70 . March 1984 MICRO 19

Page 22: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 22/86

1 3 1 3 0 R E T U R N1 3 5 0 0 R E M S U M M A R Y S T A T I S T I C S1 3 5 1 0 6 0 S U B 3 0 01 3 5 2 0 P R I N T T A B ( a l · S U M M A R Y S T A T I S T I C S ·1 3 5 3 0 P R I N T1 3 5 4 0 P R I N T ' R - S Q U A R E D = R i R Q1 3 5 4 5 P R I N T1 3 5 5 0 P R I N T ' F ~ S T A T I S T I C = " i F1 3 5 6 0 P R I N T1 3 5 7 0 P R I N T · S T A N D A R D E R R O R "1 3 5 a o P R I N T · O F T H E E S T I H A T E = " i S E1 3 5 9 0 P R I N T1 3 6 0 0 P R I N T ' D U R B I N - W A T S O N '1 3 6 1 0 P R I N T ' S T A T I S T I C = " i D W1 3 6 2 0 Y T = 2 2 : H T = 6 : 6 0 S U B 4 0 01 3 6 3 0 P R I N T ' H I T A N Y K E Y T O C O N T I N U E " ;1 3 6 4 0 6 0 S U B 6 0 0 : Z $ = X X $

1 3 6 5 0 R E T U R N

Listing Notes

The above listing does not include routines toposition the

cursor, get character input, input strings or make a sound.

These are provided below for three BASIC's: Flex,Applesoft and Commodore 64. Key in the appropriate

version for your microcomputer. If you have some other

micro, except for the Atari, you should be able to adapt

this program by fixing up these I/O routines to match the

capabilities/limitations of your system.

If you have an Atari, the program will require more

extensive changes than just these I/O routines. This is

because the program makes use of string arrays which are

not simply supported on the Atari.

2 0 0 R E H A P P L E I I S ~ 8 R O U T I N E S

2 9 9 R E M ff H O M E A N D C L E A R D I S P L A Y ff

3 0 0 H O M E : R E T U R N

3 9 9 R E M ff P O S I T I O N C U R S O R ff

4 0 0 I F V T ) O T H E ~ Y T A B ( Y T I4 1 0 I F H T } O T H E N H T A B ( H T )4 2 0 R E T U R N

4 9 9 R E M ff P O S I T I O N C U R S O R A N D P R I N T S P A C E S ff

5 0 0 6 0 S U B 4 0 0 : P R I N T S P C ( S P ) i : R E T U R N

5 9 9 R E M *f 6 E T S U B R O U T I N E ff

6 0 0 6 E T X X $ : R E T U R N

6 9 9 R E M ff I N P U T S U B R O U T I N E ff

7 0 0 I N P U T X X $ : R E T U R N

7 9 9 R E M ff M A K E S O U N D ff

8 0 0 P R I N T C H R $ ( 7 ) ; : R E T U R N

2 0 0 R E M C O M M O D O R E S U B R O U T I N E S

2 9 9 R E M *f H O M E A ~ D C L E A R D I S P L A Y ff

3 0 0 P R I N T " ( C L E A R } " ; : R E T U R N

3 9 9 R E M If P O S I T I O N C U R S O R f*

4 0 0 P R I N T ' ( H O M E } " ;

4 1 0 F O R X X = l T O Y T : P R I N T : N E X T X X4 2 0 I F H T > O T H E N P R I N T T A B ( H T ) ;4 3 0 R E T U R N

4 9 9 R E M ff P O S I T I O N C U R S O R A N D S P A C E ff

5 0 0 6 0 S U B 4 0 0 : P R I N T S P C ( S P } i : R E T U R N5 9 9 R E H f' S E T S U B R O U T I N E ff

6 0 0 X U = " ·6 1 0 6 E T X X $ , I F X X $ = " " T H E N 6 1 06 2 0 R E T U R N

6 9 9 R E M " I N P U T S U B R O U T I N E ' f7 0 0 X X $ = " " : P R I N T ' C S P A C E I O , L E F T I O } ' i : I N P U T X X $ :

R E T U R N

7 9 9 R E H ' f H A K E S O U N D ( O P T I O N A L ) f '8 0 0 R E T U R N : R E H A D D C O D E T O H A K E A8 0 1 R E M S O U N D I F Y O U S O D E S I R E I I I

2 0 0 R E M F L E X S U B R O U T I N E S

2 9 9 R E M f' C L E A R D I S P L A Y *f

3 0 0 P R I N T C H R $ ( I I ) i C H R $ ( 2 7 ) ; ' X " j C H R $ ( 2 4 ) ; : R E T U R N

3 9 9 R E M f ' P O S I T I O N C U R S O R f '4 0 0 I F Y T } O T H E N P R I N T C H R $ ( I I } ; : F O R 1 1 = 1 T O V T : P R I N T :N E X T I I

4 1 0 I F H T > O T H E N P R I N T T A B ( H T ) ;4 2 0 R E T U R N

4 9 9 R E H f ' P O S I T I O N C U R S O R A N D S P A C E f '5 0 0 6 0 S U B 4 0 0 : P R I N T S P C ( S P ) ; : R E T U R N

5 9 9 R E M f' G E T C H A R A C T E R R O U T I N E ff

6 0 0 I N P U T X X $ : I F X X $ = " X · T H E N X X $ = " '6 1 0 R E T U R N

6 9 9 R E M ff I N P U T R O U T I N E ff

7 0 0 6 0 T O 6 0 07 9 9 R E M f' H A K E S O U N D ( O P T I O N A L ) ff

8 0 0 R E T U R N : R E M A D D C O D E H E R E T O M A K E A8 0 1 R E H S O U N D I F Y O U S O D E S I R E !!

Brian Flynn may be reached at Flynn

Laboratories, 1704 Drewlaine Drive, Vien-

na, VA 22180.

[Ed. Note: It is interesting to examine the differences between the

various implementations of BASIC on as fundamental an

operation as INPUT. To INPUT a NULL string in Applesoit

BASIC, a simple INPUT XX$ will suffice. In Commodore BASIC

you must first set the string to the null string by a XX$ = 1/". The

screen location under the cursor must be a space or the character

under the cursor will be returned as the string. In Flex BASIC,.

used on our FOCUS system and the CoCo among others, the

INPUT statement will not allow a null string input. In this

program I used the letter X as input to be tested and changed into

the null string.

And INPUT seemed so triviall]

20 MICRO No. 70 - March 1984

Page 23: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 23/86

F LO P P Y D IS KS S A LE * $1.19 ea.E conomy M odel or C adillac Q uality

L O R A :E~~~umS~t l We have the lowest prices! L O R A CERTI f iED PERSONALM COMPU TER D IS K

$119.00

13.90

*ECONOMY DISKSGood quality 5 1 1 4 " single sided single density with hub rings.

Bulk Pac 1000ty. $1.19 ea.

10 Oty. 1.39 ea.

Total Price

Total Price

CADILLAC QUALITY• Each disk certified • Free replacement lifetime warranty

For those who want cadillac quality we have the Loran Floppy Disk.on Loran Disks to store important data and programs witexclusive process) plus each disk carries an exclusdisks you can have the peace of mind widevelopment.

100% CERTIFICATIOSome floppy disk manufaccertified. Each Loran disk islifetime!

FREE REPLACEMENTWe are so sure of Loran Disksty materials or workmanship

AUTOMATIC DUST REMJust like a record needle, disk ddisks the Loran smooth surfacegrind your disk drive head like sa(dust & dirt) are being constantlyprobability rate of any other disk in

Loran is

Just to prove it even furtherList $4.99 ea. INTR

because they can relyis 100% certified (an

. With Loranrs spent in program

other floppysurface willdisk-killersthe highestof the disk.

• 60% of all drive downtirTl€ is directly related to poorly maintained drives.

• Drives should be cleaned each week regardless of use.

• Drives are sensitive to smoke, dust and all micro particles .• Systematic operator performed maintenance is the best way of ensuring error free use of your computer

system.

The Cheetah disk drive, cleaner can be used with single or double sided 5'1." disk drives. The Cheetah is an

easy to use fast method of maintaining efficient floppy diskette drive operation.The Cheetah cleaner comes with 2 disks and is packed in a protective plastic folder to prevent contamination.

List $29.951 Sale $19.95

i"A-:-;;';-~r-:~;n; ; ':1;-: ': - ;=': :: ;- - ;; ; I; ; ;- ; :; :; :; ; i1 please add 6% lax, Add $2Q,() ( ) for CANADA, PUERTO RICO, HAWAII 11 orders, WE DONOT EXPORTTO OTHER COUNTRIES, 1

1 Enclose Cashiers Check, Money Order or Personal Check, Allow 1 4 11 days for delivery, 2 10 7 days lor phone orders, 1 day express mail! 1ICanada orders must be in U,S, dollars, Visa, MasterCard· C,O,D, I

. _ - - - - - - - - - - - - - - - - - - - - - - - _ .

PROTECTOE N T E R P R I Z E 5 ,w , LOV' OURCUSlOW,RS,

BOX 550, BARRINGTON, ILLINOIS 60010Phone 3121382·5244 to order

Page 24: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 24/86

SANYO MONITOR SALE!!

• 80 Colurnns x 24 lines

• Green text display

• East to read - no eye strai n• Up front brightness control

• High resolution graphics

• Quick start - no preheating

• Regulated power supply

• Attractive rnetal cabinet

• ULand FCC approved

79110

9" Data Monitor

• 15 Day Free Trial- 90 Day Immediate Replacement Warranty

9" Screen -Green Text Display $ 79.00

12" Screen - Green Text Display (anti-reflective screen) $ 99.00

12" Screen - Amber Text Display (anti-reflective screen) $119.00

14" Screen -Color Monitor (national brand) $249.00Display Monitors From Sanyo

With the need for computing power growing every day, Sanyo hasstepped in to meet the demand with a whole new line of low cost, highquality data monitors. Designed for commercial and personal com-puter use. All models come with an array of features, including up-front brightness and contrast controls. The capacity 5 x 7 dotcharacters as the input is 24 lines of characters with up to80 characters per line.

Equally important, all are built with Sanyo's commitmentto technological excellence. In the world of AudiolVideo, Sanyo issynonymous with reliability and performance. And Sanyo quality isreflected in our reputation. Unlike some suppliers, Sanyo designs,manufactures and tests virtually all the parts that go into our products,from cameras to stereos. That's an assurance not everybody cangive you!

eSANVO IOfficial Video Products

of theLos Angeles 1984Olympics

< . .. . , . . >t.. .. ' . _,-_

• LOWEST PRICES. 15 DAY FREE TRIAL. 90 DAY FREE REPLACEMENT WARRANTY

• BEST SERVICE IN U.S.A.· ONE DAY EXPRESS MAIL. OVER 500 PROGRAMS. FREE CATALOGS

~~~;~~~;;~;~~~7:=:C~;~~~~~iIlease add 6% tax. Add $20.00 for CANADA. PUERTORICO. HAWAIIIlarders. WE00 NOTEXPORTTOOTHERCOUNTRIES. I

IEnclose Cashiers Check, Money Order or Personal Check. Al low 14IIays for delivery, 2 to 7 days for phone orders, 1 day express mail! IICanada orders must be in U.S.dollars. Visa· MasterCard· C.O.D. I

.------------------------~.

PRDTECTDE N T E R P R I Z E S (WE LOVE OUA CUSTOMERS)

BOX 550. BARRINGTON, ILLINOIS 60010Phon. 3121382 · 5244 to order

Page 25: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 25/86

FANTASTICPRINTERSALE

a slow

a s

• 15 Day Free Trial- 1 8 0 Day Immediate Replacement Warranty

80 COLUMN THERMAL PRINTER - 60 CPSBi-directional, dot matrix, prints 8'/," letter size paper, full 80 columns, high

resolution graphics, dot bit addressable, special symbols and true decenders!

(Centronics parallel interface)

80 COLUMN TRACTOR·FRICTION PRINTER - 80 CPSBi-directional, dot matrix, impact, prints single sheets, continuous feed paper,

adjustable columns, 40 to 132 characters! Roll paper adapter $32.95. (Serial or

Centronics parallel interface)

PREMIUM QUALITY 10" CARRIAGE T /F PRINTER - 120 CPSBi-directional, impact, 9 x 9 dot matrix with double strike for 18 x 18 dot matrix.

High resolution bit image (120 x 144 dot matrix) underlining back spacing, left and

right margin settings, true lower decenders, with super and sub scripts. Prints

standard, italic, block graphics, special characters, plus 24 of user definable

characters and much morel! Prints single sheets, continuous feed and roll paper!(Centronics parallel interface)

PREMIUM QUALITY 15 1h" CARRIAGE PRINTER - 120 CPSHas all the features of the Premium Quality 10" Carriage T IF Printer above plus a

15' ,1," carriage and more powerful electronic components to handle large business

forms! ( Centronics parallel interface)

HIGH SPEED PREMIUM QUALITY T /F

10" PRINTER - 160 CPSSave printing time with these plus features: 160 CPS speed, 100% duty cycle, 8K

buffer diverse character fonts special symbols and true decenders, vertical and

horizontal tabs. This is Red Hot Efficiency!!! (Serial or Centronics parallel interface)

HIGH SPEED PREMIUM QUALITY

T /F 15 112" PRINTER - 160 CPSHas all the features of the 10" Carriage high speed printer plus a 15'/:z"carriage and

more powerful electronics to handle larger business forms! (Serial or Centronics

parallel interface)

PARALLEL PRINTER INTERFACES: (IN STOCK)• For VIC·20 and COMMODORE 64 $49.00

• For all APPLE COMPUTERS $69.00

• For ATARI 400 and 800 COMPUTERS $79.00

NOTE: Other printer interfaces are available at computer stores! •

LIST

$199

SALE

$149

$399 $209

$499 $289

$599 $379

$699 $499

$799 $599

•PROTECTO

E DO NOT EXPORT TO OTHER COUNTRIES EXCEPTCANADA.

Enclose Cashiers Check, Money Order or Personal Check. Allow14 days for delivery, 2 to 7 days for phone orders, 1 day express

mail! Canada orders must be in U.S. dollars. We accept Visaand MasterCard. We Ship C.O.D.

E N T E R P R I Z E S IWE LOV~ OUR CUSTOMERS)

BOX 550, BARRINGTON, ILLINOIS 60010

Phone 3121382·5244 to order

Page 26: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 26/86

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1~ ~

* *Announcing* *The Winners

of the

* *Graphics Contest* *

~~--~--ii--ii~-ii

~~

--~~1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ;

iii-~~-ii-

~lllllllllllill

Grand Prize

Taking the Bait

Commodore 64

Koala Pad

Title:

System:

Graphics Package:

Computer Artiste:Thaworn Phatinawin

1425 E. Ocean Blvd. #11

Long Beach, CA 90802

(This photo is on this month's cover.

Another entry by Mr. Pbatinawin titled: MICRO appeared

on last month's MlCRO cover.)

Apple Winners

First Prize

Title:System:

Graphics Package:

Computer Artiste:

Country 5AppleD

Koala/ Micro Illustrator

Thomas Wilson

5 Cresta Circle #9

San Rafael, CA 94903

Second Prize

Title:

by:

Polly Want a Cracked

Lori Karoub

Ypsilanti, MI 48197

Color Computer Winner

First Prize

Title:

System:

Graphics Package:

Computer Artiste:

Space Shuttle

Color Computer

Personal Software

Eric White

375 Palm Springs Drive #1112

Altamonte Springs, FL 32701

2 4

Congratulations hom the staff of MICRO to all the

winners of the Graphics Contest which was announced in

the September, 1983 issue. The subjects and methods of

presentation were all interesting, colorful, and varied. A

surprising number included animation as well.We truly enjoyed the efforts of everyone who entered, and

we thank you for taking the time to participate.

Atari Winners

First Prize

Title:

System:

Graphics Package:

Computer Artiste:

Dragon Slayer

Atari 800

Micropainter

Vic Albino

18501 194 NE

Woodinville, WA 98072

Second Prize

Title:

by:

Loon Haven

Edward H. Cheely

Accord, NY 12404

Third Prize

Title:

by:

Landscape

Jane Zinke

San Diego, CA 92115

Title:

by:

Starwars Collection

Jim Stevenson

Fairfax, VA22033

Commodore Winner

There was only one entry in the Commodore class. This

entry was so good that it won the Grand Prize. Too bad

you did not take the time to enter - you would have

WON.

MICRO No. 70 - March 1984

Page 27: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 27/86

215-822-7727 WRITE FOR CATALOG. Add 5150 per o rder for United Parce l

252 Bethlehem P'k A B Com puters We pay b al an ce o! UPS s urf ac e s hip pi ng c ha rg es o n a ll p re pa id o rd ersColmar PA 1891 ~ e (add extra for m ail APO FPO air) PriCeS Include cash discount

, Regular prices s lightly higher Prices subject to change

Hewlett Packard rh~W r i t e o r c a J l l o r p r i c e s . . : : ~

- - - - - s P E C i A L s - ; ; i N T R i G A T E - O C - l i c u I T i - - - -6 5 0 2 7 . 4 5 1 0 / 6 . 9 5 5 0 /6 .5 5 1 0 0 / 6 . 1 56 5 2 0 P IA 5 .1 5 1 0 / 4 . 9 0 50/4 .45 1 0 0 / 4 . 1 56 5 2 2 V IA 6 .4 5 1 0 / 6 . 1 0 5 0 / 5 .7 5 1 0 0 / 5 .4 52 7 1 6 E P R O M 4 . 4 5 5 /4 .2 0 1 0 /3 .9 52 5 3 2 E P R O M 5 . 9 0 5 / 5 .7 5 1 0 / 5 .4 56 1 1 6 2 1 0 < 8 C M O S R A M 6 . 4 5 5 /6 .2 0 1 0 /5 .9 54 1 1 6 R A M 8 f o r 1 4i!.~-~~-_____ . E . : Q . Q

A n c h o rA u t o m a t i o n

S i g n a l m a nM o d e m sF R E E S OU R C E M E M B ER S H IP W IT H S IG N A LM A NA l l S ig n al m an M o d e m s a re D i re c t C o n n ec ~ an d p r o v i de t h eb e s t p r ic ~ p e rf o rm a n c e v a lu e s.

D i ll er I n d O E M i aq u ir il s i ai ll ed

V . lk lm e d e m w n . C lm p a l l r C I ~ I . ( 9 9 1 6 8

Mark V I for IB M P ers on alC om pu te r (2 79 ) 1 39Mark V II Auto D ia l/Auto Answer (159) 99Mark X II Smart M ode l 1200/300 (399) 299

o c - i l AV i S - Sm i i i . d i ; - - - - - - - - - - - - - - - - - - - - Z I 9D C H a y e s S m a r t r r o d e m 1 2 0 0 / 3 0 0 5 2 9-----------------------------------

{_. _.. ~

P R O M Q U E E N ' . r V IC

A p p ll E m .l l I . r ' . r C a m ll e d. r e 6 4

S T A T S l Il i al le a P lc D • • 'II' C 6 4

S . l I d o lk 2 L n .1 S l l a d ' . r C 6 4 . r V ICC 6 4 N IC S w i t ch ( ne tw o r k in g )

B A C K U P V l .O l i p . c ap l. r fa r C 6 4 . r V ICC A R D B O A R D / 6M o t he rb o ar d - V I CC A R D B O A R D / 5M o t he rb o ar d - C 6 4C A R D P R I N T G P ri n te r I n t w i th G r a p h ic sC A R D P R I N T B P r in te r I nt er fa c e -- C 6 4 N I CC A R D B O A R D / 3s M o th e rb o ar d - V I CC A R D C O C 6 4 N IC C a lc u la to r K e y pa dC A R D R A M / 1 6 R A M E xp an si o n - V I C

C .m p le tl C A R o C o U.. l a s to c kC I E a nd V I E I E E E I n te r f ac es i n s to c k

M S o S u pe ro r i" 'II' C 6 4 . r I E EEM A E A s se m b le r f o r C 6 4

K a l i l T • • c ~ T I~ I. l - C 6 4 . r V ICC B C 4 /1 2 1 2 - b H A II0 B l ln I + S . l h n n

M u l t l p ll . ' . r C 6 4D u st C o v e r f o r C 6 4 o f V I C

3 6 55 0

7 91 9 9

7 96

A P - P L E = r n l t n r L r N - - f f E M SF R A N K L IN - c .m p l. l l l 1 n I n l t o c k

Q U E N T IN o r l l i l l a r A p p le / F n n k l l a 2 1 9

S w . ,p . r St . p p . r 2 6a u to m a ti c s w it ch b e tw e e n p a dd le s a n d j o y s t ic k

K R A F T A p p l. J O Y l tl ckK r a f t A p p le P a d d le P a ir

K I l II T I U C ~ T I ~ I e I- A p p l t/ F n a k li a

S P IN N A K ER S alh n r e i l s t I C k

B r eu n.a d S o H w lr e I n a la ck1 6K R A M C a rd f o r A p p le

M n l t l, I It - M l c r e I 8 H

S al l d o lk 2 L il l i S lI n d ' . r A p p l.

S e ri al C a r d f o r A p p leM C P R A M / 8o c aI I Im . C I r d 'II' I II ( A P f T X T IZ 8 0 S o f t c a rd a n d C P / M ( M ic ro s o f t)R A N A E l it e I w i th C o n t r o l le rP a r a ll e l P r i n te r I n te r f a ce / C a b l e

M l c re ll k l i d M C P I l I I r l lC l l l a s t I C kG r a p ple r + I nt er fa c eK r a f t P r o d uc ts f o r A p p l e i n s t o c kD C H a ye s M i cr om o d em II

P F S : A l l

P F S : R e p l rt

V ld ex 8 0 C o lu m n C a r d

A "I I 1 11 1 B i lk

[tcommodore

S .. B S f o r P ll1 Ia I. B u s in es s . l a d E du c l f ll lu llr II IU l ll .B t s. E liu a t lo B I ( D is cH I tS ln il lb le .

P E lS C A N I $ 2 4 5 b a s e p r i c eA l l o w s y o o to c o nn ec t u p to 3 0 C B M /P ET C o m p ute rs t os h a re d d i sk d r i v es a n c f p r in t e rs . C o m p l e t e ly t r an s p a re n t t o t h eu se r . P e rf ec t l o r s ch o o ls o r m u l t ip le w o r d p ro c es sin g COlI -

f ig u r at io n s . B a s e c o n f i gu r at io n s u pp o r ts 2 c o m p u te r s. A d d ~

~ ~ ~ ~ ~ . .E : .~ ~ p s $ 1 ~ ~ ~ a c h ~ _

170

C I I I

9 5

2 91 2 9

2 06 45 6724 02 23 24 4

C O M P A C K lS T C P $ 1 1 51 1 1 I1 1 1.I .t T l rm i . l l I ' I c Q ll f ar P ET . C B M . C 6 4I nc lu d es A C I A H a rd W a r e / S T C P S o f tw a r e---------------------------_.S C R E E N M AK ER 8 0 C o lu m n Ad l ,te r f l r C 64 1 4 5~ ~ ~ ~ ~ ! ! .~ ~ _ ~ i l i~ _ ~ _ ~ ~ ~ _ s a p p l i c ~ ~ ~ _

G E N ES IS C lm p u t.r C e rpV IC . l l r e l e r I I . r C 6 4 . . w .1 I I 5 0

c o m b in e w i th B S R r ro d u l es fo r h o m e o r b u si ne ss c o nt ro l

C O MS EN S E R .. . . I I ' S . . . , a IA d . p l t r ' . r C 6 4 a r V IC 3 5

C O M V O IC E S , . I ~ . $ lD r l a r C 64 . r V I C 1 3 9i n c lu d e s s o f tw a r e for t ex t t o s pe ec h , p it ch , e t c .

C O M C L O C K R i l l T Im . C l a ck wiI~ h n . r y n c b p 4 5

vic20p~d;t.-;datt; ' ;;I;-~;d-----------D I r e E M I S o l lw l r e U M I S I 'm r eA B A C U SS l l I w I r e H E S S . b l r e

~~~~~-~-~£_---~-----~~~!~~----------?~V IC T O R YS .H w lr e ' . r V IC l id C 6 4M e t a m o r p h o s i s 1 6 C r e a to r ' s R e v e n g e 1 6L a b y r i n t h of C r e a t o r 1 6 G a la c t i c C o n q u e s t 1 6K o n g o K o n g 1 6 A n n i h i l a t o r 1 6C h o m p e r M a n 1 6 G r a v e R o b b e r s 1 3

~~ty H~~! ~ ~!l.~~!~~~_~.~P A P E R C L I P w . r d P r l lC l l S a r 9 9

O R A C L E D i l l B i l l l r e m B l n . r i l l l a d u d .d 1 0 9

S u p . r B I I C l n l l r e l l B i l l e r t e a I n c l .d ld ' 5 9C o m r r o d o r e 64 P r o g r a m m e r s R e f e r e n c e G u i d e 1 6

M l c r e C ~ '1 I ' . r C 6 4 -8 l e n ll I I , Il ly 1 9e x c e ll e n t g r a p h ic s an d c o l o r

S P IN N A K ER S .l h nn C 6 4 . A p p le , I B M . A l l r lC o m p ut e rs F i r st B o o k o f P E T/ C B M

C 6 4 . r V IC S W IT C HP O W E R R O M U t il i ti e s f o r P E T /C B M

w .r d P r e 3 + / 6 4 w n . S p l l l . a t. rW o r dP r o 4 + - 8 0 3 2 , d is k , p r in te r

S P E L LM A S T E R s p .l l i a . c n c ke r ' . r W . rd P r eV I S IC A L C f o r P E T , A T A R I ,o r A p p l e

P E T -T H O P ET t . E p1 8 1 G n p ~ IC I S .H w lr e

S M -K IT .a u lC ld P ET /C B M R D . U t l l " l e aP r og r a m m e rs T o o lk it - P E T R O M U t ~ it ie sE A S Y C A L C f o r C 6 4P E T S p a c e m a i k e r II R O M S w it ch

C O P YW R I T E RW . n I P re c . l l l r ' . r C 6 42 M e te r P E T t o I E E E o r I E E E t o I E E E C a b leD u st C o v er f o r P E T , C B M , 4 0 4 0 , o r 8 0 5 0

C m C l a tl r la m (A D A lB o o , A o A I 4 5o , S A D l l n l t o c l l l

P I I g n m m i l . tn P E T /C nU C .m p l le l l - R .W is t 2 0C om pu t e r s M ac h i n e L a n g u a g e f o r B e g in n e r s 1 1

M U L T I P L A N f a r C 6 4 7 9

H E S M O D EM wM S . ' t w l r e 6 5

H E S S . lh n r e I n d H lm lr e I n a lo ck

~~L~!!I'~'!.!'!.~!'~~ _

4 03 0

9 0

5 9

1 8 5

2 9

8 91 3 92 3 53 8 96 9

F le x F ile f o r P E T /C BM I C 6 4 $ S OD a t ab a se , R e p o r t W ~ i t er w i th c a lc u la ti o ns , M a i li ng U s t s .

f iR T H f ar ji { T iC 6 4 f u i i F I G ; ; ' ~ 1= -c ;' g ~V R i le Y - -- S 50

M . II C 1 D 1 ,U . r '. r F o a T H f o r in de pe nd en t o b je c t c o de 3 D

i M M M P A S c i L l ii ~ ~ P E T ~ i M / C 6 ~ - - - - -- - _ g 5

E A R L 'o r P E T / C B M D is k - b a s e d A SS E M B L E R 6 5

S ; p e r & r l ' - ~ i C l = - iAS i c t ia l i i" - E i i i u r U - a ---45~ ~ . ! .~ h ~ ~ ~ g r a p h i~ r o u t i n e ~ ~ ~ P E T /C _~ ~ _

R A M /R O M fo r P E T / C B M 4 K $ 7 5 8 K $ 9 0

1 2 9

2 9 9

9 5

9 52 0 9

1 9

DISKSPECIALS II

1 0 /2 .2 0 5 0 / 2 .0 0 100/1.95

1 0 / 3 .0 5 5 0 / 2 .8 0 1 00 / 2 .7 5

1 0 / 2 .3 0 5 0 /2 .1 0 1 0 0 /2 .0 61 0/ 2 . 8 5 5 0 / 2 .7 0 1 00 / 2 .6 5

S c o tc h ( 3 M ) 5 " s s /d dS c o t ch ( 3M ) 5" d s l d dS c o tc h ( 3 M ) 8 " ss/sd

S c o tc h ( 3 M ) 8 " s s /d d

W e s t o c k V E R BA T IM D IS K SW r t te f e r D al l r I u d D EM p r ic e s '

S e n t in a l 5 " S S / d d 1 0 / 1 .9 0 5 0 / 1 . 8 5 1 0 0 / 1 .8 0S e n t in a l 5 " d S /d d 1 0 / 2 . 5 5 5 0 / 2 .5 0 1001 2 .45

W e s t o c k D y s a n d i s k sW ab a s h 5 " S S / s d 1 0 / 1 .6 0 5 0 / 1 .5 5 1 0 0 / 1 .4 5W ab a s h 5 " S S / d d 1 0 / 1 .9 0 5 0 / 1 . 8 5 1 0 0 / 1 . 7 5

W ab a s h 8 " S S /s d 1 0 / 2 .0 0 5 0 / 1 . 9 5 1 0 0 / 1 . 8 5

W e s t o c k M A X E L L D IS K SW r ite f o r d ea le r In d D EM p ric es '

D is k S t o r a g e P ag e s 1 0 f o r $ 5 H ub R i n g s 5 0 f o r $6

D i s k Ubrary C as e s 8 " - 3 .0 0 5 " - 2 .2 5

H ea d C le a n i n g K it s 1 2A M A R AY D i sk S to r ag e S y ste m s i n s t o c k

~~~~~~~~!.!:!!'~~~£~~~~~~~--------C A SS E TT E T A PE 8-A G F A P E- 6 1 1 P R EM IU MC - 1 0 1 0 / .6 1 5 0 / .5 8 1 0 0 / . 5 0C - 3 0 1 0 / . 8 5 50 1 . 8 2 1 0 0 / .7 0-----------------------------------

1 1

1 2 97 8

8 52 9 5

D AT AS H IE L D B A CK U P PO W ER S O U R C E $ 2 6 5B a t te r y b a c k u p U n i n te r ru p ti bl e P o w e r S u p p ly w i th s u rg e a n c f

~~~~~~~~~~~~~Y..~~~!_!l~~~~ _

M l f tl P l n - lB M If A p p le 1 8 5Q u a d b o ar d f o r I B M a v a il ab leK O A L A To u ch T a bl et s- A p ple , A t ar i, I B M , C B M

P A c ~ I . x t 5 0 0 0 S .H w l r e P I C D . . 2 0 9

P F S S aH w lr e ' . r I B M l a d A p p l. i a a ll c kV O T R A XP e r s o n a l S p e e c h S y s t e m 2 8 0

B M C 9 1 9 1 C . l e r M .a H . r 2 2 9B M C 1 2 A 1 2 " G r e e n M o n i to r 7 9

B r e IH I ' H R - 7 5 o ll ay W b .. 1 P r i l t l r 7 6 9

o y m Ir e tn ~ 0 1 - 1 5 o l l s y W ~. . I P r l l l l r 4 6 9I t o h P r o w r i t e r P a r a l l e l P r in t e r 3 7 9

P I _ I c 1 0 9 0 P r l a i e r wII~ C a rr e sp lln d ln ce M 8 II 1 2 79D a i s y w r i t e r 2 0 0 0 w i t h 4 8 K b u f f e r 1 0 2 0

a .. I I I I 0 1 2 9 9

E P So N , O k l o" S lI r M l cr ua lc s , tn le rs I I s ta c tU S I C o m p u M O D 4 R F M o d u l a to r 2 9

W . S la c k A M D el M .. H e r sA m d e k D X Y - 10 0 P lo t t e r 5 9 0A P P r o d u c t s 1 5 % O F FC O M P U T E R C O V E R U P S I N S T O C K

B R O O K S6 o l l l i t S I 1 1 1 S lp p r e l S l f /N o iS i F lt e r 5 4S u r g e S u p p r e s s o r - 6 o u t l e t 2 9E le c t r o h o m e 1 3 0 2 - 2 1 3 " H ~r e s R G B M o n i to r 3 3 5P a n a s o n i c 1 2 " M o n i t o r (2 0 M H z ) w i t h a u d io 1 3 5

S y a l r t e t S Y M - I M l c r e c e m ,u te r 1 8 9

A LL B O O K In d S O F T W AR E P R IC E S D IS C OU N T ED

1 8 9

4 0

4 03 565

3 6

6 94 08

U S I V l t l IO M l l li l in - G m a II' A M B E R 2 0 M H z li-ra.________!I~!..!~_~~J!~!~~I__I!!!~~ _

7 ' 1 1 1 1 ' 6 I datasystemsZ V M - 1 2 2 A 1 0 9 Z V M - 1 2 3 G 9 5Z V M - 1 3 1 3 0 0 Z V M - 1 3 5 5 1 0H E R O 1 · R O D l t ( f a c t o r y a s s e m b le d ) 2 1 4 5Z 2 9 T e rm i na l ( D E C an d A D M co m p a t i b l e ) 6 8 0Z T - 1 0 I nt el T e r m in a l w i t h S e r ia l P o r t 3 4 0Z 1 0 0 1 6 - b i t /8 - b i t S y s t e m s C A L LW e s to c k e n ti re Z e n it h l i ne .

A T A R I- W E S T O C K E N T IR E L IN ES P IN N A K E R a n d B r o d e rb u n d S o ft w a re i n S t o c k .

Page 28: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 28/86

C redit R e isterby Jo se ph K atta n

Keep track of redit card purchases as they occur to

avoid overspe ding, and to be sure your monthly

bills are corre t

Requirements:

Any Atari Home Computerwith minimum 24K RAM

Disk Drive

Most of us lose track some times of

how much money we have spent on

credit cards. Credit card companies do

not supply us with registers for keeping

track of such things and most of us just

toss the little slips of paper that we

receive after making a purchase with a

credit card into some drawer where

they can be safely forgotten. Sure, we

have some idea of how much we have

outstanding on credit cards, but then

again every once in a while a bill comes

in with some forgotten purchase, like

that new half size disk drive. Credit

Register will do away with all of these

problems. The program will keep track

of all of your credit card purchases on

up to eight separate accounts and

automatically update balances, billing

information, and unbilled purchases.

Credit Register is a disk-based

program, although it can be easily

modified to run on a 16K tape system.

The first menu in the program presents

you with three choices: Review Files,

Revise Files, and Create Files. When

you run the program for the first time,choose the "Create Files" option. This

will write to a data disk a grid of arrays

matrices in which your data can be

stored. After that initial use, you can

create new accounts, revise account

data, and delete accounts using the

"Revise Files" option.

If you only wish to review the

status of any account, choose the

"Review Files" menu option. To enter

data into the program, choose the

"Revise Files" option. You will find

this to be the most commonly used

26

entry on the main menu. When you

choos either option, Credit Register

will p ompt you to enter your data disk

into he disk drive. Your may, of

cours , store your data on the same

disk a the program, in which case you

will n t have to swap disks. Once you

have he proper disk in the drive and

have ressed {RETURN}, the program

will I ad your data files into memory

and d splay a list of eight accounts. If

you ave not named any account, it

will ppear on the screen display as

"Unu ed." You will then be asked to

enter he number (from 1 to 8) of the

accou t which you wish to review or

revise If you are creating a new

acco nt, enter a number of an

"Unu ed" account. Let us assume here

that ou have chosen an account for

whic data has been previously

enter d. The screen display should look

like F gure 1.

A C C O U N T : V I S AN E W A M O U N T B I L L E D :B I L L T O T A L : 3 0 7 . 5 7

0 1 1 0 / 0 7 / 8 30 2 1 0 / 1 4 / 8 30 3 1 0 / 3 1 1 8 30 4 1 0 / 3 1 / 8 30 5 1 0 / 3 1 1 8 30 6 11 / 11 i83

0 7 1 1 1 1 1 1 8 30 8 1 1 1 1 2 / 8 3

T O T A L : 5 6 0 . 6 4

D I S C SA M T R A KT O Y SB O O K SC O S T U M EP A C M A NF A B R I CB O O K S

1 ) P U R C H A S E4 ) E D I T A C C T

Menu entry 1 allows you to enter

new purchase information, entry 2

billing information, and entry 3

payment information. If you choose

any of these options, the program will

lead you step-by-step through the

proper data entry procedures. It will

prompt you to enter the date in a

month/day/year format over a display,

enter the amount of the purchase or

bill, and a name for a purchase. When

you enter billing information, the

program will ask you to identify the

purchases that have been billed and

will place a "B" next toany billed item

until you have completed entering the

billing information. When you have

done so, all billed-items will be deleted

from the list of unbilled purchases and

the screen display undated to reflect

that revision. Menu item 5 should be

used only to establish or revise an

O R I G B A L : 0 . 0 0

3 0 7 . 5 7D U E : 1 1 1 2 0 / 8 3

4 5 . 0 05 3 . 0 021. 89

16. 17

2 3 . 7 33 4 . 7 842.76

1 5 . 7 4

U N B I L L E D : 2 5 3 . 0 7

2 ) B I L L I N G 3 ) P A Y M E N T

5 ) A C C T N A M E 6 ) E X I T

MICRO No. 70 - March 1984

Page 29: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 29/86

account name. Menu item 6 allows you

to exit the account revision mode.

Menu item 4, "Edit Acct." allows

you to correct erroneous data in the

account's file. When you choose that

option, you will be presented with a

new menu:

j) O R I G B A L 2 ) L A S T B I L L 3 ) E X I T

4 ) D E L E T E P U R C H A S E 5 ) D E L E T E A C C TYou may modify the original balance,

the amount of the last bill, delete any

purchase, or delete the entire account

by entering the appropriate item

number on this menu. This part of the

program is self-explanatory and the

program will lead you through the

correct entry procedures step-by-step.

Credit Register comes with

restrictions and will inform you if you

violate any of them. The program will

not accept more than 12 unbilled

purchases for any account; it will tellyou that if you attempt to exceed the

limit. The program also limits you to

an eight-character name for any

account or purchase. Again, if you

attempt to exceed it, Credit Register

will remind you of the limit and give

you another opportunity to enter the

data. If a bill amount that you entered

does not match the sum of the

purchases that you had told the

program were on the bill, Credit

Register will give you an opportunity to

reconcile the discrepancy. If you

attempt to register a payment whenthere is no bill outstanding, the

program will inform you of the

problem. The program will also refuse

to accept an invalid date. In general,

Credit Register will not accept

incorrect entries or will advise you of

any apparent problems in data that you

are entering.

Every account display in the

program will show all unbilled

purchases, the original account

balance, the amount of new items

reflected on the last bill, the total

amount of the last bill, the total

amount outstanding on the account,

and the total value of unbilled

purchases. When you are revising

accounts, the program will revise the

total in each category and identify

purchases that have been billed or

deleted until you complete the data

entry process, at which time a new

screen will be drawn without the billed

or deleted items.

A note on data entry. At any point

in the program at which you are

No. 70 - March 1984

allowed to press any key, you may

return to the main Credit Register

menu by pressing the {OPTION} key.

Thus, ifyou wander into anypart of the

program by mistake, you can always

leave it by pressing {OPTION}. The

only drawback to this method of escape

is that program memory is cleared of all

data that you might have entered.

The data entry routine allows this

method of escape because the INPUT

statement is never used in Credit

Register. Instead, the subroutine at

lines 300-312 accepts individual

keystrokes, tests them, and accepts

them only if they are valid. For that

reason, the cursor control keys farrow

keys) are ignored by the program. If

Credit Register expects numerical data,

it will ignore all keys except the

numbers 0 through 9, the period mark

and, of course, the {OPTION}key. The

date entry routine beginning at line 240

similarly tests individual keystrokesand accepts only numerical entries and

the {OPTION} key. Both routines were

used in my program, The Investor, in

the February 1984 MICRO and are

explained in that article.

The routines at lines 680 through

760 are used to transfer memory image

files from disk to RAM and vice versa

using the Atari's resident disk handler.

Credit Register uses this technique to

save and load the data files that you

create using the program. The

advantage of this technique over using

INPUT # and PRINT # statements isspeed. The program loads the entire

data file, consisting of over 1000string

array elements and a 9 by 14matrix of

floating point numbers in about one

second! The technique is similar to

those used to save and load special

fonts and graphic screens.The starting

address in RAMof the data to be saved

or loaded and the length of the area of

memory to be saved or loaded are

POKEd into the appropriate addresses

in a special buffer used by the Atari for

input/ output operations, together with

a read or write command. The memorylocations and commands are listed in

Ian Chadwick's Mapping the Atati at

pp. 83-89. The USR command then

passes control of the program to the

resident disk handles, which handles

the data transfer in a jiffy.

Because of the use of this special

method of communicating with the

disk drive, it is absolutely imperative

that the DIM statement in line 10 be

typed in exactly as it appears in the

program listing. Atari BASIC allocates

MICRO

RAM to strings and arrays in the order

in which it encounters them. Since we

are POKEing into the I/O buffer an

address of the area in RAM to be

affected by the transfer of data to and

from the disk drive, the BASIC

interpreter must encounter our strings,

arrays, and matrix in the order in which

they appear in line 10. Otherwise, the

data we wish to transfer will reside in a

different area of memory than that

which the disk handler is told to

transfer.

The program's main data is stored

in three strings and a matrix. ACT$

keeps track of all account names,

BILL$stores billing dates, and DATE$

keeps track of the dates and names of

all purchases. The amounts of

purchases are stored in the AMT

matrix. Note that both BILL$ and

DATE$ concatenate each date to three

bytes using the CHR$ function. Since

any month or day has a value of lessthan 255 and thus may be stored in the

form of a single character string, the

month and day are converted to a

character string. The year is converted

to a character string after subtracting

1900 from its value. Thus, the year

1983 is stored as a CHR$(83).

The program has a few interesting

bells and whistles that should be

mentioned. The short subroutine at

lines 800 through 810 is used for

decimal justification of numerical data.

The subroutine changes all numbers

into a dollars and cents format by

adding the trailing zeros to integers and

multiples of 0.1. The program also

makes use of the LOCATE statement,

which I have not encountered before in

a non-graphic use. Ituses the statement

to keep track of accounts that have

been deleted or billed until all

modifications are completed and

thereby prevents a second deletion or

billing of the same item. Itkeeps track

of the status of the item bylooking for a

B or D character next to the dollar

value of the item. Finally, the routine

at lines 960 through 970 avoids a

complex sorting algorithm toget rid of

billed or deleted purchases bywasting a

little memory and transferring the

contents of one array into another array

and then back into the original array,

instead of passing values from the array

into a single variable and vice versa. It

is just a reminder that we can

sometimes speed program execution by

wasting a little memory, something we

can dowith this program.

27

Page 30: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 30/86

Listing 1

5 O P E N # 5 . 4 . 0 , " K : "1 0 D I H D A T E $ ( 1 0 5 6 i , A M T ( S , 1 3 ) , B I l l $ ( 2 4 ) , A C H ( 6 4 ) , Q $ ( 1 3 ) , A $ ( S ) ,

B l $ ( 20 ) , SI S ) , DI S C $ ( 1) , SU B $ ( 1 3 2 ) , SU B( 12 )20 D A T E$ - " " I D A T E $ ( 1 0 56 ) · D A T E $ I D A TE $ ( 2 ) . D A T E $ : B l $ = D A T E $ ( 1 , 2 0) :

A C T $ = D A T E $ ( 1 , 64 ) : S U B $ = D A T E $ ( 1, 1 4 4 ) : B I l l $ = D A T E$ ( 1 , 2 4 )3 0 F O R 1 = 1 T O S : F O R N l = O T O 1 3 I A H T ( I , N l ) = O : N E X T N 1 : N E X T I5 0 G R A P H I C S O : P O K E 7 1 0 , 1 6 0 : P O K E 7 1 2 , 1 4 6 : P O K E 7 S 2 , 1 : A D T = A D R I D A T E $ ) - 1 :

P O K E 1 6 , 6 4 : P O K E 5 3 7 7 4 , 6 4

1 0 0 P R I N T " { C l E A R } " : P O S I T I O N 1 0 , 1 0 : P R I N T " ( I ) R E V I E W F I l E S " : P O K E 8 5 , 1 0 :P R I N T " ( 2 ) R E V ' I S E F I l E S " : P O K E 8 5 , 1 0 : PR I N T " < 3 > C R E A T E F I L E S "

1 0 5 M X = 3 : G O S U B 1 5 5 : G O T O N l * 1 0 0 01 5 5 P O S I T I O N 1 1 , 2 0 : P R I N T " E N T E ~ N U M B E R : " ;1 6 0 C = P E E K I S 5 ) : R = P E E K ( 8 4 ) : A$ = " N U H " : G O S U B 3 0 0 :

I F N l ( l O R N l ) H X T H E N P O S I T I O N C , R : G O T O 1 6 01 6 5 R E T U R N1 7 0 P R I N T " C H A N G E D A T A " ;1 7 5 P R I N T " I { R E V E R S E V } E S O R ( R E V E R S E N } O ) ? " ;1 8 0 G O S U B 3 0 0 : A $ · Q $ ( 1 , l ) : I F A $ = " V " O R A $ = " N " T H E N P R I N T " ( U P , D E l E T E l I N E } " ; :

R E T U R N1 9 5 P O S I T I O N C , R : G O T O 1 8 02 4 0 G O S U B 4 5 0 : N = P E E K ( S 5 ) - 1 : S = P E E K ( S 4 ) :

R E M D A T E E N T R Y R O U T I N E - E N T E R D A V , M O N T H , V E A R2 4 1 T R A P 2 4 1 : P O S I T I O N N + l , S : P R I N T " ( C T R l E } - / - - / - - - - " : J = l : A $ = " "2 4 2 P O S I T I O N N + J H J ) 2 ) H J ) 4 ) , S I P R I N T " { C T R l E } " : I F P E E K ( 5 , 3 2 7 9 ) = 3 T H E N 3 1 2 :

R E M O N O P T I O N k E Y , C L E A R M E M O R V A N D G O T O M E N U2 4 3 I F P E E K ( 7 6 4 ) = 2 5 5 T H E N 2 4 22 4 4 G E T # 5 , A : I F A = 1 2 6 A N D J O I T H E N P O S I T I O N N + J + l J > 2 ) + ( J ) 4 ) , 5 :

P R I N T " - " : J = J - l : G O T O 2 4 22 4 5 I F A ( 4 S O R A > 5 7 T H E N 2 4 22 4 6 P O S I T I O N N + J + ( J ) 2 ) + ( J ) 4 ) , S I P R I N T C H R $ ( A ) : S ( J ) = A : J = J + l : I F J < 9 T H E N 2 4 22 4 8 G E T i s , A : I F A = 1 2 6 T H E N J = 8 : G O T O 2 4 22 5 0 I F A ( 1 1 5 5 T H E N 2 4 82 5 2 F O R J = l T O 8 : A $ ( J , J ) = C H R $ ( S ( J ) ) : N E X T J : H = V A l ( A $ ( l , 2 ) ) :

D = V A l IA $ ( 3 , 4 ) ) : Y = V A l IA $ ( 5 , S ) )2 5 3 I F M = O O R M ~ 1 2 O R 0 = 0 O R 0 ) 3 1 O R I M = 2 A N D 0 ) 2 9 ) O R

V ( 1 9 0 0O R

V > 2 1 5 5T H E N 2 5 62 5 4 P O S I T I O N 2 , 2 2 : P R I N T " { D E L E T E l I N E } " : P O S I T I O N 2 , S + 1 : I F Q $ = " B I l " T H E N R E T U R N

2 5 5 P O K E I - l 0 , M : P O K E I - 9 , D : P O K E I - 8 , Y - 1 9 0 0 : R E T U R N2 5 6 P O S I T I O N 2 , 2 2 : P R I N T " ( B E E P } { D E l E T E l I N E } P l E A S E R E E N T E R C O R R E C T D A T E " :

G O T O 2 4 12 9 5 I F N l ( 1 0 T H E N P R I N T " 0 " ;2 9 6 R E T U R N3 0 0 C = P E E K ( 8 5 ) : R = P E E K I 8 4 )3 0 1 T R A P 3 0 1 : Q $ = " " : P O S I T I O N C , R : P R I N T B l $ : Y = 1 : S · 3 23 0 2 P O K E 7 6 4 , 2 5 5 : A = O : P O S I T I O N C + Y - l , R : P R I N T " ( C T R l E } " ;3 0 3 I F P E E K ( 5 3 2 7 9 ) = 3 T H E N 3 1 23 0 4 I F P E E K ( 7 6 4 ) = 2 5 5 T H E N 3 0 33 0 5 G E T # 5 , A : I F A = 1 5 5 A N D ( n 1 O R A $ O " N U M " ) T H E N , 3 1 03 0 6 I F A = 1 2 6 T H E N Y = V - I Y > l ) : Q $ = Q $ ( l , V ) : P O S I T I O N C + Y , R : P R I N T " " : G O T O 3 0 2

3 0 7 I F A < 3 2 O R A ) 1 2 4 O R ( A $ = " N U M " A N D ( A ( 4 S O R A ) 5 7 ) A N D A ( ) 4 6 ) T H E N 3 0 23 0 8 Q $ ( Y ) = C H R $ I A ) : P O S I T I O N C + V - l , R : P U T 1 6 , A : I F V = l T H E N S = A3 0 9 Y = Y + l : G O T O 3 0 23 1 0 Q $ ( I , I ) = C H R $ ( S ) : P R I N T " { l E F T , D E l E T E } " : I F A $ = " N U M " T H E N N l = V A l ( Q $ ) : A $ = "3 1 1 S = l E N I Q $ ) : RE T U R N3 1 2 P O K E 7 1 0 , 1 6 0 : C l R : G O T O 1 03 2 0 P R I N T " E N T E R A C C O U N T N A M E : " ;3 2 5 G O S U B 3 0 0 : I F S ) 8 T H E N P O K E 8 4 , 2 0 :

P R I N T " ( B E E P } A C C T N A M E C A N N O T E X C E E D S C H A R A C T E R S " : P O S I T I O N C , R : G O T O 3 2 53 3 0 I F S ( 8 T H E N Q $ ( S + I , S ) = B l $ ( 1 , 8 - S )3 3 2 I F A $ = " R E " T H E N A $ = " " : R E T U R N3 3 3 A C T $ ( I D * 8 - 7 , I D * 8 ) = Q $ ( 1 , 8 ) : P RI N T3 3 5 P R I N T " E N T E R S T A R T I N G B A L A N C E : " ; : A $ = " N U M " : G O S U B 3 0 0 : A M T ( I D , 0 ) = N 1 : R E T U R N

28 MICRO No, 70 - March 1984

Page 31: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 31/86

3 5 0 I F C O U N T = 1 3 T H E N P R I N T " ( B E E P } S O R R Y , A C C O U N T F U L L " : G O S U B 3 9 0 : R E T U R N3 5 2 P R I N T " D A T E O F T R A N S A C T I O N : " ; : G O S U B 2 4 0 : P R I N T " P U R C H A S E : " ; : A $ = " R E " :

G O S U B 3 2 5 : D AT E $ ( A I * 11 - 7 , A I* 1 1) = Q $ ( 1 , 8 )3 5 5 P O S I T I O N 2 4 , P E E K ( 8 4 ) - 1 : P R I N T " A M T : " ; I A $ = " N U M " : G O S U 8 3 0 0 : A M T I I D , C O U N T ) = N l3 6 0 C O U N T= C OU N T+ l : R E T U RN3 9 0 I F P E E K ( 8 4 ) ( 2 3 T H E N P R I N T3 9 2 P O K E 8 5 , 8 : P R I N T " P R E S S ( R E V E R S E R E T U R N ) T O C O N T I N U E " ;3 9 5 P O K E 7 6 4 , 2 5 53 9 6 I F P E E K ( 5 3 2 7 9 ) = 3 T H E N 3 1 2

3 9 7 I F P E E K ( 7 6 4 ) = 2 5 5 T H E N 3 9 63 9 8 G E T i 5 , A : I F A < ) 1 5 5 T H E N 3 9 63 9 9 R E T U R N4 0 0 P R I N T " ( C L E A R } A C C T : " ; A C T $ I I D * 8 - 7 , I D * 8 ) ; :

I F A C T $ I I D * 8 - 7 , I D * 8 ) = B L $ l l , 8 ) T H E N P O K E 8 5 . 8 P R I N T " U N U S E D " ;4 0 5 P O K E 8 5 , 1 9 : P R I N T " O R I G B A L : " ; : N l = A M T I I D , O ) : G O S U B 8 0 0 : P ~ I N T Q $4 0 6 I F A M T I I D , 1 3 ) = 0 T H E N 4 1 04 0 7 P R I N T " N E W A M O U N T B I L L E D : " ; : N l = A M T I I D , 1 3 ) : G O S U B 8 0 0 : P R I N T Q $4 0 8 P R I N T " B I L L T O T A L : " ; : N l = A M T I I D , O ) + A M T I I D , 1 3 ) : G O S U B 8 0 0 : P R I N T Q $ ; :

P 0 K E a 5 , 2 6 : P R I N T " D U E " ; : N 1 = A S C I B I L L $ I I 0 * 3 - 2 , 1D * 3 - 2 ) )4 0 9 G O S U B 2 9 5 : P R I N T N l ; " I " j : N l = A S C I B I L L $ ( I O * 3 - 1 , I D * 3 - l ) ) : G O S U B 2 9 5 :

P R I N T N l ; " I " ; : N l = A S C I B I L L $ I I D * 3 , I D * 3 ) ) : G O S U B 2 9 5 : P R I N T N l4 1 0 A M T N = A M T I I D , 0 ) + A M T ( I D , 1 3 ) : P R I N T : P L = P E E K ( 8 4 ) - 1 : F O R C O U N T . l T O 1 2 :

G 0 1 U B 4 5 0 : I F A M T I I O , C O U N T ) = O T H E N P O P : G O T O 4 4 04 1 5 M = P E E K l I - l 0 ) : D = P E E K I I - 9 ) : Y = P E E K I I - 8 ) : N l = C O U N T : G O S U B 2 9 5 : P R I N T C O U N T ; " " ;4 2 0 N l = M : G O S U B 2 9 5 : P R I N T M ; " I " ; : N l = D : G O S U a 2 9 5 : P R I N T D ; " I " ; : N l = V : G O S u a 2 9 5 :

P R I N T V ; " " ,4 3 0 P R I N T D A T E $ ( A I * 1 1 - 7 , A I * 1 1 ) ; " " ; : N l = A M T ( I D , C O U N T ) : G O S U B 8 0 0 :

P O K E 8 5, 3 5 - S : P R I N T Q S : A M T N = A M T N + A M T ( I D , C O U N T ) I N E X T C O U N T4 4 0 P R I N T : P R I N T " T O T A L : " ; : N l = A M T N : ! 3 0 S U B 8 0 0 : P R I N T Q $ ; :

P R I N T " U N B I L L E D : " ; : N l = A M T N - A M T I I D , O ) - A M T ( I D , 1 3 ) : G O S U B 8 0 0 :P R I NT Q $ : RE TU R N

4 5 0 A I = I D * 1 2 - 1 2 + C Q U N T : I = A I * 1 1 + A DT : R E T U R N5 0 0 P R I N T " ( C L E A R } " : P O K E 8 5 , 1 2 : P R I N T " A C C O U N T S I N F I L E " : P R I N T : P R I N T

F O R 1 = 1 T O 8 : S = ( I / 2 = I N T ( I / 2 ) ) : P O K E 8 5 , 2 + S * 1 8 : N l = I : G O S U B 2 9 55 1 0 P R I N T I ; : P O K E 8 5 , 8 + S * 1 8 : I F A C T $ ( I * 8 - 7 , I * 8 ) = B L $ l l , 8 ) T H E N P R I N T

" U N U S E D " ; : G O T O 5 3 0

5 2 0 P R I N T A C T $ ( I * 8 - 7 , I * 8 ) ;530 I F S T H E N P R I N T5 4 0 N E X T I : R E T U R N5 5 0 I F C O U N T = l T H E N P R I N T . " { B E E P } N O T H I N G T O B I L L I N D A T A B A S E . U P D A T E

B I L L I N G " ; : G O S U B 1 7 5 : P R I N T : I F A $ = " N " T H E N R E T U R N5 5 1 I F A $ = " S K I P " T H E N 5 5 75 5 2 I F A M T I I O , 1 3 ) ( ) 0 T H E N P R I N T " { B E E P } P A Y M E N T O N L A S T B I L L N O T E N T E R E D " :

G O S UB 3 9 0 : RE T U RN5 5 3 P R I N T " N E W P U R C H A S E S B I L L E D : $ " ; : A $ = " N U M " : G O S U B 3 0 0 : A M T ( I D , 1 3 ) = N l :

I F A M T ( I D , O ) = O T H E N I N T = O : G O T O 5 5 55 5 4 P R I N T " I N T E R E S T B I L L E D : $ " ; : A S = " N U M " : G O S U B 3 0 0 : I N T = N l : A M T Z = A M T Z + I N T :

A M T ( I D , 1 3 ) = A M T ( I D , 1 3 ) + I N T5 5 5 P R I N T " B I L L P A Y M E N T D A T E r " ; : Q $ = " B I L " : G O S U B 2 4 0 :

B I L L $ ( I D * 3 - 2 , ID * 3 - 2 ) = C H R $ ( M ): B I L L $ ( I D * 3 - 1 , ID * 3 - 1 ) = C H R $ ( 0 )

5 5 6 B I L L $ I I D * 3 , I D * 3 ) = C H R $ ( Y - 19 0 0 )5 5 7 I F C O U N T = l T H E N 5 7 53 5 8 P R I N T " I T E M S B I L L E D I i T O " ; C O U N T - l j " , " ; C O U N T ; " I F N O N E ) : " ;5 5 9 A $ = " N U M " : G O S U B 3 0 0 l I F N l ( l O R N l > C O U N T T H E N P O S I T I O N C , R I G O T O 5 5 95 6 0 I F N l = C O U N T T H E N 5 7 55 6 1 L O C A T E 3 6 , P L + N l , A : P R I N T " { L E F T } " ; C H R $ I A ) : I F A = 6 6 T H E N P O S I T I O N C , R : G O T O 5 5 95 6 2 A M T Z = A M T Z + A M T ( I D , N l ) : A M T I I D , N l ) = O : P O S I T I O N 3 6 , P L + N l : P R I N T " B " : P O K E 8 4 , R + l5 7 0 P R I N T " M O R E I T E M S B I L L E D " , : G O S U B 1 7 5 : I F A $ = " Y " T H E N P R I N T

" ( U P , D E L E T E L I N E } " ; : G O T O 5 5 8~ 7 ! i G O S U B 950

5 8 0 I F A M T Z = A M T ( I D , 1 3 ) T H E N 6 1 05 8 5 G O S U B 4 0 0 : P R I N T : P R I N T " { B E E P } N E W P U R C H A S E S B I L L E D : " ; : N l = A M T I I D , 1 3 ) - I N T :

No. 70 . March 1984 MICRO 29

Page 32: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 32/86

G O S u e 8 0 0 : P R I N T Q $ : P R I N T " B U T B I L L E D I T E M S T O T A L : " ;5 9 0 N l = A M T Z - I N T : S O S U B 8 0 0 : P R I N T Q $ : P R I N T " I N T E R E S T B I L L E D : " ; : N l = I N T : G O S U B 8 0 0 :

P R I N T Q $ : P R I N T " C H A N G E A M O U N T B I L L E D " ;5 9 5 S O S U B 1 7 5 : I F A $ = " N " T H E N 60 56 0 0 P R I N T " N E W P U R C H A S E S B I L L E D : $ " ; : A $ = " N U M " : G O S U B 3 0 0 : A M T ( I D , 1 3 ' = N l :

A M T ( I D , 1 3 ' = A M T ( I D , 1 3 I + I N T : G O T O 5 8 06 0 5 P R I N T " S T A R T O V E R " ; : S O S U B 1 7 5 : I F A $ = " Y " T H E N C L R I S O T O 1 06 1 0 R E T U R N6 2 5 P O P : R E T U R N

6 5 0 P R I N T " E N T E R A M O U N T P A I D : " I I A $ = " N U M " : G O S U B 3 0 0 :A M T ( I D , O ' = A M T ( I D , O ) - N l + A M T ( I D , 1 3 ' : A M T ( I O , 1 3 ' . 0 : R E T U R N

6 8 0 I F D I S C $ = " Y " T H E N R E T U R N6 8 5 T R A P 6 9 5 : G O S U B 7 0 0 : 0 P E N * 1 , 4 , 0 , " D : C R E D I T . D A T " : G O S U B 7 5 0 :

P O K E 8 5 0 , 7: P O K E 8 5 8 , 4 : A= U S R ( AD R ( Q $ "6 9 0 C LO S E * l : D I S C $ = " Y ": R E TU R N6 9 5 P R I N T " C B E E P ) " : P O K E 7 1 2 , 6 4 : F O R D E L A Y = l T O 1 0 0 : N E X T O E L A Y : P O K E 7 1 2 , 1 4 6 :

C L O S E * 1 : G O T O 6 8 07 0 0 P O K E 7 6 4 , 2 5 5 : P R I N T " { C L E A R } " : P O K E 8 4 , 1 1 :

P R I N T " I N S E R T D A T A D I S C A N D P R E S S ( R E V E R S E R E T U R N } " : G Q S U B 3 9 5 : R E T U R N7 1 0 P R I N T : P R I N T " W R I T E C H A N G E S T O D I S C " ;7 1 5 G O S u e 1 7 5 : I F A $ = " N " T H E N R E T U R N7 2 0 G O S u e 7 0 0 : T R A P 7 6 0 1 0 P E N * l , 8 , 0 , " O I C R E D I T . D A T " I G O S U B 7 5 0 :

P O K E 8 5 0 , 1 1 : P O K E 8 5 8 , 8 : A = U S R ( A D R ( Q $ ' )7 3 5 C L O S E * l : D I S C $ = " Y " : P R I N T " ( C L E A R } " I R E T U R N7 5 0 Q $ = " h ( R E V E R S E " , C T R L P } L V { R E V E R S E d } " : S = I N T ( A D R ( D A T E $ ' / 2 5 6 ) :

N l = A D R ( D A T E $ ) - 2 5 6 * S I M X = ( A D R ( Q $ ' - A D R ( D A T E $ " I R = I N T ( M X / 2 5 6 ' : C = M X - R * 2 5 67 5 5 P O K E 8 5 2 , N l : P O K E 8 5 3 , S : P O K E 8 5 6 , C : P O K E 8 5 7 , R : R E T U R N1 6 0 P R I N T " ( U P , O E L E T E L I N E ) P R O B L E M S W I T H D I S C D R I V E " : G O S U B 3 9 0 : G O T O 7 2 08 0 0 N l = IN T ( N l * 1 0 0 + 0 . 5 ) / l 0 0 : Q $ = S T R $ ( N l ) :

I F N l = I N T ( N 1 ' T H E N Q $ ( L E N ( Q $ ) + l ' = " . O O " : G O T O 8 1 08 0 5 I F N l * 1 0 = I N T ( N l * 1 0 ' T H E N Q $ ( L E N ( Q $ ' + l ) = " O "8 1 0 S = L E N ( Q $ ' : R E T U R N8 5 0 P R I N T " 1 ) O R I G B A L A N C E 2 ) L A S T B I L L 3 ' E X I T 4 ' D E L E T E P U R

C H A S E 5 ) D E L E T E A C C T "8 5 5 M X = 5 : G O S U B 1 6 0 : P R I N T " { U P , D E L E T E L I N E } " : O N N l G O S U B 8 7 0 , 8 7 5 , 6 2 5 , 8 8 5 , 9 2 58 6 0 P R I N T " M O R E E D I T I N G " , I G O S U B 1 7 5 : I F A $ l : l y " T H E N G O S U B 4 0 0 : P R I N T : G O T O 8 5 0

8 65 R E T U R N8 7 0 G O S u e 3 3 5 : R E T U R N8 7 5 P R I N T " N E W P U R C H A S E S O N B I L L : $ " ; : A $ = " N U M " : G O S U B 3 0 0 : A M T ( I D , 1 3 ) = N l8 8 0 P R I N T " I N T E R E S T O N B I L L : $ " ; : A $ = " N U M " : G O S U B 3 0 0 :

A M T ( I D , 1 3 ) = A M T ( I D , 1 3 1 + N l I R E T U R N8 8 5 I F C O U N T = l T H E N P R I N T " { e E E P } N Q P U R C H A S E S T O D E L E T E I N D A T A B A S E " :

G O S u e 3 9 0 : P R I N T " ( U P , D E L E T E L I N E , U P , D E L E T E L I N E } " : S O T O 8 6 08 9 0 P R I N T " N O . O F I T E M ( 1 T O " ; C O U N T - l ; l I , I I ; C O U N T , I I I F N O N E ' I " I8 9 2 A $ = " N U M " : G O S U B 3 0 0 : I F N l ( l O R N l > C O U N T T H E N P O S I T I O N C , R : G O T O 8 9 28 9 3 I F N l = C O U N T T H E N 9 0 08 9 4 L O C A T E 3 6 , P L + N l , A : P R l N T I I ( L E F T } I I ; C H R $ ( A ) : I F A = 6 8 T H E N P O S I T I O N C , R : G O T O 8 9 28 9 6 A M T Z = A M T Z - A M T ( I D , N l ' : A M T I I D , N l ' . O: P O S I T I Q N 3 6 , P L + N l I P R I N T " D " I P O K E 8 4 , R + l8 9 8 P R I N T " M O R E I T E M S T O D E L E T E " ; : G O S u e 1 7 5 :

I F A $ = " Y " T H E N P R I N T " ( U P , D E L E T E L I N E } " ; : G O T O 8 9 0

9 0 0 G O S U B 9 5 0 : R E T U R N9 2 5 A C T $ ( I D* 8 - 7 , I D * 8 1 = B L $ l l , 8 ' I S U B $ I : " " : S U e $ ( 1 3 2 ) = S U B $ I S U e $ ( 2 ) = S U B $ :

D A T E $ ( I D * 1 3 2 - 1 3 1 , I D * 1 3 2 ' = S U B $9 3 0 F O R J = o T O 1 3 : A M T ( I D , J ' = 0 I N E X T J I R E T U R N9 5 0 F O R · J = l T O 1 2 : S U B ( J ' = 0 : N E X T J : S U B $ I : " " : S U B $ ( 1 3 2) = SU B $ : S U B $ ( 2 ' = S U B $9 6 0 J = l : F O R C O U N T = l T O 1 2 : G O S U B 4 5 0 l I F A M T I I D , C O U N T ) = O T H E N 9 7 09 6 5 S U B I J ) = A M T ( I D , C O U N T ' : S U B $ ( J * 1 1 - 1 0 , J * 1 1 ) = D A TE $ ( A I * 1 1 - 1 0 , A I * l l ) : J = J + l9 7 0 N E X T C O U N T : F O R C O U N T = l T O 1 2 I A M T ( I D , C O U N T ) = S U B I C O U N T ' : N E X T C O U N T :

D A T E $ ( I D * 1 3 2 - 1 3 1 , I D * 1 3 2 ' = S U e $ : R E T U R N1 0 0 0 G O S U B 6 8 01 0 1 0 G O S U B 5 0 0 : P O K E 8 4 , 1 8 : P R I N T " N O . O F A C C T T O R E V I E W ( 9 T O E X I T ) " ; : M X = 9 :

s o s u s 1 5 5 : I D = N 1 I I F N l = 9 T H E N C L R : G O T O 1 0

30 MICRO No. 70 - March 1984

Page 33: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 33/86

1 0 2 0 G O S u e 4 0 0 : G O S U B 3 9 0 : G O T O 1 0 02 0 0 0 G O s u e 6 8 02 0 1 0 G O S u e 5 0 0 : P O K E 8 4 , 1 8 : P R I N T " N U M B E R O F A C C T T O C H A N G E ( 9 T O E X I T ) " : H X = 9 :

G o s u e 1 5 5 : I D = N l : I F N l = 9 T H E N 5 02 0 2 0 G O S u e 4 0 0 : P R I N T : P R I N T " 1 ) P U R C H A S E 2 ) B I L L I N G 3 ) P A Y M E N T " :

P R I N T " 4 ) E D I T A C C T 5 ) A C C T N A M E 6 ) E X I P2 0 3 0 P R I N T : P R I N T " E N T E R N U M B E R : " ; : M X = 6 : G O S U B l b O : P R I N T " ( U P , D E L E T E L I N E ,

U P , D E L E T E L I N E , U P , D E L E T E L I N E , U P , D E L E T E L I N E , U P , D E L E T E L I N E } " :A M T Z = 0: C H O I C E = N l : 0 N N l G O s u e 3 5 0 , 5 5 0 , 6 5 0 , 8 5 0 , 3 2 0 , 6 1 0

2 0 3 5 I F C H O I C E = 6 T H E N 2 0 5 02 0 4 0 P R I N T " { u P , D E L E T E L I N E , U F ' , D E L E T E L I N E } " : P R I N T " M O R E C H A N G E S O N A C C T " ; :

G O S U B 1 7 5 : I F A i = " Y " T H E N 2 0 2 02 0 5 0 G O S U B 4 0 0 : G O S U B 7 1 0 : I F A $ = " N " T H E N G O S u e 3 9 02 0 6 0 G O T O 1 0 03 0 0 0 P O K E 7 1 0 , 9 6 : P R I N T " { C L E A R } " : P O K E 8 4 , 1 0 : P R I N T " C A U T I O N : W R I T I N G T O D I S C

W I L L E R A S E E X I S T I N G D A T A F I L E S O N T H E D I S C . "3 0 1 0 P R I N T : P R I N T " W R I T E T O D I S C " ; : G O S U B 1 7 5 : P O K E 7 1 0 , 1 6 0 : I F A $ = " N " T H E N 1 0 03 0 2 0 G O S u e 7 2 0 : 8 0 T O 1 0 0

Ed. Note: Microbes from the listings of Mr. Kattan's

previous article, "The Investor" (Micro 69:19), appear

on page 73.

Ioseph Kattan is a lawyer in Washington.

He may be written to at

5721 Chevy Chase Pkwy.N.W.,

Washington, DC 20015

Money-Saving BonusPaks of 64 Software

(BP-1)-(disk)

totLtextltotl.speller/totl.labelreg. price $103 NOW $79

(BP-2)-(disk)

totLbusinessltotl time managerltotl. infomaster/totl. textreg. price $228 NOW $159

(BP-3)-(disk)

totl.infomasterl

totl. text/totl.spellerreg. price $129 NOW $99

(BP-4)-(disk)

totLtextltotl.spellerlresearchassistantreg. price $118 NOW$89

(BP-5)-(tape)

totl. text/totl.labelreg. price $60 NOW $49

Commodore64 andVIC 20areIrademarks 01Commodore Bus iness Machines Inc .

....._ ..._ - - .IN F O R M A TIO N A N D ORD~~pfOU:~N

TOTL.TEXT2.0(VIC+8K) 024.95 0 28.95&-j.....-..A.~~ .....1 ITOTl.TEXT2.5(VIC+16K) 034.95 038.95TOTl.L.ABEl2.1(VIC+ 16K) 0 19.95 0 23.95

•TOTl TIMEMGR.2..1VIC+8K) 0 29.95 0 33.95 •RESEARCHASST.2.0(VIC+8K) 0 29.95 0 33.95

TOTl.BUSINESS3.0(VIC+24K) 0 84.95 •TOTL.TEXT2.6(C-64) 0 39.95 0 43.95TOTl.SPEllER 3.6(-C64) 0 34.95

•TOTL.LABEl2.6(C-64) 0 19.95 0 23.95 •TOTl TIMEMGR.2.6(C-64) 034.95 038.95

RESEARCHASST.2.0(C-64) 034.95 038.95 •TOTl.INFOMASTER3.6(C-64) 049.95

TOTL.BUSINESS3.6(C-64) 0 94.95BONUSPAK# •

Total.heck, Money Order orC.O.D. 'a lsoaccepled. C.O.D.Charges/SalesTax _

·C.O.D.orders$2.00 Sh'pp'ng & Handling $3.00

•additional(CAresidents 1 1 •

add6'1,% saleslax) AmounlEnciosed _

•FORORDERINGONLY-CALL OURTOLLFREENUMBERS •Continental U.S. 1-800-351-1555, California 1-800-351-1551

Hawaii andAlaska 415-943-7877 •

o SENDMORE INFORMATION(nochargefor calalog).~~ .lreel ~_

• City Slate __ Zip •

Phone ( 0MC 0VISA

• Card # B~~e.

• TOTLQuality you can afford •15$5ThirdAvenue

Walnut Creek,CA94596 •SOFTWARE, INC. 415/943-7877

Other VIC 20™and Commodore 64T11 softwareavailable from your dealer ordirectly from TO T l Software:Word Processing (totl.text)Spelling Checker (totl.speller)Mail ing list & Label (totl. label)Business Accounting (tott.business)Time Management '(totl time manager)

Keyword Cross Reference

(research assistant)

T O T L Offers You. __low prices and high quality • 30 daymoney-back guarantee on directpurchases • an interactive family ofsoftware • product registration •customer support • f ree informativenewsletter • regular upgrades atreduced cost • availability in manystores • 800 numbers for orderingconvenience • prompt shipment ofdirect orders • savings coupons witheach order • money-saving bonuspaks • two years and 45,000products strong

No. 70 - March 1984 MICRO 31

Page 34: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 34/86

I ~

I A l C A O ' ·

CoCo Bits

OS-9

OS-9 is becoming more and more

popular among CoCo hackers. I have

gotten a few letters from readers about

their experiences with OS-9. Gene

Driskell of Xenia, OH called and wrote

about a problem with OS-9 and the

external terminal mode. It seems the

CoCo would occasionally garble aletter being sent from the terminal to

the CoCo. I wasn't much help with the

problem as I had not run into it, and no

one else I talked with had either. A few

days later, Gene sent me another letter.

As it turns out, OS-9 will only support

terminal I/O at 300 baud. Mr. Driskell

had been using the default terminal

baud rate of 600. At 600 baud, Gene

said that only about 13% of the

characters were incorrectly sent.

It would be nice to operate the

terminal at a higher baud rate; if you

have a patch, or know of a way aroundthis problem, pass the information

along and I will relay it here. I will have

some comments on BASIC-09 in a few

moments.

CoCo 2 Memory Expansion

Santa has brought a lot of Color

Computer 2's into people's homes, and

the small powerhouse has introduced

many to the joys of computing. With

16K the stock memory, many people

are opting to raise the memory

requirements to 64K. The process iseasy.

There are 2118s in the CoCo 2,

rather than 4116s as in the earlier

CoCos. To upgrade to 64K, all it takes

is replacement of the chips and

soldering a single jumper The jumper is

located near the 6822 and 74LS244

chips. A lettering on the PC board reads

WI. Immediately adjacent to the label,

WI and toward the rear of the board

from the label are two solder pads.

These two pads should be jumpered

32

by John Steiner

together. Thanks to Gene for providing

the upgrade instructions.

By the way, the piggyback 32K

upgrade used before the 64K machines

were introduced is still possible. The

2118s require only a + 5 volt line,

rather than the + 5, -5 and + 12 volts

required of the 4116s. As a result, youcannot piggyback 4116s with the

2118s.

Software Speech Synthesizer

Classical Computing, Inc. of

Chapel Hill, NC sent me a copy of

SPEAKUP, a machine language voice

synthesizer for the CoCo. The

program, written by David Dubowski,

is an excellent example of software

voice synthesis. I have had a lot of fun

with its ability to speak any standard

BASIC string. It also has the ability toread the screen and speak any phrase

printed there. The computer will speak

the words until it finds a period,

question mark or exclamation point.

The price you pay for making your

programs talk is memory. The program

requires just over 7K of RAM.

Phonomes are used to generate the

parts of speech, soyou have tomisspell

some words in order to make them

sound right as the computer speaks

them. For example, CHAMPAGNE

sounds best when spelled

SHAMPAYN. At only $29.95, its quitea bargain.

More CoCo Rumors

I have been hearing from the grape

vine about a new CoCo to be released

shortly. Talk is of a 256K CoCo. This

word comes just after the release of the

Tandy 2000, an IBM compatible

computer with sophisticated color

capacity. My first thought was that the

2000, since it is 256K, was what they

MICRO

were referring to. Even now that the

2000 has been released, the rumors

persist. Tandy kept the 2000 a big

secret until just before its release, so

any new CoCos will probably be just as

big a secret. We shall see.

BASIC-09

With the arrival of OS-9, a new

world of BASICprogramming is at the

CoCo keyboard. BASIC-09is one of the

most powerful versions of BASICI have

seen. I have had access to many

versions recently, as I have just

finished a manuscript for Prentice-Hall

that will be released sometime this

year. The book is a BASIC cross-

referencing dictionary. In my research,

one BASIC caught my eye as being

especially powerful, BASIC-09. At the

time, I hadn't really expected it to bereleased for CoCo. Microware provided

me a BASIC manual for use with my

research. My CoCo version is still on

order as I write this, but I am assuming

there will be little difference between

Radio Shack's version and the standard

Microware release.

Probably the most unique feature of

BASIC-09is its Pascal-like procedures.

Line numbers are optional within

procedures, and several procedures may

reside in memory at any given time. It

is possible to load and save multiple

procedures in one step, and anyprocedure currently in memory may be

used by either the operator of the main

keyboard, or by any terminal user,

Procedures may be called from within

other procedures, and each may be

tested and debugged individually, if

desired.

Those familiar with Color BASIC,

or any BASICfor that matter, recognize

the FOR-NEXT loop, BASIC-09 uses

several loop structures in addition to

FOR-NEXT. Here are a few examples,

No, 70 - March 1984

Page 35: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 35/86

P roducts for C ommodore , A tari, A pple , and others!

T H E M O N K E Y W R E N C H I IA P R O G R AM M E R S A ID F O R A lA R I 8 0 0N E W A N D IM PR D V E D - 1 8 C D M M A N D SP LU G S IN TO R IG H T C AR TR ID G E S LO T

. . . .~ ~ V IC R A B B IT C A R T R ID G E\ ' A N D C B M 6 4 R A B B IT C A R T R ID G E

,~ ) $39.95,~~~) (includes Cartridge

~ ~. and Manual)

- Expansion Connectoron the V IC Cart rid ge

"D on 't w aste yo ur L ife awa y waitin g to LOADand SAVEp rogr ams on Cas se te Dec k."

L oa d o r S ave 8K in a pp ro xim ate ly 3 0 se co nd s ITryit - yo ur U n-R abbitiz ed V IC ta ke s a lm ost 3 m in ute s.I t's not only Fas t bu t VERY REL IABLE.

A lm ost as fast as V IC D isk D rive ! D on't b e fo olish -W hy b uy the d isk w hen you ca n ge t the V IC R ab bit

fo r m uch , m uch le ss!Easy to install - it just plugs in.E xpansion Connecto r on rear.Wo rk s w ith o r w ithou t Expansion Memor y.Wo rk s w ith V IC Cas se tte Dec k.12Commands p rovide o ther nea t featu re s.

A lso A va ila ble fo r 2 00 1 , 4 00 1 , a nd 8 03 2

" High-SpeedCassetteLoad and Save! "

I fyou area personwho l ikes to monkey around w i th

the ATAR I800 , t hen THE MONKEY WRENCH I I i slor YOU!I Make your programming t a s k s easier,lesst ime -c onsum ing and mo re fun . Why spend ext rahours w ork ing on a B AS IC program when theMONKEY WRENCH c an d o i t f or y ou in s ec on ds .It can also make backup copies of boot typec as se tt e p ro grams . P lu gs in to t he ri gh t s lo t a ndworks w i th ATARIBASICcar tr idge.

The M ONK EY W REN CH provides 18 direct m odecommands . The ya r e: AUTOL INE NUMBERING - P ro -v ides new l ine numbers when en te ri ng BASIC prog raml ines. RENUMBER- Renumbers BASIC ' s l ine numbersinc ludmg internal re fe rences . OELETELINE NUMBERS $59.95- R emov es a r an ge BAS IC l in e n umbe rs .

VARIABLES - O is pl ay a ll BASICvar ia bl es and t he ir c ur re nt v al ue . S cr ol li ng - Use t heSTART& SELECTkeys to d isp lay BASIC l i nes au tomati ca ll y. Sc ro ll up o r down BASICpro -g ram . F INOSTR ING - F in d fNer y o c cu rr en ce o f a s tr in g, XCHANGESTR ING - F in d fNer yo cc ur re nc e o f a s t nng and r ep la ce i t w i th a no th er s tr in g. MOVEL INES - Move l in es f romone par t o f p ro gr am t oano th er p ar t o f p r og ram . COPYL INES - Copy l in es f rom one par to f p ro gr am t o a no th er p ar t o f p ro gr am . FORMATTEDL IS T - P rin t B AS IC p ro gr am in

s pe ci al l in e f orma t a nd aut oma ti c p age number in g. O ISK D IRECTORY - O is pl ay O is kDirectory CHANGEMARGI NS - P ro vid es t he c ap ab ilit y to e as ily c ha ng e th e s cr ee nm arg in s M EMORY T ES T - P ro vid es th e ca pa bility to te st R AM m em ory C UR SORE XCHA NGE - A llo ws u sa ge of th e c urso r ke ys w ith ou t h old in g d ow n th e C TR L k e yUPPERCASE LOCK - K ee ps t he c ompu te r i n t h e u pp er c as e c ha ra ct er s et H EXCON-VERS ION - Conver ts a he xadec ima l n umber t o a dec ima l n umber . OECIMALCONVER -S ION - C on ve rts a d ec im al n umbe r t o a h ex ad ec im al n umbe r. MON ITOR - E nt er th emach ine language mon ito r

In a dd itio n t o t he BAS IC c omman ds , th e Mon ke y W re nc h a ls o c on tams a mac hi nel anguage moni to r w it h 16 commands u sed t o i n te ra ct w it h t he powe rf ul le at ur es o f t he6502 microprocessor

-, "~, ~"'~"~"""'ii:TH E

M ON KEY W RE NC H

II~~.

T E L S T A R 6 4

5 % IN C H S O F T

S E C TO R E D D IS K m E S

M o r e t h a n ju s t a n A s s e m b l e r / E d it o r !N o w f o r I h e "64" .

Sophis ti cat ed Term ina l Communica ti ons Car tr idge lo r t he 64.

'PFO ' 100 000 CP< 01> 02 BEll 12:30:00 10:14:36

(TE lSTAR's S tat us l ine)

Don' t s e t tl e l or l es s I han t he best

'• Up lo ad/ Downl oad t o/ fr om d is k o r t ape .

• Automati c F i le T rans lat ion .

• Communi ca te s i n I ndust ry S tanda rd ASCI I.

• Real -T ime C lo ck p lu s A la rm C lo ck.

• l in e ed it in g capab il it y a ll ows co rr e ct in g and r e sendi ng l ong

command l in e s

• 9 Qu ic k Read f un c ti on s .

• Menu-dr iv en .

• S im il ar t o ou r f amous STCPTe rm i na l p a ckage .

• Wo rks w it h Commodore Modems and suppo rt s au to -d ia li ng .

T hebest f e a tu re i s t h ep r i ce - on ly $49. 95 (Car tr id geand Manua l)

M a c h in e L a n g u a g e M o n i t o r

C a r t r i d g e

f o r t h e C B M 6 4

M o r e t h a n 2 0 c o m m a n d s a ll o w y o u t o a c c e s st h e C B M 6 4 's M ic r o p r o c e s s o r s R e g is te rs

a n d M e m o ry C o n te n t s . C o m m a n d s i n c l u d e

a s s e m b l e , d is a s s e m b le , r e g is te rs , m e m o r y ,

t r a n s fe r , c o m p a re , p lu s m a n y m o r e .

S o m e d a y e v e r y C BM 6 4 o w n e r w i l l n e e d a

m o n it o r s u c h a s t h is .

C a r t r i d g e a n d M a n u a l - $ 2 4 . 9 5

M A EforPET

APPLE

ATARI~Only

$59.95

It's a

Professionally

Designed

SoftwareDevelopment

System

NOW, The Best for Less!• Des igned to imp rove Programmer Product iv it y

• Similar syntax and c ommands - No n ee d t o r ele ar n

pe cu li ar s ynt ax es and commar ids whe n you g o

from PET to APPLE to ATARL

• Co re side nt A ss emble r/ Edit or - No nee d t o l oad

t he Edit or t hen t he Assemb le r t hen ( he Ed it or , et c

• A lso i nc ludes Word Processor , Rel ocat ing Loade r

and much mor e

• Jo in t he ATUG User G ro up lo r MAE format te d

diskS

• STI LL Nor CONVINCED? Send tor free spec sheet!

C O M 64 D e b u g g e r

A mo re soph is ti ca te d Mach ine l anguage Moni to r /Debugge r. 2 0K

o f o bje ct c od e m ak es t bis a p ow er tu l t oo l. W o rk s a s a s ym bo li c

debugge r l or t he MAEassemb le r. D is ket te and Manua l - $ 49. 95

A lA R I , P E T , A N D C O M 64E P R O M P R O G R A M M E R

Programs 2716 and 2532 I d ~ ' I ' ~ ; (EPROMs. Inc ludes hardware I

and sof twa re . PET= $75.00- A TA RI a nd C BM 64 (both

include sophisticatedmachine

language monitor) = $119.95

No. 70 - March 1984

T RA P 6 5

TRAP 65 I S aha r dwa re deVi ce t ha tp lu g s I nt o your 6502 's so cke t P r ev ent sexecut ion o f un imp lemented opcodesand p ro vi de s capab il it y t o e x tend t hernactsnes instruction set.For PETIAPPlE/SVM.R ed uc ed fr om $ 14 9 9 5 t o $ 6 9 95

H ighes t q ua lity . W e use them on

o u r P E Ts , A P P L E s , A T A R ls , a n d o th e r

computers. $ 2 2 . 5 0 / 1 0 o r $ 4 4 . 5 0 1 2 0

MICRO 33

Page 36: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 36/86

WHILE-DO tests the condition before

starting the loop, while FOR-NEXT

loops must execute all statements

within the loop at least once.

REPEAT-UNTIL, like FOR-NEXT,

tests at the bottom of the loop.

LOOP ENDLOOP structure can be

used to put a test at any place within

the loop.

As I get more familiar with

BASIC-09, I hope to be bringing more

examples of its power, and versatility.

It is structured to interface with OS-9,

and operates within the path structure

that makes OS-9 as powerful as it is.

W H I L E X ( Y D O

P R I N T " X I S L E S S T H A N Y "

Y : = Y - 1

E N D W H I L E

R E P E A T

I N P U T A $

P R I N T " I N C O R R E C T R E S P O N S E , S H O W A L I T T L E R E S P E C T I "

U N T I L A $ = " Y E S S I R "P R I N T " T H A T ' S B E T T E R "

I N P U T A , B

L O O P

P R I N T A

E X I T I F A ) 1 0 T H E N

P R I N T " A R E A C H E D 1 0 F I R S T . "

E N D E X I T

A : = A + 1

E X I T I F Y > 1 0 T H E N P R I N T " Y R E A C H E D 1 0 F I R S T "

E N D E X I T

Y : = Y + 1E N D L O O P

o·I

DERRYfERIPHERALS

COMPLETE PRODUCT LINES FORD.C. Hayes • H O E • Microsoft • Nashua • Okidata

APPLE • FRANKLIN. IBM·PC/XTWe carry many products at competitive prices to expand these fine computers.Request Catalog No. AFP*

Dealer

Inquiries

Invited

Professional WorkmanshipGuaranteed RepairsQuick Turn-around

HOE. AIM • SYM • KIMHOE hardware and software for ASK, OLC, OMNI-65 systemsKIM replacement modules (1K - 4K) and keyboardsAIM-65 (1K - 4K) and accessories. Request Catalog No. TASK *

COMPUTER REPAIR SERVICE

Apple

AIM

• Franklin •PET • HOE

• SYM • KIM

Atari

Perry Peripherals"Cataloqs

AFP $2.00 TASK $1.50

Catalog price refundedwith first order

Repair Center6 Brookhaven DriveRocky POint, NY 11778

OrdersP.O. Box 924 (516)744-6462Miller Place NY 11764 9AM-5PM Weekdays

Page 37: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 37/86

DOSPLUS for

Commodore 64Part 3

In the second article in this series

[MICRO No. 69), a transient program

loader was described. This program

will move machine language programs

from hidden RAM [located at the same

address, or underneath the BASIC

ROM) to an area of memory in which

they can execute [$COOO-$C7FF). In

this installment, two such programs

are provided: a monitor program and a

program that will allow you to format

your (non-Commodore) printer to setup character size, top, bottom, left, and

right margins, etc. Since we'll need the

monitor program to save our other

programs, it will be described first.

Add a Machine Language Monitor

A machine language monitor is helpful

to move blocks of memory,

disassemble ML code, and save' ML

programs to disk. A very good monitor,

probably the most widely used for the

Commodore 64, is Jim Butterfield's

Supermon64.Vl which can be found onCommodore's Disk Bonus Pack and

several public domain disks from the

Toronto Pet Users Group. It is a little

larger than 2 kilobytes but can be

shrunk (to 2K) and relocated to $COOO

to be used with DOSPLUS. However,

when you think about it, $COOOis the

worst place to put the monitor

program. You will probably be working

on ML programs assembled to run at

$COOO,so the monitor should be placed

elsewhere. As normally configured,

Supermon cuts the BASIC user RAM by

about 2K, so this is sometimesundesirable.

One place you can put the monitor

without taking any user RAM is in the

hidden RAM underneath the BASIC

ROM. In fact, you can run it from

underneath the ROM and even use

Kernal ROM subroutines

($EOOO-$FFFF). However, getting the

monitor into this area of memory,

establishing the hooks to DOSPLUS

and a clean exit to BASIC, and then

saving the program to disk is a little

No. 70 - March 1984

Michae l J. Keryan

A machine languagemonitor, a printerformatting program, a

repeat key toggle, and a kill(quit DOSPLUS) function forthe recently publishedDOSPLUS utility program.

tricky, so reread the next sections

before jumping in.

Supermon can relocate itself to the

top of usable memory; in fact it does

this every time you load and run it. But

now you want to relocate it to the top

of (hidden) RAM, not user RAM. First,

load and run Supermon as usual. You

will see on the screen a B· and a

register display. Now type in these

three lines:

.:000136

.:003700 CO

.G 0880

Now you will see another B· and

register display, but this time you are

running the new version of the monitor

located in RAM under the BASIC ROM.

What goes here?

The first line above switches outthe BASIC ROM by placing $36 into

location $0001, the 6510 CPU's

memory management register. The

second line places $COOOinto the top

of memory pointers located at $0037,

$0038. So instead of your user memory

ending at $AOOO,it now ends at $COOO.

Next a jump to $0880--this causes the

entire monitor program to be relocated.

You can find the beginning of the new

version to be $B7ED, the end to be

$BFFF.

MICRO

Now, while you are still in the

monitor program, assemble the code

shown in Listing I, starting at $COOO.

This is a boot program that will allow

you to jump to the monitor and exit

cleanly to BASIC. The program

switches out BASIC ROM (as we just

did), moves part of itself to $02A7 (an

unused portion of memory), sets up the

exit vector, and then jumps to the

monitor [$B7EDJ. The exit routine sets

the character color to black, switches

the BASIC ROM back in, adjusts the

stack, then does a jump to the warm

start.This routine now must also be moved

to hidden RAM and new table pointers

established. Type in four more lines:

.T COOOC030 B700

.:AOI301.:A033 B7

.S II S.ML" ,08,AOOO,COOO

This transfers the small program to

$B700 and sets up the tables for a

program of 1 block length, starting at

$B700, to be moved to $COOOby the

transient relocator when a RESTORE, S

sequence of keys is used.

To use the monitor with DOSPLUS,

the DOSPLUS boot program must be

updated to include S as an active key by

adding the following line:

35

Page 38: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 38/86

3065 POKE 52179,89: POKE

52211,207

Also add the following line to load the

monitor program:

1005 IF Al THEN A2: LOAD "

S.ML",8,l

Once the monitor is loaded and

running, the area of memory from

$COOOto $C7FF is free for your use.

Format Your Printer

The first article in this series gave a

machine language routine to dump the

screen to a printer configured as device

#4. Another routine was provided to

tum on or off the printer so all output

could also be directed to the printer.

These programs work with

Commodore's 1525 printer or any

other printer that can emulate the

Commodore printer through an

intelligent interface.

Many owners of Commodore 64's

have opted to buy printers made byother manufacturers, such as Epson,

OKI, Gemini, C. Itoh, or NEC. These

printers are not only more expensive

than Commodore's 1525, but require

an interface costing from $50 to $120

which plugs between the computer and

the printer. The main purpose of the

interface is to emulate the 1525printer,

i. e. translate certain character codes

sent out on the Commodore 64 serial

bus to the correct ASCII characters and

control codes in the parallel format

recognizable by the printer.

Why would so many saneindividuals goto such trouble and extra

expense to hook up a non-Commodore

printer through an interface when the

result is a printer that emulates the less

expensive Commodore 1525? The

. answer is that the other

printerlinterface combinations provide

a number of features not available on

the 1525. These include faster printing,

better quality print, several thousand

character buffers, the ability toprint on

labels, and quite a few special

formatting commands that are printer-

specific and/or interface-specific. Buthow many of these special formatting

commands are routinely used?

Probably none, because to do so

requires searching through manuals

and using special OPEN and PRlNT#

commands.

To make these functions easy to

use, a printer formatting program is

shown in the assembler Listing 2. It can

be used as is for an NEC 8023 [or

similar printers such as C. Itoh 8510,

Prowriter, etc.) and a Tymac

36·

Connection printer interface connected

to the Commodore 64. This program

will require modifications for other

combinations of printerslinterfaces.

The machine language program is

designed to be used with DOSPLUS

code published in previous articles; it

uses a number of DOSPLUS routines.

Entry to the program first saves the

current screen, then sets the default set

up parameters. You are then instructed

to enter one of the following letters:

D for Default set-up

C to Change the set-up [to other

than default)

N for No set-up

Any other response is ignored. The

default set-up is 12 characters/inch, a

left margin of 10 characters, right

margin of 6 characters [this gives 80

characters/line with margins), form

set-up with skip-over-perf, and non-

enhanced print.

If the default set-up is chosen, the

following optional input routines areskipped. A choice of C will allow a

variety of format set-ups. First is

character widths:

E n t e r C h a r f I n c h C h a r / L i n e

1 17 132

2 12 96

3 P r o p o r t i o n a l 96

4 10 80

5 8.5 66

6 6 48

7 P r o p o r t i o n a l 48

8 5 40

( P r o p o r t i o n a l C h a r / L i n e i s

a p p r o x i m a t e )

The next two options are desired

number of characters for the left and

right margins. These two numbers are

subtracted from the number of

characters for the full line to get the

actual number of characters that can be

printed on a line. This is printed out to

the screen and you are asked if this isOK. If not, you can then gothrough the

procedure again. If you made a mistakeand get a zeroor negative line width, an

error message is printed and you then

have to re-enter the data.

The next option is the fold mode

available with the Connection

interface. This mode keeps the printer

from printing part of a word on one line

and the rest of the word on the next.

This mode makes BASIC listings more

readable. The form length option is

MICRO

next. It sets up the height of the sheet

of paper to 66 lines so that a form-feed

will get you to the same place on each

page. Next is the skip-over-perf option,

which allows top and bottom margins

tobe automatically set up for each page

printed. Once set, all pages are

formatted in the same manner unless

the printer is reset. The last option is

the enhanced made, in which

everything is printed with double-

striking.

After all the desired parameters

have been chosen, the printer port

[device #4) must be opened, the desired

data output, then the port closed.

Actually, this sequence is done three

times as described below. First, the

port is opened with a secondary address

of zero. Codes equivalent to the

following are then sent to the interface

[they never get to the printer):

CHR$(27)"W"CHR$[0)

This de-activates the Width function of

the interface [which normally defaults

to 80). This step is required to

eliminate an undesired carriage return

being sent to the printer later on.

Next the printer port is opened with

a secondary address of 6. This is the

Connection's transparent mode so all

data will be sent directly [unchanged)

to the printer. A three byte sequence is

output to set up character size. Two

more bytes select either normal or

enhanced mode. If desired, a 136 byte

sequence is output to set up the form

length in the printer (with or without

skip-over-perf).

Now the printer port is opened with

a secondary address of zero again. Then

the equivalent of the following is sent

to the interface:

CHR$(27)"F"CHR$[x)

CHR$[27J' 'I''CHR$[y)

CHR$(27)' 'W"CHR$(z)

where xO for fold off, xl for fold on,

ynumber of characters for the left

margin, and zthe sum of y and the

actual line width. Finally a carriage

return is sent to activate the margins.

The printer port is left either open orclosed as desired and then the old

screen is restored.

The printer formatting program is

assembled to run at $COOO.It resides

under the BASIC ROM, however, and

is transferred to upper memory as

described in the last article in this

series. Saving the program to disk is a

little tricky, soproceed as follows.

With DOSPLUS [including the

monitor) in memory, place the printer

utility program into the RAM area of

No. 70 . March 1984

Page 39: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 39/86

$COOO-$C4FF. Use either an

assembler/loader or a BASIC loader

that POKEs DATA into memory. Then

move the program into hidden RAM.

This is done easily in BASIC

immediate mode:

FOR I 0 TO 1279: A

PEEK(149152):POKE (141216):NEXT I

POKE 40966,5: POKE 40998,161

The last line sets up the tables for

program length (5 blocks) and starting

location ($AlOOI.

Now, activate the monitor program

by RESTORE, then S. Save the whole

8K block (this now includes the

monitor and the printer formatter):

.S II SF.ML",08,AOOO,COOO

Repeat

Normally, only the space bar and the

cursor keys of the Commodore 64 have

auto-repeat. Holding down any other

key gives you only one character forevery key press. A flag for the repeat

function is located at $028A. The

RESTORE, R sequence of keys has been

assigned to toggling the repeat mode on

and off. When the repeat mode is 'on',

all keys will have the same auto-repeat

ability. The code for this function is

extremely simple, as shown in Listing

3. Itfits into an unused area of memory

located at $C807. It is only 9 bytes

long.

Kill

To activate the DOSPLUS routines you

have to load and run the DOSPLUS

boot program. To kill it requires either

shutting off the computer or a jump to

the system reset (SYS64759). Since it

is nearly impossible to remember the

number to SYS to, a Kill function was

added to DOSPLUS. Hit RESTORE, K

to reset the computer, kill DOSPLUS

and the wedge, and wipe out any

programs in memory.

Wrap-up

In this article, we've added four more

functions to DOSPLUS: F to format

the printer, S for Supermon, K for kill,

and R for repeat on/off. A new BASIC

boot program will be printed in the

next article in this series. Alsoprovided

next time will be a method to store

BASIC programs in hidden RAM, so

you can switch back and forth between

two BASIC programs by hitting a

couple of keys.

No. 70 . March 1984

Listing 1

C O O O

C O O O A 9 3 6C 0 0 2 a s 0 1C 0 0 4 A 2 1 1C 0 0 6 B D I C C OC 0 0 9 9 D A i l 0 2C O O C C AC O O D D O F 7C O O F A 9 A 6C O i l a D D O B FC O l 4 A 9 0 2C O l i l a D D I B FC 0 1 9 ~ C E D B 7C O I C 0 0

C O l D A 9 9 0C O I F 2 0 D 2 F FC 0 2 2 A 2 3 7C 0 2 4 a i l 0 1C 0 2 6 A E 3 F 0 2C 0 2 9 9 AC 0 2 A 6 C 0 2 A O

C 0 2 D

; k E R V A N D O S P L U S 3 " A R C H 1 9 a 4j S U P E R " O N B O O T - - T O R U N A V E R S I O N; O F S U P E R " O N F R O " U N D E R T H E B A S I Cj R O " S - - T H I S P R O G R A " R E S I D E S A T; $ B 7 0 0 B U T I S T R A N S F E R R E D T O A N D; R U N S A T $ C O O O W I T H D O S P L U S

O R G $ C O O O

. S P R B O O L D A 1 $ 3 6S T A $ 0 1L D X 1 $ 1 1L D A E X T C O D - I , XS T A f 0 2 A i l , XD E XB N E L O O P CL D A I $ A 6S T A $ B F D OL D A 1 $ 0 2S T A $ B F D IJ " P $ B 7 E DB R k

L D A 1 $ 9 0J S R $ F F D 2L D X 1 $ 3 7S T X $ 0 1L D X f 0 2 3 FT X SJ " P ( f A 0 0 2 )

; T A k E O U T; B A S I C R O "

; T R A N S F E R; C O D E B E L O WJ T O f 0 2 A 7

; C H A N G E E X I Tj R O U T I N E O F; N E W V E R S I O N; O F " O N I T O RI G O T O " O N I T O R

; T H I S C O D E I S; " O V E D T O; $ 0 2 A 7 T O R U N; ( S E E B E L O W )

; O R G $ 0 2 A 7I E X T C O D L D A 1 $ 9 0 , O U T P U T B L A C k

J S R f F F D 2 ; C O L O R C O D EL D X 1 $ 3 7 ; S W I T C H I N T H ES T X $ 0 1 ; B A S I C R O "L D X $ 0 2 3 F , A D J U S T S T A C K

T X S j T H E N J U " PJ " P ( f A 0 0 2 ) ; T O W A R " S T A R T 3 6 5

, S E T U P T H E F O L L O W I N G B Y L O A D I N GI S U P E R " O N . T H E N E N T E R F O L L O W I N G :

; . : 0 0 0 1 3 6 ( B A S I C R O " O U T ); . : 0 0 3 7 0 0 C O ( F A k E T O P O F " E " ); . S o a a o I T O R E L O C A T E )I; N O N S U P E R " O N I S R E L O C A T E D T O; f B 7 E D A N D Y O U A R E R U N N I N G I T .; N O N E N T E R T H E A B O V E C O D E A T f C O O O, T H E N E N T E R T H E F O L L O W I N G :

. T C O O O C 0 3 0 B 7 0 0

. : A O l 3 0 1• : A 0 3 3 B 7. S • S " . " L " , O a , A O O O , C O O O

MICRO

L O O P C

E X T C O D

T H I S T R A N S F E R S T H E C O D E A T $ C O O OT O f 8 7 0 0 A N D P L A C E S D A T A I NT A B L E A T A O O O ( I B L O C k A N D 8 7I S T H E S T A R T I N G B L O C k F O R S K E Y )

; T H E N S A V E T H E N E N C O D E ( A L L 8 K )E N D

37

Page 40: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 40/86

listing 2

C O O O O R G $ C O O O C O F 3 D O 0 3 B N E D K E Y; C O F 5 4 C 9 A C 3 J I 1 P N O S E T

O O F D N U M L E Q U $ F D C O F a C 9 4 4 D K E Y C M P 1 $ 4 4 ; DO O F E N U M H E Q U $ F E C O F A D O 0 3 B N E C K E Y0 0 7 C F P F I L E E Q U $ 7 C C O F C 4 C 4b C 3 J I 1 P O U T A L Lc a a F 0 4 E Q U $ C a a F ; O O S P L U S R O U T I N E S C O F F C 9 4 3 C K E Y C M P U 4 3 ; CC S C 3 T A B C O N E Q U $ C B C 3 C I O I F O 0 3 B E Q U N W I OC 9 B C P R N T O N E Q U $ C 9 B C C I 0 3 4 C 2 B C O J I 1 P O P E N I 1 SC 9 C 4 P R N T O F E Q U $ C 9 C 4 C I O b 2 0 4 1 C B U N W I O J S R H E S S A GC B 4 1 I 1 E S S A G E Q U $ C B 4 1 C I 0 9 O D 0 0 B Y T $ 0 0 , $ 0 0

C F 9 9 S C R S A I J E Q U $ C F 9 9 C I O B 4 3 4 a 4 1 A S C ' C H A R A C T E R S 'C F B I S C R R C L E Q U $ C F B I C I I 5 0 0 B Y ! $ 0 0F I C A O L O O U T E Q U $ F I C A ; K E R N A L R O U T I N E S C l l b 2 F 4 C 4 9 A S C ' / L I N E l I N C H E N T E R 'F F B A S E T L F S E Q U $ F F B A C I 2 S 0 0 B Y ! $ O DF F B O S E T N A M E Q U $ F F B O C I 2 9 2 0 3 1 3 3 A S C ' 1 3 2 1 7 (I) ,

F F e o O P E N E Q U $ F F C O C I 3 A 0 0 B Y ! $ 0 0 .F F C 3 C L O S E E Q U $ F F C 3 C l 3 B 2 0 2 0 3 9 A S C ' 9 b 1 2 (2) '

F F C 9 C H K O U T E Q U $ F F C 9 C l 4 C O D B Y ! $ 0 0F F C C C L R C H N E Q U $ F F C C C I 4 0 2 0 2 0 3 9 A S C ' 9 b P R O P . ( 3 } ,F F C F C H R I N E Q U $ F F C F C I 5 E O D B Y ! $ 0 0F F E 4 S E T I N E Q U $ F F E 4 C I 5 F 2 0 2 0 3 8 A S C ' 8 0 1 0 ( 4 } '

, C I 7 0 O D B Y T $ 0 0C O O O 2 0 9 9 C F F R I 1 P T R J S R S C R S A I J ; M A K E S U R E c m 2 0 2 0 3 6 A S C ' 66 8 . 5 ( 5 } 'C 0 0 3 A 9 4 S L D A 1 $ 4 5 ; D E F A U L T I S C I 8 2 0 0 B Y ! $ O DC 0 0 5 S O 5 9 C 4 S T A T M D O E S + I ; E S T A B L I S H E D C I 8 3 2 0 2 0 3 4 A S C ' 4 8 6 ( b ) '

C 0 0 8 A 9 O F L D A U O F ; I N C A S E O F C I 9 4 O D B Y ! $ O DC O O A 8 D S A C 4 S T A T M O O E S + 2 ; R E - E N T R Y C I 9 5 2 0 2 0 3 4 A S C ' 4 S P R O P . (7} ,

C O O D A 9 2 2 L O A 1 $ 2 2 C I A b 0 0 B Y ! $ O DC O O F a D 5 C C 4 S T A T M O O E S + 4 C I A 7 2 0 2 0 3 4 A S C ' 4 0 5 < B } 'C O l 2 A 9 4 3 L O A U 4 3 C I B a 0 0 s r t $ 0 0C O l 4 S D E 4 C 4 S T A T F R E N O C I B 9 2 0 2 0 2 0 A S C 'C 0 1 7 A 9 0 0 L O A 1 $ 0 0 C I C b 0 0 B Y ! $ 0 0C O l 9 8 D 6 7 C 4 S T A T C O N N T + 2 C I C 7 2 0 4 1 C B Q U E S T M J S R M E S S A GC O I C A 9 O A L O A U O A C I C A 2 0 3 F A S C ' ? 'C O l E 8 0 b A C 4 S T A T C O N N T + 5 C I C C 0 0 B Y T $ 0 0C 0 2 1 A 9 S A L O A U S A C I C D 2 0 2 1 C 4 U H M O O J S R G E T N B RC 0 2 3 a D b D C 4 S T A T C O N N T + 8 C I D O C 9 0 9 C M P 1 $ 0 9 ; ) S ?

C 0 2 6 A 9 0 1 L O A 1 $ 0 1 C I 0 2 B O F 3 B C S Q U E S T H i Y E S , R E T R YC 0 2 8 8 0 5 4 C 4 S T A F O R I 1 L N C I D 4 C 9 0 1 C M P 1 $ 0 1 ; > O ?C 0 2 B 2 0 4 1 C B O P E N I 1 S J S R M E S S A G C I O b 9 0 E F B C C Q U E S T I 1 ; N O , R E T R YC 0 2 E 9 3 2 0 2 0 B Y T $ 9 3 , $ 2 0 , $ 2 0 , $ 1 2 C I 0 8 A A T A XC 0 3 2 5 3 4 5 S 4 A S C ' S E T - L I P F O R N E C I C I D 9 B O 5 C C 4 L O A T C H R L N - I , xC 0 4 1 5 0 5 2 4 F A S C ' P R O W R I T E R - - C O N N E C T I O N ' C I O C 8 0 5 2 C 4 S T A C H R I N OC 0 5 6 9 2 0 0 0 0 B Y ! $ 9 2 , $ O D , $ 0 0 C I O F E O 0 1 C P K 1 $ 0 1C 0 5 9 2 0 4 4 4 5 A S C ' D E F A U L T : C P I = 1 2 L M = I O ' C I E I F O 0 4 B E Q C O N D E NC 0 6 F 2 0 5 2 4 D A S C ' R M = b L I N E = a o . ' C I E 3 E O 0 5 C P X 1 $ 0 5C 0 7 0 0 0 B n $ 0 0 C I E 5 D O 0 5 B N E P I C AC 0 7 E 2 0 4 0 4 F A S C ' F O R M = Y E S S K I P = Y E S ' C I E 7 A 9 5 1 C O H O E N L O A 1 $ 5 1C 0 9 0 2 0 4 5 4 E A S C ' E H H A N C E = N O , ' C I E 9 8 D 5 9 C 4 S T A T I 1 0 D E S + I ; 1 7 C P I M O D EC 0 9 C 0 0 0 0 B Y T $ 0 0 , $ 0 0 C I E C E O 0 4 P I C A C P X 1 $ 0 4C 0 9 E 4 5 4 E 5 4 A S C ' E N T E R : ' C I E E F O 0 4 B E Q T E N C H R

C O A 4 O D B Y ! $ O D C I F O E O o a C P X 1 $ 0 8C O A 5 2 0 2 0 2 0 A S C ' ( D } D E F A U L T S E T - U P ' C I F 2 D O 0 5 B N E P R O PC O B B O D B Y T $ 0 0

C I F 4 A 9 4 E T E H C H R L O A 1 $ 4 EC O B C 2 0 2 0 2 0 A S C ' ( C ) C H A H S E S E T - U P '

C I F 6 8 0 5 9 C 4 S T A T M O D E S + I ; 1 0 C P I M O D EC O O l 0 0 B Y T $ 0 0 C I F 9 E O 0 3 P R O P C P X 1 $ 0 3C 0 0 2 2 0 2 0 2 0 A S C ' ( N } N O S E T - U P '

C I F B F O 0 4 B E Q P R O P O RC O E 3 O D B Y T $ 0 0 C I F O E O 0 7 C P X 1 $ 0 7C O E 4 2 0 2 0 2 0 A S C ' ? '

C I F F D O 0 5 B N E E L I T EC O E 9 0 0 B Y T $ 0 0 C 2 0 1 A 9 5 0 P R O P O R L O A 1 $ 5 0C O E A 2 0 E 4 F F W A T O C N J S R S E T I N C 2 0 3 a D 5 9 C 4 S T A T M O O E S + I ; P R O P O R T I O N A LC O E D C 9 0 0 C M P 1 $ 0 0

C 2 0 b E O 0 5 E L I T E C P X 1 $ 0 5 ; M O O E ( 5 ?C O E F F O F 9 B E Q W A T O C N

C 2 0 B 9 0 0 5 B C C L E F T ; Y E S S O O NC O F I C 9 4 E C M P 1 $ 4 E ; N

38MICRO No. 70 - March 1984

Page 41: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 41/86

C 2 0 A A 9 O E L O A I $ O E ; N O W I D E M O D E C 3 0 0 0 0 0 0 B V T $ 0 0 , $ 0 0C 2 0 C 8 0 S A C 4 S T A T M D D E S + 2 C 3 0 F 5 3 4 B 4 9 A S C ' S K I P O Y E R P E R F 'C 2 0 F 2 0 4 1 C B L E F T J S R M E S S A G C 3 1 0 0 0 B Y T $ 0 0C 2 1 2 0 0 0 0 B Y T $ O D , $ O O C 3 1 E 2 0 E 3 C 3 J S R S E T Y NC 2 1 4 2 3 2 0 4 3 A S C ' I C H A R L E F T M A R G I N ?' C 3 2 1 9 0 0 5 B C C E N H A NC 2 2 8 0 0 B Y T $ 0 0 C 3 2 3 A 9 4 0 L O A 1 $ 4 0 1 0 E L E T E E N D O FC 2 2 9 2 0 2 1 C 4 J S R G E T N B R C 3 2 5 8 0 E 4 C 4 S T A T F R E N O I F O R M C O D EC 2 2 C 8 0 6 A C 4 S T A T C O N N T + 5 ; L E F T S T O P C 3 2 8 2 0 4 1 C B E N H A N J S R H E S S A GC 2 2 F 2 0 4 1 C B J S R M E S S A G C 3 2 B 0 0 0 0 B Y T $ 0 0 , $ 0 0C 2 3 2 0 0 0 0 B Y T $ 0 0 , $ 0 0 C 3 2 0 4 5 4 E 4 8 A S C ' E N H A N C E D P R I N T 'C 2 3 4 2 3 2 0 4 3 A S C ' . C H A R R I G H T H A R G I N ?' C 3 3 B 0 0 B Y T $ 0 0C 2 4 9 0 0 B Y T $ 0 0 C 3 3 C 2 0 E 3 C 3 J S R G E T Y NC 2 4 A 2 0 2 1 C 4 J S R G E T N B R C 3 3 F B O 0 5 B C S O U T A L LC 2 4 0 8 0 5 3 C 4 S T A R I T M A R C , 3 41 A 9 2 1 L O A 1 $ 2 1 I S E T E N H A N C E DC 2 5 0 A D 5 2 C 4 L O A C H R I N O C 3 4 3 8 0 5 C C 4 S T A T M O O E S + 4 I H O D EC 2 5 3 3 8 S E C C 3 4 6 2 0 C 4 C 9 O U T A L L J S R P R N T O F j P R I N T E R O F FC 2 5 4 E D 5 3 C 4 S B C R I T M A R C 3 4 9 A O 0 0 L O Y U { ) OC 2 5 7 B O I C B C S R W I O T H I I I N E ) 0 C H A R C 3 4 B 2 0 C 3 C 3 J S R F P O P E N I S E C A O R = OC 2 5 9 2 0 4 1 C 8 N E G L I N J S R M E S S A G C . 3 4 E A 2 0 0 L O X 1 $ 0 0 1 3 B Y T E SC 2 5 C 0 0 0 0 B V T $ 0 0 , $ 0 0 C 3 5 0 B O 5 5 C 4 L O O P F I L O A T F L V E S , XC 2 5 E 4 E 4 F 2 0 A S C ' N O G O O ~ . T R Y A G A I N . ' C 3 5 3 2 0 C A F I J S R O L O O U T I T H I S M A K E SC 2 7 1 0 0 B Y T $ 0 1 ) C 3 5 6 E 8 I N X i S U R E N O C RC 2 7 2 4 C 0 6 C I J I 1 P L I N W I O C 3 5 7 E O 0 3 C P X 1 $ 0 3 I I S G E N E R A T E DC 2 7 5 8 0 6 0 C 4 R W I O T H S T A T C O N N T + 8 I R I G H T S T O P C 3 5 9 D O F 5 B N E L O O P F I

C 2 7 8 E D 6 A C 4 S B C T C O N N T + 5 C 3 5 B 2 0 O A C 3 J S R F P C L O SC 2 7 B 9 0 D C B C C N E G L I N C 3 5 E A O 0 6 L O Y 1 $ 0 6C 2 7 0 8 5 F O S T A N U M L j L l N E W I D T H C 3 6 0 2 0 C 3 C 3 J S R F P O P E N I S E C A I I R = 6C 2 7 F 2 0 4 1 C B J S R H E S S A G C 3 6 3 A 2 0 0 L D X 1 $ 0 0 ; 5 8 Y T E SC 2 8 2 0 0 0 0 B Y T $ O O , $ O D C 3 6 5 B O 5 8 C 4 L O O P F 2 L O A T M O O E S , XC 2 8 4 5 4 4 8 4 9 A S C ' T H I S G I Y E S A L I N E O F ' C 3 6 8 2 0 C A F I J S R O L O O U TC 2 9 9 0 0 B Y T $ 0 0 C 3 6 B E 8 I N XC 2 9 A A 9 0 0 L O A 1 $ 0 0 C 3 6 C E O 0 5 C P X 1 $ 0 5C 2 9 C 8 5 F E S T A N U H H C 3 6 E D O F 5 B N E L O O P F 2C 2 9 E A 9 6 0 L D A 1 $ 6 0 I C H A N G E C O D E C 3 7 0 A D 5 4 C 4 L O A F O R H L N I F O R M S E T U P ?C 2 A O 8 0 C O C 8 S T A T A B C O N - 3 I T O S U B R O U T I N E C 3 7 3 F O 0 0 B E Q F C L I N O , S K I P I TC 2 A 3 2 0 8 F C 8 J S R D 4 C 3 7 5 A 2 0 0 L O X 1 $ 0 0 ; 1 3 6 B Y T E SC 2 A 6 A 9 4 C L O A U 4 C I R E S T O R E 0 4 C 3 7 7 D D 6 F C 4 L O O P F 3 L O A T F D R L N , XC 2 A 8 8 0 C O C B S T A T A B C O N - 3 ; C O O E C 3 7 A 2 0 C A F I J S R O L D O U T

C 2 A B 2 0 4 1 C B J S R I 1 E S S A G C 3 7 0 E 8 I N XC 2 A E 2 0 4 3 4 8 A S C ' C H A R A C T E R S ' C 3 7 E E O 8 8 C P X 1 $ 8 8C 2 B 9 0 0 D Y T $ 0 0 C 3 8 0 D O F 5 B N E L O O P F 3C 2 B A 4 F 4 B A S C ' O K ' C 3 8 2 2 0 D A C 3 F C L J S R F P C L O SC 2 B C 0 0 B Y T $ 0 0 C 3 a 5 A O 0 0 L O Y 1 $ 0 0C 2 B O 2 0 E 3 C 3 J S R G E T Y N I S O F A R O K ? C 3 8 7 2 0 C 3 C 3 J S R F P O P E N I S E C A D R = OC 2 C O 9 0 0 3 B C C F O L O M O I Y E S G O O N C 3 8 A A 2 0 0 L D X I $ Q O 1 1 0 B Y T E SC 2 C 2 4 C 0 6 C I J I 1 P L l N W I O C . 3 8 C B O 6 5 C 4 L O O P F 4 L D A T C O N N T , XC 2 C 5 2 0 4 1 C B F O L D M D J S R M E S S A G C 3 8 F 2 0 C A F I J S R O L O O U T I T H I S G O E SC 2 C B 0 0 0 0 B Y T $ 0 0 , $ 0 0 C 3 9 2 E 8 I N X I T O I N T E R F A C EC 2 C A 5 7 4 1 4 E A B C ' W A N T F O L D M O D E O N ' C 3 9 3 E O O A C P X U O AC 2 0 B 0 0 B Y T $ 0 0 C 3 9 5 D O F 5 S N E L O O P F 4 I N O T P R I N T E RC 2 0 C 2 0 E 3 C 3 J S R G E T Y N C 3 9 7 2 0 O A C 3 J S R F P C L O SC 2 D F B O 0 5 B C S F O R H S U C 3 9 A 2 0 4 1 C B N O S E l J S R I 1 E S S A S

C 2 E 1 A 9 0 1 L O A 1 $ 0 1 I F O L D H O D E C 3 9 D O D O D D Y T $ O O , $ O DC 2 E 3 8 0 6 7 C 4 S T A T C O N N T + 2 I S E T S W I T C H C 3 9 F 5 7 4 1 4 E A S C ' W A N T T H E P R I N T E R L E F T 0 'C 2 E 6 2 0 4 1 C B F O R M S U J S R I 1 E S S A G C 3 B 6 0 0 B Y T $ 0 0C 2 E 9 0 0 0 0 B Y T $ 0 0 , $ 0 0 C 3 B 7 2 0 E 3 C 3 J S R S E T Y NC 2 E B 5 3 4 5 5 4 A S C ' S E T U P F O R M L E N G T H ' C 3 B A B O 0 3 B C S F P T R D NC 2 F O 0 0 B Y T $ 0 0 C 3 B C 2 0 B C C 9 J S R P R N T O N J P R I N T E R O NC 2 F E 2 0 E 3 C 3 J S R G E T Y N C 3 B F 2 0 B I C F F P T R D N J S R S C R R C LC 3 0 1 9 0 0 7 B C C S K I P P F C 3 C 2 6 0 R T SC 3 0 3 A 9 0 0 L O A 1 $ 0 0 ; N O F O R I 1 S O .C 3 0 5 8 0 5 4 C 4 S T A F O R M L N J R E S E T S W I T C H ; S U B R O U T I N E S T O S U P P O R T A B O Y E C O D EC . 3 0 8 F O I E B E Q E N H A N I A L S O s n p S K I P .C 3 0 A 2 0 4 1 C B S K I P P F J S R M E S S A 6 C 3 C 3 A 9 7 C F P O P E N L D A I F P F I L E

No. 70 - March 1984MICRO

39

Page 42: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 42/86

C 3 C 5 A 2 0 4 L O X 1 $ 0 4 C 4 5 3 0 6 R I T M A R B Y T $ 0 6C 3 C 7 2 0 B A F F J S R S E T L F S C 4 5 4 0 1 F O R M L N B n $ 0 1C 3 C A A 9 0 0 L O A 1 $ 0 0 I,C 3 C C 2 0 B O F F J S R S E T N A M C 4 5 5 1 9 5 7 0 0 T F L Y E S E Y T $ 1 8 , $ 5 7 , $ 0 0C 3 C F 2 0 C O F F J S R O P E N ;C 3 0 2 B O 0 6 B C S F P C L O S ; E R R O R C 4 5 8 1 9 4 5 O F T M O O E S 9 Y T $ 1 9 , $ 4 5 , $ O F , $ 1 8 , $ 2 2C 3 0 4 A 2 7 C L O X I F P F I L E jC 3 0 6 2 0 C 9 F F J S R C H K O U T C 4 5 0 8 4 6 0 6 0 T C H R L N 9 Y T $ 8 4 , $ 6 0 , $ 6 0 , $ 5 0C 3 0 9 6 0 R T S C 4 6 1 4 2 3 0 3 0 B Y T $ 4 2 , $ 3 0 , $ 3 0 , $ 2 8

j jC 3 0 A A 9 7 C F P C L O S L O A I F P F I L E C 4 6 5 1 8 4 6 0 0 T C O N N T 8 Y T $ 1 8 , $ 4 6 , $ 0 0 ; F O L D O F FC 3 0 C 2 0 C 3 F F J S R C L O S E C 4 6 8 1 8 4 9 O A B Y T $ I B , $ 4 9 , $ O A j L E F T M A R G I NC 3 0 F 2 0 C C F F J S R C L R C H N C 4 6 B I B 5 7 5 A 9 Y T $ I B , $ 5 7 , $ 5 A J R I G H T S T O PC 3 E 2 6 0 R T S C 4 6 E 0 0 E Y T $ 0 0 j C A R R E 1

j j

C 3 E 3 2 0 4 1 C B G E T Y N J S R M E S S A 6 C 4 6 F 1 0 4 1 T F O R L N B Y T $ I D , $ 4 lC 3 E 6 2 0 3 C 5 9 A S C ' ( Y I N > ? ' C 4 7 1 4 0 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ '

C 3 E E 0 0 B Y T $ 0 0 C 4 7 B 4 0 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ '

C 3 E F 2 0 E 4 F F W A T N U L J S R S E l i N ; K E E P F R O M C 4 8 5 4 0 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ '

C 3 F 2 C 9 0 0 C H P 1 $ 0 0 j F A L S E E N T R Y C 4 8 F 4 0 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ '

C 3 F 4 D O F 9 B N E W A T N U L C 4 9 9 ~ O 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ '

C 3 F 6 2 0 E 4 F F N A T Y N J S R S E l i N C 4 A 3 4 0 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ '

C 3 F 9 C 9 0 0 C M P 1 $ 0 0 C 4 A O 4 0 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ '

C 3 F B F O F 9 B E Q W A T Y N C 4 B 7 4 0 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ '

C 3 F O C 9 5 9 C H P 1 $ 5 9 j Y F O R Y E S C 4 C I 4 0 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ 'C 3 F F 0 0 0 2 B N E N E G C H k C 4 C B 4 0 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ '

C 4 0 1 1 8 C L C C 4 D 5 4 0 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ '

C 4 0 2 6 0 R T S C 4 0 F 4 0 4 0 4 0 A S C ' @ @ @ @ @ '

C 4 0 3 C 9 4 E N E 6 C H K C H P U 4 E j N F O R N O C 4 E 4 4 3 T F R E N O B Y T $ 4 3 J B O T T O M M A R G I NC 4 0 5 0 0 O C B N E G E T Y N C 4 E 5 4 0 4 0 4 0 A S C ' @ @ @ @ @ @ @ @ @ @ '

C 4 0 7 3 8 S E C C 4 E F 4 0 4 0 4 0 A S C ' @ @ @ @ @ '

C 4 0 8 6 0 R T S C 4 F 4 4 1 4 0 I E B Y T $ 4 1 , $ 4 0 , $ I EI j

C 4 0 9 2 0 4 1 C 9 N U M E R R J S R M E S S A S C 4 F 7 E N DC 4 0 C 0 0 O D B Y T $ O D , $ O D

Listing 3C 4 0 E 4 5 5 2 5 2 A S C ' E R R O R - - T R Y A G A I N . 'j K E R Y A N D O S P L U S + P A R T 3 M A R C H 1 9 8 4

C 4 1 F O D 0 0 B Y T $ 0 0 , $ 0 0 j R E P E A T F U N C T I O N T O S G L E O N / O F FC 4 2 1 A 9 0 0 S E T N B R L O A 1 $ 0 0 jC 4 2 3 8 5 F O S T A N U " L j U S E N I T H O O S +C 4 2 5 8 5 F E S T A N U H H jC 4 2 7 2 0 C F F F J S R C H R I N C 8 0 7 O R S $ C 8 0 7C 4 2 A C 9 3 0 F P D E C C " P 1 $ 3 0

;C 4 2 C 9 0 O B B C C N U " E R R 0 2 8 A R P T F L G E Q U $ 0 2 8 AC 4 2 E C 9 3 A C M P U 3 A jC 4 3 0 B O D 7 B C S N U " E R R C 8 0 7 A O B A 0 2 R E P E T S L O A R P T F L GC 4 3 2 2 9 O F A N O U O F C 8 0 A 4 9 8 0 E O R U ~ OC 4 3 4 A 2 I I L O X 1 $ 1 1 C 8 0 C S D 8 A 0 2 S T A R P T F L SC 4 3 6 0 0 0 5 B N E N D 3 C 8 0 F 6 0 R T SC 4 3 8 9 0 0 2 N D I B C C N D 2

I

C 4 3 A 6 9 0 9 A O C 1 $ 0 9,j C H A N S E P O I N T E R S T O U S E T H E R K E Y

C 4 3 C 4 A N 0 2 L S R j F O R R E P E T SC 4 3 D 6 6 F E N 0 3 R O R N U H H

I

C 4 3 F 6 6 F D R O R N U M L ,C B D 2 O R S $ C B 0 2C 4 4 1 C A O E X C B 0 2 0 7 B Y T $ 0 7C 4 4 2 D O F 4 B N E N O I

I

C 4 4 4 2 0 C F F F J S R C H R I N,

C B F 2 D R S $ C B F 2C 4 4 7 C 9 0 0 C H P U O O C B F 2 c a B Y T $ C 8C 4 4 9 0 0 O F B N E F P D E C

I

C 4 4 B A S F E L O A N U H H,

C B F 3 E N DC 4 4 D 0 0 S A B N E N L I M E R RC 4 4 F A 5 F D L D A N U H LC 4 5 1 6 0 R T S Michael J . Keryan may be reached at 713

jLocust Drive, Tallmadge, OH 44278,

C 4 5 2 6 0 C H R I N D B Y T $ 6 0

4 0 MICRO No. 70· March 1984

Page 43: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 43/86

I A l C A O "From Here to Atari by Paul s. Swanson

Free Connections

In a surprising number of homes all

over the country people are donating

their time, computer equipment and

phone lines to the public. These people

operate computer bulletin board ser-

vices IBES's). Calling BBS's is becom-

ing a very popular pasttime. These

BBS's, or "boards" as they are more

commonly called, usually contain a

message base where .callers can post

messages on just about any topic they

care to discuss. For example, in the

message bases of the boards I call in

this area contain ongoing discussions

about national politics, US-USSR rela-tions, nuclear weapons control and

economics. There are alsoother discus-

sions concerning the possibilities of

colonizing other planets. In addition,

there are more "down to earth" topics

such as for sale and wanted ads, an-

nouncements of the numbers of new

boards, questions and answers about

computers and critiques of television

shows and movies. Other features of-

fered by these boards include on-line

games, local weather reports, public

domain software, private electronic

mail, lists of the telephone numbers ofother boards, help screens and chat.

The chat mode calls for the BBS's

owner, usually referred to as the

"SysOp," to converse via the

keyboards. Almost all of the boards

have most of these features. Some

boards also have multiple message

bases so that conversations are

categorized by some general criteria. If,

for example, you didn't want to have

anything to do with the current

political discussion, you wouldn't have

to see it at all, but could look at all of

the other messages.Obtaining the public domain soft-

ware available on the boards requires

that you have a terminal program that

can download files. Normally, this re-

quires that you have a disk drive on

your system, but there are some pro-

grams that will work with cassettes.

There are an enormous number of

public domain programs on the boards

ranging from games to serious utility

programs, which makes obtaining a ter-

minal program that allows

downloading a worthwhile effort. If

you run into problems finding one for

your particular computer, you can

leave a message on one of the boards

asking for help.

This service is, of course, not free of

problems. Occasionally there will be a

"problem caller" on a board, doing

some things which cause problems on

the system. For this reason, many

boards have instituted password

systems. These passwords are almost

always free as long as you leave your

real name and a valid telephone

number for verification. That way, the

SysOp knows who is using his com-

puter and if anyone causes problems,

he knows who to call by the password

used. Although having to apply for a

password intimidates some new users,

it has been effective in eliminating pro-

blems like this on most boards. Usual-

lyon these password systems, you are

also allowed use of a fictitious name on

the board so that, if you are shy about

using your own name, only you and the

SysOp know who you really are. Get-ting started is usually the hardest part

of communicating with free boards.

The problem is getting the first number

to call. Not too many places list these

free telephone numbers. I have listed

some boards below which are in the

Cambridge area. North Shore AMIS,

which is running on an Atari, has a list

of Atari-run boards all over the country.

The numbers are in the Features sec-

tion in a file called ATARlBBS. When

you have called there for the list, call

the board that is listed as being nearest

you to look for the numbers of otherboards that are in your area.

There are some standards tobe con-

sidered in the communication. Almost

all boards, at either 300 or 1200 baud,

communicate with 8 bits per word with

one stop bit, no parity, full duplex

ASCII. If your terminal program has

ways to alter the communications

parameters, those will probably be the

items listed. If any of them are not

listed or not alterable, your terminal

program probably already assumes the

correct value, since those selections are

so standard. If you are not sure of any

particular setting, try it one way and

call a board. If you find that the com-

puters cannot communicate, alter the

parameter in question and try again.

Trial and error will eventually get you

through, although odds are good that

the default values set for your program

are those described above.

Calling the boards in your area can

be informative, useful and of course

very entertaining. The bigg~st proble~

with them is that they are addictive, so

you have to keep careful track of how

much time you spend on this in-

teresting new hobby. Some BBS's in

the Cambridge area [all in the 617 area

code) are:

D Nite Lite 576 - 2426

(6pm - 6am only)

D The Outpost 259-0181

D North Shore AMIS 595- 0211

D Boston Bullet 266 - 7789

D Boston Bullet TBBS 267 - 7751

D The Trash Bin 497 - 6641

D King's Castle 444 - 5401There are actually over 30 free boards

which are in the local dialing area of

Cambridge. The other numbers are

listed on the above boards. All of the

boards above will answer at either 300

or 1200 baud except King's Castle,

which is 300 baud only. The hours for

my board, Nite Lite, are eastern time.

Please make the appropriate adjust-

ment for your time zone.

No. 70 - March 1984 41ICRO

Page 44: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 44/86

Page 45: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 45/86

Raise your Apple's IQ

e Tintes AYear!

AOne Year SubscriptionBrings You 12 Issues With:

Over $500 of Programs for your Home, Business, Education

and Entertainment. Complete Program Listings with

Instructions.

Comprehensive Articles that show what each program does,

how to use it and how to type it into your Apple, Franklin ACEor

other Applesoft-compatible computer.

Regular Features for the Beginner and Expert.

On The Scene

The Latest New Software/Hardware Releases.

Products! Inside and Out

Comprehensive Product Reviews.

Education Corner

Programs that help make Learning Fun.

Tips 'N Techniques

Little known programming Tricks you can Use.

Disassembly Lines

An Expert reveals the mysteries ofApplesoft.

Utilities

Superchargers for Basic, DOS, Printing, and More.

Games

Arcade Fun you can Type and Run.

Noteo Domesti c U.S. First Class subscr ipt ion r ate is $51.95

o Canada Air Mal l subscripton rat e IS $59.95

o Outside the U.S. and Canada Air Mail subscription rate is $89.95

All payments must be in U.S. funds drawn on a U.S. bank.

©1983 by Mi croSPARC Inc. All Rights Reserved.

Apple'" is a registered trademark of Apple Computer, Inc.

ACE' IS a regi stered t rademar k of Franklin Computer, Inc.

No. 70· March 1984

Try a NIBBLE!

Here's what some of our Readers say:

o "Certainly the best magazine on the Apple!"

o "Impressed with the quality and content. "

[J "Programs remarkably eruy to enter. "

o 'Til be a subscriber for life!"

o 'Your sennce isfantastic . . , a s a matter cf fact, I'm

amazed!"

Try a NIBBLE!

NIBBLEis focused completely on the Apple and

Applesoft-compatible computers.

Buy NIBBLEthrough your local Apple Dealer or subscribe now

with the Coupon or Order Card in this issue.

You'll want Back Issues Too!

Here are some examples of programs you can get:

The Investor-Stock Tracking, Reporting, and Graphing.

Recipe Box-Kitchen/Menu Management made Fun.

The Librarian-Auto Logging and Retrieval of your Disks,

DesignerjIl1ustrator-Art/Design Creation and

Composition with Graphics.

Machine Language Editor- Quick and Easy Aid for Typing

and Changing MIL Programs,

And Much ... Much More!

NIBBLEwill become a permanent part of your ReferenceLibrary, Discover why 95% of NIBBLEReaders save every Issue:

Join more than 120,000 Apple/Ace users who say:

"NIBBLE IS TERRIFICl"

S U B S C R IB E N O W A N D S A V E $ 1 2 . 0 0 O FF T H E C O V E R P R IC E !

r - - - - - - - - - - . ,bbl8

• =nl. We accep t Mas te r Cha== II

Box 325, Lincoln, MA 01773 (617) 259·9710 II'll tr y nibble!

IEnc lo se d is m y $ 26 .9 5 ( lo r 1 2 is su es ) I( Ou ts id e U .S ., s ee s pe Ci al n ote o n th is p ag e.)

I0 check 0 money order 0 bill me (U.S. only) IYour subscription wi ll begin with the next issue publ ished after receipt of your

Iheck/money order. ICard# Expires ----_

PLEASE PRINT CLEAAL Y

ISignature IName _

IM~~ II~ I

tate Zip _

1 . . - - - - - - - - - - . . 1ICRO 43

Page 46: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 46/86

Notice in each example that the curves

leave POand approach P3 in directions

defined by the straight lines connecting

PI to POand P2 to P3, respectively. In

addition to the influence PI and P2

have on the curve at the endpoints,

they have considerable control on the

overall shape of the curve. The

examples given in Figure 1 illustrate

the wide range of curve shapes which

can be generated.

In Figure 2 is an example of a family

of curves which is easily generated by

changing one or more of the control

points.

A number of Bezier curves can be

used to form complex curves and

surfaces, such as shown in Figure 3.

Implementation of Bezier Curves

in FORTH

From equations 1, 2 and 3, with n =3,

Figure 1. Example Bezier Curves

(a)(0,0) ~..;....--------------..., (255,0)

P1 PP2

, (10,20) / (200,10)

\ /\ /

\

(150,100)

(0,192)

(b)

(255,192)

(c)

. P1

(220,20) ,?

////

(180,150)

pPl

/ ./ (110,10)

//

P o

(20,100) ///

Pa

(200,90)

44 MICRO

the equation for a cubic Bezier curve

can be written as in equation 4,

(4) p(t) = (1-t)3*PO +

3*t*(1-t)2*Pl +

3*t2*(1-t)*P2 +

t3*P3

O<=t<=lwhere each point PIt) represents an X , Y

position on a coordinate system. Note

that for t=O, P(O)=PO and for t=l,

PIll =P3.For values of t between a and1 Pit) is a blending of the four points

PO, PI, P2 and P3.

Equation 4 could be programmed as

it is, but a more efficient representation

can be found. It can be rewritten as

(S)p(t) + t3*[(P3-PO)-

3*(P2-Pl)] +

t2*[3*(P2-Pl)-

3*(PI-PO)] +

t*[3*(PI-PO)] + PO

Letting

(6) PO' = PO

(7) PI' = 3*(PI-PO)

(8 ) P2' = 3*(P2-Pl)-

3*(PI-PO)

(9) P3' = (P3-PO)-

3*(P2-Pl)

equation 5 becomes

(10) p(t) = t3*P3' +

t2*P2' +t*Pl' + PO'

or

(11) p(t) = t*(t*

(t*P3'+P2' )+Pl' )+PO'

Note in equation 11 the repeatedexpression (t'Pm + Pn) found nestedthree levels deep. This expression for

PIt) requires considerably fewer

calculations than the original form in

equation 4. In particular, the number of

multiples is reduced to six Ithree foreach dimension X and Y). The

computations defined in equations 6

through 9 are performed once for a

given curve. To generate the curve,

equation 11 is then evaluated for

several values of t.

No. 70· March 1984

Page 47: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 47/86

Figure 2. A Family of Bezier Curves

Figure 3. Generating Complex Curves

and Surfaces

_-:r---.-. ., - - - - : , / .~)- - - . -/ . 'J .

h~-·-/./ .-

j

----

. r. /".

~ -~

L / , i '. . . . .. . - - · · · · t . I I l/...... "<, _j_ ........

io' .. -._ _ ••••

FORTH screens 42 through 47 given

in Listing 1 are an implementation of

equation 11. Taking advantage of

FORTH extensibility, X,Y point

operators P@, P!,P+, r-, po, p O I ,

POUP and PSWAP are defined [see

screens 43 and 44) corresponding to the

FORTH operators @ (fetch), ! (store, =

[plus], . [minus]," [times], 0I [times-

divide), OUP [duplicate top of stack),

and SWAP (exchange top two items on

stack). {Note: the notation [m,n ..- p,q)

defines stack contents before Ion the

left) and after (on the right) the word

executes.} Control point storage is

defined in terms of point names PO,PI,

P2 and P3, rather than (XO,YO),

(Xl,Yl), etc., for convenience. In each

case, the point name Pi points to the

corresponding X value, the Y value is

No. 70 - March 1984

stored in the next cell. (See lines 7-11

of screen 44.)

To draw the Bezier curve, points

Pit) are calculated for several values of t

and the points are connected by

straight lines. By choosing small

enough increments in t, the resultant

plot appears as a "smooth" curve (as a

function of the resolution of the

graphics system). In the

implementation presented here integer

arithmetic is used, not only because

FORTH arithmetic is integer, but also

because it is faster. The parameter t

must be scaled so that it takes on only

integer values. A variable N is defined

as the upper limit of t. N also specifies

the number of line segments used to

build the curve. To generate a curve,

then, the graphics cursor is moved to

MICRO

the beginning of the curve, Pia) =PO,

then PIT) is computed for T = 1 and a

line is drawn to P(I). PIT) is computed

for T =2 and a line is drawn from P(I)

to P(2), etc. The process is repeated to

generate N line segments and to end at

point PIN)= P3.The number of segments is

determined by computing Pit) at the

curve midpoint, i.e., at T=N/2. The

maximum of

X=(IX(N/2)-X(o)I)/3

and

Y=( I Y(N/2 )- Y(O) 1 )/3

is taken as the segment count, with a

minimum of 3 and a maximum of 50.

These minimum and maximum values

are somewhat arbitrary. They affect

both curve quality and curve

generation speed. The FORTH word

FIX.N defined in screen 46 performs

this calculation and sets the value ofN.

The variable N.SC, defined in screen 44

provides a convenient means toexperiment with the segment count. Its

default value is 3 (see line 14, screen

44).

Equations 6 through 9 are

implemented in the word

COMPUTE.P' in screen 45. The word

STORE.POINTS is used to define the

control points PO, PI, P2 and P3 by

writing data from the stack into the

corresponding storage locations .

LIST.POINTS and SHOW.POINTS are

utilities for viewing the control points

on the CRT or on the graphics display

device .Only two graphics commands are

used to draw the curve. They are

TMOVE, which moves the cursor

(without drawing) to the specified X,Y

position on the screen, and TORAW,

which draws a line from the present

cursor position to the specified

position. Equivalent commands should

be readily defined for most graphics

systems if they do not already exist.

MOVE.TO.PO, defined in screen 46,

simply moves the graphics cursor to

control point PO, the beginning of the

curve. LOAD.POINTS was defined to

load the modified control points

PO'-P3' onto the stack for use by the

word P(T). PIT) is an implementation

of equation 11, the simplified

expression derived earlier. The word

performs the general computation

ItOPm+Pn) three times as defined by

equation 11.

The parameter, T, is varied over its

range of 1 to N in the word CURVE

(screen 47), which generates the Bezier

curve. BEZIERputs everything together

45

Page 48: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 48/86

to produce a curve given a set of four

control points PO, PI, P2 and P3.

To generate the example curve

shown in Figure lb, the following was

executed.

80 150 220 20 10 20

180 150 STORE. POINTS

BEZIER

For the family of curves given in Figure

2 the word given below was defined,then executed:

: FAMILY 240 30 DO IPO !BEZIER 10 +LOOP

20 150 1 40 240 20 120

120 STORE. POINTS

FAMILY

where "I PO '" modifies only XO [not

YO) since XO is stored at the address

defined by PO.To modify YOwe would

use PO 2 + l. We could also use thepoint store word P!defined in screen 43

to redefine anyone of the four points.

For example, "50 140 PO P)" would

change point POX and Y values to 50

and 140 respectively.

An Application: Line Drawings

Screens 35-39 (listing 2) define an

application of the Bezier curve code,

along with other graphics primitives, to

generate line drawings from a table of

data. Nine commands are defined, as

listed in screen 35. They provide the

ability to build a picture from dots,

straight lines, rectangles, circles and, of

course, Bezier curves. The data are

stored on disk in FORTH screens so

that it can be generated, edited and

listed using the FORTH editor.

The only nonstandard words used

are CASE (screen 38), and the graphics

primitives COLOR, TOOT, TCIRCLE,

TMOVE, TDRAW, TRECT and CLEAR

(used inscreens 36 and 37). CASEis the

version written by C.E. Eaker and A.J.Monroe, published in FORTH

Dimensions." The graphics primitives

are a subset of the primitives supported

by the author's system (a TMS99l8A-

based color graphics system). A similar

set of primitives should be available or

could be written for other graphics

systems.

The application and examples were

written assuming a FORTH disk format

of lK bytes per sector so that one sector

stores an entire screen of data

("screen" here refers to the FORTH

screen, not the graphics screen). The

word BLOCK (screen 36, line 5) will

46

then load an entire screen. Other

configurations may require slight

modification of the data file and/ or the

code.

READ.BLKin screen 36 loads in the

specified data file and establishes it as

the source of data for

READ.COMMAND and DATA. It also

displays at the terminal the figure title

or subtitle. READ.COMMAND (screen

39) reads the next character from thedata file and expects it to be the ASCII

code of one of the nine commands.

CASE, used in EXEC.COMMAND

(screen 38), then selects the appropriate

word to execute that command.

The word OATA in screen 36 is a

key word in the remaining word

definitions. It retrieves a parameter

from the data file. For example, in the

definition of the word DRAW.CURVE

it is used eight times to load four X,Y

data pairs from the file.

Each screen of a data file begins

with a title or subtitle which is

terminated by a ")". Commands are

given one after the other, each with the

required number of data values. At

least one space must separate all

commands and data values. The "E"command terminates the data file. The

"N" command permits building large

data files by linking screens [blocks) for

continuation.

Figure 4 presents an example

drawing. The data file is given in

Listing 3 as screens 40 and 41. Figure 5

illustrates the derivation of the data

file. The first five line segments are

Figure 4. An example drawing

(0,0) x

(x'Y)ndenotespoint 10' segmentn Gdenotes segmentnumber

Figure 5. Illustration of data

definition

~60,50) "

~135,23)

___ ....0 ~155,32)

~~~152,50)

y

No. 70 - March 1984ICRO

Page 49: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 49/86

shown with points PO through P3 for

each. To draw the figure defined by

these data the command

40 FIGURE

R E F E R E N C E S :

1 . R o g e r s an d A d a m s, M a t h e m at i c a l

E l e m e n t s f o r C o m p u t e r G r a p h i c s , M c G r a w -

H i l l B o o k C o . , 1 9 7 6 , p p . 1 3 9 - 1 4 4 .

2 . M o n r o e , A . J . , F O R T H D i m e n s i o n s,

V o l u m e III, N o . 6 , p . 1 8 7 .

R i c h a r d H . T u r p i n m a y b e r e a c h e d a t 8 2 2 6

W ar b l e r W a y , I n d i a n ap o l i s , I N 4 6 2 2 3 .

would be entered at the terminal.

Listing 1. Bezier Curves in FORTH

S C R • 4 2

o B e z ie r C u r v e s - A F O RT H l f ip l el e nt at i on

B y R . H . T u r p i nI R e f e r e n c e : R o g er s' A d a i s, " M a t h e m at i c a l E l e l e n t s f o r

C Ol pu te r G r ap h ic s, ' p p 1 39 -1 44 , H cG r. ; w - H il l, 1 97 6.

4 I D e f i n e 4 p o i n t s P O , P l , P 2 , a n d n, e a c h a n X ,l p a i r .

5 I T h e B e z i e r c u r v e i s d e f i n e d b y t h e f ol lo wi ng e qu at io n,

6 I w h er e O (= T( =I :

( P ( T I = P 0 4 ( l - T 1 A 3 + 3 * P l * T 4 ( I - T 1 A 2

8 ! + 3 * P 2 W ' 2 * ( 1 - T ! + P31T")

9 I N h e r e " . d e n o t e s ' r a i s e d t o t h e p o w er . '

1 0 I T h e a b o v e e q u a t i o n c a n b e r e w ri t t e n a s :

l l ! pm = T *( TI (T tP 3 + P2 'I +P I1 +P fJ 'l

1 2 w h e r e P O = P O , P I = 3 I ( P I - P 0 1 , P " 2 ' = 3 1 [ P 2 - P I I - 3 f ( P l - P O l )

1 1 I a nd P 3' = P 3- PO -3 f( Pl -F 'O I.

1 4 F OR TH D EF IN IT IO NS

1 5 - - }

S C R • 4 3

o I B e zi e r C u rv es c o nt ' d

( I n t h e f o l l o w i n g c o d e c o n t r o l p o i n t s P O . .. P3 N i l l b e

2 Ir ef e re n c e d a s I , Y p ai r s i n t e rl s o f t h ei r c o rr e sp o nd i n g

. 3 !. n as es , F o r exasp l e , P 2 w i l l r e f e r t o X2,n . T o

f ac i l i t at e t h is t h e f o ll o wi n g o pe r at o rs a r e d e fi n e d.

5 : P @ A D D R E S S O F X - - - X , Y ) D U P @ S W A P 2 + @ ;

6 : P ' X , I , A D D R E S S O F X - - - ) R O T O V E R ' 2 + , ;

7: P + ! XO ,'iO ,n ,iI --- X O + X l , Y O + Y I R O T + R O T R O T + S W A P ;

8 : P - ( X O , Y O , X I , Y I - - - I O - X l , Y O - Y ! )

9 R O T S W A P - R O T R O T - S W A P ;

1 0 : P I I X , Y , N - - - N X , N Y ) R O T O Y E R ' R O T R O T . ;

I I : P I ! ! l ,t ,M ,N - -- M I/ N, Mi IN I

1 2 R O T ) R O Y E R O V E R > R > R I I I M f X i N j

1 3 R > Ri P > S W A P 1 / I M f Y / N ) ;

1 4 - - >I~

S C R • 4 4

o I B e zi e r C u r ve s c o nt ' d

1 ( P o i n t o pe r at o rs c o n t i n u ed

2 : P D U P I X , 1 - - - X , Y ,:i ,V ) O Y E F : O V E R ;

3 : P S W A P ( , X O , Y O , X l , Y l - - - X l , Y l , ~O , T ' O

> R R O T R O T R) R O T R O T ;

5

6 S t o r ag e f o r c o nt r ol p o in t s P f J. . . P 3 I

7 V AR I AB L E P O 2 A L L O T ( I O , 1 0 i Y AR IA B LE P I 2 A L L O T ( I l , Y I )

B V A RI A BL E P 2 2 A L L O T ( X 2 , 1 2 1 V A R I A B L E P 3 2 A L L O T I X 3 , Y 3 1

9 I S t o r a g e f o r . e d i f i e d p o i n t s P O . . . P3 I

1 0 V A R I A B L E P O ' 2 A L L O T Y A R I A B L E P I ' 2 A L L O T

1 1 Y A R I A B L E P 2 2 A L L O T Y A R I A B L E P 3 ' 2 A L L O T1 2

1 3 V A R I A B L E N I N U l t e r o f l i n e s e g ll e n t s i n c u r v e)

1 4 V A R I A B L E N . SC 3 N . S C ' ( S c al e f a c t o r f o r N c a l c u l a t i o n

1 5 - - )S C R • 4 5

o I B e z ie r C u r v e s c o n t ' d )

I i C O l p u t e sodi+i e d p o i n t s P O ' . . P3 ' f r o l c o n t r o l p o i n t s P O . . P 3

2 : C O M P U T E . P ' P I P @ P O P @ P - 3 P I ( 3 [ P H O I i P O U P

3 P 2 P @ P I P @ P - 3 P I i 3 [ P 2 - P J I ) P D U P

P 3 P @ P O P @ P - I [ P3 - P ( 1 ) P S ! r I A PP -

p~ P ' P S ~ A P p. P 2 P ' P I P ' P O P @ P O ' P ':

J

6

7 A f e w u t i l i t i e s f o r h an d l i n q /d e f i n i n q c o n t r o l p o i n t s

1 / 2 5 / 8 3 )

8 ( D e fi n e c o nt r ol p o in t s)

9 : S T O R E. P O I N TS I P O, Pl , P2 , P3 - --

Ill) P 3 P ' P 2 P ' P l P ' P O P ' ;

II I D i s p l a y c o n t r o l p o i n t s at C R T I

[? . L I S T . P O I N T S C R P O P @ . . Pl P @ . . P 2 P @ • • P 3 P @ • . C R1 3 ( D i s p l a y c o n t r o l p o i n t s o n g rap h i c s sc r e e n I

1 4 S H O W . P O I N T S P O P @ T D O T P l P @ T O O T P 2 P @ T D O T P 3 P @ I D O T ;

1 5 - - >

S C R • 4 6I) I B e zi e r C u rv es c o nt ' d

1 I M o v e c u r s o r t o s t a r t c i f c ur v e I

2 : M O V E . T D . P O P O P @ T M O Y E ;

3 ( L o ad _ od i f i e d c o n t r o l p o i n t s o n t o st a c k )

4 : L O A D . P O I N T S P O ' P @ P I ' P @ P 2 P @ P 3 P @ ;

5 ( C o _ p u t e p o i n t o n c u r v e g i v e n c o n t r o l p O i n t s a n d

6 ( p a r a m e t e r, T , w he re 0 ( = T ( = N .

7 : pm I P O ' , P I ' , P 2 ' , P 3 ' , T - - - H l l )

8 3 0 l iD D U P ) R N @ F'fi P + P i L O OP D RO P

9 I C O l l p u t e t h e n U l b e r o f c u r v e s e g ft e n t s b y f i n d i n g t h e1 0 ( d i s t a n c e f r o l P O t o t h e l i d p o i n t o n t h e c u r v e .

I I T h e n U l b e r o f se g . e n t s e q u a l s t h e l a r g e r o f d e l t a Io r

1 2 I d e l t a Y , N i t h a l i n i l u M o f 3 a n d a l a l i l u l o f 5 0 .1 3 F I I . N L O A D . P O I N T S 2 N ' I P [ T I ( c o l p u t e m i d p e i n t I

1 4 P O P @ P - A B S S W A P A B S M A X ( s e l e c t l a x i . u . f r o . X o r

1 5 N . S C @ 1 3 M A X ( ai n o f 3 ) 5 0 M I N ( Il~X o f 5 0 ) N '; - -

S C R • 4 7

I) IB e z i e r C u r v e s c an t d

( D r a w a B e z i r c u r v e)

2 : C U R V E N @ I t I D O L O A D . P O I N T S I P ( T I T D R A W L O D P

4 : B E Z I E R C O H P U T E . P F I I . N H O V E . T O . P O C U R V E ;

6 ! T o u se t h e ab o v e d o t h e 1 0 1 1 0 w i n Q :

7 I s t e p I - d e f i n e c o n t r o l p a i n i s u s i n g S T O R E . P O I N T S i

8 s t e p 2 - e ~e cu te B EZ IE R

9 T h e c u rv e qene r s t ed w i ! I p a s s t h r o u g h t h e t w o e n d

10 ( p o i n t s P O a n d P l . T h e c u r v e w i l l l e a v e poin t P O w i t h : .

1 1 i. di r e ct i on d ef in ed b y a l in e c o nn e ct i ng P O a n d P I, an d I

1 2 I w i! 1 ap p r o a c h P 3 w it h d i r e c t i o n d e f i n e d b y a l i n e

1 3 c o n n e c t i n g P2 a n d P l . C o n t r o l p o i n t s P I an d P 2 ar e

1 4 I n o t o n t h e c u r v e b u t t h e y d o h e l p d e t e r . i n e t h e

1 5 i sh a p e o f t h e c u r " e. ) ;3

Listing 2. Bezier Application . Line Drawings

47o. 7 0 - M a r c h 1 9 8 4

S C R • 35

o I B e z i e r C u r v e A p p l i c a t i o n : L i n e D r a w i n g s 1 1 4 1 8 3

I B y R . H . Irupin

2 ( C O l l a n d s f o r Q e n e ra t l n Q l i n e d r dw in Q s:I B - D r a w a c ur v e s~ gm e nt [ Dat a: ' P O, PI , P2 , P3 1

4 ( C - D r a w a c i r c l e [ D a t a: X , I , H A D I U S I

5 D - P l at d d o t ( D a t a : !,iI

6 ! E - E n d o f f i g ur l ? ( D a t a: none l

H - S e t c o l o r ( D a t a : C O L O R I

8 L - D r aw a l i n e [ ii a t a: X O , l O , X I , Y l l

9 ( N - R e ad a n o t h e r d i sf : hl o ck [ Da t a : a u : N O . 1

1 0 R - D r a w a r e c t a n g l e [ D at a : B A S E , H E I 6 H T I

1 1 ( I-C l e a r s c r e en [ Da t a : n o ne l

1 2 4 2 L O A D I L D a d B e zl e r a n d g ra p h ic s ) 6 0 L O A D ( L o ad C A S E )

1 3 ( C o n st a n t s f o r c O I . a n d r e f e r e n c e ) 6 6 C O N S T A N T = B

1 4 6 7 C O N S T A N T = C 6 8 C O N S T A N T = 0 6 9 C O N S T A N T = E 7 2 C O NS T AN T = H

1 5 7 6 C O N S T A N T = L 7 8 C O N S T A N T = N 8 2 C O N S T A N T = R 8 8 C ON ST AN T = 1- -)

M I C R O

Page 50: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 50/86

SC F : • 3 6

! L i n e D r a w I n g s c o n t d R H T : l t 4 i 8 3 1

I W o r ds t o se rv ic e c O . ~d nd s I

: D A T A I R e ad w o r d f r o l d at a; c o n v e r t t o n U M b e r o n s t ac k . I

3 2 W O R D N U M B E R D R O P ,

I L o a d a b l o c k o f d at a f r o i d i s k ; p r i n t h e a d e r )

: R E A D . B L K ( B L O C K N O . - - - ; D U P S C R ~ B LO C K D R O P

6 S C R @ B L K I 0 } [ N I 4 1 N O R D C O U N T T Y P E U 1 M C R ;7 ( C o u a n d B : D r a w c u r v e u si n g B e z ir f un ct io n i

8 : D R A W . C U R VE

9 8 0 D O D A T A L O O P ! r e a d 4 X , V p ai rs , p oi nt s P O, Pl ,P 2, P3 I

1 0 S T O R E . P O I N T S B E l l E R ( D r a w c u r v e I ;

1 1 ( C O i l a n d C : D r a w a c i r c l e )

1 2 : ! ) R A W . C I R C L E D A T A D A T A D A T A T C I R C L E ;

1 3 ' C o • • a n d D : P l o t a d o t I

1 4 : P U T . D O T D A T A D A T A T C O T ; - -

1 5

S C F ~ 1 3 7

o I L i n e D r aw in g s c o nt d

1 ( C O l l an d E : E n d o f d r aw i ng i

2 : E N D . T A S K ' E n d o f f i g u r e . ' A B O R T ,

3 ( C O i l a nd H : S e t p l o t t i n g c o l o r I4 : S E T . C O L O R D A T A C O L O R I ~

R H T: l i 41 8 3 i

~ !. C O l l l a n d L : D r a w a l i n e )

6 : D R A W . L1~E-r 4 0 D O D A T A L O O P ( g et X O , l ' I ) , X l , i 1 I

B T M O V E T D R A W \ d r a w 1 i n e I ,

9 ! C O l l a n d N : R e ad n e l t b l o c k o f d at a I

1 0 : N E I T . D A T A D A T A R E A D . B L k ,

1 1 I [ ol il ian dR : D ra w a r e c t a n g l e )

P . D R A W . R E C T A N G L E D A T A D A T A T R E C T ,1 3 - - : ,

1 4

1 5

S C R 1 3 8

o I L i n e D r aw in g s c o n t ' d

1 I C O l l an d X : C l e a r t h e s c r e e n )

2 : C L R . S C R E E N C L E A R ,

R H T : 1i4i83)

3 I C al la nd e x e cu tI o n I

4 : E X E C . C O M M A N D I C O M M A N D - - - )5 C A S E = 8 O F D R A W . CU R V E

6 = C O F D R A W . C I R C L E

7 = D O F P U T . D O T

B = E O F E N D . T A S K

9 = H O F S E T . C O L O R

1 0 = L O F D R A W . L I N E

1 1 = N O F N E X T . D A T A

1 2 = R O F D R A W . RE C T A N G L E

1 3 = X ( )F C LR . S CR EE N

1 4 " B a d d a t a i n bl o ck '

1 5 E N D C A S E , - - >

E N D O F

E N D O F

E N D O F

E N D O F

E N D O F

E N D O F

E N D O F

E N D O F

E N D O F

• B L K @ C R A B O R T

S C R 1 3 9

o !L i n e D r a w in g s c an t d

1I.

G e t c O l l l a n d f r o l d at a; l e a v e o n st a c k ,2 : R E A D. C O M M AN D ! C O M M A N D A D D R . - - - C O I 1 M A N D )

R H T : l t 4 i 8 3 1

3 3 2 W O R D C O U N T D R O P @ 2 5 5 A N D ;

5 ( W o r d t o d r a w f i g u r e u s i n g d a t a s t o r e d o n d i s k i

6 : F [ 6 U R E I B L O C k N O . - - - i

7 R E A D . B L K I L o a d i n f i g ur e d a t a f i l e )

B B E G I N I. D r a w u n t i l e n d o f f i g ur e c a l l a n d )

9 ? T E R M I N A L I F A B O R T T H E N ( T e st f o r o p e r at o r a b o r t )

1 0 R E A D . C O M M A N D

1 1 E X E C . CO M M A N D 0 I F a l se f l a g t o c o n t i n u e I

1 2 U N T I L ,

1 . 3 ; 5

1 4

48 MICRO

Listing 3. Example Line Drawing Data File

S C R # 4 0

o I L I N E D R A W I N G D A T A : P O R K Y P I G ) X H 1

1 B 9 0 3 8 1 3 5 2 3 1 7 5 5 5 1 5 0 1 0 2 B 1 3 7 1 0 0 1 5 5 9 5 1 7 0 1 3 5 1 1 0 1 3 5

2 B 1 1 0 1 3 5 4 5 1 3 5 5 3 B 5 7 0 5 5

3 B 7 5 6 5 6 0 5 0 8 0 5 9 0 4 5

4 8 1 3 5 3 7 1 5 5 3 2 I~ B 3 5 1 5 2 5 0

~ B 8 ~ 1 0 5 9 5 1 0 0 1 0 3 9 7 1 0 8 1 0 0

6 B 1 0 5 1 0 3 1 0 9 1 0 0 1 1 0 1 0 0 1 1 3 1 0 0

7 B i l l 1 0 8 1 1 7 8 5 1 4 0 8 5 1 3 3 1 0 8 L 1 1 1 1 0 8 1 3 3 1 0 8

a B 1 3 3 l O B 1 2 5 1 3 0 1 0 3 1 3 0 1 1 0 1 1 3 L 1 1 0 1 1 3 1 3 0 1 1 3

9 B 1 1 0 1 1 9 1 1 2 1 1 7 1 1 3 1 1 7 1 2 0 1 2 01 0 B 1 1 8 1 1 8 1 2 2 1 1 7 1 2 3 1 1 7 1 2 7 1 1 9

1 1 B 1 0 0 9 8 1 1 5 6 5 1 2 2 7 0 1 1 3 1 0 0 8 1 0 8 9 7 1 1 5 B 5 1 1 7 B 5 1 1 3 1 0 0

1 2 B 1 3 3 9 5 1 4 5 7 0 1 4 8 1 5 1 4 2 9 8 B 1 3 5 9 9 1 4 3 B B 1 4 5 8 8 1 4 2 9 8

1 3 H 1 5 D 4 0 1 5 R 16 5 13 5 N 4 1

1 4

1 5

S C R • 4 1

o ( P O R K Y P I G C O N T I N U E D ) H 6

1 C 5 5 1 6 0 5 L 5 0 1 5 5 5 0 1 7 0

2 C 7 0 1 6 5 5

3 L 8 0 1 6 0 8 0 l7!) B 8 0 1 6 . 3 8 4 1 6 0 8 6 1 6 1 ) 9 0 1 6 2

4 L 9 5 1 5 5 9 5 1 7 0 L 9 5 1 6 3 1 0 3 1 5 7 L 9 8 1 6 2 1 0 3 1 7 1 )

5 B 1 1 0 1 6 0 1 1 0 1 7 5 1 2 0 1 7 5 1 2 0 1 6 0

Ii 8 1 2 0 1 6 0 1 2 0 1 8 0 1 1 0 1 8 0 1 1 0 1 1 27 C 1 5 0 1 6 0 5 L 1 4 5 1 5 5 1 4 5 1 7 0

8 L 1 6 1 ) 1 6 3 l b O 1 7 0 C 1 6 0 1 5 7 2

9 C 17 0 1 6 5 5 B 1 7 ~ 1 6 0 1 7 5 l B O 1 6 5 1 8 0 1 6 5 1 7 2 E

1 0

1 1

1 2

1 3

1 4

15

SOPHISTICATED TELE-COMMUNICATION IS HERE

THE COMMUNICATORfor 4.0 Commodore Computers

JIM STRASMA'S REVIEW:

"THE BEST TERMINAL PACKAGE I'VE SEEN YET"

By April 1 (maybe sooner) It Will Be Even Better

SPEEDS UP TO 9600 BAUD

XON - XOFF

TRUE CTAL KEY (we do OUf own keyboard scan)

THE HARDWARE - A pr inted circuit board; easily installed in the CBM. It uses

no CBM connecto~ gives a serial port with tr ue RS232C standar d.

THE SOFTWARE -_ Emulates the ADDS Regent lOa, ADM 31 andlor the

TeleVldeo950.1 Or choose the VT100 model for use wi th DEC and VAX.

computers._ Runs coresident with BASIC programs; lets BASIC

programs and program on hos t compu ter communicate to deve lop rear -

Iy sophist icated communication and control capabil it ies.

_ The program is on ROM at either address; no disk loadingrequired. Uses only 512 bytes of RAM; wil l relocate i tsel f a round any other

mach ine language p rog ram a t top o f memory.

- Will upload and download and run BASIC programs. With BASIC

p rogram wi. upload and download s tanda rd data f il es. 100 page manua l

gives program l is ti ng for BASIC p rograms .

Excellent text editor designed to work with THE COMMUNICATOR

THE COMMUNICATOR $200

Text Editor $40

1200 baud modems beg inn ing at low , low $385, and even less when purchased

with THE COMMUNICATOR

AMPLIFY, INC.2325 Macbride, Iowa City, Iowa 52240 319-337-83781 tr ademarks Adds Regent. Inc., Lear Liegler. I nc . • Te:evideo S~tems, Inc.

No. 70· March 1984

Page 51: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 51/86

Whenyoleast expect it,

•••Ina few mill ionths of a second, common electrical surgesand spikes

can enter your data processing equipment and cause memory loss,false logic and misregistration. Surges very often do permanent

damage to microcircuitry.

FUX l DUCT Surge Suppressors catch surges and spikes before they

have a chance to enter your equipment In billionths of a second

(Nanoseconds),FUXlDUCT Surge Suppressors dissipate surges and

spikes from any side of the line (most protect only one side).

The multi-outlet unit is ideally suited to the computerized work-

station. It givesyou the advantage of circuit breaker protection with

plenty of outlets for data processor and peripheral equipment

No computer should bewithout the protection of a FUX lDUCT Surge

Suppressor...cspccialtr yount Write or call for further information.

Available from office products retailers.

® Surge Suppressorsa product of Winders & Geist, Inc. P.O. Box 83088 Lincoln, NE68501 402/474--3400

No. 70 - March 1984 MICRO

!

" I9

Page 52: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 52/86

PEEKing TomPlaying with

BASIC'sInternals

by Mark Johansen

A few simple techniques to help find how and where things

are done within almost any system

One thing that I enjoy about

microcomputers is that noone minds if

you mess with the system internals:

unlike a large mainframe, where any

disruption to the system may affect

hundreds of people and cost the

company a lot of money, on a micro the

only one you can really hurt is yourself,

and if you do it's generally your own

fault. In fact, most of the micros on the

market today come with a BASIC

interpreter that includes a PEEK

function and a POKE statement. It is

hard to think of a feature which could

be handier to someone interested in

seeing just how the system works and

occasionally taking advantage of such

internals.

I am using an IBM PC at work and,

much to my disappointment, none of

the manuals that I have for it say much

of anything about where the system

keeps its variables or how BASIC

programs or data are actually stored in

memory. However, I managed todevise

a few simple techniques tohelp me find

50

how things were done. While I will use

the IBM PC as my reference point, the

ideas I discuss here should be

applicable to almost any micro having

PEEKs and POKEs. For this reason, I

will avoid using any statements or

formats in my sample programs that

are not likely tobe found in almost any

version of BASIC (such as NEXT

without a variable, multiple

statements per line, the PC's DEFSEG,

etc.).

[Ed. Note: These mini - programs and

techniques are really very easy to adapt to

other micros. I used them on the Apple,

Commodore and running 6809 Flex BASIC. J

Finding A Program

A logical place to start is with finding

our program. It is extremely unlikely

that the operating system will actually

place our program at the beginning of

memory; it probably has data it needs

for itself there. But what we can do is

MICRO

write a short program that will look

through memory searching for itself.

How will it recognize itself when it

finds it? If we knew exactly how the

system stored our program in memory

this would be no problem: we would

just look for a string of bytes which

matches the first few bytes of our

program. But even if we do not know

this, there is one thing we can be

reasonably confident will be

recognizable, namely, text such as in a

PRINT statement.

Consider the following:

Program 1

1 0 P R IN T 'F IN D IN G M Y S E L F A T :"

2 0 F O R 5 = 0 T O 1 0 0 0 0

3 0 C l $ = C H R $ ( P E E K ( S l )4 0 I F C l $ < > ' F ' T H E N 9 05 0 C 2 $ = C H R $ ( P E E K I S + l ) )6 0 I F C 2 $ ( } " I " T H E N 9 07 0 P R IN T " FO UN D M YS E L F A T " ;S

9 0 N E X T S

1 0 0 E N D

No. 70· March 1984

Page 53: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 53/86

This program will search through

memory looking for every occurrence

of the letters "FI", the first two letters

of the printed text string, and printing

out the address of each occurrence.

[The 10000 in the FOR statement is a

reasonable amount of memory to

search and is likely to contain your

program. If you cannot get a hit and you

have more than 10,000 bytes ofmemory, you might increase this

number. If the program keeps running

for a long time after it has found itself,

you may just break it and not worry

about looking any further.) If there is

more than one fine, there is probably

just another place in memory that

contains those two characters by

coincidence. We simply change the

program to check for more letters

before reporting a success. When we

have narrowed it down toone we have

found our program. Of course,the real

start will be a few bytes before this, asthe line number, the keyword PRINT,

and possibly some control information

must precede the text string.

You might try putting in programs

of different lengths (just tack some

useless lines on the end), adding more

variables, starting with different things

on the screen, running with and

without any memory expansions you

might have and so on, to see what, if

anything, changes your program's

location.

Finding the Program Start Address

While we may find it amusing to see

where our program begins, it is

imperative that the operating system

be able to find it if it hopes to do

anything meaningful when we type

"RUN". It is, therefore, very likely

that it keeps track somewhere of what

our program's actual start address is. If

we knew where this value was stored,

we could save ourselves the trouble of

having to look for our program every

time and simply pick the number up

from the same place that the operating

system gets it.

How might we find it? We could

cheat and look in the manual, but then

it's always possible that the manual

doesn't say. A more interesting

approach would be to search for our

program as above, finding the address

at which it begins, and then search

through memory for a location

containing this address. This location

is likely to be the system's start-of-

program variable.

No. 70 - March 1984

There are two points that must be

dealt with. First, Program 1 does not

find us the actual start address, but

rather something a little ways after

that. We can get around this by simply

looking for an address which is slightly

before the address we found for our

PRINT text. Second, we must consider

how the computer actually stores

addresses internall y. Themicroprocessors that I am familiar with

(8088, 8080/Z80, 6502) all store

addresses in two bytes with the first

byte containing the last eight bits of the

number and the second byte containing

the first eight bits. We can pick up such

a number in a BASIC program by

coding PEEK(A) + 256*PEEK(A + 1)[where A contains the address of the

first byte of the number). Itis possible

that your computer stores addresses

differently, in which case you would

have to adjust line 220 in the program

below. If you don't know how yourcomputer stores addresses, just try it as

I have it and see what happens.

[Ed. Note: The 6800 and 6809 are

exceptions. They store the address with the

high eight bits in the first byte and the low

eight bits in the second byte.]

Program 2

1 0 P R I N T ' F I N D I N G M Y S E L F A T : "2 0 F O R s = o T O 1 0 0 0 03 0 C I $ = C H R $ ( P E E K I S ) )

4 0 I F C I $ ( ) ' F " T H E N 9 05 0 C 2 $ = C H R $ ( P E E K ( S + I ) )6 0 I F C 2 $ ( } " I " T H E N 9 07 0 P R I N T ' F O U N D M Y S E L F A T ' : S8 0 S O T O 2 0 0 .Q O N E X T S

1 0 0 E N D2 0 0 R E M L O O K F O R S T A R T A D D R E S S2 1 0 P R I N T2 2 0 F O R P = O T O 1 0 0 0 02 3 0 A = P E E K I P ) + 2 5 6 * P E E K ( p t l )2 4 0 I F A < S - I O O R A > S T H E N 2 6 02 5 0 P R I N T P ; ' C O N T A I N S " ; A2 6 0 N E X T P2 7 0 E N D

If you get several "hits", see which

one looks most likely and play with it a

bit. You might try doing PEEKs at the

addresses of these variables and seeing

what's there. Running this on the PC

gave me two hits: one at location 48

and another at location 862. A little

examination showed that location 48

contains the start address. [We'll get

back to what is in 862 later.)

MICRO

Dumping a Program

Now that we have found where the

program is kept, wemight try dumping

it out to see how it really is stored

internally. All we have to do is start at

the address we found above and dump

the next hundred bytes or so. To help

us discern what each byte is as it is

dumped, we can print it as both anumber and a character (the first we get

directly from the PEEKstatement, the

second we can get with the CHR$

function). On the IBM PC the program

start address is stored at locations

48-49, so I will use that location in the

program below. You would, of course,

have tosubstitute the appropriate value

for your computer here.

[Ed. Note: The Commodore 64 uses

locations 43 and 44 - but you know that

from Program 2. The examples have been

modified to use this address. To change toanother micro, simply re - define X and Yin

line 10. The values would be 48 and 49 for

the IBM PC.!

Program 3:

1 0 X = 4 3 : Y = 4 42 0 S = P E E K I X ) + 2 5 6 f P E E K I Y )3 0 P R I N T ' S T A R T I N G A D D R E S S : ' ; S1 0 0 R E M S T A R T D U M P I N G1 1 0 F O R A = S T O S + l O O1 2 0 C = P E E K t A )1 3 0 P R I N T C j " ( " ; C H R $ ( C ) j " ) " j

1 4 0 N E X T A1 5 0 E N D

The output of this program will not

look much like a BASIC listing, and

not just because of those numbers

stuck in there. Though variable names

and the text within PRINT and REM

statements should be recognizable,

that may be just about it.

There are several ways in which

BASIC's commonly code their

statements. Rather than store

keywords such as PRINT or CHR$ as

several characters, most BASIC

interpreters use codes from the

character set that are not used for any

of the regular letters, numbers, or

symbols. There one-byte codes are

referred to as "tokens". You should be

able to quickly identify what token

your computer uses for PRINT by

looking at what comes before the

recognizable text, to figure out other

tokens you should study the context in

a similar fashion and find something

that looks consistent. We'll get back to

51

I

I[

Page 54: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 54/86

looking at tokens in a moment.

Some BASIC's store numbers as

strings of digits: if this is the case with

your computer they should be easily

recognizable. Others store numbers in

binary, which will force you todosome

conversions if you want to be able to

read what is there.

A particularly interesting thing to

look for is what your BASICputs at the

front and end of each line. The BASIC's

I have seen all use a zero byte to mark

end-of-line, and have the line number

in binary at the front. Most also put a

link in front of the line number: a two-

byte field which holds the address of

the start of the next line.

Once you have an idea of how your

programs are stored, you might try

making the dump more

comprehensible. For example, you

could determine how to find where a

new statement begins and print your

dump of each statement starting on anew line. This makes it much more

readable.

{Ed. Note: 1 took Mark's suggestion and

wrote the [ollowitig program that dumps

lin~s of BASIC. If the value is a printable

ASCII character (range 32 to 127), then it is

printed as a character. Otherwise, it is

output as a decimal value in parentheses.

These values would be the tokens. The C64

version uses some of the color and reverse

features to make a more readable display. X

and Y point to the program start found in

the earlier ptogtams.]

Tokens

It might be entertaining to try to get a

complete list of all of our BASIC's

tokens. We could do this by writing a

program that includes every single

BASIC keyword and then dumping it

out, but there is an easier way: we can

let a program construct every possible

token and then LIST them to tell us

what they are. We begin the program

with a dummy line consisting of only

one token: REM. When we RUN the

program this will, of course, do

nothing, but the program will then go

back and change the REMtoken, tell us

what it changed it to, and then LIST

that line to show us what keyword that

token corresponds to.

(Ed. Note: Mark's IBM PC version was

changed to use the C64 teietences.]

P rog ram 4

1 0 R E M2 0 X = 4 3 : ' 1 = 4 43 0 S = P E E K I X ) + 2 5 6 * P E E K ( Y )4 0 T = S + 42 0 0 R E M C H A N S E T O K E N A N D L I S T2 1 0 V = 1 2 92 2 0 P O K E T , V

2 3 0 P R I N T Y2 4 0 L I S T 1 02 5 0 V = V + I2 6 0 6 0 T O 2 2 0

The program should print out the

number 129 followed by a listing of line

10: the number 10 and then the

keyword corresponding to the token

129. For the PC this comes out

129

10 END

Unfortunately, on the PC at least,

this is all it does.

{Ed. Note: This works for the Apple 11, but

not the C64.}

The problem is that the program ends

once it finishes the list statement

rather than going on toexecute the next

instruction and looping around. If you

do not have this problem, count your

blessings. For those of you who do,

there are two ways we might overcome

this. One way is to simply type GOTO

250 after each token is listed toget the

next one. [Note: if you type GOTO 250the variables will probably be left as

they were when the program finished;

if you type RUN 250 they will more

than likely be cleared and you will end

up poking the number one into location

zero.J Another possibility is to put

several dummy REM statements at thefront of the program, poke token values

into each of them, and then LIST. We

will have to know where to do the

POKEs, of course. Just as we knew

where toput the first one by adding the

number of bytes preceding the first

token on a line to the program start

address, we can find the others by

adding the number of bytes in each line

to the place where we did the last poke

and looping along. For the IBMPC, the

length of each line is 2 for the link plus

2 for the line number plus 1 for the

REM token plus 1 for the end-of-linemarker fa null}, which gives 6. This

number is used in line 230.

P ro gram 4b

1 0 R E M2 0 R E M3 0 R E M4 0 R E M5 0 R E M6 0 R E M7 0 R E M8 0 R E M9 0 R E M

1 0 0 X = 4 3 : Y = 4 41 1 0 S = P E E K ( X ) + 2 5 6 f P E E K I Y )1 2 0 T = S + 42 0 0 R E M C H A N S E T O K E N A N D L I S T2 1 0 F O R V = 1 2 9 T O 1 3 72 2 0 P O K E T , V2 3 0 T = T + 62 4 0 N E X T V2 5 0 P R I N T " 1 2 9 - 1 3 7 : '2 6 0 L I S T 1 0 - 9 0

B AS IC D ump C 64 B AS IC D ump

1 0 X = 4 3 : Y = 4 4

2 0 S = P E E K I X ) + 2 5 6 f P E E K I Y )3 0 P R I N T " S T A R T I N G A D D R E S S = " ; S1 0 0 R E M S T A R T D U M P I N G1 1 0 F O R 1 = 1 T O 1 01 2 0 P = P E E K I S ) + 2 5 6 f P E E K ( S + I ) : P R I N T P ;1 3 0 Q = P E E k ( S + 3 ) f I 0 0 + P E E K I 5 + 2 ' : P R I N T Q ;

14 0 5 = 5 + 31 5 0 S = 5 + I : R = P E E K I S )16 0 I F R } 3 1 A N D R ( 1 2 8 T H E N P R I N T C H R $ I R ) ; : G O T O1 7 0 I F R < > O T H E N P R I N T " ( " ; R ; " ) " ; : S O T O 1 5 01 8 0 P R I N T : S = 5 + 1j 9 t ) N E X T I

2 0 0 E N D

52

1 0 X = 4 3 : Y = 4 42 0 5 = P E E k I X ) + 2 5 b * P E E K ( Y )3 0 P R I N T · S T A R T I N G A D D R E S S = " : 51 0 0 R E M S T A R T D U M P I N G1 1 0 F O R 1 = 1 T O 1 01 2 0 P = P E E K ( S ) + 2 5 6 f P E E K ( S + I ) : P R I N T ' ( R E D } " P ;1 3 0 Q = P E E K I S + 3 ) f I 0 0 + P E E K I S + 2 ) : P R I N T " { B L U E } " Q " { B L A C K } " ;1 4 0 S = 5 + 31 5 0 S = S + I : R = P E E K ( S )

1 5 0 1 6 0 I F R > 3 1 A N D R ( 1 2 B T H E N P R I N T C H R $ ( R ) ; : 6 0 T O 1 5 01 7 0 I F R < ) O T H E N P R I N T " { R Y S } " R " { R V S O F F } ~ ; : G O T O 1 5 01 8 0 P R I N T : S = S + 11 9 0 N E X T I2 0 0 E N D

MICRO No. 70 - March 1984

Page 55: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 55/86

By the way, if you try to run this

program a second time, it is not likely

to work, as you have changed the first

few lines, most likely into syntax

errors. You will have to re-enter the

dummy REMs before you try to re-run

lor you could cheat and say RUN 100).

This program will tell us what the

tokens 129 through 137 correspond to.

If we want to get the full list, we could

either add more dummy REMs and

enlarge the loop, or we could simply

run it several times, changing the

boundaries of the loop each run.

If you are wondering why I chose

the number 129 to start with, it is

because that begins the second half of

the character set (1 /2 • 256 possible

character codes in an 8-bit byte + 1=129) and therefore seems a likely

place to include tokens. The first half

most likely includes your alphabet,

digits, and other printable symbols.

You might try running Program 4b

using V values less than 129 and see

what you get.

[Ed. Note: I am not sure why Mark did not

start at 128. This is a valid token on the

Apple, C64 and Flex BASIC. It may be

different on the IBM PC}

One final problem you may have to

deal with: on the IBM PC, some of the

tokens really take two bytes, a 255

followed by something else. Also, some

tokens mean that what follows is a

number of some kind (onebyte integer,

two byte integer, GOTO address, etc),which therefore logically requires that

something follow before the end of the

line. In there cases, the above program

will result in the beginning of the next

line being "eaten" to satisfy the

requirement for extra bytes, and from

there on everything is a mess. If you

run into this situation, simply put a

few extra characters on each dummy

statement. (And remember to change

line 230 tokeep your POKEs landing in

the right place!)

Another System Variable: TheDATA Pointer

The problem that originally led me to

work on examining system internals

was a BASICprogram I was working on

that included many, many DATA

statements. My program logic was able

to spot certain types of errors in the

data, and I wanted it to print messages

saying what was wrong and where it

had found the problem. The best way to

say "where" would be to give the line

No. 70 - March 1984

number. Thus, I wanted to find where

the system kept track of what data line

it is looking at.

For the IBM PC, surprise! We get

location 862, our old friend from

looking for start of program. When we

were not using any DATA statements,

it pointed toone byte before the start of

the program. Evidently that is where it

begins life before the first READ is

executed.

Of course, what I really wanted for

my original program was the line

number, not the address, but this can

be found by simply tracing through the

links at the start of each line. When we

find the first line with a link which

contains an address larger than the data

pointer, it follows that the pointer

must be aiming somewhere in the

current line. We then pick up the line

number and we've got it.

Final Words

Other interesting things to look for are

your memory-mapped video, your own

BASICvariables, and the system clock.

I could go on demonstrating exactly

how I found a couple of other system

variables, but I think the technique

should now be clear: whatever it is you

may be looking for,do something

which will set it equal to a value you

can calculate or predict yourself, then

search through memory for a location

containing that value. If you find more

than one, try to set up a differentpredictable value and doit again. If you

do not find any, either you have made a

mistake somewhere or the system does

not keep any such value.

Do not be fooled by coincidences!

When I was first looking for my DATA

statements, I looked for a location

containing the line number rather than

the address. The PC does not keep any

such value, but I found one anyway. No

matter what line I had my READs

reaching, location 823 would always

contain the line number, but when I

tried to use it in a program it did notwork. It turned out that what I was

finding was some work area in which

the system had placed my line number,

probably preparatory to doing the IF

test.

In general, it is wise to try things

out in a small program before spending

a lot of time working from a faulty

assumption. Which statement could no

doubt be applied in many other

contexts.

The technique we use is very

MICRO

similar to the way in which we found

the pointer to the start of the program.

We set up a DATA statement and

execute a READ, so that the data

pointer should now be pointing into

our DATA line. We than search

through memory for any location

containing a value near the beginning

of the program. We could determine

the exact value to look for if we would

take the time to dump the program and

see just where everything falls, but we

would still have to worry about

whether the pointer would be at the

last digit of the number just read, the

comma, or the first digit of the next

number, sowe may just as well be lazy,

put the DATA statement near the front,

and figure that those lines can't take

more than 25 bytes or so. Thus:

Program 5

1 0 R E A D X2 0 D A T A 3 4 , 2 4 , 3 6

1 0 0 S = P E E K ( 4 8 ) + 2 5 6 f P E E K ! 4 9 )1 1 0 F O R p = o T O S1 2 0 S I = P E E K ( P ) + 2 5 6 f P E E K ( P + I )1 3 0 I F S I ( = S O F S I } S + 2 5 T H E N 1 5 01 4 0 P R I H T P ; ' C O H T A I N S ' ; S I1 5 0 N E X T P1 6 7 0 E N D

[Ed. Note: rust for fun, I wrote the following

program to print all of the tokens on the

C64. S is the address of the first token,

determined by 'fooling around' with Mark's

programs. A sample of the printout is

included.}

1 0 5 = 4 1 1 1 8 : R E M F R O M F I N D T O K E N F O R C 6 42 0 0 P R I N T ' A D D R E S S N U M B E R T O K E N "2 1 0 F O R X = 1 2 8 T O 2 5 52 2 0 I F P E E K I S ) = O T H E N X = 2 5 5 : 6 0 T O 2 6 02 . 3 0 P R I N T S , X , ;

2 4 0 IF P E E K I S ) ( 1 2 8 T H E N P R I N TC H R t ( P E E K ( S ) ) ; : S = S + I : 6 0 T O 2 4 0

2 5 0 P R I N T C H R $ ( P E E K I S ) - 1 2 8 ) : S = S + 12 6 0 N E X T X2 7 0 P R I N T : P R I N T ' E N D O F T O K E N S '2 8 0 E N D

R U N O F P R I N T T O K E N S F O R C O M M O D O R E 6 4

A D D R E S S N U I ' I B E R T O K E N4 1 1 1 8 1 2 8 E N D4 1 1 2 1 1 2 9 F O R4 1 1 2 4 1 3 0 N E X T

•• ••

4 1 3 6 1 2 0 1 R I G H U4 1 3 6 7 2 0 2 M I D $4 1 3 7 1 2 0 3 6 0

E N D O F T O K E N S

53

Page 56: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 56/86

I A l C A O "

by Ralph Tenny

The last column dealt with the AID

and DI A converters of the

/Iconventional" kind. That is, they

used resistor ladders to generate DC

voltages proportional to a binary word.

There are numerous other methods to

make AID and DI A conversions, and

we will discuss some of them this

time. A few AID techniques offer

unique advantages for making special

measurements, and some converter ICs

offer special advantages for low cost

conversion.

The Voltage-to-Frequency (V F )

converter produces an output

frequency proportional to an input

current or voltage. A typical low-cost

unit easily measures the range from .01

volts to 10 volts with a resolution of

.001 V 11mv) and linearity of 1 mv.

That measurement range yields

frequencies between 10 Hz and 10,000

Hz. Note that this corresponds to a

binary resolution of 12 bits at 10 volts.

That resolution in most other kinds of

technology would cost four times as

much. Now for the major disadvantage- each measurement takes a full

second!

There are tricks to compensate for

the slow readings, if your need to. For

example, if you expect to measure a

voltage close to full scale, you can

sample for a shorter period. With a .001

second sample, 10volts input gives 100

counts full scale. The catch is that the

resolution, linearity and accuracy all

degrade in proportion.

If you want to measure small

voltages, you can measure the period

[time between two successive pulses)to quite good resolution, then compute

the frequency. With the original

calibration of 1 Hzlmv, the period for

10mv input would be 100msec. If youuse a peripheral counter in the

computer, this measurement can be

made to 1 usee resolution, or 100,000

counts. Obviously, this method runs

out of resolution at 10 volts input - it

gives 100 counts full scale. Another

caution with period measurement is

that the input voltage must be heavily

5 4

Interface Clinic

filtered or very steady to avoid period-

to-period variations. In general, if an

experiment can be set up with a narrow

range of input voltage, choose either

frequency or period measurements for

the most acceptable results.

Some AID converter technologies

are a mix of analog and digital

techniques. One of the first

technologies to be developed was

single- and multi-slope integrating AID

converters. Figure 1 shows the basic

premise of single-slope integrator

conversion. A linear ramp is compared

against a DC voltage. The ramp is

started at the same time as an

oscillator; a digital counter is allowed

tocount the number of oscillator cycles

which occur until the ramp rises to

equal the input voltage. The count in

-'t---

!. ----

2 : ---

1 ----

0 . . .

FULL SCALE INPU~

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

~ArH' = I r~pl_Il

:5:l0P CDUrnER

Figure 2. Operting concept of a dual-stope integrating AJDconverter. A capacitor is charged by the input voltage for afixed time, then discharged by a reference source. The in-

put voltage is determined by a ratio of charge to discharge

times.

MICRO

No. 70 . March 1984

Page 57: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 57/86

the counter then is proportional to the

DC voltage input. This is quite similar

to the converter proposed in Figure 2 of

the previous column (MICRO #69,

February 1984); the difference is that

we now are using a free-running analog

ramp instead of a digital stair-step

ramp. Also, the count is now in a

digital counter instead of a memory

location.Figure 2 shows the concept of dual-

slope integration used for AID

conversion. During the first half of the

operating cycle, the unknown voltage

is allowed to charge a capacitor for a

known period of time. In the second

period, this capacitor is discharged by a

reference source. The discharge time is

compared to the standard sample time,

and the resulting number is

proportional to the input voltage. If it

takes half as long to discharge the

capacitor as it takes to charge it, the

input is one-half of full scale.

When evaluating AID converters,

several factors need tobe considered. In

past discussions we have studied trade-

offs between accuracy and resolution.

Cost usually is a factor, but the one

parameter which varies most widely is

conversion time. The previous column

discussed the successive

+ L = : : I J --··-·--··-·---1...--------------------.1.1+

( ..•• R R2) i C .: ; : : . . . . ; . - . . .~ . J . .t_..··.:::·- - t - . . ; . R:;

u - ) ~ p~

_ ,,._ --- _c 1 ~.;.~ '----r':>-__; + > . B~-11

P . 1 t · · -4- : I _ . . . r -L . . .. . . . . . . . . . . . . . . . -~ 1/2 .;:;:R,

. • 1 ; ; :: .I J lLO-:'2 . 1 _

VDL1RGE ~S

Parts ListR1,R4,R5,R6 6.8 ohm 1/4watt resistor

R2 2K ohm potR3 820 ohm, 1/4 watt resistorR7 5.6K ohm V 4 watt resistor

Cwrent source LM334 (National Semiconductor)Op Amp TL092 (Ratio Shack 276-1746)

Diodes 1N4148 or 1N914

Transistor General purpose silicon NPNC1 . . . . .. .01 mF capacitor

Figure 3. Simple single-slope integrating AID conveter. It

requires only two 1 /0 lines.

BI10

CUf!!RErn

: s:otJf.!CE

uua't

C64-FORTH/79New and Improved

for the Commodore 64C64-Forth/79'· for the Commodore 64-$99.95

• New and improved FORTH-79 implementation with

ex tensions.

• Extension package including lines, circles, scal ing,

windowing, mixed high res-character graphics and spr ite

graphics. I• Fully compatible floating point package including

ari thmetic, relational, logical and transcendental functions.

• String extensions including LEFT$, RIGHT$. and MID$.

• Full feature screen editor and macro assembler.

• Compatible with VIC peripherals including disks, data set,

modem. printer and cartridge.

• Expanded 167 page manual with examples and application

screens.

• "SAVE TURNKEY" normally allows application program

distribution without l icensing or royalties.(Commodore 64 is a trademark of Commodore)

TO ORDER-Disk only.

-Check, money order, bank card, COD's add $1.65

-Add $4.00 postage and handling in USA and Canada

-Mass. orders add 5% sales tax

-Foreign orders add 20% shipping and handling

-Dealer inquiries welcome

PERFORMANCE MICRO PRODUCTS770 Dedham StreetCanton, MA 02021(617) 828-1209 -ISA

-No. 70 - March 1984

NOW!

FULL POWER ASSEMBLY LANGUAGE!

GET THE VERSATILITY OF INDEPENDENTLY

ASSEMBLED RELOCATABLE SUBROUTINES WITH A

RELOCATING LINKING LOADER

• For use with APPLE DOS TOOLKIT ASSEMBLER REL files

• Relocate and link 1 to 255 REL files into a BRUNable file

• Convenient specification of relocation parameters (outputfire, start address, REL file names, ... ) in text control file

• Comprehensive error reporting and recovery

• Module and entry point memory maps to aid debugging

• Complete with user manual and disk example

• FAST - ten 256 byte REL files done in 30 SEeS

RELOCATING LINKING LOADER W/MANUAL $49.95

MANUAL $ 4.50

ALSO - SECURE SENSITIVE DATA FILES

ENCRYPT/DECRYPT ANY FILE WITHFAST-CRYPTAn efficient assembly language implementation of the DES

(Data Encryption Standard) algorithm for Apple or IBM

FAST-CRYPT W/MANUAL. $34.95

Kiwi Software does NOT copy protect its products.

Send check or money order (N.J. residents add 6% sales tax).

Kiwi Software CompanyP.O. BOX 218M

PLAINSBORO. N.J . 08536

System requirements:

APPLE II , 11+, l ie (or compat ible) DOS 3.3 w(48K

IBM-PC, XT (or compat ible) PC, MS-DOS w/64K

IBM- IBM Corp .; APPLE- App le Computer , Inc.; MS·DOS- Microsof t Corp.

MICRO 55

Page 58: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 58/86

approximation converter. This

technology is the fastest of the lower Listing 1

cost technologies. A typical converter

will complete a conversion in about 50

usee, We just noted that F/V converters

require close to a second tomake a full-

resolution measurement. Integrating

converters can typically make a

conversion in 1110 to 11100 second.

Let's look at some real hardware!

Beginning with this column, some of

our interfacing experiments will be

done on the Commodore 64. There are 0 0 7 Fseveral plug-in peripherals available for 0 0 7 Ethe C64. If you have one, you can make 0 0 7 0the necessary translation from the 0 0 7 Cpinout I will describe to your own

setup.

If you plan to do any O D O Iexperimentation with your C64, you D D 0 3should purchase the Commodore 64 D D 0 4Programmer's Reference Manual. This D 0 0 5book is about an inch think and is D D O b

jammed with crucial assembly- O D 0 7language and hardware information, in O O O Eaddition to a lot of information on D D O FBASIC programming. In the I/O

section you can find pinout

information on the User port.

I made a simple adapter to give easy

access to the C64 User port, and will

use it for all simple interfacing projects.

The major hurdle to building your own

adapter is tofind a connector which fits

on the User port. The User port is a

card edge protruding from the C64 case

at the left rear. You need a PC card edge

connector with double readout (12/24)pins on .156" spacing. Either solder

eyelet or wire-wrap type pins are

acceptable. The part number for one

such socket manufactured by TRW is

251-12-50-171. I cannot find this

connector type in the mail-order

catalogs I have, but it should be

available from electronic parts

distributors. If you don't mind a little

handwork, you can cut up a Radio

Shack #276-1551.

To modify the Radio Shack

connector, use a fine-tooth saw to cut

off both lugs. Preserve one end of the

connector body intact, and count over

13pin positions. Saw the connector off

in the middle of the 13th pin position.

Note that the User port connector has

slots between pins 1-2and 10-11. Cut a

small piece of 1/64" plastic or

fiberboard to fit in between the pins of

the connector at those positions. With

these keys in place, you won't be able

to push the connector on unless it is

properly lined up. NEVER plug or un-

plug any C64 connectors with power

56

f H I S P R O G R A H E X E R C I S E S A S I N G L E - S L O P EA I D C O N V E R T O R N H I C H I S D R I V E N B y T H EC 6 4 U S E R P O R T . I T U S E S T N O 1 /0 L I N E SA N D B O T H T I H E R S T O C O N V E R T A N A N A L O GI N P U T T O A N E Q U I V A L E N T C O U N T S T O R E D I NA Z E R O P A G E B U F F E R .

;

; E Q U A T E S;; P A G E Z E R OD E L Y L O E Q U $ 7 FO E L V H I E Q U $ 7 EC N T L O E Q U $ 7 0C N T H l E Q U $ 7 C;; C I A C O N T R O L L E RB P O R TB D D RT M R A L OT M R A H IT M R B L O

T M R B H I" [ M R A C RT M R B C R

E Q U $ O D O IE Q U $ D D 0 3E G U : $ 0 0 0 4E Q U : $ O D 0 5E Q U $ D O O a

E Q U : $ D D 0 7E Q U $ O D O EE Q U : $ D O O F

C O O O D R S : $ C O O O;

C O O O 7 B S T A R T S E I S T O P I N T E R R U P T SC O O l A O 0 4 L O V U 0 4 L S B F O R T I M E AC 0 0 3 B e 0 4 D O S T Y T H R A L OC O O a A 2 0 1 L D X # $ 0 1 I N I T P O R T L I N E SC 0 0 8 B E 0 3 D O S T X B D D R B I T 0 O U T P U TC O O B A 2 F F L O X U F F I N I T I A L T I M E R B V A L U E SC O O D A I ) 4 1 L D Y 1 $ 4 1 T I M E R B H O D EC O O F A 9 0 0 L D A 1 0 0 S T A R T R A M P , S T O P T I M E RC O i l B D 0 5 D D S T A T ~ R A H I F I N I S H S E T T I N G T I M E R AC O l 4 B E O a D D S H T H R B L O I N I T T I M E R B C O U N T SC O I 7 B E 0 7 D D S I X T H R B H IC O l A B 5 7 F S T A D E L Y L O L O A D D E L A YC O I C 8 4 7 E S T Y O E L V H IC O l E B D 0 5 O D S T A T M R A H I C O M P L E T E I N I T O F T I M E R AC 0 2 1 B C O F D D S T Y T H R B C R S T A R T T I M E R BC 0 2 4 A O O B L D Y l O B H O R E F O R T I M E R AC 0 2 a B D 0 1 D O S T A B P O R T S T A R T R A M PC 0 2 9 a c O E D O S T Y T M R A C R S T A R T T I M E R A

;C 0 2 C 2 C 0 1 O D L O O P B I T B P O R T T E S T F O R R A M P E Q U A L T O I N P U TC 0 2 F 1 0 F B B P L L O O P S P I N U N T I L O O N E

C 0 3 1 8 D O E O D S T A T M R A C R K I L L T I H E R B C L O C KC 0 3 4 8 0 O F D O S T A T H R B C R A L S O T I M E R BC 0 3 7 A 9 0 1 L D A 1 0 1 T U R N O F F R A M PC 0 3 9 B O 0 1 D D S T A B P O R Tc r n c A D O a D D L D A T H R B L O R E A D A C C U H U L A T E D C O U N TC 0 3 F A E 0 7 D O L D X T M R B H IC 0 4 2 B 5 7 D S T A C N T L O S A V E C O U N T SC 0 4 4 B a 7 C S I X C N T H IC 0 4 a A O 0 0 L D Y 1 0 0 D I S P L A Y C O L O R C O D EC 0 4 8 A 2 0 0 L D X 1 0 0 S E T I N D E X P O I N T E RC 0 4 A A 5 7 C L O A C N T H I S E T D A T AC 0 4 C 2 0 5 F C O J S R O U T P U T S H O N I TC 0 4 F A S 7 D L O A C N T L O N E X T D A T A (Continued on next page)

MICRO No. 70 - March 1984

Page 59: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 59/86

on!

After making the keyways fit

properly, I bent each connector pin

toward the pin directly opposite until

the tips of the pins were about 1/16"

apart. Now, any breadboarding circuit

card [such as Radio Shack #276-152)

will slide between the pins. Be sure to

align the board in the connector so it

does not overlap the cassette port.Solder each connector pin to an edge

pin on the board and clean off all rosin

residue completely. The final step is to

put a 24 pin socket on the board and

connect it to the socket so that the

User port lines can be extended with a

DOP jumper such as the [ameco

DJ24-1-24. With this accessory, you

can swap out any number of special

boards. It is helpful if you use a specific

order in making the connections

between the socket and plug. The

pinout I used was:

P O R T :JO O :E T FUNC Tl ON

P I N1 G r o u n d

2.,

+5 V D C:

3 3 R E S E l

4 4 C N T I

5 5 S P I6 6 C N T 2

7 S P 28 8 P C 2

9 9 A T N

1 0 1 I) 9V A C1 1 1 1 9 V A C

12 1 2 G r o u n d

A 24 G r o u n d

B 23 F L A G 2

C ")'} P S I )_ " -

D 21 P B l

E 2 0 PB2

F 1 9 P9 3

H 18 P B 4

J 1 i P B 5~. 16 P B 6L 15 P S i

H 1 4 P A 2N 13 G r o u n d

Note that this particular pinout puts a

circuit common [ground] connection at

each corner of the 24 pin socket and

gives redundant ground connections for

better noise control. Also, the 9 port

pins are grouped together in a logical

order. The CNT, SP, FLAG and ,PC

lines are special functions of the 6526

Complex Adapter Interface ICIA) and

will be dealt with in a later column.

No. 70 - March 1984

C 0 5 1 2 0 S F C O J S R O U T P U l;

C 0 5 4 C 6 7 F D E L A Y I D E C D E L Y L D . S S E C O N D D E L A YC 0 5 6 D O F C B N E D E L A Y 1

C O S S C 6 7 E D E C D E L Y H IC O S A D O F S B N E D E L A Y IC 0 5 C 4 C 0 0 C O J M P S T A R T ; L O O P F O R E V E R

j

C O S F 4 S O U T P U T P H A ; S A V E D A T AC 0 6 0 4 A L S R ; S E T H I N I B B L EC 0 6 1 4 A L S RC 0 6 2 4 A L S RC 0 6 3 4 A L S RC 0 6 4 2 0 7 4 C O J S R C O N V R T M A K E D I S P L A Y A B L E C H A R A C T E RC 0 6 7 2 0 S I C O J S R D I S P L Y S H O W IT

C 0 6 A 6 S P L A G E T D A T AC 0 6 B 2 9 O F A N D U O F M A S K T O L O N I B B L EC 0 6 D 2 0 7 4 C O J S R C O N V R TC 0 7 0 2 0 S I C O J S R D I S P L YC 0 7 3 6 0 R T S

;C 0 7 4 C 9 O A

C O N V R T t M P U O A A L P H A O R N U M E R I C ?C 0 7 6 9 0 0 4 B C C N U M B E R 0 - 9C 0 7 S 3 S S E C A - FC 0 7 9 E 9 0 9 S B C 1 0 9 M A K E I T C 6 4 S C R E E N C O D EC 0 7 B 6 0 E X I T R T S

;C 0 7 C I S N U M B E R ~ L C C O N V E R T T O A S C I IC 0 7 D 6 9 3 0 A D C 1 $ 3 0C 0 7 F D O F A B N E E X IT.,C O S I 9 D 7 0 0 7 D I S P L Y S T A $ 0 7 7 0 , X P U T I N S C R E E N B U F F E RC 0 8 4 9 8 T Y A S E T C H A R A C T E R C O L O RC O S S 9 0 7 0 D B S T A $ D B 7 0 , X P U T I N C O L O R R A MC O S S E S I N X B U M P I N D E X

C 0 8 9 6 0 R T SC O S A 0 0 B R K

c o s a E N D

You will note from the programming

example below that the CIA port pins

are easier to program than PIA lines

previously discussed in this column.

Also, the schematics shown below skip

specific pinout details by showing

direct connection between the port

pins and the external circuit.

Figure 3 shows a rudimentary

single-slope integrating converter. It

isn't very accurate (+ or - 2% linearity

between .5 volts and 5 volts) but it

works well enough for

experimentation. One resistor is

marked (.); it is needed to restrict input

level to the C64. If the circuit is used

with CoCo, it should be removed.

The circuit cost is quite low, and

the driver [Listing 1) reveals a lot about

assembly language programming of the

6526 CIA. For CoCo, drive the control

MICRO

line (BITO) with SERIAL OUT and

connect BIT7 to CoCo's DC IN line.

Program CD as an interrupt and

eliminate the DELAY block in the flow

chart shown in Figure 4. Figure 4 is the

conversion flow chart for the converter

of Figure 3. Adjust the sense of the

control signals as necessary for your

computer; BITO must be low for the

ramp to run and BIT7 switches high

when ramp coincidence occurs.

The premise of this experiment is

that two I/O lines can interface with a

simple AID converter if the data

conversion is internal to the computer.

This makes the circuit work with an

unmodified CoCo, and multiple AIDs

can be driven by the C64 User port.

Data output on the C64 uses a small

"window" in the lower left part of the

screen. Binary data is converted to

57

Page 60: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 60/86

ASCII (0-9) or to C64 screen characters

(A-F).Writing the converted characters

to $0770 thru $0773 puts data in the

screen buffer, while $DB70 thru $DB73

are the corresponding Color RAM

locations which make the data visible

on the screen. Note also that writing

$07 to the 6526 Control Register (lines

37-38 in Listing 1) sets Timer A or

output on PB6i $41 sets Timer B forinput on CNT2 (lines 28-29). Thus,

PB6 and CNT2 must be connected by a

jumper.

Once the circuit is built, vary the

values of R2 and R3 to make the value

shown on the screen vary between

$FFFF for zero input and$FF80 for 5

volts. This accomplishes two thing: the

circuit accuracy does not need more

than 7 bits of resolution, and the

number representing the voltage is

restricted to a single byte for easier

conversion to "real" numbers. Since

this converter has a slightly non-linearoutput, the "classical II software

correction would be to calibrate the

circuit at (perhaps) ten points, and

create a translation table. This

technique uses a list of data (numbers

read from the screen) and the

corresponding voltage. So long as the

non-linear output of a converter (or a

sensor) is a smooth curve, a lookup

table can noticeably increase accuracy.

One other note: in common with many

converters, this converter cannot

convert negative input voltages.

Ralph Tenny may be corresponded with at

P.O. Box 545, Richardson, TX 75080

:SE'r DA1Ft10 ZERO

Figure 4. Flow chart for controlling AID converter in Fig. 3.

FORAPPLE II PLUS. FRANKLIN. APPLE lie

Font Down Loader

58

Expand the capacity of your printer hundreds of times

Load custom fonts into your Apple" Matrix Printer, Prownterrx8510A, OKI® Microline 92,93,84 Step II, and Epson® FX and use

them with virtually every word processor to turn your printer into acustom typesetter. After the fonts are loaded, they will stay in yourprinter until it's turned off. A font editor isalso provided to allow you tocreate your own graphics, text, foreign language letters, math andelectronics symbols to load into your printer. On-Disk (Specify Printer)

.................................................... 53900

$100 REWARD

New Improved versions Wth onvers for Grappler. Pkaso. Wzard and most other Intelligent parallel boards.

,--."--~--.---.--,-.,.icra warEP.o. Box 113

Pompton Plains. N.J.07444

Dealer and Distributor Inquiries Invited

"There's got to be a better way to load fonts!"

CALL (201) 838-9027

Submit the best or most uniquefont using the above software and wewill make you S 100 richer. Otherprizes for the first 25 runners up.

MICRO No. 70 . March 1984

Page 61: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 61/86

Commodore Compass

by Loren Wright

New Computers and Peripherals

At the January Consumer Electronics

Show in Las Vegas, Commodore

Business Machines announced two

new computers and a number of

peripherals. The two computers are the

264 and V364. Both include64K of

RAM 160Kaccessible for BASIC), the

7501 processor, built-in software

capabilities, and four separate cursor

keys. The specifications are similar to

those of the Commodore 64, but it is

doubtful that there will be much

compatibility. There are 16 colors,

each available in 8 luminances [similar

to AtariJ. Only two music voices, no

sprites, and only three graphics modes

are available. The new BASIC 3.5 will

include commands for graphics and

sound, and there is a screen window

capability. Also included is a built-in

machine-language monitor.

Built-in software means that the

programs are actually in ROM inside

the computer, instantly available.

Special models of the 264 will include

The 264 Magic Desk, The 264 Word

Processor, or an integrated package

called The 264 3-PLUS-1.

The V364 includes voice synthesis

capability, and extra commands in

BASIC to support it. A 250-word

vocabulary is built in, but you can add

more words by loading them from disk

or cassette. The V364 also includes a

19-key numeric keypad.I am concerned that these machines

use a 7501 processor. That means that

Commodore will once again be

introducing machines in the absence of

compatible software, in spite of

Commodore's assurance that a wide

variety of software will be available at

introduction. The lack of compatibility

with the Commodore 64 is also

unfortunate. It is quite possible that

these machines, like the C128, may

never make it to market. We shall see.

I doubt that these products will

No. 70 - March 1984

have any immediate impact on the

C-64. It has been too successful for

even Commodore to consider

abandoning.

Peripherals announced at CES

include a new disk drive [the 1542), a

60 cps dot-matrix printer IMPS 802), a

color dot-matrix printer IMCS 801),

and a daisy wheel printer lOPS 1101),

all compatible with VIC, C64, and thetwo new computers. For the two new

computers only are the SFS 481 fast

disk drive, and the 1531 cassette drive.

Magic Voice is a voice synthesis

cartridge for the Commodore 64 that

includes a vocabulary of 235 phrases.

More phrases can be loaded from disk

or cassette. The Gorf and Wizard of

Wor cartridges will be offered as talking

cartridges, with more to come later.

This unit adds capabilities similar to

those included with the V364, but

control will have to be with less-than-

convenient BASIC V2 commands andmachine language.

Jack Tramiel Resigns

Jack Tramiel, the founder and driving

force of Commodore, has resigned,

apparently in an attempt to make

Commodore's management more

efficient and structured. In his

statement he cited personal reasons,

but there is speculation that he was

forced out. According to some sources

this is the best thing that could happen

to Commodore, but according toothers

it is the worst. I tend to think a little of

both.

Jack has shown an incredible abilityto think on his feet, making sudden,

sweeping and unpredictable changes.

His aggressive pricing policies have

eliminated Texas Instruments from the

home-computer market, and seriously

hurt Atari, Apple, Timex-Sinclair, and

others, putting Commodore at the top

of the low-end microcomputer market.

Middle and especially upper

management has undergone so many

changes that I've stopped keeping

track.

Without Tramiel, Commodore will

surely exhibit more stability, andprobably more conservatism. Perhaps a

higher priority will be assigned to

things like customer and dealer

support. However, Commodore may

miss Tramie1's sixth-sense ability to

react quickly and effectively to changes

in the microcomputer market.

Listing 1

1 9 0 0 0 R E M R E A D I N M L P R O G R A M1 9 0 1 0 M E M = 4 9 1 5 2 : R E " A D D R E S S $ C O O O1 9 0 2 0 R E A D X X1 9 0 3 0 I F X X ( 2 5 6 T H E N P O K E M E M , X X : " E M = " E " + I : G O T O 1 9 0 2 01 9 0 4 0 R E T U R N1 9 5 0 0 D A T A 0 , 3 8 , 1 , 3 2 , 5 2 , 1 9 2 , 3 2 , 8 0 , 1 9 2 , 3 2 , 6 5 , 1 9 2 , 3 2 , 8 0 , 1 9 2 , 1 7 31 9 5 1 0 D A T A 2 , 1 9 2 , 2 4 0 , 9 , 1 7 2 , 1 , 1 9 2 , 3 2 , 5 2 , 1 9 2 , 3 2 , 1 4 7 , 1 9 2 , 9 6 , 3 2 , 5 21 9 5 2 0 D A T A 1 9 2 , 3 2 , 1 0 4 , 1 9 2 , 3 2 , 6 5 , 1 9 2 , 3 2 , 1 0 4 , 1 9 2 , 1 7 2 , 0 , 1 9 2 , 1 7 3 , 2 , 1 9 21 9 5 3 0 D A T A 2 4 0 , 2 3 5 , 2 0 8 , 2 2 7 , 1 7 3 , 2 4 , 2 0 8 , 4 1 , 2 4 0 , 7 4 , 7 4 , 1 3 3 , 2 5 2 , 1 3 3 , 2 5 4 , 2 0 81 9 5 4 0 D A T A 6 , 1 6 9 , 2 1 6 , 1 3 3 , 2 5 2 , 1 3 3 , 2 5 4 , 1 6 9 , 0 , 1 3 3 , 2 5 1 , 1 6 9 , 1 , 1 3 3 , 2 5 3 , 9 61 9 5 5 0 D A T A 1 7 2 , 0 , 1 9 2 , 1 3 6 , 1 7 7 , 2 5 3 , 1 4 5 , 2 5 1 , 2 0 0 , 2 0 4 , 1 , 1 9 2 , 1 4 4 , 2 4 6 , 3 2 , 1 2 71 9 5 6 0 D A T A 1 9 2 , 1 6 5 , 2 5 1 , 2 0 1 , 2 3 2 , 2 0 8 , 2 3 3 , 9 6 , 1 7 2 , 1 , 1 9 2 , 1 7 7 , 2 5 1 , 1 4 5 , 2 5 3 , 1 3 61 9 5 7 0 D A T A 2 0 4 , 0 , 1 9 2 , 1 6 , 2 4 6 , 3 2 , 1 2 7 , 1 9 2 , 1 6 5 , 2 5 1 , 2 0 1 , 2 3 2 , 2 0 8 , 2 3 4 , 9 6 , 1 6 51 9 5 8 0 D A T A 2 5 1 , 2 4 , 1 0 5 , 4 0 , 1 3 3 , 2 5 1 , 1 3 3 , 2 5 3 , 2 3 0 , 2 5 3 , 1 6 5 , 2 5 2 , 1 0 5 , 0 , 1 3 3 , 2 5 21 9 5 9 0 D A T A 1 3 3 , 2 5 4 , 9 6 , 1 5 2 , 1 3 3 , 2 5 3 , 1 6 0 , 2 4 , 1 6 2 , 0 , 1 6 9 , 3 2 , 1 2 9 , 2 5 3 , 1 3 6 , 4 81 9 6 0 0 D A T A 1 5 , 2 4 , 1 6 5 , 2 5 3 , 1 0 5 , 4 0 , 1 3 3 , 2 5 3 , 1 6 5 , 2 5 4 , 1 0 5 , 0 , 1 3 3 , 2 5 4 , 2 0 8 , 2 3 41 9 6 1 0 D A T A 9 6 , 2 5 6

MICRO 59

Page 62: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 62/86

Sideways Screen Moves

Listing 1 is a basic-loader version of a

lateral screen-move routine. A SYS

49155 instruction moves the entire

screen left one character and a SYS

49182 moves it right.

What good is such a routine? One is

in a screen editor, such as the one

published in the November, 1983 issue

of MICRO (66:28). Let's say you havecarefully prepared a design on the

screen, and you want to center it. It's

easy if you can move the entire screen

over.

The Commodore 64 offers a

smooth-scrolling feature, whereby the

entire screen can be moved in any

direction in single-pixel increments.

To make this look good, a number of

things have to happen, The screen can

be shrunk from 40 columns to 38, and

from 25 rows to 24. This provides a

hidden area where the new characters

can be assembled before being scrolledon. However, when the screen reaches

the 8-pixel limit of its fine scrolling

capability, your programming must

take over. The entire screen has to be

shifted one character in the direction of

the scroll--another use for my routine!

The routine is parameter driven.

Three bytes at the beginning of the

program control it: LCOL (49152) is

the left-hand column to be moved;

RCOL (49153) is the right-hand

column to be moved; and FLAG

(49154) determines whether to fill the

vacated column with spaces (non-zero

value) or to leave it as is. LCOL and

RCOL must be in the range 0 to 39 and

RCOL must be greater than LCOL. In

addition, on a left move LCOLmust be

1 or greater, and on a right move RCOL

must 38 or less. The values in RCOL

and LCOL will stay the same, so you

can repeat calls without resetting them

each time.

A little more on fine scrolling. It

doesn't work quite the way it should.Switching from one end of the fine

scrolling range to the other is so slow

that it results in a noticeable screen

jump. John Heilbom (Commodore 64

Graphics, Compute Books, 1983)

resorts to using duplicate areas of

screen memory. Everything is written

on two screens and the two are

switched back and forth. I certainly

hope there is a better way. My routine

will work with the smooth scrolling

feature, but without some further

refinements it will be far from smooth.

6 0

Listing 2

;S C R H E HY I C H C RC l R H E H

;P T R AP T R B

;l C O lR C O lF L A G;L I N I T

;R I N I T

;S C R S E T

;C l R S E T

I,L O N S E T

S l O E S C R O L LL O R E N W R I G H T2 0 F E B 1 9 8 ~

E Q U $ 4 0 0E Q U $ 0 0 1 8E Q U $ D 8 0 0

E Q U $ F BE Q U $ F D

D R S $ C O O O

B Y T 0

B Y T 3 8B Y T I

J S R S C R S E TJ S R H V L E F TJ S R C l R S E TJ S R H V l E F Tl D A F L A GB E Q Q U I Tl D Y R C O lJ S R S C R S E TJ S R S P C I NR T S

J S R S C R S E TJ S R H V R G H TJ S R C L R S E TJ S R H V R G H Tl D Y l C O ll D A F L A G

B E Q Q U I TS N E S P C J H P

L D A V I C H C RA N Dnil1 1 0 0 0 0l S Rl S RS T A P T R A + IS T A P T R B + IB N E l O W S E T

l D A I C L R H E "S T A P T R A + I

S T A P T R B + I

L D A 1 0S T A P T R AL D A I IS T A P T R BR T S

L D Y L C O LO E Y

C 0 5 4 B I F DC 0 5 6 9 1 F BC 0 5 8 C 8C 0 5 9 C C 0 1 C OC 0 5 C 9 0 F 6C 0 5 E 2 0 7 F C OC 0 6 1 A S F BC 0 6 3 C 9 E 8C 0 6 5 D O E 9C 0 6 7 6 0

C 0 6 8 A C 0 1 C OC 0 6 B B I F BC 0 6 0 9 1 F OC 0 6 F 8 8C 0 7 0 C C 0 0 C OC 0 7 3 1 0 F 6C 0 7 5 2 0 7 F C OC 0 7 8 A S F BC 0 7 A C 9 E 8

C 0 7 C D O E AC 0 7 E 6 0

C 0 7 F A S F BC 0 8 1 1 8C 0 8 2 6 9 2 8C 0 8 4 8 5 F BC 0 8 6 8 5 F DC 0 8 8 E 6 F DC 0 8 A A S F CC 0 8 C 6 9 0 0C 0 8 E 8 5 F CC 0 9 0 8 5 F EC 0 9 2 6 0

C 0 9 3 9 8C 0 9 4 8 5 F DC 0 9 6 A O 1 8C 0 9 8 A 2 0 0C 0 9 A A 9 2 0C 0 9 C 8 1 F DC 0 9 E 8 8C 0 9 F 3 0 O FC O A l 1 8C O A 2 A S F DC O M 6 9 2 8C O A l ! 8 5 F DC O A 8 A S F E

C O A A 6 9 0 0C O A C 8 5 F EC O A E D O E AC 0 8 0 6 0

C O B I

L L O O P

;

H V R G H TR l O O P

;

B I J I I P R N

;S P C I M

S L O O P

D O N E

E N D

0 4 0 0D O l 80 8 0 0

O O F BO O F D

C O O O

C O O O 0 0C O O l 2 6C 0 0 2 0 1

C 0 0 3 2 0 3 4 C OC 0 0 6 2 0 S O C OC 0 0 9 2 0 4 1 C OC O O C 2 0 S O C OC O O F A D 0 2 C OC O l 2 F O 0 9C O l 4 A C 0 1 C OC O l 7 2 0 3 4 C OC O l A 2 0 9 3 C OC O l D 6 0

C O l E 2 0 3 4 C OC 0 2 1 2 0 6 8 C OC 0 2 4 2 0 4 1 C OC 0 2 7 2 0 6 8 C OC 0 2 A A C 0 0 C OC 0 2 D A D 0 2 C OC 0 3 0 F O E BC 0 3 2 0 0 E 3

C 0 3 4 A D 1 8 D OC 0 3 7 2 9 F O

C 0 3 9 4 AC 0 3 A 4 AC 0 3 B 8 5 F CC 0 3 D 8 5 F EC 0 3 F D O 0 6

C 0 4 1 A 9 0 8C 0 4 3 8 5 F C

C 0 4 5 8 5 F E

C 0 4 7 A 9 0 0C 0 4 9 8 5 F BC 0 4 B A 9 0 1C 0 4 D 8 5 F DC 0 4 F 6 0

C 0 5 0 A C 0 0 C OC 0 5 3 8 8

L O A ( P T R B ) , YS T A ( P T R A ) , Y1 N YC P Y R C O LB C C L L O O PJ S R B U I I P R WL O A P T R AC HP U EB

B N E I I V l E F TR T S

l O Y R C O lL D A ( P T R A ) , Y

S T A ( P T R B ) I Y

D E YC P Y L C O lB P L R l O O PJ S R B U I I P R Wl O A P T R AC HP U EB

B N E H V R G H TR T S

L D A P T R AC l CA D C 1 4 0S T A P T R AS T A P T R BI N C P T R BL D A P T R A + IA D C 1 0S T A P T R A + IS T A P T R B + IR T S

T Y AS T A P T R BL D Y 1 2 4L D X 1 0L O A 1 $ 2 0S T A ( P T R B , X lD E YB H 1 O O N EC L Cl O A P T R BA D C 1 4 0S T A P T R BL O A P T R B + I

A D C 1 0S T A P T R B + IB N E S L O O PR T S

MICRO No. 70· March 1984

Page 63: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 63/86

You'll

Receive:

CaIC•• •aminiaturespread-sheet program that.makes complex, ntpetitlvecalculations a.b r e ez e .

+- MASTER ...a.·guessinggam~.trtatit.~c:tt~;/programming with random·numbers and.flags~, .

..,:,,".c;

+-VICCloci(.~ .••cJteaChiyQd()andcharact~grapf'llc$.(> .'.

se thts coupon or the postage paid card in this issue to order. ·+>\PIU~.nmUSiC programming,

.: . string .manlpulation,. !)orting

.df!rI1onstrations s.: and more.ICRO Books P.o. Box 6502, Chelmsford, MA 01824

YES, please rush copies of MASTERINGYOUAVIC ..2Q'(Wj~~~it~kionly $19.95 per copy (plus $2.00 slh, MA res,add5%'satesta)(Y,;, '4 i) : i , it :~\;j\.;:\ i

payment of $ is enclosed. I'm paying by 0 Check 0 MO

o VISA 0 MC

E~ch\Program.Worth the .Price

of the Book!AME ~ __

DDRESS _

ITY__ - STATE ZIP _

# EXP.DATE _

Allow 6- 8 weeks for delivery.

O rde r y ou r copy of

MA S T E R I NGYOURVIC·20

Today!

Page 64: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 64/86

,b6x6 36

g~

~~~

~g

O n M ultip lication~e,

T he 6809 Versus.J~

the 65 0 2 ~~

.J ~"g8x8 64 "

by Corn elis B o ng ers

Although it took some time, there is

now finally a 6809 board (the

REHAFLEXboard) that works on both

the Apple II and the Basis 108. This

board is downwards compatible with

the well known Mill Board (the main

difference being an extensive memory

mapping option, so that it supports the

Apple Flex as well as the Apple OS-9

operating system).

When the board arrived, I

enthusiastically started to learn 6809

machine language and I readily

encountered the MUL instruction.

With this instruction, two bytes stored

in the A- and B-accumulator can be

multiplied and the result is stored in

the 16 bit D-accumulator. The latter is

not a separate accumulator (low

byte), but consists of the A-accumulator

(high byte) and the B-accumulator (low

byte), respectively. Since the 6S02

lacks a MUL instruction, it seems an

interesting experiment to substitute a

6809 floating point (FP) multiplication

routine for the Applesoft 6S02 FP

Figure 1

[ B O N S E R - I . L S T lO I S A S S E K B L Y O F A P P L E S O F T ' SF P K U L T I P L I C A T I O N R O U T I N E

;

0 0 9 E M F P M E 9 U $ 9 EO O A b S F P M E 9 U $ A b0 0 6 2 P R O D E 9 U $ 0 2O O A C E m E 9 U $ A C

E 8 0 A S H I F T E 9 U $ E 8 D AE A O E E X P O E 9 U $ E A O EE A E o N O R M E 9 U $ E A E b

E 9 8 2 O R G $ E 9 8 2

E 9 8 2 D O 0 3 B N E D O l TE 9 8 4 4 C E 2 E 9 J M P R E T U R N

M A N T I S S A M A I N F P A C CM A N T I S S A S E C F P A C C" A N T I S S A O F P R O D U C TE X T E N S I O N B Y T E

F A S T S H I F T R O U T I N ED E T E R " I N E E X P O N E N T / S I 6 NN O R M A L I Z E R O U T I N E

B R A N C H I F N O N - Z E R O E X P O N E N TE L S E . R E T U R N T O C A L L E R

N O T E T H A T T H E S T A T E M E N T S A B O V EC A N B E R E P L A C E D B Y : B E 9 R E T U R N

MICRO62

multiplication routine, in order to

speed things up a bit. I was especially

moti vated to undertake this

experiment after I noticed how quickly

FP multiplications are done in

BASIC09. This article describes the

result of the experiment and present a

general and a special purpose

multiplication routine for the 6809.

FP Multiplication with the 6502

The Applesoft FP multiplication

routine starts at $E982. Prior to

invocation, the main floating point

accumulator (MFP, at $9D-$A1 and the

extension byte at $AC) and the

secondary floating point accumulator

(SFP, at $AS-$A9) must have been

loaded with the numbers that have to

be multiplied. Furthermore, the value

of the MFP exponent must be loaded in

the 6S02 accumulator just before the

subroutine call to $E982 is issued. (For

more details see: In the Heart of

Applesoft, MICRO No. 33, February

1981).The routine (see Figure 1) starts

with a BNE instruction. This has the

effect that the multiplication is only

carried out if the MFP differs from zero.

A zeroMFP exponent indicates that the

whole number is zeroand, in that case,

control returns to caller immediately.

The (preliminary) value of the

exponent of the product and the sign of

the mantissa are determined by the

subroutine at $EAOE, which is called

No. 70· March 1984

Page 65: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 65/86

at $E987. Next, the multiplication of

the mantissas is done. It is this part of

the multiplication routine that is best

suited for 6809 code substitution. As

can be seen from Figure I, locations

$62-$65 are initialized to zero first.

These locations will further be referred

to as the 'product accumulator'. The

product accumulator is used tobuild up

the product and when the mantissamultiplication is completed, it is

transferred to the MFP. The MFP is

then normalized and control returns to

caller.

Broadly speaking, the mantissa

multiplication is performed by

examining the bits of the MFP

mantissa (further to be called the

MFPM) one by one, beginning with the

last bit of the extension byte ($AC).If a

bit is set, the SFPM is added to the

product accumulator and next, the

product accumulator is shifted one bit

to the right [i.e., divided by two). If thebits is not set, only the shifting to the

right takes place (thus no adding). The

actual code of the routine consists of a

main driver and a subroutine. The

D E T E R M I N E N E W E X P O / S I 6 Nl N I T P R O D U C T A C C T O 0

J S R E X P OL O A 1 $ 0 0S T A P R O DS T A P R O O f !S T A P R O D + 2S T A P R O O + 3

L D A E H BJ S R M A N M U LL O A M F P M + 3J S R M A N M U LL D A M F P M + 2J S R M A N M U LL D A M F P M + !J S R M A N M U LL O A M F P MJ S R H A N M U L lJ M P N O R M

E 9 8 7 2 0 O E E A D O I TE 9 8 A A 9 0 0E 9 8 C 8 5 6 2E 9 B E 8 5 6 3E 9 9 0 8 5 6 4E 9 9 2 8 5 6 5

E 9 9 4 A 5 A CE 9 9 6 2 0 B O E 9E 9 9 9 A 5 A IE 9 9 8 2 0 8 0 E 9E 9 9 E A 5 A OE 9 A O 2 0 B O E 9E 9 A 3 A 5 9 FE 9 A 5 2 0 8 0 E 9E 9 A 8 A 5 9 EE 9 A A 2 0 B 5 E 9E 9 A D 4 C E 6 E A

S T A R T W I T H E X T E N S I O N B Y T EA N D M U L T I P L Y W I T H S F P M

D O O T H E R B Y T E S N E X T

N O R M A L I Z E A N D E X I T

E 9 8 0 D O 0 3 I ' I A N I ' I U LB N E M A N M U L l B R A N C H I F B Y T E ( > 0E 9 9 2 4 C D A E B J M P S H I F T E L S E , S H I F T F A S TE 9 8 5 4 A M A N I ' I U L I L S R G E T L A S T B I T I N C A R R YE 9 B 6 0 9 8 0 O R A U 8 0 S E T F I R S T B I TE 9 8 8 A 8 L O O P T A Y S A V E I N Y - R E GE 9 B 9 9 1 ) 1 9 B e C N O A D D O H I T A D D I F B I T N O T S E TE 9 B B 1 8 C L CE 9 B C A 5 6 5 L O A P R O D + 3 A D D S F P M T O P R O D U C T A C CE 9 B E 6 5 A 9 A O C S F P M + 3E 9 C O 8 5 6 5 S T A P R O D + 3E 9 C 2 A 5 6 4 L O A P R O D + 2E 9 C 4 6 5 A S A D C S F P I ' I + 2E 9 C 6 8 5 6 4 S T A P R O D + 2E 9 C 8 A 5 6 3 L O A P R O O + IE 9 C A 6 5 A 7 A D C S F P H + I

E 9 C C 8 5 6 3 S T A P R O D + IE 9 C E A S 6 2 L O A P R O DE 9 0 0 6 5 A 6 A D C S F P ME 9 D 2 8 5 6 2 S T A P R O DE 9 D 4 6 6 6 2 N O A D D R O R P R O D D I V I D E P R O D U C T A C C B Y 2E 9 D 6 6 6 6 3 R O R P R O D + IE 9 0 8 6 6 6 4 R O R P R O D + 2E 9 D A 6 6 6 5 R O R P R O O + 3

E 9 0 C 6 6 A C R O R E H 9 E X T B z L A S T B Y T E P R O D A C eE 9 D E 9 8 H A G E T ( S H I F T E D I B Y T E H r P ME 9 D F 4 A L S R S H I F T O N C E A G A I NE 9 E O D O D 6 B N E L O O P L O O P B T I M E SE 9 E 2 6 0 R E T U R N R T S

No. 70 - March 1984 MICRO

main driver loads the bytes of the

MFPM, one by one, in the 6502

accumulator (beginning with the last

byte) and calls the subroutine at

$E9BO.This subroutine handles the bit

examination and builds up the product

accumulator. Note that if the

subroutine is entered with the zero flag

set, indicating that the byte is zero,

control is transferred to location$ESDA. At this address resides code

that shifts the product accumulator one

byte to the right (i.e., a division by

256). This obviously goes faster than

shifting the product accumulator eight

times on bit level. If the byte is not

zero, the process above (adding and

shifting) takes place. Note the clever

method that is used to create a loop

that is executed S times (see the

instructions at $E9B5-$E9B6 and

$E9DE-$E9EO).

The time critical part of the code

f$E9BC-$E9DC) is written out

completely in order to minimize

execution time. The execution time

varies, of course, since it depends on

the number of non-zero bytes in the

MFP and the number of bits set in the

MFPM. Multiplying two small integers

takes generally much less time than

multiplying two fractional numbers,

because the mantissa of an (Applsoft)

integer number contains at most two

non-zero bytes. When we assume that

on the average half of the bits are set in

the MFPM (including the extension

byte), the number of cycles needed for

the mantissa multiplication will about

2250. Since a 6502 cycle corresponds

approximately to a microsecond, we

arrive at 2.3 milliseconds per mantissa

multiplication.

Multiplication with the 6809

The availability of the MUL

instruction opens the way to use an

entirely different multiplicationroutine. Rather than working on bit

level, we can now do things on byte

level. A possible approach is outlined

in Figure 2. First, byte 4 of the MFPM

(byte i of the MFPM will further be

referred to as MFPMi) is multiplied

with SFPM3 and the result is put in

bytes 7 and S of the (zero-initialized)

product accumulator. Next, MFPM3 is

multiplied with SFPM3 and the result

is added tobytes 6 and 7 of the product

accumulator. This process is continued

until all bytes of the MFPM are

63

I1

Page 66: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 66/86

multiplied with SFPM3. The following

step is to multiply all bytes of the

MFPM with SFPM2. We start with

SFPM2 • MFPM4 and add the result to

bytes 6 and 7 of the product

accumulator. But now a problem

arises. Namely, when the addition is

executed, a carry may be generated, for

the product accumulator already

contains the results of MFPM •

SFPM3. If a carry is generated, byte 5 ofthe product accumulator must be

incremented by one. The latter

operation may, however, also generate

a carry [actually: set the zero flag],

which would mean that byte 4 must

also be incremented, and so on. This is

certainly a drawback of this approach,

for a considerable amount of time may

be involved with the carry-processing.

An additional drawback is that the

product accumulator must consist of 9

bytes. This can be reduced to 6 bytes,

but then the entire productaccumulator must be shifted one byte

to the right after each multiplication of

the MFP mantissa with a byte of the

SFPM.

Another approach that looks more

promising works as follows. In

algebraical terms, the 20 [4xS) byte by

byte multiplications required to

multiply the two mantissas can be split

up in a number of groups. Each group

consists of those 'partial products' that

have the same exponent. When the

MFPM is looked at as a binary number,

it can be represented as follows:

F i g u r e 2 . M u l t i p l i c a t i o n w i t h t h e 6 S 0 9 ( I e t h o d I )

: H F P H O : H F P H I : H F P H 2 : H F P~ 3 : H F P H 4 : H F P H

: S F P H O : S F P H I : S F P H 2 : S F P H 3 : S F P H

- - - - - - ~ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - x

: S F P H 3 f H F P H 4 :

: S F P H 3 f H F P H 3 :

- - - - - - - - - - - - - - - - - - - - - - - - - +

: P R O D 6 : P R O D 7 : P R O D S :

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +

: P R O D S : P R O D b : P R O D 7 : P R O D S :

e t c .

64

H F P H = H F P H O f 2 AO + H F P H l f 2 A8 + H F P H 2 f 2 AI 6

+ H F P H 3 f 2 A2 4 + H F P H 4 * 2 A3 2

Multiplication with the SFMP, i.e.,

S F P H = S F P H O f 2 AO + S F P H I f 2 A8 + S F P H 2 * 2 A 1 6 + S F P H 3 f 2 · ' 2 4

gives:

( S F P H O f H F P H O ) f 2 AO +( S F P H O f H F P H I + S F P H l f H F P H O ) f 2A8 +( S F P H O f H F P H 2 + S F P H l f H F P H I + S F P H 2 f H F P H O ) f 2 A1 6 +( S F P H O f H F P H 3 + S F P H l f H F P H 2 + S F P H 2 f H F P H I + S F P H 3 f H F P H O ) f 2 A2 4 +( S F P H O * H F P H 4 + S F P H l f H F P H 3 + S F P H 2 f H F P H 2 + S F P H 3 f H F P H I ) f 2 A3 2 +( S F P H l f H F P H 4 + S F P H 2 f H F P H 3 + S F P H 3 f H F P H 2 ) f 2 A4 0 +

( S F P H 2 f H F P H 4 + S F P H 3 f H F P H 3 ) f 2 A4 8 +( S F P H 3 t H F P H 4 ) f 2 A5 b

The product can be built up in 8

F i g u r e 3 . H u l t i p l i c a t i o n w i t h t h e 6 8 0 9 ( I e t h o d 2 )

- - - - - - - - - - - - - - - - - - - ~ - - - - - - - - - - - - - - - - - - - - -: H F P H O : ~ FP H I : H F P H 2 : H F P H 3 : H F P H 4 : M F P M

: S F P H O : S F P H I : S F P H 2 : S F P H 3 : S F P H

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - x

: S F P H 3 f H F P H 4 :

: P R O D 4 :

: S F P M 2 f H F P H 4 :

- - - - - - - - - - - - - - - - - +

: P R O D 3 : P R O D 4 :

I S F P H 3 f H F P H 3 :

- - - - - - - - - - - - - - - - - - - - - - - - - +

: P R O D 2 : P R O D 3 : P R O D 4 :

: P R O D 3 : P R O D 4 :

: S F P H I f H F P H 4 :

- - - - - - - - - - - - - - - - - - - - - - - - - +

: P R O D 2 : P R O D 3 : P R O D 4 :

e t c .

MICRO No. 70 - March 1984

Page 67: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 67/86

Figure 4

• M U L T I P L Y B I N A R Y N U M B E R S* O N A 6 8 0 9

t B Y C O R N E L I S B O N G E R S• A P R I L 1 9 8 3 , Y E R S I O N 1 . 1• I N M I C R O . 7 0 , M A R C H 1 9 8 4t

* N O T E S** L P R O D M U S T B E ) = 3 A N D ( = L M P L + L M P C• L M P C M U S T B E ) = L M P L* L M P L A N D L M P C M U S T E A C H B E ( 1 2 8• L M P L + L M P C - L P R O D M U S T B E ( 1 2 8

t I N I T I A L I Z A T I O Nt

I ) O A 6 M P L E g U $ A 6 S T A R T M U L T I P L I E R0 0 9 E M P C E G U $ 9 E S T A R T M U L T I P L I C A N T0 0 6 2 P R O D E 9 U $ 6 2 S T A R T P R O D U C T0 0 0 4 L M P L E 9 U $ 4 L E N G T H M L i L TI P L I E R0 0 0 5 L M P C E Q U $ 5 L E N G T H M U L T I P L I C A N T

0 0 0 5 L P R O D E 9 U $ 5 L E N G T H P R O D U C T•• T E M P O R A R Y R E S I S T E R S

0 0 0 6 C U R X E 9 U $ 6 P O I N T E R T O M U L T I P L I E R0 0 0 8 C U R Y E 9 U $ 8 P O I N T E R T O M U L T I P L I C A N TI ) O F B I T C N T E 9 U $ F B N O . O F I T E R A T I O N SO O F C I T E R E 9 U $ F C I T E R A T I O N C O U N T E RO O F D S G N C N T E 9 U $ F D N O . O F S H I F T S T O T H E R I G H TO O F E S A M E E 9 U $ F E N O . O F L O N G E S T I T E R A T I O N SO o F F M A I L B O X E 9 U $ F F U S E D F O R 6 5 0 2 C O M M U N I C A T I O N

* S l A R T O F P R O G R A M

*0 0 0 0 O F F F S T A R T C L R M A I L B O X0 0 0 2 9 b F F W A I T L O A M A I L B O X W A I T F O R M U L T I P L Y C O M M A N D0 0 0 4 2 A F C B P L W A I T0 0 0 6 8 E O O A 9 L O X t M P L + L M P L - l P O I N T S T O E N D O F M U L T I P L I E R0 0 0 9 l o a E O O A 3 L O Y I M P C + L M P C P O I N T S T O E N D + I O F M U L T I P L I C A N TO O O D 1 0 9 F 1 ) 8 S T Y C U R ~0 0 1 0 8 6 0 4 L O A I L M P L + L M P C - L P R O D S E T U P S A M E A N D0 0 1 2 C 6 0 1 L O B t L H P C - L H P L S 6 N C N T0 0 1 4 D O F D S T D S G N C N T0 0 1 6 C E 0 0 6 5 L D U I P R O D + L P R O D - 2 P O I N T S T O E N D - I O F P R O D U C T0 0 1 9 o f C 4 C L R , U C L E A R L A S T B Y T E S O F P R O D . A C C U M .O O I B 6 F 4 1 C L R I , U0 0 1 0 O F F B C L R ! T C N T S E T N O . O F I T E R A T I O N S O T 0

1 ) 0 l F 2 0 1 8 B R A E N T R Y ! G O M U L T I P L Y0 0 2 1 3 3 S F A L I G N L E A U - I , U S T A R T M A I N L O O P0 0 2 3 9 E 0 6 C O N T L O X C U R X0 0 2 5 8 C 0 0 A 7 C P X I M P L + I S T A R T M U L T I P L I E R R E A C H E D ?0 0 2 8 2 4 O E B H S N X T P S O B R A N C H I F N O T0 0 2 A O A 0 9 D E C C U R Y + I U P D A T E P T R T O H U L T I P L I C A N T0 0 2 C O A F E D E C S A M E K E E P T R A C K O F M A X . I T E R A T I O N S0 0 2 E 2 A O E B P L N X T P S I0 0 3 0 O A F B D E C I T C N T D O W N T H E H I L L0 0 3 2 2 7 O C B E Q S K P C L R L A S T P A S S0 0 3 4 2 A 0 8 B P L N X T P S !0 0 3 6 2 0 C 8 B R A S T A R T R E A D Y

No. 70 - March 1984 MICRO

iterations, where each iteration

corresponds to the calculation of one of

the terms between parenthesis above.

We start with the calculation of the last

term [i.e., SFPM3*MFPM4j. This

involves a single multiplication and the

result is put in bytes 7 and 8 of the

product accumulator. Next, the last

but one term is computed. This

involves two multiplications, and bothresults are added tobytes 6 and 7 of the

product accumulator. A carry may

result here, but since bytes 0-5 of the

product accumulator are [still) zero, a

simple increment of byte 5 will do.

This increment can never generate a

carry, for, as can be figured out, a

(second) carry can only occur if a term

involves more than 257

multiplications. The other terms are

calculated and processed in a similar

way.

The advantages of the approach

above are that no extended carry-processing is necessary and that we

need not reserve the full length of the

product accumulator [i.e., 9 bytes). If

we want to reserve only 5 bytes for the

mantissa of the product accumulator

[as is the case in Applesoft], we set the

product accumulator pointer, which

references the current byte(s) of the

product accumulator, to byte 3 during

the first 5 iterations. Consequently,

after the calculation of each of the first

four terms the two ( !) relevant bytes of

the product accumulator must be

shifted one byte to the right (see Figure3 for an illustration). Only after the

calculation of the 5th term (and each of

the remaining terms), the product

accumulator pointer is decremented

and the shift to the right operation is

omitted.

The routine listed in Figure 4 shows

the code for the multiplication process

discussed above. Although no stack-

wise parameter passing is employed,

the routine is set up in such a way that

it can easily be adapted to non-

Applesoft applications. The length lin

bytes) of the multiplicant, the

multiplier and the product can be

specified by the user [see initialization

section), provided the restrictions

mentioned in the listing are satisfied.

The 6502 Versus the 6809

The final step is linking the 6809

multiplication routine to Applesoft

The 6502 driver, which takes care of

6809 - 6502 communications is

displayed in Figure 5. Since the 6809

6 5

. j

,I!

Page 68: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 68/86

routine expects a contiguous MFP

accumulator, the value of the

extension byte ($AC) is moved to $A2.

The old value of $A2 is temporarily

stored in the X-register. A similar

save/restore operation is performed on

location $66, which corresponds to the

'extension' byte of the product

accumulator.

Installation of the 6809 routine

involves the following steps:

1) Load the 6809 code at a suitable

address in memory, for example at

$9400

2) Coldstart the 6809 with the 6809

reset vector set to the address above.

Next put the 6809 in HALT state.

3) Move Applesoft into the Language

Card and read/write enable the

Language Card

4) .Load the 6502 driver at $E98A

5) Colds tart Applesoft and set HIMEM

to the address specified at step 1

After performing step 5, all

multiplications will be done by the

6809. A good method to check if things

work all right is to write a small

Applesoft program that compares the

results of two multiplications, the first

computed under 'normal' Applesoft

and the second computed under the

6809 version [by means of PEEK(49280)

and PEEK(49281), the Language Card

can be switched on and off from

BASIC).

For the speed comparisons I used

the program displayed in Figure 6. The

program took 52 sees to compute the

10000 multiplications with normal

Applesoft. Next I switched to the 6809

version and ran the program again, but

to my great disappointment, the

reduction in execution time was only 4

sees. First, I thought there had to be an

error somewhere lin the form of a

temporary hang-up of either the

program or my watch), since the same

program ran in 21 sees under BASIC09.

However, I was unable to find any

bugs, so I decided to establish more

precise timing results for the

multiplication operation. This can bedone rather easily by moving a fresh

copy of Applesoft into the Language

Card and inserting a JMP $EAE6

instruction (to the normalize routine)

at $E98A, thereby eliminating the

mantissa multiplication. This led to an

execution time [of the program in

Figure 6) of 32 sees. Deducting this

from the 52 secs realized earlier, we

arrive at a time of 2 millisecs per

multiplication. With the 6809, the

time needed for a multiplication is then

66

0 0 3 8 3 0 I F0 0 3 A O C F B0 0 3 C 9 F 0 60 0 3 E 6 F 5 F0 0 4 0 1 0 9 E 0 80 0 4 3 9 6 F B

0 0 4 5 9 7 F C0 0 4 7 A b 8 00 0 4 9 E 6 A 2

0 0 4 B 3 D0 0 4 C E 3 C 40 0 4 E E D C 40 0 5 0 2 4 0 20 0 5 2 6 C 5 F0 0 5 4 O A F C0 0 S 6 2 A E F0 0 5 8 D 6 F D0 0 5 A 2 7 C 50 0 5 C O A F DO O S E E C S F0 0 6 0 E D C 40 0 6 2 2 0 B F

N X T P S O L E A X - I , XI N C I T C N TS T X C U R XC L R - I , UL D Y C U R YL D A l T e N T

S T A I T E RL D A , X +L D B , - V

H U LA D D D , US T D , UB C C N O O V E RI N C - I , UD E C I T E RB P L 6 0 H U LL D B S 6 N C N TB E Q A L I 6 ND E C S 6 N C N TL D D - I , US T D , UB R A C O N T

U P D A T E P T R T O M U L T I P L I E RU P T H E H I L LU P D A T E C U R XC L E A R O V E R F L O H B Y T EG E T P T R T O H U L T I P L I C A N TG E T . O F I T E R A T I O N S F O R T H I S P A S S

S E T U P I T E R A T I O N C O U N T E RG E T B Y T E O F M U L T I P L I E RA N D H U L T I P L I C A N T

M U L T I P L YA D D T O P A R T I A L P R O D U C TA N D S T O R E

U P D A T E U - P T R ?B R A N C H I F S O

S H I F T P A R T I A L P R O D U C T

C O N T I N U Ef

* E N D O F P R O G R A M

Figure 5

j o S 0 2 D R I V E R F O R 6 8 0 9 F P M U L T I P L I C A T I O N;

0 0 9 E M F P M E Q U $ 9 E · M A N T I S S A M A I N F P A C C0 0 6 2 P R O D E Q U $ 6 2 · M A N T I S S A O F P R O D U C TO O A C E X T B E Q U f A C j E X T E N S I O N B Y T EO O F F M A I L B O X E Q U f F F ; F O R 6 5 0 2 / 0 8 0 9 C O M ME A E o N O R M E Q U $ E A E 6 ; N O R M A L I Z E R O U T I N EC O B I H L T 6 8 0 9 E Q U $ C O B I ; H A L T / S T A R T 6 8 0 9

;

E 9 8 A O R G $ E 9 8 A.,

E N T R Y IN X T P S IS K P C L R

S D H U L

N O O V E R

E 9 8 A A 6 A 2 L D X H F P H + 4 ; S A V E $ A 2E 9 8 C A 4 0 6 L D Y P R O D + 4 · A N D L A S T B Y T E P R O D U C TE 9 8 E A 5 A C L D A E X T B ; P R O V I D E 6 8 0 9 W I T HE 9 9 0 8 5 A 2 S T A M F P H + 4 · A C O N T I N U O U S M F P HE 9 9 2 A 9 8 0 L D A 1 $ 8 0 ; P R E P A R E C A L LE 9 9 4 8 S F F S T A M A I L B O XE 9 9 6 8 D B I C O S T A H L T 6 8 0 9 ; S T A R T 6 8 0 9E 9 9 9 A S F F W A I T L D A M A I L B O XE 9 9 B 3 0 F C B M I W A I T j W A I T U N T I L 6 8 0 9 I S R E A DE 9 9 D B D B I C O S T A H L T o B 0 9 ; H A L T 6 8 0 9E 9 A O A 5 6 6 L D A P R O D + 4 ; S E T E X T E N S I O N B Y T EE 9 A 2 8 5 A C S T A E X T B · P R O P E R V A L U E

E 9 A 4 B 6 A 2 S T X H F P M + 4 · R E S T O R E · C L O B B E R E DE 9 A 6 8 4 6 6 S T Y P R O D + 4 j L O C A T I O N SE 9 A 8 4 C E 6 E A J H P N O R M ; N O R M A L I Z E A N D E X I T

;E 9 A B E N D

Figure 6

5 R E M ( S I M P L E ) P R 0 6 R A M F O R S P E E D C O M P A R I S O N S1 0 L E T A = 5 I 3 : B = 5 1 32 0 F O R I = I T O 1 0 0 0 0 : C = A * B : N E X T3 0 P R I N T C H R $ ( 7 ) ; R E M B E L L

MICRO No. 70· March 1984

Page 69: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 69/86

Figure 7 t S P E C I A L P U R P O S E M U L T I L I C A T I o N R O U T I N E* T O S P E E D U P A P P L E S O F T

More speed, more memoryworkspace from the peoplewho lifted the 641( limit.

I n 1 9 8 1 , w e i n t r o d u c e d o u r f a m o u sS a t u r n RAM c a r d t o b o o s t t h e A p p l e ' sm e m o r y b y 3 2 K . N o w , t h e r e a r e 6 4 Ka n d 1 2 8 K v e r s i o n s f o r a d d e d p o w e r .

I n c r e a s e d RAM l e t s y o u r u n b i g g e rp r o g r a m s , a n d o u r V i s i C a l c ® e x p a n s i o ns o f t w a r e p r o v i d e s a d r a m a t i c e x p a n s i o no f w o r k s p a c e m e m o r y . A l s o , t h e e x t r a

m e m o r y c a n w o r k a s a p s e u d o d i s k f o ri n s t a n t a c c e s s . ( N o m o r e 2 0 - s e c o n dsearches') T h e S a t u r n RAM b o a r d i s as u p e r a i d f o r a d v a n c e d w o r d p r o c e s s -i n g , d a t a b a s e m a n a g e m e n t , s p r e a ds h e e t , a n d a c c o u n t i n g a p p l i c a t i o n s .A n d p e r f e c t w i t h P A S C A L , C P /M®,a n d B A S I C .

~ J~"~~~!....' , ..': II i'

'":b t +1 '1

~ : : ; - - ; z : : ,-:1 I. ~

L E.,ii-~-'-~ .z, .......~ • " ~... ': _'

" . - ~~~-"

• H F P M A N T I S S A S T A R T S A T $ 9 3 ( 5 B Y T E S )* S R P M A N T I X X A S T A R T S A T $ A 6 1 4 B Y T E S )t P R O D U C T M A N T I X X A S T A R T S A T $ 6 4 ( 5 B Y T E S )f

M A I L B O X E Q U $ F F U S E D F O R 6 5 0 2 C O M M U N I C A T I O Nf

M U L T D R M A C R O C O N T R O L S G E N E R A T I O N O F H U L T S E G M E N T SP N T I S E T ~ 1 S E T S P T R S T O M A N T I S S A B Y T E SP H T 2 S E T ~ 2P N T P R S E T 1 6 2 + & I + & 2 - S 9 E - $ A 6 - & 3 S E T P R O D U C T P T RC A R R Y S E T ~ 4 C A R R Y P R O C E S S I N G F L A GM U L T P N T I , P N T 2 , P N T P R , C A R R Y I N S E R T M U L T S E G M E N TC A R R Y S E T 0 T U R N C A R R Y P R O C E S S I N G O NP N T I S E T P N T l + 1

I F H ( P N T l - S A A ) , 2 L O O P U N T I L D O N E, P N T 2 S E T P N T 2 - 1

I F N ( P N T 2 - S 9 0 ) , - 5E N D H

*M U L T M A C R O G E N E R A T E S H U L T S E G H E N TL D A ~ 2 G E T B Y T E S T O B E M U L T I P L I E D

I F N ( ~ 2 = $ A 2 ) C H E C K I F E X T E N S I O N B Y T E A N DB E Q * + 1 3 - & 4 G E N E R A T E B R A N C H I N S T R I F S OL O B U

H U LA D D D ~ 3 A D D T O P A R T I A L R E S U L TS T D & 3

I F & 4 = 4 . 2 S U P P R E S S C A R R Y C H E C KB C C * + 4 I F & 4 ( ) 0

I N C & 3 - 1E N O M

• U s e o u r e a s i l y i n s t a l l e d c a r d s i n* M A I N P R O G R A M c o m b i n a t i o n - a n d g e t a w h o p p i n g

t 2 2 0 K o f V i s i C a l c w o r k s p a c e o n t h e0 0 0 0 O F F F S T A R T C L R M A I L B O X A p p l e l I e .O r s e n s a t i o n a l e n h a n c e m e n t s

0 0 0 2 9 6 F F W A I T L D A M A I L B O X W A I T F O R H U L T C O H M A N D o n A p p l e I I ,I I+ , F r a n k l i n , B a s i s a n d

0 0 0 4 2 A F e B P L W A I Tm o s t A p p l e c o m p a t i b l e s . W e e v e n h a v es o f t w a r e t h a t i n c r e a s e s y o u r A p p l e ' s

0 0 0 6 8 E 0 0 0 0 L D X 1 $ 1 ) m e m o r y i n B A S I C p r o g r a m m i n g u p t o0 0 0 9 9 F 6 2 SH $ 6 2 I N I T B Y T E 0 A N D 1 O F P R O D U C T 4 m e g a b y t e s !O O O B 9 6 A 2 L D A 1 A 2 A C C U M . C H E C K E X T N . B Y T E T h i s k i n d o f p e r f o r m a n c e r e q u i r e sO O O D 2 6 3 4 B H E A L L G O A L L T H E W A Y I F < > 0 s o p h i s t i c a t e d b a n k s w i t c h i n g a n d s u p -O O O F 9 7 6 6 S T A $ 6 6 I N l T L A S T B Y T E P R O D U C T A C C U M p o r t i n g s o f t w a r e t h a t w e o r i g i n a t e d ,0 0 1 1 1 0 9 E A O L O Y f A O D E A L I N G W I T H I N T E G E R S ? p r o v e d , and i m p r o v e d , B u y f r o m0 0 1 4 2 6 3 2 B N E N O I N T B R A N C H I F N O T t h e l e a d e r !0 0 1 6 I 0 9 E A 8 L D Y f A a D I T T O L e t u s h e l p y o u e x p a n d y o u r A p p l e ' s0 0 1 9 2 6 2 D B N E N O I N T p r o d u c t i v i t y F o r i n f o r m a t i o n o n o u r

f RAM b o a r d s a n d o t h e r T i t a n m i c r o c o m -t I N T E G E R M U L T I P L I C A T I O N p u t e r p r o d u c t s , s e e y o u r c o m p u t e r• ( 4 B Y T E 8 Y B Y T E M U L T I P L I C A T I O N S ) d e a l e r o r c o n t a c t : T i t a n T e c h n o l o g i e s ,

tI n c . , P o . B o x 8 0 5 0 , A n n A r b o r ,

0 0 1 B 9 6 A 7 L O A f A 7M I 4 8 1 0 7 ; T e l e p h o n e ( 3 1 3 ) 9 7 3 - 8 4 2 2 .

0 0 1 0 0 6 9 F L O B 1 9 F S a l e s a n d M a r k e t i n g by T h e MARKET ING

O O I F 3 D M U L R E S O U R C E GROup , C o s t a M e s a , C A .

0 0 2 0 D D 6 4 S T D f 6 40 0 2 2 M U L T f A 6 , f 9 F , f 6 3 , 4

E=~Titan ' I0 2 8 M U L T S A 7 , f 9 E , S 6 3 , 0 D O C A R R Y C H E C K H E R E0 0 3 8 MUll S A 6 , 1 9 E , $ 6 2 , 4 10 0 4 1 2 0 B O B R A S T A R T = : : : = - . . . . ! ! ! ! ! ! ! TECHNOLOGIES, INC.

IORMERLY SATURN S 'tSTEMS OF MICHK>AN

fAppl e is a r egi stered t rademark of Apple Comput er, Inc.

V isiCa lc i s a regi st er ed t rad emark o fV isiCo rp, Inc. ,iCP1M is a r eg ist er ed t rad emark o f D ig it al Rese arch. Inc . !

N o . 70 - March 1984 MICRO 6 7

Page 70: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 70/86

4.8-3.2= 1.6 millisecs, so the increase

in 'multiplication' performance is

20%. An aspect that also must be take

into consideration concerns the

extension byte. The extension byte is

only us to prevent losing precision

during the evaluation of expressions.

However, in our test program the

extension byte will always be zero,

since no temporary resul ts aregenerated. The 6502 multiplication

routine skips in this case 8 add/shift

operations on bit level and shifts the

product accumulator one byte to the

right instead. A similar thing does not

happen in the 6809 multiplication

routine; here the 20 multiplications are

executed always. Consequently, the

6502 has an inherent advantage, which

results in a gain of 3-4 sees, Adding this

to the 20 sees obtained above, we have

2.3-2.4 millisecs per 6502 FPmantissa

multiplication. This agrees with the

cycle-based time calculation in section2. The determination of the number of

cycles consumed by the 6809

multiplication routine is easy with the

help of the excellent FLEXdebugger; it

came up with 1560 cycles. Adding the

6502 driver overhead [i.e., 46 cycles),

the 6809 FP mantissa multiplication

should, therefore, last about 1.6

millisecs.

So, overall the cycle times fit

reasonably well with the timing

results. When multiplying fractional

numbers, you can expect a speed

improvement of about 10%-20% permultiplication. In the case of integers,

however, you will be faced with a

significant slowdown in execution

speed. For example, the program above

with A and B set to 10, rather than to

5/3, needs only .9 millisecs per 6502

multiplication, but [still] 1.6 millisecs

per 6809 multiplication.

The results above strongly suggest

that implementation of a 6809

multiplication routine in Applesoft is

not attractive. There is still hope

though, for BASIC09 somehow

manages to execute FP multiplication

in much less time. So, the question is:

How come the BASIC09multiplication

routine is so fast. After delving into the

BASIC09 interpreter to locate the FP

multiplication routine, the answer

appeared to be easy. In the first place,

BASIC09 doesn't use an extension

byte. This means that an FP

multiplication consists of 16 rather

than 20 byte by byte multiplications.

In the second place,it appeared that the

entire multiplication routine is written

68

0 0 4 3 D 6 A 90 0 4 5 3 D0 0 4 6 9 7 6 60 0 4 8 9 F 6 40 0 4 A0 0 6 2O O B B

O O C I D C 6 20 0 C 3 D D 6 50 0 C 5 9 F 6 20 0 C 7 O F 6 40 0 C 9O O F D0 1 2 40 1 3 E0 1 4 7 1 6 F E B 6

t F L O A T I N G P O I N T M U L T I P L I C A T I O Nt ( 1 6 D R 2 0 B V T E B V B V T E M U L T . )

*A L L L D B $ A 9M U LS T A $ 6 6

N O I N T S T X $ 6 4 I N I T B V T E 2 A N D 3 O F P R O D U C T A C CM U L T D R $ A 8 , $ A 2 , 3 , 4 G E N E R A T E 2 S E G M E N T SM U L T D R $ A 7 , $ A 2 , 3 , 0 G E N E R A T E 3 S E G M E N T SM U L T D R $ A 6 , $ A 2 , 3 , 0 G E N E R A T E 4 S E G M E N T S

L D D $ 6 2 T H R O W E V E R V T H I N G A W A Y E X C E P TS T D $ 6 5 T H E M O S T S I G N I F I C A N T B Y T E SS T X $ 6 2 R E I N I T P R O D U C T A C C .C L R $ 6 4M U L T D R $ A 6 , $ A l , 0 , 0 G E N E R A T E 4 S E G M E N T SM U L T D R $ A 6 , $ A O , 0 , 0 G E N E R A T E 3 S E G M E N T SM U L T D R $ A 6 , $ 9 F , O , O G E N E R A T E 2 S E G M E N T SM U L T D R $ A 6 , $ 9 E , O , 4 G E N E R A T E 1 S E G M E N TL S R A S T A R T

Figure 8

0 0 0 0

0 0 0 00 0 0 0 9 6 9 F0 0 0 2 2 7 0 70 0 0 4 D 6 A 60 0 0 6 3 D0 0 0 7 D 3 6 30 0 0 9 D D 6 3

* S A M P L E M A C R O E X P A N S I O NO R G $ 0 0 0 0

*t D E F I N E M U L T D R H A C R O

*M U L T D R M A C R OP N T I S E TP N T 2 S E TP N T P R S E TC A R R Y S E T

H U L TC A R R Y S E TP N T I S E T

I F NS E TI FE N D M

P N T 2

& 1& 2$ 6 2 + & 1 + & 2 - $ 9 E - $ A 6 - & 3HP N T 1 , P N T 2 , P N T P R , C A R R YoP N T I + 1( P N T H A A ) . 2P N T 2 - 1( P N T 2 - $ 9 D ) , - 5

f

t D E F I N E M U L T M A C R O

•H U L T M A C R O

L D AI F NB E QL D BM U LA D D DS T DI FB C CI N C

E N D M

& 21 . 2 = $ A 2 )1 + 1 3 - & 4& 1

G E T B Y T E S T O B E " U L T I P L I E DC H E C K I F E X T E N S I O N B Y T E A N DG E N E R A T E B R A N e I N S T R I F S O

& 3& 3H = 4 , 21 + 4& 3 - 1

A D D T O P A R T I A L R E S U L T

S U P P R E S S C A R R Y C H E C KI F HO O

t

* S A M P L E E X P A N S I O N O F M U L T " A C R O

M U L TL D AB E gL D BM U LA D D DS T DE N D "

MICRO

$ A 6 , $ 9 F , $ 6 3 , 4$ 9 F G E T B Y T E S T O B E M U L T I P L I E D* + 1 3 - 4 G E N E R A T E B R A N C H I N S T R I F S O$ A o

$ 6 3 A D D T O P A R T I A L R E S U L T$ 6 3

(Continued on next page)

No. 70 - March 1984

Page 71: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 71/86

Figure 8. Note: This is a sample of the expandedMACRO's: MUL T and MULT OR .

t S A " P L E E X P A N S I O N O F " U L T D R " A C R O

O O O B

O O O BO O O B 9 60 0 0 0 2 7O O O F D 60 0 1 1 3 D0 0 1 2 D 30 0 1 4 D D0 0 1 6 2 40 0 1 8 O C

0 0 1 A

0 0 I A 9 6O O I C 2 7O O I E D 60 0 2 0 3 D0 0 2 1 D 30 0 2 3 D D0 0 2 5 2 40 0 2 7 O C

0 0 2 90 0 2 9 9 6

0 0 2 B 2 70 0 2 D 0 60 0 2 F 3 D0 0 3 0 D 30 0 3 2 D D0 0 3 4 2 40 0 3 6 O C

0 0 3 80 0 3 8 9 60 0 3 A 2 7

0 0 3 C D 60 0 3 E 3 D0 0 3 F D 30 0 4 1 D D0 0 4 3 2 40 0 4 5 O C

*0 0 A 6 P N T IO O A I P N T 20 0 6 5 P N T P R0 0 0 0 C A R R Y

A IO BA 6

6 56 50 26 4

0 0 0 0 C A R R YO O A 7 P N T IO O A O P N T 2

A OO BA 7

6 56 50 26 4

0 0 0 0 C A R R Y0 0 A 8 P N T I0 0 9 F P N T 2

9 F

O BA 8

6 56 50 26 4

0 0 0 0 C A R R Y0 0 A 9 P N T I0 0 9 E P N T 2

9 EO B

A 9

6 56 50 26 4

0 0 0 0 C A R R YO O A A P N T I

" U L T D R $ A 6 , $ A I , 0 , 0S E T $ A 6S E T $ A IS E T $ 6 2 + $ A 6 + $ A I - $ 9 E - $ A 6 - 0S E T 0H U L T P N T I , P N T 2 , P N T P R , C A R R YL O A P N T 2 G E T B Y T E S T O B E " U L T I P L I E DB E Q t + 1 3 - C A R R Y G E N E R A T E B R A N C I N S T R I F S OL O B P N T I" U LA D D D P N T P RS T D P N T P RB C C 1 + 4I N C P N T P R - IE N D HS E TS E TS E TH U L T

L D AB E QL O B" U LA D D D P N T P RS T D P N T P RB C C 1 + 4I N C P N T P R - IE N D HS E TS E TS E TH U L TL O A

B E QL O BH U LA D D DS T DB C CI N CE N D "S E TS E TS E TH U L TL O AB E Q

L O BH U LA D D D P N T P RS T D P N T P RB C C 1 + 4I N C P N T P R - IE N D "S E T 0S E T P N T I + IE N D "

A D D T O P A R T I A L R E S U L T

I F C A R R Y O O

oP N T 1 + lP N T 2 - 1P N T I , P N T 2 , P N T P R , C A R R Y

P N T 2 G E T B Y T E S T O B E H U L T I P L I E Dt + 1 3 - C A R R Y G E N E R A T E B R A N C I N S T R I F S OP N T I

A D D T O P A R T I A L R E S U L T

I F C A R R Y ( ) O

oP N T I + IP N T 2 - 1P N T I , P N T 2 . P N T P R . C A R R YP N T 2 S E T B Y T E S T O B E " U L T I P L I E D

H I 3 - C A R R Y G E N E R A T E B R A N C I N S T R I F S OP N T I

P N T P RP N T P R1 + 4P N T P R - I

A D D T O P A R T I A L R E S U L T

out completely. This means that all

loop and pointer overhead - which

accounts for roughly 50% of the

execution time - is eliminated. As a

result, the BASIC09 mantissa

multiplication requires, on the average,

only about 750 cycles 0.75 millisecs

per mantissa multiplication.

The best way to improve FP

multiplication seems, therefore, to usethe BASIC09 approach. Though this

takes many bytes of code, the increase

in performance is impressive. Figure 7

displays the listing of a source file that

cane used to generate a loop- and

pointeriess multiplication routine. The

file can be assembled with the FLEX

assembler and installed with the 5

steps outlined above. Two macros

have been defined; the first IMULTDR)

controls the generation of the byte by

byte multiplication segments and the

second (MULT) generates the

multiplication segments itself. As canbe seen, the mantissas of MFP and SFP

are checked on zero-bytes. If the last

two bytes of both mantissas are zero a

fast integer multiplication routine' is

used.

The execution time of the routine is

39 sees for the program in Figure 6.

That means 3.9-3.2 =.7 millisecs per

multiplication, implying a speed

improvement of 65% relative to

Applesoft. When setting A and B to 10,

a multiplication takes only .2

millisecs, so integer multiplication is

improved by more than 75%. The

routine also speeds up other Applesoft

functions. For example, the

computation time for the SIN function

is reduced by approximately 40% and

the computation time for the SQR

function by about 45%.

Conclusion

The best way to significantly speed up

Applesoft multiplication with the 6809

is to use a fully expanded

multiplication routine. Such a routine

consumes a lot of memory, but the

increase in performance [a 65%-75%

reduction in the execution time of a

multiplication) gives a good pay-off.

' I

. I,

I F C A R R Y O O

oP N T 1 + 1P N T 2 - 1P N T I , P N T 2 , P N T P R , C A R R YP N T 2 S E T B Y T E S T O B E " U L T I P L I E Dt + 1 3 - C A R R Y G E N E R A T E B R A N C I N S T R I F S O

P N T I

A D D T O P A R T I A L R E S U L T

I F C A R R Y O O

t

E N D

Cornelis Bongers may be reached at

Erasmus University, Postbox 1738, 3000

DR Rotterdam, The Netherlands.

No. 70 - March 1984 MICRO 69

Page 72: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 72/86

Compile

Your BASIC

Subroutines

by Ann Marie Lancaster and Cliff Long

Interpreted BASIC is easy to use but slow, andCompiled BASIC is fast but difficult to use. Thissolution combines the best of both and workswith machine language, too

Not only is BASIC a readily available

language for micros, but its interpretivenature offers some advantages for

program development. Unfortunately,

execution speed is not one of these

advantages. Compilers are now readily

available for BASIC, and we have been

using the Microsoft version with our

Apple II's. The execution time for a

specific surface plotting program (with

hidden line removal) dropped from

about three minutes to thirty-three

seconds when compiled. Such time

reductions seem typical of our

applications and certainly lead to

substantial savings for regularly usedprograms. The one time compilation

does take a few minutes longer than a

regular program execution.

If the total surface plotting program

is compiled, then each new surface

description requires a new compile step

because function changes require a self-

modification of the BASIC program [L],

Since, for classroom gr a p h ic s

applications, it is convenient to modify

the defining function frequently

depending on the homework problems

or the whim of the questioning

students, we decided to compile the

slowest subroutine (the hidden line

part) of the program. This allows us to

change the function and viewing

direction many times during a typical

program execution without having to

recompile. Hence, while part of the

main program is running in interpreted

BASIC, the slowest portion has been

replaced by the fast running compiled

form, thus giving us a very efficient

IIcanned program" running at close to

the machine code speed (without the

70

tedious machine language

programming).{Ed. Note: Of course, if youenioy machine language programming, the

technique discussed here will still work and

be usejul.]

When we compiled the subroutine

and attempted to call it from a BASIC

program, we encountered a difficulty.

The Microsoft compiler was not

designed for compiling subroutines

which are to be called from a BASIC

program. Unfortunately, the execution

of the compiled routine erases many of

the pointers used by the main program.

Hence, these pointers need to be

preserved for later recall in order toreturn to the calling program. We

include here our solution to this

problem with the Microsoft compiler

in the hope that you can incorporate it

directly or find a way to modify it for

your own use. In our case, the results

were well worth the effort.

Two interface routines were

written; one routine creates a path

from the BASIC program to the

compiled subroutine and the second

creates a path from the compiled

program back to the BASIC program.

These are presented in Listing 1.

YBASIC

P ROGRAM

IENTRy l

-,I EXIT]

C OM P ILE D _/

S UBROUT I N E

The routine ENTRY performs the

following functions:

1. Retrieves from the stack the

return address in the BASIC

MICRO

interpreter and saves it for

use by routine EXIT;

2. Stores the contents of all 256

page zero locations;

3. Transfers control to the

compiled subroutine.

Routine ENTRY is called from the

BASIC program. During execution of

the compiled program, the contents of

several page zero locations are altered.

Consequently, the original contents of

these locations have to be saved in

order to resume execution of the BASIC

program following the call to the

compiled subroutine.

The routine EXIT performs the

following functions:

1. Restores to the top of the

stack the return address in

the BASIC interpreter saved

by routine ENTRY;

2. Restores the contents of the

page zero locations;

3. Issues a "re t urn from

subroutine' command.Routine EXIT is called from the

compiled subroutine. The functions it

performs are necessary in order to allow

execution of the BASIC program to

resume at the statement following the

call to the routine ENTRY.

We stored these routines in the first

part of page three in memory which is

available for user programs. A page of

memory is also needed to save the

contents of page zero prior to execution

of the compiled program. Since our

programs did not open any disk data

files, we used a page ($96) allocated toDOS as a file buffer. Obviously, any

unused memory page could be used.

Figure 1 illustrates the use of the

ENTRY and EXIT routines. Both

routines have been stored in a disk file

called ENTRY-EXIT ROUTINES.OBT.

Note that the addresses appearing in

the assembler Listing 1 are given in

base 16, whereas the addresses used in

the programs below are in base 10.

(Note: 30016 = 76810 and 31A16 =

79410.)

One should note that the last line of

routine ENTRY of the assembler listingis a jump to the compiled subroutine.

In this example, the address is $684C.

This address will change depending

upon where you wish to store this

routine in memory. If your BASIC

program calls more than one compiled

subroutine, the same ENTRY and EXIT

routines can be used by changing the

address portion of the JMP statement

before the call to the ENTRY routine.

This can be done using the BASIC

POKE statement.

No. 70 . March 1984

Page 73: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 73/86

Consider the following example.

We are assuming that the first

compiled subroutine is stored at $1040

and the second is stored at $6200. Note

that the address in the JMP instruction

is stored low-byte followed by high-

byte. [Note: 1016 = 161014016 = 6410

and 6216 = 9810.)

Figure 1

M A I N P R O G R A M

Figure 2

M A I N P R O G R A M

4 0 0 P R I N T C H R $ ( 4 ) + ' B l O A D E N T R Y - E X I T R O U T I N E S . O B J "4 0 0 P R I N T C H R $ ( 4 ) + ' B L O A D E N T R Y - E X I T R O U T I N E S . O B J "

2 0 0 0 R E H C A l l F I R S T C O M P I L E D S U B R O U T I N E2 0 1 0 P O K E 7 9 2 . 6 4 R E H S T O R E L O W - B Y T E O F A D D R E S S2 0 2 0 P O K E 7 9 3 , 1 6 R E M S T O R E H I G H - B Y T E O F A D D R E S S2 0 3 0 C A L L 7 6 8 R E M C A l l E N T R Y R O U T I N E

4 0 0 0 R E M C A l l S E C O N D C O H P I l E D S U B R O U T I N E4 0 1 0 P O K E 7 9 2 , 0 0 R E H S T O R E L O N - B Y T E O F A D D R E S S4 0 2 0 P O K E 7 9 3 , 9 8 R E M S T O R E H I 6 H - B Y T E O F A D D R E S S4 0 3 0 C A L L 7 6 8 R E H C A L L E N T R Y R O U T I N E

2 0 0 0 C A L L 7 6 8 R E M C A L L E N T R Y R O U T I N E

S U B R O U T I N E T O B E C O M P I L E D

C A l l 7 9 4 R E M C A l l E X I T R O U T I N E

APPLE Rela ll D lscounl Rela ll D lsco,n l ATARI Ralall D iscounl Re la,1 Dlsco ,n l

M A N Y M O R E P R O G R A M S A V A IL A B L E V IS A A N D M A S T E R C A R D A C C E P T E D E _ : -

TERMS: Send check or money orderfor total purchase price, plus $2.00for shipping. MI residents add 4%tax. C.O.D. accepted.

® M FG S_ T R A DEM ARK

~.appla®EliminalorW arAdvenlure landPi r ales Adven lu reGo ldenVoyageMag ic W i n dowTemp le o f Ap s ha iUp p er Rea ch e so f Ap s ha iC urs e o f R aM i dway Campai gnH i ·Res Comput er Go l fDOSBossTh e A r ca d e Mach in eS t ar B l aze rChopl i f terSerpenl ineDead ly Sec re ts

Ras te r B las te rBu g A t ta c kTh e HomeAc co u n ta n tSn a ck A t ta c kP ig P e nWordraceRendevousRu s sk i Du c kHo ri z o n VSargon If

$29. 95

24.9529. 95

29. 9529. 95

99. 9539. 95

19. 9519. 9516 . 0029. 9524 . 00

44.9531 . 9534.9534.95

34.95

29. 9529. 9574 . 95

29. 9529. 9524.95

39. 9534.9534.9534.95

lark I 39.95 29 .0 0 Thresho ld (d )lark I I 3 9.95 29 .0 0 Sn ak e B y te ( d)Deadl ine 49.95 36 .0 0 Spa ce Egg s ( d )

21 . 00 Master type 39 .95 29 .0 0 Bandi ts ( d )

lB .OO Cas t le Wo l fens te in 29.95 21 .0 0 Co lo r P r in t ( d )21 . 00 Super te x t I I 1 50 .0 0 1 0B .0 0 Can yo n C l im be r ( d )21 . 00 So ft c ar d P r em i um Sys tem 7 75 .0 0 60 0.0 0 Shoot in g A r ca d e ( d ) ( t)21 . 00 W i z ar d a nd t he P ri nc es s 32.95 24 .0 0 Pa c if ic Co a st H i ghwa y ( d ) (I )12.00 T ime Zone 99.95 7 2 .0 0 C lo w ns A n d B a ll oo ns ( d) ( t)29. 00 C r an s to n Mano r 34 .95 25 .0 0 Wo r dr a ce ( d )15 . 00 Threshold 39 .95 29.0 0 Andromeda (d )15 . 00 So f tpo rn Adven tu re 29.95 21 .0 0 Dead l ine (d )12. 00 Crossf ire 29.95 21 .0 0 Z or k I (d )21 . 00 Frogger 34.95 25 .0 0 la rk II (d )lB .OO L af f P a k 34.95 25 .0 0 A li en Sw ar m ( d)33. 00 U l tim a I I 59 .95 44 .0 0 Ac ti on Que s t ( d ) (I )23. 00 Screenwr i te r I I 1 29.95 94 .0 0 Gho sl En c ou n te r s ( d ) ( t)25 . 00 Graph ics Mag ic ian 59 .95 44 .0 0 K -Razy Sho ot ou l ( c )25 . 00 P ie Ma n 29.95 21 .0 0 K -Razy K r it te r s ( c )25 . 00 Faslgammon 24.95 lB .O O U lt im a I ( d)

21 . 00 Congo 34.95 25 .0 0 A li B a ba a nd F o rt y T h ie ve s ( d)21 . 00 Goldrush 34 .95 25 .0 0 De lu x e I n va d er s ( c)54 . 00 Gorgon 39 .95 29.0 0 Ga r ! ( e )21 . 00 Bee rRun 29 .95 21 .0 0 W iz ard o f W a r ( e )21. ( ' () Sna ke By te 29 .95 21 .0 0 P r ep p ie ( d) ( t)

lB .OO T ig ers i n T h e S no w (d ) ( I)

2 9 .0 0 A P P LEI ~ ~~ ~ ~~ ,~ o ;; sd k ~r~~~~26500 Ghostly M anor ( d)

2 5.0 0 V ER BA T IM /D A TA LI FE D is ks $26.";' R aster B lasler ( d)

~~.~L------___:__:...:.::....:..~SPECIAL OFFERS

STROM = =P.O . Bo x 197 SYSTEMS INC.

P ly mo u th . M i. 481 70

( 31 3 ) 4 55 -8 0 22

$39. 95

29. 9529. 9534.95

39. 9529. 9529. 95

29. 9529. 9524.95

34.9549.95

39. 9539. 9534.9529. 95

29. 9549.9549.9539. 95

32. 9539. 95

49. 9549. 95

29. 9539. 9524.95

29. 95

)I\.A T A R r·-~-'·-o24 .95 lB .O O1 9.95 15 .0 0

39 .95 29.0 0

59 .95 45 .0 044.95 33.0 044.95 33.0 0

44.95 33.0 07 9.95 60 .0 0

39.95 29.0 019 .95 15 .0 0

1 9.95 15 .0 016 .0 0 12.0 0

29.95 21 .0 029.95 21 .0 0

34 .95 25 .0 031 .95 24.0 0

32.95 24.0 029.9 5 21 .0 029.9 5 21 .0 0

34.9 5 25 .0 039.95 29 .0 0

39.95 29 .0 04995 39.00

29. 00

21 . 0021 . 00

29. 0029. 00

21 . 0021 . 0021 . 00

21 . 00lB.OO25 . 0036 . 00

29. 0029. 0025 . 0021 . 00

21 . 0036 . 0036 . 0029. 00

24 . 0029. 00

36 . 0036 . 00

21 . 0029. 00

18 . 00

21 . 00

teceeserteD=Dsk

C=Cartridge

Rea rGua r d ( d)Re a rGua r d (I)

Ca ve rn s o f Ma rs ( d)Atar i Basic (c)S t ar Ra id e rs ( c )Cen t ipede (c )P ac M a n ( c )P i lo t ( c )T emp le o f A p sh a i ( d) ( t)Up p er Rea ch e so f Ap s ha i ( t)C u rs e o f R a ( d)M i dwa y Campai g n ( t)Ap p le Pa n i; : ( d )T ra ck A tt ac k ( d)Chop l if t e r (d )S ta r B la z er ( d)

W i za rd a nd t he P ri nc es s ( d)J awbr e ak e r ( d) ( t)C r os s fi re ( d) ( I)F r og g er ( d ) ( I )Th e Sha tt er e d A l li an c e ( d )B a tt le o f S h il oh ( d)Submarine Commander (cl

WRITE OR CALL FOR FREE CATALOG

PHONE ORDER HOURS

4 PM • 9 PMMON.• FRI.INCLUDE CARD NUMBER

AND EXPIRATION DATE WITHCREDIT CARD ORDERS.

INCLUDE TYPE OF COMPUTER.

Page 74: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 74/86

Subscribe to

MICRO ...Save 20% andwe'll send you aBONUS GIFTwith your subscription!

Fill out the attached

card and mail today'

CHOOSE FROM:

* Best of MICRO Vols. 2 and 3

An $18.00 Value - FREE!

or

* MICR0Calc for Apple, Atari, TRS-80, or e6 4

A $14.95 Value - FREE!

or

* MICRO on the APPLE, Vol. 3A $24.95 Value for $12.00

Page 75: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 75/86

SAVE20 /0 !

e This

rd To

scribe ...Or Call

Toll·Free

In PA 1·800·662·2444)

o YES! Enter my subscription to MICRO for just $24.00!

and with it send me the BONUS GIFT I've checked.

o Best of MICRO Volumes 2 an d 3. An $18.00 Value -- FREE!

o MICRO Calc for 0 Apple 0 Atari 0 TRS80 0 C64

A $14.95 Value -- FREE!

o MICRO on the APPLE-Vol. 3 A $24.95 value - Only $12.00

Please rush my subscription and the BONUS GIFT I've checked to: I'm paying by: OCheck OMO

OVISA OMC

Name __

Address ___

City State Zip _

Total Enclosed:$ _

Visa/MC H _ _ _

I A i C R OM , sNewest Books

NEW for VIC·20 Users!

Mastering Your VIC·20With 8 BASIC Projects

A book that makes learning to program your

VIC-20 fun! Contains 8 projects and programs.

Games, utilities -- even a VIC-20 version of

"VisiCalc." All 8 programs on cassette to help you

lea rn faster.

o Mastering the VIC-20 @ $19.95

NEW for OSI Users!

MICRO on the 051

Includes Machine-Language enhancements and

BASIC Aids, hardware modifications for

enhanced/reversed video, programs for control

code and upper/lower case entry. A valuable pro-

gramming tool.

o MICRO on the OSI - Now Only $14.95

Please rush the MICRO Books I've checked above to:

Visa/MC H _ _ _

I'm paying by: 0 Check 0 MO

o VISA 0 MC

Total Enclosed: $(Add $2,00 s/h per book.)

Name __

Address ~----------------

City State Zip _

(Allow 6-8 weeks lor delivery)

I A i C R O TM , S Best Sellers

The Best of MICROMake your computer reference

library complete by adding the "Bestof MICRO" to your present book col-

lection. Each volume full of articles

and programs pulled from the pages

of MICRO. Excellent software at a

very low price!

o BOM Volume 2 @ $8.00

o BOM Volume 3 @ $10.00

Please rush the MICRO Books I've checked above to:

Best Sellers forAPPLE Users!

MICRO on the APPLE

What's Wherein the Apple

Revised new edition with Apple lie

information added to original

atlas and gazetter. All Apple users

will find this book helpful in

understanding their machine and

essential for mastering it.

o What's Where in the Apple

@ $19.95

Programming aids, utilities,games, enhancements. TogetherVolumes 1, 2, and 3 contain over100 programs on diskette. Fullydocumented and explained.

o 3-Volume Gift-Boxed @ $59.95

o Vol.20 Vol.3 $24.95 ea_

I'm paying by: 0 Check 0 MO

o VISA 0 MC

Total Enclosed: $(Add $2.00 5/h per book.)

(Allow 6-8 weeks lor delivery)

______________ State Zip _

Exp. Date: ___A residents add 5% sales tax.

Visa/MC H ~. _

Page 76: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 76/86

NO POSTAGENECESSARYIF MAILEDIN THE

UNITED STATES

SAVE

200/0!!!!

Subscribeto

I A l C A O ·

B U S IN E S S R E P LY C A R DFIRST CLASS PERMIT NO. 60, CHELMSFORD, MA

POSTAGE WILL BE PAID BY ADDRESSEE

Use This Postage

Paid Card to Order

the Next 12 Issues

of MICRO and SAVE

$6.00 OffNewsstand Price!

P.O. Box 6502Chelmsford, MA 01824

NO POSTAGENECESSARYIF MAILED

IN THEUNITED STATES A Feast Of

Computin~

Ideas ...U S IN E S S R E P LY C A R D

FIRST CLASS PERMIT NO. 60, CHELMSFORD, MA

POSTAGE WILL BE PAID BY ADDRESSEE

New Book~From

P.O. Box 6502Chelmsford, MA 01824

IA iCAO'

NO POSTAGENECESSARYIF MAILEDIN THE

UNITED STATESOrder These

BestSellers

B U S IN E S S R E P LY C A R DFIRST CLASS PERMIT NO. 60, CHELMSFORD, MA

POSTAGE WILL BE PAID BY ADDRESSEE From

P.O. Box 6502

Chelmsford, MA 01824

Page 77: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 77/86

Listing 1 ; E N T R Y - E X I T R O U T I N E

0 3 0 0 O R S $ 0 3 0 0

;

9 6 0 0 F R E E E Q U $ 9 6 0 0 ; F R E E P A G E O F H E M O R Y6 8 4 C S U B R E Q U $ 6 8 4 C ; A D D R E S S O F C O H P I L E D S U B R

;0 3 0 0 4 C 0 5 0 3 E N T R Y J H P A R O U N D

S u r e3 0 3 S A D D R D F S 20 3 0 5 6 8 A R O U N D P L A ; R E " O V E A D D R E S S F R O H S T A C K

it's ituiIr«IP3 0 6 8 D 0 3 0 3 S T A S A D D R ; S A V E F O R E X I T R O U T I N E0 3 0 9 6 8 P L A0 3 0 A 8 D 0 4 0 3 S T A S A D D R + 1 S A F E W A R E s MIn su ra nc e p ro v id e s f u l l

0 3 0 D A 2 0 0 L D X 1 $ 0 0 ; I N I T I A L I Z E L O O P C O U N T E R r e p l a c em e n t o f h ar d w a r e , m e d i a a n d

0 3 0 F 8 5 0 0 S A V E L D A $ O O , X ; S A V E C O N T E N T S O F P A G E Z E R O p u r ch as e d s o f tw a re a ft e r a lo w $ 50 d ed uc ti b le .

0 3 1 1 9 D 0 0 9 6 S T A F R E E , X ; " F R E E " P A G E O F M E H O R Y A s l i t t l e a s $ 35 I y r c o v e r s :

0 3 1 4 E 8 I N X • F ir e • T he f t • P ow e r S u rg e s

0 3 1 5 D O F 8 B N E S A V E• E ar t h q u a k e • W a t e r D am ag e • A u t o A c c id e n t

0 3 1 7 4 C 4 C 6 8 J H P S U B R ; J U H P T O C O M P I L E D S U B R O U T I N ES e l e c t t h e c O ( l( !r a g e y o u wantf r o m t h e f a b l e .

Amount of Insurance Annual Premium

; UP /o $ 2 .( J( )( ) $ 35

0 3 1 A 6 8 E X I T P L A ; R E H O V E A D D R E S S F R O H S T A C K $ 2 ,0 01 -$ 5 ,( J() () $ 60

0 3 1 8 6 8 P L A j T H I S A D D R E S S I S N O T N E E D E D $ 5 ,0 01 -$ 8 ,(J () () $ 75

0 3 1 C A D 0 4 0 3 L D A S A D D R + l ; R E S T O R E R E T U R N A D D R E S S $ 8 ,OO1-$1 l ,( J () ( ) $9 0

0 3 1 F 4 8 P H A T O T O P O F S T A C K su . 001-$14 , ( J () ( ) $105

0 3 2 0 A D 0 3 0 3 L D A S A D D R C a ll f or h ig he r c ov er ag es

0 3 2 3 4 8 P H AN o t a va i l . i n A K . !lr.. H I. K Y ,IA \IE. . \ I S , ~;v, C , o r w y ,

0 3 2 4 A 2 0 0 L D X 1 $ 0 0 ; I N I T I A L I Z E L O O P C O U N T E RC a ll f o r im m e d ia te p r o te c t io n .

0 3 2 6 S D 00 96 R E T L D A F R E E , X ; R E S T O R E P A G E Z E R O 1-800-848-34690 , 3 2 9 95 0 0 S T A $ O O , X

( In Oh i o ca ll 1 -BOO-848-2112)0 3 2 B E B I N X

Oi l ! I II)3 2 C D O F a B N E R E T0 3 2 E 6 0 R T S ; R E T U R N T O B A S I C I N T E R P R E T E R C OL UM B IA N AT IO NA L G EN ER A L A GE NC Y

0 3 2 F E N Dj\ICR()'"

I t h a s c O l e t o o u r a t t e n t i o n t h a t t h e r e w e r e a n U l b e r o f e r r o r ~ i n t h e p r e v i o u s l y p u b l i s h e d I n v e s t o r p r o g r a l b yJ O l e p h K l t t a n . N e h a v e t r a c e d t h e s e p r o b l e l s t o a n e w t r a n s l i s s i o n s y s t e l . M o s t o f t h e e r r o r s I r e l i l t e d b e l o w ,t h e r e l a y b e a f e w l o r e b u t w e w e r e a b l e t o r u n t h e p r o g r a l u s i n g t h e l i s t i n g g i v e n ( w i t h t h e c o r r e c t i o n s ) . O u ra p o l o g i e s , t h e p r o b l e l w i l l b e r e s o l v e d i n f u t u r e l i s t i n g s .

L i n e l B O a t t h e R e t u r n s t a t e l e n t i s t h es t a r t o f l i n e 1 8 5 .

L i n e 2 5 6 t h e l i n e w r a p s a r o u n d - 8 0 T O 2 4 1 -t h e n l i n e 2 6 0 b e g i n s .

L i n e 3 2 0 s h o u l d b e - 8 0 T O 3 1 5 , n o t 1 5 .L i n e 3 4 5 , s e c o n d l i n e , l i n e 3 4 5 b e g i n s .L i n e 3 4 7 , s e c o n d l i n e , l i n e 3 5 0 b e g i n s .L i n e 4 2 5 t h e '$' i s l i s s i n g - ( L E N ( N . ) + l ) .L i n e 4 5 0 t h e = s i g n i s l i s s i n g f r o l L = l - l .L i n e 1 0 0 0 t h e E i s l i s s i n g f r o l R E M .L i n e 1 0 2 0 t h e I i s l i s s i n g f r o l I F .L i n e 1 1 1 0 , s e c o n d l i n e , l i n e 1 1 2 0 b e g i n l .L i n e 1 2 1 0 t h e 8 i s l i s s i n g f r o l t h e 8 0 T O .

L i n e 1 2 3 0 t h e w o r d ' t h e i r ' s h o u l d b e ' o t h e r ' .L i n e 2 5 0 0 t h e l i s s i n g n U l b e r s h o u l d r e a d

" I - F ( l l .L i n e 2 5 2 0 t h e l i s s i n g n U l b e r s h o u l d r e a d M X - 3 .

L i n e 3 0 1 0 t h e E i s l i s l i n g f r o l D A T E $ I t t h ee n d o f t h e Iie .L i n e 3 3 4 0 t h e - i s l i s l i n g f r o l T H E N N 2 - N l .L i n e 4 0 1 0 , s e c o n d l i n e , l i n e 4 0 1 5 b e g i n s ,

t h e 6 0 T O b e f o r e r e f e r e n c e s l i n e 2 0 0 0 .L i n e 5 0 0 5 t h e ' I ' i s l i s s i n g f r o l S ( B ) a t

t h e e n d o f t h e l i n e .L i n e 5 1 0 0 t h e ' I ' i s l i s s i n g f r o l ( 3 )

R A T E O F R E T U R N .

No. 70 . March 1984 MICRO 73

Page 78: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 78/86

Figure 1

Plotting Fractals

On YourComputer

by Simon W ardrop

Plotting fractals (irregular shapes) can often producebeautiful, even spectacular results, but they call intoquestion our common definition of length.

74 MICRO No. 70· March 1984

Page 79: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 79/86

What is a Fractal?

Briefly speaking, a fractal is a plane

shape in which the usual notions of

length and area cease to be useful. The

term was first coined by a French

mathematician, by the name of Bernoit

Mendelbrot, in his book, "Fractals:

Form Chance and Dimension" (W.H.

Freeman, San Francisco, 1977); it is

derived from the Latin word for

II irregular" or IIfragmented", which

aptly describes their typical appearance

(see Figure 1 for example]. A really

rigorous definition of a fractal would

require a long digression into a lot of

avoidable mathematics. However, it is

not difficult to write a program, for a

computer equipped with reasonably

high resolution graphics, to create

them. Apart from being an interesting

exercise in recursive programming

(that is, programming in which

"Stakko" or "LIFO data structures"

are employed), doing this is worth the

effort, as the results are often beautiful

and spectacular.

The "Snowflake Curve"

One of the simplest fractals is the so-

called "snowflake curve" or more

technically, "the triadic Koch island"

which was discovered early this

century by H. von Koch. This shape is

produced in the following way: begin

with an equilateral triangle, divide

F ig ure 4

When the point (XL,YL)is actually rightmost on the screen, we still want

the triangle sticking out, so:

c

x = XL + C /2 - Lsin(grad)

y = YL + 0/2 + Lcas(grad)

D

The code that produces the new triangle, on the line segment, (lines

540-580) assumes that the coordinates on the top of the stack, are not

only leftmost along the curve, but leftmost on the screen. Thus a typical

situation is:

x = XL + C/2 + Lsin(grad)

y = YL + 0/2 - Lcas(grad)

Thus, when XLis bigger than XR,we must replace Lby -L. Consequently

we have line 540 of the program.

No. 70 - March 1984 MICRO

each side into three, then replace each

middle segment by a smaller

equilateral triangle. Then repeat the

process on each new segment so

produced. The first few stages of this

construction are shown in Figure 2.

Actually, the program described in this

article draws only one third of the

snowflake curve. This decision was

made because of the limited resolution

available on computers. In order to

draw the entire snowflake a reduction

in size would have been necessary, and

so fewer "generations" could have

been produced; I opted for a closer look

at just one side.

The Program

The complete program is shown in

Listing 1. I do not think that theprogram is easy to follow, and neither

could I make it so. The process of

building the snowflake is

fundamentally recursive and BASIC

does not handle such processes well. I

had no choice in the language used, and

BASIC is still the most commonly

available language.

What the program does is this.

Firstly (line 40) the width and height of

the screen (SW,SH) are specified, and

then the minimum length (ML) of a

line segment in the final curve is given.

(This latter specification is necessary toprevent the process from going on

forever). Then the starting and ending

points of the baseline are pushed onto

the stacks xlp] , yIp) which operate in

"parallel." A subroutine is then called

which splits the line specified by the

topmost, and second topmost, entries

of the stacks into three, and then builds

a triangle. The resultant four line

segments then have their endpoints

pushed onto the stack, according to the

scheme shown in Figure 3. (Notice

that, at any stage, the endpoint which

is closest along the curve from the leftis at the top of the stack, while the next

closest is next on the stack.) We then

return to the main loop where the

length of the new segments [a.b.c.d] are

compared with the prescribed

minimum: if they are smaller, they are

popped from the stack and drawn (line

100), otherwise the subroutine is called

again.

The most obscure point of the

subroutine is line 540. The purpose of

this line of code is to ensure that, at

75

Page 80: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 80/86

Figure 5

76

Figure 2

forever

/\ - + 1 I I

Stage 1 Stage 2 Stage 3

Figure 3

Before Subroutine After Subroutine

forever

MICRONo. 70 . March 1984

Page 81: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 81/86

. . - . . _ - . - . - - - -. . - - . - ,A . -. . . . . . . . . 'W" . . . . . . . 'W . . . . . . . . . . . . . .. . . . . .. . . ....-. . . . . .....-

Listing 1

9 R E M * * * * * * C L E A R S C R E E N C O M M A N D I S M A C H I N E S P E C I F I C * * * * * * * * * * * * * *1 0 C L S : R E M C L E A R S C R E E N

1 1 R E M * * * * * * P R O V I D E T H E A P P R O P R I A T E C O D E F O R Y O U R C O M P U T E R * * * * * * * *2 0 D I M X ( 10 0 0 ) , Y( 1 0 0 0 )

3 0 R E M * * * * * * * * * * * * * * * * * * I N I T I A L I Z E V AR I A B L E S * * * * * * * * * * * * * * * * * * * * * *4 0 M L = 1 0 : S = . 5 : P = 3 . 1 4 1 b : S W = b 3 9 I S H = 1 9 9 : CZ - C O S ( P I l b ) / 35 0 X ( 1 ) = 6 3 9 : Y ( 1 ) = 1 06 0 X ( 2 ) = 0 : Y ( 2 ) = 1 07 0 P = 2

8 0 R E M * * * * * * * * * * * * * * * * * * B E G I N M A I N L O O P * * * * * * * * * * * * * * * * * * * * * * * * * * *L = S Q R ( ( X ( P ) - X ( P - 1 ) ) ' \ 2 + ( Y ( P ) - Y ( P - 1 ) ) "' 2 )

R E M * * * * * * * T H E N E X T L I N E I S M A C H I N E S P E C I F I C F O R P L O T T I N G * * * * * *I F L < M L T H E N L I N E ( X ( P ) , S H - S * Y ( P ) ) - ( X ( P - 1 ) , S H - S * ¥ ( P - 1 ) ) , P S E T : P = P - 1R E M * * * * * * * P R O V I D E T H E A P P R O P R I A T E C O D E F O R Y O U R C O M P U T E R * * * * * * *IF L ) M L T H E N G O S U B 500I F P>l T H E N G O T O 90: R E M W H I L E S T A C K N O T E M P T Y , R E P E A T P R O C E D U R ES T O P

R E M * * * * * * * * * * * * * * * * *R E M U * I i * U U * U U UX L = X ( P)C = X R - X L

G D I I A T N ( D / C )I F X R < X L T H E L = - Lx ( P + 3 l = X LX ( P + 2 ) = C / 3 + X LX ( P + l ) = C / 2 - L * S I N ( G O ) + X LX ( P + 0 ) = 2 * C / 3 + X LX ( P - l ) = X RP = P + 3R E T U R N

R E M * * * * * * * * * * * * * * * * * E N D O F S U B R O U T I N E * * * * * * * * * * * * * * * * * * * * * * * * * *

90

99

1 0 0101

1 1 01 2 01 3 01 4 0500

E N D M A I N L O O P * * * * * * * t I * * * * * * * * * * * * * * * * * * * * *S P L I T T H E I N T E R V A L U U U U * U t U U U U U * U

: Y L = Y ( P ) : X R - X ( P - l ) : Y R = Y ( P - 1 ): D = Y R - Y L : L = S Q R ( C * C + D * D ) * C Z

5 1 05 2 0

5 3 05 4 05 5 0 : Y ( P + 3 ) = Y L

: Y ( P + 2 ) = D / 3 + Y L: Y ( P + l ) = D / 2 + L * C O S ( G D ) + Y L: Y ( P + 0 ) = 2 * D / 3 + Y L: Y ( P - 1 ) = Y R

5 6 05 7 05 8 059 0

6 0 06 1 06 2 0

each splitting, the new triangles

actually do stick "outwards." The

logic behind this is shown in Figure 4.

The program was written for an

Hitachi Peach; however, it should run

on most machines with good graphics.

The only non-standard BASICused are

the statements LINE (Xl,Ylj-(X2,Y2),

PSET which draws a line from (Xl,Yl)

to (X2,Y2) and CLS which clears the

screen.

There are several extensions to the

program that could be made. One could

draw all three sides of the curve, and, of

course, Peach and Color Computer

owners can PAINT under the curve. To

improve the speed, one might remove

line 590 and the" + 0" in line 580; they

were included for clarity

There are many other related

"recursively defined" curves that can

be produced by the same algorithm as

that used in the program. Some

examples are shown in Figure 5. For

many other interesting Fractals, use

Bernoit Mandelbrot's book; the first

half of it is fairly easy reading, and

there are hundreds of good, computer

drawn, plates.

No. 70 - March 1984

Itwould seem tobe infinite. This is the

crux of Mandelbrot's book. He argued

for a new definition of length that

would, hopefully, be more useful for

the comparison of "lengths" and

"sizes" than the current scheme in

which every coastline has the same

length: infinity!

Some Properties of Fractals

There are several interesting features of

the snowflake curve that are worth

mentioning. Firstly, it has an infinite

circumference, but a finite area [afinite

area because you can enclose it in a

finite square, and an infinite length

because, at each stage, you replace the

three intervals by four of the same

length, and so increase the

circumference by a factor of 4/3; so

after infinitely many generations the

"coastline" of the 'island' is infinitely

long).This is not such an esoteric

property. It has been argued that actual

coastlines behave similarly. If you

measure the length of Australia's

coastline with a 1km "yardstick", you

will get a one figure, while if you

measure it with a 1metre' 'yardstick"

you will get another result which is

probably bigger than the first. Thus, as

you use smaller and smaller yardsticks

f and supposedly get increasingly more

accurate results), you get bigger and

bigger results. What then is the length?

MICRO

Conclusion

I hope that this article has sparked

some interest in the fascinating C'tuves

called "fractals", and demonstrated a

use for stacks other than sorting! There

are many possibilities forexperimentation. Mathematically the

field is far from dead; fractals are being

applied to things as commonplace as

soap bubbles, and as esoteric as the

"strange attractors" of differential

equations.

Simon Wardrop may be reached at 3

Gwenda Avenue, Blackburn, 3130,

Australia.

77

Page 82: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 82/86

~================~®

time required to move the disk

read/write head from one track to the

next to accommodate slower drives.

This can be set differently for each

drive on the system. The default for

5-1/4 disks is 6ms per track, but that

may be redefined to as slow as 30 ms

per track. Basically, if you are having

problems reading disks on a particulardrive, you can try slowing it down on

the assumption that you are not giving

the disk sufficient time to position the

head before a read or write operation.

There are also several other double

density disks compatible with the Atari

computers. MYDOS will support these

drives also. Some of these third party

disk drives, like the Trak drive

produced by Trak Microcomputer

Corporation at 1511 Ogden Ave.,

Downers Grove, Ill. 60515, retailing at

$499.00, also has a printer port with a

small built-in printer buffer (4K).

MYDOS also has added file

manager routines, accessible in BASIC

using the XIO command, to support

these new functions. On some, the

same XIO commands are available as in

Atari DOS, but the AUX1 and AUX2

bytes, normally zero for Atari DOS,

have some other information in them.

These control the type of formatting to

be done, the number of sectors on the

drive and so forth. XIO commands

added include things like creation of

new directories and setting the default

directory.

In addition, MYDOS 1.16 supports

the ATRSOOORS232 port. The basic

difference between this RS232 handler

and the one used with the S50 interface

is that MYDOS contains the handler as

an integral part of DOS. This means

that, if you are using DUP.SYS (DOS

command from BASIC) you don't lose

the RS232 handler. I t is simply always

there. This drawback to the S50

handler is particularly annoying when

working in machine language because

it is always required to append theobject file to the AUTORUN.SYS file

used to load the handler. In MYDOS,

the machine language routine that

accesses the RS232 port can be run

directly without worrying about

loading any handler.

From Here to Atari

I have been testing my ATRSOOO (a

peripheral discussed previously in

Micro No. 6S) in different modes this

month and am impressed by its

versatility. I recently acquired the

latest release of MYDOS which greatly

expands the capacity of the ATRSOOO

when used as an Atari peripheral.

MYDOS replaces the functions of Atari

DOS and adds others required to

support more features of the ATRSOOO.

MYDOS will act as a direct

replacement for Atari DOS when usedwith most programs. The only

exception I found is the result of a bug

in MYDOS not allowing random access

updating in files, but have received

word that the problem is being

addressed by the author of MYDOS,

Charles W. Marslett. MYDOS is

distributed by SWP Microcomputer

Products, Inc., in Arlington, Texas

76011, which is the company

producing the ATRSOOO.

Most of the additional features of

MYDOS concern the different

configurations of disk drives available

through the ATRSOOO.Supported in the

5-1/4 line are single sided single

density 40 track disks, like the S10

drives use, giving about 90K of storage,

to double sided double density SOtrack

drives which store over 700K. With a

$19.95 adapter for each, the ATRSOOO

will also support S drives. Single sided

S drives will hold almost 500K and

double sided S drives will hold 990K.

The net result of this is a lot more

storage capacity for the Atari computer.

For example, using four 5-1/4 double

sided double density SO track drives

yields about 2.S megabytes of on-line

storage. Four double sided S drives

would hold almost 4 megabytes. To

transfer back and forth from the single

sided single density Atari-compatible

disk formats there must be one such

disk on line, but for maximum storage

that drive can first be used to make the

transfers, then removed and replaced

with a larger capacity drive for actual

operation.

by Paul S. Swanson

On my system (until I go get a

double sided SO track 5-1/4 drive,

anyway) I have two TRS-SO drives

connected by a Radio Shack drive cable.

Used in double density mode this gives

me the equivalent of four Atari disk

drives, or about 360K. MYDOS will

allow me to define these disks as either

single or double density and will

automatically redefine them if, for

example, I put a single density disk in a

double density configured drive, or vice

versa. This automatic redefinition willwork in DOS mode, but is not

automatic once a program is running,

so before executing a program it is

important to verify that the disks are

configured the way you want to use

them.

Other interesting features in

MYDOS includes modification to the

DOS C (copy file), I (initialize) and J

(duplicate) commands. Copy may be

done from any filespec to any filespec,

and with the RS232 version of

MYDOS, version 3.16, a file may even

be copied from disk to the RS232 port,

which is not possible under Atari DOS

or without the ATRSOOORS232 port.

Initialized, used in Atari DOS as a

format command, can be specified to

format or just erase the diskette. The

duplicate command has two options.

First, only a certain range of sectors

may be specified. Second, the

destination drive may be either

forma tted or erased before the

duplication is done.

Another interesting feature of

MYDOS is the ability to create

multiple directories on one disk. This

eliminates the 64-file limit imposed

under Atari DOS. Each additional

directory is installed as the equivalent

of one file name in the main directory

and may also contain up to 64 file

names. Since the ATRSOOOsupports so

many different drive configurations,

some further control is also supported.

For example, different disk drives will

respond at different speeds. One of the

additional controls sets the amount of

You may contact Paul Swanson at 97

Jackson St., Cambridge, MA 02140.

78 No. 70 . March 1984ICRO

Page 83: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 83/86

Commodore

L I S T I N GC o m m a n d s

( C L E A R )

( H O M E l

(lN S E R f )

( D O W N }

( U P }

(R I G H T )

( L E F T )

C o l o r s

( B L A C k }

{ W H I T E }

{ R E D }

{ C Y N }

( P U R P L E }

( G R E E N }

( B L U E )

( Y E L L O W }

C R V S }

( R V S O F F }

MICRO Program Listing Conventions

C 6 4 K E Y B O A R D

~ ] " C L R

: : 1 H O M E

II " IN S T

: ~ ~ C R S R D O W N

:l"C R S R U P

• • C R S R R I G H T

II A C R S R L E F T

I C T R L 1 B L k

= -C T R L 2 W H T

~ C T R L 3 R E O

I I I . . . C T R L 4 C Y N

:1 C T R L 5 P U R

ii C T R L 6 G R NP:II C T R L 7 B L U0 : I l

m C T R L S Y E L

~ C T R L 9 R V S O N

!! C T R L I) R V S O F F

( O R A N G E } ;~ =

( B R O W N } P J = 2{ G R E Y 1 } ~ :: 3{ G R E Y 1 } :Il = 4

( G R E Y 2 ) ~~ = 5(LT G R E E N } II = 6

{U B L U E } :) = 7

( G R E Y ' : 3} ..I . . S••

F u n c t i o n s

{ F 1 J • f 1( F 2 } JI

~\ f '2

{ F 3 } !! f3

C F 4 } H,"

f 4{FS} II f 5(F6} :. ," f 6( F l ) II f 7

{ F S } • ,' " f S

S p e c i a l C h a r a c t e n

Afar;

C o n v e n t i o n s u s e d i n A TA R I L is t i n g s .

N o r i l l a l A lp h a n u l l e r ic a p p e a r a s U P P E R C A S E :

S A M P L ER ev e r s e d A lp n a n u l e r i c a p p e a r a s l o w e r c a s e :

y E S ( y i s r e ve rs e d)

S p e c ia l C o n t r o l C h a r a c te r s in q u o t e s a p p e a r a s :( c o ll a n d } a s f o l l o w s:

l i s t i n g

{ U P }

( D O W N }{ L E F T }

( R I G H T )

{ C L E A r n{ B A C n{ T A B }

(D E L ET E L IN E }

{ IN S ER T L IN E }

{ C LE A R T A B i{ S E T T AB }{ B E E P }

{ D E L E T E }

U N S E R T }{ C T R L A}

C o f t l i a n d A T A R I K e y s

C u r s o r U p E S C f C T R L -

C u r s o r D o w n E S C iC T R L =

C u r s o r L e f t E S C /C T R L +

C u r s o r R iQ h t E S c /C T R L f

C le a r S c r e e n iii E S C ! C L E A ~ :

B a c k S p a c e ~ E S C /B A C K SC ur s o r to Iab .. E S C / T A BD ele t e l in e 11 E SC /S H IF T D E LE T E

In s e r t L in e [JE SC /S H I F T IN S E R T

C le a r T a b S t o p EI E Sc /C T R L T AB

S e t T a b S to p ID E SC iS H iF T T AB

B e e p S p e a k e r ~ E S C iC T R L 2D e l ete C h a r . U E SC /C T R L B A C K 5I n s e r t C ha r . IlE SC iC T R L IN S ER T

S r a p h i c C h a r . . . C T R L A

w h e r e A i s a n y E r a p h ic L e t t e r K e y

N o n - K e y b o a r d C o m m a n d s

( D I S " ' )

\EN8=}

< L O W E R CASU

{ U P P E R C A S E }

{ " R E T U R N }

{DEl.}

(SPACE}

N o t e s :

C H R $ ( S )

C H R f · ? 1

CHR$(14)

C H R $ ( 1 4 2 )

C H R $ ( 1 4 2 1

CHR$(20)

C H Ri (1 61 )1

1 • " r e p r e s e n t s S H 1 rr K E Y

2. = r e p r e s e n t s C o m m o d o r e ~ e y 1 n

l o w e r l e f t c o r n e r o f k e y b o a r d

3. C T R L r e p r e s e n t s C I R L k e y

4. G r a p h i c s c h a r a c t e r s r e p r e s e n t e d

i n L i s t i n g b y k e y s t r o k e s r e q u l r e d

t o g en e r a t e t h e c h a r a c t e r

5 . A n u m b e r d i r e c t l y a f t e r a { S Y M B O L ;

i n d l c a t e s m u l t l p l e s o f t h e S Y M B O L :

( O O W N 6 } w o u l d m e a n D O W N 6 t i m e s

MICRO 79

( P r } 1 T ' P i C h a r

{ P O U N D } £ P o u n d S i g n

{ U p A R R O W } t U p A r r o w

( B A C K A R R O W ) ~ B a c k A r r o w

No. 70 . March 1984

Page 84: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 84/86

il ib l t m u u n ta inA fun and excit ing Bible educational game!

Our No. 1 seller is now better than ever!VERSION 3.0 now supports multiple choicequestions, has improved Hi-Res graphics andsound, and more!

• For2 to 20 players

• 60 question/answer set included• gives correct answers and scriptural referencewhen a question ismissed

• easily create, add, and edit your own

question/ answer sets

ForAople'll-. lie

48 k W IT H D IS K D RIV E ••cceptedAdd $1.50 Shipping Plus Handling

Order now and get the tree game

"BIBLETRATION!"

DEALER !NQUIRIES INVITED

J &M SOFTWAREDisks are not locked.O. Box 2132

Athens, Texas 75751

(214) 675-8479•APPLEsa regislered trademark01Apple Compuler. Inc

For affordable businesssoftware. put MICROSPEC in

MicroSpec is serious about offering sophisticated busi-

ness programs at an affordable price. And there's no

skimping on the quality or capabilities of the programs.

Whether you're using DBM. IN\/,GIL. PAY,AIR,Alp, Fixed

Asset, Rental Property Management. Mail List, or

Checkbook Manager you'll find MicroSpec programs

offer the greatest flexibility and optimum performance

for your specific needs.And you'll like the price!

ProvenMicroSpecbusiness programs areavailable NOW

for the Commodore 64 and VIC20 (trademarks of Com-modore). Applications for other popular micros will be

coming soon.

A leader in the design of affordable business systems -

MicroSpec.Put it in your memory.

Formore information, contact your local dealer.

MicroSpec. Inc.P.o.Box 863085 • Plano, TX 75086

(214) 867-1333

(Dealer inquiries welcome)

8 0MICRO

Advertiser's Index

A BComputers 25

Amdek Inside Back Cvr

Amplify 48

Artemis Systems 7

Computer Mail Order 12,13

Dennison Computer Supplies Back Cvr

Eastern House Software 33

J &M Software 80

Kiwi Software S5

Lazerware 14

MICRO Magazine . 5,61,72

Micro Spec 80

Micro Ware 58

Midwest Micro 9

Nibble 43

Percom Inside Front Cvr

Performance Micro Products 55

Perry Peripherals 34

Protecto 21,22,23

Safeware .. 73Skyles Electric Works 3

Specialty Electronics 7

Strom Systems 71

Titan Technology 67

Tot! Software . . . . . . . . . . 31

Winders &Geist 49

Zanim Systems .

National Advertising

Representatives

East Coast:John GancarzP.O. Box 6502Chelmsford, MA 01824 (617) 256-3649

Mid-West:Thomas Knorr & AssociatesThomas H. Knorr, Jr.333 N. Michigan Avenue, Suite 401Chicago, Ill inois 60601 (312) 726-2633

serving: Ohio, Oklahoma, Arkansas, Texas, North Dakota, SouthDakota, Nebraska, Kansas, Missouri, Indiana, Illinois, Iowa,Michigan, Wisconsin, and Minnesota.

West Coast:The R.W. Walker Co., Inc.Gordon Carnie2716 Ocean Park Boulevard, Suite 1010,Santa Monica, California 90405 (213) 450-9001

serving: Washington, Oregon, Idaho, Montana, Wyoming, Colorado,New Mexico, Arizona, Utah, Nevada, California, Alaska, and Hawaii

(also British Columbia and Alberta, Canada)

No. 70 - March 1984

Page 85: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 85/86

Computer 's

Choice .

Primage ITherevolutionary office duty; letter quality

daisy printer systemfrom Primages.In word processing and datacommunications applications,where high quality printing at highspeed means higher computerproductivity- The Primage Idaisyprinter by Primages is thecomputer's first choice.That's because Primage I,with

its PAGEMATE 1*sheet feeder,costs much less than any otheroffice-quality, high-speed daisy

printer. And because it's easyto interface with any micro-computer system .

• PAGEMATE is a trademark

o f Pr images, Inc.

Primage I features:

• 45 cps speed in heavyduty applications

• Word processingfeatures

• Consistent letterquality production

• Wide choice of fonts

• Easy connection toyour computer

• Easy to install sheetfeeder that handlesup to 11"x 14" sheets,either landscape orportrait

• Full 131h"writing line

• Switch selectablemultiple languages

• Patented technologyfor greater reliability

Main Office: 163 Reservoir Street, Needham, MA 02194 , ( 61 7 ) 4 49- 5600

Branch Off ices: P.O. Box 214, Rock Hill, CT 06067 , ( 20 3 ) 5 29- 912370 Oriole Drive, Bedford, NH 03102 , ( 60 3 ) 4 72- 2123

Page 86: Micro 6502 Journal March 1984

8/3/2019 Micro 6502 Journal March 1984

http://slidepdf.com/reader/full/micro-6502-journal-march-1984 86/86


Top Related