%external %routine %spec DEFINE (%string(63) def) %external %routine %spec CLEAR (%string(63) chan) %external %routine %spec CLOSESM (%integer chan no) %external %integer %function %spec EXIST (%string(31) file) %external %integer %function %spec SMADDR (%integer chan,%integername len) %external %routine NDUMP (%string(63) fname) %string(63) out %integer pos, ad, len, ch %const %byteinteger %array hexchar(0:15) = %c '0','1','2','3','4','5','6','7', '8','9','A','B','C','D','E','F' %routine PHEX (%integer n, p) %integer j %cycle j = p*4 - 4, -4, 0 print symbol (hexchar((n >> j) & x'f')) %repeat %end %if fname -> fname . ("/") . out %start define ("1," . out) select output (1) %finish %if exist(fname) = 0 %start printstring ("DUMP fails - file "); print string (fname) print string (" does not exist, or no access"); newline %return %finish define ("SM17,".fname) ad = smaddr (17,len) print string ("Header: "); newline %cycle pos = ad-32, 4, ad-4 phex (integer(pos), 8) space %repeat newline %cycle pos = ad, 4, (ad+len+3) & (\3) - 4 %if pos & 31 = 0 %start newline phex (pos-ad, 6); print string (": ") %finish phex (integer(pos), 8) space %repeat closesm(17) clear("17") %end %end %of %file