1 // license:BSD-3-Clause
2 // copyright-holders:Curt Coder
3 /**********************************************************************
4
5 Ocean Software cartridge emulation
6
7 **********************************************************************/
8
9 /*
10
11 Chase H.Q. 2: Special Criminal Investigation
12
13 PCB Layout
14 ----------
15
16 |===========================|
17 |=| LS02 |
18 |=| |
19 |=| |
20 |=| ROM0 ROM1 |
21 |=| LS273 |
22 |=| |
23 |=| |
24 |=| |
25 |===========================|
26
27 ROM0,1 - 28-pin ROM (Toshiba TC531000 pinout, markings scratched off)
28
29 */
30
31 #include "emu.h"
32 #include "ocean.h"
33
34
35
36 //**************************************************************************
37 // DEVICE DEFINITIONS
38 //**************************************************************************
39
40 DEFINE_DEVICE_TYPE(C64_OCEAN, c64_ocean_cartridge_device, "c64_ocean", "C64 Ocean cartridge")
41
42
43
44 //**************************************************************************
45 // LIVE DEVICE
46 //**************************************************************************
47
48 //-------------------------------------------------
49 // c64_ocean_cartridge_device - constructor
50 //-------------------------------------------------
51
c64_ocean_cartridge_device(const machine_config & mconfig,const char * tag,device_t * owner,uint32_t clock)52 c64_ocean_cartridge_device::c64_ocean_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
53 device_t(mconfig, C64_OCEAN, tag, owner, clock),
54 device_c64_expansion_card_interface(mconfig, *this),
55 m_bank(0)
56 {
57 }
58
59
60 //-------------------------------------------------
61 // device_start - device-specific startup
62 //-------------------------------------------------
63
device_start()64 void c64_ocean_cartridge_device::device_start()
65 {
66 // state saving
67 save_item(NAME(m_bank));
68 }
69
70
71 //-------------------------------------------------
72 // device_reset - device-specific reset
73 //-------------------------------------------------
74
device_reset()75 void c64_ocean_cartridge_device::device_reset()
76 {
77 m_bank = 0;
78 }
79
80
81 //-------------------------------------------------
82 // c64_cd_r - cartridge data read
83 //-------------------------------------------------
84
c64_cd_r(offs_t offset,uint8_t data,int sphi2,int ba,int roml,int romh,int io1,int io2)85 uint8_t c64_ocean_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
86 {
87 if (!roml && m_roml.bytes())
88 {
89 offs_t addr = (m_bank << 13) | (offset & 0x1fff);
90 data = m_roml[addr & m_roml.mask()];
91 }
92 else if (!romh && m_romh.bytes())
93 {
94 offs_t addr = (m_bank << 13) | (offset & 0x1fff);
95 data = m_romh[addr & m_romh.mask()];
96 }
97 else if (!io1)
98 {
99 return m_bank;
100 }
101
102 return data;
103 }
104
105
106 //-------------------------------------------------
107 // c64_cd_w - cartridge data write
108 //-------------------------------------------------
109
c64_cd_w(offs_t offset,uint8_t data,int sphi2,int ba,int roml,int romh,int io1,int io2)110 void c64_ocean_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
111 {
112 if (!io1)
113 {
114 m_bank = data & 0x3f;
115 }
116 }
117