
vectrex
By: a guest on Aug 21st, 2011 | syntax:
None | size: 4.25 KB | hits: 96 | expires: Never
;Vecscape
; BIOS FUNCTIONS
buttons EQU $f1ba
button_state EQU $c80f ;getting button one on controler one
waitrecal EQU $f192
pen EQU $f2fc
intensitysetA EQU $f2ab
print EQU $f37a
draw_d EQU $f3df
music EQU $fdd3 ;Change the location to the area where the start up sound you want is
;setting up vars
user_RAM EQU $c890 ;the ram I can use.
;Player
player_x EQU user_RAM + 1 ;player postition
player_y EQU player_x + 1 ;player postition
lives EQU player_y + 1 ;Lives
health EQU lives + 1 ;Health
;level
level_on EQU health + 1
;Var setting
screen_left EQU level_on + 1
screen_right EQU screen_left + 1
screen_up EQU screen_right + 1
screen_down EQU screen_up + 1
center_x EQU screen_down + 1
center_y EQU center_x + 1
center_up EQU center_y + 1
center_down EQU center_up + 1
center_left EQU center_down + 1
center_right EQU center_left + 1
;title screen, let it flow
ORG $0000 ;where the ROM starts
;This has to be here, kinda reminds me of code signing.
FCB $67,$20
FCC "GCE LD21"
FCB $80
FDB music
FDB $f850
FDB $30b8
FCC "VECSCAPE"
FCB $80,$0
first_run: ;This happens when the game first boots up, it sets vars
JSR buttons
LDA -127
STA screen_left
LDA 127
STA screen_right
LDA 127
STA screen_up
LDA -127
STA screen_down
LDA 0
STA center_x
LDA 0
STA center_y
LDA 67
STA center_up
LDA -67
STA center_down
LDA -67
STA center_left
LDA 67
STA center_right
LDA 3 ;Sets lives to 3
STA lives
LDA 0 ; sets player position to the center of the screen
STA player_x
LDA 0
STA player_y
LDA 5 ; 5 health points
STA health
LDA 0
STA level_on
BRA game_loop ;goes to the game loop
game_loop:
CLRA
CLRB
LDA center_y
LDD center_x
JSR pen
;brightness of the screen
LDA #$7f ;The intensity
JSR intensitysetA ;SET DAT VALUe
JSR waitrecal ; refresh screen stuff
LDA #00
LDD #00
JSR pen
LDA center_down
LDD screen_left
JSR draw_d
LDA center_down
LDD center_right
JSR draw_d
JSR player_draw
JSR enemy_draw
LDA level_on
CMPA 0
BEQ level_draw
LDA level_on
CMPA 1
BEQ leveltwo_draw
LDA level_on
CMPA 2
BEQ levelthree_draw
LDA level_on
CMPA 3
BEQ end_game
JSR take_input
BRA game_loop ;REPEAT
;Draw objects
player_draw: ;Draw the player
RTS
enemy_draw: ;Draw tha enemies.
RTS
;INPUT
take_input:
JSR buttons
CMPA #$01
BEQ level_win
RTS
;LEVELS!
level_draw: ;Draw the level
JSR take_input
; LDA 50
; LDD 90
; JSR draw_d
CLRA
;LDA #00
;LDD #00
;JSR pen
BRA game_loop
leveltwo_draw:
JSR take_input
BRA game_loop
levelthree_draw:
JSR take_input
BRA game_loop
end_game:
JSR take_input
LDA 0
LDD 0
JSR pen
LDA -50
LDD 0
JSR draw_d
LDA 3
STA level_on
BRA end_game
;Stuff
game_over: ;GAME OVER MAN, GAME OVER.
BRA gameover_set
gameover_set:
BRA first_run
level_win:
LDA level_on
INCA
STA level_on
BRA game_loop
music1:
JSR music