; Utilities for fed.ipl (Full-Screen Array Editor) 3/27/08 ; ; MALOAD MASAVE CALOAD and CALIST and its helpers for importing and saving ; alt mem array data from/to MS (PTR/SFS disk/etc) or via console copy/paste. ; As written these words indicate EOF by the string ~TERMINATE~ by itself ; on the last line for pure-stream compatibility with minimal impact to the ; file, the string is not added to the alt mem array data. ; ; ALOAD - loads IPL code from alt mem. Checks to see if valid array but ; doesn't check if a valid IPL file, should include final CONSOLE but seems ; to tolerate if omitted, says [junk] NOT FOUND. ; ; If SFS is present loads LDTXT, a wrapper for MALOAD to permit loading ; normal text files provided they don't exceed AEDIT's limit of 782 lines. ; ;========================================================================== OCTAL "Loading helpers and variables..." $PRINT CRLF ;78PAD - helper word, pads string to 78 chars ;ARLINES - variable, number of lines in alt mem array ;CKARRAY - helper word, checks to see if valid array, counts lines ;STTSP - helper word, strip trailing spaces ;STFLG - strip trailing flag, set to non-zero to strip trailing spaces ; (do STFLG 0 PUT to output spaces and all, faster) ;MALOAD - convert regular text attached to MS input (ptr) ;MASAVE - lists alt mem array text to MS output (ptp) ;CALOAD - convert regular pasted text to alt mem array format ;CALIST - lists alt mem array text to screen to capture ;These terminate by ~TERMINATE~ on the last line to end the load, ;can be typed manually when pasting via CALOAD. Added to MASAVE/CALIST ;output but not added to alt memory array data. Not absolutely needed ;when loading via MALOAD but at end will hang, halt cpu and run from 2 ;then run AEDIT to edit the file. ;ALOAD - loads (presumed) IPL file from alt mem ;---------------------------------------------------------- DEFINE 78PAD ;pad string to 78 characters $LEN 116 SUB IF<0 ;if less than 78 chars $LEN 115 +DO 40 $APPEND +LOOP ELSE 116 $LEN SUB IF<0 ;if more than 78 chars #1 $LEN 116 SUB +DO $TAIL DROP +LOOP ENDIF ENDIF END ;---------------------------------------------------------- VARIABLE ARLINES ;set by CKARRAY to the number of lines in array DEFINE CKARRAY ;check if array format, pushes 0 if array 3/27/08 ;if not an array prints message and pushes something else ;sets variable ARLINES to number of lines in altmem file 51 AMTW #1 A>CCOPY AMTW GET 6412 SUB DUP IFNZ ;if CRLF pos of 1st line of page 0 not a crlf "Not an array" $PRINT CRLF ELSE STMPAG ;make sure MPAG variable is set ARLINES MPAG GET 27 MUL PUT ;set ARLINES = MPAG * 23 #1 27 +DO ;loop through 23 lines on last page MPAG GET 1630 MUL INC INDEX 50 MUL ADD ;push address of line's crlf AMTW #1 A>CCOPY AMTW GET 6412 SUB IFZ ;if a crlf ARLINES DUP GET INC PUT ;increment line count ENDIF +LOOP ENDIF END ;---------------------------------------------------------- DEFINE STTSP ;remove trailing spaces (borrowed from $TRIM) DO $LEN DEC $GET 40 SUB IFZ $TAIL DROP #0 ELSE #1 ENDIF UNTIL END ;---------------------------------------------------------- VARIABLE STFLG ;set to non-zero to strip trailing spaces STFLG 1 PUT ;default strip ;---------------------------------------------------------- "Loading MALOAD..." $PRINT CRLF DEFINE MALOAD ;convert regular text attached to MS input (ptr) ;file must end with ~TERMINATE~ or when it hangs halt and run from 2 "Converting MS in to alt mem array..." $PRINT CRLF 350 DUP GET ;push MS vector address, data MS_SAVE ZAM 2 MSUSER PUT ;redirect just MS out #0 ;line count DO MS$IN "~TERMINATE~" $EQUAL IFNZ ;if terminate string $DROP #1 ;drop string, stop loading ELSE 78PAD MS$OUT MSCRLF INC ;line count, print a * every 23 lines... DUP DUP 27 DIV 27 MUL SUB IFZ "*" $PRINT ENDIF #0 ;keep going ENDIF UNTIL CRLF DROP MS_RESTORE STMPAG ;scan alt and set MPAG var CPAG #0 PUT ;reset CPAG (1/11/08) END ;---------------------------------------------------------- "Loading MASAVE..." $PRINT CRLF DEFINE MASAVE ;lists alt mem array text to MS output (ptp) ;if STFLG non-zero strips trailing spaces CKARRAY IFZ ;if array format "Saving alt mem array to MS out, " $PRINT STFLG GET IFZ "not " $PRINT ENDIF "removing spaces..." $PRINT CRLF 351 DUP GET ;push MS out addr and vector MS_SAVE 2 MSUSER PUT ;redirect just MS in from altmem #1 ARLINES GET +DO ;loop through all lines MS$IN STFLG GET IFNZ STTSP ENDIF MS$OUT MSCRLF INDEX DUP 27 DIV 27 MUL SUB IFZ "*" $PRINT ENDIF +LOOP "~TERMINATE~" MS$OUT MSCRLF MS_RESTORE CRLF ENDIF END ;---------------------------------------------------------- "Loading CALOAD..." $PRINT CRLF DEFINE CALOAD ;convert regular pasted text to alt mem array format "Begin pasting file, ~TERMINATE~ to stop." $PRINT CRLF MS_SAVE ZAM 2 MSUSER DO $IN "~TERMINATE~" $EQUAL IFNZ $DROP #1 ELSE 78PAD MS$OUT MSCRLF #0 ENDIF UNTIL MS_RESTORE STMPAG ;scan alt and set MPAG var CPAG #0 PUT ;reset CPAG (1/11/08) END ;---------------------------------------------------------- "Loading CALIST..." $PRINT CRLF DEFINE CALIST ;lists alt mem array text to screen to capture CKARRAY IFZ ;if array format CRLF MS_SAVE 2 MSUSER #1 ARLINES GET +DO ;loop through all lines MS$IN STFLG GET IFNZ STTSP ENDIF $PRINT CRLF +LOOP "~TERMINATE~" $PRINT CRLF CRLF MS_RESTORE ENDIF END ;---------------------------------------------------------- "Loading ALOAD..." $PRINT CRLF DEFINE ALOAD ;load AEDITed IPL from alt mem 3/27/08 CKARRAY IFZ ;if array format "Loading IPL file from alt mem..." $PRINT CRLF 2 MSUSER FILE ;REDIRECT MS OUT TO FILE FPA FSA GET PUT ;SET POINTER TO END OF FILE MSCRLF "~TERMINATE~" MS$OUT MSCRLF ;WRITE TERMINATOR #0