The transactor vol7 iss1

Page 1


..! �.

.

'

c{ .

r,

' •� � .·� .�,$'· '

•'

' -

r l

--

-=-=-��,...'·.,.; 128or64

't

I

"

If you wont to get the most out of your Commodore 128 or 64, we hove goods news for you. The Paperback 128 and 64 Series of Software both offer you serious, professional quality software packages that ore easy to use and inexpensive. '

o,l-j,.�

'

.

.. .

.

"' .

...

..

Paperback 128 or 64 Software is so easy, you're ready to start using it as soon as it's loaded into memory. Even if you've never been in front of o computer before, you'll be up and running in thirty minutes. In fact, you probably won't ever need the reference guide ... 'help' is available a t the touch of o key. That's how easy.

I

.

• l'F -" • _,., •

•-<' , 1•

·-

'

.<c/'.-..

..,_

#'

Paperback 128 or 64 packages hove oil the power you're ever likely to need. They hove oil of the features you'd expect in top-of-the-line software, and then some. The good news is that Paperback 128 or 64 Software Packages are priced way down there ...where you can afford them. Fast, powerful, easy to learn and inexpensive. Soy, that is good news! '

.

.

-'

'

- ..

--. , ,.. ..au;•� ----o:-;:-

-

.

••-�

.... ..

�·

.. ...

'

..-. '' j -

I

I

.

.

.

-

.

With Paperback Writer 128 or 64, there's no more guess ing what text will look like when you print it. What you see is what you get ... on screen and in print. There ore no fancy codes to memorize, no broken words ot the end of a line. Easy to learn and sophisticated. Paperback Writer 128 or 64 offers standard word processing features plus ...

.

- ·- -

..... .

#

,

. ··-

'·

-

._.

-� -�

u�

-

•. •,

.

..

>"I?'

-

.

��

.,...;. ... v.•n _.., f' • '�

..... •-- __ ... _·---• ...

The word solutions is our middle nome and bottom line. When you purchase Paperback 128 or 64 software, you con count on it to solve your problems.

• spell i ng-checker lets you odd words to your diclionory • 40 or 80 columns on screen • f i les compatible with PoperCiip'M or other word processors

• on-screen formotling ond wordwrop • on-screen boldface, underlines and italics • no complicated format commands to cl utte r text • on-screen help at all levels

128•64 .... ....

.

Paperback 128 or 64 Software Packages offer you something . else you might not expect ... integration. You con combine the output of Paperback Writer, Paperback Filer and Paperback Planner into one piece of work. You con create o finished document with graphs, then send individually addressed copoes. ·

;:;...__ . _

-

-

•"-

What you see is what you get

of

.....

Paperback Planner 128 or 64 software lets you make fast work of all your bookkeeping chores. Cheque books, household accounts, business forecasting and bookkeeping ore just some of the jobs that Paperback Planner 128 or 64 packages make easier. You con even create four different kinds of graphs. Accurate, sophisticated and easy to use. Paperback Pl011ner 128 or 64 offers standard spreadsheet features plus ... • accuracy up t o 16 d igi ts, about twice os many os most spreadsheets for the Com mo dore 128 or 64

• sodewoys pronting available on dot matrix printers, for oversized spreadsheets that won't fit on standard paper • on-screen help at oil levels

• compatible with VisiColc"' fil es

• 80 co lumn on-scre'en option for the Commodore 64 in addition to the standard 40 columns

• g ra p hics include bar, stocked bar, line ond pie grap hs that con also be used in word p roces si ng fil11s • • smart evaluatl9n · of fo r mulae for occura -t te' co mp lex matrices :: · ••

..

I

Fler

128•64 easy

With Paperback Filer 128 or 64, you con organize moiling lists, addresses, inventories, telephone numbers, recipes and other information in on easily accessible form. Use it with Paperback Writer 128 or 64 (or other word processors) to construct individually customized form letters.

Paperback Filer 128 or 64 packages ore fast, sophisticated and truly easy to use. In addition to standard database features they offer ...

• use up to 255 fields per record (2,000 characters pe r record)

sorts by up t o 9 crite ria, con save 9 d ifferent sorts

• print labels in multiple columns

• flexible rep ort formatting including headers and footers

• optional password protection including limited access viewing or updating • on-scr een help at all levels • •

print from any record to any record orothme tic and trigonometric

functions in reports using up to 16 digit ac cura cy



JOIN TPUG The largest Commodore Users Group Benefit from: Access to library of pubuc domain software for C-64, VIC 20 and PET/CBM Magazine (10 per year) with advice fr om Butterfield Brad Bjomdahl Liz Deal Jim

TPUG yearly memberships: Regular member(attends meetings) Stu den t member (full-time, attends meetings) Associate (Canada) Associate (U.S.A.) Associate (Overseas- sea mall) Associate (Overseas- air mall)

-$35.00 Cdn. -$25.00 Cdn. -$25.00 con. -S25.oo u.s . -$30.00 Cdn. -$35.00u.s.

-$45.00 U.S.

FOR FURTHER INFORMATION: Send $1.00 for an information catalogue (tell us which machine you use!) To:

TPUG INC. DEPT. A. 101 DUNCAN MILL RD., SUITE G7 DON MILLS, ONTARIO CANADA M3B 1Z3

COMAL INFO

If you have COMAL­ We have INFORMATION. BOOKS: •

• • • • • • • • •

COMAL From A To Z. $6.95 COMAL workbook. $6.95 Commodore 64 Graphics With COMAL. $14.95 COMAL Handbook, $18.95 Beginning COMAL, $22.95 Structured Pro9ramming With COMAL. $26.95 Foundations With COMAL. $19.95 cartridge Graphics and sound, $9.95 captain COMAL Gets Organized, $19.95 Graphics Primer. $19.95 COMAL 2.0 Packages, $19.95 library of Functions and Procedures, $19.95

OTHER:

• COMAL TODAY subscription, 6 Issues, $14.95 • COMAL 0.14, Cheatsheet Keyboard overlay, $3.95 • COMAL Starter Kit !3 disks, 1 bOOk), $29.95 • 19 Different COMAL Disks only $94.05 • Deluxe COMAL cartridge Package, $128.95 <Includes 2 books, 2 disks. and cartridge>

ORDER NOW:

A 65 page reference section that includes: •

All hardware specifications including the C128 and PC1 0/20

Useful memory locations

Useful programs

SuperCharts

BASIC and machine language hints

Hexadecimal conversion

Sound, video

and more

The full calendar and date book includes: • National holidays in ten countries • • •

Personal notes

1987 forward planner

Name, address, telephone section

Just $5.95

(plus 50¢ postage and handling)

Order Your Copy Today! Canada

The Transactor 500 Ste eles Avenue Milt on Ontario ,

Call TOLL·FREE: 1·800·356·5324 ext 1307 VISA or MasterCard ORDERS ONLY. auestions and Information must call our tnfo line: 608-222·4432. All orders prepaid only-no c.o.D. Add 52 per book snipping. send a SASE for FREE Info Package or send check or monev order In us Dollars to:

COMAL USERS CROUP, U.SA . ., UMITED 5501 Groveland Ter:. Madison.

From The Guru Himself! The 1986 Commodore Reference Diary

WI

53716

Tl!ADEMARKS. commooore 64 of commodore Electronocs ltd" CIP!<IIn COMAl Of COMAl USe� GrouP. USA .. ltd.

L9T 3P7

USA

The Transactor 277 Linwood Avenue Buffalo, New York 14209

Dealer Orders: USA Ca na d a MicroPace Distributing Nor land Agen cies 1510 North Neil Street 251 Nipissing Road Milton Ontario Champaign, Illinois 61820 L9T 4T7 1 800 362-9653 (416) 876-4774 ,


cr

., '\

I

/

p

/cv

-""\:\

\

THf>..l S How You DolT Df\l)�)' �

\


bile driving deep into the Black Forest of Germany, our low and unreliable Volkswagen started sputtering and puttering and then to our dismay, just quit running. After hours of unrelentlous tinkering, our poor little mobile was running, slowly, but running. And we wanted to get out of that dank and dark forest quickly. Befuddled and confused, we were ecstatic to see a strange little Gnome emerge from behind a tree. This creature, who called himself Hacker, used his infinite wisdom and wizardry to fix our Volkswagen and get us speedily on our way. Well, we were so impressed with Hacker Gnome's wizardry, that we convinced him to reveal his secrets for speed and reliability. And we are passing these secrets along to you so that you can write the very best Basic Programs.

INTRODUCING-GNOME SPEED (A Basic 7.0 Compiler for your Commodore

128)

Gnome Speed allows you to transform virtually any Basic 7.0 Program into a compiled ver ion that

i

as sophisticated and fast as if it

were written in machine code. Simply compiling your program with

(

Gnome Speed not only gives you super-fast execution speed, but also

"-

informs you of all your program coding errors, so that your compiled

program is error-free. And for those of you who want to sell your

'

program, aJI your efforts and programming secrets will remain

\

yours, since only the compiled

'

/

version - not your Basic source code need be included on the disk. The price? Only $59.95 (U.S.) NO DONGLES!! NO COPY-PROTECTION!!!

U.S.A. MAIL ORDERS:

CANADIAN MAIL ORDERS:

DEALER INQUIRIES:

SM Software, Inc.

The Transactor

Micro-Pace, Inc.

J -215-682-4920

1-4I 6-878-8438

l-217-356-1884

(see order card)

SM SOFTWARE, INC. P.O. Box 27 Mertztown, PA. 19539-0027

1-215-682-4920


I

N

T

R

0

D

u

c

N

G

I

SINGLE/DUAL NORMAL COPIER

GCR EDITOR

Cop1es a d1sk with no errors '" 32.68 seconds.

Yes disk fans, a full blown sector by sector or track by track GCR Ed1tor. Includes TRUE B1t

dual vers1on has graphics & music.

DensityfTrack Scan.

SINGLE/DUAL NIBBLE COPIER

Nibble Copies a disk 1n 34.92 seconds. Dual

3 SUPER DOS FAST LOADERS

version has graphics & music.

Over 15 times normal DOS speed. Super DOS Files are still Commodore DOS compatible.

SINGLE/DUAL FILE COPIER

150

7 times normal DOS speed. Includes multi-copy,

Imagine loading

7·15

SUPER NIBBLER/ SUPER DISK SURGEON

multi-scratch, view/edit BAM, & NEW SUPER DOS MODE. In Super DOS Mode, it transfers limes normal speed, copies

150

seconds.

blocks in 23

blocks in

10

seconds.

Quite frankly, these will provide you the user with the backup you needl Even copies itself.

TRACK & SECTOR EDITOR

Full editing of t&s in hex, dec, ascii, bin. Includes monitor/disassembler with printout commands.

PLUS

$3.00

$29.95

u.s.

SHIPPING/HANDLING CHARGE

-

$5.00 C.O.D. CHARGE

PRISM

SOFTWARE SUPER KIT/1541 IS for archival use onlt' We do not condone nor encourage p�racy of any kind

401

I

I

I

LAKE AIR DR., SUITE D • WACO. TEXAS 76710 ORDERS (817) 757-4031 • TECH (817) 751-0200 MASTERCARD & VISA ACCEPTED

See center page for mail order card.



•

II

I

/

''There's only one thing I like better than ice fishing

•

.

.


...And that's sitting at home with my computer and a Transactor Magazine!''


·

Please send me 6 consecutive Tn:ansac:lai'S starting with the next issue! OU.S.A. SIS.us.

USA

0 0

(0 Please send microfiche instead of magazines)

0Air Mail (Overseas only) $40.us. tocludes S.4 I S �· Ptf issue

OF'oreign $21.us.

Renewal (please include your Subscription Number from mailing label) New address? 0 New Subscription ____ _

Name & Address'

SAVE 29%0FF

-,.------,--­

(please include your postal/zip code):

Cover Price 0 JB's 1986 Diary $S.95* (ptus50f p&h) 0 Paperback Writer C64 $39.9S* 0 Paperback Planner C64 $39.9S* C64 $39.9S • 0 Pape rback Filer $14.9S* 0 Paperback Dictionary

0 Transactor Microfiche Set (Vol4 + VoiS + Vol6) 39.95* 0 Inne r Space Anthology $14.9S* 0 The Toolbox (PAL and POWER) $79.95* 0 The TransBASIC Disk $9.9S* 0 The G-Link Interface $49.9S*

0 Paperback Writer C I 2 8 $49.9S* 0 Paperback Planner C128 $49.9S* C128 $49.9S* 0 Paperback Filer 0 Supe r Kit IS41 $29.9S* 0 S M BASIC 7.0 Compiler $59.95*

Note: See News BRK page 77 for details on above items Transactor Back Issues: $4.50* each.

The Transactor Disk (IS41I 4040/MSD format) 0 Please send 6 consecutive disks t o correspond with my magazine subscription: $45.00. •

0 0 0 0 0 0 0

Please send the f o llowing disks at $7.95 • each.

0 0 0 0

Disk I Disk 2 Disk 3 Disk 4

0 Disk 0 Disk 0 Disk 0 Disk

0 Disk 0 Disk 0 Disk 0 Disk

S 6 7 8

9 10 II 12

Vol. 4, Issue Vol. 4, Issue Vo l. 4, Issue Vol. 4, Issue Vol. 4, Issue Vol. 4, Issue Vo l. S, Issue

0I 02 03 04 - MF only OS- MF only 06- MF only 01

0 0 0 0 0 0 0

Vol. S, Issue Vol. S, Issue Vol. S, Issue Vo l. S, Issue Vo l. S, Issue Vol. 6, Issue Vol. 6, Issue

02 03- MF only 04- MF' only 05

06

0I 02

0 0 0 0 0

Vol. 6, Issue 03 Vol. 6. Issue 04 Vol. 6, Issue OS Vol. 6, Issue 06 Vol. 7, Issue 01

• Prices are in U.S. Dollars

NOTE: Prepaymentrequired. Purchase orders will be accepted ONLY if accompanied bypayment. 0 Cheque/MO. enclosed 0 Visa

D ated

Cheque ..

0 MasterCard

I

I

Amoun.__

___ __

Expires

Acct. ..

I use the following Commodore equipment: OCI28 OVIC 20 OC64 Disk Unit: OSFDIOOI 01540/41

08032/96 08250

08128 08050

OAmiga

04040

I

016/ +4 01571 04/86

0 Please send dealer information for The Transactor.

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

Please send me 6 consecutive TeanscadDIS starting with the next issue! OCanada $15.

Canada

0 0

(0 Please send microfiche instead of magazines) OF'oreign $21.us. OAir Mail (Overseas only) $40.us. �

Renewal (please include your Subscription Number from mailing label) New address? 0 New Subscription _ _ __ _

Name & Address. -:-:- code) ---,(please include your postal/zip : ,...-

p ost• per

i ll( t ude$ S-4 , I 5

SAVE 29% OFF

-------------------­

Cover Price 0 JB's 1986 Diary $5.95* (ptus50t p&h) 0 Pape rback Writer C64 $49.95* 0 Paperback Planner C64 $49.95* 0 Paperback Filer C64 $49.95* $19.9S* 0 Paperback Dictionary

0 Transact or Microfiche Set (Vo14 + VoiS + Vo16) 39.95* 0 Inner Space Anthology $14.95 • 0 The Toolbox (PAL and POWER) $79.9S* 0 The TransBASIC Disk $9.95* 0 The G·Link Interface $49.95*

0 Paperback Writer C l 2 8 $69.95* 0 Paperback Planner C l 2 8 $69.95* 0 Paperback Filer Cl28 $69.9S* 0 Super Kit 1541 $39.95* 0 SM BASIC 7.0 Compiler $69.9S*

Note: See News BRK page 77 for details on above items The Transactor Disk (1541I 4040/MSD format) 0 Please send 6 consecutive disks to correspond with my magazine subscription: $45.00. •

0 0 0 0 0 0 0

Please send the f ollowi ng disks at $7.95 • each.

0 0 0 0

Disk Disk Disk Disk

I 2 3 4

0 Disk 0 Disk 0 Disk 0 Disk

S 6 7 8

0 0 0 0

Disk 9 Disk 10 Disk I I Disk 12 •

Transactor Back Issues: $4.50* each.

Vol. 4, Issue 01 Vol. 4, Issue 02 Vo l. 4, Issue 03 Vol. 4, Issue 04- MF' only Vol. 4, Issue OS- MF only Vol. 4, Issue 06 MF only Vol. 5, Issue 0I •

0 0 0 0 0 0 0

Vol. S, Issue 02 Vol. 5, Issue 03 MF' only Vol. 5, Issue 04- MF only Vol. S, Issue OS Vol. S, Issue 06 Vo l. 6, Issue 01 Vol. 6, Issue 02 •

0 0 0 0

Vol. 6, Issue 03 Vol. 6, Issue 04 Vol. 6, Issue OS Vol. 6, Issue 06 0 Vol. 7, Issue 01

Ont. residents pleue add 7% PST, except on subacrlptlons, lbe Anthology, and lbe Diary

NOTE: Prepayment required. Purchase orders will be accepted ONLY if accompanied bypayment. 0 Cheque/MO. enclosed 0

Visa

0 MasterCard

Dated

Cheque

Amoun

I

Expires

Acc t . ..

I use the following Commodore e quip ment: OVIC20 DC64 D CI 28 Disk Unit: OSFDIOOI 01540/4I 0 Please send dealer information for The Transactor.

OAmiga

04040

08128 08050

08032/96 08250

016 I +4 01571 04/86


NO POSTAGE NECESSARY IF MAILED IN THE UNITED STATES

BUSINESS REPLY MAIL FIRST CLASS PERMIT NO. 390 POSTAGE

W ILL BE

BUFFALO. NY

P A ID B Y ADDRESSEE

rra 277 Linwood Avenue Buffalo, NY, 14209-9990

J, JJ.I I I.III ,J,I,,I,I,.I.I I,I,.IJ,,,J.,,IJ ••

---·---

•• ••

••

••

-· ---------- -------------------.-------------------

Business Reply Mail

No Postage Stamp Necessary If mailed in Canada Postage will be paid by:

Tra

500 Steeles Avenue

Milton, Ontario, Canada

L9T9Z9

-


Volume7 Issue 01 Circulation 64,000

ROM Routines I Kernel Routines Start Address

Editorial

Bits and Pieces

5

Letters

ml array

access

techniques

The C128- You Can Bank On It

Getting The C l28's CP/M In Gear non-hardware project

AmigaBASIC Function Plot Unmasking The Kernel

Adding Functions To BASIC

.... 3 •

Improving The SYS Command AutoLoad and the EPROM

intercepting BASIC commands

SYMASS For The C64

more on the mysterious Kernel

Command Wedge

Kernel Routines In The B 128 Kernel Who?

Jim Butterfield's C128 Memory Maps

G) ,I! ...

13

Transactor on Microfiche Transactor Mail Order News The Viewtron Starter Kit Transactor Open On Viewtron! The Transactor Communications Disk Music Workshops Distressed Commodore Users Hotline The I 54 I Revealed UsedComputer Listing Service Steve Jobs and Pixar Employees Buy Pixar MSD Disk Drive Information Exchange Introducing Super KillI 54I DISKORGANIZER For The C64 Ami.ga Spreadsheet, Telecommunications and BBS The Sourcerer 6500 Series Disassembler Help MasterFor The Commodore 64 RESWITCH from Compusave Uninterruptible Power Supply 80Column Mono Cable For The C- I 28 40/80 Column Switch Cable For The C-128

Longer Life For The C64 and 1541

a

News BRK ...... 77

TransBASIC Installment #9

C128 RAM Disk

Help: Line Scanner Required Attention Hot I 54 I Owners "... but if you fool me twice then I'm indeed a fool." Relative File Access In ML Real Programmers. . . Verifizer Update Sky Travel Support Help Required The Drive Disaster LADS to PAL Conversion

1541 Error Allocater Coloured Remarks Without REM Directol)' Filename Highlighter Easy Speedup For The C-128 With 1541 Drive C-128 Key Repeat C-64 Load It My Place Not Yours! C-64 Italics The SCNKEY Kernal Routine C-64 and VIC Un-NEWs Fast Memory Clear Using Garbage (PRINT AT Update) Update User Friendly Commands REM RAM: Tag-Along Program Variables Stringings Rhetorical Loops SYSing With The C-128 Running A BasiC From The CU On The Amiga C-64 Auto-Start The C-64 Great Escape Return of The Swords Of Doom Date Conventions The Hidden Message Verfizer For The Plus 4 and Cl 28 C-I 28's Help Key Redefined Amiga Lattice C Notes Reading 8250-Formatted Disks with an 8050 I 57 I 'sCan Be 100 Smart Holy Input-Buffer. Batman!

Matrix Manipulator

automa ticload andrun on power-up

a symbolic assemblerthat's PAL compatible'

18 25 26 29 34 36 38 42 44 46 48 54 58 63 66 69

Note: Before entering programs, see "Verifizer" on page 4 and 11 1

JUr 1986: 'llblurne 7, Issue 01


Program Ustings In The Transactor Editor in Chief

All programs listed in The Transactor will appear as lhey would on your screen in Upper/Lower case mode. To clarify lwo polenlial character mix-ups. zeroes will appear as ·o· and lhe feller "o"

Karl J. H. Hildon

will of course be in lower case. Secondly. the lower number I which has an angled top.

Editor Richard Evers

Chris Zamara

lhey're lisled here for reference. Also remember: CTRL-q wilhin quotes is identical to a Cursor Down. el al.

Art Director John Mostacci

Occasionally programs will contain lines lhal show conseculive spaces. Oflen lhe number of

spaces you insert will n01 be crilical lo correct operalion oil he program. When il is, Ihe required

Adminiatratlon & Subacrlptlona

number of spaces will be shown. For example:

Lana Humphries

print

ContributJ91 Writera lan Adam

Scoll Maclean

Daniel Bingamon

Steve McCryslal

Neil Boyle

Jim Mclaughlin

Anthony Bryant Tim Buist

Terry Monlgomery Michael Mossman

Jim Bullerfield

Gerald Neufeld

flush righl

Robert V. Davis Elizabeth Deal

Frank E. DiGioia

Yijun Ding Michael J. Erskine

Jim Grubbs Tom Hall

Bob Hayes

Up

Richard Perri! Terry Pridham

Gary Royal

Black

John W. Ross

While

John Russell Louis F. Sander

Red Cyan

Tom Hughes

Zollan Szepesi

Chris Johnson Mark Jordan

Karel Vander Lugl Audrys Vilkas

Clifton Karnes

Andrew Walduck

Gary Kiziak Jesse Knigh1 James E. LaPorte

Jack Weaver Charles Whillern

William levak

Evan Williams

Jack Lolhian

Chris Wong

=I

Orance Brown Lt.

-· - (Cyn] Purple - (Pur) Gree n -. Blue -·

Fred Simon

Nick Sullivan

I

Colour Character• For VIC I 64

Glen Reesor

Robert Huehn

=I

Home STOP

Raymond Quirling

Darren J. Spruyt

• (I 0 spaces)flush right

-· Delete -a Clear Scm- I

- (Uti

RVS RVSOff-

John Holllum

print

Jnoert

RJcht

Dave Pollack

Perry Shuliz Edward Smeda

as-

-II -·

Down

l..eh

John Jay Hilfiger Andy Hochheimer

- would be shown

Curaor Charactera For PET I CBM I VIC I 64

Noel Nyman

Jeffery Coons Pierre Corriveau

L (T) has a flal lop as opposed to lhe

Many programs will conlain reverse video characlers Ihat represent cursor movements. colours. or function keys. These will also be shown exactly as lhey would appear on your screen, bul

Technical Editor

Gary Cobb

case

-

Red

Grey! Grey2 Lt. GreenLt. Blue

-

Grey3 - (Gr3)

Yellow- (Vel)

Function Keya For VIC I 64

FlFl-

Sleven Walley

III

FSF6-

F7-

F3F4 -II

F8-

Production Allie Typeselling Ud.

Please Note: The Transactor has a new phone number: (416) 878 8438

Printing

Printed in Canada by Maclean Hunter Prinling

'" I MJbhshoed bt·monlhly by Traru.attoc Pu blbhmg Inc . SOO Sft'f'b Avenue-. \4ikon. USPS 72-S-050. Second001:» OntinO, L9T 3f'7 Ouwchiln S«ondOa.� mid rfgl$1�10'1 numbtt poilqo .-l •• llullolo. NY. lor US ...-nb<r< U.S ....,._,.,. ><nd addr.., changes 10 Thto Tr>ruo<tor 271 Lonwood A•on ... lluHilo. NY. 14209 ISS/'I• 0827·2530.

� fun.wnor

Quaatlty Or<kro:

134 2-.

nbuiOf buhng

US A 0.)1 C....,.rt�l D»>re

Charlton Burkt•ng

The TrJM�Cior u m no way c:on .n«ttd wtlh ComlfiOdcMt 8u'*MM MKhlflt'S l.ld o r Commodore lncorpouued Commodort and Com m odor�t product n"nl('\ !PET CBM. VK:. 64) �ue registered trade­ m.arkJ of Commodor� In<: Sul»cripcIOfl$, C•na<la$l5Cdn US.AIISUS Allotheri21US. An Mai l (Overseas only) $<tO US ($4, IS I)Os to.tge/i.ss.ue)

Orbv . . CT

11641�

C203t7:l5 .1. 1111 (or your IO(·,d whol6ol1er)

IUbKrlr.llon•

Send •11 to: Tiw Transactor. Subscnr>tk:ms Dc1>urtmenl. SOO Steeles Avenue. Mil ton . Ontario, Canadtt, })1' 3P7. 416 87A 8438. Note: Sub$Crlphorb arc: hand led at thr> osddress ONLY Sui)S('rijNions S4!1ll to our Buf falo addre-ss {above) will be forwcmled 10 M�hon � IQ. �·or l>cst resuhs, use JU� I d r•rd at center of maRUin�.

lht1f

O.k'oli lk-. Ontario L6J 51!4 1416)842 1555 (or yoor local wholt"!wtlcr)

Pon C VSC

Still Anllabl•:Vol. 4 01. 02.

P08o•3S2

Norland Commumc�IOil'

oquttltlm, RC 4K6

6U4 941 7911

03. Vol. 5: 01, 02, 04, 05, 06 Vol

Bat k l �ue :oa. :

Edlto n al co ntnbu llon .s Jre a lw a ys u or njted w e ko me Writer� a r e en 10 p repar � m a t erial acrord ing 10 r thetnb as mown 111 E d•tori .a l Schedule ( set> lis t nea r lhe end ol th•� •swd . R e m u n era llon l. '> $40 pe r pnnted Pl 8 t! P rel t u t'd media is 15 -4 1. 20 31, 4040. 8050. o r 8250 d t�ke ll es with WordPro , Wo r dCraft , Superc s npl O f SEQ 1�1 files. Pr ogram listings ov e r 20 line� Should be p�ovided o n di sk or tJpe M an u JCnf)C.s shou� be- t�nllen, doublr .spced a . with d\ I JCi rs t" or o f ml6lS cit arty mJr k ed. I �osor W111 bt' mcluded W' lt h aru c tb dtpendrna on u ah ry Au thors submlltl ng dlSkrttes will r�vtthe Trt�ru.KtOf Ot.)k for ahe isstlf' coot aming conrt�utiiOO

sp« l1

c. .. ..,......

Wymoh Rood

251 N1�ngRuad.l:mt 3 Millon. Ont.uto 1�rr 4ZS �Ir. 876 �774

SOLD OUT: nw lk�l of Tht Transactor Volumes I & 2 & 3; Vol 4 1\�ut.•ll 0", OS, CHi, Vol S ls�ue" O;t U·t

po!iiJge

1ltu:Mrauon s

M�'<Ol('f Medta

261

AU n H t lt'ria l a« tpted

U.SO e ach.

fi. (II, 112. O:l.ll4.1lS

Order all bikk ii\Suh lrom

Mllluri ii(J

bec:o mes t he prope rty of The Tran sat lo r All m •l (t t bl b l' O py r ight by l'r c m�c.: t or P u b licJr ii Ofh Inc Re.prod oc hon ill�")' lo rm wit hoult)t' rn m:won •• m VIOI•tion of • P � • h l ilble law� P J.ta....�. rt"<O n f1r m i ll)' perm t. Wons granlt.-d p r ior to ahi.s OOIK't" So >t , l'<l e m a n .til n�hb l te1ltd m •lt!tlfll ' ' .tt"t t. bi W !. only Wrilt 10 I he M1hon add ress tor a wn lt>u . pat k� · 1'lw- op nt�.m' t':x;p r � 10 rontnbuted artKit'S our no• W"C f'MN& or . Alltlll1u�h lllO'ool.• ulllw iran.... i atturaty '" • ma,or oi:Jt«'ttvt'. ll'le TransactOf cannot il'smnt- h.tlt ty kH \"!rur., "'if1 idt""o.,. t:w-ufitr�n""' Progr•m• lt�l"d i n TIK'Trinwc:tOf irf' pubhc frl"t' toC'Opy not &u ... .-11

l

q

b

2

domatn.

t

fll)• h

"'!'( '"'' 'Wiume 7, ..... 01


Special Aprli Feature:

S.N.I.F.F.

-

A Bold New Vision In Recording Media Software with an added dimension of realism

Price admits that the idea is not completely original; he was inspired by the cinema technique known as Smell-o-Rama, most recently used in the movie "Polyester". But he maintains that Sensory Labs is going beyond simple one-at-a-time sniffs, into the exciting science of compound scent. Scientists at Sensory Labs have broken down smells into nine primary elements, out of which almost all other smells can be created. Smells can thus be synthesized from the primary smells on disk, as the Read/Write head quickly seeks from one track to another, blending the smells to create new ones.

Transactor magazine has just scooped the story on an incredi足 ble breakthrough in floppy-disk technology which promises to add a new dimension to software realism. Sensory Laboratories of Fremont Wyoming, a company which develops more natu足 ral man-machine interfaces. has been secretly developing their new floppy-disk technology, called "Sensory Nasal Interface For Floppies", or SNIFF. The technology is now ready to be released for license by major software companies. Sensory Labs has managed to embed scents within the magnetic particles on a magnetic disk's surface. The basic idea works much like the "Scratch-n-Sniff" scent samples provided on paper carriers. The disk-based smells, however, are released by the heat-producing friction caused by the pressure pad opposite the Read/Write head. As the disk spins and the pressure pad rubs on the disk surface, the disk surface is slightly worn and heated, releasing the smells to the surrounding air, which is then wafted into the room through the drive's ventilation slots.

"Once we come out with the 3 TPS format", explains Price, "We'll be able to put all of the primary smells on a floppy, making true sniff-synthesis a reality. At that stage, we can sell our 'Sniff-Writer' software which will allow developers or even users to create any smell they need without having to place a special order." One of the problems being worked on still is the sniff-life of a disk; currently a typical track is good for about five sniff-hours. This may be enough for most games, but serious Sniffware will demand greater Sniff-lives. Improvements are on the way though, and Sensory Labs is even hoping to come out with a Hard-disk version called the "Hard-Sniff". Another potential problem is that in the event of certain hardware failures, the air in the room can be contaminated quickly. Sniff-disks come with warnings to use only in well-ventilated areas. This is especially true for programs using some of the stronger smells: for example, in an Adventure game the player may enter a recently-used bathroom.

Software vendors should be excited by the new sniff-disks (known as "floppy-sniffs"), since they can add a realism to their programs which was never before possible. Sensory Labs' President, Terrence Price, explains: "The first computers printed all their results on paper. Then, we had the CRT, which eventually opened up the wonderful visual world of computer graphics. Now we have high-quality sound and speech synthe足 sis as well. The sense of smell is the next logical step in human interface technology." The first batch of disks will be released in 4 TPS (Tracks Per Sniff) format. On a 35-track disk like the Commodore 1541 uses, this will give eight different smells which can be released. (The directory tracks are not scented because they need to be accessed periodically during a sniff-access.) A program releases a desired scent by moving the Read/Write head to the proper sniff-track and holding it there for at least three seconds. (This is called a "Sniff access" or just a "Sniff".) Sniff-access time is expected to improve in future advancements of the technology. Applications are expected to include games (smell the musty dungeon in an adventure); and a whole range of Sniffware for the blind, who have a keener sense of smell and will be able to follow scent prompts from the programs.

Looking towards the future, Sensory Labs hopes to have 3.5 inch Sniff-disks out by June. and the Hard-sniff by next year. When asked about the future of Sniff-disk technology, Price predicts: "I see a major demand for Sniffware in the next few years, because people are always looking for new methods of getting information from their computers. And as we say here at Sensory Labs, 'a picture may be worth a thousand words, but a sniff is worth a million' " And remember.

. . you read it first in The Transactor April

Edition- CZ

3

Jli( 1986: Volume 7, .._ 01


Using "VERIF'IZER" The Transactor 's Foolproof Program Entry Method VERIFIZER should be run before typing in any long program from the pages of The Transactor. It will let you check your work line by line as you enter the program, and catch frustrating typing errors. The VERIFIZER concept works by displaying a two-letter code for each program line which you can check against the corresponding code in the program listing.

With VERIFIZER on, just enter the program from the magazine normally, checking each report code after you press RETURN on a line. If the code doesn't match up with the letters printed in the box beside the listing, you can re-check and correct the line, then try again. If you wish, you can LIST a range of lines. then type RETURN over each in succession while checking the report codes as they appear. Once the program has been properly entered, be sure to turn VERIFIZER off with the SYS indicated above before you do anything else.

There are two versions of VERIFfZER on this page; one is for the PET, the other for the VIC or 64. Enter the applicable program and RUN it. If you get the message, " • • • • • data error • • • •• ··.re-check the program and keep trying until all goes well. You should SAVE the program. since you'll want to use it every time you enter one of our programs. Once you've RUN the loader, remember to enter NEW to purge BASIC text space. Then turn VERIFIZER on with:

VERIFIZER will catch transposition errors (eg. POKE 5238 I 0 instead of POKE 5 328 I ,0), but ignores spaces. so you may add or omit spaces from the listed program at will (providing you don't split up keywords!). Standard keyword abbreviations (like nE instead of next) will not affect the VERIFIZER report code. ,

SYS 828 to enable the C64NIC version (turn it off with SYS 831)

or SYS 634 to enable the PET version

(turn it off with SYS 637)

Once VERIFIZER is on, every time you press RETURN on a program line a two-letter report code will appear on the top left of the screen in reverse field. Notethat these letters are_in uppercase and will appear as graphics characters unless you are in upper/ lowercase mode (press shift/Commodore on C64/VIC). Note: If a report code is missing it means we've editted that line at the last minute which changes the report code. However, this will only happen occasionally and only on REM statements.

Technical info: VERIFIZER resides in the cassette buffer, so if you're using a datasette be aware that tape operations can be dangerous to its health. As far as compatibility with other utilities goes, VERIFIZER shouldn't cause any problems since it works through the BASIC warm-start link and jumps to the original destination of the link after it's finished. When disabled, it restores the link to its original contents.

Listing 1 a: VERIFIZER for C64 and VIC-20

Listing 1 b: PET/CBM VERIFIZER (BASIC 2.0 or 4.0)

KE JF Ll BE

OH GK FH KP

AF IN

EC EP OC MN MG

OM CA NG OK AN GH

JC

EP MH BH

10 rem• data loader for 1 5 rem vic/64 vers1on

• verifizer • •

Cl

CF

20CS=0 30 fori= 828to 958:read a:poke i,a 40 cs =cs +a:next 1 50 : 60 if cs<>14755 then print· ••••• data error ••••• ·:end 70 rem sys 828 80end

Ll HC OH GK OG

JO

AF IN ON

100 : 1000da t a 76, 74, 1010 data 252.141,

3,165.251.141. 2. 3,165 3, 3. 96, 173. 3. 3. 201 1020data 3. 240, 17.133. 252.173. 2. 3, 133 1030 data 251. 169, 99,141, 2. 3. 169. 3. 141 1, 133, 89,162 1040data 3, 3, 96,173,254, 1050data 0, 160, 0,189, 0, 2, 240, 22,2 0 1 1060data 32.240, 15,133, 91,200,152, 41, 3 1070 data 133, 90. 32, 183, 3, 198, 90, 16, 249 1080data 232. 208. 229. 56, 32. 240, 255. 169, 19 1090data 32.210.255,169. 18, 32.210,255,165 1100data 89. 41, 15. 24.105, 97, 32,210,255 11 1 0da t a 165, 89, 74, 74. 74, 74, 24,105, 97 1120 data 32. 210, 255,169. 146, 32,210. 255, 24 1130data 32,240, 255,1 08 . 251. 0. 165. 91. 24 114 0 d a t a 101. 89,133, 89. 96

1he nwliGCior

18

CK EB HE

01

JB PA HE

EL LA Kl EB

OM

4

10 rem•data loader tor 1 5 rem pet vers1on

verifizer 4.0 •

20CS=0 30 fori= 634 to 754:read a:poke i,a 40 cs = cs +a: net x i

50: 60 if cs<>15580then pri n t ·•••••data error • • • • • ·: end 70 rem sys 634 80end

100: 1000 data

76. 1 38 1010data 173,164,

2. 120. 173.163. 2. 133, 144 2,133, 145, 88. 96.120.165 1020data 145,201, 2,240, 16.141.164, 2.165 1030data 144. 141, 163. 2. 169,165,133,144, 169 1040data 2.133,145, 88, 96, 85 ,22 8,1 65. 2 17 1 050data 201. 13,208, 62,165,167,208, 58,173 1 060 d a t a 254. 1,133.251,162, 0,134,253,189 2. 168, 201, 32, 240. 15, 23 0. 2 53 1070data 0. 1080data 165.253. 41, 3,133.254, 32.236, 2 1090 data 198.254. 16.249.232. 152. 208.229.165 1100d a ta 251 , 41, 15, 24. 105,193. 141, 0.128 1110data 165.251, 74, 74, 74, 74, 24. 105,193 112 0da t a 14 1, 1,128,108,163, 2.152. 24,101 1130 data 251 . 133,251, 96 .

JWy 1916: � 7,1.-01


Bits and Pieces Cot an interesting programming tip, short routine, or an un­ known bit of Commodore trivia? Send it in - if we use it in the Bits

& Pieces column, we'll credit you in the column and send

you a free one-year's subscription to The Transactor

1541 Error Allocater Scott Gray, New Bloomfield, MO

* * • sound routine • • •

Do you have a disk you can't use because of errors on it? Rejoice, for help is here! Type in and SAVE Error Allocater. Place the faulty disk in the drive and RUN the Allocater. In a few minutes every sector with an error on it will be allocated. Now, since DOS won t try to write to those sectors. you can SAVE programs to that disk without encountering the dreaded Read Error!

You can use your favorite colour instead of yellow, or use RVS­ ON to highlight the message.

'

DA Kl MN GO CO FA ML

Directory Filename Hlghllghter

1 0 rem 1541 error allocater 20 c$ chr$(1 47): h$ chr$(1 9): 1$ chr$(1 57): 30 print c$: open 1 5,8,15, " u; • : open 2,8,2, • # • 40 gosub 1 10: if ef then stop 50 tor t 1 to 35: tor s 0 to 20 + 2•(t>1 7) + (1>24) + (t>30) 60 pnnt h$ • track · I · sector · s: 70 print tl$" [3 spaces] " : print# 15. • u 1 : • 2;0;t;s : gosub 1 1 0: if ef 0 then 100 80 print# 15, " b-f: " O;t;s: print# 15, " b-a: O;t;s 90 print: print · error" er · o n " I " , " s " 1 00 next: next: close 2: close 15: end 1 1 0 input#15,er.er$,e1 ,e2 : ef = 1 + (er 0 or er = 65 or er 73): return =

=

=

=

HA OL P8 FK

=

load · [shifted space )???filename" ,8, 1

=

Coloured Remarks

NM 8N Gl FN FG MD KL 88 GM NA OJ AA MF KA 8H CA EG AC GE 18

Luis Pistoia

Without REM

Argentina

Here is a si mple way to make important REMs. such as those identifying subroutines, 10 stand out in program li stings. Instead of the usual REM. like

1000 rem

•••

sound routine • . .

Make your subroutine-identifying remark like this:

1000 rem ·

Don Mills, ON

Here is a handy disk utility which allows you to highlight any filename in the directory. This is useful in making certain programs stand out, such as program boots; or to title various sections of the directory. The highlighting is achieved by renami ng the file with four special characters preceding it. The four characters are: shifted space, two delete characters and a reverse-on. This leaves enough space for only twelve charac­ ters for the rest of the filename. The routine below will first ask you whether you want to highl ight or un-highlighl and then ask fo r the filename. To load a highlighted file from the directory you can use:

=

=

Dlno Bavaro

L]•** sound routine

••

To gel the Reverse-M, enter the line with a space in its place at first, then move the cursor over the space and press RVS ON, shift-M, and RETURN. When you list your program, the above line will appear in yellow as:

5

1 0 rem filename highlighter 20 open 15,8,15: gosub1 000 30 hd$ chr$(1 60) + chr$(20) + chr$(20) + chr$(1 8) 40 input · 1 :highlight, 2:un-highlight • ;n 50 on n gosub 1 00.200 60end 70: 100 input · filename to highlight · ;hp$ 1 1 0 print#15, " ro: · +hd$+hp$+ " • +hp$ 120 gosub 1000 :rem check disk error 130 return 1 40 : 200 input· filename to un-highlight ;dp$ 2 1 0 print#15, • rO: • + dp$ + • = • + hd$ + dp$ 220 gosub 1000 :rem check disk error 230 return 240 : 1 000 input#15.e,e$.t.s 1 0 1 0 if e then print e,e$: end 1020 return =

=

J4iy 1916: 'loll:llume 7, ..... 01


Easy Speedup For

Ric.hard Young

The C-128 With 1541 Drive

Greenwood, NS

Here's the BASIC Loader:

Remember the VIC-20 and the 1541 disk drive? Remember the instruction in the disk drive manual for adjusting the 1541 for use with the VIC-20? Actually, the command OPEN 15,8,15, • Ul-" was not required to make the 1541 VIC-20 compatible, but rather it allowed the 1541 to function faster with the VIC. Now note the FAST command in the Commodore 128 (in 128 mode); it turns off the 40-column screen - no big deal because every 128 user should run it in 80 columns for anything but graphics - and allows the 128 to function much faster. Natu­ rally, it can easily keep up with the 1541 set for the VIC-20 speed. An estimated 1 7 to 18 percent increase in speed for all disk 1/0 is the result. With a 1541 and Commodore 128 in 80 columns, enter: fast:

EH ME IE HO

IC Nl LC

NC BG OF KD Ll II

AJ

open 15,8, 15, ui- • •

NH

KJ PG PA

Now you're in for faster business without special speed-up software! Note that • Ul + • puts the 1541 back to the slower speed required for the 64 mode and 128 in 40 columns. Of course, a 1571 is much faster still. . .

C-128 Key Repeat

C-64 Italics

Mort Adler, Winnipeg, MB

The C-128 has auto-repeating keys as a default after power­ up. To disable the auto-repeat, simply type:

Glen Mackinnon, Hanover, ON

you wish the Commodore 64 had more than one built-in character font? Thanks to the VIC II chip you can design your own custom fonts, unlike PET owners who are stuck with the Commodore set. Do

poke 2594,64.

To re-enable auto-repeat, type:

Custom character sets are usually reproduced in magazines via hundreds of DATA statements, but this short program creates the new characters by modifying the old character patterns in memory. This program uses the built-in character set to create a new set of pseudo-italic characters.

poke 2594. 128

C-64 Load It My Place Not Yours!

1 0 rem "load.it.here • by frank colaricc1 1 5 rem loads a prg at a given address 20 rem 100% relocatable - edit line 35 25 rem syntax: 30 rem sys a. · filename" .device number. load address 35 a = 49152 40 for i = a to a + 72: read b: poke 1,b: next 45 end 50 data 032, 253, 1 74, 032, 158, 1 73, 032, 143 55 data 1 73, 169, 100, 160, 1 01 , 032, 219, 182 60 data 1 60. 002. 177, 100. 153,251 , 000, 1 36 65 data 016. 248. 165. 251. 166, 252. 164, 253 70 data032, 189, 255, 032.253, 1 74 , 032, 1 58 75 data 1 73, 032. 247, 1 83. 152, 170, 169, 008 80 data 160, 000. 032, 1 86. 255, 032, 253. 174 85 data032, 158, 1 73, 032. 247, 1 83, 072. 152 90 data 1 70, 104, 168, 1 69, 000,032, 213. 255 95 data 096

The program shifts the upper four rows of each character to the right (the N/2 in line 70), giving them an italics-type slant. The new character set is located at 12288 (hex $3000) and is enabled by a POKE 53272,29. Since this program uses straight­ forward POKEs and only a divide-by-2 (shift right in machine language). it is a challenging but not impossible task for beginners learning machine language to try to translate. In fact, this program should be translated to machine language for increased speed; it is presented here in BASIC to clearly show the method of italicizing the characters.

Frank Colaricci Winter Park, FL

The Volume 6 Issue 05 Bits & Pieces section contained a program named · relocate · . I would like to suggest a relocat­ able load as an alternative to editing the load address of a disk file. Here's a routine that can be appended to your program that will load in PRG files where you want them. The ML program that • LOAD.IT.HERE creates is relocatable and may be loaded wherever you have 73 bytes of free memory. Please note that locations 251 through 253 are used during the execution of this ML program. •

After the program runs, the upper and lower-case characters are unchanged, but replacing the reverse characters are the italic-like letters (this has the side effect of destroying the cursor). To use the italics, just print or type your desired text in reverse-field. To switch back to the regular character set, use POKE 53272,21 .

The syntax of using LOAD.IT.HERE is: SYS start. " filename· .device number. load address

6

J4if tM6: Volume 7, Is.-01


El BF

PO

MK JO

CC AM OF

LM HB HM

C-64 and VIC Un-NEWs

10 rem italics for the c64 20 poke 53272,29: rem change char. set 30 ad = 55296: t1 12288: t2= 13312 40 poke 56333,127: p oke 1 ,51: rem disable irq, get char. rom 50 for i = 0 to 1 023: n = peek(ad+ i) 60 poke t1 + i,n 70 if (i and 4) 0 then n n/2 80 poke t2 + i,n : next i 90 poke 1 ,55: poke 56333.129: re-enable irq, normal rom 1 00 print " normal characters · 1 10 print" talics characters! ·

It's probably happened to everyone. While working o n some BASIC program you accidentally type ·NEW·. Usual ly that's

=

=

Shea T. Small, Thornhill, ON

All those hours of work gone down the drain. But there is a way out of that. Enter this line: the end of that.

For the 64 -

=

For the VIC -

.

poke2050, 1 :sys42291 :poke45,peek(34) :poke46, peek(35):clr poke4098, 1 :sys50483:poke45,peek(34) :poke46,peek(35):clr

Fast Memory Clear Using Garbage

Donald Fulton Stoneman, MA

The SCNKEY Ke.rnal Routine

Garbage can be useful. The BASIC li ne below will clear most of

(Author Unknown)

free memory, from 40K to 8K in only 2 seconds. Doing the

same job with POKE would take al most 2 minutes.

Here it is, the naked truth: the SCNKEY Kernal routine has been sadly neglected. Well, no more! For speedy keyboard input, it is unparalleled, a hare to GETIN's tortoise.

z$ =

"

· : for x

=

1 to 255: z.$ = z$ + chr$(0): next

it was that I

In generating one active string of 255 characters, an amazi ng

stumbled across this handy routine (located at 65439 - $ff91). I

32K of dead strings are left behind in dynamic string space. The math is the sum of I + 2 + 3 + . . . + 254 + 255.

To tell you the t ruth, I'm not even sure how

noticed that in all the memory maps, it was marked as not returning any values, but decided to try it out anyway. Voila! When t he routine is cal led, the Ascii value of the current key

This technique is effective in clearing a hi-res screen (or filling

been looking for for a long time, and has since proved to be

free RAM area (below $A000). Do the clear before moving the

superior to GETIN to check for keypresses.

top of BASIC down.

it with any given byte) if the screen is located within the normal

down is returned in the .X register!. This was something I'd

It works this way: the GETIN routine takes a character from the keyboard buffer and returns it in the accumulator. All keys can

(PRINT AT Update) Update

be made to repeat by putting a 128 in location 650, but a delay

Mike Schmidt North Tonawanda, NY

loop in the keyboard scan means that only about 7 characters a second are returned.

In the Volume 6, Issue 5 Bi ts and Pieces column an article titled · PRINT AT Update · stated that the Kernal PLOT routine was

But SCNKEY has no such limitations. It is called as part of the

unreliable when entered through the jump table at 65520

standard interrupt process and updates the keyboard buffer

(SFFFO).

and all key locations. However. reading from the buffer is slow

and the locations (such as location 203) retu rn values other than Ascii codes. It's the .X register that's the key. The value left here takes into account the shift, CTRL and Commodore-logo keys and reflects the state of the keyboard when SCNKEY is called. Best of al l, SCNKEY can be called and the keyboard read even when interrupts are disabled. Try this; the speed is

This is not the case if the carry is set or cleared before cal ling

the routi ne by POKEing the desired status into memory loca­ tion 783 ($030F). Before executing the routine, BASIC will put the contents of 783 into the processor status register.

So, to set the cursor position:

amaztng.

poke 781 ,row: poke 782,col: poke 783,0 : sys 65520: print · message ·

The SCNKEY rout in e can be used to great advantage in both ML and BASIC. To use

it from BASIC, SYS 65439 and then

PEEK(781) to get the Ascii value of the key currently held down. I only hope that future memory maps will give this great littl e piece of code its due.

To read the cursor position: poke 783,1 : sys 65520: row = peek(781) : col = peek(782)

7

J4r( .,.. \ofolurne 7, ..... 01 ,


Use.r Friendly Commands

A good example of this technique is the program which Mr. Cohen enclosed with this article, but was not printed here for lack of space. When first run, the program allows you to set up the backgrou nd border and character colours to your liking then stores these values in the REM statement as described above, and finally, SAVEs itself. The next time you LOAD and RUN the program, it restores these colours by loo ki ng at the three bytes it stored in the REM statement. Using the REM storage techni que, a program can know whether it was run before, and it can find out some information from the previous run as well. -T.Ed

Frank E. DiGioia

Editors Note:

Athens, GA

Did you know that there are two commands on the C64 which cannot give a syntax error no matter what kind of arguments you use with them (if any)? Can you guess which ones they are? (Hint: they aren't STOP and END.) The Answer: GOTO and GOSUB Commodore Trivia Department:

.

,

Place the following program in memory (so we'll have some­ t hing to GOTO) and then try to crash the GOTO or GOSUB statements 0 print ·this is line 0 • 1 print t his is line 1 • .

Stringings

Jonathan Hill, Bloomfield, Cf

In Commodore BASIC, there are some conditions that occur when using su ch character string functions as LEFT$, RIGHT$, and MID$ that programmers should be aware of. The condition can first be descri bed when using the funct i on:

Now give them your worst: goto (fred) goto$$$ gosub ·· string var .. gosub for/next

b$ = left${a$.3)

This command appears fine: B$ shou ld contain the first three characters that are in A$. But look again ! If A$ is shorter than three characters, B$ will also be less than three characters long. This is defi nitely something to be wary of, as somet imes in a program, strings must be of a known fixed length.

You simply cannot crash these commands.

REM RAM:

Herbert R. Coburn

Tag-Along Program Variables

One solution is to use a decision statement before t he string function to see if t he character string is long enough to fill the bounds set by the string function, but there is a better solution. In the above exa mple if three spaces are added to A$, then B$ is guaranteed to be three characters long, even if A$ hasn't been assigned anything yet and contains a null (a zero-length string). For example:

Spokane, WA

Here's a trick I have not seen in any magazine or book about

Commodore. The two bytes at $43 and $44 point to the start oi BASIC text. Start your program with a REM state ment and a chr$(34) to gain a block of reserved memory imbedded in the program. Add six to the pointer at $43 and it points to the first byte of the reserved block. The block of memory can be as much as 74 bytes depending on whether or not you allow the line to be listed. The chr$(34) following the REM token lets most values POKEd into the line to be displayed.

b$ = left$(a$ + • [3 spaces] ")

A similar method will work for RIGHT$ and MID$. simply add i ng spaces to the right or left of the character string, where needed. Keep in mind, too, that you can pad the string with characters other than spaces.

,

The value of this trick is that the block of memory rides along with the program when it is SAVEd. For those of us not enamoured by copy protection, it lets the user copy an installed program without having to worry about tag along files. I use it to store initial values that depend upon a user's con figu ration. Simple instructions to the user can guide him, or her, through placing the correct values in the line by using the Screen Ed itor and SAVEing the program under another name. Or, one can be more ambitious and have the program determine if it has been 'installed '. It can then ask the appropriate questions, POKE the right values, SAVE and RUN itself. This way, all previously set up parameters are there as soon as the program is LOADed no need to store them in separate files anywhere.

Finally, this solution also provides a handy formatting tool for the PRINT statement. C-64 BASIC has no PRINT USING com­ mand, such as is used on other computers to set up fixed l ength output fields, but you can achieve the same effect by printing strings of a fixed length using the above tech nique . Numerical data can be formatted by first converting to a string with the STR$ funct ion. The following are examples:

-

the Tl a n w e tol

print right$( · [4 spaces] " + c$,4) print· amount payable " ;right$( " print mid$(e$ + • (2 spaces] " ,2,1)

••••••

"

+

str$(amt),6)

.,..., 1916: \lolume 7, ...... 01


SYS address.A,X,Y.P

Rhetorical Loops

The following program is just a nine-digit counter which starts at zero and counts up. Big deal. But it uses nested FOR/NEXT loops to do it, and the variable names used are unconventional enough to turn the code into readable nonsense. Here's the program:

Any or all of the parameters can be left out. and they will default to what's in the memory locations indicated above. For example, you could code "SYS addr,20 " to set the accumulator to 20, or • SYS addr,, I • to set the carry flag (processor status= I ) before entering the routine.

1 rem · Programmable Prose by Chris Zamara and Nick Sullivan 2 mo = 9:ol = 9:in = 9:om = 9:od = 9:ps = 9:ro = 9:r = 9 3: 100 ford = automobile 1 1 0 fork = food tool 120 for a nice time = call antoinette 130 forty thieves = far too many 140 forsaken = stood up 150 forest = treetops 160 fort knox = hard to rob 170 formula = highly top secret 180 foreigner = visitor 1 90 : 300 print d;k;an;ty:sa;es;tk;mu;ei 310 next ei,mu.tk,es,sa,ty,an,k,d

Using your favorite Kernal routine from BASIC has never been simpler than on the 128! You can make your BASIC programs more efficient by making calls directly to ROM routines. This makes for awful, unportable code, but if you need more speed, a few strategic SYSes may do the trick.

Running ABasiC From

Robert Ca.se

The CLI On The Amiga

Springfield, OR

To run ABasiC from the CLI (instead of by clicking the ABasiC icon from WorkBench), you have to first increase the stack size to prevent a crash. From the CLI. enter: STACK 8000 RUNABASIC

The above program is fairly useless, but shows that if you really want to, BASIC will let you write strange-looking and difficult to understand code. It's the programmer's responsibility to use meaningful variable names and put spaces in the right place. On the other hand, perhaps "programmable prose" could be a new form of expression.

ABasiC will then come up on a screen of its own. To return to the CLI or WorkBench, first reduce the ABasiC window size and move the window to reveal the A BasiC template on the top line of the screen. You can then slide down the ABasiC screen or click it behind with the re-ordering gadgets to reveal the WorkBench screen and other open windows.

SYSing With The C-128 C-64 Auto-Start

The C-128, like the 64, allows you to pass values to a machine language routine through the A, X and Y registers, and also read the contents of these registers after the routine has finished. You can POKE the desired values into special RAM locations to initialize the registers, SYS to the routine, then PEEK the locations to find the values set by the ML routine. The locations are as follows: Location C64 C128 780 781 782 783

6 7 8

5

Steen Pederson Frederiks, Denmark

Here is a compact BASIC program which will turn any program into one which will automatically RUN when loaded. Just enter and run • Autostart 1 . 1 listed below, and it will ask for the name of the program to convert. It then asks for the name of the new, auto-start version of the program to put on disk. After a while (depending on the length of the program}, Autostart will finish, but leave the machine in a confused state. You'll have to reset the machine (turn OFF then ON} at this point. •

Register Accumulator .X register . Y register . P (Processor Status) register

The new file created on disk must be loaded in the following way: load · filename" ,8, 1

But wait! With the C-128 it's even easier than that. You can pass values of A, X, Y and P to a machine language program directly from the SYSstatement. To do this, just put the parame­ ters after the SYS like this:

Your program will then LOAD and automatically RUN. The STOP and RESTORE keys will be disabled, so your auto-start programs will be protected from being modified and re-saved to disk.

9

JWy 'IM6 : Volume 7, .._ 0 1


1 00 print· Enter name of program to be auto-started· CK 1 1 0 input· present name· ;f$ AO 120 print· Enter filename for new auto-boot program · KM 130 input" new name· ;n$ MH 140 poke 649,0: open 1 ,8,1, "0: • + n$ CO 150 print# 1 ,chr$(199);chr$(2); EC 160 for i = 1 to 61 FL 170 read v: pnnt#1,chr$(v);: next CD 180 for i 772 to 2048 OG 190 print#1 ,chr$(peek(i));: next NO 200 open 2.8.3.f$: get#2,g$,g$ Cl 210 for i = O to 1 AC 220 get#2,g$: if g$ = · · then g$ chr$(0) OH 230 i st: print# 1 g$;: next PK 240 close 1 : close 2 OG 250 : PE 260 data 169. 47. 133, 0. 1 69. 55, 133, 1 GO 270 data 169. 0, 133, 1 57. 32, 68, 229, 169 MJ 280 data 82, 14 1 , 1 19, 2, 1 69. 213, 1 4 1 , 120 JK 290 data 2. 169, 13, 1 4 1 , 1 2 1 . 2, 1 69. 3 IG 300 data 133, 198, 169. 1 3 1 . 1 4 1 , 2. 3, 169 EG 310 data 1 64, 141, 3. 3, 1 69. 52. 141, 20 GF 320 data 3. 169, 1 73, 141, 24, 3, 76, 1 1 6 CM 330 data 164, 139, 227, 199, 2

OJ KL OM BJ JL CH

BE

FN LG

120 data 57, 208, 130 data240. 47, 140 data 0, 24, 150 data 1 1 9 , 2, 160 data 2. 133, 170 data 0, 133, 180 data 169, 157, 190 data 198, 76,

54, 173, 1 4 1 , 2.201, 2 166,214, 32, 255. 233, 1 60 32, 10. 229. 169. 29, 141 169, 157, 1 4 1 , 120, 2, 1 69 198, 169, o. 133,212, 169 199, 1 69, 32, 141, 1 19, 2 141, 120. 2, 169. 2. 133 49, 234

=

Return of The Swords Of Doom

Arthur Wolf Wichita, KS

=

=

We rold you rhey'd

be back! This rime, rhanks to Mr. Wolfs

program, the Evil Swords appear as comets! Ooh, scary stuff, kids!

1 0 rem for frustrated comet gazers 1 5 rem here's this rendition of chris's 20 rem · Evil Swords of Doom · (6/4 p.9) 25 : 30 l$ =chr$(157) 35 poke 53280,0: nnlc�=> 53281,0 40 " BLUE] CYAN] 1$ + 1$ + 1$ + FP 45 b$ = " " MC 50 print chr$(142) OC 55 print " s " tab(rnd(1 )•41) LM 60 for i 1 to 19: prin t a$; FP 65 for d 1 to 15: next BE 70 next i: printb$;: goto55 EP JE KN Nl BP KG AB

=

The C-64 Great Escape

David Claussen Menomonee Falls, WI

=

Below is a short machine language program for the C-64 that creates the effect of an escape key. An escape key, which is normally found on IBM compatibles. is normally not available for Commodore owners. What an escape key does, simply put, is let the user "escape " from whatever he or she may be doing at the time.

=

Date Conventions

R.C. Eldridge Pemberton, BC

While programming in BASIC. what this function does is clear the screen line that the cursor is on and position the cursor at the first column. It also turns off quote mode, which allows normal use of the cursor and other control keys. And finally, it turns off reverse mode. The back-arrow key (located at the top left corner of the keyboard) becomes the escape key. If you wish to use the back­ arrow key in a program, hold down the Commodore-logo key while pressing back-arrow. FB FM HF FB GK GJ AM

There has always been confusion because of the U.S. conven­ tion of expressing the date in the order · month-day-year · and the rest of the world using day-month-year. Several years ago an international standards body recommended that every­ one use year-month-day and it is slowly catching on. If you use year-month-day as a date reference in one field of a data file, the computer will automatically sort references into the right chronological order. For logging purposes where precise time is important the number can be extended to year­ month-day-hour-minute.

1 0 rem • • escape key - press backarrow • • 20 for j 491 52 to 49227: read x: poke j,x : ck = ck + x: next 30 if ck<>8698 then print" data error" : stop 40 sys49152 =

The basic idea is useful in a two-day amateur radio contest log. If you use the form day-hour-minute for the time entry, the log can be re-sorted easily into chronological order after having sorted into callsigns or countries or whatever for analysis.

50 :

100 data 1 20. 169, 1 1 0 data 1 4 1 , 2 1 .

The Transoctor

13. 1 4 1 , 20, 3. 169, 192 3, 88, 96, 165, 197, 201

10

�19M: Volume 7, ._ 01


The Hidden Message

PM

Jim Butterfield, Toronto

EE There's an encrypted message in the Commodore 128. You ll never find it by inspecting memory. since it is definitely in code . . . and not an easy one to crack. '

NH JI AP

I'll tell you where it is located. It's i n bank 1 5 - that's ROM - at addresses 44644 to 44799. It's not easy to crack; since every one of the 156 characters has a different key · value, it's not a simple Caesar cipher. In fact, if the 156 keys were independent and random. the code would indeed be uncrackable. since no key is repeated. But each key is mathematical ly related to the previous one. and a cracker with time and ingenuity might perhaps - be able to break it. I'm about to give it away, so you might like to stop reading right now if you're a serious ciphe r so lver.

NP JC

"

ID PL CA OD LP EK

Dl LK GJ DN GJ

Secret code can often be found in software. Sometimes it's a personal signatu re by the author. Sometimes it's a secret proof of copyright. Sometimes it's an amusement. Here's a simple Basic p rogram to make the code readabl e.

CB CB

By the way, if you just want to read the message, I'll give you a quick method at the end of this article.

PE DO BA BG

Enter the following crude decoding program on your Commo­ dore 128. Use 40 column mode, because I'm POKE-ing to the

1010 rem commodore plus/4 version 1020 graph1c 1 : scnclr: graphic 0: rem make room for code 1 030 CS=O 1040 for j = 4096 to 4216: read x: poke j,x : ch = ch + x: next 1050 if ch<>13146 then print "checksum error" : stop 1060 print • sys 4096: rem to enable" 1070 print sys 4099: rem to disable· 1080 end 1090 data 76. 14. 16. 165. 2 1 1 . 1 4 1 , 2, 3 1 1 00 data 165. 212. 1 4 1 . 3. 3. 96. 1 73. 3 1 1 1 0 data 3. 201. 16. 240, 17. 133. 212. 1 73 •

1 1 20 data 2. 3, 133. 2 1 1 . 169. 39, 1 4 1 , 2 1 1 30 data 3. 169. 16. 1 4 1 , 3, 3. 96. 165 1 1 40 data 20. 133. 208. 162, o. 160, 0. 189 1 1 50 data o. 2 . 2 0 1 . 48, 144, 7,201 . 58 1 1 60 data 176, 3, 232, 208, 242, 189. 0. 2 1 1 70 data 240, 22, 2 0 1 . 32. 240, 15, 133, 21 o 1 1 80 data200, 1 52, 4 1 , 3. 1 33. 209, 32, 1 1 3 1 1 90 data 16, 1 98, 209, 16, 249. 232, 208, 229 1200 data 165, 208, 4 1 , 15, 24. 105. 1 93. 1 4 1 1 2 1 0 data 0. 12. 1 65. 208. 74. 74, 74, 74 1 . 12. 108. 2 1 1 1220 data 24. 105. 1 93. 1 4 1 , 1230 data 0, 165,210, 24, 1 0 1 . 208, 133, 208 1240 data 96

screen. Cl28 Verifizer (40 column mode)

1 00 bank 1 5 1 1 0 print chr$(147);chr$(14) 1 20 print: print: print 1 30 for j = 1 to 156

PK AK JK NH OG

140 x = xor(xor(peek(44643 + j),j),59) 150 m 192:if(x and m) = 0 or (x and m) = m then m = 0 160 1f (xor(x.m) and 32)>0 then m = xor(128,m) 170 poke 1023 + j,255 and xoru.m) 180 next 1 =

You'll sec t he message in crude

JP MP AG

scr

ee n format - formatting

characters such as RETURN will appear as control characters, but it's readable.

ID GF MG

just want to read the message. and don t care where it's stored or in the decoding process, there's an easier (and neater) way to see it on your 128 screen . Just type: If you

HE

'

LM JA

El KJ

sys 32800,123,45,6

DH JM KG

Verfizer For The' Plus 4 and C128

EF By next issue we'll have a Verifizer for the B Machines and for the Cl28 in 80 Column mode. They'll all appear up at the front with the other Verifizer programs.

CG

Plus 4 Verfizer

cc 80 PD

fNil

1 000 rem • data loader for

EC AC JA

verifizer + 4 • n

1 000 rem data loader for verifizer c 128 • 1010 rem • commodore c128 version 1020 rem use in 40 column mode only! •

*

1030 CS=O 1040 for j = 3072 to 3214 read x: poke j,x : ch = ch + x: next 1050 if ch<>17860 then print · checksum error· : stop 1060 print • sys 3072, 1 : rem to enable· 1070 pnnt • sys 3072,0: rem to d1sable • 1080 end 1090 data 208, 1 1 . 165. 253. 1 4 1 . 2. 3, 1 65 3 1 1 00 data 254, 1 4 1 , 3. 3, 96. 1 73, 3, 1 1 1 0 data 201, 12, 240. 1 7 , 133, 254, 1 73, 2 1 1 20 data 3, 133, 253, 169, 38. 1 4 1 , 2, 3 1 1 30 data 169, 12. 1 4 1 , 3. 3. 96, 165, 22 1 140 data 133, 250, 1 62, 0, 160, 0, 189, 0 1 1 50 data 2 , 2 0 1 , 48, 144, 7, 20 1 . 58. 1 7 6 1 1 60 data o. 2. 240 3. 232, 208. 242. 189. 1 1 70 data 22. 201. 32. 240. 15. 133. 252. 200 3. 133. 251 , 32. 135. 1 2 1 1 80 data 1 52. 4 1 . 1 1 90 data 1 98. 251. 16, 249, 232, 208. 229, 56 1200 data 32. 240. 255. 169, 19. 32. 210. 255 1210 data 169. 18, 32, 210. 255. 165, 250, 41 1220 data 15. 24. 105, 193, 32. 210, 255. 165 1230 data 250, 74. 74, 74, 74. 24, 105. 193 1240 data 32. 210. 255. 169. 146, 32. 21 o. 255 1250 data 24, 32. 240, 255, 108, 253, o. 165 1260 data 252. 24. 1 0 1 . 250, 133. 250. 96 JWy l986: 'llobne 7, � 01


1571's Can Be too Smart

Walter Kiceleff

C-128's Help Key Redefined

Buenos Aires, Argentina

We all know that the 1571 is the greatest thing since the return of the mini-skirt. But it tries so hard that it can confuse instead of help. For example. consider this sequence of events:

I really like your magazine and I would like to contribute by sending you this 'Curiosity' I discovered in my computer.

I ) LOAD in a short ( I block) program from the C 128 2) Remove the disk. put it into a 1541 and use a C-64 to replace the program with a different one 3) Put the disk back into the 1571 and LOAD· " , 8

In the Commodore 128, you can redefine the 'HELP' key to use it like a Function key. The HELP key has a memory assignment of only 5 bytes (4168-4172). If you Poke these locations with the Ascii value of the characters you want to use; Presto' It works. For example:

You would expect it to load in the new version of the program, right? Well, the 1571 still has the program in its RAM buffer. and thinks it can be smart and save time by giving you the copy from RAM instead of going out to disk. So. you get the original, un-modified program that doesn't even exist on the disk anymore. Proof that · A little knowledge is a dangerous thing · . Or. as Nietzsche put it, · Better know nothing than half-know many things· .

1 0 for i 4 1 68 to 4 1 72 20 read a$: poke i, asc(a$) 30 next i =

40 data p r i n t .

.

,

,

If you want to add a carriage return. poke 4172.13. Then your message with have 4 letters (not 5) plus a carriage return. Amiga Lattice C Notes

Robert Case Springfield, Oregon

Holy Input-Buffer, Batman!

While using the Amiga Lattice C Compile, version 3.02, I encountered two problems. A description of each problem follows:

· Robin. I think there is a diabolical plot brewing at Commo­ dore headquarters. ·

First Problem: scanf. . When scanfwas used in the following form, the program didn't halt and wait for keyboard input:

" I'm afraid it is. Are you familiar with the Input buffer in the Commodore 64? •

scan! ( • %f%c\n • , &first, &second);

· Well, Batman. from the Bat-Computer I've learned that BASIC program lines are stored in the input buffer after they're entered. "

.

.

" Say it isn't so, Bat man1 "

.

When the form was changed to:

· Right Robin! I believe that after the lines are stored. they are also tokenized in the buffer, are they not?·

scan! ( • %1 %c\n • &first. &second) •

The program would halt and wait for keyboard input. The addition of a space before each '% · corrected the problem.

· Gosh, Batman, you're so right! " " Very perceptive of you, Boy Wonder. Now I have but one more question for your keen mind: is the line number stored in the Input Buffer? ·

Second Problem: letters • E • and/or • e • . . . when these

letters were used as a key to ·exit· the program using 'scanf', their use was not recognized. When the letter • Q • was substituted for the letter • E " . the program worked as ex­ pected. Is it possible that the letter • E • is a reserved word in this version of C?

· This one I know! Just like the Bat-Buffer here in the Cave, the C-64 Input Buffer only stores the line itself, without the line number." · Excellent Robin! Now look at this Bat-Dump of the Commo­ dore 128 Input buffer right after a line has been entered. ·

Another point: it is often helpful while working from the CLI to have a larger STACK to prevent a system crash. I reset the stack to 8000 or even higher before programming and testing. (See

· Holy RAM-Chip! There's the line number at the start of the buffer, just as it was cnterd by the user, leading zeros, trailing spaces and all! In ASCII' What kind of a fiend would concoct such a scheme? ·

next Bit) Reading 8250-Formatted Disks with an 8050

· The world is full of forces we don't understand, Robin. Commodore is just one of them. They've done the same with the Plus 4 and C-16 as well! Just thank the good Lord that we have Bat-Dumps. Bat-Anthologies. and the minds to compre­ hend them.·

Since the 8250 uses both sides of a diskette, you can't use an 8050 to read any data on the opposite side. Fortunately. the 8250 only uses the other side when the first side gets full. To find out if any data has been placed on the opposite side, check the number of blocks free. If there's less than 2052 blocks free, you can read all the files on the disk with an 8050.

· Well said, Bat-Friend ' · 12

Jvty 1916: Volume 7, I ssue 01


Letters

A 1541 on four legs. It might catch on. I am pretty sure that 'hot'

Help: Une Scanner Required: Some

time ago, in 'some' com­ puter magazine, I saw an advertisement for what I believe might have been called a 'line copier' or 'line scanner' for PCs. It was supposed to be able to copy printed or typed text directly from paper and put it in the computer's memory and, presumably, onto disk as sequential files. Is such a device available for the Commo­ dore 64? William R. Carr R.R.*3, Box 233 Harrisburg, IL, USA 62946

I54I users all over will appreciate your advice. Thanks. About the C64 modem. The modem will work in the Cl28 mode but not the CP/M mode, at least not yet. The modem itself s i not at fault on this one. It'sjust that Commodore did not include a driver for the RS-232 portjust yet in their release version of CP/M Plus. Word's out, though, that a version s i available through Compu­ serve that supports RS-232 communications, and that within a few months Commodore will be releasing the same for general public consumption. About Compuserve and CPIM: apparently, Commo­ dore has included some extra software that re-configures your

About a year ago, The Transactor appeared at a computer show

Cl28 in Cl28 mode to act like a CP/M machine so you can

called the Computer Fair in the heart of Toronto. The booth next to

download the new CP/M and store it on a CP/M formatted

ours was displaying a product that really caught our eye. It was a

diskette. Just make sure that you are in Cl28 mode with an

line scanner called the Omni-Reader. It worked in a novel man­

appropriate terminal package when you phone in, and have a CPI

ner: the "eye" ofthe reader was mounted on a vertical/horizontal

M formatted disk handy.

slider assembly. A document would be placed underneath it and you would scan each line by hand with the slider. At a pretty good

A regular Commodore serial printer will work in all modes of the

pace, it would recognize about 6 or 8 different type fonts, and send

C-128. If you have an interface that hangs off the serial port to

out their character codes to an RS232 port. We were impressed. So,

some strange type ofprinter, chances are that it will work just fine.

in the true spirit of advancing with the times, Karl struck up a

But if your interface, whatever the type, connects to the cartridge

conversation with the sales rep, who promptly agreed to lend us

port, as with an IEEE interface, you can be pretty well assured that

one for a few days to try out.

the Cl28 won� like it.

Well, the people representing the Omni-Reader must have fallen

Take for example an IEEE interface that we all use at the maga­

off of the edge of the world because we never heard ofthem cigain.

zine. It has been dubbed the GUNK (Garvin 's Link). It s i a terrific

Too bad; an item like that deserves some terrific free press. My

true-to-life IEEE interface for the Commodore 64. Its true beauty lies

i letter/reply will generate some advice today is to hope that ths

in the fact that it doesn � do anything: no extra commands and no

response from our reading audience. If anyone reading knows of a

special tricks. Itjust supplies a really fast IEEE interface for your 64 without consuming memory. It does this by swapping itself into 1/2

line scanner for the Commodore 64, or for that matter any computer, please drop us or William a line. We would really

of the E ROM. The RAM underneath is left alone, assuming that

appreciate it.

one leads i hooked up correctly inside ofthe 64 to a resistor. But the CI28 is a totally seperate system and the GUNK is not compatible with Cl28 ROM.

Attention Hot 1541 Owners: Here's a bit of helpful

information However, the GL/NK will work on the Cl28 in 64 mode, as will

to help hot disk drive users to cool down.

most of the cartridge port cards for the 64. Be careful though - some have leads that are connected internally and the C128 PC board is

An easy and inexpensive way to prevent overheating of your 1541 disk drive is to buy four new pencils and cut them down to two and a quarter inches, measured from the end of the eraser. Bevel the cut ends slightly with a pencil sharpener. Place the bevelled ends into the recessed screw holes on the underside of the disk drive. This allows fresh air to get to the breathers located on the underside of the drive.

much different than the C64. The GL/NK, for instance, has a lead to the left lead of R44 on the 64; on the CI28 it goes to Pin 29 of the OS8502 chp. i This little trick was supplied to us by a gentleman we met recently while out in San Francisco. One last point: the GUNK works fine with both Viewtron and Quantum Link downloads. The Viewtron software loads and runs

I would also like to ask a question. If I get a C-128 will my C-64 modem be compatible with the C-128 in all modes? What about an interface for a printer? Duane Barry, Cambridge, Ontario

fine from the IEEE drives, but the Quantum software must be loaded from a I541 or compatible. But Quantum downloads to the IEEE work -just flip the GLINKswitch back to serial when it's done.

13

JWoi 1916: � 7, lllue OI


". . . but if you fool me twice then I'm indeed a fool.":

OPEN Command Channel

Thank you very much for publishing John Holttum's 'The Commo­

Ida

dore 128: Impressions and Observations' in Vol. 6, Issue 5. Like

tay

many C-64 owners I suspect, I felt wined and dined by Commo·

ldx

��'S08

dore's advance advertising for the new C-128. But I was mildly

]Sr

Sffba

suspicious because of their poor record with the Plus/4 and C-16,

Ida

"'$00

notably their failure to provide good documentation and program·

)Sr

Sffbd

;setnam

mer's support for those models, i.e. something akin to the 'Com­

jsr

SileO

;open

modore 64 Programmers Reference Guide'. Also, the C-1541 disk

)Sr

$kerr

;your kernal error routine

"'SO!

;setlfs

drive's SAVE@ and SCRATCH (yes Ma, there's a SCRATCH bug too) bugs are a perpetual pain in the you-know-what for (a) program·

OPEN Relative File:

mers during the process of writing code, and (b) for the prospects of

Ida

reliable database systems which involve scratching or replacing

tay

files on disk.

ldx . ]Sr

"'S08 Sffba

;setlfs

Thanks to Mr. Holttum and The Transactor, I no longer have any

Ida

"<nam

;lo address file name

problem deciding whether to purchase the C-128/1571 system.

Ida

"'>nam

;hi address file name

Actually, I decided that my next disk drive would have to be a dual

jsr

Sffbd

;setnam

drive and presumably the 1572 is essentially just two 1571's in the

]Sr

$ficO

;open

same case. But in any case, I will not be buying the C-128/1571/

)Sr

$kerr

;kernal error

I S72 until there are plenty of independent public reports that

jsr

Sderr

;disk error check routine

"'$02

Commodore has remedied the above mentioned problems. You can fool me once (the C-1541 ), but if you fool me twice them I'm

Pointer Routine

indeed a fool. John R. Menke, Chessoft Ltd., Mt. Vernon, IL

ldx

"'$Of

]Sr

Sffc9

;chkout channel I S

ldy

"SOO

;length of word to send

Nice to hearfrom you again John. There s i a rumour that new I57I ROMs are under construction that fix Saue@ as well as other bugs.

load

-

When it will be released and under what kind ofoffer we probably

Ida . ]Sr

won� know WI it's ready.

word,y

;load word

Sffd2

;output word to command channel ;end of word yet?

my

i releasing a Documentation seems to be coming. Commodore s technical reference through SAM's again, Abacus has the "Inter­

cpy

"'SOS

bne

load

nals" book and another on the way, andlim Butterfield's book will

]Sr

Sffcc

;clrchn

be updated too. word Relative FUe Accesa ln ML: Loved your excellent article on disk

.byte $50. SSe, SOl, SOO, SOl

The characters in WORD are:

access from machine code in Volume 6 Issue 5, and yes I would like to see more code on the use of relative files.

SSO = Ascii for the letter 'p' SSe = Ascii for channel "' + 96 (2 + 96)

So here's some stuff. The syntax in Basic for relative files is: OPEN the command channel OPEN 15,8,15 OPEN the relative file

OPEN 2,8,2, • O:filename

SOl

=

Ascii for lo byte record " (#J)

SOO

=

Ascii for hi byte record .. ("'0)

$0 I = Ascii for character "' (first char) •

Set the POINTER to the record with:

To access any record all you have to do is update the 3rd, 4th, and

PRINT"' IS.• P. + CHRS(channel"' + 96)+ CHRS(lo-rec"')

5th characters of WORD (lo/hi byte record"') before you call the

WRITE or READ the file with PRINT"'2, INPUT-"2, or GET"'2

input or output routines as in your article.

+ CHRS(hi-rec"')+ CHRS(character)

POINTER routine. To write or read the data use the appropriate

CLOSE the channels after use. It's easy and simple to use relative files. They are fun, fast and NOT One word of caution; if you write to the file, IMMEDIATELY after

computer memory robbers. Hope this info is of use.

writing the file, reset the pointer to the beginning of the file

John Houghton, Collingwood, Ontario

accessed with a recall to the set POINTER routine. This will stop any mess-up of files.

It's nice to heara kind word mixed with somegoodaduice. Thanks for all. I agree that a pretty large hole

Sorry I don't have PAL but I'm saving my pennies up to get it. In machine code the routines are similar to your article.

was

left in my article by

excluding relative file access. but I felt it hard to wn·te pure theory without including a ML relative file access demo that worked in a

�1916:�7. 111Je 01


Real programmers don't eat quiche. In fact real programmers don't

friendly way, ie. verbose. As you have shown, ML relative file i not code consuming. At the time I knew that the only code access s

know how to SPELL quiche. They live on Twinkies, Doritos, Coke

consuming part would be through trying to make it easily useable.

and Swechwan food.

Perhaps in a future issue /'II write up a good and friendly data base

orsomething that people can use and learn from. Might be worth a

Real programmers don't write in COBOL. COBOL is for wimpy

shot.

applications programmers.

In case it hasn � been noticed yet, I did encourage a little bit of bad

Real programmers' programs never work right the first time. But if

practice in my article with the file read/write technique employed.

you throw them on the machine they can be patched into working

With the PET, CBM, VIC and 64, code such as:

in 'only a few' 30-hour debugging sessions. Real programmers don't write in FORTRAN. FORTRAN is for pipe

ldx

"lfinp

)Sf

chkin

;set input device

)Sf

chrin

;get a character

stress freaks and crystallography weenies. Real programmers never work 9 to 5. If any real programmers are

pha

around at

ldx

"lfout

jsr

chkout

;set output device

it is because they were up all night.

Real programmers don't write in BASIC. Actually, no programmers

pia )Sf

9 AM

write in BASIC after the age of

;write the character

chrout

12.

Would have been acceptable, as stated in the article. Unfortu­

Real programmers don't write in PL/ I. PL/ I is for programmers

nately, with a machine such as the C128 a mess would have

who can't decide whether to write in COBOL or FORTRAN.

developed. You have to make sure that CLRCHN was performed before setting either the input or output channels. For the example

Real programmers don't play tennis, or any other sport that

above, the statement 'JSR CLRCHN' should be inserted before the

requires you to change clothes. Mountain climbing in OK, and real

'LDX "LF' for both input and output. Ths i is actually good practice

programmers wear their climbing boots to work in case a moun­

irregardless ofthe machine you are working on. A temporary lapse

tain should suddenly spring up in the middle of the machine room.

into bad form caused this unfortunate slip. Sorry about that. Real programmers don't document. Documentation is for simps who can't read the listings or the object code.

Real Programmers

.

.

: In light of my first letter, I thought I'd

.

better send you this. I found it after many hours of research (i.e. I

Real programmers don't write in PASCAL or BLISS or ADA or any

got lucky looking through some old files). At any rate, I would

of those PINKO computer science languages. Strong typing is for

really like to thank you for giving the ICLIG some free press.

people with weak memories.

Anyway, I have enclosed my subscription for The Transactor.

We do receive the odd piece of mail from time to time. Thanks for

Nasty trick on your part. Raising the price so we get a better

relaying that strange bit of tongue-in-cheek programming advice. My addition today to Mr. Hill's list is 'Real programmers do it in

discount. Gee, I wish I would have thought of that sooner.

their drives!'. A bit wierd but it seems to follow the pattern. Kent Tegels Manager: International Commodore Language Interest Group

Help Required: I am looking for people interested in helping me

18112 North I

type in the New Testament using a word processor. The processor I

Fremont, NE,

am presently using is SpeedScript, but another processor would be

68025

acceptable as long as the files are compatible, or could be con­

Real Programmers Don't Write Specs

verted for our use. I am using a Commodore

by Peter S. Hill

64, with a 1541

disk

drive.

NCA Corporation

After collecting, compiling and editing all the incoming data, I

As taken from 'The Special Character Set ' - September /, /983

would distribute the finished work to all the participants. If you are interested please call or write for assignments.

Real programmers don't write specs- users should consider them­ selves lucky to get any programs at all and like what they get. Real programmers don't comment their code. If it was hard to

J. Box 630

write, it should be hard to understand.

Morenci, Arizona

Randall

Bernard

85540 (602)865-3550 Real programmers don't write application programs; they program right down on the bare metal. Application programming is for

Wow! What a doozy ofa task. With a good database and indexing

feebs who can't do systems programming.

system though, it would be a terrific item. The ability to search the

15

JVr 1916: Volume 7, ..... 01


New Testament via di sk would be ideal for report references. Let us

I am primarily interested in graphics and animation. What little I

know when it's done.

have learned so far seems to indicate that machine language is the way to go. In pursuit of this I have been attempting to learn what I can about

ML but have been disappointed with what I have found.

The Drive Disaater: Re: Trans. Disk *10. A Frantic Wave-Off! I

It seems to me that your publication has much to offer towards this

tried 'Improved 1541 Head-Cleaning Program'. DISASTER! Drive

goal. . .

was 100% OK before using prg. Drive is now in shop for re­ . . . One small problem: When using 'Verifizer', the left character of

alignment!

the check signal hides in the upper left corner of the monitor. How

D.C. Kerrigan, Greenville, SC

do I move it about two spaces to the right?

The program as listed in the magazine, Volume 6 /ssue 05 page 6, i is perfect, as s the copy on disk *I0. Although we can assure you of i still in this and feel confident that the code was OK, your drive s

W.O. Ackerson, Wichita, Kansas As you have discovered, The Transactor lives for machine lan­

i intensive care. For ths we offer two possible explanations.

guage. However, there are a few good books on the market to teach you the basics through extremes oftalking to your computer

I) The Commodore dn·ues have an awful habit ofgetting stuck at

in its mother tongue. One book, which I can t say enough good i things about, s Jim Butterfield's Machine Language Book. Pul>­

times, causing them to no longer function properly for apparently i that even after powering down, the no reason. The real crunch s

lished by Bradey/Prentice-Hall, it's an educational dream front to

drive doesn ? return to normal. Often times this prompts people to

back. If you ever see it in a book store, do it the seruice of a quick

bring their drive in forservice. Unfortunately, this is often a waste of

look-over. You will probably be impressed.

time and money. A simple initialization of a diskette in the offending drive will cure the problem. This strange

occurence

can

About your Verifizer blues: there is a cure. Steve Walley, a reader in

be traced back to the drive 's head being pushed out to an extreme

Sunnymead

CA.

ran into the same problem that you did, and as i n of Verifizer that prints two sets of such sent us his modified verso

position in either direction. Once in that position there exists a chance that the head will get stuck. Once stuck nothing but a drive

Verifizerchecksums on the screen.

initialization or a little internal push on the mechanism will help.

6 Issue 06 on page 5.

Your drive may have been one of the unluckies that gets stuck in extreme positions.

See 'Double Verifizer' n i Volume

Sky Travel Support: I enjoyed the review of Sky Travel and would like to mention that I agree with your assessment of the

2) The 'Improved Head-Cleaning Program · article stated that the

program. What's more. I might just mention a couple of quick

program was not to be run twice in a row, as the quote to follow

utilities:

explains: A seasoned veteran amateur astronomer friend of mine was so "The NEW at the end of the program is not an attempt at program

delighted with Sky Travel, he dumped his color computer system

protection. it's there as drive protection. This direct method of

and purchased a Commodore 64. During December and January

stepping the head does not update location $24. Ifthe program was

we used the program to locate Halley's Comet (as well as several

immediately rerun, the dn·ve head could end up being stepped to

other objects) with surprising accuracy. As a rank amateur astrono­

track 35 or to bump up against the stop at track 0."

mer, (I barely know the correct end of a telescope to look in) I was able to locate the comet using hard copy from the program, a

As a test, I deleted line 460 of the program then ran it for the first

compass and binoculars. However, for those with sophisticated

time. Following that I immediately re-ran the program to see what

systems, the data generated for right ascention and declination

would happen. Around track 22 the drive mechanism started

seem to be right on the button (provided of course your location

making an awful noise and continued to do so through track 35.

and times are correct).

Following this, / loaded in the directory. The drive chattered a bit initially but did finally load the directory. There was no permanent

Several friends of mine who are also ham radio operators, are

damage to the drive. My drive is almost new and in perfect

experimenting with using the program for moon bounce. The

mechanical shape. A drive that has had a few miles on it might not

tracking feature and program's apparent accuracy make this a

have faired as well. If this was the case, I still feel that an

natural.

again. Although running the program twice in a row would have

I have also used the program with my children (and myself) to

been almost impossible as it was supplied on disk and listed in the

become a bit more familiar with the southern New Jersey skies

magazine, it could have been accomplished as Istated above. Your problem can probably be wrillen off to explanation If/. Just

(when the garbage in the air is not too bad).

initialization would force the drive's head back into reality once

It's a first rate package and one which ought to cost at least three or

remember, when in a bind, initial ize.

four times more than it does. . . an extraordinary buy for $29.95

-

especially given what you can do with it and the information it

Verifizer Update: After recently retiring from 21 years of design­

contains. . . and especially given how much is charged for many

ing 'Little Black Boxes' for Cesna Aircraft Co., I purchased a C-64.

poor packages.

16

.J4it 1M6: � 7, ..... 01


Commodore did us a favour putting that one out. . . hope people do take advantage of it. Peter R. Bent, West Deptford, NJ Frank Covitz reads The Transactor. Frank Covitz wrote Sky Travel.

Further to this, .OPT can be forced to perform multiple directives of output. For example: .OPT 08, P4 ; would output the Object to unit 8 and Print the source listing to unit "'4.

i smiling right about now. But only I am pretty sure that Frank s about the compliment. It seems that Sky Travel is often times pretty difficult to locate. Frank wrote the package but Commodore kind of di stributed it. At one point, right about the time that my review was published, Sky Travel was close to being li sted as missing in action. But a mxture i ofpublic pressure and common logic brought the Sky Travel bock from the dead into retail distribution once again. If for any reason anyone would like to get a copy ofSky Travel but can 1 find it anywhere, then either phone or write Commodore direct, or

To continue, you will notice a SYS700 at the start of all PAL source listings for the 64. This calls PAL so that whatever follows will be treated as assembler source code. For other assemblers, this is either omitted or substituted with whatever command starts up the assembly process. To set the origin that you would like your code to be assembled, you would use a statement such as this:

if that doesn 1 work, drop us a line. We'll make sure that your • =$COOO

request does not go unheard. Frank did too good of ajob to allow Sky Travel to fade away so easily.

LADS to PAL Conversion:

My recent subscription to The Transactor has gone far in rescuing this amateur from some sort of computer oblivion. Other mags are just fine and often very helpful but games and ads get in the way quite a lot. In The Transactor one finds a balanced, practically fat-free diet of pertinent, challenging and useful information. In short, I'm a very happy customer. Quite apart from this statement of unbridled joy, I found a state­ ment by Nick Sullivan on page 15 of my first issue (Vo1.6, Issue 03) indicating that his Transbasic practically requires the use of a PAL assembler. Mansfield's LADS/64 assem­ bler and find it very dependable and easy to use. I use a RAM-based version of Richard

The ··· represents the current program counter, so in effect you are telling the assembler that the program counter should equal $COOO. Some assemblers use .ORG but the "splat" is more com­ mon. .WORD and .BYTE

These pseudo-ops allow either bytes to be assigned to RAM, or space to be set aside for the same. Most assemblers use the same conventions but I have seen .OW (define word, I guess) and .DS (define storage?). .WORD 0,0 is Ok as is .BYTE 0,1,2,3,4,5,6,7,8 etc. They both allow RAM vectors to be set, or byte tables, or word tables. ASC allows strings to be placed

.

in memory such as:

.ASC " A STRING IN MEMORY"

Without experience with any other assembler, I find it difficult to decide whether it would be possible to translate Transbasic for assembly with the unit I use. Your advice would be helpful at this point. R.G. Tischer, Starkville, MS To best help out everyone trying to convert PAL format to their own

Other than these few quicky psuedo ops, you will find we rarely use any of others, such as .FILE to chain in other source files, .BAS to write Basic code within your assembly listing, and great scads more. For a more detailed synopsis of PAL commands, look in Karl's 'Complete Inner Space Anthology'. You will find that most RAM-based assemblers can take advantage of our source listings.

special brand of assembler, it might be best if I run down a few of the main PAL directives to be found in The Transactor. They are as follows:

.OPT

This pseudo-op is a directive of output (OutPuT). There are a number of ways to use it. For example: ;Outputs nothing. Just checks assembly to see if errors exist. .OPT 00 ;Outputs object to origin (memory). .OPT 08 ;Outputs object to device "'8 (ie. OPEN 8.8,1, • O:fi­ lename • before) .OPT P ;Outputs source listing to the default output device during assembly .OPT P4 ;Outputs source listing to device "'4 (ie. OPEN 4,4 executed before) .OPT N

TransBASIC, however, requires that modules be "merged" to­ gether. This is why they seem, at first glance, to have odd line number sequences. You'll notice that certain "areas" of each module are written in very specific line ranges. This is so they merge together with the same "areas" of other modules. If your assembler I ) uses the BASIC editor to create source code files, or 2) has a merge feature, you should have no problem after making the previously mentioned adjustments. Otherwise you may have to simulate the merging process. Don't forget, The TransBASIC Disk is now available and comes complete with the SYMASS assembler. For $9.95, TransBASIC becomes a totally self-contained utility. See our order card.

I ��------�D�---���·"��=·=��=���=·���111=••�=���


TransBASIC Installment #9

�i�){ �t•lli�Clll &arborough, Ont.

The TransBASIC Disk

TransBASIC Part 9

The TransBAS/C Disk contains all of the modules published so

This issue I want to do nothing more than present a few short modules that will bring this column into step with the new TransBASIC Disk.

far and it comes with its own assembler, SYMASS

3. f. Any

combination of modules can be linked into BASIC with only a

few simple steps. From start to finish s i usually no more than a

First orr (Program I ) is String Synthesis, which contains a handful of specialized functions for generating special strings. The most instructive of these from a module-creator's point of view is the BUILD$( function, which is a sort of glorified CHR$( that can take multiple PETSCH arguments, including ranges, to build special strings.

couple of minutes. . . even less once you get the hang of il. II comes with a handy reference forjust $9.95. See the order card at cen/er page.

TransBASIC Parts 1 to 8 Summary: Part 1: The concept of TransBASIC - a custom command

The ability of BUILD$( to handle multiple arguments means that we have to be careful in managing the memory used for intermediate results, since each argument can itself be a com­ plex expression with its own function calls, theoretically even including calls to BUILD$( itself. For this reason, BUILDS( uses the two routines PSHTEM and PULTEM. which together take care of saving and restoring the temporary memory registers T2 through T6 whenever a new argument is evaluated.

utifily /hal allows one to choose from a library only /hose commands that are necessary for a particular task. Part 2: The structure ofa TransBASIC module - each TransBA­ StC module follows a formal designed /o make them simple /o create and "mergeabfe .. with other modules. Part 3: ROM routines used by TransBASIC - many modules mal�e use of ROM routines buried inside /he Commodore Part

64.

This might be a good time to mention a couple of things that distinguish statements from functions with respect to zero page storage. One is that the locations $ 1 4 and S I S are used by statements only, never by functions, so you can expect data store in those locations to survive expression evaluations intact, no matter how complex the expression may be. The POKE statement, for example, stores the POKE address at $14/ 1 5 before evaluating the POKE value. Just remember never to use $ 1 4 / 1 5 for storage when writ ing functions of your own, or you'll end up clobbering some innocent statement that calls your function.

3 explains how to use these routines when crealing new

modules.

Part 4: Using Numeric Expressions - details on how lo make use of the evalua/e expression ROM routine. Part 5: Assembler Compatibility - TransBASIC modules are wrillen in PAL Assembler formal. Techniques for porling /hem to another assembler were discussed here. Part 6: The US£ Command - The command 'A DD' merges TransBASIC modules into lex/ space. Howeuer, as more mod­

Another point is that both statements and functions have access to the TransBASIC storage area T2 through T6. If you use this area and then evaluate an expression, do not expect the registers to be unchanged. Either push t he values onto the stack with the PSHTEM routine, or one like it, or create a storage area within your own program code.

ules are ADDed. merging gets stow. The US£ command was wrilten /o speed things up. US£ also counts the number of statements and functions USEd and updates the lotals (source fine 95) automatically. Part 7 - Usually TransBASIC modules don � need lo worry about interfering with one anolher. When two or more modules

The Delay module (Program 2) contains a single statement, DELAY, which hangs the computer for a specified number of hundredths of seconds. One thing you might want to adopt for your own programs is the check for the STOP key (JSR SA82C), which will break automatically to direct mode if the key is down.

want lo offer the same syslem vee/or, howeuer, a polenliaf crash situation exists. Part 7 deals wilh avoiding ths i problem. Part 8 - Describes the five modules for Pari 8.

II

.,.,., '1986: .....,._ 7, laue 01


displacement. If the third argument is not present it is taken to be one. The second argument may be given as a number from e s· , •w· ; 0 to 3; as a string beginning with one of n or as a string beginning with one of u " "r d ' I " . The strings may be in either upper or lower case.

The Slide module (Program 3) contains the statement SLIDE, which lets you move a sprite by specifying a displacement (relative) rather than a destination (absolute). SLIDE will wait until the raster scan is off the current location of the sprite before allowing it to move: in most cases this eliminates the shearing effect that arises when the raster catches a sprite in motion. Another interesting thing about SLIDE is that you can specify the direction of movement either as an integer or as a string. The routine that interprets the input might be useful in other commands as well.

MAKE (Type:

· ,

• •

· ,

• •

Statement Cat *: 048)

Line Range: 4106-4142 Module: MAKE Example: MAKE 22, " TRANSBASIC" + CHA$(13) The string argument is printed the specified number of times (up to 255) from the current cursor position.

The Make module (Program 4) contains the statement MAKE, which prints a specified number of repetitions of a string. You can use this to produce patterns and borders, and strings requiring repetitive cursor movement.

CENTRE (Type: Statement Cat "': 049)

Line Range: 41 44-4192 Module: CENTRE Example: CENTRE ' A PAINTED SHIP UPON A PAINTED

The Centre module (Program 5) contains the statement CEN­ TRE, which prints a specified string of up to 40 characters centred on the monitor screen. The handy thing about this command is that it ignores control characters in the string (RVS and colour control characters, for example) when deciding how far to indent the string.

OCEAN "

The string is centred on the current screen line. Control characters are ignored in calculating the offset from the margin. Strings longer than 40 characters (not counting control charac­ ters) generate a STRING TOO LONG error.

FILE (Type: Statement Cat "': 050)

Finally, the Vocab Manager module (Program 6) contains two statements and two functions that will help in vocabulary searching applications like adventure games. The FILE state­ ment, which is similar in structure to DATA, reads in alphanu­ meric strings and stores them under the BASIC ROM. With the SCAN( function, you can find the position of a particular string within the vocabulary.

Line Range: 41 94-4272 Module: VOCAB MANAGER Example: FILE ' SWORD,MACE.SPEAR,POISON-TIPPED BANANA

The strings separated by commas are stored under the BASIC ROM starting at $AOOI (40961). A pointer (FLPTR) points to the next free byte. Only alphanumerics are stored. Upper case alphabetics are converted to lower case. A vocabulary built by FILE statements can be searched with the SCAN( function (053). The only quote allowed in a FILE statement is the one that precedes the string data; also, no other statement may follow the FILE statement on the same line.

When Vocab Manager is combined with other modules like lnline (in TransBASIC "'8), First & BF$ ("'7), and Strip & Clean ("'4), many applications that depend on input parsing become much simpler to program. Not only that, but the strings stored in the vocabulary are unknown to BASIC itself, and will not create garbage collection problems.

INITFP (Type: Statement Cat *:

051)

Line Range: 4274-4306 Module: VOCAB MANAGER Example: INITFP Example: INITFP 43257 The FILE statement pointer is initialized. If no parameter is present the pointer is initialized to address 40961. If a parame­ ter between 40961 ($A00 1 ) and 49151 ($BFFF) is present the pointer is initialized to that address. The second form of the INITFP statement would normally be used only when a pre­ pared vocabulary is loaded from disk, instead of being gener­ ated from FILE statements within a program. In this case the FILE statement pointer would have to be initialized to the value determined with the FPLOC function (052) after the vocabulary was first generated.

New Commands DELAY (Type: Statement Cat *: 026)

Line Range: 3180-3214 Module: DELAY Example: IF A = B THEN DELAY 100: PAINT " WHAT? " Execution is suspended for the specified number of hundredths of seconds (0 to 65535). The timing is not accurate for very small values. SUDE (Type: Statement Cat "' : 043)

Line Range: 3830-3928 Module: SLIDE Example: FOR I = 1 TO 30: SLIDE 0 , " E " : NEXT Example: SLIDE 3,2,84 Example: Dl$ = U ' : SLIDE 7,DI$,2 This command takes two arguments plus an optional third. The first is the sprite number (0-7). the second the direction in which it is to be displaced, and the third is the amount of

FPLOC (Type: Function Cat *: 052)

Line Range: 4308-431 4 Module: VOCAB MANAGER Example: PRINT FPLOC-40961 A quasi-variable returning the current value of the FILE statement pointer (4096 1 to 49151 ).

19

JWy 1916 : Volume 7, ..... 01


SCAN (Type: Function Cat 11: 053)

num 2910 023 OE 9 rem flnum$ rvs BK 1 0 rem flrvs$( 2928 024 build MO 1 1 rem !/build$( 2986 025 12 : AI EN 13 rem u/pshtem (3100/060) KP 14 rem u/pultem (31 34/061) HP 15 rem u/kpftop (31 56/062) El 16: PD 1 7 rem Gl 1 8 : LC 603 .asc" alph " :.byte$a4:.asc " ucalph • : . byte$a4:. asc " num " :. byte$a4 CF 604 .asc • rvs$ • :.byte$a8:.asc" build$ · :.byte$a8 KK 1603 .word alph-1 ,ucalph-1 ,num-1 MB 1604 .word rvs-1,build-1 :range of upper 08 2894 ucalph Ida # · A · ; case alphabet ldx # • Z EE 2896 HH 2898 bne num1 KM 2900 ; Ida # · a · DG 2902 alph :range of lower ldx # • z • MM 2904 : case alphabet PH 2906 bne num1 CN 2908 ; ;range of digits Ida # • 0 • 18 2910 num ldx # • 9 • OL 2912 CM 2914 num1 sta t3 Ida #0 PE 2916 EM 2918 sta t2 OK 2920 Ida #$80 sta t4 MM 2922 bne bu2 AH 2924 EO 2926 ; AJ 2928 rvs ;eval expr, chk ')' JSr $aef4 :create descriptor PK 2930 JSr $b6a3 ;save length CD 2932 rv1 sta $61 stx t5 ;save pointer KK 2934 sty t6 : to string AH 2936 :allocate memory jsr $b47d EG 2938 ;test string null KE 2940 tay EH 2942 beq rv3 ; yes dey ;index to last char CM 2944 Ida #0 ;index to 1st chart IM 2946 MB 2948 sta t2 ;lower index save ;upper index save PL 2950 rv2 sty t3 ;get upper char Ida (t5),y FB 2952 ;set it aside GK 2954 pha ;get lower index HB 2956 ldy t2 Ida (t5),y :get lower char FC 2958 :set it aside tax LP 2960 ;re-get upper char pia GK 2962 sta ($62),y ;store as lower PA 2964 txa NN 2966 ;re-get lower char ; and upper index OF 2968 ldy t3 :store as upper NC 2970 sta ($62),y :when len(str) 1 OH 2972 beq rv3 HN 2974 InC t2 ;bump lower index ;back upper index dey AO 2976 ;test indices cross HO 2978 cpy t2 bcs rv2 ; not yet GD 2980 ;return str descr PG 2982 rv3 jmp $b4ca 08 2984 ; HK 2986 build ldy #0 ;clear temp storage sty t2 KG 2988 sty t4 AH 2990 jsr pshtem ;push 12- t6 DL 2992 bu1 JSr kpf1 ;eval byte to .x CG 2994

Line Range: 4316-4468 Module: VOCAB MANAGER Example: IF SCAN(AN$)<83 GOTO 770 The vocabulary compiled by the FILE statement is searched for an entry matching the argument string. Only alphanumerics are used in the comparison, and upper case alphabetic charac­ ters are converted to lower case. The number of the first matching vocabulary entry is returned, counting from one. Zero is returned if the search is unsuccessful.

• • • • • • : ; == = = = = = = • = • • • • • • • • • • • • • •

ALPH$ (Type: Function Cat": 021)

Line Range: 2894-2900 Module: STRING SYNTHESIS Example: PRINT LEFT$(ALPH$, 13) A quasi-variable that returns a string consisting of the lower case alphabet. UCALPH$ (Type:

Function Cat 11: 022)

Line Range: 2902-2908 Module: STRING SYNTHESIS Example: PRINT ALPH$ + UCALPH$ A quasi-variable that returns a string consisting of the upper case alphabet. NUM$ (Type: Function Cat ": 023)

Line Range: 291 0-2926 Module: STRING SYNTHESIS Example: A = AWAIT(NUM$) A quasi-variable that returns a string consisting of the digits from 0 to 9. RVS$ (Type: Fu nction Cat *:

024)

Line Range: 2928-2984 Module: STRING SYNTHESIS Example: PRINT RVS$( " RUMPELSTILTSKIN " ) Returns the argument string in reverse order (in this NIKSTLITSLEPMUR " ).

case,

BUILD$ (Type: Function Cat 111: 025)

Line Range: 2986-3098 Module: STRING SYNTHESIS Example: A$= BUILD$(36,48;57,32,65;70) Returns a string specified by its ASCII components. Individual values may be specified, as well as ranges. In the latter case the low and high ends of the range are separated by a semicolon. The string ' $0123456789 ABCDEF • is returned by the exam­ ple.

=

Program 1 : STRING SYNTHESIS

OE FH MH HH

CF JH NJ

Ml CB

0 rem string synthesis (aug 29/84) : 1 : 2 rem 0 statements, 5 functions 3: 4 rem keyword characters: 28 5: routine line ser # 6 rem keyword alph 2894 021 7 rem flalph$ 2902 022 ucalph 8 rem flucalph$ 20

J4it 1916: � '· .... o1

I


OK

GA KK HH EL

LA MJ

EA

LJ

AM IB

ML

HN BK CA EJ MO

LM

DO Ll BN NE PC HE OP

LH

FH FE PO

LO OJ

FJ KC NN

MJ JL

NJ OF FO OG EC LO FD

OM EO

JG

KP DA KF HP OK AJ EA IC

LH

NO

MK EP NM HC IK FO EH KG

AL OM

I

2996 299S 3000 3002 3004 3006 300S 3010 3012 3014 3016 301S 3020 bu2 3022 3024 3026 302S 3030 3032 3034 3036 303S 3040 3042 3044 3046 304S 30SO 30S2 30S4 30S6 bu3 30SS 3060 3062 3064 3066 306S bee 3070 bu4 3072 3074 3076 307S 30SO 30S2 30S4 buS 3086 bu6 3088 3090 3092 3094 bu7 3096 buS 3098 ; 31 oo pshtem 3102 3104 3106 3108 3110 3112 3 1 1 4 pht1 3116 3118 3120 3122 phl2 3124 3126

1he1Ni tot

stx $67 jsr pultem ldx $67 stx 13 jsr $79 cmp H · ; • bne bu2 jsr pshtem jsr kpftop SIX $67 )Sf pultem ldx $67 txa sec sbc t3 bee bu7 adc HO bcs buS pha adc 12 bcs buS sta 12 pia SIX 13 $b47d jsr SIX $22 sty $23 ldx 13 sta 13 ldy H$H txa 1ny cpy t3 beq bu4 sta ($62),y dex bu3 bit 14 bmi bu6 jsr $79 cmp # · , • bne buS jsr $73 bne bu1 jsr $aef7 Ida 12 ldx $62 ldy $63 jmp rv1 jmp $b248 jmp $aS71 .

Ida jsr pia sta pia sta ldx Ida pha dex bpi Ida pha Ida

#3 $a3fb $7 1 $72 #4 t2,x

pht1 $72

; and save ;pull 12 - 16 ;retrieve byte ; and save ;test range char

EL GC CL PB

; no ;push 12-16 ;eval byte to .x ; and save ;pull 12-16 ;retrieve byte ;test upper bound ; > = lower bound

CB DO FN GG IC Fl PK IM AO HN EN

LA

KM

; no ;test rangesize 2S6 ; yes ;push rangesize ;test result > 2SS ; yes ;save result so far ; pull rangesize ;save upper bound + 1 ;reserve str space ;create pointer to ; string data ;get upper bound + 1 ;save string size ;init index to str ;char to store ;bump index ;test = string size ; yes ;store character ;next char down ;branch always ;test alph$ etc ; yes ;test more to build

10 IN

OA IM

oc

MO PC EF AO

312S 3130 3132; 3134 pultem 3136 313S 3140 3142 3144 plt1 3146 314S 3 1 SO 31S2 31S4 ; 31S6 kpftop 31SS kpf1 3160 3162 3164 3166 316S 3170 3172 3174 3176 317S;

pha rts pia sta pia sta ldx pia sta 1nx bmi bpi s j r Ida pha Ida pha jsr pia sta pia sta rts

$71 $72 #$fb

;save return addr

; pull 12 to t6

$7,x plt1 pht2

;retrieve rts addr

$73 $33

;skip separator ; push fretop ptr

$34 $b79e $34

;eval byte to .x ; pull fretop ptr

$33

Program 2 : DELAY HK FH

AI

HH FO

JH

NJ

JO MH HD OH DH

; no ;skip comma ;branch always ;check close paren ;create descriptor

IG KB

cc

OK

MC NG

PF DO AG FN

;reverse the string ;'illegal quantity' ;'string too long'

IC

;check 6 stack ; bytes free ;save return addr

MG PG

FN OA PG IG

;push t6 to 12

KK EA

;retrieve rts addr

$71 21

. 0 rem delay (aug 2S/S4) 1 : 2 rem 1 statement. 0 functions 3: 4 rem keyword characters: S S: line routine 6 rem keyword 7 rem delay dela 31SO S: •

ser H 026

9 rem • • • • • • • • • • • • • • • • • • • • • • • • • • • :z: . : : • 10: 106 .asc · delaY· 1 1 06 .word dela-1 31SO dela jsr ;eval num expr $adSa 31S2 ;conv to int at $14 jsr $b7f7 31S4 de1 ldy #$0e ;count 1/100 sec ldx #$8S 31S6 de2 3188 de3 dex 3190 bne de3 3192 dey 3194 bne de2 $a82c ;check stop key 3196 jsr ldx $1 4 3198 ;decrement counter 3200 bne de4 ldy $1S 3202 3204 ;countdown complete beq deS 3206 dec $1S 3208de4 dec $ 1 4 3210 ;not done yet jmp de1 3212 deS rts 321 4 ;

Program 3: SLIDE 0 rem slide (aug 2S/84) 1 :

. .

� 1986: Yl*lrne 7, 111ue 01

I


AI

HH FO JH

NJ

JL MH

DP

CM GL KN Bl MC NO El

PO

Gl Dl GJ PB JO

oc HL OF EE AN JD FO FG IF JB EB FN GF

co

FJ GO HF MJ MO LL

PA

NN OH Nl NN EC KC EO KH ON JF

81

NP DO PB GE JD AB

cc

HF CB HO lA

I

KE NA EE FG AC EG MB

2 rem 1 statement, 0 functions 3: 4 rem keyword characters: 5 5: 6 rem keyword routine serll line slid 3830 043 7 rem slslide 8: 9 rem u/chkspr (3664/037) 1 0 rem u/raschk (3676/038) 1 1 rem u/direct (3930/044) 1 2 rem d/powers (3694/039) 13 : 1 4 rem this module also contains one 1 5 rem line from set sprites -- 3624 16: 1 7 rem 18 : 1 1 0 .asc ·slidE· 1 1 1 0 .word slid-1 3624 xs3 jmp $b248 ;'illegal quantity' 3664 chkspr JSr $73 ;skip byte 3666 chs1 ;evaI expr to . x JSr $b79e 3668 ;test valid sprite cpx 118 bes xs3 · no 3670 rts 3672 3674 ; 3676 raschk pha 3678 ras1 Ida $d012 ;get raster pos'n 3680 sbc $d001,x ;test above sprite 3682 bee ras2 ; yes 3684 cmp #$2b ;test below sprite 3686 ; no bee rasl 3688 ras2 pia 3690 rts 3692 ; 3694 powers .byte 1 ,2,4,8,1 6,32,64,128 3696 ; 3830 slid JSr chs1 ;eval sprite II 3832 SIX $14 ;save 3834 ;check for comma JSr $aefd 3836 ;get direction JSr direct 3838 pha ;push direction Ida $14 3840 ;push sprite II pha 3842 3844 Ida #1 ;save default 3846 sta 13 ; displacement 3848 jsr $79 ;test for comma 3850 cmp # • . • 3852 bne sl1 ; no 3854 JSr $b79b ;eval displacement 3856 stx 13 ; and store 3858 sl1 pia ;pull sprite # 3860 tay ;mask index . y ;position index .x 3862 asI 3864 tax 3866 pia ;pull direction 3868 jsr raschk ;wait for raster 3870 bne sl2 :direction not up 3872 Ida $d001,x ;subtract disp sbc 13 3874 ; from y-pos'n sta $d001,x 3876 3878 rts 3880sl2 cmp#2 ;test dir down bne sl3 3882 · no

lhe Tica tor

• • • • • • = = = == = • • • • • • == = == =

==

OJ

NN CF CH IH LH GF OB GO NG NG Cl El JF LK OM LO

••••••

JA

DD OB LK

KE IC EF

MP

KJ MD CB ED

co NG JE FD Ml EH KC LF NF CH BE AA

CD

EA

3884 3886 3888 3890 3892 3894 sl3 3896 3898 3900 3902 3904 3906 3908 sl4 3910 3912 39 14 391 6 sl5 3918 3920 3922 3924 3926 sl6 3928 ; 3930 direct 3932 3934 3936 3938 3940 3942 3944 3946 di1 3948 3950 3952 3954 3956 3958 di2 3960 3962 3964 3966 di3 3968 di4 3970 3972 3974 3976 di5 3978 ; 3980 dirs 3982 :

clc ;add disp Ida $d001,x ; to y-pos'n adc 13 sta $d001 ,X rts ;test dir right cmp#1 bne sl5 ; no Ida $dOOO,x ;add disp clc ; to y-pos'n adc 13 sta $dOOO, x ;don't cross seam bee sl6 Ida $d010 ;togglemsb eor powers,y ; of x-pos'n sta $d010 rts Ida $dOOO,x ;subtract disp ; from x-pos'n sec sbe 13 sta $dOOO, x bee sl4 ;cross seam rts JSr bit bmi JSr cpx

$ad9e $0d di1 $b7a1 #4 bcs di5 txa rts jsr $b6a6 tay beq di3 ldy #0 Ida ($22),y ldy #$Of cmp dirs,y beq di4 dey bpi di2 jmp $af08 tya lsr lsr rts jmp $b248

;eval direction ;test expr type ; string ;eval numeric to .x ;test< 4 ; no ;return dir in .a ;create descriptor ;test length zero ; yes ;get first char ;test valid dir ; yes

;'syntax' ;reduce to numeric

; 'illegal quantity'

.asc • UuNnRrEeDdSsLIWw • Program 4: MAKE

AM

FH AI HH EO JH NJ 10 MH HD OH

u

. .

0 rem make (aug 25/84) 1 :

2 rem 1 statement, 0 functions 3: 4 rem keyword characters: 4

5:

6 rem keyword 7 rem make 8: 9 rem 10

routine mak

line 4106

ser II 048

= c • • • • • • = = = ==== • • • • • • • = : ====• • • •

.Air 1916: \o\:llurne 7, .... 01

I


Ll CF FD

oc Kl

CA

MM 8A HJ FC AH ON PI FD OE AE DG AL JF ON EK

1 1 1 .asc • makE • 1 1 1 1 .word mak-1 4106 mak jsr $b79e txa 4108 4110 pha 4112 jsr $aefd 4114 jsr $ad9e 4116 jsr $b6a3 4118 tay 4120 pia sta t3 4122 4124 tya 4126 mak1 ldx t3 4128 beq mak2 4130 dec t3 4132 pha 4134 jsr $ab24 4136 pia jmp mak1 4138 4140 mak2 rts 4142 ;

� ;eval ll repetitions ;push ;check for comma ;eval string ;make descriptor ;string length ; pull II repetitions ;countdown register

CL FH JH HH CE JH NJ KM IE JL JD

;get remaining reps ;all done ;countdown ;print string

PH OH

PE CN NN El PO Gl ON

PO

IL MP

P8

NF HJ MG PK MA AA Cl JJ OM HM KD PO FK PM NK MC OJ

C8 KM KJ IJ OP DP 8L PF

I

.. 0 rem centre (sept 4/84) 1 : 2 rem 1 statement, 0 functions 3: 4 rem keyword characters: 6 5: ser II line routine 6 rem keyword 4144 049 7 rem centre cntr 8: 9 rem 10 : 1 1 2 .asc ·centrE • 1 1 1 2 .word cntr-1 4144 cntr ;eval string jsr $ad9e 4146 ;make descriptor jsr $b6a3 4148 tay ;index from str end 4150 ;push string length pha 4152 ldx 110 ;II printable chars ;back up index 4154 ce1 dey 4156 cpy ll$ff ;test done ; yes 4158 beq ce2 4160 Ida ($22),y ;get a character 4162 and 11$7f ;clear high bit :test ctrl char 4164 cmp 11$20 4166 ; yes bee ce1 4168 inx ;bump counter 4170 bne ce1 ;branch always 4172 ce2 txa ;test counter < = 40 sec 4174 4176 sbe 11$29 bes ce4 4178 ; no 4180 ;negate and halve eor 11$ff 4182 ; result lsr ;test logical line ldx $d3 4183 ; 40 or 80 4184 cpx 11$28 4185 bee ce3 · 40 4186 adc 11$27 ;add 40 (carry set) ;set cursor horiz 4187 ce3 sta $d3 4188 ;pull string length pia 4189 jmp $ab24 ;print string

wc o d or lM 'lla

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

jmp $a571

Program 6: VOCAB MANAGER

Program 5: CENTRE

FD FH AI HH GO JH NJ KG MH HO OH

4 1 90 ce4 4192;

08

PF EC HC OK LK FM

08

FJ Cl GK AH ON

:. = = = = = = =

00 ON HM NH AM AE LM

HK co

KP NL OH NC CD FM IJ

01

DO OM AP GP HE GE MF NE GH

23

. 0 rem vocab manager (aug 29/84) 1 : 2 rem 2 statements. 2 functions 3: 4 rem keyword characters: 20 5: 6 rem keyword ser II line routine 7 rem s/file til 4194 050 4274 051 8 rem slinitfp infptr tplo 4308 052 9 rem f/fploc scan 4316 053 1 0 rem f/scan( 11 : 1 2 rem u/cifchr (2560/003) 13 rem u/usfp (2620/006) 14 rem u/cifnum (4092/047) 15 rem dlflptr (4470/054) 16: 17 rem 18: 1 1 3 .asc • fiiEinitfP 610 .asc • fploCscan • :.byte$a8 1 1 1 3 .word fil-1 ,infptr-1 1610 .word fplo-1 .scan-1 cmp ll$5b 2560 cifchr ;test alphabetic 2562 ; and if so return bee cic1 2564 clc ; carry set 2566 bee cic2 cmp 11$41 2568 cic1 2570 cic2 rts 257 2 ; ;convert .a/.y ldx 110 2620 usfp 2622 stx $0d ; to floating point 2624 sta $62 ; from unsigned 2626 sty $63 ; 16-bit integer 2628 ldx 11$90 2630 sec 2632 jmp $bc49 2634 ; 4092 cifnum cmp # " : • ;test numeric bee cin1 4094 : and if so return : carry set clc 4096 4098 bee cin2 4100cin1 cmp # · o · 4102 cin2 rts 4104 ; ;test leading quote 4194 til cmp 11$22 4196 · no bne fi4 4198 ldy flptr ;make pointer to 4200 Ida flptr + 1 ; first free byte 4202 sty $22 4204 sta $23 4206 fi1 ;set up index ldy 110 4208 ;get a character jsr $73 ;numerics ok 4210 bee fi2 ;test end of line 4212 cmpiiO 4214 beq fi3 ; yes 4216 cmp 11$22 ;test embedded qte beq fi4 4218 ; yes 4220 cmp II · , · ;test end of word .

• • • • • • • • • • • • • • • • • • • • • • • • • • • • • •c.

J!#t 1916: 'WUne 7, ..... 01

I


OE MN OB FO

MB AK HH JF

GB GP FF ON PC HL EP AF MP ED FC MM Ml AH LA NF IL LE GC LO

01

CL OJ JK GN PK IK OA

OF co

MF HO HM LM ML IE GO FJ OF AF NH GL HC EE FO CG PJ GG MJ HC EE IN NA LE AI OL

I

4222 4224 4226 4228 fi2 4230 4232 4234 4236 4237 4238 4240 4242 4244 fi3 4246 424S 4250 4252 4254 4256 425S 4260 4262 4264 4266 426S 4270 fi4 4272 ; 4274 infptr 4276 4278 42SO 42S2 42S4 42S6 42SS 4290 ifp1 4292 ifp2 4294 4296 ifp3 429S 4300 ifp4 4302 4304 4306 ; 430S fplo 4310 4312 43 1 4 ; 4316 scan 431S 4320 4322 4324 4326 432S 4330 4332 4334 4336 433S 4340 4342 4344 4346

Thelka � lur

beq fi3 JSr cifchr bee fi1 tax sta ($22),y InC $22 bne fi1 inc $23 Ida $23 cmp l#$c0 bne fi1 jmp $a435 pha dey dec $23 txa ora 1#$SO sta ($22),y inc $23 pia cmp I# ' , ' beq fi1 ldy $22 Ida $23 bne ifp4 jmp $afOS

; yes ;test alphabetic · no ' ;save byte ;store to buffer ;bump pointer

beq ifp2 jsr $adSa jsr $b7f7 cmp #$a0 bee ifp1 beq ifp3 cmp l#$c0 bee ifp4 jmp $b24S ldy 1#1 Ida ll$a0 cpy 110 beq ifp1 sty flptr sta flptr + 1 rts

;no param ;eval param ;convert to integer ;test > = $a000 ; no ; = is special case ;test < $c000 ; yes ; 'illegal quantity' ;default in it ; to $a001 ;test = $a000 ; yes ;init flptr

ldy flptr Ida flptr + 1 jmp usfp

;get flptr value

jsr JSr sta sta txa pha tya pha Ida jsr SIX sty pia sta pia sta

$aef4 $b6a3 13 t4

AA

LB NO MC Jl GG DB BP IL HB AI OG FN KO MP NN BD AO FN KC NC PN OH JP

;test end of buffer ; ($c000) ; no ;'out of memory' ;push new byte ;point to previous ; byte in buffer ;get old byte ;set high bit ;store to buffer ;fix pointer ;pull new byte ;test comma ; yes ;store new pointer ; value to flptr ;branch always ;'syntax error'

OJ

EC IH BH FB MP GM HF HL NA EE PL LF DB FM JG OP JG OP FA

DO

GG JP

;return as fl. pt.

01

JF

;eval str. test ) ;get descriptor ;store length

cc EJ

00

;push data address

FE 01

13

;reserve memory

$23

;make ptr to ; reserved space ;make ptr to ; argument data

$b47d $24 $25

AL MJ GA IB BC OF KO PA

00

$22 24

434S 4350 4352 4354 sca1 4356 sca2 435S 4360 4362 4364 4366 436S 4370 4372 4374 sca3 4376 437S 43SOsca4 43S2 43S4 43S6 43SS 4390 4392 4394 4396 sca5 439S 4400 4402 sca6 4404 4406 4408 4410 4412 sea? 4414 4416 441S 4420 seaS 4422 4424 4426 4428 4430 4432 4434 sca9 4436 443S 4440 sca10 4442 4444 4446 4448 4450 4452 sca1 1 4454 4456 sca12 445S 4460 bmp62 4462 4464 4466 b62 446S ; 4470 flptr 4472 ;

dec ldy ldx dec iny cpy beq Ida JSr bcs and jsr bee sta jsr bne

1 l#$ff 1#0 14

;switch out basic

13

SIX

15

;test end of word ; yes ;get arg byte ;test numeric ; yes ;conv cap to lower ;test alphabetic ; yes ;add to new string ;bump new str ptr ;branch always ;reset word counter

sca4 ($22),y cifnum sca3 1#$7f cifchr sca1 ($62,x) bmp62 sca2

SIX 16 bit 14 bmi sca11 Ida #1 sta $62 Ida #$a0 sta $63 inc 15 bne sca6 . InC 16 Ida $63 cmp flptr + 1 bne sea? Ida $62 cmp flptr txa

tay bcs sca12 dey 1ny Ida ($62),y cpy t4 beq sca9 cmp ($24),y beq seaS bne sca10 sbc ($24),y cmp I#$SO beq sca1 1 Ida ($62,x) php jsr bmp62 pip bpi sca1 0 bmi seaS ldy t5 Ida t6 inc 1 jmp $b391 inc $62 bne b62 inc $63 rts .word $a001

;init spare index ;deer arg byte cntr

;test srch str null ; yes ;in it vocab pointer ; to $a001

;bump word counter

;set carry if vocab ; pointer at end ; of buffer

;.x = .y = 0 ;end of buffer ;set up pre-incr ;bump pointer ;get vocab byte ;test last arg byte ; yes ;test arg = vocab ; yes ; no ;test last vocab ; byte ; yes ;advance vocab ; pointer to ; end of word + 1

;try next word ;get word counter ;switch in basic ;return as fl. pt. ;bump ptr at $62/63 ;return z clear

; ptr to file bufr

�19t6:�7. .... 01

I


Longer Life For Your 64 and 1541

Robert V. Davis Salina, KS

With the price of Commodore 64 computers at one-fourth what it was

compound. This is not for the faint of heart. Keep paper towels handy to

when the machines first hit the market, the temptation to replace an older 64 with one of the later models is strong. But for those of us willing to break out the screwdriver and soldering iron. there are some minor improve­ ments possible to prolong the life of our computers and disk drives. Note that all the following instructions will invalidate your warranty, if any, and anyone who is not comfortable with the idea of digging into electronic equipment should go to the next article.

clean up any heatsink grease other than that on the proper surfaces.

Finally, a foot or so of 5/16 inch wooden dowel rod cut into two to three inch lengths with four matching rubber feet can be (with some sanding) forced into the holes on the bottom of the 1541 where the screws holding the top of the case reside. (Ends of pencils work great for ths' i -Ed.) These legs will raise the drive and allow improved ai r circulation through it. prolonging the life of the electronic internals.

The first modification to the Commodore 64 is to improve its video quality . . . this only applies to those of us who have the earlier model C-64s with a five pin video output jack. The addition of some of the luminance signal to the composite colour video will usually sharpen the picture noticeably on a colour monitor Note Figure I . the illustration of the t op centre of the C-64

There you have some ways of keeping your system in good health at a

minimum of expense. Good luck I Parts list:

(Radio Shack Part numbes r listed)

main printed circuit board.

•271-1312 . . 276- I 363 Heatsink •276- I 372 Heatsink grease 5/ I 6 wooden dowel rod (4 two-inch lengths) 5/16 inch rubber feet for ends of dowel I 50 ohm I I4 watt resistor

Between the five pin video connector and the aluminum box containing

the TV modulator will be a resistor (usually 470 ohms). As shown in Figure I. this resistor will connect the solder pad labelled number two to the

ground at the edge of the board, passing over 'point I · Using a small

soldering iron (25 Watts), undo the ground end of the resistor. Then solder

a

(Four brand new pencils, cut to the proper length, may be used to replace t he dowels and rubber feet)

I 50-ohm quarter-watt resistor to point one. Attach the other end of that

I 50-ohm resistor to the still-connected end of the original resistor at point two. Then, probably using additional wire, re-attach the other end of the

4 70-ohm resistor to the ground, all the while avoiding solder bridges. bare wires touching each other, and so on.

.... c

By the way, if you are using a monochrome video monitor on your C-64, a

better display results from taking the luminance output instead of the normal video output containing colour information to your video display. You will have to move a wire in the five-pin DIN connector from pin four

2

Q c ....

"tt c:: ....

to pin one. Again, both of these hints are appropriate to those older C-64s which have a five-pin video connect or.

TOP

CE"TER

COHHODOR£

64

Some C-64s came from the factory without a heat sink attached to the five volt regulator chip which is mounted next to the joystick ports. That

:I c � c:: ,... ,.,

regulator supplies power to the video circuitry and runs rather hot. The addition of a heat sink, along with heat transfer compound will really help the regulator do its job. Look next to the joystick ports on the right side of the board for a small device on three legs soldered close to the corner of the

video and system shield box.

Figure

If a flat black slotted hunk of metal about one

1

inch square is bolted or riveted to the regulator, you are OK. If not, the regulator will be sticking up with a hole through its top just begging you to help it cool down. The parts list suggests a possible heat sink which will probably require some bending before it will properly fit. A couple of ways to keep your I 54 I (or 2031 LP) disk drive cooler are in

0

order now. The hard work involves taking the drive completely apart and

adding heat sink grease to help transfer heat from the big black heat sink at the back of the drive to the frame of the unit. I have found this helpful in both old and new 1541 drives, to help get the heat from the drive and twelve volt regulators spread around inside the unit, instead of concen­ trated near the 6502 and 6522 chips.

Q w Q ..J w ....

X (/)

RIOHT SID£ COI'Uft)DORE

64

Note again, you will have to remove the plastic top of the drive, the RF

shield on top of the main PC board. and then remove the PC board itself to get to the part of the heatsink where you can apply the heat transfer

Figure 2 25

� 1986: Volume7, ._ 01


Matrix Manipulator

Richard Richmond Springfield, Ohio

Machine language program to set one array equal to another.

Because operations in BASIC must be handled through the

tions on the names that you can use, except for the normal

interpreter. some tasks can be very slow. For example, the

BASIC restrictions.

following BASIC line can take a very long time: for i = 1 to n:a(n) = b(n): next

n

How The Program Works

Many operating systems for larger computers have machine

For those interested in ASSEMBLY programming, the com­

language (ML) routines that allow matrices or arrays (arrays are

mented listing in Program I should be useful. The listing is

just one-dimension matrices) to be manipulated like non­

compatible with the lEA Assembler, but can be easily adapted

dimensioned variables. In such a system, the above example

to other Assemblers. In general, the following tasks are per­

be written like A

= B. For large, multi-dimensional

formed; ROM routines are used to find the location and length

arrays, or for repetitive operations, the time saved with such a

of the string in the calling SYS command. The two array names

utility could be very significant.

are then separated and the appropriate type designator is

could

added. In BASIC, all arrays are stored in a

block of memory.

The starting address of this block is stored in locations $30,$21. What The Program Does

This address is loaded and the array memory area is scanned to find the starting address of the first array passed from BASIC.

To perform the operation in the above example, use SYS 5 1 800

Some juggling of the array names then takes place so that the

• A,B • with the array names in quotes (to avoid conflicts with

same portion of code can

other ML utilities that start at 49152, this program is moved up

second name.

be used to find the address for the

to just below where the BASIC wedge would be loaded). Any properly dimensioned arrays may be used. The only restric­

The length of the second array (actually the offset to the

tions are that both arrays must be of the same type and

beginning of the next array in the storage area) is then found.

dimensioned the same size. The utility will not check for this,

The second array is then stored byte by byte in the first array.

only that both names are in the array table. Unlike BASIC, the

This simple byte for byte operation is why the routine is able to

subroutine will not automatically dimension an array. Instead,

handle any type of variable. It is also the reason that the

an error message is printed and the program halts if both arrays

programmer must use similar arrays. If the first array was

have not been dimensioned.

shorter the the second, the program would write past the end of the first array with possibly fatal results!

As stated earlier, any type of array can be used and the subroutine does recognize the difference between types. For

Typing It In

example, A,A% and A$ would be treated as different arrays just like in BASIC. When the subroutine returns to BASIC, each element of the first array will be the same as the corresponding

Program 2 is a M L loader program for the routine. As usual, first

element in the second array. The second array will not be

type it in and save it. With a disk in your drive, run the

affected. Note, the order in which the arrays are dimensioned is

program. When the program is finished, you will have a file on

not important, only that the arrays are dimensioned before

your disk; • MATRIXML • . To use the routine type LOAD •

calling the routine. Also just to avoid possible confusion, I have

MATRIXML" ,8, I and (RETURN). Then type NEW,(RETURN)

been using A and B as my examples but there are no restric-

and load your BASIC program.

26

JAi'f '19t6: ......,. 7, ..... 01


Matrix Manipulator BASIC Loader

To illustrate the speed of this routine type in and run the following program:

1 1 0 print · beginning basic loop·

BG

120 t 1 = ti

Gl

1 3 0 for i = 0 to 1 OOO:b(i) = d(i):next

IH

1 4 0 t2 = t i

CF

150 print · end of basic loop

30 hi= int(51 800/256):1o = 5 1 800-hi • 256 40 open 1 .8. 1 , • O:matrixml "

KO

50 print#1 ,chr$(1o)chr$(hi); 60 for i = 51800 to 52203

HH

1 00 dim b(1 OOO),d(1 000)

OK OF

GA BE

HF EF

NC FB

PO

AA

160 print· beginning ml loop

JJ

1 7 0 t3 = ti

BP AL

1 8 0 sys51800 " b.d"

EA AE AL

190 t4 = ti

OJ

DE PJ

200 print · end of ml loop

KL

220 print· ml = • ;t4-t3: · jiffies

GA

230 stop

2 1 0 print · basic =

AL LJ LB BH LO GK Nl FC JO DA PA OB OF

• ;t2-t1 ; ·jiffies

This program just sets D equal to C. The actual values i n the array are of no interest in this case because we are only interested in the relative speeds of the two methods. On my machine, BASIC takes 425 jiffies and

ML only 22. That means

that the

ML routine is 20 times faster than BASIC. II the arrays are changed to integer (C%,0%) the times are 429 and 9. making ML almost 50 times faster! Different size arrays would

IC

LD KD MG

yield different time savings. For all but the very shortest arrays, the ML routine should provide a significantly faster operation.

DG

BL IL LF

Future Additions At present, I am working to expand this routine into an entire

10

matrix operations package. Some of the other operations that I

Fl

am working on include:

OK JF

OP

I . Initialize the array - set the entire array equal to a user defined value.

2. Four function math operations - add, subtract, multiply or divide an array by a variable or by another array.

3. Find maximum or minimum values of an array.

where large arrays of data must be worked with. These addi­ tional operations will included in a single program and be reached through different entry points.

100 data

76, 1 1 7, 202, 128,

1 1 0 data 82, 120 data 32,

82,

65.

44, 144, 214, 65 89, 32, 78, 79, 84

68,

73,

77,

130 data

78,

69,

68,

79,

69,

78, 83, 73 0, 32. 1 5 8 , 1 7 3

140 data 32, 1 63, 1 82, 134, 251 , 1 32, 252, 1 70 150 data 160, 0, 140, 1 73, 2, 140, 1 7 1 , 2 2, 200, 202, 1 7 7 160 data 177, 251, 1 4 1 , 1 72, 170 data251 , 20 1 , 47, 1 44, 6 , 1 4 1 , 173, 2 180 data 190 data 200 data 210 data 220 data

76, 1 4 1 , 202, 201 . 44, 240, 37, 208, 1 4 1 , 1 72. 1 41 , 1 73,

20, 201

8, 1 73, 172, 2, 9, 128 2, 1 73. 1 73, 2, 9, 1 28 2, 200.202, 177. 251 , 201

47, 144, 248, 1 4 1 . 170,

2. 200, 202

230data240, 32, 177,251.201, 47. 144, 6 240 data 1 4 1 , 1 7 1 , 2, 76, 1 90 . 202, 201, 37 250data208, 260data 170,

8, 173, 1 70, 2, 173, 1 7 1 ,

270 data 1 7 1 , 2, 160, 280 data 9 1 , 202, 136, 290 data 3, 1 53, 139,

2, 2,

9, 128, 1 4 1 9, 128, 141 3, 185, 139, 0, 1 53 16, 247, 169, 0, 160 0, 136, 208, 250, 141

300 data 1 67, 2. 165, 48, 133, 252, 165, 47 310 data 133, 251, 160, 2, 177.251, 133, 253 320data200. 177,251, 133, 254, 160, 0, 1 7 7 330 data 251, 205, 172, 2, 208, 8, 200, 1 7 7 2, 240, 62, 165, 252 340 data 2 5 1 , 205, 173, 350data

24, 1 01 , 254, 1 33, 252, 165,251,

360data 1 01 , 253, 133, 251 , 1 44, 370 data 165,

50. 197, 252, 208,

24 2, 230, 252 6, 165, 49

2, 203, 162 380 data 197, 251, 240, 3, 76, 390data 95. 1 60, 202, 134,251, 132, 252, 160 400 data 0. 1 77 , 2 5 1 , 240, 7, 32,210, 255 4 1 0 data 200. 76, 73, 203, 32, 226. 203, 162 420 data 26. 430 data 2. 440 data 205, 450data 1 4 1 , 460 data 2.

GN PC OF IP

490 data 2, 133, 1 4 1 , 160, 3, 177, 1 4 1 , 133 500 data 252, 136, 177, 1 4 1 , 133, 251, 165, 142 510 data 24, 1 0 1 , 252, 133,254 , 165, 1 4 1 . 24 520 data 1 0 1 , 251 , 133, 253, 208, 2, 230, 254 530 data 169, 4, 1 01 , 1 41 , 1 33, 1 4 1 , 208, 2 540 data 230, 142, 169, 4, 1 0 1 , 139, 133, 139

10

JC

AA

PB CB DH

GL IN

27

80 next 90 close 1

AC FL NG FN EP MM

00

Such a package would be useful in graphics or other programs

70 read da:print# 1 ,chr$(da);

76, 55, 165, 252, 167, 2, 172, 2,

164, 165.251 , 1 4 1 , 168 2. 169, 1 4 1 , 169, 1 240, 28, 173, 1 70, 2 173, 1 7 1 , 2. 1 41 , 1 73

173, 169,

2, 133, 140, 173, 168

470 data 2, 133, 139, 238, 167, 2, 76,250 480 data 202, 173, 169, 2, 133, 142, 173, 168

550 data 208, 2, 230, 1 40, 1 60, 0. 1 77, 1 4 1 560data 145, 1 39, 230, 1 4 1 . 208, 2, 230, 142 570 data 230, 139, 208, 2. 230, 140, 166, 1 4 1 580 data 228, 253, 208, 234, 166, 142, 228, 254 590 data 208, 228, 160, 3, 185, 9 1 , 202, 136 600 data 16, 250, 96, 0

JW'( 1916: � 7,

laue

01


Matrix Manipulator Source Code 100 ;ml routone to set a b 1 1 0 ;where a.b are arrays 120 ;wrotten by •

130 ;riChard rrchmond 140 ;308 rosewood ave

150 ;sprrngloeld. ohro 45506 160 ;(513)322-7650 • 1 70 $ca58 lBO Jmp start .

190zpage

200. 210 two 220 one 230 chrout 240word 250 260 270 Star! 260

290 300 31 0

320 330 340

350 360 first

370 380 390ab 400 410 420 430 440 450 460 470 skip 460

• • • • • •

;sys51BOO

•+4 $02aa $02ac $ffd2 •

asc array no1 domensioned • byte o • :use rom rout1ne •

rsr

tsr

St<

$ad9e Sb6a3 $fb $fc

Sly lax ldy Sly Sly

one+$01 IW0+$01

Ida

($fb),y

sla •

1$00

one •

:lo get Slnng

:address :length

.torsi character

lny

de< Ida sta

(Sfb).y one +$01 bee skip SIS

:2nd char

one+$01

tmP ab •

760

790 800

ony

dex Ida ($fb),y cmp n21 bee second sta two -

beq done

Ida

($fb).y cmp M$2f

bee ac sla tW0+$01

.check lor ;siring end

-

I

The TI O'IICICtor

1140 dO 1 150 1 1 60

=

ldy

Ida

sta ony Ida sta ldy

:check for

.alpharlum

.inihal cntr

.offset lo

1550 :branch 10 error roulone 1 560 : of end of array srorage

1570 d3 1580

Jmp dO 1590 .JITIP back and check ne<l array

1600ou1

;begiMIIlQ of error rou1111e

1610 ,pnnt e<ror message 1620 ld< W>word : ldy #,word 1630 Sl.< $fb 1640 Sly Sfc ldy 1$00 1650 1660 error Ida (Sfb) y 1670 1660 beq return 1690 .rom roulone chroul rsr 1700 iny 1710 jmp error 1 720 return JSr 1730 reset ;restore zpage ld< ISla 1740 1 750 :e<�llhrough ,np Sa437 1 760 rom routone 10 pun! error 1770b3 1780: slore address of fusl array 1 790 . in argument 1800 Ida $fb sta 1 810 $02a8 1820 Ida $fc 1 830 sta $02a9 • 1840 b4 Ida �$01 1850 ;check cmp $02a7 1860 ;poonter 1870 . Jmp lo b5 2nd lome 1860 . lhrough loop 1890 beq b5 1900 !tansle< second argument 191 0 . address 10 1 Sl storage 1920 Ida IWO s1a one 1930 1940 Ida IW0+$01 1950 Sta one +$01 1960 . transfer address of forsl 1970 . argumen110 zero page 1960 a! sec.$8b Ida $02a9 1990 •

=

2010 2020 2030

sac

$02a8 $8b one $02a7 2040 ;1nerement pointer and 2050. branch back to lind address 2060 of second argument 2070 f'l'IP done! • 2080 b5 2090 ;address of second argument 2100 . stored at $6e.$Bd 2110 . length of arrays stored 2120 . at Slc.Sib 2130 only second array length 2140 : used both arrays mus1 have 2150 : drmensooned the same soze 2160 Ida $02a9 2170 sta SSe 2180 Ida $02aB 2190 sta S8d 2200 ldy 1$03 2210 Ida (SBd).y 2220 sta Sfc 2230 dey 2240 Ida ($Bd).y 2250 s1a $fb 2260 Ida $Be de 2270 2260 :endong address of second 2290 : array s1ored al 2300 : Sfe.Sfd 2310 sta $fe 2320 Ida $8d 2330 de Ida

sta

1$02 (Sib).y Sfd

sta

(Sib).y 1200 :offset ho Sfe 1210 noo 1220 :load 1st charac!er of array 1230 : and compare wrlh 1 sl of 1 240 argt.menl Ida (Sib).y 1 250 12 60 cmp one 1270 bne d2 12BO ony 1290 Ida ($1b).y 1300 cmp one+$01 ;,npwhen 1 31 0 beq b3 1320 :array found 1 330 d2 1340 Ida $fc etc 1350 1360 ,add hi byle offsel to address 1 370 adc Sfe 1360 Sta Sic 1390 Ida Sib 1400 etc 14t0 :add to byle oHset lo address 1 420 ade $fd 1430 sta $fb 1440 bee d4 1450 one Sic 1460d4 1470 :check �end of array 1480 :srorage has been reached Ida $32 1490 1500 cmp Sic 1510 bne d3 1520 Ida $31 1530 cmp Sib 1540 beq OUI

JITIP sec2 • • 8t0ac 820 cmp N$25 bne ad 830 Ida IWO 840 ora 1$60 850 860 IWO sta • 870ad 860 Ida two+$01 ora n8o 890 900 s1a IW0+$01 910 done 920 ;done wolh names. now save part 930 ;of zero page 8b-8e ldy 1$03 940 950szpage • 960 Ida $008b,y 970 sta zpage.y 9BO dey 990 bpi szpage 1000 Ida 1$00 1010 ldy 1$03 1020 clear 1 030 sra $008b,y •

=

ony de•

bne clear sta $02a7

: 1 sl array

2000

dey

1080 .store address of begrnning 1090 ;of array storage 1n fc.lb 1 100 Ida $30 Sta 1 1 10 Sic 1120 Ida $21 1130 sta $1b

1 170 1 160 1 1 90

670 680 690 700 71 0 720sec2 730 740 750 760 770

a.b"

:comma beq second 490 :check for 'S.%' 111 1as1 charac!er 500 :name bl! 7 set on bolh bytes 11 510 ;array IS omeger 520 ;bit 7 on 2nd byle sel if 530 ;array is srrrng 540 beq second cmp M$25 550 560 blne skip! Ida one 570 ora 1$60 560 590 s1a one • 600 skopl 6 10 Ida one+$01 620 ora 1$60 630 sra one+$01 640second • 650 :repeat for second argument 660

1040 1050 1060 1070 donet

2340

adc $fb

2350 2360

sta

Sid bne b7 one Sfe

2370 23BO b7 2390 ; skop 4 bytes 2400 ; thrs skops past the name and 2410 ; oNset bytes in array storage t$04 2420 Ida 2430 adc S8d 2440 sla S8d bne b6 2450 1nc SBe 2460 2470 b6 2460 Ida .t$04 2490 adc S8b s1a $8b 2500 2510 bne b9 one $Be 2520 2530 b9 2540 ; now ready to begin ltansferorlg 2550 data hom 2nd array 10 1 st 2560 ldy 1$00 : 2570 b13 2560 ;load data byte by byte 2590 Ida ($8d).y 2600 ;store on 1st array 2 610 sta ($8b).y 2620 . 1ncremen1 po•nter - 2nd •

2630

one

S8d

2640 brle b10 2650 one $Be 2660 b10 2670 ; incremenl poinler - 1 Sl 2680 inc $8b 2690 bne btl 2700 one $8c 2710 b t l 2720 compare potnler wr!h end 2730 ; end ol 2nd array 2740 ld< $8d 2750 cpx $fd bne b13 2760 2770 ld< $Be 2760 cpx Sfe 90 brle b13 27 2800 rese1 2810 . when lonoshed. res1ore 2820 ; zero page memory and •oturn 2830 ; 1o basoc 2840 ldy 1$03 2850 res1orez 2860 Ida zpage.y 2870 dey 2860 bpi res!orel 2890 rts 2900 end =

=

21

Jlily 1986: Vollrne 7, ._ 01

I


Jim Butterfield's Complete CI28 Memory Map A lew issues back we published an abridged Cl28 RAM/ROM map as prepared by Jim Butterfield. At the time we were quite pleased to have the privilege of publication. Although the maps were not in any way complete. they were good enough to start many hungry programmers on their way with the Cl28. Alter many months of careful and very well calculated pestering on our part, Jim has finally consented to allow us to publish his yet unreleased CJ28 Map. This opportunity comes as a form of prelude to Jim's yet unreleased new version of, "Machine Language For The Commodore 64 And Other Commodore Computers". Jim has carefully re-written it to include the C128, and as is usual with Jim's books, articles. videos. 1V shows. etc etc., etc., his Machine Language book takes the reader by the hand and gently Ioree leeds knowledge without any painful infliction. .•

Jim's new book is expected to be released in April of 1986, published by Bradey, a division of Simon and Shuster. As with his last Machine Language book, this version will be available most everywhere through many of the major book stores. II after this incredible bit of JB propaganda you remain unmoved, let me assure you that I am not being paid lor this. except lor a bottle of Steam beer he bought me in San Francisco(lor which I

All Banko:

Hex

0000

Otnmal Oescnption

0002 -0004

2-4

5-9

1/0 directional regiSier 110 pori. simolar 10C64 SYS address. MLM regrSlers (SR. PCI SYS, MLM register save (A. X, Y. SR/SP)

OOOA OOOB

I()

Sc:an-qu01es flag

II

TAB column save

12

O=LOAD. I =VERIFY Input buller IX>inler/number of sull>crit>h Default DIM flag Type· fF= Siring: 00 =numeric Type. 80= integer: 00� floallng pou11 DATA scan/USTquote/memory flag Subscrrp!lfNx flag

0005 -0009

oooc 0000

I

I :1

OOOE

OOOF 0010

0011 0012 0013 0014 0015 0016 -0017 0018 0019 -00'.!3 0024 -0027

0028 -002C 0020 -002£ 002F-0030 0031 -()(1:12 0033 ()()34 0035 -00:16 0037 -0038 0039 -003A 0038 -003(' .

003D-003F.

003F -OCHO

0041 -0012

0013 -0014 0015 -0016

14 15 16 17 18 19

0 .!

21

22-23 24 2�35 36-39 40-44 45-46

47-48 49-50 51-52

53-54 55-56 57-58 59-00 61-62 63-64

65-66

67-68

69-70

0047 -0018 0049 -004A

71-72

OOIB -004C

7�76 77-78

0010 -I Xf I f.

OO�F

0050 -0055 0056 -005� IKJ59 -0062 ()06:!

0064 -0067 0068 0069 006A �J(>F 0070 0071 0072 -0073

007 •1 -0075

COMMODORE 128 Memory Maps

Jl.m Butterfield

These maps apply to the machine when used in the 128K mode. When used in the 64 mode, the machine's map is identical to that of the Corn modorc 64. Architecture: "Bank numbers" as used in Basic BANK and the MLM addressing scheme are misleading; in fact. they are more correctly "configuration numbers". Bank 0 shows RAM level 0, which contains work areas and the user's Basic program. Bank I also shows RAM. this time (lor addresses above hexadecimal 0400) level I which contains variables, arrays, and strings. Other "banks" are really configurations, with various types of ROM or 110 overlaying RAM. Thus, bank IS (the most popular) is ROM and 1/0 covering RAM bank 0. Bank 14, however, is ROM and the character generator overlaying RAM bank 0. Architecture is set so that addresses below $0400 reference bank 0 only. Other bank switching (more complex than the simplified 16-bank concept) is accom­ plished via storing a mask to address $FFOO, or calling up pre-stored masks by writing to $FFOI-FF04

The Commodore C 128 Memory Map as of February 1986 0

0001

paid him back promptly). II ever you get the chance, have a read. . . you will not be disappointed. - RTE

7�74 79

O• I"PUT.l40 GET.598• READ ATN Slg n /Compansonevaluarron flag =

Current I/O prompl flag Integer •alue Poonler temporary Slnng Slack Slack for tempo<ary Slnngs Ulrhty pornter area Product area lor mullrpll(atron Poiruer: start-oi-BASIC (for bank 0) Pointer: sta�-of-variahles(bank I) Pointer: srart-ol-arrays Pointer. end-of-arrays Pointer string-storage (moving down� Ulilily string pointer Pornter limir-ol-memory(bank I) Curren! BASIC line number Textpoinrer: BASIC �-ork point Utrhly Poonter Curren! DATA lrne number Curren! DATA address lnpul •«101 Cunem vanable name Current vanablt" address V•nable pointer for fOR/NF.JIT Y-save. op-save. BASIC poinrer '"''•

Comparison .symbol accumulator 110-85 Miscellaneou; work area. pointers. and >0 on

86-86 Jump ve<:lor lor funcrions 89-98 Miscellaneous numeric work area

9 9

Ac:cum" l: exponent

I 00-103 Accum'l· manrisS<r 104 Acrum" I sign Serres t\'aluation constant poiruer lOS

1116-1 11 A<tUm'2: exponenr. and so on 112 S1gn rompanson. Arc'I \·ersus '2

In

A<tUm'l lo-order(rounding) 1 11-1 15 Cass<lre bu!fer len/Seriespoonter 1 16-117 Aulo lrne nunm.,r rncrernenl

the nan.oc tot

0076 118 Graphics nag 0077 Color sou� nunm.,r 119 0078 -0079 120-121 Temporary coume" 007A -007C 122-124 oss desnip�or 007D-007E 12�126 BASIC pseudcrstack poinler Flag: 0=dirl'<1 mode 007F 127 0080 -0081 128-129 DOS. USING work flags 0082 Slack poiIller S<rve lor crro" 130 131 Graphic rolor source 0083

132 133

008<1

0085 0086

0087

-008A

0088 -008f 0090 0091 0092 0093 009·1

0095

0096

0097

0098 0099

()()91\ 0098 -009C 009D 009£ -009F OOAO -OOA2 OOAJ -OOAB

IIOAC-OOAD

OOAE-OOAF fXlllO -008I

0082-0083

0084 -0086 0087

0088 0089

OOBA OOBB-OOBC OOBD-OOC5

Mulricolor I (II Multicolor 2 (21

Graphic loreground rotor (I:II 134 13�138 Graphic scale fanors X & Y 139-143 Graph!( "-ork values 1�4 Starus "'Old ST Key"S»1tch fA. STOP and RVS flag> 145

146 147 148 149

Timingronsranr for rape Work •alue. moniiO<. I.OADISA\E Serial ourpot deferred rharaner flo� Serial deferred chatacter Casseue work •aloe RegiSier sa'e

150 151 How many open tole\ 152 153 Input device. normally 0 Ourpul CMD devrC£·. no11nlrlly :1 15'1 155-156 Tape parity. ourput-reccrved flag 110 messa�e< 192-all. 64 t)rrotli, H- ml 157 158-159 Tape error pooniCI> 160-162 Jiffy Clock HMI. 16�171 1/0workb y l es 172-173 Pornrer tape buffer. <erolhn� IN-175 Tape end adds/End Ill progr•rn 176-117 Taperimingronsranh 178-179 Pooruer Sian olrape buffer 180-182 RS-232. M& "orhalu<'183 Number ol rmriklers rn frle nartll' Curreru logl(al file 18-1 Current serondal) addre.s 1&5 Current de'o'l(e 186 187-1 86 Poinler lo file name 189-197 1/0 wnrk pointer>

OOC6 ..{)OC7 198-199 Banks: 110 dara. hlenamc 'S OOC8 -OOCB 200-203 RS-232 inpur/ourpur buffer nddrl'>>( OOCC-OOCD 204-205 Keyboard de<:ode pointer (b•rrk IS) IIOCE .()(JCF 206-207 l'rinl srring work poinrcr 001)() 0001

0002

OOD3 0001 OOOS 0006

208 209

210 211 212

213 211

Number <>I characters rn keyboard buffer Number ol programmed char> warlrng Programmed key character uld<-• Key <hrh flag 0 - r>O .Jlrft Key rode 86 rf no kf\

Keyrode 88 � no kf\

lnpul from screer�/frum keyboard 29

0007

0008 0009

215 216

40/80 column> 0• 40columns Graphl(s mode codr

228 229

Curreru screen bc>Ciom margin Currcru SCfl�n lop margm

230 231 232-23:1 234 235

Currcul �·rt:en lt!ft margin Cuneul lo(.'teen right m a rgin lnt>Ut cur'oOr log (row. column) End-ol-hne for rnpui i>Omlrr I'Oli-IIIOil ol cursoron scrt"l'n hne

217 Character ba>t 0 RO�l.4-RAM OODA-OODf 218-223 �hsc work area OOEO -00£ 1 224-225 P<Hnler 10 screen hue/cursor 00£2 -OOE3 226-227 Color ltne porlller OOE4 OOE5 OOE6 00£7 OOES -IKJE9 OOEA OOEB

OOEC OOED-OOEE OOEf OOFO

OOfl 00f2 OOF3 OOF4 OOF5 OOF6 OOF7 OOF8

OOF9 OOFA -OOFF 0100 -{)IF'F

' ?3 -0

Row whererur�r hvo

237-238 Maxrmum scrmrltnts. column' 239 Currenr i!O cmraner

210 241 212

243 241

245 246

l'levrouscharan"' pnnted Charaner color Temporin color S��\r Sereen rever,.. llall 0• dul'd rur><>r.el<e programmed Number IllINSERT> oulstandrng

255 �Auto hi\Crl enabled

247 248 ll Seroll urR cnablled 2119 Uell dr>able 250-255 Not u"'-'<1 256-51 1 PrO<t'SSOr stack an•• Texr rnode lockour

0100 ..{)13E 0100 ..{)124 0125 ..{)138 0200 -02AO 02A2 -02AE

256-318 T;.pcerror log 256-292 DOS work area

02CD-02E2 02E3 -02fB 02fC -02f0 0300 -0301

711-738 JSRroonothtr bank 739-763 J.\IProanothtr bank 76-1-765 fun<1ron mrurehook I4C78I 768-769 Err01 m�oag� hnk 770-771 BASIC warm :.�art lruk 772-773 Crunch BASIC Iuken> lurk 774-775 l'ruu ruk•ns lrnk

293-312 PRINT/USING work area 512-672 BASIC rnpul buffer 671-686 Bank llt'\'k >UbroulrrM' 02Af-02BD 681-701 Bank I>Oke oubroutrne 02BE-02CC 70'.!-716 Bankrompore>Ubroullne

0302 -0303 ()34}1 -0305 0300 -0307

0308 -0309 030A-0308 OJOC -0300 030E -030f 0310 -0311

0312 -0313

776-777 St•rr new BASIC code lrnk 778-779 Gt•l•rirhrnclic elcmenrlrnk 780-781 Crunch F� hook

782-783 L1>1 Ff. hook

781-7&5 Execute FE hook

786-787 Unu>ed 88 7 -789 IRQ,·I'dor lfi\f,SI

0314 -0315 0316 -0317 790-791 Break rnrenup� \e<tut lll003l 0318 -0319 792-793 �MI rnlerrupl \KitH IFMOI 031A -0318 791-795 O PEN \«<or (Ef 11D( JWy 19t6: � 7, .._ 01


031C 031E o:m 0322 11324 0326

-0310 -031F -0321 -0323

-0325

-0327 0328 -4329

032A -03lB

O'J2C -032D O'J2E -032f 0330 -0331 0332 -0333 0334 -0335 0336 -0337 0338 -0339

034A -03>3 0354 -0350 035E -0361

0362 -0368 036C -0375 0376 -037F 0380 -039E 0386

(IJ9f -OJAA 03A8 -0386 0367 -038F

03CO -03C8

03C9 -0301 o:m2 -o3D4 03D5 0306 -0309 03DA

0308 �30D 03Df OJEO -03EI 03E2 03f::l 03FO -03F6

FRIO

ITOI fll12 fl'03

f't'lJ.I

HOI -Ff0·1 Bank 0: 0400 -07E7

796-191 798-799 800-801 802-803 801-8115 806-807 808-lii1J 810-811 812-813 81•1-RI5 816-817 818-81!) 820-821 822-832 821-825 812-851 85 2-861 86 2-RfoS 8ti6-R75 876-MS� 886-895 896-926 902 927-938 939-950 951-959 960-968 969-917 978-980 981 982-985 986

987-989 991 99'l-993

991

9% 1008-1014 65280

CLOSE vooor [FIAAI Scl-mput vector IF106[

Sc1-ou1pu1 veciOr [FI4CI RCSiore 1/0 l'e<1or W!26) lnpol vooor [EF06) Outpol 1'e<10< IEF79) T1!51-STOPIKtOr Gf.T vector [EEEB) Abort 1/0 vector [f'222)

(f66E)

Mochine Lang Mon11ur lrnk LOAD link SAVE link Corurol cnde (low)lrnk Ho�h ASCII rode torok ESC sequerK't' tonk K(')'board bul!er

Tab stop bits Lme wrap btls l.��giral file table Device number lablt• Secondary address table CHRGET subrouror�t CHRGOTentry fetch from RAM bank 0

Fetch from RAM hank I Fetch from RAM bank I Fetch from RAM bank 0 Fetdo from RAM b a nk 0 Unused Current BMK lor SYS, I'EF.K 11\STR work values Bank locaJI()n fo< stnng Sprott .,.ork b)'tes Aroom'l O.·erflow

Sprrte work byte< Graphoc!Text ba<'kgrounds Cmphic/Multi color lOR DMA link code

MMU conliguration regoSirr BankO 8.\nk I Bank 14 Bank 1 4 0\er RA\1 1 652�1-6528<1 MMU load confrR regi"<�ers 1024-2023

40-column -;cff'en memory

OtiOF -OAii OAI8 0AI9 OAIA

OA IB OAID -OAIF OA20

>5·· · .. iJ -'583 ..

RS-232 work values

RS-232 transmit poimer RS-232 -.end poonter �countdown. FFFF• dosable

2584 2585 2586 ? 58I "

2588-2>90 2592

RS-232 rl.'<:<ive poimer RS-232 input pointer

0A2f. -0A2f'

2606-2607 80 cui p.oges - screen, rotor

OA40 -OASA

2624-26�

40/80 pointer swap SEO-FA

1279 -127£ t27F 1280

OA60 -OA6D

2656-2669

40180data >wap S354-361

1281

OACO

2752

OA25 0A26 OA27 ..(IA2A

OAC1 -0AC4 -088f OBCO -08f1' OC:OO -ODFF OEOO -OFFF

0800

1000 -1009 100A -IOFF 1100 -1130

131 -116E 16f 170 -1173 111 178 17A 17C

-1117 -1197 -1118 -1110

PATroomer 2753-27>6 R0\1 Ph)1>1Cal Address Tabk> 2816-3007 3008-3071 3072-3583 :1584-4095 1096-•1105 1106-4351 4352-4400 •

IE7 -IIE8 IE9 -IlEA 1E8 llf.C l i ED IIEE -tiFF

1583-4584 Sprott bump masks(sprite, barkgnd) 1585-4586 Light pl'll ''aloes. X and Y 1587 CHRGE� ROM pagt, text [D8) 4588 CIIRCEN ROM page, graphie< [DOl 451\9 Secondary address for Rf.CORO 4S!10-·1607 IJnu<e<l PU chara<'lers (

4418-4565

1619-4620 TRAP addr"" FFFFif noot

OAOC OAOD

·.r.. .. ;)I·) 2513

1210 -1211 1212 -ttiJ

1621-4625 End ol BasiC (Bank 0) 1626-4627 Basr< progam limit [FFOOI r

4181) 41911 4251 4267 1!:'9 12CF.

Get From ($501 Bank I 421)3 Get From(S3F)S.nk 1 4lll8 Gel From (S52) ll<ollk I 421)0 Get From (S5C) u,,,k 0 42JC2 Get From (S5C) I1111k I 42E7 Get Froon($66) Bank I me Get From ($61 ) Bank 0 12FI Get From (S70)8ank 0 I!F6 Gl'f From {SiOJ Bank I llfll Gl'f From(S$0) Banl l 4300 Get From ($61) S.nk 1 4305 Gel From ($24) 1l<11ok Cl

430A 43E2

4417

•16FC

1708 1828 18-16 •1848 4AII2 413:14

Crunch Toh1h Che<k Keyword Matrh Keywords Aion d Vector' Function Ve<1or' Defunct VectOf> Unimpfemtnted Comnwnds Messages Fmd Me.sage Update Continue Pointer

1he 1 h a iiCIC tof

f:xt"t.llll•frrac:e Staternrnt 4BCB P�rform (stop) 4BCD Perform [end) 48F7 Setup r,.; Reference 4C86 Evaluate <or> 4C89 Evaluate <and> .JCB6 f.valuate <rompare> 402A 1,11111 'U!'itd)'• 4037 f.rror or Ready 4D3A Print 'out or rnemory' 4D3C F.rror 4DAf 8rtok Entry 4DC3 Reody For Basoc ·lll3F

4DE2 liandle '\ew Line 4F4F 4f82 4f�3 4FAA 4FfE 5017 5()47 5050 5059 506<1 50AO 50£2 5123

Re.:haon Lone> Re:.t1 End-of-Basic Rt-ceivc lnpot lJne S<>arch B-Stack For Match \love 8-Stack Down

Check Memo<y Spac<o Copy 8-Siack Pcime� Set B-Stack Pointer M01e 8-Stack Up frnd Ba>Oc line Gt1 Fixed 1'1 Number l'erlurrn [li>l) IN Subroutine

51ll6 Perform 1-·1 StF:I Set Up Run 51f8 PtriOfm (dr) 52 38 5250 5254 5262

('lear Stack & Work Area PudefCharactc<> !l.ek Up Text Pom>er Perform [return]

528F 5290 52A2

52AS

S2CS

..$)

Perform [d<�ta/bt:ood) Perform [rem!

Scan To Nut Stntnt Scan To �tXI Unt' Perform [of!

Search/Skrp Begrn/Bend Skip String Con>lant Perform [l•l,c) 53A3 Perform [on) S3C6 Perforrn [letI 51F6 Cht'<:k Strrrog l.ocatooro S53A Perform (p<ont•) 5540 Perform [cmd) 55SA Perform [tllom) 5600 Prrnt Format Char 561 2 l'erlorm [g.:·tl 5635 Getkey S648 Perform [ll>l>llt')

S320 S37C 539 1

5662

Perform [rori>Ut[ >69C Prompt &I rlllUt 56A9 Perform [r.od) e 57fl Perforo1[ne>t) 5878 Perform (dom) 5885 Perform I•Y•) 5884 Perform Itron) 5887 Perform [troll[ 58BD Perform lrresl S901 Ass.gn <rnrdS> 5975 Perform [auto) 5986 Perform [help) lf•rkrr 59AC Insert 59CF Perform [IIO'>Ubl 59ll8 Perform [gotol 5AI5 Undel'd Statement

Help

30

1628-4631 DO work J>OIIliN> 4632-4634 USR progralll iUIIIJl 17028( 46:15-4639 RND S<.'ed 1•alue Soond 1empo 4642 4655 Music sequrncer 46ii0-4663 Note ornage

4665-4670 Currm em· pilltl'tn 20 f.nvelope tablos 4671-47 1671-4680 AD(SR) polltrn 4681-4690 (AD)SR ponern 1691 1100 Waveform patll'fll 47111-4110 Pulse width panern 4111--1120 Pu1se widlh h1 pitllt'lll 4721-4274 Note· xx.u,volurtlt' 1725 Pre�·oous volurtlt' on�age 4726-4n8 Collision IRQ task tablt •

-•

4729-4734 4735

Collis4oo IRQaddrt'\.< tables Collos.on rn<L..t<

<1185 4864-6143 6144-7167

PF.N work value Unused

4136

Coi!L<Uon work Vdlut>

Reserved lor key lunctiQilS 7168-6451 1 BASIC RAM mtnlOf)' (text) 7168-8186 YICleo(roklf) rnatnx (ho-res)

8187-8191 Sprite oderotrtre<�(hr-res) 8192-1 6.183 Screl'tl memory (hr-res) 1638<1-6451 1 BASIC RAM memory (hi-res) 1024-6451 1 Basic variables, arr•y•. >tnrog;

Banlt 14: Same ao Bank 15, below, except:

1566-4581 1582

liE -IID5 106 -liES IE6

1208 -120C

Chortlt' Set Preconfig Regr'>le<> Registers For SOf�) I Inil Sprite Mm•emenl Ti!b� Prir11 Startup Mt.'\.'aR'l' S<>t Basic l.mks Basid.mks Chrgl'f For S03SO

Bank 1: 0400 -FBFF

Floo r -fixed vector [849F) Fixed-lloat Vl�tor [79:!C) Sprote motron tables(8 x I I b)1r'l Sprott X/Y positions Sprott X-hogh positions

4612-4615

BasocCold Statl 5<.1-Up BaSICCorl>taru>

lff8 -tfff 2000 -3Ff1' 4000 -F8FF

RS-2:12 rnput output buffers Sy"ern >Ptotes (56-63) Prograrnmed key lengths

1201 -12117

ur n 11115 1112 417A 41b!l

ICOO -FBFF ICOO -1m

ProRramrnrd key delinition> DOS Command staging area 4401-4462 G<ajJIHCS �'Ork area 4463 Tract modt �1'=oo 4464-4.167 Renurnberong poonters 4�68-4-171 Directory "'Ork pointe� 4472-4473 Craphrcs rndcx

4474-·1475 4176-4477

1276 -12 78

1300 -17Ff 1800 -18f1'

Ca<�te buffeJ

Sprne odeouity area (t�XI) 2048-2560 BASIC pseudo-Siark

ROM Map 4000 Ba>ir Entry Jump< 1009 Ba5<c Ke>ran

-1237 -12JE -1270 -1248 1249 -1252 1253 -t25C 125D -1266 1267 -1210 1271 -1274 -1:> p·-

OA28 OA2C

0A21 0A22 0A23 0A24

2040-2047

CIA I timer enablod

-1217 -121A -121F

Ke)OO.rd buffersue Scroetl lr�ll.lg 2593 2594 KO) repeal 128zall.64=none Key repeal liming 2595 Key rrpral pause 259<1 Graphor;/texl toggle latch 2595 4(1-col cursor mode 2596 2597-2600 1fkol blrnk values 80-<ol cuoor modt 2601 10-<01 1�Cleo SD018ornage 260'!

07f8 -07FF 0&00 -09ff

CIA I onternopt �

1214 1218 1218 1222 1 22F 1234 1239 123f 123f

0000 -DFFF 53248-57343 Chara<'ll't geooator R0\1 Bult 15: 400) -Cfff 16384-53247 ROM. BASIC 0000 -D02E 53248-53294 4tkol video chop 8564 0400 -D·11C 54272-54300 SID S<Xorod chiv 6581 Memory Mlllld8l'mtrot Unit 8122 0500 54528 MMU prornary rorofrR rcgi�er D�l -D50l 54529-54S32 MMU preconhg rl�r>ler> 0505 -0506 54S33-54S34 MMU modo, ram rt�o>lrr' D507 D600 10 12 lA If

-050A 54535-�538 MMU pagt 0 pa� 1 reg> -0601 �784-51785 8(1-<:olumn CRTI'UCllr 8563 -11 16-17 X. Y pos.troo5 -13 18-19 On-ch>p RAM addrt'>> 8ackgroond color 26 31 On-ehip RAM data 0800 -D8E7 55296-5629S Color nybble-. DCOO -OCOF 56320-56336 CIA I (IRQ)6.>26

0000 -ODOf 56576-56591 OA 2 (MII) 6526

OFOO -OFllA

57088-57098 0\IAslol

ffOS -FFFF

65285-65535 ROM· Traol>fer, JumpTable

EOOO -fEFF 57341-65279 Rml· Kernal

SAID 5A3D 5A60 SA98 SACA SAFO SAf8

Pu1 Sub To B-Stack P.rfomo[go) Perform [cum) Perform [run) Perform [restore[ KeywordsTo Renumber Perform Irenumber)

58AF. Renumber .. Contuwcd S8FB Renumber Scan 5DI9 Convert Une Number 5068

SOlS

5089 5099 5DA7 5DC6 SDDf" SDEE

Get Renumber Stan Count Oil lines Add Renumber Inc Scan Ahead S<>t Up Block Move Block Move Down Block Move Up Check Block l.imrt

5DF9 i'erlurrn {lor[ SE87 l'erform ldelt<e) 5EHl Get Lone \umber Range Sf34 Pl'fform lpudef) 5F4D PerfOtm [trap! 5F62 Perform Iresume) 5FB7 Reins1.11e Trap l'ouu SFD8 Syntax Exit SFD8 Print ·can't resume· SFEO Perform [do) 6039 P..torm [exot) 608A Perto.m [loopJ 6081 Prrnt 'loop not found' 6087 Prom 'loop �·ithout do' 60DB Ev•l Whole/Untol Argument 60£1 Defrnc Progmrnmrd Key

610A l'.rforr11 [k<'·l 61A8 Perfurrn [tMIIll[ 627C Chl'(k l'•rootong Spirt 6287 Prrfu<m [bo\) 6428 Perfo<m [»>oape) 6580 PerfOtm [g>h•po) 668E Perlofllr [nrdel 67SO Draw ('udr 6797 l't•rlnrm[drow) 67D7 695S

Pcrlorrn lcildr) l'..torrn [lor.•td

6MC 6A5C

Cokor Code> LogCurrerII Color> Perform [..:m lr[ Fill Memury flt�gc

6960 69E2

6J\79 6B06 6B1 7 6830 6BSA 68C9 68D7 6C09 6C2D 6C4F 6CB:! 6CC6

Perform ['<•It·) Pt'florrn [<uturI

Sc1 Smero Colvr Clear llr Kl'> Screen Perform [g,.plurJ Pl'fforrn[boonk) Perform [>I<'<'VI llultrpl\ Slt'<'V Tinl<' Pcrformlwaot) Perform l>tHotel U11 \td"k�

l'crloron lrnvv'l"l 6DEI i'erforrn [tolay) 6E02 Ana�>r PI•) Chara<1er 6EB2 Set SID Soond 6EfD Pia) F.rrur 6F03 Dotted �ore 6F!I7 Note [..,n�th Char 6FIE Nott• A-G

JWtJ 1986: Volume 7, .._ 01


6F52 .. VOIXIIrrt 6F69 Sha�l 6F6C Flat hF78 Rt>St 6FI)7 Perlorrn ]teu11"'1 t1HA Voice Times Two 6FE7 Length Characters 6Fi':C Command Characters 702F Chime $(oq 7039 SID Voice Step< 70,16 Perform !filter1 7()(1 Perform jenvelot>el 716·1 l'erfonnjcolli>ion) ii!JO l'erlorrn [sprcolorj 7166 Perform ]widthI 71C5 l'erfornr jvol1 m:c Perform jsoundj nee Perform Jwindowj 7335 Perform IbootI 7372 Perform Jsprdelj 7691 Sprite Ve('tors 76EC Perform lsprsav} 17113 Perform [Ia>!1 17C4 Perform [slowj 17D7 Type Match Check 770A Conlinn Numcri<: 7700 Confirm S.ri11g 77F.7 Pri111 'l)I>C mismatch' iiE!\ f'r1n1 'formula 100 complrx 77£F E\·aluate Expression 78Di Evaluate llcm at 793C Fixd-Flo e 7950 E\'al W11hin Parens 795C Check Comma 796C Svntax Error 7978 Searrh For Variable 7A85 Urrpack RAM I to fi\C'I 7MF Locate Variable 7UJC Check AlphabNic 71346 Create Variable 7CAB Set Up Array 7025 Print 'bad suhS(•ript' 7028 P11n1 'tllcgal quantitf 7£3E Comput(• Array Si7.t' 7f.71 Army l'omter Subrtn 8000 Evaluate <Ire> 8020 Decrylll Mes>age 804A i':•aluate <val> 8052 Stnng 10 Float 8076 Evaluate <dec> 80C5 Evaluate <pttk> 80E5 Perform ]poke] 80F6 Evalualt <errS> 813Y Swap x With )' 8142 Evaluat(• <hC'xS> 81GB Bytr to Hex 8182 F:viilmue <rgr> 81&: Gee Graphic� Modt! 8196 [\a)utuc <rdr> 8203 Evaluate <joy> 824D to:valuate <pot> 82A£ Evaluate <pen> 82FA fvalu<1te <j:IOIIltrr> 831F. Evaluate <r;;wi�t·> 8361 Evalwue <rspc.-o!or> 831C Evalu.:•lt' <hu rnr>> s:m E\1aluate <rsr,o�> 8:lEI Evaludle <xor> 8'107 Evaludlt' <rwindow> 84:H Evalualf' <rnd> 8490 Rud Mulliplil'r &f9A Value J�i6!1 849F f'lo.11-F'Ixt.•d Unsigned 84A7 f.\>alu<th• Ftxt•d Numbtr 84AD Float-Fixed Srgrred &IC9 Fluatt.y..a) 8,100 Evahwte <rx,�> 8•10!) ChL..:k Dirert g,mD Print ·illt'gal dut'tf g,1EO Print ·undel'd funet•on g,IE5 Set Up 16 Bit Fix-Float 84F5 Prrnt 'drrect mode only' &IFA Perform !dell S.'i2R Check FN Syntax 853R Perform Jlnj 85AF. Ev<�lu<tlr <�IrS,> 8SBF Evalwue <dlrS> 85D6 Evaluate <leftS> 860A Evaluc:•te <rightS> 861C l�valu<tiC' <•uicJS>

8640 8668 866E 8677 8688 869A 874E 877B 87EO 8iFI 880:1 8!115 8!12£

8!131 8!145 8!148 8917 894F. 8950 899C 89CA 8AOE 8A24 8A27 8A89 8AB4 SA£3 8BI7 8R2F. 8B:t3 838 1l 81149 81YIC 8BD·I 8BF9 8BFC !!COO

8C28

8C38 8C47

8C57 8CG5 8C6!1 8C75 8C8<1 8C87

8CC7 SCFB

8022 80130 SEll 8F.26 8E:l2 8£42 8F76 8F7B HF9F 8FB7 8FUIO 8FCI 8Ffi\ 9005 9033 !)()[)()

90DS 90DF 901:5 90EB 90FD 9112 9129 �12C 9180 919A 91AE �I DO \ll F.:t 91EB 91 F6 92'1J 9251 9257 9250 926:J 9269 �26F �)275 92711 9281 9287

l'ull Siring f>aramt�l(•rs Evaluate <len> Exn Strrng Mode £valua1e <aS(') Calc Striug Ve<"tor Set Up String Build String to Memory Evaluate String Clean Descriptor Stack lupu1 Bytt> Param<'ter Params For Poke/Wait Float/Fix('(! Subtrac1 From Mernory Evaluate <subtra<'t> Add Memor y Evaluate <add> Trim FAC' I Lelt Round Up FAC'' I Print ·overflow' Log Serit'S Evaluate <log> Add 0.5 Multrply By Memory Evaluate <mulliplv> Unpack ROM to FAC'2 Unpack RAM I to FAC'2 Adjust FAC' 11'2 Mullrplv Ry I0 till

Prinl 'd1vision by Zt!ro· Divide By 10 Oi\'ide Into Memory Evaluate <divide> Unpack ROM to fi\C•I Pack FAC'I to $5E Pack fi\C'I to S59 Pack FAC' I to RA�11 r.�c·2 to r.�c·1 FAC' I to FAC'2 Round FAC'I Get Sign Evaluall• <s.gn> llyte Fixed-Float Fix('(!-Float Evaluate <abs> Compare FAC' I to Memory t'loat-Fixed Evaluate <int> Strrng to FAC'I Get Ascii Digit ConvNsion V:tlues Prinl 'in'. . Prinllnte�ter Float IO Ao;di +0.5 Decimal Con�ant> ·n Con:.lants Evaluah? (.)Qr> RaiS(' t<J Memory l)uw('r Evaluat(' <power> Evaluate <ncgatt•> . F xpSeries f.valuate <eXJl) 1/0 Error MeS>age Basic 'os>en' Ba�ic ·chwut· Bas.ic ·inpuf Redir('CI Output Redrrcctlnput l'er1orm J>avcj l'erlorrn ]verify) Perlorrn [lnadj l'erlonn jnperrI Perform Jdo"'1 Get load/Save l'dramett>r:, Get Next Uyte Value Get Character ot Abort Move to Next Pardmeter (_j,e.t 01>E'n/CI� fldldlll:, Release 110 String Call'status' Call'setlls' . Call'st•tnarn Call'getin' Call 'chrO<rt' C;rll'drr·hn' . Call'dose Call'dall' Print fullowulg Text Set Load /Save Bank '

9280 929:1 9299 92EA 9409 9,110 9459 9·185 9483 94£3 9520 99CI 9BOC 9B:W 9Bf8 9C·19 9C70 9CCA 9CE3 9DIC 9024 9DF2 9E2F 9F.32 \JF29

9F:ID A022 A07E Al i D Al3•1 AI 57 A16F AISC AIM AlA) AIC8 A218 .4267 ,\2AI A2D7 ,\:tn

A:t2F A:t46 A362 A36E A37C A3BF A5Ei ASEA ASED A627 AlEI A80D A845 A81D AAIF M2'1

AA29

A£64

AI'OO

13000

13009

BOOC

13021 130:10 13050 13053 13088

BOBC 130BF 130E3 130E6 BOFC BIIA BI2A Bl30 8152 Bi9'1 BlAB BICC BlDG BIOF Bl£8 B20F. 6231 R234 B2C:t B2C6 B2CE B337

Call 'plo( Call ·get' Make Koom For String Garbage Collecti<>n Evaluate <ros> Evaluate <sm> E\·aluat� <t<•n> Trig Serre> Evaluate <atn> Series Print Using E\'aluate <instr> Evaluate <rdot> Draw Luw Plot Pixel Examine Prxcl SCl Hr-Res Color Cell Vieiro Matrix l.ines Hi PoSition Pixel Bit Masks Calc Hi-Res Row/Column Restore Pixel Cursor Parse Graphic" C01nrnand Get Color Source Pararn Curl\' Words Hi Corrv Words Lo Move Basic 10 $IC01 Perform lcatalog/direc1ory] Perlorrn jdopenj l'erlorrn jappendj find Spare SA Perform ldclose) Perform !dsave) Perform Jdverily] Perform Jdload) Perform Jbs a vej l'erlorm [bluad) Perform [headerI Perform [><'ratchI Perlorrn [record) Perform Jdclear] Perform [collect) Perform Iropy1 Perform !conc;rtj Perlorm (ren;rmcl Perform (hackup] Parse DO S Commands Pnnt 'mas.sing rile ame' n Pnnt 'illrgal device number' Prmt ·�ring too long' DOS Corrrrrrand Mask> Pnnt 'are you sure'.'' Release Suing Set Bank 15 IRQ Work Perform ]>lashI l'erlorrn jletchI Perform lswapj Encr ypt('(! \lrss;rge Basic Vcrtors Perform Imonitor) Break F.ntrv Print 'break' J'riul 'call' entrv r�riul 'monitor' l'erlorrH jrj r'rifll ·pc �I U.:t Command Error Print '?' Perform Ixj Cornm11nd� Vector:t Read llarrkN Memory Write Bankt'<l \1tmor y Compare Uanked Memor y Perform Irrr1 l'erlorrn 1:1 l'erlorrn[>l f•rml ·r�r-o. up· PerlormJg) l'erlorm Iii D1splay fl.Iemory Prim'.<r,�-on>' Perlorm]r) Prrlorm[t) Add l toOpJ Do Nrx1 Addrt� Perform!hI Perform Jlsv)

31

B3C7 B3DB B,l06 B536 B57C BSiF

B58B B599 BSBI B5D4 BSF5 86.19 B6AI 86C3 8715 B721 B7A5 B7CE

B88A

B8!1E B892 B8A5 B8A8 BSAD B8B4 B8B9 B8C2 B802 B8E7 B8E9 B901 B90E B922 B93C 8950 B%0 8974 8983 B9BI BA07 BA47 BASD BA90 cooo

C006 C009

cooc

COOF C012 COI8 C02I C024 C027 C02A C02D C033 COK C065 C06F C07B Cl42 CISO Cl56 CI5C CI7C Cl94 C234 C29B C2BC C2FF C30C C320 C33E C363 C37C C3A6 C30C

C'IOD C-IA5 C53C CS3F. CS5D C651 C6DD C6£7

C72D CilD C79A CiB6 C802

Print ·error' Perform If] Perform Ja.j Print ·space <esc-q>' Check 2 A-�latches Check A-Matrh Try Next Op Code Perform Jdj Print '<n> <es<:-q)' Display lnstrur1i011 I'rint ·<:t >t>ares:> Classif y Op Code Get Mnemonic Char Mode Tables Mode Characters Compaclt'd Mnemonics Input Parameter Read Value Number Ba� Base Bits Display 5-Digit Address Display 2-0igit Byte Print Space Print Cursor-Up Newline Blank Nev.· Line Output 2-0igit Byte Byte to 2 Ascii GCl lnput Char Get Character Copy AddO to Add2 Calculate Add2-Add0 Sub(ract SuiMract I lncreroen1 PoilliN Decrement Poilller Copy to Regi>ter Area Calculate Step/Range Perform [h&%) Convert to Decimal Transfer Addres.� Output Address Perform!@) -ciruGet From Keyboard Srreen lnput Link Screen l>rint Link -scr�n-senkey-piOlDefine FN Key IRQ link Upload 80 Col Swap •10/&1 Sel Window Screen Address Low Screen Address High 110 link Vectors Keyboard Shift Vectors Initialize Screen R�tWindow Home Cursor Goto Lelt Border Set Up New Line Do Ser('<'ll Color (IRQ)Split Screen Get a Key Input From Screen e Screen Char Rad Check For Quotes Wrap lip Screen Print Ascii to Screen Code Cherk Cusor r Range Do New Line ln:,ttt a l.ine Scroll Screen (�lete a '"" Move Screen l.rne Clear a Line SCl 80-column Counter to I Set 80-rolumn Counter Kerlx)ard Sc..·an Subrlll Key Pickup & Repeat Programmed Keys Flash •10 Column Cursor Prim to Snt.>en E:se-o (e>Cal>e) Vooor� Pnnt Control Char Print Hr-Bit Char

cs�

ChrS(29) Cursor Right C85A CluS( 11) Cursor Dowu C875 ChrS(I57)Cur:iOrlelt C880 ChrS( 14) Text ('8A6 ChrS( II) Lock C8AC ChrS(I2) Unlock C8B3 ChrS(I9) Home C8Bf ChrS( 146) Clear Rvs Mode C8C2 Chr$(18) Rt�·crse C8C7 ChrS(2) Unrlerliru:•·On CSCF. rhrS( 130) IJndrrlirU'-011 C8D5 ChrS( IS) Flash-On C8DC ChrS( H:l) Fla<h-011 ('8E:t Open Screen Space C918 ChrS(20) Delete C932 Restore Cursor C9•1F Chr$(9) Tab L'%1 Chr${2,1) Tab Toggle C96C Find Tab Column C980 Esc-z Clear All Tabs C9!13 Esc-y Set Default Tabs C98E Chr$(7) Bell C9BI ChrS(IO) Uneleed C9BE Analyze Esc Scqucnr(· C9DE Vectors CAI4 F.sc-t Top CAI6 Esc-h Bottom CAIB Set Window Pan CA24 Exit Window CA3D Eoc-i Insert Line CA52 Esc-d Delete Une CA76 Esc-q Erase End CA8B Esc-p Era>C Begrn CA9F Esc-@ Clr RcmaindN of Snn CAilC Esc-v Scroll Up CACA E.sc-w Stroll Down CAf2 Esc-I Scroll On CAES F.sc-rn Snoll Off CAEA Esc-c Cancel Auto lns(•r1 CAW Esc-a .�uto Insert CAF2 F.sc-s Block CurS<lr CAFE Esc..u Underline Cursor CBOB Esc-e Cursor Non Fla.Jr CB21 E><-1 Cursor Flash CB37 Eoc-g Bell Enable CJA B .>e-h .F Bell Dix1ble CB:IF f.sc-r Scrt"en Rever� CB·18 f.sc-n Screen Normal CB52 E.<c-k End-of-tine CB58 Get Screen Char/Color CBi•l Check Screen tine of Lo CBS I Extend/Trim Screen Li11e CB9F Set U1> une Masks CBBI E.<c-j Sl<��t-ol-l.irw CBC'J Frnd f.nd-of-Lrne CBF.D Mo•·r Cursor Right ccoo Mm·e Cursor Lelt CCI£ Save Cusor r CC27 r-•rint Spa<:l' CC2F Prinl Chara('t('r CC32 l'rint Frll Color CC31 Put Char to Screen CC5B Q:t Rows/Column� CC6A Read/Set rursor (y CCA2 Define Function K• . C02C F sc-x Sw1trlr 40/80 (1)57 Positiou 0-rol 8 Cursor rD6F Set S<:reen Color CD!JF Tunl Cursor On COCA Set CKTC RegiSier 31 cocc Set CRTC RegiSier CDD8 Kead CRTC Register 31 CODA Read CRTC Reg1stcr CDF.6 Set CRT(' to Screen Addrr·'' CDF9 Set CRTC to Color Addre" CFJJC Set Ut> 80 Columrr <:har Set CE4C Ascii Color Code> CESC System Color r(xb CEOC Bn Masks C£71 10-fol lnit Value> ($£11) CE8E 80-Col lnit Value> (SOAill) CEA8 l'rog Key Length> CEB2 Prog Ke)' Definition) 10000 Keset Code £048 MIIU SCl Up Byte> E056 -restorEOSB -V('('IOfF.073 Vertor> IO �!1:11·1 F.09:t -rarnta�EOCD Code For High RAM llank>

J4Ay 1986: Volume 7, .._ 01


EIIJ5 RAM Bank Mask' E109 -ioinilEIOC Set Up CRTC ReR�>Ier> W1J Check Spet'ial Reo;c;r

E75F Send ro RS-232 E7!l5 Connect RS-2:l2 1npur E1CE Gl'i From RS-232 E1EC Interlock RS-232/Senal E805 (N�II) RS-232 Control I/O E850 RS-212 Timings E878 (�MI) RS-232 Receiv•Timm� E8A9 (NMI) RS-232 Transmit TtmmR ESOO Find Any Tape Header £919 Wnte T•tl<' Header F.9ll0 Get Buller Address

f J 1" ·- -

Rese1 10 641128 E218 S•ilch to &1 Modr t :26J Code IO S02 E268 Scan All RO\" E28C ROM Addr{'>S('> Ih E2CO ROM Banks E2C4 Pnnf 'chm' Mil.'ik E2C7 VIC 8564 Set Up 2F8 F. CRTC8563 Set Up l'atrs E33B

-talk-

E33E

-listen-acptr-

EIJE

£102 -�E4EO -tksa-ctOUt- Pruu St•n<�l

E515

-untlk..unlsn-

F.521i E.s:tS

FUBO FOCB

Ftnd Sprnlic Header BumpTope Pointer

f"'.!02 f'212 t"'.!22 f'226

·

Re<et . ATN

RS-232 H andshake

(IRQ)Tape leader

E£S7

WrndUpT�VO w ch S 11 IR Q Vect«

E.f :98

(I

X

'... .

I

..

"

(I

-= out

'

T�� ... �

.1.1:

,

"

-

1 • our

I

our

• Iii.....

. ... I

.,. �

I

out

,. ...

Au'"""

con1

0501· 0504 0505 0506 DSOi 0501! DSI!I 050A

DCOO

"%b'l.i'" M)�" I J�(,

IVDII

ORJl

Vodft>.B. u'k

X

1--

X

1--

A

8

I I

hw

-

I.

I

r.. "

IJC()[) OCIIt: DCIJf

IIIQ I

l)o.,._II

li p

""i'!f1

O... n

l p

PRA

Sfi:tZU

PIUl

16.1!1

1)(](10

0001 0001

S It<!! II ()

X

I.

Thl

5f�o1��

0006

It

lAH

56l!5

OOOi

l

T8l.

Sl>l21o

It

Tllll 5632i

Fli! w.d

-

-

Lo.ld

I s R"iI I I A · � r'""'8 X

()I�

o ·�

S rtl u

X

X

X

I j MIJ i l lr•1 X

X

X

l

lklsl Addtt"'-'

t

I

I.

txpanwon Addrt--.'.

\

X

)--

-

II -'4"' f """' B.n t

X

I

Tr.tnskr�h

Tim 8

0000

56lt! Tun A

56:1ll

!>1411

i63ll

Stl lft

Still.)

"'iN'" ";�· 'f-" ·,�' "

-

II

i11J11i

"

6526 CIA 2 (NMI) (Same as CIA 2 for C64) ;-;:·� !

OliT

(�'f

'Ot� 1�1 �)!'tli ���,. 7!i ��� r�i K.f..l! V dt-'0

Ot !T

U IT

M I'T

IMT

Ill< • �

IM'T

-

Tinll.'f 1t.

-

Tut1t1 R

l"ttj

PR\

;,,jj,,

I'RII

;�.,;�

l.lk.\

iMj.\:

J�lflll -... s :-.

$00 lor RS;t: J!

0003

DDOS

r S wll(\hill) Rectl,lt'r X

t-.all

V erSion M axutl\lln�" kn�lfV

DDOE lli.'IJC

Tran"er Ve<tO<s

Tn�r 0\IA

OfltA

IJIJRU �::11.1

1-

Kc)1MJ3rd Matnx Un-Sh1IU'<i Kc-.hoard Matnx Shilt.d Keyboard \latnx C-K�· Keyboard Matnx Control Keyboard Matrix Caps Lock MMU Control> NMI T..n>l�r Entry

fTti\

Ch«ksum

All III,IUI

Ti!l'lt'f 8

NMI St�1ucnce

(IRQINormal Entry

FBE4 FFOO FFOS FF17 IRQ Tran,fer Entry FF3:l Rt:turn F'wm lnterntl>l ff3D Re,.. Translt•r F.ntry ff47 Jumbo JumpTable

OFOO

000�

1--

FMO fi\65 FAlltl FAil9 FB32 FB8B

-tObaseS.arch For SA

tX

!lORA 56:11!

T•mHA

... r ..

DRI6

· All O urt>ut •

Fi\17

-

K<)bo.wru1o K I 1 n1n lt< .

S(Kt

To2-0.!llt ll•nmal Block Read Prmt ·••· Print a Me..agc

F9FB FA08 FAIS

II

<)11oor K ""t tmom«Q d lloo "

RIR'of

ll <N

)--

Df08

II

Ltft

kt� hl

pJOt>k Boot

f79D S.arch & Set Up Ftlt

Df'O>

OFOl

I.

6526 CIA I (IRQ) (Same as CIA l for C64, until DCOC) XIY�"'£"II

''!" ' "'""'""·

"" '

.,.. I �','1:"1

9l \ • hh•f tS()IIIJIII

DCO:l

[)('(lj

hi

X

Slilrl: p

U l'

DCIJ6

l:il

7.t·m r..q..- l'llmkrI"O:KI)

OC02

OOlS

llf'04

C (i .:N

Sm'lllilro()SOJ 4IIIIJ\l'

OOll

00l4

Df'OO

Jtn.ronft gl.ll iii iUn t t�ers.

('olw-llonl ·"'�� I·�I�"::. !:

F781 t'i86

F7A5

OHIO

8722 Memory Management Unit

" u.. :1

F800 Soh<ln; to $0'lA2-SIY!FB f85.� ll\IA Code to S03Al F867 Check Auto Stan ROll F890 Chcrk For llool Drsk . f1 X lll Pmu'huo4111R . F92F Pnm · F988 Wmd l F9B3 Read "'ext Booc Block

f75f Set Serial Tom""'ll f763 ...menllopf'172 -rnemboc-

Print'badu�g

DF02

0600

-rdc1m.. -settlm-

DMA Controller

I • 001 T..,.

8n�

W•tch For RUN or Shill

Pnnt 'mtSStng fik> narnr· F691 f'fi9.1 Pnnt 'tllegal drvte:. no f697 F.rror o • F6BO Messages F71F. l>riut U Direct F722 l'rint l/0 Mes:.agc F731 -�namF738 -�lisF73F Sot l.oadiSav• Bank F714 -rdSIF757 Set Status Brt f75C -�msg-

S.arch FO< Fill' Set File Parameters

Burst load Close OflSerial F4BA Get Serial Byte F4C5 Receive Scnal Byte f'503 Toggle Clock Line FSOC Print 'uO' Di•k Reset F50f Print searchtng' F521 Send filt Name

8502 Processor 1/0 Registers X

-openSet CIA to RS-232

flEA f48C

F533

-udnm-

F7AE (A1 Chdr From Memo�· F 71lC Storr to.�led B ytr F7C9 Read B�t<·to hr Sav.d F700 0<'1 Chiir From Memol}' !lank F7DA !\lore Chat to Memorv iink ll F7E3 Com(lllt<· ('har With Memorv F7EC l.ood Ml'nl Control \la,k F7FO Bank \l<blc>

F66E -Slop. f67C Pnnt 'loo many filf"' f67f Prinl 'lile open' f682 l'rint 'lile not open' F685 Print 'lile not loond' F688 Prtnl 'dcvice not prrwnl' f'688 Pnnl 'not input ftle F68E Pnnl ·no� ootp<rl fil<>'

f32A Tape Load f3AI Disk Load

Ell8B Write Data to Tape F.ll90 (IRQ)T� Wnte

ms F630 1'665

-clall-clrchnF23D Clear 110 Path load F265 F27B Serial load

EMI Sot Reltd Ttmtng EAEB (IRQ) Read Tape Bits ECIF Store TapeChars f.DSI Rflft Pointer F.DSA New Char Set Up F.ll69 Send Tr•nsiln to Tape

E£2£

-cltnnGet Char From Tape -chrOOI-

-

-�\"f'-

F65E

Check cSnal Open FI06 -chkinF I4C -chkoolFl88 -closeFIEI �.Fir.

£9('8 Pnnt P<'-"' play £9Df Chtc:k T�pe status Pnnt 'pres> record £99 £ F.9f'2 lrntiatc Tape Read F.A I5 Initiate Ta(l<' Wnte EA2fi Common Tarl<' Code £Ail) Wan forT� EA8F Ch«kTii(Jt'Stop

ES45 Sel Clock High ES4E SelClock Low F..Si S Sel llal.l lltgh [5(,0 Sel Dala Low E569 Read Selial Lines E573 StabihzeTtming E59F Restore Timing £5BC Prepare F'or R(·�I>UUM.l i E5Cl Fast llsk Ofl E51l6 Fas1 llisk On f.SFB Fastllik s On/011 ESFF (NMI)Transrnrl RS-23'1 E64A

EAl6 F.F48 EF79 EFBD

FSJE FSB5

Terrnmate Senal lnput . FSBC Pruu 'saving FSC8 S<Jve 10 Tape

EEC8 (IRQ) Clear Break EEOO Control T� M01or EEEB -getin-

Get Tape BullerSlart & End Add"

E987 E99A £9BE

E503

EEA8 IRQ Ve<1o" EEBO Kill Tape MOior EE87 Check f.nd Address EECI Bump Addrt'SS

£68£ Sel RS-232 Bit Coonr Efi9D (N\11) RS-232 ReceiVe

I.

TAl

l 1M

t

ift>l\1

l

1111

��.'\!\!

II

11111

-.c>ll!

-

j"i\"'

lti�llil

••n .. • r A

!lnk'f

A Slflll

Jlnll1 RSI,ul

DDOF

rid u� ..... t" n S • • PR8•�thf>P.v.d1ril ""' Putt

' fc.nllE'dtdbut

lDL\

32

'f,f .. ·�

� 1986: Vc*.me 7, .... 01


8564 Video Chip

Sprite

Sprite

53265

1)()()0

OOOE

5:!266

DOOI

DOOF

0027

002E

Control & Miscellaneous Registers

CXII'I� (](�I I

DO I I

lr

[)()12 0013 0014

.'

'u Ma

Mod £'

. "

fl ow . SciC\ I

I�'Si>'"Y Enable

Y-Scroll

Raster Register

X

Light Pen Inpul

1-

0016

X

0018 0019

VMI :l

IRQ I

Reset I �ul � l•

X

VM

I!;"'< �

i il

.

r 1 :1

"·'""

� I ; �� C l

"

'

Interrupt Sense:

Interrupt Enable:

OOIA

1

X-S<: roll

Selec 1

V M IU

MtI

y

('olumu

Co l ou r

CI

-

53267 532(i8

smo

X

53272

Raste r

53273

R aster

53274

CBI I

( Border)

53280

X

Background Colour •o

53281

0022

X

Background Colour

0023

X

Background Colour •2

5:J28:J

0024

X

Background Colour 3

5:!281

0025

X

Sprite MultiColour •o

53285

1)026

X

Sprite MultiColou r ' I

53286

0020

X

0021

E x terior Colour

'I

...

D02F

X

X

X

X

X

0030

X

X

X

X

X

I Keylx>ard X

Ruws)

Test

00!5

c�k

53282

I

Sprite Colour

.

[�100

Q.li)i

01111:

(}I()I

0·11)1\

04(1F

[)lfl2

0-11>1

))111!

(}103

0411�

IJ111

0

(}10·1

O·IOB

OH:?

NS�:

(}IUS

uwr

1111:!

(}lfJti

D-100

1-

4 I

'�· ' 2:mlr k_R!.t J.i'r"· '

TRI 1 '

:')Ul>tamun·:l

lllll

I

ll-111

I)

ll116

ll41 i (}IIR

V:l•)ff

II

"

DOID

X·Ex1>and

53277

DOlE

lnterrupl: Sprite Collision

53278

OOIF

Interrupt: Background Collision

s:m!l

( J I I &mu�

l� h t V l'ft v... . 81;mk

X

rw:.onanc.tt � ."'"''�, Ill

BP

F1llt•t frequt'1K�' 1 Exl

tJ> ,

X

X

DliOI

I ���

llo m ont al f .ar..1 < 'r:- O.Sf'l&ar -d IWI) t h

z$ 2 0'

lton U. Ifll it ) �\'tiC I XISIIio n \\ •J i t\ • ' S)'OC

4 $()l

X

W idth

u r1

3!• •t.N

Vt•rfu .-.tl'l'olitl •�u A

5417:1

5·1 ?1111

.5·1?8i

7 107

X

Verh \ ' o.l Sync Pos 1!10n

l -

S.42H

54:!81

S·ll&�

s�

X

X

X

II

5�2iS

5·1 2112

5-!t&t

9 �19

X

A

K•• )·

i-117fi

5·1111:1

5·1:2<11.1

10 $();\

X X

. 6nb-·� -.� �. ,

)..1'_,' )--

5�284

5·12'11

I I l(llj

6m v' 1 1'>t'\

:.,�2(1�

12 111('

t,uer • "o" V3

I:">

V!

M.t'-lt'l Vvhlrltt·

II

51;r,)J

VI

).f�>95

Cur'>�Jt MIXk·

Cu r M�rSldtt

:��

X

X

CurX�r Erld

X

X

" " " "

X

I

(}IIA

f'<l •d lc l'

(AID '1)

sll'!tS

24 1 18

(}liB

N•u • t 31rc.ndom )

.)����

2S " 9

(}II('

:nve > ll'l' : s � k

).t:�uu

11 )$ 1:\

X

X

X

c� , w ·t .� tdp

RI'S

R"•

� k �ern lj!mk

� I�"l'!

o ' F.na b k

� � �lt

GrJi>h

\'dill....

I�

\dill"'

L

\'oif ll"

I. 0.�)

HS ·<roll

6hlf il

8ae:kgrU1.10d (olour

1·111

IX

X

X

RAM

X

li nt:k'f lin

X

1 111

l!

S.:rull fo nlmlJlonwnto�J ('ll ;Jr St- 1 Addre »

" k

X

Vt•t!llo�l

v S.: htll

\ dill ....

I.

I

O.,udlll'f

f'or cg, �mdCulo 1.11

28 11 C 29 11 0

I�

Cllatarl(' f u.... , )l;t\' I klfli'!JI!I<II

('ll araciN To1al

!7 S 1 8

A

X

X

e :)(:afl IJut' fouflt

"

�� '

10 m:

0 1<1r.��:tl"r Cotml

\'(11)1'�

3 1 11 F

V1dro !<,\ \ 1 dillt� ('.toe reg i � l t'rs UU� II

\ d i M''

:U

S2U

.13 111 3-t S2t

J.\ 123 3(1

33

II l

fot<Jt�r Mdrrs:�

23 1 17

m lht· oi>!JO\l' dJII!(Iflfl\

I.

)-l� i

tilt' 00111lt'1.1 fru

II -

Vtd(•o RAM Addrt'"''(� lqtl'itl'r :u I

P.•I,I� X(A/0' 1)

'

'

Ohpld\· .•\(Mrt!�:�

I.J!tfll Pt•u htpuf

OH!.I

II

ln!('rblt �

-

:?2 $ l fi

(Tf.\T RING \lOll. Sl'NC)

T

II) H J

11 1 15

FNIUfl-"

:?!• r•r :t!

20 114

Sc.'i l. � ' (n·o�d oolv l

X

X

:?5

Cur)l(.l4 Addrt"' �

1911:1

II

Otsp&arro 125)

1

ISSI:?

, 1:?91.

X

..t

� kan ! J ill'S pt.'f Chdt<M'I<'I

I :11 !>0

17 �II

I ..nd 3

l lof izonl< •l !»·n\ W1dt h

X

'

"'

V en• (·�l TOit�l X

;,l iS-1

I fi !

wn. ... .. ,

li-U!U

I

Tn •�'•ll Valut·

l iun 7xdo.� l Tu1al

I S l! lf'

X

147�\

X

Ft!le t and Vol u me Jtlll'tlt• vnh 1

NV!e Sj)l'l.li.ll V011:e

X

I) $.( 1( 1

I I 111 ;

-

8563 80�Column CRT Controller

6 $06

L

53271

53276

!i I:!Sii

"I

II

5:!26!1

Sprite M ultiColour Mode

SUi9

V(IK�·.., .r re" w rtli .•-<. ml�

532(i'l

OOIC

5·1212

�·11<1�

I I I

53275

L L

512�

0 I

Background Priority

X

K't-1 �''"'-:!1111('

I I

Y�Expand

5 �l t

.

5329'1

'I

�yT;n,.

s3287

1

.

2 I

3 I

\'n.rv

I)

.! '" � ! 1)' 1"' l 'l ' L S AW

.

Vmr..-�

,.\list w ldll\ 0

.

Vo-·t> I f're<�tk'nt"''

"

.

Bil For Sprite-·:

5 I

6 I

:1 �0

Vu1rt' l

5:!263

Y Poitio

Sprite Enable Flags

06110

V01n•?

5:!249

: : : � n: : :

5-1 18-1

VOK·t' 1

53262

X-Position High

OliiiO

(ldentical lo 6581 on C64)

1 53248

7 I

0 I

OO!B

53296

6581 SID Sound Chip

Sprite

X P sition o

I

0600 rradCsldltl!ol.

53295

Sprite

Sprite Registers

7 I

I I I

DOlO

0017

Colour Registers

7 I

0 I

8564 Video Chip

S:?�

Blco..k COIJ\ 51\lrt Addrf"\�

()\spl.tv t:lldbl�·

X

X

X

X

II

I.

tl('g

t•nd OkAM Rdr -sh R.llt· (

\ d f k .... \<li lt''

p· ·'

IlKI

5

Jvly 1916: Volume 7, I ssue 01


The C 1 28 You Can Bank On It

You may have noticed that the Commodore 128 has sixteen "memory banks". In Basic, you may call whatever bank you want (for PEEK, POKE, SYS or WAIT) by using the BANK command with a value from 0 to 15. Similarly, machine language types will reference banks in the monitor by prefixing an address with a digit from 0 to F - the same bank values of 0 to 16. However, the average programmer - with no cartridge. internal ROM. or RAM expansion - can only make use of four of these numbers. The only ones that make sense are banks 0. I, 1 4 and 1 5 (hex 0, I , E, and F) What about the other numbers? Banks 2 and 3 are reserved for memory expansion. Banks 4 to 7 and bank 1 2 are only useful il the empty socket inside your machine has been fitted with an "internal'' ROM chip. Banks 5 to I I and 1 3 are only useful if a cartridge ROM is plugged into your machine. And even if you have these extra things fitted, chances are that a commercial software house has taken care ol all the banking you're likely to need, leaving you with little to look at for fun. I don't like the term 'bank' as it is used on this machine. These numbers represent configurations; each so-called bank is an assem­ bly of varying parts of memory. Only 'Bank 0' is not a mixture: it uses one kind of memory only, the RAM where your Basic programs are held (usually called RAM 0). All the othes r are mixtures of different types of memory appearing at various addresses. Even bank 0 is slightly "impure" - addresses hex FFOO to FF04 are not RAM. they hold a special memory control chip called the MMU (memory management unit). Bank I , for example, is almost entirely the RAM where Basic's variables. arrays and strings are stored (RAM I). But there's a little bit of bank 0 still in there, at addresses 2 to I 023; and the MMU is still prc•sent at FFOO to FF04. fn fact, these items will be there in all "normal" configurations. Banks 0 and I . then. arc pure RAM. random access memory. You can store things there, and you can read the contents of these addresses. But you'd have trouble running most machine language programs in one of these banks (don't let terminology throw you: I mean. "in one of these configurations"). You have no input/output paths available from these configurations. and you don't have the built-in operating system (the 'Kernal ROM') to help the program do its job. In most cases. you'd find bank 15 (hex F) to be much more useful for running a program.

F:xruse the hexadecimal numbers. but serious architecture students will want to see them that way. Bank 1 5 (F) has RAM 0 from address 2

Jim Butterfield Toronto, Ontario

to $3FFF; above that is the ROM that holds the Basic logic, from 4000 to BFFF; above that is the Kernal operating system. in two chunks from COOO to CFFF and EOOO to FFFF; and finally, the block from 0000 to DFFF is used for the Input/Output (1/0) chips. If you need to

use the character generator. Bank 14 (E) has the same architecture except that the block from 0000 to DFFF contains the character set instead of 1/0.

When you give a �ANK command, nothing happens; the number you supply is stored (at address $0305). It won't be used until you give a command which needs this number: POKE, PEEK. SYS, WAIT and some of the DOS commands such as BLOAD and BSAVE. Even then. the computer will only set up the configuration for a fleeting moment while it transfers material to or from the selected bank.

Roll Your Own So you have only banks 0. I , 1 4 and 1 5 for your work. No problem for a Basic programmer who might occasionally PEEK and POKE. But for the serious machine language programmer, it's somewhat limiting. To keep the Kernal and 1/0, the programmer is forced to select BANK 15; and that limits the program to RAM in the area below $4000 (decimal 16384). This could be somewhat restricting, especially when a high­ resolution screen might reside in the same area. There's hope. In fact, there are sixteen architectures that the ML programmer can use. Only four of them have BANK numbers. but the others can be reached by storing a value at SFFOO. Table I shows all the practical combinations. Here's a quick rundown on some of the most important: 00 - Storing this value in FFOO causes the Cl28 to take up its

"normal" BANK IS configuration. Use this before returning to Basic.

3F and 7F- Storing $3F into FFOO creates the BANK 0 architecture; storing S7F creates BANK I . Careful: you have no 1/0 or Kernal ROM. There's a shortcut to these architectures: storing anything to FFOI creates Bank 0; storing anything to FF02 creates Bank I . OE and 4E - Storing $0E into FFOO creates the RAM 0 for addresses

up to BFFF; storing S4E creates RAM I for this area. The Kernal and I/ 0 take up their normal positions. This are the "ideal" configurations for serious machine language stuff: OE for a program in RAM 0, and 4E for a program in RAM I . Basic is removed, and you have lots of memory to play with. OF and 4F - These are similar to OE and 4E above, except that the

character generator chip is at addresses $0000 to DFFF instead of 1/0.

,.., 1986: Volume 7, .._ 01


Use one of these configurations (bric!ly) when you need to examine

character generator contains 78, and we make sure that the video chip

the pixels of the character generator; but don't call any input or output

border colour is set to its normal value of FD.

when you are set up this way. The machine language program sets the requested value into FFOO, 02, 03, 42 and 43 - These are curious con!;gurations that keep the

and then tests the contents of the specific locations. A zero is taken to

upper hall of Basic (from 8000 to BFFF). They would not be used

be RAM 0; a I to be RAM I ; other values arc tested for a match to the

much except by enthusiasts who wanted to get at the !Joating point

known ROM values. If none of these are recognized. the numeric

math routines in that area.

value is printed. Each location is tested five times; if the value is not constant for every read. it's likely "not there" and is shown VARYING.

as

Summary C128 Architester You can arrange any of a number of custom architectures if you need

1 0 data 120, 1 4 1 , 0, 255 20data 174, 0. 48, 142. 128. 2 0. 96, 1 42. 129. 2 30data 174, 40 data 174, o. 176, 142, 130. 2 50 data 174, 0, 240, 142. 131, 2 60 data 174, 32,208, 142. 132. 2 70 data 169, 0. 1 4 1 , 0. 255, 88, 96 80 for j = dec( " 250 " ) to dec( · 278 · ) 90 read x:t =t+ x:poke j,x 100 next j 1 1 0 if 1<>4305 then stop 120 lor j = 3 to 0 step -1 130 bankj 140 poke dec( · 3000 • ).Fa(O.O) = -1 150 poke dec( · 6000 • ).1.a(1 .0) = dec( · 60 · ) 160 poke dec( · bOOO • ),j:a(2.0) = dec( · 4c · ) 170 poke dec( · 1000 • ).j:a(3.0) =dec(· 29 · ) 180 poke dec(· d020 • ).j a(4,0) = dec( · 78 · ) 190 next j 200 bank 15 210 poke dec( · d020 • ).253 220 a$(0) = • 0400-3111 • 230 a$(1 ) = • 4000-7111" 240 a$(2) = • 8000 b!ff 250 a$(3l = • cOOO-c!ff/e000-1111 • 260 a$(4) = • dODO dff! " 270 input ·value of $ff00 poke(hex) • ;x$ 280 x = dec(x$):if x>255 goto 270 290 for t = 1 to 5 300 sys dec(" 0250 • ) x . 31 0 for j = 0 to 4:aU.t) = peekU + dec( " 0280 " )):next j 320 next t 330 for 1 = 0 to 4:q = fre(1 ) 340 a= au. 1 ):r$- . .. 350 for t = 2 to 5:if a<>aU.t)then a= 444 360 next t 370 if a = 0 then r$ = · ramO · 380 if a= 1 then r$ = ram 1 390 if a= 2 then r$ • ram2 • 400 1! a = 3 then r$ = • ram3 • 41 0 If a = au, 0) then r$ = • rom • If j = 4 then r$ • cgen • 420 1f 1 = 4 and a= 253 then r$ = • 1/o • 430 1f a= 120 then r$ = • cgen • 440 1f a = 444 then r$ = ·vanes· 450 1f r$ = • • then r$ = str$(a) 460 pnnt a$(1). • - · : 470 pnnt r$ 480 next 1

to. The standard BANKS are of limited help; use them to get !rom Basic and then organize your own architecture with a POKE to FFOO.

Table I . The sixteen 'useful' architectures. Addresses whose first hex FFOO ( digits are: Poke ( D 4567 89AB CEF Value 0123

) )

1/0

RAMO

ROM

ROM

ROM

RAMO

ROM

ROM

ROM

CGEN

RAMO

RAMO

ROM

ROM

RAMO

RAMO

ROM

ROM

110

CGEN

OE

RAMO

RAMO

RAMO

ROM

OF

RAMO

RAMO

RAMO

ROM

1/0

CGEN

3E 3F 40 41 42 43 4E 4F

RAMO

RAMO

RAMO

RAMO

RAMO

RAMO

RAMO

RAMO

1/0

RAMO

RAMI

ROM

ROM

ROM

RAMI

ROM

ROM

ROM

1/0

CGEN

RAMI

RAMI

ROM

ROM

RAMI

RAMI

ROM

ROM

110

CGEN

RAMI

RAMI

RAMI

ROM

RAMI

RAMI

RAMI

ROM

1/0

CGEN

7E

RAMI

RAMI

RAMI

RAMI

7F

RAMI

RAMI

RAMI

RAMI

1/0

00 01 02 03

RAMI

Bank

Store

Number

to

"BANK 15"

"BANK 14"

FF03

"BANKo··

FFOI

FF04

-

'·BANK I "

FF02

Note that in all configurations, the first I K of memory (addresses 0002

to 03FF) is always RAMO. Addresses 0 and I are internal to the processor chip.

An Architecture-Testing Program You might like to try your hand at checking the type of architecture

that results when specific values are poked into location $FFOO. Run this program, supply a value, and see what you get.

=

The "business end" is a machine language program which tries the

architecture and peeks various locations. reporting what it finds. Such

=

a program must be tucked into the first I K of memory: that's the only place that is safe !rom architecture switches. The specific locations examined by the program arc (hex): 3000, 6000,

BOOO. FOOO, and 0020. A value of 0 is poked to these locations in RAM 0. a value of I in RAM I . The ROM values arc fixed, hopefully: 6000 contains 60. bOOO contains 4C. and FOOO contains 29. At 0020. the

35

.JWv 1986: Volume 1, ._ o1

1


Getting The C l 28's CP/M + In Gear

After stating we felt there was not enough demand for more

Clifton Karnes Greensboro, NC

CP/M

info than is already available, we were deluged with letters. Several of

the responses explained it wasjust the contrary· that what little CP/M

info is around, is hard to find. So here is the first of what we hope will

be more articles on C128 CPIM + .

·

EIC

J

One of the nicest things about the new C128 and 1 5 7 1 disk drive is

addition to the new operating system. there's

nrw utility called

that they have a CP/M mode that can read real CP/M disks. The

CONF that allows you to configure your system using an ASCII printer.

system as supplied has some excellent features but unfortunately it is

dual disk drives, define baud rate, screen and cursor colors. key feel.

incomplete. There is, however, a solution.

and much more. If this weren't enough there is even a modem program for the 128 available on CompuServe: IMP by lrv Hoff. IMP is

In this article I will discuss how to get the C I 28's CP/M + system up to

the latest CP/M modem program in the honorable line that began

par. how to begin lapping the huge source of public domain software,

with MODEM7. This modem program is excellent and opens up the

and describe some language implementations (both commercial and

world to CP/Mers.

public domain) that I've tried on the Cl28 in CP/M mode. How can you gel this stuff'? First you rnusl be a member of Cornpu·

Where's the Assembler?

Serve. lf you're not then this is a good time to join. You'll need VIDTEX 4.0C to start downloading. All of this material is in DL3 of CPM-IG.

The first thing you'll notice about the CP/ M + disks is that they

CPM-IG (the CP/M Special Interest Group on CompuServe) has

contain no Assembler (MAC). debugger (SID), or any of the other

started DL3 as a Data Library specifically for C128 CP/ Mers. Nice.

utilities and source files that arc supposed to come with CP/M + . This problem is easily solved. Just send in the card for the "DRI Special

The thing to do first is download CI28.1RV. This file explains which

Offer" (and $ 19.95). Commodore will send you the missing utilities

other files are needed and how to get them. You'll need NEWSYS­

and a huge manual.

.COM (this creates a new CP/M+ operating system), IMP-C8.BIN and

Where's the 1/0?

IMP.DOC (this is the modem program and its docurTH'rllalion). 12C8I .ASM (this is an overlay to let you customize the modem program).

CONF.COM and CONF.HLP(these allow you to set system parameters The next thing you'll notice about the CP/M+ is that. besides the

and tell you how}, CI571 .COM (this nearly doubles the write speed of

console and disk, all the serial I/O routines are null. This means that

the 1571 i n CP/M mode). I n addition there are two files to help you

the User's Port is dead. If your printer uses this port or you have a

with the downloading process: BIBOOT.IMG (for single drive users)

modern you would like to usc, you are out of luck. But don't despair.

and 64CONV (for users with two drives). Even at 300 baud none of these files are long enough to be very expensive• to download. I

Where's the Standard ASCII?

recommend that if you're not a member of CompuScrvc you join, but if for one reason or another the way of getting thi� software I've

The next question that may arise regards ASCII. CP/M uses standard

described isn't appealing. then you can send me a formatted CP/M +

ASCII and the 128 implies it does (see the SETKEY utility). This is true

disk, and SASE and S3.00 and I'll copy the files for you.

in part. The characters sent to the screen are standard representations (characters unusual to Petscii are formed with the CfRL key plus the key that most nearly resembles the character eg. CfKL

Free Software

( and CfRL J

for left aud right curly brackets. CTRL I for backslash). Bul lhe codes sent to the printer are Petscii and there's no way to change that. lu

software. The best place to get started is to look into two books on the

other words. if you've got a flexible printer like the Star SG-10 and an

subject: Free Software by Robert A. Froelich (Nt'w York: Crown

interface. you can't get out of emulation mode to usc any of the

Publishers, 1984) and How to Get Free Software by Alfred Glossbren­

printer's extra features or for that matter its staudard characters that

ner (New York: St. Martin's Press, 1984). Both of these works give

aren't part of Petscii. There's hope.

excellent introductions to obtaining free software.

Commodore, CompuServe and lrv Hoff to the Rescue!

There are two basic ways to get public domain software: download it

Now that you've got your system tuned up you'll want to get some free

or buy the disks. You can download from a commercial database, like CI:3M Engineering (in the guise of Von Ertwine) has been working on

CompuServe or from a bulletin board. You don't actually buy public

thrse problems and there is a new approved Cf'/M + operating

domain software (or shouldn't) but most user's groups charge a

system available free to all on CornpuServc. This new operating

donation for equipment wear-and-tear, etc. and there arc copy

system enables the serial 1/0 so your User's Port is undead. In

services that copy public domain programs for profit (you're paying 36

.Jtiy 1986: \IQiume 7, !saw 01


for their service - not the software). Which procedure is more economical? That depends on your situation. If you've got a 1200 bps

The Beginning

modem and a local bulletin board or if the files you're interested in are fairly short then downloading is the way to go. If, however, you're not in this situation, it can become very expensive to download programs

Although this is the end of our smorgasbord of information on CI28 CP/ M + , I hope it will be the beginning for you. Find a source and start checking the stuff out. Maybe the Transactor will even start giving a page each issue to C 128 CP/M + developments.

with all the relevant files. The costs vary with buying the disks themselves from something like a dollar a disk for local user's groups (you'll usually have to join the group too. which will be around $ 1 0 $25) to $ 1 5 and up for copy services

Clifton Karnes 2519 Overbrook Dr. Greensboro, NC 27408 (919) 373-7892

·

There are two principal national sources of CP/M public domain software on disks: CP/M User's Group (CPMUG) and the Special Interest Group for Microcomputers (SIG/M). These groups both have extensive libraries. These books discuss both these sources at length. As for the formats that will work on your 128: Kaypro 2, 4, IBM CP/M 86 and Osborne Double-Density all work fine. That covers a lot of territory. Most of the public domain software out there is for CP/M 2.2, but I haven't found any incompatibilities yet with the CP/M 3.0 on the 128.

Addresses of Software Sources Mentioned

Mix Software 2 1 1 6 E. Arapaho Suite 363 Richardson, TX 75081 (214) 783-6001

SIG/M Main Office (write to them to find your nearest SIG/M repre­ sentative) Box 97 Iselin. NJ 08830

The main reason many of you are interested in CP/M is the program­ ming languages available. Many languages are even in the public

Ellis Computing 391 7 Noriega St. San Francisco, CA 94122 (415) 753-0186

CPMUG 1651 Third Ave. New York. NY 10128

domain. The most famous of these is perhaps Small-C. What follows is an annotated listing of commercial programming languages and editors I've tried that are low in price and that work on the 128, followed by some public domain packages available from the national user's groups mentioned above.

Software Toolworks 14478 Glorietta Dr. Sherman Oaks, CA 91423 (818) 986-4885

C User's Group (CUG) Box 97 McPherson, KS 67460 (216) 241-1065

Programming Languages

Language

Description

Price

Supplier

MIX C

Full K&R C compiler with UNIX functions, 400-page manual

$39.95

MIX Software

Nevada FORTRAN

Fortran IV with '77 extensions

$49.95

Ellis Computing

Nevada COBOL

ANSI COBOL '74 with level II features

$49.95

Ellis Computing

LISP/80

InterLISP dialect

$39.95

Software Toolworks

MIX Edit

Full screen I Split screen, programmable

$29.95

Mix Software

Nevada Edit

Full screen

$49.95

Ellis Computing

( I received excellent service from all of commercial sources listed above ). In addition to the these commercial packages there are several languages available in the public domain. These include: EBASIC

Gordon Eubank's Master's thesis and a forerunner of the widely used

Free

CPMUG Volume 30

Free

C User's Group

Free

SIG/M Volume 1 18

CBASIC Smaii-C

'C' programming language by Ron Cain. with only int and char data types but widely used. Comes with source code.

XLISP

Experimental Lisp by David Betz. Comes with source code in C. Soon to be upgraded to a subset of Common Lisp.

FORTH-83

Forth-83 implementation version 2.0

Free

SIG/M Volume 204

E-Prolog

A small Prolog implementation. Comes with ASM source and a VALGOL compiler written in Prolog.

Free

SIG/M Volume 242

JRT Pascal

Full Pascal implementation

Free

CPMUG Volume 82

This is just a list of the more popular languages available - there are others. And lots of other software including: assemblers, text editors. disk utilities (there are tons of these - one of the best is SWEEP in its latest version), and games. As the two books mentioned above show there is no such thing as completely free software, the price you pay for public domain programs (either in downloading tirne or to user's group or copy service) is usually a very small fraction of the value of work. Also. most of the above-mentioned public domain works can be downloaded from any number of sources if you choose that route.

37

� 1986: Volume 7, 1uue 01


C 128 RAM Disk

Noel Nyman, Seattle, WA

Add A 16K RAM Disk To Your C-128 With No Additional Hardware! A RAM disk is a chunk of random access (read/write) memory that acts like a disk drive. LOAD and SAVE work with it. It cannot be reached by store, PEEK or POKE. RAM disk is external hardware, a circuit board with chips of various sorts. If it has enough memory to be practical it is physically large and expensive.

The video register to be accessed is stored in the X register of the 8502 and the routine is entered at address $COCC. The value in X is stored at $0600. Then the BIT command checks for bit •7 to go high. Until it does, the BPL command will branch back to the BIT instruction. Once bit "7 goes high, the video chip is ready and the new data is stored at the data port, $060 I.

The advantage of RAM disk is speed. Files can be located and LOADed rapidly. Some database users find RAM disks worthwhile. But a 170K RAM disk cos t s about what you would pay for a 1541, and the memory goes away when the power is turned off.

If we want to store data in register 31, the routine is entered at address SCDCA which stores 31 ($1 F) in X for us. There is a complementary routine starting at SCD08 that reads a video chip register.

/

If you own a C-128 you can try RAM disk with no additional outlay for hardware. Every C-128 has 16K of RAM that is not part of the regular memory map - the eighty column video RAM. Although a 16K RAM disk is small by commercial standards, it will hold 62 blocks of Basic programs or one-fourth of the Basic variable memory. A new Basic program, or a whole new set of variable values, can be brought into memory in about two seconds. To understand how our RAM disk will work, you must know a little about the eighty column display system. We only have access to the 8563 eighty column video chip and its RAM through two addresses or · ports · . One of these ports, located at Bank 15, address 54784 ($0600 in hexadecimal), is used to select a register in the 8563. The other port, located at 54785 ($0601 hex), is used to read from or write to the selected register. The video chip uses the register data to make changes on the screen. The buzz­ word ued s to describe this situation is • pipelined architecture· . There are 37 registers in the video chip. Some of them are high/low address vectors (pointers) to the video RAM. Othesr change eighty column screen functions by passing numbers or setting and clearing flags. We'll only be concerned with three of .the registers.

By switching to bit mapped mode, you'll be able to ee s the data and programs being SAVEd to RAM disk.

BSAVE • MEMORY DRAM . , BO. P3072 TO P3184 To use the routine, set-up the beginning and ending addresses of memory using these commands:

Register 31 is the CPU Data register. The value at the address pointed to by registers 18/19 is available in register 31. If we access register 31 and store a number at the data port ($0601), it will be placed at the video RAM address pointed to by registers 18/19. The vector at 18/19 is then incremented automatically.

SYS 3072,1b,hb SYS 3077,1e.he Where: lb = low byte of address of beginning of memory hb = high byte of address of beginning of memory

When we store a new register value at address $0600. the video chip is probably busy updating the eighty column screen. We have to wait until the chip is ready to look at our data, or we get erratic results. Bit •7 of address $0600 is held low when the video chip is busy, and goes high when it is ready to accept new data. The ROM routine below is used by the 8502 processor to check bit •7. A2 8E 2C 10 80 60

Storing 128 in register 25 puts the video chip in Hi-Res or bit mapped mode. The two sets of vertical bars at the top of the screen are the text (CHR$(32) on a cleared screen) and allribute (color ram) screens. The horizontal bars below are remnants of the RAM test done on power-up. The five columns at the bottom are the character M)ts data. The blank spaces are there for additional character information for a double wide character mode.

Listing "I is a Basic loader for a routine designed to copy portions of memory from any Bank to RAM disk. Enter the loader, RUN it, then SAVE the resulting machine language program by typing:

Registers 18 and 19 hold the vector to an address in video RAM. The vector is stored in HIGH/LOW order. Machine language programmers are used to two byte addresses being stored in the opposite sequence, so it's important to note the difference.

F'COCA CDCC COCF C002 C004 CDD7

The following programs will store data to the 16K video RAM and retrieve it for later use. You must use the 40 column screen with them, since any printing done to the 80 column area will garble the data you've placed there. Before RUNning the programs, switch to 40 column mode. If you have an 80 column monitor available, clear the 80 column creen s and type the following: POKE 54784,25: POKE 54785,128

le he

low byte of address ( + I) of end of memory = high byte of address ( + I) of end of memory

=

For example, if you want to save all the variables (except dynamic string data) created by a Basic program, type: SYS 3072, PEEK(47), PEEK(48)

IF LOX K$1F 00 06 STX $0600 00 06 BIT $0600 FB BPL SCDCF' OJ 06 STA $0601 RTS

SYS 3077, PEEK(51 ), PEEK(52) Be sure that no more than 16K of memory is involved. Then type: SYS 3082,0,0, 1 31

.lily '1986: � 7, .._ 01


You can also use the video RAM from C-64 mode. The eighty column screen will be accessible. provided that you've used the command "G064" after first booting in C-128 mode. Listings "3 and *4 are the C-64 mode versions of the MEMORY and BASIC DRAM programs. They are relocated to start at 51200 ($C800) in the C-64 memory map. This is half way between the popular 49152 ($COOO) location used by many machine language routines and 52224 ($CCOO) used by the DOS 5. I wedge.

The first two numbers after the SYS address are the low/high vector to the location in video RAM where the memory will be stored. The third number is the Bank number of the memory to be copied. For variables. this would be Bank I . After storing to RAM disk. type:

PRINT PEEK(25 1), PEEK(252)

To use the C-64 MEMORY DRAM, enter:

This will give you the low/high vector of the next available location in video RAM. You can store several blocks of memory and retrieve them

SYS 5 1200,1b.hb

independently by keeping track of their video RAM starting addresses.

SYS 512 12.1e,he SYS 5 1 224,0,0,0

To get the data back. set up the starting and ending addresses as above. Then SYS to the routine using the same video ram address vectors. Add • 128" to the Bank number to signal the routine to retrieve from the video RAM rather than copy to it. If retrieving variables for use with Basic. you should also POKE the appropriate values in locations 47 I48 and 51 /52.

The three zeroes after the last SYS represent any low/high byte address in video RAM and the flag to store or retrieve memory. Since there are no Banks in C-64 mode, use a zero to store and 128 to recover.

If you want to use the eighty column text screen, you can still have access to 4K of disk RAM. The area between video RAM addresses 4049 and 8191 is unused in text mode. II you store more than 4K in this area, you'll

For C-64 BASIC DRAM, SYS 51200 to initialize the program. The same three commands are added and follow the same rules as C-128 mode, except that additional commands cannot be used on the same line as

overwrite the character set data.

MLOAD.

Listing "2 is a Basic loader for a routine to SAVE and LOAD Basic programs. As before, enter the program, RUN it, and type the following to SAVE the machine code:

To disable BASIC DRAM in either mode. use the reset switch near the on­ off switch or manually change the ERROR vector at $0300/$030I to its default value. The BASIC DRAM (for both modes) is a compromise

BSAVE • BASIC DRAM • . BO. P2956 TO

between features and length. It will give you a " DISK FULL· error if you try to SAVE more than ten programs. But it doesn't check lor actual memory left in video RAM. I I you SAVE something too large. the address registers will merrily · roll over · to zero and store on top of data you've already placed there.

P3573

To activate the routine enter SYS 2956.

Assigning numbers to the programs is another compromise. It would have been best to intercept the LOAD and SAVE routines, assign an unused device number to the RAM disk. use file names, etc. This would have required a lot more code, too much to type in from a magazine listing.

BASIC DRAM Adds 3 Commands to the C-128. MSAVE

MLOAD

SAVEs the Basic program in memory to RAM disk, assigns it a number, and shows the amount of memory remaining in RAM disk.

Possibly the most significant compromise was made to allow the RUN­ STOP/RESTORE key combination to halt Basic programs. The C-128 RESTORE routine clears both screens when executed. Since clearing a RAM disk isn't what we had in mind. the NMI vector is relocated to point to

LOADs a program from RAM disk to the current Basic memory space in Bank 0. The command must be followed immediately. no spaces, with the number (0-9) of a program already MSAVEd.

an abbreviated routine that leaves the RAM disk alone. The normal RESTORE resets several pointers, NMI among them. Since we can't have that either, the pointer routine was also eliminated. RESTORE uses several JSR calls to ROM routines. To leave out only small portions of these routines, we would have to put the balance of them in our program. and you would have to type them in. Instead, we've left out several of the JSR calls, and kept the minimum to get Basic to work properly. II you have a favorite program that uses any machine code, test it thoroughly when using it with BASIC DRAM.

MSCRATCH Asks lor a starting program number and ·scratches · that program and all programs with higher numbers from the RAM disk. MLOAD can be followed by a colon and other commands in direct mode. For example:

These problems don't plague the C-64 version. There is no eighty column screen to clear on a C-64, so RESTORE doesn't have that function. We can leave the normal NMI routines intact.

MLOAD2 : RUN

will place program "2 from RAM disk into memory and RUN it. We did have to add some code to the C-64 version. however. The SYS command in the C-128 looks for values separated by commas following the SYS address. The first three will be transferred to the A, X, and Y registers of the 8502. This makes passing values to ML short and sweet. (A fourth value will be placed in the Status Register, but beware of that' The value placed there will affect all the flags, including decimal mode. The processor will also set bit *5, the unused flag, even if your passed value left in clear.)

The C-128 has two 256 byte pages permanently designated lor RS-232 use that sit below the Basic program area. These are destined to become popular " safe " locations for machine code. The MEMORY DRAM code is located in the RS-232 input buffer. The BASIC DRAM program is longer and uses both buffers and the top of the tape buffer as well. If you RUN a Basic program that uses any of these buffers, the computer will probably erash " .

39

� 1916: Volume 7,1- 01


The C-64 doesn t have this feature, and to keep the commands the same, '

the code must be added. We also needed to add the routines to access the register and data ports for the video chip. Both BASIC DRAM's use the error wedge technique described by Brian

Munshaw in Transactor 5-6 ( · A New Wedge for the Commodore 64 ) The three added commands cause a ·syntax error· . Our program inter­ cepts all error messages and passes on any except syntax errors. These are examined for the use of an illegal character in front of a LOAD. SAVE. or •

.

SCRATCH token . Since any illegal character will work, XSAVE will have

the same ellect as MSAVE. The C-64 doesn't tokenize the word · scratch ·. so some additional code is required. To eliminate excess typing, we've decoded only the • sc •

portion. MSCREAM will work as well for MSCRATCH.

We hope that you enjoy experimenting with RAM disk and find it useful.

10

G8 AI EM

2060 data 1 4 1 , 1 79,

FF MC GL AG NE MC AN IK

2100 data

u

each program as you need it. This would be a real advantage to anyone using a 1541 /C-128 combination. The Merlin source code for the DRAM programs will be found on The Transactor Disk for this issue.

II you'd prefer hard copy of the source code,

mail S2 (either Canadian or US) and a large addressed envelope to:

El

EE PC KM HK ML CP MJ Kl

13, 1 4 1 ,

0, 224,

1 1 , 240,

2 1 1 0 data 201 , 1 47, 208, 2120 data 148, 240,

25. 3,

32, 125

2150 data 255,

13.

18,

82.

65,

77.

32,

68

2160 data

73,

83.

75,

32.

70,

85.

76,

76

2170 data

27,

81. 141,

0,

32, 142. 201,

76

Jl

2200 data

13, 232.

32. 204, 205.

OF

2210 data

18, 133. 253. 229.

2220 data 1 73,

12.

17.

2240 data 133. 252, 160, 32, 1 1 6, 255,

2260 data 208,

32,204, 205. 185, 225

45, 133, 251 , 1 65,

46

o. 162,

2, 230, 252. 165, 251, 197, 253

2270 data 208, 234. 165, 252. 197, 254, 208, 228 2280data 164, 200. 200, 200, 162,

18,

2290 data 205, 133. 252, 153. 224.

13, 232.

32

2310 data 125, 255, 1 4 1 ,

83,

65.

86.

69,

68

79.

71.

82,

65,

77

0, 1 74, 223.

13,

32

2370 data

32. 125, 255.

32,

2380 data

83,

32,

82.

2390 data

73,

78,

2400 data

65,

77,

2410 data

27,

81, 141,

1050 data 133. 251, 134, 252. 1060 data 254. 1070 data

96, 133, 253, 134

96, 133, 200. 134,201. 1 32. 250

72, 1 38. 1 62,

18,

32, 204. 205, 232

1080 data 104,

32.204,205, 160,

1090 data

42, 1 66, 250, 169, 2 5 1 ,

48,

1 100 data 255,

0, 1 65, 250 32, 1 1 6

32, 202. 205, 230, 251 , 208.

2

1 1 1 0 data 230, 252, 165, 251 , 197, 253, 208, 234 1 1 20 data 165, 252, 197, 254, 208,228, 162,

NM

1 180 data 236, 165, 252, 197, 254, 208. 230,

1 1 30 data

32, 218, 205, 1 33, 252, 232,

1 1 40 data 205, 1 33. 251,

18

32, 2 1 8

96,

41,

15, 1 33, 250

1 1 50 data 169, 251 , 14 1 , 185,

2.

32, 216, 205

32, 1 1 9 , 255, 230. 251, 208

2. 230, 252, 165, 251, 197, 253, 208 96

Listing Two 2000 rem save · O:bas dram.ldr • ,8 201 0 :

2020 for j

=

2956 to 357 1 : read

x:

poke

j.x:

ch + x: next

JJ

32,

80,

82,

0, 1 69.

32. 1 25, 255, 0,

62, 229, 252.

81, 141

32. 1 87.

12

66.

89.

84.

69

69,

77,

65,

73.

78

71.

32,

73,

78,

32.

82

32,

68,

73,

83,

75,

32

0, 238, 223,

13,

32

2420 data 142. 201. 162. 128, 1 08. 179, 2430 data

o. 132,

2440data

7, 186, 1 69,

98, 133,

2450 data

32,

93, 1 86.

2460 data

15, 205, 223.

2470 data

13,

97, 134,

0. 162, 96,

13, 144,

10. 168, 169,

2480 data 1 65, 200. 1 85, 224,

1 1 . 160 96,

32

8. 160,

3

32. 128,

3,

41

3,

76, 158

o. 1 4 1 ,

o. 255

13, 162,

18,

32

2490 data 204, 205, 1 33, 252, 232, 185, 225,

13

2500 data

32, 204, 205.

2510 data

32, 216, 205, 1 33, 254.

DP

2530data

G8 80 EO 8H

2540data 254. 1 69, 251 . 1 4 1 , 185.

H8 AA

27,

56. 169, 128,229.251

OM MH CM

MD

32

13,

OM EM CM HM

1 040 :

32, 2 1 8

2300 data 2 1 8, 205, 133, 251, 153, 225.

2360data 1 70, 169,

1030 if ch<>1 9056 then print · checksum error ·

o. 169, 251

32, 202, 205, 230, 251

PP

ch = ch + x: nex1

32. 202. 205 32

32,

AF IL DL M8 AM FL KE

16

46,

2350 data

poke j,x:

45,

56. 1 73.

18, 133, 254, 229.

2230 data 202, 205, 1 65, 2250 data

0, 255, 173

10, 1 68, 133. 200. 1 85, 224

81

x:

76

28,

18,

HI

12. 201

10, 1 44,

12,

3072 to 3183: read

76, 208.

13, 201,

2340data 187,

=

11

2140 data 223,

PE

1020 for j

3. 108, 1 79,

0. 1 4 1 ,

PO Box 58587

1010:

o

88,

13. 1 69,

32,

1 000 rem save · O:mem dram.ldr • ,8

96.

3.

60,

2330 data

98188

3

13, 1 62,

FM IL M8 LP NA A8 FE

11

24,

7, 201, 242, 208, 238,

EK

1 170 data

32, 216, 205, 133, 253 24, 1 65.

45

2520 data 1 3 3 . 2 5 1 , 1 0 1 . 253, 133. 253, 1 4 1 .

16

2550 data

18, 1 65,

46, 133, 252. 1 0 1 . 254, 133

32. 216. 205, 162,

2560 data 230. 251, 208,

o.

2. 160,

o

32, 1 1 9. 255

2. 230. 252, 165. 251

2570 data 197. 253. 208. 236, 165. 252, 197, 254 2580 data 208, 230, 2590 data 1 69,

32.

0, 1 4 1 ,

79,

79,

0, 255.

76, 1 62,

82

32. 125, 255

2600 data 1 4 1 ,

83.

67,

82,

65,

84.

67,

72

EJ

2610 data

32,

83.

84,

65,

82,

84.

73,

78

HJ

2620 data

71,

32,

87,

73,

84,

72,

32,

80

2630data

71,

77,

32,

78,

85,

77,

66,

69

2640 data

82,

32,

63,

32,

0,

NM EM u

2650 data 201.

o. 240, 249,

32. 228, 255

32, 210. 255, 201

2660 data

48. 144,

2030 if ch<>69893 then print ·checksum error·

PG NO

2670 data

15, 205, 223,

13, 176,

28. 1 4 1 , 223

2040 :

ON

2680 data

13. 133, 200, 230. 200,

6, 200, 164

ch

MG

3, 169, 195, 1 4 1 ,

Geoduck Developmental System

KH

JJ

2090 data 1 69,

1.

32.

1 1 60 data 166, 250,

OE LH

3, 169,

2320 data

HL 8P LA OL

JJ

0,

CG

Listing One

LJ

1 1 . 1 69, 1 8 1 , 1 4 1 ,

Noel Nyman

Seattle, WA

LL GG CH

3. 1 4 1 , 180

2190 data

JN

,

29

1,

EA

disk reorganization session. Then a simple MLOAD• will quickly bring in

Disk Doctor

63. 208.

1 1 , 1 73,

2080 data 1 4 1 ,

2130 data

3, 201.

2180 data 1 82,

Directory Reorganizer, Two Column Directory Printer, etc. prior to a heavy

as

2070data

o.

JH

MN HA

For example, you could MSAVE several programs such

2050 data 120. 173,

I The Tta.\SOCtot

=

39, 201.

58, 1 76.

35,

41

J4it l9e6: � 1, .._ o1 I


KM

FP LK DO AD

81 KJ EO KL

J8

NO

OL IM

2690data 200. 2700 data 13. 2 7 1 0 data 182. 2720 data 78. 2730 data 82. 2740 data 85. 2750data 0. 2760data 169, 2770 data 32. 2780data 169, 2790 data 76. 2800 data 0, 2810 data 0,

FO MO

169. 0. 1 53. 224. 13, 1 53. 225 200, 200. 192, 20. 208, 244. 76 12, 32, 125, 255, 1 4 1 , 18, 73 86, 65, 76. 73, 68, 32. 80 79, 71. 82, 65, 77, 32. 78 77, 66. 69. 82. 27. 8 1 , 141 32. 142,201, 76, 1 82. 1 2 , 2 1 6 127, 1 4 1 , 1 3 , 2 2 1 , 172, 13, 221 6 1 . 246. 32, 225, 255, 208. 8 147, 32, 210, 255, 1 08. o. 1 0 51 . 255. 0, 0, o. 0, 0 0, 0, 0, 0, 0. 0, 0 0, 0, o. 0, o. 0, 0

HA

CJ DE EO MO IK KA KP NM

GC LB GA

LF HD

Listing Three

NO

GG HG

1000 rem save · 0:64mem dram.ldr • ,8

8J NO H8

1010: 1020 for j = 51 200 to 51374: read x: poke j,x: ch ch + x: next 1030 if ch<>26408 then print · checksum error" 1040: 1050 data 32, 152, 200, 1 65, 1 70, 133,251 . 1 65 1060 data 1 7 1 , 133, 252. 96, 32. 152, 200. 165 1070 data 170, 133, 253. 165, 1 7 1 , 133, 254. 96 1080 data 32, 1 4 1 , 200. 1 65, 169, 133, 167, 165 1090 data 170, 133, 168. 162, 18, 32, 1 1 5, 200 1 1 00 data 232. 1 65, 167. 32, 1 1 5, 200, 160. 0 1 1 1 0 data 165. 1 7 1 , 48, 37, 1 77,251, 32, 1 1 3 1 1 20 data 200. 230. 251. 208. 2, 230, 252, 165 1 130 data 251 . 197. 253, 208, 239, 165. 252. 197 1 1 40 data 254,208, 233, 162, 18, 32, 129, 200 1 1 50 data 133, 252. 232. 32, 129, 200. 133,251 1 160 data 96. 32, 127. 200, 145.251 . 230, 251 1 1 70 data 208. 2, 230. 252. 165, 251. 197, 253 1 1 80 data 208,239, 165, 252, 197, 254, 208. 233 1 190 data 96. 1 62, 3 1 , 142, 0,21 4, 44, 0

GC

=

CJ

El

HD KE NF

II

IG CO IP

DE BN FJ NH

DH GH ON BE

00 N8 BP BB

GG AE

FH

1200 data 214,

16,251 , 141,

MM KN AI

HI HG Ml DK

CG CP AA OA

DP EF JL KJ PF LP

1 , 214.

96, 162 1 2 1 0 data 31, 142, O, 214. 44. o. 214, 1 6 1220 data 251. 173, 1 , 214. 96, 32. 253, 174 1 230 data 32. 1 58, 1 73, 32, 170. 177. 132, 169 1240 data 32, 253, 174, 32, 158, 1 73, 1250 data 177, 1 32. 1 70, 32, 253, 1 74, 1260 data 173, 32. 170, 1 77. 132, 1 7 1 .

DE

JN LO CP JC

32, 170 32, 158 96

Fl HI OP

Listing Four

BA

2000 rem save " 0:64bas dram.ldr .8

OE MF

201 0 : 2020 for j = 51200 to 51 777: read x: poke j,x: ch = ch + x: next

Jl MG MN

FE 88 CF BP lA

PL FC MB

LL LO

LK BD HM JM

IN BO AP

2030 if ch<>67582 then print · checksum error "

HO GO

2040 : 2050data 120, 1 73, 0, 3,201 , 1 39, 208. 1 9 2060 data 1 4 1 . 29, 200, 1 73, 1, 3, 1 4 1 , 30 2070data200, 169, 3 1 , 1 4 1 , 0, 3, 1 69, 200 2080 data 141. 1. 3. 88. 96. o. o. 224 2090 data 1 1 . 240. 3, 108, 29, 200, 32, 121 2100 data 0,201, 147, 208, 3, 76, 234, 200 2 1 1 0 data 201 , 1 48, 240, 2 1 , 1 69, 1 , 133, 122 2120 data 32, 1 2 1 , 0 , 2 0 1 , 83, 208,228, 32 2130 data 1 1 5. 0 , 20 1 , 67, 208, 221, 76, 72 2140 data 201 , 1 73, 45, 202, 201, 10, 144, 1 0 2150 data 169, 170, 162, 201, 32. 30, 1 7 1 , 76

8A NO DA

GB BE Ml

GJ IE

4 1

2160 data 229, 200, 10, 168. 133, 167. 1 85, 46 21 70 data 202, 162, 18, 32, 144,201. 185, 47 2180 data 202,232. 32,144,201, 56. 1 65, 45 2190 data 133. 253. 229. 43. 32. 142.201. 165 2200 data 46, 133. 254, 229. 44. 32. 142,201 2210 data 165. 43, 133, 251. 165, 44, 133, 252 2220 data 160. 0. 177, 251, 32, 142. 201. 230 2, 230, 252, 165, 251, 197 2230 data 251. 208, 2240 data 253. 208, 239, 165, 252, 197, 254, 208 2250data 233, 164, 167.200. 200, 1 62, 18. 32 2260 data 158. 201 . 133. 252, 153, 46, 202. 232 2270data 32, 158,201 , 1 33,251. 153, 47, 202 2280data 169, 187, 1 60 . 20 1 . 32, 30, 1 7 1 , 169 2290data 0. 174, 45, 202, 32. 205, 189, 1 69 2300 data 203. 160, 201. 32, 30. 1 7 1 . 56. 169 2310 data 128. 229, 251 , 1 70, 169. 62, 229. 252 2320data 32. 205, 189. 169,207, 160,201, 32 2330 data 30. 1 7 1 , 238. 45, 202. 162, 128. 1 08 2340data 29, 200, 32, 1 1 5, 0, 1 76, 246, 41 2350 data 1 5 , 205, 45, 202, 144, 3, 76, 132 2360data 201, 10, 1 68, 185, 46, 202, 162, 2370data 32, 1 4 4 , 2 0 1 , 232, 185, 47, 202. 2380 data 144, 201, 32, 156, 201, 2390data 156.201, 133, 254. 24, 2400 data 251, 101. 253. 133. 253, 2410 data 44, 133. 252, 1 0 1 . 254, 2420 data 46, 160. O, 32. 2430 data 230, 251. 208, 2. 2440 data 197, 253, 208,239. 2450 data 208, 233. 32. 51.

18 32

133, 253. 32 1 65. 43, 133 133. 45, 165 133. 254, 133

156, 201. 145, 251 230, 252, 165, 251 165, 252. 197, 254

165, 76. 229, 200 2460data 169. 238, 160. 201. 32. 30, 1 7 1 , 32 2470 data 228. 255. 201 . 0, 240, 249, 32, 210 2480 data 255, 201, 48, 144, 39, 201 , 58. 176 2490 data 35, 4 1 , 15, 205, 45. 202:176. 28 2500data 1 4 1 , 45, 202, 133, 1 67. 230, 167. 6 2510 data 167. 164, 167, 169, o. 153. 46. 202 2520 data 153. 47, 202. 200. 200. 192, 20. 208 2530 data 244. 76, 229, 200. 169, 19, 160, 202 2540 data 32, 30, 1 7 1 , 76, 229, 200, 162, 31 2550data 142, 0,214, 44, 0,214, 16, 251 2560data 1 4 1 , 1 , 214, 96, 1 62, 31 , 142, 0 2570 data 214, 44, 0,214. 16, 251 , 1 73, 1 2580 data 214, 96, 1 4 1 , 18. 82, 65, 77, 32 2590 data 68, 73. 83, 75. 32, 70, 85, 76 2600 data 2610 data 2620data 2630 data 2640 data 2650 data

76, 68, 77, 66, 77, 73,

2660 data 2670 data 2680 data 2690data 2700 data 2710 data

73, 83, 67. 82, 84, 65, 87, 73, 32.

141, 32, 32, 89, 65, 78,

78.

0, 80, 0, 84, 73, 32, 75. 65, 82. 84.

1 4 1 , 83, 82, 79, 1 4 1 , 32, 69, 83, 78, 73, 82, 65, 32, 1 4 1 , 84, 67, 84, 73, 72, 32.

65, 71, 32. 32. 78, 77,

86, 69 82, 65 0, 32 82, 69 7 1 . 32 32, 68

0, 1 4 1 , 83 72, 32, 83 78. 7 1 . 32 80,

85. 77, 66, 69, 63, 32. 0, 1 4 1 , 18, 73, 2720 data 65, 76, 73, 68, 32, 80, 2730 data 7 1 . 82, 65, 77, 32. 78, 2740 data 66. 69, 82, 1 4 1 , o. o. 2750 data 0. 0, o. o. o. 0. 2760 data 0. 0, 0. 0, 0, 0, 0. 0 2770 data

71,

77 32

82, 78. 86 82, 79 85, 77 o. 0 o. o.

o

0

JWy t986: Volume 7, ._ 01


AmigaBasic Function Plot Chris Zamara, Technical Editor

An Auto-Scaling Plotting Demo

This program will open a new window with all the standard

window. Or, you can just remove the line altogether, using

gadgets and display the graph of a function within it,

the BASIC window with its original size and title.

including the X and Y axes. The graph always fills the entire window, and will re-plot to a new size if you resize the

To set up the function to be plotted, just change the DEF FN

window with its sizing gadget. The function to be plotted is

function definition as shown in the listing, and change the

defined in the program with a DEF FN statement, over a

DOMAIN I and DOMAIN2 variable assignments to define

range of X values defined by the variables DOMAIN I and

the start and end X values for which the function is evalu­

DOMAIN2.

ated. as listed, the program will plot the function Y = SIN(X) from 0 to 2rr, which is good for demonstration purposes but

Before plotting the function, the program finds the highest

a bit boring. Several other functions appear as comments,

and lowest values of the function so that it can scale to the

along with recommended domain parameters. Take out the

size of the output window. The message " Scaling . . . " will

comment character

be printed while this process takes place. After scaling, the

"DEF FN Y(X) =SIN(X)", then set up the DOMAIN! and

function is plotted, taking up the entire height of the win­

DOMAIN2 variable assignments to try one of the listed

dow, with the lines X = 0 and Y = 0 plotted in colour 2

functions.

" · "

(apostrophe) and comment out the

(default colour black). You can move the output window around with the drag bars in the usual manner, and if you

The program uses many of AmigaBasic's advanced capabili­

re-size the window, the program re-plots the function to fill

ties. It uses no line numbers or labels, using control struc­

the window at its new size. Since the function is only re­

tures to control program flow. The scaling and plotting are

evaluated for each pixel in the width of the window, you'll

done by local procedures, which only affect the required

find that the function plots faster when the window width is

variables and produce no side effects like a standard BASIC

smaller.

subroutine does.

When the output window is first opened by the program, it

The only bug I know about is that sometimes the function

is sized so that a function is aspect-ratio corrected. That is,

will re-plot twice after a window re-sizing operation. It

the X and Y co-ordinates are the same size on the screen, if

probably occurs when the window is re-sized between

not the same number of pixels. Thus, the function Y = X will

checks for window width and height.

describe a true 45-degree angle. This, of course, can be changed by re-sizing the window, stretching the function in

The method of providing the function to the program is

the X or Y direction.

obviously primitive. A more polished program could easily grow from the humble bit of code presented here today.

The output window is opened and selected by the following

Pull-down menus could be used to select functions and the

line in the program:

domain of the functions. A good idea might be a kind of "function construction kit", pulling out individual terms of

WIN DOW 2,title$,(5, 1 0)-(502, 1 1 5),31 'new window

an equation and combining them to create the desired

The above command will open a NEW window, leaving the

functions to be plotted on different windows, or maybe on

standard BASIC window in place. The window is also auto­

the same window. A fairly easy feature to add would be a

refreshed: moving it around won't mess up what's inside.

magnify function: pick a start and end point on the graph,

That takes up a lot of memory, so if you only have 256K,

and re-plot the chosen section. You could also get it to plot

you'll have to change it to WINDOW I , replacing the BASIC

pre-calculated data from DATA statements or a disk file.

function. Another good idea might be to allow different

42

JWy 1986: � 7, Issue 01


function plot from Transactor Magazine

· th1s program may be freely disributed

SUB scale{range1. range2) STATIC ' find max. and min. y values of funct1on ' from domain1 to domain2

· Mar 86- CZ ' Plots any function and scales

SHARED domain1 , domain2

' to the size of the output window. '

' Set the function using DEF FN below

PRINT • Scaling . . . •

' and set the range of X values ' with the 'domain1' and 'domain2' variables. pi

=

SHARED FN YO

3.141592

s = (domain2-domain1 )/WIN DOW(2) range1

=

FN y(domain1 )

range2

=

range1

FOR x y

'put your function below. . . title$ = • y = sin(x) " 'output window title DEF FN y(x)

=

SIN(x) 'use 0 to 2•pi for domain

=

=

domain1 TO domain2 STEPs

FN y(x)

IF y < ranget THEN range1

=

IF y > range2 THEN range2

=

y y

NEXT x END SUB

'. . .or try one of these ' DEF FN y(x)

=

SIN(x)

+

COS(2•x)

'domain= (0, 2•pi)

' DEF FN y(x) ' DEF FN y(x)

=

SIN(x)

+

2•SIN(15•x) 'domain =(-pi, + pi)

=

-5•x-2•x•x-3•x•x•x 'try (-10. + 10)

' DEF FN y(x)

=

SQR(9-x•x)

'(-3. +3)

SUB PlotGraph(ranget, range2) STATIC •

Plot Graph of function Y to scale of current output window

'.. set the doma1n of X values here doma1n1

=

domain2

=

SHARED domain1, domain2

0 'x start

SHARED FN YO

2•pi ' x end

window.width

=

WIND0W(2)-1

'make new window to display graph

window.height

=

WINDOW(3)-1

WINDOW 2,title$.(5,1 0)-(502,1 15),31 'new window

X.scale

=

(domain2-domain1 )1window.width

'find highest and lowest y values for scaling

Y.scale

=

window.heighV(range2-range1)

CALL scale{ranget, range2)

Y.zero

=

range2•Y.scale

X.zero

=

-domain11X.scale

= = = = = = = = = = = = = = = = = = = = = =

prev.width = 0: prev.height

=

0

WHILE 1 'continuous loop

'draw ax1s: lines y = 0 and x = 0

new.width

=

WINDOW(2)

CLS

new.height

=

WINDOW(3)

LINE (0, Y.zero)-(window.width, Y.zero),2 LINE (X.zero, 0)-(X.zero, window.height),2

'plot graph if window is re-sized IF new.width<>prev. width OR new.height<> prev.height THEN

'plot first point

CALL PlotGraph(range 1 , range2) END IF

PSET (0, Y.zero-FN y(domain1)•Y.scale)

prev.width

=

new.width

FOR x.pixel

prev.he1ght

=

new.height

WEND

'now plot whole function =

0 TO window. width

x

=

x.pixel•X.scale + doma1n1

y

=

FN y(x)

y.pixel

=

Y.zero - y•Y.scale

LINE -(x.pixel, y.pixel) NEXT x.pixel END SUB

J#t '1916: 'lololurM 7, .... 01


Kernel Routines In The 8 1 28

Liz Deal Malvern, PA

This is a list of 46 KERNEL routines in the 8128. It is somewhat different from the list in the Protecto/C8M Guide. Most of the routines in the 8128 are similar to the C64, but some call addresses have been changed, setup registers sometimes differ, and there is more impact on the registers than was the case with the C64. This list is also valid for the 8256 models which have the same Kernel ROM as the B 128. Some 8256 machines (in Europe) may have a different Kernel ROM. They can be distinguished from the most recent version by the presence of code in the "patch area", $ECBO-ECE8. Making this list would not have been possible without help from Jim Butterfield in the form of memory maps and a superb disassembler.

Unless otherwise noted, long addresses are normally sent/ returned in this order: A = bank11, Y = high byte, X = low byte of address. Usually in zero page, it is kept in the lo-hi-bank order. Often a register points to the first of the three bytes. A, X, Y are data registers. If unchecked, it means, positively, that the routine has no effect on the register. The "C" column refers to the carry flag. It is a rare subroutine that does not affect the C status. So to avoid ambiguous clutter, the only time C is checked off is when it means something. Much of the time i n the 1/0 routines C indicates an error. but ST does the job better - it may show an error while Cis clear. ST 64 at the end of file: this is not indicated in the table below. =

Jumbo Jump Table in Chronological Order - CBM names rt6c

jmp Sfe9d

;txjump

transfer of execution jump

ffb7

jmp $lb4a

;readst

read/set st

ff6f

jmp Sfbca

;vreset

power on/off vector reset

ffba

jmp $lb43

;setlfs

set files la,la,sa

ff72

jmp $le33

:ipcgo

loop lor ipc system

lfbd

jmp $1b34

;setnam

set file name length and adrs.

ff75

jmp $e022

;funkey

function key vector

ffcO

jmp ($306)

$16bl

;open

open logical file

ff78

jmp Sfcab

;iprqst

ffc3

jmp ($308)

$!Sed

;close

close/abort logical file

ff7b

jmp $19fb

;ioinit

send ipc request i/o initialization

ffc6

jmp ($30a)

$1549

;chkin

connect input channel

ff7e

jmp $e004

:cint

screen initializ ation

ffc9

jmp ($30c)

$1Sa3

;chkout

connect output channel

1181

jmp $1400

:alocat

allocation of memory

flee

jmp (S30e)

$f6a6

;clrchn/restio

reset default i/o devices

ff84

jmp $lba9

;vector

read/set i/o vectors

ffcf

jmp ($31 0)

$149c

;chrin/basin/input

input a byte from open ch

ff87

jmp $lba2

;restor

restore i/o vectors

ffd2

jmp ($312)

$14ee

;chroutlbasout

output a byte to open ch.

ff8a

jmp $1660

;lkupsa

match sa

ffdS

jmp ($31 a)

$1746

;

load

load from file

ff8d

jmp $1678

;lkupla

match Ia

ffd8

jmp ($31 c)

$184c

;save

save to file

1190

jmp $1b5a

:setmsg

enable/disable os messages

ffd8

jmp $190e

;settim

119:3

jmp ($324) $1274

:second

send sa alter I isten

fide

jmp $18e6

;rdtim

set TOD clock

ff96

jmp ($326) $1280

:tal ksa

send sa alter talk

ffe I

jmp ($314)

$!96b

;stop

ff99

jmp $lb78

;memtop

set!read top of memory

fle4

jmp ($316)

$143d

;getin

ff9t

jmp $1b8d

;membot

set/read bottom of memory

ffe7

jmp ($318)

$1671

;ciaII

close or abort files

ff91

jmp $e013

:cnkey s

scan keyboard

flea

jmp $1979

;udtim

last row KB scan

ffa2

jmp $lb74

:settmo

set ieee timeout

!fed

jmp $e010

;scrorg/screen

return screen size

lfa5

jmp ($328) $130a

:acptr

1110

jmp $e019

;plot

read/set cursor position

ffa8

jmp ($32a) $1297

;ciout

handshake ieee byte in

ffl3

jmp $e0lc

;iobase

return i/o base address

flab

jmp ($32c} Sf2ab

;untlk

send untalk to ieee

ffae

jmp ($32e) $12al

;unlsn

send unlisten to ieee

fff6

sta $0:rts

;goodbye

goes to another bank

lib I

jmp ($330) $1234

;listen

send listen to ieee

fff9

.byte I

ffb4

jmp ($332) $1230

;talk

send talk to ieee

Iffa

Hardware vectors nmi $fb3 1 , reset $1997, irq $fbd6.

The T ransac tor

handshake ieee byte out

read TOD dock

check STOP key

get byte from KB or channel

J4Ay 1986: Volume 7, 路- 01


8128 Kernel Routines CBM Label

Jump addr

ACPTR

FF.�!i

lnd Real addr ro e d 328 :!Oa I

,\LOCAl"

FFit I

---

CH KIN

FFCf;

CHKOUT CI IRIN

Operation Details

2 if lllnf'out

t;e r byte lrorn IEEE

oul: C = I ancl ST

1400

Allocat(' YX by1es relativt• to top of usrr m emory

in· X = low Y - hr�h out: C = I if failed (uS(' MEMTOI')

30a

f54�1

OJ*n channel lor input

FFC9

30..

fSa3

Open ch anru d for output

FFCF

3 lfl

f49<'

Input

=-

MOD A X Y ('

-

a -

- -

-

- r

MOD ST 0

-X y-

a xyc

in: X = logical filr ..

- X .. ...

(I X

(S('e CHKIN)

.. X ... ...

(I X ... ...

- - - -

a - - c

0

a ... ... ...

- - - t

0

- - - -

ax y-

a - --

- - - c

out: ("-0 if keyboard or RS232 if IE££ . C = I if no file.no dcvitt out: C = 0 if k e buard or IEEE (u>e ST) R$232 ri STOPped turnsC I

character

IN X A Y ('

y

... C

0 if scr�oen or I EEE ( use STt RS2:!2 if STOPpt!(l turr" C = I

out: C

CHROUT

FFD2

312

Hee

Output characwr

CINT

fF7E

---

e04'1

Initialize screen editor, t op of user memory. function

ClOUT

FFA8

3 2a

f297

Output byte 10 IEEE

oul: C = I and ST: I if time�Jut

Cl.ALL

FF£7

318

ff,7f

Close or abun all fil •s

in: A =dev• C= 0 aburts. doe> CLRCHN C = I dos e s until error. aborts files afte r fir�t c.• rror

d

- - c

(l

CLOSE

FFC:!

308

fSt:d

Clo;e one file

in: A = log. fi le' . C = 0 aho nsfile. (" =

a

- - c

a xy -

CLRCH N

FFCC

3()(>

f6a6

Rest o re drf;:.uh d c.· vicrs

- - - -

(I X - -

FUN KEY

FF75

- --

e6f8

Print/Edit function kt:y definitions

f13d

Get a byte

GETIN

FFF.I

:!16

keys

0

l real tlo;dile

X )'

C

- - y a - y-

out· XY unc hanged in R$232/IEEE C 0 in keyhoord.RS2:!2.1EEE (use �T)

- - - -

a xy-

out:bank i 5 .X= lo w.Y = high addr

- - - -

... X )' ...

(I

0

X }' ...

Print all dins- in: Y 0 in: Y = key• Edit keyA= zero pg plr to length o f dfn and long addr. =

0

axy-

0

e03a

Relu rns addres.< of 1 / 0 de" ices

---

f9fb

- -- -

a xy -

FF72

---

fe : n

Initialie z l/ 0 and TOD dock loop lor ot her prorcss or

- - - -

(1

IPRQST

FF7R

---

fcah

Send ipc requ e st

- - - -

a xy-

LISTEN

FFIJI

330 f234

Make IEEE de\' icc listen

in: A = device•

a - - -

a - - -

LKUPL J\

FFSD

---

l..ookup parameters for file•

in: A = log. fife• out A - log. file . X = dev• Y = sec <•ddr. C = I rf no file l .i\

.

a

IOBASE

FFF3

lOIN IT

FF7B

IPCGO

--·-

f678

- - -

Xy -

x

0

y c

'

LKUPSA

FF�A

---

f6fi0

Lookup paramercrs on known se<'.adcl rs

LOAD

FFD5

3 la

f716

Load alter call to SETLF$0SETNAM

MEMBOT

FF9C

---

Mid

Re•d/Set bouorn of

rncmory

- - y-

a x y

in. A bit 7 - 0 1 0 load. bit 7 = I 1 0 \' e rify, hils0-:1 de;l. bank' Y.X= de;tination addr hi.lo(X= Y = $FF to load at header addr out: AOYOX = long addro last byte in.

a xy -

a xy -

sel :

C = 0: A. Y.X = long addre' s. read: C = I ; A.Y.X =lo ng addre»

a x y

- - - a xy -

in Y - srcondary addres s out· A = log file". X = d e v • Y = sec •ddro C

=

I if no file rn<•l ch<·> SA

r

---c

c

MEMTOP

FF9!l

---

lb7K

Read /Set top ol rnernory

irr C = 0: A. Y.X = long add ress out: C = I: A.Y.X , long a<klre"

a x y

---c

a x y-

OPEN

FFCO

306

fGhf

Open a logical file

in: C = 0 for n ormal Of>en C I te rnp l EE£ channel. no I able.

---c

(I

read... in. C = J ou!· X = row Y-cotumn S('l- in C ::: O : X = row Y : rol urnn

- - -

r

- -

-

0

-

Xy-

PLOT

FFFU

---

c-025

R('aci/Sct cu rsor pos1tinn

- X

l mTIM

FFOE

---

1&6

Rrarl TOO clork in llCD ( :;<"<' book for hit assignments)

READST

FFil7

---

R>4a

Read/Se! ST

RESTOR

FF87

- -

-

(b;,2

Restore system default vectors

SAVE

FFD8

3k

f84c

Save any lllemo y r

SCNKEY

FF9F

---

dJ I 3

Scau keyt.»1rd

-

SCKEEN

FFED

---

r-0 10

R<· turn scre<·1 1 si( z ' X -= c<Jiu mns Y "" rows

SECOND

FF9:!

32:1

rl74

Send

SETLFS

FFBA

--

11>43

Set file pari1 mCt(•rs

in :i-\ = log. file . X = dev•. Y=- st>e addr

SF.TMSG

FF90

- -

-

R>5a

Enable/Disable OS frle»age>

in . .� bit 7 = I KERNEL nlS R . > uno bit 6 � I Control rnsR"'" .

SETNAM

FFilD

---

fb34

Set file name

SETfiM

FFDfl

f9(1<)

SE"!TMO

S.t TOO clock using BCD

FFAl

---

b74 f

STOP

FFE I

3 1 4 f%h

·1\LK ;

FFIJ I

332

TLKSA

FF %

TXJUMP

--·-

12�0

y

(.' t•

- - - r('Jd- Ill C - 1 set- 111 C=-0 A = value I<J �IQ to ST in. X = zem pg ptr I CJ 1ong start addr Y = zero pg ptr 10 long end add" out: ,\XY are NOT final addre < s.

- - - f

- X )' d -

--

(I X }' -

a - - c

- ---

- - - -

it X } -

... X y ...

a xy-

.1 - -

d

X }' -

- - - -

- X )' -

a - - -

-

-

• x r-

- ---

a - - -

--- -

in: A = le-ngth of file n ;:nn< • . X = zt•rt, pg l >lr to loug name addr

a x - -

a - --

in: bits as�ignment-St't' book s

·'y

-

a - - -

En•ble/Disable IEEE tim Nul

in: A bn 7 - II enable. bit 7 = I dosable

"

... ..

...

- - - -

Check Stop key

out: Z () if STOP not used; X undr a nged 1.= I il STOP u>ed. X ch.ngt-<1 by call to CLRCHN

- - - -

>e<:ondary adr; after li;ten

v alues

A ::.: d('vrce•

Make IEEE device talk

m

3 26 f280

Send srconc1a y r adcl rrs.s aftN talk

in. A .,.. secondary iiddr�

FFf>C

---

fe9d

Jounp to code at long adores> AYX

UDTIM

FFEA

---

�)19

Part of KB scan ( no clock work! ' )

UNI.SN

FFAF.

:J2e

f2af

UNTLK

Fh\ll

3 2c

VECTOR

FF8•1

VRES£T

FFfoF

-

-

-

(I

- -

-

a - - -

0

a - - -

(I - - -

0

d - -

a xy

- - - -

a - - -

Unlisten all IEEE devices

- - - -

Ct

f2a b

Untalk all IEEE devices

- - -

-

a - --

---

fha9

RAM v a. "1 ors storing

a x

f

a

---

0)('<1

Set bunon- rc �el code to bank 1 5 al X.Y

in C - 0 lllON�s U)Cr lbt at AYX to vt'fiOr arl'a tors to .c1ddr AYX C � I rnoves v ec irr X = luw Y = h igh

45

0

X- -

�' X )' -

logs k('ys. enter. + .-./,:\IOI)

0

y

- X \' -

r

... ... ...

x

0

0

y-

,·1 - - -

July 1986: Volume 7, as- 01


Unmasking The Kernal

John Russell St. John's, NF

- A collection of notes about using the 1 / 0 routines

Every programmer who takes up machine language soon runs into those puzzling phenomena known as the "Kernal Routines". Those who have already attained enlightenment use them with abandon and urge others to do the same, but they can be preuy darn confusing if you have barely passed the "LOA N$00" stage. At least, they were to me, armed as I was with only a C64 Programmer's Reference Guide and a copy of Supermon.

in the filenames in order to write anything to the disk escaped me for quite some time.

I was by no means an overnight success at learning machine language. At

Looking back, I can see that it wasn't really that bad. Once I learned the op-codes and the different types of indexing I could do anything I wanted to, limited only by my knowledge of the 64's input/output chips. Now when I'm asked questions about machine language by learners. I find I'm able to give detailed answers without referring to memory maps or the Guide because I was forced to figure such things out for myself and test them by trial and error.

first I shunned the machine language section of the Guide as if I was afraid the pages would bite me. But older. wiser heads assured me that if I progressed to the point where I needed speed beyond that of Basic, I would have to become involved with machine language. I was tough to convince, but eventually I was gripped with curiosity. And so one day I dedded to give M-L a try. I studied carefully the explanations and examples from the Reference Guide. I fiddled with Supermon. I printed the alphabet. I changed the colour of the screen, and finally figured out what numbers such as $0020 stood for. I memorized the mnemonics and their functions. I printed the alphabet again. But it was here that I was stopped cold. because I couldn't really cause anything to happen (aside from changing the screen colours and the ever-popular alphabet printing). I needed two things : y-indexed loops and Kernal Routines. The former were described well enough in the Guide, I just had to think a bit about where to use them; the Kernal Routines, however, were downright confusing. This might not seem like a major crisis - who needs them. anyway? What exactly do they do? Well, the easiest way to explain it is to say that without them. the only way to make the computer communi路 cate with the outside world (i.e. you or another user) is by poking information either to screen memory or to the mysterious "CIA chips'' (one bit at a time!). This did not seem to me to be a real possibility. so I set about to figure out exactly what the Kernal was all about. Don't laugh. but I thought that Supermon would understand the names of each routine, so I had commands like "JSR CHROUT" without benefit of an assembler (Supermon, Micromon et al, with their narrow format for entering instructions, are monitors). I couldn't figure out the order of many sequences. There are a host of routines that can be used to access the disk or printer, and just to be sale. I would always use as many as I could. Needless to say. it was a nice while before I could do anything with the drive or printer. My biggest beef was that many important routines, like "CLRCHN" are not identified as important, and routines like "LISTEN" {which I have never once needed to call directly) are not identified as unnecessary. How could that be a problem, you ask? I "listened" and "unlistened" my drive to death but never did a "CLRCHN", so I always ended up with a locked up computer. an error light, and a star file in my directory. The universal input/output routines are not identified as such, so I could never decide which one was the right one (CHROUT and GETIN are always best, with one exception - simulating a Basic INPUT statement). Also, there was no step-by-step guide to opening a file and performing 1/0 functions. I ran out of stack space in my head trying to follow all those preparatory routines back to the beginning. And pulling " ,s,w " or " ,p,w "

An extreme case? Learning disabilities? I was beginning to suspect that such had to be true. In contrast to my quick grasp of commands and techniques in Basic, I was a snail at learning machine language.

-

suspect that everyone has similar problems, at least starting off. And accessing the Kernal Routines properly is likely to be the highest hurdle you'll have to clear on your way to becoming a proficient M-L program路 mer. I

So:

here's my guide to using Kernal Routines.

- Learn the hex addresses of the important routines. Using the symbolic labels in an assembler such as PAL is all very well and good, but you'll have difficulty understanding disassemblies or other people's code other颅 wise. I find "jsr SFFD2" just as easy to type and recognize as "jsr CHROUT'. those who have access to an assembler can save themselves lime and bother by assigning labels to important routines early in a program (eg OPEN = SFFCO). For those who do programming which makes extensive use of the Kernal, save a PAL symbol table or a Library file (for the Commodore Macro Assembler) which consists of nothing but the labels and addresses of frequently used Kernal routines. Use a ".1st" in PAL or" lib" in the Macro Assembler to have the labels assigned automati路 cally. - However,

- To print a character to any device (including screen) use CHROUT {SFFD2). No need to ever use ClOUT, LISTEN. or SECOND. because the routine at SFFD2 checks to see if the character is going to disk or printer and calls these routines when they are necesary. s - To receive a character from any device (including keyboard) use GETIN {SFFE4). This does away with the need for ACPTR, CHRIN. TALK, UNTLK, and TKSA, for the same reasons as above. -Of course. this means that any time you want to send to or get from disk, printer, modem, etc. you must first indicate this to the computer {Aha' you say). After a file has been opened, use CHKIN or CHKOUT to select that file for the proper operations. To avoid serial bus confusion, use CLRCHN first. It's easier to remember if you put in a routine called "toprinter" or "fromdisk" which will call CLRCHN, then CHKIN or CHKOUT whenever necessary (or if you're not sure where your data is going to or coming from). .uy 1986: \!olume 7, .._ 01


;

- The friendliest routine to use both before and after doing disk or printer

••••

below is equivalent of: 'open 8,8,8, " name " '

•• ••••

work is CLRCHN ($FFCC). Anytime you perform input or output to

Ida

#$08

;the file number the computer refers to

peripherals, use this afterwards to make sure input and output go back to

ldx

#$08

;device number 8 - the drive

keyboard/screen. Use it often; you can never be too careful.

ldy

#$08

;secondary address 8 - anything other than 15, 0, or

]Sf

- Use CHRIN only as the equivalent of a Basic input statement, and in

1

is safest

$ffba

;setlfs - use the above numbers

exactly the way it's shown in examples. This is a bizarre routine which can

Ida

#$0a

; 1 0 chars in filename

have unpredictable results if not handled carefully. Try calling it a single

tdx

#<name

;the $34 in an address like $1234

time if you're not convinced.

ldy

#>name

;the $12 in an address like $1 234

JSr

$ffbd

:set the file's name

- When using LOAD and SAVE, don't use OPEN first. They perform OPEN

JSr

$Hc0

;do the actual opening

automatically.

ldx

#$08

;file #8 (NOT device 8)

JSr

$ffc6

;chkin - ignore keyboard, receive charac­ ters from file #8

- CLALL doesn't always do what you'd expect. Use the CLOSE routine on each individual file. If you're lazy (like me), have several files open, or have

(routine using $FFE4 to read from file)

a program crash with the drive light on and file number unknown, OPEN the disk command channel, then CLOSE it. This closes all open files to the disk.

so

:

never CLOSE the command channel if you're not finished with

••••

your other files. - If you are sending disk commands, using block read or write, checking the error channel. or anything that requires you to have the command

close file # 8

••••

jsr

$flee

;finished with disk for now

Ida

#$08

;file #8 again

jsr

$ffc3

;close file #8

rts

;and we're done

channel to the disk open. keep it open for the duration. It can't hurt, and • name .asc "O:test,p,r"

you will suffer no ill effects if it isn't closed at the end. There will, however. be nasty surprises if you close it before finishing up with your other files.

;filename goes below

- Sending a command to the disk is most easily done by setting the

;NB: users of monitors must poke their

filename to be the command (e.g. " sO:test " ) before performing the OPEN.

filenames into memory and figure

Then simply open the command channel. If no command is to be set, use a

out the hex addresses themselves

filename of length zero. Disk commands after the first must be printed to the channel, as in the Basic command printNIS, · iO" .

To save memory from $1234 to $5678 as " prog

- The READST routine ($FFB7) is used mainly to detect the end of a file

start

=

$1234

;start of ram to save

(this is the cryptic "EO! line" mentioned in the C64 Guide; it stands for

end

-

$5679

;end of ram + 1

Ida

#$08

on disk . .

"End Or Identity"). A loop using it would look something like this : $He4

tax

chrout =

$ffd2

tay

reads!

=

$Hb7

JSr

$Hba

;3 8's, as in above example

loop

=

Ida

#$06

;6 chars in filename

getin

=

jsr

getin

;get a char

ldx

#<name

;lower 2 hex digits of address

JSr

chrout

;print it

ldy

#>name

;higher 2 hex digits

reads!

;check status

$ffbd

;set the filename

and

#$40

;is bit 6 (EOI} still clear

]Sf

Ida

#>start

sta

$fa

;start of save

Ida

#<start

;goes into $fa,$fb

- When reading the error channel, a loop must be used to get characters

sta

$fb

;as lo-byte, hi-byte

until a return (chr$(1 3)) is received in order to turn off the error light.

Ida

#$fa

ldy

#<end

;because $fa was used above ;one more than

- If you get "searching for. . . " and similar messages when loading and

ldx

#>end

;end of save

saving with machine language you can turn them off with "asl $9d". This

jsr

$ffd8

;now save it

clears a certain bit and avoids the hassle of the SETMSG routine.

rts

JSr

beq loop

: yes, go back

name -

- Use drive and file-type declarations in filenames to avoid errors - don't call it · test · , call it

O:test,p.w

• .

The exceptions to this rule are LOAD

.asc

O:prog

and SAVE, which don't require file type to be specified. It is, however, possible to get a look at a sequential file by doing a LOAD of " name,s,r • .

;could be anywhere ; no file type needed for load & save

Notice that when save was used, there was no need to open a channel or

The resulting program is somewhat garbled, but it can be a useful time­

set an output device. Doing so can lead to a file with file type "del" in the

saver.

directory.

A few examples (in PAL format) should serve to make things more clear.

Of course, it's impossible to cover all aspects of the Kernal routines in a

Users of M-L monitors should use actual numbers and addresses in place

single article - you could write a sizable manual on their intricate

of labels.

workings. The best bet is for programmers to refer to a work like the Programmer's Reference Guide (hence the name) for detailed how-to-use

To open program file " test · on disk for reading . . .

information and the quirks each routine has. And, of course. keep reading The Transactor! 47


Kernal Who?

Evan Williams Williams I.ake, BC

I started computing when FORTRAN IV was popular and the machine filled the basement of one of the halls on campus. Interactive was a word used in teaching, not in programming. All jobs were run in batch

required information to the KERNAL routine. Some routines need no setup at all, while others need one or two previous routine calls to get things ready. For the purposes of this discussion we will use the C-64

mode; you punched your card deck. dropped it orr at midnight, and carne back at 3 AM to get the printout. A lew of the well-equipped physics labs had a PDP-4 model or two, a mini-computer. I n those days "mini" meant really small (like skirts). The PDP series was lucky

jump table as an example. Those of you using other models of Commodore computers. particularly the PET series. will lind the jump table similar, generally containing a subset of the C-64 jump table. II you have a machine language monitor handy lor your computer. (such as supermen. micromon. etc.) you should have a look at the section of memory starting at SFF8 I . When this area is disassembled. you will lind a sequence of "JMP $xxxx" instructions where "$xxxx" is an address of either a routine in the ROM or of an indirect jump vector.

to have 8k of memory installed, and many had 4k. I dropped out of computing lor a number of years. not being able to alford 2-3 million lor a computer or a van to port it around in. Then came PET. I eagerly laid out S 1200 dollars lor one of the first ones to hit B.C. back around 1978 and took it home to see what it could do. I soon discovered the great feeling of being able to change a program the moment a mistake was discovered. This was interactive programming. To add to this. the PET has one of the best screen editors ever implemented (long before IBM PC or Tl Professional). One thing led to another. and soon I was searching for a way to boost performance. There is only one really practical way to do this, and that is machine language. What's a KERNAL?

Machine language is SUPER SPEEDY compared to BASIC, but you have to do every little thing yourself and it is difficult to make your routines as flexible as BASIC. Fortunately, there is help. and it resides within the ROMs included with your computer. This help is in the form of a useful set of general-purpose machine language routines that perform a variety of functions. These functions are primarily input, output and internal housekeeping. The routines are set up so that they will access the correct device. passing information back and forth from your program in a simple and predefined way. This block of

In the case of an indirect vector the address of the actual routine will be contained in two consecutive memory locations starting with the one referenced by the "JMP" instruction. The target address is stored in the vector location with the low order byte in the low order memory address and the high byte in the high order memory location. For example. the CHROUT ($FFD2) routine (see table I ) vectors through location $0326 by means of a "JMP ($0326)" instruction in the jump table. When this instruction is executed, the microprocessor will fetch the two bytes contained in locations $0326 and $0327 and install them i n the program counter. Program execution will then continue starting at this new address. A very important feature of the routines using an indirect jump vector is the fact that the vectors are stored in R/W memory (usually known as RAM even though ROM's are also Random Access Memory). This means that the programmer may change these vectors to point to his own routines. or simply to a RTS instruction so as to disable a routine. "Patching" these vectors is a simple and effective way of adding or modifying the operation of the computer operating system. As an

machine language routines is the heart of the computer's operating system. and in the C-64 has a ROM chip all of its own to live in. Around these routines are built many of the functions utilized by BASIC or most any other program written in machine language. Because the routines are such a central element of the computer. the name KERNAL is applied. Many programming languages exist that have a core of predefined routines that may be used to assemble more complex functions. In these languages the central core routines are often called the KERNAL. The method of using these routines in Commodore computers is the same, regardless of which model you own. To Commodore's credit, the requirements for entering each routine and the results have been kept as constant as possible on

to BASIC by JMPing to the normal error routine (SE38B). Another technique lor changing KERNAL vectors, particularly those using direct JMP commands. is to copy the KERNAL to the underlying RAM and switching off the KERNAL ROM. It is now possible to change anything you wish in the KERNAL including any and all jump table

different machines.

vectors.

The Jump Table

Using The KERNAL

The jump table is the way by which all KERNAL routines should be called. This table is a sequence of ML jump instructions found near the

Most of the KERNAL routines require some form of setup before being called. Some. however. do not. Generally. the routines that reset or

top of memory. They are in the same place in all Commodore computers except lor routines that are unique to a specific machine. To call a KERNAL routine one must first call any prerequisite routines and then load certain registers with byte values needed to transfer

clear something do not require any preparation. For example. the RESTOR routine docs not require any prior KERNAL calls or register setup. When called. it will rewrite the jump table vectors starting at $0300 to the default values. An idiosyncrasy of the manner in which

example, new commands may be added to BASIC by changing the error message vector ($0300) to point to your routine. This routine would then use the CHRGET routine to re-get the offending statement and compare it to your list of valid commands. II no match were found then the accumulator value would be restored and control passed on

.JWy 1986: ďż˝ 7, .._ 01


-

this routine is written causes it to also write the jump table vectors to

sprite pointers on the disk. It functions by Iirst obtaining the location

SFD30-SFD4F. This happens because the routine

in memory of the lirst variable declared in a BASIC program and using

VECTOR uses part of the same code and is written to allow moving of

the contents of this string as the file name/command string to send to

the vectors. As a result, if you have anything important stored in

the disk drive. The KERNAL routine SETNAM is then called to set up

SFD30-SFD4F it will be over-written when RESTOR is called. RESTOR

system pointers to this string.

RAM locations

is one of the routines called when the keys RUN/STOP-RESTORE are pressed. (You will notice these bytes being over-written if you view a

The logical file number, the device number and the secondary

high-res screen at SEOOO, then RUN/STOP-RESTORE and view it

address are then loaded in the correct registers and the SETLFS

again.)

routine is called. At this point all that remains is a call of the OPEN routine and we have a open file. This sequence produces exactly the

before use. Probably the most-used such routine and perhaps the

1,8,2, " O:test,s,w " assum足 ing the string variable passed from BASIC to program 2 contained

most complex is CHROUT (SFFD2). This routine is used to output a

"O:test,s,w".

single character. The byte value of the character is placed in the

where in memory. All that is necessary is to place the low/high values

XX command and CHROUT is called using

of the start address of the command sequence in the .x and .y registers

JSR SFFD2. If printing on the screen is desired, no other setup will be

along with the length in the .A register (Accumulator) and call the

required. The CHROUT routine will examine several flags to find out

SETNAM routine.

More commonly, the KERNAL routines require some register setup

accumulator with a LDA

same result as the BASIC statement OPEN

The file name/command string may be located any足

what channel is to be used. If no channels are open or enabled, CHROUT will then examine the byte value and determine if it is a

Next in program 2 the CHROUT routine is directed to the device used

control character.

by file

" I by loading the .x register with the file number and calling

the CHKOUT routine. This means that any calls of CHROUT will send If not, the correct screen location will be calculated, the character

the byte in the accumulator to the disk. All values (0-255) are written

translated to the correct screen code, reverse printing checked, the

with no filtering of exceptions. After reading all bytes from the screen

value placed in screen memory, the color memory updated, screen

and sending them, the accumulator is loaded with the file number and

scrolling checked/done. line link table updated and more. When

the CLOSE routine is called. This closes the file and notifies the disk

done. CHROUT and all other KERNAL routines return with an RTS

drive that it is the end of the file. The CLALL routine is called next; this

command.

resets all I/O to the default channels and clears the file table.

The nice part is that the programmer does not have to worry about

Program 3 is the screen read routine and is very similar to program 2.

any of this. The KERNAL does it for you. Another well used routine is

The main difference is that the file opened is a read file (O:test,s,r) and

GETIN. This functions in almost the same manner as the BASIC GET

the channels opened are input channels. It should be noted that a

statement. When GETIN is called, with no channels open, a single

channel may be enabled for input using CHKIN without affecting the

character from the keyboard buffer will be returned in the accumula足

output channel when calling CHROUT. The same is true for output. It

tor. If the keyboard buffer is empty, the value zero will be returned.

is therefore possible to input from disk using GETIN and print to the screen using CHROUT. Conversely, input from the keyboard using GETIN and output to disk or printer using CHROUT is possible. An

PROGRAM I

important difference in program

3 is the use of a temporary storage

Program I is a simple input routine in machine language which uses

location for the index variable used in the .y register. This is necessary

the GETIN routine to fetch characters from the keyboard buffer. The

because all registers are clobbered by the GETIN ($FFE4) routine (see

program exits when a return is pressed. Only alpha-numeric input is

TABLE I).

allowed with no control or cursor characters recognized or printed. Unlike the BASIC input routine this program will accept up to

255

The file opened in programs

2 and 3 is exactly the same as a file

characters as input. It is not possible to move off the line as only the

opened by a BASIC program. Because of this, if a machine language

delete key may be used to edit. When the return key is pressed, the

program is to be used as a subroutine of a BASIC program, it is

program alters the pointer or the lirst BASIC variable declared by the

perfectly okay to open and close the file within the BASIC portion of

BASIC program to point at the input buffer. For this reason, the first

the program. It is recommended that when !etching data from the disk

variable declared in the BASIC program should be a string variable.

the GETIN routine be used instead of the CHRIN routine. The reasons

Upon return from this program this lirst variable will contain the input

are the same as for using GET in BASIC instead of INPUT in that

data. The length of input may be controlled by the second variable

GETIN will accept any and all characters. The nice thing about

declared in the BASIC program. This must be an integer variable with

machine language is that GETIN will work just as fast as the CHRIN

a value range of 0-255. Program I as written will use SCOOO to SCOFF

routine when all the overhead of BASIC is absent. Program 3 does not

as the input buffer. See table II for entry address and examples of use.

test for a valid character after calling GETIN since the file length is always constant.

Program I gets all input from the keyboard and puts all output to the screen. This is because no input or output channels other than the

PROGRAM 4

default ones have been specified. To get information from some channel or device other than the keyboard, it is necessary to call some

Program 4 is the most complex. This program provides instant

preparatory routines lirst. Similarly, to output to a device other than

checking of the disk error channel when the Commodore and control

the screen, some setup is required.

keys are pressed together. The disk status is printed on the top line of the screen and the cursor position is maintained. If it is desired to call

PROGRAMS 2 and 3

this program from within another program, the last instruction can be changed to a RTS, the error check BCS EXIT changed to NOP's, and

Program

2 is a low resolution screen dump routine. This program

the program called at BEGIN.

opens a file to disk and writes the contents of the screen including JIJiy 1986: '\lloMne 7, .. _ 01


Program 4 uses the serial bus communication routines in the KERNAL wilhout opening a file. The serial device is commanded "speak" with the TALK (SFFB4) routine and the secondary addres.� sent using the TKSA (SFP96) routine. The Commodore Programmers Reference Guide incorrectly states that to send the secondary address one loads the accumulator with the secondary address value and calls the routine. The GUIDE does not mention that the secondary address value must first be OR'ed with the hex value $60. To access the disk command channel, secondary address $6F must be sent ($OF OR $60 $6F). This applies only to the direct serial secondary address routines TKSA and SECOND. The SETLFS routine requires only the unmodified correct secondary address value. =

When program 4 is run, the interrupt vector at $0314-$0315 is set to point at the main body of program 4. Sixty times per second the system interrupt causes the code at START to execute. If a match between location $028D and SFE is found, the rest of the program will execute. If no match is found the normal interrupt routine is JMP'ed to. When the program executes a new value is placed in the count­ down timer $FE and the TALK {$FFB4) routine is called with a device number of eight. Following, the TKSA ($FF96) routine is called with secondary address $6F. This opens the command channel in the disk drive for talking {to the computer).

sequence from the com(Juter. This takes a few milliseconds and it is best to wait at least 100 milliseconds before sending a new command. This is one reason for the countdown timer logic in program 4. That logic is also implemented since program 4 is executed on the interrupt and these interrupts occur every 16.7 milliseconds. It is necessary to prevent the routine from being called by a second interrupt that occurs while the routine is still executing. In most interrupt driven routines this is not a problem but the serial bus communication routines have a nasty habit of clearing the interrupt flag thus allowing further interrupts. Something that is not specifically mentioned in the GUIDE is the fact that the KERNAL routines never call any routines in the BASIC ROM residing at $AOOO-SBFFF. This means that the BASIC rom may be turned off and the KERNAL used as much as you like. This allows you to use the 8k of RAM there for your own programs. Keep in mind that the BASIC ROM makes frequent use of the KERNAL so the converse is not true. Another system characteristic that is not mentioned anywhere is that sprites MUST be turned otl when the serial bus is used. It is not sufficient to hide them on the edge of the screen. they must be OFF! The VIC chip steals lime from the 6510 cpu when sprites are turned on and this will clobber the serial bus liming routines, particularly the EOI (end of information) detection. Your computer will occasionally miss the EOI signal and then wait until the sun burns out to get it. Using sprites does not seem to atlect the RS-232 routines since the timing windows are much wider.

Next the PLOT ($FFFO) routine is called wilh the carry bit set. This returns the row and column position of the cursor in the .x and .y registers. These are stored. The cursor is now set to the home position by a call to CHROUT with a value of $13 in the accumulator. Next the status byte (same as ST in BASIC) is set to zero. The ACPTR ($FFA5) routine is then called and the returned value printed on the screen by CHROUT. A call to READST {$FFB7) follows to determine if an EOI was sent. If not, the program loops to NEXT and repeats until READST returns a non-zero value. This indicates the disk has said all it is going to and isn't speaking to us anymore. We then try to reset tht! cursor back where it carne from and run into a problem in the PLOT routine. Unfortunately. the values returned when PLOT is called to obtain cursor position are not always the same as the values we must use to restore cursor position. The problem comes up when the cursor is positioned on a wrap line, ie. one that is longer than 40 characters. The restore position part of the PLOT routine incorrectly handles the row calculations. We must test the column position returned by PLOT and if it is greater than $27 (decimal 39) we must subtract $28 before calling PLOT. Finally we call the UNTLK (SFFAB) routine to untalk the serial bus devices and then JMP to the normal interrupt handler. PROGRAM 5 Program 5 is a BASIC program that generates a machine language prQgram file on disk. This file will contain all four example programs with the call addresses as listed in TABLE II. Just type it in and place a ready to use disk in the drive. Then RUN the program. The M L program can be loaded with LOAD " KERNAL WHO C I 00" ,8, I .

When using the system RS-232 routines it is only necessary to OPEN a file to device number two and output with CHROUT or input with GETIN after setting the correct 1/0 channels. Do not use CHRIN with RS-232 since CHRIN is dependent on receiving a carriage return to terminate the routine. Also, the RS-232 interrupt system uses the non-maskable interrupt (NMI) as does the serial bus. Therefore, you cannot send or receive RS-232 data and serial bus data at the same time. Another item of interest is the way the CLOSE routine handles the RS232 channel. II CLOSE is called then the RS-232 file is killed along with the butlers. The user port will be set to default 1/0 values. II the RS-232 file is to be closed without alfecting these things call the CLALL routine instead. This will wipe out the file table and set default 110 but the user port is unaffected and the butlers remain allocated. One problem with RS-232 is that when a RS-232 file is OPENed, the user port is set to a standard default condition. This means that il you were using some of the pins for certain non-implemented functions, such as telephone line control, your output conditions and port values may be disrupted. The only way to deal with this is to open the RS232 file "manually". To do this you will have to setup all the table and file flags, allocate butlers. set interrupt timers etc. yourself. A lull description of this process is beyond the scope of this article but may be the subject of a future article. Full details or the entry, exit and error conditions to be considered are in the Commodore 64 Programmers Reference G11ide. I have listed the KERNAL routines in TABLE I in order by address because the table in the GUIDE is in alphabetical order by label and that is very inconven· ienl when you are looking through a disassembly and trying to find out what routine is used.

Problems and tips A few problems have been noted when using the KERNAL routines to talk to the disk drive. If a UNTLK is followed immediately by a TALK command the computer may "crash". This appears to be caused by the drive not being able to respond to another command until it has finished some internal work thus causing it to miss the attention

Using the KERNAL is not dilficult. Many of the operations are not

much different from the way BASIC works. It saves time and will make life a lot easier for the programmer. 50

� 1986 : � 7, lslue 01


TABLE I Notes:

Commodore 64 KERNAL Jump Table In Address Order

Vector addr

Label

Call addr

lOIN IT RAMTAS RESTOR VECTOR SETMSG SECOND TKSA MEMTOP MEMBOT SCNKEY SETTMO ACPTR ClOUT UNTLK UNLSN LISTEN TALK READST SETLFS SETNAM OPEN CLOSE CHKIN CHKOUT CLRCHN CHRIN CHROUT LOAD SAVE SETTIM RDTIM

$FF84 $FF87 $FF8A $FF8D $FF90 $FF93•

-

$FF96•

-

STOP GETIN CLALL UDTIM

$FF99 $FF9C SFF9F SFFA2 $FFA5•

-

-

-

$FFA8• $FFAB• $FFAE• $FFB I • $FFB4• $FFB7 $FFBA $FFBD $FFCO ($031 A) $FFC3 {$031 C) $FFC6 ($031 E) $FFC9 {$0320) SFFCC {$0322) SFFCF ($0324) SFFD2 ($0326) $FFD5•'($0330) -

$FFD8• '($0332) SFFDB SFFDE SFFEI ($0328) SFFE4 ($032A) $FFE7 {$032C) SFFEA

Target addr

Function Description

Register Usage return entry used

$FDA3 SFDSO

initialize i/o ram test

- -

$FDIS SF'DIA SFE18 $EDB9 $EDC7 $FE25 $FE34 $EA87 $FE21 $EE13 $EDDD $EDEF $EDFE SEDOC $ED09 $FE07 $FEOO $FDF9 $F34A $F291

restore vectors move vectors control kernal msg send listener second send talker second set top ram pointer set start ram point scan keyboard set IEEE timeout input serial byte output serial byte untalk serial bus unlisten serial bus listen serial device serial device talk

-

$F20E $F250 $F333 $FI57 $FICA $F49E SF5DD $F6E4 $F6DD $F6ED $FI3E $F32F SF69B

read i/o status byte set-up logical file set file name open a logical file close a single file enable input channel enable output chan set chans to default

input characters output a character load to memory save from memory set jiffy clock read jiffy clock test stop key get char from chan clear/close files update jiffy clock

-

a - -

a xy a xy a xy a xy a - a - a - -

- x y

- x y

- X

- X

- X

- - -

- X

y

- - -

-

-

-

- X

y

- - -

a -

-

a-a-y

- - -

- -

- - a - -

y

- - -

a- - - a- - -

- - -

- - -

a--

-

a- a- - - a xy a xy

- - -

a -

-

- X -

a - a- a - a - a- a - - - - -

a-

-

a a a -

-

-

-

X

-

- -

- - -

- - a - -

a a - -

a a a -

a xy a - -

x x x -

-

y y y -

- -- - - - - -

-

Program I

-

-

- - -

a xy a -a - - - - - LOY

y - X y a xy a -a x-

-

-

a a - a - a - a - -

-

a x y a x y axy a x y a x a x a x -

a

x -

$FE

DEC $FE

ter contains the high-order byte. Detailed information on using specific routines may be found in the Commo­ dore 64 Programmer's Reference Guide.

Serial 1/0 routine only, not com­ patible with some IEEE-488

adapters • • These routines use an indirect jump link AFTER being entered

:buffer pointer ;loop if buffer empty

:delete by decrementing pointer

NODEL

:save .a in the .x register

TAX AND #$7F

:remove high bit from char

CMP #$20

:is it a control character?

BCC LOOP

:if less than #$20 yes so loop

TXA

:restore character to .a reg

LOY $FE

:retrieve buffer index

CPY $FO

:check if limit reached

;index storage

BCS LOOP

:carry set, limit reached

LOA #$00 STA $FE STA $CC

:a zero 1n .a

:flag to flash cursorvariable offset

INC

LOY

:variable

BNE PUT

:if buffer not full skip to "PUT"

#$0A

offset

$FE

:increment buffer pointer

LOA {$2D),Y

:get low byte of second var

DEC $FE

:oops, buffer full so back down one

STA

$FO

;save it

;loop

JSR

$FFE4

BEQ LOOP

; " GETIN " , go get a charac ter :is it a zero? ;if zero then loop

JMP LOOP

CMP #$00

:is it a return key?

STA

BEO E N D

;exit if return pressed

JMP LOOP

;play it again sam

LOY #$02 LOA $FE

;offset to string variable lengt h

CMP #$00

The

When sixteen-bit values are passed in or out of a routine, the .x register contains the low byte and the .y regis­

JMP OUTPUT :jmp output

"

LOOP

nearly all KERNAL routines.

a- a x y axy a x y a x y a x a xy a xa x -

BEO LOOP

Keyboard input routine using GETIN and CHROUT with 255 charac­ ter buller and automatic BASIC variable access. Stores characters at $COOO-$CFFF. The first variable in the BASIC program should be a string (eg. a$= • ). When the program is called this variable will contain the i nput. The length of input is controlled by the second variable declared by the BASIC program. This variable must be an integer (eg. a% = I 0) and have a value of 0-255.

Registers indicated as being used in the "used" column may contain the same value loaded to call the routine. If no usage is indicated, then the regis­ ter is safe to use for other purposes. eg. indexing, counting, storing, etc. When GETIN is called for RS-232 input, the .x and .y registers are not affected. The processor status register and the accu­ mulator carry bit are affected by

a

CMP #$14

; is it

BNE NODEL

;not delete then skip

'hal dOCtor

PUT

STA

OUTPUT JSR

$COOO,Y :place byte in $c000 buffer $FFD2

LOA #$00

delete key?

END

51

$04

; • CH ROUT • - print the character ;zero

;disable quote mode

;buffer pointer

J4iy 1986: Volume 7,1Mue 01


STA ($20),Y

START

;put i n f�rst v ar i able le n gth byte

LOY

'$02

;offset to string length

INY

;i n c i ndex y offsetto poi t n er low byte

LOA

($20),Y

;get string length

LOA 11$00

;low ord er byte buffe r loc ation

BEQ

EXIT

;zero length, quit while ahead

;storet i i n string var iablepoi t n er

PHA

;save length on stack

;i n cr e me n t i n dex

INY

;increment index

;h1gh or der byte

LOA (S20),Y

;get low address of string

;stor e iti n str i n g v ar i ablepoi nter

TAX

;put in x

tur ; n off cur sor

INY

;increment index

;a spaceto clear the cur sor block

LOA

;pr i nt it.

TAY

;put in .y

; a nd r etur n

PLA

;pull length from stack

STA INY LOA

($20) ,Y

.¥$CO STA ($20),Y INC $CC LOA 11$20

JSR $FF02 RTS

.

($2D).Y

;get high order pointer

JSR

SFFBO

;SETNAM: set command string

LOA

'$01

;logical file ' I

LOX

'$08

;device '8

LOY

N$02

;secondary address

Dump screen contents to disk using name found in fi rst variable

JSR

SFFBA

;SETLFS: set logical file

declared in BASIC program calling this routine. The first variable

JSR

SFFCO

;OPEN

should be a string variable or the name may be rather str ange

BCS

EXIT

;if carry set then error out

LOX

'$01

;file number

PROGRAM 2

START

LOY

N$02

;offset to string length

JSR

SFFC6

;CHKIN: set input channel to file I

LOA

($2D),Y

;get string length

LOY

•soo

;zero index

BEQ

EXIT

;zero length, quit while ahead

STY

SFC

;zero index temp

PHA

;save length on stack

STY

SFD

;set pointer low byte

INY

;increment index

LOA

'$04

;start of screen high byte

;get low address of string

STA

SFE

;set pointer high byte

JSR

SFFE4

;GETIN: get a byte from disk

LOY

SFC

;get index temp

;get high order pointer

STA

(SFO),Y

;store byte on screen

TAY

;put in .y

INC

SFC

;increment index

PLA

;pull length from stack

BNE

LOOP

;not 256 yet?

LOA

(S2D),Y

TAX

;put in .x

INY

; increment

LOA

LOOP

($20),Y

LOOP index

JSR

SFFBD

;SETNAM: set file name

INC

SFE

;increment high byte of pointer

LOA

'$01

;logical file ' I

LOA

SFE

;get pointer high byte

LOX

'$08

;device ..8

CMP N$08

;done four pages yet?

LOY

N$02

;secondary address

BCC

LOOP

;if carry clear then no

JSR

$FFBA

;SETLFS: set logical file

LOA

N$01

JSR

SFFCO

;OPEN

JSR

SFFC3

;file number I

;CLOSE: close the file

BCS

EXIT

;if carry set then error out

JSR

SFFE7

;CLALL: restore default i/o

LOX

'$01

;file number

JSR

$FFC9

;CHKOUT: set output channel to file I

LOY

•$00

;zero index

STY

$FO

;set pointer low byte

LOA

..$04

;start of screen high byte

STA

SFE

;set pointer high byte

Fetches disk status and displays on top line of screen when the control

LOA

($FO),Y

;get screen character

JSR

$FF02

;CHROUT: output a byte to disk

and Commodor e keys are pr essed together.

INY

EXIT

.

EXIT

RTS

;return to BASIC

PROGRAM 4

I NIT

;increment index

SEI

;interrupts off

BNE

LOOP

;not 256 yet?

LOA

.. H,START ;high order byte of start

INC

SFE

;increment high byte of pointer

STA

$0315

LOA

SFE

;get pointer high byte

LOA

'L.START ;low byte of start

CMP '$08

;done four pages yet?

STA

$0314

BCC

;change high order vector ;low byte of vector ;interrupts on

;if carry clear then no

CLI

LOA

LOOP . . $01

;file number I

LOA

N$06

;match value

JSR

$FFC3

;CLOSE: close the file

STA

$FE

;save it

JSR

$FFE7

;CLALL: restore default i/o channels

RTS

RTS

;return to BASIC

START

PROGRAM 3

LOA

;return $0280

;load keyboard shift pattern

CMP SFE

;6 = control+ Commodore key

BEQ

BEGIN

;if pressed then do it

LOA

*$06

;countdown limit

CMP SFE

;reached yet?

Load screen contents from disk using name found in first variable

BEQ

EXIT

;if yes then continue

declared in BASIC program calling this routine. The first variable

DEC

SFE

;countdown one more jiffy

EXIT

should be a string variable.

BEGIN

The n a u s o e tor

52

$EA31 LOA ..$20

;finish interrupt

STA

;countdown location

JMP

$FE

;45 jiffys (.75 second)

.J<it 1986: "'*- 7,1aue 01


LOA •so8 JSR SFFB4

;TALK: command disk to talk ;secondary address 1 5

BO

1 00 rem object file creator for

JSR

•sGF SFF96

;TKSA: send second

KG

1 1 0 rem programs 1, 2, 3 and 4

BCS

EXIT

;error abort ;set carry bit

LOA

SEC JSR STX

NEXT

PROGRAM 1-4 Generator

;device nurnber

SFFFO SFB STY SFC LOA N$13 JSR $FFD2 LOA -soo STA $90 JSR SFFA5 JSR SFFD2 JSR SFFB7 CMP •soo NEXT

BEQ

;PLOT: fetch cursor location

:save it :save it too ;home cursor character ;CHROUT: pri nt it

SFFFO SFFAB

JMP

EXIT

130 rem

CC BL

140 print 150 get

MH

1 60 print"

EP

170 for i = 1to344: read a: ck = ck +a: next

Cl

180 if ck<>50143 then print

IL

;clear the status word

190 pnnt

KERNAL WHO? .

Williams 1986

disk in drive and press return. ·

"

a$<>chr$(13)then150 please wait "

:

in data

end ok, creat1ng disk program file·

;ACPTR: get error channel character ;CHROUT: print it ;READST: read status byte

DC

200 open1 ,8,2. "O:kernal who c100,p,w·

FG

2 1 0 restore: print#1 ,chr$(0);chr$(1 93);

EK

220 fon = 1to344: reada

;if zero

CB

230 pnnt# 1 ,chr$(a);

;get another character

OF

240 next: closet

MM

250 print ·

;move toy register ;clear carry ;PLOT: set cursor back ;UNTLK: untalk serial devices :finish

Call Address For Programs I , 2, 3 and 4

PROGRAM

HEX

PROGRAM I PROGRAM 2

SCIOO

49408

$C15F

49053

PROGRAM 3 PROGRAM 4

$CIA6 $CIF2

49574

DECIMAL

49650

All four programs are stored as a block occupying the space from SciOO to SC257. SCOOO to SCOFF is used as b uller space by program I .

Sample BASIC Programs

To call program I

To call program 2

10 clr: a$= · " : a%= 1 0

10 clr: a$= "O:screen dump,s,w "

20 sys 49408

20 sys 49053

To call program 3

To call program 4

10 clr. a$= • O:screen dump.s,r •

sys 49650

20 sys 49574

is a BASIC program that will gcueratc a machi ne language prog,·am 011 disk. This program contains the above four programs and will have 1he name " kernal who c I 00 " . Load this program with the command: Program 5

LOAD " kernal who c100" .8. 1

and press return

260 :

EE

270 data 169.

AF

280 data 177,

PO

290 data

DL

300 data 20.208,

0, 133.254, 133, 204. 160, 45. 133, 253,

o. 240, 249. 201.

10

32, 228. 255. 201 13, 240.

49, 201

9. 164, 254. 240, 237, 198

EL

310 data254.

NK

320data 32. 1 44, 225, 138, 164, 254, 196, 253

PH

330 data 1 76. 218, 230, 254, 208. 340 data 76,

76, 62, 193, 1 70. 4 1 . 127, 201

12. 193. 153,

AH

350data 255, 169,

NM

360 data 160.

OF

370 data

01

380 data 230, 204. 169.

Fl

390data

o. 192.

0. 133, 212,

2, 165. 254, 145,

0, 145, 2, 177.

5, 198. 254 76.

32. 210 12, 193

45, 200. 169

45, 200, 169. 192. 145. 32.

45, 240,

45

76, 210, 255, 160 61,

72, 200. 177

ED

400data 45, 1 70. 200, 177.

GN

4 1 0 data 189, 255. 169,

EF

420 data 32. 186. 255,

NF

430 data 162,

DO

440 data 253, 169,

LN

450 data 210, 255, 200. 208,248, 230, 254, 165

AK

460data 254, 201 ,

HC

470 data 195, 255,

HB

480 data 177,

FF

490data 170,200, 1 77. 45. 168, 104.

DH

500 data 255, 169,

Ml

510 data 186, 255.

MM

30 pnnt·pnnt a$

�one · : end

IH

IE

TABLE II

Then type NEW

EA

statements

;cursor x position SFB ;cursor y LOA SFC ;short line? CMP '"$28 BCC GOPLOT ;if yes go plot SBC ..$28 ;subtract 40

CLC JSR JSR

120 rem for ar11cle

;a zero

LOX

GOPLOT l'AY

PI

520 data

45. 1 68, 1 04.

1 , 162,

8, 160.

2

32. 192, 255. 176.

34

1 . 32, 201. 255, 160,

o. 132

4, 133. 254. 177, 253.

32

96, 160,

2

66. 72, 200. 177.

45

32,231, 255.

1 , 162.

8, 160.

32. 192. 255, 176.

1 , 32, 198, 255. 160,

Ll

530 data 132, 253. 1 69,

32

1.

8, 144, 240, 169.

45, 240,

32

32. 1 89 2.

32

39. 162

0, 132, 252 32, 228

FF

4. 133. 254.

540 data 255, 164, 252, 145. 253, 230. 252. 208

JF

550 data 245. 230, 254. 165.254,201.

8. 144

AE

560 data 237, 169,

PK

570 data 255,

PG

580 data 169,

MA

590data 133.254.

OF

600 data 240.

MC

610 data 198, 254,

76,

JO

620 data 254. 169,

8.

MD

630data 32, 150, 255, 1 76, 237.

ON

640 data 255. 1 3 4 , 2 5 1 . 132, 252. 169.

19,

JO

650 data 210. 255,169.

32, 165

KK

660 data 255,

CG

670 data

1 , 32. 195. 255.

96. 120. 169,194 1 4 1 . 3. 1 4 1 .

20.

21.

3

3. 88. 169.

6

96. 173. 1 4 1 .

1 1 , 169.

32. 231

2. 197. 254

6. 197, 254. 240. 49. 234, 169.

2

45. 133

32. 180. 255, 169. 1 1 1 56.

0, 133.144,

32, 210. 255,

32. 240 32

32, 183, 255. 201

o. 240, 243. 166,251. 165, 252.201

FP

680 data 40. 144,

OG

690 data 240. 255,

3. 233.

40.

32. 1 7 1 , 255.

24. 168. 32 76,

18. 194

.

53

,..., '1986: � 7, 1ssue 01


Adding Functions to Basic

Execute Machine Language programs inside your

Frank E. DiGioia Athens, Georgia

1541

How would you like to be able to add functions to BASIC with as much

parentheses? Suppose we make a function named '$' which converts

as you are able to add commands through the use of wedge

from ASCII Hex characters to internal floating point. Then we can

ease

programs? It can be done. And, in fact, it is just as easy to implement a

execute statements like:

function wedge as it is to implement any other type of wedge program. The natural question is, of course, if it is so easy, why haven't we seen

1 0 poke $c000,$b4

function wedges before? I think that the reason is simply because the

20 x = $aOOO 30 print $dOOO,peek($d000)

types of wedges we are most familiar with are the ones which are least suitable for adding functions.

or add a function named % for binary and you can If you try to think of a CHRGET wedge or an I ERROR wedge returning a function value, then, it does, indeed, look like a tough job, because

20 poke $033c,peek($033c)andoAl1 1 1 1

these types of wedges are not really suitable for returning values. We need a whole new type of wedge. In this article and the two that will

Admittedly, the above could be done with a USR function but by using

follow it, we will explore several different types of wedges which are

a function named '$' or

not in common use. but which have great potential for opening up

system.

' % ' we create the illusion of a new operating

new avenues of programming for those who desire to enhance the working environment of their computer.

How To Implement The Wedge

Why A Function Wedge?

Now that you are fully convinced that a function wedge is a worth· while endeavor, let us examine how to implement one. It isn't hard at

Perhaps you're wondering why we even need a function wedge. After

all. The vector we will be changing to point to our evaluation routine

all, Commodore was good enough to include the USR function in

is named IEVAL and is located at $030A/$030B. In addition to just

BASIC 2.0 which allows us to add our own functions to BASIC. While

executing our routine, however, we must tell BASIC whether the

it is very true that we can add almost any function we desire via the

result was string or numeric and where to find it. As far as the type

USR function, the advantages of a function wedge include the fact that

goes, storing a zero at location SOD indicates numeric and tells BASIC

many new functions can be defined at one time as well as the fact that

to look for the result in the FAC (fhe floating point accumulator - if

with a function wedge, we are free to determine the number of

you don't know where or what that is, don't worry, there are ROM

parameters, method of input, etc. For example, take the program line:

routines that take care of all of that for you.). Storing a SFF at location

1 0 print !cosh(.5),!sinh(.9),!sec(.12)

$00 indicates that the result is of type string and BASIC looks on the temporary string stack to find it. If you don't understand how to set up a string, don't worry, we will use a ROM routine to do this for us, too.

While the purist may argue that the line could be implemented with

Our evaluation routine will default to type numeric and the ROM

USR functions, it would take several lines to implement and would not

routines we will use to set up a string will set the type to string so we

be nearly as clear as the above line. Further, what if you need multiple

never have to worry about setting the type flag ourselves. In fact, the

arguments like:

only thing out of the ordinary that we will have to do. is to set up the string descriptor if the result of our function is a string. You will see

20 z = 'mod(x,y)

how this is done in the example program.

You could say Z= USR(X),Y I suppose, but it just isn't the same.

An Example Function Wedge

Create A New Environment

At the end of this article is a very useful example of a function wedge that you can use and add your own functions to. It is activated by

While the above are good enough reasons for using a function wedge,

SYS49152 and is immune to RUN/STOP-RESTORE. Here are the

an even more novel way to use added functions is to change the

functions we will include and an example of how they are used:

BASIC programming environment. That is, give the illusion of adding new commands, and changing the capabilities of BASIC. For example,

The '@' function: Plot the cursor and return a null string. (Note: more

a function named @ that takes two parameters and returns a null

than one @ is allowed in one print statement). Type: STRING

string can be used to plot the cursor, thus creating a PRINT@(x,y) statement. And who says we need to enclose the function argument in

Ex.

pri nt@(O, 14) ·my report · ;@(2, 12) ·by john smith · Jliy 1916: \llolurne 7 , Issue Ot


The '$' and ' % ' functions: Convert HEX and BINARY characters to lloating point. Type: NUMERIC Ex.

poke$d016. peek($d016) and % 1 1 1 0 1 1 1 1

The '"' function: Convert from LO/Hl format to 1 6 bit lloating point. (This routine is included just as an example to show how to convert your results to lloating point if they aren't already). Type: NUMERIC

our function in line 2500 by telling BASIC where the string can be found. (Note that XPLOT (The @ function) returns a null string by reserving space lor a string of length zero before setting up the string descriptor.) Writing numeric functions is easy. Just be sure to leave the final result in the FAC. II you were doing an integer calculation, you can convert the result to lloating point in exactly the same way as the " function does it . See lines 2980-3020.

print #(peek(43),peek(44))

Ex.

could be used to read the start address of BASIC. To read any address,

Final Notes

just PRINT "(LO,HI). Finally, since all the above functions so far have been kind of off the wall, I will include a parser and some examples of functions similar to what you might add yourself: including a straightforward string function, !DSTAT, and a somewhat serious numeric function, 'MOD, which shows that even YOU can do lloating point operations from machine language. The !DSTAT function returns the disk status as a string. The status is cleared once it is read so save it in a variable if you need it. Ex. (Print A Sequential File) 1 0 open2,8,2, ·filename· : a$= 'dstat if val(a$)<>0 then print a$: end 20 for i = 0 to 1 : get#2,b$: printb$: i = st: next close2

The !MOD(X,Y) function returns the integer remainder from dividing X by Y. MOD has two sister functions, DIV and FRAC, which return the integer quot ient and fractional remainder, respectively. Ex.

The function wedge is the best way possible to add functions to BASIC. It is immune to RUN/STOP-RESTORE, it is compatible with almost every other utility that I know of including the DOS wedge and Epyx Fastload Cartridge (no, the $ commands do not conllict) and it provides a natural way to pass the results back to BASIC. Any of these new functions can be used in any way that an old one can be used. I.E. the following statement is perfectly legal: a = $ff0d•%1 1 0 1 1

+ sin(!mod($ffabcd,%1

1 1 01 ))

There are a few very minor limitations to the functions presented here. II you are like me, the first test you will try with the $ function is PRINT $ABCDEF. This will result in a syntax error because the BASIC keyword DEF is embedded in the number. Adding a space before the F will solve the problem (The $ routine ignores spaces). The only other limitation is that the MOD/DIV/FRAC group is intended to be used with positive operands only. Don't forget when using the @ function in direct mode that the screen will scroll if you print too dose to the bottom. This problem .can be easily fixed with a WAIT state­ ment. Try this line:

h i = !div(x,256)

print@(O, 14)" my report " @(2, 13)" by john

lo = !mod(x,256)

doe· @(24, 14)" page 1 " ::wait198. 1

zz =

!frac(x,y)

Any functions that YOU may want to add can be included via the 1 symbol which immediately causes parsing for the function name to execute. Although the source code for this example is fully commented, I will brielly discuss some important points for those interested in adding their own functions with this code.

How It Works

The wedge itself is very simple. If not for the ! commands. the wedge would only be a few lines long. When a function name starting with ' is found, control is passed to the parser which looks through the command table for a match and jumps to the corresponding address via RTS. That is, it places the address of the routine (minus one) on the stack and then executes an RTS (at the end of CHRGET) to ju mp to the routine. The parser code is well worth studying. If you want to add your own funtions to BASIC, simply put the name of your function in the TABLE being sure to add S80 to the last byte of the name. Then put the address- I in the ADRTAB and you are in business. The 'DSTAT function is straightforward and may be used as a model for adding your own string functions. It talks to the drive and then puts the length of the resulting string in .A and in line ·2420 asks BASIC where to put the string. DLOOP2 copies the string there and we end

I hope that you will be able to use the functions presented here and that this example will provide you with the skills necessary to add any additional functions that you may need. The next article, "Command Wedge", will focus on a wedge for modifying existing BASIC com­ mands. Before going there, try these relatively simple projects: (I) Add two functions !HI(X) and 1LO(X) which return the hi and lo bytes, respectively, of the number X. (2) add a function, !SIZE, which returns the length of the BASIC program currently in memory. (3) II you have two drives, make !DSTAT require a device number like !DSTAT8 or !DSTAT9. HINTS: (Don't read unless you are stuck)

( I ) Try something like this: Look at the definition of LO and HI in

terms of !MOD and !DIV above. Use JSR $AEFI to get parm into FAC. (This routine takes care of parentheses. etc.) Store FAC at TEMP. (See lines 4190-42 1 0). Get 256 into FAC (See lines 29803020) Store at MODLUS (See lines 4260-4280) Set flag for MOD or DIV as required and JMP to line 4300. (2) Easy. Subtract address of start of BASIC (found at locations 43/44) from address of start of variables (found at 45/46). Convert this result to FAC. (3) Simply replace line 2220 with JSR GETBYT. Then add some checks so that no one can hang it up by giving it a crazy device number. Have fun! .JIAy 1986: Volume 7, Issue 01


NO FK NL GP JC

HG

OJ

OB FO IN AH HL HO NO oc EN

NO DP

NB Nl PA II

FB HN DO HB

1 00 rem basic loader for function wedge 1 1 0 rem by frank e. dtgtoia 1 1/1 4/85 120 130 140 150

: for adr = 49152 to 49634:read ml cs = cs + ml:poke adr,ml:next 160 ifcs<>59800thenprint ·error tn data·

170: 180 data 169. 190 data 1 1 . 200 data 1 15. 210 data 240, 220 data 240, 0, 230 data 240 data 32, 250 data 169,

1 1 , 141. 3, 96, 0, 201, 2 1 , 201, 1 9 , 201, 76, 1 4 1 ' 193, 76, 0, 1 4 1 ,

10,

3, 169, 192, 1 4 1 0. 133, 13. 32 1 69, 36, 240, 22, 2 0 1 , 37 64, 240, 20. 201 ' 35 33, 240, 18, 32, 1 2 1 174, 76, 29, 1 93, 76 213, 192, 76, 13, 193 132, 192, 1 70, 168, 200

260 data 189, 136, 192, 240, 64, 232. 270 data 208, 2, 240, 243. 202, 189, 280 data 16, 8. 4 1 , 127, 209, 122, 8, 232, 189, 136, 192, 290 data 208. 300 data 16, 248, 232, 238, 132, 1 92, 310 data 76, 63, 192. 200, 152, 24, 320 data 133, 122, 144, 2, 230, 1 23. 330 data 192, 10, 1 70, 189, 153, 192, 0. 76, 340 data 1 52. 192, 72, 96, 350 data 360 data

70, 83,

82, 84,

PG FC

530 data 144. 56. 76, 73, 1, 1 4 1 , 139, 540 data 1 69, 0, 240, 550 data 32. 1 1 5, 560 data 32, 1 1 4, 193, 32. 570 data 1 93, 104, 104, 76,

580 data 1 62. CM 590 data 144, EJ 600 data 65, AG 61 o data 233. 91 620 data 50. F B 630 data 65, DA 640 data 72, BA 650 data 1 39. JL 660 data 176, JL 670 data 1 85, 1. MJ 680 data NN 690 data 250. FF

BG DA IC

BN AH MA JJ LE FG

I

209. 122 136, 192 240, 19 240, 37 0 160, 1 0 1 , 122 173, 132 72. 1 89

BD

DC

EJ DO ll PC CN GE MO AK GM

8. 175 65, 195, 68 0 65, 2 1 2 ,

5, 16, 144. 7,

149, 174, 230, 174,

188. 1 93. 14,

126, 121, 97, 202. 139, 193. 201' 7 1 , 139, 193. 56, 233, 201, 9 1 , 97. 240,

249, 1 25, 32, 174, 174,

720 data 193. 32, 212. 730 data 32, 15, 187, 740 data 188. 173, 139, 750 data 32. 83, 1 84, 760 data 1 69, 225, 1 60, 770 data 73, 184, 32,

187, 169, 230. 160. 193 32, 12, 188, 32, 204 1 93, 240, 23, 165, 97 173, 139, 1 93, 48, 1 3 193, 32, 40, 186, 32 204, 188, 32. 27. 188

780 data

The l'lai .... .... .

96,

178, 166, 193, 189,

0,

10 MM AN 10 OA BP JK CG MA

360

370 , 380 Jump 390 400 410 420 430

HP 440 parse< Ml

450 BH 460 Jl 470 HJ 480 IE 490. AG 500 ploop NJ 510 HH 520 FJ 530 MA 540 OG 550 IH 560 u 570 EN S80nex1 PN 590 El 600 cc 610 10 1620 CA 630 JH 640 10 650 ' BO 66011nd HL 670 HB 680 I L 690 KB 700. EO 710 X1 FJ 720

1 1

0 32, 1 1 5, 132, 98, 1 62 0 , 44 169. 32, 62, 1 93 32, 72, 193 189, 76, 40 0, 169, 0 16, 2 5 1 , 96

4, 133, 1 4, 44, 169, 1 74. 32, 700 data 1 93. 32, 212. 7 1 0 data 138, 173, 32,

176, 1 2 , 144, 206.

330

1 1

208, 176, 240,

FC BK ME BJ GB JJ EH

1

HL

NA BB

GA GK PF HA LN GA EP

0 56

.

Sla

type

.seuypellag

J$1 cmp beq cmp beq cmp

chrget ' # $'

.see what we've go1 .hex conve<SIOrlpllnt

Jump #'%'

Jump+3 ' #'@

beq tump• 6 cmp N ,. beq Jump+ 9 cmp ,.,

beq parse<

340 .not one of ours chrgol 3 50 J$1

BN

24, 32 180, 76 1 58. 183 32, 158 104, 1 68

24, 201 16, 56 4, 201 48, 96,201 176, 202, 76 1 5 , 72, 174 137. 193. 24, 1 0 1 ' 97 97, 104, 96, 76, 126 0, 44, 169 0, 169, 255, 1 4 1 , 139, 193, 32 1 38, 1 73, 1 62, 230, 160 187, 32. 253. 174, 32 247, 174, 162, 225, 160

210 220 230 240 250 260 270 280 290 300 3 10 320

KO DO

193. 139. 193, 1 59. 192 1 86, 1 38, 32. 180, 255 1 85. 32, 150. 255. 1 62 3, 232 255, 157, 60, 245. 32, 1 7 1 , 255. 202 1 2 , 193, 32. 125, 180, 172 1 85, 60. 3, 145, 98, 136 0 76, 202, 180, 32. 1 1 5. 192. 224, 25. 144, 3, 76

420 data 138. 1 4 1 , 430 data 1 2 , 193, IJ 440 data 16, 248. AO 450 data 32. 242, JC 460 data 72, 1 7 8 , 192. 40, 176, 0 , 32, 00 470 data 240, 255. 169. JB 480 data 202. 180. 32, 250, 174, JG 490 data 142, 1 2 , 193, 32, 253, IC 500 data 183, 138, 72, 32, 247. 0, J L 51 0 data 1 74. 1 2 , 193, 96, M L 520 data 32, 242, 192, 134, 99.

PO

=

&

HL LP

CE

Of 000 BH 1010 .tunct1on wedge JK 020 :by frank e d.goo OM 030 : 1 1 / 12185 Gl 1()40. .conven,ent start HM 1050. $cOO() KJ 1060. $0073 ,get by1e of text OJ 1 070chrget • 1080chrgot get same byle $0079 JG A 090 �e��al l S030a .evaluallon vectO< • JN !OOtype .type flag SOd MM I 10 . • • .omti<!IIZe rout+f1e GP 120 lnl1 Ida PO 130 N<lwedge sta 1eva1 M D 140 PE 150 Ida N>lwedge sta 'evo l • t JC 160 rts OH 1 70 CB 180 • NM 190fwedge • .thiS IS the wedge llaglor nume<IC Ida 1$00 NO 200

rem sys 49152 to activate

77, 79, 196, 73, 2 1 4 , 68, NO MO 370 data 142, 193, 145, 8, 134, G P 380 data 162, LJ 390 data 169. 1 1 1 . 133. 0, 32, 165. G l 400 data LK 4 1 0 data 2 0 1 , 13, 208,

LF

Functk>n Wedges Source C<>M

730 740 75 0' 760found 770 780 790

800 810 820 830 a•o 850 1860 t870 880 890

1

1

tmP Sae8d •

.

1mp tmP ,np ,np

hex b1n xplot expand •

Ida Sta tax tay

1$00 count

'"Y

Ida lablo.x beq error lOX

cmp ($7a).y bne next

beq ploop dex

Ida

bpi and cmp beq bne InX Ida

beq

,b1nary convers,onpllnl .plot functionp11nt .the # commandpront

use the parse<prtnt .set flags aga1n

.use O<IQinal rout1ne :tump table for Ins

parse & execute .clear all regs and counter

.1ncr text tndex .get table byte .end ot table ,1ncr table pointer ,empare with text .too next word

matehlkeeolooktng

($7a),y found xt

bump x down once end ot table WOtdpr1m nolhnd end of word .yes/mask llag ,IS 1t a matchpllnt .hooray"' .go back for mow

table x error

.frnd end of word .lookfO< negat ve end of table

table.x l1nd

um

bpi lind

.keep look"'!)

lOX one loy

point to next word word H '" table reset text •ndex search some more

ImP s

count N$00 ploop •

lny tya

C1c adc S7a Sla S7a bee rnc

. •

.execut1on rovune ,po1n1 10 next byte .upclate 1e><1 poonter

4

$7b

Ida count .get offsel '" table a asl ,multiply by two tax .use as 1ndex Ida adrtab + I )!11 by1e adr pha .as re1urn adr h1

J4iy l9t6: VoUne 7, .._ 01

I


AB

08

Ida

900

910

pna

20 NO 9 AA ON

930.

960 .

970

byte$00

"'p

;lo byte adr

:as return adr

$af08

.synlllx

your own addresses lo name

EA 830

lo

IH LK Ml GJ G K LC

E

��0 ; � 70

adrlab

CF

IP

error

·mo'.$C4.'1ra'.Sc3

word mod-1 .frac-1.div-1.dstat-1

K 100 110 .ds functiOO 120 $ffa5 ;get byte from senal MP 130 acplt BL 140 fa Sba number .secondary address BK I 50 $b9 MD 160wbuf S033c ;buffer lor strong DE 170 lalk .letl deVICe 10 lalk $1ib4 $ff96 :send 2nd adr talk KC 1 80 lksa untalk Sffab LK 190 ;free serial bus OA 200: cc �210dslat KM �22 ldx N$08 number (disk) 0 SIX ta ;filst address AE 2230 EH 2240 lxa latk GO 250 10 speak OH 260 Ida 1$61 15(01$60) sa HK 270 :secondary lal

pori

;device

sa

• •

fO<

• •

device

;tel dnve :channel

JSf

NJ

stl

280

BH 290 CH 300 . KH IG EH 3 AA 40 BK PA 360 EM CM 238 0:

310dloop 320 30 3 350 �370 IC 239 0 OB g400 NH �410 FC 2420 430 2 OP 440 . GM 450dloop2 LB 460 HE 470 CP 480

JSI

ldx •

JSf

sta

lksa

t$00 •

acptr

wbul,x

lOX cmp N$0d

bne dfoop JSI untalk

dex txa sta

len

ldy

len

JSf

Ida

sta

dey

$b47d

wbul,y •

($62).y

address

;send it 10 dnve

;read ;get byte from drrve

command channel

;store character

:carriage returnprint ;free

serial pori

.torgellhe <cr> ;pul leng!h in .a .save 1 ;reserve space for strong ;use length ondex

1

for :copy strrng 101 baSIC .get byteof strrng ,put on strrng mem bump po<nter down

HB 490 bpi dloop2 BP 500 $b4ca dsoptr on slack 0. OE 520 . .@(row,col) func110n - plot GB Ml 540 ,cursor and null MG • IC 560chklft ;check paren KH 570chkrhl • Saet7 • .check on comma Ll • GE 590getbyt Sb79e byte into x • HO 600plot .pfot/felch cursor

EE 51 530 550;

;pul

"'p

reMn stnng Saefa ;checktell paren righl 580chkcom $aefd ;gel $fifO IK j?610 . xplol

JM

D E

MH 640 LJ PO 660 DB 2670 bad NE 680chky CE AH 700 CF AO KD

2650

NO

JSI JSf

cpx

chrget

getprm 1$19

boc chky

"'p degal cpy bes bad

1$28

,get next byte

.get row/cd on xly .row kess than 25pronl .yes/check ooumn ;nolilegal quant :col kess 40prrnt ;no/trash it .rust for looks cursor :set len to zero

than

690 etc 710 lSI plot ;plot the 720 Ida #$00 fSr $b47d :reserve space 730 740 ;put desctptr on stack tmP $b4ca 750 . 760 gelprm ;gel (a.b) 1nto y JSI chkHt .check open paten 770 ;gel first parm 780 JSf getbyt fen 790 .save

ED MC IC EK BE JP 800 co 810

I

SIX

JSf JSf

lhe Ti ar .ac tot

x1

chkcom getbyt

11 here

.checkon comma :get second byte

pul in

lay

ldx

880

rts

len

.check dosing paren .retroeve 2nd parm pul on y ,retroeve Sl

1 parm

,

CF 890 len .byte$00 KM : EN 2910 ; ;!he W(lo,hi) NG EN :tolhi to bil number. CP • 61 expand = chrget jsr KD jsr getprm 00 SIX $63 JO sty $62 BO ldx 1$90 LD PE sec JK �0 "'p $bc49 0 . �

16

a

.keep � safe

chkthl

pia

860

2920 930 2940: 950 2960 970 980

byte byte 'di'.Sd6.'ds!a',$d4.$00

JSf

PC 870

MC

.tunc1100 calcula!IOO routines

OL

pha

EP 840

JJ .dala !abies - add CD 980 .rou11ne names and AM 990 .here be sure 10 add $80 character of CF and JO :subuact t trom the address

;last �010 KF �020 : CB 12oJo !able JC �0

txa

FF 820

:execute routm

riS

940COUOI MM 950 error 08

adrlab.x

command-- convert

Jo!O

;gel nex1 byte oltexl .get parms 1n10 xly

.lo byte on $63 .h1 byteon $62 :Sal to ,don't rnvetl manltSsa .convert to lac

exponent 15

ME GF J040. ,hexlbonary conversion routone -00 BP ;thiS routone conver!S ascn AE �70 ;hex 01 binary numbers 10 floaling LL 3Q80 ;po1n1. II

EJ

'

IOOaddbyt 1legal

$bd7e $b248 Sb97e

110 120 ollow 130 exp $61 1 40 . 150 hex Ida f$00 1 60 .byte $2c EO 170 b1n Ida f$01 O A 180 flag 190 zero JSI GP 200 , EE 32101oop jst chrget 2 20 FE J beq cdone 230 convrl oncexp AO 240 JSI Ml 250 acldbyt 01 260 loop JITlP MD 270. 280 quil pia pia CG 290 PK 300cdone jmp chrgot EG 310. AD 320 .hex/bin subroulines IH 30 . MF �40Zet0

GA MJ AO KL NC HM

=

=

sta

LJ

JSf

NF

JSf

EG

LN

DP

=

�50

AK 3370 : EP DL

DC 00

zich

400 ��10 3420. �30convn

CN OP CG �440 AJ �450 EO �460 GM �470 HN EA �490

Ida ldx

t$00

1$05

stl exp.x dex

bpi rts •

zilch

bee dig11 fdx flag chkerr cmp bee qu11 cmp bes chkerr sec sbc 1$07 ldx flag

bne

N'a' N'g'

J480 MF tlsoo HO �510 AL �5 20 fA 3530drgit 0 IG �54 beq okay cmp FE �550 NG � 0 err2 56 PE �570okay bcs

CM CP Gl

��

�600 . GK �610 Chkerr NH 3620 NG 3630 MA � 640

OA J 650 NG 66 0err2 MM GN 680, IN HJ CP 710

670; 6901ncexp 700 co �720 EK �730

sec

sbc

r1s •

1'2'

1530

N$41 N$5b

cmp bee qu1t cmp bes qurt fmp iegal e

beq

exn

ldx

pha ldx flag

57

clc adc bcs

�77 0

1ncr.x exp errI exp

.get WlCr on a

exp

add

to WlCt.

.overflow error ,update exponenl byte .a

�780 .relr.eve 10 �7 90 OM J rts 800 exrt IF 3810: 20 err! "'P oflow CP 38 byte $04.$01 JE 3830 incr LH 3840 flag .byte $00 AI 850; Kl 860; co 870 ;divlmodNrac -- these roulines respectively Bl 880 .relurn the 1ntege<-quol1en1. ;1n1eger-remaonder. or fractiOnal ll LE 900 ;part of the quocrent ML 910: $61 .adr of exp ollac GL 920exp .copy lac to arg $bcOc facatg EN 940tacmem $bb(j4 .stOle at (xly) mdrv ,d1111de by $bbOt .subtract lac lrom arg Cl � subtrt $b853 Ml 70mmu� $0028 ,mu� lac by (a/y) .convert onteger CM tacont $bccc MA J990round ro nd l ac Sbelb FC addS Sto lac $b849 ;gel numeric parm on1o tac MM 010frmnum Sad8a KC 020 ; ED 030; ;enlry for d1v ON 040 dill DD 050 ;llag for div Ida *SOO NB 060 ;sk1p next instr .byteS2c EL 070mod .entry for mod Ida 1$01 .flag 101 mod GH .sk1p next 1nstr LD .byte S2c enlry 101 !rae Cl 100 EK 1 0 Ida ISH .lfag !Of lrac sta flag JO 120 .Sal the flag 130; NO 140 ;get lac and 2nd 150 ;parm arg GL 160; .open parenprrnl KH 170 JSf chklh frmnum ,gel value BG 180 JSI PO 190 ldx W<lemp ;lo byte of address DO 200 ldy W>temp ;h1 byte of address J G 210 facmem ;place temp jsr EC 220 jsr chkcom .commaprint .gel 2nd parm frmnum 230 jsr OJ

stl pia

890

alb

LN

-

lac adr on lac mem

LA

=

mem

980

.

;flag 101 hex ,sk1p nex1 1ns1r .flag 101 b1nary 11ag .set lac to

zero

.get next char

,end of stalement

.convert from asc11 ;mer. lac exponent the byte to lac

:add

;pull return adr ;set flags & ns

,sel lac to zeto .here's !he zero .5 s.gn

bytes +

.zerooul byte

,bump ondex down .counte< rol overpront

dig1110 flagldrgltprrnl or yprrnt lower ·a·

:asci1 true value .chrgel .hex b1nar .binary non-drgil .check lim1t .less !han ,check upper hm11 .b1gget than T

for 7 drgn 1 .conver110

.account extta ;hex or binarypront .hex/any rs lone ,blllk lchec upper fmd .brgger than true value

quant w1th ·a· ·a· than

;check 1llegal :compare .tess !han :compare Wllh r ;grealer 'z' ;1lfegal quantily

u

;acid

-

:ova<flow

lac to hel

• =

;1ncrement exponent :gel exponen1 .lac• 0. don'! WlCr :save byte 111 a 1 olfsec .use flag 01

exp

Ida

;add a to lac ;illegal quanlity error :exponent ol lac

.save

740

EH MB J750 N3 J760 CL MO

080 090 1

lrac

LJ

-

lilst parm on

68

on

hrst

1n

oc

NK 240 AB 250; 00 260 EF JB

jsr

chkrhl

ldx ldy

l<modlus .get adr of modlus t>modfus on .stOle lac atmodlus

AE GJ OH OL CL EH LE PI CJ

Ida

270 280

10

290;

4310

facmem

JSf

ldy

4320

JSf JSf

• 340

350;

.closmg parenpr•1t

adrof 1st parm (lo) ,adrof lSI palm(h� md1v .lac lempNac lac facatg f<temp l>temp lacon!

JSf

xl.y

.arg

,lac

-

1nt(fac)

flag. div func110n 370 ;!hen done. etse con11nue 380; LE 390 Ida flag MP 400 beq done Al 4 1 0 ; JJ 420 ;must have exp 1n .a Ida exp KJ 430 jsr subtrt .lac arg - lac OM 440 . BA 450 .check tunc1100 360 ;check

ij

*

4460

JO MO

flag d !rae !hen done. else

FK �!�· 490 BB 510 OE

KA

AN PJ

GJ BO GE

MP

AN EG KA PC

500:

con1rnue

Ida flag

tlrno done Ida

t<modlus ,get address ol lhe l>modlus .modulus n a1 • modlus mmull ,lac • for roundoff addS tac1nt :11uncare

1 y lac 530 JSf 5 ;add 540 Sr garbage 550 tSr 560: 570done jsr round ;round the lac 580 590 ; 600modlus +5 610 temp +5 520

Cl 620. CP 630.end

ldy

)

rts

• • • • • •

J4itf 19t6: \A:IIurne '· ..... 01

I


Command Wedge

By Frank E. DiGioia Athens, Georgia

Modifying BASIC's Commands Everyone has their own ideas on how the BASIC interpreter should carry out certain commands. We've all caught ourselves thinking, "If I had wrillen this interpreter, / would have done thus and so. . . ·: The

fact ofthe molter s i that whoeverDID write the BASIC interpreter didn �

write itjust for you and me. They designed the interpreter anticipating

what the needs of the A VERAC£ user would be. Unfortunately, it was wn·uen some years back, when they expected the average user to own

a tape dn·ve and not be a particularly sophisticated programmer.

Well, times have changed. and thus it seems only filling that in this issue, which is dedicated to the ROM routines, we should discuss how to modify the existing BASIC commands in order to create a version of BASIC which is perfectly customized to OUR needs today. In the previous article we explored a new wedge which allowed us to easily add functi ons to BASIC. The vector that we used for that wedge

is named /£VAL and s i located at SOJOA/SOJOB. In ths i issue, we will be using !£VAL's twin sister, ICON£ located at S0308/S0309. These two vectors are almost identical in purpose, the only difference

between them being that /£VAL is used for evaluation of functions, and ICON£ is used to execute commands. Therefore, before

we

go

any further, please note that all of the material from last issue's article on adding functions through the vector /£VAL

can

be applied to

adding commands through the vector ICON£. The converse is true as

well: Everything that we do in this article to modify existing BASIC

commands. through the use of ICON£, can be directly applied to

modifying exi sting BASIC functions through the vector /£VAL Now that we've got that straight, let us begin our example. Implementing A Command Wedge

"""����§� commands. The source code is provided and should be studied in

While modifying the buill-in commands of the BASIC interpreter may

order

sound like quite a job, let me assure you that it is really quite easy to

no interest in learning the techniques described here. you should find

do. Whenever BASIC wants to execute a command, i t JMPs through

this example command wedge most useful m your own program

the vector named IGONE at $308/$309. The execution routine calls

developemen!.

to gain a

full understanding of the technique. F.ven if you have

CHRGET to gel the token of the command into the accumulator. Bit 7 of this token is then masked off and the resulting value is multiplied

Listing

by two. This result is the offset into the address table for the address

code. Listing 3 is an example program which illustrates the use of

(minus I) of the routine to execute. This address is then placed on the

some of the modified commands. This short program may give you

stack and a JMP is made to CHRGET to get the next byte of text. The

ideas for your own applications in addition to allowing you to test your

RTS in CHRGET causes the PC to be loaded with the address of the

copy of the wedge.

1 contains a BASIC loader for the wedge. Listing 2 is the source

routine to execute since this address was just placed on the stack.

(Note: This method is almost exactly the same as the one I used in the

The commands that we will modify are:

parser for our function wedge in the last issue.) Armed with this knowledge. we can easily wedge into the execution routine, get the

RESTORE

GOSUB

GOTO

WAIT

command token and decide if it is one of the ones that we wish to

LIST

LOAD

SAVE

VERIFY

modify. If it is, then we will place the address of OUR routine on the

IF/THEN

INPUT

NEW

stack. thus executing the new routine instead of the old one.If it is not one that we wish to change. we will give the token back to BASIC for

In addition, we will make the apostrophe (') act like the REM com­

further processing.

mand and the English pound sign act like an ELSE statement. It is

noteworthy that An Example Wedge

each modified command will work exactly like

the

original command when the original syntax is used. This feature is very important in maintaining compatibility with older programs.

As an example of this technique. I have written a wedge which changes the action of several of t he most commonly used BASIC

What follows is a description of the modified commands with an example or each one. Jl#t 1916: � 7, laue 01


(7) The new LIST command is exactly like the old. except that it can be

(I) The first change in our modified BASIC is that the apostrophe is now treated as a REM statement. This provides much neater looking listings. Ex.

used in a program. The old list, you will recall, always returns to direct mode when finished. The new LIST command is invoked by adding an exclamation point after the word LIST. In order to preserve the integrity of the stack, the STOP key is not honored by the new LIST command.

1 0 'this is a comment

(2) The RESTORE command originally accepted no parameters and

Ex.

was used to set the data pointers back to the beginning of the program. However, there was no means provided to access a particular element of data when needed. The NEW RESTORE command provides TRUE RANDOM ACCESS to your data state­ ments. It takes from zero to two parameters. If no parms are given, the original RESTORE is used. Ex.

open4,4:cmd4:1ist!:print#4:close4

You could use a FOR/NEXT loop to list multiple copies of your program (to give to the members of your user's group, etc.). Another way to use this new capability would be in writing a programming tutorial. You could list the lines before executing them. For example:

1 0 read,a,b.c:data 2,4,6,8, 10 20 data

' PAM " , " PAUL" , ' KELLY '

10 print· this code moves the sprite' 20 listi 1 000-1 030:wait:gosub1 000

30 restore 20:read a$

40 restore 1 0,4: read x

(8) LOAD/SAVE/VERIFY -- A radical change for these three com­ mands! Not only do you no longer need to specify the device number, you don't even need to specify a namel Suppose you LOAD" STATI and after modifying the program, you want to save the updated copy. Just type SAVE (with no name) and the program will automatically be replaced for you. But this is not a simple scratch & save. The new SAVE first backs up the old file and THEN replaces it. The backup filename will be the first two letters of the original filename followed by the suffix • .BAK' .

The RESTORE command in line 30 sets the data pointer to line 20 and A$ will be assigned the value " PAM · . In line 40, the RE­ STORE command sets the data pointer to the 4th data element of line I 0, so X will be assigned the value 8. Attempting to RESTORE to a line.. or data element that doesn't exist will result in an informative error. (Try this with the example program in listing 3) (3) The new GOTO and GOSUB commands allow variable expressions as arguments. Ex.

Ex. Suppose we load STAT I , then we modify it and type SAVE. It will create a file named ST.BAK which is the OLD STAT I and then it will replace the old STATI with the new. updated copy. There­ fore. you can safely and confidently type SAVE when you finish modifying a program knowing that a backup will be made in case the modifications are wrong. The program can then be verified by just typing the word VERIFY. (Note: Only one quote is required when a filename is used with any of these commands)

1 0 if x>O then goto x•1 0 20 draw = 1000:paint = 2000 30 gosub draw:gosub paint

(4) The new WAIT command does exactly what the name implies. It simply waits until a key is pressed. This command is incredibly handy and as an added bonus, once a key is pressed, the new WAIT command leaves the ASCII value of the key at location 2.

Ex. (All of these are legal) Ex

1 0 print· Touch any key to continue· load " $

20 wait: print " ascii value " ;peek(2)

load · stat (5) The new INPUT command is called INPUT$ and,

load · stat "

as

the name implies, is used to input string variables. What sets this command apart from the OLD INPUT is the fact that INPUT$ will accept any character including quotes, colons and commas with no problems. This capability is extremely important in writing any kind of data processing program. (How many public domain database and mailer programs have you seen that crash if you try to include a comma or colon in an entry?) Ex.

load · stat ' ,8,1 save: REM save & replace

save " name' :rem save (no replace)

etc.

If you type LOAD, SAVE, or VERIFY with no filename and no name has yet been defined, you'll get a 'MISSING NAME' error (Unless you have Epyx FASTLOAD in place -- it defaults to a filename of M or something on LOAD). Note: Once a name is defined by using it in either LOAD, SAVE or VERIFY, this name will be the default for all three commands until a new one is defined. While LOAD & VERIFY don't mind a filename with a in it, SAVE is unable to backup such a file and will abort.

1 0 print' enter datA: " ;:input$ a$

(6) The main point of the new IF command is the fact that it is compatible with the modified commands presented here. Since I had to write this routine anyway, I went ahead and added the capability to execute an ELSE clause in the event that the expres­ sion evaluates to false. Rather than using the word ELSE. how­ ever, the English pound sign (next to CLEAR/HOME) is used as a 'token' for the word ELSE. Be sure to place a colon before the pound sign. In the example below, <L> represents the english pounds sign. Ex.

Also note: A program can be LOADED and RUN by depressing the SHIFTED RUN/STOP key.

(9) The NEW command has been modified so that it clears the default name when you type NEW so that you don't accidentally try to save an empty workspace.

if x> 10 then print· greater" :<L>print" less than "

59

� 1986: VoUne 7, .... 01


AN

1 15 data 86. 1 94,

AH

1 1 6 data 1 1 5,

The above is just a glimpse of what you can do with the vector IGONE.

OF

1 1 7 data

In addition to just modifying commands. this vector is one of the best

JA

1 1 8 data 147, 148. 149, 162.

places to ADD commands to BASIC. Don't forget, you can add

OK

1 1 9 data 195. 106, 194,

4. 195,

13, 195,

39

COMMANDS through this vector using exactly the same technique

PJ

120 data 195. 247, 195,

7, 196,

14, 196,

4

that we used to add FUNCTIONS to BASIC through IEVAL in the last

AN

121 data 196. 249, 194,208.

issue. (Likewise. you can modify existing BASIC functions through the

CO

122 data

vector IEVAL just as we modified existing BASIC commands through

HG

123 data 233,

Final Notes

o. 32, 121.

0.

32, 212. 194, 165, 1 , 1 76,

0. 149, 195, 90

3,

76.

95. 164, 50.

32, 253 41, 202

Up until now, we have been e"amining wedges which make our lives

EL

126 data240,

38, 160.

as programmers a bit easier. In my next arlicle, we will examine a

CP

127 data 208,

31, 200. 177,

very useful, though somewhat unusual, special purpose wedge which

BH

128 data 58. 240,

makes makes USING a program easier. Until then, I will leave you

KA

129 data

4, 1 77,

65. 201. 131

65, 240.

44, 201

40,201. 34, 240,

2 1 , 201

44,208. 239.202. 208, 236. 152.

HI

130 data 1 0 1 .

CE

131 data

( I ) Add a command or a function (your choice) called !NAME which

CB

132 data 200. 177,

either prints or returns the name of the file currently in memory.

LJ

133 data 209, 208, 245, 169, 227. 133.

Use the article from last issue as a guide.

BN

134 data 194,

(2) Add a command called 'SEND which will send any command to

CL

135 data 247, 183,

32.

19. 166. 176,

the disk drive. For example !SEND " SO: DATA " will scratch the file

HB

136 data 227. 168,

96,

68,

65.

named DATA.

CD

137 data

77, 69.

IB

65. 133,

65. 144,

96. 169, 1 3 1 ,

44, 169,

76,

56

0. 240.

32, 158, 1 83, 138, 240.

32. 1 21 .

96,

65. 132

125data174.

66.

29, 168

1 , 136. 133.

AO

(3) Modify the LIST command so that if you type LIST"n it will do a

76

o. 133. 139. 140. 137. 1 4 1 . 155. 146

124 data

with the following simple projects:

72,

76. 237, 167

01

the vector IGONE in this issue.)

65. 240, 69, 164,

2, 230,

24 66

34. 133,251

6. 197. 251, 240 34. 169

32, 138, 173,

32

3.

76

84.

65,

32

78,

84,

32

79,

85.

78

o. 1 4 1 . 170. 196,

32

76. 163, 168. 169,

3

69,

76,

69,

138 data 78,

79,

84, 32.

70,

DO

139 data 68, 128. 169,

OK

140 data 121.

AP

141 data 32.247, 183,

PM

142 data

PN

143 data 72, 165,

58.

72. 165,

57, 72,169

EO

144 data 141,

72,

32.

5. 195,

76. 174, 167

( I ) You can do this without a hint.

AA

145 data 201.

33, 240,

(2) See last issue how to install new commands then just store the DOS

GN

146 data 156. 166, 169,

command string in a place named CMD and call SEND (see listing

JG

147 data

2) as a subroutine.

NJ

148 data

KK

149 data 139, 141 ,

NA

150 data

GC

151 data 76,210. 255, 32. 158, 173, 32, 121

NF

152 data

BG

153 data 255. 1 74, 165.

listing to the previously opened file number n. For example: OPEN 1,8,1 .

• PROG.L .

: LISTII1 : CLOSEt

Hints:

(3) This code at the begi nning of the routine should do it for you: :number s1gn?

cmp 11'11'

bne wherever :no/do whatever

0. 76. 66. 166,

32, 138, 173

32.251, 163, 165, 123,

72. 165, 122

71 , 1 4 1 , 3,

0,

32, 1 1 5 ,

3, 169,

0.

o.

76

3, 1 69. 195. 1 4 1 .

1

6. 32, 121. 52. 1 4 1 ,

49, 1 4 1 ,

0, 201. 137. 240.

20,

97. 208,

1sr

$ffc9

:set output device

GL

154 data 32,

;same as hst!

FM

155 data 168. 32. 121.

0. 176.

DO

156 data 168. 165, 122.

56, 233,

.

3, 169,

5. 169, 167.

;get filell 1n

.

3. 169

3, 169. 227, 1 4 1 ,

$b79b

.x

20.

0, 32, 156, 166. 169

jsr etc.

1 1 . 162.

1 1 , 169, 1 70, 208, 24. 3.

1 13 32 92

76.251 76. 160

1 , 133. 122

As was the case with our function wedge. this wedge is immune

IH

to RUN/STOP-RESTORE and is compatible with most utilities

DH

158 data 168, 104, 104, 108.

including the DOS Wedge, the Function Wedge and Epyx Fas·

BJ

159 data240,

Uoad Cartridge.

ML

160 data 240,

BJ

161 data

GE

162 data 243, 169, 186, 133,

34, 1 69, 195.

76

163 data 69, 164,

77,

73,

83,

83,

73.

78

86,

65,

82.

73,

65,

66

32,

86

73, 132.

74

Command Wedge BASIC Loader

IK

157 data 176.

2. 198. 123. 160. 3.

7 1 , 32,

32. 251

8.

3. 201.

36

76. 191 . 1 7 1 ,

32, 1 1 5 ,

0

15. 162.

13, 240,

0.

0,

32, 157,

32. 207, 255, 201 60,

3, 232, 208

FK

100 rem basic loader for command wedge

NP

164 data

MK

101 rem by frank e. digioia 12/18/85

MO

165 data 76.

69. 128. 142. 170. 196,

EM

1 02 rem sys 49664 to act1v ate

JH

166 data 195.

32, 139, 176, 133,

LN

103:

LB

167 data 32. 1 63, 182. 173, 1 70, 196, 32. 1 1 7

CA

104 for adr = 49664 to 50356:read ml

168 data 180, 160,

KD

105 cs = cs + ml:poke adr.ml:next

00

NG

2. 185.

97,

o. 145,

73 96

LB

169 data 136,

106 ifcs<>85465thenprint · error in data ·

GC

170 data 60.

3. 145,

98. 136.

16. 248,

PN

107 :

FN

171 data 240,

3.

45. 184,

32, 228, 255

KK

108 data 169,

AN

172 data240,251 , 1 33.

IK

109 data

23

ML

1 73 data 169.

59,169.201

LL

174 data

EG

I

72, 189. 85, 194,

9,

1 10 data 1 94,

1 1 , 141, 3,

96.

8.

3, 169, 1 94, 1 4 1

32. 1 1 5,

76, 174, 167,

76,

0, 32.

16, 248, 172, 170. 196. 136, 185 76.

0, 133,

2.

96, 169.

10, 169,

1 . 1 4 1 , 197, 196. 1 69,

o.

1,

44

44, 1 69

0, 32. 189

IK

1 1 1 data

39, 240, 249. 201. 92, 240. 245. 170

FD

175 data 255, 1 62,

AK

1 1 2 data

16.

32. 162.

0. 1 4 1 ,

72. 194, 189

NL

176 data 240.

IP

1 1 3 data

73, 194, 240,

22. 205.

72. 194, 240

NC

177 data 153. 181, 196, 136. 177, 187. 153, 181

NL

1 1 4 data

3, 232. 208. 243, 138.

1 o. 1 70, 189

OA

178 data 196. 208, 248, 240.

The nowtot

60

8,

32, 219,225, 165. 183

19, 1 4 1 , 170, 1 96, 168, 169,

0

38, 173, 170. 196 �'"''�7. .... ot

I


LD

179 data 240.

LE

180 data 1 8 1 , 196. 1 4 1 , 174. 196. 1 73, 1 82. 196

NB

181

IE

33. 1 73, 197. 196, 240,

data 1 4 1 . 175, 196.

32. 1 1 4 . 196,

Command Wedge Source Code

18. 173

1000 ,

32, 127

1010 .command wedge 1020 .by frank e d•gtO•a 1030 1 1 / 1 7/85 1040 1050 . 1060 1070 tntl Ida N<cwcflge 1080 sta $0308 1090 Ida *>cwedge 1 1 00 Sta $0309 rIS 1110 1 120 • 1130 Cwedge • chrgct 1140 JSI 1 1 50 JSI Chktok 1 1 60 JI'I1P Sa7ac 1170. 1180 rem JI11P Sa93b 1 1 90 . 1200 chktok NS27 1210 bcq N$5c 1 220 1230 bcQ rem tax 1240 bpi W()XII 1250 1260. ldx *$00 1270 sta tok n 1280 Ida toktab.x 1290 !loop bOQ WOXtl 1300 cm token 1310 1320 beq exec tnx 1330 bnc lloop 1340 1350. 1360exec txa aSI a 1370

182 data 196, 173, 170, 196, 162. 1 8 1 . 160, 196

CP

183 data 32. 1 89. 255, 173, 1 97, 196, 208,

OH

184 data 76. 1 1 1 . 225. 166.

NM

185 data 43. 32.216. 255, 144.

BC

186 data 224.

PA

187 data

EC

188 data 82. 1 4 1 , 1 7 1 . 196. 169,

NL

189 data 196.

FF

190 data 32. 177. 255. 169. 1 1 1 , 133, 1 85,

AO

1 9 1 data 147. 255. 162.

HN

192 data

KM

193 data 1 7 4 , 255,

DE

194 data 46,

96. 169.

45. 164.

46. 169

3.

76. 249

83, 1 4 1 . 1 7 1 . 196. 169

0. 1 4 1 . 180. 196.

6.

76 140. 196. 1 69 61 , 1 4 1 , 180

76. 140. 196. 169,

8, 133. 186

0. 83. 65.

32

0, 189, 1 7 1 , 196.240

32. 168,255.232,208,245, 66.

3

48,

75.

58.

o.

76 0

cmp

o

cmp

Command Wedge Demo Program IF

e

10'

OF

20

MG

30'

NK

40 · by frank e. dtgioia

BO

50 ' 1 1/ 1 7/85

Kl

60 '

EJ

70 '

AC

80 print · press any key 10 start · :watt

NL

·

command wedge demo

90

p

1 00 pnnt

CF

1 1 0 watt:list'

CE

120 pnnt •

any key to test list·

"

8•st done! ·

a subroutine 1 . 2 .3 •

130 watt:subr = peek(2)-asc( " 0 · )

ED

135 tf subr<1 or subr>3 then goto 120

LD

140 gosub subr·300 + 50.'computed gosub

AD

142 pnnt pnnt"type any chars:

GB

150 pnnunput • goto 1 70. 180 or 190 ·.a

IB

;:tnput$ z$:print · you typed: • z$

155 tfa<>1 70 and a<>1 80 and a<>1 90 then1 50

FH

160 goto

FN

170 print"

CO

180 print ·

11180 :goto200

II

190 print·

AO

200 pnnt "

11190 •

AA

210 watt:data 1 ,2,3,4,5,6,7.8.9. 10

HP

220 print"

LE

230 fon = 1 Oto1 step- 1 :restore2 1 O,ueada printa; next:prtnt

JH

240 data • georg1a · . ·clemson " . " usc ·

111 70 • :goto200

250 data ·colons::: · . · commas... " , " doL "

CG

260 data

GP

270 pnnt·print " choose a data line. ·

LN

280 input· 240. 250 or 260" ;line

EA

285 tf li<>240 and li<>250 and li<>260 then 270

HH

290 prinLpnnt ·choose a data element· ·

EM

300 input· 1 . 2 or 3 · .de tide< 1 then300

ID

• . • mps801 "

tS • a$:goto270

AM

320 prtnt

BG

350 pnnt " executtng subr Ill • :return

PI

650 prtnt " executtng subr 112 · ·return

NL

950 pnnt · executing subr 113 · .return

m

$51

3 1 0 restore line.de:read a$ •

1380 1390 1400 1410 1420 1430 1440. .get byte aga•n chrgot 1450 wextl 1sr .QIVC 1 10 basiC 1460 Jll"P Sa7ed 1 470 . 1480 token byte $00 1490. byte $85.$8b.S8c.$89 S8d 1500 1oktab 1510 b¥te$9b$92.$93 $94 $95 $a2 $00 1520. 1530 ncwadr word .np 1 ,.1 1.resl0r 1 word goto t.gosub 1 list 1 watt 1 1540 1550 word toad- l.save I verly 1 new 1 1560. all parms opttOnal 1570 ,restore x y 1 580 . 1590 chrgct ,get next byte $0073 <)Ct tast byte 1600 chrgot $0079 ,get nume11c parm Sad8a 1610 hrnnvrn .change lac 10 tnt $b717 1620 lac•nt 1630. 1640 restor .new restore cmd .any panns? 1650 ,no/usc to rout•ne Sa81d 1660 1670 ctprm . ycf>/pet l•ne & adr 1sr g .addre�s lo Ida 1680 ldy $60 .adthcss h• 1690 1700 sec sbc N$01 .Sllll!rUCI I 1 71 0 1720 deer ht byle? bcs • • 3 dey 1730 dato potntcr to 1740 s1a $41 1750 Sly $42 data potnter h1 anothe• parm? fSI chrgot 1760 bcq rdOne 1770 no/we're done 1780. 1790 yeslct•eck comma tSr Saeld gel byle tnto x 1800 JSr $b79c 1xa 1810 0 th elemen??? t 1820 beq relone dex 1830 1840 I Sl element/done bcq rdonc ldy f$04 1850 y IS text IndeX Ida ($41)y 1 860 .gel byte ol text data Slatement? cmpl$83 1 870 .norfoo ·• 1880 t.>ne hndat 1 890 . 19()() 1oop .comma search loop ....v 1910 get byte from ltne tda t$4t).y .end of line 1920 beQ nortnd CQion? cmpl' 1930 end ot data stmnt bcq n o tf nd 1940 ,quote? cmpN$2:> 1950

bne · + 5 ,mp

in line 2 1 0 printed backwards· :print

· . " 1541

.use x as •ndex .save lo• compare ,byte lrorn table .end of table .a match? ,yoslexecute 11 .no/burnp .ndex . keep look•ng

any key for restore demo "

c64

.s•ngte quote? .now rem command . else· pseudo-token .handte as •em .set flags .not a token

-

DH

.basiC •em command

.put olfsct •n a .mull by two .use as •ndex tax fda newodr + I ,x ,put address .ol new rout.ne pha .on stack Ida newadr.x pha .next byte & rts JI'I1P Chrget

·key found! asc11· peek(2)

CE

JK

rem

,lhtS IS the wedge .gel next byte .what •s ,? , ,tnterp<eter loop

61

J4Jiy 1916: Volume 7, ._ 01


1960 1970 1 980 t990 2000 2010; 2020 2030 2040 2050

beq hnqte cmp l'.' bne loop dex bne loop

.fond clostng quote :comma? :no/tty aga1n :found one' ;need x more

tya etc adc $41 sta $4t bee • + 4 lflC $42 riS

;put offset in .a :update the data ,pointers

Ida 6$83 byteS2c

.token lor data .Skip next •nslr.

Ida sta

N$22 $1b

;ascu lor quote :save byte to lind

;lind byte at $1b

2960 .d allows extended statements 2970 . 29 80 ,, .evaluate expo-ess10n JSr $ad9e 2990 .Qet last char $0079 JSf cmp W$89 3000 . goto token? ;yeah/check result beq chkexp 30 10 3020 Ida N$a7 ; "then· token elf 3030 ;check on ·then· fSl $a .expressiOn true? 3040 chkexp Ida $61 3050 bne do•t ,yes/execute cmd I$5C psuedo token lor ·else ldx 3060 $a90b ,loo k lor ·else· 3070 fSl tax .eoln? 3080 3090 bne cmmd .no/do else clause ,:np $a81b .yes/update txtptr 3 1 00 .and return to •nterp 3110 ;get last char 3120 dOll IS' Chrgot 3130 bcs decptr ;not d•g•Vexecute 11 mp $a8a0 3140 j :d•g•Vexecute goto 3150; ;decrement txlptr 3160 decptr Ida $7a 3170 sec 3180 sbc #$01 31 90 sta $7a bcS • + 4 3200 3210 dec $7b ldy 1$00 3220 .clear y lor update 3230 . 3240cmmd JSt $a81b .update text po1n1er pia 3250 3260 pia jmp ($0308) .execute via vector 3270 3280 ; 3290 :•npul$ -- input any str•ng 3300; e 3310 wbul $033c 33 20. cmpl'$' 3330 •np .our command? . yes/11 s ours 3340 + 5 beq .no/old •npul 3350 fll1P $abbl jSr chrget .next byte 3360 .m•ss•ng parameter beq x1 3370 3380: ldx N$00 3390 3400 gellt $1fcl JSr :•npul byte cmp N$Od .carr•age return? 3410 beq eoi 3420 ;yes/end of onpul 3430 sta wbul,x .save '' inx 3440 absolute rump 3450 bne gel•t --

2060

2070

2080 rdone

2090 .

2100 linda! 2110 2t20. 2130 l1nqte 2140 2150 ' 2160 bloop 2 1 70 21 80 2190 2200 2210 2220 2230 . 2240nolfnd 2250 2260 2270 2280 2290 ; 2300 gelprm 2310 2320 2330 2340

2350 2360 lound

iny Ida ($41),y beq nolfnd cmp$fb beq loop bne bloop =

Ida sta Ida rmp

l<msg $22 H>msg $a445

=

fSl JSI

frmnum tacint fSl $3613 bcS found ,:np $a8e3 liS

,get byte of text .end of line ,found •t?

yes/goto malll loop

.no/keep looking

,print mesg & d1e

:output err mesg ;get parm & check '' .gel parm •n lac .convert to •nl .get adr ol lone .line found? nolundel'ed l•ne •

2370 , 2380msg byte 'data element not found' 2390eom .byte $80 2400 ; 24 tO ;new clear default name 2420 ; 2430 new Ida W$00 ,set length zero Sta len 2440 .to olear name Chrgot jSr 2450 .gel laSI byte .baSIC new command 2460 ,:np $3642 2470' 2480 .goto -- computed goto statement 2490 ' 2500 goto JSf frmnum ;get parm 1n lac lac1nl .convert to 1nteger 2510 1sr .that's all lolks' 2520 fll1P $a8a3 2530 ; 2540 ;gosub - computed gosub statement 2550 ; 2560 gosub Ida 1$03 .hall 1 ol bytes .enough stack space? $a31b 2570 iS' ,text po<nter h1 2580 Ida $7b 2590 pha .text po<nter lo 2600 Ida $7a 2610 pha ,line number h• 2620 Ida $3a 2630 pha 2640 Ida $39 ,line number lo pha 2650 2660 Ida N$8d :token lor gosub 2670 pha :as i d. on stack goto 2680 .doagoto JSl rmP $a7ae 2690 ;.nterpreter loop 2700. 2710 .I<St - a list subf'oullne 2720. . 2730 lrst cmp , ,. .our command? beq ll 2740 ,yes/use our rOUtine 2750 .no/reset flags & fSl chrgot c 2760 mp $a69 .use normal list 1 2770 ; Ida H$34 2780 11 ;dosable stop key sta $0314 .to byte of irq 2790 Ida �<rtrn 2800 ,po1n1 error 2810 sta $0300 vector at return 2820 .address for frst Ida N>rlrn 2830 SIS $0301 2840 .get next byte fSl chrget 2850 .reai iiSI cmd $a69c JSI 2860 ' 2870 rtrn Ida l$8b .SCI CffO< 2880 sta $0300 :vector back 10 Ida N$e3 2890 .normal 29 00 sta $0301 29 1 0 Ida N$3 1 .enable stop key sta $0314 2920 :lo byte of 11q 2930 cr Ida H$0d .carnage return .output il 2940 fll1 P $ffd2 --

I

2950

The Trca kll

3460 .

3470 x1 3480 3490 3500 3510 noprm 3520 ; 3530 COl 3540 3550 3560 3570 3580 3590 3600 3610 362014 3630 3640 3650 3660 ; 3670

3680

Ida

M<nopo-m .set up enor mesg $22 Ida M>noprm .output mesg tmP $8445 .byte 'm•ss•ng var�able',$80 Sla

SIX jSl

iS' sta Sly

IS' Ida

len cr $b08b $49 $4a $b6a3 len $b475 1$02 $61,y ($49).y

fSl ldy Ida saa dey bpi 14

ldy len dey Ida wbul.y sta ($62),y

;save len ;output <cr> .lOok up var�able .save address . as po1n1er tree stnng .gel length .reserve space .3 bytes to copy ,copy stmg dscrptr .10 vanable table ,bump counter :1•11 done .

;get length ;bump down .copy stnng data .to reserved loc .bump counter .1�1 done

3690 •5 3700 3710 dey bpi IS 3720 3730 IIS 3740 . 3750 .wa•t -- pause unttl key pressed 3760 . 3770wa•l beq • +5 .any parms? Jmp $b82d 3780 yes/use old wa11 3790wloop JSI $ffe4 .gel character 3800 .buffer empty? beq wloop .save character 3810 sta $02 r 3820 ts 3830 . 3840 .load/save -- aU parms optiOnal 3850 . $1fbd .SCI name parameter 3860 setnam .set file parameter $ffba 3870 setlfs 3880 . ;venly flag Ida 11$01 3890 verly :sk1p next •nstr 3900 byte $2c 39101oad ;flag lor load Ida H$00 :store system flag sta $0a 3920 Ida H$00 .act like load now 3930 •

=

=

62

3940

.byte $2c .sk•p nexl•nstr 3950save Ida 1$01 .flag for save 3960 sta fsllag .store our flag Ida 1$00 .default length 3970 Sr setnam .set default name 3980 t ldx 6$08 3990 .default device# 4000 rsr $e 1db .get any parms Ida $b7 4010 .length of name 4020 beq nonamo ;no name spec1hed 4030 ' sta len .store new name 4040 4050 tay .use y as •ndex 4060 Ida t$00 .end name With 0 4070 sta name y 4080. 4090nloop dey .copy new fdename 4100 Ida ($bb),y .get byte ol name sta name.y 4110 .save 11 4120 bne nloop .keep '' up beq ex11 .continue com mane 4130 4140; • 4 1 50 noname = .no name spec•hed ,IS name del•ned? Ida len 4160 4 1 70 beq eXIt ,no/error com•ng u� 4180 Ida lsllag .load or save? 4190 .loadlf•nosh up beq setup 4200. Ida name .set up two char 4210 sta abr 4220 .abbrev1at10n of Ida name+ 1 .filename lor 4230 4240 sta abr + 1 .easy backup 4250 . 4260 .scratch old backu fSr scrach rsr rename 4270 .create backup cop 4280 . Ida len 4290setup ,gel parameters ldx N<name 4300 .lor hlename to .load or save 4310 ldy N>name .set parameters 4320 fSl selllam 4330 . 4340 ex11 Ida lsilag .load or save? bne save2 4350 .save command? fll1P $e161 4360 .conllnue load cmd 4370; ldx $2d 4380 save2 .end adr of save 4390 ldy $2e ;1.e. start of vars �$2b Ida 4400 ;p01nl to StarI adr 4410 $1fd8 .continue save cmd IS' bee + 5 .normalterm•natiOn 4420 4430 .no/" break· error J11p $e019 rts 4440 4450 • 4460 SCiaeh • .scratch backup :s lor scratch Ida W's' 4470 .set command sta cmd 4480 Ida noo .end of buffer 4490 sta equal 4500 ,no equal s1gn .send send dos comrnan 4510 1mp 4520 ; • 4530 rename = .rename old i•le ,., Ida 40 :r· lor rename 45 4550 sta cmd .set command ,. = . Ida .equal 51gn 4560 4570 sta equal .where else? ,:np send 4580 .send dos commant 4590 4600 . 4610 .send -- thrs rou11ne can be used 4620 .to send any dos command to dr�ve 4630 .be sure to end command w11h zero 4640; • $1fa8 .send senal pori 4650 ClOUt = 4660 listen $ffb t ,tell dnve losten = .send 2nd adr lstn 4670second $tf93 4680 unlstn Sffac ,QU•I Irsten•ng 4690 . Ida M$08 4700send .deVJCe number sta $ba .store lor system 4710 listen Isten 10 command 4720 iS' 4730 .ch • or'ed w/$60 Ida 1$61 4740 sta $b9 .secondary adr JSr second 4750 .send •I to dr�ve 4760; ld< #$00 . use x as 1ndex 4770 Ida cmd,x 4780 dloop ;get byte ol cmd beq ex•ll 4790 .0 byte marks end 4800 JSf CIOUI .output to dr�ve rnx bump poonter 4810 bne dloop 4820 ,:np to dloop 4830 . 4840 exoll J11P unlstn aldene' 4850 . byte$00 4860 1en byte ·:;0 4870cmd byte $00.$00. bak 4880 abr 4890 equal byte$00 = • + 16 • 4900 name byte$00 4910 lsflag 4920 end

=

� 1916: Volume 7,1aue 01

I


Improving The SYS Command

Neil Boyle Calgary, Alberta

. make use of those machine language routines supplied free by Commodore.

The SYS command in BASIC is very useful - it gives the programmer access to the fast, precise world of machine language. The writers of the Commodore BASIC interpreter realized that programmers often wish to transfer values from BASIC to machine language, so they included the USR com­ mand, a specialized form of SYS. Unfortunately, the USR command is limited to transfering one numeric value. A useful extension of the SYS command would allow the passing of multiple parameters in the form of values, variables, equations and strings. A simple method of doing this would be to calculate the values in BASIC and poke them into memory, then SYS to the ML program and have it read the values. Effective. but awkward, slow and clumsy. A faster and more elegant method is to make use of some of. the machine language routines supplied free by Commodore those in the BASIC interpreter and the KERNAL. There are routines for converting floating point values to integer and back, for evaluating BASIC expressions, for manipulating strings, for printing data in numeric or string form, for storing data in variables. and for printing interpreter or KERNAL error messages. In addition, all mathematical functions handled by the Commodore 64 can be used from a machine language program. These routines are fairly simple to use, and open up innumerable opportunities. The data which can be passed back and forth between the two languages usually takes one of three forms: string, integer or floating point. Strings are fairly straightforward, and are han­ dled much the same way in each language. Integers, too, are fairly simple, but can be stored in one, two or more bytes. Numbers outside the range of BASIC integers (-32768 to 32767), or those with decimal points, are stored in floating point format, and require 5 or 6 bytes. One advantage of using the interpreter routines rapidly becomes apparent: floating point values can easily be converted to integer and back. Thus, data can be converted from one form to another, manipulated, and converted back, effortlessly (well, almost).

The real problem lies in transferring the parameters from one program to the other. A simple method of doing this using these routines takes the following format: SYS PA, value1 , value2, value3

where PA is the starting address of the ML routine, and value 13 are the parameters to be passed. For each parameter, M L routines must be called to check for the comma and to evaluate the parameter. The routine at $AEFD checks for a comma and returns an error message if it is not found. The value following the comma can be evaluated by the routine at $A09E. The value can be anything that BASIC can evaluate: strings and string functions, integer or real or boolean equations, variables, etc. If the value is a string or a string function, the result is stored at $0100, and if numeric, it is stored in floating point format in FACI. FAC1, or floating point accumulator .. I , is located at $62 to $65, and is used by the BASIC interpreter for floating point value manipulation. If the type of data to be passed is unknown, reference to two flags will sort this out. The location SOC is used to indicate the type of data- 255 for string, and 0 for numeric. The type of numeric data is indicated at $00 - 128 for integer and 0 for floating point. An alternate evalua­ tion routine exists at $879E. Following this evaluation, the expression is stored as a one-byte integer (range 0-255) in the X register. I wrote the following relocatable M L program to demonstrate this method of extending the SYS command. The program is a PRINT AT routine which allows the programmer to specify the column and row of his/her output to the screen. This is simpler and cleaner than fiddling about with embedded cursor con­ trols. The format is: SYS PA, col, row, value

PA col row value

- the address of the start of the ML routine - the number of cols from the left screen border (0-39) - the number of rows from the top of the screen (0-24) - anything the PRINT command can handle J4!o('19t6: �7, laue 01


In this example, the SYS command is followed by the parame­

delete hne 1 1 0 from the source program, and add the line 1 0 listed below. Line 10 sets PA equal to the memory address of the first of the 39 spaces 1n the REM statement and line 120 stores the ML program in the REM statement. RUN the program. then use line 10 as the first line of your program. The remaining lines can be erased, and line 1 0 can be renumbered. used and stored as wished, but it must remain the first line in the program if PA is kept as location 2063.

ters to be passed, separated by commas. This line SYS's to PA, the location of the ML routine. The ML program then checks for a comma, evaluates the next parameter, col, and stores the

If it is within the acceptable range, it is stored on the stack. The row parameter is placed in the X value in the X register.

register in the same manner, and checked for size. The col parameter is pulled from the stack, transfered to the Y register, and the KERNAL Plot routine is used to relocate the cursor. Should either parameter be out of range, the error message

1 0 pa

"ILLEGAL QUANTITY" is printed.

.

)Sf

Saefd

;check for comma after SYS

jsr

Sb79e

;evaluate expression for column number

=

2063:rem .

Example:

(col), store in .X

<39 spaces>

sys pa,4.6. • • • :pa:sqr(144) + 12•6

This example will print an asterisk in column 4 row 6, followed

cpx #$28

;must be less than 40 ($28)

by the value stored in PA (starting location of the ML program),

bcs error

;if not, print error message

and then the value of the equation (84).

;store column value on stack

Following is a short list of some of the more useful

$aefd

;check for comma alter col

manipulation routines in the BASIC interpreter and KERNAL:

$b79e

;evaluate expression for row number (row),

txa pha jsr

. JSr

store in

data

Routines used in passing parameters:

.X

cpx "$19

;must be less than 25 (S I 9)

bcs error

;if not, print error message

Saefd

pia

;retrieve col from stack and

Sad9e evaluates any expression in the BASIC statement and, if

tya

;store in .Y

numeric, leaves the results in FAC I . If the expression is

clc

;clear carry for KERNAL plot routine

a string, it is stored starting at SO I 00, and ends with a

;Kernal plot - put cursor at location speci­

zero.

jsr

SfffO

fied jsr

$0073

jmp $aaa0

error ldx

'$0e

in .X and .Y

checks for a comma in the BASIC statement.

$b79e evaluates the expression in the BASIC statement, stores

;setup for BASIC interpreter print routine

the value in FAC I , then converts FAC I into a an integer

;BASIC PRINT routine - print following

in the range 0 to 255, and stores the result in the

expression

register.

X

Routines to convert

;error " I 4 - illegal quantity

floating point values in FAC 1 to integer values: jmp Sa437

;print error specified by value in .X Sbc9b converts a floating point value

The following BASIC source program will place the program at

in FACI to a four-byte

integer in FACI . Sb I bf converts a floating point value in FAC I to a fixed point

memory location PA:

integer stored in $64 and $65, range -32768 to 32767.

AS KA AS CS OM GO OK OG

1 00 rem print at - source program 1 1 0 pa 49152: rem location of ml program 120 forj =patopa +38: reada:pokej,a:next 130 data 32. 253, 174, 32. 1 58, 183, 224, 140 data 176, 24, 138, 72, 32,253, 174, 150 data 158, 183, 224. 25, 1 76, 12, 104, 160 data 24, 32, 240, 255, 32, 115, 0, 170 data 160, 170. 162. 14, 76, 55. 164

$b7al converts a floating point value in FAC I to a fixed point integer in the X register, range 0 to 255.

=

$blaa converts a floating point value in FACI to a 2-byte

40 32 168 76

integer leaving the high byte in the accumulator and the low byte in the Y register. Routines to convert integer values to floating point values in FAC I:

Possible locations for the M L program are unused Page Two RAM $02A7 (679), the tape buffer $033C (828) or free RAM $COOO (49152). In the program, let PA equal your choice of location and it will be stored there.

Sbc44 converts a 2-byte integer in $62 and $63 to a floating point value in FACI . $bc3c converts the accumulator to a floating point value in FACI . $b3a2 converts the Y register to a floating point value in FAC I .

One convenient but unusual place to store a short (less than 75 byte) ML program is in a REM statement. To do this,

$b391 converts a 2-byte integer, high byte in the accumulator and low byte in the Y register, to a floating point value

64

� 1916: v.:.-7, ...... 01


Thanks also to Sheldon Leemon and his invaluable book.

in FACI .

Mapping the Commodore 64", for descriptions of these rou­

"

tines. For those more interested in the actual code for these Routine to convert

routines. it can be found in "The Anatomy of the Commodore

a noating point value in FAC I to an ASCII string:

64" from Abacus Software.

$bddd converts a floating point value in FAC I to an ASCII string sta rti ng at $0 I 00.

Other useful routines:

rem printer version

OM

1 00

GO

120 open4.4

GC

130 print#4,chr$(27) • p • chr$(66)

IG

140 close4

$a437 prints the error message (from the table at $A 19E)

CE

150 open4 .4.2

the X register. For exam­

BH

160 sys700

KH

170 .opt oo.p4

corresponding to the value in

ple. loading a 1 4 in the X register and then jumping to

KC

180.

CG

190 ;ml print at

00

200 ;

CHRGET routine is needed before jumping to this

KG

routine.

oc

220 chrget

this routine produces the error message · I LLEGAL

QUANTITY " . $aaa0 PRINT command - prints whatever follows, checking for TAB. SPC. commas and semicolons. A jsr to the

IE

Useful routines and nags from Zero Page and the KERNAL: $73

- CHRGET - gets the next character in a BASIC state­ ment.

$0c

- !lag: type of data. A value of 255 indicates a st ring and ,

a zero indicates numeric data.

$0d $lifO

- !lag: type of numeric data. A value of 128 indicates an integer, and a zero indicates a lloating point value.

- KERNAL plot routine - if the carry !lag is cleared. the cursor is placed at the column in the X register and the row in the Y register.

Reference locations:

210 ; -

$73

;get next character

230 errprt

-

$a437

GH

240 print

-

$aaao

;print error type .x

KD

250 comchk=

$aefd

JK

260 evalxr

-

$b79e

;put exp in .x 0-255

GL JA

270 setcrs

-

$fff0

280 .

; kernal-place cursor

-

$c000

;basic p rint

;check for comma

IJ

290 ;

oc oc

300

. JSr

310

]Sf

LN

320

;evaluate col in .x

GE lA

330

bcs error

340

txa

;branch if col > = 40

HO KG ML

350

pha

360 370

JSr . JSr

HE

380

cpx row

NL

390

bcs

AH

400

pia

JG

410

tay

comchk

evalxr cpx col

;check for comma

;store col on stack comchk

;check for comma

evalxr

;evaluate row in.x

error

;branch if row > = 25 ;get col from stack

FACI

-$62-$65 (floating point accumulator)

KB

420

FAC2

-$69-$6E

PF

430

clc . JSr

440

JSr

-$30d (781) (.X)

EH GB

450

Jmp print

-$30e (782) (.Y)

IL

460

rts

MO

470 error

ldx

GE AH

480

jmp errprt

;print error .x

490 col

.byte 40

;# of columns

OP

500 row

.byte 25

;llof rows

accumulator -$30c (780) (.A)

X register

Y register

Using these BASIC interpreter routines opens many possibili­

ties in combining BASIC and ML programs. All forms of BASIC data. equations. and variables can be passed to ML progra ms ,

HA

and ML data can easily be passed back. For a more complete

setcrs

chrget

toobig

510 toobig .byte 1 4

;set cursor at x,y ;first char for print

;parameter too big

;illegal quantity

description of these routines, I refer the reader to "Compute!'s VIC-20 and Commodore 64 Tool KIT: BASIC" by Dan Heeb, which has been the source of innumerable ideas for me.

65

Jl6y )916: Volume 7, laUe 01


Autoload & the EPROM by Tom Hughes & Steve McCrystal Milwaukee, Wisconsin

When the power comes up, so does your application program!

Imagine you're using your Commodore 64 to operate a comput­

about I minute before loading, and at any time during this

erized bulletin board and one stormy day a stray lightning bolt

delay you can abort the load by simply pressing the Commo­

knocks out the local power station. Your BBS crashes. Of

dore logo key. This delay also serves a second purpose; it

course you're not around to pick up the pieces, so when power

allows a disk drive enough time to reset itself. For some drives

finally is restored your 64 sits idly, flashing its cursor, while

that do a self-initialization, like the 4040, there's a chance of a

your modem keeps answering and answering and answering

"device not present" error occurring if the drive is accessed too

those incoming phone calls.

soon.

If your 64 had been equipped with Autoload, the computer

Nothing's free . . . you'll need to get a suitable EPROM and

would have automatically loaded and run the first disk pro­

have access to an EPROM burner, for example, the Promenade

gram (your BBS loader) immediately after power was restored.

(see section below). Also, forget about using a cassette with

You could have been miles away.

Autoload because Autoload resides at $F72C and effectively erases part of a KERNAL cassette routine. However. patches

Autoload is a short routine that resides in the 64's KERNAL.

have been placed in the KERNAL which protect you from

Think of Autoload as a "hard" wedge as opposed to the ''soft"

attempting any cassette operations. One final note: Replacing

DOS 5.1 wedge which vanishes as soon as the 64 is turned off.

the KERNAL that came with your 64 with the Autoload custom

Since it is designed to become a permanent part of the com­

KERNAL will void your computer's warranty.

puter's operating system, the only practical way to use Auto­ load is to burn it into an EPROM (along with the rest of the

If you're willing to part with the use of a cassette, then there's a

KERNAL) and then replace your old KERNAL with the Auto­

fair amount of "free space" in the KERNAL for other customiz­

load EPROM.

ing. For example, the cassette locations between $F72C-FB8D and SFB97-FCDO seem to be ripe territory. Since all this space

Autoload is able to load and run a disk file because it bypasses

is available, why not make use of it?

the 64's normal start-up or RESET routine. Normally, on power-up or a cold start the 64 jumps to the RESET vector at

Other KERNAL modifications might include:

$FFFC-FFFD which points to $FCE2. This routine sets the VIC II chip and the operating system's soft vectors at $0300,

writing your own power-up message at $E479.

initializes BASIC, resets the stack, and finally turns control of

adding a "hard" DOS wedge.

the 64 over to the BASIC interpreter. Autoload performs all of

an IEEE KERNAL

these housekeeping functions, but it also does a LOAD • 0: • • ,8

a routine to read and set the time-of-day clocks.

and then stuffs the keyboard buffer with the BASIC command

or any number of short, general purpose programs that

RUN. Finally, it jumps to BASIC, which sees it has a RUN

you use repeatedly.

command waiting, and that's that. Thanks to the bank-switching capabilities of the Commodore What if you're not running a BBS? If you're 64 isn't a "dedi­

64, custom KERNAL routines can usually be soft tested; that is,

cated" or single-purpose computer, Autoload could become

run without using an EPROM. The source code for Autoload,

quite a nuisance. Each time you flipped on the 64's power the

for example, includes a conditional assembly variable, called

computer would always - repeat always - try to load and run. To

EPROM, that allows Autoload to be soft run "under" the

get around this potentially annoying feature, Autoload pauses

KERNAL ROM itself.

66

JWy t916: 'WII.me 7, 1uue 01


Here are the steps involved for soft running Autoload:

To program a custom KERNAL with the Promenade, the modified machine code must be loaded into the

(I} Assemble Autoload with the variable EPROM

=

64 's memory.

For example, I relocate the custom KERNAL at $2000 simply because it's easy to remember. The EPROM is then pro­

0.

(2) Load a machine language monitor and run it. (3) Using the monitor, save the KERNAL (SEOOO-FFFF) as a

grammed or "burned" by the EPROM programmer. Using the

disk file. Then load it back. You now have an exact copy of

Promenade (with the Promenade software) with the KERNAL

the KERNAL in the RAM under the KERNAL.

at $2000 and the 68764 chip, the programming command has

(4) Transfer BASIC to itself. For example, most monitors have

the following syntax:

a transfer command such as 'T AOOO BFFF AOOO'. This

Tl

moves BASIC to the RAM under itself. (5)* Load the assembled Autoload from disk. This adds Auto­

"8192"

=

decimal start address of the code to be burned ($2000).

load to the RAM KERNAL. (6) Create this bank switching routine with the monitor:

" 16383" "0"

=

decimal end address of the code (S3FFF).

=

first byte of the EPROM to

be programmed. (Re-

member, computers start counting from zero).

STARTSEI LOA

8192, 16383,0,48,0

"48"

"'$35

=

Promenade "control word" which tells the burner what type of EPROM it's burning.

STA $01 "0"

CLI

=

Promenade "program method word" or PMW. This gives the Promenade instructions on how the

RTS

68764 should be programmed. This short machine language routine will flip out both the KERNAL and BASIC ROMs when it is called and transfer

Promenade owners take note: You won't find the above PMW

control of the 64 over to the customized Autoload KERNAL.

listed in your documentation. I was forced to develop my own PMW because the suggested ones failed to work on the 68764 about 90% of the time.

(7) Exit the monitor and do a SYS to START. Autoload is now in place. Next, type SYS 64738 (a RESE1) and Autoload

EPROM burning takes about 4 minutes. If the error light isn't

should do its stuff.

flashing on the Promenade after the burning, then the custom­ ized KERNAL is ready to install.

• NOTE: Commodore's assembler won't allow its object code to be directly assembled to ROM. However, CBM's HILOAOER64 and LOLOAOER64 programs can be modified to assemble into

Motorola MCM-68764 EPROMs are available from JAMECO

ROM with a few pokes which place 6502 NOP instructions in a

Electronics in the United States as well as other sources.

comparison routine:

Besides being a direct replacement for the KERNAL, this EPROM can also replace BASIC as well as the

1541 disk drive's

ROM.

For LOLOAOER64, POKE 2388,234 and POKE 2389,234 For HILOADER64, POKE 51 525,234 and POKE 51 526,234

Autoload Kernal Patch (CBM Assembler format) Using t.he Promenade EPROM Programmer ;put" @:s/kauto • Making a modified KERNAL can be done using any of several

.opt nosym

EPROM programmers or "burners·· available to home users. I

'• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •' • autoload kernal • •' • •• --- -----------• ' • •' • on powerup or reset, loads • '• • the 1 st file from drive 0 • '• and then runs the program. •• • ' however, a delay period is •' • • • provided allowing the user • • time to abort the load by •' • •

use the Promenade sold by Jason-Ranheim Co. of San Jose, California, and recommend it highly because it's inexpensive, simple to operate and very versatile. Until recently, I used the 27 64 -type

EPROM as a KERNAL

replacement chip because of its low cost. However, this is a 28pin chip. Since the KERNAL ROM has a 24-pin configuration, the

2764 requires an adapter socket and some jumper wires

before it can be plugged into the 64's circuit board.

'

But because of recent price decreases in the Motorola MCM-

•' •

68764, this chip is now my EPROM of choice. The Motorola

' •

EPROM, unlike the 2764, is pin compatible with Commodore's

•'

KERNAL chip. The additional cost of the MCM-68764 is offset

•'

by not having to fool around with an adapter socket interface.

'

• • •

pressing the cmdr logo key.

- by tom hughes v240685 -

• • • •

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

67

.Jikt t9t6: Yolume 7, ....,. 01


.skip

(; sends line feed(s) to printer )

Jmp

;go to autoload

autold

.page 'autoload' ;c64 equates

=

$f72c

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

-

-

-

-

$0801

;basic starts here

;powerup autoload

$e3bf

:initialize basic

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

-

$e422

:print powerup message

.skip

$ffe7

:close all files

autold

-

$ffc3

keyd

basic basini basmsg ciaII

-

jsr

vec300

:set $0300 vectors,

;close one file

JSr

basini

;initialize basic,

$ffcc

;i/o to defaults

JSr

basmsg

;print powerup message,

$a474

;basic warm start

ldx

#251

;and reset stack

=

$0277

;keyboard buffer

txs

load

-

$ffd5

;load ram from disk

#0

;zero jiffy clock

ndx

-

$c6

;# of chars in keybrd buff

Ida . JSr

settim

setlfs

=

$ffba

;set file parameters

Ida

shflag

$ffbd

;set file name

cmp #2

;if cmdr key pressed.

$ffdb

;set jiffy clock

beq

auto30

;skip the load

$028d

;shift pattern register

Ida

time+ 1

$a0

;jiffy clock (3)

cmp #wait

$2d

; basic variable start (2)

bne

auto10

$e453

;set page 3 o.s. vectors

JSr

clall

Ida

112

ldx

118

ldy . JSr

#0 setlfs

close clrchn dobas

setnam

-

settim

-

shflag time vartab vec300

=

-

auto10

.skip :constants eprom

=

0

; 1 = eprom/0 = soft kernal

Ida

#3

wait

=

3

;wait • 4 = delay in sees

ldx

#<filnam

ldy

ll>filnam

jsr

setnam

Ida

#0

ldx

#<basic

.skip

ldy

#>basic

;note: attempted use of a cassette routine

JSr

load

;will result in " illegal device II "

SIX

vartab

sty

vartab + 1

Ida

#2

JSr

close

JSr

clrchn

.page 'diversions'

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

;cassette routine patches

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

-

.skip

• •

-

$f2ce

jmp

$1271

-

$f38b

Jmp

$f713

-

$f539

jmp

$1713

-

jmp

;fix cassette close ;fix cassette open

:then close all files

;ignore file header

;load "0: •

,8

;set end-of-basic ptrs ;close load channel

.skip ;autorun routine

;fix cassette load

$165f $f713

;else wait till delay is up

;fix cassette save

auto20

.skip 2

ldy

#0

Ida

runit,y

;write · r u n

sta

keyd,y

;to keyboard buffer

"

+ cr

$feel ----------- ---------- -------

cpy

;divert system reset

bne auto20

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

sty

ndx

:and set buffer size

jmp

dobas

;then run the program

1ny

-

-

-

.skip

auto30

.if n eprom <

.skip

114

stx

$d016

:reset vicii ch1p,

filnam

.byt

'0 : . '

JSr

$fda3

:initialize i/o.

runit

.byt

'run'. 1 3

jsr

$fd50

:memory pointers.

.end

JSr

$fd 1 5

;soft i/o vectors,

JSr

$ff5b

;screen & keyboard

eli

.�lit '1986: Volume 7, Issue 01


SYMASS: A Symbolic Assembler For The Commodore 64

Robert Hoehn Neustadt, Ontario

Now Assemble Any Transactor Program, Anytime!

Probably the major limitation of SYMASS is both source and the resul!ing object code must reside in memory along with SY­ MASS. SYMASS doesn't take up much room, (about 2.6 K) but you will have problems if the source is too long to fit with the object code.

Symbolic assemblers, used to assemble machine language programs, are essential tools for serious programmers. The merits of machine language need not be discussed here. If you haven't broken down and bought one yet, you've probably been using a monitor such as Supermon. Monitors were never meant for program development. After trying to insert a couple of instructions into a long program with a monitor, you must also readjust the rest of your program properly. Then you think very hard about alternatives.

A partial list of SYMASS/PAL compatible features follows: ;define start of program name = $11 ;assign a value to a symbol • • +n ;skip n bytes for storage ;comments follow $ ;hexadecin1al value, default is deci mal % ;binary value ;ASCII value of character ;force absolute addressing >high, <low ;low or high byte of word ;add, subtract +, ;store bytes .byte srr .word $1111 ;store words .asc text ;store string of characters ;end assembly .end • = $c000

Unfortunately there were very few choices until now. SYMASS was written to fill the gap. It is a very fast, compact, easy to use assembler with enough features for serious programs. Besides, it's in the public domain. After experiencing SYMASS in action, you will gladly demote your monitor to debugger.

=

You're likely already familiar with SYMASS syntax, since it is totally compatible with PAL. PAL source code is published often in each issue of The Transactor. SYMASS syntax evolved through many changes from its beginning as a BASIC program (which would take over twenty minutes to assemble early versions.) It now includes most of PAL's features, including the ones most often used in Transactor programs. PAL has no problems assembling SYMASS itself, but SYMASS is faster. SYMASS source code is about 1 8 K bytes long and PAL takes about 1 7 seconds to assemble it. SYMASS assembles itself in six seconds.

-

You can use SYMASS without knowing how it works, but the explanation will help you get the most out of it. SYMASS itself is composed of small modules. each performing a specific function. In general. each module could be replaced by another section of code, if it performs the function correctly. This makes it easier to modify small sections without any side effects. SYMASS was debugged that way.

Type in SYMASS 3.0.GEN, then run it. (It's not long, but you might consider getting the Transactor disk for this issue, espe­ cially if you want the source code.) It will create the final program, SYMASS 3.0, on disk. (The generator program could also be modified for tape, since SYMAS S doesn't use the disk drive.) The SYMASS 3.0 loader will relocate itself at the top of memory when it is run. Source code is entered with the BASIC editor; usc ·sys 700' alone on the first line to call SYMASS. Leave out the PAL's .opt xx statement sinc.:e SYMASS assembles to memory only. Type 'run' and save the object code with a monitor.

The Transoc:t or

SYMASS makes two passes over the source code. During the first pass, SYMASS builds a symbol table ol all the symbols which appear iu the program. It then stores the object code to memory on the second pass, after all unknown symbol values have already been defined. A variable called FLAG is set to 0 or I , depending which pass SYMASS is currently on.

69

� 1916: Volume 7, Issue 01


The source code has already been tokenized by the BASIC editor, but this causes no problems. It even reduces the amount of memory needed for the source. Opcodes such as 'and' are already stored as tokens internally, as are custom pseudo-ops like '.end'. WORD is the most basic routine to find the next word. WORD defines a word as a sequence of characters ending with a space, colon. semi-colon, or equal sign. It also ignores leading spaces, and has a quote mode that accepts any character except the end of line. A pointer, AD, and the .y register is always used to access the source code. When WORD is called, the pointer AD is ad­ vanced over leading spaces, then the .y register is advanced to the end of the word and the result is stored in LEN. Therefore, LEN is the length of the word, '(ad),y' gives the stop character when .y equals LEN, and the first character when .y equals zero. Two routines, NEXTWORD and NEWWORD, set up AD and call WORD. NEXTWORD starts at the current stop charac­ ter, so will only get another word if a space separates them. NEWWORD, on the other hand, skips over the stop, and is used to get the expression after an equals sign. It's important to understand how those routines work if you wish to use them in your own additions to SYMASS. SYMASS creates a symbol table which starts at the top of memory and grows downward to the end of the source code. A symbol table overflow results if not enough memory is availa­ ble. Each entry takes ten bytes; eight to store the name, and another two for the value. If tokens are embedded in the name, its actual length could be longer than eight characters, but it's not a good idea.

Two other major routines are EVAL and PUTOP. EVAL takes the current word, an expression containing no spaces, evaluates it, and returns the result. It can add or subtract symbols, decimal, and hexadecimal numbers. A char­ acter enclosed in single quotes will return its ASCII value. A > or< can be placed at the beginning of the expression to return either the high or low byte of the result. The number conver­ sion routines only convert from BASIC's format as a string of characters to a useful two-byte binary number, not both ways. This is why SYMASS gives the end of assembly as a decimal number instead of hex. The BASIC ROM routine that prints 'in xxxxx' is used. During the first pass DOOP keep track of the current object address with a pointer called PTR. PUTOP is used on the second pass to store the machine code into memory. It recog­ nizes all addressing modes. Since there is no difference in syntax between zero and absolute modes, the correct mode may sometimes be ambiguous. Suppose you are storing variables in memory after the end of your program, with a label to identify the location. On the first pass, an instruction such as 'fda variable' would normally cause FINDSYM to give an undefined symbol error. FINDSYM there­ fore tries to guess your meaning by returning the value of PTR for undefined symbols on the first pass. Other assemblers may use zero, and cause an instruction like 'fda variable+ I' to produce a phase error. A phase error results when the assem­ bler makes the wrong guess, and reserves an incorrect number or bytes for an instruction. SYMASS doesn't have phase errors. You can force SYMASS to use absolute mode with a ! prefix, or to zero page by a<. which works by returning the low byte.

CRSYM creates a symbol table entry. It decides if there is enough room, then copies the current word into the table. It is your responsibility to make sure a symbol isn't defined twice. Whenever the value of a symbol is needed, FINDSYM is called. FINDSYM returns with the value in the .a and .x registers, or prints an 'undefined symbol' message.

You can add your own specialized commands to SYMASS by adding them to the CUSTOP routine. One such command, ·.pad' will add a zero to the object code if the current address is odd. You might use it sometime to make sure a jump table doesn't cross a page boundary.

FINDSYM uses the simplest possible search method, searching from beginning to end. It might be worthwhile to use a different method, such as a hash function, to save time. (Calculate the storage address with a special function, such as the remainder of table size I ASCII sum or name.)

SYMASS leaves room for optimization; the major goals in its design were simplicity, speed and ease of use. WORD, since it is used so often, is a good candidate. PAL doesn't seem to recognize · as the end of a word. If the relevant parts of SYMASS were changed, the check could be taken out of WORD. A useful, but probably more complicated improvement is assembly to disk. =

The opcode table makes up 728 bytes of SYMASS. Again, FINDOP does a linear search. The more commonly used opcodes are close to the beginning. You could fine-tune the table to your style by counting the number of times each opcode appears in your programs, then rearranging the table in that order. If you do so. change the brk opN and bit op# in DOOP and PUTOP to their new positions. You could also easily add extra opcodes such as skb (skip byte) to the table, changing NOPS to reflect the change.

SYMASS's hidden strength is the ease with which it can be modified, compared to commercial programs which do not provide source code. You can also study SYMASS just to learn how to write an assembler. In the end though, SYMASS is a tool which will enable you to write machine language programs as complex as your growing skills allow.

70


SYMASS Source Listing

1000 1040 The souretcodtlor SYMASS 3.1 has nOIIX'tfl vtrifized -ifshere 1050; lor ref('tet'l<t only - wr wukfn'l imagine anyont entering i1 by 1060 labol hand If you "''ani �rrt w(' sugget you 1ype in lht lo.ader and 1070; unasstm�il,Olh�isegel Ois:k •12 fOfthisissue. 1060

br>e labol jmp '""Oi>

IOihyslOO

Ida �r

1 10 ; < < < <symass3.1 > > > > 120 ; symbohc a.ssembk>r 130 ; rc«r1 huehnjune. Ot1ober 1985 140 . sm311)3 150·= k000 160; 110 ;wo t»8<<quat., • ;stall OfSOU!Cf 180 stMrC' $50 • S2d ,end o!source 190 stava.t jopol symbol tabl• 200mtmsit = 137 = :basic line link 210 link S4• = :eurrtl\lline number 220 line 139 = Sla ;currm $0Urctacklress 230 ad

240S)'llljlrl 250sym<nd 260�r 2l0opp<r 280 lffi 29011 30012 310 ss 32 013

= = •

• • • • = =

33014 • 34015 • 350llil!j 360 ,constants = 310oops •

3BOready

=

400 ronlbas

minline

410 ij. 420 findline

• •

430 . 440 .m�n program 450 ;

460init 410; 480 490

500

510

520 530 540 550 560

570 itI 580 590

600

610

620

630 641)

650 660

610 it2

680

690 100

110 120 130 ;

l40newline 150;

160

770

180 790 ;

=

840

8511 860 810gwl

880 890 900

910

920

930 gw2 940

95() 960

9l0gw3

9110 990

1000 gw4 1010

1020

;symbol valuepointtr :bottomcl symbol table :currtM objedaddress :opcode t>blepointer ,le�hcl•ud Jemporary number :storagefor t\'al ;sign sa\'t

ISh

SSd

S26 S23 S2a SSe S51

1611 102

�int or serondpass

55 sam

Sbdc2

Sol,. Sa6c9

Sa613

�mberol instnx1K>ns

bascready ;print·in lint' :ronlinutbasic :list tine :find basil' line i

;

:begin hr• pass

ld• 'Q

�a

Rag

ldx '<messsla.r :stan ldy '>mes.ssrar printrrus sr j ldx 13• inx bne '" :sincem dm"CI mode jmp ready ldx <messfir :first pass ldy '>mt'SSfir �� printmss ld• mems z ,iml S)'mbol table �· symend Ida memsiz+ I �· S)'mt'nd+ I '"' od bne it2 inc od+ I '

i

Ida od

"' $lasrc >�• hnk Ida odt I "' 51asfC+ I "' link+ I =

jst

;stan next lint

neXIIine

bne ge�word jmp ""'""

600g<IWllrd =

810 ; 820 830

S52 S5l S9 5

"' word OO< gwl rmp 'Sb2 bnt next jmp ad<h·al ldx

·o

Ida (artx) cmp •s.ac bne gw2 jsr doplr

jmp tlt-Xt Ida (od�y

rmp 'Sb2 bne gw3

jmp oddl)'m tindop ���· btt gw4 jmp dotl!l ldy ·o Ida (ad).y rmp •' •

:processword

1210 1280 1290 1300 1310 1320n 1330; 1340 "'""' 1350; I�

1310 1380 1390 1400 1410 1420 1430

:c:tl('(;k lor • = t I •

1 520;

1530 1540 1550 1560 1510 1580 1590 1600

1610g2wl 1620

1630

1 640g2w2 1650 1660 1610 1680 1690. 1700n<xt2 1710; 1120 1730

IHO

li50 1160 1770 17110 1790n2xl 1800 1830 1840 1850 1860 n2x

1810;

1880 finish 1890; 1900 1910

;•

jst ldy

crsym •o

�·

(sympt�.y

iny

lc!y �n Ida (adiy cmp •· • beq nl cmp ••.• beq n1 jmp ntwln< iny

tya ck

adr od

od I><< II Ill( od+ 1 jn� �'III'OC'd

••

inc ldx ld)' �r Ida

Rag

:begin secondpass

1920 1930 19-10 1950

1960 1910 1980

ldx Ida

cmp

2370

2380

2390

:put link� 51art

2400 2410

2l20cs2

2430 2440 2l50 2460 2410 2480 2490

-;stan n�xt tint

2500

2510a4

"""'"' """"

2520

word

2530

2540 2550 rs5 2>60 2510

AeXI2

·o

(od,x)

cmp •sac oo• g2wl doplr �r ;np next2 jst lindop bee g2wl jmp purop lc!y Ida

2580

2590 2600 2610 ; 2620 doop 2630; 2640 2650 2660 2610

·o

(ad �y . .

.

.

bnt ntxt2 ;np rustop =

2660

2690

;gel ,.odylor next •'Ofd

2100 2110 2120 2130 2140 2l50dol2

kl)' l<n Ida (adl.y

rmp •s20 beq n2•1 rmp •SJa beq n2xl j� neowline2 iny

1760

2170do3 2180

tya clc

adr ad •a

be<

ad n2x

ldx '<messac .assembly compl«• ld y '>mes.sac jst prinunsg Ida ptr >ta li )E' i Ida ptr+ I sta lirte+ I ju inlint jmp ready

2010; 2020add>ym =

n('W'o'Ofd

eva!

ki)' ·o "'

=

Ida sy""nd

..,

siJc '10 •• sy""nd bot cs1 dot: sym<nd+l cmp stavat

3000 3010 3020

:IO'III"l'f symend to :make room

;dl«k lor

ldy

"' printmsg "' intine jmp liSIIillf dr Ida s)·mend adr '8

:overflow

•• symptr Ida symffid+I �·

td)'

symptr+l '8

kl• •o

:erasespact lor namt

dey

"' (symend),)' bne rs4 ld)' l•n

dey

Ida (id).)'

�·

;max ""sth is8

;\'Oil¥ symbol nan,.

lsmeod),y y

ns

�move ptr pastmstrucuon

ldy ·o Ida (od).v

bne dol

MOll'

·�· 'S20

:i:Jiop"

beq dol

beq dol nexlword JSl Ida '2 bne do jst ntXI\Io'Ord Ida

Ida

3310;

:recowuze mtendedabsolute

ptr +- I

:�urn ).lngk'

3380 3390

in� Ida

(adiy

3410

Ida

·o

Slil

3420

i

:

II

mpny

;np �•

3440

3460sym 3470; 3-l&lsyl 3490 3500 3510 3520 3530 3540 3S50 3>60 sy 3510 3590 3600 3610 3620; 3630eva!

=

cpy ltn beq >J Ida (odl)'

•saa beq >J «:m11 ·sa�.> emp

l.ml' �-y l

�y j$r

.+ .-

II

find:s�·m

ldy II II �· II+ I jmp I� '"

Ida

•(I

�·

3680

�· "

�·

3090 3100<"'1 3710 3120 3130

:fmdend and{ill rmchym

lit)'

3060

:e\'aluale smglt>exptf'SSion

12 t2• I

"' 14

lc!y

·o Ida (ad�)' cmp ·s· ..

bnE' f'\•8

jmp h<x cmp •sn beq li!eraJ cmp •s.ar be<! ptrvol rmp 'Sbl be<! hilo rmp '$b3 beq hllo

•.

siJc

'131)

jmp

deci

3860ov9

3880 3890 3900

b« �ym rmp 'ltla bot S)'ffi

3940; 3950

••

14

3970

bn• hi

. ;. .> :<

:f,.

fn\1)

brll' t\'9 jmp bin . ,...

:>()! < b�1t>tX.trat1Kifi'S

lllf od

3980 3990 hl

Uk'

od • I

de< len

4000

4010.

l'M•valut'

i

II + I '" .

3430

3960

.

beq dol

3350; 3360toeral

3910 3920; 3930 hilo

(od�y .

tva! plr

3330; 3340 ;tval rOUIIIll'S b{og.in ht'f('

3810

beq do5

;<:1\ange pt1� • = -+1

"'

3320

3840 3850

de)•

cmp ··x·

•x

jsr �·

3830

be<! dol!

.

3310

jst

3290 3300

3800 3810 3820

'I

rmp . bnt do5 iny Ida iodl.)' ld)' 'l

Of':<lword n�·word

3110 3180 3190

.

Ida

jsr

3260;

3140 3l50evll 3160

'3

in<' piHI jmp Ot'XI

3210 3280

3070

epx 'S21

per

364(); 3650

cmp •·i' be<i do3 cmp •'b'

1.'\'c'll beq dol� Ida •J dr adr per

=

3580

l)'il bne cs5 =

3230 004 3240 . 3250 doplr

3450;

adr •o

�·

•a

3400

:point sym�rto :symbol valueiddress

Jmp do6

be< dol

3220

Ida sym<ndt I siJc stavar+ 1 bot cs2 ldx •<memto ;symbol table ">messsto

3150doS 3160do6 31l0dol3 31110 do 3200 321 0

:createsymbol tableenuy

3130

3140

3190

(symplr1y iny '" "' (symp<r}.)' jmp ntxl

ctnp ··c beq dol2 lc!y �· d"' beq doS

2980 2990

71

�r �r

;changelat..l intosymbol

2880 2890

2960 2910

;sa sm bol with ''alut \'t' y

=

lc!y ·o Ida (odiy . cmp , •

2930 29W 2950

i

(symper�y

2840do2 2850 2860

2920

3100 3110 3120

jmp n<"l

cmp •sf.a

ldv len dey.dey sty l•n i>t f\'al inc 1.,, inr lffi cpx ·o

3080 3090

(symi'U�y

in)' Ida IO!lpl�.l beq doll

3010

·o

"''' do

2910

3050 3060

word rnl

2830

2900

1990. 2000 :subroutines used by ma nprogram

"'

3040 dol

bne do "' rtextv.'()fd ba• do2

2810

;ffid

iny

3030

crsym

1790 2800dol 2810

2820

inc ad·+l jmp get•wd2 •

,,.

2350 2�

'<rnessoec :serond pass •>""""" prinunss

..,., •• link Ida SIMI(+ I •• link+ I

jst be<!

2100

2710 2220 2230 2240; 2250 rnym 2260; 2210 2280 2290 2300 2310 2320 2330 csl 2340

i

2080

2110 2120 2130; 2140addval 2150; 2160 2170 2180 2190 2200

;gel r9d)• for l'il'xt word

pr

lc!y �·

2090

=

2060

pr

2010

Ida per+ I �· (sy�T�J�r>y =

"'

2050

:savtword, (tlrrtnt addrtss

1440 ; • 1450 ntwline2 • 1460 ; 1410 jst ntXIlint 1480 br" getword2 1490 jmp finish 1500; • d 2= 1 510 ge�....

1810 1820

: = tokt:n

:• tokfn

1090 1100 11 10 1120 1130 1140 1150; 1 1 60 next 1170 ; 1180 1190 1200 1210 1220 1230 1240 1250nl 1 260

=

2030; 20-W

bn• 0\'l

4020pt�·al

;giJVt fUff(' ll.l aikltt'$$

.JWy 1986: Volume 7, ._ 01


S050

II

ode ·o ... II • I In rq

5060

'"'

tl • I

�hl 5090, 5100 rq

� ""

5120 5130 Sl-10 SISO Sl60. Sl70der:i 5180 . 5190

ldy '>mos!rq

roy ldo prr

-

... ...

IIJlD «8) «100 . 4100 11!1 4110 . 4120 413 0 4110 4ISO 4160 4170 mo

4190fY3 4200

42 10 4220 4230 4240 42SO 4MO 427 0 4280 mo.,, 4300 4310 4320

4330

43 40 4350 4300 4370 : 43SO•sn 4390, 4400 4410 4420 4430 4440

«SO 4460 «70 H!O

«90

4500 4510..5 4570 4530 45411 4550 4560

4570ov 45ro 4 590

4600 4610 4620f'i

4630 4640 4650

4660

4670..7 � 4690 4700 ,

4710 ""' 4720, 4130

4140 41SO 4160 4110 hx l 47110 m o 4!00 4810 4820 4830 4340

4850

4@(,0

18 10

48IWl h ll 4&90 .m> f.JIO �920 4930 4940 49SO 4 960 4970 49 1!0 4990 sooo SOl O

5070

I

5040

Q, lG40 l050

SOlO

ldo �··· •

5070

.P<rlormbst..gn

ldo " """ tvJ ldo II '" 12 kll II t I "' 12+ I ImP •s• cmp •su

:oos•gn

.+

boo M ck ldo II ldo

5240

12

11 1 ode 12 I b« 11$11 Jlllll "'

2SO 5

·

SMO

5270 5280 5290 S300

"' .·tdd<ukl

ldo 12 lb< II �· 12 Jdi 12+ I '"' II t I "' 12+ I lxc rq

SJIO

.savt signOfstqJ

<w "" ..

5440 5450

5A60 5A70 S4!0

b« ..s

S.f90

add

ssoo SSIO

...

5520 55�

Ida ... •Y ltn '"' ltn •• ltn iM'f ..I kla 14 ..... ••6 Jdi 12 ld• 12 • I ns

C'lllp 'lbl

boo f'l Jdi Qd kll '0

ns ldo 12 "' .. •

lny .... •• ••

'0

·o

II II • I ldi !ad).y

""

'IJII

lb< b« h• (ql

55·10 5550d< 5560 :

SS70�n SS80.

SS90

>

·�

brr hll IlK 'Ill b« lu � '106 In h• ollie 'IOo "' II rol tl I "'' 'l ., II '"' II' I t

"'' oq 1>1 II '"' II d

bcs rq ,,1 II rol II • I "'' rq ode II •• II

Jdi II • I

the llal-lor

5600 5610 5620

5410bol

5640 5650

< ,ronvtrlllt:t numbe-r

S390

5420 5430

otry �· dr • old �· ad roc

S320 S3JO SJ40 SJSO S360 SJlO S380 5400 5410

btq O\ Jdi !idly "'

5200 5210 S220dol

5230

ode 12 ...

SilO

5660 5670

S660 5690 5100 5710 5720 5730 5140 575(1 5760 SllO 5180 5790bn

5800

boo lui •

kll

·<-

ldi

•• ••

,dl<gilquiWI)'

,convtndt>fimal

•o II

lid

...

"" ·-

6230

lllc '130

6240

b« do � 'IOo In do

6250 6MO 6210152 6280 6290

pill ldo II lctJr II I "' II '"' II I In rq ..1 II rol tl • I bcs lq ode II '" II

6300

6310 6320 6330 6340 63SO 63601>8 6370 63ro

6390

IU

6400 64101!3

ode II • I �· II d "" rq "' II ... II • I In rq pb ode II •• II ldo II > I ode '0 •• II I "" rq iny b.. dtl jmp 1111

64201>4 64:.1

6440

6450

;(OII\'f'11 bi1\ar)'

In) Jdi

·u II ... II • I Jdi (idlY �·

64(,0 6470 643) 6490b7 6SOO 6510"' 6520 6530 6540 6550 6S60 6510. 6S80 I••""' 6590. 6600 6610 6620

"'

6630 5640

b« bo � '2

66Q) 6610

lllc '130

6650

lx> bo ii>l II rol II > I

6611llltllh.. 6600 , 6700 6110 6120 6130 6140 61SO 6160 6110 6780 6790

"" "'

ad< •• Ida adc

II II

II •1

•(J '" II t I rny """ brll Jmp lbl

lilm

• S810 hndc!r • )('! arn·1fqlC'Odt. S820 """'' pou••lo pol<l....6l999 S8JO 'I'Mllrl>""""l\llmbtt " 5810

6810 6820 6830 6840

S860 >810 S880 51190 )901)lol >910 lo2

6llfA)

S8SO

5920

S930 5940 S9SO 5960 5910 59110 lo3 59!10 6!XXJ

6010 6020 lo4

Jdi '<opt<!>

..

"""''

lei. '><>�'"' •• oppr• I kll ·o "" •<) Jcs.

JOI>J)I�I

lx'Q fo3

cmp !ldl,y bnt 1<>1 rny

·:�

<P)' I" lu! <Pl' .... brM' lot "' "'

•••

"""''

6010 b« lo> 60110 IIIC oppll I 60901o> 6100 boo lol 6110 dr 6120 "' 6130; 6140 findsym Jmd s y mbol, �um val\lf in 11 :c 61SO. 6160 . 617 0 Ida nw1n�ir 6Jro •a wn�ltl 6190 Ida mt>ms•z• 1 •• !o'-�lfr • 1 6200 62101sl ldo ''"'4M' 6220

(i)ljl)

ldo lodl•

ldo 01'1'1 dr ode 'IN

"' pnnlm>e "' IOIIIW ImP I1SIIInt •

6030 6040 6050

qxorlrl.tlt

6650

6800

� 6800 6900 &910

&920

&930 nl 6940.

b950 ne"''WVfd &.100

69 1 0 &.181) &.190 l'IKIO

.. 1010 ntll.urd 1V2Il

72

""

lb. '10

i030 1040 lliSO 11110 1010 liB) 1000

ldo s)·mprr · I lllc S)ll1f0d I "" 1>3 kll OJ8 bnt 1<11 ldi "" ldx p1nl

nro 7290 7300 7310 7320 7330 7340 7350 1360 1370rll 13110 1300 1400

1210.

� sylllmd

:ft'urn ��on lSI�!>

,<ITli."S)Uj ,undl'fin�S)'mbol •>mts.SU1 prinln\Sg lntmt loth..

ldy ·o

1430

btq kl � lod1.J

1440 14.50 14(,0 i-110 leal

boo hi <Pl ba <P) boo

lrly

Jcs. I!> �0)' Jdi [>)'mplrl)'

�h

loond tt

"' •

.

,IISI DlfeOOmgline

ldo II"' �· Ill ldo .,..• I •• 115 ... ·"'

knk

••

hnk

ad

lmll.•l 11<1+1 •(I

Ida 1�n.r

f'f�lor ""'luw ,lfl(ll.tJd10nt':d hnt

lle"'' lmk

'"'

Jdi l.od�\ •• 1m� • 1 btq nl IR) ldo ladh ..

.tnd of)OO"rft«1uml *' tlt'Vo' ill'ltoombrr

....

dr

ldo od "" 'I •• lid lx\ nl

'"' nd + l "' •

·�

..tll'l OE'XI I<.Ofd past =

....

II)\ bl'l• ll< •

.pn.. ......

11nn1 cl\aractt'f

nr:u-.'OI'd f'\il

""

'I

«<

I<> rll

dtx .... "" ��· ... II '" .. Ill' • I '"

dr

ldo tl ode '1M ...

• ·�

btq rl kll •

<'""��root

�·

ptmlm�

�·

fiUIOUt

�·

tnluw P'flP 1111dmt Jdi II Jrnp l'lt':.tt •

"""'"'"'

"' "'

""'

7600 iiOO. 7i10 tndlft'll 7120, 7130 mo 71SO 1760 mdl lllO 71!10 7790 7il00

7810 7820

i&il•nd:! 8i i 0 l1l3l � 7910 1920

1930

1940. 7950pucw 19fll. 7910 mo 8000

row

80201'<¢

.do muntdta�t ITIOdt ''*

old tml "" old· I

"'

liS) ;

br•ncb 0111ol

ldy '>mn.llroot 'ilnS'

·��

mo

llrt (lt'Jil 10.\.ltd

JIIIOI I op II

"' "' ,.

ld\

7670

., ....... ,..

ld\ '3 ldo JOI'P'II\

O: i hrnl

rtiUIIl zdtar

""

lll50

I'PO\f.d0\"lf ltrt:.mdkfll>

7600

8oll) ;

Jdi lidh

�nt·l

7510 7520 7530 7540 rl 75SO 7560 7510 , 7S80 tmm 7590

inJ

""

••

7SOO

7 640 7650 600 7

,..,. rt•

ldo •• ldo� •• ld)

7490

)6)0 7620

....

.

1410

1420

ldo ���.)

·s M II 1>1 '9 JS\mpllly

"" ltd · I

nso. nfiOff'larl\f'

...

old old ••

7100nw lmc> w,.d 1110 1120pnn1m,q 113(1 , 1140 �· II 1150 •• II • I 7100 ld) 'II 7170pml ldo !tIJ.)' 7180 lx'Q ))111 7190 �· llfd2 my 7200 mo bn• pml n20 pm "' n30.

In � cl!< """"'. .

ld• ldy �· I" IM'f

Ito

nco�"""""'b!SI•...,.

"' .,,..,

"'

ld\ 1\l dr ode �· bet

bnt

lei. lt1�f)\ do< ""

""'""'

� nt\1! •

'"'I •I<I><I) I

,,I bn• mdI ... �I· I II){'

...

...n

\I< 1•1

'I

.....

.,

ll'n

Jdi lod)l Itt. •IJ tfll) •• • t>eq ondl 1111

u. t�rt·· ,., ........, ,., ""' ,., pul•-"1 ""' Ito 1/1� '"'"

1/1, l•n lfiiC� fl\\I! .

...

,senerdlt·� mad1mt.>W<k>

'II

Ill.. l4d�\ tnw ··�· but' f lt 1• •' "'fl �mjl 01• • • • b'

J4!y 1916: 'Vall.me 7,

..... 0 1

I


8030

8040 8050

80(;0

!11)70

8080

8090popl 8100 8110 8120 8130 8140 8150 pop2 8160 817 0 8180 8190

8200 pop3

bne cpx beq cpx beq ;top jsr bne

pop I '121 pop I '120 popl reta1ive nexlword pop2

:brkop' :bilop"

ldy '9

Ida {opjllr�y �· putOOiop jmp 00:12

ld)' •o

Ida (ad).y . • •• bne pop3 jmp imm crnp

cmp ··r

bne popl 8210 8220 ,mp indirfl.'l . .. .' 8230popl cmp 8240 bne absof\lu� 8250; lorctdalwllult' by! preflx 8260 inc ad bne fr 8270 Ill( ad+ I 8280 8290 lr dec len mJ �1P S2c 8310 : 8320 absoillle :thr�t>r,1e � 8330: 8340 Ida ·o 8350 •• 15 8300 ldx •3 8370 ldy len •

8.'180

8390

8400

8410 8420 8430 11440 8450 8460 8410 11480 8490 8500 8510 8520abl

in.x

Ill)'

lxa

8610 86110 8690 7 800 8110 8120 8130 ab3 8740 8750 8700 8ii0 8780ab 8190. 8800jump 8810. 8820 8830 8840 8850 8860 8810 8680 8690

8900

8910 8920 8930 8940 8950jpl 896() 8910 8980jp2 8990 9000 9010 9020

I

(ad),y x' abl •.

9300

9310wl

ab2 13 (O)JIJCrl.y

putootop 12 pu<OUI

9&20

9&30w5 9640

9&50

9660: 9670cu•op 9680:

9&90

9700 9110 9120

9130

deydey.de)• beq ab inc len '"' len jmp ntXI2 •

�·

ld)'

Ida

cmp

• next-.·ord '(J (ad).)' •'(' jpl '3 (O)JIJCI�)'

beq ld)' Ida jsr puroutop �· eval jsr �toot "'

I"

pufOOI

jmp next2

ioc "'

bne jp2 me: ad •I "" ltn dec leon ld )' '4 Ida (opplr�y �\f pulootop

lor the nantac

: jmp, �ra nd jmp()

tnlillt' lisrline •

;outpulobject rode

ldy ·o Ida

(adl.y wl cmp •122

beq w4

9&10

kl)• 13

pnn�mss

9400

9000

pr f)CJ(OOI jmp ab3 Ida IS bne ab4 kly 13 in y:iny-iny Ida (o)JIJCr�y cmp 'lla beq a!>l pr pu<oulop Ida 12 ;,r """""

·�Ja puiOOI •<messim :illegall'fiCX'Ieo •>messim

beq

9510w2 9520 9530w3 9540 9550 9500 9510 9580 9590w4

evaI

:-·eril)' op mode

.

9300

9500

13

fltXt2

9410 9420 9430 9440 9450 9400 9410 941!il 9490

•.

polool �n

beq abl Ida (adly : crop bne abl .). len

dey

«a! puiOOI

9210; 9220 ldy 'I) "' (�r�y 9230 inr p lr 9240 bne pi 9250 9200 inc plr• I "' 9270pt 9280: • 9290word :basic rootine togtt word 9300jad) mu• poinl to •an 9310 :i!!f1or es lei<ingspares 9320; •:; · "''Jiedonly in quOit mode 9330 ;return .y-length. Slop cha.in .a 9340; 9350 ldx ·o

9390

8000

11660

9200pulool

beq abl

8540 8S50 ab4 8560 8510 8580 8590 86 10 8620 8630ab2 8640 8650

dey

Ida crop beq in.x •• �· beq ldy Ida �· Ida �·

8530

9030 IV 9040 jv 9050 "" 9000 jst '"' 9070 jmp 9080 9090; 9100pulwlop 9110; <mp 9120 btlt 9130 klx 9140 9150 ldy 9100 ist 9170 jst jmp 9180 9190:

9740cpl 9750 9760 9170cp2 9180 790 9 9800 cp3 9810 982Q 9830 cp� 98�0 9850 91160 cpS 9810 9880 9890

9900

9910 ; 9920 cp 9930 9940 9950cp6 9900: 9910 byte 9980.

9990

10000 10010 10020

:end oflint

.

cpx 'ISO

beq

w2

beq

wS ·· :· w5 •st>2 w5 •· • w3 :COil)' wl •o wS ad wl ad •I wl

('mp <'mp

beq

tmp beq cmp

beq iny bBe

cpy

bne

inc

bn�

inr

bne

•' :'

:

=

;leading5p0Ce

"" .loggit 'ISO '"' jmp "''2 "Y len cpy 'I) ....

"' •

10)'

:c:u•om pst-tJ!kHlt�

Ida ('Jnp bnt jmp crnp bf•� jmp

(id),y

bne jmp cmp bn• jmp cmp bne jmp

cp3

cmp

lctx

kl)• ��

•"

b

"

rpl "'" ··w· (p2 by"•2 •k6

:asc

"' '180

:end

•1>4

end

•'p' cpS pad •<messip ;illegal "'>messip ;p!<Udo-op printmsg

jsr inline jmp listlint'

Ida ·o

"' 15

SI j

� l'

ntXl'A'Ord 13

ldy Ida rmp beq

ill)'

•(I (adly

··: bv:l

;splil uptxp�s

""

!be

13 •a 1:1

�· putout Ida IS beq b)'S

:t�.'al and

;JXIIOUl 01)(' b)1e

1xa

�· Ida beq ldy

""'""' 13 by len

:oton�word

Ul )'

l ya

de

ode: ad '" ad bt< byI ir.c: ad+l bne byI

de

Ida IS beq b)•l Ida ., ode:

.,

ode: �· �a �· lx< by8 inc JXrt I cpy 13 bne b)� jmp <'P •

:inc plron lii'SIpass

'I (ad;y '112

as 11'8

;..asc.·

.

.

beq as3

•r 13 jsr putout ldy 13

ill)'

;.....

CP)'

len bnt' �I jmp cp inc �· bne 052 inr piHI bne 052 •

:.end

Ida 11'8 btl( tn jmp se<pass jsc AeXIWOid ldx '<messac ldy ·)5I printmsg Ida per ••

�· nm"'wd

ldy Ida cmp beq ldx

.

cpy 13 bne br2 Ida l1ag beq b)� •r len iny Ida 13 •r 13

ba b)·� Ida ·o •a 13 jsr f\'11

110311. JII»>oplab .oprode !able 11050: I I060 .asc ' Ida •.bytelid. lbd.lb9. S.S. IbS.IIo.. lla. s.9. Sol. lbl 1 1010 ·"' . "' ;.byt.S8d. l9d. !I9. I 1&S.S95. 11o.. lla. lla. 181. 191 II� .asc • bne· :.bylt 1<10, II•. lla. lla, lla, IIa. IIa, lla, II•. lla 11090 .asc • beq• :.byteiiO, II•. Ill. lla. II>, lla, IIa. lla. II•. lla 11100 .1sc:' cmp• :.byte k<l. ldd.ld9. 16. ldS. IIa. lla. lc9. kl. ldl IIIIO.asc · �,· :.bytel20. IIi. llo.. lla. IIi. Iii. lla. lla. lfa. lla :.byte lie. IIi. lbe. la6. IIi. lb6.11a. Ia?. If•. lla 11120 ·"' ' 14x' . 11130 ·"' • "' :.bytella. If>. lla. lla, If•. lla, 160, lla, II•. lla 1 1140 ·"' 'ldy. :.byte lac, lbr, lla. S.4. lb4, 11a. lla, laO. 111. lla 11150 .asc • bmi :.bytel30. 1f•. lla. lla. 11<1. llo.. lla. II•. lla. lla 11100 ·"' • dec. :.byte ke. Ide. IIa. �. ld&.lla. I I a, lfa. II•. IIa 11110 .byte S.I,O,O,I2d.l3d.l39.125.lli.lla.lfa,l29,121,131 ;ond 1 1180."' 'ba' :.bytelbO, lfa. lla. lla, lla, lla. lla, II•. Ill. lla . 11190 ·"' .in< :.byle l<e, lit, llo.. 1<6. IHi, lla. Ita, II•. lla, lla 11200 .asc 'ix<• :.bytel90, IIi. lla. lla. lfa. lla. lla. IIi. llo.. lla 1 1210 ."' · 1yo ..byle lla. IIi. llo.. lla. II•. lfa. 198. IIi. II•. lla 1 1220 ·"' .bpi' :.byte iiO. IIi. lla. lla. lfo. lla. lla. IIi. II•. lla • 1 1230 ·"' asl' ·.byte l()o, lle. lla. IOO.II&.IIa. ICa.lla. lla. lla 1 1240 .a.« clc· :.byle lla, lfa, lla. lla, lla, lla. 118. lla, IIi. lla 11250.asc:'odc:' :.byte�. lld, ll9. �. 11S, Ifa. lla, 16 9 . 161, 111 11200 .bytel45:1b0.0,14d.1Sd.IS9,145,1SS,IIa.lli.l49.141.151 .eor 1 1270 ·"' 'lxa :.bytella. If•. lla. lla. IIi. lla. 18a.lli. lfa. lla 1 1280 ·"' ·cpx· :.bytele<. lla. lfa. 1<4. 11•. lla. lla. leO. lla. lla . 1 1290 ·"' · jmp. ;.b)1< 14c. IGc, If� lla. lfa. lfa. lla. lfa. lla. Ua 11300 ·"' lax :.b)1tlfa. lfa. lla. lla. Ill. lla. laa. lla. lla. lla . 1 1310 .ast • iny :.b)1t lla, lla. lla. llo, lla. Ill. 1<8. If•. lla. lla 1 1320 .asc:' •r· cb)1t 18c, lla, lla. 184,19( lla. lla, If•. lla. lla 11330 .bytelb0.141,0,10d.lld.lf9,105,11S,IIa.lfa.IOO.IOI.III .ora 11340 ·"' · dey· :.b)1ella. sr.. lla. lla. sr.. lla. 188. If•. lfo.. lla 11350 ·"'.. dex' cbytella. lla. lla. lla. sr.. lla. ki. lfa. lla. lla 11360 .a.� Sll. :.b)1e 18e. lla. lla. 188. lla. 196. lla, If•. Ira. lla 11310 .ast ·!be· :.byttled, lid, 119, 16, 115, IIa. lla, le9, It!, Ill 1 1380 ·"' • bil• :.bytel2e. lla. lla. 124. lfa. lla. lla. lfa. lla. lla 11390 ·"'. brk' :.byte lla. lfa. lla. IIi. Iii. lla. IOO.Ifa. lla. lla 11400 .asc: 'bvc' :.byttiSO. IIa. lla. IIi. lla. lla. lla. lfa. lla. lla 11410 .ast • bvs :.b)1t 110.11a. lla. lfa. lla. lla. lla. lfa. lla. lla 1 1420.ast.dd' :.b)1t lla, lla, lla. lla. lla, lla. IdS. lfa. lla. lla 1 1430 .asc •eli :.b)1ella, lla, lla, 11.1, Ill. lla. IS8,1fa. lla. lla 1 1440 .asc: •dv' :.b)1e lla. lfa. lla. IIi. lla. lla. lb8. If•. lla. lla . 11450 .asc: <)>)' :.b)1< kx. llo.. lla. k4. lla. lla. lla. kO. lla. lla . 1 1460 .asc ' inx : byttlla, lla. lla. lfa. lla, lla. le8. If>. lla. lla 11410.ast'lsr' :.byt• 14e. SSe. lla. 146. 15&, lla. 14a. lla. lla. lla . 1480 .ast • nop :.b)1e lfa, lla. lla. IIi, lla. lla. S.., lla. lla. lla 1490 .asc • ph>· :.bytella, lla. lla, lfa. lla. lla. 148, lla, lla. lla 1500 ·"' • php• :.byte If>. lla. lla. Ita. lla. IIa. 108. lla, lla. 11a 1510 .asc 'pia :.b)1< lfa. lfa. lla. IIi. lla. lla. 1&8. lla. lla. lla 1520.ast •pip. :.b)1t lfa. lla. lla. If>. lla. lla. 128,11a. lla, lla . 1530.asc ror :.b)1t12 e. l:lt. lla. 126 a, 12a. lla. lla. llo , 136, ll IS40.b)1tIS2,1b0,0,18e.l1e.lla.l6&.11&,11a.l6a,lla,lla.lla :ror 1550.i.SC ni• :.bytelfa. lla. lla. lfa. lla. lla. 140. 11a. lla. Ita . I 500.as< •set '·"'"llo.. lla. lla. llo. lla. lla. 138.11a. lla. lla 1510 .a�<· ...,. :.bj1.Sii. lla. lla. lla. lla. lla. 118. lla. lla. 11a 1580 ...: ·,.;· :.bj1ella. lla, lfa. lla. lla. lla. 178.1fa. lla. If• 1590·"'.tay' :.bytella. lla, lfa, lfa, lla. lla, la8, lla. lla, If• 1roo .>!( •'"'• :.byte Ill. lla, Ita. lla. lla, lla, lba, lla. Ita. lfa 1610 ."' 'txs' :.bo,1ella. lla. lla. Ill. lla. lla. 19a, lla, lla, If• 1620: 1&30 >r'""'� 1&40 . 1&50 •., ...: ' ""!'.l.IO robcm huehn leb 1986':.byt< 13.11 . 1600messhr .byte I :.asc fir• pas> .. . ..b)1ell 1610 me<s5e( ·"' • SC'COnd pas>. .' ..byle 0 : e :.bj1e0 1680 messac .bytd3:.asc • ""mbly«>mppee' 1690 """"'" .bytt l3:.asc: • <ymbnl rab�o•·erflow' : b)1t0 1100 mtsSiq .byttl3:.a'if · illegal quanlily' :.b)'ltll 1710 mess<Js .bytel3..asc · undefinedl)'mbol' :.b)1tll 1720 rmsl:oor.byte tJ·.asc · branch OUI of rangt· :.b)1t' 0 • 1130 m<ssim .byt. 13·.asc: illegal mode . b)1t0 1140mossip .byt• 13:.ast if!<gal p!<UcicH>p' : bjttII

t

'

lint

Ida ptr.l

"' line+ I

P,

inliM jmp ron�ba.;; •

:padobject wilb '"if..

I0900:oddbyte10 k"P jmplables sale

Ida Rag bne q>6 jmp Ot'X'I fmp Ot'XI2 •

10030byl 10040 by2 10050 10060 10010 by9 10080 10090 10100by3 10110 10120 10130 10140 10150 10100 10110 10180 10190 10200 10210 10220 by4 10230 10240 10250 10260 10210 10280 by5 10290 10300 10310 10320 10330 10340 10350 10300 10310 10380 10�by6 10400 10410 10420 10430 by1 10440 104SO 10400 10410 10480 by8 10490 10500 by 10510; 10520ast 10530: IOS40 10550 10500 asI 10510 10580 10590 10000 10610 10620 10630 10640 as2 10650 10660 10610as 10680as3 10&90 10100 10110 10120: 10730end 10140; 10750 10100 10110 10780en 10190 10800 10810 10820 10830 10840 10850 10860 10810 10880: 10890pad

:.b)leand .....,d

10910 10920 10930 10940 10950 10960 10910 10980pa 10990pal 11000 11010 1102Q

n

Ida

ptr tOO •r beq pa

Ida l1ag beq pal Ida 'II

��

pu!OUI

jmp cp "" pu bne pa II)(.' ptr+l bne pa

.JWy 1916: Volume 7, .... 01

I


PN GF FH LF AE HA HL IK JK HM PM BM KJ CP HA EK PM HB ED CA AA OA FD HB LB

SYMASS Loade.r

Generates diskfile • symass 3. I • which you then load and run. Don't forget to save this program first. PF NM PO BL PF

Nl AK MM HO

oc oc

KC NO MD KB IL LK GF MJ

Nl HG JE NN LP

OK MC AP FF PA DO

Fl DA DA GC LE PJ JB KM CL

01

BF NE HD PC NH JK KK HF EG JC JJ CH GL OJ OA PM LN AI HL GN OB ED CK NM

I

100 open1 ,8,1, • O:symass 3.1 1 1 0 print111 ,chr$(1)chr$(8); 120 fora = 2049to5253:readd:c = c + d 130 print/11 ,chr$(d);:next 140 close 1 150 ifc<>400792thenprint data error 160 end 8, 10, 0, 1 58, 50, 48, 54 1000 data 1 1 ' 1 0 1 0 data 49, 0, 1 65, 55, 1 33. 40 0, 0, 1020 data 165, 56, 133, 4 1 ' 165, 45, 133, 38 o. 165. 38 1 030 data 165, 46, 133, 39, 160, 2, 198, 39, 198, 38, 177. 38 1 040 data 208, 1050 data 201 . 3, 1 76, 79, 72, 165, 38, 208 1060- data 2, 198, 39, 198, 38, 177, 38,201 3, 1 44, 50, 170, 165, 38, 208, 1070 data 2 1080 data 198, 39, 198. 38, 1 7 7 , 38, 24, 1 0 1 1090 data 55, 133, 42, 1 38, 1 0 1 , 56, 170, 104 2, 1 98, 4 1 1 1 00 data 208, 16, 165. 40, 208, 1 1 1 0 data 198. 40, 138. 145, 40, 165, 42, 24 4, 138, 24 1 120 data 144, 1 0 , 2 0 1 , 1 ' 208. 2. 165. 42. 72, 165, 40. 208 1 130 data 144, 1 1 40 data 2. 198, 41 , 198, 40, 104, 145, 40 1 1 50 data 24, 1 44. 1 63 , 2 0 1 , 1 2 7 , 208,237. 169 2, 165. 40, 1 4 1 , 189 1 1 60 data 76, 1 4 1 , 188. 2, 133, 55, 165, 41 . 1 4 1 . 190, 2 1 1 70 data 1 1 80 data 133. 56. 32. 99. 166. 1 69. 255. 133 0, 2, 127, 169, 0 1 1 90 data 58, 76, 188, 2, 162, 58, 255, 2, 1200 data 133, 2, 160 0, 166 1 1 2 1 0 data 58, 255, 32, 150, 249, 3, 76, 1 1 6, 164, 162 1220 data 58, 232, 208, 1230 data 94, 255, 2, 160, 94, 255, 1 ' 32 0, 165, 55, 133, 87, 165 1240 data 150, 249, 2 2, 1250 data 56, 1 33, 88, 230, 122, 208, 1260 data 230, 1 23, 165, 122, 133, 80. 133, 78 1270 data 165, 1 23, 133. 8 1 ' 133, 79, 32, 88 0 3, 76, 201' 245, 1280 data 249, o. 208. 1290 data 32, 38, 251. o. 208, 7, 201 , 1 78 1300 data 208, 59, 76. 78, 246, 0, 162, 0 0, 161 , 122. 201, 1 72, 208. 1 3 1 0 data 6, 32 o. 76, 1 72, 245, 0, 1 7 7 1320 data 26, 247, 3, 76, 58. 246 1330 data 122. 201, 178, 208. 1340 data 0, 144, 0, 32, 201' 248. 3, 76 1350 data 160. 246, 0, 160, 0, 177, 122 o. 3. 76, 9 7 , 2 5 1 ' 1360 data 201, 46, 208, 0 1370 data 32, 95, 246, 0. 160, 0, 165 0, 1380 data 89, 145, 82, 200. 165, 90, 145, 82 1390 data 164, 93, 177, 122, 201' 32, 240, 7 1400 data 201 , 58. 240, 0 3, 76, 96, 245, 141 0 data 200. 152. 24, 1 0 1 ' 122. 133, 122, 144 2, 230, 123. 76, 1 04, 245, 0 2, 1420 data 2, 162, 109, 255. 2, 1430 data 230, 2. 160 1 ' 32, 150, 249, 1440 data 109, 255, o. 165 1450 data 80, 133, 78, 165. 8 1 , 133. 79, 32 o. 208. 1460 data 88, 249. 3 , 76. 37, 246 0 , 32, 38, 251. 1470 data o. 240, 33, 162 1480 data 0, 1 6 1 , 122,201. 1 72, 208, o. 6 1490 data 32, 26, 247, 8, 246, 0 0, 76, 0, 144, 1 500 data 32, 201' 248, 3, 76. 37 1 5 1 0 data 250, 0, 0, 160, 0, 177, 122. 201 1 520 data 46, 208, 3, 76, 97,251, 0, 164 1 530 data 93. 1 7 7 ' 122' 201 ' 32, 240, 7, 201 1 540 data 58, 240, 3, 76, 218, 245, 0, 200 1 550 data 152. 24, 1 0 1 ' 122, 133, 122. 144, 2 1 560 data 2. 230, 123, 76, 226. 245, 0, 162

YMbai -= b

oc

PK FD HJ HN GO MN BB 01 KJ PG

IP

JA MK PJ OJ AO IC AL HP JD FB MC MD MN FF KC

OB GG DH JG BH NJ AJ BA

EB GG OM CP CN KJ HO AL 01 AM 7.

1 ' 32 1570 data 124, 255, 2, 160, 124, 255, 0, 165, 89, 133, 57, 165 1580 data 150, 249, 1590 data 90. 133. 58. 32. 194, 189. 76. 1 1 6 1600 data 164. 32. 95, 246, o. 32. 1 3 1 , 249 1 6 1 0 data 0. 160, o. 32, 83, 247, 0 o. 1620 data 145, 82, 200, 138. 145. 82. 76, 172 o. 32. 83 1630 data 245, o. 32, 1 3 1 ' 249, 0, 160, 0. 1640 data 247, o. 145, 82, 200 1650 data 138, 145, 82. 76, 172, 245, 0, 165 1660 data 87, 56, 233, 10, 133, 87, 176, 2 1670 data 2, 198, 88, 197, 45, 165, 88, 229 1680 data 46, 1 76, 13, 162, 143, 255, 2, 160 0, 32 1690 data 143, 255. 1 , 32, 150, 249, 1 700 data 194, 189, 76, 7 1 ' 249, 0, 24, 165 1 7 1 0 data 87, 105, 8, 133, 82, 165, 88, 105 8, 169, 1 720 data 0, 0 0, 133, 83, 160, 1 730 data 0, 136, 145, 87, 208, 251, 164, 93 1 740 data 136, 177, 122, 1 45, 87, 1 52, 208,248 0, 1 750 data 96, 160, 0, 177, 122,201, 74 1 760 data 240, 1 9 , 2 0 1 , 66, 208, 22, 224, 33 1 770 data 240, 18, 224, 32, 240, 1 4 , 32, 135 0, 169, 2, 208, 83, 32 2, 1 780 data 249, 0, 169, 1 790 data 135. 249. 3, 208, 76, 32 4. 169, 1800 data 135, 249. 0, 208, 1 1. o. 1810 data 208. 67, 160, o. 177, 122. 201 1820 data 35, 240, 228, 201' 40, 240,224, 164 1830 data 93, 136, 240, 43, 136. 240, 40, 177 1840 data 122. 201. 44, 208, 34, 200. 177. 122 7, 201' 88, 240, 1850 data 160, 1. 1 , 200 1860 data 1 77. 9 1 , 201, 250, 240, 23. 1 64. 93 1870 data 136. 136. 132. 93. 32. 83. 247. 0 0, 76 1880 data 230, 93, 230, 93, 224, 0, 0, 240 o. 32, 83,247, 1890 data 10, 247, 3, 24, 1 0 1 ' 89, 133, 89 1900 data 1 7 1 , 169, 1 9 1 0 data 1 44. 2, 230. 90, 76, 1 72,245 2, 1920 data 0, 32, 135, 249, 0, 32. 1 3 1 , 249 1930 data 0, 133, 89, 134 0, 32. 83. 247, 1940 data 90. 96, 200, 177, 122, 133. 38, 169 1950 data 0, 0, 133, 39, 200, 200, 76, 1 60 1960 data 247, 0, 200, 196, 93, 240, 1 o. 1 7 7 1970 data 122, 201 . 1 70, 240. 4 , 201 , 1 7 1 , 208 1980 data 241, 132, 38, 32. 250, 248, o. 1 64 1990 data 38, 133, 38. 134, 39, 76, 1 60. 247 2000 data 0, o. 169, 0, 133. 40, 133. 4 1 2010 data 133, 42, 133, 95, 160. 0. 1 7 7 0. 2020 data 122. 201, 36, 208. 3, 76, 8. 248 2030 data 0, 201 . 34, 240. 188, 201 , 1 72, 240 2040 data 39, 201, 177, 240, 23. 20 1 , 1 79, 240 2050 data 19, 201, 37, 208, 3, 76, 1 61 , 248 2060 data o. 56. 233, 48, 144, 1 7 8 , 2 0 1 , 1 0 2070 data 1 76. 174, 76, 9 1 ' 248. 0, 133, 95 2, 2080 data 230. 122, 208, 2, 230, 123, 198 2090 data 93, 208, 198, 200, 165, 89, 133, 38 2100 data 165, 90, 133, 39, 165, 42, 208, 1 1 21 1 0 data 165, 38, 133, 40, 165, 39, 133, 4 1 2120 data 76, 210, 247, 0 , 2 0 1 , 1 70, 208, 1 6 2130 data 24. 165, 38, 1 0 1 . 40, 133, 40, 165 2140 data 39, 1 0 1 , 4 1 , 144. 18, 76, 78,248 2150 data o. 56. 165. 40, 229. 38, 133, 40 2160 data 165, 4 1 , 229. 39, 133. 4 1 ' 144, 124 2170 data 196. 93, 240, 27, 177. 122. 133, 42 2180 data 200. 1 52. 24, 1 0 1 , 122. 133, 122. 144 2, 230, 123, 56, 165, 93, 132 2190 data 2, 2200 data 93, 229, 93, 133, 93, 76, 93, 247 0, 1 65, 95, 208, 2210 data 5, 165, 40, 166 2220 data 4 1 ' 96, 201, 177' 208, 5, 165, 41 0 0, 96, 165, 40, 162, 0, 2230 data 162, 0, 0, 133, 38 2240 data 0, 96. 200, 169, 2250 data 133. 39, 177, 122. 56, 233, 48, 144 2260 data 53,201, 10, 144, 10, 233, 1 7 , 144 .J4!t 1916:

'Wiume 7, ..... 0 1

I


DG MD ON CL FK LG KC PC OJ NB GG KC KP HO JC FM ON DO

DO Gl FP PE JA

HL NA KL JJ CG GO JJ JD EG GK OK FL MH HE EJ GP NO KA JJ Ll

FP

OM

CA JN PL FK FO JL JO CD

00

GA Jl NO OM IE MM IC FJ GE KE Ml 10

IP

KK

LG OM

LJ

6 6, 176, 4 1 ' 105, 10, 45, 2 0 1 ' 6, 38, 38 38, 38, 39, 176, 36, 6 , 38. 38, 39, 176 39, 176. 30, 24, 6, 38, 38, 39, 1 76, 18, 101 0 0, 38, 133, 38, 165, 39, 105, 6, 200, 208, 196, 76 133, 39, 1 76, 2, 160 0, 162, 166, 255, 160. 247, 0, 32 1 ' 32, 1 50, 249, 166, 255, 0, 1 69, 0 2350 data 194, 1 89, 76, 7 1 ' 249, 0, 133, 38-, 133, 39, 177, 122, 56 2360 data 2370 data 233, 48, 144, 54, 2 0 1 ' 1 0 , 176, 50 6, 38, 38 2380 data 72, 1 65, 38, 1 66, 39, 6, 38, 38, 39, 1 76 2390 data 39, 176, 215, 2400 data 209, 101. 38, 133, 38, 138, 1 0 1 ' 39 6, 38. 38, 39 2410 data 133, 39, 1 76, 198. 2420 data 1 76, 192, 104, 1 0 1 , 38, 133, 38. 165 0, 133, 39, 176, 179 0, 2430 data 39, 105, 0, 200 2440 data 200, 208. 195, 76, 160. 247, 0, 133, 38, 133, 39, 1 7 7 0, 2450 data 169. 2 2460 data 122. 56, 233, 48, 144, 23, 201 ' 6, 38, 38, 39, 176 2, 1 76, 19, 2470 data 2480 data 149, 1 0 1 . 38, 133, 38, 1 65, 39, 105 0, 133, 39, 200, 208, 226, 76 0, 2490 data 2, 1 33 0, 169, 98, 252, 2500 data 1 60, 247, 1 . 133, 92, 1 62 251 0 data 9 1 ' 169, 98, 252, 0, 0, 177, 9 1 ' 240 0, 0, 1 60, 2520 data 3 9, 209, 122, 208, 1 1 200' 192' 2530 data 2. 56 2. 2540 data 144. 243, 196. 93, 208, 2550 data 96. 232, 165, 9 1 ' 24, 105. 1 3 , 133 2, 230, 92, 224, 55 2. 2560 data 91 ' 144, 2570 data 208, 219, 24, 96, 165, 55, 133, 82 2580 data 165, 56, 133, 83, 165, 82, 56, 233 2. 2. 198, 83 2590 data 10, 133, 82, 176, 2600 data 197. 87, 165, 83, 229, 88, 1 76, 22 5, 165, 89. 166 2, 208, 2, 2610 data 165, 2, 160, 1 84 2620 data 90, 96, 1 62, 184. 255, 0 , 32, 1 94 1 , 32, 150, 249, 2630 data 255, 0 0, 0, 1 60, 2640 data 189, 76, 7 1 , 249, 2270 2280 2290 2300 2310 2320 2330 2340

data data data data data data data data

IN CN JL BK HF PL DA FH NO

IP MN ME OM

NK GJ KC AD EG EN HC AM MJ BJ DE CG HD IJ LB AL OF

2960 data 2 0 1 . -

HB CP PO BE LP KF CF EO DO FK OF GM

208,205 38, 208 136, 1 7 7 165, 58 201 , 1 66 122, 165 177, 122 177, 122. 133, 79,240 122, 133, 57,200, 1 77 4 24, 165. 122, 105. 2. 230, 123. 96 2, 44, 164, 93, 152, 24 2, 230 2, 1 22. 144, 0, 134, 38, 132 251 ' 6 0, 177, 38, 240, 200, 208, 246, 96, 160 0, 32 32. 1 0 , 2 5 1 , 0, 56 32, 83,247, 1. 1 ' 202, 56 1 76, 38, 138, 229, 90, 170 0 105, 128, 138, 105, 2, 160 240, 13, 162, 202, 255, 0, 32 1 ' 32, 150, 249, 255, 0, 165. 38 189, 76, 7 1 ' 249. 8, 246, 0 0, 76. 27. 2 5 1 , 2. 230, 123. 160 2. 122, 208, 0, 1 98 177, 9 1 . 32, 10, 251, 0, 32, 27, 251 32, 83,247, 0, 230, 1 22, 208 8, 246, 76, 2, 230, 123, 165, 93, 56, 233 168. 132, 93. 177, 122, 160, 1 1 1 , 200, 177, 91 1. 44, 240,

2650data 177, 82, 240, 8, 2660 data 200. 192, 9, 2670 data 196. 160, 2680 data 82, 96, 165, 2690 data 133, 2 1 ' 32, 2700 data 76, 1 1 6 , 164. 2 7 1 0 data 79, 133, 1 23, 2720 data 133, 78, 200, 2730 data 2 1 , 200, 177, 2740 data 122. 133, 58, 2750 data 133, 122. 144, 2760 data 164, 93, 200, 2770 data 1 0 1 , 122, 1 33, 2780 data 123, 76, 38, 0, 2790 data 39, 160, 2800 data 32, 210, 255, 3, 177, 9 1 , 2810 data 0, 2820 data 135. 249. 1' 1. 2830 data 233. 2840 data 229, 89, 133, 2850 data 24, 165, 38, 0, 2860 data 2870 data 202. 2880 data 194, 2890 data 32, 2900 data 230, 2910 data 10, 2920 data 93, 0, 2930 data 2, 2940 data 4, 2950 data

DP

9, 209, 1 22, 144, 243, 196, 177, 82, 1 70, 57, 133, 20, 19, 166, 32, 165, 78. 133, 0, 0, 160,

80

MF

88

IH CM HK MH NO

HC

IJ JL CD FC HN

CD Gl

EE

FB

LE LO IM FC BJ OF FH NO 7 5

2970 data 32, 2980 data 32, 2990 data 230, 0, 3000 data 3010 data 203, 3020 data 33, 3030 data 167. 3040 data 10, 0, 3050 data

10, 2 5 1 , 27, 2 5 1 ' 93, 76, 177, 250, 240, 249, 1 60, 76,

8. 122,201, 0, 201' 7, 224, 0, 32,

9, 177, 8, 246, 201. 35, 201' 40, 201, 33, 2, 230, 0, 133, 240, 20, 44, 208, 122.201. 94, 32, 94, 177,

3060 data 1 77, 122. 0, 3070 data 249, 0, 3080 data 249, 2, 3090 data 208, 0, 3100 data 169, 31 1 0 data 93, 136, 3120 data 122. 201. 3130 data 200, 177, 3140 data 232, 134, 3150 data 19, 164, 0, 1 65, 40, 3160 data 3170 data 32, 2 7 , 2 5 1 , 3180 data 1 65. 96, 208, 3190 data 200. 1 77, 91 , 0, 3200 data tO, 251 ' 0, 164, 94, 3210 data 3220 data 230, 93, 230, 3230 data 32, 135, 249, 3240 data 122. 201 . 40, 3250 data 91, 3260 data 0, 3270 data 251 , 3280 data 208, 3290 data 93, 3300 data 0, 0, 3310 data 3320 data 76, 3330 data 1 62, 3340 data 32,

32,

0 83,247, 93, 230, 93 0, 160, 0 246, 3, 76 74, 208, 66, 208, 1 1 ' 224 3, 76 32, 240, 0, 208 135, 249, 9 1 ' 32, 10, 251 0 0, 0, 160,

0, 32, 0, 230,

208, 208, 208, 123. 96, 136, 11, 88, 83, 91' 32, 27, 0, 76, 233, 164, 20 1 , 250, 165, 40, 136, 1 36, 93, 76, 0, 1 60, 240, 20,

0, 25 1 , 0, 251' 8, 246, 230, 123, 177, 9 1 ' 0, 83,247,

10, 27, 76, 2, 4,

32, 0, 2, 160, 32, 1 38, 32, 8, 246,

3. 76, 226 3, 76, 250 9 , 2 30, 122 198, 93, 44 162. 240, 132, 240, 247, 32,

3, 164 17' 177 93, 232 1 1 0, 240 10, 251 0, 138 251' 0 189, 250, 94, 200, 200 240.222, 32 32, 27,251 4 136, 240, 0 8, 246, 0, 1 7 7 0, 3, 177 160, 32, 83.247 138, 32, 27 0, 230, 122 198, 93, 198 32, 10, 251 32, 27, 251 0, 230, 93 250, 208, 1 3 223,255, 1 194, 189, 76 0, 145, 89 230, 90, 96 0, 1 77, 122 35,224, 128 34,201, 59 26. 201' 32 0 0, 192, •

27,251, 0, 201' 2, 160, 223, 255. 0, 32, 150, 249, 0, 0, 160, 3350 data 7 1 , 249, 2, 2. 3360 data 230, 89, 208, 0, 0, 160, 0, 3370 data 1 62, 3380 data 240, 46, 201, 34, 240, 3390 data 240, 1 6 , 2 0 1 , 58, 240, 3400 data 240, 30, 201' 178, 240, 3, 200. 208,225, 341 0 data 240, 3420 data 208, 1 5 , 230, 1 22, 208, 217, 230, 3430 data 208, 213, 138, 73, 128. 1 70, 76, 0, 0, 0, 132, 93, 192, 3440 data 251 . 3450data200, 177, 1 2 2 . 2 0 1 . 66, 208, 3, 3460 data 158. 251. 3, 0, 201, 87, 208, 3, 0, 201. 1 98, 208, 3470 data 160. 251, 3, 3. 252, 0, 201. 128. 208, 3480 data 3, 0, 201, 80, 208, 3490 data 4 1 ' 252, 2, 0, 162, 237,255. 3500 data 72, 252, 0, 3510 data 237. 255, 1 , 32, 150, 249, 0, 165, 3520 data 194, 189, 76, 7 1 ' 249, 0, 3, 76, 172. 245, 2, 208, 3530 data 0, 0, 133, 0, 169, 8, 246, 3540 data 0, 132. 94, 160, 3550 data 32, 135, 249, 5, 0, 177, 122, 201' 44, 240, 3560 data 2, 3570 data 196, 94, 208, 245, 165, 2, 3580 data 5 1 ' 132, 93, 200, 165, 94, 132, 4, 3590 data 56, 229, 94, 133, 94, 176, 0, 0, 133, 94, 32, 83, 247, 3600 data 0, 165, 96, 240, 3610 data 32, 27, 251, 0, 165, 94, 3620 data 138, 32, 2 7 , 2 5 1 ' 3630 data 36, 164, 93, 200, 152, 24. 1 0 1 , 3640 data 133, 1 22. 144, 192, 230, 123, 208, 2, 169, 2, 3650 data 24, 165. 96, 240. 1 . 1 0 1 ' 89, 133, 1 , 105, 3660 data 1 •

123 70 96 76 76 76 76 76 160 32 2 76 96 0 200 240 94 169 0 4 240 122 188 1 89

JWylM6: � 7, lslueOI


FK NM IJ NK KK PO FO EA Nl Ml

EL KG MP 10 BA GL BH JL KD OJ FO CG CN OE OJ KB KL GN KD ON DO KM GO

MM PJ LB MP PF NO EP OJ NC PO CM KP DL IG BD OH CN MH DH IF AM BK pp AP MJ JD KN KO OM NL OJ CA BG HE AH CE LA

KH KG OP AN IH PL LA 81 NP LJ OG JE CM OA NM JK 10 EM BB AL FA NF FC CH EC NP IJ AH LB BJ AI IM

3670 data 144, 2, 2, 230, 90, 196, 94, 208 3680 data 175, 76, 148, 251, 0, 32, 1 35, 249 3690 data 0, 160, 1. 1 1 77. 1 22. 201 . 34 3700 data 240, 16, 166. 2. 2. 240, 1 5 , 132 3710 data 94, 32, 27, 251. o. 164, 94, 200 3720 data 196. 93. 208. 234. 76, 1 4 8 , 2 5 1 , 0 3730 data 230, 89, 208, 244, 230, 90, 208, 240 3740 data 165. 2. 3, 76, 201, 245 2. 208, 0, 162, 124, 255 3750 data 0, 32, 135, 249, 3760 data 2, 160, 124, 255, 1 ' 32, 1 50, 249 3770 data 0, 165, 89, 133, 57, 165, 90, 133 3780 data 58, 32. 194, 189, 76. 174, 167, 165 3790 data 89, 4 1 , 1. 1 , 240, 9, 165, 2 3800 data 8, 169, 0, 2, 240, 0, 32. 27 381 0 data 251 . 0, 76, 1 4 8 , 2 5 1 , 0, 230, 89 3820 data 208, 249, 230. 90, 208, 245, 76, 68 3830 data 65, 173, 189, 185, 165, 1 8 1 , 250, 250 3840 data 169, 1 6 1 , 177, 83, 84, 65, 1 4 1 , 157 3850 data 153, 133, 149. 250, 250, 250, 129, 145 3860 data 66, 78, 69, 208, 250, 250, 250.250 3870 data 250, 250, 250, 250, 250. 66, 69, 81 3880'data 240. 250, 250, 250. 250, 250, 250, 250 3890 data 250, 250, 67, 77, 80, 205, 221 , 21 7 3900data 197, 2 1 3 , 250, 250, 2 0 1 , 193, 209, 74 3910 data 83, 82, 32, 250, 250, 250, 250, 250 3920 data 250, 250, 250, 250, 76, 68, 88, 174 3930 data 250, 190, 166, 250, 182, 250. 162, 250 3940 data 250. 82, 84, 83, 250, 250,250,250 3950 data 250. 250, 96, 250, 250, 250, 76, 68 3960 data 89, 172, 1 88, 250, 1 64, 1 80, 250, 250 3970 data 160, 250, 250, 66, 77 , 73, 48, 250 3980 data 250, 250, 250, 250, 250, 250, 250, 250 3990 data 68, 69, 67, 206, 222, 250, 198, 2 1 4 4000 data 250. 250, 250, 250, 250, 175, 0 0, 0, 45, 6 1 . 57, 37, 53,250 4010 data 0, 4020 data 250, 4 1 ' 33 , 49, 66, 67, 83, 176 4030 data 250, 250, 250, 250, 250, 250, 250, 250 4040 data 250, 73, 78, 67, 238, 254, 250, 230 4050 data 246, 250, 250, 250, 250, 250. 66, 67 4060 data 67, 144, 250, 250, 250, 250. 250, 250 4070 data 250, 250, 250, 84, 89, 65, 250.250 4080 data 250, 250. 250, 250, 152, 250. 250. 250 4090 data 66, 80, 76, 16, 250, 250, 250, 250 4100 data 250, 250, 250, 250, 250, 65, 83, 76 41 1 0 data 14, 30, 250, 6, 22, 250, 10, 250 4120 data 250, 250, 67, 76, 67, 250, 250, 250 4130 data 250. 250, 250, 24, 250, 250. 250, 65 4140 data 68, 67. 1 09. 1 25. 121 . 1 0 1 . 1 1 7. 250 4150 data 250, 105. 97, 1 1 3, 69. 1 76, 0, 0 4160 data 77, 93, 89, 69, 85, 250, 250, 73 4170 data 65, 8 1 ' 84, 88, 65, 250, 250, 250 4180 data 250, 250, 250, 138, 250, 250, 250, 67 4190 data 80, 88, 236, 250, 250, 228, 250, 250 4200 data 250. 224, 250. 250, 74, 77, 80, 76 4210 data 108, 250, 250, 250, 250, 250, 250. 250 4220 data 250, 84, 65, 88, 250, 250. 250. 250 4230 data 250, 250, 170, 250, 250. 250. 73, 78 4240 data 89, 250, 250, 250, 250, 250, 250, 200 4250 data 250. 250, 250, 83. 84, 89, 1 40, 250 4260 data 250, 132, 148. 250, 250, 250, 250. 250 4270 data 1 76, 65, 0 . 13, 29. 25. 5 0, 4280 data 2 1 , 250, 250, 9, 1 . 17, 68 1' 4290 data 69, 89, 250. 250, 250. 250. 250, 250 4300 data 136, 250. 250. 250. 68. 69, 88. 250 4310 data 250. 250, 250. 250. 250. 202, 250. 250 4320 data 250, 83, 84, 88. 1 42, 250, 250. 134 4330 data 250, 1 50. 250. 250. 250. 250, 83, 66 4340 data 67, 237, 253. 249, 229, 245. 250, 250 4350 data 233. 225, 241, 66, 73. 84, 44, 250 4360 data 250, 36, 250, 250, 250, 250. 250, 250

The T ranaoc tor

•

EK IJ JA

NL PO HE AP AC OP JB EP GB JF KC

EE El BF GJ JK NF IK LG CH IN NK PM KN EL NL MK AB LF

76

4370 data 66, 82, 75, 250, 250, 250. 250, 250 0, 250, 250, 250, 66, 86 0, 4380 data 250, 4390 data 67, 80, 250, 250, 250, 250. 250, 250 4400 data 250. 250, 250. 66. 86, 83, 1 1 2, 250 441 0 data 250, 250. 250, 250. 250, 250, 250. 250 4420 data 67. 76. 68, 250. 250, 250. 250, 250 4430 data 250, 216, 250, 250, 250, 67, 76, 73 4440 data 250, 250, 250, 250, 250. 250, 88,250 4450 data 250, 250, 67, 76, 86. 250,250, 250 4460 data 250, 250. 250, 184, 250, 250, 250, 67 4470 data 80, 89, 204, 250, 250. 196, 250, 250 4480 data 250, 192, 250, 250. 73, 78, 88, 250 4490 data 250, 250. 250, 250, 250, 232. 250, 250 4500 data 250, 76, 83. 82. 78, 94, 250, 70 4510 data 86, 250, 74, 250, 250, 250, 78. 79 4520 data 80, 250, 250, 250, 250, 250, 250, 234 4530 data 250, 250, 250, 80, 72, 65. 250, 250 4540 data 250, 250, 250, 250, 72. 250, 250, 250 4550 data 80, 72, 80, 250, 250, 250. 250,250 4560 data 250, 8, 250, 250, 250, 80, 76, 65 4570 data 250, 250. 250, 250, 250. 250, 104. 250 4580 data 250, 250, 80, 76, 80. 250,250, 250 4590 data 250, 250, 250, 40, 250, 250, 250, 82 4600 data 79, 76, 46, 62, 250, 38, 54, 250 0 0, 4610 data 42, 250, 250, 250, 82, 176. 4620 data 1 1 0. 126, 250, 102, 1 1 8, 250. 106, 250 4630 data 250, 250, 82, 84, 73, 250, 250.250 4640 data 250, 250, 250, 64, 250, 250. 250, 83 4650 data 69, 67, 250, 250, 250, 250,250, 250 4660 data 56, 250, 250, 250, 83, 69, 68, 250 4670 data 250, 250, 250, 250, 250, 248, 250, 250 4680 data 250. 83, 69. 73, 250, 250,250, 250 4690 data 250. 250. 120. 250. 250. 250, 84, 65 4700 data 89, 250, 250, 250, 250, 250.250, 168 4710 data 250, 250, 250, 84, 83, 88,250, 250 4720 data 250, 250, 250, 250, 186, 250, 250, 250 4730 data 84, 88, 83, 250, 250, 250, 250, 250 4740 data 250, 154. 250, 250, 250, 1 8 , 83, 89 4750 data 77, 65. 83, 83, 32, 5 1 ' 46, 49 4760 data 48, 32. 82, 79, 66, 69, 82, 84 4770 data 32. 72, 85, 69, 72, 78, 32, 70 4780 data 69, 66, 32. 49, 57, 56. 54, 1 3 0, 13, 70, 73, 82, 83, 84 0, 4790 data 4800 data 32, 80. 65, 83, 83, 46, 46, 46 0, 0, 83, 69, 67, 79, 78, 68 4810 data 4820 data 32, 80, 65, 83, 83, 46, 46, 46 4830 data 0, 13, 65, 83, 83. 69, 77 0, 4840 data 66. 76, 89, 32, 67, 79, 77, 80 4850 data 76, 69, 84, 69, 0, 13, 83 0. 4860 data 89, 77, 66, 79, 76, 32, 84, 65 4870 data 66, 76, 69, 32, 79, 86, 69, 82 0, 4880 data 70, 76, 79, 87, 0, 13, 73 4890 data 76, 76, 69, 7 1 , 65, 76, 32. 81 4900 data 85, 65, 78, 84, 73, 84. 89. 0 4910 data 0, 13, 85. 78, 68, 69, 70, 73 4920 data 78, 69, 68, 32, 83, 89, 77, 66 4930 data 79, 76, 0, 0, 13, 66, 82, 65 4940 data 78, 67, 72, 32, 79, 85, 84. 32 4950 data 79, 70, 32. 82. 65, 78, 7 1 , 69 0, 13. 73, 76, 76, 69. 71 0, 4960 data 4970 data 65, 76, 32, 77, 79, 68. 69, 0 0, 13, 73. 76, 76, 69. 7 1 , 65 4980 data 4990 data 76, 32, 80, 83, 69, 85, 68, 79 0, 5000 data 45. 79, 80, 0

,Jo;f 1916: Volume 7, tssue 01


News BRK Submitting NEWS BRK Press Releases

• The TransBASIC Disk $9.95 This is the complete collection of every TransBASIC module ever published.

If you have a press release which you would like to submit for the NEWS BRK column, make sure that the computer or device for which the produd is . intended is prominently noted. We receive hundreds of press releases for each issue, and ones whose intended readership is not clear must unfortunately go straight to the trash bin. It should also be mentioned here that we only prinl

There are over 120 commands at your disposal. You pick the ones you want to use. and in any combination! It's so simple that a summary of instructions fits right on the disk label. The manual describes each of the commands. plus how to make your own commands. • Jim Bulterfield's 1986 Diary $5.95 (plus SOq p&h)

product releases which are in some way Applicable to Commodore equipment.

Jim has put together a handy pocket reference that includes the most-used

Transactor News

areas of memory maps, command summaries, equipment summaries, some short programs, sound and video, machine language, and a glossary. followed by a pocket diary and a neat colour map of the London England Underground.

Transactor on Microfiche

in case you're going there. We now have 18 Transactor Magazines on microfiche! - all of Volume 4. Volume 5, and Volume 6. According to Computrex. our fiche manufacturer, the strips are the "popular 98 page size", so they should be compatible with every

• The SM Compiler $39.95 US. S49.95 Cdn This compiler is for BASIC 7.0 on the Commodore 128. We've compared it with two others, and this is the one we like. Watch for that comparim11 in an upcoming issue.

fiche reader. To keep things simple, we're making the price of the fiche the same as magazines. with one exception. A single back issue will be $4.50 (remember.

• Super Kit 1541 $29.95 US, $39.95 Cdn

you can now get those 5 Transactors that are no longer available on paper!). and subscriptions will also be the same price as shown on the order card. The exception? A complete set of 18 (Volumes 4. 5, and 6) will cost just $39.95!

Super Kit is. quite simply, the best disk file utility there is. No more losing those valuable copy-protected originals (like what's happened to me twice in the last month). See the News BRK item ahead.

Transactor Mail Order Ne ws

• Paperback Weiler

C64

• Paperback Planner C64 • Paperback Filer C64

Our mail-order department is expanding nicely, but our mail-order card isn't. Seems we just can't find any more room to put more text without making it so

• Paperback Writer Cl28 • Paperback Planner Cl28 • Paperback Filer Cl28 • Paperback Dictionary

small that you can't read it. So, if you're using the card to order, we suggest you pull it out and cross-reference with the list below for more details. • Inner Space Anthology $14.95

$39.95 US, $49 95 Cdn $39.95 US, $49.95 Cdn S39.95 US, $49.95 Cdn $49.95 US, $69.95 Cdn $49.95 US. 569.95 Cdn $49.95 US, 569.95 Cdn $14.95 US, $19.95 Cdn

In our opinion. the Paperback packages from Digital Solutions are the best you can get on their own - the fact that they work with each other makes them even better. Planner and Filer data can be loaded into the Writer, Writer text can be

This is our ever popular Complete Commodore Inner Space Anthology. Even after a year. we still get inquiries about its contents. Briefly. The Anthology is a reference book - it has no "reading" material (ie. "paragraphs"). In 122 pages.

sent

10

the Filer, and etcetera. The Dictionary spell checker works with both

there are memory maps for 5 CBM computers. 3 Disk Drives, and maps of COMAL: summaries of BASIC commands, Assembler and MLM commands. and Wordprocessor and Spreadsheet commands. Machine Language codes and . There are modes are summarized, as well as entry points to ROM routines

versions of the Writer.

sedions on Music, Graphics, Network and BBS phone numbers, Computer

microfiche - these are marked "MF only" This list also shows the "themes" of

Clubs, Hardware, unit-to-unit conversions. plus much more. . . about 2.5 million characters total'

each issue. "Theme issues" didn't start until Volume 5, Issue 01.

As mentioned earlier, all issues of The Transactor from Volume 4 Issue 01 forward are now available on microfiche. Some issue are ONLY available on

• Vol. 4, Issue 04- MF only (• Disk I) • Vol. 4. Issue 05- MF only (• Disk I) • Vol. 4, Issue 06- MF only ( • Disk I) (• Disk 2) • Vol. 5. Issue 01 -Sound and Graphics • Vol. S. lssue 02- Transition to Machine Language (• Disk 2) • Vol. 4, Issue 01 (• Disk I) • Vol. 4, Issue 02 (• Disk I } • Vol. 4. lssue 03 (• Disk I )

• The Toolbox (PAL and POWER) $79.95 PAL and POWER from Pro-Line are two of the most popular programs for the Commodore 64. PAL is an easy-to-use assembler (most assembler listings in The Transactor are in PAL format). and POWER is a programmer's aid package that adds editing features and useful commands to the programming environ­ ment. They come with two nice manuals, and our price is $50 less than suggested retail'

• Vol. 5, Issue 03 - Piracy and Protection - MF only • Vol. 5. 1ssue 04- Business & Education - MF only

( • Disk 2) ( • Disk 3)

• Vol. 5, Issue OS- Hardware & Peripherals

(• Disk 4) (• Disk 5)

• Vol. 5, Issue 06 - Aids & Utilities • Vol. 6, Issue 01 - More Aids & Utilities

• The GUNK C64 to IEEE Interface $49.95 The GUNK plugs into the cartridge pori, but doesn't extend the pori for more cartridges (for that you'll need a "motherboard" of some kind). The other side of

• Vol. 6, Issue 02- Networking & Communications • Vol. 6. Issue 03- The Languages • Vol. 6. Issue 04 - Implementing The Sciences

the GUNK is a IEEE card-edge suitable for a PET-IEEE cable. From there, any IEEE device can be accessed including disk drives. modems. printers. etc. The GU K is "transparent" - that means it won't interfere with programs. except

• Vol 6. Issue 05- Hardware & Software Interfacing • Vol. 6. Issue 06 - Real Life Applications • Vol. 7. 1ssue 01 - ROM I Kernel Routines

those that rely on the serial routines which it replaces (ie. programs with built·

in "fastloaders" for the 1541 won't like the presence of the GUNK). It has no manual (aside from one page of installation instructions) because it alters

(• Disk 6) (• Disk 7) ( • Disk 8) ( • Disk 9) ( • Disk f0) (• Disk I I ) 1• Disk 12)

Notes: The Transactor Disk •t contains all t>rogram from Volume 4. and Disk •2 contains all programs from Volume 5, Issues 1-3. Afterwards there is a

nothing and leaves everything unchanged! An on-board switch allows you to select Serial or IEEE. GUNK works with both the C64 and the Cl28 in 64 mode.

separate disk for each issue. Disk 8 from The Languages Issue contains COMAL 77

J46y 1916: � 7, .._ 01


0.14, a sort-loaded, slightly scaled down version of the COMAL 2.0 cartridge.

The 1541 Revealed

The Vlewtron Starter Kit

"The IS41 Revealed" is a 48-page booklet from Write Protect Publishing. Written by Felix Rivera and Evelio Quiros. the book contains information and diagrams concerning the 1541 disk drive's internals, and practical tips to

And Volume 6. Issue OS published the directories Transactor Disks I to 9.

prolong the unit's life. Sections of the book include: An overview of the 1541, how and why problems arise, "The Naked I 541", Cleaning, lubricating,

Since Viewtron is now shipping starter kits for free ($2.SO US. p&h), we've discontinued distribution. See the ad this issue for more details.

adjusting and aligning. A section on modifications explains how to: change

device numbers, add a front-mounted power switch, change the head end-stop to a "springy'' one, and add a write-protect switch. The writing style is informal

Transactor Open On Vlewtronl Remember, any of the above items can be ordered from our Transactor Section

and easy to understand.

We'll respond to confirm, and usually have your order out the same week. See the "Viewtron Keywords" article on page 26 of this issue for more info.

A labelled general board layout of the I 541 is found in the centre of the booklet, and a "track checker" program and a list of references is included at the end.

In the next Transactor we'll have a complete rundown on using the Transactor section, which, for the most part, will apply to just about any Viewtron section. If you get on before that, leave us some mail - we'll be happy to hear from you'

Write Protect Publishing Company

on Viewtron. Just sign on, enter "transactor", and proceed to the order section.

Price of the booklet is $5.00. For more information, contact:

Suite 4E, 135 Charles Street New York, NY 10014

The Transactor Communications Disk

Used Computer Listing Service

We're currentlyworking on a "Transactor Communications Disk". We already have permission from Viewtron to include their software and hope to include many more. When finished it could host as many as I 5 different modem

Due to widespread demand, Comp-Used, which has helped buyers and sellers of used computer equipment in the North East for two years, is expanding its

programs and may even require two diskettes. We also plan an "all-in-one"

services.

for virtually any host computer and protocol. But it's not ready yet so don't send any orders. More next issue.

s Comp-Used is a listing service that facilitates the sale and purchase of ued computer equipment. Anyone with equipment worth over $100 can contact

manual to go with it so you'll never be without a telecommunications program

the Comp-Used computer to register the product for sale. In the same vein, anyone in the market to purchase equipment can call the Comp-Used computer

Industry News Workshops In Computer-Assisted Instruction In Music

for information. Comp-Used connects the buyer and seller and they finalize the sale. When a transaction takes place, the seller pays Comp-Used a small commission; there is no charge to buy.

The lab for Computer-Assisted Instruction In Music at Brooklyn College will be

To talk with the Comp-Used telephone computer, call (203) 762-8677

offering two workshops this summer for music teachers who are interested in using computers as a teaching tool. Each workshop will last five days and

Comp-Used 8S Rivergate Drive

include IS hours of classroom instruction on the Commodore 64 computers and their applications in teaching music. The cost: $200.00/workshop. The

Wilson, CT 06897

datesare July 7-l l , 1986andJuly 14-18, 1986.

Steve Jobs and Pixar Employees Buy Pixar These workshops are offered in affiliation with the Center for Computer Music

San Raphael, CA. - Pixar, the computer graphics division of Lucasfilm Ltd., has announced that it has been acquired by Steven P. Jobs and the employees of Pixar. Pixar, now an independent company, will design, manufac t ure and

at Brooklyn College. For further information and application, contact: Gary S. Karpinski. Director Lab for CAl in Music

market high performance computers and software specifically tailored for state

Conservatory of Music Brooklyn College, Brooklyn, NY 1 1 2 1 0 (718) 780-5286

of the art computer graphics and image processing applications.

Distressed Commodore Users Hotline

Computer is nearly 200 times faster than conventional minicomputers at

The new firm has a product, the Pixar Image Computer, ready for market. Developed during the last three years at Lucasfilm Ltd., the Pixar Image performing complex graphic and image computations. At these specialized tasks, the Pixar Image Computer is also faster than a $6 million supercomputer.

On January I st, 1986. David Bradley began operating a brand new Freeware service for new Commodore computer users. It is a hotline for users to call

The Pixar Image Computer will be introduced to the commercial and scientific markets within the next 90 days and will sell for approximately $125,000.00.

when they are having trouble(s) with their new machines. The hotline operates

Monday to Friday from 2:00 PM to 10:00 PM and the number for users to ca.ll is

Pixar was originally formed in 1979 by George Lucas to bring high technology

(416) 488-4776. Users that want more information about the service can write to:

to the film industry. Lucasfilm Ltd. will continue to use the Pixar Image Computer and other technologies to produce computer animation for films

through its special effects division, Industrial Light & Magic (ILM), and for home

Distressed Commodore Users Hotline

147 Roe Avenue Toronto, Ontario, Canada

entertainment through its Games Group.

M5M 2H8

MSD Disk Drive Information Exchange

Or they can call any line of the Bradley Brothers Bulletin Board System at (416)

Now that Micro System Development, the maker of MSD Disk Drives. is no longer in business. an information exchange is being set up to seive the needs of MSD disk drive users. The first project is a database of compatible software.

487-5833, (416) 481-8661, (416) 481-9047 or (416) 277-9991 All four lines operate 24 hours a day, 7 days a week.

71

Jli( 1986: VoUne7, ._ 01


Users of MSD disk drives are encouraged to participate in the exchange.

DISKORGANIZER For The C64

The MSD Information Exchange is a no fees, not-for-profit, user service. Those who contribute information to the exchange will be provided the following serv1ces:

You probably bought your computer, at least partially, to help you get orga· nized. And you probably started with a handful of disks on which you stored all your Iiles. But now you have boxes and boxes of disks with directories that look like they were organized by a not particularly bright chimpanzee. You like elegance and order, and you wish you could organize your disks, but this seems

I . For a self-addressed stamped envelope, a printout of available information in one selected category.

such a gargantuan task that you keep putting it off. The order of the files on a Commodore disk directory seems to be engraved in stone. (fhe same stone

2. For a blank disk with mailer and return postage, a copy of the Information Exchange data disk in Superbase 64 format (data disk only). Typical entries in the exchange data base include-

holds the header.) The only way to reorganize the directory is through laborious file copying to a fresh disk, right? Wrong! We have good news: DISKORGANIZER for the C-64.

Word Processor, PaperClip 64, Batteries Included. 64C Edition SD-2: Fully compatible serial or parallel (Quicksilver interface)

With this ultimate disk utility for the C-64 you can quickly and easily sort and rearrange the disk directory of any unprotected disk to meet your own specifications, and the new directory is actually written back onto the disk!

Spreadsheet, Multiplan 64, Hesware. v. 1.06

Using a convenient screen editor you can also change the header, scratch files. copy files of any size to another disk, rename files, add 'fences' to mark off

SD-2: Partially compatible. Data files may not be saved.

sections of the disk for easy reading and independent sorting, 'scratch-protect' Backup, MSD Shure Copy, Megasoft

any file, position individual files anywhere in the directory, and, of course. print out copies of your revised directories.

SD-2: Serial compatible. Parallel: Incompatible with Quicksilver

You may have a copier utility or utility to rename the header or you may use the

Entertainment, Flight Simulator II, Sub Logic SD-2: Incompatible

wedge for common disk commands. But you don't have a single program that will take care of all your disk housekeeping (even housekeeping you didn't think possible) quickly and easily. But you will, if you get DISKORGANIZER

The information exchange will also maintain files on the availability of technical information on MSD disk drives including parts, service, service or

and get organized. DISKORGANIZER is available for $29.95 from:

maintenance manuals, wiring diagrams. memory maps, etc. as provided by users.

The G.A.S.S. Company 970 Copeland

Software News

North Bay. Ontario, Canada PIB-3E4

Introducing Super Kit/ 1541

(705) 474-9602

Prism Software is proud to introduce Super Kit/1541 for the Commodore 64. Super Kit is the most full-featured I 541 utility package to be found today. Just

Arniga Spreacbheet, Telecommunications and BBS

look at the features offered:

Micro-Systems Software Inc. has released three new software tools for the Amiga. The first is a spreadsheet called Analyse!. Similar in concept to Lotus I ·

Single/Dual Normal Copier: Copies a disk with no errors in 32.68 seconds. Dual vesion r has graphics and music.

2-3. the $99.95 program takes maximum advantage of Amiga's capabilities (pull down menus, mouse. workbench) and can produce professional sized spreadsheets (256 columns x 8,156 rows).

Single/Dual Nibble Copier: Nibble copies a disk in 34.92 seconds. Dual version has graphics and music.

The second package. Online!, is a full-featured telecommunications system for

Single/Dual File Copier: 6 times normal DOS speed. Includes multi-copy,

the Amiga that retails for $69.95 The third package. BBS-PC. is a versatile electronic bulletin board system that transforms any Amiga into an online

multi-scratch, view-edit BAM, and new Super DOS Mode.

information network.

Track and Sector Editor: Full editing of t&s in hex, dec, ascii, bin. Includes monitor/disassembler with printout commands.

The $99.95 program easily interlaces to a hard disk or keeps up with a 2400 bps modem. In addition, BBS-PC works in the "background", so the Amiga can answer the phone and take messages while users are working on other projects.

GCR Editor: Yes disk fans. a full blown sector by sector or track by track GCR editor. Includes Bit Density Scan.

All three packages are being distributed by Softeam, National Software Distribu· tors and Computer Software Services in the U.S, and in Canada by Phase 4

Super DOS 1: Fast boot for Super DOS. I SO blocks in I 0.12 seconds.

Distributors. For additional information contact:

Super DOS II: Screen on and still loads 150 blocks in 14 87 seconds. Super Nibbler: Quite frankly, if it can be copied on a 1541, this will do it!

Brown-Wagh Publishing 100 Verona Court

Including Abacus, Timeworks. Accolayde, Epyx, Acti-vision, Electronic Arts.

Los Gatos, California 95030

The price, $29.95 plus $3.00 shipping and handling.

The Sourcerer 6500 Series Disassembler

Prism Software

The Sourcerer is a multi-pass disassembler which converts 6500 series ma­ chine language (object code) into Assembly Language (source code). It operates disk-to-disk. disk-to-screen, or disk-to-printer. The commented Assembly Lan· guage which is produced can be immediately re-assembled with the Commo­ dore assembler. or loaded for editing with the Commodore editor. Any specified

401 Lake Air Drive, Suite D Waco. Texas 76710 Orders (81 7) 757-4031 (or use order card at center) Tech (817) 75 1-0200 79

(408) 395-3838

JWy 1986: VoUne 7, laue 01


extended power outages, the on-line unit operates without disruptive switching transients. Automatic internal battery recharge is incorporated.

range ol code within a program can be disasmbled. se Long programs automati· cally produce linked disk Iiies lor easy editing. All addresses referenced in the

code are converted to labels. in several sorted catagories. The Sourcerer is written in 100% machine language lor last operation, and will disassemble a 20k program with several thousand address labels in less than 13 minutes. The

Wide band EMI/RFI !iltering and High-Speed, High-Current Spike Suppression provide extended protection. Added protection is provided by an integral over­

time required for the final output of source code depends on the speed ol the

load/short-circuit proof configuration.

output device (disk, screen, or printer). A front panel TEST switch permits convenient power removal to check front panel monitors and complete system operation.

The Sourcerer is only $29.95 ppd. on a 1541 disk complete with operating instructions. Order !rom:

Line phase lock. automatic Blackout illumination. Battery-Saver automatic shut-down option and external battery option are featured. Available in 250

Chessolt Ltd. 723 Barton Street Mt. Vernon, IL

and 500 watts. For more information, contact: 62864 Electronic Specialists Inc.

Help Muter For The Commodore 64

171 South Main Street Natick, Massachusells

Help Master 64 is a software/book package that will aid Basic programmers. Help Master 64 provides instant, on-line help screens on each and every Basic

01760

command used by the Commodore 64 computer.

80 Column Mono Cable for The C-128

Once loaded, Help Master 64 remains hidden in memory until you need it. It takes up absolutely none or the Basic RAM, is completely compatible with the

This is the cable lor an 80 column monochrome display as described in many Commodore specific magazine. It eliminates the need lor an RGB monitor and

DOS wedge, and has no effect on your ability to write. edit, load. save or run any Basic program.

allows the use or any composite color or monochrome monitor. Excellent for data base and word processing applications. (See next item lor address)

When you need help, typing the quote mark plus the name or the command

40/80 Column Switch Cable for The C-128

1-800-225-4876

will instantly produce a hall-screen overlay showing the Commodore abbreviaA flip or a switch on the connector is all that's needed to change !rom 40 to 80

tion lor the command, the proper syntax, a description or the command and reference page numbers in various manuals which will provide more inlormation than is available on-screen. This hall-screen format will allow you to view both your actual program line and the Help Master example at the same time so you can see what the dilferences are.

column display and back again. Plus a simple keystroke (ESC X). In 40 column mode all 1 6 colors are available on your color monitor. .

It's small and easy to install, with no bulky switches, boxes or exposed components.

Alter viewing the help screen, you may restore the information that was on the top hall or the screen, or you can correct your program line while the help screen is still being displayed.

The 80 Column Mono Cable retails lor $9.95. The 40/80 Column Switchable cable retails lor $23.95. For more information contact:

Help Master 64 comes with the 'Handbook Of Basic lor the Commodore 64', an excellent 368 page reference manual on Commodore Basic by Frederick E. Mosher and David I. Schneider, published by Bradey Communications, Inc.

Innovative Computer Accessories 1249 Downing Street, PO Box 789 Imperial Beach, CA 92032-0837

(619) 224-1 177

The package has a retail price or $29.95. For more information contact:

C.A.S.E.

Master Software 6 Hillery Court Randallstown. MD 21133

(301) 922-2962

Hardware News RESWITCH from Compusave Reswitch

is

a reset switch/power-on indicator lor the Commodore 64 which

replaces the existing power-on LED. Installation requires no drilling or cutting, as the unit pops into the same hole as the existing LED. The Reswitch is a transparent pushbutton containing an LED and acts exactly like the original LED except that pushing down on it causes the 64 to reset. The package comes with detailed installation instructions and everything needed to hook up. Price is $10.00. Contact: Comp U Save 1 1 5 Essex St. Suite 1146 New York, NY 10002 Uninterruptible Power Supply An on-line, sine wave Uninterruptible Power Supply is being introduced by Electronic Specialists. Capable of supplying up to 20 minutes power during

COMMODORE ASSOCIATION SOUTH/EAST presents

THE COMMODORE SHOW at the

Opryland Hotel

Nashville, Tennessee April 26th & 27th, 9:00a.m. to 5:00p.m. NATIONAL COMMODORE SPEAKERS! VENDORS AND DISPLAYS! SHOW SPECIALS AND DOOR PRIZES! SEE INNOVATIONS AVAILABLE FOR THE COMMODORE MARKET! THE ONLY COMMODORE CONFERENCE IN THE SOUTH EAST! USER GROUP ORIENTED!

2-0AV REGISTRATION FEE: SIO.OO ($7.50 bdo� April 15) Tickets are available at all affiliated clubs, or for more information, contact:

C.A.S.E. • P.O. BOX 110386 • NASHVILLE, TN 37222 (615) 834-5679 • (615) 834-2073 • (205) 854-3496

N'( 1916: Yolume 1, ....,. o1

I


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.