2020-09-16 03:45:02 +00:00
|
|
|
;====================================
|
|
|
|
;====================================
|
|
|
|
; update bottom of screen
|
|
|
|
;====================================
|
|
|
|
;====================================
|
|
|
|
update_bottom:
|
2020-09-18 03:39:02 +00:00
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
jsr clear_bottom
|
|
|
|
|
2020-09-19 16:07:45 +00:00
|
|
|
|
|
|
|
lda LOCATION
|
|
|
|
cmp #MONKEY_MAP
|
|
|
|
bne not_the_map
|
|
|
|
|
2020-10-18 20:59:00 +00:00
|
|
|
;===================================
|
|
|
|
; draw map footer
|
|
|
|
; you don't have actions on the map?
|
|
|
|
;===================================
|
2020-09-19 16:07:45 +00:00
|
|
|
map_noun:
|
|
|
|
lda VALID_NOUN
|
|
|
|
beq done_map_noun
|
|
|
|
|
|
|
|
lda NOUN_L
|
|
|
|
sta OUTL
|
|
|
|
lda NOUN_H
|
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
jsr move_and_print
|
|
|
|
|
|
|
|
done_map_noun:
|
|
|
|
rts
|
|
|
|
|
|
|
|
not_the_map:
|
2020-10-18 20:59:00 +00:00
|
|
|
;===========================================================
|
|
|
|
; if footer is disable and instead we are printing a message
|
|
|
|
; then print the message
|
|
|
|
;===========================================================
|
2020-09-18 03:39:02 +00:00
|
|
|
|
|
|
|
lda DISPLAY_MESSAGE
|
|
|
|
beq no_message
|
|
|
|
|
|
|
|
lda MESSAGE_L
|
|
|
|
sta OUTL
|
|
|
|
lda MESSAGE_H
|
|
|
|
sta OUTH
|
|
|
|
jsr move_and_print
|
|
|
|
|
|
|
|
rts
|
2020-09-16 03:45:02 +00:00
|
|
|
|
2020-09-18 03:39:02 +00:00
|
|
|
no_message:
|
2020-10-18 20:59:00 +00:00
|
|
|
;===============================================
|
|
|
|
; draw the standard footer
|
|
|
|
;===============================================
|
|
|
|
|
2020-09-16 03:45:02 +00:00
|
|
|
; draw first line
|
|
|
|
; it's verb followed by noun
|
2020-10-18 20:59:00 +00:00
|
|
|
; we go through a lot of trouble to center it
|
|
|
|
|
|
|
|
; text is not inverse
|
2020-09-16 03:45:02 +00:00
|
|
|
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
; first clear line
|
|
|
|
lda #<clear_line
|
|
|
|
sta OUTL
|
|
|
|
lda #>clear_line
|
|
|
|
sta OUTH
|
|
|
|
jsr move_and_print
|
|
|
|
|
2020-10-18 20:59:00 +00:00
|
|
|
; set up temp line
|
|
|
|
; already here as we're immediately after clear line?
|
|
|
|
|
|
|
|
lda #<(temp_line+2)
|
|
|
|
sta OUTL
|
|
|
|
lda #>(temp_line+2)
|
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
; concatenate verb
|
|
|
|
|
2020-09-16 03:45:02 +00:00
|
|
|
lda CURRENT_VERB
|
|
|
|
asl
|
|
|
|
tay
|
2020-10-18 20:59:00 +00:00
|
|
|
|
2020-09-16 03:45:02 +00:00
|
|
|
lda verb_names,Y
|
2020-10-18 20:59:00 +00:00
|
|
|
sta INL
|
2020-09-16 03:45:02 +00:00
|
|
|
lda verb_names+1,Y
|
2020-10-18 20:59:00 +00:00
|
|
|
sta INH
|
2020-09-16 03:45:02 +00:00
|
|
|
|
2020-10-18 20:59:00 +00:00
|
|
|
jsr strcat
|
2020-09-16 03:45:02 +00:00
|
|
|
|
2020-10-18 20:59:00 +00:00
|
|
|
; concatenate noun if applicable
|
2020-09-16 03:45:02 +00:00
|
|
|
|
2020-09-16 04:28:08 +00:00
|
|
|
lda VALID_NOUN
|
2020-09-18 04:42:07 +00:00
|
|
|
beq no_noun
|
2020-09-16 03:45:02 +00:00
|
|
|
|
2020-09-16 04:28:08 +00:00
|
|
|
lda NOUN_L
|
2020-10-18 20:59:00 +00:00
|
|
|
sta INL
|
2020-09-16 04:28:08 +00:00
|
|
|
lda NOUN_H
|
2020-10-18 20:59:00 +00:00
|
|
|
sta INH
|
|
|
|
|
|
|
|
jsr strcat
|
|
|
|
|
|
|
|
no_noun:
|
|
|
|
|
|
|
|
; stick zero at end
|
2020-10-19 04:33:39 +00:00
|
|
|
; lda #0
|
|
|
|
; tay
|
|
|
|
; sta (OUTL),Y
|
2020-10-18 20:59:00 +00:00
|
|
|
|
|
|
|
; center it
|
|
|
|
lda #<(temp_line+2)
|
|
|
|
sta INL
|
|
|
|
lda #>(temp_line+2)
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jsr strlen
|
|
|
|
sty temp_line
|
|
|
|
lda #40
|
|
|
|
sec
|
|
|
|
sbc temp_line
|
|
|
|
lsr
|
|
|
|
sta temp_line
|
|
|
|
|
|
|
|
; now print it
|
|
|
|
|
|
|
|
lda #<temp_line
|
|
|
|
sta OUTL
|
|
|
|
lda #>temp_line
|
2020-09-16 04:28:08 +00:00
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
jsr move_and_print
|
|
|
|
|
2020-10-18 20:59:00 +00:00
|
|
|
|
2020-09-16 03:45:02 +00:00
|
|
|
|
|
|
|
;========================
|
|
|
|
; draw command bars
|
2020-09-18 03:39:02 +00:00
|
|
|
draw_command_bars:
|
2020-09-16 03:45:02 +00:00
|
|
|
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
|
|
|
|
|
2020-10-19 04:33:39 +00:00
|
|
|
;======================================
|
|
|
|
; draw inventory
|
|
|
|
|
|
|
|
; draw /\
|
|
|
|
; draw ::
|
|
|
|
; draw \/
|
|
|
|
|
|
|
|
lda #<inv_up
|
|
|
|
sta OUTL
|
|
|
|
lda #>inv_up
|
|
|
|
sta OUTH
|
|
|
|
jsr move_and_print
|
|
|
|
jsr move_and_print
|
|
|
|
|
|
|
|
jsr normal_text
|
|
|
|
|
|
|
|
jsr move_and_print
|
|
|
|
|
|
|
|
;==============================
|
|
|
|
; print inventory, if any
|
|
|
|
|
|
|
|
lda INVENTORY
|
|
|
|
beq done_inventory
|
|
|
|
|
|
|
|
asl
|
|
|
|
tay
|
|
|
|
lda inventory_names,Y
|
|
|
|
sta INL
|
|
|
|
lda inventory_names+1,Y
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
lda #<(temp_inv+2)
|
|
|
|
sta OUTL
|
|
|
|
lda #>(temp_inv+2)
|
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
jsr strcat
|
|
|
|
|
|
|
|
|
|
|
|
lda #<(temp_inv)
|
|
|
|
sta OUTL
|
|
|
|
lda #>(temp_inv)
|
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
lda #21
|
|
|
|
sta temp_inv+1
|
|
|
|
|
|
|
|
jsr move_and_print
|
|
|
|
|
|
|
|
|
|
|
|
lda INVENTORY2
|
|
|
|
beq done_inventory
|
|
|
|
|
|
|
|
asl
|
|
|
|
tay
|
|
|
|
lda inventory_names,Y
|
|
|
|
sta INL
|
|
|
|
lda inventory_names+1,Y
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
lda #<(temp_inv+2)
|
|
|
|
sta OUTL
|
|
|
|
lda #>(temp_inv+2)
|
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
jsr strcat
|
|
|
|
|
|
|
|
|
|
|
|
lda #<(temp_inv)
|
|
|
|
sta OUTL
|
|
|
|
lda #>(temp_inv)
|
|
|
|
sta OUTH
|
|
|
|
|
|
|
|
lda #22
|
|
|
|
sta temp_inv+1
|
|
|
|
|
|
|
|
jsr move_and_print
|
|
|
|
|
|
|
|
|
|
|
|
done_inventory:
|
2020-09-16 03:45:02 +00:00
|
|
|
rts
|
|
|
|
|
2020-10-19 04:33:39 +00:00
|
|
|
|
|
|
|
inventory_names:
|
|
|
|
.word null_string ; NULL
|
|
|
|
.word meat_string ; HUNK OF MEAT
|
|
|
|
.word chicken_pulley_string ; CHICKEN PULLEY
|
|
|
|
|
|
|
|
|
|
|
|
inv_up: .byte 22,21,"/\",0
|
|
|
|
inv_down: .byte 22,23,"\/",0
|
|
|
|
inv_middle: .byte 22,22,"::",0
|
|
|
|
|
|
|
|
temp_inv:
|
|
|
|
.byte 25,0," ",0
|
|
|
|
|
|
|
|
|
2020-09-16 03:45:02 +00:00
|
|
|
;0123456789012345678901234567890123456789
|
|
|
|
;
|
2020-10-19 04:33:39 +00:00
|
|
|
;GIVE PICK UP USE /\ HUNK O' MEAT
|
|
|
|
;OPEN LOOK AT PUSH :: CHICKEN PULLEY
|
|
|
|
;CLOSE TALK TO PULL \/
|
2020-09-16 03:45:02 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-10-18 20:59:00 +00:00
|
|
|
verb_give: .byte "GIVE ",0
|
|
|
|
verb_open: .byte "OPEN ",0
|
|
|
|
verb_close: .byte "CLOSE ",0
|
|
|
|
verb_pick_up: .byte "PICK UP ",0
|
|
|
|
verb_look_at: .byte "LOOK AT ",0
|
|
|
|
verb_talk_to: .byte "TALK TO ",0
|
|
|
|
verb_use: .byte "USE ",0
|
|
|
|
verb_push: .byte "PUSH ",0
|
|
|
|
verb_pull: .byte "PULL ",0
|
|
|
|
verb_walk: .byte "WALK TO ",0
|
|
|
|
|
|
|
|
clear_line: .byte 0,20," ",0
|
|
|
|
temp_line: .byte 0,20," ",0
|
|
|
|
|
|
|
|
;====================================
|
|
|
|
; concatenate (INL) to end of (OUTL)
|
|
|
|
; update (OUTL) to point to end when done
|
|
|
|
strcat:
|
|
|
|
ldy #0
|
|
|
|
strcat_loop:
|
|
|
|
lda (INL),Y
|
|
|
|
beq strcat_done
|
|
|
|
sta (OUTL),Y
|
|
|
|
iny
|
|
|
|
bne strcat_loop
|
|
|
|
strcat_done:
|
|
|
|
tya
|
|
|
|
clc
|
|
|
|
adc OUTL
|
|
|
|
sta OUTL
|
|
|
|
lda #0
|
|
|
|
adc OUTH
|
|
|
|
sta OUTH
|
2020-10-19 04:33:39 +00:00
|
|
|
lda #0
|
|
|
|
tay
|
|
|
|
sta (OUTL),Y ; NUL terminate
|
2020-10-18 20:59:00 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
;====================================
|
|
|
|
; calculate length of string in (INL)
|
|
|
|
; returns value in Y
|
|
|
|
strlen:
|
|
|
|
ldy #0
|
|
|
|
strlen_loop:
|
|
|
|
lda (INL),Y
|
|
|
|
beq strlen_done
|
|
|
|
iny
|
|
|
|
bne strlen_loop
|
|
|
|
strlen_done:
|
|
|
|
rts
|