changeset 117:bcb5c41626b4

saving progress
author Robert McIntyre <rlm@mit.edu>
date Fri, 16 Mar 2012 17:50:35 -0500
parents e45031af5327
children be4ec0e60c16
files clojure/com/aurellem/assembly.clj clojure/com/aurellem/dylans-code clojure/com/aurellem/gb_driver.clj
diffstat 3 files changed, 61 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/assembly.clj	Fri Mar 16 17:03:05 2012 -0500
     1.2 +++ b/clojure/com/aurellem/assembly.clj	Fri Mar 16 17:50:35 2012 -0500
     1.3 @@ -438,20 +438,20 @@
     1.4          0xD3   ;    
     1.5          ])))
     1.6  
     1.7 -
     1.8 -
     1.9 -
    1.10  (defn print-listing [state begin end]
    1.11    (dorun (map 
    1.12            (fn [opcode line]
    1.13              (println (format "0x%04X:  0x%02X" line opcode)))
    1.14            (subvec  (vec (memory state)) begin end)
    1.15 -          (range begin end))))
    1.16 +          (range begin end)))
    1.17 +  state)
    1.18    
    1.19 -                    
    1.20 +(defn test-input-number
    1.21 +  "Input freestyle buttons and observe the effects at the repl."
    1.22 +  []
    1.23 +  (set-state! (input-number)) 
    1.24 +  (dotimes [_ 90000] (step (view-memory @current-state 0xD352))))
    1.25  
    1.26  
    1.27  
    1.28  
    1.29 -
    1.30 -
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/clojure/com/aurellem/dylans-code	Fri Mar 16 17:50:35 2012 -0500
     2.3 @@ -0,0 +1,54 @@
     2.4 +
     2.5 +(defn count-frames* []
     2.6 +  (-> (tick (mid-game))
     2.7 +      (IE! 0) ; disable interrupts
     2.8 +      (inject-item-assembly
     2.9 +       ;; write 00010000 to 0xFF00 to select joypad
    2.10 +       [0x18   ;D31D                    ; jump over          
    2.11 +        0x02   ;D31E                    ; the next 2 bytes
    2.12 +        0x00   ;D31F                    ; frame-count
    2.13 +        0x00   ;D320                    ; v-blank-prev
    2.14 +
    2.15 +        
    2.16 +        0xFA   ;D321
    2.17 +        0x41   ;D322                    ; load (FF41) into A
    2.18 +        0xFF   ;D323                    ; this contains mode flags
    2.19 +
    2.20 +        0x47   ;; copy A -> B
    2.21 +        
    2.22 +        0xCB
    2.23 +        0x3F ;; shift A right
    2.24 +        0x2F ;; complement A
    2.25 +
    2.26 +        0xA0 ;; A & B -> A.
    2.27 +        0x47 ;; copy A -> B. Now the first bit of B is (VB == 1)
    2.28 +        
    2.29 +        0xFA
    2.30 +        0x20
    2.31 +        0xD3 ;; load v-blank-prev into A
    2.32 +
    2.33 +        0xA0 ;; A & B -> A. 
    2.34 +        0x4F ;; copy A to C. Now C contains increment-counter?
    2.35 +
    2.36 +        0xFA
    2.37 +        0x1F
    2.38 +        0xD3 ;; load frame-count into A
    2.39 +
    2.40 +        0x81 ;; add increment-counter? to frame-count
    2.41 +        0xEA ;; store A into frame-count
    2.42 +        0x1F
    2.43 +        0xD3
    2.44 +
    2.45 +        0x3E ;; load 1 into A
    2.46 +        0x01
    2.47 +        0xA0 ;; A & B -> A. Now A is (VB==1)
    2.48 +        0xEA ;; store A into v-blank-prev
    2.49 +        0x20
    2.50 +        0xD3
    2.51 +
    2.52 +        0xC3   ;D348                   ; return to beginning
    2.53 +        0x1D   ;D349
    2.54 +        0xD3   ;D34A
    2.55 +
    2.56 +
    2.57 +        ])))
    2.58 \ No newline at end of file
     3.1 --- a/clojure/com/aurellem/gb_driver.clj	Fri Mar 16 17:03:05 2012 -0500
     3.2 +++ b/clojure/com/aurellem/gb_driver.clj	Fri Mar 16 17:50:35 2012 -0500
     3.3 @@ -128,7 +128,6 @@
     3.4         (dorun (dotimes [_ n]
     3.5                  (Thread/sleep 1)
     3.6                  (Gb/step)))
     3.7 -
     3.8         (finally
     3.9               (update-state))))
    3.10    ([n]