Skip to content

Commit ec295d1

Browse files
committed
upd7810: upd78c06 has internal rom
1 parent e5bc8a4 commit ec295d1

File tree

8 files changed

+50
-57
lines changed

8 files changed

+50
-57
lines changed

hash/gamepock.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ license:CC0
1111
<publisher>Epoch</publisher>
1212
<info name="serial" value="1" />
1313
<part name="cart" interface="gamepock_cart">
14-
<dataarea name="rom" size="8192">
15-
<rom name="astrobom.bin" size="8192" crc="b0fd260f" sha1="453a0f3c0952ebd8e691316c39960731f1996c09"/>
14+
<dataarea name="rom" size="0x2000">
15+
<rom name="astrobom.bin" size="0x2000" crc="b0fd260f" sha1="453a0f3c0952ebd8e691316c39960731f1996c09"/>
1616
</dataarea>
1717
</part>
1818
</software>
@@ -23,8 +23,8 @@ license:CC0
2323
<publisher>Epoch</publisher>
2424
<info name="serial" value="2" />
2525
<part name="cart" interface="gamepock_cart">
26-
<dataarea name="rom" size="8192">
27-
<rom name="blockmaz.bin" size="8192" crc="cfb3291b" sha1="50dc5736200986b326b372c17c233c4180474471"/>
26+
<dataarea name="rom" size="0x2000">
27+
<rom name="blockmaz.bin" size="0x2000" crc="cfb3291b" sha1="50dc5736200986b326b372c17c233c4180474471"/>
2828
</dataarea>
2929
</part>
3030
</software>
@@ -35,8 +35,8 @@ license:CC0
3535
<publisher>Epoch</publisher>
3636
<info name="serial" value="3" />
3737
<part name="cart" interface="gamepock_cart">
38-
<dataarea name="rom" size="16384">
39-
<rom name="pokemahj.bin" size="16384" crc="5c3eed48" sha1="918e1caa16cfae6b74da2026f3426d0a5818061c"/>
38+
<dataarea name="rom" size="0x4000">
39+
<rom name="pokemahj.bin" size="0x4000" crc="5c3eed48" sha1="918e1caa16cfae6b74da2026f3426d0a5818061c"/>
4040
</dataarea>
4141
</part>
4242
</software>
@@ -47,8 +47,8 @@ license:CC0
4747
<publisher>Epoch</publisher>
4848
<info name="serial" value="4" />
4949
<part name="cart" interface="gamepock_cart">
50-
<dataarea name="rom" size="8192">
51-
<rom name="pokereve.bin" size="8192" crc="1c461f91" sha1="ead4a4efe5439e2ec1f6befb50c350f73919da8d"/>
50+
<dataarea name="rom" size="0x2000">
51+
<rom name="pokereve.bin" size="0x2000" crc="1c461f91" sha1="ead4a4efe5439e2ec1f6befb50c350f73919da8d"/>
5252
</dataarea>
5353
</part>
5454
</software>
@@ -59,8 +59,8 @@ license:CC0
5959
<publisher>Epoch</publisher>
6060
<info name="serial" value="5" />
6161
<part name="cart" interface="gamepock_cart">
62-
<dataarea name="rom" size="8192">
63-
<rom name="soukoban.bin" size="8192" crc="5d6f7819" sha1="61ef6483e8f9935dd8b6351fd2bdfda3af3899bd"/>
62+
<dataarea name="rom" size="0x2000">
63+
<rom name="soukoban.bin" size="0x2000" crc="5d6f7819" sha1="61ef6483e8f9935dd8b6351fd2bdfda3af3899bd"/>
6464
</dataarea>
6565
</part>
6666
</software>

src/devices/cpu/upd7810/upd7810.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,18 @@ void upd7810_device::upd_internal_256_ram_map(address_map &map)
392392
map(0xff00, 0xffff).ram();
393393
}
394394

395+
void upd7810_device::upd_internal_4096_rom_128_ram_map(address_map &map)
396+
{
397+
map(0x0000, 0x0fff).rom();
398+
map(0xff80, 0xffff).ram();
399+
}
400+
401+
void upd7810_device::upd_internal_4096_rom_256_ram_map(address_map &map)
402+
{
403+
map(0x0000, 0x0fff).rom();
404+
map(0xff00, 0xffff).ram();
405+
}
406+
395407
upd7810_device::upd7810_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor internal_map)
396408
: cpu_device(mconfig, type, tag, owner, clock)
397409
, m_to_func(*this)
@@ -494,13 +506,13 @@ void upd78c05_device::configure_ops()
494506
m_opXX = s_opXX_78c05;
495507
}
496508

497-
upd78c05_device::upd78c05_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
498-
: upd78c05_device(mconfig, UPD78C05, tag, owner, clock)
509+
upd78c05_device::upd78c05_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor internal_map)
510+
: upd7810_device(mconfig, type, tag, owner, clock, internal_map)
499511
{
500512
}
501513

502-
upd78c05_device::upd78c05_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
503-
: upd7810_device(mconfig, type, tag, owner, clock, address_map_constructor(FUNC(upd78c05_device::upd_internal_128_ram_map), this))
514+
upd78c05_device::upd78c05_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
515+
: upd78c05_device(mconfig, UPD78C05, tag, owner, clock, address_map_constructor(FUNC(upd78c05_device::upd_internal_128_ram_map), this))
504516
{
505517
}
506518

@@ -517,7 +529,7 @@ void upd78c06_device::configure_ops()
517529
}
518530

519531
upd78c06_device::upd78c06_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
520-
: upd78c05_device(mconfig, UPD78C06, tag, owner, clock)
532+
: upd78c05_device(mconfig, UPD78C06, tag, owner, clock, address_map_constructor(FUNC(upd78c06_device::upd_internal_4096_rom_128_ram_map), this))
521533
{
522534
}
523535

src/devices/cpu/upd7810/upd7810.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ class upd7810_device : public cpu_device
8686
protected:
8787
void upd_internal_128_ram_map(address_map &map);
8888
void upd_internal_256_ram_map(address_map &map);
89-
void upd_internal_4096_rom_map(address_map &map);
89+
void upd_internal_4096_rom_128_ram_map(address_map &map);
90+
void upd_internal_4096_rom_256_ram_map(address_map &map);
9091

9192
// flags
9293
enum
@@ -1399,7 +1400,7 @@ class upd78c05_device : public upd7810_device
13991400
upd78c05_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
14001401

14011402
protected:
1402-
upd78c05_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
1403+
upd78c05_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor internal_map);
14031404

14041405
virtual void device_start() override;
14051406
virtual void device_reset() override;

src/devices/cpu/upd7810/upd7811.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,15 @@
2323
2424
*/
2525

26-
void upd7810_device::upd_internal_4096_rom_map(address_map &map)
27-
{
28-
map(0x0000, 0x0fff).rom();
29-
map(0xff00, 0xffff).ram();
30-
}
31-
3226
DEFINE_DEVICE_TYPE(UPD7811, upd7811_device, "upd7811", "NEC uPD7811")
3327
DEFINE_DEVICE_TYPE(UPD78C11, upd78c11_device, "upd78c11", "NEC uPD78C11")
3428

3529
upd7811_device::upd7811_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
36-
: upd7810_device(mconfig, UPD7811, tag, owner, clock, address_map_constructor(FUNC(upd7811_device::upd_internal_4096_rom_map), this))
30+
: upd7810_device(mconfig, UPD7811, tag, owner, clock, address_map_constructor(FUNC(upd7811_device::upd_internal_4096_rom_256_ram_map), this))
3731
{
3832
}
3933

4034
upd78c11_device::upd78c11_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
41-
: upd78c10_device(mconfig, UPD78C11, tag, owner, clock, address_map_constructor(FUNC(upd78c11_device::upd_internal_4096_rom_map), this))
35+
: upd78c10_device(mconfig, UPD78C11, tag, owner, clock, address_map_constructor(FUNC(upd78c11_device::upd_internal_4096_rom_256_ram_map), this))
4236
{
4337
}

src/mame/epoch/gamepock.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "gamepock.h"
77

88
#include "bus/generic/carts.h"
9-
#include "cpu/upd7810/upd7810.h"
109

1110
#include "emupal.h"
1211
#include "screen.h"
@@ -17,10 +16,11 @@
1716
void gamepock_state::gamepock_mem(address_map &map)
1817
{
1918
map.unmap_value_high();
20-
map(0x0000, 0x0fff).rom();
19+
// 0x0000-0x0fff is internal ROM
2120
map(0x1000, 0x3fff).noprw();
22-
//map(0x4000,0xbfff).rom(); // mapped by the cartslot
21+
map(0x4000, 0xbfff).r("cartslot", FUNC(generic_slot_device::read_rom));
2322
map(0xc000, 0xc7ff).mirror(0x0800).ram();
23+
// 0xff80-0xffff is internal RAM
2424
}
2525

2626

@@ -43,13 +43,13 @@ INPUT_PORTS_END
4343

4444
void gamepock_state::gamepock(machine_config &config)
4545
{
46-
upd78c06_device &upd(UPD78C06(config, m_maincpu, 6_MHz_XTAL)); // uPD78C06AG
47-
upd.set_addrmap(AS_PROGRAM, &gamepock_state::gamepock_mem);
48-
upd.pa_out_cb().set(FUNC(gamepock_state::port_a_w));
49-
upd.pb_in_cb().set(FUNC(gamepock_state::port_b_r));
50-
upd.pb_out_cb().set(FUNC(gamepock_state::port_b_w));
51-
upd.pc_in_cb().set(FUNC(gamepock_state::port_c_r));
52-
upd.to_func().set(FUNC(gamepock_state::gamepock_to_w));
46+
UPD78C06(config, m_maincpu, 6_MHz_XTAL); // uPD78C06AG
47+
m_maincpu->set_addrmap(AS_PROGRAM, &gamepock_state::gamepock_mem);
48+
m_maincpu->pa_out_cb().set(FUNC(gamepock_state::port_a_w));
49+
m_maincpu->pb_in_cb().set(FUNC(gamepock_state::port_b_r));
50+
m_maincpu->pb_out_cb().set(FUNC(gamepock_state::port_b_w));
51+
m_maincpu->pc_in_cb().set(FUNC(gamepock_state::port_c_r));
52+
m_maincpu->to_func().set(m_speaker, FUNC(speaker_sound_device::level_w));
5353

5454
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
5555
screen.set_refresh_hz(60);
@@ -65,7 +65,7 @@ void gamepock_state::gamepock(machine_config &config)
6565
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50);
6666

6767
/* cartridge */
68-
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "gamepock_cart");
68+
GENERIC_CARTSLOT(config, "cartslot", generic_plain_slot, "gamepock_cart");
6969

7070
/* Software lists */
7171
SOFTWARE_LIST(config, "cart_list").set_original("gamepock");

src/mame/epoch/gamepock.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#pragma once
77

88
#include "bus/generic/slot.h"
9+
#include "cpu/upd7810/upd7810.h"
910
#include "sound/spkrdev.h"
1011

1112
class gamepock_state : public driver_device
@@ -14,8 +15,7 @@ class gamepock_state : public driver_device
1415
gamepock_state(const machine_config &mconfig, device_type type, const char *tag) :
1516
driver_device(mconfig, type, tag),
1617
m_maincpu(*this, "maincpu"),
17-
m_speaker(*this, "speaker"),
18-
m_cart(*this, "cartslot")
18+
m_speaker(*this, "speaker")
1919
{ }
2020

2121
void gamepock(machine_config &config);
@@ -40,16 +40,14 @@ class gamepock_state : public driver_device
4040
void port_b_w(uint8_t data);
4141
uint8_t port_c_r();
4242
uint32_t screen_update_gamepock(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
43-
DECLARE_WRITE_LINE_MEMBER(gamepock_to_w);
4443
void gamepock_mem(address_map &map);
4544

4645
uint8_t m_port_a = 0U;
4746
uint8_t m_port_b = 0U;
4847
HD44102CH m_hd44102ch[3];
4948

50-
required_device<cpu_device> m_maincpu;
49+
required_device<upd78c06_device> m_maincpu;
5150
required_device<speaker_sound_device> m_speaker;
52-
required_device<generic_slot_device> m_cart;
5351
};
5452

5553
#endif // MAME_INCLUDES_GAMEPOCK_H

src/mame/epoch/gamepock_m.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,6 @@ void gamepock_state::machine_reset()
138138
hd44102ch_init( 0 );
139139
hd44102ch_init( 1 );
140140
hd44102ch_init( 2 );
141-
142-
if (m_cart->exists())
143-
m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000,0xbfff, read8sm_delegate(*m_cart, FUNC(generic_slot_device::read_rom)));
144-
145141
}
146142

147143
uint32_t gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -215,9 +211,3 @@ uint32_t gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_in
215211

216212
return 0;
217213
}
218-
219-
/* This is called whenever the T0 pin switches state */
220-
WRITE_LINE_MEMBER(gamepock_state::gamepock_to_w)
221-
{
222-
m_speaker->level_w(state & 1);
223-
}

src/mame/handheld/gmaster.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Watara SuperVision), so perhaps it's them.
2828
2929
TODO:
3030
- does port B do anything?
31-
- hspace should have some kind of volume filter on the bgm? not sure what
32-
what controls it, or maybe it's a hardware quirk
31+
- according to one video on Youtube, hspace should have some kind of volume
32+
filter on the bgm? not sure what controls it, or maybe it's a hardware quirk
3333
3434
BTANB:
3535
- LCD flickers partially, especially bad in finitezn
@@ -60,8 +60,7 @@ class gmaster_state : public driver_device
6060
m_maincpu(*this, "maincpu"),
6161
m_lcd(*this, "lcd%u", 0),
6262
m_screen(*this, "screen"),
63-
m_speaker(*this, "speaker"),
64-
m_cart(*this, "cartslot")
63+
m_speaker(*this, "speaker")
6564
{ }
6665

6766
void gmaster(machine_config &config);
@@ -74,7 +73,6 @@ class gmaster_state : public driver_device
7473
required_device_array<sed1520_device, 2> m_lcd;
7574
required_device<screen_device> m_screen;
7675
required_device<speaker_sound_device> m_speaker;
77-
required_device<generic_slot_device> m_cart;
7876

7977
u8 io_r(offs_t offset);
8078
void io_w(offs_t offset, u8 data);
@@ -250,7 +248,7 @@ void gmaster_state::gmaster(machine_config &config)
250248
SPEAKER_SOUND(config, m_speaker).add_route(0, "mono", 0.50);
251249

252250
// cartridge
253-
GENERIC_CARTSLOT(config, m_cart, generic_linear_slot, "gmaster_cart").set_must_be_loaded(true);
251+
GENERIC_CARTSLOT(config, "cartslot", generic_linear_slot, "gmaster_cart").set_must_be_loaded(true);
254252
SOFTWARE_LIST(config, "cart_list").set_original("gmaster");
255253
}
256254

0 commit comments

Comments
 (0)