Mercurial > vba-clojure
view clojure/com/aurellem/gb/text_speed.clj @ 292:c31cb3043087
Tinkering with types and encounters.
author | Dylan Holmes <ocsenave@gmail.com> |
---|---|
date | Fri, 30 Mar 2012 05:57:12 -0500 |
parents | 0587f266a735 |
children |
line wrap: on
line source
1 (ns com.aurellem.gb.text-speed2 (:use (com.aurellem.gb gb-driver util characters))3 (:import [com.aurellem.gb.gb_driver SaveState]))5 (def text-speed-address 0xD354)7 (def text-speed->code8 {:slow 699 :mid 6710 :fast 6511 :ultra 6412 })14 (def code->text-speed15 (zipmap (vals text-speed->code)16 (keys text-speed->code)))18 (defn read-text-speed19 ([^SaveState state]20 (code->text-speed (aget (memory state)21 text-speed-address)))22 ([] (read-text-speed @current-state)))24 (defn set-text-speed25 ([^SaveState state new-speed]26 (set-memory27 state28 text-speed-address29 (text-speed->code new-speed new-speed)))30 ([new-speed] (set-text-speed @current-state new-speed)))