mist: draw controls in rocket

This commit is contained in:
Vince Weaver 2020-03-14 14:20:32 -04:00
parent 8dbb04d591
commit 7c89f170e6
3 changed files with 135 additions and 219 deletions

View File

@ -1,3 +1,7 @@
;==========================
; o/` Standing in my yard
; where they tore down the garage
; to make room for the torn down garage o/`
organ_pressed: organ_pressed:
ldy #0 ldy #0
@ -98,6 +102,131 @@ sharp_notes:
;=========================
; draw the buttons
;=========================
spaceship_draw_buttons:
ldx #0
draw_ss_buttons_outer_loop:
ldy #28 ; 13,28
draw_ss_buttons_loop:
lda gr_offsets,Y
clc
adc #13 ; 13,28
sta ss_buttons_smc+1
iny
lda gr_offsets,Y
clc
adc DRAW_PAGE
sta ss_buttons_smc+2
iny
; calculate slider status
; i.e. color
; if Y matches slide
; Y=26 and ROCKET_NOTE1=0 $50
; Y=26 and ROCKET_NOTE1=1 $05
; Y=24 and ROCKET_NOTE1=2 $50
; Y=24 and ROCKET_NOTE1=3 $05
; Y=22 and ROCKET_NOTE1=4 $50
; Y=22 and ROCKET_NOTE1=5 $05
; if Y==44-(RN&0xfe) (44 because pre-incremented)
lda rocket_notes,X
and #$fe
sta TEMP
lda #44
sec
sbc TEMP
sta TEMP
cpy TEMP
bne ss_button_none
lda rocket_notes,X
and #$1
beq ss_button_bottom
ss_button_top:
lda #$05
bne ss_buttons_smc
ss_button_bottom:
lda #$50
bne ss_buttons_smc
ss_button_none:
lda #$00
ss_buttons_smc:
sta $400,X
cpy #44
bne draw_ss_buttons_loop
inx
inx
cpx #10
bne draw_ss_buttons_outer_loop
rts
; twice as many as necessary as X increments by two
rocket_notes:
.byte $00,$00,$1,$00,$5,$00,$0a,$00
.if 0
draw_buttons_loop:
; top button
lda SWITCH_TOP_ROW
and button_lookup,X
beq top_button_off
top_button_on:
ldy #$95
bne top_button_draw_smc
top_button_off:
ldy #$35
top_button_draw_smc:
sty $4d0+25
inc top_button_draw_smc+1
inc top_button_draw_smc+1
; bottom button
lda SWITCH_BOTTOM_ROW
and button_lookup,X
beq bottom_button_off
bottom_button_on:
ldy #$19
bne bottom_button_draw_smc
bottom_button_off:
ldy #$13
bottom_button_draw_smc:
sty $5d0+26
inc bottom_button_draw_smc+1
inc bottom_button_draw_smc+1
inx
cpx #5
bne draw_buttons_loop
rts
.endif
@ -246,218 +375,6 @@ done_rocket_volts:
rts rts
;===========================
; draw the voltage displays
;===========================
generator_update_volts:
; gradually adjust generator voltage
sed
lda GENERATOR_VOLTS_DISP
cmp GENERATOR_VOLTS
beq no_adjust_gen_volts
bcs gen_volts_dec
clc
adc #1
jmp done_adjust_gen_volts
gen_volts_dec:
sec
sbc #1
done_adjust_gen_volts:
sta GENERATOR_VOLTS_DISP
no_adjust_gen_volts:
; gradually adjust rocket voltage
lda ROCKET_VOLTS_DISP
cmp ROCKET_VOLTS
beq no_adjust_rocket_volts
bcs rocket_volts_dec
clc
adc #1
jmp done_adjust_rocket_volts
rocket_volts_dec:
sec
sbc #1
done_adjust_rocket_volts:
sta ROCKET_VOLTS_DISP
no_adjust_rocket_volts:
cld
lda DRAW_PAGE
clc
adc #$6
sta gen_volt_ones_smc+2
sta gen_volt_tens_smc+2
sta rocket_volt_ones_smc+2
sta rocket_volt_tens_smc+2
sta gen_put_needle_smc+2
sta rocket_put_needle_smc+2
lda GENERATOR_VOLTS_DISP
and #$f
clc
adc #$b0
gen_volt_ones_smc:
sta $6d0+14 ; 14,21
lda GENERATOR_VOLTS_DISP
lsr
lsr
lsr
lsr
and #$f
clc
adc #$b0
gen_volt_tens_smc:
sta $6d0+13 ; 13,21
; draw gen needle
lda GENERATOR_VOLTS_DISP
ldx #0
cmp #$25
bcc gen_put_needle
inx
cmp #$50
bcc gen_put_needle
inx
cmp #$75
bcc gen_put_needle
inx
gen_put_needle:
txa
asl
asl
tax
ldy #0
gen_put_needle_loop:
lda needle_strings,X
gen_put_needle_smc:
sta $650+12,Y
iny
inx
cpy #4
bne gen_put_needle_loop
lda ROCKET_VOLTS_DISP
and #$f
clc
adc #$b0
rocket_volt_ones_smc:
sta $6d0+21 ; 21,21
lda ROCKET_VOLTS_DISP
lsr
lsr
lsr
lsr
and #$f
clc
adc #$b0
rocket_volt_tens_smc:
sta $6d0+20 ; 20,21
; draw rocket needle
lda ROCKET_VOLTS_DISP
ldx #0
cmp #$25
bcc rocket_put_needle
inx
cmp #$50
bcc rocket_put_needle
inx
cmp #$75
bcc rocket_put_needle
inx
rocket_put_needle:
txa
asl
asl
tax
ldy #0
rocket_put_needle_loop:
lda needle_strings,X
rocket_put_needle_smc:
sta $650+19,Y
iny
inx
cpy #4
bne rocket_put_needle_loop
rts
;=========================
; draw the buttons
;=========================
generator_draw_buttons:
ldx #0
clc
lda DRAW_PAGE
adc #$4
sta top_button_draw_smc+2
adc #$1
sta bottom_button_draw_smc+2
lda #$d0+25
sta top_button_draw_smc+1
adc #$1
sta bottom_button_draw_smc+1
draw_buttons_loop:
; top button
lda SWITCH_TOP_ROW
and button_lookup,X
beq top_button_off
top_button_on:
ldy #$95
bne top_button_draw_smc
top_button_off:
ldy #$35
top_button_draw_smc:
sty $4d0+25
inc top_button_draw_smc+1
inc top_button_draw_smc+1
; bottom button
lda SWITCH_BOTTOM_ROW
and button_lookup,X
beq bottom_button_off
bottom_button_on:
ldy #$19
bne bottom_button_draw_smc
bottom_button_off:
ldy #$13
bottom_button_draw_smc:
sty $5d0+26
inc bottom_button_draw_smc+1
inc bottom_button_draw_smc+1
inx
cpx #5
bne draw_buttons_loop
rts
.endif .endif

View File

@ -76,9 +76,12 @@ game_loop:
; handle special-case forground logic ; handle special-case forground logic
;==================================== ;====================================
; lda LOCATION lda LOCATION
; cmp #2 cmp #1
; bne nothing_special bne nothing_special
; draw the buttons
jsr spaceship_draw_buttons
; handle animated linking book ; handle animated linking book

View File

@ -81,10 +81,6 @@ SWITCH_TOP_ROW = $98
SWITCH_BOTTOM_ROW = $99 SWITCH_BOTTOM_ROW = $99
GENERATOR_VOLTS_DISP = $9A GENERATOR_VOLTS_DISP = $9A
ROCKET_VOLTS_DISP = $9B ROCKET_VOLTS_DISP = $9B
ROCKET_NOTE1 = $9C
ROCKET_NOTE2 = $9D
ROCKET_NOTE3 = $9E
ROCKET_NOTE4 = $9F
DISP_PAGE = $ED ; ALL DISP_PAGE = $ED ; ALL