summaryrefslogtreecommitdiff
path: root/src/engine/bank08.asm
diff options
context:
space:
mode:
authorxCrystal <rgr.crystal@gmail.com>2018-04-10 16:25:35 +0200
committerxCrystal <rgr.crystal@gmail.com>2018-04-10 16:25:35 +0200
commit2bbc1a63239201be8f1a7b360e81d19192093a8f (patch)
tree3970359d9ac5db26b39229911d975fff0825f772 /src/engine/bank08.asm
parent6895547b0d2c86d769b29dc8eb5f5021723fc763 (diff)
Add leading zero to temporary bankX.asm filenames so they show up in order
Diffstat (limited to 'src/engine/bank08.asm')
-rw-r--r--src/engine/bank08.asm132
1 files changed, 132 insertions, 0 deletions
diff --git a/src/engine/bank08.asm b/src/engine/bank08.asm
new file mode 100644
index 0000000..ca52ca5
--- /dev/null
+++ b/src/engine/bank08.asm
@@ -0,0 +1,132 @@
+ INCROM $20000, $200e5
+
+; 0 - e4 is a big set of data, seems to be one entry for each card
+
+Func_200e5: ; 200e5 (8:40e5)
+ ld [wce18], a
+ call CreateHandCardList
+ ld hl, wDuelTempList
+ ld de, wTempHandCardList
+ call CopyBuffer
+ ld hl, wTempHandCardList
+ ld a, [hli]
+ ld [wce16], a
+ cp $ff
+ ret z
+ push hl
+ ld a, [wce18]
+ ld d, a
+ ld hl, $4000
+.asm_4106
+ xor a
+ ld [wce21], a
+ ld a, [hli]
+ cp $ff
+ jp z, $41b1
+ cp d
+ jp nz, .incHL5
+ ld a, [hli]
+ ld [wce17], a
+ ld a, [wce16]
+ call LoadCardDataToBuffer1_FromDeckIndex
+ cp $d2
+ jr nz, .asm_2012b
+ ld b, a
+ ld a, [wce20]
+ and $2
+ jr nz, .incHL4
+ ld a, b
+
+.asm_2012b
+ ld b, a
+ ld a, [wce17]
+ cp b
+ jr nz, .incHL4
+ push hl
+ push de
+ ld a, [wce16]
+ ldh [hTempCardIndex_ff9f], a
+ bank1call CheckCantUseTrainerDueToHeadache
+ jp c, $41a8
+ call LoadNonPokemonCardEffectCommands
+ ld a, $1
+ call TryExecuteEffectCommandFunction
+ jp c, $41a8
+ farcall $5, $743b
+ jr c, .asm_201a8
+ pop de
+ pop hl
+ push hl
+ call CallIndirect
+ pop hl
+ jr nc, .incHL4
+ inc hl
+ inc hl
+ ld [wce19], a
+ push de
+ push hl
+ ld a, [wce16]
+ ldh [hTempCardIndex_ff9f], a
+ ld a, $6
+ bank1call $67be
+ pop hl
+ pop de
+ jr c, .incHL2
+ push hl
+ call CallIndirect
+ pop hl
+ inc hl
+ inc hl
+ ld a, [wce20]
+ ld b, a
+ ld a, [wce21]
+ or b
+ ld [wce20], a
+ pop hl
+ and $8
+ jp z, $40f7
+ call CreateHandCardList
+ ld hl, wDuelTempList
+ ld de, wTempHandCardList
+ call $697b
+ ld hl, wTempHandCardList
+ ld a, [wce20]
+ and $f7
+ ld [wce20], a
+ jp $40f7
+
+.incHL5
+ inc hl
+
+.incHL4
+ inc hl
+ inc hl
+
+.incHL2
+ inc hl
+ inc hl
+ jp .asm_4106
+
+.asm_201a8
+ pop de
+ pop hl
+ inc hl
+ inc hl
+ inc hl
+ inc hl
+ jp .asm_4106
+; 0x201b1
+
+ INCROM $201b1, $2297b
+
+; copies $ff terminated buffer from hl to de
+CopyBuffer: ; 2297b (8:697b)
+ ld a, [hli]
+ ld [de], a
+ cp $ff
+ ret z
+ inc de
+ jr CopyBuffer
+; 0x22983
+
+ INCROM $22983, $24000