# HG changeset patch # User Robert McIntyre # Date 1346396494 18000 # Node ID cd54ac4a8701e5403b631ca93541d8471fbbde04 # Parent 6e6b7961595be1d54d630e0662a6ddd44706fce8 more cleanup code. diff -r 6e6b7961595b -r cd54ac4a8701 clojure/com/aurellem/run/adv_choreo.clj --- a/clojure/com/aurellem/run/adv_choreo.clj Fri Aug 31 01:48:31 2012 -0500 +++ b/clojure/com/aurellem/run/adv_choreo.clj Fri Aug 31 02:01:34 2012 -0500 @@ -137,40 +137,65 @@ glyph-count-high (+ 2 data-start) glyph-count-low (+ 3 data-start) - delay-address (+ 4 data-start)] + delay-address (+ 4 data-start) + load-data + (flatten + [;; data region + + 0x18 + 5 + (disect-bytes-2 monitor-address) + (disect-bytes-2 total-glyph-count) + delay-count + + ;; save all registers + 0xC5 0xD5 0xE5 0xF5 + + ;; load data from data region into registers + + 0x21 + (disect-bytes-2 monitor-address-high) + + 0x2A 0x47 ;; monitor-address-high -> B + 0x2A 0x4F ;; monitor-address-low -> C + + 0x2A 0x57 ;; glyph-count-high -> D + 0x2A 0x5F ;; glyph-count-low -> E + + 0x2A ;; delay -> A + ]) + + handle-delay* + (flatten + [0xA7 ;; test if A is zero + ;; if A is not 0, decrement and skip to cleanup + 0x20 + 5 + 0x3D + 0x77 + 0xC3 + :cleanup-address-low + :cleanup-address-high]) + + + + cleanup + ;; restore all registers + [0xF1 0xE1 0xD1 0xC1] + + [cleanup-address-high + cleanup-address-low] (disect-bytes-2 + (+ start-address (count load-data) + (count handle-delay*))) - (flatten - [;; data region + handle-delay + (replace {:cleanup-address-low cleanup-address-low + :cleanup-address-high cleanup-address-high} + handle-delay*)] + (concat load-data handle-delay cleanup))) + - 0x18 - 5 - (disect-bytes-2 monitor-address) - (disect-bytes-2 total-glyph-count) - delay-count - - ;; save all registers - 0xC5 0xD5 0xE5 0xF5 - - ;; load data from data region into registers - - 0x21 - (disect-bytes-2 monitor-address-high) - - 0x2A 0x47 ;; monitor-address-high -> B - 0x2A 0x4F ;; monitor-address-low -> C - - 0x2A 0x57 ;; glyph-count-high -> D - 0x2A 0x5F ;; glyph-count-low -> E - - 0x2A ;; delay -> A - - - - - ;; restore all registers - 0xF1 0xE1 0xD1 0xC1 - ]))) (def main-program-base-address 0xC000)