Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Functions written in assembly

BCC32 only compiles inline asm through TASM32, which isn't part of Borland C++ 4.5, so some of the original's functions were assembled separately, or compiled via TASM. They cannot come from C++, and decompiled code must be portable (no __emit__, no pseudo-registers). Each is therefore written as a portable equivalent marked @zoombi32-functional, or, where none exists, left as a documented stub.

WhereWhatPortable form
OS layeratomicIncrement/Decrement/Exchange (lock inc, xchg)Interlocked* (functional)
OS layerinitContext, resumeContext, abandonContext, switchContext: carve a thread's stack and switch registers, esp and flagsfunctional with Win32 fibers (Windows 98/NT 4; not 95)
OS layerrecordReturn: walk stack framesdocumented stub
OS layerfixedMul, fixedDiv: 16.16 arithmeticfunctional
OS layerdebugBreak: int3DebugBreak()
WaveMixthe mixing inner loops (xlat, jo saturate, rep movs)functional
Graphicsnearest-colour search; packed-pixel draw and read; the DIB8 blittersfunctional
GraphicsdecompressImage: differs from our compile only in TASM's accumulator encodings (66 25 0f 00 for and ax, 0xf)functional

The assembly-built modules went through TASM, which is why a few differ only in instruction encodings from BCC32's output. Assembling through TASM does not change register allocation, so it doesn't explain other near-misses.

Packed pixels, the engine's run-length encoding of 8-bit images, are described in Images.