Skip to content

Commit 8ac83f8

Browse files
committed
nec/pc98_sdip.cpp: drop template i/f
1 parent f4b1881 commit 8ac83f8

File tree

3 files changed

+18
-45
lines changed

3 files changed

+18
-45
lines changed

src/mame/nec/pc9801.cpp

+11-12
Original file line numberDiff line numberDiff line change
@@ -1244,18 +1244,17 @@ void pc9801us_state::pc9801us_io(address_map &map)
12441244
else
12451245
logerror("SDIP: I/O $00f6 unrecognized write %02x\n", data);
12461246
}));
1247-
map(0x841e, 0x841e).rw(m_sdip, FUNC(pc98_sdip_device::read<0x0>), FUNC(pc98_sdip_device::write<0x0>));
1248-
map(0x851e, 0x851e).rw(m_sdip, FUNC(pc98_sdip_device::read<0x1>), FUNC(pc98_sdip_device::write<0x1>));
1249-
map(0x861e, 0x861e).rw(m_sdip, FUNC(pc98_sdip_device::read<0x2>), FUNC(pc98_sdip_device::write<0x2>));
1250-
map(0x871e, 0x871e).rw(m_sdip, FUNC(pc98_sdip_device::read<0x3>), FUNC(pc98_sdip_device::write<0x3>));
1251-
map(0x881e, 0x881e).rw(m_sdip, FUNC(pc98_sdip_device::read<0x4>), FUNC(pc98_sdip_device::write<0x4>));
1252-
map(0x891e, 0x891e).rw(m_sdip, FUNC(pc98_sdip_device::read<0x5>), FUNC(pc98_sdip_device::write<0x5>));
1253-
map(0x8a1e, 0x8a1e).rw(m_sdip, FUNC(pc98_sdip_device::read<0x6>), FUNC(pc98_sdip_device::write<0x6>));
1254-
map(0x8b1e, 0x8b1e).rw(m_sdip, FUNC(pc98_sdip_device::read<0x7>), FUNC(pc98_sdip_device::write<0x7>));
1255-
map(0x8c1e, 0x8c1e).rw(m_sdip, FUNC(pc98_sdip_device::read<0x8>), FUNC(pc98_sdip_device::write<0x8>));
1256-
map(0x8d1e, 0x8d1e).rw(m_sdip, FUNC(pc98_sdip_device::read<0x9>), FUNC(pc98_sdip_device::write<0x9>));
1257-
map(0x8e1e, 0x8e1e).rw(m_sdip, FUNC(pc98_sdip_device::read<0xa>), FUNC(pc98_sdip_device::write<0xa>));
1258-
map(0x8f1e, 0x8f1e).rw(m_sdip, FUNC(pc98_sdip_device::read<0xb>), FUNC(pc98_sdip_device::write<0xb>));
1247+
1248+
// 0x841e ~ 0x8f1e SDIP I/O mapping
1249+
// NOTE: split in half for pleasing emumem
1250+
map(0x841e, 0x841e).select(0x300).lrw8(
1251+
NAME([this] (offs_t offset) { return m_sdip->read(offset >> 8); }),
1252+
NAME([this] (offs_t offset, u8 data) { m_sdip->write(offset >> 8, data); })
1253+
);
1254+
map(0x881e, 0x881e).select(0x700).lrw8(
1255+
NAME([this] (offs_t offset) { return m_sdip->read((offset >> 8) + 4); }),
1256+
NAME([this] (offs_t offset, u8 data) { m_sdip->write((offset >> 8) + 4, data); })
1257+
);
12591258
// map(0x8f1f, 0x8f1f).w(m_sdip, FUNC(pc98_sdip_device::bank_w));
12601259
}
12611260

src/mame/nec/pc98_sdip.cpp

+5-31
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PC-9801 S[oftware]DIP interface
88
- https://bitchinbits.foolproofdesigns.com/pc-9821/pc-9821-cheat-sheet/
99
1010
TODO:
11-
- Discards saved settings in PC-9821 and later;
11+
- Discards saved settings in PC-9821 and later, access thru MMIO?
1212
1313
===================================================================================================
1414
@@ -65,16 +65,16 @@ bool pc98_sdip_device::nvram_write(util::write_stream &file)
6565
}
6666

6767

68-
template<unsigned port> u8 pc98_sdip_device::read(offs_t offset)
68+
u8 pc98_sdip_device::read(offs_t offset)
6969
{
70-
u8 sdip_offset = port + (m_bank * 12);
70+
u8 sdip_offset = offset + (m_bank * 12);
7171

7272
return m_sdip_ram[sdip_offset];
7373
}
7474

75-
template<unsigned port> void pc98_sdip_device::write(offs_t offset, u8 data)
75+
void pc98_sdip_device::write(offs_t offset, u8 data)
7676
{
77-
u8 sdip_offset = port + (m_bank * 12);
77+
u8 sdip_offset = offset + (m_bank * 12);
7878

7979
m_sdip_ram[sdip_offset] = data;
8080
}
@@ -83,29 +83,3 @@ void pc98_sdip_device::bank_w(int state)
8383
{
8484
m_bank = !!(state);
8585
}
86-
87-
template u8 pc98_sdip_device::read<0>(offs_t offset);
88-
template u8 pc98_sdip_device::read<1>(offs_t offset);
89-
template u8 pc98_sdip_device::read<2>(offs_t offset);
90-
template u8 pc98_sdip_device::read<3>(offs_t offset);
91-
template u8 pc98_sdip_device::read<4>(offs_t offset);
92-
template u8 pc98_sdip_device::read<5>(offs_t offset);
93-
template u8 pc98_sdip_device::read<6>(offs_t offset);
94-
template u8 pc98_sdip_device::read<7>(offs_t offset);
95-
template u8 pc98_sdip_device::read<8>(offs_t offset);
96-
template u8 pc98_sdip_device::read<9>(offs_t offset);
97-
template u8 pc98_sdip_device::read<10>(offs_t offset);
98-
template u8 pc98_sdip_device::read<11>(offs_t offset);
99-
100-
template void pc98_sdip_device::write<0>(offs_t offset, u8 data);
101-
template void pc98_sdip_device::write<1>(offs_t offset, u8 data);
102-
template void pc98_sdip_device::write<2>(offs_t offset, u8 data);
103-
template void pc98_sdip_device::write<3>(offs_t offset, u8 data);
104-
template void pc98_sdip_device::write<4>(offs_t offset, u8 data);
105-
template void pc98_sdip_device::write<5>(offs_t offset, u8 data);
106-
template void pc98_sdip_device::write<6>(offs_t offset, u8 data);
107-
template void pc98_sdip_device::write<7>(offs_t offset, u8 data);
108-
template void pc98_sdip_device::write<8>(offs_t offset, u8 data);
109-
template void pc98_sdip_device::write<9>(offs_t offset, u8 data);
110-
template void pc98_sdip_device::write<10>(offs_t offset, u8 data);
111-
template void pc98_sdip_device::write<11>(offs_t offset, u8 data);

src/mame/nec/pc98_sdip.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class pc98_sdip_device : public device_t,
1515
public:
1616
pc98_sdip_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
1717

18-
template <unsigned port> u8 read(offs_t offset);
19-
template <unsigned port> void write(offs_t offset, u8 data);
18+
u8 read(offs_t offset);
19+
void write(offs_t offset, u8 data);
2020
void bank_w(int state);
2121

2222
protected:

0 commit comments

Comments
 (0)