ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º Lesson 7 Part 020 F-PC 3.5 Tutorial by Jack Brown º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Lesson 6 Review ( continued ) ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Number Formatting Operators. ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ PAD ( -- addr ) Leave address of output buffer. The variable HLD points to the current position in the output buffer. HLD is initialized to PAD by <# below and is decremented by 1 just before another ASCII digit is added to the output. VARIABLE HLD Pointer to current output address in below PAD . HOLD ( n -- ) Add ASCII character n to string being formed and decrement HLD <# ( -- ) Start numeric conversion, initialize HLD for new output. #> ( dn -- addr len ) Terminate numeric conversion. SIGN ( n -- ) If n is negative insert a -ve sign in the output string. # ( dn -- dn' ) Convert a single digit using the current number BASE. #S ( dn -- dn') Convert all remaining digits. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Compiler Extension ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ IMMEDIATE is used right after the definition of a word to declare it to be IMMEDIATE. An IMMEDIATE word will execute at compile time instead of being compiled. LITERAL compiles the stack number in to the dictionary. LITERAL is an IMMEDIATE word itself. ' ( tick ) Get the cfa of the next word in the input stream. ' is not IMMEDIATE in F-PC ( it was in Fig Forth). STATE a system variable that is true if the system is in compile mode and false if the system is in interpretive mode. [COMPILE] force the compilation of an IMMEDIATE word when it would other wise execute. COMPILE When the word containing COMPILE executes the word will be compile into the dictionary. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ The Case Statement ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ CASE ... OF ... ENDOF ... ENDCASE CASE causes an index value to be compared to a series of values. OF is equivalent to OVER = IF DROP ENDOF is equivalent to ELSE Any number of OF .. ENDOF pairs may be used. ENDCASE is equivalent of the appropriate number of THENs ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Please Move to Lesson 7 Part 030 ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ