• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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

Delta231

A noob
681
Posts
7
Years
  • Side Quest Menu [FR]

    This hack converts the PC item storage menu into a side quest menu, or task list, etc.

    Here is the repository, the compilation instructions are included in the readme. You will need to define your own parameters/ram in src/headers/defs.asm and create your own tables of string pointers for all of the quest names, descriptions, item images, and quest details. I kept the item image part to allow hackers to include items that might be symbolic of their quest, eg. a scroll or key or pokeball.

    To use in a script (XSE)
    Code:
    writebytetooffset 0x1 <your questflag ram in src/headers/defs.asm>
    fadescreen 0x1
    callasm 0x80EBCD9
    waitstate

    Here is a slightly outdated example GIF (it is just missing the item images in the box), but it gets the point across.

    Enjoy! And please let me know of any bugs.

    Nice work but you may wanna remove .exe and dll files as not everyone uses Windows.
     

    Squeetz

    ROM Hacker
    191
    Posts
    10
    Years
  • [FR] Multi-directional jump tiles
    This is an expanded-upon version of Invert's routine on the Wahack forums (https://wahackforo.com/t-40642/fr-asm-salto-en-cualquier-direccion) So credit goes to them for the original.
    Made this for the purpose of creating a multiple-height jumping puzzle which was something Invert's routine was lacking, so thought I might as well share it.

    Code:
    .thumb
    
    .global AnyDirectionJumptile
    .equ rom, 0x08000001
    .equ offset, 0xXXXXXX
    
    /*
    Behavior bytes:
    0x7F = able to jump in any direction over tile (only on height 0x0 & 0x10)
    0x7E = able to jump up and down over tile
    0x7D = able to jump left and right over tile
    */
    
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    hooks:
    .org 0x59AF6
    	cmp r0, #0x7D
    	beq 0x59B02
    
    .org 0x59B0A
    	cmp r0, #0x7D
    	beq 0x59B16
    
    .org 0x59B1E
    	cmp r0, #0x7E
    	beq 0x59B2A
    
    .org 0x59B32
    	cmp r0, #0x7E
    	beq 0x59B3E
    
    .org 0x6812C
    	bx r2
    	
    .org 0x68144
    	.word main + rom
    
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    	
    .org offset
    main:
    	cmp r0, #0x7F	@behavior byte
    	beq CheckJump
    	ldr r2, =(0x083A705C)
    	lsl r1, r4, #0x2
    	ldr r3, =(0x0806812E|1)
    	bx r3
    	
    CheckJump:
    	bl CanPlayerJump
    	cmp r0, #0x0
    	beq CantJump
    CanJump:
    	ldr r0, =(0x08068148|1)
    	bx r0
    	
    CantJump:
    	ldr r0, =(0x0806813E|1)
    	bx r0
    	
    CanPlayerJump:
    	ldr r1, npc_states
    	ldrb r0, [r1, #0xB]		@player height
    	mov r1, #0xF
    	and r0, r1			@lower 4 bits are height
    	cmp r0, #0x4			@movement permission 0x10
    	beq TheyCan
    	cmp r0, #0x0			@movement permission 0x0
    	beq TheyCan
    TheyCant:
    	mov r0, #0x0
    	bx lr
    	
    TheyCan:
    	mov r0, #0x1
    	bx lr
    	
    .align 2
    	npc_states:		.word 0x02036E38
     
    88
    Posts
    7
    Years
    • Seen Jan 16, 2020
    Evolution Moves [FR]

    Adds the feature of learning moves when you evolve, regardless of the level. Currently, only compatable if you have expanded your moves above 511 (jambo learnsets). May make it compatable with old learnsets if there is a desire.

    Here is the repository. Update config.ini with your learnset table location and a free ram address byte (does not need to be in the save block hack. Example free space starts at 0203e000 if you've removed the help system, I believe)

    I've only done prelimenary testing, so there may be bugs.
     
    222
    Posts
    6
    Years
    • Seen Nov 18, 2023
    Side Quest Menu [FR]

    This hack converts the PC item storage menu into a side quest menu, or task list, etc.

    Here is the repository, the compilation instructions are included in the readme. You will need to define your own parameters/ram in src/headers/defs.asm and create your own tables of string pointers for all of the quest names, descriptions, item images, and quest details. I kept the item image part to allow hackers to include items that might be symbolic of their quest, eg. a scroll or key or pokeball.

    To use in a script (XSE)
    Code:
    writebytetooffset 0x1 <your questflag ram in src/headers/defs.asm>
    fadescreen 0x1
    callasm 0x80EBCD9
    waitstate

    Here is a slightly outdated example GIF (it is just missing the item images in the box), but it gets the point across.

    Enjoy! And please let me know of any bugs.

    Hello,

    I'm having a hard time understanding an aspect of your system, mainly the flags. So if you have 256 quests (the max, still kinda a small number), does that mean you need 512 flags? Consecutive flags, at that? So quest #1 would be flag 0x200, and that would go all the 0x2FF, leaving me with literally no other safe flags for the entire game, or to complete the other 256 flags eaten by the routine? Looks like I might have to dabble in expanding safe flags, unless I'm missing something obvious here.

    Edit: Couldn't I just set the "flag" offsets to some unused RAM? Probably not, since it wouldn't be covered by the save block. And how do I convert the flag number to a RAM location?

    Thanks, hjk321

    Nice routine though!
     
    Last edited:
    88
    Posts
    7
    Years
    • Seen Jan 16, 2020
    Hello,

    I'm having a hard time understanding an aspect of your system, mainly the flags. So if you have 256 quests (the max, still kinda a small number), does that mean you need 512 flags? Consecutive flags, at that? So quest #1 would be flag 0x200, and that would go all the 0x2FF, leaving me with literally no other safe flags for the entire game, or to complete the other 256 flags eaten by the routine? Looks like I might have to dabble in expanding safe flags, unless I'm missing something obvious here.

    Edit: Couldn't I just set the "flag" offsets to some unused RAM? Probably not, since it wouldn't be covered by the save block. And how do I convert the flag number to a RAM location?

    Thanks, hjk321

    Nice routine though!

    I kept the instructions somewhat vague to allow different users to utilize the system the way they like, though you're right that I could have been a bit more verbose.

    The system is set up so that you will need two flags for each quest: one to 'activate' the quest, which just means you have unlocked it and the quest name will show up in the menu and you can activate it and whatnot. The second will indicate that the quest is completed, in which case the 'Done' text will appear next to the quest name.

    It is currently written so that the activation flags (to show the quest names) are in order, and the completion flags are also in order, but can start from a different initial flag. This was done to prevent the use of two separate tables, but can easily be changed.

    256 quests seems like a pretty high number of quests for a rom hack though. And that is not necessarily the limit, the active quest ram can easily be expanded to a halfword value.

    I would recommend expanding the safe number of flags with JPANs save block hack; this way you can unlock thousands more safe flags and this system won't be as limiting.

    I'm not entirely sure why you would want to use RAM instead of flags; that would end up just taking up much more space unless you edit the routine to check for specific bits in the ram, which is then the same functionality as a flag.

    I hope this helps.
     
    222
    Posts
    6
    Years
    • Seen Nov 18, 2023
    It is currently written so that the activation flags (to show the quest names) are in order, and the completion flags are also in order, but can start from a different initial flag. This was done to prevent the use of two separate tables, but can easily be changed.
    I hope this helps.

    Literally everything about your routine is great... except every quest is ???????? whether the flags are set or not! in the defs file I've tried RAM pointers (0x0203C001) I've tried repointed flag numbers (0x909) and I've tried raw flag numbers (0x2109) and no matter what the quests do not show up!

    As an experiment I have 15 quests and I set some flags At the index. Index starts at 0203C001, have also tried 0x909 and 0x2109 in defs.asm. Here is proof I have flags set in that area...
    HHxEbja.png

    and yet all 15 quests are unshowable. What am I doing wrong?

    I only made minor edits to some text variables, as well as linking to external tables rather than making a table in the actual asm. I didn't edit anything significant.
     
    Last edited:
    88
    Posts
    7
    Years
    • Seen Jan 16, 2020
    Literally everything about your routine is great... except every quest is ???????? whether the flags are set or not! in the defs file I've tried RAM pointers (0x0203C001) I've tried repointed flag numbers (0x909) and I've tried raw flag numbers (0x2109) and no matter what the quests do not show up!

    As an experiment I have 15 quests and I set some flags At the index. Index starts at 0203C001, have also tried 0x909 and 0x2109 in defs.asm. Here is proof I have flags set in that area...
    HHxEbja.png

    and yet all 15 quests are unshowable. What am I doing wrong?

    I only made minor edits to some text variables, as well as linking to external tables rather than making a table in the actual asm. I didn't edit anything significant.

    Can you share your code so I can better understand what you are trying to do? Let's do this via discord or personal message to keep this thread clean. :)
     
    1
    Posts
    15
    Years
    • Seen Oct 14, 2018
    Hi ASMaties! I'm new to hacking and I'm not sure how to go about this? would it be okay if I requested some help modifying the way EV-increasing items (HP Up, Protein, Iron, etc.) work in Emerald?

    The default behaviour adds +10 EVs, but it has no effect when the EV is >=100. I want to remove that restriction so you can keep using EV items and max out an EV at 252, allowing players to EV train quickly and painlessly.

    Any help would be much appreciated!
     
    Last edited:
    239
    Posts
    8
    Years
    • Seen Apr 15, 2024
    Evolution Moves [FR]

    I found a bug in this code where a pokemon learning a move from any other way would be asked to learn moves it already knows and will be asked to learn a move even when their movesets are not full.

    I rewrote the moveset loop by just calling a custom function rather than editing the main learn_move function at 0803ea88, and it appears to work fine.

    Spoiler:


    If you implemented the original routines, be sure to replace the bytes at 3eaa4.
     

    Skeli

    Lord of the Rings
    300
    Posts
    10
    Years
  • Only Buy 1 TM From Shops [FR]

    If you've decided to make your TMs reusable in Fire Red, this routine will remove the option to buy more than one of each from shops. Credits to azurile13 for the first part (Main) of the code.The only thing that needs changing is the line ".equ offset".
    Code:
    .thumb
    .global AlreadyOwnTM
    
    .equ rom, 0x8000000
    .equ offset, 0x893960 @CHANGE THIS LINE
    
    .org 0x9BC3C, 0xFF
    	ldr r1, .Pointer1
    	bx r1
    .Pointer1: .word Main + rom + 1
    
    .org 0x9BC7C, 0xFF
    	ldr r0, .Pointer2
    	bx r0
    .Pointer2: .word OnlyBuyOne + rom + 1
    
    .org 0x9BEBC, 0xFF
    	ldr r1, .Pointer3
    	bx r1
    .Pointer3: .word AddItem + rom + 1
    
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    
    .org offset, 0xFF
    Main:
    	lsr r4, r0, #0x10
    	mov r0, r4
    	ldr r2, .GetItemPocket
    	bl Jump
    	cmp r0, #0x4
    	bne Return
    	mov r0, r4
    	mov r1, #0x1
    	ldr r2, .CheckItem
    	bl Jump
    	cmp r0, #0x0
    	bne AlreadyOwn
    
    Return:
    	mov r0, r4
    	ldr r1, =0x809BC45
    	bx r1
    
    AlreadyOwn:
    	ldr r1, .AlreadyHaveTMString
    	ldr r2, =0x809BC67
    	bx r2
    
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    
    OnlyBuyOne:
    	ldr r1, .FCodeBuffer2
    	mov r0, r4
    	ldr r2, .ItemID_Copy_Name
    	bl Jump
    	mov r0, r4
    	ldr r2, .GetItemPocket
    	bl Jump
    	cmp r0, #0x4
    	bne Return2
    
    GetPrice:
    	mov r0, r4
    	ldr r2, .GetMarketPrice
    	bl Jump
    	mov r1, r0
    	ldr r0, .FCodeBuffer2
    	add r0, #0x20
    	mov r2, #0x3
    	mov r3, #0x8
    	bl Hex2Dec
    	ldr r1, .NewYouWantString
    	ldr r2, =0x809BE91
    	ldr r3, =0x809BC89
    	bx r3
    
    Return2:
    	ldr r1, =0x809BC85
    	bx r1
    
    Hex2Dec:
    	ldr r4, =0x8008E79
    	bx r4
    
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    
    AddItem:
    	ldr r2, .GetItemPocket
    	bl Jump
    	cmp r0, #0x4
    	bne Return3
    	mov r0, #0x1
    	strh r1, [r4, #0x2]
    
    Return3:
    	ldrh r0, [r4, #0xA]
    	ldrh r1, [r4, #0x2]
    	ldr r2, .Bag_Add_Item
    	bl Jump
    	lsl r0, #0x18
    	ldr r2, =0x809BEC5
    Jump:
    	bx r2
    
    .align 2
    .FCodeBuffer2: .word 0x2021CD0
    .GetItemPocket: .word 0x809A9D9
    .CheckItem: .word 0x8099F41
    .ItemID_Copy_Name: .word 0x8099E91
    .GetMarketPrice: .word 0x809A901
    .Bag_Add_Item: .word 0x809A085
    .AlreadyHaveTMString: .word STRING1 + rom
    .NewYouWantString: .word STRING2 + rom
    
    STRING1: .byte 0xD3, 0xE3, 0xE9, 0x00, 0xD5, 0xE0, 0xE6, 0xD9, 0xD5, 0xD8, 0xED, 0x00, 0xE3, 0xEB, 0xE2, 0x00, 0xE8, 0xDC, 0xD5, 0xE8, 0x00, 0xCE, 0xC7, 0xAD, 0xFC, 0x09, 0xFF
    STRING2: .byte 0xFD, 0x02, 0xB8, 0xFE, 0xCE, 0xDC, 0xD5, 0xE8, 0x00, 0xEB, 0xDD, 0xE0, 0xE0, 0x00, 0xD6, 0xD9, 0x00, 0xB7, 0xFD, 0x03, 0xAD, 0x00, 0xC9, 0xDF, 0xD5, 0xED, 0xAC, 0xFF
     
    239
    Posts
    8
    Years
    • Seen Apr 15, 2024
    [FR] Fully Flag-Dependent Start Menu

    It's nothing fancy, but this code expands on FBI's routine to swap between start menus, shown here. It also keeps the safari zone start menu intact.

    Every single start menu option (except Exit) is flag-dependent, so you can add or remove start menu options with simple flag setting/clearing.

    Spoiler:


    for example, with the current definitions, setting flags 0x251, 0x253 would make the start menu be composed of only "Pokemon","[player]", and "Exit".
     

    Skeli

    Lord of the Rings
    300
    Posts
    10
    Years
  • Potions go into the Key Item slot when I use this? What am I doing wrong?
    You need to delete your save file and start a new game. Or, implement this routine by Sagiri, and then you can just start a new game normally. If you used the saveblock routine from this post and you do implement Sagiri's routine, make sure that you change the first line in constants.s (from Sagiri's routine) to
    Code:
    .definelabel jpan_block, 0x0203C100
    as that is where I started the saveblock in JPAN's routine.
     
    Last edited:
    788
    Posts
    17
    Years
    • Seen today
    Since it got mentioned above, I figured I'd post this here.

    It's been tweaked slightly so that it only uses armips, rather than the build system I use for my C stuff. All it really did for it was find free space automatically, and, while that's kind of useful, I feel it unnecessarily overcomplicated it.

    In any case:

    Clear JPAN Save Block During New Game [FR]

    Fixes an oddity with JPAN's Save Block Recycle where the saved memory doesn't get zeroed upon starting a new game. Instead, it'll retain whatever it happened to be in the previous save file.

    To be clear, this does not actually include JPAN's Save Block Recycle itself.
     
    Last edited:
    788
    Posts
    17
    Years
    • Seen today
    Unhidden Power [FR]

    This routine makes the game calculate and display the actual type of Hidden Power in battle and in status screens. If, for example, a Pokémon's Hidden Power type is Water, it will display as a Water-type move, just like Surf or any other Water-type move.

    in-battle.png
    status-screen.png


    Note that this only calculates and displays the type, not the base power.
     
    Last edited:
    788
    Posts
    17
    Years
    • Seen today
    Evolve by Leveling Up While Holding An Item [FR]

    Adds evolution methods to allow Pokémon to evolve by leveling up while holding a particular item. Also included are day and night variations for use with Happiny, Gligar, and Sneasel.

    Other implementations of this evolution method have a subtle bug - they remove the item even if the player hits B to cancel the evolution. This avoids that.
     
    Last edited:
    51
    Posts
    9
    Years
    • Seen Nov 18, 2023
    Are there news about this feature? (Trainer's Interrupting battles)
    I see that Chacha Dinosaur imported it in Emerald, but for Fire Red?
     
    Back
    Top