The transactor vol9 iss3

Page 1

Canada $4.25 USA $3.50

• Non-destructive windows on the C128 • Trouble-free 2400 Baud serial communication on the C64 • A DOS wedge for the C64 in ROM

• Far-Sys: execute machine code in any RAM area · An easy-to-build parallel printer interface for the C128 • Special centrespread bonus: GEOS label reference chart • Machine language routines for game programming • Serial 1/0 routines in Power C • All about the C128's BANK command

·Product Reviews: Z3PLUS for CP/M, JiffyDOS, SWL shortwave decoder, The ZR2 Hardware interfacing chip • Plus Regular columns by Todd Heimarck and Joel Rubin, Programming tips in Bits, and more

0

-

-- - -

Dreamtime by Wayne Schmidt


'IURBO

ROM H

''mll'n'm!{p~

flftl lla Jill a rttllctwa1 .., tiM amaJ brullulde

,.., M . n tFrl'w n,.rfu\

,....,.... rntta. .

.J

--••e ...

-.....,., .... "' I

.J llapft .... IXG ~ .,...,,.. 10-

,_j ~ AolcUorl .,. -

.J Rolin .. . J lltll'f .J ru IAil

Umolllllict oft

No ..... -'~~ 1ro ~~~· ..J ""' loll .... .J l'lllod 111 no ftllrmc ......wq ,.1 drOol I On ..,.,.1\h lilt lid 111111 ...., h•.. bl-rodl C!;Q -

ONLY SZ4.99 ,..---.;;n,r;.;..

DEEP SCAN BURST NIBBLER™

i:J Th•- -rful diU rubblfr a""U•I•If at1ywloort. ~ *'IY prtCe' :.J l!ur.t N1bblor 1111ll1Uillly •t"9(Nif\ IY'Iorn l Oo•l\ftf'l ,,.,...,. ... a pouallel O&hlt ~. aonni!CIIIoe IMI /IO?U 1571 kltl4 1£8(•"''"1:11'"1

u Wh&lllvtl """'' Nl~hlor 110 (l<•wor9 fi>hillhllufl&l nllolollf'lliAIII ~· d•a:·l•llo• d&l& rn.m Lho ~~··

t><I~Jnl II C&lllnln•lor II 11111114 tho l!llri.U ''"'' WhOII nron IIAnd&rd d&IA II lflOOIIlllered Lhoy aro belli Hurol Nibbler II'IU1olo111 li<IIA lUI MW OCR 1''•1• lllo Ull(o&ro.lloloat•ll WIUifHIIIIoo """" 1.0 doeo.•le 11. 10 ymo

,., a porfotl. GI•IJY

.......... , . . , ••u

• Woll nlhhlo lli>4n 41 r.r.u·kll • (loJOY ~ Wlorolt llook Ill llll~or amiiiUII!I • l'lllllnRiruOIIIIhl • llloi!UI" ll(l<IRIJll • • 1<1• \Vlllhlp IJII ~lliOOI • 1\t~•d Ill mlhiiii'J 110 Bllldoronf. 11111&1Jy l'e<jUI"'n e 1\•11 cr •1 1rMiuo • No nflll<I III I~I,Y IVlro.llol Ollhle If )'IU haw l'roiNalonaJ nos eta • Cah!o hu IJ11'<>1141h~lllo•Ulllllron lror I>Lhor IIA~lnno

n. t ill ......, ...lkll J AtbN;"-U•!III~II

tl~ I fl"'" ~

'lb.lli!liV ll4f alit lllllku-.. ~lk41!1

-~··

J Wil b•'!'Oit VI ,_...,,.. .,.,..,.,.,.,. tltlta~r llldili!utl UW Mill muWlbl*tr• kl Mf(U 4aflt.,t4

...,.... {,..;.llll4!lrfllilli, rllld N'IUN

...._,n lllllbiirtltll

.J hU ~tKWIDl'T\!1

= "". . . .... cu---b.,

....,,._._,

·~~~· ··~ lidE!nl Alllil.liiU'

~

.J lll!!l Ul:l Ml\ ....

r.-lll!l .....t.illll'-t.kt

~~l...W N ••,... U..

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

~t • • f'.lii ~,.

~=v+-zri!MI *re:&l1 ,._

itll &ill • • II II wi'IL.tiTU

~--.u-

.J I!ll W'il'roo • P llftiiiU ..,._ llte.i*t.t ,..,,_. ,.. ........

__ .,.I .J ~

ICfft

--

.J il!IIUICift .J ~

Qwu .... -.. •• -.... • •

-11 ..111-

-..

IGWI'M.,.. ..............

UIJ~II'WI•W..Uitlt~

....,._,...,.,

.., .• ' ' lltll.,_. ....... f~Wi&W ........

.J IM:IIIlll ~~- ...... _ .. _ ...... ll!2dJII U!h ~ llni:it• ..... .ad blf .... ,...1D4l hntw; Ullli * - JU"-. ....... MJI• ; ,, ,.,_.,.

'*'

1

,

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

ONLY

or Ull Ut'o«lfl&l

S14.99

ZHK SUPEROMEXPANDER

U N•JW J11U 11&11 111>1,1 &o11 aey of t 112X l l'lllllll

u 8 . . .... lelllOOIJI.U<"" l llliX l!l'llllll ln 11th .J Oa buud • ~>~1'11111C .,...,.

no

lnloM

p....,....

ON~ S39.99 COMPUI. SOPIUWI·ON~ S19.99 CA.UON~ BURST NIBBLER PARAME I ER DISK

.J ~ ,.., """ ll'IIOilt lllll1& IIIII' ,.I'IIDJ.l 1'1'~' U NIIIIOdltbawloodlor~

)1111

- · - - &!>al/11 . . , . . _ MDU

- ..

:.J ~~~~·~lid-• .J Nlr lllllll dtlwo.., - , . .J llollolllll' IleA Wlllor . . . . . U U111>1• ll'llilll ..-

........ 11\ll&.ill llulcor • allllllllr!l lba•lnln .......,.11'1101/J ( EI'Nlllbur!>oo

,.., fWll ~

roq-.-)

.J ~ 8'161

filii 'mM ll'llllllt

ONU'

$49.99

SMART CARl .J NOW YOU QAN IIAYI AI!2K CARTIUIWII

l'HM' YOU FIIOORAII IJKIIIAII TIIF.N A!1111 IJKIIIOUI ~ I!:IKI*"Nlo 11011

- l:oM\ery I>Mk1od ~I

Jut liP tDI YII&N (lllhh1m ~1-y) ~ Blmpl,y load lht ~1'141'11111 YT•II't<JIIII'I then nlok lhl nltrb '1'111 o~l'lrlf!C• thnn aciJI Ilka allOWCl'll'1.1'lf1Coand I!AII •~•n be MIIDUV8d

J Make yuur own oai'\J1dKhl

SAMPLER

.J ""'~ IU•~W' &11•1• 11 'j'OO" JilnOt•IILIIt ji:Lol•" UWl,r

lllilll!llmo'lfJ' ..114VI~u l,.llAl II•U.j, -~~!4,11fl•l111 J ...,...,illurnt1111 'MilWll'l'- tii.H lltin/Nfior11 ~~~ IIO<iUIIillllG

J Y l t•OIIIA. AOO~•'IIIfiiDfl

.J AfW Clf!l~ "!U~ . . .l>ll ..l<ti 11_.,_,. ~-Ad ' )

.J M~ ~ .. II$ f'lilaDlltll- Ml"i Will nvtll..wlftl

J...- jllll""" .... ~o; U lb Ill Mo IliUM lk.i. ,..... ,, 11{111"* .J . . . . IUiiiJtlt!UIN Jli!"IIAfl

ONLY

$89.99

; - - -,

EPROMMER

64TM

.J PUll cpeetl!caUon loiiDitnwrt.w a1 a ~Mlo

J II.IJJIIM .J loiiDI Ol1r

.j IIIDI TIIIIU lllmplllible w1UI 111011\ loladlnt 11101 .,IIWill'l

ONLY

$49.99

even 111111 Mr1.\YPBI, witlluuL U1o nand fur an J•lJ>I'Uin

0

EXTERNAl :t.S" DISK DRIVE

.............. ,__ .........

• tt ..Witt Jill •"' -.w.. • ,..,..,...~ .u:.

~....lillfiiAif . . . . . .......... ..,..._

ftnal~ • . . . a:.11 .. • """ •·~ e t Ill& tllh•r.Md Ml*lf e t:..at . _ IaLII a. JM~ 1t11 ,.~,~~ "-' 11-1 • no ill;lrW Nl ~

ou.,....,

ONLY U69.99 11NGU ONLY SZ99.99 DUAL

burner J Clan be JWitllhed ln/wi '11~ onl\waM~.

U 1102 alot open loP •flftollll pl'llgl·lllllmluc leahnilj\181

:J A ~·P quah\Y. lllif .. UIIIU'MII

1•11~nllr lor 1111 1141128

.J i'uJiy mtou drmn ••lllrlll'lihN'CilnJ!t

ONLY

SS9.99

i""U,.m&luio~llmiiOC .-.hnc ' n~

01 1•1111, 1111/lllt IUilpllCl\Y IWoelf il!:,l'"(riiiii'IIIMch.J4 lin Rlor

.J l'lla lnlo llll!r 1'01\ lilt MlimWII plllt>lll\r • 1111 IIONidCeo/a.1""011 ...... .., .J full ,....,.. QUa Ill f t - " " lnehrlt... do'llollllri wniJ .J We bll»w ~ M pnbanitft ~ ll1d llolll ftluo ... - . . , lll'(rlmll>l11~ Air lbo M /121.

•Uw-..,.

MIDI64

Sl9."

• wkiMI

~

.., . _ ......

~ dmlo(Jmln1Qraem. IUlUmtl

ujUdm II' llllllod IIIJ 1111\JM -

Jll'llllt:l .Jl i . - - - t r l l l lba~-

DUPLIKATOR

-... _.,_,.. i....-!---··J""PA....,••&u~M...--..IIr--­

u c......aeu. • ....,t.Utw •• w

~.-c.-.

.. -...,. .. ,_,

... Ill

~~..::':

,.,.

,,.

;J _ _ ... _

......... " " ' -

J fto _ _ _ _ , _ . . -

ON~

S69.99 COMfiU'TW

ONLY

$189.99

• J'\JII UtdJ lnlerf1101 for AMXJI'JnX)f 1000 ( l'leaA aiAI.I JDOdel) ()ompaUble w1&b moet load1n& Nidi ~ueee (Ina DI MU8lcl Mldlln MtdJ Out 1 3 Midi Thru Plllly Optn l&olaled/ rutl lliDI

e e e

ONLY

$59.99

011cte 1:14 on R•aclor llervk o eord

.&d4 $1.00 llhlppJaCJBnA!Ip' (IR'Il(lii/ MOD'f OIDD/OODI AOOiftiD

DATIL COMPUtERS 3430 I . !BOPJOAIIAAVIIUI, Ull't '8'7, U.S VIGAS, IV 89111


• 539 N. Wolf Rd. Wheeling, IL 60090 Hours- (Voice) Phone (312) 520-2540 Mon.-Thurs. 12:30-5:00, Sat. 12:00-4:00

MUSIC

CRER tc.

(24 Hour Order Recorder)

•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

.o~o you feel like no one Y car~s;b~~!,ys~ock u and your orphaned comput~r! and sell most major B ser•es NWM cares..

nd aooo series programs.

e

a

8000 9000 and B series models! ' Parts available for some

Commodore's Superpet 9000

One of a Kind • Surplus • Monthly Special • Closeouts l m•tH q~,t~ntot,.. 10 tiO ,.. o l'l•nd

&t k IHt to ps~raHtt bulltr' ••••• , , •• S let 00 ~ tOOCDt rttlab ••••• , •• , ••••• Jit 00 &41tram•rp~ , •••••••••• , • , $11000 $11\itrl Corona OM 200 ••••••••• , • J t 71 g~

&eOO I30I'lp

O~o~b'o

80'3p lnd MPP 1361 tobl'oOI"'I •• , • ,

only $19900

U 50

G080 ,. !; m10 '•"'nb ••• • , • , , • • S.. ~ 00

.

~,p flbbont

0

••••••••

0

while supplies last

"00

830 tt!)bon• • • • • • • • S• 9\

With Five Interpretive Languages:

•••••••••••••••••••••••••••••••••••••••

-,...,..,

Cobol P..cM

SUPER SPECIAL

~

Runt 8032 aoftware. Great for schools and students

64 K memory expansion for 8032 -with superbase 8096 both for only $125.00 -with superscript 8096 both for only $125.00

64K Memory Expansion for 8032 only $110 upgrades your 8032 to an 8096. COMMODORE 8000-9000 SOFTWARE & MISC.

8050 disk drive new $400.00

11000 Superpe1 ••••••••••••• $199 00 64K e•p tor 8032 •••••••••••••• S1 10 Database . . . . . . . . . . . . . . . . S~ BPI G-nolle<lger .••••••••••• , $~ BPI AcciS Payable •••••••••••••• S2!>

8050 disk drive rehab $200.00

BPI Accls Reeeovol>le •••••••••••• $~ BPIInvenlory •.••••••••••••••• S25

Superpet 9000 rehab $150.00

ozz

BPI Job Cos:l • • • . • • • • • • • • • • • • • $2'5

•••••••••••••••••••••••••••••••••••••••

$upetKrtpl 8032' • • ••••••••••• $79 Superba.M 8096 ••••••••••••••• S7i

Leg11 T1me Aec ••••••••••••••• $25 Oow Jones Ptogram •••••••••••• S25 Into Oesogno 8032 Accounung Syslem • • • • • • • • • • • • $50 Superottoce8096 ••••••••••..• $149

C.te Result 8032 ••••••••••••••• S89

•••••••••••••••••••••••

-

SFD 1001 1 Megabyte

PRICED AT $149.95 (US)

1

$125 woln purcnase ol Superpel

B-128 $99 u.s.

SF0·10C)1 iS thedr.ve lhll you lhOUkl COf\lldtr w hen you need llfgeamountt Ol date IIOfage.ll hOld.$ over 1 meoabyte of data on 1tttlngte floppy dnw F11t IEEE acctu tor your C·64 or C.128 (C-&Iancs

C·128 nMd an IEEE •ntertact ) Why . .nit tor a to wer Clri.,.l Wtth ..uatoraoecapacity Th .. driW'e ltOfea aubllllnliaJiy mo..-e prooramt end dill Think how much mon-v yo~,o~ cen NVt on drllt purch.IMJ, In

tact. rt 1torea almot:t 7 11mea moll •ntormahon than your tlandard dn..-e Buttet•n b<Mrd owNra love them And wh.atln •ntrOdUCIOryiMIC.iAI l l&l 95thttedtlv. . w111NIIII•I. tO don-, Wl•l Th••dnWihlt the idlnhtll rormet or • CB ~ 8250 dr•vt one of Commodorll motl cturebte flOppy dr•~

rehab

UW 121K USER INSTALL.AII~ IIEMORY f.XPANSIONI lH'TliOOUCTORY PRICE OF ONLY $125.

SOFTWARE FOR THE B-128111 C.A.B S Accounttng Superbele • • • • • • • • • • • • • • • • • ' 1 95

e

a-elle<!ger . . . . . . . . . . . . S 9 95

'19 9S

Accounts Aeee<vable •••••••• S 9 9!>

Supersctlpt •••••••••••••••••

1uperonoee lnlegtalld

Accoo.nll Poyabie • • • • • • • • • • • S 9 95

Su~ & $upet1Cr•P<

••••••• $49 9!>

Cek: Aelutt • • • • • • • • • • • • • • • • • $89 " '#t'otd RIIIU"I1

o •

$89 i5

.uper O.s:k Doc ••••••••••••••• 2• 9:5

Ordet En1ry ••••••••••••••• S 9 95

P•yton ••••••••

0

•••••••••

S 9.95

Buy 111 5tor only S:!4 95 SuperbeM The Boo!< •••••••••• S 14 95 Apphea Calc Retull (Boo~) •••••• St • 95

MODEL SFD-1001 DRIVES 1 HEADS/DRIVE 2 STORAGE CAPACITY (Per Unoll 1 06 M b Formatted MAXIMUM (Eeeh Onve) Sequenloal File 1 OS Mb Relalove Fole 1 04 Mb Doll< Syslem Buller RAM (Byles) 4K DISK FORMATS (Eeeh Dfo.,.) Cylinders (TrackS) (77)

Sector/Cylinder Seelor/Treek B)'IH!Seelor Fr" Bloc:ks TRANSFER RATES (Bytes/See) lnle<MI IEEE...88 Buo ACCESS TIM E ( M oiii·-O<I<It)

23-29 256 4 133

40 Kb

12 Kb

Traek~I~Ueek

..•

Average Ulek A-ege Ullency Speeo (RPM)

tOO 300

ORDER NOW WHILE STOCK LASTS!

"d.·

5eo'O "'ca ,..,.., or-.10 No<tltWHI llonlc C.n'-<. ""'~ Ul H Wott Whool.., ll - . J12·S . 2540 "'"'-"""'"'""''""''t.l~:,oo s.po ,.., soo•)SHI " s1· ·~e 1 •e 110•~ •O<Jo.S•6•59090 6114 ~ 4~ 64K "'*"'(Jfy e,.p.~~ns,.on. F01 a~ l•a•• tcld Sl ~ to '~~~' ~ lliAJ Sl (.,.,)tot eetl'\ ~ ~Of progr•rr canaoanlhpe.>II"QC.."*V"Ittt~U S For COO tCiol' lddS2.20pttbOx~ Alar~ mus,beprutii"US tundllndudepnono~oert-..;tth81NCOdl& OonotuMPO ~ · Of/llyUPSIItopoet' 2 .,.... "'Od • • be ""poNd on 11 orc;;H1 P'teed w.ch • plfiCW'a or bulineM Chfe:ll; cwaers ~POtd '"uS OtW'f arid cnt.n on ~Yff'f no cn.--k• 30 Oly watrlntyon "" P'OOucrs lr()r1 ftltiiY No mllk.lfatluftf .arraf'ly N'hM tiMf'W!'II"'ft tqu tO .tf'l'llt QUinll•fi'IIO IIOCk on hano anG lOW

c

eddreues A

..., tnouc nouce

Alt prie:H quoiN In Ul dolloll.


AMIOA • C-64 •

C-128 • conunodorc pes

·next. stop · •

With nnta7.lng computers. Stun11h1g 19oftware.

l,owerful peripheral... The World of Commodore l'l coming to capture your lmnginntlon. It'' the comp~ll<'lllhow for lw~lnnns and ha~kers, professlomtb .tnd t>tudt·nt '• hu~lnt's\ p1:ople und honw u~t'n.

Commod'*' llu§incss Mat hines .utd many other exhlhitof) will ch.. pby .tnd ~:~ell the AftiiGA, CM, Cl28, l 'C wrnputt'IS, 11 gal.•xy of softv:me for Commodore anti AMIGA l\JIIIputcrs nn<l .1 MliltcrinK wmtell;uion ol printt:r!l, di~k driws und dc!iktop puhhshlnK C4Uipmem. You \\ill llnJ per iph,'rliiS ,md' .11 (\!f>SWit>§ f"r ttll your present nnd luturc t•quipmcnt It'll computer he,wen. Stugc dcrnon~tnuinn5 und pro\'OCIIli\C semin.w1, pre!iente<.l hy top expert,, urc lnclu~lc<l with your ndmt~slon

1hrec d.tyli ''' h.ugain~. llclcltion, tnlonnatinn, excitement nnd pri7cs Sec 11 ~II\\ 1th

y• •ur llWil q

eN, Try it ull w1th } Qur o\\ n hands At the ~·ortd of Conumxlorc In l.os Angclc:;

May 19. 20 & 21, 1989 L.A. Convention Center

L

•\tlults $10 St\lltc:nts & Scnlon~ $8 r nllllln a(' 1 f\c"RC dc"''"'"nu1on' aro lucllld d \l.llh ud111l~~irm bh•bltors w.tatl Thl ftunter Group (41 6) 5'35·5906 Fa~ (416) 595·5093 Produced 1n mocl,111on with Cornrnodore Ouslnm M~chlne•


ONLY

$19.99

CaNTRONJCS PRINTDI UIAD Cl llli tulltdft"""" d - ""~!If I'IMl lit.l'\tldlo -·dump wllh IIlJa ..,......,. loo<l

Q CD-_, pori lo aey lllllllllr;.>n ICqlll'l!lo plnUt

ONLY

Sl8.99

0

SUPERCRUNCHER u ~ ._ .. ""' """#\IODIIel'loiJ .... 'IOlt"' p;wcl1\lf 110\1 .. dlM

- - llo&D Pl'fCl'UIIIIJ,."' .,.,,.and IJodinf- Clulftlll -

0011>1'0"1 Fn(raz:o ~

"'""~

ONLY

OBDEBS 1-800-788-9110 tn-

OBLY

JrO'llt- !'tchloaln •111 flklr tf lqali'J aaam 1M ......... Q lht t\01! n l hlln•IN!a

lrllllOIMd"'-

llr,llifl

S9.99

!ECBIICAL SUPPOll~ MORD.AY TBRU SATUllDAY 9am to Spm COSTOMBll SlllVICB PAOJI'IO TIME

(708) 484-7700

D'l'BA SRIPPJBG B.EQD.

OUTSmll OONTJDRTAL U.S.


Transactor

Volume 9, Issue 3

The Magazine tor Commodore Programmers

Pu bli~ her

Amon} Jacoh,on

\ice-President Operations Jeannie La\\ renee Vice-President Ad' erti\ing M<L\imwlian Jacob!-.on Al>~i.!otant

Ad,erti.,ing \ttanager Jul1c Calc

Keep-80

17

b> Richard Curcio A non-tle,trucll\e '' mdm\ mg 1echnique that u-.c' RA \I m the\ DC ch•p a' aux1hal) 'torage

Kernal++

20

b} WilJiam Coleman Add a DOS "'edge to your C64 -in R0\11!

Far-Sys for the C64 t<:ditoro; 'v1alcolm O'Brien

28

by Richard Curcio Exclulc machine language ca'>ily anywhere in the 64\ 1111:mor)

even in the dreaded

·o· block

t\ icl.. Sulli' an C'hri~

h1mam

C128 Parallel Printer Interface

32

by Bill Brier Contr ibuting \\riter' \.1anc Brengle Paul Bo-.acki Bill Brier AnLhon} Br~ ant Jo,eph Buck le~ Jim Buuerficltl William Coleman R1chard Curcio 'v1lklu~ Garamvegh} Ltrr} Ga} nicr

L -.c

J

regular parallel printer on your 1:28 '' ith thi' '>llllple U-.cr Pun intcrla~:c and pnntcr drn er

GEOS Label Names

40

Compiled by Francis G . Kostella Spcc1al centre~pread f.:alurc ·a hand) cro"·rcfercnl:c table for all GEOS a'-.cmbler labch

Gamemaker 's ML Grab-Bag

42

by Zoltan Hunt Programmmg game' tn assembler? Here\ a collection of 'hort rouune~ to make )OUr life c~icr

Tood llcimarcl.. '\dam 1-lcr'l

Robert lluchn George Hug Zohan Hunt Garry Kitial.. rranc1s Km.1ella Mil..c Mohdo D.J. Morri'\ Noel 'Jyman Adrian P~:ppcr SteH! Punier

Joel Ruh1n Da' d Sanner Sto:phcn Shcn ai' Audl)' 'vill..a-. \\'. ~tal \ <lite\ Co\Cr \ rti\t Wayne Schmidt

The BASIC 7.0 BANK Command

46

by D.J. Morriss What exactly doe~ the C l2!!'s BANK command do'! A lool.. oftcn-m•,undcr.tood command.

:u

tlw ROM~o rcvcah ;Ill the effec t' of th i'

REDATE

50

by Adam Herst Adam·~ late~t

CP/M uuhty

•~ a real com cniencc- never t}pl! •n the '}'Iem date agatn!

Serial I /0 in Power C

56

b) W. Mat Waites A comprchcn,i\c collection of ~rial l/0 funcunn' lor the C progr-.unmcr

Toward 2400

62

b) George Hug Rc.tl :!-tOO !lit pcr·M:cond communit:ation i' ca\y on the 6-1 "'llh tht:\e routine~. And unlike the Kemal\ RS B:! rourine,. the~e are bug-free


Transactors's phone numbet Is· ~~ 16) 71>4 5273 LJne open ~ays Wednesdays

and Fndays ONLY FAX 416)71>4 9262

TOLL·FREE OROER UHE 1-80Q.241-271t Extension 911 (!of orellA ooty .1\ave your VISA 01 Masle..:aro numl* a\lllilolble 11 111e U 5 only)

••adv

Departments and Columns Bits

7 Bit'fpunlc \Ohcd Datil Mouth Ahen Video

O)naborder Video Reset

Trw>UCDr 11 published bomonlnly oy Cto!Matd PublistWig Inc 86 10 WIISt Wolmol Streal, Ret> mond ~ ()o)laroo. L<t8 IK7 ISSN• 0838.0183 CenaciWl s-.d Class I.Uol Regostra110n No 7690 Galltway·MoMissau9a Ont USPS PO$!· """1'115 $end llddtess cnano- lo TrilllsactOI PO Bo• 338 SlabOn C. &ffalo NY. 14209 Croflward publsh nv Inc I• 1n no way connected w11h Commodore Business Mach1nes Lid or

The Edge Connection

10

Commodore lncorporaled Commodore and Commodore proouct names are regiStered uademari<S ot Commodore Inc. SubSCfiPIJOOS:

by Joel Rubin

Cllnada $19 Cdn USA$ 15 US AI others $21 us

Jod loob at \01111! mon: '"'cmblcr package~. a CP/\1 C compiler. di~cu,,c, 'ome bug' in lhc (i~;n CPU chipo.,, and more.

Aw Mal COverr.eas only) $40 US

Send all aubscnpllons to: Transactor, Sub-

sc 110110"" Department

The ML Column

14

by Todd Heimarck Todd Implement' the "voter..." progrJm fmm Sdcmijic Amc•rican in ML on the 64, and in the pnx:c'' cover... hi-re' graphic' prugramming and mndom number generation

Reviews Z3PLUS

69

Our loc<JI CP/M c:\pcn loob at thl\ e\leno.,ivc CP/\1 cnbanccment for the 128

JiffyDOS for the C64/C 128

72

This ROM chip set pmmi'e' compatibility, cunvcnicncc and suJXr 'Jl<!cd: as Noel rcpom, it deliver,.

SWL Short Wave decoding cartridge

76

Tum thoo.,e beep' and squl'nl\ in 'honwavc broadca\1' into readable le.\1 ~ ith SWL and a (w or VIC 20

The ZR2 Hardware Interfacing Chip

78

Control the world throu!!h )Our CM\ U\er pon with thi~ ver;mile interfacing IC

\ bout the co"er: Dn•cm11mw, b) Wa}ne Schmidt Wa} ne Sdmudt is our regular CO\ er artt't. creating the an\\ ork on the CM '' ith a varict) of ,oft\\ are. \\'a}nc explain' the \\or!.. as foiiO\v\: " Inspired b) the \\Ondcrful totcmtc tmagel) of the Aboriginal Auo.,tmliano.,, the ·Dream time· refer~ to a wre m} thtc state in \\ hich there ts a communion with the l:temal Sptnt and an c.o.pcricnce of visions that tmnscend all boundaric' of nonnal e'<perience and human limitation .. Thank' to Da' id Fo,lcr <II Read} Soh. \\hO ~upplied the RGB colour value~ 10 mmch 1he 64 ':-.colour 'ct.

85·10 West Wllmo• S!Teel R>dlmond H I Onlano. Canada l4B 1K7 14161 7'64 5273 For besl IIIIUII$, use lhe poslage paid e..rd lllle centre ol the magaz;ne Ouan~ly Orders.

tl c:.n.&o Ingram Software Lid 141 Adeuo Ori>e Corcoru Ontat>o L4K 'ZW'' t416) 738-1700 In ~'18 USA IPO Clntema·

honal PenodiCal l>Gtrobulors~ 11760-B Sorrenlo Val!oy Road San ()ego caYomoa. 92121 , 619) 481 5928 as!< lor Dave Bueschow EdolDn:ll conlr•bul.onl .,. -....,. Only 009""' • prlfviousty urtpUblahld matfOrial be c:onsouored Program hiJnO$ and andes ~ BITS S<lbmiSSIORS ol more 11\111 a r.... bnes II10Uid be provldO<I en <11$1< "'-'«•eel fonna! 11 I S.l.formal wl!h ASCII ..><t f - ~nuSC11Pls l!hoold be IYIM'wnt!trl do<Alle·SI*lld w \h $1Mt cia! clwa~ or IOfJTlal$ clea~y 0\afl<ed Pholos lhoUid be gloaay blad< and white ptlniS. llluszra. IIOOS lhOuld btl on whole paper wiUI black 1..._ only H1 •as graphics Illes on disk are p<efeneu 10 hardcopy lustrat ons ..n.., pos'"ble WNe to Transaaor s RIChmond H II off ce 1o obtarn a wrne<'IQUide

All m•t•n•l ~cceplud becomes the property ol Crotlward publshlng Inc., e><eepl by spec.al ar· rangemunt All male<tal iS copynght by Croltward pubi1Shtnv Inc. Repr0doct1on tn any form W•lhoUI perml•~•on Is In voolaloon of apphcable laws Wflte 10 1119 RIChmond H1ll adcl<esa for a Wflle<'s guide Th9 op.,oons expressed ., ccnlt1bullld attiCies .,. nol -.saarily 111ose ol Croltwa•d publishing Inc Mloough accuracy IS a major obi8CI•Ve, Croll wa•d publ shlng Inc camot as.sume ~l.:y for 8fl'0<8 10 arUC-1<15 oc proorams Programs losted on TtanS9CIO< ano or appeannv on Ttansac!Oidosl<s ;we eopynghl by ero~ ~~~ llUb'l¥1mQ Inc and may no1 be dupiiC<Ited 01 C)Slnbuled w<lhout pe<·

...

mission

PfOCIUCil<>n

ln~$8 "'"" Arnoga 2000 and

ProteSSicna!P-

F•nal OUIIXII by V - Pnnl & Grlllhlc $eNices Inc , T01cn1o Pnnbng Prmt41d 11 Caoeda by ol Canada tnc:.

eo-


Using ''VERIFIZER'' Transactor's foolp roof program entry method t • VERIF17f..R \hould be nm before 1yping in any long program from 1he page~ of 1ranwu wr. II v. ill let you ched. your work line by line a~ you enter Ihe progmm and catch fru~trating typing errors. The VLRIH/cR concept worb by di~playing a twoletter code for each program line: you can then check this code against the corresponding one in the printed program listing.

..weighted check~um technique"' that can be fooled if you try hard enough: transpo'>tng two '>ets of four character~> will produce the same report code, but thb will rarely happen. (VERII·tZtR could have been designed to be more complex, but the report code!o would need to be longer. and U!>ing it would be more trouble than checking the program manually). VERIFtZER ignores spaces so you may add or omit space., from the listed program at will (providing you don 'I splil up keywords!) Standard key word abbreviation'> {like nF instead of next) will not affect the VFRIFI/FR report code.

There are three vel"'\ion~ of VFRIFI7FR here: one each for the PET/CBM. VJC/C64. and C 128 compuler\. Enter rhe applicable program and RUN it. If you get a data or ched.sum error. re-check the program and keep trying until all goes well. You should SAVE the progr.un ~•nee you'll wam to use it every time you enter a progr.1m from Transauor. Once you've RUN the loader, remember to enter 'lEW to purge BASIC text space. Then tum \TRin7FR on \\-llh:

Technical info: VIC/CM \ fRIFIItR reside\ in the cas~eue buffer. so if y.ou're w.ing a data.\ctte be aware that tape operaLions can be dangerou., to its health. A':> far as compatibilit) with other utili tie\ goes. \TRift/fR '>houldn "t cau~e any. problems smce it work' through the BASIC warm start link and jumps to the original destinallon ot the hnk alter it 'c; finished. When disabled. it re,torc' the hnk to th origmal contenb.

SYS 63-l to enable 1he Pf·T /CBM veNon (otT: SYS 637) SYS 828 to enable 1he C64/VIC ver\ion {off: SYS 831) SYS 3072.1 10 enable I he C 128 ver..ion {off: SYS 3072.0)

PET/CBM VERIFIZER (BA IC 2.0 or 4.0)

Once VERtnZER i., on, every time you press RETURN on a program line a 1\.\-0 leiter report code v. ill appear on the lop left of the screen 10 rcver~o.e field. ole that these letters are in upperca~e and will appear as graphics charac1ers unless you are in upper/lowerca-.e mode (pres<. shifi/Commodore on C64/VIC).

IN

100:

ON lB CK EB HE OJ

I000 data 76, 138. 2. 120. 173, 163, 2, 133. 144 1010 data 173, 164. 2. 133, 145, 88, 96, 120. 165 1020 dara 145,201. 2. 240, 16, 141, 164, 2. 165 1030 data 144, 141. 163. 2. 169, 165. 131, 144. 169 I040 data 2. 133. 145. 88. 96. 85. 228. 165. 217 1050data 201. 13.208. 62. 165. 167.208. 58. 173 I060 data 254, I. 133. 251. 162. 0. 134. 253. 189 1070 data 0. 2. 168.201. 32.240. IS. 230.253 I080 data 165. 253. 41. 3. 133. 254. 32. 236. 2 1090data 198.254. 16.249.232.152.20!U29.165 II 00 data 25 I, -ll. 15 24 I05. IQl 141. 0. 128 1110 data 165, 25 I. 74. 74 74. 74. 24. 105. 193 1120data 141. I. 12X. lOX. IH 2.152. 24,10 1 11 30 data 25 I. 133. 25 I. 96

HC DH GK OG 10

Note: If a report code in the printed Iisting is mbsing (or '· --") it means we've edited that line at the last minute. changing the report code. llowever, this will only happen occasionally and usually only on REM \tatements. With VERIR/FR on, JU\t enter the program from the maga1ine normally. checkmg each report code after you press RETUR on a line. If the code doesn't match up wtth the leiters printed in the box bc'>tde the hst in g. you can re-check and correct the line. then tl) again. If~ ou v. i,h, you can LIST a range of line!>. then f) pc RETLR over each in succe~~ion v. hile checking the repon codes '" the) <lppcar. Once the program has been properly. emercd. he sure to tum \'FRIFI/ER off \Vith the SYS mdicated above helore y.ou do an) thing ehe.

JB

PA HE EL LA Kl EB

VERifi/ER \\ill catch trmhposllion error11 like POKE 52381.0 in!.tcad of POKE 53281,0. However, VtRII:-ILER use!> a Transactor

AF

10 rem* data loader for "\erilitcr 4.0" • 20 cs=O 30 for i=634 to 754: read a: poke i,a 40 cs=cs+a: next i 50: 60 if cs<> 15580 then pnnt"U*** data error*****": end 10 rem sys 634 80 end

Cl Ll

D~

4

----------------------------------------------

February 1989: Volume 9, Issue 3


VI C/C64 VERIFIZER

CB OK ON 01 OD PA BO

10 rem* data loader for "venllter" * I5 rem VIC/64 Vel"'. IOn 20 c~=O 30 for i--'828 to 958:read .t.poke i.a 40 C!>=CHa:next 1 SO: 60 if cs<>l4755 then print"' • data error*"'***": end 70 rem -;yc; 828 80 end I~ 100: EC IOOOdata• 76. 74. 1,165.251.141. 2. 3.165 EP 1010 data 252. 141. 3. 3, 96, 173, 3. 3, 201 OC 1020 data 3. 240, 17, I 33, 252. 173. 2. 3. 133 MN 1030data251,169. 99.141. 2. 3. 169. 3.141 MG 1040 data 3, 3, 96. 173,254. I, 133. 89, 162 OM I 050 data 0, 160, 0, 189. 0, 2, 240. 22, 20 I CA I060 datu 32, 240, 15, 133, 91. 200, I52, 41, 3 NG I 070 data 133. 90, 32. I K1. 3, 198. 90. 16. 249 OK 1080 data 232. 201!, 229, 56, 32.240.255. 169. 19 AN 1090 data 32.210,255. 169. 18. 32.210.255. 165 Gil 1100 data 89, 41, IS. 24. 105. 97. 32, 210.255 JC 1110 data 165. 89, 74, 74, 74. 74. 24. 105, 97 EP 1120 data 32,210,255, 169. 146. 32.210.255, 24 MH 1130 data 32, 240, 255, I08, 251. 0. 165, 91, 24 BH 1140datal01, 1!9,133. 89.96

KE Jf Ll BE DH GK FH KP AF

The Standard Transactor Program Generator If you type in programs from rhe magUJine. you might be able to ~ave your~clf o,omc work with the progmm liMed on thi!.

page. Since many program1> arc printed in the form of a BASIC ··program generator" which creates a machine language (or BASIC) program on disk, we have created a "~tandard generator" program that contain'> code common to all program generators. Just type this in once, and ~ave all that typing for every other program generator you enter! Once the program i~ typed in (ched. the Veriliter codes as usuaJ when entering it). <.,ave it on a di'>k for future use. Whenever you type in a program generator. the listing will refer to the standard generator. Load the "andard generator first, then type the lines from the li..,tmg a\ shown. The re~ulting program will include the genemtor code and be read) to run.

Cl 28 \ ERIFIZER (40 or 80 column mode)

r

When you run rhe ne" generator. 11 ""ill create a program on di'>k (the one de.,cribcd 111 the related an1cle). The generator program b just an ca') wa) for you to put a macltine language program on disk, u.,ing the ~tandard BASIC editor at your dispo~al. After the tile ha., been created, the generator is no longer needed. rhe standard generator, however, should be kept handy for future program generator\.

KL 100 rem sa\e"O:c 128 vfddr" .8 01 II 0 rem c-128 veri fi1er MO 120 rem bugs fixed: I) \\Ork\ in 80 column mode. DG 130 rem 2) 'Y~ 1072,0 no"" work\. KK 140 rem GH 150 rem by JOCI m. rub1n HG 160 rem * data loader for "veri liter c 128" IF I 70 rem * commodore c 128 ver~ion DG 180 rem* work~ in 40 or 80 column mode!!! EB 190 ch=O GC 200 for j=3072 to 3220: read x: poke j,x: ch=ch+x: next NK 210 ifch<>l8602then print "checksum error": stop BL 220 print "sy\ 3072.1 to enable DP 230 print '\y.., 3072,0 to d1~able AP 240end BA 250 data 170, 208. II. 165. 253, 141, 2. 3 MM260 data 165.254. 141. 3. 3, 96. 173. 3 AA 270 data 3. 20 I. 12. 240, 17. 133, 254, 173 FM 280 data 2. 3. 133.253. 169, 39, 141. .., IF 290data 1.169, 12.141, 3. 3, 96.169 FA 300 data 0, 141. 0, 2~5. 165. 22. 133.250 LC 310 data 162, 0, I()(). 0 I1!9. 0. 2. 20 I AJ 320 dar a 41!. 144. 7. 20 I. SH. 176. l 232 EC 330 dura 208. 242. 189. 0. 2. 2-W. 22. 20 I PI 340 data 32. 240. 15. 113. 252. 200. 152, 41 FF 350 dara 3. 133.251. 32. 141. 12, 198.251 DE 360 data 16, 249. 232, 208, 229. 56. 32.240 Transactor

370 data 255, 169. 19, 32.210,255, 169, 18 380 data 32, 210,255. 165, 250, 41, IS, 24 390 dara IOS, 193, 12, 210. 25~. 165, 250, 74 400 data 74. 74, 74. 24. 10~. 191, 12.210 410 data 255. 169. 146. 32. 210. 255. 24, 32 420 data 2-W. 255, I08. 253. 0. 165. 252, 24 430 data I0 I. 250, 133. 250. 96

The standard genermor Iis ted here will appear in every issue from now on (when nece~sary) a., a 1>tandard Transactor utility like Vcrifiter. MG EE LK KO EC FB DE CM

CH H\1 ~A

KD HE JL -. n .nr

MH IH 5

I00 rem transactor ~tandard program generator II 0 n$="fi len arne": rem name of program 120 nd=OOO: sa=OOOOO: ch=OOOOO 130 for i= I to nd: read x 140 ch=ch-\: next 150 if ch rhen print "data error": stop 160 print "data ok, now creating file.' 170 restore 180open 1.8.1,'"0:"+nS 190 hi=int(sa/256): lo=sa-256 h1 200 print# l.chr (lo)chrS(hi): 210 fori= I to nd: read x 220 pnnt# l.chr$(>. );: next 230 close I "> · ..prg '"'I _..,•o pnnt ol e " :n$ : '· create d ... " 250 print"tbis generator no longer needed." 260: February 1989: Volume 9, Issue 3


Not Fair!

Boy, am l ~teamed! Recently I was in a computer store in dov. ntown Toronto, waiting in line at the cash register. The CU'itomer in front of me wa purchasing G£•oPublish for the Apple. I was amazed to discover that the -.oftware is supplied on both 5.25" and 3.5" disks. What"s more, a sticker on the front of the package makes the proud boast that the software is- hold your breath - not copy-protected!

"official" operating ~y-.tcm? Was the copyprotection Commodore's idea? I expect that every regular GEOS user has been in-

convenienced, irritated or infuriated by the obstades put in the way of the legitimate user. I know I have. A friend of mine (who is not a GEOS user) once told me that a copy-protected operating systern was his definition of a useless thing. I can see his point and f'm sure that a lot of CP/M, Yes, you read that right. Apple GeoPubli h is not MS-DOS and AmigaDOS users wou ld concur. lt copy-protected. l guess Apple users will never just doesn't make sense. know the terrors of having only one boot disk. l wonder if they have serial numbers ... If you want people to use your operating system and if you want programmers to develop applicaWhy the special treatment for Apple users? tions to run in that environment, make it easy to Surely the vast majority of Berkeley Softworks' use. And 1 don't mean 'point and click' easy. customers are Commodore users. Don't they deserve the con!.ideration that is being hown to Ap- I don't mean to malign BSW or Commodore. I pie users? hn 't it partly as a result of the resound- just had to say something. Maybe one day copying succeso., of Commodore GEOS that ssw pro- protection will disappear. Sigh .... duced GEOS for the Apple? Why is Commodore GEOS copy-protected? Is it because GEOS is an Malcolm D. O'Brien

Transactor

6

F•bruary 1989: Volume 9, Issue 3


I

s

I

Gnt em uucre.wng programming tip, a .fltort rowint•. or an lln/..110\1'11 b11 of Commodore tnna) Send it in- if we IIH! it in rile ba.s column. we'll credit youtntlte colunm a11d send wm a free one-year .subscription to frmmtc tm:

Bits puzzle solved

Lie~

In Volume R Issue 5, we J)O\Cd what we thought was a difficult challenge - the following 'imple program wa<; pre<>ented:

in the fac t that 11 contain~ ~clf-modtfying routines. To make it compatible with both the 64 and the 128 (40 column screen), this version i-. loaded at $3000 ( 12288). Enable with ·sys 12288' and disable with 'sys 12493 ·. The ~ource code for Dynabordcr follows:

1 print " * ";: poke NUM,O ...and the challenge "'a\ cau~e the program to fill didn't offer any pri7e for fered a free hit'> book ro ~econd solution.

to find what value of M M -would the entire ~creen "'ith ~tcrish. We the \Oiution. but half in jeM. we ofanyone who could come up with a

JL

1000 sya700

BD

1010 1020 1030 1040

BA

EO LL AO ltJ

Well. it "''"n 't too long before \\C received the fir..t <;olution from Rand)' Thomp,un of Green'>boro. Nonh Carolina. Randy·~ an-.\\.er "'a' the one \\e ex~cted: "Simpl) POKE a zero into the low b)'te of 8\SIC'\ TXTPTR ($7A-S78) lO re~et CIIRGET." We J...ne"' of no other solution. but still promised a free bits book to an)'one ""ho could come up with one. Well. 'urpnse 1 Jim Bond of SpoJ...ane. Wa.,hington recently \Ubmitted an arttcle. and along with it the following solution if we would al low tt:

1 print '' * '';: poke 2069 , 138 : Using ' 138' (and the extra colon) instead of 0 is a slight cheat, bur the solution is tngenious enough, and considering we didn' t think there even ll'll.\ one, we're giving Jim recognition (and the btts book) for the -.econd solution. It works by adding a RUN token to the end of the program. modifying Itself to J...eep running over and over again. printing an a.\lemJ... each time. Ju\1 goe~ to l>how that \\.here there\ a\\ ill. there·~ a poJ...c! Oynaborder Jean-h e~ Lemieu'\, Rimou<;ki, Quebec

It,.,

an mterrupt"D)naborder" '>land-, lor "d}namic border". dnven program that u'e' the ra,ter line rega,ter.. to enhance the ~creen border '~ llh a d}namic rainbo\\ of colour... It can offer a bit of animation to your MSIC or machine language program. c'pcciall)' during un tf'PU'l. lt~ ~honness (215 bytes)

GJ

OJt GF

GJ CB ED NG AL

, ; ; ;

* *

*

*

dynaborder * pal aource cod e * by jea n-yv e a l emieux * r imou aki (q c) dec 88 *

1050 ; ************************

1060 1070 1080 1090 1100 1110

; . opt

.

00

' tem irqold irqvec 1120 r a ah i 1130 raalo 11 40 irr 1150 imr 11 60 bcol 1170 icr 1180 •.

•$254 •$257 •$314 •$dOll •Sd012 •Sd019 •$d0la =$d 020 •$d c0d

, t . .porary atoraqe ; irq vector ; ra1ter line ; reqiatera ; int requeat req ; int . maalt req

OJt EH ;border color NG ; int . c ntrl r e q CB • HI 1190 *•$3000 GC 1 200 . ' OF 1210 a ei CL 1220 lda irqvec ; prepare new OF 1230 l.dy irqvec +l ; interrupt EC 1240 ata .lrqol d ; p r ocedure I!:J 1250 aty irqold+1 1260 LN l da l <newirq BE 1270 ldy l >newirq 1280 di AJ: ata i r qvec FN 1290 aty i r qvec+l CJt 1300 eli CG 1310 lda 11 ; enable r a at e r NN 1320 ata imr ;l1.ne inter rupt EL 1330 ata irr .rese t irr EF 1340 lda l $1b ;clear r aater MJ 1350 ata raahi ; compare b i t (8)

L__T_ro_n_s_o_c_to_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ___::._ .!....:,; l989: Volume 9, Issue 3 7 _ _ _ _ _ _ _ _ _ _ __;,F.:•::b~ru:;o=ry


r CP

1360

1da f$7f

; clear irq

AB

1940

inx

00

1370

ata i c r

; flag bit

KE

1950

cpx l$16

HI

1380

lda 1$00

JD

MB

1390

sta tem

; prepare

JN

1960 1970

bna cirq inc tem+2

DO

1400

sta tem+2

;self-modifying

CG

1980

beq cirq

NL

1410

lda 1$05

, routine

FG

1990 r1

ldx tem+l

AN

1420

ata tem+1

GE

2000

c1c

BB

1430

lda l$d7

OL

2010

lda n6+1

CH

1440

ata n6+1

J1l.

2020

adc l$04

GJ

1450

rts

AB

2030

ata n6+1

ICC

1460 ;

PIC

2040

dax

ON

OJ

2050

bna cirq

00

1470 newirq •• 1480 ; •

OA

2060

dec tem+2

RIC

1490

lda 1$32

; fl.rst interrupt

HJ:

2070 :

IM

1500

sta raslo

; at line 50

JO

CD

1510

ldx

; reaet

AIC

2080 cirq • • 2090 ;

rK

1520

atx irr

; register

EN

2100

stx tem+1

FE

1530

ldy

BJ

2110

lda 1$30

; next raster line

HM

1540 n1

adc 112

;if a raster line

MG

2120

sta raslo

; interrupt

AE

1550 n2

cmp raslo

;has been reached

PO

2130

MF

1560

bna n2

; we display

FO

2140

lda u sta irr

IIC

1570

stx bcol

; a color stripe

MG

2150

jmp (irqold)

DI

1580 n3

inx

GO

II

1590

DE

1600 n4

adc tam+l cmp raslo

CI

1610

bna n4

IA

2160 disable • * 2110 aei 2180 1da irqo1d 2190 1dy irqo1d+l

OR

1620

sty bcol

JC

2200

ID

1630 n5

cpx l$05

ICJ

1640

bna nl

GO

1650

bit tam

DB

1660

bva rest

MP

1670

HC

1680

KB

u tO

; separated by

DB HN

; a black line

; continue irq

jmp di

The foliO\\ mg program j, <1 generator for 'd}naborder.obf. Once thJ\ fil e '' created hy the progrJm below. load 11 and execute it like thi ...: ; modify prior

1oad"dynabordar . obj ", 8 , 1

1690

ldx 10 atx n5+1

; routine

sya 12288

NJ

1700

ldx l$ca

; ' dax ' opcode

EG

atx n3

NL

1110 1120 n6

lda l$00

CG

1730

ata raslo

FB

1140

ldx

LL

1150

stx irr

IA

1760

JD

1770

dec tam ldx 14

AO

1000 data 120 , 173,

GC

1780

bna n1

AJ

1010 data

EH

1790 ;

DL

1800 rest

PA

1810 :

OM

1820

lda l$a8

AI

1830

FC

ICG

100 rem

generator for " DynaBorder . ob) "

; display bottom

EL

110 n$=" DynaBorder . obj ": rem

, rainbow

AD

120 nd=215 . aa• 12288 : ch•22654

nama of program

u (for line!. 130-260, 1.ec the Manda n t generator on page 5) 20,

81 ,

3 , 172 , 88 ,

21,

3, 1 41

2 , 169,

61 , 160

GP

2. 1 40' 1020 data 48, 141, 20, 1, 141, 1030 data 169,

NE

1040 data 169,

FE

1050 data

27 , 141, 13, 220 , 169,

sta n3

JI

1060 data

86 ,

1840

lda IS

CH

ICF

1850

ata n5+1

BR

1070 data 215 , 141 , 115, 1080 data 18 , 208 , 162 ,

BJ

1860

inc tem

LD

1090 data

IT

1870

lda tem+2

OJ

DIC

1880

beq r1

AIC

OP

1890

sec

; modify raster

CH

18 , 208 , 208 , 251 2 , 205 , 1100 data 142 , 32 , 208 , 232 , 109, 85, 2 , 205 1110 data 18 , 208 , 208 , 251 , 140 , 32 , 208 , 224 1120 data 5 , 208 , 230 , 44 , 84 , 2 , 112 , 27

IB

1900

lda n6+1

, line value

HB

1130 data 162 ,

JH

1910

abc 14

BL

1140 data

CIC

1920

ata n6+1

PH

1150 data

AJ

1930

ldx tem+1

LJ

1160 data

Transactor

liD

•*

; restore newirq routine ; ' inx ' opcode

; and stripe width

8

2 , 169,

3, 88 26 , 208 , 141 , 25 , 208 17, 208 , 169, 127, 141 3 , 140 ,

0 ' 141 '

21 ,

84, 85 ,

5 . 141 ' 48 , 96 , 169, 1 , 142,

2, 141 2, 169 50, 141

25 , 208 , 160

0 , 105,

96 , 48 , 162 , 202, 142 0 , 142 , 83 , 48 , 169, 0 , 141 , 18, 208 , 162 25 , 208 , 206 , 84 , 2 , 162 1 ' 142 ' 4 , 208 , 198 , 169, 232 , 141 , 83, 48

February 1989; Volume 9, Issue 3

,


Cl

1170 data 169,

5, 141,

NM

1180 data 173,

NM

1190 data

HI

1200 data

2, 232, 224,

08

1210 data

2, 240,

NN GO JC MC IC

1220 data 115,

48 , 105,

1230 data 208,

3, 206,

1240 data 169,

48 , 141,

86,

48 , 233,

96,

2, 240,

48 , 238, 22,

• • 141, 115, 22 , 208,

18, 174 ,

85,

84,

h2=~nt(x2/256) ·

2 56, 173, 115

IG

150

12•x2-256* h2

BL

160 h3=int(x/256)

48 , 174,

85

GF

170 qoaub 230

23, 238,

86

OD' 180 print"tap reatore to reset video"

190 poke ml+1,11 : poke m1+3,h1

2

1 , 1 41

JG

220

RJ

230 read a : i t a•-1 then return

IM

240 poke x , a : x•x+1: qoto 230

BX

250 data 169, 128, 162, 192, 141,

PL LP

260 data 270 data

CB

280 data 169,

I recently d1~covered an amazingly useful method for checking

RF

290 data 169,

data \tatements (espec1ally long ones). Remember S.A.M.? For anyone with the Software Automatic Mouth, datachecking become~ a breete! Simply load up S.A.M., then load in the data you want to checJ..., and add these lines:

CI

300 data

24, 208 , 169, 200, 141,

LG

310 data

27, 141,

aD

320 data 221, 160,

DE

330 data 216, 153,

1250 data 1260 data

25, 208, 108, 2 , 172,

24, 173

4 , 1 41, 115,

48 , 202

2, 142,

18, 208, 169, 87,

88,

2,

85,

2, 120, 173, 76,

17,

87

48

Data Mouth Andrew Milhm, Asbesto~, Quebec

LR

1 poke 53265,peek(53265) and 239

EX

2

3 read x: x$=str$(x) : aay x$ 4 qet a$: i t a$="" then 3 5 qet b$: i t b$="" then 5 6 goto 3

Ever have your BASIC program bomb out wh1le in hi-res mode"! Can't see the error me,sage showing line number that cau,ed the error. can you'! With this program, you just have to tap the RESTORE key by it~cll· and voila! -the ~creen is restored to text mode without being cleared. Sound and '>prites are turned off. too. It doe~n't Mop a running progmm. but don't u~ ll during disk operation'>. The program works b)' intercepting the NMI vector- an NMl IS generated when the RF~'iTORF key is pressed. It also redirects the 'error message link' vector at $0300 to re-install itself in ca~e a RUN/STOP-RESTORE or another operation restores the NMI vector bacb. to normal. To disable it, u~e the two ROM routine' ·sys 58451: ~Y'> 64789".

DB

110 ml=SOOOO: rem atart addresa

MO

120

08

130 xsml : x1cx+21 : x2•x+95

OE

140 h1•int(x1/256): 11•x1-256*h1

Transactor

210 poke m1+99,13 : poke ml+100,h3

•Y• ml: end

25 ,

24,

3, 142

3, 169, 202, 162, 192, 1 41,

3, 142,

1,

6, 141,

3,

96 ,

72, 152,

0 72

32, 208, 141 ,

33, 208

2 , 169,

23, 141

1 4 , 1 41 , 134,

22 , 208, 169

17, 208, 169, 199, 141, 0, 173, 134,

0

2 , 153,

0 0 , 218, 153

0. 217' 153, 340 data 0, 219, 200, 208, 241, 1 40, 21, 208 350 data 152, 153, 0, 212, 200, 192, 25, 208 360 data 248 , 104 , 168, 104, 76, 71, 254, 72

CJ

370 data 138,

FC

380 data

72,

32,

76, 139, 227,

0, 192 , 104 , 170, 104 -1

Alien Video b a machine language program that i' insmlled through BASIC, and i~ totally relocatable. JuM change the number in line lO to whatever address you'd like the ML to re!>ide at. After running the program, you'll be informed of the SYS to use to start Alien Video. When running, prc~s any key to ~ top it. Besides a rather wild video display, the program produce\ some truly unusual sound effects.

Video Reset Jim Bond, Spokane Washington

100 rem video reaet - re1ocatable

200 poke ml+11,12 : poke ml+13,h2

Alien Video Brian Spencer, Barrie, Ontario

S.A.M. will recite your numerical data (including decimals) so that you can easily follov. along with your printed liMing and compare. To pause (that S.A.M. is relentless! ). pres~ any key. and press any key to stan up again. Note that line I turns off the ~creen to eliminate the mllatmg visual na~h. When done. hit RUNISTOP-RESTORF to return to normal. I'm sure this trick IS ea!>ily modi lied for other ~oft ware mouth~.

XC

,I '

EP IO IF

2,

86,

'

: 13-x-256* h3

MA

10 re111 alien video

JI

20 aa•828

CM

30 for

AM

40 read d: poke i,d: next i

FB 8M

50 print " * sya";aa ;" to start *" 60 data 169, 11, 141 , 17, 208, 169,

15, 141

EF

70 data

13,

DC

80 data 208, 157,

DG

90 data

i~aa

to aa+31

24, 212, 162, 32, 208,

23, 165, 162,

18

0, 212, 202, 208, 245, 141 32, 228, 255, 240, 235,

0

How wa' the video made? At full speed. the machine language reads memory location $a2 ( 162), performs a logical OR with memory location $d012 (53266), and stores the final result in the SID (sound) chip registers. It is reading from two con\tantly changing memory locations: $a2 is the least significant b} te m the 64's jiffy clocJ..., and $dO 12 is the lower eight bits of 1he current screen line of the raster beam. The effect is a l>trange. alien-like sound. The visual pan of the v1deo is created by Moring the san1e resulting byte to the screen border location ($d020, 53280); since the main display was turned off by a write to $dOl I. this affects the whole screen. That's all there IS to 11! Simple? Absolutely. 11 9

February 1989: Volume 9, Issue 3

i


The Edge Connection CP/M C, n1ore assemblers, CPU bugs and drive tips b) J oel Rubin CP/\.1 programmer Lcor L.olman put a classilicd ad in the

November ·xx ux;HOR\ offering hi' nns C compiler package for $90 !L'Sl for the hN COp) and 50 for each additional cop}. Pre~umably. the idea i'> to order through a u-.er\ · group. You get the source code for a full-~creen editor. debugger. >.modem-compatible tclecommunicatiom. program (will it work on the C 128?) and -.tandard 1/0 librar}. A fe\\ years ago I did ...orne programmmg on a muhi-Zt!O \1P~I ~y<.tem and had access to borh BDS C and Aztec C from Manx. I found ALtec to be clo~er to the Un1x/K&R standard (especially when it came to m.ing lite~); but. onc.:e I gotu\ed to BDS. I found it ea~­ ler to work w11h. BD Soft\\are I'> at P.O. Box 216X. Cambridge. \1A 02238. (617) 576-3828. (I think the ;ip code '>hou1d be 02138 not 0223X.) Mr. Zolman takes check, VISA or Ma,tcr Card. Be sure to t.pccify di~k format or you might get the old CP \1 default fonnat - 8" single den-.it)!

packages - Commodore·~ own DevPak for the Cl28 and Geoprogrammer.

I

Some Commodore developers prefer to do their de~elopment on other machines and then download. Berkeley Softwork~ credits ih u-.e of sophi.,ticated eros~ development tools for much of II'> succel>s. Others. such a-. Enc Ro..,en/\~eig. who wrote the PTD-6510 debugger for Pterodactyl. sa} that programming on the object machine helps you to get w..cd to the machine and progmm around its weak points. To quote Mr. Ro1.cnn\e1g. writing m the September 1984 edition of the newsletter put out b} the Programmer\, Shop. (!100 421 -8006 - l don't know if they ... el l anything for !!-bit Commodore computer1. in 198!!) ··Programming on a btg machine and downloading to a -.muller or \lower one results in a program being written for a big machine that runs slow and large \\hen put on the target machine.··

S~aking

of the FOGf/OR.\, FOG, the one lime Hr-.~ O<,borne Group, which wpport1. CP/\1, MS-DOS. and (soon) the Mac. is rJi,ing ih due~ on ew Year'1. Da}. You can order up to five ~can, of membcr~hip for S25 (or SM 1f you want both CP/\1 and MS-DOS publications) through 1988. (Thel>e are going up to $30 and $52.50, respectively.) There b a surcharge of $12 per year per publication if you live in Canada or Mexico or if ) ou live m the U.S. and ,.,ant first class delivery. FOG il> at 210 Lakeshtre. P.O. Box 3474. Daly C11y. CA 94015 0474, or. 1f you want to join by VISA or Master Card, you can phone (415) 755-2000. Monday through Friday. 1000 to 1730 Pacific Ttme. They also have a tarter d"k for $4. modem dt~k (specif> setup> for $4. and a three-d1sk catalog ~ct for $10. The catalog ~et includes CP/\1 and MS DOS programl> and data file~ and i~ only available in Osborne oo or 360K MS·DOS format~. l f paying by card you\\ ill get charged S I shipping per $25 merchandise.

Now, we have some programmers using the cro~s­ development method who are so enamoured of thetr maintrame-ba~ed programming tools that they have attempted to pon their tool' to the object machine. DevPak 128 and Ceoprogrammer each have many fine features. but they run slow and large when put on the target machine. De' Pak 128 ($50 U.S. from Commodore Business Machines. 1200 Wilson Drive. West Chester. PA 19380) is extremely disk intensive. First, you edit the source lile. using either the EDT editor whtch comes with the package, or, if you don't want to learn new ednmg command<>, an) v. ord processor which can save PETSCII text files 10 disk. Then. you load the assembler which creates files similar 10 (but nol the c;ame as) Intel Hex Files. Finall). you boot the loader. whtch read., the hex files into memo!) as binary code. and sa\c the code to tlt~k. using the C 128\ monitor. The loader can load the he>. Iiies into another pan of memory if necessary - for example, if the binary image and the loader ihclf conflict. (Cinemawarc's Warp Speed cartndge help~ in this case a' its monitor conrains a ··-.ave u~ing another load address" direcuve.)

One more Ct>/\1 note: There is an error on page 6X4 of the Commodore 128 Pro!(rammer's Rej(•renre Guide. TYPF should be XDPH 1 and 1.;\IIT li.DPH-2; not reversed as the) are. This i~ correct in the DRI Sysuwn Gwde but 11\ ... ome\\ hat conful>ingC'I:IT and TYPE are ~hov. n a~ lhe low b)te and high byte. re'>pectively. of a word at XDPII-2. and. except in Motorola-land, the low byte of a word is at the lower address.

The EDT editor. ported from a Digital Equipment mainframe. includes most of\\ hat you mtght \\ant in a programmer·~ edttor. except. perhaps. for -.pi it-screen two file editing. and editor macro commands. It can handle file~ in PETSCII or ASCII, \\ ith

Since I v. rote a compari~on of Merlin 128. Buddy and l.\ DS in Transacwr 9:2, I have seen two more 6502 assembler Transactor

10

February 1989: Volume 9, Issue 3

'


line lengths up to 255 characters. and can convert bl!t\\CCn the two. If you want to t)pc in long ll'ts of numbers \\ tth the numeric 1-.eypad. you wi II lind. to your chagrin. that Fnr uses the numeric ke) pad for commands.

you to paste tn pictures. and geot\.\lembler allo\\' )OU to defane icons or other bit pattem!. u~ing thi:.. Of coun.c. therc'l> alway<> l nt GmhhN. which convert\ a tile from another word proces\Or to geoWrite format.

The a..sembler h a full macro a\\embler. I think tt " po"ible to \\rite a macro package to allo\\ thl\ as~emblcr to u~e 8080 or Z80 op-codcs, in some fom1, ~imilar to .16502.11h on the CP \1 extras dis~. in ca'e you "tsh to write mi\cd 6502/Z80 program\ for the C' 128. but no \uch macro pad:age " includ ed. One feature \\htch I missed \\as an ·oft\et' -type p<.eudoop. Let\ 1>a)' that you are gomg to \\ nte code at one add res., \\ htch will be moved to another address (or downloaded to di'>k RAM) ocfore it is run. You would like to as:.cmblc so that your address reference:. (e.g. tn a JSR) refer to the running addre'' rather than to the origmal loading addre~~. Some a~:.em­ hler-. allo\\ you to do thts, but De\ Pak \\on't- you either have to <w.emble the oft\et code separately, or add the offset to all the addre% references.

Gt•n h.~emh/er " a macro J.\\embler I don't thin!- ito. macro

With De,Pak. you abo get the ..ource code for file compressors. C6.t f~t loaders. and the DOS for the RA \t expande~. There are abo \Ome utilitie!>. !>uch ;~..,a C6.t-mode sprite editor. The manual includes a discus,ion of \ome RO~t dtfferencc!. in R bit Commodore equipment. including the SX-M. The di!.cu!.\1011 of the ne\\ 1571 ROM. and the 1541 C and 154 I II RO'vh \Ound., as tf Commodore think\ they have finally ex term mated the ...ave-with-replace bug.

The he,t feature ol the Geoprogrammer package .., genDehu~~er. but to U\C the debugger m th full glof) reqmres that you ha' e a RA \1 f:xpansion Lntt Ynu can ~mglc \tep. or smgle ~tep at the Lop level and execute \uhroutinc:. at full speed, set break poin t~. and pcrfonn all the usu~t l monitor function~. If )OU have an REL. you can define debugger macro' or rl!fer to locations in symbolic terms. The Gcoprogrammcr manual b a huge beast, and " somewhat dl\organized. but contatn\ vet') uselul informatton on programming under GFOS. Geoprogrammer 's advantages far outwetgh tts dbadvantage' if you are \\ riting programs that are to run under Cif.OS However. \\ hilc it can a\\cmble non-GEOS prognum. I thtn~ th<\1 other a,scmbler!> ''ill do the job with far b~ ha..,.,lc aml probabl) more ... peed.

The manual i~ more a ~piml-bound collection ol unrelated papcrl> than a manual. Some of the paper~. such as the tl\sembler in\tntction~. arc \\ell-wriuen and dearl)' printed. l lowcver. \Ome of the program ltsting\ \ecm to ha\e been pnnted on a 1525, or simtlar low-quality dot matnx printer Stnce these program listing~ arc on disk, you don' t need thetr li\ting. In ca\e you don't ~nO\\ which way the wind is blowing, the manual cover has the \\Ord · Amiga · twice a!> large a' the word 'Commodore·.

language has quatc the (lO\\er of De\ Pak ·,. but, on the other hand, geoAssemh/er can compute very complex 16-htt arithmetic<\! expre1>~ions U\ing a C-likc \}OW~. GeoLin/..1'1 combine\ the .ref ltle' and turns them tnto a regular Commodore program. a GEOS sequential program. or a GEOS \ 1 IR progr.un wtth a resident module and. po.,\lhly. overla) module\. One nacc feature ol geol in/..er i~ thut if ftlcs A and B create global lahcls with the \ame name. you will not get an error unles' file C tries to acce'' that name <l\ a Random e~ternal lahel (or ma)bc it alJO\\s you 10 be ~loppier than you should bl!>. Wh1le ~I'IIA11embler and ~~·oLin/..er do create. tf ncce">ary. error file~. and geoLw/..n create~ a \)tnbol file. neither one create~ lt'ting files,\\ hich can be a pain.

Geoprogrammcr can be purchased directly from Berkeley Soft\\Ork<o (Grettt We,tem Building, 2150 Shattuck Ave .. Penthou,e. Berkeley. C-\ 94704) for 69.95 plu-. 'H .50 'htpping plu.., $.t.90 \ale., tax in Califomta. or through the U\Ual retail outlet\.

The main problem with DevPak t~ itt. disk intensivencs~ for even the most minor programming task. (All as~embler~ running on a C 128 are going to become di~k intensive if you try to \\rite a 60K program.) If you use it with a ~mgle 1571 or I541, you are goang to find ) our..elf quickly running into the ltmtl\ on the numbl!r of open file'> caused b) the hmtted dtsk Rt\\.1. and, indeed. the assembler \\ill warn you of that fact. Thus. if you want to include a li le of often-used macros aJld often-used equatCl\. and get both a li!.ting and object file. you may have to repeat the assembly t\\ icc.

l

Recently, in looking over some machine language reference books. l noticed that se\ era! of them do not mentton ye olde J\1P-indirect bug mcluding the C 12R Programma'.\ Reference Gwde. (f:ven though the hug cloes exist on the 8502!) In ca'>e you· re learning 6502 programming and haven't run into it. here's the problem: Ordtn.trily. you expcu J\1P ('ector) to load the P<. with peek(\'ector) + 256 pecl-(\ector+l ).1/owl'\'el. tf \edor ts on a page boundary. for example Sl Kll. you will get pee~(' ectOr) + 256 * peek(int(vcctor/256) * 256)). Thur., if SJKrr contains liZD and St800 contains S-IF and SI'XlO contains \~C'. then J\lP ( tKFF) jump~ to S4r2D, not $5C:!l> the microprocc"or look\ up the high b)'te at SJ!iOO. not J<Xll.

Geoprogrammer, ported from Ber~cley·s Lni\ ba-.ed cross development ~yMem, as gomg to come out in Version 2.0 "real soon now". Ver,ion I only run\ under rhe C64 ver<>ion of GEOS: 'ersion 2 wi II run under either GEOS or GLOS 121\. Like R\1.\C. under CP/\t. Geoprogrammer b an 'edit, U\~emble. link, debug· ~}Mem. The editor. for better or worse, i\ any ver\tOn of geo~t/'1/e. On the one hand. Keo\Vrite i' l\IO\\ and clunky for entering text. On the other hand, geo\Vrite allows Tronsoctor

Ju\t in case you're tempted to use this to confu\e '>Omc pirate. you should know thlll the bug hw, been fixed on the 65C02 11

February 1989: Volume 9, Issue 3

------------------------


and 65816 - ~o the resultant code won't work with speed-up Finally, a few notes about 1541 and I 571 disk drives: board~. Also, by a clear corollar)' to Murphy's Law. if you try playing wuh this, ) ou v. Ill probably add or delete something a) Do you want to dtsttngui~h between the two? Try this: and forget to make sure that the vector is or b not on a page open 1,8,15, "m-r " + chr$(dec("67")) + boundal) - leadmg to a ne>.Ho-impo~sible debugging job. If chr$(dec("fe")): getll , a$ you must usc J\fP indirect. you should use assembler pseudoops to add filler bytes if necessary. I think that self-modjfying code may be ~afer 10 some ca~s. This wtll read the first byte of the IRQ routine on either drive. On the 1541, the IRQ routine begins with PHA (S48). On the Another potenual problem on the 6502 involve~ the TXS op- other hand, smce the 1571 has two modes, the IRQ routine becode. Whenever you decrease the stad. poimer (extend the gins with a jump indirect m~truction (S6C). The vector i at stad.) usmg TXS you should make ure that no interrupt. be it S2A9 and point., to S9DKI\ in 154 I mode and to 9DDE in 1571 maskable or ftOn -maskable. can possibly take place. For exam- mode. Some commercial programs (Copy II and Fast ple, consider the follo'.'-ing code, intended to let u routine find Had 路Em) got into trouble trying to read the signature b) te at out where it is in memory: SaJOO which changed when the 1571 R0\1 changed.

I

b) Do you want to change a single-sided 1541 disk into a I 57 1 disk without losing data on the 1541 dbk'? (r of/ow at your own ns . .. Destmys.{llfJpleS . k"' ' . ...

ld& l$60 ; rta sta $100 ; you alalost: never use this part of the stack

"'>

adrl jar $100

tsx

open 1,8,15, "10": printll1, "m-e" chr$(69) ohr$(16 4 )

adr2du du

txs pla ata $fc pla sta $fd

will format the ~econd \ide of the dtsk. (You Ul>e "iO" to set up the di'>k ro value correctly.) Of COUJ;e, this \till docsn 't fintsh the JOb - the double-side flag on track 18, sector 0 ts .,till stogie. and the BAM for the second 1>ide i~n 't wrillen. So, you ~ill ha\ e 10 change byte 3 (counting from 0), the double-side flag of 18/0. to $80. and copy the bytes 22 I to 255 of 18/0 (giving the summary of the side t~o BA.\1) from a fresh!) formalled double-stde disk. Then, dclear, which will tell the 1571 that you have a double-sided disk. Finally, copy 53/0 from a freshly formatted double-sided disk.

You nov. expect (SfC) to contain udrl +2 because of the way JSR uses the stack. llov. ever. suppose an interrupt strikes on the ftrst DEX. The interrupt overnrites the po:.itions on the stack you are trying to read, and (SfC) now contains adr2. It won't happen very frequentl), but, again by a Murph) 's Law corollary. tt wtll happen at the worst possible time. 111

lf you have a C 128 (or. I believe, C 16/Pius 4) you have an altemative:

c) Last, a faster way to dump a 1541 or 1571 R0\1 to disk - instead of reading each byte into the computer and then writing it back to the disk drive, you get the disk drive to write the bytes directly to disk. Of course, entering the program takes more tjme than you will ever save, but it's a neat hack. Maybe you can figure out some u\e for it.

jar primm .byte 0

will leave the address of the null byte in (SCE). As long as you are not actually printing anything, you don't have to be in Bank 15- any memory configuration in which the high ROMs are visible will work.

First, open 2,8,2,"#0" . Note the '#()' - the '0' tells it you want the buffer at S0300. Now. '>end the machine code below to the buffer: (open 1,8,15," b-p:2,0". then print the bytes to file 2)

(Speaking of Bank 15, if you have a Cl28. you shouJd always make <,ure that the 1/0 chips are visible before you try to do any input or output. Thts goc~ double tf you try to interface with BASIC, as B\SIC tends to leave you in configurations like Bank 14, or Bank 14 wuh RA\1 I. Thts ts why the version of the C 128 Verifi7er that appeared in Trun.mcwr> before 9: I wouldn't work in 80 columns. II your machme language uses C 128 BASIC routines that deal wtth variable or slrings. you may find you have to use JSRfAR even though }OU are going from Bank IS to Bank 15, because the BASIC routines end up in Bank 14 v.ith RA\1 I and your program willll) to return to the right address in the wrong bank - instant crash!) Transactor

ifsrad is the first add res~ of the ROM which you want to dump -

usuaJiy S8000 for the 1571, scoooorSCtOO for the 1541.) Now, open 3,8,1," :dosfile". Thts opens a program file called dosfile to write. 0'>'-, type: printl1 , "a - v " ch.r$(0) ch.r$(0) chr$(1) chr$(224)

This '>'-ill tell the disk drive to execute the machine code in buffer 0. The dumping of the disk drive R0\1 v. ill take place, and all files will be closed, independently of the computer. 路. 12

February 1989: Volume 9, Issue 3

I


" romdump"- Follow directions ,f!,ll'l'll in article

New! Improved! NSBASIC2!

orq $300 lda t1 rta 0

; ; eli · rt1 $83 · lda $022c · lllcl

tell tbe ayrt• you hnubed runnioq tlus code ()( so the cluk clrne w do otber 110rk, like writ1119 bytes dl ncton ue wr1ttu 111 tbe 10teuupt cycle current MCODduy address cluk clrnt 111t1rnd clmwl for aecoacluy lddnss 1

17

sta $82 ; current cluk clrn• 1ntunll c:blnnel lda lap+1 ; pat the l~cl bytes to flle 1 jsr pat

lda jsr lap lda jsr inc bne inc nine lda c:mp bne lda

lap+2

pat

fstad ; yes, tlus is adf-10difyl.ll9 code put ; to cb&n91 the aclclrtu froa frtlcl to the current aclclre~s lup+l ; unfortunately, I couldn' t fiDel a zero pl9t aclclreu whicb DlJlC ; cllcln't 91t corrupted, so I had to clo it thi1 n y lup+2 lap+2 top+l lap lup+l Clip top bnt lap jsr close lda 12 sta $83 jlp clott top .word hnallclclrtu+l 80cl 65536 pet : $dl'ld • put a byte 111 tbe current cllu file close = $dac0

,--..., 00

AJP L.'J, Jr.

0

TransBiooperz Oop)! A bug m our progrnm that cre:llcs BASIC "generator '' progrnms managed to snealo. two bad generntors b) us before we caught it. The re~ul t b that the programs will not work as listed, but fortunately the problem b very easily ~olved. These arc the uffcctcd program.'>: Volume 91ssue 2, " Cycle Counting". page 31: Don' t pamc - all the DATA statements are correct! Just change line II 0 as follows:

110 n$=''cc . c000'' ...and replace line' 130-250 with lines I 30-260 from the "standard generator" program on page 5. Volume 9 Issue 1. '"Multita~king on I he Cl28'', page 21: This one was e\en more mes-.cd up after line 1150, lhe line number\ ,tan again at I000! Ignore the liN set of lines 1000-1150. and u'e the 'tandard generator on page 5 in their place. Then replace line-. 110 and 120 a\ follows:

110 n$="mu1ti . ml " 120 nd=529 : aa=4864 : ch=57790

" I used to be so ashamed of my dull, messy code, but no matter what I tried I just couldn't get rid of those stubborn spaghetti stains!" writes Mrs. Jenny A. of Richmond Hill, Ontario. " Then the Transactor people asked me to try new TransBASIC 2, with Symass". They explained how TransBASIC 2, with ils scores of tiny 'tokens', would get my code looking clean, fast! "I was sceptical, but I figured there was no harm in giving it a try. Well, all it took was one load and I was convinced! TransBASIC 2 went to work and got my code looking clean as new in seconds! Now I'm telling all my friends to try TransBASIC 2 in their machines!"

• • •• • • • TransBASIC 2. with Symass, the symbolic assembler. Package contatns all 12 sets of TransBASIC modules from the magazrne, plus full documentation Make your BASIC programs run faster and better with over 140 added statement and functron keywords

Disk and Manual $17.95 US, $19.95 Cdn. (see order card at center and News BRK for more info)

TransBASIC 2 "Cleaner code, load after loadf"

13 FebrUQfY 1989: Volume 9, Issue 3 L_!Tr~o~n~~~ct~o~r~------------------------------------~----------------------~~~-


--

--

--

The ML Column • Creating orderfrom chaos I

b\• Todd He1marck Coprri~llf © 1989 !odtl 1/(•mwrc/.. The itlca for thb month·~ column cOillCl> from someone ebe. La~t year, Bytl' maga1rnc revte~ ed a book that wa' a compilation of column~ from Snemific American maguzme. One of the program~ dc,cribcd 111 the n:vrcw sounded Interesting. The 'cenario i' 'implc enough: You ... tart with a pool of voter~ who ha' e bccn '"'igncd mndom political leamng,, pick one of the \Oter... at random. pick a neighbor at r<uldom. and change the neighbor\ politiLal preference to nMtch the original voter. 1l1en ) ou repeat the procc\'1 111 an cntllc\' loop (or until ~ome­ bod) \lOP' the program b) prc ....,ing a ke) ). The Commodore M \ hr-res screen has 320 x 200 ptxels. That's 64.000 voter... You 3">tgn one of two colour.. to each pixel (I ptcked blue and white becau'>e they con~t '' ith each other). Counting diagonals. each pt\el h~ etght neighborl>. In the main loop. )OU pick one of the voterl>. one of its eight neighbors. and change the neighbor\ colour to match the voter. You creme a tiny universe where everythmg happens random1}. The voter-; arc gt\Cil colour' at random. A 'oter is picked at r;lndom A nerghhor to be converted " pid.ed at random. It '>Ound\ ab... urd. hut in thi-, chaotic and utterl) random universe. pattern' ol order <tri-.e. The fiN \ereen look~ like television !>tatic. Alta several hundreds of thou\ands of arguments

b.:t\\ ccn neighbor.... you screen.

\CC

th:rinitc

blob~

computer. Thut \ the main reason for programming in assembly language: It \ the fa'>te~t game in town. I ran imo a problem. however. whrch became the second topic for this column. Machine language 1., fa-.1. but it\ not always very good at hand ling randomne.,.,. ~1odu lur

programming

Let's jump into the progmm. It starts like thi'>: cOOO c003 c006 c009

200d cO 20 le cO 20 68 cO 200d cO

cOOc 60

J'r J'>r . J'>r J'>r

gmode mit\ ote . campatgn gmode

: tum on graphtc\ mode : imuali1e 'oter. : randomly change votel> : back to text mode

rt~

Although the program depends on chao'>. that doesn't mean '"e have to be chaotic about writing lt. If you behe\'e m modular programmmg (ai'>O called •·top down programming"). you break down the task mto module\. I he C. BASIC. and a~'>embly programs all looked pretty much the '>ame bccau-.e they had the 'ame 1>tnreture. The GMODl· subroutine toggles the 64 between text mode and graphics mode:

growing on the cOOd c<Xld cOlO cO I:! cO 15 cO I 8 cO Ia cOld

Although e' cr) rule rche' on randomne ..... the voter-; gather together into bloc\ of '>ohdarlly Here\ a blotch of blue: there·, a blotch ol ~ hlle. II you let the program run for a long enough time. you would probabl) 'ee either blue or \\hite take O\l!r the \\hole ..c.:rccn.

gmode = * ad II dO Ida $dOl l . 'ltrolv • 1 49 20 cor # dl0 l(Kl(Xl0. tltp hit "i Xd I I dO ' '" \dO I I . toggle graphics mode ad I8 dO Ida $dO I!i . 'mcsb 49 Oc cor #1 i()()()() I I00. toggle bits 8d 18 dO ''a SdO I!i . toggle base uddresse-. rt'> 60

The boon and the bane of as-.embl) language Jt', a ,hon routine that make' the 'crcen tltp Irom te'\t mode to graphtcs mode (and' it·e \Cr,,tl. hut unl) tl }OU ''"rt with a (H that''> ..ct lor the tldault \alue .... 1he 1 OR (c'\c..IU'.. I\e-on command change~ the appropriate bih in sc ROLY and \ ~ICSB <Commodore·., name' for locatiorh :!lOtti t and '!>DO IIi).

I wrote the original VOTERS program in the C language on a PC compatible. 'I hen I tran ... Jated 11 to nm under BASIC 7.0 tor the I :!h. Both program' were relamcl~ .,)ow. It made 'en'e to ~\\itch to a"cmbly language. to squce1e the l,t.,t drop of .. peed out of the Transactor

The ne\1 rou tine is called ti\11\0liRS: 14

February 1989; Volume 9, Issue 3


=•

cO Ie initvote cOle 20 28 cO J~r mdinit ; crank up the noisy SID . ;VOICe c021 20 36 cO J~r li II ; 1111 the colour byte!> c024 20 4a cO J~r choo~c : the 'otcr... randomly choose ;a colour

249 to 0 (forward from 0 to 249 \\Ould be OK, too). I cho~e ' 249 to 0 because I could leave out the CPY in~truction. The 6502 proce'>o;or know' when it hit~ a 7cro (equai·IO· tero) condition. It doe'n 't rccogm;e 250 unb' the program make' an e\plictt te~t for 250. You ""e a lillie ume and a byte or l\\O if you wait for a tero. Abo. we lion 't reall) want to loop 250 to I. "c "'ant 249 to 0. But we \\Jill to ST·\ when .Y contam' a tero, '>0 "e DE\ before the ST\\.

\1ost people think of the sm ch1p a~ a mu~1c1an. bm if) ou tell it to use a nOI'•e ~aveform. )OU can get random numbers from it. The R'I,DI'IT routme make~ the SID ch1p 'tan acting randomly: • c028 rndinit c028 a9 ff Ida #$ff c02a 8d Of d4 ~ta $d.t0f : max hi frequenC) c02d a980 Ida #$80 c02f Xd 12 d4 ''a $d412 : llOI'>e wavefom1 c032 8d 18 d4 -.ta $d4 1X : volume off and no om put :for voice 3 c035 60 rh

Some people m1ght put the locauon I 024 into a zero-page pointer and 'tore md1rectly \\ ith .Y. That would worl.. but 11 \\Ould probably take more hyh!'> and more clock cycle' (tr) it if you don't believe me). The next routine lilb 8192 byte!> of bitmap memory with random number .. : c04a c04a c04a

The register:. at ~D40L and :~>D~ur control the frequency of voice three and ~D~I:! controb the waveform (we're seeking noise). Storing an $80 into ~o.w! prevent<, the noi~c from being heard.

cO.fc c04e c050 c053 c055 c058 c05b c05e c05f c061

Two wa\. s to till memor .y The hi-re!> ~creen ~ill get ih colour mformation from the text !>Creen (although we could change that if we wanted to). The next routine till!> location; I024-2023 "ith the blue/white b)1e. The .Y register can onl) count to 255 and ~e need to fill I000 bytes. One way to do 11 " to count up to 250 four times:

c064

-

c036 till Ida #. 61 c036 a9 61 c038 aO fa c03a c03a c03a c03u c03a 8X cOJb c03e cO.f I c044 c047 cO-W

c065 : foreground 6 (blue) and : bad.ground I (white)

choose - • bitmap - 5>2000 a2 20 ldx #32 : 32 page~ of 256 byte'> = : R192 aO 00 ldy #0 a9 00 Ida #<bitmap 8d 5c <.:0 -,ta ~el fmod+ I a9 20 Ida #>bitmap 8d 5d cO -.ta -.elfmod+2 : ~et up the address ad lbd4 lpchoo'>e Ida random 99ft ff sel fmod '>Ia flfl .) : not the real address c8 Ill) : count forward dO f7 bne lpchoo~e :until .y \\rap!> ee 5d cO inc ~elfmod+2 ca dex dO fl bne lpchoose : and repeat a total . : of ·'- umes 60 : and that's all .~')

c067

ldy #250 colO - 1024 coli colO+ 250 col2 - colt + 250 col3 col2 + 250 lplill dey : note that this set~ the : tcro !lag 99 00 04 ~1<1 colO.) 99 fa 04 'La col i.) 99 f4 05 \La col2.) 99 ce 06 \La LOIJ.) dOn hne lpflll 60

Look atl>C05B S'IA Sll+F Y. It look' like the value 111 .A i'> being ~ to red at ~H+t indexed by . Y, but that\ not really true. A few b) lc~ back. SELF MOD+ I and SELl·MOIJ+2 arc changed. Thb i~ called "'!>elf-modifying code."

=

At 'SC06t. the h1gh byte (Sfl.f\100+2) increment'>. The program i<> programmmg it'>elt hy changmg bytes \\ithin a loop. If you U'>e thl'> technique. remember four thmg': l) You can't rei) on \aluc~ he1ng ~table "'hen you enter the ~ubroutine. You !>hould initialite the memo!) \alue ('>ee SC(}.IE <-C057) at the begmmng of the routine.

"'

The four ST\\ don't altect the 1ero ccqual·t0·7ero) tlag. So \\hen the program d1le' •I Branch 11 'lot Fqual (B'\E) at SC047. 1t'!> "orkmg from them\ lll\trucuon at SC'UlA. D E\ affects the Z flag and STA doe,n't.

2) The 6502 put'> the lo'' byte before the high byte. The instruc· tion STA take' a b) tc . ..,o the lo"' b) te i-. n.\+ I and the high b)te I\ \U+2.

Although thi' ... ubroutinc m1ght look a little odd, the oddnel.~ i~ necessary. We want the . 'I rcgi,tcr to count back.,.,ard from

3) If you kno~ ~hat )Ou're doing. you can do ama7mg thing., with ~elf-modif)ing code. If )OU don't, )Ou'll get headachcl> when )OU try to debug your program.

Transactor

15 •


4) Structured programmer~ will think you're crazy (or stupid) if you write self-modif)ing code. If you're majoring in computer science in college, you might be expelled for domg things hke this.

II:

RG Ri IB

Ill

The program ends"' Hh the final

~ubroutine:

AI

Bl

DB

c068 20 e.t ff campaign jsr getin c06b fO fb beq campaign n~ c06d 60 Thts is just a placeholder. The meat of the program would go here. Butthefe 'sa maJor problem that I can't solve.

Computers aren' t 'ery random Assembly programs arc so fast that the SID chip isn't random enough. lt spits out noisy numben., but they follow a pattern. Painting the screen with output from voice three produces very definite shapes and diagonal lines. Try POKEing various numbers into 54286 (or STAing into \D40E). I wrote an entire CA\1PAIG'I routine. but it '-"3~ flawed because the 64's SID chip couldn't produce rJ.ndom enough values. You can make a computer act chaotic up to a point. but then it

JJ Pl

oa IG MP Ltl RR

cr Cll MP JA GR

GC JO BP

FA DB Af OP CJ IP ~

PB PI

insists on being order!). If anybody has a \olution, I'd like to hear about it.

JIB BG

EC ID

Listing 1: Source code in P·\Lformat for the l'oters program

lilt

t.:.

1'0

or AJ

Ill CL

IlL

PA

10 r11 ,,.., src', l 20 sys 700 •=49152 30 40 .opt 00 50 gttin = $fft4 60 tL~daa = $dUb 10 ;

PM 80 ; ---------II 90 jar 9110d•

GI 100 liB 110 AJ 120 OG 130 CA 140 ,

jsr initvott jsr ~aiqn jsr 9fl0de

CP EC AJ pp

Ill Ell

; , ; ,

turn on graphics mode initla1itt voters randomly change votes baclt to tert mode

210 jsr rlldinit crank up tht noisy s1d voice 280 jsr fill • fill tbe color bytes jar choose . U. voters rllldoaly choose a color 290 300 rts 310 ; 320 rndlnlt : • 330 lda l$ff 340 sta $d40f ; UJ lu frequeacy 350 lda l$80 360 sta SdU2 ; noise vnefom 310 sta Sd418 ; wol- off llld no outpvt for vo101 3 380 rts 390 . 400 hll : 410 lda l$61 ; for19round 6 (blue) &nd bacltgtoulld 1 42G ldy 1250 430 colO : 1024 UOcoll = colO + 250 450 col2 = cell + 250 460 col3 = col2 + 250 410 lpfill day • note that thia sets the zero flag 480 sta colO,y 490 sta coll, y 500 sta co12, y 510 sta col3, y 520 bne lphll 530 rta 540 ; 550 choose : • 560 bltaap : $2000 510 ld:J 132 32 paqea of 256 byte• = 8192 580 ldy 10 590 ld& l<lntNp 600 sta Hu.od+l 610 Ida l>b1t:Np 620 stl stlt.od+2 ; set up tht lddrus 630 lpchoost ldl nndoe £40 se1t.od sta $ffff,y; this isn' t the real address 650 ; COQilt forvud 1DY 660 bne lpchooH ; until . y wraps 610 inc stlt.od+2 680 det bot 1pchoost ; and ttplit a total of 32 t111s 690 ; and that' s all 100 rts

.

~

110 ;

pg AG RB !!I

120 • ---------130 C&Jq~alqn Jsr qetin 140 beq cupaiqn 150 rts

Listing 2: BASIC gcncrawr.for the

\'Ofl'l'~

program

100 rea generator for •v.obJ' 110 n$•'v.obj' · rea name of prograa FA 120 nd•110: sa=49152 ch=14246

!!I fP

rts

FB 150 : ..............

(for lines 130-260, set the standard generator on paqe 51

ro 160 IJIIOda = •

(JI

GP II! 1111

til AA

CJ Cl GG JR

OI

110 Ida SdOll 180 tot 1\00100000 190 sta Sd011 200 ld& $d018 210 tor 1100001100 220 sta $dall 230 rts 240 250 ........................... 260 initvott = •

Transactor

(whitt)

; scroly ; flip bit 5 : toqqlt graphics Pie OG/off

JA NP

oc IE In' AG ll' gp

: ..::sb

: toqqlt bltS : toqq1t but adi!Assts

til OP CJ 11!1 J1l

16

1000 data 1010 dati 1020 data 1030 data 1040 dlta 1050 data 1060 data 1070 data 1080 data 1090 data 1100 data 1110 data 1120 data 1130 data

32, 192, 13, 13, 192, 169, 18, 160, 4, 241, 141, 173, 247, 32,

13, 32, 32, 12, 32 255 212 250, 153, 96 92 27, 238, 228,

192, 13, 141, 141, 54, 141, 141, 136, 244, 162, 192, 212, 93, 255,

32, 192, 11, 24, 192, 15, 24, 153, 5. 32, 169, 153, 192, 240,

30, 96, 208, 201, 32, 212, 212, 0, 153, 160, 32, 255, 202, 251,

192, 32, m. 11, m, 24, 96, 32, 74, 192, 169, 128, 96, 169, 4, 153, 238, ' · 0, 169, 141 93, 255, 200, 208, 241, 96

104 208 208 40 96 141 91 250 2C8 0 192 208 96

February 1989: Volume 9, Issue 3

I


Keep-SO Non-destructive windowing on the Cl 28 b) Richa rd Curcio The Cl28's 80-column Video Di!.play Controller hill. features that can enhance our 80-column text screens. Two of these features, 4K of unused RAM and a hardware 'block-copy', can be used to overcome a limitation of the WINDOW command: once a C 128 window has been opened, whatever was under it is lost. By copying the 80-column l-.Creen to the unused area before opening a window. recalling the saved screen 'closes' the window and restores the text and mtributes over-written by it. Thill can give our C 128 progmms the look of more advanced (and more expensive) computers.

The voc a nd K eep-80 The Video Display Controller (VDC) has Its own 16K of RAM. This RAM does not appear in the C 128 memory map. and can onl} be accessed through the \.DC. Smce 80 columns by 25 rows require 2000 byte!.. 2K b} tel. of voe RA\1 are assigned to screen memory. A corre!.ponding 2000 byte!. are required by attribute memory, which is similar to the 40-column display's colour memory. The character definitions are also stored in VDC memory. Though only eaght bytes are needed per character, each is padded out to 16 b}tes for a total of 8K for both upper-case/graphic~> and lower/upper-case characters. This accounts for 12K of the 16K of voc RAM. leaving 4K unused in normal circumstances. It b. this unused memory that Keep-80 uses to hold a copy of the text and attributes. However, there's more to a video display than the charucters and colours. A number of location~ in zero page and page three keep track of the screen or window dimension-.. cursor position, the current colour, tab positions, 'linked' lines, etc. This information can collectively be referred to as the Editor Values; Keep-80 stores the~e in the unused area as well.

SC53C in Screen Editor RO\t is U!.ed for 80-column scrolling and line clearing. To use it. the voc memory destination end address (plus one) is stored in RAM o locations $0A3C and $0A3D in low-high format. The destination start is stored in voc registers $12-$13 in high-low format. The source start address is stored in voc regi~ters $20-$21. again in high-low format. Setting bit 7 of register $18 tell~ the voc that the next block operation will be a copy. J SR $C53C does the rest. It is a misnomer to call this operation a block-copy. however. because the ROM routine invokes the voc copy mode one byte at a time! Still, using thi s routine simplifies the programming somewhat, and any loss of speed is negligible. especially in FAST mode. which !.hould always be used an 80 columns anyway. There are two 48-byte areal. ~1111 available. one at the top of the attribute!> area and one at the top of the unused area. Since Keep-80 alread> has code to move editor values to and from voc RAM, I have given it the ability to preserve two additional sets of editor values. In thas way. your program can jump from window to window, perhaps using one to receive input and the other to display results. Thi~ feature can be made to function in 40 columns. Obviously. considerable confusion will result if 80-column editor values are recalled to a 40-column screen.

Usage Keep-80 can be called from BASIC or machine language. The Cl28 must be in the BANK 15 configuration. The accumulator holds the type of operataon and X holds the direction, which is zero to save and non-tero to recall. If KEEP is the location of the routine. SYS KEEP, 0, 0

How Keep-80 '~orks

I I L

When the 'store '>Crecn • command i\ il.sued, after testing for 80-column mode, the rouune moves the 40 bytes of editor values from RAMo to the unused 48 byte'> at the top of 80-column screen memory. The voe\ copy feature is then used to move everything from S0000-$0FCF (beginnmg of 'creen to end of attributes). to the unu!.cd area. $1 000-S I FCF. Instead of calculating the number of pages and b} tel> to move, and invoking the copy mode the necesstLr} number of times, K eep-80 uses a ROM routine that takes care of everything. The routine at

saves the current 80-column screen. This should be done before opening a window. If the current text mode is not 80 columns, the processor carry bit is set and the routine returns. From BASIC, RRtG,_<,R wall read the status regaster into the variable SR. I F SR A "10 t=t THE" you know }OU made a mistake. In a.<;sembler: lda opuation lclx direction

jar keep

_Tr_a_nsa_c_to_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _1_7_ _ _ _ _ _ _ _ _ _ _ _ F• _bruary 1989: Volume 9, Issue 3


You can then branch on the carry nag appropriately. To recall the saved screen:

on the left half of the screen and lists itself. Two cursor-ups compensate for the line feeds when the hsting is completed. The editor values are saved and a window is opened on the SYS KEEP , 0, 1 right half. Because of CHRSC27)"R" (ESC-R), clearing the window with a differem COLOR 5 creates two different 'backTo save and recall only the editor values, the accumulator grounds'. This delineates the two windows. The program again should hold a I for the first set or 2 for the second set. Values listS itSelf, saves the right half editor values. then returns to the greater than 2 will also set the carry to signal an error. Direc- left half and continues the first lisung where it left off. SLEEP tion is as described above. slows things down for observation. The whole screen is saved and a window with a message is displayed. The Keep-80 proThe BASIC loader ( Li ting 2 at the end of this anicle) pokes the gram is then poked to create a second storage area at S2000Keep-80 machine language mto the applications area at loca- S2FCF, corresponding with the upper-case/graphics character tion 4864. K-eep-80 can be located elsewhere by changing the set which is not used by the demo program due to PIID.'T variable KE in line II 0. Other possible locations include the CHRS(I4). Having created another storage area. the demo again RS-232 buffers at 3072-3583, and the sprite definition area at saves the whole screen and displays another message window. 3584-4096. After running the loader, it will print the range of When a key is pressed, the process is reversed, recalling the memory the ML occupies. saved screens and thus restoring the characters covered up by the two windows. Modifications and demo Mor e free memory? If one of the 80-column character sets is unused, Keep-80 can be made to store another screen at that location. KEEP+6 and Is there still more usable 80-column memory? What about the KEEP+7 hold the starting and ending pages of the storage area. eight 'pad' bytes of each character definition? This amounts to The normal contents of these locations are $10 and $1 F. The 2K per character set. Can this highly non-contiguous memory values $20 and $2F in these locations will move storage to the be put to use? ls it worth the trouble? upper-case/graphics character set. To use the lower/upper-case character set area for storage, poke KEEP+6 and KEEP+ 7 with 48 We have seen the C-128 80-column capabihry used for hi-res and 63 (S30/S3F). These poke~ should be performed only graphics, its memory u. ed a a RA\1 dri,e. the unused RA.\.1 as when one of the character setS is not used. (To regain the com- a econd screen and the application del>cribed here. What else plete 80-column character set, use BA K 15: SVS 49191.) This can we do with the voc and iLS memory? modification makes Keep-80 compatible with OJ. Morriss' Twin-80 program (Transactor, Volume 8. issue 3). since that Listing 1: Keep-80.src program uses the normally-unused area for a second screen. Keep-80 only copies the default text and attributes locations AI 1000 aya4000 IG 1010 : ($0000-SOFCF), and these pokes do not affect editor-only stor- liP 1020 ;power aaa.mb1tr {buddy1281 age/retrieval. liB 1030 ;

I

LB AJ 1050 ; Jl 1060 $1300

To save and recall 40-column editor values, Keep-80 can be entered beyond the test for 80 columns with SYS KEEP+8, A, x. lilt Be certain that A is not zero in that case. With a little more lQI IL work, the routine can store many more sets of editor values, NF but only if a complete screen will not be saved, or one of the Ill character setS is unused. First, store the direction value in loca- !G J8 tion 195 ($C3), then SYS or JSR KEEP+t03 ('editSr' in the PB source listing) with A holding the high byte andY the low byte !.P BD of the voc RAM location to be acce~sed. Each set of editor val- Il ues requires 40 bytes. IIC Pl

ac n

When a second storage area is created in an unused character set, another 48 bytes at the top of that area are available for yet another set of editor values. U~e the method described above to access S2FDO for the upper-case/graphics area or S3FDO for lo\\er/upper-case.

lCD !I

JL

OL Ia'

co GB lB

The demo program (Listing 3) assumes that Keep-80 is located at 4864. It uses colours that should be readable on a green screen. For amber monitors some adjustment of the COLOR statements will be necessary. The program creates a window Transactor

OB !J LC

n 18

·=

1070 ; 1080 ·1090 ; 1100 ; rem routine• 1110 ; 1120 vrvdc • $cdca 1130 rdvdc • $cdd8 1140 vcopy • $c53c 1150 • 1160 ; raa 1oe&t10CI 1170 ; 1180 nan • $00.0;atart of acrt~~~ nriablta 1190 aupa • $0354; atart of tab cd 11Dlt upa 1200 pnt80 • $0a3c;end pointer for Ycopy 1210 ztllp • $e3; aaft t111porary 1ocatioa 1220 1230 1240 keep b1t $<17 ttat 10 co1_, 1250 1m oklO 1260 trr ate 1270 rta 1280 1290 apagt byta $10; atut paqa of 11m1atd aru 1300 tplgt bytt $lf;tnd page 1310 1320 okSO elf l$03 1330 bet trr February 1989: Volume 9, Issue 3

l

r


Jr 1340 atx rttap;dirtction

n 1350 tay

1360 bttt ldd& 1370 txa ID 1380 bttt ncrn

PC OA

w mo :

1400 :ant whole acnu IP 1410 ; BP 1420 jar rend;writt tditor Ya1uta to $07d3

II

Ill 1430 ; Q'

Ell

cr PJ II

rr !P D

PL

ca Q

OJ

lOA IL

LC NN

AO GD 10(

All ON IP

D &C

sa It

CB GN All

11

II '

1

1440 lda l$dO;deJtillatiOII tnd+1 1450 ldx tpaqt 1460 ata patiO 1470 ttx pot80+1 1480 lda tplgt : deat. atart 1490 ldy l$00 1500 jar addvr 1510 lda 1$00;aourct atart•$0000 1520 tay 1530 aetarce ldx l$20 1540 jar addwr+2 1550 ntcopy ldx 1$18 1560 jar rdvdc+2 1570 ora l$80;bit 7•1acopy 1580 jar wrvdc+2 1590 jar vcopy;ca11 roa routine 1600 clc;no errora 1610 rtl 1620 ; 1630 ; recall whole acnu 1640 ; 1650 ncrn lda l$d0;copy tverythillg 1660 1dx l$0f;back to $0000·$0fcf 1670 ata patiO 1680 atx pnt80+1 1690 lda 1$00 1700 tay 1710 jar addwt 1720 Ida apage aource h unund ana 1730 ldy l$00 1740 jar aatarce

Ill

MJ

NC MJ

Ll 2230

)lip

cr CL

Bll IJ IIC

LR Ml

DH PP AI

CO FI BP 1J Cl !ll 10 OA

NI

u

OL 10

MK IJ ilt D' LB

88 LE Ck FL

1840 edxa ldy l$d0;1o·bytt 1850 ; 1860 ;atort/recall acreu editor va1uu 1870 ; 1880 tditar jar addwr 1890 ldy l$1a 1900 lda att~p; O•atore 1910 btq loop3

BK

wrTdc+2

2240 end

100 r• ... kHp-80 loader *" 110 ke=4864:r• relocating "' 120 ek•O 130 readd:ek=ek+d:ifd•999then150 140 qoto130 150 ifck<>l6817thenprint•••• error in data ***':end 160 reatore:aa•kt 170 readd:ifd=999then220 180 ifd•>Otbenpokeaa,d:qoto210 190 ad•kt+aba(d):h•ad/256:laad·int(ad/256)*256 200 pokeaa,1:aa=aa+l:pokeaa, b 210 aa•aa+1:qoto170 220 print' kttp-80 inltalltd'ke'to' •• 230 print' ays' kt'lltft), a, x' 240 print' aaO for acrttn', 'xaO to aave• 250 print' a•1 for editor 1', 'z>O to recall' 260 print'a~2 for editor 2' 270 tad 280 • m data 36, 215, ca, 4, 56, 96, 16, 31, 201, 300 data 134, 195, 168, 201, 76, 131, 208. 45, 32, 310 data 174, -7, 141, 60, 10 142, 61 10, 173, 320 data 32,-154, 169, 0, 168 162, 32 32,-156, 330 data 218, 205, 9, 128, 32, 204, 205. 32, 60, 340 data 169, 208, 162, 15, 141, 60, 10, 142, 61, 350 data 168, 32,-154, 173, -6, 160, 0 32, -45, 360 data 8, 169, 15, 24, 136, 240, 2, lOS, 16, 370 data ·154, 160, 26, 165, 195, 240, 21, 32, 216, 380 data 0, 136, 16, 247, 160, 13, 32, 216, 205, 390 data 136, 16, 247, 96, 185, 224, 0, 32, 202, 400 data 247, 160, 13, 185, 84, 3, 32, 202, 205, 410 data 96, 162, 18, 32, 204, 205, 152, 232, 76,

3, ·89 -6, 162, 197, 10, 169, 160, 205, 153, 205, 136, 204,

m, 248 169, 160, 24, 24, 169, 7, 208, 153, 84, 136,

16, 205,

208 0 32 96 0 208 32 224 3 16 247 999

Listing 3: Keep-80 demo IE

IO NX IJ

DB PE

u 1930 loopl jar rclvdc IP 1940 Ita ITara, y Jl 1950 dey IJ 1960 bpl loop1 PI 1970 ldy l$0d PD 1980 1oop2 jar rdvdc 08 1990 ata aaapa, y LI 2000 dey Ill 2010 bpl 1oop2 1J 2020 rtl IG 2030 ~ 2040 loop3 lda ITart,y 8C 2050 ju wmlt:: &II 2060 dey l l 2070 bpl loop3 DP 2080 ldy UOd Ill 2090 1oop4 lda 111p1 , y Jl 2100 )ar wmlt:: JP 2110 dey Transactor

bpl loop4 rtl ; ;routine to wtltt to Tdc addrttl r.giatera ($12/$13) ;or any otbtr pair of ti(Jhttn ;pfirat byte,yqert byte,xatint reqhtu ; addn ldx f$12 j ar wrTdc+2;btn for otbtr pain tya

Listing 2: Keep-80 loader

1!1' GP 1920 ;

inx

IIJ

II: 111 mo : All 1760 rend lda 1$07,hi·byte of tditor atoraqe GD 1770 bttt Idea IS 1780 ; liD 1790 tdda Ida l$0flton/recall tditor Ylluu Gl 1800 c1e;at $0fd0 or $1fd0 IK 1810 day 18 1820 btq Idea OD 1830 adc l$10 Cl lL AJ

BD 2120 00 2130 Cll 2140 CA 2150 AB 2160 11 2170 IP 2180 Ill 2190 IC 2200 JP 2210 II 2220

PI IF .&II DE

PN Ill Ck JB PI II: IIJ

Ill

BA JB

CB 10(

19

100 bank15:keepa4864:rem atart of ml 110 poktkttp+6,16:poktkttp+7,31:rem atoraqe@ $1000·$lfcf 120 qraphic5:color6,1:color5, 12 130 print' (hOCIII)!hOCIII)I clr )'chr$ (14) cbr$ (27) "r"; 135 re1 ful1-airt reverae acrttn, lower/uppercase 140 window0,0,39, 24,l :a•1:x.O:qoaub280 150 colorS,15:window40,0,79,24,l :a•2:xzO:qoaub280 160 a=l:x-l :qoaub290:liat210· 170 aaO:xaO:qosub290 180 eo1orS,l·windowl2,7,37, 11,1 190 eo1or5,8 200 pnntchr$(1S)chr$(18)'12 don)l3 dqbt) your ••aaqe bert •· :llapl 210 potuetp+6,dee('20') poktketp+7,dee{'2f ) 215 ~ 101t atoraqe to appar/qraphica 220 qolllb290:wi.Ddowl9,8, 43,12,1 printchr$(143); 230 pri.Dt'(2 don)l5 riqbt} pnu any by • :qetby a$ 240 x=l :qolllb290 alttp2 250 pohlttp+6 16:poktkttp+7,3l:qotub290:tlttpl 260 a=2:qosub290 liat210270 rya4919l.aod f19&in char ret 280 litt-200:print'(up)!up)' 290 aya hep,a, x tlttp1:rtturn ll February 1989: Volume 9, Issue 3

I


--

KERNAL++ Add a DOS wedge to your C64 Kernal • • by William Coleman Kemal++ is a Kemal enhancement for your C64. It adds a built-in DOS wedge, auto-loading of BASIC or \1L programs at power-up, additional screen editor commands. and !.eve raJ other patches that make using the 64 easier.

#4)

Oos commands

@<disk command> Send a command to the drive, e.g. @sO:filename.

The Dos Wedge intercepts the crunch vector ($0304-$0305), ~o program execution !.peed won't be affected. All wedge commands mu~t start at the first position of a logical line. The following commands are supported: % Load an Ml. program (same as ,8, I). The end of program poanters are not modified, so you can load ML without affecting BASIC. However, for this rea~on, don't try to load a BASIC program with this command.

to 9. To use device 10. enter@:, and for drive II,@; (this work\ for most oos wedges by the way).

@$ Displays the di~k directory. The RUN/STOP key will abort.

@£ Toggle the write protect status of the disk. If you use this command and then try to write to the disk you'll get a DOS MIS\IIATCH error. Executing it a ~econd time w1ll return the disk to normal. If you list the directory of a protected disk, the Ver;ion String (just after the djsk name) will read '2e' instead of '2a'. The routine used is based on one by William Fossett. For more information see Transactor, Volume 7, Issue 4. @Q Quit wedge. To re-enable, use SYS 65526.

I Load a BASIC program. The'!' commands

i

Load and run a BASIC program. The command~ in this group of BASIC enhancements are preceded by T:

.-- Save a BASIC program.

= Verify the program in memory w1th a file on the disk. # Display a sequential file on the screen. The

!d Restore default screen colour;. This command will set the screen colours to the power-up configuration, currently a black background with light green text in lower case. You can modify the color subroutine in the '>Ource code to your own fa\.OUrites. Thj~ l>Ubroutine alsO pokes the value 128 intO locatiOn 650, which will make all keys repeaL

RUN/STOP key

will abort the dbplay. No character checking i~ done; cursor commands and colour changes will print. so be careful what you try to display. Only SEQ files will work, though you can of cour;e modify the code to display other types.

!<number> Set background and border colours. Use the same number you would use if you were poking location'> $0020 and S0021 directly.

All of the above commands have the same syntax: %filename. You don't need quotes. However, if you li'>t a directory and place one of these characters in the first pos111on of a line "'ith a filename on it, the command will execute properly. The following commands all begin with '@ '. You can also use '>· instead if you prefer.

!• Un-new BASIC. If you accidentally enter NEW (or hll a reset bullon). this re!>lores your BASIC program. It's ai'>O handy if you inadvertently load a BASIC program with the '%' command. Just use this command to set the pointers properly.

@ Read error channel.

, creen editing

@#<number> Change the drive number the wedge accesses. The number can be from 4 (yes it's possible to have a drive

Several new Screen Editor commands have been added. All are activated by pressing the CTRL key at the same time as the

Transactor

20

February 1989: Volume 9, lssue 3

f


ke:,.

li~ted.

u~mg

They can also be used from within a program by the CHRSO code given.

11\~TtOEL

- CHR$(23): Toggles quote mode on and off. Cancelling quote mode will also cancel insert mode if that is active. CLRIHO\tE CHR$(22): Homes the curwr to the bottom of the ~creen.

CHR$(2tl: Clears the line that the cur<;or is on from rhe cursor to the end of the line.

RF.Tl R

CURSOR CHRSt251: Clears the screen from the cur or to the bottom of the screen.

The commands added to the screen editor are patched into the print-to-screen routine. Commercial program) that may use the new CHRSO values as commands (CfRL-U for example) won't try ro print them, so there shouldn't be any interference. Learn how to burn! need access to an EPROM burner to in~tall these addition~. either a commercial model like the Promenade or a home-built model like the one l use, which was featured in Transactor, Volume 7, Issue 4. The source code at the end of this article was written for the Abacus assembler, but should work with PAL with only mmor changes. You

~ill

VERT.

To make the file that 'Will be burned onto the EPROM, do the following:

IIORJZ. CURSOR CHR$(261: Clears the screen from the line the cursor is on to the top of the screen.

Load your as~emblcr and monitor. Don't run them (my monitor interferes with my assembler, that "s why T do it thi~ way). I)

Other goodies Seveml other patches are included to enhance the Kemal's operation or change the standard defaults:

Load in the source code and run it. The first thing it w1ll do is copy BASIC and the Kemal into RA-.1. Thi~ ic; done from BASIC, so be patient! If you're not using a PAL-compatible assembler (LADS, for instance), you 'II have to do this by hand. Do not flip out the ROMs yet. 2)

The default LOAD device is now 8. LOAD "O:filename" will load from the disk instead of the cassette. The default OPE device i~ now 4 with a secondary address of 7. OPEII< -l now behave~ like OPES 4.4.7. These two defaults can of course be changed to ~uit your need~.

3) When the assembly b finished, enter your monitor and transfer $EOOO-$FFFF to $3000 (exactly where isn't critical, $2000 would do ju\1 as ~ell). Change the contents of memory location 0 l to 53 ($35 ). If you forget, and the RO\i isn't switched out. you won't ~ee many improvements ~hen you install the new Kernal! The ·~tandard· transfer command is:

Pressing SHifT and RUN/STOP together will generate <RETURN> RUN <RETt:RI\>. The logo key and RUN/STOP will generate LOAD "0:•" ,8,1 withoul a RETURN. CTRL and RUN/STOP will generate LOAD "0:•" without a RETUR:--.1.

T EOOO F'Fl'T 3000

The screen ~ill not ~croll while the SHifT (or SHifT LOCK) key •s depre!>sed. This b handy when listing BASIC programs.

4) Now use the monitor to save memory from $3000 to $5000:

s

3000 5000

" file~"

08

Holding down the CTRL key while turning on the computer (or hittmg the reset button, if you have one) will load the first program on your disk (same as %0:?•). This is a handy option for booting games and other programs that have an autoloader.

or possibly:

Holding down the SHif·l key while turning on the computer will load the firl>t program on the disk and RU it (same as

Read the documentation that came with your monitor for the proper syntax.

s

" filename " 08 3000 5000

t o:?•>· While you have the new Kernal in RAM, you may as well tcM it. I lit RUN-STOP/RESTORE. and enter POKE 1,53 then SYS 65526. All of the options l.hould work (except the autoboot of

Wher e's the beer?

1

The wedge is mstalled where the cassette routines used to be. To prevent c~hes. device #I is patched out - if you try to acce~s II you will reCCIVe an ILLEGAL DEVICE error. Because of where the routines are placed, these improvement<; should be 100 per cent compatible with commercial programs, although you may have to disable the wedge with @Q before loading them in. Transactor

cou~e).

'low burn the file you just saved in accordance wnh the inwuctions that came with your EPROM burner. As far as chips go, you have two choices: 2764s or the MCM68764. The former is the cheapest ($6.95, Radio Shack #276-1251 ), but 11\ a 28-pin chip so you'll need to build an adaplcr The ..1C\168764 21

F~

1989 Volume 9, Issue 3

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


is more expensive {about $16). but it's pin-for-pin compatible with the Kemal chip {2364). By the way. BASIC and 1541 R0~1s are the same type as the Kemal.

BL 1210 chardoct • $t6&8·

oc 1215 chkoodes • $t72a· charout (after patch) PI 1220 clrl101 • $t9ff·

cltLr scrttlllint

II. 1225 upordoom • $tcU

chk for cue clwlqt

Ql

If you don't have access to an EPROM burner. you can still use the program, either by using the BASIC loader {Listing 2), or by making a file as explained above, using a disk doctor to change the load address to $EOOO, and booting with the following program (a faster solution would be to write it in ML).

Al

AJ GC

PC OD

u

KA

8A

1 x-x+l: if X"'l then load"lternal++" , 8, 1 2 fori-40960 to 49151 :polte1, peelt (i) :next 3 poltel,53:aya65526:end

Making your O\\ n impro,ements The wedge occupie~ memory from SF72C to $FA80. The cassene routines run through SFCE7. so there·~ plenty of room left for funher improvments. There are also n few shorter segments in the original ROM code (mostly tape routines) that can be re-used. You might even be able to queeze in a minimonitor (vtry mini)! The possible improvements are limited onl) b) )Our imagination!

ll!

FJ PC lDI Gil FB 11 BJ IL OJ

co

8A Cl! ICP;

DD DE LB

0! ltC

L~ting

1: Kernal++.src

Ill 1000 qoto1055 00 1005 open15, 8,15,'a0:ternaltt.src•:c1ose15:aavt'O:kernal++.src•,a:end

IG 1010 ;

H!i 1015 ; .......................................................... Oil 1020 ; ' ll!IUIAL++ V1. 0 (C) U JUliE 87

CG 1025 ; ' llilliu Coleman U31 Pacetti Rd CA 1030 ; ' ata Green Cove Spqs Plf 1035 · !Iuter B1uter Florida 32043 GP 1040 · ................................................................... u 1045 ; IL 1050 ; thtst 2 1intJ copy the roa into ru rP 1055 : for 1•573U to 65535:potel,petk(i) :cat PI 1060 for l-40960 to 49151:potei,pttk(i):ctrt BB 1065 sys32768 GJ 1070 .opt oo IDI 1075 pa91 65 Cl 1080 ; above il for abacus use:Dbler. for pal, use ays 700, delete .paqe DL 1085 ; GO 1090 ; *** ktrnxl equates *** HL 1095 ; PN 1100 ltcODd • $ff93 .ll 1105 tkll • $ff96 IO 1110 acptr • $ffl.5 All lll5 ciout = $ffa8 OI 1120 anttlt • $ff&b li 1125 WID : $ffH PC mo lilten • $ffh1 Dl 1135 talk • $ffh4 PF lUO rud.tt • $ffh7 Jl 1US open • $f3d5 Ill 1150 close • $!642 Jilt 115S chraut • $ffd2 1!11 1160 load • $U9e IL 1165 atop • $ffll 8A 1170 clall • $fft7

v. ms : OG 1180 ;

*'' other equates •••

BB ll8S ; rr 1190 baswt • $t3hf . U 1195 baasq • $t422; n 1200 Ytcp3 • $tm · oc 1205 sttpctt • $1.56c

initialize buic power-up •m91 nrtore P9 3 Ytcton set charcm pctra

exit 4 scrtta charout

80

pp

n GJ AD BJ

G8

Nl

NI EP 011

PF

e g GO GL 1.11 GB

OG 1~

1230 me = $tl59 1235 border • $d020 1240 backrnd • $d021 1245 ciapra • $de00 1250 ciaprb • $de01 1255 outnum • $bdcd; print inteqer 1260 strout • $able; outputs &string set up statement 1265 aewatt • $a7ae; 1270 rune • $a68e· set up for run 1275 clear • $a659; cletr basic toktniu lint 1280 crunch =$a57c: 1285 lint • $&533· relink basic 1290 crvtc = $0304 Cl1lllCh vector 1295 lpcity • $028d· ctrl, shift,or c= keybrd repeat fl&q 1300 repeat • $028a· 1305 labuf • $0200; inpot buffer 1310 ; 1315 ; ••• zero pa91 equates 1320 ; 1325 cpat • $f3; pntr to color 111 line link table 1330 11ynx • $d9; 1335 insert • $d8; >0 = insert mode 1340 row • $d6; cursor raw (0-24) IIIIX chars in line m5 lux • $d5: 1350 quote • $d4; >0 = quote 80de cursor colUIII 1355 colaaa • $d3; 1360 rp!lt • $dl • patr to ndeo utru uybrd buffer count 1365 keycat • $c6; 1370 wt)diY • $bt; wedge dm.ce t 1375 fcue = $lib currentcle'fice 1380 dtY1ct • $b&; 1385 snd • $b9; secondary &ddr 1390 length • $b7; lenqth of filename 1395 ul • $at; end of load 1400 kflaq • $9d; ktraal Dessage flaq 1405 It • $90 1410 txtptr =$7a 1U5 aov • $2d; atart of •eriabltt stert of baJic 1420 sob • $2.b; 1425 aisc • $22 1430 flaq • $02· flaq for autoboot 1435 ctr1-retUIIl lUO ctrlrtt • 21· ctr1-bcDe 1H5 etrlba • 22; ctrl-ina/dal USO etrlinl • 23; ctrl-Yert cursor 1455 etr1Ycr • 25; 1460 ctrlhcr • 26; ctrl-hori cursor 1465 ; ··-------------------------------------

• •

••*

ED 1470 ; DI 1475 ; -- patches default device I -OD U80 ; CE U85 *m $tldt MI 1490 .bytt 8; load' file' a load'file',8 EP 1495 •• $t228 .u 1500 .byte 4, open4 • open4, 4, 1 J!D 1505 lcly 17 1!F 1510 ca 1515 -- patches Ytctor table -~ 1520 . n 1525 ' • $tUb NL 1530 .word wedge FR 1S35 · FI 1540 ; -- IIOdify power up 11essaqe -PB 1545 ; B! 1550 h $t488 GB 1S55 .uc ''ltlrnll++ Vl.O " 01 1560 ; KM 1S65 ; -- text for load -IJ 1570 ; Ill 1575 •• $t4b7 RB 1580 loacltxt .uc ' load' OP 158S bytt H GB 1590 .uc ·o· ••

rr~a~MC ~c~t~or________________________________________22_________________________Fe_b_ru __ a~ ~-1_9__ 89: Volume9,1uue3

L/_ _


Il 1595 .byte 3t

MB 1600 .asc ", 8, 1' LL 1605 , sx 1610 ; •• patch to for stop key• -l'IC 1615 ; EJ 1620 ·= $e5ta DC 1625 jlp onlktyl sc 1630 DOp II. 1635 ld.l IS Cll 16t0 Ll 16t5 -- patch to pnnt roat1nt -10 1650

CJ 1655 •• $e725 CD 1660 )1lp cbkquott U 1665 unp • P! 1670 unp Ill 1675 $t7dl II 1680 jlp cewcodu Ll 1685 : JL 1690 •• $t962 II) 1695 jllp wait D 1700 ; JD 1705 ; -- patch to etrl table ·-

·=

EC 1710 ; lO 1715 •= $tct2

MJ 1720 Ll 1725 Jl 1730 B1 1735 OJ mo FG m5 J! 1750 Gl 1755 PM 1760 LF 1765 IlL 1770 FG 1775 IG :780 IlL 1785 a 1790 GN 1795 OR 1800 H! 1805 II 1810 IIJ KC

LB RC CF HD II OA U

KL

BB Ell

KL

EX !!F

'*m JG

or 11

LC 11 011 Ill

oa All LN 1'1'

.byte $8t *= $ec78 .byte etrlina, ctrlrtt, etrlbcr ·= $tc7f .byte etrlvcr $ecab .byte etrlba *= $tcb7 .byte $85 ; ; -- patch tbift·run/stop ·; •= $tct7 .byte 13 .aac run• .byte 13 ; ' -- patch out Clutttt -; 1815 $f2ct 1820 jllp $!271 1825 *= $f38b 1830 jmp $f713 1835 •= $f539 18t0 jmp $!713 1845 *= $f65a 1850 nop 1855 nop 1860 ; 1865 ; -- do atop ktyt •• 1870 ; 1875 •= $f65f 1880 ocektya cmp l$83; abifttd 1885 bile okl 1890 JIIP $t5tt 1895 okl C11f l$84; mo but ok2 1905 lda 113 1910 bllt sticllt alwayt 1915 ok2 Cllf l$85; etrl kty 1920 but ok3 1925 ldJ 19 1930 sticllt til 1935 au ktycnt 19t0 oUoop ldl loadUt-1,1 1945 rta $0276,1 1950 del

•=

ms

JB bne okloop 11 1960 JIIP $t5ed

BP 1965 ok3 JIIP $e5!t IC 1970 H.l 1975 -- actint11 wtdqt -CD 1980 · iB 1985 •• $f72e II 1990 wtdqtoD )lr YeCp3 Ol 1995 ldl l$08 GD 2000 Ita W)de'f SIC 2005 rt1 l1 2010 1'1' 2015 • Ol 2020 ; -- wtdqt proper ·PF 2025 liP 2030 ftdgt ldl txtptr if unt input bu!ftr BF 2035 bile dore~; then crunch IF 20t0 C1f I"@' JI 20t5 btq dolt IF 2050 Clip I">" OJ 2055 btq dolt n1 2060 Clf I"-• Gl 2065 beq dotaVt OL 2070 lldge C1f I"\'; entry fr011 autoboot Ll 2075 beq deal Gli 2080 Clllp I"·· BF 2085 btq doload OF 2090 C111p 1"/" BG 2095 btq doload BI 2100 Clf I "•' LG 2105 beq doload MD 2110 cmp I ''' II 2115 btq )dobal N! 2120 Clp 1' 1' II. 2125 btq ltq CF 2130 do~ JIIP crunch comal eruncbinq !ill 2135 BB 2UO )dobll JIIP dobu . 1prJ.A9bo&rd BI2U5 IIJ 2150

-- ane roat1111

80 2155 PI 2160 doaaft )lr Htup· Itt up hlt paraa ID 2165 )lr lift lift proqru SC 2170 !a.seq Jlr pmtret pnnt return OI 2175 JIIP dirptrr; di1play error chan. 1QI 2180 • LD 2185 ; -- att up for load -n 2190 ra 2195 doll lda 11 DB 2200 .byte $2e BL 2205 doload lda 10 08 2210 JIIP loadit NB 2215 : 10 2220 : -- rtad atq filt -HC 2225 : PB 2230 atq ldl inbuf+l HJ 2235 beq done; edt it just I OL 22t0 )ll setup; stt up file parueteu LL 22t5 ldy ltngt.b; ltcgtb of filtnlllt 1(1 2250 illy 11 2255 Ida I', ' CC 2260 ata inbuf, y BE 2265 illy: add two oc 2270 Ida l ' a' Cl 2275 eta inbuf,y; apptcd • ,a' BB 2280 tty ltngtb "" ntW length Jl 2285 Jar JOOboo tell d:ift to tall U 2290 ldl 125; ctrl·rttum Pl 2295 )lr cbrOilt clttr to bottca !G 2300 atql lda st Jl 2305 bnt aqout; Ult if tt Ht LG 2310 Jlr stop LD 2315 beq aqcvt ; alto cbtek atop by PJ 2320 )lr acptr: qet a byte AI 2325 Jar cbrout and print it PL 2330 JIIP aeql; loop back FJ 2335 :

·=

Transactor

23

February 1989: Volume 9, lsau

L_~~~-------------------------------------------------


~ sqout

Jlr clolt; cloH tilt uit OJ 2345 J1P fmseq Elt 2350 n 2355 -- parse @ CllF'ndl -(K 2360 • a 2365 dolt jsr setup Itt up filt par...ttrl Gl 2370 ld& lobuf+l II 2375 beq )d.lsperr J11lt @ 8i 2380 Clip t ,. BJ 2385 btq chgdrf ro 2390 Clip t •q• II 2395 btq quit IG 2400 e~p I'$' Ill 2405 btq chr 1IJI 2UO Clip I'\' 2US beq J"P10t 10 2420 ; n 2425 '; -- Hod atnnq to trror chuntl -!P 2430 ; aakt drive listen IO 2435 jsr hello; Dll 2440 ldy IO JIJ' 2445 d&ioop lda inbuf+l,y; send strin9 liD 2450 jsr ciout; to drive RR 2455 iny DO 24 60 cpy len9th IF 2465 bne d&ioop 10 2470 jar unlsn JL 2475 done JIIP bye All 2480 jdirperr JIIIP dirperr; rtld error chan. It 2485 . BC 2490 jvprot beq vprot; rpnJI9botrd lD 2495 . GB 2500 ; -- disable wedqt -PD 2505 ; II 2510 quit lda l<=cb restore default CII1Dch 'ftctor n 2515 rta CiftC JI 2520 lda l>ciilDch lit 2525 l t l ClftC+l Il 2530 ; a> 2535 ; -- cbanqt wedgt dmct -CG 2540 . Ill 2545 cbgdeY lda inbuf+2 Jl 2550 llld f$0f SG 2555 sta wt]dn GB 2560 ; BC 2565 ; -- c0110n tlit po1nt -11 2570 ; part of cltar rB 2575 bye jsr $a67a· uin heaic loop IP 2580 jlp $a47b; PI 2585 ; All 2590 ; -- lirt directory to rcrttn -JJ 2595 ; FI 2600 dir jsr yoohoo; ukt drive talk load addr,link,b1ockr rG 2605 lda 13; or 2610 linein sta $9c qtt bytt fr01 drivt JB 2615 snk jrr acptr; atore IIi 2620 sta $9e; qtt another Lll 2625 jrr acptr; atort 1t too OP 2630 sta $9f; n 2635 1dl rt lD 2640 bee ddont; ehtcl: rt Pll 2645 dec $9c : loop to reid in IF 2650 bne snk; $9c pairl pnnt dtcaal GB 2655 ldl $9e; nUibtr. 1 t . m 2660 ldy $9f. niJibtr of blb BL 2665 JSr outllua, Dl 2670 lda • •• pn11t space GG 2675 JSr chrout II 2680 dloop Jlr acptr; 9ft I bytt loop till zero (tol) n 2685 beq tndlint. JF 2690 )If chrout BJ 2695)1Pdloop !Ill 2700 endl1ne )II protrtt chtcl: stop kty BC 2705 Jar rtop AX 2710 beq ddone

-=

I:

I

I

I

I

I

bt.'

Transactor

n 2715 ld& 12 OP 2720 bne lineiD;

Hnk,blocb

BP 2725 ddone jsr clost IC 2730 jlp bye PC 2735 • DF 2740 prnt.ret ld& 113 print rttllrn JB 2745 jlp chrout; !I) 2750 Ql 2755 · -- vnte (llD)prottct disk -00 2760 Jl! 2765 : tbis rout1ne wds to cc-•w to tbe Gl 2710 ; drift tbe first vntts ~ codl llld Ill! 2715 ; tbe secoad ooe utclltts thlt code Cl' 2780 ; DL 2785 vprot JSr hello BD 2790 ldy 10 1.11 2795 wloop ld& protstr,y FC 2800 jsr ci011t I'll 2805 iny lP 2810 cpy 131 JO 2815 bne wloop IE 2820 jsr 11Dhn DB 2825 jsr hello JF 2830 ldy 10 IJ 2835 wloop2 lda tltatr,y 81 2840 jsr c1011t liP 2845 iny JI 2850 cpy IS FB 2855 bne wloop2 All 2860 jsr llDhn Ill 2865 jlp dirperr Mit 2870 ; BD 2875 ; thest two COIIIDda art sent to tbt Ul 2880 ; drift. tbe first u a .-,ry vnte Fll 2885 ; llld tbe aecoocl is a .-,ry uecutt All 2890 ; RR 2895 protrtr .IIC ..... : .... 00 06 25 JP 29~0 .word $0600 BC 2905 byte 25 lold bla DI 2910 jsr $d042 BB 2915 lda $0702; 91t dor ftiUOD Ill 2920 eor 14; a to t/t to a 10 2925 sta $0702· store it bicl: IG 2930 rta $0716; directory (2a/ t ) Wt IDII drlft BG 2935 lda 1$41; will vtitt KL 2940 sta $0101· baa to dirk Lll 2945 jar $ef07; KL 2950 jlp $d042; Ititld baa IJld txit BA 2955 ; DB 2960 exestr .11c 'a-t'; 1-t 00 06 tal 2965 .word $0600 All 2970 ; All 2975 ; -- load routine \ I • =-1IJI 2980 ; Kll 2985 loadit sta and rtt up filt par...ters Mit 2990 jsr rttup; oc 2995 ldl sob 9tt start of basic &C 3000 ldy aob+ 1: if ve.rify tbtn MB 3005 lda UIINf; &CCIIII ) 0 JG 3010 e11p I"=' : lD 3015 beq '" BL 3020 lda 10 DI 3025 fti )Sr load lold PI09fll n' 3030 bcs lbid brench on error OD 3035 lda It Ill 3040 aocl l$10 breoch OD It JL 3045 bnt lbid2; BJ 3050 lda UIINf II' 3055 Clip I'\' !II 3060 beq ldone; if 11 load tben done Ill 3065 1d& tal BJ 3070 sta sov PO 3075 lda t&l +1 LL 3080 sta aov+l; att end of load p11tra

2A

February 1989: Volume 9, Issue 3

I


Ill 3085 jtr clur;

BO 3090 jsr link; 81 3095 )II rune;

reset r...ining pntr• rt·link prnqraa partial elur

lA 3465 lda l\01101111; $60+0f as 3470 jllp seeo!ld Jl 3475 . KB 3480 -- uka dnve till --

Jll 3100 lela inbuf

BJ 3105 Clp ID 3110 bat GB 3115 ldl CL 3120 sta JC 3125 ata

ldoM .· 10 kflag; inbnf

3130

cevstt;

(11

)lip

, •••

DB 3C85 • BP 3490 yoohoo lda llOllOOOOO;

if not • then doae 11lpprtll

ar 3495 sta Slid;

ktrnal •n.

II 3500 ]St open Q

OR OR

I'L 3135 ; I'L 3140 lbad tu pp 3145 bat 1flnl

zc

3150 OC 3155 BG 3160 ID 3165

EM

31~0

EC 3175 lC 3180

BL LD

ldx l$1e byte $2e lbad2 ldx l$1e byte $2'e ldoat ldx 1$80, no error lda l$ff sta $3a; 1tt direct IIOdt lfini JIP ($0300) ; ; -- parse eomaand atr1nq -; ; this routine set length and addr ; parueters of filen&llt in buffer. ; \ ' filtn&M' will btcoee ; \filenameln&lt ; thia ••••• will be ignored • parse ldy 1$02 sty fnue+1

11M FE

BB SA

DJ HL AD

!! 3185 Ill 3190 HB 3195 GP 3200 OB 3205 n 3210 PI 3215 JP 3220 DA 3225 !B 3230 KB 3235 1111 3240 IG 3245 dey IlL 3250 sty fn1111 : filenaae at $0201 II 3255 dey; now zero 81 3260 ploopl lda iDbaf+l ,y BP 3265 beq pdocle II) 3270 Clp l$22 IJ 327 5 beq quot lL 3280 lnY II) 3285 bpl ploopl cr 3290 quot ldx to IP 3295 ~ lela illbuf+2,y; allift stnnq to JP 3300 sta illbuf+l, x; atut of bllffer, ac 3305 beq x2y· no tr11l1n9 quote IG 3310 cap l$22 81' 3315 btq x2y II 3320 iny Jl 3325 iolt II! 3330 cplt l$25 liP 3335 bne J!IIOVI HR 3340 x2y txa AO 3345 tay 08 3350 pdone aty length SA 3355 rtl GJ 3360 ; Ill 3365 ; -- display error channel -AI 3370 ; Bl 3375 diaptrr )tr elrst SF 3380 lela de'fiee lP 3385 JSr talk IL 3390 ldl l\01101111· $60+0f PP 3395 )lr tksa !D 3400 arr1oop ]It acptr !C 3405 ) II ehroat 1B 3410 C1p 113 !P 3415 beq urdoae PL 3420 lda at !0 3425 btq mloop PJ 3430 errdoae Jlt Wltalk II) 3435 )bye jlp byt GO 3UO IL 3CCS -- ukt duk luten -AP 3450 Ill 3455 hello lda de'fice !G 3460 )U listen Transactor

Jll

IG PI CH Bll

m DH C! PC II L!

KG JH

BL Ill PC IB IL OP

LL 1M L! Jl

Gl LG 10

ro

FE PO

00 CF

El MF ON

!0 ID

CB

LH JC GC 110 Al FD

CP GJ FF II!

DI AF I!P

8! DK

PJ DL BB

25

$60+0 2nduy &ddr open ebaOMl

3505 lda deYlct 3510 ]II till · uke drift till 3515 lda snd 3520 JIP tua · 3525 3530 -- setup for drift rout1n11 -3535 3540 setup JSr parse; parae filtolle 3545 1da wt)dtv 3550 sta dtYice· 3555 elrst lda 10 3560 sta st. clear status 3565 rts 3570 ; 3575 ; -- parse I routine• -3580 ; 3585 dobu lela inbuf+l 3590 beq jbye: juat 1 3595 cmp I' d' 3600 beq default 3605 Clip t••" 3610 beq WIOtw 3615 e~p t·o· 3620 bee )byt 3625 e~p I '<' 3630 bel )bye 3635 sta border 3640 ldy lllbuf+2 3645 btq seolor 3650 ele 3655 tya 3660 adc 110 3665 sta border 3670 seolor Ita baekr!ld 3675 JIIP bye 368~ . 3685 default Jlr color 3690 j=p bye 3695 · 3700 ; -- unnew basic •• 3705 · 3710 WIOtw lda 11 3715 tay 3720 sta (aob),y; ut firat link 3725 jsr link: rt·llnk progru 3730 lda ai1c 3735 sta lOY; link prOYidea the 3740 lda aiae+l; end of progru 3745 sta IOY+l; )Uit IIOVe it. 3750 )Sr clear 37 55 jql bye 3760 · 3765 · -- sat dlfault aertt~~ colon -3770 -- IOdlfy to rait your taste -3775 3780 color lda l$80 3785 Ita rtpt.at . uke all ktya repeat 3790 lda tO baekrOODd 3795 Ita border 3800 nop: yoo can insert a 3805 nop; a lda l u bert. 3810 Ita baekrnd 3815 lda 1153: char color 3820 JSr ebroat 3825 lda 114; lowtreasa 3830 J1P ebrout 3835 ;

February 1989: Volume 9, Issue


8ll JSCO ; -- check for autoboot •• LB 3845 ; BH 3850 autoboot jar wtdqton D 3855 )II batiDit; 101t1ali&t baaic

I

OG 3860 J&r color Cl 3865 )It baa.sg powr up •saagt IJ 3170 81 3875 lcbt 1251 OL 3880 us; clear stack m 3885 lela tl I'P 3190 sta flaq; 101t load type flag OS 3895 lela spckty OG 3900 Clp 11 or 3905 btq autol; 1f abift by OS 3910 Clip ~~ DC 3915 beq auto2; if ctrl kty Gr )920 bat fiDi; always 1f no aatcb 08 3925 autol lsr flag. flag now uro III 3930 auto2 Jlr clall MB 3935 ldy l$ff 110 3940 bootl iny; tranftr '0:?*" IJ 3945 lela atar,y; to input buffer. J! 3950 sta inbuf+l,y or 3955 bot bootl IP 3960 jar pun; putt buffer ex 3965 lda flag ex 3970 bne alload IP 3975 lda , , •• ac 3980 .byte $2c AP 3985 alload lda I \" JC 3990 ata l.llbof; Ult tht wtdgt IQ 3995 ~ wdgt; to load prograa. II 4000 fiDi ilf $t386: to bane OP 4005 atar .uc '0; ,.. OJ 4010 bytt 0 rc 4015 u mo -- power up default colon •• PC 4025 J! 4030 1ttclr jar color AI 4035 J1P ($a002) 00 4040 ; 01 4045 -- atop scroll if shlft •• I! 4050 . MJ 4055 wa1t ata $ac rs 4060 sei Pll 4065 wl lda l$fd IO 4070 ata ciapn BA 4075 lda ciaprb Lll 4080 cmp l\01111111 01 4085 beq wl; loop if alii ft II 4090 eli !.C 4095 rta XII

Eli J! 011 liP AG Ell Bll

!C

Ol! CB

or

III

u mo OF 4255 -- clear to end of line ••

m

AL NIC HI

OA IIJ JP\ HB

n

PI

cc

BR !B Nil PG 80

JS All Gl !ill

DO Ul

EP Ll IIJ Jll NL

MB GD ltC

PL JP\ Jll

PB PO BC tal BP

co Ill

EG Jl LF !.C

mo ·

BP 4115 cbkquott bpl cbkq; part of reg ktrnal

'

Transactor

put a lplct in Yidao utrix put backround color 10 color 11100ry

I

cbtck for tol

GF 4320 ;

uoo .

DC mo jlp $e7d4; JL 4125 cbkq Clp tctrlins· GO 4130 beq qtog; a 4135 J1P cbkoodts · Jl 4140 qtog lda iDstrt; IP 4145 btq tryq· 0& 4150 qoff lda to Bl' 4155 ata insert: Gl 4160 sta quote; PG 4165 btq qdone; Pl 4170 tryq lela quote; AG 4175 bot qoff, l!L 4180 lDC quote; OB 4185 qdont ilf cbardont

4260 4265 clr2eol lela 1$20. 4270 ata (rpnt), y; 4275 lela backrnd; 4280 sta (cpnt),y; 4285 iny 4290 cpy lllx; 4295 bee clr2tol 4300 beq clr2eol 4305 bcs jcbrdont

ci:IDqt

M! mo ; BA 4315 ; -- cursor to bottom ••

PG 4105 ; -- quote t099lt -·

II

4190 ; 4195 -- pant on ctrl code1 -4200 . U05 nncodta Clip lctrlut 4210 beq clr2tol ms Clip lctrlla mo beq botht.e 4225 Clp lctrlvcr 4230 beq clr2bot 4235 Clp lctrlber mo btq clr2top 4245 JIP upordown check for cue

kty > 128 •ctrl·iDa preastd'

4325 bothome ldy IO mo 1c1z 124 4335 jsr $e50c; JUJP into clear acretn 4340 jcbrdont JIIP chardont 4345 4350 · -- clear to bottoa of scnen -4355 4360 clrZbot ldx l $19 4365 c2bl dn · f roa tht bottoa up 4370 cpx row 437 5 btq c2b2 mo lda llynx,x cltu lint linb 4385 ora l$80 4390 sta llynx,x 4395 )II clrllce· clurlint UOO llli c2bl· always 4405 c2b2 )Sr $t9f0; rtstt poiJlters 4410 )It $ta24 4415 ldy colUID; clurlinttbt 4420 ~ clr2eol; CUIIOII on 4425 ; 4430 ; -- clear to top of screen •• 4435 ; 4440 clr2top ldx l$ff 4445 c2tl i.Jlx; fr011 tbt top down 4450 lda llynx,x; clear line links 4455 ora 1$80 4460 at& llynx,x 4465 jar clrline; clear lint 4470 cpx row 4475 bne e2tl 4480 beq jcbrdone; always 4485 ; 4490 ; •• varioos patebta ••

FA em ;

II 4500 *= $fcff

MB 4505 jlp autoboot GC 4510 •= $fe6f HI 4515 J1P 11tclr AO 4520 *= $ff80 rs 4525 byte $10 YlrllOD bytt (1.0) IC mo : n 4535 -- sys65526 to reactiYatt •• co 4540 ; Lll 4545 ·= $fff6: laat jtJIIl table tlltry llG mo JIP wte1gton is norullJ onustd B! m5 : GE 4560 ; BL 4565 .and

ytp aopt

• iJlltrt aodt? nope

cltu insert clear quote always ' quote aodt' yep, clear 1t nope, 111: it

26

February 1989: Volume 9, Issue 3

I~


JP 1560 data 032, OS8, 248, 076, 017, 249 169, 001, 044, 169, 000, 076 JB 1570 data 140, 248, 173, 001, 002, 240, 094, 032, 077, 249, 164, 183

Listing 2: Run this to set up the Kernal ROM from BASIC Ell 100 gosub 190 : CO 110 1y1 384 : 8C 120 goscb 190 : II 130 if ~ goto 120 : OC 140 poke 1,53 : AI

»: 08 Jl

PI Jl Ill

Nl 117

Pll

GB II .II OJ

Pl II ll

MI

cr. PI IJ D Jl All

01

00 00 II IC

8C JP

OM Ll IP

Ir

00

cr lP

DI lC

rr

~

ll

OI IL LI EM Bit

ll Jll Ctl

ll r1 JJ

JB

II 1C PD II Ml Dl

Pr Jl

II CJ

II II 8D

ISO 1y1 65526 160 end 170 : 180 rill ttad I , D; pokt D bytes stuting It I 190 rtld a 200 if a:-1 then q-1: retora 210 read n 220 for i:a to a+n·l 230 read b: poll i,b 240 next i Ho retUill 260 · 1000 data 384 28 rta poke 28 byte rca copy 1010 data 169 160, 32, 135, I, 169 224, 1020 data 252, 162, 32, 177, 251, 145 251, 1030 data 202, 208, 244, 96 1040 : 10SO data 57818,1 :rem 1 byte at $tlda 1060 data 008 1070 data 57896,3 r• 3 bytes at $t228 1080 data 004, 160, 007 1090 data 58U3, 2 r• 2 bytes at $tUb 1100 data OS2, 247 1110 data 58504,14 :ru 14 bytes at $t488 1120 data 203, 069, 082, 078, 065, 076, 043, 1130 data 048, 032 1140 data 58551,13 rta 13 bytes at $e4b7 1150 data 076, 079, 065, 068, 034, 048 058, 1160 data 049 1170 data 58858,6 r• 6 bytes at $t5ta 1180 data 076, 09S, 246, 234, 162, OOS 1190 data 59173,5 :rem 5 bytes at $t725 1200 data 076, 025, 250, 234, 234 1210 data 59346,2 .r• 2 bytes at $e7d2 1220 data 058, 250 1230 data 59746, 3 r• 3 bytes at $t962 1240 data 076, 008, 2SO 1250 data 60482,1 :r• 1 byte at $tc42 1260 data 132 1270 data 60536,3 ·r• 3 bytes at $te78 1280 data 023, 021, 026 1290 data 60543,1 rta 1 byte at $tc7f 1300 data 025 1310 data 60587,1 : r• I byte at $tcab 1320 data 022 1330 data 60599,1 :rea 1 byte at $ecb7 1340 data 133 13SO data 60647,4 .rwa 4 bytes at $ece7 1360 dlta 013, 082 085, 078 1370 dlta 62158,3 . rta 3 bytes 1t $f2ce 1380 data 076, 113 242 1390 data 62347,2 :ra 2 bytes at $f38b 1400 data 076, 019 1410 dat1 62777,2 :rem 2 bytes at $f539 1420 dlta 076, 019 1430 dlta 63066,2 rta 2 bytes at $f65t 1440 dlta 234, 234 1450 dlta 63071,39 :r• 39 byttl at $f65f 1460 data 201, 131, 208, 003, 076, 238, 229, 1470 dlta 013, 208, 006, 201, 133, 208, 017, 1480 dlta 189, 182, 228, 157, 118, 002, 202, 1490 dlta 076, 254, 229 1500 dlta 63276,876 .rea 876 bytts at $f72c 1510 dlta 032, 083, 228, 169, 008 133, 190 1520 dlta 201, 064, 240, 114, 201, 062, 240 1S30 data 201, 037, 240, 038, 201, 094, 240, 1540 data 201, 061, 240, 029, 201, 033, 240, 1SSO data 076, 124, 16S, 076, 089, 249, 032,

Transactor

NL 1580 data 200, 169, 044, 153, 000, 002, PB 1590 data 132, 183, 032, 060, 249, 169, to 1600 data 208, 014, 032, 22S, 255, 240, XI 1610 data 25S, 076, ISO, 247, 032, 066, PP 1620 data 249, 173, 001, 002, 240, 038, Ml 1630 data 240, 03S, 201, 036, 240, 054, E! 1640 data 249, 160, 000, 18S, 001, 002, ca 16SO data 208, 245, 032, 174, 2S5, 076, CB 1660 data 094, 169, 124, 141, 004, 003, GD 1670 data 002, 002, 041, OIS, 133, 190, Bl 1680 data 032, 060, 249, 169, 003, 133, MJ 1690 datl 032, 165, 2S5, 133, 159, 166 lJ 1700 data 238, 166, lSI, 164, 1S9, 032, Kl 1710 datl 255, 032, 165, 255, 240, 006, DC 1720 data 032, 058, 248, 032, 225, 2SS, DL 1730 data 032, 066, 246, 076, 242, 247, lL 1740 data 050, 249, 160, 000, 185, 104, 01 17SO data 031, 208, 24S, 032, 174, 2SS, OL 1760 datl 135, 248, 032, 168, 255, 200. 8N 1770 data 255, 076, 017, 249, 077, 045, Bl 1780 data 208, 173, 002, 007, 073, 004, EM 1790 data 169, 065, 141, 001, 001, 032, PO 1800 data 045, 069, 000, 006, 133, 18S, Bl 1810 data 044, 173, 000, 002, 201, 061, LN 1820 data 244, 176, 047, 165, 144, 041, i l 1830 data 201, 037, 240, 043, 165, 174, 8A 1840 data 032, 089, 166, 032, 051, 165, OM 18SO data 201, 094, 208, 019, 169, 000, FC 1860 data 174, 167, 170, 208, 012, 162, BA 1870 data 128, 169, 2SS, 133, 058, 108, ll 1880 data 136, 132, 187, 136, 185, 001, 8M 1890 data 003, 200, 016, 244, 162, 000, 00 1900 data 240, 010, 201, 034, 240, 006, IX 1910 datl 138, 168, 132, 183, 096, 032, BG 1920 datl 255, 169, 111, 032, 150, 2S5, IF 1930 datl 201, 013, 240, 004, 165, 144, JL 1940 data 242, 247, 165, 186, 032, 177, BM 19SO data 169, 096, 133, 185, 032, 213, ~ 1960 data 165, 185, 076, 150, 255, 032, IG 1970 data 169, 000, 133, 144, 096, 173, C! 1980 data 240, 033, 201, 042, 240, 035, IB 1990 data 176, 193, 141, 032, 208, 112, l8 2000 datl 10S, 010, 141 032, 208, 141, IN 2010 data 159, 249, 076, 242, 247, 169, ~ 2020 data 165, 165, 034, 133, 04S, 165, KL 2030 data 076, 242, 247, 169, 128, 141, 1M 2040 datl 208, 234. 234, 141, 033, 208, LN 2050 data 014, 076. 210, 255, 032, 044, LN 2060 data 249, 032 034, 228, 162, 2SI, BG 2070 data 141, 002, 201, 001, 240, 006, ll 2080 data 070, 002, 032, 231, 255, 160, PL 2090 data 001, 002, 208, 247, 032, 228, PB 2100 data 094, 044, 169, 037, 141, 000, BP 2110 data 227, 048, 058, 063, 042, 000, PO 2120 datl 133, 172, 120, 169, 253, 141, !I 2130 data 127, 240, 244, 088, 096, 016, OA 2140 dlta 240, 003, 076, 042, 231, 165, CB 2150 data 216, 133, 212, 240, 006, 16S, 00 2160 data 168, 230, 201, 021, 240, 015, Gr 2170 data 240, 035, 201, 026, 240, 060, Gr 2180 data 209, 173, 033, 208, 14S, 243, CF 2190 data 240, 176, 007, 160, 000, 162, ID 2200 data 230. 162, 025, 202, 228 214, GG 2210 data 149, 217, 032, 2SS, 233, 048, II 2220 data 234, 164, 211, 076, 077, 250, ca 2230 data 128, 149, 217, 032, 2S5, 233, LG 2240 data 64767,3 :rea 3 bytes at $fcff IG 2250 data 076, 184, 249 FE 2260 data 65135,3 :rea 3 bytes at $fe6f CF 2270 data 076, 002, 250 IS 2280 data 65408,1 :ra 1 byte at $ff80 Cl 2290 dlta 016 EG 2300 data 6S526,3 :r.. 3 bytes at $fff6 PI 2310 data 076, 044, 247 BG 2320 data ·1

set QP rca copy routine rwa copy rou to ru rta copy a chunl: for rep1ac:uent rca code rta loop till Ill rca cbunl:s copitd rt• 1ntch out rou : rea actmtt vtdgt rtm

to 384 160, 0, 132 251, 133 200, 208, 249, 230, 252 routine

043, 032, 214, 049, 046 042, 034, 044, 056, 044

201, 132, 208, 004, 162 162, 009, 120, 134, 198 208, 247, 076, 205, 229 096, 110, 037, 007, 077,

166, 201, 201, 201, 249,

122, 095, 047, 035, 032,

208, 240, 240, 240, 089,

036 030 033 026 225 27

200, 025, 009, 246, 201, 201, 032, 242, 169, 032, 156, 144, 20S, 032, 240, 169, 248, 032, 192, 087, 141, 007, 032, 240, 016, 133, 032 133, 030, 000, 002, 185, 200, 084 032 240, 25S, 243, 228, 001, 201, OC2. 033. 001, 03S, 138, 169, 247, 1S4, 201 2S5, 248, 002, 032, 000, 003, 216, 212, 201, 076, 200, 024, 240, 240. 162, 228,

169, 032, 032, 076. 035, 092, 168, 247, 165, 122, 032, 208, 189, 210, 004, 013, 032, OSO, 005, 000, 002, 239, 077, 002, 208, 045, 142, 157, 044, 003, 240, 002, 232, 249, 165, 242, 169, 165, 248, 002, 048, 002, 208, 168, 133, 002, 153, 032, 169, 004, 200, 165, 076, 159, 220, 076, 240, 208, 022, 068, 196, 032, 011, 032, 25S, 214,

083, 210, 165, 104, 240, 240, 255, 076, 141, 166, 165, 039, 169, 25S, 169, 076, 168, 249, 208. 006. 007, 076, 249, 169, 047, 165, 166. 141 162, 160, 029, 002, 224, 165, 2S5, 032 111, 186, 165, 240, 144 240. 076. 14S, 046, 169, 032, 191, 001 240, 185, 002, 068, 249, 173, 212, 008, 244, 240, 236, 213, 012, 181, 240, 232, 208,

153, 255, 255, 247, 049, 025, 200, 011, 005, 076, 2SS, 191, 032, 076, 002, 210, 2S5, 160, 245, 025, 141, 066, 166, 000, 173, 175, 173, 000, 028, 002, 201, 157, 037, 186, 032, 111, 076, 032, 190, 209, 197, 007, 242, 043, 032, 000, 210, 227, 133, 004, 2S3, 208, 247, 108, 001, 231, 169, 230, 029, 169, 144, 229, 217, 233, 181, 242,

000, 165, 032, 032, 201, 032, 196, 249, 003, 123, 133, 156, 032 029, 208, 25S, 200, 000, 032 032, 166, 208, 043, 032, 000, 133, 000 002, 044, 132, 034, 001, 208, 032, 210, 255, 147, 180, 133, 201, 201, 024, 247, 032, 089, 141, 255, 032, 002, 208, 249, 003, 076, 002, 220, 201, 000, 212, 201, 032, 242, 076, 009, 032, 217, 240,

002 144 210 077 C81 050 183 240 173 164 158 208 210 248 201 032 192 185 174 066 001 077 164 158 002 046 002 076 162 188 240 002 238 180 2SS 076 2SS 255 186 068 060 152 032 051 166 032 169 1S9 173 034 153 169 134 160 201 023 133 076 02S 14S 240 168 128 036 009 206

February 1989: Volume 9, Issue 3


Far-Sys for the C64 Reach out and touch some ROM • by Richarc1 Curcio

The Commodore 64 contain' 20K of RAM normally unusable from BASIC. Using machine language, however, the BASIC Interpreter and Operating System (Kemal) ROMs can be switched out to allow access to 16K of RAM 'under· them. Another 4K lies under the 1/0 and character ROM block. Many programs have appeared that use thi~ extra RAM as a storage area or bit-map screen. The utility presented here, Far-Sys, provides BASIC with a mechamsm for calling machine language located in the~e 'hidden' areru.. Additionally, the utility provides a means for h1dden \1L to access R0\1 routines.

effect. The only reason to use this bank would be to more conveniently disable tRQs and pass register values than the normal svs statement provide~. Bank I: $AOOO- $BFFF RAM (BASIC switched out.) $0000- $DFFF l /0 SEOOO - SFFFF Kemal ROM Bank 2: Same a~ BanJ... I except; $0000- $DFFF Character ROM Bank 3: $AOOO- $BFFF RAM SDOOO- $DFFF JJO SEOOO - SFFFF RAM (BASIC and Kemal switched out.) Bank 4: Same as Bank 3 except: SDOOO- SDFFF Character ROM Bank 5: Same a' Bani.. 4 except; SDOOO- $DFFF RAM (all ROM and l/0 switched out.)

Using Far-Sys

The synrax for using Far-Sys is SYS FAR, TARGET {, a }(, x} {, y} (,s}

FAR is the addres' where far-Sys is located and TARGET is the address of the ML under R0\1. The arguments a, .x, y, and s are optional and, if present, will be loaded into the accumulator, x. y, and status registers respectively. Any argument may be omitted by placing a comma in the corresponding position. Omitted arguments retain the values SYS picks up from locations 780 to 783 (SOlOC- S010F). For example:

Note that if the machine is already configured with BASIC or BASIC and Kemal in RAM. Banks I or 3 also cause no change in configuration. Why

SYS FAR, 45056,,8

The different configurations provide a great deal of Oexibility. Using Bank I, a routine under the BASIC ROM could change colour memory or control the SID chip since vo is visible to the CPU. Using Bani.. 4, a routine under the Kemal could copy the character ROM into RAM. llowever. with increased versatility comes increased chance of error. Storing data to the RA\1 at the soxxx block while vo is present could crash the system. Attempting to call a routme under the Kemal when in Bank I or 2 could have the same effect. Far-Sys does not compare banks and target addres~c~. u~c caution.

execute!. a routine at SBOOO passing 8 to the x register. Regardless of the value as!>igned 10 sr, Far-Sy~ disables LRQs before ROMs are switched out. Upon return to BASIC, addresses 780 to 783 may be PPEKed for results, just like a normal SYS statement. One POKE i!) neces!>ary before using Far-Sys: POKE FAR +6, BA"'K. The effect of thi!> poke is similar to. though much simpler than. the BANK command in BASIC 7.0 on the CJ28. FarSys pro\ ides six 'banJ...s' numbered 0 to 5. These banks should be thought of as temporary configurations m effect only during execution of Far-Sys code. If too large a value is POKEd into FAR +6, Far-Sys will stop with L!I.DEF''-DSTATEMENTERROR.

Using FARJSR Within Far-Sys i'> \Orne code to allow \1L in the hidden areas to call R0\1 routme!-t when the ROMs are switched out. Your hidden routine \hould folio~ these step~:

Bank 0: Thi~ "equiValent to the configuration in effect before executing SYS FAR. This may not be the same ru. the 64's default configuration since a modified BASIC in RAM could be in Transactor

so many?

I. Store the

addre~s

you wish to call in low/high-byte format in zero-page locations Sl4/Sl5.

28

February 1989: Volume 9,1ssue 3


2. Pre-condition any necessary nags by ~loring the proper value in S030F. One way to do this i~ PHP, PLA then ORA or AND to set/clear the selected bit(s). Do IUJt cu while the Kernal or 110 is 1101 presell/!

3. Store any required a. x, and y value!> in S030C- S030E. 4. JSR FAR +3, where FAR is the beginning of Far-Sys.

The C64 will be reMored to the configuration in effect before BASIC executed SYS FAR (Bank 0). N. with JSRFAR and JMPFAR in the C 128 Kernal, the user should ensure that IRQ!> and NMt~ are handled properly. Step 2, above, is critical in this respect. Far-Sys always performs SEJ before switching out RO\ts and CLI after switching them back, but fARJSR doesn't CLI after switchmg R0\.1s in. (N\1ts arc not affected by SEt and cu instructions. More about NMts at the end of this article.) If interrupts are necessary, this must be handled by the value in S030F. When the called routine returns to FARJSR, SEJ occu~ before ROM~ are again switched out. The calltng routine can then examine S030C-S030F for results, though x and y can be examined directly. These locations will usually be over-wrillen when Far-Sys returns to BASIC.

PLOT routine to position the cursor mid-screen and the BASIC ROM routine, UNPRT which PRIN'nl a two-byte integer contained in x/a. (See the source listing for Underkem.) Control then returns to BASIC via Far-Sys and pauses a while to allow the effects to be ob erved. After the delay, 256 路A's are PR!'.'T ed and, after another delay, Bank 5 b set up and the code at 53248 (SDOOO) is called. This increments the first 256 screen locations, changing the 'A's to 'B 's. Writing hidden ML There are several ways to write programs under ROM. The code should first be assembled and tested in normal RAM, if pos~ible. If the ML is relocatable, with no absolute JSRs, JMPS, LoaD~ or STores within itself, after DATAfication a BASIC Loader can change the start addres~ and POKE the code to RA.\1 under R0\1. If not rclocatable. a machine language monitor can be used to manually change the absolute addres~es of ML assembled in normal RAM. This is tedious at best. The most convenient method is to use an assembler that writes object code to di'>k. Load " prog", 8, 1 will bring the ML into hidden RA\1, excluding D-blocJ... which can be POKEd as de:.cribed above. For debugging purposes, there are a few machme language monitors available that can perforn1 their operat1ons on hidden RAM.

Unlike the C128's JSRFAR, Far-Sys and FARJSR always restore the calling configuration - in either direction. The programs Program I is the BASIC loader for Far-Sys. It is designed torelocate the ML if the start address (f\R in line 11 0) is changed to a location other than 51200. Far-Sys can be placed an)where in normal or 路open' memory. If placing Far-Sys at the top of BASlC program ~pace, the top of memory pointer in locations 55-56 should be lowered by at least 157 bytes.

Details and possibilities

Far-Sys is arranged so that pans of it may be accessed by other programs. See the subroutines labeled "twobyt ". "combyl'' and "getargs" in the source listing. It is not neccessary to use FARJSR if a routine under BASIC needs to call a Kernal routine and the machine is in bank 1 or

(possibly) 2. However, a routine under the Kernal or D-block must use FARJSR to call any ROM routines.

Program 2 is a Demo-Test program to confirm that Far-Sys is functioning proper!). Far-Sys must be located at 51200 for this demo. A short program is POKEd into RA\1 beginning at 61440 under the Kernal. No bank switching is necessary to POKE to thb area, or to locations under the BASIC ROM. Another short program is POKEd to D-block RAM beginning at 53248. Surpnsmgly. Ibis area can be POKEd from BASIC! The '>teps to do !>O, 3!. shown in lanes 200-230 of the demo. are 1m1lar to those "hen BASIC i!> used to copy the character ROM to RAM. First, IRQs are disabled by ma!oking the timer interrupt bit in CIA 1. (Any other sources of interrupts ~hould also be disabled.) Then, UO is switched out by POKEmg the 6510 port at location I When character RO'.I is switched in, D-block behaves like the other ROM reg1ons: POKEs 路fall through' to the underlying RAM. Like the other ROM locations, MI is still necessary to read this RAM. D-block can be read only when all ROM is switched out.

By changing the contents of the locations labeled "cnfg'' and "ma~J..", it is possible to return to a different configuration though it's hard to see a reason to do \O. When a hidden routine is called. four Mack po!>itions are used: two to return to Far-Sys and two to return to BASIC. Similarly. usmg FARJSR uses four more stack positions. It should be possible to re-write Far-Sys as a wedge or TransBASIC module, with an accompanying BANK command. I'm sure that Transactor readers can devise many uses and variations of this small but useful progmm.

IRQs, NMis and C IAs As stated earlier, Far-Sys always performs SEt before R0\1S are switched out. Since 1/0 and the Kernal are present in bank I. if a routine under BASIC requires tRQ'>, cu will of couf\C take care of them. Also. the 6526 CIA (Complex Interface Adapter) and the VTC-ll each contain an JCR, Interrupt Control Register. which can be written to enable or disable IRQ source\.

The BASIC demo then clears the screen. sets up Far-Sys for Bank 3 and executes the ML at 61440 (SRlOO). This code increments the border color, and uses FARJSR to call the Kernal Transactor

29

February 1989: Volume 9, Juue 3

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


SD 320 data 54,225, 32, 71,225,120,173, -8 EF 330 data 133, 1, 96, 32,253,174, 32,138 J! 340 data 173, 76,247,183, 32,121, 0,240 lB 350 dat a 12, 32,253,174,201, 44,240, 5 00 360 data 32,158,183, 56, 96, 24, 96, 32 BF 370 data-105,144, 3,142, 12, 3, 32,-105 P! 380 data 144, 3,142, 13, 3, 32,-105,144 IP 39n data 3,142, 14, 3, 32,-105,144 3 !D 400 data 142, 15, 3, 9,,999

NMts are more difficull to deal with. As the name suggests, Non-Ma! kable Interrupts cannot be d1sabled by instructions, though sometimes the hardware respons1ble can be. CIA-2 at sooxx generate~ NMts relating to <;erial 110 and RS-232 activity. But the tCR b not liJ..c a nonnal memor) location. Writing to it enables-disable~ interrupt ~ources. but readmg it reveals \\hich source generated the mterrupt, not the enable-disable status. It's like a read-only reg1ster and a \\rite-on I) register containing different mformauon at the same location. There is no wa} to determine ""hich NMt sources had been enabled so that the) may be rt>-enabled after di'iabling them. Far-Sys makes no attempt to deal with !\\.it~ on a 'umversal' basis. It is left to the •user to handte N\.1ts properly in a given situation. ot eas}.

I

I

Progra m 2: Far-Sys demn'test (Far-Sys must be at 51200) !!

IIA Sll PC HB 0C IL

The real fly in the ointment is the RESTORE key. Unlike the vtc-20, where the RESTORF J..ey connects to a VIA chip, where the resulting NMT can be masked out. the C64 's RESTORE key connects to a one-shot which in tum connects directly to the NMl line (through an inverter). If thi~ or any other NMt (or for that maller, IRQ) should occur whi le Far-Sys or any other routine ha!> switched out the Kemal, the computer will crash. Changing the Kern aI RAM vector~ at $0314-$0319 won't help. because the microprocessor first looks to the 'hardware vectors' in locations SFFFA-St·Ht· 10 find out where it should go when an interrupt or reset occurs. If the Kcmal ROM isn't there, the 6510 will use whatever is in the corresponding RA.\.1 locations to find its way and will more than likely become hopele ly lost.

LJ

GM llG BN OG IP JD

OM 00 CA JL

Gl liM

Fl GO U:

PL CI JJ

There is a partial solution. though. New vectors could be \Hitten to the RA.\1 under R0~1 at SFFFA-SFHF directing the 6510 to a routine to save the regil>ters and ~\\itch the Kemal back in and handle the interrupt. or ignore 11. (If the RAM under the Kemal 1s used for a bit map. 8000 b> res are required, so 192 are still available for 'hidden vectors' and interrupt handling. Make certain any hi-res clear command clears only the first 8000 bytes. not the full 8192.)

8J

FF Rl CJ

OS IF LN Nt M!

100 res *** far·ays delo/test ••• 110 f&r-51200 120 ck:O 130 readd:lfd=-1tban1SO 140 ci acktd:qoto130 150 ifcio6830thtoprint "data atat-nt error!" :end 160 restore 170 rem *** poke rout1ne to $fOOD *** 180 fori=Oto5S: readd:poke61440+i,d:next 190 recn *** poke routine d-bloci •u 200 poit56334,pttk(S6334)and254:ru turn off tillar irqs 210 poke1,pttk{l)and2Sl: ru twitch in cbr r011 220 fori=Oto8:readd:poie53248+i,d:nt xt 230 poie1,peei (1)or4 :rea put back i/o 240 poke56334,pttk(S6334)or1:rtll enable irq 250 printchr$(147); 260 poke far+6,3:aya far,61440:rll execute routine UDder keroal 270 qosub320 280 printchr$(19) ·: fori=Oto255:priot'a*;:next 290 qosub320 300 poke far+6,S:aya far,53248·rea tltCUte routine iD d-bloci 310 tnd 320 for t=OtolSOD-oext 330 return:rea waste 1011 ttll 340 t11 *** uodtritro ••• 350 data 238, 32, 208, 169, 2~5.160, 240,132 360 data 20,133, 21, 24, 8,104,141, 15 370 data 3, 162, 10,160, 17, 32, 44,240 380 data 169,189,160,205,132, 20,133, 21 390 data 8, 104,141, 15, 3, 169, 2~~. 170 400 data 32, 44,240, 96,141, 12, 3, 142 410 data 13, 3,140, 14, 3, 76, 3,200 420 res *'* 110'/t under d-bloci *'* 430 data 162, 0,254, 0, 4,232,208 440 data 250, 96, -1

I

'I

i '

Program 3: Source code for Far-Sy1. Program 1: BASIC loader for Far-Sys PI DA Sll IJ IIC Jr

PB DB PP DC CO

rr

JJ MB Bl ID GO BB 10 IC 80 81

I«)

IG CJ

100 rem *** far-aya *** 110 far•S1200:rem relocatinq ••• 120 ci=O 130 readd:ciaci+d:ifd•999thtn1SO 140 qoto130 150 ifci<>11342thenprint'*** error io data ***':end 160 reatou:aa=far 170 rudd:ifda999then220 180 ifd=>Otbanpokm,d:qoto210 190 adafar+&bs (d) haad/256:1-.d-int (td/256) *256 200 poiesa,l:aa=sa+1:pokua,b 210 aa•~t+1 :qoto170 220 prlDt*far-aya 1Ditalltd far to'aa 230 data 76,-11, 76,-71, 0, 0, 0,108 240 data 20, 8,255,246,242,245,241,244 250 data 32.-96.174, -6,224, 6,144, 3 260 data 76,227,168,165, 1,141, -7, 61 270 dat a -12,141, -a, 32,-124 32,-89,173 280 data 15, 3, 9, 4, 72,173, 12, 3 290 data 174, 13, 3,172, 14, 3, 40, 32 300 data -9, 8, 72,173, -7,133, 1,104 310 data 40, 88, 96,173, -7,133, 1, 32

Transactor

MB

BB AJ

Ill Ef[

tal rt IP Ill

OG

a pp

OG

PC

1000 aya999 1010 : 1020 ;power assembler (buddy) 1030 ; 1040 *• $c800 1050 : 1060 ·1070 : 1080 ;------------ far-aya -----------1090 : 1100 ; ayata roat inu 1110 ; 1120 cbrqtt : $0073 1130 chrgot : $0079 1140 ell~ = $aefd 1150 fiJIII1::1 = $ad8a 1160 qetadr ,. $bm 1170 ooebyt • $b79e 1180 •

BX CB 111 1190 ·--------------------------------GC 1200

BC 1210 fusys liP ntup JD 1220 farjar JJ11P relay !I 1230 .

30

February 1989: Volume 9, Issue 3

!:


IC 1260 blnk .byte 0 JL 1250 cnfg .byte 0 II 1260 usi byte O Ill 1270 ; All 1280 jU~per liP ($0014) li 1290 . 01 1300 ;table of nlau to L1 1310 ; D 1320 asitbl =• 1D 1330 .byte 255 IIJ 1340 byte 246 lD 1350 .byte 242 l!C 1360 .byte 245 All 1370 .byte 2U BL 1380 .byte 24! !0

mo :

Bit 1960 CXIIIIbyt jar ch:qot

;poke 0-5 htrt ; current con! ig nn config

.u m FG

00

oc 1l LP IIG

' and v1tb 6510 port

bani bani bani bani bani ·blnk

012345-

PA

no change bu . oot itra ' bu . oat, ktra ' bas ' kern oat, bu ' kern out. all na

CI

1/0 111 chr . in 1/o 111 chr. in

DI IJ

.u EC Ill BI liB

00 1400 ; Ill 1410 setup jar twobyt ; read addreu fro. basic tert GB 1420 : ldl blnk DB 1(]0 : cpa l$06 Ilt lUO : bee ok DL 1450 bad jlp $a8e3 ;dlsplay ' undtf atatuent' if blnk>5 GI 1460 oi lela $01 LI 1470 : sta cnfg PL 1480 : and 111itbl, a ;111si bits appropo. EM U90 : at& 111i cr 1500 ; 18 1510 : jar getatqs GG 1520 ; II 1530 long jar rauoat II 1560 : lda $030f ;get arreg Ill 1550 : ora l$06 ·tnaurt no uq vhtn plp Ill 1560 : pba FC 1570 . lds $030c II 1580 : ldl $030d 1590 : ldy $030. Cl! 1600 : p1p ; u per abo'ft L1 1610 : ·goto target )If jllllfllr Ill 1620 ; PF 1630 ra.sin pbp ·bacl: but 88 1640 : pba ;sa'fl flags ' ace . 10 1650 : lda cnfg ro 1660 : ; rau in sta $01 LF 1670 : ph tB 1680 : plp lF 1690 : eli BL 1700 : rta EC 1710 : IIG 1720 ;routine to allow ' hidden' code to call roa routines . JA 1730 ;assumea addltaa in $16/15, a, x, y and ar in $030o - $030f . EM 1760 ;al.ao asaumes 'cnfq' reatorea toll and 'aaak' is valid I!! 1750 ; m 1760 relay lela cnfq DB 1770 : at& $01 ; rut ore ra.(s) IP 1780 : jar $e136 ;part of 'sya•. loads regs, j1llp ($00U) GF 1790: jar $1147 ;atoru rega. 08 1800 ; PIC 1810 rcuoat 11i JL 1820 : lela lUi lll 1830 : sb $01 Ill 18t0 : rtl AL 1850 ; !!! 1860 ; look for OCIU , get upremoo 0 - 65535 fro. bas1c test Dl 1870 ; IC 1880 twobyt )Sf chico. IL 1890 )It f-Ull : tYal llprtlllOG !B uno . )lip gebdr :two bytea 10 $14/15 II) 1910 ; II 1920 ;tlus routlDt retuma w1tb carty clear 1f tod of stataent or c:oa:a GL 1930 ;followed by cc.~, carry 11t and one byte in 1 if 11111. upreuion. lA 1940 ; EB 1950 ;

m LL

AM

PB MN MA OM

FP CP

llC

II

Tra nsac tor

1970 1980 1990 2000 2010 2020 2030 2040 2050 2060 2070 2080 2090 2100 2110 2120 2130 2140 2150 2160 2170 2180 2190 2200 2210 2220 2230

;current chr. btq CCMrit ;end of stat~~ent Jlr chl:ca. ; look for OQIU llld ntxt chr. Clip l$2c ; enotbtr '' btq ca.elit ;yeah jar ooebyt ; oo, get 'falUe

: : : : : : lltC . rta ca.e•it clc rts ; ; rootine to rud a, a, y, and ar ;'falats fro. blue tut. ; getatqs JSr COibyt ; tint pma (. a) : bee aget ; Just a COIIl get ntxt : sta $030c ;ureg aget jar cC.Cyt ; neat pu u (. 1) : bee yget : stl $030d ;ureg yget jsr colbyt ;get .y : bee aget ;another CoeD&'? : stx $030e ;syreg sget jar cOIIbyt ;get .ar : bee eareg : stx $030f ; arreg eareg rts ;

I

Program 4: Source code f or "underkem" in demo/test IG 100 sys999 !0 110 ; Ill 120 •• $!000 DO 130 .obJ ' underurn• CA 140 . Ill 150 ; Ill 160 border • $d020 ED 170 ftr)Sr • $cl03 IC 180 . FP 190 btqin inc border BI 200 . lda l$ff Ill 210 : ldy l$f0 IJ 220 . sty$14 OJ 230 : sta $15 u 240 : clc BI 250 : pbp Jll 260 : ph PJ 270 : at& $030f llB 280 : ldl 1$0a IF 290 : ldy l$11 Cit 300 ; IG 310 : jar regfar GL 320 ; BP 330 : lda l$bd AD 340 : ldy l$cd PB 350 : sty $14 FB 360 : It& $15 D 370 : pbp BF 380 : pla !0 390 : ata $030! All 400 : ldl l$ff IJ UO : tu KB 420 . Ill 430 . )It regfar oc ((0 · D 450 . rts CB 460 ; Cl 470 regfar sta $030c GJ (80 : stl $030d Kl' 490 : aty $030t az 500 : liP farjar Ill 510 .end

,

I

-

31

; not to call plot :will sat cursor :irqs not needed ;atatua reg. ; row 10 ;col 17 ;ace. not needed ; basic linprt

@ $bdcd

;no change in status reg. ;two-byte inte:qu in 1/a ; will print 65535 ; y not

DtSilld

;bacl: to far-aya ; prepare register• ; S111CI VI )It d bert ;n can aafely ... ~ February 1989: Volume 9, Issue 3


C128 Parallel Printer Interface

r

Emulating a parallel interface via the user port

• •

by Bill Brier Copyright© 1988 Bill Brier

The Commodore C 128 ha~ proven to be a popular machine for small business use. primarily becau~e of its low cost. powerful BASIC 7.0 programming language and its business-oriented hardware features.

The Centronics Parallel Interface The connection scheme of the Centronics parallel interface is: Cl2B Oser Port

Unfonunately. a hardware feature that the C 128 doe~n 't have is a parallel printer output (a Centronic~ interface). Since the Centronics-l.tyle printer interface i~ pretty much the standard in the businel.s world, lad. of such an output \\-Ould seem to limit the usefulness of the C 128 as a business system.

Pin

L

*PA2 PBO PBl P82 PB3 PB4 PBS PB6 PB7

B

.E'LAG2

K

c D

One solution to th1s limitation i., to buy a commercial printer interface. for \\hich one can expect to spend anywhere from 50 dollars to over 120 dollar'>. However, many of the available interfaces offer frill features that aren't necessary for most business printing applications.

E F

a J It

A less expensive solution is to make the C 128 user (RS-232) pon act as a parallel printer output. This ~olution is practical if the computer's RS-232 functions are not needed. Employing the user port as a parallel printer output requires that one buy or fabricate a ~imple cable to connect the port to the printer and wedge a driver program into the computer's operating system.

A

GND (siqn&l)

Data Dir . -+ -+ -+ -+ -+ -+

-+ -+ -+

·-

Pin l 2 3 4

5 6 7 8

9

10 16 17 31

O..ignation .~

Dl 02 03 04

05 06 07 DB •AC!Cnowledqe GND (signal) GND (shield) •RESET

The above connection chan was worked out for the popular Star Micronics printers. You might want to check your printer manual for possible differences in the shield GND and RESET connections. On some printers pin 33 is the shield Gr-.;o instead of pin 17. The balance of the connections are standard for all parallel printers.

That is what this anicle is all about. For the benefit of those who may nor be familiar \\-ith the Cenrromcs printer mterface '>Y'>tem. r II describe how 11 operates. Then, 1"11 cover the hardware mterface and the tmplementation of the driver !.Oftware. the a<,sembler '>OUrce for which is given at the end of the anicle..

The Cenrromcs interface can be described as an eight-bit. asynchronou'> parallel bu'> -.y~tem "'llh hardware hand~haking. The term asynchrmwm mean~ that data b:rte~ are transmitted at random intcrvab (no clod. is used to s:rnchronize transmission). The term hardware handshakin!( describes the technique used to coordinate the computer and pnnter so that data is passed in an orderly manner.

(For ease in typesetting, th1s anicle uses the convention to indication low true <,ignals; for e~ample. •RESET means that RESFT 1s a low true signal.) Transactor

Designation

Printer

32

February 1989: Volume 9, Issue 3


I'

Referring to the connecllon chan. the connections D I through D8 on the printer (PBO through PB7 on the computer) pass the data byte (character) to he pnnted (D I i'> equivalent to bit 0). When the printer is not heing used the logic level<. on these line) w111 be of no concern.

will work wilh many word processors that offer a user pon printer output (it has been te~ted with SuperScript 128).

The STROBE line, which i\ controlled by the computer, b one of lhe two handshakmg hne~ that ~ynchronite the computer and printer. Normally, STROBE will be held at logic one (high or 5 volts). Thi~ 1~ why STROBE and PAl are ~hown as ·tow true' (and hence are astemked). The •ACKnowledge hne, which is controlled by the printer. 1s the other handshaking line. and it roo \t iII normally he held at logic one.

Quantity

If you decide to build your own interface cable. consult this parts list for the nece-.-.ary item\:

1

2 1 A/R

1

When the computer has a character to print. it will place the corresponding ASCII data byte on the data lines D l through D8. A clear bit will be reprc~ented by logic Lero (low or 0 volts) and a set bit will be represented by logic one.

4 1

The computer will then inform the prul!er that a character is waiting by momentarily bringing the •STROBl-' line low and then high again (the +StROBe hne is said to have been toggled). The pnnter will respond to the toggling of •STROBE by reading lhe data byte from the data lines.

A source for the 24-pin PC board connector is Jameco Electronics. The other nems can be readily procured from local source~ ~uch

as Radio Shack. The 36-pin plug~ type of cable that you mtend to u~e.

mu~t

match the

I ~uggest that you mount the 24-pin edge connector and the 36-pin female receptacle to oppo~ite '>Ides of a small plastic box (see photographs). This "ill make for <t more durable and professional-appearing a~sembl), <I'> well a\ giving you a place to mount the printer reset button.

When lhe printer has successfully read lhe data byte it will signal the computer by togglmg the .. ACKnowledge line in a manner s1milar to the wa) the computer toggled •STROBE. Typically. the computer w111 "~lit mdefinuely for thl'> to happen. Once the *ACI\JJO\\ ledge ha'> been received. lhe ne>.t chamcter can be transmitted.

Posiuon the 24-pin edge connector so that 1ls centreline "'1ll be 7/16'' above the b<mom '>Urface ol the pla.'>tic box. This wilJ cause the box to re~t on the !>Urface that -.uppon..., the computer, thus avoiding lhe application of stres~ to the connector and lhe computer's PC board. When connected to the Cl28. lhe box will be adjacent to the RGB receptacle. Sufficient room must therefore be provided for the RGB connector from the video monitor.

No error checking i~ implemented in thb ~yMem. If a b)'te is corrupted for any reason, the pnnter will not J...no\\ lhe difference. Corruption can be avo1ded by limiting the speed at which data b)'tes are sent, minimi1ing the distance between the pnnter and the computer, and by using shielded cable to connect the computer to the printer.

You may mount the 36-pin female receptacle in any convenient position on the oppo~ite s1de of the bo>.. Position the reset button so that it is pointed towards the left when the interface is plugged into the computer.

The •RESET line is not actually part of the data tran~mission ~ystem, as its only function is to cause a hardware reset in the printer when it is pulled low (it i~ nom1ally high). The actual effect of such a reset wi II vary from one brand of printer to another. In most ca~es. a relict w1ll clear the printer's buffer, rerum the head to the left margin and establish a new top-ofform ening.

To secure the connector and recepwcle to the box, fiN lay out rectangular slots on the long sides of the box, and cut the slots with a sharp modelhng kn1fe. Next, drill either #43 (4-40) or #36 (6-32) p1lot holes for the mountmg ~crews. using the connectors to lay out the hole\.

Now that l"ve acqua1nted you with the CentroniCS interface. I'U de~cribe lhe hardware connection of the printer and computer.

Then simply screw the machine screw~ mto the pilot holes to attach the connector and the receptacle. The screws "'ill coldflow the plastic and make the1r ov.n thread\. Once you have tested your new interface and ha\e verified that 11 works. you should use a '>mall amount of qu1ck-setting epoxy to permanently bond the connectors to the box for greater durability.

The hardware interface You may purchase or fabricate a cable to connect the C 128 user pon to lhe mput connector on the printer. If you elect to purchase a cable. verify that it conform\ to the connectton chart in above (Berkeley Softwork~ make~ a nice but some\\hat expensive cable called the geoPrint cable). This connection scheme Transactor

24-pin mal.e PC OO.rd edge uaer port connector 36-pin male p1uq to fit printer receptacle 36-pin f.,..le r.c.ptacle to fit 36 pin plug 12 conductor ahie1ded or 36 conductor ribbon cable Plaatic box, approx . 3-1/4" 1onq x 2-1/4" wide x 1-1/4" high 4- 40 or 6-32 x 1/2" SEMS h.ad machine screws SPST momentary contact printer reaet puahbutton

The use of the 36-pm receptacle makes it possible to detach lhe cable '>hould repair~ to the as~embl~ become: ncce,,ary. If 33

February 1989, Volume 9, Issue J

~==~--------------------------~--------------~~


you elect to hard-wtre the cable into the box you may omit the receptacle and one of the two 36-pin plugs. Be sure to provide adequate !>train relief for the cable. You will need to fabricate a cable to connect the receptacle on your new interface box to the printer itself. For residential use. I highl) recommend the use of shtelded cable. Aat ribbon cable, '-"htlc more economtcal to purchase and easter to work with. emit!> too much mdtauon and may cause radto and television interference problems. The length of a ribbon cable should be limited to six feet. When using shielded cable, connect the shield to the shield G\fO pin at the printer end only. Do not terminate the shield at the computer end. Simply insulate it and let 11 float. There ~hould be no connect1on between the sh1eld and the signal G'ID at any potnt. Thb 1s to prevent the shield from acting a~ an antenna for high-fre4uency noise. The length of a shielded cable should be limited to ten feet. When wiring up your cable follow the connection chart above and, if you are using shielded cable and soldered plugs, wire pin number for pin number. If you arc u~ing ribbon cable. note that the rwo plugs must both face the -;arne direction when the cable is folded up (sec the photograph of the cable assembly). If tn doubt. check your '-"Ork "'ith '>ome type of continuit) checker to avo1d an error.

The driver software presented here configure~ the uc,er port so that it emulate!. a Centronics printer output. This is accomplished by two machine language modules designated PPD6656 and PPD5632. PPD6656 conrains the pon driver code and operating system wedge.,, "'hile PPD5632 contains the code used to set up or deacuvate the driver module. Gpon acnvauon of the driver. the PPD5632 module is no longer required in memory. and rna> be over.' ritten "'ithout an) effect on the system. The driver is completely tran!>parent to BASIC and to an> machine language program that calls the OPEl\, CLOSE, CHKOUT, Cl RCHJ\' and CIIROl T (DSOl T) subroutines tn the Kemal via the jump table. Once 11 ha<, been \\-edged tnto the C 128 operating system. the driver will intercept calls to the above subroutine!. and direct output to the port pnnter when required. Programming con1>iderations w1ll be discussed below. The driver software's transparency makes it possible to address the user port as a printer using the standard Commodore file handling syntax. You may activate the driver as follows: • Load the PPD6656 and PPD'i632 modules tnto

RA'-1

0 with

BLOA D.

• Type S YS 5632,0N,LJ \\-here Dtv is the desired device number (4 through 7) of the port printer and LF is the linefccd enable flag. Set LF to I if you want a ltncfced ( \SCIJ I0) scm to the printer after each carnage return ( \SCJJ 13) is c;ent. Otherwise, set LF to 0 to suppresc; lincfeeds.

The reset button. "hi le not a required part of the interface. is a useful feature to have in Ca'-C )OU wish to reset the printer without c;huning tt off. It -,hould be "'1red so as to pull the •RF.SFT line to ~1gnal Gl\D when the button 1\ pressed.

If a de\ ice number of 0 is selected. the driver "'ill be di engaged from the operating S)\tem and will no longer function. Sclccttng a device number out~1dc of the allo\1-able range \\-ill rel>ult in nn ILLEGAl DE\ tCL NU'-iBER error. Never auempt to activate or deactivate the driver unless the PPD6656 module is in memory. Such an error may result in ~yMem fatal it}.

In fabricating your tnterface. )OU may be a-. crude or as refined as your time and talent!> pcmllt. Just be careful to avoid accidentally making incorrect connections or short circuits. The user port is directly connected to the Mos 6526 CIA #2 chip inside the computer. A winng error may damage the chip and render the computer inoperative. A Iso. never connect or disconnect the interface whi lc the computer and printer are tumed on. An accidental slip of the wrist may bridge connections together, with catawophic rc!>ult ....

Once a device number has been ass1gncd to the u~r port primer, any output to that device number will be intercepted and directed to the port. If you assign dcv1cc ~ to the port and you also have a primer on the serial bu~ that is device 4, the serial unit will not respond. You ma> !.till output to that primer via the lo~ -level Kcrnal serial bu~ routtnc~ (\1-hlch arc not intercepted).

Once the hardware has been connected. always power the printer firM. After it has gone through its power-up sequence you may tum on the computer. When enabled, the driver software will configure the U\er port for output and will set up the STROBE and \CKnov.ledgc ltnes to the proper logic levels.

••

When opening a ftle to the user port printer, you may use one of three ~ccondary addre'>s (SA) value\ a... part of the O PE!'. file syntax. The eflect\ of the secondary addre.,., are as follows:

The drher ofh\are The C 128 user port 1\ an ctght bit tO port with hard"'are handshaking pro\ isions. It i-; connected to the CIA #2 chip and is seen in the SDDOO range of the S)Mem map. Normally. this port ;., addrcs.,cd '"ia the Kcmal RS-:!32 routmes, and is typicall) uc;ed to commun1catc \\ tth a modem. If the port ts to be used for some other purpose, wttable driver c;oftv.are must be \1-rillen to implement the deMred functions. Transactor

SA

titECT

o

Only upper case characters are printed with

PETSCII/ASCII translation 5

Transparent mode with no translation .

the

linefeed settinq is iqnored. 7

Opper and lowar case c:ha.racters are printed with trant~lation.

34

February 1989: Volume 9, Issue 3 •


secondary addre~s other than 5 or 7 will be treated as an SA of 0. The transp:1rent mode (SA 5) results in characters being passed through wuhout alteration by the driver. The linefeed nag setnng (I F) will be ignored and a linefeed will not be sent after a carriage return. The transparent mode ~hould be u\ed for pnnung dot gmph1cs. h ma} also be used to p:b~ eM:apc sequences. An)

\Vhen an SA of 0 or 7 ~~ u'>ed to open the file. the printer will act pretl) much like a Commodore printer. Ca!.e switching will occur 1f a cur...or up ( 145) or cur~or down (17) character is 'ent. Any alphabetic character will be translated from PETASCU to ASCn unle~~ it 1s part of an escape \equencc, in which case the character will pas' through unchanged. For example. scndmg CHR$(65), the PcHSCtt for 'a·. would result in tran~lation to CIIRWJ7J. the corre1>ponding ASCII value. Without tmnslation, the printer would have printed an 'A".

is taken off-line. You can breaJ.. out of this loop with the STOP/RESTORE keypress combination. Conclusion I hope that you will lind the port dnver software a welcome addition to your hbral) of C 128 utilities I aho would like to thinJ.. that you might learn '-Omethmg new by studying the code. The driver should demonstmte that there 1s nothmg to be afraid of when it comes to messmg around v. ith the fundamental opcmtion of the computer. Such hacking can often y1eld worthwhile improvements to the system. II can also lead the way to a beuer understanding of how the computer works. which will ultimately give you greater comrol over the machine and what 11 can do.

As mentioned above. if un alphabetic character immediately follows an EScape churacter (ASCII 27}. no translation of the alphabetic character wi II occur. This w11l result m most escape sequences pa~sing through the driver intact. If you prefer, you ma} open an additional lile wuh an SA of 5 and use it to pass escape sequences. When a file has been opened with an SA of 0 or 7, the control code CHR t 151 (expanded pnnt off) will be automatically con\erted to CHR~C!O l. as most pnnters will recognize CHRS<201 as expanded off and recogmze C'UR<.(I~l as condensed print on. If }OU need to !lim on conden-,ed print. open a file with an SA of 5 and u1>e 11 to pas-. the command sequence.

Photo I. Commodore tue1 port nmneuor.

Regardless of the S.\ used to open the file. no attempt will be made to translate any of the Commodore PET graphics characters. The PETASC!l value<; for those characters will be passed through unchanged, and will produce differing results dependmg on the printer that you're worJ..ing with. Programming considerations

Phow 2. Cemronic.\ parallel port cmmector.

Upon activation of the driver. several Kemal vectors are modilied so that the driver intercepts t/0 calls. A~ a result, the driver ma) be considered pan of the C 128 operating system. Changmg an) thing in the memory range from $1 AOO to S I BF3 may re'ult in ~ystem fatalit) if an> tile h:tndltng routines are called. If }OU need that memory range for somethmg et<.e. you must load the PPD5632 module and deactivate the dnver. Never deacti\ ate the dnvcr \\hile a lite j, opened to the port printer. ·\ttempting to open a lile to device 2 (the RS-232 output) will re'ult in an ILLEGAL orvtcr :\U\1BER error. Thb. is to prevent interference with the driver and the u'er port setup. No other precautions need be observed to use the driver. The driver software\\ ill loop indefimtely wa1tmg for the primer to AC!o.nov.ledge the 1\!CCption of a data byte. As a result. the system will appear to locJ.. up 1f the printer is disconnected or Transactor

Photo 3 Rihbon cablt• a.\.1rmhl1 35

February 1989; Volume 9, Issue 3

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


[Listing 1: Printer driver source

;drnu JUIIp table

opea ;open hlt eloae ;close file ckoat ; opel! oatput elreh ;elou oatpat hsoat ;oatpat ehuaehr JIIP setpn ·set up port . • jlp jlp jlp jlp jlp

.opt cos ·put"@O·prictdr1vtr .sre •t

t

t

t

t

t

f

t t

I

t

t

t

I

t t

t

••

• • •

• c-128 oantron1ca pricter ..• • dr1vtr for the u11r port

••

W.J.

. • wr1ttec 1-08-87

•••

•••1 '

br11r •

• •

copyright (c) 1987

t I

* thit

prograa is not to be . • sold . 1t is p~rauublt . · • to copy 1t bet credit .uat . ; • be gi'flll 1n the docuMntatloc

• • •

•• • ;* lit the doCUMntation

; t • t • t •• t I

t

• t

•• t

t t t t' t t t t t t

t

t t

t

t

I

;t

:* <<< prograa aas1gnmenta >>> • ••

.

0' 0 0, 0 0, 0 0, 0 0, 0

I

t t t

I

t

t

t t

t

t t t

' opatltl.Og ryat• fu.oet1001 ,,,

••

' ;control flags

.

; taro page 1111gn.ect1 .•• •• stabs =$90 ·1/o statUI word ldrnd ~98 ·nUIIbtr of open f1lea dtlto ~99 ·currant lllpot daYice dtlto =$9a ;current output dev1c1 ugfig ~9d :hrnal •aaage flag fale &$b7 . filte~~~ length la &$b8 ; file nu.btr .. &$b9 ; secondary addrtu ta &$ba ; device number toad: =$bb ;filenaae address fnbank &$c7 ;bank holding filenam~ datu =$ef ;character buffer

;urnal i/o tablu ...

••

latbl =$0362 ; file numbers fatbl =$036c : device numbers utbl =$0376 ; secondary addtue1

(optna) • not port pn.oter

optAOl lda la ·eurrtct file )It liupla eea.rch for file bee hlopo ·fill ili9idy open

. •

lda ldtod nt.Dber of open filu

cpx 110 btq tOOIU!y ; too uny hlu 10c ldtnd ;one aor• file ata latbl, x ; add file to table fa ; device nu:ubtr fatbl, 1 ; add to table sa ; secondary address 17 ;upper/lower case output open02

'

aap IS ; transparent oatput btq open02

. lda 10 . • •

·cia 12 regiater1 .

.

ldy IO

d2ddra ~dd02 ;data chraetion a d2ddrb =$dd03 ;data chraetion b

sty statUI · elur sty !*Ide :i.oitialitt bne open03 ; uppercase Ollly

••

.

• dec J*)dt , l.Ddicate

••

IIIII

.pag

I I I I

IIIIIII

n. e ./1 c

QIU

I

· I cactrooica pr1ntu drn•er 121 I

:1 • ;I I I I I I I I I I I I I I I I I Transactor

open03 )It 11tprt ' lit op

••

.

ilgdtv lda pha jar bit

; 1ave trror coda clrcb ;default i/o ugflg ktrnal 11taaage flag bve error) ..aaagea disabled .• ldy to .• errorl lda trnuq, J ' 1/o errnr ' btq un~r2 tDd of 1tr111g

.•

jar hsout . oatpot ....age iay bet urorl loop error2 pla ; fetch error coda pba ;wr1t1 1t back ora IU ;change 1t to UCll ju bloat •output arror cUIIbtr error) pla ; retr1tvt error coda IIC andieatt uror

. rte . • •

••

;patch to kernal close routine

.

cleat php ;aave atatua regi1ter phi ; IIVI fill number ldx ldtnd ; number of f1l11 clo1el dtx ; tilt table offset bpl clo11l eloae2 pla ; recov.r tilt cu.btr plp ; recovtr status regiattt J1P (cl0111) oot port printer

port

' latbl, x • file nu.btr table clo11J Clip bnt cloaal oot f~ lda fatbl x • feteh dt'r1ca Clip pdtY bne clo112 •oot port pd.ow

.

pia pla dec cpx btq

; oatpat C""'nd str111g .

ldy IO

36

19 ; illegal device nu.btr

Cllpt7

d2icr &$dd0d : 1ntarrapt eoctrol

••$1100

·mat be 0, 5 or 7

opan02 1ta utbl. x ; add to table

d2pra =$dd00 ;data port a d2pzb ~ddOl ·data port b

;I

•tt¥

lda fa ·current device Clip 12 · n-232 btq il9de'f ; illegal deYiee

.

tlnopn lda 13 ; file not open .byt $2c

;pateh to karnal open routint

lda ata .• lda aap btq

lda 11 too uny file• .byt $2c ;bit op-code

.

r:w

.

pdtv '.byt 0 ; device nlllllbtr lfflg .byt 0 ;linefetd flag

r

filopn lda 12 file already open .byt $2c

.

. jlp . •

lkcpla =$ff59 11areh for f1l1 1cdftt ..,ffH illdi~ flteh chroat ~ffd2 :oatput byte

;I

t~y

'

=a ·-;

un~r

.

;--------------------------------.

op111

elbpcl =$d030 . ayat• elocl: lpMd

bne open04 ; loop

.lwldl• errors

t

•t t t t

lilY

;

' ; ••••••ex•

lfnadr h l . _ pointer fDbank raa bank iDdftt feteh character

rta

'. byt 0,0 ; ruervtd

for . . • ;* iaatruetiona on using tbi1 ... t ;* utility with yoar aoftwart . •

•• '

eloau ckoata clreha bsoata

byt .byt .byt .byt .byt

fcltll ; eam&nd string ltllgth ope~~OS :done

openOS lda IO elc ·oo

·alht'llltt iadirtet Yeetora ope:ll

epy btq . • lda ldx jar

)It pout ; output eharaetar

·---------------------------------

t

I

jt

ope~~04

; cletr luck ldtnd ; one leu file ldtnd :check file position elouS ·no table ab1ft

February 1989: Volume 9, Issue 3

'

\


.•

~ ·

ldy ldtnd ;an fila count clone lela Ita lela Ita lela Ita

. •

lltbl, y ·aluft tabla lltbl, 1 fatbl , y fatbl 1 utbl y aatbl 1

clou5 lela In clc ·no error

lela datu ; fetch chuactar ldy u · ..coadary addrua epy 15 baq bout08 ·trcspar111t

. •

ell' 117 ;cursor down

bne bout02 du ; sat lower ease l:ai bout03

bol!tC2 ell' 1145 · cursor up bot bol!t~

.

rtl

; patch to ktrMl cb1:out routine

.

ckout ua ; swap file number Jlr lkupla ; 111rch for tile be1 flnopn ; file not open

••

cpx pdev baq ckoutl ;port printer

.

bolitO) 1t1 J:80C1e ; set IICide ' .. jlp bout09 · &lit .• bout04 cap 127 ;eJc&pe

l:ai bout 08 ; lit escape flag

.

bout05 bit 11cflg l:ai bout OS ; no conversion

. •

bot bout06

.• lda 120 . •

J:80de

bpl bout07 ;u.c. only

.

11tprt lela l \01111111 a&lk interrupti 1tad21cr

C~pl9l

bcs bout07

••

·patch to karnal clrc:bn

rout~.~~e

clrcb lela dflto ; output de•nce ell' pdP ·port pnnttr baq clrchl

. )lp . •

,

. •·--------------------------------. • ; 11t up Ultr port for out pat . • •

bee bout08

rtl

pla 1ta clkapd ; re1tore clock pla tay ;rutore .• rt1

; ucii expanded off

Clip 165 ;petacil l.c .

clc , no arror lda 10

lela t \00010000 ; icr ..lk •• pout02 bit d2icr ;wait for ack btq pout02 ; nut received

.

bout06 blt

{clrcbl) · noraal clrc:bn

clrchl lela IO ldy 13 •ta cl2prb ; clear output Ita dfltn ; atandard input lty dflto ; standard output

.• ora 132 ;change to ascii l. c . . •

. . • ' patcb to kernal cbrout routine . • •

bsnvt 1t1 dltu ; un cbtractu

lela dflto ; output da·nce ell' pde'r port prUlter baq boutOl lda datu ; reltore cbtr1cttr J1P (bsoutl) ; IIODI&l bsout •

• bout01 tu ;preatrn raqhttrs

pb&

tya pb&

••

ldx 10 ;lOde fhg Ill ltltUI

Transactor

lela cl2pra ;port a output )lr toggll . lit It robe hi¢ lda d211dra :data dir..:t1011 a ora 1\00000100 11t It robe ... 1t1 d211dra u output

bol!t07 ell' 1193 ·petacii u.c . bee bout08

.

• ell' 1219

ldx IU dex 1tx

bes bout08

. and 1127 . • •

:cbange to ucii u. c .

boutOS atx ucflg · lit/ clear jar pout ;write to port lela .. Clip 15 baq bout09 ; transparent output

clc ;all ok

rts

bit ltflg bpl bout09 ; linefeeds not enabled

cpx bne •• lela jar •• bout09 ph

clkapd un clock rata 10 cliapd ; llow lpMd 1t1t111 clear

• cap US ;expcdad off

ckout1 1ta la ; aet file number ltx fl ,1et device number stx dflto ;11t output device lty 11 • 11t ltcoadary addreu Jlr aetprt set up port

un . y raqhttr

su c12prb ;wntt to port Dop ; Wllt 6 lllCrOitcoada nop nop jar toggl ;toggle atrobe

• dex

tax ; restore file number JIP {ckouta) ;not port printer

·bold cbuactar

poutOl dey bpl poutOl :oatput throttle

bot bout05

tu tya phi lela phi ldy 1ty aty

ldy 1121

·--------------------------------'

pout

113 bout09 ; not a return

rt1

• ·--------------------------------.

; t099le atrobe l1ne

.

toggl ldl cl2pn 1nd l \11111011 bring . Ill d2pr1 ; atrobe low' · ·

••

toggll or1 l \00000100 . then .. . 1t1 cl2pn ; high aqalJl

110 ; linefeed pout

rtl

; reltore registers

••

tay

10 br1119 all prUlttr cl2prb ; output hntl low ; 11t up port b•.. d2ddxb ·u output

error 11111191 tart

pla tax lda datu

erauq byt ll ,'1/o error

clt ·all ok

I ', 0

••

. • rts .•

;atorage

•• 11cflg •••+l e1cape lOde flag p.ode

••

•••+1 ,output lOde

•'

; output to port pnntar

.

.end

37

February 1989: Volume 9,1uue 3

L_~~~--------------------------------------------------~

'·


sh lfflg ·save lintfted flag

Listing 2: Printer drher set-up source

ldx to ldy .a get confiquration

.opt cos ;put'@O:driversetup.src .•

t

t

t

t

•• t t

ru -

t t t

• t

t t

tu

; • e-128 ceotroo1cs punter ;• driftr sttup I!Odale

t

11M ecdr ;e::able drinr

t

·•

;' wr1ttan 1·08·87 w. J. br1er •

••

•t

•••

t

rtYiltd

t

'

• •

; • copyright (c) 1987 ••

;* IYI 5632.dc, lf to enable :• sys 5632 0 to disable ••• ; • see the doc1111entation for .. . :• instruction• on us1nq this ... ;• utility with your aoftwart.

·•

•t t t t t

•• • ••

t

t t

• •

• •

*

. •

t t t t t t t t I t t t

• t

. •

• t

* * t * ••• t

;* <<< prograa ass1qnments >>> • ••

t

.•

t

t

t t t

t

t

*t

t t

t

• t

*t

;systes ftctors 'pointers .•• ierror =i0300 ,basic error •ector

.•

iopec 1$03la ;kernal opaa Yletor iclose =i03lc ; ktrn~l elost Ylttor ickout •$0320 ; kernal cleat Ylttor iclrch =$0322 ; kernal clrchc Ylttor ibsOilt =$0326 ; kernal chrout •ector siffOO ;coofiquratlon

.

; pnntu dmu jllllp table ... open close clout c1rch bsout aetprt

=$1a00 =$la03 =$la06 =$1109 •$1a0c =$1a0f

;tunal open patch ;kernal close patch ; kernal chkout patch ; kernal clrchn patch ;kernal throat patch ;port setup

;pr1nter dr1ver control flags ...

•'

pdev =$1ale ;port dlvioe nlllllbtr lfflg =$lllf ;lintfttd flag

; alhrn~h 1ndirtct vector stonqe ... =$1a12 closea =$1a14 cloata =$1116 clrcha =$1118 bsoata =$111& optna

;open t1it ;close exit ;cbkoat t11t ·clrchn tilt ;chroat tilt

. •

nsr'l'd =$111c ; rutrvtd

. •

*=i1600 ;5632 •

' :===="""""-""' ;dr1ver enablt/dis&ble

.

• J=P dldr ·disable dmer • •

••

ldx ibsoat · chrooJt 'ltct.or ldy ibsoat+l sb bsouta sty bsouta tl

··-------------------------------• ••

: tllable dnftr

endr

cpz 14 ; check device Dllllber bcs endr02

ldx ldy ab aty

.

tndrOl ldx 19 ; illeqal de\'ice JIIP (ierror) ; abort endr02 cpz 18 bca endrOl ; out of range

••

tya pha ;save configuration stx pdev ; set device nUIIIber clc lda and ror ror sta

lfflg n ;uslt garbage a ·rotate twice a lfflg ·set up flag

rts

••

.

;disable dnver -

dadr

tya ph& ·uve old configuration ;

; cb«k for enabled dnver .

;set cp ntw vectors . ..

••

ldx lope:! ; ope!l 'lector ldy lopen+l cpx l<open lllle endr03

ldx iopec ; open Yletor ldy lopen+l cpx f<open bne enclr04 ; DOt tllabled

cpy l>open

cpy t>open bne endr04

lllle endr03

JIIP endr04 :skip setup •• endr03 stx opena sty opena+l . • ldx l<open ;new vector ldy l>upen stz iopen aty iopen+l ldx ldy stz sty ldx ldy stz sty

••

ldx ldy stx sty ldx ldy stx sty

endr04 pla ;old configuration sta mu

l<bsout ; new vector l>bsout lbsout lbsout+l

I

)lr setprt ;aet up user port

. •

; restore Yltton ... ldx ldy stz aty

••

ldx ldy stz sty

iclose ;close vector iclose+l closea closea+l

optna+l

iopen 1open+1 closea ;old close closea+l iclost icloae+l

ldx clrcha ;old clrchn ldy clrcha+l atx 1clrch sty iclrch+l ldx ldy stz aty

••

icloat T 1 clouta clouta•l

ldx ldy ltz sty JIIP

l<ckout , new Yector

l>ckout

cloata ; old ckout cloata+l 1clout 1cloat+l bsouta ; old bsout bscata+l ibsoat lbsoattl tndr04

:- - - = = = - - = .end

38

I

icloat ; clout 'ltctor

1clout lCkoattl

opena old open

l<close ·new vector l>close 1close 1close+1

Tronsoctor

ldx l<clrch , nt'l vector ldy l>clrch lb lClrch sty 1clrch+l

'

t

iclrch ; clrclul vector 1clrcb+l clrcha clrchatl

e::able rou

t

•• •

ldx ldy stl sty

February 1989: Volume 9, Issue 3

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


The Potpourri Disk Help!

War Balloons

This HELPful uhlity gtves you Instant menu-driven access to text tiles at the touch of a key - whJie any program Is running!

Shoot down those evil Nozl Wor Balloons with your handy Acme Connon! Don't let them get owoyt

Von Googol Loan Helper At lostl The mod philosopher• Helga von Googol. bnngs her own brand of wisdom to the small screen! If this is 'AI', then It just ain't natural!

• How much Is that loon really gotng to cost you? Which Interest rate can you afford? With Loon Helper, the answers are as close as your friendly 641

News Keyboard Save the money you spend on those supermarket tabloids - this program will generate equally convincing headline copy - tor free!

Learning how to ploy the plano? This handy educational program makes It easy and fun to learn the notes on the keyboard

Flledump Exam•ne your disk files FAST with this machine language uhlity Handles six formats. including hex. dectmol. CBM and true ASCII. WordPro and SpeedScrlpt.

Anagrams

I

Wrd The ulttmote in easy-to-use data bose programs. WRD lets you qutckly and simply create. examine and edit just about any data. Comes with sample file.

I I

I

lag the Elves A cute ~ttle arcade-style game: capture the elves in the bog as quickly as you con - but don't get the good elf)

[

Blackjack The most flexible blackjack Slmulotlon you'll find anywhere. Set up your favourite rule variations for doubling, surrendering and splittlng the deck.

[

File Compare Which of those two files you just created Is t he most recent verslon? With this great utility you'll never be left wondering.

[

Ghoul Dogs Arcade maniocs look out1 You'll need an your dexterity to handle this wicked joyshck-busterl These mod dog-monsters from space ore not for novices!

Quiz

Octagons

Anagrams lets you unscramble words for crossword puzzles and the like. The program uses a recursive ML subroutine for maximum speed and efficiency

Trivta fanatics and students alike will hove fun with this program. which g•ves you mulhple choice tests on material you hove entered with the WRD program.

Just the thing for you Mensa types. Octagons is a challenging puule of the mind. Four levels of ploy, and a tough 'memory' variation for real experts!

Life

AHA! Lander

A FAST machine language version of mathematician John Horton Conway's classic simulation. Set up your own 'colonies' and watch them growl

AHAI's great lunar lander program. Use either joystick or keyboard to compete against yourself or up to 8 other players. Watch out for space mines!

I

Backstreets

A nitty arcade game. 100% machine language. that helps you learn the typewriter keyboard while you ployl Unlike any typing program you've seen!

All the above programs, just $17.95 US. $19.95 Canadian. No. not EACH of the above programs. ALL of the above programs, on a single disk. accessed independently or from a menu, with built-in menu-driven help a nd fast-loader.

The ENTIRE POTPOURRI COLLECTION JUST $17.95 US!! See Order Card at Center

I

I


GEOS LABEL NAMES ········--------- ........... IISII abel

----------------Appelldlacord litupChp

llpbabeticd Llatillq

Ubtl

bu ldr

Amli:)

em

&oyc.

------

litOthttelip BlCultlltry llWloc lloc&l'toctu

C2ll CIOX CU2 DW2 C2CS OIIUCIM CIF3 r.w.oc CIFC rawo CIOC

loctCIOS

UIIOO!

litu~

DIWI

cooo

-lit IIIJLII Cl60 Malt 111161 CU3 Cale!llihtt . NOOLl CIDB Callllout ict IMDJliP CI08 ChangeOiltDmca CIGDRV C28C ChkDtciOS CIOSCI ClOI Clu dlo'IJtlble

wm me

ClMrllaa Cloltbcordhlt

UltL

~Stnng

C261 C261 C268 C26S C201 .usu CIO' DICU C17S DWft C231 RDIM C213 SF1ICI'P CIOS NIGI6 em CLSSIR C2SF

ClpStrlAg CopyPStrillg CopyStrlftg CJC

Debt Ddoc Otltttrtlt De ltttRtcord Diublt!pnta Doegate OontllsthiO DoDlgBox OoiCOil.l Oolllllftlbtlllll l:loltt= DoPreYltm'''ml

DoaAIC)p

Drawl.lAt DravPoint DrawSpritt

DC!• lalt DShittLtft CSIU ftli;!>t

DSDn ltll&bltP:ocess ltll&bltSpritt ltllttrlleaktop ltllttr!u:bo bitturbo ruto.IFslt rttchWI FillJM FLDc!BAII81t rsndl'ilt rtndl"lypta hUtlllit rollo<balA rr&MJtc-.anglt frttztP:ocas frttllock frot1'1lt Gotllock GttCharMtdtb GttOultad Gttfllt Gttlrtt0u8U Gttfldrtt!o GetlutOu GttPtrCurDtlla GttRtndca GtUealStzt GetScanLine GttStnalhobu Get Stung GoTolultllono GraplucsStnng JoruootalLlAt IllpnntRtctanqlt IoitroriO loitP:ocusu

Transactor

vti.OSI

Cl'8

em

WOCP SmcJCP 8IJIIlTI S'I'P.aT DICOOl

IIIJil)(ll

em elSA

CBmS TILJIIP C2l4 laU ClSI CLSIIItl C190

? Lilli PLOT CCffSP IIDUU 1111616 W1.

...sa 501616 IXIRTN SPROII

wnr

DS&m CIBlT Dll.IT2

,

IIDIL Ili'JSI LOOm !.ULI mtol mel PIOX

,59 nu READ CIIID!H RD180 J.QAl)

101.1 LOIIl.\l)

GITIJ DRVIWI WIDCII

CIIARST ROIWlR lllWIS IIIPV!

a.D CIPIIC Will

cctn3 OPIISER CJC)!'IIL

A handv• cross-reference table

·------------------------------------ ---DeaenphOil of :octiM

-------------

--.UBSI

piqt

----------------BSI libel

P9

-- 1-9 ---- ,--

Add a 'il.ll chua Draw a codtd toaqt Dnw a click bor Draw a codtd iuga with user patcbta Crute a directory entry ill MDOry Allocate aectora !or a file Pnftllt a ta..! .,..t fraa rw•bg Jaboot QI)S aa.1gntd I bst by I bst 801t1ply OougDtd 16 b1t by I bit 111ltiply Coopott n.abtr of frte block• on diak Pe:fora u indirect Jlllll' Change diak dr1" dt•ico number Cbtck if 1 cliak 11 IZOS forut Jeltt t h t ftll a ~ rtg10D nth zt:OI Closo a 'il.ll flit lltlll.ry blocl: ~arbon Strillq CC~~ptt Nnory blocl: String copy Colputt ~1ua of a -.ry :egioo 16 blt abtolutt •alnt Dec:-t a U b1t lftttger Delttt I hit ._.,. I 'iL!l cUi.a !Urn off a sprite Negate a 16 btt integer Cloaa ..rial c011unic1tion I1Ddow proctator Draw a table of click bous (ICDiS) Pt:fo:a I J-. thtoa;b I t&blt p:oceuo: Cion corrut -u

*""

C204 Cl30 Draw/1:&,./Copy an arbttrory llAt el33 Draw/lrast/Copy 1 posnt on tllt ac:ttn CIC6 Copy a apritt data block Cl69 Q!lugntd U bit d1Yiaion CH6 Oougntd U bst bJ 16 b1t oolhply CI!JO Malttplt 16 bst ltl~sc ahlft laft C2U llllhplt 16 bst logicAl ilift ngllt C16C S1q:ntd 16 btt dniuoa ClOt Foret a ncu:ung tisltd event to tuD ClD2 !urn on a apntt me Load tnd run DISI!'OP C214 Stt up a drs" nth tu:boOOS C232 Stop t11tboDOS 1A I dri.. C244 Dtlttt a ttopOrltJ ftlt C2CI CI7B IIMofJ block flll C2AD Check 1f 1 cliak atctor 11 ill n.. C20B Lookup a flit in tht directory C2l8 Crute a t&blt of flit n-s C211 Illitidiu c:r.os variables C20S Crute a hit of uctors ustd by filo em Craw an oat hae 10 a pattttll Cll2 Stop a rtc!1trlll9 tl.Md ....t 1 tlMt C289 hee a block 1D tbt IWI C226 Fret a ftlt' a stetora Cll4 Rtad 1 ucto: CIC9 Get a cbtrtcttr'a width C247 Read tuck 18 aecto: 0 C208 Load I ftlt 91- I filt . _ Clf6 Fl.lld I bolt 1A tot dlttctor:y C229 Get a fslt 1 load address C2l7 Jeao! a chua:tu fraa the ktylloatd C29S Colputt adclttu of dlsk' s . em Change the :andca ooallor CIBI Get a cbtractor' a atata CllC Colllputt ...ory address of scrttO row em Get uatr at:sal noallor CiliA Rtad a lint of tolt frca the '": CIK) ClOst all - · le..u em Proceu a g:apluc C<le&lld t&blt Clll Draw a boruODtal llAI 1A a patten C2SO Copy a box !rca acrttn 2 to acrttn I C2SC ep.a atrial coomunteatioo Cl03 Initial1zt table of tiltd ••eota

Compiled by Francis G. Kostella

·----Ioyce

abel

----------------- ..............

"

1-37 78 1·46 12 1-18112 I·SS 193 I-S6 192 1·41 118 I·U 189 l-SI 194 1-27 186 l-S2 114 1-49269 1-24 309 1-14 ?' 1-20 ~2

,

1-10 207 l-3S 296 1-40263 l·S4 251 1-32 213 I-SS 301 I-tS 14 l·Sl Ill 297 1-29 304 1-48212 1-19 126 1-41 281 1-37 259 1-]2 219 1-39m 1-30 119 1-23m 1-47 198 1-13 12S I-SO 102 1-59 211 1-33 Ill 1-16 39 1-30 100 HI 74 1-17 88 HS 306 1-16 180

------------------------------------Deaenptsoo of :octlM

-----lB BSI page P9

-----HI 2CS

Nl!tOl ClCO Create tbt text cursor sp:ttt IN SERf C286 Insert 1 VLil cha1n IJQRT11 C100 IRQ routine DMJI CllB Ra'ru .. 'fideo a borhonW lint II'/!Ol em Ra'rust rtdeo a box CJICICS C2a3 Cbtd; if - I t 11 lAUde I trllldow CIOI2 CllB Craw a cltck box 11th iDliDt data Wli.2 Cl!f ._r:y block fill nth LDh"' data (rraM~ectanglt PIOX2 cw lnlint Draw a aolid atttlint I GrapbicsStrlftg QRPBC2 CIAB Inlint Proctaa a graphic csnd t&blt 1-llprilltRtctanglt COPrn em Inlint Copy a box frca ac:ttn 2 to I C~~oteData Ill'l1ll2 Cl87 Inlint lllttlligent IQOry block - . Cruut:ing DSPTX2 cw Inllftt Dilplay I text str109 I)acmriactanglt COPYB2 CI.AS Inllftt Copf a boz f:ca sen. 1 to 2 I Jectcglt mw C19F lnllAt Fill a bor nth a patten tdApplic UlA!l3 C2lO Laid ud naa a hit 91,.. clir utry !dlloillcc I.OA:$1 em Laid a hlt vsth ~ IV&ppi.Jig J.QA!)2 C2ll Load a hlt, g1,.. a directory tntry Ldlilt LoldaluSet CICC Acti..tt a ...ory rtaidtnt font I'M lllioLoop MAil C1C3 CEOS' a ulo loop lloustOU lllOSCl' CI8D !Urn off tbl -•• 11)0$(11 CI8A !1m! 00 tht _ .. lloclfDI> lllmData IJml C17! InttlllqtOt -r:y block ltiODuk lll!DV CUI IDltWut a drt" lutRicord lim C21l lltm to ntlt 'iLil chalO btllUlloc fAI.OC2 C24D Allocate aectora for a f1lt OptnDuk OPNllSK C2Al Open a dbk OptnRacordhlt YOUN em Open 1 VLIR filo PllllC STSW C2C2 Report •r•t• error PolAtRtcord GOrO C280 Goto a rpectftc 'iLil dll1a Poa!prito POSSPl ClCF Poo1t100 a aprstt Ptt'nocsbcord C210 lltm to prnsocs VLil clwa PIIV PrelptOff CllRSCl' C29! !Urn off tbt ttxt coraor PrOiptOo CIIRSOII C298 !'urn oa the ttlt cursor Pvrgeru:to CWTS em Stop and r_.. tnrbodoa io a drlvt PutBloct QI'IZ Cll7 Wntt a stctor FutChu DSPC!R Cl45 Display a character Futllo<iul ost>IIOK CIU Diaplay a 16 bit snttgtr FutDirlload 0180 C2U Into to track II ucto: 0 PotStrlAg ostm CUI DlspliJ a hit tt:1A9 RaadBlock RW2 C21A lead a atcto: wstla dr1" p:utt RudBytt 13!Btf C2!6 Get a byte froo a ftlt Rtadi'Ht LCWll Cln Load I chain 1nto ...cry, gi... !IS VJ.QAl) RtadRtcord C28C Load a VLIR chain RtcovttAlll!enus WillS em Brut all •noa Rtcovt:Ll.Jle CCfTL ClU Copy I bat ftca ICHID 2 to IC:ttD l Rtcovttlltw ~ em lrut tilt cautot -u Rtco¥ui!ecranglt cctn Cl2D Copf a bor f:ca scrMD 1 to • c r - 2 bctllliJlt PriLL cue 1111 I box 11th I patltnl ~ile RD-'111 em RoJlUI I flit RtatartP:octu maLl Cl06 !n&blt a recurung ttMd tte:lt,Stuf DRIMIO em Draw tht current ~enu RtDoMtnu Rttr.lppl LDSIAP C2l! Load tht SIAPFILI RttrPralltalng CLSliiX C2BF Cloat a wsftdov Sa..rslt SAVI CUD sa.. - r y to a ftlt Sttlloriet DllVSIT C2ID Stltct I drt.. SttGD:.:!Dt.ry DIJDSI Ctro Cruta a dutctor:y ct.ry oo duk SttCIOSDuk camT Cl8A COIIVtrt • duk to CEOS forut Sttltxthtt .w.oc em Find and allocate a dlak block SttPattern smu em Stltct a fill pattern Slttp OtuY em Set up a tiM delay SUllFutCba: DIW«:B C202 Orav 1 cbt:acttr on tbt ac:ttn Sta:Uj>pl IIlii C22F llw> a p:ngraa that it 10 - r y SUr:tllooaellndt Ill'IllS ClU I.o.\ttdut tilt - StuhB.III C2C8 SllapiAII C2CI Tu!Po1at TIS! ClJl !txt tllt ..lut of a puel To8uic WIC C241 Rtatart wrc Ollblockl':ocess PERMIT ClOP Allow a rtcu:nng tilatd event to :uo OofrttztProctu STARt em Start a recurring hMCI tventa tiM: opdattRtcordrilt OPOL"'i em Update a 'iLil file c..syat..root miS1I Cl4B Stlect tbt BSI font VUlfyWI C2Dl Vtnle.alLlM VlJiil C121 Draw a ..rttcal hat iD a patter~~ Varf:itoBlock cam C223 Verify btfort wr1t1oq stcto: MuttBlocl: 100112 C220 ll:itt a atctor wtth drtvt pr11tt W riteFslt SAV£2 Clr9 Savt ..-ory to preallocated atctora WriteRtco:d VSAVI C28F Save - r y to 1 VLU chain

1-41120 1-34 , 1-36 1-35 76 1-]5 16 1-U IS3 I·U 92 l·U 207 HS 84 1-30 100 1-17 88 1-34 205 1-26 lCI 1-11 87 1-4683

IW!SI! Cl81 lloltlplt -ry loeatlOJ> lAit .

, ,

,

40

hu ldr.

-----------------------------·-------

llllt.ba llltUutPro.pt lnstrtRecord Inte:ruptllain In .. rtl.lAt lll..rUectllliJlt hllltiol!eqlOD I_l1tup0p 1 rslUa

1-22 9t 1-12 92 1·22 97 1-21 300 l-21 291 1-21 182 HI 1-56190 1-56191 1·44 270 1-32 210 1-14 21S 1-29m 1-49 " 1-62 206 I-S7 319 1-10 203 1-53 202 1-11 201 1-53 200 1-20 214 1-9 195 l-It 191 1-20 266 Ht 322 1-52m H3 196 1-15 307 1-60 231 1-13 28 1-54 " 1-42 36 l-IS 31

.Upbilbetical Llating

Ham

1-39 1-38 287 1-28 132 HO 1-43150 H31SI 1·34 m 1-32 283 1-44 321 1-28 293 1-44 2S3 1-58 318 l-S4 204 1-30 321 1-n m 1-47321 1-18 122 1-18 121 l-IS 308 l-62 274 1-24 123 I-2S 109 1-62 282 1-26 tn! 1-48 310 1-29 280 1-36 211 1·51 324 1-27 ,. 1•11 71 1-27 >14 1-11 81 H6 83 1-49 261 1-26 181 1-23 37 1·36 ,. 1-15 232 l-S1 2U 1-23 2S2 1-21 298 1-16 2SS 1-9 m l-S2 82 1-20 184 1-23 , I-SO .0 1-33 149

, I·SS "13

1-10 HS 1-53 1-57 1-52

212 182 183 320 133

,

1-51 7S l·U, 1-62 312 1-51 216 1-59 323

February 1989: Volume 9,1uue 3


GEOS LABEL NAMES ······-······---lSI

libel

·-··--

Sequ~ttal

llu B bn libel ldr .

----·---·--------lootfZCS

cooo

Lilting

------------------------------------Duc::nptico of roo.-tue

-----AI BSI

----------------BSI !WI

~· P'l· ---

Transactor

------

S.qutlltiol Lilting

llu a bu libel ldr

----------------- ............

--------------------------- ·---

Rlboot eros HI lllterRptlllia ~!11 ClOO no rootJ.At 1-36 ID.Itlroc:ttHI OOTBL Cl03 IAitialiu table of tlad ev~tt 1-16 180 RutartProcus r:tW!L! Cl06 lltable a rtCllrring tilled ennt, stART 1-26181 l:abltProceu mR!ll C109 rc:ce a recurring t I.Md ""'t to run 1-27 186 llocl:Proc:eu I'Cillm CIOC PrtTtnt a t!.MCI event !rca ruontnq 1-28 112 OllbloctP.-u Plllllllt CleF lliow a recurung t!.MCI ne>t to rua HS112 rrMrtProcess 5111' CIU Stop I rtCIItTUg t!.MCI IWDt' l taer H3 113 Oc!Atztfrocua SDll! em Start • rtellrrlll9 t!.MCI ""'t' taer 1·53 113 lorizootalLint Will em Draw a borirontal lint i.e a p&tttm 1-31 74 ImrtLi.ct IIIVLDI Clll Reverse video a horizontal lint 1-JS 16 RecovtrLille COPYL Clll Copy a llne from 1c:reen 2 to acrten I 1·18 11 Vtrt1calLint VIJlll Cl21 Draw a vertical lint u a pattern H7 75 Rectangle PFW. Cl24 Ftll a boa w1tb 1 p&ttern H6 13 rriMitctuglt PIOX Cl21 Drn an oatlint 1.11 a p&tttm HS 14 IJI'IUu.ctuglt lli'IBOX Cl2l Reverse nd.a a boa 1-JS 16 lt.tc:ovtrRec:WgII cmn Cl2D Copy a boa frca acr- I to sc:rttD 2 1-17 n DrawLine LIII CllO Dra.w/lrtH/Copy aa arbitrary lint 1-37 11 Drawl'o>.nt PLOI' em Dnw/lrue/COpy a poillt on tba screu H6 12 Crapbtc.Strinq GP.PBIC Cl36 Process • graphic: COII&Ad tlblt 1-30 100 Select a fill p&ttern Set Pattern S&!PAf em l-S2 82 CttScanLint IIODDl cue Ca~p~tt -.ry addreu of scrttn row I-SO 102 TtltiO>.nt n:st cur Tut tba nl.- of • putl I-SS 73 lltupllp caox Cl42 Draw a clid boa 1-12 t2 DSPCQ cus Duplay • chtrac:ttr htO.U 1-24 U3 htStrug DSPTIJ CUI Dt~play • tut 1tnng 1·26 tea a..syrt..root SIL!Sll CUB Saltct tbt BSI foot l-S2 133 Inttialtrt tilt 80011 StutMoolstllode DIITKS CUI 1-33 149 Oolltno 11!:!10 em lltno proceuor H2 36 a.covetlltnu 1-27 '14 WIOiV em !rue tilt current •n• 1acovtrl ll llonus D.IIIIIS em !rase all - • 1·27 " DoiCCCI OWIIJ$ ClSl Dnv • table of c:hck boru (ICXIIS) 1-13 21 DSiu!Ueft IIASL Cis:> Mult1plt 16 b1t ar1tboetic: Jhlft l eft 1·41 Ill -.It tllltll Cl60 Oosiqntd • blt bf • blt IDlttply H6 190 H6 191 ll*lt !111.61 Cl63 ODJign*' 16 bit by I bit IU!tip!J !liCit !111.616 Cl66 Dlltigntd 16 btt by 16 blt llllltiply 1-S6 192 OD1t 001616 Cl69 Ootiqntd 16 bit divi1100 H5 193 OSI)iy SDI616 C16C S1qned 16 bit dinlloo HI 194 Dabl Wl6 cur 16 bit absolute ti!Ut 1-9 195 H3 196 llotg&tt DC16 C112 ~·to 1 U b1t lllttger Cl75 Ddtc C!Cl6 Dtc:~t • 16 blt lllttqU 1-19U1 Cleara.. IFW. Cl11 r111 a -.ry reg1oo w1tb ruott 1·62 206 ruu.a IIDIL em -.ory blocl: f111 1-10 207 1-l420S NovtDitl lliTBII em Inttlhgont -ry block IUvt HI 201 ID1tllla BWn Cl81 Mult1ple me.ory loc:atioo init . MDtc:Uial DSPIIUIC Cl84 Display • 16 bit integer 1-2S 109 H7 198 CttReAdoll WIXII CU1 Cbange tilt nnl!oa m:mller lrlOS(II 1loutOp CIU 'torn Oft the IJOUie H3m lloutOff CIID 'torn off tilt 80011 H3 ISO tmSCf :lcfrenoullaao a.-o Cl90 Clo11 cuntllt1-15 38 llRIIIIo<l Cl93 Drn tba atrrent •u 1·23 37 ltDolllml littS.na!Jillbtr l!B.UIS Cl96 Get user 1tnal nUIIbtr 1-S9 211 Dll.Af C199 Sat up a tlJII delay 1·20 184 Slttp ClmllouHIIoda IIJSIDI C19C Reset the IOIItt H9 '! PPIIJ.2 Cl9F IAli.ce rut a boa tntb a p&ttm H6 13 l·ltctiJI<lle lnllne Draw a tol1d oat lint H5 14 1-rr~le PBOI2 cw 1-Jittonrbctanqlt a.tB2 cw Wi.M Copy a bol !rca sent~~ I to 2 1-17 11 1-GzapluCISt n..ng IVIC2 ClU lnlirA Proctu 1 graphic: <m>d table 1-30 100 1-U 92 l·lttupl\> CIIOl2 cw Dru a clid boa ntb inlue data DSm2 ew Inltnt Dtsplay 1 tut ltrlllg 1-26 101 I·PutStri119 i:etRMISht CIIWl C!Bl Get 1 c:barac:ter 1 1t1t1 H3m Hillllla JILQ'L2 Cl84 ~ry blod fill w1tb inllnt data 1-11 207 l-llotiDitl CIB7 Inline Intelligent ...ory block eove DITBII2 1-l• 205 DIPO'f Clll Raid • lint of tut frca tbe uer 1-33111 Gr.str1119 l·U 39 Gctohntlltov IXICS CliO Cion all-=ltvtb lut!utPrCII!>t w:c1a CICO Crtatt tile tut CUUOl llpOtl H1120 IIA:II C'ICJ GIOS s Mlll loop HO *tr&l«f OmSpnte CCPYSP CIC6 Copy 1 spr1te data block 1-11112 l:etCIIarWtdtb cwmra CIC9 Ctt a char1ctar 1 w1dtb 1-19 126 e1cc Activate a ...cry rtlident font l.oldCbarS.t rowr 1·28 132 P01Spnte POSSPR c1cr Posit1oo a 1prlte H7 173 &WleSpnte SPION e102 Torn 011 a spntt H2114 1-52115 OulbltSpntt SPIDFf CID5 Turn off a spr1te Cal lJoat 1DI ~ CIDI Pufom an illlliect T-Il' 1-32 210 IQII!ll CUll ~te nlllbtr of frtt blockt on duk H4 270 CaldllsPree Oli'>!QOS CIOSCI ClDI Chtd 1f a cli1k u QOS forut 1-29 256 DIITOV Clll Initialize 1 dri" 1-32283 ~uk HI 272 Cttllock IWD Cll4 Read a lector 1-62 274 IIRITB Clll llnh a sector Plltllock liEiiOOf

Compiled by Francis G. Kostella

A handy cross-reference table

SttCIOSDul: Sa..rlle SttQlirllttry 8lciGDirllttry Gttfrtt01rBlk Wrlttl1le BlWloc Raadrlle Sul!Putchu rollOIICbau Gttrile Findr1le

carm

Cl!l CUI) S.lV! DIRDSK CliO DIJMEH Clr3 IOI.I Cll6 S.lV!2

rwa: ClrC LCWII cur DWDI C202

mel rA\1)

LOOKOP DECal& LCWl2

CIIC Ldrue lltttr!lltbo

nsmP

14luUcc:

rA\D$11

Jaadllock WD2 Lc!Apphe Ul&D3 lnttBlocl: 100112 VtrWrittBlock Min: rretrile F1W Cttndrlnfo I..OI.DAD lott:Otak'top wm StarUppl IIIII bit'hltbo CWDY Pu:gt'hltbo CWTS Deltttfile Dti.ITI rindM'ypu TABU RettAppl LOSICAP tolulc WIC rutDtlrilt cm.m GttDultad 10110 htlltrllud DliO lllt.llkllloc r.wx:2 lllprintbctugle a»m I·ll!>nntRec:tanglt COPYil DoDlg8ox moow P.tlla.lile IIEIAIIB IJUtroriO OP•sn DcotlitbiO CI.SSD DSiuftllgbt IILSl CopyStrlng STIICPY copyrstr1119 BLII«<I' C1!>5tnng SncMP c.prstrillq BLlCIIP Piutrnit DII!Ol OpenRecordrilt 1/CfU Cloetbc:cr<IFile VCLOSI auu.cord IIX'f rr..tOI:Siecord PUV 1;010 P01DtRecord QIIJVI DtltttRec:ord IuartRecord DISU'l Appt~c:ord AI'Pilll RudRe<:ord VLOAD lut~ord

SttllutFZM

opdlt.-.conlhle GttPtrOlrDl:la PrelftOn PrOiptOff OpenDilk DoinlintReton Gttllut:Cbar lltupelip riAdWIB1t SatDtnct hlllll11Rtg1on Reac!Byte rretBlock Chi"4'0ilkDtnc:e RetrFnOialog PtJUc: lltOtbtrCltp StuWII fttc:haAII SwapAAIC VerlfyWI DoRNClp

41

em

C205 C201 C208 C201 C211 C214 C211 C2l.l C210 C220

em C226 C229 C22C C22r C2l2 C23S

em

Oflii)Sl ruJlGI CITtl Wll

C23B C23! C241 C2U C247 C2U C24n C2SO C2S3 C2S6 C2S9 C2SC C2Sf C262 C26S C268 C268 C26! C271 C274 C277 C21l C27D C280 C283 C216 C289 C28C C28T C292 C29S C298 C29B C29Z C2ll C2.U C2l7 C2.U

Dr.SI

C2A:)

VSlV! WDC OPtAn:

DR'IIAII COISCI

coasor

r.vsn CIIXIOS

GETBn

'

CBCDRV CLMI

C2BO C283 C286 C289 C28C C2lf

SYSUl C2C2 CIAI2 C2tS

, '

'? '

C2C8 C2CI C2CI e201 C2D4

---..... AI BSI P'l· ------------------------------------ 1-16m ---- --Connrt a cli1k to cr.os farut

------------------------------------Dtsc:nptico o! roatJ.At

Saw -.ry to a hll Create a directory eotry on di1k Create a directory eotry in ...ory rind a ll<lle ln tilt duectory Save .-ory to prulloat.-1 atctora llloatt atcton for a flle !Dad a c1wa uto -.ry 91- TU Drl!f a chtractu co tile sc:uu Create a !1st of atctors us*' by file Load a file , g1ven • f1lt 0&11 Lookup • file in the directory Ccaputt c:htdlllll of a MIIOry region Load 1 file g1..n 1 dtrectory entry Stt'Jf 1 dnve witb turbodoo Load I Wt Yltb -.ry ll'llf'P1119 Read • IICtc: wltb dnve pnnt Load and run a hit, gnu dir entry Write a 1ector w1tb drive preset Verify before wrtt>.ng 1ector Free a file' a 1ector1 Ctt a file' a load addrus Load and run IIISllOP R::ll a prngr• that b in -.ry Stop tur:bodot 1.11 a drive Step and r_... turbodcs lD • drive Delete a hlt Create a table of file name1 Load the !IW'rttl Restart WIC Dtlttt I tt~pCtary f1le Rud trod II atctor 0 trite to trac:l: 11 teetor 0 llloate HCtou fc: • file C.opy I bol f rca ICZHD 2 to IC:tttn I !aline COpy a boa !rca screen 2 to I Window proceuor lWwle a file Open 1tr11l CallaftlCatlOO Clost ~~rul c• "latiCil lbltlple 16 bit lngical sbift ngbt Str1119 eopy taory block 80vt suing ca~pert Memory block ccapariaon Initialize GIOS tariablea Open • VI.II file CIOH 1 VI.II flit 11ovt to nut VI.II chua 11ovt to pr.noua VI.II chua Goto a apte1hc VI.II clitia

~·· •

VLil chain Insert 1 VLll ch1in Add a VLIR chttn Load a vtil clitia SaTt ..,ry to a VLil cbain find and alloate • diu block Update a VLil file Colpott lddrtu of duk a DMt Turn on the text CliUGr T1lrD off tbt tut c:anor Open a cliak Perfotll a Jllll> tbroagb • table Rud a dwac:ter frca tbl ktybotrd DriW I codtd LUgt a.c1 1f 1 d.uk IICtor 11 lD Salect • drtve Cbtd 1f lOCH ll inllda I wllldow Get a byte fro~~ a ftle FrH 1 block ln the BAH Change duk drive detict nUIIbtr Close a nndow Report aysta error Oro a codtd IUgt nU au p&tdiu

pl9l

1-Sl 264 1-21298 1-21 300 1· 32 219 l·Sl 216 1·27 291 1-n m 1·23 .. l·SS 301 1·37 259 HO 263 1-20 214 1-38 217 1-24 309 1-39 HI 310 1-38 284 1-62 312 1-19 ?' 1-29 304 1-39216 H92U I-SO?' 1-14 ?' l-IS 3CI 1-20m Him 1-36 ?' 1-10 212 1-20 302 H 7 211 1-62 282 1-21 293 1-17 18 1-17 18 1-60 231 H9 268 HS 306 1-lS 307 l-43119 l·S3 200 1-11 201 H3 202 1-10 203 H2 213 HI 318 H7 lU H4 321 H7 321 1-30m H9 322 1-34 ?! 1-9 HI32C 1-S9 323 H m H1 320 1-21 m 1-18 121 HI 122 l-44 253 1·S4 " 1-30 119 1·22 1·35 296 1·23 252 J.14153 1-29 280

"

,.

291 1-14 215 l-IS 232 H42al 1-22 91

"

"?I." " February 1989: Volume 9, 1ssue 3


---

Gamemaker's ML Grab-Bag Splits, sprites and special effects by Zoltan Hunt © 1988 Zolwn H11111 Let's face it. there arc more interesting ways of displaying the The two rou tinel> 1:-.1\EP'H and ENVP'Il will dbplay a value (0player's lives than pnnting a number hke '3'. '4'. or '6'. The 255) in the form of a bar horiLontally or vertically on the same goes for energy, power or strength of the player. Are you screen (something like the player's energy levels in ARCHON or tired of writing games with spri te~ that stop about three- similar games). The colour is selected the same way as with quarters of the way aero% the screen? llow about those key- BOX, and the bar can be positioned anywhere on the screen board-character di,plays - wouldn't a hi-res screen with a text using the Kemal routine PLOT ($FFFO) to position the cursor: window at the bottom look better? While we're at it, how ldx trow number : ldy f column about a more interesting l\Creen clear and a box drawing rouclc: jar plot tine? By using a few '>imple text-oriented routines to display player sratus information at the bottom of the screen, along with the split -.creen and '>pnte movement routines to handle To u-.e E.'<EP~ r and E."'VP;>; 1: the hi-res acuon abo.,e. you ha-.e a ~imple toolkit with which lda I4S ; player's energy to begm butldmg ) our mach me language 'ideo game. at a energy ; energy byte jar anepnt ;or envpnt

Boxes, Strength, Lhes and Screens

I The BOX routine \\ill print a box of any 'ize at the current cur- Another u<.e for tht<. routine could be in a graphing program sor position, drawn with the character of )OUr choice. Example: lda sta lda sta lda ata lda sta lda sta jar

110 lx ltlO hi ItS xd ItS yd lt" x" boxchr box

; box width ; width variable ; box heiqht ; heiqht variable ; distance from left side of screen ; x distance variable ; distance from top of screen ; y distance ;character to be printed ;character variable ; go!

The colour of the box can be S(X!Citied by something like this: Ida #2· JSr ffd2: jsr box

with number-. larger than 255 ..caled down (e.g. di-.ided b) 2 or 4 or whatever before being ~tored in ~LRGY). Now we come to the routine~ PRUMrol\' and PRVME:-; that print a player's lives, ships, \hoh or whatever. Usmg these is easy: lda tnumber ;number you want printed sta pmem ; reqiater jar prhmen ;or prvmen

The word "men: " can be changed to anything. but be sure to add the right number of cursor lefls after it. The program, as it is, prints the solid ball character this can be changed to any other character. Try usmg different characters and colours ro indicate the various values of mterest. Fmall). we come to the la'>t routine in tltis section. CLRSCR. Thi~ give~ )OUr progr.tm that "dt~integrating" effect found in ~ome programs. It is called stmply \\ ith a JSR: jar clracr

Thts wtll pnnt the box in red. Another effect possible is by dra\\ ing the box m the center and then decreasing XD and YD \\-hile increasing LX and 111 •md calling BOX each time. This \\ill make the bo" grow. making an interesting finish to a game (by printing blanlo. '>paces. thi., could also be used for clearing screens). Transactor

Once again you can change the character it prints - a blank space - to anythmg you \\ant. No"' we move on to the last two and (X!rhaps most interesting rouunes. ' 42

February 1989: Volume 9, Issue 3


I

OP GN BM CN KN AI LL AC PI OH AF CD BI OI GG FL

SPLIT and SEAM split.. the ~crccn into two parts: a multi-colour hi-res screen on top. and a regular te\t screen on the bottom five lines.

SPUT

Using it is eas)'. Set the bottom text background colour with the variable tRQTWCOl Select text or text/hi-re~ w1th a 0 or a I intRQSF.tC

• •

Here then is a shon example: lda sta lda sta jar

10 • irqaelc

HL MI BA MP FB OM JC

100 aye 700 ;pal 64 110 .opt oo 120 "box" 130 ; draws a box given left edge, 140 ; top edge width and height 150; in "xd", "yd", "lx", "hi" . 160 ; character in "boxchr 170 ; 180 box =* 190 lda l"(clr} " 200 J•r $ffd2 ; optional clear 210 boxll =* 220 ldx yd 230 ldy xd 240 clc 250 jar $fff0 ;poaition cursor 260 ldx 10 270 box3l =* 280 lda boxchr 290 jar $ffd2 ;print char 300 inx 310 cpx lx 320 bne box3l 330 ldx U 340 box4l =* 350 lda l "(left}" 360 jar $ffd2 370 lda l "(down}" 380 jsr $ffd2 390 lda boxchr 400 jar $ffd2

GH

410 iruc

EF EO BA GC KP PG ML ML OB BE NG MB FL CA AO IM NI EL GI LP GP PA IM DC AB OE KD LP DC OA

cpx hi bne box4l ldx tl box5l =* lda I '{left }" Jlr $ffd2

JG GL GL EI EO OP PL HN GE AI

420 430 440 450 460 470 480 490 500 510 520 530 540 550 560 570 580 590 600 610 620 630 640 650 660 670 680 690 700 710 720 730 740 750 760 770 790 BOO 810 820

OP GN AA LN

100 110 120 130

sys 700 , pal 64 .opt oo ; "enepnt" ; thia routine can be uaed to

L!

AB AG IM IA IA CM

;set screen to text/hi-rea

u irqtwcol ;set text window colour to white split

OJ

This routine is one of the most important in many applications. notably games. and is good if you want to easily give the player information. while leaving your richly detailed hi-res masterpiece intact. II can also be u~ed in direct mode. letting you edit or run a program \\hile ~eeing a h1gh-res ~creen panially d1splayed To change the number of text lines that are displayed. change the byte 'tored in ·,plio· It is curremly set to 20 lines. leaving live hnes at the bottom: making it maller will move the split h1gher up on the screen. This value can also be changed dynamicall). creating a "cunain'' effect as the border bcmeen graphics and text move~ up or down. r--ow we come to the last routine; it lets you position a sprite an) where on the screen without havmg to work with the sprite register... and number... greater than 255 (great for machine language programmer... ) The best wa) to show it b through example. so here we go:

ldx stx ldy sty lda sta jar lda at a

140 ;this is halt the x position ot you.r sprite xpos ;store it in the x variable 150 ;this is the y position ylo ;store in they variable 10 ;this is sprite you want moved (0-7) xpsnum aeam ;go to it ;aprite to turn on 11 53269;turn it on

Th1s will move your 'Prite anywhere on the screen. One thing to note though: the >.. po"llon i~ doubled. so that '>loring 40 in ·xpos · will place the 'prite at position 80 on the screen. If you need to po-.ition a ... prite prec"ely. put the low byte in the accumulator. the high b)te (0 or I) in 'xhi'. and jsr 'seam2' mstead of ·seam·. I hope these routines will lind their wa} into some of your programs (I already have one 111 mind that \\111 make heavy use of SEAM) You should be able to mod1f) them to l>Uit your own need~ if required. Transactor

43

iruc

cpx 1x bne box5l ldx 11 box61 =* lda I {up} " jsr $ffd2 inx cpx hi bne box6l ldx 11 box7l =* lda t• (left}" jsr $ffd2 lda t "(down}" jar $ffd2 lda boxchr jar $ffd2 iruc cpx hi bne box7l ldx ll box8l •* lda boxch.r jar $ffd2 iruc

cpx lx bne boxBl rta lx .byte 15 hi .byte 10 xd .byte 0 yd .byte 0 boxchr .asc

;width ;height ;d.utance x froca aide ;diatance y from top "*";char used

February 1989: Volume 9, Issue 3


.......

!J MA

EI DA

MF JL CD DF BO M!

IJ LO B!'

LB BM ID

GJ BI IB

PM DC EF

OK IO

MO GI 1(8

EB

AC OC

LF

HI LG

BB

HI PG CB

II JB

LI

140 ; t hov a player' • enerqy level 150 ; 160 enepnt =* 170 lda energy 180 sta ecount 190 eploop =* 200 lda ecount 210 sec 220 sbc 18 230 bee pntpar 240 sta ecount 250 lda l<abox 260 l dy l>abox 270 jar $able, print a aolid aquare 280 Jmp eploop 290 pntpar =* 300 lda ecount 310 beq enpnt ;done pri nting 320 asl : tax ; index i nto table 330 lda pntab+1, x 340 tay 350 lda pntab, X 360 jar $able ;print bar char 370 ; 380 enpnt =* 410 rtl 420 ; 430 enerqy .byte 21 ;player enerqy 440 ecount .byte 0 450 sbox . asc " (rva ) (rva off) ": .byte 0 460 pntel . aac "( logo-g) ": .byte 0 470 pnte2 . aac "( logo-j )":.byte 0 480 pnte3 . aac "( logo-k) ":.byte 0 490 pnte4 . aac " (logo-k) ": .byte 0 500 pnte5 asc "(rva) (logo- l ) (rva off)":.byte 0 510 pnte6 asc "(rva)(logo-n)(rva off)":. byte 0 520 pnte7 . asc "(rva ) (logo-a)(rva off) ":.byte 0 530 · 540 pntab vord 0, pntel, pnte2, pnte3 550 vord pnte4, pnte5, pnte6, pnte7

DP 100 aye 700 ; pal 64 GN 110 .opt oo CC 120 ; "envpnt• PI 130 ; diaplaya a vertical BD 140 ; bar graph of the value rE 150 ; in "ecount • GB 160 ; CN 170 envpnt =* HI 180 ; prints ' enerqy level' vertically HB 190 lda enerqy AH 200 ata ecount NM 210 eploop =* GE 220 lda ecount HG 230 sec LP 240 sbc 18 AG 250 bee pntpar MK 260 ata ecount PP 270 lda l<abox FG 280 ldy l>abox PI 290 jsr $able; print a solid square LN 300 jJQP eploop HE 310 pntpar =* JM 320 ; print appropriate character EL 330 lda ecount B!' 340 beq enpte Gl> 350 asl : tax ; 111dex ~nto table BH 360 lda pnvtab+l, ll B! 370 tay LM 380 lda pnvtab, X AN 390 jar $able GA 400 ; CP 410 enpte =* IO 420 lda 119 home curaor II! 430 jar $ffd2 Elt 440 rt• ID 450 ; Transactor

JC 460 enerqy .byte 100 ;player enerqy OD 470 ecount .byte 0 PB 480 abox aac "( rva ) (rva off ) {left) {up )": .byte 0 KE 490 pntel aac "( logo-@)(left)(up) ":.byte 0 MG 500 pnte2 asc "( logo-p)(left) {up) ":.byte 0 MI 510 pnte3 aac "( 1ogo- o)(left)(up)":. byte 0 KG 520 pnte4 . asc "{ logo- i)( l eft) (up )":. byte 0 CL 530 pnte5 . asc "{ rva )(logo-u)( rvs off) (l eft )( up}":.byte 0 LL 540 pnte6 . aac "{rva)(logo- y)(rva off){left)(up) ":.byte 0 LI 550 pnte7 . asc "{rva ) (logo-t ){rva off){left){up) ":.byte 0 GK 560 ; CG 570 pnvtab .vord 0, pnte1, pnte2, pnte3 JK 580 . vord pnte4, pnte5, pnte6, pnte7 DP 100 sys 700 ;pal 64 GN llO . opt oo DA 120 ; "prhmen" OM 130 ;this routine prints the player' • MK 140 ; men but could be used to represent PA 150 ; enerqy levela, atrength, etc GB 160 ; FJ 170 prhmen =* MH 180 lda l<prnmen CD 190 ldy l>prnmen LM 200 jar $able ;print it IE 210 ; IF 220 ldx pmen ;get number of men GD 230 lda I "Q" ; thia char represents men PN 240 menlop =* HE 250 jar $ffd2 ;print it OM 260 dex ;have ve printed them all AB 270 bne ~~enlop EA 280 rts OA 290 pmen .byte 5 AK 300 prnmen . aac "men: " KC 310 .byte 0 FD 100 JM 110 PB 120 PN 130 BB 140 DN 150 GB 160 NM 170 OI 180 EP 190 LM 200 OE 210 PB 220 PH 230 KB 240 DJ 250 EF 260 AG 270 CO 280 EI 290 IB 300 EK 310 EO 320 OD 330

sys 700 : opt oo ; "prvmen" ; this is alaoat the aame aa ;prhmen but printa the men ;dovn inated of across ; prvmen •* lda l<pnaen ldy l>pnmen jsr $able ;print it ldx pmen ;get number of men menlop lda l"(left) " jsr $ffd2 lda l "(dovn) " jsr $ffd2 lda 1"0" ; thia char repreaenta men jsr $ffd2 ; print it dex ; have ve printed them all bne menlop rts pmen . byte 5 ; number of IIMin pnmen .aac "men: (left ){left){left){left) " .byte 0

DP 100 sya 700 ;pal 64 GN llO .opt oo LO 120 ; "clrscr" AA 130 , cleara screen ua~ng NI 140 , "dissolve" effect MA 150 ; HJ 160 clracr =* BP 170 ldx 10 NC 180 loop =* AC 190 lda 1255 IL 200 sta 54287 KC 210 lda 1128 ; aet up JM 220 sta 54290 February 1989: Volume 9, Issue 3


CI 230 AD 240 81 250 PB 260 OA 270 CA 280 BD 290 AB 300 CB 310 10. 320 DO 330 EG 340 BP 350 PB 360 00 370 NM 380 OE 390 YC 400 JJ 410 LF 420 lE 430 AE 440 NI 450 IL 460 •

sta ldy lda ata sta 1ta sta

54296 ; lid chip 54299 ;qet random number 132 1024 , y 1024+256, y 1024+512, y 1024+768, y JSI delay

BF MB GM OG JD KO LI BB lB

inx

cpx 1254 bne loop lda l " (clr) jsr $ffd2 delay txa pha ldx 15 clrsbd•ldy 10 clrayl dey bne clrayl dex bne clrabd pla tax rtl

ND IK

AF IJ

PM CB

DI JJ HK Ilt

DF KK

CA FN DO EO LO

DP 100 Gil 110 FN 120 GF 130 AL 140 PI 150 GB 160 BC 170 NE 180 PB 190 DI 200 PI 210 IJ 220 FC 230 BN 240 IG 250 LN 260 OJ 270 BD 280 AL 290 IB 300 Mit 310 RB 320 HL 330 OL 340 LG 350 rr 360 BF 370 GL 380 IL 390 BA 400 !0 410 AB 420 PL 430 FN 440 DP 450 BL 460 MB 470 BA 480 OM 490 DO 500 G& 510 Nit 520 GE 530 PP 540 IL 550 IB 560 FN 570 n 580 PM 590 PP 600 JE 610

aya 700 ;pal 64 . opt oo ; "split" ; irq driven multi-colour ; hi-rea/text acr..n ; by zoltan bunt, 1988 ; split =* sei 1da l<main sta $0314 lda l>main ata $0315 lda 1$81 sta $d0la lda l$lb sta $dOll lda l$7f sta $dc0d

GO GJ

!«:: BE

DP 100 GN 110 GN 120 ML 130 PL 140 AC 150 BJ 160 IN 170 KC 180 PO 190 DL 200 LD 210 OA 220 BJ 230 LA 240 MM 250 Bl 260 01 270 IM 280 IG 290 MG 300 LB 310 PB 320 FB 330 MH 340 CF 350 EE 360 EN 370 NP 380 BO 390 OJ 400 NB 410 AJ 420 MK 430 BJ 440 BG 450 Ia! 460 JL 470 MM 480 AG 490 FE 500 Pit 510 Pit 520 CJ 530 OK 540 LO 550

eli

rts ; main "'* pha: tya pha: txa pha ; save a , x,y lda U sta $d019 lda irqselc cmp ll beq irqend 1da $d012 cmp 160 bee topirq lda 53272 ; 1et up for text mode and 1247 sta 53272 lda 53265 and 1223 sta 53265 lda 12 sta $d012 lda 53270 and 1239 sta 53270 lda irqtwco1 sta 53281 jmp irqend : topirq =* ; set up for hires mode 1da 53272 ora 18

Transactor

620 630 640 650 660 670 680 690 700 710 720 730 740 750 760 770 780 790 800 810 820 830 840 850 860 870 880 890 900 910

45

sta 53272 1da 53265 ora 132 sta 53265 1da 53270 ora 116 sta 53270 1da lp1in ; lp1it text 11ne asl : asl . asl ; convert to raster adc ISO sta $d012 ; irqend =* lda $dc0d lsr a bee irq2end pla: tax pla: tay pla jmp $ea31 ; irq2end =* pla : tax p1a : tay p1a jmp $febc ; irqtwcol . byte 3 irqselc .byte 0 ; hi/text (l)=text spUn . byte 20 ; 1plit text line 1ys 700 ; pal 64 .opt oo ; "seam" ; puts a 1prite anywhere ; on the screen ; put x/2 in xpoa, ; y in ylo, ; and sprite I in xp1nua. ; seam =* ; uses xpoa, ylo, xpsnua lda 10 1ta xhi lda xpos aal rol xhi ; holds hiqb bit seam2 =* ; u1e1 x1o, xhi, ylo, xp1nua sta xlo lda xpsnWD asl: tax lda ylo sta 53249,x lda xlo sta 53248,x lda xhi bne xpnl ; clear hiqb bit ldx xpanum lda #255 ..c sbc xpnum, x and 53264 sta 53264 rts xpnl =* : 1et hiqh b1t ldx xpsnua lda 53264 ora xpnua, x sta 53264 rtl ; xpos .byte 80 ; sprite x poa I 2 ylo .byte 120 . y position xlo .byte 100 : sprite x poa low xhi .byte 0 ; 1prite x hiqb bit xpsnum .byte 0 ; sprite I (0-7) xpnum .byte 1, 2, 4,8, 16, 32,64,128 February 1989: Volume 9, Issue 3


The BASIC 7.0 BANK Command A voyage of discovery in the Cl28 ROMs •

by O.J . M orri ~s

As is well J..nown. Commodore wa~ experiencing financial difficultie~ during the development and early rnarl.eting of the Cl28. This may account for the frequent usc and misuse of the term 'bank • in connection with the internal architecture of both the C 128 and the 1750 RA \1 Ex pan~ ion Module. A~ ha~

been well explained in earher "~ues of the Transactor. the term ·bank· in the C 121! ~~ mo~t oflen u),ed to refer to different pre\elected memory configuration\. The Memory Management Unit (MMl ) ~...,itches different part:. of the available 180 kilobyte!. of RAM and ROM IIllO the Cl28's 6-tK of addressable memory. a-. needed. Thi-. \Witching i:. going on hundred-. of times a c;econd. under the control of the operating system. For example. a very long BASIC program rna) occupy RAM in Bani. 0 a.s far a' $0600. The program at that point may contatn a l>tatement to PRI~T \ . where the string AS could. by coincidence. be stored in Bani. I \tarting at that :.amc addre1.s. $0600. If the 80-column screen b the acti\e ~creen, the PRiNT statement must pass the string to the 80-column Video Display Control ler (VDC) through its two registers at (you guessed it) $0600 and $0 60 I in Bnnl. 15.

and revealed some fac ts about and not widely J.. nown.

that arc both important

What it does

The BAXK routme h locnted 111 R0\1 at )6BC9 (li~ted at the end of this anicle). A~ the disassemhl> sho\\s. the routine is shon and "mph!. It e' aluatcs the argument of the BA'lli. command. chccl.~ 1f that argument i~ in the range 0-15. then !.tore~ it in $0305 (decimal 981 ). and exih. And that is all it does! The command. n \ '"- IS, i~ e\actly the same as POK E 98t,IS. The BA:-.1< command cenainly .,ee1m innocent enough... The next obvious question i' .. Who care\'! .. or. "What routine-. reference thl\ memory location. $0lD5 !" I used the Monitor HV•n command to check the R0\1'- for all in-,tances of this address. (I thought it unlil.ely that thi~ locauon would be referenced b) indc,ed or indin.:ct addres~ing.) Naturally. the uddrc" would be found, 10 lo\\-byte hi-byte form. as the sequence $05. $03. There are exactly nine occurrences of this byte sequence. and the} all turned out to be pan of val1d load or store commands. Th1s is the break-down of the locations and the routine-. located there:

Meanwhile, the 40-column -.creen may need to know how to draw a character who~c .. hape is defined !>Larting at $0 600 in Bank 14. Clearly. interfering in the~e rapidly changing configuratioru. would be a \er} tncky and dangerous process. Yet, BASIC 7.0 on the C 128 seem~ to supply a command that does e>.aclly that. Naturally. it 1s called the 8A'K command.

$4085 the initiali1alion routine of the cold-start sequence. The routine store~ a value of $OF. decimal 15. in location $0305 $5891

Various reference-. seem unclear about JUSt ...,hat the BASIC 7.0 B'\'"- command doe-.. One \tate-. that the command .. .,witches the system from one bani. to another". Another say!. that BA.'K "select~ one of the 16 memor) banl.s ... Most authoritie~. including Commodore\ C 128 System Guide and C 128 Programmers Reference Guult• make ll clear that the B.\'IX command determines the memor) configuration accessed b} certain other BASIC 7.0 commtmds. bul there 1s no general agreement as to \\hich commands are involved. Some digging in the C 128 RO\<N gave me the ans\\er to most of these que!>tion!>. Transactor

BA'lK

th1s pan of the R0\1 handles the svs statement.

S6BO I handles the B !\'It-: \tatemcnt ('>ec li'>ting). ~

46

$6C41

handles the \\All statement.

$7347

handle., the ROOT statement .

StlOD~

handles the PFFK

$80F I

handles the POK F \tatemcnt.

~t<llement

February 1989: Volume 9,

Issue 3


$A3EO

evaluate~ parameter~

for di~J... commands.

describe how to access Bank I ! In fact. you can fcl CH. SlASH and SWAP to/from any C 128 internal bank. simply b) using \he BA.'IK command fir!>t.

$AA60 common code for R-\\1 Expansion Module snsH, FETCit and SWAP commands.

The Version 0 C 128 ROW; have some problems in dotng this. The ongmal D\1A (Otrect Memory Access) routine mststs on creating a new memory conftgurauon. m whtch the 110 block is vbible. Thu~. it \.\Ould be ttnp<h\tble to STASH lhe Character RO~h. 111 BanJ... 14. using the Vcr..ion 0 RO!\ts. In addition. the Version 0 routine wtll occasionally carry out the STASHIFETCHr.iWAP \\ ith the ""rong memo!) configuration enabled. The new Version I ROM\ correct both these bugs. allowing ) ou to access an) part of an} banJ... \\ ithout dtfticulty.

These are lhe onl) command' that change or refer to 0305; the,e are the onlY BASIC command., that are affected b) BA'>K. There are several "gnthcant poinh that 'hould be made about !hi ... li~t. The fiN thing to be noted b the relative pem1anence of lhe BA''K command. Once BA"K \!Ores a value 111 $0305. onl) another BA'<K command, a poke 10 $0305. or a complete sy\tem reset will change it The stored value survive~ the running of a program. a RL '-1/S fOP Rl 'i 1OR!路. and even a reset with RL 'I :; 1OP depres,ed

For example. if you have etther a 1700 or 1750 RA 'v1 Expansion Module and C 128 Verston I ROMs. try this short program in 40-column mode:

A~

a consequence. you :-.hould never as~ume you know lhe value stored in $0305. An) of the 'banked路 commands listed above should ahmrs include some l)pc of BANK command to set the desired configuralton explicitly.

100 200 300 400

GRAPHIC 1,1 BANK 14: STASH 4096, 53248' 0, 0 BANK 15: FETCH 4096, 8192, 0, 0 BANK 0: FETCH 4096, 12288, 0, 0

Some C 128 references ~tate that. 10 the ah-.ence of any BA'IK command. BanJ... 15 is the default value. In one sen-.e. this is correct. If no BA'k. command has ever been u~ed '>ince the computer was reset. the value of sor stored in $0305 b) the initialization routine will establbh Ban.J... 15 as tiJe one to be accessed.

The entire character ~et ha\ been copied from the Bank 14 Character R0\1s tnto the RA \1 cxpam.ion. and from there '""ice into the BanJ... 15 ht-res ..creen memor). The different BA..'\K commands in lines 300 and 400 simp!) demonstrate that. from SOOOO to S3f"FF. Bank 0 and Bank 15 arc the same.

Hmn!W!r. if any BAI\K command ha\ ever changed the value in

Disk 1/0

$0305 'ince the last reset. then that 8.\'\K command i<> the one that dete1111ines the bank acce"ed. even if it was t<,ssued hour<> earlier.

The 10clusion of the dt..,k parameter evaluatton rouune is also curiou .... The commands tmolved are BLOAD and BSAVI:i. The description of these 1wo command' makes 11 clear that you can specify the bank to be aeces\ed by including the B par.uneter in the command string: for example.

PEEK, POKE, SYS and WAIT

The importance of B \r\K to these four commar.d., is obvious. If you are going to looJ... at. or change bytes at memory locations in different hanks. the r>rrK and POKF routines must check $0.105 to !-.now which configumtton you want them to access.

BSAVE "CHJIRGEN", Bl4, P53248 TO P57343

will save the character pattern ROM. in Bank 14, to disk:\\ hile BLOAO "SPRITES", BO, P3584

If you are going to SYS to some machine language, SYS needs to !.now ""hich configuration contains the program. If you are going to WAn until the bih in a parttcular memory location match some pattern, agam the routme must kno\\ which configuration contain' the particular location.

loads a binary file into the BanJ... 0 ~pritc pattern storage area. Not so clearly stated is the fact that, in the absence of any B parameter in the BS \\ r or BLOAO command string. the last BAI\K command is used to -.et the hank ...aved or loaded Enter and run this 'hort BASIC progmm. tn 40-column mode. \\ ith a disJ... in the drive;

STASH, FETCH and SWAP

The inclusion of the R\M Expan\ion commands STASH. FETCH and S\\.\P ma) cau..e some '>urprise. The R \.\1 Expansion Module User路~ GUtde certain!) ~ccms prcll) definite that only Bank 0 can be acces ...ed. On page 14. it states that the BASIC commands "can only be used to transfer or retrieve data 10 BanJ... 0 of the C 128 computer\ internal RMt". and the statement i' repeated vvord-for-\.\ord on page 24 The ~ituation is ~omewhat confused. since the manual goes on immedtatel) to Transactor

100 GRAPHIC 1,1 200 BANK 14 BSAVE "CHAR/SET", P532 48 to P57343 300 BANK 15 ; BLOAD "CHAR/SET", P8192

The complete character set wtll appear on the '>Creen, as it is fiN BSAVEd from BanJ... 14 to di,J.... <llld then BLO.'\Dcd back into Bank 15 tnto the htgh-re~ screen mcmor}. 47

February 1989: Volume 9, Issue 3


Either a BA.'IIK ~tatement or a 8 parameter b necessary to ensure that BSAVE. and particularly RLOAD, operate reliabl). The problem is that the C 128 uses the -.arne format for saving ftle~ as do all other Commodore 6502 ba.\ed systems, from the flfSt PET onwards. Thus, \\htle the stan address of a file IS saved. the Bank is not saved. since the format predates the Bank concept.

I.JSR

'otably absent from the hst of BASIC 7.0 'memof) • commands affected by BAI\K is the l'SR function. Briefly. USR operates as follows. When a 8\SIC program encounters a CSR smtement. such a~: 400 Y

Th1s makes the C 128 compatible \\ ith other Commodore computers. but leads to problems when file'> are saved and loaded from different Banf..s. The Banf.. mu 1 be specified sepamtel), b) either the 8 parameter m the command stnng. or the BA!'.l'C command preceding the disf.. command. Since the 8 parameter overrides the BA"'K command. It should be included in the command string whenever the at OAD or BSAVE commands are used.

= OSR(

X)

the exprcs'>ion m parentheses is evaluated and Mored in Floating Poim Accumulator #I. In the example above, the expre:.sion is just the variable X, but any complex expression that yields a numcncul value IS permiued. Then the program executes a JMP to u U'>er '>Upplied machine language routine. This is only po'\sible if you have earlier '>tored the address of the routine, in low-byte, high-byte order, in 4633-4634 (decimal), $1219-$121A.

BOOT

The fact that BOO'I is affected by the BMK command is a total surprise. There ~1re, of course, two versions of the BOOT command. The simple command, UOOT, causes the system to carry out instructions according to the content~ of Track I, Sector 0. This versiOn of BOOT IS not mlluenced by BANK. However, the other ver...ion of the command, BOOT "filename". is affected by BA"'K. although none of references I have 'eem to be aware of this. The command, BOOT "filename". is the equivalent of BLOAD "filename", followed b) a SYS to the load address of the file BLOADed. Howe\er. a~ explamed above, the load Bank is not Sa\ed. As a result. the BOOT command U\es the BA!'.K command flag in $0305 to determine the Banf.. \\here the program will be BLOAoed and run. 11ms. you should always set this flag with a BANK command before you execute the BOOT "fiJenarne" command. An interesting discovery was made about the syntax of the BOOT command. Mol.t reference~> fail to mention that the BOOT command string can contain an altemate load address, specified by a P. followed by the new load address. Thi!. is exactly the ~arne as the P syntax used in BLOAD and BSAVI:. In addition, none of the references mention that the 8 parameter can be included m the BOOT command string to force the BLOAD and S'\ s into <,orne other Bank. For example: BOOT "GOOOIES", BO, Pl2345

will load the file "GOODIES" mto Bank 0. staning at 12345 (decimal), and then svs to this location. The Bank value in $0305. and the onginal load Bank and address of "GOODIES", will have no effect. Since thi'> u~e of the 8 parameter is completely undocumented by Commodore. 1t \\Ould be unwise to make much u\e of it. There i~ no requirement on Commodore\ pan to preserve ~uch undocumented 'features·.

1l1e machine language routine may or may not change the value in Floating Point Accumulator #I: abo, the routine must end in an RTS (ReTurn from Subroutine). Finally, the value found in Floating Point Accumulator# I at the end of the machine language routine is used as the value of the USR func- ; lion: in the above example, this value 1'> assigned to Y. Here is a more complex example: 500 Y • 3

* (

SQR( 2.5 * USR( LOG( 5 * Y ) ) ) )

Here the variable Y 1s multiplied by 5, and the logarithm of the result i~ calculated and left in Floatmg Point Accumulator #I. The mach me language rout me 1s executed. and the value in the Floating Point Accumulator at the end of the \tL IS multiplied b) 2.5: the square root of the result I'> muluphed by three and assigned to the variable Y. If you are careless enough to usc the LSR function without setting the pointer in $1219-$121 A, you will receive an lLLEGAL QUAI\'TITY ERROR message. There is no illegal quantity. and USR ha<; functioned as described. It's just that the initialintion routine sets S 1219-$121 A to point to the routine that prints that particular error message, as a precaullon against exactly this piece of carele!.'>ness! As far as this article is concerned. the imponant point b that the JMP to the user· supplied maclune language routine takes place in Bank 15. The BAJ\K flag 111 $0305 is not consulted, and USR is not affected m any \\ay b) the BA"'K command. Thus, the machine language routme mu'>t be in Bank 15 RA\1 belo\\ $4000, or con'>ist of a R0\1 routine. Of course. there is no reason wh) the \1L cannot JUmp to a routine in another Bank. as long a,., it retums to Banf.. 15 before ending. Bank 16, 17, 18...?

As stated above, the B\1\K command is careful to place a number in the range 0-15 (decimal) in $0305. You rna) be wondering \\-hat would happen 1f )OU poked some other value into $0305. and then u..ed any of the command~ above. The results

L-_T_ ra_n_sa _c_t_o_r _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _4_8_ _ _ _ _ _ _ _ _ _ _ _February 1989: Volume 9, Issue 3


\1-ould be quite unusual, and not very useful. Here·~ why. The actual switch from one Bank to another is accomplished by . - - - - - - - - - - - - - - - - - - - - - - - - - - - . NOTHING LOADS YOUR PROGRAMS FASTER ~toring a number m SFFOO. THE QUICK BROWN BOX A NEW CONCEPT IN COMMODORE CARTRIDGES

Thi~ •~

an alternate addre!>\ for $0500, the MML. Configuration Register. Each of the eight bits in the number ~tored determine~ some part of the memor> configuration. leading to a possible 256 configurations.

Commodore picked 16 individual configurations (or Banks) that it thought would be particularly useful, and stored the Configurauon Regi!>ter value that e~tablishes each of these configurations in a table starting at SF7FO. For example, to establish the memory configuration that Commodore cho!>e to call Bank 0 require~ that 63 (decimal) be \tored in $FFOO, 1.0 the first entry in the table is 63. The BANK nag tn S03D5 is used a' an off<>et into this table, to obtain a value that ""ill then be stored m $FFOO.

Store up to 30 of your favorite programs Basic &. M 1L, Games &. Utilities, Word Processors&. Terminals - in a single battery-backed canridge. READY TO RUN AT THE TOUCH OF A KEY. HUNDREDS OF TIMES FASTER THAN DISK. Change contents as often as you wish. The QBB accepts most unprotected programs including kThe Write Stuff" the only word proce.o.sor that stores your text as you type. Usc as a permanent RAM-DISK, a protected work area, an autoboot utility. includes utili tie~ for C64 and C-128 mode. Packages avatlable wtth "The Write Stuff," "Uitrntenn Ill," "QDisk" (CP/ M RAM Disk), or QBB Utilittes Disk. Price; 32KS99; 64K $129. (+$3 S H; $5 overseas air; Mass residents ndd 5%). I Year Warranty. Brown Boxes, Inc, 26 Concord Rd. Bedford, MA 01730: (617) 2750090; 862-3675

Since there are only 16 cmrie~ in the table, setting a Bank higher than 15 would cause t11e )ystem to read the code that follow~ the table a~ more Configuration Regbter values. The memory configuration that would be e~tablished during PEEK. POKE or \\.hatever. by these ·new· table values would be very strange indeed! Summary I)

2)

3)

Always precede PELK, POKL, SYS, WAlT. STASH. FETCH, SWAP and BOOT "filename" with a BANI\. statement to et the desired Bank explicllly.

GET MORE PLEASURE FROM THE

Alway' mclude the 8 parameter tn the command string for BLOAD and BSAVE to set the desired Bank explicitly.

BIBLEWITII

LANDMARK

Always locate the machine language for the USR function in Bank 15.

The Computer Reference Bible

4) Never POKE strange values into SOJD5. Better yet. never POKE strange values anywhere!

Here's what LANDMARK will enable you to do: "' SEARCH THE BIBLE-Pind Phrues, wocdl or acn1eru:u. "' DEVELOP TOPICAL PILES-Copy from The Bible text and seacch results then add your own comments and notes. "' COMPILE YOUR PERSONAL BIBLE- Outline texts In color. Add notes, oommenu, and references. Make your Bible Study organized and on pennamcn1 record! "' CREATE PILES- Then convert them foe U$e wllh wocdptOOe$SOC"$llke Paperdlp and GEOS. "' MAKE SUPPLEMENTARY STUDY FILES- Por opcclfic IGidy and develop ttanslatlon vttiatlons.

Listing UNJC Cc *' end PCM Listing

61:x:9

jer $87!4 ;

~

to evaluate

; BANK arqument 6l:x:c

cpx l$10

6l:x:e

bee $6bd4 ; branch i t invalid

6bd0

$119.95

v1.2 for C64 and v2.0 for C128

; in $03DS

CALL OR WRITE 10DAY FOR .A FREB BROCHUR.B WHICH SHOWS HOW V.ALlMBLE LANDMARK CAN BB IN YOUR BIBLE SIVDY

; all done

P.A..V.Y. Software P.O. Box 1584 Ballwin, MO 63022 (314) 527-4505

etx $03d5 ; etore BANK

ar~t

6bd3

rte

6bd4

jlllp $7c128 ; pri.nte error -ssaqe

Transac tor

NEW LOW PRICE!

; <:Melt tor valid arqumant

49

February 1989; Volume 9, Issue 3


RED ATE Notes from the CP/M Plus workbench by Adam Aerst

CopyrightŠ 19RR Adam Herst CP/M Plus provides sophisticated date and time setvices to both the user and the progmmmcr. Ui)Crs can set the system clock from the command line u~ing the DATE or CONF commands. With a little preparation, you can stamp files with the system time to reflect creation, access. and update dates and times. The transient version of the DIR command can display the stamped information. Programmers can manipulate system dates and times and file stamps using a number of BOOS seJVices. With all of the\e scJViccs prov1ded by CP~1 Plus, it is unfortunate that the C 128 docs not come equipped with a batterypowered clock. If the system clock and file stamps are to be correct, the system date and time must be set or reset on every cold boot, reset or warm boot.

fast. and is de1.igned to manipulate a hO\t of system characteristics, most of them specific to CP/\1 on the C 128. The differences in design and function between DATE and CO:>~F are reflected in the operation of these two utilities. When used to set the system date and tune, DATE can be used in a command line mode or in an intcracti\e mode. Interactive mode b useful in PROFILE.SL B files. since it pauses and prompts for input. In interactive mode, the form of the DATE command is: DATE SET

CP/\1 will respond with the exchange: While this IS annoying, there are benefits in making sure that the system's date and time are set correctly. or at least in correct chronological '>equence. lf you're like me - without a watch more often than not - it is convenient to have the time available through the command line. More importantly, the date and time seJVice~ provide a way to track the many versions of text and executable files that are generated by practically every large writing or programming project.

Enter today ' a date (MM/DD/YY) : Entez the tiJM (HB: te4 : SS) Pzeaa any key to aet tiJM

An argument error at ~my stage will abort the DATE command.

An argument can be passed over b} pressing the RETURN key. ln command line mode, the form of the DATE command is:

REDATE, a short assembler program, removes the drudgery of manually resetting the system clock. lt uses CP/M 's file stamping to set the system date and time to that of the most recently accessed file. Without a battery-powered clock. no program can automatically set the dme and time exactly. However, REDATE can ensure that file stamps are chronologically correct and, if there has been recent disk access. that the system date and time are reasonably clo e to the real date and time. etting the date and time Two utilities with which to '>et the ~yMem date and time. DATE and co:-w, are supplied in the CP/\1 Plus toolkit. DATE is a standard CP/M Plus transient utility provided by DRI (Digital Research Institute, the supplier of the CP/\1 Plus operating system). 1t i\ a relatively large program. and is speciali7ed for setting and d1~playmg the !.Y'\tem date and time. CO'fF is an implernentation-~pecitic ullhty pro\ ided by Commodore. with CP/M ver~ionl> dated Dec 6. 1985 and later. CO~F is small and

DATE SET dd/rrm/yy hh:nm: . .

where dd is the day number, 111111 is the month number. yy is the year number, hh is the number of hours in 24-hour format, mm is the number of minutes, and ss is the number of seconds. Both arguments must be supplied in full. An incomplete date or time specification i'> flagged as an error. lsl>uing this command without argument errors results in a prompt to press any key to set the date and time. Pressing a key sets the system clock and return~ the CCP prompt. If there are errors in the arguments, euher syntax errors or invalid dates or times, the error IS flagged and the operation ir, aborted. DATE can be used to di~pla} the syMem date and time in command line mode only. The form of the command for display is: DATE

L__ Tr_o_n_soc _ t_o_ r _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _s_ o___________ February 1989: Volume 9, Issue 3


CP/\1 will respond with a di~play similar to:

If the directory space is not to be recovered, tNITDIR respond' wnh:

Mon 08/01/88 11:49:18

Do you want tMI axiating time ·~• clM.recl

~ote

the di~play of the day name. The code to extract this information from the information actually maintained by CP/\1 is one of the rca~ons for DATF\ large l>ile and !>low operation rel1; auve to co'r. onetheles~. it is a nice feature if you need iL.

This last exchange is the only way to directly manipulate rue stamps through the standard CP/M toolkit. Unfortunately, file \tamps can only be explicitly set to a blank entry. ote that the disk does not have to be newly formaued. Existing data will not be de~troyed by tNtTDtR. There b a chance, however, that a disk with data may not have sufficient directory space remaining to support tile stamp!>. If this is the case, you will have to remove some of the files on the disk. File5 that exi ted before the initialization will have blank entries for the activated !>lamps.

, CONF offers limited functionality compared to DATE. It operate~ in command line mode only, performs less error handling, and pro' ides a stripped-down display. Ho"Wever, given its relaU\ ely small 'fite, and its man) other uses. it is much more likely to be found on a currently logged-in disk than DATE, its DR! counterpart. To use CONP to set the date and time. issue the command: cx:tiF DATI: - dd/lffiA/yy hh : -

Once the directory has been initiali7ed. use the SET command to indicate v. hich of the file Mamp types l.hould be active for that disk. CP/M Plus supports three types of file stamps: create. update, and access. Create !>tamps indicate the date and time at which the file was created. Update stamps indicate the date and time at which the file was last updated. Access !>lamps indicate the date and time at which the tile was last accessed.

:88

where dd is the day number. mm is the month number, yy is the year number. hh is the hour number in 24-hour format , mm is the number of minutes. and ss is the number of seconds (though this is ignored and may be omitted). Either argument can be omitted. If both arguments arc omitted the date b displayed. An error - either a syntax error or an invalid date cau,es the command to be aborted.

While three file stamp types are supported, a maximum of two file stamp type!> may be active at any one time. CP/\1 dtcrates that create and access file stamps are mutually exclusive - only one of the two can be active at any one time. Fortunately, the way CP/M interprets update stamps allows them to function as create stamps in most cases.

Slumping files CP~t"s

file-stamping services are the heart of REDATE' · operation. Without them, no record of the date and time would exist for REDATE to use. However, CP/M Plu~ does not stamp Iiles with dates and times by default. (This is probably due to the directory enrry overhead imposed by tile stamps. A!> de cribed later in this arttcle, the use of tile stamps reduces the number of available directory entnes by 25 per cent.) So. before tiles can be stamped. the L\IITDIR command must be used to initialile the directory of the given disk to receive tile stamp~. Also. the SET command must be u11ed to indicate v. hich of the file <;tamp types is to be active.

Update stamps indicate the date and time at which the file was updated 'in place •. A file that is updated in place has altered information wrinen to the same disk record as the ongmal tile, and writes new information to the last record of the original tile. One program that updates files in place is dBASC n. Most programs do not update files in place. They create a new file to hold the altered or new version and delete or rename the original flle. Consequently. for a newly created tile, the update stamp reflects the creation date and time. Activate access stamps instead of create stamps. and interpret them as create stamp . To display the file stamps, use the transient vef!>ion of DIR:

To initialize a di~t- directory for file stamps, issue the command: I

(Y/N).,

INimiR d:

DIR d :

where d is the letter of the drive containing the disk to be initialized.

[A'l"l')

where dis the drive whose disk directory should be shov.n. A directOr) dbpla) similar to the following will be shown:

l"'ITDIR responds with the exchange: INI"l''IR WILL JIC'1'I\'Am TD£ STAMPS Do you

~

D~

THE SPJ:X:lli'IED DRIVE .

l'or Dd.ve A ~

'OM%'

f

wnt to re-format the directory oo drive: M (YIN)? update

If the disk has already been initialized to accept file stamps. tNITDIR responds with:

3 Oir toll

Directory al%Udy re-fOTDPtted. Do you want to recc:Mar tJ..m./date dir-=tory space

Transactor

Total lk &locka •

(Y/N)?

51

-

Of/01/n 12:U 01/01/11 12:U l

1

I'U... l'oand •

tJaed./M&x. Dlr &n.triea For Driw A .

1

,1/ 121

February 1989: Volume 9, 1ssue 3


The last mo column~ of the listing contain the information for the acrive file stamps, 10 thiS example update and access. Practically all of the other form'> of the DIR command will display the file stamp mformmion a'> well.

DMA buffer containc; the directory entry for four files. When file stamps are active, the last directory entry in the DMA buffer contains the file stamp and password mode information for the preceding three files.

System level sen ices

File stamp infonnation can be obtained directly from the 0).1A buffer. However, BOOS call 66h gel!> the file stamp information for the file in the res. Bytes 24-27 of the FCB "'ill contain the create or access file stamp (recall that 011ly one of the two may be active). Bytes 28-31 of the FCB w1ll contain the update stamp. File stamp date and ttmes cannot be ~et directly.

The next fe"' paragraphs disc~'> time and date !.Cr. ices and file

stamping at J.he system level: they assume familiarity with the CPI\1 3.0 Boos and the CP/\1 3.0 tile sy!>tem. This background informarion can be found 10 the CP M Plus Pro,v,rammer's Guide available through the Commodore CP/\1 Special Offer. • CP~1 use!> a four-byte data Mruclure 10 More date and time information. The first two bytes are used to store the date: tile last two bytes are used to store the time. The date is stored as the number of days elapsed since January l, 1978, in low byte/high byte format. (Your guess as to what will happen when we pass June 4, 200 I, the largest date representable under this format, is a<, good as mine.) The time is stored as the number of hours and number of minutes, in BCD (binary coded decimal) format. The CP/M date ~tructure representing the date and time 7/18/88 22:55 looks like thb:

oc

OF

low byte

hi.<Jh

date in days

date in days

byte

22

55

hours

minutes

Redating REDATE sets the 1.ystem date and time to that of tbe most recently accessed file as indicated by the access !>lamp. It frees you from finding a calendar and clock to detem1ine the date and time, and frees you from having to enter that date and time through the keyboard. While RPDATE can't accurately set the time, it ensures that !.tamps are chronologically correct. It is most effective when used immediately after a warm boot or reset. While it can be used after a cold boot, Large discrepancies between the system date and time and the real date and time are likely. REDATE requires that access file stamps be activated on the specified disk and that some d1sk activity has occurred before the REDATE command is 1s-.ued.

The ~ystem date and time are mamtained in the system control blocL. at byte offltet 58h-5ch. (The fifth b}te 1s used to store the seconds in BCD. and is unused for file !>tamps.) It can be queried and set by d1rectly manipulaung the SCB. However. BOOS calls 68h and 69h are provided to facilitate operations that set or query the dare and time respectively.

To execute REDATE. bsue the command: JU:DAn: d:

where dis the drive tn which the disk to be searched is located.

CP/St Plus stores ftle stamps tn the disk d1rectory. Since only two types of file \tamp!> can be active at one time. and four bytes are required for each date structure, a maximum of 8 bytes are required LO More the file stamp!> for a given flle. File stamps are not stored in the same directory entry as the file to which they are related - there b no room. They are stored in a directory entry used solely for date and time stamps, and password mode information. There is enough room in a directory entry (32 bytes) to '>tore date and time c;tamps and password information for three files.

lf the disk lcuer is omitled, the default disk will be searched. If no file access stamp 1s found. the program return code will be !.et to an error condition.

The REDATE program REDATE is written in 8080 a~scmblcr. It can be assembled 'as is' with MAC and loaded with IIEXCOM, both supplied by DR! in the Commodore CP/M Special Offer package. The code is fully commented. so only an overview will be supplied here. REDATE stan.., by matching all files in user area 0, and stores them in a simple stack using the PushFileName routine. Once all matche.., have been found, the file name:. are retrieved one at a time using the PopFileName routine. The access stamp tnformatton for each file I'> compared to the saved dare (initiali1ed to 1/1178) u\ing the CompareDate routine. If the access stamp ,., more recent, tt I'> copied to the saved date where it become<, the standard for further comparisons. When the ln!>t file in the current user area ill processed, the cycle is repeated for the next user area. When all ~er areas have been processed, the system date is set to the saved date if it is more recent than the initial dme.

This explain~ what b happening when a di!>k directory is processed by INITDIR. When CP/M Plu!> prepares a directory for file stamping, the directory is rearranged so that every fourth entry is used to record stamp and password mode information for the previous three tiles. (This re~ult'> in the 25 per cent reduction of available directory space mentioned earlier.) A file stamp directory entry b identt lied by a 21 h tn location 0 of the directory entry. tn"ead of the user number to wllich the file belong~.

When a directory entry for a file b read using the BOOS ¡search for first tile' or 'search for next file' system calls, the Transactor

52

February 1989: Volume 9, Issue 3

I


Conclu ~ion

; U Set du buffer

illustrates one w,e of CP/\1 3.0\ sophisticated date and time services. Enhancement-. to RI:DATE could include an option for a 'fudge factor' to set the date more accurately. or an option to !>carch all the disk ... in the drive path for the most recentl} accessed file. Other date and tune related utilitie:. could include a \tAKE utilit} to evaluate file dependencies. The features of CP/\1 3.0 make idea' like the!>C surprisingly easy to implement.

avi !11 call

REDATE

5 FlCd 10st rec:et aceess st.up IJld lift It

S.l Eu a drin bte:a Spttlfled'

; s. 2

Listing: Redate.asm

If DO

:n

b.CNQ

ICY

I I

(1)1

0!1

; po1~t to dr:ft letter ; ~ drift ltttu · ia it almdy till default'

u.n mrt ebtclliq filta : filtwt

Cl!!ai'ILIS

JZ

~t.

11

druily tht dtfalllt

; 5.3 Set dtfa~lt drift to apecifild drift , I TIYL!

; WI'! (c) 1988 Adu Berlt, Toroato, Oatuio Set tb4 ayatea d&h to Uat of tbt wt rtctntly acctsatd file on the specified diak Requires tb&t acoess filt stup~ hu been actintld.

; Y2.0 • YI.O ;l

AddJ drift cptioa Seta pr09fll return code to error 1f DO at.up fOI:Ild run wcrk1119 ftnioo llcc·wurk1119 prototype

CetSetietCcdl

6cb

s.t!ID!Mr

l&!l

StlOiJk

Ot!l

GetSetCser

20b

imlllltlla S.uchPust S.Uchiext

Hh

~ttiusvd

Setnitt

c. StlDisk

IOV

•••

call

BDOS

; 5.4 For OS!RYUK: =0 to lS

!Ji

h,OS!lllltll

avi

a.Ob

; point to CCWlttr : att 1t to 0

I I

: 9ft

IWSEi!i.IC

Cfh

eolmttr

: 111t ~to IS : yu 10 JliiP to Itt qst• dltt

IXWI

ICY

t .l

call

8:X)S

; 5.4.2 Set feb to aateb all wildcard

12b

sbld

66h 68b

w

tqu

20b

mtalta:PSOC:

equ equ

OOOOb

tqu tqu

c.GetSetCur

w

equ tqu equ tqu

ni

lib

SilOS: CW.FC!: l'CB!'ILE!IAHZ: FC!.\alSS: 11!00 FILllW!!mel: ;:mmrm

•4

nl

· S.U Set aatr Clllbtr to OSw::IC

F~l'!S

mo:t!:Sml:

I

CECIFILIS:

; 2 BIS'IOR!

•2.1

dcr

Sb Sell CPNFCS+Id CPIIFCBt24d 040Cb

sbld ll'fi l.d

h WliLIS PFCUSPECHR h,CPifi'CB PFCUCBPTR c, Pustrlie.~ut d,PFCBSmJcr

call

BDOS

point to wildcard fliuptc: str1119 pvt polllttr in PFC8S1llllC! point to file control blocl: p;:t poilltii in PFCBSnUC! parse the atrinq ud initialize FC8

: 5. 4.3 Setup the f1lenama stack to store filespec aatcbea for proctsslDq h,F~!ACX ;

OSOOb

CIT~O!I

: : ; ; ;

point to bott0111 of fillllllll stack ; aet top atlck pointer to bottai

F!LllW!m

; CCP-wtializld a:ectss code : Oatr set mot code

: 5, U Get directory

•~try

m w

~

for flrat flit aateb c,StuchPmt d,CPII'CB BOOS

call

· U Pr09f11 mrt : 5 4.S lli.lt t.he..'l! ia a Wt aateb

orq

10011 (f)i

• 4 2 S« p109f11 retUrD code to error

m lu

call

(, GetStthtCode d. F3TCOOt=s!i!lll BOOS

1t till ao aatdl code• ll!IUliO'!IIIm : yes 10 JliiiP to process utebts

Offh

jz : S.U.l Ptsl!

flle:a~e

call

;

11

onto flle:ue stack

Pus~il.XU.

· savt filll'.llt fr01 00 !Iaffer

_T _ra ,;_n_s:...:a..... c_to:.._r_ _ _ _ _ _ _ _ _ _ _ __ _ _ _ _ _ _ _s_ 3 _ _ _ _ _ _ _ _ _ _ _ February 1989; Volume 9, Issue 3

L[


; 5.U.2 Gtt directory trJtry for nut file utch

Ii

ll'fl

c Surchlltrt

lVI

lu

d.CPI!FO

ull

BllS

lxi Clll

; 7 Em

; 5 4 5.3 <1ld 1f thtre vas 1 utc!l to un

; 7.1 ; 5 U llile file:w statk u

DOt

~IX:tSS

mtsmSS :

lllptJ

ll'f1

lxi

h FILI:IAICESfACI ;

Pi

d

h

po~t

; 7 2 !rror

lhld

; pom to top of stati

ull

; do they polllt to the sue louuon ; yes so co files to prOOtSs

Jl ; 5 U .l Pop

ull

to hottCII of r.ltk ; y::t polttU iJI C!

ln posh

file~.ut

;8

fr011 F!UlW!!S1ACI( PopFileN~mt

ull

; pot filena:e in FC8

c.GttDatePmvd

IIi

d.CPKFCB

ull

BOOS

armms

; 8.1 CUrreotDmaRec - Point to tht currtot DKA record

; Descnpt!on; ;

; 5.4.6.2 Gtt access stamp inforution for file in CPKFCB lVI

COb

; Arg'lllltllts: ; Returns:

Point to tilt start of tilt current reoord in the I»>A bllfftr. A - nuabtr of cmtnt record in DKA buffer (0-3) BL - points to start of current record

w

: 5.4 6.3 Is the file access diu - r than tlle currut sane! date'

ln lu lu Clll ; St U

dmslSDA!!

b rt:B.\LXZSS ~nDatt

· point to nne! date ; polAt to acceu dau ; tolplle und date to access date

I! DO tW proem wt fllewe

EII.Eim:IHf ; und 11 lU9U so do

j!IC

DUt

file ; 8. 2

~tCite

b,lmi!A , point to firrt !II'.A record d,II!Wal!TS!! ; 9ft tht record offut 1 • ~itillirt record COU!Ittt

a

; iJ It the ri¢t record' ; )'tl so return

d M!tiCA.W:

; poi.ct to nut ~ ncord ; c:htck if It u the righ: rtcerd

- ~re n date to 0! dati

; S U 5 S.n acceu date of fil, Desctipt.iac b.IEIISYSDA."E

lxi

ln

d rcamss

IV1

b.04b

ull

COpyBytts~

· Arpents · l'.et~rtlS

5.4.6.6 Check if tbtrt b enotlltr filenut to proem

~n

tht CP/1 datt structaru.

ttA sttndard datt is ll&lltt/tq'Jil/larqu then tbt ltqu~Gt datt 0! - sttndard datt l!l. - Ug'llllllt date l - Itt if equal C - 11t if std is llllltr

Co~partDatt

ldu

h d d

cap

I

i.cl

· 5.1.7 Do ntrt user

; 6 Stt tllt

~r

1QI

ld inr

b, OSERNilN

; point to uur numhtr toUllttr

1

; incrt~tnt

j~~p

fORDsmtiiC

; chtct if its valid

IJitD

it

rc rtll dcx da

datt if an ICCtll ltllp hll httn found

0001'11:

h

ldu

d d

cap

I

rc ; U

Is tllt und date

r:-...1 •

w

l.u

b

i.cl i.cl i.cl

on

I

w

ldu

b

cap

I

on w en

I

rc

b

rtl

I

iu i.u

b d

ldu

d

cap

I

If )'tS

to 1h IAitill nltt'

b b d d d

w

; 6.2

~q~:d

b,IEIS!'SOAtl

a,l

tW do lD U:S~cct11!u! Ult

; boars bytt of sWdard

. 9ft SWdard ; is

1t ; Clll It

tq'JI1 to ~t is sulltr

; no it isla~ ; aw:tts byte of ~t ; IIWI bytt o! ltllldard ; gtt sttndard ; ls 1t equal to arg.nt

ret

JI Transactor

; hiqh byte of yean in day' of a~nt ; hiqh bytt of yean in days of standard ; qet standard ; is it equal to arguaent : no it is llllltr , no it is luqtr , lov byte of yms In days of trC)'JIIL,t , lov byte of years In days of standard ; qet rtendard ; IS it tqpal tO lrqui!Ot ; DO 1t is llllltr ; DO il iJ lii9tt • boars bytt of UJliiCt

54

February 1989: Volume 9, Issue 3

: '


· Cocriptton·

Copy Cllrrt!lt hltout ill IJIA buffer

• lr;'alll;ts·

to tlit top of tbt filL'I&II mel. Jeqairts tUt nLZIWCESUCI bls btcl stt up a:.d PlUIAilEPft W bttJI defUltd A • curre.t ncurd lll lllfl buffer

lllr ldu

., w w )If

c d

•• • d h XI:Xt!YTU

; ; ; ; ; ;

incr~t

coaLter gtt source bytts put it 1n destillltioo point to ~ soarce bytu poi.Jrt to ~ deJtllllhOD check If IOrt bytts to CGpJ

; 8.1 ~yttsllon ·Copy S llllllltr of bytu 10n119 don fro. D! to &L

all w p-..U

pop illd m all

shld ret

wren~

h h d FIU»..IEPTR

b,lld Copy!yteJ1lp rtt.IJAliEPTR

, 1.1 P<~pFile!lue • Push f1lW1111 ill

; Description·

• polllt to cum::t reoord lll I» • po111t to start of fllerw , pat source poW.u 111 D!

; Ducnphoa: •

• •'

; ~ts;

. •

; put destwtioa po1nter ill 6! ; put n=btr of bytu to ccpy ; copy tbta ii'.(IColllbDi pollltti , "" tbt new poi:ter

• ; Rt:ums: '

'

jmh

pop shld ret

• 11'11

c,Ob

: Wthlite byte counter

IOV

a,c b

, gtt counter for COIII'arisoo is It equal to tbt namber of bytes , yes so no 110re bytes to copy incr~m~nt tbt counter point to source byte to copy : po1nt to destination ; get aouroe bytt : put it lJl destination ; check if 10re bytes to copy

Ollp

n

; qtt source pointer ; put it lD DE

pop lli lfi all

IL • sbrt of destwtlon byt11+1 B • nlliiJtr of bytu to ccpy D! • last bytt of IOUICI byttJ iL • lut byte of destwtioa byt11

II!X'!'Bml:

Copy tlit ftltnut !roe tlit top of tht filenue stack to tht FCB RJquirts tbit FILEIW!!STACI: hu at least one 111try

jmh

C! • stut of 14trce bytu+l

CopyBytesDovn

rca onto FILE.lW!ZSTACI

lbld

Copy tl:e byt11 pointed to by ll to the bytu po:.nted to by IL decr-=t1J19 the poitttrs.

h,I'CSI'lL!ml+lld ; qtt destillltioa polllter b, lld ; nuar of bytu to ccpy Copy!ytesDown ; ccpy tbta Otc!XIhnq pointu d ; Uft Dtf poiDtti

inr del dcx ldu

c d b d

IOV

I, a

)If

mnml

; 9~

b Fitmll!m

· 9 1 \lru!(l: • Vemoa a:.d ccpyn¢: str1D9 · Duaiptioa· Vmioa and rtleut C'.'llbtr a:.d ccpyri¢t strinq

· U Cclpa.'1CZ'To&:. • CGiplrt the wtrd lll C! to tb word lll &L

V!ISI<I:

• Oesa1ptioa ·

; ' . 2 l!IS!s:m • Ditt to set systea tt. to : Ducnphon: ditt a:.d hit lJI CP/ll forut

. ltq:Ets:

Retams: •

ColpmDEToiL

Celpm EL to Cl. EL IS sulltr (tcjW 1lllq'r tW D! , Set appr<~prutt flaqs ca rttcrn. EL • wrd ill l01 byte hi~ bytt fo:ut DE • word lJl 101 byte, hiqb bytt folUt Z· Itt lf t<fJI} C • m 1f IL is adler

., Clfl

1,1 e

rc

rr.z 110'1

Clip

l ,h d

' J!Dlft Y11 lei Ada !mt 19U'

mrstSDlft:

db db db db

; gtt biqh byte ; is hi hiqb byte equal to de biqb byte' ; no, it is smaller, so BL is smaller ; no it u luger, so BL il larger ; get 101 byte ; ia hl low hytt eqad to de low byte'

Ob Oh Ob Ob

: 101 byte of yun lD days : blqb hytt of years iD days : hours ill bed ; linuttJ ill bed

; 9.3 PFCBSTROCT: • Pant FCB structure · Description: Parse file eootrol block pointer structure PFCBSTllUCT: PFCB!'SPZCPft: PFCBFCBP!R:

dY dY

OOOOb OOOOb

, pointer to cpf• style filespec string · pointer to file control bloci

ret · 9.4 OS!RICK: • user n~r counter , Dt5Ciipticn: Oser n\llber eouctu

; U CQpyBytesJp • Copy Bn!Sltr of bytta IO'Iinq up froa 0! to BL • Otscnptioa: • · Ar~ts:

• • · lltms ·

oma.

Copy the bytta pointed to by Cl to tbt bytu polllted to by IL incr-tinq tU pointers Dt • surt of acuree bytu IL • ahrt of destu1at1oa byt11 B • C'.'llbtr of bytes to copy Oil • bytt after lut byte cf IO"..n:t stmq IL • byte after Jut bytt of destwticn stnnq

: 9.5 ALI11US. ·filespec ltr1J19 a •.• ; Dtscnptioa CP/M style strlllq for wildcard filupec lU!'ILSS :

m

c,Cb

: wuuue bft• eocnter

.,

I,C

; gtt ecunter for

Clp

b

: h it tcr•d to tbt C3W of bytu? ; yes so f1nuhed

n

Transac tor

' *. *$'

; U Fr:.mlm'!R: • po~tttr to t<~p of rttmiiESUCI ; Dtscr:ptlcn Poltttr to t<~p of FI!l!WISnCI

Copy&ytu~

l!llil!tt2

Cb

dr

CSCCb

COI!fUUCD

; 10 Elm 55

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

February 1989 Volume 9, Issue 3


Serial 1/0 in Power C An RS232 function package for C programmers by W. Mat Waites e'cuing area~ of use for the C64 is cheap telecommunication~. The ability to communicate with other machines via modem or a hardwired connection adds greatly to the power and value of :my computer. The C64 has benefited more than other computer~ from telecommunications because of Commodore's 1.upplying modems that are very affordable. One of the

mo~t

name for thic; ldnd of device i\ Universal Asynchronous Receiver(fransmitter (UART). The C64 emulate~> the activities of a I.JART in soflware. The positive side of this is that software is more flexible than hardware. The C64 's seriall/0 is at least as configurable as a UART and is more configurable than some. The negative side io; that software, especially I MHz 6502 software, io; slow. The C64 Kcmal routines are barely able to keep up at 1200 baud; 2400 baud is not reliable at all.

Developing telecommunications programs is interesting and fun. but the choice~ of language for that development have been very few in the past.

The two big kludges There is a problem with the Kemahupplied serial routines. The timing values supplied for 1200 baud are not exactly correct! The 'width' of the bits commg in to the port don't match up ~ith what the Kemal expect<;. By supplying new and improved timmg values. we can tune the routines to expect the correct bit widths.

1nterpreted BASIC' is too slow even for 300 baud communication. Comp1led BASIC' 1s much faster. but generally utilizes the BASIC' mterpreter\ garbage collect1on routmes for string storage maintenance. The result of th1\ is that the system locks up e\ef) fe\.\ mmutes ~hlle the string '>pace IS being recovered. Thl'> \.\ill drive you in.,ane after a \.\ hile.

This 'bit width fix¡ introduces another problem, though. With the best possible values in place for receiving characters. there is a problem with transmitting characters. The 'stop bit' (the final bit in a serial character transmi!>sion) i<> too 'narrow'. That is. it doesn't last long enough tor the machine at the other end to recogni7e it reliably. This is not really a problem with simple terminal emulation because no one types fast enough to cause multiple character~ to be output one immediately after another.

Assembly language has been the most viable choice for writing programs that would be limited in !>peed only by the Kernal and the hardware. These assembly programs are very long and difficult to modify, however. The lack of a standardized parameter pas~ing convention and a linker makes it difficult to write function<; in assembler that are reusable and sharable with other software developer~. C has come to the rescue with a language that is higher level than assembly. but without the nm-time overhead of BASIC and other interpreted languages.

The shon stop bit does cause problems with file transfers. When a block of data is sent, the characters follow one another in rapid succession. The receiver i~ sometimes still waiting for the end of the stop bn when the next character arrives. This kind of synchronitation problem ~~ called a framing error.

Commodore 64 serial I/O The C&l actually has a very .,ophi\ticated serial vo system for a microcomputer. It 1s mterrupt driven. which means that incoming characters are taken in b) the Kemal even if )OUT program 1s not quite ready for them. Even -,uch popular systems 1 as \1S-OOS do not have thi'> feature. \1S-DOS terminal programs 1 must supply their o~ n interrupt-driven code to create this kind of funcuonaliry. The Kemal taf...es care of all of the low level details of accepting character., and .,ending them out.

To break down this final barrier to reliable 1200-baud communication, a second kludge is introduced. Adela) loop is used to wait for each character to be clocked out before another is added to the output buffer. This allo"'s the receiving computer to recover from one character before the next arrives.

MoM computers have s!)l!cialiLcd chip~ to perform the act of sending out and rcce1ving individual chamcters. The generic

In applying C to telccommumcations. the first hurdle to overcome is interfacing to the Kemal for several functions. Most

Transactor

Problems y,ith C

56

Oecemb4tr 1989: Volume 9, Issue 2

•


obviously, the serial 1/0 must be accessed from C. Methods for doing this are not documented in either the Abacus Super-C or Pro-Line/Spinnaker Power C manual~ (at least none that I have seen). Other functioru, that mu" be implemented mclude: geuing a k.ey!>troke without 'hanging'. producing a cur.or on the ~creen. doing cursor movement. and providing tim1ng functions for communications protocob.

Power C space. We simply move the pointers to point to ~pace that we have allocated for this purpo~e; the rest of memory can then be used without fear of overwriting the input and output queues. This gives the added benefit of allowing the easy examination of the queues without reading character. from them.

This article introduces a terminal program •Millen in C and provides the detad' of the implementation of serial 1/0 in Power C. (Vole: due w \pace linuumom only 1he sertal and Xmodem roUiines 1hem.1ehes are mcludecl in 1he C murre lis1ings accompanying lilts anicle. The full source for Mat's terminal program, and the program itself. will be included on the Transactor disk for this issue. -Ed.)

After the port is opened. the baud rate and other parameters mu't be set. We could have specified the baud mtc at open time. but ~e want to be able to change the baud mte at any time so we must work at a lower level.

Setting the port parameters

The setserial() function allows the caller to set the baud rate, the number of bit'> per character, the number of \top bits, and the parity. Thi~ function may be called at an} time to change the parameters. The three baud mtes implemented are 300, 450, and 1200. Many 300 baud modems will function reliably at 450 baud, and many sass support this speed.

•Packages' of functions Power C provide~ an excellent linking facility that allows the programmer to divide his application into as many compilation unil'> as desired. Software development can be made more efficient by "'riling subsyMems that are independent of each other and placing them in separate file'>. In this way, several different applications may call the same 'package' of functions.

Kludge #I is mcluded in the timmg values supplied in this function. The 1200 baud values seem to work well, but they may be tuned for the best performance with your '>et-up. The 61 may be varied up or down by about 4 or 5.

The reusablility of software is very important if you ever intend to develop a softY. are sy~tem of any size. You simply cannot Man from \Cratch at the beginning of every project and expect to do large proJects.

The stopbiLS may be set to either I or 2. The bih per character may be set to an}thing from 5 to 8. The parity i-. '>et with a bitmap value corresponding to the 3 bits descnbed mthe Commodore 64 Programmers Manual for selecting parity.

The package discussed here contain~ all of the functions and data structures necessary for serial 110 in Power C. It allow'> }OU to open the senal device, set the port parameters, write to the serial dev1ce. read from the dev1ce, and close the dev1ce.

Table of parity values 0- disabled I -odd parity 3 -even parity 5 - mark parity 7 -space parity

The data structures include the input and output queues and the current state of the port. Opening and Closing the De' ice

Reading and writing

OpcnseriaiO opens the C64 •file· for serial communications. Notice that the BASIC-style open() call is used l>O that a secondary addres!i may be supplied 1f desired. RS is the symbol for the stream number used for the serial port. 6. With the BA· SIC-,tyle open. the '>tream number. 5 through 9 should be used to avoid conflict with the automatic stream-number allocation done by the higher-level vo functions.

The getscrial() function is called to get a character from the serial port. If no characters are available. a - I is returned. Notice that if the Power C getc() function were called here. the function would not return until a character had come in the serial port. If you arc writing a terminal program or BBS, you do not want to 'hang' wmung on characters. You simply want to get it if it b there, or return if it is not.

The closeserial() function simply the RS <>tream.

doe~

a

BASIC-~tyle

close on

The puLSerial() function is called to output a character to the serial port. This function implements kludge #2. There is a deJa} loop that was shortened until framing errors began to occur. After the loop it simply call~ the Power C pule() function to output the character.

Moving the butTers The other activity carried out by the openserial() function is mo' ing the buffer pointers to pomt to the buffer!> that have been declared for the serial port queues. The~e arc named inhuf and outbuf. The Kcrnal allocates the buffers initially at the top of BASIC memory space, but this falls in the middle of Transactor

57

Other functions in the package Functions are also provided in this package for -.orne other oos-related activities. Functions are provided for accessing the December 1989: Volume 9,

Issue 2


keyboard "'ithout hanging, for checking to see if tbe'logo· key is pressed (1 use this for an attention key), to wait for a given number of seconds, and to read the d1sk error channel. ~otice

II

that Kemal calls mu~t be made to achieve ~orne of this functionality. but with these function~ making the calls for you, you don't need to directly call the Kemal in applications.

The Xmodem routines are very portable. The Commodore specific 110 functions are separated out and should make it very easy to move the Xmodem pan to another operating system.

Using the package To use this kind of a package you simply compile it as you would any other function m Power C .

This "'ill produce a file - "do,.o". When you link your application, ~imply link tn "dos.o" and you have erial vo. Note that you will on I) compile 11 once and then link it in ""henever you need it. Thi!> is a great advantage over BASIC compilers that force you to recompile your entire program every time you make a change.

Ideas for future de,elopment With the !.erial 110 !.tabihzed, it l.houldn 't be too difficult to add other protocols: Xmodem CRC. Xmodem batch, KermiL Punter. and so on. The most d1fficult thing about implementing some of these protocol'> is findmg definitive documentation. lmplementmg a BBS IS also a pos,ibilit}. The Commodore 64 ~till ha~ a lot of life left in the area of software development. llopefully. thl!> article will help spur intere:;t in C programming on the 64. Drop me a note if you have any questions, or if you write any mtcre~ting applications with the serial package. I can be contacted on Usenet (!gatech!emcard!mat) or by mail at this address:

The terminal program Included on the di-.k IS a '>imple terminal progf'dm that calls this !>erial l/0 package. It implement!> a sprite cuf!>or and Xmodem file transfer!>.

I • dos.c · optratinq ayst• stuff disk ~rt serw l lo kb i/o tl.lt!S

*I

1• I lilt lutu • Sept 1988 *I hncltde

<stdio. b>

!• 5-9 uy be used with 'basic' open •I ldlfint ltB 5 ldlfice RS 6

I* kludge for reliable 1200 baud •1 lclefint lU.01lGI 40

!• kernel routines •1 ldtfine CHXIN ldefine G£TIN ldtfine TISA ldefine ACPTR ldtfine TALK

Oxffe6 Oxfft4 Oxff96 OxffaS Oxffb4 !define IJIITU: Oxffab

W. Mat Waites 1264 Brandl Drive Mariella, Georgia 30060

*robuf =otbof;

I• Ht baad rate •1 •.Sla)b = 256 • hibyte(iodx) + lobyte II.DCixI ; *bauclof • ('.Sla)b) •2 + 200 ;

I 1• cloJIHiial () · closutrul () I close(RS) ; I I • 300, 450, 1200

close

serul port •I

1• stopbits •I if(sb < 1 sb > 2) I

-

sb • 1;

llple~ented

static short hibyte(3) static short lobyte(l)

=I 6, =168,

•I

l

sb-·;

4, 1); 12, 61);

/* bits per char 'I if(bpc <5 bpc > 8) ( -

1• setserial 0 - set serial port •I sttserial(bd, bpc, sb, par) int bd, bpc, sb, par; I short *m51ajb =Ox0295; short *baudot =Ox0299; char •.S1ctr =Ox0293; char tm51cdr = Ox0294; char *bitnum =Ox0298; unsi~ed

bpc • 8;

I

*bitn~

bpc = 8 - bpc;

/' parity ., if(par < 0 par > 7) I par = 0. I

indx;

I* input and output serial buffers •I static char iabufi2S6), otbuf(256) ; /' serial lllt4rfac:e functiOCJ 'I

I• optllSerial () · open Mrial port ' I ope:stnal () (

short *r!buf = Orl0f1 : short •robuf = Cx00f9:

mtch(bd)

/• put bpc, ab, and par 10 rtqs •/ 'a51ctr z (cbar ((bpc « 5) lab« 7)) ; ..:51cdr • (char) (par « 5);

I Cl$1)00

lJldl: = o· bruk,

case 450: 1lldx = 1 brw. CIJI 1200:

I 1• getstrialO • char froa serW port •I 9'tHrial ()

indx = 2

/* open nnal port */

open (RS, 2, 0. "'); {• ~art

pointers to bafftrs •/ •rl.buf = inbuf;

Transactor

• (ehar)(bpc + 1) ;

(

brui; dtfault: I* default to 300 bal:d indx = 0.

break;

*I

int ch ; char •rsstat • Ox0297;

ch = qetonecbar (RS)

)

58

December 1989: Volume 9, Issue 2


I• check !or empty buffer *I if((*rsstat ' Ox08)

)

== Ox08)

(

I* disk 1/0 functions •I

unsigned bates: street clock *clockl = Olde08; char *ct.odt • OldeOf;

ldehne SAilOR Ox6f

•cllode ,. Ox7f; /* IOdt 1s clock */

• disktrr ) - read enor cla.:u:el •I char *disktrr (disk, int disk

if(UitcJ ) 59) USICI : 59;

!• coovert sees to bed •I

(

bstcs • useca\10

(

return ·1·

I

else (

return ch )

)

I • patstnll() - char to atrial port •I

'

p::Uenal (ch) cUr ch· ( lnt

i.

putc(ch, RS);

I* delay loop for 1200 baud kludqt */

I

I* tell dnve to

I* getcloclt() • get current clock sees •I

clockl->boura = 0: clockl·>ainQtes • 0; elockl·>atcOnds = (char)bsees, clockl·>tenthl • 0· I' frM clock */

tall • I

ac = (char)disk; sys(TALK, &ac, &xc, 'yc) ;

for (i=O; i<KLUilG! i++) (

(

unsigned USICS; char junk; struct clock •clock1

•second = SADOR; sys(TKSA, 'ac, &xc, 'yc) ,

/ • klyboard interface functions */

!• opentb ()

unsigned get clock()

I* tell 1t what to talk ~t */ ac = (char)SADDR;

I )

• open keyboard

openkb ()

for (;;)

(

char 'rptflq

=Oxdc08;

junk • clockl·>seconds; ustcs = (junk &OxOf) t 10 * (junk>> 4),

I* read in the response ' / liP = msgbuf;

*/

( (useca, 10)«4)

ut cc, char ac, xc, yc; stat1c ctar ~(41] char ' liP· char •second =Ox0Cb9; char *status = Ox0090;

Junk

~

cloekl·>ttntha; / * frM clock •I

(

=Ox028a;

I* get byte

optD(EB, 0, 0, '');

I• let the keyboard rtptat •1 *rptflg = Ox80;

~rca bus

in acc •I

retura uStca,

ays (ACPTR. &ac, &xc, &yc);

I

tf(ac = '\r ')

I' end of file */

(

I

breal:;

I• mM- c • ,....... . protocol •/

I

I' closekb () - close hyboard ' /

*lp: IC

closekb()

ipH

(

I

close{DI;

*q>

I

1• V Mat W11tes

getkb () (

•1

lincludl <stdio.b>

='\0'.

/* tell dr1ve to shut ap */ sys(CYTLK, &ac, 'xc, 'yc);

!• getkb() - get char frca keyboard */

- Stpt 1988

/ • nUibtr of retrlts, tlleOUts ldthnt RETRY 5 ldt!ae 1'00f 2 ldt!ine 8!00! 10

*I

return (IIJ9buf), return getontchar(D),

I

!• charunq() • t available kb chars */ chaninq(l (

char *ndx = Ox00c6; return (int)•ndx;

I

/* protocol characters */

I* timer functions *I unsigned getcloek () ;

ldtfine SOH OxOl ldt!ine £Or Ox04 ldtfint ACK Ox06 ldtfint NAX Oxl5 ldtfint CAN Oxl8

I* sleep() • sleep for seconds */

ldtfint RECSIZE 128

slMp(usecs) unsigned usec.s;

I

l '

char •disktrr() ,

(

I* chltstop () - check for <C•> key *I

sttcloclt ( (u.~signed) 0);

chltstop()

I

wr *sh!lag = Cx028d; returu (•sh!lag

oa

Ox02),

I / ' getOI'Achar () • get char frca chan •/ static 91tO!llchar (clw:ntl) int channel

I

vhilt(gttcloclt() < usecs)

char ac, xc yc ·

int nc ict ttiu int tlMO\lt

(

I

!• liuffer for dlta in/oat *I

I

char bu!ftr(l32);

rtract clock / • stn:ct utcles CIA • /

I

I* MM!ilt () •

nnd tilt

aendfllt (fn~~~,

disk)

char ttoths · char seconds· char IWlutiS . char hours;

chu ' fiWII l.Dt disk;

va ._,_ *I

(

int at; I; int ch; xc = (cl.lr)chw.l· char trrbu![UI sys(CBXIM, 'ac, 'xc, &yc); 1• setclock() - set tiler clock *I char locna~~[211: sys (GETill, 'ac, 'xc, 'yc); setclock(usecsl char •status • Ox0090; rtturn(int)ac. unug:ted usecs; FILl! d.!ile; IL---Transactor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 59

December 1989: Volume 9, Issue 2


rae = 1;

ch = getcht.o (TOO!') ; if (tilltout)

strcpy(loc:oa. 1 fllUI). streat(locnaae, · ~ r'),

/ ' ahake hands 'I putserial (responae) I• qet 1st c:hu . , ch =geteht.o (root)

{

patserial(EO'l);

if (tialout l

l

J• attelpt to open f1le for r11d •/

else

drrice (diu) dtile = fopen (loennt)

I

triu-if (tnes

{

lf(ch = ACX)

/ ' cheek for disk error */ strcpy (ertbufl chsierr (duk) J; st =ato1 (errbof), lf(st >= 20)

(

(

pr111tf ('sent EO'l\o\n'); break·

cootinut,

printf ('C&n' t sync w/stndtr\o'); cloJt (dfilt); returo (O)

l close (dfile); printf ('\s traosfured\o\o' 1 fllUI), nturn(l);

l

)

if(ch

recvfile(foa~e,

I

char 'fna:na; int disk;

}

I

{

close (dtile); retlllll (O)

l

int st; int ch; int i ; char rl 1 r2, dt; int response; chu rchk; char loena. I21 J, char enbuf[U J; unsiqned chksua; PILl dflle:

contlnue;

l

(

close (dfile); printf ('Transfer cancelltd' \o'); nturn (O)

:

}

I

' 1

pnotf ('Stranqe char l\02x)\o' 1 ch); 9Qbble(); /* clear any weudness •/ rtsponll = w . ,. &lld try again .,

•'I;

/ ' att.,t to open file for wtlte de'fiee (disk): df1le =fopen(locname} for disk error • I strcpy (errbuf 1 diskerr (disk} ); st = ato1 (errbuf); 1f{st >= 20}

)

W)

{

I

break: printf('Strange char l\02x) \n'l ch) , )

}

l

print! ('Synched\n' ), f1lt •1 while (fillbuf (dfile 1 buffer)} (

I

/ ' clear input queue ' I while lqetsuial (} >= 0)

returo (O} •

}

if l'tuee(brJffu})

I

priotf ("lll) on reeoUII\D"}; continut;

I' qet 1 1 ccmp record number •/ 1

r2 • getchtmo(TOOT} ; if [timeout} printf ("THO on camp recnum\ n' }; continue;

J• get dlta •I chksUII = 0;

I

'I

dt : getcht.o (1'00!1; if (tialout)

I

I J• get a record ' /

{

cloJt (dflle):

prutf ('Record \3d tnu =RE'!RY; for ( ;

returo (O);

I

hrtak '1

reel:

I

*I

/* record l11ltlber •/

for(iEO; i<JW:SIU; it+)

/ ' tra!lsfu file response = !ill. for( ;)

close (dflle};

response = IWt : rl "qttchtm(100f}; if (tilltout}

}

I I

if (chkstop (} )

}

(

pr1ntf l'\s opened\n" 1 !name} ;

I• send the

•I

I

bllffer[1) = dt· ehkSUII +t dt ; chks~a ': Oxff; )

1f(ehkstop () I

J• cheek for dlta ti..eout •/

(

lf (tl.MOUt)

close (dfllel; nturn (O);

I

pr1ntf ("!MO on dlt1\o'); continue,

I 60

'!

l

}

close (dflle} ; sbowerr(fname, errbuf) ; return (O};

Transoc:tor

/ * done •/

else lf (ch =CAN) / ' cancelled */

I* cheek

close (dfilt); retlllll(O)

I

== EO'l)

)

streat(locea=e

/• tell • wt re doae patseml (!Of): for(.;)

ehe if (ch

printf( ' qot EOT\ n\ n'); clou (dfile}; putserial (ACK) ; printf( ' \s transfer rtd\ n\n' 1 fnaae); return (1) ;

printf ("TIMO!lt\o'): triu-if (tnes > 0)

1

I

rae = 1;

(

I

t

{

strcpy (loa:a•, tna.)

=

xmodem

disk)

(

if(ch

*/

tht

ell =qetchtm (81'00!) ; if (ti..eout)

II

/ ' beg of data

}

1• raevfile () - recv file via

printf('Synching .•. \o' ); if (chbtop ())

SOB)

brtsi.

printf ('\s opened\o' 1 fllUI};

{

=

{

}

for (;, )

•/

l

close (df1le), showtrt (f~ ertbuf); retlllll(OJ,

tries = !\!TRY.

1• try again

I

l

(

/' clear input buffer */ wbilt lgetltrial () >• 0}

> OJ

December 1989: Volume 9, Issue 2

II


I

I

,. qet checiS1111 . ,

I triu-- ; 1f(tm1

serchar = qetserial (); if( aerchu >= 0)

rchk = getcht.o(!'OOT): if (t i.Jieout)

(

(

return(serchar);

pnntf ('P.etryillq . .• \11'1; continue.

prtntf ("!MO on cbtcksua\n'); c:ont inllt ~

I

I

I

I

if (qetclocl: ()

pmtf("!IMOUt\n'); return(O).

>= tialen)

(

• a.p~re rec na &Dd 1' 1 CCIIIIIp 1f (/rl ' Ozff) 1= (r2 l Oxff))

I

rtCDIII

return 0;

I* a.p~re cbtcksua and local ont •/ if (rchk •= chksua)

I printf ('Bad chtchu.\n'); rtsponst • HAl, continue;

, . lllll)'lt rtlpOQit 1f(ch =CAN)

I

s\n"),

I

tllleollt = 1.

•/

I prilltf(' Bad c:ontinllt.

)

/ ' fillhllf() - get buffer of data fillhuf(filnua, bet) int filn1111: char buf(J;

prllltf('Canoe11ed\ll'); rttum(O) ·

*/

)

tlst if (ch -= ACK) (

printf(' ACKtd\n', rtc); break;

I int i , int echk; char •status = Gx0090 ;

if((rl ==(rtc-1) ' Oxff)) / * dupt •/

I tlat

I

if Ich "" IWI)

for (i=O; i<RECSIZB; i++)

I

I

I

printf('NAAtd\ n', rtc) ;

/• qat a char fr01 fi1t */ if( (echk=fgetc(filnua)) ==!OF)

printf ('Duplicatt rtcord\n'); responn = ACK; contlllllt;

I tlu

I

I

break;

I

printf ('Stranqe rerponst\n");

)

if(rl

'=

)

buf (il = tchk;

(rec' Oxff))

I

triu--. if(tdtl > 0)

I

printf i'Rtoord nalbtrinq trror\n") ; close (dfile) return (O);

if(i == 0) return 0,

I

/ • set rut of buffer to C'lllrt for(; 1<RECSI!B· i++)

riC#;

I

buf (i) =

!• write data to f1lt •/ (

I continat,

print f ("Olt\n•) response = ACK . )

I

prlttf("Mo IOrt rttries' \o'); rtturn (O)

I

(char)26 ~

)

rtc++; return(!);

return(!) · )

I

putc(bufftr(i(, dfile);

I

I

*I

I

for (1=0; 1<RECSU!: 1++)

!• tuec () - send rec,

get response

tuec(buf) char buf() ;

*/

/* qobblt ll - qobblt ap stray chars */ qobblt()

I

I int i · int ch; unsigned chksu:u;

unsigned qotooe ;

tries = RETRY;

lleep(2) ;

for( ;;)

for (;;)

pri.ntf('\nqobblinq\n");

I* showerr() - display disk error */ shoverr(fnlmt, trrm$q) char *fnlml; char *umq,

I erase (); 11091(11, 5); pillltf ("!rror accessing \s' , fn111); 11091{13, 5); prlDtf ("(\s]', erDISq) ; 11091(20 , 5);

• I

/• qetcht.o () - get char w/ tlaiOUt •/ qr.clltiO (tialtn) iJ:t tialtn •

I lilt

strchar;

taeout =0; setclock((unsigntd)O), / • start ti.lltr */ for(;·) Transactor

.,

I

I

I

l

> 0)

I

I

I*

gotone = 0; / • clear input queue '/ while (qetserial () >• 0)

send record •/

printf ('Record \3d •, rec); putmial (SOB); putserW (rec); putserial(/rec) ; chkSUI = 0; for (i=O· 1<RttSI!B; i++)

I

qotont = 1; )

if (qotor.e)

I

I

llttp(l).

putsmal (buf (1)) cbisu2 +: baf(i ). chksua l= Oxff;

)

tbt

I return;

I put serial {chUC!I);

I

t• get

response */ ch = qetchtiO (BTOO'r); if {timeout) 61

I I

1• end of file

•/

l1

December 1989: Volume 9, Issue 2


Toward 2400 RS-232 revisited by George Hug timer with the difference. After the timer is started, its reload latch is reset to Sffff. This appears to be a software emulation of the VTC 20's 6522 VIA chip. The VIA's Timer B has no continuous mode, but its one-shot mode underflows to $ffff and continues counting down. Since the CIA's Timer B does operate in continuous mode. the VIA emulation seems to be pointless.

The performance of 2400-baud modems with C64s and C 128s will benefit from a new look at the RS-232 servtcmg routines. That performance is poor at I MHz, and error. occur even at 2 MHz when data flows continuou!tly or in both dtrections at once. The 64 and 128-mode RS-232 drivers (which are almost identical) are inefficient and contain several outright bugs. There is even a hardware glitch in many 6526 CIA chips. New routines overcoming these faults \\-ill permit error-free communication at 2400 baud at either CPU speed.

2. The RS-232 driver is biased tO\\-atd a late samphng of pin C. The sampling point is 70 cycles late in the lirst place because of code execution time between the mid-bit NMI and the actual sampling. (In 128 mode, samphng begtn'> 91 cycles late. but works back to near mid-pomt at a rate of 12 cycles per NMl.) In addttion, since the VIA emulation manually restarts Timer B, any video DMA during that proce'>~ rna) cause a permanent, cumulative, 40-cycle delay in all :.ubsequent samplings of the current byte. Finally, the actual pin-C data rate of a 1200- or 2400-baud modem may range from the nominal baud rate to as much as 1.6111- fast. The combination of late sampling points and short bit periods may result in a sampling pa~t the end of a bit period.

Commodore RS-232 The RS-232 drivers send and receive data one bit at a time. At 2400 baud the transmit driver runs Timer A of CIA#2 in continuous mode with a latch value of 426 (the 1-MHz l/0 clock I! divided by 2400). On each timeout, the NMl service routine places the next bit of outgoing data on pin M (PA2) of the User Port. Ten Mls must be serviced to transmit one byte of 8/N/1 data. Timer B is used for received data, which enters on User Port pins B (FLAG) and C (PBO). The high-to-low transition at the beginning of the ~tnrt bit generates a FLAG NMI. In response, the service routine disables the FLAG NMI, enable!> the Tuner B NMI, and sets Timer B to ume out at the mid-pomt of the \tart bit. (The service code itself uses I 00 of the 213 cycles in a half-bit, leaving a timer load value of 11 3.) When the NMI occurs, Timer B is set to time out every 426 cycles so that pin C can be sampled at the mid-point of each bit period. At mid!ttop-bit the NMls are switched back to start-bit detection mode - FLAG enabled, Timer B disabled. Eleven NMls must be serviced to receive one byte of data.

3. Continuous data now hits a bottleneck at the junction of the Mop and start bits, \\-here three NMb occur within one bit period. For example, the mid-stop-bit NMI requires 287 clock cycles to service (325 cycles in 128 mode - the extra time results from saving and restoring the current bunk), but at 2400 baud the next byte may start nfter only 213 of those cycles. A related limitation is the 2224 cycles (2639 cycles in 128 mode) of total NMl service ume needed to recetve one byte of data. At I MHz. continuou~ 2400-baud inflow requires 55% (66%) of available clock cycles just to service NM!s.

RS-232 inefficiencies

RS-232 bugs

The following characteristic do not produce error. as such, but needlessly limit the baud rate attatnable at a gtven CPU speed. All relate to the receive function.

The defects descnbed below cau-;e errors without regard to baud rate, mode or CPU speed. I. The routine at $f0a4 ($e7ec in 128 mode) disables all RS232 activity so thut NMls will not corrupt dis~. tape or REU access. It is called by the KER..'AL routines LOAD. SA\ E. OPEl\, CHKr'\, CHKOIJT, LISTE~ and TALK for serial bus devices and the datasette. It should be called, but is not, by D\1ACALL- the !28's REU routine at $ff50.

I. During each byte, 450 clock cycle!> are consumed in manually re-starting Timer B once per btt. The re-start routine located at Sfedd ($e87f in 128 mode) -determine' how long ago the umeout occurred, adds an allowance for tts own execution time, subtracts that sum from the bit time, and loads the Transactor

62

February 1989: Volume 9, Issue 3


f0a4

pha

f0a5

lda $02al

;copy of enabled NMia

f0a8 fOaa

beq $f0bb lda $02al

;none enabled - done.

tOad

and l$03

;TA(bO) or TB(bl) enabled?

!Oaf

bne $f0aa

; yea , teat until idle

fObl

lda 1$10

; no , awaitinq atart bit

f0b3

ata $dd0d

; d.i.aable FLAG NMI (b4)

f0b6 f0b8

lda l$00 sta $02al

; all off now (?)

fObb

pla

fObc

rta

simultaneous 1/0 • when Timer A generates the NMl and Timer B times our just as the service routine reads SddOd.

; any current activity?

A sofh \ are solution The most demanding performance standard for full-duplex RS-232 is the error-free processing of continuous. bidirectional, as)nchronous transmission ("CBAT"), meaning that data streams generated by unrelated clocks flow. without pause, in both directions at the same time. Fonunately, such performance at 2400 baud IS anainable through software. even at I MHz. The approach pre. en ted here retains bit-by-bit servicing. but adopts a few key simplifications. beginning wilh elimination of two receive NMis. The mid-stan-bit NMI exists only to check for a false start bit, which for technical reasons would never be detected on a PSK/QAM modem. The mid-stopbit NMI tests for a framing error, or missing stop bit, which is ignored by most software.

;update copy

The $ffiaa-ffiaf sequence pauses until the tran~mit buffer has been emptied and any incoming byte ha~ been received. Then at Sffib3 it turns off the Mart-bit detector. However, if an incoming stan-bit edge should arrive after $ffiaa but before Sf0b3, the resulting NMI serv1cing will disable FLAG (making $f0b3 redundant) and enable the Timer B NMI. Since Sffib8 clears only the ma~k. copy, the Timer B NMI will indeed rake place, with unpredictable results.

Another change is the removal from the NMJ service routine of all matters related to parity, x-line handshake, half-duplex transmission, multiple stop bit~. and the RSSTAr framing. parity, overrun and break errors. All such items take up time, are seldom used, and can be implemented separately if really needed. Finally, the VIA emulation is discarded.

2. In the BSOUT routine the buffer pointer is incremented (at $f020/$e768) before the b) te to be transmitted is placed in the buffer (at .Sf026/$e76e). If the l'.MI service routine comes looking for that new byte in the Interim, it will transmit the wrong character.

New Modem Routines

3. The routine at Sef3b ($e67f) is used by the 1\'MI service routines. and by CHKJJ\ and BSOUT. to enable or disable an NMT source, as !>pecified m the accumulator.

1

ef3b

ata $dd0d

; enable or disable the NMI

ef3e

eor $02al

;chanqe copy to match

ef4l

ora 1$80

; enable bit on

ef43

sta $02al

;update copy

ef46

ata $dd0d

;enable masked NMia

ef49

rta

Program l ("newmodem.src") is generic assembl) language source code for a collecuon of ne"' RS-232 rouunes. The code is not a patch to any specific BBS or termmal software, but ralher one example of what might be installed b> the author of such a program, or by one havmg access to its source code. The assembled code uses less than two pages of memory. In 128 mode it must be visible m bank 15. The new NMI routine begins at line 3000 by pushing the register~ onto the stack (already done in 128 mode. which enters at 3050). Lines 3060-3170 detcnnine which enabled NMT sources have triggered. The 6526 glitch i~ finessed by comparing the high byte of Timer B before (3060) and after (3110) the read of the interrupt register (3090). If the value is higher after the read than before, then Timer B must have timed out during that period. Line 3140 makes sure B's flag bit is set in the accumulator, and 3150 make~ sure it 1s cleared in SddOd.

The routine is executed while NMis arc enabled. Should an NMl of the opposite "direction " occur after $ef3e and before $ef46, the resulting servicing may change the NMJ enabled for that direction. Upon the return, however, $ef43 or Sef46, or both, wiU restore the old (wrong) NMI. This error occurs only when transmiss1on takes place in both d1rections simultaneously.

Beginning at 3180 the routine is structured to accommodate CBAT. The NMT routine does only a few critical operauons while the NMh are di~abled, savmg its "housekeeping" chore~ for later That prevents a new "'MI (one occurring after 3090) from going unserviced for too long. The critical operation for the Timer A NMI is placement of the next outgomg bn on pin M (3200-3230). The FLAG N\11 must load Ttmer B with the ~tart-bit timer value and start it counting do"' n (32703320). The Timer B NMI must sample pin C (3120). (Pin C is sampled on every NMI; the sampling is ignored if Tuner B is not an NMJ source.) Once these operations have been completed, the NMTs are re-enabled (3360 or 3470).

4. It appears that man) 6526 CIA chips have a hardware defect involving the interrupt flag for Timer B. lf Timer B times out at about the same time as a read of the interrupt register. the T1mer B flag may not be set at all. Under the VIA emulation, Timer B Will then underflow and count do"' n Sffff cycles before generating another NMI. A whole serie of incoming bytes may be lost a~ a result. The defect was present m five of six Cl28s and two of three C6-h '-ampled. When "good'' and ''bad" chips were switched, the problem followed the "bad" chip. There appear to be no such defects with respect to the flags for Timer A or R.'\G This glitch can cause errors during Transactor

63

Febru ary 1989: Volume 9, I$$Ue 3

I


Housekeeping chores for lhc Timer A NMl (3720-3920) include isolaring rhe ne\l ou1pu1 bit, or felching the next byte from the rransmil buffer. or Mopping Timer A and disabling its NMI if the buffer b em ply. (Timer A is loaded and started, and its NMI enabled. only by BSOUT.) In FLAG housekeeping (3330-3420). the A.AG NMI i\ di'>abled and the Timer B NMl enabled. the Timer B reload latch .., loaded \\-llh the full-bit timer value. and the bll counler is initiahLed. Timer B housekeeping (3510-3680) procc,-.e, the sampled pin-C value. If the last data bit has been received, the new byte iJ, stored in the receive buffer, Timer B b Mopped, and the NMls are prepared for a new start bit - n..AG enabled. Timer B disabled.

The new NMT rouline was rested under CBAT conditions to establish the recctve rimer values which work. for various combinations of compuler. CPU 'peed, video DMA activity and modem <>peed. The rem made u<>e of the fact rhm a 50%-dutycycle '>quare wa' e also consutute' contmuous transmission of the lener 'u' <q(o I0 I0 I0 I) in RS-232 8/N/1 format. The square wave was genera led U\lng the ~enal port of CIA# I. the clock output of ""hich (CNTI) is available at pm 4 of the User Port. A spare card-edge connector (Cinch #50-24A-30) ""as installed in the User Port ""llh pins 4. B and C wired together.

The procedure at 3630 '" u~ed to change the enabled NMis. It disables all NMh, calculate~ the new conliguration. and then enables that configura! ion. The duplicale disabling instructions at 3640/50 are necessary because an NMJ occurring during the first one will be serviced immediately thereafter, resulting in re-enabled NMh which must be disabled again by the second (there is norhing left to interrupt the second).

Program 2 ('calibrare') \\-3'i U\ed to run the tests. It keeps the CNTI "modem" clocking contmuously by feeding new ourput to the CIA# I serial port during !he IRQ routine. ll parks in a GETIN loop which prints an ·•· to the screen if a received character is not a 'u'. Program 2 also provides for continuous transmission by filling the output buffer with u's and changing line 3820 to read, in effect, 'beq gelbuf'.

Following the new NMI routine are replacements for !he defective routine!. described earlier. A new DlSABL at line 4000 is a substitute for !he old one at $f0a4/e7ec. Since the old one cannot be re-vecrored, a call to DISABL should be made before any disk, tape or REU operation if there is any chance that the modem might generate an NMI. The "BSOuT routine at 5000 ts a new fronJ end for BSOUT which corrects the buffer poinler problem and avoids a calllo $ef3b/e67f. A direcl call to RSOliT (5050) will \end a charac1er to the modem regardless of the curren1 outpul dev tee.

Timer values for the receive start bit (~b) and full bit (fb), the CNTI ··modem" (en). and the rran,mil function (tx) are set in line 210 of Program 2 for each Irial, which consists of running the program and looking for a'lterisb. If none appear then CBAT proce!>sing is error-free at those settings. One minute is enough to run through the possible overlaps of tmnsmit and receive N'Mls, and video DMAs if enabled. Asynchronou!> timing is approximated if the fb, en, and tx values are different.

Calibration and performance

Table I shows the 2400-baud test re'ults with the tx rate fixed at 2400 and rhe fb rate fixed mtd\\-ay between 2400 and 1.6% fast. For each hard""are combmatton, the tests determined the highest and lowest start-bit time., (sb) providing error-free CBAT. While the acceptable sb mnge varies with each set-up, there is a 70-cyclc range. with a mid-point of 459, which works in all sci-ups. Any change to !he new NMI routine would require re-calibration, and the results might be different.

NCHKJJ\ a1 6000 is a new front end for CHKJI', which avoids

Sef3b/e67f. A direct call to NABU: (6070) will re-enable the RS232 input function \\- ithout also selecting device #2 for input. Either KCHKN (to #2) or tt-.ABU;: muM be called after disk. tape or REU operations 10 re-enable start bit detection. The BAUD section (6090-6190) sets the receive baud rate by poking the correct rimer values tnto the NM I service code. It assumes that the current baud rate is already reflected in the BAUDOF variable at $299 ($a 16), and select.~ one of three baud rate!. (2400. 1200. or 300) ba!>ed on the high byte value of BAUDOF. If 1\CHKIN (to #2) or INABLE will be called frequently, BAuD should be moved to a separate rourinc which is called only after OPEN or when the baud rare needs 10 be changed. Provision could also be made for additional baud rates if needed.

Table 2 compares !he NM I service ttme!. required under the old and new rout ines. Reduction~ are particularly dramaric in the receive function. Program 3 ('ciatcst64') tests for the glitch in Timers A and B of CIA#2. Load and run in 64 mode only, without the card edge connector. Only a Timer B glitch has been found so far.

RSGET a1 7000 will fetch a character from the RS-232 inpul buffer regardle~s of !he current mput device. It differs from GETL'l in that it does nothtng to RSSTAT but instead return~ with the carry flag set if the buffer was empty.

For rransmisston in only one direction at a time. the 'newmodem · routine!> should be replaced w11h shorter. fa'>ter ones. The "simultaneous" bugs will no longer occur. 'lepamte routines for each NMI l} pecan be vectored in at $3 I8/3 I 9 in sequence, and NMis need not be disabled during servicing. Much higher baud rates can be attained under those conditions.

The SETUP routine al 2000 point\ the relevant page 3 vectors to the new NMl, 1'-;CHKN and NBSOl'T code. SETUP ts the first entry in the JUmp table ( 1530). AI'>O mcluded in the jump table are the non-vectored routines NABLE. OISJ\BL, RSGET and RSOUT. Finally, the receive ~tart-bil and full-btl timer values for the three baud rate~ are located in a table begmmng at 1590. Transa<:lor

Random thoughts

I. The usual ca"ears apply about cartridges, special ROMS, IEEE drivers, and connecling anything homemade 10 rhe u.,er Port. 64

February 1989: Volume 9, Issue 3


2. CIA chips produce a count equal to the timer load value plus one So a 425ttmer value i;. re<tll) 1022727/426 = 2400.8 baud.

Progra m 1: Source code for the new

3. The SLOW command tum;. on the vtdeo DMA;. even in 80column mode (the 40-column c;creen sho'"'' a border). Tum off the DMAc; b} cleanng the blanl..mg bll - bll 4 of ~01 I. Program 2 does thai through 'anable dm.

1110 · "ctWIOdte arc• • 64 lOde. 1120 @128 = ch&nqts for 128 lOde.

4. Nev. driverl".

\~ill

not cure nboned Xmodem or Punter transfers caused by runnmg I MH1 transfer routines at 2 'v1H7. bur the} v. ill permit the routines to be run at I \ 1H7 without modem error;..

5. Program I \tart;. <tnd l>tOps the umers .md aho enables and disables their NMis. If nothmg else uses the timers. the NMis could be lch enabled. Time aJ.,o mtght be saved b) havmg the transmit NMI!. occur only when the level on pin M needs to change, or at the stop bit, whtchever occur~ liN.

Table 1: Calibration Rel>ults for 2400 Baud. Computer mode CPU

~peed

64

(MHt)

I

12H I 40/KO on 425 421

426

128 I

128

RO

80

of I 425 421

oil

426

2

Displa> mode Vtdeo DMA' TX (Tx bu time ) FB !R>: full hill

40 on 425 42 1

"''ominal modem: C'\ !CNTI ''modem") Low SB !R>: \tan) High SB

426 '\94

J<>2

:no

426 424*

56R

5.lH

618

724

418 .150 524

418 '\48 494

418 290 580

418

425 421

Fa!>l modem: c~ Lo~

SB High SB

354 688

• \1ost restrictive. Mai·JXHnt - 459

Table 2: NMI Service Times (cycles per byte). 6-1 Mode OLD

Transmit: Data bits 1-8 Stop bu Start bit 1

To1;1l

:no

1

EW

........

128 Mode

OLD ...

......

NEW

196 179

1192 14H 17]

1624 234 217

1'\60 169 194

1695

1513

2075

1723

Recehe: FL\G

Stan bu Data bit\ 1-7 Data bull Stop bit

Totru

157 188

153

139~

959 1H5

199 287

195 223 1659

B7 .325

174 1106 206 -

----·--

-------

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

..-------

2224

1297

2639

l486

~erial

1130 1140 1150 1160 1170 1180 1190 1200 1210 1220 1230 1240 1250 1260 1270 1280 1290 1500 1510

--------------------------------------------ribuf •$!7 ;@121 $c8 robof z$!9 ·ma Sci bindof =$0299 :@128 $0&16 r1dbe =$029b :@121 $0&11 nc!bs =$029c : @128 $0119 rodbs =$029d ·ma so11a rodbe =$029e @128 $011b whl •$02&1 @128 $0&0! rstkey =$ft56 :@128 $fa4b norest =$ft72 :@128 $fa5f @128 $ff33 return •$ftbc oldout =$f1cl ·@128 $tf19 oldchk =$f2lb ·@128 $flOe findfn =$f30f ,@128 $!202 devnwa =$f3lf ,@128 $!212 nofilt =$f701 ; @128 $f682

1S20 1530 1540 1550 1560 1570 1580 1590 1600 1610 1620 1630 16CO

;--------------------------------------------IXOO jlp setup xz03 j1p inab1t xx06 jlp duabl u09 jlp rsqet xxOc JIP rsoct nop stn24 word $01cb m start·btt tt•s strtl2 .word $0442 1090 strt03 word $1333 4915 !111124 word $01&5 ; 421 !1111-blt tau !111112 .word $034d US f111103 .word $0<152 3410

1650 2000 2010 2020 2030 20CO 2050 2060 2010 2080 2090 2100 2110 2120 2130 3000 3010 3020 3030 lOCO 3050 3060 3070 3080 3090 3100

·--------------------------------------------'@128 l<nm128 setup lea l<nm64 lc!y l>nai6C ; fl28 l>tw.128 ata $0318 sty $0319 lea l <nchki11 lc!y l>nchkill sta $031e sty $031! lea l<nbaout lc!y l>nbsout sta $0326 sty $0327 rts

3110

modem routine\

•·--------------------------------------------• @128 $1a00 •$ce00

•·---------------------------------------------

aai64

pha tu

phi tya phi na1128 cld ldx $dd07 ld.l l$1f

Wifle tiM! b lu byte dluhlt Cll - , .

stl $dd~

lea $ddDd bpl notci& cp1 $dd07

rtad/clt&r fllgs (rutort kty) tb tJ..MOut SlCCt 3060'

[L_T_ro_n_soc _ t_o_r_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 65_ _ _ _ _ _ _ _ _ _ _ _F_e_b_ru_ory 1989: Volume 9, Issue 3


---

I\

3120 3130 3140 3150 3160 3110 3180 3190 3200 3210 3220 3230 3240 3250 3260 3270 3280 3290 3300 3310 3320 3330 3340 3350 3360 3370 3380

mo 3400 3410 3420 3430 I ' 3440

mo

3460 3470 3480 3490 3500

I!

auk

ldy $dd01 bcsaask ora f$02 ort $dd0d IDd tlllbl tu lsr bee clihg ldl $dd00 l!ld t$fb ort $b5 stl $dd00

ckflag tu and•l$10 beq nalOD strtlo ldl l$42 sta $dd06 strthi ld& 1$04 sta $dd07 ldl l$11 stl $dd0f ldl 1$12 eor enabl sta tnabl sta $dd0d fulllo ldl l$4d sta $dd06 fullhi lda l$03 stl $dd07 ldl 1$08 stl $a8 bet chkhd CotCll ldy l$00 J1P utity ClllOil lda tnabl sta SddOd

; (wplt plD C)

3740 3750 3760 3770 3780 3790 3800 3810 3820 3830 3840 3850 3860 3870 3880 3890 3900 3910 3920 3930 4000 4010 4020 4030 4040 4050 4060 4070 4080 4090 4100 4110 4120 5000 5010 5020

;no ;yts, Itt fl&q lD ICC. ; rttd/clur fltgs 19110 ·usk out non-tlllbled :thtst IIUJt bt st"lC:ed ;twr a' (b1t 0) ;oo ;yes, p:~t b1t 011 p1D a

:•flag

nal'

(blt 4)

;no ;yes, start-b1t to tb

;start tb counting ;*flag nai off, tb on ;updltt muk ;enable new con!1g , change reload latch • to fol1-b1t tlM

.I of b1ts to

reetlvt

:branch tlnya :or JIP const : re-entblt n11 ' s

SOlO

tu

and l$02 beq chktld JSlO tya 3520 hr 3530 ror $11 JSCO dec $a8 3550 bne txd 3560 ldy ridbt 3570 lda $11 sta (ribuf),y 3580 3590 1DC ridbt 3600 lda l$00 3610 sta $dd0f 3620 lda 1$12 3630 sntch ldy 1$7! 3640 sty SddOd sty $dd0d 3650 3660 eor tlllbl 3670 sta entbl 3680 ata Sdd'Jd 3690 t~ tu 3100 lsr 3710 clltld bcceut no dec $b4 mo lia1 clw: Transactor

-

,tlDtr b' (b1t 1) no ;yes, tample froa 3120

5040 5050 5060 5070 5080 5090 5100 5110 5120 5130 5140 5150 5160 5170 5180 5190 5200 5210 5220 5230 5240 5250 5260 5270 5280

·rt232 11 lab first . byte hniahed'

;no ·yes, byte to buffer ; (no overrun test) :ttop tiller b

;tb

off, •fltg on ;dlstb1e nai ' a tW1Ct 011

;updlte usk •tntble DIW C0Df1g ' tUIIr a' no yea , byte fin11htd' yes 66

low store ent clw:

ldl ror bcs ldl stl

J1P ldy cpy beq

ge+..bllf ldl 1nc sta ldl sta bne hoff ldx stl lda bne

t$04 $b6 store l$00 $b5 uturn rodhs rodbt t1off (robaf), y rodhs $b6 1$09 $b4 low 1$00 $dd0t l$01 switch

·no. prep cut b1t • (fill w1th stop bits)

, restore r191, rti ;buffer t=pty'

:yu ;no, prep cut byte

:I b1ts to send tlways - do stlrt b1t ·•top tiller 1 ;dlsable ta w ;alwtys

•·-------------------------------····----------

disabl phl test lda enabl and 1$03 bne test lda l$10 Stl $dd0d ld& l$02 l!ld tnabl hnt ttst sta enabl pla rta

; turns off IIIOdelll port ;any current activ1ty? yes, test again :no, dlsable •!lag Mi

·currently rtctiYing' yes stut ovtr lll off cpdate uu

--------------------------------------------ahsout phl lda $9a Cllfl 1$02 br.t notaod pla rsout ata $9e sty $97 po1nt ldy rodbt sta (robuf). y iny cpy rodbs beq fulbuf sty rodbt strtup lda enabl l!ld 1$01 bnt ret3 sta $b5 lda 1$09 sta $b4 ldy rodhs lda (robuf), y sta $b6 li!C rodhs lda baudo! stl $dd04 lda baudof+l sta $dd05 ldl l$11 sta $dd0t

new blout

;output to aodeJa

not off1c1al till 5120 ;buffer full' yu no, bllllfl pointer tranlldtt1ng now? yu no, prep start b1t,

•• I b1ts to nlld,

• l!ld next byte 0

;full ta b1t tUII to ta

:atart tUIIr a February 1989: Volume 9, Issue 3


'

5290 ldi l$81 ;enable ta lllll 5300 change sta $dd0d nai clears flag 1! set 5310 php save uq atatua 5320 ltl duablt uq 1 mo ldy 1$7! duablt 11a1 ' 1 5340 sty $dd~ 5350 rty $dd0d 5360 ora Clbl ;update IIUk 5370 m Clbl 538J sta $ddOd ;enable 0111 conflg. ;reatort uq rtatcs 5m plp 5400 ret3 clc suo ldy $97 S420 1di $9t 5430 rts suo fulbuf Jar strtup 5450 ~ po1nt 5460 noblod ph ;back to old bsout S470 j~:p oldout 5480 •·---······-···············------····-········· 6000 nchkin jar findfn ;new chkin 6010 bne nosucb 6020 Jlr devnua 6030 ldi $ba 6040 Clip l$02 6050 bne back 6060 sta $99 6070 inablt Ita $9t :enable rs232 tnpat 6080 lty $97 6m baud ldi baudof+l ;set recelVt to s&M llld 1$06 6100 : ba~d rate as lilt 6110

tay

6120 lda rtrt24 'y 6130 rta rtrtlo+1 :ovenntt Yalut ~ 3270 6140 lda ttrt24+1 y 6150 rta atrtlu+l 6160 lela ful124 ,y 6170 ttl fulllo• 1 6180 lda full24+1 , y 6190 rta fullhi+l ldi tnabl 6200 6210 and 1$12 :*flag or tb on' 6220 bne retl ;yes 6230 sta $dd0f :no, atop tb 6240 lela l$90 ;turn on flag nmi 6250 Jlllp change 6260 nosucb JliiP nofile 6270 back lela Sba 6280 JIIIP oldchlt 7000 7010 7020 ;Q30 7040 7050 7060 7010 7080 7090 7100 7110

rsget

sta $9t sty $97 lc!y udbs

Program 2: Caltbrmion progmm lor the 64 or 12R. PD 100 re~ •calibrate' for 64 or 128 . Ml 110 rea connect user port p1n1 4, b ' c. Cll 120 re~ load ntw»lew' obJect code at pl . Dlt 130 rem for 128 lOde, un·rea 230·250. W 140 res adJUSt nluu 111 210. run . • • error Ll 150 rem run/atop rtatort to tLd tr1al NG 160 r.- s = (1, 2) abr, da =daa off(O), un (l). Ill 170 res Cl. 180 clo.se 2: open 2,2,0, chr$(6)+chr$(0): 111=12288 LP 190 for 1=111 to 111+116 read a poke 1 a r=r+a cext DO 200 if r<>15157 then print data error' close2 end PC 210 tb=459 fb-421 cn•418 tP425 1•1 d.Pl EJ 220 rt=65212· bf:pttk(250) *256 bo=665· pl=S2736 NR 230 rea ri=65331 bf=l328: bo=2582. pl=6656 BI 240 rea alow. 1f s•2 then fast · goto 260 NO 250 rea 1f ds=O and petk(215)thtn poke 11+107, 234 FG 260 for 1=bf to bf+25S· poke i,85: next: sys pl KL 270 a=p1+16+(tx/256 and 6). b=sb: goaub 310 IO 280 a=a+6: b=fb: goaub 310: a=bo: b=tx: qoaub310 DI 290 a=251: b=cn: gosub 310· a=S98 : b=ri: gosubllO NP 300 poke pi+2U,O: printl2 "u'.: sys 11 GG 310 q:tnt(b/256) poke a+1,q poke a.b·q*256. return BI 320 dita 162, 2, 32 198, 255. 32, 39, 48 PO 330 data 32. 228, 255, 201, 85, 240, 249, 32 DI 340 dita 183 255, 208 244, 169, 42, 32, 210 CJ 350 dita 255 76, 8 48, 169. 255 141 12 !J 360 data 220 173, 13 220, 108. 86, 2, 120 FA 370 data 166 251, 164 252, 169 0, 141, 26 lK 380 data 2C8 141, 15, 220, 169, 127, 141, 13 IA 390 data 220 141, 25 208, 142 4, 220, 140 AI 400 data S 220, 169 81, lU U , 220, UO BL 410 data 255. 140, 12 220, 162 S, 173, 13 IA 420 data 220. 41, 1 240, 249 202. 208, 246 IJ 430 data 140. 12, 220 169 28 141, 20, 3 PP 440 data 169 48, 141 21 3 169, 136, 141 Ilt 450 data 13 . 220, 88 96 173. 17, 208, 41 AG 460 data 239 141, 17, 208, 96

Program 3: CIA chip tc\1 for the 64. W 500 rem "ciatest64' for 64 aode only. MA 510 rea • • interrupt flag error

BG 520 rem reset after test. AI) 530 rea BL 540 n:12800: for i=n to n+103· read a poke i ,a. t•tta QA 550 next if t<>ll949 thtn pr1nt'data error· :end EG 560 sys 65412: x=not x: poke 251, x and 255 00 570 punt chr$ (147) ;•any hy sw1tcbes taer • ID 580 pr1nt'test1ng ttDer ';chr$(6S·x): aya n JB 590 watt 198,7: poke 198.0 : goto 560 &I 610 data 170. 169, 98, 160, 3, 141. 4. 221 JG 620 data 140. 5, 221, 142 , 6. 221 140, 7 GO 630 data 221 169, 17, 141, 14. 221 141, 15 !L 640 data 221. 162, 2, 160, 7, 36. 251, 48 GG 650 data 3. 202, 160, 5, 134 252, 140, 77 OL 66~ data 50 140, 85, SO, 138, 73, 131, 162 JL 670 data 72, 160, 50 142 24, 3. 140, 25 EB 680 data 3 174, 13 221 141, 13 221, 96 FL 690 data 72, 138, 72, 152 172, 7, 221, 72 !'!' 700 data 173. 13, 221. 216 204, 7, 221, 176 ~ 710 data 12 13. 13. 221 37, 252, 208, S JE 720 data 169 42, 32, 210 255, 76. 188, 254

; 1nput fr011 aode:a

cpy ndbt

buffer llpty'

beq rtt2

yu

lela (ribaf ), y co, frtcb character sta $9t lDC

ret! ret2 lut

Transactor

ndbs

clc 1dy m ldi $9e rts

:cc = char

111

ace.

:ca = buffer was 11pty 67

February 1989; Volume 9, Issue 3


Pro~ ram

4: Generator for the CfH new modem rouunes.

Program 5: Generator for the C 128 new modem routmes.

i I

9&1ltr&tor for ne.od64 .ob)" n 110 n$= newod64 .obJ• r• DDe of pfOCJru GF 120 ~494 : aa=S2736: ch•58580

Nl 100 r• qeuerator for •cewod128.ob)" 1IC 110 n$s' ntwodl28 ob)• l 8 n.. of proqru OG 120 ncl=494 : aa::6656: ch=51020

(for lilies 130·260, see the standa.td qeuerator on page 5)

(for lillts 130·260, ••• the standa.td generator on page 5)

BC 100

DB IJ Ill CI JB llll IIG J1

II CB JF

or CI CG

Jll

88 1111 JIC

IL

rr

II 11M BG JP AG AP MO LB JC B! J1

11 m li JO It

17 PS Gil 1111 DB IlK ri

II JO

AM 1L D

Ll BF PJ lA i'G

110 liP 1

n JB AI IIG Il DG IP

l8

1000 data 76, 1010 data 207, 1020 data 203, 1030 data 77, 1040 data 141, 1050 data 160 1060 data 16~ 1070 data 39, 1080 data 216, 1090 data 221, 1100 data 221, 1110 data 13, 1120 data 144, 1130 data 181, 1140 data 47, 1150 data 141, 1160 data 169, 1170 data 141, 1180 data 169, 1190 data 168, 1200 data 173, 1210 data 2 1220 data 168, 12J0 data 145, 1240 data 15, 1250 data 221, 1260 data 161, 1270 data 14, 1280 data 182, 1290 data 188, 1300 data 240, 1310 data 182, mo data o, 1330 data 72, 1340 data 169 1350 data 161, 1360 data 96, 1370 data 104, 1380 data 145, 1390 data 140, 1400 data 208, 1410 data 172, 1420 data 157, 1430 data 173, 1440 data 141, 1450 data 8, 1460 data 13, 1470 data 141, 1410 data 158, 1490 data 104, 1500 data 60, 1510 data 208, 1520 data 173, 1530 data 206, 1540 data 119, 1550 data 185, 1560 data 2, 1570 data 169, 1580 data 165, 1590 data 151, 1600 data 8, 1610 data 24,

Transactor

28, 76, 1, 3, 24, 207, 33, 3, 174 173, 172, 13, 10, 141, 169, 7, 18, 13, 3, 208 161 240 208 247 221, 140, 2, 198, 176, 254, 13, 169, 142, 173. 16 2 72 133, 249, 158, 58, 157, 2, 154, 14, 120 221 13 96 76 32, 54, 154 141, 206, 23 41 144, 186, 172 177 164

206, 213, 66, 82, 3, 141 160 96, 7 13, 1, 221, 173, 0, 66, 221, 77. 221, 141, 60 2 44, 34, 238, 169, 13, 141, 180, 2, 172, 177, 9, 14, 161, 141, 208, 165, 158, 200, 2, 133, 2, 173, 2, 221, 160, 13, 221, 32, 202, 31, 133, 2, 114, 185, 206, 18, 76, 76, 156 247 151,

16, 156, 207, 76, 4, 51, 13, 169, 140, 25 . 30, 3. 207, 141 72, 138 221, 169 221, 16, 221, 176, 45, 161, 0, 221, 221, 138, 141, 6, 169, 17 161, 2, 169, 77, 7, 221 160, o. 141, 13 152, 74 172, 155, 155, 2, 18, 160, 221, 77, 13, 221, 48, 13, 169, 0, 157, 2, 249, 238, 133, 180, 221, m. 2, 41 13, 221 237' 141, 154, 201, 132, 151, 204, 157, 173, 161, 181, 169, 177, 249, 153, 2, 141, 5, 169, 129, 127 140, 161, 2 40, 24 59, 207, 241, 32, 243, 165, 153, 133, 41, 6, 206, 185, 22, 206, 141, 145, 208, 35, 101 207, 27, 242, 2, 204 133, 158, 165, 158,

207, 41, 19, 59, 3, 140, 38, 72, 127, 77, 5, 2, 41, 41, 221, 141, 141, 141, 169, 76, 221, 102, 2, 169, 127, 161, 138, 169, 133, 204, 157, 208, 1. 3, 169, 161, 2, 172, 2, 2, 9, 133, 141, 221, 141, 13, 141 1£4, 76 15, 186, 158, 168, 17, 141, 206, 141, 76, 133, 155, 238, 96

76, 207, 165, 160, 169, 31, 3, 152 141. 236. 9.

110. 251, 16, 169, IS, 161, 6, 8, 86. 138. 170. 165. 0, 140, 2, 74, 4, 181, 158, 2, 228. 208, 208. 2 2, 208, 158, 240, 41, 133, 182, 4, 169, 13, 221, 161 151 45. 243 201 132 185, 206, 140, 173, 15, 1, 158, 2 156,

8 234 1 206 140 3 140 72 13 7 2 74 5 240 4 221 2 221 133 254 41 198 170 141 13 141 144 102 76 2 133 162

!I:G !D Ill Pll JB

Ill JB Jl 0:

Cl JF IG'

CI CG JN

BB Ill JIC

IlL BX II ~

DE M5 AG BP IO LB JC GP LL £B

tsa

18 BG

249 45 104 96 2 74 1 180 238 221 17 221 140 2 165 207 201 2 151 16 141 206 161 221 247 132 240 2

JO

GC !l

CI Pit AO DE AJ

liB BI JO AN CL 18

ex Jl

PJ lA Ill'

MC

n KB PO 8M PF LD LD IP

68

1000 data 1010 data 1020 data 1030 data 1040 data 1050 data 1060 data 1070 data 1080 data 1090 data 1100 data 1110 data 1120 data 1130 data 1140 data 1150 data 1160 data 1110 data 1180 data 1190 data 1200 data 1210 data 1220 data 1230 data 1240 data 1250 data 1260 data 1270 data 1280 data 1290 data 1300 data 1310 data 1320 data 1330 data 1340 data 1350 data 1360 data 1370 data 1380 data 1390 data 1400 data 1410 data 1420 data 1430 data 1440 data 14so data 1460 data 1410 data 1480 data 1490 data 1500 data 1510 data 1520 data 1530 data 1540 data 1550 data 1560 data 1570 data 1580 data 1590 data 1600 data 1610 data

76, 27, 203, 77, 141. 160 169 39 216. 221 221, 13, 144, 181, 47, 141, 169, 141, 169 168, 173 2 168 145, 15, 221, 15, 14, 182, 51, 240, 182, 0 12, 169, 15, 96, 104, 145, 140, 208, 112, 26, 113, 141,

a 13, 141, 158, 104, 60, 208, 113, 26, 119, 185, 10, 169, 165, 151, 8, 24,

28, 76, 1, 3, 24, 27, 33, 3, 114, 173, 112, 13, 10, 141, 169, 7, 18, 13, 3, 208, 15, 240, 208, 200, 221, 140, 10, 198, 176, 255, 13, 169, 142, 113, 16, 10, 72, 133, 202, 27, 58, 26, 10, 23, 14, 120, 221 13, 96. 76, 32, 54, 23, 141, 26, 23, 41, 144, 186. 172, 177 164

26, 213, 66, 82, 3, 141. 160. 96 1

13 1, 221, 113, 0, 66, 221, 77 221. 141 60 10 44, 34 238, 169, 13, 141, 180, 2, 172, 177, 9 14, IS 141 208, 165, 158, 200, 10, 133, 10, 173, 10, 221, 160 13 221 32, 121, 18, 133, 10, 114, 185, 26, 18, 76, 76, 25, 200, 151,

76, 27, 4, 13, 140, 30, 27, 12, 221, 221, 221, 45, 0, 221, 141, 169, 15, 169, 7, 160, 141, 152, 172, 24, 18, 221, 13, 48, 169, 26, 202, 133, 221, 10, 13, 237, 154, 132, 204, 173, 181, 111,

22, 141, 169, 121, 15, 40, 59, 239, 242, 153, U, 26, 22, 141, 208, 101, 14, 10, 133, 165,

156, 76, 51, 169, 25, 3, 141, 138, 169, 16, 176, 15, 221, 138, 6, 11, 10, 11 ,

221, 0. 13, 74, 24, 10, 160, 77, 221, 13, 0, 10, 238, 180, 169, U 221 141 201, 151 , 26, 15, 169, 202, 10, 5, 129, 140 10 24, 27, 32, 165, 133, 6, 185, 26, 145, 35, 27, 241, 204 158, 158,

27, 41, 19, 64, 3 140. 38, ,2 127, 77 5, 10, 41, 41, 221, 141, 141, 141, 169, 16 , 221 102, 10. 169, 127, 15, 138, 169, 133, 204, 26, 208, 1, 3, 169, 15, 2, 172, 10, 10, 9, 133, 141, 221, 141, ll, 141, 164, 76, 2, 186, 158, 168, 17, 141, 26, 141, 76, 133, 24, 238, 96

76, 27, 165, 160, 169, 31, 3, 152, 141, 236, 9, 110, 251, 16, 169, 15, 15, 6, 8, 15, 138, 170, 165,

o. 140, 10, 74, 4, 181, 27, 10, 228, 208, 208 2. 10, 208, 27, 240, 41, 133, 182, 4, 169, 13, 221. 15, 151. 45 242. 201, 132, 185, 26, 140, 173, 15 , 130. 158 . 10, 25.

8 234 1 26 140 3 140 12 13 1

2 74 5 240 4 221 10 221 133 250 41 198 170 141 13 141 144 102 76 10 133 162 188 249 45 104 96 10 74 1 180 238 221 11 221 140 10 165 27 208 2 151 16 141 26 15 221 246 132 240 10

February 1989: Volume 9,1ssue 3

I

II

I


Z3PLUS

An extensive and versatile operating system enhancement f or C128 CP/M mode

Review by M . Garamszeghy

Z3PLUS $69.95 from :

copying files from a point-and-!>hOOt type menu. You can stiU run virtually all standard CP/M programs when usmg the Z System, as well as man) Z S}-stcm-spectfic utilities.

Z Systems Associates 1435 Centre Street Ne,, ton Centre, M \ 02159-2469

Z3PLlS comprise~ the mam operating module (Z 3PLUS.C0\1 ) and a number of tran~ient command and utility programs. The commands are brol..en down mto three segments:

(617) 965-355 2 One of the most frequent complaints I hear about CP/M on the Cl28 is its lack ol ·u~er fnendhncss'. especially towards Commodore JUnkte~ \\ ho have never bothered to acquaint them selves \\ith other computer \}-stem-.. Asl.. what \\OUld constitute a user-friendly syMem. and you are hkely to get as many different re!.ponses a' people you ask. Thi~ !>Cern!. to indtcate that the ideal opet ating S) stem 1>hould be cuMomi.table !.O that it can appeal to diver~c ta!.te~. Z3PLUS i)> such a !.yMem. Z3PLUS, or the "Z System" as it is otherwise known, has evolved constderably over the years \ince it made its debut as ZCPR, almo~t at the dawn of CP/M computing. Versions exist for almost every Z80 CP/M -.ystem around. the latest release running under CP/M 3.0 or CP/M Plus. which JUSt happens to be the CP/M U)>ed by the C 128 as well as a few other les!> important (to me, anyway) computers.

the RCP (Re~idenr Command Package). comaming general commands (such as ECHO and Cl S);

the CPR (Command PRocc~sor). \\hich contains s)Mem commands (like GET, GO and JU\1P).

The 'Mock' Z3PLUS ~ystcm include~ a wide variety of options and command!> in each of the three command types outlined above, such as CLS (clear !>Creen); CCIIO (print me!l!.age to screen); POKE (for changing system memory); IF, A."iD. OR and ELSE (for conditional batch ft le execution); GET (load a file); GO. JU\1P (e'<eCute a prevtously loaded file): etc.

Z3PLus ts essennally an enhanced replacement command processor for the standard CP/M CCPC'O\f operating environment. It is a user mterface that provides feature!> such :ll> named directorie!. (\\ hich can be named aerO!>!> dnve!. and user areas). exten~ive command line editing. keyboard macros and enhanced batch file proce!>sing.

Any or all of these commands can be mcluded in your personal command library. Obviousl). the more commanili. you make residenr. the more memor}- wtll be rcqutred by ~y!ltem overheads.

The sy~tem comes complete with a number of operating system shells of varying !>Ophisttcation that allow you to perform routine housekeepmg functions such as runmng programs and

-

the FCP (Ao" Command Pad age), "hich is used to decide branching and condtttonal execution m batch file type processing (such as tr and Ft SF);

The Z System is custominble in a number of ways. The first level of cu~tomitmion involves which commands you decide 10 include with your sy~tem.

What is Z3PLUS?

Transactor

By using GET and GO separately, you can load and run programs m areas other than the default "an ofTP\. pro' tding, of 69

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

February 1989: Volume 9, Issue 3


cour-,e. that the tile'> were a'>sembled with the non-~tandard stan addre~s 10 mind This allow' you to ha'e more than one program 111 memory at once by ha\ ing each located in a different area of RA \1. (In Iact. mo't of the Z Sy~tem shelh and ut1 htie'> \\Ork 10 this fashion. ) An interesting point b that G(;T i'> not rc~tricted to loading program (C0\1) file,. and can even be U\ed to ·toad' te\1 files. Of course. )OU \\ill not be able to C\ecute the te\t file. but you can bring it 1010 memory 11 ) ou .,.. i'>h. The \CCOnd level of CUStOI111/aiiOn im Oh e\ the U\e Of "aJia!>e~. and script tile.,. (an 'aha.,· 1\ defmcd in the manual a., a ··-.mgle \.\Ord or command that Mand' for .1 longer or compound command"). The alia>. allow~ you to -.ct up cu,tom name;. for your fa\ ouritc commund '>cqucncc>.. Script Iiles are more cxlen ... ive and interactive than aliases, and can be combined mto libraries containing ~>Orne very ~>oph isti­ cated custom menu routine~. You write them your~elf and can. therefore. include whatever you wi~>h in them. Of named directories One of the many interesting feature-. of Z3PLus is it~ use of the CP/\1 user areas a' named d1rectorie-.. This can help people to organi7e large di'>k' 1nt0 smaller area'> as\octated w1th easy to remember label....

EASE stands for · Frror And Shell Editor'. A ·shell' can be loosely detined as a u\er mterface that prov1de' \Orne degree of '>lmplitlcation for acce'>'>ing operating ")\~em features. In addnion to prO\Iding a p<l\.\erlul command lme editor (the command code-. arc basicall) comp<ttihlc \\ ith WordS tar). EASE also provtdc~ a 'hi,tory · tile of prc' iou'l) executed command~ in ~equencc that can be e<t:.il) retrieved. edited and rcexecuted. ZFILER is the second operating '>hell prm ided ""ith /.3PLt s. It i' bthicall) a pomt-and ·\hOOt menu-dm en lile management program that doe' thing-. like batch cop) mg. runmng other program\, etc. Like the other ZJPLl s utilities. it i~ clean and ver) ea ... y to usc. (One interesting feature uhout the l. S)\lem I\ that it allows you to usc multiple lcveb of \hell\. If you first activated the EASE shell, then went into zru FR. you would go back to EASE when you exited zrtt.FR. You then exit EASE to get back to the Z3PLLS syMem.) ZPATCii is a hcxadecunal file cd1tor. It i!> e~icr to U!>C than t11e patching mode~ of a debugger such as SID because it provides a full-screen editor that work-. in both HEX and ASCII mode~. SALlAS is a mim tc\1 eduor used for edumg and creatmg alias -;cnpt files that u\es WordStar-t)pc control code commands for editing and cur,or mm ement.

For e\ample. .,.. ith the EDIT, DR )OU c.an define u...er area I 5 on dme M ~the ·s,STE.\1' directory. O\.\ ''hen )OU log onto u!>l!r IS of dri-.e M:. the prompt w11l dbpla) the name of the directory 'SYSTI '1' in addition to the usual CP/M ·r-.115' prompt.

In addition. S -\LIAS can be w,ed for other general editing of short text nOh!\ a\ \\ell. ARt: :z io; an alia<; librar) manager of sort' It allows you to combine man) \ingle aha\ \Cnpt file'> into one large one. thus saving on di-;k overhead '>pace (one large f1le can take up significantly less dis!.. <,pace than many \mall one\ due to the CP/M dis!.. allocation unit \i7e ol I or 2 l..ilobyte\ on the Cl 28). When you u!>e ARL 'IZ. you \pecify the name of the alia!> 'module· you wish to run, and ARL 'JZ will extract it from the ali~ library tile (ALIAS.CMD), then execute it.

When 1n the Z S) qem. and from w1th10 mo'>t of its utilities, )OU can change to the named directory area by s1mply specifying the directory label without having to remember the exact drive code and user area. 1l1e named d1rectory list can also be ~aved (using SAVI:.t-.DR} for future use. Z3PLUS also provides for password protection of files and directories.

The documentation

The tools and utilities

I

If I could say but one thmg to the first time Z3Pu;s user. it would be: read the manual. front to back. in that order. and do \llo\1 of the utili tie-. pro\ ided on the di~tribuuon 'er~ion of not ~lip anything. The manual. hke the Z3PLLS ~y:.tem. was Z3PLIJS arc public. domain. (Thi' doc' not mean. however. that writlen primarily b) ,1 phy~ici\t at \11 r. (This person i~ ~o logiyou get the ~arne old tired progmms that you probabl} alread) cal he \\Ould make Mr. Spocl.. grcen{er) w1th em}. if he were ha\e SC\ eraI copie~ of in your library. The) have been put into capable of such emotion.} The manual \\US ' ' ritten to be read the public domam b) their vanou\ authors to the benefit of all 10 consecun-.e order. Z Sy-.tem u-.crs.) (As a phy,icist. he \hould be familiar \\ uh the concept of The major one\, \Uch a... the operating \)'\tern ~hell I:.ASE and Bro.,.. man motion • .,.. htch 1\ how I thml.. mo't people. m) self ZFILFR. have been spec1f1call) wntten to run m the ZJPLus mcluded, tend to read \Oh\\are manuab- random!) talong bi~ emironment. \O would not do too well without iL (They are here and there. I made the m1~take of ~lipping a chapter in the public domain in the \Cn\e that )OU are free to copy and use middle and was confu!.ed for quite !lOme time until l realiLed them as you see lit. The /WLUS.CO'A main system modules are that the chapter I had missed contamed !>Orne vital information that I needed.) nor public domain, however.) Transactor

70

February 1989: Volume 9, Issue 3


Once you convmt·e ) ouN:ll that readmg the manual i~ requ1red. initial ~ct-up of the Z3PLlls operat1ng ~)~tem i' quite ~imple and ~tr.ught fon' ard. You define your terminal capabilitic~ (Saint~ be pmi.,cd. the tem1inal t) pc ~election menu even includes an entr) for the C 128!) and rename a couple of file~ (this 1~ the le~s ob' iou\ pan that l..illcd me before 1 read the manual in detail). Type in the magic "ord DPu s and a'' ay you go. The documcntauon lhelt I\ clear enough. although ~omev. hat laclmg '~hen it come., to detail\. f-or example. in the section dealing '~ith J)\!rhap., the mo.,t important utilit). ZftLER (the general tile handling. copying etc. ulllit) ). the pan de~cribing the command option'> merely tells you to lool.. at the menu ti~t­ tng on the screen. I thtnl.. that at lea\t a command summary could have been expected. (To their credit, however. a more deuuled technical reference manual can be h<ld, ut extra cost. A bibliogmphy or :.ugge~ted further reading is also .,upplied for those who ma) be intere~ted.)

C For CP/M The BDS C Compiler v1.6 The original, fast CP/ M-80 C language development system is now available once again directly from 80 Software! • Over 700K of materials, including full sources for: all libraries, runtime pkg, RED integrated editor, COB source-level debugger, CMODEM program, utilities • Ideal for most ROM-based applications • Made to run fast on floppy-only systems • Many P.O. applications available (CUG) • Fully supported by author Leer Zolman

Now only $90 per copy!

To get around the problem of having to read the manual front to back. I v. ould <,ugge~t be11er cross-referencing among the section~. espcc1ally betv.een '>ections that contam vital mformation requ1red to get a given utilit> to v.orl...

80 Software P.O. Box 2368 Cambridge, Ma. 02138 (617) 576-3828 Free UPS 2nd-day·a•rdchvery for pre-paid orders C.O.D., MC. VISA orders accepted PtC<oSe 1pectry a .on ·sectored disk format!

The Z Sy~tem i'> Jl-.o supported b> a networl.. of BBSs (referred to as ·z-Node' '). which ~uppl) up to date techincal info and help a\ well a'> pro' iding a con.. enient method to distribute ne,.. program<, wri11en for the Z Sy!>tem. A list of Z"'odes i<> included on the zwu·s dl!>l...

CHIP CHECKER

Final impressions CP/\1 i!. a dbl..-tnten'>lve operating 'Y tern. Z3Pu;s i~ perhaps even more l>O because of it\ reliance on tr.m!lient commands and script batch file\. Because of thi~. a fa!l t drive i!. imperative (don't try it with a 1541. you will probably die of old age) and a RAM disk is even be11er. (An interesting combination i~ a 64k Quicl.. Brown Box battery-backed RA \11 c:~rtridge with the QDisk CP/t-1 driver soft ware (reviewed in a recent b~ue of Twin Cities-128). With this you can load mo~t of the Z3PLuS main tiles and uulities into a non-volatile R--\M disl.. and ha' e them available as ~oon as you start up CP/M each time without ha' ing to copy them into the 1750 RAI\1 disk.)

• Over 650 Digital ICs

• 75/54 TIL (Ais.as.f,h,tls.s)

• 9000 TTL • 74/54 CMOS (C.hc hct SCI • 14-24 Pin Chips • 14/4 CMOS • .3" + .6" IC Widths Pressing a single key 1dent1f1es/tests ch1ps with ANY type of output 1n seconds. The CHIP CHECKER now also tests popular RAM ch1ps. The CHIP CHECKER is available for the C64 or C128 for S159. The PC compatible vers1on IS $259.

When I fiN '>taned up my cop) of Z3Pu.;s. I thought. "another .,emi-u.,eful product". Hov.ever. as I u~ed it more. and dlsCO\ered more of 11\ feature\. I found m)~lf liking it more and more and con.,equently U'>ing 11 more and more.

DUNE SYSTEMS W1lla Onve St Joseph. Ml 49085 (616) 983-2352 2603

Although $69.95 rna) ~eem like a fair bit to spend on an opcrJttng ~Y'>tem enhancement. it is well wonh it 1f you arc !>eriousl} mto C 128 CP!\1. What you get is an eastly expandable and cu~tOtnl7able opemting environment ~at can be a-. powerful a\ you v.ant to make it. ~ It son of grov.s on

• 8000 National + S1g

)OU.

!

Transactor

71

February 1989: Volume 9,

Issue 3


JiffyDOS for the C64/C128 "Look, Ma - no cables!''

JiffyDOS is m·ailable for C64. Cf>.J-C, SX64. C 128. C 128-D and 1541115.JI-CII'i.JI-11,1571.1'i81. fSD. WSD. E:rcelerator +, F 1cel 200 I. f nlumcu 2000

sary. The system will worlo.. at nonnal '>peed with any additional drives that are not upgraded. Unlike some cartridge-based products. R0\4 replacements speed up SA\1:. and "bloc)... acce~~". a~ well as LOAD. JiffyDOS LOADs file~ about nine times faster thtUl a Mandard system. SAVES are about three time ... fa ... tcr.

C6.J series and one dril'e - $¥9.95 C128 urie~ and onr dril•t• $59.95 additional dril't! R0\11 $2.J.95 all prices plus shipping, L S dollars

Jiffyoos worlo..s at this fa.,ter ~peed with all types of files, and with "block acceS\es" as "ell. Program~ \uch as SuperBase may LOAD rapid!) with many other product<o. But. they operate at nonnal '<,low· '>peed becaw.e they rely heavtly on ...equenual or relative lile'>. Jiffy oos improve' the drive perfonnance on any sEQ. REL, or LSR file. D1rect blocil. access "~abo about three times fa~tcr in my tC'>t'>.

Creatil·e Mtcm DestRm. PO 80\ 789, Wilbraham. M-\ 01095. (413) 'i25-0023 Specifi. compwer and dil~ dme models 11 hen ordering M) lin.t encounter ~ith hardware to speed up m) C64/l541 combination ~a~ 1541 n ... \Sll. It ~as incredibly fast compared to stock machme~. Block read~ with "D1sk Doctor" were on the <;creen almo't ~fore you could relea"e the RFTL'R" key. It also sponed an extra cable between the dnve and the Datassette pon. You could put that plug in upside down. I found that out the hard wa). 'tou could brealo.. the w1res off the plug (found that out the hard wa), too).

Jiffyoos u<,es the standard Commodore DOS fonnat to save files. It changes the 'interleave· (the number of disk sectors slo..ipped between con-,ecuuve \ector'> of a file) to s1x. Commodore use\ an interleave ot ten. Tim malo..e'> for faster loads of files SA\1-d with Jiff) oos. when Jiflyoos i.., used. Standard DOS can '>ti II read these file~o too. but a bit more iolowly then nonnal.

FLASU pennancntly replaced the computer and disk drive ROMs (Read Only Memories), and worked only with the 1541. It was supposed to he compatible with everything. But the ·newest' copy protection sy\tCilh u~ed 1541 R0\4 codes, and wouldn't worlo. with H ASit.

One disadvantage of ROM replacement is that you must disassemble your computer and di~lo.. drive to make the installation. Creative Micro tries lo make this as painles~ as possible. They prov1de s1x page~ of step-by-,tep instruction:-. for the computer, and seven pages for the d1sl.. drive. There are dear drawings of the variow. circuit board vcr... ion'>, with the location of the ROM to ~ removed. and similar drav.. ingl> showing the Jiffyoos R0\1 orientation. The inwuction'> arc easy to foUov.., and have enough cautions and comment'> to keep even a no,'ice from runnmg into dlfllcultle'>

That was se,eral year~ ago. and I'm sure FLASH has improved. Tt, and many similar product~. -.till require an extr..t cable between the computer and disk drives. A corollary of Murph) 's Law says that the cable '>Upphed v. ill always be just inches shon of what's needed to locate your equipment where you want it.

I had a minor ·problem' readmg a '>pecial note for 64C owners. It refers to the RO\t for the "older C64 board'> .. a'> ha\ ing 24 pin~. '"hile the correct R0\1 fur ne\\cr 64C'> ha-. 28 pins.

A product that doe~ not require extra "1nng ~~ Jtff) DOS from Creative Micro De"gn'>. The 'Y'tem u~es the ~tandard serial bu~ cable for all data tran,fef'>.

I have a C64. one of the older boards. But. the R0\1 I received has 28 pin~. The R0\1 i'> mounted on a '>mall circuit board. The board ha~ 24 pm~ on it. wh1ch fll mto the Kemal R0\1 socket on the C64 board. The note apparently refer-. to the number of

Jiffyoos replace-. R0\1', in the computer and disk drives. I tested it on a C64 (R0\1 J) \\ llh two I'i41 di~lo.. dnve~. Both dnves were equipped v..ith J1flyoos RO\h, although that's not necesTransactor

72

February 1989: Volume 9, Issue 3


another di~k drive, although "READY. ·• will be end of the copy.

JiffyDOS improves the drive pnformance on any SEQ , REL , or USR file. Direct bloc!.. access was also about three times faster in rny tests ...

----- ----------pins on the circuit board. not on the R0\1 chtp it,elf. (Creative \1icro '>ay s that a ne\v ver1>10n of the IO'>truction-. make~ tim clear.) \\ hich brings up the other d1s.1dvantage of R0\1 replacement!>. If you hav~ an older C64, your Kemal ROM may not be in a ..ocket. To install JiflyDOS. you 'II have to unsolder the R0\1 from the circuit boarll. This I'> not a job to be taken on lightly. If you don't have e\pcrience "'ith un~olllering integrated Circuits. you should enlist the aid of a profes.,ional. Any competent computer tech ~hould be able to remove your Kernal ROM and in-.tall a low profile socket in its place for a fe,v dollar:.. 'Aanv• CO.h, and all 64Cs and C 128s have the Kcmal ROM '>OCketed mther than soldered in place. Mo~t

154 I ROI\l'> are socketed. A few rare excepttons have

ROM'> mounted on 'piggyback· board\. Although the ...e can be unsoldered, the J iffyoos ROM and ~ocJ..et mounted on the piggyback board will1.it too high to clear the top cover. If you encounter th1s problem. Crcattve Micro give ... you the option of a free spec1al replacement board

append~d

to the

CON 1ROI P will print the currenl low resolution te~t ~creen on \ your printer... sometimes. The printer mu'>l be device #4, and either a Commodore printer or a good emulation. The com· mand "orked fine m d1rect mode. I hoped to get hard copy of screen~ from databa~es and 'preadsheets. But, COI\TROL·P didn't \\<ork from in!>ide most programs. Occasionally one of the public domain ''Disk Doctor.·· printed, bul only in upper case/graphics mode, al1hough the screen wa-. upper/lower case. @NO:disk,id fonnats a disk in about 20 seconds - no1 as faM as some :-.ysteml>. But the documentation daum that all nonnal error checking is maintained. @Nl :disk,id fonnah both '>ides of a dbk for 1571 drives in 1541 mode. Th1s facilitate-. using both heads when working with a C64/ 157 1. @IB toggle>. 'head bumping' on the 15·H. Wi1h bumping off.

dl'>k read errors will not cau~e the obno>.ious m1sahgmng rattle. Some softw<trc may send it~ own code to the drive which turru. th~ bump back on. In that ca-,e. t" o @)B commands are needed to tum bump10g off aga10. More on th1s 10 a moment. @Q di~ables the wedge and function key comm<t11ds. Fast disk access routines are still in place. A S\ s to an address in R0\1 will re-enable the functions that @Q kill<;.

Wedge command~ can be used in BASIC program' They can be chain~d. several commands on one hne. @''* 9'': @"SO: t eat* ": @'' *8''

A " edge, and mol'e

This can be done 10 program or djrect mode. Note that the quotes arc required. and an @;$ in the cham will cause the rcmainmg commands to be skipped.

JiffyDOS adds several features besides f.1ster dbk access. The usual 'wedge• commands arc available. with the usual '>yntax.

The "'edge commands will accept string vanables, hut only in program mode. Numeric variab le~ can be u~ed for some parameter:., such Ul> disk drive number~. in c1ther mode.

filename loads a BASIC program. 'k filename \VIII do the ...amc tor a machine language file. @$displays a d1sk directory. @SO:Iilename will scratch a file, etc. The> symbol can be used 10 place of the (iv.

Compatibility and copyrights Jiffyooc; abo defines the cigh1 function keys with commonly used wedge commands, and RU'i and us r. @ F toggles these definit1onr, on and off.

Creative Micro claims that J1ffyDOS is completely compatible with all commerc1al hardware and software. They guarantee it for 30 day~ from purchase. If you lind something 1hat won '1 work, you can retum Jiffyoos for a full refund.

'filename verifies a fi le against memory. @U will 'un-ncw' a BASIC program. ({L O:Iilename lists a RASIC program to the 'creen "ithout disturbing memof). The lt-.ung can be paur,ed b> press10g <li1Y key. The hsung can be redirected to a pnnter with OI'I.:.N-1.4: C\11.).1.

Ob' iously. a replacement with all the:.c feature~ change!> the Kemal ROM code substantially. As us ual. the extensive Daw:.sette routines are replaced "'ith rhe ne"' code. That alone would make the ROM 10compatible "'ith one piece of "com mercia I hardware .. - the Data"clle.

@T :filename \\<Ill ui~play or 'tjpe' ~equential files on the screen, agam without disturbing mcmor). Pressing any key will pause the displa}. C~D "'ill redirect the output 10 a printer or di'k drive. You can u-.e @ T to copy a sequenual file to Tronsoc lor

Some products avoid this problem by prov 1ding a hll;trd "tth t"o socket'>- one for the new R0\1 and one for your old Kemal 73

February 1989: Volume 9, Issue 3


tempt!> when a disl.. error ., encountered. A 5 causes the normal activity. complete with head hump. A I 'B bypasses the bumping pan (the high btl is -.cr ... l33 I :!X + 5). This i'> a •traditional' method ol eliminating head hump But. a dri\e re\et defeat-. 11 So....omc 'olt\\ are may sttll cau-.e head bump'>.

R0\1. A ~~itch '>elc.:ct\ one or the other: hence, full compatibility. If '>Omething \\On't work, just throw the s\\ itch.

=

Jiffy DOS doc\ thi' one hcllcr. I he small circuit board wnh il'> 2-t pm-. holds only one R0\1. It docs have a toggle -.~itch -.oldered to 11. on about <1 foot of\\ ire. You mount tht\ ,.,.. nch in a hok you drill in the pla-.uc ca-.e. The in,tallation in-.truction'> '>uggc't place' \\here the '" ttch \\On 't be in the .,.. a~ of internal .,.. orl..in,g.... s . . itches arc connected to the RO\h for dbk drive'> a.. \\ell.

Jiffy DOS chan)!e' 'eH:ral of the 'ecwr" m the 768-779 (~BOO0308) r.mgc. (a Q re-.er.. them to '>lOCk values. 8.\SIC add-on utilitie\ and other pmgmnh ai'>O change these vectors. to point at thenhehe'>. A \\eii-\Hitten pmgram \\ill \U\e the vector it replace .... and jump to it \\hen done. But, not all program, are \veil \Hinen. Many programmer' wtll <l"ume the '>lOCk values and jump directly to them. Thi' \\ill hyptl'>'> the JiffyD<)S command'>.

The s~itch select-. one of t\\0 HK banks of memory in the R0\1. One" ltii)DOS. The other., -.uppo,ed to be fully compatible \\ ith your old computer R0\1 When I thre~ the ~~itch and reset the computer, I \\a-. greeted \\tlh the lan11har sign-on mes,agc - the c\act same me\\age.

I .,.. a' plea\antly \Urpri,ed to find that Jillyt.>OS doe ... not use location 186 (~llA) to determine whidl dnve to acce~~ for wedge command>.. Location 186 holds the current device number. actually the la~t device acces,ed. If you just printed something on the printer. location I X6 wtll have a value of 4.

Curious, T checked the 'stock· R0\1 code again~t the original Kcrnal ROM. Not only arc they "comp<~tible'', they're byte-for· byte iden!lcttl! Tlw, makes for a curious situation regarding Commodore\ copyright on the ROM code. It does ensure that the u~er ha'> full compatihilit). It al~o The "compatibilit_v" ROM is gtve<. you <t R0\1 upgrade in case you identical to the Kernal ROM -3. have an older (R0\1-1 or R0\1-2) C64.

This insures full compatibility

Many add-on,, 'uch a\ fast Load. and the Date! \1arl..-tv cartridge, U'>C location 186 to delide which dbk drive to acce~.,. If you tell the ~lark-tv to display a tli'>k direc:.tory after printing on the printer. 11 \ami) tnes to show you a dtrcctory I rom devtcc #4.

If )OU need to disable JilT) DOS on the and upgrades a ROM -I or computer and ...cveml disk dnves. you'll have to thro\\ a \\\itch on each. ROM -2 C64 ... Thts COUld be a oother il you ha\C 'IC\J111} t)( >s i' snl<tner. It keep-. ih O\\ n eraJ program-. reqUiring the change. acti\ e dm e number. the one you set You can make it ca-.ier h) mounting wllh (it# . It -.rores it at location 787 the dri\ e "' nche-. on the lront panels. or under the front beLel (S0313). This location. marked "unu...ed" on memor} mapl>, ~its betY.een the LSR (U\er routine) and the IRQ (hard.,..are interon 1571\. rupt) vector-.. It·, only one b) te. <md not in tero page. So. most programmers don't u-.e it Rut J tftyDOS does, and I do. Compatibilit) and R \M

The manual ~ay~-o that JilT) oos "doe' not U'>e an) extra RA~t (Random Acce'' Memory) 111 }OUr computer". Well... almost. It\ hard to toggle fcatureo., Without u"ng o.,ome memory to remember whtch Mate the lllggle I\ in. If the .tdd-on hardware has no RAI\t. it muM burrow some from the computer.

Jtff)DOS abo know' the legal dl'>k de,ice number,. I could change betY.cen di~k drives hy POll.! ing an H or 9 to addre'>ll 787. But <Ill} other value wa~ changed to 8 by the next disl.. access. Since the :o.y-.tem works with more than two drives. I lll>sume that values of I 0 and up would be accepted if those device~ were in, t.tlled in the sy'>tem.

Jiffyoos ha., only R0\1. So. Mlme mcmor} loc"tions arc u~cd. The designers mlllimtted this tmpact by uo.,ing location~ that are uncommon to mo-.t ,oft ware routines.

If you li'>C

addrc~'

progr<~ms,

be aware that Jiff) DOS may ch;tngc the value lor you. I hat can bc a feature. To tell from pro~ram mode tf Jtii}DOS is active. '>tore 255 at location 7H7. i...... ue a di'k command. <md ...ee if location 787 contaml> an X.

l.ocaliOn\ 67-l (\H~A ') ,tnd 67'\ ('\112,\ I) are Uo.,ed b) the stOCI.. Kemal to save c lA tComple'\ Interface Adapter) control regi.!>ter-. during Data\\ette 1 <>. Smce Jilf} DOS doe~n·r U!>e the Datas\Ctte. it usc' the'>e uddrc"c' a' toggle'>.

7X7 in ) our mv n

Sum man•

Addres' 674 hold'> the function ke) toggle. A non-tero value tum-. ofl the pre·dehncd Junction key'

Jift) DOS 1-. a good compromtsc het\\een ma'l:imum fast load-

Jill)DOS toggle-. the \alue at addrc" 675 bct\\ecn 5 and 133 whene\er @JB ., prc"ed. n le v.llue IS then -.em to di'>k drhe addre~!> I06 (:)M). Thi~ audn.: ... ~ controb the number of read at-

You can use an) '><>ltY..trC or hardware. Your canridge. Datas~euc. and usa porh arc free. You can add a dt'>k drive or use part of )OUr -.ystem wnh other non Jiff)DOS equipment with-

Transactor

ing and compatihility.

74

February 1989: Volume 9, Issue 3


out difficulry. There t~re no extra wire~ to bother with, and nothing to forget to plug in. Jiff) DOS suppom mt~n) non-Commodore drive<,. It ma) be )Our only chOice for a 'peed up '>'tem 1f you u~e another manufacturer\ drive, or m1x 154h and 157h With the l-ame computer. J1ff)DOS "-Orkcd "-ith all the ,Oft\\ are and add on\ ltc\ted. including ~ome •;urpn<;e<;. The Datel Mark-1\ cartndge worked normally \\llh Jiffyoos active. I loaded •• "Warp 2'i .. version of Di\k Maintenance 111 ).C\t!n ~cond' ,.,.llh the Mark-1\. Loading the Mandard•program wuh Jilly!X>s took 45 \econd<;. Dil.k Maintenance ha' ih 0\\11 ~ooft"'are fa~ot loader. "'hich probably deactivated the Ji ffyDO'i rout me~. Once runmng Dbk Maintenance. however, Jiffyoos read the block~ from the dil.J... three limes faster rhan "-ilh lhe Murk. w alone. For ease of u:.e, with some helpful features nddcd, Jifl'yDOS is a good value.

Ulh-FIIt DIJk Oplntlng Sytttm for the C-64, SX.f.f & C-128 • Spuds up Ill chk openilora. l.old, Save, Fann~~, SctalCh, Valdlle, ICCIII PRG. SEQ, REL & USR tJee 14' 10 15 t l - futtl1 • U... no ports, m-ry, or tllrl cabling. Tt. JllyOOS AOiolt ~Wade yw COI11lUitt and drM(a) irii~TW~y fol muii!UII IP"d and~ • Guarantttd 100%complllbMwllhahoflwarunll hltdwlre. JJlyOOSapnlls 141 the biding and inl11111llt ICCftloptrlltOnohlltlllyllc:ommerdlll~. • Bull·ln DOS Wtdgt plJI 14 ~tlonal convnancll 11\d convtnlenct Ill'"" fnl;lujj~ onKey loe&"Mvtllclllcl\ dlr~C~ory mt~ and- ~. • Eay do-11-yoUIMII IM~allllon. No tlaet10nlcl ·~ or aptcialllloll ,. quinld. IIUIIIlled 1181H1Y-slap lnS1111C1io,. lneiJdld. Avai~Mllt lor C-f4, S4C, SX-t4,

Here ur rile Transacwr ojj/t·es we hare receilwl Jijfyoos for !he C 128 alit/ 1571. 'llli.1 product u·ork1 in 6-1 mode as well as 128 mode. Tlw in\l/'1/clions u•t•re l'en• dear and we/1il/u~rrared. 1mrullurion ll'a~ wnple wulrlle ~ysrem 1\'0rb ll'l'/1. In our case. rhe drhe itwrucriom umowllt•cl w si.\ pages (the 1541 has been rhmugh .\l'\'l'ral reri:.ions and therefore requires set·en pac:es).

C.128 l C.1:L80 (JWiyi)OS'128epaaciJ 141 boll164 111d 128 modes) and 1541, 1541C, 1541-1, 1571, 1581, FS0.1l2, MSD S0.1U, Elcel2001, Enhanctr2000, Amt.cft, Swl\ lndual 81-hlpdllll ctlvw. Sys~~m inl:b:IH ROMs fol ~., and 1 cisk drM, I1DCIIIJ~ twldq ~ys~~m, iiiUIIrattd inslalltion ntructlonl, Uttr'a Mlnull and Money..a.ck Gllarantn

Jtf]\oos al!m1 r 'poll'er on' ROlf muclung (Craslum: or hangin~

up i~ pouthle. respon.1e rune.\ 11'/lh the pmgram.} Do nnr Sll'itch durin!( a eli.\~ un <'H 1 Speed Compari<,on: The chart helo"' i' !rom the Jiff) DOS manual and i' ba\ed on re\ulh obtained u.. mg \11. muune~. The) do not take into t~ccount ~pin-up dela) (.5 ~ec.) or direcrory searching time. Other foetor:. may ai\O influence the results that you obt.lin on your '>)1\lem. ~

On 1571 unci 1581 clrile1. the drircs lt>ll:.e 11/terlter tlte compmer is 111 stock or J ijfyoos moclt a/1{1 lt'lecr rite correct remtines awnmarical!y. Jtjjyoos speeds up 1571 a/1{1 1581 dril·es ( rhough nor as dramatically ar tt dorsrhr 15./ II

Speed Comparison Chart C'64, SX-64, 64 mode Load 202 hlod, PRG fi le Save I00 hlod. PRO file Read 125-hlock SEQ or USR file Wnte 100-hlo<:k SFQ or l SR file Read M 154-h}lte R1·1. record" Write one 154-h)le Rf L record Read/~ rite 16K on command channel

1541 124 75 84 81 40

12 24 15 27 14 .350 .125 47 9

157 1 124

9

75 20 84 81 40

u

24 14 .lSO .1.20 47 9

1581 102 40

63 44 ~7

.U5 47

R 15 9 17 10 110 9

C128 in 128 mode Load 20.2-hlt'x:k PRG file SaH~ I<Xl-blt><:k PRG hie Read 125-block 'iEQ or l SR hie Write 100-blod, SEQ nr t..SR file Read 64 154-b\lc RLL record~ • Autoboot .:!02 block. p1ogram Read/\\rHC 16K on command channel Transactor

124 12 75 24 84 15 81 27 40 14 125 13 47 10 75

14 41< 31 41< 21 54 10

9 .25 12 33 14 10 6

12 8 .:!6 14 .:!0 10 1() II

17 10 u 9 10 6 February 1989: Volume 9, ISllue 3


--

--

--

-

SWL Short-wave decoding f or the C64 (and V/C-20 )

SWL cartrit~~e. "''ailahle j(>r ~ IC 20. C6-l,aml C/28 $64

us

If your receiver uses a full si7e phone jack, you 'II need an 41dapter. A second mmiature jack on the canridge can be used for headphones or a ~pcaker to moni10r the signal.

G&G £/ecrrnnirs A third jacl. is provided for connecting a key (the telegraph type), so you cun pwcti~c your code ~ending s~ills \\ith the canridgc. A slide switch i1> abo used to select wide or narrow bandwidth for certain types of c,ign:tls.

8524 Dakma Ot. Gmtllersburg MD 20R77 USA (301) 258-7373

The S\\1. cartridge. from G&G Electronics. has been adverti'>ed m Commodorc-onented maganne'> for sever.ll year'>. prom bing "Worldwide Shon-wa' e Radio S1gnab on Your Computer."

The demo tape contains a long mes..,ag~ in Mof'oe code. You play the tape on any ca~sette player. 'I he headphone output from the pla)er '' fed into the canndgc. B> momtonng the sound. you can get a feel for the \Oiume and pitch that worl besl.

"Remember the fun of tuning in all tho~c foreign broadcast stations'?" You bet I do! I once had a W\\ 11 llallicrafters aircraft rece1,er. modified for '>hon .... ave u\e. The ad explains that all tho'>e .. beep' and '>queall. .. you hear in the shon-wave bands are digital data. 'llle S\\ t canridge \\ill decode them for you. "You'll see the actual text (on your! video screen ...

The Cartridge performed fli.l\\ JesS() With the demo tape.

The cartridge plugs 1nto the computer expan~ion pon. It come~ with a hooJ..-up cable. a demo cas~cttc, and a manual that explains "how to get the most out of :,hort-wave digital DXing, even if you're brand new at it." DXing ic; short for Distance Receiving. Swt is an acronym for Short-Wave Listening.

l decided that my recctver c,imply wasn't up to the tas~. So l contacted my friend John, who is 1ntercMcd in DXing. He loaned me a Kenwood receiver with digital tuning, sideband switches, adjustable tillers, and many other bells and whistles. This was a for cry from that ancient llallicrafters!

There are several microprocessor ba~ed product\ that decode variou~ l>Ons of .,bon-wave wde. The SWL cartridge, at $64 us, is by far the lea~t expcnM\oe. 'lllat ·s because you supply the microprocel>sor, a C64 (or a C 128 111 C64 mode). A different model of the S\\L i., a\ a liable forthe VIC 20.

I easily heard hundred~ of signab. I also heard incredible amounts of QR\1 (rad1o interference). I patient!) adjul>ted. filtered, and t\~<eaJ..ed on signab. tr) ing to get the cartridge to respond to them.

~

~

I connected 11 10 m) mexpcn'>lve mult1-band rad1o. ran a long piece of wire around the room. and proceeded to look for Signals to decode. \lone that I found wa-, loud enough to get e'en a glimmer of recognition from the cartridge.

Swt. provtdes an on \creen tuning indicator which flashes when the ~ignal fed to the canridge " rccogni7ed b) the PLL. An audto tone " aho produced tn the momtor -,pcaker. Without these tuning aide,, getting the audio JU'>t nght would be Impossible. E'en with them. tt \ qutte a challenge.

All the decoders operate on the audio output of a shon-wave receiver. The) u\e a circuit called a PI 1 (Phase Locked Loop) to ·Joe(.. m· on a narroY. band of audio frequenciel>. The audio signal b then con\'ened 11110 d1g11al output A R0~1 (Read On!) Memof)) in the canndge supplie~ the progr.un that telh the computer hoY. 10 usc the d1g1tal output from the PLL.

Mor~e

code b ...cnt as C\\ (Continuou., Wave). A circuit called a sro (Beat Frequency Osctllator) in )OUr rccei,cr creates the audio 'dots· and 'dac;hcc;' from a C'\\ 'ignal. The BFO allows )OU to vary the pitch of the aud1o. The pitch also varies if the

The cable supphcd "ith the cartridge connects a miniature phone Jack on the canndge to )Our receiver'!> headphone jack. Transact or

76

February 1989: Volume 9, Issue 3


signal's radio frequency drifts. The drift can occur in either the tran,mmer.) our recei' er. or both. The 1'1 L. circuit in the cartridge requires the audio input to be vef) near a 'pecific frequenc). You mu ~t adJU'>t your receiver to produce audio at that frequency. On the Kenwood. several knobs affected the audio pitch. I found the volume was ai\O tmportant. Mor\e code can be sent at a variety of speeds. measured in WPM (Word' Per Minute). The cartndge can adju<;t automau cally to ch<mging speed. hut only o-.er a hmited range. You set the initial speed, and all other car1ridge functions. using CfRt l..ey combinations on the l..eyboard. So you must guess at the speed of a r.ignal and set the cartridge. then adjust for the right pitch and volume. Variattons in the signal Mrength and any frequency drift '''II cause pitch and \Oiume changes. The control\ on your receiver require frequent adJuMing to compen· sate. Too much interference will 1.wamp the cartridge. It won't be able to find the recetved 'ignal amongst the garbage. I worked with the swt and the Kenwood for three c,·enings. My net result was a partial message which read "1 am a retired airline pilot... I detennmed that most of the QRM \\a' comtng from the C64 itself. Some shieldmg was in order. A better an· tenna syMem was needed too. I explained the problems to John, who put me in touch with Bill. Bill's hobby is DXmg. He ha!. three Commodore comput· ers. But he\ not really a ·computer per..on.' Instead, they only serve a.s aids to his many recervers. scanners, and other spc· cialiled listening gear.

tions in RTI Y than Mor'e tran'm'''iom, h wa~ dtllt~u\t to gauge the SWL.\ perfonnance agam't the Info-Tech on RTII becau!.e they require audio at diff'erclll frequenctes in th" mode. So. the two devices could not decode the signal-. '>imul taneou\ly. Bill wa., quite surprised at the perfom1ance of the G&G ElectoniC\ cartridge. It did a' well a~ the much higher priced Info· Tech, for the stgnals it wa-. designed to decode. But tht-. de' icc is not for the c;c,ual U\er. The canridge wtil not worl.. at all with an inexpensive short-wave receiver. You mu-.1 have a good radio that will let you adjust the audio to the range that the SWL can handle. You must abo have a good !.now ledge of what the s tgnal<~ ~>Ound lil..e, and what adjuM menh to make from the keyboard to decode them Without Bill's expenise. I would have "a"ed mo\t of the e\ening on inappropriate "beeps and \queal' ... You'll need good shielding on the computer alw. The comput· er mu\t be within reach of the mdto for proper operauon. sim:e you'll need to make adjustments on both often. The computer and monitor must not create any radio interference. You'll need clean signals to get proper canndge operation. The cartridge i\ an inexpensive way for the dedicated ox'er with a CM to add on-hne autom<lltc decodmg. It '' nm appro priate for a computer owner who\ just gellmg started 1n the exciting hobby of short-wave listening. l:f ART l A coapt ete lntertact •rat•• for

•••d

and recelwe oa CW, RTTY

w lt~

the Co-.o4or• iCflZI

(a&IMiot 4 ASCll) aad AXTOI, fer

u••

coort•r. Operatlaa proar••

Btll was mterested in the SWI.. canndge, and offered to help me teM 11. But he didn't expect much from 1.uch an inexpensive product. He uses a decoder made by lnfo·Tech. It\ a large blacl.. box bristling with ... witche-.. and co-.t him \everal hundred dollars.

I

dh

~n

J Ut 1\0

411·1 A coaplete interrace aystoa fo~ sen• ••• r~cciYe •• r-, RTTY (latadot & ASCII) ud AM'T'Ol, for

use v ith Cem.odore VIC 20. Opentlna pTOaraa tn ROH

So. I 'bited Btl! in hb h... tening po~t. He\ \01\ ed the computer generated QR \1 problem by using large ferrite traps threaded around the equipment power cord.... He abo use~ shielded cable to feed ~•gnal\ from hi'> sophl\llCated antenna:..

Ut.ts

SWL: A

cw.

recei~• o~ly

cartrldtt for

lTTY (lau-dot • ~SCU) ror u .. llfitt. CoM!Niort •4/IU. Opnatii'J , , . , ,• • lft ltlt.

su ••

AIRDT SK: An All·J typt operatlna pro1n.m for u~e with your interface hardware. lotb VtC·lO

We te. . ted the SWL. cartridge by connecting it and Brll'<; InfoTech to the audio output of hi' receiver Both uml\ got the same audio :.ignal. The Info-Tech ha!> it'> own mtcroproces~or and connects to a video screen directly. Both devices can decode Mor<;e and RTIY (Radio Teletype) signab. The Info-Tech can de;1l with several additional t} pes, including packet radio (computer data sent by radio instead of phone lines).

aad C64/lll pro&r••' oft one dill . S Jt .ts

- -

I

.

- _....

.t... _

AIR-ROM Cartrid&t •ersion of AlRDIS~ for C64/121 only.

SS9.9S

MORSE

COACH Tbt'l

We found that the S\\ 1 cartridge and the Info-Tech dtd equall) well with M or~c code. Both dcvtce-. drsplayed the '>arne text con:.i..,tentl). Bill's receiver ha\ more filtering than the Kenwood. which helped elimmate :.tallc and other ~rgnal interference. The SWL cartridge abo did well with RTIY :,ignal-.. More ~ct-up is required since there are many more variaTransactor

trh.hlded.

NOISE OOACH . A Ceapl•t• t••c•t•l and ttttinc proar•• for J••rainl tht Nor'• code rarrrid1• •or CbC or ClZI. Set 4S

1• •

VlC lf'lCIAL

J

MICROLOG

\KU

GANO G

S lJ

E L ECTRON ICS

OF MARYLAND

8524 DAKOTA DRIVE, GAITHERSBURG, M D 20877 (301) 258-7373 77

February 1989. Volume 9, Issue 3

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

I


I

The ZR2 Hardware Interfacing Chip Control f unctions via the user port

LR2 - -10 pinlJ/1' lwrdwure iniCifan• 111tegrated nrcuit chip

60HL If you develop a IX dimming or 11crial tran\fer application, then change the cryt.tal frcquenc). you m<l} have to adjuM your software to compcn'>ate.

$29.95 plu~ $1.55 .\lllf>Jiill~ (U!}) i\l..X DiKital

12265 S. Dixie !lll'y #922 Miami Fl 33/5(>

The eleven inpuh fal l into three groups: eight data inputs, two 'logic point'>'. and a reset linc. For most applications, one or both logic point\ arc required. l"he reset '1gnal is neces\ary if you ~ant to change funcllon' under '>Ohware control. lf you u~e the Commodore u~r port, that leave:, only five line:, for data input\. Thi' i'> enough to '>elect all of the ZR2'~ function!>. But, !>Orne function., accept parameter' U'>ing all eight data inputs. With the U'>cr rxm application. you're limited in the range of the'>e funcllon' you can acce,s.

a dis/.. ll'ith 8 1\ W< routines to comrol tlw LR2 connected to a Conmwdore 11.\Cr(UII/ 1.1 arwlahle fin· $5

Commodore eight-bit computers have an 'open architecture'. ~ith all control <tnd data 'ignal\ brought to the out,idc world. The \lC-20 <tnd C64 al'o prO\ 1dc a U\Cr port with eight bidirectional line' e<t,il> controlled by 8 \SIC .,ohware. Their IO\\ co" make' thl!m ideal for har<.l~are;: control 'Y'-tem,.

Parallel decoders The w,er port ihclf i'> <I \tmple c1ght line decoder. By ...ending a value bemecn I and 255 to the U'>Cr port. it.. outpuh can be 'turned on· in an> combination. The outputs arc 'latched' in this state: the) don '1 ch<lngc until another number is sent to the pon.

But. the time '"ved b) u... mg the.,c computers i'> often lost again in building the hard~ <ll"l! interface\ }OU need to make computer '>ignal' operate real "'orld devices. A product that attempt' 10 make mterlacing easier is the ZR2, from -\I'\ Digital. rhi' forty-pin DIP (Dual lnhne Package) chip prm ide' \everal pmgr<~mmahle func tion'>. The function' can be loo\CI) grouped a... : one-oi -X outputs. pube counter. ~e­ rial function.,, dimmer.., and .,pc<.:ialit.ed display.

If want 10 turn on output #"i, your -;oftware

have to calculate the appropriate bmary value to 'end to the port (32 in this case). lf you want to turn on output #7 ~ ithout tum111g off #5. you 'II have more calculation to do (I 28+32-160). lf you need more than eight output\. you huve a challenge.

Hardware requirement!> The ZR2 ha'> eleven input!> and ~ixteen output\. The only additional pam required are pull-up re\i,tors. a capacitor and a Cf) ~tal (see f-igure I). t\t '\ n:commenlh w,mg buffers on the 7R2 output,, and 'fk!cllic' 74240\. The'e are 11L (TransistorTran.,btor Logic) tri-.,wte gatc<.l buffer pad.ages. Since they invert the ZR2 '>1!!11.11\, I U'>Cd the '>imilar 74244. It is pin-forpm compatible. but provide'> un inverted buffering.

The ZR2 pro\ ides -;orne easy alternatives. In what's called the "marrix" mode, you have two eight line decoders To activate this mode, ) ou fiN place a value of live on the <.lata bus and ground the reset line. Thi'> re ...eh the ZR2 to the funcuon spectfied by tile number on the data bu'>. Next. place a tero on the data bus. In matrix mode. the ;ero -.aluc i'> a toggle. But in !>Orne mode.,, a faM tero 1' required. or the mode selection number may abo be interpreted as the flr'>l data \alue.

The ZR2 requires about IOOma (milli ampere~) at five ,·olts oc. A C64 ~ ith a rxm er \uppl) 10 top con<.lit1on mtght be able to pro \Ide lOOm a But I .,trongl) '>ugge'>t a .,eparate power supply for the ZR2 <toll the t1rcu1h it dme.,. Be ... urc to connect computer ground to ZR2 ClrtUII ground.

'o"' '>end any value bet\\Cen I and 25"i to the data bus. The corre..,pond1ng output\ of ··outrxm #I" ~ 111 tum on. They ~ill be latched. JU\t "' '' ith the u'er port. Sending a 1ero to the data bu~ toggle~ the <.lata bu' to "outport #2". The next data value ~ill tum on the appropriate line~ on outport #2. ew value)> sent to the porh will change the output lines in the same manner a<, the u'er port.

A cry'>tal frequency betY.een I \111t. and ll~UIL ~ill work for mo~t funcuon\. A t\.1111 cry'>tal i~ ~pecified for AC dimming at 78

Transactor

--

~

-

~Ill

February 1989: Volume 9, Issue 3


To tero an ourport. you mu't ground a !ogre pont line \\hilc ~end111g data to the outport. fhi~ worked I inc tor me on out port #1. But. r \\U~ unable to lero OUI(Xlrt 1#1. Al,o. \\ ith three of the Commodore u~er pon line~ connected to the logil' (X>int~ and reset. I was limited to controlling five line~ on each ourport. An alternative decoder may be more u,eful in ~ome ctn.:um~tance~. The one-ol- \i\teen decoder is 'elected b} re,etting the ZR2 Y.ith a si\ on the d;lltl bu' lf)ou don't q rickl) folio\\ thi~ "rth a tero. the 'i' "til appear at the /R1 output. Even at computer ~peed:.. your real \\orld device~ might respond to this hnef signal. £'11 dbcus' a 'lh for tht' later. "'ow a "alue from one to eight .,.. ill turn a corre,ponding line of out port #I on "Ole that this i' a true one-of erght decoder. where the "matri>." was a htnal) decoder If you put a number from mnc to 'txteen on the data hu,. a hne on outport 111 '"ill tum on. 1l1is is the "oR" modc... onl} one line on each outport '-"ill be on at <tn) time. At '\ ha~ de,igned the /R1 -;o the outport' are somewhat independent tn thi\ mode. You can tum on Ime' 1n either port with ju'it one number on the data bu .... But. folio\\ mg .m eight \\llh .1 mne \1 t11 lea\e the la\t line on outpon #I on and lllrn the liN line of out(X>rt #2 on aJ,o.

#I. A paraJtcl cop) of the word appear' on outpon #2 tor verification. Thc\e pube~ are fed to logic point #2 of the 'econd /.R2. 'ct for \erial mput.

In this mode. the receiving ZR1 dt'>plays the received daw on outpon #I 111 hmary form. l"he data., latched unttl a new \\ord j<, received New Y.Ofd\ replace old ones; no "AND" mode. A tero " a ..,tan of trathmi\'iOn .. 'ignal to the fiN ZR2. ;md i\ not sent as d<tttl. Not being uhlc to transmit a zero V<tlue makes thi~ wrial '>) ~tem u'eles~ for 'ending program or other data But 11 can be used to send one-of-eight input control 'tgnah over long di,tance~. There is a decoding delay. \\hich irll.rease' '" 11h the value of the numb.:r 'ent.

Pul'>e counter Pube counting moue b ~imilar to 'enal decoding Howc,er. in thil. mode. nc" pul\e~ arc merely added to the e\t\ttng l·ount. Both outport' are used together. So. number-. up to 65.5.15 can he "dt~played'". The line' t.hange \\ith each put...e recel\cd. 'lni' make' for an interesting displa). But. an} UC\ icc\ con- , nected to these line~ will get morncntar} pubc~ a~ }OU \end ne\.\ number' DC dimmer

1

If you ha\e .1 need tor many line' to he on <II one lime. you can enter the "\:-.!D" mode h> grounding logtc point #2 Now !>ending in se4uence 1·. ·2·. ·3· to the d·ua bu' \\til cau'e the fin. I three Ime:. on outport # l to come on. Sendtng a tero to the data bu' clean. the outputs in hoth nwde~.

Up to eight '~.:parate line~ can be 'elected tor dunming 'ia outport #I The line' 'tart '" ith no output. Gruundmg logu.. point #2 cau~es pul'ies to he -;ent to the \elected line~. The pul'e" increa'e in width. ba,ed on the cl)·,tal frequenc). The ob,crv ed effect on 11 t>~ connected to the hne.., •.., that the} gradually come up to full brightne" \her hriefly grounchng !ogre point #I. logic (XJtnt #2 " u~ed to dim the t H>~ agarn. Bringmg logic point #1 high during the prtx:e'' hold>. the 1FOs at their brightness le' cl. So a slo\\ er 'peed can be 1111plemented by pulsmg logic point #2.

Serial decoder

The \erial decode funcuon pro"~>tde~ an rntere~tmg alternative. ~incc fe\\er data line' are rc4uired to U\C 11 In hct. if )OU -.et up the function u.. mg hard\l.are (\\'Itches perhap-.). you onl} need t" o ~ignab. Oat<~ j, sent on logil. (Xlint #1. Up to eight pul'e' can be ...ent A line \\<til tum on at outpon #I reprc-.cnting the total numher of pulse~ sent. 1l1e tuning ., moderate!) criucal hen: If the pul'c \\ tdths and frequcnc) aren't right. the decoding will be erra11c. or not work at .til. The exact tuning \\ill depend on the cry,tal frequency you u,e.

Of cour...e. other de\ ices can be w..cd in place of tros. I tried a '>mall DC motor with fair rc,ults (Oe 'ure to use a back bia,cd diode to pre\ ent rc\ er..e voltage 'pikes entennr the integrated circu ih). But any robotic' u,efulnc...s of thi~oo mode is ehminat ed because you must come up to full "hnghtne...s" hcfore ..dimming" again. You can go from any brightne" le\clto zero. a feature not mentioned in the ZR2 document;llron.

Output' are "ANDed". So. 'cndinl' ·I·. · 2 ·. and '3 · in ...ucces,ion "rll cau'e all three of tho~c ltnc" to 1urn or• You can control outpon #1 independent!) b} grounding log~t point #I before 'ending pui\C~. \ nine \Cnt to either out(XJrt \.\ill tero the outpuh.

AC dimmer To uulile AC dimming. you need a 41\.111/ crystal driving the ZR2. and some addiuonal pam. \C dimming \\Ork\ differently from IX dimming. "'ot on!) can }OU 'dim· he fore reaching full brightness. you can't avotd it. Bnngmg the logtc point high to halt the pnx:esl> aJ,o toggle-. the dtrecuon. To bri)!hten light' to a paniculur level. \top, then brighten again, you must 'end two ground pulses to the logic pomt. The lirst to)!gle' dimming. the second ''" 11chcs hack to brightening. Sine..: we're dealing wrth AC de' ices. tht\ won't he a problem for the output.... But 11 mean" a more de' ice inten\t\e 'otmare routine.

An mtere ... ting fXl"ihilit) here i' that the puhes to logic point #2 don't have to come from the computer. You can u'e pre· recorded pul'e~ from tape. or docked pul'e~ from a R0\1. or from another ZR1. L ... mg tape. ) ou could '>Ct th~; device up entirely in hardware "ith s\l.llches... no computer re4uired. AtH'\ has abo Implemented 1ts own propnctary ~erial tran~mis ,jon S)'>tcm using 1\.\0 ZR_,.,_ The liN ZR2 receives a p;lrallcl eight byte '" ord. and generate'> '>erial pul'e' on outpon #I line Transactor

79

February 1989; Volume 9, Issue 3


j{?nly one output can be controlled in AC dimming. However, the dim rUle ~~ 'electable over a reasonably wide range by placing a number on the data bu,. pecialiLed

di -;pla~ s

fir..t electronic~ con~trucuon proJeCt!> were 'do nothing· boxe:.. We made them from neon light~. capacitor:.. and resbtor.. (relaxation oscillato~ to you kOO\\ ledgeable folks). The lights fla.\hed 10 pattern-.. usually a circle.

M)

Integrated circmt-. made 'do nothmgs' much more sophisticated. I wrote fwo an1cle~ for Rmlw-t.lectmmn magaLine on LeO 'do nothing' boxes th(lt w.ed RO\t's to produce a variety of display~.

Perhaps because of my pa't interest in doing nothing. I found the "chaser" routines most interesting. There are four separate displays that produce 'chasmg' pauerns on LEDs or other Iights connected to the ourpons. The displays are speed conrrollable. v1a the data bus. The) can al!.. o be operated in •·pulse .. mode through the logic poinh. You can mal..e a l>imple 'do nothing· that switches among the four di~play~. Or you could connect the outputs to Chri5tmas tree lights or other d1-.plays for \Ome interc,ting effects. Clever as they are. the chaser-. arc not very useful for hardware conrrol. Should

~ou

The first example also implies that the ZR2 must be started from a pov.er off condition to change modes. In fact. a grounded reset line will sv. itch modes on the ZR2. It will also force all ourpuh high hrietl). Th1s may be annoying for light displays. It could mean dl\aster for real world de\ 1ces connected to tho-..e outpuh. Thts and other de.,1gn 'features· probably stem from ALX \ bacl..ground de.,igning lighting control sy~tems. Lights aren't as fu.,.,y about brief '>purious signals as arc integrated c1rcuit controller-.. \l) solurion wa-. to add a one-shot crrcuit to the standard schematic provided h) \t,x. I connected the output of the oneshot to the gate pin-.. on the buffer... The one-shot is tnggered by the ZR2 reset signal to disable the buffer outputs. It\ timed to hold the gates low until the ZR2 scules its outputs down to their desire<.l state. It's not always clear from the documentation what the state of the logic points should be. 1 here are several unused pins on the chip. These should not have unything connected to them or internal damage may result. But no caution appears in the manual. AL.X has infonned me that they are working on a revision of

the documentation to correct ... ome of these problems. For experienced elccrronic\ experimenter.... the 7R2 provides a co•;t effecuve way to I.JUICI..Iy and eas1ly expenment with new interface circuits.

buy one'!

If you have the electronics e>.pcnbe. you could build a hard" arc device to perform an) one of these tasks for less than the cost of a ZR2. If you have onl) one particular project in mind, the ZR2 may be O\erl..ill.

••

••

If you lil..e to expenment, or If you hnd your hardware needs changing periodically, the ZR2 may be a rea-.onable investment. You can certainly connect it in 1..cveral different circuits more easily than you could construct equivalent hardware. Tt may even be cheaper to te~t syMems using the ZR2 that you eventually build from discrete pnrts, 1f your development time i~ valuable.

I•

l~fVT

n

eus T• 10

I?

=--·mn-L,-'•' [

••

!1·

••

~

There are ... orne prohlem~. many with the documemation. Some electronic~ knowledge on the user\ part is <l'>~umed. In the fir~t example (the chase~). the U\er b told to "bring the same pin nogic point #21 up to +5 \OIL-.." A few sentence~ later come~ the caution "~I\ r R CO'I,ECT A'<Y PI!'. OrTHEZJU DI

r-:

"

Z"2

I

·~ ·i

.....

l

-

,r- •

,..

A LX

RI:CTLY TO +5'"

,.. s

LNT£Rr.C.N' n •l Zltz

u

00

01

0,

~.,

'

'

+----'I ••

,,..

DIGITA L

,.. TNI .,.~JoC w ,. """ .,.. ro tt.:tPr.&.(~( fMI:

II

~

,,I'

....

••

.. ' ..... ::h:__, .. ,.. .. ..f . .. • •• .. i• .,.. . :l .. •IT

.:-;

LOOIC r'O!Nl~~! lOGIC P'OINT 'l

~

• ..1

•• no

.. : -'

10

!'}W

10

••

;r.,

This apparent d1o;crcpenc) a\\ume'> that the uo;er understands "+S \OIL., .. a., a 'lang termmology "h1ch actuall) means "logic one.. 111 the 1 11 world. A 1 rL "log1c one" ~~ u~ually in the range of +3.4 volt.... Some mput lines can cause tntemal chip problems if connc~tcd to the higher • S volts. The user must have a good idea when "+5 \Olt~ .. in the manual really means "logic one." Transactor

80

February 1989: Volume 9 ,1ssue 3


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.