-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HP98X6: added support for option ROMs (#12661)
- Loading branch information
Showing
4 changed files
with
204 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd"> | ||
<!-- | ||
license:CC0-1.0 | ||
HP98x6 option ROMs | ||
Compiled by F.Ulivi | ||
--> | ||
|
||
<softwarelist name="hp98x6_rom" description="HP 98x6 Option ROMs"> | ||
<software name="basic40"> | ||
<description>BASIC 4.0</description> | ||
<year>1985</year> | ||
<publisher>Hewlett-Packard</publisher> | ||
<info name="serial" value="98603A" /> | ||
<part name="rom" interface="hp98x6_rom"> | ||
<dataarea name="rom80000" size="0x80000" width="16" endianness="big"> | ||
<rom name="basic40.bin" size="0x80000" crc="003e6837" sha1="64f58d4aa4a305551573740dcc236ab521a47196" /> | ||
</dataarea> | ||
</part> | ||
</software> | ||
|
||
<software name="basic51"> | ||
<description>BASIC 5.1</description> | ||
<year>1988</year> | ||
<publisher>Hewlett-Packard</publisher> | ||
<info name="serial" value="98603B" /> | ||
<part name="rom" interface="hp98x6_rom"> | ||
<dataarea name="rom100000" size="0xc0000" width="16" endianness="big"> | ||
<rom name="basic51.bin" size="0xc0000" crc="0998506d" sha1="b199d613dfe0c427f4550886f46cfecbf359dc42" /> | ||
</dataarea> | ||
</part> | ||
</software> | ||
|
||
<software name="ssshpl"> | ||
<description>SSS HPL+II</description> | ||
<year>1992</year> | ||
<publisher>Structured Software Systems</publisher> | ||
<part name="rom" interface="hp98x6_rom"> | ||
<dataarea name="rom80000" size="0x80000" width="16" endianness="big"> | ||
<rom name="ssshpl.bin" size="0x80000" crc="c2f63303" sha1="b0401724e77984893662a3943fd63f07adace510" /> | ||
</dataarea> | ||
</part> | ||
</software> | ||
|
||
</softwarelist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// license:BSD-3-Clause | ||
// copyright-holders: F. Ulivi | ||
/********************************************************************* | ||
hp98x6_optrom.cpp | ||
Optional ROMs for HP98x6 systems | ||
*********************************************************************/ | ||
|
||
#include "emu.h" | ||
#include "hp98x6_optrom.h" | ||
#include "softlist.h" | ||
|
||
// Debugging | ||
#define VERBOSE 0 | ||
#include "logmacro.h" | ||
|
||
DEFINE_DEVICE_TYPE(HP98X6_OPTROM, hp98x6_optrom_device, "hp98x6_optrom", "HP98x6 optional ROM") | ||
|
||
struct optrom_region { | ||
offs_t m_start; | ||
const char *m_tag; | ||
}; | ||
|
||
constexpr std::array<struct optrom_region , 2> region_tab = | ||
{{ | ||
{ 0x100000, "rom100000" }, | ||
{ 0x80000, "rom80000" } | ||
}}; | ||
|
||
// +--------------------+ | ||
// |hp98x6_optrom_device| | ||
// +--------------------+ | ||
hp98x6_optrom_device::hp98x6_optrom_device(machine_config const &mconfig, char const *tag, device_t *owner) | ||
: hp98x6_optrom_device(mconfig, tag, owner, (uint32_t)0) | ||
{ | ||
} | ||
|
||
hp98x6_optrom_device::hp98x6_optrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) | ||
: device_t(mconfig, HP98X6_OPTROM, tag, owner, clock) | ||
, device_rom_image_interface(mconfig, *this) | ||
, m_space_r(nullptr) | ||
{ | ||
} | ||
|
||
hp98x6_optrom_device::~hp98x6_optrom_device() | ||
{ | ||
} | ||
|
||
void hp98x6_optrom_device::install_handlers(address_space *space_r) | ||
{ | ||
m_space_r = space_r; | ||
|
||
for (const struct optrom_region& reg : region_tab) { | ||
uint8_t *ptr = get_software_region(reg.m_tag); | ||
if (ptr != nullptr) { | ||
auto len = get_software_region_length(reg.m_tag); | ||
LOG("%s loaded, %u long\n", reg.m_tag, len); | ||
space_r->install_rom(reg.m_start , reg.m_start + len - 1 , ptr); | ||
} | ||
} | ||
} | ||
|
||
void hp98x6_optrom_device::device_start() | ||
{ | ||
} | ||
|
||
std::pair<std::error_condition, std::string> hp98x6_optrom_device::call_load() | ||
{ | ||
LOG("hp98x6_optrom: call_load\n"); | ||
if (!loaded_through_softlist()) { | ||
return std::make_pair(image_error::UNSUPPORTED, "Option ROMs must be loaded from software list"); | ||
} | ||
|
||
return std::make_pair(std::error_condition(), std::string()); | ||
} | ||
|
||
void hp98x6_optrom_device::call_unload() | ||
{ | ||
LOG("hp98x6_optrom: call_unload\n"); | ||
if (m_space_r != nullptr) { | ||
for (const struct optrom_region& reg : region_tab) { | ||
auto len = get_software_region_length(reg.m_tag); | ||
if (len != 0) { | ||
m_space_r->unmap_read(reg.m_start , reg.m_start + len - 1); | ||
LOG("%s unloaded\n" , reg.m_tag); | ||
} | ||
} | ||
} | ||
machine().schedule_soft_reset(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// license:BSD-3-Clause | ||
// copyright-holders: F. Ulivi | ||
/********************************************************************* | ||
hp98x6_optrom.h | ||
Optional ROMs for HP98x6 systems | ||
*********************************************************************/ | ||
#ifndef MAME_HP_HP98X6_OPTROM_H | ||
#define MAME_HP_HP98X6_OPTROM_H | ||
|
||
#pragma once | ||
|
||
#include "imagedev/cartrom.h" | ||
|
||
class hp98x6_optrom_device : public device_t, | ||
public device_rom_image_interface | ||
{ | ||
public: | ||
// construction/destruction | ||
hp98x6_optrom_device(machine_config const &mconfig, char const *tag, device_t *owner); | ||
hp98x6_optrom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); | ||
virtual ~hp98x6_optrom_device(); | ||
|
||
void install_handlers(address_space *space_r); | ||
|
||
protected: | ||
// device_t implementation | ||
virtual void device_start() override; | ||
|
||
// device_image_interface implementation | ||
virtual std::pair<std::error_condition, std::string> call_load() override; | ||
virtual void call_unload() override; | ||
|
||
virtual bool is_reset_on_load() const noexcept override { return true; } | ||
virtual const char *image_interface() const noexcept override { return "hp98x6_rom"; } | ||
virtual const char *file_extensions() const noexcept override { return "bin"; } | ||
|
||
address_space *m_space_r; | ||
}; | ||
|
||
// device type definition | ||
DECLARE_DEVICE_TYPE(HP98X6_OPTROM, hp98x6_optrom_device) | ||
|
||
#endif /* MAME_HP_HP98X6_OPTROM_H */ |