17.07.2016 Views

COAET" • r

Apple-Orchard-v3n2-1982-May-Jun

Apple-Orchard-v3n2-1982-May-Jun

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

If you read last issue's installment, you may remember<br />

that that article involved interfacing an Assembly language<br />

routine to an Apple/// Pascal program. The procedure and<br />

techniques we used were exactly the same as those used in<br />

Apple II Pascal. Those of you out there who are familiar with<br />

how Apple Pascal links up with Assembly language will see<br />

that the way invokable modules are created and used<br />

directly parallels the Apple Pascal technique. Therefore, I<br />

would highly recommend the Apple II Pascal Operating<br />

System Reference Manual chapter on The Assembler for<br />

some background material on writing Business BASIC<br />

ivokable modules.<br />

Getting Down to Details<br />

Alright already, enough discussion and reference. How di<br />

I do it? Glad I asked. Well, here goes.<br />

Assembly language routines which can be used from<br />

Business BASIC are written with the Apple // / Pascal system.<br />

In general, the code is created in the Editor, assembled<br />

with (surprise!) the Assembler, saved to disk, then used<br />

from the Basic program.<br />

Here's a nice bonus effect of having both Pascal and<br />

BASIC served by the same operating system and disk format:<br />

the same Assembly language routine can often be<br />

used by both BASIC and Pascal with little or no modification.<br />

As a demonstration of that claim, our first BASIC<br />

invokable module will use exactly the same Assembly language<br />

file as was used last time with Pascal, which prepares<br />

the system for a cold start. If you didn't enter the file last<br />

time, have since erased it, or (shame on you!) don't have the<br />

previous issue, I'll repeat it here, with instructions. (Back<br />

issues of the March-April 1982 issue of Apple Orchard are<br />

available.)<br />

First, enter the Pascal Editor, and type in this file: (some of<br />

the comments have been omitted this time)<br />

.PROC RESTART<br />

COLD_START .EQU 65<br />

$65<br />

BRK<br />

parameters<br />

;COLD_ST ART's<br />

number is<br />

;To signal a SOS<br />

call<br />

;Tells which call<br />

.BYTE COLD_START<br />

.WORD PARAM_TABLE ;Points to the<br />

PARAM_TABLE .BYTE 00<br />

para ms<br />

.END<br />

;see Mar-Apr Apple<br />

Orchard for details<br />

;COLD_START<br />

has no<br />

Then, leave the Editor and save the file by typing<br />

"QW.D2/RESTART', substituting a different disk drive<br />

name for .D2 if you wish. Then press "A" to assemble the<br />

file. Answer ".D2/RESTART" to the "Assemble what text?"<br />

question, using something other than .D2 if you didn't save<br />

to Drive 2 from the Editor. When asked "To what code file?",<br />

answer by typing a dollar sign. This will cause the output file<br />

to be called RESTART.CODE on the same disk as the<br />

source file. Press [RETURN! when asked for an output file<br />

name.<br />

Once the assembly has been finished, you should have a<br />

real, live, bona fide invokable module!. To prove it, boot your<br />

Business BASOC 1.1 diskette, then put the diskette with<br />

RESTART.CODE on it in the built-in disk drive. Type<br />

"INVOKE .DI/RESTART.CODE" to load the module from<br />

disk Then type "PERFORM REST ART' and watch the fun.<br />

Your screen should say "INSERT SYSTEM DISKETTE<br />

AND REBOOT' in 40-column text mode. You've just written<br />

and executed an invokable module! That wansn't so<br />

bad, was it?<br />

Now that you've got the basics of writing invokable<br />

modules, you should be able to handle the whole story,<br />

which appears in (ta-daa!) Apple's new technical note,<br />

Apple / / / Business BASIC and its Assembly Language<br />

Interface. This note should be available from the IAC soon,<br />

or write to the author (that's me) in care of Apple Orchard<br />

for more information on writing invokables or unlocking<br />

any of the other Apple / / / mysteries.<br />

For further information: be sure and read (and reread)<br />

your Standard Device Drivers Manual. It's got great gobs of<br />

goodies in there, and it will likely answer some of your<br />

favorite technical questions about the Apple //I- Also, the<br />

Apple / / / Pascal manuals are worht a perusal or two.<br />

And now, folks, it time to practice your invocations!<br />

May -June 1982 67

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!