2017-12-11 14:01:57 +00:00
|
|
|
// ****************************
|
|
|
|
// * Demo Game for SixtyPical *
|
|
|
|
// ****************************
|
|
|
|
|
2018-02-06 10:41:21 +00:00
|
|
|
// ----------------------------------------------------------------
|
|
|
|
// Type Definitions
|
|
|
|
// ----------------------------------------------------------------
|
|
|
|
|
|
|
|
//
|
|
|
|
// Type of routines (and vectors to those routines) which are called on each frame
|
|
|
|
// to implement a certain state of the game (title screen, in play, game over, etc.)
|
|
|
|
//
|
|
|
|
// This type is also used as the type for the interrupt vector, even though
|
|
|
|
// the interrupt routine saves and restores everything before being called and
|
|
|
|
// thus clearly does not actually trash all the registers. It is declared this
|
|
|
|
// way so that the game state routines, which do trash these registers, can be
|
|
|
|
// assigned to it.
|
|
|
|
//
|
|
|
|
// This type is also used as the type for the location the old interrupt vector
|
2018-02-06 11:41:32 +00:00
|
|
|
// is backed up to, because all the game state routines `goto` the old handler
|
2018-02-06 10:41:21 +00:00
|
|
|
// and the end of their own routines, so the type needs to be compatible.
|
|
|
|
// (In a good sense, it is a continuation.)
|
|
|
|
//
|
|
|
|
// Further,
|
|
|
|
//
|
|
|
|
// It's very arguable that screen1/2/3/4 and colormap1/2/3/4 are not REALLY inputs.
|
|
|
|
// They're only there to support the fact that game states sometimes clear the
|
|
|
|
// screen, and sometimes don't. When they don't, they preserve the screen, and
|
|
|
|
// currently the way to say "we preserve the screen" is to have it as both input
|
|
|
|
// and output. There is probably a better way to do this, but it needs thought.
|
|
|
|
//
|
|
|
|
|
|
|
|
typedef routine
|
2018-02-09 16:59:01 +00:00
|
|
|
inputs joy2, press_fire_msg, dispatch_game_state,
|
2018-02-08 16:03:22 +00:00
|
|
|
actor_pos, actor_delta, actor_logic,
|
2018-02-06 10:41:21 +00:00
|
|
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
2018-02-09 16:59:01 +00:00
|
|
|
outputs dispatch_game_state,
|
2018-02-08 16:37:40 +00:00
|
|
|
actor_pos, actor_delta, actor_logic,
|
2018-02-06 10:41:21 +00:00
|
|
|
screen, screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
2018-02-09 16:57:49 +00:00
|
|
|
trashes a, x, y, c, z, n, v, pos, new_pos, delta, ptr, dispatch_logic
|
2018-02-06 10:41:21 +00:00
|
|
|
game_state_routine
|
|
|
|
|
2018-02-06 11:41:32 +00:00
|
|
|
//
|
|
|
|
// Routines that are called to get the new state of each actor (player, enemy, etc.)
|
|
|
|
//
|
|
|
|
// Routines that conform to this type also follow this convention:
|
|
|
|
//
|
|
|
|
// Set carry if the player perished. Carry clear otherwise.
|
|
|
|
//
|
|
|
|
|
|
|
|
typedef routine
|
|
|
|
inputs pos, delta, joy2, screen
|
|
|
|
outputs pos, delta, new_pos, screen, c
|
2018-02-09 16:57:49 +00:00
|
|
|
trashes a, x, y, z, n, v, ptr
|
2018-02-06 11:41:32 +00:00
|
|
|
logic_routine
|
|
|
|
|
2017-12-11 14:01:57 +00:00
|
|
|
// ----------------------------------------------------------------
|
2017-12-12 10:58:59 +00:00
|
|
|
// System Locations
|
2017-12-11 14:01:57 +00:00
|
|
|
// ----------------------------------------------------------------
|
|
|
|
|
2017-12-11 14:40:30 +00:00
|
|
|
byte vic_border @ 53280
|
|
|
|
byte vic_bg @ 53281
|
|
|
|
|
2018-02-06 11:36:11 +00:00
|
|
|
byte table[256] screen1 @ 1024
|
|
|
|
byte table[256] screen2 @ 1274
|
|
|
|
byte table[256] screen3 @ 1524
|
|
|
|
byte table[256] screen4 @ 1774
|
2017-12-11 14:09:55 +00:00
|
|
|
|
2018-02-06 11:36:11 +00:00
|
|
|
byte table[256] colormap1 @ 55296
|
|
|
|
byte table[256] colormap2 @ 55546
|
|
|
|
byte table[256] colormap3 @ 55796
|
|
|
|
byte table[256] colormap4 @ 56046
|
2017-12-11 14:09:55 +00:00
|
|
|
|
2017-12-07 16:14:02 +00:00
|
|
|
buffer[2048] screen @ 1024
|
|
|
|
byte joy2 @ $dc00
|
|
|
|
|
2017-12-12 10:58:59 +00:00
|
|
|
// ----------------------------------------------------------------
|
|
|
|
// Global Variables
|
|
|
|
// ----------------------------------------------------------------
|
|
|
|
|
2017-12-07 16:14:02 +00:00
|
|
|
pointer ptr @ 254
|
2017-12-13 13:14:10 +00:00
|
|
|
|
2018-02-06 11:36:11 +00:00
|
|
|
word table[256] actor_pos
|
2017-12-07 16:14:02 +00:00
|
|
|
word pos
|
2017-12-13 14:29:24 +00:00
|
|
|
word new_pos
|
2017-12-13 13:14:10 +00:00
|
|
|
|
2018-02-06 11:36:11 +00:00
|
|
|
word table[256] actor_delta
|
2017-12-07 16:14:02 +00:00
|
|
|
word delta
|
2017-12-13 12:24:11 +00:00
|
|
|
|
2018-02-12 14:53:49 +00:00
|
|
|
vector logic_routine table[256] actor_logic
|
2018-02-06 15:03:59 +00:00
|
|
|
vector logic_routine dispatch_logic
|
|
|
|
|
2018-02-06 11:36:11 +00:00
|
|
|
byte table[32] press_fire_msg: "PRESS`FIRE`TO`PLAY"
|
2017-12-07 16:14:02 +00:00
|
|
|
|
2017-12-11 14:40:30 +00:00
|
|
|
//
|
|
|
|
// Points to the routine that implements the current game state.
|
|
|
|
//
|
|
|
|
|
2018-02-06 10:41:21 +00:00
|
|
|
vector game_state_routine
|
2018-02-05 18:14:44 +00:00
|
|
|
dispatch_game_state
|
2017-12-11 14:40:30 +00:00
|
|
|
|
2017-12-07 16:14:02 +00:00
|
|
|
//
|
2018-02-06 10:41:21 +00:00
|
|
|
// Interrupt vector. Has same type as game states (see above.)
|
2017-12-07 16:14:02 +00:00
|
|
|
//
|
|
|
|
|
2018-02-06 10:41:21 +00:00
|
|
|
vector game_state_routine
|
2018-02-05 18:14:44 +00:00
|
|
|
cinv @ 788
|
2017-12-07 16:14:02 +00:00
|
|
|
|
2018-02-06 10:41:21 +00:00
|
|
|
//
|
|
|
|
// Location to which the old interrupt vector is saved before replacement.
|
|
|
|
//
|
|
|
|
|
|
|
|
vector game_state_routine
|
2018-02-05 18:14:44 +00:00
|
|
|
save_cinv
|
2017-12-07 16:14:02 +00:00
|
|
|
|
2017-12-11 14:01:57 +00:00
|
|
|
// ----------------------------------------------------------------
|
2017-12-11 14:09:55 +00:00
|
|
|
// Utility Routines
|
2017-12-11 14:01:57 +00:00
|
|
|
// ----------------------------------------------------------------
|
|
|
|
|
2017-12-07 16:14:02 +00:00
|
|
|
routine read_stick
|
|
|
|
inputs joy2
|
|
|
|
outputs delta
|
|
|
|
trashes a, x, z, n
|
|
|
|
{
|
|
|
|
ld x, joy2
|
|
|
|
ld a, x
|
|
|
|
and a, 1 // up
|
|
|
|
if z {
|
|
|
|
copy $ffd8, delta // -40
|
|
|
|
} else {
|
|
|
|
ld a, x
|
|
|
|
and a, 2 // down
|
|
|
|
if z {
|
|
|
|
copy word 40, delta
|
|
|
|
} else {
|
|
|
|
ld a, x
|
|
|
|
and a, 4 // left
|
|
|
|
if z {
|
|
|
|
copy $ffff, delta // -1
|
|
|
|
} else {
|
|
|
|
ld a, x
|
|
|
|
and a, 8 // right
|
|
|
|
if z {
|
|
|
|
copy word 1, delta
|
|
|
|
} else {
|
|
|
|
copy word 0, delta
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-12 10:58:59 +00:00
|
|
|
// 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.
|
|
|
|
|
2018-02-09 16:59:01 +00:00
|
|
|
define check_button routine
|
|
|
|
inputs joy2
|
|
|
|
outputs c
|
2017-12-12 10:58:59 +00:00
|
|
|
trashes a, z, n
|
2018-02-09 16:59:01 +00:00
|
|
|
static byte button_down : 0
|
2017-12-12 10:58:59 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-11 14:09:55 +00:00
|
|
|
routine clear_screen
|
|
|
|
outputs screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
|
|
|
trashes a, y, c, n, z
|
|
|
|
{
|
|
|
|
ld y, 0
|
|
|
|
repeat {
|
|
|
|
ld a, 1
|
|
|
|
st a, colormap1 + y
|
|
|
|
st a, colormap2 + y
|
|
|
|
st a, colormap3 + y
|
|
|
|
st a, colormap4 + y
|
|
|
|
|
|
|
|
ld a, 32
|
|
|
|
st a, screen1 + y
|
|
|
|
st a, screen2 + y
|
|
|
|
st a, screen3 + y
|
|
|
|
st a, screen4 + y
|
|
|
|
|
|
|
|
inc y
|
|
|
|
cmp y, 250
|
|
|
|
} until z
|
|
|
|
}
|
|
|
|
|
2017-12-13 14:29:24 +00:00
|
|
|
routine calculate_new_position
|
|
|
|
inputs pos, delta
|
|
|
|
outputs new_pos
|
|
|
|
trashes a, c, n, z, v
|
|
|
|
{
|
|
|
|
copy pos, new_pos
|
|
|
|
st off, c
|
|
|
|
add new_pos, delta
|
|
|
|
}
|
|
|
|
|
2018-02-09 16:57:49 +00:00
|
|
|
define check_new_position_in_bounds routine
|
2017-12-13 15:53:43 +00:00
|
|
|
inputs new_pos
|
2017-12-13 14:29:24 +00:00
|
|
|
outputs c
|
2018-02-09 16:57:49 +00:00
|
|
|
trashes a, z, n, v
|
|
|
|
static word compare_target : 0
|
2017-12-13 14:29:24 +00:00
|
|
|
{
|
2017-12-13 15:53:43 +00:00
|
|
|
copy 1000, compare_target
|
2017-12-13 14:29:24 +00:00
|
|
|
st on, c
|
2017-12-13 15:53:43 +00:00
|
|
|
sub compare_target, new_pos
|
|
|
|
|
|
|
|
if not c {
|
|
|
|
copy word 0, compare_target
|
|
|
|
st on, c
|
|
|
|
sub compare_target, new_pos
|
|
|
|
if not c {
|
|
|
|
st off, c
|
2017-12-13 16:05:18 +00:00
|
|
|
} else {
|
|
|
|
st on, c
|
2017-12-13 15:53:43 +00:00
|
|
|
}
|
|
|
|
} else {
|
2017-12-13 16:05:18 +00:00
|
|
|
st on, c
|
2017-12-13 15:53:43 +00:00
|
|
|
}
|
2017-12-13 14:29:24 +00:00
|
|
|
}
|
|
|
|
|
2017-12-14 10:13:47 +00:00
|
|
|
routine init_game
|
2018-02-06 15:03:59 +00:00
|
|
|
inputs actor_pos, actor_delta, actor_logic
|
2018-02-08 16:03:22 +00:00
|
|
|
outputs actor_pos, actor_delta, actor_logic
|
|
|
|
trashes pos, a, y, z, n, c, v
|
2017-12-14 10:13:47 +00:00
|
|
|
{
|
|
|
|
ld y, 0
|
|
|
|
copy word 0, pos
|
|
|
|
repeat {
|
|
|
|
copy pos, actor_pos + y
|
|
|
|
copy word 40, actor_delta + y
|
2018-02-12 15:59:20 +00:00
|
|
|
copy enemy_logic, actor_logic + y
|
2017-12-14 10:13:47 +00:00
|
|
|
|
|
|
|
st off, c
|
|
|
|
add pos, word 7
|
|
|
|
|
|
|
|
inc y
|
|
|
|
cmp y, 16
|
|
|
|
} until z
|
|
|
|
|
|
|
|
ld y, 0
|
|
|
|
copy word 0, actor_pos + y
|
|
|
|
copy word 0, actor_delta + y
|
2018-02-12 15:59:20 +00:00
|
|
|
copy player_logic, actor_logic + y
|
2017-12-14 10:13:47 +00:00
|
|
|
}
|
|
|
|
|
2017-12-11 14:01:57 +00:00
|
|
|
// ----------------------------------------------------------------
|
2017-12-13 13:14:10 +00:00
|
|
|
// Actor Logics
|
2017-12-11 14:01:57 +00:00
|
|
|
// ----------------------------------------------------------------
|
|
|
|
|
2018-02-06 11:41:32 +00:00
|
|
|
define player_logic logic_routine
|
2017-12-07 16:14:02 +00:00
|
|
|
{
|
|
|
|
call read_stick
|
|
|
|
|
2017-12-13 14:29:24 +00:00
|
|
|
call calculate_new_position
|
|
|
|
call check_new_position_in_bounds
|
2017-12-07 16:14:02 +00:00
|
|
|
|
2017-12-13 14:29:24 +00:00
|
|
|
if c {
|
|
|
|
copy ^screen, ptr
|
|
|
|
st off, c
|
|
|
|
add ptr, new_pos
|
|
|
|
ld y, 0
|
|
|
|
|
2017-12-13 16:11:02 +00:00
|
|
|
// check collision.
|
2018-02-08 11:58:24 +00:00
|
|
|
ld a, [ptr] + y
|
2017-12-14 11:59:09 +00:00
|
|
|
// if "collision" is with your own self, treat it as if it's blank space!
|
|
|
|
cmp a, 81
|
|
|
|
if z {
|
|
|
|
ld a, 32
|
|
|
|
}
|
2017-12-13 16:18:36 +00:00
|
|
|
cmp a, 32
|
|
|
|
if z {
|
2017-12-13 17:00:21 +00:00
|
|
|
copy ^screen, ptr
|
|
|
|
st off, c
|
|
|
|
add ptr, pos
|
|
|
|
copy 32, [ptr] + y
|
|
|
|
|
|
|
|
copy new_pos, pos
|
2017-12-14 11:04:19 +00:00
|
|
|
|
2017-12-14 11:59:09 +00:00
|
|
|
copy ^screen, ptr
|
|
|
|
st off, c
|
|
|
|
add ptr, pos
|
|
|
|
copy 81, [ptr] + y
|
|
|
|
|
2017-12-14 11:04:19 +00:00
|
|
|
st off, c
|
2017-12-13 16:18:36 +00:00
|
|
|
} else {
|
2017-12-14 11:04:19 +00:00
|
|
|
st on, c
|
2017-12-13 16:18:36 +00:00
|
|
|
}
|
2017-12-13 14:29:24 +00:00
|
|
|
|
2017-12-13 15:30:20 +00:00
|
|
|
// FIXME these trashes, strictly speaking, probably shouldn't be needed,
|
2018-02-08 14:20:17 +00:00
|
|
|
// but currently the compiler cares a little too much about values that are
|
|
|
|
// initialized in one branch of an `if`, but not the other, but are trashed
|
2017-12-13 15:30:20 +00:00
|
|
|
// at the end of the routine anyway.
|
|
|
|
trash ptr
|
|
|
|
trash y
|
|
|
|
trash v
|
2017-12-14 10:47:57 +00:00
|
|
|
} else {
|
2017-12-14 11:04:19 +00:00
|
|
|
st off, c
|
2017-12-13 14:29:24 +00:00
|
|
|
}
|
2017-12-13 13:14:10 +00:00
|
|
|
}
|
|
|
|
|
2018-02-06 11:41:32 +00:00
|
|
|
define enemy_logic logic_routine
|
2018-02-09 16:57:49 +00:00
|
|
|
static word compare_target : 0
|
2017-12-13 13:14:10 +00:00
|
|
|
{
|
2017-12-14 12:05:44 +00:00
|
|
|
call calculate_new_position
|
|
|
|
call check_new_position_in_bounds
|
|
|
|
|
|
|
|
if c {
|
|
|
|
copy ^screen, ptr
|
|
|
|
st off, c
|
|
|
|
add ptr, new_pos
|
|
|
|
ld y, 0
|
|
|
|
|
|
|
|
// check collision.
|
2018-02-08 11:58:24 +00:00
|
|
|
ld a, [ptr] + y
|
2017-12-14 12:05:44 +00:00
|
|
|
// if "collision" is with your own self, treat it as if it's blank space!
|
|
|
|
cmp a, 82
|
|
|
|
if z {
|
|
|
|
ld a, 32
|
|
|
|
}
|
|
|
|
cmp a, 32
|
|
|
|
if z {
|
|
|
|
copy ^screen, ptr
|
|
|
|
st off, c
|
|
|
|
add ptr, pos
|
|
|
|
copy 32, [ptr] + y
|
|
|
|
|
|
|
|
copy new_pos, pos
|
|
|
|
|
|
|
|
copy ^screen, ptr
|
|
|
|
st off, c
|
|
|
|
add ptr, pos
|
|
|
|
copy 82, [ptr] + y
|
2017-12-14 10:13:47 +00:00
|
|
|
|
2017-12-14 12:05:44 +00:00
|
|
|
st off, c
|
|
|
|
} else {
|
|
|
|
st on, c
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME these trashes, strictly speaking, probably shouldn't be needed,
|
|
|
|
// but currently the compiler cares too much about values that are
|
|
|
|
// initialized in one branch of an `if`, but not the other, but trashed
|
|
|
|
// at the end of the routine anyway.
|
|
|
|
trash ptr
|
|
|
|
trash y
|
|
|
|
} else {
|
2018-01-08 12:10:59 +00:00
|
|
|
copy delta, compare_target
|
|
|
|
st on, c
|
|
|
|
sub compare_target, word 40
|
|
|
|
if not z {
|
|
|
|
copy word 40, delta
|
|
|
|
} else {
|
|
|
|
copy $ffd8, delta
|
|
|
|
}
|
2017-12-14 12:05:44 +00:00
|
|
|
}
|
2017-12-14 11:04:19 +00:00
|
|
|
|
|
|
|
st off, c
|
2017-12-13 13:14:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------
|
|
|
|
// Game States
|
|
|
|
// ----------------------------------------------------------------
|
|
|
|
|
2018-02-06 10:41:21 +00:00
|
|
|
define game_state_title_screen game_state_routine
|
2017-12-14 10:47:57 +00:00
|
|
|
{
|
|
|
|
ld y, 0
|
|
|
|
repeat {
|
2018-03-06 15:52:21 +00:00
|
|
|
|
|
|
|
// First we "clip" the index to 0-31 to ensure we don't
|
|
|
|
// read outside the bounds of the table:
|
|
|
|
ld a, y
|
|
|
|
and a, 31
|
|
|
|
ld y, a
|
|
|
|
|
2017-12-14 10:47:57 +00:00
|
|
|
ld a, press_fire_msg + y
|
|
|
|
|
|
|
|
st on, c
|
|
|
|
sub a, 64 // yuck. oh well
|
|
|
|
|
|
|
|
st a, screen1 + y
|
|
|
|
inc y
|
|
|
|
cmp y, 18
|
|
|
|
} until z
|
|
|
|
|
|
|
|
st off, c
|
|
|
|
call check_button
|
|
|
|
|
|
|
|
if c {
|
|
|
|
call clear_screen
|
|
|
|
call init_game
|
2018-02-12 15:59:20 +00:00
|
|
|
copy game_state_play, dispatch_game_state
|
2017-12-14 10:47:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
goto save_cinv
|
|
|
|
}
|
|
|
|
|
2018-02-06 10:41:21 +00:00
|
|
|
define game_state_play game_state_routine
|
2018-02-09 16:46:53 +00:00
|
|
|
static byte save_x : 0
|
2017-12-13 13:14:10 +00:00
|
|
|
{
|
|
|
|
ld x, 0
|
|
|
|
repeat {
|
|
|
|
copy actor_pos + x, pos
|
|
|
|
copy actor_delta + x, delta
|
|
|
|
|
|
|
|
st x, save_x
|
|
|
|
|
2018-02-06 15:03:59 +00:00
|
|
|
copy actor_logic + x, dispatch_logic
|
2018-02-07 13:58:10 +00:00
|
|
|
call dispatch_logic
|
2017-12-13 13:14:10 +00:00
|
|
|
|
2017-12-14 11:04:19 +00:00
|
|
|
if c {
|
|
|
|
// Player died! Want no dead! Break out of the loop (this is a bit awkward.)
|
|
|
|
call clear_screen
|
2018-02-12 15:59:20 +00:00
|
|
|
copy game_state_game_over, dispatch_game_state
|
2017-12-14 11:04:19 +00:00
|
|
|
ld x, 15
|
|
|
|
} else {
|
2018-02-06 15:03:59 +00:00
|
|
|
ld x, save_x
|
2017-12-14 11:04:19 +00:00
|
|
|
}
|
|
|
|
|
2017-12-13 13:14:10 +00:00
|
|
|
copy pos, actor_pos + x
|
|
|
|
copy delta, actor_delta + x
|
|
|
|
|
|
|
|
inc x
|
|
|
|
cmp x, 16
|
|
|
|
} until z
|
2017-12-07 16:14:02 +00:00
|
|
|
|
|
|
|
goto save_cinv
|
|
|
|
}
|
|
|
|
|
2018-02-06 10:41:21 +00:00
|
|
|
define game_state_game_over game_state_routine
|
2017-12-11 14:40:30 +00:00
|
|
|
{
|
|
|
|
st off, c
|
2017-12-12 10:58:59 +00:00
|
|
|
call check_button
|
2017-12-11 14:40:30 +00:00
|
|
|
|
|
|
|
if c {
|
2017-12-13 12:32:24 +00:00
|
|
|
call clear_screen
|
2017-12-14 10:13:47 +00:00
|
|
|
call init_game
|
2017-12-14 10:47:57 +00:00
|
|
|
copy game_state_title_screen, dispatch_game_state
|
2017-12-11 14:40:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
goto save_cinv
|
|
|
|
}
|
|
|
|
|
2017-12-11 14:01:57 +00:00
|
|
|
// *************************
|
|
|
|
// * Main Game Loop Driver *
|
|
|
|
// *************************
|
|
|
|
|
2018-02-06 10:41:21 +00:00
|
|
|
define our_cinv game_state_routine
|
2017-12-11 14:01:57 +00:00
|
|
|
{
|
|
|
|
goto dispatch_game_state
|
|
|
|
}
|
|
|
|
|
2017-12-07 16:14:02 +00:00
|
|
|
routine main
|
|
|
|
inputs cinv
|
2017-12-11 14:09:55 +00:00
|
|
|
outputs cinv, save_cinv, pos, dispatch_game_state,
|
|
|
|
screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
|
2017-12-11 14:40:30 +00:00
|
|
|
trashes a, y, n, c, z, vic_border, vic_bg
|
2017-12-07 16:14:02 +00:00
|
|
|
{
|
2017-12-11 15:21:40 +00:00
|
|
|
ld a, 5
|
|
|
|
st a, vic_border
|
|
|
|
ld a, 0
|
|
|
|
st a, vic_bg
|
|
|
|
ld y, 0
|
|
|
|
|
2017-12-11 14:09:55 +00:00
|
|
|
call clear_screen
|
2017-12-11 15:21:40 +00:00
|
|
|
|
2017-12-12 09:59:43 +00:00
|
|
|
copy game_state_title_screen, dispatch_game_state
|
2017-12-11 14:01:57 +00:00
|
|
|
|
2017-12-07 16:49:43 +00:00
|
|
|
copy word 0, pos
|
2017-12-07 16:14:02 +00:00
|
|
|
with interrupts off {
|
|
|
|
copy cinv, save_cinv
|
|
|
|
copy our_cinv, cinv
|
|
|
|
}
|
2017-12-12 15:18:59 +00:00
|
|
|
|
|
|
|
repeat { } forever
|
2017-12-07 16:14:02 +00:00
|
|
|
}
|