Skip to content

Commit 5524834

Browse files
bfm_cobra3.cpp Cleanup (nw)
1 parent 6850aac commit 5524834

File tree

1 file changed

+42
-99
lines changed

1 file changed

+42
-99
lines changed

src/mame/bfm/bfm_cobra3.cpp

Lines changed: 42 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,11 @@
11
// license:BSD-3-Clause
2-
// copyright-holders:David Haywood
2+
// copyright-holders:David Haywood, James Wallace, blueonesarefaster
3+
34
/* Bellfruit SWP (Skill With Prizes) Video hardware
45
aka Cobra 3
56
6-
*/
7-
8-
/* Radio Times readme #1
9-
---------------------------------------------
10-
11-
Music TR9C1710 (Video RAMDAC)
12-
13-
Part number : STV8438CV
14-
Manufacture : ST Microelectronics
15-
Specification(s)
16-
Description : 8-Bit Triple DAC with Analog Switch
17-
Package : PQFP44
18-
19-
MC68340 : Integrated Processor with DMA
20-
The MC68340 is a high-performance 32-bit integrated processor with direct memory access (DMA), combining an enhanced M68000-compatible processor, 32-bit DMA, and other peripheral subsystems on a single integrated circuit. The MC68340 CPU32 delivers 32-bit CISC processor performance from a lower cost 16-bit memory system. The combination of peripherals offered in the MC68340 can be found in a diverse range of microprocessor-based systems. Systems requiring very high-speed block transfers of data can benefit from the MC68340.
21-
22-
Block Diagram
23-
24-
25-
MC68340 Features
26-
CPU32 Core
27-
Two-Channel DMA Controller
28-
DUART Compatible with 68681
29-
Two 16-Bit Timer/Counters
30-
Four Chip Selects
31-
System Integration
32-
32 Address Lines, 16 Data Lines
33-
Low Power Management
34-
4.8 MIPS @ 25 MHz
35-
Available in 16 and 25 MHz
36-
Available in 3.3 and 5V
37-
38-
39-
l5380 -scsi controller
40-
41-
ymz280b - in MAME - sound chip
42-
43-
audio board
44-
45-
75585116 - PALCE 16V8H
46-
75585118 - PALCE 16V8H
47-
48-
TI introduce the TMS320AV110 MPEG audio decoder based on TI's 16 bits
49-
50-
roms (RadioTimes)
51-
52-
game 95 400 009 type swp left ver. radt 1.1 - ST 27C4001
53-
game 95 400 010 type swp right ver. radt 1.1 - ST 27C4001
54-
95 004 056 sound left - ST 27C4001
55-
95 004 057 sound right - AM 27C040
56-
57-
cd
58-
59-
version 95-100-302
7+
TODO: MPEG decoding currently not implemented
8+
Checksum fails for all games, looks like a CPU bug
609
*/
6110

6211

@@ -138,27 +87,27 @@ uint16_t bfm_cobra3_state::bfm_cobra3_mem_r(offs_t offset, uint16_t mem_mask)
13887

13988
switch ( cs )
14089
{
141-
case 1: //ROM
90+
case 1: // ROM
14291
return m_cpuregion[offset & 0x7ffff];
143-
case 2://RAM
92+
case 2:// (NV)RAM
14493
return m_mainram[offset & 0x1fff];
14594

146-
case 3: //I/O 00ac0000-00ac07ff
95+
case 3: // I/O
14796
{
14897
offset &= 0x7ff;
14998
offs_t cs_addr_8_11 = (offset * 2) & 0xf00;
15099

151100
switch(cs_addr_8_11)
152101
{
153-
case 0x300: //ac0300
102+
case 0x300: //YMZ stereo sound accesses
154103
if(ACCESSING_BITS_0_7)
155104
{
156105
return m_ymz->read(offset & 1);
157106
}
158107
break;
159108

160109
case 0x400:
161-
//input reads
110+
//input reads, haven't got far enough to trigger any
162111
break;
163112

164113
case 0x500: //SCSI DMA
@@ -177,23 +126,23 @@ uint16_t bfm_cobra3_state::bfm_cobra3_mem_r(offs_t offset, uint16_t mem_mask)
177126
}
178127
}
179128
break;
180-
129+
181130
default:
182-
logerror("%08x maincpu read access offset %08x mem_mask %08x cs %d\n", pc, offset*4, mem_mask, cs);
131+
logerror("%s maincpu read access offset %08x mem_mask %08x cs %d\n", machine().describe_context(), offset*4, mem_mask, cs);
183132
break;
184133
}
185134
}
186135
break;
187136

188-
case 4: //0x00b10000 SCSI controller
137+
case 4: // SCSI controller
189138
if(ACCESSING_BITS_8_15)
190139
{
191-
return(m_scsic->read(offset & 0x0f)<<8);
140+
return(m_scsic->read(offset & 0x0f) << 8);
192141
}
193142
break;
194143

195144
default:
196-
logerror("%08x maincpu read access offset %08x mem_mask %08x cs %d\n", pc, offset*4, mem_mask, cs);
145+
logerror("%s maincpu read access offset %08x mem_mask %08x cs %d\n", machine().describe_context(), offset*4, mem_mask, cs);
197146
}
198147

199148
return 0x0000;
@@ -206,34 +155,33 @@ void bfm_cobra3_state::bfm_cobra3_mem_w(offs_t offset, uint16_t data, uint16_t m
206155

207156
switch (cs)
208157
{
209-
case 1://ROM, shouldn't write here?
210-
logerror("%08x maincpu write access(1) offset %08x data %08x mem_mask %08x cs %d\n", pc, offset*4, data, mem_mask, cs);
158+
case 1:// ROM, shouldn't write here?
159+
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);
211160
break;
212-
213-
case 2://RAM
161+
162+
case 2:// (NV)RAM
214163
COMBINE_DATA(&m_mainram[offset & 0x1fff]);
215164
break;
216-
217-
case 3: //00ac0000-00ac07ff I/O
165+
166+
case 3: // I/O
218167
{
219168
offset &= 0x7ff;
220169
offs_t cs_addr_8_11 = (offset * 2) & 0xf00;
221-
222170
switch(cs_addr_8_11)
223171
{
224172
case 0x000:
225-
// lamps0_15_w(data);
173+
// lamps;
226174
break;
227175

228176
case 0x100:
229177
if(ACCESSING_BITS_8_15)
230178
{
231-
//coin lockout and optional vfd
179+
// coin lockout and optional vfd (debug only?)
232180
}
233181
break;
234182

235183
case 0x200:
236-
//volume, watchdog and other stuff ?
184+
// volume, watchdog and other stuff ? That's where it would be elsewhere
237185
break;
238186

239187
case 0x300:
@@ -243,14 +191,14 @@ void bfm_cobra3_state::bfm_cobra3_mem_w(offs_t offset, uint16_t data, uint16_t m
243191
}
244192
break;
245193

246-
case 0x500://SCSI DMA
194+
case 0x500: // SCSI DMA
247195
if(ACCESSING_BITS_8_15)
248196
{
249197
m_scsic->dma_w(data >> 8);
250198
}
251199
break;
252200

253-
case 0x700:
201+
case 0x700: // RAMDAC for palettes
254202
if(ACCESSING_BITS_0_7)
255203
{
256204
offset &= 7;
@@ -274,21 +222,21 @@ void bfm_cobra3_state::bfm_cobra3_mem_w(offs_t offset, uint16_t data, uint16_t m
274222
break;
275223

276224
default:
277-
// coin divert, hoppers, note validator
278-
logerror("%08x maincpu write access(3) offset %08x data %08x mem_mask %08x cs %d\n", pc, offset*4, data, mem_mask, cs);
225+
// coin divert, hoppers, note validator must be somewhere
226+
logerror("%s maincpu write access(3) offset %08x data %08x mem_mask %08x cs %d\n", machine().describe_context(), offset*4, data, mem_mask, cs);
279227
break;
280228
}
281229
}
282230
break;
283-
284-
case 4: //0x00b10000 SCSI controller
231+
232+
case 4: // SCSI controller
285233
offset &= 0x0f;
286234
if(ACCESSING_BITS_8_15)
287235
{
288236
m_scsic->write(offset, data >> 8);
289237
}
290238
break;
291-
239+
292240
default:
293241
logerror("%08x maincpu write access(0) offset %08x data %08x mem_mask %08x cs %d\n", pc, offset*4, data, mem_mask, cs);
294242
break;
@@ -313,7 +261,7 @@ void bfm_cobra3_state::scc66470_map(address_map &map)
313261
}
314262

315263
static INPUT_PORTS_START( bfm_cobra3 )
316-
//TODO: Fix inputs
264+
// TODO: Fix inputs
317265
PORT_START("STROBE0")
318266
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(3)
319267
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(3)
@@ -372,7 +320,7 @@ static void cobra_scsi_devices(device_slot_interface &device)
372320

373321
void bfm_cobra3_state::dma1_drq(int state)
374322
{
375-
//? Can't see this
323+
// Triggers, but seems not to do anything, may be CPU bug related.
376324
}
377325

378326
void bfm_cobra3_state::scc66470_irq(int state)
@@ -386,27 +334,24 @@ uint32_t bfm_cobra3_state::screen_update(screen_device &screen, bitmap_rgb32 &bi
386334
{
387335
if(cliprect.min_y == cliprect.max_y)
388336
{
389-
uint32_t *dest;
390-
uint8_t *src;
337+
uint32_t *dest = &bitmap.pix(cliprect.min_y);
391338
uint8_t buffer[768];
392-
393-
dest = &bitmap.pix(cliprect.min_y);
394-
339+
uint8_t *src = buffer;
395340
m_scc66470->line(cliprect.min_y, buffer, sizeof(buffer));
396341

397342
src = buffer;
398343

399344
if(*src == 254)
400345
{
401-
// Other implementation suggests MPEG border colour here to ease blending
346+
// Other implementations suggest leaving transparency / MPEG border colour here to ease blending
402347
src += 32;
403348
}
404349
else
405350
{
406351
dest = std::fill_n(dest, 32, m_palette->pen(*src));
407352
src += 32;
408353
}
409-
354+
410355
/* mpeg video has significant overscan, 4 lines either side.
411356
412357
Just crop it out to fit, presume the chip does this IRL */
@@ -415,7 +360,7 @@ uint32_t bfm_cobra3_state::screen_update(screen_device &screen, bitmap_rgb32 &bi
415360
{
416361
if(*src == 254)
417362
{
418-
*dest++ = 0; //Will allow MPEG to be drawn i.e. transparent
363+
*dest++ = 0; // Will allow MPEG to be drawn i.e. transparent
419364
src++;
420365
}
421366
else
@@ -425,7 +370,7 @@ uint32_t bfm_cobra3_state::screen_update(screen_device &screen, bitmap_rgb32 &bi
425370

426371
if(*src == 254)
427372
{
428-
*dest++ = 0; // this should be mpeg video pixel - 0 = transparent
373+
*dest++ = 0; // This should be mpeg video pixel i.e. transparent
429374
src++;
430375
}
431376
else
@@ -435,7 +380,7 @@ uint32_t bfm_cobra3_state::screen_update(screen_device &screen, bitmap_rgb32 &bi
435380
}
436381
if(*src == 254)
437382
{
438-
// finally 32 pixels of mpeg border colour when it's mixed
383+
// finally 32 pixels of mpeg border colour when it's mixed in
439384
}
440385
else
441386
{
@@ -449,7 +394,6 @@ uint32_t bfm_cobra3_state::screen_update(screen_device &screen, bitmap_rgb32 &bi
449394

450395
void bfm_cobra3_state::bfm_cobra3(machine_config &config)
451396
{
452-
/* basic machine hardware */
453397
M68340(config, m_maincpu, 16000000);
454398
m_maincpu->set_addrmap(AS_PROGRAM, &bfm_cobra3_state::bfm_cobra3_map);
455399

@@ -462,8 +406,8 @@ void bfm_cobra3_state::bfm_cobra3(machine_config &config)
462406

463407
PALETTE(config, m_palette).set_entries(256);
464408

465-
RAMDAC(config, m_ramdac, 0, m_palette);
466-
m_ramdac->set_addrmap(0, &bfm_cobra3_state::ramdac_map); // MUSIC Semiconductor TR9C1710 RAMDAC
409+
RAMDAC(config, m_ramdac, 0, m_palette); // MUSIC Semiconductor TR9C1710 RAMDAC
410+
m_ramdac->set_addrmap(0, &bfm_cobra3_state::ramdac_map);
467411
m_ramdac->set_split_read(1);
468412

469413
SPEAKER(config, "lspeaker").front_left();
@@ -582,8 +526,7 @@ ROM_START( c3_ppays )
582526
DISK_IMAGE_READONLY( "95100315", 0, SHA1(fc76d3ab5ff38c2dc4f06399f5399a1ae3c136e9) )
583527
ROM_END
584528

585-
} // anonymous namespace
586-
529+
}
587530

588531
GAME( 1995, c3_telly, 0, bfm_cobra3, bfm_cobra3, bfm_cobra3_state, empty_init, ROT0, "BFM", "Telly Addicts (Bellfruit) (Cobra 3)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING )
589532
GAME( 1995, c3_tellyns,0, bfm_cobra3, bfm_cobra3, bfm_cobra3_state, empty_init, ROT0, "BFM", "Telly Addicts (New Series) (Bellfruit) (Cobra 3)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING )

0 commit comments

Comments
 (0)