So I'm digging around Ogre Battle and it has this function that it uses a lot at $001199, and it takes a Long stored after the jsr. It then calls said long. Here is a trace of its execution
This seems a lot of work and fancing around to do JSL $008e66, looks like it probably clears any DP movement/data page when doing the jump, so you call the function without changing the DP/Data bank. But also seems like overkill for such functionality. Am I missing something?
Code:
$05/B19E 20 99 11 JSR $1199 [$05:1199] A:FFD2 X:0650 Y:07C4 P:envMxdizc
$05/B1A1 66 8E 05
$05/119A 5C 8E 9F 00 JMP $009F8E[$00:9F8E] A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F8E 8B PHB A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F8F F4 9D 11 PEA $119D A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F92 0B PHD A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F93 4B PHK A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F94 08 PHP A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F95 C2 20 REP #$20 A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F97 0B PHD A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F98 48 PHA A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F99 3B TSC A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F9A 5B TCD A:1FDD X:0650 Y:01C4 P:envmxdizc
$00/9F9B D4 0D PEI ($0D) [$B1A0] A:1FDD X:0650 Y:01C4 P:envmxdizc
$00/9F9D A5 0B LDA $0B [$00:1FE8] A:1FDD X:0650 Y:01C4 P:envmxdizc
$00/9F9F 85 0D STA $0D [$00:1FEA] A:0505 X:0650 Y:01C4 P:envmxdizc
$00/9FA1 68 PLA A:0505 X:0650 Y:01C4 P:envmxdizc
$00/9FA2 85 0C STA $0C [$00:1FE9] A:B1A0 X:0650 Y:01C4 P:eNvmxdizc
$00/9FA4 E6 0C INC $0C [$00:1FE9] A:B1A0 X:0650 Y:01C4 P:eNvmxdizc
$00/9FA6 A7 0C LDA [$0C] [$05:B1A1] A:B1A0 X:0650 Y:01C4 P:eNvmxdizc
$00/9FA8 E6 0C INC $0C [$00:1FE9] A:8E66 X:0650 Y:01C4 P:eNvmxdizc
$00/9FAA 3A DEC A A:8E66 X:0650 Y:01C4 P:eNvmxdizc
$00/9FAB 85 06 STA $06 [$00:1FE3] A:8E65 X:0650 Y:01C4 P:eNvmxdizc
$00/9FAD E6 0C INC $0C [$00:1FE9] A:8E65 X:0650 Y:01C4 P:eNvmxdizc
$00/9FAF E2 20 SEP #$20 A:8E65 X:0650 Y:01C4 P:eNvmxdizc
$00/9FB1 A7 0C LDA [$0C] [$05:B1A3] A:8E65 X:0650 Y:01C4 P:eNvMxdizc
$00/9FB3 85 08 STA $08 [$00:1FE5] A:8E00 X:0650 Y:01C4 P:envMxdiZc
$00/9FB5 48 PHA A:8E00 X:0650 Y:01C4 P:envMxdiZc
$00/9FB6 AB PLB A:8E00 X:0650 Y:01C4 P:envMxdiZc
$00/9FB7 C2 20 REP #$20 A:8E00 X:0650 Y:01C4 P:envMxdiZc
$00/9FB9 68 PLA A:8E00 X:0650 Y:01C4 P:envmxdiZc
$00/9FBA 2B PLD A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9FBB 28 PLP A:03E2 X:0650 Y:01C4 P:envmxdiZc
$00/9FBC 6B RTL A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/8E66 29 FF 03 AND #$03FF A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/8E69 0A ASL A A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/8E6A A8 TAY A:07C4 X:0650 Y:01C4 P:envmxdizc
$00/8E6B B9 6F 8E LDA $8E6F,y[$00:9633] A:07C4 X:0650 Y:07C4 P:envmxdizc
$00/8E6E 60 RTS A:FFD2 X:0650 Y:07C4 P:eNvmxdizc
$00/119E AB PLB A:FFD2 X:0650 Y:07C4 P:eNvmxdizc
$00/119F 6B RTL A:FFD2 X:0650 Y:07C4 P:envmxdizc
$05/B1A4 85 8A STA $8A [$00:008A] A:FFD2 X:0650 Y:07C4 P:envmxdizc
$05/B1A6 E2 20 SEP #$20 A:FFD2 X:0650 Y:07C4 P:envmxdizc
$05/B1A8 60 RTS A:FFD2 X:0650 Y:07C4 P:envMxdizc
$05/B1A1 66 8E 05
$05/119A 5C 8E 9F 00 JMP $009F8E[$00:9F8E] A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F8E 8B PHB A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F8F F4 9D 11 PEA $119D A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F92 0B PHD A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F93 4B PHK A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F94 08 PHP A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F95 C2 20 REP #$20 A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F97 0B PHD A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F98 48 PHA A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F99 3B TSC A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9F9A 5B TCD A:1FDD X:0650 Y:01C4 P:envmxdizc
$00/9F9B D4 0D PEI ($0D) [$B1A0] A:1FDD X:0650 Y:01C4 P:envmxdizc
$00/9F9D A5 0B LDA $0B [$00:1FE8] A:1FDD X:0650 Y:01C4 P:envmxdizc
$00/9F9F 85 0D STA $0D [$00:1FEA] A:0505 X:0650 Y:01C4 P:envmxdizc
$00/9FA1 68 PLA A:0505 X:0650 Y:01C4 P:envmxdizc
$00/9FA2 85 0C STA $0C [$00:1FE9] A:B1A0 X:0650 Y:01C4 P:eNvmxdizc
$00/9FA4 E6 0C INC $0C [$00:1FE9] A:B1A0 X:0650 Y:01C4 P:eNvmxdizc
$00/9FA6 A7 0C LDA [$0C] [$05:B1A1] A:B1A0 X:0650 Y:01C4 P:eNvmxdizc
$00/9FA8 E6 0C INC $0C [$00:1FE9] A:8E66 X:0650 Y:01C4 P:eNvmxdizc
$00/9FAA 3A DEC A A:8E66 X:0650 Y:01C4 P:eNvmxdizc
$00/9FAB 85 06 STA $06 [$00:1FE3] A:8E65 X:0650 Y:01C4 P:eNvmxdizc
$00/9FAD E6 0C INC $0C [$00:1FE9] A:8E65 X:0650 Y:01C4 P:eNvmxdizc
$00/9FAF E2 20 SEP #$20 A:8E65 X:0650 Y:01C4 P:eNvmxdizc
$00/9FB1 A7 0C LDA [$0C] [$05:B1A3] A:8E65 X:0650 Y:01C4 P:eNvMxdizc
$00/9FB3 85 08 STA $08 [$00:1FE5] A:8E00 X:0650 Y:01C4 P:envMxdiZc
$00/9FB5 48 PHA A:8E00 X:0650 Y:01C4 P:envMxdiZc
$00/9FB6 AB PLB A:8E00 X:0650 Y:01C4 P:envMxdiZc
$00/9FB7 C2 20 REP #$20 A:8E00 X:0650 Y:01C4 P:envMxdiZc
$00/9FB9 68 PLA A:8E00 X:0650 Y:01C4 P:envmxdiZc
$00/9FBA 2B PLD A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/9FBB 28 PLP A:03E2 X:0650 Y:01C4 P:envmxdiZc
$00/9FBC 6B RTL A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/8E66 29 FF 03 AND #$03FF A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/8E69 0A ASL A A:03E2 X:0650 Y:01C4 P:envmxdizc
$00/8E6A A8 TAY A:07C4 X:0650 Y:01C4 P:envmxdizc
$00/8E6B B9 6F 8E LDA $8E6F,y[$00:9633] A:07C4 X:0650 Y:07C4 P:envmxdizc
$00/8E6E 60 RTS A:FFD2 X:0650 Y:07C4 P:eNvmxdizc
$00/119E AB PLB A:FFD2 X:0650 Y:07C4 P:eNvmxdizc
$00/119F 6B RTL A:FFD2 X:0650 Y:07C4 P:envmxdizc
$05/B1A4 85 8A STA $8A [$00:008A] A:FFD2 X:0650 Y:07C4 P:envmxdizc
$05/B1A6 E2 20 SEP #$20 A:FFD2 X:0650 Y:07C4 P:envmxdizc
$05/B1A8 60 RTS A:FFD2 X:0650 Y:07C4 P:envMxdizc
This seems a lot of work and fancing around to do JSL $008e66, looks like it probably clears any DP movement/data page when doing the jump, so you call the function without changing the DP/Data bank. But also seems like overkill for such functionality. Am I missing something?