changeset 218:ca9d2897435b

moved hardcoded stuff into its own namespace.
author Robert McIntyre <rlm@mit.edu>
date Fri, 23 Mar 2012 20:18:03 -0500
parents 7ceaac84be57
children 1af1a279895b
files clojure/com/aurellem/gb/hxc.clj clojure/com/aurellem/gb/species.clj
diffstat 2 files changed, 88 insertions(+), 92 deletions(-) [+]
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/clojure/com/aurellem/gb/hxc.clj	Fri Mar 23 20:18:03 2012 -0500
     1.3 @@ -0,0 +1,88 @@
     1.4 +(ns com.aurellem.gb.hxc
     1.5 +  (:use (com.aurellem.gb assembly characters gb-driver util
     1.6 +                         constants))
     1.7 +  (:use (com.aurellem.world practice))
     1.8 +  (:import [com.aurellem.gb.gb_driver SaveState]))
     1.9 +
    1.10 +
    1.11 +(def hxc-pokenames
    1.12 +  "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."
    1.13 +  (let [count-species 190
    1.14 +        name-length 10]
    1.15 +    (map character-codes->str
    1.16 +         (partition name-length
    1.17 +                    (take (* count-species name-length)
    1.18 +                          (drop 0xE8000
    1.19 +                                (rom(root))))))))
    1.20 +
    1.21 +(def hxc-items
    1.22 +  "The hardcoded names of the items in memory. List begins at ROM@45B7 "
    1.23 +  (map character-codes->str
    1.24 +       (take-nth 2
    1.25 +                 (partition-by #(= % 0x50)
    1.26 +                               (take 1200
    1.27 +                                     (drop 0x45B7 (rom (root))))))))
    1.28 +(def hxc-titles
    1.29 +  "The hardcoded names of the trainer titles in memory. List begins at
    1.30 +ROM@27E77"
    1.31 +  (map character-codes->str
    1.32 +       (take-nth 2
    1.33 +                 (partition-by #(= 0x50 %)
    1.34 +                               (take 196
    1.35 +                                     (drop 0x27E77
    1.36 +                                           (rom (root))))))))
    1.37 +
    1.38 +
    1.39 +(def hxc-pokedex
    1.40 +  "The hardcoded pokedex entries in memory. List begins at
    1.41 +ROM@B8000, shortly before move names."
    1.42 +  (map character-codes->str
    1.43 +       (take-nth 2
    1.44 +                 (partition-by #(= % 0x50)
    1.45 +                               (take 14754
    1.46 +                                     (drop 0xB8000
    1.47 +                                           (rom (root))))))))
    1.48 +(def hxc-moves
    1.49 +  "The hardcoded move names in memory. List begins at ROM@BC000"
    1.50 +  (map character-codes->str
    1.51 +       (take-nth 2
    1.52 +                 (partition-by #(= % 0x50)
    1.53 +                               (take 1551
    1.54 +                                     (drop 0xBC000
    1.55 +                                           (rom (root))))))))   
    1.56 +
    1.57 +
    1.58 +
    1.59 +(def hxc-places
    1.60 +  "The hardcoded place names in memory. List begins at
    1.61 +ROM@71500. Cinnabar Mansion is dynamically calculated."
    1.62 +  (map character-codes->str
    1.63 +       (take-nth 2
    1.64 +                 (partition-by #(= % 0x50)
    1.65 +                               (take 560
    1.66 +                                     (drop 0x71500
    1.67 +                                           (rom (root))))))))
    1.68 +
    1.69 +
    1.70 +(def hxc-dialog
    1.71 +  "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
    1.72 +(character-codes->str(take 0x0F728
    1.73 +                          (drop (+ 0x98000)
    1.74 +                                (rom (root))))))
    1.75 +
    1.76 +(def hxc-later
    1.77 +  "Running this code produces, e.g. hardcoded names NPCs give
    1.78 +their pokemon. Will sort through it later."
    1.79 +(print (character-codes->str(take 10000
    1.80 +                          (drop 0x71597
    1.81 +                                (rom (root)))))))
    1.82 +
    1.83 +(let [dex
    1.84 +      (partition-by #(= 0x50 %)
    1.85 +                    (take 2540
    1.86 +                          (drop 0x40687
    1.87 +                                (rom (root)))))]
    1.88 +  (def dex dex)
    1.89 +  (def hxc-species
    1.90 +    (map character-codes->str
    1.91 +         (take-nth 4 dex))))
     2.1 --- a/clojure/com/aurellem/gb/species.clj	Fri Mar 23 19:39:03 2012 -0500
     2.2 +++ b/clojure/com/aurellem/gb/species.clj	Fri Mar 23 20:18:03 2012 -0500
     2.3 @@ -1,100 +1,8 @@
     2.4  (ns com.aurellem.gb.species
     2.5    (:use (com.aurellem.gb assembly characters gb-driver util
     2.6                           constants))
     2.7 -  (:use (com.aurellem.world practice))
     2.8    (:import [com.aurellem.gb.gb_driver SaveState]))
     2.9  
    2.10 -
    2.11 -(def hxc-pokenames
    2.12 -  "The hardcoded names of the 190 species in memory. List begins at ROM@E8000."
    2.13 -  (let [count-species 190
    2.14 -        name-length 10]
    2.15 -    (map character-codes->str
    2.16 -         (partition name-length
    2.17 -                    (take (* count-species name-length)
    2.18 -                          (drop 0xE8000
    2.19 -                                (rom(root))))))))
    2.20 -
    2.21 -(def hxc-items
    2.22 -  "The hardcoded names of the items in memory. List begins at ROM@45B7 "
    2.23 -  (map character-codes->str
    2.24 -       (take-nth 2
    2.25 -                 (partition-by #(= % 0x50)
    2.26 -                               (take 1200
    2.27 -                                     (drop 0x45B7 (rom (root))))))))
    2.28 -(def hxc-titles
    2.29 -  "The hardcoded names of the trainer titles in memory. List begins at
    2.30 -ROM@27E77"
    2.31 -  (map character-codes->str
    2.32 -       (take-nth 2
    2.33 -                 (partition-by #(= 0x50 %)
    2.34 -                               (take 196
    2.35 -                                     (drop 0x27E77
    2.36 -                                           (rom (root))))))))
    2.37 -
    2.38 -
    2.39 -(def hxc-pokedex
    2.40 -  "The hardcoded pokedex entries in memory. List begins at
    2.41 -ROM@B8000, shortly before move names."
    2.42 -  (map character-codes->str
    2.43 -       (take-nth 2
    2.44 -                 (partition-by #(= % 0x50)
    2.45 -                               (take 14754
    2.46 -                                     (drop 0xB8000
    2.47 -                                           (rom (root))))))))
    2.48 -(def hxc-moves
    2.49 -  "The hardcoded move names in memory. List begins at ROM@BC000"
    2.50 -  (map character-codes->str
    2.51 -       (take-nth 2
    2.52 -                 (partition-by #(= % 0x50)
    2.53 -                               (take 1551
    2.54 -                                     (drop 0xBC000
    2.55 -                                           (rom (root))))))))   
    2.56 -
    2.57 -
    2.58 -
    2.59 -(def hxc-places
    2.60 -  "The hardcoded place names in memory. List begins at
    2.61 -ROM@71500. Cinnabar Mansion is dynamically calculated."
    2.62 -  (map character-codes->str
    2.63 -       (take-nth 2
    2.64 -                 (partition-by #(= % 0x50)
    2.65 -                               (take 560
    2.66 -                                     (drop 0x71500
    2.67 -                                           (rom (root))))))))
    2.68 -
    2.69 -
    2.70 -(def hxc-dialog
    2.71 -  "The hardcoded dialogue in memory, including in-game alerts. List begins at ROM@98000."
    2.72 -(character-codes->str(take 0x0F728
    2.73 -                          (drop (+ 0x98000)
    2.74 -                                (rom (root)))))
    2.75 -
    2.76 -(def hxc-later
    2.77 -  "Running this code produces, e.g. hardcoded names NPCs give
    2.78 -their pokemon. Will sort through it later."
    2.79 -(print (character-codes->str(take 10000
    2.80 -                          (drop 0x71597
    2.81 -                                (rom (root)))))))
    2.82 -
    2.83 -
    2.84 -
    2.85 -
    2.86 -
    2.87 -
    2.88 -
    2.89 -(let [dex
    2.90 -      (partition-by #(= 0x50 %)
    2.91 -                    (take 2540
    2.92 -                          (drop 0x40687
    2.93 -                                (rom (root)))))]
    2.94 -  (def dex dex)
    2.95 -  (def hxc-species
    2.96 -    (map character-codes->str
    2.97 -         (take-nth 4 dex))))
    2.98 -
    2.99 -
   2.100 -
   2.101  (def species-code->species-name
   2.102    {0x01  :rhydon
   2.103     0x02  :kangaskhan