Upload
cubemanpdx
View
230
Download
0
Embed Size (px)
Citation preview
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 1/68
The Magazine of the APPLE. KIM. PET
and Other @l!:l(!)~ Systems
II'OB O R O $11'08
11'08 A2 Q{ ) LOUH $00 B E G I N PLOTTIMG R O U T I N EIFOA AO 02 LOUH $02
lPO ( B l 1C LOOP LOArY $7 C T RA NS PE R V ALU ES 'O R ISI I'O J:. 1 0 10 B P L P O S I Y S . Z J AHO P I , Qt ,11'10 c8 I N Y RS TO £.1. 1111, U.
I~ 11 C9 ~ 'F CIIPII! »'1' AN D PE l, QU , H,
lFn 1'005 BE Q N E O l RESP~CTlVELl , REDUCE
11'15 A~ 80 BITH LllAIH *60 VALUES FROI1 'twO
11'11 IiC 2A IF JHP STOl l BYTES TO OIl!
IFIA 01 7C N ~ G l LOUY UC
IFIC 10 F7 O P L BITHIF1~ 30 OA BHI STOR
IF20 00 05 POS! ONS THCli
11'22 C8 I N Y11'23 B I rc E .OAIY ~7C
11'25 10 0] BPE . STOR
11'27 A9 'IF TMCH LDUH $71'IF29 cs lN Y
IF2A 9S 23 STOR .'lUX ~E
1f'2C es Hil
11'2D 96 TrA
IF20: 18 CE.e
11'21' 69 O~ AOGlt! $06
Inl A S TH
11'32 C9 2C CHPIH $2C CHECK FOR END OF TRANSFER
1"311 DO 06 ON E LOOP
11'36 AS 23 L O A PE COHPIl'I'E Ell' , FE .. EX11'38 18 eLC
Plotting a
Revolution
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 2/68
froan RAINBOW
Ma c hi ne L a ng u ag e, i,
'cu rso r-b ased tex t ed ito r fo r 16K Apple .; • Featu res fo rm at cap ab ilitie s o f m ost tex t
editors.• All comm and s are con tro l charac te rs.• Enab les you to defin e your ow n functionc ommand s .
, Order P I E o n Casse tte : _ . . . . . . . $19.95On D isk e tte ... _ . ... _ . _ . . $24 .95
fo r 24K
• Flip back andtex t w ith ESC. ,
• Correct w rong m otes• Analyze you r pos i ionOrderSARG ON on Casse tte .... ' . $19.95
A high quality , ch alleng ing gam e for you
and th e co m pu tar.
Ord er FAST GAMMON on Casse tte _ $19.95
On D iske tte $24 .95
Call o r w rite tOday~ 'fo r your FREE App leSoftw are Catalog . e w elcom e B/A-V ISAa n d M a s te rc ha rg e. or rv , n o CO Os. P leaseadd $1.25 sh iPP ing l and hand ling . Califo r-n ia resid en ts add 6% Sales T ax .
I
W e ship p rom ptly ~n rece ip t o f your pre-p aid o rd er. Ord er d i~ ect fro m:
M ach ine lang uage p rogramfo r 16 K Ap ple .• D efine your ow n characte r se t and graph icshapes .
• Co mp le te E ng lis h u pp er/lo we r ca se ch ara c-te r s et.
• Com ple te G reek Alphabet w ith upp er/low -e r ch ara cte r se t.
• S cro ll, v ary w in do w siz e, in ve rt ch ara cte rs,sw itch b ack and forth b e tw een tw o cha r-a ct er s et s.
Or de r H i-R es C ha r. G en . o n D is ke tte $19.95
• D efin e a 3-D lu -re s s ha pe .• A nim a te w ith fu ll p er sp ec tiv e.• Includ es 3 dem o shapes.
Ord er 3-D A NIMA TION o n d isk ette .$24 .95
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 3/68
~~ ***** !AIM·65 *****
EXCERT~NCORPORATED
PIN
A65-1
A65-4A65-AA65-B
AIM-651 w/1 K RAM
AIM-65~W/4K RAMAssem ler ROM
BASIC ROMS
aty 1-9$375
$450$85
$100
EXCERT has concentrated on the AIM-65 tq guarantee YOU that the products we offer are fully
compatible. We know how these products work since they are used in our systems. EXCERT canhelp you get the system YOU want!
ACCESSORIESPIN
PRS1 + 5V at 5A, + 24V at 2.5A,±12V at 1A (does not fit in-side ENC1) $95
PRS2 + 5V at 5A, + 24V at 1A
(mounts inside ENC1) $50
ENC1 AIM-65 case with space for
PRS2 and MEB1 or MEB2 or
VIB1 $45
ENC2 ENC1 with PRS2 inside $100
TPT1 Approved Thermal PaperTape, 6/165' rolls $10 .
MCP1 Dual 44 pin Mother Card takes
MEB1, VIB1, PTC1 $80
MEB1 8K RAM, 8K Prom sockets,
6522 and programmer for 5VEproms (2716) $245
PTC1 Prototype card same size as
KIM-1, MEB1, VIB1 $40
VIBI Video bel with 128 char, 128
user char, up to 4K RAM, lightpen and ASCII keyboard inter-
faces $245
MCP2 Single 44 pin (KIM-4 style)
Mother Card takes MEB2,PGR2 and offers 4K RAM
sockets $119
with 4K RAM $169MEB2 16K RAM bd takes 2114's $125
with 8K RAM $225with 16K RAM $325
PGR2 Programmer for 5V Eproms
with ROM firmware, up to 8
Eproms simultaneously $195
with 4 textool skts $245
SYSTEMS
"ASSEMBLED & TES-rED"
All AIM-65 systems are self contained and have
the power supply (PRS2) mounted inside ENC1.
"STARTER" SYSTEMS
PINSB65-1 A65-1 in ENC2
SB65-4 A65-4 in ENC2
SB65-4B Same Plus BASIC
$475
$540
$640
"EXPANDED" SYSTEMS
PIN
"B" "e" "0"MEB1 MEB2 VIB1
E_65-4 A65-4, ENC2,
wlone MEB1,MEB2, or VIB1 $775 $855 $775
E_65-4B Same PIus
BASIC $875 $955 $875
Higher quantities and systems with other op-
tions quoted upon request!
Mail Check or Money Order To:
EXCERT, INCORPORATED
Attn: Laurie4434 Thomas Avenue SouthMinneapolis, Minnesota 55410
(612) 920·7792
Add $5.00 for shipping, insurance, and hand-
ling.
Minnesota residents add 4% sales tax.
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 4/68
faster than Q speeding m;n;Able to leap I tall m;cros;na s;ngle4K RAMBKROM
, r ' $Its more than a ba . ain, it's a real steal.
$279
Superboard, by OhioS cientific , - the computer
on a board - even
includes a key board andin te rface fo r v ideo d isplayand casse tte reco rder.
V/~-1 t \D U-1STER-rH-tRGEORDERS 4RE
80 Til 4C(EI'TED.
- - - - - - - - - - - - - - - - - - - - - - ~ - - - - - - - - ~ - - - - - - - ~ - - - - - -Send me a Superboard II $279 enclosedName - ~ t___-
Payment by BAC(VISA) _MasterCharge _Address -----j-:- __
City LDmpUTE~SHOP CreditCardAccountll __ ~_~_
Boston UnionNH. CambrrdgeState Zip __ 590Comm.Ave. Rte.16B . 268NorfulkSI. Expires __
(acrossfrom6U.) 503-473-23231(nearMU) TOTAL CHARGED OR ENCLOSED _
Phone 247-0700 661-2670 All orders shipped Insured UPS unless olherwlseTequested
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 5/68
)
,)
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 6/68
CONNECTICUT mic~oCOMPUTER, Inc.
150POCONO ROAD - BROOKFlfLD, CONNECTICUT 06804
TWX : 7 10 -4 56 -0 05 2EL: (203) 775-9659
P WERM OULE
Gi~ANALOG INPUTlMOOULE
~ q : = tNALOG
MANIFOLOMOOULE
SENSORS
• TEMPERATURE
• VELOCITY
• PRESSURE
• db
• pH• ACCELERATION
• HUMIDITY
• LIGHT LEVEL
• FLUIO LEVEL
• ETC. ..
~
L :__J JGPIB (IEEE-488)INTERFACE MODULE
~TRQMOO
TRS-80 INTERFACE
ETC.MANUAL AND
OISPLAY MOOU~E BXPANOERMOOULE
DAM SYSTE~S bw effieA coaplele sysle. of oodules lq lel ~our co.puler lislen
l o l he r ea l ' wo rl d.
DAM SYSTEMS PRICE LIST
CABl.E II I~" .l n - ; ' , ' ; : ' ; ' 1 " " cc)n ne c t. C.j:st",.J. E~;;
G a ln e cl s c ", ", ,1 .i !r i nt e- ra c eI.D
A IMI6 , IW ID IS I, XPA l lf f il , etc,
f 1" 3 I~
AIM161 - Analog Input Module16 8-bll ana l05 In ,,,,l. - 100 o ic ro so rond coove r,ion llo e - 3
.lale O IJUou l - r e o oi r e. on e 8-bil """""I.i!r oot.> IJl _ l for
" ",! .r ol a nd on e 8-b ll roo r-u lo r in Hll ..... l lor dili.
CABLI~ A24 In t,e,"'c o I1rl e ct (::able $l9.(j~~
2. inc h 0;;1>1. "1L) -, ln lo rf"". c r ;,nec lc f on on . end ""d an OCOH
e oo lva le nt o n lh o ot.hor .
F' (l Wl - F' Gw ~r Mo~j~lle
Suw lie s ,._ . fo r on e AIMI6 . .00 . .1 • •
$:1.4.9~';MAND.rSj. -_ Mal1lJal an d I:ll~;2J.~~SM(:ldl.lle l O B A
Camed . be t .we .n th e A lH I6 a nd toe < "," "lo r l n1 .E l'f "" . . A llo w s
Wf l u a l o r C 1 l I f ' 4 J l e r c O 'l ir o l o f i J i@ ~nl16t ( l lSF ' lo ~ c h a r t li e l
n uo be r a nd dali.ICON - Input Connecter
F or C O".n ec lln s i f,a lO S i n" "ls t o lh o AIM I. - 20 p in Oilf'd edge
c oo ne cL or - sold er .,.,l.l s.GPIB MOD - GPIB (ILEE-488J Interface
Allow. lh o DAIISYSTEJISIIOIU.£S to be used " 1 L )- , lh o GPIB bu.
lnslead o f a C1W \Jler 's o the r 1i0 ear l s .D e O N - O l J LP l J t. C()r'neclot~
Fo r " ", m e c li n s U - . . AIMI . to a " "" "" I.e < - 2 0 P l O c ar d edge
c oo ne cL or - s old er .... l.l".
MANM()[ll _. Manif~Jld M () d l i l e
I J 5 e in pIn of ! c t : W . Screw le or llin al b ar rIe r ; lr ·ip s f or
cmn~L ino : a ..icH;ild.;, f oO le nt ..i ~le f- s, 0 .r 01 l~ s oo r~ J ~lc.
El i. lnales lh o n eed for 'Old erlOS. P lu gs in lo lh o AIMI6 .
RS232 MO[1 - RS232 Ir)terf~~(~e M(:ldll,le
All"", lh o DAIISYSTEI tSI ' IJ IU.£S to be u se d " lt h a n [ ,S -23 2 "" ,- l
o r l or ol na l.
XF'ANDRl E>,pander' ModuleA ll""" .. to 128 8-b il ""a l05 In ,,,,ls (8 ~ IM I6 IIo du le s) to be
c oo ne cle d L D on e ' ! I S leo.
rBA
ANAMANl - AI')alo~ MaI1i'fol.d Mc)dl,Jte 'l"B A
I J s o in ,I..,. o f Im N . C on ne cls D AIIS YST £J1 SSEHS(l':S to lh o AIMI6
w i U 'n l L SO ld e r lO ! t - Sii'tSOl' c so le s .i ls i r -lu s iii. P l u g; s i n to t . h e
A IMI 6 o r lh o KAHIIOOI.
SENSOR!:)
S e n s. ar s f e r l .e a f. e. ra tu r er H'~sure, flow, l'1I.idiL~, l ev eb pft,
IIOliOfh ele.
TBA DAM SYS1"EMS sets
CUMPUTER INTERFACESFo r lh o f '£ h K IM , T It S- BO , ..1.0. U se i n .I oc o o f O CII N. E Ii .i n. le s
lh o n ee d f lJ' s old .f ln S o r S >l !C la l C OO S! .r uc tlo n.
Tr<A
AIM161 SLarLer SeL 1In clu de s o ne A IIU .I, o n> 1'( Ij1, o n. IC lJj a nd o n. m.
'liHl9.00
AIM161 SLarLer SeL 2In clu de s o n. A J" lI.l, o n. 1 '( Ij1 o o n. IW fIO JJI iIld o r,. O CD H.
PETMOD - PET InLerface ModuleGiv es tw I E EE . .. .. l s, on e u se r I'I II 'l a nd o n. D A IIS Y ST E M S
i n lo r fi iCO . .. .. t. s . . . . . . w ea r a nd lear on lh o f '£ T '. f or in le d
c ir cu i l b oa rd . A ls o c alle d lh o P £ T S A ' A l .
$49.95PETS!'::T1a
In clu de s o n. PHIl)!" on . C A I I l . £ 1 12 ., o n. A IM I .I, o n. F 'O W !a nd
lIIe IWKIO!.
KIMMOI! - KIM InLerfac~ ModlJle
G iv es o n. _ lic alio n c on ne cL or I'III'l a nd < r,o D AIIS YS TE IISi r l le r f i iCO ea r l .
kIMSETlaI nc lu de s o n. K IIV llO , o n. C A I I l . £ 112., on e A IM !.I, o n. f1 JII a nd
o n e iW If OD l .
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 7/68
Plotting a Revolution
John Sherburne
206 Goddard
White Sands Missile Range, NM 880102
An assembly language plotting routine thatis callable from BASIC will simplify andspeed up the high resolution plotting process.
What does fomenting rebellion haveto do with microcomputing? Plotting a
revolution refers to the creation of three
dimensional figures, called solids of
revolution, that are formed by rotating a
two dimensional figure about an axis to
form a solid.
Solids of revolution can be generated
and displayed, under BASIC, by using a
fast, general purpose assembly langu-
age plotting routine and a technique
that allows the assembly language
routine to access BASIC variables. The
plotting routine and the BASIC langu-
age interface are building blocks used to
construct a generalized program to
display solids of revolution.
Plotting Routine
The purpose of the assembly lanqu-
age plotting routine is to simplify and
speed up the high resolution plotting
process. It also allows the operator to
choose any point as the center and plot
coordinates relative to that center, and it
allows the option of plotting with a 45
degree perspective. To accomplish all
this, six parameters must be passed
from BASIC: P%, Q%, R%, X%, Y% and
Z%.
P% and Q% are the screen location
for the center of the plot. The screencontains 80 x 50 plot positions so
P% '" 40 and Q% '" 25 would plot
relative to the center of the screen.
I
R% specifies the type of plot. If the
zero bit of R% is set (R% is odd), the plot
is displayed as though viewed straight
on. If R% is even, the plot is at a 45
degree perspective to the viewer's right.
If the one bit of R% is not set, the plot-
ting routine will plot over any non-plot
September, 1979
LIST~I~ : a ~Y ~ ~ : ~ ~X ~ ~·1I~ P R IN~ irL:;lI'
~ I Y ~ ~ ~I=-24 TO 17 STEP 21 Zx=21+6:ZT=2I/5
; 1 FOR X1=-48 TO 48; 28 XX=XI :XT=XI.2 ..../S8: 88 YT=(COS(XHZT> +COS(XT»'3: 58 IF YS<YT GOTO 364:68 Y1=YT: Y2=YS: 62 GOTO 378:64 Y1=YS: Y2=YT:78
FOR YI=Y2 TO Y1 STEP -1: a8 YYo=YI
: I I 5YS(7944): N I X T YI·4 Y -YT
~i N XT XI
·I'i.~ Y~ ~TG~: IF U-"" GOTO 578
Figure 1: Two sine waves of different frequencies.
MICRO - The 6502 Journal 16;:5
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 8/68
characters on the screen and erase
them. If the one bit is set, non-plotcharacters on the screen will not be
erased. The other bits of R% are ig-
nored.
X%, Y% and Z% are the coordinates
of the point to be plotted. TheX axis is
horizontal, the Y axis is vertical and the
Z axis is either vertical or at a 45degree
angle, depending on R%.
Themost complex problem inmakingthree dimensional plots is to draw only
lines which are visible and to eliminate
lines hidden to the viewer. The plotting
routine can perform hidden line elimina-tion automatically for one type of figure;
afigure which can beimagined as anob-ject covered by a very large, tight fitting
sheet. More precisely, the figure musthavea single Yvalue for each (X,Z)value
pair, and thebottom of the figure will be
hidden from view.
If such a figure is plotted, startingwith the lowest value of Z and progress-
ing inorder to the highest valueof Z, the
~i~ : f 9 Y ~ ~ ; l J ~ ~ I - ·. . . > < R : ~5"": XP·35
~
YR-: YP-1...zr-XR/ZP:XF·XR/XP:YF·YP/YRPR INT "L;I"
11~ ~~R2T~~z~XO~02~~~pQ~6TO 568139 2T=2 UXP/ZP149 2x=ZI159 "'5=-29299 XL=INT(.'+SQR(XP.XP-ZT'ZT»
~
19 FOR XI=-XL TO XL
2 1 XT=5QR(XI.XI+ZT.ZT)3 XT=XUXF.. X~-Xt39 YT-5 N(XT)'YF3 8 1 Y'IX-Y :5Y5 (7944)
48 Y-Y41 N XT ~I~~ ~ ~T Gt: IF U-"" GOTO 578
Figure 2: Sine wave rotated about the Y axis.
M IC RO -WA RE A SS EM BL ER 6 5XX-1. 0
1F081F08
1F08
1F08
1F081F08
1F08
1F081F08
1F08
1F08
1F08
1F08
1F08
1F08
1F08
lF08
lF08 A2 00
1FOA AO 02
1FOC B 1 1C
1FOE 10 10
1F10 C8lF11 C9 FF
1F13 FO 051F15 A9 80
1Fl1 4C 2A IF
1F1A B1 1C1F1C 10 F7
1F1E 30 OA
1F20 DO 05
1F22 C8
1F23 B1 1C1F25 10 03
lF21 A9 1F1F29 C8
lF2A 95 23lF2C E8
1F2D 98
1F2E 18
1F2F 69 06
lF31 A8
lF32 C9 2C1F34 DO D6
lF36 A5 23
lF38 18
lF39 65 26
1F3B 10 08
1F3D 46 25
1F3F BO 061F41 65 281F43 50 02
lF45 A9 1F
1F41 85 541F49 18
lF4A A5 24
1F4C 65 281F4E 10 05
1F50 38
lF51 E5 211F53 50 02
•• PL OT TI NG A R EV OL UT IO N
• M OD I FI E D 1-11-19 B Y MI CRO STAFF
•• PAGE ZERO VARIABLES FOR V ER IFI CA TI ON R OU TI NE :
SUT • $0023VFLAG • $0024
VARY • $0025
• PAGE ZERO VARI AB LES FOR PLOT TI NG ROUT INE:
PE • $0023QU • $0024
AR • $0025
EX • $0026Wy • $0021
ZE • $0028
EXPP • $0051
WYPP • $0052
RH I • $0053
EXP • $0054Wy p • $0055
CHAR • $0056
FLAG • $0051
LOOP
ORG
LDXIM
LDYIM
LDAIY
BPL
INY
CMPIM
BEQ
LDAIM
$IF08
$0 0
$0 2
$1 C
POSI
TRANSFER VALUES FOR X%
Y%, Z% AND PJ, QJ,
RJ TO EX, WY, ZE,AND PE, QU, AR,
RE SPE CT IVE LY. RE DUCE
VALUES FROM TWO
BYTES TO ONE
B EGI N PLOT TI NG ROUT INE
BITR
$F F
NEGI
$8 0STOR
$1 CBITR
JM P
NEGI LDAIYBPL
BMI STOR
POSI BNE TMCH
INY
LDAIY $1CBPL STOR
TMCH LDAIM $1FINY
STOR STAX PE
INX
TYA
CL C
ADCIM $06
TAY
CMPIM $2C CHECK FOR END OF TRANSFERBNE LOOP
LDA PE COMPUTE EXP = PE + EX
CL C
ADC EX
BVS OFLO
LSR AR CHECK AR, IF ODD 90 DEGREE
BCS CLER PLOT, IF EVEN 45 DEGREES.ADC ZE IF 45, ADD AR TO EXPBVC CLER
OFLO LDAIM $1F SET TO 1F ON OVERFLOW
CLER STA EXPCL C
LDA QU COMPUTE WYP = WY + QU
ADC ZEBVS OVRF
SEC
SBC WYBVC OKEY
16:6 MICRO - The 8502 Journal September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 9/68
F55 A9 7F OVRF
F57 85 55 OKEY
F59 A9 00
F5B 85 57
F5D 85 53 MAI N
F5F 85 56
F61 A5 5~
F63 85 51
F65 30 04
F67 C9 50
F69 90 01
F6B 60 COUT
F6C A5 55 YCH KF6E 85 52
F 7 O - 30 7B
F72 C9 32F7~ B O F5
F76 ~6 51 GOON
F78 90 02
F7A E6 56F7C 46 52 XQUAD
F7E 90 04
F80 E6 56
F82 E6 56
F84 A9 01 YQUAD
F86 A4 56 ROND
F88 FO 06
F8A OA
F8B C6 56
F8D 4C 86 IFF90 85 56 ROUT
F92 06 52
F94 06 52
F96 06 52
F98 A5 52
F9A 06 52
F9C 26 53
F9E 06 52
FAO 26 53
lFA2 65. 5 2
FA4 85 52
lFA6 A5 53
lFA8 69 00
lFAA 85 53
lFAC A5 52
lFAE 65 51
lFB O 85 52
lFB 2 90 02
1 B 4 E6 53
1 B 6 18
1 B 7 A9 80
lFB 9 65 53lFB S 85 53
lFB D AO 10
1 B F A2 00
lC1A152
1 C3 88
1 C4 D9 B 3 lE
1 C 7 FO OB
C9 CO 00
CB DO F6
1 CD A6 25
1 CF FO 03
Dl 4C E D I F
D4 A5 57
1 D6 FO OC
D8 A5 56
DA 49 OF
DC 85 56
DE 98
1 DF 25 56
1 El 4C E7 I F
1 E4 98
1 E5 05 56
1 7 A8
hidden line problem will be simplifiedgreatly. Infact, it becomesonly amatterof printing the value of Y for each (X,Z)and eliminating all. previously plottedlower values of Y. The plotting routineaccomplishes this process by simplyerasing all points below the currently
plotted point.
Besides having to plot all points in in-
creasing order of Z, the procedure re-quires that, for a given value of Z, an
(X,Y) be computed for each feasiblevalue of X. Otherwise gaps in the plotmight leavenon-visible points unerased.This process canbeimagined as cutting
the figure into slices parallel to the XYplaneand then stacking the slices up inZ valueorder to reconstitute the figure.
If the hidden line function is notwanted, it can be turned off with thestatement "POKE 8181,96". This willcause the routine to plot a point at X%,
Y%, Z% without erasing lower points.Of courseif Z% is held constant at zero,the routine is equivalent toatwo dimen-sional plotting function.
Figure 3: The problem has
drawing a line between
eliminating the gaps.
been corrected by
plot points and
September, 1979 M rC RO -~. 8502 Joumal
PLUS
NOVR
AGIN
LDAI M $7FST A WYP
LDAI M $00
ST A FLAG
ST A RH I
ST A CH AR
LDA EXP
ST A EXPP
B MI COUT
CMPI M $50
B CC YCH K
RT S
LDA WYPST A WYPP
B MI RT RN
CMPI M $32B CS COUT
LSR EXPP
B CC XQUAD
I NC CH AR
LSR WYPP
B CC YQUAD
I NC CH AR
I NC CH AR
LDAI M $01
LDY CH ARB EQ ROUT
ASLA
DEC CH AR
JMP RONDST A CH AR
ASL WYPP
ASL WYPP
ASL WYPPLDA WYPP
ASL WYPP
ROL RHI
ASL WYPP
ROL RHI
ADC WYPP
ST A WYPP
LDA RH I
ADCI M $00
ST A RHI
LDA WYPP
ADC EXPP
ST A WYPP
B CC PLUS
I NC RH I
CLC
LDAI M $80
ADC RH I
ST A RH I
LDYI M $10
LDXI M $00
L DA IX WYPP
DEY
CMPY T AB LEB EQ NOVR
CPYI M $00
B NE AGI N
LDX AR
B EQ NOVR
JMP RT RNLDA FLAG
B EQ SET R
LDA CH AR
EORI M $OF
ST A CH AR
T'iAAND CH AR
JMP PLOT
T YAORA CHAR
T AY
SETR
pun
SET T O 7F ON OVERFLOW
SET FLAG FOR FI RST I T ERAT I ON
B EGI N PLOT
CH ECK FOR EXP GREAT ER
T H AN ZERO, LESS T H AN 80
CH ECK FOR WYP GREAT ER
T H AN ZERO, LESS T H AN 50
DI VI DE EXP AND WYP BY ;~
COMPUT E QUADRANT OF
PLOT POI NT WI T H I N T H E
S CR EE N P OS IT IO N
SET B I T I N CH AR CORRESPONDI NG
T O Q UA DR AN T
OF PLOT POI NT
T RANSLATE RELAT IVE COORD
OF PLOT POI NT T O
SCREEN LOCAT I ON FOR
POI NT . X + 40 • Y
FI ND CH ARACT ER ALREADY
AT SCREEN LOCAT ION
IF CH ARACT ER NOT I N T AB LE,
CH ECK AR FOR OVERWRI T E
I NDI CAT OR (2ND B I T)FI RS T I TE RA TI ON ?
IF NOT FI RST I T ERAT I ON,
B LANK OUT CH ARACT ER ON SCREEN
I F FI RST I TERAT ION,PR IN T N EW C HA RA CT ER
16:7
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 10/68
If'E!B89 83 lElFEB 81 52
lFED A9 FF RTRN
lFEF 85 51
lFFl E6 55
lFF3 A9 00
lFF5 4C 5D IF
lEB3
lEB3 20 TABLE
lEB4 1E
lEB5 1C
lEB6 EC
lEB1 1BlEBS 61
2000 2114
AR 0025 BI TR lF15 CH AR 0056
CLER lF47 COUT lF6B END lF02
EXPP 0051 EXP 0054 FLAG 0051
IFACE lEC3 INI T lECE LOOP lFOC
NEGI lF1A NOVR lFD4 OFLO lF45
OVRF lF55 PE 0023 PLOT lFE1
POSI lF20 QU 0024 RH I 0053
ROUT lF90 RPET lEEC RTRN lFED
STAT 0023 STOR lF2A TAB LE lEB3
rl9Ure 4: TIle solid formed by ro,.,lng Y = 15 expAR Y 0025 VFLAG 0024 WY 0027
WYP 0055 XQUAD lF1C YCHK lF6C
ZE 0028 - Xl3) about the Y axis,
MICRO - The 8sf Journal September. 1979
lEB9 FF
lEBA BC
lEBB 6C
lESC 1FlEBD El
lEBE FB
lEBF 62
I ECO FClECl FE
lEC2 AO
lEC3 A9 CF
lEC5 85 25
lEC1 AO 01
lEC9 84 24lECB 88
lECC 84 23lECE E6 25
lEDO 18
lEDl 26 24
lED3 B l 1ClED5 C5 25
lsp1 FO 06
lED9 A5 24
lEDB 05 23
lEDD 85 23
lEDF C8
lEEO B l 1C
lEE2 C9 80
lEE4 FO 06
lEE6 A5 24
lEE8 05 23
lEEA 85 23
lEEC 98lEED 18
lEEE 69 06lEFO A8
lEFl C9 2A
lEF3 FO OD
lEF5 C9 15
lEF1 DO D5
lEF9 A5 25lEFB 69 04
lEFD 85 25lEFF 4C CE lE
lF02 A5 23
lF04 8D OC 02
lF07 60
SYM BOL T AB LE
AGIN lFC3CHEK lEDF
EX 0026
GOON lF16
MAI N lF5D
OKEY lF51PLUS lFB 6
ROND lF86
SET R lFE4TMCH lF21
WYPP 0052
YQUAD lF84
16:8
LDAY T ABLE
ST AIX WYPP
LDAIM $FF
ST A FLAG
INC WYP
LDAIM $00
JMP MAIN
ORG $lEB3
$2 0
$1 E
$1 C
$E C
$1 B$6 1
$PF
$E C
$6 C
= $1 F
= $[1
$F S
= $6 2$F C
$F E
$A O
IFACE LDAIM $CF
STA VARY
LDYI M $01
STY VFLAG
DE Y
STY ST ATI NIT I NC VARY
CL C
ROL VFLAG
LDAI Y $1CCMP VARY
BEQ CHEK
LDA VFLAG
ORA ST AT
STA ST AT
CH EK INY
LDAI Y $1C
CMPU\ $80
BEQ RPET
LDA VFLAG
ORA ST AT
STA ST AT
RPE! TYACL C
ADCIM $06TAY
CMPIM $2A
BEQ END
CMPIM $15
BNE I NIT
LDA VARY
ADCIM $04
STA VARY
JMP INIT
END LDA ST AT
STA $020C
RT S
I
I
SET FLAG TO NEXT ITERATI O~INCREMENT POINT FOR ERASI G
AREA BELOW POINT
B EGI N VER IFI CAT ION fiO UT INf
LOAD CONT ENT OF WORKING
STORAGE AREA
C OM PA RE V AR IA BL E· NA ME
FI RS T C HA RA CT ER
I F CH ARAC TER I NCOR RECT
UPDATE ST AT
S EC ON D C HA RA CT ER
IF CH ARACTER INCORRECT
UPDATE ST AT
MORE TO NEXT VARIABLE
CH ECK FOR END OF LOOP
BEGIN ROUTI NE TO SKIP
FROM UTO XJ
ST ORE STAT IN ST ATUS
The routine is written to reside in theupper portion of 8K RAM. Under mostcircumstances, this area is not used un-til the BASIC program employing the
routine gets too large. If the BASICpro-gram requires certain string manipula-tions, however, PETmay use high RAM
for string working area and clobber the
plotting routine. For example, the se-quence A$ = "123" : B% = "456":
C$ = A% + B$ will cause C$ to bestored inhigh RAMand destroy theplot-ting routine.
The routine is designed to be savedUSing the PET Machine LanguageMonitor. The routine is first entered inmemoryusing themonitor and then sav-ed with "8,01,PLOnER, 1E53,1FF8".Once saved, the routine can be loadedas would anyother program, with LOAD"PLOnER". The BASIC program usingthe routine can then be loaded in thenormal manner. ! A
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 11/68
~i
x-042: Qx-17 :R~-eXx-e "' X-e :Z "-8ZP-104
. . . X R - . . .X P -3 e."R-1 5:VP- 7
~ ZF-XR/Zp:Xr.XR/XP:VF-VP/VR~ PR INT "~"1 8 FOR ZI=-QX TO (49-QX)118 IF ZI<-ZP OR ZI>ZP GOTO 569138 ZT=ZI.XP/ZP148 Zx=ZI1S8 VS=-YP288 XL=INTC.S+SQReXP.XP-ZT.ZT»218 FOP X:=-XL TO XL
~
28 XT=SQprxr.XI+ZT.ZT)3 X T = < ~ " " : - : -.. xx:;reH
yi=.StCOS(3.XT)+COS(XT».YF
IS H IF Y5,<YT GOTO 364
68 Y1..YT: YI"YS2 GOTf) 31
~4 Y1=VC' Y -YT
Figure 5: The solid formed by rotating Y = 1/2cos(3X) + cos(X) about the Yaxis.
Since the assembly language routinerequires that the six parameters bepass-edfrom BASIC, the USRfunction with itssingle parameter argument cannot beused. POKE will not work, either, be-cause it will not accept negative values.The method I used to overcome this pro-blem was to have the assembly langu-
age routine access the BASIC workingarea to obtain the required parameters.
Float ing point variables are stored innormalized form, while lnteqer variablesare stored as two-byte signed numbers.The address of tllle startlnq byte of thevariable storage area is stored in loca-tion $7C. For simplicity, the plottingroutine assumes that the six requiredparameters-P%, Q%, R%, X%, Y%,and Z% -are the first six variables inthe program and are in that order.
BASIC Interface
After the run command is given, PETBASIC takes each variable in the order itis encountered and creates a workingstorage area for it following the lastBASIC statement. For non-subscriptedvariables the working storage is sevenbytes long. The first two bytes are thevariable name and the next five are thecurrent value.
To insure that all the requiredvariables are in ti lle proper place and inthe proper sequence, the assemblylanguage prograrin includes a verifica-tion routine starting at location $1EC3.This routine is caUed with the statement"SYS (7875)" and checks for thepresence and correct sequence of eachparameter. The results of the checks arestored in the PE T status word at location$020C.
September, 1979 MICRO - The 8502 ,Journal
If the value of the status word, 5T, iszero, all variables were located. If one ofthe variables is not located, the cor-responding bit of ST will be set. For ex-ample, ST = 6 would mean bits 1 and 2are set and thus that P% and Q% werenot found. Bit zero is not used. A typicalsequence to establish and verify theBASIC routine would be:
The important point is that the sixplotting variables must be the first six
variables mentioned in the program, andthey must be in the required sequence.Normally, the verification routine will on-ly be used for diagnostic purposes. Theplotting routine itself is entered with thestatement "SYS (7944)".
BASIC ProgramsThe plotting routine described above
can be used for any three dimensionalplot that satisfies the requirements ofbeing single valued in Y and having onlythe upper surface visible. For example,Figure 1 is a graph showing the effectsof combining two sine waves of differentfrquencies. The difference in frequencyis a function of Z; Y is amplitude and X is
time.
Figure 2 is a solid of revolution formedby rotating a sine wave about the Yaxls.The program is written a generalized for-mat, and any function can be used inline 300 as the function generating theSolid.
The scale and perspective of thefigure are determined in lines 30 thru 50.XR is the actual maximum value that Xcan take, while - XR is the minimum. XPis the number of plot points that thedistance XR wil l cover. For Figure 2, theXvalue runs from -1.5 pi to 1.5pi and isplotted from - 35 to 35. Changing XPchanges the width of the plotted f igure.
Similarly, the actual range of Y is YR,and YP is the plotted range of Y. Chang-ing YP changes the heighth of the plot-ted figure. The Xl cross section of thefigure is circular so the actual range of Zis the same as X - XR. However, theplotted range of Z - ZP depends uponperspective.
The larger ZP, the greater the ap-parent depth of the figure and the higherthe apparent posi tion of the viewer. Thevalue Y5 in line 150 represents thelowest plotted value of Y or the base of
the figure_
A potential problem with the programis that while each point in the Xdirectionis plotted, not every point in the Y direc-tion is. Thus for Z = 0, two consecutiveplot points might be (X1 = 3, Y1 = 12)and (X2 = 4, Y2 = 9)_While X1 and X2are adjacent, Y1 and Y2 are not. The pro-blem of such gaps is esthetically moresevere with some figures than others,
16:9
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 12/68
InFigure3, the problem has beencor-
ected by drawing a line between plot
points and eliminating the gaps_ The
program for Figure 3 is the same as for
Figure2except that thesection between
lines 300and 400has beenmodified.
Figure4 is a plot of the solid formedby revolving Y = 15e- x/3 about the Y
axis. The program is the same as forFigure 3 except that line 300 contains
the new function, line 150 is changed,and lines 10-50contain the new center
and scaling factors. Figure 5 is the solid
of revolution of Y = V2cos(3x)+ cos(x)about the Y axis. The program is thesame as that of Figures 3 and 4 except
for lines 10-50,150,and 300.
The process of rotating the plane
figure toobtain asolid of revolution is il-
lustrated in Figures 5 and 6_As describ-
ed before, the plot for agiven value of Z
is equivalent to a vertical slice throughthe solid parallel to the Xaxis. Figures 5
and 6 represent views of a solid form
aboveand thedotted line is'thepath of a
vertical slice.
The maximum radius of the solid is
XT.Theapparent distance of a point onthe circle from the circle's center (view-
:
Figure 7 : 1 View of a solid form above illustrating
the prob/~m of computing the Y value for each X
val us. !
Figure 6: View of a solid irom-ebove. The d 4 ttedline ;s the path of a vertical slice. '
16:10 MICRO - Th86f2 Journul
ed straight on) is XL. XL is computed inline 200 of the programs for Figures 2
through 5.
Thenext step is to find the Yvalue foreach paint on the dotted line between
- XLand XL_TheFORloop in line210in-
sures that each possible Xvalue is used.The process of computing the Y value
for each X value is larg€ly the reverseofthe process described above and is il-
lustrated in Figure 6.
Viewed from the top, the contours of
thesolid torrn.concentrlc circles, That is,the Y value of every point at a given
distance from the center is the same.For 'a point along the dotted line at an
apparent distance XI from the center,the Y value will be the same as for a
point where the inner circle crosses theZ = o tlne.
Thedistance of either point 'from the
center is the square root of(X12+ ZT2)-Thecalculation is perform-
ed in line 220and the resultant distance
is used to compute the Y value in line300. The plotting function is called in
line 380 and uses whatever values of
X%, Y% and Z% arethen current.
Septemper, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 13/68
An AIM·65 Notepad
A few short. assembly language routines implement anotepad and provide the basis for versatile output to theAIM·65 display. These techniques overcom a variety ofcommon output difficulties. '
Doyou want to learn how to use the
20-character AiM 65 display? This short
article describes several assembly
language subroutines that may beused
to display input/output information. The
entire program functions as a novel
"notepad" that jnay be used to leave a
message for someone else or for your-self. However, its primary utility will lie
in the applications that you designwhich usethe AIM 65 display. The pro-
gram listing is given, and its description
follows.
We will begin by describing some of
the features of the notepad program,and then return to adescription of some
of the subroutines that you might wantto duplicate in your assembly language
programs. Thenotepad program allows
theoperator to enter amessagecontain-
ing from oneto 256ASCII characters (in-cluding spaces) into locations $0200to
$02FFof the AIM65's memory space.
While entering the message, the
characters typed on the keyboard are
displayed on the 20-character display.
Themessage enters the right-hand side
of the display, and it is scrolled to theleft. If an error is made, the DEL key
allows the entire message to be back-spaced, and a new character or set of
characters may beentered.
Oncethe desired message is entered,
the RETURNkey starts themessagecir-
culating from right to left onthe display.
It circulates at a ratethat makes it easyto read. If more than one space (ASCII
value = $20) is encountered, the spaceis not displayed. Thus, a message that
contains less than 256 characters does
not take a noticeable amount of time to
display "empty" locations.
You can leave a message to yourselfsuch as "CALL SAMTONIGHT", or you
can remind your wife to "BE SURETO
LET ROVER OUT WHEN YOU GET
HOME." Of course there aremuch less
expensive ways to do this than by pur-chasing AIM 65, and it is doubtful
whether this notepad program will pro-
vide sufficient justification to convinceyour spouse that you ought to have a
computer. The program is more of anovelty that rnlqht beuseful as anadver-
September, 1979
tising gimmick, itl you are selling AIM65s, or to impress your friends.
i
On the other h nd, the subroutines
could beuseful ina largevariety of pro-
grams. I use seveat of the subroutines
in my Morse code program for the AIM65 (available fro me for $3.50). The
subroutines might beuseful incomputer
assisted instructi n programs that re-
quire interaction f the computer with
the operator. Or t ey might beuseful in
testing reading and comprehension
speed in certain sychological tests of
perception and co nition.
The read/write (RAM) memory loca-
tions from $A43 to $A43B, memorylocations which a e available on anoff-
the-shelf AIM 65, are used to store the
ASCII characters to be displayed. We
call these locatio s the display buffer.These20 location are filled with ASCII
spaces by the subroutine CLEAR star-
ting at address $ 3AO.Subroutine DIS-PLAY, starting at address $0360,
transfers the AS II characters in thedisplay buffer to he AIM 65 display. Itdoes this bymaki g useof a subroutine
in theAIM65montor called OUTDD1tht
is located at $EF B.
Subroutine OU 001 in the AIM 65ROMis very usef I in working with the20-character displ y. Thecontent of the
X register addres es the display in the
sense that X = $00 is the leftmostcharacter on the display, and X = $13(19) is the right- ost character on thedisplay.
Theaccumulat r, A, must contain the
ASCII representation of the character to
be displayed beore the jump to the
OUTDD1 subrout ne is made. The ac-
cumulator must a sobeORAedwith $80
before the subro tine call, or the cursorwill bedisplayed. With the accumulatorproperly loaded a d theappropriate "ad-
dress' in the X egister, a subroutinejump to OUTD 1 will display the
character.
A jump to S!broutine CLEAR, at$03AO,followed b a jump to subroutineDISPLAY will cle r the display. To putsome informatio in the display and
scroll it to the Iet, subroutine MODIFY(starting at add ess $0372) is used.
MICRO - ,",8 8502 Journal
Dr.Marvin L . DeJong
Department of Mathematics and PhysicsTheSchool of the Ozarks
Point Lookout, MO65726
Subroutine MODIFYstores the contents
of the accumulator in location $A44C.
Then it proceeds to shift thecontents of$A439to $A438,$A43Ato $A439,and so
on until it finishes by shifting the con-
tents of location $A44Cto $A44B.
Once the display buffer is properly
modified by subroutine MODIFY,then asubroutine call to DISPLAY will cause
thedown-shifted ASCIIcharacters inthedisplay buffer to appear as left·shifted
characters on theAIM65display.
The sequence of events, starting at
the beginning of the mainprogram, is asfollows: First, the display buffer is
cleared by subroutine CLEAR. Themessage buffer from $0200to $02FF is
cleared (loaded with ASCII spaces).
Next, an AIM 65 monitor subroutine,READ, is called to get a character from
the keyboard. As long as no key is
depressed, the monitor stays in this
subroutine. Akeydepression results ina
return to the main program with theASCII representation of the character In
the accumulator. Thecontents of the ac-
cumulator are transferred to themessagebuffer, using Y as an index forthe buffer's base address of $0200,
unless it is the ASCII character for RE-TURN, DEL,or the F1key.
The F1 key starts the entire program
over. The DEL key removes the lastcharacter from the message buffer, and
it backspaces (scrolls right) the displaybuffer and the display itself. The RE-
TURN key starts the message, and thiskey should be pressed only when the
desired messagehas beenplaced inthe
messagebuffer.
If a character is placed in the
messagebuffer, then it is alsodisplayedby calling subroutines MODIFYand DIS-
PLAY in succession. If the messagebuf-fer is filled, or if the RETURN key is
pressed, then the program will proceed
to scroll the entire messageacross the
display.
The message is displayed by getting
characters from the message buffer,starting with location $0200, and thencalling subroutines MODIFY and DIS-
PLAY in succession. A time delay is in-
16:11
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 14/68
0010: 0520 : 0362 8A TXA
0020: * M AI N PROGRA M 0530 : 0363 48 PH A
0030: 0540: 0364 B D 38 A4 LDAX $A438
0040: 0300 ORG $0300 0550: 0367 09 80 ORAI M $80
0050: 0300 20 AO 03 JSR $03AO 0560: 0369 20 7B EF JSR $EF7B
0060: 0303 AO 00 LDYI M $00 0570: 036C 68 PLA
0070: 0305 84 00 STY $00 0580: 036D AAT AX
0080: 0307 A9 20 LDAI M $20 0590 : 036E CA DEX
0090: 0309 99 00 02 ST AY $0200 0600: 036F 10 Fl BPL $0362
0100: 030C C8 I NY 0610: 0371 60 RT S
0110: 030D DO FA B NE $0309 0620:
0120: 030F 20 3C E9 JSR $E93C 0630: * M OD IFY S UB RO UT IN E
0130: 0312 C9 OD CMPI M $OD 0640:
0140: 0314 FO 1C BEQ $0332 0650, 0372 8D 4C A4 ST A $A44C
0150: 0316 C9 5B CMPI M $5B 0660 0375 A2 01 LDXI M $01
0160: 0318 FO E6 B EQ $0300 0670 0377 B D 38 A4 LDAX $A438
0170: 031A C9 7F CMPI M $7F 0680 037A CA DEX
0180: 031C DO 06 B NE $0324 0690: 037B 9D 38 A4 ST AX $A438
0190: 031E A9 20 LDAI M $20 0700: 037E E8 I NX
0200: 0320 88 DEY 0710: 037F E8 I NX0210: 0321 20 85 03 JSR $0385 0720: 0380 EO 55 CPXIM $15
0220: 0324 99 00 02 ST AY $0200 0730: 0382 90 F3 BCC $0377
0230: 0327 B O E6 B CS $030F 0740: 0384 60 RTS
0240: 0329 20 72 03 JSR $0372 0750:
0250: 032C 20 60 03 JSR $0360 0760: * B ACKSPACE SUBR
0260: 032F c8 I NY 0770:
0270: 0330 DO DD B NE $030F 0780: 0385 A2 12 LDXI M $12
0280: 0332 AO 00 LDYI M $00 0790: 0387 B D 38 A4 LDAX $A438
0290: 0334 B9 00 02 LDAY $0200 0800: 038A E8 I NX
0300: 0337 C9 20 CMPI M $20 0810: 038B 9D 38 A4 ST AX $A438
0310: 0339 DO 08 B NE $0343 0820: 038E CA DEX
0320: 033B A5 00 LDA $00 0830: 038F CA DEX
0330: 033D DO lB B NE $035A 0840: 0390 10 F5 BPL $0387
0340: 033F E6 00 I NC $00 0850: 0392 98 TYA
0350: 0341 DO 07 B NE $034A 0860: 0393 E9 14 SBCI M $14
0360: 0343 A9 00 LDAI M $00 0870: 0395 AA T AX
0370: 0345 85 00 ST A $00 0880: 0396 B D 00 02 LDAX $0200
0380: 0347 B9 00 02 LDAY $0200 0890: 0399 8D 38 A4 ST A $A438
0390: 034A 20 72 03 JSR $0372 0900: 039C 20 60 03 JSR $0360
0400: 034D 20 60 03 JSR $0360 0910: 039F 60 RT S
0410: 0350 A9 FF LDAI M $FF i 0920:
0420: 0352 8D 97 A4 ST A $A497 0930: * C LE AR S UB RO UT IN E
0430: 0355 2C 97 A4 EI T $A497 0940:
0440: 0358 10 FB BPL $0355 0950: 03AO A2 13 LDXI M $13
0450: 035A C8 I NY 0960: 03A2 A9 20 LDAI M $200460: 035B 18 CLC 0970 : 03A4 9D 38 A4 ST AX $A438
0470: 035C 90 D6 BCC $0334 0980: 03A7 CA DEX
0480: 0990: 03A8 10 FA BPL $03A4
0490: * D IS PL AY S UB RO UT IN E 10 00 : 03AA 60 RT S
0500: I D=
0501 : 0360 ORG $03600510: 0360 A2 13 LDXI M $13
i
!
16:12
~
MICRO - The ~502 J ou rr 8 1 September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 15/68
serted ($FF is loated into the divide-
by-1024 counter on the 6532 chip) unless
more than one space occurs in succes-
sion. In that case, the subroutines and
the time delay are not used at all, and
the program keeps searching through
the message buffer until it finds another
non-space ASCII character, in which
case subroutines MODIFY and DISPLAY
are called aqain.
One subroutine that remains to be
mentioned is BACKSPACE used by the
DEL key. It starts at $0385 and its effect
is to backspace the display buffer,
replacing the leftmost character with
the appropriate character from the
message buffer. It then calls subroutine
DISPLAY to show the typist that the
character has, in fact, been deleted and
the entire message has been backspac-
ed.
Again, I think the subroutines
MODIFY, DISPLAY, CLEAR, READ, and
OUTDD1 will be of considerable use if
you are writing programs that use the
keyboard or the display on the AIM 65_
All of them are quite short, and a little
study will show how they work. Most in-
volve only simple loops and nothing
more complicated than indexed ad-
dressing. Mimic or echo your display on
your computer storefront and you will
have something that will really catch the
eye, but don t ask me where to get the
appropriate neon sign elements.
A summary of the subroutines
follows:
DISPLAY Takes the contents of
locations $AS438 to
$A44B and transfers
them to the AIM 65
display. A is modified,
and X = 0 on return.
MODIFY Successively shifts the
contents of locations
$A439 to $A44C to loca-
tions in memory whose
addresses are one less.
The contents of the ac-
cumulator, when the
subroutine is called, will
be stored in location
$A438. A and X are modi-
fied.
CLEAR Loads $20 in the display
buffer, locations $A438
to $A44B. A and X aremodified.
BACKSPACE Reverses the effects
found in MODIFY and, in
addition, loads location
$A438 with the contents
of the message buffer in
$0200 + (Y - $13). Y
points to the last entry
made in the message
buffer. X and A are
modlfied.
September, 1979
T he MicroC puter I nvestor's
Associatio is a non-profit,
.profession 1 organiiation which
was founde three years ago to
enable mem ers to share data and
;informatio • For an information
packet, se d. $1. GO to:'
J ac k Wi Ua ms, MC IA,
902 A n 'd r s on Dri ve
Frederi ksburg, VA 221101
T he N e w E h land APPLE T ree (NEAT}is a group,of APPLE owners and
I.!sersWh o ave come'together to
,learn mo r e about their APPLEs.
trade pro'g ams and information
and enjoy he world of personal
computers s much as possible.
"liE p rog ra ms, y ou r
and your partici-
Users' Group is at-
locate persons in ,
1D~"al~['u gton area, in-a local users' group.
p~ease write or
s e r s • . .r o u p'
Jones
45 th Av en ue
OR 912T31 - 4 9 0 8
ews, etc.
in ex-
. 'O rm at io n a n d s of t-, th er c lu bs . ' Co nt ac t:
t h e . S o u th
MICRO - + The 6502 Journal
ware and technical information
ar)d to help ,new APPLE users use
their APPLES. T hey plan to es-
tablisha quarterly newsletter
and anticipate installing an on
line system where anyone can
have access to club information.
I f you wish to correspond or
j Oi n, c on ta ct :
David Hall, Sec.
2300 N'~ 1 35t h . S t .
M ia mi , ' FL 3 3 1 6 7
Einleitung: Die vorliegende Nr;
o i s t . a ls I n fo r ma t io n sb r os c hu r e
tiber den Verein gedacht. Sie
stimmt in wesentlichen T ellen
mitdem Entwurf uberein. Zweck
diesel' Zei tschrift ist es, .als
I nfo rma ti on5 fo rum fu r A P.E 'LE-
B enutzer zu dienen. Del' Name
A pp le .-C om -Po st w ard e i n a bg e-
wandelter Form von derZeit-
5 ch ri ft C OH PPO ST ·d es . R ec he n-
z en tr um s d el ' R uh n- Un iv er si ta t
B Oc hu m u be rn om me n. Daa Kurzel
nc;'Om lf'5011 andeuten, dass es
5:lch beim APPLE um einen Computer
bande.Lt. Wu nch e s ow ie dr-uckbar-eArtike'~ sfnd sehr' erwan5.cht.
APPLE User. Group Europe
P.ostfach 4068
0'-4320 Hattingen
We 5t Ge rm an y
T he WlC Users' Group in N e w York
City is still alive. Their new
addres5 i5:
T he DrY5dale Security
55 water St.
N e w , 'Yo r k, . N Y 10004
( 5 1 . 6 ) . 5 7 9 - 4 2 9 5
Washington Area KIM Enthusia5tl!
(WAKE.) meet each month at the
M cGr aw -H il l C on ti n' ui ng E du ca ti onCenter in Wa5hingtoD:., D~C. to
study operation, expansion, and
a pp li ca ti on s o f K IM '-1m ic ro -
computers. For a copy of the
current WAKE new51etter, send
a s .t a mp . ed · , s e lf . -a d dr e ss e d e n -
velope.to:WAKE
c/o Ted B each,
5T ,):2Wnliamsburg B lvd.
Arlington" VA 22207
16:13
•
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 16/68
AIM 65 is fully assembled, tested and warranted. Withaddition of a low cost, readily available power supply,
ready to start working for you.AIM 65 features on-board thermal printer andalphanumeric display, and a terminal-style keyboard. I thas an addressing capability up to 65K bytes, and comeswith a user-dedicated 1K or 4K RAM. Two installed 4K ;ROMS hold a powerful Advanced Interface Monitorprogram, and three spare sockets are included to expandon-board ROM or PROM up to 20K bytes.An Application Connector provides for attaching a TTty
and one or two audio cassette recorders, and gives ext~r-nal access to the user-dedicated general purpose I/O lin s.Also included as standard are a comprehensive AIM 5
User's Manual, a handy pocket reference card, an R650Hardware Manual, an R6500 Programming Manual and nAIM 65 schematic.AIM 65 is packaged on two compact modules. The
circuit module is 12 inches wide and 10 inches long, thE!keyboard module is 12 inches wide and 4 inches long.They are connected by a detachable cable.
THERMAL PRINTERMost desired feature on low-cost microcomputer systems I ..
• Wide 20-column printout• Versatile 5 x 7 dot matrix format• Complete 64-character ASCII alphanumeric format• Fast 120 lines per minute• Quite thermal operation• Proven reliabili ty
FULL-SIZE ALPHANUMERIC KEYBOARDProvides compatibility with system terminals ...• Standard 54 key, terminal-style layout• 26 alphabetic characters• 10 numeric characters• 22 special characters
• 9 control functions• 3 user-def ined functions
TRUE ALPHANUMERIC DISPLAYProvides legible and lengthy display ...• 20 characters wide• 16-segment characters• High contrast monol ithic characters• Complete 64-character ASCII alphanumeric format
ROCKWELL INTERNATIONAL
PROVEN R6S00 MICROCOMPUTER SYSTEM DEVICESReliable, high performance NMOS technology ...• F:6502 Central Processing Unit (CPU), operat ing at 1MHz. Has 65K address capability, 13 addressing modesand true index capability. Simple but powerful 56instructions.
• Fead/Write Memory, using R2114 Static RAM devices .
.clvailable in 1K byte and 4K byte versions.• 8K Monitor Program Memory, using R2332 Static ROMdevices. Has sockets to accept additional 2332 ROM or2532 PROM devices, to expand on-board Programmemory up to 20K bytes.
• F6532 RAM-Input/Output-Timer (RIOT) combinationdevice. Multipurpose circuit for AIM 65 Monitor functions.
• Two R6522 Versat ile Interface Adapter (VIA) devices,which support AIM 65 and user functions. Each VIA hastwo parallel and one serial 8-bit, bidirect ional I/O ports,two 2-bit peripheral handshake control lines and twofully-proqramrnable 16-bit interval timer/event counters.
BUILT-IN EXPANSION CAPABILITY• 44-Pin Application Connector for peripheral add-oris• 44-Pin Expansion Connector has full system bus• Both connectors are KIM-1 compatible
r rv AND AUDIO CASSETIE INTERFACESSta rdard interface to low-cost peripherals ...• 2') mao current loop TIY interface• Interface for two audio cassette recorders• TNO audio cassette formats: ASCII KIM-1 compatiblea ro binary, blocked file assembler compatible
ROlli RESIDENT ADVANCED INTERACTIVE MONITORAdvanced features found only on larger systems ...• r v onitor-generated prompts• Sngle keystroke commands• Address independent data entry• Debug aids• E-ror messages• Option and user interface linkage
ADVANCED INTERACTIVE MONITOR COMMANDS
• Major Function Entry• Instruction Entry and Disassembly• Display/Alter Registers and Memory• Manipulate Breakpoints• Control Instruction/Trace• Cantrol Peripheral Devices• C3.11User-Defined Functions• Comprehensive Text Editor
LOW COST PLUG-IN ROM OPTIONS• 41CAssembler-symbolic, two-pass• 81CBASIC Interpreter
POWER SUPPLY SPECIFICATIONS• + 5 VDC ± 5% regulated @ 2.0 amps (max)• + 24 VDC ± 15% unregulated @ 2.5 amps (peak)0.5 amps average
PR ICE: $375.00 (1K RAM)Plus $4.00 UPS (shipped in U.S. must give street address),$10 parcel post to APO's, FPO's, Alaska, Hawaii, Canada ..$25 air mail to all other countries
We manufacture a complete line of high quality expansionboards. Use reader service card to be added to our mail inglist, or U.S. residents send $1.00 (International send $3.00U.S.) for airmail delivery of our complete catalog.
2967 W. Fairmount Avenue
Phoenix AZ. 85017
1602)265-7564
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 17/68
App lesoft Renum .bering
Here is a fast and reliable utility for APPLE pro-
grammers who do not have disks. It can be adaptedto the PET and other Microsoft BASIC systems.
The need for a program written in Apple-soft to renumber Applesoft programs ismoot now that APPLE has made avail-able the 3.2 version of its disk operatingsystem, that is, i f one has a disk system.I wrote the present renumbering pro-gram while my disk drive was out of ac-tion, before the release of the 3.2 ver-sion, and after reading Mr. Carpenter'sprogram in MICRO 12:45 based in turnon a PET program by Jim Butterfield,MICRO 8:33. Since some people do nothave disks and since Applesoft pro-grams can be adapted to the PET andother systems using Microsoft BASIC,my renumbering program still may findusers.
Comparison
This Applesoft renumbering program(hereafter called RENUMB) is dreadfullyslow; it took 7.9 minutes to renumber a8.5K program. Even at that, it's fasterthan Mr. Carpenter's program, whichtock 13.2 minutes to renumber the same8.5K program (and also had a problemwith one THEN). In comparison, the 3.2disk renumber program did the job in 7.8seconds.
Like Mr.. Carpenter's program, RE-NUMB cannot change the line numberafter a GOTO, a GOSUB, or a THENequivalent of a GOTO when the new line
number has more digits than the oldone. The program prints a list of thesechanges which must be made by hand. Ifthere is not enough space, RENUMB in-serts only the least significant digits.For example, the line
100 ON L GOTO 180, 190
with a l ine number shift upwards by 1005would be given as
1105 ON L GOTO 185, 195
September, 1979
J.D. Childress5108 Springlake WayBaltimore, MD 21212
With the manual change instructionsshown here:
LINE 1105: INSERT 1185 AFTER GOTO.
LINE 1105: INSERT 1195 AFTER COMMA.
If there is more space than needed,RENUMB inserts leading zeros. (Notethat the Applesoft interpreter preservessuch leading zeros whereas the 3.2 diskrenumber program does not.)
RENUMB has one useful feature incommon with the 3.2 disk renumber pro-gram, namely the capability of renum-bering only a specified portion of a pro-
gram. This feature must be used withcare since one can renumber a part of aprogram with line numbers equal to or inbetween some of the line numbers of theremaining part of the program.
Unlike the 3.2 disk program, RE-NUMBdoes not order such lines into the propersequence. If you really want that, youmust run RENUMB first then use thescreen/cursor editing controls to copythe out-of-sequence lines through theApplesoft interpreter. The reader is leftwith the nontrivial problem of gett ing ridof the still remaining out-of-sequencelines.
Operation
To use RENUMB, one needs to ap-pend RENLIMB to the program to be re-numbered. The machine language AP-PEND program and procedure given byMr. Carpenter are recommended·. Afterthe two programs are properly loaded,renumbering is accomplished by a RUN63000 command. Give the requested in-formation, then be patient; rememberthat RENUMB is numbingly slow.
MICRO - The 6502 Journal
Copy carefully all the manual changeslisted. I f you want to see them again, youcan do so by a GOTO 63360 commandprovided you have done nothing to clearthe variables, i.e., have not given anyRUN commands or changed any line ofthe program.
You may use the SPEED command toslow up the display and the CTRL-Ccommand to interrupt the displaywithout clearing the variables. Once thevariables have been cleared, there isnothing you can do except start from thebeginning, that is, load the programsagain.
At the beginning of the program run,you are asked for a rough estimate ofthe number of program lines (numberedlines) to be renumbered. Be generous,within limits of available memory. If yourestimate is too small, you will get a
?BAD SUBSCRIPT ERROR IN 630XO
where X = 6, 7, or 8 since your est imateis used for array dimensioning. Unlessyour program is especially rich in bran-ches, an estimate, say, about 50%greater than the number of l ine numberswill suffice.
Program DeSign
The design of RENUMB is quite sim-ple. First RENUMB searches the pro-gram being renumbered for line numbers(and their memory locations) and the linenumbers (and memory locations) afterGOTO's, GOSUB's, THEN's, and COM-MA's in multiple branches. This searchis done by lines 63040-63090 and forbranches, the subroutine at 63250. Lines63130 and 63140 make the changes atthe branches and line 63180 at thelabels. The routine beginning at 63350
16:15
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 18/68
prints out those changes that must bemade by hand.
All else is bookkeeping. Note: In line63030, START is the address in memoryof the beginning of the program. This isprobably the only thing that needs to bechanged for RENUMB to run on the PET(try START@1025 per Butterfield) andpossibly on other systems uslnq Micro-soft BASIC. Finally, if you write veryGOTOy and GOSUBy programs, you maywant to change the definition of DO inline 63030.
Applesoft
Butterfield gives considerable infor-mation about the insight into the struc·ture of Microsoft BASIC. What is evenhandier is your own APPLE II. Let it beyour textbook and teacher. For example,start ing fresh with Applesoft in the corn-puter, enter
1 PRINT: GOTO 521521 PRINT "FREE": 1ST521
While this lit tle prog am runs withouterror, that is not nec ssary. You canenter anything you wa t to see how Ap-plesoft handles it.
Now go to the monit~r and look at
801·OC08 01 00 BA AAB 35 32 31 00 I
80C· 10 08 09 02 BA ~2 46 52 45 45 223A iBC 35 32 31 00
810·0000 i
I
for ROM Applesoft (1001 for RAM Ap-plesoft). In the above lines, arrangedhere for clarify, OC, 08 10 08, and thefinal 0000 point to the n xt instruction inmemory, the 00 00 pointer labelling theend of the program. 01 )0 and 0902 are
the line numbers, 1 and 521 respectively.BA is the token for PRINT; 3A is theASCII code for the colon; AB is the tokenfor GOTO; 353231 gives the line numberfor the GOTO; and 00 indicates the lineending. 2246 524545 22is a direct ASCIIcode rendition of "FREE". Finally BC isthe token for LIST and 353231 is the linenumber 521 after LIST.
Study of the above paragraph showsthat Applesoft puts things into memory
almost exactly the way you type them onthe keyboard, except that the interpreterremoves spaces, puts in instruction ad-dresses, translates its command wordsinto tokens, and uses ASCII code andhexidecimal, low-order bit first notation.
I think we can be confident thatMicrosoft has written most of theirBASIC interpreters in as similar afashion as possible. After all, why notexploi t one's own good work. J .i
LIST I NG--<\PPLESOFT RF.NlIMBEPI ~IGPROGRA'"
6 2 9 9 9 END63000 HOME: VTA.B (3): po I ~!T "
RENUMBERI~G ppnGRA~": "PINT
63010 PRINT "lI~IES TO BE o~NI!M1lERED:": INPUT" ~EGI~IP.IG L INE--";BG~l: INPUT" ENDP!GLI~IE--";TP~: I~IP'JT" TOTALNUMBEROF LIMES (ROUGHLY)--";D: PRI~T
63020 I~PUT "R~NUMB~PED BEGINNING LINE--";SK: PIPIlT "HIC"EIAENT--";ADD
63030 START .. 256 * PEEK (10~) +
PEEK (103):M = START + 2 : 0 0INT (D I ~): DI~ LS(D),L
N(DD),LM(DD),LOC(DD),NA$(DD), ND(DD) , INS (DD) , I MS (OD)
530~0 L • L + I:LS(L) • M:LC .. 256 * PEEK (M + 1) + PEEK (~): IF LC > 62900 THEN 63100
63050 FOR J • M + 2 TO M + 155:TST. PEE!< (J): IF TST .. 0 THENM • J + 3: GOTO 630~0
63060 IF TST • 171 THEN NA!(K +
1) • "GOTO": GOSUB 63250
63070 IF TST • 176 THEN NA$(K +
1) • "GOSUB": GOSliB 63250
63080 IF TST • 196 ANn PEE~ (J +
1) > ~7 AN~ PEEK (J + 1) <58 THEN NA$(K + 1) • "THEN":
r,oSUB 63250630CJO NEXT63100 FOP J • 1 TO L:LNU • 256 *
°EEK (LS(J) + 1) + °EEK (LS (J) l : IF UIU > TPM OR L"IlJ >62900 THEN PRI ur : po I 'IT "RENUMREPING C0MPlETED THPOUn~LI~:E ";LUN;",": GC'Tf') 53350
63110 IF LNl' < ~GN T~PI 63P106312~ S~! .. "0000" + STP$ (SI<):S
K~· RIGHTS (SK~,5)
63130 FOR I .. 1 TO K: IF UIU < >INS(I) THEN NEXT: GOTO 631
,90F3HO F('lR KA. 1 TO NO(I): Pt)k'E
LOC(I) + 1 + N{)(I) - KA , '1A.L( MIDt (SKt,6 - KA,I)) + k8:"lEXT
63150 IF LNU" INS(I) T~~N IMS(I) • SK
63160 IF LEN ( STP! (SK)) > NO(I) THEN PCR = 1
53170 ~!EXT63180 SO· INT (SI<' I 255): POK~
(LS(J) + 1),SO: POKE (LS(J))
,SK - 256 * SO63190 FOR I • 1 TO K: IF LNU .. L
N(I) THEN U)(I) .. SK: IF LNU
< BGN THEN LM(I) • LNU63200 'lEXT
63210 SK • SK + ADD:LUN • LNU63220 NEXT63250 K . . K + I:LN(K) .. LC:SU PEEK
(J + 1) - ~8
63260 FOR KA • J + 2 TO J + ~:CPR . PEEK (KA): I F cpo "' 0 OR
CPR· 58 OR CPR .. ~~ THEN GOT~63290
632;0 SU • 10 * SU + CPR - 4 863280 NEXT63290 LOC(K) .. J:NO(K) • K A - 1 -
J: INS(I() • SU:J .. KA - 1: IFCPR .. 4~ THF:N ~lAH K + 1) • "
CQ~MA":J .. KA : GOTO 63250
63300 RETUR"I63310 ENrl63350 IF PC? < > 1 THE"! ENn
63360 PRINT: PPINT "MOTE: YOU '-A
UST ~AKE THE F"lLnWI~G CH<\N-": PRINT "GES MAf'-lUALLY:": PI:lI"lT
63370 F0P I • 1 T~ K: IF LEN ( ST"~(IMS(I))) < . . ND(I) THEN NEXT: END
63380 PPI'1T "LINE ";LM( 1);": I'!SERT ";IMS(I);" AqEP ";NA$(I
);"."63390 NEXT: END
i
16:16
I
MICRO - The 8~2 Journal
i
September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 19/68
MOVE IT: Relocating PE~TSource Programsand Object Code
A useful program need not perform the enltire tas k. If tenpercent of the total coding effort achleses nlnety-ninepercent of the desired result, perhaps manual interven·tion will be more efficient than additionallprogramming.
MICRO readers probably know thatwhen a PET program is saved oncassette tape it normally loads back intothe same area of memory. Several timesrecently I wished that was not the casebecause I found the need to relocate ln-formation already saved.
For example, I originally assignedsource code for an assembler to whatlater turned out to be an inconvenientarea of memory. Being naturally lazy, Ihad no desire to retype the long sourceprogram into the newly assigned
memory region. Let the PET move it, Isaid-and it did. This article tells how.
Information one might wish torelocate falls into three categories. Ihave already mentioned ASCII sourcecode which would require no modifica-tions after being moved. The nextcategory also requires no extra work.BASIC programs which you might wantto append, relocate, or relocate, do in-deed have address links which need tobe modified. Fortunately for us the PEThas routines which do this automatical-ly.
Finally, machine language programs
are not always located where they do themost good and it could becomenecessary to move them to more usefulareas. In this case many changes pro-bably will be necessary. Instructionswhich use absolute addressing modesand indexed pointers are the principleculprits. Finding the necessary changescan be difficult without a source listingof the original program.
The first method I considered to moveprograms (the first step in relocation)was a modified program from the FirstBook of KIM (MOVEIT, p. 127). I rejectedthis approach for a number of reasons,but mainly because I was convinced the
PET had the routines already built in. Anarticle by Jim Butterfield (bless hisbones) in the PET User's Notes (Vol. 2,#1, p. 7)gave me the concept I needed tohave the PET operating system help re-locate code already saved on tape.
This method has the decided advant-age of not requiring the old memorylocations to be present. A programoriginally located at hex 6000 and saved
September, 1979
on tape in another PETcan be loaded in-to an 8K machine at hex 4')0 if desired.
After placing the mach ne languageprogram in a ne'l ' l area of memory, it isnecessary to make vari JUS addresschanges. These rnodltlca ions can bemade with a machine language program.See The First Bopk of KIM, p. 130, for anexample. Since I!feel more comfortableworking in BASIC, I develcped a simpleBASIC program to do most of the ad-dress modificati<pns.
The program i$ not perfs ct, so any re-maining chanqes or corrections need tobe done with a . monitor program. Ideliberately used an easy-to-write(slightly flawed) JIlrogramin combinationwith manual correction, ln s tead of spen-ding lots of time, writing an elegant pro-gram which did Elverything. I felt this ap-proach gave the best results becausethe total time tq accomplish a task iswhat really counts.
In summary, the relocatlnq methoddiscussed here aan be broken down intothree essential steps:
1. Loading th~ informction on the
cassette tape into the new area ofmemory.
2. Running a BASIC proqrarn whichmakes most of 1 he addresschanges.
3. Manually correctlnq e rors, using amonitor pro$ram, and making othernecessary qhanges IT issed by thesimple minded BASIC program.
As an example, I have picked what Ihope is a useful exercise: relocatingCommodore's machine lanquaqe moni-tor. It is important to have availablemonitors which are located in dif ferent
areas of memoty. When we want tomodify low areas of memory, it isnecessary to use a monitor in highmemory, and vice versa.
Furthermore, the top of memory isconsistently changing as PET ownersadd extra memorty. It is a decided disad-vantage to be stuck witt; only a lowmonitor, as supplied by Commodore.The latest PET's have a mcnitor in ROM,
MICRO - The 8502 Journal
Professor Harvey B. HermanDepartment of Chemistry
The University of North CarolinaGreensboro, NC 27412
l E A 8 A 9 23 85 F9 20 5E l E 29
l E B O 20 CF FF C 9 2C FO 55 c gl E CO O D FO O B E O 10 FO Fl 95l E C8 23 E 6 E E E 8 D O E A A 5 20
l E D O C9 06 D O C 8 A 2 00 8E O Bl E D 8 02 A 5 Fl D O 03 4C 9 B l C
l E E O C9 03 B O F9 20 67 F6 20
l E E 8 3 B F8 20 FF F3 A 5 E E FOl E FO 08 20 95 F4 D O 08 4C 9 BlEF8 lf 20 A E F5 FO F8 20 4D
l D O O O A 60 3A 3 B 52 4D 47 5 8l D 08 4C 53 ! 1D lD 1D 1D 1D lD J
l D l 0 I T I : : J . : I D Cl B l 2C 5E D 7 FDl D 18 9E 9E 20 50 43 20 20 5 3l D 20 52 20 41 43 20 58 5 2 20
l D 28 59 52 20 53 50 A 5 O D D Ol D 30 06 20 F2 1£ 20 37 l E 20l D 38 37 l E A 2 00 B D l A [!.] 2 0
l D 40 D 2 FF E 8 E O 13 D O F5 20l D 48 F2 l C A 2 2E A 9 3 B 20 22
l D 50 ~ 20 37 ~ 20 08 ~ 201D 58 E 7 .l.f 20 B B u ;_ FO 4D 20
l D 60 90 ~ 20 4F ~ 90 48 20l D 68 3F ~ 20 90 ~ 20 4F ~l D 70 90 3D 20 3F 1E A O 00 B 9l D 78 4A ~ 30 06 20 D 2 FF C8l D 80 D O F5 29 7F 20 D 2 FF 2 0
l D 88 2A F3 FO 20 A 6 O A D O l C
l D 90 20 A 3 1£ 9 0 17 20 F2 l~
l D 98 A 2 2E A 9 3 A 20 22 l E 20l D A O 37 l[ 20 0 4 ~ A 9 08 20l D A 8 B B 1£ FO D B 4c 57 1£ 4 Cl D B O 9 B .l.f 20 5E ~ 20 4F l[
l D B 8 90 03 20 B 2 l C 20 E 7 l Cl D CO D O O A 20 5E 1E 20 4F l E1D C8 90 E 5 A 9 0 8 85 21 20 9 0
1D D O ~ 20 CF K D O F8 FO D 4l D D 8 20 CF FF C 9 O D FO O C C91D E O 20 D O CC 2 0 4 F ~ 90 03
1D E 8 20 B 2 li A 6 1F 9A A 5 l A1D FO 48 A 5 19 4 8 A 5 l B 48 A 5l D F8 1C A 6 l D A 4 1E 40 A 6 1F
1FO O F6 20 22 F4 20 8A F8 20l F08 13 F9 A D O C 0 2 29 10 D O
1F10 E 5 4c 57 1C 20 4F l E A 51F18 11 85 F7 A 5 12 85 F8 20l F20 CF FF C9 20 FO F9 C9 O D
1F28 FO A 4 C9 2C FO 03 4c 9c
1F30 .!E. 20 4F 1E A 5 11 85 E 5.1F38 A 5 12 85 E 6 A 5 20 C9 06
l F40 FO 92 A 2 00 2 0 B 1 F6 4c1F48 57 ~ O D 2 0 2 0 20 20 20l F50 20 20 20 20 2 0 30 20 20
1F58 31 20 20 32 20 20 33 2 01F60 20 34 20 2 0 35 20 2 0 36
1F68 20 20 B 7
16:17
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 20/68
lCOO 00 OD 04 OA 00 9E 28 31
lc08 30 33 39 29 00 00 00 A91C10 27 8D 1B OA A 9 iRl 8D 1C
1C18 02 A9 ~ 85 7D A 9 6B 85
lC20 7c A9 43 85 21 D O 12 A9
~ C28 42 85 21 D8 4A 68 85 1E
1C30 68 85 1D 68 85 1C 68 85
1C38 1B 68 69 FF 85 19 68 69
1C40 FF 85 1A B A 86 1F 58 201C48 F2 _K A S 21 A9 2A 20 22
1C50 1& A 9 52 85 OD DO 2B A9
1C58 00 85 CA 85 OD 85 OA 201C60 F2 ~ A 9 2E 20 D2 FF A6
lC68 20 EO 02 FO 04 EO 03 D O
1C70 06 20 3A 1E 20 37 1E 20
1C78 90 1E c 9 2E FO F9 C9 201C80 FO F5 A2 07 DD 02 IJ] D O
1c88 OF A5 20 85 OE 86 20 B D
1C90 OA W 0 48 BD 12 li m 48 601C9S CA 10 E9 A9 3F 20 D2 FF
1CAO 4C 57 ~ 38 A5 13 E5 11
1CA8 85 OB A5 14 E5 12 A8 05
1CB O OB 60 A5 11 85 19 A5 12
1CB 8 85 1A 60 85 21 AO 00 201CCO 3A 1E B1 11 20 13 1E 20
1CC8 F7 1C c6 21 DO F1 60 20
1CDO 5E 1E 90 OD A2 00 81 11
1CD8 C1 11 FO 05 68 68 4C 9B
1CEO 1C 20 F7 ~ c6 21 60 A 9
1CE8 1B 85 11 A9 00 85 12 A 9
ICFO 05 60 A 9 OD 4C D2 FF E6
1CF8 11 DO 06 E6 12 DO 02 E6
Location Object Code Source Codeand Notes
Original Modified Orig nal Modified
0447 1C47 20F~04 20F21C JSR CRLF (1)
0484 1C84 000:W5 000210 CMP CMOS, X (2)
0414 1C14 A90L . A91C LOA # BRKE (3)0511 1011 06 1E .BYT ZZ8 (4)
073E 1F3E C90€i C912 CMP #6 (5)
NOTES
(1) Absolute address identified and changed by BASIC MODIFY
program.
(2) Address not changed by BASIC program. Changed manually
with the monitor.
(3) High order byte of address of the break vector stored at $21 C
must be changed.
(4) Jump table value (address of command) has to be relocated.
(5) Code which was erroneously changed because of preceedinghex 20. Changed back manually with the monitor.
Typical Changes While Relocating Monitor Program
5 REM MODI FY PROGRAM (FLAWED)
6 REM 1K LOCA TIONS ~EA RCH ED
7 REM HA RVEY B. HERM AN
8 N=O
10 FOR 1=0 TO 1023
15 REM DEC 7168 IS H EX 1COO2 0 L =7 16 8+ I
3 0 A = P EEK (L): B=P EEK (L + 2)35 REM DEC 32 & 76 A RE H EX 20 (JSR) & 4C (JMP)
3bREM PGS . D EC/HEX 4,5,6 & 7 S EA RC HE D
40 IF A=32 A ND B=4 T HEN GOSUB 1000
50 IF A=32 AND B =5 T HEN GOSUB 100060 IF A=32 AND B =6 T HEN GOSUB 1000
70 IF A=32 AND B =7 T HEN GOSUB 1000
80 IF A=76 AND B =4 T HEN GOSUB 100090 IF A=76 AND B =5 T HEN GOSUB 1000
100 IF A=76 A ND B=6 TH EN GOS UB 1000
110 I F A=76 AND B=7 TH EN GOS UB 1000
120 NEXT I125 PRI NT "LOCA TI ONS MODIFIED =";N
130 ST OP999 REM MODIFIED TO DEC 24/H EX 18 HI GHER
1000 PO KE L +2 ,B +241 00 5 N =N +11 010 R ET UR N
16:18 M IC RO - The 8502 Jour l11 ll
but the general ideas presented here willstill be useful to owners of thosemachines in other applications.
The art icle by Jim Butterf ield showeda procedure which loaded the tape intothe screen memory area. I wanted tomove the monitor program to the top ofmemory, 8K in my PET.This.procedure isshown in Figure 1. Step 2 loads the tape
header. I used the monitor program, inlow memory, to modify the tape addressfrom the header in steps 4 and 5. Movingthe program on tape to the new area ofmemory occurs in step 7. After protec-ting the program, step 8, it is necessaryto make address modifications beforethe program can be run successfully.
Most of the address modificationscan be made with the BASIC program.The program looks for JSR (hex 20/dec32) and JMP (hex 4C/dec 76)values in thenew memory locations. The majority ofchanges necessary were in those two in-structions alone. When the programfinds dec 32 or dec 76 followed by a loca-
tion in pages 4 through 7 (where theoriginal program was located), it modi-fies the page number to the relocatedvalues, 28 through 31 respectively. Thisprogram is quite a bit slower than amachine language version, but it certain-ly runs faster than I could type in thechanges.
Since the BASIC program has flaws, itis important to check for errors. The
September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 21/68
1EOO 9A 4C 8B c3 A2 01 DO 02
1E08 A2 09 B5 10 48 B5 11 20
1E10 13 1E 58 48 4A 4~ 4A 4A
1E18 20 2B 1E AA 68 29 OF 20
1E20 2B ~ 4 8 8A 20 02 FF 68
1E28 4C 02 FF 18 69 06 69 FO
1E30 90 02 69 06 69 3~ 60 20
1E38 3A ~ A9 20 4C D2 FF A2
1E40 02 B5 10 48 B5 12 95 10
1E48 68 95 12 CA DO F3 60 201E50 5E 1E 90 02 85 12 20 5E
1E58 ~ 90 02 85 11 60 A9 00
1E60 85 OF 20 90 1E C9 20 DO
1E68 09 20 90 1E C9 20 DO OE
1E70 18 60 20 85 1E OA OA OA
1E78 OA 85 OF 20 90 1E 20 85
1E80 ~ 05 OF 38 60 C 9 3A 08
1E88 29 OF 28 90 02 69 08 60
1E90 20 CF FF C9 00 to F8 68
1E98 68 4c 57 lk 4c 9B 1f 20
1EAO 90 1E A9 00 85 EE 85 FA
relocated monitor program contained
two unnecessary changes which were
easy to find and change back. I manually
corrected these errors using a low moni-
tor and looked for other locations which
needed to be changed. All instructions
besides JSR and JMP that have an ab-
solute addressing mode referring to
relocated addresses must be modified.
Much harder to find are table values and
page zero references. A source listing or
disassembler output listing is essential.
I hao the advantage of having the
source code for the monitor (PET User
Manual, p. 100)and changes were easier
to identify. However, I have successfully
relocated code with just a dissassembl-
ed listing and no comments or
mnemonic variable names. A few ex-
amples of what to look for are shown in
Figure 2.
The trickiest part of relocating in-
volves indirect instructions. The instruc-
tion itself does not have to be changed,but the numbers stored as page 0
pointers may have to be. Somewhere in
the code, there may be a combination
like LOA $051 STA $35, which would
have to be changed to LOA #101 STA
The BASIC modify program changed 72
locations (2 of which were in error). I
have underlined the correct changes and
put an asterisk beside the corrected er-
rors. Fourteen locations needed to be
changed manually, and these have been
boxed. By my count, more than 3/ 4 of the
changes were made by the BASIC pro-
gram. I was satisfied, but others may
wish to write a more comprehensive
utility.
Once properly moved and relocated,
the monitor can be run (SYS 7183) and
saved on tape (S 01, 1COO, 1F6B). The
break vector is set automatically on
entering the program. After the first run,
the program can be restarted with SYS
1024 which is easier to remember. That
trick takes advantage of the zero (BRK)
first byte in every BASIC program.
$35. The monitor program did not con-
tain examples of these ins1ructions.
Moving and relocating programs can
be fun as well as useful. In somerespects it's like a game or puzzle. I
believe this is the aspect that appeals to
me. I would enjoy hearing from other
PETters about their success or failures
in relocating programs (SASE for reply).
A hex listing Of the relocated monitor
is shown in Figure 3. All functions have
been checked and appear to beworking.
For the KIM-l
PCROS - A Real- Time Operating System in theH. GELLER COMPUTER SYSTEMS IK KIM RAM
DEPT. M, P.O. BeX 350NEW YORK, NY 10040 Includes: Assembly listing; Cassette with user's
.===(::N=e=w=Y=0:i::rk=R:i::e=s=id::e:in:i::t:i:s=A=d::d=A:P:::P=I:i::ic::a=b=l:i::eS:i:a::i:le::s=T::a=x::i:}=====m:::Hnual;chema tic for re I ay control board
T.D.Q.TAPE DATA QUERY
PET-8K SOL-IIA TRS-80-LEVEL II
* FILE MANAGEMENT SYSTEM
-Utilizes Dual Audio Cassette Recorders
* INTERACTIVE QUERY LANGUAGE-English-Like Commands
-Powerful Info Re trieval Capabili ty
* COMPUTERIZED BUSINESS & PERSONAL RECORDS-Customize Your Own File Structures
-Create & Maintain Data Files
-No Programming Experience Required
* IMPLEMENTED IN BASIC
T.D.Q. CASSETTE WITH MANUAL & REF. CARD $50.00
The Following Pre-Defined T.D.Q. File StructuresAre Available To Solve Your Data Processing Needs:
INVENTORY CONTROL $35.00
ACCOUNTS RECEIVABLE $35.00
ACCOUNTS PAY ABLE $35.00
ORDER PROCESSING $35.00
CUSTOMER DIRECTORY $25.00APPOINTMENT SCHEDULING $25.00
Each With Cassette And Manual
Send Self-Addressed Stamped Envelope ForComplete Software Catalogue.Send Check Or Money-Order To:
September, 1979
NOW AVAILABLE
For SOL-IIA and PET -8K
GENERAL PACK 1 $1l.00
(Checkbook Balancer, Tic Tac Toe, Metric Conversion)
GENERAL PACK 2 $19.00
(Space Patrol, Biorhythm, Battlestar, One-Armed Bandit)
FIN!\NCIAL PACK 1
(Loans, Depreciation. Investments)
$13.00
FIN/\NCIAL PACK 2 $13.00
(Mor:gage & Loan Amortization, Future Projections,
Risk Analysis)
STATlSTICS PACK 1 $19.00
(Mean & Deviation, Distribution, Linear Correlat ion &
Regression, Contingency Table Analysis)
GAME PACK 1 $20.00
(Basketball. Object Removal, Bowling, Darts, Gopher)
GAME PACK 2 - (children - educational)
(Arithmetic God, Addition Dic.e, Travel)
$13.00
$50.00
MICRO - The 6502 ~oumal 16:19
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 22/68
POWEHSOFT, INC.P. O. BOX 157
PITMAN, NEW JERSEY 08071(609) 589·5500
APPLESOFT II UTILITY
products for the
APPLE II
(Diskette Only) $12.45
The Applesoft II Util ity program provides the user with the following features. a) Complete automatic renumbering of any Applesoft II
program. b) The creation of an EXEC File for subroutine file creation. This feature allows you to incorporate the samesubroutine in various pro-
grams. c) No modification of the program in machine memory (RAM). d) Autornatic running of the program. No programmer should bewithout
this excellent utility program. REQUIREMENTS: Disk II, Applesoft II, 16K of memory.
REAL ESTATE ANALYSIS PROGRAM $14.95
The Real Estate Analysis Program provides the user with three features. a) J\ powerful real estate investment analysis for buy/sell decisions
and time to hold decisions for optimal rental/commercial investments, b) Generation of complete amorization schedules consistent with banking
practices and schedules. c] Generation of depreciation schedules for selecting the best depreciation schedule for your useand a determination of
optimal switch over points to straight line to maximize depreciation. All three features aredesigned for video screenor printer output. In addition,
the program will plot; cash flow before taxes vs. years, cash flow after taxes vs. vears, adjusted basis vs. years, capital gains vs, years, pre-tax pro-
ceeds vs. years, post-tax proceeds vs, years, and return on investment (%) vs. years. FlEQUIREMENTS: Applesoft II, 16K of memory without DOS
or 32K of memory with DOS (Disk II).
ADDRESS FILE GENERATOR $19.95
A professional piece of software which allows the user to create four different types of address files: a) Holiday File, b) Birthday File,
c) Home Address File, and d) Commercial Address File. The program contains a menu of sevenmajor commands: 1) Createa File, 2) Add to File,
3) Edit File, 4) Display File, 5) Search File, 6) Sort File, and 7) Reorganize File. MJst of the major commands havesubordinate commands which
adds to the flexibil ity of this powerful software system. We doubt you could buy a better program for maintaining and printing address files.
REQUIREMENTS: Disk II, Apple Printer Card, 32K of memory with Applesoft l'lOM Card or 4aK of memory without Applesoft ROM Card.
SUPER CHECKBOOK $19,95
A totally new checkbook program with a unique option ... Bar Graphs. These bar graphs, outputed to a printer or video screen, provide
trend anaiysis data on code expense, income, expenses, or gain/loss on a month by month basis. The program contains a total of fourteen options:
1) Check/Deposit Entry & Modification, 2) Reconciliation of Checks or Deposits, ~.)Sort by Check Number, 4) Sort by Code for Year, 5) Sort by
Code for Month, 6) Output Year to Date, 7) Output Month Activity, a·ll) PrinterIVideo Plot Trend Analvsls-Bar Graphs, 12) Account Status,
13) Reconciied Check Status, and 14) Quit. An excellent program for maintaining your checkbook, or that of a small business. REQUIREMENTS:
Disk II, 32K of memory with Applesoft ROM Card or 4aK of memory without Applesoft ROM Card.
FUNCTION GRAPHS AND TRANSFORMATIONS $14.95
. .. .
. .~. .....J.-.j
.• e8. - Z It. ..... z . . . . . . . . .Available at your local computer store
Call or write for our free SOFTWARE & ACCESSORIES CATALOG
This program uses the Apple II high resolution graphics capabil ities to draw detailed
graphs of mathematical functions which the user defines in Basic syntax. The graphs appear in a
large rectangle whose edges are X and Y scales (with values labeled by up to 6 digits). Graphs
can be superimposed, erased, drawn as dashed (rather than solid) curves, and transformed. The
transformations available an, reflection about anaxis, stretching or compressing [chanqeof scale),
and sliding (translation). The user can alternate between the graphic display and a text display
which lists the available commands and the more recent interactions between user and program.
Expected users are engineers, mathematicians, and researchers in the natural and social sciences;
in addition, teachers and students can use the program to approach topics in (for example)
algebra, trigonometry, and analytic geometry in a visual, intuitive, and experimental way which
complements the traditional, primarily symbolic orientation. REQUIREMENTS: 16K of
memory with Applesoft ROM Card or 32K of memory without Applesoft ROM Carel.
DEALER INOUIRIES II\lVITED
POWEH§OFT, INC.P. O. BOX 157
PITMAN, NEW JERSEY 08071
(609) 589-5500
• Check or Money Order
• Include $1.00 forshipping and handling
• C.O.D. ($1.00 add't!. charge)
• Master Chargeand VISAarders accepted
• New Jersey residents add5% seles tax
Programs Available on Disketteet $5.00 Additional
Apple II is a registered
trademark of Apple Computer, Inc,
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 23/68
Life in the Fast Lane
Richard R_Auricchio
1596Stapleton Court
SanJose, CA95118
This high speed version of the game of LIFE uses lo-resgraphics on the APPLE II. A clean assembly languageimplementation makes it easy to enhance or adapt.
\,ii
What? Yetanother gameof LIFE?Yes,this one's for the APPLE II computer,
and it's afairly quick one. Thegameruns
in Lo-Resgraphics using a32x 32array.
Ihe current version is black-and-white,but adding color should not prove toodifficult a task. The assembly language
module which actually computes the
generations is capable of running offabout three per second on the APPLEscreen.
j
The program is designed to utilize
both of theAPPLE's graphic screen buf-fers to avoid the ripple effect which oc-
curs when the display is updated. When
both buffers areused, the new image is
created in the buffer not currently beingdisplayed on the screen; after the com-plete, image is created, the buffers are
swapped via the hardware controls inthe APPLE.
In addition to the two screen buffer
areas, the actual LIFE generations are
performed in a 32x 32 array (1K bytes).
Separating the screen and LIFE arraymakes it easier to interface with the
LIFEprogram from BASIC; inaddition, aspeed increase was realized because itwas not necessary to "read" the screen
points to compute the next generation.The code to perform an assembly
language SCRN(X,Y ) function, although
short, requires computation of screencoordinates. This computation would
cost valuable compute-time.
September, 1979
ProgramOrganization
Therearetwo entry potnts to the LIFE
program. One, which performs initializa-tion, is used toclear the LIFEarray and
set up thescreenbuffer pointers. These-cond screen buffer is then blanked outby copying the first into the second.
Thesecond entry is the "run" entry toperform LIFE generations. This is themain part of the LIFE program. It runs
until either the screen becomes com-
pletely blank, or the user hits any keyon
the APPLE keyboard. The program willnot detect a stable LIFE pattern, It will
keep running more generations eventhough the display does not appear tochange.
The LIFEprogram makes two passes
over the LIFE array to compute eachgeneration. The first pass sets up pen-
ding births and deaths within the array.
This is done by accessing cells(neighbors) which border thecurrent cell
being examined. Thearray is allowed to
wrap around and going off one edgebr-
ings you back inon the other side. Thesecond pass completes the birth/deathprocess, displays the cells in the inac-
tive screen buffer, and swaps the
screens. This process continues until all
cells die or a key is hit. Ineither event,areturn is made to the BASIC program;
the screen and UFE array are notaltered. This allows the BASICprogram
MICRO- The 8502Journal
to actually edit the LIFE array, say, toadd/delete cells or to center the imageon the screen.
Driving the Program from BASIC
A simple Integer BASIC driver is in-
cluded here: It allows one to type in
points until (0.0) is entered, and thencalls the LIFEprogram todisplay gener·ations on the screen. No fancy editing
facilities have been coded, but they'reeasy enough to add if you find themuseful.
Structuring the Code
The LIFE program was coded using
straightforward techniques. Notricks orshortcuts wereused tosaveabytehere,
a microsecond there. Comments havebeensprinkled throughout the listing toenable changes or customization of the
module, and coding tricks might have
madethat next to impossible.
Usewith APPLEDOS
TheLIFEprogram is completely com-patiblewith APPLEDOS(bothversions3.1and 3.2).Therearenomemory areas us-
ed which will conflict with DOSusage,
andnoDOSfeaturesareaffected byrunn-ing LIFE.Userswith DOSsystems should
BSAVEtheLIFEmoduleand insert anap-propriateBLOADcommandatthebeqlnn-ing of the BASICdriver program.
16:21
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 24/68
[;J(~}!m~[;l~[!.~§ tm
~ §!I~[3I[;l ~ ~~ ~~
Allindude the Following Features:
All METAL HEAVY DUTY CASE
ON/OFF SWITCH and PILOT LIGHT
115/60Hz or 2)O/Sottz INPUT
G RO UN DE D T HR EIE -W IR E
PQWERCORO
P OW E R P LUS 5: + 5V at 5A, ± l2V at 1A 57500
P OW E R P LU S S UP ER 5: + 5V at lOA, ± 12V at lA 59500
P OW E R P LUS 5/24: + 5V at 5A, + 24 at 2.5A, ± l2V at lA 59500
SPECIFICALLY DESIGNED FOR THE AIM 65
Small E lM lugh 1 (1Fi ll ns id e the A IM Enc lo su re
Enough Power k" the AIM 65Fully lo~ded
Plus ~n Additiomll Baud
Works on 115VJ60Hz or 2JOV/SOHz
Provides Rex;ulated + 5V a t 5A~ ,. j +24V oJl1A
Grounded Three-Wire Power Cord
POWER A PLUS: $5()OOON/OFF Switch ilnd Pilolli.ht
ALL THE POWER A
KIM·1/SYM-1 NEEDS
Neolt. Comp,Jid, Economin
Yhouynds in Use '
INPUT: 115V/60Hz
OUTPUTS: ReBuloJled + 5V oJll.4A
+ l lV oJl1.004
Unregulated +BVu p t o 4 . 3A
+16Vuptol.0A
Win Power a KIM-l/SYM-l,J,.j oneAdditionoJl 8("O,ud
S uc h. u MEMl JRY PLUS o r V IDEO
POWER PLUS: $4000 PLUS
SUPERSCOPE C-190
b y Marantz
A High QUoJlily Cassette Recorder
with all 01the Fealurl!'! Required
for M ic ro computer Sys tems :
617/256-3649
PO Box 3S Chelmsford. m s 018'24
•••••••• 1•••••••• 1••••••
• •• T H E GAME OF LIFE FOR •
T H E APPLE-I I , ON A •
• 32 X 32 A RRAY. •
•• B Y RI CK AURI CCH I O •• 10-30-78 •• MODIFI ED B Y MI CRO •• S TA FF 7 -17 -7 9
•• •• • • • • • • • • • • • • • • • • • • • • • • •
APTR • $0000 LIFE ARRAY POI NT ER (LO)
NPTR • $0002 NEIGH B OR CELL POI NT ER (LO)
NNUM • $0004 NUMB ER NEIGH B OR CH ECKS
NCNT • $0005 NEIGH B OR COUNT
NCELLS • $0006 NUMB ER LI VE CELLS
CRT • $0007 CRT OFFSET : OO=lST , 04=2ND
COLOR • $0030 PLOT COLOR
GBASH • $0027 GRA PH I C B ASE ADDRESS (HI)
AI L • $003C MONI T OR WORK BYTES
A1H • $0030
A2L • $003E
A2H • $003F
A4L • $0042
A4H • $0043
AST ART • $OOOC START PAGE FOR ARRAY
AEND • $0010 END PAGE FOR ARRAY
KB • $COOO KEYB OARD I NPUT ADDRESS
KB S • $C010 KEYB OARD ST ROB E CLEAR
CRTFLI • $C054 C054/C055 FLI PS CRT
GB ASCA • $F847 CALCULAT E PLOT ADDRESS
MOVE • $F32C B LOCK MOVE ROUT I NE
• MEMORY LAYOUT :
• PAGE(S) CONTENT
• 04-07 CRrl1
• 08-0B CRTl2
• OC-OF L IFE A RR AY
• 10-11 PROGRAM
•ORG $1000
•• CALL T O I NI T WI LL CLEAR T H E LI FE ARRAY
• AND SET UP T HE APPR OPR IA TE C RT PO IN TE R
•1000 20 DA 10 I N I T JSR ORIGI N SET ARRAY POI NT ER
1003 A9 04 LDAI M $04 SET CRT T O SECOND
1005 85 07 ST A CRT FOR T H E FI RST GENERAT I ON
1007 AO 00 LDYI M $00 ZERO I NDEX
1009 98 CLRA T YA ZERO T H E AC
100A 91 00 ST AI r APT R CLEAR ARRAY B YT E
100C 20 E5 10 JSR B UMP B UMP T O NEXT B YT E
100F g o F8 BCC CLRA =)MORE T O DO
•• CLEAR SECOND CRT BUFFER
•1011 A2 00 LDXI M $001013 86 3C ST X AI L
1015 86 42 ST X A4L
1017 CA DEX
1018 86 3E ST X A2L
lOlA A 2 0 4 LDXI M $04
101C 86 3D ST X A1H
101E A2 08 LDXIM $08
1020 86 43 ST X A4H
1022 CA DE X
1023 86 3F ST X A2H
1025 20 2C F3 JS R MOVE
1028 60 RT S
B LOCK MOVE
DONE, B ACK T O B ASI C(S)
MICRO - The 6502 Journal September, 197916:22
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 25/68
1029 20 D A 10 RUN
•
102C A9 07
102E 85 O L I
1030 A9 1)0
1032 85 0:;
1034 A5 O L I
1036 OA
1037 AA
1038 18
1039 A5 00
103B 70 Oi l 11
103E 85 O;~
1040 A5 011
1042 70 OB 11
1045 C9 10
1047 B O Ot!
1049 C9 OC
104B B O 06
1040 69 O L I
104F DO O;~
\j
1051 E9 04
1053 85 03
1055 A O 00
1057 B 1 O;~
1059 10 O;~
105B E6 0:)
1050 C6 011
105F 10 03
1061 A6 0')
1063 B l 00
1065 10 OA
1067 EO O;?
1069 90 I ;?106B EO Ol~
1060 BO 01,
106F 90 Oi~
1071 EO 03
1073 D O 08
J
1075 E6 06
1077 A 9 40
1079 11 00
107B 91 001070 20 E'5 10
1080 90 AA
September, 1979
•• ENTRY AT RUN WILL DO T HE
• PROCES SING UNT IL EI THER:
• 1) ALL CELLS DI E, OR
• 2) ANY KEY IS H IT.
• IT WI LL THEN RETURN
•JSR ORIGIN S ET ARRAY POINTER
• PA SSI WILL SCAN THE A RRAY• A ND SET UP BI RTH S/D EA THS
• FOR ALL CELLS
PASS I LDA IM $07
ST A NNUM
LDA IM $00
STA NCNT
NBCHK LOA NNUM
A S L A
TAX
•
S ET TO CHECK OUT
S EV EN N EI GH B OR S
T HERE ARE NO
NE IGH BO RS YET
GET NEIGH BOR NUM BER
AND MA KE IT A
2-B YT E I ND EX
• SET NPT R B Y ADJUST ING TH E CURRENT
• CELL POINTER BY THE FOLLOWI NG VALUES :
• -33, -32, -31, -1, +1, +31, +32, +33
•CL C
LOA APTR GET LO H ALF
ADCX O FFS ET A DD/ SUB TRA CT
STA NPTR S ET NPTR LO
LOA APTR
ADCX OFFSET
CMPI M AE ND
BCS S UB04
CM PI M A ST ART
BCS STORE
ADCIM $04
BNE STORE
SUB04 SB CIM $04
ST ORE ST A
•
+01 GET HI HA LF
+ 01 A D D/ S UB T RA CT
PAST T HE END OF ARRAY
=)YES : BACK I T UP!
B ELOW ST ART OF ARRAY?
=)NO: WI TH IN B OUN DS
B UMP UP I NTO A RRAY
A ND GO STUFF NPTR
NPTR +01 NOW SET NPTR HI
B ACK UP I NTO A RRAY
• CH ECK OUT T HI S NEIGH BOR
LDYIM $00 I ND EX = 0
LD AIY NPTR GET NEIGHBOR
BPL NEXT NB =)NONE H ERE
INC NCNT
• T RY NEXT NEIGHB OR
•
=)ONE HERE: COUNT UP
NEXTNB D ECZ NNUM M ORE TO DO?
BPL NB CH K =)YES: D O A LL
•• ALL NEIGH BORS COUNTED• MA KE LIFE/D EAT H DECISI ON
LOX NCNT
LDA IY APT R
BPL CH KBI R
CPXIM $02
BCC DIE
CPXI M $04
B CS DIE
BCC SURVI V
CHKB IR CPXIM $03
BNE DIE
GET CURRENT COUNT
GET CURRENT CELL
=)EMPT Y: MAYBE B IRT H H ERE?
A LI VE : T WO N EI GH BO RS ?
=) 0 OR 1: D IE!
4 -7 N E IGH B OR S?=)YU P: D IE O F O VE RCRO WD IN G!
=)2 OR 3: S URVIVE
E XA CT LY T HRE E N EI GH BO RS ?
=)NO: EMPTY CELL ST AYS D EAr
SUR V I V I NC NCELLS , BUMP COUNT OF LI VE CELLS
LOA 1M $40 "OR" I N 40 BI T
ORA IY APT R TO S URVIVE
D IEST AI Y APT RJSR BUMP
BCC PAS SI
THI S T IM ESET NEXT CELL T O DO
=)MORE T O D O
~~~®~~ ~[h[] l~tm
FOR
AIM/SYM/KIM
8K STATIC RAM P~~~R
Sockets for 8K Eprom
6522 1/0 Port
ON BOARD REGULATORS
EPROMPROGRAMMER
MEMORY PLUS: 520000 FULLY ASSEMBLED AND TESTED
AIM/SYM/KIM
UPPER/l ower case ASCII
128 Addit ional User Programmable
Characters: GRAPHICS·
SYMBOLS·FOREIGN CHARACTERS
Programmable Screen Format up to
8 0 CHARACTERS - 2 4 LINES
KEYBOARO and L IGHT PEN Inter faces
Up 1 0 4K D ISPLAY RAM
Pr ov isi on lo r 2 K EPROM
Pr ov isi on t o ad d 6 50 2 f or
STANO·ALONESYSTEM
ASSEMBLED AND TESTED
WITH 2K DISPLAY RAM
VIDEO PLUS: $24500
ADO UPTO F IVE ADDITIONAL BOARDS
AUDIOITTY CONNECTIONS
POWER TERMINALS
APPLICATION CONNECTORS
AIM/SYM/KIM
FULLY BUFFERED
FULLY DECODED
KIM·4 Bus Structure
MorH ER PLUS: $8000 FULLY ASSEMBLED AND TESTED
;J~[] l~tmFOR
AIMISYMIKIMSame S IZE and SHAPE as k IM /SYM
Professional Quality
Double Sided, Plated through Holes
Two Sets of GOLD Plated Dual 22 Fingers
Designed lor-WIRE WRAP Or
SOLDER Connections
Provisions lor 4014/16 pin sockets
424/40 pin sockets
J voltage regulators PROTO PLUS: $4000
617/256-3649
MICRO - The8502 J)urnal 16:23
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 26/68
1082 B l 00
10811 A 2 00
1086 OA
1087 91 00
1089 FO 02
108B A2 FF1080 86 30
108F A9 IF
1091 25 001093 18
10 911 6 9 O il
1096 A8
1097 A5 001099 l lA
109A llA
109B llA
109C llA
1090 llA
109E 85 0410AO A9 03
10A2 25 01
10A4 OA
10A5 OA
10A6 OA
10A7 05 04
10A9 1810AA 69 04
lOAC 20 F9 10
lOAF AO 00
lOBI 20 E5 10
10B4 90 CC
10B6 A5 07
10B8 4A
10B9 4A
lOBA AA
10BB 90 54 COlOBE BD 08 11
lOCI 85 07
10C3 AD 00 CO
10C6 10 07
IOC8 80 54 CO
10CB 80 10 CO
10CE 60
10CF A5 06
1001 FO F5
1003 1\9 00
1005 65 06
1007 4C 2C 10
10DA A9 00
lODC 65 00
lODE 85 06
10EO A9 OC
10E2 85 01
10E4 60
16:24
•• PASS2 WILL DISPLAY TH E
• ARRAY BY PLOT TING POI NTS
• IN CRT #1 OR #2 AND
• WILL TH EN SWAP SCREENS
•PASS2 LDAIY APTR
LDXIM $00
ASLA
STAI Y APTR
BEQ SE1COL
LDXIM $FF
SET COL STX COLOR
LDAIM $lF
AND APTRCLC
ADCI M $04
TAY
LOA APTR
LSRA
LSRA
LSRA
LSRA
LSRA
STA NNUM
LDAI M $03
AND APTR
ASLA
ASLA
ASLA
ORA NNUM
CL CADCIM $04JSR PLOT X
GET CURRENT CELL
ASSUME DEAD: COLOR = 0
SH IFT ONE BIT LEFT
AND PUT B ACK
=)NOT ALIVE I
ALI VE: COLOR = 15
X CO-ORDINATE IS
LOW 5 BI TSBUMP DOWN TO
CENTER OF CRT
OF APTR
Y CO-ORDI NATE IS
HIGH 3 BIT S
OF
APTR
H OL D T EM PO RA RI LYNOW MERGE IN
+01 2 LOW BI TS OF
APTR HI
TO FORM
FULL
Y C O- OR DI N AT E
B UMP DOWN T OCENT ER OF CRTPLOT T HE POINT
LDYI M $00 INDEX
JSR B UMP BUMP TO NEXT POI NT
BCC PASS2 =)00 ALL CELLS
•• SET HARDWARE T O DI SPLAY THE CURRENT
• SCREEN AND SWAP OVER TO TH E OTHER SIDE
•LO A
LSRALSRA
TAX
STAXLDAX
ST A
CRT GET CRT NUMBER
SCALE DOWNTO 0 OR 1 RANGE
TO I NDEX REG
CRTFLI FLIP CRT DISPLAYCRTNUM GET CRT NUMBER
CRT FOR NEW CRT
•
•
• CONTI NUE RUNNI NG UNLESS
• ALL DEAD OR KEY HI T
LOA
BPL
RETURN STA
ST A
RTS
KB
NOKEY
CRTFLI
KBS
CHECK KEYS
=)NO KEY H IT
SET CRT #1 ALWAYS
C LE AR K EYB OA RD
NOKEY LOA NCELLS GET COUNT OF CELLS
SEQ RETURN =)ALL DEAD
LDAIM $00 MORE LEFT
STA NCELLS CLEAR COUNT AND
JMP PASSI GO AROUND AGAIN
•• SET UP ARRAY POINT ERS
•ORIGIN LDAIM $00
STA APTR
STA NCELLSL DAI M AST ART
STA APTR
RT S
•
SET UP TH E
LO B YTE OF APT R
AND CLEAR CELL COUNT
SET UP START
+01 OF ARRAY
• B UMP APTR. RESETS IT IS
• WE GO PAST EHD OF ARRAY.
10E5 E6 00
10E7 DO OE
10E9 E6 01
lOEB A5 01
lOED C9 10
10EF DO 06
10F 1 A9 OC
10F3 85 01
10F5 38
10F6 60
10F7 18
10F8 60
10F9 4A
10FA 08
10FB 20 47 rs
10FE A5 07
1100 18
1101 65 27
1103 85 27
1105 4C 05 rs
1108 04
1109 00110A OF
110B FF
110C EO
1100 FF
110E El
110F FF
1110 FF
1111 FF
1112 01
1113 00
1114 IF
1115 00
1116 20
1117 001118 21
1119 00
S YMB OL T AB LEAEND 0010
ARH 0031'
ATL 004;~
CLRA 1009
CRT 000'7
IHIT 1000
NBCHK 10311
MHUH 000 11
ORI GIN 10011RETURN 10ca
SUB PT 1051
MICRO - The 8502 Journal
•• CARRY T ELLS IF WE H IT
• THE END OF T HE ARRAY:
• 0 8 N O, 1 = YES
•BUMP INCZ APTR
BNE BUMPO
INC APTR
LOA APTR
CMPIM AEND
8NE BUMPO
LO A HI ASTARTST AZ APTR
B UMP LO H ALF
=)NOT OFF END
+01 BUMP HI HALF
+01 GET IT
OFF T HE END?
=)NOT YET
=)YES: RESET AND
+ 0. 1 T EL L C AL LE R
SE C
RT S
BUMPO CLC
RT S
•• SPECIAL FORM OF "PLOT"
• ROUTINE: MONIT OR'S ONE
• DOESN'T ALLOW PLOT TING
• IN SECOND CRT BUFFER,
• SO WE ADD A H OOK FOR IT
•PLOTX LSRA
PH P
JSR GBASCA
•• AB OVE INSTRUCTIONS ARE
• TAKEN RIGHT OUT OF TH E• MONITOR'S ROUTINE. B UT
• WE WILL NOW UPDATE TH E
• HI ADDRESS IN "GB ASH"
• TO FORCE PLOT TING IN T HE• CORRECT SCREEN BUFFER
•LOA
CL C
AD CST A
JM P
CRT GET CRTADD TO T HE
GBASH VALUE FOR
GBASH POSSIBLE SECOND CRT
$F805 AND CONTINUE WIT H
•• DATA AREAS• (READ ONLY)
•CRT NUM $04
$0 0OFFSET = $DF
$FF
$E O$F F
$E l
$F F
$F F
$F F
$01
= $00
$lF$00
= $20
$00
$21$0 0
2000 20FCAPTR 0000
ARL 003E
BUMP 10E5
COLOR 0030
DI E 1 0 7 0
KB COOO
NCELLS 0006
NOKEY 10CF
PASSQ 102C
RUN 1029
SURVI V 1075
AQ H 0030
ASTART OOOC
BUHPP 10F7
CRTFLI C054
GB ASCA F84 7
KBS COlO
NCNT 0005
NPT R 0002
PASSR 1082SETCOL 1080
AQL 003C
ATH 0043
CHKBIR 1071
CRTNUM 1108
GBASH 0027
MOVE F32C
NEXTNB 1050
OFFSET 110A
PLOTX 10F9
STORE 1053
September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 27/68
;
PYGMY
PROGRAMMING
* PRESENTS *
APPLE BUSINESS SOFTWAREA P P L E -D M S © 4 8 k & d i s k r e q u i r e d $ 4 9 . 0 0
Apple data m anagem en t system ... the ultim ate in free-
form system s. Y ou de fin e the nam e and len gth of fie lds
w ith in e ac h re cord . M ulti d isk c ap ab ility g iv es you a cc ess
to thousands of records a t on ce w ith the in c luded
sort/ ed it fea ture s! The prin t form at is a lso d efin ed b y the
use r for c ustom re port g en era tion . Use s in clud e m ailin g
labe ls, 'in ven tory, personn e l da ta and other recordk e ep in g f un c ti on s .
A P P L E - S C R IB E -2 © d i s k o r c a s s e t t e $ 4 9 . 0 0Text p rocessor ... the pe rfec t add ition to an y b usin ess
system . Th is is a non -lin e orien ted ed itor tha t a llow s
upper and low er case le tte rs, an y w id th paper and an yle ng th p ag e. In clud ed fe ature s a re a utom a tic h ea din gs,
da te and page num ber, r igh t hand justifica tion , searc h
w ith un ive rsa l or in div id ua l re pla ce me nts. Te xt is store don d isk or c assette for easy re tr ie va l.
P.O. Box 3078 • Scottsdale, AZ 85257
F R E E !up to ,$ 1 70 in merchandisewith the purchase of PET-COMitem!!! M ~ ~ ~ E H .
PET 16K Large Keyboard $ 995 $130PET 3 2K Large Keyboard $1295 $170PET 8K $ 795 $100
PET 2040 D ua l D isk (343K) $129 5 $170
PET 202 3 P rin te r ( pr es fe e d) $ 849 $110PET 2022 P rin te r ( tra e fe e d) $ 995 $130
K IM-1 $159 (A dd $3 0 lor Pow er Sup ply) SYM-16 500 Program min g M an ual
2114 L 450 n s '' '''''''' ''''''' '''''''' ''''''' '' 5 .90 24/ 5. 152716 EPROM (5 Volt)6 550 RAM ( fo r 8K PET)6 502 M icroproc essor C hip6 522 V IA6 520 PIAPET 4 Voic e M usic B oa rd (M TUK -1002-2)Music Softw are (K -1002-3 C) for PETProgram mers Toolkit - PET ROM Utilit iesM icrochess 2.0 for PET or APPLEPET W ord Processor - Machine Language
3 M "Sc otc h" 8" disks3 M "Sc otc h" 5" d iskettesV er ba tim 5 " d isk et te s 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Cassettes ( al/ ta pe s g ua ra n te e d)Prem ium q uality, h igh output low noise in 5 sc rewhousin g w ith lab els:
C -10 10/5.95 50/25.00 100/48.00C-30 10/7.00 50/30.00 100/57.00
WR ITE FOR 6 502 ANO S -1 00 PROOUCT LIST
115-8 E. Stum p Roa d
A B Computers Mon tg ome ry ville . PA 1 89 3 61215) 699-8386
S A L E
$222.006.50
100/4.4542.0012.709.759.755.50
s 49.00$ 19 .00$ 45.00
17.9024.00
1 0 /$ 3 1 -
1 0 /$ 3 5 -
1 0 /$ 2 7 _
K IM /S Y M /A IM -6 5 - 3 2 K E X P A N D A B L E R A M
D Y N A M IC R A M W IT H O N B O A R D T R A N S P A R A N T R E F R E S HT H A T I S C O M P A T IB L E W IT H K IM / S Y M /A IM - 6 5A N D O T H E R 6 5 0 2 B A S E D M IC R O C O M P U T E R S .
• P L U G C OM PA TI B L E W IT H K IM /S YM / A IM ~5 .
M A Y B E C O N NE C T ED T O P E T U S IN G A D AP TO RC A B L E . S S 4 4 - E B US E DG E C O NN EC TO R .
• U S E S + 5 V O N L Y (S U P P L I E D F R O M H O S T
C O MP U TE R B US ). 4 W A T T S M A X IM UM .
* B O AR D A DD RE S SA BL E IN 4 K B Y T E B L O C K SW H IC H C A N B E ! ND E P EN D E NT L v P LA C E D O N
4 K B Y T E B O UN DA R I E S A NY W HE R E IN A 6 4 K
B YT E A D DR E S S S PA C E.
* B U S B U FF ER ED W IT H 1 L S T T L L O AD .
* 2 0 0N SE C 4 11 6 R A MS .
* F U L L D O C U M E N TA T IO N
* A S S E M B L E D A N D T E S T E D B O A R D S A R EG U A R A N T E E D F O R O N E Y E A R . A N D
P U RC HA SE P R IC E I S F UL L Y R EF UN D AB L E I FB O AR D IS R ET U RN ED U N DA MA GE D W IT H IN
1 4 D A Y S .
ASSEMBLED,
TESTED
W ITH 32K RAM. . . . . . 1449 .00
W ITH 1 6K RAM. . . SJ79.00
W ITHOUT RAM CHIPS.. . . .. . SJ09.00
H ARD TO G ET PARTS ONL Y (NO RAM C HIPS) .
B ARE B OARD AND MANUAL .
C O N NE C TS T H E A BO VE :1 2 K E XP AN D A BL E R AM T O A 4 K O R 8 K P E T.
C O N TA IN S E XP AN S IO N IN TE RF A C E C A B L E . B DA R D S TA ND O F F S ,
P OW E R S U P PL Y M O D I F IC A TIO N K IT A N D C O MP LE TE IN S T R u c n ON S .
KIT
S419.00
S 3 4 9 1 1 0
S279.OO
. . S I50. 00
.. . S 50 .0 0
I
BETA COMPUTER DEVICES 0 C " A L L A S S E M B L E D B O A R D S A N D M E M ·POBOX 3465 . - ,-,- ,"~' , ,,-' '~ F D R Y C HIP S C AR R Y A F UL L O N E Y E A R
ORANG~71~~~~~07~~~A 92665 D~ • c o-c~D -.C: ~~~~: ~ , ' " R E PL A CE M EN T W A R A NT Y
1 6K X I D YN AM IC R AM
T H E M K4 1 1 6 - 3 I S A 1 6 , 3 8 4 B I T H IG H S P E E D
N MO S , D YN AM IC R A M . T HE Y A RE E QU IV AL E NTT O TH E M O S T E K , T EX A S I N S TR U ME N TS . O R
M O TO R O LA 4 11 6- 3.* 2 D D N S EC A C C ES S T IM E , 3 7 5 N SE C C Y C LET I M E
* 1 6 P I N T TL C O MP A T lB LE
* B UR NE D IN A ND F UL L Y T E ST E D
• P A R TS R E P L A C E M E N T G U A R A N T E E D F O R
O N E Y EA R .
1 9. 5 0 E AC H IN O U AN TI T IE S O F B
M O TO R O LA M E MO R Y A D D RE S S M U LT IP LE XE R -
M C 3 24 2A
T H E M C 3 2 4 2 A I S A N A DD RE SS M UL T I P LE XE RA N D R E F R E S H C O U N T E R F O R 1 6 P IN , 1 6 K
D YN A M IC R A M S T H A T R EQ U IR E A 1 2 B C YC LE
R E F R E S H .
• C ON TA IN S M EM OR Y R EF RE S H C OU NT E R* M UL T IP L E X E S S YS TE M 1 4 B I T A DD RE S S T O
T H E 7 A D D R E S S P IN S O F T H E R A M S .
* C O M PA T I B LE W I T H 3 48 0 M E M OR Y
C O N T R O L L E R
• P AR T I S G UA RA NT EE D.S I 2 . 5 0 E A C H
M O TD R OU D YN AM IC M EM O RY C O NT RO LL ER -
M C 3 4 8 0 L
M EM O RY C O NT RO LL ER D ES IG N E D T O S IM P L I F Y
C ON TR O L O F 1 6 P I N 4 K O R 1 6 K D YN A M I C R AM S
* G EN ER A T E S R AS /C A S A ND R EF R E SH T IM IN GS IG NA LS F O R 1 6K T O 6 4K B YT E M EM O RIE S .
* G EN ER A T ES M EM O RY R EA D /W R IT E T IM IN G
* D IR E C T I N T E R F A C E W IT H M O T O R O L A O RIN T E L 3 2 4 2 A A DD RE S S M UX A ND R EF RE S H
C O U N T E R .
* P A R T G U A R A NT E ED .
S I 3 . 9 5 E A C H
6 5D 2. 64K B YT ER A M A N D C O N TR O LL ER SETM AK E 5 4 K B Y T E M EM O RY F OR Y O UR 6 8 0 0 D R
6 50 2. T HI S C H IP S ET I N C LU D E S
* 3 2 M 5K 4 1 1 6 - 3 1 6 K X 1 , 2 0 0 N S E C R A M S.* 1 M C 34 8 0 M EM O RY C ON T R OL L E R .
* 1 M C 3 2 4 2 A M E M O R Y A D D R E S SM U L TI P LE XE R A N D C O UN TE R .
• D A T A A N D A P P L I C AT IO N S H E E T S P A R TS
T ES T ED A N D G U AR A NT EE D .
S 2 9 5. o o P ER S E T
E P R O M2 71 6- 4 5 0N SE C . . S 4 9. / W
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 28/68
SYM·1 Event Timer
Help that onboard 6532 earn its keep with this 100KHzevent timer. It handles up to 50 elapsed time intervalsor successive timed events.
M ICR O-WAR E A SS EMB LER 65 11-1. 0II
II EVENT T I MER PROGRAMII
II B Y S TE PH EN J. FARIS
II MODIFI ED B Y MI CRO ST AFFII
02AF G ET K E Y II $88AF
02AF ACCESS II $8B86
02AF OUTB YT II $82FA
02AF SCAND II $8906
02AF Dl II $0000
02AF D2 II $0001
02AF D3 II $0002
02AF NII
$000602AF Rl II $0006
02AF R2 II $00'56
02AF R3 II $00A6
02AF DB l II $A645
02AF DB 2 II $A644
02AF DB 3 II $A643
02AF DB4 II $A642
02AF DB 5 II $A641
02AF PAO II $AOOl
02AF PB O II $AOOO
0200 ORG $0200
0200 78 SE I D IS AB LE I NT ER RU PT S
0201 F8 SE D
0202 A2 00 LDXIM $00 SET DECI MAL .MODE
0204 A9 50 LDAIM $50 AND SET X=O
0206 8D 7 E A 6 ST A $A67E0209 A9 02 LDAI M $02
020B 8D 7 F A6 ST A $A67F T H EN SET I NTERRUPT VECT OR,
020E A9 FF I NIT LDAI M $FF
0210 85 00 ST A Dl
0212 85 01 ST A D2
0214 85 02 ST A D3 INIT COUNTER
0216 AD 01 AO ST ART 1 LDA PA O
0219 29 01 A ND 1 M $01 LOOK FOR "1" LEVEL
021B FO F9 B EQ START1 AT PAO I NPUT
021D AD 01 AO ST ART 2 LDA PA O
0220 29 01 ANDI M $01 LOOK FOR "0" LEVEL
0222 DO F9 B NE START2 AT PAO I NPUT
0224 58 CLI
0225 00 B RK GE NE RA TE I NT ER RU PT
0226 EA NOP
0227 A5 02 ST OPl LDA D3
0229 C9 FF CMPIM $F F LOOK FOR "1" LEVEL AT PB O022B FO OE B EQ ESC I NPUT WI T H T I MEOUT AFTER
022D AD 00 AO LDA PB O 99 I N D3
0230 29 01 ANDIM $0 1
0232 FO F3 B EQ STOPl
0234 AD 00 AO ST OP2 LDA PB O LOOK FOR "0" LEVEL
0237 29 01 ANDI M $01 AT PB O I NPUT
0234} DO F9 B NE STOP2
0 23 I ! & 8 ESC I 8I I NCREMENT I FOR NEXT POI NT
023C A5 00 LDA 01
023E 95 06 STAZX Rl
0240 A5 01 LOA 02
02112 85 56 S1A R2
16:26 MICRO - The 6502 Journal
Stephen J. FarisSyner.tek Inc.
400 Humphrey StreetSwampscott, MA 01907
Very often it is desired to measure the
time between two events, such as the
start and end of a race or the time taken
to respond to a given stimulus. The time
between events can occur from a given
start pulse to each succeeding pulse as
follows:
STAR'I' 3
STOPTOP STOP
This article will use the SYM·l board's
6532 timer and keyboard display to
create a device which can measure up to
50 time intervals, store them in memory
and then read them out one at a time.
The first segment of the program is a loop
loop to look for the start pulse, set up
the 6532 timer and then look for the stop
pulse. To measure the time between
events, the 6532 generates an interrupt
whenever it times out. The interrupt rou-
tine increments a 6·digit counter which
counts the number of time intervals un-
til the stop pulse is found. With minor
modifications the program can ac-
complish both types of event measure-
ment mentioned earlier.
For example, the program listing shown
will measure time events per Figure 2. Inorder to measure as per Figure 1,change
the BNE (24B) instruction to jump to
STOP 1.The number of time events is fix-
ed by N. The last segment of the pro-
gram is the readout routine. This routine
will read out each time interval from 1 to
N, stopping so that the answer can be
written down before going on
automatically to the next. After corn-
pletinq the routine, the program jumps
back to the beginning.
September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 29/68
The time interval increments can be
changed by accessing different dividers
of the 6532 and changing the timer count
To operate the program the following
steps are necessary:
1. Enter in location N the number of
time intervals to be measured. (In
HEX, less than 31.)
2. Decide what type of time intervals
are to be measured (i.e. Figure 1or
Figure 2).3. Decide time interval needed and
enter VAL from Table I.
4. Start program at location 200.
5. Display results by hitting 1 on the
keyboard.
The interface hardware to the event
timer can be a 556 timer connected as
shown in Fi~lure 3.
The input signals can be derived from
switches, light coupled devices or
transducers. The output pulses are 50
microseconds wide and positive going.
This conditions the input pulses so the
software can look for a minimum widthpulse. The only other hardware required
is a SYM-1 board, cassette and power
supply.
\~.I
lK
i n p u ts t a r t
p u l s e
o u t p u tt o PA O
of SYM-l
a p p l i c a t i o n
p o r t
+5V _. __ ,..- ,-- __ --,
i n p u ts t o p
p u l s e
0.01 uf
o u t p u t
t o PE O
of SYM-l
a p p l i c a t i o n
p o r t I
Figure 3:Connecting a 556timerfor use as an interface to theevent timer.
September,1979
0244 A ~ 02 LOA 03 S TO RE R ES UL TS
02 46 85 A 6 S T A R3 I N M EM ORY LO CA TI ON S
0248 78 S EI02119 E4 0 6 CPI N I S NUM B ER OF I NT ERVA LS DONE
024B D O Cl B NE I N I T024D I IC 6 A 02- JMP R D OU T JUMP T O D I SPLAY
•• 6-D IGI T CO UN TE R I NT ER RU PT R OU TI NE
•02 50 118 I N T R PH A
0251 A9 11 9 LD A I M $49
0253 80 1C A 4 S T A $A41C
0256 A 9 0 1 LD A I H $0102~ 8 65 06 A D C Rl
025A 85 06 S T A Rl
02 5C A 5 00 [J)A $00
02 5E 65 56 A D C R2
02 60 85 56 S T A R2
02 62 A 9 00 LD A I H $00
02 64 65 A 6 A D C R302 66 85 A 6 S T A R302 68 68 PL A
0269 40 RT I
•• REA D OUT ROUT INE
•
uf
02 6A 20 86 8B RD OUT ' JS R A CCES S02 60 20 AF 88 KEY JSR GET KEY
02 70 C 9 31 CMPI M $31
02 12 D O F9 B NE KEY02 74 A 6 06 LDX N
02 76 A O PO L4 LDYI M $FO
02 78 B 5 A6 LD A ZI R302 7A 20 FA 82 JS R OUT B YT
02 7D B 5 56 LD A ZX R202 7F 20 FA 82 JS R OUT B YT0282 B 5 0 6 LD A ZX Rt
02 84 20 FA 82 JS R OUT B YT
02 87 A 9 FF L3 LD A I M $FF0 2 8 9 80 I F Al l S T A $A 41F
02 8e 8D O~ A 4 S T A $A 404
02 8F 8E 00 0 3 S T X $03000292 8e 01 0 3 S T Y $0301
0295 20 06 89 L1 JSR S CA ND
02 98 A D 05 A l l LD A $A 40502 9B 10 F8 B PL Ll
02 9D A E 00 0 3 LD I $030002 A O A C 01 0 3 LDY $0301
02 A 3 88 D EY
02A 4 FO 03 B EQ L2
02A 6 4 e 8 7 02 JMP L3
02A 9 CA L2 D EI
02" D O e A B NE L4
02A C I I C OE 02 JMP I NI T
D B R A 644
D Q 0000
GE TKE Y 88A F
LQ 0295
N 0006
RD OUT 026A
S C Al l 'D 8 90 6S T OPR 0234
A CCES S 8B 86 D B Q A645
D B T A 642 D B U A64lrs 0002 Es e 023B
lK I N T R 0250 KEY 026D
LS 0287 LT 0276PAP A OOl PB P A OOO
R R 0056 RS 00A 60.1 uf
S TA RT R 0210 S TOP Q 0227
uf
P UC H A C CU M UL A TO R
LO AD T IM ER
T WO LE AS T S IGN IFI CA NT
D IG ITS
M I DD LE T WO D I GI TS
P UL L A C CU M UL A TO R
RE TURN FRO M I NT ERRUPT
U N-WR IT E P RO T EC TS EA RCH FOR "1" KEY
LOA D Y FOR D I SPLAY T I M E
ON EA CH I NT ERVA L
S ET UP T I M ER FOR
D IS PLA Y T IM E
S CA N D I SPLAY UNT IL T IM EOUT
RES T ORE X A ND Y
D B S A 643
D R 0001I NI T 020E
LR 02A 9
O UT BYT 82FA
RQ 0006
S TA RT Q 0216
TIME INTERVAL
Table 1:Time Interval Data
VALUE ADDRESS
(253of Program)A41C
A41D
A41E
A41F
100 MICROSECONDS
1 MILLISECOND
10 MILLISECONDS
100 MILLISECONDS
MICRO - The 8502 Journal
49
7A
9C
62
16:27
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 30/68
BOX 120
ALLAMUCHY, N.J. 07820
201-362-3574
H U D SON D IG ITAL EL ECTRON ICS IN C.
inc.
TH E HDE MIN I-DI:SK SYSTEM
VERSIONS
KIM
TIM
AIM 65 - 4th Otr. '79
SYM -1 st Otr. '80
SINGLE DRIVE
DUAL DRIVE
$ 795.00
$1195.00
Complete with all hardware.
Interconnecting cables, FODS,
text editor and user and instal-
lation manuals.
The HDE DMS16·MD1 Mini Disk System is the per-
ipheral you have been waiting for. No longer bounded
by long and unreliable cassette saves and loads, your
computer becomes a sophisticated system for program
development or general purpose use. With the HDE
Mini-Disk you load and save programs in seconds, not
minutes or hours. And, since all transfers to and from
the Miri-Disk are verified for accuracy, the data will be
there when you need it.
The HDE DMS16-MD1 Mini·Disk has been "systems"
engineered to provide a complete and integrated capa-
bility. Software and hardware have been built as a team
using the most reliable com ponents available. The sys-
tems software includes the acclaimed and proven
HDE File Oriented Disk System and Text EDitor, requir-
Ing only SK for the operating software and overlay area.
Systems expanding programs available include the
two-pass HDE assembler, the Text Output Processing
System and Dynamic Debugging Tool. Hardware In-
cludes a Western Digital 1771 based controller In a
state-of·the-art 4'/, x 6'1," card size, Shugart SA400 drive
and the Alpha power supply.
The storage media for the DMS16-MD1 ISthe stan-
dard, soft sectored 5'/4' mini diskette readily available
at mosl computer stores, and HDE has desrqneo the
system so that the diskettes rotate only durinq disk
transactions, favorably extending media life. A disk
formatter routine included with the system, formats the
diskettes, verifies media integrity by a comprehensive
R/W test and checks drive RPM. Additional utilities
provide ascending or descending alpha numeric sort.disk packinq, text output formatting, file renaming,
file addressing and other capabilities.
HDE PRODUCTS. BUILT TO BE USED WITH CONFIDENCE.
AVAILABLE DIRECT OR FROM THESE FINE DEALERS:
LONG ISLAND
co v1PUTER GENERAL STORE LONE STAR ELECTRONICSOHNSO~I COMPUTER PLAINSMAN MICROSYSTEMS ARESCO
PO Box 43
Audubon, Pa. 19407
215-631-9052
Box 488
Manchaca. Texas 78652
612-282-357C
103 Atlantic Avenue
t.ynbrock, NY 11563
516-887'1500
Box 523
Medina, Ohio 44256
216-725-4560
Box 1712
Auburn, Ala. 36830
800-633-8724
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 31/68
AIM·65 in the Ham Shacl(
Have a field day with this message transmitter ancl keyer.It will accept and save messages to be broadcast auto-
matically, as needed, in response to a single keystroke.
\,
T OTRANSMITTER
9
r----I
< J -T OTRANSl l ITTER
+5 V
Figure 1: Buffer circuit to key the transmitter.
Some transmitters may require the keying relay.
Only two ICs, a 74LSOO and a 7402 are required to
construct this interface and the keyer interface in
Figure 2. Both ICs have pin 14 as + 5V and pin 7 asGND.,
j
September, 1979 MICRO - The 8502 Journal
Dr.Marvin L . DeJong
Department of Mathematics
and Physics
TheSchool of the Ozarks
Point Lookout, MO65726
Contest operating is a lot easier if
standard messages such as "COCOVODE KOEI KOEI K" can be sent auto-
matically. The program listed in Table I
inthe AIM65 disassembly format allowsyou to dojust that. It has the following
features:
1) Three different messages, calledA, B, and C,may bestored inone
pageof memory. Thetotal numberof characters, including spaces,may not exceed 256 characters.
2) Themessages arecomposed andedited using the AIM65 keyboard.As the message is typed on the
keyboard, it appears on the dis-play and scrolls left. The delete
key allows corrections to bemade. The carriage return key
signals that the message is com-
plete, and the display blanks inpreparation for the next message.
3 ) When all three messages are
entered the display blanks again,
and you enter your code speed in
words per minute (indecimal). Thecode speed will remain displayed
until new messages are entered
by restarting the program.
4) With the messages and code
speed loaded, a depression of theA keywill result inmessageAbe-ing sent, theB keywill causethe B
messagetobesent, and the Ckey
will cause the C message to be
sent.
5) The code speed can be changedat the end of any message by
pressing the S key. This displaywill blank, and a new code speed
can beentered.6 ) A simple interface circuit and an
interrupt routine allow the same
program to be used as a keyer,
operating at the same speed as
the speed entered on thekeyboard. You must provide pad-dle, or modify a bug to make the
mechanical connections.
7) Code speeds from 5 wpm to 9 9
wpmarepossible for themessagesender and keyer, though it is
16:29
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 32/68
CB2
D O T
PB 7
Figure 2: Interface circuit for the keyer. All con-nections are to the Applications Connector on theAIM 65.
unlikely that any of us will ever
send 99 wpm with a keyer.
Before illustrating how the program
might be used, let me point out that a
similar program for the KJM-1 is schedul-
ed to appear in the September or Oc-
tober issue of 73 Magazine, and the
details of its operation are described
there. Only a few features unique to the
AIM 65 version will be given here. Also,
most of the display routines have been
described in a companion article in
MICRO, and they will not be described
again.
Let me describe how the keyer and
message sender might be used for Field
Day. You would start the program, then
load message A as follows: "CO CO CO
FD DE KOEIfOKOElfO K" Expecting so-
rneone to respond to your CO, message
Bwould be "DE KOEIUR MO MO BK"To use message B, you would first send
the other guy's call with the keyer and
then hit key B on the keyboard. The
blanks, spaces inserted by pressing the
keyboard, would be fil led by you, again
using the keyer, to give the proper signal
report. Message C might read "OSL ES
TU OM" and would be sent after you
received his signal report and section
correctly. It would not be difficult to
modify the program for sweepstakes or
16:30
•• M A I N PROGRA M
• M OD IFI ED 7-16-79• B Y M I CRO S T AFF
•0200
0200 78
0201 A9 A O
0203 8D OC A O
0 206 A 9 0 10208 8D 00 A O
0 20B 80 0 2 A O
0 20E 20 9 B 030 211 A2 0 0
0 213 A O 00
0 215 94 01
0 217 20 3C E9
0 21A C9 7F0 21C D O 10
0 21E A 9 2 00 220 88
0 221 99 00 01
0 224 8A
0225 48
0 226 20 85 03
0 229 68
022A A A
0 22B 18
0 22C 90 E9
0 22E C9 5B0 230 FO 2A
O RG
SEIL D A IM
S T A
L D A IMS T A
S T A
JS RL DX IM
L DY IM
S TYZ X
J SR
C MP IMB NE
L D A IMD EY
S TAY
T XA
PH A
JS R $0385
PLA
T AX
CLC
MICRO - The 8502 Journal
B CC $0217
CMPI M $5B
B EQ $025C
$0200
$A O
$ A OOC
$01
$ A OOO
$A002
$039B$00
$00
$0001
$E93C
$7F$022E
$20
$0100
0232 C9 00
0234 FO 13
0236 99 00 01
0239 8A
023A 48
023B B 9 00 01
023E 20 72 0 3
0241 20 60 0 30244 68
0245 A A
0246 c 8
0247 D O CE0249 8A
024A 48
024B 20 9B 03
024E 20 60 0 3
0251 68
0252 A A
0253 88
0254 94 04
0256 c 8
0257 E8
0258 EO 03
025A 90 B 9025C 20 9B 03025F 20 60 03
0262 20 3 C E9
0265 48
0266 20 72 030269 20 60 03
026C 68
026D 38
026E E9 300270 OA
027 1 OA
0272 OA
0273 OA
0274 85 11
0276 20 3 C E9
0279 48
027A 20 72 0 3
027D 20 60 03
0280 68
0281 38
0282 E9 30
0284 180285 65 11
0287 480288 29 FO
028A 4A
028B 85 10
028D 4A
028E 4A
02B F 18
0290 65 100292 85 10
0294 68
0295 29 OF0297 65 10
0299 85 10
029B 38029C A 2 00
029E A 9 9402A O 85 08
02A 2 A 9 04
02A 4 85 09
02A 6 A 5 08
02A 8 E5 10
02A A 85 08
02A C A 5 0902A E E9 00
02B O 85 09
02B 2 E8
02B3 B O F1
CMPI M $00
B EQ $0249
S T AY $0100
T XA
PH ALOAY $0100
JS R $037 2
JS R $0360
PL A
T AX
I NY
B NE $0217T XA
PH A
JS R $039B
JS R $036 0
PL AT AX
D EY
S TYZX $0004
I NY
I NX
CPXI M $03
B CC $0215J S H $039BJS R $0360
JS R $E93C
PH A
JS R $0372JS R $0360
PL AS EC
S B CI M $30
A S L A
A S L A
A S L A
A S L A
S T A Z $0011
JSR $E93C
PH A
JS R $0372
JS R $0360
PLA
S EC
S B CI M $30
CLCA D CZ $11
PH AA ND I M $FO
LSRA
S T A Z $0010
LSRA
LSRA
CLCA D CZ $0010S T A Z $0010
PL A
A ND I M $OFA D CZ $0010
S T A Z $0010
S ECLDXI M $00
LD A I M $94S T A Z $0008
LD A I M $04
S T A Z $0009
LOA Z $0008
S B CZ $0010
S T A Z $0008
LD A Z $0009S B CI M $00
S T A Z $00 09
I NX
B CS $02 A 6
September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 33/68
02B 5 86 07
02B 7 A 9 4302B 9 80 04 A 4
02B C A 9 03
02B E 80 05 A 4
02C1 A9 90
02C3 80 OE A O
02C6 20 3C E9
02C9 58
02CA C9 53
02CC [' 0 B E
02CE A O 00
0200 C9 410202 [' 0 OA
0204 C9 42
0206 [' 0 05
0208 C9 43020A 00 EA
020C c 8
0200 c 8
020E B 6 01
02EO 20 EO 02
02E3 8A
02E4 09 04 00 .
02E 7 [' 0 00
02E9 E802EA 4C EO 02
02EO 8A
02EE 48
02E[, B O 00 01
0 2 [' 2 A A
02F3 B 5 00
02F5 FO 1E
02F7 OA
02F8 FO 1002FA 48
02FB B O 06
02FO 20 1A 030300 4c 06 03
0303 20 33 03
0306 68
0307 4c F7 02
030A A 2 02
030C 20 38 03030F CA
0310 00 [' A
0312 68
0313 A A
0314 60
0315 A 2 04
0317 4C OC 03
031A A 2 01
031C CE 00 A O
031F 20 38 03
0322 CA0323 00 FA
0325 A O 00 A O0328 4A
0329 B O 07
032B EE 00 A O
032E E8
032F 4C 1F 03
0332 60
0333 A 2 030335 4c 1C 03
0338 A 5 07
September, 1979
S T XZ $0007
LOA I M $43S T A $A 404
LOA I M $03
S T A $A 405
LOA I M $90
S T A $A OOE
JS R $E93C
CL I
$53
$025C$00
$41$020E
$42
$0200
$43$02C6
C MP IM
B EQ
L OY IM
C MP IMB EQ
C MP IMB EQ
C MP IM
B NEI NY
I NY
LOXZY $01
JSR $02EO
T XA
CMPY $00 04
B EQ $02C6
I NX
JMP $02 EO
• S EN D S UB RO UT IN E
• T XA
PH A
LD AX $0100
T AX
LOAX $00
B EQ $0315
A S L A
B EQ $03 0A
PH A
B CS $03 03
JS R $03 1A
JMP $03 06
JS R $03 33
PL A
JMP $02F7
LOXI M $02
JS R $03 38OEX
B NE $030CPL A
T AX
RT S
•• OI T A NO OA H• S UB RO UT I NE S
•LOXI M $04
JMP $03 0C
LOXI M $01OEC $A O OO
JS R $03 38
OEXB NE $031F
LOA $A OOOLSRA
B CS $0332
I NC $A OOO
I NX
JMP $031F
RT S
LOXI M $03
JMP $031C
•• T IM ER S UB RO UT IN EIi
LOA Z $0007
other contests. Any t ime you vlant to ln-sert something in a message, oe sure toleave enough time, in ASCII spaces, tokey in the insert. You soon gel the hangof working so smoothly that no one willrecognize your insert for what it is.
Some notes about the proqrarn maybe useful if you want to modify it for yourown purposes. Instruct ions start ing at$0200 and ending at $025F are used toload the three messages. The instruc-
tions starting at $0262 and sndlnq at$0285 are used to enter the code speedin decimal, convert the ASCII represen-tations to decimal numbers, and storethe result in location $0011. The lnstruc-tions starting at $0287 and sndlnq at$0299 are used to convert this decimalnumber to a hexadecimal number andstore it in location $0010. The lnstruc-tions starting at $029B and ending at$02B5 are used to convert the speed to anumber to be loaded into tile divide-by-1024 timer. The remainder of the pro-gram tests for A, B, or C key depres-sions, and it calls on var ous sub-routines to send the message If you donot want to use the AIM 65 as a keyer,
then you may omit the interrupt rout ine.
Note that in my program listings I us-ed page one, addresses $0100 and up-ward to store the message. I ""ould notrecommend this, but since I have only1K of memory, I could not use $0400 to$04FF. If you have more than 1K ofmemory, I would urge you to change allthe $0100 addresses in the program to$0400or the page of your own choosing.These instructions are located at $0221,$0236, $023B, and $02EF.
The interface circuits are shown inFigures 1 and 2. Figure 1 gives a circuitthat simply buffers the output of the PBO
pin to key my transmitter. A optionalrelay may be required for other trans-mitters. The NOR gates were used be-cause I needed a NOR gate in the keyercircuit, and the NOR gates allow you toOR your own keyer to the messagesender circuit. The keyer circuit is shownin Figure 2. Basically it debounces thedot and dash paddle connectlons, and itmay be reset with a pulse fron pin CB2.
When the key is put in either the dot ordash position, a negative going signal isproduced at pine one of th 3 7402. Anegative pulse on CB1 produces an in-terrupt, so the program [urnps to pro-cess the interrupt routine. In the inter-rupt routine Port B is read (L DA AOOO),producing a negative pulse on CB2. Thisnegative pulse will reset the cross-coupled NAND gates if the <e y is up,otherwise pin one of the 7402 will stay atlogic zero. As long as it is at logic zerothe program continues to ser d dots (ordashes). Reading Port B also clears theinterrupt flag on the 6522. As soon asPB6 is set to logic one by the negativepulse from CB2, the interrupt routine iscompleted and execution co -nmues Inthe main program. fJ
MICRO - The 8502 Joumal
033A 80 97 A . 4
0330 2C 97 A 4
0340 10 FB
0342 60
0343 48
0344 8A
0345 48
0346 A O 00 A O
0349 30 06
034B 20 1A 03034E 4C 54 03
0 3 5 1 20 33 030 354 A O 00 A O
0357 OA
0 358 10 EC
0 35A 68
035B A A
035C 68
0350 40
0360
0360 A 2 13
0362 8A
0363 48
0364 B O 38 A 4
0 367 09 80
0 369 20 7B EF
036C 68
0 360 A A
036E CA
036F 10 F1
0 371 60
0 372 80 4C A 4
0375 A 2 01
0377 B O 38 A 4
037A CA
037B 90 38 A 4
037E E80 37 [' E B
0 3 B O EO 15
0382 90 F30 3 B 4 6 0
0 3 B 5 A 2 12
0387 B O 38 A 4
038A EB
038B 90 3 B A 4
03B E CA
038F CA
0390 10 F5
0392 A 9 20
0394 B O 3 B A 4
0397 20 60 03
039A 60
039B A 2 13
0390 A 9 20039F 90 3 B A 4
03A 2 CA
03A 3 10 FA03A 5 60
S T A $A 497
B I T $A 497
B PL $033D
RT S
• I NT ERRUPT RO UT IN E
PH A
T XA
PH A
LOA $A OOO
B M I $0351
JSR $031AJMP $0354
JS R $ 0 3 3 3
LOA $A OOO
A S L A
B PL $0346
PL A
T AX
PL A
RT I
•• O IS PL AY
• S UB RO UT I NU
•ORG $0360
LOXI M $13
T XA
PH A
LOA X $A 43B
OR A IM $ B O
JS R $EE' 7B
PL A
T AX
OEX
B PL $0362
RT S
•• M OO IFY S UB RO UT IN E
•S T A $A 44C
LOXI M $01
LOAX $A 43B
OEX
S T AX $A 438
I NX
I NX
CPXl M $15
B CC $0377RT S
•• B A CK SP AC E
• S UB RO UT I NE
•LOXl M $12
L D AX $ A 4 3 B
I NX
S T AX $A 438
OEX
OEX
B PL $ 0 3 B 7
LOA 1 M $20
S T A $ A 4 3 B
JS R $0360
RT S
•• CLE AR S UB RO UT IN E
•LOXI M $13
LOA I H $20
S T AX $A 438
OEX
B PL $039FRT S
16:31
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 34/68
ATARI® 400™
PERSONAL COMPUTER
SYSTEMP R IC E IN C LUD E S:
computer Console
BASIC Language Cartri dge
BASIC Language progr amming
Manual (Wil ey)
400 operator's Manual with
Note Book
power Supply
TV Switch BOx
ATARI® 800™
PERSONAL COMPUTER SYSTEM
P R IC E I NC LUD E S:Computer Console
BAS(C Language Car tridge
Education System Master Cartridge
BASIC Language PrOgramming
Manual (Wi ley)
BOO operator's Manual with Note Book
ATARI 410 Program Recorder
Guide to BASIC prOgramming Cassette
BK RAM Module· Power Supply'
TV Switch Box
$99999
WE PROMISE TO D EL IVER!!!• We GUARANTEE ship dates on prepaid Computer System orders. Send your orders in now!!!
• If for reasons beyond our control we miss a ship date, we will REFUND the shipping andhandling charges and give you a 10% DISCOUNTon any future software purchases for yourATARI®System. *
• For prepaid system orders, get a FREEAccessory Controller of your choice.
'Order must be prepaid by Cashier's Check made out to Computer Components of Orange County.
ATARI USER'S CROUP INFORMATION ... CALL (714) 891-2584
PERIPHERALS AND ACCESSORIESATARI@810™DISCDRIVE-DISKETTES
CX8100 BLANK DISKETIES"CX8101 DISK FILE MANAGER"
55.00/ea.
$749.99
ATARI® 820™PRINTER- $599.99
ACCESSORY CONTROLLERS
CX2C·01 DRIVING CONTROLLER PAIRCX30·04 PADDLE CONTROLLER PAIRCX40,04 JOYSTICK CONTROLLER PAIR
519.95/ea.
SOFTWAREGAMES $49.99/ ea.
CXL4004 BASKETBALLCXL4005 LIFE .CXL4006 SUPER BREAKOUTTMCX4008 SUPER BUGTM--
$39.99/ea.
CX6009 GREAT CLASSICS (ENGLISHICX6010 BUSINESS COMMUNICATIONSCX6011 BASIC PSYCHOLOGYCX6012 EFFECTIVE WRITINGCX6013 AUTO MECHANICSCX6014 PRINCIPLES OF ECONOMICSCX6015 SPELLINGCX6016 BASIC ELECTRICITYCX6017 BASIC ALGEBRA
ATARI® 410™PROCRAM RECORDER$89.99ADD-ON MEMORY (800 ONLYI
CXB52 BK RAM MEMORY MODULE 5124.99CXB5316K RAM MEMORY MODULE $249. 99
(JI(ll(PI« n
APPLICATION $69.99
CXL4002 ATARI BASICCXL4003 ASSEMBLER DEBUG - -CXL4007 MUSIC COMPOSERCXL4009 COMPUTER CHESS- •
COMPUTER COMPONENTS OF ORANGE COUNTY
6791 westminster Ave., Westminster, CA92683 714-891-2584 Telex 182274Hours: Tues-Fri 11:00 AM to 8:00 PM-sat 10:00 AM to 6:00 PM-Sun 12:00 to 4:00 PM (Closed Mon)
Master charge, Visa, B of A are accepted. Allow 2 weeks for personal check to clear.Add $2.00 for handling and postage. For computer systems please add $10.00 for Shipping,
handling and insurance. California residents add 6% Sales Tax.• MAIL ORDERLINE (714) 891·2587 OrTELEX 182274.
VAN NUYS BURBANK LAWNDALE ORANGE COUNTY IRVINE(213}786-7411 (213}848-5521 (213) 370-4842 (714}891-2584 (714}891·2589
ROM CARTRIDGES
CXL4001 EDUCATION SYSTEM MASTERCARTRIDGE ... .... .... 534.99KEY: ( il = uses JoystiCk controller
(Pi = uses paddle conrrouer(dl = uses dr iving con rroue r
EDUCATION SYSTEM CASSETTE PROGRAMS
CX6001 u.s. H ISTORYCX6002 U.S. GOVERNMENTCX6003 SUPERVISORY SKILLSCX6004 WORLD HISTORY (WESTERN ICX6005 BASIC SOCIOLOGYCX6006 COUNSELING PROCEDURESCX6007 PRINCIPLES OF ACCOUNTINGCX6008 PHYSICS
BASIC GAME ANDPROGRAM CASSETTES
CX4101 GUIDE TO BASIC PROGRAMMING-CX4102 BASIC GAME PROGRAMS-
529.95/ea.
• October Delivery • " NOvember Delivery
-Prices subject to change.-
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 35/68
\,
j
./
In Southern California we re Number oneuCOMPUTERCOMPONENTS (CCI)OFOR NGECOUNTY, your full
support computer store presents the fi est in personal computersSendfor our 36 pagefully illustrated catalog S3°0• SaveSO~by sendi the top one inch of this ad with your order.
AN INDUSTRYSTANDARD
Apple IIorApple II Pluswith 16K51195
c ompu t c z r
M W .. _ .
SPECIAL13" Color TVcompatiblewith Apple II
only 9900
with systempurchase
INTERFACE C, RDSPro to typl ng l ~obbV Card
Parallel ertnn r Inter face Cardc omm u n tc a t! m s c ar d & 08 25Connector C ,er e~Ign-Speed Sf: r\31Interi3Ce C3rdLanguage svs em wn n Pascal(48KRAM, [ ll sk IIaequr rernAPPlesOft IIF/ mwara Card16 I np ut Anal l g Car d
S 24.00
1BO.00
225.00195.00
495.00200.00295.00
ACCESSORIESDisk II-Drive I InIVD isk I I-Dr ive ~ Con trol le r (UK Min.RAM eeconr lendecH 595.00vinVI Carrying Case 30.00Tape Recordel 40.00Pr og rammer .; A id NO .1 F irmwa re ( Foruse with Intlger BASIC) 50_00CloclC/C3lend. r carc 199_00Aut o- St ar t R )M Pa ck ag e ( ForAPpleti OnlVDlglklt lzer Pol ' t ev taresIKltfonnl _ _.Hig" Re!iOlutit n L ight penMicromodem D_C_Haves)12' · B IW Leebl ·XMonitorCab le f rom M( nttor to Apple I I13· ·Co lo r TV( crnpannre withApple IISup-i t-MOduia or \ ll t= \
SOFTWARE FeR APPLE II
PASCAL from Icqramma 49.95FORTH 49.95I ISP- fromA~ J leSO ftwa re BkNo. 3 NI C
LISA-Interact ve disk assembler 34.95WHATSIT-Exc! tl en t conve rsat iona l database managE r UK 100 .00 4BK 125 .005ARGON-Cnam] Of 2nd Wes t coastCompu te r t=a reAPPLE PIE-EX .enent text edi torF-ORTE-MuSIc !Cltor Inhirest=ASTGAMMON· - sxc enene backgammongame wl tn gl il PhlCS Tap e 2 0. 00 Di sk 25 _00APPLE21-Ex( euen t blackjack game 9.95BRIOGECHALLI NGER-Computer b ri dge 14.95FINANCIAL MA .ACEMENT SYSTEM• Accounts Pa table • ledger processing• Accounts Re :elvable • Pavroll
: ~~~~n~~~ ~I ~~~~Ie : ~~go~~~~~~~~
~ - - - - - - - - - - - - - - - - - - . _ - -
APPLEII will change the way you think about computers.That's because it is specifically designed to handle theday to day tasks of education, financial planning,building security, scientific calculation, andentertainment. APPLEII is appealing and comfortable(like other appliances that make your life easier)' and itbrings to personal computing a new level of simplicitythrough hardware and software sophistication.
Reference Books for Apple and PETOwnersProgramming Manual (MOSTEK) . $12.00Hardware Manual (MOSTEK) . . . . 12.00programming the 6502 (ZAKS) . .9.956502 APplication Book (ZAKS) ,.,.. '12.95Programming a Micro Computer: 6502 (FUSTER) . 9.95
PETOwners OnlyPETUser Manual . , .Hands on BASICw ith a PET ..PETMachine Language Culde
. .. $9.95
..... 14.959.95
495_00
PRINTER SPECIALS FOR APPLE AND PET
TRENDCOM100 w ith Inter face forADPle o r PETL ITEPEN used W ith TVo r mon itorscreenALFMusiC svnenesner acarussuoertareeranaeex DP-BOOOwith tractera: paper w id th and Inter facero AppleCen tron ics 779 ·2 for App le 1\
with paral le l Interface
450.00
34.95265.00279_00
65.00
SOFTWARE {$e l1d for complete SOf twareCatalog $1.001
DOWJones ecrttouo Evaluator I
StOCk Ouote Reporter Diska r c r ccne s s 2.0 cne s s DiskDisk Uti li ty PaclCwith DOS3.2The Control ler (General Businesssystem) 625.00Apple Post (Mailing list System) 49_95Bowling Program Diskette 15_00The Cashi er lRe taUSto re Man3gemen t 250 .00Checkbook Cassette 20.00Applesoft II Language & DemocassetteRAM Test Tape with ManualFinance 1-2Cassette PaCkagenatamcver i reieecnq cassetteteem. Ca rd ' Mo dem ReQ ·d)Mlcroche!iS 2.0 Chess TapeBow li ng Program TapePasca l w ith l anguage Sys tem!48K RAM & Disk IIReQuired)
1050.00
124500
50.0025.0025.00
20.007_5025_00
7 SO20001500
495_00
499.00199.00379_00149009.95
290.0025.00
19.9524.9519.95
MISCELLANEOUSVlnvl mseeree Holder PagesIPkg of io: 8.50Diskette Boxes (BA Plastic) 4 SODiskettes (5··)Apple (Box of 101 50.00ve rbat im (Box o f 1m 3400ovsan (Box of 5) 25_00Decals (RainbOW Apple)ms t ce wrncowrz": l0COu ts roe Window (2··) l0COu e s r c e Window 11··) s cApple logo (Rainbow) t-snters 6_00so ec lf y-Me n. Women. o r c hi ld I smai lmed ium, o r l arge )
APple Owners OnlyApple I I Ref ,! rence ManualApple Soft nanual ... ,. ..,"'" 'Programmlr's Culde (computer Station)APPle II MOllltor Peeled ,. ,.Sof tWare 01rectory for Apple• Buslne! s , F inance & utility• Cames, Demo, Utility ,
Best o f corn act 78 ' . , . . .. . ...P rogrammllg In PASCAL (Crogono)
$10.0010.005.959.95
4.95.4.952.50,9.90
A PROFESSIONALBUSINESSSYSTEM
~~:rnrnodore CBM™
2001-16B$995
Also
2001-8 . , .... $7952001-16N , , .. $9952001-32N ... $12952001-32B , , . $1295
341KDUAL DRiVe-' 80 COL. DOT
MATRIXPRINTER
ACCESSORIES FOR PETCommodore PET Service Kit .Beeper- Tells when tape Is LoadedPetunla- ·Play music with PET .. . ,Video Bu 'fer-Attach another display.Combo- petunia and Video Buffer
S()FTW ARE FOR PET
$30.0024.9529.9529.9549.95
COMPUTER COMPONENTS OF ORANGE COUNTY
6791 westminster Ave., Westminster, CA92683 714-891-2584 Telex 182274Hours: Tues-Fri 11:00 AM to 8:00 PM-Sat 10:00 AM to 6:00 P -Sun 12:00 to 4:00 PM(Closed Mon)
Master Charge, Visa, B of A are accepted. Allow 2 we ks for personal check to ctear .Add $2.00 for handling and postage. For computer svste s please add $10.00 for Shipping,
handling and insurance. California residen s add 6% Sales Tax.
C8M 2040$1295
CMB 2022$995
AlSO
ExternalCassette .. , . $95PET to IEEEcable $39.95
Also
CBM 2023printer .. , ... $849IEEEto IEEEcable " .. $49.95
•• Retrofit kit required for operation with PET 2001·8 .
Mirrors arid Lenses ..... 19.95 checkers and Baccarat .7.95The state: ... ,. .14.95 Chess . . .. ... 19.95Real Estate 1 & 2. .59.95 Series and ParallelMomentum and Energy , .19.95 Circuit Analysis 19.95ProJectile Motion 19_95 Home Accounting 9.95MortgagE. . 14.95 BASIC Math 29.95Dow Jone; 7.95 Came Playing with BASICPetunia P ayerSftwr .... 14.95 Vol. I, II. III .. 9.95 each
PI JSmany more. Send for SoftWare catalog $1.00.
-Prices subject to change-
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 36/68
Stephen Bach ofRt 2, B ox 50Al,.Scott::jyille, VA
reports that th~ 24 H our AI M Clock program. on
MI CRO 10:7 should contain F? (SED] atl.dcation
0305, rather than 38 (SEClas published.
: , : , : : : , - - - : : : : ' : , _ ) - , , : : , : ' , , '
Peterj. Sl e ggs of 1208 Half' Mo.on Lane, Oakville
On tar io [.6 F 2 .6 5're por ts t hat th e. EK IM Exte nsi on
to the . monitor in MI CRO .11:20 will not .
perfor expected1n ..the autoincreinent and
branch mo E s, H e suggests changing .17Dl from
BO AD (B CS ST ART) t 4 (B CS GETK} •. Hr.. inclu
0381- 02 45 OA 41 20 53 49
0388- 55 OD 44 52 4A 4E 46 43
0390- 4B 54 5A 4C 57 48 59 500398- 51 4F. 4 2 47 06 4D 58 56.
03AO- 00 99 33 99 2D 99 07 38
03A8- 37 03 24 34 27 2C 21 3A
03B O- 28 35 22 29 32 23 36 30
03B 8- 31 39 3F 26 99 2E 2F 3B
03CO- 99 00 00 c o 00
[.t. Robert Carlson speculates that his article
on A B audot Teletype. Driver for the.APP['E H in
M IC RO 14 : 5 w as m tl ti la te d b y t ne ~d :! J' ()r 'i ;i l. st .a ff ..
It's true: location 037C shouldcontai.n.68
(RORA), rather than 6E (ROR) , and the spurious
o pe ra nd b yt .e s a t o 3 7 D a nd . 0 37 E~ ho ~1\ 1b ;j rE !m o"E !d
to close up the .code •. Inad.diti9n;~.~h;.t'Of+()'li-.
ing lookup table should follow the pr;o~ramcode,
be gin nin g a t lo cat ion 03 81, im med ia: tl: llY a ft erthe RTS which moved upward two bytes;'
',,:'i:."-:i
a S t re e t, ' W in d so r
crobe in H armonic
13:5~ which works
r mo ni cs h ap pe ns
e as y~ C :: ha ng e. li ne .
Roger Cohen, 100 Nimbus Road, H olbrook,
reported the same editorial slip-up.IN; rnAL SCALE c .
N T "P L OT OF IN PUT D A.T A ·
FT B H AR MO NI C> YA T 100Several readers reported problemswlth thE)AMPERSORT article on MI CRQ14: 41. G.. Lewis
Scott of 6220 COlchester Place, Charlq.1;te,NC
282,0 sent in seven corrections to tne assembly
l an gu ag e s ou rc e:
llowing changes to improve
graphics output: .79 .'
H P L O T TO k J' 79- Y
This plo.ts the original curve as a solid line
which wiLl stand' out from the harmonics.ine 0370 should be 5201- 20 E 7 ' 54
Line 0400 should be 5207- DD 20 55
Line 1180 should be 5298- B D 33 55
Line 1240 should be 52A5:" 20 OA 55
Line 2810 should be 53CA- 20 C2 54
Line 28 70 s ho uld be 53D8- 20 0-2 511
Line 3320 should be 5425- 20 OA 55
Wi ll ia ll l(J . T a. r; tp r- lr it es p f a n e rr or t n. h is
articlt'!.n eB a~icMorse Keyboard. H I CR013: >3.
T he t(; m~ tb ( a rd ll cq em at ic .b as ; o ut pu t ' .r qm .t il e
computer ar.d +S ..'lp()werreversed! Exchange PB t)
and +5 V.'.c correct. Although the parts list
sholfs·.a50.yf cap.whn~·the schematic shows
35'yffor' C f~eithervaluewitl worlc:. Finally,
line. 5.0t' l qe <I US j! G p ro gra m sh oul d in clu de
NT.b.eCi:>re.the outputstring~
and Mr. Scott noted some additional problems
once he got the program running. William G.
T rawick of the Georgia_ State University Dept.
of Chemistry in Atlanta, GA 30033report.edsome of the same microbes. Marlc:.rosby ofWashington APPLE. Pie and 1373 E Street SE.
Washington DC 2Q003 is also worl<ing these
difficulties. Alan G. Hill, the
AMPERSORT. is cQllating
p ro bl em s, m os t P i: Wh ic h d ev el OI p. e(i !. "h ~l n
minute enhancements were
source. I f you ihavelteyed. in
that tape I Anyf1nal paCOI'1t';~.
month.
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 37/68
Speech Processor for the PET
A speech processor unit samples audiowaveforms and digitizes the input signal.Digitized speech can be stored, catalog·ed, processed as discrete data, and out-
put through a D /A converter. The outputspeech quality rivals that of a CB radio.
Within the past year a low cost speechprocessor unit has appeared on themarket. This device designed for thecomputer hobbyist can be used in avariety of applications from voice aug-mentation to computer games to directcomputer-to-phone modem implementa-tions. .
This article will briefly describe thedevice and how the unit can be inter-faced to a PET computer. A softwaredriver program capable of storing the
digitized sound, playing it back, savingthe processed information on cassettefiles, and then reloading it will also bepresented. The article wil l conclude withan illustration of how this device mightbe used with a home computer system.
The Speech Processor Unit
The speech procesor unit used in thisarticle is the DATA-BOyTM Speech Pro-cessor developed by Mimic ElectronicsCompany. This processor is an extreme-ly low-cost audio signal processing sys-tem designed for the hobbyist. Thespeech processor is essentially aspeech "digitizer" which uses a proprie-tary signal processing technique to con-vert the human voice into a single bitstream, and vice versa. "Digitized"speech is typically thought of as speechwhich has been sampied with an analog-to-digital form, and then reconverted toanalog form by a digital-to analog (D/A)converter.
By using certain characteristics of thespeech waveform, especially the factthat the amplitude components tend todecrease with increasing frequency, theresolution of the AID and DIA convertersrequired can be decreased from, say, 8bits down to a single bit while main-taining intelligibility. When this bitstream is sampled at a rate of 8000
samples per second, highly intelligiblespeech can be obtained. The speechquality is close to that which is given bya CB radio.
Speech Processor Interface
Figure 1 describes the componentsnecessary to support the speech pro-cessor and its interface with the PETComputer. To digitize and then repro-duce speech the speech processor unitrequires the use of an additional
September, 1979
speaker, microphone and power supply.The speech processor unit l. s designedon a 3 inch by 5 inch printed circuitboard. The author's unit was built into a9 by 5V 2 inch box which also containedthe power supply. The simple power sup-ply design was taken direct l f f rom theusers manual provided wlth :he speechprocessing unit.
In addition to the interface, shown inFigure 1, the author added two addi-tional features to his uni t. To determine
when the squelch threshold level was ex-ceeded one side of a light emi tting diodewas connected to the DATA F EADY line.The other side of the LED was con-nected to the + 5 volt supply through a300 ohm registor. When the squelchthreshold level is exceeded the DATAREADY line goes low and LE[) glows.
A computer bypass switct was alsoadded to the author's unit. lhis switchallows the TO COMPUTER lind FROMCOMPUTER lines to be dirE,ctly inter-connected or interfaced to the com-puter. This feature allows t ie speechprocessor system to be teste:l indepen-dent of the computer. It also allows the
user to demonstrate the dif fel ence in in-telligibi lity produced by the computersquanitization effects.
The Speech Processor Unit is inter-connected to the PETComputer bythreelines. Each line is accompanied by aground to provide some degrell of shield-ing. The TO COMPUTER lir e is con-nected to PAO(Pin C) on the IJSERCon-nector. This line will be same led by theprocessor at the proper da:a rate toquanitize the input data st ' ea rn . Thedigital output data stream wil be return-ed to the speech processor lnit on theline marked FROMCOMPUTElt This lineis attached to PA7 (Pin L) on the USER
Connector. A third line termec the DATAREADY line is used to indicate if the in-put signal level exceeds the thresholdestablished in the speech processorunit. The DATA READYline is connectedto PA1 (Pin D)on the PETUSERConnec-tor.
Software Descriptioll
The software used to drive the speechprocessor device is written in two parts:A User Interface Program Nriften inBASIC and a pair of Speech Proceseo r to
MICRO - The 8502 JOl mal
Charles R. Husbands24 Blackhorse DriveActon, MA 01720
Computer Interface Programs written inmachine language. The User InterfaceProgram is designed to allow the user tointeract easily with the speech pro-cessor. This program provides four useroptions: RECORD, PLAYBACK, SAVEand LOAD.
The RECORDProgram calls one of themachine language interface programswhich samples the state of the speechprocessor bit stream and stores thesampled input data into sequential loca-
tions of buffer memory.
The PLAYBACK process is the directcounterpart of the RECORD process. Inthis mode each word in the buffermemory is unpacked and returned to thespeech processor to reproduce thespeech data examined during the RE-CORD sequence. The PLAYBACK pro-- c e s s I lke-the RECORD process-calls asupporting machine language program.
The SAVEroutine isa data file storageprogram which allows the user to saveall or some portion of the recorded dataon tape for later use.
The LOAD routine is a data file
retrieval program which allows digitaldate files stored on tape by the SAVEprogram to be restored into the com-puters memory. Both the SAVE andLOAD routines allow the user to design-ate the beginning and ending address ofthe data to be manipulated, With thisfacil ity data words stored in memory canbe saved and rearranged in order tobuild a data base where the beginning ofeach utterance or sound is uniquelydefined.
An illustration of the memory maporganization used to support the speechprocessor unit is shown in Figure 2.
From this map it can be seen that themachine language programs required tosupport the BASIC programs are storedin tape buffer #2. In order to establishsufficient buffer memory to store thedigitized speech information, a cap wasplaced on the BASIC program. By forc-ing the BASIC Interpreter into thinking itis operating with a 4K memory limita-tion, the upper 4K of memory can be us-ed for storing the recorded digitizedspeech. A smal l number of bytes in zeropage working storage are used for pass-
16:35
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 38/68
0010: REM •• SIMPLE VOICE PROCESS OR PROGRAM ••
0020: REM0030: REM B Y CHA RLI E R. HUSBA NDS
0040: REM
00 50: PRI NT "
0 060 : PRI NT " •• • VO IC E PR OCE SS OR P R O G R A M · · ·0 070 : PRI NT0080: POKE 135,12
0 0 90 : D A T A 1 69 , 00 , 14 1, 6 7, 2 32 , 13 3 ,5 4 ,1 33
0 10 0 : D A T A 5 6 ,1 68 ,1 69 , 08 , 13 3 ,5 5 ,1 69 , 12
0 11 0: D A T A 1 33 ,5 8 ,1 69 , 12 , 13 3 ,5 7, 16 9 ,3 0
0 12 0 : D A T A 1 33 , 59 , 78 , 79 , 23 2 ,3 8 ,5 4 ,1 98
0 13 0 : D A T A 5 5 ,1 65 ,5 5 ,2 40 , 11 ,1 65 , 58 , 17 0
0 14 0 : D A T A 2 0 2, 13 8 ,2 0 8, 2 52 , 23 4 ,7 6 ,8 4 ,0 3
0 15 0 : D A T A 2 3 4, 16 5 ,5 4 ,1 45 , 56 , 23 4 ,2 0 0, 16 9
0 16 0 : D A T A 0 8 ,1 33 , 55 , 15 2 ,2 0 8, 2 20 , 23 0 ,5 7
0 17 0 : D A T A 1 65 , 57 , 19 7 ,5 9 ,2 0 8, 2 12 , 96 ,0 0
0 18 0 : D A T A 1 69 , 25 5 ,1 41 ,6 7, 2 32 , 16 9 ,0 0, 13 3
0 19 0 : D A T A 5 6 ,1 68 , 16 9 ,0 8 ,1 33 , 55 , 16 9 ,1 2
0 2 00 : D A T A 1 33 , 58 , 16 9 ,1 2, 13 3 ,5 7 ,1 69 ,3 0
0 2 10 : D A T A 1 33 , 59 , 17 7 ,5 6 ,1 41 ,7 9 ,2 3 2, 2 34
0 2 20 : D A T A 1 65 , 58 , 17 0 ,2 0 2, 13 8 ,2 0 8, 2 52 , 23 4
0 2 30 : D A T A 1 98 , 55 , 16 5 ,5 5 ,2 4 0, 0 7, 14 , 79
0 2 40 : D A T A 2 3 2, 23 4 ,7 6 ,1 62 , 03 , 20 0 ,1 77 , 56
0 2 50 : D A T A 1 41 ,7 9, 2 32 ,1 69 , 08 , 13 3 ,5 5 ,1 52
0 2 60 : D A T A 2 0 8, 2 22 , 23 0 ,5 7, 16 5 ,5 7 ,1 97 , 59
0 2 70 : D A T A 2 0 8, 2 14 , 96 , 23 4 ,2 3 4, 2 34 ,2 3 4, 2 34
0 2 80 : D A T A 1 69 , 00 , 14 1, 6 7, 2 32 , 17 3 ,7 9 ,2 3 2
0 29 0 : D A T A 3 6 ,6 0 ,2 0 8, 2 44 , 76 , 58 , 03 ,2 3 4
0 300 : A =826
0310: FOR 1=1 TO 168
0320: READ D $
0330: POKE A,D $
0 340 : A =A +l
0350: NEXT I
0360: P R I N T · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·0370: PRINT · PRES S R FOR RECORD"
0380: PRINT · PRES S P FOR PLAYBACK"
0390: PRINT· PRES S S FOR SAVE"0400: PRINT " PRES S L FOR LOA D"
0410: P R I N T · · · · · · · · · .0420: GET C$:IF C$="· GOT O 420
0430: IF C$="R" GOTO 600
0440: IF C$="P· GOTO 700
0450: IF C$="S" GO TO 800
0460: IF C$="L· GOTO 9000470: GOT O 420
SPEA KER
C ENT ER L EA D PA RA LLEL
US ER
PORT
r--_,SQUELCH - Se t up US ER por t as
an inp ut a nd re ad USER valu e.
NO
I NrT l - Set u p USER po rt as a n
,inp ut. DA TAWD = O. Ini t d ata
p oin ter to $OCOO and end poi nt
to $l EOO. B IICNT = 8. DELAYC
= 12 .
LOCPl
STRGl
Sto re c omp leted D ATAWD i nto
n ext bu ffe r lo ca tio n a nd se t
BI TCNT = 8.
NO
Figure 3: Speech processor flowchart
[l ECIM . ~ L
DA TA RE ADY PA l (D) 7936
SPEECH GND (A )7680
GN DPROCES S OR
BOA RD T O C OM PU TE R PA D (C )
M ICROPHONE GN D3012
F RO M C OM PU T ER PA 7 (L )
GN D (N)
. . v PE T102~
COMPUTER0820
P OWE R S UP PL Y
Figure 1: Speech processor components
16:36 MICRO - The 6502 Journal
HEXI
__ I
------ - ---
D AT A B UFFE R
SPA CE
B AS IC P RO GR AM
M AC HI NF L AN GU AGE P RO GR AM
P AGE Z ER O , IO RK IN G S TO ~A G~
031A
lFGtJ
1 E O O
aeon
0'10']
Figure 2: Speech processor memory map
September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 39/68
\
ing variables between the machinelanguage programs and their BASICcounterparts.
The Record Program
The RECORD process is entered bypressing "R". This action causes thepointing vector corresponding to thebeginning address of the RECORDmachine language program to be placedinto locations 1 and 2. A value of 02 isalso placed in decimal location 60,
which is the squelch mask value to beused in the machine language routine.The machine language program is thenentered by executing the USR instruc-tion.
A flow diagram of the RECORD Pro-gram is shown in Figure 3 and a machinelanguage listing of the process is alsogiven. After initialization, the programloops wait ing for the DATA READY lineto go low. This action occurs when theamplitude of the voice level exceeds thesquelch threshold set on the speech pro-cessor board. Once the squelch level issensed, the program proceeds and therecord program initialization com-
mences.
)
A machine language listing of theSQUELCH Process is shown. If the userwishes not to implement the squelchtest, the values in line 610 of the pro-gram can be changed to:
610 POKE 01,58 : POKE 02,03and the record program will be entereddirectly.
After initial ization the record processbeings. The value of TO COMPUTER lineis sampled at PAOof the user's port andstored into the LSB of the buffer locationDATAWD. A counter (BITCNT) is thentested to see if 8 samples have beensensed. If 8 samples have not yet been
sensed, DATAWD is shifted left oneplace and a delay loop is executedbefore the value of the next bit is sampl-ed. When a full byte of data has beenreceived, the byte is stored away in thenext memory location. The values ofDATAWD and BITCNT are reinitialized. Ashort delay loop is executed and the pro-cess is repeated.
At the time that DATAWD is storedaway the location into which it is beingstored is checked against an upperbound pointer in memory. When the twoaddress correspond, the process hasrun out of available buffer space for therecord process and the machine
language routine returns control to theBASIC program. Completion of the RE-CORD process is indicated by the line"RECORD PROCESS COMPLETED" ap-pearing on the display screen.
\
Playback Program
The PLAYBACK program is entered bypressing "P". This action forces thepointing vector corresponding to the
September, 1979
beginning address of the playbackmachine language program tc be placedinto locations 1 and 2. Tht! machinelanguage program is then entered by theexecution of the USR instruction. A flowdiagram of the PLAYBACK program isshown in Figure 4. A machine languagelisting of the PLAYBACK prog 'am is alsogiven.
The PLAYBACK program r speats thesame basic process developed in the re-cord process. As each ne'lV byte is
retrieved from the buffer memory, thestate of the most significant bit is out-putted to the speech processor unit.After a finite delay, the D.HAWD isshifted left one position and the state ofthe new MSB is sent to the speech pro-cessor. When all the bi ts have been ex-amined, the next byte in buffer memoryis retrieved. When all of the bytes in thedata buffer memory have been examin-ed, the PLAYBACK process is completedand. the message "PLAYBI,CK PRO-CESS COMPLETED" appeas on themonitor screen.
Save Process
The SAVE process is a E,ASIC pro-gram written to allow the user to dumpportions of the buffer memo-yon tapefor later use. The process is entered bypressing "S". A prompting messageasks the user to enter the dEsired star-ting address and ending address in buf-fer memory to be saved. The contents ofthe memory locations between the twoselected locations is then 'IVritten ontape and upon completion o'f :his opera-tion the message "SAVE PROCESSCOMPLETED" appears on th « monitor.
Load Process
The LOAD program is also a BASICroutine designed to load into memory atape prepared by the SAVE program. Toenter the LOAD process the userpresses the "L" key. A me ssaqe willprompt the user to enter the slarting andending address of the data file to bestored. When the LOAD process is com-pleted the message "LOAD PROCESSCOMPLETED" will appear on lhe screen.
Typical Application
For an illustration of how these pro-grams might be employed, let's assumethe user wants .to have his computerautomatically dial up telephone numbers.Using the speech processor and the RE-CORD process, each dual tor e multiple
frequency (DTMF) output is recordedfrom a standard touch tone telephone.As each tone is recorded, a ds.ta f ile canbe written using the SAVE p re gram. Thestarting locating for each tone would bethe beginning of buffer memory. The en-ding address could be set at the beginn-ing of memory plus, say 200 bytes. Afterall ten tones have been recorded, thedata files collected by the ::lAVE pro-gram can be stacked consecutively on
MICRO - The 6502 JOIJmal
600 REM. RECOR!) MODE .
610 POKE 01,210: POKE 02,03
615 POKE 60,02
620 LET X=USR(R)
630 PRINT" RECORD PROCESS COMPLETED"
640 GOTO 420
700 R E M _ . PL\Y&.CK :-IODE .
710 POKE 01,130: POKE 02,03
720 LET X"'USR(R)
730 PRINT" PL\YMCK PROCESS COMPLETED"
740 GOTO 420
800 PRINT"**SAVE PROCESS INITATED"805 INPUT" FIL E NAM E"; N$
810 INPUT" INPUT STARTING ADDRESS"; S
820 INPUT" INPUT ENDING ADDRESS"; _
825 POKE 243,122: POKE 244,02
830 OPEN 1,1,1,N$
840 FOR I=O co (E-S)
850 PRINT IFl, PE:EK(S+I)
860 NEXT I
870 CLOSE 1
880 PRINT"**SAVE PROCESS COMPLETED**"
890 GOTO 420
900 PRINT"**LOAD PROCESS INITA TID"
905 INPUT" FILE: NAME" ; N$
910 INPUT" INPtrr STARTING ADDRESS"; S
920 INPUT" INPtrr ENDING ADDRESS"; E
925 POKE 243,12:2:POKE 244,02
930 OPEN 1,1,0,N$
940 FOR I=O co (E-S)
950 INPUT i Fl , A
960 POKE(S+I) ,.~
970 NEXT I
980 CLOSE 1
990 PRINT"**LOA.D PROCESS COMPLETED**"
995 GOTO 420
1000 END
200 byte boundaries using the LOADprogram. Wewould now have a data base. in buffer storage with each tone startingand ending on a known boundary.
In order to now dial any number, asmall BASIC program wouid be requiredto call the PLAYBACK program with theappropriate starting boundary and en-ding boundary addresses in the required
sequence. The resulting tones devel-oped through the speech processorwould then be acoustically coupled tothe telephone to complete the process.
Conclusions
This paper was designed to illustratehow a low cost speech processor mightbe interfaced with a PET Computer.
However, the same machine languagesoftware could be used to interface thedevice to any 6502. based processor withonly slight modifications. The use ofBASIC in this application provided aneasy method of mechanizing the man-machine interface. The application ofvoice or sound feedback in computing isalmost limit less and it is hoped that thisarticle illustrates one method of achiev-ing this goal. i .l
16:37
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 40/68
03CD
03CD
03CD
03CD
03CD
03CD
03CD
03CD
033A
033A A9 00
033C 8D 43 E8
033F 85 36
0341 85 380343 A8
0344 A9 08
0346 85 37
0348 A9 OC
034A -95 3A
OJ4C A9 OC
034E 85 39
0350 A9 1E
0352 85 3B0354 4E 4F E8 LOOP1
0357 26 36
035<; cs 37
035B A5 37035D FO OC
035F A5 3A
0361 AA
0362 CA0363 8A
0364 DO FC
0366 EA
0367 4C 54 03
036A EA
036B A5 36
036D 91 38
036F EA
0370 C8
0371 A9 08
0373 85 37
0375 98
0376 DO DC
0378 E6 39037A A5 39
037C C5 3B
037E DO D40380 60
0361 EA
03D2
03D2 A 9 00
03D4 8D 43 E8
03D7 AD 4F E8
A W a rn in g_ :_
The MACROTEA™is fo r P ro fess ionalProgrammers - and VerySerious Amateurs - O nly
Now: a machine language pro-gramming powerhouse for the
knowledgeable programmer whowants to extend the PET's capa-bilities to the maximum. TheMacroTeA, the Relocating MacroText Editor.Assembler from SkylesElectric Works.
The Skyles MacroTeA is a superpower1ul text editor. 26 powerfule ditin g c ommand s . S tr in g s ea rc h a ndr ep la c e capab il it y. Manusc ri pt f ea tu refo r le tte rs a nd o th er t ex t. T ex t lo ad inga nd s to ra ge on ta pe o r d is cs . S uppor tsta pe d riv es , d is cs , CR T, p rin te rs a ndkeyboard.
T he S kyles M ac ro TeA is a relo catin gmach ine l anguage assemb le r w it h t ruem acro capab ilities . A single nam eid en tifies a w ho le b od y o f lin es . Y ouw rite in b ig c hu nk s, exam in e, m od ifya nd a ss emb le th e c omp le te p ro gram .And , when load ing , t he Mac roTeA goeswhere you want it to go. Macro andc on ditio na l a ss emb ly s up po rt. A uto -m atic lin e n um berin g. L ab els u p to 1 0cha rac te rs long.
T he S k yle s Ma cr oT eA is a n e nh anc eM onitor. 11 pow erful com mands toease you past the rough spots ofp rogram debugging .
The Skyles MacroTeA is a warmstart button. Over 1700 bytes ofp ro te c ted RAM memory f or you rob j ec tcode.
There's no tape load ing and noo ccupying of valuab le R AM m em orys pa ce : T he S k yle s Ma croT eA pu ts 1 0Kby tes of executab le m a ch in e la n g u a gecode in ROM (from 9800 to BFFF-d ir ec tly b elow th e BASIC in te rp re te r) .2K bytes o f R AM ( 9 O C l O t o 9 7FF ).
L i ke a ll S k yle s P rod uc ts fo r th e PET, it 's p ra ctic ally p lug inan d go. N o to ols a re n ee de d. A nd , fa ste r th an lo ad in g a nequi va len t s iz e a ssemb le rl ed it or f rom tape , t he Mac roTeA isinstal led permanent ly .
T he S ky le s M ac ro TeA : 1 1 c hip s o n a s in g le P C B. O p er a te sin te rfa ce d w ith th e P ET 's p ara lle l a dd re ss a n d d ata b us o r witht he S k yle s Memo ry Connec to r. (Whe n o rd erin g , in d ic ate if th e
Ma cr oT eA w ill in te rfa ce w ith a S k yle s Memory Exp ansionS y stem . You c an s av e $ 20 .) S p ec ific atio n s a nd e ng in ee rin g a re
up t o th e p ro ve n Sk yle s quality s ta nd ar ds . Fu lly wa rra nt ed f or 9 0d ay s. And, a s w it h a ll S k yle s p roduc ts , fu lly a nd in te llig en tly
documented.
V IS A, M aste rc ha rg e o rd ers c all (8 00 ) 2 27-8 39 8 (E xc ep t C alif.)G V 4 California orders please call (415 ) 494-1210 .
O~! !~~Dr i ~ !~~~~~~~~ ! : . ~S
DATAWD I
BITCNT I
WD B
DLYCNT I
ENDBUF I
MASK
PADD
PA D
INIT1
DLY1
$0036
$0037
$0038
$003A
$003B
$003C
~E843
$E84F
ORG $033A
LDAIM $00 SET UP DIRECT ION REG
ST A PADD AS AN INPUT
ST A DATAWD DAT AWD = 0
ST A WDBTAY
LDAIM $08
ST A B ITCNT BIT CNT 8
LDAIM $OC
ST A DLYCNT DLYCNT 12
LDAIM $OC
ST A WDB
LDAIM $1E
ST A ENDB UF ENDB UF = $1 ELSR PAD PICK UP DATA BIT
ROL DATAWD STORE I N LSB OF DAT AWD
+01 WDB+ 1 = 12
DECLD A
BEQ
LD A
TAX
DE X
BITCNT
BITCNTSTRG1
DLYCNT DELAY FOR 8KHZ RATE
TXA
ENE DLY1 +0 3Na p
JM P LOOP1
NO P
STRG1 LDA DATAWD
STAIY WDB
NO P
INY
LDAIM $08
ST A B ITCNT
TYA
ENE LOOP1
INC WDB +01
LDA WDa +01
CMP ENDB UF
BNE LOOP1RT S
NO P
ORG $03D2
SQUELC LDAIM $00
STA PADDLDA PAD
ASSEM B LE LIST
0H' l0 ;M OVE TB L 1 TO TB L2
0110 .B A $400
q 4 0 0 - AI 0B 0120 LOOP LOY #00
q 4 0 2 - B 9 0B 04 Q ) 1 3 Q ) LOA TB L1.Y
q 4 Q ) 5 - 8 9 Q )B 05 Q ) 1 4 Q ) STA TB L2.Y
q 4 Q ) 8 - C8 Q ) 1 5 Q ) IN Y
q 4 Q) 9 OQ ) F7 Q ) 1 6 Q ) B NE LOOP
Q ) 1 7 0
q4Q )B Q ) 1 8 Q ) TB L1 . OS 25 6
q5Q )B Q ) 1 9 Q ) TB L2 .OS 256
Q ) 2 Q ) Q )
Q ) 2 1 Q ) .E N
l.AB EL F ILE 1 = EXTERNAL
~,TART = Q ) 4 Q ) Q ) LOOP = Q ) 4 Q ) 21 B L2 = Q)5Q )B
11Q )Q )Q )U6Q )B ,Q ) 6Q )B
TB L 1 = Q)4Q )B
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 41/68
03DA 24 3C BI T MASK
03DC DO F4 BNE SQUELC
03DE 4C 3A 03 JMP INI T1
03E 1 EA NOP,
0382 OR G $0382
0382 A9 FF INIT2 LDAIM $FF SET UP DIRECTION REGISTl:R
0384 8D 43 E8 STA PADD AS O UTPUT
0387 A9 00 L.DAIM $0 0
0389 85 38 STA I I B
0388 A8 TAY
038C A9 0 8 LDAIM $0 8
038E 85 37 ST A B IrCNT B IT CNT 80390 A9 O C LDAIM $OC
0392 85 3A STA DLYCNT DLYCNT 12
0394 A9 OC LDAIM $OC
0396 85 39 ST A WD B +01 IIDB+1 = 10
0398 A9 1E LDAIM $lE
039A 85 38 STA ENDBUF ENDBUF = 1E
039C B1 38 LDAIY liDB PICK UP WORD FROM STORACE
039E 8D 4F E8 STA PAD AND PL.ACE IN OUTPUT REG
03A 1 EA NOP
03A2 A5 3A DL.Y2 L.DA DLYCNT DELAY TO ESTABLISH
03A4 AA' TAX 8KHZ RATE
03A5 CA DEX
03A6 8A TXA
03A7 DO FC BNE DLY2 +0 3
03A9 EA NO P
03AA C6 37 L.00P2 DEC BITCNT
03AC A 5 37 LDA B ITCNT03AE FO 07 BEQ STRG2
0380 OE 4F E8 ASL PA D
03B3 EA NOP
03B4 4C A2 03 JMP DLY2
03B7 C8 STRG2 lN Y
03B8 B1 38 LDAIY WDB
03BA 8D 4 ( "E8 STA PAD
03BD A9 08 LDAIM $0 8
03BF 85 37 STA B ITCNT
03C 1 98 TYA
03C2 DO DE BNE DLY2
03C4 E6 39 INC WDB +01
03C6 A5 39 LDA WDB +01
03C8 C5 38 CMP ENDBUF
03CA DO D6 BNE DLY2
03CC 60 RT S
Is Programming Fun?
Have More Fun,Make Fewer Errors,Complete Programs MuchFaster ... with the
BAS IC PAOGAAMMEA ' S
TOOlKIT™
Now you can modify, polish, simplify,add new features to your PET pro-grams far morequickly while reducingthe potential for error.That ali adds upto more fun ... and the BASICProgrammer's ToolKitThe magic of the ToolKit: 2KB of
ROM firmware on a single chip with acollection of machine language pro-grams available to you from the timeyou turn on your PETto the time youshut if off. No tapes to load or tointerfere with any running programs.And the Programmer's ToolKit installsin minutes, without tools.Hereare the 11commands that can
be yours instantly and automatically... guaranteed to make your BASICprogramming a pleasure:
AUTO RENUMBER
HELP TRACE
OFF APPEND
FIND
DELETE
STEP
DUMP
Every one a powerful command toinsure more effective programming.Like the HELP command that showsthe line on which the error occurs... and the erroneous portion isindicated in reversevideo:
HELP50 0 J = SQR(A' B/~Ij)
READY
SYMB OL TAB LE 2000 2066
BIrCNT 0037 DATAWD 0036 DLYCNT 003A DLYQ 035F... Or the TRACE command that
DLYR 03A2 ENDBUF 003B INITQ 033A INITR 0382lets you see the sequence in which
LOOPQ 0354 LOOPR 03AA MASK 003C PADD E843your program is being executed in a
PA D E84F SQUELC 03D2 STRGQ 0368 STRGR 03B7window in the upper corner of your
WD B 0038CRT:
To Order PROGRAMMER'S TOOLKIT or MACROTEA-Custom deSigned to plug into your PET. So, when ordering, please Indicate if yourToolkit:
. .. wil l beused with the Skyles Memory Expansion System, or
._il l beused with the ExpandaPet, or Expandmem
... wil l be used with the PET2001-8alone(We lurnish connectors to the memory expansion bus and to the second cassette interlace.
... will be used with the PET2001-16,-32(chip only)
... wi.!I be used with Skyles MacroTeA
$80.00'
$80.00'$80.00'
$50.00'
$50.00'
The Programmer's ToolKit is a
product of Harry Saal and .hisassociates at Palo Alto lCs, a sub-sidiary of Nestar Systems, Inc. Dr.Saal is considered a leading expert inthe field of personal computers.
So, if you really want to be intoBASICprogramming - and you wantto havefun while you're doing it, orderyour BASIC Programmer's ToolKitnow. You'll be able to enjoy it verysoon. We guarantee you'll be de-lighted with it: if, for any reason you'renot return it within ten days. We'llref~nd every penny.And no questionsasked.
Your MacroTeA. Custom designed for your PET.So specify your PETmodel when ordNing.$295.00·
(Important Sarings: If i I's to be used with a Skyles Memory Expansion System, the MacroTeA canplug directly into the Skyles connector. So you save S20.The Skyles MacroTeA is Jnly S275.00when Interfaced with the Skyles Memory Expansion System_)
Send your check or money order to Skyles Electric Works_VISA, Mastercharge orders may call(800)227-8398.(California residents: please phone (415)494-1210.)TenDay Uncondit,onal Money·Sa.ckGuarantee on al/ products sold by Skyles Electr ic Works, except chip only.
g .llprice. complete, Including .hlpplng and handling. Plea.e allow 3 week•.
California ... Ident.: plea.e add 8-81'.r % California sale. tax.
SKYLESELECTRICWORKS 10301Stonydale Drive, Cupertino, CA95014,(4011)735·7891
- - - - - - - - - - - - - - - - - - - - - - - - ~
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 42/68
Skyles ElectricWork~;
You love your PE~r,but you'll
love it more with this BigKeyboard?
74KB Big KeyBoards @ $125.00 (Plus $5.00 shipping & handling)
The Skyles Big KeyBoard™. More than 15 inches wide. A layout nearly
0dentical to the PET Keyboard and with all functions-alpha, numeric, Sgraphics, special symbols, lower case alpha-on full-sized, almost plump,key-tops double-shot to guarantee lifetime durability.
Actual size
Would you like to turn on your PET. . . and see this8KB 8K Memory Expansion Systems @ $250.00
(Plus $3.50 shipping & handling)
16KB 16K Memory Expansion Systems @ $450.00(Plus $5.00 shipping & handling)
24KB 24K Memory Expansion Systems @ $650.00(Plus $5.00 shipping & handling)
Skyles Memory Expansion Systems are complete; nothing more to buy .• First qualitystatic RAMs. Solid soldered on first quality glass epoxy board. Separate PET AdapterPrinted Circuit Board connects directly to data bus on your PET -no rat's nest of hang-ing hand-wiring. Ribbon cable and 50 pin connectors that keep your PET open to theoutside world (one on the 8KB; two on the 16KB and 24KB).
__ 8KB Memory Expansion System(s) at $250 each. $ _(Adds 8,192 bytes; total 15,359 )(shipping and handling $3.50 each)
___ 16KBMemory Expansion System(s) at $450 each. $ _(Adds 16,384 bytes; total 23,551) (shipping and handling $5.00 each)
__ 24KB Memory Expansion System(s) at $650 each. $ _(Adds 14,576 bytes; total 31 ,743) (shipping and handling $7.00 each)
__ 74KB BigKeyBoard(s) at $125 $ _(shipping and handling $5.00 each)
__ SPECIAL DEAL(S): 8KB Memory and 74KB Keyboard at $350 complete $ _
__ SPECIAL DEAL(S): 16KBMemory and 74KB Keyboard at $525 complete $ _
• Please add 6% sales tax if you are a California resident; 6.5% if a resident of BART. Santa Clara or Santa Cruz Counties (CA).Please add shipping and handling costs as indicated.
VISA, MASTERCHARGE ORDERS CALL (800) :127-8398 (except California residents)
CALIFORNIA ORDERS PLEASE I:ALL (415) 494-1210
I10301Stonydale Drive
_. Skyles ElectricWor~~s~uri;r~~~~;~~5014
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 43/68
Tiny PILOT:
An Educational Language for the 6502
PILOT is a higher level language used for computer aidedinstruction. This version includes an editor and an Inter-preter. It requires fewer than 800 bytes of memory.
Nicholas Vrtis5863 Pinetree S.E.Kentwood, MI 49508
•• ••••••• ••••••• ••••••• ••••••• ••••••• ••••••• ••••••• ••••••• •••••• H •••••
• CH AR • EDI T FUNCT I ON•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• ;t •••••
• • START EXECUT I ON OF T HE PILOT PROGRAM• UPARROW· MOVE EDI T POI NT ER TO ST ART OF PROGRAM•I • DI SPLAY NEXT ~INE OF TH E PROGRAM• % • PAD TO END OF ~INE WI T H DELETE CHARACT ERS• B I S • B ACKS PACE T O CORRE CT T YPlN G E RROR• C I R • CARRIAGE RETURN - I NDI CATE END OF ST AT EMENT• ANY • CHARACTER I S ST ORED IN PROGRAM (MAX 127 PER ~INE)•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• 1•••••
• FORMAT • ST ATEMENT I w1iA I T DOES•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• ·1•••••
•
• MAY PRECEED ANY STAT EMENT (lit
• CONDI T IONAL. ACTS AS DEST lI A rION• FOR A JUMP OR USE STAT EMENT• AS PART OF TEXT CAUSES GONT I NrS• OF VARIABLES T O B E DI SPLAYD O R
• M AT CH ED .• ~? I ND IC AT ES N AM E FI EL DS .
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• i'· •••••
• T :T EXT • TYPE• •• A: • A CC EPT• •• ? : • A CC EPT ~AME
• •• M :T EXT • MA TCH• •• •• J:N • JUMP
• •• •• U:N • USE SUBROUT INE N• •• E: • EXI T F RO M S UB R OU T IN E
• •• S: • ST OP• •• C: • C OM PU TE• •• •• •• •• •• R: • R EM AR KS• •• • C ON D IT I ON A LS
• N •• Y •• •• ·N • ~ABEL• •• •• $X • VARI AB ~E I TEM• •• •• •
September, 1979
• DI SPLAY T H E TEXT ON T H E TERllINAL
• INPUT UP T O 40 CHARACT ERS mT O
• AN SWER FI ELD• INPUT UP TO 40 CHARACT ERS UT O• NAME AND ANSWER FI ELD.• COMPARE TEXT T O LAST I MPUT~ROM• TERMI NAL AND SET MA TC:! FLAG TO• Y I F EQUAL, N IF NOT EQUAL.• JUMP T O LABEL N FOR NEXT LI1E.
• J:A MEANS JUMP TO LAST ACCEI T .• J=. ME AN S RE ST ART FROM B EGI INI NG.• SA VE ADDRESS OF ST ART OF NE;:T• LI NE AND T HEN PERFORM AS I ~ JUMP.• RET URN TO ADDRESS SAVED B Y i'RIOR
• U SE S TA TE ME li T.• ST OP PROGRAM AND RET URN TO I :DI T OR
•• PE RFO RM S A RI TH ME TI C O N VA R1J .B LE S• NAMED A T HROUGH Z. ALLOWED• OPERAT I ONS ARE =, +, AND -• RANGE IS + OR - 999• C:$= wILL PLAGE RESULT IN WSWER• FIELD INSTEAD OF A VARIABLE• PRO GR AM R E. ~A RKS - N CT E XE Cl ' :E D
•• MA Y PRE CE ED AN Y S TA TE MEN T.• EXECUTE ONLY IF MAT CH FLAC:S N• E XE CUT E O NLY I F ! ". AT CHFLAG . :S Y
•
MICRO - The 8502 Jc,.mal
Are you envious of the guys on your
block who have big BASIC systems?
Have you ever tried to teach machine
language tosomeonewhothinks HEXis
an evil spell? I had the same problemuntil I discovered PILOT, and im-
plemented a small version onmySYM-1.For those who haven't heard of PILOT
yet, it is an educational, high level
language intended for computer aided
instruction. It is a verysimple language,
with only ten basic instructions, but it in-
corporates a number of features that
make it easyenough to useas amethod
for introducing people to computers. Ihavewritten somemath drill programsfor my six- and eight-year olds, and in
turn, myeight-year old loves towrite pro-
grams for her little brother to run.
This implementation of PILOTis not a
full "standard" version. After all, what
do you expect from an interpeter and
editor that run in less than 800 bytes? Ialso could not resist the temptation to
change things a little hereand there. It
is close enough togive a flavor for what
PILOT can do, and it makes a nice
language to havefun with, evenona2K
system.
The editor performs only the most
elemen·tary functions required to get a
program in and running. It accepts
characters without checking syntax
rules, theonly limitation being that eachllne is a maximum of 127 characters
long. I compromised at 127, instead of
50, because the sign of the indexregister changes at 128,and so I avoid-
ed a compare.
The program looks for the ASCII
back-space character, hex 08, becausemyCRTactually backspaces. If your ter-minal doesn't, you might want to
change this to a printable charactersuch as the underscore used by many
timesharing systems.. A check is also
made for the backspace in the code forthe ACCEPT statement, so be sure to
change it there as well.
16:41
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 44/68
The editor doesn't have a provisronfer inserting a line between existing
lines, but it is possible to change a line,
provided you replace it with one of the
same length or shorter. Thepercent keyfills from thecurrent position to the nextend of line with delete characters, hex
FF.Sincemost terminals ignore these, it
works effectively as a delete to the endof the line. Theprogram has tocheck for
these during MATCH and COMPUTE
statement processing, since they repre-
sent the logical end of line.
The carriage return, entered as the
end of line, is converted toazerobythe
editor. This simplifies looking for the
end of each line, later on, since the zero
flag is set as the byte gets loaded. The
SYMmonitor routine CRLFoutputs both
the carriage return and the line feed, so
one doesn't save anything by keeping
the return in the line to output it.
The locations CURADand CURAD+ 1address the start of each PILOT line. In-
itially, this is set to $500by the routine
SETBGN.TheY register is incremented
o access the next character in the line.
At the end of each line, subroutine SCU-
RADbumps Yonemore time to get past
the end of line character, and then addsthe resulting Y value to the current ad-
dress and resets Y to zero.
This sets things up for the start of the
next line. Performing the line scan inthis
way saves two bytes each time I need to
get to the next character because anINY is used instead of a JSR, and it also
makes it easy to check for a line too
• PAGE ZER( D ATA REFERENCES
$0000
$0002
$0003
$002B
$0053$0087
$0088
$0089
$008B
$0080
$008E$008F
$0090
$0095
$0097
$O D
AD DRESS OF LA ST A CCEPT COM MAND
CU RRE NT YE S/ NO F~ AG
ALLOW 40 BYT ES OF I NPUT
VA RIA BLE AREAS - 2 BYT ES EACHVA RIA BLE AREAS - 2 BYT ES EACH
SPECI AL INDI CAT OR FLAG AREA
HOLD AREA FOR Y VALUE
T EMP WO RK VAR IAB LE
R ESU LT H OLD AR EA FO R CO ~~U TAT ION S
HOLD AREA FOR ANSWER IND EX POINT ER
S ~GN IFI CA NC E I ND IC AT OR
LAS T OPERA TION IN COMPUTE S TAT EMENT
DI SPLAY VARI ABLE BUILD AREA
JU MP RET URN A DDR ESS
ADD RES S OF ST ART OF CURRENT LINE
LS T
FL G
CHRS
NAME
VARIBS •
IFLAG •HOLDY
WORK
RES ULT •ANSX
SI GN IF •
OPRATN •
tWM DSP •
RET URN •CURAD
CA RRI AGE RET URN C ODER
• E XT ER NA L ! .D DR ES S R EFE RE NC ES
CRLF $8340 OUT PUT A CR AND LF
INCHR' $8A1B INPUT ONE CHARACT ER
OUTCH R • $8A 47 OUTPUT ONE CHARACT ER
ORG $0200
• STA RT OF THE EDIT OR PORTION
0200 A9 8.0
)202 85 87J20l l 20 83 04
S TART LOA ] H $80 S ET MOD E TO ED IT FOR "PRT " ROUTINE
STA IFLAGJSR SE TBGN SET UP STA RTI NG DAT A A REA A DDRESS
• HERE IS lfi E S TART OF EA CH NEW LINE
o:zn A 9 3E ELINE LD AHI $3E OUT PUT A ")" PROMPT CHARACT ER
0209 20 47 8A JS R OUTChR
• HERE IS ,HERE EACH INPUT CH ARA CTER IS OB TAI NED
020C 20 lB 8A EGET JSR INCHR
020F AA TAX CHECK FOR NULLS AND I GNORE
0210 FO FA BEQ EGET S O TH EY DON'T GET CONFUSED WITH EOL
EPROM PROGRAMMER
Model EP-2A-79
0212 C9 5E
0214 FO EACMP]" $5E IS IT AN UPARROW?BEQ ST ART YES - STA RT AT B EGI NNI NG AGAI N
0216 C9 40
0218 FO 33CMP1 ~ I $40 IS IT "A T" SYM BOL FOR EXECr .rr E REQUEST ?BEQ EXEC YES' - GO ST ART ON TH AT
021A C9 08021C DO 06
CMP1 ~ $08 I S IT A BA CKSPACE?
BNE T RYD SP NO - GO CH ECK FOR DI SPLAY REQUES T
021E 88
021F 10 EB
0221 c s0222 10 E8
DE Y
B PL EGET
INYBPL EGET
YES - BACK UP ONE CH ARACT ER
BUT CH ECK FOR PAST ST ART OF LINE
HE BA CKED UP TOO FAR - DIS ALLOW
UNCOND ITIONA L
T RYD SP CMPH I $2F IS IT "/" FOR DISPLAY LINE REQUEST ?BNE TRYREP NO - CH ECK FOR REPLACEMENT REQUEST
0224 C9 2F
0226 D O 05
• D IS PL AY "0 THE NEXT CA RRI AGE RET URN
0228 20 21 04
022B B O DA
JSR PRT PRINT T HE LI NE
BCS ELI NE UNCOND ITI ONA L
T RYREP CMP' H $25 IS I T "$" REQUES T TO PA D A LINE?
BNE CHA R ~O - MUST BE D ATA CHARACT ER0220 C9 25022F DO OE
SOFTWARE AVAILABLE FOR F-8, 8080, 6800,8085, l -80, 6502, KIM-1, 1802, 2650.EPROM type isselected by a person. lilY modulewhich plugs Into The front of the programmer.
Power requirements are 115 VAe, 50/60 HZat15watts. It i s suppli ed with a 36 inch r ibbon cablefor,connecring to microcomputer. Requires 11/2
I/O ports. Priced at $155 with one set ofsoftware. Personality modues are shown beow.
• PAD T HE I INE FROM CURRENT LOC T O EOL WIT H D ELETE CH AR
0231 B 1 97 PAD LOP LD A:Y CUR AD GE T C UR RE NT CHA RA CTER
0233 FO 18 BEQ S E TNL IF ZERO, WE A RE DONE
0235 A 9 FF LOA: H $FF ELSE MAKE I T A D ELETE CHA R
0237 91 97 S T A: ~ ~ CURAD
0239 C8 INY BUMP TO NEXT CH ARA CTER
023A 10 F5 BPL PADLOP LOOP I F HA VEN'T DONE 128
023C 88 DE Y LINE I S TOO LONG - B ACK UP ONE
0230 A 9 OD LDA :H CR FORCE I N A N EOL H ERE
• IT WASN'- AN EDI T CHARACT ER - MUST BE D ATA TO S AVE
Par t No_ Pr .. . .. . . .. Price
PM-O TMS 2708 $15.00PM-1 2704,2708 15.00PM-2 2732 30.00PM-3 TMS 2716 15.00PM-4 TMS 2532 30.00PM-5 TMS 2516,2716,2758 15.00
Optimal TechnolO8)', Inc.BlueWood 127,Earlysville,VA22936
Phone (804) 973-5482
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 45/68
023F C9 OD CH AR CHPIH CR IS IT CARRIAGE RETURN AS EOL?
0241 DO 02 6NE CHAR1 SKIP AHEAD IF N OT
0243 A9 00 LDAIH $00 ELSE CONVERT CR TO ZERO AS EOL
02 45 91 97 CHAR 1 3TAlY CURAD PUT IT AWAY~, 0247 ,0 04 BEQ SET NL BRANCH IF YES
0249 c8 I NY ELSE BUMP TO SET UP ,OR NEXT ONE
024A 10 CO BPL EGET AND GO GET IT IF STI LL ROOM ON LINE
024C 88 DE Y ELSE POINT BACK TO LAST CHAR & FALL THRU
0240 20 57 04 SETNL JSR LINEND DO CRILF AND FIX U P CURAD
0250 B O 85 BCS ELINE GO START A NEW LI NE
• E XE CU TI ON PORTION BEGINS HERE
0252 20 40 83 EXEC JSR CRLF EXTRA BLANK LINE AFTER EDITOR
0255 20 83 04 RESTRT JSR SET BGN HERE IF FROM J:I
0253 A2 J3 LDXIM $33 ZERO VA RI AB LE ZR EA S
025A A9 0 0 LDAIH $00
025C 85 96 ST A RETURN .01
0252 95 53 RESTR1 STAX VARI BS
0260 CA DEX
0261 10 FB B PL RESTR1
0263 B1 9 7 LSTART LOA IY CURAD GET CHARACT ER ,ROM THE LINE
0265 C9 2A CHPIH $2A CHECK FOR "." LABEL MARKER
0267 no 04 B NE CHKCON IF NOT - GO CHECK FOR CONDITIONAL
0269 C8 I NY OTHERWISE SKIP PAST THE •• "
026A C8 SKPNXT INY SKIP PAST TH E NEXT CHARACTER
026B 00 F6 BN E L ST AR T U NC ON DI TI ON AL
I FLAG DEPENDENT PROCESSING H ERE
0260 C9 59 CHKCON CMPIM $59 CH ECK FOR .yn REQUEST026F FO 04 BE Q TFLAG BRANCH IF YES
0271 C9 4& CMPIM $4E IF NOT - CHECK FOR "N " REQUEST
0213 DO 09 BN E STRTST BRANCH IF NEIT HER
I SEE IF CONDIT IONAL MATCHES FLAG
0215 C5 02 TFLAG CM P t'LG SEE IF TH EY MATCH
0211 FO F1 BE Q SKPNXT SKIP TO NEXT CHAR & EXECUT E LI NE
I NO MATCH - SKIP THI S STATEMENT
0219 20 5A 04 FWD JS R rIID1 US E T HI S S UB ROU TI NE
021C BO E5 BCS LSTART UNCONDITI ONAL
021& 85 81 STRTST ST A IFUG THIS WILL CLEAR HIGH B IT FOR EDIT OR
0280 C8 INY POINT TO THE ":" CHAR0281 C8 INY AND TO TH E FOLLOWING CHARACTER
• ENTER NAME STATEMENT
0282 C9 3F
0284 00 05
0286 38
0281 66 81
0289 00 OC
XQUEST CHPIM $3F
BNE XA
SE C
ROR IFLAG
BNE TAKEI N
• ACCEPT STATEM ENT
028B C9 41
0280 00 34
028F A5 91
0291 85 00
0293 A5 98
0295 85 01
XA CMPIH $41
BNE XC
LOA CURAD
STA LST
LOA CURAD
STA LST
IS IT "," FOR ENTER NAME,
B RANCH IF NOT
T URN HIGH ORDER BIT ON T O INDICATE
PROCESSI NG NA ME COMMAND
NOW USE T HE ACCEPT LOGI C
SEE IF HAVE ACCEPT STAT EMENT
BRANCH IF NOT
SAVE ADDRESS OF TH E "A" STATEMENT
NO TE: WI LL I NCLU DE COND IT IONA LS
.0 1
.0 1
0291 A9 3F T AKEIN LDAIH $3F DI SPLAY"," PROMPTING CHARACTER
0299 20 41 8A JSR OUTCHR
029C A2 21
029E 20 1B 8A ACHR
02A 1 C9 08
02A3 00 03
02A5 E8
02A6 00 F6
02A8 C9 00 ACHR1
02AA 00 02
02AC A9 00
02A& 95 03 ACHR2
0290 24 81
LDXIH $21
Jsl! INCH R
CMPIM $08
BNE ACHR1
IN X
BNE ACH R
CMPIM CR
BNE ACHR2
LDAIM $00
STAX CHRS
BIT IFLAG
September, 1979
CHRS GETS STORED BACKWARDS
GET AN INPUT CHARACTER
IS I T A BACKSPACE?
BRANCH IF NOT
ELSE FORGET ABOUT LAST CHARACTER IN
UNCONDITIONAL
WAS IT A CARRIAGE RETURN?
NO - SKIP AHEAD
YES - CONVERT CR T O END OF LINE
AND SAVE IT FOR MATCH STATEMENT
SEE IF GET TING NAME FIELD
MICRO - The 8502 Jo~rnal
long. If Y is minus after it has been in-
cremented, more than 128 charactershavegone bysince the start of the line.
Theeditor inserts anend of lineat this
point and continues on. If this occurs
during line print or scan for endof line, it
probably means that the PILOTprogram
has gone off the end, so these routines
branch toSETBGNtostart at thebeginn-ing again. This does not prevent the
PILOTprogram from looping while look-
ing for an undefined label, but it doesprevent printing somegarbage.
The first character on a line is not
necessarily useful for executing aPILOT
statement. Theremight bea line feed or
some other control character present
there. Theasterisk and the label arenot
used except as a destination for a USEor JUMPstatement. If wedo find oneof
these, wenot only need toskip it, but we
must also skip thenext character, sincethat is the label. The routine SKPJNK
takes care of skipping over everything
but the asterisk, since thesameroutine
is used by both normal command start
and by the label search routine.
Once the program has searched out
the first probable command characteron the line, the next thing it has todo is
look for a conditional flag. This willdetermine whether it must examine the
rest of the line. A "Y" or an "N" is acon-ditional, and if the character of one of
these lines, it is checked against thecur-
rent value in FLG. If they domatch, theprogram simply increments Y to point to
the following character, and also starts
again, but this time Y is pointing to theoperation code following the condi-tional.
Most of the other operations execute
inasimilar manner. They look at thecur-rent character inA,dotheir processing ifit is their turn, or branch to the next
routine if it isn't theirs. Therearesomeexceptions to this (naturally). TheTEXT
command is last because, if the
character isn't a valid statement, the
whole line must beprinted anyway. One
of theother exceptions is theprocessingfor ENTERNAME(?:) and ACCEPTstate-
ments, which share much of the samecode. Another is the code for JUMPand
USER statements, which also sharecommon code.
Logically, theonly difference between
the "?:" statement and the "A:" state-
ment is that the "?:" inputs characters
into both CHRS and into NAME, whilethe "A:" saves the starting address ofthe line for usein "J:A" (jump to last ac-
cept) processing. Infact, the processingof the ENTERNAME statement merely
involves setting the high order bit ofIFLAG on and skipping the saveof the
line address that theACCEPTstatementperforms. Thehigh order bit of IFLAG is
normally turned off bystoring the ASCII
command character in it. The code for
the ACCEPTstatement checks the high
16:43
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 46/68
order bit of IFLAG and stores the inputcharacter in NAME if the bit is on.
One thing to note is that data saved inNAME and CHRS are stored backwards,with the first input character inCHRS+ 39,the second in CHRS+ 38,etc.Since I have to initialize the X registeranyway, I could init ialize it with zero andcount up, or with 39 and count down. If Iam counting up, though, I need to do a
compare to see if I have reached themaximum value. If I am counting down,the minus flag will automatically setwhen I reach the end.
The COMPUTE statement usesdecimal arithmetic. Each variable is twobytes long, with the high order first. Thehigh order decimal digit (bits 0-3 of thefirst byte) are used to indicate the sign.A value of 8 or 9 indicates a negativenumber, while anything else is con-sidered positive. It works out to be tens'complement arithmetic. To illustrate,assume I want to calculate 1 minus 2,which everybody knows is -1. The ac-tual result from the decimal subtract is$9999, much as it would be $FFFF inbinary.
Inorder to displaythls as - 1,we haveto subtract $9999 from zero to get $0001.Using decimal arithmetic does havesome disadvantages, particularly thefact that the range of numbers is - 2000to + 7999 ($8000 to $7999)for two bytesinstead of - 32768 to + 32767 for binary.Another disadvantage is that INC is nota decimal instruction.
The primary advantage of usingdecimal mode is the ease of translat ingfrom ASCII to internal and back. TheASCII characters zero through nine are$30through $39 in hex. Mult iplying by 10
in order to accept the next digit into anumber is also very easy, since it only re-quires a four bit shift left. Converting todisplay merely means shifting each digitto the low order four bits. ANDing off thehigh order part, and ORing in $30.
The MATCH statement is the mostcompucateo stateraent apart from COM·PUTE. In theory, all thai has to be doneis compare the characters in CHRSagainst those in the MATCH statementline, and then set FLG to Y if they match,and to N if they don't. This works fine ifthey match. The problems come whenthey are different. Before the flag getsset to N, we have to determine why they
did not match.For one thing, it might be the end of
the MATCH statement line. Since all thecharacters up to that point have match·ed, the program treats this condition asa complete match. PILOT uses the com-ma as a seperator in the match state-ment to indicate alternate possible mat-ches, so if the mismatch character is acomma, it is treated as the end of line,and FLG is set to Y .
16:44
02B2 10 02 BPL A :llR3 BRANCH IF ~OT
0294 95 2B STAX N lilE ELSE SAVE IN N AME FIELD ALSO02B6 C9 00 ACHR3 CMPIM $ )1) IS IT DONE YET ?
02B8 FO 03 BEQ A )O NE BRANCH IF HE HAS SIGNALLED END
02BA CA DEX ELSE BUMP FOR NEXT INPUT
029B 10 E1 BPL A :IIR AND GO GET IT IF ROOM STILL LEFT
02BO 20 4D 83 ADONE JS R C II.F DO C R I L F TO LET GUY KNOW
02CO l IC 7 9 02 JM P F I:)
•• COMPUTE STAT ~IENT
02C3 C9 43 XC CMPIM $ II IS IT A "C" FOR COMPUTE?
02C5 FO 03 BEQ X: I BRANCH IF IT IS
02C7 4C 5 6 0 3 JMP x I ELSE LONG JUMP TO TEST ,OR ~
02CA 20 94 Oll XCl JSR G:"IDX GET INDEX POINTER TO RESULT
02CD S6 80 ST X A l:iX SAVE IT FOR NOW
02CF A9 00 LDAIM $ Iii C LEA R R ES UL T
0201 85 8B STA R : :i UL T
02D3 85 8c ST A R ::iULT .0 1
02D5 cs INY POINT TO ":"
0206 A2 2B LDXIM $ !II SET 1ST OPERAT ION TO "." FOR ADD0208 DO 4A BNE O'IIRAP GO SAVE & SET UP .ORK AREA
I LOOP FOR EAC I NEW CH ARACTER I N COMPUT E PROCESSI ~G
02DA C8
0208 B1 97
020D 30 20
020F C9 2F02E1 90 1C
02E3 C9 3A
02E5 BO 12
CMPLOP INY BUMP TO NEXT CHARACTER
LOAI Y C I !'.AO GET A CH ARACT ER
BMI I :(lPR MINUS IS DELETEIALSO LAST "OPERATOR"
CMPIM $ ~I' IS IT " I " FOR AN OPERAT ION SPECI FIED?BCC I i(IPR BRANCH IF YES
CMPIM $ iJ, IF NOT - IS IT ":" FOR A NUMBER?
BCS N I~'NMB BRANCH IF NOT - MUST BE A VARIABLE:
02E7 29 OF ANDlM $ 'I' CONVERT NUMBER TO BINARY
02E9 6A RORA SPIN TO H IGH ORDER PART O F A
02EA 6A RORA
02EB 6A RORA
02EC 6A RORA LEAVE BIT 3 I N CARRY
02EO A2 04 LDXIM $ I 4 BITS TO ROLL INTO .ORK
02EF 26 8A BUROL RO L W'lfK .01 RIPPLE CARRY INTO WORK
02F1 26 89 ROL II IfK FOR 16 BITS
02F3 OA ASLA PUT NEXT BIT INTO CARRY02F4 CA DEX COUNT ONE JUST D ONE
02F5 DO F8 BNE B l ROL CONTINUE IF M ORE TO GO
02F7 ,0 E1 BEQ C: !LOP ELSE GET NEXT CHARACTER (DIGITS)
02F9 20 9C 04 NOTNMB JSR Vi ANS TRANSFER VARIABLE :0 ·'ORK AREA
02FC 4C DA 02 JMP C:ILOP GO GET NEXT CHARACTER (OPERATION?)
I GO T A N O PE RA 10N - FIRST PERFORM PREVIOUS REQUEST
02FF F8
0300 AA
0301 A5 8F
0303 C9 200305 FO 10
0307 18
0308 A5 SA
030A 65 8C
030C 85 8c
030E A5 890310 65 8B
0312 85 8B
0314 4C 24 03
0317 38
0318 A5 8c
0 31 .4 E 5 8A
031C 85 8C
031E A5 8B
0320 E5 89
0322 85 8B
0324 08
0325 86 8F
0327 8A
0328 FO OA
032A 30 08
032C A9 00
032E 85 89
0330 85 8A0332 FO A6
ISOPR SED SET TO DECIMAL MODE
TAX SAVE NEW OPERATION IN X FOR NOW
LOA 0 fATN GET ?REVIOUS OPERATION
CMPIM $: I '"AS IT A "-" FOR SUBTRACT?BEQ 0 ~NUS BRANCH IF YES
CL C
LD A
AD C
ST A
LO A
AD C
ST A
JM P
OPMNUS SE C
LD A
SB C
ST A
LO A
SB C
ST A
OPIIRAP CL DST X
TXABEQ
BMI
ALL OTHERS ASSUME IT IS ADD
>I ( RK .01
RISULT .01
RISULT .01
W I R K
RIS ULTRISULT
OI~RAP GO WRAP UP T HE O PE RA TI ON
SUBTRACTION
RI SULT .01
WI RK .01
HI SULT .01
R I SULT
> II RK
RISUl.T
GET OUT OF DECIMAL ~ODE
OI RAT N SAVE NEW OPERAT IONDO TRANSFER TO CHECK i'OR "00"1"f'F"
CI PDON DONE IF IT WAS ZERO (EOL)
CIPDON OR DELETE CHARACTERS (FROM FILLING)
LDAIH $tO ELSE CLEAR WORK AREA FOR NEXT ONE
STA weRK
STA weRK .01BEQ CIPLOP AND GO DO NEXT CHARACTER
MICRO - The 6502 Journal September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 47/68
0334 A6 80
0336 10 13
0338 A2 38
CMPOON LOX ANSX GET INDEX TO RES ULT
B PL TOVRI B PLUS I S NORMAL IND EX TO A VA RIA BLE
033A 20 gr 04
0330 20 AB 04
0340 A 2 OLl
0342 B 5 gO TA LOOP
0344 95 26
0346 CA
0347 10 rs
0349 30 08
034B A 5 8c TOVRIB
0340 95 54
034F A5 8B
0351 95 530353 4C 7g 02 XFWO
0356 C9 40
0358 D O 4F
035A 88
035B C8
035C A 2 27035E 81 g7
0360 FO 08
0362 05 030364 DO 08
0366 C8
0367 CA0368 10 F4
036A A2 59036C DO 37
036E C9 24
0370 so 130372 C9 2C
0374 rO r4
0376 C8
0377 B1 97
0379 rO 28
037S C9 2C
0370 FO DC
037r DO r 5
0381 A4 88
0383 DO r t
0385 C8
0386 86 8D0388 20 A 8 04
038B A6 80
0380 84 88
038F AO 04
LDXIM $38
JSR VTUNSJSR CNVOSP
LDXIM $04
LDAX HUMOSP
S TAX CHRS
DE X
B PL TALOOP
BMI XFWD
LOA RES ULT
STAX VARIB S
LOA RES ULT
STAX VARIB S
JM P NO
ELSE FUDGE IND EX FOR "FROM" RESULT
USI NG "RESULT - VARIBS"
+03 MOVE RESULT TO WORK A REA
+03 CONVERT IT TO DI SPLAY FORM
TRA NSFER DI SPLAY TO A NSWER A REA
+23 NOT E OH SE T TO PUT IT AT T HE EN II
UNCOND ITIONA L
+01 DES IRE D V AR IAB LE+0 1
• PROCES S M ATCH ST ATEMEN T
A ND GO D O HEXT ONE
X M CMPIM $4 0
SNE XU
DE Y
MCHKX I HY
LDXIM $27MCHK LDA IY CURAD
BEQ MXY
CMPX CHRS
BH E MXH MCH
INY
DE XBPL MCH K
MXY LDXI M $5g
BH E MX
MXH MCH CMPI M $24
BEQ MNUMB
CMPI M $2C
SEQ MXY
I S !T "M" FOR M ATCH?
BRA NCH I F NOT
SACK UP ONE rOR WH AT FOLLOWS
POI NT T O MA TCH CHA RACTER
STA RT AT FI RST A CCEPT ED CH ARA CTERGET TH E MAT CH CH ARACT ER
TH EY HA VE MAT CHED T O END OF "M :" S TM !
CH ECK FOR MA TCH
S RANCH IF MA TCH FA ILED
ELSE BUMP TO NEXT PAI R OF CHARACTERS
AND GO CH ECK I F S TILL DAT A LEFT
BO TH EQUAL - S ET r LAG TO "Y"UNCONDIT10NAL
IS IT "$" FOR VARIAB LE REQUEST ?
YES - MA TCH TO NUMERIC VA RIA BLE
IS IT A COMMA GROUP SEPA RAT OR?
YES - MAT CHED SO FAR - S ET IT AS YES
M COMMA I NY NO - S O NEED T O S KIP A HEA D T O COMM A
L DAI Y C UR ADBEQ MXS ETN IF TO EOL, TH ERE IS NO MORE T O CH ECK
CMPIM $2C CH ECK FOR A COMM A CHA RACTER
BEQ MCH KX RESTA RT CO HPA RE AT NEXT MAT CH CH ARACT ER
BNE M COHMA LOOP IN S EARCH OF A COMM A
M COMX LOY H OLDY RESE T Y T O CURRENT LI NE POIN TER
SNE MCOMM A AND GO LOOK rOR NEXT COMM A
M NUM B I NY VARIAB LE - BUH P TO VARI AB LE 10
STX ANSX SA VE CURRENT X FOR NOWjSR CNVOSP CONVERT VARIAB LE T O DI SPLAY FORM
LOX A NSX GET POINT ER T O I NPUT BA CK
STY H OLDY SA VE CURRENT "Y· POI NT ER
LOYIM $04 HA VE TO SEARCH UP T O 5 B YT ES
03g1 B9 90 00 MXNOLP
0394 FO 08
0396 05 03
0398 D O E703gA CA
039B 88
039C 10 F3
039E Al l B 8
03AO c 8
03A 1 D O BB
03A3 A 2 4E
03A5 86 02
03A 7 DO AA
j
03A 9 Cg 55 XU
03A B DO 11
03A D B1 g7
03AF 48
03BO 20 5A 04
03B 3 A5 97
03B 5 85 95
03B 7 A5 se03B 9 85 g6
03BB 68
September, 1979
MXDI FF LOY
I NY
B NE
LDAY
BEQ
CMPX
S NE
DE XDE Y
SPL
NUM OSP GET ONE NUM ERIC CHA RA CTER
MXDI Ff BRANCH I F END - MI GHT B E M ATCH
CHRS ELS E CH ECK AGA INS T INPUT
MCOHl BRA NCH IF NO MA TCH
ELS E CO NT INUE M AT CH ING
M XN OL P U NC O ND I T IO N AL
HOLOY RESE T Y TO CURRENT LI NE POIN TERB UMP TO CHA RACTER AFTER VARIAB LE
MCHK UNCOND ITI ONAL CONT INUE CHECKI NG
MXSET N LDXIM $4E
MX S TX FLG
BNE XFWD
GET "N" - MA TCH WAS UNSUCCESSFUL
STORE IT
UNCOND ITI ONAL FOWRARD TO NEXT LI NE
• PROCESS US E SUBROUT INE STA TEM EN T
CMPI M $55
B NE XJ
L DA IY C UR AD
PH A
JS R
LOA
S TA
LOAST APL A
IS IT A " u n f OR U SE S UB RO UT IN E?
BRANCH IF NOT
G ET D E ST I N AT 10 N
S AVE THE LAB EL CH ARACT ER
H OVE TO S TART OF NEXT LINEW0 1
CURA D
RETURN S AVE FOR RETURN A DDRESS
CURAD +01RET URN +01
GET D EST INATI ON BA CK
MICRO - The 6502 Journlll
There is also the possibility it mightbe caused by a request to match againstthe current value of a variable. To per-form variable matching, the programcalls CNVDSP which converts the vari-able to display format with leading zerossuppressed. It then matches the displayformat against the characters in CHRS.If the variable value matches, the pro-gram continues checking the rest of the
MATCH statement.
If, even after all this, we still have a no-match condition, all is not lost yet. Wehave to scan forward in the MATCHstatement, to look for a comma or theend of line. If we find the end of line,then FLG gets set to N. If we find a com-ma, the program starts the whole matchprocess over again, from the characterafter the comma in the MATCH state-ment and from the beginning of CHRS.All this sounds confusing but, for exam-ple, the statement "M:YE,OK,SUR" willprovide a Y indication for most affirma-tive responses such as YES or YES SIRor YEP or SURE WILL or OK.
As I mentioned earlier, the USE sub-routine statement shares much of itscode with the JUMP statement. Themain difference is that the USE state-ment must save the address of the startof the next statement, whi le the JUMPstatement doesn't need to. Note that theUSE statement does not nest levels(sorry about that).
There are two reserved labels inPILOT. The first is the asterisk, which isused to completely restart the PILOTprogram (including zeroing the vari-ables). The second reserved label is "A".This label indicates a JUMP (or USE)tothe last ACCEPT statement. If the labelin the statement is not one of the reserv-ed labels, the program sets CURAD backto the start of the PILOT program via acall to SETBGN + 3 and starts the searchfor that label.
The STOP statement is trivial. It mere-ly requires a jump back to the start of theeditor.
Processing of the EXIT from sub-routine statement is slightly more com-plex. It involves a check of the high orderbyte of the address contained in RE-TURN. If it is zero, then there was noUSE statement executed to get there,and the program merely advances to the
next line. The high order byte can neverbe zero, since all the lines are storedabove $500. After restoring the return ad-dress to CURAD, the program resets thehigh order byte to zero. This means thatthe PILOT program can either "fallthrough" a subroutine, or use it in a nor-mal fashion.
The REMARKS processing rivals thatof the STOP statement for complexity. Itmerely involves advanclnq to the next
16:45
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 48/68
statement. Onefinal PILOTstatement is
the TYPE statement. It is also the de-fault statement if noneof theabovesec-
tions processed it. If the statement is
not a true TYPEstatement, Y is backed
up twice, so the whole line will be
printed. Otherwise, the line is printed
following the "T:".
The remainder of the program con-
sists of subroutines used by various
PILOT statements. The routine PRT
prints the current line to the end. It uses
the high order bit of IFLAG to see if the
program is ineditor mode. If it is, thenall
characters are printed, instead of beingchecked for a "$" to indicate avariable.
After the line has been printed, a car-riage return and line feed are output. It
then falls through to FWD1.
The purpose' of this routine is to ad-
vance to the end of the current line, and
set up CURADfor the next line. Since it
checks for end of line first, before incre-menting Y,the fall through from PRTwill
immediately exit this routine, thus sav-
ing a branch in PRT.
FWD1,in turn, exits toa routine calledSCURAD.This adds one to Y, and adds
the result to CURADas the start of the
next line. Finally, this routine falls
through to SKPJNK, which skips overanyunwanted junk at thestart of the line
and executes the return.
With theexception of CNVDSP,the re-
maining routines are short and prettymuch to the point. TheVTRANSroutine
must transfer the high order byteof thevariable last, so it sets the sign flag for
CNVDSP.The format of the NUMDSPar-
ray is set up in the same "backward"
manner used for CHRSand NAME, and
it is the output of CNVDSP. If the vari-
able is negative, a " - " is inserted as thefirst character.
Thehigh order bit of SIGNIF Isused tokeep track of whether a non-zerodigit
has beenencountered in the number be-
ing converted. If the bit is off and the
current digit is zero, the index is not
decremented, but the zero is stored
anyway. If the bit is on, the digit getsstored regardless of its value. Any non-
zerodigit turns onthehigh order bit, justto make sure. An end of line zero is in-
serted after the last digit.
Therearethree SYMmonitor routinesused inthis program. If you plan tobring
Tiny PILOT up on another system you
will have to change the addresses forthese routines. They are all fairly stan-
dard, so most systems should have
equivalents. INCHR gets one ASCIIcharacter from the terminal into the A
register, without parity; OUTCHR out-
puts one ASCII character from A; and
CRLF outputs a carriage return then a
line feed. Tiny PILOT assumes that allregisters are preserved b'y theseroutines. jJ
16:46
03BC DO 06 NO GO HANDLE AS JUMP STA TEMENT
• PROCESS JUMP ST AT EMENT
03BE C9 4A XJ CMPIM $I.A IS IT "J" [ 'O R J UM P S T AT E .' lE NT ?
03CO DO 2E BNE X" BRANCH 1[' NO T,03C2 81 97 LDAIr CIIRAD GET D ESTINA TION
03C4 85 87 JDO ST A I I'LA G SAVE LAB EL CH ARAC TER
03C6 C9 2A CMPIM $;!A HAVE "". TO REQUEST RET URN TO BEGINNING?
03C8 ['0 2 3 BEQ IllES T BRANCH IF SO
03CA C9 41 CMPIM $111 SEE IF A ~ABELLED JUMP
03CC DO OA BNE JF IF NOT "A", IT'S A NORMAL JUMP
03CE AS 00 LD A L:;T ELSE SET TO ST ART 0[' L AS T A CC EPT
03DO 85 97 ST A CURAD
03D2 A5 01 LD A L:iT +01
03D4 85 98 ST A CllRA D +01
03D6 DO 43 BNE II. NEXT UNCONDITIONA L
03D8 20 86 04 JF JS R S ICTBGN +03 AND GET BA CK TO STA RT OF PROGRAM
03DB Bl 97
03D D C9 2A
03DF DO 07
03E1 C8
03E2 B1 97
03E4 C5 87
03£6 FO 3303E8 20 SA 04
03EB BO EE
03ED 4c 55 02
03FO C9 53
03F2 DO 0303F4 4C 00 02
03F7 C9 4503F9 DO 10
03FB AS 96
03FD FO 1003FF 85 98
0401 A5 95
0403 85 97
0405 A9 00
0407 a s 96
0409 FO 10
FNDMRK LDAI r C:1RA D GET ['lRST CH ARACT ER
CMPIM $.1A IS IT """ FOR A MA RKER?
BNE Fl1NEXT NOPE - GO AHEAD TO NEXT LINE
INY ELS E BUMP TO M ARKER CHARACTER
LDAIY C1RAD GET LABEL
CMP FLAG SEE IF I TS THE ONE WE WANT
BEQ 1.NEXT rES - GO EXECUn: IT
FMNEXT JS R F,Dl ELSE GO TO NEXT L:NE
BCS FmMRK AND CONTINUE LOOKING
IREST JI '.P R;STRT IND IRECT TO RESTRTI
I S TO P S TA TE ME n
XS CMPIM $;3 IS IT AN "S" FOR S TOP STATEMENT?BNE X; BRANCH IF NOT
JMP srART ELSE RETURN TO EDITOR START
• EXI T FROM SUB ROUT IN E
XE CMPIM $45 IS IT AN "E"BNE XR BRANCH I F NOT
LDA RETURN +01 MOVE RETURN ADDRESS TO CURAD
BEQ XXFWD SKIP LINE IF NOT SET
ST A CURAD +01
LDA RETURN
STA CURAD
LDAIM $00 NOW SET TO NOT-USED AGAINST A RETURN +01
BEQ ILNEXT UNCOND:TIONAL
• R EM AR K S TA TE ME NT
040B C9 52 XR
040D DO 03040F 4c 79 02 XXFWD
0412 C9 54
0414 FO 02
0416 88
0417 88
0418 20 21 04
041B 20 6E 04041E 4c 63 02
0421 Bl 97
0423 FO 32
0425 24 87
0427 30 26
0429 C9 24
0428 DO 22
042D C8
042E Bl 97
0430 C9 3F0432 FO OF
CMPI!1;52
BNE )T
JMP 'WD
IS IT AN !'R t1
BRANCH IF NOT - ELSE SKIP THE LINE
CAN'T REACH T HAT FAR A LONE
• T YPE STATEMENTS AND SYNTAX ERRORS
CMPI M 1,54
BEQ ,'E
DE Y
DE Y
TE JSR
I LNEXT JSR
JM P
XT IS I T A V ALID "T " S TATEMENT
BRANCH IF SO
ELSE BA CK UP TO ORIGINAL S TART
I'RT NOW PRINT THE LINE
!'KPJNK CUR A D IS SE T - SKIP OVER LE.tilINGJUNKLST ART AND GO START ON THE LINE
I PRINT A LINI: FROM CURRENT LOCATION TO
• NEXT EOL A NII T HEN SET UP FOR NEXT LINE
PRT LDAIY I:URAD GET THE CURRENT CHARACTER
BEQ !.INEND B RAJICH IF T O END OF LINE
BIT ':FLAG SEE IF I N EDI TO R
BMI I~ROUT IF SO, DON'T LOOK FOR '$'
CMPIM :.24 I S IT A SPECIAL ONE ("$")
BNE I~ROUT BRANCH IF NOT
INY ELSE BUMP T O NEXT ONE
LDAIY ,:URAD GET VA RIA8LE
CMPI M BF IS IT REQUEST FOR NAME ("$") 7
BEQ 11AMEO B RAJICH IF YES
MICRO - The 8502 Journel September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 49/68
O~34 20 A8 04
0"37 A2 04
0439 B5 90043B 1'0 15
0430 20 47 8A0 ! !4 0 C A
0441 10 1'6
0443 A2 27
0445 85 2B
04 47 1'0 0 9
0449 20 47 SA
Q44C CA
044D 10 1'6
04!!F 20 47 8A
0452 C8
0453 10 CC
0455 30 2C0457 20 4D 83
0!!5A Bl 97
045C 1'0 05
045E C8
0 45 1' 10 1' 9
)461 30 20
0463 C8
0464 980465 18
0466 65 970468 85 97
046A 90 02
046c 86 98
046E AO 1'1'
0470 C8
0471 24 87
0473 30 OC0475 B l 97
0477 30 rt0479 C9 2A
047B 1'0 0 4
0470 C9 31'
0471' 90 EF
0481 380482 50
0483 20 40 830486 AO 00
0488 84 97
Q48A 84 00
048c A9 05048E 85 98
0490 85 010492 DO DA
0494 B1 97
0496 38
0497 E9 410499 OA
049A AA
049B 60
.. ./
~ 49C 20
0 49 1' B 5
04A 1 85
04A3 B5,)4.1.5 85
04A7 60
September, 1979
VBDISP
JSR CNVOSP CONVERT VAa IABLE TO DIS?LAY
LDXLM $04 GOT BYTES POS SIBLE
LDAX NUMOSP GET A CHARACTER
BEQ CHROUT +03 BRANCH IF TO END OF VARIABLE
JSR OUTCHR ELSE OUTPUT IT
DEX AND COUNT IT
BPL VBDISP UNCONDITIONAL LOOP
NAMED LDXIM $27 REMEMBER - IT CAME IN BACKWARDS
LDU NAME
SEQ CHROUT +03 BRANCH IF TO END OF NAME
JSR OUTCHRDE X
BPL NAMEO +02 UNCONDITIONAL
CHROUT JSR
INY
BPL
BMI
LI NEND JSR
OUTCHR
PRT LOOP I F NOT TOO MANY
SETBGN RESET TO BEGINNING IF PAST THE END
CRLF OUTPUT A CR AND T HE LINE FEED
I ENTER HERE TO SKIP A LINE WITHOUT PRINT
I AND INITIALIZE FOR THE NEXT LINE
FWD1 LDAI Y CURAD GET A CHARACTER
BEQ SCURAD BRANCH IF END OF LINE
INY ELSE B UMP TO NEXT ONE
8PL FWD1 LOOP I F NOT TOO MANY
8M I SETBGN RESEr-TO BEGINNING IF PAST THE END
I HERE FIXES UP CURAD TO POINT TO BEGINNING OF A LINE
I CURAD SHOULD IND EX END OF LINE (WITH YJ ON ENTRY
SCURAD INY
TYA
CL C
AD CST A
BCCINC
CURAD
CURAD
SKPJNK
CURAD
BUMP PAST THE CR
MOVE COUNT TO A
CLEAR CARRY FOR AD D
ADD TO LOW ORDER FIRST
AND SA V E RESULT
SKIP IF NO CA RRY FORWARD
+01 ELSE BUMP HIGH ORDER
I HERE TO SKIP PAST LEADING JUNK ON A LINE
SKPJNK LDYI M $1'1'
S JLOOP INY
BIT
BMILDAIY
BMI
CMPIMBEQ
CMPIMBCC
S JRTS SEC
RT S
IFLAG
SJRTS
CURAD
SJLOOP
$2 ASJRTS
$31'SJLOOP
SET UP Y THIS WAY
I NCREMENT T O NEXT CH AR ACT ER
SEE IF IN EDI T MODE
DON'T TRY SKIPPING JUNK IF SO
GET CHARACTER TO LOOK AT
IGNORE DELETE CHARACTER ALSOLOOK FOR ••• LABEL MARKER
RETURN IF FOUND
LOOK FOR POSSI BL E O PERAT ION CH ARACT ERCONTINUE S KIPPING IF TOO LOW
SET CARRY FOR BRANCHES AFTER RETURN
B EFO RE R ET UR N
I SET UP BEGI NNING ADDRESS OF USER AREA
S ETBGN JSR CRLF START ON A NEW LINE
LDYIM $00 EVEN PAGE BOUNDARY
STY CURAD
STY LS T ALSO SET UP THIS GUY AS DEFAULT
LDAIM $05STA CURAD +01
STA LS T +01BNE SKPJNK UNCONDI TIONAL
I COMPUTE INDEX FOR A VA RIABLE
GET lOX LDAIY CURAD
SE C
SBCIM $41ASLA
TAX
RT S
GET VARIABLE LETTER
SUBTRACT ·A· TO MAKE RELATI VE TO ZEROT IM ES 1' \10B YT ES PE R V Al UA BL E
MOVE TO INDEX REGI STER
A ND R ET UR N
I TRANSFER A VARIA BLE'S DATA T O WORK AREA
94 04
54
8A
5339
nRANS JSR
LOU
ST A
LOU
S7 A
ilTS
GETIDX
VA RIBS
WORKVA RIBS
WORK
GET INDEX POI NTER FIRS T
+01 NOW MOVE T O WORK AREA
+0 1
MICRO - The 8502 Journal
by Commodore
The O rigina i6S02 Sys tem
20mA cunent tccp TTY Interface
Audio ("'nelle Interface
15 Use r 110 l in e,
2 tnterv a1Timers
1K+ RAM
21( K IM Mon it or ROM
He ll Ke yp a d ll ED Di sp l a y
KIM·1; S18QOO
The Ultimate Enclosure
for the KIM-1
P ro tect s You r K IM-l
Neat, Attractive, Profess ional
full Acceu to the hpamion and
Application Connectors
ENCLOSURE PLUS
for KIM: $3000
Room for the KIM·l and OneAd di ti on a 1B oa rd s uc h a 5
MEMORY PLUS o r V IDEO PLUS.
b y R oc kwe ll ln le rn al io n a 1
The Complet e 6502 Sys tem
20Co lumn Thermal P rint er
H igh Speed Aud io Cas se tt e
I(eyboard Versatile 81( ROM Monitor
AIM 6 5: $ ]7 50 0 1 1( RAM - 5 42 00 04K RAM
ENCLOSUREWITH BUILT IN
POWER SUPPLY
SPECIFICATIONS:
INPUT: 1101220 VAC 50/60 Hz
OUTPUT: + 5V @ 5A+24V@IA
GROUNDED THREE·WIRE L INE CORD
ON/OFF SWITCH WITH P ILOT L IGHT
Enclosure has room 'or the AIM .nd one
a ddi ti ona l boa rd: MEMORY PLUS o r VIDEO PLUS
AIM PLUS: $10000 AIM and AIM PLUS: $47500
617/256-3649
16:47
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 50/68
_ - - - - - ~ACRO ASSEMB LER and T EXT EDI TOR:for PET, APPLE I I , SYM, KI M, other.M ac ros , co ndi ti ona l a ss emb ly, 2 7
c om ma nd s, 2 2 p se ud o-o ps . C as se tt eand manual for $49.95 ($1.00 forinfo). C.W. Moser
3239 Linda DriveWi ns to n-S al em , N C 27106
ZI PTAPE loads 8K B ASI C in 15 sec-
onds! Slower than a speeding disk?Sure, but it only costs $22.50plus $1.00 S&H. $3.00 extra for
software on KIM cassette. Des-cribed in MI CRO U6. SASE for info.Order from: Lew Edwards
145 1 H am il ton A ve .T renton, NJ 08629
GRAFAX, the full screen graphics
editor for the OSI 2P, 540 videog ra phi cs RO M, p oll ed k eyb oar d.S in gle ke yst rok e c omm and s m ake
d ra win g a br eez e. $1 0 + $1.00 post·a ge fo r B AS IC /as sem bl er c as set tea n d d o cu m en t at i on :
Mark Bass269 Jamison DriveFra nkf ort , l L 6 042 3
Software for the APPLE:$ 25 b uys S CRO LLI NG WON DER
+ GI AN T L ET TE R+ H I -R E S A L PH A NU M ER I CS
on cassette, 16K. $25 buys:
MULTI-MESSAGE +
I N T ER L EA V ED K A LE I DO S CO P E +
MULTI-MESSAGE w/ AB ST RA CT A RT
on cassette, 32K. Send check or Met o: C on ne ct ic ut I nf or ma ti on S ys te ms
218 Huntington Rd.
B ri dg epo rt, C T 0 66 08
MAI LING LI ST PROGRAM for APPLE:
Maintain complete mailing list!
Requires 1 drive and Applesoft I I
Data base can be added, changed,
deleted, reformatted, searched (~
and sorted (5). Send $34.95 to:
SOFT WARE T ECH NOLOGY for COMPUT ER~
P.O. Box 428
Belmont, Ma. 02178
For only $33 for 12 issues you
get CURSOR, the original cassette
magazine for the Commodore PET .
Each issue has a graphic "Front
Cover" program, plus five excel-
lent programs that are ready to
Load and Run. The CURSOR NOTES
newsletter with each issue pro-
vides useful information about
the programs and help you with
using your PET .
CURSOR
Box 550
Goleta, Ca. 93017
S ou the ast er n S of twa re N EWS LET TER
for Apple II Owners. $ 1 0 . 0 0 for
10 issues per year. B ack issues
available at $1.00 each. Order
from:
S OU TH EA ST ER N S OFT WA RE
7270 CULPEPPER DRI VE
DEPT . MI
\.:NEW ORLEANS, LA. 70126
16:48
04A8 20 9C04AB 10 1704AD A9 2004AF 85 940 4B 1 F804B 2 3804B 3 A9 00
04B5 E5 8A04B7 85 8A04B9 A9 00
0488 E5 8904BO 85 890 4B F D804CO A2 0304C2 DO 02
04C4 A2 0404c5 1804C7 55 8E0 4C9 A 5 8q04CB 20 E5 0404CE A5 8A0 400 4A0 401 4A0 402 4A0 403 4 A0404 20 E5 040407 AS 8A0409 20 E5 04
040C 24 8E040E 30 010 4EO C A04E1 A9 0004E3 95 9004 E5 5 0
04E5 29 OF04E8 09 3004EA 95 9004EC 24 8E04EE 30 O~04FO C9 3004F2 DO 010 4F4 5 0
04F5 38
04F6 56 8E0 4F8 C AOJlF950
• C ON VER T A VA RI AE LE T O DI SPL AY FO RM
04 CNVDSP JSR VT RA~S MOVE T O WORK AREAB PL ISPLlS B RANCH IF POSAT I VELDAI M $20 ELSE PUT I N MI NUS SIGNST A NUMD~.P+04SED SET DECI MAL MODE I NDI CAT ORSECLDAI M $00 SUBT RACT FROM ZERO T O COMPLZMENT
S8C WORK +01ST A WORK +01L DA IM $ 00
SB C WORKST A WORKCLD CLEAR DECI MAL MODELDXI M $03 ONLY 4 POSI T IONS LEFTBNE ISPL SKI P INDEX SET
ISPLUSI S PL1
$04 H AS FI VE P OS IT IO NS H Al LA BL EO FF S I GN I FI C AN C E I N DI C AT O R
LDXlMCL CH ORLO AJS RLO ALSRALSR~LSRALSRAJS RLO AJS R
BI TBMIDE XLDAH!STAXHT S
PLUSTURN
SIGN:.FWORKTOOU1'WORK
GET FI RST D IGI TPUT T O OUT PUT AREA+01 SECOND DI GI T ISMOVE T O LOW ORDER
HI GH ORDER OF T HIS
ISPL2
TOOUTWORK +01 LOW ORDER IS T HI RD DIGI TTOOU1
S IGN ]F SE E I F H AD AN Y S IGN IFI CAN T C HAR SISPL; SKI P NEXT IF YES
ELSE KEEP T HE LAST ZERO TH ERE$00 INSERT END OF LI NE MARKERNUMD~P
A ND R ET U RN
• CONVERT CURRENT VALUE T O xsctr AND PUT T O OUT PUT AREA
TOOUT A ND IM $ OFO RA IM $ 30STAX NU~PBI T SIGN1FB MI SETS1GC MP IM $ 30BNE SETS]GRT S
KE EP O NLY LO W O RDE RMAKE IT ssctrS A VE R E GA R DL E SSS EE I F S IG NI FI CA NC E S TA RT EDYES - ALL ARE I MPORT ANT NOWELSE SEE I F SHOULD ST ART NOWI MPOR TAN T I F N OT Z ER OE LS E R ET UR N
3 ET SI G S EC
HOROE XP GM EN D H T S
S ET S IGN IFI CA NC E B IT O N
S I GN ] F A L WA YSA ND POI NT T O N EXT A VAI LAB LE POS I710NA ND T HEN R ET URN
S YM BO L T AB LE 2 00 0 2 21; AACHR 029E ACHRQ 02A8 ACH RR 02AE ACHRS 0286ADONE 0280 ANSX 0080 BI T ROL 02EF CH AR 023FCHARQ 0245 CHKCOI I 0260 CH ROUT 044F CHRS 0003CMPOON 0334 CMPLOI '02DA CNVDSP 04A8 eR 0000CRLF 8340 CURAD 0097 EGET 020C ELINE 0207EXEC 0252 FLG 0002 FHNEXT 03E8 FNDMRK 03DBF'li0 0279 F'liOQ 045A GETlDX 04911 HOLDY 0088IFLAG 0087 I L NE : C 0 4 18 INCHR 8A1B IREST 03EDISOPR 02FF I SPLQ 04c6 I SPLR 04E1 I SP LU S 0 4C 4JDO 03C4 JF 0308 LINENO 0457 LST ART 0263LST 0000 MCHK 035E MCHKX 0358 MCOMMA 0376MCOMX 0381 MNUMB 0385 M X 03A5 MXDIFF 039EMXNMCH 036E MXNOU' 0391 MXSETN 03A3 MXY 036A
NAME 0028 NAMEO 0443 NOTNMB 02F9 NUMOSP 0090OPMNUS 0317 OPRAn· 008F OPI/RAP0324 O UT CH R 8 A4 7PADLOP 0231 PGMENII 04F9 PH T 0421 R ES T RQ 0 25 ER ES TR T 0 25 5 RESULT 008B RETURN 0095 SCURAD 0463SET8GN 0483 SETNL 0240 SET SIG 04F5 S I GN I F 0 08 ES JL OO P 0 47 0 SJRTS 0481 SKPJNK 046E S KP NX T 0 26 ASTART 0200 STRTS1 027E TAKEIN 0297 TALOOP 03421'E 0418 TFLAG 0275 TOOUT 04E5 T O VR IB 0 34 8T RY DS P 0 22 4 TRYREF 0220 VARI ES 0053 V8DI SP 0439V TR AN S 0 49 C WORK 0089 XA 028B XC 02C3xC Q 02CA XE 03F7 XF'o'O 0353 XJ 03B EXM 0356 XQUES1 0282 XR 040B XS 03FOXT 0412 XU 03A9 XXF'o'D040F
MICRO - The 8502 Journal September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 51/68
I - - - - - - - - - - - - - ~ - - - - - - IName ----------------
IAddress ------------------------ ----------
ICity State _ _ Zip _
IDo you own a computer? What tYPE? _
: Do you use your computer for: Business?______ I
IPersonal? Education? __Other? I-----------_ . ._ - - - - - -
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 52/68
compQ~=microsystems
P.O . B ox 6 87
224 S.E. 16th Street
Ames, Iowa 50010
D A l r r l
DAIM isa complete disk operating system for the FIOCKWELL INTERNATIONAL
AIM 65. The DAIM system includes a controller board (with 3.3K operating system in
EPROM)which plugs into the ROCKWELL expansion motherboard, packaged power
supply capable of driving two 5 1/4 inch floppy dr ives and one or two disk drivesmounted in a unique, smoked plastic enclosure. DAIM is completely compatible in
both disk format and operating system functions 'Nith the SYSTEM 65. Commandsare provided to load/save source and object files, initialize a disk, list a file, list a disk
directory, rename files, delete and recover files and compress a disk to recover
unused space. Everything is complete - plug it in and you're ready to go! DAIM
provides the ideal way to turn your AIM 65 into a complete 6500 developmentsystem. Also pictured are CSB 20 (EPROM/RAM) and CSB 10(EPROM programmer)
which may be used in conjunction with the DAIM to provide enhanced functionalcapability. Base price of $850 includes controller board with all software in EPROM,power supply and one disk drive. Now you know why we say -
There is nothing like a
e m m Phone 515-232-8187
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 53/68
TH E .M ICRO SO FTWARECATAL OG : XII
Mike RoweP.O. Box 6502
Chelmsford, MA 018 :,
Name: AIM 65 Morse Code Send ProgramSystem: AIM 65
Memory: Less than 1K
Language: Assembly LanguageHardware: One IC (inverter), one relay (no relays
necessary for solid state transmitters)
Description: This program converts the AIM 65 keyboard
input into Morse code characters that are then output to
pin PAOon the applications connector. A suitable buffer
(two 7404 inverters) will key the transmitter or drive arelay. The following feature are provided:
1) The characters are displayed on the AIM 65 display
as they are typed on the keyboard. Up to 20
characters may be displayed, with a 20 characteroverflow buffer, giving the ability to type 40characters ahead.
2) The display is updated (scrolled to the left) as thecharacters are sent.
3) The display is updated as the characters are entered.
4) The DEL key allows characters to be deleted (back-space and delete).
5) Code speed is set and controlled digitally by enteringthe speed (in decimal) on the keyboard. Speeds from
05 to 99 wpm are possible.
6) The speed can be changed at any time by pressing
the ESC key, followed by entering the speed in words
per minute.
7) A message being sent may be halted at any time by
means of the carriage return key.
Copies: Just Released (hopefully thousands)Price: $3.50
Includes: Source listing in the AIM 65 dissasembly tor-
mat interface description, and instructionsfor operation.
Author: Marvin L. De Jong
Available from: Marvin L. De Jong
S.R. 2, Box 364A
Branson, MO 65616
September, 1979
Narm : MONITOR·II
Systs m: APPLE·II
Mem Iry: 3K + DOS 3.2 requirements
Lang iaqe: Machine LanguageHard rare: APPLE·II , DISK·II
(Sup] orted) High speed serial card, Programmer's Aid
ROM Applesoft ROM
Desc ption: MONITOR·II is an extension to Apple's
ROM Monitor that adds an interactive command
lanq; age. MONITOR·II provides the user: Extended cur-
sor c mtrol-Named program load, initialize, and execute
from lape or disk·Programmer's Aid ROM #1 interface
and .ornrnands-Translent area management·Variable
spee- listings-Split screen dlsplay-Speclat I/O routine
supp.ut-User extensible interact ive commands-Integer
BASI:: Variables Utility·Resident supervisor-much
more
Copk s: Just released
Price $45.00 on disk (Introductory)
lnclu les: System disk, user's guide
Optic ral: Assembly listings, systems guide
Auth: -: W.C. Deegan
Avail. .ble from: W.C. Deegan
2 Fairfax Towne
Southfield, MI 48075
Name Single Drive Copy
Syste 1 1 : APPLE
Memc ry : 16KLanqi age: Integer BASIC
Descr otion: Allows you to copy a diskette using one
drive. Autornatlcally adjusts for available memory andcorne.. with the option of not initializing disk.
Copie:: 10Price: :~19.95 + $1.00 postage & handling (PA residents
add 6% sales tax).
Incluc I!S: Cassette with instructions.
Authc ': Vince CorsettiAvail" hle from: Progressive Software
P.O. Box 273Ply. Mtg., PA 19462
MICRO - The 6502 Jou 'nsl 16:51
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 54/68
Name: CLASS ATTENDANCECHURCH ATTENDANCE
System: PETMemory: 8K or moreLanguage: BASICHardware: PET, 8K or larger
Description: Class Attendance & Church Attendancemaintain attendance records for any group which meetsregularly, using data tapes. The school version recordso to 5 days' attendance for each of up to 39 weeks. Thechurch version does the same for 0 to 5 times for eachof 12 months.
Attendance automatically sorts entires alphabetical-ly within & between data tapes. Though presentlydimensioned for up to 10 tapes of 70-85 names each,there is no limit to the number of tapes that can be us-ed.
Commands include: ADD, DELETE, LIST, UPDATE,END & CATEGORY. Within CATEGORY there are 8 sub-commands for frequency of attendance, (perfect atten-dance this month, for example). There is also a Helpcommand to escape to the main menu from anywhere inthe program, and a Back-up command to correctmistakes in updating. With four SIMPLE line changes,
PET's with the upcoming roms can use Attendancealso.
Copies sold: JUSt released,Price: $12.95 (either version)Includes: Program cassette with sample Directory &
sample data, 2 blank C-10tapes for data, anda 6 page instruction booklet with lists of vari-ables used & location of major routines.
Author: James StrasmaAvailable from: Dr. Daley
425 Grove Av.Berrien Springs, MI 49103(616) 471-5514 (Sun-Thurs, Noon-9PM)(Master Charge & Bank Americard OK)
Name: Omni Plotting PackageSystem: APPLEMemory: 32KLanguage: BASICHardware: Disk and Applesoft on ROM
Description: 7 data sets and 2 exec file examples 12basic programs, employ the High Resolution Mode. Noshape tables are used, data base is Cartesian coor-dinates which can be sent over the phone or to hard-copy plotters. Package allows ease of intricate graphicsgeneration supported by easy manipulation of graphicsafter generation. Package is excellent for map making,drafti ng, artistry and any other purely visual application.
Price: $19.00+$5.00 for diskette or you send one. We
pay postage.
Includes: 12basic programs, 7 data sets, 2 examples, 19page illustrated users manual with step by stepinstructions.
Author: P.S. TruaxAvailable from: Omni Plotting Package
c/o P.S. Truax237 Star Rte.Santa Barbara, CA 93105
16:52
Name: Applesoft BASIC-Optimization LibrarySystem: APPLE"Memory: 1BKLanguage: 6502 Assembly LanguageHardware: Standard (Applesoft ROM card optional)
Description: The Library consists of two 1.3Kassembly-language programs (VAROPT & REMOUT)that will workin any APPLE II with APPLOSOFT lIa, VAROPT renamesall variables to unique 1-2character variable names anddisplays (prints) a cross-reference listing with new
name, old name, and all l ine numbers where the variablewas referenced. REMOUT removes remarks, removesextra colons, renumbers from 1 by 1,and concatenatesshort lines into a reduced number of long lines.
Together, these programs will convert a verbose, well-documented development version of an Applesoft pro-gram into an extremely memory-efficient, more-secureproduction version.
Copies: Just ReleasedPrice: $15/Cassette, $20/Disk
Includes: Cassette/disk with hex listing & instructionsAvailable from: Sensible Software
P.O. Box 2395Dearborn, MI 48123
Name: APPLE XFRSystem: APPLE" with diskMemory: 3:~KLanguage: Machine LanguageHardware: Apple II, Disk II, D.C. Hayes Micromodem II
Description: This program will establish a session bet-ween two Apples and allow transfer of any text file fromone to another. All text file I/O is written in machinelanguage. Programs are also included to facilitate theconversion of any Integer or Applesoft program to a textfile.
Copies: Just releasedPrice: $15.!l5 on disketteIncludes: Diskette and documentation
Author: Travis JohnsAvailable from: Travis Johns
1642 Heritage Cr.Anaheim, CA 92804
Name: OnlELLOSystem: APPLEMemory: 1BKLanguage: Integer BASIC
Description: A game played by one or two players. Oncea piece is played the color may be reversed many times,with sudden reverses of luck. Can win with a single
move. Computer keeps all details and flips the pieces.Copies: 10Price: S9.9!5+ $1.00 postage & handling (PA residents
add 6% sales tax).
Includes: Cassette with instructions.Author: Vince Corsetti
Available from: Progressive SoftwareP.O. Box 273Ply. Mtg., PA 19462
MICRO- The 6502Journal September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 55/68
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 56/68
a table lookup scheme and transfering
to a separate routine for each 8080op-code. This offered some advantages in
simplicity and execution speed but it re-
quired far morememory than I cared touse.
A careful analysis of the8080instruc-
tion set suggested that the 256 table en-
tries and routines required by a "brute
force" technique could bereduced by25by grouping the 8080 op-codes into
categories sharing common functions.
Inaddition, certain judicious tradeoffs
could be made between simplicity and
ideal features, taking best advantage of
the addressing modes and features of
the 6502. For instance, the 6502 stack
resides in page one and many of the
6502's instructions and addressing
modes makeuseof pagezero. Toavoid
memoryuseconflicts it would havebeenniceto simulate 8080memorystarting at0200 HEX, making that address
equivalent internally to 0000 HEX.This
would have required a great deal of
overhead in the form of a special
monitor to show addresses minus the
200 HEXoffset.
Theaddresses being used bythe8080
program while running would haveto be
converted dynamically, and in order touse indirect addressing a special set of
simulated registers would have to be
maintained in pagezero. Besides requir-ing much morecode, this would slow ex-
ecution speed down considerably. Idecided instead to simply require the
user to patch around the small areas in
page zero and page one being used bythe simulator.
Final Design Overview
Laying out the 8080 instruction set
graphically on a hexadecimal grid, as il-lustrated, reveals some interesting
features. Four major divisions are ap-
parent, neatly dividing the instruction
set into quadrants. Thesecond quadrant
is composed alomst entirely of MaV in-struction op-codes. This MaV group
most clearly illustrates the way that8080 op-codes break down into source
and destination fields, and suggests thebest way to organize simulated 8080
registers in memory.
With simulated registers arranged
properly inmemory, source and destina-tion field data can beextracted from the
op-code and used as indexes to the
registers involved. In every case whereinstructions act upon individual
registers their order, as dtermined by
this source/destination indexing scheme
is B.C,D,E,H,L,M,A-where M is not an
actual register but rather the content ofthe mrmory location pointed to by the
HL register pair.
This order suggests ageneral method
for accessing individual registers with
some slight exceptional logic for the M
16:54
"pseudo-register". By inverting the
source and destination indexes andreversing the order of the 8080 registers
in memory it becomes possible te use
the HL register pair directly as an in-
direct pointer to memory. Addln; theStack Pointer and Program Counter to
the register array in the same reversed
order completes the simulated r€~listerset.
Looking again at the Instruction set
grid it can beseen that a syrnrne ry ex-ists based on the source field of t ie op-code. For instance, all INR instru ctions
have source fields containing 0'· HEXwhile all OCRinstructions have0:; HEX
as their source field. The tourth
quadrant exhibits similar symmetry. The
third quadrant is more logically defined
bythe destination field, but still ci"idesinto 8 groups of similar tnstructlons as
dothe first and fourth quadrants. '-,ese,
along with the entire MaV quaclrant,
total 25groups of similar instructi ens, A
major task, then, of the slrnulator
mainline is to determine from 111'3 op-codewhich of the 25groups it belor gs in
so tht control can be transfered \J the
proper routine to interpret it.
To keep the simulator as compact as
possible it is advantageous to petorm
as many common operations as possi-ble in the mainline. Fetching 11113 op-
code, extracting source and desti 'ation
indexes from it and tncrementlnq the
Program Counter are fundamental. Themainline also fetches the conte it ofmemory pointed to by the HL w!jister
pair, clears a flag used by "anysimulator routines, saves data frorn the
register pointed toby thedestination in-
dex for later operations, tests tor and
handles interrupts and handles other"housekeeping" type functions.
At theend of themainline theaddress
of the selected interpreter routine is
pushed onto the stack along with a
preset status. A 6502RTI instruction is
executed, transferring control to tl1'epro-
per module entry.
It is the responsibility of each module
to correctly interpret all op-codes which
result in a call to that module. Each
module is constructed as a subroutine.returning control to the mainline ~ia an
RTS.This also enables certain modules
to be used as subroutines by othermodules. Abrief look at themodules andtheir support subroutines will hel J to il-
lustrate their functions.
MOV. Whileencompassing the largest
number of op-codes of anymodul«, MaV
has perhaps oneof the simplest tasks. It
merely takes the content of the m'~isterindicated bythe source index and ~toresit in the register pointed to II~the
destination index. Nocondition fHgSinthe PSW(Processor Status Word)eireaf-
fected. The only slight complicationwhether the destination is memJry, in
MICRO - The 8502 Journal
which case the HL register pair is usedas an indirect pointer tostore the resultin memory.
INXlDCX.This module must increment
or decrement a selected register pair.The least significant bit of the destina-
tion index is tested to determine
whether the instruction is an increment
or a decrement instruction. The bit is
then dropped and what remains is an in-
dex to the proper register pair-except
for the cases of 33 HEX and 3B HEXwhen the Stack Pointer is the register
pair of interest. Inthese cases, the pro-
per index for the Stack Pointer is substi-
tuted.
With the proper index set, a call is
madeto INCDEC.INCDECis a 16bit ad-
der designed to add two zeropage16bit
operands. With the 6502's X and Y In-
dexes properly set at the entry to this
support routine, the content of adoubleprecision one (0001 HEX) or a double
precision minus one (FFFF HEX)is add-
ed to the chosen register pair, perform-ing the increment or decrement.
The proper register pair is selected in
the samefashion for the DADand LXIin-
structions also.
INR, OCR,MVI. Theseinstructions are
very consistent in their use of the
destination index for determining which
register (or memory as thecasemay be)
they operate on. INRand OCRhavetheadded complication of modifying the
PSWcondition bits, with the exceptionof the 8080Carry.
Rotates. This is amixture of quite dif-ferent instructions lumped into onemodule. Proper execution depends on
separating the Rotate instructions from
the DAA, STC, CMC and CMA instruc-
tions, providing special logic for eachand insuring the proper setting of PSWflags.
PUSH/POP. While handling register
pairs somewhat like INX, DCX,DADand
LXI do, these instructions differ in
substituting a register pair madeup ofthe 8080 Accumulator and PSW for theStack Pointer. The simulator handles
this by looking for the special caseand
thendecrementing thedestination indexto theproper position. TheStack Pointer
is then incremented or decremented ap-
propriately and the register pair data
transferred to or from the stack as re-quired.
Several support routines come into
play, including INCDEC and variousroutines for transferring the content of
register pairs between each other and
memory. An intermediate register pair
(not illustrated) is utilized as a tem-porary storage location during the ex-
change of register pairs. I've labeled it
simply "SCR", though I believe it bearsanactual hardwareanalog in the8080inthe form of a hidden register pair, tem-porary registers Wand Z.
September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 57/68
NOP RL C XX L S I I D M RA L XT N N C V
[>( I 0 X R R I DAA X[>(
R
XTC
MOV
r;;lADD
SU B
ANA
ORA
JMpI---
R P J OUT C P I R RE 0 M I--- A U M S ET P P IXTHL L S M T T
I""- L H E
DI D
B e D E
B
D
H
M
B
D
H
M
H Z
H e
PO
NS
CALL and RETURN. These also
manipulate the stack, using it as a
storage location for the content of theProgram Counter. Thesame set of sup-
port routines areused toget thetransfer
address from memory (for the CALL in-struction) and to movedata to and from
the stack memory. RST is treated like a
CALL instruction, except that thetransfer address is computed from the
destination field of the op-code rather
than taken from memory, Conversely,JUMP gets its transfer address from
memory, but does not save any return
address onthe stack.
Condition Codes. CALL, RET, andJMPall makeuseof a subroutine called
CONDIT.CONDITexamines the destina·
tion index derived from the op-codeandsubdivides it into.a condition index and
a True/False indicator bit. The index is
used to select a PSWbit mask from a
J
table of masks. Thesemasks align with
theappropriate bit in thePSW.Basedon
thestateof theselected PSWbit and theTrue/Falseindicator bit, CONDITreturns
an indication of whether or not the JMP,CALL, or RETshould take place.
September, 1979
H
~LS~
AB eM D E H M
D
A .
D
M
V
I
LoA
D
D
eX
I
N
R
D
eR
ADC
SB B
X R A
. : m r z
J I R C
M M S
P M T PE
E, :?HL D s
8080 Instruction Set :iagram"X"s = Unimplemen' I~d
A
RRC C
E
L
CMC A
C
E
L
A
J!<)
I N T E PS W A M
L H
E D
C B
SPL SPH
FQ
Pet PCH
8080 ;3imulator Register Map
MICRO- The8502Joulnal 16:55
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 58/68
Arithmetic and Logic. These lnstruc-
tions occupy the third quadrant of the in-
struction set. Rather than being grouped
vertically by their source fields they are
grouped horizontally by their destination
fields. This is due to the fact that while
they may have different sources of data,
they all have one implied destina-
tion-the 8080 Accumulator. The CMP
instruction is the only one of this group
which does not place its results in the
Accumulator. It merely discards theresult, setting only the PSW flags accor-
dingly. This is accomplished by forcing
the destination index to point to a scrat-chpad location.
Probably one of the most difficult
things to simulate successfully is the
proper setting of the Processor Status
Word. Different instruction groups at-fect different subsets of PSW flags but
the Arithmetic and Logic group affect all
the flags. Zero, Sign and Parity flags are
always affected as a group. A routine
called STATUS sets these three flags
simultaneously when a result is passed
to it. Carry and Auxilliary Carry arehandled separately as they may be at-fected in isolation by some instructions
and not affected at all by others.
Special Features. For the purpose of
using the simulator as a debugging tool,
I chose to trap unimplementec op-
codes. When the 8080 Simulator deter-
mines that the current instruction is an
illegal op-code it forces a jump t o the
system monitor. This can be used: 0 ad-
vantage as a simple type of breakpoint.
Alternately, a table of breakpoint ad-
dresses may be set up in memory. After
each instruction, the 8080 Pregram
Counter is compared to each address in
the breakpoint table. If a match is t . iund,
a jump is forced to the system monitor.This makes it possible to step from
breakpoint to breakpoint, seeinq the
result of groups of steps rather than only
individual steps.
110 Instructions. 110 is also handled
via a table of addresses. Each ertry in
the table is the address of a port n the
6502 system. The entries in the tatle are
associated with 8080 ports in sequential
ascending order. Setting of the Data
Direction Register, as in a 6530 FlO, is
handled transparently to the user.
Call 65. I have "borrowed" one rf the8080's unimplemented op-codes for a
special purpose function-calling 6502
subroutines from an 8080 prograrr . This
enables you to use existing system I/O
routines and other utilities. All tha: is reo
quired is to add brief header and .rallerroutines to transfer the required para-meters to and from simulator registers
and 6502 registers used by the sub-
routine. The CALL 65 instruction may
also be useful fothandlinq time depen·
dent code segments.
Summary
Modeling one microprocessor with
another is a technique which provides
many potential benefits. It has certain
significant drawbacks, most notable of
which is a large penalty in execution
speed. These drawbacks, however, are
not of paramount importance in a large
number of applications in instructional,
personal and experimental use.
Designing such a simulator involves
tradeoffs between the complexity and
quantity of the coding required for the
task on one hand, and the features and
execution speed of the final product on
the other. Ichose to minimize the quanti·
ty of code, emphasizing commonality of
functions within the simulator.
Simulators for the 8080 and Cosmac
1802 microprocessors are available from
the author inversions designed to run onthe Commodore/MOS Technology KIM·1.
Thanks to Gary Davis for his generoussupport in the form of access to his 8080system and his assistance in runningcomparison tests. IA
16:56
MANUSCRIPT COVER SHEET
~~~~~(!JMlease enter all of the information requested on this cover sheet:
Date Submitted: '-- _
Author(s) Name(s) Telephone: ---------
(To be published exactly as entered) (This will NOT be published)
Mailing Address:(This will be published) _
AUTHOR'S DECLARATION OF OWNERSHIP OF MANU·
SCRIPT RIGHTS: This manuscript is my/our original work and
is not currently owned or being considered for publication by
another publisher and has not been previously published in
whole or in part in any other publication. I/we have written per-
mission from the legal owner(s) to use any illustrations,
photographs, or other source material appearing in this manu-
script which is not my/our property. If required, the manu-
script has been cleared for publication by my/our employer(s).
Note any exceptions to the above (such as material has been
published in a club newsletter but you still retain ownership)here:
Signature(s): Date:. _
Any material for which you are paid by Micro Ink, Incorporated,
whether or not it is published in MICRO, becomes the ex-
clusive property of Micro Ink, Incorporated, with all rights
reserved.
A FEW SUGGESTIONS
All text should be typewritten using double or triple spacing
and generou" left and right margins. Figures and illustrations
should be drawn neatly, either full size or to scale, exactly as
they will app ear in MICRO. Photographs should be high con-
trast glossy prints, preferably with negatives, and program
listings shor Id be machine generated hard copy output in
black ink on -vhite paper. Assembly language program lisHngs
need not becf especially high quality, since these are normally
re-qenerated inthe MICRO Systems Lab, but they must include
object code as a check against typographical errors.
Since other ~IICRO readers will becopying your program code.
please try to test your program thoroughly and ensure that is
is as free from errors as possible. MICRO will pay for programlistings, figUi es and illustrations, in addition to the text of an
article; howe fer, MICRO does not normally pay fo r figures that
must be re-d: awn o r fo r p ro gra ms that must be re-keyboarded
in order to obtain a high contrast l isting. Any program should
include a re e sonable amount of commentary, of course, and
the com men s should be part of the source code ra ther than
explanations added to the listing. .
Send your m muscrlpts to:
MICRO, 1-.0. Box 6502, Chelmsford, MA 01824, U.S.A.
MICRO - The 8502 Journal September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 59/68
LEADERIN
c om pUTER EDUCATION
INTRODUCES THE 6502 SERIES
PlOGlAmmlNG THE 6502
B y Rodney Zaks
320 pp, ret C202 510.95
An introductory programming
text for the 6502. Does not
require any prior programming
knowledge. From arithmetic
to interrupt-driven input-output
techniques. It hos been de-
signed as a progressive, step
by step course, with exercises
inthe text designed to test the
reader at every step.
6502 GAmES
B y Rodnay Zaks
retG402 513.95
From Piano to tic tac toe, in-
cluding many popular games,
and how to program your own.
To be published.
6502APPUCAnONS BOOK
6502 APPLICATIONS BOOK
byRodney Zaks275 pp, ret D302 512.95
Presents a series af practical
(hardware & software) appl icc-
tions for any 6502 board.
Applications can be used as
experiments - or implemented
at minimal cost. A few ex-
amples: marse generator, elec-
tronic piano, digital clock,
home alarm systems, traffic
controller .... and more!
TO ORDER
.yphone: 415848~233, Visa, M.C.,
American Express.
ly .... ll: Include payment.
Shlppl . .. char_: add 65C per book
4th class - allow 4weeks - or S 1.50
per book for U. P . S. Over eece add
S3.00 per book.
Tax: inCalifornia add tax.
AVAILABLE AT BOOKSTORES. COMPUTER. AND
ELECTRONIC SHOPS EVERYWHERE
82020 Milvia Street
Berkeley. CA 94704Tel415 848-8233 Telex 336311
,"- POSITION _
COMPANY _
ADDRESS . _
CITY STATE/ZIP
Ocharge my: OVisa OM.C. OAmerican Express
OC202 OD302 OG402
Number Exp. date _
Signature
MM OSend Free Catalogue
DISt: DRIVE WOES? PRINTER INTERACTION?
MEMORY LOSS? ERRATIC OPERATION?
DON'T BLAME THE SOFTWARE!
' ~ . ' "~~- ISO-1
e\)'~I
~0-2
Power Line Spikes, Surges & Hash could be the culprit!
Floppies, printers, memory & processor often interact!
Our ur ique ISOLATORS eliminate equipmen t interaction
AND curb damaging Power Line Spikes, Surges and Hash,
·ISOLATOR uso-t Al 3 filter isolated 3-prang sackets;
integri. Surge/Spike Suppression; 1875 WMaximum load,
1 KW lead any ..tEet t54 .•·ISOlATOfIlfaG-211 tiher isolated 3-prflfl!l sacbt banks;
(: 5 sochets totall; in1llgral Spike/Surge Suppression;
1875 nMax load. 1KWeither bank . . . . . .. $54.95
*SUPER ISOlATOR (lS()'31, similar to ISO-1A
ex~ept double filtering 8. Suppression . . .. $79.95
·ISOLATOR (lSO-41. similar to ISO-1A except
unit has 6 individually filtered sockets. .. $93.95
·ISOLATOR (ISO-51, similar to ISO-2 except
unit has 3 socket banks. 9 sackets total .. $76.95·CIRCUIT BREAKER, any model (add-CBI Add $ 6.00
·CKT BRKR/SWITCH/PILOT any model
(-C:JSI Add $11.00
• PHONE ORDERS 1-617-655-1532 _,
lEllElectronic Specialists, Inc.171 South Main Street. Natick. Mass. 01760
Dept.M'
It ....§..l l Y r s C R , ~ ( S r n ( ~
• U T I L IT Y PA C I I •• • • • • •
• CH ECKB OOK UPDATE TO DOSA N EXE C FI LE WR I T ES OV ER YOU R C H E CK B OO K
PRO GRA M T O A UT O M A T I C AL L Y U PD A T E I T T O D O S• I NlEX FI LE UPDATE
AU T O M A T ES B I S H O P'S I N D EX FI L E
• FI ~D CONTROL CHARACTERWI LL D I SPLA Y CO NT R OL CH A RA C T E RS ON A NY
C A T A LO G O R PRO GRA M L I S T I N G
• SLeW LI STFU LL S T OP & S T AR T C O NT RO L WI T H E XI T . WO RK SWI T H APPL E SO FT O R I N T EGER B A S I C
• LI ST H EADERSPU T H E A D E RS ON YOU R L I S T I N GS WI T H NO LI N E
NU M B E ~ S O R R E M S T A T E M EN T S . A P I I
• AU10 WRIT E• AU10 WRI TE INST RUCTIONS
US E EXEC FI L E S T O APPE N D, A D D S UB R OU T I N ES ,
OR E D I T PRO GR A M S . C O NV ER T I NT E GE R T O APPL E -
S OFT . D EL ET E I L LE GAL LI N E N UM B ER S E T C . E T C .
• EXEC READERR EA D S T EXT FI L ES FO R A B OV E
• DISC SPACEC OM PL E T E L Y WR I T T EN I N APPL E SO FT . WOR KS
I N 3 S EC O ND S . GI V E S FRE E SE C T O RS A ND B YT E S
WI TH LI ST IN GS AND D ocu MEN TAT ION, PRI CE $ 1 9 . 9 5• • • • • • • • • • D I S C M A NA G ~ N T S Y ST E M • • • • • • • • • •E I GH T PRO GR A M S ON D I S K T O PR O VI D E T H E U S E R WI T H A
C OM PLE T E UN D ER S T A ND I N G OF T H E D I SK D R I V E C O M M A N D S
PLU S A U T I L I T Y PA CK AGE T O I N D E X & C A T A GO R I Z E A LL
PRO GR A M S WR I T T EN FO R T H E A PPLE I I C O MPU T E R. T H E
S YS T EM PRO V I D ES FU LL S E AR CH , E D I T I N G A ND D A T AT RA NS FE R C AP AB IL IT IE S.
A T WE NT Y-S I X PAGE B OO KL E T PRO VI D ES D E T A I LE D,E DU C A T I O N AL T E QU NI Q UE S GI V I N G A T H RO UGH UN DE R S T A N D -
I NG O F T H E D OS CO M M A ND S .
SYS T E M RE QU I RE M E N T S : D I S K I I ~ A PPLE S OFT T A PE O R RO M
PRI C E $ 19. 95 O N D I SK FO R E I T H E R O F A B O VE(PROCES S ED & S H I PPE D WI T H I N 4 D AYS)
S E ND C H E C K O R M ON EY OR DE R T O:
a i l eS O F T O U ' C H
P. O. B O X 511L E OM I N S T E R, M A S S . 014 53
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 60/68
GAMES OF HIGH ADVENTURE
FOR THE APPLE II FROM
SYNERGISTIC SOF1WARE
5221 120th Ave, S.E.
Bellevue, WA 98006
The Apventure games combine the exciting graphics andsou nd effects capabi Iities of the APP LE IIw ith the fas-cinating complexity of a mythical adventure game.Monsters, hazards. obstacles , weapons, magical devicesand evil powers confront the player at every turn asyou gather treasure and try to reach your goal. Twoadventures are now avai lable:
DUNGEON CAMPAIGN· Full color graphicssubterranean adventure. 16K required.
CASS, $12.50 DISK $15.00
WILDERNESS CAMPAIGN - HIRES graphicssurface adventure. 48K required.
CASSo $15.00 DISK $17.50
GET BOTH ON ONE DISK FOR $30.00
(WA Res. add 5.3% sales tax)
Put Yourself in Control with the__ _ A PP L£THHO TTLE
That's right! The APPIETHROTTLE willtumyour game paddles into a speed controUer.
Bysimplypushing a button, you can stopyour computer for as long.as you wantRelease the button, and your computerenters a slow-motion mode withonepaddle controlling the speed. And if thatisn't enough, look at these additionalfeatures:
• Plugs intoany slot
• Works withmachine language, IntegerBASIC,and Applesoft
• Normal· slow· stop
• Use to UST, TRA.CE,RUN,etc.
• NO SOFTWARE to load=APPLETHROTTLE .....• Unveilprogram secrets
And there's more! No more multiple UST commands toviewsmallprogramsections. With the APPlETHROTTLE, you'll be able to list or trace longprograms whilewatching your program flowin slow-motion. So get in controlwiththe APPlETHROTTLE and order yours today!
PROTOBOARD,with over 1300
holes on 0.1 centers for designingyour own circuits.APB.1 Protoboard .... $17.95
APPLETIME,a RealTime Oockforthe Apple II.Plugs directlyinto anyslot and keeps time even whencomputer is off. Features 12/24
Hour, BCD/ASCIIdata format, andAC/Crystal time base selection.Includes software examples formachine language and BASIC pro-grams. Completely assembled andtested.
APT·1 RealTime Oock $79.95
VERBATIM5W' DISKETTES
Sof t ·Sec to r Bo x of 10... $34.50(plastic Hie case included)
. . . . ._ - _ _ _ ,------,_ _ --:
M~ 'RE I N N O V A T I O N S !F R O M
P.S'I SOFTWARE HOUSEFORM ERLYPE T S H A CK
PETTI< INTERFACESNE .....!
PET toC I IITRONICS INTERFACE
PET to 2r jCASSETTE INTERFACE
$9aOO
549.95
PETTI<SCHEMATICSFOR ONI , $24.95 YOU GET:
24" X 30 - ;chemat iG of the CPU board, p lus oversi zed schemat ics of the V ideoMonitor, 1"1 cj Tape Recorder, p lus complete Pa rts layout· all accuralely and
pains taku ~Iy drawn to the minutes t detai l.
P ET" " R 'O M ROU TIN ESFOR ONI l$19.95 YOU GET:
CompletE I li sassembty l ist ings o f al l 7 ROMS, p lus ident if ied sub rou tine en trypoints; Vi, "'0 Monitor, Keyboard routine, Tape Record and Playback routine, Real
Tlrne Cl o h, etc. To entice you we arealso includingour own Machine LanguageMonrtor pegram for your PET using .the keyboard and video display.You can I av e the Monitor program on cassette for only $9.95 extra.
SOFTWARE:6502 o rs 'SSEMBLER $'2.95
MAILING .1ST- For personal or business applications. $9.95
MACHINI I,ANGUAGEMONITOR· WriteMachine Code. Saveontape $9,95
BUDGET flEW - Keep.treck ct Bills and Checks. Updateasneeded $14.95
STAATREc. All-time favorite written for the PET'sspecial Geaotucs $7.95
Sen< J>rourfree SOFTWARE BROCHURE. Dealer inquiries welcome.
P.S. SOFTWARE HOUSE
P.O.eux 966 Mishawaka,IN46544
.1 Tel: (219) 255-3408 C iC i........ __ 0 =:=-. : :=.=: . . ' * : ' : . ._•• ._.._ 0 .;
1 B J
TEXTCASTTUI ~Iyour PET into a WORD PROCESSOR
cor iparable to large systems for a fractionof t ie cost!
CF:EATE-REVIEW·EDIT FILESO~I TAPES OR DISKS
PF NT TEXT·LETTERS-FORMS-TABLES
TE ;(TCAST FITS YOUR PETsv :3TEM, OLD AND NEW ROMS
CLEAR INSTRUCTIONS!
Pri. HS: Tape plus manual, $60.Diskette plus manual, $65.Manual separately, $20.
Wri : ' : ! : TEXTCAST M9P.O. Box 2592CHAPEL HILL, N.C. 27514
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 61/68
Writing for MICRO
Who writes for MICRO? Subscribers just likeyourself! How does one go about it? Read on!
The kind of material published in
MICRO can be broken down into three
general categories: application notes
describing hardware or software pro-
jects, tutorials conveying general infor-
mation about specific subjects, and re-
views presenting informed opinion. The
division into categories is not hard and
fast; one easy way to get published is to
write a piece whose very novelty defies
categorization. Yet most articles pub-
lished in MICRO and other magazines
describe a project, or a concept, or a pro-
duct, and can be labelled accordingly.
The label serves a purpose by remin-
ding the writer that abstract theory may
be out of place in an application des-
cription; working laboratory projects
may detract from a tutorial; and opinion,
the mainstay of reviews, is alien to bothother forms.
This article is a tutorial on the subject
of wr iting technical articles. It illustrates
how most anyone can write a piece that
will be received gratefully by any number
of magazines, including MICRO, and it
explains exactly why one would want to
do so. Because it is a tutorial, and not an
application note, it will not present step
by step instructions that could be ex-
ecuted in sequence, with the usual back-
tracking and microbe debugging, to pro-
duce a working (publishable) project. If it
did, about ten thousand readers wouldpromptly deluge MICRO with drafts of
essential ly ident ical manuscripts.
Insteacl, we will examine each ol thethree forms of technical prose, describe
some easy ways to get started, mention
a few techniques that may t E applied
along the way, and encouraqe you to
rush the result directly to M1CF.O.
Application notes
Many personal computers are much
like the t - f . o . railroad train toys of two
decades ago: expensive inljlJlgences
that occupy a few delightful hours on
Christmas day and spend thu next six
months gathering dust on a closet shelf.
A decent model railroad used to run bigbucks, what with engines and cars and
lots of track segments, tur riels andcrossings. and enough plastic rle brake-
men to simulate teatherbeddlnq.
Yet once assembled, it served onlyone useful purpose. Like model trains,the personal computer may provide little
more than entertainment the di{ it is un-
packed and assembled. It ca 1 play all
kinds of Ilames, and play most of them
exceedingly well. It comes complete
with a formidable library of rscreatlcnalsoftware. Whether any individual
machine ever rises above recreatlonalapplications depends entirely upon the
dilligence and ingenuity of its cwner.
This explains why many proqiarnrnlnq
buffs scorn "personal COlT puters."Quite a few data processin J profes-
sionals actually eschew the turrn itself,
September, 1979 MICRO - The 8502 Joumal
Shawn Spilman
Box 6502Chelmsford, MA 01824
perhaps because there is little that is
personal in computing and less that is
computational in pure and simple
gamesmanship. The measure of any
computer lies in its ability to implement
true data processing applicat ions.
Recreation is a legi timate applicat ion,
of course, but no one doubts that per-
sonal computers can be recreational.
The question is, "Can they be applied to
other problems?" Can they afford eco-
nomical, effective solutions to the
classical problems of data manage-
ment? Can they admit to new applica-
tions reflecting the unsolved problems
raised by recent technology?
We suspect that the answer is a re-sounding yes, and we can demonstrate
this by describing applications that are
served by personal computers. Each ap-
plication implemented successfully en-
hances the versatility of the machine
that was used to perform the task and,
perhaps more important, each makes
the next application ali that much easier
to implement.
A 6502 application note will benefit
the entire 6502 community if it descr ibes
the solution to an open problem or an
application never before implemented
on a particular machine. Beneficial ar-
ticles might also report new or unusual
approaches to problems that have beensolved using different methods. The
novelty, general applicability, and over-
all ellegance of the solution are quite im-
portant because, after all, brand new ap-
plications that solve open problems are
very rare.
It is easy to write an article that
describes a computer application. This
is fortunate because the application is
not fully implemented until it has been
described in writing. An application note
should describe the problem that was
solved, the method of solution, and the
implications of the method. It should
answer the questions: "What?" and "So
what?"
It is impossible to overrate the value
of a problem description. Serious com-
puter scientists are constantly refining
their ability to evaluate problems, assign
them to categories or classes, distin-
guish those solved in the past from
those that remain open, separate the
easy from the difficult, generalize the
solution to other applications, and ex-
tract specific techniques that might
serve well in future projects.
16:59
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 62/68
This skill derives from exposure to
problems, as well as solutions. Sostatethe problem clearly. Describe the situa-
tion that caused the problem. Indicate
its analogs in related situations. Outlineprevious attempts to solve the problem,
and mention the measure of their sue-cess or the reason for their failure.
You will only have to deal with your
solution once, now that it is fully im-
plemented, yet whether you aredescrib-ing a simple memory test routine or a
mind boggling speech synthesizer, yet
another fast Fourier transform or thefirst algorithm to play a competitive
game of GO, you will undoubtedly en-counter your problem over and over
again. Few people understand the prob-
lemas well as youdo, now that youhavesolved it once. Takethe time todescribeit well, sothat youand everyoneelsewill
recognize all of its manifestations.
The problem solution is most often a
program or a piece of logic. Softwaresolutions and hardware solutions have
much incommon. Most interesting prob-
lems admit to solutions of either type.
The best presentation of a softwaresolution reproduces aworking source of
the actual computer program; that is,
theassembler or compiler output listing0( aprogram that was loaded and tested
thoroughly immediately after assemblyor compilation.
Listings that were transcribed orrnanually corrected imply that the per-
son who made the copy or revision is
less prone to error than the computer.The entire article is likely to beviewed
with the samescepticism anyonewould
accord this implication. As a rule, let thecomputer generate the program listing.
It goes without saying that any pro-
gram worth coding is worth commen-ting. Or does it? The first self explana-tory computer program remains to bewritten. If and when it finally appears,
odds arethat it will contain comments.
The program description is perhaps
the least important part of an applica-tion note. The program is right there,
after all, cleanly coded and with ample
commentary. The big question,"What?", has beenanswered bythepro-blem description and the source listing.
Authors stress program descriptionsbecausethey provideaneffective mech-
anism for answering the question, "So
what?" The description illustrates whyan application is deserving of study. Itpoints out noteworthy aspects of thedesigner's methodology, perspective or
approach. It identifies techniques thatmay be generalized to solve other pro-
blems. Inmuch thewayamap enhances
appreciation of unfamiliar terrain, it un-
covers pitfalls, highlights the points O.finterest, and distinguishes one parti-
16:60
cular application from the varletv ofsimilar programs that almost always ex-
ist as equivalent solutions. Is yourmemory test routine anydifferent [roma
thousand others written since Baboaqenamed the game? If so, the proqrarndescription is theplacetopoint th isout.
A hardware application note "'fi I re-quire a logic schematic in lieu of a pro-
gram listing, block diagrams in place of
flowcharts, pin out lists instead cf call-
ing sequences, and perhaps a photo-graph. That photo might not providemuch hard and fast information, but it
relates your article to the real wOII<l.
Schematics and block dlaqrarns are
almost always drawnbyhandand, tl,ere-
fore, susceptible to errors no proof-reader will ever catch. Unlike so!t-varedesigners, whose computer gen'31ated
source listings instill a measure of
reader confidence, the hardwaredesigner must rely onmanual reproduc-
tion techniques to express his im-
plementation. That extraneous photo isone exception to this rule. Like com-
puters, cameras might not alwavs tell
the truth, but they nevermakemistakes.
Tutorials
A tutorial is a short, complete andentertaining explanation of a technical
subject. Unlike application notes,
tutorials need not describe operationalprograms or projects that may becon-
structed to perform useful tasks. AI·
though they may include program seg-
ments or circuit details, byway of illus-
tration, tutorials present techniques forsolving general problems, instead, andavoid specific problem solutions.
The subject of a tutorial must be
selected carefully to resolvethe confl let-
ing demands of brevity and complete'ness. A single chip, such as the 6522 or6532, might makea good subject. Amaojor subsystem, such as avideodriver or
a tape 110package, might be too corn-plex to describe insufficient detail. The
general subject of subroutine calling se·
quences would make a good tutorial;however, the subject of floating pointmath packages is much too broad.
Becauseof its limited size, a tutorial
may employ writing techniques that are
not appropriate in other types of
MICRO - The 6502 Journal September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 63/68
1?L~~
f?tJ[p
/'--I/
/
technical prose. Useof the first person
is common, for example, and casual orvernacular writing may be effective.
Thesetechniques help makethe tutorial
entertaining, fun to read; their usegives
tutorials a big advantage over longer
technical articles, which can tend to berather dull.
Of course, a tutorial must present
more than warmed over material from
the manufacturer's documentation or a
clever rehash of material excerpted from
a textbook. Like any other form of writ-ing, its impact depends upon theauthor's originality. Here again, careful
selection of subject and perspective is
the key to success. A fresh, innovative
point of view applied to the right topic
yields a tutorial that will practically writeitself.
Analogy is aneffective technique that
sets tutorials apart from run of the mill
technical documentation. Virtually all
significant hardware and software pro-blems haveanalogs outside of computer
science. Textbooks cannot develop
analogies for morethan afew aspects ofthe material they treat without ranging
far afield. Yet the tutorial, becauseof its
limited scope, responds perfectly to the
useof analogy.
Historical perspective is another
useful trick. Ageneral solution is only as
September, 1979
interesting as the general proorern it
solves, and thetutorial provides an idealformat for discussion of problems, as
well as solutions.
Innovativemodelling can also payoff,
to the extent that it is effective; but this
little trick is fraught with risk. Theauthorwho devises his own paradlqrn has
guaranteed originality and H fresh
perspective right off the bat. If themodelis effective, he might just become as
famous as Hollerith with punched cards;Baudot with character codes; or Hamm-
ing, whosesimpleconcept of "di stance"sold thousands of books. However, if the
model is not effective, the tutorial fails.
It is as simple as that, and the-eis no
middle ground, but perhaps someone
will print that questionable model as a
humerous bit of satire.
Thewriting style matters, ina tutorial,
because virtually identical info.rmation
is available from manyother sources. Dr.DeJong's application note in this issue
provides the only description of an AIMNotepad you will find anywhere; in con-
trast, there are countless artic:les on
evensuch anunlikely tutorial subject aswriting articles. If you survived that
freshman English composition course,
enough said. But if youopted ins:ead fora tensor calculus elective, sorre com-
mon senseguidelines will makeawhole
lot of difference.
MICRO - The 6502 Jeurna]
Short sentences win big. Usefirst per-
son, present tense, active voice. Avoidany grammatical construction you can't
identify by name. Resist all impulse to
employ parentheses, quotation marks,
footnotes or dashes. Andwhen indoubt
triple spacethemanuscript, leaving you;
editor plenty of room to ply his trade.
If you ever wanted to write a book of
nonfiction, a tutorial is really the ideal
place to start. It only takes a few idle
evenings, it requires a format inwhich it
is difficult to bog down, and you canalways useit as Chapter 27of your hard-
cover best seller. Besides, what couldprovide more motivation than your first
royalty check? That check is only five
typewritten pages away.
Reviews
MICRO has published very few pro-
duct reviews, in the past, largely be-
cause of uncertainty about how reviews
should be solicited, prepared and pre-
sented. MICROwill publish many more
software, hardware and book reviews infuture issues. This is how weplan togoabout it.
All product reviews must besolicitedbythemagazine. MICROwill not publish
a review that simply shows up in the
mail, because the act of writing an un-
solicited review implies that the author
has strong feelings about the product,
one way or another, else hewould nothavetroubled to prepare anunsolicited
manuscript.
The product must be submitted for
review by themanufacturer. This is only
fair, becausea reviewer should feel free
to make negative comments, and a
manufacturer should be able to enjoy
his monthly MICROwithout encounter-
ing those negativecomments complete-
ly unexpectedly.
Themanufacturer of a product, or the
author of a book or program, must re-
ceive a copy of the review, prior to pub-lication. Although manufacturers will
not havethe right tomodify or suppress
unfavorable reviews, they will beableto
make comments or rebuttals and offeradditional insights that the reviewer
might havemissed.
Software and books submitted for
review will become the property of the
reviewer. Hardwarewill beprovided, andthe reviewer will havethe option of pur-
chasing this hardware at dealer cost.
What's In it for me?
More and more frequently, of late,manuscripts have arrived from writers
who wished to retain exclusive owner-
ship of their articles. MICRO has re-
ceived copyrighted manuscripts, and afew authors havedeclined to fill out theominously worded MScover sheet.
16:61
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 64/68
Any piece of text can be copyrightedsimply by writing "copyrighted by", andyour name, and the date, and the magicsymbol ©, somewhere near the front ofthe text. You can copyright your article,your computer program, your life story,or your laundry receipt. It is notnecessary to hire a lawyer and send Un-cle Sam a draft.
Now, your article remains your article
whether it is copyrighted or not, andplagiarism of uncopyrighted material isplagiarism none the less. However, ifyour article is copyrighted, this meansthat it cannot be Xeroxed, it cannot bequoted at length, it cannot be trans-cribed or typeset, and it cannot beprinted in any magazine. There is nopoint in sending a copyrighted article toMICRO, unless you think the editor willenjoy reading it, because enjoy it isabout all he can do.
MICRO is a business, like any othercorporation, that tries to earn a profitpurchasing raw materials, adding valueby incorporating these materials into a
marketable commodity, and selling thecommodity. Articles comprise the rawmaterials; the magazine is the final pro-duct. The added value consists ofediting, typesetting, proofing, paste-up,illustration, program listing generation,Pfinting, distribution, and all the otheractivities that make Chelmsford onefrightfully busy place to work.
This means that if you want to retainexclusive ownership of your article, andyou also want to share it with others byprinting it in MICRO, the hard facts oflife require you to request an advertisingrate card.
When you submit an article for publi-cation, the editor and publisher collabor-ate with you to produce a piece that re-flects substantial effort on both sides.YQ!Jre_cEil i'e_<!.nlnLti_<!.l__r_o_ya.ltyayment,based upon the size of the plece.Jn re-turn for the inspiration and effort youhave expended on its preparation.
You remain the author, and the articlewill never appear in print without yourbyline. You may receive addit ional pay-ments, called residuals, whenever the ar-ticle is reprinted or incorporated intoanother publication such as Best ofMICRO. Residuals are based on thesales of the auxiliary publication and
often exceed the original royalty pay-ment.
Your article will not De published byanyone except MICRO without your per-mission. In return, of course, you mustagree not to publish the article, on yourown, without MICRO's permission. Aswith most any magazine, MICRO wouldbe proud to see your article incorporatedinto your very own book, presented at aconference. or included in an anthology.
16:62
It appeared here first, after all, and lmlta-tion is a sincere, if unprofi table, form offlattery. Classic works of both fictlonand nonfiction have appearec inmC\gazinesprior to publication as books.
What if I don't get published?
Rejecting an article is the rnos: dif-ficult task any editor will be called rponto perform, especially when the copydeadline draws near and space remains
to be filled. The only common reasonsfor rejecting articles submittecl toMICRO are:
Too short
Nothing new
Incomplete
and, very rarely, just entirely too dif1icultto prepare for publication. These pi1fallsare surely easy enough to avoid. If yourarticle is at least one page long andreflects original work, it will be publ ish-ed. If it is incomplete, you will be askedto supply additional material prior topublication. This might involve answers
to questions that were raised and leftopen, comments to accompany programcode, or background information mostreaders would require.
Every so often an otherwise excellentmanuscript simply jams the productionmachinery. One author's draft stubborn-ly refused to pass through the copyingmachine. Another included several yardsof program listing, in a language theMICRO systems lab was not equipped to
reproduce, all printed using blue inkwhich is invisible to photographic plate-making equipment. By al l means avoidblue ink and electrostat ic copies. Moreto the point, take a minute and considerwhat is required to convert your manu-script into a magazine article. Have yousupplied the basic input required? If so,publication is all but guaranteed.
The editor wishes to thank these per-sons who contributed their thoughts andassistance: Keating Wilcox, Dann Mc-Creary, Dr. Marvin L . De Jong, Philip K.Hooper, Robert M. Tripp. Illustrations byBruce Conley.
~/'~Ij
I!
MICRO - The 8502 Journal September, 1979
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 65/68
The Basic SwitcllMAttentton "Old" Pet1M Owners:
Not sure about the ROM Retrofit Kit from Commodore?Now you can use both sets of Commodore ROMs and others as well.
The Basic Switch allows switch selection of either ~OM set (your original set oryour retrofit set) from Commodore. Plus,Model 15-A includes an additional zero
insertion force socket allowing easy use of ROMs likHthe BASIC Programmer's Toolkit
...concurrently.
Modell4-E The economy model of The Basic Switch. Stand alone board andharness without case and case hardware. The free standing unit isready to accept your ROMs.
Modell4-D Same as Model14-E but includes ottractlve protective case andmounted Basic Swttch board.
Note that Model 14Series does not allow for expansion ROMs like the BASIC Pro-
grammer's Toolkit.Modell5-A The Basic Switch plus ... includes .expcnded cable assembly and
zero insertion force socket. Your 15th ~OM simply plugs in ...enabledwhile either ROM set isselected. SOCk'3t15may be readdressed bythe user for additional flexibility.
The Basic SwHch issold in assembled form only. All mccels are designed for easyattachment to your Pet with a convenient cable ossernbtv No soldering or drillingis required. The Basic Switch mates with a cable ossernblv at your primary board,and does not use ·the physical connectors of any PE~tports.
Model 15-A allows you to use the BASIC Programmer's Toolkit wi"thout "the need for
the additional $25.00 board or tying up your ports. And since we've designed
the 15th socket to bereaddressable, watch for mom ROM pacs later in the Fall.
The BaSic SwHch:
Modell4-E
Model 14·D
Model 15·A
S64.95
S77.95
$99.95
With installed ROMRetrofit Kit fromCommodore:
S149.95
S162.95
$.184.95
With BASICProgrammer's Ioolklt '
$149.95
Model15·A with installed ROM Retrofit and Basic Programmer's Toolkit: $229.95
Modell5-A with installed ROM Retrofit and both Toolkits: $274.95
"Old" Pets were shipped with 24 or 28 pin ROMs.You rnust check which you have,and specify at time of order.
The Basic Swttch 1M is a product of
SmaUSystem Services, Inc.900 Spring Gorden StreetGreensboro, North Carolina 27403"Telephone 919-272-4867
Pet1M isa trademark of Commodore BusinessMachines, Inc. of Santa Claro, Calif.The BASIC Programmer's Toolkit isa product of Palo Alto IC's,A Division of Nestar
Systems, Inc. North Carolina residents 6dd 4% sales tax. All orders odd $2.50 shipping.
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 66/68
Presents
Softw are and H ardw are for "our APPLE
SALES FORECAST provides the best forecast using the four
most popular forecasting techniques: linear regression, logtrend, power curve trend, and exponential smoothing. Neil D.
lipson's program uses artificial intelligence to determine thebest fit and displays all results for manual intervention. $9.95
CURVE FIT accepts any number of data points, distributed in
any fassion, and fits a curve to the set of points usinq log
curve fit, exponential curve fit, least squares, or a power curve
fit. It will compute the best fit or employ a specific type of fit,and display a graph of the result. By Dave Garson. $9.95
PERPETUAL CALENDAR may be used with or without aprinter. Apart from the usual calendar functions, it computes
the number of days between any two dates and displays suc-
cessive months in response to a single keystroke. Written byEd Hanley. $9.95
STARWARS is Bob Bishop's version of the original and best
game of intergallactic combat. You fire on the invader after
aligning his fighter in your crosshairs. This is a high resolutiongame, in full color, that uses the paddles. $9.95
ROCKET PILOT is an exciting game that simulates blasting offin a rocket ship. The rocket actually accelerates you up andover a mountain; but if you are not careful, you will run out of
sky. Bob Bishop's program changes the contour of the landevery time you play the game. $9.95
SPACE MAZE puts you in control of a rocket ship that youmust steer out of a maze using paddles or a joystick. It is a real
challenge, designed by Bob Bishop using high resolutiongraphics and full color. $9.95
MISSILE ANTI·MISSILE displays a target on the screen and a
three dimensional map of the United States. A hostile sub-marine appears and launches a pre-emptive nuclear attack
controlled by paddle 1. As soon as the hostile missile is fired,
the U.S. launches its anti-missile controlled by paddle O . DaveMoteles' program offers high resolution and many levels ofplay. $9.95
MORSE CODE helps you learn telegraphy by entering letters,words or sentences, in English, which are plotted on thescreen using dots and dashes. Ed Hanley's program also
generates sounds to match the screen display, at severaltransmission speed levels. $9.95
POLAR COORDINATE PLOT is a high resolution graphics
routine that displays five classic polar plots and also permits
the operator to enter his own equation. Dave Moteles' programwill plot the equation on a scaled grid and then flash a table of
data points required to construct a similar plot on paper. $9.95
UTILITY PACK 1 combines four versatile programs by Vince
Corsetti , for any memory conf igurat ion.
POSTAGE AND HANDLING
Please add $1.00 for the first item
and $.50 for each addit iona l item .
• Program s accepted for pub lica tion
• H ighest royalty paid
Int lqer to Applesoft conversion: Encounter only those
SYI tax errors unique to Applesoft after using this programto .onvert any Integer BASIC source.
• Di! k Append: Merge any two Integer BASIC sources into asir gle program on disk.
• Int lqer BASIC copy: Replicate an Integer BASIC program
fre TI one disk to another, as often as required, with a
sir gle keystroke.
• Ao nesott Update: Modify Applesoft on the disk to elimin·at e I he heading always produced when it is first run.
• Bir uy Copy: Automatically determines the length and
sts rinq address of a program while copying its binary filefre T, one disk to another in response to a single key·str rke. $9.95
BLOCK tl.DE lets two players compete by building walls to
obstruc t each other. An exciting game written in IntegerBASIC )l' Vince Corsetti. $9.95
TABLE 3ENERATOR forms shape tables with ease from direc-
tional \ ectors and adds additional information such as star-ting ad Iress, length and position of each shape. Murray Sum-
mers' f.oplesott program will save the shape table anywhere in
usable nemory. $9.95
OTHEL .0 may be played by one or two players and is similar
to ches s in strategy. Once a piece has been played, its color
may br reversed many times, and there are also suddenreverse; :JI luck. You can win with a single move. Vince Corset-ti's pro jrarn does all the work of keeping board details and
flippin~ pieces. $9.95
SINGLI DRIVE COPY is a special utility program, written byVince Corsetti in Integer BASIC, that will copy a diskette USing
only on 1drive. It is supplied on tape and should be leaded ontoa diske tie. It automatically adjusts for APPLE memory size
and sh: lid be used with DOS 3.2. $19.95
SAUCE R INVASION lets you defend the empire by shootingdown a flying saucer. You control your position with the pad-
dle wh IE~firing your missile at the invader. Written by BobBishop $9.95
HARDWARELIGHT 'EN with seven supporting routines. The light meter
takes ir tnnsitv readings every fraction of a second frem 0 to588. Th. light graph generates a display of light inteositv on
the scr ,en. The light pen connects points that have been
drawn c r the screen, in low or high resolution. and displaystheir cc ordinates. A special utility displays any number of
points cn the screen, for use in menu selection or games. andselects 1point when the light pen touches it. The package in-
cludes, light pen calculator and light pen TIC TAC TOE. Neil
D. lips, .n's programs use artificial intelligence and are notcontuse c by outside light. The hi-res light pen. only, requires
48K anc flOM card. $34.95TO ORDER
Send check or m oney order to:
P.O. B ox 273
Plym outh M eetin g, PA 19 462
PA residen ts add 6% sales tax.
U.S. and fore ign dealer an d d lstr lhum r inq uiries invited
All p rogram s require 16 K m em ory un less specified
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 67/68
305 Riverside Dri-ve. New York: N~Y. 1002-5
Quadruple your PET's graphic resolution. Why be
New Version stuck with the :~ET's cumbersome 25 x 40 1000 pointdisplay. With Graphics Pac you can directly control
(set and clear) 4000 points on screen. It's great for graphing, plotting, and gaming. GraphicsPac allows you to plot inany combination oftwomodes 4Quadrant graphing with (0,0) center
screen, and Standard graphing with (0,0) plotted inthe upper left hand corner. Completedocu-mentation shows howyou canmerge this useful routine with any ofyour ownprograms with-
out retyping either one! All this on a high quality Microsette for only $9.95.
A full featured assembler for your PETmicrocompu-ter that follows the standard set of 6502mnemonics.
Now you can take full advantage of the computingabilities ofyour PET.Store and load via tape, run through the SYSorUSR functions. List and
edit too with this powerful assembler. No other commercial PETassembler gives you all these
features plus the ability to look at thePET'S secret Basic ROMsall in one program. This valu-
able program is offered at $15.95.
An exciting flew simulation that puts you III
charge of a bicycle manufacturing empire. Juggleinflation, breakdowns, seasonal sales variations,
inventory, workers, prices, machines, and ad carnpatgns to keep your enterprise in theblack. Bike is dangerously addictive. Once you start a game you will not want to stop. To
allow you to take short rest breaks, Bike lets you store the data from your game on a tapeso you can continue where you left off next time you wish to play. Worth a million in fun,we'll offer BIKE at $9.95.
Dynamic usage of the PET's graphics featureswith sound! when combined with the fun of thenumber 1arcade
game equals a.naction packed video spectacle foryour computer. Bumpers. chutes. flippers, free balls, gates, a jackpot, and a little luckguarantee a great game for all. $9.95.
Give your PET a workout. This program reallyputs the PET'~:graphics to work. Super Doodle letsyou use the screen of your PET like a sketch pad.
Move a cursor in eight directions leaving a trail of any of the 256 charactrs the PET canproduce. New features include an erase key that automatically remembers your last fivemoves. a return to center key, and clear control. WllY waste any more paper, buy Super
Doodle for onlv $9.95.
Non stop excitement with a fast moving, highpaced version of your favorite video arcade racinggames. Shift up! Shift Down! Watch your gas, and
be careful on those hairpin turns. This dynamite tape has the two most common arcaderacing games specially adapted to run onyour PET computer. Driving Ace simulates anendless road packed with tight turns and gentle, but teasing, twists. Starting with fiftygallons of gas, how far can you go with a minimum of accidents? Grand Prix places youand your car on a crowded racing track. Race the clock and becareful steering· around thefast but packed Grand Prix track. $9.95
Dealer Rates On Request
Authors: Weoffer UNBEATABLE royalties
8/3/2019 Micro 6502 Journal September 1979
http://slidepdf.com/reader/full/micro-6502-journal-september-1979 68/68
Soft:\Narefor the APPLE II
THE PLANETS S15 !t5
1 J J1 ... -
~~
I...I ' . .. ..I.•n-... . ,. . .,. u"
. . . . .liN-(roi U.r:I.
,,. .... Ill'll! kt'lll " . : I C0III1IInc". . })I!
ACTIVE FILTERS $24.95
STATE CAPITALS
FORMAT
PROGRAMMA ' , FORMAT (Version H I)
IS a command oriented lex t processor de-
signed to be fully compatible With PI E(PROGRAMMA Improved Editor).
FORMAT ' s system of Imbedded commands
(within the textl give It an ease of ooer-
a non similar to text formatters found on
some min r - compu t e r s .
FO RMAT features right marq: n jusufr-
cation, centering, page numbering, and
auto- par agr aph Indent.
The following commands ar e available
With FORMAT:
.ad Beqin adjusting fight margms
.bp n Begin page numbered n
.b r Cause a line break
.ce n Center n ex t n lines without fill
.f Start filling output lines
.fo r Foot title becomes t
.he t Head tl tie becomes t
.in n Indent n spaces trom left margin
.I! n Literal, next n unes are text
,II n l.m e length including Indent IS n
.ls n Set line spacing to n
.ml n Top spacing Including head title
.m2 n Spacinq after heading title
,m3 n Spaci ng before foot nne
.m4 n Bottom spacing includ Ing foot [I tie
.na Stop adjusting right margins
.nl Stop filling output lines
.pl n Page length is n lin es
.pp n Begin paragraph; .sp, .I:.. tl n
.so n Space down n lines, except at top
.n n Temporary Indent of n
.ul n Underline next n input lines
All orders inctude 3% postage Jnd handling.
Apple II 1\ a registered trademark 01 Apple
Computer , tnc.
Californ.a resodents add 6% Sales TaxVISA & MASTERCHARGE accepted.
l' «( A un u))) i
Ire.fUI· • I'DII'I .0..·n
SAUCER WAR $15.95
CANTE R DOWN$ $15.95
BATTLESTAR I $15.9"
LUN AR LAND ER 59.95
l I U J