changeset 137:1c58fa3cfc68

Checkpoint: about to include the state machine in the assembly* code.
author Dylan Holmes <ocsenave@gmail.com>
date Sun, 18 Mar 2012 20:49:40 -0500
parents ffeeabae7dcd
children 2b69cbe8a5b9
files clojure/com/aurellem/assembly.clj
diffstat 1 files changed, 26 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/assembly.clj	Sun Mar 18 05:53:25 2012 -0500
     1.2 +++ b/clojure/com/aurellem/assembly.clj	Sun Mar 18 20:49:40 2012 -0500
     1.3 @@ -531,55 +531,60 @@
     1.4     0x41
     1.5     0x20   ; JUMP ahead to button input if nonzero
     1.6     0x03
     1.7 -   0x18   ; JUMP  back to beginning
     1.8 -   0xE7
     1.9 +   0x18   ; JUMP  back to frame metronome (D31E)
    1.10 +   0xE7  
    1.11     
    1.12     ;; -------- GET BUTTON INPUT
    1.13 -   0x00 ;; var: which-input D336
    1.14 +
    1.15 +        ;; btw, C_0 is now 1
    1.16 +   0x00 ;; var: which-input D337
    1.17          ;; prepare to select bits
    1.18  
    1.19 -   0x01 ;; load 0x0000 into BC
    1.20 -   0x00 
    1.21 +   0x06 ;; load 0x00 into B
    1.22     0x00
    1.23 -   
    1.24 -   0x3E ;; load 0x20 into A
    1.25 + 
    1.26 +   0x3E ;; load 0x20 into A, to measure dpad
    1.27     0x20
    1.28  
    1.29     
    1.30 -   0xEA ;; load A into [FF00] ;; D33D
    1.31 +   0xE0 ;; load A into [FF00] ;; D33C
    1.32     0x00
    1.33 -   0xFF
    1.34 -
    1.35 -   0xFA ;; load A from [FF00]
    1.36 +   
    1.37 +   0xF0 ;; load A from [FF00]
    1.38     0x00
    1.39 -   0xFF
    1.40  
    1.41     0xE6 ;; bitmask 00001111
    1.42     0x0F
    1.43     
    1.44     0xB0 ;; A or B --> A
    1.45 -
    1.46     0xCB
    1.47     0x41 ;; test bit 0 of C
    1.48 -   0x20 ;; JUMP forward if 1
    1.49 +   0x28 ;; JUMP forward if 0
    1.50     0x08
    1.51  
    1.52     0x47 ;; A -> B
    1.53     0xCB ;; swap B nybbles
    1.54     0x30 
    1.55     0x0C ;; increment C
    1.56 -   0x3E ;; load 0x10 into A
    1.57 +   0x3E ;; load 0x10 into A, to measure btns
    1.58     0x10
    1.59     0x18 ;; JUMP back to "load A into [FF00]" [20 steps?]
    1.60 -   0xEB
    1.61 +   0xED
    1.62  
    1.63     ;; now A contains the pressed keys
    1.64 -   0xEA ;; copy keys to input-number [D336]
    1.65 -   0x39 
    1.66 +   
    1.67 +   
    1.68 +
    1.69 +
    1.70 +
    1.71 +
    1.72 +
    1.73 +
    1.74 +   0xC3 ;; todo replace with relative jump
    1.75 +   0x1E
    1.76     0xD3
    1.77 -   0x18 ;;JUMP back to "beginning" [D31E]
    1.78 -   0xC7
    1.79 -   
    1.80 +   ;;0x18 ;;JUMP back to "metronome" in one hop [D31E]
    1.81 +   ;;0xCA ;; E1
    1.82     
    1.83     ]
    1.84    )