­­Inventio Software Techie Page

 Lots of Forth based stuff, mostly for Windows… Enjoy!

Comments to Howerd Oakford

Latest News!     2021 Aug 15

colorForth is a minimalistic operating system for an x86 PC

colorForth is a simple dialect of Forth created by the inventor of Forth, Chuck Moore.

cf2019 is a distribution that runs on a Windows PC in bochs, or natively from a USB drive.


Download colorForth system packaged with bochs :  cf2019 Issue 2021Aug15.7z 


or as self-extracting zip file cf2019 Issue 2021Aug15.exe.


Unzip and double click go.bat to run the cf2019.img image in the bochs PC emulator.


Documentation : cf2019_colorForth.pdf

The latest version is available here : https://www.inventio.co.uk/colorforth



Older versions :

cf2019 uses BIOS calls to access the USB drive, so it is no longer necessary to have a floppy disk drive to run natively!

Full assembler source file, NASM assembler, colorForth source and batch files to create the colorForth image, and run it in the bochs emulator.

Real colorForth running on (just about) any Windows PC.

bochs is available from http://bochs.sourceforge.net/    Thank you to all the bochs developers...

Download the zip file here  cf2019_Issue_2019Apr04.zip  and

self-extracting zip file here cf2019_Issue_2019Apr04.exe

Legacy – requires a floppy disc drive to run natively :

cf2012bochs colorForth system packaged with Bochs

Download the zip file here  cf2012bochs2012Oct21release.zip  and self-extracting zip file here cf2012bochs2012Oct21release.exe

ASN1DER parser ASN1DER_Issue_2021Aug11.7z for SwiftForth

ASN1DER.f  ASN.1 Abstract Syntax Notation version 1 Distinguished Encoding Rules

Parse an X.509 Certificate that uses ASN.1 Abstract Syntax Notation version 1 and DER Distinguished Encoding Rules  

Converts the abstract syntax from an ASN1 format file to some C files.

This might help if you need to visualise ASN1 files.

Originally from 2015 I am currently working with ASN1 definition files that specify the structure of JSON schema files, which specify the structure of JSON files. So I tidied it up and posted it here, in case it is useful for others too :-)

The folder ASN1DER contains a Windows batch file “GetSupportFiles.bat” that  copies the required Forth files from the folder ..\Common.

These common files are mostly available from this page – they are collected together for your convenience here : Common_Issue_2021Aug11.7z 


Cweed Now packaged with Win32ForthV6.05H, with support for C++, Lint and with Folder Scan, and works under Windows7/8/10 Also NumName human readable hash values…

Cweed is a C source file weeder written in Win32Forth.

It only changes whitespace (formatting) and does not otherwise change the content of the file.

This is analogous to weeding a garden, where the plants are left untouched but the bits between may be seriously modified.

Cweed is an experiment in specifying a coding standard in the form of an executable program.

Code prettifier for C and header files. Converts tabs to spaces, re-formats, checks for Lint errors.

Creates a folder report listing files and their formatting health status.

Shows the CRC32 and MD5 hashes for each file.

Lots more features too...


Win32Forth6v05H 2019 Mar 02

Win32Forth6v05H.7z ( and Win32Forth6v05H.zip zip version ) , the Win32Forth system used to create win32for.exe, as supplied in the Cweed packages.

The ‘H’ is for Howerd, although I have kept as much of the original V6.05 as possible.

This version of Win32Forth runs under Windows 7 and 10 and does not trigger my anti-virus program.

It also includes bug-fixes from Rod Oakford ( including one in the ExtSources kernel that made a zero sized window when running on a new computer )  - thanks!

I have kept the original help file by Tom Zimmer et al. but moved it to load from the local directory without having to have the source tree present.

This means that it works with the Cweed package. I merged changes in the OS detection words from V6.14 so that it recognises Windows 7, 8 and 10.

I have also added some aliases such as  

loc  for  locate , to locate a word’s source,

\\  for  \S  to end compilation of a file

and some new words :

g  to invoke the editor, and  

tt  that,  if you are in directory Cweed,  will load file Cweed.f

Show{   which compiles the text following it until End} like .” , and

zCompile{   which compiles the text following it until End} as a null terminated string.

Useful for helptext.  Type  loc Show{  to view the source code, and  g  to open the editor.

There is a readme.txt file to get you started – just unzip and run Win32For.exe .

Software Algorithms - ANS Forth for 32 bit PC Forths, mathematical, CRCs, Hashes, also Windows Sockets API wsa.f , I hope you find them useful!

Now with AES , SHA-256 , Average and an updated WSA interface :

average.f    average.zip

\ Average.f  2014 Nov 07  Running averaging of n data readings.   Howerd Oakford  www.inventio.co.uk

\ Uses a buffer size that is a power of 2 for efficiency

\ Calculates a running total by adding the current reading and subtracting the

\ n'th reading, so looping over many values is not required - see UpdatePulses

\ You can extract averages over a different period of time from the same average buffer.

\ For SwiftForth - www.forth.com - a 32 bit ANS Forth for the PC

\ include Average.f  ttAv    \ will show a demo using the MiniScope ASCII display


aes.f    aes.zip

\ aes.f  by Jabari Zakiya - thanks! With new API added by Howerd Oakford

\ Use of this code is free subject to acknowledgment of copyright.

\ Copyright (c) 2001 Jabari Zakiya, -- jzakiya at gmail dot com, 2001/5/26

\ Revised: 2014/10/13

\ ANS FORTH code to implement the Advanced Encryption Standard (AES).


SHA-256.f    SHA-256.zip

\ SHA-256.f Secure Hash Algorithm SHA-256 Howerd Oakford 2012 Nov 21

\ For SwiftForth 32 bit Little Endian ANS Forth, with Round functions coded in SwiftForth x86 assembler


wsa.f    wsa.zip

\ wsa.f  Howerd Oakford  2017 Dec 25

\ WinSock - Windows Sockets API ( Berkeley-like interface ) for SwiftForth ANS Forth.

\ A simple TCP/IP server and client and an HTTP client interface.

\ The Server simply echoes back what you send it, seen in blue on the Client.

\ Add your own code to process commands for HTTP or another service at this point...


USBclarify.zip  V1.0 2014 May 14 - SwiftForth source and zipped executable to display information about USB devices as they are plugged into your Windows computer

Unzip all the files from USBclarify.zip into a folder, irun SwiftForth and in the SwiftForth console use cd c:\yourfolderpath and type include USBclarify.f , or click on | File | Include | and select the file USBclarify.f , then type USBclarify <cr>

Displays the COM port assigned to a USB serial device when it is plugged in.

Still not the best code in the world, but mature and useful enough to leave home…

USBclarifyFull.f   this file includes MD5.f and usb.ids in-line – open it in your browser, ctrlA ctrlC then paste it into a SwiftForth console with ctrlV, wait half a minute then type USBclarify <cr>

Just for fun, to see how it can be done - it’s one big file, so please be patient :-)

USBclarify.f   V1.0 2014 May 14 Howerd Oakford  www.inventio.co.uk

 Displays when a USB device is connected and disconnected, including which COM port a USB serial device is assigned to

Demonstrates how to use Windows device notifications

Defines HID and other constants and structures, including support for GUIDs

Compile using SwiftForth, available from www.forth.com

The file usb.ids from http://www.linux-usb.org/usb.ids must be in the local folder in order to compile this program.

Thank you to the Linux guys for making this information available :-)


The USBloader system is designed to make it easy to make any USB disk drive bootable.

This allows you to run your choice of operating system on your computer, from a USB drive.

Program execution is in Real Mode on an 80x86 PC, 80386 32 bit or higher is required.

USBloader supersedes USBboot which is no longer supported.

Download  : USBloader2013Apr08release.exe  self extracting zip file or  USBloader2013Apr08release.zip zip file.

Disclaimer : using USBloader.exe to make a USB drive bootable should not affect the other files on the drive.

Use it at your own risk, and backup up everything on your drive, or use a brand new one, just in case…

Now with new Floppy Disk Formatting features : press ctrlF4 to convert the cfUSB.img file into a floppy disk image and copy it to the inserted drive.

This can be either a USB floppy disk drive or USB drive, in either case the disk will be re-formatted and all data will be lost.

There are two warnings before this happens…

More info : USBloader 2013 Apr 08

Includes a FAT32 file system boot loader written in NASM assembler 

 Corrected two typos in the HDLC CRC16 calculation in Forth and added two new CRC16 calculations :

crc16hdlc.f        crc16.zip ( the zip file now contains all three CRC16 files )

\ *****************************************************************************

\ crc16hdlc.f  2012 Apr 11

\ CRC-16 for HDLC calculation using a table

\ 16 bit FCS lookup table per RFC1331

\ Thanks to :

\ http://www.mavi1.org/web_security/cryptography/hashes/crc/crc-16-hdlc.c

\ Note that this code defines "#define FCSGOOD 0xF0B8"

\ whereas I define "$0F47 constant CRC_VALID"  which is bitwise inverted.

\ This is because CRC16 returns the actual value to be sent in an HDLC packet

\ Also note that at least one online CRC calculator does not include this CRC.

\ *****************************************************************************

crc16modbus.f   as above for ModBus

crc16-a.f   as above for ISO10373 and ISO14443 type A (and B )

New Forth book online : Chuck Moore, the inventor of the Forth programming language has published his book from 1970 online.

It gives a fascinating insight into the rationale behind Forth : PROGRAMMING A PROBLEM-ORIENTED-LANGUAGE, Charles H. Moore



My thoughts on Forth

My EuroForth papers collected together here :

2003 The colorForth Magenta Variable an emergent property of a new programming environment

2003 Three Forths Make a Hole how Forth made the extremely difficult happen

2001 colorForth and the Art of the Impossible  the title says it all

2000 The Point to Point Protocol in Forth Hayes, PPP, IP, UDP, IPCP for 16 bit micros

1998 Multiple Language Programs Made Easy what you can do with a simple compiler

1997 Forth : Past, Present and Future an attempt to understand Forth

Forth and Not C  (why you shouldn't use Forth ;)

Forth Versus C (why you should use Forth ;)     

Token-based Programming for Compact Code  getting the most out of the Atmel 89C2051

Some of my software tools - I hope they are useful...

Software Algorithms - ANS Forth for 32 bit PC Forths, mostly mathematical, CRCs, Hashes, also Windows Sockets API wsa.f , I hope you find them useful!

PCIdev PCI device viewer. Even works under WinXP/2K/NT (with some help!)  This program may be of special interest to potential colorForth users to debug troublesome hardware...

PPP.com is a DOS based program to analyse, display and create PPP and Internet protocols. PPP.com is the current evolution of a general purpose scripting environment, adapted to the Point to Point Protocol. Currently it can open a PPP connection to an ISP and send DNS, ICMP, UDP or TCP packets to any IP address on the Internet. PPP.com has not been optimised for program size, as it is a 16 bit Forth program, and nearly fills up the maximum 63K bytes allowed for a .com program. This includes 4K of help text, roughly 3K of protocol descriptor text, an editor, 8086 assembler and Forth compiler. It supports five tasks, two of which monitor PPP and IP packets on each of COM1 and COM2 serial ports. It is programmed in a 16 bit DOS 8086 Forth to allow easy porting to 8 or 16 bit embedded processors.

Cweed is a C source file weeded and scanner. It only changes whitespace (formatting) and does not otherwise change the content of the file. This is analogous to weeding a garden, where the plants are left untouched but the bits between may be seriously modified. Cweed is an experiment in specifying a coding standard in the form of an executable program. Cweed is also useful for scanning a file for control characters, removing tabs, or just viewing what is actually there, not processed and formatted by an editor.

cfdos is a DOS program to display colorForth pre-parsed source blocks. This program will work on any computer that runs or emulates DOS, and allows you to view colorForth source, in both normal and "colour blind" mode. It features a file listing utility (F6) which displays all files of type *.BLK in the same directory, and can copy them to a formatted floppy disk. colorForth Explorer Edition is the latest colorForth stand-alone operating system, packaged together with a Windows/DOS program to display colorForth source and create bootable floppy disks.

Don't be deceived by the fact that colorForth boots from a floppy - this is an experimental state-of-the-art operating system for a PC.

See The colorForth Magenta Variable and colorForth and the Art of the Impossible  my first impressions of colorForth


Thanks to Bert Greevenbosch for J.S.Bach's Inventio No.8 and Inventio No.13.