%external %routine DUMP BLOCK (%name from, %integer bytes, line width, wants) %integer from addr = addr(from) !'WANTS' mask values: %const %integer hex = 1<<1, octal = 1<<2, ASCII = 1<<3, decoded = 1<<4, exclam = 1<<5, EBCDIC = 1<<6, formats = 3 %external %integer %fn %spec EtoI (%integer sym) %external %string(63) %fn %spec ITOS (%integer I,places) %external %routine %spec PHEX (%integer n,width) %integer %fn STOI (%string(15) s) %byte %name b %integer j, n = 0 %for j = 1,1,length(s) %cycle b == char no (s,j) %continue %if b <= ' ' %if '0' <= b <= '9' %start n = 10*n + (b-'0') %finish %else %result = -1 %repeat %result = n %end %const %integer non zero = 1 %const %integer infinity = 16_7FFFFFFF %const %integer FF = 12; !ASCII formfeed character %record(parm fm) P %integer offset; !word index in BLOCK %integer N words; !# of 32-bit words per dump line %integer firsttry; !!!!!! %integer rows; !# of dump lines per block %integer N fields; !# of (hex,oct,..) fields wanted %integer unit; !physical unit no. %integer decoding = 0 %integer j,k %routine report (%string(63) message) print string (message); newline %end %integer lines = 0 %routine break; !keeps track of lines for formfeeds newline; lines = lines + 1 %end %routine dump ASCII (%integer word, sp); !SP = padding per character %routine do (%integer word) %integer j,k %for j = 1,1,3 %cycle k = rem (word,37); word = word//37 %if k = 0 %then space %else %start %if k <= 26 %start print symbol (k + 'A' - 1) %else print symbol (k - 27 + '0') %finish %finish %repeat %end %integer j, k %if decoding = 0 %or wants&1<>(3*8)) & 255; word = word<<8 %if wants&EBCDIC {xlate} # 0 %then k = EtoI(k) %else k = k&127 %if k < ' ' %or k = 127 %then space %else print symbol (k) %repeat %else; !packed decode spaces (4*sp + 4 - 6) do (word>>16); do(word&X'FFFF') %finish %end %routine poct (%integer n) %integer j print symbol (n>>j & 7 + '0') %for j = 30, -3, 0 %end %routine print decoded (%integer n, offset) !dump the ASCII translation of the N words !starting at FROM under each of the formats %integer j,k,from from = from addr + offset decoding = non zero spaces (4); print symbol ('|') %for j = 1,1,formats %cycle %if wants & 1<>2) // N words rows = rows+1 %if rows*N words < bytes>>2 block ht = rows block ht = 2*rows %if wants & decoded # 0; !ASCII decode under each line block ht = 3 {header lines} + block ht break offset = 0 %for j = 1,1,rows %cycle write (4*offset,3) {byte offset}; print symbol ('|') %for k = 1,1,formats %cycle space %if 1<