OpenSNES
Modern Open-Source SNES Development SDK
Loading...
Searching...
No Matches
dsp1.h
Go to the documentation of this file.
1
49#ifndef SNES_DSP1_H
50#define SNES_DSP1_H
51
52#include <snes/types.h>
53
54/* Removed on 2026-10-05 (1.0 plan, lot C): dsp1Parameter, dsp1Present.
55 * The replacements are in docs/UPGRADING.md; `make check-upgrade` names them. */
56
63extern volatile s16 dsp1_o0;
64extern volatile s16 dsp1_o1;
65extern volatile s16 dsp1_o2;
66extern volatile s16 dsp1_o3;
67
77#define DSP1_T_FROM_FIX(f) ((s16)((s16)(f) << 7))
81#define DSP1_FIX_FROM_T(t) ((s16)((s16)(t) >> 7))
83#define DSP1_A_FROM_FIX8(a) ((u16)((u16)(u8)(a) << 8))
85
94void dsp1Init(void);
95
108
116void dsp1Triangle(u16 angle, s16 radius);
117
129
141void dsp1Attitude(u16 scale, u16 az, u16 ay, u16 ax);
142
153void dsp1Objective(s16 x, s16 y, s16 z);
154
171
192
204void dsp1Project(s16 x, s16 y, s16 z);
205
217void dsp1Target(s16 h, s16 v);
218
247void dsp1Raster(u8 FAR *ab, u8 FAR *cd, s16 vs, u16 count);
248
273
298
310
311#endif /* SNES_DSP1_H */
void dsp1Init(void)
Resynchronise the DSP-1 to a known command-wait state.
s16 dsp1Range(s16 x, s16 y, s16 z, u16 r)
Sphere test (DSP-1 command $18, "Range").
volatile s16 dsp1_o1
void dsp1Triangle(u16 angle, s16 radius)
Scaled sine and cosine of an angle (DSP-1 command $04, "Triangle").
void dsp1Objective(s16 x, s16 y, s16 z)
Transform a point by matrix A: local → world (DSP-1 command $0D, "Objective").
void dsp1Project(s16 x, s16 y, s16 z)
Project a world point to the screen (DSP-1 command $06, "Project").
void dsp1Attitude(u16 scale, u16 az, u16 ay, u16 ax)
Build a 3D rotation matrix into slot A (DSP-1 command $01, "Attitude").
volatile s16 dsp1_o0
Multi-word DSP-1 result registers (written by multi-output commands).
void dsp1Target(s16 h, s16 v)
Screen point → ground plane (DSP-1 command $0E, "Target").
volatile s16 dsp1_o2
u8 dsp1IsPresent(void)
Is a DSP-1 responding? Known-answer self-test.
s16 dsp1Multiply(s16 a, s16 b)
Signed 1.15 × 1.15 multiply (DSP-1 command $00).
void dsp1Rotate(u16 angle, s16 x, s16 y)
Rotate a 2D point about the origin (DSP-1 command $0C, "Rotate").
void dsp1Raster(u8 FAR *ab, u8 FAR *cd, s16 vs, u16 count)
Stream per-scanline Mode 7 matrices into two HDMA payloads (DSP-1 command $0A, "Raster").
volatile s16 dsp1_o3
void dsp1SetCamera(const Dsp1Camera *cam)
Set up the projection plane (DSP-1 command $02, "Parameter").
u16 dsp1Distance(s16 x, s16 y, s16 z)
Euclidean length of a 3D vector (DSP-1 command $28, "Distance").
static u16 b
Definition main.c:156
static u16 a
Definition main.c:156
signed short s16
16-bit signed integer (-32768 to 32767)
Definition types.h:50
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
#define FAR
Place a global in bank $7E WRAM, outside the 8 KB bank-0 band.
Definition types.h:130
static Dsp1Camera cam
The camera: position on the ground plane (x, y wrap with the 1024-unit texture), height,...
Definition main.c:95
static u16 angle
Mode 7 ground: 9-tile prefab track (original art).
Definition main.c:46
The camera of the projection: the seven inputs of DSP-1 command $02, "Parameter", under their names i...
Definition dsp1.h:162
s16 les
Definition dsp1.h:167
s16 z
Definition dsp1.h:165
u16 azs
Definition dsp1.h:169
s16 y
Definition dsp1.h:164
u16 aas
Definition dsp1.h:168
s16 x
Definition dsp1.h:163
s16 lfe
Definition dsp1.h:166
OpenSNES Standard Types.