13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

UNITST ATUS Demonstration ProgramThe following program demonstrates how UNITSTATUS may be used witha printer and with a remote input device. It repeatedly tests a remote inputand a printer, using UNITSTATUS. If the remote input has a characterwaiting to be read, TestStuff reads it and places it in a buffer. If the printeris able to accept output, TestStuff sends it a character from the buffer. Italso outputs a LINE FEED character after each RETURN. To exit TestStuff,you set KEYPRESS by typing any character. Here is the listing.PROGRAM Te5tStuff;USES AppleStuff;COHST buflimitkeyboardprinterreminerlf1ill!;2;6;7;13;11!;{ needed for keypre55 }{ volume number5 }{ ASCII control character5 }TYPE buflndex B .. bufLimit;VAR re5ult integer;rPtr,wPtrbufchbuflndex;PACKED ARRAYchar;Cbuflndexl OF char;BEGIHwriteln;writeln;writeln C'Fire away!');rPtr := B;wPtr := B;{ initialize read pointer }{ initialize write pointer }(Listing is continued on next page.)Device 1/0 OperationsIII-191

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

Saved successfully!

Ooh no, something went wrong!