comparison clojure/com/aurellem/dylans-code @ 117:bcb5c41626b4

saving progress
author Robert McIntyre <rlm@mit.edu>
date Fri, 16 Mar 2012 17:50:35 -0500
parents
children
comparison
equal deleted inserted replaced
116:e45031af5327 117:bcb5c41626b4
1
2 (defn count-frames* []
3 (-> (tick (mid-game))
4 (IE! 0) ; disable interrupts
5 (inject-item-assembly
6 ;; write 00010000 to 0xFF00 to select joypad
7 [0x18 ;D31D ; jump over
8 0x02 ;D31E ; the next 2 bytes
9 0x00 ;D31F ; frame-count
10 0x00 ;D320 ; v-blank-prev
11
12
13 0xFA ;D321
14 0x41 ;D322 ; load (FF41) into A
15 0xFF ;D323 ; this contains mode flags
16
17 0x47 ;; copy A -> B
18
19 0xCB
20 0x3F ;; shift A right
21 0x2F ;; complement A
22
23 0xA0 ;; A & B -> A.
24 0x47 ;; copy A -> B. Now the first bit of B is (VB == 1)
25
26 0xFA
27 0x20
28 0xD3 ;; load v-blank-prev into A
29
30 0xA0 ;; A & B -> A.
31 0x4F ;; copy A to C. Now C contains increment-counter?
32
33 0xFA
34 0x1F
35 0xD3 ;; load frame-count into A
36
37 0x81 ;; add increment-counter? to frame-count
38 0xEA ;; store A into frame-count
39 0x1F
40 0xD3
41
42 0x3E ;; load 1 into A
43 0x01
44 0xA0 ;; A & B -> A. Now A is (VB==1)
45 0xEA ;; store A into v-blank-prev
46 0x20
47 0xD3
48
49 0xC3 ;D348 ; return to beginning
50 0x1D ;D349
51 0xD3 ;D34A
52
53
54 ])))