TIFILES…€JP… ĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘSĘS E3 F-TIDBIT #1 : TRUE LOWER CASE FOR FORTH D Your favorite CHARA1 file from TI-WRITER (several versionsC exist) can be installed on your Forth disk for true lower˙F case. Screen 19 of the system disk is only partially used byE the Forth kernel, leaving sufficient space for the chardefsF of ASCII 32 through 127. The parameters given below assume a˙Forth disk for true lower˙E two-drive SS/SD system. For other configurations it will beF necessary to adjust them accordingly. In case you prefer theE 64-column editor, the following does not affect the display˙˙Forth disk for true lower˙C of its tiny characters. (There's no way to improve them.) D Step 1: Copy the CHARA1 file to a clean, initialized disk.( Any disk manager can be used. ˙ display˙˙Forth disk for true lower˙D Step 2: Boot Forth and place the disk with the CHARA1 fileB in drive 2. The file will be found on screens 98 and 99.E That is, the sectors which are needed are on these screens,# the rest can be ignored. ˙E Step 3: The file could be transferred now, but it is easier? to combine it first onto one screen (#100) before theD transfer is made. The CHARA1 file starts on line 8 (addr =˙s,# the rest can be ignored. ˙B 512) but the first 6 bytes (0 to 5 ) constitute the fileF header, so the address must be incremented by 6 (=518). ThisC is followed by 256 bytes (the chardefs for ASCII 0 to 31)˙ the rest can be ignored. ˙F which we don't need. Therefore, the starting address for theE transfer is 98 BLOCK 774 +, destination is 100 BLOCK and we? want to move the remaining 250 bytes of that screen: ˙he rest can be ignored. ˙= 98 BLOCK 774 + 100 BLOCK 250 CMOVE UPDATE FLUSH G The rest of the chardefs are found on screen 99 and 506 bytesF have to be moved. They must follow what has already been put on screen 100: ˙= 99 BLOCK 100 BLOCK 250 + 506 CMOVE UPDATE FLUSH A Scr #100 now contains the entire set of definitions for) displayable ASCII characters. ˙t has already been put on screen 100: ˙D Step 4: Once again it is time to issue that old warning ofF "Do it on a backup disk!." With the Forth BU disk in drive 1E and the chardefs on screen #100 in drive 2, the transfer is# easily accomplished by: ˙ ˙ ; 100 BLOCK 19 BLOCK 256 + 768 CMOVE UPDATE FLUSH D Provided no errors were made and scr #33 (SYSTEM CALLS) isB booted, the new chardefs are written to the PDT (pattern˙easily accomplished by: ˙ ˙# descriptor table) with + HEX 13 BLOCK 100 + 900 300 VMBW D For a quick check, it can be entered from the keyboard andB some lower case characters typed. If everything works as˙ ˙C expected, i.e., the display does not go haywire and lowerC case letters are properly shown, then the above statementE should be placed on scr #3 (the welcome screen) to autoboot˙case characters typed. If everything works as˙ ˙? the new charset along with whatever other autobootingG features may already have been installed there by the user. F While it is not necessary to put the entire charset into the˙rs typed. If everything works as˙ ˙G PDT (the upper cases are there already) I use the whole rangeC (32 to 127) because I have redefined the characters of myE file. They are not only bigger but I have slashed the 0 and˙into the˙rs typed. If everything works as˙ ˙C improved the lower cases. Also, I can easily put the sameA charset into the upper end of the PDT for conversion to: inverse video. More about that in F-TIDBIT #2. ˙ and˙into the˙rs typed. If everything works as˙ ˙B The procedure I have described makes use of space on theF disk which is wasted otherwise. It does not require any modsF of other screens to accommodate the character definitions. A˙˙into the˙rs typed. If everything works as˙ ˙B VMBW of >300 bytes does not add any noticable delay when booting Forth.  EOF/Lutz Winkler, F-TIDBIT #2 : ADDING INVERSE VIDEOE One feature which can enhance a program by making on-screen˙ as˙ ˙E prompts and other information stand out, is 'inverse video'D where the text/screen colors are reversed. With Forth thisD is easily accomplished. Michal Jaegermann of the Edmonton,˙n enhance a program by making on-screen˙ as˙ ˙C Alberta, Canada, Users Society provided the basis for theD routine shown below. Unfortunately, unless you have all ofD his many enhancements at your disposal, it is not directly˙,˙n enhance a program by making on-screen˙ as˙ ˙E transferrable. The following, however, can be used instead. 0 ( INVERSE VIDEO ) 1 33 CLOAD RANDOMIZE 2 BASE->R HEX2 3 900 PAD 300 VMBR PAD D00 300 VMBW˙hance a program by making on-screen˙ as˙ ˙< 4 : INVERT 1000 D00 DO FF I VXOR LOOP ; INVERT 5A 6 : (^) COUNT OVER + SWAP DO I C@ 80 OR EMIT8 LOOP ;@ 7 : (IV) BEGIN KEY DUP 1F > WHILE 80 OR EMIT8 REPEAT 8 DROP DROP ;˙on-screen˙ as˙ ˙! 9 : IVLIT 22 STATE @C 10 IF COMPILE SLIT WORD HERE C@ 1+ =CELLS ALLOT6 11 ELSE WORD HERE THEN ; IMMEDIATE, 12 : IV" [COMPILE] IVLIT STATE @˙AT 8 DROP DROP ;˙on-screen˙ as˙ ˙> 13 IF COMPILE (^) ELSE (IV) THEN ; IMMEDIATE 14 15 R->BASEA Line 1: Insures that the SYSTEM CALLS are booted which3 allows VMBR and VMBW to be used.˙ DROP DROP ;˙on-screen˙ as˙ ˙A Line 2: VPD reads and writes are always easier in HEX.F Line 3: Read ASCII 32-127 to PAD and write them from PAD toE the high order (ASCII 160-255) area in PDT. If you˙ be used.˙ DROP DROP ;˙on-screen˙ as˙ ˙D have put a charset on screen 19 (see F-TIDBIT #1)H replace this line with : 13 BLOCK 100 + D00 300 VMBW.F Line 4: INVERT performs a VXOR on the high order charset to˙ed.˙ DROP DROP ;˙on-screen˙ as˙ ˙9 turn off-pixels on, and on-pixels off.: Line 6: (^) converts a string to inverse video.F Line 7: (IV) accepts input from keyboard for inverse video.˙he high order charset to˙ed.˙ DROP DROP ;˙on-screen˙ as˙ ˙G Line 9: IVLIT is WLITERAL adapted for IV purposes, delimiter< is ASCII 34 (") instead of BL (ASCII 32).D Line 12: IV" (used in place of .") will display or compile˙charset to˙ed.˙ DROP DROP ;˙on-screen˙ as˙ ˙E text following it in inverse video until delimited by ".G Usage IV" - keyboard input is displayed in inverse8 video until the ENTER key is pressed.˙DROP DROP ;˙on-screen˙ as˙ ˙F or : TEST IV" This is a test" ; will display 'This is a? test' in inverse video when TEST is invoked. EOF/Lutz Winkler6 F-TIDBIT #3 : IMPROVING THE 40-COLUMN EDITOR˙ssed.˙DROP DROP ;˙on-screen˙ as˙ ˙G In F-TIDBIT #1 I outlined how to install your preferred char-G set on the Forth disk and in TIDBIT #2 I provided informationD about how to achieve inverse video. Now we can put both of˙ITOR˙ssed.˙DROP DROP ;˙on-screen˙ as˙ ˙E these features together for improving the 40-column editor.H The procedure which follows not only corrects TI's omission ofF auto-repeating keys but also changes the character under the˙TOR˙ssed.˙DROP DROP ;˙on-screen˙ as˙ ˙I cursor to inverse video unless it is a blank space. This merely requires thatD 1) there is a character set loaded into the PDT at >D00,9 2) the charset is converted to inverse video,˙˙DROP DROP ;˙on-screen˙ as˙ ˙4 3) a few minor changes to screen 38, andE 4) the addition of screen 41 (which is unused otherwise).C As to the first item, if you have installed your favorite˙t is converted to inverse video,˙˙DROP DROP ;˙on-screen˙ as˙ ˙E charset on screen 19 (F-TIDBIT #1), all you need to do is a@ HEX 13 BLOCK 100 + D00 300 VMBW. This places a copy ofI your charset into the upper end of the PDT. To convert this set˙ inverse video,˙˙DROP DROP ;˙on-screen˙ as˙ ˙E to inverse video use INVERT from F-TIDBIT #2 (HEX : INVERTF 1000 D00 DO FF I VXOR LOOP ;). Then install the following on6 screen 41 which is blank on the system disk:0 0 ( BLINK & DELAY FOR 40-COL EDITOR )˙n˙ as˙ ˙ 1 0 CLOAD DELAY 2 BASE->R HEX 3 4 : BLINK ( --- )1 5 CURPOS @ DUP VSBR OVER OVER3 6 DUP 21 < IF DROP 1E SWAP VSBW. 7 ELSE 80 + VSBW˙n˙ as˙ ˙# 8 THEN1 J B0 0 DO LOOP ( blink rate )! 10 SWAP VSBW ; 11 12 : DELAY ( --- )5 13 800 0 DO LOOP ; ( repeat rate ) 14 15 R->BASE˙˙. Now modify screen 38 as shown below:D 0 ( SCREEN EDITOR 12JUL82 LCT) BASE->R HEX 29 CLOAD DELAYG 1 : VED BOX SWAP CLS LISTL !CUR .CUR BEGIN ?KEY DUP IF CASE3 (lines 2 through 9 remain unchanged)˙15 R->BASE˙˙5 10 7F OF -TAB ENDOF DUP 1F > OVER 7F < AND< 11 IF DUP EMIT DUP !BLK ELSE 7 EMIT ENDIF ENDCASEI 12 BLINK DELAY ELSE DROP BLINK ENDIF AGAIN ; FORTH DEFINITIONS5 (lines 13 through 15 remain unchanged)˙ R->BASE˙˙I Before you make this improved editor part of your autoboot, youG may want to try one more minor change. On line 3 of screen 34I modify the word BOX to read : BOX 8F7 8F1 DO CC I VSBW LOOP ;˙h 15 remain unchanged)˙ R->BASE˙˙J which makes the vertical sides of the box-shaped cursor 2 pixelsJ wide and a bit easier to spot. This will provide you with a very( satisfactory 40-column editor. EOF/Lutz Winkler˙˙h 15 remain unchanged)˙ R->BASE˙˙/ FORTH TIP #4 : IN-BETWEEN DISK COPIERL From the time TI-Forth was first released a number of disk-copyingK routines have been published. This was mainly in response to TI's˙EOF/Lutz Winkler˙˙h 15 remain unchanged)˙ R->BASE˙˙L implementation of FORTH-COPY which - being nothing more than a DO-L LOOP of SCOPY - tediously copies one screen at a time while givingI the disk drives a good workout. My complaint about those 3-pass˙ain unchanged)˙ R->BASE˙˙K copiers is that they necessitate re-booting and for the most partK also disk-swapping. In essence, not much time is saved. One mightJ as well leave Forth and boot a disk manager. That, of course, is˙˙ain unchanged)˙ R->BASE˙˙6 something a true fanatic is not going to do.J From my point of view, too much is made of speed anyway (I am inL the enviable position of having plenty of time) and am inclined to˙hat, of course, is˙˙ain unchanged)˙ R->BASE˙˙J look for convenience. That is the reason my disk copier does notL set any speed records, but it does away with disk-swapping and re-I booting. It copies from drive 1 to 2 (0 to 1, if you want to be˙˙˙ain unchanged)˙ R->BASE˙˙I finicky about it), takes up about 720 bytes of memory, and fiveL screens are read/written per pass. It will copy formats other thanK SS/SD, however, the disk-formatting feature will only provide the˙˙ain unchanged)˙ R->BASE˙˙; format which is invoked by your FORMAT-DISK word.A 0 ( DISK-COPIER - 1 ) 39 CLOAD AD 0 CLOAD COPY-DISK9 1 BASE->R HEX 0 DISK_LO ! 0 CONSTANT INCE 2 : AT GOTOXY ; ( skip this if already in your autoboot )˙E 3 : .SCR# DUP 6 .R ; ( format for screen number display )* 4 : READ5 5 0 DO I INC + .SCR#9 5 BLOCK I 400 * 1400 + 400 VMBW 6 LOOP ;˙OTOXY ; ( skip this if already in your autoboot )˙4 7 : WRITE5 5 0 DO I 400 * 1400 + I INC +E 8 DISK_SIZE @ + .SCR# BLOCK 400 VMBR UPDATE7 9 LOOP FLUSH EMPTY-BUFFERS ;J 10 : M1 F1 7 VWTR CLS 2 A AT ." Reading source screens" CR CR ;˙˙H 11 : M2 1E 7 VWTR CLS 2 A AT ." Writing copy screens" CR CR ;= 12 : M3 CLS CR ." FORGET INC to clear memory" CR ;J 13 : MORE? ( --- f ) CLS 0 ' INC ! 4 E AT ." Continue (Y/N) ? "˙S 2 A AT ." Reading source screens" CR CR ;˙˙4 14 KEY DUP 59 = SWAP 79 = OR 0= ; 15 --> 0 (DISK-COPIER - 2 )B 1 : TITLE CLS 4 5 AT ." 0>------ COPY-DISK ------>1"C 2 4 8 AT ." Insert source disk in drive 0,"˙reens" CR CR ;˙˙C 3 4 A AT ." copy disk in drive 1,"C 4 4 D AT ." Press 1 to format copy disk or"? 5 4 F AT ." any other key when ready "6 6 KEY 31 = IF 1 FORMAT-DISK THEN ;˙& 7 : XFER DISK_SIZE @ 5 / 06 8 DO M1 READ5 M2 WRITE5 5 ' INC +! 9 LOOP ;' 10 : COPY-DISK EMPTY-BUFFERS; 11 BEGIN TITLE XFER F1 7 VWTR MORE?˙KEY 31 = IF 1 FORMAT-DISK THEN ;˙+ 12 UNTIL M3 ABORT ; 13# 14 R->BASE COPY-DISK ;S 15 P By the way, the first parameters in M1 and M2 (as well as the one pre-˙N TITLE XFER F1 7 VWTR MORE?˙KEY 31 = IF 1 FORMAT-DISK THEN ;˙M ceeding 7 VWTR in DISK-COPY) change the text and background colors.P (>F1 = white text on black screen.) You may substitute others to suit,H just make sure you do it in HEX. READ5 and WRITE5 are DO-LOOPs˙F 1 FORMAT-DISK THEN ;˙M which read(write) five screens at a time. XFER combines them into aL DO-LOOP which derives its limit from DISK_SIZE. The top level wordP COPY-DISK is an indefinite loop which allows repeated execution by way˙FORMAT-DISK THEN ;˙P of MORE?. About the >1400 in READ5 and WRITE5: Screen contents are putO into an unused area of VDP memory. As I said, convenience, not speed,O was my main objective. So, please excuse me while I fetch that second˙T-DISK THEN ;˙ cup of coffee. EOF/LW# FORTHTIP #5: SORTING NUMBERSM Inevitably a programmer encounters the need to sort some informationN into some logical sequence, either numerically or alphabetically. Quite˙ond˙T-DISK THEN ;˙L a few sorting algorithms have been devised over the years and here weN will deal with a Forth version of the Quicksort. This particular inter-M pretation was written by Gary Nemeth. Based on it I have implemented a˙te˙ond˙T-DISK THEN ;˙, demonstration to sort twenty numbers.B 0 ( QUICKSORT DEMO - 1 BASED ON GARY NEMETH'S QUICKSORT )- 1 : NOT 0= ; : 2/ 1 SRA ;8 2 : 2DUP OVER OVER ; : 2SWAP ROT >R ROT R> ;˙ve implemented a˙te˙ond˙T-DISK THEN ;˙( 3 : 2OVER SP@ 6 + @ SP@ 6 + @ ; 4 5 0 VARIABLE XX 40 ALLOT 6 7 : NO.INP ( ----n )% 8 QUERY INTERPRET ;9 9 : ENTER CR 40 0 DO I 2 / 1+ 14 .R ." INPUT : "˙implemented a˙te˙ond˙T-DISK THEN ;˙3 10 NO.INP XX I + ! CR 2" 11 +LOOP ;6 12 : SHOW CR 40 0 DO CR I 2 / 1 + 18 .R ." : "- 13 XX I + @ 3 .R 2! 14 +LOOP ; 15 -->˙nd˙T-DISK THEN ;˙N This screen sets up a number of operators (from NOT to 2OVER) which areN needed for the sorting operation. VARIABLE XX is established to receiveP the numbers in random order by way of ENTER. After they have been sorted,˙d˙T-DISK THEN ;˙O SHOW displays them. The words which perform the sort are shown on below: 1 ( QUICKSORT DEMO - 2 ) 2 0 VARIABLE MIDDLE 3 : K@ 2 * XX + @ ; 4 : K! 2 * XX + ! ;+ 5 : MID@ OVER - 2/ + K@ MIDDLE ! ;˙SK THEN ;˙! 6 : COMP K@ MIDDLE @ - ;2 7 : EXCH 2DUP K@ SWAP K@ ROT K! SWAP K! ; 8 : SORT ( n1 n2 --- )% 9 2DUP > IF DROP DROP, 10 ELSE 2DUP 2DUP MID@˙+ 5 : MID@ OVER - 2/ + K@ MIDDLE ! ;˙SK THEN ;˙= 11 BEGIN SWAP BEGIN DUP COMP 0< WHILE 1+ REPEAT= 12 SWAP BEGIN DUP COMP 0 > WHILE 1- REPEATA 13 2DUP > NOT IF 2DUP EXCH 1 -1 D+ THEN 2DUP >7 14 UNTIL SWAP ROT 2OVER 2OVER - ROT ROT -˙K THEN ;˙: 15 < IF 2SWAP THEN MYSELF MYSELF THEN ;M SORT obviously is the top level word. K@ and K! retrieve and store theP integers from variable XX, while MID@, COMP and EXCH are needed to enable˙T 2OVER 2OVER - ROT ROT -˙K THEN ;˙N SORT to perform its function. (It is not the purpose of this article toN explain the workings of a typical quicksort. This information should be$ obtained from other sources.) ˙ are needed to enable˙T 2OVER 2OVER - ROT ROT -˙K THEN ;˙N The twenty-number limit for the sort is arbitrary. It was chosen so theO entire result of the sort can be displayed without scrolling off screen.P If XX is modified to allot more (or fewer) cells and the loop counters in˙ROT -˙K THEN ;˙N ENTER and SHOW are changed accordingly a larger (or smaller) number can be sorted. Usage is as follows:B ENTER - allows input of 20 positive or negative numbers˙ore (or fewer) cells and the loop counters in˙ROT -˙K THEN ;˙M 0 19 SORT - sorts them in ascending order (loop parameters must be put! on the stack!)2 SHOW - displays the result of the sortM In spite of the length of SORT, you will be amazed at the speed of the˙T -˙K THEN ;˙M sorting operation. In the next installment we shall explore the use of% this routine for string sorts. EOFJLW# E FORTHTIP #6: SORTING STRINGSN In the preceeding article I demonstrated how numbers can be sorted. Now˙ THEN ;˙N we will see how the same routine can be adapted for sorting strings, i.M e., putting them into alphabetical order. Most obvious changes are theL use of an additional variable (ORDER) and a few added and/or modified˙ sorted. Now˙ THEN ;˙M words. Instead of moving strings into alphabetical order, pointers areP stored in ORDER, similar to sector 1 of a disk containing pointers to theM files in their alphabetical order while the files themselves remain in˙rted. Now˙ THEN ;˙P random order. There is also the -TEXT word from Brodie to compare stringsO except that it is called =TEXT to avoid confusion with TI-Forth's -TEXT.O Variable STRGS serves the same purpose as XX which stored numbers in the˙. Now˙ THEN ;˙N previous example. ENTER has become ENTER$, and similarly SHOW is SHOW$.' SET is used to initialize ORDER.D 0 ( STRING SORT DEMO - 1 BASED ON GARY NEMETH'S QUICKSORT )- 1 : NOT 0= ; : 2/ 1 SRA ;˙ the˙. Now˙ THEN ;˙8 2 : 2DUP OVER OVER ; : 2SWAP ROT >R ROT R> ;( 3 : 2OVER SP@ 6 + @ SP@ 6 + @ ; 4) 5 : =TEXT ( addr1 u addr2 --- f) 6 2DUP + SWAP0 7 DO DROP 2+ DUP 2- @ I @ - DUP˙SRA ;˙ the˙. Now˙ THEN ;˙/ 8 IF DUP ABS / LEAVE THEN 2$ 9 +LOOP SWAP DROP ; 10# 11 0 VARIABLE ORDER 40 ALLOT# 12 0 VARIABLE STRGS 40 ALLOT 13 14 15 -->" 0 ( STRING SORT DEMO - 2 ) 1˙THEN ;˙, 2 : SET 40 0 DO I 2 / ORDER I + ! 2 3 +LOOP ; 4 5 : ENTER$ SET2 6 40 0 DO CR ." ENTER STRING : ": 7 I 2 / 2 .R ." : " PAD 2 EXPECT˙NG SORT DEMO - 2 ) 1˙THEN ;˙3 8 PAD STRGS I + 2 CMOVE 2 9 +LOOP ; 109 11 : SHOW$ 40 0 DO CR ORDER I + @ DUP 12 .R SPACE/ 12 2 * STRGS + 2 TYPE 2 13 +LOOP ; 14 -->˙˙THEN ;˙ 15O The basic sort itself (now on screen 3) remains virtually unchanged withL the exception of COMP (now $COMP) which has to furnish parameters forM =TEXT. String length is purposely limited to 2 letters in the interest˙˙˙THEN ;˙L of speed. Unless it is absolutely imperative that - for example - theM names RICHARD, RICHARDS, RICHARDSEN and RICHARDSON be sorted in properM order, the sort should be performed with a limited string length. This˙the interest˙˙˙THEN ;˙M is because =TEXT is a high-level definition and is by no means a speed demon. " 1 ( STRING SORT DEMO - 3 ) 2 0 VARIABLE MIDDLE 3 : K@ 2 * ORDER + @ ; 4 : K! 2 * ORDER + ! ;˙ngth. This˙the interest˙˙˙THEN ;˙+ 5 : MID@ OVER - 2/ + K@ MIDDLE ! ;@ 6 : $COMP K@ 2 * STRGS + 2 MIDDLE @ 2 * STRGS + =TEXT ;2 7 : EXCH 2DUP K@ SWAP K@ ROT K! SWAP K! ; 8 : SORT ( n1 n2 --- )% 9 2DUP > IF DROP DROP˙is˙the interest˙˙˙THEN ;˙, 10 ELSE 2DUP 2DUP MID@> 11 BEGIN SWAP BEGIN DUP $COMP 0< WHILE 1+ REPEAT> 12 SWAP BEGIN DUP $COMP 0 > WHILE 1- REPEATA 13 2DUP > NOT IF 2DUP EXCH 1 -1 D+ THEN 2DUP >˙interest˙˙˙THEN ;˙7 14 UNTIL SWAP ROT 2OVER 2OVER - ROT ROT -: 15 < IF 2SWAP THEN MYSELF MYSELF THEN ; Usage is as follows:: ENTER$ - allows input of twenty 2-letter strings˙F 2DUP EXCH 1 -1 D+ THEN 2DUP >˙interest˙˙˙THEN ;˙P 0 19 SORT - generates the alphabetical list in the form of pointers which& are stored in ORDER2 SHOW$ - displays the result of the sortM This routine can easily be adapted for inclusion in a program where an˙EN ;˙P alphabetical listing is desired. Parameters for alloting sufficient spaceM in ORDER and STRGS would have to be derived from the number of recordsN (actual or allowed). The same is true for any loop to read the pointers˙am where an˙EN ;˙N in ORDER and look up the corresponding records. Storing the contents ofP ORDER in the program (i.e., on disk) would eliminate the need for sortingO until a new record is added to the file. Sorting takes time and - unless˙ where an˙EN ;˙N =TEXT can be rewritten in assembly language to speed it up - one shouldO remember to keep string length to a minimum. The longer the strings, the$ longer it takes to sort them. EOF/LW.FI;LM 10;RM 75 .CE ˙nless˙ where an˙EN ;˙9FORTH STYLE (or MY PET PEEVES ABOUT FORTH PROGRAM{MER}S)  ?It has been said that Forth programmers are rarely able to readAtheir own programs a couple of months after writing them. JudgingBy convention, this is the ( --- ) placed after a word's name.?You immediately know something about the word. It could be that?it needs a parameter ( n-- ) from, or leaves something on ( --n˙;˙>or --f) the stack. In either case, one can tell right away. If@the word is neutral (no stack effect) it's quite alright to omitit. The key is consistency.  >Selecting a good name seems to be a problem for many. There is˙eaves something on ( --n˙;˙?nothing quite as bad as an abbreviation which has no meaning to>the person trying to disect the program. I am one of those whoAdoesn't like to just type them in, I like to understand and learn˙to be a problem for many. There is˙eaves something on ( --n˙;˙@from tehm, too. Choose words so they convey an idea of what theyuseful stuff simply because the style was so bad and I did not/feel like fighting my way through the morass.  ?These are my pet peeves after looking at lots of Forth screens.˙er,˙˙;˙>How should it be done and what should it look like? Here is anAexample. This little program doesn't do much except print labels.8But I think it illustrates good Forth style very well:   .NF ˙ pet peeves after looking at lots of Forth screens.˙er,˙˙;˙> 0 ( ADDRESS LABELS - 1 Label Size: 1 x 3 inches )C 1 BASE->R DECIMAL 33 CLOAD RANDOMIZE 72 CLOAD TRIADs2 2 : LAB ; ( boundary for FORGETting )G 3 : CLEARPAD PAD 150 BLANKS FILL ; ( 150 spaces into PAD )˙˙C 4 : DASHES 30 0 DO ." -" LOOP ; ( display 30 dashes )/ 5 : FORMAT. CLS 14 3 AT ." LABELS"= 6 2 5 AT DASHES 2 7 AT DASHES= 7 2 9 AT DASHES 2 11 AT DASHES˙es into PAD )˙˙- 8 2 13 AT DASHES ;I 9 : CONTENT? ( put 5 lines of up to 30 characters into PAD )J 10 2 5 AT PAD 30 EXPECT 2 7 AT PAD 30 + 30 EXPECT˙ 2 9 AT DASHES 2 11 AT DASHES˙es into PAD )˙˙J 11 2 7 AT PAD 60 + 30 EXPECT 2 11 AT PAD 90 + 30 EXPECT. 12 2 13 AT PAD 120 + 30 EXPECT3 13 : LINES ( retrieve contents of PAD )G 14 150 0 DO PAD I + 30 -TRAILING TYPE CR 30 +LOOP ;˙o PAD )˙˙ 15 -->   # 0 ( ADDRESS LABELS - 2 )C 1 : HOW_MANY? ( --n , number of labels to be printed )F 2 2 16 AT ." How many ? : " QUERY INTERPRET ;˙ DO PAD I + 30 -TRAILING TYPE CR 30 +LOOP ;˙o PAD )˙˙= 3 : .LABELS ( n-- , output n labels to printer ): 4 SWCH 0 DO LINES CR LOOP UNSWCH ;8 5 : ?MORE ( --f , continue program if YES )2 6 2 16 AT ." More ? (Y/N) "˙PE CR 30 +LOOP ;˙o PAD )˙˙6 7 KEY DUP 89 = SWAP 121 = OR 0= ;5 8 : REMIND CLS CR ." Enter FORGET LAB" ;< 9 : TEST PAD 150 65 FILL 1 .LABELS CLEARPAD ;C 10 : LABELS BEGIN CLEARPAD FORMAT. CONTENT? HOW_MANY?˙+LOOP ;˙o PAD )˙˙, 11 .LABELS ?MORE& 12 UNTIL REMIND ;@ 13 CLS 2 10 AT ." Enter TEST for printer line-up" CR= 14 2 12 AT ." LABELS to run program" CR 15 R->BASE  .FI  ˙˙o PAD )˙˙A As you can see, the top level word by itself gives an almost.complete description of how the program goes:  %BEGIN^^^^^^Start an indefinite loop *CLEARPAD^^^Fill the PAD area with blanks )FORMAT.^^^^Put line guide on the screen ˙ ˙˙o PAD )˙˙#CONTENT?^^^What goes on the label 9HOW_MANY?^^Input how many copies of this label to print .LABELS^^^^Print them G?MORE^^^^^^Continue with the program ? (Leases a false flag for UNTIL) ˙ blanks )FORMAT.^^^^Put line guide on the screen ˙ ˙˙o PAD )˙˙@REMIND^^^^^Issue reminder to use LAB for FORGETting the program  ; In addition to the above, there are only three more:  5DASHES^^^^^Put 30 dashes on the screen (line guide) )LINES^^^^^^Retrieve the contents of PAD ˙the screen ˙ ˙˙o PAD )˙˙?TEST^^^^^^^Print 5 lines of capital A's for printer alignment  J Note that all colons are easy to spot and the program is very easy toJread. True, it's very short - but the longer an application gets, the more˙of PAD ˙the screen ˙ ˙˙o PAD )˙˙)helpful and important good style becomes.   > CONVERSION OF FORTH SCREENS TO D/V 80 6 (AND BACK TO SCREENS)  M Some time ago, there was a program floating about to convert Forth ˙ )˙˙I screens to DIS/VAR 80 files. If memory serves me correctly, it K was 13 (!) screens long and required a lot of typing by the user L including that ugly F-D" word. Now, in the September issue of the ˙about to convert Forth ˙ )˙˙H LA 'TopIcs' newsletter (with credit to the TINS newsletter) I H spotted a three-screener to do the same thing. Though 16-line L screens are shown, the article states that the code is Wycove and ˙he ˙about to convert Forth ˙ )˙˙J I/O specific words would have to be replaced to make it work in L TI-Forth. If you don't know what Wycove's I/O words mean (or do), J this is a bit hard to do. Here, for all the writers who wish to ˙about to convert Forth ˙ )˙˙J include Forth screens in text files but have no desire to enter K them manually, is a two-screener that not only transfers screens F to DV80 files, but also does it in reverse. And it works in  standard TI-Forth: ˙)˙˙ l C 0 ( SCREENS>FILE ) BASE->R DECIMAL 0 CLOAD F>S 68 CLOAD STAT " 1 HEX 0 VARIABLE BUF 4E ALLOT # 2 PABS 2+ BUF 1400 FILE XF XF : 3 : FNAME ( -- cnt ) CR ." Filename: " PAD 40 20 FILL ˙orks in  standard TI-Forth: ˙)˙˙< 4 PAD 1+ 30 OVER OVER EXPECT -TRAILING 2- -DUP ; : 5 : SETFILE ( n-- ) IF XF SET-PAB VRBL 50 REC-LEN DUP A 6 ROT 1- C! 1+ PAD PAB-ADDR 9 + ROT VMBW . 7 ELSE DROP APPND THEN ; ˙tandard TI-Forth: ˙)˙˙ 8 : S>F FNAME SETFILE OPN 8 9 CR ." Start from screen: " QUERY INTERPRET @10 CR ." End with screen: " QUERY INTERPRET 1+ SWAP '11 DO I BLOCK 400 OVER + SWAP ˙ ELSE DROP APPND THEN ; ˙tandard TI-Forth: ˙)˙˙>12 DO I BUF 20 MOVE BUF 40 -TRAILING 1 MAX WRT DROP 13 40 +LOOP LOOP CLSE 214 CR CR ." S>F, F>S or FORGET BUF" CR ; 15 R->BASE -->   0 ( FILE>SCREENS )  1 BASE->R HEX  2 : EOF STAT 1 AND 0= ; ˙dard TI-Forth: ˙)˙˙ 3 : F>S FNAME SETFILE OPN 8 4 CR ." Destination screen: " QUERY INTERPRET 8 5 CR ." How many screens?: " QUERY INTERPRET  6 OVER + SWAP C 7 DO EOF IF I BLOCK UPDATE 400 OVER OVER 20 FILL OVER + SWAP ˙rd TI-Forth: ˙)˙˙6 8 DO EOF IF RD BUF I ROT CMOVE ELSE LEAVE THEN  9 40 +LOOP 10 THEN 11 LOOP CLSE FLUSH .12 CR CR ." F>S, S>F or FORGET BUF" CR ; 13 R->BASE 414 CLS CR ." Enter S>F for screens to DV80 file," ˙AP ˙rd TI-Forth: ˙)˙˙=15 CR ." or F>S for DV80 file to screens." CR CR ;S  l  M The original version of this routine comes from Michal Jaegermannn L of the Edmonton, Alberta, user group and is only one screen long. ˙P ˙rd TI-Forth: ˙)˙˙K However, it works only with the enhancements he has incorporated L in his file I/O load option. I adapted it to work with the normal M -FILE load option and added some on-screen prompts which increased       ˙: ˙)˙˙J its size to two screens. Even though this is a step backwards - E at least from Michal's version - it's still a considerable I improvement over the 13-screener and a useful one if you don't ˙ increased       ˙: ˙)˙˙I happen to have Wycove. With the prompts it is self-explanatory I and requires only one comment: If you have written a number of I (consecutive) screens to a file and wish to append more to the ˙creased       ˙: ˙)˙˙L same file, press instead of entering a new file name. For F example, you have established a file named DSK2.SCREENS and L transferred screens 39 through 45 to it. If you opt for S>F again ˙ased       ˙: ˙)˙˙M and press at the 'Filename:' prompt, the next entries, say K from starting screen 60 to ending screen 66, are appended to the K earlier transfer. Your 'SCREENS' file will contain screens 39-45  and 60-66.  ˙N Please note that only the contents of each screen is written to the J file. For use in an article, such as this one, you will have to J insert some blank lines to separate the screens. For eye appeal ˙ and 60-66.  ˙E you may also want to add line numbers as I have done here.  ˙the J file. For use in an article, such as this one, you will have to J insert some blank lines to separate the screens. For eye appeal ˙ and 60-66.  ˙