micro 6502 journal september 1984

76
8/3/2019 Micro 6502 Journal September 1984 http://slidepdf.com/reader/full/micro-6502-journal-september-1984 1/76 for the Serious Computerist Structure Tree Utility Introduction to FORTH FORTH Multl.Tasklng Time Series Forecasting TWERP o

Upload: cubemanpdx

Post on 06-Apr-2018

238 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 1/76

for the Serious Computerist

Structure Tree Utility

Introduction to FORTH

FORTHMultl.Tasklng

Time Series Forecasting

TWERP

o

Page 2: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 2/76

FLASH!Gets the Gold

at the Computer OlympicsThe Skyles Electric Works 1541

FLASH! dashed off with the gold atthe Computer Olympics here.The 1541FLASH! loaded and saved

programs and files three times fasterthan an unenhanced Commodore

" faster than 1541disk drive could.• • • • Faster than any otherany other disk disk drive with com-

drive" patible disk format.• • • Three times faster!The device delighted the homecrowd, which watched the 1541FLASH! set a meet record, and leaveits competition in the dust.Once installed, the 1541FLASH! is

transparent. Computer operationsall remain unaffected as it speeds upevery disk-related function. TheFLASH! is a permanent installationwith both a software (ROM)and ahardware component. Through key-

board commands or a hardwareswitch, you can even return to theold, slow loading method-if youreally want to.And there is nothing new to learn

for the FLASH! Nospecial tricks or

1541 FLASH !, an add-on assembly, for the Commodore 64/1541 costs only $79.95.

1

kyles Electric Works231 E South Whisman RoadMountain View, CA 94041(415) 965-1735

techniques. Once it's in, just watchit go.But if you're really serious about

programming, the 1541FLASH! is agold mine. The manual will show youhow to write software allowing datatransfer to and from the 1541disk

drive at speeds up to 10times thenormal.For programs that usually load

with a ..'*',8,1" command, just hitShift/Run-Stop. A spreadsheet pro-gram like BUSICALC 3 then loadsin about 25 seconds.The 1541FLASH! even adds 21ex-

tra commands for the Commodore64user. Some of these include edit-ing, programming and loading com-mands, as well as "DOS Wedge"commands. You can ignore all thesecommands, though, and just enjoythe rapid disk operations.

Hwowed the crowd at the Com-puter Olympics. Once you see itssheer speed, you'l l know why. Callits coach, Skyles Electric Works, toplace your order or to get more info.

Available 'from your localCommodore 64 dealer orcall1-S00-227-999S.1541 FLASH! i s a t rademark o f Sky les E lectric WorkS,

Commodore 64 is a trademark o f Commodore.

Page 3: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 3/76

Want to become an Apple expert?

Join the club.A.P.P.L.E.

Apple PugetSound Program Library Exchange

The Apple PugetSound Program Library Exchange is the world's first, oldest, and largest Applecomputer user group. Our membership is comprised of Apple enthusiasts throughout the world, and

we provide support for all levels of technical ability, from beginner to seasoned program author.

A membership in A.P.P.L.E. will bring the Apple owner 7 day per week hotline privileges for techni-

cal assistance when you need it, plus the international magazine Call-A.P.P.L.E., and incredible

discounts on our fully supported, low priced, world famous software products, and hardware.

A.P.P.L.E. is a member owned, non-profit service organization. Write today for a free copy of our

magazine and club information, or join by filling out the enrollment coupon

VALUESOFTA product whose time has come.

Fully supported, guaranteed, high quality software at low prices.

VALUESOFT INCLUDES: 2 word processing programs

exciting games

useful utilities

high quality graphics

finance and education

since 1978.Mallia

APPLE

21246· 68th Ave.S.Kent. WA98032

(206) 872-2245

or call our toll-free number1-800-426-3667

(24Hrs. Orders Only)

c: MEMBERSHIP526one-time

appticauon fee + 525 first year

dues.551= : fREE INfO + Call-A.P.P L E

Please send free- inforrnauon

Name

Uncommon at

$12.50perdisk.program contains its own

document on disk.

The quality. VAlUESOFT line of software is available through the Apple]

PugetSound Program library Exchange.

NEW lIe OWNER ?programs for the IIc now in stock

Utilities

DatabaseGraphics

Word Processing

1 / " )Join Now and Receive 10 FREE (5- 4

Address _

City

State ZIP _

Phone " _

M/ C VISA #

Exp. Date _

Aoo.t-onat foreign postage required

for rnemoersr uo outs.ce the U.SL J

I

III

I

Ii

I~

Page 4: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 4/76

Featured This Month

This month we enter into the world of FORTH, inadditiQn

to a varied selection of other exciting subjects, progTa.ms

and projects.

Time-Series Forecasting enter into the world of

Nostradamus with the sagacity of Einstein. This program

uses various forecasting techniques to predict the future,

from interest rates to the Dow Jones. Includes versions for

the Apple, Atari, Commodore 64 and CoCo.

Introduction to FORTH a look at the world of

FORTH. Who would be interested in FORTH, why, what

features does it offer, its uses and implementations.

Textfile Write Edit Read Program for all of you Apple

users who have cursed when they wanted to read a text file

and only got an error message. This program is an

invaluable help in writing, reading, and editing text files.

Multi-Tasking for FORTH this program allows

seperate tasks to run in the 'background' while still having

the FORTH interpreter available in the 'foreground.' A

concept and program with powerful implications.

Transforming dBase II Files find out how to alter

your dBase II files so that you can use them with

Wordstar/Mailmerge to produce personalized letter forms.

Stepper who has step-traced his way through an

assembler program only to have to suffer through jumps to

monitor routines 1 This program saves from this time

consuming annoyance, making debugging a little more

enjoyable.

Structure Tree Utility nothing is worse than

forgetting the calling structure of a word in FORTH. Withthis program you can easily recall which came first - thechicken or the egg.

68000 Exception Processing how to take advantage

of the 68000' s capabilities, software exception processing

in general and hardware exception processing for the

SAGE.

Graphic Print for C64 Part 3 the final installment of

this excellent series provides the programs and techniques

required to generate full color pictures on your standard

printer!

Approximating the Square Root of the Sum of

Squares a fast and time saving method for dealing

with that candidate for 'the most often used

calculation' - the square root.

,.

ROGRAIrotS AVAILABLE FOR THE ApotCEOF

ONEof THE BEST P 0 EJtTERMAlIiIAlN EM nCS PACAACE'

COtIsU"". aU_ AP~lE COMPuTERS . AST RATE INTE~Al AN 'FIRST LEVEL DIACiMOS

• VS FOR rTSf.lF APr" " OftCMAPlD : ~ U f IOtiPUTER pOPUu." COlirUTItIG PERFEcT PACKAGE

so",al.ll 'IT PA BE IN THE LI8fI,ARY Of EvERY UTa" aOUCAT1Of1 'EASYTO uSE. A oe "fRY l HELl INoEEO'

I . 'THIS p ..~J(.ACESHOULD .... TMP ..T1C•• cO llP

,.. ct." 'OOES ONE J

'. . l: ' . .c- . _/ " . " _ " _ ' " _ - _ . _ o . _ ' _ _ ' _ ' _ U S _ ' " - - ,

. ' c _ MASTER DIAGNOSTICS

There is only one thing I. ,

more important than your . a p p I e !MaintainingHOW ... ..NY DISKETTES HAVE YOU INITIALIZED WITH YOUR DISK DRIVES RUNNING TOO FAST OR

TOO SLOW THI NK esovr WHAT THAT COOLD MEAN

010 YOU KNOW THAT THE DAIVE SPEEO OF YOUR APPLE SHOULD BEAS CLOSE TO

JOORPM ASPQSS IS LE 1 L IK E A RECORD ORT APE SYSTEM VAR IE S W IT H MOTOR SPEED

so DOES ... DISKETTE

WHEN WAS THE LAST TIME YOU CLEANED THE READ/WRITE HEADS OF YOUR DRIVES?

THEY SHOULD HAVE SEEN CLEANED U.ST MONTH, AND WITH OUR PROGRAMMED

UTILITIES YOU COULD 00 so AT THE PUSH OF A BUTTON

MOW A 80 UT TH E WRI TE P RO TE CT SWI TC H I S I T W OR KI NG P RO PE R Y S O YOU wee-rDESTROY YOUR PROGRAM DISKETTE OR PROTECTED DATA?

THEFlES lOTS MORE 01. ",0 IT W Il l ONLY TAKE ,S MINUTES A MONTH TO KEEP YOUR HIGH

T ECHNOLOGY EOU IPMENT RUNNING AT H IGH PERFORMANCE . PREVENT PROBLEMS OR O IAGNOS e

P FO BL EMS A ND S AV E YOURS EL F O NE O F T H OS E D AY S

WITH MASTER DIAGNOSTICS ~ CAN DO IT.

THE PROGRAM THAT PAYS FOR ITSELF

WHEN ORDERING SPECIFYversion II & II plus or version lie

o master diagnostics $55.00

it.

.-- - - = -

IHE TESTSINCWOE

o master diagnostics + plus $75.00

TM. +"LUI

. .. e . .. . ~tao. + . .. .. .. p n: !Y >d es .. .. .- yt Nn g n .. oe d t o m . t tUUn y ou r c om pu_ef

Tn. e!1tl,. ~'I ~ in our awnmold«! cue 10profBCt 8QIII"1l"'1C e'ecIncrty..·rllYInd afhercontam..,.ru.

1r>elucled.nlhtkiCil

• THE DIAGNOSTICS orSI(ETTE • CRT SCREEN C EANER• F OA TY Pl rGE PF OCEDURE M ANUAL • CO UPUTfR ORrVE HOUSING CLEANER

• HEAO CLEANING KIT • REUSEABLf CHAMOIS npPEO 'MNOS

tliKROItf®Technical Products,lnc.

25 Prospecl Street, Leominster MA 01453

2No. 75· September 1984

DIAL1-800-835-2246

MICRO

Page 5: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 5/76

'v.~~'v.~ Buy th is 68000 comp uter ,I~~ande'll g ive you a 65C 02... free . I

i,

[ • O ver 50 m ac hine language1 utilities

Cho ose from o ur ex ten siveselec tion o f softw are ... for the65C 02 : M TU -BASIC (std) ,MTU -C ($ 200 ), MTU -FORTH($79), 6502/65C02/6511 macroassem bler ($150), . .. fo r the6 8000 : MTU -BAS IC 1 .5 ($ 50 ),M oto rola c om patable, m ac roc ro ss-assembler ($ 200),FORTH68K-8 3 (w ith so urc e$ 25 0), FORTH68K -8 3 METACOMPIL ER ($250), ... 68 000MAG IC /L ($ 49 5), D ig ita lResearc h CP /M 68K with C

language ($c all). F or w ord

II p roc essing, WORDPIC ($ 420)

---------~-----------___1 m ixes graphic s w ith text. A nd--T h-e lV ITU-140has always 32KB in just 2 .6 sec onds ... and I you c an run any CP /M 2.2

! been a good deal, bec ause it's another 20KB in just 1 sec ond! program with the PROGRAM -I suc h a versatile c omputer. Plus, both CPU's c an perform MOVER Board (MTU-CP/M ,Now when you purc hase an other tasks during disk opera- Z-80A , 64KB RAM -$650).MTU-140 ($3995) you get the tions ... even servic e For laboratory use, thenew 65C02 proc essor c hip free. interrupts. F ew computers MULT I-O System ($1500)A nd, by adding the DATA - offer this freedom ... none w ith I offers IE EE -488 bus, c loc kMOVER board ($1080) you'll both 65C02 and 68000 calendar, 2 p arallel & 2 ser ia lhave a 68000 computer to boot. proc essors! Equipped with the ports, 12 b it D / A & A /D (8... plus a total of 335KB RAM DATAMOVER, the MTU-140 channels) w ith up to 16,000to share between them. T he provides: samples/sec ond, 5,000/sec ond65C02 is just like the 6502 plus • 8MH z 68 000 plus 256K B R AM sustained to disk from M TU-8 new instruc tions and 2 new with 2 D MA ports BASIC! It is fu lly enc losed ...dd . d . th • IMHz 65C02 p lus 80KB RAM . Idi ta ressmg mo es using e w ith m ultiple D MA ports in c U ing c onnec ors, pow erlatest high speed CMOS • Dual 1M B 8" F loppies fo r supply and all driver softw aretec hnology. W ith the CODOS / u lt ra -r el ia bl e o pe ra ti on I for interfac ing all devic es toDMXMON operating system , • DMA disk operations in to CODaS and all languages. A ndyou c hoose w hic h proc essor is m em ory , no C PU interferenc e for signal analysis w ork, our. I h b h • DMA h i-re s G ra ph ic s/T ex t D"S d 16 ff 16 bitm contro ... or ave ot d isp la y, n o C PU in te rfe re nc e IgI oun - 0 ers - Iru nning sim ultaneo usly , eac h .96 key detac hed keyboard w ith l inear , 100,000samples /second ,perfo rm ing flaw lessly ... the 5 separate c ursor keys variable internal or ex ternalway MTU computers have • 8-bit D /A speec h and m usic sam ple c loc k, 64K B DMA

always worked. • ~i~~r optic light pen RAM buffer, and parallel portOur c ustomers are sold on • 2 Parallel, 1 serial port interfac e to w ork w ith any

the MTU-140. T hey know we •In ternal expansio n c ard slots

c om puter ($2 995).i designed it for thinking people • CODOS /DMXMON O pe ra tin g Interested? C all or w rite

[' ... to extend their abilities. system using devic e inde- M TU today for details. W e justI T hey have found it easy to p en de nt c h an ne ls made a good deal eveni c ustomize for their own needs • ~C~~lr:~~gr,b~~~dl~t~ot~k better ... w ith a free 65C02.I . . . p rovid ing solu tio ns they had files

'I ' not thought possible. W e think • MTU -B A SIC w ith grap hic &'1 1 th MTU 140 d is k e x te ns ion syou W I agree... e 1 - • C om munic ations w ith at-

I is tailor-m ade for people w ho tend ed /u nattend ed u se-

i need their own p ro fessio nal s ou rc e a va il ab lei c omputer. • G ra ph ic e dito r, slid esh ow

I T he M T U - 1 4 0 is f ast. A t the • r~~;n~t;~ony instrum entI touc h of a button, you c an load s yn th esiz er m usicI

Mi cro T e c hn olo gy U nlim ite d2 80 6H illsb oro ug h S t.

R aleigh, N orth C aro lina 276 07(919) 833-1458

Page 6: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 6/76

Publisher/Editor-ln-Chief

Robert M. Tripp

Associate Publisher

Cindy Kocher

Production Manager

Jennifer Collins

Technical Editor

Mark S. Morano

Technical Editor

Mike Rowe

Advertising Manager

William G. York

Circulation Manager

Linda Hensdill

Office Manager

Pauline Giard

Shipping Director

Marie Ann Wessinger

Comptroller

Donna M. Tripp

Accounting

Louise Ryan

Contributing Editors

Cornelis BongersPhil DaleyDavid Malmberg

John SteinerJim Strasma

Paul SwansonRichard C. Vile, Jr.

Loren Wright

Dealer Sales Representative

Alison Churchil l

MICRO is published monthly by:MICRO, Chelmsford, MA 01824.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 issuesand all othe fulfillment questions to:

MICROP.O.Box 6502Chelmsford, MA 01824

or call 617/256-3649.

Subscription Rates: (per year):U.S. $24.00or $42.00for two yearsForeign surface mail: $27.00

Air mail: Europe $42.00

Mexico, Central America, Middle East,

North Africa, Central Africa $48.00

South America, South Africa, Far East,

Australia, NewZealand $72.00

Copyright © 1984by MICRO.All Rights Reserved.

4

1 51ntroduction to

FORTHThe basic Why's and

Wherefore's about the

FORTH language.

Kenneth Butterfield

1 8Multi·Tasking in

FORTH

A Technique and Program

for Running Multiple Tasks

Under FORTH.

Kenneth Butterfield

"AStructure Trees in

L"FORTH

A FORTH Utility that Prints

the Structure of a FORTH

Word.

Michael Dougherty

2 7Textfile Write Edit

Read Program

(T.W.E.R.P)

Now reading, writing, and

editing textfiles is easy.

N. D. Greene

Add Full Color to Your

Graphic Printouts -Without

a Color Printer.

~6Approximating the

:1Square Root of the

Sum of the Squares

A Very Fast Method of

Calculating this Useful

Function.

Chris Williams

4 4Interface Clinic: A

Major Hardware

Interface

Design a major hardware

interface - a receiver

board for the 32K CoCo.

Ralph Tenny

MICRO No_ 74 - August 1984

Page 7: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 7/76

4 7 :~~~~s~~;i~~-~-----> .,-....,.

Mike-Rosing

How 68000 Uses ExceptionProcessing to Handle

Software and Hardware.

r2 Transferring dBase II-;/ Files For Use With .>

Wordstar/Mailmerge /~"'---/~~.

..-~

Alter your dBase II filesand use them to produce

personalized letter forms.

Robert R. Carroll

5 5 s ; ~ P P e . -Chester H. Page

Step-Trace facility that

allows you to bypass

monitor routines.

6 1

Time-Series

Forecasting

A Program to Predict theFuture - That Runs on the

Apple, Atari, C64 or CoCo.Brian Flynn

13 Wizard A game utilizing the 14 Stocker1 For the serious

C64's capabilities to stock market

the maximum - investor, a program

that even lets the for predicting

player create his performance that

own material. can interact with a

time-shared database.

13 Person-to- Person A feature packed 14 MMp·1000C A full-feature

communication Modem communications

package for the package for any

Apple, that inciudes Atari, including all

a mailing list required hardware

capability. and software.

13 Mail Now! A user-friendly

mailing list programfor the C64.

2 Highlights7 Guest Editorial8 Editorial

10 Feedback11 Spotlight

68 Books69 Catalog71 Lyte Bytes72 Advertiser Index72 Coming in October

No. 74 . August 1984 MICRO 5

Page 8: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 8/76

Page 9: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 9/76

r-euIv;?Oe7~-----.

Languages like FORTH represent an important turning

point for computer users. Until now, computer usage was

managed as a "closed shop." Users desiring computer aid

were faced with either working with a software expert who

might not understand their problems, or becoming theirown software expert at the expense of effort applied to the

original problem. In either case, the actual solution to the

user problem was hindered.

In the last decade, the closed shop cycle was being

discarded by several new software environments. Working

in a scientific field which changed far faster than

conventional software support, Charles Moore developed

the language and operating system FORTH. In a sense, this

language placed software development in the hands of the

user. Users were able to quickly develop and modify

software without the software middle man. Parallel to

FORTH, the software engineer was also finding similar

help in the environment of UNIX and C. The UNIX/C

combination allowed the nebulous field of software

support to be directly used by the software engineer.

UNIX/C allowed each software engineer to build the tools

needed to analyze, design, write, test and document

software effectively. In education, Seymor Papert was

developing an environment called LOGO to teach

concepts in mathematics and programming. Paperr's

methods were based upon the students writing their own

software rather than being passive subjects for CAl drill

and practice.

From the viewpoint of the user, these languages

represent the true second generation of

software - languages which allow the user to directly

apply a computer to user problems. These secondgeneration languages may be characterized by the

"toolbox" approach to problem solving. Each of the new

computer environments allows the user to construct

individual tools [functions, modules, etc.) which may be

combined to solve problems. Instead of relying on an

intermediate software engineer to design and build a single

program, the second generation languages allow the user

to build upon past software to solve new problems.

The toolbox approach becomes a software metaphor for

the normal human process of learning. Learning typically

consists of building upon previous knowledge. For

example, speech must be learned in steps, each step

building upon the last. A small child will first learn simple

nouns and verbs. These words will be combined into shortsentences to express desires. Adjectives, adverbs and

prepositional phrases are later added to express more

complex desires or ideas. Thus, learning to speak is a

process of building new speech tools upon those

previously learned. This process of synthesis is a natural

and well practiced process for most people. The toolbox

approach utilizes this concept for software development.

(It should be pointed out that this "bottom up"

methodology is not perfect. Just as many children who can

talk must still be taught "proper" English in school, the

building blocks must be rearranged or modified when the

goal at the top is missed.)

by Mike Dougherty

Littleton, Colorado

Notice that the toolbox approach complements the

normally advocated "top down" methodology. This is not

bad. Rather, it is a reflection of two different problem

environments. Top down programming was developed to

aid software engineers dealing with complex programmingtasks. Complex software is not limited to large

government projects - even the Apple Lisa's integrated

software required a 200 man-year effort' These systems

require a different methodology than used in a laboratory

or learning environment.

Given a set of requirements, a complex project may be

successfully decomposed, layer by layer, into small, easily

programmed and tested units. This decomposition will

detail the interfaces between software functions and allow

different portions of the software to be developed by

different programmers or teams of programmers.

Although validated by several pilot projects and used in

many actual projects, this top down methodology (called

structured analysis and structured programming by

Yourdon) requires two strong foundations. First, the

software requirements must behave as a "damped

oscillator." Although many requirements change

throughout a project, these changes must converge to zero.

That is, for a firial product to be generated, the final

requirements must be set prior to delivery. (In the real

world, this is not always the case!) Top down methods are

not very effective when requirements are vague.

Secondly, the right personnel must be found to perform

the software decomposition. Proper decomposition

requires a well structured, highly analytical thought

process. Unfortunately, most of us do not adequately

possess the skill and talent required for this job. In mylimited experience with complex projects, the front end

decomposition is, simply stated, very difficult. Not only is

the decomposition difficult to do, there are problems in

determining whether the decomposition is correct or even

complete. Finally, the ultimate project success, years

down the schedule, will depend upon proper and valid

decomposition. Good software analysts can easily be

worth their weight in gold.

Who are the readers of MICRO 1 I suspect that most of

the readers fall into the toolbox category. Like myself,

they are interested in using their personal computers for

solving the wide range of problems encountered in

everyday living, not programming complex U.S. Defense

Projects. Since everyday problems cannot always beanticipated, the software requirements change

continuously. In addition, it is difficult and cost

prohibitive to find a software' 'middle man" with as much

knowledge as the user. Only the user fully knows the

problems to be solved. The toolbox approach simply

makes good sense for most MICRO readers.

Where does this leave MICRO? I think that MICRO

should expand to cover these new software environments.

Versions of FORTH are available on most micros; similar

versions of LOGO are supported on both Atari and Apple

(LOGO Computer Systems, Inc.l, UNIX is rapidly

becoming the de facto operating system for the 68000

No. 75 . September 1984 7ICRO

Page 10: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 10/76

I--------------------------------------~-------~-------------,

microprocessor family. Details of specific implementa-

tions as well as the general philosophy behind each

software environment need to be covered. Each language

has its own niche with unique advantages and

disadvantages. The languages discussed here are not

free - they do require investment in software, hardware

and effort. By covering these second generation user

languages, MICRO will allow the readers to determine

what they should invest in their current or future personal

computers. These languages are receiving attention from

many sources and I feel that MICRO must seriouslyconsider their coverage.

Mike Dougherty has worked in the software field since

1977 and is currently a Software Engineer with Martin

Marietta Denver Aerospace in Colorado. He has

specialized in developing real time data acquisition and

control systems. While most of his software has been

written in assembly language, in the last few yers he has

used FORTH for work and personal projects. He has

submitted several FORTH programs/ articles, the first of

which, Structure Trees appears in this issue.

[Editor's Note: This 'Guest Editotial'<is essentially ,a very

thoughtful letter MICRO received from the author in April. $j~c~

it expressed many of our thoughts very eloquently, we obtained

permission to use it as an editotial.]

Discover Forth

Join the FORTH Interest Group

The FORTH Interest Group (FIG) is a non-profi t member-sup-

ported organization, devoted to the Forth computer language.

Join our 4700+ members and discover Forth. We provide Our

members with the information and services they need, including;

Over fifty local FIG chapters (general and special

interest) meet throughout the world on a regular

basis.

Forth Dimensions magazine is published six times a

year and add resses the latest Forth news. A one

year subscription to FDis free with FIG membership.

The FIG-Tree is the FIG-sponsored, on-line

computer data base that offers members a wealth

of Forth information. Dial (415) 538-3580 using a

modem and type two carriage returns.

Forth publications; awide variety of high quality and

respected Forth-related publications (listings,

conference proceedings, tutorials, etc.) are available.

- The FIG HOT LINE(41 5) 962-8653, isfully staffed to

help you.

The Job Registry helps match Forth programmers

with potential employers.

All this and more for only $1 5.00/yr. ($ 27.00 foreign)

Just call the FIG HOT LINEor write and

become a FIG member (VISA or MC accepted.)

Don't m,S5 our upcoming (' ~ (415) 962.8653

6th Annual Forth Convention \\FORTH PO Boxl1 05

November 16·17. 1984 at the Intere" San Carlos

Hyatt Palo Alto in Palo Alto. CA. \ Group CA 94070

Calf or write for details. \'-- __ ~

MICRO Goes FORTH

I agree with the position set forth by Mike Dougherty in

the preceeding editorial. Starting with this issue, MICRO

intends to provide regular support for programming in

FORTH. Our recent Reader Survey indicates that

approximately one-fifth of you already program in

FORTH. This means that many of you are capable of

providing FORTH oriented material for MICRO. The

primary thrust should be FORTH programs and utilities

that can be added to other reader's 'toolboxes'. SinceFORTH is fairly standardized and is available for all

microcomputers, the value of each well-written FORTH

program extends far beyond the bounds of the

microcomputer that it was written on. This should be a

refreshing change from machine specific BASIC and

assembly programs. If you are a FORTH devotee, here is an

opportunity to share your accomplishments and

enthusiasm with other serious computerists.

Of course, if one-fifth of the readership program in

FORTH, then four-fifths do not! For these readers, MICRO

would like to provide introductory tutorials, 'how-to-get-

started' projects, buyers guides to FORTH materials for

specific microcomputers, complete applications and

utilities, and overall, an incentive to make the effort tolearn a new language. Make no mistake - it does take

effort. You will have to purchase a version of FORTH for

your system, install it, use an editor that may be totally

different from that which you are familiar with, learn a

whole new way of approaching and solving problems and

memorize a strange, new vocabulary. But, MICRO will be

there to help.

The editors at MICRO are not FORTH experts. We are

just learning to use FORTH. On the one hand, this means

that we will be very sympathetic and understanding about

the difficulties other programmers encounter in getting

'into FORTH. On the other, it means that we will be very

dependent on those of you who already are experts to

provide the articles and programs that will make FORTH a

successful part of MICRO. If you have never tried FORTH,

try it. If you are a FORTH enthusiast, support it.

Atari

It was not.suprising to find from the Reader Survey that

the two most popular microcomputers were the Apple

(39%) and the Commodore 64 (39%), with Atari (13%) a

distant third. Still, I feel that the Atari family of

microcomputers has many features that should make it

interesting to the serious computerist. Unfortunately it

has: a 'game orientation' stigma attached to it; a non-

Microsoft BASIC with a number of 'odd-ball'constructions - especially in dealing with strings; some

annoying aspects such as the 'beeping', the 'graphic mode

key' where the right-hand 'shift key' should be, and so

forth. MICRO's coverage of the Atari has been weak

relative to that of the Apple and Commodore. This is not

due to our lack of interest I It is due to a lack of good article

submissions on the Atari. Although only about one-thirdas many readers own Ataris as own either Apples or C64s, I

would estimate that we get ten (10) or more submissions

for each of these computers to one (1) received for the

Atari. We try to convert some articles submitted for other

micros to the Atari, [see Time - Series Forecasting in this

8MICRO No. 75 . September 1984

Page 11: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 11/76

issue), but this is a lot of extra work. While it might be

tempting to just drop the Atari, I still have hope for this

micro. Especially now that Jack Tramiel, the man who

took Commodore to the top, has taken over Atari. While

Atari may currently be down, do not count it out. If those

of you who use Ataris start submitting 'meaty' articles,

then you will see a lot more in MICRO on the Atari. Let's

hear from you.

Advertisers

The money you pay for your copy of MICRO, whether

through a subscription or at the counter, does not begin to

pay for the cost of producing it. If MICRO was dependent

solely on its distribution revenue, then you would be

receiving an 8 to 12 page newsletter. The additional

revenue required to run MICRO comes primarily from

advertising. Advertisers pay to run ads for one reason: they

want to make sales. How does an advertiser know if his ad

is working in MICRO I While a few have a special

'department number' or other encoded information in

their address, most do not. They will only know that you

saw their ad in MICRO and were positively affected by it

I f You Tell Them!

When you contact an advertiser to buy a product or formore information, please tell them that you saw it in

MICRO. You can not over-estimate the effect this will

produce. The size of MICRO is determined primarily by

the amount of advertising. If you want to see MICRO

grow, then

Support Your Advertiser.

Editor-in-Chief

On The Cover

rtaHILV

_1_~~FOUR --bE HCnlll TION 5

z FIR51-FAHrLV

3~ (_;;HCAT-GR~NDPAREN5

( • • • '> AI>~H AND EVE

4 { ••• J (";;RAHHV AHI> G-lrlHDP~

Z HLJCLCAR-FAHIL V

3 PAJ.lENT5

4 ( .• oJ HOH AND DAD

3 CUILDREH

4 _{.IO JACK AND _JILl.

For computerists who want to communicate with 'third

generation' computers, our tree (a 'structure tree' which

was generated by Dougherty's 'Structure Tree Utility')

might bring to mind Dr. Moore, who named his solution

FORTH (fourth generation language). As Nature creates

trees of brilliant variety, so can the user of FORTH.

Cover Photo by Cindy Kocher

No. 75 - September 1984 MICRO

ReqUIres, paral le l p rimer such as. Eason . Gemini. Mtcrouoe. Cltoh.

IMin. speed 35 cps]

SuperTerm - the only software that communicates with

them ali I Information networks such as CompuServe;

business and university mainf rames; free hobby bullet in

boards.

Professionals and students: Superlerrns Vl l 02 emulationgets you on-line in style. Advanced video features, graphics,

full-screen editing, 80/132 column through sidescrolling,extended keyboard - perfect for EDT.DECMail, etc. Even

download your work files and edit off-line! Full printer andeditor support; other emulations available.

Researchers and writers: Superterm's built-in text editor

helps you create, edit. print. save, send and receive text

files - articles, stories, reports, inventories, bibliographies - in

short, it's your information work station. Access

CompuServe, Dow Jones Information Network,

Dialog/Knowledge Index, Western Union's Easylink, The

Source, and many more. Optional Sprinter accessory saves

printing rime and S(see below).

Computer hobbyists: Join in the fun of accessing hundreds

of free bulletin board systems (88S) for Commodore, Apple,

TRS-80,etc. Textmode with all88S systems; up/downloading

with Commodore 88Ssystems IPunter protocol). Special

protocol for up/downloading with other SuperTermowners.Popular "redial-if-busy" feature for use with automodems

Get the information you need, for business or for fun,

with the software that communicateswith them all!

Requtres. Commodore 64, disk drive, and SUItablemanual- or auto-modem. Printer

opt iona l. Software on disk w/free backup copy Extensive manual inde luxe b inder.

SuperTerm's

SPRINTER Accessory . .56995

With the Sprinter accessory, SuperTermcan perform

concurrent printing - astext appears on your screen, it's

simultaneously printed on your printer. Includes all necessary

hardware for connecting your parallel printer and computer

via the cartridge port. Simply plug-in and go. Free utility

software for printing and listing asa stand-alo~e interface.

Commodore 64 IS a trademark o r Commodore Electronics. Lrd..

9

Page 12: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 12/76

,-~----------~

To The Editor

I believe that the most basic need in the micro field is the

tranportability of software from one brand of computer to

another.

I, unfortunately, purchased a good computer that is no

longer very popular. I have converted it to CP/M to relieve

the software problem, but find that even that uses a

nonstandard disk format which is difficult to get

translated from the usual IBM format. Even with CP/M

there are about 20 different disk formats.

I believe in innovation but I find it difficult to

understand why a program written in a high level language

cannot be portable between almost all micro-computers in

some reasonably convenient way.

I'm in the process of determining what my next com-

puter will be. But I do not intend to buy the latest model

every year. The big question is not what is "state of the

art" or what is fastest, it is what computer is the software

going to be available for in five year or ten years. Now,

most new software is being written for the IBM PC. Even

CP/M-80 is being ignored by many vendors. Untilrecently, I thought that maybe I.B.M. would be good for

many years but now I'm almost convinced that technical

limitations will prevent if from being effectively expanded

to larger systems such as UNIX and ADA. However, I do

not think that a Motorola 68000 based system will domin-

ate without the support of at least one large company in a

moderate price range. I know that all software writers

cannot provide all software for all formats and all

languages when almost all computers are different. So why

cannot all computers be provided with a second standard

ASCII disk format which is common to all computers for

the purpose of transporting software and data. Then the

addition of software translaters such as Apple Basic to

Commodore Basic or even Basic to Pascal could reduce a

nasty problem to one that is managable by most users. I

doubt that everyone is going to agree on any standard by

which this can be done, so maybe a solution would be for a

technically oriented magazine such as MICRO to puhlish

the software and hardware specs needed to read from the

various disk formats.

C. M. Nelson

Indianapolis, IN 46256

The following limerick was submitted by Margie [oseph of

Los Angeles, CA.

Though sometimes her memory would slip

And sometimes her mind took a flip,

But now don't dispute'r

She's got a computer

Her memory's a silicon chip.

j\IC:R() ..

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 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 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 1 1 1 1 1 1 1 1 1 I 1 1 1 1 1 1 1 i 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

-"!

""nat~sw-«;

nthe ~

APPLE

• Gives names and locations of various Integer

BASIC, Monitor, Applesoft, and DOS routines and

tells what they're used for

• Lists Peeks, Pokes and Calls in over 2000

memory locations

• Explains how to use the information for easier,

better, faster software writing

. .- The revised edition with lie Appendix is now

available at a new low price of only $19.95.(plus $2

shih).

For the 35,000 people who already own previous

editions, the lie Appendix is available separately

for just $5.00.

. .--"!

WE'VE \.:__

ADDED APPLE lie

GUIDE & ATLAS ....

-"!. ....---

SO NOW THERE'S

NOTHING MORE

TO SAY!

. ..To order, send check or Money Order to: :;;:

MICRO INK

P.O. Box 6502

Chelmsford, MA 01824

phone 6171256·3649 (use VISA or MasterCard) ~

. .

10

1 1 11 1 11 1 11 11 1 11 1 11 1 11 1 11 11 1 11 1 11 1 11 11 1 11 1 11 1 11 1 11 11 1 11 1 11 1 11 1 11 11 1 11 1 11 1 11 11 1 11 1 11 1 11 1 11 11 1 11 1 11 1 11 11 1 11 1 11 1 11 1 11 1 11 1 1 I II I I! 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 1 1 1

MICRO No. 75 . September 1984

Page 13: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 13/76

·-~

cMili 68

Coprocessor SystemDistributor

Stellation Two

P.O. Box 2342

Santa Barbara, CA 93120

1805) 966-1140

Introduction

The McMill 68000 Coprocessor System is designed for the

Apple II and IIe. It is a peripheral board that enables

the Apple to run 68000 programs. The CPU is a 68008 chip

that utilizes direct memory access logic allowing the 6502

and 68008 to alternate memory cycles. All memory and

I/O slots can be directly accessed via the 68008. Using

alternating cycles while the 68008 is running, the 6502

continues to execute at one-half speed or faster. Special

address translation logic resolves conflicts among 68000

exception vectors, 6502 zero page and Apple II I/O space

locations. The fact that the McMill 68008 is truly a

coprocessor that runs simultaneous tasks with the 6502 is

a particularly powerful advantage. [During disk access,

game paddle reads and any other timing-loop dependent

functions the 68008 must, of course, be halted.)

InstallationThe McMill 68008 Coprocessor System board is painless

.and easy to install. All that is necessary is inserting the

board in one of the peripheral card slots. There aren't any

additional connections or worries to deal with.

What is Provided

The package includes the McMill coprocessor board,

Hardware Documentation Guide, a Motorola Inc. MC

68000 Microprocessor Programming Card, a floppy disc

entitled Fig Forth, version l.0 Mountain View press,

hardware warranty IMcMill will repair or replace free

of charge any board that is defective within one year of

the original purchase date, damage caused by accident,

misuse, or tampering not included).You can also order the SoC 68000 Cross Assembler

with the McMill Coprocessor System. This is an excellent

assembler as those who already have their 6502 version

will attest to. All SoC assemblers use the same set of

directives and commands, making adaption to different

chips very easy. The 68000 version has some differences

from the standard SoC Macro Assembler, such as expres-

sions being expanded to 32 bits, and other alterations

necessary to accommodate the code and syntax differences

in the 68000. All variances are clearly documented.

Included in their latest version are 10 new commands and

7 new directives, improving what is already a fine product.

Under a special arrangement with Addison-Wesley

Publishing Company Stellation has been allowed to

provide a monitor from Tim King and Brian Knight's book

'Programming the M68000.' The book takes the reader

through the world of the 68000 and how to program it. A

floppy disk with their monitor and a debugger is provided.

The monitor/debugger is compatible with the SoC Macro

assemblers source files, allowing easy editting and

assembly.

What is Not Provided

The board itself hasn't any ROM or RAM. None of thelanguages most 68000 users would use are provided,

namely C Fortran, UNIX, and LISP. Although a version ofC is due to be released, this is still a serious shortcoming.

Documentation

This is where the McMill package is the weakest. The

Hardware Documentation Guide could cover more and

include a schematic diagram that is legible. Expanded

hardware documentation is scheduled for release, which

will hopefully correct the shortcomings of the present

version. The Monitor/Debugger relies on the information

in King and Knight's 'Programming the 68000' for

documentation. The information needed is basically there

but the organization is not. It is organized as a chapterin a book (which is what it is), not as documentation for

software. Although the Mountain View Press Fig FORTH

is included with the McMill package, you have to send

away to Mountain View Press to get the complete

documentation [for a nominal charge). This strikes me as a

good way to create unhappy and frustrated users. It would

make more sense to charge more for the package and

deliver it complete, rather than inconveniencing and

possibly annoying the user.

Price

The McMill with FORTH is $229.00; with the SoC

Assembler it is $299.00.

Conclusion

This package has its ups and downs. It does gives the

Apple user an inexpensive way of upgrading to a 68000

machine, while not having to give up the familiarity

of his present machine. On the other hand the poor

documentation, lack of on board RAM and ROM, Fortran,

LISP and UNIX are enough to discourage many users. For

those who are soley interested in getting into 68000

Assembler, using the SoC Macro Assembler with the

McMill board is an inexpensive means of doing so. In the

end it depends on what your needs and expectations are as

to whether this is a product for you.

No. 75 . September 1984 11ICRO

Page 14: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 14/76

Super Action Software!

) ( )~:

(

Perplexian Challenger $29.95

P-'IP. InC:I":cil/J/". ~hree·a.(ls luysed" cCIl:,~GI of a

space flghtf:'" hJrlr:i'.; 5Jl'L SLI E::d, ]1"Clphll:::s pruvrde

3 CC,ll::lnL.OIIS dISr:lJ'j C: ~,~tl'L lilenatlOI- Nell

a L'lI'ee-rJlrm_;'lSTI'dl v'IE'i', o t space

You. dS a o.lut rrusr UUIZP rqhr.nmq fas t r-e flexes to oes tr-ov

i livadl llg shlps_ ar.d a '. 'u ld the ir ' --eS '_ lr 'lk'e S,r;\L. lt21Ecus ly , you

ou.st maneuver vour ship ~D captur-e space deer'is tt-at

remal'l5 frurn the exploslor~s

Out st .ar -o.nq oraprucs fea tu r-es, Ir:clu(je smooth 3-0

rotations, sp/rt screens Clrld the nos·: Inu'ecrbie hlgh-

reSOI'J tlen nvoersuace sequence ever pr'oduced

Proqr arnrnec ent rr 'el y In machme lanqi.aqe. this act.or-.

strateqv g::=m:E-s yuaranteeCl [0 blov. aVlja\.'

All ~rle prctess.nna: featllf'es VO'J expect are Included

automatic seucemc luqh score retention, ;JaUSE, anc

provrsmns for ' 1 to 4 play'el 's. Add to this. features you ccnt

expect l ike 9.asJ-luadmg and '--n'J5 ICcu-n-q the load. Perplex Ian

Chal!enger IS i: game :hat brings the arcade expertence to your

home

DENVER, COLORADO

CYBERWORLD $39.95

$39.95

Rear -t ime auven !ure exc itement at l is bes t SoJ ,;e counness

puzzles and slay over a dozen monsters by uSing !he huge

vocabu lary of over 200 words Two chal lengl l' 1g d if fI cul ty levels

awa.: you with over 80 areas. each ful ly descr ibed InOld English

SCript

MenaCing monsters, knrvlng v il la ms, !al lered cooe b oo ks an d

treacherous terrain are Just a few of the sr'uauons you must

overcome Inyour quest tor the thirteen prrce less treasures More

than seventy objects are Invaluable 10 you Inyour search for g lory

and wealth'

A full-SIze, thoroughly IIlustralecJ manual ISIncluded Feawrmg

color fran! and back, book quality. and a laid-Jut map thrs

'extra fur ther extends the pro'ess.or-atrsrn of 'hiS game The

fol lowing are quotes Irom unsolrc .ted t esurnoruars sent to us by

adventurers . 1 ' 1 Gcthmog s Lair

I have ex treme ly e ruovec Gothmog s La ir and plan tobuy more

adventure games

Scott Tutrnan

,\-1ernphls, TN

GOinrnog s l .ar ISthe Des! adventure I ve eve ' p tayec

Oenrus 'vIanochIO, Jr

Sara toqa CA

This five-screen arcaae adventure packs the compute; with

Intense graphics and sound! Y')U ar e a special Cvberl eaque

agent in a universe fu!i of hostile aliens and VICIOUS robots

Joystick and keyboard transport you through 3-0 rooms

space earner-s. fieets of Invaders, and warship-ridden

Quadrants of space OVEr 100 sprites, 8 new cha racter sets,

and dozens of m nd-boggllng sound effects rnake up thiS multi-

layered adventure AnlrTlatlon, action. and strategy all

combined Into a game so extensive that two disk Sides are

lammed with game programs and datal React, the ultimate

rank of ad-rural and you may carve a niche In the permanent

high-score ust A ful l- si ze book Qual it y manual wi th ful l- co lor

covers IS Included to gUide you through your most exciting

game experience

WfZORd$39.95

Jump from ropes to ladders, dodge plummeting boulders and

duck under deadly arrows in vour quest for sparkling diamonds,

g leaming bars of gold, and glisten ing pearls, \X- 'i th joyst ick in hand

you must explore for ty dazzl ing screens, each a new and excinng

adventure. Take the key (0unlock rhe doorway to your nexr spine-

tingling level . Each key res tores your magical powers, a llowing you

ro cast over ren different spells. \x"ith rhese magic spells you have the

power to overcome vicious creatures, terrifying traps, and perilous

plunges,

Your \X./i:urd IS reahstic allv animated in every possible direction,

Omens of movements are possible - jump over burning fires,

sh immy up or down ropes and ladders, even slip down treacherous

sliding staircases! Magtc portals move your Wizard through midair

and p rO fen you f rom a myriad of fully-animated fiendish monsters.

Catch an elevator to the t or o f the sc reen and dar t through s liding

gates in your quest f or magic and treasure.

Wizar d's fascinating variety of scr eens are sure to please and

en ter tain, and of cou rse you canbui ld anunl im ited number of you r

own levels using the const ruc tion se t p rov ided w ith your game ,

~PROFESSOR $34.95

An m-deptb s el f- t u tur i al for the Commodore 64 on a two-

sided disk This menu-driven tutorial covers every aspect

of your C-64-BASIC. keyboard. sound. music simple and

advanced graphics, Quizzes lest your cumprehensiun at

the end u f rnan y les sons ' On-screen illustrations, sound

effects a nd ful l-co lor t nte rnntive graph ics rn ake learning

eus v .md mter-e s! ing ' I' hl -' PROFESSOR is your ONLY r.hoice

f u r an all-i n - n n e . t h ur u ug h luturia] a b o u t t h e C o m m o d o r e o4~

Supershipper 64 Supershipper AccountingA COlllpl"!I' m ulti-prmt er shIpping system vdlich ope rur es

un r h e mexpe n sive Cummndm-e 6-1, Offers all t he f eatur es

1111I11ln~ expc ns rve. more cumhe rsome hus rnesssof tv. are a t d

111\\' 111\\ prnt: Ful l-sr.reen. f ull -cursor edrting on all dHld

t:lltr,\ PrHh irl\ 0;U:5. CO D. lags. m; )iJi ng and shipping

luhel s. Sorts YIJur r.usturuer list aphahetically. by city stat e

111 uy , ,> ,d t!SPI' rS(ln. Ker-p s r.omple f e recurds of , Il l inv Diu,s

dCHI dCI:I)Unl.., on disk ~ up ti l Bon at.i.ounls per disk! Au to-

111.111( h-n.k ups, pruci ut.l chart s und ll1.rny other features

dlt' ,d..,() uu.Iuded

Supershipper 64

Supershipper Accounting

$99.95

$79.95

The uccuunting supplement 1 (1 the Su per'shipper' 64. Pflnls

stat eruent s. hank depus rt s. past due acco un t s <tnt ! drlily or

rnon t h ly S ides repo rt s . Bruak s dovvn sa les r .orumi ssions and

print s all cu stouters pa s t lr ansucfions Also provides

invento r-y control for up to 200 difl erent pruduct s The nnl y

\\'Hy t il ful l-y computerize yuur business!

Progressive Peripherals & Software

2186 South Holly, Suite #2, Denver, Colorado 80222 TELEX 888837

Call for more information or a dealer near you.

TWX 9109971314303) 759-5713 [3031 757-0830

Page 15: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 15/76

,--------- ~ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ~Product Name:

Equip. Req'd:

Product Name:

Equip. Req'd:Price:

Manufacturer:

Wizard

Commodore 6439.95

Progressive Peripherals & Software

2186 South Holly, Suite #2

Denver, CO 80222

Description: If you must have a game, it should at least

utilize the built-in capabilities of your computer to the

maximum. Wizard does! The game is of the "Donkey

Kong" genre in which you move around the screen to

reach an ultimate destination, while getting points by

taking treasures and avoiding fatal hazards. Through the

use of sprites, clever sound effects, a superior collection of

options, a large number of screens and many unique

concepts, it goes far beyond similar games. For example,

there are 'spells' that can be used to ward off calamity.

Some of these, such as 'invisibility', can protect you from

harm, but at the same time may make it more difficult for

you to move around the screen since you can only see the

wizard against colored backgrounds. Also, the invisibility

Iwears off' as you use it to avoid destruction. High scores

are automatically maintained on disk.

Pluses: The utilization of the Commodore 64's sprites,

sound, programmable characters and color provide an

excellent demonstration of the capabilities of the

computer and should inspire programmers to improve

their own displays. The game involves more than just thecomplex coordination found in many other games. A good

deal of strategy is required to master the game. The game

is even fun to watch while another plays, so that sharing

the game in a multi-player mode is enjoyable. The choice

of screens, speeds, spells and so forth keep the game from

getting repetious, even after many hours of play. The most

significant feature is the ability to generate your own

screens! This goes beyond merely playing the game. This

gives the novice a chance to experience the joy of

'programming' a computer to make it do what he wants.

He can design screens as complete as those that come with

the package, with hazards, spells, colors and the like.

Minuses: It may become habit forming.

Documentation: Very extensive for a game. Provides

more than enough information to play the game and to

create new screens.

Skill Level: With the variety of speeds and screen

difficulty, the game is suitable for all ages. The new screen

creation is limited only by the users imagination, not any

knowledge or training limitations.

Reviewer: Robert M. Tripp

Price:

Person-to-Person

Apple II, II +, lIe - DOS 3.3

Modem recommended-Hayes, Apple or

Novation

$39.95

Manufacturer: Trutec Software, Inc.

1700 Solano Ave.

Berkeley, CA 94707

Description: A full-featured communications program

including a mailing listltelephone list file, auto-dialing,

including secondary carriers, terminal program with auto

log-on and printed output, including form letters and

mailing labels. The entire program is menu-driven with

consistancy of response throughout the program. The 80

page documentation is easy to read and completely

explains any possible questions. The manual includes

many examples of command files.

Pluses: This program has all the bells and whistles of

standard communications/ terminal programs, plus it

incorporates a complete mailing list program with

telephone numbers that can be searched and dialed,

including pass word numbers to carriers such as MCI and

SPRINT. A single keystroke can dial and log-on to such asCompuServe and Source, upload electronic mail, check

your mailbox, download its contents, sign off and hangup.

Minuses: None noted.

Skill level required: No prior experience required.

Reviewer: Phil Daley

Product Name: Mail Now

Equip. Req'd: Commodore 64 with disk and printer

Price:Manufacturer: Cardco, Inc.

313 Mathewson

Wichita, KS 67214

Author: S. & S. Faure and G. Coggin

Description: A user-friendly mailing list program for 600

names per disk with add, delete, modify and sorting

options. The printer options include one or more rows of

labels, repeat labels, and printer codes for double strike,

enhanced, etc. There is also a convert function to change

the file format into one readable by the Write Now! word

processor.

Pluses: If you are familiar with label systems, the manualis almost superfluous - the program is thateasy to follow.

The search command quickly and easily can find a string

in any major field. Modify quickly changes any data. The

program performs flawlessly.

Minuses: If you like slapstick comedy, read the manual.

Otherwise just use the program and forget the satire.

Skill level required: No prior knowledge required.

Reviewer: Phil Daley

No. 75 . September 1984 13ICRO

Page 16: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 16/76

Product Name:

Equip. Req'd:

Stocker!

Apple II, II + t lIe - CP/M only

with Z80 card, TRS80 Mod Ill, 4, II,

12, 16 card

$300.00

Engineering Management Consultant

P.O. Box 312Fairfax, Virginia 22030

an infinite loop. A second try did not produce this prob-

lem. Unless you are a serious player of the market it would

be hard to justify the cost of this program.

Price:

Manufacturer:

Description: This package is designed to help the user

forecast stockmarket turning points, enabling betterinvestment and profit performance.

Pluses: Using a unique Moving Window-Spectral method

Stockerl saves time in stockmarket forecasting. Inputting

of historical data is easy and user friendly (prompting

provided). Stockerl employs a univariate model (one vari-

able in, the same variable out). Future values are predicted

using historical data which is input in a user oriented data

editor. Data can be entered in a Create mode or Update

mode. Statistical comparison is provided in addition to

graphical representation and comparison. Charts/graphs

are in an easily readible form. One free hour on the

Electronic Forecast Information Service is also included in

the package.

Minuses: If the user is not very familiar with stocks and

forecasting he is apt to be lost with this program. This is

certainly not a program for the uninitiated. At one point

through an error entered into the program we ended up in

089APPLICATIONSOFTWARE

ACCOUNTS PAYROLLPAYABLE GENERAL

$549$349LEDGER

with

CASH SMALL

ACCOUNTS JOURNAL BUSINESS

RECEIVABLE

$449INVENTORY

$349 $349COMPLETE DOCUMENTATION $19.95

OS9 & BASIC 09 ARE TRADEMARK OF

MICROWARE, INC. & MOTOROLA CORP.

)~t>. SPECIAL TV

~ ~ ELECTRONICS

(405) 233-5564

2110 W. WILLOW - ENID, OK 73701

Documentation: The manual provided is clearly laid out

and reasonably easy to read. Instructions and descriptions

are understandable if the user has an understanding of the

subject. It is assumed the user is familiar with his com-

puter's operating system. Technical data is provided, as

are sample case studies, and a bibliography. The manual

does suffer from a number of typos.

Skill level: Intermediate to advanced.

Reviewer: Mark S. Morano

Product Name: MPP-IOOOC Modem

Equip. Req'd: Any Atari Computer

Price: $149.95

Manufacturer: Microbits Peripheral Products

225 W. Third Street

Albany, OR 97321503/967-9075

Description: There probably is not any easier way to get

into telecommunications with your Atari. The package

consists of the modem which plugs into a joystick port and

a standard telephone connector; a cartridge containing the

terminal software; and a short manual. The program is

totally menu driven, making it simple for anyone to use.

The following features are supported: display disk drive 1

directory; direct transfer of information between disk and

modem; buffer modem to memory and then copy to a

specified device and visa versa; select between full/half

duplex, ASCII/ ATASCII translations, X-modem protocol

on/off, 38/40/80 column display, no/odd/even parity;auto answer; enter/savelload up to ten phone numbers to

be used to dial number, and more. By combining the

various features, files may be up/down loaded from Atari

Bulletin Boards IBBS), other Ataris and other computers. A

CompuServe demonstration package is included, and,

thoughtfully, a list of bulletin board services listed by

state throughout the country so that you have someone to

talk to when you first get started.

Pluses: Extremely easy to connect, use, and understand.

Minuses: None noted.

Documentation: Basic information is covered well. Afew more examples of combining the various options for

specific tasks would have been useful.

Skill level: Any and all.

Reviewer: Robert M. Tripp

14 MICRO No. 75 . September 1984

Page 17: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 17/76

••• tntroduction •• •to

FORTH

Basic why's and wherefore's about the FORTH language.

In the early spring of 1978, I first

learned of FORTH from an

advertisement for PetForth by

Programma International. At the time,

I was doing scientific calculations and

was looking for a language that would

be faster than the Pet BASIC. Another

goal I had for the PET was to use it to

control experiments in a physics

laboratory. I called Programma to find

out if FORTH was suitable for myneeds. The call was transferred to the

programmer who had written PetForth

which really gave me a feeling that I

was getting first class service' My first

question was Is FORTH a good

Language? and the response was the

classic, I don't use languages, I just

program them! The question Is FORTH

a good language! remained

unanswered. I hope to provide my

answer to this question, as well as to

the questions What is FORTH?, and

by Kenneth Bu tte rfie ld

Los A lamos, New Mexico

Who would be interested in FORTH!

First, FORTH is more than just a

language. It can be a stand-alone

operating system that provides basic

support for terminal and disk control.

Multi-tasking and multi-user FORTH

systems are available. FORTH also

provides a block structured high level

language that can be used in an

interpreted or compiled mode. Among

some of the block structures providedare the DO ... loop, BEGIN ...

WHILE ... END, and BEGIN UNTIL

loops and the IF ... ELSE ENDIF

control structure. On the other hand,

FORTH has been called a pseudo-

machine language because the key

words used for moving data from place

to place are very simple and similar in

use to the techniques used in assembly

language.

FORTH can have all of the above

features because it is an extensible

language. Most implementations of

FORTH have a small kernel written in

machine language and the remaining

80-90% of the language is written in

FORTH. Any new 'words' (FORTH's

name for a procedure or subroutine) are

defined using the previously compiled

words. Each new word becomes part of

the FORTH 'dictionary' (list of words

or commands) and are available for use

in future definitions. The programsthat you write become part of the

language.

One of the nicest features available

in FORTH is the on-line interpreter.

Commands may be given to FORTH

from the keyboard in a similar manner

to the 'immediate mode' of most

BASIC interpreters. This allows

FORTH to be used as a calculator.

Another use for the interpreter is in

program development and debugging.

The interpreter allows the programmer

No. 75· September 1984 15ICRO

Page 18: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 18/76

~

I

to try out a sequence of commands, one

at a time, to verify their consequences.

After the sequence has been shown to

work properly, it can be given a name

and compiled into the language for

future use. A program [word) is

activated by typing its name in the

interpreter mode, or by entering the

name in the list of names that makes

up the definition of a new word.

FORTH was originally written byone man, Charles Moore, to provide a

better media for program development

than the languages available at the

time. One of its first uses was in real

time computer graphics where, it is

said, FORTH provided a marked

increase in speed over FORTRANIl).

The first widespread use of FORTH was

in the computer control of large

telescopes, and FORTH continues to be

the language used at many of the

world's largest observatories. In fact,

my early interest in the language grew

when a fellow student informed methat FORTH was the language he used

when doing his research at the Kitt

Peak Observatory. It seemed to me that

a language that could control a large

telescope should be useful in other

control applications.

More recent uses of FORTH

continue the computer control theme.

Two applications arc the control of

robot cameras for special effects in the

motion picture industryjz], and remote

sensing of water depth and speed for aid

in navigation of large barges on inland

waterways(3). FORTH is still strong in

the area of computer graphics. Charles

Moore has a CAD-CAM system that

runs in 28K of memory(4). FORTH has

been shown to be very useful in

research laboratory settings where the

experiments vary from day to day. It is

important to have a language that is

flexible, allowing the measurement

(spectrometers, ADC's, etc.) and

control devices (stepping motors or

relays) to be connected in new and

often changing configurations.

New uses for FORTH are beingdeveloped all of the time, and some of

the most exciting are in the area of

artificial intelligence. LISP is the

language usually associated with AI

projects, but there is a marked

similarity in the underlying structures

of LISP and FORTH. Both languages

treat data and programs as lists, and

have the feature that a program can

create and manipulate a list that will

later be used as a program. Programs

written for the two languages are

similar except for the notation. LISP

uses a parenthetical notation while

FORTH uses a parenthesis free

notation originally derived for formal

logic by a Polish logician, Lukasiewicz.

The difference in usage can be

compared to the difference in using an

algebraic calculator such as produced

by Texas Instruments, versus a

'Reverse Polish' calculator from

Hewlett PackardIn the FORTH compiler, new words

are added to the dictionary, and can be

used in the definition of future

programs. The structure of a word

consis ts of a header section containing

the name of the word and pointer and a

data section. The data can be either a

constant, a variable, a list of variables,

or a list of addresses if the word is an

executable word. It is LISP's ability to

treat a list as either data or program

that makes it useful for AI

programming. It is not surprising, then,

that FORTH can also be used for AIapplications. What is surprising is that

FORTH may have significant

advantages for some projects.

For instance, in a knowledge-based

system developed by General Electric

to diagnose and troubleshoot large

electric locomotives, a FORTH system

operating on a PDP-ll minicomputer

was found to be smaller and faster then

a LISP system operating on a VAX

computerlz]. If you think that such a

system would be out of your reach, a

program recently became available for

CP 1M based computers that supplies

an expert system language written in

FORTH. A recent article uses this

language to develop a weather

prediction program I5).

Hopefully, I have convinced you

that FORTH is a powerful language

that is useful for many different

applications. Not only has FORTH

been used to control large telescopes

and explore artificial intelligence, it

has been used to program text editors,

data base systems, spreadsheets and, of

course, games. Application programs ofthese types are often available from the

same vendor that sells a version of

FORTH for your machine.

If you are interested in FORTH

there are many good sources of

information. Various computer

magazines print articles on FORTH

either occasionally or on an annual

basis. Other sources of information

include newsletters and books.

MICRO has told me that it plans to

publish more FORTH articles now that

their emphasis has returned to reaching

the experienced users. Dr. Dobbs

Journal has had an annual FORTH issue

for several years. It comes out in

September and is usually very good.

Several other magazines have

published an article on FORTH at one

time or another. You might check the

availability of back issues.

One of the best information sources

is the FORTH INTEREST GROUP,FIG, (PO Box 1105 San Carlos,

CA.94070). FIG publishes a bi-monthly

newsletter and has local chapters in

many cities. Membership in FIG is $15

and includes a subscription to FORTH

Dimensions. FIG also has source

listings of FORTH for many

microprocessors and many

minicomputers. The FIG-FORTH

installation manual is a very

interesting document and I highly

recommend its purchase because it

contains vocabulary listings with

descriptions of the use of each word. Italso contains a complete FORTH

implementation written in FORTH as

an example of how large programs can

be written'

There are several good books

available ranging from introductory

level to advanced application. Starting

FORTH by Brodie is a very good

introductory text with the caveat that

it uses FORTH Inc. syntax. Threaded

Interpretive Languages by Loeliger is a

very good text on the design and

implemen tat ion of threaded

interpreters IFORTH is only one

example) and would be a good choice

for more experienced computerists,

Mountain View Press, Inc. (PO BOX

4656 Mountain View, CA. 94040) lists

over 30 books and manuals, a dozen of

these being general descriptions of

FORTH.

One last source that should not be

overlooked is the instruction manual

that comes with a FORTH system.

There are many vendors that supply

FORTH systems, and many of these

have very good documentation that

comes with their product.

This brings up my final topic. If you

decide to get a FORTH system, what

should you buy! As usual, a simple

question like this cannot be answered

simply. First you have to decide

whether to implement your own

version of FORTH using a source

listing (from FIG) or to purchase a

complete system. There are complete

systems for practically every computer

that has been on the market for more

16 MICRO No. 75 . September 1984

Page 19: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 19/76

than a few months. In fact, one

computer (Jupiter Ace at $150) comes

with FORTH as its main language. If

you decide on a complete system you

then have to decide on which FORTH

standard to use.

Most people will want to purchase a

complete system from a vendor. This

has the advantage of having a working

program immediately, and someone to

complain to when it doesn't functionin the expected manner. The main

standards that exist are original FIG-

FORTH, FORTH79, and FORTH83.

These are all standards defined by FIG.

Fortunately, FORTH83 supercedes

FORTH79 and should become the most

common standard as vendors update

their product. Original FIG-FORTH is

very common and can be extended to

meet the later standards.

Another version of FORTH comes

from FORTH Inc. This company was

started by Charles Moore, so their

FORTH has to be considered as astandard because it is the 'original'

FORTH. FORTH Inc. produces a very

professional package for many different

computers. They might be considered

the Rolls Royce of FORTH systems.

There are many vendors that

produce a FORTH that does not meet

any of the above standards for one

reason or another. Quite often these

systems have a marked speed

improvement over a standard system.

Be aware, however, that the speed

increase is usually obtained at the

sacrifice of portability to other

machines (including other processors)

which is one of the main benefits of the

standard systems. Another possiblesacrifice that is sometimes made is the

ability to produce ROMable code. Of

course this capability may not be

something you need. Then too, this

ability may not be an option on a

standard system.

My recommendations for personal

use would be to buy a FIG-FORTH

compatible system, and preferably one

that has enhancements to meet

FORTH83 standards. This type of

system can run programs written for

many different computers. Your first

system should probably be a completesystem purchased from a vendor. If you

are really brave or foolhardy you might

consider the option of configuring your

own system starting with FIG source

code. I have done this for a 6809

computer and succeeded (mostly) in

C64-fORTH/79New and Improvedfor the Commodore 64

C64-ForthI79'· for the Commodore 64-$99.95• New and improved FORTI-f-79 implementation with

extensions.

• Extension package including lines, ci rcles, scaling,

windowing, mixed high res-character graphics and sprite

graphics.

• Fully compatible floating point package including

arithmetic, relational, logical and transcendental functions.

• String ex tensions 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 applicat ion program

distribution without licensing or royal ties.

(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 PRODUCTS

EB,

I

770 Dedham StreetCanton, MA 02021(617) 828-1209 -ISA-

No, 75 - September 1984

getting it to work. This is a particularly

good route for someone who has built a

computer from scratch. Implementing

your own system is not easy, but it is

tremendously satisfying when

completed! In any case, FORTH is a

very interesting language that is well

worth learning.

References

1) Marlin Ouverson, Interview withCharles Moore, FORTH Dimensions

vol. 6, 2, pg. 2, July/Aug. 1983.

2) Kim Harris, Forth Applications

Conference, FORTH Dimensions vol.

6,2, pg. 31, July/Aug. 1983.

3) Peter J.Largeren, FORTH:

Cheaper than Hardware, FORTH

Dimensions vol. 6, 2, pg. 13, July/Aug.

1983.

4) Robert Berkey, FORMAL 1983: A

Review, Programming Techniques,FORTH Dimensions vol. 5, 5, pg. 34,

Jan./Feb. 1984.

5 J Jack Park, Expert Systems and

the Weather, Dr. Dobbs Journal vol. 9,

4, pg. 24, April 1984.

ATTENTION COMMODORE 64 OWNERS:

"Is THE CLONE MACHINE really dead?"

Yes, there comes a time when a product grows old and isn't the

latest state of the art. Thank goodness we understand that here atMicro-W. Our all new version (known as SUPERCLONE) willsurely prove thatwe are still number one in the back-up business.

You'l l stil l get the old rel iable

Clone Machine but we've

added the following'.

1) A fast clone copy (approx.

14 minutes) that's simple to use

2) A Super Unguard util.ility

that quickly handles errors

20 thru 29 (and you don't

even have to disassemble

your drive like some of our

competi tors suggest )

3) A new unique way to

back-up formerly uncopyable

software.

Don't worry if you are aregistered owner ofour earlier

version. we've got you on

file and this upgrade will only

cost you $10 plus shipping

and handling. Dealers. call

us for stock balancing on old

merchandiseSTill ONLY$49-95' Should'," made beck-ups with Super Clone. : : m : Available from: 1342B Route 23

M.~~/ Butler. N.J. 07405

'CrO-1"r . , ~ALL: (201)838-902710 OrderDISTRIBUTING. INC Dealer and Distributor lnqumes Invited

• We ... ..I la liow ~ 1 S trade c-edi: for anv o!hf'~ copv p r( ) jr <1 rr l ; :- ,2 .t 1 ,,:(). ! La ,' ,; p u r c h a s e d r owe r- t : hl !

purchase ofSUPER CLONE ,H $49 9S : o u mvst pr ov.de \,(",H or-S~[Jd. purc>-:ased product anc

state wh. , . you want ours -nsteec Th iS cff e · me , be ....I!h c:raw n al i;)Ily rime

MICRO 17

Page 20: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 20/76

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

Multi- Tasking in FORTH

SUMMARY

Multi-tasking i....a.method.·•...•.•.••...f}.£..~.•....l.~.•......your computer to work onmf}:fet1:fan

one program (task) at a time.lpre$ent.a

program that allows two sep3:fate~a~lss

to run in the 'background' wbilestill

having the FORTH interpreteravailable in the 'foreground'. The

sample tasks are a clock display, aAdap.

animated bouncing ball. Thesedmbe

replaced by just about anything,

including separate control programs for

'software robots'. I have given enough

detail to allow you to develop other

uses of multi-tasking.

FORTH is more than a language; it is

an operating system as well. In

addition, FORTH has the advantage of

being changeable, and extendable. Thismakes FORTH an ideal media for

learning how to implement various

system operations. This paper will

show how to implement one type of

multi-tasking system. It includes a

demonstration program comprised of

two separate tasks (programs) that

display the time, and a bouncing ball

on the screen while FORTH is waiting

for input from the keyboard.

To run this multi-task system you

will need a fig-FORTH system with an

assembler. The multi-task words will

work on any 6502 based machine withmodification being required only in the

stack partitioning (see section on

extensions). Stack partitioning is

defined in RESET.POINTERS, and I

have shown partitions for two FORTH

systems. The demonstration is written

for either PET or CBM machines with

version 3 or 4 BASIC. It should be easy

to modify most parts of the

demonstration to work on other

computers.

For those who are very thorough

This time the display should continue

while the numbers are being printed.

The lesson here is that you can define

any FORTH word so that the multi-tasking continues simply by inserting

sleep anywhere inside the most active

loop.

U you are the cautious type, or if the

demonstration didn't work, you will

want to debug each module separately.

Screen 112 contains a simple example

of multi-tasking that can be used to test

screens 110 and 111. If you don't have a

Pet computer this screen will be the

easiest way to try multi-tasking, since

it won't require modifying the

demonstration screens to run on your

machine. Each of the tasks in thedemonstration can be tested in a

regular (single-task) FORTH by

removing the SLEEP in KEY, BB, and

CLOCK. Once all of the pieces are I

working properly, go back one

paragraph and try again.

A few words are in order regarding

the new input structure used in [he

multi-tasking demonstration. It is

based on [he FORTH model and stores

every key [including cursor keys]. Both

the back cursor and delete keys will

by Kenneth Bu tte rfie ldLos A lam os, New Mexico

A technique and program for running

multiple tasks under FORTH.

MICRO8 No. 75 . September 1984

proofreaders, the demonstration can be

set up using screens 110,111,115,116,

and 117. Screens 112, and 113 are

useful for debugging. Be sure theassembler screens for your system are

loaded and then load screen 117. The

other screens will be loaded

automatically. As compilation takes

place you will be told that some words

(KEY, EXPECT) are not unique. When

the prompt appears, run START. If

everything is correct you will have a

clock and a bouncing ball displayed on

the top of the screen. In addition,

FORTH will be ready for input from the

keyboard. Hit a RETURN and you

should get an 'OK' response. Try

adding two numbers and printing theresult. While you are typing, the

display will operate normally.

However, when you hit return it will

stop momentarily while FORTH

interprets the line, and then it will start

up again. Now enter the following line.

: TEST 100 0 DO I • LOOP j TEST

Note that the display is halted until

TEST completes. Next enter

; TEST1 100 0 DO I SLEEP . LOOP j TEST1

Page 21: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 21/76

back up one space. All other cursor

keys are entered as part of the input.

When FORTH tries to interpret the line

you will get errors for any cursor key. If

you want to change the way FORTH

reads in a line all you need to do is

change the definition of EXPECT. This

is how PET INPUT works in Cargil and

Riley's FORTH. Incidently, you can

modify PET INPUT by adding a SLEEPin one of the inner loops, and have

much nicer input for the multi-tasking

system.

TYPES OF MULTI-TASKING

There are many techniques that can be

used to implement multi-tasking

programs. These range from being

straightforward to being involved and

complex. Most multi-tasking

techniques are simple in theory

regardless of how difficult they are to

implement. I will describe a couple ofmethods, then show how to program

one method using FORTH.

The most familiar method of

performing a series of tasks is to do

them sequentially. In FORTH this is

done by defining a word for each task.

Next, these words are invoked in order,

either from the keyboard or from

another word. In BASIC the tasks

would be a set of subroutines and a

main program would be used to call the

subroutines in order. This method of

multi-tasking is sometimes called the

hen - and - piglets method [1 ] .

The hen-and-piglets method is fine

for simple programs. It requires no

programming overhead. It is simple to

understand, and it is easy to add

another routine into the loop. The

main problem with this method is that

a slow task must finish before any

other task can start. How many times

have you waited for a long printout?

Another problem is that it might be

hard to determine the location for the

RETURN required for each subroutine.

For instance, in a terminal emulatorprogram, getting characters from the

keyboard and from the modem are

separate tasks. Sending characters to

the CRT and to the modem are other

tasks. Or are they! Characters are sent

to the modem only when received from

the keyboard. Should the task be to get

a character and send it? What if no

character is present? In this case the

task boundary becomes confused if a

RETURN is required.

Another type of multi-tasking is

timesharing. For users of big

computers, timesharing is a well

known, and often cursed, way of life.

Timesharing has advantages, but it is

complex. I am prejudiced against

timesharing because it is almost

synonymous with multi-user systems.

I bought a computer to have it to

myself. On the other hand, timesharingoffers advantages to a single user who

can run more than one task at a time.

An example of this is spooling of

printer output. Spooling means writing

the listing to a disk file (fast), and then

copying the file to the printer (slow)

using a separate task. This task will

share time with all other scheduled

tasks making it look as though several

things are being done at the same time.

Timesharing is complex because

the time to switch tasks is usually

determined by a clock that interrupts

the CPU. The next task to run isdetermined from a list of tasks and

their priorities. This requires some

calculation and adds to the

programming overhead. Fortunately,

there are other methods of multi-

tasking that can also have tasks run at

what appears to be the same time.

SLEEP

The method I am going to implement is

called SLEEP. SLEEP resembles the

hen-and piglets method, but has some

important differences, the main

difference being that each routine is a

closed loop. Instead of a RETURN at

the end of the task, a call to SLEEP is

inserted anywhere in the closed loop of

the routine. SLEEP then changes the

current task to the next task in a list. In

a sense SLEEP plays the part of the

main control loop in the hen-and-

piglets method.

As in the hen-and-piglets method,

tasks are changed under simple and

direct programmer control. There are

no automatic switchings of tasks atunknown times and places as might

happen in a timeshared system. There

is also no need to write interrupt

handling routines. The order of the

tasks which will be run is determined

by SLEEP.There is no need to calculate

priorities at the time of a switch so

overhead is kept to a minimum.

Unlike the hen-and-piglets method,

tasks do not have to be completed

sequentially. SLEEP can multi-task a

series of routines so that they appear to

run simultaneously. This is possible

because the call to sleep does not have

to be at the end of the routine. If it is

placed inside of a loop (say at a point

that requires waiting for I/O), then

only one pass through the loop will be

completed before another task is given

time to run. Note that the call to sleep

can be anywhere in the loop. It can beat the start, the end, or anywhere in the

middle. The programmer can chose a

place that makes sense to him. When

SLEEP next calls [awakens] the

routine, the loop will continue from

where it left off. SLEEP's ability to run

tasks simultaneously is similar to

time-sharing, so spooling is one of its

possible uses.

One of the main advantages of

SLEEPover hen-and-piglets is that each

task can have its own stacks and

variable storage. If each task has

separate storage for data stack, it willnot interfere with any of the the other

tasks! In fact, two tasks may be the

same program. It is not necessary to

have separate copies ofthe programs for

each task. Only the data storage needs

to be separate. Of course, tasks can

interact with each other, when desired,

through the use of shared memory.

IMPLEMENTATION OF SLEEP

There are several general

considerations that need to be kept in

mind when implementing a SLEEP

system. Each task should either be an

endless loop, or have some way of

removing itself from the list of tasks.

There needs to be a way to call SLEEP.

There needs to be a way to set up new

tasks. And last, there needs to be a way

to switch stacks, variable memory, and

program control.

For the sample multi-tasking

system implemented here, each of the

tasks will be an endless loop. This

keeps the system easier to understand

by removing spurious FORTH words.Many problems will require that the

tasks be endless loops, so this system is

useful as it stands. For instance, in the

terminal emulator program mentioned

earlier, the tasks that monitor the

keyboard and modem continuously

check for receipt of characters. When a

character is received from either the

keyboard or the modem, it is stored in

the appropriate buffer. A third task will

check to see if the modem buffer has

No. 75 . September 1984 19ICRO

Page 22: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 22/76

anything in it. If there is a character, it

will be written to the screen. Then the

task will loop back to the start. A

fourth task would monitor the

keyboard buffer and send characters to

the modem. All four tasks would be

endless loops. They would be written

and debugged independently of each

other, simplifying the programming

effort. In each of the four tasks, a singlecall to SLEEP would be added

somewhere in the loop to tie the

system together.

FORTH provides a simple way to

call sleep. All that needs to be done is

to compile the name SLEEPsomewhere

within the main loop of the task. This

can be done directly or indirectly.

Because one of the better places to put

SLEEPis at the end of a loop, one way

to compile SLEEP indirectly is to

redefine LOOP, REPEAT, UNTIL, etc.

This makes programming look

identical to a non-SLEEP environment.One problem with this approach is that

more than one SLEEP may be

compiled. This makes a task sleep

more times then necessary. The task

will still run but at a slower pace and

with more overhead for the SLEEP

program. Even though indirect

compilation of SLEEP can be slower, I

generally use it because it is easier.

Words that work in a normal FORTH

environment need only to be reloaded

using the new loop words to work with

SLEEP.

The initialization of the FORTH

SLEEPsystem has several steps. Tasks

must be added to the list of tasks to

run. Separate stacks (and variable

storage areas) must be set up. The

return stacks for each of the tasks must

be initialized. The last step is to start

the system. In the example given on

screen 112 these steps are done by

running NEW.TASKS and MAIN.

NEW.TASKS uses RESET.POINTERS

to create separate return and data

stacks for each task, and uses

INIT.TASK to initialize the retumstack. MAIN starts the multi-tasking

system after it has been initialized. It

also serves as the list of tasks to run.

MAIN, the main control word,

awakens four tasks over and over until

the break or stop key is pressed. Each

task prints its number and then puts

itself to sleep. When it is reawakened,

it executes the AGAIN to loop back.

Thus, the output is a list of the task

numbers printed repeatedly in order.

In the example, the data and return

stacks have been partitioned into five

pieces by RESET.POINTERS. One

piece is for each of four slave tasks and

one is for the main task. INIT.TASK

pushes the parameter field address

IPFA)of the word acting as a task onto

the appropriate location in the retum

stack. The data stack needs no

initializa tion.The key to changing tasks is the

word SWITCH. SWITCH saves the

current stack pointers, resets the stack

pointers for the next task, and transfers

con trol. The actual transfer is

performed by the FORTH word IS.

In ordinary operation, ;S is

compiled into a colon definition by j.

Hence, it serves as a retum from

subroutine. ;S pops an address off the

return stack and places it in the IP

(instruction pointer) register. ;S

finishes with a jump to NEXT which

loads the W register from the address inthe IP. NEXT concludes by jumping

indirectly via the W register to machine

language code. (That's three levels of

indirection in ;S.)

The words TS1, TS2, TS3, and TS4

are required for SWITCH to work

properly. They push the task number

on the data stack and, more

importantly, set up the return stack for

the eventual return to MAIN. The

return stack preparation is devious.

The: used to define TS1, etc., compiles

the word DOCOL. DOCOL is

FORTH's jump to subroutine. Itpushes

the current value of the IP onto the

return stack. The; (actually ;S) of TS1

is never executed. After the stacks have

been switched, the jump to ;S at the

end of SWITCH is performed instead.

This passes control to a new task

(TASK1). The new task will execute

until it reaches SLEEP. The stacks are

switched again, and finaly the retum

address pushed to the retum stack by

TS1 is loaded into the IP. Control is

now returned to MAIN. Hence, the

SWITCH located in SLEEPserves as the

; for TS1 and vice versa. Similar actions

occur for TS2, TS3 and TS4.

The initialization of the return

stack can now be understood. (See

definition of INIT.TASK.) TASK1 will

put the PFAon the data stack. The PFA

is then stored on the retum stack, ready

to be used by SWITCH. The array RP

contains the initial values for each of

the separate return stack pointers. The

return stack is located in page one of

memory. The stack grows toward low

memory, and the stack pointer points

to the next available address. (See

Figure 1.) Thus $0101 is added to the

value obtained from RP when the

storage address for initializing the

return stack is calculated. The PFA of

the task is used because it points to the

list of code field addresses ICFA's) of

the words comprising the task. Hence,it is the address of an address that

points to machine code. Counting the

return stack pointer, the three levels of

indirection needed for ;S are now

evident. fA more complete discussion

of the FORTH inner interpreter is

contained in reference 4/.

address value r e tu r n s t ac k

pointer

01BF

018E

01BD PFA HI018C PFA LO

018B <== RP=BB

Figure 1. Initial return stack#1where PFA is the parameter

field address of the taskthat will be TASK1.

EXTENSIONS OF THE EXAMPLE

There are several points to consider

when using SLEEP with a more

complex set of tasks. These points

include determining the size of thestacks and the technique used to store

the list of tasks to be switched. You

will also need to consider what types of

FORTH words are suitable for multi-

tasking and where to place any variable

torage.

An example of where things can go

wrong can be easily demonstrated.

While the demonstration (screen 117)

is operating define the following word.

: BALL 4 12 300 0 DO MOVE POS DRAW S LEEP

L OO P D RO P D RO P i

This BALLlooks like BB except that it

runs for only 300 times. When you run

it, however, it doesn't act at all the

same. In fact, the original ball is also

acting very strange. What went wrong!

The problem is that both BB and BALL

use the variables DX and DY. When

one of them needs to change direction,

the direction for both is changed. This

is an example of tasks sharing data

when they shouldn't. To fix this

20 No. 75 . September 1984ICRO

Page 23: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 23/76

problem either BALL should be

redefined starting from the definition of

OX and OY, or OX and DY should be

stored on the stack instead of in

variables. Since each tasks has its own

stack, there will be no interaction.

In the 6502 version of FORTH, the

data stack and retum stacks are limited

in the amount of memory that theyhave available. The FORTH return

stack uses the 6502 stack pointer. This

limits the size of the stack to one page

of memory. In addition, The terminal

input buffer (TIE) uses some of the

same space. Therefore, it is very

important to estimate the size for each

of the tasks to be multi-tasked and to

partition the stack memory

accordingly. Two bytes of the return

stack are used for each level of nesting

of FORTH words. In addition, each

active DO LOOP requires another four

bytes, two bytes for the index counter,

and two for the counter limit.

The data stack has even less space

available then the return stack. FORTH

sets aside part of the zero page of

memory for this stack and uses the

6502 X register as a stack pointer. Zero

page is also used for the IPW, and other

FORTH registers. To make matters

worse, the PET uses half of zero page

for the operating system. Other

computers may also reserve zero page

storage.

The exact location of the data stack

limits will vary from one vendor's

version to another. For FULLFORTH,

the stack is from 4 to 6E. For FORTH

by Cargil and Riley, the stack is from

20 to 88. SOcan be used to find the start

(high limit) of the data stack. SOis a

user variable that is normally used

during an ABORT to set the data stack

pointer. The lower limit is a little

harder to find. You will have to

decompile the word lSTACK [21.Most

versions of FORTH come with a word

to perform this function. If your

version does not, you will have to do itby hand.

If either of the stacks is not long

enough for the multi-tasking system

you are implementing, then you will

have to set up separate stack storage

areas for each task. SWITCH will need

to be modified to copy the various

stacks into and back out of the separate

storage areas. If care is taken in the

rewriting of SWITCH, only the

currently used parts of the stack will be

copied. This care will minimize the

time needed to switch from one task to

another. The advantage of stack

swapping is that each task can have a

full sized data and return stack. The

disadvantage is that the overhead time

(the time spent while not doing the

required tasks) is larger than forpartitioned stacks.

Another consideration when

implementing multi-tasking is the

method which is used for saving the list

of tasks to be executed. MAIN serves

this function in the current example.

Using the technique illustrated by

MAIN, it is possible to change tasks at

any time, even while multi-tasking is

going on. However, there will always

be the same number of active tasks. If

you only want three tasks, NUL.TASK

can used to replace one of the active

tasks. The price paid will be the time

spent switching to and from

NUL.TASK. The following line can be

used to replace task 2 by NUL.TASK.

I N UL .T A SK R P 2+ c@ 1 01 +1

Any of the other tasks can be similarly

replaced simply by changing the '2' to

the proper number.

If it is absolutely required that the

number of tasks be variable, some

other technique must be developed to

switch from one task to another.

Screen 113 is one way that it can be

done. The variable NUM.TASK is used

to store the current number of tasks.

The constant MAX.TASKS is the

maximum number of allowed tasks. A

new word TASK.SWITCH replaces

TSl, TS2, TS3 and TS4. SLEEP will

still be used by each of the tasks to

return to NEW.MAlN. NEW.MAlN

uses a DO LOOP index to determine

which task to execute next. When all of

the current tasks have been called

once, it loops back to the BEGIN.

NUM.TASK is used to set the number

of active tasks for this set of calls.This new technique allows the

adding or subtracting of tasks, but the

initialization and task removal

problems are more complicated than

with the original system. You will need

to consider what to do when task 2 is to

be removed while task numbers 3 - and 4

are still required. There are also

problems associated with adding a new

task to a list of tasks that have been in

operation for a period of time. In this

case only the new task's stacks should

be initialized. If all of the stacks were

ini tialized, each would 'forget'

everything that it had already

accomplished. In many situations that

could be a disaster. I have not given any

listings for solving these problems

because the solutions depend uponwhether stack partitioning or stack

switching is being used.

With either MAIN or NEW.MAIN

there are some important

considerations for the tasks

themselves. First, tasks must be colon

definitions. Tasks should either be

endless loops (BEGIN...AGAlN), or

provisions for termination of the task

will be required. Each task must call

SLEEP somewhere within the main

loop of the task. The last consideration

has to do with the storage of any

variables used by the separate tasks.

The best place to store variables is

on the data stack. If a FORTH variable

is used for storage, and more than one

task uses that variable, there is a good

possibility for confusion. This problem

can be formally stated as: tasks used in

a multi - tasking system have to be

reentrant. Reentrant means that two

versions of the same task can run at the

same time (but not necessarily in

synchronization). It isn't always

possible to use the data stack, and there

are at least two solutions for variable

storage provided by FORTH.

When only a small number of

variables are required, defining USER

variables is a good solution. A user

variable is used just like a regular

variable. The advantage is that USER

variables are addressed indirectly

through the user pointer IUP). The UP

can be changed for each task to point to

separate user table areas. Of course

these areas must be set aside and

protected. If USER variables are used

then SWITCH should be expanded to

include switching the UP. 6502FORTH has 128 bytes set aside for the

original user table, and the first 48

variables are pre-defined as system

variables. These system variables will

need to copied into each of the user

tables during initialization.

If your application needs more

storage than is available in USER

variables, separate vocabularies for

each task might be a solution. This

No. 75· September 1984 21ICRO

Page 24: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 24/76

S C R # 1 1 0

o C R . " T A S K S WIT C HIN G R O U TIN E S " B A S E @ H E X

1 ( S T O R A G E F O R T A S K S T A C K P OIN T E R S )

2 ( R O O M F O R 5 B Y T E S )

3 0 V A RIA B L E RP 3 A L L O T 0 V A RIA B L E S P 3 A L L O T

4 0 V A RIA B L E T A S K # ( C U R R E N T A C T IV E T A S K )

5 C O D E S WIT C H ( IN D E X . . . ) ( S WIT C H E S T O N E W T A S K )

6 ( G E T O L D A N D N E W T A S K N U M B E R S )7 T A S K # L D Y, 0 ,X L D A, T A S K # S T A, INX, INX,

B ( S A V E P R E S E N T P OIN T E R S )9 T X A, S P ,Y S T A, T S X, T X A, RP ,Y S TA ,

10 ( S E T N E W P OIN T E R S )

1 1 T A S K # L D Y, RP ,Y L D A, T A X , T X S, S P ,Y L D A, T A X,

12 ( S WIT C H T O N E W T A S K )

1 3 I ;S JMP,

1 4 B A S E ->

S C R # 1 1 1

o C R . " T A S K S WIT C H-2" B A S E @ H E X

1 S L E E P 0 S WIT C H

2 T S 1 1 S WIT C H S WIT C H T O T A S K 1

3 T S2 2 S WIT C H S WIT C H T O T A S K 2

4 T S 3 3 S WIT C H S WIT C H T O T A S K 3

5 T S 4 4 S WIT C H S WIT C H T O T A S K 46 N U L . TA S K B E GIN S L E E P A G AIN ;

7 T AS K IN IT IA LIZ AT IO N W OR DS )

B R E S E T . P OIN T E R S (INIT . P OIN T E R S

9 E B 1 R P + C ! B B 2 R P + C ! 6 B 3 R P + C ! 5 4 4 R P + C !

10 B 0 1 S P + C ! 50 2 S P + C ! 40 3 S P + C ! 30 4 S P + C !

1 1 ( 60 1 S P . . . 30 . . . 20 . . . 10 IS F O R F U L L F O R T H +

12 INIT. T A S K ( A D D R, IND E X .. . . ) IN D E X IS T A S K N U M B E R )

1 3 RP + C @ 101 + S W A P O V E R A D D R IS C F A O F W O R D )

1 4 I S L E E P C F A S W A P 2 + N E E D E D F O R FIR S T R U N )

1 5 B A S E ! ; S

S C R # 1 12

o C R . " M U L TI-TA S K S F O R F O R T H " B A S E @ D E CIM A L

1 M AIN B E GIN . " M AIN " T S 1 T S2 T S 3 T S 4 ? T E R MIN A L U N T IL2 T A S K 1 B E GIN C R . " T A S K 1 " S L E E P A G AIN

3 T A S K2 B E GIN C R .« T A S K 2 " S L E E P A G AIN

4 T A S K 3 B E GIN C R . " T A S K 3 " S L E E P A G AIN

5 T A S K 4 B E GIN C R . " T A S K 4 " S L E E P A G AIN ;

6 N E W . T A S K S ( INITIA L IZ E S T A C K S A N D RtT N M AIN R U N L O O P

7 R E S E T . P OIN T E R S

B I T AS K1 1 IN IT .T AS K

9 I T A S K2 2 INIT.TASK

10 I T A S K 3 3 INIT . T A S K

1 1 I T A S K 4 4 INIT . T A S K

12 M AIN

1 3 . " A L L D O N E "

1 4 ;

1 5 B A S E ! ( R E S T O R E B A S E ) ; S

S C R # 1 1 3

o C R . " N E W M AIN L O O P R O U TIN E "1 0 V A RIA B L E N U M . T A S K ( C U R R E N T N U M B E R O F A C TIV E T A S K S

2 4 C O N S T A N T M A X . T A S K ( M A XIM U M N U M B E R O F T A S K S )

3 T A S K . S WIT C H S WIT C H ; ( R E Q UIR E D T O S U P P L Y ; )

4 N E W . M AIN

5 B E GIN N U M . T A S K @ 1 + 1 D O I I . T A S K . S WIT C H L O O P

allows for the use of standard variables

and arrays. Each task, with all of its

storage variables and arrays, will have

to be compiled into a vocabulary. If the

same FORTH word will be used for two

of the tasks, then it will have to be

loaded twice, once into each

vocabulary. Vocabularies offer as much

storage as you have memory. The only

disadvantage is that the PFA's of words

that will be tasks may be a little more

difficult to obtain. Thus, the

initialization process may be more

complicated then in the example.

CONCLUSION

The answer to the question What are

the obiectives of a multi - tasking

system! will depend on who is asking

the question. Most people would agree

that the first two objectives are to

switch between tasks (programs) and to

avoid having tasks interfere with each

other. Two other objectives, mutually

exclusive, are to make the task

switching transparent to the user and

to optimize input/output operations.

There is a set of implementation

requirements that will have to be

satisfied for whatever set of objectives

is chosen. I have covered many of these

requirements in the text, but an

explicit listing of them might be in

order. Multi-tasking requires a methodof:

1) initializing the system

2) maintaining separate task data

storage

3) initiating the task switching

4) adding new tasks

5) terminating tasks that have been

completed.

All of this must be done in a way that

minimizes the time required. After all,

multi-tasking is useless if the tasks

never get a chance to run.The FORTH program described in

this paper describes how to implement

the type of multi-tasking called SLEEP .

The key word in this program is

SWITCH. SWITCH trades the system

and task variables associated with the

old task for those variables associated

with the new task. Because of its

importance, SWITCH has been coded

in machine language. All of the other

MICRO No. 75 - September 1984

Page 25: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 25/76

FORTH words are high level

definitions. Very little time penalty is

incurred for the high level words

because these words are used

infrequently. The balance between

machine language and FORTH words

in this program was chosen to illustrate

the point that the speed of operation of

a program can often be improved whenonly a small piece is written in

machine language. [Since the initial

submission of this article, two related

articles on multitasking have appeared.

See references 5 and 6.}

REFERENCE S

1) A Simple Implementation of

Multi - tasking, by Wendell Brown,

BYTE, Vol 6, 10, Oct. 1981, pg 1762) fig - FORTH 6502 Assembly Listing,

by W.F. Ragsdale, Sept. 1980, Forth

Interest Group, PO Box 1105, San

Carlos, Ca. 94070

3) fig-FORTH Installation Manual, by

W.F. Ragsdale, Nov. 1980

4) fig - FORTH Interpreters, by C. H.

Ting, FORTH Dimensions Vol 6, #1,

May/June 1984, pg 12

5) A Simple Multi tasker, by Ray

Duncan, FORTH Dimensions, Vol 5,

#2, July/August 1983, pg 20

6) A Simple Multitasking

Environment, by Martin B. Perti,

FORTH Dimensions, Vol 5, #2,

July/ August 1983, pg 22

Ken recently completed his graduate

degree in Physics at the University of

New Mexico. He has been

programming small computers for over

15 years, and doesn't trust a computer

that he can't carry, or software that

doesn't come with the source code. He

has worked in a variety of fields,ranging from ranching in Colorado, to

Laser development at the Los Alamos

National Laboratory.

S C R /I 1 1 5

o C R . " T I M E F U N C T I O N n B A S E @ D E C I M A L

1 T I 1 4 1 C @ 2 5 6 * 0 1 4 2 C @ 0 D + D R O P 2 5 6 u * 1 4 3 C @ 0 D+ ;

2 S E G 0 / I / I D R O P D R O P ; : C O L O N 5 8 H O L D ; : L O C - 3 2 7 2 8 H L D

3 E M I T T I M E L O C S E G C O L O N S E G C O L O N S E G ;

4 S M A 6 0 M j M O D R O T D R O P 3 6 0 0 M / S W A P 0 6 0 M / S W A P

5 T I M E B A S E @ D E C I M A L T I S M A E M I T T I M E B A S E ! ;

6 C L O C K B E G I N T I M E S L E E P A G A I N

7 C R .« B O U N C I N G B A L L . .

8 1 V A R I A B L E D X 1 V A R I A B L E D Y

9 X C H E C K D U P 0 = O V E R 3 8 > O R I F D X @ M I N U S D X ! E N D I F ;

1 0 Y C H E C K D U P 0 = O V E R 5 > O R I F D Y @ M I N U S D Y ! E N D I F

1 1 P O S O V E R O V E R 4 0 * + 3 2 7 6 8 + ; : D R A W 1 2 8 T O G G L E

1 2 M O V E Y C H E C K S W A P X C H E C K D X @ + S W A P D Y @ + ;

1 3 B B 1 3 P O S D R A W

1 4 B E G I N M O V E P O S D R A W S L E E P A G A I N D R O P D R O P

1 5 B A S E ! - >

S C R /I 116

o C R . " D E F I N E N E W F O R T H S Y S T E M I N P U T S T R U C T U R E . .B A S E @ H E X

1 C O D E ( K E Y ) X S A V E S T X , F F E 4 J S R , X S A V E L D X , P U S H 0 A JMP , F O R T H

2 C R S O N 1 0 0 A 7 ! ; ( T U R N C U R S O R O N )

3 C R S O F F 1 A 8 C ! B E G I N A A C @ U N T I L 1 A 7 C ! ; ( C U R S O R O F F )

4 K E Y C R S O N B E G I N ( K E Y ) S L E E P - D U P U N T I L C R S O F F ;

5 E X P E C T ( T E R M I N A L I N P U T M E M O R Y - 2 )

6 O V E R + O V E R D O K E Y D U P 9 D = I F D R O P 1 4 E N D I F D U P 1 4 = ( D E L ?

7 I F O V E R I = D U P R > 2 - + > R - E L S E ( N O T D E L ) D U P 0 D =

8 I F ( R E T U R N ) L E A V E D R O P B L 0 E L S E D U P E N D I F

9 I C ! 0 I 1 + ! E N D I F E M I T L O O P D R O P ;

1 0 M Q U E R Y T I B @ 4 6 E X P E C T 0 I N ! ; ( L I N E I N P U T )

1 1 M Q U I T ( R E S T A R T , I N T E R P R E T F R O M T E R M I N A L )

1 2 0 B L K ! [ C O M P I L E ] [ B E G I N R P ! C R M Q U E R Y I N T E R P R E T

1 3 S T A T E @ 0 = I F . " O K . .E N D I F A G A I N ;

1 4 B A S E ! ; S

S C R /I 117

o C R . " M U L T I - T A S K I N G F O R T H " B A S E @ D E C I M A L

1 1 1 0 L O A D 1 1 5 L O A D

2 6 U S E R S 0 8 U S E R R 0

3 M A I N B E G I N T S 3 T S 1 T S 3 T S 4 T S 3 A G A I N ;

4 S T A R T ( I N I T I A L I Z E ' S T A C K S A N D S T A R T M U L T I - F O R T H )

5 R E S E T . P O I N T E R S

6 ( N E X T 2 L I N E S H O O K I N T E R P R E T E R I N T O S Y S T E M )

7 1 S P + C @ S 0 C ! 1 R P + C @ R 0

8 I M Q U I T C F A I Q U I T !

9 I M Q U I T 1 I N I T . T A S K

1 0 I B B 3 I N I T . T A S K

1 1 I C L O C K 4 I N IT . T A S K

1 2 M A I N ; H E X

1 3 S T O P I 0 C F A I Q U I T ! C O L D

1 4 ( S T O P W I L L R E T U R N T O R E G U L A R F O R T H S Y S T E M

1 5 B A S E ! ; S

o

No. 75 . September 1984 23ICRO

Page 26: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 26/76

When modifying a program, it is useful

to know the calling structure of that

program. That is, given a FORTH word,

XYZ, what is every FORTH word usedto define XYZ for all calling levels

down to the FORTH machine language

primitives? A graphical representation

of the calling structure is known as a

"structure chart" (refer to Structured

Design by Yourdon and Constantine).

"Structure tree" is the text equivalent.

In FORTH, a Structure Tree is an

inden ted lis ting of each "colon

definition" with all of the FORTH

words used to define that word.

For example, assume that the

following FORTH words have been

defined:

A 1 ;

B 2 + ;

C 3

D A B C /

A B A B ;

E A B D A B

A Structure Chart for word E is

shown in Figure l. An equivalent

Structure Tree is shown in Figure 2. (In

this case, the Structure Tree shows the

calling levels of only the applicationwords.) For every colon definition, all

words comprising that word's defini-

tion are printed in an indented fashion.

For example, in Figure 2, word D in

line #8 is at level l.Lines 8 through 16

comprise the Structure Tree of the

word D covering levels 1 through 3

After the word, /, the level is back

to 1 and the Structure Tree of D is

completed. As can be seen, the

Structure Tree contains redundancy

not found in the Structure Chart.

Structure TreesIn

FORTHb y M ichael D ougherty

L ittle ton, Colo ra do

S C R # 76

o ( S TR UC TU RE T RE E U TIL IT Y

1

2 T o load the utility:

3 76 L O A D4

5 T R E E U sage:

6 T o list the S tructure T ree

83 1 B YT ES

of word X Y Z :

T R E E X Y Z

7

8

9

1 0

11 -->

S C R # 77

o 0 V A R IA B L E L E V E L

1 1 0 V AR IA BL E M AX-L EV EL

2

3 N U L L ;4 ' N U L L C F A @ C ON ST AN T C OL ON

5 ' ; S C F A C O N S T A N T S E M IC O L O N

6

C urrent level of T RE E b ranch)

M aximum T R E E branch level )

D ummy def to get : efa value)Pointer to code of word)

T erminating C F A of : word )

o7 ' 0B R A N C H C F A C O N S T A N T '0B R A N C H W or ds c om pi li ng a rg um en ts

8 ' B R A N C H C FA C ON ST AN T ' B R A N C H

9 ' L IT C FA C ON ST AN T 'LIT

1 0 ' C L IT C FA C ON ST AN T 'C LIT

1 1 ' ( L O O P ) C F A C O N S T A N T ' L O O P

1 2 ' ( +L OO P ) C FA C ON ST AN T '+ LO OP

1 3 ' (. II) C FA C ON ST AN T ' "1 4

1 5 ->

o

o

S C R # 78o ( D R A W A B A R F O R T H E C U R R E N T L E V E L )

o

1

oength -- )

If length > than 0 )

F or l en gt h c ha ra ct er s

( P rint a bar )

2 B A R

3 -D U P IF

4 0 D O

5 A S C II E MIT

6 L O O P

7 E N D IF

8

9 -->

o

o

o

24 MICRO No. 75 . September 1984

Page 27: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 27/76

Figure 1. Sample Structure Chart.

S C R # 7 9

o ( C A S E S T A T E M E N T B Y D R . C . E . E A K E R , F O R T H D I M E N S I O N S [V2,#3]

1

2 D O C A S E ? C O M P C S P @ ! C S P 4 ; I M M E D I A T E

34 < < 4 ? P A I R S C O M P I L E O V E R C O M P I L E ~ C O M P I L E 0 B R A N C H

5 H E R E 0 , C O M P I L E D R O P 5 ; I M M E D I A T E

6

> > 5 ? P A I R S C O M P I L E B R A N C H H E R E 0

S W A P 2 [ CO MP IL E ] E N D I F 4 ; I M M E D I A T E

7

8

9

1 0

11

1 2

1 3

1 4

15 ->

E N D C A S E S 4 ? P A IR S C O M P I L E D RO P

B E G I N S P @ C S P @ ~ 0 ~ W H I L E

2 [ C OM PI LE ] E N D IF R E P E A T

C S P ! ; I M M E D I A T E

S C R # 8 0

o ( P R I N T T H E A RG U M E N T

1

2 P R I N T - A R G

34 D O C A S E

5 1 < < 2 + D U P C @ . 1 +6 2 < < 2 + D U P @. 2 +

7 3 < < 2 + D U P C @ S W A P 1 + S W A P

8 0 D O

9 D U P C @

1 0 E M I T

1 +

L O O P

E N D C A S E S

11

1 2

1 3

1 4

15 ->

S C R # 8 1

o ( M O V E P F A O N S T A C K T O N E X T W O R D

1

234

5

6

7

8

9

1 0

11

1 2

1 3

1 4

15 ->

M O V E - W O R DD U P @

D O C A S E

' 0 B R A N C H < < 2 P R I N T - A R G

' B R A N C H < < 2 P R I N T - A R G

' L I T < < 2 P R I N T - A R G

' C L I T < < 1 P R I NT -A R G

' L O O P < < 2 P R I N T - A R G

' + L O O P < < 2 P R I N T - A R G

, rr < < 3 P R I NT -A R G

S W A P 2 + S W A P

E N D C A S E S

( a ddr n - addr )

> > ( Skip/print 1 byte )> > (Skip/print 2 bytes )

( Skip/print n bytes )

( For len of string )

( Get a dim str char )

( Print it )

( Next string addr )

»

( addr - addr+offset )( Get cfa eompiled at ptr

( Check for special move )

> > ( Skip 2 byte offset )

> > ( Skip 2 byte offset )

> > (S kip 2 byte value )

> > (S kip 1 byte value )

> > (Skip 2 byte offset )

> > (Skip 2 byte offset )

> > ( S kip strin g t ill rr )

( Skip only the ptr itself

No. 75 . September 1984 MICRO

E

1 AB

2------

A

3---------

1. . . ,

BL------3--------- 2

3 +----_----1 D

. . . ,AL------

3--------- 1. . . , BL------3

. . . ,---------

.L

3 +---------

2------ C

3---------

3

2------

/

1 AB2------ A

3--------- 1. . . ,BL------

3. . . ,

--------- .L

3 +---------

Figure 2. Sample Struture Tree

(for Structure Tree Utility)

The Structure Tree serves as a

"roadmap" of the FORTH application.

As in a roadmap, the Structure Tree

does not tell how execution travels

through the words. Instead, the

Structure Tree provides all the words

which could be called during the

execution of a specific word. When

modifying another programmer's code

lor your own after a sufficient amount

of time), knowing who calls whom will

help identify the words which should

be changed.

Tree

The Structure Tree Utility, TREE, is

defined in Listing 1. TREE generates a

Structure Tree from the application

dictionary in memory. Once the TREE

and application are LOADed, the

Structure Tree of word XYZ is printed

by:

TREE XYZ

The output may be directed to the

printer by the Atari fig-FORTH word

PON. Since FORTH is a highly nested

language, a Structure Tree listing can

be quite lengthy. [The Structure Tree of

"." requires two and a half pages I) To

limit the nested listing, two parameters

are used in TREE. If a definition of a

word is below the current value of

FENCE, the Structure Tree will not

continue to a lower level for that

particular "tree branch." Further, the

25

Page 28: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 28/76

. . . . • . . . .. . . .. • · · . · · · · · · · · · > . i . ....•... . .. .

maximum level of the Structure Tree

may be limited by the variable MAX-

LEVEL. In either case, a Structure Tree

branch will be terminated when TREE

encounters a word not defined as a

colon definition [ i .e., VARIABLE,

CONSTANT, CODE, etc.). TREE may

be aborted while listing by simply

pressing any key other than BREAK.

Upon execution, TREE determinesthe parameter field address (pfa) of the

next input word with "tick" ('). The

name is printed and DO-TREE is used

to print the actual Structure Tree. DO-

TREE basically executes a loop until

there are no parameter field addresses

on the stack [i e., when variable LEVEL

goes to zero). If the parameter field

address on top of the stack does not

point to the end of the definition (;S),

the name of that word is printed with

indentation determined by LEVEL. IF

the word is a colon definition not

defined below FENCE, and LEVEL isless than MAX-LEVEL, then this new

pta is pushed onto the stack, LEVEL is

incremented, and the loop repeated.

When the end of the colon definition is

reached, the pfa is popped off the stack,

DO- TREE moves the pfa to the next

word, LEVEL is decremented and the

loop again repeated. When LEVEL goes

to zero, the last pfa has been popped

and DO-TREE is finished.

The only problem with the FORTH

dictionary is that words such

as BRANCH, LIT, and ." compile

arguments directly into the word

heing TREEed. The word MOVE-

WORD is designed to skip these

compiled argumen ts. If your

application has additional defining

words which compile arguments into

the definition, then MOVE-WORD will

have to he extended.

Conclusion

When faced with modifying a FORTH

application written by another

programmer, the Structure Tree

generated by TREE can be an invaluable

tool. The Structure Tree allows one

to determine how a word is reached

during execution, as well as who the

word calls.

Reference

Structured Design, Fundamentals of a

Discipline of Computer Program and

Systems Design by Edward Yourdon and

Larry L . Constantine.

S C R # 82

o ( P RIN T T H E N A M E W H O S E C F A IS P OIN T E D T O B Y S T A C K A D D R

1

2 P RIN T -N A M E

3 C R

4 L E V E L @ 3 . R

5 L E V E L @ 3 * B A R6 @7 2 +

8 N F A

9 ID .

1 0

11 -->

addr -- )

N ew line for output

P rint the level number

O utput a bar 3 *L E V ELG et the cfa )

M ove to the pfa

M ove to nfa )

P rint name )

o

o

o

o

o

o

o

o

o

o

o

o

o

o I

o

o

o

o

o

26

S C R # 83

o ( P R IN T A W O R D T R E E

1

2

34

56

7

8

9

1 0

11

12

13 -->

( pfa - )

1 L E V E L ( Init level to first)

B E G IN ( U ntil t he stack i s empty )

? T E R MIN A L IF A B O R T E N DIF ( A bort T R E E if key pressed )D U P @ S E MIC O L O N = 0= IF ( If not at a ; S word)

D U P P RIN T -N A M E ( P rint the word down below

D U P @ @ C O L O N = ( If lower word is a : def )

L E V E L @ M A X-L E V E L @ < A N D ( and less than M A X-L E V E L

O V E R @ F E N C E @ > A N D IF ( and greater than fence)

1 L E V E L +1 ( G o down to the next level)

D U P @ 2 + ( G et the pfa of that level )

D O-T R E E

S C R # 84

o ( P R I~T A W O R D T R E E, C O N T 'D )

1

2

34

5

6

7

8

9

1 0

11

E L S E N ot a colon )

M ove over to nextO V E-W O R DE N DIF

E L S E E nd of a colon definition

P op up to next level )

D rop the addr pointer )

M ove over )

-1 L E V EL +!

D R O P

M O V E-W O R D

ENDIF

L E V E L @ 0= U N TIL U ntil stack is empty )

12 ->

S C R # 85

o ( U S E R E N T R Y F O R T R E E )

1

2 TR E E3 C R

4 [ C O M PIL E ] I

5 D U P N F A ID .

6 D O-T R E E

7 C R ;

8

9 ;5

. . . T R E E word . " )

G et pfa of next inpu~ word )

P rint word to be T R E Eed )

P rint Structure Tree of pfa )

MICRO No. 75 . September 1984

Page 29: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 29/76

Text Write Edit Read Program

(T.W.E.R.P.)

Now reading, wri'ting and editing textfiles

is easy.

Introduction

Sequential text files provide a method

for quickly storing and retrieving data.

They are essential for data-basedprograms (such as telephone number

listing, accounts receivable, etc.). Also,

they have other useful applications.

Programs can be shortened by storing

variables and strings in a text file and

loading them after the program is run

(viz. during the first few lines). If

formatted properly, text files may be

used as exec files which greatly extend

programming flexibility. For example,

it is possible to rewrite a program while

it is running using an exec file.

Unfortunately, text files are hard to

use. There is no direct command to list

their contents. You cannot "see" them

except indirectly. Files may contain

extra data or spaces and it is often

difficult to check for these conditions.

To write an exec file it is necessary to

create a cumbersome exec file program.

The Textfile Write Edit Read

Program (T.W.E.R.P.) was written to

help write and edit text files. Using

the program it is possible to read any

sequential text file and to add, remove

or edit any line within the file. Error

by N.D. Greene

S to rrs , Connecticut

trap routines detect and prevent user

mistakes.

Program Desc:ription

A program listing is shown in Figure l.

The main program is only five lines

long (lines 10-50). It calls a series

of subprograms to perform various

functions (e.g. load, read, save). These

subprograms call other subroutines to

run frequently used operations. The

program has been written in modular

form with the modules separated by

remark statements. These are used

only to make it easier to review the

listing - they are not required to run

the program.

It may be helpful to briefly review

the program, since it contains several

routines which might be useful in your

programs. TWERP uses a command

rather than a self-prompting menu. The

program does not ask questions, it

waits for user commands. No cursor

appears unless the user has activated

a command which requires further

input. Nine, single, keystroke

mnemomic commands [e.g., < R>READ) are used, and they remain in

view at all times. A keypress is

No. 75 . September 1984 MICRO 27

detected with the WAIT command

(line 1200) and its value returned as K$.

This is examined and the program is

routed to the appropriate subprogram

using the short routine in lines 30-50.If any key other than a code key is

pressed, the control is returned to line

30.

Files are loaded from either the

keyboard or disc. As prompted by the

program, entering K activates the

keyboard mode. Entering three .' s

terminates entry. Since the length of

a text file is often unknown, it is

difficult to read it completely without

an out of data error and program

termination. This problem is avoided

by using the ONERR command (line 5)

and then reading a disc text file until an

error occurs. Line 1000 tests for the out

of data error code (5). If it is present,

the file is closed and the total number

of lines (fields) is calculated by

subtracting 1f rom the value of the loop

counter, I, that caused the error.

The file in memory may be

reviewed by the < R> READ

command. It may be saved at anytime

[with the option of changing its name).

Adding or deleting lines is done by

algorithms which insert or remove

Page 30: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 30/76

lines and then renumber the file. records are in memory.

Adding a line except at the end of the

file, displaces the original lines

upward. For example, if

a new line number .3 is inserted, the

original line number .3becomes 4, the

original line number 4 becomes 5, and

so on. Similarly, if a line is deleted,

all lines with greater numbers are

displaced downward. I f the < E> EDIT

command is chosen, the current line isdisplayed together with a new, blank

line for entering changes. This new line

replaces the original.

The commands for catalog, print

and quit simply list the contents of the

current disc, print the file in memory

or end the program. The printout

should work with most printers.

However, if special commands are

needed, these may be entered at line

8.30 [printer on) and line 850 [printer

offl.

Error traps start at line 1000. Asnoted before, this line is used to detect

the end of a data file. Lines, 1010,

10.30 and 1040d are a universal error

routine which may be used in any

program. Line 1020 tests to see if any

Listing 1

written here as a subroutine.

The subroutines are used by thevarious subprograms extensively. All Program Applications

inputs are entered via the input

anything subroutine'. Commas and

other characters forbidden by the

normal input command may be enteredand this routine limits the length of; DOS moved to a language card. Using

lines to 255 characters. Backspacing \,TWERP, text file manipulation is

erases characters - a very helpful iltno51~~__ea~ __~ __prograT!1ining in

feature. The wait routine mentioned BASIC. It is especially easy to createabove, waits for a keypress by checking exec files, one of the more powerful and

address 49152 for a value greater than less used routines available in

128. It then converts this value into a Applesoft " .. TWERP also provides an

normal ACSII character and stores it is easy way to rename text files and/ or totransfer them to another disk.K$. The wait address is then reset by a

poke to 49168. This is an excellent

routine for single keystroke menus.

The wink cursor is a similar

subroutine, frequently used by Beagle

Bros. * in their commercial programs.

It loops through the wait and reset

addresses while overprinting to achieve

a blinking effect. Center title is alsoa useful programming tool. The caption

to be centered is sent to the subroutine

as an M$ string together with the

desired vtab, V. Since arrow labels are

used throughout the program, it was

( T . W . E . R . P )

T EX T FIL E W RIT E E DIT R E A D P R O G R A H

N .D . G RE EN E

C O P YRIG H T ( C ) 1 9 83

5 D $ = C H R $ ( 1 3 ) + C H R $ ( 4 ) : DIM S $ ( 5~!0):

P OK E 4 44 52,1 9: P OK E 4 46 05 ,1 8:

O N E R R G O TO 1000

6 R E M

7 R E M M AIN P RO GR AM

8 R E M

10 H O M E :V = 10:

M $ = " TE XT FIL E W RIT E E DIT R EA D P RO GR AJ II" :

G OS UB 1 19 0: V = 12 : M $ = ,,( T .W .E .R . P . ; " :

G O S U B 1 1 90: P RIN T: V T A B 21:F O R I = 1 T O 40: P RIN T

" = " ; : N E X T

V T A B 22:

PRINT « < C > C A T A L O G " T A B ( 1 7) ,,<A > A D D " T A B ( 32)

" < P > P RIN T " ; :

P RIN T < L > L O A D " T A B ( 1 7) ,,<D > D E L E~:E " T AB ( 32)

,,<S > S A V E " ; : P RIN T « < R >

R E A D " T A B ( 1 7) " < E > E DIT " T A B ( 32)« < Q > Q UIT " ;

:V T A B 4 : P O K E 3 5,20

e

This program works with Apple II, II +

and II/ e Computers' *. Errors may

occur if it is run on systems with

Acknowledgements

Thanks to R.H. Gandhi for his helpful

suggestions and to L. Fosdick for

supplying the input anything routine

and his permission to usc it in this

program.

'Written by L Fosdick, E C & C

Princeton Applied Research, Princeton, N[

'Beagle Bros, Inc, San Diego, CA

"Registered Trademark

30 C A L L 5 4 9 1 5 : G O S U B 1200: F O R I = 1 T O 9 :

IF K $ = M ID $ ( "L RS AD EC PQ ",I,l) T HE N 5 0

40 N E X T

5 0 O N I G O SU B 1 00 ,2 00 ,3 00 ,4 00 ,5 00 ,6 00 ,7 00 ,8 00 ,

900,30R E M0

6 1

62

100

1 10

R E M L O A D FIL E

R E MH O M E V T A B 10: H T A B 5 : P RIN T " FIL E N A M E :" ;

V = 20:M$(1) = " D DIS K < K > K E Y B O A R D " :

M$(2) = " < D > DIS K < K > K E Y B O A R D " : G O S U B 1210:

IF K $ < > " D " A N D K $ < > " K " T H E N 1 10

V T A B 20: H T A B 1 : C A L L - 868:

IF K $ = " K " T H E N F $ = " K E Y B O A R D " :S T = 1 :G O T O 1 70

1 30 V T A B 10: H T A B 1 6 : G O S U B 1 100

1 40 F $ = T $: P RIN T D $; " VE RIF Y" ;F $:

P RIN T D $; " OP EN " ;F $: : P RIN T D $; " RE AD "; F $:

H O M E :V = 10:M$ = " LO AD IN G F IL E. " : G OS UB 1 19 0:

F O R I = 1 T O 5 00:S $( I) = ""

1 50 G E T K $ :

IF K $ < > C H R $ ( 1 3 ) T H E N S $ (I) S $ (I) + K $ :

G O T O 1 50

120

28 MICRO No. 75 . September 1984

Page 31: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 31/76

• · · • · · •• . · · • · ·. · · · ·• • • . • .· . · } < · • .. · . · . > i . .· . ·· . ii . .i··.··.·.. i > . . . . . . . . . . . .

(continued)

1 6 0 P R I N T " . . " ; : N E X T : G O T O 3 0

1 7 0 H O M E : V = l : M $ = " E N T E R = > ** * < = T O S T O P " :

G O S U B 1 1 9 0 : P R I N T : P R I N T :

F O R I = S T T O 5 0 0 : P R I N T

1 8 0 N X = I : G O S U B 1 2 3 0 : G O S U B 1 1 0 0 : S $ ( I ) = T $ :

I F S $ ( I ) = "***" T H E N N = I - l : V = 1 0 :M $ = " E N T R Y E N D E D A T L I N E N O : "+ S T R $ ( N ) :

H O M E : G O S U B 1 1 9 0 :

G O T O 3 0

1 9 0 N E X T

1 9 1 R E M

1 9 2 R E M R E A D F I L E

1 9 3 R E M

2 0 0 G O S U B 1 0 2 0 : H O M E : F O R I = 1 T O N : N X = I :

G O S U B 1 2 3 0 : P R I N T S $ ( I ) : I F

P E E K ( 3 7 ) < 1 7 T H E N 2 2 0

2 1 0 V = 2 0 : M $ ( 1 ) = " P R E S S A N Y K E Y F O R M O R E " :

M $ ( 2 ) = " P R E S S A N Y < K E Y > F O R

M O R E : G O S U B 1 2 1 0 : H O M E

2 2 0 N E X T G O T O 3 0

2 2 12 2 2

2 2 3

3 0 0

R E MR E M S A V E F I L E

R E M

G O S U B 1 0 2 0 : H O M E : V T A B 1 0 : H T A B 5 :

P R I N T " F I L E N A M E : " ; F $

V = 2 0 :

M $ ( l ) = « < S > S A V E C C H A N G E < E > E X I T " :

M $ ( 2 ) = " S S A V E < C >

C H A N G E E E X I T " : G O S U B 1 2 1 0 :

F O R I = 1 T O 3 : I F K $ = M I D $

( "S CE ", I, l) T H E N 3 30

N E X T

O N I G OT O 3 4 0, 3 70 , 38 0 ,3 1 0

V = 1 0 : M $ = " S A V I N G F I L E "

H O M E : G O S U B 1 1 9 0 : P R I N T D $ " O P E N " F $ :

P R I N T D $" D E L E TE "F $: P R IN TD $ "O P E N "F $ : P R I N T D $ "W R IT E " F $

F O R I = 1 T O N : P R I N T S $ ( I ) : N E X T :

P R I N T " C L O S E " : H O M E : V = 1 0 : M $ =

" F I L E S A V E D " : G O S U B 1 1 9 0 : G O T O 3 0

V T A B 1 4 : H T A B 5 : P R I N T " N E W N A M E : " ; :

G O S U B 1 1 0 0 : F $ = T $ : G O T O 3 0 0

H O M E G O T O 3 0

4 8 0 S $ ( I ) = T $ : N = N + 1 : H O M E : V = 1 0 :

M $ = " A D D E D L I N E N O : "+ S T R $ ( N A ):

G O S U B 1 1 9 0 : G O T O 3 0

R E M

R E M D E L E T E L I N E S

R E MG O S U B 1 0 2 0 : H O M E : V T A B 1 0 : H T A B 5 :

P R I N T " D E L E T E L I N E N O : " ; : G O S U B

1 1 0 0 : N D = V A L ( T $ ) : I F N D < 1 O R N D >

H O M E : V T A B 1 0 : N X = N D : G O S U B 1 2 3 0 :

P R I N T S $( N D )

V = 2 0 : M $ ( 1 ) = " D D E L E T E < E > E X I T " :

M $ ( 2 ) = « < D > D E L E T E E E X I T " :

G O S U B 1 2 1 0 : I F K $ = " D " T H E N 5 5 0

I F K $ = " E " T H E N 3 8 0

G O T O 5 2 0

I F N D = N T H E N N = N - 1 : G O T O 5 7 0

F O R I = N D T O N - l : S $ ( I ) = S $ ( I + 1 ) :

N E X T : N = N - 1

oN T H E N 5 0 0

o

3 1 0

3 2 0

3 3 0

3 4 0

3 5 0

3 6 0

3 7 0

3 8 0

3 8 1

3 8 2

3 8 3

4 0 0

R E M

R E M A D D L I N E S

R E M

G O S U B 1 0 2 0 : H O M E : V T A B 1 0 : H T A B 5 :

P R I N T " A D D L I N E N O : " ; : G O S U B 1 1 0 0 :

N A = V A L ( T $ ) : I F N A < 1 O R N A > N + 1

T H E N 4 0 0

I F N A = N + 1 T H E N S T = N + 1 : G O T O 1 7 0H O M E : V T A B 1 0 : N X = N A : G O S U B 1 2 3 0 :

G O S U B 1 1 0 0

V = 2 0 : M $ ( 1 ) = « < A > A D D E E X I T " :

M $ ( 2 ) = " A A D D < E > E X I T " : G O S U B

1 2 1 0 : 1 = N + 1 : I F K $ = " A " T H E N 4 6 0

I F K $ = " E " T H E N 3 8 0

G O T O 4 3 0

S $ ( I ) = S $ ( I - 1 ) : 1 = I - 1 :

I F I = N A G O T O 4 8 0

G O T O 4 6 0

4 8 1

4 8 2

4 8 35 0 0

5 1 0

5 2 0

5 3 0

5 4 0

5 5 0

5 6 0

5 7 0 H O M E : V = 1 0 : M $ = " D E L E T E D L I N E N O : II.

G O S U B 1 1 9 0 : P R I N T N D : G O T O 3 05 7 1

5 7 2

5 7 3

6 0 0

R E M

R E M E D I T L I N E S

R E M

G O S U B 1 0 2 0 : H O M E : V T A B 1 0 : H T A B 5 :

P R I N T " E D I T L I N E N O : " ; : G O S U B 1 1 0 0 :

N E = V A L ( T $ ) : I F N E < 1 O R N E > N T H E N 6 0 0

H O M E : V T A B 8 : N X = N E : G O S U B 1 2 3 0 :

P R I N T S $ ( N E ) : P R I N T : P R I N T : G O S U B

1 2 3 0 : G O S U B 1 1 0 0

V = 2 0 : M $ ( 1 ) = « < A > A D D E E X I T " :

M $ ( 2 ) = " A A D D < E > E X I T " : G O S U B

1 2 1 0 : I F K $ = " A " T H E N 6 5 0

I F K $ = " E " T H E N 3 8 0

G O T O 6 2 0

S $ ( N E ) = T $ : H O M E : V = 1 0 :M $ = " E D I T E D L I N E N O : "+ S T R $ ( N E) :

G O S U B 1 1 9 0 : G O T O 3 0

o

o

o

o

o

o

o

o

o

o

o

o

o

o

o

o

4 1 04 2 0

4 3 0

4 4 0

4 5 0

4 6 0

4 7 0

No. 75 . September 1984 MICRO

6 1 0

6 2 0

6 3 0

6 4 0

6 5 0

6 5 1

6 5 2

6 5 3

7 0 0

R E M

R E M

R E M

C A T A L O G

H O M E P R I N T D $ ; " C A T A L O G " : V = 2 0 :

M $ ( l ) = " P R E S S A N Y < K E Y > T O C O N T I N U E

: M $ ( 2 ) = " P R E S S A N Y K E Y T O C O N T I N U E " :

G O S U B 1 2 1 0 : G O T O 3 8 1 ' l

R E M1 ' l 4

7 1 ' l 5 R E M

7 1 ' l 6 R E M

8 1 ' l 1' lO S U B 1 1 ' l 21 ' l :O M E : V = 1 1 ' l :

M $ = " T U R N P R I N T E R O N " : G O S U B 1 1 9 1 ' l : = 1 3 :

M $ ( l ) = » < S > S T A R T E E X I T " :M $ ( 2 ) = " S S T A R T < E > E X I T " : G O S U B 1 2 1 1 ' l :

I F K $ = " S " T H E N 8 3 1 ' l

8 1 0 I F K $ = " E " T H E N 3 8 1 ' l

8 2 0 G O T O 8 1 ' l 0

8 3 0 P R # 1 : P R I N T

8 4 1 ' l F O R I = 1 T O N :

P R I N T C H R $ ( 9 1 ) ; I ; C H R $ ( 9 3 ) ; " = > " ; S $ ( I ) : N E X T 0

8 5 0 P R # 0

8 6 1 ' l V = 1 2 : M $ = " P R I N TO U T C O M P L E TE D ": H O M E :

G O S U B 1 1 9 1 ' l :G O T O 3 1 ' l

P R I N T

(Continued on next page)

29

Page 32: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 32/76

MicroMotion

MasterFORTHIt's h ere - the next generCltionof M icroM otion F orth.

• Meets all provisions, extensions and expenrnentolproposals of the FORTH-83Intemational Standard.

• Usesthe host operating system file structure (PWLE

DOS 3.3 & CP/M 2.x)

• Built-in micro-assembler with numeric local labels.

• A full screen editor isprovided which includes 16x

64 format, can push & pop more than one line,

user definable controls, upper/lower case key-

board entry, A COPYutility moves screens witl'lin &

between lines, line stack, redefinable control

keys, and search & replace commands.

• Includes all file primitives described in Kemigan

and Plauger's Software Tools.

• The input and output streams are fully redirectable.• Theed .tor.assembler a nd scree ncopy uti Ilt lesare

provided as relocatable object modules. They

are brought into the dictionary on demancl and

may be released with a single command.

• Many key nucleus commands are vectored. Error

handling, number parsing, keyboard translotion

and so on can be redefined as needed by user

programs. They are automatically returned to

their previous definitions when the program is

forgotten.

• The string-handling package is the finest and

most complete available

• A listing of the nucleus is p rovided as part of the

documentation

• The language implementation exactly matches

the one described in FORTHTOOLS,by Anderson

& Tracy. This 200 page tutorial and reference

manual is included with MasterFORTH

• Floating Point & HIRESoptions available

• Available for APPLEII/II+/lle & CP/M 2.x users.

• MasterFORTH- 5100.00. FP& HIRES540.00 each

• Publications

• FORTHTOOLS- 520.00

• 83 International Standard - 515.00

• FORTH-83 Source Listing 6502, 8080, 8086 -

520.00 each

Contact:

MicroMot ion12077 Wilshire Blvd" Ste. 506

LosAngeles, CA 90025

(213) 1321-4340

30

(continued)

o

86 2

86 3

86 4

9 00

R E M

R E M Q U IT

R E Me

T E X T P O K E 4 4 4 52,22: P O K E 4 4 6 05 ,21 : H O M E

P OK E 21 6 ,0: E N D

R E M

R E M E R R O R T R A P S

R E MIF P E E K (222) = 5 T H E N P RIN T D $ ; " C L O S E " :

N = I - 1 : H O M E : V T A B 10: H T A B 1 2 :

P RIN T N ; " R E C O R D S L O A D E D " : G O T O 30

H O M E :V = 1 2:M $ = " E R R O R C O D E :" : G O S U B 1 1 90:

P RIN T P E E K ( 222): G O S U B 1 04 0: G O TO 3 80

IF N = 0 T H E N H O M E :V = 1 2:

M $ = " N O R E C O R D S IN M E M O R Y " : G O S U B 1 1 9 0:

G O S U B 1040: G O T O 3 80

1030 R E T U R N

1040 F L A S H :V = 1 0:M $ = " O PE RA T OR A LE R T" :

G O S U B 1 1 90: N O R M A L :V = 20:

M $ ( 1 ) = " P R E S S A N Y < K E Y > T O R E S E T " :

M $ (2) = " P R E S S A N Y K E Y T O R E S E T " :

G OS UB 1 21 0: R ET UR N

1050 R E M105 1 R E M

1052 R E M

105 4 R E M

105 5 R E M

1 1 00 T $ = " " :K = 0

1 1 10 G E T K $ :J = A S C ( K $ ) : IF J = 8 T H E N 1 1 5 0

1 1 20 IF J = 1 3 T H E N R E T U R N

1 1 30 IF K = 25 5 T H E N 1 1 10

1 1 40 P RIN T K $ ; :T $ = T $ + K $ :K = K + 1 : G O T O 1 1 1 0

1 1 50 IF K = 0 T H E N 1 1 1 0

1 1 60 P RIN T K $ ; " " ; K $ ; :K = K - 1 : IF K = 0 T H E N 1 100

1 1 70 T $ = L E F T $ ( T $,K ) : G O T O 1 1 1 0

1 1 80 R E T U R N : R E M

1 1 82 R E M

1 1 83 R E M C E N T E R TIT L E1 1 84 R E M

1 1 90 V T A B V : H T A B 21 - L E N ( M $ ) I 2: P R IN T M $ ; :

R E T U R N

1 1 92 R E M

1 1 9 3 R E M

1 1 9 4

1200

9 04

9 05

9 061000

o

o

1020o

o

o

S U B R O U TIN E S o

IN P UT A N YT H IN G

e

o

o

oW AIT F O R K EY PR ES S

1220

R E M

W A IT 4 9 1 52 ,1 28 :

K $ = C H R $ ( P E E K ( 4 9 1 52) - 128) : P O K E 4 9 1 6 8,O: ( )

R E T U R N

R E M

R E M

R E M

S P EE D = 2 20 :M $ = M $( l) : G OS UB 1 19 0: M$ = M $ (2):

G O S U B 1 1 90:K = P E E K ( 4 9 1 5 2):

IF K < 1 28 T H E N 1210 0K $ = C H R $ ( K - 1 28): S P E E D = 25 5 : P O K E 4 9 1 6 8,0:

R E T U R N

1201

1202

1204

1210

W IN K C UR SO R o

1221 R E M

1222 RE M A RR OW L AB EL 0

1223 R E M

1230 PRINT : H T A B 1 : IN VE RS E P RIN T N X ;: N O R MA L

PRINT " => " ;: R ET UR N 0

MICRO No, 75 . September 193

Page 33: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 33/76

r-~ ,

~

~

Graphic Print for C-64

Pait 3

In the first two parts of this series, we

developed a program to produce a

graphic screen dump for most popular

non-Commodore printers. The fast

machine language program can be used

to print graphic files from a number of

popular graphic programs. In this last

installment, we will show how to getfull-color printouts using your existing

dot-matrix printer.

Introduction

The graphic print program described in

the last two issues will give a HiRes or

MULTlcolor graphic dump in various

dot patterns - the density of the dot

patterns is proportional to the darkness

of the actual colors used in the picture.

Sixteen different patterns are used so

that even two colors that look identicalon a black and white monitor can be

distinguished on the printout. What

can be better than this? Color. There

are several methods that you can use to

get full-color hard copies of graphic

displays created on your Commodore

64.

One method is to use a good quality

35mm camera with color film and

shoot the pictures displayed on your

color monitor. This is probably the best

way to create slides for presentations.

The third party graphic programs

available for the Commodore 64 will

create outstanding title slides, graphs,

bar charts, and pictures. This method

can also be used to create larger color

prints, but this can be expensive for a

full-page enlargement.

A second method is to buy a color

printer or plotter. Several new color

dot-matrix printers have recently been

introduced; some use multi-color

ribbons, some use ink-jet technology.

You can get one for $600-$1000 +. If

you want to create a lot of color prints,

b y M ich ael J. Keryan

T allm ad ge, O hio

Add full color to your graphic printouts

without a color printer.

you can probably justify one. If you

don't yet have a printer and are

thinking of getting a color dot-matrix

printer for general-purpose use, make

sure it can produce a good sharp black

letter. Many of these color printersproduce only 3 colors, and create black

by mixing all 3; black letters may

appear as smeared gray. Color plotters

are used mainly for very high

resolution line plots, graphs, and

charts. They are not generally used for

dumping color pictures, but software

could be written to do this by drawing a

large number of short lines. However,

this would be extremely slow.

A third method land the one

described in this article) is to use color

ribbons with your existing dot-matrix

printer. If you have a good quality

graphic pr int er , want full-page

printouts in color only occasionally,

and are willing to invest some of your

time but not much money, this method

is for you. It works by overprinting the

same printout several times, once for

each ribbon color.

Color Ribbons

The first thing you will need is a set of

color ribbons. A number of printer

supply firms sell ribbons in various

colors for most popular printers at

about 30% higher cost than the

standard ribbons. The ribbon cartridges

are exactly the same as your black

ribbons; the only difference is the colorof the ink on the ribbon. Note that a set

of ribbons is used - one for each

color - multicolor ribbons are not

used. Another way to obtain a set of

color ribbons is to ink your own. You

can buy new, uninked ribbons, place

them in your old cartridges, and use

one of the new mechanical inking

gadgets that wind the ribbon while

applying ink.

How many colors will you need?

Well that depends on the type of

pictures you want printed and on the

colors that you can obtain. Y(JU

certainly do not need all 16 colors that

the Commodore 64 can produce. Many

of these can be created from

combinations and varying patterns of

other colors. If you can find them, use

black, blue, red, and yellow. All the

other colors can be generated from

these. Unfortunately, I could not find a

source for yellow ribbons (if you know

where I can get a yellow Prowriter

ribbon, let me know}, so I used black,

blue, red, green, and brown. With

No. 75 - September 1984 31ICRO

Page 34: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 34/76

these, all colors except yellow and

orange can be generated.

Keep the ribbon cartridges in plastic

bags that can be sealed to keep the ink

from drying out. Make sure the rollers

1T I the cartridges turn smoothly.

Nothing is more frustrating than

having a ribbon stick halfway through

the last color of a five color printout.

Helpful HintsAs previously noted, the color prints

are made by printing over the same

page (or pages) several times, once for

each color. A lot of things can go wrong

while you're doing this. Here are a few

pointers that I've picked up in the last

several months; they may save you

some time and grief:

1. Be prepared to spend an hour or more

to get a few prints. If you are only

printing one, make several copies - 3

or 4 to be safe. That way if a ribbon

jams or a page is misaligned, the othersshould still be good. Save up your

pictures to be printed and do them all

in one session. This will reduce the

number of ribbon swaps.

2. If you are using pin-feed paper,

prepare the paper beforehand. The perfs

tend to tear apart when moving the

paper up and down several times to get

all colors printed. A partially torn perf

will catch and cause the paper to jam.

Prior to printing, take out the paper,

tape over the perfs with scotch tape,

and then place it back in your printer.

You can even form a continuous loopwith several sheets, avoiding the need

to backtrack the platen.

3. Prior to printing the first color on

each page, draw an index line in pencil,

aligning the mark to some stationary

point on the printer carriage or frame.

For subsequent colors, make sure this

alignment mark is in the same place.

4. A misalignment of even one dot

11172 inch) is quite noticeable. If a

misalignment is obvious while printing

a page, turn off the printer with the off-

line or select switch on the printer,

then try to align the page by adjustingthe platen. Although you won't be able

to save the current page, subsequent

pages (see tip 1) should then end up

perfectly aligned.

5. Some printers have a panel that must

be removed when changing ribbons. A

micro switch will not allow printing

when this panel is removed. To save

you some time, remove this panel and

tape down the micro switch to defeat

it. Then leave the panel off while you

are getting your color prints.

Even by using all the above pre-

cautions, I've yet to get correct align-

ment of all colors on the first page of 4

copies that I print. My average is about

50% of all copies with no noticeable

misalignment. But the results are

rewarding.

Color Print

A BASIC program to create color

printouts is given in Listing 1. Thisprogram is based on the program in last

month's MICRO. All the machine

language routines are the same. The

only changes necessary are the printer

matrix codes for each color. These

codes change with each ribbon color.

The program first loads, from diskette,

the machine language routines II

GOUMP +MOVE", then jumps to line2000. Here the type of picture is

selected. Then in lines 2120-2250 the

printer specific information is defined.

Change the values for variables PT,

NT, and SO for your printerlinterface

set-up, then save the revised program.

The picture file is then loaded into

memory from disk. While loading this

file, the CRT will display the following

menu:

A FT E R P I C T U R E L O A D S, P R E S S :

P F O R B L A C K ( W H I T E P R I N T

C OL OR P RI N T :

B F O R B L A C K R I B B O N

N F O R B R O W N R I B B O N

U F O R B L U E R I B B O NR F O R R E D R I B B O N

G F O R G R E E N R I B B O N

E T O E X I T

The program works as last months

program for black/white printouts

when pressing P. For color prints, first

set up the paper and the first ribbon,

then press the key that corresponds to

that color. After one (or more) prints of

that particular color are finished,

change the ribbon, set up the paperback to the beginning, then press the

key for the new color. Keep this up

until all required colors are printed.

Then press E to exit.

The color pattern information in

matrix CM Isee lines 2350-2360) is

POKEd to the machine language

routine in lines 1150-1320, then the

printer dump is executed (line 1330).

This loop is repeated for each color.

Dots are printed for each combina-

tion of screen color and ribbon color

containing an X in the table below. A

high density of dots is printed for dark

colors, a lower density for lighter

colors.

R ib bo n C ol or

S c r e e n

C o l o r B l a c k B r o w n R e d G r e e n B l u e

-~----

B l a c k X

W h i t e

R e d X

C y a n X X

P u r p l e X X

G r e e n X

B l u e X

Y e l l o w X

O r a n g e X X X

B r o w n X

L i g h t R e d X

G r a y 1 X

G r a y 2 X

L i g h t G r e e n -

L i gh t B l u e

G r a y 3 X

X

X

If you have ribbons of different

colors or would like to experiment with

different shades or color codes, change

the data in lines 4000-4050. Line 4000

contains the pattern codes as described

in part 1of this series. The other OATA

lines (one line for each ribbon) point to

the 0 to 15th term in line 4000. There

are 16 entries in each line, one entry for

each color (0 black, 1 white, etc.). All

zeroes in these lines will print no dots

for those color/ribbon combinations.

The programs described in this 3 part

series of articles can be obtained on

1541 format disks for $15 (US) from

MICRO (disk number MO-4).

[Editors Note' The picture on page 22 of the

July issue (part 2 of this series) is titled

"MIDDLE EARTH" and was created by

Wayne Schmidt of New York City, using

Doodle by City Software and is a demo on

the Doodle disk. Credit was madvertantly

omitted.}

Michael J. Keryan has written a number ofarticles inMICRO, BYTE, and COMPUTER

and ELECTRONICS involving machine

language utility programs and hardware

add-ons for various microcomputers,

including OSI, TRS-SOand Commodore 64.

His DOES - IT program to extend the

capabilities of the C64 by implementing

keyboard-callable machine language

routines and supporting swapping of

machine language programs appeared in

recent issues of MICRO (January through

April/May 1984)

32 MICRO No. 75· September 1984

Page 35: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 35/76

. . . . . . . ....... . .. ,," , .• 01 ... " ........ , . . . . .

" . ..... ," . .1 •• .." . 1 1 . • . .

...... 10. . . . . . . . . . . .,"' ......

-•

• • ..•

•• • •

No. 75 . September 1984 3 3ICRO

Page 36: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 36/76

I ~---------~

No. 75 . September 1984

1000 RE M B A SIC P R O G R A M T O S U P P O R T G D U M P

1 005 R EM P RO VID ES C OL OR P RIN TO UT S

1010 R E M M . J . K E R Y A N 3-30-84

1020 :

1030 IF A =0 T H E N A =1 : L O A D " G D U M P + M O V E ",E " 1

1040 IF A =1 T H E N A =2: G O T O 2000

1 05 0 P OK E 204 91 ,P T: P OK E 204 92,S D

1 06 0 P OK E 204 93 ,N T: P OK E 204 87,N P

1070 S Y S G T

1080 IF T Y =2 O R T Y=4 T H E N M D =P E E K ( 5 3270):

M D=3 -( (M D A ND 1 6) /1 6) : P OK E 204 94 ,M D

1090 IF T Y =3 O R T Y =5 T H E N P O K E 204 9 4,3

1 100 IF T Y =6 T H E N P O K E 204 9 4,O

1 11 0 G ET K$ : I F K $< > ''''T HE N1 11 0

1 1 20 G E T K $ :IF K $ =" " T H E N 1 120

1 1 30 IF K $ =" P " T H E N S Y S 20480: G O T O 1 800

1 1 40 IF K $ =" E " T H E N 1 800

1 1 50 C =0: IF K $ = " B " T H E N C =11 1 60 IF K $ =" N " T H E N C =2

1 1 70 IF K $ =" R " T H E N C =3

1 1 80 IF K $ =" G " T H E N c=4

1 1 90 IF K $ =" U " T H E N C =5

1200 IF C =0 T H E N 1 1 10

1 3 00 F O R M =0 T O 1 5 : M M =21 1 82+ M : N N =21 1 9 8+ M

1 31 0 P OK E M M,C M( C,M ): P OK E N N,C M( 0,M )

1 3 20 N E X T M

1 3 30 S Y S 20480: G O T O 1 1 10

1800: R E M Q UIT

1 8 40 P O KE 5 3 26 5 , ( P EE K (5 3 26 5 )A N D2 23 )

1 8 50 P O KE 5 3 27 0, ( P EE K (5 3 27 0) A ND 20 7)

1 86 0 P OK E 5 327 2,21

1870 P O K E 5 3280,6: P O K E 5 3281,1 5: P O K E M 6,0

1 88 0 P RIN T" {C LE AR }" : E ND2000 PO K E 5 3280,6: P O K E 5 3281,1 5: P O K E M 6,0

201 0 P RIN T" {C LE AR ,D OW N2} WH IC H T YP E O F P IC TU RE ?"

2020 P RIN T

2030 P RIN T " 1 SIM O N 'S B A SIC "

2040 P RIN T " 2 U L T R A B A SIC -6 4 "

2050 P RIN T " 3 D O O D L E "

2060 P RIN T " 4 K O A L A P AIN T E R "

;~070 PRIN T " 5 S LID E S H O W "2080 P RIN T " 6 S LID E S H O W - INV E R T E D " _ _ _ _

2090 IN P U T " " :T Y

21~ T Y < 1 O R rr> 6 T H E N 2000

2110 :

21 20 PT = O : R E M P RIN T E R T Y P E

21 30 : R E M N E C /P R O W RIT E R = °2140 : R E M E P S O N O R SIMIL A R = 121 50 :

21 60 N P = 3 : IF P T =1 T H E N N P = 2

21 70 : R E M R E P E A T C O D E

o

o

34

2180 :

21 90 N T = O :

2200

2210 :

2220 :

2230 S D = 6 : R E M S E C O N D A R Y A D D R E S S

2240 :

2250 :

2260 G T = 21808 + ( T Y-1 ) *3

2270 IF G T > 21 820 T H E N G T =21820

2280 IF T Y =1 T H E N 3000

2290 P RIN T " { D O W N2} N O W P U T IN DIS K WIT H T H E PIC T U R E FIL E. "

23 'O O IN PU T" {D OW N} NA ME O F P IC TU RE "; N M$

23 10 P RIN T" {D OW N} AF TE R P IC TU RE L OA DS , P RE SS :"

23,20 PRIN T " P F O R B L A C K /W HIT E P RIN T "

23 21 P RIN T

2322 P RIN T " C O L O R P R IN T :"

2323 P RIN T " B F O R B L A C K RIB B O N "

2324 P RIN T " N F O R B R O W N RIB B O N "

2325 P RIN T " U F O R B L U E RIB B O N "

2326 P RIN T " R F O R R E D RIB B O N "

2327 P RIN T " G F O R G R E E N RIB B O N "

23 29 P RIN T

23 30 P RIN T " E T O E XIT "

23 40 D IM C M( 5,1 5)

23 50 F O R 1 =O T O 5 : F O R J =0 T O 1 5

23 60 R E A D M M : C M (I,J) =M M : N E X T J : N E X TI

2370 IF T Y =4 T H E N L O A D " ? " + N M $ + " *",8,1

2380 IF T Y < > 4 T H E N L O A D N M $ + " *",8,1

2900 :3000 RE M C R E A T E A SIM O N 'S B A SIC P R O G R A M

3 01 0 Q $ =C H R$ ( 34 )

3020 PRIN T " { C L E A R } 1 IF A =1 T H E N A =2:L O A D " Q$ " G D U M P +M O V E " Q $" ,8,1 "

3030 P RIN T "2 IF A =0 T H E N A =1 : G O T O 7

3 04 0 P RIN T" 3 P OK E 204 91 , " PT " :P OK E 204 92, " SD

3 05 0 P RIN T " 4 P OK E 204 93 , " N T" :P OK E 204 87, " NP ":

S YS 21 808 "

3 06 0 P RIN T" 5 A =P EE K( 53 270) : A =( A A ND 1 6) /1 6"

3070 P RIN T " 6 A =3-A: P O KE 204 9 4,A: S Y S 204 80: E N D "

3080 P RIN T " 7 R E M A P P E N D Y O U R P R O G R A M H E R E "

3 0 90 P R IN T " S A VE " Q $ " SI MO N . G D UM P " Q $ " ,8 "

3 100 P O K E 6 3 1,1 9 : F O R A =6 32 T O 6 3 9 : P O K E A,1 3: N E X T A

3 1 10 P O K E 1 9 8,9: N E W

4000 DA T A O,5,32,10,64,20,1,40,15 9,1 6 5,90,

130,219,135,80,255

4010 D A T A 1 5,O,O,O,O,O,O,O,O,O,O,12,13,O,O,3

4020 DA T A O,O,O,O,O,O,O,2,4,15,O,O,O,O,O,O4030 D A T A O,O,1 5,O,9,O,O,O,6,O,9,O,O,O,O,O

4040 D A T A O,O,O,5,O,1 5,O,O,2,O,O,O,O,9,O,O

4050 D A T A O,O,O,1 1,10,O,15,O,O,O,O,O,O,O,10,O

R EM IN TE RF AC E T YP E

R E M C O N N E C TIO N = °R E M O T H E R S = 1

R EM F OR T RA NS PA RE NT

MICRO

Page 37: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 37/76

There are three ways to learn 6502 Assembly Language on your Apple Computer:

Hard IEasy Easiest

OTHER ASSEMBLERS LISA v2.6 LISA ED PAC

Page 38: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 38/76

o 0 _ O L . . . _ _ _

Approxim ating the Square Root

ot the Sum

of the S quares000

by Chris Williams

Ogden, UtahA fast method of calculating

this useful function.

/--------

but i s e , keep reading. With the r:::~h~~e:,~-ut it's a small

.ch ice of a and b the peak error I one.Your X must be greater than Y. If

of this a roximation is a grand total of ~~tart with, simply switch

4.01 n rcent. No misprint there, a coefficients. ~-----_____ __/max' aum error of 4.01 percent. A similar procedure can-beGone" in

Ah, good. You're paying attention 3-D. In that case, we'd be approxi

again. Now then, think of how much mating R=SQRI(IX**2.) + IY**2.) +faster your computer will be able to do IZ* *2.))), and we'd do so with

SPRIME=a*X + b= Y than it could RPRIME=llla*X) + Ib*Y) + Ic*Z))).

S = SQRIIX**2.j + IY**2.). The optimal, binary-related coeffi-

The optirnal jfrom a minimal peak cients are a~ 1.0, b= .375 and c~ .25.

error perspective) values of a and b are The peak error is 9.68 percent. This is

a = 0.961 and b = 0.398, to three allowing a maximum right shift of

decimal places. Use those and SPRIME three. You could achieve superior peak

will never vary from S by more than error performance if you shifted more,

4.01 percent. For those of you who but you'd lose significance as bits were

haven't realized it yet, you probably shifted off the end of the byte. Three

will never see graphics errors that seems a good compromise.

small. Accompanying this article is a

For the assembly language inclined program that demonstrates the validity

readers, here's another tidbit of value. of the above claims. It's written in

Suppose we choose values of a and b Applesoft, but there's nothing

that are related to powers of two. The particularly machine dependent in it,

a *X and bOy operations then become so you should be able to get it to run on

simple shifts of X or Y an amount equal any BASIC machine.

to what the power of two a or b is. The outputs are shown in Fig.2. The

Doing that is thousands of times faster S value represents the results from

than a full-fledged fl ating-point Applesoft's straightforward

multiply. SQRIIX**2.) + IY**2.)1 calculation.

SPRIME is the approximation value.

Both are computed for 0 < X/Y < 1.0in steps of 0.1. Error is computed as a

there) and b ~ .375, a . to three percentage and is liS - SPRIME) / 5) *

decim 1places. Sin is not~ 100.

power ollha,:>:::to4fo--a- little ) So that's it. It's a good technique

more than just a simple shift. Namely, /Try it.

shiftYthree times to the right 1·1#and add the result to its twice

/(.12S"3=.37S).Tha' . muchf eference

/ than anyJ1oattnf-Point multip . M gnitude Approximations for

( __ -------ffi;::[dently, this cornbi ation icroprocessor Implementation by W.

coefficients yields a peak or of 6.8 homas Adams and John Brady, IEEE

It's an approximation, of course, percent. Micro, October 1983

If I were asked to make a list of what I

thought were the most often executed

computer calculations in the world,

very near the top of that list would bthe following equation:

S= SQR( (X** 2 .) + 5 (Y * *2 .))

This square root of the sum of the

squares calculation is used for all kinds

of different things. It crops up in

electronics, in physics, in geometry,

and in just about every other

imaginable field. It is widely used

because it is the equation for

calculating the magnitude of two

rectangular components - of

anything. It tends to be a repetitive

calculation, especially in the world of

graphics and animation where

computers are called on to perform it

hundreds of times.

Since this is true, a computer

technique that will save just One

microsecond executing the calculation

is precious. Using such a technique in a

repetitive application subtracts one

microsecond from the execution time

for each loop and you wind up finishing

your task much faster than you

otherwise would have.Bearing all that in mind, consider

the value of the following technique; it

saves tens or hundreds of microseconds

for each repetition.

Skeptical? Don't be. The method is

incredibly simple. It is incredibly fast.

It is, without further ado:

SPRIME=a*X + b* Y

That's it.

3 6 MICRO No. 75 . September 198~

Page 39: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 39/76

15

12.5

S

S=((X 2 1 + iY21JY2X= 10

10

i00 1 2 3 4 5 6 7 8 9 10

Y

15

12.5

SPRIME=( .961)*X + ( .398J*Y

X= 10

SPRIME

10

Figure 1. Graphs show how

nearly identical the

two functions are.

iO L-. _

1 2 3 6 7 8 94 5

Y

5 R EM E RR OR V AL ID AT IO N P RO GR AMS S P RIM E E R R O R (%)

6 R E M B Y C WIL LIA M S, 3/841 10.04 9875 6 10.008 .416678098 10 H O M E : V T A B 1 02 10.198039 10.406 2.03922505 20 PRIN T " S " ; : H T A B 1 5 : P RIN T " S F RIM E " ; :3 10. 4 40306 5 10.804 3 . 4 83 5 5 1 78 H T A B 28: P RIN T " E R R O R ( % ) "4 10.7703296 11.202 4.00795888 30 P O K E 3 4,2: V T A B 3

05 1 1 . 1 803 3 9 9 1 1 . 6 3 . 75 3 5 5 4 1 40 F O R Y = 1 T O 10.6 1 1 . 6 6 1 9038 1 1 . 9 9 8 2.8820011 5 50 X = 10.7 12.206 5 5 5 6 12. 3 9 6 1 . 5 5 1 9 8879 60 S = (( X t 2. ) + (Y t 2.)) 0. 58 12.8062485 12.79 4 .09 5 6 4 4 5 79 8 70 SPRIME = (0.961 * X ) + (0.398 * Y ) 09 1 3 . 4 5 3 624 1 1 3 . 1 92 1 . 9 4 4 6 3 627 80 D F = A B S ( ( S - S P RIM E ) / S ) * 100.

10 1 4 . 1 421 3 5 6 1 3 . 5 9 3.90418847 90 P RIN T Y ; : H T A B 4 : P RIN T S ; : H T A B 1 5 :

P RIN T S P RIM E j : H T A B 28: P RIN T D F0

Figure 2. Validity Program Outputs 100 N E X T

1 10 E N D#JCAO"

No. 75 . September 1984 MICRO 3 7

10

Page 40: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 40/76

FLOPPY D ISKS SALE *$1 .1 9 ea.Economy Mo.:lel or Cadillac Quality

L O R A N ~ C E ~ ~ ~ u ~ ~ 5 ~ ~ A l We have the lowest prices! L O R AC E ~ T l f l E D( ~ 5 O N A lCOMPUl {~ [) I5~

$119.00

13.90

* ECONOMY DISKSGood quality 51/4" single sided single density with hub rings.

Bulk Pac 1000ty. $1.19 ea.

100ty. 1.39ea.

Total Price

Total Price

CADILLAC QUALITY (double density)

• Each disk certified • Free replacemenl lifetime warranty • Automatic dust remover

For those who want cadillac quality we have the Loran Floppy Disk. Used by professionals because they can rely

on Loran Disks to store important data and programs without fear of loss! Each Loran disk is 100% certified (an

exclusive process) plus each disk carries anexclusive FREEREPLACEMENT LIFETIME WARRANTY. With Loran

disks you can have the peace of mind without the frustration of program loss after hours spent in program

development.

100% CERTIFICATION TESTSome floppy disk manufacturers only sample test on a batch basis the disks they sell, and then claim they are

certified. Each Loran disk is individually checked so you will never experience data or program loss during yourlifetime!

FREE REPLACEMENT LIFETIME WARRANTYWe are so sure of Loran Disks that we give you a free replacement warranty against failure to perform due to taut-ty materials or workmanship for as long as you own your Loran disk.

AUTOMATIC DUST REMOVERJust like a record needle, disk drive heads must travel hundreds of miles over disk surfaces. Unlike other floppy

disks the Loran smooth surface finish saves disk drive head wear during the life of the disk. (A rough surface will

grind your disk drive head like sandpaper). The lint free automatic CLEANING LINER makes sure the disk-killers

(dust & dirt) are being constantly cleaned while the disk is being operated. PLUS the Loran Disk has the highest

probability rate of any other disk in the industry for storing and retaining data without loss for the life of the disk.

Loran is definitEt/y the Cadillac disk in the worldJust to prove it even further, we are offering these super .b.QXY.INTRODUCTORYPRICES

List $4.99 ea. INTRODUCTORY SALE PRICE $2.99 ea. (Box of 10 only) Total price $29.90

$3.33 ea..(3 quantity) Total price $9.99

All lORAN disks come with hub rings and sleeves in an attractive package.

DISK DBIVE CLEAN ER S19.95Everyone needs a disk drive doctor

-,~~.60% of all drive downtime 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

system

The Cheetah disk drive cleaner can be used with single or double sided 5'/." 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 * $16.'5

error free use of your computer

Add $3.00 for shipping. handling and insurance. i ll inois ".sidenlsplease add 6~. tax. Add $6.00 for CANADA, PUERTORICO,HAWAII,

ALASKA. APO·FPO orders. Canadian orders musl be in U.S. dollars.WEDO NOTEXPORTTOOTHERCOUNTRIES.

Enclose Cashiers Check, Money Order or Personal Check. ~dlow I~

days for delivery, 2107 days for phone orders. 1day express rnail!

VISA- MASTERCARD- C.O.D.

NoC.O.D. 10Canada. APO-FPO.

PROTECTOENTERPRIZES~I cL")""'USO~(.S

BOX 5~O. BARRINGTON, IlliNOIS 60010

Phon. 3121382·5244 10Old.;

Page 41: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 41/76

8141 FOURNEW 128K -MEGA BYTE DUAL DISK DRIVE-80 C O L U M N

COM'PUTER~SYSTEM SALE!HOME • BUS INE~SS • WORD PROCESSING

"<,

C D ' B r u050

! " . . . . . <,DualDiskDrive

J Mega Byte

L2)~~~~~-;~~1:::/J

~l/,~I

~I

8128 Computer

128 K

100 CPS

4023 Printer

12" HiRes Monitor

(If ordered

before III 1184

List Price $3717.95

LOOK AT ALL YOU GET FOR ONLY $895.LIST PRICE

s 995 00B 128 COMMODORE 1281~80 COLUMN COMPUTER

@ 8050 DUAL DISK DRIVE lover 1 million bytes)

~ 4023 100 CPS 80 COLUMN BIDIRECTIONAL PRINTER

@ 12' HI RESOLUTION 80 COLUMN GREEN OR AMBER MONITOR 24900

• BOX OF 10 LORAN LIFETIME GUARANTEED DISKS ·)995

1795 00

49900

• 1100 SHEETS FANFOLD I~APER

• ALL CABLES NEEDED FOR INTERFACING

TOT AL LIST PRICE

1995

10205

s 3717.95

Printer replacement options (replace the 4023 with the following at these sale prices)

LIST

s 69900s 779 00s 19900

SALE

$ 399.00

$ 499.00

$ 139.00

* Olympia Executive Letter Quality Serial Printer

* Cornstar HI Speed 160 CPS 15 . Serial Business Pnnter

* Teter ornrnur-icatons Deluxe Modern Package

Plus You Can Order These Business Programs At Sale Prices

LIST SALE LIST SALE

f-'ruleSSI()fIJ 00 s 149 95 $9900 Payroll 't 149 $9900

''/,',-,rd ?((Jc(:-,,,sn( 1f1~'entnry 1,199:) 9900

Prote s s. nnat Data Bas t' 14995 9900 General Ledger 149 gO ) 9900

AI:lQ,:C ReCf:'T\iJI;\e .~-, \4995 9900 trRdnr:lai Spr ean Sheet 14995 9900

Ar ( 111nts Payable 149 gl) 99.00 P ro gr am G e ne ra to r 1·199" 99.00

15 DAY FREE TRIAL We give you 15 (jays to tryout tn.s SUPER SYSTEM PACKAGE" lilt doesn' t <reel your e<pec

tat ens lust send It back to us prepaid and we will reiumj your purchase prlceli

90 DAY 1MMEDIA TE REPLACEM ENT WARRAI~ TY II any 01 the SU PER SYSTEll" PACKAG Eequipment Or ;YOg' arn~

lail due to faulty workmanship or material we wdl replace It IMMEDIATEL Y at no Olarge"

W rite or Call For Free Catalo g an d S pec S heets!!

rAdd $5o.00fur-;hippi;g~d;;,;;jlingii------·-'

I$100.00 for Canada, Puerto Rico, Hawaii orders. IIWE DO NOT EXPORT TO OTHER COUNTRIES

IEnclose Cashiers Check. Money Order or Personal Check Allow II

I14 days for dell'Jery. 2 to 7 days for phone orders. 1 day exoress

Imad' Canada orders must be In US dollars We accept Visa ar.o I~~t~C~~'~~~SJ'£~';;:'~~d~~e~o~ .J

PRDTECTDE N T E R P R I Z E S l 't IE LOVE au' C"STOM,.S,

80X 550, BARRINGTON,ILLINOIS 80010Phon. 3121382·5244to order

No. 75 . September 1984 MICRO 3 9

Page 42: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 42/76

SANYO MONITOR SALE !!• 80 Columns x 24 lines

• Green text display

• Easy to read - no eye strain

• Up front brightness control

• High resolution graphics

• Quick start - no preheating

• Regulated power supply

• Attractive metal cabinet

• UL and FCC approved

$6900

9" Data Monitor

12" Screen Amber or Gree-n~T~~t--Dlsplay$99

• 15 Day Free Trial - 90 Day Immediate Replacement Warranty

12" Hi-Resolution Amber or Green Screen Monitor $119.00this is a 1000 Line, 80 Column, High Resolution Monitor with crisp dear

text that is easy to read! f J \ must for Word Processing! Includes specialSoftware Discount coupon.List $249.00 SALE $119.00

14" Hi-Resolution Color Monitor $229.00This 14" color monitor has the sharpest and clearest resolution of anycolor monitor we have tested! Beautiful color contrast! Also compatiblewith video recorders. Inc ludes special Software Discount cou pon.List $399.00 SALE $229.00 (IBM Compatable)

• LOWEST PRICES· 15 D",Y FREE TRIAL. 90 DAY FREE REPLACEMENT WARRANTY

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

PRDTECTCENTERPRIZES !WICOVIOU"CUITO .. I""

lOX ISO, BARRINQTON, ILL. INOIS 10010P ho n. 3 12 13 12 ·5 24 4 10 order

Add $10,00 for shipping, handling and in,uron, •. //tinai, r•• identspl.o • ..pdd 6~'. 10x . Add $20.00 for CANADA. PUERTO RICO. HAWAII.ALASKA, APO-FPO orders. Canadian order, mus' be in U,S. dol lor •.

WE DO NOT EXPORT TO OTHER COUNTRIES.

Enclose Co.hiers Check. Money Order ar P.rlonol Check. Allow 1.4

day. for d.n.....y,·2 to 7do.,.. for phone order •. , day .Jl:pr.1I moil!VISA - MASTER CARD - C.O.D.

4 0 MICRO No. 75· September 198ff

Page 43: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 43/76

':":'DELUXECOMSTAR TI F

80 CPS Printer - $169.00This COMSTAR T F (Tractor F'iCtl(lll)

PRINTER IS except.onaliv vers.atre It

prints 8 x Ll stCl/li.id!cI Slle single sheet

stationary or continuous ("eel Ulrllputf'r

paper Blcllrecllclrlcil, irl1:)J( t clot 113t".¥.

80 CPS. 224 characters iC,'rllrc)Il

Paralleliliterfact)

Premium Quality 120·140 CPS10" COM·STAR PLUS+Printer $269.00

The COM STAR PLUS+ gIVt:Ci YOI. ai, tile

features of till' COMST AR TF PRINT ER

plusa 10" carriage', 120 140CPS,9x9dot

matrix With double strike capability for 18 x

18 dot matrix (near letter quality) hlgll

resolution bit Irlldge (120 x 144 clot

matrix). underllnlrlg hack spacing, left

and right rnarglr' settings true lov'lf,r

decenders With super and subscripts

prints standard. Ital iC: block grapll lcS and

special characters It gives you print

quality and ieaturps fmlll(j en pr.oter s

costing twice dS much!' (Centrorucs

Par'allel Irlteriact') (Better than Epson

FX80) List '£499.00 SALE $269.00

Premium Quality 120·140 CPS15lj2"COM·STAR PLUS+Business Printer $379.00

Has all the'eatures of the 10" COM·STAR

PLUS+ PRlfHER plus 15' carnage and

rnor e powerfui electrorucs components to

IklncJle large ledger busness torrrs:

(Better than Epson FX 100) List $:)99

SALE $379.00.

Superior Quality 140·160 CPS10" COM·STAR PLUS+

IBM Pers/Bus Printer $389.00Has ali the features of the 10" COM·STAR

PLUS+ PRII~TERr I t ISespecially designed

for ali IBM personal cornputer s: 140 160

CPS HIGH SPEED PRINTING 10Q',1, dutv

cycle, 2K buffer, diverse character fonts.

special symbols and true decenders,

ver tical and horizontal tabs.

A RED HOT IBM personal bus.ness printer

at an uubelreveable low price of $38900

plus one year Immediate replacement

warranty (:entronlcs parallel interface)

List $699 SALE $389.00

Superior Quality 160·180 CPS10" COM·STAR PLUS+Business Printer $399.00

ThiS SUPER HIGH SPEED COM STAR

PLUS+ PRINTER 160180 CPS has a 10"

carriage w.tr all Ih e COM STAR F'LUS+

features bunt In' It ISespec.auy cle',!gned

1'111'1 more powerful electrorl lcs to Ilillldle

larger ledger busriess forms' b!:.!uslve

t)OttOITI l eed: (Centr oruc s parallel

Interface) also conpatable With ail IBM

Personal/Bus.ness Computors:' Oill' year

Immeolate replacement warranty

List $699 SALE $399

151/2' Printer List $/99 SALE $499.

nOlympiaExecutive Letter Quality

DAISYWHEEL PRINTER $399.00Thrs ISthe worlds finest (Jalsy wilet 'l printer

Fantastic Letter Quality. up to 20 CPS

bidirectional. 1 '1111 hand.e 144 ~OrfTlS

wdth: Has a 256 character print Ixilier.

specral prillt ell han cements IlLIlit In

tractor feed (Centrorncs Parallel and

RS232C Interface) List $699 SALE $399.

----------------------------PARALLELINTERFACES----------------------------

For VIC20 and COM 64 - $4900 For Apple computers- $7900 Atar 850 lntertace - $79.00 For ALL IBM Computers - $8900

, - - - - - - - - - - - - - - - - - - - - - - 11Add $14.50 for shipping, handling and insurance. WE DO NOT EXPORT I

1 TO OTHER COUNTRIES EXCEPT CANADA. I

1 Enclose Cashiers Check, Money Order or ~ersonal Check. Al low 14 days I

1for delivery, 2 to 7 days for phone orders, 1 day express mai l' Canada Iorders must be in U.S. dollars. VISA - MASTER CARD ACCEPTED. We

1 ship C.O.D. I------ • .f

PRDTECTDE N T E R P R I Z E S (WE LOVE OUR CUSTOI.u'SI

BOX 550, BARRINGTON, ILLINOIS 80010Phon. 3121382·52« 10 ord.r

C OM ·STAR PLUS+ ABCDEFGH J:.:JKLMNClPClRSTUVWXVZ

Print Example A BCDEFGHIJKU1NOPCM TUVW XY Z 12::54~6?e«i'O

No. 75 . September 1984 41ICRO

Page 44: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 44/76

Commodore · 64

WORD PROCESSORCRIPT-64 EXECUTIV(80 Columns in Color)40 or 80 columns in color or black and white; turns your computer into a Business

Machine!

Rated best by COMMODORE. This is the finest word processor available. Features in-

clude line and paragraph insertion/deletion, indentation, right and left justification,

titles, page numbering, characters per inch, etc. All features are easy to use and under-

stand. With tabs, etc. SCRIPT-54 even includes a 250 word dictionary/spelling checker to

make sure your spelling is correct. The dictionary is user customizable to any technical

words you may use. Furthermore, all paragraphs can be printed in writing and everyday

letters are a snap. To top things off, there is a 100 page manual and help screens to

make learning how to use SCRIPT-54 a snap. This word processor is so complete we

can't think of anything it doesn't have. When combined with the complete database you

have a powerful mailmerge and label program that lets you customize any mailing list

with personalized letters. List $99.B5. Sale $59.00. ':'Coupon Price $49.00. (Disk only.)

. [.];l.J.][Iii[·]~'*1;nAllows you to check spelling on 20,000 most often mispelled words! List $29.95. Sale

$19.95. ':'Coupon Price $12.50 (Disk only.)

: : I ~ " . ~ ~ · i · , ~ t · * · ~ ~ : · 4 · i j ~ : t ~(Plus Mail Merge and Labels)This powerful DATABASE is user friendly and makes any information easy to store and

retrieve. The user defines the fields and then can add, change, delete, and search for

any category wanted! Must be used with the SCRIPT-54 EXECUTIVE WORD PROC-

ESSOR. When combined with the Executive Word Processor you can search out any

category (zip codes, even hair color, etc.) and print super personalized letters! 500

names can be sorted and formulated on each disk in any order or category! Will handle

any size mailing list by chanqino or adding disks! List $59.00. Sale $39.00. *CouponPrice $29.00.

SCRIPT-6420,OOO

SCRIPT -64 COMPLET

• 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

WE SHIP C.O.D. HONOR VISA AND MASTER CHARGE

ADD $3.00 SHIPPING FOR C.O.D. ADD $2.00 MORE

SPECIAL SERVICES:

One Day - Express Mail add $10.00

PROTECTOE N T E R P R I Z E S l~iE LCJvE 'JUP CUSTCMERS)

BOX 550, BARRINGTON, ILLINOIS 60010

Phone 3121382·5244 to order

Page 45: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 45/76

Olympia. EXECU TIV E LETTER QUAL ITY

"D AISY WH EEL PRINTERS"

Execu tiv e Le tt er Quality P rin te r

Wo rld 's F inest Computer P rin ter

List Price $699 SALE $3 99

;.

• Daisywheel printer, bidirectional with special print

enhancements.

• Print speed up to 20 characters per second

• 10, 12, and 15 characters per inch.

• 256 character print buffer.

• 14.4" forms width.

• Print line width: 115, 138, and 172 characters.

• Serial RS-232-C and parallel Centronics Interface

ports built-in.

• Built-in bidirectional forms tractor.• Operating status control panel.

World 's F in es t

Executive Le tt er Qua lit y P ri nt er /Typewr it er

"Combinat ion"List Price $799

PrinterITypewriterSALE $ 48 9

• Superb computer printer combined with world's finest

electronic typewriter'

• Better than IBM selectric - used by world's largest

corporations:

• Two machines in one - Just a flick of the switch'• Superb letter quality correspondence - home, office,

word processing!

• Extra large carnage - allows 14-1/8" paper usage'

• Drop in cassette ribbon - express lift off correction or

eraser up to 46 characters'

• Precision daisy wheel printing - many type styles'

• Pitch selector - 10, 12, 15 CPS, Automatic relocate key'

• Automatic margin control and setting' Key In buffer'

• Electronic reliability, built In diagnostic test!

• Centronics parallel interface built-in

15 Day Free tn«. 90 Day Immediate Replacement Warranty

r - - - - - - - - - - - - - - - - - - - ~Add $17.50 for shipping, handling and insurance. Illinois residents plE!ase Iadd 6% tax. Add $35.00 for CANADA, PUERTO RICO, HAWAII, ALASKA,

IAPA-FPO orders. Canadian orders must be in U.S. dollars. IIWE DO NOT EXPORT TO OTHER COUNTRIES. IIEnclose Cashiers Check, Money Order or Personal Check. Allow 14 clays IIelivery, 2 to 7 days for phone orders, 1 day express mai l! II VISA - MASTERCARD - C.O.D. II No C.O.D. to Canada, APO-FPO _J'----------------------

COM 64 - VIC-20 INTERFACE

APPLE INTERFACE

$59.00

$79.00

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

BOX 550, BARR INGTON, IL L INO IS 8 0 01 0Phone 3121382·5244 t o o rd er

Page 46: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 46/76

Page 47: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 47/76

. . v

(3)

(O/( f-Q 4 -C01-o.e

' »_7'--

CLOC",

Figure 1

8

14Izf-G: : . 1~_ +-+ + _-+--I

Q1 II p"-Q-=-2--+---I---/--+-i-_~-:::en

C04024 q Q"/

, QSy : : ~ = ~ ~ = = = ~ ~: ~o---~--+--I

3 . . g r~j!ffi

IQ-

IBAUD R A T E " I

RI'!¢J _ _ I I~c....... AI

..Sv

i tT a T I~ r , -'-i-H-t-t-......,4'-f1--;-Va. 1~ 1"

~ ~ e ll ~ z~ z-+ -- -t -- -r -~ -t -r ~, _+ -~ rt ~~- -- -+ -, _- ~2 R.... T~ 1-"2:..;./.,--t---f----+---I-+-+--+--+--t-HH--"'.__-----+--+--~

S ~TS. ~z~-~---~-~-~-+~~+-+-~-+~~----+-4--~E J i ,~~o r.:~'a_t---r_-_r-~_t_rl_;-t-rl_t~~----t-l_-~~~~~

3 ",cIA

~f-----H-+-++__.:':...jlUTAI Zf cr'sot

poRT~

LJ I J

411 2 Q7 3

01 s: :r4Li is s: .!_

02 ~ .s,05

,.~

M i13 10

?

OS " 2

0' I 3

D7 I "Vw· I 7

II>

17

"

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

could be used to toggle a flip-flop at twice the period of the

desired baud rate clock.

This timer-generated baud clock would only bepractical on a dedicated machine such as I will be using.

Also, it is advisable to put the VIA on NMI* and the ACIA

on IRQ'. Only the timer interrupt is time critical, but the

STROBE' line should have reasonably prompt response to

maintain high throughput for input data. The ACIA

buffers a second character and will assert BUSY if

necessary. However, the data throughput on even 2400

baud serial will not be greatly affected by a short BUSY

hold on transmission.

Two other loose ends: If you should desire to have full

eight-bit parallel input and output at $FF70, it is possible

to use an octal latch in place of U8 and an octal tri-state

buffer in place of U7. The required decoding is slightly

different, and will be shown in next month's column.The second loose end is that I promised to examine the

bus loading in detail to decide if this interface board

needed to be buffered from the innards of CoCo. The

answer is yes; on two counts. First, the power loading

(drive current furnished by the 6809 CPU) on the address

lines is approaching the maximum specified value. This

loading will reduce the bus's ability to drive a capacitive

load at normal speed. In the second place, the capacitive

loading for the address bus is very close to, or exceeding,

the rated maximum. Therefore, this board does need

buffering. The calculation, circuitry and other

considerations will be presented next time also. I\ICRO-

No. 75 . September 1984 MICRO

AN ESSENTIAL DISK & MEMORY UTILITYFOR THE COMMODORE 64 ™ & DRIVE

EASY To USE - HELP - KEYSTROKE COMMANDS

•Disk Track/Sector Editor

• Examine and modify disk sector data

• File Follower - memory for 151 sectors

• Fast 1541 disk compare and error check

• Display Memory and Disk Data

in Hex, ASCII or Screen Code

• Edit full page in Hex or ASCII

• Disassemble memory and disk data

• Search for string • Un-new Basic pgms

• Read drive memory • Convert Hex/Dec

• Free sector map • Use DOS wedge

• Run ML routines • Extensive manual

• Printer screen dump (serial bus)

• Fast machine code! Compatible with

many Basic and monitor programs

DISKETTE CAN BE BACKED Up!!

US Post Paid

ALL FOR

$29.95

QUANTUM SOFTWARE

P.O. BOX 12716, Dept. 64

LAKE PARK, FL 33403

To ORDER: Send check or money order. US dollars

Florida residents add 5010 sales tax

COO add $2. Call 305-840-0249

Commodore &4 Is a regis tered trademark of Commodore Electronics Ltd.

PEEK A BYTE i. a tr ad emerk of Quantum Sof twar e

4 5

Page 48: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 48/76

Complete AppleModem $129

Sing le-Slot 300 Baud Direct-C onnect Modem for

Applle II. 11+. lie and Frank lin computers

J aB E NT ER PR IS ES INC

P a 8 01 2 69

Aver M A 01 132

For :ranstem.g Informatlcn between computers

NETMASTER s superb error check.nq and high

speed ale an unbeatable combination With a NET·

MASTEI~ on eacr end. you can Iransler Inlorma-

non three to live trr.es iasler than other commu-

nication" packages like visiterrn or ASCII

Exoress Erro. Iree

Your best DUY In modern history The Ne tworker ,'

a plug-In s.nqte-stot direct connect modern lor Ihe

Apple II larnuv 01corncuters Send etectroruc mail

10a tneno or bus.ne ss associate. use your sc-coi S

compuler access hundreds 01 compu te r bu llel ln

boards o r thousands 01 data oases lor up-to-the-

rmnute news. sPOr1S weather. airline. and SlaCK In-

torr-iaucn

M.~IL ORDERSPLEASE WRITE NUMBER Of ITEMS IN BOX

C NETWORKER ~ NETMASTER $79

$179

There s abSOLleIY"OI~:ng e'se 10 ~U, Y ~u get

t~e modem beard cOr 'mu~lca. t 'o" 5U't",.a:8 ar.c a

valuable subscnono» tr Arner:;:.:a,.') ; ;r er T"' er , nf .; :r _

manon service. THE SOURCE Fccr S' 29 Is ar

unbeatab le va lue

ThiS IS the modem that does 't a', and ClOf'S It IO~

less The Apple ComC'un'callcns Cards cr boa.o

so no other mterf ace IS needed II S 30e, oauo I"e

most coovncorv used : lodern s:Jeed A."c 't:Clf"leS

complele wrth NETWORKER CCrT;c"un catc -s

Software on an App,le-cumparlbJe diSK gl\'lng VOl.,

ieatures no modern o ffers

L:ke the abn tv to 'ock on-screen r~essages !nto

you' Apple s RAM, and IherT move tce n lo 'mat lo"

arlo a disk lor easy reference and review A 1e.-lll.

nal program that tuns your corr oi.tcr Into a cor -i -

rnurucanoos command center , ' '' '' '' It hen -sc reen ' r:elp

menus. ccntr-uous i.ocates of memory i.saqe ca.'·

( ier oresecc=. and cornmunlcaflon stalLS

Bul NETMASTER s not stuttv II Will lalk 10 those

other communications packages. bul they cor 1

work as lasl a-ic Ihey ,10n : check errors !Ike NET-

MASTER. And NETMASTER doesn I oniy w[Jrk

with Ihe NETWORKER rr-ocern ben I vo u

already have another rlodemlo' your Apple. NET-

MASTER IS an oi.tstancrnc value In comrru-»-

cations software. so we seli NETMASTER by Iisel

lor $79. NETMASTER rcouires 48" 01 RAM onedisk cnve and I~e NETWORKER or anOlher

modem

W E E V E N G I V E Y O U S O M E O N E T OT A LK T O !

Your purchase ollhe NETWORKER wllh or w.rhout

NETMASTER comes cor-crete w.th a me'roersh,o

10 THE SOURCE, with lis -icrrna: reg'slratlon tee

fUlly waveo THE SOURCE will out a wond of elec-

tron.c information anc cornmur- rcanor - se-v.ces at

veer hngertlPs - instantly E!ectronlc 1:a,1 ard com-

puter conlererclng Current news ar c soo-ts Valu-

able bUSiness and fmane.a l 'nlo'matICr~ Trave,1 Ser-

Vices A weallh Of Inlcrmallon about oersonal

compUI>ng Eveo qarnes. Al i l u; ly co-r oanc.e wah

your equipment. and ready to Lise at orce

NAME _ ._ __ . _

ADDRESS _

CITY S TA TF _ __

F E A T U R E S O F T H E N E T W O R K E R "

C D DIREC T = O~NEC T - No a coust.r coupling neeoec

Tw o m co ur a r : e r e p h c o e . a r cs - o n e lo r p h o n e - o o et or i lne

® SING er C HIP MODEM tor grea:er rbab:,ly

m O N BO ARD fiRM WARE (enla'ns a te'm 'la, pro-\.:V g r a m

(4' 0 " BOAflD SERIAc~ TER'ACE - no e x : r , cards 'c, _ _ ' ! ) buv Softw are selectab le data 'orrnat 7 or 8 da 'a

» ts one Jr tw c s\OC b its, 0dd r r e ve n ~ a r , t v fu';lor~ all de p ie , -

® 300 BAUD \clUme seleC'able lor 11 J baud

f6\ SWITC H :ONTROL lor answ er J " g : n a t e S IS o e x : to\ ' : ' ) , e yb o ar j

if' CAg~ E~ DETEC- LEe ""es V ( l U l I o e snu s at 10_) car:e

AU THIS PLUS

COMPLU, w !'h~ETWORKE~ SOFTWARE ;0 g ive''1<)l;

• T ext tra pp ing ot e 'lt lre iniG g A M m er no v

s to ra ge c ao ac I'Y lor trapped Ie "s cree'l m enu a nd sta tus rld:CJ~Grs

fREE SUBSCRIPTlurl TO TrtE SOURCE the poou-

la r d ia l . . J O In fo r r : lJt 1cr s v s . e r r

SOf!WARE COMPATIBIL'TY - -"in a' c o r n m o rApple c om r: lU r li C a t lr ) 'l s o rt '" ,, 'a r '!

CDMPATiBLE ,\:t'l S C ! r " 1 '0t2r\ a nd tone ph or es

fCC APPRUVED - Made n JSA

OM YEAR M ANUfAC TURERS ,\ARRM ;TY

N E T W O R K E R ' IN C LU D E S AC O M P L E T E P A C K A G E

$129

C NETWORKERNETMASTER COMBO

e , o _ D ,

Mass residents add 5'0 s ale s t ax

Tota l Enclosed _

VISA CHECK

N E T M A S T E R v C O M M U N I C A T I O N SS O F T W A R E

Fcc S' 79 wencluCie Wllh Ire NETWORKER Ihe

NET MASTER Comrrn.r rcauo-is Sollware lor ad-

va"ced users NET MASTER ""I let yOG Iransler

gU,Tes c'onpurer graPhiCS, programs, sales re-

00·1s, ooccr ervs - 'r' face arv Aocle tile c! anv Size

- IC' anctr.er CCi1l~l_;ter_ crecnv from Clsk to c.sk

WI!"'O.Jt errors ever lhrOLJqr nosy phone lines

To OrderCall Toll Free800-824-7888 Continental US

800-824-7919 Alaska and Hawaii

or anywhere In the world

916-929-9091 VISA'

C 0 J O R .D E R S A D D 5 3 O C

: - M ASTERCARD

CARD NUMBER _ EXPIRES _

JQB Enterprises Incorporated

SIGNATURE _

I Cred!~ C a r e ord ers + ost b e 5,~ ned I

P O B O X 2 6 9 . A Y E R M AS S A C H U S E T T S 0 1 4 3 2All Pr.ces Q uoted are for Prep,lld Orders - Pnces Suoect to Change W,thoul Notice

Page 49: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 49/76

~ ~ = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 1• • • • • • • • • • • • • • 4 . • • • • • • • • • • • • • • ·000

68000 Exception Processingo00······························

The 68000 microprocessor has many

attributes found on mini and main

frame computers. These include

system and user modes, levels of

interrupts and error recovery from bad

software. Compared to 8 bit

microprocessors like the 6502 and

6809, the 68000 seems incredibly

complex.

Fortunately, the designers of the

68000 came up with a logical and

straight forward method of handling allthe complexities. The purpose of this

article is to describe "exception

processing" on the 68000. The

following parts will give examples of

how to take advantage of the 68000's

capabilities. Part 2 will cover software

exception processing in general; Part 3

will cover hardware exception

processing for the Sage II.

Status Register

Like other microprocessors, the 68000

has a status register. This holds the

carry, overflow, zero and negative bits

which are found on all

microprocessors. The 68000 has

additional bits called trace, interrupt

mask and supervisor state. The bit

positions within the status register are

shown in Table l.

Table 1 . Status Register

B it Description

15 T ra ce M ode

14 Unused

13 S u pe rv is or S t at e

12-11 Unused

10-8 I nt er ru pt M a sk

7-5 Unused

4 E xtend ( X bit)

3 Negative

2 Zero

1 Overflow

0 Carry

by Mike Rosing

Littleton, Colorado

68000 uses exception processing to handle

software and hardware.

Bits 0-7 are called the user byte and

bits 8-15 are called the system byte.

The trace mode bit is useful for tracing

programs one instruction at a time.

The interrupt mask determines what

level of interrupt can be processed,

lower levels being ignored. We will get

into those bits later. For now the

supervisor state is most important.

If you have ever written a program

on an 8 bit machine which accessed

every byte in I/O space (like COOOto

CFFF on the Apple 2) you will

appreciate the separation of user state

and supervisor state on the 68000.

When the 68000 is in user state, it can

not access the system byte of the status

register. Nor can it access addresses

which are specified to be in supervisorspace.

Register A7 is also affected by the

supervisor state bit. If the bit is set A7

points to the supervisor stack pointer.

When the supervisor state bit is clear

A7 points to the user stack pointer.

Most systems keep these stacks in

different areas of memory.

Exceptions

Once the 68000 goes to user state, it

can not change the supervisor state bit.Unless an exception occurs, the 68000

will stay in user state. Since exceptions

can be forced by software, this is not a

problem. In fact, it ensures program

integrity since exceptions are all

outside the users normal needs.

Exceptions include interrupts,

hardware errors, software errors and

traps. Interrupts are caused by external

devices. Hardware errors are part of

external logic to the 68000. Software

errors include division by zero and

registers out of bounds. Traps are

similar to a software generated

interrupt.

All 68000 exceptions go thru four

steps. Step one is to make a copy of the

status register. This ensures that after

the exception is handled the processor

can return to its original state. The

supervisor state bit is set putting the

processor in supervisor mode and sets

the stack pointer to the supervisor

stack.

Step two determines the vector

number of the exception. This vector is

a pointer to the code which the 68000

will execute to take care of the

exception. In some cases this number is

placed on the bus by an external device.

In other cases the vector number isgenerated by the 68000.

In step three, the program counter is

pushed on the supervisor stack

followed by the status register copy

made in step one. I f the exception is a

bus or address error, more information

will be pushed on the stack during this

step.

Step four sets the program counter

to the address found in step two and

normal execution resumes.

The address pointers used by the

68000 in step two are located at

addresses 0 thru $3FF. Every four bytesrepresents a 32 bit pointer. This is

enough room for 256 pointers.

Multiplying the vector number by four

gives the address of the pointer. This in

turn has the address of the code to

execute.

The first 64 exception vectors have

specific meanings. For example, vector

number 5 is the divide by zero

exception. Vectors 48 thru 63 are

reserved for future use. Vectors 64 thru

255 are user definable.

M S B

L S B

No. 75 . September 1984 MICRO 47

Page 50: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 50/76

Table 2 - Software Exception Vectors

Vector Number H ex Address D escription

User interrupts: Space for interrupts

generated using "normal" interrupt

processing. Very few manufacturers

use this because autovectoring is much

simpler.

To understand how to use the

68000 exception processing a few

examples are necessary. Part 2 of this

article will discuss software exceptions

which can be programmed on any

68000 system. Examples of hardware

exceptions will be given in Part 3.

These examples will be for a specific

computer but the main ideas are

transportable to other machines.

Table 3 - Hardware Exception Vectors

Vector N umber Hex A ddress Description

0 0 Reset

2 8 B us e rr or

1 5 3 C U n in i ti a li ze d i n te r ru pt

24 6 0 S p ur io us i nt er ru pt

25-31 6 4-7C Autovector interrupts

64-255 100-3FC U se r i nt er ru pt s

3 C A dd re ss e rr or

4 1 0 I ll eg a l i n st r uc t io n

5 1 4 Z er o d iv id e

6 1 8 C HI( instruction

7 1 C T R A PV i ns tr uc ti on

8 20 Privilege viol.ation

9 24 Trace

10 28 Line 1010 emulator

1 1 2C Line 1 1 1 1 emulator

32-47 80-BC T R A P instructl.ons

Software Exceptions

4 8

traps on the 68000.

Hardware ExceptionsTable 3 shows the hardware vectors. I

call them hardware because the support

chips placed around the 68000

determine how these vectors are

generated.

Bus error: When pin 22 goes low on

the 68000 this exception is processed.

Usually a system is designed so any

attempt to access memory which does

not exist will pull this low.

Uninitialized interrupt: If an MMU

(memory management unit) is attached

to the 68000 it can generate this vector.

Spurious interrupt: If bus error goes

low while an interrupt is being

processed this exception is taken.

Autovector interrupts: Designed foruse with 6800 peripherals. Almost all

systems built to date use these as the

only interrupts.

Par t 2: Software Exceptions

In the firs t part of this article, the

68000 exception processing was

described in the theoretical sense. This

Listing 1 o

* i ni ti al iz e t ra p v ec to r

le a

move.l

trapzero,aO

aO,$80

Table 2 shows the vector numbers and

locations for the software exceptions. A

short description of each is given here.

Actual examples will be given in Part 2

of this article.

Address error: Attempt was made to

reference word or long word address on

an odd boundary.

Illegal instruction: Attempt was

made to execute data. Patterns $4AFA,

$4AFB and $4AFC are "permanently

illegal" according to Motorola.

Zero divide: Attempt to divide by

zero using DIVU or DIVS instructions.

CHK instruction: The check

instruction is used to compare a

register against bounds. If not in proper

range the exception occurs.

TRAPV ins truction: Exception

taken if overflow bit is set.

Privilege violation: Attempt was

made in user mode to change system

byte of status register.

Trace: If the trace bit is set in the

status register, the exception is taken

at the end of each instruction. This

pointer should be set to a debugger or

monitor.

Line 1010 and Line 1111 emulator:

68000 instructions which have $A or

$F as the first nibble will come here.

Motorola has a set of instructions

defined for the 68020 such as floating

point operations. The purpose of these

traps is to enable emulation of the

68020 by the 68000 for downward

compatability.

TRAP instructions: These can be

compared to software interrupts of8bit

microprocessors. There are 16available

* e xe cu te s of tw ar e e xc ep ti on

trap 1 1 0

* go back to user mode

move 1 10,sr

rts

og et tr ap a ddr es s

pu t i nto v ec to r lo ca ti on

o

o

clear all of status register o

* code executed b y trap 1 1 0 instruction o

t ra pze ro :b se t 1 1 5,( sp )

rte

set supervisor bit in old status word

r et ur n f ro m e xc ep ti on 0

MICRO No. 75· September 1984

Page 51: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 51/76

sec t ion' s purpose is to create a better

understanding of the 68000 exception

processing activity by using concrete

examples.

When an exception occurs, the

68000 copies the status register, gets

the vector number, pushes the program

counter and previous status register on

the supervisor stack and jumps to the

address stored for this vec tor.

As an extremely simple example thecode in Listing 1 is actually very

powerful.

The first two lines in Listing 1

initialize vector number 32. The

sixteen trap instructions use vectors

32 + n where n is in the range zero to

fifteen. These two lines of code point

out the flexability of the 68000

exception system. The exception

processing code may be anywhere in

memory. It also points out how simple

it is to change exception vectors.

The trap instruction is the same as asoftware interrupt instruction on a

6502 or 6809. The program counter and

status register are pushed onto the

supervisor stack. The number in the

instruction determines which vector is

chosen. Trap instructions are always

immediate mode. The trap number is

added to 32, then multiplied by 4. This

gives the address of the trap code. In

this case address $80 contains the

address of trapzero.

The address stored in location $80

is put into the program counter.

Execution now begins as usual. In thiscase, bit five of the byte pointed to by

the supervisor stack is set. Remember

that this is a copy of the status register.

When the RTE is executed, the status

register is pulled from the stack. Bit

five happens to be the supervisor state

bit. When the program counter is

pulled from the stack we return to the

instruction following the trap #0.

We have now gone from user mode

to supervisor mode and the system is at

our command. Depending on the

operating system, this can be

extremely dangerous. After playingwith the system we may want to return

to user mode. This is done by clearing

the supervisor state bit in the status

register Isr].If an attempt were made at

executing the move #O,sr in user mode

the privilege violation exception

(vector number 81would occur. In this

case the program counter pushed on the

stack points to the instruction in

violation, not the instruction

afterwards. This is slightly different

from the trap instruction.

Unimplemented instructions are

similar to the privilege violation. The

program counter pushed on the system

stack points to the offending code. This

is very useful as shown in tbe next

example.

Suppose we have an application

where 64 bits are required. As an

example we create an instructionwhich has the following format:

Nibble H ex value Meaning

J f L in e 1 11 1 e mu la to r

2 I~ Addition

1 0,2,4,6 Register

0 0,2,4,6 pair

Nibble 3 forces exception

processing on vector number 11

[address $2C). Nibble 2 can be used to

specify one of 16 instructions. For this

example only one is used. Nibble 1

specifies the source register pair. Since

we want to add 64 bits, we will need

two registers to hold the result. Zero

means registers dO and d l . Six means

register d6 and d 7. We will take odd

numbers to be errors. Nibble 0 specifies

the destination register pair.

Listing 2 shows how an emulator

might be written. It first saves all thedata registers. Errors are just ignored.

Since any registers might be used, all

are saved into memory. The source and

destination register pairs are converted

to memory offsets. These memory

contents are then added. Notice that

the add with extend instruction is not

as flexable as the add instruction. This

is a minor drawback of the 68000.

Initialization of the emulator

requires the first line of Listing 2. This

puts the address of the emulator into its

appropriate vector.

Listing 2

* initial :. ze line 1 11 1 em ulat or a nd c all it fo r te stin g

move.1

move

move

.dc.v

rts

line1111,$2c

1,d2

2,d4

$f024

line1111:

* emulator code for 64 bit addition of registers

o

o

o

o

o

o

o

e

o

o

o

No. 75· September 1984

d0-d7/a0,sav ezon e sa ve da ta

2( sp),a0 point to instruction

(a0),d0 get instruction

0,d0 even destination?

error nope

4,d0 e ve n s ou rc e?

error no again

7,d0 create

2,d0 d es ti n at i on o f fs e t

(a0),d1 create

$70,d1 source

2,d1 offsetsavezone,a0 point to data

4(a0,d1),d2 get l ow er s ou rc e b it s

d2,4(a0,d0) add t o l ow er d es ti na ti on

(a0,d1),d2 get h ig h s ou rc e b it s

(a0,d0),dJ get h ig h d es ti na ti on b it s

d2,dJ add w it h e xt en d

dJ,(a0,d0) r es e t d e st in a ti on

move

and

Is rlea

move.l

add.l

move.l

move.l

addx.l

move.l

movem.l savezone,d0-d7/a0 restore new data

add.l 2,2(sp) point to next instruction

movem.l

move.l

move

btst

bne

btst

bne

and

lsI

error:

rte

.ds.l

end

9avezone:

MICRO

bits

r et ur n f ro m e xc ep ti on

spac e for 9 long words

4 9

Page 52: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 52/76

Execution is done by placing a word

in the middle of normal code. Most

assemblers require a construct shown

in Listing 2 as .dc. w $F024.

When normal execution gets to this

instruction exception processing takes

over. Since the high nibble is $F =

1111 (base 2), vector number eleven is

executed. This is just our emulator.

Notice that we added 2 bytes to the

program counter before returning fromthe exception. This prevents an infinite

loop.

The trace exception is also a

software interrupt. Like the trap

instruction the program counter

pushed on the stack points to the next

instruction to be executed. This

happens because the trace exception

processing always occurs between

instructions. To make effective use of

the trace exception, one must know the

II 0 port addresses for efficient

debugging.Unlike the previous exceptions, the

address error can occur anytime an

effective address for a word or longword

is on an odd byte. This is usually in the

middle of an instruction execution.

Because of this, more information is

pushed on the supervisor stack during

the third step of exception processing.

This includes the instruction register

which holds the first word of the

offending instruction. The program

counter is usually two to four bytes

past this point. After the instruction

register comes the effective address

which is going to be odd. This is a

longword. The 1st word pushed on the

stack includes the function code, a

read/ write bit and an instruction bit.

The function code corresponds to

the 3 bits FCO, FCI and FC2 on the

68000. These determine user or

supervisor mode and program or data

space. The read/write bit tells whether

the access was during a read or write.

The instruction bit tells if the error

occured on an instruction. An address

error on an instruction will occur on aline of code such as JMP (AO) where

AO is odd. The jump instruction itself

will be executed, but an address error

will occur as soon as AO is transferred

to the program counter.

To fully utilize these error

exceptions, one has to send

information to the programmer. This

usually involves input and output. The

final section of this article gives

examples of hardware interrupts for

I/O on a specific machine.

Part 3: Hardware Exceptions

The previous two parts of this article

have described 68000 exception

processing which was valid for any

system. This final portion is specific to

the Sage 2 because hardware exceptions

are caused by the physical wiring

connected to the 68000.

Hardware exceptions include reset,

interrupts and bus error. Each of these

arepifysi~ally wired to the 68000. On

the! Sage, the reset is performed by

power on, or by pressing the reset

butt~llI~n the back of the machine.

The bus error line on the Sage will

be activated if the address strobe line is

not released within two microseconds.

Even the. slowest EPROM's are faster

than this. Usually one gets this error

when attempting to access an address

such as $4D696B65.

Interrupts are generated wheneverany of the interrupt lines go low. All

lines low indicates a level 7 interrupt.

All lines high indicates no interrupt.

The Sage is built with an LS148 priority

encoder attached to the interrupt lines.

This ensures that the 68000 sees only

the highest level interrupt yet to be

processed.

Reset Processing

During reset the 68000 looks for asystem stack pointer at vector number

o . This is located at address 000000. Itthen reads the program counter from

vector number 1 at address 000004. On

the Sage these addresses are located in

RAM. How does the Sage turn on at a

known address?

When the reset line goes Iowa latch

is cleared which relocates the monitor

EPROM:> to address 000000. The first

longword in the EPROM is $400 which

is the startup system stack. The next

longword is $FE003C which becomesthe program counter.

On the Sage, addressing the

EPROMs at addresses in the $FEOOOO

range relocates the EPROMs to

$FEOOOO.Thus, as soon as the program

counter address hits the bus, the

EPROMs are where they need to be and

the 68000 is initialized.

The only way to change the reset

system on the Sage is to burn new

EPROM,. For most users this should be

unnecessary.

Bus Error Processing

The bus error exception is exactly

the same as the address error described

in part two previously. It is precessed

whenever the bus error line (pin 22)

goes low. To appreciate why this is

useful in two microseconds on the

Sage, remember that the 68000 is an

asychronous device. DTACK has to go

low before the address lines arereleased. The processor enters wait

states until DTACK is returned. It is

perfectly happy to wait forever.

To avoid external circuitry which

computes whether an address is valid it

is much simpler to put on a timer. The

timer is run at the start of each bus

access and off when no bus access takes

place. As long as the timer never runs

out no bus error can occur. If no wait

states are ever used, a complete bus

access will require 250 nanoseconds

and a complete instruction will require

500 nanoseconds (or more). A singlewait state is 125 nanoseconds, Thus 16

wait states will go by before a bus error

occurs.

This discussion is specific to the

Sage only. Other systems will have

different methods of generating bus

errors. The access address is pushed on

the stack in any case, and this is

important to display for debugging

purposes.

Interrupt Processing

According to the 68000 manual,

normal interrupt processing requires

the interrupting device to put its vector

number on the lower data bus. This

number should be greater than 64. This

method allows for a total of 192

interrupts of any desired level. The

implementation is not so easy in

hardware. I don't know of any 68000

based machines which use this

capability.

The lack of "normal" interrupts is

due to the 68000 having autovector

interrupts. By pulling the VPA line low(pin 21) during an interrupt

acknowledge the 68000 looks at the

interrupt level input lines (pins 23-25).

This value is added to 24 to get the

exception vector.

Level 7 is used for RAM parity

errors. Levels 4, 5 and 6 are used for the

IEEE port, the terminal input port and

the floppy disk controller respectively.

The level one interrupts are processed

thru an Intel priority interrupt

controller for eight interrupts. All

50 MICRO No. 75 . September 1984

Page 53: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 53/76

interrupts are autovectored and no

provision was made for "normal"

interrupt processing as defined by

Motorola.

The eight level one interrupts

include two clock timers, the terminal

receive ready, the terminal and remote

transmit ready, a ring detect, printer

acknowledge and software generatable

inputs. In order to give an example of

interrupt processing on the 68000, wewill mask all but the terminal USART

generated interrupts.

The terminal interface chip is an

Intel 8251A. This chip generates an

interrupt whenever a character is

received, as well as when it is ready to

transmit a character.

The code shown in Listing 3 is very

simple and should not be used for any

real application because it does not

save registers. It is a good example to

follow though. The first line of code

puts the processor into supervisor

mode [see page 48, Listing I). Themask on the next line prevents all

interrupts except the USART transmit

ready from entering the 8259. Next the

autovector addresses are set to the

interrupt codes. Registers are used

directly for this example and are

initialized. The 5 turns the USART on

for transmission and reception of data.

Finally, the stop instruction moves

$2000 into the status register and halts

processing.

When an interrupt occurs the

processor executes code starting at theinterrupt in question. If the USART is

ready to transmit the tennout interrupt

will execute. If a character comes in

from the keyboard, the tennin code

will execute. When the processor

returns from the interrupts the code

following the stop is executed.

To follow this, suppose the

processor is halted. We press a key on

the terminal which is transmitted to

the USART. The USART causes

interrupt level 5 and the 68000

autovectors to termin. The character is

pulled from the USART, clearing theinterrupt. We store it into the input

buffer and bump the input buffer

pointer. After returning from the

interrupt, the 68000 checks to see if a

character came in.

A character was received so DO is

not equal to Dl. The character is

moved to the output buffer and

pointers are incremented. The

transmitter is enabled and the

processor halts again.

Since the transmitter is empty, it

generates a level one interrupt via the

8259. The level one in terrup t

autovectors to termout. Since we set it

up for only one possibility, the 8259

interrupt level is ignored. However, in

a real system we would then have to

pick the correct place to go to handle

the interrupt.

The character is moved from the

output buffer to the transmitter of the

USART. The get pointer is bumped andthe interrupt is ended.

At this point DO equals Dl so we

return to the stop instruction. The

USART generates a transmitter empty

interrupt so we again vector to the

termout routine. At this point D2

equals D3 meaning the buffer is empty

lor overflowed!). The endout point

turns the transmitter enable off. Return

from interrupt again finds DO and D l

equal putting us at the stop instruction.

Even at 19.2K baud the trans-

mission of characters is 100 times

slower than the processor. This is only

an example to show how interrupts can

be used to run I/O in background while

68000 processes data in foreground.To summarize, remember that

exceptions all have vectors which point

to the code which handles them. Any

exception vector can be changed on any

computer to suit the needs of your

program.

eisting 3

* A ssume baud rates set up and 825 9 i nitialized (')

trap # ~ go to supervisor modemove. b # % 1 1~1 1 1 1 1, $F F C~4 3 mask off all interrupts

*transmit

move.1

move.l

le a

lea

fer

on:

moveq

moveq

moveq

moveq

move.b

#termout,$64

#termin,$74

inbufr,a~

outbufr,a1

#~,d~

#~,d1

#~,d2

#~,d3

# 5,# F F C073

#$2~0~d~,d1

wait

(a0,d0), (a1,d3 )

# 1,d0

#1,d3

on

i n te r ru p t h a n dl e r

# $ C,$ F F C04 1

$ F F C04 1,d4

# $20,$F F C04 1

d2,d3endout

(al,d2),$ F F C071

#1,d2

# 4,$ F F C073

i n te r ru p t h a n dl e r

$ F F C0721,d4

d4,(a0,d1 )

# 1,d1

d0,d1

endin

#0,$F F C073

e x ce pt t er m in al t ra ns m it

a ut ov ec to r 1

a ut ov ec to r 5

pointer to input b uf fer(1)

p oi nt er t o o ut pu t b uf fe r

set

up

get and

p ut p oi nt er s

e na bl e t ra ns mi ss io n a nd

reception

w ait f or i nt er ru pt

char came in?

n o,w en t o ut

m ov e f ro m i npu t t o o ut pu t 0

bum p input g et pointer

bum p output put pointer

e n ab l e t r an s m is s io n

set up 825 9 for read

g et i nt er ru pt l ev el

c le ar i nt er ru pt

hit end ofd at a t o t ra ns mi t?

send out char

b um p g et p oi nt er

e nd o f i nt er ru pt

d i sa b l e t r an s m is s io n

get input ch ar

put into input b uff er

b um p p ut po in te r

h it g et po in te r?

y es , p ro b le m s

s o d is ab le re ce iv e

end of interrupt

e

o

'"v

e

o

o

o

No. 75 . September 1984 51

wait:stop

cmp.b

beq

move.b

put

add i,

add i,

bra

* t er mi na l o ut pu tterm out: m ove. b

move.b

move.b

cmp.b

beq

move.b

addi,

rt e

ITlove.b

rte

endout:

* t er m in al i np ut

termin: move. b

ITlove.b

s.ddi.

cmp.b

t ne

ITIove.b

rtendin:

MICRO

Page 54: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 54/76

.---~------------,

F L D N A M E T Y P E W I D T H D E C

0 0 1 M R M R S C 0 0 4

0 0 2 F I R S T N A H E C 0 1 5

0 0 3 L A S T N A M E C 0 1 5

0 0 4 C O M P A N Y C 0 2 0

0 0 5 S T R E E T C 0 2 0

0 0 6 C I T Y C 0 1 5

0 0 7 S T A T E C 0 0 4

0 0 8 Z I P C 0 0 6

* * T O T A L * * 0 0 0 9 8

by Rob4~rt R . Carroll

Woodland Hills, California

o

oOf the many books and articles

written on these programs, none has

come up with a simple, easy-to-use

method of transferring the data files.

Typical schemes require writing an

external BASIC program or using a

word processor in a lengthy, hard-

to-remember procedure. dBASE II

provides all the functions necessary

to make the transfer complete without

resorting to difficult external measures.

Besides many users of these programs

don't have the time, inclination or

programming knowledge to use them.

Now, let's look at a sample dBASEII .OBF file called OATA.OBF which

contains mailing list data. Using

dBASE II's LIST STRUCTURE

command we see the following:

. U S E D A T A

. L IS T S TR UC TU R E

S T R U C T U R E F O R F I L E : A : D A T A . D B F

N U M B E R O F R E C O R D S : 0 0 0 0 3

D A TE O J ? L A S T U P DA TE : 0 3 / 1 5 / 8 4

P R I M A RY U S E D AT A B A S E

oTransferring dBase IIFiles

For Use WithWordstarl Mailmerge

o

Alter your dBase II files and use them

to produce personalized letter forms.

52 MICRO

We can see that each field has a

specific width determined by the user

at the time the database was created.dBASE II will reserve this width for

the data when it is stored on disc,

whether the actual data fills up the

entire width or not. For example, a

LASTNAME of Oeltawashington fills

up our field width of 15 characters

quite nicely. However, Stein leaves us

with 10 trailing blanks which will be

carried right into our form letter if we

don't get rid of them somehow. Let's

enter some sample data to clarify the

example.

When using the popular programsdBASE II and Wordstar/Mailmerge in

business, an opportunity often presents

itself where the two can be used

together to produce personalized form

letters. On the surface, it would

seem that this should be no problem;

however, there exists certain

peculiarities in each program that

forces a bit of thought as to how to

manipulate dBASE II files so that

Mailmerge sees just what it needs to

perform correctly with all types of

data. If you're not careful, you will

undoubtedly find form letters loadedwith unwanted spaces due to the

trailing blanks leftover from the fixed

field lengths of your data from dBASE

II's .OBF (data) files. Or worse,

embedded commas in your data will

confuse Mailmerge to the point where

it won't track your data correctly. In

either case your letters will look far

from personal. This article will explore

a simple yet effective method for

flawlessly transferring dBASE II data

files for this use.

No. 75 . September 1984

Page 55: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 55/76

R ec # M RM RS F IR ST NA ME L A S T N A M E C O M P A N Y

00001 Mr. ,JohnH. Stein Tate and Sons

00002 Mrs. J oanne T . Houseman M el t, In c.

00003 Ms. Toni J . D e lt a wa sh i ng t on L e wl s, J ones, and C o.

S T R E E T CITY S T A T E ZIP

24 L ake A venue Chicago IL 60606

9 70 T ulips S treet N ew Y ork N Y 10019

1 16 78 R ivers ide D r. Burbank C A 9 1 3 5 6

Now suppose we want to use this data to create a personalized form letter

called FORMLTR written using Wordstar/Mailmerge. The letter might read asfollows:

. . F O R M L T R

.op (to omit page number in printout)

. df D AT AT EX T. TX T ( datafile created from dB AS E II file D AT A. DB F)

.rv M R M R S,FIR S T N A M E,L A S T N A M E,C O M P A N Y,S T R E E T,CIT Y,S T A T E,ZIP

( tells M ailmerge to read values in specif ic order)

D ear & MR MR S& & LA ST NA ME &:

We regret to inform you that we cannot use & C O M P J U fY & in this

y ear' s ex hib ition. T hank y ou f or y our inter est.

Sincerely,

C ly de T . N ew sh an dl er

. pa( to b egin new page)

If we don't remove the trailing blanks we would get something like:

Dear Mr. Stein

We regret to inform you that we cannot use Tate and Sons

this year's exhibition. T hank you for your interest.

in

The blanks in the text of the letter automatically tell the reader a computer

is talking at him. Also, Mailmerge must see its data separated by commas and

if a piece of data has a comma embedded in it, the entire piece must be enclosed

in quotes. For example, in our Rec # 00002, the COMPANY field contains

Melt, Inc. Mailmerge must see "Melt, Inc." so that it doesn't confuse theembedded comma with a field separator and think that "Inc." is the next data

field. In this unfortunate occurrence, the tracking of all the data would be one

field off for the rest of the letters generated. Thus we might get:

Dear 1001 9 Ms. :

We regret to inform you that we cannot use Toni J . in this .

No. 75 . September 1984 MICRO

u~hA Dea Inc.

Word Sta rP ro Pack

DISK DRIVES

Concorde CIII $189

Rana Elite I $229

Rana Elite II $369Rana Elite III $475

MODEl

11512" Amber Hi-Res $129

21012" COmposite-RGB $289

400 12" RGB Med-Res . . . . . . . . . . . .. $299

41012" RGB Hi-r~es $349

415 12" RGB Super Hi-Res $399

1 26 29 N . T atu m B lvd .Su it e 212

Phoenix, A 1 . 85032

Coli: 602-957-3619

$2 PHONE REBATEWITH ANY ORDER

SHIPPING CHARGES0-100 s 5

101-200 $ 8201-300 $10301- up $15

All prices are for cash or check-

Visa/Mastercard add 3%

53

Page 56: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 56/76

Not very professional. Luckily, Mailmerge will also accept an overkill

method of data separation: enclosing all data in quotes and separating them

with commas. This seems like it would be more work, but actually it is the

uniformity of this approach that makes this method work. And dBASE II does

all the work for us.

Now let's try the conventional method of creating text files from dBASE II

database files. While in dBASE II use the command:

USE DATA

COPY TO datatext DELIMITED WITH"

If we now examine the file DATATEXT.TXT (the .TXT extension is

automatically assigned by dBASE II) using Words tar or a suitable command

like CP/M's TYPE, we'll see that all data is enclosed in quotes but with all the

trailing blacks carried right along like this:

"Mr. ''. "John H.

"24 Lake Avenue

' '. "Stein

", "Chicago

", "Tate and Sons

", "IL «, "60606

",

", "Mrs. ",

Well, that's no good. Let's try the other way of creating text files from dBASEII

files:

USE DATA

COPY TO data text DELIMITED WITH,

Using this method, all data will be separated by commas and the trailing blanks

will be trimmed from each piece of data like this:

The SET TALK OFF command

stops dBASE II from sending comments

to the screen as it makes calculations

or skips to the next record. SET RAW

ON eliminates single spaces between

fields which when defaulted to OFF is

the normal way dBASE IIwill LIST or

DISPLAY data. Keep in mind that

everything sent to the screen will

appear in the file datatext. txt.

Using the above dBASE II program

on our sample file data.dbf will yield

the following result automatically

given the filename datatext. txt by

dBASE II:

"M r. "

"John H. ",

"Stein",

"Tate and Sons",

"24 Lake Avenue" ,"Chicago",

"IL" ,

"60606",

"Mrs. «,

"Joanne T.",

"Houseman" ,

"Melt, Inc. ",

"970 Tulips Street",

"New York",

"NY",

"10019",

"Ms. ",

"Toni J. ",

"Del tawashington",

"Lewis, Jones and Co",

"11678 Riverside Dr. ",

"Burbank",

"CA",

"91356",

We can see that this format adheres

to all of Mailmerge's rules. Each piece

of data is separated by commas, trailing

blanks trimmed and enclosed in quotes

to protect embedded commas within

data fields.

An extra added bonus is that our

original dBASE II command file used to

create the datatext. txt file is easily

modified for use with other dBASE II

.DBF files by changing the field names

only via Words tar or dBASE II's Modify

Command. The rest remains intact.

If you do any work at all with these

programs and form letters, you'll find

this method unbeatable.

Mr. ,John H.,Stein,Tate and Sons,24 Lake Avenue,Chicago,IL.60606,

Mrs., Joanne T., Houseman,Mel t, Inc., 970 Tul ips Street, New York,NY,

10019,Ms.,Toni J.,Deltawashington,Lewis, Jones, and Co. ,11678

Riverside Dr.,Burbank,CA,91356

Unfortunately, embedded commas (like in Melt, Inc.) will cause incorrectdata tracking as we discussed earlier. Obviously this won't work with all data

types either.

Fortunately, there is a trickier way to create text files with dBASE II which

allows the full power of the program to be runrnng at the same time. If the

command SET ALTERNA TE TO

datatext. txt is used followed by SET

ALTERNATE ON, everything shown

on the screen will be sent to the file USE DATA

datatext. txt. So, we can write a short SET TALK OFF

dBASE II program stnpping away the SET RAWON

trailing blainks from the data using SET ALTERNATE TO datatext. txt

the TRIM funciton and insert the SET ALTERNATE ON

proper punctuation so Mailmerge gets

just what it wants. And, as an addedbonus, since the full power of dBASE

II is available, we can "filter" the

usable data for our form letters much

more efficiently than we could by

simply using the COpy TO command

line.

For our example, the following

program could be written in dBASE II:

54

DO WHILE .NOT. EOF, 1 ,1

TRIM(MRMRS) I" ,I I

,III' TRIM (FIRSTNAME) 111' I I,

, " ' TRIM (LASTNAME) , '" I I,r T I' TRIM (COMPANY) , TI' I I,I III TRIM(STREET) , " ' I I,, n t TRIM(CITY) r T I' I I

s

, '" TRIM(STATE) r "'I I,

r "' TRIM(ZIP) , " ' I I,

SKIP

ENDDO

SET ALTEF~ATE OFF

MICRO No. 75 . September 1984

Page 57: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 57/76

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

sT

E

p

ER

p

-A Step-Trace facility with

a handy twist.

Have you ever tried to debug a

machine-language program by step-

tracing it and found that you were

looking at a lot of instructions that you

had not written IThis can be slow and

annoying.

-

by Chester H . Page

S ilver S pring, M ary land

Apple, Volume 2. That prugram

mimics the Step-Trace facility that was

in the old monitor ROM before the

days of AutoStart. He added a few

features such as interrupted trace. In

addition to the nuisance of dissecting

all monitor subroutines used in yourprogram, this Step-Trace program has a

problem with COUT - it hangs up.

My modification avoids this problem

because COUT is not dissected. In fact,

I can step-trace a program which calls

for printing 2. word on the screen, then

activating the printer and repeating the

print operation on paper' To do this

requires one special procedure: instead

of changing output hooks at $36/37

[which would cause a hang-up) the

hooks are changed directly in DOS at

$AA531 AA54.

For a final touch, my stepper

program is relocatable and can be

BRUN at any location that avoids the

program to be debugged.

The step-tracing displays ofinstructions and user registers are

placed on screen lines 0 to 19; user

COUT output appears in lines 22 and

23. Lines 20 and 21 maintain a gap for

better appearance. The right-hand end

of the gap lines is used for special

storage, so exhibits a pecu Ii ar

combination of characters. The reason

for this unconventional storage

location is to avoid possible

interference with user programs which

may use any available zero-page space

The reason for this phenomenon is

obvious - all rSR calls to MONITOR

routines get traced through step-by-

step and this is distracting. I decided

that I wanted a step-trace program that

would display only my instructions,

i.e., any call to a monitor subroutine

would be handled as a single step

operation, no matter how many

monitor steps were actually involved.

For background, I studied

Peterson's Step-Trace in MICRO on the

No. 75 . September 1984 MICRO 55

Page 58: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 58/76

With these tools •••s- c M acro Assem ble r - C om bined edito r/a ss em -

b le r inc lude s 29 com mands and 20 d ir ec t iv e s ; w ith

m ac ro s. c onditio na l a ss em bly , g lo ba l r ep la ce , e dit . a nd

m o re . W e ll- kn ow n f or e as e- of -u se a nd p ow e rf ul f ea tu re s.

T ho us and s o f u se rs in o v er 30 c ou ntr ie s a nd in e ve ry t yp e

o f indu str y a tt est t o its s pe ed, d ep end abili ty , a nd u se r-

f r ie n d li n es s . B l e nd s po ......r. s im p li ci ty , a nd p e rf o rm a nc e t o

provide the op t im um capabi li t ies to both beginning and

professional programmers. With IOO-page manual and

reference card. :$ 92.50

Cross Assembler Modules - Owners of the S-C MacroAs se mble r m ay a dd th e a bil ity to de velo p programs fo r

o th er sy stem s. W e h av e m odu le s fo r mOSI o f t he p o pu la rc hip s. a t v er y r ea so na ble prices

6800'01/02.

6BO~

6809.

6BOOO

Z-BO.

PDP· I IB048

B051 .

8080/851802/04/0~

$32.50

· $32.50$32.50

$5000$32.50

· $50.00

· $32.50

· $32.50..... $32.50... $32.50

Al l of the c ro ss a ss em b le rs r et ain t he f ul l powe r of the S- C

M a cr o A ss em b le r. Y o u c an d ev elo p p ro g ra m s f or b ur nin g

mtc E PROM s , transfer th rou gh a daia-hnk, o r d ir ec t

exe cu tio n by so me o f the p lu g-in p ro ce ss or c ar ds no w o n

t h e m a r ke t.

Appl« Assembly Line - Monthly newsletter forassembly

la ng ua ge p ro gra m mer s, b eg inn er o r a dv anc ed. T utorial

a rt ic le s: a dv a nc ed t ec hniq ue s; h and y u ti lity p ro gr am s:

commented li sti ngs of code in DOS and Apple ROMs:r ev ie w s o f r ele va nt n e ......b oo ks , h ar dw a re , s of t w a r e: a nd

more' S18per year( add $3 for first class postage inUSA.

C ana da , M exic o: a dd $1 3 p os ta ge f or o th er c ou ntr ies ).

S·C Software Corporation2331 Gus Thomasson, Suite 125

Dallas, Texas 75228

(214) 324·2050

and may use the empty spaces in DOS

for data storage. This special storage

area is for (1) the split-screen window

data, (2) storage of output-hook data

and (3) storage of the XQT (execute

instruction) area. The old monitor

ROM uses $3C/44 for XQT, but

$3E/3F gets overwritten by GETNUM.

For this reason, the XQT area had to be

re-initialized before each user step. I

preferred to avoid this repetitionbecause I use a lengthy initialization

routine for relocatability. The problem

is in the two jump instructions that

follow the user command which was

copied to XQT. These two jumps are

for the normal no-branch return and

the special return when relative-jump

branches are taken. Since these jumps

are to routines within the stepper

program, they must be inserted by a

code-locating routine. I preferred

running this just once at the beginning

of the program.

STEPPER is conventional except forone major departure. After a user

instruction is copied to XQT, it is

examined to see if it calls an address in

the monitor. If so, the instruction is

executed directly instead of being

simulated and stepped through. In the

case of an indirect jump, the indicated

jump address is examined for location.

If it is in the monitor, it is displayed

and the instruction executed.

To use STEPPER, load the program to

be debugged (at Snnnn], enter HOME,

then BRUN STEPPER, AX at any

convenient location. Your program can

be stepped through by entering nnnnS,followed by entering an S for each

successive step. Alternatively, nnrmT

will produce a continuous trace of

successive steps which can be

interrupted by pressing any key and

restarted with T, or shifted to single

steps with S.STEPPER can be tested on STEPPER

DEMO. STEPPER DEMO includes

subroutines, direct jumps and indirect

jumps, both within itself and to the

monitor and hook changing. To run,

BLOAD STEPPER DEMO, enter

HOME, BRUN STEPPER and enter300T. The word "TEST" should be

printed on the bottom screen line, then

the printer activated and "TEST"

printed on paper.

N o t e : M r . P a g e u s e s t h e S - C P R B Y T E E Q U $ F D D A

A s s e m b l e r , p u b l is h ed b y F D E D - C O U T E Q U $ F D E D

S -C S of tw a r e C or p o ra ti on F E 0 0 - B L 1 E Q U $ F E 0 0

F E 7 5 - A 1 P C E Q U $ F E 7 5

* * * * * * * * * * * * * * * * * * * * * * * * * * * * F F 3 A - B E L L E Q U $ F F J A

* S T E P P E R * F F 3 F - R E ST O R E E QU $ F F 3 F* C H E T P A GE * F F 4 A - S A V E E Q U $ F F 4 A

* * * * * * * * * * * * * * * * * * * * * * * * * * * F F A 7 - G E T N U M E Q U $ F F A 7

. OR $ 7 0 00 F F 5 8 - R T R N E Q U $ F F 5 8

. TA $ 80 0 F F B E - T O S U B E Q U $ F F B E

* . T F S T E P P E R F F C 5 - Z M O D 0 E Q U $ F F C 5

0 0 2 2 - '. I E Q U $ 2 2 F F C 7 - Z M O D E E Q U $ F F C 7

0 0 2 F - L E N G T H E Q U $ 2 F F F C C - C H R T B L E QU $ F F C C

0 0 3 3 - P R O M P T E Q U $ 3 3 * - - - - - - - - - - - - - - - - - -

0 0 3 4 - Y S A V E Q U $ 3 4 * IN I T I A L I ZE W IN D O W A R E A S

0 0 3 A - P C L E Q U $ 3 A *

0 0 3 B - P C H E Q U $ 3 B 7 0 0 0 - A 9 0 0 L D A 1 1 0

0 0 3 C - I N D P T R E Q U $ 3 C 7 0 0 2 - 8 5 2 2 S T A '. I

0 0 4 8 - S T A T U S E Q U $ 4 8 7 0 0 4 - 8 D 7 2 0 6 S T A W + 2

0 1 0 0 - S T A C K E Q U $ 1 0 0 7 0 0 7 - A 9 1 4 L D A 1 1 $ 1 4

0 6 6 E - O U T P R T E Q U $ 6 6 E 7 0 0 9 - 8 5 2 3 S T A ' . 1 + 10 6 E F - X Q T E Q U $ 6 E F 7 0 0 B - A 9 1 3 L D A 1 1 $ 1 3

0 6 7 0 - W E Q U $ 6 7 0 7 0 0 D - 8 5 2 5 S T A ' . 1 + 3

0 6 7 4 - T W E Q U $ 6 7 4 7 0 0 F - A 9 1 6 L D A 1 1 $ 1 6

A A 5 3 - H O O K E Q U $ A A 5 3 7 0 1 1 - 8 D 7 0 0 6 S T A W

c 0 0 0 - K B R D E Q U $ C 0 0 0 7 0 1 4 - A 9 1 8 L D A 1 1 $ 1 8

F 8 8 2 - I N S D S1 E Q U $ F 8 8 2 7 0 1 6 - 8 D 7 1 0 6 S T A W + 1

F 8 D 0 - I N S T D S P E QU $ F 8 D 0 7 0 1 9 - A 9 1 7 L D A 1 1 $ 1 7

F 9 4 8 - P R B L N K E Q U $ F 9 4 8 7 0 1 B - 8 D 7 3 0 6 S T A W + 3

F 9 5 4 - P C A D J 2 E Q U $ F 9 5 4 *

F 9 5 6 - P C A D J 3 E Q U $ F 9 5 6 7 0 1 E - A D 5 3 A A L D A H O O K

0 F A D 7 - R E G D S P E Q U $ F A D 7 7 0 2 1 - 8 D 6 E 0 6 S TA O U TP R T

F C 2 2 - V T A B E Q U $ F C 2 2 7 0 2 4 - A D 5 4 A A L D A H OO K+ 1

F D 6 7 - G E T L N Z E Q U $ F D 6 7 7 0 2 7 - 8 D 6 F 0 6 S TA O UT P R T + 1

56 MICRO No. 75· September 1984

Page 59: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 59/76

N BB VC P CN 3A 1T SX

* - - - - - - - - - - - - - - - - - - -* IN IT IA LIZ E X EQ R ET UR NS

*

*RELAYS

70A 4- 50 58 PCN3 A1 BVC PCN3 A270A 6- 50 58 PCN2A1 BVC PCN 2A2

70A 8- 50 D2 STR T1 BVC ST RT

70A A- AD 00 C 0 TRAC E WA KBR D

*STO P ON ANY KE Y

* WAIT FOR NEXT , R EPEAT STEP

70AD- 3 0 1 5 BMI A GIN

70A F- C 6 34 DEC Y S AV

70B1- 20 C 7 FF ENT JSR ZM ODE

70B4- B 8 CLV

70B 5- 50 12 BVC S TE P

o

702A- 20 5 8 FF J SR RTRN702D- B8 C LV

702E- 5 0 07 BVC NB

703 0- 20 4A FF N BRN JSR SAVE

7~3-38 S~

703 4- B8 C LV

*REL AY TO PCN3 LO CATE NBRN

* AND IN SE RT J UM P

703 5- 5 0 6D703 7- B A

703 8- C A

703 9- 18

703 A- BD 00 01

703 D- 69 04

703 F- 8D F3 06

704 2- E 8

704 3- BD 00 01

704 6- 69 00

704 8- 8D F4 06

704 B- A9 4c

704 D- 8D F2 06

705 0- 8D F5 06

705 3- 20 58 FF

705 6- B 87057- 50 0F

7059- 18

705A- A0 01

705C- B1 3 A705E- 20 56 F9

7061- 85 3 A

706 3- 9 8

706 4- 3 8

706 5- B 8

* SE AR CH M ON C HA RS

70B 7- A0 17 MCMD WY #$17

70B 9- 88 C HRS DEY

70BA- 3 0 c0 BMI STRT

* CMP W ITH TAB LE, TRY AGA IN

* F OU ND , P RO CE ED

70BC - D9 CC FF CMP CHRT BL,Y

70BF - D 0 F 8 BNE C HRS

70C1- 20 BE FF JSR TOSU B

70C4 - A4 3 4 A GIN WY YSAV

~C~~ C~*G ET NE XT COMM AND, AD R TO P C

* D IS PL AY IN ST RU CT IO N

* RE SET OU TPUT PO RT70C7- 5 0 C1

70C9- 20 75 FE S TEP

70CC- 20 D0 F870CF- AD 6E 06

70D2- 8D 53 AA

70D5- AD 6F 0670D8- 8D 54 AA

70DB- A2 02

* TR Y M ON IT OR C OM MA ND SD EX

C LC

W A STAC K,XADC # 4

S TA xQ T+ 4

IN X

W A STAC K,X

ADC #0

S TA X QT +5

W A #$4C

S TA X QT +3

S TA xQ T+ 6

JSR RTRN

CLVBVC BR

BRAN CLC

WY #1

WA (PC L),Y

J SR P CA DJ 3

STA PCL

TYA

SE C

*RE LAY TO PCN 2 L OCAT E BRA NCLV *NO P'S T O XEQ A REA

70DD- A9 EA XQ IN

70DF- 9D EF 06

70E 2- C A

70E3- D0 F8

*---------------

707C - D8 S TRT CW

707D- 20 3A FF J SR BELL

7080- A9 2A CO NT WA # $2A

7082- 85 3 3 STA PROMP T

7084- 20 67 FD J SR GETLN Z

7087- 20 C7 FF J SR ZMOD E

708A- 20 A7 FF N XTI J SR GETNU M708D - 8 4 3 4 STY Y SAV

*IS IT STEP ? IS IT T RACE ?

* IS IT < CR> ?

708F- C9 EC

709 1- F0 1E

709 3- C9 ED

709 5- F0 13

7097- C9 C6

7099- D0 1C

709B- 20 C5 FF

709E- 20 00 FE

70A 1- B 8

70A 2- 50 DC

* AND IN SE RT J UM P

7066- 50 3 E

7068- B A BR

706 9- C A

706A- 18706B- B D 00 01

706E- 6 9 04

7070- 8D F6 06

7073 - E 8

7074- BD 00 01

7077- 69 00

7079 - 8D F7 06

BVC NXTI

JSR A 1PCJ SR IN ST DS P

W A O UTPR T

STA H OOK

WA O UTPR T+1

S TA H OO K+ 1

WX #2

WA #$E A

S TA X QT ,X

D EX

B NE X QIN

WX # 0WA (PC L,X)

B NE N OT BR K

WA # $F0

STA HOOK

WA # $FD

S TA H OO K+ 1

J SR IN SD S1

J SR R EG DS P

CLV

B VC S TR Tl

P CN 3A 2 B VC P CN 3A 3P CN 2A 2 B VC P CN 2A 3

NOTBRK WY LENGTH

CM P #$20

B NE T RY JM P

N O, S IM UL A TE

WA (P CL),Y

CMP #$F8

BC S EX1

c

o

o

B VC P CN 2A 1

TSX

DEX

CLCWA STA CK,X

ADC #4

S TA X QT +7

IN X

W A STAC K,X

A DC # 0

S TA X QT +8

*------

* C Opy USE R COMM AND*----------

70E 5- A 2 0070E 7- A 1 3A

70E 9- D 0 17

* SE T S CR EE N O UT PU T

70EB - A9 F0

70ED - 8D 53 A A

70F0- A9 FD70F2- 8D 54 A A

70F5- 20 82 F8

70F8- 20 D7 FA

7 0F B- B 8

*RELAY

70FC- 5 0 AA

70FE- 50 7B7100- 5 0 7B

o

o

o

o

o

o

o

o

o

o

o

No. 75· September 1984

*-------------

* E XA MIN E O PC OD E

C MP # $EC

BEQ ENT

C MP # $ED

B EQ T RA CE

C MP # $C6

BNE MCMD

J SR Z MO D0

JSR BL1

C LV

*7102- A4 2F

71 04- C 9 20

71 06- D0 0A*IT IS JSR

*IS IT IN M ONIT OR?

* YE S , S O E XE CU TE ,

71 08- B 1 3A

710A- C9 F8

71 0C- B 0 71VC CONT

MICRO 5 7

Page 60: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 60/76

7 1 0 E - 9 0 7 3 B C C S J S R1 7 1 9 3 - 4 9 1 4 E O R # $ 1 4

7 1 U l - 5 0 B 2 A G I N 2 B V C A G I N 7 1 9 5 - C 9 0 4 C M F # 4

7 1 1 2 - C 9 4 c T R Y J M F C M F # $ 4 C * S E T U P B R A N C H , R E T U R N T O B R A N 07 1 1 4 - D 0 0 8 B N E T R Y I N D 7 1 9 7 - F 0 0 2 B E Q X Q 2

* I T I S J M P 7 1 9 9 - B 1 3 A X Q 1 L D A ( P C L ) , Y

* I S I T T O M O N I T O R ? 7 1 9 B - 9 9 E F 0 6 X Q 2 S T A X Q T , Y

* Y E S , E X E C U T E N O , S I M U L A T E 7 1 9 E - 8 8 D E Y 07 1 1 6 - B 1 3 A L D A ( P C L) , Y 7 1 9 F - 1 0 F 8 B P L X Q 1

7 1 1 8 - C 9 F 8 C M P # $ F 8 * R E S T O R E U S E R R E G I S T E R S , E X E C U S E R C M D

7 1 1 A - B 0 6 9 B C S E X 2 7 1 A 1 - 2 0 3 F F F J S R R E S T O R E0

7 1 1 C - 9 0 6 9 B C C S J MP 7 1 A 4 - 4 c E F 0 6 J M P X Q T

7 1 1 E - C 9 6 C T R Y I N D C M P # $ 6 C * SI MU LA TE R TI7 1 2 0 - D 0 6 7 B N E T RY R T S 7 1 A 7 - 1 8 S R T I C L C

* IN D I RE C T J UM P 7 1 A 8 - 6 8 P L A 07 1 2 2 - B 1 3 A L D A ( P C L ) , Y 7 1 A 9 - 8 5 4 8 S T A S T A T U S

7 1 2 4 - 8 5 3 D S TA I N D P T R + 1 * SI MU LA TE R TS

7 1 2 6 - : -8 8 D E Y 7 1 A B - 6 8 S R T S P L A

7 1 2 7 - B 1 3 A L D A ( P C L ) , Y 7 1 A C - 8 5 3 A S T A P C L 0

7 1 2 9 - 8 5 3 C S T A I N D PT R 7 1 A E - 6 8 P L A

7 1 2 B - B 1 3 C L D A ( I N D P T R ) , Y 7 1 A F - 8 5 3 B P C N 2 S T A P C H

* I S I T T O M O N I T O R ? S I M U L A T E 7 1 8 1 - 2 0 5 4 F 9 P C N 3 J S R P C A D J 2 07 1 2 D - C 9 F 8 C M F # $ F 8 7 1 8 4 - 8 4 3 B S T Y P C H

7 1 2 F - 9 0 4 5 B C C S I N D 1 7 1 8 6 - : - 1 8 C L C

* 7 1 8 7 - 9 0 1 8 B C C N E W I'

* D I S P L A Y M O N I T O R A D D RE S S * R E L A Y S 0* 7 1 8 9 - 5 0 4 3 U S E R 1 B V C U S E R 4

7 1 3 1 - A D 5 3 A A L D A H O O K 7 1 8 B - 5 0 3 6 U S E R 2 B V C U S E R 37 1 3 4 - 8 D 6 E 0 6 S T A O U T P R T * S I M U L A T E J S R

07 1 3 7 - A D 5 4 A A L D A H O O K + 1 * S I M U L A T E R E T U R N T O S T A C K

7 1 3 A - 8 D 6 F 0 6 S T A O U T P R T + 1 7 1 B D - 1 8 S J S R G L C

7 1 3 D - A 9 F 0 L D A # $ F 0 7 1 8 E - 2 0 5 4 F 9 J SR P CA D J 2

7 1 3 F - 8 D 5 3 A A S T A H O O K 7 1 C 1 - A A T A X 07 1 4 2 - A 9 F D L D A # $ F D 7 1 C 2 - 9 8 T Y A

7 1 4 4 - 8 D 5 4 A A S TA H OO K+ 1 7 1 C 3 - 4 8 P H A

7 1 4 7 - A 9 8 D L D A # $ 8 D 7 1 C 4 - 8 A T X A

7 1 4 9 - 2 0 E D F D J S R C O U T 7 1 C 5 - 4 8 P H A 07 1 4 C - 2 0 4 8 F 9 J SR P RB LN K 7 1 C 6 -: -A 0 0 2 L D Y # 2

7 1 4 F - 2 0 4 8 F 9 J SR P RB LN K * SI MU LA T E J UM P

7 1 5 2 - 2 0 4 8 F 9 J SR P RB LN K 7 1 C 8 - 1 8 S J M P C L C0

7 1 5 5 - A 9 A 4 L D A # $ A 4 * S I M UL A TE I N D IR EC T J U M P

7 1 5 7 - 2 0 E D F D J S R C O U T 7 1 C 9 - B 1 3 A S I N D L D A ( P C L ) , Y

7 1 5 A - B 1 3 C L D A ( I N D P T R ) , Y 7 1 C B - A A T A X7 1 5 C - 2 0 D A F D J SR P RB YT E 7 1 C C - 8 8 D E Y 07 1 5 F - 8 8 D E Y 7 1 C D - B 1 3 A L D A ( P C L ) , Y

7 1 6 0 - B 1 3 c L D A ( I N D P T R ) , Y 7 1 C F - 8 6 3B S T X P C H

7 1 6 2 - 2 0 D A F D J SR P R B YT E 7 1 D 1 - 8 5 3 A N E W P S T A P C L

7 1 6 5 - A D 6 E 0 6 L D A O UT PR T 7 1 D 3 - B 0 F 3 B C S S J M P 0

7 1 6 8 - 8 D 5 3 A A S T A HO O K 7 I D 5 - A D 53 . A A N E W P 2 L D A H O O K

7 1 6 B - A D 6 F 0 6 L D A OU T P R T + 1 7 1 D 8 - 8 D 6 E 0 6 S TA O UT P R T

7 1 6 E - 8 D 5 4 A A S T A H O O K + 1 7 I D B - A D 5 4 A A L D A H OO K+ 1 0* 7 I D E - 8 D 6 F 0 6 S TA O UT P R T+ 1

7 1 7 1 - A 4 2 F L D Y L E N G T H 7 1 E 1 - A 9 F 0 L D A # $ F 0

7 1 7 3 - B 8 C L V 7 1 E 3 - 8 D 5 3 A A S T A H O O K

7 1 7 4 - 5 0 4 3 B V C U S E R 1 7 1 E 6 - : -A 9 F D L D A # $ F D 07 1 7 6 - A 4 2 F S I N D 1 L D Y L E N GT H 7 1 E 8 - 8 D 5 4 A A S TA H OO K+ 1

7 1 7 8 - 3 8 S E C 7 1 E B - 2 0 D 7 F A J S R R E GD SP

7 1 7 9 - B 0 4 E B C S S I N D7 1 E E - B 8 C L V

0* R E L A Y S * R E L A Y T O A G I N

7 1 7 8 - 5 0 3 4 P C N 3 A 3 B V C P C N 3 7 1 E F - 5 0 9 0 B V C A GI N1

7 1 7 D - 5 0 3 0 P C N 2 A 3 B V C P C N 2 7 1 F 1 - 5 0 E 2 N E W I ' l B V C N E W P 2

7 1 7 F - B 0 3 A E X 1 B CS U S E R 2 * - - - - - - ~ - - - - - - - 07 1 8 1 - 5 0 8 D A G I N 1 B V C A G I N 2 * EX E C UT E M ON IT OR R OU TI N E

7 1 8 3 - 9 0 3 8 S J S R 1 B C C S J S R *

7 1 8 5 - B 0 3 2 E X 2 B C S U S E R 1 * I F M O N I T O R S U B R O U T I N E S E T U P R E T U R N0

7 1 8 7 - 9 0 3 F S J M P 1 B C C S J M P * A N D C O N V E R T J S R T O J M P

7 1 8 9 - C 9 6 0 T R Y R T S CM P # $ 6 0 7 1 F 3 - 1 8 U S E R 3 C L C

7 1 8 B - F 0 1 E B E Q S R T S 7 1 F 4 - 2 0 5 4 F 9 J SR P CA D J 2

7 1 8 D - C 9 4 0 C M P # $ 4 0 7 1 F 7 - A A T A X 07 1 8 F - F 0 1 6 B E Q S R T I 7 1 F 8 - 9 8 T Y A

7 1 9 1 - 2 9 1 F A N D # $ 1 F 7 1 F 9 - 4 8 P H A

58 MICRO No. 75 . September 1984

Page 61: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 61/76

7 1F A- 8 A

71 FB - 4 8

7 1F C- A 0 02 LD Y #2* EX E CU T E M O NIT O R R O UT IN E

7 1 F E- A 9 60 US E R 4 L D A # $ 60

7200- 8 D F 2 06 S T A X Q T + 3

7203- B1 3 A . 1 L D A ( P C L ),Y

7205- 99 E F 06 S T A X Q T ,Y

7208- 88 D E Y

7209- 10 F8 B P L . 1

*IF J S R , CO N V E R T T O J M P

720B - C9 20 C MP # $20

720D- D0 06 B N E . 2

720F - A9 4 c L D A # $ 4 C721 1- C8 IN Y

7212- 99 EF 06 ST A X Q T,Y

72 15- A2 03 . 2 L DX # 3*S AV E T RA CE W IN DO W D AT A

7217- B 5 22 S VT L D A W , X

7219 - 9 D 7 4 06 ST A T W ,X

721C - CA D E X

721D - 10 F8 BP L SV T

72 1F- A2 03 LDX # 3

* LO A D U S ER -W IN D OW D A TA

7221- B D 70 06 LD U L D A U W ,X

7224 - 9 5 22 S TA W , X

7226--C A D E X

7227- 10 F8 B P L L D U

7229- 2 0 22 F C J S R V T A B

722C - 2 0 3F F F J S R R E S T O R E

722F- 20 E F 06 J S R X Q T

7232- 2 0 4 A F F J S R S A V E

72 35- A2 03 LDX # 3* SA V E U S ER -W IN D OW D A TA

7237- B 5 22 SV U L D A W , X

723 9- 9 D 7 0 0 6 ST A u w , x723 C- C A D E X

723 D- 10 F8 B P L SV U

723 F- A 2 03 LD X #3* LO A D T R AC E-W IN D OW D A TA

724 1- BD 7 4 06 LD T L D A T W ,X

724 4- 9 5 22 S TA W , X

724 6- C A D E X

724 7- 10 F8 B P L LD T

724 9- A9 4 c LD A # $ 4 C

724 B- 8 D F 2 0 6 S T A X Q T + 3

* RE C OV E R R ET U RN A DD R ES S

724 ~ ~ P U

724 F- 85 3A S T A PC L

725 1- 68 P U

725 2- 85 3 B S T A PC H

725 4- E6 3A INC P C L

725 6--D0 02 B NE .2725 8- E6 3B INC P C H

725 A- A 2 0 0 .2 LD X # 0725 C- B8 C L V

* R E U Y T O N E W P2

725 0- 5 0 92 BVC N E W P 1

o For those who aren't using an S-C Assembler, to the rightare definitions of those commands which are unique to

this assembler. The following are from the 'S-C Macro

Assembler' by Bob Sander-Cederlof, copyright 1981" S-C

o Software Corporation.

1 0 20 * * * ** * * ** * * ** * * ** *1 03 0 .OR $3 001040 .TA $800

1050 .TF S T E P P E R D E M OF D E D - 1060 CO U T . E Q $ F D E D

0006 - 1070 PT R . E Q $ 6

03 00- 20 1 1 03 1080

03 03 - A 9 00 1090

03 05- 8D 5 3 A A 1 100

03 08- A 9 C1 1 1 1 0

03 0A- 8D 5 4 A A 1 12003 0D- 20 1 1 03 1 1 3 0

03 10- 00 1 14 003 11- A 9 8 D 1 1 5 0 T EX T

03 13- 20 ED FD 1 1 6 0

03 16- A 9 D 4 1 170

03 18- 20 44 03 1 180

03 18- A 9 C 5 1 1 9 0

03 1D- 20 47 03 1200

03 20- A 9 D3 1 210

03 22- 20 4F 03 1220

03 25- 20 5 8 F F 1 23 0

03 28- 20 5 4 03 124 0

032B- A2 4 1 1 250

03 2D- A 0 03 1 26 0

03 2F- 8 6 06 1 27003 31 - 8 4 07 1280

03 33- A 0 00 1 29 0

03 35- B 1 06 1 300 PRINT

03 37- F0 07 1 310

033 9- 20 ED F D 1 320

033 C- C 8 1 3 30

033 D- 4c 3 5 03 1 3 40

034 0- 6 0 13 50 D ON E

034 1- D4 8D 00 1 360 W OR D

034 4- 4C E D F D 1 370 T 1

034 7- 6C 4 A 03 1 380 T 2

034 A- 4 C 1 3 90 T 3

034 B- 03 1 400034 c- 4C 3 C F F 1 4 10 T 4

034 F- 6C 52 03 1 420 T 5035 2- ED FD 1 4 30 T 6

035 4- 6C 57 03 1 4 40 T 7

035 7- 58 FF 1 4 50 T 8

.DA DAta'Creates constants or variables in yourprogram ... The value of the expression, as oneor two bytes, is stored at the current loca-tion. If a label is present, it is defined as theaddress where the first byte of data is stored.'

.HS Hex String'Converts a string of hex digits [hhh ... h]to binary, two digits per byte, and storesthem starting at the current location. If a

label is present, it is defined as the addresswhere the first byte is stored.'

.TF Target File'Causes the object code generated to be storedon a binary file, rather than in memory.'

J S R T E XT

L D A #0

S TA $ AA 53L DA # $C 1

S TA $ AA 54J S R T E X T

B R K

L DA # $8 D

J S R C O U T

L DA # $D 4

J S R T 1

L DA # $C 5

J S R T2

L DA # $D 3

J S R T 5

J SR $ FF 58

J S R T7

L DX # WO RD

L DY / WO RD

S T X P T RS TY P TR +1

L D Y # 0L DA ( PT R) ,Y

B EQ D ON E

J SR C OU T

IN Y

JM P P RI NT

R T S

. H S D 48 D0 0

J MP C OU T

JM P ( T 3 ). DA # T4

. DA / T4

J MP $ FF 3C

J M P ( T 6 ). HS E DF D

J M P ( T8 )

. HS 5 8F F

.TA Target Address'Sets the target address at which the object-code will be stored during assembly.'

.OR Origin'Sets the program origin and the target addressto the value of the expression. Program ori-gin is the address at which the object programwill be executed.' ~.

No. 75 . September 1984 MICRO 59

Page 62: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 62/76

The FlJll i Screen CalculatorEasier to use than spread sheets

- - - - - ' - . . .- - - - -astering Your VIC·20

Mastering Your Commodore 64

A Better Way To Learn BASIC

Eight major programs to enjoy

while you are learning

Mastering Your VIC·20

Mastering Your Oornmodore 64

The 8 programs, "run-ready" on disk (C-64) or

tape (VIC-20) and explained in the 160-'192 page

book, each demonstrate important concepts of

BASIC while providing useful, enjoyable software.

Programs include:

• Player - compose songs from your keyboard,

save, load and edit for perfect music

• MicroCalc - display calculation proqr arn that

make even complex operations easy

• Master - a one or two person guessing game

• Clock - character graphics for a digital clock

VIC-20 with tape & book just $19.95

C-64 with disk & book (avail. Sept.) just $19.95

Look for us at the

International Software Show

Toronto, September 20·23

MICROCalc for C·64

This on-screen calculator comes with diskette and

48-page manual offering a wide variety of useful

screens, and a great way to learn BASIC expressions

if you don't already know them.

• Unlimited calculation length & complexity

• Screens can be linked and saved on disk/cassette

• Build a library of customized screens

• Provide formatted printer output

Diskette & 48-page manual just $29.95

For the Freshest Books, Buy Direct!

• No prehandled books with bent corners

• Books come direct to your door

• No time wasted searching store to store

• 24 hours from order receipt to shipment

• No shipping/handling charges

• No sales tax (except 5% MA res.)

• Check, MO, VISA/MC accepted (prepaid only)

The Computerist Bookcart

P.O. Box 6502, Chelmsford, MA 01824

For faster service, phone: 6171256 - 3649.

Page 63: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 63/76

. . . ·. .: : · . > · 0 · . • _ aaA .

Time-Series Forecasting

•eo

Requirements: Apple II, Commodore

64, Atari, or CoCo with Flex

Prophets and pundits since time

immemorial have tried to peer into that

murky and mysterious region of

shifting shadows and dancing dreams

called the future. These seers and

soothsayers have plied their fortune-

tell ing trade using every sort of

contrivance imaginable: everything

from shooting stars and playing cards to

chicken entrails and crystal balls.

Today you can join this elite group

of mystics and Merlins by using the

time-series forecasting program

presented here. It's written in a

'generic BASIC' and runs nicely on a

machine with minimum memory. And

while the forecasts of yesteryear were

often as illusory as a maintenance-free

automobile or a meek and mild

Klingon, the microcomputer

projections can have a sound scientific

basis.

After first explaining what a "time

series" is, we'll show you how to use

by Brian Flynn

V ienna , V irgin ia

•A program 1 : 0 predict the future.

the microcomputer program to predict

future interest rates. We'll describe the

program's forecasting techniques

1. Least-Squares Trend

2. Semi-Averages

3. Percent Changes

4. First Differences, and

5. Past Averages

and give you hints on when to use each.

What's a Time Series?

A time series is a group of observations

on a variable, in chronological order, at

a set frequency. Monthly sales, weekly

income, annual gross national product

and the number of Americans flying to

London every August are examples.

The adjective "time" means that

our observations are tallied at equal

calendar intervals. And the noun

"series" means that we have more

than one data point. Hence, a "time

series" records a variable's past and

time-series forecasting projects its

future using historical observations.

As the sage says, the past is

prologue, or so we hope.

Real-World Example:

Whither Interest Rates?

The future level of interest rates in the

economy concerns most of us,

borrowers and lenders alike. If we're

thinking about financing a new house

or car, for example, and if interest rates

are falling, then delay will save us

dollars. But we're better off buying now

if interest rates are rising.

Suppose the dogs of debt are

muzzled for a change, however, and

that we strut proudly to the teller's

window to lend instead of to borrow.

Cash in hand and nirvana in mind, we

decide to plop down $5K for a money-

market certificate maturing

somewhere between 3 months and 2

112 years. If interest rates are headed

downward, locking in a relatively high

rate now for as long as possible (2 1/2

years) is sound strategy. With rising

interest rates, on the other hand, we're

better off with a shorter maturity.

There's only one catch to this nice

"buy-low sell-high" kind of advice.

How dowe know iffuture interest rates

will rise or fall? To try and find out,

No. 75 . September 1984 61ICRO

Page 64: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 64/76

let's use the time-series forecasting

routine. Our first step is to gather

historical data, with our bountiful

harvest shown in Table 1. This

sequence of numbers qualifies as a time

series: the 0bserva tions are in

chronological order (August 1982 to

April 1984) at a set frequency

Imonthly).

After keying our figures into the

computer, with the program prompting

us at every tum, the microcomputer

indicates that future interest rates can

be predicted using any of these

extrapolation techniques: (I) Least-

Squares Trend, (2) Semi-Averages, (3)

Percent Changes, 1 4 ) First Differences,

and (5) Past AVerages.

We can predict as far into the future

as we care or dare, using one method

after another, until all reasonable

alternatives are exhausted.

We now explain each technique in

detail.

ponding to 1 (the firs t time period),

September 1982 corresponding to 2 (the

second time period), and so on. April

1984 corresponds to 21 since we have

21 months worth of data.

Technically, the microcomputer

estimates our linear equation so that

the sum of squared deviations of our

observations from the line is as small

as possible; hence the term "least

squares" .

Taking a practical example, let's

forecast interest rates in January 1985.

We ask the microcomputer to project

nine months ahead, from May 1984. It

responds with the forecasts of Table 2.

Table 1

Interest Rates on

3-Month Treasury Bills

Year: M onth P ercent

1 982: 8 8.68

9 7.92

10 7.71

11 8.07

12 7.9 4

1983: 1 7.86

2 8.11

3 8.35

4 8.21

5 8.19

6 8.79

7 9.08

8 9.34

9 9.00

10 8.64

11 8.76

12 9.00

1 984: 1 8.90

2 9.09

3 9.52

4 9.69

Least-Squares Trend

In Least-Squares Trend the micro-

computer forecasts by extrapolating an

historically fitted regression line intothe future. As Figure 1 shows, the

technique satisfies an urge that almost

all of us have had: to draw a line

through a plot of points to best reflect

the apparent trend.

The microcomputer estimates the

line using a statistical technique called

"ordinary leas t squares". Our

dependent variable, interest rates, is

regressed on a lone explanatory

variable, "time". Observations on the

latter are generated internally by the

program, with August 1982 corres-

F O R E C A S T S

M E TH OD : L EA ST - S QU AR E S T R E N D

P E R I O D 22 ) = 9.46

P E R I O D 23 ) = 9.53

P E R I O D 24 ) = 9.61

P E R I O D 25 ) = 9.69

P E R I O D 26 ) = 9.77

P E R I O D 27 ) = 9.84

P E R I O D 28 ) = 9.92

P E R I O D 29 ) = 1 0

P E R I O D 3 0 ) = 10.07

=======================:=======

F O R E C A S T S

M E T H O D : S E M I - A V E R A GE S

P E R I O D 22 ) = 9.62P E R I O D 23 )= 9.72

P E R I O D 24 ) = 9.81

P E R I O D 25 ) = 9.9

P E R I O D 26 ) = 9.99

P E R I O D 27 ) = 10.08

P E R I O D 28 ) = 10.18

P E R I O D 29 ) = 10.27

P E R I O D 30 ) = 10.36

===============================

Least-Squares Trend

.j-Month Treasury Bill Rate Versus Time

Percent

10.0

F O R E C A S T S

M E T H O D : P ER CE N T C H A N GE S

4

P E R I O D 22 ) = 9.86

P E R I O D 23 ) = 10.03

P E R I O D 24 ) = 10.21

P E R I O D 25 ) = 10.4

P E R I O D 26 ) = 10.58

P E R I O D 27 ) = 10.77

P E R I O D 28 ) = 10.96

P E R I O D 29 ) = 11.16

P E R I O D 30 ) = 11.36

===============================

95

90

8.5

8.0

7 5

82:8 60 11 12 831 2 3 10 11 12 841 2

Figure 1

62 MICRO No. 75 . September 1984

Page 65: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 65/76

===============================

F O R E C A S T S

===============================

M ET HO D: F IR ST D IF FE RE NC ES

PERIOD 22 ) = 9 . 86

PERIOD 23 ) = 10.03

P E RIO D 24 ) = 10.2

PERIOD 25 ) = 10.37

PERIOD 26 ) = 10.54

PERIOD 27 ) = 10.71

PERIOD 28 ) = 10.88

PERIOD 29 ) = 11.05

PERIOD 3 0 ) = 11.22

===============================

F O R E C A S T S

===============================

M E T H O D : P A S T A V E R A G E S O F 20

PERIOD 22 ) = 9 . 75

PERIOD 23 ) = 9 . 81

PERIOD 24 ) = 9 . 87PERIOD 25 ) = 9 . 9 3

PERIOD 26 ) = 9 . 9 9

P E RIO D 27 ) = 10.05

PERIOD 28 ) = 10.11

PERIOD 29 )= 10.18

PERIOD 30 )= 10.24

===============================

F O R E C A S T S

M E T H O D : P A S T A V E R A G E S O F 20

P E RIO D 22 )= 9 . 74PERIOD 23 ) = 9 . 79

P E RIO D 24 )= 9 . 84

PERIOD 25 )= 9 . 89

PERIOD 26 )= 9 . 9 4

P E RIO D 27 )= 9 . 9 9

PERIOD 28 ) = 10.04

PERIOD 29 ) = 10.09

PERIOD 30 ) = 10.14

A big advantage of Least-Squares

Trend over traditional regression

routines is that we know future values

of the explanatory variable (" time" Iwith absolute certainty. With the latter

technique we don't. Using the rate of

inflation instead of "time" to predict

interest rates, for example, leaves us

the problem of estimating the price

level in January 1985 before we can run

our model.

Semi-Averages

The method of Semi-Averages is

somewhat akin to Least-Squares Trend.

Method of Semi-Averages

Step 1Percent10.0

9.5

90

8.5

. •8.0 . •

7.5

t _I I I I I I I I

8l:8 9 10 II 1283:12 .3 4 6

I I I I I I I I910111284:1234

In the first step the microcomputer divides our time series

into two roughly equal parts, and computes the mean of

each 18.1% and 9.1% respectively.)

PercentStep 2

9.1%1---------------------

No. 75 . September 1984

1. I I I I I I I82:8 9 10 11 12 83: 1 2 3 4

I I I I I I I I

6 7 8 9 10 11 12 841 2 3 4

In the second step the microcomputer fits a line through

the two means. The points on the line represent our

forecasts.

Figure 2

Namely, the microcomputer divides

our time series into two roughly equal

parts and computes the mean of each.

Then it fits a line through the two

points, with values on the line

representing our forecasts. Figure 2

details the process.

MICRO

Percent Changes

The Percent Change routine works as

its name implies. The microcomputer

first computes the percent delta

between the last two values of our time

series: 100'1969 - 9.52)/9.52

63

Page 66: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 66/76

1.79%, or 1.0179 in index form. Then

it applies this factor to future periods.

Hence, the predicted interest rate in

May 1984 is 9.69*1.0179 = 9.86%.

The technique of Percent Changes

is usually best suited to short-term

forecasts, say up to two or three periods

ahead and for cases where observations

are highly correlated from one period to

another. Examples include using

monthly data to forecast next quarter's

Dow Jones Average or foreign tradedefici t.

As a general rule, leave long-term

prognostications to Least-Squares

Trend or to the method of Semi-

Averages. An exception is when you

strongly believe that very recent data

will heavily influence the future. An

example might be a sharp jump in the

inflation rate which in turn fuels the

fear of future price hikes and, hence,

becomes a self-fulfilling prophecy.

First Differences

The First Difference routine works a lot

like its Percent Change colleague.

Namely, the difference instead of

percent change between the last two

values of the time series is used as the

factor to forecast future values.

For our data, this difference is

9.69 - 9.52 = 017. Hence, interest

rate forecasts for May and June using

this technique are 9.86% (9.69 + 0.17)

and 10.03% (9.86 + 0.171,

respecti vel y.

Once again, the method of First

Differences is a short-run forecasting

tool. You might want to compare it to

Percent Changes In making 2 or 3

period forecasts. Your predictions are

probably strongest where the two

methods agree and weakest where they

diverge. The comparison, in other

words, should give you a "warm

fuzzy" or a "rigid frigid", or perhapsboth.

Past Averages

Finally, the Past Average routine

computes Percent Changes and First

Differences using any number of past

values. with you telling the

microcomputer how many.

For example, the mean of the past

two first differences is (9.69 - 9.52)

+ (9.52 - 9.09) all divided by 2, or

0.30. The microcomputer in this case

predicts a May 1984 interest rate of

9.69 + 0.30 = 9.99%.The Past Average procedure is

ideally suited to forecasting situations

where a string or subset of past values

is deemed most important. It ignores

the long-term drift captured by Least-

Squares Trend and the method of Semi-

Averages, and avoids the short-run bias

of Percent Changes and First

Differences.

Summary

A time series is a group of observations

on a variable, in chronological order, at

a set frequency. Your microcomputer

program forecasts future values of a

time series using these extrapolation

techniques: (1) Least-Squares Trend,

(2) Semi-Averages, 1 3 ) Percent

Changes, (4) First Differences and (5)

Past Averages.

All five methods suggest thatinterest rates will rise in the near

future. And all five invoke the adage

"The past is prologue." If it isn't, then

perhaps we ought to have Madame

Zelna read our palms I

Listing Notes:

Brian Flynn provided the original

programs for the Apple II. Mike Rowe

has modified these so that they can

work on the Commodore 64, Atari and

the CoCo (with Flex), as well as the

Apple. The Listing 1 contains the

"generic" code. This will not work

without the system specific

subroutines provided below. Listings 2

through 5 provide the required

subroutines for the Apple, Commodore

64, Atari and CoCo (with Flexl

respectively. These additional routines

must be added to Listing 1 in order for

the program to work on any

microcomputer.

listing 1

1 0 R EM T I ME -S ER IE S F OR E CA S T I N G2 0 R E M B Y B R I A N F L Y N N

3 0 R E M M A Y 1 9 8 4

3 2 R E M M O D I F I E D F O R C O M M O D O R E 6 4 , A T A R I A N D F L E X

3 4 R E M B Y M I K E R O W E , J U L Y 1 9 8 4

4 0 R E M I N IT I A L I Z E

5 0 G O S U B 1 0 0 0

6 0 R E M E N T E R D A T A

7 0 G O S U B 3 0 0 0

8 0 R E M E D I T D A T A

9 0 G O S U B 3 5 0 0

1 0 0 R E M C H O O S E M E T H O D

1 1 0 G O S U B 5 0 0 0

1 2 0 R E M F O R E C A S T

1 3 0 I F C H < > 6 T H E N G O S U B 5 5 0 0 : G O T O 1 1 0

1 4 0 E N D* * * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * ** * * * * * * * * * * * *I N SE R T S U B R O U T I N E S F O R Y O U R M I C R O C O M P U T E R H E R E

* * * * * * * * * * * * * * ** * * * * * * * * * * * * * * * ** * * * * * * * * * * * * *1 00 0 R E M I NI TI A I Z E

1 0 1 0 R E M T I T L E

1 0 1 5 D I M C $ ( 6 )

1 0 2 0 G O S U B 1 5 0 0

1 03 0 R EM I NS TR U CT I ON S

1 0 4 0 G O S U B 2 0 0 0

1 0 5 0 R E M C H O I C E S

1 0 6 0 G O S U B 2 5 0 0

1 07 0 R E T UR N

1 5 0 0 R E M T I T L E

1 5 1 0 G O S U B 3 0 01 5 2 0 V T ~ 1 0 : H T ~ 1 5 : G O S U B 4 0 0 : P R I N T " T I M E -S E RI E S"

1 5 3 0 V T ~ l 1 : H T ~ 1 5 : G O S U B 4 0 0 : P R I N T " F O R E CA S T I N G"

1 5 4 0 F O R D ~ 1 T O 1 0 0 0 : N E X T D

1 5 5 0 R E T UR N

2 00 0 R E M I N S T R UC TI ON S

2 0 1 0 R E M M A XI M U M N UM B E R O F O B S E R V A TI O N S

2 0 2 0 D A T A 1 5 0

2 0 3 0 R E A D M N

2 0 4 0 D I M Y ( M N )

2 05 0 R E M I N S TR U C TI ON S

2 0 6 0 G O S U B 3 0 0

2 0 7 0 P R I N T " T H I S P R O G R A M F O R E C A S T S F U T U R E V A L U E S "

2 0 8 0 P R I N T " O F A T I M E S E R I E S U S I N G A H O S T O F T R E N D - "

2 09 0 P R I N T " A N A L YS IS T E C H N I Q UE S . "

2 1 00 P R I N T2 1 1 0 P R I N T " T H E M A X I M U M N U M B E R O F O B S E R V A T I O N S "

2 1 2 0 P R I N T " A L L O W E D I S " ;M N ; " . "

2 13 0 P RI N T

2 1 4 0 P R I N T " C H A N G E L I N E 2 0 2 0 F O R A D I F F E R E N T L I M I T . "

2 1 5 0 V T ~ 2 2 : H T ~ 1 4 : G O S U B 4 0 0 :

P R I N T " P R E S S A N Y K E Y " ;

2 1 6 0 G O S U B 6 0 0

2 17 0 R E T U R N

2 5 0 0 R E M C H O I C E S

2 5 10 D A T A L E A S T -S QU A R E S T RE N D , S E M I -A VE R A GE S ,

P E R C E N T C HA N G E S

2 5 2 0 D A T A F I R S T D I F F E R E N C E S , P A S T A V E R A G E S , N O N E

64 MICRO No. 75 . September 1984

Page 67: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 67/76

2 5 3 0 F O R I = 1 T O 6

2 5 4 0 R E A D C $ ( I )

2 5 5 0 N E X T I

2 5 60 R E T UR N

3 0 0 0 R E M E N T E R D A T A

3 0 1 0 G O S U B 3 0 0

3 0 2 0 P R I N T " P L E A S E E N T E R O B S E R V A T I O N S O N Y O U R T I M E "

3 0 3 0 P RI N T " S E RI E S. H I T ' R E TU R N ' 1 J H E N T H R OU G H . "

3 0 4 0 N = M N

3 0 5 0 B K $ = "

3 0 6 0 F O R I = 1 T O M N

3 0 7 0 V T = 6 : H T = l : G O S U B 4 0 0

3 0 7 5 P R I N T " P E R I O D #( " ; 1 ; " ) = " ;

3 0 8 0 G O S U B 7 0 0

3 0 9 0 I F X X $ = ' ' ' ' H E N N = 1 - 1 : I = M N : G O T O 3 1 2 0

3 1 0 0 I F X X $ < > "" T H E N Y ( I ) = V A L ( X X $ )

3 1 1 0 V T = 6 : H T = 1 8 : G O S U B 4 0 0 : P R I N T B K $

3 1 2 0 N E X T I

3 1 3 0 R E M C H E C K F O R E N O U G H D A T A

3 1 4 0 I F N > 2 T H E N R E T U R N

3 1 50 V T= 21 : HT =1 :G OS UB 4 0 0

3 1 6 0 P R I N T " S O R R Y , 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 ! " :

G O S U B 8 0 0 : G O T O 3 0 4 0

3 5 0 0 R E M E D I T D A T A

3 5 1 0 F O R L = 0 T O I N T ( ( N - 1 ) / 1 0 )

3 5 2 0 R E M D I S P L A Y D A T A

3 5 3 0 G O S U B 4 0 0 0

3 5 4 0 R E M C O R R E C T D A T A

3 5 5 0 G O S U B 4 5 0 0

3 5 6 0 N E X T L

3 5 70 R E T UR N

4 0 0 0 R E M D I S P L A Y D A T A

4 0 1 0 G O S U B 3 0 0

4 0 2 0 P R I N T " T H E S E A R E V A L U E S O F Y O U R T I M E S E R I E S : "

4 0 3 0 F O R J = 1 T O 1 0

4 0 4 0 M = J + L * 1 0

4 0 5 0 I F M > N T H E N 4 0 6 0

4 0 5 5 V T = J + 3 : H T = l : G O S U B 4 0 0 :

P R I N T " P E R I O D ( " ; M ; " ) " ; Y ( M )

4 0 6 0 N E X T J

4 0 70 R E T UR N

4 5 0 0 R E M C O R R E C T D A T A

4 5 1 0 V T = 1 6 : H T = l : G O S U B 4 0 0 :

P R I N T " CO RR E C TI ON S ( Y I N ) " ;

4 5 2 0 G O S U B 8 0 0 : G O S U B 6 0 0

4 5 3 0 I F X X $ = " N " T H E N 4 6 6 0

4 5 4 0 I F X X $ < > " Y " T H E N 4 5 2 0

4 5 5 0 V T = 1 8 : H T = l : G O S U B 4 0 0 :

P R I N T " W H A T I S T H E N U M B E R O F T H E D A T U M T O "

4 5 6 0 V T = 1 9 : H T = 1 6 : G O S U B 4 0 0 : P R I N T B K $ : G O S U B 8 0 0

4 5 6 5 V T = 1 9 : H T = l : G O S U B 4 0 0

4 5 7 0 P R I N T " B E C O R R E C T E D ? " ; : G O S U B 7 0 0

4 5 9 0 Q = V A L ( X X $ )

4 6 0 0 I F Q > = ( 1 + L * 1 0 ) O R Q < = N O R Q < = ( 1 0 + L * 1 0 )

T H E N 4 6 1 0

4 6 0 5 V T =2 1: HT =1 : GO SU B 4 004 6 0 6 P R I N T " O U T S I D E B O U N D S S H O W N . P L E A S E T R Y A G A I N . " :

G O T O 4 5 6 0

4 6 1 0 V T = 2 3 : H T = l : G O S U B 4 0 0 : G O S U B 8 0 0

4 6 2 0 P R I N T " N E W V A L U E = " ; : G O S U B 7 0 0

4 6 4 0 Y ( Q ) = V A L ( X X $ )

4 6 5 0 G O S U B 4 0 0 0 : G O T O 4 5 1 0

4 66 0 R E T U RN

5 0 0 0 R E M C H O O S E M E T H O D

5 0 1 0 G O S U B 3 0 0

5 0 2 0 P R I N T " F U T U R E V A L U E S O F Y O U R T I M E S E R I E S A R E "

5 0 3 0 P R I N T " P R O J E C T E D U S I N G A N Y O F T H E S E M E T H O D S : "

5 0 4 0 F O R I = 1 T O 6

5 0 5 0 V T = 2 * I + 3 : H T = 1 0 : G O S U B 4 0 0 : P R I N T I ; " . " ; C $ ( I )

5 0 6 0 N E X T I

5 0 7 0 V T = 1 9 : H T = 1 0 : G O S U B 4 0 0 :

P R I N T " Y O U R C H O I C E = ? " ;

5 0 8 0 G O S U B 8 0 0 : G O S U B 6 0 0

5 0 9 0 C H = V A L ( X X $ )

5 1 0 0 I F C H < 1 O R C H > 6 T H E N 5 0 8 0

5 1 10 R E T U R N

5 5 0 0 R E M M A KE P RO J E C T I O N S

5 5 1 0 R E M N U M B E R O F F U T U R E P E R I O D S

5 5 2 0 G O S U B 6 0 0 0

5 5 30 R E M P RO JE CT IO NS

5 5 4 0 G O S U B 3 0 0

5 5 5 0 I F C H < > 5 T H E N V T = 1 2 : H T = 1 3 : G O S U B 4 0 0 :

P R IN T " F O R EC A S T I N G . . . " ;

5 56 0 O N C H G OS UB 6 50 0, 70 00 ,7 50 0, 80 00 ,8 50 0

5 5 7 0 R E M D I S P LA Y

5 5 8 0 G O S U B 1 1 5 0 0

5 59 0 R E T UR N

6 0 0 0 R E M N U M B E R O F F U T U R E P E R I O D S

6 0 1 0 G O S U B 3 0 0

6 0 2 0 P R I N T " T H E L A S T P E R I O D O F Y O U R T I M E S E R I E S I S "

6 0 3 0 P R I N T " N U M B E R " ; N ; " . "

6 0 4 0 P RI N T

6 0 5 0 P R I N T " H O W M A N Y P E R I O D S I N T O T H E F U T U R E D O Y O U "

6 0 6 0 V T = 5 : H T = 2 0 : G O S U B 4 0 0 : P R I N T B K $ ; : G O S U B 8 0 0 :

V T = 5 : H T = l : G O S U B 4 0 0

6 0 7 0 P R I N T ' ' W ' A N TT O F O R E C A S T ? " ; : G O S U B 7 0 0

6 0 8 0 N F = V A L ( X X $ )

6 0 9 0 I F N F < 1 T H E N 6 0 6 0

6 1 0 0 R E M C H E C K F O R E N O U G H M E M O R Y

6 1 1 0 T = N + N F : I F T < = M N T H E N R E T U R N

6 1 2 0 V T = 2 2 : H T = l : G O S U B 4 0 0

6 1 2 5 P R I N T " S O R R Y , O N L Y " ; M N - N ;

" M O R E P E R I O D S A L L O W E D . " ; : G O T O 6 0 6 0

6 13 0 R E T U RN

6 5 0 0 R E M L E A S T - S Q U A R E S T R E N D

6 5 1 0 R E M K E Y S U M S

6 5 2 0 S X = 0 : S Y = 0 : x Q = 0 : Y Q = 0 : C P = 0

6 5 3 0 F O R I = 1 T O N

6 5 4 0 S X = S X + I

6 5 5 0 S Y = S Y + Y ( I )

6 5 6 0 x Q = X Q + I * I

6 5 7 0 Y Q = Y Q + Y ( I ) t 2

6 5 8 0 C P = C P + Y ( I ) * I

6 5 9 0 N E X T I

6 6 0 0 R E M A & B

6 6 1 0 B = ( N * C P - S X * S Y ) / ( N * X Q - S X * S X )

6 6 2 0 A = ( S Y - B * S X ) / N

6 6 3 0 R E M F O R EC A S T S

6 6 4 0 F O R I = N + 1 T O T

6 6 5 0 Y ( I ) = A + B * I

6 6 6 0 N E X T I

6 67 0 R E T U RN

7 0 0 0 R E M M E TH O D O F S E M I - A VE RA GE S

7 0 1 0 R E M N U M B E R O F P O I N T S I N E A C H G R O U P7 0 2 0 G 1 = I N T ( N / 2 )

7 0 3 0 G 2 = N - G 1

7 0 4 0 R E M G R O U P M E A N S

7 0 5 0 Y 1 = 0 : X 1 = 0

7 0 6 0 F O R I = 1 T O G 1

7 0 7 0 Y 1 = Y 1 + Y ( I )

7 0 8 0 X l = X 1 + 1

7 0 9 0 N E X T I

7 1 0 0 Y 1 = Y 1 / G 1 : X 1 = X 1 / G 1

7 1 1 0 R E M M E A N S O F S E C O N D G R O U P

7 1 2 0 Y 2 = 0 : X 2 = 0

7 1 3 0 F O R I = G 1 + 1 T O N

e

o

o

o

o

No. 75 . September 1984 65ICRO

Page 68: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 68/76

7 1 4 0 Y 2 = Y 2 + Y ( I )

7 1 5 0 X 2 = X 2 + 1

7 1 6 0 N E X T I

7 1 7 0 Y 2 = Y 2 / G 2 : X 2 = X 2 / G 2

7 1 8 0 B = ( Y 2- Y 1 )/ ( X 2- X 1 )

7 19 0 R E M Y -I NT E R CE P T

7 2 0 0 A = Y 2 - B * X 2

7 2 1 0 R EM F O RE CA ST S

7 2 2 0 F O R I = N + 1 T O T

7 2 3 0 Y ( I ) = A + B * I

7 2 4 0 N E X T I

7 25 0 R ET UR N

7 5 0 0 R E M P E R C E N T C H A N G E

7 5 1 0 F O R I = N + 1 T O T

7 52 0 Y (I ) = Y (I -1 )* Y( I- 1) /Y (I -2 )

7 5 3 0 N E X T I

7 54 0 R ET UR N

8 0 0 0 R E M F I R S T D I F F E R E NC E

8 0 1 0 F O R I = N + 1 T O T

8 02 0 Y (I ) = 2 *Y (I -1 )- Y( I- 2)

8 0 3 0 N E X T I

8 04 0 R ET UR N

8 5 0 0 R E M P A S T A V E R A G E

8 5 1 0 P R I N T " W O U L D Y O U L I K E T O U S E A N A V E R A G E O F "

8 5 2 0 P R I N T " P A S T : "

8 5 3 0 V T = 4 : H T = 1 0 : G O S U B 4 0 0 : P R I N T "1. % C H A N G E S "

8 5 4 0 V T = 6 : H T = 1 0 : G O S U B 4 0 0 :

P R I N T " 2 . F I R ST D IF F E R E NC ES "

8 5 5 0 V T = 8 : H T = 1 0 : G O S U B 4 0 0 :

P R I N T " 3 . A C T U A L V A LU E S "

8 5 6 0 V T = 1 2 : H T = 1 0 : G O S U B 4 0 0 : P R I N T " C H O I C E =

8 5 7 0 G O S U B 8 0 0 : G O S U B 6 0 0

8 5 8 0 A V = V A L ( X X $ )

8 5 9 0 I F A V < 1 O R A V > 3 T H E N 8 5 7 0

8 6 0 0 I F A V = 1 T H E N T $ = " P E R C E N T C H A N G E S "

8 6 1 0 I F A V = 2 T H E N T $ = " F I R S T D I F F E R E N C E S "

8 6 2 0 O N A V G O S U B 9 0 0 0 , 9 0 0 0 , 9 5 0 0

8 6 3 0 G O S U B 3 0 0

8 6 4 0 V T = 1 2 : H T = 1 3 : G O S U B 4 0 0 :

P R I N T " F O R E CA S T I N G . . . "

8 6 5 0 O N A V G O S U B 1 0 0 0 0, 1 0 50 0 , 11 0 0 0

8 66 0 R E T UR N

9 0 0 0 R E M % C HA NG E S O R F I RS T D IF FE RE N C E S

9 0 1 0 V T = 1 5 : H T = l : G O S U B 4 0 0 :

P R I N T " H O W M A N Y P A S T " j T $

9 0 2 0 V T = 1 6 : H T = 2 2 : G O S U B 4 0 0 : P R I N T B K $ : G O S U B 8 0 0

9 0 3 0 V T = 1 6 : H T = l : P R I N T " D O Y O U W A N T T O U S E ? "j :

G O S U B 7 0 0

9 0 4 0 P P = V A L ( X X $ )

9 0 5 0 I F P P < 1 T H E N 9 0 2 0

9 0 6 0 I F P P < N T H E N R E T U R N

9 0 7 0 V T = 2 2 : H T = l : G O S U B 4 0 0

9 0 8 0 P R I N T " S O R R Y , O N L Y " jN -1 j" A R E A V A I L A B LE " :

G O T O 9 02 0

9 5 0 0 R E M A C T U A L V A L U E S

9 5 1 0 V T = 1 5 : H T = l : G O S U B 4 0 0 :

P R I N T " H O W M A N Y P A S T A C T U A L V A L U E S W O U W "

9 5 2 0 V T = 1 6 : H T = 1 9 : G O S U B 4 0 0 : P R I N T B K $ : G O S t B 8 0 0

9 5 3 0 V T = 1 6 : H T = l : G O S U B 4 0 0 :

P R I N T " Y O U L I K E T O U S E ? " j : G O S U B 7 0 0

9 5 4 0 P P = V A L ( X X $ )

9 5 5 0 I F P P < 1 T H E N 9 5 2 0

9 5 6 0 I F P P < = N T H E N R E T U R N

( ) 9 5 7 0 V T = 2 2 : H T = l : G O S U B 4 0 0

9 5 8 0 P R I N T " S O R R Y , O N L Y " jN j" A R E A V A I L A B LE " :

G O T O 9 52 0

1 0 0 0 0 R E M P E R C E N T C H A N G E S

( ) 1 0 0 1 0 R E M P A S T A V E R A G E

1 0 0 2 0 P C = 0

II.,

1 0 0 3 0 F O R I = N T O N - P P + 1 S T E P - 1

1 0 0 4 0 P C = P C + Y( I ) /y ( I - 1)

1 0 0 5 0 N E X T I

1 0 0 6 0 P C = P C / P P

1 0 0 7 0 R EM F O R EC A ST S

1 0 0 8 0 F O R I = N + 1 T O T

1 0 0 9 0 Y ( I ) = Y ( I - 1 ) * P C

1 0 1 0 0 N E X T I

1 01 10 R E T UR N

1 0 5 0 0 R EM F I R ST D IF F ER E N C E S

1 0 5 1 0 R E M P A S T A V E RA G E

1 0 5 2 0 F D = 0

1 0 5 3 0 F O R I = N T O N - P P + 1 S T E P - 1

1 0 5 4 0 F D = F D +Y (I ) - Y( I - 1 )

1 0 5 5 0 N E X T I

1 0 5 6 0 F D = F D / P P

1 0 5 7 0 R EM F O R EC A ST S

1 0 5 8 0 F O R I = N + 1 T O T

1 0 5 9 0 Y ( I ) = Y ( I - 1 ) + F D

1 0 6 0 0 N E X T I

1 06 10 R E T UR N

1 1 0 0 0 R E M A C T U A L V A L U E S

1 1 0 1 0 R E M P A S T A V E RA G E

1 1 0 2 0 A C = 0

1 1 0 3 0 F O R I = N T O N - P P + 1 S T E P - 1

1 1 0 4 0 A C = A C + Y ( I )

1 1 0 5 0 N E X T I

1 1 0 6 0 A C = A C / P P

1 1 0 7 0 R EM F O R E CA ST S

1 1 0 8 0 F O R I = N + 1 T O T

1 1 0 9 0 y(I) = A C

1 1 1 0 0 N E X T I

1 11 10 R E T UR N

1 1 5 0 0 R EM D IS PL A Y

1 1 5 1 0 F O R L = 0 T O I N T ( ( N F - 1 ) / 1 0 )

1 15 2 0 R E M H E A D IN G

1 1 5 3 0 G O S U B 1 2 0 0 0

1 1 5 4 0 R E M B O D Y

1 1 5 5 0 G O S U B 1 3 0 0 0

1 1 5 6 0 N E X T L

1 15 70 R ET UR N

1 2 0 0 0 R E M H E A D IN G

1 2 0 1 0 G O S U B 3 0 0

1 2 0 2 0 F $ = " = = = == = == = = = == = == = = = == = == = = = == = = = == = == = = "

1 2 0 3 0 P R I N T F $

1 2 0 4 0 V T = 2 : H T = 1 6 : G O S U B 4 0 0 : P R I N T " F O R E CA S T S "

1 2 0 5 0 P R I N T F $

1 2 0 6 0 V T = 5 : H T = l : G O S U B 4 0 0 : P R I N T " M E T H O D : " j C $ ( C H ) j

1 2 0 7 0 I F C H = 5 T H E N G O S U B 1 2 5 0 0

1 20 80 R ET UR N

1 2 5 0 0 R E M P A S T A V E R A G E

1 2 5 1 0 P R I N T " O F " j P P

1 2 5 2 0 V T = 6 : H T = 9 : G O S U B 4 0 0

1 2 5 3 0 I F A V = 1 T H E N P R I N T ,, % C H A N G E S "

1 2 5 4 0 I F A V = 2 T H E N P R I N T " F I R S T D I F F E R E N C E S "

1 2 5 5 0 I F A V = 3 T H E N P R I N T " A C T U A L V A L U E S "

1 25 60 R E T UR N

1 3 0 0 0 R E M B O D Y

1 3 0 1 0 F O R J = 1 T O 1 0

1 3 0 2 0 M = J + L * 1 0 + N

1 3 0 3 0 I F M > T T H E N 1 3 0 4 0

1 3 0 3 5 V T = J + 7 : H T = l : G O S U B 4 0 0 :

P R I N T " P E R I O D ( " j M j " ) = " j Y ( M )

1 3 0 4 0 N E X T J

1 3 0 5 0 V T = 2 1 : H T = l : G O S U B 4 0 0 : P R I N T F $

1 3 0 6 0 V T = 2 2 : H T = 1 4 : G O S U B 4 0 0 :

P R I N T " P R E S S A N Y K E Y " j

1 3 0 7 0 G O S U B 6 0 0

1 30 80 R ET UR N

6 6 MICRO No. 75 . September 1984

Page 69: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 69/76

Subroutines

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 * * C L E A R D I S P L A Y * *3 (1 1 (1 1P R IN T C H R$ ( 1 1) ; CH R $ ( 27 ) ; " X" ; C HR $ ( 24 ) ; : R ET UR N

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

4 ( 11 ( 11I F V T > (I I T H E N P R I N T C H R $ ( 1 1 ) ; :

F O R 1 1 = 1 T O V T : P R I N T : N E X T I I

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

4 2( 11 R ET UR N

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

5 (1 1( 1 1O S UB 4 (1 1( 1 1:R IN T S PC (S P ); : R ET UR N

5 9 9 R E M * * G E T C H A R A C T E R R O U T I N E * *

6 ( 1 1 ( 1 1I N P U T X X $ : I F X X $ = " X " T H E N X X $ = " "

6 1( 11 R E TU RN

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

7 (1 1( 11 O T O 6 (1 1( 11

7 9 9 R E M * * M A K E S O U N D ( O P T I O N A L ) * *

8 ( 1 1 ( 1 1 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 A

8 ( 1 1 1 R E M S O U N D I F Y O U S O D E S I R E !!

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

2 ( 1 1 ( 1 1E 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 * * H O M E A N D C L E A R D I S P L A Y * *

3 ( 1 1 ( 1 1R I N T " [ C L E AR } "i : R E T U R N

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

4 ( 1 1 ( 1 1R I N T " { H O M E } " ;

4 1 ( 1 1 F O R X X = 1 T O V T : P R I N T : N E X T X X

4 2( 11 IF H T> (I I T H E N P R I N T T A B ( H T ) ;

4 3 ( 1 1 R E T U R N

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

5 ( 1 1 ( 1 1O S U B 4 ( 1 1 ( 1 1 :R I N T S P C ( S P ) ; : R E TU R N

5 9 9 R E M * * G E T S U B R O U T I N E * *

6 ( 1 1 ( 1 1X $ = " "

6 1 ( 1 1G E T X X $ : I F X X $ = " " T H E N 6 1 ( 1 1

6 2 ( 1 1 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 * *

7 ( 1 1 ( 1 1R IN T [ SP AC E 1( 1 1, B AC K SP A CE 1( 11 }; : I NP UT X X$ : R E TU R N

7 9 9 R E M * * M A K E S O U N D ( O P T I O N A L ) * *

8 ( 1 1 ( 1 1E T U R N : R E M A D D C O D E T O M A K E A

8 ( 1 1 1R E M S O U N D I F Y O U S O D E S I R E I!!

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

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

2 ( 1 1 ( 1 1 E M A P P L E I I S U B R O U T I N E S

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

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

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

4 ( 1 l ( l lI F V T > 0 T H E N V T A B ( V T )

4 1 ( 1 1 I F H T > ( 1 1T H E N H T A B ( H T )

4 2 0 r E T U R N

R E M * * 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 * *

G O SU B 4 ( 11 ( 11 :R I NT S P C ( S P ) i : R E T U R N

5 9 9 R E M * * G E T S U B R O U T I N E * *

6 ( 1 1 ( 1 1 ET X X $ : R E TU R N

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

7 (1 l( l lI NP UT X X $: R ET U RN

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

8 ( 1 1 ( 1 1 R I N T CHR$(7) j : R E T U R N

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

* * * A T A R I V E R S I O N * * *

2 ( 1 1 ( 1 1E M A T A R I S U B R O U T I N E S

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

3 ( 1 1 ( 1 1R I N T C H R $ ( 1 2 5 ) ; :R E TU R N

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

4 ( 1 1 ( 1 1O SI TI ON H T, VT :R ET UR N

4 9 9 R E M * * 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 * *

5 ( 1 1 ( 1 1O S U B 4 ( 1 1 ( 1 1

5 1 ( 1 1F O R 1 = 1 T O S P : P R I N T C H R $ ( 3 2 ) : N E X T I : R E T U R N

5 9 9 R E M * * G E T S U B R O U T I N E * *

6 ( 1 1 ( 1 1E T # 1 ,X : XX $ =C H R$ ( X) : RE T UR N

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

7 ( 1 1 ( 1 1N PU T X X $ : R E T U R N

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

8 ( 1 1 ( 1 1E T U R N

8 1 ( 1 1R E M A D D Y O U O W N S O U N D I F D E S I R E D

* * * T H E N E X T T I l 0 L I N E S M U S T B E A D D E D * * *

1 ( 1 1 1 5 D I M B K $ ( 1 ( 1 1 ) , X X $ ( 1 ( 1 1), T $ ( 2 ( 1 1 ), F $ ( 4 ( 1 1 )

1 (1 11 6O PE N # 1, 4, (1 1, ''1(:''

* * * L I N E 1 ( 1 1 6 ( 1 1N D L I N ES 2 5 ( 1 1 ( 1 1O 2 5 6 ( 1 1 MU S T B E D E LE T E D. ( )

* ** R E PL A CE L I N E S 5 ( 1 1 5 ( 1 1N D 1 2 ( 1 1 6 ( 1 1S F O L L O W S:

5 ( 1 1 5( 1 1T = 2 * I+ 3 : H T= 1 ( 11 : G O SU B 4 ( 1 1( 1 1 : PR I N TI j " .

G OS UB 1 4( 11 (1 1( 11

fl••,.

1 4 ( 1 1 ( 1 1 ( 1 1N I G O TO 1 4 (1 1 1( 1 1, 1 4( 1 12 ( 11 , 14 ( 11 3 (1 1 ,1 4 (1 1 4( 1 1, 1 4( 1 15 ( 11 , 14 ( 1l 6 (1 1

1 4 ( 1 1( 1 1 5N C H G O T O 1 4 ( 1 11 ( 1 1, 1 4 ( 11 2 ( 11 , 1 4 (1 1 3 (1 1 , 1 4( 1 1 4( 1 1 , 14 ( 1 15 ( 1 1 ,1 4 ( 11 6 ( 1 1

1 4( 11 1 (1 1R IN T " L EA ST -5 QU A RE S T RE ND "j : RE TU R N 0

1 4( 11 2( 11R IN T " SE MI -A VE RA GE S" ; : RE TU RN

1 4( 11 3( 11R IN T ' 'P ER CE NT C HA NG ES " ; : R ET UR N

1 4( 11 4 (1 1R IN T " FI RS T D IF F ER E NC E S" ; : RE TU RN 01 4( 11 5 (1 1R IN T " P AS T A VE RA GE S" ;: R E TU R N

1 4 ( 1 16 ( 1 1R I N T ' ' N O N E '' ; :R E T U RN

o

No. 75 . September 1984 67ICRO

1 2( 11 6( 11T =5 :H T= 1: GO SU B 4 (1 1( 11 :P RI N T' 'M ET HO D: " ;:

G OS UB 1 4( 11 ( 11 5

* * * A D D T H E F O L L O W I N G S U B R O U T I N E

Page 70: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 70/76

Title: The Apple Ilc BookAuthor: Bill O'BrienPrice: $12.95Publisher: Bantam Books

Title: Mastering YourAtari Through Eight BASIC ProjectsAuthor: the staff of MICRO magazine, Tom Marshall ed.Price: $19.95, disk includedPublisher: Prentice-Hall

Using a 'learning-by-doing' approach the reader is

quickly taught how to write, modify, and expand his ownprograms.A diskette is included which contains complete runningprograms to begin with. The eight projects include MicroCalc, a miniature spreadsheet; Master, a guessing game;Atari Clock; Word Detective; Atari Player, a musicprogram; Breakup, an exciting game, Sorting, sorts graphicbars and telephone directory; Programmable Characters,add extra plotting resolution while retaining most normalcharacters in the Atari character set. Each project isdesigned to teach the reader a specific aspect ofprogramming string manipulation, BASICfunctions, random numbers and flags, ON ... GOSUB,character graphics, animation, sorting methods, plusmany more. There are listings for all the programs, clear

operating instructions, examples and figures. Eachprogramming element is explained with clarity and relatedto the project the reader is working on. This book presentslearning and mastery with hands-on experience and fun.This is the second in a series of 'Mastering' books, the firstwas for the Vic-20, the next is for the Commodore 64.

Level: Beginner to intermediate.

Title: Getting On-LineAuthor: M. David StonePrice: $14.95Publisher: Prentice-Hall, Inc.

The field of telecommunications is constantly growingand at a startling rate. Finding out how, what and where isa time consuming and often confusing task. It is the pur-pose of this book to help both the novice and old-hand atsorting out what they need, where to get it, and how to useit. The first six chapters explain what you need before youactually go on-line. Chapter 1 Information Util ities - alook at what is available and where it came from, ex-amines kinds of information utilities and data bases.Chapter 2 Hardware Utilities - covers dumb terminals,smart terminals and computers as terminals. Chapter 3Hardware II - deals with modems, baud rate, signalingstandards, connecting a modem, direct connect vs.acoustical connect modems and choosing a modem.Chapter 4 Software Part I - a look at available features,

computers as dumb and smart terminals, smart terminalprograms; basic features and additional capabilities.Chapter 5 Software Part II - the nitty gritty, RS-232,short reviews and helpful hints regarding some popularmicros, CP/M computers, dual processor machines andmodems. Chapter 7 Search Strategy deals with how to goabout organizing your search for information, with tipsthat can save you money and time. The rest of the bookconsists of a catalog of information and an index, Thecatalog is of the various utilities (Dow Jones, The Source,etc.), and free services (Public Access Bulletin Boards).

Level: Beginner to advanced.

Bantam was selected by Apple to be among those who

introduced the IIc. Providing information that is useful tonovices and advanced users, it includes data not found inthe owner's manual. Compatability, configuration, DOS3.3 and ProDOS are all covered. The addition ofperipherals features mice, touchpads, graphics tablets, andthe new 'flat screen.' BASIC (Applesoft) is explained in asmuch as one can in three chapters. Graphics is also touch-ed upon. Telecommunications - i.e. the connections ofmodems, bulletin boards, etc. are dealt with in onechapter. Another chapter is devoted to troubleshooting,hardware and software problems. The four most used ap-plications - Word Processing, Databases, Spreadsheets,and Communications are introduced and reviewed. Thelast chapter contains vital information on user groups,bulletin boards, magazines and books. The appendices

contain hardware information, technical stats and Escapecodes. This books covers a lot of ground and hence islimited in the depth of coverage. However it does containa great deal of useful information and has gathered someinformation not easily found elsewhere.

Level: beginner to advanced.

Title: Introduction to CAuthor: Paul M. ChirlianPrice: $15.95Publisher: Matrix Publishers, Inc.

As the title says this is an introduction to the program-ming language C. It is designed so that even those whohave no previous programming experience will be able tolearn C. Starting out with some basic ideas about com-puter operation, it moves on to some of the fundamentalconcepts of programming in C. Fundamental arithmeticoperations are explained: integer, floating-point, hierar-chy, mixed mode, constants, etc. The next area is basicinput, output and character operations including the use ofthe 'printf' statement and strings. The author stressesstructured programming and documentation, devoting alarge section of the book to these topics. The debuggingprocess is outlined, a subject seldom covered. There are anumber of good exercises and over 70 example programs.Arrays, pointers, and manipulations are covered in detail.File handling is discussed, input/output redirection, diskfiles, and command line input of data. The appendicescontain C Keywords, C Operators, and the ASCII Codes.Chirlian has chosen to follow the standards set forth byBrian W. Kernighan and Dennis M. Ritchie in their book'The C Programming Language,' Prentice-Hall,Englewood Cliffs, N.J. 1978. This book and Chirlian's areconsidered the standard books on C programming.

Level: Beginner to intermediate.

68 MICRO No. 75 . September 1984

Page 71: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 71/76

Name:

System:

Cardboard/5

Commodore 64

Name:

System:

Computereyes

Apple II Series &

Compatibles

48K

Applesoft & DOS 3.3

Description: This product allows

greater flexibility of use to switch

select any cartridge slot or

combination of cartridge slots. The

22 color coded lights emit diodes to

give status indication. Each slot has

four LEDS and two toggle switches

for indication and control. It allows

the user supply power to a cartridge

without allowing it to auto-start or

to effect other operations.

Price:

Available:

$79.95

Cardco, Inc.

313 Mathewson

Wichita, KS 67214

Memory:

Language:

Description: This is a slow-scan

device that connects any standard

video source (video tape recorder,video camera, videodisk, etc.] and

the Apple's game I/O socket. A

multi-scan mode provides realistic

grey-scale images. Included in the

package: interface module, cable,

software support on disk, owner's

manual and also comes with a one

year warranty. Versions for other

popular computers will be available

soon.

Price: $129.95

$10.00 demo disk (not

required)

Available: Digital Vision, Inc.

14Oak Street - Suite 2

Needham, MA 02192

(617) 444-9040

B O U N T Y H U N T E R

Jo ur ne y ba ck w ith u s int o th e days o f J es si e J ame s and

B illy the K id where the only form of ju stice was a

lo ade d r ev olv er a nd a h angm an's no os e. I n this full-

length text adv entu re, you p lay th e role o f B Ollnty

H u nter, ba ttling a ga inst ru th less o utla ws, h o;stile

Indians, wUd anim als and the elem ents of the

w ilderness w ith only your w its and your six I~un.

Ave ra g e s o lv ing t im e : 2 0- 30 hour s. If y ou lo v e ad'w en -

tu res, th is one is a real treat. Ava ilable for COMMO -

DORE 6 4 , th e V IC -2 0 (w ith exp ander ), a nd C O L I C O

ADAM.See your dea le r .

$1995 ~~~Co sse t , . 'D~ s \ ' t~ 'D . c _ ~ - - = - - - - = - - ~

Published by:

~~~,~~~~~Jt~;:rn~'2~;v2564 Industry Lane • Norristown, P A 19403 • 215-539-4:100

VictOrySoftware

ADAM isa trademark of Coieco, Inc. COMMODORE64 isa tradem~lIk or CommodoreBusinessMachines, Inc.VIC-20 isa trademark of Commodore BUSinessMachines, Inc.

No. 75 - September 1984 MICRO 69

Page 72: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 72/76

Microsport

Microcomputers Model

MMC/02

AIM 65, Apple II, Atari

400,800, Commodore

CBM/PET series, KIM-I,

KIM-4, Vic-20, MTU

1300 and motherboards,

Ohio Scientific 600 and

others, Synertek SYM-l.

Description: The Model MMC/02is a complete microcomputer on a

4.5" by 6.5" PC board. It features a

6502 microprocessor, lK Ram

standard, 4K ROM/EPROM socket,

2K RAM or ROM/EPROM

expansion and BUS for ading up to

16 I/O devices. Three basic versions

are available. The MMC can operate

from a regulated plus 5VDC power

source. The CPU addresses a total of

8K, enough for most control

applications. There is a prototyping

area as well as spare gates.

Name:

System:

Price:

Available:

From $159.00'

R.J. Brachrnan

Associates, Inc

P.O. Box 1077

Havertown, PA 19083

(215) 622-5495

Name:

System:

Cheatsheet

Commodore VIC 20,

C-64

Description: These are plastic

laminated keyboard overlays

designed to fit over the keyboard

s u r r oun din g the keys withcommands and controls grouped

together for easy references. The

latest cheatsheets available are:

Logo [sheet 11, Logo 1 sheet 2,

advanced], Pilot, Easy Calc,

PrinteI-1526, The Manager,

Multiplan, Practicalc 64 1 & plus),Printer IEpson-RX-80), Superbase

64, The Consultant, Sprites Only

and blanks. This brings the total

cheatsheets available to 33.

Price: $3.95 plus $1.00 shipping

per orderAvailable: Cheatsheet Products

P.O. Box 8299

Pittsburgh, PA 15218

(412) 456-7420

r-----------------------, ,..---~ ---------- ....

U N L IM I T E D P R O F I T P O T E N T IA L

EMC

(j)WATCH OUT WALL STREET!! Now available on floppy disk forbrokers and active traders. The AMAZING computer program..STOCKER 1" uses new Moving Window-Spectral algori thrn to fore-cast stock/commodity market TURNING POINTS-not mere trendline/moving averages. Affordable! Easy to use!

l IS E D B Y S T O C X / C lJ l! If lD l T Y B R I J £ R S & I l : T I V E T R A l l f . R S

Po:or t, iPSYOUtoo a re r~.dY for the S T O C K E R l chl1llef!~e i

Ie STOCKER 1 II available for

18M. PC, PC. j r , XT '5"'-lS

APPLE II. II+. lIt--

with Z-SIZI Card

rRS81lJ MODIII.4,

IIJ12116 4gk,~J,;ItIU!'1t

NEW! Your own personal forecast.

COM PARE There IS Jusr nothmg qUi te l ike It

,~STOCKER1n forecast for the Do w JonesIndustrial average dally closmo with your cur-rent method

" lOT OF "CTUQL " D I-J IIECMST"QII CD"f>Q~ISO"

P',,~~ E,.rEIl '" (0"" nv.

$299 IlASTERIVI~/Of£CXItnlJ lES FREEI ( ) U R ()i I 1 J D E I I S E R V I C E

I~~. ':"I!I"- ---------------------------------

I I i~ ~: .---------- -

116~. : : ~ . _ _ _ _ _ _ _ _ _ _ _ _ _ ,,-~"'.c.u. ------A-

~~:~:~?:~=~V E E R R ~ U N D E R 2 % ::=::~;;:===;~~~;~:;II:'>E.6~... -·-------- ·-------"..,.-----------AIlF--"---"--QA-"F-

11':~. ~II~.---------------~A- ~-..----"FF---F-~.+""---------1:,;:1!I.97' ..---·-------o::.A---FFF"-;:l--F---"''''''------A---A------111136e;.------------"-I1-----l!""-FF_;:lAA-"'- AAA-------110~, 1I"l7.--"·---··--P---~F-----F-- · • _

Ii!F':i4.14B---F~A---~-I1-FF---------- -~--

10!i!:.. ::::8,"-AA-~Q!"""'--------___ FQ...... t~ ~UR"rlOG PIJ!,.TS·1"763~1-----"F---A------------- ---

li!lf.7.4::" ..-~----f--------------------- .------------- ..---0000000000: I, II:; II '::::::~:·~"·<:2::J~::~J11~:44<o"""44"4

1111~"~E 78!i11.;"" . 7B 'I01 ~3"~E 78901 :~~~E 78901 :::34:%99

ENGINEERING

MANAGEMEI""T

CONSULT ANT

~, ! o. ~ 'I I1II .

""000" IN . PO. Box 312

Fat rtax . Va. 22030

Tel.: (703) 425-1296.

WEEKLY I MONTHLY I QUARTERLY 100Invest Trade Options Futures

70

In Micro No. 73 IJuly) Ian R. Humphreys 'CMPRSS'

program the following lines should read:

NOTE: It is the policy of Micro to not include all of the

hex code for assembled text. Due to space limitations we

include only the first three bytes of the assembled

message. This practice is carried throughout all of our

assembler listings. We apologize for any confusion this

may have presented and also any inconvenience to those

who are not using an assembler.

9 0 0 2 B D F 6 0 3

9 0 0 7 B D F 7 0 3

9 2 E 5 A 9 A 9

9 3 2 E A 9 E E

9 4 0 0 6 9 F F

9 4 0 2 B 5 0 3

S T A B J P + l

S T A B J P + 2

L D A s < M E S S l

P R T l A L D A #< M E S S 1 A

A D C # $ F F

S TA N E W P T R + l

MICRO No. 75 . September 1984

Page 73: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 73/76

,-~ ~----------.

by Mark S. Morano

_ . , . - .

~; - -~~.~.-'. . ." \

......

.... _ ...

It all started two months ago when I received a callfrom the BES [Bureau of Encryption Services). They were

having trouble with data security between their micros

and mainframes. The problem was thought to be origin-

ating from inside. Regardless of what new encryption

methods were developed, the unknown informant would

render them useless. And so the Bureau had decided to

seek outside help. Due to our years of experience in the

field, Micro was given the job. Our resident expert in

this area, Mike Rowe, was assigned the task of developing

new encryption methods that would prove effective

against prying thieves.

All went well until three weeks ago when Mike went

on vacation. He called on the day he was to return saying

he'd been delayed by a death in the family. We immed-

iately informed the BESof the delay and the reason for it.

The following day the Bureau contacted his family. They

hadn't heard from him. Needless to say there had been no

funeral. We were told to call the Bureau immediately if we

heard from Mike. They assured us that they would locate

him, but a week passed and still no sign of Mike. I began

to worry. I have known Mike for a long time and knew he

wasn't the kind of guy to up and disappear. The whole

thing sounded strange. That is, until the other night.

I was working late, downloading some files from a

local mainframe we use for mass storage. While looking at

the catalog I noticed a file named 'test. mr'. It was nothing

unusual to find a test file, but we never used the extension'rnr'. I downloaded the file to check it out. At first it

seemed to be a garbled mess, as though something strange

happened during transmission. I decided that there must

have been a surge on the wires, or a lost handshake

somewhere, so I downloaded again. As I did I thought

about the strange extension - 'mr' - of course, Mike

Rowe - it must be one of his work files, but he always

named his' temp. tst'. I started to examine the file more

closely; it still seemed like a bad transmission to me.

Perhaps I would find a clue on his desk. After rummaging

around piles of paper, I found what I was looking for, a

folder marked'Top Secret' in big red letters with hand-

painted stars and spaceships scattered about. With folder

. . . . . . . . . . . _ ...

. .~

in hand I went back to my desk. I printed out Mike's file,

carefully perused it, and then started pouring through the

'Top Secret' folder in hope of an answer. As I sifted

through countless encryption methods, I suddenly came

upon one dated three days before Mike went on vacation.

He had mentioned he was onto something hot and had

pulled an all nighter the Thursday before he left. As I

compared his examples and 'test.mr' I knew I had it. Two

hours later I had decoded the mystery file.

At first I thought it was a gag, but it soon became

evident it wasn't. The text explained that he had been

picked up by a couple of woman, the next thing he

remembered was passing out. He woke to find himself

locked in a room with a desk, a couple of terminals, a

printer and a modem. He was instructed over an intercom

to recompose the latest encryption method he had devised.

He was able to convince his captors that he had to access

some files from the mainframe Micro used. While online

he sent over this dummy work file I had found. I later

found out he had given this new encryption method to the

Bureau before he left for vacation. It seems that now

someone else wanted it too. Mike stated in 'test.mr' that

his method would be used to send important data over the

lines sometime during the next month. He asked me to in-

form the Bureau of his plight, destroy' test.rnr' and any

files associated with his work. His last request was that I

quickly come up with some alternate encryption methods

for the BES to use in place of his.Well, in all honestly, I have limited experience in this

area. So I decided to tap the brains of some people I know.

After considering different suggestions, I finally came to

the conclusion that you, the readers of Micro, could prob-

ably help the most. By gathering a variety of encryption

methods, I could distill one final product that would

ensure security and stymy any intruder. And so, I ask you

to help me out in this time of need. Please send your

encryption schemes and solutions to me, using the sen-

tence 'When the crow flies west, the sun shall set in the

east.' Any encryption methods you can or have devised

will be of great value and an important link in forging a

chain that only Mike Rowe himself could crack.

No. 75 . September 1984 71ICRO

Page 74: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 74/76

Advertiser's Index

Analog

Call APPLE

Cardco, Inc

Cheatsheet Products

Digital VisionEngineering Managemen t

Hayes Microcomputer Products

JQB Enterprises

Lazerware

MICRO

Micro Motion

Micro Technology Unlimited

Micro-W Distributing

Midwest Micro

Nikrom Technical Products

Performance Micro

Progressive Peripherals

6 9

7 ( )

6 97 ( )

Back Cvr

4 6

35

60,Ins Back Cvr

8,3()

3

17

9

2

17

12

38,39,40,41,42,43

4S

70

4S

Ins Front Cvr

14

6 9

53

6

Coming in October -

Protecto

Quantum Software

R.I. Brachman

S-C Software

Skyles Electr ic Works

Specialty Electronics

Star Byte

Such-A-Deal Soft ware

[j Plotting Binary Trees

by Luther K. Branting

Graphic displays of tree-like decision paths aid

using and understanding this type of graph

[j Fat Bit Map Plotting

by Loren Wright

Assembly language routines to support bit map

plotting on the Commodore 64

[j Data Base Comparisons

by Saniiva Nath

Discussion of the features to look for in selecting

a data base manager for your micro

[j Rational Joystick Interfacing

by Charles Engelsher

A 'built-it yourself' project to add a joystick toyour system and learn about AID conversion

[j FORTH Input Utility

by Mike Dougherty

A method of providing interactive text input for

better applications

Solution to last month's (#74 July)

Lyte Bytes puzzle.

72 MICRO No. 75· September 1984

Page 75: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 75/76

• 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 2000

memory locations

• Allows easy movement between BASIC and

Machine Language• Explains how to use the information for easier,

better, faster software writing

This famous book now contains the most comprehensive description of firmware

and hardware ever published for the whole Apple II family. A new section with

guide, atlas and gazeteer now provides Apple lie specific information.

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

For the 35,000 people who already own previous editions,

the lie Appendix is available separately for just $5.00.

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

Please send me:___ What's Where in the Apple @ $19.95 ea. _

(Plus $2.00 per copy shipping/handling) Name

___ Apple lie Appendix @ $5.00 ea.

(includes shipping charges)

Mass residents add 5% sales tax $

Address

City State Zip

Total Enclosed $ Signature _

o Check 0 VISA 0 MasterCard

For faster service

Phone 6171256-3649Acet # _ Expires _

MICRO, P.O. Bo)~6502, Chelmsford, MA 01824L ~ •

Page 76: Micro 6502 Journal September 1984

8/3/2019 Micro 6502 Journal September 1984

http://slidepdf.com/reader/full/micro-6502-journal-september-1984 76/76

Communicat ing is so easy w ith a c om- you w ant to do. T he program guides

p le te t el ecompu ti n_gsy st em f rom Hayes. y ou a lo ng the way .Y o u c an c re ate , Jist.J u st p lug it io -a od -th e w o rld is your name. send. rec eive. print or eraseA p ple. H ay es Smartm od em 3 00 tM is the files right from the m enu. F rom thec onvenient direc t-c onnec t modem for verJ first tim e y ou u se it. you' ll f indth e ~ pp le IIc :A nd H ay es M iaomodem telec omp~ting w ith Hayes as easyIle=is t he e as il y installed board modem as aPele pielfo r th e A p ple II,Ile. III, and A pple plus. W e ve got your numberl W e k nowPac k ag ed w it h Smartcom r- d:t u w ant a s ystem that's flexib le.companion II~ versatile a nd a cc ommo -software, I~ ~ d ati ng . T h e Smar t-b o th p ro v id e '''{j~~Jrt::ir. ' modem3OO/Smar t com Ia c omple te ~~~AA~~fW"v s ys tem a c c ep ts P roDOS !"telecomputing '(WWyv I DOS 3 . 3 , Pascal and CP /M-ope ra ti ngsystem . A nd best o f all, both system s system s. T he M iaomodem lIe Ia re f rom Ha. ! y. e.s.. the established tele- Sm artc pm Iystem ac cep ts D OS 3,3,c omputing leader! Pasc al and CP/M oper at ing s y st ems .W e c onnec t yoo to all the right Smartc om I a lso_provides you w ith

p lac es. B ulletin boards, databases. a direc tory of the files sto red on your

F ollo w the leader. O ver the years

w e'v e b uilt o ur rep utatio n as d iete le c cm p un ng le ad er b y d ev elo pin gquality p ro du c ts th at se t in du stry sta n-d ard s. N ow we in vite y .o u to s ee fo ry ou rself ju st h ow sim ple it is . toaddp ow e rf ul . e as y t o u se t el ec ompu ti ngc apab il it ie s t o your Aep le c ompu te rw ith a c om ple te. re ad y-to -g o sy stemfrom H ay es . V is it y ou r H ay es d ea le rfo r a harids-on d em o nstra tio n. A n dget on linew ith the "wor ld .Hayt;s.

We 're h ereto h el p.