OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
hdma.h
Go to the documentation of this file.
1
97
98#ifndef OPENSNES_HDMA_H
99#define OPENSNES_HDMA_H
100
101#include <snes/types.h>
102
103/*============================================================================
104 * HDMA Channel Definitions
105 *============================================================================*/
106
108#define HDMA_CHANNEL_0 0
110#define HDMA_CHANNEL_1 1
112#define HDMA_CHANNEL_2 2
114#define HDMA_CHANNEL_3 3
116#define HDMA_CHANNEL_4 4
118#define HDMA_CHANNEL_5 5
120#define HDMA_CHANNEL_6 6
123#define HDMA_CHANNEL_7 7
124
125/*============================================================================
126 * HDMA Transfer Modes
127 *============================================================================*/
128
135#define HDMA_MODE_1REG 0x00
136
143#define HDMA_MODE_2REG 0x01
144
151#define HDMA_MODE_1REG_2X 0x02
152
159#define HDMA_MODE_2REG_2X 0x03
160
167#define HDMA_MODE_4REG 0x04
168
181#define HDMA_INDIRECT 0x40
182
183/*============================================================================
184 * Common Destination Registers
185 *============================================================================*/
186
188#define HDMA_DEST_CGADD 0x21
189
191#define HDMA_DEST_CGDATA 0x22
192
194#define HDMA_DEST_BG1HOFS 0x0D
195
197#define HDMA_DEST_BG1VOFS 0x0E
198
200#define HDMA_DEST_BG2HOFS 0x0F
201
203#define HDMA_DEST_BG2VOFS 0x10
204
206#define HDMA_DEST_BG3HOFS 0x11
207
209#define HDMA_DEST_BG3VOFS 0x12
210
212#define HDMA_DEST_WH0 0x26
213
215#define HDMA_DEST_WH1 0x27
216
218#define HDMA_DEST_COLDATA 0x32
219
221#define HDMA_DEST_INIDISP 0x00
222
224#define HDMA_DEST_M7A 0x1B
225
227#define HDMA_DEST_M7B 0x1C
228
230#define HDMA_DEST_M7C 0x1D
231
233#define HDMA_DEST_M7D 0x1E
234
235/*============================================================================
236 * Core HDMA Functions
237 *============================================================================*/
238
255void hdmaSetup(u8 channel, u8 mode, u8 destReg, const void *table);
256
270void hdmaSetupBank(u8 channel, u8 mode, u8 destReg, const void *table, u8 bank);
271
293void hdmaSetupIndirect(u8 channel, u8 mode, u8 destReg, const void *table,
294 u8 dataBank);
295
308void hdmaEnable(u8 channelMask);
309
317void hdmaDisable(u8 channelMask);
318
324void hdmaDisableAll(void);
325
332
342void hdmaSetTable(u8 channel, const void *table);
343
344/*============================================================================
345 * HDMA Effect Helpers
346 *============================================================================*/
347
360void hdmaParallax(u8 channel, u8 bg, const void *scrollTable);
361
374void hdmaGradient(u8 channel, const void *colorTable);
375
388void hdmaWindowShape(u8 channel, const void *windowTable);
389
390/*============================================================================
391 * HDMA Wave Effect Functions
392 *============================================================================*/
393
400void hdmaWaveInit(void);
401
426void hdmaWaveH(u8 channel, u8 bg, u8 amplitude, u8 frequency);
427
436void hdmaWaveUpdate(void);
437
443void hdmaWaveStop(void);
444
451extern u8 hdma_wave_speed;
452inline void hdmaWaveSetSpeed(u8 speed) {
453 hdma_wave_speed = speed;
454}
455
456/*============================================================================
457 * HDMA Brightness Gradient
458 *============================================================================*/
459
477void hdmaBrightnessGradient(u8 channel, u8 topBrightness, u8 bottomBrightness);
478
485
486/*============================================================================
487 * HDMA Color Gradient
488 *============================================================================*/
489
511void hdmaColorGradient(u8 channel, u8 colorIndex, u16 topColor, u16 bottomColor);
512
519
520/*============================================================================
521 * HDMA Iris Wipe (Circular Window)
522 *============================================================================*/
523
553void hdmaIrisWipe(u8 channel, u8 layers, u8 centerX, u8 centerY, u8 radius);
554
563void hdmaIrisWipeStop(u8 channel);
564
565/*============================================================================
566 * HDMA Water Ripple
567 *============================================================================*/
568
595void hdmaWaterRipple(u8 channel, u8 bg, u8 amplitude, u8 speed);
596
597#endif /* OPENSNES_HDMA_H */
static const BgAsset bg
Definition main.c:44
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 hdmaEnable(u8 channelMask)
Enable HDMA channel(s).
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 hdmaIrisWipeStop(u8 channel)
Stop iris wipe effect and restore window registers.
void hdmaWaveSetSpeed(u8 speed)
Definition hdma.h:452
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 hdmaSetupBank(u8 channel, u8 mode, u8 destReg, const void *table, u8 bank)
Set up an HDMA channel with explicit source bank byte.
u8 hdma_wave_speed
Set wave speed.
void hdmaDisable(u8 channelMask)
Disable HDMA channel(s).
void hdmaColorGradientStop(u8 channel)
Stop color gradient effect.
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 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.