13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

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.

The Host ProgramUse the Editor to create a textfile named MAIN containing the followingtext:PROGRAM MAIN;USES APPLESTUFF,{ MAINLIBIU is first since REGUNIT uses it also }{$U LMAIN.LIB} MAINLIBIU, {$U REGUNIT.CODE } REGUNIT,{$U INTRINU.CDDE} INTRINU;CONST LENGTH = 89;VAR I,RESULT,INVAL,IDR:INTEGER;MSTR:STRING;{ Return INT multiplied by 2 }FUNCTION MULT2CINT:INTEGER>:INTEGER; EXTERNAL;{ Store INT in I if INT >= LENGTH }PROCEDURE STOREICINT:INTEGER>; EXTERNAL;BEGINWRITEC'Starting main, enter MSTR:'>;READLNCMSTR);REGUPROCCMSTR>;MAINLIBP;I : = til ;{$!-} { Turn off system input checking; do it ourselves }REPEATWRITEC'Value to multiply by 2:');READCINVAL>;I DR:= IDRESUL T;READLNUNTIL IDR=!I;{$!+}RESULT:=MULT2CINVAL);STORE I CRESUL T>;WRITELNC'l=',I,', RESULT=',RESULT>;INTRINUPROC;WRITEC'Press any key:'>;WHILE NOT KEVPRESS DO ; { Wait for user to press a key }WRITELNC'Done!')END.The Host Program 11-275

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

Saved successfully!

Ooh no, something went wrong!