changeset 491:2304906d443b

added function to pack gb-rgb bytes
author Robert McIntyre <rlm@mit.edu>
date Thu, 24 May 2012 17:33:25 -0500
parents 09b3bc0b71b5
children 716752719a78
files clojure/com/aurellem/run/image.clj moves/temp.vbm
diffstat 2 files changed, 64 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/image.clj	Mon May 07 12:31:16 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/image.clj	Thu May 24 17:33:25 2012 -0500
     1.3 @@ -88,24 +88,69 @@
     1.4  ;; }
     1.5  
     1.6  
     1.7 -(def intensity
     1.8 -  [0x00 0x10 0x20 0x30 0x40 0x50 0x5e 0x6c 0x7a 0x88 0x94
     1.9 -   0xa0 0xae 0xb7 0xbf 0xc6 0xce 0xd3 0xd9 0xdf 0xe3 0xe7
    1.10 -   0xeb 0xef 0xf3 0xf6 0xf9 0xfb 0xfd 0xfe 0xff 0xff])
    1.11 +                  
    1.12  
    1.13 -(def influence
    1.14 -  [[16 4 4]
    1.15 -   [8 16 8]
    1.16 -   [0 8 16]])
    1.17 +(def image-program-target 0xB000)
    1.18  
    1.19 -(defn rgb->gb-rb [[r g b]]
    1.20 -  (let [color-matrix
    1.21 -        (map
    1.22 -         (fn [color-row]
    1.23 -           (map
    1.24 -            (fn [color]
    1.25 -              (bit-shift-right
    1.26 -               (* (intensity (bit-shift-right r 3))
    1.27 -                  color) 5)))))]))
    1.28 -                  
    1.29 -        
    1.30 \ No newline at end of file
    1.31 +
    1.32 +(def display-width 160)
    1.33 +(def display-height 144)
    1.34 +
    1.35 +
    1.36 +
    1.37 +;{:r :g :b }
    1.38 +
    1.39 +(def character-data     0x8000)
    1.40 +(def character-data-end 0x97FF)
    1.41 +
    1.42 +
    1.43 +
    1.44 +
    1.45 +(def BG-data-1 0x9800)
    1.46 +
    1.47 +(def BG-data-2 0x9C00)
    1.48 +
    1.49 +(def OAM 0xFE00)
    1.50 +
    1.51 +
    1.52 +(def bg-pallet-select 0xFF68)
    1.53 +(def bg-pallet-data   0xFF69)
    1.54 +
    1.55 +(def obj-palette-select 0xFF6A)
    1.56 +(def obj-palette-data   0xFF6B)
    1.57 +
    1.58 +
    1.59 +
    1.60 +(def video-bank-select-register 0xFF4F)
    1.61 +
    1.62 +
    1.63 +
    1.64 +(defn gb-rgb->bits [r g b]
    1.65 +  (assert (< 0 r 32))
    1.66 +  (assert (< 0 g 32))
    1.67 +  (assert (< 0 b 32))
    1.68 +  [(bit-and
    1.69 +    0xFF
    1.70 +    (+
    1.71 +     r
    1.72 +     (bit-shift-left g 5)))
    1.73 +
    1.74 +   (+
    1.75 +    (bit-shift-right g 3)
    1.76 +    (bit-shift-left  b 2))])
    1.77 +      
    1.78 +      
    1.79 +   
    1.80 +
    1.81 +  )
    1.82 + 
    1.83 +(defn display-one-color
    1.84 +  "Displayes a single color onto the gameboy screen. input rgb in
    1.85 +   gameboy rgb."
    1.86 +  [r g b]
    1.87 +  
    1.88 +
    1.89 +
    1.90 +
    1.91 +
    1.92 +  )
    1.93 \ No newline at end of file
     2.1 Binary file moves/temp.vbm has changed