Analysis model: gpt-5.5 xhigh

LO-RES by Marty Smith - Technical Dissection

LO-RES is a May 1984 MS-DOS demo / demonstration package credited to Marty Smith. It is earlier than the PC demoscene lineage normally discussed in these notes: it is public-domain IBM PC graphics engineering, not a party demo or cracktro, but it is exactly the kind of early PC display trick that later demo authors kept rediscovering.

Release year: 1984

Source Status

This pass is intentionally source-limited.

Demozoo lists a Defacto2 archive for LORES.zip, but Defacto2 currently serves Cloudflare challenge HTML to this environment for both the page and the download endpoint. I did not obtain the original archive or executable bytes in this turn, so there is no claim below that a COM/EXE was disassembled.

What is available and used:

The Softalk text identifies LoRes as Marty Smith's aid package for 160-by-100 sixteen-colour graphics on the IBM PC and notes that the demo was written in assembler. Demozoo lists Released May 1984, platform MS-Dos, type Demo, and credits Marty Smith for code and graphics.

Visual Evidence

LO-RES public Demozoo screenshot contact sheet

The six public screenshots show a small but technically focused sequence:

Image Visible part What it proves
lo-res-demozoo-01.png Title card: 160x100 color mode, author line, function-key prompt, Escape exit The program presents itself as an IBM PC low-resolution colour-mode demo and exposes interactive demo selection.
lo-res-demozoo-02.png Nested elliptical arcs with overlaid label band A line/arc primitive is repeatedly called with changing radius/phase/color.
lo-res-demozoo-03.png Rectangular tunnel / nested square outlines Horizontal and vertical line primitives are being clipped or stepped in the 160x100 coordinate space.
lo-res-demozoo-04.png Rotating grid / angular line field The demo can draw dense line sets fast enough for visual animation in this text-derived mode.
lo-res-demozoo-05.png Concentric colour rings Circle/ellipse stepping is independent of the title text overlay code.
lo-res-demozoo-06.png Radial starburst of coloured lines The line drawer is the central reusable primitive.

There are no exact runtime timestamps for this article because I do not have a runnable binary. These are public static screenshots, not local DOSBox-X captures.

The Core Trick

CGA 160x100 text-mode cell map

The name LO-RES is literal. The usual IBM CGA graphics modes give 320x200 with four colours or 640x200 with two colours. The 160x100 sixteen-colour trick uses text mode instead:

In normal 80-column text mode, a cell is:

B800:0000 + cell*2 + 0  character code
B800:0000 + cell*2 + 1  attribute byte

For a 160x100 logical pixel coordinate:

cell_index = y * 80 + (x >> 1)
cell_addr  = B800:0000 + cell_index * 2
side       = x & 1

The two logical pixels inside a cell are therefore:

left  pixel: x even
right pixel: x odd

The program can draw them with CP437 block characters:

0xDB  full block
0xDD  left half block
0xDE  right half block
0x20  space

The useful representation is:

attribute low  nibble = foreground colour
attribute high nibble = background colour
glyph bits            = foreground on left/right/both/neither

With blink disabled or background intensity enabled, the attribute can carry the full 0..15 colour range on both foreground and background. If blink remains enabled, background colour is effectively only 0..7 and the mode is less useful for arbitrary two-colour cell pairs. A program advertising sixteen-colour 160x100 drawing is normally expected to choose the non-blinking background interpretation.

Pixel Store Inner Loop

The expensive part of this mode is that a single logical pixel write cannot blindly store one byte. It must preserve the neighbouring pixel that shares the same text cell.

The logical operation for putpixel(x, y, c) is:

cell = y * 80 + (x >> 1);
addr = 0xb8000 + cell * 2;

old_ch   = mem[addr + 0];
old_attr = mem[addr + 1];

decode old_ch/old_attr into left_colour and right_colour;

if ((x & 1) == 0)
    left_colour = c;
else
    right_colour = c;

encode left_colour/right_colour back into ch/attr;

mem[addr + 0] = new_ch;
mem[addr + 1] = new_attr;

A practical encoder wants a cheap common case:

if (left == right) {
    ch   = 0xdb;               /* both halves foreground */
    attr = left | (left << 4);
} else {
    ch   = 0xdd;               /* left half foreground, right half background */
    attr = left | (right << 4);
}

If a target adapter or text font has the half-block orientations swapped, the encoder uses 0xde or swaps the attribute nibbles. The important point is not which block code is chosen, but that the text glyph supplies a two-pixel mask while the attribute supplies the two colours.

A real assembler implementation would avoid a slow multiply for every pixel. The likely fast form keeps row bases:

; input: x in AL/AX, y has already selected a row base in DI,
;        colour in BL
; row_table[y] = y * 160 bytes? no: y * 80 cells * 2 bytes = y * 160

mov  di,[row_table + y*2]
mov  ax,x
shr  ax,1
shl  ax,1              ; two bytes per text cell
add  di,ax             ; DI = byte offset within B800

mov  al,es:[di]        ; old character
mov  ah,es:[di+1]      ; old attribute
; decode neighbour colour from AL/AH
; insert new colour into the selected half
mov  es:[di],new_char
mov  es:[di+1],new_attr

That is the core cost of the mode: fast enough for colourful line drawings, but each plotted point is still a read-modify-write of a two-byte text cell.

Clear And Page Shape

The entire screen is exactly one CGA text page:

80 columns * 100 rows * 2 bytes = 16000 bytes

A fast clear therefore does not need a graphics-mode stride. It can fill text cells directly:

mov ax,0b800h
mov es,ax
xor di,di
mov ax,(background << 12) | (foreground << 8) | glyph
mov cx,8000
rep stosw

For a black clear with all cells blank, the word would be approximately:

character = 0x20
attribute = 0x00
word      = 0x0020

For a solid colour clear, an implementation can use full-block characters with matching foreground/background nibbles. Because this is text memory, rep stosw is ideal: one word equals one cell, and one cell equals two logical pixels.

Line Drawing

The screenshots are dominated by line primitives. In a 1984 assembler demo, the natural line kernel is integer Bresenham:

dx = abs(x1 - x0);
dy = abs(y1 - y0);
sx = x0 < x1 ? 1 : -1;
sy = y0 < y1 ? 1 : -1;
err = dx - dy;

for (;;) {
    putpixel(x0, y0, colour);
    if (x0 == x1 && y0 == y1) break;
    e2 = err << 1;
    if (e2 > -dy) { err -= dy; x0 += sx; }
    if (e2 <  dx) { err += dx; y0 += sy; }
}

The starburst frame is the most direct proof that such a primitive is central: many rays share a common origin and differ only in endpoint and colour. The rectangle frame proves that the same path handles straight horizontal and vertical runs, or calls special-case line fillers for those two cases.

An efficient assembler implementation would special-case horizontal spans:

; y fixed, x0..x1 increasing
; Use one read/modify/write for odd/even boundary cells,
; then write full cells for interior pairs.

That avoids calling the generic putpixel twice per text cell in the common case where two adjacent logical pixels have the same colour. The nested-square frame is the frame where this would matter most.

Circle And Ellipse Drawing

The ellipse and ring screenshots imply either midpoint circle/ellipse stepping or a small precomputed sine/cosine table. Both fit the era and the mode.

A table-driven version for the arc frame would look like:

for (radius = r0; radius < r1; radius += dr) {
    colour = (colour + 1) & 15;
    for (theta = theta0; theta < theta1; theta += step) {
        x = cx + ((cos_table[theta] * radius_x) >> scale);
        y = cy + ((sin_table[theta] * radius_y) >> scale);
        putpixel(x, y, colour);
    }
}

The concentric ring frame can reuse the same table with full 0..255 phase coverage. The tilted/overlaid ellipse frame changes the phase origin or uses different radius_x and radius_y increments.

The important performance detail is that all visible work eventually collapses to the same text-cell plotter. The visual variety comes from different coordinate generators feeding one low-resolution pixel store.

Why The Screenshots Look Like That

The mode's "chunky" look is not low-quality 320x200 CGA. It is the text-cell geometry showing through:

This is also why the screenshots look surprisingly colourful for 1984. The program is not using a hidden 16-colour bitmap mode. It is using text hardware as a two-pixel-per-cell colour compositor.

Interactive Shape

The title screenshot says:

Use Function Keys
for demos,
Hit ESCape to quit.

That implies a tiny menu loop:

for (;;) {
    key = bios_read_key();
    switch (key) {
    case F1: demo_arc_fan();       break;
    case F2: demo_square_tunnel(); break;
    case F3: demo_grid_swirl();    break;
    case F4: demo_rings();         break;
    case F5: demo_starburst();     break;
    case ESC: restore_text_mode(); return;
    }
}

On an IBM PC, function keys arrive through BIOS keyboard service INT 16h as extended scan codes rather than printable ASCII. A compact assembler menu would use INT 16h AH=00h, compare AH against function-key scan codes, and compare AL against 1Bh for Escape.

The first frame also proves that the demo overlays ordinary text labels on top of the low-resolution mode. That is nearly free in this representation: labels are just text cells. A text overlay can either write normal letters directly or temporarily abandon the two-pixel invariant in a rectangular band, which is exactly what the screenshot label areas look like.

What This Adds To The PC Demo Timeline

LO-RES is important because it shows the PC visual-demo problem before VGA, before AdLib/Sound Blaster demo culture, and before party competition rules. The author is not trying to stream a packed multipart show. The point is:

Can the IBM PC be made to show a colourful graphics-like mode that IBM did not
offer as a normal BIOS graphics mode?

The answer is yes, by treating CGA text mode as a programmable colour grid. That exact mentality later becomes normal PC demo engineering:

Verification Boundary

Hard facts in this article:

Not verified in this article:

If the Defacto2 archive becomes reachable, this article should be upgraded with file hashes, real disassembly, exact CRTC register writes, exact key dispatch, and true inner loops.