%external %routine %spec SET DEFAULT (%string(127) def) %external %string(127) %function %spec EXPAND (%string(127) spec) %external %string(127) %function %spec CLI PARAM %external %string(127) %function %spec SYS MESS (%integer no) %external %string(127) %function %spec IN FILE NAME %begin %string(127) file = cliparam %integer check, record = 0 %integer n, s, a, l %record(eventfm) %name ev %routine GETCH (%integer %name s) read symbol (s) check = check + s %end %routine OCTAL (%integer n) %integer j %for j = 15, -3, 0 %cycle print symbol (n>>j & 7 + '0') %repeat %end %routine GET (%integer %name n) %integer s1, s2 getch (s1); getch (s2) n = s1 + s2<<8 %end %on 9 %start ev == event select output (0) %if ev_sub = 1 %start; ! EOF print string ("** Unexpected end of input after ") write (record, 0); print string (" records") %else %if ev_sub = 3 print string (file); print string (" -- ") print string (sys mess (ev_extra)) %else %signal 9, ev_sub, ev_extra %finish newline %stop %finish set default (".ABS") file = expand (file) open input (1, file) l = length(file); a = l l = l - 1 %until charno(file, l) = '.' length(file) = l open output (1, file . "DMP") length(file) = a select input (1) select output (1) newline print string ("Dump of PDP11 loader file ") print string (in file name); newline record = 0 %cycle read symbol (s) %until s = 1 %and nextsymbol = 0 read symbol (s) check = 1 record = record + 1 get (n); n = n - 6 %exit %if n <= 0; ! last record has 0-length get (a) newline print string (" Record"); write (record, 3) print string (" Size"); write (n, 3); print string (" bytes") print string (" Load address "); octal (a); newline l = 0 %cycle n = n - 2; %exit %if n < 0 %if l = 0 %start newline; spaces (2) octal (a) print string (": ") %finish get (s); space; octal (s) a = a + 2 l = (l + 1) & 7 %repeat read symbol (s) newline %if l # 0 %if (check+s) & 255 # 0 %start newline %if l = 0 print string("***checksum error***") newline %finish newline %repeat %end %of %program