summaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rwxr-xr-xsrc/engine/bank1.asm57
-rwxr-xr-xsrc/engine/bank3.asm4
-rwxr-xr-xsrc/engine/home.asm26
3 files changed, 67 insertions, 20 deletions
diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm
index 2d9e6f9..985418b 100755
--- a/src/engine/bank1.asm
+++ b/src/engine/bank1.asm
@@ -1,4 +1,5 @@
-Func_4000: ; 4000 (1:4000)
+; continuation of Bank0 Start
+Start_Cont: ; 4000 (1:4000)
di
ld sp, $e000
call ResetSerial
@@ -18,7 +19,7 @@ Func_4000: ; 4000 (1:4000)
cp A_BUTTON | B_BUTTON
jr z, .ask_erase_backup_ram
farcall Func_126d1
- jr Func_4000
+ jr Start_Cont
.ask_erase_backup_ram
call Func_405a
call Func_04a2
@@ -40,10 +41,43 @@ Func_4050: ; 4050 (1:4050)
ret
Func_405a: ; 405a (1:405a)
- INCROM $405a, $406f
+ xor a
+ ld [wTileMapFill], a
+ call DisableLCD
+ call Func_2119
+ call Func_5aeb
+ ld de, $387f
+ call Func_2275
+ ret
+; 0x406e
+
+CommentedOut_406e: ; 406e (1:406e)
+ ret
+; 0x406f
Func_406f: ; 406f (1:406f)
- INCROM $406f, $409f
+ call $420b
+ call $66e9
+ ldtx hl, BackUpIsBrokenText
+ jr c, .asm_4097
+ ld hl, sp+$00
+ ld a, l
+ ld [wcbe5], a
+ ld a, h
+ ld [wcbe6], a
+ call ClearJoypad
+ ld a, [wDuelTheme]
+ call PlaySong
+ xor a
+ ld [wDuelFinished], a
+ call Func_426d
+ jp StartDuel.asm_40fb
+.asm_4097
+ call DrawWideTextBox_WaitForInput
+ call ResetSerial
+ scf
+ ret
+; 0x409f
; this function begins the duel after the opponent's
; graphics, name and deck have been introduced
@@ -92,6 +126,8 @@ StartDuel: ; 409f (1:409f)
call HandleSwordsDanceOrFocusEnergySubstatus
call $54c8
call HandleTurn
+
+.asm_40fb
call Func_0f58
ld a, [wDuelFinished]
or a
@@ -232,7 +268,18 @@ StartDuel: ; 409f (1:409f)
ret
; 0x420b
- INCROM $420b, $4225
+Func_420b: ; 420b (1:420b)
+ xor a
+ ld [wTileMapFill], a
+ call $5990
+ call Func_04a2
+ call Func_2119
+ call Func_5aeb
+ ld de, $389f
+ call Func_2275
+ call EnableLCD
+ ret
+; 0x4225
HandleTurn: ; 4225 (1:4225)
ld a, DUELVARS_DUELIST_TYPE
diff --git a/src/engine/bank3.asm b/src/engine/bank3.asm
index dd8638b..68fb245 100755
--- a/src/engine/bank3.asm
+++ b/src/engine/bank3.asm
@@ -83,9 +83,9 @@ Func_c0ce: ; c0ce (3:40ce)
ld a, [wd0bf]
res 7, a
rlca
- add PointerTable_c0e0 & $ff
+ add LOW(PointerTable_c0e0)
ld l, a
- ld a, PointerTable_c0e0 >> $8
+ ld a, HIGH(PointerTable_c0e0)
adc $0
ld h, a
ld a, [hli]
diff --git a/src/engine/home.asm b/src/engine/home.asm
index ebffefa..78e32ae 100755
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -61,10 +61,10 @@ Start: ; 0150 (0:0150)
call ResetSerial
call CopyDMAFunction
call SetupExtRAM
- ld a, BANK(Func_4000)
+ ld a, BANK(Start_Cont)
call BankswitchHome
ld sp, $e000
- jp Func_4000
+ jp Start_Cont
VBlankHandler: ; 019b (0:019b)
push af
@@ -627,10 +627,10 @@ Func_04a2: ; 04a2 (0:04a2)
ld a, [wConsole]
cp CONSOLE_SGB
ret nz
- call EnableLCD ;
- ld hl, AttrBlkPacket_04bf ; send SGB data
- call SendSGB ;
- call DisableLCD ;
+ call EnableLCD
+ ld hl, AttrBlkPacket_04bf
+ call SendSGB
+ call DisableLCD
ret
AttrBlkPacket_04bf: ; 04bf (0:04bf)
@@ -2069,7 +2069,7 @@ SerialHandleRecv: ; 0d77 (0:0d77)
dec e
jr z, .last_was_ca
cp $ac
- ret z ; return if read_data == $ac
+ ret z ; return if read_data == $ac
cp $ca
jr z, .read_ca
or a
@@ -2081,7 +2081,7 @@ SerialHandleRecv: ; 0d77 (0:0d77)
set 6, [hl]
ret
.read_ca
- inc [hl] ; inc [wSerialLastReadCA]
+ inc [hl] ; inc [wSerialLastReadCA]
ret
.last_was_ca
; if last byte read was $ca, flip all bits of data received
@@ -4350,13 +4350,13 @@ Func_210f: ; 210f (0:210f)
jr asm_2121
Func_2119: ; 2119 (0:2119)
- ld hl, DuelGraphics - Fonts
+ ld hl, DuelGraphics - $4000
ld de, vTiles2 ; destination
ld b, $38 ; number of tiles
asm_2121
- ld a, BANK(Fonts)
+ ld a, BANK(DuelGraphics)
call BankpushHome
- ld c, $10
+ ld c, TILE_SIZE
call CopyGfxData
call BankpopHome
ret
@@ -4707,7 +4707,7 @@ Func_235e: ; 235e (0:235e)
ld b, $c9
ld a, l
ld [bc], a ; prev[i0] ← i
- ldh [$ffa9], a ; [$ffa9] ← i (update linked-list head)
+ ldh [$ffa9], a ; [$ffa9] ← i (update linked-list head)
ld h, $c9
ld b, [hl]
ld [hl], $0 ; prev[i] ← 0
@@ -6173,7 +6173,7 @@ LoadCardGfx: ; 2fa0 (0:2fa0)
Func_2fcb: ; 2fcb (0:2fcb)
ld a, $1d
call BankpushHome
- ld c, $10
+ ld c, TILE_SIZE
call CopyGfxData
call BankpopHome
ret