Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/genplus-gx32/core/cart_hw/svp/svp.c
2 views
1
/*
2
basic, incomplete SSP160x (SSP1601?) interpreter
3
with SVP memory controller emu
4
5
(c) Copyright 2008, Grazvydas "notaz" Ignotas
6
Free for non-commercial use.
7
8
For commercial use, separate licencing terms must be obtained.
9
10
Modified for Genesis Plus GX (Eke-Eke): added BIG ENDIAN support, fixed addr/code inversion
11
*/
12
13
#include "shared.h"
14
15
svp_t *svp = NULL;
16
17
void svp_init(void)
18
{
19
svp = (void *) ((char *)cart.rom + 0x200000);
20
memset(svp, 0, sizeof(*svp));
21
}
22
23
void svp_reset(void)
24
{
25
memcpy(svp->iram_rom + 0x800, cart.rom + 0x800, 0x20000 - 0x800);
26
ssp1601_reset(&svp->ssp1601);
27
}
28
29
void svp_write_dram(uint32 address, uint32 data)
30
{
31
*(uint16 *)(svp->dram + (address & 0x1fffe)) = data;
32
if ((address == 0x30fe06) && data) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE06;
33
if ((address == 0x30fe08) && data) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE08;
34
}
35
36
uint32 svp_read_cell_1(uint32 address)
37
{
38
address >>= 1;
39
address = (address & 0x7001) | ((address & 0x3e) << 6) | ((address & 0xfc0) >> 5);
40
return *(uint16 *)(svp->dram + (address & 0x1fffe));
41
}
42
43
uint32 svp_read_cell_2(uint32 address)
44
{
45
address >>= 1;
46
address = (address & 0x7801) | ((address & 0x1e) << 6) | ((address & 0x7e0) >> 4);
47
return *(uint16 *)(svp->dram + (address & 0x1fffe));
48
}
49
50
51