summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev/bitbngr.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-02-03 07:43:28 +1100
committer Vas Crabb <vas@vastheman.com>2022-02-03 09:00:23 +1100
commitcb16512392b356d42893257e91ba0935dea86d79 (patch)
tree381266b0c2fa4d8281bacbd0bbc692d13ea2f4e1 /src/devices/imagedev/bitbngr.cpp
parent79db67a77a6929b6423ebe82041971477a1c1a24 (diff)
Clean up various loose ends:
frontend: Exposed debug symbol tables and parsed expressions to Lua (these can be used when the debugger is not active). Also made it simpler to walk input types. imagedev/bitbngr.cpp: Added software list loader support (used by sitcom). sitcom.cpp: Replaced bankdev with a memory view. Also added a bar graph for the timer DAC output, and made the DL1414 displays squarer in the layout like they are in real life. They still don't look right because the internal segment drawing code doen't draw the segments the right width. docs: Fixed broken links and added missing links in command line options index. Also removed documentation for an option that no longer exists and fixed some inconsistent terminology. Separated includes by module in various drivers.
Diffstat (limited to 'src/devices/imagedev/bitbngr.cpp')
-rw-r--r--src/devices/imagedev/bitbngr.cpp55
1 files changed, 45 insertions, 10 deletions
diff --git a/src/devices/imagedev/bitbngr.cpp b/src/devices/imagedev/bitbngr.cpp
index 2a18395ad75..86c92c88ceb 100644
--- a/src/devices/imagedev/bitbngr.cpp
+++ b/src/devices/imagedev/bitbngr.cpp
@@ -9,6 +9,10 @@
#include "emu.h"
#include "bitbngr.h"
+#include "softlist_dev.h"
+
+#include <cstring>
+
/***************************************************************************
@@ -24,6 +28,8 @@ DEFINE_DEVICE_TYPE(BITBANGER, bitbanger_device, "bitbanger", "Bitbanger")
bitbanger_device::bitbanger_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, BITBANGER, tag, owner, clock),
device_image_interface(mconfig, *this),
+ m_next(nullptr),
+ m_end(nullptr),
m_interface(nullptr),
m_is_readonly(false)
{
@@ -37,10 +43,8 @@ bitbanger_device::bitbanger_device(const machine_config &mconfig, const char *ta
void bitbanger_device::output(uint8_t data)
{
- if (exists())
- {
+ if (!loaded_through_softlist() && exists())
fwrite(&data, 1);
- }
}
@@ -50,11 +54,21 @@ void bitbanger_device::output(uint8_t data)
uint32_t bitbanger_device::input(void *buffer, uint32_t length)
{
- if (exists())
+ if (loaded_through_softlist())
+ {
+ size_t const result = std::min<size_t>(length, m_end - m_next);
+ memcpy(buffer, m_next, result);
+ m_next += result;
+ return uint32_t(result);
+ }
+ else if (exists())
{
return fread(buffer, length);
}
- return 0;
+ else
+ {
+ return 0;
+ }
}
@@ -63,8 +77,19 @@ uint32_t bitbanger_device::input(void *buffer, uint32_t length)
device_start
-------------------------------------------------*/
-void bitbanger_device::device_start(void)
+void bitbanger_device::device_start()
+{
+}
+
+
+
+/*-------------------------------------------------
+ get_software_list_loader
+-------------------------------------------------*/
+
+const software_list_loader &bitbanger_device::get_software_list_loader() const
{
+ return rom_software_list_loader::instance();
}
@@ -73,15 +98,24 @@ void bitbanger_device::device_start(void)
call_load
-------------------------------------------------*/
-image_init_result bitbanger_device::call_load(void)
+image_init_result bitbanger_device::call_load()
{
- /* we don't need to do anything special */
+ if (loaded_through_softlist())
+ {
+ auto const length = get_software_region_length("input");
+ m_next = get_software_region("input");
+ m_end = m_next + length;
+ }
+ else
+ {
+ m_next = m_end = nullptr;
+ }
return image_init_result::PASS;
}
image_init_result bitbanger_device::call_create(int format_type, util::option_resolution *format_options)
{
- /* we don't need to do anything special */
+ // we don't need to do anything special
return image_init_result::PASS;
}
@@ -89,6 +123,7 @@ image_init_result bitbanger_device::call_create(int format_type, util::option_re
call_unload
-------------------------------------------------*/
-void bitbanger_device::call_unload(void)
+void bitbanger_device::call_unload()
{
+ m_next = m_end = nullptr;
}