[FE7 and FE8] Shuusuke's Simple Sorcery

I almost titled this thread “Shuu’ssembly” before the alliteration dawned upon me

I don’t make it a secret that I’m not a fan of ASM, but even then, I’ve done some very basic stuff that I figured I should put together somewhere, and thus this here SSS was created.

I’ll include whether there is an FEBuilder patch for it (and if not, why), the source(s) for more information if there are any, explanations and images of the result/how to do it. Thanks to 7743, Sme, Leonarth, Pikmin, Epicer, and Vesly for helping with some of these at some point. They’re currently FE8 exclusive, some specifically for FE8U only.

Change easy/normal mode penalty into bonus

FEB Patch: “Change Easy and Normal modes level penalty into level bonus”
Source: [FE7/FE8] Difficulty stat changes
With this, the values previously read to lower autoleveled unit’s levels in easy and normal modes will instead be used to increase their level, like what’s done for hard mode. (Note that FEBuilder’s interface won’t change to reflect the patch).
Example of the same unit in Normal mode using the same modifier of 0xF (15 levels), left is vanilla behavior (penalty, essentially nothing since the unit has less than 15 levels), right is with the edit (stats are calculated as if the unit was 15 levels above their actual level).

The idea for this was that you would design around the Easy difficulty having no modifiers, so that you could have two increased difficulty options.

How to do it: In the Disassembler, go to address 18064, go to line 080180FA, and change the value 08018064 to 08017FC4. image

Allow the player to trade with NPCs

FEB Patch: No, because it conflicts with Capture, which is part of the skill system. If you use the skill system, the code will be different and this won’t work.
Source: N/A

How to do it: Go to address 2521C, line 0802522E , and change the value there to 08024D8Cimage

Allow Enemies/NPCs/Other units to also gain exp

FEB Patch: No, because there are visual glitches, but it still functions normally otherwise.
Source: N/A
image image
Visual bug: image
The Soldier is the one who leveled up, but it displays Eirika’s data instead, since only the unit on the right can normally level up. Also, since the Soldier uses a generic portrait, it displays a broken image instead. But it occurred correctly, and as seen above, the Soldier’s stats were updated. Both units leveling up will also occur correctly, despite graphical bugs.

How to do it: Go to address 2B9F4, line 0802BA0E, the default value there is 0xC0, meaning only blue units can gain exp. To make it so all units can gain EXP, change it to 0x0 like in the image. Change to 0x40 to allow only enemies to gain EXP, or 0x80 to allow only NPCs to gain EXP.

Once this is done, you have to set the EXP of the units that you want to level up to a value other than 255, which is another condition that restricts EXP gain in vanilla, and was not changed for convenience (this makes it so units don’t break their level cap, and lets you select which units can gain EXP instead of making all of them do so unconditionally) through events. With the “Set all unit status” patch it’s easy to set this for multiple units at once, if that’s what you want. Note that units will use their unit growths when leveling up this way, regardless of autolevel, even generics.

Allow the player to steal from NPCs

FEB Patch: Allow the player to steal from NPCs (green units)
Source: N/A
How to do it: Go to 25BA0, lines 08025BAA and 08025BAC, change r0 to r1 and #0x80 to r0 respectively.image
NPCs won’t steal from the player, even with this.

Allow Enemies/NPCs/Other units to get droppable items

FEB Patch: Remove restriction on droppable items
Source: N/A
image image image image image image
How to do it: Go to 3292C, line 08032942, the default value is 0xC0, meaning only blue units. Change to 0x0 to allow all units to get droppable items, 0x40 to allow NPCs, or 0x80 to allow enemies.
Note that if an enemy/npc gets an item and can’t carry any more, the player will be prompted to discard or store one of their items, depending on whether the convoy is enabled.

Get currently pressed keys

FEB Patch: GetCurrentlyPressedKeys
Source:This post, 7743 later improved the code which is listed below.

This is an ASMC, so if you use FEBuilder, just apply the patch. If you don’t use FEBuilder, the code is listed below.
This ASMC makes it so the bitmask of the keys being pressed by the player are returned to memory slot C. The bitmask is the same used for vanilla command IGNORE_KEYS, so A is 1, B is 2, A+B is 3, select is 4, and so on. FEBuilder’s patch also includes a command to check if the pressed keys are the one(s) you want, using the intuitive menu you see in the images.


ldr r0,=0x2024CC0 @Key press bitfield pointer
ldrh r1,[r0,#0x4] @Key press bitfield start <<<<
mov r2,r1
ldr r0,=0x30004B8 @FE8U MemorySlot0
mov r1,#0x0C @FE8U MemorySlotC
lsl r1,#2
str r2,[r0,r1]
bx lr

At first this was made to simulate RPG walking, but later Sme’s Free Walk ASMC was made, so it was surpassed for this purpose. Still, you can use it if you want to know what the player is pressing during an event, such as letting the player decide with direction to move to by checking the right/left keys, or if they approve/deny a suggestion by checking A/B, and so on.

Allow enemy/NPC dancers/thieves/summoners to gain exp from dancing/stealing/summoning

In function
2C6A0, go to line 0802C6A8 and change the 0xC0 value to 0x00


Enable Augury on hard mode (FE7U)

This enables Augury even on hard mode. It’s still disabled in Lyn mode.
For EA:

ORG $9930A
SHORT 0x2001

For FEBuilder

NAME.en=Enable viewing Augury on hard mode [FE7U]
INFO.en=Normally, you can only view Augury on normal mode. This patch lets you change that.



OFF:0x9930A=0x00 0x20

FIX:0x9930A=0x01 0x20

Autolevel player unit

I submitted this to FEBuilder and it was made a patch. The code is below.

.align 4
.macro blh to, reg=r3
ldr \reg, =\to
mov lr, \reg
.short 0xf800

.equ MemorySlot0, 0x30004B8
.equ GetUnitByCharId, 0x0801829C
.equ GetUnitByEventParameter, 0x800bc50
.equ CopyUnitToBattleStruct, 0x0802A584
.equ CheckForLevelUp, 0x0802BA28
.equ SaveUnitFromBattle, 0x0802C1EC
.equ EnsureNoUnitStatCapOverflow, 0x80181c9

PUSH {r4-r7,lr}
SUB SP, #0x80
LDR r0, =MemorySlot0 @FE8U MemorySlot0
LDR r5,[r0,#0x20] @FE8U MemorySlot8 - # of levels
LDR r0,[r0,#0x1C] @FE8U MemorySlot7 - Unit ID
BLH GetUnitByEventParameter @0x800bc50
cmp r0, #0
beq Exit

ldrb r1, [r0,#0xB] @Do not use for enemies
cmp r1, #0x40
bge Exit

ldrb r1, [r0, #0x9] @Get unit exp
cmp r1, #0x64 @check EXP:–
bge Exit @level caps

cmp r5, #0x0 @ what’s LV+0?
beq Exit

MOV r6 ,r0 @Copy unit address
@Get unit level
LDRB r4, [r6, #0x8] @ current lvl
add r5, r4 @ # of lvls + current lvl = final lvls

MOV r7, SP
MOV r0, SP
MOV r1 ,r6
BLH CopyUnitToBattleStruct
LDRB r0, [r7, #0x9]
ADD r0, #0x64
STRB r0, [r7, #0x9]
MOV r0, SP
BLH CheckForLevelUp

LDRB r0, [r7, #0x9] @Get unit exp
CMP r0, #0x64
BLT NotMaxLevel @If the unit already reached its level cap, do not give more levels
MOV r0 ,r6
MOV r1, SP
BLH SaveUnitFromBattle
B MaxLevel

MOV r0 ,r6
MOV r1, SP
BLH SaveUnitFromBattle
ADD r0 ,r4, #0x1
LSL r0 ,r0 ,#0x18
LSR r4 ,r0 ,#0x18
CMP r4 ,r5
BCC LoopStart

MOV r0, #0x0 @Set EXP to 0
STRB r0, [r6, #0x9]

mov r0, r6 @ unit
blh EnsureNoUnitStatCapOverflow


ADD SP, #0x80
POP {r4,r5,r6,r7}
POP {r0}
BX r0

.align 4

To use in FEBuilder, go to the Insert ASM/C menu, copy the address and click Run. In events, use the CALL ASMC command, paste the copied address and add +1 to it, then click Write. When you CALL, the value in slot 7 is the ID of the unit you want to autolevel, and slot 8 is the amount of levels you want to give to the unit. (Note that the addresses in the image don’t match since I show the Insert menu after already inserting file)

This uses the same routines as the vanilla game uses after the route split, but isn’t hardcoded to Eirika or Ephraim and doesn’t do the other things it also does (such as giving a steel weapon and weapon experience). It will not work on enemy units, which is why in the example I make O’Neill a playable unit first, and change him back after autoleveling.

This routine will stop giving levels once the unit has reached its level cap, by checking that its exp has become – through the game’s own judgement, so any alterations you make to level caps will accurately be reflected. As an aside, unless you intentionally edit ExModularSave, levels after 31 won’t correctly be saved, though they can still be set and will be respected by this routine.

Special thanks to Contro and Vesly for their help with making this, and 7743 for various fixes after my initial code and for making the FEBuilder patch. Incidentally, Vesly also has an Autolevel patch in FEBuilder, which uses class growths instead, while mine uses unit growths.


:eyes: cool stuff

I see you like to do stuff with NPCs as an opposing army, hah

1 Like
My master plan



1 Like

If you make a patch, I’ll register it.
In FEBuilderGBA, patches that fix multiple locations are implemented as switch patches.

For example, the patch that fixes 0x73758 and 0x73D2C, 0x73722 is written as follows.
When Default is selected, the OFF item is executed, and when Fix is selected, the FIX item is executed.

NAME.en=Fixed the display of large level-up screens
INFO.en=Move the text tiles in vram so that they don't overwrite the battle screen's larger tiles



OFF:0x73758=0xC0 0x28 0x00 0x06
OFF:0x73D2C=0x8C 0x22 0x12 0x01
OFF:0x73722=0xA3 0x22

FIX:0x73758=0x00 0x3C 0x00 0x06
FIX:0x73D2C=0x1C 0x22 0x12 0x02
FIX:0x73722=0xF0 0x22

The only one that I may have forgotten to ask about was the fourth one, which allows the player to steal from NPCs. I don’t know if it would conflict with other patches, but the patch file for what I described in the first post should look like this:

NAME.en=Allow the player to steal from NPCs (green units)
INFO.en=Normally blue units can only steal from enemies, but this patch also allows them to steal from NPCs if the other requirements for stealing are met.\r\nNPCs won’t be able to steal from the player even if this is done.\r\n
AUTHOR=Shuusuke [FE8] Shuusuke's Simple Sorcery



OFF:0x25BAA=0x08 0x40 0x80 0x28

FIX:0x25BAA=0x09 0x40 0x80 0x42

The others I already asked about previously, and I listed the explanation you gave me for why you didn’t add them to FEBuilder.

Also, I forgot to add GetCurrentlyPressedKeys to the first post, so I’ll be doing that.
EDIT: Done that.
EDIT2: Allow the player to steal from NPCs (green units) was added to FEBuilder’s patches.

1 Like

Updated first post with Allow enemy/NPC dancers/thieves/summoners to gain exp from dancing/stealing/summoning


Made one for FE7U, this enables Augury even on hard mode. It’s still disabled in Lyn mode.
For EA:

ORG $9930A
SHORT 0x2001

For FEBuilder

NAME.en=Enable viewing Augury on hard mode [FE7U]
INFO.en=Normally, you can only view Augury on normal mode. This patch lets you change that.



OFF:0x9930A=0x00 0x20

FIX:0x9930A=0x01 0x20

Updated first post with this.


Hey there, I had been wanting to make it so that the rescue staff couldn’t be used on NPCs, and thanks to looking through your stuff, I was able to do it, so thank you.

The highlighted value is the one to change for anyone who’s curious.

1 Like

Finally, I venture beyond inline editing. Added Autolevel player units to the first post. Special thanks to Vesly and Contro for helping with making it.

EDIT: Updated the first post with 7743’s fixes to the routine.

1 Like