# HG changeset patch # User Robert McIntyre # Date 1334240500 18000 # Node ID 47d44bb54d32a52836e5bcea05dc44b4df73d5a8 # Parent d8cbbf2a313307111733ba82373fecd62850668a saving progress... diff -r d8cbbf2a3133 -r 47d44bb54d32 clojure/com/aurellem/gb/rlm_assembly.clj --- a/clojure/com/aurellem/gb/rlm_assembly.clj Thu Apr 12 06:27:03 2012 -0500 +++ b/clojure/com/aurellem/gb/rlm_assembly.clj Thu Apr 12 09:21:40 2012 -0500 @@ -66,16 +66,16 @@ (defn frame-metronome [] (let [timing-loop [;;0x01 ; \ - ;;0x43 ; | - ;;0xFE ; | load 0xFF44 into BC without repeats - ;;0x0C ; | + ;;0x43 ; | + ;;0xFE ; | load 0xFF44 into BC without repeats + ;;0x0C ; | ;;0x04 ; / ;;0x0A ;; (BC) -> A, now A = LY (vertical line coord) 0x11 ; \ - 0x43 ; | - 0xFE ; | load 0xFF44 into DE without repeats - 0x1C ; | + 0x43 ; | + 0xFE ; | load 0xFF44 into DE without repeats + 0x1C ; | 0x14 ; / 0x1A ;; (DE) -> A, now A = LY (vertical line coord) ] @@ -115,15 +115,15 @@ (defn read-user-input [] [;;0x01 ;\ - ;;0x01 ;| - ;;0xFE ;| load 0xFF00 into BC without repeats - ;;0x04 ;| + ;;0x01 ; | + ;;0xFE ; | load 0xFF00 into BC without repeats + ;;0x04 ; | ;;0x0D ;/ 0x11 ; \ - 0x01 ; | - 0xFE ; | load 0xFF44 into DE without repeats - 0x14 ; | + 0x01 ; | + 0xFE ; | load 0xFF44 into DE without repeats + 0x14 ; | 0x1D ; / 0x3E @@ -144,7 +144,7 @@ 0xE6 ;; select bottom bits of A 0x0F - 0x47 ;; A->B + 0x57 ;; A->D 0xF1 ;; pop AF @@ -153,9 +153,10 @@ 0xCB 0x37 ;; swap A nybbles - - 0xB0 ;; (AND A B) -> A - + + 0x5A ;; D->E \ necessary to + 0xB3 ;; (or A D) -> A / prevent repeats. + 0x2F ;; (NOT A) -> A ]) @@ -204,20 +205,31 @@ (read-user-input))) init - [0x1E 0xFF 0x1C] ;; 0-> E without repeats - + [0xAF 0x4F] ;; 0->A; 0->C; - ;; HL -> BC ;; HL = here - ;; add E to HL + ;; add C to HL ;; jp HL + prepare-HL + [0x21] ;; load HL from literal nn + ;; nn == here defined below + mode-dispatch - [0x44 + [0x06 ;\ + 0x01 ; | 0->B without repeats + 0x05 ;/ + 0x09 ;; add BC to HL + 0xE9] ;; jp + here + (disect-bytes-2 (+ 2 start-address (count init) + jump-distance prepare-HL + (count mode-dispatch))) + - ;;(here) jr metronome + ;;(here) jr end ;;stuff ;;modify E @@ -225,59 +237,29 @@ ;;stuff ;;jr metronome + + input-number + + [0x47 ;; A->B + 0x1E ;; + input-high-write-jump + 0x18 + (jump-distance ??)] + + input-high-write + [0x + - - mode-dispatch - [0xCB - 0x43 ;; test bit 0 - - 0xCB - 0x4B ;; test bit 1 - - 0xCB - 0x53 ;; test bit 2 - - 0xCB - 0x5B ;; test bit 3 - - 0xCB - 0x63 ;; test bit 4 - - 0xCB - 0x6B ;; test bit 5 - - ];;default - - - mode-select - [0x5F] ;; A->E - - ;; delayed inputs - input-high 0x67 ;; A->H - input-low 0x6F ;; A->L - input-num 0x57 ;; A->D - - ;; final-actions - jump 0xE9 ;; jp (HL) - write 0x22 ;; A->(HL); inc HL - input-mode 0x00 ;; no-op - - - - input-high - [0x67 ;; A->H - 0x1E ;; change mode - input-low-mode] - - - mode-dispatch + (concat init (frame-metronome) (read-user-input) + prepare-HL here mode-dispatch) +