þþwdX;-------------------nX;xX;I/O Subroutines‚X;ŒX;For the TEXT EDITOR–X; X;FILE: IOSUBªX;´X;-------------------¾X;ÈX;OPEN a file/deviceÒX;Ü$X;This routine will open whateveræX;file or device is named inð X;the string - FILNAM. It I/Oú$X;mode is transfered in IODIR. ItX;will also pause the VBI's.X;‡OPENFIL †CLOSE1" #†PAUSE?,$>6Q>@ P…ICCOM9J Q>4†FILNAMT P…ICBAL9^ Q>5†FILNAMh P…ICBAH9r Q…IODIR| P„AUX19†Q> P„AUX29š !„CIOV¤X;®X;Close IOCB #1¸X;†CLOSE1$>ÌQ> Ö P…ICCOM9à !„CIOVêX;ôX;Open PrinterþX; …OPENP%>†OPENP1Q„PDEV8 P†FILNAM8&10 I†OPENP1:Q>D P…IODIRN H‡OPENFILXX;bX;Custom Input RoutinelX;v$X;This is my famous INPUT routine€X;that I used in DEBUG+ andŠ X;about 10 other programs. It”X;will fetch a 24 characterž!X;string from the keyboard and¨#X;return it in MYBUF, terminated²X;by a EOL ($9B).¼X;Æ…INPUTQ>;;length = 0Ð P„CENDÚ#„IPUT;;signal inputä †ERMYBF;;and bufferî„GETC †GETKEY;;get a keyøR>;;ESCape?H†GOTCHR;;nope.  "„IPUT;;;signal error :;;and leave*†GOTCHR%>…ILEGS4M>>†CHKLEGR…ILLEG8H F„GETCR1\ I†CHKLEGf Q…OLDACp†INPDELR>~;;Delete?zH†NOTDEL;;no.„"„CEND;;lower lengthŽIƒTS2;;<0? no.˜Q>;;make zero.¢ P„CEND¬ƒTS2 „TST1;;test length¶Q„CEND;;get lengthÀF„GETC;;if not 0 go!Ê%„CEND;;put in a spcÔ)>Þ H…DODELè1ò …DODELQ>üP…COMLN8;;erase charP…COMLN8;;erase cursorF„GETC;;get next.†NOTDELR>œ;;Delete Line?$F„GETC;;yes.. %„CEND8 P…MYBUF8BR>ƒEOL;;EOL?LF…ATEND;;done!V †ASC2IC;;make icode`)>j H„SHCHt1~„SHCHP…COMLN8;;to screenˆ3’)>œ D„TST9¦1°„TST9'„CENDº „TST1;;length?Ä!„GETC;;do again.Î…ATENDQ…MYBUFØ R>ƒEOLâ F…INPUTìQ>öP…COMLN8;;erase cursor P„IPUT ,;;show good input :;;bye.X;(X;Test INPUT length2X;<„TST1Q„CENDFHƒTL1P P…COMLNZ P…COMLNdƒTL1:nX;xX;Get and copy Filename‚X;Œ X;This calls INPUT to fetch a– X;filename, if ESC is pressed "X;it returns to MAIN. Otherwiseª X;it converts the filename to´#X;upper-case and moves it to the¾X;FILNAMe buffer.È!X;If the user tried to use theÒ"X;E: or S: devices for file I/OÜX;the routine defaults to D:æX;ð†COPFIL …INPUTú D„COP077 !†CLRWIN"X;, „COP0$>6Q…MYBUF;;second char@R> :J F…YZEROTQ…MYBUF;;third char^R> :h F…YZEROr%>|„COP1Q…D1TXT8† P†FILNAM81š I„COP1¤%>® H‡COPMYBF¸ …YZERO%>‡COPMYBFQ…MYBUF9Ì †CONL2UÖ P†FILNAM8à R>ƒEOLê F‡COPFILDô3þ2(> H‡COPMYBF‡COPFILDQ†FILNAM&R> E0 F…INSDD:R> SD HˆCOPFILD2N …INSDDQ> DX P†FILNAMb ˆCOPFILD2:lX;vX;Perform I/O Operation€X;Š†PERFIO$>” P…ICCOM9ž Q…MEMST¨ P…ICBAL9² Q…MEMST¼ P…ICBAH9Æ !„CIOVÐX;ÚX;Convert lower to UPPERäX;î X;This simply check to see ofø X;the char is lower-case or a X;CONTROL character, if so it X;converts it to upper-case.X; †CONL2UR>ƒEOL* F…CNNCR4R>{> E…CNNCRHR>aR D„CNL2\;fS> p „CNL2R> z E…CNNCR„,ŽO>@˜ …CNNCR:¢X;¬X;LPRINT MYBUF to printer¶X;À!X;This is similar to the BASICÊX;LPRINT statement. It sendsÔ"X;MYBUF to the printer, settingÞX;a max output of 80 chars,èX;terminated with an EOL.òX;ü‡LPRINTR$> Q>  P…ICCOM9 Q>4…MYBUF$ P…ICBAL9. Q>5…MYBUF8 P…ICBAH9B Q>PL P…ICBLL9V Q>` P…ICBLH9j !„CIOVt X;~ X;Print a CR to printerˆ X;’ "X;This simply sends out a blankœ !X;line to the printer by first¦ !X;erasing MYBUF (a precaution)° X;then putting an EOL in theº "X;first position in MYBUF, thenÄ X;it falls through to LPRINT.Î X;Ø „LPCR †ERMYBFâ Q>ƒEOLì P…MYBUFö X; X;Print a line and check for X;page break. X; "X;This first sends out the line( X;in MYBUF, then bumps the2 X;number of lines printed,< "X;checks to see if we should doF !X;a FORM FEED, if so we do andP "X;then we increase the PAGENUM.Z #X;If an error happens during thed !X;print LPRINT returns the CIOn X;error code in the Y-reg.x X;‚ †LPRINT ‡LPRINTRŒ G…LPERR– #…LINES  Q…LINESª R>>´ D…LPOUT¾ Q>ƒEOLÈ P…MYBUFÒ ‡LPRINTRÜ ‡LPRINTRæ ‡LPRINTRð #‡PAGENUMú Q> P…LINES …LPOUTQ> …LPERR:" X;, #X;This is the directory routine.6 X;It first asks what drive to@ #X;get the directory from (12348)J X;and then will get and printT #X;the directory, putting 2 file-^ #X;names per line. If the end ofh !X;the screen is reached beforer #X;the directory is done, we will| #X;wait for a key, then clear the† X;screen and start at the top X;again.š X;¤ …DODIR†PRINT …DIRMS® †GETKEY¸ %> †DIRLP1R‡DIRNUMS8Ì F‡GOTDIRNÖ 1à I†DIRLP1ê :ô X;þ ‡GOTDIRNP†DIRTXT %> †DIRLP2Q†DIRTXT8 P†FILNAM8& 10 I†DIRLP2: Q>D P…IODIRN †CLOSE1X  ‡OPENFIL;;open diskb I‡DIRGOODl †PRINT …DIRERv †CLOSE1€ "†PAUSE?Š !†GETKEY” ‡DIRGOOD †CLRSCRž Q>¨ ,² O>4…SCMEM¼ PƒSCRÆ Q>5…SCMEMÐ O>Ú PƒSCRä Q>î P„COLSø P…LINES †DIRLP3 †READIR G‡DIRDONE %> †DIRLP4Q…MYBUF8* R>ƒEOL4 FˆENTRYFIN> †ASC2ICH P@ƒSCR7R 3\ H†DIRLP4f ˆENTRYFIN#„COLSp Q„COLSz R>„ D…ADD20Ž Q>˜ P„COLS¢ #…LINES¬ Q…LINES¶ R>À FˆPAUSEDIRÊ …ADD20QƒSCRÔ ,Þ O>è PƒSCRò QƒSCRü O> PƒSCR !†DIRLP3X;$ˆPAUSEDIR†PRINT …DIRPS. †GETKEY8R>B FˆDIRLEAVEL†PRINT …DIRMSV !‡DIRGOOD`X;j‡DIRDONE†PRINT …DIRFNt †GETKEY~ˆDIRLEAVE †CLOSE1ˆ "†PAUSE?’ !†CLRSCRœX;¦X;This routine will get one°"X;directory entry from the diskºX;and put it in MYBUF.ÄX;ΆREADIR$>ØQ>â P…ICCOM9ì Q>4…MYBUFö P…ICBAL9 Q>5…MYBUF  P…ICBAH9Q> P…ICBLL9(Q>2 P…ICBLH9< !„CIOVFX;PX;This routine relies on theZ!X;fact that all text is storedd!X;in ICODE in memory, else alln X;is lost.xX;‚‡SCRDRAWQ>Œ,– O>4…SCMEM PƒSCRª Q>5…SCMEM´O>¾ PƒSCRÈ Q…TOPLNÒ;Ü S…MEMSTæ P„TEMPð Q…TOPLNú S…MEMST L„TEMP E…ADROK Q…MEMST" P…TOPLN, Q…MEMST6 P…TOPLN@…ADROKQ…TOPLNJ P…TEXTPT Q…TOPLN^ P…TEXTPh$>r …PPAGE%>|…PLINEQ@…TEXTP7† P…LBUFF83šR>¤ H…RCRET® &„CURY¸ '„CURX QˆCHARUNDRÌ …RCRETM>Ö R>‡EOLCHARà F…BREAKê)>&ô H…PLINEþ1…SLOOPQ@…TEXTP7M>R>& H…NXCUR0 QˆCHARUNDR: …NXCURR>DF„SBRK;;IF = 0N1X H…SLOOPb%>%;;LINELEN-1l „SBRK3v…BREAK'„TEMP€%>Š„COPYQ…LBUFF8” P@ƒSCR7ž3¨ )„TEMP² H„COPY¼,ÆCÐ O…TEXTPÚ P…TEXTPä Q…TEXTPîO>ø P…TEXTPC PˆLENTABLE9 …CLRLN)>&  F‡CLEARED*Q>@;;SOME CHAR4 P@ƒSCR7>3H !…CLRLNR ‡CLEARED,\QƒSCRfO>(pPƒSCRz D†INCNOT„ #ƒSCRŽ †INCNOT2˜(>;;LINE COUNTER¢ F…PDONE¬ !…PPAGE¶…PDONEQ…TEXTPÀ P†BOTSCRÊ Q…TEXTPÔP†BOTSCRÞ:èX;òX;This routine will find theü X;length of the line just off!X;the top of the screen. Thus X;allowing the user to cursorX;off the top of the screen$X;.†CUROFFQ†CURMEM8 R…MEMSTB H…NPASTLQ†CURMEMV R…MEMST` H…NPASTj%>ÿt:;;finished.~ …NPASTQ>ˆ P…TEXTP’Q†CURMEMœ;¦S>° P…TEXTPº R…MEMSTÄEƒNP1Î Q…MEMSTØ P…TEXTPâ Q…MEMSTì P…TEXTPö ƒNP1%>„PLN1Q@…TEXTP7 3 R>‡EOLCHAR F„BRKL()>&2 H„PLN1<1F„SLP1Q@…TEXTP7P F…SPBRKZ1d H„SLP1n%>%x …SPBRK3‚ „BRKL,ŒC– O…TEXTP  P…TEXTPª Q…TEXTP´O>¾ P…TEXTPÈR†CURMEMÒDƒNP1Ü Q…TEXTPæ R†CURMEMðDƒNP1ú „ALLD: