• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Code: ASM Resource Thread

Day/Night Switching of Textbox Palettes (FireRed)

So this is one of my few successful ASM hacks. What it does is swap the palettes used by the textbox depending on whether it is day or night (based on Prime Dialga's D/N system). Some of you older users may remember such a feature being implemented by Shiny Quagsire for Pokémon Grey (iirc).

So the first thing you need to do is go to 0x471DEC and copy 0xA0 bytes there, and then paste them into freespace somewhere. Be sure to note the offset. These are the five palettes used by the textboxes. You can use this copy as the base for your new night palettes.

Next, assemble and insert the following routine into freespace, once again noting the offset. Be sure to replace the ZZZZZZ with the offset of your new night palettes.
Code:
.text
.align 2
.thumb
.thumb_func

main:
  @ get the time
  ldr r1, =(0x300553C) @ if your RTC uses a different location for the time, change this
  ldrb r1, [r1, #0x6]

  @ check the time
  @ if <= 6 AM or >= 6 PM
  @   load night palette
  @ else
  @   load day palette
  cmp r1, #0x6 @ 6 AM
  ble set_night
  cmp r1, #0x12 @ 6 PM
  bge set_night

set_day:
  ldr r1, day_palette
  b return

set_night:
  ldr r1, night_palette

return:
  @ this uses the end of the original function
  @ so there should be no problems
  add r0, r0, r1
  pop {r1}
  bx r1

.align 2

day_palette:
  .word 0x08471DEC

night_palette:
  .word 0x08ZZZZZZ @ change this to your night palette

Now finally, navigate to 0x150448 and place this (the hook):
Code:
00 49 08 47 XX XX XX 08 00 00 00 00
Where XX XX XX 08 is the pointer to the location you inserted the ASM + 1.

I know it's a bit of a silly hack, but I hope someone makes use of it! :)
Is there something like this but for the battle background?

Meaning instead of the text box the battle backgrounds looks like a night palette.
 
Updated light ball to raise Pikachu's attack:

Spoiler:
Do we know where the Light Ball's effect is stored in Emerald?
 
Checking HM Compatibility
Hey guys, I've got a fun one for you. If you're like me and hate wasting move slots on HMs, this hack will make that a thing of the past. This hack checks whether the player's team contains a Pokemon that can learn an HM you specify. It doesn't check if they actually HAVE it, only whether they CAN learn it. Used correctly, the player can simply walk up to a tree and cut it immediately if they have a Pokémon that can cut. This is for Fire Red but porting it should be simple if you know the equivalent offsets in Emerald (and I don't, if someone does, let me know and I'll update this post)

Compile and insert to free space:
Spoiler:


NOTE: Before you compile, direct your attention to the line highlighted in blue. The offset here is the offset of the table that determines TM/HM compatibility. If you have expanded the number of Pokémon in your hack, be sure to change this offset to whatever the new offset is.

Now, using this ASM is simple. In whatever script you're writing, first set variable 0x800D (aka LASTRESULT) to one of the following values based on the HM you are checking:

Spoiler:


Then, call the ASM using Callasm. After the ASM runs, variable 0x800D will be set to the party slot containing the Pokémon who can learn whatever move you checked for, or 0x6 if no Pokémon was found.

The only issue is, Fly and Flash aren't used in scripts by the game, and Dive and Waterfall can't be checked. Making items that perform the same functions using other methods, however, is a working substitute.

Here's an example script. Let's say I'm editing the cut tree script. (If you remove the badge check and attack check as I have you can actually overwrite the original script with this, as there's enough space for it)
Spoiler:


Anyways, that's that. I'll be using this in the future, but I do hope others can make use of it too.
Has anyone reimplemented this in HMA?

EDIT:
Now that we got the row bug resolved, I'm going to try to turn this into modern HMA instructions, and include details about how to get this working with each HM
 
Last edited:
Back
Top