; CONGEN - sysgen to console - 5/10/04 ; Support word CONOUT - encodes block of memory to console ; Usage.. startadr endadr CONOUT ; Format.. ; BEGIN octal_startadr ; END octal_endadr ; encoded text ; CHECK octal_checksum ; [eof or next BEGIN] ; Encoded format is the same as used by the MKLDR utility for encoding ; binary code into IPL text (as used by the octapus IPLs), each word ; is encoded to 3 characters, 60 characters per line for neatness. OCTAL "Loading CONOUT" $PRINT CRLF DEFINE CONOUT RADIX SWAP ROT ; push current radix below startadr, endadr OCTAL ; all our numeric output in octal SWAP ; tos = startadr, endadr below that #0 SWAP ROT ;checksum below endadr (radix below checksum) ;stack = radix, checksum, endadr, startadr <--top "BEGIN " $PRINT DUP PNUM CRLF ;print BEGIN line "END " $PRINT OVER PNUM CRLF ;print END line ;encode until address = endadr... ;pointer on stack, endadr over that DO OVER OVER SUB INC ;calculate remaining size DUP CASE > 24 DROP 24 ENDCASE ;max 20 words if not at end #1 SWAP +DO ;loop the indicated number of words ;now pointer back at top of stack ;add word to checksum... DUP GET DUP S>Y ;save word on Y stack S>Z ROT SWAP Z>S ADD SWAP ROT ;output word as three characters... Y>S ;restore very same word to avoid checksum error DUP 77 AND 74 ADD PCHR ;encode ASR ASR ASR ASR ASR ASR DUP 77 AND 74 ADD PCHR ASR ASR ASR ASR ASR ASR 17 AND 74 ADD PCHR INC ;inc mem pointer +LOOP ;until string is 60 chars long (or remaining) CRLF ;output end of line ;pointer on stack, endadr over that.. exit if pointer > endadr OVER OVER SUB IF<0 #1 ELSE #0 ENDIF UNTIL ;done DROP DROP ; drop pointer and endadr "CHECK " $PRINT PNUM CRLF ;output checksum CASE ;restore radix... = 2 BINARY = 12 DECIMAL DEFAULT OCTAL ENDCASE END ; "Loading CONGEN" $PRINT CRLF DEFINE CONGEN "----- Start CONGEN output -------" $PRINT CRLF 2 EOD CONOUT ;save HP-IPL/OS and dictionary 70000 75777 CONOUT ;save high memory CRLF ;output blank line to terminate when reloading via papertape "----- End of CONGEN output ------" $PRINT END ; "Done." $PRINT CONSOLE