Mercurial > vba-clojure
view clojure/com/aurellem/dylans-code @ 135:eb6ba88088d3
Wrote a more efficient input-number-assembly program; 91 oc -> 60 oc.
author | Dylan Holmes <ocsenave@gmail.com> |
---|---|
date | Sun, 18 Mar 2012 05:13:19 -0500 |
parents | bcb5c41626b4 |
children |
line wrap: on
line source
2 (defn count-frames* []3 (-> (tick (mid-game))4 (IE! 0) ; disable interrupts5 (inject-item-assembly6 ;; write 00010000 to 0xFF00 to select joypad7 [0x18 ;D31D ; jump over8 0x02 ;D31E ; the next 2 bytes9 0x00 ;D31F ; frame-count10 0x00 ;D320 ; v-blank-prev13 0xFA ;D32114 0x41 ;D322 ; load (FF41) into A15 0xFF ;D323 ; this contains mode flags17 0x47 ;; copy A -> B19 0xCB20 0x3F ;; shift A right21 0x2F ;; complement A23 0xA0 ;; A & B -> A.24 0x47 ;; copy A -> B. Now the first bit of B is (VB == 1)26 0xFA27 0x2028 0xD3 ;; load v-blank-prev into A30 0xA0 ;; A & B -> A.31 0x4F ;; copy A to C. Now C contains increment-counter?33 0xFA34 0x1F35 0xD3 ;; load frame-count into A37 0x81 ;; add increment-counter? to frame-count38 0xEA ;; store A into frame-count39 0x1F40 0xD342 0x3E ;; load 1 into A43 0x0144 0xA0 ;; A & B -> A. Now A is (VB==1)45 0xEA ;; store A into v-blank-prev46 0x2047 0xD349 0xC3 ;D348 ; return to beginning50 0x1D ;D34951 0xD3 ;D34A54 ])))