home *** CD-ROM | disk | FTP | other *** search
- ╔═══════════════════════════════════════════════════════╗
- ║ Lesson 1 Part 5.0 F-PC 3.5 Tutorial by Jack Brown ║
- ╚═══════════════════════════════════════════════════════╝
-
- Welcome back. In this lesson we will take a look at how to use F-PC's
- built in editor.
-
- Our first program will is going to display a checker board on the
- display screen. Instead of typing the program directly line by line as
- we did with our simple databases we will type the program into a
- separate text file using the EDitor. The advantage is that it will be
- easier to fix our mistakes, (won't have to retype the whole program) and
- we will have a permanent copy of our final working program.
-
- In F-PC the default extension for Forth source code files is SEQ.
-
- Lets call the file that we will contain our checker board program
- BOARD1.SEQ where the 1 is for our first attempt (there may be many!).
-
- Before we start the EDitor let's make sure that the current directory is
- the work directory. Type:
-
- CD C:\WORK <enter> <---- or what ever you called your work directory.
-
- If you wanted to keep your files on the A: drive instead you could just
- type:
-
- A: <enter>
- CD A:\WORK <enter> <---- if you have a WORK sub directory on A:
-
- To start editing a new file called BOARD1.SEQ, Press <ESC> and select
- the New File option and enter the file name BOARD1 when prompted to do
- so. You can begin editing a new file by pressing <ALT> N and entering
- the file name when prompted to do so. Do this now and you should see
- something like the display below.
-
- ╔══INSERT Line=1 Column=0 Page#=1 Lines=2 Characters=2 ══════╗
- ║ ║
- ║ ( this takes up the full screen!) ║
- ║ ║
- ╚══HELP=F1═══════════File = C:\WORK\board1.seq ═════MENU=ESC════════╝
-
- The graphics display here is no match for Zimmer's!
-
- The editor is for the most part uses commands similar to the wordstar
- editor, sidekick editor, and those included with the Borland Turbo
- products. Use the Help function key F1 to get HELP screen and choose
- the SED-Help menu item for further help with the editor commands. Enter
- the following program using the editor.
-
- \ CHECKER BOARD PROGRAM
- \ Version Number: 1
- \ Date: September 18, 1988
- \ Author: <your name>
-
- : BLACK ( -- )
- SPACE SPACE ;
-
- : WHITE ( -- )
- 177 EMIT 177 EMIT ;
-
- : ROW1 ( -- )
- CR BLACK WHITE BLACK WHITE
- BLACK WHITE BLACK WHITE ;
-
- : ROW2 ( -- )
- CR WHITE BLACK WHITE BLACK
- WHITE BLACK WHITE BLACK ;
-
- : BOARD ( -- )
- CR ROW1 ROW2 ROW1 ROW2
- ROW1 ROW2 ROW1 ROW2 ;
-
- : CHECKER_BOARD ( -- )
- BOARD CR CR ;
- ----- end of program -----------<don't type this line!
-
- To leave the editor and save the program press SHIFT F10
- and you will be back in Forth with the " ok " prompt.
- To load the program type:
-
- FLOAD BOARD1.SEQ <enter> and you will see:
-
- BLACK isn't unique <--- don't worry about this it means
- WHITE isn't unique ok <--- the Forth also has words BLACK and WHITE
-
- To test the program type:
- CHECKER_BOARD <enter> and you will see the checker board!
- If you have an error re-edit BOARD1.SEQ and fix it! and repeat
- the above process. That's all the room this time!
-
- ┌────────────────────────────────────┐
- │ Please move to Lesson 1 Part 6.0 │
- └────────────────────────────────────┘
-