mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-11-25 23:49:17 +00:00
Give the "game" a "title screen" of sorts; click to begin.
This commit is contained in:
parent
b3d2d0bfcf
commit
5e8f41307d
@ -46,10 +46,15 @@ Finish the little demo "game" where you can move a block around the screen with
|
||||
the joystick (i.e. bring it up to par with the original demo game that was written
|
||||
for SixtyPical)
|
||||
|
||||
### Self-reference in signatures
|
||||
### `call` routines that are defined further down in the source code
|
||||
|
||||
A vector might store [the address of] a routine which changes the vector. Thus its
|
||||
signature might look like `vector foo outputs foo`. Thus we need to support that.
|
||||
We might have a graph of states that refer to each other and that want to `goto`
|
||||
each other. Thus we need this. We have it for vectors, but we need it for `call`.
|
||||
|
||||
### Allow branches to diverge in what they touch
|
||||
|
||||
For example, if the routine inputs and outputs `foo`, and one branch of an `if`
|
||||
sets `foo` and the other does not touch it, that should be OK.
|
||||
|
||||
### `vector table` type
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
// ****************************
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// Global Variables and System Locations
|
||||
// System Locations
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
byte vic_border @ 53280
|
||||
@ -22,17 +22,22 @@ byte table colormap4 @ 56046
|
||||
buffer[2048] screen @ 1024
|
||||
byte joy2 @ $dc00
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// Global Variables
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
pointer ptr @ 254
|
||||
word pos
|
||||
word delta
|
||||
byte button_down : 0 // effectively static-local to check_button
|
||||
|
||||
//
|
||||
// Points to the routine that implements the current game state.
|
||||
//
|
||||
|
||||
vector dispatch_game_state
|
||||
inputs joy2, pos
|
||||
outputs delta, pos, screen, screen1, dispatch_game_state
|
||||
inputs joy2, pos, button_down, dispatch_game_state
|
||||
outputs delta, pos, screen, screen1, button_down, dispatch_game_state
|
||||
trashes a, x, y, c, z, n, v, ptr
|
||||
|
||||
//
|
||||
@ -48,17 +53,16 @@ vector dispatch_game_state
|
||||
//
|
||||
|
||||
vector cinv
|
||||
inputs joy2, pos
|
||||
outputs delta, pos, dispatch_game_state, screen, screen1
|
||||
inputs joy2, pos, button_down, dispatch_game_state
|
||||
outputs delta, pos, screen, screen1, button_down, dispatch_game_state
|
||||
trashes a, x, y, c, z, n, v, ptr
|
||||
@ 788
|
||||
|
||||
vector save_cinv
|
||||
inputs joy2, pos
|
||||
outputs delta, pos, dispatch_game_state, screen, screen1
|
||||
inputs joy2, pos, button_down, dispatch_game_state
|
||||
outputs delta, pos, screen, screen1, button_down, dispatch_game_state
|
||||
trashes a, x, y, c, z, n, v, ptr
|
||||
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// Utility Routines
|
||||
// ----------------------------------------------------------------
|
||||
@ -96,6 +100,37 @@ routine read_stick
|
||||
}
|
||||
}
|
||||
|
||||
// You can repeatedly (i.e. as part of actor logic or an IRQ handler)
|
||||
// call this routine.
|
||||
// Upon return, if carry is set, the button was pressed then released.
|
||||
|
||||
routine check_button
|
||||
inputs joy2, button_down
|
||||
outputs c, button_down
|
||||
trashes a, z, n
|
||||
{
|
||||
ld a, button_down
|
||||
if z {
|
||||
ld a, joy2
|
||||
and a, $10
|
||||
if z {
|
||||
ld a, 1
|
||||
st a, button_down
|
||||
}
|
||||
st off, c
|
||||
} else {
|
||||
ld a, joy2
|
||||
and a, $10
|
||||
if not z {
|
||||
ld a, 0
|
||||
st a, button_down
|
||||
st on, c
|
||||
} else {
|
||||
st off, c
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
routine clear_screen
|
||||
outputs screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
||||
trashes a, y, c, n, z
|
||||
@ -128,8 +163,8 @@ routine clear_screen
|
||||
//
|
||||
|
||||
routine game_state_play
|
||||
inputs joy2, pos
|
||||
outputs delta, pos, dispatch_game_state, screen, screen1
|
||||
inputs joy2, pos, button_down, dispatch_game_state
|
||||
outputs delta, pos, screen, screen1, button_down, dispatch_game_state
|
||||
trashes a, x, y, c, z, n, v, ptr
|
||||
{
|
||||
call read_stick
|
||||
@ -148,27 +183,28 @@ routine game_state_play
|
||||
}
|
||||
|
||||
routine game_state_title_screen
|
||||
inputs joy2, pos
|
||||
outputs delta, pos, screen, screen1, dispatch_game_state
|
||||
inputs joy2, pos, button_down, dispatch_game_state
|
||||
outputs delta, pos, screen, screen1, button_down, dispatch_game_state
|
||||
trashes a, x, y, c, z, n, v, ptr
|
||||
{
|
||||
ld y, 0
|
||||
ld y, 10
|
||||
repeat {
|
||||
ld a, 82
|
||||
ld a, 90
|
||||
st a, screen1 + y
|
||||
inc y
|
||||
cmp y, 18
|
||||
} until not z
|
||||
cmp y, 20
|
||||
} until z
|
||||
|
||||
st off, c
|
||||
// jsr check_button
|
||||
call check_button
|
||||
|
||||
if c {
|
||||
// call clear_screen
|
||||
// jsr init_game
|
||||
// call init_game
|
||||
copy game_state_play, dispatch_game_state
|
||||
} else {
|
||||
copy game_state_play, dispatch_game_state
|
||||
// This is sort of a hack. FIXME: let `if` branches diverge this much.
|
||||
copy dispatch_game_state, dispatch_game_state
|
||||
}
|
||||
|
||||
goto save_cinv
|
||||
@ -179,8 +215,8 @@ routine game_state_title_screen
|
||||
// *************************
|
||||
|
||||
routine our_cinv
|
||||
inputs joy2, pos
|
||||
outputs delta, pos, dispatch_game_state, screen, screen1
|
||||
inputs joy2, pos, button_down, dispatch_game_state
|
||||
outputs delta, pos, screen, screen1, button_down, dispatch_game_state
|
||||
trashes a, x, y, c, z, n, v, ptr
|
||||
{
|
||||
goto dispatch_game_state
|
||||
|
Loading…
Reference in New Issue
Block a user