DVX Architecture Overview

DVX Architecture Overview

DOS Visual eXecutive -- A Windowing GUI for DJGPP/DPMI

DVX (DOS Visual eXecutive) is a complete windowing GUI compositor targeting DJGPP/DPMI on DOS. It provides overlapping windows with Motif-style chrome, a retained-mode widget toolkit, cooperative multitasking of DXE-loaded applications, and a dirty-rectangle compositor optimized for 486/Pentium hardware.

Key Design Constraints

No external font or cursor files -- all bitmaps are compiled in as static const data.

The runtime environment consists of a bootstrap loader (dvx.exe) that loads core DXE libraries, widget plugins, and the shell, which in turn loads and manages DXE application modules.

Contents

.link arch.build Build System

Five-Layer Architecture

Five-Layer Architecture

DVX is organized into five layers, each implemented as a single .h/.c pair. Every header includes dvxTypes.h (the shared type definitions) to avoid circular dependencies. The layers are strictly stacked: each layer depends only on the layers below it.

 Applications (DXE .app modules)
 ==================================================
 |                                                |
 |  +------------------------------------------+  |
 |  |  Layer 5: dvxApp  (Application API)      |  |  dvxApp.h / dvxApp.c
 |  |  Event loop, window creation, public API  |  |
 |  +------------------------------------------+  |
 |  |  Layer 4: dvxWm   (Window Manager)       |  |  dvxWm.h / dvxWm.c
 |  |  Window stack, chrome, drag, resize      |  |
 |  +------------------------------------------+  |
 |  |  Layer 3: dvxComp  (Compositor)          |  |  dvxComp.h / dvxComp.c
 |  |  Dirty rect tracking, merge, LFB flush   |  |
 |  +------------------------------------------+  |
 |  |  Layer 2: dvxDraw  (Drawing Primitives)  |  |  dvxDraw.h / dvxDraw.c
 |  |  Rects, bevels, text, blits, cursors     |  |
 |  +------------------------------------------+  |
 |  |  Layer 1: dvxVideo (Video Backend)       |  |  dvxVideo.h / dvxVideo.c
 |  |  VESA VBE, LFB mapping, pixel format     |  |
 |  +------------------------------------------+  |
 |                                                |
 |  +------------------------------------------+  |
 |  |  Platform Layer (dvxPlatform.h)          |  |  dvxPlatformDos.c
 |  |  OS-specific: video, input, asm spans    |  |
 |  +------------------------------------------+  |
 |                                                |
 |  +------------------------------------------+  |
 |  |  Shared Types (dvxTypes.h)               |  |
 |  |  DisplayT, WindowT, RectT, ColorSchemeT  |  |
 |  +------------------------------------------+  |
 ==================================================

Layer Summary

  Layer               Header         Responsibility
  -----               ------         --------------
  1 - Video           dvxVideo.h     VESA VBE mode negotiation, LFB mapping via DPMI, backbuffer allocation, packColor() (RGB to native pixel format), display-wide clip rectangle.
  2 - Draw            dvxDraw.h      All 2D drawing: rectFill, rectCopy, drawBevel, drawText/drawTextN, drawMaskedBitmap (cursor), drawTermRow (batch terminal row). Stateless beyond clip rect. Dispatches hot inner loops through BlitOpsT function pointers.
  3 - Compositor      dvxComp.h      Dirty rectangle tracking (dirtyListAdd), pairwise merge of overlapping rects (dirtyListMerge), and flushRect to copy dirty regions from backBuf to LFB.
  4 - Window Manager  dvxWm.h        Window lifecycle, Z-order stack, chrome drawing (title bars, bevels, close/minimize/maximize gadgets), hit testing, drag/resize, menu bars, scrollbars, system menu, keyboard move/resize, minimized icon bar.
  5 - Application     dvxApp.h       Public API aggregating all layers into AppContextT. Provides dvxInit/dvxShutdown, dvxRun/dvxUpdate, window creation helpers, image loading, clipboard, accelerator tables, theme management, wallpaper, video mode switching, screenshot capture.

Display Pipeline

Display Pipeline

The double-buffer strategy is the single most important performance decision in DVX. All drawing goes to a system RAM backbuffer (DisplayT.backBuf); only dirty rectangles are flushed to the linear framebuffer (DisplayT.lfb) in video memory.

This matters because writes to video memory over the PCI bus are 10-50x slower than writes to main RAM on 486/Pentium hardware for random-access patterns.

Per-Frame Compositing Pipeline

  1. Input poll (mouse, keyboard)
         |
  2. Event dispatch (focus window callbacks)
         |
  3. Layers call dirtyListAdd() for changed regions
         |
  4. dirtyListMerge() consolidates overlapping rects
         |
  5. For each merged dirty rect:
     a. Clip and redraw desktop background (or wallpaper)
     b. For each window (back-to-front, painter's algorithm):
        - wmDrawChrome()   -- frame, title bar, gadgets, menu bar
        - wmDrawContent()  -- blit per-window content buffer
        - wmDrawScrollbars()
     c. Draw minimized window icons
     d. Draw popup menus / tooltips (overlay pass)
     e. Draw software mouse cursor
         |
  6. flushRect() -- copy each dirty rect from backBuf to LFB
         |
  7. Yield (platformYield)

Key Data Structures

DisplayT -- Central display context: width, height, pitch, pixel format, LFB pointer, backbuffer pointer, palette, clip rectangle. Passed by pointer through every layer -- no globals.

BlitOpsT -- Vtable of span fill/copy function pointers resolved at init time for the active pixel depth. On DOS these dispatch to hand-written rep stosl / rep movsd asm inner loops.

DirtyListT -- Fixed-capacity dynamic array of RectT. Linear scanning for merge candidates is cache-friendly at typical sizes (under 128 rects). If the list fills up, the compositor merges aggressively or falls back to full-screen repaint.

Why This Works on a 486

Per-window content buffers persist across frames, so windows don't repaint on expose -- only when their own content changes.

Window System

Window System

WindowT Structure

Each WindowT is the central object of the window manager. Key fields:

  Field Group                              Purpose
  -----------                              -------
  Geometry (x, y, w, h)                   Outer frame rectangle (including chrome).
  Content area (contentX/Y/W/H)           Computed from frame minus chrome. Where application content lives.
  Content buffer (contentBuf, contentPitch) Per-window backbuffer in native pixel format. Persists across frames.
  Chrome state (menuBar, vScroll, hScroll) Optional menu bar and scrollbars. Affect content area computation.
  Widget tree (widgetRoot)                 Root of the retained-mode widget tree (NULL if using raw callbacks).
  Callbacks                                onPaint, onKey, onKeyUp, onMouse, onResize, onClose, onMenu, onScroll, onFocus, onBlur, onCursorQuery.

Window Stack (Z-Order)

WindowStackT is an array of WindowT* ordered front-to-back: index count-1 is the topmost window. This allows:

Reordering by pointer swap (no copying of large WindowT structs).

Only one drag/resize/scroll operation can be active system-wide at a time (single mouse), so that state lives on the stack, not on individual windows.

Chrome Layout

  +-------------------------------------------+
  |  4px outer border (raised bevel)          |
  |  +-------------------------------------+  |
  |  | [X] Title Bar Text     [_] [^] [X]  |  |  20px title height
  |  +-------------------------------------+  |
  |  | 2px inner border                    |  |
  |  +-------------------------------------+  |
  |  | Menu Bar (optional, 20px)           |  |
  |  +-------------------------------------+  |
  |  |                                     |  |
  |  |          Content Area               |  |
  |  |                                     |  |
  |  |                               |  S  |  |  S = vertical scrollbar
  |  |                               |  B  |  |      (16px wide)
  |  +-------------------------------------+  |
  |  |  Horizontal Scrollbar (optional)    |  |  16px tall
  |  +-------------------------------------+  |
  |  4px outer border                         |
  +-------------------------------------------+

Chrome constants are compile-time defines:

  CHROME_BORDER_WIDTH   = 4px
  CHROME_TITLE_HEIGHT   = 20px
  CHROME_INNER_BORDER   = 2px
  CHROME_MENU_HEIGHT    = 20px
  SCROLLBAR_WIDTH       = 16px
  CHROME_CLOSE_BTN_SIZE = 16px

Hit Test Regions

wmHitTest() iterates the stack front-to-back and returns a hit-part identifier: HIT_CONTENT, HIT_TITLE, HIT_CLOSE, HIT_RESIZE, HIT_MENU, HIT_VSCROLL, HIT_HSCROLL, HIT_MINIMIZE, HIT_MAXIMIZE. Resize edge detection returns a bitmask of RESIZE_LEFT, RESIZE_RIGHT, RESIZE_TOP, RESIZE_BOTTOM (corners combine two edges).

Menu System

Menus use fixed-size arrays with inline char buffers (no heap strings). Up to 8 menus per bar, items dynamically allocated. Supports cascading submenus via MenuItemT.subMenu pointer. Item types: normal, checkbox, radio. Separators are non-interactive items. The popup state (PopupStateT) tracks a stack of parent frames for cascading submenu nesting.

Minimized Windows

Minimized windows display as 64x64 icons at the bottom of the screen with beveled borders, similar to a classic desktop icon bar. Icons show a scaled-down preview of the window's content buffer, refreshed one per frame in a round-robin fashion to amortize the scaling cost.

Widget System

Widget System

The widget system (dvxWidget.h) is a retained-mode toolkit layered on top of the window manager. Widgets form a tree rooted at a per-window VBox container.

WidgetT Base Structure

Every widget shares the same WidgetT struct. The type field is a runtime-assigned integer ID. The wclass pointer references the widget's WidgetClassT vtable. Widget-specific private data is stored in w->data (opaque void*).

Tree linkage: parent, firstChild, lastChild, nextSibling. No prevSibling -- this halves pointer overhead and removal is still O(n) for typical tree depths of 5-10.

Layout Engine

Two-pass flexbox-like algorithm:

Top-down (layout) -- allocate space within available bounds, distributing extra space according to weight values (0 = fixed, 100 = normal stretch).

Size hints use a tagged encoding: the top 2 bits of an int32_t select the unit (pixels, character widths, or percentage of parent), the low 30 bits hold the value. Macros: wgtPixels(v), wgtChars(v), wgtPercent(v).

Widget Class Dispatch (WidgetClassT)

Each widget type provides a WidgetClassT with a handlers[] array indexed by stable method IDs. Method IDs are never reordered or reused -- new methods append at the end. This provides ABI-stable dispatch so that widget DXEs compiled against an older DVX version continue to work.

Methods include: PAINT, PAINT_OVERLAY, CALC_MIN_SIZE, LAYOUT, ON_MOUSE, ON_KEY, ON_ACCEL_ACTIVATE, DESTROY, GET_TEXT, SET_TEXT, POLL, and more (21 defined, room for 32).

Class Flags

  Flag                    Meaning
  ----                    -------
  WCLASS_FOCUSABLE        Can receive keyboard focus (Tab navigation)
  WCLASS_HORIZ_CONTAINER  Lays out children horizontally (HBox)
  WCLASS_PAINTS_CHILDREN  Widget handles child rendering itself
  WCLASS_SCROLLABLE       Accepts mouse wheel events
  WCLASS_SCROLL_CONTAINER ScrollPane -- scrolling viewport
  WCLASS_NEEDS_POLL       Needs periodic polling (e.g. AnsiTerm comms)
  WCLASS_SWALLOWS_TAB     Tab key goes to widget, not focus navigation
  WCLASS_PRESS_RELEASE    Click = press + release (buttons)

Available Widget Types

Each widget is a separate .wgt DXE module. 29 widget types are included:

  Widget                  Description
  ------                  -----------
  Box (VBox/HBox)         Vertical and horizontal layout containers
  Button                  Clickable push button with label
  Canvas                  Raw drawing surface for custom painting
  Checkbox                Boolean toggle with checkmark
  ComboBox                Text input with dropdown list
  DataCtrl                Data-bound control for database operations
  DbGrid                  Database grid (tabular data display)
  Dropdown                Dropdown selection list
  Image                   Static image display
  ImageButton             Button with bitmap icon
  Label                   Static text label
  ListBox                 Scrollable selection list
  ListView                Multi-column list with headers and sorting
  ProgressBar             Determinate progress indicator
  Radio                   Radio button (mutual exclusion group)
  ScrollPane              Scrollable viewport container
  Separator               Visual divider line
  Slider                  Value selection via draggable thumb
  Spacer                  Empty space for layout
  Spinner                 Numeric input with up/down arrows
  Splitter                Resizable split pane
  StatusBar               Window status bar with sections
  TabControl              Tabbed page container
  Terminal (AnsiTerm)     ANSI terminal emulator widget
  TextInput               Single-line text entry field
  Timer                   Periodic timer events
  Toolbar                 Toolbar with icon buttons
  TreeView                Hierarchical tree display
  WrapBox                 Flow layout (wrapping horizontal container)

Widget API Registry

Each widget DXE registers a small API struct under a name during wgtRegister(). Callers retrieve it via wgtGetApi("button") and cast to the widget-specific API type. Per-widget headers provide typed accessors so callers avoid manual casts. Adding a new widget requires zero changes to the core.

Widget Interface Descriptors (WgtIfaceT)

Each widget can register an interface descriptor that describes its BASIC-facing properties, methods, and events. These descriptors are used by the form runtime and IDE for generic dispatch and property panel enumeration. Properties have typed getters/setters (WGT_IFACE_STRING, WGT_IFACE_INT, WGT_IFACE_BOOL, WGT_IFACE_ENUM).

DXE Module System

DXE Module System

DVX uses DJGPP's DXE3 (Dynamic eXtension) format for all loadable modules. DXE3 supports RTLD_GLOBAL symbol sharing -- symbols exported by one module are visible to all subsequently loaded modules. This is critical: widget DXEs call core API functions (e.g. rectFill, wgtInvalidate) that are exported by the core library DXE.

Module Types

  Extension  Directory   Purpose                                             Examples
  ---------  ---------   -------                                             --------
  .lib       LIBS/       Core libraries loaded first. Provide infrastructure APIs.  libtasks.lib, libdvx.lib, dvxshell.lib
  .wgt       WIDGETS/    Widget type plugins. Each exports wgtRegister().    button.wgt, listview.wgt, terminal.wgt
  .app       APPS/*/     Application modules. Each exports appDescriptor and appMain(). Loaded on demand by the shell.  progman.app, notepad.app, cpanel.app

Boot Sequence

  dvx.exe (loader)
     |
     +-- Enter VGA mode 13h, display splash screen with progress bar
     |
     +-- Scan LIBS/ for *.lib, WIDGETS/ for *.wgt
     |
     +-- Read .dep files for each module (dependency base names)
     |
     +-- Topological sort: load modules in dependency order
     |     - dlopen() with RTLD_GLOBAL
     |     - Each .wgt that exports wgtRegister() has it called
     |
     +-- Find and call shellMain() (exported by dvxshell.lib)
           |
           +-- dvxInit() -- video mode, input, font, colors, cursors
           |
           +-- Load desktop app (progman.app)
           |
           +-- Main loop:
                 dvxUpdate() -> tsYield() -> shellReapApps()

Application Lifecycle

Two kinds of DXE apps:

Callback-only (hasMainLoop = false)

appMain() creates windows, registers callbacks, and returns. The app lives through GUI callbacks driven by the shell's main loop. Lifecycle ends when the last window is closed. No extra task stack needed -- simpler and cheaper.

Main-loop (hasMainLoop = true)

A dedicated cooperative task is created. appMain() runs in that task with its own loop, calling tsYield() to share CPU. Needed for apps with continuous work (terminal emulators, games). Lifecycle ends when appMain() returns.

Crash Recovery

The platform layer installs signal handlers for SIGSEGV, SIGFPE, SIGILL. On crash, the handler logs platform-specific diagnostics (register dump on DJGPP), then longjmps back to the shell's main loop. The crashed app is killed; other apps and the shell survive. This provides Windows 3.1-style fault tolerance.

Per-App Memory Tracking

All allocations route through dvxMalloc/dvxFree wrappers that prepend a 16-byte header recording the owning app ID and allocation size. The Task Manager displays per-app memory usage, and leaks are detected at app termination.

Event Model

Event Model

DVX uses a cooperative polling model. The main loop (dvxRun / dvxUpdate) runs this cycle each frame:

Yield -- platformYield() or idle callback.

Event Dispatch Chain

  Mouse/Keyboard Input
       |
  Global handlers (Ctrl+Esc, modal filter)
       |
  Accelerator table check (focused window)
       |
  Window callback (onMouse / onKey)
       |
  [If widget tree installed:]
       |
  widgetOnMouse / widgetOnKey
       |
  Widget hit test (widgetHitTest)
       |
  wclsOnMouse / wclsOnKey (vtable dispatch)
       |
  Universal callbacks (onClick, onChange, etc.)

Accelerator Tables

Per-window accelerator tables map key + modifier combinations to command IDs. The runtime normalizes key/modifier at registration time (uppercase key, strip shift from modifiers) so matching at dispatch time is two integer comparisons per entry. Matched accelerators fire the window's onMenu callback with the command ID, unifying the menu and hotkey code paths.

Mouse Cursor

Software-rendered cursor using the classic AND/XOR mask approach. Seven cursor shapes are compiled in: arrow, horizontal resize, vertical resize, NW-SE diagonal resize, NE-SW diagonal resize, busy (hourglass), and crosshair. The cursor is painted into the backbuffer on top of the composited frame and the affected region is flushed to the LFB each frame.

Double-Click Detection

Timestamp-based: two clicks on the same target (title bar, minimized icon, close gadget) within the configurable double-click interval trigger the double-click action. Separate tracking for each target type.

Font System

Font System

DVX uses fixed-width 8-pixel-wide bitmap fonts only. One size is provided: 8x16, matching the standard VGA ROM font and CP437 encoding (256 glyphs).

BitmapFontT

  typedef struct {
      int32_t        charWidth;    // fixed width per glyph (always 8)
      int32_t        charHeight;   // 16
      int32_t        firstChar;    // typically 0
      int32_t        numChars;     // typically 256
      const uint8_t *glyphData;    // packed 1bpp, charHeight bytes per glyph
  } BitmapFontT;

Design rationale:

8-pixel width aligns with byte boundaries -- no bit shifting in per-scanline rendering.

Text Rendering Functions

drawChar() -- Renders a single character. Supports opaque (background fill) and transparent modes.

drawTextN() -- Optimized batch rendering for a known character count. Clips once for the entire run, fills background in a single rectFill, then overlays glyph foreground pixels. Significantly faster than per-character rendering for long runs.

drawTermRow() -- Renders an 80-column terminal row in a single pass, with per-cell foreground/background from a 16-color palette, blink attribute support, and cursor rendering. Exists because per-character terminal rendering is unacceptably slow on target hardware.

drawTextAccel() -- Renders text with & accelerator markers. The character after & is underlined to indicate the keyboard shortcut.

Performance Optimization

AppContextT stores a fixed-point 16.16 reciprocal of font.charHeight (charHeightRecip) so that dividing by charHeight (for pixel-to-row conversion in terminal/text widgets) becomes a multiply+shift instead of an integer divide, which costs 40+ cycles on a 486.

Color System

Color System

Pixel Format

PixelFormatT describes the active VESA mode's pixel encoding. Populated once from the VBE mode info block. Stores shift, mask, and bit count for each channel so packColor() can convert RGB to native format with shift-and-mask arithmetic -- no per-pixel computation.

Supported depths:

  Depth    Bytes/Pixel  Notes
  -----    -----------  -----
  8 bpp    1            Palette mode. Nearest-index via 6x6x6 color cube + grey ramp.
  15 bpp   2            5-5-5 RGB (1 bit unused).
  16 bpp   2            5-6-5 RGB.
  32 bpp   4            8-8-8 RGB (8 bits unused).

ColorSchemeT -- Theming

All 20 UI colors are pre-packed into display pixel format at init time. Every color is a uint32_t that can be written directly to the framebuffer with zero per-pixel conversion. The scheme must be regenerated on video mode change, but mode changes require re-init anyway.

Color roles mirror classic Motif/Windows 3.x conventions:

cursorFg/Bg -- mouse cursor colors

Source RGB values are kept in AppContextT.colorRgb[] for theme save/load. Themes are stored as INI files with a [colors] section. The API provides dvxLoadTheme(), dvxSaveTheme(), dvxSetColor(), and dvxResetColorScheme().

Bevel Styles

Bevels are the defining visual element of the Motif aesthetic. Convenience macros create bevel style descriptors by swapping highlight and shadow colors:

  BEVEL_RAISED(colorScheme, borderWidth)       -- raised 3D look
  BEVEL_SUNKEN(colorScheme, face, borderWidth) -- sunken/inset look
  BEVEL_TROUGH(colorScheme)                    -- 1px scrollbar trough
  BEVEL_SB_BUTTON(colorScheme)                 -- scrollbar button

Platform Layer

Platform Layer

All OS-specific and CPU-specific code is isolated behind dvxPlatform.h. To port DVX, implement a new dvxPlatformXxx.c against this header.

Implementations

  File                Target        Details
  ----                ------        -------
  dvxPlatformDos.c    DJGPP/DPMI    Real VESA VBE, INT 33h mouse, INT 16h keyboard, rep movsd/rep stosl asm spans, DPMI physical memory mapping for LFB, INT 9 hook for key-up, CuteMouse Wheel API.

Abstraction Areas

Video

platformVideoInit() -- mode probe and framebuffer setup. platformVideoShutdown() -- restore previous mode. platformVideoEnumModes() -- enumerate available modes.

Framebuffer Flush

platformFlushRect() -- copy dirty rect from backBuf to LFB. On DOS, each scanline uses rep movsd for near-optimal aligned 32-bit writes over the PCI bus.

Optimized Memory Spans

Six functions: platformSpanFill8/16/32() and platformSpanCopy8/16/32(). Called once per scanline of every rectangle fill, blit, and text draw. On DOS these use inline assembly for critical inner loops.

Mouse Input

Polling model. platformMousePoll() returns position and button bitmask. Wheel support via CuteMouse API.

Keyboard Input

platformKeyboardRead() -- non-blocking key read. platformKeyUpRead() -- key release detection (requires INT 9 hook on DOS). platformAltScanToChar() -- scancode-to-ASCII lookup for Alt+key combinations.

Crash Recovery

platformInstallCrashHandler() -- signal handlers + longjmp for fault tolerance.

DXE Support

platformRegisterDxeExports() -- register C runtime and platform symbols for DXE resolution. platformRegisterSymOverrides() -- register function pointer overrides for module loader.

Build System

Build System

Cross-Compilation

DVX is cross-compiled from Linux using a DJGPP cross-compiler (i586-pc-msdosdjgpp-gcc). The top-level Makefile orchestrates building all subsystems in dependency order.

  make               -- build everything
  ./mkcd.sh          -- build + create ISO for 86Box

Build Targets

  all: core tasks loader texthelp listhelp tools widgets shell taskmgr serial sql apps
  Target     Output                    Description
  ------     ------                    -----------
  core       bin/libs/libdvx.lib       GUI core library (draw, comp, wm, app, widget infrastructure)
  tasks      bin/libs/libtasks.lib     Cooperative task switcher
  loader     bin/dvx.exe               Bootstrap loader (the DOS executable)
  widgets    bin/widgets/*.wgt         29 widget type plugins
  shell      bin/libs/dvxshell.lib     DVX Shell (app management, desktop)
  taskmgr    bin/libs/taskmgr.lib      Task Manager (loaded as a separate DXE)
  texthelp   shared library            Shared text editing helpers (clipboard, word boundaries)
  listhelp   shared library            Shared dropdown/list helpers
  apps       bin/apps/*/*.app          Application modules (progman, notepad, clock, etc.)
  tools      bin/dvxres                Resource compiler (runs on Linux, builds resource sections into DXEs)
  serial     serial DXE libs           UART driver, HDLC packets, security, seclink
  sql        SQL DXE lib               SQLite integration

DXE3 Build Process

Each DXE module is compiled to an object file with GCC, then linked with dxe3gen:

  # Compile
  i586-pc-msdosdjgpp-gcc -O2 -march=i486 -mtune=i586 -c -o widget.o widget.c

  # Link as DXE with exported symbols
  dxe3gen -o widget.wgt -E _wgtRegister -U widget.o

  # Optionally append resources
  dvxres build widget.wgt widget.res

The -E flag specifies exported symbols (prefixed with underscore per DJGPP convention). -U marks unresolved symbols as OK (they'll be resolved at load time from previously loaded DXEs).

Deployment (mkcd.sh)

Places the ISO at ~/.var/app/net._86box._86Box/data/86Box/dvx.iso for 86Box to mount as CD-ROM.

Compiler Flags

  -O2                  Optimization level 2
  -march=i486          486 instruction set baseline
  -mtune=i586          Optimize scheduling for Pentium
  -Wall -Wextra        Full warnings

Directory Layout

  dvxgui/
  +-- core/              Core library sources (dvxVideo, dvxDraw, dvxComp, dvxWm, dvxApp, widget infra)
  |   +-- platform/      Platform abstraction (dvxPlatform.h, dvxPlatformDos.c)
  |   +-- thirdparty/    stb_image, stb_ds, stb_image_write
  +-- loader/            Bootstrap loader (dvx.exe)
  +-- tasks/             Cooperative task switcher (libtasks.lib)
  +-- shell/             DVX Shell (dvxshell.lib)
  +-- widgets/           Widget DXE modules (*.wgt), each in its own subdirectory
  |   +-- box/           VBox/HBox layout containers
  |   +-- button/        Push button
  |   +-- textInput/     Text entry field
  |   +-- listView/      Multi-column list
  |   +-- ...            (29 widget types total)
  +-- texthelp/          Shared text editing helpers
  +-- listhelp/          Shared dropdown/list helpers
  +-- apps/              Application DXE modules (*.app)
  |   +-- progman/       Program Manager (desktop)
  |   +-- notepad/       Text editor
  |   +-- cpanel/        Control Panel
  |   +-- imgview/       Image viewer
  |   +-- clock/         Clock
  |   +-- dvxdemo/       Demo / showcase app
  |   +-- dvxbasic/      DVX BASIC compiler and VM
  +-- tools/             Build tools (dvxres resource compiler)
  +-- rs232/             ISR-driven UART driver
  +-- packet/            HDLC framing, CRC-16, sliding window
  +-- security/          DH key exchange, XTEA cipher, DRBG RNG
  +-- seclink/           Encrypted channel wrapper
  +-- serial/            Combined serial stack DXE
  +-- proxy/             Linux proxy (86Box <-> secLink <-> telnet)
  +-- sql/               SQLite integration
  +-- bin/               Build output (dvx.exe, libs/, widgets/, apps/, config/)
  +-- obj/               Intermediate object files
  +-- docs/              Documentation