Mode 7 rotation and scaling demo. More...
Functions | |
| int | main (void) |
| Mode 7 tile pixel data (256 tiles x 64 bytes, 8bpp), from data.asm. | |
Mode 7 rotation and scaling demo.
Demonstrates SNES Mode 7, the hardware affine transformation mode that applies a 2x2 matrix (rotation + scaling) to a single 128x128 tile background layer. Mode 7 uses a unique interleaved VRAM format where tilemap bytes occupy the low bytes and 8bpp tile pixel data occupies the high bytes of each VRAM word. The transformation matrix is controlled via registers M7A-M7D, with the library's mode7SetAngle() and mode7SetScale() computing the sin/cos matrix entries from an 8-bit angle and 8.8 fixed-point scale factors.
| int main | ( | void | ) |
Mode 7 tile pixel data (256 tiles x 64 bytes, 8bpp), from data.asm.
Mode 7 tilemap (128x128 tile indices, one byte each), from data.asm.
256-colour palette for the Mode 7 plane (512 bytes), from data.asm.
Entry point – interactive Mode 7 rotation and scaling demo.
Initializes the Mode 7 plane with an image, then allows the user to rotate (A/B buttons) and zoom (D-pad UP/DOWN) in real time. The transformation matrix is updated each frame via mode7SetAngle() and mode7SetScale(), which compute sin/cos values and write to the M7A-M7D hardware registers.
< Current joypad button state
< Rotation angle (0-255 maps to 0-360 degrees)
< Zoom level in 8.8 fixed-point (1.0 = 1:1, higher = more zoomed out)