aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-05-12 17:36:01 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-05-12 17:36:01 +0100
commit820d42da5f25916ba4378fd8ee3ac7e0d2fd1f5a (patch)
treedf32ded12d476e933af9968c5517ed518bad7123
parentaf16b77a3667b6dd4ffd645f27a29c57a1db88cc (diff)
downloadtr8vm-820d42da5f25916ba4378fd8ee3ac7e0d2fd1f5a.tar.gz
tr8vm-820d42da5f25916ba4378fd8ee3ac7e0d2fd1f5a.zip
Menu WIP
-rw-r--r--game/assets/press.pngbin0 -> 628 bytes
-rw-r--r--game/assets/title.pngbin0 -> 825 bytes
-rw-r--r--game/assets/usebox.pngbin0 -> 8685 bytes
-rw-r--r--game/main.asm168
4 files changed, 166 insertions, 2 deletions
diff --git a/game/assets/press.png b/game/assets/press.png
new file mode 100644
index 0000000..e5aed17
--- /dev/null
+++ b/game/assets/press.png
Binary files differ
diff --git a/game/assets/title.png b/game/assets/title.png
new file mode 100644
index 0000000..20282eb
--- /dev/null
+++ b/game/assets/title.png
Binary files differ
diff --git a/game/assets/usebox.png b/game/assets/usebox.png
new file mode 100644
index 0000000..f47426d
--- /dev/null
+++ b/game/assets/usebox.png
Binary files differ
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 a, >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
+ 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"