From 820d42da5f25916ba4378fd8ee3ac7e0d2fd1f5a Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Fri, 12 May 2023 17:36:01 +0100 Subject: Menu WIP --- game/main.asm | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 166 insertions(+), 2 deletions(-) (limited to 'game/main.asm') diff --git a/game/main.asm b/game/main.asm index bfc203c..8abd239 100644 --- a/game/main.asm +++ b/game/main.asm @@ -3,6 +3,31 @@ .equ INT_VECTOR 0xff00 call init + +menu: + ld x, blink + ld y, 0 + ld [a : x], y + + call clear_screen + +menu_loop: + halt + + call stars_update + call menu_draw + + ; read controller 1 + ld b, 0xf0 + port b, b + + ; start + bit b, 7 + bnz + jmp menu_loop + +play: call init_game game_loop: @@ -13,8 +38,17 @@ game_loop: call entities_update call entities_draw + ; read controller 1 + ld b, 0xf0 + port b, b + + ; select to exit + bit b, 6 + bnz jmp game_loop + jmp menu + init: ; setup an int handler so we ; can use the frame int to sync @@ -45,6 +79,12 @@ init_game: ld y, 104 ld [a : x], y + call clear_screen + call entities_draw + + ret + +clear_screen: ; erase the screen ld b, 0 ld a, 0xbf @@ -59,9 +99,127 @@ fill_loop: dec y bnz jmp fill_loop + ret - call entities_draw +blink: + .db 0 + +menu_draw: + ; settings mode + ld y, 128 + ld b, 0xb0 + port b, y + + ; setup + inc b + ; addr: title sprite + ld y, title + port b, y + + ; x + ld y, 26 + port b, y + + ; y + ld y, 40 + port b, y + + ld y, 76 + port b, y + ld y, 21 + port b, y + + ; blit + dec b + ; write, transparent + ld y, 3 + port b, y + + ; settings mode + ld y, 128 + port b, y + + ; setup + inc b + + ld x, <blink + ld a, >blink + ld y, [a : x] + inc y + and y, 31 + ld [a : x], y + cmp y, 10 + bnc + jmp menu_draw_start + + ; addr: black to erase sprite + ld y, 0 + port b, y + ld y, 0xa0 + port b, y + jmp menu_continue_start + +menu_draw_start: + ; addr: press start sprite + ld y, <press + port b, y + ld y, >press + port b, y + +menu_continue_start: + ; x + ld y, 36 + port b, y + + ; y + ld y, 80 + port b, y + + ld y, 56 + port b, y + ld y, 8 + port b, y + + ; blit + dec b + ; write, transparent + ld y, 3 + port b, y + + ; settings mode + ld y, 128 + port b, y + + ; setup + inc b + + ; addr: usebox logo sprite + ld y, <usebox + port b, y + ld y, >usebox + port b, y + + ; x + ld y, 44 + port b, y + + ; y + ld y, 118 + port b, y + + ld y, 40 + port b, y + ld y, 8 + port b, y + + ; blit + dec b + ; write, transparent + ld y, 3 + port b, y ret int_handler: @@ -139,4 +297,10 @@ stars: ; end of list .dw 0xffff - +; menu data +title: + .incpng "assets/title.png" +press: + .incpng "assets/press.png" +usebox: + .incpng "assets/usebox.png" -- cgit v1.2.3