Improve the code dumping function
author |
Steve Losh <steve@stevelosh.com> |
date |
Thu, 31 Mar 2016 22:17:53 +0000 |
parents |
8a18f9b3bb72
|
children |
ea71bdab6baa
|
branches/tags |
(none) |
files |
src/wam/dump.lisp |
Changes
--- a/src/wam/dump.lisp Wed Mar 30 13:44:34 2016 +0000
+++ b/src/wam/dump.lisp Thu Mar 31 22:17:53 2016 +0000
@@ -52,15 +52,14 @@
(opcode-short-name (aref instruction 0))
(rest (coerce instruction 'list))))
-(defun dump-code (wam)
- (let ((code (wam-code wam)))
- (format t "CODE~%")
- (let ((addr 0))
- (while (< addr (length code))
- (format t "; ~4,'0X: " addr)
- (let ((instruction (wam-code-instruction wam addr)))
- (format t "~A~%" (instruction-aesthetic instruction))
- (incf addr (length instruction)))))))
+(defun dump-code (wam &optional (from 0) (to (length (wam-code wam))))
+ (format t "CODE~%")
+ (let ((addr from))
+ (while (< addr to)
+ (format t "; ~4,'0X: " addr)
+ (let ((instruction (wam-code-instruction wam addr)))
+ (format t "~A~%" (instruction-aesthetic instruction))
+ (incf addr (length instruction))))))
(defun dump-wam-registers (wam)