Skip to content

Commit dde4f28

Browse files
68340.cpp: fix return for out of space register access
bfm_cobra3.cpp : improve logging (nw)
1 parent 55bdcbe commit dde4f28

File tree

2 files changed

+28
-26
lines changed

2 files changed

+28
-26
lines changed

src/devices/machine/68340.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// copyright-holders:David Haywood
33
/* 68340
44
* TODO: - convert all modules to devices
5-
- in multiple QUICC systems running slave mode, global chip select disabled, the internal base moves to start at 3ff04
65
*/
76

87
#include "emu.h"
@@ -131,14 +130,15 @@ uint8_t m68340_cpu_device::int_ack(offs_t offset)
131130
uint16_t m68340_cpu_device::m68340_internal_base_r(offs_t offset, uint16_t mem_mask)
132131
{
133132
if (!machine().side_effects_disabled())
134-
LOGMASKED(LOG_BASE, "%08x m68340_internal_base_r %08x, (%08x) [s%08x] [d%08x]\n", m_ppc, offset*2,mem_mask, m_sfc, m_dfc);
133+
LOGMASKED(LOG_BASE, "%08x m68340_internal_base_r %08x, (%08x) (%08x)\n", m_ppc, offset*2,mem_mask, m_sfc);
134+
135135
if (m_sfc==0x7)
136136
{
137137
return ((!BIT(offset, 0) ? (m_m68340_base >> 16): m_m68340_base)) & 0xffff;
138138
}
139139
else
140140
{
141-
return 0;
141+
return -1;
142142
}
143143
}
144144

src/mame/bfm/bfm_cobra3.cpp

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
aka Cobra 3
66
77
TODO: MPEG decoding currently not implemented
8-
Checksum fails for all games, looks like a CPU bug
98
*/
109

1110

@@ -107,6 +106,7 @@ uint16_t bfm_cobra3_state::bfm_cobra3_mem_r(offs_t offset, uint16_t mem_mask)
107106

108107
case 0x400:
109108
//input reads, haven't got far enough to trigger any
109+
logerror("%s maincpu read access offset %08x mem_mask %08x cs %d\n", machine().describe_context(), offset*4, mem_mask, cs);
110110
break;
111111

112112
case 0x500: //SCSI DMA
@@ -154,12 +154,12 @@ void bfm_cobra3_state::bfm_cobra3_mem_w(offs_t offset, uint16_t data, uint16_t m
154154
switch (cs)
155155
{
156156
case 1:// ROM, shouldn't write here?
157-
logerror("%sx maincpu write access(1) offset %08x data %08x mem_mask %08x cs %d\n", machine().describe_context(), offset*4, data, mem_mask, cs);
158-
break;
157+
logerror("%sx maincpu write access(1) offset %08x data %08x mem_mask %08x cs %d\n", machine().describe_context(), offset*4, data, mem_mask, cs);
158+
break;
159159

160160
case 2:// (NV)RAM
161-
COMBINE_DATA(&m_mainram[offset & 0x1fff]);
162-
break;
161+
COMBINE_DATA(&m_mainram[offset & 0x1fff]);
162+
break;
163163

164164
case 3: // I/O
165165
{
@@ -168,17 +168,20 @@ void bfm_cobra3_state::bfm_cobra3_mem_w(offs_t offset, uint16_t data, uint16_t m
168168
switch(cs_addr_8_11)
169169
{
170170
case 0x000:
171+
logerror("%s maincpu write access lamp drive io latch offset %08x mem_mask %08x cs %d\n", machine().describe_context(), offset*4, mem_mask, cs);
171172
// lamps;
172173
break;
173174

174175
case 0x100:
176+
logerror("%s maincpu write access lockout latch offset %08x mem_mask %08x cs %d\n", machine().describe_context(), offset*4, mem_mask, cs);
175177
if(ACCESSING_BITS_8_15)
176178
{
177179
// coin lockout and optional vfd (debug only?)
178180
}
179181
break;
180182

181183
case 0x200:
184+
logerror("%s maincpu write access io latch offset %08x mem_mask %08x cs %d\n", machine().describe_context(), offset*4, mem_mask, cs);
182185
// volume, watchdog and other stuff ? That's where it would be elsewhere
183186
break;
184187

@@ -200,21 +203,20 @@ void bfm_cobra3_state::bfm_cobra3_mem_w(offs_t offset, uint16_t data, uint16_t m
200203
if(ACCESSING_BITS_0_7)
201204
{
202205
offset &= 7;
203-
if(offset == 0)
206+
switch (offset)
204207
{
208+
case 0:
205209
m_ramdac->index_w(data);
206-
}
207-
else if(offset == 1)
208-
{
210+
break;
211+
case 1:
209212
m_ramdac->pal_w(data);
210-
}
211-
else if(offset == 2)
212-
{
213+
break;
214+
case 2:
213215
m_ramdac->mask_w(data);
214-
}
215-
else if(offset == 3)
216-
{
216+
break;
217+
case 3:
217218
m_ramdac->index_r_w(data);
219+
break;
218220
}
219221
}
220222
break;
@@ -228,16 +230,16 @@ void bfm_cobra3_state::bfm_cobra3_mem_w(offs_t offset, uint16_t data, uint16_t m
228230
break;
229231

230232
case 4: // SCSI controller
231-
offset &= 0x0f;
232-
if(ACCESSING_BITS_8_15)
233-
{
234-
m_scsic->write(offset, data >> 8);
235-
}
236-
break;
233+
offset &= 0x0f;
234+
if(ACCESSING_BITS_8_15)
235+
{
236+
m_scsic->write(offset, data >> 8);
237+
}
238+
break;
237239

238240
default:
239-
logerror("%s maincpu write access(0) offset %08x data %08x mem_mask %08x cs %d\n", machine().describe_context(), offset*4, data, mem_mask, cs);
240-
break;
241+
logerror("%s maincpu write access(0) offset %08x data %08x mem_mask %08x cs %d\n", machine().describe_context(), offset*4, data, mem_mask, cs);
242+
break;
241243
}
242244
}
243245

0 commit comments

Comments
 (0)