diff --git a/games/keen/Makefile b/games/keen/Makefile index c9b0e1a4..8c134e9f 100644 --- a/games/keen/Makefile +++ b/games/keen/Makefile @@ -40,7 +40,7 @@ loader.o: loader.s KEEN_TITLE: keen_title.o ld65 -o KEEN_TITLE keen_title.o -C ../../linker_scripts/apple2_4000.inc -keen_title.o: keen_title.s zp.inc hardware.inc init_vars.s \ +keen_title.o: keen_title.s zp.inc hardware.inc \ zx02_optim.s \ graphics/keen1_title.hgr.zx02 ca65 -o keen_title.o keen_title.s -l keen_title.lst diff --git a/games/keen/enemies_level1.s b/games/keen/enemies_level1.s index 8661a783..7a7012ad 100644 --- a/games/keen/enemies_level1.s +++ b/games/keen/enemies_level1.s @@ -45,7 +45,7 @@ hit_something: jsr enemy_noise - jsr inc_score_by_10 +; jsr inc_score_by_10 jmp exit_laser_enemy diff --git a/games/keen/init_vars.s b/games/keen/init_vars.s deleted file mode 100644 index 9e495618..00000000 --- a/games/keen/init_vars.s +++ /dev/null @@ -1,31 +0,0 @@ - - ;===================== - ; init vars - ;===================== -init_vars: - lda #0 - sta ANIMATE_FRAME - sta FRAMEL - sta FRAMEH - sta JOYSTICK_ENABLED - sta KEEN_WALKING - sta KEEN_JUMPING - sta LEVEL_OVER - sta LASER_OUT - sta KEEN_XL - sta SCORE0 - sta SCORE1 - sta SCORE2 - sta KEEN_FALLING - sta KEEN_SHOOTING - sta KICK_UP_DUST - sta DOOR_ACTIVATED - sta INVENTORY - - lda #1 - sta FIREPOWER - - lda #4 - sta KEENS - - rts diff --git a/games/keen/keen_level1.s b/games/keen/keen_level1.s index 931bc442..a27622bc 100644 --- a/games/keen/keen_level1.s +++ b/games/keen/keen_level1.s @@ -33,20 +33,15 @@ keen_start: sta ANIMATE_FRAME sta FRAMEL sta FRAMEH - sta JOYSTICK_ENABLED sta KEEN_WALKING sta KEEN_JUMPING sta LEVEL_OVER sta LASER_OUT sta KEEN_XL - sta SCORE0 - sta SCORE1 - sta SCORE2 sta KEEN_FALLING sta KEEN_SHOOTING sta KICK_UP_DUST - sta DOOR_ACTIVATED - sta INVENTORY + sta KEYCARDS lda #enemy_data -; sta ENEMY_DATAH - - ; FIXME: temporary -; lda INVENTORY -; ora #INV_RED_KEY -; sta INVENTORY - -; lda #$10 -; sta SCORE0 - - lda #1 - sta FIREPOWER - - lda #2 ; draw twice (both pages) - sta UPDATE_STATUS - - lda #4 - sta KEENS lda #4 sta DRAW_PAGE diff --git a/games/keen/keen_title.s b/games/keen/keen_title.s index b4ed548c..412fdc4b 100644 --- a/games/keen/keen_title.s +++ b/games/keen/keen_title.s @@ -176,11 +176,28 @@ done_intro: bit FULLGR bit LORES - ;============================ + ;===================== ; init vars + ;===================== +init_vars: + lda #0 + sta ANIMATE_FRAME + sta FRAMEL + sta FRAMEH + sta JOYSTICK_ENABLED + sta LEVEL_OVER - jsr init_vars + sta SCORE0 ; set score to 0 + sta SCORE1 + sta SCORE2 + sta RAYGUNS ; number of laser blasts + sta KEYCARDS + sta SHIP_PARTS + sta POGO + + lda #4 ; number of lives + sta KEENS ;============================ @@ -206,7 +223,6 @@ done_intro: .include "gr_fast_clear.s" .include "text_print.s" - .include "init_vars.s" ; .include "graphics_title/title_graphics.inc" ; .include "lc_detect.s" diff --git a/games/keen/status_bar.s b/games/keen/status_bar.s index 8020c1fb..e229c146 100644 --- a/games/keen/status_bar.s +++ b/games/keen/status_bar.s @@ -1,15 +1,17 @@ ; Draw Status Bar ;=========================== - ; inc_score_by_10 + ; inc_score ;=========================== - ; FIXME: make sure interrupt routine handles d flag properly -inc_score_by_10: + ; make sure any interrupt routine handles d flag properly + ; value to add by in A (BCD/100) + ; for Keen assume always a multiple of 100 +inc_score: sed - lda SCORE0 + clc - adc #$10 + adc SCORE0 sta SCORE0 lda SCORE1 @@ -21,8 +23,6 @@ inc_score_by_10: sta SCORE2 cld - jsr update_score - rts ;=========================== @@ -34,7 +34,7 @@ update_score: lda SCORE0 and #$f ora #$b0 ; 0 -> $b0 - sta status_string+6 + sta score_string+6 lda SCORE0 lsr @@ -42,12 +42,12 @@ update_score: lsr lsr ora #$b0 ; 0 -> $b0 - sta status_string+5 + sta score_string+5 lda SCORE1 and #$f ora #$b0 ; 0 -> $b0 - sta status_string+4 + sta score_string+4 lda SCORE1 lsr @@ -55,15 +55,12 @@ update_score: lsr lsr ora #$b0 ; 0 -> $b0 - sta status_string+3 + sta score_string+3 lda SCORE2 and #$f ora #$b0 ; 0 -> $b0 - sta status_string+2 - - lda #2 - sta UPDATE_STATUS + sta score_string+2 rts @@ -72,8 +69,9 @@ update_score: ; update health ;=========================== -update_health: .if 0 +update_health: + ldx #0 update_health_loop: cpx HEALTH @@ -83,13 +81,14 @@ update_health_loop: health_on: lda #' ' done_health: - sta status_string+9,X + sta score_string+9,X inx cpx #8 bne update_health_loop -.endif + rts +.endif ;=========================== ; update items @@ -97,23 +96,23 @@ done_health: update_items: - lda INVENTORY + lda KEYCARDS and #INV_RED_KEY beq done_red_key lda #'R'&$3f - sta status_string+33 + sta score_string+33 done_red_key: - lda INVENTORY + lda KEYCARDS and #INV_BLUE_KEY beq done_blue_key lda #'B'&$3f - sta status_string+35 + sta score_string+35 done_blue_key: @@ -125,42 +124,92 @@ done_blue_key: ;=========================== ; update the status bar ;=========================== -update_status_bar: - - jsr update_score - - jsr update_health - - jsr update_items - - lda #2 - sta UPDATE_STATUS - - rts +;update_status_bar: +; +; jsr update_score +; +; jsr update_health +; +; jsr update_items +; +; lda #2 +; sta UPDATE_STATUS +; +; rts ;=========================== ; draw the status bar ;=========================== ; only draw when ENTER pressed, not always draw_status_bar: - bit TEXTGR + + jsr update_score + + + bit TEXTGR ; split graphics/text ; draw to visible frame lda DRAW_PAGE eor #$4 sta DRAW_PAGE - jsr inverse_text ; print help node - lda #help_string + lda gr_offsets+1,X + clc + adc DRAW_PAGE + sta OUTH + + ldy #39 + lda #$FF +draw_box_inner: + sta (OUTL),Y + dey + bpl draw_box_inner + + inx + inx + cpx #40 + bne draw_box_loop + + + ; draw keens + + ldx #keen_sprite_stand_right + sta INH + + ; XPOS, YPOS + + lda #2 + sta XPOS + lda #32 + sta YPOS + + jsr put_sprite_crop + + + + ; TODO: draw keycards + + ; TODO: draw parts + + ; draw text at bottom + + jsr inverse_text + lda #status_string sta OUTH jsr move_and_print - - jsr normal_text ; (normal) - jsr move_and_print ; print explain text - jsr raw_text - jsr move_and_print ; print status line + jsr move_and_print + jsr move_and_print + jsr move_and_print ; wait for keypress @@ -181,18 +230,11 @@ wait_status_bar: rts -help_string: - .byte 3,20," PRESS 'H' FOR HELP ",0 - -score_string: - ; 012456789012345678901234567890123456789 - .byte 0,22,"SCORE HEALTH FIREPOWER INVENTORY",0 status_string: -; .byte 0,23,"ZZZZZ XXXXXXXX =- ",0 - .byte 0,23,"ZZZZZ" - .byte ' '|$80,' '|$80 - .byte "XXXXXXXX" - .byte ' '|$80,' '|$80 - .byte '='|$80,'-'|$80,' '|$80,' '|$80,' '|$80,' '|$80,' '|$80,' '|$80,' '|$80,' '|$80 - .byte ' '|$80,' '|$80,' '|$80,' '|$80,' '|$80,' '|$80,' '|$80,' '|$80,' '|$80,' '|$80,' '|$80,' '|$80,0 + ; 0123456789012345678901234567890123456789 + .byte 0,20," KEENS KEYCARDS PARTS ",0 + .byte 0,21," ",0 + .byte 0,22," SCORE NEXT KEEN RAYGUN POGO ",0 +score_string: + .byte 0,23," 00000000 20000 0 N ",0 diff --git a/games/keen/zp.inc b/games/keen/zp.inc index 6f41a4f2..237e7cb7 100644 --- a/games/keen/zp.inc +++ b/games/keen/zp.inc @@ -104,17 +104,23 @@ TILEMAP_Y = $8C KEEN_FOOT_OFFSET = $8D -FIREPOWER = $8E -INVENTORY = $8F - INV_RED_KEY = $80 - INV_BLUE_KEY = $20 - INV_SHOE = $08 - INV_GRIP = $02 +RAYGUNS = $8E +KEYCARDS = $8F + INV_RED_KEY = $01 + INV_BLUE_KEY = $02 + INV_YELLOW_KEY = $04 + INV_GREEN_KEY = $08 + KEENS = $90 SCORE0 = $91 SCORE1 = $92 SCORE2 = $93 -UPDATE_STATUS = $94 + +SHIP_PARTS = $94 + PARTS_BOTTLE = $01 + PARTS_VACUUM = $02 + PARTS_BATTERY = $04 + PARTS_JOYSTICK = $08 KEEN_FALLING = $95 KEEN_SHOOTING = $96 @@ -122,7 +128,7 @@ KICK_UP_DUST = $97 SUPPRESS_WALK = $98 ENEMY_DATAL = $99 ENEMY_DATAH = $9A -DOOR_ACTIVATED = $9B +POGO = $9B LASER_TILE = $9C TILE_TEMP = $9D