diff clojure/com/aurellem/run/adv_choreo.clj @ 557:cd54ac4a8701

more cleanup code.
author Robert McIntyre <rlm@mit.edu>
date Fri, 31 Aug 2012 02:01:34 -0500
parents 6e6b7961595b
children 6f8b15c2fb48
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/adv_choreo.clj	Fri Aug 31 01:48:31 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/adv_choreo.clj	Fri Aug 31 02:01:34 2012 -0500
     1.3 @@ -137,40 +137,65 @@
     1.4          glyph-count-high     (+ 2 data-start)
     1.5          glyph-count-low      (+ 3 data-start)
     1.6  
     1.7 -        delay-address        (+ 4 data-start)]
     1.8 +        delay-address        (+ 4 data-start)
     1.9          
    1.10 +        load-data
    1.11 +        (flatten
    1.12 +         [;; data region
    1.13 +          
    1.14 +          0x18
    1.15 +          5
    1.16 +          (disect-bytes-2 monitor-address)
    1.17 +          (disect-bytes-2 total-glyph-count)
    1.18 +          delay-count
    1.19 +
    1.20 +          ;; save all registers
    1.21 +          0xC5 0xD5 0xE5 0xF5
    1.22 +
    1.23 +          ;; load data from data region into registers
    1.24 +
    1.25 +          0x21
    1.26 +          (disect-bytes-2 monitor-address-high)
    1.27 +
    1.28 +          0x2A 0x47 ;; monitor-address-high -> B
    1.29 +          0x2A 0x4F ;; monitor-address-low  -> C
    1.30 +
    1.31 +          0x2A 0x57 ;; glyph-count-high -> D
    1.32 +          0x2A 0x5F ;; glyph-count-low  -> E
    1.33 +
    1.34 +          0x2A ;; delay -> A
    1.35 +          ])
    1.36 +
    1.37 +        handle-delay*
    1.38 +        (flatten
    1.39 +         [0xA7 ;; test if A is zero
    1.40 +          ;; if A is not 0, decrement  and skip to cleanup
    1.41 +          0x20
    1.42 +          5
    1.43 +          0x3D
    1.44 +          0x77
    1.45 +          0xC3
    1.46 +          :cleanup-address-low
    1.47 +          :cleanup-address-high])
    1.48 +
    1.49 +          
    1.50 +          
    1.51 +        cleanup
    1.52 +        ;; restore all registers
    1.53 +        [0xF1 0xE1 0xD1 0xC1]
    1.54 +
    1.55 +        [cleanup-address-high
    1.56 +         cleanup-address-low] (disect-bytes-2
    1.57 +                               (+ start-address (count load-data)
    1.58 +                                  (count handle-delay*)))
    1.59          
    1.60 -  (flatten
    1.61 -   [;; data region
    1.62 +        handle-delay
    1.63 +        (replace {:cleanup-address-low cleanup-address-low
    1.64 +                  :cleanup-address-high cleanup-address-high}
    1.65 +                 handle-delay*)]
    1.66 +    (concat load-data handle-delay cleanup)))
    1.67 +        
    1.68  
    1.69 -    0x18
    1.70 -    5
    1.71 -    (disect-bytes-2 monitor-address)
    1.72 -    (disect-bytes-2 total-glyph-count)
    1.73 -    delay-count
    1.74 -
    1.75 -    ;; save all registers
    1.76 -    0xC5 0xD5 0xE5 0xF5
    1.77 -
    1.78 -    ;; load data from data region into registers
    1.79 -
    1.80 -    0x21
    1.81 -    (disect-bytes-2 monitor-address-high)
    1.82 -
    1.83 -    0x2A 0x47 ;; monitor-address-high -> B
    1.84 -    0x2A 0x4F ;; monitor-address-low  -> C
    1.85 -
    1.86 -    0x2A 0x57 ;; glyph-count-high -> D
    1.87 -    0x2A 0x5F ;; glyph-count-low  -> E
    1.88 -
    1.89 -    0x2A ;; delay -> A 
    1.90 -    
    1.91 -
    1.92 -    
    1.93 -    
    1.94 -    ;; restore all registers
    1.95 -    0xF1 0xE1 0xD1 0xC1
    1.96 -   ])))
    1.97  
    1.98  (def main-program-base-address 0xC000)
    1.99