-
Notifications
You must be signed in to change notification settings - Fork 2.2k
machine/nmk112.cpp: Convert bank method into memory_bank_creator and address_space finders #14267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
cam900
commented
Oct 5, 2025
- Reduce duplicates
- Fix spacings and argument data type
- atlus/cave.cpp, atlus/patapata.cpp, nmk/nmk16.cpp, nmk/nmkmedal.cpp, nmk/quizpani.cpp: Fix memory region size for NMK112 bankswitched OKI MSM6295 spaces
…address_space - Reduce duplicates - Fix spacings and argument data type - atlus/cave.cpp, atlus/patapata.cpp, nmk/nmk16.cpp, nmk/nmkmedal.cpp, nmk/quizpani.cpp: Fix memory region size for NMK112 bankswitched OKI MSM6295 spaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change to use real bank objects is a good idea, but I don’t think the method of installing into address spaces is ideal. Rather than adding the address space finders to the NMK112 device, you should add address map functions, e.g. something like:
In machine/nmk112.h:
...
class nmk112_device : public device_t
{
public:
...
void oki0(address_map &map) ATTR_COLD;
void oki1(address_map &map) ATTR_COLD;
...
private:
...
void oki_map(address_map &map, unsigned which) ATTR_COLD;
...
};
...
In machine/nmk112.cpp:
...
void nmk112_device::oki0(address_map &map)
{
oki_map(map, 0);
}
void nmk112_device::oki1(address_map &map)
{
oki_map(map, 1);
}
void nmk112_device::oki_map(address_map &map, unsigned which)
{
for (int i = 0; i < 4; i++)
{
map((i << 16) | page_offset(which, i), (i << 16) | 0xffff).bankr(m_samplebank[which][i]);
if (paged)
map(i << 8, (i << 8) | 0xff).bankr(m_tablebank[which][i]);
}
}
...
Then when you want use it in a driver, you can do something like:
...
void cave_state::donpachi(machine_config &config)
{
...
OKIM6295(config, m_oki[0], 4.220_MHz_XTAL/4, okim6295_device::PIN7_HIGH); // pin 7 not verified
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.60);
OKIM6295(config, m_oki[1], 4.220_MHz_XTAL/2, okim6295_device::PIN7_HIGH); // pin 7 not verified
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 1.0);
nmk112_device &nmk112(NMK112(config, "nmk112", 0));
nmk112.set_rom0_tag("oki1");
nmk112.set_rom1_tag("oki2");
nmk112.set_page_mask(1 << 0); // chip #0 (music) is not paged
m_oki[0]->set_addrmap(0, nmk112, &nmk112_device::oki0);
m_oki[1]->set_addrmap(0, nmk112, &nmk112_device::oki1);
}
This isn’t tested, and I’m coding in a web browser, but I hope you can see the basic idea.
Simply crash when OKI chip tries to play sample because address map is installed before ROM related stuff is initialized. Bank initialization function is should be moved from device_start? |
Which part is crashing? The address map function should be able to use
No, the actual part where you call |
When tries to access sample space from method of above. Memory bank finder should be optional_memory_bank_array for use |
|