Guest

vectrex

By: a guest on Aug 21st, 2011  |  syntax: None  |  size: 4.25 KB  |  hits: 96  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. ;Vecscape
  2.  
  3. ; BIOS FUNCTIONS
  4. buttons            EQU $f1ba
  5. button_state       EQU $c80f ;getting button one on controler one
  6. waitrecal          EQU $f192
  7. pen                EQU $f2fc
  8. intensitysetA      EQU $f2ab
  9. print              EQU $f37a
  10. draw_d             EQU $f3df
  11. music              EQU $fdd3 ;Change the location to the area where the start up sound you want is
  12.  
  13. ;setting up vars
  14. user_RAM     EQU $c890 ;the ram I can use.
  15.  
  16. ;Player
  17. player_x EQU user_RAM + 1 ;player postition
  18. player_y EQU player_x + 1 ;player postition
  19. lives    EQU player_y + 1 ;Lives
  20. health   EQU lives + 1 ;Health
  21.  
  22.  
  23. ;level
  24. level_on EQU health + 1
  25. ;Var setting
  26. screen_left EQU level_on + 1
  27. screen_right EQU screen_left + 1
  28. screen_up EQU screen_right + 1
  29. screen_down EQU screen_up + 1
  30. center_x EQU screen_down + 1
  31. center_y EQU center_x + 1
  32. center_up EQU center_y + 1
  33. center_down EQU center_up + 1
  34. center_left EQU center_down + 1
  35. center_right EQU center_left + 1
  36.  
  37.  
  38. ;title screen, let it flow
  39.  
  40.         ORG     $0000 ;where the ROM starts
  41.        
  42.         ;This has to be here, kinda reminds me of code signing.
  43.         FCB     $67,$20
  44.         FCC     "GCE LD21"
  45.         FCB     $80
  46.         FDB     music
  47.         FDB     $f850
  48.         FDB     $30b8
  49.         FCC     "VECSCAPE"
  50.         FCB     $80,$0
  51.      
  52. first_run: ;This happens when the game first boots up, it sets vars  
  53.         JSR buttons
  54.         LDA -127
  55.         STA screen_left
  56.         LDA 127
  57.         STA screen_right
  58.         LDA 127
  59.         STA screen_up
  60.         LDA -127
  61.         STA screen_down
  62.         LDA 0
  63.         STA center_x
  64.         LDA 0
  65.         STA center_y
  66.         LDA 67
  67.         STA center_up
  68.         LDA -67
  69.         STA center_down
  70.         LDA -67
  71.         STA center_left
  72.         LDA 67
  73.         STA center_right
  74.        
  75.  
  76.        
  77.         LDA     3 ;Sets lives to 3
  78.         STA     lives
  79.         LDA     0 ; sets player position to the center of the screen
  80.         STA     player_x
  81.         LDA     0
  82.         STA     player_y
  83.         LDA     5 ; 5 health points
  84.         STA     health
  85.         LDA     0
  86.         STA     level_on
  87.        
  88.         BRA     game_loop ;goes to the game loop
  89.        
  90.        
  91. game_loop:
  92.         CLRA
  93.         CLRB
  94.  
  95.         LDA     center_y
  96.         LDD     center_x
  97.         JSR     pen
  98.        
  99.         ;brightness of the screen
  100.         LDA     #$7f ;The intensity
  101.         JSR     intensitysetA ;SET DAT VALUe
  102.        
  103.         JSR     waitrecal ; refresh screen stuff
  104.        
  105.         LDA #00
  106.         LDD #00
  107.         JSR pen
  108.  
  109.         LDA  center_down
  110.         LDD  screen_left
  111.         JSR  draw_d
  112.         LDA  center_down
  113.         LDD  center_right
  114.         JSR  draw_d
  115.        
  116.         JSR  player_draw
  117.         JSR  enemy_draw
  118.  
  119.         LDA level_on
  120.         CMPA 0
  121.         BEQ level_draw
  122.  
  123.        
  124.         LDA level_on
  125.         CMPA 1
  126.         BEQ leveltwo_draw
  127.  
  128.        
  129.         LDA level_on
  130.         CMPA 2
  131.         BEQ levelthree_draw
  132.        
  133.         LDA level_on
  134.         CMPA 3
  135.         BEQ end_game
  136.      
  137.         JSR take_input
  138.  
  139.         BRA   game_loop ;REPEAT
  140.        
  141.  
  142.        
  143. ;Draw objects      
  144.        
  145. player_draw: ;Draw the player
  146.        
  147.        
  148.        
  149.        
  150.         RTS
  151.  
  152. enemy_draw: ;Draw tha enemies.
  153.      
  154.        
  155.         RTS
  156.  
  157. ;INPUT
  158. take_input:
  159.        
  160.         JSR buttons
  161.         CMPA #$01
  162.         BEQ level_win
  163.         RTS
  164.  
  165.  
  166.  
  167. ;LEVELS!
  168.  
  169.  
  170.  
  171. level_draw: ;Draw the level
  172.          JSR  take_input
  173.        
  174.   ;      LDA 50
  175.    ;     LDD 90
  176.     ;    JSR draw_d
  177.        
  178.         CLRA
  179.         ;LDA #00
  180.         ;LDD #00
  181.         ;JSR pen
  182.        
  183.         BRA game_loop
  184.  
  185.  
  186.  
  187.        
  188. leveltwo_draw:  
  189.         JSR  take_input
  190.  
  191.         BRA game_loop
  192.        
  193. levelthree_draw:  
  194.         JSR  take_input
  195.  
  196.         BRA game_loop      
  197.  
  198. end_game:
  199.       JSR  take_input
  200.       LDA 0
  201.       LDD 0
  202.       JSR pen
  203.       LDA -50
  204.       LDD 0
  205.       JSR draw_d
  206.       LDA 3
  207.       STA level_on
  208.       BRA end_game
  209.  
  210. ;Stuff
  211.  
  212. game_over: ;GAME OVER MAN, GAME OVER.
  213.  
  214.  
  215.         BRA gameover_set
  216.  
  217. gameover_set:
  218.        
  219.         BRA    first_run
  220.      
  221. level_win:
  222.       LDA   level_on
  223.       INCA
  224.       STA level_on
  225.       BRA game_loop
  226.  
  227.  
  228.  
  229.      
  230.  
  231. music1:
  232.       JSR music