diff options
author | Michael Pavone <pavone@retrodev.com> | 2016-10-07 18:27:38 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2016-10-07 18:27:38 -0700 |
commit | 3bda38c2547f87a25635a886604e8b597bae5491 (patch) | |
tree | 90a11eb98ac068c72987468d31ec2dd4b96c7afc | |
parent | f6eff7d2b0907476b6a47cfe88f896c8dc8f7073 (diff) |
Added placeholder code for video output hardware/object processor
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | jag_video.c | 13 | ||||
-rw-r--r-- | jag_video.h | 22 | ||||
-rw-r--r-- | jaguar.c | 20 | ||||
-rw-r--r-- | jaguar.h | 11 |
5 files changed, 52 insertions, 16 deletions
@@ -160,7 +160,7 @@ blastem$(EXE) : $(MAINOBJS) $(CC) -o $@ $^ $(LDFLAGS) $(FIXUP) ./$@ -blastjag$(EXE) : jaguar.o render_sdl.o $(M68KOBJS) $(TRANSOBJS) $(CONFIGOBJS) +blastjag$(EXE) : jaguar.o jag_video.o render_sdl.o $(M68KOBJS) $(TRANSOBJS) $(CONFIGOBJS) $(CC) -o $@ $^ $(LDFLAGS) dis$(EXE) : dis.o 68kinst.o tern.o vos_program_module.o diff --git a/jag_video.c b/jag_video.c new file mode 100644 index 0000000..fd484b2 --- /dev/null +++ b/jag_video.c @@ -0,0 +1,13 @@ +#include <stdint.h> +#include <stdlib.h> +#include "jag_video.h" + +jag_video *jag_video_init(void) +{ + return calloc(1, sizeof(jag_video)); +} + +void jag_video_run(jag_video *context, uint32_t target_cycle) +{ + context->cycles = target_cycle; +} diff --git a/jag_video.h b/jag_video.h new file mode 100644 index 0000000..0555712 --- /dev/null +++ b/jag_video.h @@ -0,0 +1,22 @@ +#ifndef JAG_VIDEO_H_ +#define JAG_VIDEO_H_ + +#define JAG_VIDEO_REGS 0x2E +#define LINEBUFFER_WORDS 720 + +typedef struct { + uint16_t regs[JAG_VIDEO_REGS]; + + uint16_t clut[256]; + uint16_t line_buffer_a[LINEBUFFER_WORDS]; + uint16_t line_buffer_b[LINEBUFFER_WORDS]; + uint16_t *write_line_buffer; + uint16_t *read_line_buffer; + + uint32_t cycles; +} jag_video; + +jag_video *jag_video_init(void); +void jag_video_run(jag_video *context, uint32_t target_cycle); + +#endif //JAG_VIDEO_H_ @@ -102,25 +102,25 @@ void rom0_write_16(uint32_t address, jaguar_context *system, uint16_t value) } else if (address < 0x100800) { //CLUT address = address >> 1 & 255; - system->clut[address] = value; + system->video->clut[address] = value; } else { //Line buffer A address = address >> 1 & 0x3FF; if (address < LINEBUFFER_WORDS) { - system->line_buffer_a[address] = value; + system->video->line_buffer_a[address] = value; } } } else if (address < 0x101800) { //Line buffer B address = address >> 1 & 0x3FF; if (address < LINEBUFFER_WORDS) { - system->line_buffer_b[address] = value; + system->video->line_buffer_b[address] = value; } } else if (address < 0x102100) { //Write Line Buffer address = address >> 1 & 0x3FF; if (address < LINEBUFFER_WORDS) { - system->write_line_buffer[address] = value; + system->video->write_line_buffer[address] = value; } } else { //GPU/Blitter registers @@ -180,25 +180,25 @@ uint16_t rom0_read_16(uint32_t address, jaguar_context *system) } else if (address < 0x100800) { //CLUT address = address >> 1 & 255; - return system->clut[address]; + return system->video->clut[address]; } else { //Line buffer A address = address >> 1 & 0x3FF; if (address < LINEBUFFER_WORDS) { - return system->line_buffer_a[address]; + return system->video->line_buffer_a[address]; } } } else if (address < 0x101800) { //Line buffer B address = address >> 1 & 0x3FF; if (address < LINEBUFFER_WORDS) { - return system->line_buffer_b[address]; + return system->video->line_buffer_b[address]; } } else if (address < 0x102100) { //Write Line Buffer address = address >> 1 & 0x3FF; if (address < LINEBUFFER_WORDS) { - return system->write_line_buffer[address]; + return system->video->write_line_buffer[address]; } } else { //GPU/Blitter registers @@ -270,8 +270,11 @@ uint8_t rom0_read_m68k_b(uint32_t address, void *context) 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; } @@ -309,6 +312,7 @@ jaguar_context *init_jaguar(uint16_t *bios, uint32_t bios_size, uint16_t *cart, init_m68k_opts(opts, jag_m68k_map, 8, 2); system->m68k = init_68k_context(opts, handle_m68k_reset); system->m68k->system = system; + system->video = jag_video_init(); return system; } @@ -1,13 +1,15 @@ #ifndef JAGUAR_H_ #define JAGUAR_H_ -#define DRAM_WORDS (4*1024*1024) -#define LINEBUFFER_WORDS 720 +#define DRAM_WORDS (1*1024*1024) #define GPU_RAM_BYTES 4096 #define DSP_RAM_BYTES 8192 +#include "jag_video.h" + typedef struct { m68k_context *m68k; + jag_video *video; uint16_t *bios; uint16_t *cart; uint32_t bios_size; @@ -20,11 +22,6 @@ typedef struct { uint16_t dram[DRAM_WORDS]; uint32_t gpu_local[GPU_RAM_BYTES / sizeof(uint32_t)]; uint32_t dsp_local[DSP_RAM_BYTES / sizeof(uint32_t)]; - uint16_t clut[256]; - uint16_t line_buffer_a[LINEBUFFER_WORDS]; - uint16_t line_buffer_b[LINEBUFFER_WORDS]; - uint16_t *write_line_buffer; - uint16_t *read_line_buffer; uint8_t memcon_written; } jaguar_context; |