duke: have status bar actually update

not sure why I bother as you can't do anything that affects this yet
This commit is contained in:
Vince Weaver 2020-12-13 22:15:20 -05:00
parent 6db6144afa
commit af488e4b26
5 changed files with 191 additions and 23 deletions

View File

@ -1,24 +1,34 @@
collision detection left/right sound:
~~~~~~
click on jump
click on bump head
fancier PC-style sounds
movement:
~~~~~~~~~
collision detection up (hit head on jump) collision detection up (hit head on jump)
only calculate position once
only jump if feet on ground only jump if feet on ground
speed up walking again when land from jump, stop walking
jump slightly higher? jump slightly higher?
levels:
hook up title screen ~~~~~~~
mystery level 2 mystery level 2
more complete map status:
~~~~~~~
status: keep score, proper laser count keep score, proper laser count
sprites:
~~~~~~~~
Different sprites for left, right, shooting Different sprites for left, right, shooting
When land, kicks up dust When land, kicks up dust
Enemy? Little robot, green crawly enemies:
~~~~~~~~
Little robot
green crawly
Sound effects? items:
~~~~~~
Pick up items? red key inverse-R red/blue key inverse-R

View File

@ -38,6 +38,21 @@ duke_start:
sta LEVEL_OVER sta LEVEL_OVER
sta LASER_OUT sta LASER_OUT
sta DUKE_XL sta DUKE_XL
sta SCORE1
sta SCORE2
sta INVENTORY
lda #$10
sta SCORE0
lda #1
sta FIREPOWER
lda #2 ; draw twice (both pages)
sta UPDATE_STATUS
lda #7
sta HEALTH
lda #4 lda #4
sta DRAW_PAGE sta DRAW_PAGE
@ -50,6 +65,8 @@ duke_start:
sta DUKE_DIRECTION sta DUKE_DIRECTION
jsr update_status_bar
;==================================== ;====================================
; load level1 background ; load level1 background
;==================================== ;====================================

View File

@ -1,23 +1,128 @@
; Draw Status Bar ; Draw Status Bar
update_status_bar: ;===========================
; inc_score_by_10
;===========================
; FIXME: make sure interrupt routine handles d flag properly
inc_score_by_10:
sed
lda SCORE0
clc
adc #$10
sta SCORE0
lda SCORE1
adc #0
sta SCORE1
lda SCORE2
adc #0
sta SCORE2
cld
jsr update_score
rts rts
;===========================
; update score
;===========================
update_score:
lda SCORE0
and #$f
ora #$b0 ; 0 -> $b0
sta status_string+6
lda SCORE0
lsr
lsr
lsr
lsr
ora #$b0 ; 0 -> $b0
sta status_string+5
lda SCORE1
and #$f
ora #$b0 ; 0 -> $b0
sta status_string+4
lda SCORE1
lsr
lsr
lsr
lsr
ora #$b0 ; 0 -> $b0
sta status_string+3
lda SCORE2
and #$f
ora #$b0 ; 0 -> $b0
sta status_string+2
lda #2
sta UPDATE_STATUS
rts
;===========================
; update health
;===========================
update_health:
ldx #0
update_health_loop:
cpx HEALTH
bcc health_on
lda #'_'|$80
bne done_health
health_on:
lda #' '
done_health:
sta status_string+9,X
inx
cpx #8
bne update_health_loop
rts
;===========================
; update the status bar
;===========================
update_status_bar:
jsr update_score
jsr update_health
rts
;===========================
; draw the status bar
;===========================
draw_status_bar: draw_status_bar:
jsr inverse_text ; to improve frame rate, only draw if update status set?
; not implemented yet
jsr inverse_text ; print help node
lda #<help_string lda #<help_string
sta OUTL sta OUTL
lda #>help_string lda #>help_string
sta OUTH sta OUTH
jsr move_and_print jsr move_and_print
jsr normal_text
jsr move_and_print
jsr move_and_print
jsr inverse_text
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
rts rts
@ -27,5 +132,12 @@ help_string:
score_string: score_string:
; 012456789012345678901234567890123456789 ; 012456789012345678901234567890123456789
.byte 0,22,"SCORE HEALTH FIREPOWER INVENTORY",0 .byte 0,22,"SCORE HEALTH FIREPOWER INVENTORY",0
.byte 0,23,"00010 XXXXXXXX =-=- ",0 status_string:
.byte 7,23," ",0 ; .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

View File

@ -29,6 +29,23 @@ inverse_text:
rts rts
;=============================
; raw text
;=============================
; modify so print raw string
raw_text:
; want nop nop
lda #$EA
sta ps_smc1
lda #$EA
sta ps_smc1+1
rts
;================================ ;================================
; move_and_print ; move_and_print
;================================ ;================================

View File

@ -95,6 +95,18 @@ TILEMAP_Y = $8C
DUKE_FOOT_OFFSET = $8D DUKE_FOOT_OFFSET = $8D
FIREPOWER = $8E
INVENTORY = $8F
INV_RED_KEY = $80
INV_BLUE_KEY = $20
INV_SHOE = $08
INV_GRIP = $02
HEALTH = $90
SCORE0 = $91
SCORE1 = $92
SCORE2 = $93
UPDATE_STATUS = $94
; done game puzzle state ; done game puzzle state