Mercurial > vba-clojure
changeset 558:6f8b15c2fb48
trying to track down major problem with storing variables in RAM.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 31 Aug 2012 04:22:08 -0500 |
parents | cd54ac4a8701 |
children | 91e99cc36bda |
files | clojure/com/aurellem/run/adv_choreo.clj |
diffstat | 1 files changed, 69 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/run/adv_choreo.clj Fri Aug 31 02:01:34 2012 -0500 1.2 +++ b/clojure/com/aurellem/run/adv_choreo.clj Fri Aug 31 04:22:08 2012 -0500 1.3 @@ -125,6 +125,44 @@ 1.4 2))])] 1.5 (concat A B ))) 1.6 1.7 + 1.8 + ;; handle-delay* 1.9 + ;; (flatten 1.10 + ;; [0xA7 ;; test if delay is zero 1.11 + ;; ;; if delay is not 0, decrement and skip to cleanup 1.12 + ;; 0x28 ;; JR Z, skip this section if A==0 1.13 + ;; 4 1.14 + ;; 0x3D ;; dec A 1.15 + ;; 0x77 ;; (dec delay) -> delay 1.16 + ;; 0x18 1.17 + ;; :to-cleanup]) 1.18 + 1.19 + ;; handle-glyph-count* 1.20 + ;; (flatten 1.21 + ;; [;; if glyph-count is 0, go directly to stack-cleanup 1.22 + 1.23 + ;; ;;0x79 0xB0 ;; check if BC == 0 1.24 + ;; 0 0 1.25 + ;; 0x20 ;; JR NZ, skip if BC !=0 1.26 + ;; 2 1.27 + ;; 0 0 1.28 + ;; ;;0x18 1.29 + ;; ;;:to-stack-cleanup 1.30 + ;; ]) 1.31 +;; handle-glyph-count* [0 0 0 0] 1.32 + 1.33 + 1.34 + ;; handle-delay 1.35 + ;; (replace {:to-cleanup 1.36 + ;; (+ (count display-glyph) (count handle-glyph-count*))} 1.37 + ;; handle-delay*) 1.38 + 1.39 + ;; handle-glyph-count 1.40 + ;; (replace {:to-stack-cleanup 1.41 + ;; (+ (count display-glyph) (count cleanup))} 1.42 + ;; handle-glyph-count*) 1.43 + 1.44 + 1.45 (defn glyph-display-program 1.46 [start-address 1.47 monitor-address 1.48 @@ -153,9 +191,8 @@ 1.49 0xC5 0xD5 0xE5 0xF5 1.50 1.51 ;; load data from data region into registers 1.52 - 1.53 0x21 1.54 - (disect-bytes-2 monitor-address-high) 1.55 + (reverse (disect-bytes-2 data-start)) 1.56 1.57 0x2A 0x47 ;; monitor-address-high -> B 1.58 0x2A 0x4F ;; monitor-address-low -> C 1.59 @@ -163,37 +200,39 @@ 1.60 0x2A 0x57 ;; glyph-count-high -> D 1.61 0x2A 0x5F ;; glyph-count-low -> E 1.62 1.63 - 0x2A ;; delay -> A 1.64 + 0x7E ;; delay -> A 1.65 ]) 1.66 1.67 - handle-delay* 1.68 - (flatten 1.69 - [0xA7 ;; test if A is zero 1.70 - ;; if A is not 0, decrement and skip to cleanup 1.71 - 0x20 1.72 - 5 1.73 - 0x3D 1.74 - 0x77 1.75 - 0xC3 1.76 - :cleanup-address-low 1.77 - :cleanup-address-high]) 1.78 - 1.79 - 1.80 - 1.81 + display-glyph [0 0 0] 1.82 cleanup 1.83 ;; restore all registers 1.84 + 1.85 + (flatten 1.86 + [;; HL points to delay currently, 1.87 + ;; decrement HL and then restore everything 1.88 + 1.89 + 0x03 ;; (inc monitor-address) -> monitor-address 1.90 + 0x1B ;; (dec glyph-count) -> glyph-count 1.91 + 1.92 + ;; Reset HL to initial value 1.93 + 0x21 1.94 + (reverse (disect-bytes-2 data-start)) 1.95 + 1.96 + 0x78 0x22 ;; B -> monitor-address-high 1.97 + 0x79 0x22 ;; C -> monitor-address-low 1.98 + 1.99 + ;;0x7A 0x22 ;; D -> glyph-count-high 1.100 + ;;0x7B 0x22 ;; E -> glyph-count-low 1.101 + ]) 1.102 + 1.103 + stack-cleanup 1.104 [0xF1 0xE1 0xD1 0xC1] 1.105 1.106 - [cleanup-address-high 1.107 - cleanup-address-low] (disect-bytes-2 1.108 - (+ start-address (count load-data) 1.109 - (count handle-delay*))) 1.110 - 1.111 - handle-delay 1.112 - (replace {:cleanup-address-low cleanup-address-low 1.113 - :cleanup-address-high cleanup-address-high} 1.114 - handle-delay*)] 1.115 - (concat load-data handle-delay cleanup))) 1.116 + ] 1.117 + (concat load-data 1.118 + ;;handle-delay handle-glyph-count 1.119 + display-glyph 1.120 + cleanup stack-cleanup))) 1.121 1.122 1.123 1.124 @@ -208,7 +247,8 @@ 1.125 (+ (count init) (count header) 1.126 start-address) 1.127 main-program-base-address 100 1.128 - (- (count (program-data 0)) 100)) 1.129 + 200) 1.130 + ;;(- (count (program-data 0)) 100)) 1.131 1.132 state-machine-start-address 1.133 (+ start-address (count init) (count header) (count glyph-display)) 1.134 @@ -231,7 +271,7 @@ 1.135 1.136 1.137 1.138 -(defn begin-glyph-bootstrap 1.139 +(defn-memo begin-glyph-bootstrap 1.140 ([] (begin-glyph-bootstrap (launch-main-bootstrap-program))) 1.141 ([script] 1.142 (let [glyph-init (glyph-init-program relocated-bootstrap-start)