Rom Hacking Question

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.
Bavi_H
Posts: 250
Joined: Sun Mar 03, 2013 1:52 am
Location: Texas, USA

Re: Rom Hacking Question

Post by Bavi_H »

Here is my understanding of the code.

The code loads A with a vehicle value:

  LDA $42  ; A = vehicle (1 for on foot, 2 for canoe, 4 for ship, 8 for airship)

Then if the B button is pressed it overwrites A with 8. But if the B button is not pressed, A remains the same vehicle value that was loaded above:

  BIT $20  ; Negative = joy_bits AND A_BUTTON. Overflow = joy_bits AND B_BUTTON.
  BVC skip ; If Overflow Clear (B button not pressed), skip the next instruction
  LDA #$08 ; (Else, the B button was pressed) A = 8
skip:     

Then the code does the "divide A by 2 and round up" calculatation and stores it in a variable for the move speed:

  LSR      ; \
  ADC #$00 ; |
  STA $34  ; / move_speed = (A/2) + Remainder
  RTS      ; Return

So when the B button isn't pressed, the move speeds end up as 1 for on foot, 1 for canoe, 2 for ship, and 4 for airship.
When the B button is pressed, the move speed always ends up as 4.

It seems like the reason the patch uses this kind of method where it sets A to 8, and then does the same "divide A by 2 and round up" calculation was probably because there was very little space to fit in changes to the code.
User avatar
Ben Boldt
Posts: 1513
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: Rom Hacking Question

Post by Ben Boldt »

OK I guess that makes sense. So if you are in the airship (8) and you hold B with your new code, it SLOWS DOWN?? Maybe that is cool though, it helps you make a fine adjustment where to land. :)

I am guessing all other values are glitchy, like $10,20,40,80…

OK another question. Since there aren’t random encounters when flying an airship, does the original hack prevent the random encounters when holding B?
Uncle_Jo
Posts: 10
Joined: Fri Jun 27, 2025 1:00 am

Re: Rom Hacking Question

Post by Uncle_Jo »

Ben Boldt wrote: Tue Jul 08, 2025 6:08 pm OK I guess that makes sense. So if you are in the airship (8) and you hold B with your new code, it SLOWS DOWN?? Maybe that is cool though, it helps you make a fine adjustment where to land. :)

I am guessing all other values are glitchy, like $10,20,40,80…

OK another question. Since there aren’t random encounters when flying an airship, does the original hack prevent the random encounters when holding B?
You still get random encounters, sprinting or walking.

EDIT: It slows the airship down, and does nothing for the ship. Not sure on the canoe. Encounters are all as normal as far as I can tell, pressing B or not doesn't seem to affect that.
User avatar
Ben Boldt
Posts: 1513
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: Rom Hacking Question

Post by Ben Boldt »

How about a different hack that could be used by itself or in combination with sprinting:

Hold B to disable random encounters!

It makes sense though, if you are in a hurry, you don’t want random encounters right?
Uncle_Jo
Posts: 10
Joined: Fri Jun 27, 2025 1:00 am

Re: Rom Hacking Question

Post by Uncle_Jo »

Ben Boldt wrote: Tue Jul 08, 2025 7:08 pm How about a different hack that could be used by itself or in combination with sprinting:

Hold B to disable random encounters!

It makes sense though, if you are in a hurry, you don’t want random encounters right?
You could do that, lol. It's more of a cheat though. What I've done is disable random encounters on the open grass, but keep them in the tall grass, marsh, forests, etc. I also let the boat dock anywhere. So there's a certain openness to it all. If you want to grind then go out into the forest and have at it. If you just want to get to a new town then avoid the danger terrain and you're good.
Uncle_Jo
Posts: 10
Joined: Fri Jun 27, 2025 1:00 am

Re: Rom Hacking Question

Post by Uncle_Jo »

For those interested in what the project goals are:

Phase 1: Open Expanded Updated (Nearing Completion)
-All the modern quality of life and bug fixes hackers have come up with in the last few decades.
-Vanilla quest intact, but a few more paths open due to free travel on grass, some mountain passes added, and a boat that docks anywhere.
-12 classes, with gear and spells altered to fit the new classes (like more hammers and axes for the Paladins and DethKnights, for example).
-I might alter some NPC text to be more useful.

Phase 1 is nearly ready for the testing/tweeking phase. I need to change a few more spells.

Then I'll take everything I learned doing that and apply it to...

Phase 2: Cascadia.
-Where I alter the maps to resemble my homebrew D&D campaign, Cascadia. Set in a fantasy Pacific Northwest.
-The Dwarves of Hood Mountain, the Lava Lord at Broken Top (Mt. St. Helens), Elves of the Olympic Penninsula, King of Portland, Queen of Seattle, etc.