Posts for bortreb


Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
mike89: I get the game to execute a program that reads the eight buttons (down, up, left, right, A, B , start, select) as a single byte of input and write that byte to memory. It also displays that byte to the screen. So, the numbers that appear on the screen are the programming code for the music and picture at the end, and each number is entered by pressing a certain combination of the eight keys.
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
KwyjiboPrime: but this run has a different goal than p4wn3r's video. He beats the game as fast as possible, while I reprogram the game. Spikestuff: If you have a way to verify it if it were Red or Blue, then that same technique should also work for yellow. I'm not sure how these console verifying machines work, but one problem that could come up is that there is some "give" with the physical inputs on a real gameboy. (When you press a button, it sometimes causes an electrical vibration in the memory mapped input registers, and so a single button can register multiple times.) Also, in my run I assume that you can hit each arrow of the d-pad independently. I'd love to learn more about how these console verifying machines work if you wouldn't mind sending a link or something. Thanks everyone!
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
I think that the submission system is trying to extract the rerecord count and total length from the header of the vbm file. Since I wrote my own program to output this file, that header is wrong. That's most likely what happened. Can I change the time manually somehow? The actual time of the video is 12 minutes, 50 seconds. The rerecord count doesn't really apply since it's all done with bots. It's probably in the millions by now.
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
I think that It's trying to extract the rerecord count and total length from the header of the vbm file. Since I wrote my own program to output this file, that header is wrong. That's most likely what happened. Can I change the time manually somehow?
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
I have submitted my video. It is at http://tasvideos.org/3767S.html I am not sure why it says that it takes 5 seconds..... Please let me know if I've done anything wrong, since it's my first time. Thanks!
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
Alright, I'll submit it as a Moon. When I get some more free time I'll work on making it shorter. Of course, anyone who wants is welcome to work on their own hack using this run and all the automation code I wrote as a base. Thanks everyone for all your help!
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
I'm still alive, but school has prevented me from doing any any significant work on it. I will revisit this later, but for now I don't think I have the time to work on it until school lets up. So, what do you all recommend I do? Should I submit the video as is, then batch up all the improvements I've learned about from you all in another submission sometime in the future, or should I just wait until I can get the item-buying part down by a few minutes?
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
OmnipotentEntity wrote:
The youtube video. The 9 digit is visually shifted to the right a little bit and cut off.
That's actually me being really bad at drawing nines :( Next update I'll get my friend to touch it up so it looks nicer.
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
Maybe it could be a new type of run -- get the game to execute a new kernel which allows for interactive reprogramming of arbitray RAM. Prove you did it by writing and then executing a demo program that does something interesting. Maybe the run ends when the total-control program begins running (because you wouldn't want to penalize more elaborate demo programs that take longer to input)? Or maybe the run ends on the last input, and is judged by total setup time versus coolness of the demo program? (to reward clever compression / bootstrapping of more elaborate programs) I wonder how many other games could be reprogrammed in this way?
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
Since the point of the run is to "do something cool" with total control of the game's RAM, I think that it's a valid point to decrease the bootstrapping time as much as possible since scrolling through menus is boring. (Though, I like going to the celadon PC for flavor). I think I'll spend a few weeks trying to incorporate the pokemon frame shifting trick into the run. It may be possible to shave off a few minutes.
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
OmnipotentEntity wrote:
One thing I noticed is you seem to have a off by one error when displaying the hex digit 9. But this is super duper awesome and I love it to bits.
Could you explain more about this "off by one" error? Do you see ti on the youtube video or when running the vbm file?
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
p4wn3r, that input function looks promising. I didn't use it because I didn't know about it. With that function, it should be possible to decrease the total items required to begin the bootstrapping process. I will also look into the possibility of using pokemon switching to create the necessary opcodes without items. However, the total time to switch pokemon and then switch the generated item into a "protected region" so that the next pokemon switch doesn't corrupt it may be longer than just buying the items (also, scrolling through the glitched items is slow). I bet that ultimately a combination of items and pokemon switching could shorten the item-buying time by maybe three or four minutes if everything went well. Since it might be possible to improve the run with these new methods, should I submit the run as it is now or should I spend a some more time to try to get the time down? I think that the pokemon-switching trick could take several weeks to do properly, but using pokemon yellow's input function might be doable in only a few days. How does the fact that it's an entertainment run play in here?
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
see http://hg.bortreb.com/vba-clojure/file/54644b08da1a/clojure/com/aurellem/gb and http://hg.bortreb.com/vba-clojure/file/54644b08da1a/clojure/com/aurellem/run especially rlm_assembly.clj and bootstrap_1.clj The initial bootstrap code spelled out in items is:
(defn pc-item-writer-program
  []
  (let [limit 201 ;; should be more like 92
        [target-high target-low] (disect-bytes-2 pokemon-list-start)]
    (flatten
     [[0x00  ;; (item-hack) set increment stack pointer no-op
       0x1E  ;; load limit into E
       limit
       0x3F  ;; (item-hack) set carry flag no-op

       ;; load 2 into C.
       0x0E   ;; C == 1 means input-first nybble
       0x04   ;; C == 0 means input-second nybble

       0x21 ;; load target into HL
       target-low
       target-high
       0x37 ;; (item-hack) set carry flag no-op

       0x00 ;; (item-hack) no-op
       0x37 ;; (item-hack) set carry flag no-op
       
       0x00 ;; (item-hack) no-op
       0xF3 ;; disable interrupts
       ;; Input Section

       0x3E ;; load 0x20 into A, to measure buttons
       0x10 

       0x00 ;; (item-hack) no-op
       0xE0 ;; load A into [FF00]
       0x00

       0xF0 ;; load 0xFF00 into A to get
       0x00 ;; button presses
       
       0xE6
       0x0F ;; select bottom four bits of A
       0x37 ;; (item-hack) set carry flag no-op

       0x00 ;; (item-hack) no-op
       0xB8 ;; see if input is different (CP A B)

       0x00 ;; (item-hack) (INC SP)
       0x28 ;; repeat above steps if input is not different
       ;; (jump relative backwards if B != A)
       0xED ;; (literal -19) (item-hack) -19 == egg bomb (TM37)

       0x47 ;; load A into B
       
       0x0D ;; dec C
       0x37 ;; (item-hack) set-carry flag
       ;; branch based on C:
       0x20 ;; JR NZ
       23 ;; skip "input second nybble" and "jump to target" below
       
       ;; input second nybble

       0x0C ;; inc C
       0x0C ;; inc C

       0x00 ;; (item-hack) no-op
       0xE6 ;; select bottom bits
       0x0F
       0x37 ;; (item-hack) set-carry flag no-op

       0x00 ;; (item-hack) no-op
       0xB2 ;; (OR A D) -> A

       0x22 ;; (do (A -> (HL)) (INC HL))

       0x1D ;; (DEC E)

       0x00 ;; (item-hack) 
       0x20 ;; jump back to input section if not done
       0xDA ;; literal -36 == TM 18 (counter)
       0x01 ;; (item-hack) set BC to literal (no-op)

       ;; jump to target
       0x00  ;; (item-hack) these two bytes can be anything.
       0x01 

       0x00   ;; (item-hack) no-op
       0xBF   ;; (CP A A) ensures Z
       
       0xCA   ;; (item-hack) jump if Z
       target-low
       target-high
       0x01   ;; (item-hack) will never be reached.
       
       ;; input first nybble
       0x00
       0xCB
       0x37  ;; swap nybbles on A

       0x57  ;; A -> D

       0x37  ;; (item-hack) set carry flag no-op
       0x18  ;; relative jump backwards
       0xCD  ;; literal -51 == TM05; go back to input section
       0x01  ;; (item-hack) will never reach this instruction

       ]
      (repeat 8 [0x00 0x01]);; these can be anything

      [;; jump to actual program
       0x00
       0x37  ;; (item-hack) set carry flag no-op

       0x2E  ;; 0x3A -> L
       0x3A


       0x00  ;; (item-hack) no-op
       0x26  ;; 0xD5 -> L
       0xD5  
       0x01  ;; (item-hack) set-carry BC

       0x00  ;; (item-hack) these can be anything
       0x01  

       0x00
       0xE9 ;; jump to (HL)
       ]])))
viewed as items it is
([0 30]
 [:TM01 63]
 [:awakening 4]
 [:thunderstone 98]
 [:TM09 55]
 [0 55]
 [0 243]
 [:lemonade 16]
 [0 224]
 [0 240]
 [0 230]
 [:parlyz-heal 55]
 [0 184]
 [0 40]
 [:TM37 71]
 [:ice-heal 55]
 [:fire-stone 23]
 [:burn-heal 12]
 [0 230]
 [:parlyz-heal 55]
 [0 178]
 [:water-stone 29]
 [0 32]
 [:TM18 1]
 [0 1]
 [0 191]
 [:TM02 98]
 [:TM09 1]
 [0 203]
 [:guard-spec 87]
 [:guard-spec 24]
 [:TM05 1]
 [0 1]
 [0 1]
 [0 1]
 [0 1]
 [0 1]
 [0 1]
 [0 1]
 [0 1]
 [0 55]
 [:x-accuracy 58]
 [0 38]
 [:TM13 1]
 [0 1]
 [0 233])
Items like [0 1] are glich items with id==0. I name the rival L[pk] so that I can start the program at the [0 55] item. p4wn3r, could you explain the parity manupulation hack?
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
Thanks for all the comments! I'll write up a detailed report of everything that's going on in the video and submit it to the site soon. I'll also annotate the source code with more detailed explainations and post it to my blog in html. I'm glad to be part of such an excellent community!
Post subject: Pokemon Yellow Total Control Hack
Experienced Forum User, Published Author, Former player
Joined: 9/3/2012
Posts: 40
Location: boston
Hello fellow TASers --- I wanted to share a TAS Pokemon Yellow video I've been working on for the past three months. This is my first post to this site so I wanted to get some feedback before posting it as an actual run. This is not a speedrun but an entertainment run which shows off an intricite glitch I've constructed. I was inspired by http://tasvideos.org/2913S.html which basically turns the in-game item list into a hex editor. I wanted to see how far I could take that concept. In this run I use items to spell out a program in the gameboy's machine language. After multiple stages of bootstrapping I create a program that allows me to completely rewrite Pokemon Yellow's RAM. I use this ability to insert my own image and song into the game. As far as I know no other hack can completely reprogram a game from within. I created an encoded video of the run at youtube and at aurellem.org, http://www.youtube.com/watch?v=p5T81yHkHtI Link to video http://aurellem.org/pokemon-hack/rlm-yellow-hack.avi Here is the vbm file. It should work with the latest version of VisualBoyAdvance. http://aurellem.org/pokemon-hack/rlm-yellow-hack.vbm And finally, the entire source code for the project: http://hg.bortreb.com/vba-clojure You can browse the link or get the project with 'hg clone' * Technical Details To make this run, I took the source for VisualBoyAdvance and added JNI bindings so that I could drive the emulator from Java and then through clojure, a dialect of LISP which runs on the JVM. The entire run was constructed from clojure statements which search the pokemon game tree to find the most efficient ways to accomplish high level goals. For example, a section of the run which buys items at the celadon store is expressed as:
(defn-memo go-to-floor-two
  ([] (go-to-floor-two (to-celadon)))
  ([script]
     (->> script
          (walk [→ → ↑
                 ↑ ↑ ↑ ↑
                 ← ← ← ←
                 ↑ ↑ 
                 ← ← ← ← 
                 ↓ ↓ ↓
                 ← ←])
          (first-difference [] ↑ AF))))

(defn-memo floor-two-TMs
  ([] (floor-two-TMs (get-money-floor-two)))
  ([script]
     (->> script
          (set-cursor 0)
          (select-menu-entry)
          (buy-item 2 98)  ;; TM02 (razor-wind)
          (buy-item 4 71)  ;; TM37 (doubleteam)
          (buy-item 5 63)  ;; TM01 (mega-punch)
          (buy-item 6 1)   ;; TM05 (mega-kick)
          (buy-item 7 56)  ;; TM09 (take-down)
          (close-menu))))
Let me know what you think! --Robert McIntyre