Category : Forth Source Code
Archive   : FIFTH.ZIP
Filename : ASCII.FIV

 
Output of file : ASCII.FIV contained in archive : FIFTH.ZIP
CREATE ASCII
CREATE WHITE
EDIT
\ White tests if the character on the top of stack is a white space character,
\ that is, a space, cr, tab, or line feed.
: white
dup 32 = \ Space.
over 13 = or \ CR.
over 9 = or \ Tab.
over 10 = or \ Line feed.
;
~UP
EDIT
\ Takes the next character in the input stream and generates the its ASCII
\ value. If the compiler is on, the code to push this ASCII representation
\ onto the stack is generated. A compile error occurs if ASCII is followed
\ by more than one character.

: ASCII
begin \ Find the beginning of the next word.
>in @ c@@ white \ Get the next character and test if white space.
1 >in +! \ Move text pointer to next character.
while \ Loop while white space.
drop \ Drop character if it is white space.
repeat
dup if else \ Test for end of text. (This is marked by 0)
cls \ Error if at end of text.
." EOT error on ASCII routine"
abort
endif
>in @ c@@ white over 0= or \ Test that only one character follows.
if
drop \ Drop the white space character.
else
drop cls \ More than one character follows.
." Illegal ASCII character"
abort
endif
state c@ if \ If the compiler is on,
['] literal execute \ compile a push of the ASCII value to the stack.
endif
; immediate
~UP
ABORT


  3 Responses to “Category : Forth Source Code
Archive   : FIFTH.ZIP
Filename : ASCII.FIV

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/