Skip to content
Mildanner edited this page Nov 10, 2025 · 3 revisions

Ultra DMA Queue (by Flamewing)

The Ultra DMA Queue is an assembly language routine for the Sega Genesis that provides a highly optimized method for managing the console's DMA transfers. Developed by programmer Flamewing, it is widely used within the Genesis homebrew and ROM hacking communities, particularly in projects involving the Sonic the Hedgehog games.

Overview

The Sega Genesis's DMA controller is used to rapidly transfer data (such as tiles, palettes, and sound samples) from main memory (ROM or RAM) to the VDP or sound driver. Efficient use of DMA is crucial for performance in Genesis development. The Ultra DMA Queue is designed to minimize the CPU cycles required to queue a transfer, offering significant performance improvements over the stock DMA handling found in official games like Sonic 2 and Sonic 3 & Knuckles.

Key Features

  • High Optimization: The primary feature is its speed, achieved through highly efficient 68000 assembly code.
  • DMA Boundary Handling: Certain versions of the queue can automatically detect and split DMA transfers that cross 128 kB memory boundaries—a hardware quirk of the Genesis that can cause data corruption if not handled correctly. This provides a safer, automated solution compared to manually arranging data in ROM.
  • Flexibility: Compatible with various assemblers (such as the "AS" macro assembler) and configurable with different flags to suit specific project needs, such as ensuring safety for transfers from RAM sources.
  • Open Source: The code is open source and available on GitHub under a permissive 0BSD (BSD 0-Clause) license, allowing developers to freely use, modify, and distribute it (though attribution is appreciated).

Usage

Developers integrate the Ultra DMA Queue into their projects by including the assembly file and calling the provided initialization and queue functions. The function calls replace the standard methods for initiating DMA transfers, making it a drop-in replacement in many cases—though some adjustments may be required to how the queue is cleared in the existing codebase.

Credits

  • Flamewing: The creator and primary developer of the Ultra DMA Queue.
  • Community: The code is maintained and used by members of the Sonic Retro and Sonic Stuff Research Group communities.

Clone this wiki locally