main
testgst.c
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
10uint8_t busreq;
11uint8_t reset;
12
13void latch_mode(vdp_context * context)
14{
15}
16void ym_data_write(ym2612_context * context, uint8_t value)
17{
18 if (context->selected_reg >= YM_REG_END) {
19 return;
20 }
21 if (context->selected_part) {
22 if (context->selected_reg < YM_PART2_START) {
23 return;
24 }
25 context->part2_regs[context->selected_reg - YM_PART2_START] = value;
26 } else {
27 if (context->selected_reg < YM_PART1_START) {
28 return;
29 }
30 context->part1_regs[context->selected_reg - YM_PART1_START] = value;
31 }
32}
33
34void ym_address_write_part1(ym2612_context * context, uint8_t address)
35{
36 //printf("address_write_part1: %X\n", address);
37 context->selected_reg = address;
38 context->selected_part = 0;
39}
40
41void ym_address_write_part2(ym2612_context * context, uint8_t address)
42{
43 //printf("address_write_part2: %X\n", address);
44 context->selected_reg = address;
45 context->selected_part = 1;
46}
47
48uint16_t ram[64*1024];
49uint8_t zram[8*1024];
50
51
52int main(int argc, char ** argv)
53{
54 vdp_context vdp;
55 ym2612_context ym;
56 psg_context psg;
57 m68k_context m68k;
58 z80_context z80;
59 genesis_context gen;
60 if (argc < 3) {
61 fputs("Usage: testgst infile outfile\n", stderr);
62 return 1;
63 }
64 memset(&gen, 0, sizeof(gen));
65 memset(&m68k, 0, sizeof(m68k));
66 memset(&z80, 0, sizeof(z80));
67 memset(&ym, 0, sizeof(ym));
68 memset(&vdp, 0, sizeof(vdp));
69 memset(&psg, 0, sizeof(psg));
70 m68k.mem_pointers[1] = ram;
71 z80.mem_pointers[0] = zram;
72 vdp.vdpmem = malloc(VRAM_SIZE);
73 gen.vdp = &vdp;
74 gen.ym = &ym;
75 gen.psg = &psg;
76 gen.m68k = &m68k;
77 gen.z80 = &z80;
78 uint32_t pc = load_gst(&gen, argv[1]);
79 save_gst(&gen, argv[2], pc);
80 return 0;
81}