Dec 082017
F-PC 3.5xx Forth tools. Tool 2 of 8. Includes Bach sound, abacus calculator, and others by Dr. Ting.
File TING.ZIP from The Programmer’s Corner in
Category Forth Source Code
F-PC 3.5xx Forth tools. Tool 2 of 8. Includes Bach sound, abacus calculator, and others by Dr. Ting.
File Name File Size Zip Size Zip Type
ABACUS.BAT 20 20 stored
ABACUS.SEQ 145 101 deflated
ABACUS1.SEQ 2408 969 deflated
ABACUS2.SEQ 4027 1179 deflated
CANON.SEQ 4169 1070 deflated
CLOCK.SEQ 2814 1006 deflated
COPYFILE.SEQ 2587 870 deflated
COREDUMP.SEQ 4131 1326 deflated
DOWNLOAD.SEQ 5490 1635 deflated
INTERRUP.SEQ 5303 1957 deflated
MULTI.SEQ 9561 3228 deflated
SEMICODE.SEQ 2671 976 deflated
SORT.SEQ 5371 1831 deflated
STEPS.SEQ 2481 1049 deflated
TING.TXT 5048 2143 deflated
TONE.SEQ 5275 1776 deflated

Download File TING.ZIP Here

Contents of the TING.TXT file

The following files are contributions from Dr. C. H. Ting.


Type ABACUS under DOS and the batch file will load a
calculator program into F-PC. You can use the arrow keys to
select a floating point function. Pressing INS key executes
the selected function. In teh meantime, you have a command
window so you can enter F-PC commands.

Under F-PC, type FLOAD ABACUS to load the calculator. SFLOAT
package by Bob Smith is required to provide floating point

Play a few tunes on the PC. Load it and type
CANON1 to CANON18 to play these tunes.


Using the DOC 1CH interrupt service to generate a timer
display one the screen as a background task. The clock is
updated at about 2 Hz.


Set up an input file handle and an output file handle. Read
one line from the input file and write it to the output file
until the end of the input file. This seems to be a trvial
application. However, lots of processing can be done on the
lines before they are written out. They are left to your
imagination in the deferred word WORK.


Print the most significant bit of a 64K byte array in a
memory segment on the printer as a 256 by 256 image. The
bitplane suitable for dumping is constructed in an 8K byte
buffer above PAD. The segment address is stored in the
variable DUMPSEG. Other bits in the image array can be
rotated to the MSB biplane, or the image data can be
processed through a lookup table to extract a printable


A limited IBM graphic character set is downloaded to Epson
printer so that boxes can be printed in a form similar to
that displayed on the monochrome screen. This set covers the
single and double line characters from 176 to 207. IBM
characters using control codes are not supported.

Additional commands are also defined to control the operation
of Epson. The control code can be assumed to be quite
universal for printers made by Japanese manufacturers.
However, there are difference among the printers.


?INTERRUPT returns the address of the current interrupt
service routine. INSTALL-INTERRUPT writes the address and
code segment of the new service routine into the vector table
to handle the desired interrupt. The syntax is as follows:


An interrupt service can be removed by the word


An example of using F-PC multitasker. 10 background tasks
are declared. 9 tasks each handles a voice and the 10th
tasks serrves as the conductor, keeping time and
synchronization. It is used to play multi-voice canons by J.
S. Bach. Need 9 speakers that most of us don't have.


CASE: is F83 is a very elegant way of constructing case
structures. It uses the regular colon compiler, so there is
zero overhead in compiler code. The EXEC: in FPC is very
close in functionality and thus CASE: can be defined using
the code portion of EXEC:. Some other examples are given in
F-PC defining words.


Binary radix sort. It sorts a list of 1024 16 bit numbers
by distributing the numbers to two heaps according to one bit
in the numbers. Repeating this distribution process 16 times
starting at the least significant bit to the most significant
bit and collating the heaps will sort the array. Simple
and quite fast.


This is based on Jay Malvin's talk at Maxtor Forth Seminar,
June 7, 1988. He implemented a function which allows a word
in a colon definition to exit, or skip the rest of the words
in the colon definition, by a flag generated at runtime.
This method can be generalized to provide a powerful
mechanism to change the execution sequence in a colon

The basic technique is to manipulate the top element on the
return stack. If it is droped, you exit from the colon
definition. If you increment it by two, you will skip the
next word. If you decrement it by four, then you will
re-execute the previous word, creating an implicit loop


This program is needed by CANON, which sets up the PC speaker
as an electronic organ to play Bach's canons. Since AT or PC has
only one speaker, only one channel of sound generator is
defined. CANON gives you something you can play on a PC
without other hardware equipment.

 December 8, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>