home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_GEN
/
FORTH_86.ZIP
/
MANUAL.4TH
< prev
next >
Wrap
Text File
|
1993-12-09
|
48KB
|
1,291 lines
Getting Started
For beginners 1
Disassembler 2
Entering Numeric values 2
Printing strings 3
Numerics in strings 3
Printing Numeric values 3
Defining new words 5
LINK 5
Using the editor 6
Comments in Code 18
Debug utilities
Dumping memory and stack 8
Dump Dictionary 8
DEBUG; TRACEON; TAG 8
TRACEL 9
TM, TD, and SYNONYM 9
differences from normal 10
Variables and Constants 12
BLOCK 12
CONST 12
,CONST ( comma const) 13
Other Words
FLOAD 15
ON REDEFINE 15
OFF PRINTLOAD 15
OMIT 16
Writing Assembly code
BLOAD 15
:EXIT and :ENTER 16
Inline Assembler 16
Cross Compile Mode
CROSS-COMPILE & UNCROSS 17
LOAD & ISAVE 17
STATUS 19
MAP 19
4TH_86
( based upon United Controls Corporation CP/M80 Forth.)
Translated for IBM PC with EGA graphics.
( Demo ) Version 4.01 December 1993
by
M.F.Buchan
Kinnell House 1 Argyle Place, Rothesay,
Isle of Bute, PA20 0AZ,
Scotland, U.K.
Voice: 44-700-505185
Fax: 44-700-504051
Compuserve 100012,651
Internet: larryb@rothesay.demon.co.uk
Translation Copyright (c) 1988, 1989, 1993, M.F.Buchan
Original Copyright (c) 1982 United Controls Corporation,
Huntsville, Alabama.
4th_86 GETTING STARTED page 1
The manual provided with this demo version is limited in
content. The full manual is being updated at the moment and will be
available with registered versions.
===============
Getting Started
===============
The registered package provides three versions of the system.
4TH_86.COM, 4TH_86DD.COM, and 4TH_86FP.COM. The first is a very minimal
system with no disassembler; DOS shell; etc. 4TH86DD has everything
except floating point; double precision; and transcendental functions.
These are added to create 4TH_86FP.COM.
The downloadable demonstration version 4TH86DEM.COM is
essentially the same as 4TH_86FP.COM -- but starts in tutorial mode --
uses only page0 video as default -- has additional promotional text
added -- a 10 second delay on exit -- and has certain other limitations
as a consequence.
From the DOS prompt, type 4TH86DEM <return> and you will be in
4th_86. If you want to get back to DOS, type BYE. (QUIT has been re-
named to Q-U-IT as it is no longer a preferred exit word]
If you are using the DEMO version you will be automatically
placed in the split-screen tutorial mode. To exit this type UNSPLIT.
The tutorial can always be re-entered at any time by typing HELP.
The system words DIR and TYPE can be used from within 4th_86 and
paths are now implemented. Drive letters from A: through D: are
implemented and can be used alone to change default drive, or as prefix
with DIR and TYPE. CD can be used to change directory, but facilities
like MD, RD, and REName and COPY are done by shelling to DOS first,
using the word SYS
The screen contents can be dumped to printer using the normal
IBM-PC keyboard keys SHIFT PRTSC. Also CTRL-P will toggle on and off
duplication of screen output to printer.
=============
For beginners
=============
If you are not familiar at all with FORTH as a language, then a
good book to read is FORTH: A text and Reference by Mahlon G. Kelly and
Nicholas Spies -- Prentice Hall -- 1986.
The following tutorial is not dificult to follow however, and
you should work through it as the specific features which make this
implementation unique will not be covered in any general text book.
You also have the built in help facility.
4th_86 GETTING STARTED page 2
The screen display will be easier to follow if you exit from the
default tutorial mode -- by typing FULLSCREEN -- before you try any of
the following.
Before we get into the basics of FORTH -- let's just have a
quick look at the disassembler in order to become familiar with its
use. This disassembler will be of enormous help when you come to write
your first FORTH definitions of - as they are called - "words".
============
Disassembler
============
"DD" is the 4th_86 word which calls up the diassembler. It must
be followed by the word you want to disassemble.
To show the use of the disassembler, let us see how the word BYE
is made up. Type DD BYE and then press <return>. This will show you
that BYE makes use of several other Forth words such as PAGE0, BRKON,
SECDELAY.
Look at each of these words by typing DD PAGE0 etc. Unlike BYE
itself - you will see that PAGE0 and BRKON are pure assembly code.
SECDELAY is interesting in that most of it is assembly code -- but a
part in the middle is Forth code. It is quite simple to mix assembly
and Forth source in this manner. The actual source code for SECDELAY is
provided on disk.
You can also try DD THREAD, DD COLON, and DD SRET if you wish.
In fact you can type DD followed by any 4th_86 word and it will be
disassembled.
Perhaps a better word to demonstrate how Forth and Assembly can
be mixed is the word GC. Type DD GC and then use ctrl-S to pause and
start the display.
You may get OOPS displayed in the disassembly -- and this simply
means that the word which ** should ** appear there has been removed
from the dictionary. There are two reasons for doing this -- to save
space -- and because a ** very ** large number of the words needed to
build up the system from source are of no use at all in normal use.
You can not of course disassemble any word which has been
removed from the dictionary.
The display can be "aborted" at any time by pressing the space
bar. Ctrl-S will start and stop the display.
Ctrl-C and Ctrl-Brk are normally disabled, as using them would
dump you back into DOS. The word BRKON turns the ctrl-Brk facility on
again.
4th_86 GETTING STARTED page 3
=======================
Entering Numeric Values
=======================
Here is one place that 4th_86 differs from all other Forths.
Numbers can be input in Hex, Binary, Decimal or Octal. In 4th_86
considerable flexibility is introduced by using the same notation as
when writing ASM code -- a suffix after the number -- 123H -- 123Q ( or
123O) -- 11011B for Hex, Octal, Binary respectively.
Decimal is the default, so for 123 decimal just type in 123.
ASCII values can be inserted as "A" rather than 41H -- or "B" "C" "D"
etc.
================
Printing Strings
================
Unlike standard Forths, the dot-quote word ( ." ) does not
double as part of the initial string quote. It is a separate word.
4th_86 => " this is a test" ."
Other Forths => ."this is a test"
Note also that in 4th_86 a space is needed between the first
quote sign and the start of the string text. This is because the
leading " is a Forth word just like any other word. The closing " is
not a word -- it is an end of string delimiter.
===================
Numerics in Strings
===================
String values are entered between quotes
" this is a test"
If it is required to enter specific numeric bytes as part of the
string -- for example 0D Hex and 0A Hex -- this is done by using the
up-arrow ^
" ^0dh 0ah^this is a test"
or " ^13 10^this is a test"
The result of course is the same as
crlf " this is a test"
There is a file on disk called FRENCH.4TH which can be loaded [
type FLOAD FRENCH.4th ] and will demonstrate how special accented
characters and ascii graphics can be displayed.
4th_86 GETTING STARTED page 4
=======================
Printing Numeric Values
=======================
To print out the value on the TOS (top of stack) the operators
.H .L .HB .C and . are provided.
.H prints a word in Hex with a leading space. .HB prints a byte
in Hex with leading space. A single period . prints the TOS in decimal
with a leading space.
.C prints the ASCII character if one exists -- but with no
leading space.
.L is the same as . but without a leading space. It's main
purpose is for sending ANSI control codes requiring numeric parameters.
A leading space would invalidate the ANSI sequence.
Try the following at the 4th86 prompt
20H 16 "C" + + dup .H crlf dup . crlf 30H - .C
Try also the following
20H 16 "C" + + dup .h 3 spcs dup . 3 spcs 30h - .c
In normal Forths different number bases can not be mixed. It is
necessary to define a variable BASE as either HEX DECIMAL etc. 4th_86
does not have this clumsy restriction.
Whilst there used to be a variable called BASE in 4th_86 it had
nothing to do with number bases, and was never used in normal events.
It was the relocation offset used when meta-compiling stand-alone COM
programs. It is no longer used in version 4.01.
You may have noticed that to the left of the 4th_86 ■ prompt
there is a highlighted number, which is usually _0_
This number represents the total number of two byte values
pushed on the data stack. ( It can become negative if stack underflow
takes place )
Try typing in numbers 2 <return> 3 <return> 4567 <return> A"
<return> and watching the depth indication increase.
Now print out the stack values one at a time with . . . (or if
you prefer it .H .H .H ) and note the depth indication decrease.
If you print out a value when the stack is empty you will get a
negative value of depth display.
4th_86 GETTING STARTED page 5
One feature of all FORTHs is that an unrecognised entry clears
the stack and most other transient variables.
Type in 2 3 4 5 <return> to get some values on the stack,
then type sgkdfshk <return> [ or some other garbage entry ] and the
depth display will become zero.
In addition to the auto-depth display, the word DEPTH is
available to use within definitions.
==================
Defining new words
==================
Type : Fred 3 . ;
This defines a word Fred -- which simply prints the value 3
Type FRED (or fred FrEd fREd) and you will see 3 printed
(out of curiosity, disassemble with DD FRED )
Type : Fred 4 . ;
You will be asked if you want to redefine Fred -- answer Y
Type FRED and and you will see that 4 is now printed instead
of 3
Now type
: Larry 4 ;
: Tom Larry 2 * . ; and then type TOM
You should get an 8 printed -- Larry -- which is 4 -- has been
multiplied by 2
Let's redefine LARRY
: Larry 6 ; ( and of course answer Y )
Now type TOM --- and you will find that you do not get 12
printed - you still get 8.
The redefinition of LARRY from 4 to 6 has not affected the prior
definition of TOM. This is the normal way with Forth. When TOM was
defined -- it used the IMMEDIATELY PRIOR defined value of LARRY. The
redefinition of LARRY ** after ** the definition of TOM does not affect
TOM's use of the original LARRY definition.
A clearer picture of all the words you have entered can be seen
if you type DDICT.
Now let's see how we can actually replace the old
definition with a new one.
4th_86 GETTING STARTED page 6
====
LINK
====
Type DD LARRY and you will see the constant 6
type FORGET LARRY and then DD LARRY and you will see that we
are now back to our original definition of LARRY as the value 4
type : KEN 6 ;
LINK LARRY KEN ( ignore the warning message )
TOM
you should get the value 12 printed. All calls to the last LARRY
are now diverted to KEN instead. Try DD LARRY and DD KEN.
The last word linked can be restored with UNLINK
Type UNLINK which unlinks LARRY from KEN
type TOM and you should get 8
type DD TOM DD KEN and DD LARRY to confirm
================
Using the editor
================
Make sure you have read and implemented the instructions in
INTRO.4TH for configuriing EDITR.BAT and ASMBL.BAT.
You must first tell 4th_86 the name of the file you want
to edit. The default name built into 4th_86 is EDHELP.TXT -- so if you
type EDIT you should get this help message displayed by your editor.
The word USING allows you to change the default file name to
another one. To edit a different file -- say SQ.4TH -- first type
USING SQ.4TH -- then all future uses of the word EDIT (and the words
REDIT and RELOAD) will call up the file SQ.4TH.
The editor is designed to be much more flexible than this
however. After editing a Forth source file, the normal procedure would
be to re-load it for testing and debugging. For this purpose, the words
RELOAD and REDIT exist.
RELOAD behaves the same as FLOAD except that it uses the name
already specified by USING. Therefore
4th_86 GETTING STARTED page 7
FLOAD SQ.4TH is the same as having executed USING SQ.4TH and
then executing RELOAD
REDIT also uses the name specified by the previous USING and is
equivalent to EDIT followed by RELOAD.
The normal edit => fload => test => re-edit cycle is simplified
Try USING SQ.4th
FLOAD SQ.4th
DD OSQUARE
REDIT
<==> DD OSQUARE
REDIT
<==> DD OSQUARE where <==> are the steps to exit from
the editor you are using.
You will see by the addresses attached to the DD disassembly
that each REDIT redefines a new OSQUARE, getting higher and
higher in memory.
To confirm this -- type DDICT and examine how many copies of the
word OSQUARE you have loaded.
This multiple redefinition can be avoided by defining a
dummy word -- say STRT -- and starting your source file with FORGET
STRT
Try
USING SQ.4TH
: STRT ;
FLOAD SQ.4TH
DD OSQUARE
REDIT
<==> DD OSQUARE
now the re-load of the newly edited file SQ.4TH
causes deletion of the previously loaded file.
Following this tutorial should now be much easier as a hands-on
process. Instead of trying to key into 4th_86 lengthy definitions
directly from the keyboard, they can be edited into a test file, and
the file loaded.
Lower and upper case are equivalent, whether entered from the
keyboard or floaded from a file. Of course, case in quoted strings is
preserved
" Hey There" ." will be printed Hey There - not capitalized
nor all lower case.
4th_86 GETTING STARTED page 8
========================
Dumping memory and stack
========================
DM 8DM and 16DM are memory dumps -- try 2000H 8DM etc.
NOTE that there is a number left on the stack after the dump is
completed. Use .H to display this value and you will see that it is
2080H. The purpose of this is so that the dump can be continued simply
by typing 8DM again [ or 16DM or whatever ].
DS and DDS are stack dumps
try 2 3 4 5 DS <return>
DS <return> DS <return>
DDS <return> DS <return>
DS prints out the stack values, and leaves them unchanged
DDS (destructive dump stack) prints the values and removes them
try 2 3 4 5 <return> DS <return> abcd <return> DS <return>
this is a convenient way to clear and reset the stack -- type in
any meaningless phrase (i.e. - abcd), press return, and the error
message clears the stack.
===============
Dump Dictionary
===============
Type DDICT and you will be presented with a display of the words
in the dictionary, together with the address of the dictionary entry
and flag byte (high segment ) and the start offset of the code area (
low segment ). The display has now been arranged to pause every 15
items. RETURN produces the next 15 entries. Any other keypress aborts.
Type PDICT DUP and instead of returning all the words in the
dictionary, you will just get the addresses for the word DUP.
===================
DEBUG; TRACEON; TAG
===================
We already have TOM defined
Type TRACEON TOM and then TOM
the word is traced, and stack values are displayed
4th_86 GETTING STARTED page 9
TRACEOFF removes the trace, and TAG (trace-again) restores it
applying TRACEON to another word automatically removes it from
the old one
any errors -- as well as clearing the stack -- also remove
TRACEON
DEBUG is an on/off toggle.
type TRACEOFF to be sure -- and then type DEBUG ( to toggle
debug on)
now type 3 4 5 6 <return>
. . <return>
DDS (return>
DEBUG ( to toggle it off)
this display of stack contents is useful.
======
TRACEL
======
This is Trace-level and is used for tracing DO...LOOP structures
Type : SLOOPY 5 0 do I . loop ;
then run it by typing SLOOPY
you should get 0 1 2 3 4 5 displayed on the screen
now TRACEON SLOOPY
SLOOPY -------- not very impressive
3 TRACEL
SLOOPY ---- somewhat better ???
===============
TM; TD; SYNONYM
===============
Type TM and the time will be shown
Type TD <return> and then TD <return> again.
the elapsed time between the two events is shown
Try : dly1 1000 0 do loop ;
: dly td 10 0 do dly1 loop crlf td crlf ;
4th_86 GETTING STARTED page 10
then run by typing DLY.
The SECOND line shows the elapsed time to complete the word DLY
-- measured between the first TD and the second TD.
No -- indeed this system is not as fast as many others -- but at
the moment speed is not the objective. The objective is a user-friendly
interface which will allow ease of code writing and learning for
beginners.
So you think TM is too terse and non-standard?
well try SYNONYM TIMEELAPSED TD
and type TIMEELAPSED -- purists can build synonyms for any word
they think "non-standard" (or modify the source) and create a
new system file using SAVESYS.
4th_86 GETTING STARTED page 11
=======================
differences from normal
=======================
4th_86 is different from other implementations of FORTH in
several ways. Some of the differences are because of the targeted
applications of FORTH such as the fact that the dictionary is stored
separately from the code so compact stand-alone code can be generated.
Other differences arise because of adding features not commonly found
in other FORTHs, different naming conventions, and different
philosophies in the implementation.
Listed below are some of the minor differences that may
"disturb" the user of a more conventional FORTH. SYNONYMS or short
words can be used to re-define the more familiar names. For example:
SYNONYM EMIT .C
or
: KEY 0 BEGIN DROP 255 6 MON2 DUP END ;
After the table below is a discussion of several more
significant differences.
Many FORTHs 4th_86 exact
Equivalent replacement
C@ B@
C! B!
EMIT .C
KEY 0 BEGIN
DROP 255 6 MON2 DUP
GETCHR END
TYPE 1 DO DUPB@ .C
1+ LOOP DROP ."
VARIABLE DATA[ ...]
CONSTANT CONST
."string" " string" ."
ABORT" string" " string" 1 ERMSG
LEAVE EXIT
BEGIN..UNTIL BEGIN...END
BEGIN..WHILE..REPEAT REPEAT..WHILE..ENDWHILE
D+ D= etc. ,+ ,= etc.
4th_86 GETTING STARTED page 12
In 4th_86, DO..LOOPs terminate when the loop count is exceeded,
not equaled. Also in most FORTHs, the loop is always executed at least
once, while in 4th_86 the loop index is checked against the limit
before the loop is executed (loop skipped if limit exceeds maximum). In
4th_86, loops cannot use negative increments, When the word EXIT
(corresponds to LEAVE) is executed, the loop is exited immediately
(most FORTHS set the loop limit equal to the current loop index).
The file SHARPS.4th contains source for double precision
formatted output routines -- it also includes a self loading and
executing demonstration of these.
CREATE...DOES is not included as such, but the file ARRAY.4th
shows how defining words can be created. This file also contains a self
exeuting demonstration.
=======================
Variables and Constants
=======================
BLOCK
=====
Purpose: Reserves a block of contiguous memory where
the size of the block is on the TOS and the name of the
block is the next word. When the name is executed, the
address of the block of memory associated with it is
placed on the stack.
?? block_size --- ?? ( when BLOCK is executed )
?? --- ?? address ( when the name of the block
is executed )
Example: Reserve 25 bytes of memory and name it
BUFFER.
25 BLOCK BUFFER ( A buffer which is 25 bytes long )
Example: Assume that the address of BUFFER is 453EH.
Using the word .H print the address of BUFFER.
BUFFER .H
453E ( this is printed on the console )
4th_86 CONSTANTS AND VARIABLES page 13
CONST
=====
Purpose: Defines a constant whose value is on TOS and
name follows CONST. When the name is executed, the
value associated with that name is placed on TOS. Only
single precision integers may be used as the value of a
constant.
?? value -- ?? ( when CONST is executed )
?? -- ?? value ( when name of constant is executed )
Example: Define the constant B_SIZE whose value is
1100. Also, using the word . print the value of SIZE.
1100 CONST B_SIZE
B_SIZE .
1100 ( this is printed on console )
,CONST ( comma const)
======
Purpose: ,CONST is similar to CONST except a double
precision constant is defined.
?? --- ??
Format: value ,CONST name
DATA[ ( data left bracket)
======
Purpose: Defines a block of memory with the values
between DATA[ and ] with the name of the block
following ]. The values may be:
1. one byte integers
2. two byte integers
3. strings with a length byte
4. strings without a length byte
When the name of the block is executed, the address of
the block associated with the name is placed on the TOS
4th_86 CONSTANTS AND VARIABLES page 14
There are special words which allow the data type to
vary as mentioned above. The words are:
BYTE
WORD
LENGTH
NOLENGTH
and are respective to the meanings 1 through 4 above.
The defaults are WORD and LENGTH. When these words are
detected, all remaining values have the same data type
until either a new defining data type is encountered
or a ] is found, which ever comes first. Note that '
and " can be used in DATA[
?? --- ??
Example: Define TABLE whose values and format are:
145 ( one byte)
5394 ( one byte)
13 ( two bytes)
" HI" ( with length byte)
423EH ( two bytes)
" HELLO" ( no length byte)
and write a word, TEST which prints each value one per
line.
DATA[ BYTE 145 5394
WORD 13
LENGTH " HI"
WORD 423EH
NOLENGTH " HELLO" ] TABLE
: TEST
TABLE DUPB@ . CRLF
1+ DUPB@ . CRLF
1+ DUP@ . CRLF
2+ DUP 4 + SWAP DO
DUPB@ + 1+ DUP@ .H CRLF
2+ DUP 4 + SWAP DO
I B@ ." LOOP ;
TEST
145
18
13 HI
423E
HELLO
4th_86 OTHER WORDS & FEATURES page 15
=====
FLOAD
=====
This has already been described. An alternative to FLOAD
FILE.ABC would be " FILE.ABC" LOAD. The use of the word FLOAD avoids
the need for string quotes.
ON REDEFINE
============
REDEFINE is a flag which determines whether the compiler will
give a warning or not when a re-definition is encountered. ON REDEFINE
allows words to be redefined without warning. OFF REDEFINE causes
warning messages.
OFF PRINTLOAD
=============
PRINTLOAD is a flag which determines whether the file will be
listed on the screen as it is loaded. OFF PRINTLOAD allows the file to
load without being displayed on the screen. ON and OFF PRINTLOAD can be
scattered throughout a file if parts are to be observed during loading
-- as indeed can ON and OFF REDEFINE.
=====
BLOAD
=====
BLOAD is used for COM files created by MASM. It does ** NOT **
check for re-definition so care is needed not to duplicate words.
This feature has been briefly described in INTRO.4TH and will
not be elaborated in this shortened manual. In-line assembly is
available and will normally be the preferred method.
There is however a file TEST.ASM provided, which you can use [
issue the command BLOAD TEST --- do **not** use the .ASM suffix ]. The
first time you BLOAD this file it will automatically compile into
TEST.BIN [ provided you have configured ASMBL.BAT properly ] and then
load the TEST.BIN into 4th_86.
By examining the source for TEST.ASM you will see that it
defines three words FIRST SECOND and THIRD. If you execute these words
they each print a message.
BLOAD only compiles the target file into BIN if there is no BIN
file already existing -- or if its date is earlier than that of the ASM
file. If you use BLOAD TEST again it will no longer compile TEST.ASM --
unless you delete TEST.BIN first -- or edit TEST.ASM to give it a later
date.
4th_86 OTHER WORDS & FEATURES page 16
================
:EXIT and :ENTER
================
These allow changes from assembly to colon ( :ENTER) and from
colon to assembly ( :EXIT) within the same word definition. See the
file SECDELAY.4TH
====
OMIT
====
As the number of words added to the system increases, it soon
becomes necessary to "prune out" the garbage entries in the dictionary.
All code entered has a dictionary entry, -- and is referenced by other
code. A good 50% of the code entered however will never be needed for
external applications, and maintaining a dictionary pointer to it is
simply a waste of space.
================
Inline Assembler
================
This feature has again been described briefly in INTRO.4TH and
will not be elaborated on in this limited manual.
There are however two files MASM.TST and MASMTST which were used
in developing the assembler. These can both be FLOADed -- or examined
to see the format of entering inline assembly instructions.
Both files end by calling upon the disassembler to display the
code that was just loaded. The object was to check that the assembler
and disassembler were consistent.
Many of the source files for the system have both inline
assembly; BLOADable assembly; and plain FORTH code. Much can be learned
by examining these.
=============================
How to compile demonstrations
=============================
To create SINE.COM simply bring up 4TH_86 and then type FLOAD
SINCOM.DEM The process will end by exiting to DOS. Look at the file
SINCOM DEM which automates the building process, and the file SIN.4TH
which is the source for the demonstration, to see what is happening.
4th_86 ASSEMBLY & CROSS COMPILE page 17
Similarly you can FLOAD SMITH.DEM to produce SMITH.COM -- and of
course FLOAD HILCOM.DEM will produce HILBERT.COM.
HILSIER2 is used exclusively by HILCOM.DEM to produce
HILBERT.COM -- and omits the facility for defining levels and
magnification. If you examine the source code however, you will see
commented out the relevant code to allow level and magnification to be
specified from the 4th_86 command prompt. You can edit HILSIER2.4TH [
or use HILSIER.4TH ] to reinsert the omitted code - and then reload.
The easiest way is by using REDIT as already described.
=======================
CROSS-COMPILE & UNCROSS
=======================
The demonstrations which you created above were created in
CROSS-COMPILE mode. The 4th_86 system provides the user with a means of
compiling any system provided either image [ xxx.IMG ] or source code
files are available for all the words needed.
The cross-compiler is not a separate compiler, instead it is a
mode in which the compiler executes. The compiler runs in one of two
modes: cross-compile or noncross-compile. Until specified, the compiler
will operate in noncross-compile mode. Executing the word CROSS-COMPILE
switches to the cross-compile mode.
Unlike earlier versions of 4th_86, CROSS-COMPILE now needs no
parameters. Because all cross compile activity is in its own dedicated
segment, it starts at offset 100H and has it's upper limit close to the
64K offset limit.
several points need to be noted
a) code generated in cross-compile mode can ** NOT ** be run
during the process of cross compiling. All offsets are identical to the
final code produced -- but the segment is inappropriate.
b) all code forming part of the "mother system" can be run in
cross-compile just as in noncross mode. Obvously this is essential or
the compiler would be "dead".
c) cross-compiled definitions can not reference a word which has
not already been itself defined in cross-compile. The word may already
exist in the mother system -- and be executable -- but attempts to use
it in a cross-compie definition will give an error message.
d) Cross-compile creates its own dictionary, and FIND will
reference this dictionary to determine code addresses ** NOT ** the
system dictionary. The system dictionary is only used for words in
immediate mode.
4th_86 ASSEMBLY & CROSS COMPILE page 18
ISAVE
=====
This is only used during cross-compile. At any stage of partial
completion of the cross-compile, the memory image can be saved by using
ISAVE FNAME.IMG
ILOAD
=====
This allows a previously saved xxx.IMG file to be re-loaded in
the cross-compile mode. Unlike earlier versions of 4th_86, image files
are not system sensitive because cross compile takes place in a
dedicated segment - and always at offset 100H.
COMMENTS IN CODE
================
Forth or in-line assembly code between brackets is treated as
comments and ignored by FLOAD.
for example : comment_test 2 ( first variable )
3 ( second variable )
dup ( stack is 2 3 3 )
* ( 3 * 3 gives 9 )
+ 2 + 9 gives 11 )
. ( print answer )
; ( end word definition )
To assist in following complicated if -- then -- else and mixed
conditional statements; the usual practice of indenting has not been
used. Instead the ascii-graphic character B3 Hex [ 179 decimal ] is
ignored by 4th_86 when encountered in FLOADed code. This character is a
vertical line and its use is shown by the following sample.
: DS ( DISPLAY STACK ELEMENTS IN HEX)
SP@ CLISP @ SWAP - 2 / DUP 0>
IF ( SOMETHING ON STACK)
│
│ BEGIN
│ │ DUP 1+ PICK .H ( PRINT IT)
│ │ 1 - DUP 0=
│ END DROP crlf
│
ELSE
│
│ IF ( underflow)
│ │ " STACK UNDERFLOW ... RESETTING STACK." 1 ERMSG
│ THEN
│ " STACK EMPTY." ." CRLF
│
THEN ;
4th_86 ASSEMBLY & CROSS COMPILE page 19
======
STATUS
======
STATUS is a word which prints out the dictionary and code space
available at any stage. In cross-compile mode it prints additional
information.
===
MAP
===
" xxxx.yyy" MAP will create a file xxxx.yyy showing all the
words loaded into a system either in cross-compile or noncross mode. It
will not list the words already embedded in the "mother" system.
==========
CONCLUSION
==========
The main features of 4th_86 have been outlined. The Glossary
will define individual words -- and the complete manual will give a
description of the memory layout and dictionary structure.
4th_86 INDEX page 20
,+ ,= etc 11
,CONST 13
." 3
.C 4
.H 4
.HB 4
.L 4
. 4
16DM 8
8DM 8
:ENTER 16
:EXIT 16
^ 3
ARRAY.4th 12
AUTO-DEPTH DISPLAY 4
BASE 4
BLOAD 15
BLOCK 12
BRKON 2
brkon 2
BYE 2
C! 11
C@ 11
CD 1
Colon Definitions 5
COLON 2
CONST 12
CONSTANT 11
CREATE .. DOES 12
ctrl-Break 2
ctrl-Brk 2
ctrl-C 2
CTRL-P 1
ctrl-S 2
D+ D= etc. 11
DATA[ 13
DD 2
DDH 2
DDICT 8
DDL 2
DDS 8
DEBUG 9
DEMO version 1
DEPTH 5
4th_86 INDEX page 21
diassembler 2
DIR 1
DM 8
DO..LOOP 9
DO..LOOPs 12
DS 8
EMIT 11
EXIT 12
FLOAD 15
FLOAD 7
FORGET 6
FRENCH.4TH 3
FULLSCREEN 2
HEAD 15
HILSIER2 17
ILOAD 18
Inline Assembler 16
ISAVE 18
KEY 11
LAST 15
LEAVE 12
LINK 6
LOAD 15
MAP 19
OMIT 16
OOPS 2
PAGE0 2
PDICT 8
PRINTER 1
PRINTLOAD 15
REDEFINE 15
REDIT 6
RELOAD 6
RELOAD 7
SECDELAY.4TH 16
SECDELAY 2
SHARPS.4th 12
SHIFT PRTSC 1
SRET 2
STATUS 19
SYNONYM 10
4th_86 INDEX page 22
SYS 1
TAG 8
TD 9
TEST.ASM 15
THREAD 2
TM 9
TRACEL 9
TRACEOFF 8
TRACEON 8
TYPE 11
TYPE 1
UNLINK 6
UNSPLIT. 1
USING 6
VARIABLE 11