summaryrefslogtreecommitdiff
path: root/src/engine/game_loop.asm
blob: fc7def7c708e2ca8841eb2aff2a8be8bb386b021 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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 StubbedUnusedSaveDataValidation
	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 SetDefaultConsolePalettes
	lb de, $38, $7f
	call SetupText
	ret

	ret ; stray ret