lemm: bottom menu sorta working

This commit is contained in:
Vince Weaver 2022-03-14 22:57:33 -04:00
parent 29bf0b06b8
commit 2d303093d6
8 changed files with 191 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -28,6 +28,11 @@ hgr_hlin:
lda div7_table,X ; put X1/7 into Y
tay
; reset color bits
ldx HGR_COLOR
lda hgr_colortbl,X
sta HGR_BITS
and #$1 ; only shift if in odd column?
beq hlin_no_shift_colors
jsr shift_colors
@ -185,7 +190,7 @@ done_shift_colors:
; color in X
set_hcolor:
lda hgr_colortbl,X
sta HGR_COLOR
sta HGR_BITS
rts
; lives at $F6F6 in Applesoft ROM

View File

@ -9,28 +9,36 @@ hgr_vlin:
cpy #0
beq done_hgr_vlin
; get initial ROW into (GBASL)
sta current_row_smc+1 ; save current A
; sty vlin_row_count
lda div7_table,X
lda div7_table,X ; X is X1
sta x1_save_smc+1
txa ; save X ; X is still X1
pha
ldx HGR_COLOR
lda hgr_colortbl,X
sta HGR_BITS
and #$1 ; only shift if in odd column?
beq vlin_no_shift_colors
jsr shift_colors
vlin_no_shift_colors:
pla
tax ; restore X is X1
lda mod7_table,X
tax
lda vlin_masks,X
lda vlin_masks,X ; get mask
sta vlin_mask_smc+1
tya
tax ; get line count into X
tax ; put line count into X
hgr_vlin_loop:
@ -42,7 +50,7 @@ current_row_smc:
sta GBASL
x1_save_smc:
ldy #$dd
ldy #$dd ; X1/7
lda (GBASL),Y
eor HGR_BITS
vlin_mask_smc:

View File

@ -190,10 +190,18 @@ check_return:
return_pressed:
jsr update_menu
; first check if off bottom of screen
; first check if over lemming
lda CURSOR_Y
cmp #168-8 ; center of cursor
bcc return_check_lemming
jsr handle_menu
jmp done_keypress
; next check if over lemming
return_check_lemming:
lda OVER_LEMMING
bpl not_over_lemming
@ -205,11 +213,6 @@ return_pressed:
not_over_lemming:
; TODO
; handle clicking on bottom row
done_keypress:
@ -220,3 +223,68 @@ no_keypress:
handle_menu:
; see where we clicked
lda CURSOR_X
; urgh need to multiply by 7
clc
asl
adc CURSOR_X
asl
adc CURSOR_X
clc
adc #24 ; adjust to center
lsr ; /16 for on-screen co-ords
lsr
lsr
lsr ; each box is 16 wide
cmp #3
bcc plus_minus_buttons
cmp #11
beq pause_button
cmp #12
beq nuke_button
bcs map_grid_button
; otherwise was job button
job_button:
pha
; erase old
jsr erase_menu
; update value
pla
sec
sbc #2
sta BUTTON_LOCATION
; draw new
jsr update_menu
jmp done_menu
plus_minus_buttons:
; TODO
jmp done_menu
nuke_button:
; TODO
jmp done_menu
map_grid_button:
; TODO
jmp done_menu
pause_button:
bit KEYRESET
jsr wait_until_keypress
done_menu:
rts

View File

@ -9,6 +9,7 @@ do_level1:
sta CURRENT_CHUNK
sta DONE_PLAYING
sta BASE_FRAME_L
sta BUTTON_LOCATION
lda #$D0
sta CHUNK_NEXT_LOAD ; Load at $D0

View File

@ -1,31 +1,85 @@
;
;
;
update_menu:
lda #7
jsr set_hcolor
lda BUTTON_LOCATION
bne actually_update_menu
rts
actually_update_menu:
ldx #7
stx HGR_COLOR
lda BUTTON_LOCATION
jsr draw_button
rts
;========================
;
;========================
erase_menu:
lda BUTTON_LOCATION
bne actually_erase_menu
rts
actually_erase_menu:
ldx #0
stx HGR_COLOR
lda BUTTON_LOCATION
jsr draw_button
rts
;====================
; draw button
;====================
draw_button:
; location is (1+BUTTON_LOCATION)*16
; two hlins
lda BUTTON_LOCATION
clc
adc #1
asl
asl
asl
asl
tax
sta button_smc1+1
sta button_smc2+1
sta button_smc3+1
clc
adc #15
sta button_smc4+1
button_smc1:
ldx #144
lda #168
ldy #15
jsr hgr_hlin ; (x,a) to (x+y,a)
button_smc2:
ldx #144
lda #191
ldy #15
jsr hgr_hlin ; (x,a) to (x+y,a)
; two vlins
button_smc3:
ldx #144
lda #168
ldy #47
ldy #23
jsr hgr_vlin ; (x,a) to (x,a+y)
button_smc4:
ldx #159
lda #168
ldy #47
ldy #23
jsr hgr_vlin ; (x,a) to (x,a+y)
rts

View File

@ -67,6 +67,7 @@ LEMMINGS_TO_RELEASE = $83
SAVED_Y1 = $84
SAVED_Y2 = $85
LEMMINGS_OUT = $86
BUTTON_LOCATION = $87
APPLEII_MODEL = $8B

View File

@ -176,6 +176,40 @@ loop4:
jsr wait_until_keypress
; test 5
; jsr HGR2
; draw lines
ldy #0
loop5:
ldx #0 ; draw white1
jsr set_hcolor
tya
pha
tax ; X1=Y
eor #$ff
sec
adc #192 ; Y1=192-Y
; run = Y
jsr hgr_vlin
pla
tay
iny
cpy #192
bne loop5
jsr wait_until_keypress
done:
jmp main