Information about BIF as of April 2019.
Author: Joel Matthew Rees, Amagasaki, Hyogo, Japan.
joel.rees+knock at gmail dot com
Copyright from 2000 to 2019 Joel Matthew Rees
(The following can be found in its original form in the bif-c
repositories. bif-c is buggy, by the way.)
BIF was a dialect of the early fig-standard FORTH. It was a student
project, not a commercial product, and no warranty has ever been made
concerning it, whatsoever. It was written on the Color Computer 2 in
6809 assembler; the assembler used was disk EDTASM+. It also ran on
the Color Computer 3, with the expected limitations of requiring the
32 column screen, etc.
License information -- the rights to BIF and the materials with it,
and restrictions on distribution -- are described in the file
BIFDOC.TXT, which really should distributed with the source along with
The short version of the licensing information is that I am distributing
BIF6809 under the essential terms of the Internet Systems Consortium
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
accompanying copyright notices and this permission notice appear in
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHORS DISCLAIM ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
I add here the stipulation that I claim right to the word "BIF" as
the name of a programming language.
If you are going to distribute or redistribute the obect or source of
bif in any of its forms, it really makes no sense at all to fail to
include either the BIFDOC.TXT file and this README.TXT file.
In the present world, it also makes no sense to fail to include the
source code, or at least a link to a known good repository -- such as
If you do something like that and you or anyone that gets the
resulting distribution has problems with it, and somebody comes
to me looking for help, expect to be teased mercilessly about it.
And expect to be on the bottom of my priority list, not out of
spite, out of self-protection.
I have reconstructed something approximating my source disks (using the
great emulator, xroar: https://www.6809.org.uk/xroar/ and the imgtool
distributed with MAME, along with the *nix tools). Some useful commands
are noted in commands.txt.
The name of the disk image is (appropriately?) bifsource.dsk. It can be
directly attached by xroar's disk emulator tools, and should be similarly
useable with VCC, MAME, etc. al.
The assembler source files are readable by the a variety of text editors,
that respond flexibly about line termination. But if you try editing them
with a normal editor and then assembling the result with EDTASM+, be very
careful about line termination. Be prepared to use *nix command line tools
like tr, cut, sed/awk, perl, etc.
The source files retain the original line numbers as used by EDTASM+,
which is why you will want the *nix tools. But I have included source to a
short C program, stripln.c, which strips the line numbers. This program
may also be useful for converting line endings, if that is necessary. Look
for it in the junkbox directory, and be prepared to compile it.
If you are under the burden of using Microsoft OSses, the Cygwin project
should be of quite a bit of assistance, including the *nix command line
tools and gcc and clang, etc.
Macros are used in the source, but shouldn't cause too much confusion
to a programmer with assembler experience. If anyone is brave enough
to try to port it, key routines will be EMIT, KEY, ?TERMINAL, CR, R/W,
and several routines in the EDITOR vocabulary where I used direct
video I/O out of laziness.
BIF might be useful for experimentation and for learning about FORTH,
for someone who has access to a Color Computer or an emulator. The
executable file may be run on the Color Computer by LOADMing it via
Color Computer Disk BASIC. (More details in BIFDOC.TXT.)
It is assembled to be EXECed at hexadecimal 1300 (&H1300).
One specific warning must be given:
DO NOT ATTEMPT TO ACCESS ORDINARY DISKS FORMATTED FOR USE BY OTHER
OPERATING SYSTEMS WHILE BIF IS RUNNING! Because of disk buffering, it
will be difficult to avoid unintentional writes to the disk.
If you do try looking at an OS-9 or Color Computer DOS (etc.) disk with
BIF, don't blame me if you destroy the directory and/or other valuable
I tried a re-write in C (bif-c), but it's not working well. Issues with
file systems (no real file system in BIF) and the current standardization
committees ideas about what is meaningful code, problems with my own
attention span, etc. keep it full of bugs. And I used a number of neat
tricks that get in the way in C.
One thing I want to retain is the use of nested binary trees in the
Incidentally, said re-write has been in process for over thirty years.
Real life keeps getting in the way.
I am including source to a Q&D C program, 32col.c, which will re-format
files extracted from BIF disks for normal text editors. Mac-isms and
Codwarrior-isms can probably be discerned by comparing it with stripln.c,
When I brought the BIF high-level source with me, I used some feature of
Color Computer BASIC and BIF that I have forgotten to dump some of the
Forth style screen listings.
The program stripln can be used to strip line numbers from such screen
listings, as well.
I really should put in more work on the tools for converting between
normal text files and Forth/BIF screens, but those projects aren't even
on my back burners any more. Maybe later. In the meantime, you're
welcome to take a crack at it.
The documentation is ASCII text, with CR/LF line termination, and should
be examined carefully by anyone considering a port. Bear in mind that
it was written toward Color Computer users.
I apologize for not alphabetizing the FORTH words by name. I did it once
with a C program, but got too ambitious and lost the results in the
process of trying to split it up into modules. I haven't had enough time
to finish the modularization, yet, either. (Getting an iBook so I could
work on the train just gave me more things to do on the train.)
There are four subdirectories at this point:
* junkbox --
Various tools I've used. Most are one-time tools that might be useful
again in a similar situation.
* edtasm_v --
This is where I'm recreating what I used at college, to use as a baseline
in further projects. The code here can be assembled by the disk-based
Put the EDTASM+ disk (image) in the 1st drive (Coco drive 0) and the
source code disk (image) in the 2nd (Coco drive 1). Assemble with
AD BIF6809X.BIN:1 /WE
to save the binary in BIF6809X on the 2nd drive (Coco drive 1) and
wait for errors so you can see what happened before it scrolls off
I've essentially frozen my work on this version, to provide a point
of reference if someone wants to port BIF-6809 to a non-Coco machine.
See BIFDOC.TXT for further information about use.
* cross_v --
I have been using the lwtools assembler and the MAME imgtool utility
as the basis of a cross-assembly environment. (See the commands.txt
file for clues.) At this point, assembly is successful, and execution
succeeds to the point of being able to load the post-fix assembler
which I put together for college, which resides in the tools.dsk image.
This code is essentially a mirror of edtasm_v, with source code changes
that allow assembly using the lwtools assembler, and line endings
friendly to *nix tools.
Again, see BIFDOC.TXT for further information about use.
Now that I have the baseline sort-of re-established, and am able
to compile the post-fix assembler and other tools, I'll use the
cross-development tools to reorganize and restructure the code
to make it more generally useful.
That work will start in reorg_v.
* Top-level directory, ./ :
general explanations, including descriptions of every word.
*nix command lines that I want to remember. May be useful.
* edtasm_v/ and cross_v/ :
structure of the per-user variable page.
macros, including the inner interpreter (basis of the virtual machine),
the dictionary (symbol table) structure offsets,
and invocations for the fundamental objects.
things kept in the direct page,
including the behaviours for the fundamental objects (was not a good idea after all),
and the index to the per user variable page.
cold and warm boot routines and the initial value table for the per-user variable page.
the main source file (includes other parts),
basic expression evaluation, more of the inner interpreter,
basic vocabulary access, basic symbol parsing.
basic I/O, more of the inner interpreter, extended expression evaluation,
the rest of the basic symbol table access.
data movers, common expression evaluation,
stack pointer access, more of the inner interpreter,
common expression evaluation, extended expression evaluation,
innards of the high-level compiler, more of the high-level compiler,
more common expression evaluation, common constants,
I/O constants, character typing constants,
symbol table globals, compiler globals, parser globals, I/O globals.
compiler globals, more high-level compiler,
more common expression evaluation, formatted output.
more basic symbol table, symbol table, more compiler, more formatted output,
more data movers, more low-level parser (formatted input), more I/O,
more extended expression evaluation, more expression evaluation,
more compiler directives, an extension to the inner interpreter.
more formatted output, more innards of the high-level compiler,
more high-level compiler.
more innards of the expression evaluator, more common expression evaluation,
more I/O (buffer handling).
more high-level compiler, more compiler directive.
more innards of the high-level compiler, more I/O (buffering),
disk access, error handling, more formatted output.
more error handling, screen-based sector (character) editor.
more parser (formatted input), I/O (terminal), compiler (input),
symbol table (lookup).
symbol table, compiler innards, null vector test,
more screen-based sector editor.
compiler, formatted output, compiler directives
error handling, symbol tables, compiler directives.
The Color Computer Disk Extended BASIC format disk image with
the above assembly language source files readable under EDTASM+ .
Under cross_v, the only interesting file in bifsource.dsk is the
object file, BIF6809.BIN, which is the output of the lwtools
assembler. I'm reusing the disk image from edtasm_v for my own
The startup disk for the FORTH/BIF system.
You basically want this disk (image) in your first drive whenever
bif-6809 is running.
Important contents include the following:
SCREEN 0: Human readable index. (Forth had no file system of its own.)
SCREEN 4: Human readable error message text.
SCREEN 6: Basic disk SCREEN (sector, for Coco) listing and editing tools.
SCREEN 16: Post-fix assembler.
Once you get used to it, you can copy the error messages in
SCREEN 4 of the tools.dsk (image) to a fresh disk (image) and
use it instead. (And you'll probably want SCREENs 6-15, as well.)
blank.dsk (not present)
You can make blank, unformatted disk images with a *nix command
dd if=/dev/zero of=blank.dsk bs=256 count=630
C language source and Macintosh executables for stripping line
numbers and reformatting 32 column source code "screens". The two
XXX.GXX.out files below are output of the 32col program.
FORTH source for disk listing, screen handling, definition dumping,
sector copying, forward referencing, buffer maintenance,
experimenting with hardware, double (32 bit) integer math, etc.,
and a post-fix assembler.
This is how I brought the contents of the tools.dsk image with
me. Probably not useful to anyone except me.
a "database" example from one of my FORTH books. Might be
interesting for those wondering how the dictionary (symbol
Contains the tools output readable in regular text editor format
and the error messages, with their corresponding number in
hexadecimal. I should make a separate file for the error messages
This may be useful for understanding the contents of tools.dsk .
One way to do arrays. Probably not useful for anyone except me.
Some random math. Probably not useful for anyone except me.
A test suite. Probably not useful for anyone except me.