þþþJdX;-----------------------nX;xX;Text Editor Subroutines‚X;ŒX;By: Bryan Schappel–X; X;FILE: TXTSUBªX;´X;-----------------------¾X;ÈX;SAVE a fileÒX;Ü"X;This routine will SAVE a fileæ#X;to disk, if there is a file inð"X;memory at this time, if thereúX;is no file in memory, the$X;command is aborted. The routine#X;will over-write the disk file.#X;it will not ask to replace it."X;,„SAVEQ…FILE?6HƒDSV@:JƒDSV†PRINT …SAVEMT †COPFIL^ †CONASChQ>r P…IODIR| ‡OPENFIL;;open file†ƒSV1G…SVERR$>š Q…MEMST¤ P…ICBAL9® Q…MEMST¸ P…ICBAH9Â;Ì Q†MEMPNTÖ S…MEMSTà P…ICBLL9êQ†MEMPNTô S…MEMSTþ P…ICBLH9Q>  †PERFIO G…SVERR& †CLOSE10 "†PAUSE?: !†CONINTDX;N…SVERR†PRINT …SAVERXƒSCL †CLOSE1b †GETKEYl "†PAUSE?v !†CONINT€X;Š"X;This is the PRINT TO DISK, or” X;MANUAL routine. This justsž#X;asks for a disk filename, then¨!X;branches to the proper place²$X;in the print routine to produce¼X;the output.ÆX;ІMANUALQ…FILE?Ú H„DMANä:î„DMAN†PRINT …PRNTMø †COPFILQ>  P…IODIR ‡OPENFIL  G„PERR*IƒPV24X;>X;PRINT a fileHX;R$X;This routine will generate page\!X;formatted output to any linef#X;printer. The text is formattedp"X;for 80 columns by the routinez"X;LPLINE. The LINES location is„$X;used to keep track of where theŽ$X;page is being printed, if LINES˜#X;=0 then we are at TOP of form,¢ X;else some where else on the¬"X;page. The program will number¶!X;all pages (up to 255, if theÀ"X;page number exceeds 255, thenÊ!X;the page number is set to 0)Ô X;The message 'Page # xxx' isÞ"X;used at the top of each page.èX;ò…PRINTQ…FILE?üFƒPV0†PRINT …PTEXT …YESNOEƒPV0$ …OPENP.IƒPV28„PERR †CLOSE1B†PRINT …PRTERL "†PAUSE?V !†GETKEY`ƒPV0:j ƒPV2Q>t P‡PAGENUM~ Q…MEMSTˆ P…TEXTP’ Q…MEMSTœ P…TEXTP¦‡PRINTLP „LPCR° G„PERRº Q‡PAGENUMÄP‚LOÎ †CALCNMØ Q„NBUFâ,ìO> ö P…PAGEN Q„NBUF ,O>  P…PAGEN( Q„NBUF2,<O> F P…PAGEN P%>Z '…LINESd…PGNLPQ…PAGEN8n P…MYBUF8x R>ƒEOL‚ F†PGNLP0Œ3– H…PGNLP †PGNLP0 †LPRINT;;line #1ª G„PERR´ „LPCR;;line #2¾ G„PERRȆLPTEXT †LPLINEÒ G„PERRÜ Q…LPLENæR>ÿð F†LPDONEú Q…LINES H†LPTEXT F‡PRINTLP†LPDONEQ…LINES" F‡LPDONE1, „LPCR6 !†LPDONE@‡LPDONE1"†PAUSE?J !†CLOSE1TX;^X;LOAD a filehX;rX;Here we LOAD a file into| X;memory. If the LOAD is good†!X;we convert the file to ICODE X;by calling - CONINT. If theš#X;LOAD is bad we print the error¤X;message, and exit.®X;¸„LOAD†PRINT …LOADM †COPFILÌQ>Ö P…IODIRà ‡OPENFILê G…LOERRô ˆERASEMEMþ$> Q†MEMMAX P…ICBLL9Q†MEMMAX& P…ICBLH90Q>: †PERFIOD G…LOERRN „LOAG$>X Q…ICBLL9b;lS>v P…ICBLL9€ Q…ICBLH9ŠS>” P…ICBLH9ž Q…MEMST¨ O…ICBLL9² P†MEMPNT¼ P…TEXTPÆ Q…MEMSTÐ O…ICBLH9ÚP†MEMPNTä P…TEXTPî †CLOSE1ø #…FILE? "†PAUSE? %>Q> „LOALP@…TEXTP7*34 H„LOAL> †CONINTH !‡SCRDRAWRX;\…LOERR)>ˆ;;EOF?f F„LOAGp †CLOSE1z†PRINT …LOADR„ "†PAUSE?Ž !†GETKEY˜X;¢X;Jump to Beginning of Line¬X;¶ X;We jump to the start of theÀ#X;line by taking the Xpos of theÊ"X;cursor, subtract 1 (since theÔ"X;actual Xpos is kept as 1 lessÞ"X;than the number that is shownèX;on the cursor line), thenòX;subtract this number fromü X;CURMEM. X; …BLINE$„CURX 0$ &„TEMP. Q†CURMEM8 ;B S„TEMPL P†CURMEMV Q†CURMEM` S>j P†CURMEMt …BLOUT:~ X;ˆ X;Advance ONE word’ X;œ #X;Here we scan ahead for a SPACE¦ #X;or a RETURN to determine if we° !X;have found the end of a wordº X;then scan ahead for a non-Ä X;space character.Î X;Ø †UPWORD%>â …RLOOPQ@†CURMEM7ì F†UPWRD1ö R>‡EOLCHAR F†UPWRD1 3 H…RLOOP :( †UPWRD132 H…UPWRD< #†CURMEMF Q†CURMEMP R†MEMPNTZ D…UPWRDd H‡ENDTEXTn …UPWRDQ@†CURMEM7x F†UPWRD1‚ X;Œ X;This routine adds the Y-reg– X;to CURMEM, and then calls  !X;CHECKMEM to make sure we didª X;not leave the screen.´ X;¾ ‡ADDY2CP,È CÒ O†CURMEMÜ P†CURMEMæ Q†CURMEMð O>ú P†CURMEM „WRTN!ˆCHECKMEM ‡ENDTEXTQ†MEMPNT P†CURMEM" Q†MEMPNT, P†CURMEM6 !ˆCHECKMEM@ X;J X;Goto bottom of textT X;^ !X;This routine is a little bith "X;tricky. If the end of text isr X;on the screen, we just call| X;ENDTEXT, else we subtract† X;1K from the EOT pointer and #X;call CHECKMEM to scroll to theš X;end of text.¤ X;® †BOTTOMQ>¸ P…TOPLN Q†MEMPNTÌ ;Ö S>à R…MEMSTê E‡BOTSAFEô Q…MEMSTþ ‡BOTSAFEP…TOPLN ‡SCRDRAW !‡ENDTEXT X;& X;Goto end of line0 X;: #X;To goto the EOL we move to theD X;Begin of line, and then addN X;line length-1 to the CURMEMX X;pointer.b X;l …ENDLN …BLINEv $„CURY€ QˆLENTABLE9Š ?” 1ž !‡ADDY2CP¨ X;² X;Home Cursor¼ X;Æ "X;All we do here is move to ADRÐ X;of TOPLN to the CURMEMÚ X;pointer.ä X;î „HOMEQ…TOPLNø P†CURMEM Q…TOPLN P†CURMEM : X;* X;Flip Insert mode4 X;> X;All we do here is flip theH "X;INSMODE mode between 0 and 1.R !X;Then the DLI will change the\ !X;CURSOR line color to reflectf X;the mode change.p X;z …IMODEQ‡INSMODE„ N>Ž P‡INSMODE˜ :¢ X;¬ X;Reverse Characters¶ X;À !X;This command was one I heardÊ X;PAPERCLIP had so I had toÔ X;include it here. As you canÞ !X;see it is not hard to do. Ifè !X;you move to the EOT and do aò #X;swap, the character is flippedü X;with a blank space.X;‡REVERSE%> Q@†CURMEM7$5.38 Q@†CURMEM7B1L P@†CURMEM7V3`7j P@†CURMEM7t:~X;ˆX;Erase all of Memory’X;œ!X;This is called only to ERASE¦!X;the entire TEXTPT buffer. It°X;also resets some of myº#X;pointers. It fills memory withÄ X;zeroes.ÎX;؈ERASEMEMQ…MEMSTâ P…TEXTPì P…TOPLNö P†CURMEM P†MEMPNT  Q…MEMST P…TEXTP P…TOPLN(P†CURMEM2P†MEMPNT<;F Q>5†TXTENDP S…MEMSTZP†MEMMAXd>nQ>x P†MEMMAX‚‡ERMEMLP%>ÿŒ "…TEXTP– P@…TEXTP7 3ª #…TEXTP´†ERMLP2P@…TEXTP7¾3È H†ERMLP2Ò #…TEXTPÜ0æ H†ERMLP2ð P@…TEXTP7ú:X;X;Insert One SpaceX;""X;This sets the INSLEN location,X;to 1 and calls the block6!X;insert routine. Then it puts@X;a space under the cursor.JX;T‡INSCHARQ>^ P†INSLENhQ>rP†INSLEN| ˆINSBLOCK†Q>?š P@†CURMEM7¤ !ˆCHECKMEM®X;¸ X;These are the block insertsÂX;ÌX;This is the 255 char blockÖ"X;insert routine. It works muchà"X;the the 1 char insert routineê X;it only sets INSLEN to 255.ôX;þ†ADD255Q>ÿ P†INSLEN H„TAB2X;&"X;This routine inserts 5 spaces0X;into the text.:X;D†ADDTABQ>N P†INSLENX „TAB2b Q@†CURMEM7l H†NOINCYv3€†NOINCY!‡ADDY2CPŠ „TAB2Q>”P†INSLENž ˆINSBLOCK¨Q>²?¼ $†INSLENƆFILLSPP@†CURMEM7Ð3Ú0ä H†FILLSPî:øX;X;Insert a block of text X;#X;This is the actual INSERT code !X;it sets up the pointers DEST*X;and FROM, then moves the4"X;memory. There are checks made>#X;to make certain that you don'tHX;go past the EOT memory.RX;\ ˆINSBLOCK,f Q†MEMPNTp O†INSLENzQ†MEMPNT„O†INSLENŽ R>5†TXTEND˜ D…OKINS¢7¬7¶:À …OKINS,Ê Q†CURMEMÔ P„FROMÞ O†INSLENè P„DESTòQ†CURMEMü P„FROMO†INSLEN P„DEST;$ Q†MEMPNT. S„FROM8 P‡MOVELENBQ†MEMPNTL S„FROMVP‡MOVELEN` …DMOVEj,t Q†MEMPNT~ O†INSLENˆ P†MEMPNT’Q†MEMPNTœO†INSLEN¦P†MEMPNT°:ºX;ÄX;Move Memory RoutinesÎX;Ø"X;The next two routines are theâX;memory move routines.ì"X;They self-modify for a littleöX;extra speed.X; …DMOVEQ‡MOVELEN> L‡MOVELEN( H‡NOTNULL2:< ‡NOTNULL,FAP O„FROMZ P…DMVLPd Q„FROMn P…DMVLPx,‚AŒ O„DEST– P…DMVLP  Q„DESTª P…DMVLP´2¾ %‡MOVELENÈ H…DMVLPÒ F‡SKIPDMVÜ „DMV1%>ÿæ…DMVLPQÿÿ8ðPÿÿ8ú1)>ÿ H…DMVLP‡SKIPDMV"…DMVLP" "…DMVLP,06 H„DMV1@:JX;TX;Move memory up^X;h…UMOVEQ„FROMr P…UMVLP| Q„FROM† P…UMVLP Q„DESTš P…UMVLP¤ Q„DEST® P…UMVLP¸$‡MOVELEN F‡SKIPUMVÌ „UMV1Q>Ö„UMV2P†ENDPOSà%>ê…UMVLPQÿÿ8ôPÿÿ8þ3 )†ENDPOS H…UMVLP #…UMVLP& #…UMVLP0(>: F†UMVOUTD0N H„UMV1X‡SKIPUMVQ‡MOVELENb H„UMV2l †UMVOUT:vX;€X;Move cursor RightŠX;” X;This simply adds one to thež!X;CURMEM pointer and calls the¨"X;CHECKMEM routine to make sure²"X;we did not leave text memory.¼X;ƇGORIGHT…BUMP †CURMEMÐ !ˆCHECKMEMÚX;äX;Move Cursor LeftîX;ø!X;This just subtracts one from"X;CURMEM and calls CHECKMEM. If $X;you go left from the HOME posit"X;the screen will only move one "X;character up in the document.*X;This can cause some minor4#X;cosmetic problems for the word>X;wrap later on.HX;R†GOLEFTQ†CURMEM\ H…NODECf"†CURMEMp…NODEC"†CURMEMz !ˆCHECKMEM„X;ŽX;CONTROL-DEL a char˜X;¢#X;This moves the cursor forward,¬"X;then saves its position, then¶"X;moves it back again and callsÀ#X;the DELETE2 code to delete theÊ X;text.ÔX;Þ‡CTRLDEL ‡GORIGHTè ‡DELETE1ò †GOLEFTü ‡DELETE2:X;X;Delete a char (BACK S)$X;."X;This save the CURMEM position8 X;then moves left and deletesBX;the text.LX;V†CHRDEL ‡DELETE1` †GOLEFTj !‡DELETE2tX;~X;Actual delete codeˆX;’#X;Here are the work-horse deleteœ X;routines, that perform most¦"X;of the text delete functions.°X;º ‡DELETE1;Ä Q†CURMEMÎ S…MEMSTØ P„TEMPâQ†CURMEMì S…MEMSTö L„TEMPH‰DELETE1.1 77:(‰DELETE1.1Q†CURMEM2 P„FROM<Q†CURMEMF P„FROMP:Z ‡DELETE2;d Q†CURMEMn P„DESTxN>ÿ‚ O„FROMŒ P†GOBLEN–Q†CURMEM  P„DESTªN>ÿ´ O„FROM¾P†GOBLENÈ †DELMEM;Ò Q†MEMPNTÜ S„DESTæ P‡MOVELENðQ†MEMPNTú S„DESTP‡MOVELEN…BUMP ‡MOVELEN …UMOVE" Q†MEMPNT,;6 S†GOBLEN@ P†MEMPNTJQ†MEMPNTTS†GOBLEN^P†MEMPNTh:rX;|X;These are the routines†X;that convert the text into"X;the internal form the programš X;uses.¤X;®†CONASCQ>¸ P‡CONFLAG F…DOCON̆CONINTQ>€Ö P‡CONFLAGà…DOCONQ…MEMSTê P…TEXTPô Q…MEMSTþ P…TEXTP;Q†MEMPNT S…TEXTP&>02:%>D†CVLOOPQ@…TEXTP7N5X Q‡CONFLAGb F†COTHERl7v R>ƒEOL€ H†NOTRTNŠ Q>‡EOLCHAR”H‰OVEROTHERž†NOTRTNR>¨ H†GOASCQ²Q>}¼H‰OVEROTHERƆGOASCQ †ASC2ICÐ!‰OVEROTHERÚ †COTHER7ä R>‡EOLCHARî H…NOTRCø Q>ƒEOLH‰OVEROTHER  …NOTRCR>} H†GOASCX Q>*H‰OVEROTHER4†GOASCX †IC2ASC>‰OVEROTHERP@…TEXTP7H3R H†CVLOOP\ #…TEXTPf0p H†CVLOOPz:„X;ŽX;Show false spaces˜X;¢!X;This simply flips the middle¬"X;bit of the middle byte on one¶!X;of the characters in my set.À!X;This produces a small dot onÊ!X;the screen where a word-wrapÔ X;occured.ÞX;è…PARSEQ…MYSETòN>üP…MYSET:X;X;Move Down One Screen$X;."X;This will HOME the cursor and8!X;then move the screen down 19BX;lines by simply adding theL"X;length of the line, stored inV X;the table - LENTABLE. If we`!X;try to go past the EOT, thenj X;we call the BOTTOM routine.tX;~„DNSC „HOMEˆ%>’†DNLOOPQ…TOPLNœ,¦OˆLENTABLE8° P…TOPLNº P†CURMEMÄ Q…TOPLNÎO>Ø P…TOPLNâP†CURMEMì3ö)> H†DNLOOP Q†MEMPNTR†CURMEM D„DNBT( F„DNCL2 E…DNSCO<„DNCLQ†MEMPNTF R†CURMEMP D…DNSCOZ„DNBT!†BOTTOMd…DNSCO ‡SCRDRAWn !ˆCHECKMEMxX;‚X;Move Cursor Down a lineŒX;–!X;This simply moves the cursor #X;to the start of the line, thenª#X;adds the length of the line to´ X;CURMEM. If the cursor is on¾!X;the last line, we must firstÈ"X;scroll the screen (to get theÒ"X;length of the next text line)ÜX;and add this new length.æX;ð„DNLN …BLINEú $„CURY Q†CURMEM,OˆLENTABLE9" P†CURMEM,Q†CURMEM6O>@P†CURMEMJ(>T H…DOVER^Ah5r Q„CURX|5† Q…TOPLN,š OˆLENTABLE¤ P…TOPLN® Q…TOPLN¸O> P…TOPLNÌ ‡SCRDRAWÖ7à P„CURXê7ô P„CURYþ$> …DOVERQˆLENTABLE9 R„CURX D†ADDONY& Q„CURX0 †ADDONY?: 1D !‡ADDY2CPN X;X X;Move cursor Up a lineb X;l X;This was the most difficultv !X;routine to write for T:EDIT.€ !X;If the cursor is on any lineŠ X;but one, we simply goto the” X;start of the line, subtractž "X;the length of the line before¨ X;it and then check to see if² "X;the cursor Xpos is on the new¼ X;line. If not we move to theÆ X;end of the new line. If theÐ #X;cursor was on the TOP line, weÚ X;run into the problem - Howä "X;long is the line just off theî #X;top of the screen? - To figureø X;this out I wrote a routine!#X;much like the BOTTOM routine + !"X;the SCRDRAW routine. It steps!#X;back 1K and 'draws the screen' !#X;until we find the cursor. When*!#X;we are done with this, we know4! X;the length of the line just>!X;off the screen. Yeah! ThisH!X;little gem of an idea tookR!"X;weeks to form and a matter of\!!X;hours to get to work. Enjoy.f!X;p!„UPLN …BLINEz! $„CURY„!(>Ž! F†SCRLUP˜!0¢!0¬! Q†CURMEM¶!;À!SˆLENTABLE9Ê! P†CURMEMÔ!Q†CURMEMÞ!S>è!P†CURMEMò! !…DOVERü!†SCRLUP †MOVEUP" $†CURMEM" &…TOPLN"$†CURMEM$" &…TOPLN." R„CURX8" D†SCRLUYB" Q„CURXL" †SCRLUY?V"1`" !‡ADDY2CPj"X;t"X;Move CURMEM up one line~"X;ˆ"#X;This routine HOME's the cursor’" X;then calls CUROFF, to calc.œ"#X;the length of the unseen line,¦""X;If Y-reg = $FF, we are at the°"X;top of text and abort.º"X;Ä"†MOVEUP „HOMEÎ" †CUROFFØ" '„TEMPâ")>ÿì"HƒMVUö":#ƒMVUQ†CURMEM #;# S„TEMP# P†CURMEM(#Q†CURMEM2#S><#P†CURMEMF#CP#:Z#X;d#"X;Move the cursor up one screenn#X;x# X;This simply calls MOVEUP 19‚# X;times, and when we are doneŒ#!X;we call CHECKMEM to move the–#X;screen up. #X;ª# „UPSCQ>´# P…LINES¾#…UPSCL †MOVEUPÈ# Q†CURMEMÒ# P…TOPLNÜ#Q†CURMEMæ# P…TOPLNð# #…LINESú# Q…LINES$R>$ H…UPSCL$ !ˆCHECKMEM"$X;,$X;Delete to end of line6$X;@$#X;This saves the CURMEM positionJ$"X;moves to the EOL then deletesT$X;the text, very simple.^$X;h$†DEL2CR …ERAS1r$ …ENDLN|$ Q†SAVCUR†$;$ S†MEMPNTš$ P„TEMP¤$Q†SAVCUR®$S†MEMPNT¸$ L„TEMPÂ$ EˆDEL2CRLVÌ$ Q†CURMEMÖ$;à$ S†MEMPNTê$ P„TEMPô$Q†CURMEMþ$S†MEMPNT% L„TEMP% F…ERAS3% H…ERAS2&%X;0%#X;The following routines are the:%$X;ones used to delete to the EOL.D%X;N%…ERAS1Q†CURMEMX% P„DESTb% P†SAVCURl%Q†CURMEMv% P„DEST€%P†SAVCURŠ%:”%X;ž%…ERAS2…BUMP †CURMEM¨% …ERAS3;²% Q†CURMEM¼% P„FROMÆ% S†SAVCURÐ% P†GOBLENÚ%Q†CURMEMä% P„FROMî%S†SAVCURø%P†GOBLEN& †DELMEM &ˆDEL2CRLVQ†SAVCUR& P†CURMEM &Q†SAVCUR*&P†CURMEM4& !ˆCHECKMEM>&X;H&"X;Delete all spaces from CURMEMR&!X;to next non-space character.\&X;f&!X;This simply moves the CURMEMp&X;to the next non-space charz&"X;and deletes all chars between„&"X;the original position and theŽ&X;new position.˜&X;¢&†KSPACEQ†CURMEM¬& P…TEXTP¶& P„DESTÀ&Q†CURMEMÊ& P…TEXTPÔ& P„DESTÞ&%>è&†SPCFNDQ@…TEXTP7ò& H†OUTSPCü&3' H†SPCFND' Q…TEXTP'R†MEMPNT$' D…GOINC.' Q†MEMPNT8' P…TEXTPB'Q†MEMPNTL' P…TEXTPV'%>`' F†OUTSPCj'…GOINC#…TEXTPt' H†SPCFND~' †OUTSPC,ˆ'C’' O…TEXTPœ' P„FROM¦'Q>°' O…TEXTPº' P„FROMÄ';Î' Q†MEMPNTØ' S„DESTâ' P‡MOVELENì'Q†MEMPNTö' S„DEST(P‡MOVELEN (;( Q„FROM( S„DEST(( P†GOBLEN2( Q„FROM<( S„DESTF(P†GOBLENP(…BUMP ‡MOVELENZ( …UMOVEd(;n( Q†MEMPNTx( S†GOBLEN‚( P†MEMPNTŒ(Q†MEMPNT–(S†GOBLEN (P†MEMPNTª(:´(X;¾(X;Find a string in memoryÈ(X;Ò("X;These are the GLOBAL Search &Ü(X;REPLACE routines. If theæ(X;Search string is equal inð(!X;length to the Replace stringú(!X;the S&R goes very fast, else)"X;you might wait a little while)X;)„FIND†PRINT …FINDM") …INPUT,) D†FINDOK6):@)†FINDOKQ„CENDJ) P„SLENT)%>,^)…FNDMBQ…MYBUF8h) P„SBUF8r)1|) I…FNDMB†)…GLOBL …CSRCH)R>ÿš) F„NFND¤)†PRINT …REPLM®) ƒYN2¸) E„NFNDÂ)†GETREP†PRINT …REPLWÌ) …INPUTÖ) D†GLBREPà) „NFND:ê)†GLBREP …CSRCHô) Q„FPOSþ)R>ÿ* F„NFND* „REPL* ˆCHECKMEM&* !†GLBREP0*…CSRCHQ†CURMEM:* P…TEXTPD*Q†CURMEMN* P…TEXTPX*%>b* …SRCH0$>l*…SRCH1Q„SBUF9v* †ASC2IC€* R@…TEXTP7Š*F‚CY”*(>ž* H…SRCH0¨*0²*‚CY3¼* H…NOVFLÆ* #…TEXTPÐ* Q…TEXTPÚ*R†MEMPNTä* F…NOVFLî* EˆNOTFOUNDø* …NOVFL2+ („SLEN + H…SRCH1+, +C*+ O…TEXTP4+ P„TEMP>+ Q…TEXTPH+O>R+ P„TEMP\+ Q†MEMPNTf+ R„TEMPp+Q†MEMPNTz+ S„TEMP„+ DˆNOTFOUNDŽ+;˜+ Q„TEMP¢+ S„SLEN¬+ P†CURMEM¶+ P„FPOSÀ+ Q„TEMPÊ+S>Ô+P†CURMEMÞ+ P„FPOSè+ ˆCHECKMEMò+%>ü+ Q@†CURMEM7,N>€, P@†CURMEM7, ‡SCRDRAW$,%>., Q@†CURMEM78,N>€B, P@†CURMEM7L,CV,:`,ˆNOTFOUNDQ>ÿj, P„FPOSt,:~,X;ˆ, X;This is the replace routine’,X;œ, „REPL;¦, Q†CURMEM°, P„DESTº, S„FPOSÄ, P„TEMPÎ,Q†CURMEMØ, P„DESTâ, S„FPOSì, L„TEMPö, H†NOREPL-Q>ÿ - P„FPOS-,- Q„SLEN(- O†CURMEM2- P„FROM<-Q>F-O†CURMEMP- P„FROMZ-;d- Q†MEMPNTn- S„DESTx- P‡MOVELEN‚-Q†MEMPNTŒ- S„DEST–-P‡MOVELEN -…BUMP ‡MOVELENª- Q„SLEN´- R„CEND¾- F†DOREPCÈ- …UMOVEÒ-;Ü- Q†MEMPNTæ- S„SLENð- P†MEMPNTú-Q†MEMPNT.S>.P†MEMPNT. Q„CEND". P†INSLEN,.Q>6.P†INSLEN@. ˆINSBLOCKJ.†DOREPC%>T.‡REPLOOPQ…MYBUF8^. †ASC2ICh. P@†CURMEM7r.3|. )„CEND†. H‡REPLOOP.,š. Q†CURMEM¤. O„CEND®. P†CURMEM¸.Q†CURMEMÂ.O>Ì.P†CURMEMÖ.†NOREPL!ˆCHECKMEMà.X;ê.!X;Convert char under cursor toô. X;UPPER if LOWER and LOWER ifþ. X;UPPER./X;/‡CONVERT%>/ Q@†CURMEM7&/M>?0/R>!:/ D†NOTALPD/R>;N/ E†NOTALPX/ Q@†CURMEM7b/N>@l/ P@†CURMEM7v/†NOTALP!‡GORIGHT€/X;Š/!X;This routine forms a line of”/"X;text for the printer routine.ž/"X;If the end of text is reached¨/X;it returns a $FF in LPLEN.²/X;else, it returns the CIO¼/X;error code.Æ/X;Ð/†LPLINE †ERMYBFÚ/%>ä/†PLOOP1Q@…TEXTP7î/ R>‡EOLCHARø/FŠFOUNDSPACE0†NOTRETP…MYBUF8;;LMARG=5 030)>F;;70 chars? 0 D†PLOOP1*0 '…LPLEN40‰FINDSPACEQ@…TEXTP7>0FŠFOUNDSPACEH01R0H‰FINDSPACE\0 %…LPLENf0 †FSPACE3p0 Q@…TEXTP7z0FŠFOUNDSPACE„01Ž0ŠFOUNDSPACE'…LPLEN˜0 ˆOVERSTORC¢0;¬0 O…TEXTP¶0 P…TEXTPÀ0 Q…TEXTPÊ0O>Ô0 P…TEXTPÞ0%>è0‡MAKEASCQ…MYBUF8ò0 †IC2ASCü051M>1R> 1 E‡CHR2BUF$1,.1O>À81>B17L1AV1R>À`1 HˆCHR2BUF1j1 Q>ƒEOLt1 ˆCHR2BUF15~1 ‡CHR2BUF7ˆ1P…MYBUF8’13œ1 )…LPLEN¦1 H‡MAKEASC°1 Q>ƒEOLº1P…MYBUF8Ä1 †LPRINTÎ1 GˆLEAVELPLØ1;â1 Q…TEXTPì1 S†MEMPNTö1 P„TEMP2 Q…TEXTP 2S†MEMPNT2 L„TEMP2 D‡LEAVELP(2Q>ÿ22 P…LPLEN<2‡LEAVELPQ>F2 ˆLEAVELPL:P2X;Z2X;This routine counts thed2 X;number of words in the textn2X;in memory. This is a truex2!X;count, not faked by counting‚2 X;spaces and dividing by two.Œ2X;The count begins from the–2X;top of memory. 2X;ª2‡CNTWORDQ…MEMST´2 P…TEXTP¾2 Q…MEMSTÈ2 P…TEXTPÒ2Q>Ü2PƒLO1æ2PƒHI1ð2†PRINT ‡WORDTXTú2†CNTWLP ‡GETWORD3 D…CNTOK3%>3…CNTDNQ…DIRPS8"3 R>ƒEOL,3 F†CNTKEY63 †ASC2IC@3 PƒLN18J33T3 H…CNTDN^3†CNTKEY!†GETKEYh3…CNTOK…BUMP ƒLO1r3 †CONBCD|3%>†3†CNTCPYQ„ABUF83 PƒLN18š31¤3 I†CNTCPY®3 G†CNTWLP¸3X;Â3!X;This routine finds a word inÌ3"X;memory, it skips spaces untilÖ3X;it hits a non-space, thenà3X;looks for another space.ê3!X;Then we check if we are pastô3X;the end of the text.þ3X;4‡GETWORD%>4…GETW1Q@…TEXTP74M>&4 F†GETUPL04 R>‡EOLCHAR:4 H‡GOTWORDD4 †GETUPL3N4 H…GETW1X4 #…TEXTPb4 †WRDRTSl4 D…GETW1v4:€4‡GOTWORD ‡ENDWORDŠ4%>”4‡GETWSPCQ@…TEXTP7ž4M>¨4 F‡ENDWORD²4 R>‡EOLCHAR¼4 F‡ENDWORDÆ43Ð4 H‡GETWSPCÚ4 #…TEXTPä4 H‡GETWSPCî4 ‡ENDWORDCø4,5 O…TEXTP 5 P…TEXTP5 D†WRDRTS 5 #…TEXTP*5†WRDRTSQ…TEXTP45;>5 S†MEMPNTH5 P„TEMPR5 Q…TEXTP\5S†MEMPNTf5 L„TEMPp5 D‡WRDRTS2z5 F†WRDSET„5 ‡WRDRTS2:Ž5 †WRDSET,˜5: