summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/unsp/unsp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/unsp/unsp.h')
-rw-r--r--src/devices/cpu/unsp/unsp.h34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/devices/cpu/unsp/unsp.h b/src/devices/cpu/unsp/unsp.h
index cd939aeb25e..2ff18871a8f 100644
--- a/src/devices/cpu/unsp/unsp.h
+++ b/src/devices/cpu/unsp/unsp.h
@@ -1,10 +1,14 @@
-// license:BSD-3-Clause
-// copyright-holders:Ryan Holtz
+// license:GPL-2.0+
+// copyright-holders:Segher Boessenkool,Ryan Holtz
/*****************************************************************************
- SunPlus micro'nSP core
+ SunPlus micro'nSP emulator
- based primarily on Unununium, by segher
+ Copyright 2008-2017 Segher Boessenkool <segher@kernel.crashing.org>
+ Licensed under the terms of the GNU GPL, version 2
+ http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+
+ Ported to MAME framework by Ryan Holtz
*****************************************************************************/
@@ -13,7 +17,7 @@
#pragma once
-#define UNSP_LOG_OPCODES (0)
+#define UNSP_LOG_OPCODES (1)
enum
{
@@ -56,6 +60,13 @@ enum
UNSP_NUM_LINES
};
+struct unsp_timer
+{
+ uint32_t time;
+ uint32_t interval;
+ int index;
+ struct unsp_timer *next;
+};
class unsp_device : public cpu_device
{
@@ -63,6 +74,10 @@ public:
// construction/destruction
unsp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ void set_timer_interval(int timer, uint32_t interval);
+
+ uint16_t get_video_line();
+
protected:
// device-level overrides
virtual void device_start() override;
@@ -87,8 +102,15 @@ protected:
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
private:
+ void add_lpc(const int32_t offset);
+
+ inline void execute_one(const uint16_t op);
+
address_space_config m_program_config;
+ void timer_add(struct unsp_timer *timer);
+ void timer_run(uint32_t ticks);
+
uint16_t m_r[16];
bool m_enable_irq;
bool m_enable_fiq;
@@ -98,6 +120,7 @@ private:
uint16_t m_sirq;
uint8_t m_sb;
uint8_t m_saved_sb[3];
+ struct unsp_timer *timers;
address_space *m_program;
int m_icount;
@@ -117,6 +140,7 @@ private:
inline void trigger_fiq();
inline void trigger_irq(int line);
inline void check_irqs();
+ inline int get_irq();
};