(herald (assembler as_file) (env t (assembler as) (assembler as_open) (assembler listing))) (define (assemble-file inspec outspec listspec machine) (with-open-ports ((in (open inspec '(in))) (out (open outspec '(out))) (lst (open listspec '(out)))) (let ((items (read in))) (let ((section (new-assemble (test-lap items machine)))) (write out `(,(vector `(verbatim ',(bits-bv (assembly-section-bits section)))) ,@(map (lambda (key) `((,key) (offset-in (circular 0) ,(- (quotient (label-offset section key) 8) 10)))) ;; divide by 8 to convert from bits to bytes ;; subtract adjust from tagged pointer to ;; address of object header [which is what offset-in ;; wants] (assembly-section-globals section)))) (listing-to-port lst section) section))))