From bc3e07356ebf4d76765994efbc7126e0b5ae3e79 Mon Sep 17 00:00:00 2001 From: John Lorentzson Date: Fri, 16 May 2025 10:38:41 +0200 Subject: [PATCH] Add a USC test program --- .../user-side-compiler/test-programs.lisp | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 wip-duuqnd/user-side-compiler/test-programs.lisp diff --git a/wip-duuqnd/user-side-compiler/test-programs.lisp b/wip-duuqnd/user-side-compiler/test-programs.lisp new file mode 100644 index 0000000..9342f54 --- /dev/null +++ b/wip-duuqnd/user-side-compiler/test-programs.lisp @@ -0,0 +1,22 @@ +(in-package #:user-side-compiler) + +(defun test-sweep () + (let* ((line-routine (make-label :name "line" :address 0)) + (var+=-routine (make-label :name "var+=" :address 0)) + (var-=-routine (make-label :name "var-=" :address 0)) + (calls (list (make-call line-routine '((t 0) (t 120) (nil 0) (nil 1))) + (make-call line-routine '((t 255) (t 120) (nil 2) (nil 3))) + (make-call var+=-routine '((nil 0) (t 1))) + (make-call var+=-routine '((nil 1) (t 1))) + (make-call var-=-routine '((nil 2) (t 1))) + (make-call var-=-routine '((nil 3) (t 1)))))) + (loop :with prev := nil + :for call :in calls + :unless (null prev) + :do (setf (next prev) call) + :do (setf prev call)) + (let ((insts + (compile-starting-at + (make-instance 'node-dotimes :loopee-node (first calls) :stop-ref (make-instance 'reference-constant :value 240))))) + (fix-label-addresses-in-instruction-list insts #xc000) + (bytesquash-instruction-list insts #xc000))))