Project: SCUMM Adventure Editor → DOS Motor (Electron + C/Watcom)
Target: 486DX2 @ 66MHz, 8MB RAM, DOS4GW
Tech: React 18 + Zustand | C (wcc386) | Open Watcom 2.0 | MPU-401 audio
Generate code for Electron editor + DOSBox-runnable GAME.EXE + binary GAME.DAT. Audio via native MPU-401 driver (no external libs).
| What | Value | Impact |
|---|---|---|
| CPU | 486DX2 66MHz (27 MIPS) | No complex loops; precomputed tables |
| RAM | 8MB (7.3MB extended) | DAT < 2MB; stack over malloc |
| Video | VGA 13h (320×200×256) | 64KB framebuffer only |
| Timer | 18.2 Hz ISR | Chain interrupts; don't replace |
| Audio | MPU-401 @ 0x330 | Non-blocking queue (32 bytes/frame max) |
Always loaded:
- This file
Loaded when you ask about keywords:
documentation/FETCH-SYSTEM.md— Q&A lookup | audio, MIDI, compile, DAT, motordocumentation/CONTEXT7-AGEMKI.md— Architecture | "how does", structure, designdocumentation/AUDIO-GUIDE.md— Audio spec | OPL, soundcard, MIDI multi-tarjeta
On-demand:
src/main/dat/AGEMKI_DAT_SPEC.md— DAT binary formatdocumentation/INDEX.md— Navigation guidedocumentation/legacy/— Reference docs
- Editor (
src/renderer/) — React + Zustand (UI, game design) - Build (
src/main/) — Node.js codegen → C code + DAT binary - Motor (
resources/engine/) — C + asm, VGA/input/pathfind/inventory - Audio (
resources/engine/mididrv.c) — MPU-401 driver, interrupt-chained
Editor → JSON → codegen (Node.js) → C code + GAME.DAT
↓
wcc386 -bt=dos -6r -ox
wlink system dos4gw
↓
GAME.EXE (32-bit protected)
↓
DOSBox (mpu401=intelligent)
- ISR chain broken → Motor hangs
- Shared inventory buffers → Sprites corrupt
- DAT chunks unsorted → Binary search fails
- AUDIO.DAT in XMI → No sound (use MIDI)
- DOSBox without mpu401=intelligent → No audio
- Blocking loops in script → Input freezes
- Watcom without DOS4GW → Won't run
- PCX > 256×256 → Memory overflow
- C: No stdlib; use Watcom pragmas + inline asm; chain ISR
- JS: React hooks, Zustand patterns, template strings for C codegen
- DAT: Match AGEMKI_DAT_SPEC.md exactly (sorted chunks, CRC32)
- Audio: MIDI via
mididrv.cAPI (non-blocking)
| File | Purpose | Action |
|---|---|---|
src/main/index.js |
Build init | ✅ Modify |
src/main/datGenerator.js |
DAT writer | ✅ Modify |
resources/engine/agemki_engine.c |
Motor core | ✅ Add handlers |
resources/engine/mididrv.c |
Audio API | |
resources/engine/mpu.c |
MPU-401 HW | ❌ Frozen |
documentation/ |
Refs | ❌ Read-only |
🔗 For questions: Check FETCH-SYSTEM.md first (< 10s). Then CONTEXT7-AGEMKI.md if needed.
- Understood 486DX2 + 8MB constraints?
- Read CONTEXT7-AGEMKI.md overview?
- Checked FETCH-SYSTEM.md for your question?
- If C code: DOS4GW compatible, no blocking calls, memory efficient?
- If DAT: chunks ordered, CRC32 valid, AGEMKI_DAT_SPEC.md compliant?
- If audio: using mididrv.c API, Format 0/1 MIDI, DOSBox configured?
# Build a game (from Windows)
npm run build
# Compile single C file with Watcom
wcc386 -bt=dos -6r -ox -w=3 file.c
# Link DOS4GW executable
wlink system dos4gw file.obj name file.exe
# Run in DOSBox-X (with mpu401=intelligent in config)
dosbox-x GAME.EXE
# Generate GAME.DAT (inside editor → Build button)
# → calls datGenerator.js → outputs GAME.DAT to build/
# Generate main.c with handlers
# → called from src/main/index.js during buildAny code you generate should:
- ✅ Compile cleanly with
wcc386 -bt=dos - ✅ Run in DOS (tested in DOSBox-X)
- ✅ Respect 8MB RAM limit
- ✅ Chain interrupts (don't replace ISR)
- ✅ Use non-blocking I/O where possible
- ✅ Follow AGEMKI naming conventions (g_* for globals, engine_* for API)
- ✅ Match style of existing agemki_engine.c code
- ✅ Include comments explaining hardware constraints
Configuration Version: v32 — March 2026
Last Updated: 2026-03-26
Maintainer: AGEMKI Development Team