With the accidental discovery of the negative menu glitch during an RTA attempt, the seemingly solid code of Phantasy Star IV was slowly picked away at until we arrived at the current any% run. Using these discoveries as a foundation, this TAS beats the game in just over twenty minutes.

Glitches:

- Negative Menus: If you press B 17 frames after an A or C input in the message/battle speed menus it goes into negative menus, as the game counts it as closed, but then closes it again. What happens afterwards is determined by a number of variables, such as: Tile it was performed on, which character is in the lead, whether or not a battle has been initiated before the glitch is performed, etc. There are tons of things that affect it, but also exceptions to the rules too. If used in succession it will almost certainly softlock the game. This is used one time in the TAS in order to stop the game from crashing.
- Macro Glitch: Very similar to the negative menus, except it is done via the macro menu, specifically from the skills page. However, being that it originates from the actual player menu there are many practical applications for it. For this to be initiated, the glitch must be performed 3 times in succession, each with a different frame to press B on (12,10,13 respectively).
- Walk Through Objects (aka. Gryz skip): After executing the macro glitch, provided you've met the right conditions, you can press B and return to the menu. If you press B the correct amount of times at the menu, then select a character who has Ryuka/a Telepipe and use it, the sound will play and a blank window will pop up immediately freeing you up for movement. After this has taken place, you can walk through objects such as chests or npcs. This is used in Molcum in order to skip going to Zema.
- Save Warping: Once you've initiated the walk through objects glitch, the reason you can walk through stuff is because the game is confused and thinks you're on the world map. Specifically, it swaps your co-ordinates on the map you're on, with those on the world map. If you save, or if a cutscene completes, it will put you on the coordinates you saved on but you will be on the world map. This allows us to skip doing the Bioplant plot, thereby skipping getting Rika. It is also used to skip the cave between Aiedo and Kadary.
- Glitched Macro Abilities: After doing the Macro Glitch, you can choose the tech window and it will store it in memory. If you perform the Macro Glitch a second time, but press B after, it will bring up a list of "techniques" which are based on the skills of the last person who was used in the Macro Glitch. Alys' Vortex skill allows us to access Nawat, an end game technique. In order to leave the negative menus that happen once its performed, you simply have to have 3 tabs of items, and scroll right in a separate macro. This will fix the negative menus. While this glitched macro is of paramount importance in an RTA run, due to luck manipulation in the TAS the actual spell itself is used only once. It has a far more important use later on.
- Character 255: Because we skip Rika, the game is extremely confused after the Demi cutscene. I'm not exactly sure why the game adds Character 255 to the party afterwards, but I believe it has something to do with the expectation that you would have three party members when you in fact have only two. This puts Demi behind 255, making it so she cannot be used in combat. Most importantly, it corrupts all macros made before 255 joins the party. 255's name will crash the game unless specific dialogues are opened before the menu is. This can be bypassed by having no text be shown in the menu (by using the Negative Menus).
- Byte Shift: This is the biggest discovery out of all the glitches, and by far the least understood. When using the corrupted macros given to you after 255 joins the party and you have at least five party members, it will initiate a byte shift in the SRAM IF CONDITIONS ARE CORRECT. The conditions that must be met for this particular set up are: Chaz must be level 4 and in the front of the party, the fight has to be on the beach background of Motavia, the characters behind 255 must be Demi and Rune and the macro used must be one that has been used for glitched abilities and have a macro below it that has Gryz using an item above Chaz's attack. The one used in this TAS shifts all bytes by 8. More details on this specific set up are in the route. The biggest improvements I can see in the future for this run would be from a better understanding of this glitch, and how to manipulate it.

Route:

- Piata: Same as normal for the most part. Igglanova is skipped using the Earth stun + running away. The 100 meseta chest is picked up for the byte shift later, as well as for much needed funds.
- Molcum & Krup: A departure from the norm here, we skip going to Zema and instead head to Molcum (for the telepipe warp) and then to Krup. In Krup we buy 3 telepipes and 1 escapipe before exiting and unequipping some items. These are extremely important for the byte shift and the order must be consistent. We exit the shopping menu prematurely because doing so stops us from having to do a save and load before using the walk through objects glitch in Molcum. The next two items we buy are a telepipe and an escapipe, these are also important for the byte shift. The rest of the items bought are for after the byte shift occurs, and to fill up the inventory for the glitched ability later.
Once the shopping is done, telepipe to Molcum, and the walk through objects glitch is performed using the telepipe in the first slot. This is a bit faster than normal because it goes straight to the item for whatever reason, and only one B input is needed in order to get the correct negative menu value for the glitch to occur. Once Rune joins the party, you'll see after the cutscene that the characters are now in the middle of the ocean due to the previous glitch. A quick Ryuka back to Molcum, and we perform a save warp, getting us to Aiedo.
- Kadary & Tonoe: Another save warp in Aiedo puts us right next to Kadary. We need an encounter in order to get Chaz up to level 4 for the shadowblade underflow. There are 10 safe steps upon an area transition that cannot have encounters so multiple steps are needed. A fight with two Speard and one Tech User is manipulated. One character has to die, hopefully Hahn, to get the exp required for Chaz. Unfortunately Alys has to take the heat here as every manipulation to have Hahn die to the Speard cost many more frames than this one did, either later on or in the fight itself. Once this is done, we head into Kadary to rest up and recover Chaz's TP as well as add it to the Ryuka list. In order for the game to proceed after Demi joins, Rune cannot be in the party. So we dump him off in Tonoe and get Gryz.
- Zio's Fort: Very good manipulation on the fight to get the Shadowblade, probably the best of all the fights. Once upstairs we create the macros for the byte shift and for the fight, as well as equip Chaz with the Shadowblade (and unequipping his armor to add items to the inventory to escape the negative menus). Juza is manipulated pretty well here, got all the Tsus' average damage to above 467 in order for him to be finished off by Gryz's Nawat. Its important for Chaz to die here, as we cant have him getting more XP.
- Krup Reloaded & Ladea Tower: The spot saved at is important for the byte shift. Saving and loading is required for escapipe usage in Ladea Tower. Walking out is also required over using a telepipe as we dont have an extra telepipe, and if we did it wouldn't be faster because we'd have to save and load again anyways. Encounter manipulation is pretty noticeable in the Land Rover (can you hear the spots it takes place?). Ladea is pretty simple, but there are a lot of delayed frames due to the high encounter rate. Once Rune "joins" we go to the spot in the corner as it is the only spot that will not crash the game if you enter negative menus. Using it here allows us to enter the menu without displaying names (which will hardlock the game), and escapipe out. This would not have worked if we didn't save and load.
- Byte Shift: The moment of truth. An encounter with a Fanbite is manipulated by the sea, their single target attack is extremely fast and allows for a quick shift. Heres a quick breakdown of what important stuff happens:
  1. Items 3-7 are shifted into our party, this means we have Alys (Dagger), 2x Hahn (Hunt Knife), Seth (Leather Shield) and Telepipe(!).
  2. Event flags are shifted backwards, things we did earlier on will have a big effect on the rest of the run.
  3. Ryuka data is corrupted, it now has our saved y position as the index we go to. For those interested, it is now Dezolis.
Seeing as the event flags have shifted, we are sent back to Piata as if we had never completed the Igglanova event.
- Piata 2: There are 2 reasons the item order was important. We need a combination of 3 characters in the front of the party consisting of either Chaz, Hahn or Alys in order for the Igglanova cutscene to not freeze and Alys' C dialogue will stop Telepipe from locking the game when the menu opens. Telepipe has a unique ability. He will destroy an object in the room he enters ala Rune's Flaeli in the cutscene. In the first room of Piata Academy you can see him Thanos one of the NPCs. However, its more important for the run in that he also gets rid of the object that prevents you from passing Hahn in order to reach the basement, which skips a ton of dialogue. Igglanova is the same as before, with easier manipulation because Seth's Mindblast is way better than Chaz's Earth. Alys C dialogue is called up in order to use an escapipe. Dialogue with the Principal again, and his dialogue afterwards is used to stop the menu from locking. Its fastest for whatever reason to get rid of Telepipe here, so thats done, and we use a telepipe to go to "PIATA" aka Dezolis. (as a side note, its required to do this stuff again because we cannot reach The Edge otherwise. The game checks every frame you're on Motavia's overworld to see if its complete and if its not it will throw you back to Piata.)
- Dezolis: We need to open up the Spaceport in order to get back to The Edge. Quick walk/ride through the motions and its done. However, the byte shift strikes again here. If you remember the 100 Meseta chest we opened at the start, the event flag for it being open shifts to the "reunion" cutscene just after obtaining the Elysdeon. This plays through and opens the edge. Its also important to note that we have to get rid of Telepipe for this cutscene, as he destroys Raja and stops the game from continuing. Well worth the watch. (Another note, we can trigger the edge to be open by grabbing the antidote in Piata basement as well. However, it changes the Principal's dialogue and makes it so the Igglanova event is unable to be completed, keeping you trapped in Piata forever)
- The Edge: This is the only dungeon where frames were saved in the walk after I redid RNG manipulation. A whole one frame. We make our way down to The Profound Darkness and... we complete the game. Without fighting the boss. This is due to the byte shift, of course. A chest which is open by default in the Bioplant (thus always being triggered) shifts into the "Profound Darkness" byte setting it to her being defeated.

Possible Improvements:

RNG Manipulation. I'm still a bit of a novice at this, and while I did my best there are certainly spots where things could potentially be faster. Getting a good Hahn death near Kadary would save about 7 frames. If its actually possible to get 4 Speard on the overworld, that would potentially save 1 second. These among other things.
Byte Shift: There is a lot left to discover with this. There are so many variables in its execution and each with different results. I once called up the Seth transformation cutscene (which crashed afterwards), which leads me to think there might be a credit warp somewhere. I was never able to reproduce this effect though.
- Thanks to Veo and Mor_mot for all their work on figuring out the routing for the byte shift stuff. Thanks to Lory for his disassembly which was a big help ([dead link removed]). Also thanks to Janus, his TAS was what got me to do a no backtrack Gryz byte shift. Big thanks to the Phantasy Star RTA community as well, wouldn't have done this without you guys.

ThunderAxe31: Judging.
ThunderAxe31: From what I could gather, this run is well made, as of the current game knowledge and techniques.
It's also very entertaining to watch. Even people not familiar with the game would be able to notice that something weird is going on during the movie, in particular the repetition of the Igglanova event and the complete lack of the final boss battle. Lastly, I note that the audience reception was completely positive.
Accepting for Moons as a new branch.
feos: Pub.
feos: Finally changing the branch. See my post.


TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15577
Location: 127.0.0.1
This topic is for the purpose of discussing #6159: Jiseed's Genesis Phantasy Star IV "macro glitch" in 20:33.04
BigBoct
He/Him
Editor, Former player
Joined: 8/9/2007
Posts: 1692
Location: Tiffin/Republic, OH
That was completely ridiculous. Yes vote.
Previous Name: boct1584
Experienced player (690)
Joined: 2/5/2012
Posts: 1795
Location: Brasil
never played it, but it looked good lol
I want all good TAS inside TASvideos, it's my motto. TAS i'm interested: Megaman series, specially the RPGs! Where is the mmbn1 all chips TAS we deserve? Where is the Command Mission TAS? i'm slowly moving away from TASing fighting games for speed, maybe it's time to start finding some entertainment value in TASing.
Jungon
He/Him
Player (50)
Joined: 4/2/2009
Posts: 376
Location: Porto Alegre - Brazil
Alys in revisiting Piata and the events there, should be like: "Zio? Oh yeah I heard about him. I actually talked with him some seconds ago. Chaz was being a slow ass, so I had to shield him, and then I died. Yeah right, happens every time, I'm used to it by now.. well, we have to teleport do Dezolis now, excuse us" I laughed a lot thinking about this while watching... xP And Yes vote, of course =D
*Jungon*/*Johnnyz* smilie weirdo =P ^^ o.o @__@ +D
Player (177)
Joined: 8/14/2014
Posts: 22
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3821)
Joined: 11/30/2014
Posts: 2829
Location: US
That's crazy. If anyone throws a trace logger at this to figure out exactly what's going on, I would be very interested to see exactly what convoluted series of events leads to this byte shift. Yes vote.
Joined: 5/14/2007
Posts: 525
Location: Pisces-Cetus filament
Alyosha wrote:
If anyone throws a trace logger at this to figure out exactly what's going on, I would be very interested to see exactly what convoluted series of events leads to this byte shift. Yes vote.
Maybe ruadath? I wonder if they would be denied co-autorship again were they to improve this run with new ideas.
AzumaK wrote: I swear my 1 year old daughter's favorite TASVideo is your R4MI run :3 xxNKxx wrote: ok thanks handsome feos :D Help improving TASVideos!
Player (177)
Joined: 8/14/2014
Posts: 22
Zeupar wrote:
Maybe ruadath? I wonder if they would be denied co-autorship again were they to improve this run with new ideas.
I'm glad we agree on this! I think Ruadath's input would be invaluable, considering all the work hes done on the SaGa TAS for instance. While this isn't exactly the place to discuss my previous submission, I cant imagine you're alone in your thoughts. The fact of the matter is co-authorship as a courtesy was indeed offered but subsequently not accepted or even acknowledged. Despite this he is still thanked in the submission text among the greats of Phantasy Star 2 routing for his fresh new ideas and routing help for the TAS. Now that thats said, keep it to this submission please.
Joined: 2/20/2010
Posts: 209
Location: I'm in space
I played through Phantasy Star IV several times growing up, especially when out of school sick. Watching it obliterated in 20 minutes was surreal and wonderful. ALYS DOESN'T DIE!!! SO awesome to see her wandering around with the others in The Edge. Incredible job, pleasure to watch! Easy yes vote.
Oh, play it cool. Play it cool. Here come the space cops.
Memory
She/Her
Site Admin, Skilled player (1556)
Joined: 3/20/2014
Posts: 1765
Location: Dumpster
Question was this accepted as a new branch or as an improvement to the existing branch. Personally I lean towards the former but I'd like to see this clarified.
[16:36:31] <Mothrayas> I have to say this argument about robot drug usage is a lot more fun than whatever else we have been doing in the past two+ hours
[16:08:10] <BenLubar> a TAS is just the limit of a segmented speedrun as the segment length approaches zero
Editor, Reviewer, Skilled player (1358)
Joined: 9/12/2016
Posts: 1646
Location: Italy
Memory wrote:
Question was this accepted as a new branch or as an improvement to the existing branch. Personally I lean towards the former but I'd like to see this clarified.
Legit question. Even though there aren't many ratings for the current publication, I decided to accept this submission as a new branch, since I think that the game is enough popular. I did edit my judgment note in order to make it clearer. In any case, I have to note that the obsoletion chain can be changed anytime if new ratings on the current publication will prove me wrong.
my personal page - my YouTube channel - my GitHub - my Discord: thunderaxe31 <Masterjun> if you look at the "NES" in a weird angle, it actually clearly says "GBA"
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Which glitches listed in the first section are unique to this movie, not present in our existing TASes of this game?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Player (177)
Joined: 8/14/2014
Posts: 22
feos wrote:
Which glitches listed in the first section are unique to this movie, not present in our existing TASes of this game?
As far as I can tell, everything in the glitches section is new when looking at the other TASes. The only glitch that it shares is the Shadowblade MTL underflow for the Juza boss fight. On a personal note I'm in favor of this being a new branch as Janus' TAS, while a bit dated now, is a fantastic work of RNG manipulation. The small amounts I had to do while making this movie really showed me that, and I think it deserves to stick around.
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Is this the "byte shift" glitch? I see memory corruption and then you save the game, reset, and continue. It looks like you're loading the corrupted save data and that's the main feature of the movie. Is that correct, or you might as well not save/load there and just keep playing, getting the same speedrun benefits?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Player (177)
Joined: 8/14/2014
Posts: 22
feos wrote:
Is this the "byte shift" glitch? I see memory corruption and then you save the game, reset, and continue. It looks like you're loading the corrupted save data and that's the main feature of the movie. Is that correct, or you might as well not save/load there and just keep playing, getting the same speedrun benefits?
No, the byte shift takes place in the battle with the Fanbite after Ladea Tower. What happens here is a product of the macro glitch used to do the save warp, more specifically the tile that it was done on. If we moved down and to the left a little bit it would look a lot cleaner with similar results (just farther away from Kadary upon loading). Old RTA runs did skip doing this save warp and the game was completed in the same way, so it has little effect on gameplay aside from skipping the "slug cave".
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
We've been reading the trace logs and the disasm, it seems the key glitch is macro glitch. You spawn the broken char and he corrupts the macros, so then you try to use those macros and due to having more chars than possible (6?), the lookup overflows, reading arbitrary data (0x27) as "battle object ID". It then tries to resolve it to some char data and overflows once again, ending up with 0x158 characters it thinks you have. And when setting them up, it finally does the "byte shift", which is not byte shift at all.
Language: asm

005694: 23B1 move.l (A1,D3.w,4), (A1,D3.w) ; swap next fighter with current 00569A: 5843 addq.w #4, D3 ; do the same for next pair 00569C: 51CA dbra D2, $5694 ; decrement D2 and jump back to 005694 unless D2 is $FFFF
Before that, the starting address (Battle_Turn_Order) of the area to be corrupted is loaded:
Language: asm

00568A: 43F8 lea $FFFFEFB0.w, A1
And so, corruption loops up to address $FFEFB0 + $55C + 4 = $FFF510. Then some more, but you get the idea. It's not a byte-wise shift. It copies over 4-byte chunks that 68K calls longs, and the offset is also 4 bytes. Now, should we call the glitch and this branch "long shift"? I don't think it tells anything helpful to the viewer either. I prefer "macro glitch". This seems to be the most important "feature" of the broken char. Does anyone want it to be something else?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Player (98)
Joined: 12/12/2013
Posts: 378
Location: Russia
According to info that feos provided, you do macro #2 (index from 1), and when it comes to command #3 (index from 1) it tries to find character with some kind of id = 6 in Obj_Fighters. It is table starting at address 0xFFFFF500. It's scanning it by steps of 0x40 and looking at offset 0x12 for value 7, "because character ID in battle is actual ID + 1". Code offset is 0x5630. Next, it can't find character with id 7 so it keeps stepping by 0x40, eventually overflowing address register and it turns into zero. So it warps around, and continue search in ROM, because addresses starting from 0 is ROM. Eventually it finds some offset with value of 7 at offset 0x12, and reads its 0x0 offset because it should be "battle obj ID". It happens to be 0x27. Next, macro action also pick "other character". Now, the game wants to find out their order in Battle_Turn_Order. So it tries to find 0x27 in Battle_Turn_Order, but there is no such character, and it continues searching, until it eventually find 0x27 somewhere outside of the list, at index 0x158. Max index is around 20 though. I'll call this 0x27 as "bugged". Next, because "other picked character" is earlier in the list than "bugged" one (index 1 vs index 0x158), it wants to move it right after bugged like this: imagine current order is: 1234567 and "other" is 3, and "bugged" is 6, then it wants to make following: 1245637 So it moves everything between them one position to the left, and moving "other picked" right after "bugged". But each entry of this order is 4 bytes, and our "bugged character" is found at index 0x158, so it's shifting all that memory by 4 bytes to lower address. And this range contains some of values that are stored into SRAM when you ask to save. Also there are some game flags, world index, and etc. If "other picked" would later than "bugged" it would not shift anything. In short: bugged macro while searching bugged char finds bugged id, and then when bugged id is scanned in Battle_Turn_Order it finds bugged index, and then shifts everything in between by 4 bytes, and moves first 4 bytes to end of this shifted bytes.
Player (177)
Joined: 8/14/2014
Posts: 22
I'll be honest, I really have no idea how it works, even with the explanations given. I merely found the glitch, I had little to do with figuring out its manipulation and results. As far as renaming it I'm perfectly fine with that if "byte shift" is inconsistent with what you guys have discovered.
Post subject: Movie published
TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15577
Location: 127.0.0.1
This movie has been published. The posts before this message apply to the submission, and posts after this message apply to the published movie. ---- [3863] Genesis Phantasy Star IV "macro glitch" by Jiseed in 20:33.04
Zucca
He/Him
Joined: 8/22/2008
Posts: 118
Location: KUUSANKOSKI, Finland
One of my favourite games totally broken! You get my vote for sure!
trazz wrote:
Killing the skeletons sooner or letting the skeletons live (unlive?) won't affect that at all.