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
139#define HDMA_CHANNEL_7 7
140
141/*============================================================================
142 * HDMA Transfer Modes
143 *============================================================================*/
144
151#define HDMA_MODE_1REG 0x00
152
159#define HDMA_MODE_2REG 0x01
160
167#define HDMA_MODE_1REG_2X 0x02
168
175#define HDMA_MODE_2REG_2X 0x03
176
183#define HDMA_MODE_4REG 0x04
184
197#define HDMA_INDIRECT 0x40
198
199/*============================================================================
200 * Common Destination Registers
201 *============================================================================*/
202
204#define HDMA_DEST_CGADD 0x21
205
207#define HDMA_DEST_CGDATA 0x22
208
210#define HDMA_DEST_BG1HOFS 0x0D
211
213#define HDMA_DEST_BG1VOFS 0x0E
214
216#define HDMA_DEST_BG2HOFS 0x0F
217
219#define HDMA_DEST_BG2VOFS 0x10
220
222#define HDMA_DEST_BG3HOFS 0x11
223
225#define HDMA_DEST_BG3VOFS 0x12
226
228#define HDMA_DEST_WH0 0x26
229
231#define HDMA_DEST_WH1 0x27
232
234#define HDMA_DEST_COLDATA 0x32
235
246#define HDMA_DEST_INIDISP 0x00
247
249#define HDMA_DEST_BGMODE 0x05
250
252#define HDMA_DEST_TM 0x2C
253
255#define HDMA_DEST_M7A 0x1B
256
258#define HDMA_DEST_M7B 0x1C
259
261#define HDMA_DEST_M7C 0x1D
262
264#define HDMA_DEST_M7D 0x1E
265
266/*============================================================================
267 * Core HDMA Functions
268 *============================================================================*/
269
286void hdmaSetup(u8 channel, u8 mode, u8 destReg, const void *table);
287
309void hdmaSetupIndirect(u8 channel, u8 mode, u8 destReg, const void *table,
310 u8 dataBank);
311
331void hdmaEnableMask(u8 channelMask);
332
340void hdmaDisableMask(u8 channelMask);
341
360void hdmaEnable(u8 channel);
361
370void hdmaDisable(u8 channel);
371
377void hdmaDisableAll(void);
378
385
395void hdmaSetTable(u8 channel, const void *table);
396
397/*============================================================================
398 * HDMA Effect Helpers
399 *============================================================================*/
400
413void hdmaParallax(u8 channel, u8 bg, const void *scrollTable);
414
427void hdmaGradient(u8 channel, const void *colorTable);
428
441void hdmaWindowShape(u8 channel, const void *windowTable);
442
443/*============================================================================
444 * HDMA Wave Effect Functions
445 *============================================================================*/
446
456void hdmaWaveInit(void);
457
482void hdmaWaveH(u8 channel, u8 bg, u8 amplitude, u8 frequency);
483
492void hdmaWaveUpdate(void);
493
504void hdmaWaveStop(void);
505
512
513/*============================================================================
514 * HDMA Brightness Gradient
515 *============================================================================*/
516
544void hdmaBrightnessGradient(u8 channel, u8 topBrightness, u8 bottomBrightness);
545
552
553/*============================================================================
554 * HDMA Color Gradient
555 *============================================================================*/
556
581void hdmaColorGradient(u8 channel, u8 colorIndex, u16 topColor, u16 bottomColor);
582
589
590/*============================================================================
591 * HDMA Iris Wipe (Circular Window)
592 *============================================================================*/
593
638void hdmaIrisWipe(u8 channel, u8 layers, u8 centerX, u8 centerY, u8 radius);
639
648void hdmaIrisWipeStop(u8 channel);
649
650/*============================================================================
651 * HDMA Water Ripple
652 *============================================================================*/
653
680void hdmaWaterRipple(u8 channel, u8 bg, u8 amplitude, u8 speed);
681
682#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.