Skip to content

Commit

Permalink
Forth: Add shortcuts for : and ; in FIND
Browse files Browse the repository at this point in the history
  • Loading branch information
adumont committed Nov 14, 2021
1 parent 8c0e698 commit 3330291
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions forth.s
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,31 @@ defword "FIND",,
STA W
LDA LATEST+1
STA W+1

; shortcuts in FIND for ":" and ";"
LDA 2,X
CMP #1
BNE @nxt_word
; 1 char word. here we test if the word is ":"
LDA (G2)
CMP #':'
BNE @not_colon
; word is ":"!!
LDA #<h_FCOLON
STA 4,X
LDA #>h_FCOLON
STA 5,X
JMP do_DROP
@not_colon:
CMP #';'
BNE @not_semi
; word is ";"!!
LDA #<h_SEMICOLON
STA 4,X
LDA #>h_SEMICOLON
STA 5,X
JMP do_DROP
@not_semi:
@nxt_word:
; store W+2 in G1 (G1 points to the counted str)
CLC
Expand Down

0 comments on commit 3330291

Please sign in to comment.