Add a USC test program
This commit is contained in:
parent
3878b57848
commit
bc3e07356e
1 changed files with 22 additions and 0 deletions
22
wip-duuqnd/user-side-compiler/test-programs.lisp
Normal file
22
wip-duuqnd/user-side-compiler/test-programs.lisp
Normal file
|
@ -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))))
|
Loading…
Add table
Reference in a new issue