Skip to content

Commit

Permalink
Forth: 3 tail call optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
adumont committed Apr 21, 2022
1 parent da75ff4 commit 947f76f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions forth.s
Original file line number Diff line number Diff line change
Expand Up @@ -2192,10 +2192,9 @@ defword "CR",,

_crlf:
LDA #KBD_RET ; CR
JSR putc
; LDA #KBD_RET ; LF
; JSR putc
RTS
; LDA #KBD_RET ; LF
JMP putc

defword "CFA",">CFA",
; ( HDR -- CFA )
Expand Down Expand Up @@ -2980,9 +2979,7 @@ getline:
BRA @next
@finish:
STY INP_LEN
JSR _crlf
RTS

JMP _crlf

; boot_refill will refill only one token (word) from BOOT_PRG
; into INPUT buffer. Not super efficient I guess...
Expand Down Expand Up @@ -3092,7 +3089,7 @@ print_nibble:
ADC #$66
@skip:
EOR #$30
JSR putc
JMP putc
:
RTS

Expand Down

0 comments on commit 947f76f

Please sign in to comment.