Comments to Howerd Oakford
Windows Sockets Forth code : wsa.f updated with HTTP POST test code and FTP, 2016 Dec 21
Full assembler source files, NASM assembler, colorForth source and batch file to create the colorForth image, and run it in the bochs emulator.
Real colorForth running on (just about) any Windows PC.
Double left click ( run ) go.bat to start the cf2012.blk version of colorForth in a bochs PC emulator.
bochs is available from http://bochs.sourceforge.net/
bochs is truly wonderful! Thank you to all the bochs developers...
\ 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 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 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 Howerd Oakford 2014 Oct 23
\ 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...
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>
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 - its 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 :-)
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...
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.
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…
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 2012 Apr 11
\ CRC-16 for HDLC calculation using a table
\ 16 bit FCS lookup table per RFC1331
\ Thanks to :
\ 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 )
The ‘H’ is for Howerd, although I have kept as much of the original V6.05 as possible.
This version of Win32Forth runs under Windows7 ( Ultimate 64 bit ) and does not offend my anti-virus program.
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…
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
My thoughts on Forth
My EuroForth papers collected together here :
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
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...
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.