04/05/26 15:39
(defun display-binaried-file (file)
(interactive "fFilename: ")
(with-output-to-temp-buffer "Binary"
(with-temp-buffer
(let ((addr 0)
s)
(insert-file-literally file)
(goto-char (point-min))
(while (re-search-forward "\\=\\(?:.\\|\n\\)\\{1,8\\}" nil t)
(princ (format "%08X:" addr))
(setq s (match-string 0)
addr (+ 8 addr))
(mapc (lambda (c)
(princ " ")
(dotimes (i 8)
(princ (if (zerop (logand 128 c)) "0" "1"))
(setq c (lsh c 1))))
s)
(princ (format "%s %s\n"
(make-string (* 9 (- 8 (length s))) ?\040)
(mapconcat (lambda (c)
(if (and (<= 32 c) (< c 127))
(char-to-string c)
"."))
s
nil))))))))