diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-12 17:39:09 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-12 17:39:09 +0100 |
commit | c9c562a372f808f9474b14daf0ae23d32c86da8d (patch) | |
tree | e7583250960d40c3288b5a367adcb4a285e1d1c1 /game | |
parent | 820d42da5f25916ba4378fd8ee3ac7e0d2fd1f5a (diff) | |
download | tr8vm-c9c562a372f808f9474b14daf0ae23d32c86da8d.tar.gz tr8vm-c9c562a372f808f9474b14daf0ae23d32c86da8d.zip |
Add some comments
Diffstat (limited to 'game')
-rw-r--r-- | game/main.asm | 53 |
1 files 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 a, >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_VECTOR - ld b, <int_handler - ld [a : x], b - inc x - ld b, >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_VECTOR + ld b, <int_handler + ld [a : x], b + inc x + ld b, >int_handler + ld [a : x], b + + ; enable interrupts + cif + ret + int_handler: iret |