summaryrefslogtreecommitdiff
path: root/src/engine/game_loop.asm
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/game_loop.asm')
-rw-r--r--src/engine/game_loop.asm55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/engine/game_loop.asm b/src/engine/game_loop.asm
new file mode 100644
index 0000000..c3745b6
--- /dev/null
+++ b/src/engine/game_loop.asm
@@ -0,0 +1,55 @@
+; continuation of Bank0 Start
+; meant as the main loop, but the game never returns from _GameLoop anyway
+GameLoop:
+ di
+ ld sp, $e000
+ call ResetSerial
+ call EnableInt_VBlank
+ call EnableInt_Timer
+ call EnableSRAM
+ ld a, [sTextSpeed]
+ ld [wTextSpeed], a
+ ld a, [sSkipDelayAllowed]
+ ld [wSkipDelayAllowed], a
+ call DisableSRAM
+ ld a, 1
+ ld [wUppercaseHalfWidthLetters], a
+ ei
+ farcall CommentedOut_1a6cc
+ ldh a, [hKeysHeld]
+ cp A_BUTTON | B_BUTTON
+ jr z, .ask_erase_backup_ram
+ farcall _GameLoop
+ jr GameLoop
+.ask_erase_backup_ram
+ call SetupResetBackUpRamScreen
+ call EmptyScreen
+ ldtx hl, ResetBackUpRamText
+ call YesOrNoMenuWithText
+ jr c, .reset_game
+; erase sram
+ call EnableSRAM
+ xor a
+ ld [s0a000], a
+ call DisableSRAM
+.reset_game
+ jp Reset
+
+InitSaveDataAndSetUppercase:
+ farcall InitSaveData
+ ld a, 1
+ ld [wUppercaseHalfWidthLetters], a
+ ret
+
+; basic setup to be able to print the ResetBackUpRamText in an empty screen
+SetupResetBackUpRamScreen:
+ xor a ; SYM_SPACE
+ ld [wTileMapFill], a
+ call DisableLCD
+ call LoadSymbolsFont
+ call SetDefaultPalettes
+ lb de, $38, $7f
+ call SetupText
+ ret
+
+ ret ; stray ret