summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@arcor.de>2015-01-30 21:10:42 +0100
committer couriersud <couriersud@arcor.de>2015-01-30 21:10:42 +0100
commit403b27d615bd8f1b7187d74d7a609c994099dc8e (patch)
tree5d27c1498c82f08ccc347a212095911e2f26aec3
parentae4dddb9c1b9faa7b45501620dd4a8cded0faa2a (diff)
parentd094328b4d73944a0a7b6ee3ac06f19b34a9ca56 (diff)
Merge branch 'master' of https://github.com/mamedev/mame.git
-rw-r--r--3rdparty/sqlite3/sqlite3.h9
-rw-r--r--src/emu/cpu/amis2000/amis2000.c17
-rw-r--r--src/emu/cpu/amis2000/amis2000.h11
-rw-r--r--src/emu/cpu/amis2000/amis2000op.inc54
-rw-r--r--src/emu/cpu/drcbex64.h4
-rw-r--r--src/emu/cpu/drcbex86.h4
-rw-r--r--src/emu/cpu/uml.h10
-rw-r--r--src/emu/ui/inputmap.c2
-rw-r--r--src/emu/ui/mainmenu.c2
-rw-r--r--src/lib/util/bitmap.c2
-rw-r--r--src/osd/windows/winprefix.h1
11 files changed, 95 insertions, 21 deletions
diff --git a/3rdparty/sqlite3/sqlite3.h b/3rdparty/sqlite3/sqlite3.h
index c31f126dbbe..352f4909fbc 100644
--- a/3rdparty/sqlite3/sqlite3.h
+++ b/3rdparty/sqlite3/sqlite3.h
@@ -256,6 +256,13 @@ typedef struct sqlite3 sqlite3;
typedef sqlite_int64 sqlite3_int64;
typedef sqlite_uint64 sqlite3_uint64;
+/* pointer-sized values */
+#ifdef PTR64
+typedef sqlite3_uint64 FPTR;
+#else
+typedef unsigned int FPTR;
+#endif
+
/*
** If compiling for a processor that lacks floating point support,
** substitute integer for floating-point.
@@ -4382,7 +4389,7 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
*/
typedef void (*sqlite3_destructor_type)(void*);
#define SQLITE_STATIC ((sqlite3_destructor_type)0)
-#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1)
+#define SQLITE_TRANSIENT ((sqlite3_destructor_type)(FPTR)-1)
/*
** CAPI3REF: Setting The Result Of An SQL Function
diff --git a/src/emu/cpu/amis2000/amis2000.c b/src/emu/cpu/amis2000/amis2000.c
index b194cdbad15..81dcea88d5e 100644
--- a/src/emu/cpu/amis2000/amis2000.c
+++ b/src/emu/cpu/amis2000/amis2000.c
@@ -134,6 +134,9 @@ void amis2000_device::device_start()
// zerofill
memset(m_callstack, 0, sizeof(m_callstack));
m_pc = 0;
+ m_ppr = 0;
+ m_pbr = 0;
+ m_pp_index = 0;
m_skip = false;
m_op = 0;
m_f = 0;
@@ -148,6 +151,9 @@ void amis2000_device::device_start()
// register for savestates
save_item(NAME(m_callstack));
save_item(NAME(m_pc));
+ save_item(NAME(m_ppr));
+ save_item(NAME(m_pbr));
+ save_item(NAME(m_pp_index));
save_item(NAME(m_skip));
save_item(NAME(m_op));
save_item(NAME(m_f));
@@ -182,6 +188,8 @@ void amis2000_device::device_start()
void amis2000_device::device_reset()
{
m_pc = 0;
+ m_skip = false;
+ m_op = 0;
}
@@ -197,6 +205,15 @@ void amis2000_device::execute_run()
while (m_icount > 0)
{
m_icount--;
+
+ // increase PP prefix count
+ if ((m_op & 0xf0) == 0x60)
+ {
+ if (m_pp_index < 2)
+ m_pp_index++;
+ }
+ else
+ m_pp_index = 0;
debugger_instruction_hook(this, m_pc);
m_op = m_program->read_byte(m_pc);
diff --git a/src/emu/cpu/amis2000/amis2000.h b/src/emu/cpu/amis2000/amis2000.h
index 7e34ed560d0..5f583343fde 100644
--- a/src/emu/cpu/amis2000/amis2000.h
+++ b/src/emu/cpu/amis2000/amis2000.h
@@ -72,13 +72,16 @@ protected:
UINT8 m_bu_bits;
UINT16 m_bu_mask;
- UINT8 m_callstack_bits;
+ UINT8 m_callstack_bits; // number of program counter bits held in callstack
UINT16 m_callstack_mask;
UINT8 m_callstack_depth; // callstack levels: 3 on 2000/2150, 5 on 2200/2400
UINT16 m_callstack[5]; // max 5
- UINT16 m_pc;
- bool m_skip;
+ UINT16 m_pc; // 13-bit program counter
+ UINT8 m_ppr; // prepared page register (PP 1)
+ UINT8 m_pbr; // prepared bank register (PP 2)
+ UINT8 m_pp_index; // number of handled PP prefixes
+ bool m_skip; // skip next opcode, including PP prefixes
UINT8 m_op;
UINT8 m_f; // generic flags: 2 on 2000/2150, 6 on 2200/2400
UINT8 m_carry; // carry flag
@@ -99,6 +102,8 @@ protected:
UINT8 ram_r();
void ram_w(UINT8 data);
+ void pop_callstack();
+ void push_callstack();
void op_illegal();
void op_lai();
diff --git a/src/emu/cpu/amis2000/amis2000op.inc b/src/emu/cpu/amis2000/amis2000op.inc
index 173f0531ae1..708f416f578 100644
--- a/src/emu/cpu/amis2000/amis2000op.inc
+++ b/src/emu/cpu/amis2000/amis2000op.inc
@@ -14,6 +14,25 @@ void amis2000_device::ram_w(UINT8 data)
m_data->write_byte(address, data & 0xf);
}
+void amis2000_device::pop_callstack()
+{
+ m_pc = (m_pc & ~m_callstack_mask) | (m_callstack[0] & m_callstack_mask);
+ for (int i = 0; i < m_callstack_depth-1; i++)
+ {
+ m_callstack[i] = m_callstack[i+1];
+ m_callstack[i+1] = 0;
+ }
+}
+
+void amis2000_device::push_callstack()
+{
+ for (int i = m_callstack_depth-1; i >= 1; i--)
+ {
+ m_callstack[i] = m_callstack[i-1];
+ }
+ m_callstack[0] = m_pc & m_callstack_mask;
+}
+
void amis2000_device::op_illegal()
{
logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
@@ -207,31 +226,56 @@ void amis2000_device::op_eur()
void amis2000_device::op_pp()
{
// PP _X: prepare page/bank with _X
- op_illegal();
+ UINT8 param = ~m_op & 0x0f;
+ if (m_pp_index == 0)
+ m_ppr = param;
+ else
+ m_pbr = param & 7;
}
void amis2000_device::op_jmp()
{
// JMP X: jump to X(+PP)
- op_illegal();
+ UINT16 mask = 0x3f;
+ UINT16 param = m_op & mask;
+ if (m_pp_index > 0)
+ {
+ param |= m_ppr << 6;
+ mask |= 0x3c0;
+ }
+ if (m_pp_index > 1)
+ {
+ param |= m_pbr << 10;
+ mask |= 0x1c00;
+ }
+ m_pc = (m_pc & ~mask) | param;
}
void amis2000_device::op_jms()
{
// JMS X: call to X(+PP)
- op_illegal();
+ m_icount--;
+ push_callstack();
+ if (m_pp_index == 0)
+ {
+ // subroutines default location is page 15
+ m_ppr = 0xf;
+ m_pp_index++;
+ }
+ op_jmp();
}
void amis2000_device::op_rt()
{
// RT: return from subroutine
- op_illegal();
+ pop_callstack();
}
void amis2000_device::op_rts()
{
// RTS: return from subroutine and skip next
- op_illegal();
+ op_rt();
+ m_skip = true;
}
void amis2000_device::op_nop()
diff --git a/src/emu/cpu/drcbex64.h b/src/emu/cpu/drcbex64.h
index 6b6cf729b64..dcd5505fe5b 100644
--- a/src/emu/cpu/drcbex64.h
+++ b/src/emu/cpu/drcbex64.h
@@ -73,8 +73,8 @@ private:
static inline be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < x64emit::REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
static inline be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < x64emit::REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
static inline be_parameter make_vreg(int regnum) { assert(regnum >= 0 && regnum < x64emit::REG_MAX); return be_parameter(PTYPE_VECTOR_REGISTER, regnum); }
- static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
- static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }
+ static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, static_cast<be_parameter_value>(reinterpret_cast<FPTR>(base))); }
+ static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, static_cast<be_parameter_value>(reinterpret_cast<FPTR>(const_cast<void *>(base)))); }
// operators
bool operator==(const be_parameter &rhs) const { return (m_type == rhs.m_type && m_value == rhs.m_value); }
diff --git a/src/emu/cpu/drcbex86.h b/src/emu/cpu/drcbex86.h
index 3c3af63d0d0..1e3910f4084 100644
--- a/src/emu/cpu/drcbex86.h
+++ b/src/emu/cpu/drcbex86.h
@@ -73,8 +73,8 @@ private:
static inline be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < x86emit::REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
static inline be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < x86emit::REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
static inline be_parameter make_vreg(int regnum) { assert(regnum >= 0 && regnum < x86emit::REG_MAX); return be_parameter(PTYPE_VECTOR_REGISTER, regnum); }
- static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
- static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }
+ static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, static_cast<be_parameter_value>(reinterpret_cast<FPTR>(base))); }
+ static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, static_cast<be_parameter_value>(reinterpret_cast<FPTR>(const_cast<void *>(base)))); }
// operators
bool operator==(const be_parameter &rhs) const { return (m_type == rhs.m_type && m_value == rhs.m_value); }
diff --git a/src/emu/cpu/uml.h b/src/emu/cpu/uml.h
index 53eacfa49d9..db1ed62f83a 100644
--- a/src/emu/cpu/uml.h
+++ b/src/emu/cpu/uml.h
@@ -305,7 +305,7 @@ namespace uml
parameter(UINT64 val) : m_type(PTYPE_IMMEDIATE), m_value(val) { }
parameter(operand_size size, memory_scale scale) : m_type(PTYPE_SIZE_SCALE), m_value((scale << 4) | size) { assert(size >= SIZE_BYTE && size <= SIZE_DQWORD); assert(scale >= SCALE_x1 && scale <= SCALE_x8); }
parameter(operand_size size, memory_space space) : m_type(PTYPE_SIZE_SPACE), m_value((space << 4) | size) { assert(size >= SIZE_BYTE && size <= SIZE_DQWORD); assert(space >= SPACE_PROGRAM && space <= SPACE_IO); }
- parameter(code_handle &handle) : m_type(PTYPE_CODE_HANDLE), m_value(reinterpret_cast<parameter_value>(&handle)) { }
+ parameter(code_handle &handle) : m_type(PTYPE_CODE_HANDLE), m_value(static_cast<parameter_value>(reinterpret_cast<FPTR>(&handle))) { }
parameter(code_label &label) : m_type(PTYPE_CODE_LABEL), m_value(label) { }
// creators for types that don't safely default
@@ -313,11 +313,11 @@ namespace uml
static inline parameter make_freg(int regnum) { assert(regnum >= REG_F0 && regnum < REG_F_END); return parameter(PTYPE_FLOAT_REGISTER, regnum); }
static inline parameter make_vreg(int regnum) { assert(regnum >= REG_V0 && regnum < REG_V_END); return parameter(PTYPE_VECTOR_REGISTER, regnum); }
static inline parameter make_mapvar(int mvnum) { assert(mvnum >= MAPVAR_M0 && mvnum < MAPVAR_END); return parameter(PTYPE_MAPVAR, mvnum); }
- static inline parameter make_memory(void *base) { return parameter(PTYPE_MEMORY, reinterpret_cast<parameter_value>(base)); }
- static inline parameter make_memory(const void *base) { return parameter(PTYPE_MEMORY, reinterpret_cast<parameter_value>(const_cast<void *>(base))); }
+ static inline parameter make_memory(void *base) { return parameter(PTYPE_MEMORY, static_cast<parameter_value>(reinterpret_cast<FPTR>(base))); }
+ static inline parameter make_memory(const void *base) { return parameter(PTYPE_MEMORY, static_cast<parameter_value>(reinterpret_cast<FPTR>(const_cast<void *>(base)))); }
static inline parameter make_size(operand_size size) { assert(size >= SIZE_BYTE && size <= SIZE_DQWORD); return parameter(PTYPE_SIZE, size); }
- static inline parameter make_string(const char *string) { return parameter(PTYPE_STRING, reinterpret_cast<parameter_value>(const_cast<char *>(string))); }
- static inline parameter make_cfunc(c_function func) { return parameter(PTYPE_C_FUNCTION, reinterpret_cast<parameter_value>(func)); }
+ static inline parameter make_string(const char *string) { return parameter(PTYPE_STRING, static_cast<parameter_value>(reinterpret_cast<FPTR>(const_cast<char *>(string)))); }
+ static inline parameter make_cfunc(c_function func) { return parameter(PTYPE_C_FUNCTION, static_cast<parameter_value>(reinterpret_cast<FPTR>(func))); }
static inline parameter make_rounding(float_rounding_mode mode) { assert(mode >= ROUND_TRUNC && mode <= ROUND_DEFAULT); return parameter(PTYPE_ROUNDING, mode); }
// operators
diff --git a/src/emu/ui/inputmap.c b/src/emu/ui/inputmap.c
index 4150bfc9649..472bd7cb15b 100644
--- a/src/emu/ui/inputmap.c
+++ b/src/emu/ui/inputmap.c
@@ -73,7 +73,7 @@ void ui_menu_input_groups::handle()
/* process the menu */
const ui_menu_event *menu_event = process(0);
if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT)
- ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_general(machine(), container, int((long long)(menu_event->itemref)-1))));
+ ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_general(machine(), container, int((long long)((FPTR)menu_event->itemref)-1))));
}
diff --git a/src/emu/ui/mainmenu.c b/src/emu/ui/mainmenu.c
index 9809833a506..0110c3754f9 100644
--- a/src/emu/ui/mainmenu.c
+++ b/src/emu/ui/mainmenu.c
@@ -151,7 +151,7 @@ void ui_menu_main::handle()
/* process the menu */
const ui_menu_event *menu_event = process(0);
if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT) {
- switch((long long)(menu_event->itemref)) {
+ switch((long long)((FPTR) menu_event->itemref)) {
case INPUT_GROUPS:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_groups(machine(), container)));
break;
diff --git a/src/lib/util/bitmap.c b/src/lib/util/bitmap.c
index 4d1f8502f50..170e2dd98b7 100644
--- a/src/lib/util/bitmap.c
+++ b/src/lib/util/bitmap.c
@@ -49,7 +49,7 @@ inline INT32 bitmap_t::compute_rowpixels(int width, int xslop)
inline void bitmap_t::compute_base(int xslop, int yslop)
{
m_base = m_alloc + (m_rowpixels * yslop + xslop) * (m_bpp / 8);
- UINT64 aligned_base = ((reinterpret_cast<UINT64>(m_base) + (BITMAP_OVERALL_ALIGN - 1)) / BITMAP_OVERALL_ALIGN) * BITMAP_OVERALL_ALIGN;
+ UINT64 aligned_base = ((static_cast<UINT64>(reinterpret_cast<FPTR>(m_base)) + (BITMAP_OVERALL_ALIGN - 1)) / BITMAP_OVERALL_ALIGN) * BITMAP_OVERALL_ALIGN;
m_base = reinterpret_cast<void *>(aligned_base);
}
diff --git a/src/osd/windows/winprefix.h b/src/osd/windows/winprefix.h
index 2635685eff1..1f26a2104a2 100644
--- a/src/osd/windows/winprefix.h
+++ b/src/osd/windows/winprefix.h
@@ -31,6 +31,7 @@
#pragma warning (disable: 5025 5026 5027)
#define _CRT_STDIO_LEGACY_WIDE_SPECIFIERS
#endif
+#define strtoll _strtoi64
#endif
#ifdef __GNUC__