- Description
- Main features
- History and current status
- Supported computers and disk operating systems
- Status of each DOS support
- Download
- Directory tree
- Disks
- How to run
- The library
- How to use the additional source disks
- How to test and benchmark
- How to write Forth programs
- How to rebuild
- Notation
- Glossary
Description
Solo Forth is a modern standard Forth system under development for the ZX Spectrum 128 and compatible computers.
Solo Forth is focused on cross development of Forth programs for ZX Spectrum 128 using a ZX Spectrum emulator on a GNU/Linux operating system (in theory, other kind of operating system could be used as well).
Solo Forth is a complete Forth system. Therefore it can be used as a stand-alone Forth system on a ZX Spectrum emulator or the real computer, without any limitation, but that’s not its goal. Its goal is to be used as the last step of the development process, i.e. to compile and debug a Forth program on a ZX Spectrum emulator. The sources of the Forth program are edited on the host operating system and converted to Forth block disk images by tools that run on the host operating system.
Main features
-
Fast DTC (Direct Threaded Code) implementation.
-
A kernel as small as possible.
-
Dictionary in banked memory, separated from code and data space.
-
Transparent access to banked memory.
-
Big library of useful source code.
-
Modular DOS support.
-
Documented source code.
-
Detailed documentation.
History and current status
The development of Solo Forth started on 2015-05-30, from the disassembled code of Abersoft Forth, a tape-based fig-Forth 1.1 for ZX Spectrum 48.
The GitHub repository was created on 2016-03-13 from the development backups, in order to preserve the change history from the very beginning. Besides, there’s a development history until v0.12.0 (2016-12-31).
At the time of writing (2017-04-27) Solo Forth is under active development. It’s very stable, and it’s being used to develop two projects in Forth: Nuclear Waste Invaders and Black Flag.
Supported computers and disk operating systems
Solo Forth needs a ZX Spectrum or compatible computer with disk drives and at least 128 KiB of RAM. Therefore it can not run on the original ZX Spectrum 48, but in theory it could be used to develop Forth programs for it.
Computer | Disk interface | DOS |
---|---|---|
ZX Spectrum 128 |
Beta 128 |
TR-DOS |
Plus D |
G+DOS |
|
ZX Spectrum +2 |
Beta 128 |
TR-DOS |
Plus D |
G+DOS |
|
ZX Spectrum +3 |
+3DOS |
|
ZX Spectrum +3e |
+3DOS |
|
Pentagon 128 |
TR-DOS |
|
Pentagon 512 |
TR-DOS |
|
Pentagon 1024 |
TR-DOS |
|
Scorpion ZS 256 |
TR-DOS |
Status of each DOS support
G+DOS
Summary
G+DOS is the best supported DOS at the moment. Block disks are fully supported, but some file-management words are not implemented yet, especially the standard Forth words.
Rationale
G+DOS was the first target (in fact, the only planned target at the beginning), and it’s also the author’s platform of choice to develop projects in Solo Forth, because of its excellent features:
-
Fast disk operations.
-
Big disk capacity (800 KiB for Forth blocks or 780 KiB for files).
-
It uses only the RAM of the Plus D interface.
TR-DOS
Summary
TR-DOS is well supported. Block disks are fully supported, but many file-management words are not implemented yet, especially the standard Forth words.
Rationale
TR-DOS is slower than G+DOS, it uses 368 bytes of RAM from the main computer memory, and the maximum capacity of its disks is smaller (636 KiB of useful space, either for Forth blocks or files), but it haves some interesting features:
-
TR-DOS can handle 4 disk drives at the same time. This makes it an interesting choice in some cases. For example, to compile a program from the third drive, using the library on the second drive during the process, and also reading or manipulating the files on the first drive (for example, graphics); or just to use a total of 2544 Forth blocks (
636 4 *
). -
TR-DOS is the DOS used by all of the Russian ZX Spectrum powerful clones: The Pentagon and Scorpion series are the best known among them.
+3DOS
Summary
Note
|
The +3DOS support does not work fine because of a recently introduced bug, which will be fixed in version 0.14.0. |
The +3DOS support is still basic. Only the first drive can be used for block disks and most file-management words are not implemented yet, but standard Forth words are better supported than on G+DOS or TR-DOS.
Rationale
+3DOS uses 16 KiB of banked memory, but their features and API are excellent and very well documented. Besides, it’s the door to support the more advanced IDEDOS and ResiDOS in the future.
Comparative of DOS support
The following table shows the main disk-management words implemented on each DOS.
Word | G+DOS | TR-DOS | +3DOS | Comment |
---|---|---|---|---|
|
YES |
YES |
Save memory zone to a file |
|
|
YES |
YES |
n/a |
Abbreviated disk catalogue |
|
YES |
Standard Forth |
||
|
YES |
YES |
draft |
Detailed disk catalogue |
|
YES |
Standard Forth |
||
|
draft |
Standard Forth |
||
|
YES |
YES |
YES |
Standard Forth |
|
YES |
YES |
||
|
YES |
n/a |
||
|
YES |
YES |
||
|
YES |
YES |
||
|
YES |
Standard Forth |
||
|
YES |
|||
|
YES |
|||
|
Standard Forth |
|||
|
YES |
YES |
||
|
YES |
YES |
Standard Forth |
|
|
YES |
|||
|
YES |
YES |
||
|
YES |
YES |
Load file contents to memory zone |
|
|
YES |
YES |
||
|
Standard Forth |
|||
|
YES |
YES |
draft |
|
|
Standard Forth |
|||
|
Standard Forth |
|||
|
Standard Forth |
|||
|
draft |
Standard Forth |
||
|
YES |
Standard Forth |
||
|
YES |
Standard Forth |
||
|
Standard Forth |
|||
|
Standard Forth |
|||
|
YES |
YES |
YES |
Standard Forth |
|
YES |
Standard Forth |
||
|
Standard Forth |
|||
|
Standard Forth |
|||
|
Standard Forth |
|||
|
YES |
YES |
draft |
|
|
YES |
|||
|
YES |
Standard Forth |
||
|
YES |
Abbreviated disk catalogue with wildcards |
||
|
YES |
draft |
Detailed disk catalogue with wildcards |
|
|
Standard Forth |
|||
|
Standard Forth |
Download
Solo Forth can be downloaded from two sites:
Directory tree
The project directory has the following structure:
. ├── backgrounds Version background images ├── bin Binary files needed to build disk 0 │ ├── fonts Fonts for the supported screen modes │ ├── addons Code that is loaded from disk │ │ because it's not assembled in the library yet │ └── dos DOS files ├── disks Disk images │ ├── gplusdos G+DOS disk images │ ├── plus3dos +3DOS disk images │ └── trdos TR-DOS disk images ├── doc Documentation ├── make Files used by `make` to build the system ├── screenshots Version screenshots ├── src Sources │ ├── inc Z80 symbols files │ ├── lib Library │ ├── loader BASIC loader for disk 0 │ ├── addons Code that is loaded from disk │ └── doc Files used to build the documentation ├── tmp Temporary files created by `make` ├── tools Development and user tools └── vim Vim files ├── ftplugin Filetype plugin └── syntax Syntax highlighting
Disks
The <disks> directory of the directory tree contains the disk images:
disks/*/disk_0_boot.* disks/*/disk_1_library.* disks/*/disk_2_games.* disks/*/disk_3_workbench.*
The subdirectory and the filename extension depend on the DOS, as follows:
DOS | Subdirectory | Filename extension |
---|---|---|
G+DOS |
gplusdos |
mgt |
TR-DOS |
trdos |
trd |
+3DOS |
plus3dos |
dsk |
-
Disk 0 is the boot disk. It contains the BASIC loader, the Solo Forth binary, some addons (i.e. compiled code that is not part of the library yet) and fonts for the supported screen modes. Two +3DOS boot disk images are included, with different sizes. Several TR-DOS disk images are included, for specific models of Pentagon and Scorpion computers (in a future version, one single disk will contain all the executables, and the right one will be selected automatically).
-
Disk 1 contains the sources of the library.
-
Disk 2 contains some little sample games, most of them under development.
-
Disk 3 contains tests and benchmarks used during the development.
Warning
|
Disks 1, 2 and 3 are Forth block disks: They contain the source Forth blocks directly on the disk sectors, without any file system. Therefore their contents can not be accessed with ordinary DOS commands. |
About the disk image formats
The MGT disk image file format (used for G+DOS disks) does not include format-describing metadata: The MGT file is just a dump of the original 800-KiB disk. Beside, G+DOS does not need its own metadata (the directory tracks) be present in order to read or write sectors.
That’s why converting Forth sources to MGT disk images is most simple, and the full capacity of the disks can be used to store the Forth blocks.
All this means the MGT disk images actually are identical to Forth block files, as used by modern Forth systems. Therefore, for example, they can be browsed with a Forth block editor.
Also the TRD disk images, one of the formats used for TR-DOS disk images, are dumps of the original disks, without any format-describing metadata. But, contrary to G+DOS, TR-DOS needs the system track (track 0) to contain certain data in order to recognize the disk, even for sector-level access. That’s why only 636 KiB can be used for Forth blocks, 4 KiB (one track) less than the maximum capacity.
Anyway, TRD disk images can be browsed with a Forth block editor, with the following restriction: blocks 0..3 will be shown as garbage (they are track 0 of the disk), while the actual first Forth block of the disk (block 0) will be shown as block 4.
The DSK disk image format, used for +3DOS and other systems, is quite a different thing: It contains a lot of metadata to describe the format of the disk, the tracks and the sectors…
On +3DOS, sector 0 of track 0 can not be used for Forth blocks, because it must contain the disk specification, even for sector-level access. Since the size of a sector is 512 B, only one Forth block is lost because of this restriction.
How to run
On ZX Spectrum 128 (or ZX Spectrum +2) with the Plus D interface
-
Run a ZX Spectrum emulator and select a ZX Spectrum 128 (or ZX Spectrum +2) with the Plus D disk interface.
-
"Insert" the disk image file <disks/gplusdos/disk_0_boot.mgt> as disk 1 of the Plus D disk interface.
-
Choose "128 BASIC" from the computer start menu.
-
Type
run
in BASIC. G+DOS will be loaded from disk, and Solo Forth as well.
On ZX Spectrum 128 (or ZX Spectrum +2) with the Beta 128 interface
-
Run a ZX Spectrum emulator and select a ZX Spectrum 128 (or ZX Spectrum +2) with the Beta 128 interface.
-
"Insert" the disk image file <disks/trdos/disk_0_boot.trd> as disk A of the Beta 128 interface.
-
Choose "128 BASIC" from the computer start menu.
-
Type
randomize usr 15616
in BASIC (or justrun usr15360
to save seven keystrokes). This will enter the TR-DOS command line[1]. -
Press the
R
key to get theRUN
command and press the Enter key. Solo Forth will be loaded from disk.
On ZX Spectrum +3 (or ZX Spectrum +3e)
-
Run a ZX Spectrum emulator and select a ZX Spectrum +3 (or ZX Spectrum +3e).
-
"Insert" the disk image file <disks/plus3dos/disk_0_boot.180.dsk> (or <disks/plus3dos/disk_0_boot.720.dsk>, depending on the capacity of the drive) as disk 'A'.
-
Choose "Loader" from the computer start menu. Solo Forth will be loaded from disk.
On Pentagon 128
-
Run a ZX Spectrum emulator and select a Pentagon 128.
-
"Insert" the disk image file <disks/trdos/disk_0_boot.trd> as disk 'A'.
-
Choose "TR DOS" from the computer start menu. This will enter the TR-DOS command line[1].
-
Press the
R
key to get theRUN
command and press the Enter key. Solo Forth will be loaded from disk.
On Pentagon 512
-
Run a ZX Spectrum emulator and select a Pentagon 512.
-
"Insert" the disk image file <disks/trdos/disk_0_boot.pentagon_512.trd> as disk 'A'.
-
Choose "128k menu"[2] from the computer start menu (the reset service menu). This will enter a ZX Spectrum 128 style menu. Choose "TR-DOS". This will enter the TR-DOS command line[1].
-
Press the
R
key to get theRUN
command and press the Enter key. Solo Forth will be loaded from disk.
On Pentagon 1024
-
Run a ZX Spectrum emulator and select a Pentagon 512.
-
"Insert" the disk image file <disks/trdos/disk_0_boot.pentagon_512.trd> as disk 'A'.
-
Choose "128k menu"[2] from the computer start menu (the reset service menu). This will enter a ZX Spectrum 128 style menu. Choose "TR-DOS". This will enter the TR-DOS command line[1].
-
Press the
R
key to get theRUN
command and press the Enter key. Solo Forth will be loaded from disk.
On Scorpion ZS 256
-
Run a ZX Spectrum emulator and select a Scorpion ZS 256.
-
"Insert" the disk image file <disks/trdos/disk_0_boot.scorpion_zs_256.trd> as disk 'A'.
-
Choose "128 TR DOS" from the computer start menu. Solo Forth will be loaded from disk.
The library
Note
|
The library can not be used on +3DOS because of a recently introduced bug, which will be fixed in version 0.14.0. |
The library disk contains the source code in Forth blocks, written directly on the disk sectors, without any filesystem. In order to use the library, follow these steps:
-
Insert the library disk:
-
On G+DOS: "Insert" the file <disks/gplusdos/disk_1_library.mgt> as disk 2 of the Plus D disk interface. Type
2 set-drive throw
to make drive 2 the current one. -
On TR-DOS: "Insert" the file <disks/trdos/disk_1_library.trd> as disk B of the Beta 128 interface. Type
1 set-drive throw
to make drive 1[3] the current one. -
On +3DOS: "Insert" the file <disks/plus3dos/disk_1_library.dsk> as disk A.
-
-
Type
1 load
to load block 1 from the library disk. By convention, block 0 can not be loaded (it is used for comments), and block 1 is used as a loader. In Solo Forth, block 1 contains2 load
, in order to load theneed
tool and related words from block 2. -
Type
need name
, were "name" is the name of the word or tool you want to load from the library.
Library index
The need
word and its related words search the index line (line 0)
of all blocks of the disk for the first occurence of the required
word, within a configurable range of blocks (using the variables
first-locatable
and last-locatable
). Of course, nested need
are
resolved the same way: searching the library from the beginning. This
can be slow. This is not a problem, because the goal of Solo Forth is
cross development, and therefore only the last step of the development
loop, i.e., the compilation of the sources from the disk images
created in the host system, compilation that includes all the slow
searching of library blocks, is done in the real (actually, emulated)
machine. But the system includes a tool to create an index of the
library, which is used to locate their contents instantaneously, what
makes things more comfortable when the Forth system is used
interactively.
How to use the library index:
-
Load the indexer with
need make-thru-index
. -
Make the index and activate it with
make-thru-index
. -
The default behaviour (no index) can be restored with
use-no-index
. The index can be reactivated withuse-thru-index
.
The indexer creates an index (actually, a Forth word list whose
definitions use no code or data space) and changes the default
behaviour of need
and related words to use it. Then need name
will
automatically start loading the first block where the word "name" is
defined.
DOS | First block | Last block | Seconds | Bytes of far memory |
---|---|---|---|---|
G+DOS |
5 |
799 |
154 |
13498 |
TR-DOS |
5 |
635 |
135 |
13027 |
Note
|
The far memory is the virtual 64-KiB space formed by 4 configurable memory banks. No code or data space is used by the indexer. |
An alternative indexer is under development. It’s activated with
use-fly-index
and does not make and index in advance: Instead, it
indexes the blocks on the fly, when they are searched the first time.
This indexer was included in Solo Forth 0.12.0 but it’s not finished
yet.
How to search the source files
Three simple one-line wrapper scripts are included to search the Forth sources for a regular expression: <tools/search_library>, <tools/search_kernel> and <tools/search_source> (to search all files in the <src> directory).
The scripts use ack
. In order to use the more common grep
, edit
the files. ack
and grep
are compatible.
Their first parameter is the regular expression. An optional second
parameter is passed to ack
.
Usage examples:
tools/search_source use-thru-index tools/search_source use-thru-index -l tools/search_kernel color tools/search_kernel ";\s:\s" tools/search_library "\-bank" tools/search_library "code\s+\S+\s+\("
How to use the additional source disks
When the needed source is in a different disk than the library,
set-block-drives
must be used first in order to configure the drives
used as block drives, and their order. For example, this is the case
when you want to try the simple sample games from
<disks/*/disk_2_games.\*> or the benchmarks and tests from
<disks/*/disk_3_workbench.\*>.
The following example is for G+DOS. First, "Insert" the file <disks/gplusdos/disk_1_library.mgt> as disk 1. Then, "Insert" the file <disks/gplusdos/disk_2_games.mgt> as disk 2. Then enter the following commands to load the Pong game:
cold \ just to start from scratch, if needed 1 load \ load the `need` utility from the library need set-block-drives 2 1 2 set-block-drives need pong
Note the last parameter of set-block-drives
is the number of the
drives used as block drives. The last but one parameter is the
identifier of the first drive used for blocks. Note also G+DOS uses
drive identifiers 1 and 2; TR-DOS uses 0, 1, 2 and 3; +3DOS uses
letters 'A' and 'B'. See the glossary entry of set-block-drives
for
more details.
How to test and benchmark
Besides many little specific tests and benchmarks used during the development of Solo Forth probably not interesting for the application programmer, disk image number 3 (called "workbench") contains also and adapted version of the Hayes test and some known benchmarks.
First, in order to access disk image number 3, follow these steps:
-
Run Solo Forth or enter
cold
to start from scratch. -
"Insert" the file <disks/*/disk_1_library.\*> (the actual subdirectory and filename depend on your DOS) into the first disk drive of your emulated machine, if it’s not already "inserted".
-
"Insert" the file <disks/*/disk_3_workbench.\*> (the actual subdirectory and filename depend on your DOS) into the second disk drive of your emulated machine, if it’s not already "inserted".
-
Enter command
1 load
to load theneed
tool. -
Enter command
need set-block-drives
to loadset-block-drives
. -
Depending on your DOS, configure the block drives as follows:
-
On G+DOS:
2 1 2 set-block-drives
-
On TR-DOS: 1 0 2 set-block-drives`
-
On +3DOS: 'B' 'A' 2 set-block-drives`
-
Now the first two disk drives are used as block drives, and need
will search both of them as configured: first the first one (the
library), then the second one (the benchmarks and tests).
Second, depending on the code you want to run, enter the corresponding command:
-
need hayes-test
-
need byte-magazine-benchmark
-
need interface-age-benchmark
-
need vector-loop-benchmark
-
need all-benchmarks
to run all the three benchmarks above
How to write Forth programs
In order to use Solo Forth to write programs for ZX Spectrum, programmers already acquainted with Forth and GNU/Linux systems can extract all the required information from the <Makefile> of Solo Forth.
The only difference between building Solo Forth and
building a Forth program is the content of disk 0 (the boot disk), if
needed, and the library modules included in disk 1 (the library disk),
which usually also contains the source of the program. If the program
does not need to use the disk at run-time, you can simply copy the
default disk 0, and boot it to load your program from block 1 of your
customized disk 1, with a simple 1 load
. When the loading finishes,
you can save a system snapshot, in SZX format, using the corresponding
option of your ZX Spectrum emulator.
Some simple little games are provided as examples, in disk 3. Some of them are not finished yet.
In order to try, improve and fix the Forth system during its development, two more complex game projects are being developed at the same time:
They are not finished yet, but they can be useful as examples of program development with Solo Forth.
How to rebuild
If you modify the sources, you have to build new disk images for your DOS of choice. Also the manual depends on the documentation included in the sources.
First, see the requirements listed in the header of the <Makefile> file and install the required programs. Then enter the project directory and use one of the following commands to build the disk images or the manual for your DOS of choice:
DOS | Disk images | Documentation |
---|---|---|
G+DOS |
|
|
TR-DOS (all) |
|
|
TR-DOS (128k only) |
|
|
TR-DOS (Pentagon 512/1024 only) |
|
|
TR-DOS (Scorpion ZS 256 only) |
|
|
+3DOS |
|
|
All of them |
|
|
The disk images will be created in the <disks> directory. The HTML manual will be created in the <doc> directory.
Notation
Stack notation
Symbol | Data type | Size | Range |
---|---|---|---|
a |
address |
1 cell |
0..65535 |
aa |
aligned address[5] |
1 cell |
0..65535 |
ca |
character-aligned address[5] |
1 cell |
0..65535 |
fa |
float-aligned address[5] |
1 cell |
0..65535 |
f |
well-formed flag (false: 0; true: -1) |
1 cell |
-1..0 |
0f |
zero flag (false: 0; true: non-zero) |
1 cell |
-32768..0..65535 |
true |
true flag (-1) |
1 cell |
-1 |
false |
false flag (0) |
1 cell |
0 |
b |
8-bit byte |
1 cell |
-128..127, 0..255 |
c |
8-bit character |
1 cell |
0..255 |
char |
8-bit character |
1 cell |
0..255 |
u |
16-bit unsigned number |
1 cell |
0..65535 |
len |
16-bit unsigned number (memory zone length) |
1 cell |
0..65335 |
n |
16-bit signed number |
1 cell |
-32768..32767 |
+n |
16-bit non-negative number |
1 cell |
0..32767 |
x |
16-bit unspecified number |
1 cell |
-32768..65535 |
d |
32-bit signed double number |
2 cells |
-2147483648..2147483647 |
+d |
32-bit non-negative double number |
2 cells |
0..2147483647 |
ud |
32-bit unsigned double number |
2 cells |
0..4294697295 |
xd |
32-bit unspecified number |
2 cells |
-2147483648..2147483647 |
t |
48-bit signed triple number |
3 cells |
|
ut |
48-bit unsigned triple number |
3 cells |
|
q |
64-bit signed quadruple number |
4 cells |
|
uq |
64-bit unsigned quadruple number |
4 cells |
|
col |
8-bit cursor column |
1 cell |
0..31, 0..41, 0..63 |
row |
8-bit cursor row |
1 cell |
0..23 |
x |
8-bit cursor x coordinate (column) |
1 cell |
0..31, 0..41, 0..63 |
y |
8-bit cursor y coordinate (row) |
1 cell |
0..23 |
gx |
8-bit (absolute) or 16-bit (relative) graphic x coordinate |
1 cell |
0..255, -32768..32767 |
gy |
8-bit (absolute) or 16-bit (relative) graphic y coordinate |
1 cell |
0..191, -32768..32767, 0..175 |
xt |
execution token (=cfa) |
1 cell |
|
cfa |
code field address (=xt) |
1 cell |
|
lfa |
link field address |
1 cell |
|
nt |
name token (=nfa) |
1 cell |
|
nfa |
name field address (=nt) |
1 cell |
|
pfa |
parameter field address |
1 cell |
|
xtp |
execution token pointer |
1 cell |
|
wid |
word-list identifier |
1 cell |
|
ior |
Input/Output error result |
1 cell |
|
dosior |
Input/Output error result in DOS format |
1 cell |
|
orig |
address of an unresolved forward branch |
1 cell |
0..65535 |
dest |
address of a backward branch target |
1 cell |
0..65535 |
cs-id |
control structure identifier |
1 cell |
|
do-sys |
loop control parameters (=orig) |
1 cell |
0..65535 |
loop-sys |
loop control parameters |
2 cells |
|
nest-sys |
definition call |
1 cell |
|
source-sys |
source identifier |
n cells |
|
i*x |
any data type |
0 or more cells |
|
j*x |
any data type |
0 or more cells |
|
k*x |
any data type |
0 or more cells |
|
u*x |
u elements of type x (eg. |
0 or more cells |
|
r |
a floating point real number |
5 bytes[6] |
1E-38..1E38 |
rf |
a floating point real number flag |
5 bytes[6] |
0..1 |
op |
Z80 8-bit opcode, generally a jump |
1 cell |
0..255 |
reg |
Z80 8-bit register identifier |
1 cell |
0..7 |
regp |
Z80 16-bit register pair identifier |
1 cell |
0, 2, 4 |
regph |
Z80 16-bit HL register pair identifier |
1 cell |
4 |
regpi |
Z80 16-bit IX/IY register pair identifier |
1 cell |
4 |
Symbol | Description |
---|---|
<char> |
the delimiting character marking the end of the string being parsed |
<chars> |
zero or more consecutive occurrences of the character char |
<space> |
a delimiting space character |
<spaces> |
zero or more consecutive occurrences of the character space |
<quote> |
a delimiting double quote |
<paren> |
a delimiting right parenthesis |
<eol> |
an implied delimiter marking the end of a line |
ccc |
a parsed sequence of arbitrary characters, excluding the delimiter character |
name |
a token delimited by space, equivalent to |
Z80 flags notation
Symbol | Description | bit |
---|---|---|
Fc |
Carry flag |
0 |
Fh |
Half Carry flag |
4 |
Fn |
Add/Subtract flag |
1 |
Fp |
Parity/Overflow flag |
2 |
Fs |
Sign flag |
7 |
Fz |
Zero flag |
6 |
Glossary
!
! ( x a -- )
Store x at a.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
!>
!> Interpretation: ( x "name" -- ) Compilation: ( "name" -- ) Run-time: ( x -- ) "store-to"
!>
is an immediate
word.
Interpretation:
Compilation:
Parse name, which is a word created by constant
or
const
, and append the run-time semantics given below to
the current definition.
Run-time:
Make x the current value of constant name.
Origin: IsForth.
Source file: <src/lib/data.store-to.fs>.
!a+
!a+ ( x -- )
Store x at the address register and increment the address register by one cell.
Source file: <src/lib/memory.address_register.fs>.
!bank
!bank ( x a n -- )
Store cell x into address a ($C000..$FFFF) of bank n (0..7).
!bank
is written in Z80. Its equivalent definition in
Forth is the following:
: !bank ( x a n -- ) bank ! default-bank ;
Source file: <src/lib/memory.far.fs>.
!bit
!bit ( f b ca -- )
Store flag f in an element of a bit-array, represented by address ca and bitmask b.
Source file: <src/lib/data.array.bit.fs>.
!csp
!csp ( -- )
Definition:
: !csp ( -- ) sp@ csp ! ;
Origin: fig-Forth.
Source file: <src/kernel.z80s>.
!dos
!dos ( x a -- )
Store x at the Plus D memory address a.
Source file: <src/lib/dos.gplusdos.fs>.
!dosvar
!dosvar ( x n -- )
Store x into the G+DOS variable n.
Source file: <src/lib/dos.gplusdos.fs>.
!exchange
!exchange ( x1 a -- x2 )
Store x1 into a and return its previous contents x2.
See also: c!exchange
, exchange
.
Source file: <src/lib/memory.MISC.fs>.
!sound
!sound ( b1 b2 -- )
Set sound register b2 (0…13) to value b1.
See also: @sound
, sound
, play
, sound-register-port
,
sound-write-port
.
Source file: <src/lib/sound.128.fs>.
!volume
!volume ( b1 b2 -- )
Store b1 at volume register of channel b2 (0..2, equivalent to notation 'A'..'C').
Registers 8..10 (Channels A..C Volume)
Bits 0-4 Channel volume level.
Bit 5 1=Use envelope defined by register 13 and ignore the volume setting.
Bits 6-7 Not used.
Source file: <src/lib/sound.128.fs>.
#
# ( d1 -- d2 )
Divide d1 by current base. The remainder is converted to an ASCII character and appended to the output text string. The quotient d2 is left on stack.
Definition:
: # ( d1 -- d2 ) base @ ud/mod rot >digit hold ;
Source file: <src/kernel.z80s>.
#>kk
#>kk ( n -- bitmask port )
Convert keyboard key number n to its data: bitmask is the key bitmask and port is the keyboard row port.
Source file: <src/lib/keyboard.MISC.fs>.
#block-drives
#block-drives ( -- ca )
A character variable that holds the number of block drives
defined in block-drives
, i.e. the number of drives that are
used for blocks. #block-drives
could be modified
manually, provided also block-drives
is configured
accordingly, but set-block-drives
is provided for that.
Source file: <src/kernel.z80s>.
#chars
#chars ( ca len c -- +n )
Return the count +n of chars c in a string ca len.
See also: #spaces
, char-in-string?
, char-position?
.
Source file: <src/lib/strings.MISC.fs>.
#esc-order
#esc-order ( -- a )
A variable that holds the number of word lists in the escaped strings search order.
See also: esc-context
, esc-max-order
, esc-get-order
,
esc-set-order
, >esc-order
.
Source file: <src/lib/strings.escaped.fs>.
#lag
#lag ( -- ca n )
Return cursor address ca and count n after cursor till end of line.
Source file: <src/lib/editor.specforth.fs>.
#lead
#lead ( -- a n )
From the cursor pointer r#
compute the line address a
in the block buffer and the offset from a to the cursor
location n.
Source file: <src/lib/editor.specforth.fs>.
#locate
#locate ( -- n1 n2 )
From the cursor pointer r#
compute the line number n2
and the character offset n1 in line number n2.
Source file: <src/lib/editor.specforth.fs>.
#order
#order ( -- a )
User variable that holds the number of word lists in the search order.
Source file: <src/kernel.z80s>.
#spaces
#spaces ( ca len -- +n )
Count number +n of spaces in a string ca len.
Source file: <src/lib/strings.MISC.fs>.
#tib
#tib ( -- a )
a is the address of a cell containing the number of characters in the terminal input buffer.
Origin: Forth-83 (Required Word Set), Forth-94 (CORE EXT, obsolescent).
Source file: <src/kernel.z80s>.
#words
#words ( -- u )
u is the number of words currently defined in the system.
Source file: <src/kernel.z80s>.
'
' ( "name" -- xt )
If name is found in the current search order, return its execution token xt, else throw an exception.
Definition:
: ' ( "name" -- xt ) defined dup ?defined name> ;
Origin: Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
''
'' ( "name" -- xtp )
If name is found in the current search order, return its execution-token pointer xtp, else throw an exception.
Since aliases share the execution token of their original
word, it’s not possible to get the name of an alias from
its execution token. But ''
can do it:
' drop alias discard ' discard >name .name \ this prints "drop" '' discard >>name .name \ this prints "discard"
Source file: <src/lib/compilation.fs>.
'bs'
'bs' ( -- c )
A character constant that returns the caracter code used as backspace (8).
Source file: <src/lib/display.control.fs>.
'cr'
'cr' ( -- c )
A character constant that returns the caracter code used as carriage return (13).
Source file: <src/lib/display.control.fs>.
's
's ( tid a -- a' )
Index another task’s user variable.
Source file: <src/lib/multitask.muench-koh.fs>.
'tab'
'tab' ( -- c )
A character constant that returns the caracter code used as tabulator (6).
Source file: <src/lib/display.control.fs>.
(
( ( "ccc<paren>" -- )
Parse until a right paren is found. The number of parsed characters may be zero to the number of characters in the parse area.
(
is an immediate
word.
Source file: <src/kernel.z80s>.
((cat
((cat ( -- ior )
Show a disk catalogue of the current drive, calling the
corresponding G+DOS hook command, which uses the data in
ufia1
. Return error result ior.
((cat
is a low-level factor of (cat
.
Source file: <src/lib/dos.gplusdos.fs>.
(+ato)
(+ato) ( n1 n2 xt -- )
Add n1 to element n2 of 1-dimension single-cell values array xt.
Source file: <src/lib/data.array.value.fs>.
(+cato)
(+cato) ( c n xt -- )
Add c to element n of 1-dimension character values array xt.
Source file: <src/lib/data.array.value.fs>.
(+loop)
(+loop) ( n -- ) ( R: loop-sys1 -- loop-sys2 )
Add n to the loop index. If the loop index did not cross the boundary between the loop limit minus one and the loop limit, continue execution at the beginning of the loop. Otherwise, discard the loop parameters and continue execution immediately following the loop.
(+loop)
is compiled by +loop
.
See also: (loop)
.
Source file: <src/kernel.z80s>.
(-do)
(-do) ( n1|u1 n2|u2 -- ) ( R: -- loop-sys | )
If n1|u1 is not less than n2|u2, discard both
parameters and continue execution at the location given by
the consumer of the do-sys left by -do
at compilation
time. Otherwise set up loop control parameters loop-sys
with index n2|u2 and limit n1|u1 and continue executing
immediately following -do
. Anything already on the
return stack becomes unavailable until the loop control
parameters loop_sys are discarded.
(-do)
is compiled by -do
.
Source file: <src/lib/flow.do.fs>.
(.")
(.") ( -- )
Type the compiled string that follows.
Definition:
: (.") ( -- ) r@ count dup char+ r> + >r type ;
Source file: <src/kernel.z80s>.
(.xs)
(.xs) ( -- )
Display a list of the items in the current xstack
; TOS is
the right-most item.
(.xs)
is a factor of .xs
.
Source file: <src/lib/data.xstack.fs>.
(0-1-8-color.
(0-1-8-color. ( n c -- )
Print control character c. Then convert n to the set 0, 1 and 8 and print it as a character. The conversion of n is done as follows:
-
0, 1 and 8 are not changed.
-
2, 4 and 6 are converted to 0.
-
3, 5 and 7 are converted to 1.
-
Values greater than 8 or less than 0 are converted to 8.
Source file: <src/lib/display.attributes.fs>.
(0-9-color.
(0-9-color. ( -- a )
Return the address a of a routine used by paper.
and
ink.
. This routine prints a color attribute in the range
0..9.
Input: - A = attribute control char ($10 for ink, $11 for paper) - TOS = attribute value (0..9)
Note: If TOS is greater than 9, 9 is used instead.
Source file: <src/lib/display.attributes.fs>.
(2ato)
(2ato) ( xd n xt -- )
Store xd into element n of 1-dimension double-cell values array xt.
See also: 2ato
.
Source file: <src/lib/data.array.value.fs>.
(;code)
(;code) ( -- ) ( R: a -- )
Rewrite the code field of the most recently defined high-level word (it can not be a code word) to point to the following machine code sequence.
Definition:
: (;code) ( -- ) ( R: a -- ) r> latest name> 1+ ! ;
Source file: <src/kernel.z80s>.
(>drive-block
(>drive-block ( u1 -- u2 )
Convert block u1 to its equivalent u2 in its corresponding disk drive, which is set the current drive.
(>drive-block
becomes the action of >drive-block
after block-drives
has been loaded.
See also: ?drive#
, ?block-drive
, set-drive
,
set-block-drives
.
Source file: <src/lib/dos.COMMON.fs>.
(>file)
(>file) ( -- ior )
Save a file to disk using the data hold in ufia
and
return error result ior.
(>file)
is a factor of >file
.
Source file: <src/lib/dos.gplusdos.fs>.
(>tape-file)
(>tape-file) ( -- )
Write a tape file using the data stored at tape-header
.
(>tape-file)
is a factor of >tape-file
.
Source file: <src/lib/tape.fs>.
(?ccase)
(?ccase) ( c ca len -- )
Run-time procedure compiled by ?ccase
. If c is in the
string ca len, execute the n-th word compiled after
?ccase
, where n is the position of the first c in the
string (0..len-1). If c is not in ca len, do nothing.
Source file: <src/lib/flow.ccase.fs>.
(?do)
(?do) ( n1|u1 n2|u2 -- ) ( R: -- loop-sys | )
If n1|u1 is equal to n2|u2, continue execution at the
location given by the consumer of the do-sys left by ?do
at compilation time. Otherwise set up loop control parameters
loop-sys with index n2|u2 and limit n1|u1 and continue
executing immediately following ?do
. Anything already on
the return stack becomes unavailable until the loop control
parameters loop_sys are discarded.
(?do)
is compiled by ?do
.
Source file: <src/kernel.z80s>.
(any-of)
(any-of) ( x0 x1..xn n -- x0 x0 | x0 0 )
The run-time factor of any-of
. If x0 equals any of
x1..xn, return x0 x0; else return x0 0.
Source file: <src/lib/flow.case.fs>.
(at-xy
(at-xy ( col row -- )
Set the cursor coordinates to column col and row row,
by displaying control character 22 followed by col and
row, as needed by some display modes, e.g. mode-64
and
mode-42
. The upper left corner is column zero, row zero.
(at-xy
is a possible action of at-xy
, which is a
deferred word configured by the current display mode.
Warning
|
The default mode-32 expects row right after
control character 22, and then col, i.e in the order used
by Sinclair BASIC. This will be fixed/unified in a future
version of Solo Forth.
|
Source file: <src/lib/display.mode.COMMON.fs>.
(ato)
(ato) ( x n xt -- )
Store x into element n of 1-dimension single-cell values array xt.
See also: ato
.
Source file: <src/lib/data.array.value.fs>.
(baden-sqrt
(baden-sqrt ( n1 -- n2 n3 )
Integer square root n3 of radicand n1 with remainder
n2. (baden-sqrt
is a factor of baden-sqrt
.
Source file: <src/lib/math.operators.1-cell.fs>.
(c)
(c) ( ca len -- )
Copy the string ca len to the cursor line at the cursor position.
Source file: <src/lib/editor.specforth.fs>.
(cat
(cat ( b -- )
Show a disk catalogue of the current drive, using the data
in ufia
, being b the type of catalogue:
-
$02 = abbreviated
-
$04 = detailed
-
$12 = abbreviated with wild-card
-
$14 = detailed with wild-card
Source file: <src/lib/dos.gplusdos.fs>.
(cato)
(cato) ( c n xt -- )
Store c into element n of 1-dimension character values array xt.
See also: cato
.
Source file: <src/lib/data.array.value.fs>.
(ccase)
(ccase) ( c ca len -- )
Run-time procedure compiled by ccase
. If c is in the
string ca len, execute the n-th word compiled after
ccase
, where n is the position of the first c in the
string (0..len-1). If c is not in ca len,
execute the word compiled right before endccase
.
Source file: <src/lib/flow.ccase.fs>.
(ccase0)
(ccase0) ( c ca len -- )
Run-time procedure compiled by ccase0
. If c is in the
string ca len, execute the n-th word compiled after
ccase0
, where n is the position of the first c in the
string (0..len-1) plus 1. If c is not in ca len,
execute the word compiled right after ccase0
.
Source file: <src/lib/flow.ccase.fs>.
(comp')
(comp') ( nt -- xt )
A factor of name>compile
. If nt is an immediate
word,
return the xt of execute
, else return the xt of
compile,
.
Source file: <src/lib/compilation.fs>.
(cr)
(cr) ( -- )
Default action of the deferred word cr
:
Transmit a carriage return to the selected output device.
Source file: <src/kernel.z80s>.
(d.
(d. ( d n -- ca len )
Convert d to an unsigned number in the current base
,
with n digits, as string ca len.
Source file: <src/lib/display.numbers.fs>.
(dbin.
(dbin. ( d n -- )
Display d as an unsigned binary number with n digits.
Source file: <src/lib/display.numbers.fs>.
(defer)
(defer) ( -- )
Default action of an uninitialized deferred word: error.
Source file: <src/kernel.z80s>.
(delete-file)
(delete-file) ( -- ior )
Delete a disk file using the data hold in ufia
.
Return an error result ior.
(delete-file)
is a factor of delete-file
.
Source file: <src/lib/dos.gplusdos.fs>.
(dhex.
(dhex. ( d n -- )
Display d as an unsigned hexadecimal number with n digits.
Source file: <src/lib/display.numbers.fs>.
(do)
(do) ( n1|u1 n2|u2 -- ) ( R: -- loop-sys )
Set up loop control parameters loop-sys with index n2|u2
and limit n1|u1 and continue executing immediately following
do
. Anything already on the return stack becomes
unavailable until the loop control parameters loop_sys are
discarded.
(do)
is compiled by do
.
Source file: <src/kernel.z80s>.
(dstep)
(dstep) ( R: x d -- x d' | x )
The run-time procedure compiled by dstep
.
If the loop index ud is zero, discard it and continue execution after the loop. Otherwise decrement the loop index and continue execution at the beginning of the loop.
Source file: <src/lib/flow.dfor.fs>.
(file-status)
(file-status) ( -- a ior )
Return the status of the file whose name is hold in ufia
.
If the file exists, its file header is read into ufia
,
a is the address returned by ufia
, and ior is zero.
If the file does not exists, a is useless and ior is
the corresponding error code.
(file-status)
is a low-level factor of file-status
.
Source file: <src/lib/dos.gplusdos.fs>.
(file>)
(file>) ( ca len -- ior )
Read a file from disk, using the data hold in ufia
and
the alternative destination zone ca len, following the
following two rules:
-
If len is not zero, use it as the count of bytes that must be read from the file defined in
ufia
and use ca as destination address. -
If len is zero, use the file length stored in the file header instead, and then check also ca: If ca is not zero, use it as destination address, else use the file address stored in the file header instead.
Return error result ior.
(file>)
is a factor of file>
.
See also: file-address
, file-length
.
Source file: <src/lib/dos.gplusdos.fs>.
(g-emit
(g-emit ( c -- )
Display character c (32..127) at the current graphic coordinates.
The character is printed with overprinting (equivalent to
1 overprint
).
Source file: <src/lib/display.g-emit.fs>.
(gigatype
(gigatype ( ca len a1 a2 -- )
If len is greater than zero, display text string ca len at screen address a1 using style data table a2.
(gigatype
is written in Z80 and it’s a factor of
gigatype
.
Source file: <src/lib/display.gigatype.fs>.
(greater-of)
(greater-of) ( x1 x2 -- x1 x1 | x1 x1' )
The run-time factor of greater-of
.
Source file: <src/lib/flow.case.fs>.
(heap-in
(heap-in ( -- )
If the current heap
was created by bank-heap
, page in
its bank, which is stored at heap-bank
; else do nothing.
(heap-in
is the action of heap-in
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
(home)
(home) ( -- )
Default action of home
: Set the cursor position at the
top left position (column 0, row 0).
Source file: <src/kernel.z80s>.
(index-block)
(index-block) ( u -- )
Index block u, evaluating its header line. The only
word list in the search order must be index-wordlist
.
This is a common factor of (indexer)
(from the indexer
tool) and (index-block)
(from the fly-indexer
tool).
Source file: <src/lib/blocks.indexer.COMMON.fs>.
(less-of)
(less-of) ( x1 x2 -- x1 x1 | x1 x1' )
The run-time factor of less-of
.
Source file: <src/lib/flow.case.fs>.
(load)
(load) ( u -- )
Make block u the current input source and interpret it.
Definition:
: (load) ( u -- ) block>source interpret ;
See also: block>source
, interpret
.
Source file: <src/kernel.z80s>.
(located)
(located) ( ca len -- block | 0 )
Locate the first block whose header contains the string ca len (surrounded by spaces), and return its number. If not found, return zero. The search is case-sensitive.
Only the blocks delimited by first-locatable
and
last-locatable
are searched.
This is the default action of located
, which is
changed by use-fly-index
.
See also: default-first-locatable
.
Source file: <src/lib/002.need.fs>.
(loop)
(loop) ( R: loop-sys1 -- loop-sys2 )
Increment the loop index by one. If the loop index did not cross the boundary between the loop limit minus one and the loop limit, continue execution at the beginning of the loop. Otherwise, discard the loop parameters and continue execution immediately following the loop.
(loop)
is compiled by loop
.
See also: (+loop)
.
Source file: <src/kernel.z80s>.
(make-thru-index)
(make-thru-index) ( -- )
Create the blocks index, from first-locatable
to
last-locatable
.
(make-thru-index)
is a factor of make-thru-index
.
See also: use-thru-index
.
Source file: <src/lib/blocks.indexer.thru.fs>.
(options)
(options) ( i*x x -- j*x )
Run-time procedure compiled by options[
.
x = option to search for
Source file: <src/lib/flow.options-bracket.fs>.
(parse-esc-string)
(parse-esc-string) ( ca len "ccc<quote>" -- ca' len' )
Parse a text string delimited by a double quote,
translating some configurable characters that are escaped
with a backslash. Add the translated string to ca len,
returning a new string ca' len' in the stringer
.
(parse-esc-string)
is a factor of parse-esc-string
.
See also: set-esc-order
.
Source file: <src/lib/strings.escaped.fs>.
(pixel-pan-right
(pixel-pan-right ( -- a )
Return the address a of a Z80 routine that pans the whole screen one pixel to the right.
Note: The BC register (the Forth IP) is not preserved. This is intended, in order to save time when this routine is called in a loop. Therefore the calling code must save the BC register.
See also: pixel-pan-right
, pixel-scroll-up
.
Source file: <src/lib/graphics.scroll.fs>.
(pixel-scroll-up
(pixel-scroll-up ( -- a )
Return the address a of a Z80 routine that scrolls the whole screen one pixel up.
Note: The BC register (the Forth IP) is not preserved. This is intended, in order to save time when this routine is called in a loop. Therefore the calling code must save the BC register.
See also: pixel-scroll-up
.
Source file: <src/lib/graphics.scroll.fs>.
(rename-file
(rename-file ( -- ior )
Rename the file named by the filename stored in ufia1
to
the filename stored in ufia2
. and return error result
ior.
(rename-file
is a factor of `rename-file
.
Source file: <src/lib/dos.gplusdos.fs>.
(source-id)
(source-id) ( -- a )
A variable that contains the value returned by source-id
.
Source file: <src/kernel.z80s>.
(step)
(step)
The run-time procedure compiled by step
.
Run-time: ( R: n — n' )
If the loop index is zero, discard the loop parameters and continue execution after the loop. Otherwise decrement the loop index and continue execution at the beginning of the loop.
Source file: <src/lib/flow.for.fs>.
(substitution
(substitution ( ca1 len1 -- ca2 )
Given a string ca1 len1 create its definition in
substitute-wordlist
its substitution and return the
address of its storage space in data space, not allocated.
(substitution
is a common factor of substitution
and
xt-substitution
.
See also: substitution
, xt-substitution
, replaces
.
Source file: <src/lib/strings.replaces.fs>.
(tape-file>)
(tape-file>) ( -- )
Read a tape file using the data stored at tape-header
.
(tape-file>)
is a factor of tape-file>
.
Source file: <src/lib/tape.fs>.
(user)
(user) ( +n "name" -- )
Create a user variable name. +n is the offset within the user area where the value for name is stored. Execution of name leaves its absolute user area storage address.
(user)
is a factor of ucreate
.
Origin: user
in fig-Forth, Forth-79 (Reference Word Set)
and Forth-83 (Uncontrolled Reference Words).
Source file: <src/kernel.z80s>.
(warning")
(warning") ( f -- )
Inner procedure compiled by warning"
. If f is not
zero, print the compiled message; else do nothing.
Source file: <src/lib/exception.fs>.
(~~)
(~~) ( nt n u -- )
If the content of ~~?
is not zero, execute the debugging
code that was compiled by ~~
during the definition of
word nt in line n of block u.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
)
) ( f -- )
End an assertion.
)
is an immediate
word.
Origin: Gforth.
See: assert(
.
Source file: <src/lib/tool.debug.assert.fs>.
*
* ( n1|u1 n2|u2 -- n3|u3 )
Multiply n1|u1 by n2|u2 giving the product n3|u3.
Origin: fig-Forth, Forth-79, Forth-83, Forth-94, Forth-2012.
Source file: <src/kernel.z80s>.
*!
*! ( n|u a -- )
Multiply n|u by the single-cell number at a and store the product in a
Source file: <src/lib/memory.MISC.fs>.
*/
*/ ( n1 n2 n3 -- n4 )
Multiply n1 by n2 producing the intermediate d. Divide d by n3 giving the quotient n4.
Definition:
: */ ( n1 n2 n3 -- n4 ) */mod nip ;
Origin: fig-Forth, Forth-79, Forth-94, Forth-2012.
Source file: <src/kernel.z80s>.
*/-
*/- ( n1 n2 n3 -- n4 )
Multiply n1 by n2 producing the intermediate result d. Divide d by n3 (doing a symmetric division), giving the symmetric quotient n4.
Source file: <src/lib/math.operators.1-cell.fs>.
*/-rem
*/-rem ( n1 n2 n3 -- n4 n5 )
Multiply n1 by n2 producing the intermediate result d. Divide d by n3 (doing a symmetric division), giving the remainder n4 and the symmetric quotient n5.
Source file: <src/lib/math.operators.1-cell.fs>.
*/_
*/_ ( n1 n2 n3 -- n4 )
Multiply n1 by n2 producing the intermediate result d. Divide d by n3 (doing a floored division), giving the floored quotient n4.
Source file: <src/lib/math.operators.1-cell.fs>.
*/_mod
*/_mod ( n1 n2 n3 -- n4 n5 )
Multiply n1 by n2 producing the intermediate result d. Divide d by n3 (doing a floored division), giving the remainder n4 and the floored quotient n5.
Source file: <src/lib/math.operators.1-cell.fs>.
*/mod
*/mod ( n1 n2 n3 -- n4 n5 )
Multiply n1 by n2 producing the intermediate result d. Divide d by n3 producing the remainder n4 and the quotient n5.
Definition:
: */mod ( n1 n2 n3 -- n4 n5 ) >r m* r> m/ ;
Origin: fig-Forth, Forth-79, Forth-94, Forth-2012.
Source file: <src/kernel.z80s>.
+!
+! ( n|u a -- )
Add n|u to the single-cell number at a.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
+3dos
+3dos ( -- )
An alias of noop
that is defined only in the +3DOS version
of Solo Forth. Its goal is to be used to check the DOS the
application is running on.
+3dos
is an immediate
word.
Source file: <src/kernel.z80s>.
+ato
+ato ( n1 n2 "name" -- )
Add n1 to element n2 of 1-dimension single-cell values array name.
+ato
is an immediate
word.
Source file: <src/lib/data.array.value.fs>.
+beep>note
+beep>note ( +n1 -- +n2 +n3 )
Convert a Sinclair BASIC BEEP’s positive pitch +n1 to its corresponding note +n3 (0..11) in octave +n2, being zero the middle octave.
See also: beep>note
, -beep>note
, /octave
.
Source file: <src/lib/sound.48.fs>.
+branch
+branch ( n -- )
A run-time procedure to branch conditionally. If n is positive, the following in-line address is copied to IP to branch forward or backward.
See also: -while
.
Source file: <src/lib/flow.branch.fs>.
+cato
+cato ( c n "name" -- )
Add c to element n of 1-dimension character values array name.
+cato
is an immediate
word.
Source file: <src/lib/data.array.value.fs>.
+exit
+exit ( n -- ) ( R: nest-sys | -- nest-sys | )
If n is positive, return control to the calling definition, specified by nest-sys.
+exit
is not intended to be used within a do-loop. Use
0>= if unloop exit then
instead.
In Solo Forth +exit
can be used in interpretation mode to
stop the interpretation of a block.
Source file: <src/lib/flow.conditionals.positive.fs>.
+field
+field ( n1 n2 "name -- n3 )
Create a definition for name with the execution semantics
defined below. Return n3 = n1 + n2 where n1 is the
offset in the data structure before +field
executes,
and n2 is the size of the data to be added to the data
structure. n1 and n2 are in address units.
name execution: ( a1 — a2 )
Add n1 to a1 giving a2.
+field
is not required to align items. This is
deliberate and allows the construction of unaligned data
structures for communication with external elements such as
a hardware register map or protocol packet. Field
alignment has been left to the appropriate field
definition, e.g. field:
, 2field:
, cfield:
.
In Solo Forth, +field
is an unitialized deferred word,
for which three implementations are provided:
+field-unopt
, +field-opt-0
and +field-opt-0124
.
Origin: Forth-2012 (FACILITY EXT).
See also: begin-structure
.
Source file: <src/lib/data.begin-structure.fs>.
+field-opt-0
+field-opt-0 ( n1 n2 "name" -- n3 )
Optimized implementation of +field
. This implementation
is more efficient than +field-unopt
(but less than
+field-opt-0124
) because the field 0 does not calculate
the field offset.
+field-opt-0
uses 31 bytes of data space.
Source file: <src/lib/data.begin-structure.fs>.
+field-opt-0124
+field-opt-0124 ( n1 n2 "name" -- n3 )
Optimized implementation of +field
that optimizes the
calculation of field offsets 0, 1, 2 and 4. Therefore it is
more efficient than +field-unopt
and +field-opt-0
, but
it uses 106 bytes of data space and needs case
.
Source file: <src/lib/data.begin-structure.fs>.
+field-unopt
+field-unopt ( n1 n2 "name" -- n3 )
Unoptimized implementation of +field
. This
implementation is less efficient than +field-opt-0
and
+field-opt-0124
because the field offset is calculated
also when it is 0.
The advantage of this implementation is it uses only 22 bytes of data space, so it could be useful in some cases.
Source file: <src/lib/data.begin-structure.fs>.
+if
+if ( n -- )
Faster and smaller alternative to the idiom 0>= if
.
+if
is an immediate
and compile-only
word.
Source file: <src/lib/flow.conditionals.positive.fs>.
+load
+load ( n -- )
Load the block that is n blocks from the current one.
Source file: <src/lib/blocks.fs>.
+loop
+loop ( -- ) Compilation: ( do-sys -- )
+loop
is an immediate
and compile-only
word.
Origin: Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
See also: loop
.
Source file: <src/kernel.z80s>.
+order
+order ( wid -- )
Remove all instances of the word list identified by wid from the search order, then add it to the top.
Source file: <src/lib/word_lists.fs>.
+origin
+origin ( n -- a )
Leave the memory address relative by n bytes to the origin
parameter area. +origin
is used to access or modify the
boot-up parameters at the origin area.
Origin: fig-Forth.
Source file: <src/kernel.z80s>.
+perform
+perform ( a n -- )
Execute the execution token pointed by an offset of n cells from base address a, i.e., execute the contents of element n of the cell table that starts at a.
If the execution token is zero, do nothing.
Source file: <src/lib/flow.MISC.fs>.
+place
+place ( ca1 len1 ca2 -- )
Add the string ca1 len1 to the end of the counted string ca2.
Source file: <src/lib/strings.MISC.fs>.
+seclusion
+seclusion ( wid1 wid2 -- wid1 wid2 )
Start more private definitions of a seclusion
module.
See also: -seclusion
, end-seclusion
.
Source file: <src/lib/modules.MISC.fs>.
+stringer
+stringer ( -- a )
A variable that holds the pointer of the stringer
, i.e. an
offset to its first free address. The offset equals the number
of free characters in the stringer
.
See also: empty-stringer
.
Source file: <src/kernel.z80s>.
+thru
+thru ( u1 u2 -- )
Load consecutively the blocks that are u1 blocks through u2 blocks from the current one.
Source file: <src/lib/blocks.fs>.
+toarg
+toarg ( -- )
Set the add action for the next local variable. Used with
locals created by arguments
.
Loading +toarg
makes @
the default action of
arguments
locals, which is hold in arg-default-action
.
See also: toarg
.
Source file: <src/lib/locals.arguments.fs>.
+under
+under ( n1|u1 n2|u2 x -- n3|u3 x )
Add n2|u2 to n1|u2, giving the sum n3|u3.
+under
is written in Z80. Its definition in Forth
is the following:
: +under ( n1|u1 n2|u2 x -- n3|u3 x ) >r + r> ;
Origin: Comus.
See also: under+
Source file: <src/lib/math.operators.1-cell.fs>.
+until
+until ( n -- )
Faster and smaller alternative to the idiom 0>= until
.
+until
is an immediate
and compile-only
word.
Source file: <src/lib/flow.conditionals.positive.fs>.
+while
+while ( n -- )
Faster and smaller alternative to the idiom 0>= while
.
+while
is an immediate
and compile-only
word.
Source file: <src/lib/flow.conditionals.positive.fs>.
,"
," ( "ccc<quote>" -- )
Parse "ccc" delimited by a double-quote and compile the string.
Definition:
: ," ( -- ) '"' parse s, ;
Source file: <src/kernel.z80s>.
,np
,np ( x -- )
Store x into the address pointed by the name-space pointer, advancing the name-space pointer.
Source file: <src/kernel.z80s>.
-!
-! ( n|u a -- )
Subtract n|u from the single-cell number at a.
Source file: <src/lib/memory.MISC.fs>.
-->
--> ( -- ) \ "next-screen"
Continue interpretation with the next block.
-→
is an immediate
word.
Definition:
: --> ( -- ) ?loading refill 0= #-35 ?throw ; immediate
Origin: fig-Forth, Forth-79 (Reference Word Set), Forth-83 (Controlled Reference Words).
Source file: <src/kernel.z80s>.
-1
-1 ( -- -1 )
Return -1. -1
is not a constant, but a code word, which
is faster.
Source file: <src/kernel.z80s>.
-1..1
-1..1 ( -- -1|0|1 )
Return a random number: -1, 0 or 1.
See also: -1|1
, rnd
, fast-random
.
Source file: <src/lib/random.fs>.
-1|1
-1|1 ( -- -1|1 )
Return a random number: -1 or 1.
See also: -1..1
, rnd
, fast-random
.
Source file: <src/lib/random.fs>.
-beep>note
-beep>note ( -n1 -- -n2 +n3 )
Convert a Sinclair BASIC BEEP’s negative pitch -n1 to its corresponding note +n3 (0..11) in octave -n2, being zero the middle octave.
See also: beep>note
, +beep>note
, /octave
.
Source file: <src/lib/sound.48.fs>.
-block-drives
-block-drives ( -- )
Fill block-drives
with not-block-drive
, making no disk
drive be used as block drive.
See also: set-block-drives
, get-block-drives
.
Source file: <src/lib/dos.COMMON.fs>.
-branch
-branch ( n -- )
A run-time procedure to branch conditionally. If n is negative, the following in-line address is copied to IP to branch forward or backward.
See also: +while
.
Source file: <src/lib/flow.branch.fs>.
-do
-do Compilation: ( -- do-sys )
Compile (-do)
and leave do-sys to be consumed by loop
or +loop
. -do
is an alternative to do
and ?do
,
to create count-down loops with +loop
.
-do
is an immediate
and compile-only
word.
Definition:
: -do ( -- do-sys ) postpone (-do) >mark ; immediate compile-only
Usage example:
: -count-down ( limit start -- ) -do i . -1 +loop ; 0 0 -count-down \ prints nothing 4 0 -count-down \ prints nothing 0 4 -count-down \ prints 4 3 2 1 \ Compare to: : ?count-down ( limit start -- ) ?do i . -1 +loop ; 0 0 ?count-down \ prints nothing 4 0 ?count-down \ prints 0 -1..-32768 32767..4 0 4 ?count-down \ prints 4 3 2 1 0 : count-down ( limit start -- ) do i . -1 +loop ; 0 0 count-down \ prints 0 4 0 count-down \ prints 0 -1..-32768 32767..4 0 4 count-down \ prints 4 3 2 1 0
Origin: Gforth.
Source file: <src/lib/flow.do.fs>.
-exit
-exit ( n -- ) ( R: nest-sys | -- nest-sys | )
If n is negative, return control to the calling definition, specified by nest-sys.
-exit
is not intended to be used within a do-loop. Use
0< if unloop exit then
instead.
In Solo Forth -exit
can be used in interpretation mode to
stop the interpretation of a block.
Source file: <src/lib/flow.conditionals.negative.fs>.
-filename
-filename ( -- )
Blank the filename in ufia
, i.e. replace it with spaces.
See also: /filename
, set-filename
.
Source file: <src/lib/dos.gplusdos.fs>.
-if
-if ( f -- )
Faster and smaller alternative to the idiom 0< if
.
-if
is an immediate
and compile-only
word.
Source file: <src/lib/flow.conditionals.negative.fs>.
-leading
-leading ( ca len -- ca' len' )
Adjust the start and length of a string to suppress the leading blanks.
Source file: <src/kernel.z80s>.
-mixer
-mixer ( -- )
Disable the noise and tone mixers for the three channels of the AY-3-8912 sound generator.
Source file: <src/lib/sound.128.fs>.
-move
-move ( ca n -- )
Move a line of text from ca to line n of current block.
Source file: <src/lib/editor.specforth.fs>.
-order
-order ( wid -- )
Remove all instances of word list identified by wid from the search order.
Source file: <src/lib/word_lists.fs>.
-prefix
-prefix ( ca1 len1 ca2 len2 -- ca1 len1 | ca3 len3 )
Remove prefix ca2 len2 from string ca1 len1.
Source file: <src/lib/strings.MISC.fs>.
-rem
-rem ( n1 n2 -- n3 )
Divide n1 by n2 (doing a symmetric division), giving the remainder n3.
Source file: <src/lib/math.operators.1-cell.fs>.
-seclusion
-seclusion ( wid1 wid2 -- wid1 wid2 )
Start the public definitions of a seclusion
module.
See also: +seclusion
, end-seclusion
.
Source file: <src/lib/modules.MISC.fs>.
-suffix
-suffix ( ca1 len1 ca2 len2 -- ca1 len1 | ca3 len3 )
Remove suffix ca2 len2 from string ca1 len1.
Source file: <src/lib/strings.MISC.fs>.
-tape-filename
-tape-filename ( -- )
Blank tape-filename
in tape-header
.
Source file: <src/lib/tape.fs>.
-text
-text ( ca1 len1 ca2 -- f )
Return a non-zero f if string ca1 len1 exactly match string ca2 len1, else return a false flag.
Source file: <src/lib/editor.specforth.fs>.
-trailing
-trailing ( ca1 len1 -- ca1 len2 )
Adjust the length of a string to suppress the trailing blanks.
If len is greater than zero, len2 is equal to len1 less the number of spaces at the end of the character string specified by ca1 len1. If len1 is zero or the entire string consists of spaces, len2 is zero.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (STRING), Forth-2012 (STRING).
Source file: <src/kernel.z80s>.
-until
-until ( n -- )
Faster and smaller alternative to the idiom 0< until
.
-until
is an immediate
and compile-only
word.
Source file: <src/lib/flow.conditionals.negative.fs>.
-while
-while ( f -- )
Faster and smaller alternative to the idiom 0< while
.
-while
is an immediate
and compile-only
word.
Source file: <src/lib/flow.conditionals.negative.fs>.
.
. ( n -- )
Print signed integer n according to current base
, followed
by only one blank.
Source file: <src/kernel.z80s>.
."
."
Compilation: ( "ccc<quote>" — )
Parse "ccc" delimited by a double-quote. Append the run-time semantics given below to the current definition.
Run-time: ( -- )
Display "ccc".
."
is an immediate
and compile-only
word.
Definition:
: ." ( "ccc<quote> -- ) compile (.") ," ; immediate
Origin: Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
.\"
.\" ( Compilation: "ccc<quote>" -- ) ( Run-time: -- ca len )
.\"
is an immediate
and compile-only
word.
Note: When .\"
is loaded, esc-standard-chars-wordlist
is set as the only word list in esc-order
. That is the
standard behaviour. Alternative escaped chars can be
configured with esc-block-chars-wordlist
and
esc-udg-chars-wordlist
.
See also: parse-esc-string
, set-esc-order
, s\"
.
Source file: <src/lib/strings.escaped.fs>.
.context
.context ( -- )
Display the word lists in the search order in their search order sequence, from first searched to last searched.
Source file: <src/lib/tool.list.word_lists.fs>.
.current
.current ( -- )
Display the compilation word list.
See also: get-current
, .wordlist
, order
.
Source file: <src/lib/tool.list.word_lists.fs>.
.gil-heap
.gil-heap ( -- )
Print the map of the current memory heap
, in the
implementation based on code written by Javier Gil, whose
words are defined in gil-heap-wordlist
.
Occupied chunks are marked with a 'x'; free chunks are marked with a '-'.
Source file: <src/lib/memory.allocate.gil.fs>.
.index
.index ( u -- )
Print the first line of the block u, which conventionally contains a comment with a title.
Source file: <src/lib/tool.list.blocks.fs>.
.line
.line ( n1 n2 -- )
Print line n1 from block n2, without trailing spaces.
Origin: fig-Forth.
Source file: <src/lib/tool.list.blocks.fs>.
.line#
.line# ( n -- )
Print line number n right-aligned in a field whose width depends on the current radix (decimal, hex or binary).
Source file: <src/lib/tool.list.blocks.fs>.
.throw
.throw ( n -- )
Deferred word that prints error message n. By default it prints only the number.
Source file: <src/kernel.z80s>.
.throw#
.throw# ( n -- )
Print the number of throw error n, as a decimal number, prefixed with a '#' and followed by a space.
Source file: <src/kernel.z80s>.
.throw-message
.throw-message ( n -- )
Extended action of the deferred word .throw
: Print the
text of throw error n. The variable
errors-block
holds the number of the first
block where messages are hold. If it contains zero, only
the error number is printed.
Source file: <src/lib/exception.fs>.
.unused
.unused ( -- )
Display the total RAM in the system, and the amount of space
remaining in the regions addressed by here
and np
, in
address units.
Source file: <src/kernel.z80s>.
.word
.word ( nt -- )
A deferred word whose default action is (.word)
. This
word is used by words
, words-like
and wordlist-words
,
therefore their output can be changed by the user in
special cases, for example when more details are needed for
debugging.
Source file: <src/lib/tool.list.words.fs>.
.wordlist
.wordlist ( wid -- )
If the word list identified by wid has an associated name, display it; else display wid.
See also: wordlists
.
Source file: <src/lib/tool.list.word_lists.fs>.
.wordname
.wordname ( nt -- )
An alternative action for the deferred word .word
,
which is used by words
, words-like
and
wordlist-words
. .wordname
prints nt and its
correspondent name.
Source file: <src/lib/tool.list.words.fs>.
.xs
.xs ( -- )
Display the number of items on the current xstack
, followed
by a list of the items, if any; TOS is the right-most item.
Source file: <src/lib/data.xstack.fs>.
/
/ ( n1 n2 -- n3 )
Divide n1 by n2, giving the quotient n3.
Definition:
: / ( n1 n2 -- n3 ) /mod nip ;
Origin: fig-Forth, Forth-79, Forth-94, Forth-2012.
Source file: <src/kernel.z80s>.
/!
/! ( n a -- )
Divide n by the single-cell number at a and store the quotient in a
Source file: <src/lib/memory.MISC.fs>.
/-
/- ( n1 n2 -- n3 )
Divide n1 by n2 (doing a symmetric division), giving the symmetric quotient n4.
Source file: <src/lib/math.operators.1-cell.fs>.
/-rem
/-rem ( n1 n2 -- n3 n4 )
Divide n1 by n2 (doing a symmetric division), giving the remainder n3 and the symmetric quotient n4.
Source file: <src/lib/math.operators.1-cell.fs>.
/_
/_ ( n1 n2 -- n3 )
Divide n1 by n2 (doing a floored division), giving the floored quotient n4.
Source file: <src/lib/math.operators.1-cell.fs>.
/_mod
/_mod ( n1 n2 -- n3 n4 )
Divide n1 by n2 (doing a floored division), giving the remainder n3 and the floored quotient n4.
Source file: <src/lib/math.operators.1-cell.fs>.
/_mod
/_mod ( n1 n2 -- n3 )
Divide n1 by n2 (doing a floored division), giving the remainder n3.
Source file: <src/lib/math.operators.1-cell.fs>.
/accept
/accept ( -- a )
A variable that holds the buffer max length used by
the latest execution of accept
.
Source file: <src/lib/keyboard.MISC.fs>.
/bank
/bank ( -- n )
n is the size in bytes of a memory bank: $4000.
See also: bank-start
.
Source file: <src/kernel.z80s>.
/counted-string
/counted-string ( -- n )
n is the maximum size of a counted string, in characters.
See also: max-char
, environment?
.
Source file: <src/lib/environment-question.fs>.
/filename
/filename ( -- b )
A constant that returns the maximum length of a G+DOS filename.
See also: set-filename
.
Source file: <src/lib/dos.gplusdos.fs>.
/heap
/heap ( -- n )
Size of the current heap
, in address units.
See also: get-heap
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
/hold
/hold ( -- len )
A character constant that returns the length of the pictured
output string buffer, which is located right below pad
.
Source file: <src/kernel.z80s>.
/kk
/kk ( -- n )
A constant that holds the bytes ocuppied by every key in
the kk-ports
table: 3 (smaller and slower table) or 4
(bigger and faster table).
The application can define /kk
before loading this block;
else it will be defined as a cconstant with value 4.
Source file: <src/lib/keyboard.MISC.fs>.
/line#
/line# ( -- # )
Maximum length of a line number in the current radix. It works for decimal, hex and binary.
Source file: <src/lib/tool.list.blocks.fs>.
/mod
/mod ( n1 n2 -- n3 n4 )
Divide n1 by n2, giving the remainder n3 and the quotient n4.
Origin: fig-Forth, Forth-79, Forth-94, Forth-2012.
See also: du/mod
.
Source file: <src/kernel.z80s>.
/name
/name ( ca1 len1 -- ca2 len2 ca3 len3 )
Split string ca1 len1 into ca2 len2 (from the start of the first name in ca1 len1) and ca3 len3 (from the char after the first name in _ca1 len1). A name is a substring separated by spaces.
See also: first-name
, /string
, -prefix
, -suffix
,
string/
.
Source file: <src/lib/strings.MISC.fs>.
/octave
/octave ( -- c )
A constant that returns the number of notes in one octave: 12.
See also: middle-octave
.
Source file: <src/lib/sound.48.fs>.
/pad
/pad ( -- n )
n is the size of the scratch area pointed to by pad
, in
characters.
See also: /hold
, environment?
.
Source file: <src/lib/environment-question.fs>.
/qx
/qx ( -- n )
n is the number of header lines shown on a quick index. It depends on the rows and columns of the current screen mode.
See also: qx
.
Source file: <src/lib/tool.list.blocks.fs>.
/qx-column
/qx-column ( -- n )
n is the width of a column of the quick index. It depends on the columns (32, 42, 64…) of the current screen mode.
See also: qx
, qx-columns
.
Source file: <src/lib/tool.list.blocks.fs>.
/sound
/sound ( -- b )
A character constant that returns 14, the number of registers used by the 128K sounds.
Source file: <src/lib/sound.128.fs>.
/string
/string ( ca1 len1 n -- ca2 len2 )
Adjust the character string ca1 len1 by n characters. The resulting character string ca2 len2 begins at ca1 plus n characters and is len1 minus n characters long.
/string
is written in Z80. Equivalent definitions in Forth
are the following:
: /string ( ca1 len1 n -- ca2 len2 ) rot over + -rot - ;
: /string ( ca1 len1 n -- ca2 len2 ) dup >r - swap r> + swap ;
Origin: Forth-94 (STRING), Forth-2012 (STRING).
Source file: <src/kernel.z80s>.
/stringer
/stringer ( -- n )
A constant that holds the maximum size of the stringer
, in
characters.
See also: +stringer
, empty-stringer
, `default-stringer'.
Source file: <src/kernel.z80s>.
/tabulate
/tabulate ( -- a )
A variable that holds the number of spaces that tabulate
counts for. Its default value is 8.
See tabulate
.
Source file: <src/lib/display.control.fs>.
/tape-filename
/tape-filename ( -- n )
n is the maximum length of a tape filename, which is 10 characters.
See also: tape-filename
. /filename
.
Source file: <src/lib/tape.fs>.
/tape-header
/tape-header ( -- n )
n is the length of a tape-header
: 17 bytes.
Source file: <src/lib/tape.fs>.
/udg
/udg ( -- b )
b is the size of a UDG (User Defined Graphic), in bytes.
Source file: <src/lib/graphics.udg.fs>.
/ufia
/ufia ( -- n )
n is the length of a UFIA (User File Information Area), a 24-byte structure which describes a file.
Source file: <src/lib/dos.gplusdos.fs>.
/user
/user ( -- n )
n is the length of the user area.
See also: up
.
Source file: <src/kernel.z80s>.
/window
/window ( -- n )
A constant that holds the size in bytes n occupied by the data of one window.
Source file: <src/lib/display.window.fs>.
0
0 ( -- 0 )
Return 0. 0
is not a constant, but a code word, which is
faster.
Source file: <src/kernel.z80s>.
0.r
0.r ( n -- )
Print signed integer n according to current base, without any trailing blank.
Source file: <src/kernel.z80s>.
0<
0< ( x -- f )
f is true if and only if n is less than zero.
Origin: Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
0<=
0<= ( n -- f )
f is true if and only if n is less than or equal to zero.
Source file: <src/lib/math.operators.1-cell.fs>.
0<>
0<> ( x -- f )
f is true if and only if x is not equal to zero.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
See also: 0=
.
Source file: <src/kernel.z80s>.
0=
0= ( x -- f )
f is true if and only if x is equal to zero.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
0>
0> ( n -- f )
f is true if and only if n is greater than zero.
Origin: Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
0>=
0>= ( n -- f )
f is true if and only if n is greater than or equal to zero.
Source file: <src/lib/math.operators.1-cell.fs>.
0branch
0branch ( f -- )
A run-time procedure to branch conditionally. If f is false (zero), the following in-line address is copied to IP to branch forward or backward.
Origin: fig-Forth.
Source file: <src/kernel.z80s>.
0d.r
0d.r ( d -- )
Print signed double integer d according to current base, without any trailing blank.
Source file: <src/kernel.z80s>.
0exit
0exit ( f -- ) ( R: nest-sys | -- nest-sys | )
If f is zero, return control to the calling definition, specified by nest-sys.
0exit
is not intended to be used within a do-loop. Use
0= if unloop exit then
instead.
In Solo Forth 0exit
can be used in interpretation mode to
stop the interpretation of a block.
Source file: <src/lib/flow.conditionals.zero.fs>.
0if
0if ( f -- )
Faster and smaller alternative to the idiom 0= if
.
0if
is an immediate
and compile-only
word.
Source file: <src/lib/flow.conditionals.zero.fs>.
0max
0max ( n -- n | 0 )
If n is negative, return 0; else return n. This is a
faster alternative to the idiom 0 max
.
Source file: <src/lib/math.operators.1-cell.fs>.
0until
0until ( f -- )
Faster and smaller alternative to the idiom 0= until
.
0until
is an immediate
and compile-only
word.
Source file: <src/lib/flow.conditionals.zero.fs>.
0while
0while ( f -- )
Faster and smaller alternative to the idiom 0= while
.
0while
is an immediate
and compile-only
word.
Source file: <src/lib/flow.conditionals.zero.fs>.
1
1 ( -- 1 )
Return 1. 1
is not a constant, but a code word, which is
faster.
Source file: <src/kernel.z80s>.
1/string
1/string ( ca1 len1 -- ca1+1 len1-1 )
Adjust the character string ca1 len1 by 1 character.
1/string
is equivalent to the idiom 1 /string
but
faster (0.9 the execution time).
See also: /string
.
Source file: <src/kernel.z80s>.
16bin.
16bin. ( n -- )
Display n as an unsigned 16-bit binary number.
Source file: <src/lib/display.numbers.fs>.
16hex.
16hex. ( d -- )
Display d as an unsigned 16-bit hexadecimal number.
Source file: <src/lib/display.numbers.fs>.
1array
1array ( n1 n2 "name" -- )
Define a 1-dimension array name with n1 items of n2 address units each.
See also: }
, array>items
, 2array
.
Source file: <src/lib/data.array.noble.fs>.
1line
1line ( -- f )
Scan the cursor line for a match to pad
text. Return flag
and update the cursor r#
to the end of matching text, or
to the start of the next line if no match is found.
Source file: <src/lib/editor.specforth.fs>.
1literal
1literal ( x -- )
1literal
is used in interpret-table
to compile the
single-cell literals. It is useful as an alternative to
literal
, in order to optimize the code when x is unknown.
1literal
is an immediate
and compile-only
word.
Definition:
: 1literal ( x -- ) dup byte? if postpone cliteral exit then postpone literal ; immediate compile-only
Source file: <src/kernel.z80s>.
2
2 ( -- 2 )
Return 2. 2
is not a constant, but a code word, which is
faster.
Source file: <src/kernel.z80s>.
2!
2! ( x1 x2 a -- )
Store the cell pair x1 x2 at a, with x2 at a and x1
at the next consecutive cell. It is equivalent to the sequence
swap over ! cell+ !
.
Origin: Forth-79 (Double Number Word Set), Forth-83 (Double Number Extension Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
2!>
2!> Interpretation: ( xd "name" -- ) Compilation: ( "name" -- ) Run-time: ( xd -- ) "two-store-to"
2!>
is an immediate
word.
Interpretation:
Compilation:
Parse name, which is a word created by 2constant
or
2const
, and append the run-time semantics given below to
the current definition.
Run-time:
Make xd the current value of double-cell constant name.
Origin: IsForth’s !>
.
Source file: <src/lib/data.store-to.fs>.
2*
2* ( x1 -- x2 )
x2 is the result of shifting x1 one bit toward the most-significant bit, filling the vacated least-significant bit with zero.
2*
is equivalent to 1 lshift
.
Origin: Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
2*!
2*! ( a -- )
Do a 2*
shift to the single-cell number at a.
Source file: <src/lib/memory.MISC.fs>.
2/
2/ ( x1 -- x2 )
x2 is the result of shifting x1 one bit toward the least-significant bit, leaving the most-significant bit unchanged.
This is the same as s>d 2 fm/mod swap drop
. It is not
the same as 2 /
, nor is it the same as 1 rshift
.
Origin: Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/lib/math.operators.1-cell.fs>.
2/!
2/! ( a -- )
Do a 2/
shift to the single-cell number at a.
Source file: <src/lib/memory.MISC.fs>.
2>x
2>x ( x1 x2 -- ) ( X: -- x1 x2 )
Move the cell pair x1 x2 from the data stack to the
current xstack
.
Source file: <src/lib/data.xstack.fs>.
2@
2@ ( a -- x1 x2 )
Fetch the cell pair x1 x2 stored at a. x2 is stored at
a and x1 is stored at the next consecutive cell. It is
equivalent to the sequence dup cell+ @ swap @
.
Origin: Forth-79 (Double Number Word Set), Forth-83 (Double Number Extension Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
2@+
2@+ ( a -- a' xd )
Fetch xd from a. Return a', which is a incremented by two cells. This is handy for stepping through double-cell arrays.
Source file: <src/lib/memory.MISC.fs>.
2array
2array ( n1 n2 n3 "name" -- )
Define a 2-dimension array name with n1 x n2 items of n3 address units each.
Source file: <src/lib/data.array.noble.fs>.
2array>
2array> ( n a1 -- a2 )
Return address a2 of element n of a 1-dimension
single-cell array a1. 2array>
is a common factor of
2avalue
and 2avariable
.
2array>
is written in Z80. Its equivalent definition in
Forth is the following:
: 2array> ( n a1 -- a2 ) swap [ 2 cells ] literal * + ;
Source file: <src/lib/data.array.COMMON.fs>.
2ato
2ato ( xd n "name" -- )
Store xd into element n of 1-dimension double-cell values array name.
2ato
is an immediate
word.
Source file: <src/lib/data.array.value.fs>.
2avalue
2avalue ( n "name" -- )
Create a 1-dimension double-cell values array name with n elements and the execution semantics defined below.
name execution:
name ( n — xd )
Return contents xd of element n.
Source file: <src/lib/data.array.value.fs>.
2avariable
2avariable ( n "name" -- )
Create a 1-dimension double-cell variables array name with n elements and the execution semantics defined below.
name execution:
name ( n — a )
Return address a of element n.
See also: avariable
, cavariable
, far2avariable
.
Source file: <src/lib/data.array.variable.fs>.
2const
2const ( x1 x2 "name" -- )
Create a double fast constant name, with value x1 x2.
A double fast constant works like an ordinary 2constant
,
except its value is compiled as a literal.
Origin: IsForth’s const
.
Source file: <src/lib/data.const.fs>.
2constant
2constant ( x1 x2 "name -- )
Create a definition for name with the executions semantics defined below:
name is referred to as a two-constant.
name Execution: ( — x1 x2 )
Place cell pair x1 x2 on the stack.
Origin: Forth-79 (Double Number Word Set), Forth-83 (Double Number Extension Word Set), Forth-94 (DOUBLE), Forth-2012 (DOUBLE).
Source file: <src/kernel.z80s>.
2dup
2dup ( x1 x2 -- x1 x2 x1 x2 )
Duplicate cell pair x1 x2.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
2entry:
2entry: ( dx wid "name" -- )
Create a double-cell entry "name" in associative list wid, with value dx.
Source file: <src/lib/data.associative-list.fs>.
2field:
2field: ( n1 "name" -- n2 )
Parse name. offset is the first double-cell aligned value greater than or equal to n1. n2 = offset + 2 cells.
Create a definition for name with the execution semantics defined below.
name execution: ( a1 — a2 )
Add the offset calculated during the compile-time action to a1 giving the address a2.
See also: begin-structure
, +field
.
Source file: <src/lib/data.begin-structure.fs>.
2literal
2literal ( dx -- )
Compile dx in the current definition.
2literal
is an immediate
and compile-only
word.
Definition:
: 2literal ( dx -- ) postpone 2lit 2, ; immediate compile-only
Source file: <src/kernel.z80s>.
2ndrop
2ndrop ( dx1..dxn n -- )
Drop n double cell items from the stack.
Source file: <src/lib/data_stack.fs>.
2storer
2storer ( xd a "name" -- )
Define a word name which, when executed, will cause that xd be stored at a.
Origin: variant of the word set
found in Forth-79
(Reference Word Set) and Forth-83 (Appendix B.
Uncontrolled Reference Words).
Source file: <src/lib/data.storer.fs>.
2switch
2switch ( xd switch -- )
Execute the switch switch for the key xd.
Source file: <src/lib/flow.switch-colon.fs>.
2toval
2toval ( -- )
Change the default behaviour of words created by 2val
:
make them store a new value instead of returning its actual
one.
Source file: <src/lib/data.val.fs>.
2user
2user ( "name" -- )
Create a user double variable name in the first available offset within the user area. Execution of name leaves its absolute user area storage address.
Source file: <src/lib/data.user.fs>.
2val
2val ( x1 x2 "name" -- )
Create a definition for name that will place x1 x2 on
the stack (unless 2toval
is used first) and then will
execute init-2val
.
2val
is an alternative to the standard 2value
.
Source file: <src/lib/data.val.fs>.
2value
2value ( x1 x2 "name" -- )
Create a definition name with the following execution semantics: place x1 x2 on the stack.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/data.value.fs>.
2variable
2variable ( "name" -- )
Parse name. Create a definition for name with the execution semantics defined below. Reserve two consecutive cells of data space.
name is referred to as a two-variable.
name Execution: ( — a )
a is the address of the first (lower address) cell of two consecutive cells. A program is responsible for initializing the contents.
Origin: Forth-79 (Double Number Word Set), Forth-83 (Double Number Extension Word Set), Forth-94 (DOUBLE), Forth-2012 (DOUBLE).
Source file: <src/kernel.z80s>.
2x>
2x> ( -- x1 x2 ) ( X: x1 x2 -- )
Move the cell pair x1 x2 from the current xstack
to
the data stack.
Source file: <src/lib/data.xstack.fs>.
2x@
2x@ ( -- x1 x2 ) ( X: x1 x2 -- x1 x2 )
Copy the cell pair x1 x2 from the current xstack
to the
data stack.
Source file: <src/lib/data.xstack.fs>.
2xdrop
2xdrop ( X: x1 x2 -- )
Remove the cell pair x1 x2 from the current xstack
.
See also: xdrop
.
Source file: <src/lib/data.xstack.fs>.
2xdup
2xdup ( X: x1 x2 -- x1 x2 x1 x2 ) xover xover ; ?)
Duplicate the cell pair x1 x2 in the current xstack
.
See also: xdup
.
Source file: <src/lib/data.xstack.fs>.
32bin.
32bin. ( d -- )
Display d as an unsigned 32-bit binary number.
Source file: <src/lib/display.numbers.fs>.
32hex.
32hex. ( d -- )
Display d as an unsigned 32-bit hexadecimal number.
Source file: <src/lib/display.numbers.fs>.
3dup
3dup ( x1 x2 x3 -- x1 x2 x3 x1 x2 x3 )
3dup
is written is Z80. An equivalent definition in
Forth is the following:
: 3dup ( x1 x2 x3 -- x1 x2 x3 x1 x2 x3 ) dup 2over rot ;
Source file: <src/lib/data_stack.fs>.
8*
8* ( x1 -- x2 )
x2 is the result of shifting x1 three bits toward the most-significant bit, filling the vacated least-significant bit with zero.
This is the same as 3 lshift
or 2* 2* 2*
, but
faster.
Source file: <src/lib/math.operators.1-cell.fs>.
8bin.
8bin. ( n -- )
Display n as an unsigned 8-bit binary number.
Source file: <src/lib/display.numbers.fs>.
8hex.
8hex. ( d -- )
Display d as an unsigned 8-bit hexadecimal number.
Source file: <src/lib/display.numbers.fs>.
:
: ( "name" -- -sys )
Parse name. Create a definition for name, called a "colon
definition". Enter compilation state
and start the
current definition. Append the initiation semantics given
below to the current definition.
Initiation: ( i*x — i*x ) ( R: — nest-sys )
Save implementation-dependent information nest-sys about the calling definition. The stack effects i*x represent arguments to name.
name execution: ( i*x — j*x )
Execute the definition name. The stack effects i*x and j*x represent arguments to and results from name, respectively.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
:2clause
:2clause ( xd switch -- )
Start the definition of a switch clause xd for switch switch.
Source file: <src/lib/flow.switch-colon.fs>.
::
:: ( class "name" -- )
Compile the method for the selector name of the class class (not immediate!).
Source file: <src/lib/objects.mini-oof.fs>.
:cclause
:cclause ( switch -- )
Start the definition of a switch clause c for switch switch.
Source file: <src/lib/flow.switch-colon.fs>.
:clause
:clause ( x switch -- )
Start the definition of a switch clause x for switch switch.
Source file: <src/lib/flow.switch-colon.fs>.
:noname
:noname ( -- xt )
Create an execution token xt. Enter compilation state and start the current definition, which can be executed later by using xt.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/define.MISC.fs>.
:switch
:switch ( xt "name" -- head )
Create a code switch whose default action is given by xt. Leave the address of the head of its list on the stack.
The head of the switch structure is the address of a 2-cell structure:
-
link (to the last clause of the switch)
-
default xt
Source file: <src/lib/flow.bracket-switch.fs>.
;
; Compilation: ( -- ) Run-time: ( -- ) ( R: nest-sys -- )
Compilation: Append the run-time semantics below to the current definition. End the current definition, allow it to be found in the dictionary and enter interpretation state.
Run-time: Return to the calling definition specified by nest-sys.
;
is an immediate
and compile-only
word.
Definition:
: ; ( -- ) postpone exit finish-code ;
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
See also: exit
, :
, finish-code
, ;code
.
Source file: <src/kernel.z80s>.
;]
;] Compilation: ( orig xt1 -- ) Run-time: ( -- xt2 )
End a quotation started by [:
.
;]
is an immediate
and compile-only
word.
Compilation: ( orig xt1 — )
End the current nested definition, and resume compilation
to the previous (containing) current definition, identified
by xt1. Resolve the branch from orig left by [:
.
Append the following run-time to the (containing) current
definition:
Run-time: ( — xt2 )
xt2 is the execution token of the nested definition.
Source file: <src/lib/flow.bracket-colon.fs>.
;code
;code ( -- )
Stop compilation and terminate a new defining word by
compiling the run-time routine (;code)
.
;code
is an immediate
and compile-only
word.
Origin: fig-Forth, Forth-79 (Assembler Word Set), Forth-83 (Assembler Extension Word Set), Forth-94 (TOOLS EXT), Forth-2012 (TOOLS EXT).
Source file: <src/lib/define.MISC.fs>.
<
< ( n1 n2 -- f )
f is true if and only if n1 is less than n2.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
<=
<= ( n1 n2 -- f )
f is true if and only if n1 is less than or equal to n2.
Source file: <src/lib/math.operators.1-cell.fs>.
<=>
<=> ( n1 n2 -- -1|0|1 )
If n1 equals n2, return zero. If n1 is less than n2, return negative one. If n1 is greater than n2, return positive one.
Source file: <src/lib/math.operators.1-cell.fs>.
<>
<> ( x1 x2 -- f )
f is true only and only if x1 is not bit-for-bit the same as x1.
Origin: Forth-79 (Reference Word Set), Forth-83 (Uncontrolled Reference Words), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
<bin
<bin ( -- )
Start a code zone where binary radix is the default, by
saving the current value of base
to base'
and executing
binary
. The zone is finished by bin>
.
See also: <hex
.
Source file: <src/lib/display.numbers.fs>.
<hex
<hex ( -- )
Start a code zone where hexadecimal radix is the default,
by save the current value of base
to base'
and
executing hex
. The zone is finished by hex>
.
Origin: lina.
See also: <bin
.
Source file: <src/lib/display.numbers.fs>.
<mark
<mark ( -- a )
Leave the address of the current data-space pointer, as the
the destination of a backward branch. a is typically
only used by <resolve
to compile a branch address.
Origin: Forth-83 (System Extension Word Set).
Source file: <src/kernel.z80s>.
<resolve
<resolve ( dest -- )
Resolve a backward branch. Compile a branch address using
dest, the address left by <mark
, as the destination
address. Used at the source of a backward branch after either
branch
or ?branch
or 0branch
.
Origin: Forth-83 (System Extension Word Set).
Source file: <src/kernel.z80s>.
<switch
<switch ( head xt n -- head )
Define a new clause to execute xt when the key n is matched.
The switch clauses are 3-cell structures:
-
link (to the previous clause of the switch)
-
key
-
xt
Source file: <src/lib/flow.bracket-switch.fs>.
=
= ( x1 x2 -- f )
f is true only and only if x1 is bit-for-bit the same as x1.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
>
> ( n1 n2 -- f )
f is true if and only if n1 is greater than n2.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
>2bstring
>2bstring ( xd -- ca len )
Convert xd to a 2-cell binary string in pad
.
ca len contains xd "as is", as stored in memory.
Source file: <src/lib/strings.MISC.fs>.
>=
>= ( n1 n2 -- f )
f is true if and only if n1 is greater than or equal to n2.
Source file: <src/lib/math.operators.1-cell.fs>.
>accept
>accept ( -- a )
A variable that holds the offset of the cursor in the
string being edited by accept
.
Source file: <src/lib/keyboard.MISC.fs>.
>action
>action ( xt -- a )
Return the address a that holds the execution token currently associated to the deferred word xt.
Source file: <src/kernel.z80s>.
>amark
>amark ( -- a )
Leave the address of an assembler absolute forward reference.
Source file: <src/lib/assembler.fs>.
>aresolve
>aresolve ( a -- )
Resolve an assembler absolute forward reference.
See also: >amark
.
Source file: <src/lib/assembler.fs>.
>body
>body ( xt -- dfa )
dfa is the data-field address corresponding to xt.
If xt is for a word defined by create
, dfa is the
address that here
would have returned had it been
executed immediately after the execution of the create
that defined xt.
If xt is for a word defined by variable
, 2variable
,
cvariable
, constant
, 2constant
and cconstant
, dfa
is the address that holds their value.
If xt is for a word defined by :
, dfa is the address
of its compiled definition.
If xt is for a word defined by code
, dfa makes no
sense.
dfa is always in data space.
Origin: Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
See also: body>
.
Source file: <src/lib/compilation.fs>.
>bstring
>bstring ( x -- ca len )
Convert x to a 1-cell binary string ca len in pad
.
ca len contains x "as is", as stored in memory.
Source file: <src/lib/strings.MISC.fs>.
>digit
>digit ( n -- c )
Convert a number to its character digit: 0..9A..Z.
Definition:
: >digit ( n -- c ) dup 9 > [ 'A' '0' - 1+ ] literal and + '0' + ;
Source file: <src/kernel.z80s>.
>drive-block
>drive-block ( u1 -- u2 )
Convert block u1 to its equivalent u2 in its corresponding disk drive, which is set the current drive.
>drive-block
is a deferred word whose default action is
noop
. Its action is set to (>drive-block
when
set-block-drives
is loaded.
Source file: <src/kernel.z80s>.
>esc-order
>esc-order ( wid -- )
Push wid on the escaped strings search order.
See also: set-esc-order
, get-esc-order
,
esc-standard-chars-wordlist
,
esc-block-chars-wordlist
,
esc-udg-chars-ẁordlist
.
Source file: <src/lib/strings.escaped.fs>.
>file
>file ( ca1 len1 ca2 len2 -- ior )
Save memory region ca1 len1 to a file named by the string ca2 len2, and return error result ior.
Source file: <src/lib/dos.gplusdos.fs>.
>in
>in ( -- a )
A user variable that contains the offset in characters from the start of the input buffer to the start of the parse area.
Source file: <src/kernel.z80s>.
>mark
>mark ( -- orig )
Compile space in the dictionary for a branch address which
will later be resolved by >resolve
.
Origin: Forth-83 (System Extension Word Set).
Source file: <src/kernel.z80s>.
>name
>name ( xt -- nt | 0 )
Try to find the name token nt of the word represented by execution token xt. Return 0 if it fails.
>name
searches all definition headers, from the oldest one
to the newest one, for the first one whose xtp (execution
token pointer) contains xt. This way, when a word has
additional headers created by alias
or synonym
, its
original name is found first.
Origin: Gforth.
Source file: <src/kernel.z80s>.
>number
>number ( ud1 ca1 len1 -- ud2 ca2 len2 )
ud2 is the unsigned result of converting the characters
within the string specified by ca1 len1 into digits, using
the number in base
, and adding each into ud1 after
multiplying ud1 by the number in base
. Conversion
continues left-to-right until a character that is not
convertible, including any "+" or "-", is encountered or the
string is entirely converted. ca2 is the location of the
first unconverted character or the first character past the
end of the string if the string was entirely converted. len2
is the number of unconverted characters in the string.
Definition:
: >number ( d1 ca1 len1 -- d2 ca2 len2 ) begin dup while over c@ base @ digit? while >r 2swap r> swap base @ um* drop rot base @ um* d+ 2swap 1 /string repeat then ;
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
>order
>order ( wid -- )
Push word list identifier wid on the search order.
Definition:
: >order ( wid -- ) also context ! ;
Origin: Gforth.
Source file: <src/kernel.z80s>.
>printable-ascii-char
>printable-ascii-char ( c1 -- c1 | c2 )
If character c1 is a printable ASCII character, return
it, else return the character returned by
default-printable-ascii-char
.
See also: printable-ascii-char?
.
Source file: <src/lib/chars.fs>.
>resolve
>resolve ( orig -- )
Resolve a forward branch by placing the address of the current
data-space pointer into the space compiled by >mark
.
Origin: Forth-83 (System Extension Word Set).
Source file: <src/kernel.z80s>.
>stringer
>stringer ( ca1 len1 -- ca2 len1 )
Copy string ca1 len1 to the stringer
and return it as ca2
len1.
Definition:
: >stringer ( ca1 len1 -- ca2 len1 ) dup allocate-stringer swap 2dup 2>r move 2r> ;
See also: allocate-stringer
, far>stringer
.
Source file: <src/kernel.z80s>.
>tape-file
>tape-file ( ca1 len1 ca2 len2 -- )
Write a memory region ca1 len1 into a tape file ca2 len2.
See also: tape-file>
, (>tape-file)
, >file
.
Source file: <src/lib/tape.fs>.
>ufia1
>ufia1 ( a -- )
Move a UFIA (User File Information Area) from a to
ufia1
.
Source file: <src/lib/dos.gplusdos.fs>.
>ufia2
>ufia2 ( a -- )
Move a UFIA (User File Information Area) from a to
ufia2
.
Source file: <src/lib/dos.gplusdos.fs>.
>ufiax
>ufiax ( a1 a2 -- )
Move a UFIA (User File Information Area) from a1 to a2, with the Plus D Memory paged in.
Source file: <src/lib/dos.gplusdos.fs>.
>x
>x ( x -- ) ( X: -- x )
Move x from the data stack to the xstack
.
Source file: <src/lib/data.xstack.fs>.
?(
?( ( f "ccc<space><question><paren><space>" -- )
If f is not zero, parse and discard until ?)
is found or
until the end of the parse area is reached.
?(
is used for conditional compilation, as a simpler but
more compact alternative to the standard [if]
.
?(
is an immediate
word.
Definition:
: ?( ( f "ccc<space><question><paren><space>" -- ) 0= ?exit begin parse-name dup while s" ?)" str= ?exit repeat 2drop ; immediate
See also: ?]>>`, `<<entry28, pass:c[(
.
Source file: <src/kernel.z80s>.
?)
?) ( -- )
Do nothing. ?(
parses until ?)
is found.
?)
is an immediate
word.
Source file: <src/kernel.z80s>.
?-->
?--> ( f -- )
If f is not false, continue interpretation on the next
sequential block. parse area. ?-→
is used for
conditional compilation.
?-→
is an immediate
word.
See also: -->
.
Source file: <src/lib/blocks.fs>.
??
?? ( Compilation: "name" -- ) ( Runtime: f -- )
??
is an immediate
and compile-only
word.
Compilation:
Parse name and search the current search order for it.
If not found, throw exception #-13. If found and it’s an
immediate
word, execute it, else compile it.
Runtime:
If f is not zero, execute name, which was compiled.
Source file: <src/lib/flow.MISC.fs>.
pass:c[?\]
?\ ( f "ccc<eol>" -- )
If f is not zero, execute pass:c[\]
, else do nothing.
?\
is an immediate
word.
?\
is a conditional version of ]>>`, used for conditional
compilation, as a simpler but more compact alternative to the
standard `<<entry5B69665D, pass:c[[if]
.
Definition:
: ?\ ( "ccc<eol>" -- ) if postpone \ then ; immediate
See also: ?(
.
Source file: <src/kernel.z80s>.
?block-drive#
?block-drive# ( u -- )
If u is not-block-drive
, throw exception #-35 ("invalid
block number").
See also: (>drive-block
, block-drives
, ?drive#
,
?drives
.
Source file: <src/lib/dos.COMMON.fs>.
?branch
?branch ( f -- )
A run-time procedure to branch conditionally. If f is not false (not zero), the following in-line address is copied to IP to branch forward or backward.
Note
|
This is not Forth-83’s ?branch , which is equivalent
to fig-Forth’s 0branch , which is a more logical name to
represent the action: branch if zero. Solo Forth borrows
0branch from fig-Forth, and completes the branches after a
logical naming convention shared with optional control flow
words, e.g. ?exit , 0exit , -exit …
|
Source file: <src/kernel.z80s>.
?ccase
?ccase Compilation: ( C: -- orig ) Run-time: ( c ca len --)
Start a ?ccase
..end?ccase
structure. If c is in the
string ca len, execute the n-th word compiled after
?ccase
, where n is the position of the first c in
the string (0..len-1), then continue after end?ccase
. If
c is not in ca len, just continue after end?ccase
.
?ccase
is an immediate
and compile-only
word.
Usage example:
: .a ( -- ) ." Letter A" ; : .b ( -- ) ." Letter B" ; : .c ( -- ) ." Letter C" ; : letter ( c -- ) s" abc" ?ccase .a .b .c end?ccase ." The End" cr ;
Source file: <src/lib/flow.ccase.fs>.
?compiling
?compiling ( -- )
Throw exception #-14 if not compiling.
Source file: <src/lib/exception.fs>.
?csp
?csp ( -- )
Throw error #-264 (definition not finished) if the current data stack
position does not match the value saved by !csp
.
Origin: fig-Forth.
Source file: <src/kernel.z80s>.
?defined
?defined ( f -- )
If f is false, throw exception code #-13 (not found).
Source file: <src/kernel.z80s>.
?dictionary
?dictionary ( -- )
Issue an error message if the dictionary is out of bounds.
Source file: <src/kernel.z80s>.
?dnegate
?dnegate ( d1 n -- d1|d2 )
If n is negative, negate d1, giving its arithmetic inverse d2.
?dnegate
is written in Z80. Its equivalent definition in
Forth is the following:
: ?dnegate ( d1 n -- d1|d2 ) 0< if dnegate then ;
Origin: fig-Forth’s d+-
.
See also: ?negate
.
Source file: <src/kernel.z80s>.
?do
?do Compilation: ( -- do-sys )
?do
is an immediate
and compile-only
word.
Definition:
: ?do ( -- do-sys ) postpone (?do) >mark ; immediate compile-only
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
?drive#
?drive# ( u -- )
If u is greater than the maximum number of disk drives, throw exception #-35 ("invalid block number").
See also: (>drive-block
, block-drives
, ?block-drive
,
?drives
.
Source file: <src/lib/dos.COMMON.fs>.
?drives
?drives ( n -- )
If n is greater than the maximum number of disk drives, throw exception #-287 ("wrong number of drives").
See also: set-block-drives
. ?block-drive
, ?drive#
.
Source file: <src/lib/dos.COMMON.fs>.
?esc-order
?esc-order ( n -- )
Check if n is a valid size for the escaped strings search order, else throw an exception.
See also: #esc-order
, esc-context
, >esc-order
,
set-esc-order
, get-esc-order
.
Source file: <src/lib/strings.escaped.fs>.
?executing
?executing ( -- )
Throw exception #-263 if not executing.
Source file: <src/lib/exception.fs>.
?exit
?exit ( f -- ) ( R: nest-sys | -- nest-sys | )
If f is zero, do nothing. Otherwise return control to the calling definition, specified by nest-sys.
?exit
is the conditional version of exit
.
?exit
can not be used within a loop
. Use if unloop
exit then
instead.
In Solo Forth ?exit
can be used in interpretation mode to
stop the interpretation of a block.
Source file: <src/kernel.z80s>.
?frames
?frames ( u -- )
Stop execution during at least u frames of the TV (there are 50 frames per second in in Europe and 60 frames per second in USA), or until a key is pressed.
Source file: <src/lib/time.fs>.
?index-block
?index-block ( block -- )
Index block block, if not done before.
See also: use-fly-index
.
Source file: <src/lib/blocks.indexer.fly.fs>.
?leave
?leave ( f -- ) ( R: loop-sys -- | loop-sys )
If f is non-zero, discard the loop-control parameters for
the current nesting level and continue execution
immediately following the innermost syntactically enclosing
loop
or +loop
.
Source file: <src/lib/flow.MISC.fs>.
?load
?load ( u f -- )
Load block u if flag f is true, else do nothing.
Origin: Pygmy Forth.
See also: load
.
Source file: <src/lib/blocks.fs>.
?located
?located ( n -- )
If n is zero, throw an exception #-268 ("needed, but not located").
Source file: <src/lib/002.need.fs>.
?name-too-short
?name-too-short ( ca len -- )
If name ca len is empty, throw exception #-16.
See also: header
.
Source file: <src/kernel.z80s>.
?negate
?negate ( n1 n2 -- n1|n3 )
If n2 is negative, negate n1, giving its arithmetic inverse n3.
?negate
is written in Z80. Its equivalent definition in
Forth is the following:
: ?negate ( n1 n2 -- n1|n3 ) 0< if negate then ;
Origin: fig-Forth’s +-
.
Source file: <src/kernel.z80s>.
?next-bank
?next-bank ( a -- a|a' )
If the actual far-memory address a ($C000..$FFFF) has increased to the next bank ($0000..$3FFF), convert it to the corresponding actual address a' ($C000..$FFFF) in the next bank and page in the next bank. Otherwise return a.
See also: ?next-bank_
, ?previous-bank
.
Source file: <src/kernel.z80s>.
?next-bank_
?next-bank_ ( -- a )
Address of the question_next_bank
routine of the kernel,
which does the following:
If the actual far-memory address ($C000..$FFFF) in the HL register has increased to the next bank ($0000..$3FFF), convert it to the correspondent actual address ($C000..$FFFF) in the next bank and page in the next bank, else do nothing.
This is the routine called by ?next-bank
.
?next-bank_
is used in code words.
Input:
-
HL = address in a paged bank ($C000..$FFFF) or higher ($0000..$BFFF).
Output when HL is above the paged bank:
-
HL = correspondent address in the next bank, which is paged in
-
A corrupted
-
D = 0
-
E = bank
Output when HL is an address in a paged bank:
-
HL preserved
-
A corrupted
Source file: <src/lib/memory.far.fs>.
?order
?order ( n -- )
If n is not a valid size for the search order, throw an exception.
Definition:
: ?order ( n -- ) dup 0< #-50 ?throw max-order < ?exit #-49 throw ;
Source file: <src/kernel.z80s>.
?pairs
?pairs ( x1 x2 -- )
If x1 not equals x2 throw error #-22 (control structure mismatch).
Source file: <src/lib/compilation.fs>.
?previous-bank
?previous-bank ( a -- a|a' )
If the actual far-memory address a ($C000..$FFFF) has decreased to the previous bank ($8000..$BFFF), convert it to the corresponding actual address a' ($C000..$FFFF) in the previous bank and page in the next bank. Otherwise return a.
See also: ?previous-bank_
, ?next-bank
.
Source file: <src/kernel.z80s>.
?previous-bank_
?previous-bank_ ( -- a )
Address of the question_previous_bank
routine of the
kernel, which does the followig:
If the actual far-memory address ($C000..$FFFF) in the HL register has decreased to the previous bank ($8000..$BFFF), convert it to the correspondent actual address ($C000..$FFFF) in the previous bank and page in the next bank, else do nothing.
This is the routine called by ?previous-bank
.
?previous-bank_
is used in code words.
Input:
-
HL = address in a paged bank ($C000..$FFFF) or lower ($8000..$BFFF).
Output when HL is below the paged bank:
-
HL = correspondent address in the previous bank, which is paged in
-
A corrupted
-
D = 0
-
E = bank
Output when HL is an address in a paged bank:
-
HL preserved
-
A corrupted
Source file: <src/lib/memory.far.fs>.
?rel
?rel ( n -- )
If assembler relative branch n is too long, throw exception #-269 (relative jump too long).
Source file: <src/lib/assembler.fs>.
?repeat
?repeat ( Compilation: dest -- dest ) ( Execution: f -- )
An alternative exit point for begin until
loops.
?repeat
is an immediate
word.
Usage example:
: xx ( -- ) begin ... flag ?repeat \ Go back to `<<entry626567696E, pass:c[begin]>>` if flag is false ... flag ?repeat \ Go back to `<<entry626567696E, pass:c[begin]>>` if flag is false ... flag until \ Go back to `<<entry626567696E, pass:c[begin]>>` if flag is false ... ;
Source file: <src/lib/flow.MISC.fs>.
?retry
?retry ( Compilation: -- ) ( Run-time: f -- )
Do a conditional branch to the start of the word.
?retry
is an immediate
and compile-only
word.
See also: retry
.
Source file: <src/lib/flow.MISC.fs>.
?rstack
?rstack ( -- )
Issue an error message if the return stack is out of bounds.
Origin: fig-Forth’s ?stack
.
See also: ?stack
.
Source file: <src/kernel.z80s>.
?seconds
?seconds ( u -- )
Wait at least u seconds or until a key is pressed.
Source file: <src/lib/time.fs>.
?set-tape-filename
?set-tape-filename ( ca len -- )
If filename ca len is not empty, store it into the tape
header by executing set-tape-filename
; else use a
wildcard instead, by executing any-tape-filename
.
Source file: <src/lib/tape.fs>.
?shift
?shift ( x1 n -- x1 | x2 )
If n is zero, drop it and return x1. If n is
negative, convert it to its absolute value and execute
rshift
, returning x2. If n is positive execute
lshift
, returning x2.
Source file: <src/lib/math.operators.1-cell.fs>.
?stack
?stack ( -- )
Issue an error message if the data stack is out of bounds.
Origin: fig-Forth.
See also: ?rstack
.
Source file: <src/kernel.z80s>.
?stringer
?stringer ( len -- )
Make sure there’s room in the stringer
for len characters.
Definition:
: ?stringer ( len -- ) dup unused-stringer > if empty-stringer then negate +stringer +! ;
See also: unused-stringer
, empty-stringer
, +stringer
.
Source file: <src/kernel.z80s>.
?throw
?throw ( f n -- )
If f is non-zero, throw
exception n
Definition:
: ?throw ( f n -- ) swap if throw else drop then ;
Source file: <src/kernel.z80s>.
?user
?user ( -- )
Throw an exception if the user area pointer is out of bounds.
Source file: <src/lib/data.user.fs>.
?warn
?warn ( ca len -- ca len | ca len xt )
Check if a warning about the redefinition of the word name ca len is needed. If no warning is needed, unnest the calling definition and return ca len. If a warning is needed, return ca len and the xt of the word found in the current compilation wordlist.
?warn
is factor of warn.throw
, warn.message
and
warn-throw
.
See also: no-warnings?
, not-redefined?
, warn.message
,
warn.throw
, warn-throw
.
Source file: <src/lib/compilation.fs>.
@
@ ( a -- x )
x is the value stored at a.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
@+
@+ ( a -- a' x )
Fetch x from a. Return a', which is a incremented by one cell. This is handy for stepping through cell arrays.
Source file: <src/lib/memory.MISC.fs>.
@a+
@a+ ( -- x )
Fetch cell at the address register and increment the address register by one cell.
Source file: <src/lib/memory.address_register.fs>.
@bank
@bank ( a n -- x )
Fetch x from address a ($C000..$FFFF) of bank n (0..7).
@bank
is written in Z80. Its equivalent definition in
Forth is the following:
: @bank ( a n -- x ) bank @ default-bank ;
Source file: <src/lib/memory.far.fs>.
@bit
@bit ( b ca -- f )
Fetch f from an element of a bit-array, represented by address ca and bitmask b.
@bit
is an alias of c@and?
.
Source file: <src/lib/data.array.bit.fs>.
@dos
@dos ( a -- x )
Fetch the cell x stored at Plus D memory address a.
Source file: <src/lib/dos.gplusdos.fs>.
@sound
@sound ( b1 -- b2 )
Get the contents b2 of sound register b1 (0…13).
See also: !sound
, sound
, play
, sound-register-port
.
Source file: <src/lib/sound.128.fs>.
@volume
@volume ( b1 -- b2 )
Fetch b2 from the volume register of channel b1 (0..2, equivalent to notation 'A'..'C').
Registers 8..10 (Channels A..C Volume)
Bits 0-4 Channel volume level.
Bit 5 1=Use envelope defined by register 13 and ignore the volume setting.
Bits 6-7 Not used.
Source file: <src/lib/sound.128.fs>.
@wordlists
@wordlists ( a -- )
Fetch the latest definition of every word list from a.
Source file: <src/lib/tool.marker.fs>.
Initialize
Initialize and link new task into `pause` chain.
Source file: <src/lib/multitask.muench-koh.fs>.
['']
[''] ( Compilation: "name" -- )
If name is found in the current search order, compile its execution-token pointer as a literal, else throw an exception.
['']
is an immediate
and compile-only
word.
Source file: <src/lib/compilation.fs>.
[']
['] ( Compilation: "name" -- )
Compilation: If name is found in the current search order, compile its execution token as a literal, else throw an exception.
[']
is an immediate
and compile-only
word.
Definition:
: ['] ( Compilation: "name" -- ) ' postpone literal ; immediate
Origin: Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
[+switch
[+switch ( "name" -- head )
Open the switch structure name to include additional
clauses. The default behavior remains unchanged. The
additions, like the original clauses, are terminated by
switch]
. Leave the head of the given switch name,
for clauses to append to.
Origin: SwiftForth.
Source file: <src/lib/flow.bracket-switch.fs>.
[1const]
[1const] ( "name" -- )
Evaluate name. Then compile the single-cell value left on
the stack, using 1literal
.
[1const]
is intented to compile constants as literals,
when it’s uncertain if the literal is a character or a
cell, in order to gain execution speed. name can be any
word, as long as its execution returns a single-cell value
on the stack.
Usage example:
48 constant zx : test ( -- ) [1const] zx . ;
[1const]
is an immediate
and compile-only
word.
Source file: <src/lib/compilation.fs>.
[2const]
[2const] ( "name" -- )
Evaluate name. Then compile the double-cell value left on the stack.
[2const]
is intented to compile double-cell constants
as literals, in order to gain execution speed.
Usage example:
48. 2constant zx : test ( -- ) [2const] zx d. ;
[2const]
is an immediate
and compile-only
word.
Source file: <src/lib/compilation.fs>.
[:
[: Compilation: ( -- orig xt )
Start a quotation.
Suspend compiling to the current definition, start a new
nested definition and compilation continues with this
nested definition. Return orig and the execution token
xt of of the host definition, both to be consumed by
;]
.
Note
|
Locals are not supported yet. |
[:
is an immediate
and compile-only
word.
Source file: <src/lib/flow.bracket-colon.fs>.
[cconst]
[cconst] ( "name" -- )
Evaluate name. Then compile the char left on the stack.
[cconst]
is intented to compile char constants as
literals, in order to gain execution speed.
Usage example:
48 cconstant zx : test ( -- ) [cconst] zx emit ;
[cconst]
is an immediate
and compile-only
word.
Source file: <src/lib/compilation.fs>.
[char]
[char]
Compilation: ( "name" — )
Parse "name" and append the run-time semantics given below to the current definition.
Run-time: ( — c )
Place c, the value of the first character of name, on the stack.
[char]
is an immediate
and compile-only
word.
Solo Forth recognizes the standard notation for
characters, so [char]
is not needed:
: test ( -- ) 'x' emit ." equals " [char] x emit ;
Origin: Forth-94 (CORE), Forth-2012 (CORE).
See also: char
.
Source file: <src/lib/parsing.fs>.
[comp']
[comp'] ( Compilation: "name" -- ) ( Run-time: -- x xt )
Compilation token x xt represents the compilation semantics of name.
[comp']
is an immediate
and compile-only
word.
Origin: Gforth.
Source file: <src/lib/compilation.fs>.
[compile]
[compile] ( "name" -- )
Parse name. Find name. If name has other than default compilation semantics, append them to the current definition; otherwise append the execution semantics of of name.
In other words: Force compilation of name. This allows
compilation of an immediate
word when it would otherwise
have been executed.
[compile]
is an immediate
word.
[compile]
has been be superseded by postpone
.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE EXT), Forth-2012 (CORE EXT, obsolescent).
Source file: <src/lib/compilation.fs>.
[const]
[const] ( "name" -- )
Evaluate name. Then compile the single-cell value left on the stack.
[const]
is intented to compile constants as literals,
in order to gain execution speed. name can be any word,
as long as its execution returns a single-cell value on the
stack.
Usage example:
48 constant zx : test ( -- ) [const] zx . ;
[const]
is an immediate
and compile-only
word.
Source file: <src/lib/compilation.fs>.
[defined]
[defined] ( "name" -- f )
Parse name. Return a true flag if name is the name of a word that can be found in the current search order; else return a false flag.
[defined]
is an immediate
word.
Definition:
: [defined] ( "name" -- f ) defined 0<> ; immediate
Origin: Forth-2012 (TOOLS EXT).
See also: defined
, [undefined]
.
Source file: <src/kernel.z80s>.
[else]
[else] ( "ccc" -- )
Parse and discard space-delimited words from the parse
area, including nested occurrences of [if] … [then]
,
and [if] … [else] … [then]
, until either the word
[else]
or the word [then]
has been parsed and
discarded. If the parse area becomes exhausted, it is
refilled as with refill
.
Origin: Forth-94 (TOOLS EXT), Forth-2012 (TOOLS EXT).
See also: [if]
.
Source file: <src/lib/compilation.fs>.
[if]
[if] ( f "ccc" -- )
If flag is true, do nothing. Otherwise, parse and discard
space-delimited words from the parse area, including nested
occurrences of [if] … [then]
, and [if] … [else]
… [then]
, until either the word [else]
or the word
[then]
has been parsed and discarded. If the parse
area becomes exhausted, it is refilled as with refill
.
[if]
is an immediate
word.
Origin: Forth-94 (TOOLS EXT), Forth-2012 (TOOLS EXT).
See also: ?]>>`, `<<entry3F28, pass:c[?(
.
Source file: <src/lib/compilation.fs>.
[needed]
[needed] ( "name" -- f )
Parse name. If there’s no unresolved need
, needed
,
reneed
or reneeded
, return true. Otherwise, if name
is the needed word specified by the last execution of
need
or needed
, return true, else return false.
[needed]
is an immediate
word.
Source file: <src/lib/002.need.fs>.
[switch
[switch ( "name1" "name2" -- head )
Start the definition of a switch structure name1
consisting of a linked list of single-precision numbers and
associated behaviors, with its default action name2.
The head of the switch is left on the stack for defining
clauses. The switch definition will be terminated by
switch]
, and can be extended by [+switch
.
Origin: SwiftForth.
Source file: <src/lib/flow.bracket-switch.fs>.
[then]
[then] ( -- )
Do nothing. [then]
is parsed and recognized by [if]
.
[then]
is an immediate
word.
Origin: Forth-94 (TOOLS EXT), Forth-2012 (TOOLS EXT).
Source file: <src/lib/compilation.fs>.
[undefined]
[undefined] ( "name" -- f )
Parse name. Return a false flag if name is the name of a word that can be found in the current search order; else return a true flag.
[undefined]
is an immediate
word.
Definition:
: [undefined] ( "name" -- f ) postpone [defined] 0= ; immediate
Origin: Forth-2012 (TOOLS EXT).
See also: [defined]
.
Source file: <src/kernel.z80s>.
[unneeded]
[unneeded] ( "name" -- f )
Parse name. If there’s no unresolved need
, needed
,
reneed
or reneeded
, return false. Otherwise, if name
is the needed word specified by the last execution of
need
or needed
, return false, else return true.
[unneeded]
is an immediate
word.
Source file: <src/lib/002.need.fs>.
pass:c[\]
\ ( "ccc<eol>" -- )
If blk
contains zero, parse and discard the remainder of the
parse area; otherwise parse and discard the portion of the
parse area corresponding to the remainder of the current line.
\
is an immediate
word.
Origin: Forth-94 (BLOCK EXT), Forth-2012 (BLOCK EXT).
Source file: <src/kernel.z80s>.
]1l
]1l ( x -- )
A short form of the idiom ] 1literal
.
]1l
is an immediate
and compile-only
word.
Source file: <src/lib/compilation.fs>.
]2l
]2l ( xd -- )
A short form of the idiom ] 2literal
.
]2l
is an immediate
and compile-only
word.
Source file: <src/lib/compilation.fs>.
]cl
]cl ( x -- )
A short form of the idiom ] cliteral
.
]cl
is an immediate
and compile-only
word.
Source file: <src/lib/compilation.fs>.
]l
]l ( x -- )
A short form of the idiom ] literal
.
]l
is an immediate
and compile-only
word.
Source file: <src/lib/compilation.fs>.
]options
]options ( a1 a2 a3 -- )
End a options[ ]options
structure. Resolve the addresses
left by options[
:
-
a1 = address of exit point
-
a2 = address of default option xt
-
a3 = address of number of options
See options[
for a usage example.
Source file: <src/lib/flow.options-bracket.fs>.
a
a ( -- a )
A variable that holds the address register.
Source file: <src/lib/memory.address_register.fs>.
aborted?
aborted? ( c -- f )
If no key is pressed return false. If a key is pressed, discard it and wait for a second key. Then return true if it’s c, else return false.
aborted?
is a useful factor of nuf?
.
Usage example:
: listing ( -- ) begin ." bla " bl aborted? until ." Aborted" ;
Source file: <src/lib/keyboard.MISC.fs>.
abs
abs ( n -- u )
Leave the absolute value u of a number n.
Definition:
: abs ( n -- u ) dup ?negate ;
Source file: <src/kernel.z80s>.
acat
acat ( -- )
Show an abbreviated disk catalogue of the current drive.
Source file: <src/lib/dos.gplusdos.fs>.
accept
accept ( ca1 len1 -- len2 )
Receive a string of at most len1 characters. No characters are received or transferred if len1 is zero. Display graphic characters as they are received.
Input terminates when an implementation-defined line terminator is received. When input terminates, nothing is appended to the string or displayed on the screen.
len2 is the length of the string stored at ca1.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
In Solo Forth accept
is a deferred word. Its default
action is simple-accept
, which provides only the basic
editing options. Alternative definitions are provided in the
library.
Source file: <src/kernel.z80s>.
accept-buffer
accept-buffer ( -- a )
A variable that holds the buffer address used by
the latest execution of accept
.
Source file: <src/lib/keyboard.MISC.fs>.
accept-xy
accept-xy ( -- a )
A double variable that holds the cursor position at the
start of the most recent accept
.
Source file: <src/lib/keyboard.MISC.fs>.
action-of
action-of ( -- ) Interpretation: ( "name" -- xt ) Compilation: ( "name" -- ) Runtime: ( -- xt )
Parse name, which is a word defined by
defer
. Return xt, which is the execution token that
name is set to execute.
Parse name, which is a word defined by
defer
. Append the runtime semantics given below to the
current definition.
Return xt, which is the execution token that name is set to execute.
action-of
is an immediate
word.
Origin: Forth-2012 (CORE EXT).
Source file: <src/lib/define.deferred.fs>.
activate
activate ( tid -- )
Activate the task identified by tid. activate
must be
used only in definition. The code following activate
must
not exit
. In other words it must be an infinite loop like
quit
.
Source file: <src/lib/multitask.muench-koh.fs>.
address-unit-bits
address-unit-bits ( -- n )
n is the size of one address unit, in bits.
See also: max-char
, environment?
.
Source file: <src/lib/environment-question.fs>.
adraw176
adraw176 ( gx gy -- )
Draw a line from the current coordinates to the given absolute coordinates gx gy, using only the top 176 pixel rows of the screen (the lower 16 pixel rows are not used). gx is 0..255; gy is 0..175.
Source file: <src/lib/graphics.lines.fs>.
again
again ( dest -- )
End of an infinite loop. Compile an unconditional jump instruction to branch backward to dest.
again
is an immediate
and compile-only
word.
Source file: <src/kernel.z80s>.
ahead
ahead Compilation: ( C: -- orig ) Run-time: ( -- )
ahead
is an immediate
and compile-only
word.
Origin: Forth-94 (TOOLS EXT), Forth-2012 (TOOLS EXT).
Source file: <src/kernel.z80s>.
al#
al# ( -- )
Create an absolute reference to an assembler label defined
by l:
. The label number has been compiled in the last cell
of the latest Z80 instruction. If the corresponding label
is already defined, its value is patched into the latest
Z80 instruction. Otherwise it will be patched after the
label has been defined by l:
.
Usage example:
code my-code ( -- ) #2 call, al# \ a call to label #2 nop, #2 l: \ definition of label #2 ret, end-code
Warning
|
al# is used after the Z80 command, while its
counterpart rl# is used before the Z80 command.
|
Source file: <src/lib/assembler.labels.fs>.
al-id
al-id ( -- b )
Identifier of absolute references created by al#
.
rl-ad
is used as a bitmask added to the label number
stored in l-refs
.
See also: rl-id
.
Source file: <src/lib/assembler.labels.fs>.
alias
alias ( xt "name" -- )
Create an alias name that will execute xt.
Aliases have the execution token xt of the original word,
but, contrary to synonyms created by synonym
, don’t
inherit its attributes (immediate
and compile-only
).
Origin: Gforth.
Source file: <src/lib/define.alias.fs>.
align
align ( -- )
If the data-space pointer is not aligned, reserve enough space to align it.
In Solo Forth, align
does nothing (it’s an immediate
alias of noop
), because the Z80 processor does not need
addresses be cell-aligned.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/lib/memory.MISC.fs>.
aligned
aligned ( a1 -- a2 )
a2 is the first aligned address greater than or equal to a1.
In Solo Forth, aligned
does nothing (it’s an
immediate
alias of noop
), because the Z80 processor
does not need addresses be cell-aligned.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
See also: align
.
Source file: <src/lib/memory.MISC.fs>.
aline176
aline176 ( gx gy -- )
Draw a line from the current coordinates to the given absolute coordinates gx gy, using only the top 176 pixel rows of the screen (the lower 16 pixel rows are not used) and preserving the current attributes of the screen. gx is 0..255; gy is 0..175.
aline176
is faster than adraw176
.
See also: rdraw176
.
Source file: <src/lib/graphics.lines.fs>.
allocate
allocate ( u -- a ior )
Allocate u address units of contiguous data space. The data-space pointer is unaffected by this operation. The initial content of the allocated space is undefined.
If the allocation succeeds, a is the aligned starting address of the allocated space and ior is zero.
If the operation fails, a does not represent a valid address and ior is an exception code.
allocate
is a deferred word whose action can be
charlton-allocate
or gil-allocate
, depending on the
heap
implementation used by the application.
Origin: Forth-94 (MEMORY), Forth-2012 (MEMORY).
See also: free
, resize
, empty-heap
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
allocate-stringer
allocate-stringer ( len -- ca )
Allocate len characters in the circular string buffer and return the address ca of the allocated space.
Definition:
: allocate-stringer ( len -- ca ) ?stringer stringer unused-stringer + ;
See also: >stringer
, stringer
, ?stringer
,
unused-stringer
.
Source file: <src/kernel.z80s>.
allocate-xstack
allocate-xstack ( n -- a )
Create an xstack
in the heap. n is the size in
cells. Return its address a.
See also: xfree
, allocate-xstack
.
Source file: <src/lib/data.xstack.fs>.
allot
allot ( n -- )
If n is greater than zero, reserve n address units of data space. If n is less than zero, release n address units of data space. If n is zero, leave the data-space pointer unchanged.
Definition:
: allot ( n -- ) dp +! ;
Origin: fig-Forth, Forth-79, Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
allot-heap
allot-heap ( n -- a )
Create a heap
of n address units in the data space.
Return its address a.
See also: limit-heap
, bank-heap
, farlimit-heap
,
empty-heap
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
allot-xstack
allot-xstack ( n -- a )
Create an xstack
in data space. n is the size in
cells. Return its address a.
See also: allocate-xstack
.
Source file: <src/lib/data.xstack.fs>.
allotted
allotted ( n -- a )
Reserve n address units of data space and return its address a.
Source file: <src/lib/memory.MISC.fs>.
also
also ( -- )
Duplicate the word list at the top of the search order.
Definition:
: also ( -- ) get-order over swap 1+ set-order ;
Origin: Forth-83 (Experimental proposals), Forth-94 (SEARCH EXT), Forth-2012 (SEARCH-EXT).
Source file: <src/kernel.z80s>.
ambulance
ambulance ( n -- )
Ambulance sound for ZX Spectrum 48K. Make it n times.
Source file: <src/lib/sound.48.fs>.
and
and ( x1 x2 -- x3 )
x3 is the bit-by-bit logical "and" of x1 with x2.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
anon
anon Compilation: ( n -- ) Run-time: ( -- a )
Compilation: Compile a reference to cell n (0 index) of
the buffer pointed by anon>
.
Run-time: Return address a of cell n (0 index) of the
buffer that was pointed by anon>
during the compilation.
anon
is an immediate
and compile-only
word.
Source file: <src/lib/locals.anon.fs>.
anon>
anon> ( -- a )
A variable. a contains the address of the buffer used by
local variables defined by set-anon
and accessed by
anon
.
anon>
must be set by the application before compiling a
word that uses set-anon
and anon
. One single buffer
pointed by anon>
can be shared by several words,
provided they dont’t need to use it at the same time, e.g.
because of nesting.
Source file: <src/lib/locals.anon.fs>.
any-of
any-of Compilation: ( C: -- of-sys ) Run-time: ( x0 x1..xn n -- | x0 )
Compilation:
Put of-sys onto the control flow stack. Append the
run-time semantics given below to to the current
definition. The semantics are incomplete until resolved by
a consumer of of-sys, such as endof
.
Run-time:
A variant of of
. If x0 equals any of x1..xn, discard
x1..xn n and continue execution at the location specified
by the consumer of of-sys, e.g., following the next
endof
. Otherwise, consume also x0 and continue
execution in line.
Usage example:
: test ( n -- ) case 1 of ." one" endof 2 7 10 3 any-of ." two, seven or ten" endof 6 of ." six" endof endcase ;
Source file: <src/lib/flow.case.fs>.
any-tape-filename
any-tape-filename ( -- )
Configure tape-header
to load any filename, by replacing
the first char of tape-filename
with 255, which will be
recognized as a wild card.
Source file: <src/lib/tape.fs>.
any?
any? ( x[0] x[1]..x[n] n -- f )
Is any x[1]..x[n] equal to x[0]?
Origin: John A. Peters' tools for CP/M F83 2.1.1, 1984.
Source file: <src/lib/math.operators.1-cell.fs>.
arg-action
arg-action ( -- a )
A variable. a holds the execution token of the action
performed by the locals defined by arguments
. Its
default value is stored in arg-default-action
. The
content of arg-default-action
is copied to arg-action
by arguments
, and also every time a local variable is
used.
Source file: <src/lib/locals.arguments.fs>.
arg-default-action
arg-default-action ( -- a )
A variable. a holds the execution token of the default
action performed by the locals defined by arguments
. Its
default value is zero, which means "no action" (noop
can
be used too, but arg-default-action off
is simpler than
' noop arg-defaul-action !
).
The content of arg-default-action
is copied to
arg-action
by arguments
, and also every time a local
variable is used.
See also: arg-action
.
Source file: <src/lib/locals.arguments.fs>.
arguments
arguments ( i*x +n -- j*x )
Define the number +n of arguments to take from the stack
and assign them to the first local variables from l0
to
l9
. By default, local variables are manipulated with
@
, !
and +!
, like ordinary variables. They are
returned with results
.
Example: The phrase 3 arguments
assigns the names of
local variables l0
through l9
to ten stack
positions, with l0
, l1
and l2
returning the
address of the top 3 stack values that were there before 3
arguments
was executed. l3
through l9
are
zero-filled and the stack pointer is set to just below
l9
. After all calculating is done, the phrase 3
results
leaves that many results on the stack relative to
the stack position when arguments
was executed. All
intermediate stack values are lost, which is good because
you can leave the stack "dirty" and it doesn’t matter.
Usage example:
: test ( length width height -- length' volume surface ) 3 arguments l0 @ l1 @ * l5 ! \ surface l5 @ l2 @ * l4 ! \ volume $2000 l0 +! \ length+$2000 l4 @ l1 ! \ volume l5 @ l2 ! \ surface 3 results ;
When toarg
or +toarg
are loaded, they change the
default behaviour of locals: Then l0
through l9
return their contents, not their addresses. To write them
you precede them with the word toarg
. For example 5
toarg l4
writes a 5 into l4
. Execution of l4
returns 5 to the stack. To add a number to a local
variable, you precede it with the word +toarg
. For
example, 5 +toarg l4
adds 5 to the current content of
l4
.
Example:
need toarg need +toarg : test ( length width height -- length' volume surface ) 3 arguments l0 l1 * toarg l5 \ surface l5 l2 * toarg l4 \ volume $2000 +toarg l0 \ add $2000 to length l4 toarg l1 \ volume l5 toarg l2 \ surface 3 results ;
The default action of local variables (either return its
address or its value) is hold in arg-default-action
, as
an execution token.
arguments
is a compile-only
word.
Source file: <src/lib/locals.arguments.fs>.
array>
array> ( n a1 -- a2 )
Return address a2 of element n of a 1-dimension
single-cell array a1. array>
is a common factor of
avalue
and avariable
.
array>
is written in Z80. Its equivalent definition in
Forth is the following:
: array> ( n a1 -- a2 ) swap cells + ;
Source file: <src/lib/data.array.COMMON.fs>.
array>items
array>items ( a -- n )
Convert address of array a to its number of items n.
See also: 1array
.
Source file: <src/lib/data.array.noble.fs>.
ascii-char?
ascii-char? ( c -- f )
Is character c an ASCII character, i.e. in the range 0..126?
Source file: <src/lib/chars.fs>.
assembler
assembler ( -- )
Replace the first word list in the search order with
assembler-wordlist
.
Origin: Forth-79 (Assembler Word Set), Forth-83 (Assembler Extension Word Set), Forth-94 (TOOLS EXT), Forth-2012 (TOOLS EXT).
Source file: <src/lib/assembler.fs>.
assembler-wordlist
assembler-wordlist ( -- wid )
Return wid, the identifier of the word list that includes the words defined as part of the assembler.
See also: assembler
, wordlist
, set-order
, forth-wordlist
,
root-wordlist
.
Source file: <src/kernel.z80s>.
assert(
assert( ( -- )
Start a normal assertion. Normal assertion are turned on
by default. assert(
is equivalent to assert1(
.
assert(
is an immediate
word.
Origin: Gforth.
See also: assert-level
, assert0(
, assert1(
,
assert2(
, assert3(, `)
.
Source file: <src/lib/tool.debug.assert.fs>.
assert-level
assert-level ( -- a )
Variable that holds the highest assertions that are turned on (0..3). Its default value is 1: all assertions above 1 are turned off.
Origin: Gforth.
See also: assert(
.
Source file: <src/lib/tool.debug.assert.fs>.
assert0(
assert0( ( -- )
Start an important assertion. Important assertions should always be turned on.
assert0(
is an immediate
word.
Origin: Gforth.
See also: assert-level
, assert(
, assert1(
, assert2(
,
assert3(, `)
.
Source file: <src/lib/tool.debug.assert.fs>.
assert1(
assert1( ( -- )
Start a normal assertion. Normal assertions are turned on by default.
assert1(
is an immediate
word.
Origin: Gforth.
See also: assert-level
, assert(
, assert0(
, assert2(
,
assert3(, `)
.
Source file: <src/lib/tool.debug.assert.fs>.
assert2(
assert2( ( -- )
Start a debugging assertion.
assert2(
is an immediate
word.
Origin: Gforth.
See also: assert-level
, assert(
, assert0(
, assert1(
,
assert3(, `)
.
Source file: <src/lib/tool.debug.assert.fs>.
assert3(
assert3( ( -- )
Start a slow assertion. Slow assertions are those you may not want to turn on in normal debugging; you would turn them on mainly for thorough checking.
assert3(
is an immediate
word.
Origin: Gforth.
Source file: <src/lib/tool.debug.assert.fs>.
assertn
assertn ( n -- )
If the contents of assert-level
is greater than n, then
parse and discard the input stream to the next right paren
(the end of the assertion); else do nothing. assertn
is the common factor of assert0(
, assert1(
, assert2(
,
and assert3(
.
Origin: Gforth.
See also: assert(
.
Source file: <src/lib/tool.debug.assert.fs>.
associative-case:
associative-case: ( "name" -- )
Create an associative case definition "name":
name ( i*x n — j*x )
.
Usage example:
: red ." red" ; : blue ." blue" ; : orange ." orange" ; : pink ." pink" ; : black ." black" ; associative-case: color ( n -- ) 7 red 12 blue 472 orange 15 pink 0 black ; 7 color cr 472 color cr 3000 color cr
n for default must be 0 and the default pair must be last. Numbers can be in any order except 0 must be last. An actual zero or a no match causes the default to be executed. Numbers can’t be constants.
Source file: <src/lib/flow.associative-case-colon.fs>.
associative-list
associative-list ( "name" -- )
Create a new associative list "name".
Source file: <src/lib/data.associative-list.fs>.
associative:
associative: ( n "name" -- )
Create a table lookup "name" with n entries.
An associative memory word. It must be followed by a set of values to be looked up. At runtime, the values stored in the parameter field are searched for a match. If one if found, the index to that value is returned. If no match is made, then the number of entries, ie max index + 1 is returned. This is the inverse of an array.
Usage example:
1000 constant zx1 200 constant zx2 30 constant zx3 3 associative: unzx ( value -- n ) zx1 , zx2 , zx3 , 1000 unzx . \ prints 0 200 unzx . \ prints 1 30 unzx . \ prints 2
Source file: <src/lib/data.associative-colon.fs>.
at-accept
at-accept ( -- )
Set the cursor position at the start of the most recent
accept
.
Source file: <src/lib/keyboard.MISC.fs>.
at-x
at-x ( col -- )
Set the cursor at the given column (x coordinate) col and the current row (y coordinate).
Source file: <src/lib/display.cursor.fs>.
at-xy
at-xy ( col row -- )
Set the cursor coordinates to column col and row row. The upper left corner is column zero, row zero.
at-xy
is a deferred word whose default action is
mode-32-at-xy
.
Origin: Forth-94 (FACILITY), Forth-2012 (FACILITY).
See also: home
.
Source file: <src/kernel.z80s>.
at-xy-display-udg
at-xy-display-udg ( c x y -- )
Display UDG c at cursor coordinates x y. This is much
faster than using at-xy
and emit-udg
, because no ROM
routine is used, the cursor coordinates are not updated and
the screen attributtes are not changed (only the character
bitmap is displayed).
See also: udg-at-xy-display
.
Source file: <src/lib/graphics.udg.fs>.
at-y
at-y ( row -- )
Set the cursor at the current column (x coordinate) and the given row (y coordinate) row.
Source file: <src/lib/display.cursor.fs>.
ato
ato ( x n "name" -- )
Store x into element n of 1-dimension single-cell values array name.
ato
is an immediate
word.
Source file: <src/lib/data.array.value.fs>.
attr!
attr! ( b -- )
Set b as the current attribute.
See also: attr@
, perm-attr!
, set-paper
, set-ink
,
set-flash
, set-bright
.
Source file: <src/lib/display.attributes.fs>.
attr-cls
attr-cls ( b -- )
Clear the screen with the attribute b, reset the graphic coordinates at the lower left corner (x 0, y 0) and reset the cursor position at the top left corner (column 0, row 0).
Source file: <src/kernel.z80s>.
attr-mask!
attr-mask! ( b -- )
Set b as the current attribute mask.
See also: attr-mask@
, perm-attr-mask!
.
Source file: <src/lib/display.attributes.fs>.
attr-mask@
attr-mask@ ( -- b )
Get the current attribute mask b.
See also: attr-mask!
, perm-attr-mask@
.
Source file: <src/lib/display.attributes.fs>.
attr-setter
attr-setter ( b "name" -- )
Create a definition name that, when executed, will set b as the current attribute.
See also: mask+attr-setter
.
Source file: <src/lib/display.attributes.fs>.
attr>ink
attr>ink ( b1 -- b2 )
Convert attribute b1 to its ink color number b2.
attr>ink
is written in Z80. The equivalent code in
Forth is the following:
: attr>ink ( b1 -- b2 ) ink-mask and ;
See also: attr>paper
.
Source file: <src/lib/display.attributes.fs>.
attr>paper
attr>paper ( b1 -- b2 )
Convert attribute b1 to its paper color number b2.
attr>paper
is written in Z80. The equivalent code in
Forth is the following:
: attr>paper ( b1 -- b2 ) paper-mask and 3 rshift ;
Source file: <src/lib/display.attributes.fs>.
attr@
attr@ ( -- b )
Get the current attribute b.
See also: attr!
, perm-attr@
.
Source file: <src/lib/display.attributes.fs>.
avalue
avalue ( n "name" -- )
Create a 1-dimension single-cell values array name with n elements and the execution semantics defined below.
name execution:
name ( n — x )
Return contents x of element n.
Source file: <src/lib/data.array.value.fs>.
avariable
avariable ( n "name" -- )
Create a 1-dimension single-cell variables array name with n elements and the execution semantics defined below.
name execution:
name ( n — a )
Return address a of element n.
See also: 2avariable
, cavariable
, faravariable
.
Source file: <src/lib/data.array.variable.fs>.
b
b ( -- )
Used after f
to backup the cursor by the length of the
most recent text.
Source file: <src/lib/editor.specforth.fs>.
b/sector
b/sector ( -- n )
Bytes per disk sector.
See also: sectors/block
, sectors/track
.
Source file: <src/kernel.z80s>.
back-from-dos-error_
back-from-dos-error_ ( -- a )
Return the address a of Z80 code that can be set to be executed when a G+DOS routine throws an error, therefore preventing the DOS from returning to BASIC. This is needed only when a Forth word calls G+DOS routines directly instead of using hook codes.
back-from-dos-error_
works like an alternative end to
words that use direct G+DOS calls: The routine at
back-from-dos-error_
will leave the proper error result
on the stack.
Usage example:
b push, dos-in, \ Save the Forth IP. \ Page in the G+DOS memory. back-from-dos-error_ h ldp#, h push, 2066 sp stp, \ Set G+DOS D_ERR_SP ($2066) so an error will go to \ `<<entry6261636B2D66726F6D2D646F732D6572726F725F, pass:c[back-from-dos-error_]>>` instead of returning to BASIC. \ This is needed because we are using direct calls to the \ G+DOS ROM instead of hook codes. \ ... do whatever G+DOS direct call here ... dos-out, h pop, b pop, next ix ldp#, ' false jp, end-code \ Page out the G+DOS memory. \ Consume the address of `<<entry6261636B2D66726F6D2D646F732D6572726F725F, pass:c[back-from-dos-error_]>>` \ that was pushed at the start. \ Restore the Forth IP. \ Restore the Forth IX. \ Return `<<entry66616C7365, pass:c[false]>>` _ior_ (no error).
Source file: <src/lib/dos.gplusdos.fs>.
backspace
backspace ( -- )
Emit a backspace character (character code 8).
See also: 'bs'
.
Source file: <src/lib/display.control.fs>.
backspaces
backspaces ( n -- )
Emit n number of backspace characters (character code 8).
Source file: <src/lib/display.control.fs>.
baden-sqrt
baden-sqrt ( n1 -- n2 )
Integer square root n2 of radicand n1. Original code
by Wil Baden, published on Forth Dimensions (volume 18,
number 5, page 27, 1997-01). This method is 7..8 times
faster than newton-sqrt
.
Loading baden-sqrt
makes it the action of sqrt
.
See also: (baden-sqrt
.
Source file: <src/lib/math.operators.1-cell.fs>.
bank
bank ( +n -- )
Page in the 16-KiB memory bank +n at $C000..$FFFF.
The range of n depends on the computer:
Computer | Memory banks |
---|---|
ZX Spectrum 128 |
0..7 |
ZX Spectrum +2 |
0..7 |
ZX Spectrum +3 |
0..7 |
ZX Spectrum +3e |
0..7 |
Pentagon 128 |
0..7 |
Scorpion ZS 256 |
0..15 |
Pentagon 512 |
0..31 |
Pentagon 1024 |
0..63 |
Source file: <src/kernel.z80s>.
bank-heap
bank-heap ( n b a -- a )
Create a heap
of n address units at address a of bank
b. a is the actual address ($C000..$FFFF) when bank
b is paged in, which is stored in heap-bank
.
See also: heap-in
, heap-out
, allot-heap
,
limit-heap
, farlimit-heap
, empty-heap
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
bank-index
bank-index ( -- ca )
A byte variable that holds the bank index (0..3) calculated by
the latest execution of far
Source file: <src/kernel.z80s>.
bank-start
bank-start ( -- a )
a is the memory address where banks are paged in: $C000.
See also: /bank
, bank
, banks
, far-banks
,
default-bank
.
Source file: <src/kernel.z80s>.
banks
banks ( -- n )
Return the number of 16-KiB RAM memory banks:
Computer | Banks |
---|---|
ZX Spectrum 128 |
8 |
ZX Spectrum +2 |
8 |
ZX Spectrum +3 |
8 |
ZX Spectrum +3e |
8 |
Pentagon 128 |
8 |
Scorpion ZS 256 |
16 |
Pentagon 512 |
32 |
Pentagon 1024 |
64 |
See also: bank
, far-banks
, default-bank
, ram
.
Source file: <src/kernel.z80s>.
beep
beep ( duration pitch -- )
Produce a tone in the internal beeper, with parameters that are equivalent to those of the homonymous Sinclar BASIC command:
duration is in miliseconds (instead of seconds used by BASIC).
pitch is identical to the BASIC parameter: number of semitones from middle C (positive number for notes above, negative number for notes below).
Here is a diagram to show the pitch values of all the notes in one octave on the piano (extracted from the manual of the ZX Spectrum +3 transcripted by Russell et al.):
| | | | C#| D#| | | F#| G#| A#| | | | | | | | | Db| Eb| | | Gb| Ab| Bb| | | | | |-2 | | | 1 | 3 | | | 6 | 8 |10 | | |13 |15 | __|___| | |___|___| | |___|___|___| | |___|___| | | | | | | | | | | | -3 |-1 | 0 | 2 | 4 | 5 | 7 | 9 |11 |12 |14 |16 ____|___|___|___|___|___|___|___|___|___|___|____ C D E F G A B C
Hence, to play the A above middle C for half a second, you would use:
500 9 beep
And to play a scale (for example, C major) a complete (albeit short) program is needed:
create scale 0 c, 2 c, 4 c, 5 c, 7 c, 9 c, 11 c, 12 c, 8 constant /scale : play-scale ( -- ) /scale 0 ?do 500 scale i + c@ beep loop ; play-scale
See also: beep>bleep
, bleep
.
Source file: <src/lib/sound.48.fs>.
beep>bleep
beep>bleep ( duration1 pitch1 -- pitch2 duration2 )
Convert duration1 and pitch1, which are equivalent to
the parameters used by Sinclar BASIC’s BEEP command, to
pitch2 and duration2, which are the parameters required
by bleep
.
duration1 is in miliseconds (instead of seconds used by Sinclair BASIC).
pitch1 is identical to the Sinclair BASIC parameter: number of semitones from middle C (positive number for notes above, negative number for notes below).
Here is a diagram to show the pitch values of all the notes in one octave on the piano (extracted from the manual of the ZX Spectrum +3 transcripted by Russell et al.):
| | | | C#| D#| | | F#| G#| A#| | | | | | | | | Db| Eb| | | Gb| Ab| Bb| | | | | |-2 | | | 1 | 3 | | | 6 | 8 |10 | | |13 |15 | __|___| | |___|___| | |___|___|___| | |___|___| | | | | | | | | | | | -3 |-1 | 0 | 2 | 4 | 5 | 7 | 9 |11 |12 |14 |16 ____|___|___|___|___|___|___|___|___|___|___|____ C D E F G A B C
Source file: <src/lib/sound.48.fs>.
beep>dhz
beep>dhz ( n -- u )
Convert a Sinclair BASIC BEEP’s pitch n to its corresponding frequency in dHz (tenths of hertzs) u.
See also: beep>note
, beep>bleep
, beep
.
Source file: <src/lib/sound.48.fs>.
beep>note
beep>note ( n1 -- n2 +n3 )
Convert a Sinclair BASIC BEEP’s pitch n1 to its corresponding note +n3 (0..11) in octave n2, being zero the middle octave.
See also: -beep>note
, +beep>note
, beep>dhz
, beep>bleep
,
beep
, /octave
.
Source file: <src/lib/sound.48.fs>.
begin
begin ( -- dest )
begin
is an immediate
and compile-only
word.
Source file: <src/kernel.z80s>.
begin-structure
begin-structure ( "name" -- struct-sys 0 )
Parse name. Create a definition for name with the
execution semantics defined below. Return a struct-sys
that will be used by end-structure
and an initial offset
of 0.
name execution: ( — +n )
+n is the size in memory expressed in address units of the data structure.
Example usage:
begin-structure /record field: ~year cfield: ~month cfield: ~day end-structure 10 #records create records #records /record * allot : record> ( n -- a ) /record * records + ; \ Address _a_ of record _n_. 1887 0 record> ~year ! \ store a year into record 0 9 record> ~month c@ \ fetch the month from record 9
Note: begin-structure
and end-structure
are not
necessary to create a structure. Only the initial offset 0
is needed at the start, and saving the structure size at
the end, e.g. using a constant
or a value
:
0 field: ~the-cell cfield: ~the-char constant /record
Origin: Forth-2012 (FACILITY EXT).
See also: end-structure
, field:
, cfield:
, 2field:
,
+field
.
Source file: <src/lib/data.begin-structure.fs>.
benched
benched ( xt n -- d )
Execute n times the benchmark xt and return the timer result d.
Source file: <src/lib/time.fs>.
benched.
benched. ( xt n -- d )
Execute n times the benchmark xt and print the result.
Source file: <src/lib/time.fs>.
bench{
bench{ ( -- )
Start timing, setting the system frames counter to zero.
See also: }bench
, reset-frames
.
Source file: <src/lib/time.fs>.
between
between ( n1|u1 n2|u2 n3|u3 -- f )
Perform a comparison of a test value n1|u1 with a lower limit n2|u2 and an upper limit n3|u3, returning true if either (n2|u2 ⇐ n3|u3 and (n2|u2 ⇐ n1|u1 and n1|u1 ⇐ n3|u3)) or (n2|u2 > n3|u3 and (n2|u2 < n1|u1 or n1|u1 < n3|u3)) is true, returning false otherwise.
Source file: <src/lib/math.operators.1-cell.fs>.
between-of
between-of Compilation: ( -- of-sys ) Run-time: ( x1 x2 x3 -- | x1 )
between-of
is an immediate
and compile-only
word.
Usage example:
: test ( n -- ) case 1 of ." one" endof 2 5 between-of ." between two and five" endof 6 of ." six" endof endcase ;
Source file: <src/lib/flow.case.fs>.
bin.
bin. ( n -- )
Display n as an unsigned binary number, followed by one space.
Source file: <src/lib/display.numbers.fs>.
bin>
bin> ( -- )
End a code zone where binary radix is the default, by
restoring the value of base
from base'
. The zone was
started by <bin
.
Source file: <src/lib/display.numbers.fs>.
bit-array
bit-array ( n "name" -- )
Create a bit-array name to hold n bits, with the execution semantics defined below. The bits are stored in order: array bit 0 is bit 7 of the first byte of the array; array bit 7 is bit 0 of the first byte of the array; array bit 8 is bit 7 of the second byte of the array; array bit 15 is bit 0 of the second byte of the array, etc.
name ( n — b ca )
Return bitmak b and address ca of bit n of the array.
See also: @bit
, !bit
, bits>bytes
, bitmasks
.
Source file: <src/lib/data.array.bit.fs>.
bit>mask
bit>mask ( n -- b )
Convert bit number n to a bitmask b with bit n set.
Source file: <src/lib/memory.MISC.fs>.
bitmasks
bitmasks ( -- ca )
Address of a table that holds the bitmasks for bits 0..7
as used by bit-array
.
Source file: <src/lib/data.array.bit.fs>.
bits
bits ( ca len -- u )
Count the number u of bits that are set in memory zone ca len.
See also: pixels
.
Source file: <src/lib/math.operators.1-cell.fs>.
bits>bytes
bits>bytes ( n1 -- n2 )
Return the number of bytes n2 needed to hold n1 bits.
Used by bit-array
.
Source file: <src/lib/data.array.bit.fs>.
black
black ( -- b )
A constant that returns 0, the value that represents the black color.
Source file: <src/lib/display.attributes.fs>.
blackout
blackout ( -- )
Erase the screen (bitmap and the attributes) with zeros.
See also: fade-display
, cls
, attr-cls
.
Source file: <src/lib/graphics.display.fs>.
blank
blank ( ca len -- )
If len is greater than zero, store the character value for space in len consecutive character positions of memory beginning at ca.
Origin: Forth-94 (STRING), Forth-2012 (STRING).
Source file: <src/kernel.z80s>.
bleep
bleep ( duration pitch -- )
Produce a tone in the internal beeper.
bleep
calls the
BEEPER ROM routine with pitch in the HL register and
duration in the DE register.
(…) but while there is greater flexibility than is directly available in BASIC the system is more difficult to use. Precalculation is necessary to obtain musical scales, on the following basis:
To generate a frequency of F Hz, pitch must be set to:
pitch = (437500/F)-30Looking in the opposite direction:
F = 437500/(pitch+30)The duration of the note is determined as a number of cycles, so duration must be set to
F x T
, where T is the duration in seconds.A point to note is that if a very low frequency is selected, with a high duration, the system may appear to hang up, because the BEEPER ROM routine goes on and on…; whithout the user being able to use BREAK.
Output a square wave of given duration and frequency to the loudspeaker.
Enter with:
DE = #cycles - 1
HL = tone period as described next
The tone period is measured in T states and consists of three parts: a coarse part (H register), a medium part (bits 7..2 of L) and a fine part (bits 1..0 of L) which contribute to the waveform timing as follows:
coarse medium fine duration of low = 118 + 1024*H + 16*(L>>2) + 4*(L&$3) duration of hi = 118 + 1024*H + 16*(L>>2) + 4*(L&$3) Tp = tone period = 236 + 2048*H + 32*(L>>2) + 8*(L&$3) = 236 + 2048*H + 8*L = 236 + 8*HLAs an example, to output five seconds of middle C (261.624 Hz):
Tone period = 1/261.624 = 3.822ms
Tone period in T-States = 3.822ms*fCPU = 13378 (where fCPU = clock frequency of the CPU = 3.5MHz)
Find H and L for desired tone period: HL = (Tp - 236) / 8 = (13378 - 236) / 8 = 1643 = $066B
Tone duration in cycles = 5s/3.822ms = 1308 cycles
DE = 1308 - 1 = $051B
The resulting waveform has a duty ratio of exactly 50%.
ZX Spectrum disassembly
Source file: <src/lib/sound.48.fs>.
blk
blk ( -- a )
User variable that holds the number of the disk block being interpreted. A disk block holds 1024 bytes. One source screen consists of one disk block.
Source file: <src/kernel.z80s>.
block
block ( u -- a )
If the block u is already in memory, leave the address a of the first cell in the disk buffer for data storage.
If the block u is not already in memory, transfer it from disk to the buffer. If the block occupying that buffer has been marked as updated, rewrite it to disk before block u is read into the buffer. Finally leave the address a of the first cell in the disk buffer for data storage.
Definition:
: block ( u -- a ) dup buffer-block = if drop else save-buffers dup read-block disk-buffer ! then buffer-data ;
See also: buffer
, buffer-block
, save-buffers
,
read-block
, disk-buffer
, buffer-data
.
Source file: <src/kernel.z80s>.
block-chars
block-chars ( -- )
A phoney word used only to do need block-chars
. The
loading of the correspondent source block will define
characters 128..143 as block characters, with the shape
they have in Sinclair BASIC. The current value of os-udg
is used.
See also: make-block-chars
, set-udg
, udg!
,
default-udg-chars
.
Source file: <src/lib/graphics.udg.fs>.
block-drive!
block-drive! ( c n -- ) >block-drive c@ ;
Set drive c (DOS dependent) as block drive number n (0 index).
See also: block-drive@
, set-block-drives
.
Source file: <src/lib/dos.COMMON.fs>.
block-drive@
block-drive@ ( n -- c ) >block-drive c@ ;
Get drive c (DOS dependent) currently used as block drive number n (0 index).
See also: block-drive!
, get-block-drives
.
Source file: <src/lib/dos.COMMON.fs>.
block-drives
block-drives ( -- ca )
ca is the address of a character table that holds the
disk drives used as block drives. This table can be
configured manually or using set-block-drives
.
The length of the table is max-drives
. The first element
of the table (offset 0) is the disk drive used for blocks
from number 0 to number blocks/disk 1-
; the second element
of the table (offset 1) the disk drive used for blocks from
number blocks/disk
to number blocks/disk 2 * 1-
; and so on.
The number of used block drives is hold in #block-drives
.
The block ranges not associated to disk drives are marked
with $FF (the not-block-drive
optional constant is
provided for convenience), and all of them should be at the
end of the table. In theory it’s possible to define gaps
in the whole range of blocks associated to disk drives, but
this would cause trouble with set-block-drives
and
get-block-drives
, which use #block-drives
as the drives
count from the start of block-drives
.
The default configuration of block-drives
is: use only
the first disk drive for blocks.
Source file: <src/lib/dos.COMMON.fs>.
block-indexed
block-indexed ( block -- )
Mark block block as indexed.
See also: use-fly-index
.
Source file: <src/lib/blocks.indexer.fly.fs>.
block-sector#>dos
block-sector#>dos ( n -- x )
Convert the sequential disk sector n of a block drive to the disk sector id x, in the format required by G+DOS: The high byte of x is the track (0..79 for side 0; 128..207 for side 1); its low byte is the sector (1..10).
In G+DOS all sectors of a block disk can be used for blocks.
Therefore block-sector#>dos
is an alias of sector#>dos
.
See also: transfer-block
.
Source file: <src/kernel.gplusdos.z80s>.
block>source
block>source ( u -- )
Set block u as the current source.
Definition:
: block>source ( u -- ) blk ! >in off ;
See also: terminal>source
, blk
, >in
, set-source
,
lineblock>source
.
Source file: <src/kernel.z80s>.
blocks/disk
blocks/disk ( -- n )
A constant. Number of blocks per disk.
See also: sectors/block
, sectors/track
.
Source file: <src/kernel.z80s>.
blue
blue ( -- b )
A constant that returns 1, the value that represents the blue color.
Source file: <src/lib/display.attributes.fs>.
body>
body> ( dfa -- xt )
xt is the execution token corresponding to the data-field address dfa.
See also: >body
.
Source file: <src/lib/compilation.fs>.
border
border ( n -- )
Set the border of the screen to color to n. Only the 3 lower bits of n are used (for colors 0..7).
Source file: <src/kernel.z80s>.
bounds
bounds ( ca len -- ca2 ca )
Convert the string identifier ca len to ca2 ca, being
ca2 the address after the last character of the string.
ca2 ca are the parameters needed by do
or ?do
to
traverse the string ca len.
bounds
is written in Z80. Its equivalent definition in
Forth is the following:
: bounds ( ca len -- ca2 ca ) over + swap ;
Origin: Comus.
See also: count
.
Source file: <src/kernel.z80s>.
branch
branch ( -- )
The run-time procedure to branch unconditionally. The following in-line address is copied to IP to branch forward or backward.
Origin: Forth-83 (System Extension Word Set).
Source file: <src/kernel.z80s>.
break-key?
break-key? ( -- f )
Is the break key pressed? break-key?
is a deferred word
whose default action is default-break-key?
.
Source file: <src/kernel.z80s>.
bright-mask
bright-mask ( -- b )
A constant. b is the bitmask of the bit used to indicate the bright status in an attribute byte.
See also: bright-mask
, brighty
, set-bright
, attr!
.
Source file: <src/lib/display.attributes.fs>.
bright.
bright. ( n -- )
Set bright n by printing the corresponding control characters. If n is zero, turn bright off; if n is one, turn bright on; if n is eight, set transparent bright. Other values of n are converted as follows:
-
2, 4 and 6 are converted to 0.
-
3, 5 and 7 are converted to 1.
-
Values greater than 8 or less than 0 are converted to 8.
bright.
is much slower than set-bright
or attr!
,
but it can handle pseudo-color 8 (transparent), setting the
corresponding system variables accordingly.
See also: flash.
, (0-1-8-color.
.
Source file: <src/lib/display.attributes.fs>.
brighty
brighty ( b1 -- b2 )
Convert attribute b1 to its brighty equivalent b2.
brighty
is written in Z80. Its equivalent definition in
Forth is the following:
: brighty ( b1 -- b2 ) bright-mask or ;
Source file: <src/lib/display.attributes.fs>.
buffer
buffer ( n -- a )
Assign the block buffer to block n. If the contents of the buffer were marked as updated, it is written to the disk. The block n is not read from the disk. The address a left on stack is the first cell in the buffer for data storage.
Definition:
: buffer ( n -- a ) dup buffer-block = if drop else free-buffer then buffer-data ;
See also: block
, buffer-block
, free-buffer
,
buffer-data
.
Source file: <src/kernel.z80s>.
buffer-block
buffer-block ( -- n )
Return the block n associated with the disk buffer.
: buffer-block ( — n ) buffer-id $7FFF literal and ; ---
Source file: <src/kernel.z80s>.
buffer-data
buffer-data ( -- ca )
Address of the disk buffer contents.
Source file: <src/kernel.z80s>.
buffer-id
buffer-id ( -- x )
x is the identifier of the disk buffer.
See also: disk-buffer
.
Source file: <src/kernel.z80s>.
buffer:
buffer: ( u "name" -- )
Create a definition for name, with the execution semantics defined below. Reserve u address units of data space at an aligned address.
buffer:
provides a means of defining an uninitialized
buffer.
Execution of name:
name ( — a )
a is the address of the space reserved by buffer:
when
it defined name. The program is responsible for
initializing the contents.
Origin: Forth-2012 (CORE EXT).
Source file: <src/lib/data.MISC.fs>.
c
c ( "ccc<eol>" -- )
Copy in "ccc" to the cursor line at the cursor position.
Source file: <src/lib/editor.specforth.fs>.
c!
c! ( c ca -- )
Store c at ca.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
c!>
c!> Interpretation: ( c "name" -- ) Compilation: ( "name" -- ) Run-time: ( c -- ) "c-store-to"
c!>
is an immediate
word.
Interpretation:
Compilation:
Parse name, which is a word created by cconstant
or
cconst
, and append the run-time semantics given below to
the current definition.
Run-time:
Make c the current value of the character constant name.
Origin: IsForth’s !>
.
Source file: <src/lib/data.store-to.fs>.
c!a
c!a ( c -- )
Store c at the address register.
Source file: <src/lib/memory.address_register.fs>.
c!a+
c!a+ ( c -- )
Store c at the address register and increment the address register by one address unit.
Source file: <src/lib/memory.address_register.fs>.
c!bank
c!bank ( c ca n -- )
Store c into address ca ($C000..$FFFF) of bank n (0..7).
c!bank
is written in Z80. Its equivalent definition in
Forth is the following:
: c!bank ( c ca n -- ) bank c! default-bank ;
Source file: <src/lib/memory.far.fs>.
c!dos
c!dos ( b ca -- )
Store b at the Plus D memory address ca.
Source file: <src/lib/dos.gplusdos.fs>.
c!dosvar
c!dosvar ( b n -- )
Store b into the G+DOS variable n.
Source file: <src/lib/dos.gplusdos.fs>.
c!exchange
c!exchange ( c1 ca -- c2 )
Store c1 into ca and return its previous contents c2.
Source file: <src/lib/memory.MISC.fs>.
c"
c" ( Compilation: "ccc<quote>" -- ) ( Run-time: -- ca )
Parse a string delimited by double quotes and compile it into the current definition. At run-time the string will be returned as a counted string ca.
c"
is an immediate
and compile-only
word.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
See also: csliteral
.
Source file: <src/lib/strings.c-quote.fs>.
c#
c# ( "name" -- c )
Parse name and return the code c of the its first character.
c#
is an immediate
word.
Source file: <src/lib/math.number.prefix.fs>.
c>bstring
c>bstring ( c -- ca len )
Convert c to a 1-char binary string ca len in pad
,
ca len contains c "as is", as stored in memory.
Source file: <src/lib/strings.MISC.fs>.
c@
c@ ( ca -- c )
Fetch the character c stored at ca.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
c@+
c@+ ( ca -- ca' c )
Fetch the character c at ca. Return ca', which is ca incremented by one character. This is handy for stepping through character arrays.
Source file: <src/lib/memory.MISC.fs>.
c@a
c@a ( -- c )
Fetch c at the address register.
Source file: <src/lib/memory.address_register.fs>.
c@a+
c@a+ ( -- c )
Fetch c at the address register and increment the address register by one address unit.
Source file: <src/lib/memory.address_register.fs>.
c@and
c@and ( b1 ca -- b2 )
Fetch the caracter at ca and do a bit-by-bit logical
and
of it with b1, returning the result b2.
Source file: <src/lib/memory.MISC.fs>.
c@and?
c@and? ( b ca -- f )
Fetch the caracter at ca and do a bit-by-bit logical "and" of it with b. Return false if the result is zero, else true.
See also: c@and
.
Source file: <src/kernel.z80s>.
c@bank
c@bank ( ca n -- c )
Fetch c from address ca ($C000..$FFFF) of bank n (0..7).
: c@bank ( ca n -- c ) bank c@ default-bank ;
Source file: <src/lib/memory.far.fs>.
c@dos
c@dos ( ca -- b )
Fetch byte b stored at Plus D memory address ca.
Source file: <src/lib/dos.gplusdos.fs>.
c@dosvar
c@dosvar ( n -- b )
Fetch the contents b of G+DOS variable n.
Source file: <src/lib/dos.gplusdos.fs>.
calculator-command
calculator-command ( b -- )
Compile the assembler instructions needed to execute the b command of the ROM calculator.
Source file: <src/lib/math.floating_point.rom.fs>.
calculator-command>flag
calculator-command>flag ( b -- )
Compile the assembler instructions needed to execute the b command of the ROM calculator and to return the floating-point result as a flag on the data stack.
Source file: <src/lib/math.floating_point.rom.fs>.
call,
call, ( a -- )
Compile the Z80 opcode to call a.
Definition:
: call, ( a -- ) $CD c, , ;
See also: jp,
.
Source file: <src/kernel.z80s>.
call-xt,
call-xt, ( xt -- )
Compile a Z80 call to xt, by compiling the Z80
instruction that loads the HL register with xt, and then
executing execute-hl,
to compile the rest of the
necessary code.
call-xt,
is the low-level equivalent of execute
: it’s
used to call a colon word from a code word.
Source file: <src/lib/assembler.fs>.
capslock
capslock ( -- b ca )
Return address ca of system variable FLAGS2 and bitmask b of the bit that controls the status of capslock.
See also: set-capslock
, unset-capslock
, capslock?
,
os-flags2
.
Source file: <src/lib/keyboard.caps_lock.fs>.
capslock?
capslock? ( -- f )
Is capslock set?
See also: set-capslock
, unset-capslock
, toggle-capslock
,
capslock
.
Source file: <src/lib/keyboard.caps_lock.fs>.
case
case ( -- 0 )
case
is an immediate
and compile-only
word.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/flow.case.fs>.
case-sensitive
case-sensitive ( -- a )
A variable that holds a flag that turns case-sensitive mode on and off.
When the contents of case-sensitive
are zero, case-sensitive mode
is off (this is the default): the name of new words defined will be
stored in lowercase into the dictionary; and any name
searched for in the dictionary will be converted to lowercase first
(the conversion is done at low level, not affecting the name string
passed as parameter).
When the contents of case-sensitive
are non-zero, case-sensitive
mode is on: the name of new words defined will be stored as they are
parsed from the input stream, without modification; and any name
searched for in the dictionary will not be modified, therefore it
will be found only if it’s identical to the name stored in the
definition header.
Warning
|
Words that are defined when case-sensitive mode is on, and that have uppercase characters in their names, will not be found when case-sensitive mode is off. |
Source file: <src/kernel.z80s>.
case-sensitive-esc-chars
case-sensitive-esc-chars ( -- a )
A variable that holds a flag that turns case-sensitive mode
on and off only during the parsing of escaped strings, e.g.
s\"
and .\"
. The contents of this variable are
temporarily stored into case-sensitive
by
parse-esc-string
. The current contents of
case-sensitive
are preserved and restored at the end.
When the contents of case-sensitive
are non-zero, escaped
characters case-sensitive mode is on (this is the default):
any escaped character searched for in the configured word
list will not be modified, therefore it will be found only
if it’s identical to the name stored in the definition
header.
When the contents of case-sensitive-esc-chars
are zero,
escaped characters case-sensitive mode is off: any escaped
character searched for in the correspondent word list will
be converted to lowercase first (the conversion is done at
low level, not affecting the name string passed as
parameter).
Note
|
In order to create upper-case case-sensitive escaped
chars, their correspondent words must be created when
case-sensitive is on.
See the words defined in esc-udg-chars-wordlist .
|
Source file: <src/lib/strings.escaped.fs>.
case>
case> ( orig counter selector "name" -- orig counter' )
Compile an option into a cases:
structure. The given
selector will cause the word "name" to be executed.
See cases:
for an usage example.
Source file: <src/lib/flow.cases-colon.fs>.
cases:
cases: ( "name" -- orig 0 )
Define a cases:
structure "name", built as an array of
pairs (value and associated vector).
Usage example:
: say10 ." dek" ; : say100 ." cent" ; : say1000 ." mil" ; : say-other ." alia" ; cases: say ( n -- ) 10 case> say10 100 case> say100 1000 case> say1000 othercase> say-other 10 say 100 say 1000 say 1001 say
Source file: <src/lib/flow.cases-colon.fs>.
catch
catch ( xt -- 0 | err# )
Push an exception frame on the exception stack and then
execute xt (as with execute
) in such a way that control
can be transferred to a point just after catch
if throw
is executed during the execution of xt.
If the execution of xt completes normally (i.e., the
exception frame pushed by this catch
is not popped by an
execution of throw
) pop the exception frame and return
zero on top of the data stack, above whatever stack items
would have been returned by the execution of xt.
Otherwise, the remainder of the execution semantics are
given by throw
.
Origin: Forth-94 (EXCEPTION), Forth-2012 (EXCEPTION).
Source file: <src/lib/exception.fs>.
catcher
catcher ( -- a )
A user variable that holds the return stack pointer for error
handling. Used by throw
.
Source file: <src/kernel.z80s>.
cato
cato ( c n "name" -- )
Store c into element n of 1-dimension character values array name.
cato
is an immediate
word.
Source file: <src/lib/data.array.value.fs>.
cavalue
cavalue ( n "name" -- )
Create a 1-dimension character values array name with n elements and the execution semantics defined below.
name execution:
name ( n — c )
Return contents c of element n.
Source file: <src/lib/data.array.value.fs>.
cavariable
cavariable ( n "name" -- )
Create a 1-dimension character variables array name with n elements and the execution semantics defined below.
name execution:
name ( n — ca )
Return address ca of element n.
See also: avariable
, 2avariable
, farcavariable
.
Source file: <src/lib/data.array.variable.fs>.
ccase
ccase Compilation: ( C: -- orig1 orig2 ) Run-time: ( c ca len -- )
Start a ccase
..endccase
structure. If c is in the
string ca len, execute the n-th word compiled after
ccase
, where n is the position of the first c in the
string (0..len-1) plus 1, then continue after endccase
.
If c is not in ca len, execute the word compiled right
after ccase
, then continue after endccase
.
ccase
is an immediate
and compile-only
word.
Usage example:
: .a ( -- ) ." Letter A" ; : .b ( -- ) ." Letter B" ; : .c ( -- ) ." Letter C" ; : .nope ( -- ) ." Nope!" ; : letter ( c -- ) s" abc" ccase .a .b .c .nope endccase ." The End" cr ;
Source file: <src/lib/flow.ccase.fs>.
ccase0
ccase0 Compilation: ( C: -- orig ) Run-time: ( c ca len -- )
Start a ccase0
..endccase
structure. If c is in the
string ca len, execute the n-th word compiled after
ccase0
, where n is the position of the first c in
the string (0..len-1) plus 1, then continue after
endccase0
. If c is not in ca len, execute the word
compiled right after ccase0
, then continue after
endccase0
.
ccase0
is an immediate
and compile-only
word.
Usage example:
: .a ( -- ) ." Letter A" ; : .b ( -- ) ." Letter B" ; : .c ( -- ) ." Letter C" ; : .nope ( -- ) ." Nope!" ; : letter ( c -- ) s" abc" ccase0 .nope .a .b .c endccase0 ." The End" cr ;
Source file: <src/lib/flow.ccase.fs>.
cconst
cconst ( c "name" -- )
Create a character fast constant name, with value c.
A character fast constant works like an ordinary
cconstant
, except its value is compiled as a literal.
Origin: IsForth’s const
.
Source file: <src/lib/data.const.fs>.
cell
cell ( -- n )
n is the size in address units of one cell. cell
returns
2 in Solo Forth.
Origin: Comus.
Source file: <src/kernel.z80s>.
cell+
cell+ ( a1 -- a2 )
Add the size in address units of a cell to a1, giving a2.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
cell-
cell- ( a1 -- a2 )
Subtract the size in address units of a cell from a1, giving a2.
Origin: Comus.
Source file: <src/kernel.z80s>.
cell-bits
cell-bits ( -- n )
A constant. n is the number of bits in a cell.
See also: cell
, environment?
.
Source file: <src/lib/math.number.conversion.fs>.
cell/
cell/ ( n1 -- n2 )
Divide n1 by the size of a cell, returning the result n2.
Source file: <src/lib/math.operators.1-cell.fs>.
cells
cells ( n1 -- n2 )
n2 is the size in address units of n1 cells.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
centry:
centry: ( c wid "name" -- )
Create a character entry "name" in associative list wid, with value c.
Source file: <src/lib/data.associative-list.fs>.
cenum
cenum ( n "name" -- n+1 )
Create a cconstant name with value n and return n+1.
Usage example:
0 cenum first cenum second cenum third cenum fourth drop
Source file: <src/lib/data.MISC.fs>.
cexchange
cexchange ( ca1 ca2 -- )
Exchange the characters stored in ca1 and ca2.
See also: exchange
, c!exchange
.
Source file: <src/lib/memory.MISC.fs>.
cfield:
cfield: ( n1 "name" -- n2 )
Parse name. offset is the first character aligned value greater than or equal to n1. n2 = offset + 1 character.
Create a definition for name with the execution semantics defined below.
name execution: ( a1 — a2 )
Add the offset calculated during the compile-time action to a1 giving the address a2.
Origin: Forth-2012 (FACILITY EXT).
See also: begin-structure
, +field
.
Source file: <src/lib/data.begin-structure.fs>.
change-octave
change-octave ( u n -- u' )
Change the note frequency u of the middle octave (octave zero) to its corresponding note frequency u' in octave n. If n is zero, u' equals u.
See also: octave-changer
, beep>dhz
, middle-octave
.
Source file: <src/lib/sound.48.fs>.
char
char ( "name" -- c )
Parse name and put the value of its first character on the stack.
Solo Forth recognizes the standard notation for
characters, so char
is not needed:
'x' emit .( equals ) char x emit
Origin: Forth-94 (CORE), Forth-2012 (CORE).
See also: [char]
.
Source file: <src/lib/parsing.fs>.
char-in-string?
char-in-string? ( ca len c -- f )
Is char c in string ca len?
See also: char-position?
, contains
, compare
,
#chars
.
Source file: <src/lib/strings.MISC.fs>.
char-position?
char-position? ( ca len c -- +n true | false )
If char c is in string ca len, return its first position +n and true; else return false.
See also: char-in-string?
, contains
, compare
.
Source file: <src/lib/strings.MISC.fs>.
char>string
char>string ( c -- ca len )
Convert the char c to a string ca len in the
stringer
.
See also: chars>string
, ruler
, u>str
, d>str
,
ud>str
.
Source file: <src/lib/strings.MISC.fs>.
char?
char? ( ca len -- c true | false )
Is the string ca len the representation of a character? If so return the character c and true; else return false.
Definition:
: char? ( ca len -- c true | false ) 3 = if dup c@ ''' <> if dup [ 2 chars ] literal + c@ ''' <> if char+ c@ true exit then then then drop false ;
Source file: <src/kernel.z80s>.
charlton-allocate
charlton-allocate ( u -- a ior )
Allocate u address units of contiguous data space. The data-space pointer is unaffected by this operation. The initial content of the allocated space is undefined.
If the allocation succeeds, a is the aligned starting address of the allocated space and ior is zero.
If the operation fails, a does not represent a valid address and ior is #-59.
charlton-allocate
is the action of allocate
in the
memory heap
implementation adapted from code written by
Gordon Charlton, whose words are defined in
charlton-heap-wordlist
.
See also: charlton-resize
, charlton-free
.
Source file: <src/lib/memory.allocate.charlton.fs>.
charlton-empty-heap
charlton-empty-heap ( -- )
Empty the current heap
, which was created by
allot-heap
, limit-heap
, bank-heap
or farlimit-heap
.
charlton-empty-heap
is the action of empty-heap
in
the memory heap
implementation adapted from code written
by Gordon Charlton, whose words are defined in
charlton-heap-wordlist
.
See also: charlton-allocate
, charlton-resize
,
charlton-free
.
Source file: <src/lib/memory.allocate.charlton.fs>.
charlton-free
charlton-free ( a -- ior )
Return the contiguous region of data space indicated by a
to the system for later allocation. a shall indicate a
region of data space that was previously obtained by
charlton-allocate
or charlton-resize
.
As there is no compelling reason for this to fail, ior is zero.
charlton-free
is the action of free
in the memory
heap
implementation adapted from code written by Gordon
Charlton, whose words are defined in
charlton-heap-wordlist
.
Source file: <src/lib/memory.allocate.charlton.fs>.
charlton-heap-wordlist
charlton-heap-wordlist ( -- wid )
wid is the word-list identifier of the word list that
holds the words the memory heap
implementation adapted
from code written by Gordon Charlton (1994-09-12).
need charlton-heap-wordlist
is used to load the memory
heap implementation and configure allocate
, resize
,
free
and empty-heap
accordingly.
An alternative, simpler and smaller implementation of the
memory heap is provided by gil-heap-wordlist
.
The actual heap must be created with allot-heap
,
limit-heap
, farlimit-heap
or bank-heap
, which are
independent from the heap implemention.
Source file: <src/lib/memory.allocate.charlton.fs>.
charlton-resize
charlton-resize ( a1 u -- a2 ior )
Change the allocation of the contiguous data space starting
at the address a1, previously allocated by
charlton-allocate
or charlton-resize
, to u address
units. u may be either larger or smaller than the current
size of the region. The data-space pointer is unaffected by
this operation.
If the operation succeeds, a2 is the aligned starting
address of u address units of allocated memory and
ior is zero. a2 may be, but need not be, the same as
a1. If they are not the same, the values contained in
the region at a1 are copied to a2, up to the minimum
size of either of the two regions. If they are the same,
the values contained in the region are preserved to the
minimum of u or the original size. If a2 is not the
same as a1, the region of memory at a1 is returned to
the system according to the operation of free
.
If the operation fails, a2 equals a1, the region of memory at a1 is unaffected, and ior is #-61.
charlton-resize
is the action of resize
in the memory
heap
implementation adapted from code written by Gordon
Charlton, whose words are defined in
charlton-heap-wordlist
.
Source file: <src/lib/memory.allocate.charlton.fs>.
chars
chars ( n1 -- n2 )
n2 is the size in address units of n1 characters. In Solo
Forth, chars
does nothing.
chars
is an immediate
word.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
chars>string
chars>string ( c1..cn n -- ca len )
Convert n chars to a string ca len in the stringer
.
- c1..cn
-
chars to make the string with (c1 is the last one)
- n
-
number of chars
Source file: <src/lib/strings.MISC.fs>.
chop
chop ( ca len -- ca' len' )
Remove the last character from string ca len.
Source file: <src/lib/strings.MISC.fs>.
circle
circle ( gx gy b -- )
Draw a circle at center coordinates gx gy and with radius b.
circle
does not use the ROM routine and it’s much
faster.
circle
does no error checking: the whole circle must
fit the screen. Otherwise, strange things will happen when
other parts of the screen bitmap, the screen attributes or
even the system variables will be altered.
Note: By default circle
does nothing. Its factor
routine circle-pixel
must be configured first with
set-circle-pixel
, in order to choose the routine that
creates the pixels of the circle: uncolored-circle-pixel
,
colored-circle-pixel
or a routine provided by the
application.
Source file: <src/lib/graphics.circle.fs>.
circle-pixel
circle-pixel ( -- a )
a is the address of a subroutine used by circle
to set
its pixels. This routine does a jump to the actual
routine, which by default does nothing. The desired routine
must be set by set-circle
.
Also any routine provided by the application can be used as
the action of circle-pixel
, provided the following
requirements:
-
HL, DE and BC must be preserved.
-
Input parameters: B=gy and C=gx.
Source file: <src/lib/graphics.circle.fs>.
class
class ( class -- class methods vars )
Start the definition of a class.
Source file: <src/lib/objects.mini-oof.fs>.
classic-number-point?
classic-number-point? ( c -- f )
Is character c a classic number point? Allowed points are: comma, hyphen, period, slash and colon.
classic-number-point?
is an alternative action for the
deferred word number-point?
, which is used in number?
,
and whose default action is standard-number-point?
.
See also: extended-number-point?
.
Source file: <src/lib/math.number.point.fs>.
clear
clear ( n -- )
Clear block n with blanks and select for editing.
Source file: <src/lib/editor.specforth.fs>.
clear-accept
clear-accept ( -- )
Clear the string currently edited by accept
.
Source file: <src/lib/keyboard.MISC.fs>.
clear-block
clear-block ( column row width height -- )
Clear a screen block at the given character coordinates and of the given size in characters. Only the bitmap is cleared. The color attributes remain unchanged.
Source file: <src/lib/graphics.blocks.fs>.
cliteral
cliteral ( b -- )
Compile b in the current definition.
cliteral
does the same as literal
but saves one byte of
data space and b is put on the stack a bit faster (0.97 of
execution speed).
cliteral
is an immediate
and compile-only
word.
Definition:
: cliteral ( b -- ) postpone clit c, ; immediate compile-only
Origin: Comus.
Source file: <src/kernel.z80s>.
cls
cls ( -- )
Clear the screen with the current attribute, reset the graphic coordinates at the lower left corner (gx 0, gy 0) and reset the cursor position at the upper left corner (column 0, row 0).
Source file: <src/kernel.z80s>.
cls-chars0
cls-chars0 ( -- )
Clear the screen by rotating all bytes of the bitmap.
See also: cls-chars1
.
Source file: <src/lib/graphics.cls.fs>.
cls-chars1
cls-chars1 ( -- )
Clear the screen by rotating all bytes of the bitmap.
See also: cls-chars0
.
Source file: <src/lib/graphics.cls.fs>.
cmove<far
cmove<far ( ca1 ca2 len -- )
If len is greater than zero, copy len consecutive characters from far-memory address ca1 to main-memory address ca2.
Source file: <src/lib/memory.far.fs>.
cmove>far
cmove>far ( ca1 ca2 len -- )
If len is greater than zero, copy len consecutive characters from main-memory address ca1 to far-memory address ca2.
Source file: <src/lib/memory.far.fs>.
color-block
color-block ( column row width height color -- )
Color a screen block at the given character coordinates and of the given size in characters. Only the color attributes are changed; the bitmap remains unchanged.
Source file: <src/lib/graphics.blocks.fs>.
colored-circle-pixel
colored-circle-pixel ( -- a )
a is the address of a subroutine that circle
can use to
draw its pixels. This routine sets a pixel, changing its
color attributes on the screen (like plot
). Therefore
it’s slower than its alternative uncolored-circle-pixel
(1.64 its execution speed).
set-circle-pixel
sets the routine used by circle
. See
the requirements of such routine in the documentation of
circle-pixel
.
Source file: <src/lib/graphics.circle.fs>.
column
column ( -- col )
Current column (x coordinate).
See also: row
, last-column
, columns
.
Source file: <src/lib/display.cursor.fs>.
columns
columns ( -- n )
Return the number of columns in the current screen mode. The default value is 32.
Source file: <src/lib/display.mode.COMMON.fs>.
comp'
comp' ( "name" -- x xt )
Compilation token x xt represents the compilation semantics of name.
Origin: Gforth.
Source file: <src/lib/compilation.fs>.
compare
compare ( ca1 len1 ca2 len2 -- n )
Compare the string ca1 len1 to the string ca2 len2. The strings are compared, beginning at the given addresses, character by character, up to the length of the shorter string or until a difference is found. If the two strings are identical, n is zero. If the two strings are identical up to the length of the shorter string, n is minus-one (-1) if len1 is less than len2 and one (1) otherwise. If the two strings are not identical up to the length of the shorter string, n is minus-one (-1) if the first non-matching character in the string ca1 len1 has a lesser numeric value than the corresponding character in the string ca2 len2 and one (1) otherwise.
Origin: Forth-94 (STRING), Forth-2012 (STRING).
Source file: <src/kernel.z80s>.
compile
compile ( -- )
Compile the cell following the compilation address of
compile
into the dictionary.
compile
allows specific compilation situations to be
handled in addition to simply compiling an execution token
(which the interpreter already does).
compile
is a compile-only
word.
Definition:
: compile ( -- ) r> dup cell+ >r @ compile, ;
Typically used in the form:
: name compile namex ;
When name is executed, the execution token of namex is
compiled, not executed. name is tipically an immediate
word and namex is typically not an immediate
word.
compile
has been be superseded by postpone
.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set).
Source file: <src/kernel.z80s>.
compile-only
compile-only ( -- )
Make the most recent definition a compile-only word.
Definition:
: compile-only ( -- ) compile-only-mask latest lex! ;
See also: compile-only?
, immediate
.
Source file: <src/kernel.z80s>.
compile-only-mask
compile-only-mask ( -- b )
Constant that holds the bitmask of the compile-only bit, set
by compile-only
.
See also: immediate-mask
.
Source file: <src/kernel.z80s>.
compile-only?
compile-only? ( nt -- f )
Is the word nt compile-only?
See also: compile-only
, immediate?
.
Source file: <src/kernel.z80s>.
compiling?
compiling? ( -- f )
Definition:
: compiling? ( -- f ) state @ 0<> ;
Source file: <src/kernel.z80s>.
const
const ( x "name" -- )
Create a fast constant name, with value x.
A fast constant works like an ordinary constant
, except
its value is compiled as a literal.
Origin: IsForth.
Source file: <src/lib/data.const.fs>.
contains
contains ( ca1 len1 ca2 len2 -- f )
Does string ca1 len1 contain string ca2 len2?
See also: char-position?
, char-in-string?
, compare
,
#chars
,
Source file: <src/lib/strings.MISC.fs>.
context
context ( -- a )
User variable that holds the search order: a is the address
of an array of cells, whose maximum length is hold in the
max-order
constant, and whose current length is hold in the
#order
variable. a holds the word list at the top of the
search order.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (System Extension Word Set).
Source file: <src/kernel.z80s>.
continued
continued ( u -- )
Continue interpretation at block u.
Origin: Forth-79 (Reference Word Set), Forth-83 (Appendix B. Uncontrolled Reference Words).
Source file: <src/lib/blocks.fs>.
contrast
contrast ( b1 -- b2 )
Convert color b1 to its contrast color b2. b2 is
white
(7) if b1 is a dark color (black
, blue
, red
or magenta
); b2 is black
(0) if b1 is a light
colour (green
, cyan
, yellow
or white
).
See also: papery
.
Source file: <src/lib/display.attributes.fs>.
control-char?
control-char? ( c -- f )
Is character c a control character, i.e. in the range 0..31?
Source file: <src/lib/chars.fs>.
count
count ( ca1 -- ca2 len2 )
Return the character string specification for the counted string stored at ca1. ca2 is the address of the first character after ca1. len is the contents of the character at c1, which is the length in characters of the string at c2.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
See also: farcount
.
Source file: <src/kernel.z80s>.
counted>stringer
counted>stringer ( ca1 len1 -- ca2 )
Copy string ca1 len1 to the stringer
as a counted
string and return it as ca2.
See also: >stringer
, allocate-stringer
.
Source file: <src/lib/strings.MISC.fs>.
cr
cr ( -- )
Transmit a carriage return to the selected output device.
cr
is a deferred word whose default action is (cr)
.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
crandom
crandom ( b1 -- b2 )
Return a random 8-bit number b2 in range 0..b1-1
Source file: <src/lib/random.fs>.
create-entry
create-entry ( i*x wid xt "name" -- )
Create an entry "name" in associative list wid, using xt to store its value i*x.
Source file: <src/lib/data.associative-list.fs>.
create:
create: ( "name" -- )
Create a word "name" which is compiled as a colon word but, when executed, will return the address of its pfa.
Source file: <src/lib/define.MISC.fs>.
creset
creset ( b ca -- )
Reset the bits at ca specified by the bitmask b.
Source file: <src/kernel.z80s>.
crs
crs ( n -- )
Emit n number of cr characters (character code 13).
Source file: <src/lib/display.control.fs>.
cset
cset ( b ca -- )
Set the bits at ca specified by the bitmask b.
Source file: <src/kernel.z80s>.
cslit
cslit ( -- ca )
Return a string that is compiled after the calling word, and adjust the instruction pointer to step over the inline string.
cslit
is compiled by csliteral
.
See also: slit
.
Source file: <src/lib/strings.c-quote.fs>.
csliteral
csliteral ( Compilation: "ccc<quote>" -- ) ( Run-time: -- ca )
Compile a string ca len which at run-time will be returned as a counted string.
csliteral
is an immediate
and compile-only
word.
Source file: <src/lib/strings.c-quote.fs>.
csp
csp ( -- a )
User variable that holds the current data stack position saved
by !csp
.
Origin: fig-Forth.
Source file: <src/kernel.z80s>.
cstorer
cstorer ( c ca "name" -- )
Define a word name which, when executed, will cause that c be stored at ca.
Origin: variant of the word set
found in Forth-79
(Reference Word Set) and Forth-83 (Appendix B.
Uncontrolled Reference Words).
Source file: <src/lib/data.storer.fs>.
cswitch
cswitch ( c switch -- )
Execute the switch switch for the key c.
Source file: <src/lib/flow.switch-colon.fs>.
ctoggle
ctoggle ( b ca -- )
Invert the bits at ca specified by the bitmask b.
See also: c@and
.
Source file: <src/lib/memory.MISC.fs>.
ctoval
ctoval ( -- )
Change the default behaviour of words created by cval
:
make them store a new value instead of returning its actual
one.
Source file: <src/lib/data.val.fs>.
current
current ( -- a )
User variable that holds the word list identifier of the compilation word list.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (System Extension Word Set).
See also: get-current
.
Source file: <src/kernel.z80s>.
current-latest
current-latest ( -- nt )
Leave the name token of the topmost word in the current
compilation word list. current-latest
is different from
latest
, which returns the name token of the latest word
defined in the system.
Definition:
: current-latest ( -- nt ) get-current @ ;
Origin: fig-Forth’s latest
.
Source file: <src/kernel.z80s>.
current-mode
current-mode ( -- a )
Variable that holds the execution token of the word that
activates the current screen mode. It’s set to noop
until
the first mode change is done.
See also: save-mode
, restore-mode
.
Source file: <src/kernel.z80s>.
current-window
current-window ( -- a )
A variable. a holds the data address of the current window.
See also: window
, set-window
.
Source file: <src/lib/display.window.fs>.
cursor-char
cursor-char ( -- a )
A byte variable that holds the character code of the cursor
used by xkey
. Note this is a character variable, thus it has to
be fetched with c@
and modified with c!
.
Source file: <src/kernel.z80s>.
cval
cval ( c "name" -- )
Create a definition for name that will place c on
the stack (unless ctoval
is used first) and then will
execute init-cval
.
Source file: <src/lib/data.val.fs>.
cvalue
cvalue ( c "name" -- )
Create a definition name with the following execution semantics: place c on the stack.
Source file: <src/lib/data.value.fs>.
cvariable
cvariable ( "name" -- )
Create a character variable name and reserve one character of data space. When name is executed, it returns the address of the reserved space.
Source file: <src/lib/data.MISC.fs>.
cyan
cyan ( -- b )
A constant that returns 5, the value that represents the cyan color.
Source file: <src/lib/display.attributes.fs>.
d
d ( n -- )
Delete line n but hold it in pad
. Line 15 becomes free
as all statements move up one line.
Source file: <src/lib/editor.specforth.fs>.
d*
d* ( d|ud1 d|ud2 -- d|ud3 )
Multiply d1|ud1 by d2|ud2 giving the product d3|ud3.
Source file: <src/lib/math.operators.2-cell.fs>.
d+
d+ ( d1|ud1 d2|ud2 -- d3|ud3 )
Add d2|ud2 to d1|ud1, giving the sum d3|ud3.
See also: +
.
Source file: <src/kernel.z80s>.
d.
d. ( d -- )
Print signed double integer d according to current base, followed by only one blank.
Source file: <src/kernel.z80s>.
d.r
d.r ( d n -- )
Print a signed double number d right justified in a field of n characters.
Definition:
: d.r ( d n -- ) >r tuck dabs <# #s rot sign #> over - spaces type ;
Source file: <src/kernel.z80s>.
d10*
d10* ( ud1 -- ud2 )
Multiply ud1 per 10, resulting ud2.
Source file: <src/lib/math.operators.2-cell.fs>.
d>s
d>s ( d -- n )
n is the equivalent of d. The high cell of d is discarded.
Origin: Forth-94 (DOUBLE), Forth-2012 (DOUBLE).
Source file: <src/kernel.z80s>.
d>str
d>str ( d -- ca len )
Convert d to string ca len.
See also: u>str
, ud>str
, char>string
.
Source file: <src/lib/strings.MISC.fs>.
dabs
dabs ( d -- ud )
Leave the absolute value ud of a double number d.
Definition:
: dabs ( d -- ud ) dup ?dnegate ;
Source file: <src/kernel.z80s>.
data
data ( n "name" -- n orig )
Create a definition for name, in order to compile data
items of n address units each, finished by end-data
.
Leave n and orig to be consumeb by end-cdata
. When
name is executed, it will leave the start address of the
data and the number of items, which depends on n.
Usage example:
cell data my-cells ( -- a u ) 1 c 2 c 3 c 4 c 5 c end-data 2 cells data my-double-cells ( -- a u ) 0. 2, 1. 2, 2. 2, end-data 1 chars data my-characters ( -- a u ) 'a' c, 'b' c, 'c' c, end-data
Source file: <src/lib/data.data.fs>.
date
date ( -- a )
Address of a variable that holds the date used by
set-date
and get-date
, with the following structure:
+0 day (1 byte) +1 month (1 byte) +2 year (1 cell)
Source file: <src/lib/time.fs>.
dec.
dec. ( n -- )
Display n as a signed decimal number, followed by one space.
Source file: <src/kernel.z80s>.
decimal
decimal ( -- )
Set contents of base
to ten.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
default-bank
default-bank ( -- )
Page in the default memory bank, wich can be configured with
default-bank#
, at $C000..$FFFF.
See also: set-default-bank
, get-default-bank
, bank
, banks
.
Source file: <src/kernel.z80s>.
default-bank#
default-bank# ( -- ca )
An 8-bit variable holding the value of the default bank. Note
this variable must be set with c!
and fetched with c@
.
See also: set-default-bank
, get-default-bank
, banks
,
bank
, far-banks
.
Source file: <src/kernel.z80s>.
default-bank_
default-bank_ ( -- a )
Return address a of a routine that pages in the default
bank. This is the routine default-bank
runs into, after
pushing IX on the return stack to force a final return to
next
.
Output of the routine: A and E corrupted.
See also: bank-e_
.
Source file: <src/lib/memory.far.fs>.
default-break-key?
default-break-key? ( -- f )
Is the default break key (Shift+Space) pressed?
default-break-key?
is the default action of the deferred
word break-key?
.
Source file: <src/kernel.z80s>.
default-colors
default-colors ( -- )
Set the screen colors to the default values.
Source file: <src/kernel.z80s>.
default-first-locatable
default-first-locatable ( -- a )
A variable that holds the default number of the first block
to be searched by located
and its descendants.
See also: first-locatable
.
Source file: <src/lib/002.need.fs>.
default-font
default-font ( -- )
Set the default font, which is the ROM font, by setting the
system variable os-chars
to 15360 ($3C00).
Source file: <src/kernel.z80s>.
default-header
default-header ( -- )
Set header
to its default action: input-stream-header
.
Definition:
: default-header ( -- ) ['] input-stream-header ['] header defer! ;
Source file: <src/kernel.z80s>.
default-mode
default-mode ( -- )
A deferred word that activates the default screen mode. It’s
set to noop
until the first mode change is done. Then it’s
vectored to mode-32
. It’s used by bye
.
Source file: <src/kernel.z80s>.
default-option
default-option ( "name" -- )
Set the default option "name" of an options[ ]options
structure. It can be anywhere inside the structure.
See options[
for a usage example.
Source file: <src/lib/flow.options-bracket.fs>.
default-printable-ascii-char
default-printable-ascii-char ( -- c )
Return the default ASCII character c used by
>printable-ascii-cthar
.
Source file: <src/lib/chars.fs>.
default-udg-chars
default-udg-chars ( -- )
A phoney word used only to do need default-udg-chars
in
order to define UDG 144..164 as letters 'A'..'U', copied
from the ROM font, the shape they have in Sinclair BASIC by
default. The current value of os-udg
is used.
Warning
|
In Solo Forth os-udg points to bitmap of UDG
0, while in Sinclair BASIC it points to bitmap of UDG
144.
|
See also: block-chars
, set-udg
, rom-font
.
Source file: <src/lib/graphics.udg.fs>.
defer
defer ( "name" -- )
Create a deferred word.
Origin: Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
defer!
defer! ( xt1 xt2 -- )
Set the deferred word xt2 to execute xt1.
Origin: Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
defer@
defer@ ( xt1 -- xt2 )
Return the word xt2 currently associated to the deferred word xt1.
Origin: Forth-2012 (CORE EXT).
Source file: <src/lib/define.deferred.fs>.
deferred
deferred ( xt "name" -- )
Create a deferred word name that will execute xt. The
effect is the same than defer name xt ' name defer!
.
Source file: <src/lib/define.deferred.fs>.
deferred?
deferred? ( xt -- f )
Is xt a deferred word?
The code of a deferred word starts with a Z80 jump ($C3) to the word it’s associated to.
Source file: <src/lib/define.deferred.fs>.
defers
defers ( Compilation: "name" -- )
Compile the present contents of the deferred word "name" into the current definition. I.e. this produces static binding as if "name" was not deferred.
defers
is an immediate
word.
Origin: Gforth.
Source file: <src/lib/define.deferred.fs>.
defined
defined ( "name" -- nt | 0 )
Parse name and find its definition. If the definition is not found after searching all the word lists in the search order, return zero. If the definition is found, return its nt.
Definition:
: defined ( "name" -- nt | 0 ) parse-name find-name ;
See also: undefined?
, [defined]
, parse-name
,
find-name
.
Source file: <src/kernel.z80s>.
defines
defines ( xt class "name" -- )
Bind xt to the selector name in class class.
Source file: <src/lib/objects.mini-oof.fs>.
definitions
definitions ( -- )
Make the compilation word list the same as the first word list in the search order. The names of subsequent definitions will be placed in the compilation word list. Subsequent changes in the search order will not affect the compilation word list.
Definition:
: definitions ( -- ) context @ set-current ;
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (SEARCH), Forth-2012 (SEARCH).
See also: context
, set-current
, wordlist
, vocabulary
.
Source file: <src/kernel.z80s>.
delete
delete ( n -- )
Delete n characters prior to the cursor.
Source file: <src/lib/editor.specforth.fs>.
delete-file
delete-file ( ca len -- ior )
Delete the disk file named in the string ca len and return an error result ior.
Origin: Forth-94 (FILE), Forth-2012 (FILE).
See also: (delete-file)
.
Source file: <src/lib/dos.gplusdos.fs>.
delimited
delimited ( ca1 len1 -- ca2 len2 )
Add one leading space and one trailing space to string ca1
len1, returning the result ca2 len2 in the stringer
.
Source file: <src/lib/002.need.fs>.
dfor
dfor
Compilation: ( R: — dest ) Run-time: ( d — )
Start of a dfor
..dstep
loop, that will iterate ud+1
times, starting with du and ending with 0.
dfor
is an immediate
and compile-only
word.
The current value of the index can be retrieved with
dfor-i
.
Source file: <src/lib/flow.dfor.fs>.
dfor-i
dfor-i ( -- d )
Return the current index d of a dfor
loop.
Source file: <src/lib/flow.dfor.fs>.
dhz>bleep
dhz>bleep ( frequency duration1 -- duration2 pitch )
Convert frequency (in dHz, i.e. tenths of hertzs) and
duration1 (in ms) to the parameters duration2 pitch
needed by bleep
.
See also: hz>bleep
.
Source file: <src/lib/sound.48.fs>.
digit?
digit? ( c n -- u true | false )
Convert the ascii character c (using base n) to its binary equivalent u, accompanied by a true flag. If the conversion is invalid, leave only a false flag.
Origin: fig-Forth’s digit
.
Source file: <src/kernel.z80s>.
dip
dip ( x1 x2 -- x2 x2 )
This word is defined in Z80. Its equivalent definition in Forth is the following:
: dip ( x1 x2 -- x2 x2 ) nip dup ;
Source file: <src/lib/data_stack.fs>.
disk-buffer
disk-buffer ( -- a )
Address of the disk buffer, which is a cell that holds its id.
Source file: <src/kernel.z80s>.
display-char-bitmap_
display-char-bitmap_ ( -- a )
Return address a of a Z80 routine that displays the bitmap of a character at given cursor coordinates.
Input registers:
-
HL = address of the character bitmap
-
B = y coordinate (0..23)
-
C = x coordinate (0..31)
Source file: <src/lib/graphics.udg.fs>.
dnegate
dnegate ( d1 -- d2 )
Negate d1, giving its arithmetic inverse d2.
Origin: Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
do
do Compilation: ( -- do-sys )
do
is an immediate
and compile-only
word.
Definition:
: do ( -- do-sys ) postpone (do) >mark ; immediate compile-only
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/lib/flow.do.fs>.
docolon
docolon ( -- a )
A constant that returns the address of the colon interpreter.
dolocon
is used by does>
.
Source file: <src/kernel.z80s>.
does>
does> Compilation: ( -- ) Run-time: ( -- ) ( R: nest-sys1 -- )
Define the execution-time action of a word created by a high-level defining word. Used in the form:
: definer ... create ... does> ... ; definer name
does>
marks the termination of the defining part of the
defining word definer and then begins the definition of the
execution-time action for words that will later be defined by
definer. When name is later executed, the address of
name's parameter field is placed on the stack and then the
sequence of words between does>
and ;
are executed.
does>
is an immediate
and compile-only
word.
Definition:
: does> ( -- ) postpone (;code) docolon call, ; immediate compile-only
Detailed description, after Forth-2012:
Compilation:
Append the run-time semantics below to the current definition. Append the initiation semantics given below to the current definition.
Run-time:
Replace the execution semantics of the most recent definition, referred to as name, with the name execution semantics given below. Return control to the calling definition specified by nest-sys1.
Initiation: ( i*x — i*x pfa ) ( R: — nest-sys2)
Save information nest-sys2 about the calling definition. Place name's parameter field address on the stack. The stack effects i*x represent arguments to name.
name execution: ( i*x — j*x )
Execute the portion of the definition that begins with the
initiation semantics appended by the does>
which
modified name. The stack effects i*x and j*x represent
arguments to and results from name, respectively.
Origin: Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
don't
don't ( n1 n2 -- | n1 n2 )
If n1 equals n2, remove them and exit the definition
that called don’t
, else leave the n1 and n2 on the
stack.
don’t
is a compile-only
word.
don’t
is intended to be used before do
, as an
alternative to ?do
, when the do-loop structure is
factored in its own word.
Source file: <src/lib/flow.MISC.fs>.
dos
dos ( -- ca len )
Return the name of the DOS in string ca len. It can be "+3DOS", "G+DOS" or "TR-DOS".
Source file: <src/kernel.z80s>.
dos-in,
dos-in, ( -- )
Compile the Z80 instruction in a,(231)
, which pages in
the Plus D memory.
Source file: <src/lib/dos.gplusdos.fs>.
dos-out,
dos-out, ( -- )
Compile the Z80 instruction out (231),a
, which pages out
the Plus D memory.
Source file: <src/lib/dos.gplusdos.fs>.
dos-vars
dos-vars ( -- a )
Address of the G+DOS variables in the Plus D memory.
Source file: <src/lib/dos.gplusdos.fs>.
dosior>ior
dosior>ior ( dosior -- ior )
Convert a DOS dosior to a Forth ior.
dosior = the error number returned by G+DOS commands in the AF register:
-
bit 0 (Fc) = set: error; unset: no error
-
bits 8-14 = error code
-
bit 15 = set: OS error; unset: G+DOS error
ior = zero (no error) or Forth exception code:
-
-1031..-1000: Equivalent to G+DOS error codes 0..31.
-
-1154..-1128: Equivalent to OS error codes 0..27.
Definition:
: dosior>ior ( dosior -- ior ) dup 1 and negate \ error? swap flip %11111111 and \ get upper 8 bits 1000 + negate and ;
Source file: <src/kernel.gplusdos.z80s>.
dovocabulary
dovocabulary ( -- )
Change the behaviour of the latest word defined: Replace the first word list in the search order with the wid stored in its body.
Definition:
: dovocabulary ( -- ) does> ( -- ) ( pfa ) @ context ! ;
See also: vocabulary
, wordlist>vocabulary
, wordlist
.
Source file: <src/kernel.z80s>.
dp
dp ( -- a )
A user variable. a is the address of a cell containing the
data-space pointer. The value may be read by here
and
altered by there
and allot
.
Origin: fig-Forth.
Source file: <src/kernel.z80s>.
drive
drive ( c1 -- c2 )
Convert drive number c1 (0 index) to actual drive identifier c2 (DOS dependent).
drive
is used in order to make the code portable,
abstracting the DOS drive identifiers.
Usage example:
\ Set the second disk drive as default: 2 set-drive \ on G+DOS only 1 set-drive \ on TR-DOS only 'B' set-drive \ on +3DOS only 1 drive set-drive \ on any DOS -- portable code
See also: first-drive
, max-drives
.
Source file: <src/lib/dos.COMMON.fs>.
drop-type
drop-type ( ca len x -- )
Remove x from the stack and display the string ca len.
drop-type
is one of the possible actions of
type-right-field
and type-center-field
.
Source file: <src/lib/display.type.fs>.
drup
drup ( x1 x2 -- x1 x1 )
This word is defined in Z80. Its equivalent definition in Forth is the following:
: drup ( x1 x2 -- x1 x1 ) drop dup ;
Source file: <src/lib/data_stack.fs>.
dstep
dstep Compilation: ( dest -- ) Run-time: ( R: ud -- ud' )
dstep
is an immediate
and compile-only
word.
Compilation: ( dest — )
Append the run-time semantics given below to the current
definition. Resolve the destination of dfor
.
Run-time: ( R: ud — ud' )
If the loop index is zero, discard the loop parameters and continue execution after the loop. Otherwise decrement the loop index and continue execution at the beginning of the loop.
Source file: <src/lib/flow.dfor.fs>.
dtimes
dtimes ( d -- )
Repeat the next compiled instruction d times. If d is zero, continue executing the following instruction.
This structure is not nestable.
Usage example:
: blink ( -- ) 7 0 ?do i border loop 0 border ; : blinking ( -- ) 100000. dtimes blink ." Done" cr ;
See also: times
, executions
.
Source file: <src/lib/flow.times.fs>.
du/mod
du/mod ( ud1 ud2 -- ud3 ud4 )
Divide ud1 by ud2, giving the remainder ud3 and the quotient ud4.
See also: /mod
.
Source file: <src/lib/math.operators.2-cell.fs>.
dump
dump ( ca len -- )
Show the contents of len address units from ca.
Source file: <src/lib/tool.dump.fs>.
dup
dup ( x -- x x )
Duplicate x.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
dup>r
dup>r ( x -- x ) ( R: -- x )
A faster alternative to the idiom dup >r
.
Source file: <src/lib/return_stack.fs>.
dzx7m
dzx7m ( a1 a2 -- )
Decompress data, which has been compressed by ZX7, from a1 and copy the result to a2.
dzx7m
is the port of the ZX7 decompressor, "Mega"
version, written by Einar Saukas.
dzx7m
is the fastest (30% faster than dzx7s
) but
biggest (251 bytes) version of the decompressor. dzx7s
and dzx7t
are smaller but slower.
For more information, see http://www.worldofspectrum.org/infoseekid.cgi?id=0027996 ZX7 in World of Spectrum].
Source file: <src/lib/decompressor.zx7.fs>.
dzx7s
dzx7s ( a1 a2 -- )
Decompress data, which has been compressed by ZX7, from a1 and copy the result to a2.
dzx7s
is the port of the ZX7 decompressor, "Standard"
version, written by Einar Saukas, Antonio Villena &
Metalbrain.
dzx7s
is the smallest (87 bytes) but slowest version of
the decompressor. dzx7t
and dzx7m
are bigger but
faster.
For more information, see http://www.worldofspectrum.org/infoseekid.cgi?id=0027996 ZX7 in World of Spectrum].
Source file: <src/lib/decompressor.zx7.fs>.
dzx7t
dzx7t ( a1 a2 -- )
Decompress data, which has been compressed by ZX7, from a1 and copy the result to a2.
dzx7t
is the port of the ZX7 decompressor, "Turbo"
version, written by Einar Saukas & Urusergi.
dzx7t
is 25% faster than dzx7s
, and needs only 10
more bytes (97 bytes in total). dzx7m
is bigger but
faster.
For more information, see http://www.worldofspectrum.org/infoseekid.cgi?id=0027996 ZX7 in World of Spectrum].
Source file: <src/lib/decompressor.zx7.fs>.
e-bank_
e-bank_ ( -- a )
Return address a of a routine that pages in the
bank hold in the E register.
This routine is a secondary entry point of default-bank
.
-
Input: E = bank
-
Output: A corrupted
See also: default-bank_
.
Source file: <src/lib/memory.far.fs>.
either
either ( x1 x2 x3 -- f )
Return true if x1 equals either x2 or x3; else return false.
Origin: IsForth.
Source file: <src/lib/math.operators.1-cell.fs>.
else
else ( orig1 -- orig2 )
else
is an immediate
and compile-only
word.
Source file: <src/kernel.z80s>.
emit-udg
emit-udg ( c|n -- )
Print the UDG c|n from the current UDG set, which is pointed
by os-udg
.
Note
|
The usual parameter is c (0..255), but no check is done. If a 16-bit value n is received instead, it will be used as well in order to calculate the address of the corresponding character bitmap in the UDG set. |
See also: set-udg
, emit
, mode-32-emit
, last-font-char
.
Source file: <src/kernel.z80s>.
emits
emits ( c n -- )
If n is greater than zero, display n characters c.
Definition:
: emits ( c n -- ) 0 max 0 ?do dup emit loop drop ;
Source file: <src/kernel.z80s>.
empty-buffers
empty-buffers ( -- )
Unassign all block buffers. Do not transfer the contents of any updated block to mass storage.
Definition:
: empty-buffers ( -- ) $7FFF disk-buffer ! ;
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Controlled Reference Words), Forth-94 (BLOCK EXT), Forth-2012 (BLOCK EXT).
See also: update
, flush
, disk-buffer
.
Source file: <src/kernel.z80s>.
empty-heap
empty-heap ( -- )
Empty the current heap
, which was created by
allot-heap
, limit-heap
, bank-heap
or farlimit-heap
.
empty-heap
is a deferred word whose action can be
charlton-empty-heap
or gil-empty-heap
, depending on the
heap
implementation used by the application.
Source file: <src/lib/memory.allocate.COMMON.fs>.
empty-stringer
empty-stringer ( -- )
Empty the stringer
, by initializing +stringer
with
/stringer
. The contents of the stringer
are not modifed.
Definition:
: empty-stringer ( -- ) /stringer +stringer ! ;
See also: default-stringer
.
Source file: <src/kernel.z80s>.
end-app
end-app ( -- )
Mark the end of an application that is being loaded by
load-app
.
See also: loading-app
.
Source file: <src/lib/blocks.fs>.
end-asm
end-asm ( -- )
Exit the assembler mode started by asm
.
See also: end-code
.
Source file: <src/kernel.z80s>.
end-class
end-class ( class methods vars "name" -- )
End the definition of a class.
Source file: <src/lib/objects.mini-oof.fs>.
end-code
end-code ( -- )
Definition:
: end-code ( -- ) end-asm reveal ;
Origin: Forth-83 (Assembler Extension Word Set).
Source file: <src/kernel.z80s>.
end-data
end-data ( n orig -- )
Finish the definition started by data
, calculating the
number of data items of n address units that were
compiled and store it at orig.
Source file: <src/lib/data.data.fs>.
end-internal
end-internal ( -- a )
End internal (private) definitions. Return the current value of the headers pointer, which is the xtp (execution token pointer) of the next word defined.
The start of the internal definitions was marked by
internal
. The internal definitions can be unlinked by
unlink-internal
or hidden by hide-internal
.
Source file: <src/lib/modules.internal.fs>.
end-module
end-module ( parent-wid -- )
End a module
definition. All module internal words are no
longer accessible. Only words that have been exported with
export
are still available.
Source file: <src/lib/modules.module.fs>.
end-package
end-package ( wid0 wid1 -- )
End the current package, which was started by package
.
wid1 is the word list of the current package; wid0 is the word list in which the current package was created.
Origin: SwiftForth.
Source file: <src/lib/modules.package.fs>.
end-seclusion
end-seclusion ( wid1 wid2 -- )
End a seclusion
module.
See also: -seclusion
, +seclusion
.
Source file: <src/lib/modules.MISC.fs>.
end-structure
end-structure ( struct-sys +n -- )
Terminate definition of a structure started by
begin-structure
.
Origin: Forth-2012 (FACILITY EXT).
Source file: <src/lib/data.begin-structure.fs>.
end-transient
end-transient ( -- )
End the transient code started by transient
.
end-transient
must be used after compiling the
transient code.
See also: forget-transient
.
Source file: <src/lib/modules.transient.fs>.
end?ccase
end?ccase Compilation: ( C: orig -- ) Run-time: ( -- )
end?ccase
is an immediate
and compile-only
word.
Source file: <src/lib/flow.ccase.fs>.
endcase
endcase Compilation: ( 0 orig1..orign -- ) Run-time: ( x -- )
endcase
is an immediate
and compile-only
word.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/flow.case.fs>.
endccase
endccase Compilation: ( C: orig1 orig2 -- ) Run-time: ( -- )
endccase
is an immediate
and compile-only
word.
Source file: <src/lib/flow.ccase.fs>.
endccase0
endccase0 Compilation: ( C: orig -- ) Run-time: ( -- )
endcase0
is an immediate
and compile-only
word.
Source file: <src/lib/flow.ccase.fs>.
endm
endm ( -- )
Finish the definition of an assembler macro, started by
macro
.
endm
is an immediate
word.
Source file: <src/lib/assembler.macro.fs>.
endof
endof ( orig1 -- orig2 )
endof
is an immediate
and compile-only
word.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/flow.case.fs>.
entry:
entry: ( x wid "name" -- )
Create a cell entry "name" in associative list wid, with value x.
Source file: <src/lib/data.associative-list.fs>.
enum
enum ( n "name" -- n+1 )
Create a constant name with value n and return n+1.
Usage example:
0 enum first enum second enum third enum fourth drop
Source file: <src/lib/data.MISC.fs>.
enumcell
enumcell ( n "name" -- n+cell )
Create a constant name with value n and return n+cell.
Usage example:
0 enumcell first enumcell second enumcell third enumcell fourth drop
See also: enum
.
Source file: <src/lib/data.MISC.fs>.
environment-wordlist
environment-wordlist ( -- wid )
A constant that holds the word list identifier wid where the environmental queries are defined.
See also: environment?
.
Source file: <src/lib/environment-question.fs>.
environment?
environment? ( ca len -- false | i*x true )
The string ca len is the identifier of an environmental query. If the string is not recognized, return a false flag. Otherwise return a true flag and some information about the query.
String | Value data type | Constant? | Meaning |
---|---|---|---|
/COUNTED-STRING |
n |
yes |
maximum size of a counted string, in characters |
/HOLD |
n |
yes |
size of the pictured numeric output string buffer, in characters |
/PAD |
n |
yes |
size of the scratch area pointed to by PAD, in characters |
ADDRESS-UNIT-BITS |
n |
yes |
size of one address unit, in bits |
FLOORED |
flag |
yes |
true if floored division is the default |
MAX-CHAR |
u |
yes |
maximum value of any character in the implementation-defined character set |
MAX-D |
d |
yes |
largest usable signed double number |
MAX-N |
n |
yes |
largest usable signed integer |
MAX-U |
u |
yes |
largest usable unsigned integer |
MAX-UD |
ud |
yes |
largest usable unsigned double number |
RETURN-STACK-CELLS |
n |
yes |
maximum size of the return stack, in cells |
STACK-CELLS |
n |
yes |
maximum size of the data stack, in cells |
Notes:
-
Forth-2012 designates the Forth-94 practice of using
environment?
to inquire whether a given word set is present as obsolescent. The Forth-94 environmental strings are not supported in Solo Forth. -
In Solo Forth environment queries are also independent ordinary constants accessible by
need
.
Origin: Forth-2012 (CORE).
See also: environment-wordlist
. /counted-string
,
/pad
, address-unit-bits
, floored
, max-char
,
max-d
, max-n
, max-u
, max-ud
, return-stack-cells
,
stack-cells
.
Source file: <src/lib/environment-question.fs>.
erase
erase ( ca len -- )
If len is greater than zero, clear all bits in each ol len consecutive address units of memory beginning at ca.
Origin: fig-Forth, Forth-83 (Controlled Reference Words), Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
error
error ( n -- )
Save the error number n into error-number
, and the current
block and line into error-pos
, to be used by where
. Issue
error n and restart the system.
Definition:
: error ( n -- ) dup error-number ! >in @ blk @ error-pos 2! dup -1 = if (abort) then dup -2 = if space abort-message 2@ type (abort) then .error-word .throw (abort) ;
Source file: <src/kernel.z80s>.
error#
error# ( -- a )
Variable that holds the number of the last error issued by
error
.
Source file: <src/kernel.z80s>.
error-pos
error-pos ( -- a )
Double variable that holds the position of the last error
issued by error
:
See also: where
.
Source file: <src/kernel.z80s>.
error>line
error>line ( -n1 -- n2 )
Convert error code -n1 to line n2 relative to the block that contains the error messages.
Source file: <src/lib/exception.fs>.
error>ordinal
error>ordinal ( -n1 -- +n2 )
Convert an error code n1 to its ordinal position +n2 in the library.
-n1 = -90..-1 \ Standard error codes -300..-256 \ Solo Forth error codes -1024..-1000 \ G+DOS error codes +n2 = 1..146
Source file: <src/lib/exception.fs>.
errors-block
errors-block ( -- a )
Variable that contains the block that holds the error messages.
Source file: <src/lib/exception.fs>.
esc-block-chars-wordlist
esc-block-chars-wordlist ( -- wid )
Identifier of the word list that contains the escaped block characters used by the BASin IDE and other ZX Spectrum tools:
Escaped notation | Default character code |
---|---|
\<space><space> |
128 |
\<space>' |
129 |
\'<space> |
130 |
\'' |
131 |
\<space>. |
132 |
\<space>: |
133 |
\'. |
134 |
\': |
135 |
\.<space> |
136 |
\.' |
137 |
\:<space> |
138 |
\:' |
139 |
\.. |
140 |
\.: |
141 |
\:. |
142 |
\:: |
143 |
In order to make s\", `.\"
and their common factor
parse-esc-string
recognize the escaped block characters,
esc-block-chars-wordlist
must be pushed to the escaped
strings search order. Example:
need set-esc-order esc-standard-chars-wordlist esc-block-chars-wordlist 2 set-esc-order s\" \::\:.\ '\. \nNew line:\.'\:'\'.\: ..." type
The code of the first block character can be modified with
the character variable first-esc-block-char
.
See also: first-esc-block-char
, set-esc-order
, >esc-order
,
esc-standard-chars-wordlist
, esc-udg-chars-wordlist
,
parse-esc-string
, s\"
, .\"
.
Source file: <src/lib/strings.escaped.graphics.fs>.
esc-context
esc-context ( -- a )
A variable that holds the escaped strings search order: a
is the address of an array of cells, whose maximum length
is hold in the max-esc-order
constant, and whose current
length is hold in the #esc-order
variable. a holds the
word list at the top of the search order.
See also: esc-max-order
, >esc-order
, esc-get-order
,
esc-set-order
.
Source file: <src/lib/strings.escaped.fs>.
esc-previous
esc-previous ( -- )
Remove the top word list (the word list that is searched first) from the escaped strings search order.
Source file: <src/lib/strings.escaped.fs>.
esc-set-order
esc-set-order ( widn..wid1 n -- )
Set the escaped strings search order to the word lists identified by widn..wid1. Subsequently, word list wid1 will be searched first, and word list widn searched last. If n is zero, empty the escaped strings search order.
See also: esc-get-order
, >esc-order
,
esc-standard-chars-wordlist
, esc-block-chars-wordlist
,
esc-udg-chars-ẁordlist
.
Source file: <src/lib/strings.escaped.fs>.
esc-standard-chars-wordlist
esc-standard-chars-wordlist ( -- wid )
Identifier of the word list that contains the words whose
names are the standard characters that must be escaped
after a backslash in strings parsed by s\"
, .\"
and
other words.
The execution of the words defined in the word list
identified by esc-standard-chars-wordlist
returns the
new character(s) on the stack (the last one at the bottom)
and the count. Example of the stack effect of a escaped
character that returns two characters:
( -- c[1] c[0] 2 )
Most of the escaped characters are translated to one character, so they are defined as double constants.
Conversion rules:
Escaped | Name | ASCII characters |
---|---|---|
\a |
BEL (alert) |
7 |
\b |
BS (backspace) |
8 |
\e |
ESC (escape) |
27 |
\f |
FF (form feed) |
12 |
\l |
LF (line feed) |
10 |
\m |
CR/LF |
13, 10 |
\n |
newline |
13 |
\q |
double-quote |
34 |
\r |
CR (carriage return) |
13 |
\t |
HT (horizontal tab) |
9 |
\v |
VT (vertical tab) |
11 |
\z |
NUL (no character) |
0 |
\" |
double-quote |
34 |
\x<hexdigit><hexdigit> |
Conversion of the two hexadecimal digits |
See also: parse-esc-string
, set-esc-order
,
esc-standard-chars-wordlist
, esc-block-chars-wordlist
,
esc-udg-chars-ẁordlist
.
Source file: <src/lib/strings.escaped.fs>.
esc-udg-chars-wordlist
esc-udg-chars-wordlist ( -- wid )
Identifier of the word list that contains the words whose
names are the UDG characters ('A'..'U'), in upper case,
that must be escaped after a backslash in strings parsed by
s\"
, .\"
and other words.
The execution of the words defined in the word list
identified by esc-udg-chars-wordlist
returns the
correspondent UDG character (144..164) and a 1.
In order to make s\", `.\"
and their common factor
parse-esc-string
recognize the escaped UDG characters,
esc-udg-chars-wordlist
must be pushed on the escaped
strings search order. Example:
need set-esc-order esc-standard-chars-wordlist esc-udg-chars-wordlist 2 set-esc-order s\" \A\B\C\D\nNew line:\A\B\C\D..." type
Source file: <src/lib/strings.escaped.graphics.fs>.
evaluate
evaluate ( i*x ca len -- j*x )
Save the current input source specification. Store
minus-one (-1) in source-id
. Make the string described
by ca len both the input source and input buffer, set
>in
to zero, and interpret. When the parse area is
empty, restore the prior input source specification.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
See also: interpret
, execute-parsing
.
Source file: <src/lib/parsing.fs>.
even?
even? ( n -- f )
Is n an even number?
even?
is written in Z80. Its equivalent definition in
Forth is the following:
: even? ( n -- f ) 1 and 0= ;
See also: odd?
.
Source file: <src/lib/math.operators.1-cell.fs>.
exchange
exchange ( a1 a2 -- )
Exchange the cells stored in a1 and a2.
Source file: <src/lib/memory.MISC.fs>.
exec
exec ( "name" -- i*x )
Parse name. If "name" is the name of a word in the current search order, execute it; else throw exception #-13.
Source file: <src/lib/compilation.fs>.
execute
execute ( i*x xt -- j*x )
Execute execution token xt.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
See also: perform
.
Source file: <src/kernel.z80s>.
execute-hl,
execute-hl, ( -- )
Compile an execute
with the xt hold in the HL register.
execute-hl,
is used to call Forth words from Z80.
See also: call-xt,
.
Source file: <src/lib/assembler.fs>.
execute-parsing
execute-parsing ( ca len xt -- )
Make ca len the current input source, execute xt, then restore the previous input source.
See also: evaluate
, interpret
, string>source
,
nest-source
.
Origin: Gforth.
Source file: <src/lib/parsing.fs>.
executing?
executing? ( -- f )
Definition:
: executing? ( -- f ) state @ 0= ;
Source file: <src/kernel.z80s>.
exit
exit ( -- ) ( R: nest-sys -- )
Return control to the calling definition, specified by nest-sys.
Before executing exit
within a do-loop, a program shall
discard the loop-control parameters by executing unloop
.
exit
is compiled by ;
.
In Solo Forth exit
can be used in interpretation mode to
stop the interpretation of a block, like fig-Forth’s ;s
.
Origin: fig-Forth’s ;s
, Forth-79 (Required Word Set),
Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012
(CORE).
Source file: <src/kernel.z80s>.
exitcase
exitcase ( -- )
End part of a thiscase
structure: exit the current
definition.
exitcase
is an immediate
and compile-only
word.
Source file: <src/lib/flow.thiscase.fs>.
export
export ( parent-wid "name" -- parent-wid )
Make the word named name accessible outside the module
currently defined. name will be still available after
end-module
.
Source file: <src/lib/modules.module.fs>.
extended-number-point?
extended-number-point? ( c -- f )
Is character c an extended number point? Allowed points are: plus sign, comma, hyphen, period, slash and colon, after Forth Programmer’s Handbook.
extended-number-point?
is an alternative action for the
deferred word number-point?
, which is used in number?
,
and whose default action is standard-number-point?
.
See also: classic-number-point?
.
Source file: <src/lib/math.number.point.fs>.
f
f ( "ccc<eol>" -- )
Search forward from the current cursor position until string "ccc" is found. The cursor is left at the end of the string and the cursor line is printed. If the string is not found and error message is given and the cursor repositioned to the top of the block.
Source file: <src/lib/editor.specforth.fs>.
f!
f! ( fa -- ) ( F: r -- )
Store r at fa.
Origin: Forth-94 (FLOATING), Forth-2012 (FLOATING).
Source file: <src/lib/math.floating_point.rom.fs>.
f,
f, ( -- ) ( F: r -- )
Reserve data space for one floating-point number and store r in that space.
Origin: Gforth.
Source file: <src/lib/math.floating_point.rom.fs>.
f==
f== ( -- f ) ( F: r1 r2 -- )
Exact bitwise equality.
Are r1 and r2 exactly identical? Flag f is true if the bitwise comparison of r1 and r2 is succesful.
Source file: <src/lib/math.floating_point.rom.fs>.
f@
f@ ( fa -- ) ( F: -- r )
r is the value stored at fa.
Origin: Forth-94 (FLOATING), Forth-2012 (FLOATING).
Source file: <src/lib/math.floating_point.rom.fs>.
fade-display
fade-display ( -- )
Do a screen fade to black, by decrementing the values of paper and ink in a loop.
Source file: <src/lib/graphics.display.fs>.
false
false ( -- false )
Return a false flag, a single-cell value with all bits clear.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
far
far ( a1 -- a2 )
Convert a far-memory address a1 ($0000..$FFFF) to its actual
equivalent a2 ($C000..$FFFF) and page in the corresponding
memory bank, using the configuration at far-banks
.
far
is written in Z80. Its equivalent definition in Forth
is the following:
: far ( a1 -- a2 ) u>ud /bank um/mod far-banks + c@ bank bank-start + ;
Source file: <src/kernel.z80s>.
far!
far! ( x a -- )
Store x into far-memory address a.
far!
is written in Z80. Its equivalent definition in Forth
is the following:
: far! ( x a -- ) >r split r@ 1+ far c! r> farc! ;
Faster but larger definition:
: far! ( x a -- ) >r split r@ 1+ far c! r> far c! default-bank ;
See also: far-banks
.
Source file: <src/kernel.z80s>.
far+!
far+! ( n|u a -- )
Add n|u to the single-cell number at far-memory address a.
Source file: <src/lib/memory.far.fs>.
far,"
far," ( "ccc<quote>" -- )
Parse "ccc" delimited by a double-quote and compile the string in far memory.
Source file: <src/lib/strings.far.fs>.
far-banks
far-banks ( -- ca )
Address of an array of four bytes. It holds the four memory banks used as a virtual 64-KiB continuous space, called "far memory". Every byte holds the bank number used for a 16-KiB range of addresses, as follows:
Offset | Address range | Bank |
---|---|---|
+0 |
$0000..$3FFF |
1 |
+1 |
$4000..$7999 |
3 |
+2 |
$8000..$BFFF |
4 |
+3 |
$C000..$FFFF |
6 |
Warning
|
On +3DOS bank 6 is used for disk cache and RAM disk,
and the default value of farlimit is $C000 instead of $0000.
Therefore, the name space is 16 KiB smaller than on G+DOS or
TR-DOS.
|
See also: bank
, banks
, bank-index
, far
, far@
,
farc@
, far!
, farc!
, farcount
, farplace
, fartype
,
faruppers
, farlimit
.
Source file: <src/kernel.z80s>.
far-hl_
far-hl_ ( -- a )
Address of the far.hl
routine of the kernel, which
converts the far-memory address ($0000..$FFFF) hold in the
HL register to its actual equivalent ($C000..$FFFF) and
pages in the correspondent memory bank.
Input:
-
HL = far-memory address ($0000..$FFFF)
Output:
-
HL = actual memory address ($C000..$FFFF)
-
A DE corrupted
Source file: <src/lib/memory.far.fs>.
far2@+
far2@+ ( a -- a' xd )
Fetch xd from a. Return a', which is a incremented by two cells. This is handy for stepping through double-cell arrays.
Source file: <src/lib/memory.far.fs>.
far2avariable
far2avariable ( n "name" -- )
Create, in far memory, a 1-dimension double-cell variables array name with n elements and the execution semantics defined below.
name execution:
name ( n — a )
Return far-memory address a of element n.
See also: faravariable
, farcvariable
, 2avariable
.
Source file: <src/lib/data.array.variable.far.fs>.
far>sconstant
far>sconstant ( ca len "name" -- )
Create a string constant name in far memory with value ca len.
When name is executed, it returns the string ca len in
the stringer
as ca2 len.
See also: farsconstant
.
Source file: <src/lib/strings.far.fs>.
far>sconstants
far>sconstants ( 0 ca[n]..ca[1] "name" -- n )
Create a table of string constants name in far memory, using counted strings ca[n]..ca[1], being 0 a mark for the last string on the stack, and return the number n of compiled strings.
When name is executed, it converts the index on the stack
(0..n-1) to the correspondent string ca len in far
memory, and return a copy in the stringer
.
Usage example:
0 \ end of strings np@ far," kvar" \ string 4 np@ far," tri" \ string 3 np@ far," du" \ string 2 np@ far," unu" \ string 1 np@ far," nul" \ string 0 far>sconstants digitname constant digitnames cr .( There are ) digitnames . .( digit names:) 0 digitname cr type 1 digitname cr type 2 digitname cr type 3 digitname cr type cr
See also: sconstants
, farsconstants
.
Source file: <src/lib/strings.far.fs>.
far>stringer
far>stringer ( ca1 len1 -- ca2 len1 )
Save the string ca1 len1, which is in far memory, to the
stringer
and return it as ca2 len1.
See also: >stringer
.
Source file: <src/lib/strings.far.fs>.
far@
far@ ( a -- x )
Fetch x from far-memory address a.
far@
is written in Z80. Its equivalent definition in Forth
is the following:
: far@ ( a -- x ) dup 1+ far c@ >r farc@ r> join ;
Faster but larger definition:
: far@ ( a -- x ) dup 1+ far c@ >r far c@ r> join default-bank ;
See also: far-banks
.
Source file: <src/kernel.z80s>.
far@+
far@+ ( a -- a' x )
Fetch x from far-memory address a. Return a', which is a incremented by one cell. This is handy for stepping through cell arrays.
Source file: <src/lib/memory.far.fs>.
farallot
farallot ( n -- )
If n is greater than zero, reserve n address units of headers space. If n is less than zero, release n address units of headers space. If n is zero, leave the headers-space pointer unchanged.
Source file: <src/lib/memory.far.fs>.
faravariable
faravariable ( n "name" -- )
Create, in far memory, a 1-dimension single-cell variables array name with n elements and the execution semantics defined below.
name execution:
name ( n — a )
Return far-memory address a of element n.
See also: far2avariable
, farcavariable
, avariable
.
Source file: <src/lib/data.array.variable.far.fs>.
farc!
farc! ( c ca -- )
Store c into far-memory address ca.
See also: far-banks
.
Source file: <src/kernel.z80s>.
farc+!
farc+! ( c ca - )
Add c to the char at far-memory address ca
Source file: <src/lib/memory.far.fs>.
farc@
farc@ ( ca -- c )
Fetch c from far-memory address ca.
See also: far-banks
.
Source file: <src/kernel.z80s>.
farc@+
farc@+ ( ca -- ca' c )
Fetch the character c at far-memory address ca. Return ca', which is ca incremented by one character. This is handy for stepping through character arrays.
Source file: <src/lib/memory.far.fs>.
farcavariable
farcavariable ( n "name" -- )
Create, in far memory, a 1-dimension character variables array name with n elements and the execution semantics defined below.
name execution:
name ( n — ca )
Return far-memory address ca of element n.
See also: faravariable
, far2variable
, cavariable
.
Source file: <src/lib/data.array.variable.far.fs>.
farcount
farcount ( ca1 -- ca2 len2 )
A variant of count
that works with far-memory addresses.
See also: far-banks
.
Source file: <src/kernel.z80s>.
fardump
fardump ( ca len -- )
Show the contents of len address units from far-memory address ca.
Source file: <src/lib/tool.dump.far.fs>.
farlimit
farlimit ( -- a )
A variable. a is the address of a cell containing the
address above the highest address usable by the names space
Variable that holds the far-memory address above the highest
address usable by the names space (the names space is the
region addressed by np
). Its default value is zero, which is
right above the highest far-memory address ($FFFF).
farlimit
can be modified by a program in order to reserve
a memory zone for special purposes.
Origin: Fig-Forth’s limit
constant.
Source file: <src/kernel.z80s>.
farlimit-heap
farlimit-heap ( n -- a )
Create a heap
of n address units right above farlimit
and return its address a. farlimit
is moved down n
address units, and heap-bank
is updated with the
corresponding bank.
allocate
, resize
and free
page in the corresponding
bank at the start and restore the default bank at the end.
Warning
|
The heap must be in one memory bank. Therefore,
before executing farlimit-heap , the application must
check that the n address units below farlimit belong to
one memory bank.
|
See also: allot-heap
, bank-heap
, limit-heap
,
empty-heap
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
farlowers
farlowers ( ca len -- )
A variant of lowers
that works in far memory.
See also: far-banks
.
Source file: <src/kernel.z80s>.
farplace
farplace ( ca1 len1 ca2 -- )
Store the string ca1 len1 (which must be below memory address $C000) as a counted string at far-memory address ca2.
Source file: <src/kernel.z80s>.
farsconstant
farsconstant ( ca len "name" -- )
Create a string constant name in far memory with value ca len.
When name is executed, it returns the string ca len in far memory as ca2 len.
See also: far>sconstant
.
Source file: <src/lib/strings.far.fs>.
farsconstants
farsconstants ( 0 ca[n]..ca[1] "name" -- )
Create a table of string constants name in far memory, using counted strings ca[n]..ca[1], being 0 a mark for the last string on the stack, and return the number n of compiled strings.
When name is executed, it converts the index on the stack (0..n-1) to the correspondent string ca len in far memory.
Usage example:
0 \ end of strings np@ far," kvar" \ string 4 np@ far," tri" \ string 3 np@ far," du" \ string 2 np@ far," unu" \ string 1 np@ far," nul" \ string 0 farsconstants digitname constant digitnames cr .( There are ) digitnames . .( digit names:) 0 digitname cr fartype 1 digitname cr fartype 2 digitname cr fartype 3 digitname cr fartype cr
See also: sconstants
, far>sconstants
.
Source file: <src/lib/strings.far.fs>.
farsconstants,
farsconstants, ( 0 ca[n]..ca[1] "name" -- n )
Create a table of string constants name in far memory, using counted strings ca[n]..ca[1], being 0 a mark for the last string on the stack, and return the number n of compiled strings.
When name is executed, it returns an address that holds the address of the table in far memory.
farconstants,
is a common factor of farsconstants
and
far>sconstants
.
Source file: <src/lib/strings.far.fs>.
farsconstants>
farsconstants> ( n a -- ca len )
Return the far-memory string ca len whose address is stored at the n cell of the table a in data space.
farsconstants>
is a factor of farsconstants
and
far>sconstants
.
Source file: <src/lib/strings.far.fs>.
fartype
fartype ( ca len -- )
If len is greater than zero, display the character string ca len, which is stored in the far memory.
Source file: <src/lib/display.type.fs>.
fartype-ascii
fartype-ascii ( ca len -- )
If len is greater than zero, display the string ca len, which is stored in far memory, replacing non-ASCII and control chars with a dot.
See also: fartype
, type-ascii
.
Source file: <src/lib/display.type.fs>.
farunused
farunused ( -- u )
Return the amount of far-memory space remaining in the region
addressed by np
, in address units.
Source file: <src/kernel.z80s>.
faruppers
faruppers ( ca len -- )
Convert string ca len, which is stored in far memory, to uppercase.
Source file: <src/lib/strings.far.fs>.
farwdump
farwdump ( a len -- )
Show the contents of len cells from far-memory address a.
Source file: <src/lib/tool.dump.far.fs>.
fast-get-key?
fast-get-key? ( -- f )
An alternative to key?
. It works also when the system
interrupts are off. Faster variant with absolute jumps.
See also: get-key?
.
Source file: <src/lib/keyboard.get-key-question.fs>.
fast-gxy>scra_
fast-gxy>scra_ ( -- a )
Return address a of a a modified copy of the PIXEL-ADD ROM routine ($22AA), to let the range of the y coordinate be 0..191 instead of 0..175.
This code is a bit faster than slow-gxy>scra_
because
the necessary jump to the ROM is saved and a useless and
a
has been removed. But in most cases the speed gain is so
small (only 0.01: see set-pixel-bench
) that it’s not
worth the extra space, including the assembler.
When fast-gxy>scra_
is loaded, it is set as the
current action of gxy>scra_
.
Input registers:
-
C = x cordinate (0..255)
-
B = y coordinate (0..191)
Output registers:
-
HL = address of the pixel byte in the screen bitmap
-
A = position of the pixel in the byte address (0..7), note: position 0=bit 7, position 7=bit 0.
See also: gxy176>scra_
.
Source file: <src/lib/graphics.pixels.fs>.
fast-pixels
fast-pixels ( -- n )
Return the number n of pixels set on the screen.
This is the default action of pixels
.
See also: slow-pixels
, bits
.
Source file: <src/lib/graphics.pixels.fs>.
fast-random
fast-random ( n1 -- n2 )
Return a random number n2 from 0 to n1 minus 1.
Source file: <src/lib/random.fs>.
fast-rnd
fast-rnd ( -- u )
Return a random number u.
fast-rnd
generates a sequence of pseudo-random values
that has a cycle of 65536 (so it will hit every single
number): f(n+1)=241f(n)+257
.
See also: fast-random
, rnd
.
Source file: <src/lib/random.fs>.
fconstant
fconstant ( "name" -- ) ( F: r -- )
Create a floating-point constant called "name" with value r.
Origin: Forth-94 (FLOATING), Forth-2012 (FLOATING).
Source file: <src/lib/math.floating_point.rom.fs>.
fetchhl
fetchhl ( -- a )
Return address a of a secondary entry point in the code of
@
. The code at a fetches the cell pointed by the HL
register, pushes it onto the stack and then continues at the
address returned by next
.
See also: pushhl
.
Source file: <src/kernel.z80s>.
field:
field: ( n1 "name" -- n2 )
Parse name. offset is the first cell aligned value greater than or equal to n1. n2 = offset + 1 cell.
Create a definition for name with the execution semantics defined below.
name execution: ( a1 — a2 )
Add the offset calculated during the compile-time action to a1 giving the address a2.
Origin: Forth-2012 (FACILITY EXT).
See also: begin-structure
, +field
.
Source file: <src/lib/data.begin-structure.fs>.
file-dir#
file-dir# ( ca len -- n ior )
Return the file directory number of the file named in the character string ca len. If the file was successfully found, ior is zero and n is the file directory number. Otherwise ior is an exception code and n is undefined.
See also: file-status
.
Source file: <src/lib/dos.gplusdos.fs>.
file-dirdesc
file-dirdesc ( ca len -- n ior )
Return the G+DOS file directory identifier of the file named in the character string ca len. If the file was successfully found, ior is zero and n is the file directory identifier. Otherwise ior is an exception code and n is undefined.
See also: file-status
.
Source file: <src/lib/dos.gplusdos.fs>.
file-exists?
file-exists? ( ca len -- f )
If the file named in the character string ca len is found, f is true. Otherwise f is false.
See also: file-status
.
Source file: <src/lib/dos.gplusdos.fs>.
file-length
file-length ( ca1 len1 -- len2 ior )
Return the file length of the file named in the character string ca1 len1. If the file was successfully found, ior is zero and len2 is the file length. Otherwise ior is an exception code and len2 is undefined.
See also: file-status
.
Source file: <src/lib/dos.gplusdos.fs>.
file-start
file-start ( ca1 len1 -- ca2 ior )
Return the file start address of the file named in the character string ca1 len1. If the file was successfully found, ior is zero and ca2 is the start address. Otherwise ior is an exception code and ca2 is undefined.
See also: file-status
.
Source file: <src/lib/dos.gplusdos.fs>.
file-status
file-status ( ca len -- a ior )
Return the status of the file identified by the character
string ca len. If the file exists, ior is zero and a
is the address returned by ufia
. Otherwise ior is the
corresponding I/O result code and a is useless.
Origin: Forth-94 (FILE-EXT), Forth-2012 (FILE-EXT).
See also: file-exists?
, file-start
, file-length
,
file-type
, file-dir
, find-file
, file-dir#
,
file-dirdesc
.
Source file: <src/lib/dos.gplusdos.fs>.
file-type
file-type ( ca len -- n ior )
Return the G+DOS file-type indentifier of the file named in the character string ca len. If the file was successfully found, ior is zero and n is the file-type identifier. Otherwise ior is an exception code and n is undefined.
See also: file-status
.
Source file: <src/lib/dos.gplusdos.fs>.
file>
file> ( ca1 len1 ca2 len2 -- ior )
Read the contents of a disk file, whose filename is defined by the string ca1 len1, to memory zone ca2 len2 (i.e. read len2 bytes and store them starting at address ca2), or use the original address and length of the file instead, depending on the following rules:
-
If len2 is not zero, use ca2 len2.
-
If len2 is zero, use the original file length instead and then check also ca2: If ca2 is zero, use the original file address instead.
Return error result ior.
Example:
The screen memory has been saved to a disk file using the following command:
16384 6912 s" pic.scr" >file
Therefore, its original address is 16384 and its original size is 6912 bytes.
Now there are four ways to load the file from disk:
Example | Result |
---|---|
|
Load the file using its original known values |
|
Load only the bitmap to the original known address |
|
Load the file using its original unknown values |
|
Load the whole file to address 32768 |
|
Load only 256 bytes to address 32768 |
Source file: <src/lib/dos.gplusdos.fs>.
fill
fill ( ca len b -- )
If u is not zero, store b in each of u consecutive characters of memory beginning at a.
Origin: fig-Forth, Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
find
find ( -- )
Search for a match to the string at pad
, from the cursor
position until the end of block. If no match found issue
an error message and reposition the cursor at the top of
the block.
Source file: <src/lib/editor.specforth.fs>.
find
find ( ca -- ca 0 | xt 1 | xt -1 )
Find the definition named in the counted string at ca. If the definition is not found, return ca and zero. If the definition is found, return its execution token xt. If the definition is immediate, also return one (1), otherwise also return minus-one (-1).
Origin: Forth-83 (Required Word Set), Forth-94 (CORE, SEARCH), Forth-2012 (CORE, SEARCH).
See also: find-name
, find-name-from
, find-name-in
.
Source file: <src/lib/word_lists.fs>.
find-file
find-file ( ca len -- a | 0 )
If the file named in the character string ca len is
found, update the contents of ufia
and return its address
a. Otherwise return zero.
See also: file-status
.
Source file: <src/lib/dos.gplusdos.fs>.
find-name
find-name ( ca len -- nt | 0 )
Find the definition identified by the string ca len in the current search order. If the definition is not found after searching all the vocabularies in the search order, return zero. If the definition is found, return its nt.
Definition:
: find-name ( ca len -- nt | 0 ) #order @ 0 ?do 2dup context i cells + @ @ find-name-from ?dup ( ca len nt nt | ca len 0 ) if nip nip unloop exit then ( ca len ) loop 2drop false ;
Origin: Gforth.
See also: find-name-in
, find-name-from
, find
.
Source file: <src/kernel.z80s>.
find-name-from
find-name-from ( ca len nt1 -- nt2 | 0 )
Find the definition named in the string ca len, starting at nt1. If the definition is found, return its nt2, else return zero.
String ca len must be below memory address $C000.
See also: find-name
, find-name-in
, find
.
Source file: <src/kernel.z80s>.
find-name-in
find-name-in ( ca len wid -- nt | 0 )
Find the definition named in the string at ca len, in the word list identified by wid. If the definition is found, return its nt, else return zero.
See also: search-wordlist
, find-name-from
, find-name
,
find
.
Source file: <src/lib/word_lists.fs>.
find-substitution
find-substitution ( ca len -- xt f | 0 )
Given a string ca len, find its substitution. Return xt and f if found, or just zero if not found.
See also: replaces
.
Source file: <src/lib/strings.replaces.fs>.
finish-code
finish-code ( -- )
End the current definition, allow it to be found in the dictionary and enter interpretation state.
Definition:
: finish-code ( -- ) ?csp postpone [ noname? @ noname? off ?exit reveal ;
Origin: Gforth.
Source file: <src/kernel.z80s>.
first-drive
first-drive ( -- c )
A constant that returns the identifier c of the first drive available in the DOS.
See also: max-drives
, drive
.
Source file: <src/kernel.z80s>.
first-esc-block-char
first-esc-block-char ( -- a )
A variable that holds the code of the first block graphic. Its default value is 128, like in the ZX Spectrum charset. This variable can be modified in order to make the escaped block characters produce a different range of codes.
See also: esc-block-chars-wordlist
.
Source file: <src/lib/strings.escaped.graphics.fs>.
first-locatable
first-locatable ( -- a )
A variable that holds the number of the first block to be
searched by located
and its descendants.
See also: last-locatable
, need-from
.
Source file: <src/lib/002.need.fs>.
first-name
first-name ( ca1 len1 -- ca2 len2 )
Return the first name ca2 len2 from string ca1 len1. A name is a substring separated by spaces.
Source file: <src/lib/strings.MISC.fs>.
flash-mask
flash-mask ( -- b )
A constant. b is the bitmask of the bit used to indicate the flash status in an attribute byte.
See also: flash-mask
, flashy
, set-flash
, attr!
.
Source file: <src/lib/display.attributes.fs>.
flash.
flash. ( n -- )
Set flash n by printing the corresponding control characters. If n is zero, turn flash off; if n is one, turn flash on; if n is eight, set transparent flash. Other values of n are converted as follows:
-
2, 4 and 6 are converted to 0.
-
3, 5 and 7 are converted to 1.
-
Values greater than 8 or less than 0 are converted to 8.
flash.
is much slower than set-flash
or attr!
, but
it can handle pseudo-color 8 (transparent), setting the
corresponding system variables accordingly.
See also: bright.
, (0-1-8-color.
.
Source file: <src/lib/display.attributes.fs>.
flashy
flashy ( b1 -- b2 )
Convert attribute b1 to its flashy equivalent b2.
flashy
is written in Z80. Its equivalent definition in
Forth is the following:
: flashy ( b1 -- b2 ) flash-mask or ;
Source file: <src/lib/display.attributes.fs>.
flip
flip ( x1 -- x2 )
Exchange the low and high bytes within x1, resulting x2.
Note
|
flip is called >< or cswap in other Forth
systems.
|
Origin: eForth.
Source file: <src/kernel.z80s>.
floor
floor ( F: r1 -- r2 )
Round r1 to an integral value using the "round toward negative infinity" rule, giving r2.
Origin: Forth-94 (FLOATING), Forth-2012 (FLOATING).
Source file: <src/lib/math.floating_point.rom.fs>.
floored
floored ( -- f )
f is true if floored division is the default.
See also: environment?
.
Source file: <src/lib/environment-question.fs>.
flush
flush ( -- )
Perform the function of save-buffers
, then unassign all
block buffers.
Origin: Forth-83 (Required Word Set), Forth-94 (BLOCK), Forth-2012 (BLOCK).
See also: empty-buffers
.
Source file: <src/lib/blocks.fs>.
fly-located
fly-located ( ca len -- block | 0 )
Locate the first block whose header contains the string ca len (surrounded by spaces), and return its number. If not found, return zero. The search is case-sensitive. Index all searched blocks on the fly.
See also: use-fly-index
.
Source file: <src/lib/blocks.indexer.fly.fs>.
fm/mod
fm/mod ( d1 n1 -- n2 n3 )
Floored division:
d1 = n3*n1+n2 n1>n2>=0 or 0>=n2>n1
Divide d1 by n1, giving the floored quotient n3 and the remainder n2. Input and output stack arguments are signed.
Dividend | Divisor | Remainder | Quotient |
---|---|---|---|
10 |
7 |
3 |
1 |
-10 |
7 |
4 |
-2 |
10 |
-7 |
-4 |
-2 |
-10 |
-7 |
-3 |
1 |
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/lib/math.operators.1-cell.fs>.
for
for Compilation: ( R: -- dest ) Run-time: ( n -- )
Start of a for
..step
loop, that will iterate n+1
times, starting with n and ending with 0.
The current value of the index can be retrieved with
for-i
.
for
is an immediate
and compile-only
word.
Source file: <src/lib/flow.for.fs>.
forget-transient
forget-transient ( -- )
Forget the transient code compiled between transient
and
end-transient
, by unlinking the header space that was
reserved and used for it. forget-transient
must be
used when the transient code is not going to be used any
more.
The inner operation is: Restore the old value of
latest-wordlist
; store the nt of the latest word
created before compiling the transient code, into the lfa
of the first word created after the transient code was
finished by end-transient
.
Source file: <src/lib/modules.transient.fs>.
forth
forth ( -- )
Transform the search order consisting of wid[n]..wid[2]
wid[1] (where wid[1] is searched first) into
wid[n]..wid[2] wid[forth-wordlist
], i.e. replace the top
word list of the search order with forth-wordlist
.
forth
is the vocabulary corresponding to forth-wordlist
.
Origin: Forth-83 (Required Word Set), Forth-94 (SEARCH EXT), Forth-2012 (SEARCH EXT).
See also: root
, wordlist
, vocabulary
.
Source file: <src/kernel.z80s>.
forth-wordlist
forth-wordlist ( -- wid )
Return wid, the identifier of the word list that includes
all standard words provided by the implementation.
forth-wordlist
is initially the compilation word list and
is part of the initial search order.
Origin: Forth-94 (SEARCH), Forth-2012 (SEARCH).
See also: wordlist
, set-order
, root-wordlist
,
assembler-wordlist
.
Source file: <src/kernel.z80s>.
fplay
fplay ( ca -- )
Play a sound whose 14 bytes are stored at ca. fplay
is a faster version of play
.
Source file: <src/lib/sound.128.fs>.
frames
frames ( u -- )
Stop execution during at least u frames of the TV (there are 50 frames per second in in Europe and 60 frames per second in USA).
Source file: <src/lib/time.fs>.
frames!
frames! ( d -- )
Store d at the system frames counter, which is incremented every 20 ms by the OS.
See also: frames@
, reset-frames
, os-frames
, bench{
.
Source file: <src/lib/time.fs>.
frames@
frames@ ( -- d )
Fetch the system frames counter, which is incremented every 20 ms by the OS.
See also: frames!
, reset-frames
, os-frames
, bench{
.
Source file: <src/lib/time.fs>.
free
free ( a -- ior )
Return the contiguous region of data space indicated by a
to the system for later allocation. a shall indicate a
region of data space that was previously obtained by
allocate
or resize
.
If the operation succeeds, ior is zero. If the operation fails, ior is an exception code.
free
is a deferred word whose action can be
charlton-free
or gil-free
, depending on the heap
implementation used by the application.
Origin: Forth-94 (MEMORY), Forth-2012 (MEMORY).
See also: allocate
, resize
, empty-heap
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
free-buffer
free-buffer ( n -- )
If the current disk buffer has been updated, write its block to the disk. Assign block number n to the disk buffer.
Definition:
: free-buffer ( n -- ) updated? if buffer-block write-buffer then disk-buffer ! ;
Source file: <src/kernel.z80s>.
fround
fround ( r1 -- r2 )
Round r1 to an integral value using the "round to nearest" rule, giving r2.
Origin: Forth-94 (FLOATING), Forth-2012 (FLOATING).
Source file: <src/lib/math.floating_point.rom.fs>.
ftrunc
ftrunc ( F: r1 -- r2 )
Round r1 to an integral value using the "round toward zero" rule, giving r2.
Origin: Forth-94 (FLOATING), Forth-2012 (FLOATING).
Source file: <src/lib/math.floating_point.rom.fs>.
fyi
fyi ( -- )
Print information about the current status of the Forth system.
Source file: <src/lib/tool.debug.fyi.fs>.
f~
f~ ( -- f ) ( F: r1 r2 r3 -- )
Medley for comparing r1 and r2 for equality:
Origin: Forth-94 (FLOATING EXT), Forth-2012 (FLOATING EXT).
See also: f~rel
.
Source file: <src/lib/math.floating_point.rom.fs>.
f~abs
f~abs ( -- f ) ( F: r1 r2 r3 -- )
Approximate equality with absolute error: |r1-r2|<r3
.
Flag f is true if the absolute value of r1-r2 is less than r3.
Origin: Gforth.
Source file: <src/lib/math.floating_point.rom.fs>.
f~rel
f~rel ( -- f ) ( F: r1 r2 r3 -- )
Approximate equality with relative error:
|r1-r2|<r3*|r1+r2|
.
Flag f is true if the absolute value of r1-r2 is less than the value of r3 times the sum of the absolute values of r1 and r2.
Source file: <src/lib/math.floating_point.rom.fs>.
f~relabs
f~relabs ( -- f ) ( F: r1 r2 r3 -- )
Approximate equality with relative error:
|r1-r2|<|r3|*|r1+r2|
.
Flag f is true if the absolute value of r1-r2 is less than the absolute value of r3 times the sum of the absolute values of r1 and r2.
Source file: <src/lib/math.floating_point.rom.fs>.
g+dos
g+dos ( -- )
An alias of noop
that is defined only in the G+DOS version
of Solo Forth. Its goal is to be used to check the DOS the
application is running on.
g+dos
is an immediate
word.
Source file: <src/kernel.z80s>.
g-at-x
g-at-x ( gx -- )
Set the current graphic x coordinate gx, without changing the current graphic y coordinate.
Source file: <src/lib/graphics.coordinates.fs>.
g-at-xy
g-at-xy ( gx gy -- )
Set the current graphic coordinates gx gy.
Source file: <src/lib/graphics.coordinates.fs>.
g-at-y
g-at-y ( gy -- )
Set the current graphic y coordinate gy, without changing the current graphic x coordinate.
Source file: <src/lib/graphics.coordinates.fs>.
g-cr
g-cr ( -- )
Move the graphic coordinates to the next character row.
Source file: <src/lib/display.g-emit.fs>.
g-emit
g-emit ( gx gy c -- )
Display character c (32..255) at the current graphic coordinates. If c is 32..127, it is printed from the main font. If c is 128..255, it is printed from the UDG font.
The character is printed with overprinting (equivalent to
1 overprint
).
See also: g-emit-udg
, (g-emit
, g-type
.
Source file: <src/lib/display.g-emit.fs>.
g-emit-udg
g-emit-udg ( c -- )
Display UDG c (0..255) at the current graphic
coordinates, from the font pointed by system variable
os-udg
, which contains the address of the first UDG
bitmap (0).
The UDG character is printed with overprinting (equivalent
to 1 overprint
).
Source file: <src/lib/display.g-emit.fs>.
g-emit_
g-emit_ ( -- a )
Address of a machine code routine that prints an 8x8 bits
character at graphic coordinates. Used by g-emit-udg
.
Input registers:
-
DE = address of the first char (0) bitmap in a charset
-
A = char code (0..255)
-
B = y coordinate
-
C = x coordinate
Modifies: AF BC HL IX DE
See also: g-emit
.
Source file: <src/lib/display.g-emit.fs>.
g-emitted
g-emitted ( -- )
Update the current graphic coordinates after printing a character at them.
Source file: <src/lib/display.g-emit.fs>.
g-home
g-home ( -- )
Set the graphic coordinates to 0, 0.
See also: g-at-xy
.
Source file: <src/lib/graphics.coordinates.fs>.
g-type
g-type ( ca len -- )
If len is greater than zero, display the character string ca len at the current graphic coordinates.
See also: g-emit
.
Source file: <src/lib/display.g-emit.fs>.
g-x
g-x ( -- gx )
Return the current graphic x coordinate gx.
Source file: <src/lib/graphics.coordinates.fs>.
g-xy
g-xy ( -- gx gy )
Return the current graphic coordinates gx gy.
Source file: <src/lib/graphics.coordinates.fs>.
g-y
g-y ( -- gy )
Return the current graphic y coordinate gy.
Source file: <src/lib/graphics.coordinates.fs>.
gcd
gcd ( n1 n2 -- n3 )
n3 is the greatest common divisor of n1 and n2.
Source file: <src/lib/math.operators.1-cell.fs>.
get-block-drives
get-block-drives ( -- c[n]..c[1] n )
Get the current configuration of block drives, as configured by `
to the drives specified by drive identifiers c[n]..c[1].
Subsequently drive c[1] will be searched first for
blocks, from block 0 to blocks/disk
minus one, and so on.
If n is zero, no drive is used for blocks.
See also: -block-drives
, #block-drives
, block-drive!
.
Source file: <src/lib/dos.COMMON.fs>.
get-bright
get-bright ( -- f )
If bright is active in the current attribute, return true, else return false.
Source file: <src/lib/display.attributes.fs>.
get-current
get-current ( -- wid )
Return wid, the identifier of the compilation word list.
Definition:
: get-current ( -- wid ) current @ ;
Origin: Forth-94 (SEARCH), Forth-2012 (SEARCH).
See also: current
.
Source file: <src/kernel.z80s>.
get-date
get-date ( -- day month year )
Get the current date. The default date is 2016-01-01. It
can be changed with set-date
. The date is not updated by
the system.
Source file: <src/lib/time.fs>.
get-default-bank
get-default-bank ( -- +n )
Get the current default bank +n by fetching the contents
of default-bank#
.
See also: set-default-bank
, default-bank
, bank
,
banks
.
Source file: <src/lib/memory.bank.fs>.
get-drive
get-drive ( -- n )
Get the current drive n (1 or 2).
See also: set-drive
.
Source file: <src/lib/dos.gplusdos.fs>.
get-esc-order
get-esc-order ( -- wid[n]..wid[1] n )
Return the number of word lists n in the escaped strings search order and the word lists identifiers wid[n]..wid[1] identifying these word lists. wid[1] identifies the word list that is searched first, and wid[n] the word list that is searched last.
See also: set-esc-order
, >esc-order
.
Source file: <src/lib/strings.escaped.fs>.
get-flash
get-flash ( -- f )
If flash is active in the current attribute, return true, else return false.
Source file: <src/lib/display.attributes.fs>.
get-font
get-font ( -- a )
Get address a of the current font (characters 32..127),
by fetching the system variable os-chars
. a is the
bitmap address of character 0.
See also: set-font
, default-font
.
Source file: <src/lib/display.fonts.fs>.
get-heap
get-heap ( -- a u b )
Get the values of the current heap: its address a
(returned by heap
), its size u (returned by /heap
)
and its bank b (stored in heap-bank
).
get-heap
and set-heap
are useful when more than one
memory heap are needed by the application.
Source file: <src/lib/memory.allocate.COMMON.fs>.
get-inkey
get-inkey ( -- 0 | c )
Leave the value of the key being pressed. If no key being pressed leave zero.
get-inkey
reads the keyboard, so it works even when the
keyboard is not read by an interrupts routine.
Source file: <src/lib/keyboard.get-inkey.fs>.
get-key?
get-key? ( -- f )
An alternative to key?
. It works also when the system
interrupts are off. Variant with relative jumps.
See also: key?
, fast-get-key?
.
Source file: <src/lib/keyboard.get-key-question.fs>.
get-mixer
get-mixer ( -- b )
Get the contents b of the mixer register of the AY-3-8912 sound generator.
Register 7 (Mixer - I/O Enable)
This controls the enable status of the noise and tone mixers for the three channels, and also controls the I/O port used to drive the RS232 and Keypad sockets.
Bit 0 Channel A Tone Enable (0=enabled).
Bit 1 Channel B Tone Enable (0=enabled).
Bit 2 Channel C Tone Enable (0=enabled).
Bit 3 Channel A Noise Enable (0=enabled).
Bit 4 Channel B Noise Enable (0=enabled).
Bit 5 Channel C Noise Enable (0=enabled).
Bit 6 I/O Port Enable (0=input, 1=output).
Bit 7 Not used.
Source file: <src/lib/sound.128.fs>.
get-order
get-order ( -- wid[n]..wid[1] n )
Return the number of word lists n in the search order and the word lists identifiers wid[n]..wid[1] identifying these word lists. wid[1] identifies the word list that is searched first, and wid[n] the word list that is searched last.
: get-order ( -- wid[n]..wid[1] n ) #order @ dup 0 ?do dup i - 1- cells context + @ swap loop ;
Origin: Forth-94 (SEARCH), Forth-2012 (SEARCH).
Source file: <src/kernel.z80s>.
get-time
get-time ( -- second minute hour )
Return the current time.
The system doesn’t have a clock. The system frames counter is used instead. It is increased by the interrupts routine every 20th ms. The counter is a 24-bit value, so its maximum is $FFFFFF ticks of 20 ms (5592 minutes, 93 hours), then it starts again from zero.
Source file: <src/lib/time.fs>.
get-udg
get-udg ( -- a )
Get address a of the current UDG set (characters
0..255), by fetching the system variable os-udg
. a
is the bitmap address of character 0.
See also: set-udg
.
Source file: <src/lib/graphics.udg.fs>.
gigatype
gigatype ( ca len n -- )
If len is greater than zero, display text string ca len
as a title with style n (0..7), at the current cursor
coordinates. gigatype
displays characters from the
current font, with doubled pixels (16x16 pixels per
character) and modifying them on the fly after a given
style n. The text is combined with the current content
of the screen, as if overprint
were active. The current
attribute, set by attr!
and other words, is used to color
the text.
Usage example:
: demo ( -- ) cls 8 0 ?do 17 0 i 3 * tuck at-xy s" GIGATYPE" i gigatype at-xy ." style " i . loop key drop home ;
See also: gigatype-title
, set-font
, (gigatext
,
type
.
Source file: <src/lib/display.gigatype.fs>.
gigatype-title
gigatype-title ( ca1 len1 n -- )
If len1 is greater than zero, display the character
string ca1 len1 at the center of the current row (the
current column is not used), using gigatype
and its style
number n.
Warning
|
gigatype prints double-size (16x16 pixels)
characters. Therefore, the maximum value of len1 is 16
characters, but gigatype-title does no check. Beside,
it calculates the column of the title assuming the current
mode is mode32 (32 characters per line), which is the
default one.
|
See also: type-center-field
.
Source file: <src/lib/display.gigatype.fs>.
gil-allocate
gil-allocate ( u -- a ior )
Allocate u address units of contiguous data space. The data-space pointer is unaffected by this operation. The initial content of the allocated space is undefined.
If the allocation succeeds, a is the aligned starting address of the allocated space and ior is zero.
If the operation fails, a does not represent a valid address and ior is #-59.
gil-allocate
is the action of allocate
in the heap
implementation based on written code written by Javier Gil,
whose words are defined in gil-heap-wordlist
.
See also: gil-free
.
Source file: <src/lib/memory.allocate.gil.fs>.
gil-empty-heap
gil-empty-heap ( -- )
Empty the current heap
, which was created by
allot-heap
, limit-heap
, bank-heap
or farlimit-heap
.
gil-empty-heap
is the action of empty-heap
in the
memory heap
implementation based on code written by
Javier Gil, whose words are defined in gil-heap-wordlist
.
See also: gil-allocate
, gil-free
.
Source file: <src/lib/memory.allocate.gil.fs>.
gil-free
gil-free ( a -- ior )
Return the contiguous region of data space indicated by a
to the system for later allocation. a shall indicate a
region of data space that was previously obtained by
gil-allocate
.
gil-free
is the action of free
in the heap
implementation based on written code written by Javier Gil,
whose words are defined in gil-heap-wordlist
.
Source file: <src/lib/memory.allocate.gil.fs>.
gil-heap-wordlist
gil-heap-wordlist ( -- wid )
wid is the word-list identifier of the word list that
holds the words the memory heap
implementation adapted
from code written by Javier Gil (2007-01).
need gil-heap-wordlist
is used to load the memory heap
implementation and configure allocate
, free
and
empty-heap
accordingly. This implementation of the memory
heap does not provide resize
.
An alternative, bigger implementation of the memory heap is
provided by charlton-heap-wordlist
.
The actual heap must be created with allot-heap
,
limit-heap
, farlimit-heap
or bank-heap
, which are
independent from the heap implemention.
Source file: <src/lib/memory.allocate.gil.fs>.
greater-of
greater-of Compilation: ( -- of-sys ) Run-time: ( x1 x2 -- | x1 )
greater-of
is an immediate
and compile-only
word.
Usage example:
: test ( x -- ) case 10 of ." ten!" endof 15 greater-of ." greater than 15" endof ." less than 10 or 11..15" endcase ;
See also: less-of
.
Source file: <src/lib/flow.case.fs>.
green
green ( -- b )
A constant that returns 4, the value that represents the green color.
Source file: <src/lib/display.attributes.fs>.
gx>x
gx>x ( gx -- x )
Convert graphic x coordinate gx to column x.
Source file: <src/lib/graphics.pixels.fs>.
gxy176>scra
gxy176>scra ( gx gy -- n a )
Return screen address a and pixel position n (0..7) of pixel coordinates gx (0..255) and gy (0..175).
See also: gxy176>scra_
, gxy>scra
, xy>scra
.
Source file: <src/lib/graphics.pixels.fs>.
gxy176>scra_
gxy176>scra_ ( -- a )
Return address a of a routine that uses an alternative entry point to the PIXEL-ADD ROM routine ($22AA), to bypass the error check.
Input registers:
-
C = x cordinate (0..255)
-
B = y coordinate (0..176)
Output registers:
-
HL = address of the pixel byte in the screen bitmap
-
A = position of the pixel in the byte address (0..7), note: position 0=bit 7, position 7=bit 0.
See also: gxy176>scra
, gxy>scra_
.
Source file: <src/lib/graphics.pixels.fs>.
gxy>attra
gxy>attra ( gx gy -- a )
Convert pixel coordinates gx gy to their correspondent attribute address a.
Source file: <src/lib/graphics.pixels.fs>.
gxy>scra
gxy>scra ( gx gy -- n a )
Return screen address a and pixel position n (0..7) of pixel coordinates gx (0..255) and gy (0..191).
See also: gxy>scra_
, gxy176>scra
, xy>scra
.
Source file: <src/lib/graphics.pixels.fs>.
gxy>scra_
gxy>scra_ ( -- a )
A deferred word that executes fast-gxy>scra_
or, by
default, slow-gxy>scra_
: Return address a of an
alternative to the PIXEL-ADD ROM routine ($22AA), to let
the range of the y coordinate be 0..191 instead of 0..175.
See also: gxy176>scra_
, xy>scra_
.
Source file: <src/lib/graphics.pixels.fs>.
gy>y
gy>y ( gy -- y )
Convert graphic y coordinate gy to row y.
Source file: <src/lib/graphics.pixels.fs>.
h
h ( n -- )
Hold line n at pad
(used by system more often than by
user).
Source file: <src/lib/editor.specforth.fs>.
header
header ( "name" | -- )
A deferred word that creates a dictionary header. Its default
action is stream-name-header
, and it’s set by
default-header
. Its alternative temporary action is
nextname-header
.
See also: header,
.
Source file: <src/kernel.z80s>.
header,
header, ( ca len -- )
Create a definition header in the names space using the name ca len and hide it by setting its smudge bit.
The execution token pointer of the new header points to the data space pointer.
Source file: <src/kernel.z80s>.
heap
heap ( -- a )
The memory heap can be created by allot-heap
,
limit-heap
, bank-heap
, or farlimit-heap
. Then it must
be initialized by empty-heap
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
heap-bank
heap-bank ( -- ca )
A character variable ca that contains the memory bank
used to store the heap
, when the memory heap was created
by bank-heap
or farlimit-heap
. If the heap was created
by allot-heap
or limit-heap
, heap-bank
contains
zero.
Source file: <src/lib/memory.allocate.COMMON.fs>.
heap-in
heap-in ( -- )
If the current heap
was created by bank-heap
or
farlimit-heap
, page in its bank, which is stored at
heap-bank
; else do nothing.
See also: heap-out
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
heap-out
heap-out ( -- )
If the current heap
was created by bank-heap
or
farlimit-heap
, page in the default memory bank instead;
else do nothing.
heap-out
is a deferred word whose default action is
noop
. Its alternative action is default-bank
.
See also: heap-in
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
here
here ( -- a )
Return the address of the data-space pointer.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
hex
hex ( -- )
Set contents of base
to sixteen.
Origin: fig-Forth, Forth-79 (Reference Word Set), Forth-83 (Controlled Reference Words), Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
hex.
hex. ( n -- )
Display n as an unsigned hexadecimal number, followed by one space.
Source file: <src/lib/display.numbers.fs>.
hex>
hex> ( -- )
End a code zone where hexadecimal radix is the default, by
restoring the value of base
from base'
. The zone was
started by <hex
.
Source file: <src/lib/display.numbers.fs>.
hidden
hidden ( nt -- )
Hide the definition nt by setting its smudge
bit.
Source file: <src/kernel.z80s>.
hide-internal
hide-internal ( nt xtp -- )
Hide all words defined between the latest pair internal
and end-external
, setting the smudge
bit of their
headers.
Usage example:
internal : hello ( -- ) ." hello" ; end-internal : salute ( -- ) hello ; hide-internal salute \ ok! hello \ error!
At least one word must be defined between end-internal
and hide-internal
.
The alternative word unlink-internal
uses a different,
simpler method: it unlinks the internal words from the
dictionary.
privatize
uses a similar method, but it has error
checking and does not use the stack.
Source file: <src/lib/modules.internal.fs>.
hld
hld ( -- a )
A user variable that holds the address of the latest character of text during numeric output conversion.
Origin: fig-Forth.
Source file: <src/kernel.z80s>.
holds
holds ( ca len -- )
Add string ca len to the pictured numeric output string.
Origin: Forth-2012 (CORE EXT).
Source file: <src/lib/display.numbers.fs>.
home
home ( -- )
Set the cursor position at the top left position (column 0, row 0).
home
is a deferred word, whose default action is (home)
.
See also: at-xy
.
Source file: <src/kernel.z80s>.
horizontal-curtain
horizontal-curtain ( b -- )
Wash the screen with the given color attribute b from the top and bottom rows to the middle.
See also: vertical-curtain
.
Source file: <src/lib/graphics.cls.fs>.
hunt
hunt ( ca1 len1 ca2 len2 -- ca3 len3 )
Search a string ca1 len1 for a substring ca2 len2. Return the part of ca1 len1 that starts with the first occurence of ca2 len2. Therefore ca3 len3 = ca1+n len1-n.
Origin: Charscan library, by Wil Baden, 2003-02-17, public domain.
Source file: <src/lib/strings.MISC.fs>.
hz>bleep
hz>bleep ( frequency duration1 -- duration2 pitch )
Convert frequency (in Hz) and duration1 (in ms) to
the parameters duration2 pitch needed by bleep
.
See also: dhz>bleep
.
Source file: <src/lib/sound.48.fs>.
i
i ( -- n|u ) ( R: do-sys -- do-sys )
Return a copy of the current (innermost) loop index.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
i
i ( n -- )
Insert text from pad
at line n, moving the old line n
down. Line 15 is lost.
Source file: <src/lib/editor.specforth.fs>.
if
if ( Compilation: -- orig ) ( Run-time: x -- )
if
is an immediate
and compile-only
word.
Source file: <src/kernel.z80s>.
ifcase
ifcase ( x f -- )
Part of a thiscase
structure that checks x. If f is
true, discard x and continue execution; else skip the
code compiled until the next exitcase
.
ifcase
is an immediate
and compile-only
word.
See also: othercase
.
Source file: <src/lib/flow.thiscase.fs>.
ifelse
ifelse ( x1 x2 f -- x1 | x2 )
If f is true return x1, otherwise return x2.
Source file: <src/lib/math.operators.1-cell.fs>.
immediate
immediate ( -- )
Make the most recent definition an immediate word.
Definition:
: immediate ( -- ) immediate-mask latest lex! ;
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
See also: immediate?
, compile-only
.
Source file: <src/kernel.z80s>.
immediate-mask
immediate-mask ( -- b )
Constant that holds the bitmask of the precedence bit, set by
immediate
.
See also: compile-only-mask
.
Source file: <src/kernel.z80s>.
immediate?
immediate? ( nt -- f )
Is the word nt immediate?
Definition:
: immediate? ( nt -- f ) immediate-mask lex? ;
See also: immediate
, lex?
, immediate-mask
.
Source file: <src/kernel.z80s>.
index
index ( u1 u2 -- )
Print the first line of each block over the range from u1 to u2, which conventionally contains a comment with a title.
Origin: fig-Forth, Forth-79 (Reference Word Set), Forth-83 (Uncontrolled Reference Words).
Source file: <src/lib/tool.list.blocks.fs>.
index-block
index-block ( block -- )
Index block block.
See also: use-fly-index
.
Source file: <src/lib/blocks.indexer.fly.fs>.
index-ilike
index-ilike ( u1 u2 "name" -- )
Print the first line of each block over the range from u1 to u2, which conventionally contains a comment with a title, as long as the string name is included in the line. The string comparison is case-insensitive.
See also: index
, index-like
.
Source file: <src/lib/tool.list.blocks.fs>.
index-like
index-like ( u1 u2 "name" -- )
Print the first line of each block over the range from u1 to u2, which conventionally contains a comment with a title, as long as the string name is included in the line. The string comparison is case-sensitive.
See also: index
, index-ilike
.
Source file: <src/lib/tool.list.blocks.fs>.
index-name
index-name ( ca len -- )
Add word ca len to the blocks index, if not done before.
The current word list must be index-wordlist
.
Warning
|
The block where ca len was found is stored as
the execution token of its definition in the index. This
way the index uses no data space. Don’t put
index-wordlist in the search order unless you know what
you’re doing.
|
Source file: <src/lib/blocks.indexer.COMMON.fs>.
index-wordlist
index-wordlist ( -- wid )
Word list for the indexed words.
Source file: <src/lib/blocks.indexer.COMMON.fs>.
indexed-block?
indexed-block? ( block -- f )
Is block block indexed?
See also: use-fly-index
.
Source file: <src/lib/blocks.indexer.fly.fs>.
indexed-blocks
indexed-blocks ( -- ca )
Bit array to mark the indexed blocks
See also: use-fly-index
.
Source file: <src/lib/blocks.indexer.fly.fs>.
init-2val
init-2val ( -- )
Init the default behaviour of words created by 2val
: Make
them return their content.
init-2val
is a factor of 2val
.
Source file: <src/lib/data.val.fs>.
init-arg-action
init-arg-action ( -- )
Set arg-action
to arg-default-action
.
init-arg-action
is a factor of arguments
.
Source file: <src/lib/locals.arguments.fs>.
init-asm
init-asm ( -- )
A deferred word called by asm
. Its action is set by the
assembler labels module in order to init the labels. Its
default action is noop
.
Source file: <src/kernel.z80s>.
init-cval
init-cval ( -- )
Init the default behaviour of words created by cval
: Make
them return their content.
init-cval
is a factor of cval
.
Source file: <src/lib/data.val.fs>.
init-labels
init-labels ( -- )
Init the assembler labels and their references, by
allocating space for them in the stringer
and erasing it.
labels
and l-refs
are given new values.
Loading init-labels
makes it the action of init-asm
,
which is called by asm
and therefore also by code
and
;code
. Therefore, if the application needs a specific
ammount of labels or label references, max-labels
and
max-l-refs
must be configured before compiling the
assembly word.
Source file: <src/lib/assembler.labels.fs>.
init-val
init-val ( -- )
Init the default behaviour of words created by val
: Make
them return their content.
init-val
is a factor of val
.
Source file: <src/lib/data.val.fs>.
ink.
ink. ( b -- )
Set ink color to b (0..9), by printing the corresponding control characters. If b is greater than 9, 9 is used instead.
ink.
is much slower than set-ink
or attr!
, but it
can handle pseudo-colors 8 (transparent) and 9 (contrast),
setting the corresponding system variables accordingly.
See also: paper.
, (0-9-color.
.
Source file: <src/lib/display.attributes.fs>.
inkey
inkey ( -- 0 | c )
Leave the value of the key being pressed. If no key being pressed, leave 0.
inkey
works only when an interrupts routine reads the
keyboard and updates the related system variables.
Source file: <src/lib/keyboard.inkey.fs>.
input-buffer
input-buffer ( -- a )
A double-cell variable that holds the address and length of the current input buffer.
See also: source
, set-source
.
Source file: <src/kernel.z80s>.
input-stream-header
input-stream-header ( "name" -- )
Create a dictionary header name.
Definition:
: input-stream-header ( "name" -- ) parse-name ?name-too-short header, ;
See also: header
, header,
, nextname-header
,
parse-name
, ?name-too-short
.
Source file: <src/kernel.z80s>.
internal
internal ( -- nt )
Start internal (private) definitions. Return the nt of the latest word created in the compilation word list.
The end of the internal definitions is marked by
end-internal
. Then those definitions can be unlinked by
unlink-internal
or hidden by hide-internal
.
Source file: <src/lib/modules.internal.fs>.
interpret
interpret ( -- )
The text interpreter which sequentially executes or compiles
text from the input stream (terminal or disk) depending on
state
. if the word name cannot be found after a search of
the context
search order it is converted to a number
according to the current base
. That also failing, an error
message will be given.
The actions of the text interpreter are determined by the
configuration of interpret-table
.
See also: evaluate
, execute-parsing
, set-source
,
nest-source
.
Source file: <src/kernel.z80s>.
interpret-table
interpret-table ( -- a )
Return the address of the execution table used by interpret
.
The table contains 13 vectors. The behaviour of the Forth
text interpreter can be changed by replacing these vectors.
See the kernel source for details on the position and function
of the vectors.
Source file: <src/kernel.z80s>.
inverse
inverse ( f -- )
If f is zero, turn the inverse printing mode off; else turn it on.
See also: inverse-off
, inverse-on
, overprint
.
Source file: <src/lib/display.attributes.fs>.
inverse-cond
inverse-cond ( op1 -- op2)
Convert an assembler condition flag (actually, an absolute jump opcode) to its opposite.
Source file: <src/lib/assembler.fs>.
inverse-off
inverse-off ( -- )
Turn the inverse printing mode off.
See also: inverse-on
, inverse
, overprint-off
.
Source file: <src/lib/display.attributes.fs>.
inverse-on
inverse-on ( -- )
Turn the inverse printing mode on.
See also: inverse-off
, inverse
, overprint-on
.
Source file: <src/lib/display.attributes.fs>.
invert
invert ( x1 -- x2 )
Invert all bits of x1 giving its logical inverse x2.
Source file: <src/kernel.z80s>.
invert-display
invert-display ( -- )
Invert the pixels of the whole screen.
See also: wave-display
, fade-display
.
Source file: <src/lib/graphics.display.fs>.
isolate
isolate ( -- )
Create a word list, push it on the search order and set it as the compilation word list.
isolate
is the simplest way to create a module. Usage
example:
get-current isolate \ Inner words. set-current \ Interface words. previous
Source file: <src/lib/modules.MISC.fs>.
item
item ( ca len wid -- i*x )
If ca len is an item of associative list wid, return its value i*x; else throw exception -13, "undefined word".
Source file: <src/lib/data.associative-list.fs>.
item?
item? ( ca len wid -- false | xt true )
Is ca len an item of associative list wid? If so return its xt and true, else return false.
Source file: <src/lib/data.associative-list.fs>.
items
items ( wid -- )
List items of associative list wid.
Source file: <src/lib/data.associative-list.fs>.
j
j ( -- n|u ) ( R: loop-sys1 loop-sys2 -- loop-sys1 loop-sys2 )
Return a copy n|u of the next-outer loop
index.
Origin: Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/lib/flow.j.fs>.
join
join ( b1 b2 -- x )
b1 is the low-order byte of x, and b2 is the high-order byte of x.
Origin: IsForth.
See also: split
.
Source file: <src/lib/math.operators.1-cell.fs>.
jp,
jp, ( a -- )
Compile the Z80 opcode to jump to a.
Definition:
: jp, ( a -- ) $C3 c, , ;
See also: call,
.
Source file: <src/kernel.z80s>.
jppushhl,
jppushhl, ( -- )
Compile a Z80 jump to pushhl
.
Actually two instructions are compiled: push hl
and jp
(ix)
(the IX register holds the address returned by next
).
The execution of these instructions is faster than an absolute
jump to a push, and they need 3 bytes, same as a jump.
Source file: <src/kernel.z80s>.
k
k ( -- n|u ) ( R: loop-sys1..loop-sys3 -- loop-sys1..loop-sys3 )
Return a copy n|u of the second outer loop
index.
Origin: Forth-83 (Controlled reference words).
Source file: <src/lib/flow.j.fs>.
key-translation-table
key-translation-table ( -- a )
A variable that holds the address of the current key
translation table, used by key
.
The table consists of pairs of characters. The first one is the character that has to be translated and the second one is its translation. The table is finished with a zero.
The default table makes it possible to access the following characters with Symbol Shift: '[', ']', '~', '|', '\', '{' and '}'.
Source file: <src/kernel.z80s>.
key?
key? ( -- f )
Origin: Forth-94 (FACILITY), Forth-2012 (FACILITY).
Source file: <src/kernel.z80s>.
keys
keys ( -- n )
A constant that holds the number of keys on the keyboard: 40.
Source file: <src/lib/keyboard.MISC.fs>.
kk,
kk, ( bitmask port -- )
Store a key definition into the keys table.
Source file: <src/lib/keyboard.MISC.fs>.
kk-chars
kk-chars ( -- a )
Address of a 40-byte table that contains the chars used as names of the keys.
The table contains one byte per physical key, and it’s organized by keyboard rows.
By default, the first 4 UDG (chars 128..131) are used for keys whose names are not a printable char:
-
128 = Caps Shift
-
129 = Enter
-
130 = Space
-
131 = Symbol Shift
Source file: <src/lib/keyboard.MISC.fs>.
kk-ports
kk-ports ( -- a )
A table that contains the key definitions (bitmak and port) of all keys.
The table contains 40 items, one per physical key, and it’s organized by keyboard rows.
Every item occupies 3 or 4 bytes, depending on the value of
/kk
.
Source file: <src/lib/keyboard.MISC.fs>.
kk@
kk@ ( a -- bitmask port )
Fetch a key definition from the keys table.
Source file: <src/lib/keyboard.MISC.fs>.
l!
l! ( x n -- )
If assembler label n has been defined in the current
definition, throw exception #-284 (assembly label number
already used); else create a new assembler label n with
value x and resolve all previous references to it that
could have been created by rl#
or al#
. Usually x is
an address.
See also: l:
.
Source file: <src/lib/assembler.labels.fs>.
l-refs
l-refs ( -- a )
A variable. a contains the address of the label
references table, which is allocated in the stringer
by
init-labels
. The size of the table can be configured with
max-l-refs
.
Each element of the table (0 index) has the following structure:
+0 = byte: unused reference: all bits are 0 used reference: label number: bits 0..5 relative reference?: bit 6 = 1 (mask `<<entry726C2D6964, pass:c[rl-id]>>`) absolute reference?: bit 7 = 1 (mask `<<entry616C2D6964, pass:c[al-id]>>`) +1 = cell: label address
Source file: <src/lib/assembler.labels.fs>.
l:
l: ( n -- )
If assembler label n has been defined in the current
definition, throw exception #-284 (assembly label number
already used); else create a new assembler label n with
the value returned by here
and resolve all previous
references to it that could have been created by rl#
or
al#
.
See also: l!
.
Source file: <src/lib/assembler.labels.fs>.
labels
labels ( -- a )
A variable. a contains the address of the labels table,
which is allocated in the stringer
by init-labels
. The
size of the table can be configured with max-label
.
Each element of the table (0 index) is one cell, which holds hold the address of the correspending label, or zero if the label is undefined.
Source file: <src/lib/assembler.labels.fs>.
last
last ( -- a )
User variable that holds the name token of the last word defined.
Source file: <src/kernel.z80s>.
last-column
last-column ( -- col )
Last column (x coordinate) in the current screen mode.
Source file: <src/lib/display.cursor.fs>.
last-font-char
last-font-char ( -- ca )
Address ca holds the code of the last character displayed
from the current font by the current action of emit
. Higher
characters are managed apart, usually displayed by emit-udg
,
depending on the actual implementation of emit
, which is a
deferred word.
At the moment, only mode-32-emit
checks this value.
Eventually, also the alternative modes will use it.
Note that this is a character variable, which must be set with
c!
. Its default value is 127.
Note that emit-udg
prints characters 0..255 from the
current UDG set. This is different from Sinclair BASIC, where
UDG code 164 is the first one in the UDG set.
Source file: <src/kernel.z80s>.
last-locatable
last-locatable ( -- a )
A variable that holds the number of the last block to be
searched by located
and its descendants. Its default
value is the last block of the disk.
See also: first-locatable
.
Source file: <src/lib/002.need.fs>.
last-name
last-name ( ca1 len1 -- ca2 len2 )
Get the last name ca2 len2 from string ca1 len1. A name is a substring separated by spaces.
See also: first-name
, /name
, string/
, -suffix
.
Source file: <src/lib/strings.MISC.fs>.
last-row
last-row ( -- row )
Last row (y coordinate) in the current screen mode.
See also: last-column
, row
, rows
.
Source file: <src/lib/display.cursor.fs>.
last-tape-filename
last-tape-filename ( -- ca )
Address of the filename in last-tape-header
.
See also: /tape-filename
, tape-filename
.
Source file: <src/lib/tape.fs>.
last-tape-filetype
last-tape-filetype ( -- ca )
Address of the file type (one byte) in last-tape-header
.
See also: tape-filetype
.
Source file: <src/lib/tape.fs>.
last-tape-header
last-tape-header ( -- ca )
Address of the second tape header, which is used by the ROM
routines while loading. Its structure is the identical to
tape-header
.
It can be used by the application to know the details of the last tape file that was loaded.
See also: last-tape-filename
, last-tape-filetype
,
last-tape-start
, last-tape-length
.
Source file: <src/lib/tape.fs>.
lastblk
lastblk ( -- a )
User variable that holds the block number of the block most
recently or loaded (with load
or continued
). lastblk
is used by reload
.
Source file: <src/kernel.z80s>.
lastxt
lastxt ( -- a )
User variable that holds the execution token of the last word defined.
Source file: <src/kernel.z80s>.
latest
latest ( -- nt )
Leave the name token of the last word defined.
Origin: Gforth.
Source file: <src/kernel.z80s>.
latest>wordlist
latest>wordlist ( wid -- )
Associate the latest name to the word list identified by wid.
See also: wordlist
, wordlist-name!
,
wordlist>vocabulary
, wordlists
, latest
.
Source file: <src/lib/word_lists.fs>.
latestxt
latestxt ( -- xt )
Leave the execution token of the last word defined.
Origin: Gforth.
Source file: <src/kernel.z80s>.
lb
lb ( -- )
List bottom half of screen hold in scr
.
See also: lt
, lm
, list
, list-lines
.
Source file: <src/lib/tool.list.blocks.fs>.
leapy-year?
leapy-year? ( n -- f )
Is n a leapy year?
See also: set-date
.
Source file: <src/lib/time.fs>.
leave
leave ( -- ) ( R: loop-sys -- )
Discard the loop
control parameters for the current nesting level.
Continue execution immediately following the innermost syntactically
enclosing loop
or +loop
.
Origin: Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
lengths
lengths ( ca1 len1 ca2 len2 -- ca1 len1 ca2 len2 len1 len2 )
Duplicate lengths len1 and len2 of strings ca1 len1
and ca2 len2. lengths
is a factor of s+
.
lengths
is written in Z80. Its equivalent definition in
Forth is the following:
: lengths ( ca1 len1 ca2 len2 -- ca1 len1 ca2 len2 len1 len2 ) 2over nip over ;
Source file: <src/lib/strings.MISC.fs>.
less-of
less-of Compilation: ( -- of-sys ) Run-time: ( x1 x2 -- | x1 )
less-of
is an immediate
and compile-only
word.
Usage example:
: test ( x -- ) case 10 of ." ten!" endof 15 less-of ." less than 15" endof ." greater than 14" endcase ;
See also: greater-of
, (less-of)
.
Source file: <src/lib/flow.case.fs>.
lex!
lex! ( b nt -- )
Set the bits of the mask b in the length byte of nt.
See also: lex?
, immediate
, compile-only
.
Source file: <src/kernel.z80s>.
lex?
lex? ( nt b -- f )
Test the bits at nt specified by the bitmask b. Return true if the result is non-zero, else return false.
See also: lex!
, immediate?
, compile-only?
.
Source file: <src/kernel.z80s>.
limit
limit ( -- a )
A variable. a is the address of a cell containing the
address above the highest address usable by the data space
(the data space is the region addressed by dp
). Its default
value is zero, which is right above the highest memory address
($FFFF).
limit
can be modified by a program in order to reserve a
memory zone for special purposes.
Origin: Fig-Forth’s limit
constant.
Source file: <src/kernel.z80s>.
limit-heap
limit-heap ( n -- a )
Create a heap
of n address units right above limit
and return its address a. limit
is moved down n
address units.
See also: allot-heap
, bank-heap
, farlimit-heap
,
empty-heap
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
line
line ( n -- a )
Leave address a of the beginning of line n in the
current block buffer. The block number is in scr
.
Read the disk block from disk if it is not already in the
disk buffer.
Source file: <src/lib/editor.specforth.fs>.
line>string
line>string ( n1 n2 -- ca len )
Convert the line number n1 and the screen number n2 to a string ca len in the disk buffer containing the data.
Definition:
: line>string ( n1 n2 -- ca len ) >r c/l b/buf */mod r> + block + c/l ;
Origin: fig-Forth’s (line)
.
Source file: <src/kernel.z80s>.
lineblock>source
lineblock>source ( n u -- )
Set block u as the current source, starting from its line n.
See also: block>source
.
Source file: <src/lib/blocks.fs>.
lineload
lineload ( n u -- )
Begin interpretation at line n of block u.
Origin: Forth-83 (Uncontrolled Reference Words).
See also: load
.
Source file: <src/lib/blocks.fs>.
link,
link, ( head -- )
Create a new node in data space for the linked list head:
Before:
-
head -→ old_node
After:
-
head -→ new_node
-
new_node -→ old_node
See also: link@
.
Source file: <src/lib/data.MISC.fs>.
link>name
link>name ( lfa -- nt )
Get nt from its lfa.
See also: name>link
.
Source file: <src/lib/compilation.fs>.
link@
link@ ( node1 -- node2 )
Fetch the node node2 from the linked list node node1.
link@
is an alias of @
.
See also: link,
.
Source file: <src/lib/data.MISC.fs>.
list
list ( u -- )
Display block u and store u in scr
.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Controlled Reference Words), Forth-94 (BLOCK EXT), Forth-2012 (BLOCK EXT).
See also: scr
, list-lines
, lt
, lm
, lb
.
Source file: <src/lib/tool.list.blocks.fs>.
list-line
list-line ( n u -- )
List line n from block u, without trailing spaces.
See also: list-lines
, .line#
, list
.
Source file: <src/lib/tool.list.blocks.fs>.
list-lines
list-lines ( u n1 n2 -- )
List lines n2..n3 of block u and store u in scr
.
Source file: <src/lib/tool.list.blocks.fs>.
literal
literal ( x -- )
Compile x in the current definition.
literal
is an immediate
and compile-only
word.
Definition:
: literal ( x -- ) postpone lit , ; immediate compile-only
Source file: <src/kernel.z80s>.
lm
lm ( -- )
List middle part of screen hold in scr
.
See also: lt
, lb
, list
, list-lines
.
Source file: <src/lib/tool.list.blocks.fs>.
load
load ( u -- )
Save the current input-source specification. Store u in blk
(thus making block u the input source and setting the input buffer
to encompass its contents) and lastblk
, set >in
to zero, and
interpret. When the parse area is exhausted, restore the prior input
source specification.
An error is issued if u is zero.
Definition:
: load ( u -- ) dup 0= #-259 ?throw dup lastblk ! nest-source (load) unnest-source ;
See also: (load)
, nest-source
, unnest-source
,
lineload
, +load
, thru
.
Source file: <src/kernel.z80s>.
load-app
load-app ( "name" -- )
Load an application. An application is a set of blocks
that are loaded as a whole. They don’t have block headers
except the first one, which contains name, and therefore
they don’t have internal requisites. Applications don’t
need -->
or any other word to change the loading: The
loading starts from the first block of the disk that has
name in its header (surrounded by spaces), and continues
until the last block of the disk or until end-app
is
executed.
See also: loading-app
.
Source file: <src/lib/blocks.fs>.
loader
loader ( u "name" -- )
Define a word name which, when executed, will load block u.
Origin: Forth-79’s loads
(Reference Word Set),
Forth-83’s loads
(Appendix B. Uncontrolled Reference
Words).
Source file: <src/lib/blocks.fs>.
loading-app
loading-app ( -- a )
A variable that holds a flag: Is an application being
loaded? This flag is modified by load-app
and end-app
.
Source file: <src/lib/blocks.fs>.
loads
loads ( u n -- )
Load n blocks starting from block u.
Origin: MMSFORTH.
Source file: <src/lib/blocks.fs>.
local
local ( a -- )
Save the value of variable a, which will be restored at the end of the current definition.
Usage example:
variable v 1 v ! v ? \ default value : test ( -- ) v local v ? 1887 v ! v ? ; v ? \ default value
Source file: <src/lib/locals.local.fs>.
locate
locate ( "name" -- block | false )
Locate the first block whose header contains name (surrounded by spaces), and return its number block. If not found, return false. The search is case-sensitive.
Only the blocks delimited by first-locatable
and
last-locatable
are searched.
See also: located
.
Source file: <src/lib/002.need.fs>.
locate-need
locate-need ( "name" -- )
If name is not found in the current search order, locate the first block where name is included is the block header (surrounded by spaces), and load it. If not found, throw an exception #-268 ("needed, but not located").
This is the default action of the deferred word need
.
See also: make-thru-index
.
Source file: <src/lib/002.need.fs>.
locate-needed
locate-needed ( ca len -- )
If the string ca len is not the name of a word found in the current search order, locate the first block where ca len is included in the block header (surrounded by spaces), and load it. If not found, throw an exception #-268 ("needed, but not located").
This is the default action of the deferred word needed
.
See also: make-thru-index
.
Source file: <src/lib/002.need.fs>.
locate-reneed
locate-reneed ( "name" -- )
Locate the first block whose header contains name (surrounded by spaces), and load it. If not found, throw an exception #-268 ("needed, but not located").
This is the default action of the deferred word reneed
.
See also: make-thru-index
.
Source file: <src/lib/002.need.fs>.
locate-reneeded
locate-reneeded ( ca len -- )
Locate the first block whose header contains the string ca len (surrounded by spaces), and load it. If not found, throw an exception #-268 ("needed, but not located").
This is the default action of the deferred word
reneeded
.
See also: make-thru-index
.
Source file: <src/lib/002.need.fs>.
located
located ( ca len -- block | 0 )
Locate the first block whose header contains the string ca len (surrounded by spaces), and return its number. If not found, return zero. The search is case-sensitive.
Only the blocks delimited by first-locatable
and
last-locatable
are searched`.
This is a deferred word whose default action is
(located)
.
See also: need-from
.
Source file: <src/lib/002.need.fs>.
loop
loop Compilation: ( do-sys -- )
loop
is an immediate
and compile-only
word.
Origin: Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
lower_
lower_ ( -- a )
Return address a of a routine that converts to uppercase the ASCII character holad in the A register.
Source file: <src/kernel.z80s>.
lowers
lowers ( ca len -- )
Convert string ca len to lowercase.
Source file: <src/lib/strings.MISC.fs>.
lshift
lshift ( x1 u -- x2 )
Perform a logical left shift of u bit-places on x, giving x2. Put zeroes into the least significant bits vacated by the shift.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/lib/math.operators.1-cell.fs>.
lt
lt ( -- )
List top half of screen hold in scr
.
See also: lm
, lb
, list
, list-lines
.
Source file: <src/lib/tool.list.blocks.fs>.
m
m ( n -- )
Move the cursor by n characters. The position of the cursor on its line is shown by a "_" (underline).
Source file: <src/lib/editor.specforth.fs>.
m*
m* ( n1 n2 -- d )
Multiply n1 by n2 producing the result d.
Definition:
: m* ( n1 n2 -- d ) 2dup xor >r abs swap abs um* r> ?dnegate ;
Origin: fig-Forth, Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
m*/
m*/ ( d1 n1 +n2 -- d2 )
Multiply d1 by n1 producing the triple-cell intermediate result t. Divide t by +n2 giving the double-cell quotient d2.
Source file: <src/lib/math.operators.2-cell.fs>.
m+
m+ ( d1|ud1 n -- d2|ud2 )
Add n to d1|ud1, giving the sum d2|ud2.
Origin: Forth-94 (DOUBLE) Forth-2012 (DOUBLE).
Source file: <src/lib/math.operators.2-cell.fs>.
m/
m/ ( d n1 -- n2 n3 )
A mixed magnitude math operator which leaves the signed remainder n2 and signed quotient n3 from a double number dividend and divisor n1.
m/
is deferred and by default its action is sm/rem
, so
it does a symmetric division (the remainder takes its sign
from the dividend), as in fig-Forth. It can be set to execute
fm/mod
instead.
m/
is executed by all other division operators. Therefore
setting it to execute either sm/rem
or fm/mod
will change
the behaviour of all division operators.
Origin: fig-Forth.
Source file: <src/kernel.z80s>.
macro
macro ( name -- )
Start the definition of an assembler macro name.
Usage example:
macro dos-in, ( -- ) DB c, #231 c, endm \ Assemble the Z80 instruction `in a,(#231)`, to page in \ the Plus D memory.
Source file: <src/lib/assembler.macro.fs>.
magenta
magenta ( -- b )
A constant that returns 3, the value that represents the magenta color.
Source file: <src/lib/display.attributes.fs>.
make-block-chars
make-block-chars ( a -- )
Make the bit patterns of the 16 ZX Spectrum block characters, originally assigned to character codes 128..143, and store them (128 bytes in total) from address a.
make-block-chars
is provided for easier conversion of
BASIC programs that use the original block characters.
These characters are part of the ZX Spectrum character set,
but they are not included in the ROM font. Instead, their
bitmaps are built on the fly by the BASIC ROM printing
routine. In Solo Forth there’s no such restriction, and
characters 0..255 can be redefined by the user.
make-block-chars
is written in Z80 and uses 18 B of
code space, but the word block-chars
is provided as an
alternative.
Source file: <src/lib/graphics.udg.fs>.
make-thru-index
make-thru-index ( -- )
Create the blocks index and activate it. The current word list and the current search order are preserved.
make-thru-index
first creates a blocks index, i.e. a
word list from the names that are on the index (header)
line of every searchable block, ignoring duplicates;
second, it executes use-thru-index
to activate the blocks
index, changing the default behaivour of need
and related
words.
The words in the index have a fake execution token, which
is the block they belong to. This way, after indexing all
the disk blocks only once, need
will search the word list
and load the block of the word found. On the contrary, the
default action of need
is to search all the blocks every
time.
The default action of need
and related words can be
restored with use-no-index
.
Source file: <src/lib/blocks.indexer.thru.fs>.
marker
marker ( "name" -- )
Create a definition "name". When "name" is executed, it will restore the data-space pointer, the word lists pointer, the compilation word list, the search order and the configuration of word lists to the state they had just prior to the definition of "name".
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/tool.marker.fs>.
marker,
marker, ( -- a )
Store the names pointer, the latest definition pointers,
the word lists pointer, the current compilation word list,
the search order and the configuration of word lists at the
current data-space pointer, and return its address a, for
later restoration by unmarker
.
marker,
is a factor of marker
.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/tool.marker.fs>.
mask+attr!
mask+attr! ( b1 b2 -- )
Set b1 as the current attribute mask and b2 as the current attribute.
See also: mask+attr@
, attr!
, attr-mask!
Source file: <src/lib/display.attributes.fs>.
mask+attr-setter
mask+attr-setter ( b1 b2 "name" -- )
Create a definition name that, when executed, will set b1 as the current attribute mask and b2 as the current attribute.
See also: attr-setter
.
Source file: <src/lib/display.attributes.fs>.
mask+attr>perm
mask+attr>perm ( -- )
Make the current attribute and mask permanent.
Note: Words that use attributes don’t use the OS permanent attribute but the temporary one, which is called "current attribute" in Solo Forth.
Source file: <src/lib/display.attributes.fs>.
mask+attr@
mask+attr@ ( -- b1 b2 )
Set b as the current attribute mask.
See also: attr-mask!
, perm-attr-mask@
.
Source file: <src/lib/display.attributes.fs>.
match
match ( ca1 len1 ca2 len2 -- true n3 | false n4 )
Match the string ca2 len2 with all strings contained in the string ca1 len1. If found leave n3 bytes until the end of the matching string, else leave n4 bytes to end of line.
Source file: <src/lib/editor.specforth.fs>.
max-blocks
max-blocks ( -- u )
Return the number u of maximum blocks available in the
system. The number depends on #block-drives
and
blocks/disk
.
Source file: <src/kernel.z80s>.
max-char
max-char ( -- u )
u is the maximum value of any character in the character set.
See also: address-unit-bits
, /counted-string
,
environment?
.
Source file: <src/lib/environment-question.fs>.
max-d
max-d ( -- d )
d is the largest usable signed double.
See also: max-n
, max-ud
, environment?
.
Source file: <src/lib/environment-question.fs>.
max-drives
max-drives ( -- b )
A constant that returns the maximum number of drives available in the DOS.
See also: first-drive
, drive
.
Source file: <src/kernel.z80s>.
max-esc-order
max-esc-order ( -- n )
A constant that returns the maximum number of word lists in the escaped strings search order.
Its default value is 4, but the application can define this constant with any other value before loading the words that need it, and it will be kept.
See also: esc-context
, #esc-order
, set-esc-order
,
get-esc-order
, >order
.
Source file: <src/lib/strings.escaped.fs>.
max-l-refs
max-l-refs ( -- ca )
ca holds a byte, which is the maximum number (count) of
unresolved label referenced that can be created by rl#
or
al#
. Its default value is 16. The application can change
the value, but the default one should be restored after the
code word has been compiled.
max-l-refs
is used by init-labels
to allocate the
l-refs
table.
Usage example:
need assembler also assembler need l: max-l-refs c@ #16 max-l-refs c! previous code my-word ( -- ) \ Z80 code that needs #16 label references end-code max-l-refs c! \ restore the default value
See also: max-labels
.
Source file: <src/lib/assembler.labels.fs>.
max-labels
max-labels ( -- ca )
ca holds a byte, which is the maximum number (count) of
labels that can be defined by l:
. Its default value is
8. The application can change the value, but the default
one should be restored after the code word has been
compiled.
max-labels
is used by init-labels
to allocate the
labels
table.
Usage example:
need assembler also assembler need l: max-labels c@ #24 max-labels c! previous code my-word ( -- ) \ Z80 code that needs #24 labels end-code max-labels c! \ restore the default value
See also: max-l-refs
.
Source file: <src/lib/assembler.labels.fs>.
max-n
max-n ( -- n )
n is the largest usable signed integer.
See also: max-u
, max-d
, environment?
.
Source file: <src/lib/environment-question.fs>.
max-order
max-order ( -- n )
A constant that returns the maximum number n of word lists in the search order.
Source file: <src/kernel.z80s>.
max-u
max-u ( -- u )
u is the largest usable unsigned integer.
See also: max-n
, max-ud
, environment?
.
Source file: <src/lib/environment-question.fs>.
max-ud
max-ud ( -- ud )
ud is the largest usable unsigned double.
See also: max-u
, max-d
, environment?
.
Source file: <src/lib/environment-question.fs>.
middle-octave
middle-octave ( -- a )
Return the address of a 12-cell table that contains the
frequencies in dHz (tenths of Hz) of the middle octave.
They are used by beep>dhz
to calculate the frequency of
any note.
Here is a diagram to show the offsets of all the notes in the table, on the piano (extracted from the manual of the ZX Spectrum +3 transcripted by Russell et al.):
| | C#| D#| | | F#| G#| A#| | | | Db| Eb| | | Gb| Ab| Bb| | | | 1 | 3 | | | 6 | 8 |10 | | | |___|___| | |___|___|___| | | | | | | | | | | 0 | 2 | 4 | 5 | 7 | 9 |11 | |___|___|___|___|___|___|___| C D E F G A B
See also: beep
, /octave
, octave-changer
.
Source file: <src/lib/sound.48.fs>.
mod
mod ( n1 n2 -- n3 )
Divide n1 by n2, giving the single-cell remainder n3.
Definition:
: mod ( n1 n2 -- n3 ) /mod drop ;
Origin: fig-Forth, Forth-79, Forth-94, Forth-2012.
Source file: <src/kernel.z80s>.
mode-32
mode-32 ( -- )
Set the default 32 CPL display mode. Usually this is not
needed by the application, except when any other mode is
used, e.g. mode-32iso
, mode-42
or mode-64
.
When any other mode is loaded, mode-32
is automatically
loaded and made the default display mode (therefore
restored by restore-mode
, which is called by warm
and
cold
).
See also: current-mode
, set-font
, set-mode-output
,
columns
, rows
, mode32-emit
, mode-32-xy
,
mode-32-at-xy
.
Source file: <src/lib/display.mode.32.fs>.
mode-32-at-xy
mode-32-at-xy ( col row -- )
Warning
|
The system will crash if the coordinates are out of screen. For the sake of speed, no check is done. If needed, the application can use a wrapper word. |
Source file: <src/kernel.z80s>.
mode-32-emit
mode-32-emit ( c -- )
Send character c to the current channel, calling the ROM routine at $0010.
mode-32-emit
is the default action of emit
.
mode-32-emit
uses last-font-char
the following way:
characters up to and including last-font-char
(by default,
0..127) are displayed through the ROM routine, while higher
characters (by default, 128..255) are displayed by emit-udg
from the current UDG set. The following table shows the
effect of changing the value of last-font-char
:
Value | Effect |
---|---|
126 |
Characters 0..126 are printed by the ROM;
characters 127..255 are printed by |
127 |
Characters 0..127 are printed by the ROM;
characters 128..255 are printed by |
143 |
Characters 0..143 are printed by the ROM
(this range includes the block graphics);
characters 144..255 are printed by |
162 |
Characters 0..162 are printed by the ROM
(this range includes also the 128-BASIC UDG set 144..162,
corresponding to UDG characters 0..18 in Solo Forth);
characters 163..255 are printed by |
255 |
Characters 0..255 are printed by the ROM
(this range includes also the 128-BASIC tokens);
no character is printed by |
When a standard character set is required, without the ROM
interpreting characters 128..255 its own way, mode-32iso-emit
can be used instead.
Source file: <src/kernel.z80s>.
mode-32-xy
mode-32-xy ( -- col row )
Return the current column and row, in mode-32
.
mode-32-xy
is the default action of xy
.
Definition:
: (mode_32-xy) ( -- col row ) 24 23689 c@ - 33 23688 c@ - dup 32 = if drop 1+ 0 then swap ; \ 23688 = OS variable S_POSX \ 23689 = OS variable S_POSY
Source file: <src/kernel.z80s>.
mode-32iso
mode-32iso ( -- )
A 32 CPL display mode, an alternative to the default
mode-32
. The only difference with mode-32
is
mode-32iso
can use a ISO character set, i.e. it
displays characters 32..255 from the current font. See
mode-32iso-emit
for details.
See also: current-mode
, set-font
, set-mode-output
,
columns
, rows
, mode-32-xy
, mode-32-at-xy
.
Source file: <src/lib/display.mode.32iso.fs>.
mode-32iso-emit
mode-32iso-emit ( c -- )
Send character c to the current channel, calling the ROM routine at $0010, and assuming the current font contains printable characters 32..255.
In order to force the ROM routine interpret characters
128..255 as ordinary characters (not block graphics, user
defined graphics or BASIC tokens, as mode-32-emit
does),
mode-32iso-emit
modifies c if needed and moves the
current font address accordingly before calling the ROM.
As a result, the ROM routine treats character ranges
128..223 and 224..255 as 32..127 and 32..63 respectively.
mode-32iso-emit
is an alternative action of emit
,
useful when a ISO character set is required (or any
character set with more than 128 characters). A similar
result could be obtained with mode-32-emit
and
last-font-char
, by treating the characters greater than
128 as UDG and using set-udg
. The advantage of
mode-32iso-emit
is the ISO font can be managed (e.g.
built, loaded from disk, allocated, etc.) as a whole, using
only the font address, and reserving the full UDG set for
graphics.
mode-32iso-emit
is activated by mode-32iso
, i.e.
it’s set as the action of emit
, though it can be used
alone.
mode-32iso-emit
is not affected by last-font-char
.
See also: set-font
.
Source file: <src/lib/display.mode.32iso.fs>.
module
module ( "name" -- parent-wid )
Start the definition of a new module named name.
end-module
ends the module and export
exports a word.
Usage example:
module greet : hello ( -- ) ." Hello" ; : mods ( -- ) ." Modules" ; : hi ( -- ) hello ." , " mods ." !" cr ; export hi end-module
Now only the exported definitions of the module are available.
hi \ displays "Hello, Modules!" hello \ error, not found
The module name is defined as a constant that holds the
word list identifier the module words are defined into.
Therefore, to expose the internal words of a module, you
can use name >order
, where name is the name of the
module.
Source file: <src/lib/modules.module.fs>.
more-words?
more-words? ( nt|0 -- nt|0 f )
A common factor of words
and words-like
.
Source file: <src/lib/tool.list.words.fs>.
move<far
move<far ( a1 a2 len -- )
If len is greater than zero, copy len consecutive cells from far-memory address a1 to main-memory address a2.
Source file: <src/lib/memory.far.fs>.
move>far
move>far ( a1 a2 len -- )
If len is greater than zero, copy len consecutive cells from main-memory address a1 to far-memory address a2.
Source file: <src/lib/memory.far.fs>.
ms
ms ( u -- )
Wait at least u ms (miliseconds).
Origin: Forth-94 (FACILITY EXT), Forth-202 (FACILITY EXT).
Source file: <src/lib/time.fs>.
mt*
mt* ( d n -- t )
t is the signed product of d times n.
Source file: <src/lib/math.operators.3-cell.fs>.
n
n ( -- )
Find the next occurrence of the string found by an f
command.
Source file: <src/lib/editor.specforth.fs>.
n!
n! ( x[u]..x[1] u a -- )
If u is not zero, store u cells at address a, being x[1] the first cell stored there and x[u] the last one.
Source file: <src/lib/memory.MISC.fs>.
n,
n, ( x[u]..x[1] u -- )
If u is not zero, store u cells x[u]..x[1] into data space, being x[1] the first one stored and x[u] the last one.
Source file: <src/lib/memory.MISC.fs>.
n>r
n>r ( x#1..x#n n -- ) ( R: -- x#1..x#n n )
Remove n+1 items from the data stack and store them for
later retrieval by nr>
. The return stack may be used to
store the data. Until this data has been retrieved by
nr>
:
Origin: Forth-2012 (TOOLS EXT).
Source file: <src/lib/return_stack.fs>.
n@
n@ ( a u -- x[u]..x[1] )
If u is not zero, read u cells x[u]..x[1] from a, being x[1] the first one stored and x[u] the last one.
Source file: <src/lib/memory.MISC.fs>.
name-indexed?
name-indexed? ( ca len -- false | block true )
Search the index for word ca len. If found, return its block and true, else return false.
Source file: <src/lib/blocks.indexer.COMMON.fs>.
name<name
name<name ( nt1 -- nt2 )
Get the previous nt2 from nt1.
See also: name>name
.
Source file: <src/lib/compilation.fs>.
name>
name> ( nt -- xt )
Definition:
: name> ( nt -- xt ) [ 2 cells ] literal - far@ ;
Source file: <src/kernel.z80s>.
name>body
name>body ( nt -- pfa )
Get pfa from its nt.
See also: body>name
.
Source file: <src/lib/compilation.fs>.
name>compile
name>compile ( nt -- x xt )
Compilation token x xt represents the compilation semantics of the word nt. The returned xt has the stack effect ( i*x x — j*x ). Executing xt consumes x and performs the compilation semantics of the word represented by nt.
Origin: Forth-2012 (TOOLS EXT).
See also: (comp')
.
Source file: <src/lib/compilation.fs>.
name>immediate?
name>immediate? ( nt -- xt f )
Is the word nt immediate?
Definition:
: name>immediate? ( nt -- xt f ) dup name> swap immediate? ;
See also: immediate?
.
Source file: <src/kernel.z80s>.
name>interpret
name>interpret ( nt -- xt | 0 )
Return xt that represents the interpretation semantics of the word nt. If nt has no interpretation semantics, return zero.
Origin: Forth-2012 (TOOLS EXT).
Source file: <src/lib/compilation.fs>.
name>link
name>link ( nt -- lfa )
Get lfa from its nt.
See also: link>name
.
Source file: <src/lib/compilation.fs>.
name>name
name>name ( nt1 -- nt2 )
Get the next nt2 from nt1.
See also: name<name
.
Source file: <src/lib/compilation.fs>.
name>str
name>str ( nt -- ca len )
Convert the name token nt to its name string ca len in far memory.
Definition:
: name>str ( nt -- ca len ) farcount word-length-mask and ;
See also: name>string
.
Source file: <src/kernel.z80s>.
name>string
name>string ( nt -- ca len )
Convert the name token nt to its name string ca len
in the stringer
.
Definition:
: name>string ( nt -- ca len ) name>str allocate-stringer ( ca1 len ca ) 2dup swap 2>r ( R: ca len ) -rot ( ca ca1 len ) 0 ?do ( ca ca1 ) 2dup farc@ swap i + c! char+ loop 2drop default-bank 2r> ;
See also: name>str
.
Source file: <src/kernel.z80s>.
need
need ( "name" -- )
If name is not found in the current search order, locate the first block where name is included is the block header (surrounded by spaces), and load it. If not found, throw an exception #-268 ("needed, but not located").
This is a deferred word whose default action is
locate-need
.
See also: make-thru-index
.
Source file: <src/lib/002.need.fs>.
need-from
need-from ( "name" -- )
Locate the first block whose header contains name
(surrounded by spaces), and set it the first one located
will search from. If not found, throw an exception #-268
("needed, but not located").
need-from
is intended to prevent undesired name clashes
during the execution of need
and related words. name is
supposed to be a conventional marker.
Usage example:
( x ) : x ( -- ) ." Wrong x!" ; ( use-x ) need-from ==data-structures== need x x ( y ==data-structures== ) : y ." Y data structure; ; ( x ) : x ." X data structure; ;
Source file: <src/lib/002.need.fs>.
need-here
need-here ( "name" -- )
If name is not a word found in the current search order, load the current block.
This is a faster alternative to need
, when the needed
word is in the same block, and conditional compilation is
used with ?]>>`, `<<entry3F28, pass:c[?(
or [if]
.
Source file: <src/lib/002.need.fs>.
needed
needed ( ca len -- )
If the string ca len is not the name of a word found in the current search order, load the first block where ca len is included in the block header (surrounded by spaces). If not found, throw an exception #-268 ("needed, but not located").
This is a deferred word whose default action is
locate-needed
.
See also: make-thru-index
.
Source file: <src/lib/002.need.fs>.
negate
negate ( n1 -- n2 )
Negate n1, giving its arithmetic inverse n2.
Origin: Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
neither
neither ( x1 x2 x3 -- f )
Return true if x1 is not equal to either x2 or x3; else return false.
Origin: IsForth.
Source file: <src/lib/math.operators.1-cell.fs>.
nest-source
nest-source ( R: -- source-sys )
source-sys describe the current source specification for
later use by unnest-source
.
Definition:
: nest-source ( R: -- source-sys ) r> source 2>r source-id >r >in @ >r blk @ >r #tib @ >r >r ; compile-only
Source file: <src/kernel.z80s>.
new
new ( class -- o )
Create a new incarnation of the class class.
Source file: <src/lib/objects.mini-oof.fs>.
new-menu
new-menu ( a1 a2 ca len x y n1 n2 -- )
Set the current menu to cursor coordinates x y, n2 options, n1 characters width, title ca len, actions table a1 (a cell array of n2 execution tokens) and option texts table a2 (a cell array of n2 addresses of counted strings).
Source file: <src/lib/menu.sinclair.fs>.
new-menu
new-menu ( a1 a2 ca len x y n1 n2 -- )
Set, display at cursor coordinates x y and activate a new menu of n2 options, n1 characters width, title ca len, actions table a1 (a cell array of n2 execution tokens) and option texts table a2 (a cell array of n2 addresses of counted strings).
Source file: <src/lib/menu.sinclair.fs>.
new-needed-word
new-needed-word ( ca1 len -- ca2 len' )
Remove trailing and leading spaces from the word ca1 len,
which is the parameter of the latest need
needed
,
reneed
or reneeded
, store it in the stringer
and return it as ca2 len' for further processing.
Source file: <src/lib/002.need.fs>.
newton-sqrt
newton-sqrt ( n1 -- n2 )
Integer square root n2 of radicand n1 by Newton’s
method. newton-sqrt
is 7..8 times slower than
baden-sqrt
.
Loading newton-sqrt
makes it the action of sqrt
.
Source file: <src/lib/math.operators.1-cell.fs>.
next
next ( -- a )
Return the address a of the main entry point of the Forth inner interpreter. It is the address Forth words jump to at the end. The code at a executes the word whose execution token is in the address pointed by the Forth IP (the Z80 BC register).
In Solo Forth, the Z80 IX register holds a, which must be preserved across Forth words.
Source file: <src/kernel.z80s>.
nextname
nextname ( ca len -- )
The next defined word will have the name ca len; the
defining word will leave the input stream alone.
nextname
works with any defining word.
Origin: Gforth.
See also: nextname-header
, nextname-string
.
Source file: <src/lib/define.MISC.fs>.
nextname-header
nextname-header ( -- )
Create a dictionary header using the name string set by
nextname
. Then restore the default action of
header
.
Origin: Gforth.
See also: nextname-string
.
default-header
.
Source file: <src/lib/define.MISC.fs>.
nextname-string
nextname-string ( -- a )
A double variable that may hold the address and length of a
name to be used by the next defining word. This variable
is set by nextname
.
Origin: Gforth.
See also: nextname-header
.
Source file: <src/lib/define.MISC.fs>.
nip
nip ( x1 x2 -- x2 )
Drop the first item below the top of stack.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
nn!
nn! ( x[u]..x[1] u a -- )
Store the count u at a. If u is not zero, store also u cells x[u]..x[1] at the next cell address, being x[1] the first one stored and x[u] the last one.
Source file: <src/lib/memory.MISC.fs>.
nn,
nn, ( x[u]..x[1] u -- )
Store the count u into data space. If u is not zero, store also u cells x[u]..x[1] into data space, being x[1] the first one stored and x[u] the last one.
Source file: <src/lib/memory.MISC.fs>.
nn@
nn@ ( a -- x[1]..x[u] u | 0 )
Read the count u from a. If it’s zero, return it. If u is not zero, read u cells x[u]..x[1] from the next cell address, being x[1] the first cell stored there and x[u] the last one.
Source file: <src/lib/memory.MISC.fs>.
no-warnings?
no-warnings? ( -- f )
Are the warnings deactivated?
Source file: <src/lib/compilation.fs>.
noname?
noname? ( -- a )
A variable that holds a flag: Was the word being defined
created by :noname
? noname?
is set by :noname
and
reset by ;
.
Source file: <src/kernel.z80s>.
noop_
noop_ ( -- a )
Return address a of a routine that does nothing, except
executing a Z80 ret
to return.
See also: noop
.
Source file: <src/kernel.z80s>.
not-block-drive
not-block-drive ( -- c )
c is a constant identifier used by set-block-drives
,
-block-drives
and other related words to mark unused
elements of block-drives
.
Source file: <src/lib/dos.COMMON.fs>.
not-redefined?
not-redefined? ( ca len -- ca len xt false | ca len true )
Is the word name ca len not yet defined in the compilation word list?
See: ?warn
.
Source file: <src/lib/compilation.fs>.
np
np ( -- a )
Address that holds the name-space pointer, which points to the next free address where the next word header will be stored.
Source file: <src/kernel.z80s>.
nr>
nr> ( -- x#1..x#n n ) ( R: x#1..x#n n -- )
Retrieve the items previously stored by an invocation of
n>r
. n is the number of items placed on the data
stack.
Origin: Forth-2012 (TOOLS EXT).
Source file: <src/lib/return_stack.fs>.
nuf?
nuf? ( -- f )
If no key is pressed return false. If a key is pressed, discard it and wait for a second key. Then return true if it’s a carriage return, else return false.
Usage example:
: listing ( -- ) begin ." bla " nuf? until ." Aborted" ;
Source file: <src/lib/keyboard.MISC.fs>.
number
number ( ca len -- n | d )
Attempt to convert a string ca len into a number. If a valid point is found, return d; if there is no valid point, return n. If conversion fails due to an invalid character, an exception #-275 is thrown.
Source file: <src/lib/math.number.conversion.fs>.
number-base
number-base ( ca len -- ca' len' n )
If the first char of string ca len is a radix prefix,
return its value n and the updated string ca' len' (which
does not include the radix prefix). Otherwise return ca
len untouched and the current value of base
n.
Definition:
: number-base ( ca len -- ca' len' n ) dup if over c@ dup '$' = if drop 1 /string #16 exit then dup '%' = if drop 1 /string #2 exit then '#' = if 1 /string #10 exit then then base @ ;
Source file: <src/kernel.z80s>.
number-point?
number-point? ( c -- f )
Is character c a valid point in a number? number-point?
is a deferred word used in number?
. Its default action is
standard-number-point?
, which only allows the period.
See also: classic-number-point?
, extended-number-point?
.
Source file: <src/kernel.z80s>.
number?
number? ( ca len -- 0 | n 1 | d 2 )
Convert a string ca len to a number, using the current value
of base
.. Return 0 if the conversion is not possible. If the
result is a single number, return n and 1. If the result is
a double number, return d and 2.
number?
accepts valid point anywhere on the number and
updates dpl
with the position of the last one. If no point
is found, dpl
contains -1.
Characters between single quotes are recognized, after Forth-2012.
Definition:
: number? ( ca len -- 0 | n 1 | d 2 ) dup 0= if 2drop 0 exit then \ reject empty strings 2dup char? if nip nip 1 exit then \ char format over c@ number-point? \ first char is a point? if 2drop 0 exit then \ is so, reject the string base @ >r number-base base ! ( R: radix ) skip-sign? >r ( R: radix sign ) 0 0 2swap dpl on begin ( d ca len ) >number dup while over c@ number-point? 0= \ invalid point? if 2drop 2drop rdrop r> base ! 0 exit then dup dpl @ = \ previous char was a point? if 2drop 2drop rdrop r> base ! 0 exit then dup 1- dpl ! \ update the position of the last point 1 /string \ skip the point repeat 2drop \ discard the empty string dpl @ 0< \ single-cell number? if d>s r> ?negate 1 \ single-cell number else r> ?dnegate 2 \ double-cell number then r> base ! ; \ restore the radix
See also: >number
, number-point?
, skip-sign?
, dpl
,
number
.
Source file: <src/kernel.z80s>.
nup
nup ( x1 x2 -- x1 x1 x2 )
This word is defined in Z80. Its equivalent definition in Forth is the following:
: nup ( x1 x2 -- x1 x1 x2 ) over swap ;
Source file: <src/lib/data_stack.fs>.
nx
nx ( -- )
Give next quick index, calculated from scr
.
Source file: <src/lib/tool.list.blocks.fs>.
nz?
nz? ( -- op )
See also: z?
, c?
, nc?
, po?
, pe?
, p?
, m?
,
?ret,
, ?jp,
, ?jr
, ?call
, rif
, rwhile
, runtil
,
aif
, awhile
, auntil
.
Source file: <src/lib/assembler.fs>.
ocr
ocr ( col row -- c | 0 )
Try to recognize the character printed at the given cursor
coordinates, using the font whose first printable character
is pointed by the variable ocr-charset
. The variable
ocr-chars
holds the number of characters in the set, and
ocr-first
holds the code of its first character. If
succesful, return the character number c according to the
said variables. Otherwise return 0. Inverse characters are
not recognized.
Note: The name ocr
stands for "Optical Character
Recognition".
Source file: <src/lib/graphics.ocr.fs>.
ocr-chars
ocr-chars ( -- ca )
A character variable that holds the number of chars used by
ocr
, from the address pointed by ocr-charset
. By
default it contais 95, the number of printable ASCII chars
in the ROM charset.
See also: ocr-first
, ocr-charset
.
Source file: <src/lib/graphics.ocr.fs>.
ocr-charset
ocr-charset ( -- a )
Variable that holds the address of the first printable char
in the charset used by ocr
. By default it contains
0x3D00, the address of the space char in the ROM charset.
Source file: <src/lib/graphics.ocr.fs>.
ocr-first
ocr-first ( -- ca )
A character variable that holds the code of the first
printable char in the charset used by ocr
, pointed by
ocr-charset
. By default it contais bl
, the code of the
space character.
See also: ocr-chars
, ocr-charset
.
Source file: <src/lib/graphics.ocr.fs>.
octave-changer
octave-changer ( -- a )
Execution table that contains the three execution tokens used to calculate the frequency of notes from any octave. a is the address of the second execution token (cell offset 0).
See also: change-octave
, beep>dhz
, middle-octave
.
Source file: <src/lib/sound.48.fs>.
odd?
odd? ( n -- f )
Is n an odd number?
odd?
is written in Z80. Its equivalent definition in
Forth is the following:
: odd? ( n -- f ) 1 and 0<> ;
See also: odd?
.
Source file: <src/lib/math.operators.1-cell.fs>.
of
of Compilation: ( -- orig ) Run-time: ( x1 x2 -- )
of
is an immediate
and compile-only
word.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/flow.case.fs>.
only
only ( -- )
Set the search order to the minimum search order.
Definition:
: only ( -- ) -1 set-order ;
Origin: Forth-94 (SEARCH EXT), Forth-2012 (SEARCH EXT).
Source file: <src/kernel.z80s>.
only-one-pressed
only-one-pressed ( -- false | bitmask port true )
Return the key identifier of the key pressed, if there’s only one key pressed. bitmask is the key bitmask and port is the keyboard row port.
Source file: <src/lib/keyboard.MISC.fs>.
option
option ( x "name" -- )
Compile the action "name" of an option x in an options[
]options
control structure.
See options[
for a usage example.
Source file: <src/lib/flow.options-bracket.fs>.
options[
options[
Compilation: ( — a1 a2 a3 )
Start an options[ ]options
structure.
The addresses left on the stack will be resolved by
]options
:
-
a1 = address of exit point
-
a2 = address of the xt of the default option
-
a3 = address of number of options
Usage example:
: say10 ." dek" ; : say100 ." cent" ; : say1000 ." mil" ; : say-other ." alia" ; : say ( n ) options[ 10 option say10 100 option say100 1000 option say1000 default-option say-other ]options ; 10 say 100 say 1000 say 1001 say
options[
is an immediate
and compile-only
word.
Source file: <src/lib/flow.options-bracket.fs>.
or
or ( x1 x2 -- x3 )
x3 is the bit-by-bit inclusive-or of x1 with x2.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
order
order ( -- )
Display the word lists in the search order in their search order sequence, from first searched to last searched. Also display the word list into which new definitions will be placed.
Origin: Forth-2012 (SEARCH EXT).
Source file: <src/lib/tool.list.word_lists.fs>.
orthodraw
orthodraw ( gx gy gxinc gyinc len -- )
Draw a line formed by len pixels, starting from gx gy and using gxinc gyinc as increments to calculate the coordinates of every next pixel.
The status of inverse
and overprint
modes are obeyed;
the screen attributes and the system graphic coordinates
are updated. That’s what makes orthodraw
much slower
than ortholine
.
Source file: <src/lib/graphics.lines.fs>.
ortholine
ortholine ( gx gy gxinc gyinc len -- )
Draw a line formed by len pixels, starting from gx gy and using gxinc gyinc as increments to calculate the coordinates of every next pixel.
The status of inverse
and overprint
modes is ignored;
the attributes of the screen are not modified; and the
system graphic coordinates are not updated. That’s what
makes ortholine
almost twice faster than orthodraw
.
See also: rline176
.
Source file: <src/lib/graphics.lines.fs>.
os-attr-p
os-attr-p ( -- ca )
A constant that returns the address a of 1-byte system variable ATTR_P, which holds the current permanent color attribute, as set up by color statements.
Source file: <src/lib/system_variables.fs>.
os-attr-t
os-attr-t ( -- ca )
A constant that returns the address a of 1-byte system variable ATTR_T, which holds the current temporary color attribute, as set up by color statements.
Source file: <src/lib/system_variables.fs>.
os-chans
os-chans ( -- a )
A constant that returns the address a of system variable CHANS, which holds the address of channels data.
Source file: <src/lib/system_variables.fs>.
os-chars
os-chars ( -- a )
A constant that returns the address of system variable CHARS, which holds the bitmap address of character 0 of the current font (actual characters 32..127). By default this system variables holds ROM address 15360 ($3C00).
Source file: <src/lib/system_variables.fs>.
os-coords
os-coords ( -- a )
A constant that returns the address a of 2-byte system variable COORDS which holds the graphic coordinates of the last point plotted.
Source file: <src/lib/system_variables.fs>.
os-coordx
os-coordx ( -- ca )
A constant that returns the address a of 1-byte system variable COORDX which holds the graphic x coordinate of the last point plotted.
Source file: <src/lib/system_variables.fs>.
os-coordy
os-coordy ( -- ca )
A constant that returns the address a of 1-byte system variable COORDY which holds the graphic y coordinate of the last point plotted.
Source file: <src/lib/system_variables.fs>.
os-flags2
os-flags2 ( -- ca )
A constant that returns the address ca of 1-byte system variable FLAGS2, which holds several flags.
See also: capslock
.
Source file: <src/lib/system_variables.fs>.
os-frames
os-frames ( -- a )
A constant that returns the address a of 3-byte system variable FRAMES (least significant byte first), which holds a frame counter incremented every 20 ms.
See also: frames@
, frames!
, reset-frames
, frames
,
?frames
.
Source file: <src/lib/system_variables.fs>.
os-mask-p
os-mask-p ( -- ca )
A constant that returns the address a of 1-byte system
variable MASK_P, which holds the permanent color attribute
mask, used for transparent colors, etc. Any bit that is 1
shows that the corresponding attribute bit is taken not
from os-attr-p
but from what is already on the screen.
Source file: <src/lib/system_variables.fs>.
os-mask-t
os-mask-t ( -- ca )
A constant that returns the address a of 1-byte system
variable MASK_T, which holds the temporary color attribute
mask, used for transparent colors, etc. Any bit that is 1
shows that the corresponding attribute bit is taken not
from os-attr-t
but from what is already on the screen.
Source file: <src/lib/system_variables.fs>.
os-p-flag
os-p-flag ( -- ca )
A constant that returns the address a of 1-byte system variable P_FLAG, which holds some flags related to printing.
Source file: <src/lib/system_variables.fs>.
os-seed
os-seed ( -- a )
A constant that returns the address a of system variable SEED, which holds the seed of the BASIC random number generator.
Source file: <src/lib/system_variables.fs>.
os-udg
os-udg ( -- a )
A constant that returns the address a of system variable UDG, which holds the address of the first character bitmap of the current User Defined Graphics set (characters 128..255 or 0..255, depending on the words used to access them).
Source file: <src/lib/system_variables.fs>.
othercase
othercase ( x -- )
Mark the start of the default option of a thiscase
structure that checked x.
Source file: <src/lib/flow.thiscase.fs>.
othercase>
othercase> ( orig counter "name" -- )
Compile the default option of a cases:
to be the word
"name" . This must be the last option of the structure and
is mandatory. When no default action is required,
othercase> noop
can be used.
See cases:
for an usage example.
Source file: <src/lib/flow.cases-colon.fs>.
outlet-autochars
outlet-autochars ( a -- )
Create a modified, bolder copy of the ZX Spectrum ROM font
and store it at a. 768 bytes will be used from a. Then
activate the new font by modifing the contents of
os-chars
.
The code word of outlet-autochars`
has been adapted from
the Autochars routine used by the Outlet magazine,
published in its issue #1 (1987-09).
Usage example:
create outlet-font 768 allot need outlet-autochars outlet-font outlet-autochars
Source file: <src/lib/display.fonts.fs>.
overprint
overprint ( f -- )
If f is zero, turn the overprint mode off; else turn it on.
See also: overprint-on
, overprint-off
, inverse
.
Source file: <src/lib/display.attributes.fs>.
overprint-off
overprint-off ( -- )
Turn the overprint mode off.
See also: overprint-on
, overprint
, inverse-off
.
Source file: <src/lib/display.attributes.fs>.
overprint-on
overprint-on ( -- )
Turn the overprint mode on.
See also: overprint-off
, overprint
, inverse-on
.
Source file: <src/lib/display.attributes.fs>.
package
package ( "name" -- wid0 wid1 )
If the package name has been previously defined, open it. Otherwise create it.
wid1 is the word list of the package name; wid0 is the word list in which the package name was created.
end-package
ends the package; public
start public
definitions and private
starts private definitions.
Syntax:
package package-name ... private definitions here ... public ... public definitions here ... private ... more private definitions maybe ... end-package
In the above, private definitions are placed in the
package-name
word list. Public definitions are placed
in whatever word list was current before package
package-name
. If a package called package-name
already exists prior to the above, then it is reused,
rather than redefined.
Usage example:
package example defer text : ex1 ( -- ca len ) s" This is an example" ; ' ex1 ' text defer! public : .example ( -- ) text cr type ; private : ex2 ( -- ca len ) s" This is an example (cont.)" ; end-package
At this point, .example
is a new word in whatever the
current wordlist was, and text
, ex1
and ex2
are
all words in the example
word list. example
itself
is created in the current wordlist if it didn’t already
exist. (if example
exists and isn’t a package, this
is an unchecked error which will probably be revealed when
public
runs.)
If this code is in a library, code including the library
can then run .example
freely.
If there’s some need to reopen the package, this is easily done:
package example :noname ( -- ca len ) s" This is yet another example" ; ' text defer! end-package .example
Use case: loading a package using library with a prelude:
Suppose that you need to load a package with some alien definitions, you can put them in a package with the same name before loading the code, and this will only affect that package:
package some-package \ This package's code relies on `<<entry706C616365, pass:c[place]>>` appending a nul byte. : place ( ca1 len1 ca2 -- ) 2dup + 0 swap c! place ; end-package include some-lib.fs
Origin: SwiftForth.
Source file: <src/lib/modules.package.fs>.
pad
pad ( -- ca )
Return the address of a transient region that can be used to hold
data for intermediate processing. It’s a fixed offset above here
.
Definition:
: pad ( -- ca ) here /hold + ;
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
padding-spaces
padding-spaces ( len1 len2 -- )
If len2 minus len1 is a positive number, print that number of spaces; else do nothing.
See also: type-left-field
.
Source file: <src/lib/display.type.fs>.
page
page ( -- )
Move to another page for output. On a terminal, page
clears
the screen and resets the cursor position to the upper left
corner. On a printer, page
performs a form feed.
Origin: Forth-79 (Reference Word Set), Forth-83 (Uncontrolled Reference Words), Forth-94 (FACILITY), Forth-2012 (FACILITY).
See also: cls
.
Source file: <src/kernel.z80s>.
paper.
paper. ( b -- )
Set paper color to b (0..9), by printing the corresponding control characters. If b is greater than 9, 9 is used instead.
paper.
is much slower than set-paper
or attr!
, but
it can handle pseudo-colors 8 (transparent) and 9
(contrast), setting the corresponding system variables
accordingly.
See also: ink.
, (0-9-color.
.
Source file: <src/lib/display.attributes.fs>.
papery
papery ( b1 -- b2 )
Convert paper color b1 to its equivalent attribute b2.
papery
is an alias of 8*
, which is written in Z80.
Its equivalent definition in Forth is the following:
: papery ( b1 -- b2 ) 8 * ;
See also: brighty
, flashy
, attr>paper
, contrast
Source file: <src/lib/display.attributes.fs>.
parse
parse ( char "ccc<char>" -- ca len )
Parse ccc delimited by the delimiter char. ca is the address (within the input buffer) and len is the length of the parsed string If the parse area was empty, the resulting string has a zero length.
Definition:
: parse ( char "ccc<char>" -- ca len ) stream 2dup 2>r rot scan dup if char- then 2r> rot - parsed tuck - ;
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
See also: stream
, scan
, parsed
, parse-name
.
Source file: <src/kernel.z80s>.
parse-all
parse-all ( "ccc" -- ca len )
Parse the rest of the source.
parse-all
is a useful factor of Specforth editor’s
text
.
Source file: <src/lib/parsing.fs>.
parse-esc-char>chars
parse-esc-char>chars ( "c" -- c[n-1]..c[0] n )
Parse and translate a escaped char 'c' to a number of chars c[n-1]..c[0] and their count _n.
The translation is done by searching the name of the
escaped char in the current search order, which has been
set by calling set-esc-string-order
in
parse-esc-string
.
Source file: <src/lib/strings.escaped.fs>.
parse-esc-string
parse-esc-string ( "ccc<quote>" -- ca len )
Parse a text string delimited by a double quote,
translating some configurable characters that are escaped
with a backslash. Return the translated string ca len in
the stringer
.
The characters that must be escaped depend on the search
order set by the deferred word set-esc-string-order
,
whose default action is set-standard-esc-string-order
.
Therefore, by default, the escaped characters are those
described in Forth-2012’s s\"
.
See also: (parse-esc-string)
.
Source file: <src/lib/strings.escaped.fs>.
parse-name
parse-name ( "name" -- ca len )
Parse name and return it as string ca len within the input buffer. If the parse area is empty or contains only white space, the len is zero.
Definition:
: parse-name ( "name" -- ca len ) stream ( ca0 len0 ) dup >r -leading ( ca1 len1 ) ( R: len0 ) over >r bl scan ( ca2 len2 ) ( R: len0 ca1 ) dup if char- then \ skip trailing delimiter r> r> rot - parsed \ update `<<entry3E696E, pass:c[>in]>>` tuck - ( ca len ) 2dup parsed-name 2! ;
Origin: Forth-2012 (CORE EXT).
See also: parse
, parse-name-thru
, word
, stream
,
scan
, parsed
, parsed-name
.
Source file: <src/kernel.z80s>.
parse-name-thru
parse-name-thru ( "name" -- ca len )
Parse name and return it as string ca len within the
input buffer. If the parse area is empty, use refill
to
fill it from the input source. If the input source is
exhausted, throw exception #-289 (input source exhausted).
See also: parse-name
, parse
.
Source file: <src/lib/parsing.fs>.
parse-string
parse-string ( Compilation: c "ccc<char>" -- ) ( Interpretation: c "ccc<char>" -- ca len ) ( Run-time: -- ca len )
Source file: <src/kernel.z80s>.
parsed
parsed ( len -- )
Add the given len to >in
.
Definition:
: parsed ( len -- ) >in +! ;
See also: parse
.
Source file: <src/kernel.z80s>.
parsed-name
parsed-name ( -- a )
A double variable that holds the address and length of the
most recently name parsed by parse-name
.
Source file: <src/kernel.z80s>.
pause
pause ( -- )
Allow another task to execute:
Stop current task and transfer control to the task of which
status
user variable is stored in follower
user variable
of current task.
Source file: <src/lib/multitask.muench-koh.fs>.
pause
pause ( u -- )
If u 0 zero, stop execution until a key is pressed. Otherwise stop execution during at least u frames of the TV (there are 50 frames per second in in Europe and 60 frames per second in USA), or until a key is pressed.
pause
is a convenience that works like the homonymous
keyword of Sinclair BASIC.
Source file: <src/lib/time.fs>.
perform
perform ( a -- )
If the cell stored at a is zero, do nothing. Otherwise execute it as an execution token.
Note
|
perform is called @execute in other Forth systems.
|
See also: execute
.
Source file: <src/kernel.z80s>.
perm-attr!
perm-attr! ( b -- )
Set b as the permanent attribute.
Note: Words that use attributes don’t use the OS permanent attribute but the temporary one, which is called "current attribute" in Solo Forth.
See also: perm-attr@
, attr!
.
Source file: <src/lib/display.attributes.fs>.
perm-attr-mask!
perm-attr-mask! ( b -- )
Set b as the permanent attribute mask.
Note: Words that use attributes don’t use the OS permanent attribute but the temporary one, which is called "current attribute" in Solo Forth.
See also: perm-attr-mask@
, attr-mask!
.
Source file: <src/lib/display.attributes.fs>.
perm-attr-mask@
perm-attr-mask@ ( -- b )
Get the permanent attribute mask b.
Note: Words that use attributes don’t use the OS permanent attribute but the temporary one, which is called "current attribute" in Solo Forth.
See also: perm-attr-mask!
, attr-mask@
.
Source file: <src/lib/display.attributes.fs>.
perm-attr@
perm-attr@ ( -- b )
Get the permanent attribute b.
Note: Words that use attributes don’t use the OS permanent attribute but the temporary one, which is called "current attribute" in Solo Forth.
See also: perm-attr!
, attr@
.
Source file: <src/lib/display.attributes.fs>.
pixel-pan-right
pixel-pan-right ( -- )
Pan the whole screen one pixel to the right.
pixel-pan-right
is a wrapper that calls
(pixel-pan-right
saving the BC register.
Source file: <src/lib/graphics.scroll.fs>.
pixel-scroll-up
pixel-scroll-up ( -- )
Scroll the whole screen one pixel up. pixel-scroll-up
is a wrapper that calls (pixel-scroll-up
saving the BC
register.
See also: pixel-pan-right
, pixels-scroll-up
.
Source file: <src/lib/graphics.scroll.fs>.
pixels
pixels ( -- u )
Return the number u of pixels that are set on the screen.
This is a deferred word set by fast-pixels
or
slow-pixels
.
See also: bits
.
Source file: <src/lib/graphics.pixels.fs>.
pixels-pan-right
pixels-pan-right ( u -- )
Pan the whole screen u pixels to the right.
Source file: <src/lib/graphics.scroll.fs>.
pixels-scroll-up
pixels-scroll-up ( u -- )
Scroll the whole screen u pixels up.
See also: pixel-scroll-up
, pixels-pan-right
.
Source file: <src/lib/graphics.scroll.fs>.
place
place ( ca1 len1 ca2 -- )
Store the string ca1 len1 as a counted string at ca2. The source and destination strings are permitted to overlap.
An ambiguous condition exists if len1 is greater than 255 or the buffer at ca2 is less than len1+1 characters.
place
is written in Z80. Its equivalent definition in
Forth is the following:
: place ( ca1 len1 ca2 -- ) 2dup c! char+ smove ;
Source file: <src/kernel.z80s>.
play
play ( ca -- )
Play a 14-byte sound definition stored at ca.
Source file: <src/lib/sound.128.fs>.
plot
plot ( gx gy -- )
Set a pixel, changing its attribute on the screen and the current graphic coordinates. gx is 0..255; gy is 0..191.
Source file: <src/lib/graphics.pixels.fs>.
plot176
plot176 ( gx gy -- )
Set a pixel, changing its attribute on the screen and the current graphic coordinates, using only the top 176 pixel rows of the screen (the lower 16 pixel rows are not used). gx is 0..255; gy is 0..175.
plot176
is equivalent to Sinclair BASIC’s PLOT
command.
Warning
|
If parameters are out of range, the ROM will throw a BASIC error, and the system will crash. |
See also: set-pixel176
, plot
, xy>gxy176
.
Source file: <src/lib/graphics.pixels.fs>.
polarity
polarity ( n -- -1|0|1 )
If n is zero, return zero. If n is negative, return negative one. If n is positive, return positive one.
polarity
is written in Z80. This is an example
implementation in Forth:
: polarity ( n -- -1|0|1 ) dup 0= ?exit 0< ?dup ?exit 1 ;
Source file: <src/lib/math.operators.1-cell.fs>.
positional-case:
positional-case: ( "name" -- )
Create a positional case word name. At runtime, name will execute the n-th word compiled in its definition, depending upon the value on the stack. No range checking.
Usage example:
: say0 ( -- ) ." nul" ; : say1 ( -- ) ." unu" ; : say2 ( -- ) ." du" ; positional-case: say ( n -- ) say0 say1 say2 ; 0 say cr 1 say cr 2 say cr
Source file: <src/lib/flow.positional-case-colon.fs>.
possibly
possibly ( "name" -- )
Parse name. If name is the name of a word in the current search order, execute it; else do nothing.
Source file: <src/lib/compilation.fs>.
postpone
postpone ( "name" -- )
Skip leading space delimiters. Parse name delimited by a space. Find name. Append the compilation semantics of name to the current definition.
postpone
is an immediate
word.
Definition:
: postpone ( "name" -- ) defined dup ?defined name>immediate? 0= if compile compile then compile, ; immediate
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
prefix?
prefix? ( ca1 len1 ca2 len2 -- f )
Is string ca2 len2 the prefix of string ca1 len1?
Source file: <src/lib/strings.MISC.fs>.
pressed
pressed ( -- false | bitmask port true )
Return the key identifier of the first key from the keys table that happens to be pressed. bitmask is the key bitmask and port is the keyboard row port.
See also: kk-ports
, only-one-pressed
, pressed?
.
Source file: <src/lib/keyboard.MISC.fs>.
pressed?
pressed? ( bitmask port -- f )
Is a key pressed? bitmask is the key bitmask and port is the keyboard row port.
See also: pressed
, only-one-pressed
.
Source file: <src/lib/keyboard.MISC.fs>.
previous
previous ( -- )
Remove the top word list (the word list that is searched first) from the search order.
Definition:
: previous ( -- ) get-order nip 1- set-order ;
Origin: Forth-94 (SEARCH EXT), Forth-2012 (SEARCH EXT).
Source file: <src/kernel.z80s>.
previous-mode
previous-mode ( -- a )
Variable that holds the xt of the word that activates the
screen mode that was active before executing bye
. It’s
updated by bye
, and used by warm
to restore the current
mode.
Source file: <src/kernel.z80s>.
printable-ascii-char?
printable-ascii-char? ( c -- f )
Is c a printable ASCII character, i.e. in the range 32..126?
See also: >printable-ascii-char
.
Source file: <src/lib/chars.fs>.
printing
printing ( -- a )
a is the address of a cell containing the printer flag.
printing
is set by printer
, reset by display
and
checked by page
. printing
should not be changed directly
by the application.
Source file: <src/kernel.z80s>.
private
private ( wid0 wid1 -- wid0 wid1 )
Mark subsequent definitions invisible outside the current
package. This is the default condition following the usage
of package
.
wid1 is the word list of the current package; wid0 is the word list in which the current package was created.
Origin: SwiftForth.
See also: end-package
, public
.
Source file: <src/lib/modules.package.fs>.
private{
private{ ( -- )
Start private definitions. See privatize
for a usage
example.
Source file: <src/lib/modules.privatize.fs>.
privatize
privatize ( -- )
Usage example:
private{ \ Everything between `<<entry707269766174657B, pass:c[private{]>>` and `<<entry7D70726976617465, pass:c[}private]>>` \ will become private. : foo ; : moo ; }private : goo foo moo ; \ can use `<<entry666F6F, pass:c[foo]>>` and `<<entry6D6F6F, pass:c[moo]>>` privatize \ hide `<<entry666F6F, pass:c[foo]>>` and `<<entry6D6F6F, pass:c[moo]>>` ' foo \ will fail
Source file: <src/lib/modules.privatize.fs>.
public
public ( wid0 wid1 -- wid0 wid1 )
Mark subsequent definitions available outside the current
package defined with package
.
wid1 is the word list of the current package; wid0 is the word list in which the current package was created.
Origin: SwiftForth.
See also: end-package
, private
.
Source file: <src/lib/modules.package.fs>.
pusha
pusha ( -- a )
Return address a of a secondary entry point of the Forth
inner interpreter. The code at a pushes the A register onto
the stack and then continues at the address returned by
next
.
Source file: <src/kernel.z80s>.
pushhl
pushhl ( -- a )
Return address a of a secondary entry point of the Forth
inner interpreter. The code at a pushes the HL register
onto the stack and then continues at the address returned by
next
.
Source file: <src/kernel.z80s>.
pushhlde
pushhlde ( -- a )
Return address a of a secondary entry point of the Forth
inner interpreter. The code at a pushes the DE and HL
registers onto the stack and then continues at the address
returned by next
.
Note
|
DE is pushed first, so HL is left on top of the stack. This is equivalent to pushing the double number formed by both registers, being HL the high part and DE the lower part. |
Source file: <src/kernel.z80s>.
px
px ( -- )
Give previous quick index, calculated from scr
.
Source file: <src/lib/tool.list.blocks.fs>.
query
query ( -- )
Make the user input device the input source. Receive input
into the terminal input buffer, replacing any previous
contents. Make the result, whose address is returned by tib
,
the input buffer. Set >in
to zero.
Origin: Forth-94 (CORE EXT, obsolescent).
Source file: <src/kernel.z80s>.
qx
qx ( -- )
Give a quick index. The number and width of the columns
depend on the current screen mode. The current block,
stored in scr
, is highlighted.
Origin: Gforth’s blocked
editor.
Source file: <src/lib/tool.list.blocks.fs>.
qx-bounds
qx-bounds ( -- u1 u2 )
Blocks to be included in the quick index, from block u2
to block u1-1. They depend on scr
.
See also: qx
.
Source file: <src/lib/tool.list.blocks.fs>.
qx-columns
qx-columns ( -- n )
n is the number of columns (2..4) of the quick index. It depends on the columns (32, 42, 64…) of the current screen mode.
See also: qx
, /qx-column
.
Source file: <src/lib/tool.list.blocks.fs>.
r#
r# ( -- a )
A variable that holds the location of the editing cursor, an offset from the top of the current block. Its default value is zero.
Origin: fig’Forth’s user variable r#
.
Source file: <src/lib/editor.COMMON.fs>.
r>xy
r>xy ( -- ) ( R: col row -- )
Restore the current cursor coordinates from the return stack.
See also: xy>r
, restore-mode
.
Source file: <src/lib/display.cursor.fs>.
ram
ram ( -- n )
Return the total RAM size n in kibibytes.
Note
|
The RAM size includes the 8 KiB of the Plus D interface, if present. |
See also: banks
.
Source file: <src/kernel.z80s>.
random
random ( n1 -- n2 )
Return a random number n2 from 0 to n1 minus 1.
See also: rnd
, random-range
, fast-random
.
Source file: <src/lib/random.fs>.
random-range
random-range ( n1 n2 -- n3 )
Return a random number from n1 (min) to n2 (max).
See also: random
.
Source file: <src/lib/random.fs>.
randomize
randomize ( n -- )
Set the seed used by fast-rnd
and fast-random
to n.
See also: randomize0
.
Source file: <src/lib/random.fs>.
randomize0
randomize0 ( -- )
Set the seed used by fast-rnd
and fast-random
to n;
if n is zero use the system frames counter instead.
See also: randomize
.
Source file: <src/lib/random.fs>.
rdraw176
rdraw176 ( gx gy -- )
Draw a line relative gx gy to the current coordinates, using only the top 176 pixel rows of the screen (the lower 16 pixel rows are not used). gx is 0..255; gy is 0..175.
rdraw176
is equivalent to Sinclair BASIC’s DRAW
command.
Source file: <src/lib/graphics.lines.fs>.
read-block
read-block ( u -- )
Read disk block u to the buffer.
Definition:
: read-block ( u -- ) read-mode transfer-block ;
See also: read-mode
, transfer-block
, write-block
,
block
.
Source file: <src/kernel.z80s>.
read-mode
read-mode ( -- )
Set the read mode for transfer-sector
and transfer-block
.
See also: write-mode
.
Source file: <src/kernel.gplusdos.z80s>.
realias
realias ( xt "name" -- )
Set the alias name to execute xt.
Source file: <src/lib/define.alias.fs>.
recurse
recurse ( -- )
Append the execution semantics of the current definition to the current definition.
recurse
is an immediate
and compile-only
word.
Origin: Forth-83 (Controlled Reference Words), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/lib/flow.MISC.fs>.
red
red ( -- b )
A constant that returns 2, the value that represents the red color.
Source file: <src/lib/display.attributes.fs>.
refill
refill ( -- f )
Definition:
: refill ( -- f ) loading? if blk @ 1+ dup block>source block? exit then false source-id ?exit 0= query ;
Origin: Forth-94 (CORE EXT, BLOCK EXT); Forth-2012 (CORE EXT, BLOCK EXT).
Source file: <src/kernel.z80s>.
rename-file
rename-file ( ca1 len1 ca2 len2 -- ior )
Rename the file named by the character string ca1 len1 to the name in the character string ca2 len2 and return error result ior.
Origin: Forth-94 (FILE EXT), Forth-2012 (FILE EXT).
Source file: <src/lib/dos.gplusdos.fs>.
reneed
reneed ( "name" -- )
Load the first block whose header contains name (surrounded by spaces).
This is a deferred word whose default action is
locate-reneed
.
See also: make-thru-index
.
Source file: <src/lib/002.need.fs>.
reneeded
reneeded ( ca len -- )
Load the first block whose header contains the string ca len (surrounded by spaces). If not found, throw an exception #-268 ("needed, but not located").
This is a deferred word whose default action is
locate-reneeded
.
See also: make-thru-index
.
Source file: <src/lib/002.need.fs>.
repeat
repeat
Compilation: ( orig dest -- )
repeat
is an immediate
and compile-only
word.
Source file: <src/kernel.z80s>.
replaces
replaces ( ca1 len1 ca2 len2 -- )
Set the string ca1 len1 as the text to substitute for the substitution named by ca2 len2. If the substitution does not exist it is created. The program may then reuse the buffer ca1 len1 without affecting the definition of the substitution.
The name of a substitution should not contain the "%" delimiter character.
replaces
allots data space and creates a definition.
Origin: Forth-2012 (STRING EXT).
See also: substitute
, unescape
, substitution
,
find-substitution
, substitute-wordlist
.
Source file: <src/lib/strings.replaces.fs>.
reserve
reserve ( n -- a )
Reserve n address units of data space, erase the zone and return its address a.
Source file: <src/lib/memory.MISC.fs>.
reset-bit
reset-bit ( b1 n -- b2 )
Reset bit n of b1, returning the result b2.
Source file: <src/lib/memory.MISC.fs>.
reset-frames
reset-frames ( -- )
Reset the system frames counter, which is incremented every 20 ms by the OS, setting it to zero.
Source file: <src/lib/time.fs>.
reset-pixel
reset-pixel ( gx gy -- )
Reset a pixel without changing its attribute on the screen or the current graphic coordinates. gx is 0..255; gy is 0..191.
See also: set-pixel
, toggle-pixel
, reset-pixel176
.
Source file: <src/lib/graphics.pixels.fs>.
reset-pixel176
reset-pixel176 ( gx gy -- )
Reset a pixel without its attribute on the screen or the current graphic coordinates, and using only the top 176 pixel rows of the screen (the lower 16 pixel rows are not used). gx is 0..255; gy is 0..175.
See also: set-pixel176
, toggle-pixel176
, reset-pixel
,
set-pixel
, toggle-pixel
, plot
, plot176
.
Source file: <src/lib/graphics.pixels.fs>.
reset-time
reset-time ( -- )
Reset the current time to 00:00:00.
See also: get-time
.
Source file: <src/lib/time.fs>.
resize
resize ( a1 -- a2 ior )
Change the allocation of the contiguous data space starting
at the address a1, previously allocated by allocate
or
resize
, to u address units. u may be either larger
or smaller than the current size of the region. The
data-space pointer is unaffected by this operation.
If the operation succeeds, a2 is the aligned starting
address of u address units of allocated memory and ior
is zero. a2 may be, but need not be, the same as a1.
If they are not the same, the values contained in the
region at a1 are copied to a2, up to the minimum size
of either of the two regions. If they are the same, the
values contained in the region are preserved to the minimum
of u or the original size. If a2 is not the same as
a1, the region of memory at a1 is returned to the
system according to the operation of free
.
If the operation fails, a2 equals a1, the region of memory at a1 is unaffected, and ior is the implementation-defined I/O result code.
resize
is a deferred word whose action can be
charlton-resize
, depending on the heap
implementation
used by the application.
Origin: Forth-94 (MEMORY), Forth-2012 (MEMORY).
See also: allocate
, free
, empty-heap
.
Source file: <src/lib/memory.allocate.COMMON.fs>.
restore-mode
restore-mode ( -- )
Restore the screen mode that was saved in previous-mode
by
save-mode
.
restore-mode
is executed by warm
.
Definition:
: restore-mode ( -- ) previous-mode perform ;
See also: current-mode
, perform
.
Source file: <src/kernel.z80s>.
results
results ( +n -- )
Define the number +n of local variables to leave on the
stack as results. Used with locals created by arguments
.
results
is a compile-only
word.
Source file: <src/lib/locals.arguments.fs>.
retry
retry ( -- )
Do an unconditional branch to the start of the word.
retry
is an immediate
and compile-only
word.
See also: ?retry
.
Source file: <src/lib/flow.MISC.fs>.
return-stack-cells
return-stack-cells ( -- n )
n is the maximum size of the return stack, in cells.
See also: return-stack-cells
, environment?
.
Source file: <src/lib/environment-question.fs>.
return-stack-cells
return-stack-cells ( -- n )
n is the maximum size of the data stack, in cells.
See also: stack-cells
, environment?
.
Source file: <src/lib/environment-question.fs>.
revealed
revealed ( nt -- )
Reveal the definition nt by resetting its smudge
bit.
Source file: <src/kernel.z80s>.
rl#
rl# ( n -- a )
Create a relative reference to assembler label number n,
defined by l:
. If label n is already defined, a is
its value. Otherwise a is a temporary address just to be
consumed by the relative jump instruction, and the actual
address will be resolved after the label has been defined
by l:
.
Usage example:
code my-code ( -- ) #2 rl# jr, \ a relative jump to label #2 nop, #2 l: \ definition of label #2 ret, end-code
Warning
|
rl# is used before the Z80 command, while its
counterpart al# is used after the Z80 command.
|
Source file: <src/lib/assembler.labels.fs>.
rl-id
rl-id ( -- b )
Identifier of relative references created by rl#
.
rl-id
is used as a bitmask added to the label number
stored in l-refs
.
See also: al-id
.
Source file: <src/lib/assembler.labels.fs>.
rnd
rnd ( -- u )
Return a random number u.
See also: random
, random-range
, fast-rnd
.
Source file: <src/lib/random.fs>.
rom-font
rom-font ( -- a )
A constant that holds the address a of the ROM font,
which is 15360 ($3C00), the bitmap address of character 0,
256 bytes below the bitmap of the space (character 32),
which is the first printable character. This is the default
hold in os-chars
.
See also: default-font
, set-font
, get-font
,
outlet-autochars
.
Source file: <src/lib/display.fonts.fs>.
root
root ( -- )
Transform the search order consisting of wid[n]..wid[2]
wid[1] (where wid[1] is searched first) into
wid[n]..wid[2] wid[root-wordlist
], i.e. replace the top
word list of the search order with root-wordlist
.
root
is the vocabulary corresponding to root-wordlist
.
See also: forth
, wordlist
, vocabulary
.
Source file: <src/kernel.z80s>.
root-wordlist
root-wordlist ( -- wid )
Return wid, the identifier of the word list that includes
the words defined in the minimum search order. The words
defined in the word list identified by root-wordlist
are
aliases of the definitions in forth-wordlist
.
See also: only
, wordlist
, set-order
,
assembler-wordlist
, alias
.
Source file: <src/kernel.z80s>.
rows
rows ( -- n )
Return the number of rows in the current screen mode. The default value is 24.
Source file: <src/lib/display.mode.COMMON.fs>.
rp0
rp0 ( -- a )
User variable that holds the address of the bottom of the return stack.
Origin: fig-Forth’s r0
.
Source file: <src/kernel.z80s>.
rshift
rshift ( x1 u -- x2 )
Perform a logical right shift of u bit-places on x, giving x2. Put zeroes into the most significant bits vacated by the shift.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/lib/math.operators.1-cell.fs>.
ruler
ruler ( c len -- ca len )
Return a string ca len of characters c.
See also: chars>string
, char>string
, s+
.
Source file: <src/lib/strings.MISC.fs>.
run:
run: ( head n "ccc<semicolon>" -- head )
Add a clause to a switch structure head. The key value
of the clause is n and its associated behavior is one or
more previously defined words, ending with ;
.
Origin: SwiftForth.
Source file: <src/lib/flow.bracket-switch.fs>.
runs
runs ( head n "name" -- )
Add a clause to a switch structure head. The key value of the clause is n and its associated behavior is the previously defined name.
Origin: SwiftForth.
Source file: <src/lib/flow.bracket-switch.fs>.
s
s ( n -- )
Spread at line n. Line n and following lines are are moved down one line. Line n becomes blank. Line 15 is lost.
Source file: <src/lib/editor.specforth.fs>.
s"
s" ( Compilation: "ccc<quote>" -- ) ( Interpretation: "ccc<quote>" -- ca len ) ( Run-time: -- ca len )
s"
is an immediate
word.
Definition:
: s" ( Compilation: "ccc<quote>" -- ) ( Interpretation: "ccc<quote>" -- ca len ) ( Run-time: -- ca len ) '"' parse-string ; immediate
Source file: <src/kernel.z80s>.
s""
s"" ( -- ca len )
Return an empty string in the stringer
.
Source file: <src/lib/strings.MISC.fs>.
s'
s' ( Compilation: "ccc<char>" -- ) ( Run-time: -- ca len )
Identical to the standard word s"
, but using single
quote as delimiter. A simple alternative to s\"
when only
double quotes are needed in a string.
s'
is an immediate
word.
Source file: <src/lib/strings.MISC.fs>.
s+
s+ ( ca1 len1 ca2 len2 -- ca3 len3 )
Append the string ca2 len2 to the end of string ca1
len1 returning the string ca3 len3 in the stringer
.
Source file: <src/lib/strings.MISC.fs>.
s,
s, ( ca len -- )
Compile a string.
Definition:
: s, ( ca len -- ) dup c, tuck here swap cmove allot ;
Source file: <src/kernel.z80s>.
s>d
s>d ( n -- d )
Sign extend a single number n to form a double number d.
Definition:
: s>d ( n -- d ) dup 0< ;
Origin: fig-Forth’s s→d
, Forth-94 (CORE), Forth-2012
(CORE).
Source file: <src/kernel.z80s>.
s\"
s\" ( Compilation: "ccc<quote>" -- ) ( Interpretation: "ccc<quote>" -- ca len ) ( Run-time: -- ca len )
Note: When s\"
is loaded, esc-standard-chars-wordlist
is set as the only word list in esc-order
. That is the
standard behaviour. Alternative escaped chars can be
configured with esc-block-chars-wordlist
and
esc-udg-chars-wordlist
.
s\"
is an immediate
word.
Origin: Forth-2012 (CORE EXT, FILE EXT).
See also: parse-esc-string
, set-esc-order
, .\"
.
Source file: <src/lib/strings.escaped.fs>.
save-buffers
save-buffers ( -- )
If the disk buffer has been modified, transfer its contents to disk and mark it as unmodified.
Definition:
: save-buffers ( -- ) updated? 0= ?exit buffer-block dup write-block disk-buffer ! ;
Origin: Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (BLOCK), Forth-2012 (BLOCK).
See also: empty-buffers
, flush
, block
, buffer
,
buffer-block
, disk-buffer
.
Source file: <src/kernel.z80s>.
save-mode
save-mode ( -- )
Save the current screen mode into previous-mode
.
save-mode
is executed by bye
before setting the default
screen mode.
Definition:
: save-mode ( -- ) current-mode @ previous-mode ! ;
See also: restore-mode
, current-mode
, previous-mode
.
Source file: <src/kernel.z80s>.
scan
scan ( ca1 len1 c -- ca2 len2 )
Scan the string ca1 len1 for the first occurence of character c. Leave match address ca2 and length remaining len2. If no match occurred then len2 is zero and ca2 is ca1+len1.
Source file: <src/kernel.z80s>.
sconstant
sconstant ( ca len "name" -- )
Create a string constant name with value ca len.
See also: sconstants
.
Source file: <src/lib/strings.MISC.fs>.
sconstants
sconstants ( 0 ca[n]..ca[1] "name" -- n )
Create a table of string constants name, using counted strings ca[n]..ca[1], being 0 a mark for the last string on the stack, and return the number n of compiled strings.
When name is executed, it converts the index on the stack (0..n-1) to the correspondent string ca len.
Usage example:
0 \ end of strings here ," kvar" \ string 4 here ," tri" \ string 3 here ," du" \ string 2 here ," unu" \ string 1 here ," nul" \ string 0 sconstants digitname constant digitnames cr .( There are ) digitnames . .( digit names:) 0 digitname cr type 1 digitname cr type 2 digitname cr type 3 digitname cr type cr
See also: sconstant
.
Source file: <src/lib/strings.MISC.fs>.
scr
scr ( -- a )
User variable that holds the number of the block most recently
listed by list
. scr
is used by the block editors.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Controlled Reference Words), Forth-94 (BLOCK EXT), Forth-2012 (BLOCK EXT).
Source file: <src/kernel.z80s>.
scra>attra
scra>attra ( a1 -- a2 )
Convert screen bitmap address a1 to its correspondent attribute address a2.
Source file: <src/lib/graphics.pixels.fs>.
seal
seal ( -- )
Remove all word lists from the search order other than the word list that is currently on top of the search order. I.e., change the search order such that only the word list at the top of the search order will be searched.
Origin: Gforth.
Source file: <src/lib/word_lists.fs>.
search
search ( ca1 len1 ca2 len2 -- ca3 len3 f )
Search the string ca1 len1 for the string ca2 len2. If f is true, a match was found at ca3 with len3 characters remaining. If f is false there was no match and ca3 len3 is ca1 len1.
Origin: Forth-94 (STRING), Forth-2012 (STRING).
Source file: <src/kernel.z80s>.
search-wordlist
search-wordlist ( ca len wid -- 0 | xt 1 | xt -1 )
Find the definition identified by the string ca len in the word list identified by wid. If the definition is not found, return zero. If the definition is found, return its xt and one (1) if the definition is immediate, minus-one (-1) otherwise.
Origin: Forth-94 (SEARCH), Forth-2012 (SEARCH).
See also: find-name
, find-name-from
, find-name-in
,
find
.
Source file: <src/lib/word_lists.fs>.
seclusion
seclusion ( -- wid1 wid2 )
Start a seclusion module. Private definitions follow.
Modules hide the internal implementation and leave visible the words of the outer interface.
wid1 is the identifier of the compilation word list
before seclusion
was executed. wid2 is the identifier
of the word list where private definitions of the seclusion
module will be created. They are used by -seclusion
,
which marks the start of public definitions, +seclusion
,
which optionally marks the start of new private
definitions, and end-seclusion
, which ends the module.
Usage example:
seclusion \ Inner/private words. -seclusion \ Interface/public words. +seclusion \ More inner/private words. -seclusion \ More interface/public words. \ Etc. end-seclusion
A copy of wid2 may be kept by the application in order to
access private words later, e.g. `seclusion dup constant
my-module
.
Source file: <src/lib/modules.MISC.fs>.
sector#>dos
sector#>dos ( n -- x )
Convert the sequential disk sector n to the disk sector id x, in the format required by G+DOS: The high byte of x is the track (0..79 for side 0; 128..207 for side 1); its low byte is the sector (1..10)..
Definition:
: sector#>dos ( n -- x ) dup sectors/track mod 1+ ( n sector ) swap dup 20 / ( sector n track0 ) swap sectors/track / 1 and ( sector track0 side ) negate 128 and or ( sector track ) sector>dos ; \ Notes: \ x (high byte) = track 0..79 for side 0, 128..207 for side 1 \ x (low byte) = sector 1..10 \ track0 = 0..79 \ track = 0..207 \ side = 0..1
See also: sectors/track
, sector>dos
, transfer-sector
.
Source file: <src/kernel.gplusdos.z80s>.
sector>dos
sector>dos ( sector track -- x )
Convert the 8-bit sector number sector and the 8-bit track number track to the 16-bit number x in the format used by G+DOS: The high byte of x is the track, and its low byte is the sector.
sector>dos
is a factor of block-sector#>dos
.
sector>dos
is written in Z80. Its equivalent definition in
Forth is the following:
: sector>dos ( sector track -- x ) flip or ;
Source file: <src/kernel.gplusdos.z80s>.
sectors/block
sectors/block ( -- n )
Sectors per block.
See also: b/sector
, sectors/track
, blocks/disk
.
Source file: <src/kernel.z80s>.
sectors/track
sectors/track ( -- n )
Sectors per disk track.
See also: b/sector
, sectors/block
, blocks/disk
.
Source file: <src/kernel.z80s>.
see
see ( "name" -- )
Decode the word’s definition name. At the moment see
works only with colon definitions.
Origin: Forth-94 (TOOLS), Forth-2012 (TOOLS).
See also: see-xt
, see-body
, see-body-from
.
Source file: <src/lib/tool.see.fs>.
see-body
see-body ( pfa -- )
Decode the colon word’s definition whose body is pfa.
see-body
is a factor of see
.
See also: see-body-from
, see-xt
.
Source file: <src/lib/tool.see.fs>.
see-body-from
see-body-from ( a -- )
Decode the colon word’s definition from a, which is part
of its body. see-body-from
is useful to decode words
that use exit
in the midle of the definition, because
see
stops at the first exit
found.
Source file: <src/lib/tool.see.fs>.
see-xt
see-xt ( xt -- )
Decode the word’s definition xt. At the moment
see-xt
works only with colon definitions.
The listing can be paused with the space bar, then stopped with the return key or resumed with any other key.
See also: see
, see-body
, see-body-from
.
Source file: <src/lib/tool.see.fs>.
sentry:
sentry: ( ca len wid "name" -- )
Create a string entry "name" in associative list wid, with value ca len.
Source file: <src/lib/data.associative-list.fs>.
set-accept
set-accept ( ca1 len1 -- ca1' )
Set string ca len as the string being edited by accept
.
Return the address ca1' after its last character.
Source file: <src/lib/keyboard.MISC.fs>.
set-anon
set-anon ( x[n-1]..x[0] n a -- )
Usage example:
here anon> ! 5 cells allot : test ( x4 x3 x2 x1 x0 -- ) 5 set-anon [ 0 ] anon ? \ print _x5_ 123 [ 0 ] anon ! [ 0 ] anon ? \ print 123 [ 2 ] anon ? \ print _x3_ 555 [ 2 ] anon ! [ 2 ] anon ? \ print 555 ;
Source file: <src/lib/locals.anon.fs>.
set-bit
set-bit ( b1 n -- b2 )
Set bit n of b1, returning the result b2.
Source file: <src/lib/memory.MISC.fs>.
set-block-drives
set-block-drives ( c[n]..c[1] n -- )
Set the block drives to the drives specified by drive
identifiers c[n]..c[1]. Subsequently drive c[1] will be
searched first for blocks from block number 0 to block
number blocks/disk 1-
; drive c[n+1] will be searched
for blocks from block number blocks/disk
to block number
blocks/disk 2 * 1-
; and so on.
If n is zero, no drive is used for blocks.
Note
|
set-block-drives sets last-locatable to the
last block available on the new configuration, but
first-locatable is not modified.
|
See also: -block-drives
, #block-drives
, block-drive!
,
get-block-drives
.
Source file: <src/lib/dos.COMMON.fs>.
set-bright
set-bright ( f -- )
If f is true, turn bright on by setting the
corresponding bit of the current attribute. If f is
false, turn bright off by resetting the bit. Other
non-zero values of f will turn bright on or off depending
on them having a common bit with bright-mask
.
Source file: <src/lib/display.attributes.fs>.
set-capslock
set-capslock ( -- )
Set capslock.
See also: unset-capslock
, capslock?
, toggle-capslock
,
capslock
.
Source file: <src/lib/keyboard.caps_lock.fs>.
set-circle-pixel
set-circle-pixel ( a -- )
Set the address a of the routine circle-pixel
will jump
to.
set-circle-pixel
is used to make circle-pixel
jump
to colored-circle-pixel
, uncolored-circle-pixel
, or
other routine provided by the application, therefore
configuring circle
.
Source file: <src/lib/graphics.circle.fs>.
set-code-file
set-code-file ( ca1 len1 ca2 len2 -- )
Configure ufia
to use a code file in the current drive
with filename ca2 len2, start address ca1 and length
len1.
See also: set-filename
.
Source file: <src/lib/dos.gplusdos.fs>.
set-current
set-current ( wid -- )
Set the compilation word list to the word list identified by wid.
Definition:
: set-current ( wid -- ) current ! ;
Origin: Forth-94 (SEARCH), Forth-2012 (SEARCH).
Source file: <src/kernel.z80s>.
set-date
set-date ( day month year -- )
Set the current date. The default date is 2016-01-01. It
can be fetch with get-date
. The date is not updated by
the system.
See: get-date
, date
, leapy-year?
.
Source file: <src/lib/time.fs>.
set-default-bank
set-default-bank ( +n -- )
Set +n as the default memory bank by modifyng the
contents of default-bank#
.
See also: get-default-bank
, default-bank
, bank
,
banks
.
Source file: <src/lib/memory.bank.fs>.
set-drive
set-drive ( n -- ior )
Set the drive n (1 or 2) as the current one. If the drive is successfully selected, ior is zero. Otherwise it’s an exception code.
Source file: <src/kernel.gplusdos.z80s>.
set-filename
set-filename ( ca len -- )
Configure ufia
to use filename ca len and the current
drive.
Source file: <src/lib/dos.gplusdos.fs>.
set-flash
set-flash ( f -- )
If f is true, turn flash on by setting the
corresponding bit of the current attribute. If f is
false, turn flash off by resetting the bit. Other
non-zero values of f will turn flash on or off depending
on them having a common bit with flash-mask
.
Source file: <src/lib/display.attributes.fs>.
set-font
set-font ( a -- )
Set address a as the current font by setting the system
variable os-chars
set-font
is used by all screen modes. The character
bitmap a points to depends on the mode.
The last char used from the font can be configured by
last-font-char
.
Source file: <src/kernel.z80s>.
set-heap
set-heap ( a u b -- )
Set the values of the current heap: its address a
(returned by heap
), its size u (returned by /heap
)
and its bank b (stored in heap-bank
).
set-heap
and get-heap
are useful when more than one
memory heap are needed by the application.
Source file: <src/lib/memory.allocate.COMMON.fs>.
set-ink
set-ink ( b -- )
Set ink color b by modifying bits 0-2 of the current attribute. Note that b is supposed to be in the range 0..7 and its bits 3-7 are not masked. Therefore any value other than 0..7 will corrupt the current attribute.
set-ink
is written in Z80. Its equivalent definition in
Forth is the following:
: set-ink ( b -- ) attr@ %11111000 and or attr! ;
See also: attr!
, ink.
, set-paper
, set-flash
,
set-bright
.
Source file: <src/lib/display.attributes.fs>.
set-mixer
set-mixer ( b -- )
Set the mixer register of the AY-3-8912 sound generator to b.
Register 7 (Mixer - I/O Enable)
This controls the enable status of the noise and tone mixers for the three channels, and also controls the I/O port used to drive the RS232 and Keypad sockets.
Bit 0 Channel A Tone Enable (0=enabled).
Bit 1 Channel B Tone Enable (0=enabled).
Bit 2 Channel C Tone Enable (0=enabled).
Bit 3 Channel A Noise Enable (0=enabled).
Bit 4 Channel B Noise Enable (0=enabled).
Bit 5 Channel C Noise Enable (0=enabled).
Bit 6 I/O Port Enable (0=input, 1=output).
Bit 7 Not used.
Source file: <src/lib/sound.128.fs>.
set-mode-output
set-mode-output ( a -- )
Associate the output routine at a to the system channels "K", "S" and "P".
Source file: <src/lib/display.mode.COMMON.fs>.
set-order
set-order ( -1 | 0 | wid[n]..wid[1] n -- )
Set the search order to the word lists identified by widn..wid1. Subsequently, word list wid1 will be searched first, and word list widn searched last. If n is zero, empty the search order. If n is minus one, set the search order to the implementation-defined minimum search order.
Definition:
: set-order ( -1 | 0 | widn..wid1 n -- ) dup -1 = if drop root-wordlist dup 2 then dup ?order dup #order ! 0 ?do i cells context + ! loop ;
Origin: Forth-94 (SEARCH), Forth-2012 (SEARCH).
Source file: <src/kernel.z80s>.
set-paper
set-paper ( b -- )
Set paper color b (0..7) by modifying the corresponding bits of the current attribute.
set-paper
is written in Z80. Its equivalent definition
in Forth is the following:
: set-paper ( b -- ) papery attr@ unpaper-mask and or attr! ;
See also: attr!
, paper.
, set-ink
, set-flash
,
set-bright
.
Source file: <src/lib/display.attributes.fs>.
set-pixel
set-pixel ( gx gy -- )
Set a pixel without changing its attribute on the screen or the current graphic coordinates. gx is 0..255; gy is 0..191.
See also: plot
, plot176
, reset-pixel
,
toggle-pixel
, xy>gxy
.
Source file: <src/lib/graphics.pixels.fs>.
set-pixel176
set-pixel176 ( gx gy -- )
Set a pixel without changing its attribute on the screen or the current graphic coordinates, and using only the top 176 pixel rows of the screen (the lower 16 pixel rows are not used). gx is 0..255; gy is 0..175.
See also: set-save-pixel176
, set-pixel
, plot
,
plot176
, reset-pixel
, toggle-pixel
, reset-pixel176
,
toggle-pixel176
, xy>gxy176
.
Source file: <src/lib/graphics.pixels.fs>.
set-save-pixel176
set-save-pixel176 ( gx gy -- )
Set a pixel without changing its attribute on the screen,
and using only the top 176 pixel rows of the screen (the
lower 16 pixel rows are not used). gx is 0..255; gy is
0..175. set-save-pixel176
updates the graphic
coordinates (contrary to set-pixel176
).
See also: set-pixel
, plot
, plot176
, reset-pixel
,
toggle-pixel
, reset-pixel176
, toggle-pixel176
.
Source file: <src/lib/graphics.pixels.fs>.
set-source
set-source ( ca len -- )
Set the memory zone ca len as the current source by pointing the input buffer to it.
Definition:
: set-source ( ca len -- ) input-buffer 2! >in off ;
See also: input-buffer
, >in
, terminal>source
,
block>source
.
Source file: <src/kernel.z80s>.
set-tape-filename
set-tape-filename ( ca len -- )
Store filename ca len into the tape-filename
field of
tape-header
.
Source file: <src/lib/tape.fs>.
set-tape-memory
set-tape-memory ( ca len -- )
Configure tape-header
with the memory zone ca len (to
be read or written), by storing len into tape-length
and ca into tape-start
.
Source file: <src/lib/tape.fs>.
set-time
set-time ( second minute hour -- )
Set the current time.
See also: get-time
.
Source file: <src/lib/time.fs>.
set-udg
set-udg ( a -- )
Set address a as the the current UDG set (characters
0..255), by changing the system variable os-udg
. a
must be the bitmap address of character 0.
Source file: <src/lib/graphics.udg.fs>.
set-window
set-window ( -- )
Make a the current window.
See also: window
, current-window
.
Source file: <src/lib/display.window.fs>.
sign
sign ( n -- )
If n is negative, add a minus sign to the beginning of the pictured numeric output string.
Definition:
: sign ( n -- ) 0< if '-' hold then ;
Origin: Forth 94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
silence
silence ( -- )
Execute -mixer
to disable the noise and tone mixers for
the three channels of the AY-3-8912 sound generator. Then
set the volume of the three channels to zero.
See also: !volume
.
Source file: <src/lib/sound.128.fs>.
simple-accept
simple-accept ( ca1 len1 -- len2 )
Default action of the deferred word accept
:
Receive a string of at most len1 characters. No characters are received or transferred if len1 is zero. Display graphic characters as they are received.
Input terminates when the Return key is pressed. When input terminates, nothing is appended to the string or displayed on the screen.
The only control key accepted is Delete.
len2 is the length of the string stored at ca1.
Definition:
: simple-accept ( ca len -- len' ) over + over ( bot eot cur ) begin xkey dup 13 <> \ not carriage return? while ( bot eot cur c ) dup 12 = \ delete? if drop >r over r@ < dup \ any chars? if 8 dup emit bl emit emit then r> + else \ maybe printable >r 2dup <> \ more? r@ [ bl 1- ] literal > and \ and printable? if r@ over c! char+ r@ emit then r> drop then repeat ( bot eot cur c ) drop nip swap - ;
Source file: <src/kernel.z80s>.
skip
skip ( ca1 len1 c -- ca2 len2 | ca1 len1 )
Skip over leading occurences of the character c in the string ca1 len1. Leave the address of the first non-matching character ca2 and length remaining len2. If no characters were skipped leave ca1 len1.
Source file: <src/kernel.z80s>.
skip-sign?
skip-sign? ( ca len -- ca' len' f )
If number string ca len starts with a minus sign, remove it and return the result string ca' len' and a true flag f; else ca' len' is identical to ca len and f is false.
Definition:
: skip-sign? ( ca len -- ca' len' f ) over c@ '-' = dup >r abs /string r> ;
Source file: <src/kernel.z80s>.
slit
slit ( -- ca len )
Return a string that is compiled after the calling word, and adjust the instruction pointer to step over the inline string.
Definition:
: slit ( -- ca len ) r@ count dup char+ r> + >r ;
Source file: <src/kernel.z80s>.
sliteral
sliteral ( ca len -- )
Compile string _ca len _ in the current definition.
sliteral
is an immediate
and compile-only
word.
Definition:
: sliteral ( ca len -- ) postpone slit s, ; immediate compile-only
Source file: <src/kernel.z80s>.
slow-gxy>scra_
slow-gxy>scra_ ( -- a )
Return address a of an alternative entry point to the PIXEL-ADD ROM routine ($22AA), to let the range of the y coordinate be 0..191 instead of 0..175.
This is the default action of gxy>scra_
.
When fast-gxy>scra_
(which is faster but bigger, and
requires the assembler) is needed, the application must use
need fast-gxy>scra_
before need set-pixel
or any
other word that needs gxy>scra_
.
Input registers:
-
C = x cordinate (0..255)
-
B = y coordinate (0..191)
Output registers:
-
HL = address of the pixel byte in the screen bitmap
-
A = position of the pixel in the byte address (0..7), note: position 0=bit 7, position 7=bit 0.
See also: gxy176>scra_
.
Source file: <src/lib/graphics.pixels.fs>.
slow-pixels
slow-pixels ( -- n )
Return the number u of pixels that are set on the screen.
This is the alternative action of the deferred word
pixels
. slow-pixels
simply executes bits
with the
screen address and length on the stack.
See also: fast-pixels
.
Source file: <src/lib/graphics.pixels.fs>.
sm/rem
sm/rem ( d n1 -- n2 n3 )
Symmetric division:
D = n3*n1+n2; sign(n2) = sign(d1) or 0
Divide d by n1, giving the symmetric quotient n3 and the remainder n2. Input and output stack arguments are signed.
Dividend | Divisor | Remainder | Quotient |
---|---|---|---|
10 |
7 |
3 |
1 |
-10 |
7 |
-3 |
-1 |
10 |
-7 |
3 |
-1 |
-10 |
-7 |
-3 |
1 |
Definition:
: sm/rem ( d1 n1 -- n2 n3 ) \ symmetric signed division 2dup xor >r \ sign of quotient over >r \ sign of remainder abs >r dabs r> um/mod swap r> ?negate swap r> ?negate ;
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
smove
smove ( ca1 len1 ca2 -- )
Move the string ca1 len1 to ca2.
smove
is the equivalent of the idiom swap move
, but
faster.
Source file: <src/kernel.z80s>.
smudge
smudge ( -- )
Toggle the "smudge bit" of the latest definition’s name field. This prevents an uncompleted definition from being found during dictionary searches, until compiling is completed without error.
Origin: fig-Forth.
See also: smudged
.
Source file: <src/lib/compilation.fs>.
smudge-mask
smudge-mask ( -- b )
Constant that holds the bitmask of the smudge
bit.
Source file: <src/kernel.z80s>.
smudged
smudged ( nt -- )
Toggle the "smudge bit" of the given nt.
See also: smudge
.
Source file: <src/lib/compilation.fs>.
sound
sound ( b[0]..b[13] "name" -- )
Create a word name that will play the 14-byte sound defined by b[0]..b[13].
Source file: <src/lib/sound.128.fs>.
sound,
sound, ( b[0]..b[13] -- )
Compile the 14-byte sound definition b[0]..b[13].
Source file: <src/lib/sound.128.fs>.
sound-register-port
sound-register-port ( -- a )
The I/O port used to select a register of the AY-3-8912
sound generator, before writing a value into it using
sound-write-port
, or before reading a value from it using
sound-register-port
again.
sound-register-port
is a fast constant defined with
const
. Its value is $FFFD.
See also: sound-write-port
, !sound
, @sound
.
Source file: <src/lib/sound.128.fs>.
sound-write-port
sound-write-port ( -- a )
The I/O port used to write to a register of the AY-3-8912 sound generator.
sound-write-port
is a fast constant defined with
const
. Its value is $BFFD.
See also: sound-register-port
, !sound
, @sound
.
Source file: <src/lib/sound.128.fs>.
source
source ( -- ca len )
Definition:
: source ( -- ca len ) blk @ ?dup if block b/buf exit then input-buffer 2@ ;
Origin: Forth-94 (CORE), Forth-2012 (CORE).
See also: input-buffer
, set-source
, blk
.
Source file: <src/kernel.z80s>.
source-id
source-id ( -- 0 | -1 )
Identifies the input source as follows:
0 |
User input device |
-1 |
String via |
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
sp0
sp0 ( -- a )
User variable that holds the address of the bottom of the data stack.
Origin: fig-Forth’s s0
, Forth-79’s s0
, Forth-83’s
s0
.
Source file: <src/kernel.z80s>.
spaces
spaces ( n -- )
If n is greater than zero, display n spaces.
spaces
is written in Z80. Its equivalent definition in
Forth is the following:
: spaces ( n -- ) bl swap emits ;
Origin: fig-Forth, Forth-79, Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
span
span ( -- a )
The address of a variable containing the count of
characters actually received and stored by the last
execution of expect
.
Origin: Forth-83 (Required Word Set), Forth-94 (CORE EXT).
Source file: <src/lib/keyboard.MISC.fs>.
split
split ( x -- b1 b2 )
Get b1 and b2 from the 2 bytes which compose x: b1 is the low-order byte and b2 is the high-order byte.
Origin: IsForth.
See also: join
.
Source file: <src/lib/math.operators.1-cell.fs>.
sqrt
sqrt ( n1 -- n2 )
Calculate integer square root n2 of radicand n1.
sqrt
is a deferred word which can execute baden-sqrt
or newton-sqrt
.
Source file: <src/lib/math.operators.1-cell.fs>.
standard-number-point?
standard-number-point? ( c -- f )
Is character c a valid point in a number? The only allowed point is period.
standard-number-point?
is the default action of the
deferred word number-point?
, which is used in number?
.
Definition:
: standard-number-point? ( c -- f ) '.' = ;
See also: classic-number-point?
, extended-number-point?
.
Source file: <src/kernel.z80s>.
state
state ( -- a )
User variable that holds the compilation-state flag, which is true when in compilation state, false otherwise.
Origin: fig-Forth, Forth-89 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
step
step Compilation: ( dest -- ) Run-time: ( R: n -- n' )
Compilation: ( dest — )
Append the run-time semantics given below to the current
definition. Resolve the destination of for
.
Run-time: ( R: n — n' )
If the loop index is zero, discard the loop parameters and continue execution after the loop. Otherwise decrement the loop index and continue execution at the beginning of the loop.
step
is an immediate
and compile-only
word.
Note: step
is usually called next
in other Forth
systems.
Origin: Z88 CamelForth.
Source file: <src/lib/flow.for.fs>.
storer
storer ( x a "name" -- )
Define a word name which, when executed, will cause that x be stored at a.
Origin: word set
found in Forth-79 (Reference Word Set)
and Forth-83 (Appendix B. Uncontrolled Reference Words).
Source file: <src/lib/data.storer.fs>.
str<
str< ( ca1 len1 ca2 len2 -- f )
Is string ca1 len1 lexicographically smaller than string ca2 len2?
Source file: <src/lib/strings.MISC.fs>.
str=
str= ( ca1 len1 ca2 len2 -- f )
Is string ca1 len1 lexicographically equal to string ca2 len2?
Definition:
: str= ( ca1 len1 ca2 len2 -- f ) compare 0= ;
Source file: <src/kernel.z80s>.
str>
str> ( ca1 len1 ca2 len2 -- f )
Is string ca1 len1 lexicographically larger than string ca2 len2?
Source file: <src/lib/strings.MISC.fs>.
stream
stream ( -- ca len )
Return the address and length of the remaining stream source.
Source file: <src/kernel.z80s>.
string-parameter
string-parameter ( -- ca len )
Return a string compiled after the calling word.
See warning"
and (warning")
for a usage example.
Source file: <src/lib/compilation.fs>.
string/
string/ ( ca1 len1 len2 -- ca2 len2 )
Return the len2 ending characters of string ca1 len1.
See also: /string
.
Source file: <src/lib/strings.MISC.fs>.
string>source
string>source ( ca len -- )
Set the string ca len as the current source.
See also: set-source
, (source-id)
.
Source file: <src/lib/parsing.fs>.
stringer
stringer ( -- a )
A constant that returns the base address of the stringer
,
which is the circular string buffer used by all string
operations.
The application can move and resize the stringer
if
needed. Example:
stringer /stringer 2constant old-stringer \ Keep the address and length of the old stringer, in order \ to reuse its space later. need !> here 1024 dup allot !> /stringer !> stringer empty-stringer \ Create a new, 1024-byte `<<entry737472696E676572, pass:c[stringer]>>` in data space.
The default stringer
can be restored by
default-stringer
.
See also: !>
, /stringer
, empty-stringer
, +stringer
,
unused-stringer
, ?stringer
, allocate-stringer
,
>stringer
.
Source file: <src/kernel.z80s>.
substitute
substitute ( ca1 len1 ca2 len2 -- ca2 len3 n )
Perform substitution on the string ca1 len1 placing the result at string ca2 len3, where len3 is the length of the resulting string. An error occurs if the resulting string will not fit into ca2 len2 or if ca2 is the same as ca1. The return value n is positive or 0 on success and indicates the number of substitutions made. A negative value for n indicates that an error occurred, leaving ca2 len3 undefined, and being n the exception code.
Substitution occurs left to right from the start of
ca1 in one pass and is non-recursive. When text of
a potential substitution name, surrounded by "%" (ASCII
$25) delimiters is encountered by substitute
, the
following occurs:
-
If the name is null, a single delimiter character is passed to the output, i.e., "%%" is replaced by "%". The current number of substitutions is not changed.
-
If the text is a valid substitution name acceptable to
replaces
, the leading and trailing delimiter characters and the enclosed substitution name are replaced by the substitution text. The current number of substitutions is incremented. -
If the text is not a valid substitution name, the name with leading and trailing delimiters is passed unchanged to the output. The current number of substitutions is not changed.
-
Parsing of the input string resumes after the trailing delimiter.
If after processing any pairs of delimiters, the residue of the input string contains a single delimiter, the residue is passed unchanged to the output.
See also: unescape
, substitution-delimiter?
.
Source file: <src/lib/strings.substitute.fs>.
substitute-wordlist
substitute-wordlist ( -- wid )
Word list for substitution names and replacement texts.
See also: replaces
.
Source file: <src/lib/strings.replaces.fs>.
substitution
substitution ( ca1 len1 -- ca2 )
Given a string ca1 len1 create its substitution and storage space. Return the address of the buffer for the substitution text.
See also: replaces
.
Source file: <src/lib/strings.replaces.fs>.
substitution-delimiter
substitution-delimiter ( -- c )
A character constant that returns the character used as
delimiter by substitute
. By default it’s "%".
See also: substitution-delimiter?
.
Source file: <src/lib/strings.substitute.fs>.
substitution-delimiter?
substitution-delimiter? ( ca -- f )
Does ca contains the character hold in the character
constant substitution-delimiter
? If so return true,
else return false.
substitution-delimiter?
is a factor of substitute
.
substitution-delimiter?
is written in Z80. Its
equivalent definition is Forth is the following:
: substitution-delimiter? ( ca -- f ) c@ substitution-delimiter = ;
Source file: <src/lib/strings.substitute.fs>.
suffix?
suffix? ( ca1 len1 ca2 len2 -- f )
Is string ca2 len2 the suffix of string ca1 len1?
Source file: <src/lib/strings.MISC.fs>.
swap-current
swap-current ( wid1 -- wid2 )
Exchange the contents of the current compilation word list,
which is idenfified by wid2, with the word list
identified by wid1
.
Origin: lpForth.
Source file: <src/lib/word_lists.fs>.
swapped
swapped ( i*x n1 n2 -- j*x )
Remove n1 and n2. Swap elements n1 and n2 of the
stack, being 0 the top of the stack. 0 1 swapped
is
equivalent to swap
.
Usage example:
( 1 2 3 4 5 ) 1 4 swapped ( 4 2 3 1 5 )
Source file: <src/lib/data_stack.fs>.
switch
switch ( x switch -- )
Execute the switch switch for the key x.
See also: switch:
.
Source file: <src/lib/flow.switch-colon.fs>.
switch:
switch: ( "name" -- )
Create a new switch control structure name, which is a word list the clauses of the structure will be added to.
The keys can be 1-byte, 1-cell or 2-cell numbers, but the correspondent words must be used to create the clauses and execute them later:
Usage example:
switch: mynumber \ Define clauses: 0 mynumber :clause ( -- ) cr ." zero" ; 1 mynumber :cclause ( -- ) cr ." one" ; 2048 mynumber :clause ( -- ) cr ." 2 KiB" ; 100000. mynumber :2clause ( -- ) cr ." big" ; \ Execute the clauses: 0 mynumber switch 1 mynumber cswitch 2048 mynumber switch 100000. mynumber 2switch
New clauses can be added any time, in any order, with any key.
Clauses created with :clause
(for 1-cell keys),
:cclause
(for character keys) and :2clause
(for 2-cell
keys) must be executed with switch
, cswitch
and
2switch
respectively. The smaller the key type, the less
memory used by clauses in headers space (every clause is a
definition whose name is the binary string of its key) and
the less execution time, though the difference will be
unimportant in most cases.
If a new clause is added with a previously used key, the new clause will replace the old one.
There’s no default clause: if the a given key is not found, no code is executed and no exception is thrown.
Source file: <src/lib/flow.switch-colon.fs>.
switch]
switch] ( head -- )
Terminate a switch structure (or the latest additions to it) by marking the end of its linked list. Discard the switch head from the stack.
Origin: SwiftForth.
Source file: <src/lib/flow.bracket-switch.fs>.
switcher
switcher ( i*x n head -- j*x )
Search the linked list from its head for a match to the value n. If a match is found, discard n and execute the associated matched xt. If no match is found, leave n on the stack and execute the default xt.
Source file: <src/lib/flow.bracket-switch.fs>.
synonym
synonym ( "newname" "oldname" -- )
Create a definition for newname with the the semantics defined below. newname may be the same as oldname; when looking up oldname, newname shall not be found.
newname ( Interpretation: i*x — j*x )
Perform the interpretation semantics of oldname.
newname ( Compilation: i*x — j*x )
Perform the compilation semantics of oldname.
Synonyms have the execution token of the old word and,
contrary to aliases created by alias
, they also inherit
its attributes (immediate and compile-only).
See also: alias
.
Origin: Forth-2012 (TOOLS EXT).
Source file: <src/lib/define.synonym.fs>.
system
system ( -- a len )
Prepare the system in order to save a copy. Return its start address and length, to be used as parameters for saving the system to disk.
Source file: <src/lib/tool.turnkey.fs>.
tab
tab ( -- )
Emit a tabulate character (character code 6), which moves the print position to the next 16-character column.
Source file: <src/lib/display.control.fs>.
tabs
tabs ( n -- )
Emit n number of tab characters (character code 6).
Source file: <src/lib/display.control.fs>.
tabulate
tabulate ( -- )
Display the appropriate number of spaces to tabulate to the
next position, using the value of /tabulate
.
Note tabulate
does not uses the "tab" control code, whose
behaviour depends on the screen mode (in the default screen
mode, it moves the cursor 16 positions to the right).
tabulate
prints spaces and is independent from the screen
mode.
Source file: <src/lib/display.control.fs>.
tape-file>
tape-file> ( ca1 len1 ca2 len2 -- )
Read a tape file ca1 len1 (len1 is zero if filename is unspecified) into a memory region ca2 len2.
ca2 is zero if the address must be taken from the file header instead, which is the address the file was saved from. len2 is zero if it’s unspecified.
Warning
|
If len2 is not zero or the exact length of the file, the ROM routine returns to BASIC with "Tape loading error". This crashes the system, because in Solo Forth the lower screen has no lines, and BASIC can not print the message. This will be avoided in a future version of Solo Forth. |
See also: >tape-file
, (tape-file>)
, >file
.
Source file: <src/lib/tape.fs>.
tape-filename
tape-filename ( -- ca )
Address of the filename in tape-header
.
See also: /tape-filename
, set-tape-filename
,
last-tape-filename
.
Source file: <src/lib/tape.fs>.
tape-filetype
tape-filetype ( -- ca )
Address of the file type (one byte) in tape-header
.
Its default value is 3 (code file).
See also: last-tape-filetype
.
Source file: <src/lib/tape.fs>.
tape-header
tape-header ( -- a )
Address of the tape header, which is used by the ROM routines. Its structure is the following:
Offset | Size | Description |
---|---|---|
+00 |
byte |
filetype (3 for code files) |
+01 |
10 chars |
filename, padded with spaces |
+11 |
cell |
length |
+13 |
cell |
start address |
+15 |
cell |
not used for code files |
When the first char of the filename is 255, it is regarded
as a wildcard which will match any filename. The word
tape-file>
sets the wildcard when the provided filename
is empty.
A second tape header, pointed by last-tape-header
,
follows the main one. It is used by the ROM routines while
loading. It can be used by the application to know the
details of the last tape file that was loaded.
IX addresses the first header, which must contain the data. The second header is used by the system when loading and verifying. Only the "CODE" file type column is relevant to Solo Forth.
First header | Second header | BASIC program | Num DATA | String DATA | CODE | Notes |
---|---|---|---|---|---|---|
IX+$00 |
IX+$11 |
0 |
1 |
2 |
3 |
File type |
IX+$01 |
IX+$12 |
x |
x |
x |
x |
F ($FF if filename is null) |
IX+$02 |
IX+$13 |
x |
x |
x |
x |
i |
IX+$03 |
IX+$14 |
x |
x |
x |
x |
l |
IX+$04 |
IX+$15 |
x |
x |
x |
x |
e |
IX+$05 |
IX+$16 |
x |
x |
x |
x |
n |
IX+$06 |
IX+$17 |
x |
x |
x |
x |
a |
IX+$07 |
IX+$18 |
x |
x |
x |
x |
m |
IX+$08 |
IX+$19 |
x |
x |
x |
x |
e |
IX+$09 |
IX+$1A |
x |
x |
x |
x |
. |
IX+$0A |
IX+$1B |
x |
x |
x |
x |
Padding spaces |
IX+$0B |
IX+$1C |
lo |
lo |
lo |
lo |
Total… |
IX+$0C |
IX+$1D |
hi |
hi |
hi |
hi |
…length of datablock |
IX+$0D |
IX+$1E |
Auto |
- |
- |
Start |
Various |
IX+$0E |
IX+$1F |
Start |
a-z |
a-z |
addr |
($80 if no autostart). |
IX+$0F |
IX+$20 |
lo |
- |
- |
- |
Length of program only… |
IX+$10 |
IX+$21 |
hi |
- |
- |
- |
…i.e. without variables |
See also: tape-filename
, tape-filetype
, tape-start
,
tape-length
, any-tape-filename
, ?set-tape-filename
.
Source file: <src/lib/tape.fs>.
tape-length
tape-length ( -- a )
Address of the file length in tape-header
.
See also: last-tape-length
.
Source file: <src/lib/tape.fs>.
tape-length
tape-length ( -- a )
Address of the file length in last-tape-header
.
See also: tape-length
.
Source file: <src/lib/tape.fs>.
tape-start
tape-start ( -- a )
Address of the file start in tape-header
.
See also: last-tape-start
.
Source file: <src/lib/tape.fs>.
tape-start
tape-start ( -- a )
Address of the file start in last-tape-header
.
See also: tape-start
.
Source file: <src/lib/tape.fs>.
task
task ( user_size ds_size rs_size "name" -- )
Create a new task.
Source file: <src/lib/multitask.muench-koh.fs>.
tasks
tasks ( -- )
Display tasks list in status-follower chain.
Source file: <src/lib/multitask.muench-koh.fs>.
terminal>source
terminal>source ( -- )
Set the terminal as the current source.
Definition:
: terminal>source ( -- ) blk off (source-id) off tib #tib @ set-source ;
See also: set-source
, blk
, tib
, #tib
, (source-id)
,
block>source
.
Source file: <src/kernel.z80s>.
text
text ( "ccc<eol>" -- )
Get the text string until end of line and store it into
pad
as a counted string, blank-filling the remainder of
pad
to c/l
characters.
Source file: <src/lib/editor.specforth.fs>.
there
there ( a -- )
Set a as the address of the data-space pointer.
A non-standard counterpart of here
.
Source file: <src/lib/compilation.fs>.
thiscase
thiscase ( x -- x x )
Mark the start of an alternative case
structure.
Usage example:
: say0 ( -- ) ." nul" ; : say1 ( -- ) ." unu" ; : say2 ( -- ) ." du" ; : say-other ( -- ) ." alia" ; : test ( x -- ) thiscase 0 = ifcase say0 exitcase thiscase 1 = ifcase say1 exitcase thiscase 2 = ifcase say2 exitcase othercase say-other ;
Source file: <src/lib/flow.thiscase.fs>.
throw
throw ( n -- )
Definition:
: throw ( n -- ) ?dup if catcher @ ?dup 0= \ no catcher? if error then \ `<<entry6572726F72, pass:c[error]>>` does not return rp! \ restore previous return stack r> catcher ! ( n ) \ restore previous catcher r> swap >r ( saved-SP ) ( R: n ) sp! drop r> ( n ) \ restore stack \ Return to the caller of `<<entry6361746368, pass:c[catch]>>` because return stack is \ restored to the state that existed when `<<entry6361746368, pass:c[catch]>>` began \ execution. then ;
Origin: Forth-94 (EXCEPTION), Forth-2012 (EXCEPTION).
Source file: <src/kernel.z80s>.
thru
thru ( block1 block2 -- )
Load consecutively the blocks from block1 through block2.
Origin: Forth-79 (Reference Word Set), Forth-83 (Controlled Reference Words), Forth-94 (BLOCK EXT), Forth-2012 (BLOCK EXT).
Source file: <src/lib/blocks.fs>.
thru-index-need
thru-index-need ( "name" -- )
If word "name" is found in the current search order, do nothing. Otherwise search the index word list for it. If found, execute it, causing its associated block be loaded. If not found, throw an exception -277 ("needed, but not indexed").
This is an alternative action of the deferred word
need
.
Source file: <src/lib/blocks.indexer.thru.fs>.
thru-index-needed
thru-index-needed ( ca len -- )
If word ca len is found in the current search order, do nothing. Otherwise search the index word list for it. If found, execute it, causing its associated block be loaded. If not found, throw an exception -277 ("needed, but not indexed").
This is an alternative action of the deferred word
needed
.
Source file: <src/lib/blocks.indexer.thru.fs>.
thru-index-reneed
thru-index-reneed ( "name" -- )
Search the index word list for word "name". If found, execute it, causing its associated block be loaded. If not found, throw an exception -277 ("needed, but not indexed").
This is an alternative action of the deferred word
reneed
.
Source file: <src/lib/blocks.indexer.thru.fs>.
thru-index-reneeded
thru-index-reneeded ( ca len-- )
Search the index word list for word ca len. If found, load the block it’s associated to. If not found, throw an exception -277 ("needed, but not indexed").
This is an alternative action of the deferred word
reneeded
.
Source file: <src/lib/blocks.indexer.thru.fs>.
tib
tib ( -- a )
Return address a of the terminal input buffer.
Origin: Forth-83 (Required Word Set), Forth-94 (CORE EXT, obsolescent).
Source file: <src/kernel.z80s>.
till
till ( "ccc<eol>" -- )
Delete on the cursor line from the cursor till the end of string "ccc".
Source file: <src/lib/editor.specforth.fs>.
time&date
time&date ( -- second minute hour day month year )
Return the current time and date: second, minute, hour, day, month and year.
Origin: Forth-94 (FACILITY EXT), Forth-201 (FACILITY EXT).
Source file: <src/lib/time.fs>.
times
times ( n -- )
Repeat the next compiled instruction n times. If n is zero, continue executing the following instruction.
times
is useful to implement complicated math
operations, like shifts, multiply, divide and square root,
from appropriate math step instructions. It is also useful
in repeating auto-indexing memory instructions.
This structure is not nestable.
Usage example:
: blink ( -- ) 7 0 ?do i border loop 0 border ; : blinking ( -- ) 100 times blink ." Done" cr ;
See also: dtimes
, executions
.
Source file: <src/lib/flow.times.fs>.
tnegate
tnegate ( t1 -- t2 )
t2 is the negation of t1.
Source file: <src/lib/math.operators.3-cell.fs>.
to
to Interpretation: ( i*x "name" -- ) Compilation: ( "name" -- ) Run-time: ( i*x -- )
to
is an immediate
word.
Interpretation:
Compilation:
Parse name, which is a word created by cvalue
, value
or 2value
, and append the execution execution semantics
given below to the current definition.
Run-time:
Make i*x the value of name.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/data.value.fs>.
toarg
toarg ( -- )
Set the store action for the next local variable created by
arguments
.
Loading toarg
makes @
the default action of
arguments
locals, which is hold in arg-default-action
.
See also: +toarg
.
Source file: <src/lib/locals.arguments.fs>.
toggle-capslock
toggle-capslock ( -- )
Toggle capslock.
See also: set-capslock
, unset-capslock
, capslock?
,
capslock
.
Source file: <src/lib/keyboard.caps_lock.fs>.
toggle-pixel
toggle-pixel ( gx gy -- )
Toggle a pixel without changing its attribute on the screen or the current graphic coordinates. gx is 0..255; gy is 0..191.
See also: set-pixel
, reset-pixel
, toggle-pixel176
,
set-pixel176
, reset-pixel176
, plot
, plot176
.
Source file: <src/lib/graphics.pixels.fs>.
toggle-pixel176
toggle-pixel176 ( gx gy -- )
Toggle a pixel without changing its attribute on the screen or the current graphic coordinates, and using only the top 176 pixel rows of the screen (the lower 16 pixel rows are not used). gx is 0..255; gy is 0..175.
See also: toggle-pixel
, set-pixel
, reset-pixel
,
set-pixel176
, reset-pixel176
, plot
, plot176
.
Source file: <src/lib/graphics.pixels.fs>.
top
top ( -- )
Position the editing cursor at the top of the block.
Source file: <src/lib/editor.COMMON.fs>.
toval
toval ( -- )
Change the default behaviour of words created by val
:
make them store a new value instead of returning its actual
one.
Source file: <src/lib/data.val.fs>.
tr-dos
tr-dos ( -- )
An alias of noop
that is defined only in the TR-DOS version
of Solo Forth. Its goal is to be used to check the DOS the
application is running on.
tr-dos
is an immediate
word.
Source file: <src/kernel.z80s>.
trail
trail ( -- nt )
Leave the nt of the topmost word in the first word list of the search order.
Source file: <src/lib/word_lists.fs>.
transfer-block
transfer-block ( u -- )
The block-level disk read-write linkage. Transfer block u
to or from disk. The read or write mode must be previously
set by write-mode
or read-mode
.
Definition:
: transfer-block ( u -- ) >drive-block sectors/block * dup block-sector#>dos buffer-data transfer-sector throw 1+ block-sector#>dos [ buffer-data b/sector ] literal transfer-sector throw ;
See also: transfer-sector
, block-sector#>dos
,
>drive-block
.
Source file: <src/kernel.gplusdos.z80s>.
transfer-sector
transfer-sector ( x a -- ior )
The sector-level disk read-write linkage. Transfer sector
x to or from the disk in the current drive. The read or
write mode must be previously set by write-mode
or
read-mode
.
-
x = sector to be read or written
-
high byte = track 0..79, +128 if side 1
-
low byte = sector 1..10
-
-
a = source or destination address
See also: block-sector#>dos
, transfer-block
.
Source file: <src/kernel.gplusdos.z80s>.
transient
transient ( u1 u2 -- )
Start transient code, reserving u1 bytes of headers space for it, which will be allocated at the top of the far memory, and u2 bytes of data space for it, which will be allocated at the top of the main memory. Therefore the memory used by the transient code must be known in advance.
The inner operation is: Save the current values of dp
,
np
current-latest
, latest-wordlist
, limit
and
farlimit
; then reserve data and headers space as said and
update limit
and farlimit
accordingly.
transient
must be used before compiling the transient
code.
Usage example:
2025 1700 transient need assembler end-transient \ ...use assembler here... forget-transient
The values of limit
and farlimit
must be preserved
between transient
and end-transient
, because
forget-transient
restores them to their previous state,
before transient
.
Source file: <src/lib/modules.transient.fs>.
translate-char
translate-char ( c1 -- c1 | c2 )
Translate char c1 using the current keyboard decoding table,
pointed by key-translation-table
.
Source file: <src/kernel.z80s>.
translate-char
translate-char ( c1 -- c2 )
Source file: <src/kernel.z80s>.
trim
trim ( ca1 len1 -- ca1' len1' )
Remove leading and trailing spaces from a string ca len1, returning string ca1' len1'.
Source file: <src/lib/strings.MISC.fs>.
true
true ( -- true )
Return a true flag, a single-cell value with all its bits set (equivalent to -1).
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
tuck
tuck ( x1 x2 -- x2 x1 x2 )
Copy the first (top) stack item below the second stack item.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
turnkey
turnkey ( xt -- a len )
Prepare the system in order to save a copy that will execute the given xt after the ordinary boot process. Return its start address and length, to be used as parameters for saving the system to disk.
Source file: <src/lib/tool.turnkey.fs>.
type
type ( ca len -- )
If len is greater than zero, display the character string ca len.
: type ( ca len — ) bounds ?do i c@ emit loop ;
See also: type-udg
.
Source file: <src/kernel.z80s>.
type-ascii
type-ascii ( ca len -- )
If len is greater than zero, display the string ca len, replacing non-ASCII and control chars with a dot.
Source file: <src/lib/display.type.fs>.
type-center-field
type-center-field ( ca1 len1 len2 -- )
If len1 is greater than zero, display the character string ca1 len1 at the center of a field of len2 characters.
See also: type-center-field-fit
,
type-center-field-crop
, drop-type
, type-left-field
,
type-right-field
, gigatype-title
.
Source file: <src/lib/display.type.fs>.
type-center-field-crop
type-center-field-crop ( ca1 len1 len2 -- )
If len1 is greater than zero, display the character string ca1 len1 at the center of a field of len2 characters, which is shorter than the string.
See also: type-center-field-fit
, type-center-field
.
Source file: <src/lib/display.type.fs>.
type-center-field-fit
type-center-field-fit ( ca1 len1 len2 -- )
If len1 is greater than zero, display the character string ca1 len1 at the center of a field of len2 characters, which is longer than the string.
See also: type-center-field-crop
, type-center-field
.
Source file: <src/lib/display.type.fs>.
type-left-field
type-left-field ( ca1 len1 len2 -- )
If len1 is greater than zero, display the character string ca1 len1 at the left of a field of len2 characters.
See also: padding-spaces
, type-right-field
,
type-center-field
.
Source file: <src/lib/display.type.fs>.
type-right-field
type-right-field ( ca1 len1 len2 -- )
If len1 is greater than zero, display the character string ca1 len1 at the right of a field of len2 characters.
See also: type-right-field-fit
, type-right-field-crop
,
drop-type
, type-left-field
, type-center-field
.
Source file: <src/lib/display.type.fs>.
type-right-field-crop
type-right-field-crop ( ca1 len1 len2 -- )
Type string ca1 len1 at the right of a field of len2 characters, which is shorter than the string.
See also: type-right-field
, type-right-field-fit
.
Source file: <src/lib/display.type.fs>.
type-right-field-fit
type-right-field-fit ( ca1 len1 len2 -- )
Type string ca1 len1 at the right of a field of len2 characters, which is longer than the string.
See also: type-right-field
, type-right-field-crop
.
Source file: <src/lib/display.type.fs>.
type-udg
type-udg ( ca len -- )
If len is greater than zero, display the UDG character
string ca len. All characters of the string are printed
with emit-udg
.
See also: type
.
Source file: <src/lib/graphics.udg.fs>.
u.r
u.r ( u n -- )
Print an unsigned number u right justified in a field of n characters wide. If the number of characters required to print u is greater than n, all digits are displayed with no leading spaces in a field as wide as necessary.
Origin: Forth-79 (Reference Word Set)[7], Forth-83 (Controlled Reference Word)[8], Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/display.numbers.fs>.
u<
u< ( u1 u2 -- f )
f is true if and only if u1 is less than u2.
Origin: Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
u<=
u<= ( u1 u2 -- f )
f is true if and only if u1 is less than or equal to u2.
Source file: <src/lib/math.operators.1-cell.fs>.
u>
u> ( u1 u2 -- > )
f is true if and only if u1 is greater than u2.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
u>=
u>= ( u1 u2 -- f )
f is true if and only if u1 is greater than or equal to u2.
Source file: <src/lib/math.operators.1-cell.fs>.
u>str
u>str ( u -- ca len )
Convert u to string ca len.
See also: ud>str
, d>str
, char>string
.
Source file: <src/lib/strings.MISC.fs>.
u>ud
u>ud ( u -- ud )
Extend a single unsigned number u to form a double
unsigned number ud. u>ud
is just an alias of 0
.
See also: s>d
.
Source file: <src/lib/math.operators.1-cell.fs>.
uallot
uallot ( n -- )
If n is greater than zero, reserve n address units of user data space. If n is less than zero, release n address units of user data space. If n is zero, leave the user data-space pointer unchanged. An exception is thrown if the user-data pointer is out of bounds after the operation.
Source file: <src/lib/data.user.fs>.
ucreate
ucreate ( "name" -- )
Create a header name which points to the first available offset within the user area. Execution of name leaves its absolute user area storage address. No user space is allocated.
Source file: <src/lib/data.user.fs>.
ud*
ud* ( ud1 ud2 -- ud3 )
Multiply ud1 by ud2 giving the product ud3.
Source file: <src/lib/math.operators.2-cell.fs>.
ud.r
ud.r ( ud n -- )
Print an usigned double number ud right justified in a field of n characters wide. If the number of characters required to print ud is greater than n, all digits are displayed with no leading spaces in a field as wide as necessary.
Source file: <src/lib/display.numbers.fs>.
ud/mod
ud/mod ( ud1 u2 -- u3 ud4 )
An unsigned mixed magnitude math operation which leaves a double quotient ud4 and remainder u3, from a double dividend ud1 and single divisor u2.
Definition:
: ud/mod ( ud1 u1 -- urem udquot ) >r 0 r@ um/mod -rot r> um/mod rot ;
Origin: fig-Forth’s m/mod
, Gforth, Z88 CamelForth.
Source file: <src/kernel.z80s>.
ud>str
ud>str ( ud -- ca len )
Convert ud to string ca len.
See also: u>str
, d>str
, char>string
.
Source file: <src/lib/strings.MISC.fs>.
udg!
udg! ( b0..b7 c -- )
Store the 8-byte bitmap b0..b7 into UDG c (0..255) of
the UDG font pointed by os-udg
. b0 is the first (top)
scan. b7 is the last (bottom) scan.
Source file: <src/lib/graphics.udg.fs>.
udg-at-xy-display
udg-at-xy-display ( x y c -- )
Display UDG c (0..255) at cursor coordinates x y. This
is much faster than a combination of at-xy
and
emit-udg
, because no ROM routine is used, the cursor
coordinates are not updated and the screen attributtes are
not changed (only the character bitmap is displayed).
See also: at-xy-display-udg
.
Source file: <src/lib/graphics.udg.fs>.
udg-blank
udg-blank ( -- ca )
A character variable that holds the characted used by
grid
and g
as a grid blank. By default it’s '.'.
See also: udg-dot
, udg-scan>binary
.
Source file: <src/lib/graphics.udg.fs>.
udg-block
udg-block ( width height c "name..." -- )
Parse a UDG block, from UDG character c (0..255). width
and height are in characters. The maximum width is 7
(imposed by the size of Forth source blocks). height has
no maximum, as the UDG block can ocuppy more than one Forth
block (provided the Forth block have no index line, i.e.
load-app
is used to load the source).
The scans can be formed by binary digits, by the characters
hold in udg-blank
and udg-dot
, or any combination of
both notations.
Usage example:
5 2 140 udg-block ..XXXX....XXXX....XXXX....XXXX....XXXX.. .XXXXXX..XXXXXX..XXXXXX..XXXXXX..X.XXXX. XXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXX.XXXXXX XXXXXXXXXXXXXXXXX.XXXXXXX.XXXXXXXXXXXXXX XXXXXXXXX.XXXXXXX.XXXXXXXXXXXXXXXXXXXXXX XX..XXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXX .XXXXXX..XXXXXX..XXXXXX..XXXXXX..XXXXXX. ..XXXX....XXXX....XXXX....XXXX....XXXX.. ..XXXX....XXXX....XXXX....XXXX....XXXX.. .XXXXXX..XXXXXX..XXXXXX..XXXXXX..X.XXXX. XXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXX.XXXXXX XXXXXXXXXXXXXXXXX.XXXXXXX.XXXXXXXXXXXXXX XXXXXXXXX.XXXXXXX.XXXXXXXXXXXXXXXXXXXXXX XX..XXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXX .XXXXXX..XXXXXX..XXXXXX..XXXXXX..XXXXXX. ..XXXX....XXXX....XXXX....XXXX....XXXX..
Source file: <src/lib/graphics.udg.fs>.
udg-dot
udg-dot ( -- ca )
A character variable that holds the characted used by
grid
and g
as a grid blank. By default it’s 'X'.
See also: udg-blank
, udg-scan>binary
.
Source file: <src/lib/graphics.udg.fs>.
udg-group
udg-group ( c -- )
Parse a group of UDG definitions organized in width
columns and height rows, and store them starting from UDG
character c (0..255). The maximum width is 7 (imposed
by the size of Forth source blocks). height has no
maximum, as the UDG block can ocuppy more than one Forth
block (provided the Forth block have no index line, i.e.
load-app
is used to load the source).
The scans can be formed by binary digits, by the characters
hold in udg-blank
and udg-dot
, or any combination of
both notations.
Usage example:
5 1 140 udg-group ..XXXX.. ..XXXX.. ..XXXX.. ..XXXX.. ..XXXX.. .XXXXXX. .XXXXXX. .XXXXXX. .XXXXXX. .X.XXXX. XXXXXXXX XXXXXXXX XXXXXXXX X.XXXXXX X.XXXXXX XXXXXXXX XXXXXXXX X.XXXXXX X.XXXXXX XXXXXXXX XXXXXXXX X.XXXXXX X.XXXXXX XXXXXXXX XXXXXXXX XX..XXXX XX.XXXXX XXXXXXXX XXXXXXXX XXXXXXXX .XXXXXX. .XXXXXX. .XXXXXX. .XXXXXX. .XXXXXX. ..XXXX.. ..XXXX.. ..XXXX.. ..XXXX.. ..XXXX..
See also: udg-block
.
Source file: <src/lib/graphics.udg.fs>.
udg-ocr
udg-ocr ( n -- )
Set ocr
to work with the first n chars of the current
UDG set.
Source file: <src/lib/graphics.ocr.fs>.
udg-scan>binary
udg-scan>binary ( ca len -- )
Convert the characters udg-blank
and udg-dot
found in
UDG scan string ca len to '0' and '1' respectively.
See also: udg-scan>number?
.
Source file: <src/lib/graphics.udg.fs>.
udg-scan>number
udg-scan>number ( ca len -- n )
If UDG scan string ca len, after being processed by
udg-scan>binary
, is a valid binary number, return the
result n. Otherwise throw exception #-290 (invalid UDG
scan).
See also: udg-scan>number?
, udg-block
, udg-group
.
Source file: <src/lib/graphics.udg.fs>.
udg-scan>number?
udg-scan>number? ( ca len -- n true | false )
Is UDG scan string ca len a valid binary number?
The string is processed by udg-scan>binary
first.
See also: udg-scan>binary
, udg-scan>number
.
Source file: <src/lib/graphics.udg.fs>.
udg-width
udg-width ( -- b )
b is the width of a UDG (User Defined Graphic), in pixels.
Source file: <src/lib/graphics.udg.fs>.
udg:
udg: ( b0..b7 c "name" -- )
Create a cconstant
name for UDG char c (0..255) and
store the 8-byte bitmap b0..b7 into that UDG char. b0
is the first (top) scan. b7 is the last (bottom) scan.
Source file: <src/lib/graphics.udg.fs>.
udg>
udg> ( c -- a )
Convert UDG number n (0..255) to the address a of its
bitmap, pointed by os-udg
.
Source file: <src/lib/graphics.udg.fs>.
udp
udp ( -- a )
User variable that holds an offset from the start of the current user area to the free space in it.
Source file: <src/kernel.z80s>.
ufia
ufia ( -- a )
Return constant address a of a buffer used as UFIA (User File Information Area), a 24-byte structure which describes a file.
Solo Forth words use ufia
for G+DOS calls. G+DOS uses
its own buffers ufia1
and ufia2
for internal
operations.
Offset | Bytes | Meaning |
---|---|---|
0 |
1 |
Drive number (1, 2 or '*' ($2A) for current) |
1 |
1 |
Directory entry number |
2 |
1 |
Stream number |
3 |
1 |
Device density type ('d'=DD, 'D'=SD) |
4 |
1 |
Directory description |
5 |
10 |
File name (padded with spaces) |
15 |
1 |
File type |
16 |
2 |
Length of file |
18 |
2 |
Start address |
20 |
2 |
Length of a BASIC program |
22 |
2 |
Autostart line of a BASIC program |
Source file: <src/lib/dos.gplusdos.fs>.
ufia1
ufia1 ( -- a )
a is the address of G+DOS UFIA1 (in the Plus D memory).
A UFIA (User File Information Area) is a 24-byte structure
which describes a file. See ufia
for a detailed
description.
See also: /ufia
.
Source file: <src/lib/dos.gplusdos.fs>.
ufia2
ufia2 ( -- a )
a is the address of G+DOS UFIA2 (in the Plus D memory).
A UFIA (User File Information Area) is a 24-byte structure
which describes a file. See ufia
for a detailed
description.
See also: /ufia
.
Source file: <src/lib/dos.gplusdos.fs>.
um*
um* ( u1 u2 -- ud )
Multiply u1 by u2, giving the unsigned double-cell product ud. All values and arithmetic are unsigned.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
um/mod
um/mod ( ud u1 -- u2 u3 )
Divide ud by u1, giving the quotient u3 and the remainder u2. All values and arithmetic are unsigned.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
unbright-mask
unbright-mask ( -- b )
A constant. b is the inverted bitmask of the bit used to indicate the bright status in an attribute byte.
See also: unbright-mask
, brighty
, set-bright
, attr!
.
Source file: <src/lib/display.attributes.fs>.
uncolored-circle-pixel
uncolored-circle-pixel ( -- a )
a is the address of a subroutine that circle
can use to
draw its pixels. This routine sets a pixel without
changing its color attributes on the screen (like
set-pixel
). Therefore it’s faster than its alternative
colored-circle-pixel
(0.6 its execution speed).
set-circle-pixel
sets the routine used by circle
. See
the requirements of such routine in the documentation of
circle-pixel
.
Source file: <src/lib/graphics.circle.fs>.
undefined?
undefined? ( ca len -- f )
Find name ca len. If the definition is not found after searching the active search order, return false, else return true.
Definition:
: undefined? ( ca len -- f ) find-name 0= ;
Source file: <src/kernel.z80s>.
under+
under+ ( n1|u1 x n2|u2 -- n3|u3 x )
Add n2|u2 to n1|u2, giving the sum n3|u3.
under+
is written in Z80. Its definition in Forth is
the following:
: under+ ( n1|u1 x n2|u2 -- n3|u3 x ) rot + swap ;
Origin: Comus.
See also: +under
.
Source file: <src/lib/math.operators.1-cell.fs>.
unescape
unescape ( ca1 len1 ca2 -- ca2 len2 )
Replace each "%" character in the input string ca1 len1 by two "%" characters. The output is represented by ca2 len2. The buffer at ca2 shall be big enough to hold the unescaped string.
If you pass a string through unescape
and then
substitute
, you get the original string.
Origin: Forth-2012 (STRING EXT).
See also: replaces
.
Source file: <src/lib/strings.MISC.fs>.
unflash-mask
unflash-mask ( -- b )
A constant. b is the inverted bitmask of the bit used to indicate the flash status in an attribute byte.
See also: unflash-mask
, flashy
, set-flash
, attr!
.
Source file: <src/lib/display.attributes.fs>.
unlink-internal
unlink-internal ( nt xtp -- )
Unlink all words defined between the latest pair internal
and end-external
, linking the first word after
end-internal
to the word before internal
, thus making
all the internal words skipped by the dictionary searches.
Usage example:
internal : hello ( -- ) ." hello" ; end-internal : salute ( -- ) hello ; unlink-internal salute \ ok! hello \ error!
At least one word must be defined between end-internal
and unlink-internal
.
The alternative word hide-internal
can be used instead of
unlink-internal
in order to keep the internal words
searchable.
Source file: <src/lib/modules.internal.fs>.
unlocated
unlocated ( block -- )
Deferred word called in the loop of located
, when the
word searched for is not located in block. Its default
action is drop
, which is changed by use-fly-index
in order to index the blocks on the fly.
Source file: <src/lib/002.need.fs>.
unloop
unloop ( -- ) ( R: loop-sys -- )
Discard the loop
control parameters loop-sys for the
current nesting level. An unloop
is required for each
nesting level before the definition may be exited with exit
.
Origin: Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
unmarker
unmarker ( a -- )
Set the data-space pointer to a and restore the names
pointer, the latest definition pointers, the word lists
pointer, the compilation word list, the search order and
the configuration of word lists that were saved at a by
marker,
.
unmarker
is a factor of marker
.
Source file: <src/lib/tool.marker.fs>.
unnest-source
unnest-source ( R: source-sys -- )
Restore the source specification described by source-sys,
left by nest-source
.
Definition:
: unnest-source ( R: source-sys -- ) r> r> #tib ! r> blk ! r> >in ! r> (source-id) ! 2r> input-buffer 2! >r ; compile-only
Source file: <src/kernel.z80s>.
unresolved
unresolved ( n -- a )
a is the address of element n of the cell array pointed
by unresolved>
.
Source file: <src/lib/assembler.fs>.
unresolved0>
unresolved0> ( -- a )
Address a is the default value of unresolved>
: an
8-cell array.
Source file: <src/lib/assembler.fs>.
unresolved>
unresolved> ( -- a )
A variable. Address a contains the address of a cell
array accessed by unresolved
. Its default value is
unresolved0>
, which is an 8-cell array.
The cell array pointed by unresolved>
is used to store
unresolved addresses during the compilation of code words.
This method is a simpler alternative to labels created by
l:
.
Source file: <src/lib/assembler.fs>.
unset-capslock
unset-capslock ( -- )
Unset capslock.
See also: set-capslock
, capslock?
, toggle-capslock
,
capslock
.
Source file: <src/lib/keyboard.caps_lock.fs>.
until
until ( dest -- )
until
is an immediate
and compile-only
word.
Source file: <src/kernel.z80s>.
unused
unused ( -- u )
Return the amount of space remaining in the region addressed
by here
, in address units. This region includes the
transient spaces addressed by pad
and hold
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/kernel.z80s>.
unused-stringer
unused-stringer ( -- n )
Return the number n of free characters in the stringer
.
unused-stringer
is written in Z80. Its equivalent
definition if Forth is the following:
: unused-stringer ( -- n ) +stringer @ ;
See also: +stringer
.
Source file: <src/kernel.z80s>.
up
up ( -- a )
A variable. a holds the address of the user area pointer.
Origin: fig-Forth.
Source file: <src/kernel.z80s>.
update
update ( -- )
Mark the current block buffer as modified. The block will
subsequently be transferred automatically to disk should
its buffer be required for storage of a different block, or
upon execution of flush
or save-buffers
.
Origin: Forth-83 (Required Word Set), Forth-94 (BLOCK), Forth-2012 (BLOCK).
Source file: <src/lib/blocks.fs>.
updated?
updated? ( -- f )
Is the current disk buffer marked as modified?
Definition:
: updated? ( -- f ) buffer-id 0< ;
See also: update
, empty-buffers
, buffer-id
.
Source file: <src/kernel.z80s>.
upper_
upper_ ( -- a )
Return address a of a routine that converts the ASCII character in the A register to uppercase.
Source file: <src/lib/strings.MISC.fs>.
uppers
uppers ( ca len -- )
Convert string ca len to uppercase.
Source file: <src/lib/strings.MISC.fs>.
uppers1
uppers1 ( ca len -- )
Change the first char of string ca len to uppercase.
Source file: <src/lib/strings.MISC.fs>.
use-default-located
use-default-located ( -- )
use-default-located
is a common factor of
use-no-index
and use-thru-index
.
Source file: <src/lib/002.need.fs>.
use-default-need
use-default-need ( -- )
use-default-need
is a common factor of use-no-index
and use-fly-index
.
Source file: <src/lib/002.need.fs>.
use-fly-index
use-fly-index ( -- )
Set the alternative action of need
, needed
, reneed
,
reneeded
, located
and unlocated
in order to use the
blocks index and index the searched blocks on the fly.
The default action of all said words can be restored by
use-no-index
.
See also: use-thru-index
.
Source file: <src/lib/blocks.indexer.fly.fs>.
use-no-index
use-no-index ( -- )
Set the default action of need
, needed
, reneed
,
reneeded
and unlocated
: Use locate
to search the
blocks.
The alternative actions are set by use-thru-index
and
use-fly-index
.
See also: use-default-need
, use-default-located
.
Source file: <src/lib/002.need.fs>.
use-thru-index
use-thru-index ( -- )
Change the action of need
, needed
, reneed
,
reneeded
, located
and unlocated
in order to use the
blocks index created by make-thru-index
.
The default action of all said words can be restored by
use-no-index
.
See also: use-fly-index
.
Source file: <src/lib/blocks.indexer.thru.fs>.
user
user ( n "name" -- )
Create a user variable name in the first available offset within the user area. Execution of name leaves its absolute user area storage address.
Source file: <src/lib/data.user.fs>.
ut*
ut* ( ud u -- t )
t is the signed product of ud times u.
Source file: <src/lib/math.operators.3-cell.fs>.
ut/
ut/ ( ut n -- d )
Divide a triple unsigned number ut by a single number n giving the double number result d.
Source file: <src/lib/math.operators.3-cell.fs>.
val
val ( x "name" -- )
Create a definition for name that will place x on the
stack (unless toval
is used first) and then will execute
init-val
.
val
is an alternative to the standard value
.
Source file: <src/lib/data.val.fs>.
value
value ( x "name" -- )
Create a definition name with the following execution semantics: place x on the stack.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/data.value.fs>.
var
var ( m v size "name" -- m v' )
Define a variable with size bytes.
Source file: <src/lib/objects.mini-oof.fs>.
variable
variable ( "name" -- )
Parse name. Create a definition for name with the execution semantics defined below. Reserve one cell of data space.
name is referred to as a variable.
name Execution: ( -- a )
a is the address of the reserved cell. A program is responsible for initializing the contents of the reserved cell.
Origin: Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
version
version ( -- a )
Return an address that holds the Solo Forth version, as follows:
+0: major (one byte) +1: minor (one byte) +2: patch (one byte) +3: pre-release (one byte), zero if none +4: build (double-cell number)
Source file: <src/kernel.z80s>.
vertical-curtain
vertical-curtain ( b -- )
Wash the screen with the given color attribute b from the left and right columns to the middle.
See also: horizontal-curtain
.
Source file: <src/lib/graphics.cls.fs>.
view
view ( "name" -- )
List the block where name is defined, i.e. the first block where name is in the index line (surrounded by spaces). If name can not be found, throw exception #-286 ("not located").
Source file: <src/lib/tool.list.blocks.fs>.
vocabulary
vocabulary ( "name" -- )
Create a vocabulary name. A vocabulary is a named word list. Subsequent execution of name replaces the first entry in the search order with the word list associated to name. When name becomes the compilation word list new definitions will be appended to name's word list.
Origin: Forth-83 (Required Word Set).
See also: wordlist
, definitions
, wordlist-of
.
Source file: <src/lib/word_lists.fs>.
wacat
wacat ( ca len -- )
Show a wild-card abbreviated disk catalogue of the current drive using the wild-card filename ca len. See the Plus D manual for wild-card syntax.
Source file: <src/lib/dos.gplusdos.fs>.
warn
warn ( ca len -- ca len )
Check if ca len already exists in the compilation word list.
If so, and if the content of warnings
is not zero, do a
configurable action, usually issue a warning message.
warn
is a deferred word which is called by header,
and
whose default action is noop
. Alternative actions are
provided by warn.message
, warn.throw
and warn-throw
.
Source file: <src/kernel.z80s>.
warn-throw
warn-throw ( ca len -- ca len )
Alternative action for the deferred word warn
. If the
contents of the user variable warnings
is not zero and
the word name ca len is already defined in the current
compilation word list, throw error #-257 instead of
printing a warning message.
See: warnings
, warn.throw
, warn.message
, ?warn
.
Source file: <src/lib/compilation.fs>.
warn.message
warn.message ( ca len -- ca len )
Alternative action for the deferred word warn
. If the
contents of the user variable warnings
is not zero and
the word name ca len is already defined in the current
compilation word list, print a warning message.
See: warnings
, warn.throw
, warn-throw
, ?warn
.
Source file: <src/lib/compilation.fs>.
warn.throw
warn.throw ( ca len -- ca len )
Alternative action for the deferred word warn
. If the
contents of the user variable warnings
is not zero and
the word name ca len is already defined in the current
compilation word list, print throw error #-257, without
actually throwing an error.
See: warnings
, warn-throw
, warn.message
, ?warn
.
Source file: <src/lib/compilation.fs>.
warning"
warning"
Compilation: ( "ccc<quote>" — )
Parse and compile a message.
Execution: ( f — )
If f is not zero, print the compiled message; else do nothing.
Source file: <src/lib/exception.fs>.
warnings
warnings ( -- a )
User variable that holds a flag. If it’s zero, no warning is shown when a compiled word is not unique in the compilation word list. Its default value is true.
Source file: <src/lib/compilation.fs>.
wave-display
wave-display ( -- )
Modify the screen bitmap with a water effect. At the end the original image is restored.
See also: invert-display
, fade-display
.
Source file: <src/lib/graphics.display.fs>.
wcat
wcat ( ca len -- )
Show a wild-card disk catalogue of the current drive using the wild-card filename ca len. See the Plus D manual for wild-card syntax.
Source file: <src/lib/dos.gplusdos.fs>.
wdump
wdump ( a len -- )
Show the contents of len cells from a.
Source file: <src/lib/tool.dump.fs>.
where
where ( -- )
Print information about the last error: block number, line number and a picture of where it occurred. If the error was in the command line, nothing is printed.
Origin: Forth-79 (Reference Word Set).
Source file: <src/lib/tool.debug.where.fs>.
while
while ( dest -- orig dest )
while
is an immediate
and compile-only
word.
Source file: <src/kernel.z80s>.
white
white ( -- b )
A constant that returns 7, the value that represents the white color.
Source file: <src/lib/display.attributes.fs>.
white-noise
white-noise ( -- )
White noise for ZX Spectrum 48K. u is the duration in number of sample bytes.
Source file: <src/lib/sound.48.fs>.
width
width ( -- a )
User variable that holds the maximum number of letters saved
in the compilation of a definition name. It must be 1 thru 31,
with a default value of 31. The name character count and its
natural characters are saved, up to the value in width
. The
value may be changed at any time within the above limits.
Origin: fig-Forth.
Source file: <src/kernel.z80s>.
window
window ( x0 y0 columns rows "name" -- )
Create a window called name: x0 y0 is the position of its top left corner on the screen, and columns rows is its size. Its cursor position is set to home.
Later execution of name will leave the address of its data on the stack, which is the following structure:
Byte offset | Description |
---|---|
+0 |
x cursor coordinate |
+1 |
y cursor coordinate |
+2 |
window left x coordinate on screen |
+3 |
window top y coordinate on screen |
+4 |
width in columns |
+5 |
heigth in rows |
See also: set-window
, current-window
.
Source file: <src/lib/display.window.fs>.
wipe-block
wipe-block ( column row width height color -- )
Wipe a screen block at the given character coordinates and of the given size in characters. The bitmap is erased and the color attributes are changed with the given color.
wipe-block
is written in assembler and it combines the
functions of clear-block
and color-block
. It may be
defined also this way (with slower but much smaller code):
: wipe-block ( column row width height color -- ) >r 2over 2over clear-block r> color-block ;
Source file: <src/lib/graphics.blocks.fs>.
within
within ( n1|u1 n2|u2 n3|u3 -- f )
Perform a comparison of a test value n1|u1 with a lower limit n2|u2 and an upper limit n3|u3, returning true if either (n2|u2 < n3|u3 and (n2|u2 ⇐ n1|u1 and n1|u1 < n3|u3)) or (n2|u2 > n3|u3 and (n2|u2 ⇐ n1|u1 or n1|u1 < n3|u3)) is true, returning false otherwise.
Origin: Forth-94 (CORE EXT), Forth-2012 (CORE EXT).
Source file: <src/lib/math.operators.1-cell.fs>.
word
word ( c "<chars>ccc<char>" -- ca )
Skip leading c character delimiters from the input
stream. Parse the next text characters from the input
stream, until a delimiter c is found, storing the packed
character string beginning at ca (which is the current
address returned by here
), as a counted string (the
character count in the first byte), and with one blank at
the end (not included in the count).
This word is obsolescent. Its function is superseeded by
parse
and parse-name
.
Note
|
The requirement to follow the string with a space is
obsolescent and was included in Forth-94 as a concession to
existing programs that use convert (superseded by
>number ). A program shall not depend on the existence of
the space. The requirement to follow the string with a
space was removed from Forth-2012.
|
Origin: Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/lib/parsing.fs>.
word-length-mask
word-length-mask ( -- b )
Constant that holds the bitmask b of the word length.
Source file: <src/kernel.z80s>.
wordlist
wordlist ( -- wid )
: wordlist ( — wid ) here wordlist, ;
See also: set-order
, vocabulary
.
Source file: <src/kernel.z80s>.
wordlist,
wordlist, ( -- )
Compile the contents of a new word list. The structure is the following:
+0 |
nt of the latest definition in the word list |
+2 |
wid of the previous word list, or zero |
+4 |
nt of the word list name, or zero |
Definition:
: wordlist, ( -- ) here 0 , latest-wordlist @ , latest-wordlist ! 0 , ;
See also: wordlist
, latest-wordlist
.
Source file: <src/kernel.z80s>.
wordlist-name!
wordlist-name! ( nt wid -- )
Store nt as the name associated to the word list identified by wid. nt is stored into the name field of the word-list metadata.
See also: wordlist
, wordlist-name@
, wordlist>name
.
Source file: <src/lib/word_lists.fs>.
wordlist-name@
wordlist-name@ ( wid -- nt|0 )
Fetch from the word-list identifier wid its associated name nt, or zero if the word list has no associated name.
See also: wordlist
, wordlist-name!
, wordlist>name
.
Source file: <src/lib/word_lists.fs>.
wordlist-of
wordlist-of ( "name" -- wid )
Return the word-list identifier wid associated to vocabulary name.
Origin: eForth’s widof
.
See also: wordlist
, vocabulary
.
Source file: <src/lib/word_lists.fs>.
wordlist-words
wordlist-words ( wid -- )
List the definition names in word list wid.
Source file: <src/lib/tool.list.words.fs>.
wordlist>link
wordlist>link ( wid -- a )
Return the link field address a of word-list identifier wid, which holds the word-list identifier of the previous word list defined in the system.
Source file: <src/lib/word_lists.fs>.
wordlist>name
wordlist>name ( wid -- a )
Return the address a which holds the nt of word-list identifier wid (or zero if the word list has no associated name).
See also: wordlist
, wordlist>link
.
Source file: <src/lib/word_lists.fs>.
wordlist>vocabulary
wordlist>vocabulary ( wid "name" -- )
Create a vocabulary name for the word list identified by wid.
See also: wordlist
, vocabulary
, latest>wordlist
,
wordlists
.
Source file: <src/lib/word_lists.fs>.
wordlists
wordlists ( -- )
List all wordlists defined in the system, either by name (if they have an associated name) or by number (its word list identifier, if they have no associated name). The word lists are listed in reverse chronological order: The first word list listed is the most recently defined.
See also: .wordlist
, wordlist
, latest-wordlist
.
Source file: <src/lib/tool.list.word_lists.fs>.
wordlists,
wordlists, ( -- )
Store the latest definition of every word list in the data space.
Source file: <src/lib/tool.marker.fs>.
words
words ( -- )
List the definition names in the first word list of the search order.
Origin: Forth-83 (Uncontrolled Reference Words), Forth-94 (TOOLS), Forth-2012 (TOOLS).
Source file: <src/lib/tool.list.words.fs>.
words#
words# ( -- n )
Return number n of words defined in the first word list of the search order.
Source file: <src/lib/tool.list.words.fs>.
words-like
words-like ( "name" -- )
List the definition names, from the first word list of the search order, that contain substring "name".
Source file: <src/lib/tool.list.words.fs>.
write-block
write-block ( n -- )
Write the buffer to disk block n.
Definition:
: write-block ( n -- ) write-mode transfer-block ;
See also: write-mode
, transfer-block
, read-block
,
block
.
Source file: <src/kernel.z80s>.
write-mode
write-mode ( -- )
Set the write mode for transfer-sector
and transfer-block
.
See also: read-mode
.
Source file: <src/kernel.gplusdos.z80s>.
x
x ( "ccc<eol>" -- )
Find and delete the next occurrence of the string "ccc".
Source file: <src/lib/editor.specforth.fs>.
x>
x> ( -- x ) ( X: x -- )
Move x from the current xstack
to the data stack.
Source file: <src/lib/data.xstack.fs>.
x>gx
x>gx ( x -- gx )
Convert column x to graphic x coordinate gx.
Source file: <src/lib/graphics.pixels.fs>.
x@
x@ ( -- x ) ( X: x -- x )
Copy x from the current xstack
to the data stack.
Source file: <src/lib/data.xstack.fs>.
xdepth
xdepth ( -- n )
n is the number of single-cells values contained in the
current xstack
.
Source file: <src/lib/data.xstack.fs>.
xdup
xdup ( X: x -- x x )
Duplicate x in the current xstack
.
See also: 2xdup
.
Source file: <src/lib/data.xstack.fs>.
xfree
xfree ( -- )
Free the space used by the current xstack
, which was
created by allocate-xstack
.
Source file: <src/lib/data.xstack.fs>.
xkey
xkey ( -- c )
Show a cursor, wait for the next terminal key struck; if it’s the caps lock key, toggle caps and keep waiting; else leave the char code of the key struck.
Source file: <src/kernel.z80s>.
xlen
xlen ( -- n )
n is the length of the current xstack
, in address units.
See also: xdepth
.
Source file: <src/lib/data.xstack.fs>.
xor
xor ( x1 x2 -- x3 )
x3 is the bit-by-bit exclusive-or of x1 with x2.
Origin: fig-Forth, Forth-79 (Required Word Set), Forth-83 (Required Word Set), Forth-94 (CORE), Forth-2012 (CORE).
Source file: <src/kernel.z80s>.
xover
xover ( X: x1 x2 -- x1 x2 x1 )
Place a copy of x1 on top of the xstack
.
Source file: <src/lib/data.xstack.fs>.
xp
xp ( -- a )
A variable. Address a holds the address of the current
xstack
pointer.
Source file: <src/lib/data.xstack.fs>.
xp0
xp0 ( -- a )
Initial address of the current xstack
pointer.
Source file: <src/lib/data.xstack.fs>.
xpick
xpick ( u -- x'u ) ( X: x'u ... x'0 -- x'u ... x'0 )
Remove u. Copy x’u from the current xstack
to the
data stack.
Source file: <src/lib/data.xstack.fs>.
xsize
xsize ( -- n )
Size of the current xstack
in address units.
Source file: <src/lib/data.xstack.fs>.
xstack
xstack ( a -- )
Make the extra stack a the current one. a is the
address returned by allot-xstack
or allocate-xstack
when the extra stack was created.
Extra stacks grow towards high memory. a is the address of a table that contains the metadata of the xstack, which is the following:
+0 = initial value of the stack pointer (1 cell below the stack space) +2 = stack pointer +4 = maximum size in address units
Source file: <src/lib/data.xstack.fs>.
xt-replaces
xt-replaces ( xt ca len -- )
Set xt (whose execution returns the address and length of a string) as the text to substitute for the substitution named by ca len. If the substitution does not exist it is created.
The name of a substitution should not contain the "%" delimiter character.
See also: replaces
, substitute
, unescape
,
substitute-wordlist
.
Source file: <src/lib/strings.xt-replaces.fs>.
xt-substitution
xt-substitution ( ca len -- a )
Given a string ca len create its substitution and storage space. Return the address that will hold the execution token of the substitution.
See also: xt-replaces
.
Source file: <src/lib/strings.xt-replaces.fs>.
xy
xy ( -- col row )
Return the current column and row of the text cursor.
xy
is a deferred word whose default action is mode-32-xy
.
See also: at-xy
.
Source file: <src/kernel.z80s>.
xy>attr
xy>attr ( col row -- b )
Return the color attribute b of the given cursor coordinates col row.
Source file: <src/lib/display.cursor.fs>.
xy>attra
xy>attra ( col row -- a )
Return the color attribute address a of the given cursor coordinates col row.
Source file: <src/lib/display.cursor.fs>.
xy>attra_
xy>attra_ ( -- a )
Return the address a of a Z80 routine that calculates the attribute address of a cursor position. This is a modified version of the ROM routine at 0x2583.
Input:
-
D = column (0..31) - E = row (0..23)
Output:
-
HL = address of the attribute in the screen
Source file: <src/lib/display.cursor.fs>.
xy>gxy
xy>gxy ( x y -- gx gy )
Convert cursor coordinates x y to graphic coordinates gx gy. x is 0..31, y is 0..23, gx is 0..255 and gy is 0..191.
Source file: <src/lib/display.cursor.fs>.
xy>gxy176
xy>gxy176 ( x y -- gx gy )
Convert cursor coordinates x y to graphic coordinates gx gy (as used by Sinclair BASIC, i.e. the lower 16 pixel rows are not used). x is 0..31, y is 0..23, gx is 0..255 and gy is 0..175.
xy>gxy176
is provided to make it easier to adapt
Sinclair BASIC programs.
See also: xy>gxy
, plot176
, set-pixel176
.
Source file: <src/lib/display.cursor.fs>.
xy>r
xy>r ( -- ) ( R: -- col row )
Save the current cursor coordinates to the return stack.
Source file: <src/lib/display.cursor.fs>.
xy>scra
xy>scra ( x y -- a )
Convert cursor coordinates x y to their correspondent screen address a.
Source file: <src/lib/display.cursor.fs>.
xy>scra_
xy>scra_ ( -- a )
Return address a of a Z80 routine that calculates the screen address correspondent to given cursor coordinates.
Input registers:
-
B = y coordinate (0..23)
-
C = x coordinate (0..31)
Output registers:
-
DE = screen address
Source file: <src/lib/display.cursor.fs>.
y>gy
y>gy ( y -- gy )
Convert row y to graphic y coordinate gy.
Source file: <src/lib/graphics.pixels.fs>.
yellow
yellow ( -- b )
A constant that returns 6, the value that represents the yellow color.
Source file: <src/lib/display.attributes.fs>.
}
} ( a1 n -- a2 )
If in range, return address a2 of the n item of the 1-cell array a1. Otherwise throw error #-272 (array index out of range).
See also: 1array
, array>items
.
Source file: <src/lib/data.array.noble.fs>.
}bench
}bench ( -- d ) frames@ ;
Return the current value of the system frames counter.
Source file: <src/lib/time.fs>.
}private
}private ( -- )
End private definitions. See privatize
for a usage
example.
Source file: <src/lib/modules.privatize.fs>.
}}
}} ( a1 n1 n2 -- a2 )
Return address a2 of the n1,n2 item of the 2-dimension array a1. Data stored row-wise.
See also: 2array
.
Source file: <src/lib/data.array.noble.fs>.
~~
~~ ( -- )
Compile debugging code.
~~
is an immediate
and compile-only
word.
Origin: Gforth.
See also: (~~)
, ~~?
, ~~y
, ~~quit-key
, ~~resume-key
,
~~info
, ~~app-info
, ~~control
~~save
, ~~restore
.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~?
~~? ( -- a )
A variable that holds a flag. When the flag is true, the
debugging code compiled by ~~
is executed, else ignored.
Its default value is true.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~app-info
~~app-info ( -- )
A deferred word that can be used by the application in
order to show application-specific debugging information as
part of the debugging code compiled by ~~
. By default it
does nothing.
See also: ~~info
.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~control
~~control ( -- )
Keyboard control used by the debug points compiled by ~~
:
If the contents of ~~quit-key
and ~~resume-key
are zero
do nothing, else wait for a key press in an endless loop:
If the pressed key equals the contents of ~~quit-key
,
then execute quit
; if the pressed key equals the contents
of ~~resume-key
, then exit.
See also: ~~control?
, ~~press?
.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~control?
~~control? ( -- f )
Is there any key to be checked by ~~control
?
~~control??
is part of the ~~
tool.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~info
~~info ( -- )
Show the debugging info compiled by ~~
and the current
contents of the data stack. At least to lines are used,
depending on the contents of the stack. The first line
shows the block, line and definition name where ~~
was compiled; the second line shows the contents of the
stack. The printing position can be configured with
~~y
.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~press?
~~press? ( c ca -- f )
Is the character stored at ca not zero and equal to c?
This is a factor of ~~control
used to check key presses,
in the code compiled by ~~
.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~quit-key
~~quit-key ( -- ca )
A character variable that holds the key code used to quit
at the debugging points compiled by ~~
. If its value is
not zero, ~~control
will wait for a key press in order to
quit the debugging. Its default value is the code of 'q'.
See also: ~~resume-key
.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~restore
~~restore ( -- )
Restore system status after executing the debugging code
compiled by ~~
. This is a deferred word. Its default
action is to restore the cursor coordinates.
See also: ~~save
, ~~restore-xy
.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~restore-xy
~~restore-xy ( -- )
Restore the cursor coordinates. This is the default
action of ~~restore
.
~~restore-xy
is part of the ~~
tool.
See also: ~~save-xy
, ~~save
, ~~xy-backup
.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~resume-key
~~resume-key ( -- ca )
A character variable that holds the key code used to resume
execution at the debugging points compiled by ~~
. If
~~resume-key
contains zero, ~~control
will not wait
for a key. If ~~resume-key
contains $FF, ~~control
will wait for any key. Otherwise ~~control
will wait for
the key stored at ~~resume-key
, whose default value is
bl
, the code of the space character.
See also: ~~quit-key
.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~save
~~save ( -- )
Save system status before executing the debugging code
compiled by ~~
.. This is a deferred word. Its default
action is to save the cursor coordinates.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~save-xy
~~save-xy ( -- )
Save the cursor coordinates. This is the default
action of ~~save
.
~~save-xy
is part of the ~~
tool.
See also: ~~restore-xy
, ~~restore
, ~~xy-backup
.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~xy-backup
~~xy-backup ( -- a )
A double variable that holds cursor coordinates saved and
restored by the default actions of ~~save
and
~~restore
.
~~xy-backup
is part of the ~~
tool.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.
~~y
~~y ( -- ca )
A character variable that holds the row the debugging
information compiled by ~~
will be printed at. Its
default value is zero.
Source file: <src/lib/tool.debug.tilde-tilde.fs>.