@@ -550,17 +550,69 @@ uppercase_ok:
550
550
ret
551
551
552
552
553
+
553
554
;
554
- ; Helper function. Remove " THE " from any input
555
+ ; Helper function, filter our input buffer, by removing some words
555
556
;
556
557
filter_input_buffer:
558
+ call filter_input_buffer_on
559
+ call filter_input_buffer_the
560
+ ret
561
+
562
+
563
+ ;
564
+ ; Helper function. Remove " ON " from any input
565
+ ;
566
+ filter_input_buffer_on:
567
+ ld hl, INPUT_BUFFER+1
568
+ ld a, (hl)
569
+ ld b, a ; b contains the number of chacters
570
+ inc hl ; hl points to the text the user entered
571
+
572
+ compare_loop_on:
573
+ push bc ; preserve count
574
+ push hl ; preserve starting char
575
+
576
+ ld b, 4 ; strlen(" ON " )
577
+ ld de, ON
578
+
579
+ call CompareStringsWithLength
580
+ jp z, we_found_on
581
+
582
+ pop hl
583
+ pop bc
584
+
585
+ inc hl
586
+ djnz compare_loop_on
587
+
588
+ ; Didn't find " THE " at any character position in the input-buffer.
589
+ ret
590
+
591
+ we_found_on:
592
+ pop hl
593
+ pop de
594
+
595
+ ; we have " THE " at the location HL points to
596
+ ld a, " "
597
+ ld (hl), a ; " " -> " "
598
+ inc hl
599
+ ld (hl), a ; "O" -> " "
600
+ inc hl
601
+ ld (hl), a ; "N" -> " "
602
+ ret
603
+
604
+
605
+ ;
606
+ ; Helper function. Remove " THE " from any input.
607
+ ;
608
+ filter_input_buffer_the:
557
609
558
610
ld hl, INPUT_BUFFER+1
559
611
ld a, (hl)
560
612
ld b, a ; b contains the number of chacters
561
613
inc hl ; hl points to the text the user entered
562
614
563
- compare_loop :
615
+ compare_loop_the :
564
616
push bc ; preserve count
565
617
push hl ; preserve starting char
566
618
@@ -574,7 +626,7 @@ compare_loop:
574
626
pop bc
575
627
576
628
inc hl
577
- djnz compare_loop
629
+ djnz compare_loop_the
578
630
579
631
; Didn't find " THE " at any character position in the input-buffer.
580
632
ret
@@ -2685,6 +2737,8 @@ NOW_YOU_SEE:
2685
2737
db "Now you can see where you are:", 0x0a, 0x0d, "$"
2686
2738
THE:
2687
2739
db " THE "
2740
+ ON:
2741
+ db " ON "
2688
2742
usage_message:
2689
2743
db 0x0a, 0x0d
2690
2744
@@ -2937,6 +2991,10 @@ command_table:
2937
2991
DEFW use_function
2938
2992
DEFB 5, 'LIGHT', 1
2939
2993
DEFW use_function
2994
+ DEFB 6, 'SWITCH', 1 ; switch on generator, etc
2995
+ DEFW use_function
2996
+ DEFB 4, 'TURN', 1 ; turn on torch, etc.
2997
+ DEFW use_function
2940
2998
;; easter-eges
2941
2999
DEFB 4, 'CALL', 1
2942
3000
DEFW call_function
0 commit comments