OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
hdma.h
Go to the documentation of this file.
1
109
110#ifndef OPENSNES_HDMA_H
111#define OPENSNES_HDMA_H
112
113#include <snes/types.h>
114
115/* Removed on 2026-10-05 (1.0 plan, lot C): hdmaSetupBank.
116 * The replacements are in docs/UPGRADING.md; `make check-upgrade` names them. */
117
118/*============================================================================
119 * HDMA Channel Definitions
120 *============================================================================*/
121
123#define HDMA_CHANNEL_0 0
125#define HDMA_CHANNEL_1 1
127#define HDMA_CHANNEL_2 2
129#define HDMA_CHANNEL_3 3
131#define HDMA_CHANNEL_4 4
133#define HDMA_CHANNEL_5 5
135#define HDMA_CHANNEL_6 6
138#define HDMA_CHANNEL_7 7
139
140/*============================================================================
141 * HDMA Transfer Modes
142 *============================================================================*/
143
150#define HDMA_MODE_1REG 0x00
151
158#define HDMA_MODE_2REG 0x01
159
166#define HDMA_MODE_1REG_2X 0x02
167
174#define HDMA_MODE_2REG_2X 0x03
175
182#define HDMA_MODE_4REG 0x04
183
196#define HDMA_INDIRECT 0x40
197
198/*============================================================================
199 * Common Destination Registers
200 *============================================================================*/
201
203#define HDMA_DEST_CGADD 0x21
204
206#define HDMA_DEST_CGDATA 0x22
207
209#define HDMA_DEST_BG1HOFS 0x0D
210
212#define HDMA_DEST_BG1VOFS 0x0E
213
215#define HDMA_DEST_BG2HOFS 0x0F
216
218#define HDMA_DEST_BG2VOFS 0x10
219
221#define HDMA_DEST_BG3HOFS 0x11
222
224#define HDMA_DEST_BG3VOFS 0x12
225
227#define HDMA_DEST_WH0 0x26
228
230#define HDMA_DEST_WH1 0x27
231
233#define HDMA_DEST_COLDATA 0x32
234
236#define HDMA_DEST_INIDISP 0x00
237
239#define HDMA_DEST_BGMODE 0x05
240
242#define HDMA_DEST_TM 0x2C
243
245#define HDMA_DEST_M7A 0x1B
246
248#define HDMA_DEST_M7B 0x1C
249
251#define HDMA_DEST_M7C 0x1D
252
254#define HDMA_DEST_M7D 0x1E
255
256/*============================================================================
257 * Core HDMA Functions
258 *============================================================================*/
259
276void hdmaSetup(u8 channel, u8 mode, u8 destReg, const void *table);
277
299void hdmaSetupIndirect(u8 channel, u8 mode, u8 destReg, const void *table,
300 u8 dataBank);
301
321void hdmaEnableMask(u8 channelMask);
322
330void hdmaDisableMask(u8 channelMask);
331
350void hdmaEnable(u8 channel);
351
360void hdmaDisable(u8 channel);
361
367void hdmaDisableAll(void);
368
375
385void hdmaSetTable(u8 channel, const void *table);
386
387/*============================================================================
388 * HDMA Effect Helpers
389 *============================================================================*/
390
403void hdmaParallax(u8 channel, u8 bg, const void *scrollTable);
404
417void hdmaGradient(u8 channel, const void *colorTable);
418
431void hdmaWindowShape(u8 channel, const void *windowTable);
432
433/*============================================================================
434 * HDMA Wave Effect Functions
435 *============================================================================*/
436
446void hdmaWaveInit(void);
447
472void hdmaWaveH(u8 channel, u8 bg, u8 amplitude, u8 frequency);
473
482void hdmaWaveUpdate(void);
483
494void hdmaWaveStop(void);
495
502
503/*============================================================================
504 * HDMA Brightness Gradient
505 *============================================================================*/
506
530void hdmaBrightnessGradient(u8 channel, u8 topBrightness, u8 bottomBrightness);
531
538
539/*============================================================================
540 * HDMA Color Gradient
541 *============================================================================*/
542
570void hdmaColorGradient(u8 channel, u8 colorIndex, u16 topColor, u16 bottomColor);
571
578
579/*============================================================================
580 * HDMA Iris Wipe (Circular Window)
581 *============================================================================*/
582
630void hdmaIrisWipe(u8 channel, u8 layers, u8 centerX, u8 centerY, u8 radius);
631
640void hdmaIrisWipeStop(u8 channel);
641
642/*============================================================================
643 * HDMA Water Ripple
644 *============================================================================*/
645
672void hdmaWaterRipple(u8 channel, u8 bg, u8 amplitude, u8 speed);
673
674#endif /* OPENSNES_HDMA_H */
unsigned short u16
16-bit unsigned integer (0 to 65535)
Definition types.h:53
unsigned char u8
8-bit unsigned integer (0 to 255)
Definition types.h:47
void hdmaWaveStop(void)
Stop wave effect and disable HDMA channel.
void hdmaWaveInit(void)
Initialize HDMA wave effect system.
void hdmaWaveH(u8 channel, u8 bg, u8 amplitude, u8 frequency)
Set up horizontal wave effect (water reflection).
void hdmaSetupIndirect(u8 channel, u8 mode, u8 destReg, const void *table, u8 dataBank)
Configure an INDIRECT HDMA channel (table of pointers to data).
void hdmaGradient(u8 channel, const void *colorTable)
Set up a fixed color gradient effect.
void hdmaWaveUpdate(void)
Update wave animation.
void hdmaBrightnessGradient(u8 channel, u8 topBrightness, u8 bottomBrightness)
Create a vertical brightness gradient.
void hdmaEnableMask(u8 channelMask)
Enable HDMA channel(s), given as a bit mask.
void hdmaIrisWipeStop(u8 channel)
Stop iris wipe effect and restore window registers.
void hdmaWaveSetSpeed(u8 speed)
Set wave speed.
void hdmaSetTable(u8 channel, const void *table)
Update HDMA table pointer (for dynamic effects).
u8 hdmaGetEnabled(void)
Get currently enabled HDMA channels.
void hdmaColorGradient(u8 channel, u8 colorIndex, u16 topColor, u16 bottomColor)
Create a per-scanline CGRAM color gradient.
void hdmaWindowShape(u8 channel, const void *windowTable)
Set up window position HDMA for shape effects.
void hdmaColorGradientStop(u8 channel)
Stop color gradient effect.
void hdmaEnable(u8 channel)
Enable one HDMA channel, given by number.
void hdmaSetup(u8 channel, u8 mode, u8 destReg, const void *table)
Set up an HDMA channel.
void hdmaIrisWipe(u8 channel, u8 layers, u8 centerX, u8 centerY, u8 radius)
Create a circular window mask (iris/spotlight effect).
void hdmaDisableAll(void)
Disable all HDMA channels.
void hdmaBrightnessGradientStop(u8 channel)
Stop brightness gradient and restore full brightness.
void hdmaDisable(u8 channel)
Disable one HDMA channel, given by number.
void hdmaDisableMask(u8 channelMask)
Disable HDMA channel(s), given as a bit mask.
void hdmaParallax(u8 channel, u8 bg, const void *scrollTable)
Set up a background parallax scroll effect.
void hdmaWaterRipple(u8 channel, u8 bg, u8 amplitude, u8 speed)
Create a water ripple distortion effect.
OpenSNES Standard Types.