FORMATTED FILES IN RAM - for the HP71 ------------------------------------- Required : FILEQLX for the keyword FILE? in line 30 of EDTXTRAM. STRINGLX for the keyword RPT$ in line 50 of EDRDPRAM. TEXT EDITOR ROM For the HP71 When using the HP71 Text Editor to format a text file, particularly when justification of both margins is required, it is difficult to tell what the overall length of the finished product will be. One way is to produce a FORMATTED file in RAM, assuming that there is sufficient RAM available. Mike Markov produced an excellent routine that would do just that. It requires the user to have the program EDRDPRAM (listed below) in RAM and to create a TEXT file called FMT in RAM prior to using the Text Editor routines. The result is a formatted file called FMT in RAM. This is fine, as far as it goes, but if you want to do several such operations in one go then manually creating, processing and renaming the files is tedious. I also tend to forget to delete EDRDPRAM when I want to go back to formatting directly on to paper. To solve the problem I wrote a utility called EDTXTRAM. It makes use of the keyword FILE?, either from the lexfile FILELEX or from FILEQLX to automatically read the program EDRDPRAM from Mass Memory. If the user runs the program and enters the name of a textfile containing the formatting control characters and keys ENDLINE the result will be a formatted textfile with the same name as the 'source' file save for the last letter which has been changed to a 'Z'. The source file remains, unaltered, in RAM and the utility then prompts the user for another source file. Keying ENDLINE without entering a filename will delete EDRDPRAM from RAM and automatically terminate the program. I hope you find the program useful. If you do not have FILELEX/FILEQLX/STRINGLX then send me a disc or a tape (sorry, no cards) and I will record it for you. Mark Cracknell, 6 Stratton Mews, Off South Street, Leighton Buzzard, Bedfordshire LU7 8NT, England. [0525-383265] 0010 ! EDTXTRAM 0020 ON ERROR GOTO 40 0030 IF FILE?("EDRDPRAM") THEN 50 ELSE COPY EDRDPRAM:MASSMEM @ GOTO 50 0040 OFF ERROR @ BEEP 1000 @ DISP "'EDRDPRAM' not available !" @ END 0050 OFF ERROR @ ON ERROR GOTO 60 @ PURGE FMT 0060 OFF ERROR @ CREATE TEXT FMT 0070 ON ERROR GOTO 90 0075 BEEP 200 @ INPUT "Filename ? ";S$ @ CAT S$ @ CALL EDFORM(S$,1,"") 0080 F$=S$[1,LEN(S$)-1]&"Z" @ RENAME FMT TO F$ @ CAT F$ @ GOTO 70 0090 OFF ERROR @ PURGE EDRDPRAM @ BEEP 800 @ PUT "#43" @ END 0010 ! EDRDPRAM - produces formatted text file in FMT 0020 ! Create an EMPTY text file FMT in :MAIN BEFORE use 0030 SUB EDITFPR1(A$,B$) @ IF NOT X9 THEN ASSIGN #255 TO FMT @ X9=1 0040 RESTORE #255,9999 @ PRINT #255;A$&B$ @ END SUB 0050 SUB EDITFPR2(L,R,N1) @ DIM X9$[80] @ X9$=RPT$(" ",(R+L-LEN(STR$(N1)))/2) 0060 CALL EDITFPR1(X9$,"-"&STR$(N1)&"-") 0070 END SUB 0080 SUB EDITFPR3(A$,L) @ IF LEN(A$)>3 THEN CALL EDITFPR1(A$[4],"") 0090 END SUB 0100 SUB EDITFRD(#1,I$,I1) 0105 I1=0 @ ON ERROR GOTO 120 @ READ #1;I$ @ IF I$="" THEN I$=" " 0110 GOTO 130 0120 I1=1 0130 END SUB