Begin debugger
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#:use-module (rnrs io ports)
|
||||
#:use-module ((scheme base)
|
||||
#:select (write-u8 write-bytevector))
|
||||
#:export (assemble))
|
||||
#:export (assemble assemble-file))
|
||||
|
||||
(define (lookup-instruction inst)
|
||||
(define inst-obj (assq inst *instruction-set*))
|
||||
@@ -55,3 +55,12 @@
|
||||
(write-word (cadr inst))
|
||||
(write-word (assq-ref labels (cadr inst)))))
|
||||
(loop (cdr seq)))])))))
|
||||
|
||||
(define (assemble-file file out)
|
||||
(call-with-input-file file
|
||||
(lambda (in)
|
||||
(define (read-all next)
|
||||
(if (eof-object? next)
|
||||
'()
|
||||
(cons next (read-all (read in)))))
|
||||
(assemble (read-all (read in)) out))))
|
||||
|
||||
Reference in New Issue
Block a user