diff --git a/src/main.asm b/src/main.asm index 6e8bcc4..9f072ca 100644 --- a/src/main.asm +++ b/src/main.asm @@ -12,6 +12,12 @@ wStateEventHandler:: ds 2 wStateVBlankHandler:: ds 2 +SECTION "Stack", WRAM0 +wStack: + ds STACK_SIZE +wStackEnd: + + SECTION "Code Entry Point", ROM0 Main:: ; Turn off LCD during initialization. @@ -19,6 +25,9 @@ Main:: xor a, a ldh [rLCDC], a + ; Stack + ld sp, wStackEnd + ; We use a single set of tiles for the entire game, so we copy it at the start. ld de, Tiles ld hl, _VRAM @@ -53,7 +62,13 @@ Main:: ld a, TACF_262KHZ | TACF_START ; Zero out the ram where needed. - call InitializeVariables + call TimeInit + call IntrInit + call InputInit + call ScoreInit + call LevelInit + call FieldInit + call SFXInit ; Set up the interrupt handlers. call InitializeLCDCInterrupt @@ -94,22 +109,4 @@ EventLoopPostVBlankHandler:: jr EventLoop - -; ***************************************************************************** -; * * -; * Functions * -; * * -; ***************************************************************************** -SECTION "Functions", ROM0 -InitializeVariables: - call TimeInit - call IntrInit - call InputInit - call ScoreInit - call LevelInit - call FieldInit - call SFXInit - ret - - ENDC