Files
dusk/src/dusksat/display/displaysat.c
T
2026-06-19 14:24:09 -05:00

89 lines
2.3 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "display/displaysat.h"
#include "display/render/rendersat.h"
#include "display/display.h"
#include "assert/assert.h"
#include "log/log.h"
#include <vdp1/cmdt.h>
#include <vdp2/cram.h>
#include <vdp2/tvmd.h>
#include <vdp2/scrn.h>
#include <vdp2/vram.h>
errorret_t displaySaturnInit(void) {
logDebug("[Saturn] displaySaturnInit: start\n");
DISPLAY.whichBuffer = 0;
/*
* TV mode: NTSC, 320×224, non-interlaced.
* Yaul's vdp2_tvmd_display_res_set() configures the sync standard and
* horizontal/vertical resolution.
*
* TODO: replace with the Yaul typed call when integrating the full SDK:
* vdp2_tvmd_display_res_set(VDP2_TVMD_INTERLACE_NONE,
* VDP2_TVMD_HORZ_NORMAL_A,
* VDP2_TVMD_VERT_224);
* vdp2_tvmd_display_set();
*/
/*
* VDP2 scroll planes: disable all NBG/RBG planes for now; game content is
* drawn entirely via VDP1 sprites. Tilemap chunks will re-enable NBG0
* when the VDP2 tilemap backend is implemented.
*
* TODO:
* vdp2_scrn_display_set(VDP2_SCRN_DISP_NBG0, false);
* vdp2_scrn_display_set(VDP2_SCRN_DISP_NBG1, false);
* ...
*/
/*
* VDP1 initialisation: the hardware starts drawing from VRAM offset 0.
* We place our command table there and texture data afterward.
*
* TODO:
* vdp1_vram_partitions_set(
* VDP1_VRAM_CYCP_..., // cycle patterns
* ...
* );
*/
logDebug("[Saturn] displaySaturnInit: calling renderSaturnInit\n");
errorChain(renderSaturnInit());
logDebug("[Saturn] displaySaturnInit: done\n");
errorOk();
}
errorret_t displaySaturnFlush(ropbuffer_t *buf) {
assertNotNull(buf, "Saturn flush: null ropbuffer");
errorChain(renderSaturnFlush(buf));
errorOk();
}
errorret_t displaySaturnSwap(void) {
logDebug("[Saturn] displaySaturnSwap\n");
/*
* Wait for VDP1 to finish rendering the current frame then swap buffers.
*
* TODO:
* vdp1_sync_render();
* vdp1_sync();
* vdp2_sync();
* vdp2_sync_wait();
*/
DISPLAY.whichBuffer ^= 1;
errorOk();
}
void displaySaturnDispose(void) {
logDebug("[Saturn] displaySaturnDispose\n");
renderSaturnDispose();
}