From c1bbc27af64a181eb7e7d7d312a32c9a9d8ab3a7 Mon Sep 17 00:00:00 2001 From: Kyle Cardoza Date: Sun, 24 Mar 2024 15:58:14 -0400 Subject: [PATCH] Work on fleshing out sections --- Audio & Video.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Audio & Video.md b/Audio & Video.md index 5cfff15..c921a40 100644 --- a/Audio & Video.md +++ b/Audio & Video.md @@ -120,7 +120,11 @@ If the value in `INCR0` is nonzero, then after reading or writing from or to `DA ### CTRL -The `CTRL` register, located at `0x00DF05`, contains three significant bits: bit 0, called `ADDRSEL`, determines which `DATAx` register the `ADDRx` registers refer to. Bit 1, called `DCSEL`, controls which set of registers are accessed at addresses `0x00DF09` through `0x00DF0C`. Bit 7, called `RESET`, will reset VERA to the initial power-on state when a `1` value is written to it. +The `CTRL` register, located at `0x00DF05`, contains three significant bits: + +- Bit 0, called `ADDRSEL`, determines which `DATAx` register the `ADDRx` registers refer to. +- Bit 1, called `DCSEL`, controls which set of registers are accessed at addresses `0x00DF09` through `0x00DF0C`. +- Bit 7, called `RESET`, will reset VERA to the initial power-on state when a `1` value is written to it. ### IEN @@ -359,21 +363,25 @@ The bitmap address of a sprite is the top 12 bits of a 17-bit VERA memory addres The X and Y positions are 10-bit numbers representing the offset from the screen origin of the sprite's origin. -`FIXME: How does the collision mask work?` +The four-bit collision mask is used in detecting collisions between sprites in hardware. When two sprites' defined areas on screen overlap, their collision masks are used as operands in a binary AND operation; if the result is nonzero, then the collision will trigger a sprite collision interrupt if that interrupt source is enabled. Thus, a sprite with a collision mask of `0b0101` can trigger interrupts by colliding with sprites whose interrupt masks have bit 0, bit 2, or both set, regardless of the status of the other two bits. This makes sprite collision more efficient, by allowing groups of sprites which can and cannot detect collision with rach other to be defined, saving time resolving needless collisions. The layer position value determines the drawing order of the sprite relative to the two tile/bitmap layers: -| Value | Description | -| :---: | :------------: | -| 0 | Disabled | +| Value | Description | +| :---: | :-----------------------------: | +| 0 | Disabled | | 1 | Between background and layer 0 | -| 2 | Between layer 0 and 1 | -| 3 | Above layer 1 | +| 2 | Between layer 0 and 1 | +| 3 | Above layer 1 | The horizontal and vertical flip bits, as you would expect, flip the sprite's bitmap along the horizontal and vertical axes, respectively. The palette offset is used to translate colour values from the sprite bitmap data, where those values are between 1 and 15. Such values are modified by adding the product of 16 and the palette offset. +## Sprite Multiplexing + +While it should rarely be necessary, the presence of the raster line interrupt does allow for the re-use of sprites during the rendering of a single frame; the maximum number of effective sprites possible on screen in a single frame has not been experimentally demonstrated. + ## 16-Bit Reads/Writes With appropriate configuration of registers, it is possible to perform sequential 16-bit reads and writes to VERA address space: