Just to give you an idea of what the code skeleton provides, consider the following routine. This is the "Level Initialization" routine, intended to initialize the game world when a new level starts (or when the game starts, if there are no levels).
Notice that it has lots of comments on what it is doing, and gives you ideas of what else to add for your own game.
;;==========================================================================;;
;; Title: P-Machinery Game Engine (State Machine) ;;
;; By: DZ-Jay ;;
;; Description: Defines functions to handle the game's main state machine's ;;
;; individual states. ;;
;; ;;
;; Copyright 2010-2011, James Pujals (DZ-Jay), <dz-game@techunlimited.net>. ;;
;;==========================================================================;;
;; ======================================================================== ;;
;; ;;
;; ----------------------------------------------------------------------- ;;
;; WARNING! ACHTUNG! WARNING! ACHTUNG! WARNING! ACHTUNG! WARNING! ACHTUNG! ;;
;; ----------------------------------------------------------------------- ;;
;; ;;
;; The initialization sequence, including state transitions and scheduled ;;
;; tasks, are arranged in a particular way. This is by design. Changing ;;
;; any step may impact the overall state of the intializer, causing ;;
;; unexpected results. ;;
;; ;;
;; DO NOT change unless you really know what you are doing! ;;
;; ======================================================================== ;;
;; ======================================================================== ;;
;; ST_LVL_INIT: ISR routine to handle game level initialization. ;;
;; ======================================================================== ;;
ST_LVL_INIT PROC
DIS ; Start Critical Section
; --------------------------------------
; Perform any level initialization here.
; The display is disabled so we have free
; reign over the bus to access the STIC
; and GRAM, with no time limit.
;
; Here is a good place to load all the
; graphics into GRAM, initialize sprites
; and draw the play-field.
;
; The level initialization routine can last
; as long as it needs to, and the screen
; will just remain blank in the meantime.
;
; At the end of initialization, we'll
; transition to the "Level Play" state,
; where the play-field and MOBs will be
; ready to go, and the display will be
; enabled.
; --------------------------------------
; Initialize the Color Stack
MVII #C_BLK, R0 ; Set up the color stack
MVO R0, STIC.cs0 ; 0 = Black
MVO R0, STIC.cs1 ; 1 = Black
MVO R0, STIC.cs2 ; 2 = Black
MVO R0, STIC.cs3 ; 3 = Black
MVO R0, STIC.bord ; Set the border black too
; Initialize environment for new game state
CALL STOPALLTASKS ; 1. Stop all tasks
CALL RESET_CTRL.Force ; 2. Reset Input Controller values
CALL RESET_STIC ; 3. Reset the STIC (clone) registers
CALL CLRSCR ; 4. Clear the screen
CLRR R0
MVII #PLAYER_INFO.Score, R4
MVO@ R0, R4 ; \_ Reset score
MVO@ R0, R4 ; /
MVO@ R0, R4 ; Reset lives
MVO@ R0, R4 ; Reset current direction
MVO@ R0, R4 ; Reset stand-by direction
MVII #MAXTSK, R0 ; \_ Activate all tasks, ready for play!
MVO R0, TSKACT ; /
; Interrupts are enabled on return
SET_GAME_STATE(LEVEL, Play, cNormal) ; Engage the Level Play engine.
IRET
ENDP
And below is the main "Game Play" engine. This routine is called continuously from the game loop to update the game world. Notice how it just performs some "housekeeping" stuff like check for pause and process timers, but it hints as to what you could add for your game.
;; ======================================================================== ;;
;; ST_LVL_ENGINE: ISR routine to handle a game level. ;;
;; ======================================================================== ;;
ST_LVL_PLAY PROC
; --------------------------------------
; These access GRAM or the STIC, and so
; need to run as soon as possible at the
; top of the ISR routine.
; --------------------------------------
ISR_ENABLE_DISPLAY
CALL POST_STIC_X
; --------------------------------------
; Perfom all engine tasks or add them
; to the task queue as necessary:
; - Update STIC
; - Update PSG
; - Cycle GRAM cards
; - Update score display
; - Move all sprites
; - Check collisions
; - Animate sprites
; - etc.
; --------------------------------------
; --------------------------------------
; Process all timed tasks and counters.
; --------------------------------------
DCALL DOTIMER, iEnabled
CALL PAUSE_GAME ; Check for pause
IRET
ENDP