Mercurial > vba-clojure
comparison clojure/com/aurellem/run/bootstrap_0.clj @ 303:5bcda2d6d135
item manipulation program works!
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 31 Mar 2012 00:33:35 -0500 |
parents | 0b3e89103dc2 |
children | fefe5ce49b21 |
comparison
equal
deleted
inserted
replaced
302:0b3e89103dc2 | 303:5bcda2d6d135 |
---|---|
782 | 782 |
783 | 783 |
784 (do-nothing 1)))) | 784 (do-nothing 1)))) |
785 | 785 |
786 | 786 |
787 ("d572" "d573" "d574" "d575" "d576" "d577" "d58b" "d58e" "d58f" "ff80" "ff82" "ff84" "ff86" "ff87" "ff89") | |
788 | |
787 | 789 |
788 (defn test-pc-item-program [] | 790 (defn test-pc-item-program [] |
789 (-> (read-state "bootstrap-init") | 791 (-> (read-state "bootstrap-init") |
790 (set-memory pc-item-list-start 50) | 792 (set-memory pc-item-list-start 50) |
791 (set-memory-range | 793 (set-memory-range |
792 | 794 |
793 (inc pc-item-list-start) | 795 (inc pc-item-list-start) |
794 (flatten | 796 (flatten |
795 [ | 797 [ |
796 (repeat | 798 (repeat |
797 25 | 799 28 |
798 [0xFF 0x01]) | 800 [0xFF 0x01]) |
799 [0x00 ;; second part of item manipulation program | 801 [;; second part of item manipulation program |
800 0x2A | 802 0x00 ;; this starts at address 0xD56C |
801 | 803 0x2A ;; save (HL)=(target) to A, increment HL |
804 | |
802 0x00 | 805 0x00 |
803 0x47 | 806 0x47 ;; save A to B |
804 | 807 |
805 0x00 | 808 0x00 |
806 0x3A | 809 0x3A ;; save (target+1) to A, decrement HL |
807 | 810 |
808 0x00 | 811 0x00 |
809 0x22 | 812 0x22 ;; A -> target, increment HL [(target+1) -> target] |
810 | 813 |
811 0x00 | 814 0x00 |
812 0X70 | 815 0x70 ;; load B into target+1 [(target) -> target+1] |
813 | 816 |
814 0x00 | 817 0x00 |
815 0xC3 | 818 0xC3 ;; first part of absolute jump |
816 | 819 |
817 0x0C | 820 0x0C ;; return control to pokemon kernel |
818 0x5F] | 821 0x5F] |
819 (repeat | 822 (repeat |
820 8 | 823 5 |
821 [0xFF 0x01]) | 824 [0xFF 0x01]) |
822 | 825 |
823 [0x00 | 826 [;; first part of item manipulation program |
824 0x21 | 827 0x00 |
825 | 828 0x21 ;; load target into HL |
826 0x93 | 829 |
830 0x94 ;; this is the target address | |
827 0xD5 | 831 0xD5 |
828 | 832 |
829 0x00 | 833 0x00 ;; relative jump back to first part |
830 0x18 | 834 0x18 |
831 | 835 |
832 0xE1 | 836 0xE1 ;; of program |
833 0x01 | 837 0x01 |
834 | 838 |
835 0xFF | 839 0xFF ;; spacer |
836 0x01 | 840 0x01 |
837 | 841 |
838 0x04 ;; target ID | 842 0x04 ;; target ID (pokeball) |
839 0x3E ;; target Quantity | 843 0x3E ;; target Quantity (lemonade) |
840 ]])))) | 844 ]])))) |