From 4f1275708c60e7b582a3e5a02fac4ee0300a9999 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Wed, 12 Oct 2016 09:39:52 -0700 Subject: Initial implementation of video output hardware --- jaguar.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'jaguar.c') diff --git a/jaguar.c b/jaguar.c index 76ba875..ba5c779 100644 --- a/jaguar.c +++ b/jaguar.c @@ -7,6 +7,7 @@ #include "util.h" #include "debug.h" #include "config.h" +#include "render.h" //BIOS Area Memory map // 10 00 00 - 10 04 00 : Video mode/ Memory control registers @@ -238,20 +239,34 @@ uint16_t rom0_read_16(uint32_t address, jaguar_context *system) return 0xFFFF; } +m68k_context * sync_components(m68k_context * context, uint32_t address) +{ + jaguar_context *system = context->system; + jag_video_run(system->video, context->current_cycle); + if (context->current_cycle > 0x10000000) { + context->current_cycle -= 0x10000000; + system->video->cycles -= 0x10000000; + } + return context; +} + void *rom0_write_m68k(uint32_t address, void *context, uint16_t value) { + sync_components(context, 0); rom0_write_16(address, ((m68k_context *)context)->system, value); return context; } uint16_t rom0_read_m68k(uint32_t address, void *context) { + sync_components(context, 0); return rom0_read_16(address, ((m68k_context *)context)->system); } void *rom0_write_m68k_b(uint32_t address, void *context, uint8_t value) { + sync_components(context, 0); //seems unlikely these areas support byte access uint16_t value16 = value; value16 |= value16 << 8; @@ -261,6 +276,7 @@ void *rom0_write_m68k_b(uint32_t address, void *context, uint8_t value) uint8_t rom0_read_m68k_b(uint32_t address, void *context) { + sync_components(context, 0); uint16_t value = rom0_read_16(address, ((m68k_context *)context)->system); if (address & 1) { return value; @@ -268,17 +284,6 @@ uint8_t rom0_read_m68k_b(uint32_t address, void *context) return value >> 8; } -m68k_context * sync_components(m68k_context * context, uint32_t address) -{ - jaguar_context *system = context->system; - jag_video_run(system->video, context->current_cycle); - if (context->current_cycle > 0x10000000) { - context->current_cycle -= 0x10000000; - system->video->cycles -= 0x10000000; - } - return context; -} - m68k_context *handle_m68k_reset(m68k_context *context) { puts("M68K executed RESET"); @@ -367,6 +372,7 @@ int main(int argc, char **argv) fatal_error("Failed to read cart from %s\n", argv[2]); } jaguar_context *system = init_jaguar(bios, bios_size, cart, cart_size); + render_init(640, 480, "BlastJag", 60, 0); m68k_reset(system->m68k); return 0; } -- cgit v1.2.3