comparison testgst.c @ 487:c08a4efeee7f opengl

Update opengl branch from default. Fix build breakage unrelated to merge
author Mike Pavone <pavone@retrodev.com>
date Sat, 26 Oct 2013 22:38:47 -0700
parents 140af5509ce7
children e9369d6f0101
comparison
equal deleted inserted replaced
449:7696d824489d 487:c08a4efeee7f
1 /*
2 Copyright 2013 Michael Pavone
3 This file is part of BlastEm.
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
5 */
6 #include "gst.h"
7 #include <string.h>
8 #include <stdlib.h>
9
10 uint8_t busreq;
11 uint8_t reset;
12
13 int32_t color_map[1 << 12];
14
15 void latch_mode(vdp_context * context)
16 {
17 }
18 void ym_data_write(ym2612_context * context, uint8_t value)
19 {
20 if (context->selected_reg >= YM_REG_END) {
21 return;
22 }
23 if (context->selected_part) {
24 if (context->selected_reg < YM_PART2_START) {
25 return;
26 }
27 context->part2_regs[context->selected_reg - YM_PART2_START] = value;
28 } else {
29 if (context->selected_reg < YM_PART1_START) {
30 return;
31 }
32 context->part1_regs[context->selected_reg - YM_PART1_START] = value;
33 }
34 }
35
36 void ym_address_write_part1(ym2612_context * context, uint8_t address)
37 {
38 //printf("address_write_part1: %X\n", address);
39 context->selected_reg = address;
40 context->selected_part = 0;
41 }
42
43 void ym_address_write_part2(ym2612_context * context, uint8_t address)
44 {
45 //printf("address_write_part2: %X\n", address);
46 context->selected_reg = address;
47 context->selected_part = 1;
48 }
49
50 uint16_t ram[64*1024];
51 uint8_t zram[8*1024];
52
53
54 int main(int argc, char ** argv)
55 {
56 vdp_context vdp;
57 ym2612_context ym;
58 psg_context psg;
59 m68k_context m68k;
60 z80_context z80;
61 genesis_context gen;
62 if (argc < 3) {
63 fputs("Usage: testgst infile outfile\n", stderr);
64 return 1;
65 }
66 memset(&gen, 0, sizeof(gen));
67 memset(&m68k, 0, sizeof(m68k));
68 memset(&z80, 0, sizeof(z80));
69 memset(&ym, 0, sizeof(ym));
70 memset(&vdp, 0, sizeof(vdp));
71 memset(&psg, 0, sizeof(psg));
72 m68k.mem_pointers[1] = ram;
73 z80.mem_pointers[0] = zram;
74 vdp.vdpmem = malloc(VRAM_SIZE);
75 gen.vdp = &vdp;
76 gen.ym = &ym;
77 gen.psg = &psg;
78 gen.m68k = &m68k;
79 gen.z80 = &z80;
80 uint32_t pc = load_gst(&gen, argv[1]);
81 save_gst(&gen, argv[2], pc);
82 return 0;
83 }