Permission is granted to reprint/use these on the web so long as it includes a link back to my website.
Forty years of Pascal and Delphi Programming
I first learnt Pascal at University in the late 70s. It was I believe a version for ICL computers on an ICL 1904A and compared to Turbo Pascal was primitive. No strings but it had type alfa which were something like 10 character strings. I had a disagreement with one of my lecturers (John Elder) author of a Pascal textbook. His lectures often ran over a few minutes which made me late for my next lecture; that was the disagreement. I set off an alarm on my watch exactly on the hour in each lecture; oddly he didn't much like that!
In the real world after graduating my programming was limited to Basic on Apple II, Act Sirius and Dec Rainbow. But in 1984, I was introduced to Compas Pascal from Denmark and developed a small system for a builder in Carrickfergus, N. Ireland where I lived. They had to refer to a Housing Executive "bible" for procing and building-job details and prices and my system automated it, generating printed invoices. Compas Pacal was great, quick to compile, supported proper strings and ran on a Gemini Z80 system with all of 64 KB of memory. I received £100 for that!
Two years later I invested £50 and bought Turbo Pascal 3.02, and ran it on an Amstrad PCW. It took about 15 minutes to compile a 3,000 line program but this was the era of Amstrad's 3" disks. I developed a postal game in mid 1986 called Casus Belli and ran it for a couple of years, back in the pre-internet era. It was a 16-player wargame, based on the Empire game. This being the era of dot matrix printers that you could program to output graphics.
The Move to England
In 1987 I moved to Manchester England to take up a game programming job that lasted a year; the firm Icon Design had published a couple of games that I had written (Johnny Rebel II and Battle of the Bulge) and I took part in early 1987 in London in a postal games convention, meeting players of my game which had been launched in Comnputer & Video games magazine. I met Kevin Cropper of KJC Games (Cleveleys Blackpool) who offered to buy the game from me. During this year I developed the computer game Dark Empires, an Empire clone on Zx Spectrum and CBM-64. I did the Z80 to 6502 conversion (5,000 lines of code) in one month, working seven all-night sessions, the last three back to back - madness!
Warlord
At the end of 1987, I spoke to Kevin and after a five hour chat at his offices was offered a job as designer and programmer of postal games, and sold Casus to him. One of my first jobs was to create a 100 player version of it called Warlord which is still running in 2020.
Quest
Following Warlord, I developed Quest. Again, programmed in Turbo Pascal 5.5, it took a year to write all by myself and was 40,000 lines of procedural pascal. This included the map generator, the dungeon generator and towns and city areas and shops. Dungeons were 12 levels deep with stairs up and down on each level and corridors connecting all rooms so there was a guaranteed path down to the lowest level and back. I had fun coding the genertators for that!
Postal games were written as game processing engines. Turns were sent in on specially printed postcards, and were then manually input using a program I'd written into a text file. When it was time to process, all game data was backed up and then the turns pocessed instruction by instruction. As this was running on Amstrad PC 1640s, there was only Dos 3.0 and programs were limited to 64 KB units. I created the equivalent of dlls; in TP you could load an object file into memory and call to, passing in the address of a large memory block. Ao each of the 26 commands (A-Z) had its own "module". That let me write more code than could ever be compiled in one program.
The game processing engine would read all the data as it needed it. I used fixed size record files, but also a variable size file where an index file was accessed as 2 byte (16 bit) file pointers and then would do a seek into a data file. This let me store all the strings from the program in the data file with a 16 bit file pointer to each string. I also used linked list file pointers where a 16 bit file pointer would index into a file. It would then have the 16 bit file address of the next record, followed by the record length and the data itself. It was very economical of disk space but deleting a record was a matter of marking the length with a special value indicating to-delete and then copying the entire file into a new file, skipping the 'marked-for-deletion-data' and rewriting the file indices.
In 1988-1990 KJC Games was very busy and the downstairs office had six dot-matrix printers that would be left running all night. Each morning there'd be a pile a couple of feet high under each printer of printed turns. Next day, those would have to be split into single-player turns then stuffed into envelopes and posted.
I moved on from KJC Games in Mid 1990 to British Aerospace where my Pascal programming experience got me a job as an Ada developer and I stayed there two years working on software to test the Eurofighter (Typhoon to be)'s avionic software.
BATPUG and Move to London
During my KJC years I'd set up the Borland And Turbo Pascal User Group (BATPUG) and published I think 12 magazines over a four year period. I made a few friends from it and when I eventually moved to London in 1996, I ended up with a contract from one such friend. This was after a years C++ programming, working on software reading aircraft blackbox data and then working on the Nimrod 2000 project to refurbish the Nimrod 2000 recce aircarft. I became a Delphi 3 contract programmer from late 1997-late 1999 in the city working on a research project for financial derivatives.
I found the weirdest ever bug during those two years. The program would run until it hit a trunc( or sql operation and then crash with a nonsensical error. I searched but found nothing on the web or anyone else who had that error. It took three months with the bug appearing two or three times a week and it could not even be caught by an exception handler! Eventually while debugging, I found the bug. My code called another programmer's code in a DLL written by my friend who got me the contract. His DLL did a lot of financial calculations - pricing futures and options, calculating implied volatility etc. on simulated prices- Typically it was filling a 2D array: 5,000 x 10 doubles. A var variable returned a reference back to the big array and my code then used the values. Looking through the debugger one day I spotted a +INF in the middle of all the values!
We were using MS Access database to hold data. I didn't know at the time but the Borland Access driver for Delphi 3 disabled hardware exception handling. My mate's code had a wee bug that did a divide by zero and with exceptions not being generated, Delphi just stored the +INF bit pattern in the array. There was also a -INF and a +NAN (Not a Number) and a -NAN. Important lesson - always check your input data!. I added checking code and it fired once or twice more revealing more bugs in the DLL on other occasions. Once a +INF had got in my code, it stayed hidden and only emerged at the trunc( and sql operations when the weird crash occurred.
12 Years of City Work
After the contract finished I worked for a DotCom (HomeDirectory.com) for a year till that closed. They had been using Delphi 4 for a COM addin to SQL Server for doing searches. We had a mysterious bug that when the SQl Server CPU rose above 5%, it would crash. On a hunch I recompiled the COM addin with Delphi 5, tried that and that fixed it. Part of the recompense for Microsoft poaching Anders Hejlsberg was they helped Borland with COM code. If you used Delphi 4 for COM, it could go wrong. So use Delphi 5 at the minimum!
I then joined a software house, doing all the GUI work for a Front Office Trading System and small DIY report system in Delphi four. Then after seven years there I got a job at a major US bank, with first six months contracting (best pay in my life) and then made permanent where I stayed until 2013. All work was in Delphi five and seven, plus I learnt C# and Java. At the interview with the bank, one of the programmers had actually played Quest!
Work after that was mostly C# on mobile but I had a nine months spell as a Delphi contractor with Delphi 9 in 2014. Then we relocated out of London in 2015. I was doing more C# until 2017 when I got a job in the PropTech (Property Technology) industry in Sleaford, Lincolnshire. I started working on code that was first written in the early 1990s! Huge code bases with over a million lines of Delphi code. With the aid of the IDE Fix pack (recommended), I can build all 1.3 million loc in 45 seconds on a laptop with Delphi XE7 and a make following a code change takes just 6-8 seconds.
Dynamic Virtual Channels
For the last year I have been making Microsoft's Dynamic Virtual Channels come to life in Delphi having manually line by line translated about 1,500 lines of C++ code into Delphi. This lets a program running in a RDP session talk to a program running on your local PC. It uses the same underlying technology that RDP itself uses. Implementing it is a little harder though. On your laptop you have to create a COM dll that is invoked automatically by MSTSC.exe (the program that runs your RDP session). Once the RDP session is established, you have to run another program on the RDP computer- just an EXE that talks to the dll. A link is established and the two programs can now chat incessanty.
It's only thanks to Eric Harmon's Delphi COM Programming book, some old articles by Brian Long, and Binh Ly on his Techvanguard website that I was able to do it. I'd never done COM to the level needed before, but I got there eventually. When you click a button on a program running in an RDP session and a file open-dialog magically, instantly opens on your laptop in response, it is indeed magic. All in 100% Delphi and it works fast- sending 2-3 MB of data per second each way.
I wrote my first pascal program in 1978. In 2020, 42 years later, aged 60, I'm still doing it.