Advertisement
FireRat_Genesis

MainLoop example

Aug 13th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MainLoop
  2.         moveq   #0,d0               ; clear d0
  3.         move.w  game_state,d0       ; get game state on d0
  4.         add.w   d0,d0               ; multiply ID by 2 (if d0 = 1 -> d0 = 2)
  5.         add.w   d0,d0               ; multiply previous by 2 (if d0 = 2 -> d0 = 4)
  6.         jsr     @index(pc,d0.w)     ; jump to @index addr + d0
  7.         bra     MainLoop
  8. @index:
  9.         bra.w   TitleScreen_Init    ; (0) each bra is 4 bytes long
  10.         bra.w   TitleScreen         ; (1) each bra is 4 bytes long
  11.         bra.w   GameMode_Init       ; (2)
  12.         bra.w   GameMode            ; (3)
  13.  
  14. TitleScreen_Init:
  15.         ; <Initialization, plane loading, etc>
  16.         move.w  #1,game_state       ; change game state
  17.         rts                         ; load it
  18.  
  19. TitleScreen:
  20.         ; "main" status...
  21.         move.w  #2,game_state       ; change game state
  22.         rts                         ; load it
  23.  
  24. GameMode_Init:
  25.         ; <Initialization, plane loading, etc>
  26.         move.w  #3,game_state       ; change game state
  27.         rts                         ; load it
  28.  
  29. GameMode:
  30.         ; "main" status...
  31.         ; (...)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement