monkey: print current active verb

This commit is contained in:
Vince Weaver 2020-09-15 23:45:02 -04:00
parent 1ac4e8d995
commit 2cb849dfd2
5 changed files with 149 additions and 82 deletions

View File

@ -30,7 +30,7 @@ monkey.o: monkey.s zp.inc hardware.inc common_defines.inc \
common_sprites.inc \
keyboard.s joystick.s \
leveldata_monkey.inc \
monkey_actions.s \
monkey_actions.s update_bottom.s \
guy.brush
ca65 -o monkey.o monkey.s -l monkey.lst

View File

@ -57,6 +57,9 @@ monkey_start:
lda #0
sta ANIMATE_FRAME
lda #VERB_WALK
sta CURRENT_VERB
game_loop:
;=================
; reset things
@ -95,25 +98,7 @@ game_loop:
jmp nothing_special
fg_draw_blue_page:
; jsr draw_blue_page
jmp nothing_special
fg_draw_red_page:
; jsr draw_red_page
jmp nothing_special
animate_projector:
; jsr draw_projection
jmp nothing_special
animate_trap:
; jsr draw_trap
jmp nothing_special
animate_gate_s:
; jsr update_gate_s
jmp nothing_special
animate_gate_n:
; jsr update_gate_n
@ -243,68 +228,6 @@ really_exit:
;====================================
;====================================
; update bottom of screen
;====================================
;====================================
update_bottom:
ldx #0
bottom_loop:
lda bottom_strings,X
sta OUTL
lda bottom_strings+1,X
sta OUTH
jsr move_and_print
inx
inx
cpx #18
bne bottom_loop
rts
;0123456789012345678901234567890123456789
;
;GIVE PICK UP USE
;OPEN LOOK AT PUSH
;CLOSE TALK TO PULL
bottom_strings:
.word bottom_give
.word bottom_open
.word bottom_close
.word bottom_pick_up
.word bottom_look_at
.word bottom_talk_to
.word bottom_use
.word bottom_push
.word bottom_pull
bottom_give: .byte 0,21,"GIVE ",0
bottom_open: .byte 0,22,"OPEN ",0
bottom_close: .byte 0,23,"CLOSE",0
bottom_pick_up: .byte 6,21,"PICK UP",0
bottom_look_at: .byte 6,22,"LOOK AT",0
bottom_talk_to: .byte 6,23,"TALK TO",0
bottom_use: .byte 15,21,"USE ",0
bottom_push: .byte 15,22,"PUSH",0
bottom_pull: .byte 15,23,"PULL",0
;==========================
; includes
;==========================
@ -331,3 +254,4 @@ bottom_pull: .byte 15,23,"PULL",0
.include "guy.brush"
.include "monkey_actions.s"
.include "update_bottom.s"

View File

@ -1,3 +1,33 @@
;=============================
; normal_text
;=============================
; modify so print normal text
normal_text:
; want ora #$80
lda #$09
sta ps_smc1
lda #$80
sta ps_smc1+1
rts
;=============================
; inverse_text
;=============================
; modify so print inverse text
inverse_text:
; want and #$3f
lda #$29
sta ps_smc1
lda #$3f
sta ps_smc1+1
rts
;================================
; move_and_print

112
monkey/update_bottom.s Normal file
View File

@ -0,0 +1,112 @@
;====================================
;====================================
; update bottom of screen
;====================================
;====================================
update_bottom:
; draw first line
; it's verb followed by noun
jsr normal_text
; first clear line
lda #<clear_line
sta OUTL
lda #>clear_line
sta OUTH
jsr move_and_print
lda CURRENT_VERB
asl
tay
lda verb_names,Y
sta OUTL
lda verb_names+1,Y
sta OUTH
jsr move_and_print
lda CURRENT_NOUN
bmi no_noun
no_noun:
;========================
; draw command bars
jsr inverse_text
ldx #0
bottom_loop:
lda bottom_strings,X
sta OUTL
lda bottom_strings+1,X
sta OUTH
jsr move_and_print
inx
inx
cpx #18
bne bottom_loop
rts
;0123456789012345678901234567890123456789
;
;GIVE PICK UP USE
;OPEN LOOK AT PUSH
;CLOSE TALK TO PULL
bottom_strings:
.word bottom_give
.word bottom_open
.word bottom_close
.word bottom_pick_up
.word bottom_look_at
.word bottom_talk_to
.word bottom_use
.word bottom_push
.word bottom_pull
bottom_give: .byte 0,21,"GIVE ",0
bottom_open: .byte 0,22,"OPEN ",0
bottom_close: .byte 0,23,"CLOSE",0
bottom_pick_up: .byte 6,21,"PICK UP",0
bottom_look_at: .byte 6,22,"LOOK AT",0
bottom_talk_to: .byte 6,23,"TALK TO",0
bottom_use: .byte 15,21,"USE ",0
bottom_push: .byte 15,22,"PUSH",0
bottom_pull: .byte 15,23,"PULL",0
verb_names:
.word verb_give
.word verb_open
.word verb_close
.word verb_pick_up
.word verb_look_at
.word verb_talk_to
.word verb_use
.word verb_push
.word verb_pull
.word verb_walk
verb_give: .byte 15,20,"GIVE ",0
verb_open: .byte 15,20,"OPEN ",0
verb_close: .byte 14,20,"CLOSE ",0
verb_pick_up: .byte 12,20,"PICK UP ",0
verb_look_at: .byte 12,20,"LOOK AT ",0
verb_talk_to: .byte 12,20,"TALK TO ",0
verb_use: .byte 16,20,"USE ",0
verb_push: .byte 15,20,"PUSH ",0
verb_pull: .byte 15,20,"PULL ",0
verb_walk: .byte 12,20,"WALK TO ",0
clear_line: .byte 12,20," ",0

View File

@ -76,8 +76,9 @@ LOCATION = $81 ; location on the map
GUYBRUSH_X = $82 ; location of protagonist
GUYBRUSH_Y = $83
CURRENT_VERB = $84
CURRENT_VERB = $84 ; current verb
CURRENT_NOUN = $85 ; current noun
; done game puzzle state