DX-FORTH v4.30
This commit is contained in:
parent
a2f4b9c609
commit
58cc1a4889
Binary file not shown.
BIN
Artek Ada v125/e.EXE
Normal file
BIN
Artek Ada v125/e.EXE
Normal file
Binary file not shown.
BIN
Artek Ada v125/e.axe
Normal file
BIN
Artek Ada v125/e.axe
Normal file
Binary file not shown.
1
DX-FORTH v430/ASM.SCR
Normal file
1
DX-FORTH v430/ASM.SCR
Normal file
File diff suppressed because one or more lines are too long
609
DX-FORTH v430/ASM.TXT
Normal file
609
DX-FORTH v430/ASM.TXT
Normal file
@ -0,0 +1,609 @@
|
||||
DX-Forth 8086/87 Assembler
|
||||
--------------------------
|
||||
|
||||
Contents:
|
||||
|
||||
1. Assembler interface
|
||||
2. Instruction format
|
||||
3. Operands
|
||||
4. Data sizes
|
||||
5. Instruction aliases
|
||||
6. Register usage
|
||||
7. Local labels
|
||||
8. Structured conditionals
|
||||
9. Mixing code and high-level forth
|
||||
10. No-name code definitions
|
||||
11. Forth addresses
|
||||
12. Predefined macros
|
||||
13. Compiler security
|
||||
14. Miscellaneous tools
|
||||
15. 8087 support
|
||||
16. Error messages
|
||||
17. F83 differences
|
||||
|
||||
|
||||
1. Assembler interface
|
||||
|
||||
Main words:
|
||||
|
||||
CODE <name> Begin a code definition
|
||||
|
||||
LABEL <name> As for CODE but instead of <name> executing the code
|
||||
sequence, it returns the execution address (xt).
|
||||
|
||||
;CODE The code equivalent of DOES>. Ends a high-level forth
|
||||
defining sequence and begins a code sequence that will
|
||||
be performed when a child word is executed. Used in
|
||||
the form:
|
||||
|
||||
: <name> CREATE ... ;CODE ... END-CODE
|
||||
|
||||
At run-time the child's parameter field address is
|
||||
placed on the stack.
|
||||
|
||||
END-CODE End a CODE LABEL or ;CODE definition
|
||||
|
||||
Macro support:
|
||||
|
||||
MACRO name Begin an assembler macro definition
|
||||
|
||||
ENDM End a macro assembler definition
|
||||
|
||||
Mixing code and high-level forth:
|
||||
|
||||
C: Switch from code to begin a forth sequence. Register
|
||||
SI is pushed to the return stack.
|
||||
|
||||
;C Switch from forth to begin a code sequence. Register
|
||||
SI popped from the return stack.
|
||||
|
||||
Miscellaneous:
|
||||
|
||||
[ASM Add ASSEMBLER to the search order. Initialize the
|
||||
assembler and enter interpret state. Note: does
|
||||
not clear local labels or initialize stack check.
|
||||
|
||||
ASM] Remove ASSEMBLER from the top of the search order.
|
||||
Note: does not exit interpret state.
|
||||
|
||||
READY Clear local labels and initialize stack check.
|
||||
|
||||
CHECK Check stack level and resolve labels since READY was
|
||||
last issued.
|
||||
|
||||
-ASM Discard the assembler and all subsequent words.
|
||||
|
||||
|
||||
2. Instruction format
|
||||
|
||||
As with most forth assemblers, operands precede the instruction.
|
||||
The following examples show DX-Forth assembler syntax as compared
|
||||
with conventional Intel notation.
|
||||
|
||||
Intel DX-Forth
|
||||
----- --------
|
||||
CLI CLI
|
||||
IRET IRET
|
||||
REP REP
|
||||
REPNZ REPNZ
|
||||
CS: CS:
|
||||
POP AX AX POP
|
||||
PUSH AX AX PUSH
|
||||
INT 37 37 INT
|
||||
IN AX,23 23 # AX IN
|
||||
IN AX,DX DX AX IN
|
||||
OUT 23,AL AL 23 # OUT
|
||||
OUT DX,AL AL DX OUT
|
||||
MOV AX,BX BX AX MOV
|
||||
CMP AL,DL DL AL CMP
|
||||
ROL AX,1 AX ROL
|
||||
ROL AX,1 AX 1 ROL
|
||||
ROL AX,CL AX CL ROL
|
||||
ROL CL,1 CL 1 ROL
|
||||
XCHG [BX],AX AX 0 [BX] XCHG
|
||||
XCHG AX,[BX] 0 [BX] AX XCHG
|
||||
MOV AL,9 9 # AL MOV
|
||||
MOV AX,1234 1234 # AX MOV
|
||||
MOV AX,-1 -1 # AX MOV
|
||||
MOV BX,AX AX BX MOV
|
||||
MOV [2344],AL AL 2344 ) MOV
|
||||
MOV AX,[1234] 1234 ) AX MOV
|
||||
MOV [BX],AL AL 0 [BX] MOV
|
||||
POP [BX] 0 [BX] POP
|
||||
MOV [BX+9],AX AX 9 [BX] MOV
|
||||
MOV [BX+SI+9],AX AX 9 [BX+SI] MOV
|
||||
JMP 1234 1234 ) JMP
|
||||
JMP [1122] 1122 [] JMP
|
||||
JMP FAR [4455] 4455 [] FAR JMP
|
||||
JMP 5678:1234 1234 5678 ) FAR JMP
|
||||
JNZ HERE+5 HERE 5 + JNZ
|
||||
JMP SHORT HERE+5 HERE 5 + JU
|
||||
RET RET
|
||||
RETF FAR RET
|
||||
RET 14 14 +RET
|
||||
|
||||
CMPSB BYTE CMPS
|
||||
CMPSW CMPS
|
||||
MOVSB BYTE MOVS
|
||||
MOVSW MOVS
|
||||
SCASB BYTE SCAS
|
||||
SCASW SCAS
|
||||
LODSB BYTE LODS
|
||||
LODSW LODS
|
||||
STOSB BYTE STOS
|
||||
STOSW STOS
|
||||
|
||||
|
||||
3. Operands
|
||||
|
||||
Operands to instructions may be registers, memory locations or
|
||||
immediate values. When an operand is not a register, it must be
|
||||
followed by a symbol to indicate its type:
|
||||
|
||||
# operand is an immediate number
|
||||
) operand is a memory location
|
||||
[] operand is an indirect memory location for CALL/JMP
|
||||
|
||||
Exceptions are the loop and short jump instructions - these do not
|
||||
use ) after the memory address.
|
||||
|
||||
|
||||
4. Data sizes
|
||||
|
||||
When the syntax of the instruction does not make it clear, then
|
||||
the memory operand data size is assumed to be:
|
||||
|
||||
- 16 bit integer for 8086 instructions
|
||||
- 64 bit real for 8087 instructions
|
||||
|
||||
Valid overides are:
|
||||
|
||||
BYTE ( -- ) 8 bit integer
|
||||
WORD ( -- ) 16 bit integer
|
||||
DWORD ( -- ) 32 bit integer or real
|
||||
QWORD ( -- ) 64 bit integer or real
|
||||
TBYTE ( -- ) 80 bit real
|
||||
|
||||
Notes:
|
||||
|
||||
- WORD DWORD QWORD TBYTE are present only when the 8087 assembler
|
||||
extension is loaded.
|
||||
|
||||
- BYTE must only be applied to instructions that require it.
|
||||
Attempting to use BYTE on instructions which are implicitly 8-bit
|
||||
e.g. BYTE AL DL MOV may adversely affect subsequent instructions.
|
||||
|
||||
|
||||
5. Instruction aliases
|
||||
|
||||
Several Intel 8086 instructions have alias names. The table below
|
||||
lists the preferred DX-Forth name and the corresponding Intel alias.
|
||||
|
||||
DX-Forth Intel DX-Forth Intel
|
||||
|
||||
JO - JPO JNP
|
||||
JNO - JL JNGE
|
||||
JC JB JNAE JNL JGE
|
||||
JNC JNB JAE JG JNLE
|
||||
JA JNBE JNG JLE
|
||||
JNA JBE JU * JMP SHORT
|
||||
JZ JE LOOPZ LOOPE
|
||||
JNZ JNE LOOPNZ LOOPNE
|
||||
JS - REPZ REP REPE
|
||||
JNS - REPNZ REPNE
|
||||
JPE JP SHL SAL
|
||||
|
||||
* "Jump Unconditional"
|
||||
|
||||
|
||||
6. Register usage
|
||||
|
||||
Code words may use any 8086 cpu register except:
|
||||
|
||||
SI forth interpretive pointer
|
||||
BP return stack pointer
|
||||
CS DS SS
|
||||
|
||||
Segment registers CS DS SS are initialised to the forth code
|
||||
segment CSEG.
|
||||
|
||||
If any of these registers are to be used in a code definition for
|
||||
other purposes, their contents must be saved beforehand and restored
|
||||
afterwards. Register ES is free for use as a scratch register.
|
||||
|
||||
|
||||
7. Local labels
|
||||
|
||||
The DX-Forth assembler uses local labels to mark addresses for flow
|
||||
control. Labels are assigned and referenced as follows:
|
||||
|
||||
$: ( n -- ) assign the address of the current dictionary
|
||||
location HERE to label n
|
||||
|
||||
$ ( n -- addr ) return the address assigned to label n
|
||||
|
||||
The maximum number of labels per definition is 20 and are numbered 1
|
||||
to 20. The maximum number of forward references is 25. These limits
|
||||
should be sufficient for most applications but can be increased by
|
||||
altering the assembler source and re-compiling.
|
||||
|
||||
8086 instructions that may use forward references as operands includes
|
||||
jumps, calls and other instructions as determined empirically.
|
||||
|
||||
The following demonstrates the use of labels to define the word 0= .
|
||||
It uses one label and one forward reference.
|
||||
|
||||
CODE 0= ( n -- flag )
|
||||
AX AX SUB \ load AX with false flag (0)
|
||||
DX POP \ pop n to DX
|
||||
DX DX OR \ test DX
|
||||
1 $ JNZ \ jump to label 1 if DX <> 0
|
||||
AX DEC \ change flag to true ($FFFF)
|
||||
1 $: \ define label 1
|
||||
AX PUSH \ push flag onto stack
|
||||
'NEXT ) JMP \ return to forth
|
||||
END-CODE
|
||||
|
||||
It can be simplified by the use of macros e.g.
|
||||
|
||||
CODE 0= ( n -- flag )
|
||||
AX AX SUB
|
||||
DX POP
|
||||
DX DX OR
|
||||
1 $ JNZ
|
||||
AX DEC
|
||||
1 $:
|
||||
1PUSH \ return to forth pushing AX onto stack
|
||||
END-CODE
|
||||
|
||||
|
||||
8. Structured conditionals
|
||||
|
||||
Structured conditionals are an alternative or adjunct to local labels.
|
||||
They include:
|
||||
|
||||
IF ELSE THEN BEGIN WHILE REPEAT UNTIL AGAIN AHEAD
|
||||
|
||||
Conditionals that perform a test i.e. IF WHILE UNTIL must be
|
||||
preceeded by one of the following condition flags:
|
||||
|
||||
U>= U< 0<> 0= U> U<= 0>= 0< >= < > <= CY NC OV NO
|
||||
PO PE CXNZ NEVER
|
||||
|
||||
NEVER is used before a conditional test to create an unconditional
|
||||
jump. E.g. AHEAD and AGAIN are macros for NEVER IF and NEVER UNTIL
|
||||
respectively. N.B. Structured conditionals are restricted to short
|
||||
relative branches.
|
||||
|
||||
Structured conditionals are restricted to short relative branches.
|
||||
|
||||
Example
|
||||
|
||||
CODE 0= ( n -- flag )
|
||||
AX AX SUB
|
||||
DX POP
|
||||
DX DX OR
|
||||
0= IF
|
||||
AX DEC
|
||||
THEN
|
||||
1PUSH
|
||||
END-CODE
|
||||
|
||||
Structured conditionals are not included by default and must be loaded
|
||||
before they can be used e.g. 1 FLOAD ASMCOND.SCR . N.B. If using the
|
||||
8087 assembler extensions ensure these are loaded before the structured
|
||||
conditionals.
|
||||
|
||||
|
||||
9. Mixing code and high-level forth
|
||||
|
||||
The assembler allows free mixing of machine-code and high-level forth.
|
||||
|
||||
It is sometimes convenient to execute high-level forth words from
|
||||
within a code definition.
|
||||
|
||||
Example - display a message within a code definition
|
||||
|
||||
CODE TEST ( -- )
|
||||
C: \ begin forth
|
||||
." Hi There!"
|
||||
;C \ end forth
|
||||
NEXT
|
||||
END-CODE
|
||||
|
||||
Note: SI register is automatically pushed to the return stack before
|
||||
the forth sequence executes and restored afterwards.
|
||||
|
||||
The reverse is also possible i.e execute machine code within high-
|
||||
level forth:
|
||||
|
||||
: TEST ( -- )
|
||||
5 0 DO
|
||||
I
|
||||
;C \ begin code
|
||||
AX POP 23 # AX ADD AX PUSH
|
||||
C: \ end code
|
||||
.
|
||||
LOOP ;
|
||||
|
||||
See "Register usage" for a list of registers that must be preserved.
|
||||
|
||||
|
||||
10. No-name code definitions
|
||||
|
||||
[ASM ASM] READY CHECK allow the user to assemble code sequences for
|
||||
any imaginable situation. Here is 0= coded as a nameless definition
|
||||
in the style of :NONAME .
|
||||
|
||||
HERE ( start address of code routine )
|
||||
[ASM READY
|
||||
( x -- flag )
|
||||
AX AX SUB
|
||||
DX POP
|
||||
DX DX OR
|
||||
1 $ JNZ
|
||||
AX DEC
|
||||
1 $:
|
||||
1PUSH \ return to forth pushing AX onto stack
|
||||
CHECK ASM]
|
||||
|
||||
( -- xt ) \ leaves xt address
|
||||
|
||||
If local labels are not used or compiler security is not required
|
||||
then READY CHECK could be omitted.
|
||||
|
||||
|
||||
11. Forth addresses
|
||||
|
||||
The following functions return addresses in the forth kernel which
|
||||
may be useful when writing code definitions. See also 'Predefined
|
||||
macros'.
|
||||
|
||||
'NEXT ( -- adr ) address of centralized NEXT
|
||||
UP ( -- adr ) pointer to forth USER area
|
||||
FSP ( -- adr ) pointer to separate floating-point stack
|
||||
DOCOL ( -- adr ) enter colon routine
|
||||
EXIT1 ( -- adr ) exit colon routine
|
||||
TOD ( -- adr ) routine read BIOS tick timer AX:DX
|
||||
TSYNC ( -- adr ) routine wait for timer tick, exit AX:DX = TOD
|
||||
UPC ( -- adr ) routine make AL uppercase
|
||||
|
||||
|
||||
12. Predefined macros
|
||||
|
||||
The assembler defines several useful macros -
|
||||
|
||||
NEXT compile in-line NEXT
|
||||
1PUSH push AX then jump to NEXT
|
||||
2PUSH push DX AX then jump to NEXT
|
||||
USER# calculate USER variable offset
|
||||
[UP] USER addressing mode
|
||||
|
||||
1PUSH and 2PUSH make use of the centralized NEXT. Users wanting
|
||||
maximum performance (at the expense of code size) may replace 1PUSH
|
||||
and 2PUSH with their in-line equivalents e.g.
|
||||
|
||||
AX PUSH NEXT ... instead of ... 1PUSH
|
||||
DX PUSH AX PUSH NEXT ... instead of ... 2PUSH
|
||||
|
||||
USER# converts a USER variable address to its offset. Equivalent
|
||||
to: UP @ -
|
||||
|
||||
[UP] works like an assembler addressing mode taking a USER variable
|
||||
as an argument. After the operation register DI holds the address
|
||||
of the specified user variable (unless DI was used as a destination).
|
||||
|
||||
Examples:
|
||||
|
||||
BASE [UP] AX MOV load AX with contents of BASE, DI = addr BASE
|
||||
10 # BASE [UP] MOV set BASE to decimal, DI = addr BASE
|
||||
BASE [UP] PUSH push BASE contents to stack, DI = addr BASE
|
||||
BASE [UP] DI MOV load DI with contents of BASE
|
||||
|
||||
Note: The [UP] macro can be expensive since it generates three machine
|
||||
instructions each time it is invoked. If your code routine requires
|
||||
access to several user variables it may be more efficient to load BX
|
||||
or DI with the USER base address and use USER# to supply the various
|
||||
offsets e.g.
|
||||
|
||||
UP ) DI MOV point DI to the USER area
|
||||
10 # BASE USER# [DI] MOV set BASE to decimal
|
||||
>IN USER# [DI] INC increment >IN
|
||||
|
||||
|
||||
13. Compiler security
|
||||
|
||||
As with colon definitions, the assembler employs stack checking to
|
||||
verify statements have been correctly written. Normally very useful
|
||||
there may be occasions when one needs to turn off stack checking,
|
||||
albeit temporarily e.g.
|
||||
|
||||
CHECKING OFF
|
||||
|
||||
CODE TEST
|
||||
...
|
||||
HERE ( adr ) \ push location onto the stack
|
||||
...
|
||||
NEXT
|
||||
END-CODE
|
||||
|
||||
CHECKING ON
|
||||
|
||||
( adr )
|
||||
|
||||
|
||||
14. Miscellaneous tools
|
||||
|
||||
When machine language is used extensively there can be a need for
|
||||
tools found in conventional assemblers. Below are several the author
|
||||
has found useful. They are not resident in the forth assembler but
|
||||
defined as needed.
|
||||
|
||||
SYSTEM
|
||||
|
||||
\ Adjust HERE to an even address padding with a NOP instruction
|
||||
: EVEN ( -- ) HERE 1 AND IF $90 C, THEN ;
|
||||
|
||||
\ Name value x
|
||||
: EQU ( x "name" -- ) SYS @ TUCK 0= SYS ! VALUE SYS ! ;
|
||||
|
||||
\ Name address at HERE and compile a 16-bit value
|
||||
: DW ( 16b "name" -- ) HERE EQU , ;
|
||||
|
||||
\ Name address at HERE and compile a 8-bit value
|
||||
: DB ( 8b "name" -- ) HERE EQU C, ;
|
||||
|
||||
APPLICATION
|
||||
|
||||
|
||||
15. 8087 support
|
||||
|
||||
ASM87.SCR contain extensions to allow the assembly of 8087 floating
|
||||
point instructions. Once loaded, the following instructions become
|
||||
available:
|
||||
|
||||
Intel Forth
|
||||
----- -----
|
||||
F2XM1 F2XM1
|
||||
FABS FABS
|
||||
FADD m/r m/r FADD
|
||||
FADD ST,ST(n) ST(n) ST FADD
|
||||
FADD ST(n),ST ST ST(n) FADD
|
||||
FADDP ST(n),ST ST(n) FADDP
|
||||
FBLD m/r m/r FBLD
|
||||
FBSTP m/r m/r FBSTP
|
||||
FCHS FCHS
|
||||
FCLEX FCLEX
|
||||
FCOM m/r m/r FCOM
|
||||
FCOM ST(n) ST(n) FCOM
|
||||
FCOMP m/r m/r FCOMP
|
||||
FCOMP ST(n) ST(n) FCOMP
|
||||
FCOMPP FCOMPP
|
||||
FCOS FCOS **
|
||||
FDECSTP FDECSTP
|
||||
FDISI FDISI
|
||||
FDIV m/r m/r FDIV
|
||||
FDIV ST,ST(n) ST(n) ST FDIV
|
||||
FDIV ST(n),ST ST ST(n) FDIV
|
||||
FDIVP ST(n),ST ST(n) FDIVP
|
||||
FDIVR m/r m/r FDIVR
|
||||
FDIVR ST(n),ST ST(n) FDIVR
|
||||
FDIVRP ST(n),ST ST(n) FDIVRP
|
||||
FENI FENI
|
||||
FFREE ST(n) ST(n) FFREE
|
||||
FIADD m/r m/r FIADD
|
||||
FICOM m/r m/r FICOM
|
||||
FICOMP m/r m/r FICOMP
|
||||
FIDIV m/r m/r FIDIV
|
||||
FIDIVR m/r m/r FIDIVR
|
||||
FILD m/r m/r FILD
|
||||
FIMUL m/r m/r FIMUL
|
||||
FINCSTP FINCSTP
|
||||
FINIT FINIT
|
||||
FIST m/r FIST
|
||||
FISTP m/r m/r FISTP
|
||||
FISUB m/r m/r FISUB
|
||||
FISUBR m/r m/r FISUBR
|
||||
FLD m/r m/r FLD
|
||||
FLD ST(n) ST(n) FLD
|
||||
FLD1 FLD1
|
||||
FLDCW m/r m/r FLDCW
|
||||
FLDENV m/r m/r FLDENV
|
||||
FLDL2E FLDL2E
|
||||
FLDL2T FLDL2T
|
||||
FLDLG2 FLDLG2
|
||||
FLDLN2 FLDLN2
|
||||
FLDPI FLDPI
|
||||
FLDZ FLDZ
|
||||
FMUL m/r m/r FMUL
|
||||
FMUL ST,ST(n) ST(n) ST FMUL
|
||||
FMUL ST(n),ST ST ST(n) FMUL
|
||||
FMULP ST(n),ST ST(n) FMULP
|
||||
FNOP FNOP
|
||||
FPATAN FPATAN
|
||||
FPREM FPREM
|
||||
FPREM1 FPREM1 **
|
||||
FPTAN FPTAN
|
||||
FRNDINT FRNDINT
|
||||
FRSTOR m/r m/r FRSTOR
|
||||
FSAVE m/r m/r FSAVE
|
||||
FSCALE FSCALE
|
||||
FSIN FSIN **
|
||||
FSINCOS FSINCOS **
|
||||
FSQRT FSQRT
|
||||
FST m/r m/r FST
|
||||
FST ST(n) ST(n) FST
|
||||
FSTCW m/r m/r FSTCW
|
||||
FSTENV m/r m/r FSTENV
|
||||
FSTP m/r m/r FSTP
|
||||
FSTP ST(n) ST(n) FSTP
|
||||
FSTSW AX AX FSTSW *
|
||||
FSTSW m/r m/r FSTSW
|
||||
FSUB m/r m/r FSUB
|
||||
FSUB ST,ST(n) ST(n) ST FSUB
|
||||
FSUB ST(n),ST ST ST(n) FSUB
|
||||
FSUBP ST(n),ST ST(n) FSUBP
|
||||
FSUBR m/r m/r FSUBR
|
||||
FSUBR ST,ST(n) ST(n) FSUBR
|
||||
FSUBRP ST(n),ST ST(n) FSUBRP
|
||||
FTST FTST
|
||||
FXAM FXAM
|
||||
FXCH ST(n) ST(n) FXCH
|
||||
FXTRACT FXTRACT
|
||||
FYL2X FYL2X
|
||||
FYL2XP1 FYL2XP1
|
||||
|
||||
* 80287/80387 only
|
||||
** 80387 only
|
||||
|
||||
Notes:
|
||||
|
||||
WAIT instructions are not automatically encoded. A WAIT should be
|
||||
inserted:
|
||||
|
||||
- before each floating point instruction (8087 only)
|
||||
- after any floating point instruction that writes to memory
|
||||
|
||||
Several Forth and Unix-derived 8087 assemblers are known to have
|
||||
bugs associated with the following instructions:
|
||||
|
||||
FSUBP
|
||||
FSUBRP
|
||||
FDIVP
|
||||
FDIVRP
|
||||
FSUB/FSUBR/FDIV/FDIVR ST(i),ST
|
||||
|
||||
Programmers should therefore exercise care when using 8087 source
|
||||
code taken from third party or public domain sources.
|
||||
|
||||
|
||||
16. Error messages
|
||||
|
||||
"definition incomplete" Definition was not properly formed.
|
||||
"duplicate label" Label number was previously used.
|
||||
"execution only" Word may be used only during execution.
|
||||
"invalid label" Incorrect label number or too many
|
||||
labels used.
|
||||
"branch out of range" Exceeded the range of a short relative
|
||||
branch.
|
||||
"too many references" Exceeded the maximum number of forward
|
||||
references to labels.
|
||||
"unresolved reference" A label was referenced but never defined.
|
||||
|
||||
Note: the assembler has limited error checking and it is possible to
|
||||
compile code using incorrect modes or operands without any warning
|
||||
given. Take care!
|
||||
|
||||
|
||||
17. F83 differences
|
||||
|
||||
The DX-Forth assembler is based on the 8086 assembler included with
|
||||
Laxen/Perry F83 Forth. Differences from the F83 assembler are:
|
||||
|
||||
- Uses local labels rather than structured conditionals
|
||||
- REP behaviour changed (in F83, REP functioned as REPNZ !)
|
||||
- Alternate Intel names used for some conditional jump instructions
|
||||
- ) and [] replaces #) and S#)
|
||||
- Additional syntax forms for OUT, XCHG, rotate/shift instructions
|
||||
- In DX-Forth ;CODE places the child's parameter field address
|
||||
on top of the stack; in F83 the address was held at BX+2.
|
1
DX-FORTH v430/ASM87.SCR
Normal file
1
DX-FORTH v430/ASM87.SCR
Normal file
File diff suppressed because one or more lines are too long
1
DX-FORTH v430/ASMCOND.SCR
Normal file
1
DX-FORTH v430/ASMCOND.SCR
Normal file
@ -0,0 +1 @@
|
||||
\ 8086 structured conditionals .( 8086 structured conditionals ) assembler definitions hidden hex system warning off 70 constant NO 71 constant OV 72 constant U>= 73 constant U< 74 constant 0<> 75 constant 0= 76 constant U> 77 constant U<= 78 constant 0>= 79 constant 0< 7A constant PO 7B constant PE 7C constant >= 7D constant < 7E constant > 7F constant <= 0E3 constant CXNZ 0EB constant NEVER aka U>= NC aka U< CY : THEN here over rel swap c! ; aka HERE BEGIN : UNTIL c, here rel c, ; : IF c, begin 0 c, ; : AHEAD never if ; : ELSE ahead swap then ; : WHILE if swap ; : AGAIN never until ; : REPEAT again then ; ( : TIMES # CX MOV begin ; ) forth definitions decimal application warning on
|
1
DX-FORTH v430/ASMTEST.SCR
Normal file
1
DX-FORTH v430/ASMTEST.SCR
Normal file
File diff suppressed because one or more lines are too long
1
DX-FORTH v430/BLK2TXT.SCR
Normal file
1
DX-FORTH v430/BLK2TXT.SCR
Normal file
File diff suppressed because one or more lines are too long
1
DX-FORTH v430/BREAKGO.SCR
Normal file
1
DX-FORTH v430/BREAKGO.SCR
Normal file
@ -0,0 +1 @@
|
||||
\ BREAK GO Breakpoint tool (adapted from Forth Dimensions 5/1) BREAK is inserted into the application source code at the point to be debugged. When BREAK is subsequently executed, the application is temporarily halted and the current stack contentsdisplayed. The user will then be in a special interpret loop (indicated by the '<ok>' prompt) during which time the system may be examined. The application can be resumed at any time using GO. Executing QUIT or ABORT while halted (e.g. as a result of mistyping a command) will result in the user dropping back to forth. \ BREAK GO forth definitions system variable bsd create buf 80 allot : bip ( -- ) begin cr ." <ok> " buf dup 80 accept space evaluate again ; \ Halt application : BREAK ( i*x -- i*x ) cr ." BREAK stack = " .s depth bsd ! ['] bip catch dup -256 - if throw else drop then ; \ Resume application : GO ( i*x -- i*y ) depth bsd @ - bsd off abort" stack changed" -256 throw ; application behead bsd bip
|
45
DX-FORTH v430/CHANGES.TXT
Normal file
45
DX-FORTH v430/CHANGES.TXT
Normal file
@ -0,0 +1,45 @@
|
||||
IMPORTANT CHANGES
|
||||
|
||||
This document discusses changes to DX-Forth for DOS that may adversely
|
||||
affect previously written programs. It is recommended users update their
|
||||
programs to the latest DX-Forth version. See WHATSNEW.TXT for a summary
|
||||
of other changes and additions.
|
||||
|
||||
|
||||
v4.30
|
||||
|
||||
Removed immediate EXIT and renamed (EXIT) to EXIT.
|
||||
|
||||
v4.07
|
||||
|
||||
-TRAILING ZCOUNT now use the SSEG segment. See SSEG in the glossary
|
||||
for details.
|
||||
|
||||
v4.05
|
||||
|
||||
EDIT can no longer be used to load the editor from disk. You must use
|
||||
SED or TED for that. Once the editor is loaded and saved as part of
|
||||
the system, EDIT can be added as a synonym.
|
||||
|
||||
v4.03
|
||||
|
||||
ALLOT has been changed (for the better). Unlike Forth-94 ALLOT only
|
||||
unsigned values may be used. Applications which used negative values
|
||||
with ALLOT should be changed to use -ALLOT instead. Programs which
|
||||
require Forth-94 behaviour can be accommodated with the following
|
||||
redefinition:
|
||||
|
||||
: ALLOT ( n -- ) NEGATE -ALLOT ;
|
||||
|
||||
Note however that memory checking is not performed.
|
||||
|
||||
v4.02
|
||||
|
||||
Functions '.' and '?' adopt the eForth behaviour i.e. when BASE is
|
||||
decimal display signed; otherwise display unsigned. Only these
|
||||
functions and those which use them are affected. Applications
|
||||
requiring Forth-94 behaviour may redefine:
|
||||
|
||||
: . ( n -- ) S>D D. ;
|
||||
|
||||
|
11
DX-FORTH v430/DISCLAIM.TXT
Normal file
11
DX-FORTH v430/DISCLAIM.TXT
Normal file
@ -0,0 +1,11 @@
|
||||
Disclaimer:
|
||||
|
||||
The projects presented here are experimental in nature. They
|
||||
may be incomplete, not fully tested or contain defects. Being
|
||||
free software, it is provided 'as is' and without any warranty.
|
||||
Use of these projects or information is strictly at your own
|
||||
risk and responsibility.
|
||||
|
||||
Project material written and created by the author is public
|
||||
domain; any non-original or reference material included may be
|
||||
subject to copyright by their respective owners.
|
1
DX-FORTH v430/DOSLIB.SCR
Normal file
1
DX-FORTH v430/DOSLIB.SCR
Normal file
File diff suppressed because one or more lines are too long
BIN
DX-FORTH v430/DX.EXE
Normal file
BIN
DX-FORTH v430/DX.EXE
Normal file
Binary file not shown.
2740
DX-FORTH v430/DXFORTH.GLO
Normal file
2740
DX-FORTH v430/DXFORTH.GLO
Normal file
File diff suppressed because it is too large
Load Diff
900
DX-FORTH v430/DXFORTH.TXT
Normal file
900
DX-FORTH v430/DXFORTH.TXT
Normal file
@ -0,0 +1,900 @@
|
||||
DX-Forth for MS-DOS
|
||||
-------------------
|
||||
|
||||
This is the documentation for DX-Forth. It is divided into two parts:
|
||||
|
||||
- A walk-through that introduces new users (even those without
|
||||
previous Forth experience) to a few concepts and illustrates some of
|
||||
DX-Forth's special features. However, no attempt is made to teach
|
||||
Forth - for this, get hold of an introductory text such as:
|
||||
|
||||
"Forth Programmer's Handbook", Conklin & Rather
|
||||
"Programming Forth", Stephen Pelc
|
||||
"And so Forth...", J.L. Bezemer
|
||||
|
||||
- A technical section for prospective DX-Forth programmers. It assumes
|
||||
the reader has some familiarity with the Forth language programming.
|
||||
|
||||
|
||||
Contents:
|
||||
---------
|
||||
|
||||
1. Introduction
|
||||
|
||||
1.1 Overview
|
||||
1.2 Distribution files
|
||||
1.3 Acknowledgments
|
||||
1.4 Legal
|
||||
1.5 Installation
|
||||
1.6 Getting started
|
||||
1.7 Source files
|
||||
1.8 Screen editor
|
||||
1.9 Resident text file editor
|
||||
1.10 Command-line interface
|
||||
1.11 Machine code assembler
|
||||
1.12 Increasing System space
|
||||
1.13 Further suggestions
|
||||
1.14 Error messages
|
||||
|
||||
2. Programming reference
|
||||
|
||||
2.1 File system
|
||||
2.2 Application and System words
|
||||
2.3 Executing applications
|
||||
2.4 No Warm-Boot option
|
||||
2.5 User Patch area
|
||||
2.6 Overlays
|
||||
2.7 Multitasking
|
||||
2.8 User variables
|
||||
2.9 System vectors
|
||||
2.10 Deferred words
|
||||
2.11 Search order
|
||||
2.12 Compiler security
|
||||
2.13 Exception handling
|
||||
2.14 Exception codes
|
||||
2.15 Key codes
|
||||
|
||||
|
||||
1. Introduction
|
||||
|
||||
1.1 Overview
|
||||
|
||||
DX-Forth is a Forth language compiler and development system
|
||||
for MS-DOS 2.x and compatible disk operating systems. It is
|
||||
intended to be a complete, easy to use, programming tool for
|
||||
the creation of DOS applications.
|
||||
|
||||
Features include:
|
||||
|
||||
- ANS-FORTH Standard (FORTH-94) *
|
||||
- Fast direct-threaded code
|
||||
- Generate turnkey applications without compiler overhead
|
||||
- Fast floating point and trigonometric functions
|
||||
- Forth-94 file I/O
|
||||
- DOSLIB application library
|
||||
- Multitasking
|
||||
- ANS locals
|
||||
- Overlays for large applications
|
||||
- 8086/87 Forth assembler for CODE words
|
||||
- Full source code included
|
||||
|
||||
* DX-FORTH 4 generally follows the FORTH-94 Standard but
|
||||
does not seek to be strictly compliant.
|
||||
|
||||
|
||||
1.2 Distribution files
|
||||
|
||||
See FILES.TXT
|
||||
|
||||
|
||||
1.3 Acknowledgments
|
||||
|
||||
No software is written in a vacuum; therefore the author wishes to
|
||||
gratefully acknowledge all those in the CP/M and Forth communities who
|
||||
have generously made their source code available for public scrutiny.
|
||||
Without these to serve as a starting point and source for ideas,
|
||||
DX-Forth would not have been written.
|
||||
|
||||
|
||||
1.4 Legal
|
||||
|
||||
DX-Forth and all the files in this distribution (apart from excerpts
|
||||
taken from the FORTH-83 and ANS-FORTH documents) are hereby placed into
|
||||
the PUBLIC DOMAIN by the author.
|
||||
|
||||
DX-Forth is an experimental software and is provided without support or
|
||||
warranty. The author makes no guarantee as to fitness for purpose, nor
|
||||
assumes liability for any error, omission, damage or loss caused by the
|
||||
use of DX-Forth. Anyone wishing to use this software does so entirely
|
||||
at their own risk.
|
||||
|
||||
|
||||
1.5 Installation
|
||||
|
||||
Not applicable to the MS-DOS version of DX-Forth.
|
||||
|
||||
|
||||
1.6 Getting started
|
||||
|
||||
Several versions of the DX-Forth compiler are available:
|
||||
|
||||
FORTH.EXE The forth compiler kernel. It includes everything
|
||||
required to load and compile forth source files.
|
||||
|
||||
FORTH-F.EXE Same as FORTH.EXE but includes software floating point
|
||||
and trigonometric functions. These increase the size
|
||||
of the kernel by approximately 3K bytes.
|
||||
|
||||
DX.EXE FORTH-F.EXE with full-screen editor loaded.
|
||||
|
||||
FORTH-C.EXE Same as FORTH-F.EXE but uses "common stack" model
|
||||
i.e. floating point items are placed on the data stack
|
||||
rather than on a separate stack.
|
||||
|
||||
Note: FORTH-C.EXE is not in the distribution but can
|
||||
be generated by rebuilding the system with FMAKE.BAT
|
||||
|
||||
First, enter forth by executing FORTH.EXE (or FORTH-F.EXE or DX.EXE)
|
||||
from the DOS prompt e.g.
|
||||
|
||||
A> FORTH
|
||||
|
||||
You will be greeted with DX-Forth's start-up screen showing the
|
||||
version number and compilation date. If you executed FORTH-F.EXE
|
||||
you will also be informed that the floating point functions are
|
||||
available.
|
||||
|
||||
Now type
|
||||
|
||||
FYI
|
||||
|
||||
"For Your Information". It displays information about the current
|
||||
forth environment including dictionary size, vocabularies, logged
|
||||
drive and open screenfiles.
|
||||
|
||||
To see the names of functions (Forth calls them "words") in the
|
||||
dictionary, type
|
||||
|
||||
WORDS
|
||||
|
||||
Press any key to stop the display or <space> to pause. If you want
|
||||
to see only word names that contain the sequence 'MOD' then type
|
||||
|
||||
WORDS: MOD
|
||||
|
||||
You will notice some words are accompanied by an attribute.
|
||||
|
||||
The bold attribute (normally blue) indicates the word resides in the
|
||||
SYSTEM dictionary. All other words reside in the APPLICATION
|
||||
dictionary. If the brightness attribute is on, it indicates the word
|
||||
is IMMEDIATE. Attributes are accumulative. Thus a word that appears
|
||||
in bold and has the brightness toggled is both a SYSTEM word and
|
||||
IMMEDIATE.
|
||||
|
||||
Forth users will be familiar with IMMEDIATE words. SYSTEM words are
|
||||
peculiar to DX-Forth and are explained in the programming section.
|
||||
|
||||
You can capture screen output to a printer e.g.
|
||||
|
||||
PRINTER WORDS
|
||||
|
||||
then restore output to the console with
|
||||
|
||||
CONSOLE
|
||||
|
||||
Adding a new function to forth's dictionary is easy. Let's try the
|
||||
ubiquitous 'hello world' program. Type the following paying
|
||||
attention to the space between ." and Hello .
|
||||
|
||||
: HELLO-WORLD ." Hello world" ;
|
||||
|
||||
If you make a mistake entering text you may use the backspace key
|
||||
<BS> to delete the previous character, or escape key <ESC> to erase
|
||||
the entire line.
|
||||
|
||||
Spaces are important to forth as they distinguish elements within a
|
||||
forth statement. Forth syntax is very simple - a forth statement
|
||||
consists of functions or numbers separated by one or more spaces.
|
||||
In the example above : ." ; each represents a distinct forth
|
||||
function.
|
||||
|
||||
You have just compiled a new function or 'word' called HELLO-WORLD.
|
||||
Now type
|
||||
|
||||
WORDS
|
||||
|
||||
This lists all words in the current vocabulary. <SPACE> key may
|
||||
be used to pause/resume the listing or <ESC> to stop. Note that
|
||||
HELLO-WORLD appears at the top of the list since it was the most
|
||||
recent addition to the dictionary.
|
||||
|
||||
Now execute HELLO-WORLD by typing its name. It should display the
|
||||
text
|
||||
|
||||
Hello world
|
||||
|
||||
Should you need to enter a quote character '"' within a quote-
|
||||
delimited string, this may be done by entering it twice e.g.
|
||||
|
||||
S" this text includes ""quote"" marks" CR TYPE
|
||||
|
||||
produces
|
||||
|
||||
this text includes "quote" marks
|
||||
|
||||
Removing a word from the dictionary is even easier. Type
|
||||
|
||||
FORGET HELLO-WORLD
|
||||
|
||||
This discards HELLO-WORLD ... and any forth word you defined after
|
||||
it! Use WORDS to check that HELLO-WORLD was deleted.
|
||||
|
||||
Perhaps you would like to save HELLO-WORLD as your first turnkey DOS
|
||||
application. To do this, re-enter the HELLO-WORLD definition if you
|
||||
discarded it. Once you have tested it to make sure that it works as
|
||||
expected, save it to disk with
|
||||
|
||||
TURNKEY HELLO-WORLD HELLO
|
||||
|
||||
If you now type DIR *.EXE you should see HELLO.EXE in the disk
|
||||
directory.
|
||||
|
||||
Now - the most important thing you should know - how to get out of
|
||||
forth and back to DOS. Do this now by typing
|
||||
|
||||
BYE
|
||||
|
||||
Now that you are back in DOS you may try out your new HELLO program.
|
||||
You will note that HELLO.EXE executable is considerably smaller in
|
||||
size than the FORTH.EXE used to create it. This illustrates one of
|
||||
DX-Forth's features - turnkey applications may be saved without the
|
||||
compiler and word headers. The benefit is that applications take
|
||||
less disk space, are quicker to load, and have more free memory
|
||||
available to them when they execute.
|
||||
|
||||
|
||||
1.7 Source files
|
||||
|
||||
Forth has traditionally used 'blocks' for mass storage. Blocks may
|
||||
hold any type of data including text. In DX-Forth, blocks are used
|
||||
primarily to store forth program source. Each 'screen' (the name
|
||||
given to blocks that hold forth text) represents 1024 bytes of data
|
||||
organized as 16 lines of 64 characters each. DX-Forth screens are
|
||||
saved as conventional DOS disk files and are distinguished by a .SCR
|
||||
filetype (some forths use .BLK as the filetype).
|
||||
|
||||
DX-Forth also supports forth source in standard text files. To load
|
||||
and compile such a file, use:
|
||||
|
||||
INCLUDE filename[.F]
|
||||
|
||||
If no filetype is given then .F is assumed. Another form is:
|
||||
|
||||
S" filename[.F]" INCLUDED ( Forth-94 Standard )
|
||||
|
||||
Forth source files (text or screen) may be nested to the default
|
||||
maximum of 6.
|
||||
|
||||
|
||||
1.8 Screen editor
|
||||
|
||||
Screen files require a special text editor. DX-Forth includes such
|
||||
an editor in the form of SED.SCR. The editor is automatically
|
||||
loaded and run by FORTH.EXE or FORTH-F.EXE by typing
|
||||
|
||||
n SED
|
||||
|
||||
where n is the screen number to be edited. If n is omitted and the
|
||||
data stack is empty then the editor will use the last LISTed, or if
|
||||
an error occured, the screen that caused the error.
|
||||
|
||||
If you have a slow computer or are working from a floppy disk then
|
||||
it will be convenient to save a version of forth where the editor is
|
||||
permanently loaded. Let's do this now.
|
||||
|
||||
From the DOS prompt, load forth and open SED.SCR
|
||||
|
||||
A>FORTH-F SED ( if no filetype is given .SCR is assumed )
|
||||
|
||||
Forth will boot-up with the message 'Using SED.SCR'. Alternately,
|
||||
open SED.SCR from within forth with
|
||||
|
||||
USING SED
|
||||
|
||||
In DX-FORTH the most recently opened screenfile is termed the
|
||||
'current' file and all screen and block commands operate on it.
|
||||
CLOSE closes the 'current' screenfile. SWAP-FILE permits users
|
||||
to switch between two open screenfiles.
|
||||
|
||||
Once SED.SCR has been opened, you may view the contents of the
|
||||
file with the LIST command. 0 LIST displays screen 0, 1 LIST
|
||||
displays screen 1 etc. The following shortcuts are provided:
|
||||
|
||||
L ( -- ) (L)ist the current screen
|
||||
N ( -- ) list the (N)ext screen
|
||||
B ( -- ) list the previous screen i.e. (B)ack
|
||||
LS ( -- ) (S)wap screenfiles and (L)ist
|
||||
|
||||
Line 0 of each screen is called the index line and traditionally
|
||||
contains a comment indicating the contents of the screen. Typing
|
||||
|
||||
0 QX
|
||||
|
||||
displays a 'quick index' of 60 screens beginning at screen 0.
|
||||
|
||||
To list screens to a printer one could use
|
||||
|
||||
PRINTER 0 LIST 1 LIST 2 LIST CONSOLE
|
||||
|
||||
or more simply
|
||||
|
||||
0 2 SHOW
|
||||
|
||||
which prints screens 0 to 2 at three screens per page.
|
||||
|
||||
To print all the screens in a source file, type
|
||||
|
||||
LISTING
|
||||
|
||||
Now compile the editor into the dictionary with
|
||||
|
||||
1 LOAD
|
||||
|
||||
Once loading has completed, typing WORDS will show new commands have
|
||||
been added to the dictionary. In addition, FYI reveals some system
|
||||
memory has been consumed and there is now a new vocabulary in addition
|
||||
to FORTH - the EDITOR vocabulary. If you are curious to see what is
|
||||
in the EDITOR vocabulary, type
|
||||
|
||||
EDITOR WORDS
|
||||
|
||||
Now that the editor has been loaded, let's make it permanent by saving
|
||||
it and the current contents of the forth dictionary as a new executable.
|
||||
|
||||
But before doing that you may prefer to use the name EDIT instead of
|
||||
SED. That's easily done by creating a synonym e.g.
|
||||
|
||||
AKA SED EDIT
|
||||
|
||||
You can now use either SED or EDIT to invoke the screen editor.
|
||||
|
||||
Let's finish saving our custom version of DX-Forth to disk.
|
||||
|
||||
SAVE DX.EXE ( if no filetype is given .EXE is assumed )
|
||||
|
||||
Note: DX-Forth comes supplied with DX.EXE so you can omit the above
|
||||
step if you wish.
|
||||
|
||||
For details on using the editor, refer to the SED.TXT documentation
|
||||
file.
|
||||
|
||||
|
||||
1.9 Resident text file editor
|
||||
|
||||
DX-Forth includes TED - a simple text file editor. As with the screen
|
||||
editor, text source files may be edited without leaving the forth
|
||||
environment. See TED.TXT for further information.
|
||||
|
||||
|
||||
1.10 Command-line interface
|
||||
|
||||
DX-Forth allows file opening and command processing from the DOS command
|
||||
line. The syntax is:
|
||||
|
||||
A:> FORTH item1 item2 ... itemn
|
||||
|
||||
where:
|
||||
|
||||
item1 filename to be opened (assumed suffix is .SCR)
|
||||
item2...itemn forth command(s) to be executed
|
||||
|
||||
Once the command sequence is completed, the DX-Forth sign-on message
|
||||
appears and control passes to the user.
|
||||
|
||||
To bypass file opening, replace item1 with a '-' character.
|
||||
|
||||
Including BYE at the end of the command sequence will cause an immediate
|
||||
return to DOS. This can be very useful and allows use of the forth
|
||||
compiler within DOS batch files.
|
||||
|
||||
|
||||
1.11 Machine code assembler
|
||||
|
||||
Although threaded-code forth generates code that is compact and quite
|
||||
fast - up to 10 times faster than interpreted BASIC - there may be
|
||||
occasion when the full speed of machine code is required.
|
||||
|
||||
The assembler provided with DX-Forth allows writing of forth 'code'
|
||||
words. Code words are simply machine language routines that end with
|
||||
a jump to NEXT. Documentation for the assembler may be found in the
|
||||
file ASM.TXT.
|
||||
|
||||
|
||||
1.12 Increasing System space
|
||||
|
||||
The FORTH and FORTH-F executables are supplied with tools and assembler
|
||||
installed. If either are not required, the System dictionary space may
|
||||
be increased accordingly. To facilitate this, two marker words are
|
||||
provided:
|
||||
|
||||
-TOOLS removes the tools and all subsequent words.
|
||||
-ASM removes the assembler and all subsequently defined words.
|
||||
|
||||
E.g. To remove TOOLS type the following:
|
||||
|
||||
CHECKING OFF FORGET -TOOLS CHECKING ON
|
||||
|
||||
Note: As of DX-Forth 3.3, word headers are stored in their own segment
|
||||
rather than in the System dictionary. Consequently there is now much
|
||||
less need to conserve System dictionary space.
|
||||
|
||||
|
||||
1.13 Further suggestions
|
||||
|
||||
If you have worked your way through the previous sections, you now
|
||||
know your way around DX-Forth - how to list and compile forth screen
|
||||
files, save new versions of forth and create turnkey applications.
|
||||
|
||||
If this is your first encounter with forth, I hope this brief tour
|
||||
through DX-Forth will encourage you to look further. Get a book on
|
||||
forth and learn it - forth really is EASY!
|
||||
|
||||
The best way to learn forth (or any language) is by studying examples.
|
||||
Several simple applications have been provided with DX-Forth. When
|
||||
you encounter a forth word which is unfamiliar, find its definition
|
||||
in the Forth-94 Standard, or the DX-Forth glossary if not a Standard
|
||||
word.
|
||||
|
||||
A sample filecopy program FCOPY is provided in source form. As well
|
||||
as illustrating a complete forth application, it also serves as a
|
||||
primer on using DX-Forth's file functions. It will show you how to:
|
||||
|
||||
- get arguments from the DOS command line
|
||||
- create file-handles and assign file-buffers
|
||||
- open disk files
|
||||
- read data from a disk file
|
||||
- write data to a disk file
|
||||
- close disk files
|
||||
- handle errors
|
||||
|
||||
Routines may be extracted for your own use or the entire program can
|
||||
serve as the basis for a more complex one.
|
||||
|
||||
NEWAPP.SCR is a skeletal program that allows users to quickly develop
|
||||
DOS applications. Using DOSLIB.SCR it provides access to DOS functions
|
||||
and routine tasks such as command-line parsing and buffered I/O. See
|
||||
NEWAPP.TXT for details.
|
||||
|
||||
|
||||
1.14 Error messages
|
||||
|
||||
Compiler error messages
|
||||
-----------------------
|
||||
"block out of range" Attempt to access a block past end of
|
||||
file.
|
||||
"block r/w error" Error encountered during a block read or
|
||||
write operation.
|
||||
"no file open" File operation was requested but no file
|
||||
was open.
|
||||
"can't open file" File not found or write-protected.
|
||||
"can't create file" Existing file write-protected or disk full.
|
||||
"can't delete file" File not found or write-protected.
|
||||
"can't resize file" File not found or write-protected.
|
||||
"can't rename file" File exists, not found or write-protected.
|
||||
"can't save file" Error occurred during save (probably disk
|
||||
full).
|
||||
"compilation only" Use only during compilation.
|
||||
"execution only" Use only during execution.
|
||||
"loading only" Use only during loading.
|
||||
"definition unbalanced" Definition is not properly formed e.g.
|
||||
conditional statements (IF ELSE THEN etc)
|
||||
were incorrectly used or the data stack level
|
||||
changed.
|
||||
"is protected" Word is located in PROTECTed dictionary.
|
||||
"is alias" Operation on alias not allowed e.g. FORGET.
|
||||
"invalid name" Word name length outside the range 1 to 31
|
||||
characters.
|
||||
"specify filename" A filename is required but none was given.
|
||||
"too many files" Exceeded maximum number of open source files.
|
||||
"is redefined" Definition with the same name already exists.
|
||||
Note: this is a warning - not an error.
|
||||
"is system" A System word is being compiled into the
|
||||
Application dictionary. See section 2.2
|
||||
Note: aliases will be displayed using the
|
||||
primary name.
|
||||
"is undefined" Word could not be found in the dictionary
|
||||
using the current search order, or was not
|
||||
a valid number.
|
||||
"no name space" Header dictionary full.
|
||||
"stack?" Data stack under/overflow.
|
||||
"r-stack?" Return stack under/overflow.
|
||||
"f-stack?" Floating point stack under/overflow.
|
||||
"invalid chain" Illegal CHAIN argument. See glossary.
|
||||
|
||||
Run-time error messages
|
||||
-----------------------
|
||||
Apart from those listed below, DX-Forth does not perform run-time error
|
||||
checking. It is the responsibility of the application programmer to
|
||||
include error checking appropriate to the task.
|
||||
|
||||
"HOLD buffer overflow" The string being built in the HOLD buffer
|
||||
exceeded the maximum size.
|
||||
"uninitiated DEFER" A DEFERed word was defined but never
|
||||
initialized with IS.
|
||||
"exception = [n]" Exception error code n was executed. See
|
||||
section 2.14 for a list of system and DOS
|
||||
codes. Application-defined error codes are
|
||||
typically represented by a positive number.
|
||||
"no data space" Data space or dictionary full.
|
||||
"not enough RAM" Insufficient DOS memory.
|
||||
"wrong DOS version" Requires DOS version 2.x or later.
|
||||
|
||||
Assembler error messages
|
||||
------------------------
|
||||
"definition unbalanced" Definition is not properly formed.
|
||||
"duplicate label" Label number was previously used.
|
||||
"execution only" Word may be used only during execution.
|
||||
"invalid label" Incorrect label number or too many labels
|
||||
used.
|
||||
"branch out of range" Exceeded the range of a short relative
|
||||
branch (128 bytes).
|
||||
"too many references" Exceeded the maximum number of forward
|
||||
references to labels.
|
||||
"unresolved reference" A label was referenced but never defined.
|
||||
|
||||
|
||||
2. Programming reference
|
||||
|
||||
This section contains programming and technical information specific
|
||||
to DX-Forth.
|
||||
|
||||
|
||||
2.1 File system
|
||||
|
||||
DX-Forth uses FORTH-94 disk file management.
|
||||
|
||||
|
||||
2.2 Application and System words
|
||||
|
||||
When a word is compiled into DX-Forth, it is added to either the
|
||||
Application dictionary or the System dictionary.
|
||||
|
||||
The above suggests that DX-Forth uses two dictionaries. In reality,
|
||||
there is one dictionary physically divided into two parts. It is this
|
||||
physical partitioning that enables DX-Forth to generate small turnkey
|
||||
applications, free of compiler overhead.
|
||||
|
||||
Executing the words APPLICATION or SYSTEM causes all subsequent
|
||||
definitions to be compiled into the corresponding dictionary segment.
|
||||
The word FYI shows the current compilation dictionary and statistics.
|
||||
|
||||
The 'application' dictionary contains words (less their headers) that
|
||||
are available for use by either TURNKEY applications or by the forth
|
||||
compiler.
|
||||
|
||||
The 'system' dictionary contains words that are used exclusively by the
|
||||
forth compiler. Headers of forth words are located in their own
|
||||
segment. System words and headers are NOT saved during the generation
|
||||
of TURNKEY applications.
|
||||
|
||||
To see which words are System or Application, type WORDS. If the word
|
||||
is displayed with a bold attribute (usually blue), then it resides in
|
||||
the System dictionary otherwise it resides in the Application dictionary.
|
||||
|
||||
Compiling SYSTEM words
|
||||
|
||||
Under no circumstances should an application compiled with TURNKEY be
|
||||
allowed to execute a System word. Attempting to do so will result in
|
||||
unpredictable behaviour and failure of the application.
|
||||
|
||||
To assist users from inadvertently compiling System words into TURNKEY
|
||||
applications, DX-Forth will issue a warning message should this be
|
||||
attempted (assuming WARNING has not been disabled).
|
||||
|
||||
Applications saved with TURNKEY-SYSTEM may safely ignore System warnings
|
||||
as the entire forth dictionary including compiler and headers is saved.
|
||||
|
||||
Spurious SYSTEM warnings
|
||||
|
||||
It is possible to receive a System warning message that is neither an
|
||||
error condition, nor results in failure of the turnkey application.
|
||||
Typically it occurs during the compilation of defining words e.g.
|
||||
|
||||
APPLICATION WARNING ON
|
||||
|
||||
: BYTE-CONSTANT
|
||||
CREATE C, DOES> C@ ;
|
||||
|
||||
Compiling the above causes the following message to appear
|
||||
|
||||
"CREATE is system C, is system (;CODE) is system"
|
||||
|
||||
DX-Forth is warning the user that words CREATE C, (;CODE) are System
|
||||
words and are being compiled into the Application dictionary.
|
||||
|
||||
The reason this will NOT cause the application to fail is that the
|
||||
words between CREATE and DOES> inclusive represent the "compiling" part
|
||||
of the defining word. This part is executed only during compilation
|
||||
- never when the application is run.
|
||||
|
||||
To disable spurious System warning messages one may use WARNING OFF or
|
||||
precede the offending definition with -? which will turn off WARNING
|
||||
for that definition only.
|
||||
|
||||
Tip: For an alternative way of creating defining words which avoids the
|
||||
peculiarities of CREATE ... DOES> see BUILD in the glossary.
|
||||
|
||||
|
||||
2.3 Executing applications
|
||||
|
||||
Applications can often be fully tested and debugged from within the
|
||||
forth environment. However when they are eventually TURNKEYed and
|
||||
executed from the DOS command-line, there will be differences of which
|
||||
the programmer should be aware:
|
||||
|
||||
- The amount of unused memory available to an application will vary
|
||||
depending on whether it is run from within forth or from the DOS
|
||||
command-line. UNUSED may be used by applications to determine how
|
||||
much free memory is currently available.
|
||||
|
||||
- SET-LIMIT allows the programmer to specify a top-of-memory address
|
||||
or LIMIT for the application. The effect of SET-LIMIT is postponed
|
||||
until the turnkey application is executed.
|
||||
|
||||
- The memory region at 5Ch and 80h (DOS default FCB and DMA buffer) is
|
||||
overwritten by the forth compiler during DIR, RENAME, INCLUDE etc.
|
||||
Otherwise, this region is unaffected and may be used by turnkey
|
||||
applications to interrogate the DOS command-line.
|
||||
|
||||
|
||||
2.4 No Warm-Boot option
|
||||
|
||||
Not applicable to the MS-DOS version of DX-Forth.
|
||||
|
||||
|
||||
2.5 User patch area
|
||||
|
||||
Not applicable to the MS-DOS version of DX-Forth.
|
||||
|
||||
|
||||
2.6 Overlays
|
||||
|
||||
As DX-Forth resides in a single 64K segment, there will be a limit on
|
||||
the size of applications that may be compiled. If larger applications
|
||||
are needed this can often be achieved with overlays.
|
||||
|
||||
Using overlays will require a little more planning of the application.
|
||||
Some important aspects the programmer must consider are listed below.
|
||||
|
||||
- The resident part of the program must ensure that the correct overlay
|
||||
is in memory before executing an overlay word.
|
||||
|
||||
- An overlay must not execute words that exist in other overlays.
|
||||
|
||||
- An overlay must not execute words in the resident part, which in
|
||||
turn, execute words in a different overlay.
|
||||
|
||||
See OVERLAY.SCR for a demonstration of a simple overlay system.
|
||||
|
||||
|
||||
2.7 Multitasking
|
||||
|
||||
A co-operative 'round robin' multi-tasker is provided with DX-Forth.
|
||||
It permits an application to have several tasks run concurrently.
|
||||
|
||||
Refer to the multitasker documentation MULTI.TXT and the source file
|
||||
MULTI.SCR for further details.
|
||||
|
||||
|
||||
2.8 User variables
|
||||
|
||||
In common with most forth systems, DX-Forth has 'user' variables. User
|
||||
variables occupy a common region in memory. They hold various system
|
||||
and boot up values and are also used for multi-tasking applications.
|
||||
|
||||
In DX-Forth the default size of the user area is 128 bytes. User
|
||||
variables are defined as follows:
|
||||
|
||||
44 USER VAR1
|
||||
46 USER VAR2
|
||||
50 USER VAR3 ...
|
||||
|
||||
The number preceding USER is the offset in bytes of the variable from
|
||||
the user base address (given by the variable UP). Offsets beginning
|
||||
with 44 decimal are available to applications. In the above example,
|
||||
VAR1 occupies 2 bytes (1 cell) at offset 44, VAR2 occupies 4 bytes
|
||||
(2 cells) at offset 46 etc. See #USER in the glossary.
|
||||
|
||||
As with normal variables, executing the name of a user variable returns
|
||||
its address. Unlike normal variables, the literal value of the address
|
||||
may differ at compile and run time. In multi-tasking applications the
|
||||
contents of a user variable may differ between tasks.
|
||||
|
||||
Predefined user variables in DX-Forth are:
|
||||
|
||||
S0 R0 DP VOC-LINK FS0 DPH DPL BASE OUT CATCHER
|
||||
|
||||
|
||||
2.9 System vectors
|
||||
|
||||
SYS-VEC returns the address of the system vector and parameter table.
|
||||
The table contains default values used by the system. Applications
|
||||
may alter the vectors and values in the table as needed. Note that
|
||||
some changes will not take effect until COLD is executed. Refer to
|
||||
SYS-VEC in the glossary document for details.
|
||||
|
||||
|
||||
2.10 Deferred words
|
||||
|
||||
The following is a list of DX-Forth words built with DEFER IS .
|
||||
|
||||
BEEP FIND MS PAUSE REFILL ACCEPT SOUND
|
||||
|
||||
The current action of a deferred word may be obtained using:
|
||||
|
||||
' >BODY @ ( "name" -- xt ) or
|
||||
ADDR @ ( "name" -- xt )
|
||||
|
||||
|
||||
2.11 Search order
|
||||
|
||||
The dictionary search order is CONTEXT CURRENT FORTH where each
|
||||
represents a vocabulary or "wordlist". Complex search orders are
|
||||
possible using the CHAIN command.
|
||||
|
||||
|
||||
2.12 Compiler security
|
||||
|
||||
DX-Forth includes compiler security to detect malformed definitions
|
||||
and constructs e.g. failing to terminate an IF section with a THEN.
|
||||
|
||||
Compiler security words used by DX-Forth are listed in the glossary.
|
||||
How and when to use them is a topic of its own and is not discussed
|
||||
here (see the DX-Forth source files for examples of use).
|
||||
|
||||
It is sometimes useful to disable balance checking in high-level or
|
||||
code definitions. This may be done by setting variable CHECKING
|
||||
to false (i.e. zero).
|
||||
|
||||
|
||||
2.13 Exception handling
|
||||
|
||||
CATCH THROW provide a mechanism for handling errors conditions within
|
||||
a program.
|
||||
|
||||
It is recommended that applications use only positive THROW codes.
|
||||
Exception values in the range -1 to -4095 are reserved by ANS-FORTH
|
||||
for use by the system. See: "Exception codes"
|
||||
|
||||
|
||||
2.14 Exception codes
|
||||
|
||||
DX-Forth implements only a subset of ANS-FORTH Standard exception
|
||||
codes. Codes in the range -257 to -511 are reserved for DOS related
|
||||
errors.
|
||||
|
||||
DX-Forth exception codes:
|
||||
|
||||
0 no error
|
||||
-1 ABORT
|
||||
-2 ABORT"
|
||||
-256 reserved
|
||||
-257 to -511 DOS error code
|
||||
|
||||
The correlation between DOS error code and DX-Forth exception code
|
||||
is given below:
|
||||
|
||||
Forth DOS
|
||||
0 0 no error
|
||||
-511 1 invalid function number
|
||||
-510 2 file not found
|
||||
-509 3 path not found
|
||||
-508 4 too many open files
|
||||
-507 5 access denied
|
||||
-506 6 invalid handle
|
||||
-505 7 memory control block destroyed
|
||||
-504 8 insufficient memory
|
||||
-503 9 memory block address invalid
|
||||
-502 10 environment invalid
|
||||
-501 11 format invalid
|
||||
-499 12 access code invalid
|
||||
-498 13 data invalid
|
||||
-497 14 reserved
|
||||
-496 15 invalid drive
|
||||
-495 16 attempted to remove current directory
|
||||
-494 17 not same device
|
||||
-493 18 no more files
|
||||
... ...
|
||||
-257 255 unspecified error e.g. disk full
|
||||
|
||||
Note: To convert an exception code in the range -257 to -511 to its
|
||||
corresponding DOS error code, use: 255 AND
|
||||
|
||||
|
||||
2.15 Key codes
|
||||
|
||||
DX-Forth supports IBM-PC extended keystrokes and enhanced keyboards.
|
||||
For ease of use, two-byte extended keystrokes are returned as single
|
||||
values. The codes below are for an enhanced 101-key US keyboard.
|
||||
Ascii codes 32-126 are not shown.
|
||||
|
||||
Key Code Key Code Key Code
|
||||
---- ----- ---- ----- ---- ------
|
||||
00 0 Alt F A1 161 Ctrl F7 E4 228
|
||||
Ctrl A 01 1 Alt G A2 162 Ctrl F8 E5 229
|
||||
Ctrl B 02 2 Alt H A3 163 Ctrl F9 E6 230
|
||||
Ctrl C 03 3 Alt J A4 164 Ctrl F10 E7 231
|
||||
Ctrl D 04 4 Alt K A5 165 Alt F1 E8 232
|
||||
Ctrl E 05 5 Alt L A6 166 Alt F2 E9 233
|
||||
Ctrl F 06 6 Alt ; A7 167 Alt F3 EA 234
|
||||
Ctrl G 07 7 Alt ' A8 168 Alt F4 EB 235
|
||||
Ctrl H 08 8 Alt ` A9 169 Alt F5 EC 236
|
||||
Ctrl I 09 9 AA 170 Alt F6 ED 237
|
||||
Ctrl J 0A 10 Alt \ AB 171 Alt F7 EE 238
|
||||
Ctrl K 0B 11 Alt Z AC 172 Alt F8 EF 239
|
||||
Ctrl L 0C 12 Alt X AD 173 Alt F9 F0 240
|
||||
Ctrl M 0D 13 Alt C AE 174 Alt F10 F1 241
|
||||
Ctrl N 0E 14 Alt V AF 175 Ctrl Prtsc F2 242
|
||||
Ctrl O 0F 15 Alt B B0 176 Ctrl Left F3 243
|
||||
Ctrl P 10 16 Alt N B1 177 Ctrl Right F4 244
|
||||
Ctrl Q 11 17 Alt M B2 178 Ctrl End F5 245
|
||||
Ctrl R 12 18 Alt , B3 179 Ctrl PgDn F6 246
|
||||
Ctrl S 13 19 Alt . B4 180 Ctrl Home F7 247
|
||||
Ctrl T 14 20 Alt / B5 181 Alt 1 F8 248
|
||||
Ctrl U 15 21 B6 182 Alt 2 F9 249
|
||||
Ctrl V 16 22 * Alt * B7 183 Alt 3 FA 250
|
||||
Ctrl W 17 23 B8 184 Alt 4 FB 251
|
||||
Ctrl X 18 24 B9 185 Alt 5 FC 252
|
||||
Ctrl Y 19 25 BA 186 Alt 6 FD 253
|
||||
Ctrl Z 1A 26 F1 BB 187 Alt 7 FE 254
|
||||
Ctrl [ 1B 27 F2 BC 188 Alt 8 FF 255
|
||||
Ctrl \ 1C 28 F3 BD 189 Alt 9 100 256
|
||||
Ctrl ] 1D 29 F4 BE 190 Alt 0 101 257
|
||||
Ctrl ^ 1E 30 F5 BF 191 Alt - 102 258
|
||||
Ctrl _ 1F 31 F6 C0 192 Alt = 103 259
|
||||
F7 C1 193 Ctrl PgUp 104 260
|
||||
Ctrl <- 7F 127 F8 C2 194 F11 105 261
|
||||
80 128 F9 C3 195 F12 106 262
|
||||
Alt Esc 81 129 F10 C4 196 Shift F11 107 263
|
||||
82 130 C5 197 Shift F12 108 264
|
||||
83 131 C6 198 Ctrl F11 109 265
|
||||
84 132 Home C7 199 Ctrl F12 10A 266
|
||||
85 133 Up C8 200 Alt F11 10B 267
|
||||
86 134 PgUp C9 201 Alt F12 10C 268
|
||||
87 135 * Alt - CA 202 Ctrl Up 10D 269
|
||||
88 136 Left CB 203 * Ctrl - 10E 270
|
||||
89 137 * 5 CC 204 * Ctrl _ 10F 271
|
||||
8A 138 Right CD 205 110 272
|
||||
8B 139 * Alt + CE 206 Ctrl Down 111 273
|
||||
8C 140 End CF 207 Ctrl Ins 112 274
|
||||
8D 141 Down D0 208 Ctrl Del 113 275
|
||||
Alt <- 8E 142 PgDn D1 209 Ctrl Tab 114 276
|
||||
Shift Tab 8F 143 Ins D2 210 Ctrl / 115 277
|
||||
Alt Q 90 144 Del D3 211 * Ctrl * 116 278
|
||||
Alt W 91 145 Shift F1 D4 212 Alt Home 117 279
|
||||
Alt E 92 146 Shift F2 D5 213 Alt Up 118 280
|
||||
Alt R 93 147 Shift F3 D6 214 Alt PgUp 119 281
|
||||
Alt T 94 148 Shift F4 D7 215 11A 282
|
||||
Alt Y 95 149 Shift F5 D8 216 Alt Left 11B 283
|
||||
Alt U 96 150 Shift F6 D9 217 11C 284
|
||||
Alt I 97 151 Shift F7 DA 218 Alt Right 11D 285
|
||||
Alt O 98 152 Shift F8 DB 219 11E 286
|
||||
Alt P 99 153 Shift F9 DC 220 Alt End 11F 287
|
||||
Alt [ 9A 154 Shift F10 DD 221 Alt Down 120 288
|
||||
Alt ] 9B 155 Ctrl F1 DE 222 Alt PgDn 121 289
|
||||
Alt Enter 9C 156 Ctrl F2 DF 223 Alt Ins 122 290
|
||||
9D 157 Ctrl F3 E0 224 Alt Del 123 291
|
||||
Alt A 9E 158 Ctrl F4 E1 225 * Alt / 124 292
|
||||
Alt S 9F 159 Ctrl F5 E2 226 Alt Tab 125 293
|
||||
Alt D A0 160 Ctrl F6 E3 227 * Alt Enter 126 294
|
||||
|
||||
(*) on keypad
|
||||
|
||||
Note:
|
||||
|
||||
- Codes 261 and above are only available on AT-class machines
|
||||
fitted with an enhanced keyboard
|
||||
|
||||
- DOS versions prior to 4.0 do not support enhanced keys
|
||||
irrespective of the hardware
|
||||
|
562
DX-FORTH v430/DXFORTH.WDS
Normal file
562
DX-FORTH v430/DXFORTH.WDS
Normal file
@ -0,0 +1,562 @@
|
||||
!
|
||||
!CSP
|
||||
!L
|
||||
#
|
||||
#>
|
||||
#S
|
||||
#SCREENS
|
||||
#USER
|
||||
'
|
||||
'AH
|
||||
'AX
|
||||
'BH
|
||||
'BP
|
||||
'BX
|
||||
'CH
|
||||
'CX
|
||||
'DH
|
||||
'DI
|
||||
'DS
|
||||
'DX
|
||||
'ES
|
||||
'FLAGS
|
||||
'NEXT
|
||||
'SI
|
||||
'SOURCE
|
||||
(
|
||||
(*
|
||||
(.)
|
||||
(;CODE)
|
||||
(D.)
|
||||
(F.)
|
||||
(FE.)
|
||||
(FS.)
|
||||
(G.)
|
||||
(NAME)
|
||||
(U.)
|
||||
*
|
||||
*/
|
||||
*/MOD
|
||||
+
|
||||
+!
|
||||
+EXT
|
||||
+LOOP
|
||||
+STRING
|
||||
,
|
||||
,"
|
||||
-
|
||||
-->
|
||||
-1
|
||||
-?
|
||||
-ALLOT
|
||||
-ASM
|
||||
-BLANKS
|
||||
-EXT
|
||||
-FP
|
||||
-PATH
|
||||
-ROLL
|
||||
-ROT
|
||||
-TASK
|
||||
-TOOLS
|
||||
-TRAILING
|
||||
.
|
||||
."
|
||||
.(
|
||||
.FREE
|
||||
.ID
|
||||
.NAME
|
||||
.R
|
||||
.S
|
||||
.VOC
|
||||
/
|
||||
/MOD
|
||||
/MS
|
||||
/PARSE
|
||||
/STRING
|
||||
0
|
||||
0<
|
||||
0<>
|
||||
0=
|
||||
0>
|
||||
1
|
||||
1+
|
||||
1-
|
||||
2
|
||||
2!
|
||||
2!L
|
||||
2*
|
||||
2+
|
||||
2-
|
||||
2/
|
||||
2>R
|
||||
2@
|
||||
2@L
|
||||
2CONSTANT
|
||||
2DROP
|
||||
2DUP
|
||||
2LITERAL
|
||||
2NIP
|
||||
2OVER
|
||||
2R>
|
||||
2R@
|
||||
2ROT
|
||||
2SWAP
|
||||
2VARIABLE
|
||||
3
|
||||
:
|
||||
:NONAME
|
||||
;
|
||||
;C
|
||||
;CODE
|
||||
<
|
||||
<#
|
||||
<>
|
||||
<RESOLVE
|
||||
=
|
||||
>
|
||||
><
|
||||
>BODY
|
||||
>FLOAT
|
||||
>FNAME
|
||||
>IN
|
||||
>MARK
|
||||
>NUMBER
|
||||
>R
|
||||
?
|
||||
?BAL
|
||||
?BLOCK
|
||||
?COMP
|
||||
?CSP
|
||||
?DO
|
||||
?DUP
|
||||
?EXEC
|
||||
?STACK
|
||||
@
|
||||
@EXECUTE
|
||||
@L
|
||||
ABORT
|
||||
ABORT"
|
||||
ABS
|
||||
ACCEPT
|
||||
ADDR
|
||||
AGAIN
|
||||
AHEAD
|
||||
AKA
|
||||
ALIGN
|
||||
ALIGNED
|
||||
ALLOT
|
||||
AND
|
||||
APPLICATION
|
||||
ASSEMBLER
|
||||
AT-XY
|
||||
ATTRIB
|
||||
B
|
||||
B/BUF
|
||||
BACKGROUND
|
||||
BAL
|
||||
BASE
|
||||
BEEP
|
||||
BEGIN
|
||||
BEHEAD
|
||||
BETWEEN
|
||||
BIN
|
||||
BINARY
|
||||
BIOS-IO
|
||||
BL
|
||||
BLANK
|
||||
BLK
|
||||
BLOCK
|
||||
BOLD
|
||||
BOUNDS
|
||||
BRIGHT
|
||||
BUFFER
|
||||
BUILD
|
||||
BYE
|
||||
C!
|
||||
C!L
|
||||
C,
|
||||
C/L
|
||||
C@
|
||||
C@L
|
||||
CAPS
|
||||
CASE
|
||||
CATCH
|
||||
CATCHER
|
||||
CELL+
|
||||
CELL-
|
||||
CELLS
|
||||
CHAIN
|
||||
CHAR
|
||||
CHAR+
|
||||
CHARS
|
||||
CHECKING
|
||||
CLEAR-LINE
|
||||
CLOSE
|
||||
CLOSE-ALL
|
||||
CLOSE-FILE
|
||||
CMDTAIL
|
||||
CMOVE
|
||||
CMOVE>
|
||||
CMOVEL
|
||||
CODE
|
||||
COLD
|
||||
COLOR-TABLE
|
||||
COMPARE
|
||||
COMPILE
|
||||
COMPILE,
|
||||
COND
|
||||
CONSOLE
|
||||
CONSTANT
|
||||
CONTEXT
|
||||
COUNT
|
||||
CR
|
||||
CREATE
|
||||
CREATE-FILE
|
||||
CS-DROP
|
||||
CS-MARK
|
||||
CS-PICK
|
||||
CS-POP
|
||||
CS-PUSH
|
||||
CS-ROLL
|
||||
CS-TEST
|
||||
CSEG
|
||||
CSP
|
||||
D+
|
||||
D-
|
||||
D.
|
||||
D.R
|
||||
D0<
|
||||
D0=
|
||||
D2*
|
||||
D2/
|
||||
D<
|
||||
D=
|
||||
D>F
|
||||
D>S
|
||||
DABS
|
||||
DECIMAL
|
||||
DEFER
|
||||
DEFINITIONS
|
||||
DELETE
|
||||
DELETE-FILE
|
||||
DELETE-LINE
|
||||
DEPTH
|
||||
DIR
|
||||
DMAX
|
||||
DMIN
|
||||
DNEGATE
|
||||
DO
|
||||
DOES>
|
||||
DOS-IO
|
||||
DOSCALL
|
||||
DOSERR?
|
||||
DOSVER
|
||||
DP
|
||||
DPH
|
||||
DPL
|
||||
DROP
|
||||
DU<
|
||||
DUMP
|
||||
DUP
|
||||
DXFORTH
|
||||
ELSE
|
||||
EMIT
|
||||
EMPTY
|
||||
EMPTY-BUFFERS
|
||||
END
|
||||
ENDCASE
|
||||
ENDOF
|
||||
EOL
|
||||
ERASE
|
||||
EVALUATE
|
||||
EXECUTE
|
||||
EXIT
|
||||
F!
|
||||
F*
|
||||
F**
|
||||
F+
|
||||
F,
|
||||
F-
|
||||
F.
|
||||
F.R
|
||||
F/
|
||||
F0<
|
||||
F0=
|
||||
F0>
|
||||
F<
|
||||
F>
|
||||
F>D
|
||||
F>S
|
||||
F@
|
||||
FABS
|
||||
FALIGN
|
||||
FALIGNED
|
||||
FALSE
|
||||
FATAN
|
||||
FCONSTANT
|
||||
FCOS
|
||||
FDB
|
||||
FDEPTH
|
||||
FDP
|
||||
FDROP
|
||||
FDUP
|
||||
FE.
|
||||
FE.R
|
||||
FEXP
|
||||
FILE-POSITION
|
||||
FILE-SIZE
|
||||
FILE-STATUS
|
||||
FILEBLOCKS
|
||||
FILL
|
||||
FIND
|
||||
FLITERAL
|
||||
FLN
|
||||
FLOAD
|
||||
FLOAT+
|
||||
FLOATS
|
||||
FLOOR
|
||||
FLUSH
|
||||
FLUSH-FILE
|
||||
FM/MOD
|
||||
FMAX
|
||||
FMIN
|
||||
FNEGATE
|
||||
FOREGROUND
|
||||
FORGET
|
||||
FORTH
|
||||
FOVER
|
||||
FPICK
|
||||
FRANDOM
|
||||
FROT
|
||||
FROUND
|
||||
FS.
|
||||
FS.R
|
||||
FS0
|
||||
FSIN
|
||||
FSP
|
||||
FSQRT
|
||||
FSWAP
|
||||
FVARIABLE
|
||||
FYI
|
||||
G.
|
||||
G.R
|
||||
GET-CURRENT
|
||||
GET-WINDOW
|
||||
GET-XY
|
||||
GETFILENAME
|
||||
HERE
|
||||
HEX
|
||||
HLIMIT
|
||||
HOLD
|
||||
HSEG
|
||||
I
|
||||
I'
|
||||
ICLOSE
|
||||
IF
|
||||
IMMEDIATE
|
||||
INCLUDE
|
||||
INCLUDED
|
||||
INDEX
|
||||
INSERT-LINE
|
||||
INTCALL
|
||||
INTERPRET
|
||||
INVERSE
|
||||
INVERT
|
||||
IS
|
||||
J
|
||||
KEY
|
||||
KEY?
|
||||
L
|
||||
LABEL
|
||||
LAST
|
||||
LASTFILE
|
||||
LDUMP
|
||||
LEAVE
|
||||
LFILL
|
||||
LIMIT
|
||||
LINK,
|
||||
LIST
|
||||
LISTING
|
||||
LITERAL
|
||||
LOAD
|
||||
LOADED
|
||||
LOADFILE
|
||||
LOADLINE
|
||||
LOOP
|
||||
LREAD
|
||||
LS
|
||||
LSHIFT
|
||||
LWRITE
|
||||
M*
|
||||
M*/
|
||||
M+
|
||||
MACRO
|
||||
MARKER
|
||||
MAX
|
||||
MAX-PRECISION
|
||||
MIN
|
||||
MOD
|
||||
MOVE
|
||||
MS
|
||||
N
|
||||
N>NAME
|
||||
NEGATE
|
||||
NHOLD
|
||||
NIP
|
||||
NOOP
|
||||
NORMAL
|
||||
NOT
|
||||
NUMBER?
|
||||
OF
|
||||
OFF
|
||||
ON
|
||||
OPEN
|
||||
OPEN-FILE
|
||||
OR
|
||||
ORDER
|
||||
OUT
|
||||
OVER
|
||||
P!
|
||||
P@
|
||||
PACK
|
||||
PAD
|
||||
PAGE
|
||||
PARSE
|
||||
PATH
|
||||
PAUSE
|
||||
PC!
|
||||
PC@
|
||||
PI
|
||||
PICK
|
||||
PLACE
|
||||
POSTPONE
|
||||
PRECISION
|
||||
PRINTER
|
||||
PROTECT
|
||||
QUIT
|
||||
QX
|
||||
R/O
|
||||
R/W
|
||||
R0
|
||||
R>
|
||||
R@
|
||||
READ-FILE
|
||||
READ-LINE
|
||||
RECURSE
|
||||
REFILL
|
||||
REMEMBER
|
||||
RENAME
|
||||
RENAME-FILE
|
||||
REPEAT
|
||||
REPOSITION-FILE
|
||||
REPRESENT
|
||||
RESIZE-FILE
|
||||
RETURN
|
||||
ROLL
|
||||
ROT
|
||||
RP!
|
||||
RP@
|
||||
RSHIFT
|
||||
S"
|
||||
S,
|
||||
S.R
|
||||
S0
|
||||
S>D
|
||||
S>F
|
||||
SAVE
|
||||
SAVE-BUFFERS
|
||||
SCAN
|
||||
SCR
|
||||
SCREEN?
|
||||
SEARCH
|
||||
SED
|
||||
SET-CURRENT
|
||||
SET-LIMIT
|
||||
SET-PRECISION
|
||||
SET-WINDOW
|
||||
SHOLD
|
||||
SHOW
|
||||
SIGN
|
||||
SKIP
|
||||
SLITERAL
|
||||
SM/REM
|
||||
SMUDGE
|
||||
SOUND
|
||||
SOURCE
|
||||
SP!
|
||||
SP@
|
||||
SPACE
|
||||
SPACES
|
||||
SSEG
|
||||
STATE
|
||||
SWAP
|
||||
SWAP-FILE
|
||||
SYS
|
||||
SYS-VEC
|
||||
SYSTEM
|
||||
TED
|
||||
THEN
|
||||
THENS
|
||||
THROW
|
||||
THRU
|
||||
TICKS
|
||||
TO
|
||||
TOKEN
|
||||
TRIM
|
||||
TRUE
|
||||
TUCK
|
||||
TURNKEY
|
||||
TURNKEY-SYSTEM
|
||||
TYPE
|
||||
U.
|
||||
U.R
|
||||
U2/
|
||||
U<
|
||||
U>
|
||||
UM*
|
||||
UM/MOD
|
||||
UMAX
|
||||
UMIN
|
||||
UNLOOP
|
||||
UNNEST
|
||||
UNTIL
|
||||
UNUSED
|
||||
UP
|
||||
UPCASE
|
||||
UPDATE
|
||||
UPPER
|
||||
USER
|
||||
USING
|
||||
VALUE
|
||||
VARIABLE
|
||||
VOC-LINK
|
||||
VOCABULARY
|
||||
VOCS
|
||||
W/O
|
||||
W>NAME
|
||||
WAIT-TICK
|
||||
WARNING
|
||||
WHILE
|
||||
WITHIN
|
||||
WORD
|
||||
WORDS
|
||||
WORDS:
|
||||
WRITE-FILE
|
||||
WRITE-LINE
|
||||
XOR
|
||||
Y/N
|
||||
ZCOUNT
|
||||
ZPLACE
|
||||
[
|
||||
[']
|
||||
[ASM
|
||||
[CHAR]
|
||||
[COMPILE]
|
||||
[DEFINED]
|
||||
[ELSE]
|
||||
[IF]
|
||||
[THEN]
|
||||
[UNDEFINED]
|
||||
\
|
||||
\\
|
||||
]
|
1
DX-FORTH v430/EXTEND.SCR
Normal file
1
DX-FORTH v430/EXTEND.SCR
Normal file
@ -0,0 +1 @@
|
||||
\ Extend Extend DX-Forth kernel \ Load block empty forth definitions decimal system marker -TASK ( editor stubs) : SED s" #1 FLOAD SED SED" evaluate ; : TED s" LOADLINE @ LASTFILE INCLUDE TED (TED)" evaluate ; 1 fload TOOLS 1 fload ASM application protect
|
92
DX-FORTH v430/F87.TXT
Normal file
92
DX-FORTH v430/F87.TXT
Normal file
@ -0,0 +1,92 @@
|
||||
F87 - Hardware Floating-Point for DX-Forth
|
||||
|
||||
F87 requires an 80387 or compatible floating-point processor. Applications
|
||||
compiled with F87 will check whether a suitable FPU is present and abort
|
||||
with an error if none is found.
|
||||
|
||||
F87 models currently supported:
|
||||
|
||||
F87S.SCR single precision (32 bit) reals on data stack
|
||||
F87D.SCR double precision (64 bit) reals on data stack
|
||||
F87DS.SCR double precision (64 bit) reals on separate stack
|
||||
F87X.SCR extended precision (80 bit) reals on data stack
|
||||
|
||||
Compile the model of your choice e.g. FORTH.EXE F87D 1 LOAD BYE
|
||||
|
||||
While F87 includes several IEEE 754 features such as NaN/Inf, signed-zero,
|
||||
rounding modes etc. there is no attempt to be IEEE 754 compliant.
|
||||
|
||||
Acknowlegements:
|
||||
|
||||
F83 8087 FLOATING POINT 1984 by Steve Pollack
|
||||
|
||||
|
||||
F87 Glossary:
|
||||
|
||||
FINIT ( -- ) Performs 80x87 FPU instruction 'finit' resetting the
|
||||
FPU hardware and rounding mode to "round to nearest/
|
||||
even". If a compatible FPU is not present an error
|
||||
message "requires 80387+ FPU" is issued and the
|
||||
application aborts. By default FINIT is executed by
|
||||
COLD.
|
||||
|
||||
CW@ ( -- cw ) Get FPU control word
|
||||
CW! ( cw -- ) Set FPU control word
|
||||
|
||||
SET-NEAR ( -- ) Set FPU rounding to "nearest or even" (default)
|
||||
SET-FLOOR ( -- ) Set FPU rounding to "round down"
|
||||
SET-CEIL ( -- ) Set FPU rounding to "round up"
|
||||
SET-TRUNC ( -- ) Set FPU rounding to "round towards zero" i.e. truncate
|
||||
|
||||
FROUND ( r1 -- r2 ) Round to integral value using current rounding mode
|
||||
FNEAR ( r1 -- r2 ) Round to integral value nearest or even
|
||||
FLOOR ( r1 -- r2 ) Round to integral value nearest negative infinity
|
||||
FCEIL ( r1 -- r2 ) Round to integral value nearest positive infinity
|
||||
FTRUNC ( r1 -- r2 ) Round to integral value nearest zero
|
||||
|
||||
SIGNED-ZERO ( -- addr ) A VARIABLE which controls floating-point
|
||||
negative-zero display. Default is OFF.
|
||||
|
||||
F0= ( r -- flag ) Return true if r is zero, or false otherwise. Does not
|
||||
differentiate between positive and negative zero.
|
||||
|
||||
F= ( r1 r2 -- flag ) Return true if r1 and r2 are equal, or false otherwise.
|
||||
Does not differentiate between positive and negative
|
||||
zero.
|
||||
|
||||
FLOG ( r1 -- r2 ) r2 is the base-ten logarithm of r1. An ambiguous
|
||||
condition exists if r1 is less than or equal to zero.
|
||||
|
||||
FALOG ( r1 -- r2 ) Raise ten to the power r1, giving r2.
|
||||
|
||||
FSIGNBIT ( r -- sign ) Return sign of r as indicated by the IEEE sign bit.
|
||||
|
||||
FSIGN ( r -- sign ) As for FSIGNBIT except the sign of -0.0E is determined
|
||||
by variable SIGNED-ZERO.
|
||||
|
||||
FCLASS ( r -- +n ) Return class of floating-point number r. +n is a
|
||||
positive non-zero value indicating NaN, infinite,
|
||||
normal, subnormal, zero or the 80x87 conditions
|
||||
unsupported and empty.
|
||||
|
||||
FP-NORMAL ( -- +n ) CONSTANT representing f/p finite class
|
||||
FP-SUBNORMAL ( -- +n ) CONSTANT representing f/p subnormal class
|
||||
FP-ZERO ( -- +n ) CONSTANT representing f/p zero class
|
||||
FP-INFINITE ( -- +n ) CONSTANT representing f/p infinity class
|
||||
FP-NAN ( -- +n ) CONSTANT representing f/p NaN class
|
||||
|
||||
+INF ( -- r ) FCONSTANT returning f/p number '+Inf'
|
||||
-INF ( -- r ) FCONSTANT returning f/p number '-Inf'
|
||||
+NAN ( -- r ) FCONSTANT returning f/p number '+NaN'
|
||||
-NAN ( -- r ) FCONSTANT returning f/p number '-NaN'
|
||||
|
||||
>FLOAT ( c-addr u -- r true | false | other 1 )
|
||||
Extend >FLOAT semantics to return 1 and the corresponding IEEE datum
|
||||
if any of the case-insensitive strings "NaN" "Inf" "Infinity", with or
|
||||
without sign, are present.
|
||||
|
||||
REPRESENT ( r c-addr n1 -- n2 flag1 flag2 )
|
||||
In addition to the semantics for REPRESENT (see DX-Forth glossary) when
|
||||
flag2=false return a string "+NAN" "-NAN" "+INF" "-INF" or "BADFLT" in
|
||||
the buffer at c-addr padded with trailing blanks (BL). n2 is reserved
|
||||
and flag1=sign. Rounding direction is per current rounding mode.
|
1
DX-FORTH v430/F87D.SCR
Normal file
1
DX-FORTH v430/F87D.SCR
Normal file
File diff suppressed because one or more lines are too long
1
DX-FORTH v430/F87DS.SCR
Normal file
1
DX-FORTH v430/F87DS.SCR
Normal file
File diff suppressed because one or more lines are too long
1
DX-FORTH v430/F87S.SCR
Normal file
1
DX-FORTH v430/F87S.SCR
Normal file
File diff suppressed because one or more lines are too long
1
DX-FORTH v430/F87X.SCR
Normal file
1
DX-FORTH v430/F87X.SCR
Normal file
File diff suppressed because one or more lines are too long
1
DX-FORTH v430/FCOPY.SCR
Normal file
1
DX-FORTH v430/FCOPY.SCR
Normal file
File diff suppressed because one or more lines are too long
64
DX-FORTH v430/FILES.TXT
Normal file
64
DX-FORTH v430/FILES.TXT
Normal file
@ -0,0 +1,64 @@
|
||||
The following files are included in the DX-Forth distribution:
|
||||
|
||||
Executables -
|
||||
|
||||
FORTH.EXE DX-Forth compiler
|
||||
FORTH-F.EXE DX-Forth compiler with floating point
|
||||
DX.EXE FORTH-F.EXE with screen editor loaded
|
||||
LISTING.BAT Make a formatted listing file from a screen file
|
||||
|
||||
Documentation -
|
||||
|
||||
WHATSNEW.TXT Summary of additions/changes/fixes
|
||||
CHANGES.TXT Important changes information
|
||||
DXFORTH.TXT DX-Forth documentation
|
||||
DXFORTH.GLO DX-Forth glossary of non-standard words
|
||||
DXFORTH.WDS DX-Forth kernel words
|
||||
SED.TXT Screen file editor
|
||||
TED.TXT Text file editor
|
||||
ASM.TXT 8086/8087 assembler
|
||||
F87.TXT 80387 floating point
|
||||
OBSOLETE.TXT When old DX-Forth applications no longer compile...
|
||||
MULTI.TXT Multitasker
|
||||
FILES.TXT Files list
|
||||
|
||||
System source -
|
||||
|
||||
MAKEF.BAT Build DX-Forth binaries (needs Borland TASM)
|
||||
MAKEF87.BAT Build 80387 floating point binaries
|
||||
KERNEL.ASM MASM/TASM source for DX-Forth
|
||||
EXTEND.SCR Extends kernel
|
||||
TOOLS.SCR Resident extensions & utilities
|
||||
ASM.SCR Forth 8086 assembler
|
||||
ASM87.SCR 8087 assembler extensions
|
||||
SED.SCR Screen file editor
|
||||
TED.F Text file editor
|
||||
|
||||
Misc source -
|
||||
|
||||
ASMCOND.SCR Assembler structured conditionals
|
||||
ASMTEST.SCR Test assembler
|
||||
OBSOLETE.SCR Obsolete DX-Forth functions
|
||||
MULTI.SCR Multitasker
|
||||
F87D.SCR 80387 double-precision f/p
|
||||
F87S.SCR 80387 single-precision f/p
|
||||
F87X.SCR 80387 extended-precision f/p
|
||||
F87DS.SCR 80387 double-precision f/p with separate stack
|
||||
FPOUT.F Support for 80387 floating point
|
||||
OVERLAY.SCR Overlay system
|
||||
STRINGS.SCR Sample string package
|
||||
FCOPY.SCR Sample filecopy utility
|
||||
TXT2BLK.SCR Text to block conversion utility
|
||||
BLK2TXT.SCR Block to text conversion utility
|
||||
BREAKGO.SCR Debugging utility
|
||||
MISC.SCR Miscellaneous function library
|
||||
SHOW.SCR Print source files 6 screens per page
|
||||
SSED.SCR Create stand-alone screen editor
|
||||
NEWAPP.SCR Skeletal MS-DOS application
|
||||
DOSLIB.SCR Function library and NEWAPP support
|
||||
STKCHK.SCR Stack balance check utility
|
||||
LFN.SCR Long filename support for Windows 95
|
||||
LOCALS.SCR ANS locals
|
||||
HLOCALS.SCR Hayes locals extension
|
||||
MISER.SCR Miser Case extensions & demo
|
||||
|
24
DX-FORTH v430/FILE_ID.DIZ
Normal file
24
DX-FORTH v430/FILE_ID.DIZ
Normal file
@ -0,0 +1,24 @@
|
||||
DX-Forth 4 - Forth compiler for MS-DOS
|
||||
--------------------------------------
|
||||
|
||||
DX-Forth is a Forth language compiler and development system
|
||||
for MS-DOS 2.x and compatible disk operating systems. It is
|
||||
intended to be a complete, easy to use, programming tool for
|
||||
the creation of DOS applications.
|
||||
|
||||
Features include:
|
||||
|
||||
- ANS FORTH Standard (FORTH-94) *
|
||||
- Fast direct-threaded code
|
||||
- Generate turnkey applications without compiler overhead
|
||||
- Fast floating point and trigonometric functions
|
||||
- Forth-94 file I/O
|
||||
- DOSLIB application library
|
||||
- Multitasking
|
||||
- ANS locals
|
||||
- Overlays for large applications
|
||||
- 8086/87 Forth assembler for CODE words
|
||||
- Full source code included
|
||||
|
||||
* DX-FORTH 4 generally follows the FORTH-94 Standard but
|
||||
does not seek to be strictly compliant.
|
BIN
DX-FORTH v430/FORTH-F.EXE
Normal file
BIN
DX-FORTH v430/FORTH-F.EXE
Normal file
Binary file not shown.
BIN
DX-FORTH v430/FORTH.EXE
Normal file
BIN
DX-FORTH v430/FORTH.EXE
Normal file
Binary file not shown.
451
DX-FORTH v430/FPOUT.F
Normal file
451
DX-FORTH v430/FPOUT.F
Normal file
@ -0,0 +1,451 @@
|
||||
\
|
||||
\ FPOUT.F version 3.10
|
||||
\
|
||||
\ A Forth floating-point output words package
|
||||
\
|
||||
\ Main words:
|
||||
\
|
||||
\ Compact Formatted String
|
||||
\ ------- --------- ------
|
||||
\ FS. FS.R (FS.) Scientific
|
||||
\ FE. FE.R (FE.) Engineering
|
||||
\ F. F.R (F.) Floating-point
|
||||
\ G. G.R (G.) General
|
||||
\
|
||||
\ FDP ( -- a-addr )
|
||||
\
|
||||
\ A variable controlling decimal point display. If the
|
||||
\ contents are zero then trailing decimal points are
|
||||
\ not shown. If non-zero (default) the decimal point is
|
||||
\ displayed.
|
||||
\
|
||||
\ FECHAR ( -- c-addr )
|
||||
\
|
||||
\ A character variable containing the output character
|
||||
\ used to indicate the exponent. Default is 'E'.
|
||||
\
|
||||
\ FEDIGITS ( -- a-addr )
|
||||
\
|
||||
\ A variable containing the minimum number of exponent
|
||||
\ digits to display in formatted output mode. Default
|
||||
\ value is 2, minimum is 1. Does not affect compact
|
||||
\ output mode.
|
||||
\
|
||||
\ MAX-PRECISION ( -- n )
|
||||
\
|
||||
\ A constant returning the implementation-defined
|
||||
\ maximum precision. Equivalent to the value returned
|
||||
\ by the environment-query string MAX-FLOAT-DIGITS.
|
||||
\
|
||||
\ Notes:
|
||||
\
|
||||
\ Output words which specify the number of places after
|
||||
\ the decimal point may use the value -1 to force compact
|
||||
\ mode.
|
||||
\
|
||||
\ In compact mode non-essential zeros and signs are
|
||||
\ removed and the number of significant digits output is
|
||||
\ limited to MAX-PRECISION digits. FS. FE. F. G. operate
|
||||
\ in compact mode.
|
||||
\
|
||||
\ In formatted mode the number of decimal places output
|
||||
\ is fixed and PRECISION has no effect.
|
||||
\
|
||||
\ The character string returned by (FS.) (FE.) (F.) (G.)
|
||||
\ resides in the pictured-numeric output area.
|
||||
\
|
||||
\ An ambiguous condition exists if: BASE is not decimal;
|
||||
\ character string exceeds pictured-numeric output area;
|
||||
\ PRECISION returns a value less than one or greater
|
||||
\ than MAX-FLOAT-DIGITS.
|
||||
\
|
||||
\ For use with separate or common stack floating-point
|
||||
\ Forth models.
|
||||
\
|
||||
\ This code is PUBLIC DOMAIN. Use at your own risk.
|
||||
\
|
||||
\ *****************************************************
|
||||
\ This version of FPOUT requires REPRESENT conform to
|
||||
\ the specification proposed here:
|
||||
\
|
||||
\ ftp://ftp.taygeta.com/pub/Forth/Applications/ANS/
|
||||
\ Represent_33.txt (2014-03-17)
|
||||
\
|
||||
\ If your Forth does not have a compliant REPRESENT
|
||||
\ then use FPOUT v2.2 instead.
|
||||
\ *****************************************************
|
||||
\
|
||||
\ History:
|
||||
\
|
||||
\ 3.1 2006-11-13 es Demo for REPRESENT proposal.
|
||||
\ 3.2 2007-06-05 es Changed default to trailing
|
||||
\ decimal point on.
|
||||
\ 3.3 2007-11-19 es Add FECHAR FEDIGITS. Fix zero
|
||||
\ sign in (F.) F.R
|
||||
\ 3.4 2008-01-23 es Updated to REPRESENT spec 2.1
|
||||
\ 3.5 2010-12-05 es Updated to REPRESENT spec 3.0
|
||||
\ 3.6 2011-02-06 es Changed FECHAR storage from
|
||||
\ cell to character.
|
||||
\ 3.7 2011-02-16 es Renamed mp# to MAX-PRECISION.
|
||||
\ Removed effect of PRECISION in
|
||||
\ formatted mode.
|
||||
\ 3.8 2011-05-25 es Fixed log(0) in (f1)
|
||||
\ 3.9 2012-05-20 es Range check FEDIGITS PRECISION.
|
||||
\ FEDIGITS minimum changed to 1.
|
||||
\ 3.10 2014-06-06 es Factor out S.R SHOLD NHOLD. No
|
||||
\ functional change.
|
||||
|
||||
CR .( Loading FPOUT 3.10 2014-06-06 ... ) CR
|
||||
|
||||
DECIMAL
|
||||
|
||||
\ Useful tools which exist in some Forth systems albeit
|
||||
\ under different names
|
||||
|
||||
[UNDEFINED] DXFORTH [IF]
|
||||
|
||||
\ type string right-justified
|
||||
: S.R ( c-addr u width -- )
|
||||
OVER - SPACES TYPE ;
|
||||
|
||||
\ HOLD string
|
||||
: SHOLD ( c-addr u -- )
|
||||
BEGIN DUP WHILE 1- 2DUP CHARS + C@ HOLD
|
||||
REPEAT 2DROP ;
|
||||
|
||||
\ HOLD n characters
|
||||
: NHOLD ( n char -- )
|
||||
SWAP 0 ?DO DUP HOLD LOOP DROP ;
|
||||
|
||||
[THEN]
|
||||
|
||||
\ Compile application
|
||||
|
||||
CREATE FDP 2 CELLS ALLOT
|
||||
CREATE FECHAR 1 CHARS ALLOT
|
||||
VARIABLE FEDIGITS
|
||||
|
||||
\ ****************** USER OPTIONS *******************
|
||||
|
||||
1 FDP ! \ trailing decimal point
|
||||
2 FEDIGITS ! \ minimum exponent digits
|
||||
CHAR E FECHAR C! \ output character for exponent
|
||||
|
||||
\ *****************************************************
|
||||
|
||||
[DEFINED] DXFORTH [IF] #fdigits ( n) [ELSE]
|
||||
|
||||
S" MAX-FLOAT-DIGITS" ENVIRONMENT? 0= [IF]
|
||||
CR .( MAX-FLOAT-DIGITS not found ) ABORT
|
||||
[THEN] ( n)
|
||||
|
||||
[THEN]
|
||||
|
||||
\ Maximum PRECISION
|
||||
( n) CONSTANT MAX-PRECISION
|
||||
|
||||
\ Define SET-PRECISION PRECISION if not present
|
||||
[UNDEFINED] SET-PRECISION [IF]
|
||||
|
||||
\ Return the number of significant digits currently used
|
||||
\ by F. FE. FS. G.
|
||||
MAX-PRECISION VALUE PRECISION
|
||||
|
||||
\ Set the number of significant digits currently used by
|
||||
\ F. FE. FS. G.
|
||||
: SET-PRECISION ( +n -- )
|
||||
1 MAX MAX-PRECISION MIN TO PRECISION ;
|
||||
|
||||
[THEN]
|
||||
|
||||
MAX-PRECISION SET-PRECISION \ set to maximum
|
||||
|
||||
[DEFINED] DXFORTH [IF] MAX-PRECISION ( n) [ELSE]
|
||||
|
||||
S" REPRESENT-CHARS" ENVIRONMENT?
|
||||
0= [IF] MAX-PRECISION [THEN] ( n )
|
||||
|
||||
[THEN]
|
||||
|
||||
( n ) CONSTANT mc# \ max chars output from REPRESENT
|
||||
|
||||
CREATE fbuf mc# CHARS ALLOT
|
||||
|
||||
0 VALUE ex# \ exponent
|
||||
0 VALUE sn# \ sign
|
||||
0 VALUE ef# \ exponent factor 1=FS. 3=FE.
|
||||
0 VALUE pl# \ +n places right of decimal point
|
||||
\ -1 compact display
|
||||
|
||||
\ get exponent
|
||||
: (f1) ( F: r -- r ) ( -- exp )
|
||||
FDUP [UNDEFINED] FLOG [IF]
|
||||
fbuf MAX-PRECISION REPRESENT NIP AND
|
||||
[ELSE]
|
||||
F0= IF 1 ELSE FDUP
|
||||
FABS FLOG FLOOR F>D D>S 1+ THEN
|
||||
[THEN] ;
|
||||
|
||||
\ apply exponent factor
|
||||
: (f2) ( exp -- offset exp2 )
|
||||
S>D ef# FM/MOD ef# * ;
|
||||
|
||||
\ float to character string
|
||||
: (f3) ( F: r -- ) ( places -- c-addr u flag )
|
||||
DUP TO pl# 0< IF
|
||||
PRECISION
|
||||
ELSE
|
||||
(f1) ef# 0> IF 1- (f2) DROP 1+ THEN pl# +
|
||||
THEN MAX-PRECISION MIN fbuf SWAP REPRESENT >R
|
||||
TO sn# TO ex# fbuf mc# -TRAILING R> <# ;
|
||||
|
||||
\ insert exponent
|
||||
: (f4) ( exp -- )
|
||||
DUP ABS S>D pl# 0< 0= DUP >R IF FEDIGITS @
|
||||
1 MAX 1 ?DO # LOOP THEN #S 2DROP DUP SIGN 0< 0=
|
||||
R> AND IF [CHAR] + HOLD THEN FECHAR C@ HOLD ;
|
||||
|
||||
\ conditionally set flag
|
||||
: (f5) ( n -- +n|0 )
|
||||
0 MAX DUP FDP CELL+ +! ;
|
||||
|
||||
\ insert string
|
||||
: (f6) ( c-addr n -- )
|
||||
(f5) SHOLD ;
|
||||
|
||||
\ insert '0's
|
||||
: (f7) ( n -- )
|
||||
(f5) [CHAR] 0 NHOLD ;
|
||||
|
||||
\ insert sign
|
||||
: (f8) ( -- )
|
||||
sn# SIGN 0 0 #> ;
|
||||
|
||||
\ trim trailing '0's
|
||||
: (f9) ( c-addr u1 -- c-addr u2 )
|
||||
pl# 0< IF
|
||||
BEGIN DUP WHILE 1- 2DUP CHARS +
|
||||
C@ [CHAR] 0 - UNTIL 1+ THEN
|
||||
THEN ;
|
||||
|
||||
: (fa) ( n -- n n|pl# )
|
||||
pl# 0< IF DUP ELSE pl# THEN ;
|
||||
|
||||
\ insert fraction string n places right of dec. point
|
||||
: (fb) ( c-addr u n -- )
|
||||
0 FDP CELL+ !
|
||||
>R (f9) R@ +
|
||||
(fa) OVER - (f7) \ trailing 0's
|
||||
(fa) MIN R@ - (f6) \ fraction
|
||||
R> (fa) MIN (f7) \ leading 0's
|
||||
FDP 2@ OR IF
|
||||
[CHAR] . HOLD
|
||||
THEN ;
|
||||
|
||||
\ split string into integer/fraction parts at n and insert
|
||||
: (fc) ( c-addr u n -- )
|
||||
>R 2DUP R@ MIN 2SWAP R> /STRING 0 (fb) (f6) ;
|
||||
|
||||
\ exponent form
|
||||
: (fd) ( F: r -- ) ( n factor -- c-addr u )
|
||||
TO ef# (f3) IF ex# 1- (f2) (f4) 1+ (fc) (f8) THEN ;
|
||||
|
||||
\ Main words
|
||||
|
||||
\ Convert real number r to a string c-addr u in scientific
|
||||
\ notation with n places right of the decimal point.
|
||||
: (FS.) ( F: r -- ) ( n -- c-addr u )
|
||||
1 (fd) ;
|
||||
|
||||
\ Display real number r in scientific notation right-
|
||||
\ justified in a field width u with n places right of the
|
||||
\ decimal point.
|
||||
: FS.R ( F: r -- ) ( n u -- )
|
||||
>R (FS.) R> S.R ;
|
||||
|
||||
\ Display real number r in scientific notation followed by
|
||||
\ a space. Non-essential zeros and signs are removed.
|
||||
: FS. ( F: r -- )
|
||||
-1 0 FS.R SPACE ;
|
||||
|
||||
\ Convert real number r to a string c-addr u in engineering
|
||||
\ notation with n places right of the decimal point.
|
||||
: (FE.) ( F: r -- ) ( n -- c-addr u )
|
||||
3 (fd) ;
|
||||
|
||||
\ Display real number r in engineering notation right-
|
||||
\ justified in a field width u with n places right of the
|
||||
\ decimal point.
|
||||
: FE.R ( F: r -- ) ( n u -- )
|
||||
>R (FE.) R> S.R ;
|
||||
|
||||
\ Display real number r in engineering notation followed
|
||||
\ by a space. Non-essential zeros and signs are removed.
|
||||
: FE. ( F: r -- )
|
||||
-1 0 FE.R SPACE ;
|
||||
|
||||
\ Convert real number r to string c-addr u in fixed-point
|
||||
\ notation with n places right of the decimal point.
|
||||
: (F.) ( F: r -- ) ( n -- c-addr u )
|
||||
0 TO ef# (f3) IF
|
||||
ex# DUP mc# > IF
|
||||
fbuf 0 ( dummy ) 0 (fb)
|
||||
mc# - (f7) (f6)
|
||||
ELSE
|
||||
DUP 0> IF
|
||||
(fc)
|
||||
ELSE
|
||||
ABS (fb) 1 (f7)
|
||||
THEN
|
||||
THEN (f8)
|
||||
THEN ;
|
||||
|
||||
\ Display real number r in fixed-point notation right-
|
||||
\ justified in a field width u with n places right of the
|
||||
\ decimal point.
|
||||
: F.R ( F: r -- ) ( n u -- )
|
||||
>R (F.) R> S.R ;
|
||||
|
||||
\ Display real number r in floating-point notation followed
|
||||
\ by a space. Non-essential zeros and signs are removed.
|
||||
: F. ( F: r -- )
|
||||
-1 0 F.R SPACE ;
|
||||
|
||||
\ Convert real number r to string c-addr u with n places
|
||||
\ right of the decimal point. Fixed-point is used if the
|
||||
\ exponent is in the range -4 to 5 otherwise use scientific
|
||||
\ notation.
|
||||
: (G.) ( F: r -- ) ( n -- c-addr u )
|
||||
>R (f1) [ -4 1+ ] LITERAL [ 5 2 + ] LITERAL WITHIN
|
||||
R> SWAP IF (F.) ELSE (FS.) THEN ;
|
||||
|
||||
\ Display real number r right-justified in a field width u
|
||||
\ with n places right of the decimal point. Fixed-point is
|
||||
\ used if the exponent is in the range -4 to 5 otherwise
|
||||
\ use scientific notation.
|
||||
: G.R ( F: r -- ) ( n u -- )
|
||||
>R (G.) R> S.R ;
|
||||
|
||||
\ Display real number r followed by a space. Floating-point
|
||||
\ is used if the exponent is in the range -4 to 5 otherwise
|
||||
\ use scientific notation. Non-essential zeros and signs are
|
||||
\ removed.
|
||||
: G. ( F: r -- )
|
||||
-1 0 G.R SPACE ;
|
||||
|
||||
CR FDP @ [IF]
|
||||
CR .( Decimal point always displayed. Use 0 FDP ! )
|
||||
CR .( or FDP OFF to disable trailing decimal point. )
|
||||
[ELSE]
|
||||
CR .( Trailing decimal point not displayed. Use )
|
||||
CR .( 1 FDP ! or FDP ON for FORTH-94 compliance. )
|
||||
[THEN] CR
|
||||
|
||||
[DEFINED] DXFORTH [IF] BEHEAD mc# (fd) [THEN]
|
||||
|
||||
\ ****************** DEMONSTRATION ******************
|
||||
|
||||
0 [IF]
|
||||
|
||||
CR .( Loading demo words... ) CR
|
||||
CR .( TEST1 formatted, n decimal places )
|
||||
CR .( TEST2 compact & right-justified )
|
||||
CR .( TEST3 display FS. )
|
||||
CR .( TEST4 display F. )
|
||||
CR .( TEST5 display G. )
|
||||
CR .( TEST6 display 8087 non-numbers ) CR
|
||||
CR .( 'n PLACES' sets decimal places for TEST1. )
|
||||
CR .( SET-PRECISION sets maximum significant )
|
||||
CR .( digits displayable. )
|
||||
CR CR
|
||||
|
||||
[UNDEFINED] F, [IF]
|
||||
: F, ( r -- ) HERE 1 FLOATS ALLOT F! ;
|
||||
[THEN]
|
||||
|
||||
\ floating-point numbers array
|
||||
|
||||
FALIGN HERE ( *)
|
||||
1.23456E-16 F,
|
||||
-1.23456E-11 F,
|
||||
1.23456E-7 F,
|
||||
-1.23456E-6 F,
|
||||
1.23456E-5 F,
|
||||
-1.23456E-4 F,
|
||||
1.23456E-3 F,
|
||||
-1.23456E-2 F,
|
||||
1.23456E-1 F,
|
||||
-0.E0 F,
|
||||
1.23456E+0 F,
|
||||
-1.23456E+1 F,
|
||||
1.23456E+2 F,
|
||||
-1.23456E+3 F,
|
||||
1.23456E+4 F,
|
||||
-1.23456E+5 F,
|
||||
1.23456E+6 F,
|
||||
-1.23456E+7 F,
|
||||
1.23456E+11 F,
|
||||
-1.23456E+16 F,
|
||||
|
||||
( *) HERE OVER - 1 FLOATS / CONSTANT #numbers
|
||||
( *) CONSTANT f-array
|
||||
|
||||
: do-it ( xt -- )
|
||||
#numbers 0 DO
|
||||
f-array FALIGNED I FLOATS +
|
||||
OVER >R F@ CR R> EXECUTE
|
||||
LOOP DROP ;
|
||||
|
||||
2VARIABLE (dw)
|
||||
: d.w ( -- dec.places width ) (dw) 2@ ;
|
||||
: PLACES ( places -- ) d.w SWAP DROP (dw) 2! ;
|
||||
: WIDTH ( width -- ) d.w DROP SWAP (dw) 2! ;
|
||||
|
||||
5 PLACES 18 WIDTH
|
||||
|
||||
: (t1) ( r -- )
|
||||
FDUP d.w FS.R FDUP d.w F.R FDUP d.w G.R d.w FE.R ;
|
||||
|
||||
: TEST1 ( -- )
|
||||
CR ." TEST1 right-justified, formatted ("
|
||||
d.w DROP 0 .R ." decimal places)" CR
|
||||
['] (t1) do-it CR ;
|
||||
|
||||
: (t2) ( r -- )
|
||||
FDUP -1 d.w NIP FS.R FDUP -1 d.w NIP F.R
|
||||
FDUP -1 d.w NIP G.R -1 d.w NIP FE.R ;
|
||||
|
||||
: TEST2 ( -- )
|
||||
CR ." TEST2 right-justified, compact" CR
|
||||
['] (t2) do-it CR ;
|
||||
|
||||
: TEST3 ( -- )
|
||||
CR ." TEST3 FS."
|
||||
CR ['] FS. do-it CR ;
|
||||
|
||||
: TEST4 ( -- )
|
||||
CR ." TEST4 F."
|
||||
CR ['] F. do-it CR ;
|
||||
|
||||
: TEST5 ( -- )
|
||||
CR ." TEST5 G."
|
||||
CR ['] G. do-it CR ;
|
||||
|
||||
: TEST6 ( -- )
|
||||
PRECISION >R 1 SET-PRECISION
|
||||
CR ." TEST6 8087 non-numbers PRECISION = 1" CR
|
||||
CR 1.E0 0.E0 F/ FDUP G.
|
||||
CR FNEGATE G.
|
||||
CR 0.E0 0.E0 F/ FDUP G.
|
||||
CR FNEGATE G.
|
||||
CR
|
||||
R> SET-PRECISION ;
|
||||
|
||||
[ELSE]
|
||||
|
||||
CR .( To compile demonstration words TEST1..TEST6 )
|
||||
CR .( enable conditional in FPOUT source. ) CR
|
||||
|
||||
[THEN]
|
||||
|
||||
\ end
|
1
DX-FORTH v430/HLOCALS.SCR
Normal file
1
DX-FORTH v430/HLOCALS.SCR
Normal file
@ -0,0 +1 @@
|
||||
\ Hayes-style locals Adapted from: http://www.complang.tuwien.ac.at/forth/anslocal.fs \ Hayes-style locals [undefined] (local) [if] 1 fload locals [then] forth definitions system -? : lp >in @ swap token 2dup s" --" compare if 2dup s" }" compare over 0> and if s" |" compare 0= or false else true then else [char] } parse 2drop true then if 2drop 2drop >in @ end dup if false postpone literal then recurse swap >in ! token (local) ; : { false lp >in ! 0 0 (local) ; immediate application behead lp lp
|
9838
DX-FORTH v430/KERNEL.ASM
Normal file
9838
DX-FORTH v430/KERNEL.ASM
Normal file
File diff suppressed because it is too large
Load Diff
1
DX-FORTH v430/LFN.SCR
Normal file
1
DX-FORTH v430/LFN.SCR
Normal file
File diff suppressed because one or more lines are too long
7
DX-FORTH v430/LISTING.BAT
Normal file
7
DX-FORTH v430/LISTING.BAT
Normal file
@ -0,0 +1,7 @@
|
||||
echo off
|
||||
echo Usage: LISTING screenfile output
|
||||
if "%1"=="" goto end
|
||||
if "%2"=="" goto end
|
||||
forth %1 :noname 'DX c! 2 doscall ; sys-vec 8 + ! listing bye >%2
|
||||
echo done!
|
||||
:end
|
1
DX-FORTH v430/LOCALS.SCR
Normal file
1
DX-FORTH v430/LOCALS.SCR
Normal file
File diff suppressed because one or more lines are too long
12
DX-FORTH v430/MAKEF.BAT
Normal file
12
DX-FORTH v430/MAKEF.BAT
Normal file
@ -0,0 +1,12 @@
|
||||
rem opts: NOFLOAT NOFSTACK FLOORED NOHIDE
|
||||
rem opts: EMS= HMS= SMS= FILES=
|
||||
tasmx /t /dnofstack /d%1 /d%2 /d%3 /d%4 /d%5 /d%6 kernel.asm
|
||||
tlink /t kernel
|
||||
kernel.com - 1 fload EXTEND save FORTH-C.EXE bye
|
||||
tasmx /l /t /d%1 /d%2 /d%3 /d%4 /d%5 /d%6 kernel.asm
|
||||
tlink /t kernel
|
||||
kernel.com - 1 fload EXTEND save FORTH-F.EXE bye
|
||||
forth-f - checking off forget -FP checking on 1 fload EXTEND save FORTH.EXE bye
|
||||
forth-f - 1 fload SED aka sed EDIT save DX.EXE bye
|
||||
del kernel.obj
|
||||
del kernel.map
|
5
DX-FORTH v430/MAKEF87.BAT
Normal file
5
DX-FORTH v430/MAKEF87.BAT
Normal file
@ -0,0 +1,5 @@
|
||||
forth F87D 1 load bye
|
||||
forth F87DS 1 load bye
|
||||
forth F87S 1 load bye
|
||||
forth F87X 1 load bye
|
||||
copy /y f87d.exe F87.EXE
|
1
DX-FORTH v430/MISC.SCR
Normal file
1
DX-FORTH v430/MISC.SCR
Normal file
File diff suppressed because one or more lines are too long
1
DX-FORTH v430/MISER.SCR
Normal file
1
DX-FORTH v430/MISER.SCR
Normal file
File diff suppressed because one or more lines are too long
1
DX-FORTH v430/MULTI.SCR
Normal file
1
DX-FORTH v430/MULTI.SCR
Normal file
File diff suppressed because one or more lines are too long
306
DX-FORTH v430/MULTI.TXT
Normal file
306
DX-FORTH v430/MULTI.TXT
Normal file
@ -0,0 +1,306 @@
|
||||
DX-Forth Multitasker
|
||||
--------------------
|
||||
|
||||
1. Introduction
|
||||
2. Multitasking words
|
||||
3. Design considerations
|
||||
4. Semaphores
|
||||
5. Messages
|
||||
6. A multitasking example
|
||||
7. Turnkey applications
|
||||
8. Task Control Block
|
||||
|
||||
|
||||
1. Introduction
|
||||
|
||||
A co-operative multitasker MULTI.SCR is provided with DX-Forth
|
||||
allowing several tasks to run concurrently within an application.
|
||||
|
||||
Each task has its own stacks, user variables and (if required)
|
||||
PAD and HOLD buffer. Tasks are linked in a 'round-robin' loop
|
||||
with switching occuring on each encounter of PAUSE.
|
||||
|
||||
2. Multitasking words
|
||||
|
||||
TCB ( u s r "ccc" -- ) compiling
|
||||
( -- tcb ) run-time
|
||||
|
||||
Create a task control block named ccc. u s r is the number
|
||||
of bytes reserved for the task's user area, data and return
|
||||
stacks respectively. The task is initially put to sleep.
|
||||
When ccc is executed, the address of the task control block
|
||||
is placed on the data stack.
|
||||
|
||||
See: ACTIVATE
|
||||
|
||||
ACTIVATE ( tcb -- )
|
||||
|
||||
Initialize the stacks and wake task tcb. Task execution
|
||||
begins with the word following ACTIVATE. ACTIVATE must be
|
||||
used inside a definition.
|
||||
|
||||
HIS ( tcb user -- user' )
|
||||
|
||||
Get address of user variable belonging to task tcb.
|
||||
|
||||
PAUSE ( -- )
|
||||
|
||||
Save the current task state and pass control to the next
|
||||
active task.
|
||||
|
||||
STOP ( -- )
|
||||
|
||||
Put the current task to sleep and switch to next active
|
||||
task.
|
||||
|
||||
WAKE ( tcb -- )
|
||||
|
||||
Resume the task identified by tcb.
|
||||
|
||||
SLEEP ( tcb -- )
|
||||
|
||||
Suspend the task identified by tcb.
|
||||
|
||||
SINGLE ( -- )
|
||||
|
||||
Disable the multitasker. Only the current task remains
|
||||
active.
|
||||
|
||||
MULTI ( -- )
|
||||
|
||||
Enable the multitasker.
|
||||
|
||||
Note: MULTI does not enable individual tasks. See
|
||||
ACTIVATE.
|
||||
|
||||
GRAB ( sem -- )
|
||||
|
||||
Obtain the resource identified by the semaphore variable.
|
||||
If owned by another task, repeatedly execute PAUSE until
|
||||
the resource becomes available.
|
||||
|
||||
GET ( sem -- )
|
||||
|
||||
Same as GRAB but performs an initial PAUSE.
|
||||
|
||||
RELEASE ( sem -- )
|
||||
|
||||
Release the resource identified by the semaphore variable.
|
||||
If the resource is owned by another task, do nothing.
|
||||
|
||||
/TASKER ( -- )
|
||||
|
||||
Initialize the multitasker links. TURNKEYed applications
|
||||
must execute /TASKER before launching the multitasker.
|
||||
|
||||
#FLOAT ( -- u )
|
||||
|
||||
A VALUE returning the size in bytes of the separate floating
|
||||
point stack to be assigned for each task. #FLOAT is preset
|
||||
to the system default value but may be changed prior to
|
||||
executing TCB.
|
||||
|
||||
3. Design considerations
|
||||
|
||||
3.1 Data and return stacks
|
||||
|
||||
Sufficient data and return stack space must be allocated for each
|
||||
task. Inadequate stack can cause mysterious crashes or unexpected
|
||||
behaviour and can be difficult to trace. It is usually better to
|
||||
start with larger stack sizes during development and reduce it
|
||||
once the application is fully debugged.
|
||||
|
||||
Note: Task switching consumes 3 cells (6 bytes) of data stack and
|
||||
must be included when calculating task data stack allocation. If
|
||||
the task uses floating point on the data stack this must be
|
||||
included also.
|
||||
|
||||
3.2 PAD and HOLD buffer
|
||||
|
||||
Tasks are not automatically alloted a PAD or HOLD buffer. If a
|
||||
PAD or HOLD buffer is required it must be allocated by assigning
|
||||
extra space to the data stack. When defining a task control block,
|
||||
use the following calculation:
|
||||
|
||||
s (bytes) = task data stack requirement +
|
||||
HOLD buffer size (default 68 bytes) +
|
||||
PAD size required
|
||||
|
||||
Tasks that display numbers or use the pictured numeric operators
|
||||
<# ... #> HOLD etc. will require a HOLD buffer. If a task requires
|
||||
PAD then a HOLD buffer (default 68 bytes) must also be provided.
|
||||
|
||||
3.3 USER area
|
||||
|
||||
The size of a task user area should be at least #USER bytes. Tasks
|
||||
may begin defining their per-task user variables at offset #USER.
|
||||
|
||||
3.4 Floating-point
|
||||
|
||||
If a separate floating-point system is detected, each task is
|
||||
automatically allocated an f/p stack. The size of the f/p stack
|
||||
is determined by #FLOAT. If a task performs no floating-point
|
||||
then #FLOAT may be set to zero.
|
||||
|
||||
3.5 PAUSE
|
||||
|
||||
Each active task is required to PAUSE to give other tasks a chance
|
||||
to execute. In DX-Forth PAUSE is automatically performed by KEY?
|
||||
KEY EMIT TYPE and MS. If a task does not perform any of these
|
||||
function (or does so infrequently) then a PAUSE must be explicitly
|
||||
included in the program.
|
||||
|
||||
3.6 Other
|
||||
|
||||
Tasks are typically defined as an infinite loop e.g. within a BEGIN
|
||||
AGAIN construct. If a task needs to terminate, use STOP.
|
||||
|
||||
Tasks should not assume the initial contents of a user variable e.g.
|
||||
a task which uses BASE directly or indirectly must explicitly set
|
||||
BASE to the required number radix.
|
||||
|
||||
To build a multitasking application, load MULTI.SCR from your
|
||||
application. TURNKEY applications must execute /TASKER before
|
||||
starting the multitasker.
|
||||
|
||||
During testing, do not FORGET tasks. Instead use COLD and reload
|
||||
the application. Do not use SAVE or TURNKEY while the multitasker
|
||||
is active.
|
||||
|
||||
4. Semaphores
|
||||
|
||||
Semaphores are used to prevent conflicts that may arise when
|
||||
several tasks access a common resource. In DX-Forth a semaphore
|
||||
is simply a VARIABLE with the contents initialized to zero.
|
||||
|
||||
Consider the case when two tasks send output to the screen. Since
|
||||
PAUSE is built into EMIT this would result in a jumbled display.
|
||||
A solution is to enclose the display routine with SINGLE and MULTI.
|
||||
While this would work it has the disadvantage that the multitasker
|
||||
is disabled for all other tasks while printing takes place.
|
||||
|
||||
A better way is with semaphores. A semaphore is a variable which
|
||||
signals whether a resource is available.
|
||||
|
||||
In the example below, tasks which display to the screen GET the
|
||||
resource making it unavailable to other tasks. When the task has
|
||||
finished with the screen it is RELEASEd. Tasks waiting for a
|
||||
resource automatically PAUSE until the resource becomes available.
|
||||
|
||||
GET GRAB RELEASE are modelled after the Forth Inc. functions of
|
||||
the same name.
|
||||
|
||||
VARIABLE SCREEN \ create a resource for the screen
|
||||
SCREEN OFF \ mark screen as available
|
||||
|
||||
\ TASK1
|
||||
...
|
||||
SCREEN GET
|
||||
10 10 AT-XY ." Task 1"
|
||||
SCREEN RELEASE
|
||||
...
|
||||
|
||||
\ TASK2
|
||||
...
|
||||
SCREEN GET
|
||||
50 10 AT-XY ." Task 2"
|
||||
SCREEN RELEASE
|
||||
...
|
||||
|
||||
\ TASK3
|
||||
...
|
||||
|
||||
5. Messages
|
||||
|
||||
Messages (also known as mailboxes) provide a way of passing data
|
||||
between tasks. The following is an example of a simple message
|
||||
system. While 16 bit data is assumed, the concept can be expanded
|
||||
to pass data of any type or size - strings, CP/M records etc.
|
||||
|
||||
\ Define a message variable
|
||||
CREATE <name> ( -- addr )
|
||||
0 , \ flag 0=empty
|
||||
1 CELLS ALLOT \ storage space
|
||||
|
||||
\ Send message
|
||||
: SEND ( x addr -- )
|
||||
BEGIN PAUSE DUP @ 0= UNTIL DUP ON CELL+ ! ;
|
||||
|
||||
\ Receive message
|
||||
: RECEIVE ( addr -- x )
|
||||
BEGIN PAUSE DUP @ UNTIL DUP OFF CELL+ @ ;
|
||||
|
||||
6. A Multitasking Example
|
||||
|
||||
This simple example that shows how to write a task, launch it, turn
|
||||
it on and off, disable it and the multitasker altogether.
|
||||
|
||||
First load the multitasker system:
|
||||
|
||||
USING MULTI.SCR 1 LOAD
|
||||
|
||||
Create a task by entering the following definitions:
|
||||
|
||||
VARIABLE COUNTS
|
||||
|
||||
#USER 32 32 TCB COUNTING
|
||||
|
||||
: COUNTER ( -- )
|
||||
COUNTING ACTIVATE
|
||||
BEGIN PAUSE 1 COUNTS +! AGAIN ;
|
||||
|
||||
: X ( -- ) COUNTS @ U. ;
|
||||
|
||||
We have created a task block called COUNTING and reserved #USER
|
||||
bytes of user area and 32 bytes each for data and return stacks.
|
||||
Since the task won't be outputting numbers or need a PAD we
|
||||
haven't allocated any space for them.
|
||||
|
||||
The definition COUNTER embodies both the task initialization and
|
||||
its action. COUNTING ACTIVATE resets the task stacks and wakes it.
|
||||
Task execution begins with the word immediately following ACTIVATE.
|
||||
|
||||
Our example task is very simple - it simply increments the value
|
||||
held in COUNTS. Since the task is defined as an endless loop,
|
||||
COUNTS will update automatically whenever the task is in control.
|
||||
Note there is a PAUSE within the loop - this is important as it
|
||||
allows other tasks a chance to execute.
|
||||
|
||||
Should we want COUNTER to run once or stop looping after some
|
||||
event, a STOP can be included in the definition.
|
||||
|
||||
The following shows how to start and control COUNTER. You may
|
||||
type X at any time to see whether the task is running.
|
||||
|
||||
To control the task we can use:
|
||||
|
||||
MULTI ( start the multitasker )
|
||||
COUNTER ( start our task )
|
||||
|
||||
COUNTING SLEEP ( put the task to sleep )
|
||||
COUNTING WAKE ( wake the task again )
|
||||
|
||||
SINGLE ( stop the multitasker )
|
||||
MULTI ( restart the multitasker again )
|
||||
|
||||
7. Turnkey applications
|
||||
|
||||
It is important that /TASKER is executed by turnkey applications
|
||||
before the multitasker is invoked.
|
||||
|
||||
8. Task Control Block
|
||||
|
||||
R0 ;----------------------
|
||||
; return stack
|
||||
FS0 ;----------------------
|
||||
; fp-stack (if used)
|
||||
S0 ;----------------------
|
||||
; data stack
|
||||
;----------------------
|
||||
; PAD buffer (if used)
|
||||
PAD ;----------------------
|
||||
; HOLD buffer (if used)
|
||||
HERE ;----------------------
|
||||
; user variables
|
||||
tcb ;----------------------
|
||||
|
1
DX-FORTH v430/NEWAPP.SCR
Normal file
1
DX-FORTH v430/NEWAPP.SCR
Normal file
File diff suppressed because one or more lines are too long
160
DX-FORTH v430/NEWAPP.TXT
Normal file
160
DX-FORTH v430/NEWAPP.TXT
Normal file
@ -0,0 +1,160 @@
|
||||
|
||||
NEWAPP and DOSLIB
|
||||
|
||||
*** IMPORTANT ***
|
||||
|
||||
NEWAPP.SCR and DOSLIB.SCR are subject to change (really!) There is
|
||||
no guarantee - or intent - that future versions will remain backward
|
||||
compatible. When backing up or distributing application source code
|
||||
that uses DOSLIB.SCR, it is important to include a copy as later
|
||||
versions of DOSLIB may no longer be compatible.
|
||||
|
||||
Introduction
|
||||
|
||||
NEWAPP is a skeletal program that allows users to quickly develop a
|
||||
DOS application. It provides often needed tasks including error
|
||||
handling, command-line parsing, file operations, buffered I/O, help
|
||||
screen, number and string functions.
|
||||
|
||||
NEWAPP comprises two parts:
|
||||
|
||||
NEWAPP.SCR skeletal main program
|
||||
DOSLIB.SCR function library
|
||||
|
||||
NEWAPP is supplied as a functioning program which may be turnkeyed.
|
||||
Styled as a typical DOS command-line application it demonstrates
|
||||
how the various tasks are integrated to form a functioning program.
|
||||
Making NEWAPP perform a useful task can be as easy as adding one
|
||||
line. In this instance it is line 6 of the definition (RUN) which
|
||||
turns NEWAPP into a simple filecopy utility.
|
||||
|
||||
DOSLIB is a library of Forth and DOS functions in source form.
|
||||
While the primary role is support for NEWAPP, DOSLIB may be used
|
||||
by any application. DOSLIB is organized as named modules.
|
||||
1 FLOAD DOSLIB causes the names of all the modules contained in
|
||||
DOSLIB to be loaded into the dictionary. Executing the name of a
|
||||
module causes the corresponding code to be loaded into memory.
|
||||
NEWAPP automatically loads DOSLIB and a default set of modules.
|
||||
|
||||
New users are encouraged to examine and understand how NEWAPP works
|
||||
before attempting to create their own application. The following
|
||||
notes should help with some of the less obvious aspects. Unless
|
||||
otherwise stated all screen references refer to NEWAPP.SCR.
|
||||
|
||||
First, an explanation of the function +IS which is used by NEWAPP.
|
||||
+IS is similar to IS but instead of replacing the existing behaviour
|
||||
of a DEFERed word, it chains in a new action. When the deferred word
|
||||
is eventually executed, all actions in the chain will be performed
|
||||
beginning with the most recently added.
|
||||
|
||||
1. Setting the options
|
||||
|
||||
Screen 1 defines the title of the program, version, date and name
|
||||
for the turnkey executable.
|
||||
|
||||
The programmer may optionally specify the upper limit of memory for
|
||||
turnkey applications (Screen 1 line 10). This is useful for
|
||||
environments where memory is limited. The calculation includes 256
|
||||
bytes for PAD and data stack, plus any RESERVE bytes tallied at
|
||||
compile-time. Typically RESERVE holds the total number of bytes the
|
||||
program will ALLOT or otherwise need at run-time. By default LIMIT
|
||||
is set to the maximum available memory i.e. the compiler's top of
|
||||
memory address (usually $FFF0 for MS-DOS or CCP/BDOS base for CP/M).
|
||||
|
||||
Screen 2 loads the remainder of the application. It also defines
|
||||
and sets the action for several deferred words which are explained
|
||||
below.
|
||||
|
||||
ONSTART is a deferred word. Its function is to perform any system
|
||||
initialization that may be required before the application begins.
|
||||
Typically these will be "run once" tasks such as alloting buffers
|
||||
or initializing memory management functions. Actions are added to
|
||||
ONSTART via +IS.
|
||||
|
||||
SET-IO is a deferred word that sets the console input/output method.
|
||||
By default SET-IO is set to BIOS-IO. Users needing DOS console I/O
|
||||
redirection can do so either by selectively surrounding words with
|
||||
DOS-IO ... SET-IO pairs or by uncommenting the line:
|
||||
' DOS-IO IS SET-IO.
|
||||
|
||||
The DOSLIB disk read/write routines include a keyboard test. If
|
||||
ESC CTRL-C or CTRL-BREAK keys are detected, the user is given an
|
||||
opportunity to abort the program. The feature may be disabled by
|
||||
commenting out the line: ' (?BREAK) IS ?BREAK.
|
||||
|
||||
ONERROR is the application's top-level error handler. It intercepts
|
||||
exceptions before the system's error handler deals with it. ONERROR
|
||||
permits the application to perform any necessary 'clean-up' tasks
|
||||
before aborting.
|
||||
|
||||
ONERROR is a deferred word whose action is modified with +IS. An
|
||||
example is the DOSLIB 'files' module which extends ONERROR to
|
||||
automatically close the default files should an error occur.
|
||||
|
||||
Note: If a function performed by ONERROR itself generates an exception
|
||||
then the original exception that caused ONERROR to execute is likely
|
||||
to be masked.
|
||||
|
||||
2. Loading DOSLIB modules
|
||||
|
||||
Screen 3 of NEWAPP.SCR initializes the DOSLIB library then proceeds
|
||||
to load the named modules. This screen contains the support modules
|
||||
typically needed by NEWAPP based applications. If your application
|
||||
does not require a particular module and you wish to conserve space,
|
||||
then you may comment out the line on which the module's name appears.
|
||||
|
||||
3. Default files
|
||||
|
||||
The default files module simplifies much of the drudgery associated
|
||||
with file handling e.g. display of filenames when opening, overwrite
|
||||
checking, error messages when reading or writing files etc.
|
||||
|
||||
One input and one output file are supported which is sufficient for
|
||||
most applications. The usual file read/write functions are provided
|
||||
including file position and reposition. Output file overwrite
|
||||
checking is enabled by default. It may be turned off by uncommenting
|
||||
the line: WRTCHK OFF on screen 2.
|
||||
|
||||
When an application aborts as a result of a fatal error, the default
|
||||
files will be automatically flushed and closed. If it is desired to
|
||||
delete the default output file, it can be done by uncommenting the
|
||||
line on screen 2: ' DELOUTFILE +IS ONERROR
|
||||
|
||||
FLUSHWRITE is an optional function that works similarly to FLUSH-FILE.
|
||||
Data written to the default output file is forced to disk updating
|
||||
the directory. Buffered output, if loaded, is also flushed.
|
||||
|
||||
4. Buffered files
|
||||
|
||||
This is an optional extension to the default files and allows reading
|
||||
and writing one character at a time. For speed buffers are used to
|
||||
hold the data. Buffer refill and flushing is automatic and requires
|
||||
no user intervention. The default buffer size is 512 bytes and is
|
||||
given by /INBUF /OUTBUF respectively. Normally the buffers are
|
||||
allocated at compile-time but this can be changed to run-time if
|
||||
desired.
|
||||
|
||||
Example: Allocate the buffered output file at run-time and change
|
||||
the buffer size to 1024 bytes.
|
||||
|
||||
Make the following changes to the copy of NEWAPP.SCR that will be
|
||||
your application.
|
||||
|
||||
Step 1. Disable compile-time buffer allocation by setting /OUTFILE
|
||||
to zero prior to executing _Bufoutfile.
|
||||
|
||||
( Screen 3 Line 13)
|
||||
0 to /OUTFILE _Bufoutfile \ buffered output file
|
||||
|
||||
Step 2. Initialize output buffer at run-time by creating a word to
|
||||
perform the task and appending it to deferred word ONSTART.
|
||||
|
||||
( Screen 2 Line 13)
|
||||
:noname ( -- ) #1024 to /OUTFILE here to OUTFILE
|
||||
/OUTFILE allot resetoutbuf ; +is ONSTART
|
||||
|
||||
Note: Applications may apply this technique to any large buffer used
|
||||
by the program. It is useful for keeping turnkey executables small
|
||||
and/or allocating buffers greater than would fit in memory at compile-
|
||||
time.
|
||||
|
1
DX-FORTH v430/OBSOLETE.SCR
Normal file
1
DX-FORTH v430/OBSOLETE.SCR
Normal file
File diff suppressed because one or more lines are too long
19
DX-FORTH v430/OBSOLETE.TXT
Normal file
19
DX-FORTH v430/OBSOLETE.TXT
Normal file
@ -0,0 +1,19 @@
|
||||
A note for users upgrading from previous versions of DX-Forth
|
||||
-------------------------------------------------------------
|
||||
|
||||
Changes and improvements to DX-Forth may occasionally result in
|
||||
compatibility issues with previous application software.
|
||||
|
||||
Usually the problem takes the form of an application either not
|
||||
loading successfully or (less common) not running - despite its
|
||||
compiling and running correctly on a previous version of DX-Forth.
|
||||
|
||||
For the first case, the user should try loading OBSOLETE.SCR before
|
||||
loading the application. In most cases this will fix the problem.
|
||||
OBSOLETE.SCR contains functions that once existed in DX-Forth but
|
||||
were removed due to obsolescence.
|
||||
|
||||
Should the application compile but fail to execute correctly then
|
||||
the incompatibility is likely to be more subtle. In this instance
|
||||
one should read CHANGES.TXT to ascertain what function behaviours
|
||||
have changed since the application was originally developed.
|
1
DX-FORTH v430/OVERLAY.SCR
Normal file
1
DX-FORTH v430/OVERLAY.SCR
Normal file
File diff suppressed because one or more lines are too long
1
DX-FORTH v430/SED.SCR
Normal file
1
DX-FORTH v430/SED.SCR
Normal file
File diff suppressed because one or more lines are too long
152
DX-FORTH v430/SED.TXT
Normal file
152
DX-FORTH v430/SED.TXT
Normal file
@ -0,0 +1,152 @@
|
||||
Full-Screen Editor for DX-FORTH
|
||||
-------------------------------
|
||||
|
||||
*** IMPORTANT ***
|
||||
|
||||
After editing a screen, Ctrl-K must be pressed to UPDATE
|
||||
the changes. This is a safeguard as there is no backup
|
||||
copy of the source file being editing. Until Ctrl-K is
|
||||
pressed, the screen may be restored to its previous state
|
||||
using Ctrl-L.
|
||||
|
||||
|
||||
INSTALLATION:
|
||||
|
||||
DX-FORTH for CP/M must be configured for your terminal before
|
||||
using the full screen editor. See DX-FORTH.TXT for further
|
||||
details.
|
||||
|
||||
|
||||
INVOKING:
|
||||
|
||||
The screen editor is invoked typing SED. If the editor is not
|
||||
resident it is automatically loaded from the disk file SED.SCR.
|
||||
|
||||
If you mainly use screen files you may want to add EDIT as a
|
||||
synonym for SED e.g. AKA SED EDIT
|
||||
|
||||
DX (COM or EXE) comes pre-loaded with the screen editor.
|
||||
|
||||
|
||||
COMMANDS:
|
||||
|
||||
SED ( n | -- )
|
||||
|
||||
Enter the full screen editor, selecting screen n for
|
||||
editing. If no screen number is specified, then the screen
|
||||
last LISTed is used or, in the case a LOAD error, the screen
|
||||
and position where the error occured.
|
||||
|
||||
Note: If the screen number is out of range, then the highest
|
||||
screen available is used. If the size of the screen file
|
||||
was zero when EDIT was called, it will be extended by one
|
||||
block.
|
||||
|
||||
L ( -- ) List
|
||||
|
||||
Lists the current screen. The screen number is obtained
|
||||
from the variable SCR which is set by LIST, EDIT or when a
|
||||
LOAD error occurs.
|
||||
|
||||
N ( -- ) Next
|
||||
|
||||
Increment the screen number in variable SCR then list it.
|
||||
|
||||
B ( -- ) Back
|
||||
|
||||
Decrement the screen number in variable SCR then list it.
|
||||
|
||||
LS ( -- ) List Swap
|
||||
|
||||
Perform SWAP-FILE and list the screen specified by SCR.
|
||||
|
||||
|
||||
EDITOR COMMANDS:
|
||||
|
||||
1. Cursor movement
|
||||
|
||||
Ctrl-E Move cursor up
|
||||
Ctrl-X Move cursor down
|
||||
Ctrl-D Move cursor right
|
||||
Ctrl-S Move cursor left
|
||||
Ctrl-I Move cursor 4 places to the right (TAB)
|
||||
Ctrl-Q Move cursor to the upper left of the screen
|
||||
|
||||
2. Editing
|
||||
|
||||
Ctrl-G Delete character to the right of the cursor
|
||||
Ctrl-H Delete character to the left of the cursor
|
||||
Ctrl-T Erase all characters to the right of the cursor
|
||||
Ctrl-O Insert space at the current cursor position
|
||||
Ctrl-Y Delete the current line. Lines below cursor are moved
|
||||
up one position. Pop a line from circular buffer into
|
||||
the bottom line
|
||||
Ctrl-N Insert blank line. Lines below cursor are moved down
|
||||
one position. Push bottom line to the circular buffer
|
||||
Ctrl-W Split the current line at the cursor position
|
||||
Ctrl-F Join the next line at the cursor position
|
||||
Ctrl-A Copy the contents of the current line to the one-line
|
||||
buffer
|
||||
Ctrl-P Copy the contents of the one-line buffer to the
|
||||
current line
|
||||
Ctrl-K Update all changes made to the screen
|
||||
|
||||
3. Miscellaneous
|
||||
|
||||
Ctrl-C Move to the next screen
|
||||
Ctrl-R Move to the previous screen
|
||||
Ctrl-J Jump to another screen
|
||||
Ctrl-B Redraw the screen. Used if the screen has become
|
||||
garbled e.g. after displaying blocks containing binary
|
||||
data
|
||||
Ctrl-L Reload the current file block
|
||||
Ctrl-V Toggle between insert or overwrite mode
|
||||
Ctrl-U Exit the editor
|
||||
Ctrl-Z Multi-function command
|
||||
S - clear the screen contents
|
||||
B - clear the circular buffer contents
|
||||
I - insert a blank screen at the current position
|
||||
D - delete the current screen copying it to the buffer
|
||||
ESC Toggle between normal and graphics mode
|
||||
|
||||
4. Utilities
|
||||
|
||||
The following commands are available from the EDITOR vocabulary
|
||||
|
||||
IMPORT ( n1 n2 -- )
|
||||
|
||||
Copy screens n1 thru n2 from the secondary file inserting
|
||||
them beginning at screen SCR of the current file.
|
||||
|
||||
EXPORT ( n1 n2 -- )
|
||||
|
||||
Copy screens n1 thru n2 from the current file inserting
|
||||
them beginning at screen SCR of the secondary file.
|
||||
|
||||
IMPORT and EXPORT assume two screen files are currently open
|
||||
and SCR of the target file has been set (SCR may be viewed with
|
||||
FYI). After the operation, target SCR is set to the last block
|
||||
written plus 1.
|
||||
|
||||
5. Notes
|
||||
|
||||
In the DOS version of the editor, the arrows keys, PgUp, PgDn,
|
||||
Home, Insert and Delete keys may be used in addition to the
|
||||
usual control-key sequences.
|
||||
|
||||
COPY COPIES EXPAND (found in earlier versions of the editor)
|
||||
are redundant as the ability to insert or delete screens is now
|
||||
available from Ctrl-Z.
|
||||
|
||||
To extend a screenfile, enter EDIT then jump to the desired
|
||||
screen number using Ctrl-J. Alternatively, truncating/
|
||||
extending a screenfile may also be done from the Forth
|
||||
environment using FILEBLOCKS.
|
||||
|
||||
A special graphics mode has been added. It is toggled via the
|
||||
ESC key and allows graphic characters to be entered from the
|
||||
keyboard. It is intended to allow the insertion of PC symbols
|
||||
or graphic characters into quoted strings. Refer to
|
||||
DX-FORTH.TXT for a table of keys and their corresponding codes.
|
||||
To exit graphics mode, press ESC again.
|
||||
|
1
DX-FORTH v430/SHOW.SCR
Normal file
1
DX-FORTH v430/SHOW.SCR
Normal file
File diff suppressed because one or more lines are too long
17
DX-FORTH v430/SIEVE.F
Normal file
17
DX-FORTH v430/SIEVE.F
Normal file
@ -0,0 +1,17 @@
|
||||
8190 CONSTANT SIZE
|
||||
VARIABLE FLAGS SIZE ALLOT
|
||||
|
||||
: SIEVE
|
||||
." primes 10 iterations: "
|
||||
10 0 DO
|
||||
FLAGS SIZE -1 FILL
|
||||
0 SIZE 0 DO
|
||||
I FLAGS + C@ IF
|
||||
I 2 * 3 + DUP I + BEGIN
|
||||
DUP SIZE < WHILE
|
||||
DUP FLAGS + 0 SWAP C! OVER +
|
||||
REPEAT DROP DROP 1+
|
||||
THEN LOOP
|
||||
LOOP
|
||||
. ;
|
||||
|
1
DX-FORTH v430/SSED.SCR
Normal file
1
DX-FORTH v430/SSED.SCR
Normal file
@ -0,0 +1 @@
|
||||
\ SED Turns DX-Forth screen editor into a stand-alone utility \ Load screen empty forth definitions decimal system checking off forget -TASK [defined] -FP [if] forget -FP [then] checking on 1 fload SED : PROGRAM ( -- ) cmdtail 'source 2! using cr ." Forth Screen Editor" cr ." type CTRL-U to exit " key drop 0 sed close ; turnkey-system program SED bye
|
1
DX-FORTH v430/STKCHK.SCR
Normal file
1
DX-FORTH v430/STKCHK.SCR
Normal file
@ -0,0 +1 @@
|
||||
\ Stack Balance Checking Utility Helps locate words which should be stack-neutral but aren't! Use: place [S S] around the words you wish to test for balance e.g. BEGIN [S ... S] AGAIN Use as many [S S] pairs as needed. Should the stack level change at run-time, the application will stop and display the screen number where the offending definition was compiled. Nesting to 16 levels is allowed. CREATE csd 0 C, 16 CELLS ALLOT \ stack depth array : [S ( -- ) DEPTH csd COUNT 1+ 15 AND DUP csd C! CELLS + ! ; : [s] ( blk -- ) DUP SCR ! >R DEPTH csd COUNT DUP 1- csd C! CELLS + @ - IF PAGE ." Stack changed: Scr# = " R@ . CR QUIT THEN R> DROP ; : S] ( -- ) BLK @ POSTPONE LITERAL POSTPONE [s] ; IMMEDIATE
|
1
DX-FORTH v430/STRINGS.SCR
Normal file
1
DX-FORTH v430/STRINGS.SCR
Normal file
File diff suppressed because one or more lines are too long
451
DX-FORTH v430/TED.F
Normal file
451
DX-FORTH v430/TED.F
Normal file
@ -0,0 +1,451 @@
|
||||
\ TED.F
|
||||
\
|
||||
\ TED - A Tiny Text Editor for DX-Forth
|
||||
\
|
||||
\ Based on the HT-68K editor by J.Bartel
|
||||
\
|
||||
\ The HELP screen is only compiled for the
|
||||
\ turnkey version
|
||||
\
|
||||
\ ^E Up cursor ^R Prev page
|
||||
\ ^X Down cursor ^C Next page
|
||||
\ ^D Right cursor ^G Del next char
|
||||
\ ^S Left cursor ^H Del prev char
|
||||
\ ^L Restore line ^M New line
|
||||
\ ^T Erase to EOL ^Y Delete line
|
||||
\ ^U Exit editor ^Z Function
|
||||
\ ^ZC Clear text ^ZH Help
|
||||
\ ^ZR Read file ^ZW Write file
|
||||
\
|
||||
\ Revision
|
||||
\ 2016-09-25 es updated for DX-Forth
|
||||
\ 2015-06-03 es specify a filename
|
||||
\ 2015-12-09 es join lines with ^G or DEL
|
||||
\ 2017-01-25 es replace EXIT THEN with END
|
||||
|
||||
forth definitions decimal
|
||||
|
||||
0 \ true for turnkey
|
||||
|
||||
( *) dup [if] application [then]
|
||||
|
||||
cr .( loading TED Text Editor )
|
||||
|
||||
\ Running DX-Forth for CP/M or DOS ?
|
||||
: CPM? ( -- f ) $111 @ $4683 = ;
|
||||
|
||||
[undefined] ZCOUNT [if]
|
||||
: ZCOUNT ( a -- a u ) dup -1 0 scan drop over - ;
|
||||
[then]
|
||||
|
||||
[undefined] ZPLACE [if]
|
||||
: ZPLACE ( a -- a u ) 2dup + >r swap cmove 0 r> c! ;
|
||||
[then]
|
||||
|
||||
[undefined] PACK [if]
|
||||
: PACK ( a u a2 -- a2 ) dup >r place r> ;
|
||||
[then]
|
||||
|
||||
[undefined] TOKEN [if]
|
||||
: TOKEN ( "name" -- c-addr u ) bl word count ;
|
||||
[then]
|
||||
|
||||
\ Video terminal specific
|
||||
|
||||
79 value XMAX \ #columns - 1
|
||||
24 value YMAX \ #rows - 1
|
||||
|
||||
\ INSERT-LINE ( -- ) insert blank line at cursor;
|
||||
\ remaining rows scroll down
|
||||
\ DELETE-LINE ( -- ) delete line at cursor;
|
||||
\ remaining rows scroll up
|
||||
\ CLEAR-LINE ( -- ) blank from cursor to end of line
|
||||
|
||||
\ pointer operations
|
||||
: 1+! ( a -- ) 1 swap +! ;
|
||||
: 1-! ( a -- ) -1 swap +! ;
|
||||
: C@+ ( a -- c ) dup @ c@ swap 1+! ;
|
||||
: C!+ ( c a -- ) tuck @ c! 1+! ;
|
||||
: -C@ ( a -- c ) dup 1-! @ c@ ;
|
||||
: -C! ( c a -- ) dup 1-! @ c! ;
|
||||
|
||||
\ max line length
|
||||
132 constant COLS
|
||||
|
||||
0 value YBOT \ edit bottom row
|
||||
0 value BUF \ edit buffer addr
|
||||
0 value BUFE \ edit buffer end + 1
|
||||
0 value TBUF \ text buffer addr
|
||||
0 value LINES \ line count
|
||||
0 value MEM \ top of memory
|
||||
0 value FNAM \ filename buffer addr
|
||||
0 value FID \ file handle
|
||||
|
||||
variable COL \ current column#
|
||||
variable LIN \ current line#
|
||||
variable LADR \ current line addr
|
||||
variable LTOP \ absolute line# at top of screen
|
||||
variable LPOS \ current line# relative to top of screen
|
||||
variable BPOS \ address of char in edit buffer
|
||||
variable NXT \ next free addr in text (contains 0)
|
||||
variable UPD \ edit buffer change flag
|
||||
variable XF \ quit flag
|
||||
|
||||
: UKEY ( -- c ) key upcase ;
|
||||
: LMAX ( -- n ) lines 1- 0 max ;
|
||||
: GOXY ( x y -- ) 1+ at-xy ;
|
||||
: CXY ( -- ) col @ XMAX min lpos @ goxy ;
|
||||
: MSG ( -- ) 0 0 at-xy clear-line ;
|
||||
: CHGD ( -- ) upd on ;
|
||||
|
||||
: CONT ( -- ) xf off
|
||||
." Press a key to continue " key drop ;
|
||||
|
||||
: .FIL ( -- ) fnam count 20 min type ;
|
||||
|
||||
: .POS ( -- )
|
||||
13 0 at-xy lin @ 1+ u.
|
||||
22 0 at-xy col @ 1+ u. cxy ;
|
||||
|
||||
: .HD ( -- ) msg 10 0 at-xy
|
||||
[ dup ] [if]
|
||||
." Ln Cl ^ZH Help File "
|
||||
[else]
|
||||
." Ln Cl File "
|
||||
[then]
|
||||
.fil .pos ;
|
||||
|
||||
: .ERR ( a u -- ) msg .fil space space type cont .hd ;
|
||||
|
||||
: SURE? ( a u -- f )
|
||||
msg type ." Are you sure? " ukey [char] Y = ;
|
||||
|
||||
: LINE ( -- a u ) ladr @ zcount ;
|
||||
|
||||
: .LINE ( -- ) line XMAX 1+ min type ;
|
||||
|
||||
: .RT ( -- ) \ display string right of cursor
|
||||
bpos @ bufe over - XMAX 1+ bpos @ buf - - min type ;
|
||||
|
||||
: ROOM? ( -- f ) bufe 1- c@ bl = ;
|
||||
|
||||
: LINE@ ( -- lin adr ) lin @ ladr @ ;
|
||||
: LINE! ( lin adr -- ) ladr ! lin ! ;
|
||||
|
||||
: GOTOP ( -- ) tbuf ladr ! lin off ;
|
||||
|
||||
: CURTOP ( -- )
|
||||
gotop ltop off col off lpos off ;
|
||||
|
||||
\ clear text, filename, reset cursor
|
||||
: -TXT ( -- ) tbuf dup 1- 3 erase ( nulls )
|
||||
1+ nxt ! 1 to lines 0 fnam c! curtop ;
|
||||
|
||||
: SETUP ( -- )
|
||||
[ cpm? ] [if]
|
||||
$168 c@ 1- to XMAX
|
||||
$169 c@ 1- dup to YMAX 2- to YBOT
|
||||
[else]
|
||||
get-window ( x1 y1 x2 y2 )
|
||||
rot - dup to YMAX 2- to YBOT
|
||||
swap - to XMAX
|
||||
[then]
|
||||
application here unused + to mem pad 80 +
|
||||
dup to fnam 80 + dup to buf COLS + dup to bufe
|
||||
2+ dup to tbuf mem u> abort" no space" -txt ;
|
||||
|
||||
: INSC ( c -- ) \ insert char in buf
|
||||
bpos @ dup 1+ bufe over - 1+ cmove>
|
||||
bpos c!+ ;
|
||||
|
||||
: LU ( -- ) \ go up one line in text
|
||||
lin 1-!
|
||||
ladr dup 1-! begin dup -c@ 0= until 1+! ;
|
||||
|
||||
: LD ( -- ) \ go down one line in text
|
||||
lin 1+! ladr begin dup c@+ 0= until drop ;
|
||||
|
||||
: SETLIN ( n -- ) \ setup for line n
|
||||
tbuf over 0 ?do zcount + 1+ loop
|
||||
ladr ! lin ! ;
|
||||
|
||||
: LINES+ ( -- ) lines 1+ to lines ;
|
||||
: LINES- ( -- ) lines 1- to lines ;
|
||||
|
||||
: ?MEM ( -- )
|
||||
nxt @ mem u< not if s" no space" .err then ;
|
||||
|
||||
: REPL ( a u -- ) \ replace line in text
|
||||
>r line r@ over - >r
|
||||
over + dup r@ + nxt @ 1+ dup >r
|
||||
2 pick - move 2r> + dup off nxt !
|
||||
r> cmove ?mem ;
|
||||
|
||||
: BSTR ( -- a u ) \ string in buffer
|
||||
buf bufe over - -trailing ;
|
||||
|
||||
: LEAV ( -- ) \ leave the line we are on
|
||||
upd @ if bstr repl then upd off ;
|
||||
|
||||
: ENTER ( -- ) \ start changes on this line
|
||||
line buf dup COLS blank swap cmove
|
||||
buf col @ + bpos ! upd off ;
|
||||
|
||||
: .ALL ( -- ) \ update screen
|
||||
leav enter
|
||||
page line@
|
||||
ltop @ dup setlin
|
||||
lmax swap - YBOT min
|
||||
1+ 0 ?do 0 i goxy .line ld loop
|
||||
line! .hd cxy ;
|
||||
|
||||
: SLN ( ltop lin -- )
|
||||
>r 0 max lmax min dup r> max lmax min
|
||||
dup setlin over - lpos ! ltop ! .all ;
|
||||
|
||||
: PU ( -- ) \ ^R page up
|
||||
lin @ if
|
||||
leav ltop @ YBOT - lin @ YBOT - sln
|
||||
then ;
|
||||
|
||||
: PD ( -- ) \ ^C page dn
|
||||
lin @ lines < if
|
||||
leav ltop @ YBOT + lin @ YBOT + sln
|
||||
then ;
|
||||
|
||||
: SU ( -- ) \ scroll up, new line at bottom
|
||||
0 0 goxy delete-line 0 YBOT dup lpos ! goxy ;
|
||||
|
||||
: SD ( -- ) \ scroll down, new line at top
|
||||
0 0 goxy insert-line lpos off ;
|
||||
|
||||
-? : UP ( -- ) \ ^E line up
|
||||
lin @ if
|
||||
leav lu
|
||||
lin @ ltop @ 1- = if
|
||||
sd .line ltop 1-!
|
||||
else
|
||||
lpos 1-!
|
||||
then
|
||||
enter .pos
|
||||
then ;
|
||||
|
||||
: DN ( -- ) \ ^X line dn
|
||||
lin @ lines < if
|
||||
leav ld
|
||||
lin @ ltop @ YBOT 1+ + = if
|
||||
su .line ltop 1+!
|
||||
else
|
||||
lpos 1+!
|
||||
then
|
||||
enter .pos
|
||||
then ;
|
||||
|
||||
: RT ( -- ) \ ^D right
|
||||
col @ XMAX < if
|
||||
col 1+! bpos 1+! .pos
|
||||
then ;
|
||||
|
||||
: LFT ( -- ) \ ^S left
|
||||
col @ if
|
||||
bpos 1-! col 1-! .pos
|
||||
then ;
|
||||
|
||||
: TAB ( -- ) \ ^I tab
|
||||
4 col @ over mod - 0 do rt loop ;
|
||||
|
||||
: NLN ( -- ) \ ^M new line
|
||||
room? if
|
||||
13 insc chgd leav
|
||||
ladr begin dup c@+ 13 = until 0 over -c! 1+!
|
||||
lines+ lin 1+!
|
||||
clear-line col off enter
|
||||
lpos @ YBOT = if
|
||||
su ltop 1+!
|
||||
else
|
||||
lpos 1+! insert-line cxy
|
||||
then
|
||||
.all
|
||||
then ;
|
||||
|
||||
: DEL ( -- ) \ ^G del next
|
||||
bpos @ bstr + < if ( del char)
|
||||
bpos @ dup 1+ swap bufe bl over c! over - 1+ cmove
|
||||
.rt cxy chgd
|
||||
else ( join line)
|
||||
chgd leav line COLS over - >r
|
||||
+ dup 1+ zcount r> min rot zplace .all
|
||||
then ;
|
||||
|
||||
: BS ( -- ) \ ^H del prev
|
||||
col @ if lft del then ;
|
||||
|
||||
: DLN ( -- ) \ ^Y del line
|
||||
lin @ lines < if
|
||||
ladr @
|
||||
ld enter 13 ladr -c!
|
||||
ladr !
|
||||
chgd leav enter
|
||||
lines- lin 1-!
|
||||
delete-line
|
||||
ltop @ YBOT + lines < if
|
||||
line@
|
||||
ltop @ YBOT + setlin 0 YBOT goxy .line
|
||||
line!
|
||||
then
|
||||
.pos
|
||||
then ;
|
||||
|
||||
: RST ( -- ) \ ^L restore line
|
||||
0 lpos @ goxy clear-line .line cxy
|
||||
enter ;
|
||||
|
||||
: DEOL ( -- ) \ ^T delete to EOL
|
||||
bufe bpos @ - blank
|
||||
clear-line cxy chgd ;
|
||||
|
||||
: CHAROK ( c -- )
|
||||
dup bl 126 between room? and if
|
||||
dup insc dup emit col 1+! .rt
|
||||
.pos chgd
|
||||
then drop ;
|
||||
|
||||
: CLR ( -- ) \ ^ZC
|
||||
s" *** Clear text: " sure? if leav -txt then
|
||||
.all ;
|
||||
|
||||
: GETN ( -- a u ) msg ." Filename: "
|
||||
pad dup XMAX 10 - accept ;
|
||||
|
||||
: STNAM ( a u -- a u )
|
||||
2dup fnam pack count upper 0 to fid ;
|
||||
|
||||
: CLOSF ( -- ) fid ?dup if close-file drop then ;
|
||||
|
||||
: CLN ( a u -- ) \ ctl chars to spaces
|
||||
over + swap ?do i c@ bl max i c! loop ;
|
||||
|
||||
: (RD) ( a u -- )
|
||||
stnam r/w open-file throw to fid
|
||||
0 to lines tbuf dup off dup 1+ nxt !
|
||||
( a) begin
|
||||
dup COLS 2dup + mem u> throw
|
||||
fid read-line throw ( a u' f )
|
||||
while
|
||||
2dup cln + 0 over c! ( null)
|
||||
1+ dup nxt ! lines+
|
||||
repeat 2drop nxt @ off ;
|
||||
|
||||
: RD ( a u -- )
|
||||
s" F" +ext ( append .F extension if none )
|
||||
leav ['] (rd) catch if
|
||||
2drop s" load/size error" .err -txt
|
||||
then closf curtop .all ;
|
||||
|
||||
: (WR) ( a u -- )
|
||||
stnam r/w create-file throw to fid
|
||||
tbuf begin ( a)
|
||||
dup nxt @ u<
|
||||
while
|
||||
zcount 2dup fid write-line drop + 1+
|
||||
repeat drop ;
|
||||
|
||||
: WR ( a u -- )
|
||||
leav ['] (wr) catch if
|
||||
2drop s" save error" .err
|
||||
then closf .all ;
|
||||
|
||||
: ZRD ( -- ) \ ^ZR read file into text buffer
|
||||
getn rd .hd ;
|
||||
|
||||
: ZWR ( -- ) \ ^ZW write text to file
|
||||
getn wr .hd ;
|
||||
|
||||
: SAV ( -- )
|
||||
fnam count dup 0= if 2drop getn then wr ;
|
||||
|
||||
dup [if]
|
||||
: HLP ( -- ) \ ^ZH help
|
||||
leav page 14 spaces ." Help Menu"
|
||||
cr ." ^E Up cursor ^R Prev page"
|
||||
cr ." ^X Down cursor ^C Next page"
|
||||
cr ." ^D Right cursor ^G Del next char"
|
||||
cr ." ^S Left cursor ^H Del prev char"
|
||||
cr ." ^L Restore line ^M New line"
|
||||
cr ." ^T Erase to EOL ^Y Delete line"
|
||||
cr ." ^U Exit editor ^Z Function"
|
||||
cr ." ^ZC Clear text ^ZH Help"
|
||||
cr ." ^ZR Read file ^ZW Write file"
|
||||
cr cr cont .all ;
|
||||
[then]
|
||||
|
||||
: FN ( -- ) \ ^Z function
|
||||
[ dup ] [if]
|
||||
msg ." *** (R)ead, (W)rite, (C)lear, (H)elp ? " ukey
|
||||
[char] H of hlp end \ ^ZH help
|
||||
[else]
|
||||
msg ." *** (R)ead, (W)rite, (C)lear ? " ukey
|
||||
[then]
|
||||
[char] C of clr end \ ^ZC clear
|
||||
[char] R of zrd end \ ^ZR read
|
||||
[char] W of zwr end \ ^ZW write
|
||||
drop .hd ;
|
||||
|
||||
: DONE ( -- ) \ ^U Quit editor
|
||||
msg ." *** Exit: (S)ave, (Q)uit ? " ukey
|
||||
[char] Q of xf on end
|
||||
[char] S of sav xf on end
|
||||
drop .hd ;
|
||||
|
||||
: KMAP ( c1 -- c2 ) \ map in arrow keys etc
|
||||
[ cpm? ] [if]
|
||||
$14F c@ of 5 end $150 c@ of 24 end
|
||||
$151 c@ of 4 end $152 c@ of 19 end
|
||||
127 of 7 end
|
||||
[else]
|
||||
200 of 5 end 208 of 24 end
|
||||
205 of 4 end 203 of 19 end
|
||||
211 of 7 end
|
||||
210 of 22 end 201 of 18 end
|
||||
209 of 3 end 199 of 17 end
|
||||
[then] ;
|
||||
|
||||
: CMD ( -- ) key kmap
|
||||
3 of pd ( ^C) end 4 of rt ( ^D) end
|
||||
5 of up ( ^E) end 7 of del ( ^G) end
|
||||
8 of bs ( ^H) end 9 of tab ( ^I) end
|
||||
12 of rst ( ^L) end 13 of nln ( ^M) end
|
||||
18 of pu ( ^R) end 19 of lft ( ^S) end
|
||||
20 of deol ( ^T) end 21 of done ( ^U) end
|
||||
24 of dn ( ^X) end 25 of dln ( ^Y) end
|
||||
26 of fn ( ^Z) end
|
||||
charok ;
|
||||
|
||||
\ Load & edit textfile addr len. If len=0 don't load.
|
||||
: (TED) ( line addr len -- )
|
||||
setup page .hd
|
||||
?dup if
|
||||
rd ( line ) 1- dup 7 - swap sln
|
||||
else 2drop then
|
||||
enter xf off begin cmd xf @ until
|
||||
0 YMAX at-xy cr cr ;
|
||||
|
||||
( *) [if]
|
||||
|
||||
\ Turnkey version
|
||||
-? : TED ( -- ) 1 cmdtail (ted) ; turnkey ted ted bye
|
||||
|
||||
[else]
|
||||
|
||||
\ Resident version
|
||||
-? : TED ( "filename[.F]" -- ) token dup if 1 -rot
|
||||
else 2drop loadline @ lastfile then (ted) ;
|
||||
|
||||
\ aka TED EDIT
|
||||
|
||||
behead cpm? cmd
|
||||
|
||||
[then]
|
||||
|
||||
forth definitions application
|
||||
|
79
DX-FORTH v430/TED.TXT
Normal file
79
DX-FORTH v430/TED.TXT
Normal file
@ -0,0 +1,79 @@
|
||||
|
||||
Text File Editor for DX-FORTH
|
||||
-----------------------------
|
||||
|
||||
TED is a resident text file editor.
|
||||
|
||||
|
||||
INSTALLATION:
|
||||
|
||||
DX-FORTH for CP/M must be configured for your terminal before
|
||||
using the text file editor. See DX-FORTH.TXT for further
|
||||
details.
|
||||
|
||||
Users who prefer working with text files can replace the
|
||||
resident screen file editor in DX-Forth with TED. To do this
|
||||
enter the following from the DOS command prompt:
|
||||
|
||||
A:FORTH-F - SYSTEM INCLUDE TED AKA TED EDIT SAVE DX BYE
|
||||
|
||||
|
||||
INVOKING:
|
||||
|
||||
The text editor is invoked by typing TED. If the editor is
|
||||
not resident it is automatically loaded from disk file TED.F
|
||||
|
||||
If you mainly use text files you may want to add EDIT as a
|
||||
synonym for TED as previously described.
|
||||
|
||||
TED ( "filename[.F]" -- )
|
||||
|
||||
Load and edit the text file "filename". If no filename is
|
||||
given use the file specified by LASTFILE and LOADLINE.
|
||||
|
||||
Note: Specifying a filename with TED is only available once
|
||||
TED has been loaded and the loader stub overwritten.
|
||||
|
||||
A "load/size error" is reported if the file cannot be found,
|
||||
is write-protected or too large to fit in memory.
|
||||
|
||||
Edits are confined to memory and only written to disk on
|
||||
exit with ^U (S)ave or when writing to another filename with
|
||||
^Z (W)rite.
|
||||
|
||||
Lines can be up to 132 characters but only the leftmost are
|
||||
displayed and directly editable. Tabs are converted to
|
||||
single spaces.
|
||||
|
||||
|
||||
COMMANDS:
|
||||
|
||||
1. Cursor movement
|
||||
|
||||
Ctrl-E Move cursor up
|
||||
Ctrl-X Move cursor down
|
||||
Ctrl-D Move cursor right
|
||||
Ctrl-S Move cursor left
|
||||
Ctrl-I Move cursor to the next tab stop (TAB)
|
||||
|
||||
2. Editing
|
||||
|
||||
Ctrl-G Delete character to the right of the cursor
|
||||
Ctrl-H Delete character to the left of the cursor
|
||||
Ctrl-T Erase all characters to the right of the cursor
|
||||
Ctrl-Y Delete the current line. Lines below cursor are moved
|
||||
up one position.
|
||||
Ctrl-M Insert a blank line at the cursor position
|
||||
|
||||
3. Miscellaneous
|
||||
|
||||
Ctrl-C Move to the next page
|
||||
Ctrl-R Move to the previous page
|
||||
Ctrl-L Restore the current line
|
||||
Ctrl-U Exit the editor
|
||||
Ctrl-Z Multi-function command
|
||||
C - clear the text buffer
|
||||
H - show help screen (if present)
|
||||
R - read file from disk
|
||||
W - write file to disk
|
||||
|
1
DX-FORTH v430/TOOLS.SCR
Normal file
1
DX-FORTH v430/TOOLS.SCR
Normal file
File diff suppressed because one or more lines are too long
1
DX-FORTH v430/TXT2BLK.SCR
Normal file
1
DX-FORTH v430/TXT2BLK.SCR
Normal file
File diff suppressed because one or more lines are too long
94
DX-FORTH v430/WHATSNEW.TXT
Normal file
94
DX-FORTH v430/WHATSNEW.TXT
Normal file
@ -0,0 +1,94 @@
|
||||
WHATSNEW.TXT - DX-FORTH for DOS
|
||||
|
||||
Note: only significant changes/fixes are listed.
|
||||
|
||||
! changed + added * fixed - removed
|
||||
|
||||
v4.30 2017-02-11
|
||||
|
||||
+ I' END BOUNDS
|
||||
! EXIT made non-immediate
|
||||
! MISC: Add MJD. Rename D/MOD to SD/REM
|
||||
- (EXIT)
|
||||
|
||||
v4.20 2016-10-07
|
||||
|
||||
+ EOL
|
||||
! QUIT moved to Application
|
||||
! Rename PARSE$ FREEZE PACKED to /PARSE PROTECT PACK
|
||||
|
||||
v4.10 2016-07-13
|
||||
|
||||
+ (.) (U.)
|
||||
|
||||
v4.09 2016-05-20
|
||||
|
||||
! Rename WORDS-LIKE to WORDS:
|
||||
|
||||
v4.08 2016-01-16
|
||||
|
||||
* File not found error in INCLUDE displays wrong filename
|
||||
|
||||
v4.07 2016-01-07
|
||||
|
||||
+ TRIM
|
||||
* WARNING incorrectly disabled by consecutive -?
|
||||
|
||||
v4.06 2015-07-26
|
||||
|
||||
+ LAST BAL
|
||||
! CSP extended to 2 cells
|
||||
- +BAL -BAL
|
||||
* Turnkey initialization improperly wrote to high memory
|
||||
|
||||
v4.05 2015-05-16
|
||||
|
||||
+ BINARY -BLANKS LASTFILE
|
||||
+ Interpret numbers with % prefix as binary
|
||||
+ TED text file editor
|
||||
! APPLICATION moved to Application dictionary
|
||||
- CTOGGLE (see MISC.SCR for alternative)
|
||||
|
||||
v4.04 2015-04-12
|
||||
|
||||
+ #USER .FREE LS BOLD BRIGHT INVERSE
|
||||
! ABORT" made state-smart
|
||||
! Rename FILE? to SCREEN?
|
||||
! Revised multitasker locals
|
||||
* Fix ASMTEST to use -ALLOT
|
||||
|
||||
v4.03 2015-01-07
|
||||
|
||||
+ -ALLOT
|
||||
! ALLOT may no longer use negative values. See glossary.
|
||||
! /MS is now DEFERed
|
||||
|
||||
v4.02 2014-09-29
|
||||
|
||||
+ WAIT-TICK
|
||||
! . and ? display unsigned when BASE not decimal
|
||||
* LOCALS.SCR updated to compile with DX4
|
||||
|
||||
v4.01 2014-07-22
|
||||
|
||||
* ASM: Fix bug in XCHG which caused subsequent instructions to be
|
||||
assembled in BYTE mode
|
||||
|
||||
v4.00 2014-07-19
|
||||
|
||||
+ 2NIP @EXECUTE W>NAME CMDTAIL PARSE$ >FNAME TOKEN WORDS-LIKE CHAIN
|
||||
+ CTOGGLE PACKED S.R SHOLD NHOLD LREAD LWRITE LINK, S, ?BLOCK
|
||||
+ FPICK S>F F>S
|
||||
+ READ-LINE recognizes CP/M EOF terminator ($1A)
|
||||
! ADDR made state-smart
|
||||
! OPEN now requires a file-access-method
|
||||
! Rename >NEXT, FORWARD, BACK to 'NEXT, >MARK, <RESOLVE
|
||||
! WORDS "pattern" now handled by WORDS-LIKE
|
||||
! Improve compiler security
|
||||
! MARKER is no longer ANS compatible
|
||||
! Allow leading decimal point on float input
|
||||
* INCLUDED didn't restore block contents
|
||||
* TXT2BLK fixed to work with CP/M
|
||||
- PARSE" ASCIIZ M/MOD
|
||||
- ONLY ALSO PREVIOUS WORDLIST SEARCH-WORDLIST FORTH-WORDLIST ENVIRONMENT?
|
||||
|
3
DX-FORTH v430/m.bat
Normal file
3
DX-FORTH v430/m.bat
Normal file
@ -0,0 +1,3 @@
|
||||
ntvdm -c -p forth - include %1.f %1 bye
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user