Ultima VI: The False Prophet:Notes

From Data Crystal
Jump to: navigation, search

Frame rules

The main game loop when adventuring spreads each game world update over 16 frames. The frame counter is stored in memory at 42 and is used by the function at 88BE to run a different function for each frame of the cycle.

Frame  Description
-----  -----------
    0  Handles player input (moves, opens menu, etc.)
    2  Updates sprites
    A  Updates sprites
    E  Uploads missing tiles to VRAM

DMA Operations

An array at A00 stores the queued DMA operations to be performed each frame. This is used for updating sprite positions, uploading tile graphics, etc. A pointer to the end of the array is stored in b5. Each item is 8 bytes:

Offset  Length  Description
------  ------  -----------
     0       2  Bytes to copy. 0 means this is the end of the list of DMA operations
     2       2  Destination address in VRAM / 2
     4       3  Source address in RAM
     7       1  DMA transfer mode (copied directly to the SNES.DMAP0 register, usually has value 01)

Mob rendering

An array at 500 stores the mobs to be rendered each frame. This data is later used by sprite render functions to create one or more tiles per mob in OAM to be rendered.

Each item is 8 bytes:

Offset  Length  Description
------  ------  -----------
     0       1  X position
     1       1  Sprite flags (flip, priority, palette)
     2       1  Y position + 1
     3       1
     4       1  Direction/animation data
     5       1  Sprite ID
     6       1  ?? Seems to be related to X position
     7       1  ?? Seems to be related to Y position

The render functions append tiles to an array at 1300 which is directly copied to OAM later in the frame.

Sprite IDs are associated with a graphics data, palette index, an animation function and a render function, which are described in the ROM Map.