|
|
|
@ -42,41 +42,41 @@
|
|
|
|
|
(define-macro (tgl X)
|
|
|
|
|
#'(λ(regs)
|
|
|
|
|
((if (toggled?)
|
|
|
|
|
(make-inc-base X)
|
|
|
|
|
(make-tgl-base X)) regs)))
|
|
|
|
|
(make-inc-base 'X)
|
|
|
|
|
(make-tgl-base 'X)) regs)))
|
|
|
|
|
|
|
|
|
|
(define-macro (make-cpy-base X Y)
|
|
|
|
|
#'(λ(regs)
|
|
|
|
|
(define val (if (number? 'X) 'X (hash-ref regs 'X)))
|
|
|
|
|
(hash-set! regs 'Y val)))
|
|
|
|
|
(define val (if (number? X) X (hash-ref regs X)))
|
|
|
|
|
(hash-set! regs Y val)))
|
|
|
|
|
|
|
|
|
|
(define-macro (cpy X Y)
|
|
|
|
|
#'(λ(regs)
|
|
|
|
|
((if (toggled?)
|
|
|
|
|
(make-jnz-base X Y)
|
|
|
|
|
(make-cpy-base X Y)) regs)))
|
|
|
|
|
(make-jnz-base 'X 'Y)
|
|
|
|
|
(make-cpy-base 'X 'Y)) regs)))
|
|
|
|
|
|
|
|
|
|
(define-macro (make-dec-base X) #'(λ(regs) (hash-update! regs 'X sub1)))
|
|
|
|
|
(define-macro (make-inc-base X) #'(λ(regs) (hash-update! regs 'X add1)))
|
|
|
|
|
(define-macro (make-dec-base X) #'(λ(regs) (hash-update! regs X sub1)))
|
|
|
|
|
(define-macro (make-inc-base X) #'(λ(regs) (hash-update! regs X add1)))
|
|
|
|
|
|
|
|
|
|
(define-macro (inc X) #'(λ(regs)
|
|
|
|
|
((if (toggled?)
|
|
|
|
|
(make-dec-base X)
|
|
|
|
|
(make-inc-base X)) regs)))
|
|
|
|
|
(make-dec-base 'X)
|
|
|
|
|
(make-inc-base 'X)) regs)))
|
|
|
|
|
|
|
|
|
|
(define-macro (dec X) #'(λ(regs)
|
|
|
|
|
((if (toggled?)
|
|
|
|
|
(make-inc-base X)
|
|
|
|
|
(make-dec-base X)) regs)))
|
|
|
|
|
(make-inc-base 'X)
|
|
|
|
|
(make-dec-base 'X)) regs)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-macro (make-jnz-base X Y)
|
|
|
|
|
#'(λ(regs)
|
|
|
|
|
(when (not (zero? (if (number? 'X) 'X (hash-ref regs 'X))))
|
|
|
|
|
(when (not (zero? (if (number? X) X (hash-ref regs X))))
|
|
|
|
|
Y)))
|
|
|
|
|
|
|
|
|
|
(define-macro (jnz X Y)
|
|
|
|
|
#'(λ(regs)
|
|
|
|
|
((if (toggled?)
|
|
|
|
|
(make-copy-base X Y)
|
|
|
|
|
(make-jnz-base X Y)) regs)))
|
|
|
|
|
(make-cpy-base 'X 'Y)
|
|
|
|
|
(make-jnz-base 'X 'Y)) regs)))
|
|
|
|
|