; L2ABS - Log To ABS for HP-IPL/OS 5/10/04 ; converts CONGEN terminal log in MS-input to ABS file on MS-output ; file must have at least 1 blank line after last CHECK to terminate ; normally it will when CONGEN run from console, unless removed from log. ; doesn't matter what's up front, starts converting from first BEGIN line. ; if no BEGIN then it hangs and waits for you to reboot with the correct ; file attached... not much error handling, this is a quick-hack. "Loading L2ABS" $PRINT CRLF ;-------------------------------------- OCTAL DEFINE L2ABS OCTAL ;not bothering with restoring, runs in octal mode ;find 1st begin and start address... MS$IN ;get string from MS input to prime DO ;while additional blocks to load #0 ;checksum for read #0 ;ABS checksum DO ;until start address > 0 #0 5 $SLICE ;push first 6 chars "BEGIN " $EQUAL $DROP ;CHECK FOR BEGIN and drop temp string IFZ ;if NOT equal $DROP MS$IN #0 ;get next line ELSE ;if BEGIN found 6 $LEN DEC $SLICE ;push string containing start address $VAL ;push startadr #1 ;found ENDIF UNTIL $DROP ;the BEGIN line ;file checksum, ABS checksum, startadr on stack ;get and push endadr.. MS$IN 4 $LEN DEC $SLICE $VAL $DROP "Processing " $PRINT OVER PNUM "to " $PRINT DUP PNUM CRLF MS$IN ;load 1st line to process #0 S>Z ;ABS record counter on Z DUP S>Y ;ABS endadr on Y +DO ;loop thru all values ;now just filecheck, ABS check on stack Z>S DUP S>Z ;get record counter IFZ ;if zero then start new ABS block DROP ;existing ABS checksum INDEX ;get current address for checksum Y>S DUP S>Y ;get end address OVER ;push current address ;stack = filecheck, checksum (addr), endadr, current addr SUB INC ;get #words left DUP 33 SUB ;see if incomplete IF<0 ;if incomplete leave #left on stack ELSE DROP 33 ;do 33 octal words ENDIF Z>S DROP DUP S>Z ;update record count on Z MSBOUT ;write record count #0 MSBOUT ;pad INDEX MSWOUT ;write start address ENDIF ; stack = filecheck, checksum ; get encoded data... string on stack $LEN IFZ ;if empty $DROP MS$IN ;get next string ENDIF ;decode 3 chars and push to stack... $HEAD 74 SUB $HEAD 74 SUB 100 MUL ADD $HEAD 74 SUB 10000 MUL ADD DUP MSWOUT ;write to ABS file DUP S>X ;save value temporarily ADD ;add value to ABS checksum SWAP X>S ADD SWAP ;add value to file checksum Z>S DEC DUP S>Z IFZ DUP MSWOUT ENDIF ;if last word write checksum ;keep user occupied INDEX 777 AND IFZ "." $PRINT ENDIF +LOOP ;do next address DROP ;ABS checksum $DROP ;input line (now empty) MS$IN ;load CHECK line 6 $LEN DEC $SLICE $VAL $DROP ;get value from file OVER OVER SUB IFNZ ;compare CRLF "Checksum error - expected " $PRINT PNUM "but calculated " $PRINT PNUM ;keep going anyway ELSE DROP DROP ;drop checksums ENDIF MS$IN ;get next line, either next BEGIN or empty line $TRIM $LEN ;terminate when empty line received CRLF WHILE ;stop when line is empty $DROP ;the empty next-line string PTZERO ;terminate the ABS file END ;-------------------------------------- "Done." $PRINT CONSOLE