From b395dbcfda268fc44ee0d197efc9c934dab8241f Mon Sep 17 00:00:00 2001 From: Chris Pressey Date: Mon, 11 Dec 2017 14:01:57 +0000 Subject: [PATCH] Spiff up the demo game source a little bit. --- eg/proto-game.60p | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/eg/proto-game.60p b/eg/proto-game.60p index 228f926..9436085 100644 --- a/eg/proto-game.60p +++ b/eg/proto-game.60p @@ -1,3 +1,11 @@ +// **************************** +// * Demo Game for SixtyPical * +// **************************** + +// ---------------------------------------------------------------- +// Variables +// ---------------------------------------------------------------- + buffer[2048] screen @ 1024 byte joy2 @ $dc00 @@ -28,6 +36,17 @@ vector save_cinv outputs delta, pos, screen trashes a, x, y, c, z, n, v, ptr +// (This one is less fibby.) + +vector dispatch_game_state + inputs joy2, pos + outputs delta, pos, screen + trashes a, x, y, c, z, n, v, ptr + +// ---------------------------------------------------------------- +// Routines +// ---------------------------------------------------------------- + routine read_stick inputs joy2 outputs delta @@ -61,7 +80,11 @@ routine read_stick } } -routine our_cinv +// ---------------------------------------------------------------- +// Game States +// ---------------------------------------------------------------- + +routine game_state_play inputs joy2, pos outputs delta, pos, screen trashes a, x, y, c, z, n, v, ptr @@ -81,14 +104,30 @@ routine our_cinv goto save_cinv } +// ************************* +// * Main Game Loop Driver * +// ************************* + +routine our_cinv + inputs joy2, pos + outputs delta, pos, screen + trashes a, x, y, c, z, n, v, ptr +{ + goto dispatch_game_state +} + routine main inputs cinv - outputs cinv, save_cinv, pos + outputs cinv, save_cinv, pos, dispatch_game_state trashes a, n, z { + // jsr clear_screen + copy game_state_play, dispatch_game_state + copy word 0, pos with interrupts off { copy cinv, save_cinv copy our_cinv, cinv } + // repeat forever {} }