386-PROLOG - The First Quarter Century
On 2nd November 1989, the very first lines of 386 Assembler code were written by Brian D Steel, on a brand new product that he decided to call, "386-PROLOG". At that time, employed as LPA's senior programmer for MS-DOS products, he had been working on "PROLOG Professional", the final and most advanced version of the iconic "micro-PROLOG", that had seen service on everything from CP/M computers and the Sinclair Spectrum, to the Apple II and BBC Micro.
The Background: From 8 Bits to 16
The original micro-PROLOG was written by Frank McCabe as an 8-bit program for CP/M, with a simple Lisp-style syntax and a bare minimum of "clutter", to help it fit within the confines of the very limited memory of computers of the time. Few people could afford more than 16kb (kilobytes!) of memory, let alone a "full" complement of 64kb.
Working as a research assistant in the Department of Computing, Imperial College, London, Brian found a way to add high-resolution graphics to micro-PROLOG, creating a special version for the North Star Advantage, an all-in-one CP/M computer with keyboard, screen and floppy drive built into a single unit. The graphics proved popular with his fellow researchers, and based on this work, he was offered the chance to port micro-PROLOG from the 8-bit Z80 chip, to the 16-bit 8086. At the time, the only computer readily available was the remarkable Sirius 1 (known as the Victor 9000 in the USA), the latest product designed by the amazing Chuck Peddle, who had previously designed the 6502 microprocessor for Motorola, and created one of the first true personal computers, the Commodore PET.
While maintaining his research job at Imperial, Brian spent his spare time at home, painstakingly translating the source code for micro-PROLOG from its Z80 version, to the new 16-bit machine. Module by module, pieces of code began to run, followed, inevitably, by the dreaded "SYSTEM ABORT" message when some pointer ran out of range, or a routine was called that had not yet been written.
By 1983, a fairly stable version of micro-PROLOG 3.0 was running happily on the Sirius 1, and (more significantly) on the brand new IBM PCs that had arrived at Imperial. Brian continued to work on new versions of micro-PROLOG, releasing 3.1 in 1984, simultaneously with Frank's final release for Z80 machines. During the following months, Brian created a further version, with overlapping text windows and a WordStar-style command line editor, but this was never released to the public, instead being used solely by his colleagues at Imperial.
Pushing 16 Bits to 20 and More
Although it ran on the new 16-bit IBM PC (and many other machines supporting MS-DOS), micro-PROLOG still limited program and execution space to 64kb, and a complete rewrite of the core engine was started. In 1984, Brian left Imperial to join LPA full time, and together with Frank McCabe, worked to produce what would come to be called, "PROLOG Professional". Using the segmented memory architecture of the 8086, this version could address up to 640kb of memory on the IBM-PC and its increasingly common "clones", and up to 1024kb (1Mb) on other MS-DOS machines such as the Sirius 1 and Apricot.
Larger memory lead to bigger programs, and Brian introduced changes to the micro-PROLOG syntax to support meaningful variable names, richer floating point maths, and much more. Although the system was still fundamentally based around a Lisp-style notation, support was also added for the increasingly common and de-factor standard, "Edinburgh" syntax. A faster, compiler based version of PROLOG Professional had been created in collaboration with Paul Parker, and eventually this compiler replaced the original interpreter as LPA's flagship product, although Brian maintained it for some further years for hobby purposes, in conjunction with his interest in Hewlett Packard's tiny MS-DOS handheld computers, such as the HP-100C.
While even the first version of PROLOG Professional gave programmers up to ten times the memory space than micro-PROLOG, it was not long before people were clamouring to use "Expanded" memory, or EMS. This somewhat cludgy technology was added to the system, allowing up to 4Mb of additional memory to be swapped in and out of the 8086 20-bit address space, enabling a form of RAM-based virtual memory, which worked with a reasonable degree of efficiency.
The Intel 80836 - 32 Bits
While PROLOG Professional continued to sell well, the arrival on the scene of Intel's 80386 processor was a major game changer. For the first time, it was possible to address a theoretical 4Gb (4096Mb) using a single pointer, rather than the previous 1Mb using a combination of a 16-bit (64kb) pointer and separate segment offset. It was plain that a direct translation of PROLOG Professional and its 16-bit code into 32 bits would not make the most of the new architecture, so it was decided to start over with a completely clean slate.
After much planning and consideration of different memory architectures and compiler models, Brian wrote the first lines of the new, clean, 32-bit version of Prolog on 2nd November, 1989. The first version of the new Prolog engine was to run from the MS-DOS command line, using a 32-bit DOS Extender, licensed from Phar Lap, to give it full access to a 32-bit (4Gb) memory address space. The first routines were written: simple output, MS-DOS functions translated into their 32-bit equivalents, assorted declarations, and experimental heap allocation routines. Early days yet, but "386-PROLOG" was born.
For the next twelve months, Brian was writing non-stop in 386 Assembler language, creating a new compiler instruction set, garbage collector, unification routines, essential predicates, input/output routines, error handlers and the entire paraphernalia which embody a Prolog engine. The new system included an extended Lisp syntax, similar to that of micro-PROLOG, but now encompassing four bracketed structure types, mapping to lists and executable tuples, conjunctions and disjunctions.
Early experimental code was written in this extended Lisp syntax, but by June 1990, work was undertaken to add Edinburgh style I/O right into the heart of the new system. It was at this point, that Brian was able to start giving fragile, working prototypes of the new, 32-bit compiler to others at LPA; Phil Vasey began to work on the "overlay", a Prolog file automatically loaded at system startup, which provides most of the familiar predicates of Edinburgh Prolog.
Version 1.0 of "386-PROLOG" was launched just over a year after those first lines of code had been written, and work continued to develop the system further, and fix the inevitable slew of bugs that were reported by back users of the first systems to be shipped.
Windows and MS-DOS
Simultaneously with his continued development of the new Prolog engine on 32-bit extended MS-DOS, Brian began work on a Windows 3.0 compatible version of the system. The wisdom of his choice of development language, namely 386 Assember, really proved itself. The assorted C and Pascal compilers of the day could not host code both on Windows and MS-DOS, nor were the DOS compilers compatible with the Windows ones in terms of syntax and run-time libraries. With Assembler, there were no such concerns: Brian simply implemented a mirror of his MS-DOS function libary, started on that 2nd November, 18 months previously, using Windows APIs to do the equivalent job.
In February 1992, version 1.100 of 386-PROLOG was announced simultaneously for MS-DOS and Windows. The name, "386-PROLOG", was retained in documentation to describe the common engine, but the names "DOS-PROLOG" and "WIN-PROLOG" were adopted as shorthand for "386-PROLOG for DOS" and "386-PROLOG for Windows", respectively. WIN-PROLOG was running as a hybrid 16/32 bit system: a 16-bit Windows executable provided the standard input/output features, including a selection of pre-compiled dialogs and alerts, together with user-programmable windows and a console, while all the "work" was being carried out inside the 32-bit 386-PROLOG module, running as a sperate, linked process.
Fast Forward to the Millennium Bug
Countless improvements were made to the 386-PROLOG engine over the next few years, resulting in frequent releases, often with spectacular new performance enhancements as well as with the occasional embarrassing bug being fixed. By July 1996, it was felt that the old WinMem32 hybrid version of WIN-PROLOG had reached the end of its useful life, and while it worked fine with Windows 95, it would not readily support the about-to-be-released, Windows NT. A final release of the hybrid system, version 3.3, had been made in April 1996, and Brian started on the business of redesigning the low level Windows API interface around the true 32-bit model, and just before Christmas, 1996, released version 3.5 internally at LPA, the first single-process version of WIN-PROLOG, where the 386-PROLOG engine was physically compiled and linked into the main executable file. A stable version 3.6 of the system was publically released in November 1997, ahead of a significant code review and substantial system rewrite.
Much had been made in the computing and public press, about the impending doom-laden evening of 31st January 1999, when, once second after 23:59:59, the lights would go out, aircraft would fall from the sky, and the world's banks, phone exchanges and more would grind to a halt. In ten years' continuous development, some of the clean code in 386-PROLOG had grown over complex, and it was decided to use the Hunt for the Millenium Bug as an excuse to revise much of the code and layout, while ensuring the entire system was immune from the "Y2K" (Year 2000) issue. Three internal release numbers were used up in the ensuing flurry or work, until in April 1999, version 4.0 was released to the public, proven to be safe from all Y2K issues.
Unicode, Syntax Colouring & Common Controls
And so the work went on. Support for highly efficient hashed compilation, supporting large databases like WordNet, and the full adoption of Unicode lead to the 4.2 release in October 2001, allowing programs and data to be written in any world language and character set. Support for Windows 3.1, which could host WIN-PROLOG using Win32s, was finally abandoned with the adoption of Rich Edit to support large program windows (formerly limited to 64kb of text per window), context-sensitive syntax colouring and a new, powerful console user interface complete with command history recall: version 4.3 arrived in June 2002. This version was also released internally, in a new, experimental form, as DLL-PROLOG, a fully-callable and micro-controllable Prolog subprocess that could efficiently be loaded into any running C/C++ application.
Another year, and the 386-PROLOG engine was enjoying the benefits of runtime memory save/restore routines, which both could be used to develop asynchronous server applications, and to support memory space reallocation at runtime without the need to quit Prolog and restart: these features were released with version 4.5 in July 2004; this version also saw the termination of Windows 95 support, following the inclusion of a number of common controls, such as nudge boxes, tabbed windows and tooltips.
TCP/IP Sockets, MIDI & Tries
TCP/IP, the primary connection language of the Internet, was built into version 4.6, released in September 2005; MIDI, the lingua franca of Musical Instruments, was included in version 4.7, in July 2007. Version 4.8, released in October 2008, included an advanced parallel text search based on "Tries", which in turn facilitated the creation of library files supporting efficient XML and Jason parsing routines; a final 4.x release, 4.9, was made in April 2011, consolidating the many changes that had taken place in the dozen or so years since the Y2K-safe release in 1999.
Version 5 - New Floating Point
It was 2010, and another major code review was undertaken, this time replacing the legacy, third-party mathematics library, which was related to the one Brian incorporated into PROLOG Professional way back in 1986, with a brand new floating point library written from scratch, fully utilising the x87 processor. The change required system-wide modifications, and an extensive programme of complex testing, before finally being released July 2013 as version 5.0.
Happy 25th Birthday, 386-PROLOG
So here were are, 25 years after Brian wrote those first lines of code. 386-PROLOG is alive, well and kicking, currently ported to 6 different formats, including the DOS-, WIN- and DLL- varieties mentioned above, but also "BAT-" and "CON-" versions for MS-DOS and Windows command line applications respectively, and "TCP-", which replaces the console input and output streams with a TCP/IP link, allowing Prolog to talk directly to a remote client over a Telnet link.
While the 386-PROLOG engine has, thoughout the past 25 years, been the work of one individual, this is not to underplay the role of everyone else at LPA, who between them have been implementing and maintaining the LPA Toolkit Suite, from the flex Expert System & VisiRule executable business charts, to the ProWeb Server, WebFlex, Intelligence Server and much more. 386-PROLOG is the foundation stone of LPA's entire product range, which in turn comprises the creative output of an amazing team, all working tirelessly, over those same 25 years.
In May 2014, Brian acquired the full IPR to the LPA-PROLOG system, including the 386-PROLOG engine in all its versions and related files and resources, although it will continue be marketed by LPA and to form the basis of the LPA Toolkits, just as before. Altogether, 386-PROLOG represents a quarter of a century of innovation, design and perserverence by Brian, which has resulted in a world-leading software product. Here's looking forward to the next 25 years!
Version 6 - Rebranding for an Independent Future
As the end of the 25th Anniversary Year approached, and with a view to a secure, independent future for 386-PROLOG, the system was subjected to thorough rebranding, with removal of the legacy "LPA" logo and monikers, to be replaced by the new "Solanum" symbol, which is comprised of two touching elipses intersected by a line, somewhat resembling the figures of "8" and "1" superimposed. Bitmaps, Icons and other resources were replaced with designs based on the new logo, and utilising the bold, "VAG Rounded" font in place of the "Tekton", "FormalScript 421" and "Staccato 222" fonts previously used for the product logo.
In addition to the rebranding, this new version included rewritten file handling routines, allowing its Windows incarnations to handle files of up to 2^53-1 (9,007,199,254,740,991) bytes in size, compared to the previous limit of 2^32-1 (4,294,967,295) bytes, making it possible to process huge media files and large databases.
Copyright © 2017 Brian D Steel
All rights reserved