DSP-1 pseudo-3D: a cube tumbling in 3D, rotated by the coprocessor. More...
Macros | |
| #define | CUBE_DIST 400 |
| Distance from the camera to the cube's centre, along the DSP-1's depth axis. Empirically characterised on luna (DSP-1B): with azs=0x4000 the projection looks along +Y — X is across, Z is up. Rotated corners span ±~139 (80·√3), so 400 keeps every corner in front of the eye. | |
| #define | VIEW_AZS 0x4000 |
| Screen-plane zenith angle: 0x4000 (90°) = horizontal view, +Y is the depth axis. The all-zero setup is degenerate (every point projects to the origin) — this angle is what makes the projection live. | |
| #define | VIEW_LES 256 |
| #define | VIEW_LFE 96 |
| dsp1SetCamera FOV knobs, tuned empirically on luna. The effective focal length is close to VIEW_LFE + VIEW_LES (projected offset ≈ (lfe+les)·x/y): 96+256 spreads the corners ±~92 px at CUBE_DIST 400 — filling the 224-line screen without clipping at the nearest swing. | |
Functions | |
| int | main (void) |
Variables | |
| static const s16 | cube [8][3] |
| static const u8 | dot_pal [4] = { 0x00, 0x00, 0xFF, 0x7F } |
| static const u8 | dot_tile [32] |
| volatile u16 | dsp1_ok = 0 |
| 1 when the DSP-1 answered the known-answer probe — parked in WRAM so the luna test manifest can assert it (coproc_dsp1.toml). | |
| static const Dsp1Camera | view |
| The fixed camera: at the origin, looking along +Y. | |
DSP-1 pseudo-3D: a cube tumbling in 3D, rotated by the coprocessor.
Each frame the DSP-1 builds a rotation matrix (dsp1Attitude), transforms the cube's 8 corners through it (dsp1Objective), and projects each corner onto the screen with true hardware perspective (dsp1Project, set up once by dsp1SetCamera). The corners are drawn as 8 sprites — all the 3D math, including the perspective divide, runs on the NEC uPD77C25, not the 65816.
| #define CUBE_DIST 400 |
Distance from the camera to the cube's centre, along the DSP-1's depth axis. Empirically characterised on luna (DSP-1B): with azs=0x4000 the projection looks along +Y — X is across, Z is up. Rotated corners span ±~139 (80·√3), so 400 keeps every corner in front of the eye.
| #define VIEW_AZS 0x4000 |
Screen-plane zenith angle: 0x4000 (90°) = horizontal view, +Y is the depth axis. The all-zero setup is degenerate (every point projects to the origin) — this angle is what makes the projection live.
| #define VIEW_LES 256 |
| #define VIEW_LFE 96 |
dsp1SetCamera FOV knobs, tuned empirically on luna. The effective focal length is close to VIEW_LFE + VIEW_LES (projected offset ≈ (lfe+les)·x/y): 96+256 spreads the corners ±~92 px at CUBE_DIST 400 — filling the 224-line screen without clipping at the nearest swing.
| int main | ( | void | ) |
|
static |
The cube's 8 corners in model space (DSP-1 integer coordinates).
|
static |
Two colours: index 0 transparent, index 1 white ($7FFF).
|
static |
8x8 4bpp tile, colour index 1 everywhere. In the SNES 4bpp layout planes 0/1 interleave per row, so plane 0 all-set is the ODD bytes 0,2,…,14.
| volatile u16 dsp1_ok = 0 |
1 when the DSP-1 answered the known-answer probe — parked in WRAM so the luna test manifest can assert it (coproc_dsp1.toml).
|
static |
The fixed camera: at the origin, looking along +Y.