;;;
;;; test.lisp
;;;
;;; Scratch file for testing ESB-ASSEM.
;;;

(cl:defpackage :esb-test
  (:use :common-lisp :esb-assem))
(cl:in-package :esb-test)

(define-instruction pusha (segment)
  (:emitter
   (emit-byte segment #b01100000)))

(defun test-1 ()
  (let ((segment (make-segment)))
    (assemble (segment)
      (inst pusha))
    (finalize-segment segment)
    (let ((buffer (let ((bits nil))
		    (esb-assem::on-segment-contents-vectorly
		     segment
		     (lambda (bit) (push bit bits)))
		    (apply #'concatenate '(vector (unsigned-byte 8)) (reverse bits)))))
      buffer)))

#|
CL-USER> (esb-test::test-1)
#(96)
CL-USER> #x60
96
CL-USER>
|#

;;; EOF
