Software development covers a wide spectrum: desktop applications and tiny embedded systems for battery-powered sensors share some concepts, but yet they are very different at the same time.
On occasion, the documentation for some aspect of the Microsoft Windows API does not go deep enough: it just scratches the surface of what it aims to explain. A few of the papers here try to augment the documentation with more details and in-depth coverage. There are no introductory articles on this site.
- The Microsoft Windows Palette Manager
Details on the palette manager of Microsoft Windows, with a focus on identity palettes. This is a highly technical description of what seems to be one of the less understood APIs of Microsoft Windows. The contents of this article are based on close readings of Microsoft's documentation, articles that uncover undocumented interfaces, many "black box" experiments and traces through GDI. With this article, you can also download a free "palette spy" utility that has assisted us frequently in spotting palette problems in our code.
Most recent update: changes in the Palette Manager in Windows 2000: one more static colour that turns out to be dynamic; extra settings for SetSystemPaletteUse().
- A gamma-corrected uniform palette (for Microsoft Windows)
A proposal for a general-purpose 256 colour palette. The palette contains the 20 "static colours" used by Microsoft Windows, a gray scale ramp and gamma-corrected colours.
- Microsoft WaveMix annotated manual
This page is the updated, corrected, annotated and expanded manual for WaveMix, Microsoft's real time sound mixing solution before the advent of DirectSound. This paper covers WaveMix version 1.80, a version that is quite a bit more convenient than version 1.50, but that nevertheless was never really distributed (you can get version 1.80 from this site as well).
Most recent update: A few clarifications in descriptions of the parameters to WaveMixPlay() and the WAVEMIX.INI file, plus a new section in typical mixing strategies.
- Accurate frame timing in Visual Basic
How to improve the accuracy of timed events under Windows. The code snippet is in Visual Basic, but the principles apply to all Windows
Most recent update: Notes for the timer accuracy on Windows 2000/XP (and improving it), plus a change to avoid monopolizing the CPU.
- Detecting Vertical Retrace in Microsoft Windows
Synchronizing display updates with the vertical retrace of the monitor can reduce flicker, tearing and other artefacts. The vertical retrace is a real time event and, under a multitasking operating system like Microsoft Windows, that requires some consideration. This article covers Windows 3.x, Windows 95/98 and Windows NT/2000.
Most recent update: Updated source code for the kernel drivers (correction of a bug that occurred under rare circumstances). In addition, the page sheds a few words on installing the Windows NT/2000 kernel driver, because it is a source of much confusion.
- Cloning a registry branch
This article presents a function that copies all values and keys below a given key in the registry to another key. It is a recursive function, that you can plug in directly into C and C++ projects. The article also explains why cloning a registry branch is sometimes needed (with updated information on installing filter drivers for the LeadTOOLS multimedia kit).
- A tiny DrawHTML() function
DrawHTML()is a drop-in replacement for the standard
DrawText()function from the Platform SDK, and it supports a (very) limited subset of HTML tags. The function was initially developed for the Callout control published in Dr. Dobb's Journal; the page has a few errata for the article too.
A collection of technical articles that are related to embedded systems and the programming of microcontrollers and small systems.
- Implementing FAT on CompactFlash cards, SD/MMC cards and USB sticks
When writing the software for our programmable MP3 player, we had to find out how a file system, such as FAT16 and FAT32, is fitted on a CompactFlash card. In the end, it turned out to be all pretty standard. However, two published reference implementations of similar projects as ours were quite terse and... they turned out to work only "in most circumstances". Hence, we decided that our insight might very well be useful to others.
Most recent update: Information on SD/MMC cards has been added.
- minIni: a portable INI file parser
The minIni library is a minimal INI file parser that supports reading, writing and deleting keys from an INI file and that requires little memory or other resources. It is adaptable to non-standard file I/O libraries, which are often found in embedded systems.
- Debouncing switches with vertical counters
An efficient software method to debounce multiple switch inputs concurrently. The article explains "vertical counters" and how these can be used to filter out "contact bounces" in switches with a minimum of overhead.
- Configuring a micro-controller for low-speed USB communication
All device controllers that support full-speed, also support low-speed. This is inherent to the protocol. However, since only few programmers are have knowledge of the USB physical layer (signal levels), and few circuit designers have knowledge of the programming intricacies, low-speed configuration of an USB device is becoming "lost knowledge". This article fills the void.
- The Dhrystone benchmark, the LPC2106 and GNU GCC
Our running of the Dhrystone benchmark on the LPC2106 microcontroller (a NXP/Philips chip with an ARM7 core) produced significantly different results than those reported by a compiler vendor. We publish our data to point out the risks in interpreting benchmarks.
Most recent update: KEIL no longer lists its controversial tables on its site. For completeness, our discussion now contains a link to an archived copy of that page.
- ICSP programming tool/adapter
This tiny adapter enables In-System Programming of the NXP LPC1000 and LPC2000 microcontroller series using the tag-connect cable and an FTDI TTL-232R interface cable. It may also apply to other microcontrollers that use ICSP.
- LPC2100: Entering ISP mode from user code
Our notes and code modifications on the NXP/Philips application note AN10356, pertaining to a simple solution to in-field firmware updating.
- The STA013 MP3 decoder
This paper is a collection of hardware notes on the use of the STA013 MP3 decoder from STMicroelectronics. The paper also contains some notes on the MP3 file format.
- An RS232 "spy" cable
The RS232 norm defines a one-on-one communication link between two devices. With a special cable, though, it is possible to have a third device (a PC) "listen in" on the data —a useful trick in debugging serial protocols or for deciphering an unknown protocol.
- A MIDI to RS232 converter
The MIDI protocol is a serial data communications protocol using on a "current loop" physical layer, and using a Baud rate of 31250 bps. This article shows the electronics needed to convert between current loop and the RS232 signal levels. In the second part, it talks about the "software protocol" of MIDI.
Most recent update: A link to USB-to-RS232 adapters that support the required (non-standard) Baud rate of 31250 bps was added.
- Extending TFTP
The "Trivial File Transfer Protocol" is a file transfer protocol that is suitable for timy implementations (in embedded systems). This article discusses and proposes a few extensions on the protocol, to improve performance, allow larger files, enable peer-to-peer file transfers, and more...
CompuPhase build up much experience in the field of computer graphics, both 2-dimensional and 3-dimensional. A few of the papers that we wrote were published as magazine articles, others are available on this site.
- Colour metric
An introduction to colour models and specifying the distance (or closeness) of colours. Measuring the difference between colours is essential for a variety of tasks: from palette mapping to lossy image compression (and broadcast television). The document describes different approaches to the problem (CIE LUV, YIQ and YUV) and proposes a new formula for colour distances (both simpler and more accurate).
The paper also briefly covers gamma correction and its implications for transferring pictures from the Apple Macintosh to the IBM PC.
Most recent update: extra references of proposed modification to the CIE L*u*v* colour space.
- Axonometric projections
Isometric projections are used in a few popular computer games. This paper starts with an overview and a historic perspective, then focuses on six alternative isometric and dimetric projections. Although intended as an overview, the paper presents several formulae and details that are probably published here for the first time.
Most recent update: A link to the CARTESIO program was corrected (again).
- Panoramic image projection
Panoramic images are best known from QuickTime VR (QTVR). This paper gives an overview of panoramic imaging and derives the basic formulae for the projection.
This paper is in Adobe Acrobat (PDF) format, as HTML is inadequate for displaying equations. If you have trouble viewing it, please contact us.
- Quick image scaling by 2
Down-scaling by two is a simple matter of applying a "box-filter". For the purpose of up-scaling by a factor of 2, the article proposes a novel directionally-interpolating algorithm. The algorithm is quick (single pass), keeps smooth areas smooth and edges sharp.
- Quick colour averaging
Computing the middle colour between two colours is not difficult. Doing it fast requires a few tricks. Calculating the average colour is a requirement of some of the scaling and image re-sampling techniques that will be published in the near future (both on this site and in magazine articles).
- Synchronizing animation on MIDI audio
A low level toolkit for Win32, Maximum Midi, can serve as a base timer for the screen refresh of sprite or frame animation. All tempo changes in the MIDI piece are handled automatically. This paper explains how to hook Maximum MIDI into AniSprite. The principles apply to other MIDI and animation toolkits as well.
Most recent update: An extra section explaining why it is important to synchronize animation to MIDI, and why a "single timer" strategy is the better alternative.
- Drawing the Hilbert curve
The Hilbert curve is a space filling curve that visits every point in a square grid. It has advantages in those image processing (and rendering) operations where the coherence between neighbouring pixels is important. The Hilbert curve has been applied successfully in image compression and dithering algorithms.
- Riemersma dither
Dithering along a Hilbert curve with restricted error proliferation. This paper proposes a new dither algorithm that combines the advantages of ordered dither and error diffusion dither.
- Animation tips and resources
An overview of animation techniques and tips, plus a list of software resources and links to related sites.
Most recent update: We made our storyboard layout available (in Adobe Acrobat format, or PDF) and discuss how one should use it.
- Display Typography
This article focuses on the design of "screen" fonts; fonts that are designed to be optimally legible on computer displays.
- Feathering a mask for anti-aliased sprites
Two algorithms, one conventional and one novel, to "blur" a mask on the inside. This allows a sprite engine to use the same "alpha blending" techniques for animated objects as advanced paint programs.
Most recent update: a clarification of the requirements for the convolution filters.
- The FLIC file format
A detailed description of the animation file format for FLI/FLC files. The FLIC file format was developed for Autodesk Animator, and it is now supported by a wide range of animation software and utilities.
The document also discusses many enhancements and extensions to the file format from EGI, DTA and Cosmigo, plus that it covers the FLH/FLT/FLX files in addition to the 256-colour FLIC files.
Most recent update: An additional "known error" in the format plus clarifications of the colour palette chunks (how they relate to updating the screen).
- The Filmstrip file format
A description of the lossless (uncompressed) animation file format that Adobe introduced with Premiere. This paper fills in a few details that are lacking from the original description by Adobe and it provides some C source code to read/convert Filmstrip files.
Most recent update: Minor corrections in the code snippets.
- The Poly-Raster Image format
The Poly-Raster Image format is a picture file format that holds one or more device-specific bitmaps along with descriptive headers. Its goal is to be a flexible format that is easy to decode, using few resources. The Poly-Raster format is therefore particularly useful for embedded systems —especially the smallest of these embedded systems. The article presents the file format as well as source code and utilities.
Most recent update: The article has a new section on animation, and the updated software now comes with a GUI version of the image encoder.
A collection of technical articles that are related to software development in general.
- SvnRev: stamp your applications with revision numbers
SvnRev is a little program that writes the current revision number of project into a C/C++ header file. It retrieves the revision number from keywords that the Subversion version control system maintains in the source code.
Most recent update: Support for the new "working copy" of Subversion 1.7; relaxed requirement for RCS keywords in source files (on Subversion 1.7 working copies).
- Rosette: internationalization through message catalogs
The Rosette library was an internal project to make internationalization of software easier and to improve the quality of the translations. This white paper discusses the backgrounds of the library and motivates why a cooperative effort of linguists and programmers is needed to achieve good translations as well as maintainable internationalized software.
For translators working on applications that use Rosette, a set of tools is freely available.
- Periodic Interrupts with the Real Time Clock
This is an old article that I originally uploaded to one of the CompuServe forums. It is now available here upon a reader's request. The example source code (int70.asm)) is in a separate file. It is quite possible that there has existed a second example program (in C), because the article mentions the need of a C compiler. That file is lost, however.
Other than changing the e-mail address, I have made no modifications to the article (not even HTML formatting). So the article talks about 80386 and 80486 processors and about DOS and Windows 3.1. The RTC hardware has not changed since those days, however.