VMU peripheral

From dreamcast.wiki
Jump to navigation Jump to search

The VMU peripheral on the Maple Bus contains 3 functions: screen, storage, and timer.

NOTE: Some information here is misleading and/or incomplete

Screen

The "block write" command (0x0C) with screen function code and 48 data words is used to write monochrome images to the screen. A screen is 48 bits wide and 32 bits tall. For each bit in the 48 data words, a value of 1 means the pixel is on (black) and 0 means the pixel is off (white). Data is written from left to right and top to bottom. The most significant bit of the first word sets the pixel on the top, left of the screen. The two most significant bytes write to the 33rd through 48th bit of the first row. The next two bytes write to the 1st through 16th bits of the second row. This is repeated for the rest of the 48 words like pictured below.

Dreamcast Screen Words

Storage

The "block read" and "block write" commands (0x0B and 0x0C) with storage function code are used to read and write blocks of memory in the storage peripheral.

Normally, there are 256 blocks of memory that make up the entire storage space, and normally each block consists of 512 bytes. That makes a total of 128 KB of memory. These values are configurable according to the Maple Bus spec, but anything other than these values are not practically usable by most games due to memory access APIs.[1]

Function Definition

The function definition may be found in the peripheral's device info packet. It is necessary to read this word to know how to access blocks of memory on the storage.

Byte 0 (LSB) Byte 1 Byte 2 Byte 3 (MSB)
bit 7: removable (1: true)
bit 6: CRC (1: needed)
bits 0-5: unused (0)
bits 4-7: number of write accesses per block
bits 0-3: number of read accesses per block
number of bytes per block
(x + 1)*32 bytes
number of partitions

Block Read

Execute a sequence of block reads to read data from storage. The number of sequences is dependent on the number of read accesses per block defined in the function definition above. On successful execution, a data transfer packet will be returned.

Block Write

Execute a sequence of block writes to write data to storage. The number of sequences is dependent on the number of write accesses per block defined in the function definition above. On successful execution, a acknowledge packet will be returned. After the final write sequence, execute a get last error command with an incremented phase value to commit the block from RAM to storage.

  • A VMU cannot handle successive block write packets faster than about 10 ms per write
    • After such error, the storage functionality acts as if it never received this sequence and never returns a response packet - it may be possible to successfully resend this sequence, but writing a "get last error" command would be necessary before starting over at the first sequence

Timer

The timer function allows the host to activate the buzzer on the VMU and get button conditions.

References

  1. [1] TapamN | 400 block VMU on emulator