peasant: add "where" command

This commit is contained in:
Vince Weaver 2021-10-03 22:41:02 -04:00
parent 37e50c3ef3
commit 7239ea553f
2 changed files with 36 additions and 3 deletions

View File

@ -158,13 +158,45 @@ check_show:
check_version:
cmp #VERB_VERSION
bne check_unknown
bne check_where
lda #<version_message
sta OUTL
lda #>version_message
jmp finish_parse_message
check_where:
cmp #VERB_WHERE
bne check_unknown
where_blargh:
ldx MAP_LOCATION
lda location_names_l,X
sta INL
lda location_names_h,X
sta INH
lda #<(where_message+22)
sta OUTL
lda #>(where_message+22)
sta OUTH
ldy #0
where_loop:
lda (INL),Y
sta (OUTL),Y
beq where_done
iny
bne where_loop ; bra
where_done:
lda #<where_message
sta OUTL
lda #>where_message
jmp finish_parse_message
check_unknown:
lda #<help_message
sta OUTL
@ -253,6 +285,7 @@ verb_lookup:
.byte "SAVE",VERB_SAVE|$80
.byte "SHOW",VERB_SHOW|$80
.byte "VER",VERB_VERSION|$80
.byte "WHERE",VERB_WHERE|$80
.byte $00

View File

@ -74,8 +74,8 @@ drink_message2:
; + what the f- / this sucks
.byte "Come now. Don't get discouraged.",0
; + where (offset 21)
where_label:
; + where (offset 22)
where_message:
.byte "You're hanging out in",13
.byte " ",0