Skip to content

Commit

Permalink
Added SLEEP/WAIT - as per #22
Browse files Browse the repository at this point in the history
  • Loading branch information
skx committed Apr 28, 2021
1 parent c1d32ab commit c430dec
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions game.z80
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ find_command_skip2: ; skip $LENGTH-bytes




;********************************************************************
; Utility functions
;********************************************************************
Expand Down Expand Up @@ -1708,6 +1709,43 @@ quit_function:



;
; Command-Handler SLEEP
;
sleep_function:

ld de, SLEEP_START_MSG
call show_msg

; Run a time-delay function 40 times
ld b, 40

hl_delay
ld hl,0xffff / 2
hl_delay_loop:
inc hl
ld de, 0xffff - 100
de_delay_loop:
inc de
ld a, d
or e
jr nz, de_delay_loop
ld a,h
or l
jr nz, hl_delay_loop

PUSH_ALL
ld c, BDOS_OUTPUT_SINGLE_CHARACTER
ld e, "."
call BDOS_ENTRY_POINT
POP_ALL
djnz hl_delay

ld de, SLEEP_END_MSG
call show_msg
ret


;
; Command-Handler TURNS
;
Expand Down Expand Up @@ -1867,6 +1905,17 @@ show_tab:
pop af
ret


;
; Command-Handler WAIT
;
; Nothing happens.
;
wait_function:
ld de, WAIT_CMD_MSG
call show_msg
ret

; }


Expand Down Expand Up @@ -2500,6 +2549,15 @@ not_carrying_item_msg:
db 0x0a, 0x0d, "You're not carrying that!", 0x0a, 0x0d, "$"
MIRROR_DROP_FUN:
db 0x0a, 0x0d, "You drop the mirror, which cracks and breaks.", 0x0a, 0x0d, "$"
SLEEP_START_MSG:
db 0x0a, 0x0d, "You lay down and try to take a small nap.", 0x0a, 0x0d
db "$"
SLEEP_END_MSG:
db 0x0a, 0x0d, "You jerk awake, unsure of how much time has passed or how much closer the boat,", 0x0a, 0x0d
db "and yourself, are to certain doom.", 0x0a, 0x0d
db "$"
WAIT_CMD_MSG:
db 0x0a, 0x0d, "You wait for a moment, lost in thought.", 0x0a, 0x0d, "$"
TORCH_ON_MSG:
db 0x0a, 0x0d, "You turn on the torch.", 0x0a, 0x0d, "$"
ship_closer_msg:
Expand Down Expand Up @@ -2761,6 +2819,10 @@ command_table:
DEFW bad_language_function
DEFB 5, 'XYZZY', 1
DEFW magic_function
DEFB 5, 'SLEEP', 1
DEFW sleep_function
DEFB 4, 'WAIT', 1
DEFW wait_function
;; abbreviations
DEFB 1, 'L', 1
DEFW look_function
Expand Down

0 comments on commit c430dec

Please sign in to comment.