From c9c562a372f808f9474b14daf0ae23d32c86da8d Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Fri, 12 May 2023 17:39:09 +0100 Subject: Add some comments --- game/main.asm | 53 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/game/main.asm b/game/main.asm index 8abd239..4b9a81f 100644 --- a/game/main.asm +++ b/game/main.asm @@ -4,7 +4,11 @@ call init +; +; Menu entry point +; menu: + ; reset the blink flag ld x, blink ld y, 0 @@ -27,6 +31,10 @@ menu_loop: bnz jmp menu_loop + +; +; Gameplay entry point +; play: call init_game @@ -49,21 +57,9 @@ game_loop: jmp menu -init: - ; setup an int handler so we - ; can use the frame int to sync - ld a, >INT_VECTOR - ld x, int_handler - ld [a : x], b - - ; enable interrupts - cif - ret - +; +; Setup the game after the menu +; init_game: halt @@ -84,6 +80,9 @@ init_game: ret +; +; Helper to clear the screen +; clear_screen: ; erase the screen ld b, 0 @@ -101,9 +100,15 @@ fill_loop: jmp fill_loop ret +; +; Controls the blink of the "press start" text +; blink: .db 0 +; +; Draws the menu +; menu_draw: ; settings mode ld y, 128 @@ -222,6 +227,24 @@ menu_continue_start: port b, y ret +; +; Init the TR8 (setup an int handler) +; +init: + ; setup an int handler so we + ; can use the frame int to sync + ld a, >INT_VECTOR + ld x, int_handler + ld [a : x], b + + ; enable interrupts + cif + ret + int_handler: iret -- cgit v1.2.3