1 // license:BSD-3-Clause
2 // copyright-holders:Curt Coder
3 /**********************************************************************
4
5 Easy Calc Result cartridge emulation
6
7 **********************************************************************/
8
9 /*
10
11 PCB Layout
12 ----------
13
14 |===========================|
15 |=| |
16 |=| ROM0 LS73 |
17 |=| |
18 |=| |
19 |=| |
20 |=| |
21 |=| ROM1 LS00 |
22 |=| |
23 |===========================|
24
25 ROM0 - Hitachi HN61364P 8Kx8 EPROM "CR2001"
26 ROM1 - Hitachi HN613128P 16Kx8 EPROM "CR3001"
27
28 */
29
30 #include "emu.h"
31 #include "easy_calc_result.h"
32
33
34
35 //**************************************************************************
36 // DEVICE DEFINITIONS
37 //**************************************************************************
38
39 DEFINE_DEVICE_TYPE(C64_EASY_CALC_RESULT, c64_easy_calc_result_cartridge_device, "c64_easy_calc_result", "C64 Easy Calc Result cartridge")
40
41
42
43 //**************************************************************************
44 // LIVE DEVICE
45 //**************************************************************************
46
47 //-------------------------------------------------
48 // c64_easy_calc_result_cartridge_device - constructor
49 //-------------------------------------------------
50
c64_easy_calc_result_cartridge_device(const machine_config & mconfig,const char * tag,device_t * owner,uint32_t clock)51 c64_easy_calc_result_cartridge_device::c64_easy_calc_result_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
52 device_t(mconfig, C64_EASY_CALC_RESULT, tag, owner, clock),
53 device_c64_expansion_card_interface(mconfig, *this), m_bank(0)
54 {
55 }
56
57
58 //-------------------------------------------------
59 // device_start - device-specific startup
60 //-------------------------------------------------
61
device_start()62 void c64_easy_calc_result_cartridge_device::device_start()
63 {
64 // state saving
65 save_item(NAME(m_bank));
66 }
67
68
69 //-------------------------------------------------
70 // device_reset - device-specific reset
71 //-------------------------------------------------
72
device_reset()73 void c64_easy_calc_result_cartridge_device::device_reset()
74 {
75 m_bank = 0;
76 }
77
78
79 //-------------------------------------------------
80 // c64_cd_r - cartridge data read
81 //-------------------------------------------------
82
c64_cd_r(offs_t offset,uint8_t data,int sphi2,int ba,int roml,int romh,int io1,int io2)83 uint8_t c64_easy_calc_result_cartridge_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
84 {
85 if (!roml)
86 {
87 data = m_roml[offset & 0x1fff];
88 }
89 else if (!romh)
90 {
91 data = m_romh[(m_bank << 13) | (offset & 0x1fff)];
92 }
93
94 return data;
95 }
96
97
98 //-------------------------------------------------
99 // c64_cd_w - cartridge data write
100 //-------------------------------------------------
101
c64_cd_w(offs_t offset,uint8_t data,int sphi2,int ba,int roml,int romh,int io1,int io2)102 void c64_easy_calc_result_cartridge_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
103 {
104 if (!io1)
105 {
106 m_bank = !BIT(offset, 0);
107 }
108 }
109