- January 2012
- December 2011
- November 2011
- September 2011
- July 2011
- June 2011
- May 2011
- March 2011
- January 2011
- October 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- September 2009
- July 2009
- June 2009
- May 2009
- March 2009
- September 2008
- April 2008
- December 2007
- June 2007
- June 2005
- September 2004
- May 2002
- October 2001
- August 2001
Miscellaneous code
Turbo Pascal Bug
There is a bug in the standard Turbo Pascal CRT unit. This bug causes a "Divide by zero" error on Pentium II and above. Any program that uses the CRT unit crashes. If, like many people, you only use CRT for "ClrScr", "GotoXY", "Delay", "Readkey" and "KeyPressed", then you can use my Small CRT replacement unit instead. It doesn't have the bug... until computers become 30,000 times faster than their current speed.
To download the Pascal source code (3k), click here.
Delay routine
I was told that Microsoft C doesn't have a "delay" routine. Since I don't use MS-C, I can't check this. Here, however, is a delay routine.
Add #include "delay.h" to the example programs and replace all references to delay with MilliDelay. This file contains MilliDelay (long n) and MicroDelay (long m) which wait for n milliseconds or m microseconds respectively.
To download the C source code (0k), click here.
For Pascal programmers, the MicroDelay routines is also available, as TurboPascal's delay only has a millisecond resolution
To download the Pascal source code (0k), click here.
Extended Memory Routines
A Turbo Pascal unit that enables the direct use of XMS (extended) memory in DOS programs.
To download the Pascal source code (3k), click here.
To download the C(++) source code (3k), click here.
Keyboard handler extension
Source code to trap cursor key presses and releases. This is allows for continuous movement of the player character instead of the repeat generated by the BIOS keyboard handler.
To download the Pascal source code (2k), click here.
To download the DJGPP/C(++) source code (2k), click here.
Many people have requested a list of scan codes for all the keys on the keyboard to be used with the replacement keyboard handler, so here it is.
To download the text file (4k), click here.
Mouse routines
Source code showing how to read information from the mouse.
To download the Pascal source code (1k), click here.
To download the DJGPP/C(++) source code (1k), click here.
Serial communication routines
Source code demonstrating how to send and receive data through a serial (COM) port.
To download the Pascal source code (3k), click here.
To download the C/C++ source code (3k), click here.