I don’t know how well other people understand this, and I realize I kinda glossed over it in my battle computations. Buy don’t shy away from this – this is the core of FE’s round system:
(Get ready for a big asm dump.)
08028FB0 B530 push {r4,r5,r14}
08028FB2 B082 add sp,-#0x8 @Allocate 2 words of stack space.
08028FB4 F7FFFFE6 bl #0x8028F84 @Clears the battle buffer
08028FB8 AC01 add r4,sp,#0x4
08028FBA 4668 mov r0,r13
08028FBC 1C21 mov r1,r4
08028FBE F000F833 bl #0x8029028 @Stores tha attacker pointer and defender pointer into the stack.
08028FC2 4D18 ldr r5,=#0x203A50C @the battle buffer
08028FC4 6829 ldr r1,[r5]
08028FC6 2001 mov r0,#0x1 @"Start of battle"
08028FC8 788A ldrb r2,[r1,#0x2]
08028FCA 4310 orr r0,r2
08028FCC 7088 strb r0,[r1,#0x2]
08028FCE 9800 ldr r0,[sp] @r0 is the attacker
08028FD0 9901 ldr r1,[sp,#0x4] @r1 is the defender
08028FD2 F000F871 bl #0x80290B8 @This calculates what happens in a round of fighting -- damage, hit, crit, all that. In this case, for the attacker.
08028FD6 0600 lsl r0,r0,#0x18 @It will return whether the fight can keep going. 0x1 means the enemy is dead or no weapon or something.
08028FD8 2800 cmp r0,#0x0
08028FDA D119 bne #0x8029010 @We can't keep going if r0 is 0x1
08028FDC 6829 ldr r1,[r5] @Load battle buffer
08028FDE 2008 mov r0,#0x8 @Set the "Which side is attacking" bit.
08028FE0 880A ldrh r2,[r1]
08028FE2 4310 orr r0,r2
08028FE4 8008 strh r0,[r1]
08028FE6 9801 ldr r0,[sp,#0x4] @this time, loads r0 = defender and
08028FE8 9900 ldr r1,[sp] @r1 = attacker
08028FEA F000F865 bl #0x80290B8 @Calculates round of battle for the defender.
08028FEE 0600 lsl r0,r0,#0x18
08028FF0 2800 cmp r0,#0x0
08028FF2 D10D bne #0x8029010
08028FF4 4668 mov r0,r13
08028FF6 1C21 mov r1,r4
08028FF8 F000F820 bl #0x802903C @This checks if you can double. AS difference, not eclipse effect, and not dead enemy. If the defender doubles, it switches the spot of the attacker and defender on stack.
08028FFC 0600 lsl r0,r0,#0x18
08028FFE 2800 cmp r0,#0x0
08029000 D006 beq #0x8029010
08029002 6829 ldr r1,[r5]
08029004 2004 mov r0,#0x4
08029006 8008 strh r0,[r1]
08029008 9800 ldr r0,[sp] @loads character to double
0802900A 9901 ldr r1,[sp,#0x4] @loads character to get hit again
0802900C F000F854 bl #0x80290B8 @Calculates battle/ writes to battle buffer
08029010 4804 ldr r0,=#0x203A50C @Battle buffer
08029012 6801 ldr r1,[r0]
08029014 2080 mov r0,#0x80 @"End of battle" bit
08029016 788A ldrb r2,[r1,#0x2]
08029018 4310 orr r0,r2
0802901A 7088 strb r0,[r1,#0x2]
0802901C B002 add sp,#0x8 @deallocate the space we took.
0802901E BC30 pop {r4,r5}
08029020 BC01 pop {r0}
08029022 4700 bx r0
@literals follow
You can read my comments in there for better understanding, but basically, it calculates the round for the attacker, then defender, then if a unit can double, the doubler again.
[click here if you want to download that code with my comments][1]
[1]:https://dl.dropboxusercontent.com/u/92273434/My%20FEDOC/FE7%20Round%20System