diff clojure/com/aurellem/run/adv_choreo.clj @ 560:3194a4f438ca

restored previous functionality of glyph-display program.
author Robert McIntyre <rlm@mit.edu>
date Fri, 31 Aug 2012 05:00:33 -0500
parents 91e99cc36bda
children c57398047795
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/adv_choreo.clj	Fri Aug 31 04:58:15 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/adv_choreo.clj	Fri Aug 31 05:00:33 2012 -0500
     1.3 @@ -126,43 +126,7 @@
     1.4      (concat A B )))
     1.5  
     1.6  
     1.7 -   ;; handle-delay*
     1.8 -        ;; (flatten
     1.9 -        ;;  [0xA7 ;; test if delay is zero
    1.10 -        ;;   ;; if delay is not 0, decrement and skip to cleanup
    1.11 -        ;;   0x28 ;; JR Z, skip this section if A==0
    1.12 -        ;;   4
    1.13 -        ;;   0x3D ;; dec A
    1.14 -        ;;   0x77 ;; (dec delay) -> delay
    1.15 -        ;;   0x18
    1.16 -        ;;   :to-cleanup])
    1.17 -
    1.18 -        ;; handle-glyph-count*
    1.19 -        ;; (flatten
    1.20 -        ;;  [;; if glyph-count is 0, go directly to stack-cleanup
    1.21 -
    1.22 -        ;;   ;;0x79 0xB0 ;; check if BC == 0
    1.23 -        ;;   0 0
    1.24 -        ;;   0x20 ;; JR NZ, skip if BC !=0
    1.25 -        ;;   2
    1.26 -        ;;   0 0
    1.27 -        ;;   ;;0x18
    1.28 -        ;;   ;;:to-stack-cleanup
    1.29 -        ;;   ])
    1.30 -;;        handle-glyph-count* [0 0 0 0]
    1.31 -        
    1.32 -
    1.33 -        ;; handle-delay
    1.34 -        ;; (replace {:to-cleanup
    1.35 -        ;;           (+ (count display-glyph) (count handle-glyph-count*))}
    1.36 -        ;;          handle-delay*)
    1.37 -
    1.38 -        ;; handle-glyph-count
    1.39 -        ;; (replace {:to-stack-cleanup
    1.40 -        ;;           (+ (count display-glyph) (count cleanup))}
    1.41 -        ;;          handle-glyph-count*)
    1.42 -
    1.43 -
    1.44 + 
    1.45  (defn glyph-display-program
    1.46    [start-address
    1.47     monitor-address
    1.48 @@ -195,6 +159,27 @@
    1.49            0x7E ;; delay -> A
    1.50            ])
    1.51  
    1.52 +        handle-delay*
    1.53 +        (flatten
    1.54 +         [0xA7 ;; test if delay is zero
    1.55 +          ;; if delay is not 0, decrement and skip to cleanup
    1.56 +          0x28 ;; JR Z, skip this section if A==0
    1.57 +          4
    1.58 +          0x3D ;; dec A
    1.59 +          0x77 ;; (dec delay) -> delay
    1.60 +          0x18
    1.61 +          :to-cleanup])
    1.62 +
    1.63 +        handle-glyph-count*
    1.64 +        (flatten
    1.65 +         [;; if glyph-count is 0, go directly to stack-cleanup
    1.66 +          0x79 0xB0 ;; check if BC == 0
    1.67 +          0x20 ;; JR NZ, skip if BC !=0
    1.68 +          2
    1.69 +          0x18
    1.70 +          :to-stack-cleanup
    1.71 +          ])
    1.72 +
    1.73          display-glyph [0 0 0]               
    1.74          cleanup
    1.75          ;; restore all registers
    1.76 @@ -216,10 +201,19 @@
    1.77           
    1.78          stack-cleanup
    1.79          [0xF1 0xE1 0xD1 0xC1]
    1.80 +        
    1.81 +        handle-delay
    1.82 +        (replace {:to-cleanup
    1.83 +                  (+ (count display-glyph) (count handle-glyph-count*))}
    1.84 +                 handle-delay*)
    1.85  
    1.86 +        handle-glyph-count
    1.87 +        (replace {:to-stack-cleanup
    1.88 +                  (+ (count display-glyph) (count cleanup))}
    1.89 +                 handle-glyph-count*)
    1.90      ]
    1.91      (concat load-data
    1.92 -            ;;handle-delay handle-glyph-count
    1.93 +            handle-delay handle-glyph-count
    1.94              display-glyph
    1.95              cleanup stack-cleanup)))
    1.96