diff options
Diffstat (limited to 'src/emu')
48 files changed, 3567 insertions, 3636 deletions
diff --git a/src/emu/bus/centronics/epson_lx810l.c b/src/emu/bus/centronics/epson_lx810l.c index 0b56ca128cc..933eef5cee4 100644 --- a/src/emu/bus/centronics/epson_lx810l.c +++ b/src/emu/bus/centronics/epson_lx810l.c @@ -176,7 +176,7 @@ static MACHINE_CONFIG_FRAGMENT( epson_lx810l ) MCFG_STEPPER_END_INDEX(24) MCFG_STEPPER_INDEX_PATTERN(0x00) MCFG_STEPPER_INIT_PHASE(2) - + MACHINE_CONFIG_END //------------------------------------------------- @@ -345,7 +345,6 @@ epson_ap2000_t::epson_ap2000_t(const machine_config &mconfig, const char *tag, d void epson_lx810l_t::device_start() { - } diff --git a/src/emu/bus/ieee488/c8050fdc.c b/src/emu/bus/ieee488/c8050fdc.c index 421b2f3c4ea..0a619b7ab71 100644 --- a/src/emu/bus/ieee488/c8050fdc.c +++ b/src/emu/bus/ieee488/c8050fdc.c @@ -20,10 +20,10 @@ #define LOG 1 #define GCR_DECODE(_e, _i) \ - ((BIT(_e, 6) << 7) | (BIT(_i, 7) << 6) | (_e & 0x33) | (BIT(_e, 2) << 3) | (_i & 0x04)) + ((BIT(_e, 6) << 7) | (BIT(_i, 7) << 6) | (_e & 0x33) | (BIT(_e, 2) << 3) | (_i & 0x04)) #define GCR_ENCODE(_e, _i) \ - ((_e & 0xc0) << 2 | (_i & 0x80) | (_e & 0x3c) << 1 | (_i & 0x04) | (_e & 0x03)) + ((_e & 0xc0) << 2 | (_i & 0x80) | (_e & 0x3c) << 1 | (_i & 0x04) | (_e & 0x03)) diff --git a/src/emu/bus/isa/cga.c b/src/emu/bus/isa/cga.c index cd47e1a1f3f..b894632d715 100644 --- a/src/emu/bus/isa/cga.c +++ b/src/emu/bus/isa/cga.c @@ -365,7 +365,7 @@ void isa8_cga_device::device_start() astring tempstring; m_chr_gen_base = memregion(subtag(tempstring, "gfx1"))->base(); m_chr_gen = m_chr_gen_base + m_chr_gen_offset[1]; - + save_item(NAME(m_framecnt)); save_item(NAME(m_mode_control)); save_item(NAME(m_color_select)); @@ -374,7 +374,7 @@ void isa8_cga_device::device_start() save_item(NAME(m_vsync)); save_item(NAME(m_hsync)); save_item(NAME(m_vram)); - save_item(NAME(m_plantronics)); + save_item(NAME(m_plantronics)); } diff --git a/src/emu/bus/isa/sc499.h b/src/emu/bus/isa/sc499.h index eeda9ad1a4a..2db4b28e4c7 100644 --- a/src/emu/bus/isa/sc499.h +++ b/src/emu/bus/isa/sc499.h @@ -28,13 +28,13 @@ class sc499_ctape_image_device : public device_t, public device_image_interface public: // construction/destruction sc499_ctape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // image-level overrides virtual bool call_load(); virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) { return load_software(swlist, swname, start_entry); } virtual void call_unload(); virtual iodevice_t image_type() const { return IO_MAGTAPE; } - + virtual bool is_readable() const { return 1; } virtual bool is_writeable() const { return 1; } virtual bool is_creatable() const { return 1; } diff --git a/src/emu/bus/sega8/rom.c b/src/emu/bus/sega8/rom.c index ce15d0429fc..33ebe932e07 100644 --- a/src/emu/bus/sega8/rom.c +++ b/src/emu/bus/sega8/rom.c @@ -899,17 +899,17 @@ WRITE8_MEMBER(sega8_janggun_device::write_mapper) /*------------------------------------------------- - + Hi-Com X-in-1 cart, uses writes to 0xffff to change program bank in 0x0000-0x7fff - + -------------------------------------------------*/ READ8_MEMBER(sega8_hicom_device::read_cart) { if (offset >= 0x8000) return m_rom[offset & 0x3fff]; - + return m_rom[(m_rom_bank_base * 0x8000) + offset]; } diff --git a/src/emu/bus/sega8/rom.h b/src/emu/bus/sega8/rom.h index 8b7336864e1..be540fc1efb 100644 --- a/src/emu/bus/sega8/rom.h +++ b/src/emu/bus/sega8/rom.h @@ -318,17 +318,17 @@ class sega8_hicom_device : public sega8_rom_device public: // construction/destruction sega8_hicom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // device-level overrides virtual void device_start() { save_item(NAME(m_rom_bank_base)); } - + virtual void late_bank_setup(); - + // reading and writing virtual DECLARE_READ8_MEMBER(read_cart); virtual DECLARE_WRITE8_MEMBER(write_cart) {} virtual DECLARE_WRITE8_MEMBER(write_mapper); - + protected: UINT8 m_rom_bank_base; }; diff --git a/src/emu/cpu/arc/arc.c b/src/emu/cpu/arc/arc.c index 4bc688ce92d..86337afa966 100644 --- a/src/emu/cpu/arc/arc.c +++ b/src/emu/cpu/arc/arc.c @@ -99,7 +99,6 @@ void arc_device::device_reset() void arc_device::execute_set_input(int irqline, int state) { - } diff --git a/src/emu/cpu/arc/arcdasm.c b/src/emu/cpu/arc/arcdasm.c index b1fa5d442b1..e5381db23c0 100644 --- a/src/emu/cpu/arc/arcdasm.c +++ b/src/emu/cpu/arc/arcdasm.c @@ -68,7 +68,7 @@ static const char *conditions[0x20] = /* 03 */ "PL", // (aka P - Positive) /* 04 */ "MI", // (aka N - Negative) /* 05 */ "CS", // (aka C, LO - Carry set / Lower than) (unsigned) - /* 06 */ "CC", // (aka CC, NC, HS - Carry Clear / Higher or Same) (unsigned) + /* 06 */ "CC", // (aka CC, NC, HS - Carry Clear / Higher or Same) (unsigned) /* 07 */ "VS", // (aka V - Overflow set) /* 08 */ "VC", // (aka NV - Overflow clear) /* 09 */ "GT", // ( - Greater than) (signed) @@ -204,7 +204,7 @@ CPU_DISASSEMBLE(arc) case 0x05: // BL print("%s(%s)(%s) %08x", basic[opcode], conditions[ARC_CONDITION], delaytype[ARC_BRANCH_DELAY], (ARC_BRANCH_ADDR<<2)+pc+4); break; - + case 0x08: // ADD // todo, short / long immediate formats print("%s %s , %s , %s (%08x)", basic[opcode], regnames[ARC_REGOP_DEST], regnames[ARC_REGOP_OP1], regnames[ARC_REGOP_OP2], op &~ 0xfffffe00); diff --git a/src/emu/cpu/arcompact/arcompact.c b/src/emu/cpu/arcompact/arcompact.c index 4f229f7a291..5527830be1b 100644 --- a/src/emu/cpu/arcompact/arcompact.c +++ b/src/emu/cpu/arcompact/arcompact.c @@ -164,9 +164,8 @@ void arcompact_device::device_reset() /*****************************************************************************/ - + void arcompact_device::execute_set_input(int irqline, int state) { - } diff --git a/src/emu/cpu/arcompact/arcompact.h b/src/emu/cpu/arcompact/arcompact.h index 4bf491daf00..1b901fb6950 100644 --- a/src/emu/cpu/arcompact/arcompact.h +++ b/src/emu/cpu/arcompact/arcompact.h @@ -21,16 +21,15 @@ ARCOMPACT_RETTYPE arcompact_handle##name##_p11(OPS_32) \ { \ int M = (op & 0x00000020) >> 5; \ - \ + \ switch (M) \ { \ case 0x00: return arcompact_handle##name##_p11_m0(PARAMS); \ case 0x01: return arcompact_handle##name##_p11_m1(PARAMS); \ } \ - \ + \ return 0; \ -}; \ - +}; #define ARCOMPACT_HANDLER04_TYPE(name) \ ARCOMPACT_RETTYPE arcompact_handle##name(OPS_32) \ { \ @@ -45,8 +44,7 @@ ARCOMPACT_RETTYPE arcompact_handle##name(OPS_32) \ } \ \ return 0; \ -}; \ - +}; #define ARCOMPACT_HANDLER04_TYPE_PM(name) \ ARCOMPACT_RETTYPE arcompact_handle##name##_p00(OPS_32); \ @@ -55,8 +53,7 @@ ARCOMPACT_RETTYPE arcompact_handle##name(OPS_32) \ ARCOMPACT_RETTYPE arcompact_handle##name##_p11_m0(OPS_32); \ ARCOMPACT_RETTYPE arcompact_handle##name##_p11_m1(OPS_32); \ ARCOMPACT_HANDLER04_P11_TYPE(name); \ - ARCOMPACT_HANDLER04_TYPE(name); \ - + ARCOMPACT_HANDLER04_TYPE(name); class arcompact_device : public cpu_device { @@ -146,53 +143,53 @@ protected: ARCOMPACT_RETTYPE arcompact_handle01_01_01_0f(OPS_32); ARCOMPACT_RETTYPE arcompact_handle02(OPS_32); ARCOMPACT_RETTYPE arcompact_handle03(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_00(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_00(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_01(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_02(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_02(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_03(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_04(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_05(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_06(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_07(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_04(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_05(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_06(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_07(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_08(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_09(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_0a(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_0a(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_0b(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_0c(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_0d(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_0e(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_0f(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_0e(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_0f(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_10(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_11(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_12(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_13(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_14(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_15(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_16(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_17(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_18(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_19(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_13(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_14(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_15(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_16(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_17(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_18(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_19(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_1a(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_1b(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_1c(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_1d(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_20(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_20(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_21(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_22(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_23(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_28(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_29(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2a(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_00(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_01(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_2f_02(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_2f_02(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_03(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_04(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_05(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_06(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_2f_07(OPS_32); -// ARCOMPACT_RETTYPE arcompact_handle04_2f_08(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_2f_07(OPS_32); +// ARCOMPACT_RETTYPE arcompact_handle04_2f_08(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_09(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_0a(OPS_32); ARCOMPACT_RETTYPE arcompact_handle04_2f_0b(OPS_32); @@ -779,9 +776,9 @@ protected: ARCOMPACT_HANDLER04_TYPE_PM(04_14); ARCOMPACT_HANDLER04_TYPE_PM(04_15); ARCOMPACT_HANDLER04_TYPE_PM(04_16); - ARCOMPACT_HANDLER04_TYPE_PM(04_17); + ARCOMPACT_HANDLER04_TYPE_PM(04_17); ARCOMPACT_HANDLER04_TYPE_PM(04_18); - ARCOMPACT_HANDLER04_TYPE_PM(04_19); + ARCOMPACT_HANDLER04_TYPE_PM(04_19); ARCOMPACT_HANDLER04_TYPE_PM(04_20); ARCOMPACT_HANDLER04_TYPE_PM(04_2b); @@ -811,10 +808,10 @@ private: inline UINT32 READ32(UINT32 address) { return m_program->read_dword(address << 2); } inline void WRITE32(UINT32 address, UINT32 data) { m_program->write_dword(address << 2, data); } inline UINT16 READ16(UINT32 address) { return m_program->read_word(address << 1); } - inline void WRITE16(UINT32 address, UINT16 data){ m_program->write_word(address << 1, data); } + inline void WRITE16(UINT32 address, UINT16 data){ m_program->write_word(address << 1, data); } inline UINT8 READ8(UINT32 address) { return m_program->read_byte(address << 0); } - inline void WRITE8(UINT32 address, UINT8 data){ m_program->write_byte(address << 0, data); } - + inline void WRITE8(UINT32 address, UINT8 data){ m_program->write_byte(address << 0, data); } + inline UINT64 READAUX(UINT64 address) { return m_io->read_dword(address *4); } inline void WRITEAUX(UINT64 address, UINT32 data) { m_io->write_dword(address *4, data); } @@ -827,7 +824,7 @@ private: int m_delaylinks; UINT32 m_delayjump; -// f e d c| b a 9 8| 7 6 5 4| 3 2 1 0 +// f e d c| b a 9 8| 7 6 5 4| 3 2 1 0 // - - - L| Z N C V| U DE AE A2|A1 E2 E1 H UINT32 m_status32; @@ -862,7 +859,7 @@ private: #define STATUS32_CHECK_Z (m_status32 & Z_ZERO_FLAG) // Condition 0x0c (LE) -#define CONDITION_LE ((STATUS32_CHECK_Z) || (STATUS32_CHECK_N && !STATUS32_CHECK_V) || (!STATUS32_CHECK_N && STATUS32_CHECK_V)) // Z or (N and /V) or (/N and V) +#define CONDITION_LE ((STATUS32_CHECK_Z) || (STATUS32_CHECK_N && !STATUS32_CHECK_V) || (!STATUS32_CHECK_N && STATUS32_CHECK_V)) // Z or (N and /V) or (/N and V) #define CONDITION_EQ (STATUS32_CHECK_Z) #define CONDITION_CS (STATUS32_CHECK_C) #define CONDITION_LT ((STATUS32_CHECK_N && !STATUS32_CHECK_V) || (!STATUS32_CHECK_N && STATUS32_CHECK_V)) diff --git a/src/emu/cpu/arcompact/arcompact_common.c b/src/emu/cpu/arcompact/arcompact_common.c index c2c12208b1e..b03f27e19ff 100644 --- a/src/emu/cpu/arcompact/arcompact_common.c +++ b/src/emu/cpu/arcompact/arcompact_common.c @@ -4,7 +4,7 @@ \*********************************/ -// condition codes (basic ones are the same as arc +// condition codes (basic ones are the same as arc const char *conditions[0x20] = { /* 00 */ "AL", // (aka RA - Always) @@ -13,7 +13,7 @@ const char *conditions[0x20] = /* 03 */ "PL", // (aka P - Positive) /* 04 */ "MI", // (aka N - Negative) /* 05 */ "CS", // (aka C, LO - Carry set / Lower than) (unsigned) - /* 06 */ "CC", // (aka CC, NC, HS - Carry Clear / Higher or Same) (unsigned) + /* 06 */ "CC", // (aka CC, NC, HS - Carry Clear / Higher or Same) (unsigned) /* 07 */ "VS", // (aka V - Overflow set) /* 08 */ "VC", // (aka NV - Overflow clear) /* 09 */ "GT", // ( - Greater than) (signed) @@ -44,7 +44,7 @@ const char *conditions[0x20] = #define UNUSED_REG "unusedreg" #define AUX_UNUSED_16 \ - /* 0xxx0 */ UNUSED_REG, /* 0xxx1 */ UNUSED_REG, /* 0xxx2 */ UNUSED_REG, /* 0xxx3 */ UNUSED_REG, /* 0xxx4 */ UNUSED_REG, /* 0xxx5 */ UNUSED_REG, /* 0xxx6 */ UNUSED_REG, /* 0xxx7 */ UNUSED_REG, /* 0xxx8 */ UNUSED_REG, /* 0xxx9 */ UNUSED_REG, /* 0xxxa */ UNUSED_REG, /* 0xxxb */ UNUSED_REG, /* 0xxxc */ UNUSED_REG, /* 0xxxd */ UNUSED_REG, /* 0xxxe */ UNUSED_REG, /* 0xxxf */ UNUSED_REG, + /* 0xxx0 */ UNUSED_REG, /* 0xxx1 */ UNUSED_REG, /* 0xxx2 */ UNUSED_REG, /* 0xxx3 */ UNUSED_REG, /* 0xxx4 */ UNUSED_REG, /* 0xxx5 */ UNUSED_REG, /* 0xxx6 */ UNUSED_REG, /* 0xxx7 */ UNUSED_REG, /* 0xxx8 */ UNUSED_REG, /* 0xxx9 */ UNUSED_REG, /* 0xxxa */ UNUSED_REG, /* 0xxxb */ UNUSED_REG, /* 0xxxc */ UNUSED_REG, /* 0xxxd */ UNUSED_REG, /* 0xxxe */ UNUSED_REG, /* 0xxxf */ UNUSED_REG, // the Auxiliary Register set is actually a 2^32 dword address space (so 16 GB / 34-bit) // this table just allows us to improve the debugger display for some of the common core / internal ones @@ -125,7 +125,7 @@ const char *auxregnames[0x420] = AUX_UNUSED_16 /* 0x090 - 0x09f */ AUX_UNUSED_16 /* 0x0a0 - 0x0af */ AUX_UNUSED_16 /* 0x0b0 - 0x0bf */ - // build configuration registers 0x0c0 - 0x0ff + // build configuration registers 0x0c0 - 0x0ff /* 0x0c0 */ "RESERVED AUX 0xc0",/* 0x0c1 */ "RESERVED AUX 0xc1",/* 0x0c2 */ "RESERVED AUX 0xc2",/* 0x0c3 */ "RESERVED AUX 0xc3",/* 0x0c4 */ "RESERVED AUX 0xc4",/* 0x0c5 */ "RESERVED AUX 0xc5",/* 0x0c6 */ "RESERVED AUX 0xc6",/* 0x0c7 */ "RESERVED AUX 0xc7",/* 0x0c8 */ "RESERVED AUX 0xc8",/* 0x0c9 */ "RESERVED AUX 0xc9",/* 0x0ca */ "RESERVED AUX 0xca",/* 0x0cb */ "RESERVED AUX 0xcb",/* 0x0cc */ "RESERVED AUX 0xcc",/* 0x0cd */ "RESERVED AUX 0xcd",/* 0x0ce */ "RESERVED AUX 0xce",/* 0x0cf */ "RESERVED AUX 0xcf", /* 0x0d0 */ "RESERVED AUX 0xd0",/* 0x0d1 */ "RESERVED AUX 0xd1",/* 0x0d2 */ "RESERVED AUX 0xd2",/* 0x0d3 */ "RESERVED AUX 0xd3",/* 0x0d4 */ "RESERVED AUX 0xd4",/* 0x0d5 */ "RESERVED AUX 0xd5",/* 0x0d6 */ "RESERVED AUX 0xd6",/* 0x0d7 */ "RESERVED AUX 0xd7",/* 0x0d8 */ "RESERVED AUX 0xd8",/* 0x0d9 */ "RESERVED AUX 0xd9",/* 0x0da */ "RESERVED AUX 0xda",/* 0x0db */ "RESERVED AUX 0xdb",/* 0x0dc */ "RESERVED AUX 0xdc",/* 0x0dd */ "RESERVED AUX 0xdd",/* 0x0de */ "RESERVED AUX 0xde",/* 0x0df */ "RESERVED AUX 0xdf", /* 0x0e0 */ "RESERVED AUX 0xe0",/* 0x0e1 */ "RESERVED AUX 0xe1",/* 0x0e2 */ "RESERVED AUX 0xe2",/* 0x0e3 */ "RESERVED AUX 0xe3",/* 0x0e4 */ "RESERVED AUX 0xe4",/* 0x0e5 */ "RESERVED AUX 0xe5",/* 0x0e6 */ "RESERVED AUX 0xe6",/* 0x0e7 */ "RESERVED AUX 0xe7",/* 0x0e8 */ "RESERVED AUX 0xe8",/* 0x0e9 */ "RESERVED AUX 0xe9",/* 0x0ea */ "RESERVED AUX 0xea",/* 0x0eb */ "RESERVED AUX 0xeb",/* 0x0ec */ "RESERVED AUX 0xec",/* 0x0ed */ "RESERVED AUX 0xed",/* 0x0ee */ "RESERVED AUX 0xee",/* 0x0ef */ "RESERVED AUX 0xef", @@ -371,8 +371,8 @@ const char *regnames[0x40] = /* 37 */ "r55(ext)", /* 38 */ "r56(ext)", /* 39 */ "r57(M-LO)", // MLO (result registers for optional multply functions) - /* 3a */ "r58(M-MID)", // MMID - /* 3b */ "r59(M-HI)", // MHI + /* 3a */ "r58(M-MID)", // MMID + /* 3b */ "r59(M-HI)", // MHI /* 3c */ "r60(LP_COUNT)", /* 3d */ "r61(reserved)", /* 3e */ "r62(LIMM)", // use Long Immediate Data instead of register @@ -523,4 +523,3 @@ const char *opcodes_04[0x40] = /* 3e */ "0x3e", /* 3f */ "0x3f", }; - diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c index 8e79c587ba1..27deef265c2 100644 --- a/src/emu/cpu/arcompact/arcompact_execute.c +++ b/src/emu/cpu/arcompact/arcompact_execute.c @@ -19,7 +19,7 @@ void arcompact_device::execute_run() { debugger_instruction_hook(this, m_pc); -// printf("new pc %04x\n", m_pc); +// printf("new pc %04x\n", m_pc); if (m_delayactive) { @@ -56,86 +56,65 @@ void arcompact_device::execute_run() #define GET_01_01_01_BRANCH_ADDR \ INT32 address = (op & 0x00fe0000) >> 17; \ address |= ((op & 0x00008000) >> 15) << 7; \ - if (address & 0x80) address = -0x80 + (address & 0x7f); \ - + if (address & 0x80) address = -0x80 + (address & 0x7f); #define GROUP_0e_GET_h \ h = ((op & 0x0007) << 3); \ - h |= ((op & 0x00e0) >> 5); \ - + h |= ((op & 0x00e0) >> 5); #define COMMON32_GET_breg \ int b_temp = (op & 0x07000000) >> 24; \ int B_temp = (op & 0x00007000) >> 12; \ - int breg = b_temp | (B_temp << 3); \ - + int breg = b_temp | (B_temp << 3); #define COMMON32_GET_creg \ - int creg = (op & 0x00000fc0) >> 6; \ - + int creg = (op & 0x00000fc0) >> 6; #define COMMON32_GET_u6 \ - int u = (op & 0x00000fc0) >> 6; \ - + int u = (op & 0x00000fc0) >> 6; #define COMMON32_GET_areg \ - int areg = (op & 0x0000003f) >> 0; \ - + int areg = (op & 0x0000003f) >> 0; #define COMMON32_GET_areg_reserved \ - int ares = (op & 0x0000003f) >> 0; \ - + int ares = (op & 0x0000003f) >> 0; #define COMMON32_GET_F \ - int F = (op & 0x00008000) >> 15; \ - + int F = (op & 0x00008000) >> 15; #define COMMON32_GET_p \ - int p = (op & 0x00c00000) >> 22; \ - + int p = (op & 0x00c00000) >> 22; #define COMMON32_GET_s12 \ int S_temp = (op & 0x0000003f) >> 0; \ int s_temp = (op & 0x00000fc0) >> 6; \ INT32 S = s_temp | (S_temp<<6); \ - if (S & 0x800) S = -0x800 + (S&0x7ff); /* sign extend */ \ - + if (S & 0x800) S = -0x800 + (S&0x7ff); /* sign extend */ #define COMMON32_GET_CONDITION \ UINT8 condition = op & 0x0000001f; #define COMMON16_GET_breg \ - breg = ((op & 0x0700) >>8); \ - + breg = ((op & 0x0700) >>8); #define COMMON16_GET_creg \ - creg = ((op & 0x00e0) >>5); \ - + creg = ((op & 0x00e0) >>5); #define COMMON16_GET_areg \ - areg = ((op & 0x0007) >>0); \ - + areg = ((op & 0x0007) >>0); #define COMMON16_GET_u3 \ - u = ((op & 0x0007) >>0); \ - + u = ((op & 0x0007) >>0); #define COMMON16_GET_u5 \ - u = ((op & 0x001f) >>0); \ - + u = ((op & 0x001f) >>0); #define COMMON16_GET_u8 \ - u = ((op & 0x00ff) >>0); \ - + u = ((op & 0x00ff) >>0); #define COMMON16_GET_u7 \ - u = ((op & 0x007f) >>0); \ - + u = ((op & 0x007f) >>0); #define COMMON16_GET_s9 \ - s = ((op & 0x01ff) >>0); \ - + s = ((op & 0x01ff) >>0); // registers used in 16-bit opcodes hae a limited range // and can only address registers r0-r3 and r12-r15 #define REG_16BIT_RANGE(_reg_) \ - if (_reg_>3) _reg_+= 8; \ - + if (_reg_>3) _reg_+= 8; #define GET_LIMM_32 \ limm = (READ16((m_pc + 4) >> 1) << 16); \ - limm |= READ16((m_pc + 6) >> 1); \ - + limm |= READ16((m_pc + 6) >> 1); #define GET_LIMM_16 \ limm = (READ16((m_pc + 2) >> 1) << 16); \ - limm |= READ16((m_pc + 4) >> 1); \ - + limm |= READ16((m_pc + 4) >> 1); #define PC_ALIGNED32 \ (m_pc&0xfffffffc) @@ -178,7 +157,7 @@ int arcompact_device::check_condition(UINT8 condition) case 0x1f: fatalerror("unhandled condition check %s", conditions[condition]); return -1; } - return -1; + return -1; } @@ -194,44 +173,44 @@ ARCOMPACT_RETTYPE arcompact_device::get_insruction(OPS_32) switch (instruction) // 32-bit instructions (with optional extra dword for immediate data) { - case 0x00: return arcompact_handle00(PARAMS); // Bcc - case 0x01: return arcompact_handle01(PARAMS); // BLcc/BRcc - case 0x02: return arcompact_handle02(PARAMS); // LD r+o - case 0x03: return arcompact_handle03(PARAMS); // ST r+o - case 0x04: return arcompact_handle04(PARAMS); // op a,b,c (basecase) - case 0x05: return arcompact_handle05(PARAMS); // op a,b,c (05 ARC ext) - case 0x06: return arcompact_handle06(PARAMS); // op a,b,c (06 ARC ext) - case 0x07: return arcompact_handle07(PARAMS); // op a,b,c (07 User ext) - case 0x08: return arcompact_handle08(PARAMS); // op a,b,c (08 User ext) - case 0x09: return arcompact_handle09(PARAMS); // op a,b,c (09 Market ext) - case 0x0a: return arcompact_handle0a(PARAMS); // op a,b,c (0a Market ext) - case 0x0b: return arcompact_handle0b(PARAMS); // op a,b,c (0b Market ext) + case 0x00: return arcompact_handle00(PARAMS); // Bcc + case 0x01: return arcompact_handle01(PARAMS); // BLcc/BRcc + case 0x02: return arcompact_handle02(PARAMS); // LD r+o + case 0x03: return arcompact_handle03(PARAMS); // ST r+o + case 0x04: return arcompact_handle04(PARAMS); // op a,b,c (basecase) + case 0x05: return arcompact_handle05(PARAMS); // op a,b,c (05 ARC ext) + case 0x06: return arcompact_handle06(PARAMS); // op a,b,c (06 ARC ext) + case 0x07: return arcompact_handle07(PARAMS); // op a,b,c (07 User ext) + case 0x08: return arcompact_handle08(PARAMS); // op a,b,c (08 User ext) + case 0x09: return arcompact_handle09(PARAMS); // op a,b,c (09 Market ext) + case 0x0a: return arcompact_handle0a(PARAMS); // op a,b,c (0a Market ext) + case 0x0b: return arcompact_handle0b(PARAMS); // op a,b,c (0b Market ext) } } else { switch (instruction) // 16-bit instructions { - case 0x0c: return arcompact_handle0c(PARAMS); // Load/Add reg-reg - case 0x0d: return arcompact_handle0d(PARAMS); // Add/Sub/Shft imm - case 0x0e: return arcompact_handle0e(PARAMS); // Mov/Cmp/Add - case 0x0f: return arcompact_handle0f(PARAMS); // op_S b,b,c (single 16-bit ops) - case 0x10: return arcompact_handle10(PARAMS); // LD_S - case 0x11: return arcompact_handle11(PARAMS); // LDB_S - case 0x12: return arcompact_handle12(PARAMS); // LDW_S - case 0x13: return arcompact_handle13(PARAMS); // LSW_S.X - case 0x14: return arcompact_handle14(PARAMS); // ST_S - case 0x15: return arcompact_handle15(PARAMS); // STB_S - case 0x16: return arcompact_handle16(PARAMS); // STW_S - case 0x17: return arcompact_handle17(PARAMS); // Shift/Sub/Bit - case 0x18: return arcompact_handle18(PARAMS); // Stack Instr - case 0x19: return arcompact_handle19(PARAMS); // GP Instr - case 0x1a: return arcompact_handle1a(PARAMS); // PCL Instr - case 0x1b: return arcompact_handle1b(PARAMS); // MOV_S - case 0x1c: return arcompact_handle1c(PARAMS); // ADD_S/CMP_S - case 0x1d: return arcompact_handle1d(PARAMS); // BRcc_S - case 0x1e: return arcompact_handle1e(PARAMS); // Bcc_S - case 0x1f: return arcompact_handle1f(PARAMS); // BL_S + case 0x0c: return arcompact_handle0c(PARAMS); // Load/Add reg-reg + case 0x0d: return arcompact_handle0d(PARAMS); // Add/Sub/Shft imm + case 0x0e: return arcompact_handle0e(PARAMS); // Mov/Cmp/Add + case 0x0f: return arcompact_handle0f(PARAMS); // op_S b,b,c (single 16-bit ops) + case 0x10: return arcompact_handle10(PARAMS); // LD_S + case 0x11: return arcompact_handle11(PARAMS); // LDB_S + case 0x12: return arcompact_handle12(PARAMS); // LDW_S + case 0x13: return arcompact_handle13(PARAMS); // LSW_S.X + case 0x14: return arcompact_handle14(PARAMS); // ST_S + case 0x15: return arcompact_handle15(PARAMS); // STB_S + case 0x16: return arcompact_handle16(PARAMS); // STW_S + case 0x17: return arcompact_handle17(PARAMS); // Shift/Sub/Bit + case 0x18: return arcompact_handle18(PARAMS); // Stack Instr + case 0x19: return arcompact_handle19(PARAMS); // GP Instr + case 0x1a: return arcompact_handle1a(PARAMS); // PCL Instr + case 0x1b: return arcompact_handle1b(PARAMS); // MOV_S + case 0x1c: return arcompact_handle1c(PARAMS); // ADD_S/CMP_S + case 0x1d: return arcompact_handle1d(PARAMS); // BRcc_S + case 0x1e: return arcompact_handle1e(PARAMS); // Bcc_S + case 0x1f: return arcompact_handle1f(PARAMS); // BL_S } } @@ -501,15 +480,15 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_2f(OPS_32) switch (subinstr2) { - case 0x00: return arcompact_handle05_2f_00(PARAMS); // SWAP - case 0x01: return arcompact_handle05_2f_01(PARAMS); // NORM + case 0x00: return arcompact_handle05_2f_00(PARAMS); // SWAP + case 0x01: return arcompact_handle05_2f_01(PARAMS); // NORM case 0x02: return arcompact_handle05_2f_02(PARAMS); // SAT16 - case 0x03: return arcompact_handle05_2f_03(PARAMS); // RND16 - case 0x04: return arcompact_handle05_2f_04(PARAMS); // ABSSW - case 0x05: return arcompact_handle05_2f_05(PARAMS); // ABSS - case 0x06: return arcompact_handle05_2f_06(PARAMS); // NEGSW - case 0x07: return arcompact_handle05_2f_07(PARAMS); // NEGS - case 0x08: return arcompact_handle05_2f_08(PARAMS); // NORMW + case 0x03: return arcompact_handle05_2f_03(PARAMS); // RND16 + case 0x04: return arcompact_handle05_2f_04(PARAMS); // ABSSW + case 0x05: return arcompact_handle05_2f_05(PARAMS); // ABSS + case 0x06: return arcompact_handle05_2f_06(PARAMS); // NEGSW + case 0x07: return arcompact_handle05_2f_07(PARAMS); // NEGS + case 0x08: return arcompact_handle05_2f_08(PARAMS); // NORMW case 0x09: return arcompact_handle05_2f_09(PARAMS); // illegal case 0x0a: return arcompact_handle05_2f_0a(PARAMS); // illegal case 0x0b: return arcompact_handle05_2f_0b(PARAMS); // illegal @@ -935,13 +914,13 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17(OPS_16) switch (subinstr) { - case 0x00: return arcompact_handle17_00(PARAMS); // ASL_S - case 0x01: return arcompact_handle17_01(PARAMS); // LSR_S + case 0x00: return arcompact_handle17_00(PARAMS); // ASL_S + case 0x01: return arcompact_handle17_01(PARAMS); // LSR_S case 0x02: return arcompact_handle17_02(PARAMS); // ASR_S - case 0x03: return arcompact_handle17_03(PARAMS); // SUB_S - case 0x04: return arcompact_handle17_04(PARAMS); // BSET_S - case 0x05: return arcompact_handle17_05(PARAMS); // BCLR_S - case 0x06: return arcompact_handle17_06(PARAMS); // BMSK_S + case 0x03: return arcompact_handle17_03(PARAMS); // SUB_S + case 0x04: return arcompact_handle17_04(PARAMS); // BSET_S + case 0x05: return arcompact_handle17_05(PARAMS); // BCLR_S + case 0x06: return arcompact_handle17_06(PARAMS); // BMSK_S case 0x07: return arcompact_handle17_07(PARAMS); // BTST_S } @@ -967,7 +946,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18(OPS_16) return 0; } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_05(OPS_16) +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_05(OPS_16) { UINT8 subinstr2 = (op & 0x0700) >> 8; @@ -975,7 +954,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_05(OPS_16) { case 0x00: return arcompact_handle18_05_00(PARAMS); // ADD_S (SP) case 0x01: return arcompact_handle18_05_01(PARAMS); // SUB_S (SP) - case 0x02: return arcompact_handle18_05_02(PARAMS); // <illegal 0x18_05_02> + case 0x02: return arcompact_handle18_05_02(PARAMS); // <illegal 0x18_05_02> case 0x03: return arcompact_handle18_05_03(PARAMS); // <illegal 0x18_05_03> case 0x04: return arcompact_handle18_05_04(PARAMS); // <illegal 0x18_05_04> case 0x05: return arcompact_handle18_05_05(PARAMS); // <illegal 0x18_05_05> @@ -986,7 +965,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_05(OPS_16) return 0; } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_06(OPS_16) +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_06(OPS_16) { UINT8 subinstr2 = (op & 0x001f) >> 0; @@ -1029,7 +1008,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_06(OPS_16) return 0; } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07(OPS_16) +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07(OPS_16) { UINT8 subinstr2 = (op & 0x001f) >> 0; @@ -1135,13 +1114,13 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03(OPS_16) switch (subinstr2) { case 0x00: return arcompact_handle1e_03_00(PARAMS); // BGT_S - case 0x01: return arcompact_handle1e_03_01(PARAMS); // BGE_S + case 0x01: return arcompact_handle1e_03_01(PARAMS); // BGE_S case 0x02: return arcompact_handle1e_03_02(PARAMS); // BLT_S case 0x03: return arcompact_handle1e_03_03(PARAMS); // BLE_S case 0x04: return arcompact_handle1e_03_04(PARAMS); // BHI_S case 0x05: return arcompact_handle1e_03_05(PARAMS); // BHS_S case 0x06: return arcompact_handle1e_03_06(PARAMS); // BLO_S - case 0x07: return arcompact_handle1e_03_07(PARAMS); // BLS_S + case 0x07: return arcompact_handle1e_03_07(PARAMS); // BLS_S } return 0; @@ -1177,7 +1156,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle00_00(OPS_32) } else { - // m_regs[REG_BLINK] = m_pc + (size >> 0); // don't link + // m_regs[REG_BLINK] = m_pc + (size >> 0); // don't link return realaddress; } @@ -1194,7 +1173,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle00_01(OPS_32) address |= ((op & 0x0000000f) >> 0) << 20; if (address & 0x800000) address = -0x800000 + (address & 0x7fffff); int n = (op & 0x00000020) >> 5; op &= ~0x00000020; -// int res = (op & 0x00000010) >> 4; op &= ~0x00000010; // should be set to 0 +// int res = (op & 0x00000010) >> 4; op &= ~0x00000010; // should be set to 0 UINT32 realaddress = PC_ALIGNED32 + (address * 2); @@ -1206,7 +1185,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle00_01(OPS_32) } else { - // m_regs[REG_BLINK] = m_pc + (size >> 0); // don't link + // m_regs[REG_BLINK] = m_pc + (size >> 0); // don't link return realaddress; } @@ -1234,9 +1213,9 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_00_01dasm(OPS_32) INT32 address = (op & 0x07fc0000) >> 17; address |= ((op & 0x0000ffc0) >> 6) << 10; address |= ((op & 0x0000000f) >> 0) << 20; - if (address & 0x800000) address = -0x800000 + (address&0x7fffff); + if (address & 0x800000) address = -0x800000 + (address&0x7fffff); int n = (op & 0x00000020) >> 5; op &= ~0x00000020; -// int res = (op & 0x00000010) >> 4; op &= ~0x00000010; +// int res = (op & 0x00000010) >> 4; op &= ~0x00000010; UINT32 realaddress = PC_ALIGNED32 + (address * 2); @@ -1271,7 +1250,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_01_01_00_helper(OPS_32, const char if ((breg != LIMM_REG) && (creg != LIMM_REG)) { - } else { @@ -1305,22 +1283,21 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_01_01_00_helper(OPS_32, const char UINT32 limm; \ GET_LIMM_32; \ size = 8; \ - \ + \ if (breg == LIMM_REG) \ b = limm; \ else \ b = m_regs[breg]; \ - \ + \ if (creg == LIMM_REG) \ c = limm; \ else \ c = m_regs[creg]; \ - } \ - + } #define BR_TAKEJUMP \ /* take jump */ \ UINT32 realaddress = PC_ALIGNED32 + (address * 2); \ - \ + \ if (n) \ { \ m_delayactive = 1; \ @@ -1330,8 +1307,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_01_01_00_helper(OPS_32, const char else \ { \ return realaddress; \ - } \ - + } ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_00_00(OPS_32) // register - register BREQ @@ -1343,7 +1319,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_00_00(OPS_32) // regi { BR_TAKEJUMP } - + return m_pc + (size>>0); } @@ -1356,7 +1332,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_00_01(OPS_32) // regis { BR_TAKEJUMP } - + return m_pc + (size>>0); } @@ -1369,20 +1345,20 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_00_02(OPS_32) // regit { BR_TAKEJUMP } - + return m_pc + (size>>0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_00_03(OPS_32) // register - register BRGE +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_00_03(OPS_32) // register - register BRGE { BR_REGREG_SETUP - + // BRGE (signed operation) if ((INT32)b >= (INT32)c) { BR_TAKEJUMP } - + return m_pc + (size>>0); } @@ -1395,7 +1371,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_00_04(OPS_32) // regis { BR_TAKEJUMP } - + return m_pc + (size>>0); } @@ -1409,7 +1385,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_00_05(OPS_32) // regis { BR_TAKEJUMP } - + return m_pc + (size>>0); } @@ -1443,33 +1419,32 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_01_01_01_helper(OPS_32, const char GET_LIMM_32; \ size = 8; \ b = limm; \ - } \ - + } // register -immediate cases ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_00(OPS_32) // BREQ reg-imm { BR_REGIMM_SETUP - + // BREQ if (b == c) { BR_TAKEJUMP } - + return m_pc + (size>>0); } ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_01(OPS_32) // BRNE reg-imm { BR_REGIMM_SETUP - + // BRNE if (b != c) { BR_TAKEJUMP } - + return m_pc + (size>>0); } @@ -1478,26 +1453,26 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_01(OPS_32) // BRNE ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_02(OPS_32) // BRLT reg-imm { BR_REGIMM_SETUP - + // BRLT (signed operation) if ((INT32)b < (INT32)c) { BR_TAKEJUMP } - + return m_pc + (size>>0); } ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_03(OPS_32) { BR_REGIMM_SETUP - + // BRGE (signed operation) if ((INT32)b >= (INT32)c) { BR_TAKEJUMP } - + return m_pc + (size>>0); } @@ -1510,7 +1485,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_04(OPS_32) // regi { BR_TAKEJUMP } - + return m_pc + (size>>0); } @@ -1524,7 +1499,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle01_01_01_05(OPS_32) // regis { BR_TAKEJUMP } - + return m_pc + (size>>0); } @@ -1547,7 +1522,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle02(OPS_32) int X = (op & 0x00000040) >> 6; //op &= ~0x00000040; int Z = (op & 0x00000180) >> 7; //op &= ~0x00000180; int a = (op & 0x00000600) >> 9; //op &= ~0x00000600; -// int D = (op & 0x00000800) >> 11;// op &= ~0x00000800; // we don't use the data cache currently +// int D = (op & 0x00000800) >> 11;// op &= ~0x00000800; // we don't use the data cache currently UINT32 address = m_regs[breg]; @@ -1635,18 +1610,18 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle03(OPS_32) { int size = 4; UINT32 limm = 0; - int got_limm = 0; + int got_limm = 0; int S = (op & 0x00008000) >> 15; int s = (op & 0x00ff0000) >> 16; if (S) s = -0x100 + s; COMMON32_GET_breg; COMMON32_GET_creg; - -// int R = (op & 0x00000001) >> 0; // bit 0 is reserved - int Z = (op & 0x00000006) >> 1; - int a = (op & 0x00000018) >> 3; -// int D = (op & 0x00000020) >> 5; // we don't use the data cache currently + +// int R = (op & 0x00000001) >> 0; // bit 0 is reserved + int Z = (op & 0x00000006) >> 1; + int a = (op & 0x00000018) >> 3; +// int D = (op & 0x00000020) >> 5; // we don't use the data cache currently UINT32 address = m_regs[breg]; @@ -1738,7 +1713,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_helper(OPS_32, const char COMMON32_GET_p; COMMON32_GET_breg; - + if (!b_reserved) { if (breg == LIMM_REG) @@ -1813,24 +1788,24 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_helper(OPS_32, const char #include "cpu/arcompact/arcompact.inc" -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_01(OPS_32) -{ +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_01(OPS_32) +{ return arcompact_handle04_helper(PARAMS, opcodes_04[0x01], /*"ADC"*/ 0,0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_03(OPS_32) +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_03(OPS_32) { return arcompact_handle04_helper(PARAMS, opcodes_04[0x03], /*"SBC"*/ 0,0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_08(OPS_32) +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_08(OPS_32) { return arcompact_handle04_helper(PARAMS, opcodes_04[0x08], /*"MAX"*/ 0,0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_09(OPS_32) +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_09(OPS_32) { return arcompact_handle04_helper(PARAMS, opcodes_04[0x09], /*"MIN"*/ 0,0); } @@ -1848,24 +1823,24 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0c(OPS_32) } ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0d(OPS_32) -{ +{ return arcompact_handle04_helper(PARAMS, opcodes_04[0x0d], /*"RCMP"*/ 1,0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_10(OPS_32) -{ +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_10(OPS_32) +{ return arcompact_handle04_helper(PARAMS, opcodes_04[0x10], /*"BCLR"*/ 0,0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_11(OPS_32) -{ +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_11(OPS_32) +{ return arcompact_handle04_helper(PARAMS, opcodes_04[0x11], /*"BTST"*/ 0,0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_12(OPS_32) -{ +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_12(OPS_32) +{ return arcompact_handle04_helper(PARAMS, opcodes_04[0x12], /*"BXOR"*/ 0,0); } @@ -1874,23 +1849,23 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_12(OPS_32) -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1a(OPS_32) -{ +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1a(OPS_32) +{ return arcompact_handle04_helper(PARAMS, opcodes_04[0x1a], /*"MPY"*/ 0,0); } // * -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1b(OPS_32) -{ +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1b(OPS_32) +{ return arcompact_handle04_helper(PARAMS, opcodes_04[0x1b], /*"MPYH"*/ 0,0); } // * -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1c(OPS_32) -{ +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1c(OPS_32) +{ return arcompact_handle04_helper(PARAMS, opcodes_04[0x1c], /*"MPYHU"*/ 0,0); } // * -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1d(OPS_32) -{ +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_1d(OPS_32) +{ return arcompact_handle04_helper(PARAMS, opcodes_04[0x1d], /*"MPYU"*/ 0,0); } // * @@ -1903,7 +1878,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p00(OPS_32) COMMON32_GET_creg COMMON32_GET_F - if (creg == LIMM_REG) + if (creg == LIMM_REG) { // opcode iiii i--- ppII IIII F--- CCCC CC-- ---- // J limm 0010 0RRR 0010 0000 0RRR 1111 10RR RRRR [LIMM] (creg = LIMM) @@ -1945,7 +1920,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p00(OPS_32) } else { - return m_regs[creg]; } } @@ -2003,7 +1977,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m0(OPS_32) // Jcc // opcode iiii i--- ppII IIII F--- cccc ccmq qqqq // Jcc [c] 0010 0RRR 1110 0000 0RRR CCCC CC0Q QQQQ // no conditional links to ILINK1, ILINK2? - + c = m_regs[creg]; } @@ -2026,7 +2000,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m0(OPS_32) // Jcc } if (F) - { + { // if F is set then the destination MUST be ILINK1 or ILINK2 if ((creg == REG_ILINK1) || (creg == REG_ILINK1)) @@ -2037,7 +2011,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_20_p11_m0(OPS_32) // Jcc { arcompact_fatal ("fatal arcompact_handle04_20_p11_m0 J %08x (F set but not ILINK1 or ILINK2 used as dst)", op); - } + } } @@ -2076,7 +2050,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_23(OPS_32) ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_28(OPS_32) // LPcc (loop setup) { int size = 4; -// COMMON32_GET_breg; // breg is reserved +// COMMON32_GET_breg; // breg is reserved COMMON32_GET_p; if (p == 0x00) @@ -2099,7 +2073,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_28(OPS_32) // LPcc (loop COMMON32_GET_u6 COMMON32_GET_CONDITION //arcompact_fatal("Lp conditional %s not supported %d", conditions[condition], u); - + // if the loop condition fails then just jump to after the end of the loop, don't set any registers if (!check_condition(condition)) { @@ -2124,7 +2098,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_28(OPS_32) // LPcc (loop ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2a(OPS_32) // Load FROM Auxiliary register TO register { int size = 4; -// UINT32 limm = 0; +// UINT32 limm = 0; int got_limm = 0; COMMON32_GET_p; @@ -2132,7 +2106,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2a(OPS_32) // Load FROM if (p == 0) { - COMMON32_GET_creg if (creg == LIMM_REG) @@ -2142,7 +2115,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2a(OPS_32) // Load FROM //GET_LIMM_32; size = 8; } - + } else { @@ -2176,7 +2149,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_helper(OPS_32, const c COMMON32_GET_p; //COMMON32_GET_breg; - + if (p == 0) { COMMON32_GET_creg @@ -2185,7 +2158,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2f_helper(OPS_32, const c { //UINT32 limm; //GET_LIMM_32; - size = 8; + size = 8; } else { @@ -2265,7 +2238,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_3x_helper(OPS_32, int dsi } else { - } + } arcompact_log("unimplemented LD %08x (type 04_3x)", op); return m_pc + (size>>0); @@ -2313,7 +2286,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_2f_0x_helper(OPS_32, cons COMMON32_GET_p; //COMMON32_GET_breg; - + if (p == 0) { COMMON32_GET_creg @@ -2322,7 +2295,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle05_2f_0x_helper(OPS_32, cons { //UINT32 limm; //GET_LIMM_32; - size = 8; + size = 8; } else @@ -2454,7 +2427,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_0x_helper(OPS_16, const c int size = 2; GROUP_0e_GET_h; - + if (h == LIMM_REG) { //UINT32 limm; @@ -2463,7 +2436,6 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_0x_helper(OPS_16, const c } else { - } arcompact_log("unimplemented %s %04x (0x0e_0x group)", optext, op); @@ -2480,7 +2452,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_00(OPS_16) // ADD_s b, b, GROUP_0e_GET_h; COMMON16_GET_breg; REG_16BIT_RANGE(breg); - + if (h == LIMM_REG) { UINT32 limm; @@ -2499,7 +2471,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_00(OPS_16) // ADD_s b, b, } // 16-bit MOV with extended register range -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_01(OPS_16) // MOV_S b <- h +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_01(OPS_16) // MOV_S b <- h { int h,breg; int size = 2; @@ -2507,7 +2479,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_01(OPS_16) // MOV_S b <- GROUP_0e_GET_h; COMMON16_GET_breg; REG_16BIT_RANGE(breg); - + if (h == LIMM_REG) { // opcode iiii ibbb hhhI Ihhh @@ -2543,10 +2515,9 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_03(OPS_16) // MOV_S h <- GROUP_0e_GET_h; COMMON16_GET_breg; REG_16BIT_RANGE(breg); - + if (h == LIMM_REG) // no result.. { - } m_regs[h] = m_regs[breg]; @@ -2573,9 +2544,9 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_02(OPS_16) // JL_S COMMON16_GET_breg; REG_16BIT_RANGE(breg); - + m_regs[REG_BLINK] = m_pc + (2 >> 0); - + return m_regs[breg]; } @@ -2586,11 +2557,11 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_03(OPS_16) // JL_S.D COMMON16_GET_breg; REG_16BIT_RANGE(breg); - + m_delayactive = 1; m_delayjump = m_regs[breg]; m_delaylinks = 1; - + return m_pc + (2 >> 0); } @@ -2616,7 +2587,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_00_07_07(OPS_16) // J_S.D m_delayactive = 1; m_delayjump = m_regs[REG_BLINK]; m_delaylinks = 0; - + return m_pc + (2 >> 0); } @@ -2679,7 +2650,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle_ld_helper(OPS_16, const cha ARCOMPACT_RETTYPE arcompact_device::arcompact_handle10(OPS_16) -{ // LD_S c, [b, u7] +{ // LD_S c, [b, u7] int breg, creg, u; COMMON16_GET_breg; @@ -2697,7 +2668,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle10(OPS_16) ARCOMPACT_RETTYPE arcompact_device::arcompact_handle11(OPS_16) { - // LDB_S c, [b, u5] + // LDB_S c, [b, u5] int breg, creg, u; COMMON16_GET_breg; @@ -2707,7 +2678,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle11(OPS_16) REG_16BIT_RANGE(breg); REG_16BIT_RANGE(creg); -// u <<= 0; // check +// u <<= 0; // check m_regs[creg] = READ8((m_regs[breg] + u) >> 0); return m_pc + (2 >> 0); @@ -2715,7 +2686,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle11(OPS_16) ARCOMPACT_RETTYPE arcompact_device::arcompact_handle12(OPS_16) { - // LDB_W c, [b, u6] + // LDB_W c, [b, u6] int breg, creg, u; COMMON16_GET_breg; @@ -2765,7 +2736,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle15(OPS_16) // STB_S c. [b, u REG_16BIT_RANGE(breg); REG_16BIT_RANGE(creg); -// u <<= 0; +// u <<= 0; WRITE8((m_regs[breg] + u) >> 0, m_regs[creg]); @@ -2833,7 +2804,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_00(OPS_16) // LD_S b, [ return m_pc + (2 >> 0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_01(OPS_16) +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_01(OPS_16) { return arcompact_handle18_0x_helper(PARAMS, "LDB_S (SP)", 0); } @@ -2855,7 +2826,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_02(OPS_16) // ST_S b, [S return m_pc + (2 >> 0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_03(OPS_16) +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_03(OPS_16) { return arcompact_handle18_0x_helper(PARAMS, "STB_S (SP)", 1); } @@ -2896,13 +2867,13 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_05_01(OPS_16) return m_pc + (2 >> 0); } -// op bits remaining for 0x18_06_xx subgroups 0x0700 +// op bits remaining for 0x18_06_xx subgroups 0x0700 ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_06_01(OPS_16) // POP_S b { int breg; COMMON16_GET_breg; REG_16BIT_RANGE(breg); - + m_regs[breg] = READ32(m_regs[REG_SP] >> 2); m_regs[REG_SP] += 4; @@ -2918,15 +2889,15 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_06_11(OPS_16) // POP_S bl return m_pc + (2 >> 0); } -// op bits remaining for 0x18_07_xx subgroups 0x0700 +// op bits remaining for 0x18_07_xx subgroups 0x0700 ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_01(OPS_16) // PUSH_S b { int breg; COMMON16_GET_breg; REG_16BIT_RANGE(breg); - + m_regs[REG_SP] -= 4; - + WRITE32(m_regs[REG_SP] >> 2, m_regs[breg]); return m_pc + (2 >> 0); @@ -2938,7 +2909,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_11(OPS_16) // PUSH_S [ // breg bits are reserved m_regs[REG_SP] -= 4; - + WRITE32(m_regs[REG_SP] >> 2, m_regs[REG_BLINK]); return m_pc + (2 >> 0); @@ -3058,7 +3029,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1d_00(OPS_16) // BREQ_S b,0, if (!m_regs[breg]) { - int s = (op & 0x007f) >> 0; op &= ~0x007f; + int s = (op & 0x007f) >> 0; op &= ~0x007f; if (s & 0x40) s = -0x40 + (s & 0x3f); UINT32 realaddress = PC_ALIGNED32 + (s * 2); //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link @@ -3077,7 +3048,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1d_01(OPS_16) // BRNE_S b,0, if (m_regs[breg]) { - int s = (op & 0x007f) >> 0; op &= ~0x007f; + int s = (op & 0x007f) >> 0; op &= ~0x007f; if (s & 0x40) s = -0x40 + (s & 0x3f); UINT32 realaddress = PC_ALIGNED32 + (s * 2); //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link @@ -3098,7 +3069,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_0x_helper(OPS_16, const c ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_00(OPS_16) // B_S s10 (branch always) { - int s = (op & 0x01ff) >> 0; op &= ~0x01ff; + int s = (op & 0x01ff) >> 0; op &= ~0x01ff; if (s & 0x100) s = -0x100 + (s & 0xff); UINT32 realaddress = PC_ALIGNED32 + (s * 2); //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link @@ -3109,7 +3080,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_01(OPS_16) // BEQ_S s10 ( { if (STATUS32_CHECK_Z) { - int s = (op & 0x01ff) >> 0; op &= ~0x01ff; + int s = (op & 0x01ff) >> 0; op &= ~0x01ff; if (s & 0x100) s = -0x100 + (s & 0xff); UINT32 realaddress = PC_ALIGNED32 + (s * 2); //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link @@ -3123,7 +3094,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_02(OPS_16) // BNE_S s10 { if (!STATUS32_CHECK_Z) { - int s = (op & 0x01ff) >> 0; op &= ~0x01ff; + int s = (op & 0x01ff) >> 0; op &= ~0x01ff; if (s & 0x100) s = -0x100 + (s & 0xff); UINT32 realaddress = PC_ALIGNED32 + (s * 2); //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link @@ -3146,7 +3117,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_02(OPS_16) // BLT_S { if (CONDITION_LT) { - int s = (op & 0x003f) >> 0; op &= ~0x003f; + int s = (op & 0x003f) >> 0; op &= ~0x003f; if (s & 0x020) s = -0x20 + (s & 0x1f); UINT32 realaddress = PC_ALIGNED32 + (s * 2); //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link @@ -3160,7 +3131,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_03(OPS_16) // BLE_S { if (CONDITION_LE) { - int s = (op & 0x003f) >> 0; op &= ~0x003f; + int s = (op & 0x003f) >> 0; op &= ~0x003f; if (s & 0x020) s = -0x20 + (s & 0x1f); UINT32 realaddress = PC_ALIGNED32 + (s * 2); //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link @@ -3177,7 +3148,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_03_07(OPS_16) { return a ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1f(OPS_16) // BL_S s13 { - int s = (op & 0x07ff) >> 0; op &= ~0x07ff; + int s = (op & 0x07ff) >> 0; op &= ~0x07ff; if (s & 0x400) s = -0x400 + (s & 0x3ff); UINT32 realaddress = PC_ALIGNED32 + (s * 4); @@ -3600,6 +3571,3 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_1c(OPS_16) { arcompac ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_1d(OPS_16) { arcompact_fatal("<illegal 0x18_07_1d> (%04x)", op); return m_pc + (2 >> 0);} ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_1e(OPS_16) { arcompact_fatal("<illegal 0x18_07_1e> (%04x)", op); return m_pc + (2 >> 0);} ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_1f(OPS_16) { arcompact_fatal("<illegal 0x18_07_1f> (%04x)", op); return m_pc + (2 >> 0);} - - - diff --git a/src/emu/cpu/arcompact/arcompactdasm.c b/src/emu/cpu/arcompact/arcompactdasm.c index 54829b61729..f1ff19942a1 100644 --- a/src/emu/cpu/arcompact/arcompactdasm.c +++ b/src/emu/cpu/arcompact/arcompactdasm.c @@ -41,48 +41,48 @@ CPU_DISASSEMBLE(arcompact) switch (instruction) // 32-bit instructions (with optional extra dword for immediate data) { - case 0x00: size = arcompact_handle00_dasm(DASM_PARAMS); break; // Bcc - case 0x01: size = arcompact_handle01_dasm(DASM_PARAMS); break; // BLcc/BRcc - case 0x02: size = arcompact_handle02_dasm(DASM_PARAMS); break; // LD r+o - case 0x03: size = arcompact_handle03_dasm(DASM_PARAMS); break; // ST r+o - case 0x04: size = arcompact_handle04_dasm(DASM_PARAMS); break; // op a,b,c (basecase) - case 0x05: size = arcompact_handle05_dasm(DASM_PARAMS); break; // op a,b,c (05 ARC ext) - case 0x06: size = arcompact_handle06_dasm(DASM_PARAMS); break; // op a,b,c (06 ARC ext) - case 0x07: size = arcompact_handle07_dasm(DASM_PARAMS); break; // op a,b,c (07 User ext) - case 0x08: size = arcompact_handle08_dasm(DASM_PARAMS); break; // op a,b,c (08 User ext) - case 0x09: size = arcompact_handle09_dasm(DASM_PARAMS); break; // op a,b,c (09 Market ext) - case 0x0a: size = arcompact_handle0a_dasm(DASM_PARAMS); break; // op a,b,c (0a Market ext) - case 0x0b: size = arcompact_handle0b_dasm(DASM_PARAMS); break; // op a,b,c (0b Market ext) + case 0x00: size = arcompact_handle00_dasm(DASM_PARAMS); break; // Bcc + case 0x01: size = arcompact_handle01_dasm(DASM_PARAMS); break; // BLcc/BRcc + case 0x02: size = arcompact_handle02_dasm(DASM_PARAMS); break; // LD r+o + case 0x03: size = arcompact_handle03_dasm(DASM_PARAMS); break; // ST r+o + case 0x04: size = arcompact_handle04_dasm(DASM_PARAMS); break; // op a,b,c (basecase) + case 0x05: size = arcompact_handle05_dasm(DASM_PARAMS); break; // op a,b,c (05 ARC ext) + case 0x06: size = arcompact_handle06_dasm(DASM_PARAMS); break; // op a,b,c (06 ARC ext) + case 0x07: size = arcompact_handle07_dasm(DASM_PARAMS); break; // op a,b,c (07 User ext) + case 0x08: size = arcompact_handle08_dasm(DASM_PARAMS); break; // op a,b,c (08 User ext) + case 0x09: size = arcompact_handle09_dasm(DASM_PARAMS); break; // op a,b,c (09 Market ext) + case 0x0a: size = arcompact_handle0a_dasm(DASM_PARAMS); break; // op a,b,c (0a Market ext) + case 0x0b: size = arcompact_handle0b_dasm(DASM_PARAMS); break; // op a,b,c (0b Market ext) } } else - { + { size = 2; op &= ~0xf800; switch (instruction) // 16-bit instructions { - case 0x0c: size = arcompact_handle0c_dasm(DASM_PARAMS); break; // Load/Add reg-reg - case 0x0d: size = arcompact_handle0d_dasm(DASM_PARAMS); break; // Add/Sub/Shft imm - case 0x0e: size = arcompact_handle0e_dasm(DASM_PARAMS); break; // Mov/Cmp/Add - case 0x0f: size = arcompact_handle0f_dasm(DASM_PARAMS); break; // op_S b,b,c (single 16-bit ops) - case 0x10: size = arcompact_handle10_dasm(DASM_PARAMS); break; // LD_S - case 0x11: size = arcompact_handle11_dasm(DASM_PARAMS); break; // LDB_S - case 0x12: size = arcompact_handle12_dasm(DASM_PARAMS); break; // LDW_S - case 0x13: size = arcompact_handle13_dasm(DASM_PARAMS); break; // LSW_S.X - case 0x14: size = arcompact_handle14_dasm(DASM_PARAMS); break; // ST_S - case 0x15: size = arcompact_handle15_dasm(DASM_PARAMS); break; // STB_S - case 0x16: size = arcompact_handle16_dasm(DASM_PARAMS); break; // STW_S - case 0x17: size = arcompact_handle17_dasm(DASM_PARAMS); break; // Shift/Sub/Bit - case 0x18: size = arcompact_handle18_dasm(DASM_PARAMS); break; // Stack Instr - case 0x19: size = arcompact_handle19_dasm(DASM_PARAMS); break; // GP Instr - case 0x1a: size = arcompact_handle1a_dasm(DASM_PARAMS); break; // PCL Instr - case 0x1b: size = arcompact_handle1b_dasm(DASM_PARAMS); break; // MOV_S - case 0x1c: size = arcompact_handle1c_dasm(DASM_PARAMS); break; // ADD_S/CMP_S - case 0x1d: size = arcompact_handle1d_dasm(DASM_PARAMS); break; // BRcc_S - case 0x1e: size = arcompact_handle1e_dasm(DASM_PARAMS); break; // Bcc_S - case 0x1f: size = arcompact_handle1f_dasm(DASM_PARAMS); break; // BL_S + case 0x0c: size = arcompact_handle0c_dasm(DASM_PARAMS); break; // Load/Add reg-reg + case 0x0d: size = arcompact_handle0d_dasm(DASM_PARAMS); break; // Add/Sub/Shft imm + case 0x0e: size = arcompact_handle0e_dasm(DASM_PARAMS); break; // Mov/Cmp/Add + case 0x0f: size = arcompact_handle0f_dasm(DASM_PARAMS); break; // op_S b,b,c (single 16-bit ops) + case 0x10: size = arcompact_handle10_dasm(DASM_PARAMS); break; // LD_S + case 0x11: size = arcompact_handle11_dasm(DASM_PARAMS); break; // LDB_S + case 0x12: size = arcompact_handle12_dasm(DASM_PARAMS); break; // LDW_S + case 0x13: size = arcompact_handle13_dasm(DASM_PARAMS); break; // LSW_S.X + case 0x14: size = arcompact_handle14_dasm(DASM_PARAMS); break; // ST_S + case 0x15: size = arcompact_handle15_dasm(DASM_PARAMS); break; // STB_S + case 0x16: size = arcompact_handle16_dasm(DASM_PARAMS); break; // STW_S + case 0x17: size = arcompact_handle17_dasm(DASM_PARAMS); break; // Shift/Sub/Bit + case 0x18: size = arcompact_handle18_dasm(DASM_PARAMS); break; // Stack Instr + case 0x19: size = arcompact_handle19_dasm(DASM_PARAMS); break; // GP Instr + case 0x1a: size = arcompact_handle1a_dasm(DASM_PARAMS); break; // PCL Instr + case 0x1b: size = arcompact_handle1b_dasm(DASM_PARAMS); break; // MOV_S + case 0x1c: size = arcompact_handle1c_dasm(DASM_PARAMS); break; // ADD_S/CMP_S + case 0x1d: size = arcompact_handle1d_dasm(DASM_PARAMS); break; // BRcc_S + case 0x1e: size = arcompact_handle1e_dasm(DASM_PARAMS); break; // Bcc_S + case 0x1f: size = arcompact_handle1f_dasm(DASM_PARAMS); break; // BL_S } } diff --git a/src/emu/cpu/arcompact/arcompactdasm_dispatch.c b/src/emu/cpu/arcompact/arcompactdasm_dispatch.c index 172c00893f2..b510cb28c41 100644 --- a/src/emu/cpu/arcompact/arcompactdasm_dispatch.c +++ b/src/emu/cpu/arcompact/arcompactdasm_dispatch.c @@ -141,9 +141,9 @@ int arcompact_handle04_dasm(DASM_OPS_32) // 00100 bbb 00 iiiiii F BBB CCCCCC A AAAAA General Operations *UN*Conditional Register to Register // 00100 bbb 01 iiiiii F BBB UUUUUU A AAAAA General Operations *UN*Conditional Register (Unsigned 6-bit IMM) // 00100 bbb 10 iiiiii F BBB ssssss S SSSSS General Operations *UN*Conditional Register (Signed 12-bit IMM) - - // 00100 bbb 11 iiiiii F BBB CCCCCC 0 QQQQQ General Operations Conditional Register - // 00100 bbb 11 iiiiii F BBB UUUUUU 1 QQQQQ General Operations Conditional Register (Unsigned 6-bit IMM) + + // 00100 bbb 11 iiiiii F BBB CCCCCC 0 QQQQQ General Operations Conditional Register + // 00100 bbb 11 iiiiii F BBB UUUUUU 1 QQQQQ General Operations Conditional Register (Unsigned 6-bit IMM) UINT8 subinstr = (op & 0x003f0000) >> 16; op &= ~0x003f0000; @@ -304,15 +304,15 @@ int arcompact_handle05_2f_dasm(DASM_OPS_32) switch (subinstr2) { - case 0x00: size = arcompact_handle05_2f_00_dasm(DASM_PARAMS); break; // SWAP - case 0x01: size = arcompact_handle05_2f_01_dasm(DASM_PARAMS); break; // NORM + case 0x00: size = arcompact_handle05_2f_00_dasm(DASM_PARAMS); break; // SWAP + case 0x01: size = arcompact_handle05_2f_01_dasm(DASM_PARAMS); break; // NORM case 0x02: size = arcompact_handle05_2f_02_dasm(DASM_PARAMS); break; // SAT16 - case 0x03: size = arcompact_handle05_2f_03_dasm(DASM_PARAMS); break; // RND16 - case 0x04: size = arcompact_handle05_2f_04_dasm(DASM_PARAMS); break; // ABSSW - case 0x05: size = arcompact_handle05_2f_05_dasm(DASM_PARAMS); break; // ABSS - case 0x06: size = arcompact_handle05_2f_06_dasm(DASM_PARAMS); break; // NEGSW - case 0x07: size = arcompact_handle05_2f_07_dasm(DASM_PARAMS); break; // NEGS - case 0x08: size = arcompact_handle05_2f_08_dasm(DASM_PARAMS); break; // NORMW + case 0x03: size = arcompact_handle05_2f_03_dasm(DASM_PARAMS); break; // RND16 + case 0x04: size = arcompact_handle05_2f_04_dasm(DASM_PARAMS); break; // ABSSW + case 0x05: size = arcompact_handle05_2f_05_dasm(DASM_PARAMS); break; // ABSS + case 0x06: size = arcompact_handle05_2f_06_dasm(DASM_PARAMS); break; // NEGSW + case 0x07: size = arcompact_handle05_2f_07_dasm(DASM_PARAMS); break; // NEGS + case 0x08: size = arcompact_handle05_2f_08_dasm(DASM_PARAMS); break; // NORMW case 0x09: size = arcompact_handle05_2f_09_dasm(DASM_PARAMS); break; // illegal case 0x0a: size = arcompact_handle05_2f_0a_dasm(DASM_PARAMS); break; // illegal case 0x0b: size = arcompact_handle05_2f_0b_dasm(DASM_PARAMS); break; // illegal @@ -759,13 +759,13 @@ int arcompact_handle17_dasm(DASM_OPS_16) switch (subinstr) { - case 0x00: size = arcompact_handle17_00_dasm(DASM_PARAMS); break; // ASL_S - case 0x01: size = arcompact_handle17_01_dasm(DASM_PARAMS); break; // LSR_S + case 0x00: size = arcompact_handle17_00_dasm(DASM_PARAMS); break; // ASL_S + case 0x01: size = arcompact_handle17_01_dasm(DASM_PARAMS); break; // LSR_S case 0x02: size = arcompact_handle17_02_dasm(DASM_PARAMS); break; // ASR_S - case 0x03: size = arcompact_handle17_03_dasm(DASM_PARAMS); break; // SUB_S - case 0x04: size = arcompact_handle17_04_dasm(DASM_PARAMS); break; // BSET_S - case 0x05: size = arcompact_handle17_05_dasm(DASM_PARAMS); break; // BCLR_S - case 0x06: size = arcompact_handle17_06_dasm(DASM_PARAMS); break; // BMSK_S + case 0x03: size = arcompact_handle17_03_dasm(DASM_PARAMS); break; // SUB_S + case 0x04: size = arcompact_handle17_04_dasm(DASM_PARAMS); break; // BSET_S + case 0x05: size = arcompact_handle17_05_dasm(DASM_PARAMS); break; // BCLR_S + case 0x06: size = arcompact_handle17_06_dasm(DASM_PARAMS); break; // BMSK_S case 0x07: size = arcompact_handle17_07_dasm(DASM_PARAMS); break; // BTST_S } @@ -795,7 +795,7 @@ int arcompact_handle18_dasm(DASM_OPS_16) return size; } -int arcompact_handle18_05_dasm(DASM_OPS_16) +int arcompact_handle18_05_dasm(DASM_OPS_16) { int size = 2; UINT8 subinstr2 = (op & 0x0700) >> 8; @@ -805,7 +805,7 @@ int arcompact_handle18_05_dasm(DASM_OPS_16) { case 0x00: size = arcompact_handle18_05_00_dasm(DASM_PARAMS); break; // ADD_S (SP) case 0x01: size = arcompact_handle18_05_01_dasm(DASM_PARAMS); break; // SUB_S (SP) - case 0x02: size = arcompact_handle18_05_02_dasm(DASM_PARAMS); break; // <illegal 0x18_05_02> + case 0x02: size = arcompact_handle18_05_02_dasm(DASM_PARAMS); break; // <illegal 0x18_05_02> case 0x03: size = arcompact_handle18_05_03_dasm(DASM_PARAMS); break; // <illegal 0x18_05_03> case 0x04: size = arcompact_handle18_05_04_dasm(DASM_PARAMS); break; // <illegal 0x18_05_04> case 0x05: size = arcompact_handle18_05_05_dasm(DASM_PARAMS); break; // <illegal 0x18_05_05> @@ -816,7 +816,7 @@ int arcompact_handle18_05_dasm(DASM_OPS_16) return size; } -int arcompact_handle18_06_dasm(DASM_OPS_16) +int arcompact_handle18_06_dasm(DASM_OPS_16) { int size = 2; UINT8 subinstr2 = (op & 0x001f) >> 0; @@ -861,7 +861,7 @@ int arcompact_handle18_06_dasm(DASM_OPS_16) return size; } -int arcompact_handle18_07_dasm(DASM_OPS_16) +int arcompact_handle18_07_dasm(DASM_OPS_16) { int size = 2; UINT8 subinstr2 = (op & 0x001f) >> 0; @@ -968,7 +968,6 @@ int arcompact_handle1e_dasm(DASM_OPS_16) int arcompact_handle1e_03_dasm(DASM_OPS_16) { - int size = 2; UINT8 subinstr2 = (op & 0x01c0) >> 6; op &= ~0x01c0; @@ -976,13 +975,13 @@ int arcompact_handle1e_03_dasm(DASM_OPS_16) switch (subinstr2) { case 0x00: size = arcompact_handle1e_03_00_dasm(DASM_PARAMS); break; // BGT_S - case 0x01: size = arcompact_handle1e_03_01_dasm(DASM_PARAMS); break; // BGE_S + case 0x01: size = arcompact_handle1e_03_01_dasm(DASM_PARAMS); break; // BGE_S case 0x02: size = arcompact_handle1e_03_02_dasm(DASM_PARAMS); break; // BLT_S case 0x03: size = arcompact_handle1e_03_03_dasm(DASM_PARAMS); break; // BLE_S case 0x04: size = arcompact_handle1e_03_04_dasm(DASM_PARAMS); break; // BHI_S case 0x05: size = arcompact_handle1e_03_05_dasm(DASM_PARAMS); break; // BHS_S case 0x06: size = arcompact_handle1e_03_06_dasm(DASM_PARAMS); break; // BLO_S - case 0x07: size = arcompact_handle1e_03_07_dasm(DASM_PARAMS); break; // BLS_S + case 0x07: size = arcompact_handle1e_03_07_dasm(DASM_PARAMS); break; // BLS_S } return size; diff --git a/src/emu/cpu/arcompact/arcompactdasm_dispatch.h b/src/emu/cpu/arcompact/arcompactdasm_dispatch.h index f317e0ffb8e..5e30a2e8488 100644 --- a/src/emu/cpu/arcompact/arcompactdasm_dispatch.h +++ b/src/emu/cpu/arcompact/arcompactdasm_dispatch.h @@ -12,8 +12,7 @@ #define GET_LIMM_32 \ limm = oprom[6] | (oprom[7] << 8); \ - limm |= (oprom[4] << 16) | (oprom[5] << 24); \ - + limm |= (oprom[4] << 16) | (oprom[5] << 24); int arcompact_handle00_dasm(DASM_OPS_32); diff --git a/src/emu/cpu/arcompact/arcompactdasm_ops.c b/src/emu/cpu/arcompact/arcompactdasm_ops.c index 4cdf09a37a0..842dafe3bd8 100644 --- a/src/emu/cpu/arcompact/arcompactdasm_ops.c +++ b/src/emu/cpu/arcompact/arcompactdasm_ops.c @@ -31,87 +31,68 @@ static void ATTR_PRINTF(1,2) print(const char *fmt, ...) #define GROUP_0e_GET_h \ h = ((op & 0x0007) << 3); \ - h |= ((op & 0x00e0) >> 5); \ - op &= ~0x00e7; \ - + h |= ((op & 0x00e0) >> 5); \ + op &= ~0x00e7; #define COMMON32_GET_breg \ int b_temp = (op & 0x07000000) >> 24; op &= ~0x07000000; \ int B_temp = (op & 0x00007000) >> 12; op &= ~0x00007000; \ - int breg = b_temp | (B_temp << 3); \ - + int breg = b_temp | (B_temp << 3); #define COMMON32_GET_creg \ - int creg = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; \ - + int creg = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; #define COMMON32_GET_u6 \ - int u = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; \ - + int u = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; #define COMMON32_GET_areg \ - int areg = (op & 0x0000003f) >> 0; op &= ~0x0000003f; \ - + int areg = (op & 0x0000003f) >> 0; op &= ~0x0000003f; #define COMMON32_GET_areg_reserved \ - int ares = (op & 0x0000003f) >> 0; op &= ~0x0000003f; \ - + int ares = (op & 0x0000003f) >> 0; op &= ~0x0000003f; #define COMMON32_GET_F \ - int F = (op & 0x00008000) >> 15; op &= ~0x00008000; \ - + int F = (op & 0x00008000) >> 15; op &= ~0x00008000; #define COMMON32_GET_p \ - int p = (op & 0x00c00000) >> 22; op &= ~0x00c00000; \ - + int p = (op & 0x00c00000) >> 22; op &= ~0x00c00000; #define COMMON32_GET_s12 \ int S_temp = (op & 0x0000003f) >> 0; op &= ~0x0000003f; \ int s_temp = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; \ - int S = s_temp | (S_temp<<6); \ - + int S = s_temp | (S_temp<<6); #define COMMON32_GET_CONDITION \ UINT8 condition = op & 0x0000001f; op &= ~0x0000001f; #define COMMON16_GET_breg \ breg = ((op & 0x0700) >>8); \ - op &= ~0x0700; \ - + op &= ~0x0700; #define COMMON16_GET_creg \ creg = ((op & 0x00e0) >>5); \ - op &= ~0x00e0; \ - + op &= ~0x00e0; #define COMMON16_GET_areg \ areg = ((op & 0x0007) >>0); \ - op &= ~0x0007; \ - + op &= ~0x0007; #define COMMON16_GET_u3 \ u = ((op & 0x0007) >>0); \ - op &= ~0x0007; \ - + op &= ~0x0007; #define COMMON16_GET_u5 \ u = ((op & 0x001f) >>0); \ - op &= ~0x001f; \ - + op &= ~0x001f; #define COMMON16_GET_u8 \ u = ((op & 0x00ff) >>0); \ - op &= ~0x00ff; \ - + op &= ~0x00ff; #define COMMON16_GET_u7 \ u = ((op & 0x007f) >>0); \ - op &= ~0x007f; \ - + op &= ~0x007f; #define COMMON16_GET_s9 \ s = ((op & 0x01ff) >>0); \ - op &= ~0x01ff; \ - + op &= ~0x01ff; // registers used in 16-bit opcodes hae a limited range // and can only address registers r0-r3 and r12-r15 #define REG_16BIT_RANGE(_reg_) \ - if (_reg_>3) _reg_+= 8; \ - + if (_reg_>3) _reg_+= 8; // this is as messed up as the rest of the 16-bit alignment in LE mode... #define GET_LIMM \ limm = oprom[4] | (oprom[5] << 8); \ - limm |= (oprom[2] << 16) | (oprom[3] << 24); \ - + limm |= (oprom[2] << 16) | (oprom[3] << 24); #define PC_ALIGNED32 \ (pc&0xfffffffc) @@ -163,7 +144,7 @@ int arcompact_handle01_00_00dasm(DASM_OPS_32) // 00001 sssssssss 00 SSSSSSSSSS N QQQQQ INT32 address = (op & 0x07fc0000) >> 17; address |= ((op & 0x0000ffc0) >> 6) << 10; - if (address & 0x800000) address = -0x800000 + (address&0x7fffff); + if (address & 0x800000) address = -0x800000 + (address&0x7fffff); int n = (op & 0x00000020) >> 5; op &= ~0x00000020; COMMON32_GET_CONDITION @@ -180,7 +161,7 @@ int arcompact_handle01_00_01dasm(DASM_OPS_32) INT32 address = (op & 0x07fc0000) >> 17; address |= ((op & 0x0000ffc0) >> 6) << 10; address |= ((op & 0x0000000f) >> 0) << 20; - if (address & 0x800000) address = -0x800000 + (address&0x7fffff); + if (address & 0x800000) address = -0x800000 + (address&0x7fffff); int n = (op & 0x00000020) >> 5; op &= ~0x00000020; int res = (op & 0x00000010) >> 4; op &= ~0x00000010; @@ -265,7 +246,7 @@ int arcompact_01_01_01_helper(DASM_OPS_32, const char* optext) op &= ~0x07007fe0; print("%s%s %s, 0x%02x %08x (%08x)", optext, delaybit[n], regnames[breg], u, PC_ALIGNED32 + (address * 2), op & ~0xf8fe800f); - + return size; } @@ -327,7 +308,7 @@ int arcompact_handle03_dasm(DASM_OPS_32) { int size = 4; UINT32 limm = 0; - int got_limm = 0; + int got_limm = 0; // bitpos // 1111 1111 1111 1111 0000 0000 0000 0000 // fedc ba98 7654 3210 fedc ba98 7654 3210 @@ -401,7 +382,7 @@ int arcompact_handle04_p00_helper_dasm(DASM_OPS_32, const char* optext, int igno output += sprintf(output, "%s", optext); output += sprintf(output, "%s", flagbit[F]); - // output += sprintf( output, " p(%d)", p); + // output += sprintf( output, " p(%d)", p); if ((!b_reserved) && (breg == LIMM_REG)) @@ -429,7 +410,7 @@ int arcompact_handle04_p00_helper_dasm(DASM_OPS_32, const char* optext, int igno } else if (ignore_dst == 1) // certain opcode types ignore the 'a' field entirely, it should be set to 0. { - if (areg) output += sprintf(output, " <reserved %d> <-", areg); + if (areg) output += sprintf(output, " <reserved %d> <-", areg); } else if (ignore_dst == 2) // for multiply operations areg should always be set to LIMM { @@ -464,7 +445,7 @@ int arcompact_handle04_p01_helper_dasm(DASM_OPS_32, const char* optext, int igno // 0010 0bbb 01ii iiii FBBB uuuu uuAA AAAA int size = 4; UINT32 limm = 0; -// int got_limm = 0; +// int got_limm = 0; COMMON32_GET_breg; COMMON32_GET_F; @@ -473,14 +454,14 @@ int arcompact_handle04_p01_helper_dasm(DASM_OPS_32, const char* optext, int igno output += sprintf(output, "%s", optext); output += sprintf(output, "%s", flagbit[F]); - // output += sprintf( output, " p(%d)", p); + // output += sprintf( output, " p(%d)", p); if ((!b_reserved) && (breg == LIMM_REG)) { GET_LIMM_32; size = 8; -// got_limm = 1; +// got_limm = 1; } // areg can be LIMM too, but in that case LIMM indicates 'no destination' rather than an actual LIMM value following @@ -492,7 +473,7 @@ int arcompact_handle04_p01_helper_dasm(DASM_OPS_32, const char* optext, int igno } else if (ignore_dst == 1) // certain opcode types ignore the 'a' field entirely, it should be set to 0. { - if (areg) output += sprintf(output, " <reserved %d> <-", areg); + if (areg) output += sprintf(output, " <reserved %d> <-", areg); } else if (ignore_dst == 2) // for multiply operations areg should always be set to LIMM { @@ -530,7 +511,7 @@ int arcompact_handle04_p10_helper_dasm(DASM_OPS_32, const char* optext, int b_re output += sprintf(output, "%s", optext); output += sprintf(output, "%s", flagbit[F]); - // output += sprintf( output, " p(%d)", p); + // output += sprintf( output, " p(%d)", p); if (!b_reserved) @@ -570,7 +551,7 @@ int arcompact_handle04_p11_m0_helper_dasm(DASM_OPS_32, const char* optext, int b output += sprintf(output, "%s", optext); output += sprintf(output, "%s", flagbit[F]); - // output += sprintf( output, " p(%d)", p); + // output += sprintf( output, " p(%d)", p); if (!b_reserved) { @@ -594,7 +575,7 @@ int arcompact_handle04_p11_m0_helper_dasm(DASM_OPS_32, const char* optext, int b output += sprintf(output, " Cond<%s> ", conditions[condition]); - + if (creg == LIMM_REG) { @@ -626,7 +607,7 @@ int arcompact_handle04_p11_m1_helper_dasm(DASM_OPS_32, const char* optext, int b output += sprintf(output, "%s", optext); output += sprintf(output, "%s", flagbit[F]); - // output += sprintf( output, " p(%d)", p); + // output += sprintf( output, " p(%d)", p); if (!b_reserved) { @@ -685,52 +666,52 @@ int arcompact_handle04_helper_dasm(DASM_OPS_32, const char* optext, int ignore_d return 0; } -int arcompact_handle04_00_dasm(DASM_OPS_32) +int arcompact_handle04_00_dasm(DASM_OPS_32) { return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD", 0,0); } -int arcompact_handle04_01_dasm(DASM_OPS_32) -{ +int arcompact_handle04_01_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADC", 0,0); } -int arcompact_handle04_02_dasm(DASM_OPS_32) -{ +int arcompact_handle04_02_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB", 0,0); } -int arcompact_handle04_03_dasm(DASM_OPS_32) +int arcompact_handle04_03_dasm(DASM_OPS_32) { return arcompact_handle04_helper_dasm(DASM_PARAMS, "SBC", 0,0); } -int arcompact_handle04_04_dasm(DASM_OPS_32) +int arcompact_handle04_04_dasm(DASM_OPS_32) { return arcompact_handle04_helper_dasm(DASM_PARAMS, "AND", 0,0); } -int arcompact_handle04_05_dasm(DASM_OPS_32) +int arcompact_handle04_05_dasm(DASM_OPS_32) { return arcompact_handle04_helper_dasm(DASM_PARAMS, "OR", 0,0); } -int arcompact_handle04_06_dasm(DASM_OPS_32) +int arcompact_handle04_06_dasm(DASM_OPS_32) { return arcompact_handle04_helper_dasm(DASM_PARAMS, "BIC", 0,0); } -int arcompact_handle04_07_dasm(DASM_OPS_32) +int arcompact_handle04_07_dasm(DASM_OPS_32) { return arcompact_handle04_helper_dasm(DASM_PARAMS, "XOR", 0,0); } -int arcompact_handle04_08_dasm(DASM_OPS_32) +int arcompact_handle04_08_dasm(DASM_OPS_32) { return arcompact_handle04_helper_dasm(DASM_PARAMS, "MAX", 0,0); } -int arcompact_handle04_09_dasm(DASM_OPS_32) +int arcompact_handle04_09_dasm(DASM_OPS_32) { return arcompact_handle04_helper_dasm(DASM_PARAMS, "MIN", 0,0); } @@ -752,87 +733,87 @@ int arcompact_handle04_0c_dasm(DASM_OPS_32) } int arcompact_handle04_0d_dasm(DASM_OPS_32) -{ +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "RCMP", 1,0); } int arcompact_handle04_0e_dasm(DASM_OPS_32) -{ +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "RSUB", 0,0); } -int arcompact_handle04_0f_dasm(DASM_OPS_32) -{ +int arcompact_handle04_0f_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "BSET", 0,0); } -int arcompact_handle04_10_dasm(DASM_OPS_32) -{ +int arcompact_handle04_10_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "BCLR", 0,0); } -int arcompact_handle04_11_dasm(DASM_OPS_32) -{ +int arcompact_handle04_11_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "BTST", 0,0); } -int arcompact_handle04_12_dasm(DASM_OPS_32) -{ +int arcompact_handle04_12_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "BXOR", 0,0); } -int arcompact_handle04_13_dasm(DASM_OPS_32) -{ +int arcompact_handle04_13_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "BMSK", 0,0); } -int arcompact_handle04_14_dasm(DASM_OPS_32) -{ +int arcompact_handle04_14_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD1", 0,0); } -int arcompact_handle04_15_dasm(DASM_OPS_32) -{ +int arcompact_handle04_15_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD2", 0,0); } -int arcompact_handle04_16_dasm(DASM_OPS_32) -{ +int arcompact_handle04_16_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "ADD3", 0,0); } -int arcompact_handle04_17_dasm(DASM_OPS_32) -{ +int arcompact_handle04_17_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB1", 0,0); } -int arcompact_handle04_18_dasm(DASM_OPS_32) -{ +int arcompact_handle04_18_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB2", 0,0); } -int arcompact_handle04_19_dasm(DASM_OPS_32) -{ +int arcompact_handle04_19_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "SUB3", 0,0); } -int arcompact_handle04_1a_dasm(DASM_OPS_32) -{ +int arcompact_handle04_1a_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPY", 0,0); } // * -int arcompact_handle04_1b_dasm(DASM_OPS_32) -{ +int arcompact_handle04_1b_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPYH", 0,0); } // * -int arcompact_handle04_1c_dasm(DASM_OPS_32) -{ +int arcompact_handle04_1c_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPYHU", 0,0); } // * -int arcompact_handle04_1d_dasm(DASM_OPS_32) -{ +int arcompact_handle04_1d_dasm(DASM_OPS_32) +{ return arcompact_handle04_helper_dasm(DASM_PARAMS, "MPYU", 0,0); } // * @@ -890,7 +871,7 @@ int arcompact_handle04_28_dasm(DASM_OPS_32) // LPcc (loop setup) output += sprintf(output, "LP<%s> (start %08x, end %08x)", conditions[condition], pc + 4, PC_ALIGNED32 + u*2); int unused = (op & 0x00000020)>>5; - if (unused==0) output += sprintf(output, "(unused bit not set)"); + if (unused==0) output += sprintf(output, "(unused bit not set)"); } @@ -908,11 +889,9 @@ int arcompact_handle04_28_dasm(DASM_OPS_32) // LPcc (loop setup) output += sprintf( output, "[%03x]", auxreg); \ } \ else \ - output += sprintf( output, "[%03x]", auxreg); \ - + output += sprintf( output, "[%03x]", auxreg); int arcompact_handle04_2a_dasm(DASM_OPS_32) // Load FROM Auxiliary register TO register { - // pp F // 0010 0bbb 0010 1010 0BBB CCCC CCRR RRRR // 0010 0bbb 0010 1010 0BBB 1111 10RR RRRR @@ -930,9 +909,9 @@ int arcompact_handle04_2a_dasm(DASM_OPS_32) // Load FROM Auxiliary register TO output += sprintf( output, "LR"); if (F) output += sprintf( output, ".<F set, illegal>"); -// output += sprintf( output, " p(%d)", p); - - +// output += sprintf( output, " p(%d)", p); + + if (breg == LIMM_REG) { @@ -947,7 +926,6 @@ int arcompact_handle04_2a_dasm(DASM_OPS_32) // Load FROM Auxiliary register TO if (p == 0) { - COMMON32_GET_creg COMMON32_GET_areg_reserved @@ -960,7 +938,7 @@ int arcompact_handle04_2a_dasm(DASM_OPS_32) // Load FROM Auxiliary register TO } output += sprintf( output, "(%08x) ", limm ); - + } else { @@ -976,7 +954,7 @@ int arcompact_handle04_2a_dasm(DASM_OPS_32) // Load FROM Auxiliary register TO int auxreg = u; PRINT_AUX_REGNAME - + if (ares) output += sprintf( output, "reserved(%02x) ", ares ); } else if (p == 2) @@ -996,7 +974,7 @@ int arcompact_handle04_2a_dasm(DASM_OPS_32) // Load FROM Auxiliary register TO } int arcompact_handle04_2b_dasm(DASM_OPS_32) // Store TO Auxiliary register FROM register -{ +{ // code at ~ 40073DFE in leapster bios is manually setting up a loop this way // rather than using the lPcc opcode @@ -1010,9 +988,9 @@ int arcompact_handle04_2b_dasm(DASM_OPS_32) // Store TO Auxiliary register FROM output += sprintf( output, "SR"); if (F) output += sprintf( output, ".<F set, illegal>"); -// output += sprintf( output, " p(%d)", p); - - +// output += sprintf( output, " p(%d)", p); + + if (breg == LIMM_REG) { @@ -1031,7 +1009,6 @@ int arcompact_handle04_2b_dasm(DASM_OPS_32) // Store TO Auxiliary register FROM if (p == 0) { - COMMON32_GET_creg COMMON32_GET_areg_reserved @@ -1095,7 +1072,7 @@ int arcompact_handle04_29_dasm(DASM_OPS_32) int arcompact_handle04_2f_helper_dasm(DASM_OPS_32, const char* optext) { - // + // // 0010 0bbb pp10 1111 FBBB CCCC CCII IIII int size = 4; @@ -1105,8 +1082,8 @@ int arcompact_handle04_2f_helper_dasm(DASM_OPS_32, const char* optext) output += sprintf( output, "%s", optext); output += sprintf( output, "%s", flagbit[F]); -// output += sprintf( output, " p(%d)", p); - +// output += sprintf( output, " p(%d)", p); + if (breg == LIMM_REG) { output += sprintf(output, " <no dst>, "); @@ -1125,7 +1102,7 @@ int arcompact_handle04_2f_helper_dasm(DASM_OPS_32, const char* optext) { UINT32 limm; GET_LIMM_32; - size = 8; + size = 8; output += sprintf( output, "(%08x) ", limm ); } @@ -1232,11 +1209,11 @@ int arcompact_handle04_3x_helper_dasm(DASM_OPS_32, int dsize, int extend) else { output += sprintf( output, "%s]", regnames[creg]); - } + } return size; - + } @@ -1279,7 +1256,7 @@ int arcompact_handle05_29_dasm(DASM_OPS_32) { return arcompact_handle04_helper_ int arcompact_handle05_2f_0x_helper_dasm(DASM_OPS_32, const char* optext) { - // + // // 0010 1bbb pp10 1111 FBBB CCCC CCII IIII when pp == 0x00 // or // 0010 1bbb pp10 1111 FBBB UUUU UUII IIII when pp == 0x01 @@ -1293,9 +1270,9 @@ int arcompact_handle05_2f_0x_helper_dasm(DASM_OPS_32, const char* optext) output += sprintf( output, "%s", optext); output += sprintf( output, "%s", flagbit[F]); -// output += sprintf( output, " p(%d)", p); - - +// output += sprintf( output, " p(%d)", p); + + output += sprintf(output, " %s, ", regnames[breg]); if (p == 0) @@ -1306,7 +1283,7 @@ int arcompact_handle05_2f_0x_helper_dasm(DASM_OPS_32, const char* optext) { UINT32 limm; GET_LIMM_32; - size = 8; + size = 8; output += sprintf( output, "(%08x) ", limm ); } @@ -1469,7 +1446,7 @@ int arcompact_handle0e_0x_helper_dasm(DASM_OPS_16, const char* optext, int revop GROUP_0e_GET_h; COMMON16_GET_breg; REG_16BIT_RANGE(breg); - + if (h == LIMM_REG) { UINT32 limm; @@ -1517,7 +1494,7 @@ int arcompact_handle0f_00_0x_helper_dasm(DASM_OPS_16, const char* optext) COMMON16_GET_breg; REG_16BIT_RANGE(breg); - + print("%s %s", optext, regnames[breg]); return 2; @@ -1724,7 +1701,7 @@ int arcompact_handle17_07_dasm(DASM_OPS_16) } -// op bits remaining for 0x18_xx subgroups 0x071f +// op bits remaining for 0x18_xx subgroups 0x071f int arcompact_handle18_0x_helper_dasm(DASM_OPS_16, const char* optext, int st, int format) { @@ -1746,27 +1723,27 @@ int arcompact_handle18_0x_helper_dasm(DASM_OPS_16, const char* optext, int st, i return 2; } -int arcompact_handle18_00_dasm(DASM_OPS_16) +int arcompact_handle18_00_dasm(DASM_OPS_16) { return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "LD_S", 0,0); } -int arcompact_handle18_01_dasm(DASM_OPS_16) +int arcompact_handle18_01_dasm(DASM_OPS_16) { return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "LDB_S", 0,0); } -int arcompact_handle18_02_dasm(DASM_OPS_16) +int arcompact_handle18_02_dasm(DASM_OPS_16) { return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "ST_S", 1,0); } -int arcompact_handle18_03_dasm(DASM_OPS_16) +int arcompact_handle18_03_dasm(DASM_OPS_16) { return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "STB_S", 1,0); } -int arcompact_handle18_04_dasm(DASM_OPS_16) +int arcompact_handle18_04_dasm(DASM_OPS_16) { return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "ADD_S", 1,1); // check format } @@ -1791,8 +1768,8 @@ int arcompact_handle18_05_01_dasm(DASM_OPS_16) return 2; } -// op bits remaining for 0x18_06_xx subgroups 0x0700 -int arcompact_handle18_06_01_dasm(DASM_OPS_16) +// op bits remaining for 0x18_06_xx subgroups 0x0700 +int arcompact_handle18_06_01_dasm(DASM_OPS_16) { int breg; COMMON16_GET_breg @@ -1803,7 +1780,7 @@ int arcompact_handle18_06_01_dasm(DASM_OPS_16) return 2; } -int arcompact_handle18_06_11_dasm(DASM_OPS_16) +int arcompact_handle18_06_11_dasm(DASM_OPS_16) { int res = (op & 0x0700) >> 8; op &= ~0x0700; // all bits now used @@ -1816,8 +1793,8 @@ int arcompact_handle18_06_11_dasm(DASM_OPS_16) return 2; } -// op bits remaining for 0x18_07_xx subgroups 0x0700 -int arcompact_handle18_07_01_dasm(DASM_OPS_16) +// op bits remaining for 0x18_07_xx subgroups 0x0700 +int arcompact_handle18_07_01_dasm(DASM_OPS_16) { int breg; COMMON16_GET_breg @@ -1829,7 +1806,7 @@ int arcompact_handle18_07_01_dasm(DASM_OPS_16) } -int arcompact_handle18_07_11_dasm(DASM_OPS_16) +int arcompact_handle18_07_11_dasm(DASM_OPS_16) { int res = (op & 0x0700) >> 8; op &= ~0x0700; // all bits now used @@ -1921,7 +1898,7 @@ int arcompact_handle1d_helper_dasm(DASM_OPS_16, const char* optext) COMMON16_GET_breg; REG_16BIT_RANGE(breg); - int s = (op & 0x007f) >> 0; op &= ~0x007f; + int s = (op & 0x007f) >> 0; op &= ~0x007f; if (s & 0x40) s = -0x40 + (s & 0x3f); print("%s %s, 0 to 0x%08x", optext, regnames[breg], PC_ALIGNED32 + s*2); @@ -1935,7 +1912,7 @@ int arcompact_handle1d_01_dasm(DASM_OPS_16) { return arcompact_handle1d_helper_ int arcompact_handle1e_0x_helper_dasm(DASM_OPS_16, const char* optext) { - int s = (op & 0x01ff) >> 0; op &= ~0x01ff; + int s = (op & 0x01ff) >> 0; op &= ~0x01ff; if (s & 0x100) s = -0x100 + (s & 0xff); print("%s %08x", optext, PC_ALIGNED32 + s*2); @@ -1950,7 +1927,7 @@ int arcompact_handle1e_02_dasm(DASM_OPS_16) { return arcompact_handle1e_0x_help int arcompact_handle1e_03_0x_helper_dasm(DASM_OPS_16, const char* optext) { - int s = (op & 0x003f) >> 0; op &= ~0x003f; + int s = (op & 0x003f) >> 0; op &= ~0x003f; if (s & 0x020) s = -0x20 + (s & 0x1f); print("%s %08x", optext, PC_ALIGNED32 + s*2); @@ -1968,7 +1945,7 @@ int arcompact_handle1e_03_07_dasm(DASM_OPS_16) { return arcompact_handle1e_03_0 int arcompact_handle1f_dasm(DASM_OPS_16) { - int s = (op & 0x07ff) >> 0; op &= ~0x07ff; + int s = (op & 0x07ff) >> 0; op &= ~0x07ff; if (s & 0x400) s = -0x400 + (s & 0x3ff); print("BL_S %08x", PC_ALIGNED32 + (s*4)); @@ -2389,4 +2366,3 @@ int arcompact_handle18_07_1c_dasm(DASM_OPS_16) { print("<illegal 0x18_07_1c> (% int arcompact_handle18_07_1d_dasm(DASM_OPS_16) { print("<illegal 0x18_07_1d> (%04x)", op); return 2;} int arcompact_handle18_07_1e_dasm(DASM_OPS_16) { print("<illegal 0x18_07_1e> (%04x)", op); return 2;} int arcompact_handle18_07_1f_dasm(DASM_OPS_16) { print("<illegal 0x18_07_1f> (%04x)", op); return 2;} - diff --git a/src/emu/cpu/arcompact/arcompactdasm_ops.h b/src/emu/cpu/arcompact/arcompactdasm_ops.h index 5bdd6c67a3b..d853899faa6 100644 --- a/src/emu/cpu/arcompact/arcompactdasm_ops.h +++ b/src/emu/cpu/arcompact/arcompactdasm_ops.h @@ -15,8 +15,7 @@ #define GET_LIMM_32 \ limm = oprom[6] | (oprom[7] << 8); \ - limm |= (oprom[4] << 16) | (oprom[5] << 24); \ - + limm |= (oprom[4] << 16) | (oprom[5] << 24); int arcompact_handle00_00_dasm(DASM_OPS_32); int arcompact_handle00_01_dasm(DASM_OPS_32); @@ -367,7 +366,7 @@ int arcompact_handle04_2f_3f_3a_dasm(DASM_OPS_32); int arcompact_handle04_2f_3f_3b_dasm(DASM_OPS_32); int arcompact_handle04_2f_3f_3c_dasm(DASM_OPS_32); int arcompact_handle04_2f_3f_3d_dasm(DASM_OPS_32); -int arcompact_handle04_2f_3f_3e_dasm(DASM_OPS_32); +int arcompact_handle04_2f_3f_3e_dasm(DASM_OPS_32); int arcompact_handle04_2f_3f_3f_dasm(DASM_OPS_32); int arcompact_handle05_2f_00_dasm(DASM_OPS_32); @@ -632,7 +631,7 @@ int arcompact_handle18_07_15_dasm(DASM_OPS_16); int arcompact_handle18_07_16_dasm(DASM_OPS_16); int arcompact_handle18_07_17_dasm(DASM_OPS_16); int arcompact_handle18_07_18_dasm(DASM_OPS_16); -int arcompact_handle18_07_19_dasm(DASM_OPS_16); +int arcompact_handle18_07_19_dasm(DASM_OPS_16); int arcompact_handle18_07_1a_dasm(DASM_OPS_16); int arcompact_handle18_07_1b_dasm(DASM_OPS_16); int arcompact_handle18_07_1c_dasm(DASM_OPS_16); diff --git a/src/emu/cpu/cpu.mak b/src/emu/cpu/cpu.mak index 64cfc56c729..da5c799f5f1 100644 --- a/src/emu/cpu/cpu.mak +++ b/src/emu/cpu/cpu.mak @@ -129,7 +129,7 @@ $(CPUOBJ)/arcompact/arcompact_common.o: $(CPUSRC)/arcompact/arcompact_common.c $(CPUOBJ)/arcompact/arcompact.inc: $(CPUSRC)/arcompact/arcompact_make.py @echo Generating arcompact source .inc files... $(PYTHON) $(CPUSRC)/arcompact/arcompact_make.py $@ - + #------------------------------------------------- # Acorn ARM series # diff --git a/src/emu/cpu/h8/h8_timer16.c b/src/emu/cpu/h8/h8_timer16.c index d8fa8f89679..56f6089b3f4 100644 --- a/src/emu/cpu/h8/h8_timer16.c +++ b/src/emu/cpu/h8/h8_timer16.c @@ -347,7 +347,7 @@ void h8_timer16_device::device_start() sprintf(tm, "%d", i); timer_channel[i] = subdevice<h8_timer16_channel_device>(tm); } - + save_item(NAME(tstr)); } diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index 0746edc0b1a..3bf0b84cc49 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -699,7 +699,7 @@ static void m68k_cause_bus_error(m68000_base_device *m68k) { /* only the 68010 throws this unique type-1000 frame */ m68ki_stack_frame_1000(m68k, REG_PPC(m68k), sr, EXCEPTION_BUS_ERROR); - } + } else if (m68k->mmu_tmp_buserror_address == REG_PPC(m68k)) { m68ki_stack_frame_1010(m68k, sr, EXCEPTION_BUS_ERROR, REG_PPC(m68k), m68k->mmu_tmp_buserror_address); diff --git a/src/emu/cpu/m68000/m68kdasm.c b/src/emu/cpu/m68000/m68kdasm.c index ba3ab3143ba..644e7d47f99 100644 --- a/src/emu/cpu/m68000/m68kdasm.c +++ b/src/emu/cpu/m68000/m68kdasm.c @@ -1728,12 +1728,12 @@ static void d68881_ftrap(void) switch (g_cpu_ir & 0x7) { - case 2: // word operand + case 2: // word operand w3 = read_imm_16(); sprintf(g_dasm_str, "ftrap%s.w $%04x", g_cpcc[w2 & 0x3f], w3); break; - case 3: // long word operand + case 3: // long word operand l2 = read_imm_32(); sprintf(g_dasm_str, "ftrap%s.l $%08x", g_cpcc[w2 & 0x3f], l2); break; diff --git a/src/emu/cpu/pps4/pps4.c b/src/emu/cpu/pps4/pps4.c index de48dd45081..af3b1290c5e 100644 --- a/src/emu/cpu/pps4/pps4.c +++ b/src/emu/cpu/pps4/pps4.c @@ -71,10 +71,10 @@ const device_type PPS4 = &device_creator<pps4_device>; pps4_device::pps4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : cpu_device(mconfig, PPS4, "PPS4", tag, owner, clock, "pps4", __FILE__ ) - , m_program_config("program", ENDIANNESS_LITTLE, 8, 12) - , m_data_config("data", ENDIANNESS_LITTLE, 8, 12) // 4bit RAM - , m_io_config("io", ENDIANNESS_LITTLE, 8, 8) // 4bit IO + : cpu_device(mconfig, PPS4, "PPS4", tag, owner, clock, "pps4", __FILE__ ) + , m_program_config("program", ENDIANNESS_LITTLE, 8, 12) + , m_data_config("data", ENDIANNESS_LITTLE, 8, 12) // 4bit RAM + , m_io_config("io", ENDIANNESS_LITTLE, 8, 8) // 4bit IO { } @@ -84,9 +84,9 @@ pps4_device::pps4_device(const machine_config &mconfig, const char *tag, device_ */ UINT8 pps4_device::M() { - UINT8 ret = m_data->read_byte(m_B & ~m_SAG); - m_SAG = 0; - return ret; + UINT8 ret = m_data->read_byte(m_B & ~m_SAG); + m_SAG = 0; + return ret; } @@ -96,14 +96,14 @@ UINT8 pps4_device::M() */ void pps4_device::W(UINT8 data) { - m_data->write_byte(m_B & ~m_SAG, data); - m_SAG = 0; + m_data->write_byte(m_B & ~m_SAG, data); + m_SAG = 0; } offs_t pps4_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) { - extern CPU_DISASSEMBLE( pps4 ); - return CPU_DISASSEMBLE_NAME(pps4)(this, buffer, pc, oprom, opram, options); + extern CPU_DISASSEMBLE( pps4 ); + return CPU_DISASSEMBLE_NAME(pps4)(this, buffer, pc, oprom, opram, options); } /** @@ -115,11 +115,11 @@ offs_t pps4_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *opr */ inline UINT8 pps4_device::ROP() { - const UINT8 op = m_direct->read_decrypted_byte(m_P & 0xFFF); - m_Ip = m_I1; // save previous opcode - m_P = (m_P + 1) & 0xFFF; - m_icount -= 1; - return op; + const UINT8 op = m_direct->read_decrypted_byte(m_P & 0xFFF); + m_Ip = m_I1; // save previous opcode + m_P = (m_P + 1) & 0xFFF; + m_icount -= 1; + return op; } /** @@ -131,10 +131,10 @@ inline UINT8 pps4_device::ROP() */ inline UINT8 pps4_device::ARG() { - const UINT8 arg = m_direct->read_raw_byte(m_P & 0xFFF); - m_P = (m_P + 1) & 0xFFF; - m_icount -= 1; - return arg; + const UINT8 arg = m_direct->read_raw_byte(m_P & 0xFFF); + m_P = (m_P + 1) & 0xFFF; + m_icount -= 1; + return arg; } /** @@ -173,9 +173,9 @@ inline UINT8 pps4_device::ARG() */ void pps4_device::iAD() { - m_A = m_A + M(); - m_C = (m_A >> 4) & 1; - m_A = m_A & 15; + m_A = m_A + M(); + m_C = (m_A >> 4) & 1; + m_A = m_A & 15; } /** @@ -193,9 +193,9 @@ void pps4_device::iAD() */ void pps4_device::iADC() { - m_A = m_A + M() + m_C; - m_C = m_A >> 4; - m_A = m_A & 15; + m_A = m_A + M() + m_C; + m_C = m_A >> 4; + m_A = m_A & 15; } /** @@ -214,10 +214,10 @@ void pps4_device::iADC() */ void pps4_device::iADSK() { - m_A = m_A + M(); - m_C = m_A >> 4; - m_Skip = m_C; - m_A = m_A & 15; + m_A = m_A + M(); + m_C = m_A >> 4; + m_Skip = m_C; + m_A = m_A & 15; } /** @@ -236,10 +236,10 @@ void pps4_device::iADSK() */ void pps4_device::iADCSK() { - m_A = m_A + M() + m_C; - m_C = m_A >> 4; - m_Skip = m_C; - m_A = m_A & 15; + m_A = m_A + M() + m_C; + m_C = m_A >> 4; + m_Skip = m_C; + m_A = m_A & 15; } /** @@ -265,10 +265,10 @@ void pps4_device::iADCSK() */ void pps4_device::iADI() { - const UINT8 imm = ~m_I1 & 15; - m_A = m_A + imm; - m_Skip = (m_A >> 4) & 1; - m_A = m_A & 15; + const UINT8 imm = ~m_I1 & 15; + m_A = m_A + imm; + m_Skip = (m_A >> 4) & 1; + m_A = m_A & 15; } /** @@ -288,7 +288,7 @@ void pps4_device::iADI() */ void pps4_device::iDC() { - m_A = m_A + 10; + m_A = m_A + 10; } /** @@ -307,7 +307,7 @@ void pps4_device::iDC() */ void pps4_device::iAND() { - m_A = m_A & M(); + m_A = m_A & M(); } /** @@ -326,7 +326,7 @@ void pps4_device::iAND() */ void pps4_device::iOR() { - m_A = m_A | M(); + m_A = m_A | M(); } /** @@ -346,7 +346,7 @@ void pps4_device::iOR() */ void pps4_device::iEOR() { - m_A = m_A ^ M(); + m_A = m_A ^ M(); } /** @@ -364,7 +364,7 @@ void pps4_device::iEOR() */ void pps4_device::iCOMP() { - m_A = m_A ^ 15; + m_A = m_A ^ 15; } /** @@ -381,7 +381,7 @@ void pps4_device::iCOMP() */ void pps4_device::iSC() { - m_C = 1; + m_C = 1; } /** @@ -398,7 +398,7 @@ void pps4_device::iSC() */ void pps4_device::iRC() { - m_C = 0; + m_C = 0; } /** @@ -415,7 +415,7 @@ void pps4_device::iRC() */ void pps4_device::iSF1() { - m_FF1 = 1; + m_FF1 = 1; } /** @@ -432,7 +432,7 @@ void pps4_device::iSF1() */ void pps4_device::iRF1() { - m_FF1 = 0; + m_FF1 = 0; } /** @@ -449,7 +449,7 @@ void pps4_device::iRF1() */ void pps4_device::iSF2() { - m_FF2 = 1; + m_FF2 = 1; } /** @@ -466,7 +466,7 @@ void pps4_device::iSF2() */ void pps4_device::iRF2() { - m_FF2 = 0; + m_FF2 = 0; } /** @@ -490,9 +490,9 @@ void pps4_device::iRF2() */ void pps4_device::iLD() { - const UINT16 i3c = ~m_I1 & 7; - m_A = M(); - m_B = m_B ^ (i3c << 4); + const UINT16 i3c = ~m_I1 & 7; + m_A = M(); + m_B = m_B ^ (i3c << 4); } /** @@ -513,11 +513,11 @@ void pps4_device::iLD() */ void pps4_device::iEX() { - const UINT16 i3c = ~m_I1 & 7; - const UINT8 mem = M(); - W(m_A); - m_A = mem; - m_B = m_B ^ (i3c << 4); + const UINT16 i3c = ~m_I1 & 7; + const UINT8 mem = M(); + W(m_A); + m_A = mem; + m_B = m_B ^ (i3c << 4); } /** @@ -542,20 +542,20 @@ void pps4_device::iEX() */ void pps4_device::iEXD() { - const UINT8 i3c = ~m_I1 & 7; - const UINT8 mem = M(); - UINT8 bl = m_B & 15; - W(m_A); - m_A = mem; - m_B = m_B ^ (i3c << 4); - // if decrement BL wraps to 1111b - if (0 == bl) { - bl = 15; - m_Skip = 1; - } else { - bl = bl - 1; - } - m_B = (m_B & ~15) | bl; + const UINT8 i3c = ~m_I1 & 7; + const UINT8 mem = M(); + UINT8 bl = m_B & 15; + W(m_A); + m_A = mem; + m_B = m_B ^ (i3c << 4); + // if decrement BL wraps to 1111b + if (0 == bl) { + bl = 15; + m_Skip = 1; + } else { + bl = bl - 1; + } + m_B = (m_B & ~15) | bl; } /** @@ -579,12 +579,12 @@ void pps4_device::iEXD() */ void pps4_device::iLDI() { - // previous LDI instruction? - if (0x70 == (m_Ip & 0xf0)) { - LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1)); - return; - } - m_A = ~m_I1 & 15; + // previous LDI instruction? + if (0x70 == (m_Ip & 0xf0)) { + LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1)); + return; + } + m_A = ~m_I1 & 15; } /** @@ -602,7 +602,7 @@ void pps4_device::iLDI() */ void pps4_device::iLAX() { - m_A = m_X; + m_A = m_X; } /** @@ -620,7 +620,7 @@ void pps4_device::iLAX() */ void pps4_device::iLXA() { - m_X = m_A; + m_X = m_A; } /** @@ -638,7 +638,7 @@ void pps4_device::iLXA() */ void pps4_device::iLABL() { - m_A = m_B & 15; + m_A = m_B & 15; } /** @@ -656,7 +656,7 @@ void pps4_device::iLABL() */ void pps4_device::iLBMX() { - m_B = (m_B & ~(15 << 4)) | (m_X << 4); + m_B = (m_B & ~(15 << 4)) | (m_X << 4); } /** @@ -676,8 +676,8 @@ void pps4_device::iLBMX() */ void pps4_device::iLBUA() { - m_B = (m_B & ~(15 << 8)) | (m_A << 8); - m_A = M(); + m_B = (m_B & ~(15 << 8)) | (m_A << 8); + m_A = M(); } /** @@ -695,10 +695,10 @@ void pps4_device::iLBUA() */ void pps4_device::iXABL() { - // swap A and BL - UINT8 bl = m_B & 15; - m_B = (m_B & ~15) | m_A; - m_A = bl; + // swap A and BL + UINT8 bl = m_B & 15; + m_B = (m_B & ~15) | m_A; + m_A = bl; } /** @@ -716,10 +716,10 @@ void pps4_device::iXABL() */ void pps4_device::iXBMX() { - // swap X and BM - const UINT8 bm = (m_B >> 4) & 15; - m_B = (m_B & ~(15 << 4)) | (m_X << 4); - m_X = bm; + // swap X and BM + const UINT8 bm = (m_B >> 4) & 15; + m_B = (m_B & ~(15 << 4)) | (m_X << 4); + m_X = bm; } /** @@ -737,10 +737,10 @@ void pps4_device::iXBMX() */ void pps4_device::iXAX() { - // swap A and X - m_A ^= m_X; - m_X ^= m_A; - m_A ^= m_X; + // swap A and X + m_A ^= m_X; + m_X ^= m_A; + m_A ^= m_X; } /** @@ -758,10 +758,10 @@ void pps4_device::iXAX() */ void pps4_device::iXS() { - // swap SA and SB - m_SA ^= m_SB; - m_SB ^= m_SA; - m_SA ^= m_SB; + // swap SA and SB + m_SA ^= m_SB; + m_SB ^= m_SA; + m_SA ^= m_SB; } /** @@ -786,9 +786,9 @@ void pps4_device::iXS() */ void pps4_device::iCYS() { - const UINT16 sa = (m_SA >> 4) | (m_A << 8); - m_A = m_SA & 15; - m_SA = sa; + const UINT16 sa = (m_SA >> 4) | (m_A << 8); + m_A = m_SA & 15; + m_SA = sa; } /** @@ -826,20 +826,20 @@ void pps4_device::iCYS() */ void pps4_device::iLB() { - // previous LB or LBL instruction? - if (0xc0 == (m_Ip & 0xf0) || 0x00 == m_Ip) { - LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1)); - return; - } - m_SB = m_SA; - m_SA = (m_P + 1) & 0xFFF; - m_P = (3 << 6) | (m_I1 & 15); - m_B = ~ARG() & 255; - m_P = m_SA; - // swap SA and SB - m_SA ^= m_SB; - m_SB ^= m_SA; - m_SA ^= m_SB; + // previous LB or LBL instruction? + if (0xc0 == (m_Ip & 0xf0) || 0x00 == m_Ip) { + LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1)); + return; + } + m_SB = m_SA; + m_SA = (m_P + 1) & 0xFFF; + m_P = (3 << 6) | (m_I1 & 15); + m_B = ~ARG() & 255; + m_P = m_SA; + // swap SA and SB + m_SA ^= m_SB; + m_SB ^= m_SA; + m_SA ^= m_SB; } /** @@ -867,13 +867,13 @@ void pps4_device::iLB() */ void pps4_device::iLBL() { - m_I2 = ARG(); - // previous LB or LBL instruction? - if (0xc0 == (m_Ip & 0xf0) || 0x00 == m_Ip) { - LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1)); - return; - } - m_B = ~m_I2 & 255; // Note: immediate is 1's complement + m_I2 = ARG(); + // previous LB or LBL instruction? + if (0xc0 == (m_Ip & 0xf0) || 0x00 == m_Ip) { + LOG(("%s: skip prev:%02x op:%02x\n", __FUNCTION__, m_Ip, m_I1)); + return; + } + m_B = ~m_I2 & 255; // Note: immediate is 1's complement } /** @@ -893,13 +893,13 @@ void pps4_device::iLBL() */ void pps4_device::iINCB() { - UINT8 bl = m_B & 15; - bl = (bl + 1) & 15; - if (0 == bl) { - LOG(("%s: skip BL=%x\n", __FUNCTION__, bl)); - m_Skip = 1; - } - m_B = (m_B & ~15) | bl; + UINT8 bl = m_B & 15; + bl = (bl + 1) & 15; + if (0 == bl) { + LOG(("%s: skip BL=%x\n", __FUNCTION__, bl)); + m_Skip = 1; + } + m_B = (m_B & ~15) | bl; } /** @@ -919,13 +919,13 @@ void pps4_device::iINCB() */ void pps4_device::iDECB() { - UINT8 bl = m_B & 15; - bl = (bl - 1) & 15; - if (15 == bl) { - LOG(("%s: skip BL=%x\n", __FUNCTION__, bl)); - m_Skip = 1; - } - m_B = (m_B & ~15) | bl; + UINT8 bl = m_B & 15; + bl = (bl - 1) & 15; + if (15 == bl) { + LOG(("%s: skip BL=%x\n", __FUNCTION__, bl)); + m_Skip = 1; + } + m_B = (m_B & ~15) | bl; } /** @@ -945,9 +945,9 @@ void pps4_device::iDECB() */ void pps4_device::iT() { - const UINT16 p = (m_P & ~63) | (m_I1 & 63); - LOG(("%s: P=%03x I=%02x -> P=%03x\n", __FUNCTION__, m_P, m_I1, p)); - m_P = p; + const UINT16 p = (m_P & ~63) | (m_I1 & 63); + LOG(("%s: P=%03x I=%02x -> P=%03x\n", __FUNCTION__, m_P, m_I1, p)); + m_P = p; } /** @@ -977,11 +977,11 @@ void pps4_device::iT() */ void pps4_device::iTM() { - m_SB = m_SA; - m_SA = m_P; - m_P = (3 << 6) | (m_I1 & 63); - m_I2 = ARG(); - m_P = (1 << 8) | m_I2; + m_SB = m_SA; + m_SA = m_P; + m_P = (3 << 6) | (m_I1 & 63); + m_I2 = ARG(); + m_P = (1 << 8) | m_I2; } /** @@ -1003,8 +1003,8 @@ void pps4_device::iTM() */ void pps4_device::iTL() { - m_I2 = ARG(); - m_P = ((m_I1 & 15) << 8) | m_I2; + m_I2 = ARG(); + m_P = ((m_I1 & 15) << 8) | m_I2; } /** @@ -1028,10 +1028,10 @@ void pps4_device::iTL() */ void pps4_device::iTML() { - m_I2 = ARG(); - m_SB = m_SA; - m_SA = m_P; - m_P = ((m_I1 & 15) << 8) | m_I2; + m_I2 = ARG(); + m_SB = m_SA; + m_SA = m_P; + m_P = ((m_I1 & 15) << 8) | m_I2; } /** @@ -1048,7 +1048,7 @@ void pps4_device::iTML() */ void pps4_device::iSKC() { - m_Skip = m_C; + m_Skip = m_C; } /** @@ -1065,7 +1065,7 @@ void pps4_device::iSKC() */ void pps4_device::iSKZ() { - m_Skip = (0 == m_A) ? 1 : 0; + m_Skip = (0 == m_A) ? 1 : 0; } /** @@ -1084,9 +1084,9 @@ void pps4_device::iSKZ() */ void pps4_device::iSKBI() { - const UINT8 i4 = m_I1 & 15; - const UINT8 bl = m_B & 15; - m_Skip = bl == i4 ? 1 : 0; + const UINT8 i4 = m_I1 & 15; + const UINT8 bl = m_B & 15; + m_Skip = bl == i4 ? 1 : 0; } /** @@ -1101,7 +1101,7 @@ void pps4_device::iSKBI() */ void pps4_device::iSKF1() { - m_Skip = m_FF1; + m_Skip = m_FF1; } /** @@ -1116,7 +1116,7 @@ void pps4_device::iSKF1() */ void pps4_device::iSKF2() { - m_Skip = m_FF2; + m_Skip = m_FF2; } /** @@ -1135,11 +1135,11 @@ void pps4_device::iSKF2() */ void pps4_device::iRTN() { - m_P = m_SA & 0xFFF; - // swap SA and SB - m_SA ^= m_SB; - m_SB ^= m_SA; - m_SA ^= m_SB; + m_P = m_SA & 0xFFF; + // swap SA and SB + m_SA ^= m_SB; + m_SB ^= m_SA; + m_SA ^= m_SB; } /** @@ -1158,12 +1158,12 @@ void pps4_device::iRTN() */ void pps4_device::iRTNSK() { - m_P = m_SA & 0xFFF; - // swap SA and SB - m_SA ^= m_SB; - m_SB ^= m_SA; - m_SA ^= m_SB; - m_Skip = 1; // next opcode is ignored + m_P = m_SA & 0xFFF; + // swap SA and SB + m_SA ^= m_SB; + m_SB ^= m_SA; + m_SA ^= m_SB; + m_Skip = 1; // next opcode is ignored } /** @@ -1195,13 +1195,13 @@ void pps4_device::iRTNSK() */ void pps4_device::iIOL() { - UINT8 ac = ((m_B & 15) << 4) | (~m_A & 15); - m_I2 = ARG(); - m_io->write_byte(m_I2, ac); - LOG(("%s: port:%02x <- %x\n", __FUNCTION__, m_I2, ac)); - ac = m_io->read_byte(m_I2) & 15; - LOG(("%s: port:%02x -> %x\n", __FUNCTION__, m_I2, ac)); - m_A = ~ac & 15; + UINT8 ac = ((m_B & 15) << 4) | (~m_A & 15); + m_I2 = ARG(); + m_io->write_byte(m_I2, ac); + LOG(("%s: port:%02x <- %x\n", __FUNCTION__, m_I2, ac)); + ac = m_io->read_byte(m_I2) & 15; + LOG(("%s: port:%02x -> %x\n", __FUNCTION__, m_I2, ac)); + m_A = ~ac & 15; } /** @@ -1219,7 +1219,7 @@ void pps4_device::iIOL() */ void pps4_device::iDIA() { - m_A = m_io->read_byte(PPS4_PORT_A) & 15; + m_A = m_io->read_byte(PPS4_PORT_A) & 15; } /** @@ -1237,7 +1237,7 @@ void pps4_device::iDIA() */ void pps4_device::iDIB() { - m_A = m_io->read_byte(PPS4_PORT_B) & 15; + m_A = m_io->read_byte(PPS4_PORT_B) & 15; } /** @@ -1255,7 +1255,7 @@ void pps4_device::iDIB() */ void pps4_device::iDOA() { - m_io->write_byte(PPS4_PORT_A, m_A); + m_io->write_byte(PPS4_PORT_A, m_A); } /** @@ -1277,8 +1277,8 @@ void pps4_device::iDOA() */ void pps4_device::iSAG() { - // mask bits 12:5 on next memory access - m_SAG = 0xff0; + // mask bits 12:5 on next memory access + m_SAG = 0xff0; } /*************************************************************************** @@ -1286,227 +1286,227 @@ void pps4_device::iSAG() ***************************************************************************/ void pps4_device::execute_one() { - m_I1 = ROP(); - if (m_Skip) { - m_Skip = 0; - LOG(("%s: skip op:%02x\n", __FUNCTION__, m_I1)); - return; - } - switch (m_I1) { - case 0x00: - iLBL(); - break; - case 0x01: - iTML(); - break; - case 0x02: - iTML(); - break; - case 0x03: - iTML(); - break; - case 0x04: - iLBUA(); - break; - case 0x05: - iRTN(); - break; - case 0x06: - iXS(); - break; - case 0x07: - iRTNSK(); - break; - case 0x08: - iADCSK(); - break; - case 0x09: - iADSK(); - break; - case 0x0a: - iADC(); - break; - case 0x0b: - iAD(); - break; - case 0x0c: - iEOR(); - break; - case 0x0d: - iAND(); - break; - case 0x0e: - iCOMP(); - break; - case 0x0f: - iOR(); - break; - - case 0x10: - iLBMX(); - break; - case 0x11: - iLABL(); - break; - case 0x12: - iLAX(); - break; - case 0x13: - iSAG(); - break; - case 0x14: - iSKF2(); - break; - case 0x15: - iSKC(); - break; - case 0x16: - iSKF1(); - break; - case 0x17: - iINCB(); - break; - case 0x18: - iXBMX(); - break; - case 0x19: - iXABL(); - break; - case 0x1a: - iXAX(); - break; - case 0x1b: - iLXA(); - break; - case 0x1c: - iIOL(); - break; - case 0x1d: - iDOA(); - break; - case 0x1e: - iSKZ(); - break; - case 0x1f: - iDECB(); - break; - - case 0x20: - iSC(); - break; - case 0x21: - iSF2(); - break; - case 0x22: - iSF1(); - break; - case 0x23: - iDIB(); - break; - case 0x24: - iRC(); - break; - case 0x25: - iRF2(); - break; - case 0x26: - iRF1(); - break; - case 0x27: - iDIA(); - break; - - case 0x28: case 0x29: case 0x2a: case 0x2b: - case 0x2c: case 0x2d: case 0x2e: case 0x2f: - iEXD(); - break; - - case 0x30: case 0x31: case 0x32: case 0x33: - case 0x34: case 0x35: case 0x36: case 0x37: - iLD(); - break; - - case 0x38: case 0x39: case 0x3a: case 0x3b: - case 0x3c: case 0x3d: case 0x3e: case 0x3f: - iEX(); - break; - - case 0x40: case 0x41: case 0x42: case 0x43: - case 0x44: case 0x45: case 0x46: case 0x47: - case 0x48: case 0x49: case 0x4a: case 0x4b: - case 0x4c: case 0x4d: case 0x4e: case 0x4f: - iSKBI(); - break; - - case 0x50: case 0x51: case 0x52: case 0x53: - case 0x54: case 0x55: case 0x56: case 0x57: - case 0x58: case 0x59: case 0x5a: case 0x5b: - case 0x5c: case 0x5d: case 0x5e: case 0x5f: - iTL(); - break; - - case 0x65: - iDC(); - break; - - case 0x60: case 0x61: case 0x62: case 0x63: - case 0x64: case 0x66: case 0x67: - case 0x68: case 0x69: case 0x6a: case 0x6b: - case 0x6c: case 0x6d: case 0x6e: - iADI(); - break; - - case 0x6f: - iCYS(); - break; - - case 0x70: case 0x71: case 0x72: case 0x73: - case 0x74: case 0x75: case 0x76: case 0x77: - case 0x78: case 0x79: case 0x7a: case 0x7b: - case 0x7c: case 0x7d: case 0x7e: case 0x7f: - iLDI(); - break; - - case 0x80: case 0x81: case 0x82: case 0x83: - case 0x84: case 0x85: case 0x86: case 0x87: - case 0x88: case 0x89: case 0x8a: case 0x8b: - case 0x8c: case 0x8d: case 0x8e: case 0x8f: - case 0x90: case 0x91: case 0x92: case 0x93: - case 0x94: case 0x95: case 0x96: case 0x97: - case 0x98: case 0x99: case 0x9a: case 0x9b: - case 0x9c: case 0x9d: case 0x9e: case 0x9f: - case 0xa0: case 0xa1: case 0xa2: case 0xa3: - case 0xa4: case 0xa5: case 0xa6: case 0xa7: - case 0xa8: case 0xa9: case 0xaa: case 0xab: - case 0xac: case 0xad: case 0xae: case 0xaf: - case 0xb0: case 0xb1: case 0xb2: case 0xb3: - case 0xb4: case 0xb5: case 0xb6: case 0xb7: - case 0xb8: case 0xb9: case 0xba: case 0xbb: - case 0xbc: case 0xbd: case 0xbe: case 0xbf: - iT(); - break; - - - case 0xc0: case 0xc1: case 0xc2: case 0xc3: - case 0xc4: case 0xc5: case 0xc6: case 0xc7: - case 0xc8: case 0xc9: case 0xca: case 0xcb: - case 0xcc: case 0xcd: case 0xce: case 0xcf: - iLB(); - break; - - default: - iTM(); - } + m_I1 = ROP(); + if (m_Skip) { + m_Skip = 0; + LOG(("%s: skip op:%02x\n", __FUNCTION__, m_I1)); + return; + } + switch (m_I1) { + case 0x00: + iLBL(); + break; + case 0x01: + iTML(); + break; + case 0x02: + iTML(); + break; + case 0x03: + iTML(); + break; + case 0x04: + iLBUA(); + break; + case 0x05: + iRTN(); + break; + case 0x06: + iXS(); + break; + case 0x07: + iRTNSK(); + break; + case 0x08: + iADCSK(); + break; + case 0x09: + iADSK(); + break; + case 0x0a: + iADC(); + break; + case 0x0b: + iAD(); + break; + case 0x0c: + iEOR(); + break; + case 0x0d: + iAND(); + break; + case 0x0e: + iCOMP(); + break; + case 0x0f: + iOR(); + break; + + case 0x10: + iLBMX(); + break; + case 0x11: + iLABL(); + break; + case 0x12: + iLAX(); + break; + case 0x13: + iSAG(); + break; + case 0x14: + iSKF2(); + break; + case 0x15: + iSKC(); + break; + case 0x16: + iSKF1(); + break; + case 0x17: + iINCB(); + break; + case 0x18: + iXBMX(); + break; + case 0x19: + iXABL(); + break; + case 0x1a: + iXAX(); + break; + case 0x1b: + iLXA(); + break; + case 0x1c: + iIOL(); + break; + case 0x1d: + iDOA(); + break; + case 0x1e: + iSKZ(); + break; + case 0x1f: + iDECB(); + break; + + case 0x20: + iSC(); + break; + case 0x21: + iSF2(); + break; + case 0x22: + iSF1(); + break; + case 0x23: + iDIB(); + break; + case 0x24: + iRC(); + break; + case 0x25: + iRF2(); + break; + case 0x26: + iRF1(); + break; + case 0x27: + iDIA(); + break; + + case 0x28: case 0x29: case 0x2a: case 0x2b: + case 0x2c: case 0x2d: case 0x2e: case 0x2f: + iEXD(); + break; + + case 0x30: case 0x31: case 0x32: case 0x33: + case 0x34: case 0x35: case 0x36: case 0x37: + iLD(); + break; + + case 0x38: case 0x39: case 0x3a: case 0x3b: + case 0x3c: case 0x3d: case 0x3e: case 0x3f: + iEX(); + break; + + case 0x40: case 0x41: case 0x42: case 0x43: + case 0x44: case 0x45: case 0x46: case 0x47: + case 0x48: case 0x49: case 0x4a: case 0x4b: + case 0x4c: case 0x4d: case 0x4e: case 0x4f: + iSKBI(); + break; + + case 0x50: case 0x51: case 0x52: case 0x53: + case 0x54: case 0x55: case 0x56: case 0x57: + case 0x58: case 0x59: case 0x5a: case 0x5b: + case 0x5c: case 0x5d: case 0x5e: case 0x5f: + iTL(); + break; + + case 0x65: + iDC(); + break; + + case 0x60: case 0x61: case 0x62: case 0x63: + case 0x64: case 0x66: case 0x67: + case 0x68: case 0x69: case 0x6a: case 0x6b: + case 0x6c: case 0x6d: case 0x6e: + iADI(); + break; + + case 0x6f: + iCYS(); + break; + + case 0x70: case 0x71: case 0x72: case 0x73: + case 0x74: case 0x75: case 0x76: case 0x77: + case 0x78: case 0x79: case 0x7a: case 0x7b: + case 0x7c: case 0x7d: case 0x7e: case 0x7f: + iLDI(); + break; + + case 0x80: case 0x81: case 0x82: case 0x83: + case 0x84: case 0x85: case 0x86: case 0x87: + case 0x88: case 0x89: case 0x8a: case 0x8b: + case 0x8c: case 0x8d: case 0x8e: case 0x8f: + case 0x90: case 0x91: case 0x92: case 0x93: + case 0x94: case 0x95: case 0x96: case 0x97: + case 0x98: case 0x99: case 0x9a: case 0x9b: + case 0x9c: case 0x9d: case 0x9e: case 0x9f: + case 0xa0: case 0xa1: case 0xa2: case 0xa3: + case 0xa4: case 0xa5: case 0xa6: case 0xa7: + case 0xa8: case 0xa9: case 0xaa: case 0xab: + case 0xac: case 0xad: case 0xae: case 0xaf: + case 0xb0: case 0xb1: case 0xb2: case 0xb3: + case 0xb4: case 0xb5: case 0xb6: case 0xb7: + case 0xb8: case 0xb9: case 0xba: case 0xbb: + case 0xbc: case 0xbd: case 0xbe: case 0xbf: + iT(); + break; + + + case 0xc0: case 0xc1: case 0xc2: case 0xc3: + case 0xc4: case 0xc5: case 0xc6: case 0xc7: + case 0xc8: case 0xc9: case 0xca: case 0xcb: + case 0xcc: case 0xcd: case 0xce: case 0xcf: + iLB(); + break; + + default: + iTM(); + } } void pps4_device::execute_run() { - do - { - debugger_instruction_hook(this, m_P); - execute_one(); + do + { + debugger_instruction_hook(this, m_P); + execute_one(); - } while (m_icount > 0); + } while (m_icount > 0); } /*************************************************************************** @@ -1515,54 +1515,54 @@ void pps4_device::execute_run() void pps4_device::device_start() { - m_program = &space(AS_PROGRAM); - m_direct = &m_program->direct(); - m_data = &space(AS_DATA); - m_io = &space(AS_IO); - - save_item(NAME(m_A)); - save_item(NAME(m_X)); - save_item(NAME(m_P)); - save_item(NAME(m_SA)); - save_item(NAME(m_SB)); - save_item(NAME(m_Skip)); - save_item(NAME(m_SAG)); - save_item(NAME(m_B)); - save_item(NAME(m_C)); - save_item(NAME(m_FF1)); - save_item(NAME(m_FF2)); - save_item(NAME(m_I1)); - save_item(NAME(m_I2)); - save_item(NAME(m_Ip)); - - state_add( PPS4_PC, "PC", m_P ).mask(0xFFF).formatstr("%03X"); - state_add( PPS4_A, "A", m_A ).formatstr("%01X"); - state_add( PPS4_X, "X", m_X ).formatstr("%01X"); - state_add( PPS4_SA, "SA", m_SA ).formatstr("%03X"); - state_add( PPS4_SB, "SB", m_SB ).formatstr("%03X"); - state_add( PPS4_Skip, "Skip", m_Skip ).formatstr("%01X"); - state_add( PPS4_SAG, "SAG", m_SAG ).formatstr("%03X"); - state_add( PPS4_B, "B", m_B ).formatstr("%03X"); - state_add( PPS4_I1, "I1", m_I1 ).formatstr("%02X").noshow(); - state_add( PPS4_I2, "I2", m_I2 ).formatstr("%02X").noshow(); - state_add( PPS4_Ip, "Ip", m_Ip ).formatstr("%02X").noshow(); - state_add( STATE_GENPC, "GENPC", m_P ).noshow(); - state_add( STATE_GENFLAGS, "GENFLAGS", m_C).formatstr("%3s").noshow(); - - m_icountptr = &m_icount; + m_program = &space(AS_PROGRAM); + m_direct = &m_program->direct(); + m_data = &space(AS_DATA); + m_io = &space(AS_IO); + + save_item(NAME(m_A)); + save_item(NAME(m_X)); + save_item(NAME(m_P)); + save_item(NAME(m_SA)); + save_item(NAME(m_SB)); + save_item(NAME(m_Skip)); + save_item(NAME(m_SAG)); + save_item(NAME(m_B)); + save_item(NAME(m_C)); + save_item(NAME(m_FF1)); + save_item(NAME(m_FF2)); + save_item(NAME(m_I1)); + save_item(NAME(m_I2)); + save_item(NAME(m_Ip)); + + state_add( PPS4_PC, "PC", m_P ).mask(0xFFF).formatstr("%03X"); + state_add( PPS4_A, "A", m_A ).formatstr("%01X"); + state_add( PPS4_X, "X", m_X ).formatstr("%01X"); + state_add( PPS4_SA, "SA", m_SA ).formatstr("%03X"); + state_add( PPS4_SB, "SB", m_SB ).formatstr("%03X"); + state_add( PPS4_Skip, "Skip", m_Skip ).formatstr("%01X"); + state_add( PPS4_SAG, "SAG", m_SAG ).formatstr("%03X"); + state_add( PPS4_B, "B", m_B ).formatstr("%03X"); + state_add( PPS4_I1, "I1", m_I1 ).formatstr("%02X").noshow(); + state_add( PPS4_I2, "I2", m_I2 ).formatstr("%02X").noshow(); + state_add( PPS4_Ip, "Ip", m_Ip ).formatstr("%02X").noshow(); + state_add( STATE_GENPC, "GENPC", m_P ).noshow(); + state_add( STATE_GENFLAGS, "GENFLAGS", m_C).formatstr("%3s").noshow(); + + m_icountptr = &m_icount; } void pps4_device::state_string_export(const device_state_entry &entry, astring &string) { - switch (entry.index()) - { - case STATE_GENFLAGS: - string.printf("%c%c%c", - m_C ? 'C':'.', - m_FF1 ? '1':'.', - m_FF2 ? '2':'.'); - break; - } + switch (entry.index()) + { + case STATE_GENFLAGS: + string.printf("%c%c%c", + m_C ? 'C':'.', + m_FF1 ? '1':'.', + m_FF2 ? '2':'.'); + break; + } } /*************************************************************************** @@ -1571,17 +1571,17 @@ void pps4_device::state_string_export(const device_state_entry &entry, astring & void pps4_device::device_reset() { - m_A = 0; // Accumulator A(4:1) - m_X = 0; // X register X(4:1) - m_P = 0; // program counter P(12:1) - m_SA = 0; // Shift register SA(12:1) - m_SB = 0; // Shift register SB(12:1) - m_SAG = 0; // Special address generation mask - m_B = 0; // B address register B(12:1) (BL, BM and BU) - m_C = 0; // Carry flip-flop - m_FF1 = 0; // Flip-flop 1 - m_FF2 = 0; // Flip-flop 2 - m_I1 = 0; // Most recent instruction I(8:1) - m_I2 = 0; // Most recent parameter I2(8:1) - m_Ip = 0; // Previous instruction I(8:1) + m_A = 0; // Accumulator A(4:1) + m_X = 0; // X register X(4:1) + m_P = 0; // program counter P(12:1) + m_SA = 0; // Shift register SA(12:1) + m_SB = 0; // Shift register SB(12:1) + m_SAG = 0; // Special address generation mask + m_B = 0; // B address register B(12:1) (BL, BM and BU) + m_C = 0; // Carry flip-flop + m_FF1 = 0; // Flip-flop 1 + m_FF2 = 0; // Flip-flop 2 + m_I1 = 0; // Most recent instruction I(8:1) + m_I2 = 0; // Most recent parameter I2(8:1) + m_Ip = 0; // Previous instruction I(8:1) } diff --git a/src/emu/cpu/pps4/pps4.h b/src/emu/cpu/pps4/pps4.h index e5f46906a6c..a001e3cf933 100644 --- a/src/emu/cpu/pps4/pps4.h +++ b/src/emu/cpu/pps4/pps4.h @@ -9,22 +9,22 @@ ***************************************************************************/ enum { - PPS4_PC, - PPS4_A, - PPS4_X, - PPS4_SA, - PPS4_SB, - PPS4_B, - PPS4_Skip, - PPS4_SAG, - PPS4_I1, - PPS4_I2, - PPS4_Ip, - PPS4_GENPC = STATE_GENPC, - PPS4_GENSP = STATE_GENSP, - PPS4_GENPCBASE = STATE_GENPCBASE, - PPS4_PORT_A = 256, - PPS4_PORT_B = 257 + PPS4_PC, + PPS4_A, + PPS4_X, + PPS4_SA, + PPS4_SB, + PPS4_B, + PPS4_Skip, + PPS4_SAG, + PPS4_I1, + PPS4_I2, + PPS4_Ip, + PPS4_GENPC = STATE_GENPC, + PPS4_GENSP = STATE_GENSP, + PPS4_GENPCBASE = STATE_GENPCBASE, + PPS4_PORT_A = 256, + PPS4_PORT_B = 257 }; /*************************************************************************** @@ -40,128 +40,128 @@ extern const device_type PPS4; class pps4_device : public cpu_device { public: - // construction/destruction - pps4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + // construction/destruction + pps4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - - // device_execute_interface overrides - virtual UINT32 execute_min_cycles() const { return 1; } - virtual UINT32 execute_max_cycles() const { return 3; } - virtual UINT32 execute_input_lines() const { return 0; } - virtual UINT32 execute_default_irq_vector() const { return 0; } - virtual void execute_run(); - - // device_memory_interface overrides - virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const - { - return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : ( (spacenum == AS_DATA) ? &m_data_config : NULL ) ); - } - - // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &string); - - // device_disasm_interface overrides - virtual UINT32 disasm_min_opcode_bytes() const { return 1; } - virtual UINT32 disasm_max_opcode_bytes() const { return 2; } - virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // device_execute_interface overrides + virtual UINT32 execute_min_cycles() const { return 1; } + virtual UINT32 execute_max_cycles() const { return 3; } + virtual UINT32 execute_input_lines() const { return 0; } + virtual UINT32 execute_default_irq_vector() const { return 0; } + virtual void execute_run(); + + // device_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const + { + return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : ( (spacenum == AS_DATA) ? &m_data_config : NULL ) ); + } + + // device_state_interface overrides + void state_string_export(const device_state_entry &entry, astring &string); + + // device_disasm_interface overrides + virtual UINT32 disasm_min_opcode_bytes() const { return 1; } + virtual UINT32 disasm_max_opcode_bytes() const { return 2; } + virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); private: - address_space_config m_program_config; - address_space_config m_data_config; - address_space_config m_io_config; - - address_space *m_program; - direct_read_data *m_direct; - address_space *m_data; - address_space *m_io; - int m_icount; - - UINT8 m_A; //!< Accumulator A(4:1) - UINT8 m_X; //!< X register X(4:1) - UINT16 m_P; //!< program counter P(12:1) - UINT16 m_SA; //!< Shift register SA(12:1) - UINT16 m_SB; //!< Shift register SB(12:1) - UINT8 m_Skip; //!< Skip next instruction - UINT16 m_SAG; //!< Special address generation mask - UINT16 m_B; //!< B register B(12:1) (BL, BM and BH) - UINT8 m_C; //!< Carry flip-flop - UINT8 m_FF1; //!< Flip-flop 1 - UINT8 m_FF2; //!< Flip-flop 2 - UINT8 m_I1; //!< Most recent instruction I(8:1) - UINT8 m_I2; //!< Most recent parameter I2(8:1) - UINT8 m_Ip; //!< Previous instruction I(8:1) - - //! return the contents of B register (made of BU, BM and BL) - inline UINT16 B() const; - - //! return memory at address B(12:1) - inline UINT8 M(); - - //! write to memory at address B(12:1) - inline void W(UINT8 data); - - //! return the next opcode (also in m_I) - inline UINT8 ROP(); - - //! return the next argument (also in m_I2) - inline UINT8 ARG(); - - void iAD(); //!< Add - void iADC(); //!< Add with carry-in - void iADSK(); //!< Add and skip on carry-out - void iADCSK(); //!< Add with carry-in and skip on carry-out - void iADI(); //!< Add immediate - void iDC(); //!< Decimal correction - void iAND(); //!< Logical AND - void iOR(); //!< Logical OR - void iEOR(); //!< Logical Exclusive-OR - void iCOMP(); //!< Complement - void iSC(); //!< Set Carry flip-flop - void iRC(); //!< Reset Carry flip-flop - void iSF1(); //!< Set FF1 - void iRF1(); //!< Reset FF1 - void iSF2(); //!< Set FF2 - void iRF2(); //!< Reset FF2 - void iLD(); //!< Load accumulator from memory - void iEX(); //!< Exchange accumulator and memory - void iEXD(); //!< Exchange accumulator and memory and decrement BL - void iLDI(); //!< Load accumulator immediate - void iLAX(); //!< Load accumulator from X register - void iLXA(); //!< Load X register from accumulator - void iLABL(); //!< Load accumulator with BL - void iLBMX(); //!< Load BM with X - void iLBUA(); //!< Load BU with A - void iXABL(); //!< Exchange accumulator and BL - void iXBMX(); //!< Exchange BM and X registers - void iXAX(); //!< Exchange accumulator and X - void iXS(); //!< Eychange SA and SB registers - void iCYS(); //!< Cycle SA register and accumulaor - void iLB(); //!< Load B indirect - void iLBL(); //!< Load B long - void iINCB(); //!< Increment BL - void iDECB(); //!< Decrement BL - void iT(); //!< Transfer - void iTM(); //!< Transfer and mark indirect - void iTL(); //!< Transfer long - void iTML(); //!< Transfer and mark long - void iSKC(); //!< Skip on carry flip-flop - void iSKZ(); //!< Skip on accumulator zero - void iSKBI(); //!< Skip if BL equal to immediate - void iSKF1(); //!< Skip if FF1 equals 1 - void iSKF2(); //!< Skip if FF2 equals 1 - void iRTN(); //!< Return - void iRTNSK(); //!< Return and skip - void iIOL(); //!< Input/Output long - void iDIA(); //!< Discrete input group A - void iDIB(); //!< Discrete input group B - void iDOA(); //!< Discrete output group A - void iSAG(); //!< Special address generation - - void execute_one(); //!< execute one instruction + address_space_config m_program_config; + address_space_config m_data_config; + address_space_config m_io_config; + + address_space *m_program; + direct_read_data *m_direct; + address_space *m_data; + address_space *m_io; + int m_icount; + + UINT8 m_A; //!< Accumulator A(4:1) + UINT8 m_X; //!< X register X(4:1) + UINT16 m_P; //!< program counter P(12:1) + UINT16 m_SA; //!< Shift register SA(12:1) + UINT16 m_SB; //!< Shift register SB(12:1) + UINT8 m_Skip; //!< Skip next instruction + UINT16 m_SAG; //!< Special address generation mask + UINT16 m_B; //!< B register B(12:1) (BL, BM and BH) + UINT8 m_C; //!< Carry flip-flop + UINT8 m_FF1; //!< Flip-flop 1 + UINT8 m_FF2; //!< Flip-flop 2 + UINT8 m_I1; //!< Most recent instruction I(8:1) + UINT8 m_I2; //!< Most recent parameter I2(8:1) + UINT8 m_Ip; //!< Previous instruction I(8:1) + + //! return the contents of B register (made of BU, BM and BL) + inline UINT16 B() const; + + //! return memory at address B(12:1) + inline UINT8 M(); + + //! write to memory at address B(12:1) + inline void W(UINT8 data); + + //! return the next opcode (also in m_I) + inline UINT8 ROP(); + + //! return the next argument (also in m_I2) + inline UINT8 ARG(); + + void iAD(); //!< Add + void iADC(); //!< Add with carry-in + void iADSK(); //!< Add and skip on carry-out + void iADCSK(); //!< Add with carry-in and skip on carry-out + void iADI(); //!< Add immediate + void iDC(); //!< Decimal correction + void iAND(); //!< Logical AND + void iOR(); //!< Logical OR + void iEOR(); //!< Logical Exclusive-OR + void iCOMP(); //!< Complement + void iSC(); //!< Set Carry flip-flop + void iRC(); //!< Reset Carry flip-flop + void iSF1(); //!< Set FF1 + void iRF1(); //!< Reset FF1 + void iSF2(); //!< Set FF2 + void iRF2(); //!< Reset FF2 + void iLD(); //!< Load accumulator from memory + void iEX(); //!< Exchange accumulator and memory + void iEXD(); //!< Exchange accumulator and memory and decrement BL + void iLDI(); //!< Load accumulator immediate + void iLAX(); //!< Load accumulator from X register + void iLXA(); //!< Load X register from accumulator + void iLABL(); //!< Load accumulator with BL + void iLBMX(); //!< Load BM with X + void iLBUA(); //!< Load BU with A + void iXABL(); //!< Exchange accumulator and BL + void iXBMX(); //!< Exchange BM and X registers + void iXAX(); //!< Exchange accumulator and X + void iXS(); //!< Eychange SA and SB registers + void iCYS(); //!< Cycle SA register and accumulaor + void iLB(); //!< Load B indirect + void iLBL(); //!< Load B long + void iINCB(); //!< Increment BL + void iDECB(); //!< Decrement BL + void iT(); //!< Transfer + void iTM(); //!< Transfer and mark indirect + void iTL(); //!< Transfer long + void iTML(); //!< Transfer and mark long + void iSKC(); //!< Skip on carry flip-flop + void iSKZ(); //!< Skip on accumulator zero + void iSKBI(); //!< Skip if BL equal to immediate + void iSKF1(); //!< Skip if FF1 equals 1 + void iSKF2(); //!< Skip if FF2 equals 1 + void iRTN(); //!< Return + void iRTNSK(); //!< Return and skip + void iIOL(); //!< Input/Output long + void iDIA(); //!< Discrete input group A + void iDIB(); //!< Discrete input group B + void iDOA(); //!< Discrete output group A + void iSAG(); //!< Special address generation + + void execute_one(); //!< execute one instruction }; #endif // __PPS4_H__ diff --git a/src/emu/cpu/pps4/pps4dasm.c b/src/emu/cpu/pps4/pps4dasm.c index 2f27137ee94..6a06b498232 100644 --- a/src/emu/cpu/pps4/pps4dasm.c +++ b/src/emu/cpu/pps4/pps4dasm.c @@ -16,81 +16,81 @@ #define ARG(A) opram[(A) - PC] typedef enum pps4_token_e { - t_AD, t_ADC, t_ADSK, t_ADCSK, t_ADI, - t_DC, t_AND, t_OR, t_EOR, t_COMP, - t_SC, t_RC, t_SF1, t_RF1, t_SF2, - t_RF2, t_LD, t_EX, t_EXD, t_LDI, - t_LAX, t_LXA, t_LABL, t_LBMX, t_LBUA, - t_XABL, t_XBMX, t_XAX, t_XS, t_CYS, - t_LB, t_LBL, t_INCB, t_DECB, t_T, - t_TM, t_TL, t_TML, t_SKC, t_SKZ, - t_SKBI, t_SKF1, t_SKF2, t_RTN, t_RTNSK, - t_IOL, t_DIA, t_DIB, t_DOA, t_SAG, - t_COUNT, - t_MASK = (1 << 6) - 1, - t_I3c = 1 << 6, /* immediate 3 bit constant, complemented */ - t_I4 = 1 << 7, /* immediate 4 bit constant */ - t_I4c = 1 << 8, /* immediate 4 bit constant, complemented */ - t_I4p = 1 << 9, /* immediate 4 bit offset into page 3 */ - t_I6p = 1 << 10, /* immediate 6 bit constant; address in current page */ - t_I6i = 1 << 11, /* immediate 6 bit indirect page 3 offset (16 ... 63) + followed by page 1 address */ - t_I8 = 1 << 12, /* immediate 8 bit constant (I/O port number) */ - t_I8c = 1 << 13, /* immediate 8 bit constant inverted */ - t_OVER = 1 << 14, /* Debugger step over (CALL) */ - t_OUT = 1 << 15 /* Debugger step out (RETURN) */ + t_AD, t_ADC, t_ADSK, t_ADCSK, t_ADI, + t_DC, t_AND, t_OR, t_EOR, t_COMP, + t_SC, t_RC, t_SF1, t_RF1, t_SF2, + t_RF2, t_LD, t_EX, t_EXD, t_LDI, + t_LAX, t_LXA, t_LABL, t_LBMX, t_LBUA, + t_XABL, t_XBMX, t_XAX, t_XS, t_CYS, + t_LB, t_LBL, t_INCB, t_DECB, t_T, + t_TM, t_TL, t_TML, t_SKC, t_SKZ, + t_SKBI, t_SKF1, t_SKF2, t_RTN, t_RTNSK, + t_IOL, t_DIA, t_DIB, t_DOA, t_SAG, + t_COUNT, + t_MASK = (1 << 6) - 1, + t_I3c = 1 << 6, /* immediate 3 bit constant, complemented */ + t_I4 = 1 << 7, /* immediate 4 bit constant */ + t_I4c = 1 << 8, /* immediate 4 bit constant, complemented */ + t_I4p = 1 << 9, /* immediate 4 bit offset into page 3 */ + t_I6p = 1 << 10, /* immediate 6 bit constant; address in current page */ + t_I6i = 1 << 11, /* immediate 6 bit indirect page 3 offset (16 ... 63) + followed by page 1 address */ + t_I8 = 1 << 12, /* immediate 8 bit constant (I/O port number) */ + t_I8c = 1 << 13, /* immediate 8 bit constant inverted */ + t_OVER = 1 << 14, /* Debugger step over (CALL) */ + t_OUT = 1 << 15 /* Debugger step out (RETURN) */ } pps4_token_e; static const char *token_str[t_COUNT] = { - "ad", /* add */ - "adc", /* add with carry-in */ - "adsk", /* add and skip on carry-out */ - "adcsk", /* add with carry-in and skip on carry-out */ - "adi", /* add immediate */ - "dc", /* decimal correction */ - "and", /* logical and */ - "or", /* logical or */ - "eor", /* logical exclusive-orf */ - "comp", /* complement */ - "sc", /* set C flip-flop */ - "rc", /* reset C flip-flop */ - "sf1", /* set FF1 flip-flop */ - "rf1", /* reset FF1 flip-flop */ - "sf2", /* set FF2 flip-flop */ - "rf2", /* reset FF2 flip-flop */ - "ld", /* load accumulator from memory */ - "ex", /* exchange accumulator and memory */ - "exd", /* exchange accumulator and memory and decrement BL */ - "ldi", /* load accumulator immediate */ - "lax", /* load accumulator from X register */ - "lxa", /* load X register from accumulator */ - "labl", /* load accumulator with BL */ - "lbmx", /* load BM with X */ - "lbua", /* load BU with A */ - "xabl", /* exchange accumulator and BL */ - "xbmx", /* exchange BM and X */ - "xax", /* exchange accumulator and X */ - "xs", /* exchange SA and SB */ - "cys", /* cycle SA register and accumulator */ - "lb", /* load B indirect */ - "lbl", /* load B long */ - "incb", /* increment BL */ - "decb", /* decrement BL */ - "t", /* transfer */ - "tm", /* transfer and mark indirect */ - "tl", /* transfer long */ - "tml", /* transfer and mark long */ - "skc", /* skip on C flip-flop equals 1 */ - "skz", /* skip on accumulator zero */ - "skbi", /* skip on BL equal to immediate */ - "skf1", /* skip on FF1 flip-flop equals 1 */ - "skf2", /* skip on FF2 flip-flop equals 1 */ - "rtn", /* return */ - "rtnsk", /* return and skip */ - "iol", /* input/output long */ - "dia", /* discrete input group A */ - "dib", /* discrete input group B */ - "doa", /* discrete output */ - "sag" /* special address generation */ + "ad", /* add */ + "adc", /* add with carry-in */ + "adsk", /* add and skip on carry-out */ + "adcsk", /* add with carry-in and skip on carry-out */ + "adi", /* add immediate */ + "dc", /* decimal correction */ + "and", /* logical and */ + "or", /* logical or */ + "eor", /* logical exclusive-orf */ + "comp", /* complement */ + "sc", /* set C flip-flop */ + "rc", /* reset C flip-flop */ + "sf1", /* set FF1 flip-flop */ + "rf1", /* reset FF1 flip-flop */ + "sf2", /* set FF2 flip-flop */ + "rf2", /* reset FF2 flip-flop */ + "ld", /* load accumulator from memory */ + "ex", /* exchange accumulator and memory */ + "exd", /* exchange accumulator and memory and decrement BL */ + "ldi", /* load accumulator immediate */ + "lax", /* load accumulator from X register */ + "lxa", /* load X register from accumulator */ + "labl", /* load accumulator with BL */ + "lbmx", /* load BM with X */ + "lbua", /* load BU with A */ + "xabl", /* exchange accumulator and BL */ + "xbmx", /* exchange BM and X */ + "xax", /* exchange accumulator and X */ + "xs", /* exchange SA and SB */ + "cys", /* cycle SA register and accumulator */ + "lb", /* load B indirect */ + "lbl", /* load B long */ + "incb", /* increment BL */ + "decb", /* decrement BL */ + "t", /* transfer */ + "tm", /* transfer and mark indirect */ + "tl", /* transfer long */ + "tml", /* transfer and mark long */ + "skc", /* skip on C flip-flop equals 1 */ + "skz", /* skip on accumulator zero */ + "skbi", /* skip on BL equal to immediate */ + "skf1", /* skip on FF1 flip-flop equals 1 */ + "skf2", /* skip on FF2 flip-flop equals 1 */ + "rtn", /* return */ + "rtnsk", /* return and skip */ + "iol", /* input/output long */ + "dia", /* discrete input group A */ + "dib", /* discrete input group B */ + "doa", /* discrete output */ + "sag" /* special address generation */ }; static const UINT16 table[] = { @@ -369,75 +369,75 @@ static const UINT16 table[] = { CPU_DISASSEMBLE( pps4 ) { - UINT32 flags = 0; - unsigned PC = pc; - UINT8 op = OP(pc++); - UINT32 tok = table[op]; - char *dst = 0; - - if (0 == (tok & t_MASK)) { - sprintf(buffer, "%s", token_str[tok & t_MASK]); - } else { - dst = buffer + sprintf(buffer, "%-7s", token_str[tok & t_MASK]); - } - - if (tok & t_I3c) { - // 3 bit immediate, complemented - UINT8 i = ~op & 7; - if (0 != i) // only print if non-zero - dst += sprintf(dst, "%x", i); - } - - if (tok & t_I4) { - // 4 bit immediate - UINT8 i = op & 15; - dst += sprintf(dst, "%x", i); - } - - if (tok & t_I4c) { - // 4 bit immediate, complemented - UINT8 i = ~op & 15; - dst += sprintf(dst, "%x", i); - } - - if (tok & t_I4p) { - // 4 bit immediate offset into page 3 - UINT8 i = op & 15; - dst += sprintf(dst, "[%x]", 0x0c0 | i); - } - - if (tok & t_I6p) { - // 6 bit immediate offset into current page - UINT8 i = op & 63; - dst += sprintf(dst, "%x", (PC & ~63) | i); - } - - if (tok & t_I6i) { - // 6 bit immediate offset into page 3 - UINT16 i6p3 = (3 << 6) | (op & 63); - // 8 bit absolute offset at 0x0100 - UINT16 addr = (1 << 8) | 0; // ROM[ip3] can't be reached!? - (void)addr; // avoid unused variable warning - dst += sprintf(dst, "[%x]", i6p3); - } - - if (tok & t_I8) { - // 8 bit immediate I/O port address - UINT8 arg = ARG(pc++); - dst += sprintf(dst, "%02x", arg); - } - - if (tok & t_I8c) { - // 8 bit immediate offset into page - UINT16 arg = ~ARG(pc++) & 255; - dst += sprintf(dst, "%02x", arg); - } - - if (tok & t_OVER) // TL or TML - flags |= DASMFLAG_STEP_OVER; - - if (tok & t_OUT) // RTN or RTNSK - flags |= DASMFLAG_STEP_OUT; - - return (pc - PC) | flags | DASMFLAG_SUPPORTED; + UINT32 flags = 0; + unsigned PC = pc; + UINT8 op = OP(pc++); + UINT32 tok = table[op]; + char *dst = 0; + + if (0 == (tok & t_MASK)) { + sprintf(buffer, "%s", token_str[tok & t_MASK]); + } else { + dst = buffer + sprintf(buffer, "%-7s", token_str[tok & t_MASK]); + } + + if (tok & t_I3c) { + // 3 bit immediate, complemented + UINT8 i = ~op & 7; + if (0 != i) // only print if non-zero + dst += sprintf(dst, "%x", i); + } + + if (tok & t_I4) { + // 4 bit immediate + UINT8 i = op & 15; + dst += sprintf(dst, "%x", i); + } + + if (tok & t_I4c) { + // 4 bit immediate, complemented + UINT8 i = ~op & 15; + dst += sprintf(dst, "%x", i); + } + + if (tok & t_I4p) { + // 4 bit immediate offset into page 3 + UINT8 i = op & 15; + dst += sprintf(dst, "[%x]", 0x0c0 | i); + } + + if (tok & t_I6p) { + // 6 bit immediate offset into current page + UINT8 i = op & 63; + dst += sprintf(dst, "%x", (PC & ~63) | i); + } + + if (tok & t_I6i) { + // 6 bit immediate offset into page 3 + UINT16 i6p3 = (3 << 6) | (op & 63); + // 8 bit absolute offset at 0x0100 + UINT16 addr = (1 << 8) | 0; // ROM[ip3] can't be reached!? + (void)addr; // avoid unused variable warning + dst += sprintf(dst, "[%x]", i6p3); + } + + if (tok & t_I8) { + // 8 bit immediate I/O port address + UINT8 arg = ARG(pc++); + dst += sprintf(dst, "%02x", arg); + } + + if (tok & t_I8c) { + // 8 bit immediate offset into page + UINT16 arg = ~ARG(pc++) & 255; + dst += sprintf(dst, "%02x", arg); + } + + if (tok & t_OVER) // TL or TML + flags |= DASMFLAG_STEP_OVER; + + if (tok & t_OUT) // RTN or RTNSK + flags |= DASMFLAG_STEP_OUT; + + return (pc - PC) | flags | DASMFLAG_SUPPORTED; } diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c index 7099a148885..8f29e8f95c5 100644 --- a/src/emu/cpu/sh2/sh2comn.c +++ b/src/emu/cpu/sh2/sh2comn.c @@ -699,7 +699,7 @@ READ32_MEMBER( sh2_device::sh2_internal_r ) case 0x00: break; case 0x01: -// return m_m[1] | 0; // bit31 is TDRE: Trasmit Data Register Empty. Forcing it to be '1' breaks Saturn ... +// return m_m[1] | 0; // bit31 is TDRE: Trasmit Data Register Empty. Forcing it to be '1' breaks Saturn ... return m_m[1] | (0x84 << 24); // ... but this is actually needed to make EGWord on SS to boot? case 0x04: // TIER, FTCSR, FRC diff --git a/src/emu/cpu/tms0980/tms0980.c b/src/emu/cpu/tms0980/tms0980.c index 8c085b7bd32..22ebea62b52 100644 --- a/src/emu/cpu/tms0980/tms0980.c +++ b/src/emu/cpu/tms0980/tms0980.c @@ -250,7 +250,7 @@ tms0270_cpu_device::tms0270_cpu_device(const machine_config &mconfig, const char static MACHINE_CONFIG_FRAGMENT(tms1000) - + // microinstructions PLA, output PLA MCFG_PLA_ADD("mpla", 8, 16, 30) MCFG_PLA_FILEFORMAT(PLA_FMT_BERKELEY) @@ -374,7 +374,7 @@ void tms1xxx_cpu_device::device_start() m_r_mask = (1 << m_r_pins) - 1; m_pc_mask = (1 << m_pc_bits) - 1; m_x_mask = (1 << m_x_bits) - 1; - + // zerofill m_pc = 0; m_sr = 0; @@ -401,7 +401,7 @@ void tms1xxx_cpu_device::device_start() m_clatch = 0; m_add = 0; m_bl = 0; - + m_ram_in = 0; m_dam_in = 0; m_ram_out = 0; @@ -484,7 +484,7 @@ void tms0270_cpu_device::device_start() m_o_latch_low = 0; m_o_latch = 0; m_o_latch_prev = 0; - + // register for savestates save_item(NAME(m_r_prev)); save_item(NAME(m_chipsel)); @@ -535,18 +535,18 @@ void tms1000_cpu_device::device_reset() { // common reset tms1xxx_cpu_device::device_reset(); - + // pre-decode instructionset m_fixed_decode.resize_and_clear(0x100); m_micro_decode.resize_and_clear(0x100); - + for (int op = 0; op < 0x100; op++) { // _____ _____ ______ _____ ______ _____ _____ _____ _____ const UINT32 md[16] = { M_STSL, M_AUTY, M_AUTA, M_CIN, M_C8, M_NE, M_CKN, M_15TN, M_MTN, M_NATN, M_ATN, M_MTP, M_YTP, M_CKP, M_CKM, M_STO }; UINT16 mask = m_mpla->read(op); mask ^= 0x3fc8; // invert active-negative - + for (int bit = 0; bit < 16; bit++) if (mask & (1 << bit)) m_micro_decode[op] |= md[bit]; @@ -559,7 +559,7 @@ void tms1000_cpu_device::device_reset() m_fixed_decode[0x0c] = F_RSTR; m_fixed_decode[0x0d] = F_SETR; m_fixed_decode[0x0f] = F_RETN; - + for (int i = 0x10; i < 0x20; i++) m_fixed_decode[i] = F_LDP; for (int i = 0x30; i < 0x34; i++) m_fixed_decode[i] = F_SBIT; for (int i = 0x34; i < 0x38; i++) m_fixed_decode[i] = F_RBIT; @@ -572,7 +572,7 @@ void tms1000_cpu_device::device_reset() void tms1100_cpu_device::device_reset() { tms1000_cpu_device::device_reset(); - + // small differences in 00-3f area m_fixed_decode[0x00] = 0; m_fixed_decode[0x09] = F_COMX8; // ! @@ -597,29 +597,29 @@ void tms0970_cpu_device::device_reset() // upper half of the opcodes is always branch/call if (op & 0x80) m_fixed_decode[op] = (op & 0x40) ? F_CALL: F_BR; - + // 5 output bits select a microinstruction index UINT32 imask = m_ipla->read(op); UINT8 msel = imask & 0x1f; - + // but if (from bottom to top) term 1 is active and output bit 5 is 0, R2,R4-R7 directly select a microinstruction index if (imask & 0x40 && (imask & 0x20) == 0) msel = (op & 0xf) | (op >> 1 & 0x10); - + msel = BITSWAP8(msel,7,6,5,0,1,2,3,4); // lines are reversed UINT32 mmask = m_mpla->read(msel); mmask ^= 0x09fe; // invert active-negative - + // _____ _____ _____ _____ ______ _____ ______ _____ _____ const UINT32 md[15] = { M_CKM, M_CKP, M_YTP, M_MTP, M_ATN, M_NATN, M_MTN, M_15TN, M_CKN, M_NE, M_C8, M_CIN, M_AUTA, M_AUTY, M_STO }; for (int bit = 0; bit < 15; bit++) if (mmask & (1 << bit)) m_micro_decode[op] |= md[bit]; - + // the other ipla terms each select a fixed instruction const UINT32 id[8] = { F_LDP, F_TDO, F_COMX, F_LDX, F_SBIT, F_RBIT, F_SETR, F_RETN }; - + for (int bit = 0; bit < 8; bit++) if (imask & (0x80 << bit)) m_fixed_decode[op] |= id[bit]; @@ -630,20 +630,20 @@ void tms0970_cpu_device::device_reset() UINT32 tms0980_cpu_device::decode_micro(UINT8 sel) { UINT32 decode = 0; - + sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed UINT32 mask = m_mpla->read(sel); mask ^= 0x43fc3; // invert active-negative - + // M_RSTR is specific to TMS02x0, it redirects to F_RSTR // M_UNK1 is specific to TMS0270, unknown yet // _______ ______ _____ _____ _____ _____ ______ _____ ______ _____ _____ const UINT32 md[22] = { M_NDMTP, M_DMTP, M_AUTY, M_AUTA, M_CKM, M_SSE, M_CKP, M_YTP, M_MTP, M_ATN, M_NATN, M_MTN, M_15TN, M_CKN, M_NE, M_C8, M_SSS, M_CME, M_CIN, M_STO, M_RSTR, M_UNK1 }; - + for (int bit = 0; bit < 22 && bit < m_mpla->outputs(); bit++) if (mask & (1 << bit)) decode |= md[bit]; - + return decode; } @@ -651,7 +651,7 @@ void tms0980_cpu_device::device_reset() { // common reset tms1xxx_cpu_device::device_reset(); - + // pre-decode instructionset m_fixed_decode.resize_and_clear(0x200); m_micro_decode.resize_and_clear(0x200); @@ -661,20 +661,20 @@ void tms0980_cpu_device::device_reset() // upper half of the opcodes is always branch/call if (op & 0x100) m_fixed_decode[op] = (op & 0x80) ? F_CALL: F_BR; - + UINT32 imask = m_ipla->read(op); // 6 output bits select a microinstruction index m_micro_decode[op] = decode_micro(imask & 0x3f); - + // the other ipla terms each select a fixed instruction const UINT32 id[15] = { F_LDP, F_SBL, F_OFF, F_RBIT, F_SAL, F_XDA, F_REAC, F_SETR, F_RETN, F_SBIT, F_TDO, F_COMX8, F_COMX, F_LDX, F_SEAC }; - + for (int bit = 0; bit < 15; bit++) if (imask & (0x80 << bit)) m_fixed_decode[op] |= id[bit]; } - + // like on TMS0970, one of the terms directly select a microinstruction index (via R4-R8), // but it can't be pre-determined when it's active m_micro_direct.resize_and_clear(0x40); @@ -710,7 +710,7 @@ void tms1xxx_cpu_device::next_pc() fb = 1; else if (m_pc == m_pc_mask) fb = 0; - + m_pc = (m_pc << 1 | fb) & m_pc_mask; } @@ -731,9 +731,9 @@ void tms0980_cpu_device::read_opcode() debugger_instruction_hook(this, m_rom_address << 1); m_opcode = m_program->read_word(m_rom_address << 1) & 0x1ff; m_c4 = BITSWAP8(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes - + m_fixed = m_fixed_decode[m_opcode]; - + // if ipla term 0 is active, R4-R8 directly select a microinstruction index when R0 or R0^BL is 0 int r0 = m_opcode >> 8 & 1; if (m_ipla->read(m_opcode) & 0x40 && !((r0 & m_bl) ^ r0)) @@ -747,7 +747,7 @@ void tms0980_cpu_device::read_opcode() void tms0270_cpu_device::read_opcode() { tms0980_cpu_device::read_opcode(); - + // RSTR is on the mpla if (m_micro & M_RSTR) m_fixed |= F_RSTR; @@ -780,13 +780,13 @@ void tms0270_cpu_device::dynamic_output() // R13: power off, trigger on falling edge if ((m_r_prev >> 13 & 1) && !(m_r >> 13 & 1)) m_power_off(1); - + // R11: TMS5100 CTL port direction (0=read from TMS5100, 1=write to TMS5100) m_ctl_dir = m_r >> 11 & 1; // R12: chip select (off=display via OPLA, on=TMS5100 via ACC/CKB) m_chipsel = m_r >> 12 & 1; - + if (m_chipsel) { // ACC via SEG B,C,D,G: TMS5100 CTL pins @@ -812,7 +812,7 @@ void tms0270_cpu_device::dynamic_output() m_o_latch_prev = m_o_latch; } } - + // standard R-output if (m_r != m_r_prev) { @@ -860,7 +860,7 @@ void tms1xxx_cpu_device::set_cki_bus() case 0x30: case 0x38: m_cki_bus = 1 << (m_c4 >> 2) ^ 0xf; break; - + // 01XXXXXX: constant case 0x00: // R2,3,4 are NANDed with eachother, and then ORed with R1, making 00000XXX valid too case 0x40: case 0x48: case 0x50: case 0x58: case 0x60: case 0x68: case 0x70: case 0x78: @@ -886,7 +886,7 @@ void tms0980_cpu_device::set_cki_bus() case 0x020: case 0x0a0: m_cki_bus = 1 << (m_c4 >> 2) ^ 0xf; break; - + // 0X1XXXXXX: constant case 0x040: case 0x048: case 0x050: case 0x058: case 0x060: case 0x068: case 0x070: case 0x078: case 0x0c0: case 0x0c8: case 0x0d0: case 0x0d8: case 0x0e0: case 0x0e8: case 0x0f0: case 0x0f8: @@ -1080,7 +1080,7 @@ void tms0270_cpu_device::op_tdo() m_o_latch_low = m_a; else m_o_latch = m_o_latch_low | (m_a << 4 & 0x30); - + // write to output is done in dynamic_output } @@ -1111,7 +1111,7 @@ void tms1xxx_cpu_device::execute_run() if (m_status) { UINT8 new_pc = m_opcode & m_pc_mask; - + // BR: conditional branch if (m_fixed & F_BR) { @@ -1120,7 +1120,7 @@ void tms1xxx_cpu_device::execute_run() m_ca = m_cb; m_pc = new_pc; } - + // CALL: conditional call if (m_fixed & F_CALL) { @@ -1166,7 +1166,7 @@ void tms1xxx_cpu_device::execute_run() case 1: // fetch: rom address 2/2 m_rom_address = (m_ca << (m_pc_bits+4)) | (m_pa << m_pc_bits) | m_pc; - + // execute: update alu inputs // N inputs if (m_micro & M_15TN) m_n |= 0xf; @@ -1233,7 +1233,7 @@ void tms1xxx_cpu_device::execute_run() if (m_fixed & F_SAL) op_sal(); if (m_fixed & F_SBL) op_sbl(); if (m_fixed & F_XDA) op_xda(); - + // after fixed opcode handling: store status, write ram m_status = status; if (m_ram_out != -1) diff --git a/src/emu/cpu/tms0980/tms0980.h b/src/emu/cpu/tms0980/tms0980.h index 1b0d3e2a910..a3e3505962f 100644 --- a/src/emu/cpu/tms0980/tms0980.h +++ b/src/emu/cpu/tms0980/tms0980.h @@ -77,7 +77,7 @@ public: template<class _Object> static devcb_base &set_write_r_callback(device_t &device, _Object object) { return downcast<tms1xxx_cpu_device &>(device).m_write_r.set_callback(object); } template<class _Object> static devcb_base &set_power_off_callback(device_t &device, _Object object) { return downcast<tms1xxx_cpu_device &>(device).m_power_off.set_callback(object); } static void set_output_pla(device_t &device, const UINT16 *output_pla) { downcast<tms1xxx_cpu_device &>(device).c_output_pla = output_pla; } - + protected: // device-level overrides virtual void device_start(); @@ -184,7 +184,7 @@ protected: devcb_write16 m_write_o; devcb_write16 m_write_r; devcb_write_line m_power_off; - + UINT32 m_o_mask; UINT32 m_r_mask; UINT32 m_k_mask; @@ -239,7 +239,7 @@ protected: virtual void device_reset(); virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); - + virtual void op_setr(); virtual void op_rstr(); }; @@ -263,7 +263,7 @@ protected: virtual machine_config_constructor device_mconfig_additions() const; virtual void write_o_output(UINT8 index); - + virtual void op_setr(); virtual void op_tdo(); }; @@ -284,11 +284,11 @@ protected: virtual UINT32 disasm_min_opcode_bytes() const { return 2; } virtual UINT32 disasm_max_opcode_bytes() const { return 2; } virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); - + virtual UINT8 read_k_input(); virtual void set_cki_bus(); virtual void read_opcode(); - + virtual void op_comx(); UINT32 decode_micro(UINT8 sel); @@ -299,7 +299,7 @@ class tms0270_cpu_device : public tms0980_cpu_device { public: tms0270_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + // static configuration helpers template<class _Object> static devcb_base &set_read_ctl_callback(device_t &device, _Object object) { return downcast<tms0270_cpu_device &>(device).m_read_ctl.set_callback(object); } template<class _Object> static devcb_base &set_write_ctl_callback(device_t &device, _Object object) { return downcast<tms0270_cpu_device &>(device).m_write_ctl.set_callback(object); } @@ -316,7 +316,7 @@ protected: virtual UINT8 read_k_input(); virtual void dynamic_output(); virtual void read_opcode(); - + virtual void op_setr(); virtual void op_rstr(); virtual void op_tdo(); diff --git a/src/emu/luaengine.c b/src/emu/luaengine.c index 843c873233e..62e7d02563a 100644 --- a/src/emu/luaengine.c +++ b/src/emu/luaengine.c @@ -348,7 +348,7 @@ luabridge::LuaRef lua_engine::l_machine_get_devices(const running_machine *r) luabridge::LuaRef devs_table = luabridge::LuaRef::newTable(L); device_t *root = &(m->root_device()); - devs_table = devtree_dfs(root, devs_table); + devs_table = devtree_dfs(root, devs_table); return devs_table; } diff --git a/src/emu/machine.c b/src/emu/machine.c index 76855efad96..9ab3452e963 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -255,10 +255,10 @@ void running_machine::start() primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(running_machine::watchdog_vblank), this)); save().save_item(NAME(m_watchdog_enabled)); save().save_item(NAME(m_watchdog_counter)); - + // save the random seed or save states might be broken in drivers that use the rand() method save().save_item(NAME(m_rand_seed)); - + // initialize image devices image_init(*this); m_tilemap.reset(global_alloc(tilemap_manager(*this))); diff --git a/src/emu/machine/am9517a.c b/src/emu/machine/am9517a.c index 7e473f8b59d..2e20fd8a475 100644 --- a/src/emu/machine/am9517a.c +++ b/src/emu/machine/am9517a.c @@ -523,7 +523,7 @@ void am9517a_device::device_start() save_item(NAME(m_status)); save_item(NAME(m_temp)); save_item(NAME(m_request)); - + for (int i = 0; i < 4; i++) { save_item(NAME(m_channel[i].m_address), i); diff --git a/src/emu/machine/e05a30.c b/src/emu/machine/e05a30.c index 5e3de355336..804b46ccbe3 100644 --- a/src/emu/machine/e05a30.c +++ b/src/emu/machine/e05a30.c @@ -151,7 +151,6 @@ void e05a30_device::update_cr_stepper(UINT8 data) WRITE_LINE_MEMBER( e05a30_device::centronics_input_strobe ) { if (m_centronics_strobe == TRUE && state == FALSE && !m_centronics_busy) { - m_centronics_data_latch = m_centronics_data; m_centronics_data_latched = TRUE; diff --git a/src/emu/machine/i6300esb.c b/src/emu/machine/i6300esb.c index 04592dccf1b..7619cb3eda0 100644 --- a/src/emu/machine/i6300esb.c +++ b/src/emu/machine/i6300esb.c @@ -83,12 +83,12 @@ DEVICE_ADDRESS_MAP_START(internal_io_map, 32, i6300esb_lpc_device) AM_RANGE(0x00ec, 0x00ef) AM_WRITE8( nop_w, 0x0000ff00) // Non-existing, used for delays by the bios/os ADDRESS_MAP_END - + i6300esb_lpc_device::i6300esb_lpc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : pci_device(mconfig, I6300ESB_LPC, "i6300ESB southbridge ISA/LPC bridge", tag, owner, clock, "i6300esb_lpc", __FILE__), - acpi(*this, "acpi"), - rtc (*this, "rtc"), - pit (*this, "pit") + acpi(*this, "acpi"), + rtc (*this, "rtc"), + pit (*this, "pit") { } diff --git a/src/emu/machine/i82875p.h b/src/emu/machine/i82875p.h index bf8c8f841ba..2fa14253b66 100644 --- a/src/emu/machine/i82875p.h +++ b/src/emu/machine/i82875p.h @@ -107,7 +107,7 @@ class i82875p_overflow_device : public pci_device { public: i82875p_overflow_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - + DECLARE_READ8_MEMBER (dram_row_boundary_r); DECLARE_WRITE8_MEMBER (dram_row_boundary_w); DECLARE_READ8_MEMBER (dram_row_attribute_r); diff --git a/src/emu/machine/r10696.c b/src/emu/machine/r10696.c index 50191c0ede7..7dca19866f6 100644 --- a/src/emu/machine/r10696.c +++ b/src/emu/machine/r10696.c @@ -34,7 +34,7 @@ #include "emu.h" #include "machine/r10696.h" -#define VERBOSE 1 +#define VERBOSE 1 #if VERBOSE #define LOG(x) logerror x #else @@ -50,9 +50,9 @@ const device_type R10696 = &device_creator<r10696_device>; r10696_device::r10696_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, R10696, "Rockwell 10696", tag, owner, clock, "r10696", __FILE__), - m_io_a(0), m_io_b(0), m_io_c(0), - m_iord(*this), m_iowr(*this) + : device_t(mconfig, R10696, "Rockwell 10696", tag, owner, clock, "r10696", __FILE__), + m_io_a(0), m_io_b(0), m_io_c(0), + m_iord(*this), m_iowr(*this) { } @@ -61,12 +61,12 @@ r10696_device::r10696_device(const machine_config &mconfig, const char *tag, dev */ void r10696_device::device_start() { - m_iord.resolve(); - m_iowr.resolve(); + m_iord.resolve(); + m_iowr.resolve(); - save_item(NAME(m_io_a)); - save_item(NAME(m_io_b)); - save_item(NAME(m_io_c)); + save_item(NAME(m_io_a)); + save_item(NAME(m_io_b)); + save_item(NAME(m_io_c)); } /** @@ -87,101 +87,101 @@ void r10696_device::device_reset() WRITE8_MEMBER( r10696_device::io_w ) { - assert(offset < 16); - const UINT8 io_a = m_io_a; - const UINT8 io_b = m_io_b; - const UINT8 io_c = m_io_c; - switch (offset) - { - case 0x0A: // Read Group A - case 0x09: // Read Group B - case 0x03: // Read Group C - case 0x00: // Read Groups A | B | C - case 0x01: // Read Groups B | C - case 0x02: // Read Groups A | C - case 0x08: // Read Groups A | B - break; - - case 0x0E: // Set Group A - m_io_a = data & 0x0f; - break; - case 0x0D: // Set Group B - m_io_b = data & 0x0f; - break; - case 0x07: // Set Group C - m_io_c = data & 0x0f; - break; - case 0x04: // Set Groups A, B and C - m_io_a = m_io_b = m_io_c = data & 0x0f; - break; - case 0x05: // Set Groups B and C - m_io_b = m_io_c = data & 0x0f; - break; - case 0x06: // Set Groups A and C - m_io_a = m_io_c = data & 0x0f; - break; - case 0x0C: // Set Groups A and B - m_io_a = m_io_b = data & 0x0f; - break; - } - if (io_a != m_io_a) - m_iowr(0, m_io_a, 0x0f); - if (io_b != m_io_b) - m_iowr(1, m_io_b, 0x0f); - if (io_c != m_io_c) - m_iowr(2, m_io_c, 0x0f); + assert(offset < 16); + const UINT8 io_a = m_io_a; + const UINT8 io_b = m_io_b; + const UINT8 io_c = m_io_c; + switch (offset) + { + case 0x0A: // Read Group A + case 0x09: // Read Group B + case 0x03: // Read Group C + case 0x00: // Read Groups A | B | C + case 0x01: // Read Groups B | C + case 0x02: // Read Groups A | C + case 0x08: // Read Groups A | B + break; + + case 0x0E: // Set Group A + m_io_a = data & 0x0f; + break; + case 0x0D: // Set Group B + m_io_b = data & 0x0f; + break; + case 0x07: // Set Group C + m_io_c = data & 0x0f; + break; + case 0x04: // Set Groups A, B and C + m_io_a = m_io_b = m_io_c = data & 0x0f; + break; + case 0x05: // Set Groups B and C + m_io_b = m_io_c = data & 0x0f; + break; + case 0x06: // Set Groups A and C + m_io_a = m_io_c = data & 0x0f; + break; + case 0x0C: // Set Groups A and B + m_io_a = m_io_b = data & 0x0f; + break; + } + if (io_a != m_io_a) + m_iowr(0, m_io_a, 0x0f); + if (io_b != m_io_b) + m_iowr(1, m_io_b, 0x0f); + if (io_c != m_io_c) + m_iowr(2, m_io_c, 0x0f); } READ8_MEMBER( r10696_device::io_r ) { - assert(offset < 16); - UINT8 io_a, io_b, io_c; - UINT8 data = 0xf; - switch (offset) - { - case 0x0A: // Read Group A - io_a = m_iord(0); - data = io_a & 0x0f; - break; - case 0x09: // Read Group B - io_b = m_iord(1); - data = io_b & 0x0f; - break; - case 0x03: // Read Group C - io_c = m_iord(2); - data = io_c & 0x0f; - break; - case 0x00: // Read Groups A | B | C - io_a = m_iord(0); - io_b = m_iord(1); - io_c = m_iord(2); - data = (io_a | io_b | io_a) & 0x0f; - break; - case 0x01: // Read Groups B | C - io_b = m_iord(1); - io_c = m_iord(2); - data = (io_b | io_c) & 0x0f; - break; - case 0x02: // Read Groups A | C - io_a = m_iord(0); - io_c = m_iord(2); - data = (io_a | io_c) & 0x0f; - break; - case 0x08: // Read Groups A | B - io_a = m_iord(0); - io_b = m_iord(1); - data = (io_a | io_b) & 0x0f; - break; - - case 0x0E: // Set Group A - case 0x0D: // Set Group B - case 0x07: // Set Group C - case 0x04: // Set Groups A, B and C - case 0x05: // Set Groups B and C - case 0x06: // Set Groups A and C - case 0x0C: // Set Groups A and B - break; - } - return data; + assert(offset < 16); + UINT8 io_a, io_b, io_c; + UINT8 data = 0xf; + switch (offset) + { + case 0x0A: // Read Group A + io_a = m_iord(0); + data = io_a & 0x0f; + break; + case 0x09: // Read Group B + io_b = m_iord(1); + data = io_b & 0x0f; + break; + case 0x03: // Read Group C + io_c = m_iord(2); + data = io_c & 0x0f; + break; + case 0x00: // Read Groups A | B | C + io_a = m_iord(0); + io_b = m_iord(1); + io_c = m_iord(2); + data = (io_a | io_b | io_a) & 0x0f; + break; + case 0x01: // Read Groups B | C + io_b = m_iord(1); + io_c = m_iord(2); + data = (io_b | io_c) & 0x0f; + break; + case 0x02: // Read Groups A | C + io_a = m_iord(0); + io_c = m_iord(2); + data = (io_a | io_c) & 0x0f; + break; + case 0x08: // Read Groups A | B + io_a = m_iord(0); + io_b = m_iord(1); + data = (io_a | io_b) & 0x0f; + break; + + case 0x0E: // Set Group A + case 0x0D: // Set Group B + case 0x07: // Set Group C + case 0x04: // Set Groups A, B and C + case 0x05: // Set Groups B and C + case 0x06: // Set Groups A and C + case 0x0C: // Set Groups A and B + break; + } + return data; } diff --git a/src/emu/machine/r10696.h b/src/emu/machine/r10696.h index 996a7d43365..a151a4846dd 100644 --- a/src/emu/machine/r10696.h +++ b/src/emu/machine/r10696.h @@ -24,31 +24,31 @@ /* Set the read and write group (4-bit; nibble) delegates */ #define MCFG_R10696_IO(_devcb_rd,_devcb_wr) \ - r10696_device::set_iord(*device, DEVCB_##_devcb_rd); \ - r10696_device::set_iowr(*device, DEVCB_##_devcb_wr); + r10696_device::set_iord(*device, DEVCB_##_devcb_rd); \ + r10696_device::set_iowr(*device, DEVCB_##_devcb_wr); class r10696_device : public device_t { public: - r10696_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~r10696_device() {} + r10696_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~r10696_device() {} - DECLARE_READ8_MEMBER ( io_r ); - DECLARE_WRITE8_MEMBER( io_w ); + DECLARE_READ8_MEMBER ( io_r ); + DECLARE_WRITE8_MEMBER( io_w ); - template<class _Object> static devcb_base &set_iord(device_t &device, _Object object) { return downcast<r10696_device &>(device).m_iord.set_callback(object); } - template<class _Object> static devcb_base &set_iowr(device_t &device, _Object object) { return downcast<r10696_device &>(device).m_iowr.set_callback(object); } + template<class _Object> static devcb_base &set_iord(device_t &device, _Object object) { return downcast<r10696_device &>(device).m_iord.set_callback(object); } + template<class _Object> static devcb_base &set_iowr(device_t &device, _Object object) { return downcast<r10696_device &>(device).m_iowr.set_callback(object); } protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); + // device-level overrides + virtual void device_start(); + virtual void device_reset(); private: - UINT8 m_io_a; //!< input/output flip-flops group A - UINT8 m_io_b; //!< input/output flip-flops group B - UINT8 m_io_c; //!< input/output flip-flops group C - devcb_read8 m_iord; //!< input line (read, offset = group, data = 4 bits) - devcb_write8 m_iowr; //!< output line (write, offset = group, data = 4 bits) + UINT8 m_io_a; //!< input/output flip-flops group A + UINT8 m_io_b; //!< input/output flip-flops group B + UINT8 m_io_c; //!< input/output flip-flops group C + devcb_read8 m_iord; //!< input line (read, offset = group, data = 4 bits) + devcb_write8 m_iowr; //!< output line (write, offset = group, data = 4 bits) }; extern const device_type R10696; diff --git a/src/emu/machine/r10788.c b/src/emu/machine/r10788.c index 10f46ab621a..128314903fe 100644 --- a/src/emu/machine/r10788.c +++ b/src/emu/machine/r10788.c @@ -41,7 +41,7 @@ #include "emu.h" #include "machine/r10788.h" -#define VERBOSE 0 +#define VERBOSE 0 #if VERBOSE #define LOG(x) logerror x #else @@ -57,10 +57,10 @@ const device_type R10788 = &device_creator<r10788_device>; r10788_device::r10788_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, R10788, "Rockwell 10788", tag, owner, clock, "r10788", __FILE__), - m_ktr(0), m_kts(0), m_kla(0), m_klb(0), m_mask_a(15), m_mask_b(15), m_ker(0), - m_io_counter(0), m_scan_counter(0), - m_display(*this) + : device_t(mconfig, R10788, "Rockwell 10788", tag, owner, clock, "r10788", __FILE__), + m_ktr(0), m_kts(0), m_kla(0), m_klb(0), m_mask_a(15), m_mask_b(15), m_ker(0), + m_io_counter(0), m_scan_counter(0), + m_display(*this) { } @@ -69,22 +69,22 @@ r10788_device::r10788_device(const machine_config &mconfig, const char *tag, dev */ void r10788_device::device_start() { - m_display.resolve(); - - save_item(NAME(m_reg)); - save_item(NAME(m_ktr)); - save_item(NAME(m_kts)); - save_item(NAME(m_kla)); - save_item(NAME(m_klb)); - save_item(NAME(m_mask_a)); - save_item(NAME(m_mask_b)); - save_item(NAME(m_ker)); - save_item(NAME(m_io_counter)); - save_item(NAME(m_scan_counter)); - - m_timer = timer_alloc(TIMER_DISPLAY); - // recurring timer every 36 cycles - m_timer->adjust(clocks_to_attotime(36), 0, clocks_to_attotime(36)); + m_display.resolve(); + + save_item(NAME(m_reg)); + save_item(NAME(m_ktr)); + save_item(NAME(m_kts)); + save_item(NAME(m_kla)); + save_item(NAME(m_klb)); + save_item(NAME(m_mask_a)); + save_item(NAME(m_mask_b)); + save_item(NAME(m_ker)); + save_item(NAME(m_io_counter)); + save_item(NAME(m_scan_counter)); + + m_timer = timer_alloc(TIMER_DISPLAY); + // recurring timer every 36 cycles + m_timer->adjust(clocks_to_attotime(36), 0, clocks_to_attotime(36)); } /** @@ -93,14 +93,14 @@ void r10788_device::device_start() void r10788_device::device_reset() { memset(m_reg, 0x00, sizeof(m_reg)); - m_ktr = 0; - m_kts = 0; - m_kla = 0; - m_klb = 0; - m_mask_a = 15; - m_mask_b = 15; - m_ker = 0; - m_scan_counter = 0; + m_ktr = 0; + m_kts = 0; + m_kla = 0; + m_klb = 0; + m_mask_a = 15; + m_mask_b = 15; + m_ker = 0; + m_scan_counter = 0; } @@ -113,19 +113,19 @@ void r10788_device::device_reset() */ void r10788_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - UINT8 data; - switch (id) - { - case TIMER_DISPLAY: - data = (m_reg[0][m_scan_counter] & m_mask_a) + - 16 * (m_reg[1][m_scan_counter] & m_mask_b); - LOG(("%s: scan counter:%2d data:%02x\n", __FUNCTION__, m_scan_counter, data)); - m_display(m_scan_counter, data, 0xff); - break; - default: - LOG(("%s: invalid timer id:%d\n", __FUNCTION__, id)); - } - m_scan_counter = (m_scan_counter + 1) % 16; + UINT8 data; + switch (id) + { + case TIMER_DISPLAY: + data = (m_reg[0][m_scan_counter] & m_mask_a) + + 16 * (m_reg[1][m_scan_counter] & m_mask_b); + LOG(("%s: scan counter:%2d data:%02x\n", __FUNCTION__, m_scan_counter, data)); + m_display(m_scan_counter, data, 0xff); + break; + default: + LOG(("%s: invalid timer id:%d\n", __FUNCTION__, id)); + } + m_scan_counter = (m_scan_counter + 1) % 16; } /************************************* @@ -142,87 +142,87 @@ void r10788_device::device_timer(emu_timer &timer, device_timer_id id, int param WRITE8_MEMBER( r10788_device::io_w ) { - assert(offset < 16); - switch (offset) - { - case KTR: // Transfer Keyboard Return - LOG(("%s: KTR data:%02x\n", __FUNCTION__, data)); - m_ktr = data; - break; - case KTS: // Transfer Keyboard Strobe - LOG(("%s: KTS data:%02x\n", __FUNCTION__, data)); - m_kts = data; - break; - case KLA: // Load Display Register A - LOG(("%s: KLA [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data)); - m_kla = data; - m_reg[0][m_io_counter] = m_kla; - break; - case KLB: // Load Display Register B - LOG(("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data)); - m_klb = data; - m_reg[1][m_io_counter] = m_kla; - break; - case KDN: // Turn On Display - LOG(("%s: KDN data:%02x\n", __FUNCTION__, data)); - m_mask_a = 15; - m_mask_b = 15; - break; - case KAF: // Turn Off A - LOG(("%s: KAF data:%02x\n", __FUNCTION__, data)); - m_mask_a = 0; - m_mask_b &= ~3; - break; - case KBF: // Turn Off B - LOG(("%s: KBF data:%02x\n", __FUNCTION__, data)); - m_mask_b &= ~12; - break; - case KER: // Reset Keyboard Error - LOG(("%s: KER data:%02x\n", __FUNCTION__, data)); - m_ker = 10; - break; - } + assert(offset < 16); + switch (offset) + { + case KTR: // Transfer Keyboard Return + LOG(("%s: KTR data:%02x\n", __FUNCTION__, data)); + m_ktr = data; + break; + case KTS: // Transfer Keyboard Strobe + LOG(("%s: KTS data:%02x\n", __FUNCTION__, data)); + m_kts = data; + break; + case KLA: // Load Display Register A + LOG(("%s: KLA [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data)); + m_kla = data; + m_reg[0][m_io_counter] = m_kla; + break; + case KLB: // Load Display Register B + LOG(("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data)); + m_klb = data; + m_reg[1][m_io_counter] = m_kla; + break; + case KDN: // Turn On Display + LOG(("%s: KDN data:%02x\n", __FUNCTION__, data)); + m_mask_a = 15; + m_mask_b = 15; + break; + case KAF: // Turn Off A + LOG(("%s: KAF data:%02x\n", __FUNCTION__, data)); + m_mask_a = 0; + m_mask_b &= ~3; + break; + case KBF: // Turn Off B + LOG(("%s: KBF data:%02x\n", __FUNCTION__, data)); + m_mask_b &= ~12; + break; + case KER: // Reset Keyboard Error + LOG(("%s: KER data:%02x\n", __FUNCTION__, data)); + m_ker = 10; + break; + } } READ8_MEMBER( r10788_device::io_r ) { - assert(offset < 16); - UINT8 data = 0xf; - switch (offset) - { - case KTR: // Transfer Keyboard Return - data = m_ktr; - LOG(("%s: KTR data:%02x\n", __FUNCTION__, data)); - break; - case KTS: // Transfer Keyboard Strobe - data = m_kts; - LOG(("%s: KTS data:%02x\n", __FUNCTION__, data)); - break; - case KLA: // Load Display Register A - m_kla = m_reg[0][m_io_counter]; - data = m_kla; - LOG(("%s: KLA [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data)); - break; - case KLB: // Load Display Register B - m_klb = m_reg[1][m_io_counter]; - data = m_klb; - LOG(("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data)); - // FIXME: does it automagically increment at KLB write? - m_io_counter = (m_io_counter + 1) % 16; - break; - case KDN: // Turn On Display - LOG(("%s: KDN data:%02x\n", __FUNCTION__, data)); - break; - case KAF: // Turn Off A - LOG(("%s: KAF data:%02x\n", __FUNCTION__, data)); - break; - case KBF: // Turn Off B - LOG(("%s: KBF data:%02x\n", __FUNCTION__, data)); - break; - case KER: // Reset Keyboard Error - LOG(("%s: KER data:%02x\n", __FUNCTION__, data)); - break; - } - return data; + assert(offset < 16); + UINT8 data = 0xf; + switch (offset) + { + case KTR: // Transfer Keyboard Return + data = m_ktr; + LOG(("%s: KTR data:%02x\n", __FUNCTION__, data)); + break; + case KTS: // Transfer Keyboard Strobe + data = m_kts; + LOG(("%s: KTS data:%02x\n", __FUNCTION__, data)); + break; + case KLA: // Load Display Register A + m_kla = m_reg[0][m_io_counter]; + data = m_kla; + LOG(("%s: KLA [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data)); + break; + case KLB: // Load Display Register B + m_klb = m_reg[1][m_io_counter]; + data = m_klb; + LOG(("%s: KLB [%2d] data:%02x\n", __FUNCTION__, m_io_counter, data)); + // FIXME: does it automagically increment at KLB write? + m_io_counter = (m_io_counter + 1) % 16; + break; + case KDN: // Turn On Display + LOG(("%s: KDN data:%02x\n", __FUNCTION__, data)); + break; + case KAF: // Turn Off A + LOG(("%s: KAF data:%02x\n", __FUNCTION__, data)); + break; + case KBF: // Turn Off B + LOG(("%s: KBF data:%02x\n", __FUNCTION__, data)); + break; + case KER: // Reset Keyboard Error + LOG(("%s: KER data:%02x\n", __FUNCTION__, data)); + break; + } + return data; } diff --git a/src/emu/machine/r10788.h b/src/emu/machine/r10788.h index 51eb2577710..925e579f2c1 100644 --- a/src/emu/machine/r10788.h +++ b/src/emu/machine/r10788.h @@ -23,50 +23,50 @@ /* Set the writer used to update a display digit */ #define MCFG_R10788_UPDATE(_devcb) \ - r10788_device::set_update(*device, DEVCB_##_devcb); + r10788_device::set_update(*device, DEVCB_##_devcb); class r10788_device : public device_t { public: - r10788_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~r10788_device() {} - - enum { - KTR = 0xc, //!< Transfer Keyboard Return - KTS = 0xa, //!< Transfer Keyboard Strobe - KLA = 0xe, //!< Load Display Register A - KLB = 0xd, //!< Load Display Register B - KDN = 0x3, //!< Turn On Display - KAF = 0xb, //!< Turn Off A - KBF = 0x7, //!< Turn Off B - KER = 0x6 //!< Reset Keyboard Error - }; - - DECLARE_READ8_MEMBER ( io_r ); - DECLARE_WRITE8_MEMBER( io_w ); - - template<class _Object> static devcb_base &set_update(device_t &device, _Object object) { return downcast<r10788_device &>(device).m_display.set_callback(object); } + r10788_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~r10788_device() {} + + enum { + KTR = 0xc, //!< Transfer Keyboard Return + KTS = 0xa, //!< Transfer Keyboard Strobe + KLA = 0xe, //!< Load Display Register A + KLB = 0xd, //!< Load Display Register B + KDN = 0x3, //!< Turn On Display + KAF = 0xb, //!< Turn Off A + KBF = 0x7, //!< Turn Off B + KER = 0x6 //!< Reset Keyboard Error + }; + + DECLARE_READ8_MEMBER ( io_r ); + DECLARE_WRITE8_MEMBER( io_w ); + + template<class _Object> static devcb_base &set_update(device_t &device, _Object object) { return downcast<r10788_device &>(device).m_display.set_callback(object); } protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); private: - static const device_timer_id TIMER_DISPLAY = 0; - - UINT8 m_reg[2][16]; //!< display registers - UINT8 m_ktr; //!< transfer keyboard return value - UINT8 m_kts; //!< transfer keyboard strobe value - UINT8 m_kla; //!< display register A value - UINT8 m_klb; //!< display register B value - UINT8 m_mask_a; //!< display enable bits for A - UINT8 m_mask_b; //!< display enable bits for B - UINT8 m_ker; //!< keyboard error value - int m_io_counter; //!< current I/O register index - int m_scan_counter; //!< current display scan - devcb_write8 m_display; //!< display updater - emu_timer* m_timer; //!< timer running at clock / 18 / 36 + static const device_timer_id TIMER_DISPLAY = 0; + + UINT8 m_reg[2][16]; //!< display registers + UINT8 m_ktr; //!< transfer keyboard return value + UINT8 m_kts; //!< transfer keyboard strobe value + UINT8 m_kla; //!< display register A value + UINT8 m_klb; //!< display register B value + UINT8 m_mask_a; //!< display enable bits for A + UINT8 m_mask_b; //!< display enable bits for B + UINT8 m_ker; //!< keyboard error value + int m_io_counter; //!< current I/O register index + int m_scan_counter; //!< current display scan + devcb_write8 m_display; //!< display updater + emu_timer* m_timer; //!< timer running at clock / 18 / 36 }; extern const device_type R10788; diff --git a/src/emu/machine/ra17xx.c b/src/emu/machine/ra17xx.c index 0869016e562..2b143d0aa9c 100644 --- a/src/emu/machine/ra17xx.c +++ b/src/emu/machine/ra17xx.c @@ -40,7 +40,7 @@ #include "emu.h" #include "machine/ra17xx.h" -#define VERBOSE 1 +#define VERBOSE 1 #if VERBOSE #define LOG(x) logerror x #else @@ -56,10 +56,10 @@ const device_type RA17XX = &device_creator<ra17xx_device>; ra17xx_device::ra17xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, RA17XX, "Rockwell A17XX", tag, owner, clock, "ra17xx", __FILE__), - m_enable(false), - m_iord(*this), - m_iowr(*this) + : device_t(mconfig, RA17XX, "Rockwell A17XX", tag, owner, clock, "ra17xx", __FILE__), + m_enable(false), + m_iord(*this), + m_iowr(*this) { } @@ -68,10 +68,10 @@ ra17xx_device::ra17xx_device(const machine_config &mconfig, const char *tag, dev */ void ra17xx_device::device_start() { - m_iord.resolve(); - m_iowr.resolve(); + m_iord.resolve(); + m_iowr.resolve(); - save_item(NAME(m_line)); + save_item(NAME(m_line)); } /** @@ -79,7 +79,7 @@ void ra17xx_device::device_start() */ void ra17xx_device::device_reset() { - memset(m_line, 0, sizeof(m_line)); + memset(m_line, 0, sizeof(m_line)); } @@ -97,36 +97,36 @@ void ra17xx_device::device_reset() WRITE8_MEMBER( ra17xx_device::io_w ) { - assert(offset < 16); - m_bl = (data >> 4) & 15; // BL on the data bus most significant bits - if (offset & 1) { - // SOS command - if (data & (1 << 3)) { - m_line[m_bl] = 1; // enable output + assert(offset < 16); + m_bl = (data >> 4) & 15; // BL on the data bus most significant bits + if (offset & 1) { + // SOS command + if (data & (1 << 3)) { + m_line[m_bl] = 1; // enable output // if (m_enable) - m_iowr(m_bl, 1, 1); - } else { - m_line[m_bl] = 0; // disable output + m_iowr(m_bl, 1, 1); + } else { + m_line[m_bl] = 0; // disable output // if (m_enable) - m_iowr(m_bl, 0, 1); - } - } else { - // SES command - if (data & (1 << 3)) { - // enable all outputs - m_enable = true; - for (int i = 0; i < 16; i++) - m_iowr(i, m_line[i], 1); - } else { - // disable all outputs - m_enable = false; - } - } + m_iowr(m_bl, 0, 1); + } + } else { + // SES command + if (data & (1 << 3)) { + // enable all outputs + m_enable = true; + for (int i = 0; i < 16; i++) + m_iowr(i, m_line[i], 1); + } else { + // disable all outputs + m_enable = false; + } + } } READ8_MEMBER( ra17xx_device::io_r ) { - assert(offset < 16); - return (m_iord(m_bl) & 1) ? 0x0f : 0x07; + assert(offset < 16); + return (m_iord(m_bl) & 1) ? 0x0f : 0x07; } diff --git a/src/emu/machine/ra17xx.h b/src/emu/machine/ra17xx.h index 4833f5cb7c5..f771ca77590 100644 --- a/src/emu/machine/ra17xx.h +++ b/src/emu/machine/ra17xx.h @@ -23,34 +23,32 @@ /* Set the read line handler */ #define MCFG_RA17XX_READ(_devcb) \ - ra17xx_device::set_iord(*device, DEVCB_##_devcb); \ - + ra17xx_device::set_iord(*device, DEVCB_##_devcb); /* Set the write line handler */ #define MCFG_RA17XX_WRITE(_devcb) \ - ra17xx_device::set_iowr(*device, DEVCB_##_devcb); \ - + ra17xx_device::set_iowr(*device, DEVCB_##_devcb); class ra17xx_device : public device_t { public: - ra17xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~ra17xx_device() {} + ra17xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + ~ra17xx_device() {} - DECLARE_READ8_MEMBER ( io_r ); - DECLARE_WRITE8_MEMBER( io_w ); + DECLARE_READ8_MEMBER ( io_r ); + DECLARE_WRITE8_MEMBER( io_w ); - template<class _Object> static devcb_base &set_iord(device_t &device, _Object object) { return downcast<ra17xx_device &>(device).m_iord.set_callback(object); } - template<class _Object> static devcb_base &set_iowr(device_t &device, _Object object) { return downcast<ra17xx_device &>(device).m_iowr.set_callback(object); } + template<class _Object> static devcb_base &set_iord(device_t &device, _Object object) { return downcast<ra17xx_device &>(device).m_iord.set_callback(object); } + template<class _Object> static devcb_base &set_iowr(device_t &device, _Object object) { return downcast<ra17xx_device &>(device).m_iowr.set_callback(object); } protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); + // device-level overrides + virtual void device_start(); + virtual void device_reset(); private: - UINT8 m_line[16]; //!< input/output flip-flops for 16 I/O lines - UINT8 m_bl; //!< value of BL during the most recent output - bool m_enable; //!< true if outputs are enabled - devcb_read8 m_iord; //!< input line (read, offset = line, data = 0/1) - devcb_write8 m_iowr; //!< output line (write, offset = line, data = 0/1) + UINT8 m_line[16]; //!< input/output flip-flops for 16 I/O lines + UINT8 m_bl; //!< value of BL during the most recent output + bool m_enable; //!< true if outputs are enabled + devcb_read8 m_iord; //!< input line (read, offset = line, data = 0/1) + devcb_write8 m_iowr; //!< output line (write, offset = line, data = 0/1) }; extern const device_type RA17XX; diff --git a/src/emu/machine/smpc.c b/src/emu/machine/smpc.c index 93ffa7a0533..955a409b308 100644 --- a/src/emu/machine/smpc.c +++ b/src/emu/machine/smpc.c @@ -393,7 +393,7 @@ void saturn_state::smpc_analog_pad( UINT8 pad_num, UINT8 offset, UINT8 id) void saturn_state::smpc_keyboard(UINT8 pad_num, UINT8 offset) { UINT16 game_key; - + game_key = 0xffff; game_key ^= ((ioport("KEYS_1")->read() & 0x80) << 8); // right @@ -415,8 +415,8 @@ void saturn_state::smpc_keyboard(UINT8 pad_num, UINT8 offset) m_smpc.OREG[2+pad_num*offset] = game_key>>8; // game buttons, TODO m_smpc.OREG[3+pad_num*offset] = game_key & 0xff; /* - Keyboard Status hook-up - TODO: how shift key actually works? EGWord uses it in order to switch between hiragana and katakana modes. + Keyboard Status hook-up + TODO: how shift key actually works? EGWord uses it in order to switch between hiragana and katakana modes. x--- ---- 0 -x-- ---- caps lock --x- ---- num lock diff --git a/src/emu/machine/steppers.c b/src/emu/machine/steppers.c index 5494caf2f3e..4bf3f80ba6e 100644 --- a/src/emu/machine/steppers.c +++ b/src/emu/machine/steppers.c @@ -46,7 +46,7 @@ stepper_device::stepper_device(const machine_config &mconfig, const char *tag, d m_optic_cb(*this) { m_max_steps=(48*2); - } + } /////////////////////////////////////////////////////////////////////////// void stepper_device::update_optic() diff --git a/src/emu/machine/steppers.h b/src/emu/machine/steppers.h index 4d1b49adfd4..6e7fd90c5a6 100644 --- a/src/emu/machine/steppers.h +++ b/src/emu/machine/steppers.h @@ -31,29 +31,29 @@ #define MCFG_STEPPER_ADD(_tag)\ MCFG_DEVICE_ADD(_tag, STEPPER, 0) - + #define MCFG_STEPPER_REEL_TYPE(_data) \ stepper_device::set_reel_type(*device, _data); /* total size of reel (in half steps) */ #define MCFG_STEPPER_MAX_STEPS(_write) \ - stepper_device::set_max_steps(*device, _write); - + stepper_device::set_max_steps(*device, _write); + /* start position of index (in half steps) */ #define MCFG_STEPPER_START_INDEX(_write) \ - stepper_device::set_start_index(*device, _write); + stepper_device::set_start_index(*device, _write); -/* end position of index (in half steps) */ +/* end position of index (in half steps) */ #define MCFG_STEPPER_END_INDEX(_write) \ - stepper_device::set_end_index(*device, _write); + stepper_device::set_end_index(*device, _write); -/* end position of index (in half steps) */ +/* end position of index (in half steps) */ #define MCFG_STEPPER_INDEX_PATTERN(_write) \ - stepper_device::set_index_pattern(*device, _write); - + stepper_device::set_index_pattern(*device, _write); + /* Phase at 0, for opto linkage */ #define MCFG_STEPPER_INIT_PHASE(_write) \ - stepper_device::set_init_phase(*device, _write); + stepper_device::set_init_phase(*device, _write); #define MCFG_STARPOINT_48STEP_ADD(_tag)\ MCFG_STEPPER_ADD(_tag)\ @@ -103,9 +103,9 @@ public: template<class _Object> static devcb_base &set_optic_handler(device_t &device, _Object object) { return downcast<stepper_device &>(device).m_optic_cb.set_callback(object); } - static void set_reel_type(device_t &device, UINT8 type) - { - downcast<stepper_device &>(device).m_type = type; + static void set_reel_type(device_t &device, UINT8 type) + { + downcast<stepper_device &>(device).m_type = type; switch ( type ) { default: case STARPOINT_48STEP_REEL: /* STARPOINT RMxxx */ @@ -127,17 +127,17 @@ public: case ECOIN_200STEP_REEL : downcast<stepper_device &>(device).m_max_steps = (200*2); break; - } + } } static void set_max_steps(device_t &device, INT16 steps) { downcast<stepper_device &>(device).m_max_steps = steps; } static void set_start_index(device_t &device, INT16 index) { downcast<stepper_device &>(device).m_index_start = index; } - static void set_end_index(device_t &device, INT16 index) { downcast<stepper_device &>(device).m_index_end = index; } - static void set_index_pattern(device_t &device, INT16 index) { downcast<stepper_device &>(device).m_index_patt = index; } - static void set_init_phase(device_t &device, UINT8 phase) + static void set_end_index(device_t &device, INT16 index) { downcast<stepper_device &>(device).m_index_end = index; } + static void set_index_pattern(device_t &device, INT16 index) { downcast<stepper_device &>(device).m_index_patt = index; } + static void set_init_phase(device_t &device, UINT8 phase) { - downcast<stepper_device &>(device).m_initphase = phase; - downcast<stepper_device &>(device).m_phase = phase; - downcast<stepper_device &>(device).m_old_phase = phase; + downcast<stepper_device &>(device).m_initphase = phase; + downcast<stepper_device &>(device).m_phase = phase; + downcast<stepper_device &>(device).m_old_phase = phase; } /* update a motor */ diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index a011a527445..72e8838f7f3 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -94,9 +94,9 @@ const int LAYOUT_VERSION = 2; enum { - LINE_CAP_NONE = 0, - LINE_CAP_START = 1, - LINE_CAP_END = 2 + LINE_CAP_NONE = 0, + LINE_CAP_START = 1, + LINE_CAP_END = 2 }; @@ -120,13 +120,13 @@ render_screen_list render_target::s_empty_screen_list; inline int gcd(int a, int b) { - while (b != 0) - { - int t = b; - b = a % b; - a = t; - } - return a; + while (b != 0) + { + int t = b; + b = a % b; + a = t; + } + return a; } @@ -137,15 +137,15 @@ inline int gcd(int a, int b) inline void reduce_fraction(int &num, int &den) { - // search the greatest common divisor - int div = gcd(num, den); - - // reduce the fraction if a common divisor has been found - if (div > 1) - { - num /= div; - den /= div; - } + // search the greatest common divisor + int div = gcd(num, den); + + // reduce the fraction if a common divisor has been found + if (div > 1) + { + num /= div; + den /= div; + } } @@ -161,56 +161,56 @@ inline void reduce_fraction(int &num, int &den) static int get_variable_value(running_machine &machine, const char *string, char **outputptr) { - char temp[100]; - - // screen 0 parameters - screen_device_iterator iter(machine.root_device()); - int scrnum = 0; - for (const screen_device *device = iter.first(); device != NULL; device = iter.next(), scrnum++) - { - // native X aspect factor - sprintf(temp, "~scr%dnativexaspect~", scrnum); - if (!strncmp(string, temp, strlen(temp))) - { - int num = device->visible_area().width(); - int den = device->visible_area().height(); - reduce_fraction(num, den); - *outputptr += sprintf(*outputptr, "%d", num); - return strlen(temp); - } - - // native Y aspect factor - sprintf(temp, "~scr%dnativeyaspect~", scrnum); - if (!strncmp(string, temp, strlen(temp))) - { - int num = device->visible_area().width(); - int den = device->visible_area().height(); - reduce_fraction(num, den); - *outputptr += sprintf(*outputptr, "%d", den); - return strlen(temp); - } - - // native width - sprintf(temp, "~scr%dwidth~", scrnum); - if (!strncmp(string, temp, strlen(temp))) - { - *outputptr += sprintf(*outputptr, "%d", device->visible_area().width()); - return strlen(temp); - } - - // native height - sprintf(temp, "~scr%dheight~", scrnum); - if (!strncmp(string, temp, strlen(temp))) - { - *outputptr += sprintf(*outputptr, "%d", device->visible_area().height()); - return strlen(temp); - } - } - - // default: copy the first character and continue - **outputptr = *string; - *outputptr += 1; - return 1; + char temp[100]; + + // screen 0 parameters + screen_device_iterator iter(machine.root_device()); + int scrnum = 0; + for (const screen_device *device = iter.first(); device != NULL; device = iter.next(), scrnum++) + { + // native X aspect factor + sprintf(temp, "~scr%dnativexaspect~", scrnum); + if (!strncmp(string, temp, strlen(temp))) + { + int num = device->visible_area().width(); + int den = device->visible_area().height(); + reduce_fraction(num, den); + *outputptr += sprintf(*outputptr, "%d", num); + return strlen(temp); + } + + // native Y aspect factor + sprintf(temp, "~scr%dnativeyaspect~", scrnum); + if (!strncmp(string, temp, strlen(temp))) + { + int num = device->visible_area().width(); + int den = device->visible_area().height(); + reduce_fraction(num, den); + *outputptr += sprintf(*outputptr, "%d", den); + return strlen(temp); + } + + // native width + sprintf(temp, "~scr%dwidth~", scrnum); + if (!strncmp(string, temp, strlen(temp))) + { + *outputptr += sprintf(*outputptr, "%d", device->visible_area().width()); + return strlen(temp); + } + + // native height + sprintf(temp, "~scr%dheight~", scrnum); + if (!strncmp(string, temp, strlen(temp))) + { + *outputptr += sprintf(*outputptr, "%d", device->visible_area().height()); + return strlen(temp); + } + } + + // default: copy the first character and continue + **outputptr = *string; + *outputptr += 1; + return 1; } @@ -222,32 +222,32 @@ static int get_variable_value(running_machine &machine, const char *string, char static const char *xml_get_attribute_string_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, const char *defvalue) { - const char *str = xml_get_attribute_string(&node, attribute, NULL); - static char buffer[1000]; - - // if nothing, just return the default - if (str == NULL) - return defvalue; - - // if no tildes, don't worry - if (strchr(str, '~') == NULL) - return str; - - // make a copy of the string, doing substitutions along the way - const char *s; - char *d; - for (s = str, d = buffer; *s != 0; ) - { - // if not a variable, just copy - if (*s != '~') - *d++ = *s++; - - // extract the variable - else - s += get_variable_value(machine, s, &d); - } - *d = 0; - return buffer; + const char *str = xml_get_attribute_string(&node, attribute, NULL); + static char buffer[1000]; + + // if nothing, just return the default + if (str == NULL) + return defvalue; + + // if no tildes, don't worry + if (strchr(str, '~') == NULL) + return str; + + // make a copy of the string, doing substitutions along the way + const char *s; + char *d; + for (s = str, d = buffer; *s != 0; ) + { + // if not a variable, just copy + if (*s != '~') + *d++ = *s++; + + // extract the variable + else + s += get_variable_value(machine, s, &d); + } + *d = 0; + return buffer; } @@ -259,18 +259,18 @@ static const char *xml_get_attribute_string_with_subst(running_machine &machine, static int xml_get_attribute_int_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, int defvalue) { - const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL); - int value; - - if (string == NULL) - return defvalue; - if (string[0] == '$') - return (sscanf(&string[1], "%X", &value) == 1) ? value : defvalue; - if (string[0] == '0' && string[1] == 'x') - return (sscanf(&string[2], "%X", &value) == 1) ? value : defvalue; - if (string[0] == '#') - return (sscanf(&string[1], "%d", &value) == 1) ? value : defvalue; - return (sscanf(&string[0], "%d", &value) == 1) ? value : defvalue; + const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL); + int value; + + if (string == NULL) + return defvalue; + if (string[0] == '$') + return (sscanf(&string[1], "%X", &value) == 1) ? value : defvalue; + if (string[0] == '0' && string[1] == 'x') + return (sscanf(&string[2], "%X", &value) == 1) ? value : defvalue; + if (string[0] == '#') + return (sscanf(&string[1], "%d", &value) == 1) ? value : defvalue; + return (sscanf(&string[0], "%d", &value) == 1) ? value : defvalue; } @@ -282,12 +282,12 @@ static int xml_get_attribute_int_with_subst(running_machine &machine, xml_data_n static float xml_get_attribute_float_with_subst(running_machine &machine, xml_data_node &node, const char *attribute, float defvalue) { - const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL); - float value; + const char *string = xml_get_attribute_string_with_subst(machine, node, attribute, NULL); + float value; - if (string == NULL || sscanf(string, "%f", &value) != 1) - return defvalue; - return value; + if (string == NULL || sscanf(string, "%f", &value) != 1) + return defvalue; + return value; } @@ -297,37 +297,37 @@ static float xml_get_attribute_float_with_subst(running_machine &machine, xml_da void parse_bounds(running_machine &machine, xml_data_node *boundsnode, render_bounds &bounds) { - // skip if nothing - if (boundsnode == NULL) - { - bounds.x0 = bounds.y0 = 0.0f; - bounds.x1 = bounds.y1 = 1.0f; - return; - } - - // parse out the data - if (xml_get_attribute(boundsnode, "left") != NULL) - { - // left/right/top/bottom format - bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "left", 0.0f); - bounds.x1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "right", 1.0f); - bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "top", 0.0f); - bounds.y1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "bottom", 1.0f); - } - else if (xml_get_attribute(boundsnode, "x") != NULL) - { - // x/y/width/height format - bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "x", 0.0f); - bounds.x1 = bounds.x0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "width", 1.0f); - bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "y", 0.0f); - bounds.y1 = bounds.y0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "height", 1.0f); - } - else - throw emu_fatalerror("Illegal bounds value in XML"); - - // check for errors - if (bounds.x0 > bounds.x1 || bounds.y0 > bounds.y1) - throw emu_fatalerror("Illegal bounds value in XML: (%f-%f)-(%f-%f)", bounds.x0, bounds.x1, bounds.y0, bounds.y1); + // skip if nothing + if (boundsnode == NULL) + { + bounds.x0 = bounds.y0 = 0.0f; + bounds.x1 = bounds.y1 = 1.0f; + return; + } + + // parse out the data + if (xml_get_attribute(boundsnode, "left") != NULL) + { + // left/right/top/bottom format + bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "left", 0.0f); + bounds.x1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "right", 1.0f); + bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "top", 0.0f); + bounds.y1 = xml_get_attribute_float_with_subst(machine, *boundsnode, "bottom", 1.0f); + } + else if (xml_get_attribute(boundsnode, "x") != NULL) + { + // x/y/width/height format + bounds.x0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "x", 0.0f); + bounds.x1 = bounds.x0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "width", 1.0f); + bounds.y0 = xml_get_attribute_float_with_subst(machine, *boundsnode, "y", 0.0f); + bounds.y1 = bounds.y0 + xml_get_attribute_float_with_subst(machine, *boundsnode, "height", 1.0f); + } + else + throw emu_fatalerror("Illegal bounds value in XML"); + + // check for errors + if (bounds.x0 > bounds.x1 || bounds.y0 > bounds.y1) + throw emu_fatalerror("Illegal bounds value in XML: (%f-%f)-(%f-%f)", bounds.x0, bounds.x1, bounds.y0, bounds.y1); } @@ -337,23 +337,23 @@ void parse_bounds(running_machine &machine, xml_data_node *boundsnode, render_bo void parse_color(running_machine &machine, xml_data_node *colornode, render_color &color) { - // skip if nothing - if (colornode == NULL) - { - color.r = color.g = color.b = color.a = 1.0f; - return; - } - - // parse out the data - color.r = xml_get_attribute_float_with_subst(machine, *colornode, "red", 1.0); - color.g = xml_get_attribute_float_with_subst(machine, *colornode, "green", 1.0); - color.b = xml_get_attribute_float_with_subst(machine, *colornode, "blue", 1.0); - color.a = xml_get_attribute_float_with_subst(machine, *colornode, "alpha", 1.0); - - // check for errors - if (color.r < 0.0 || color.r > 1.0 || color.g < 0.0 || color.g > 1.0 || - color.b < 0.0 || color.b > 1.0 || color.a < 0.0 || color.a > 1.0) - throw emu_fatalerror("Illegal ARGB color value in XML: %f,%f,%f,%f", color.r, color.g, color.b, color.a); + // skip if nothing + if (colornode == NULL) + { + color.r = color.g = color.b = color.a = 1.0f; + return; + } + + // parse out the data + color.r = xml_get_attribute_float_with_subst(machine, *colornode, "red", 1.0); + color.g = xml_get_attribute_float_with_subst(machine, *colornode, "green", 1.0); + color.b = xml_get_attribute_float_with_subst(machine, *colornode, "blue", 1.0); + color.a = xml_get_attribute_float_with_subst(machine, *colornode, "alpha", 1.0); + + // check for errors + if (color.r < 0.0 || color.r > 1.0 || color.g < 0.0 || color.g > 1.0 || + color.b < 0.0 || color.b > 1.0 || color.a < 0.0 || color.a > 1.0) + throw emu_fatalerror("Illegal ARGB color value in XML: %f,%f,%f,%f", color.r, color.g, color.b, color.a); } @@ -364,29 +364,29 @@ void parse_color(running_machine &machine, xml_data_node *colornode, render_colo static void parse_orientation(running_machine &machine, xml_data_node *orientnode, int &orientation) { - // skip if nothing - if (orientnode == NULL) - { - orientation = ROT0; - return; - } - - // parse out the data - int rotate = xml_get_attribute_int_with_subst(machine, *orientnode, "rotate", 0); - switch (rotate) - { - case 0: orientation = ROT0; break; - case 90: orientation = ROT90; break; - case 180: orientation = ROT180; break; - case 270: orientation = ROT270; break; - default: throw emu_fatalerror("Invalid rotation in XML orientation node: %d", rotate); - } - if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "swapxy", "no")) == 0) - orientation ^= ORIENTATION_SWAP_XY; - if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipx", "no")) == 0) - orientation ^= ORIENTATION_FLIP_X; - if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipy", "no")) == 0) - orientation ^= ORIENTATION_FLIP_Y; + // skip if nothing + if (orientnode == NULL) + { + orientation = ROT0; + return; + } + + // parse out the data + int rotate = xml_get_attribute_int_with_subst(machine, *orientnode, "rotate", 0); + switch (rotate) + { + case 0: orientation = ROT0; break; + case 90: orientation = ROT90; break; + case 180: orientation = ROT180; break; + case 270: orientation = ROT270; break; + default: throw emu_fatalerror("Invalid rotation in XML orientation node: %d", rotate); + } + if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "swapxy", "no")) == 0) + orientation ^= ORIENTATION_SWAP_XY; + if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipx", "no")) == 0) + orientation ^= ORIENTATION_FLIP_X; + if (strcmp("yes", xml_get_attribute_string_with_subst(machine, *orientnode, "flipy", "no")) == 0) + orientation ^= ORIENTATION_FLIP_Y; } @@ -400,78 +400,78 @@ static void parse_orientation(running_machine &machine, xml_data_node *orientnod //------------------------------------------------- layout_element::layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname) - : m_next(NULL), - m_machine(machine), - m_defstate(0), - m_maxstate(0) + : m_next(NULL), + m_machine(machine), + m_defstate(0), + m_maxstate(0) { - // extract the name - const char *name = xml_get_attribute_string_with_subst(machine, elemnode, "name", NULL); - if (name == NULL) - throw emu_fatalerror("All layout elements must have a name!\n"); - m_name = name; - - // get the default state - m_defstate = xml_get_attribute_int_with_subst(machine, elemnode, "defstate", -1); - - // parse components in order - bool first = true; - render_bounds bounds = { 0 }; - for (xml_data_node *compnode = elemnode.child; compnode != NULL; compnode = compnode->next) - { - // allocate a new component - component &newcomp = m_complist.append(*global_alloc(component(machine, *compnode, dirname))); - - // accumulate bounds - if (first) - bounds = newcomp.m_bounds; - else - union_render_bounds(&bounds, &newcomp.m_bounds); - first = false; - - // determine the maximum state - if (newcomp.m_state > m_maxstate) - m_maxstate = newcomp.m_state; - if (newcomp.m_type == component::CTYPE_LED7SEG || newcomp.m_type == component::CTYPE_LED8SEG_GTS1) - m_maxstate = 255; - if (newcomp.m_type == component::CTYPE_LED14SEG) - m_maxstate = 16383; - if (newcomp.m_type == component::CTYPE_LED14SEGSC || newcomp.m_type == component::CTYPE_LED16SEG) - m_maxstate = 65535; - if (newcomp.m_type == component::CTYPE_LED16SEGSC) - m_maxstate = 262143; - if (newcomp.m_type == component::CTYPE_DOTMATRIX) - m_maxstate = 255; - if (newcomp.m_type == component::CTYPE_DOTMATRIX5DOT) - m_maxstate = 31; - if (newcomp.m_type == component::CTYPE_DOTMATRIXDOT) - m_maxstate = 1; - if (newcomp.m_type == component::CTYPE_SIMPLECOUNTER) - m_maxstate = xml_get_attribute_int_with_subst(machine, *compnode, "maxstate", 999); - if (newcomp.m_type == component::CTYPE_REEL) - m_maxstate = 65536; - } - - if (m_complist.first() != NULL) - { - // determine the scale/offset for normalization - float xoffs = bounds.x0; - float yoffs = bounds.y0; - float xscale = 1.0f / (bounds.x1 - bounds.x0); - float yscale = 1.0f / (bounds.y1 - bounds.y0); - - // normalize all the component bounds - for (component *curcomp = m_complist.first(); curcomp != NULL; curcomp = curcomp->next()) - { - curcomp->m_bounds.x0 = (curcomp->m_bounds.x0 - xoffs) * xscale; - curcomp->m_bounds.x1 = (curcomp->m_bounds.x1 - xoffs) * xscale; - curcomp->m_bounds.y0 = (curcomp->m_bounds.y0 - yoffs) * yscale; - curcomp->m_bounds.y1 = (curcomp->m_bounds.y1 - yoffs) * yscale; - } - } - - // allocate an array of element textures for the states - m_elemtex.resize(m_maxstate + 1); + // extract the name + const char *name = xml_get_attribute_string_with_subst(machine, elemnode, "name", NULL); + if (name == NULL) + throw emu_fatalerror("All layout elements must have a name!\n"); + m_name = name; + + // get the default state + m_defstate = xml_get_attribute_int_with_subst(machine, elemnode, "defstate", -1); + + // parse components in order + bool first = true; + render_bounds bounds = { 0 }; + for (xml_data_node *compnode = elemnode.child; compnode != NULL; compnode = compnode->next) + { + // allocate a new component + component &newcomp = m_complist.append(*global_alloc(component(machine, *compnode, dirname))); + + // accumulate bounds + if (first) + bounds = newcomp.m_bounds; + else + union_render_bounds(&bounds, &newcomp.m_bounds); + first = false; + + // determine the maximum state + if (newcomp.m_state > m_maxstate) + m_maxstate = newcomp.m_state; + if (newcomp.m_type == component::CTYPE_LED7SEG || newcomp.m_type == component::CTYPE_LED8SEG_GTS1) + m_maxstate = 255; + if (newcomp.m_type == component::CTYPE_LED14SEG) + m_maxstate = 16383; + if (newcomp.m_type == component::CTYPE_LED14SEGSC || newcomp.m_type == component::CTYPE_LED16SEG) + m_maxstate = 65535; + if (newcomp.m_type == component::CTYPE_LED16SEGSC) + m_maxstate = 262143; + if (newcomp.m_type == component::CTYPE_DOTMATRIX) + m_maxstate = 255; + if (newcomp.m_type == component::CTYPE_DOTMATRIX5DOT) + m_maxstate = 31; + if (newcomp.m_type == component::CTYPE_DOTMATRIXDOT) + m_maxstate = 1; + if (newcomp.m_type == component::CTYPE_SIMPLECOUNTER) + m_maxstate = xml_get_attribute_int_with_subst(machine, *compnode, "maxstate", 999); + if (newcomp.m_type == component::CTYPE_REEL) + m_maxstate = 65536; + } + + if (m_complist.first() != NULL) + { + // determine the scale/offset for normalization + float xoffs = bounds.x0; + float yoffs = bounds.y0; + float xscale = 1.0f / (bounds.x1 - bounds.x0); + float yscale = 1.0f / (bounds.y1 - bounds.y0); + + // normalize all the component bounds + for (component *curcomp = m_complist.first(); curcomp != NULL; curcomp = curcomp->next()) + { + curcomp->m_bounds.x0 = (curcomp->m_bounds.x0 - xoffs) * xscale; + curcomp->m_bounds.x1 = (curcomp->m_bounds.x1 - xoffs) * xscale; + curcomp->m_bounds.y0 = (curcomp->m_bounds.y0 - yoffs) * yscale; + curcomp->m_bounds.y1 = (curcomp->m_bounds.y1 - yoffs) * yscale; + } + } + + // allocate an array of element textures for the states + m_elemtex.resize(m_maxstate + 1); } @@ -492,14 +492,14 @@ layout_element::~layout_element() render_texture *layout_element::state_texture(int state) { - assert(state <= m_maxstate); - if (m_elemtex[state].m_texture == NULL) - { - m_elemtex[state].m_element = this; - m_elemtex[state].m_state = state; - m_elemtex[state].m_texture = machine().render().texture_alloc(element_scale, &m_elemtex[state]); - } - return m_elemtex[state].m_texture; + assert(state <= m_maxstate); + if (m_elemtex[state].m_texture == NULL) + { + m_elemtex[state].m_element = this; + m_elemtex[state].m_state = state; + m_elemtex[state].m_texture = machine().render().texture_alloc(element_scale, &m_elemtex[state]); + } + return m_elemtex[state].m_texture; } @@ -511,23 +511,23 @@ render_texture *layout_element::state_texture(int state) void layout_element::element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param) { - texture *elemtex = (texture *)param; - - // iterate over components that are part of the current state - for (component *curcomp = elemtex->m_element->m_complist.first(); curcomp != NULL; curcomp = curcomp->next()) - if (curcomp->m_state == -1 || curcomp->m_state == elemtex->m_state) - { - // get the local scaled bounds - rectangle bounds; - bounds.min_x = render_round_nearest(curcomp->bounds().x0 * dest.width()); - bounds.min_y = render_round_nearest(curcomp->bounds().y0 * dest.height()); - bounds.max_x = render_round_nearest(curcomp->bounds().x1 * dest.width()); - bounds.max_y = render_round_nearest(curcomp->bounds().y1 * dest.height()); - bounds &= dest.cliprect(); - - // based on the component type, add to the texture - curcomp->draw(elemtex->m_element->machine(), dest, bounds, elemtex->m_state); - } + texture *elemtex = (texture *)param; + + // iterate over components that are part of the current state + for (component *curcomp = elemtex->m_element->m_complist.first(); curcomp != NULL; curcomp = curcomp->next()) + if (curcomp->m_state == -1 || curcomp->m_state == elemtex->m_state) + { + // get the local scaled bounds + rectangle bounds; + bounds.min_x = render_round_nearest(curcomp->bounds().x0 * dest.width()); + bounds.min_y = render_round_nearest(curcomp->bounds().y0 * dest.height()); + bounds.max_x = render_round_nearest(curcomp->bounds().x1 * dest.width()); + bounds.max_y = render_round_nearest(curcomp->bounds().y1 * dest.height()); + bounds &= dest.cliprect(); + + // based on the component type, add to the texture + curcomp->draw(elemtex->m_element->machine(), dest, bounds, elemtex->m_state); + } } @@ -540,9 +540,9 @@ void layout_element::element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, c //------------------------------------------------- layout_element::texture::texture() - : m_element(NULL), - m_texture(NULL), - m_state(0) + : m_element(NULL), + m_texture(NULL), + m_state(0) { } @@ -553,8 +553,8 @@ layout_element::texture::texture() layout_element::texture::~texture() { - if (m_element != NULL) - m_element->machine().render().texture_free(m_texture); + if (m_element != NULL) + m_element->machine().render().texture_free(m_texture); } @@ -568,146 +568,146 @@ layout_element::texture::~texture() //------------------------------------------------- layout_element::component::component(running_machine &machine, xml_data_node &compnode, const char *dirname) - : m_next(NULL), - m_type(CTYPE_INVALID), - m_state(0) + : m_next(NULL), + m_type(CTYPE_INVALID), + m_state(0) { - for (int i=0;i<MAX_BITMAPS;i++) - m_hasalpha[i] = false; - - // fetch common data - m_state = xml_get_attribute_int_with_subst(machine, compnode, "state", -1); - parse_bounds(machine, xml_get_sibling(compnode.child, "bounds"), m_bounds); - parse_color(machine, xml_get_sibling(compnode.child, "color"), m_color); - - // image nodes - if (strcmp(compnode.name, "image") == 0) - { - m_type = CTYPE_IMAGE; - if (dirname != NULL) - m_dirname = dirname; - m_imagefile[0] = xml_get_attribute_string_with_subst(machine, compnode, "file", ""); - m_alphafile[0] = xml_get_attribute_string_with_subst(machine, compnode, "alphafile", ""); - m_file[0].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ))); - } - - // text nodes - else if (strcmp(compnode.name, "text") == 0) - { - m_type = CTYPE_TEXT; - m_string = xml_get_attribute_string_with_subst(machine, compnode, "string", ""); - m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0); - } - - // dotmatrix nodes - else if (strcmp(compnode.name, "dotmatrix") == 0) - { - m_type = CTYPE_DOTMATRIX; - } - else if (strcmp(compnode.name, "dotmatrix5dot") == 0) - { - m_type = CTYPE_DOTMATRIX5DOT; - } - else if (strcmp(compnode.name, "dotmatrixdot") == 0) - { - m_type = CTYPE_DOTMATRIXDOT; - } - - // simplecounter nodes - else if (strcmp(compnode.name, "simplecounter") == 0) - { - m_type = CTYPE_SIMPLECOUNTER; - m_digits = xml_get_attribute_int_with_subst(machine, compnode, "digits", 2); - m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0); - } - - // fruit machine reels - else if (strcmp(compnode.name, "reel") == 0) - { - m_type = CTYPE_REEL; - - astring symbollist = xml_get_attribute_string_with_subst(machine, compnode, "symbollist", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15"); - - // split out position names from string and figure out our number of symbols - int location = -1; - m_numstops = 0; - location=symbollist.find(0,","); - while (location!=-1) - { - m_stopnames[m_numstops] = symbollist; - m_stopnames[m_numstops].substr(0, location); - symbollist.substr(location+1, symbollist.len()-(location-1)); - m_numstops++; - location=symbollist.find(0,","); - } - m_stopnames[m_numstops++] = symbollist; - - // careful, dirname is NULL if we're coming from internal layout, and our string assignment doesn't like that - if (dirname != NULL) - m_dirname = dirname; - - for (int i=0;i<m_numstops;i++) - { - location=m_stopnames[i].find(0,":"); - if (location!=-1) - { - m_imagefile[i] = m_stopnames[i]; - m_stopnames[i].substr(0, location); - m_imagefile[i].substr(location+1, m_imagefile[i].len()-(location-1)); - - //m_alphafile[i] = - m_file[i].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ))); - } - else - { - //m_imagefile[i] = 0; - //m_alphafile[i] = 0; - m_file[i].reset(); - } - } - - m_stateoffset = xml_get_attribute_int_with_subst(machine, compnode, "stateoffset", 0); - m_numsymbolsvisible = xml_get_attribute_int_with_subst(machine, compnode, "numsymbolsvisible", 3); - m_reelreversed = xml_get_attribute_int_with_subst(machine, compnode, "reelreversed", 0); - m_beltreel = xml_get_attribute_int_with_subst(machine, compnode, "beltreel", 0); - - } - - // led7seg nodes - else if (strcmp(compnode.name, "led7seg") == 0) - m_type = CTYPE_LED7SEG; - - // led8seg_gts1 nodes - else if (strcmp(compnode.name, "led8seg_gts1") == 0) - m_type = CTYPE_LED8SEG_GTS1; - - // led14seg nodes - else if (strcmp(compnode.name, "led14seg") == 0) - m_type = CTYPE_LED14SEG; - - // led14segsc nodes - else if (strcmp(compnode.name, "led14segsc") == 0) - m_type = CTYPE_LED14SEGSC; - - // led16seg nodes - else if (strcmp(compnode.name, "led16seg") == 0) - m_type = CTYPE_LED16SEG; - - // led16segsc nodes - else if (strcmp(compnode.name, "led16segsc") == 0) - m_type = CTYPE_LED16SEGSC; - - // rect nodes - else if (strcmp(compnode.name, "rect") == 0) - m_type = CTYPE_RECT; - - // disk nodes - else if (strcmp(compnode.name, "disk") == 0) - m_type = CTYPE_DISK; - - // error otherwise - else - throw emu_fatalerror("Unknown element component: %s", compnode.name); + for (int i=0;i<MAX_BITMAPS;i++) + m_hasalpha[i] = false; + + // fetch common data + m_state = xml_get_attribute_int_with_subst(machine, compnode, "state", -1); + parse_bounds(machine, xml_get_sibling(compnode.child, "bounds"), m_bounds); + parse_color(machine, xml_get_sibling(compnode.child, "color"), m_color); + + // image nodes + if (strcmp(compnode.name, "image") == 0) + { + m_type = CTYPE_IMAGE; + if (dirname != NULL) + m_dirname = dirname; + m_imagefile[0] = xml_get_attribute_string_with_subst(machine, compnode, "file", ""); + m_alphafile[0] = xml_get_attribute_string_with_subst(machine, compnode, "alphafile", ""); + m_file[0].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ))); + } + + // text nodes + else if (strcmp(compnode.name, "text") == 0) + { + m_type = CTYPE_TEXT; + m_string = xml_get_attribute_string_with_subst(machine, compnode, "string", ""); + m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0); + } + + // dotmatrix nodes + else if (strcmp(compnode.name, "dotmatrix") == 0) + { + m_type = CTYPE_DOTMATRIX; + } + else if (strcmp(compnode.name, "dotmatrix5dot") == 0) + { + m_type = CTYPE_DOTMATRIX5DOT; + } + else if (strcmp(compnode.name, "dotmatrixdot") == 0) + { + m_type = CTYPE_DOTMATRIXDOT; + } + + // simplecounter nodes + else if (strcmp(compnode.name, "simplecounter") == 0) + { + m_type = CTYPE_SIMPLECOUNTER; + m_digits = xml_get_attribute_int_with_subst(machine, compnode, "digits", 2); + m_textalign = xml_get_attribute_int_with_subst(machine, compnode, "align", 0); + } + + // fruit machine reels + else if (strcmp(compnode.name, "reel") == 0) + { + m_type = CTYPE_REEL; + + astring symbollist = xml_get_attribute_string_with_subst(machine, compnode, "symbollist", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15"); + + // split out position names from string and figure out our number of symbols + int location = -1; + m_numstops = 0; + location=symbollist.find(0,","); + while (location!=-1) + { + m_stopnames[m_numstops] = symbollist; + m_stopnames[m_numstops].substr(0, location); + symbollist.substr(location+1, symbollist.len()-(location-1)); + m_numstops++; + location=symbollist.find(0,","); + } + m_stopnames[m_numstops++] = symbollist; + + // careful, dirname is NULL if we're coming from internal layout, and our string assignment doesn't like that + if (dirname != NULL) + m_dirname = dirname; + + for (int i=0;i<m_numstops;i++) + { + location=m_stopnames[i].find(0,":"); + if (location!=-1) + { + m_imagefile[i] = m_stopnames[i]; + m_stopnames[i].substr(0, location); + m_imagefile[i].substr(location+1, m_imagefile[i].len()-(location-1)); + + //m_alphafile[i] = + m_file[i].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ))); + } + else + { + //m_imagefile[i] = 0; + //m_alphafile[i] = 0; + m_file[i].reset(); + } + } + + m_stateoffset = xml_get_attribute_int_with_subst(machine, compnode, "stateoffset", 0); + m_numsymbolsvisible = xml_get_attribute_int_with_subst(machine, compnode, "numsymbolsvisible", 3); + m_reelreversed = xml_get_attribute_int_with_subst(machine, compnode, "reelreversed", 0); + m_beltreel = xml_get_attribute_int_with_subst(machine, compnode, "beltreel", 0); + + } + + // led7seg nodes + else if (strcmp(compnode.name, "led7seg") == 0) + m_type = CTYPE_LED7SEG; + + // led8seg_gts1 nodes + else if (strcmp(compnode.name, "led8seg_gts1") == 0) + m_type = CTYPE_LED8SEG_GTS1; + + // led14seg nodes + else if (strcmp(compnode.name, "led14seg") == 0) + m_type = CTYPE_LED14SEG; + + // led14segsc nodes + else if (strcmp(compnode.name, "led14segsc") == 0) + m_type = CTYPE_LED14SEGSC; + + // led16seg nodes + else if (strcmp(compnode.name, "led16seg") == 0) + m_type = CTYPE_LED16SEG; + + // led16segsc nodes + else if (strcmp(compnode.name, "led16segsc") == 0) + m_type = CTYPE_LED16SEGSC; + + // rect nodes + else if (strcmp(compnode.name, "rect") == 0) + m_type = CTYPE_RECT; + + // disk nodes + else if (strcmp(compnode.name, "disk") == 0) + m_type = CTYPE_DISK; + + // error otherwise + else + throw emu_fatalerror("Unknown element component: %s", compnode.name); } @@ -726,76 +726,76 @@ layout_element::component::~component() void layout_element::component::draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) { - switch (m_type) - { - case CTYPE_IMAGE: - if (!m_bitmap[0].valid()) - load_bitmap(); - { - bitmap_argb32 destsub(dest, bounds); - render_resample_argb_bitmap_hq(destsub, m_bitmap[0], m_color); - } - break; - - case CTYPE_RECT: - draw_rect(dest, bounds); - break; - - case CTYPE_DISK: - draw_disk(dest, bounds); - break; - - case CTYPE_TEXT: - draw_text(machine, dest, bounds); - break; - - case CTYPE_LED7SEG: - draw_led7seg(dest, bounds, state); - break; - - case CTYPE_LED8SEG_GTS1: - draw_led8seg_gts1(dest, bounds, state); - break; - - case CTYPE_LED14SEG: - draw_led14seg(dest, bounds, state); - break; - - case CTYPE_LED16SEG: - draw_led16seg(dest, bounds, state); - break; - - case CTYPE_LED14SEGSC: - draw_led14segsc(dest, bounds, state); - break; - - case CTYPE_LED16SEGSC: - draw_led16segsc(dest, bounds, state); - break; - - case CTYPE_DOTMATRIX: - draw_dotmatrix(8, dest, bounds, state); - break; - - case CTYPE_DOTMATRIX5DOT: - draw_dotmatrix(5, dest, bounds, state); - break; - - case CTYPE_DOTMATRIXDOT: - draw_dotmatrix(1, dest, bounds, state); - break; - - case CTYPE_SIMPLECOUNTER: - draw_simplecounter(machine, dest, bounds, state); - break; - - case CTYPE_REEL: - draw_reel(machine, dest, bounds, state); - break; - - default: - throw emu_fatalerror("Unknown component type requested draw()"); - } + switch (m_type) + { + case CTYPE_IMAGE: + if (!m_bitmap[0].valid()) + load_bitmap(); + { + bitmap_argb32 destsub(dest, bounds); + render_resample_argb_bitmap_hq(destsub, m_bitmap[0], m_color); + } + break; + + case CTYPE_RECT: + draw_rect(dest, bounds); + break; + + case CTYPE_DISK: + draw_disk(dest, bounds); + break; + + case CTYPE_TEXT: + draw_text(machine, dest, bounds); + break; + + case CTYPE_LED7SEG: + draw_led7seg(dest, bounds, state); + break; + + case CTYPE_LED8SEG_GTS1: + draw_led8seg_gts1(dest, bounds, state); + break; + + case CTYPE_LED14SEG: + draw_led14seg(dest, bounds, state); + break; + + case CTYPE_LED16SEG: + draw_led16seg(dest, bounds, state); + break; + + case CTYPE_LED14SEGSC: + draw_led14segsc(dest, bounds, state); + break; + + case CTYPE_LED16SEGSC: + draw_led16segsc(dest, bounds, state); + break; + + case CTYPE_DOTMATRIX: + draw_dotmatrix(8, dest, bounds, state); + break; + + case CTYPE_DOTMATRIX5DOT: + draw_dotmatrix(5, dest, bounds, state); + break; + + case CTYPE_DOTMATRIXDOT: + draw_dotmatrix(1, dest, bounds, state); + break; + + case CTYPE_SIMPLECOUNTER: + draw_simplecounter(machine, dest, bounds, state); + break; + + case CTYPE_REEL: + draw_reel(machine, dest, bounds, state); + break; + + default: + throw emu_fatalerror("Unknown component type requested draw()"); + } } @@ -806,34 +806,34 @@ void layout_element::component::draw(running_machine &machine, bitmap_argb32 &de void layout_element::component::draw_rect(bitmap_argb32 &dest, const rectangle &bounds) { - // compute premultiplied colors - UINT32 r = m_color.r * m_color.a * 255.0; - UINT32 g = m_color.g * m_color.a * 255.0; - UINT32 b = m_color.b * m_color.a * 255.0; - UINT32 inva = (1.0f - m_color.a) * 255.0; - - // iterate over X and Y - for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++) - { - for (UINT32 x = bounds.min_x; x <= bounds.max_x; x++) - { - UINT32 finalr = r; - UINT32 finalg = g; - UINT32 finalb = b; - - // if we're translucent, add in the destination pixel contribution - if (inva > 0) - { - rgb_t dpix = dest.pix32(y, x); - finalr += (dpix.r() * inva) >> 8; - finalg += (dpix.g() * inva) >> 8; - finalb += (dpix.b() * inva) >> 8; - } - - // store the target pixel, dividing the RGBA values by the overall scale factor - dest.pix32(y, x) = rgb_t(finalr, finalg, finalb); - } - } + // compute premultiplied colors + UINT32 r = m_color.r * m_color.a * 255.0; + UINT32 g = m_color.g * m_color.a * 255.0; + UINT32 b = m_color.b * m_color.a * 255.0; + UINT32 inva = (1.0f - m_color.a) * 255.0; + + // iterate over X and Y + for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++) + { + for (UINT32 x = bounds.min_x; x <= bounds.max_x; x++) + { + UINT32 finalr = r; + UINT32 finalg = g; + UINT32 finalb = b; + + // if we're translucent, add in the destination pixel contribution + if (inva > 0) + { + rgb_t dpix = dest.pix32(y, x); + finalr += (dpix.r() * inva) >> 8; + finalg += (dpix.g() * inva) >> 8; + finalb += (dpix.b() * inva) >> 8; + } + + // store the target pixel, dividing the RGBA values by the overall scale factor + dest.pix32(y, x) = rgb_t(finalr, finalg, finalb); + } + } } @@ -844,49 +844,49 @@ void layout_element::component::draw_rect(bitmap_argb32 &dest, const rectangle & void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle &bounds) { - // compute premultiplied colors - UINT32 r = m_color.r * m_color.a * 255.0; - UINT32 g = m_color.g * m_color.a * 255.0; - UINT32 b = m_color.b * m_color.a * 255.0; - UINT32 inva = (1.0f - m_color.a) * 255.0; - - // find the center - float xcenter = float(bounds.xcenter()); - float ycenter = float(bounds.ycenter()); - float xradius = float(bounds.width()) * 0.5f; - float yradius = float(bounds.height()) * 0.5f; - float ooyradius2 = 1.0f / (yradius * yradius); - - // iterate over y - for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++) - { - float ycoord = ycenter - ((float)y + 0.5f); - float xval = xradius * sqrt(1.0f - (ycoord * ycoord) * ooyradius2); - - // compute left/right coordinates - INT32 left = (INT32)(xcenter - xval + 0.5f); - INT32 right = (INT32)(xcenter + xval + 0.5f); - - // draw this scanline - for (UINT32 x = left; x < right; x++) - { - UINT32 finalr = r; - UINT32 finalg = g; - UINT32 finalb = b; - - // if we're translucent, add in the destination pixel contribution - if (inva > 0) - { - rgb_t dpix = dest.pix32(y, x); - finalr += (dpix.r() * inva) >> 8; - finalg += (dpix.g() * inva) >> 8; - finalb += (dpix.b() * inva) >> 8; - } - - // store the target pixel, dividing the RGBA values by the overall scale factor - dest.pix32(y, x) = rgb_t(finalr, finalg, finalb); - } - } + // compute premultiplied colors + UINT32 r = m_color.r * m_color.a * 255.0; + UINT32 g = m_color.g * m_color.a * 255.0; + UINT32 b = m_color.b * m_color.a * 255.0; + UINT32 inva = (1.0f - m_color.a) * 255.0; + + // find the center + float xcenter = float(bounds.xcenter()); + float ycenter = float(bounds.ycenter()); + float xradius = float(bounds.width()) * 0.5f; + float yradius = float(bounds.height()) * 0.5f; + float ooyradius2 = 1.0f / (yradius * yradius); + + // iterate over y + for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++) + { + float ycoord = ycenter - ((float)y + 0.5f); + float xval = xradius * sqrt(1.0f - (ycoord * ycoord) * ooyradius2); + + // compute left/right coordinates + INT32 left = (INT32)(xcenter - xval + 0.5f); + INT32 right = (INT32)(xcenter + xval + 0.5f); + + // draw this scanline + for (UINT32 x = left; x < right; x++) + { + UINT32 finalr = r; + UINT32 finalg = g; + UINT32 finalb = b; + + // if we're translucent, add in the destination pixel contribution + if (inva > 0) + { + rgb_t dpix = dest.pix32(y, x); + finalr += (dpix.r() * inva) >> 8; + finalg += (dpix.g() * inva) >> 8; + finalb += (dpix.b() * inva) >> 8; + } + + // store the target pixel, dividing the RGBA values by the overall scale factor + dest.pix32(y, x) = rgb_t(finalr, finalg, finalb); + } + } } @@ -896,408 +896,408 @@ void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle & void layout_element::component::draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds) { - // compute premultiplied colors - UINT32 r = m_color.r * 255.0; - UINT32 g = m_color.g * 255.0; - UINT32 b = m_color.b * 255.0; - UINT32 a = m_color.a * 255.0; - - // get the width of the string - render_font *font = machine.render().font_alloc("default"); - float aspect = 1.0f; - INT32 width; - - - while (1) - { - width = font->string_width(bounds.height(), aspect, m_string); - if (width < bounds.width()) - break; - aspect *= 0.9f; - } - - - // get alignment - INT32 curx; - switch (m_textalign) - { - // left - case 1: - curx = bounds.min_x; - break; - - // right - case 2: - curx = bounds.max_x - width; - break; - - // default to center - default: - curx = bounds.min_x + (bounds.width() - width) / 2; - break; - } - - // allocate a temporary bitmap - bitmap_argb32 tempbitmap(dest.width(), dest.height()); - - // loop over characters - for (const char *s = m_string; *s != 0; s++) - { - // get the font bitmap - rectangle chbounds; - font->get_scaled_bitmap_and_bounds(tempbitmap, bounds.height(), aspect, *s, chbounds); - - // copy the data into the target - for (int y = 0; y < chbounds.height(); y++) - { - int effy = bounds.min_y + y; - if (effy >= bounds.min_y && effy <= bounds.max_y) - { - UINT32 *src = &tempbitmap.pix32(y); - UINT32 *d = &dest.pix32(effy); - for (int x = 0; x < chbounds.width(); x++) - { - int effx = curx + x + chbounds.min_x; - if (effx >= bounds.min_x && effx <= bounds.max_x) - { - UINT32 spix = rgb_t(src[x]).a(); - if (spix != 0) - { - rgb_t dpix = d[effx]; - UINT32 ta = (a * (spix + 1)) >> 8; - UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; - UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; - UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; - d[effx] = rgb_t(tr, tg, tb); - } - } - } - } - } - - // advance in the X direction - curx += font->char_width(bounds.height(), aspect, *s); - } - - // free the temporary bitmap and font - machine.render().font_free(font); + // compute premultiplied colors + UINT32 r = m_color.r * 255.0; + UINT32 g = m_color.g * 255.0; + UINT32 b = m_color.b * 255.0; + UINT32 a = m_color.a * 255.0; + + // get the width of the string + render_font *font = machine.render().font_alloc("default"); + float aspect = 1.0f; + INT32 width; + + + while (1) + { + width = font->string_width(bounds.height(), aspect, m_string); + if (width < bounds.width()) + break; + aspect *= 0.9f; + } + + + // get alignment + INT32 curx; + switch (m_textalign) + { + // left + case 1: + curx = bounds.min_x; + break; + + // right + case 2: + curx = bounds.max_x - width; + break; + + // default to center + default: + curx = bounds.min_x + (bounds.width() - width) / 2; + break; + } + + // allocate a temporary bitmap + bitmap_argb32 tempbitmap(dest.width(), dest.height()); + + // loop over characters + for (const char *s = m_string; *s != 0; s++) + { + // get the font bitmap + rectangle chbounds; + font->get_scaled_bitmap_and_bounds(tempbitmap, bounds.height(), aspect, *s, chbounds); + + // copy the data into the target + for (int y = 0; y < chbounds.height(); y++) + { + int effy = bounds.min_y + y; + if (effy >= bounds.min_y && effy <= bounds.max_y) + { + UINT32 *src = &tempbitmap.pix32(y); + UINT32 *d = &dest.pix32(effy); + for (int x = 0; x < chbounds.width(); x++) + { + int effx = curx + x + chbounds.min_x; + if (effx >= bounds.min_x && effx <= bounds.max_x) + { + UINT32 spix = rgb_t(src[x]).a(); + if (spix != 0) + { + rgb_t dpix = d[effx]; + UINT32 ta = (a * (spix + 1)) >> 8; + UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; + UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; + UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; + d[effx] = rgb_t(tr, tg, tb); + } + } + } + } + } + + // advance in the X direction + curx += font->char_width(bounds.height(), aspect, *s); + } + + // free the temporary bitmap and font + machine.render().font_free(font); } void layout_element::component::draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) { - char temp[256]; - sprintf(temp, "%0*d", m_digits, state); - m_string = astring(temp); - draw_text(machine, dest, bounds); + char temp[256]; + sprintf(temp, "%0*d", m_digits, state); + m_string = astring(temp); + draw_text(machine, dest, bounds); } /* state is a normalized value between 0 and 65536 so that we don't need to worry about how many motor steps here or in the .lay, only the number of symbols */ void layout_element::component::draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) { - if (m_beltreel) - { - draw_beltreel(machine,dest,bounds,state); - } - else - { - const int max_state_used = 0x10000; - - // shift the reels a bit based on this param, allows fine tuning - int use_state = (state + m_stateoffset) % max_state_used; - - // compute premultiplied colors - UINT32 r = m_color.r * 255.0; - UINT32 g = m_color.g * 255.0; - UINT32 b = m_color.b * 255.0; - UINT32 a = m_color.a * 255.0; - - // get the width of the string - render_font *font = machine.render().font_alloc("default"); - float aspect = 1.0f; - INT32 width; - - - int curry = 0; - int num_shown = m_numsymbolsvisible; - - int ourheight = bounds.height(); - - for (int fruit = 0;fruit<m_numstops;fruit++) - { - int basey; - - if (m_reelreversed==1) - { - basey = bounds.min_y + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry; - } - else - { - basey = bounds.min_y - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry; - } - - // wrap around... - if (basey < bounds.min_y) - basey += ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops)); - if (basey > bounds.max_y) - basey -= ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops)); - - int endpos = basey+ourheight/num_shown; - - // only render the symbol / text if it's atually in view because the code is SLOW - if ((endpos >= bounds.min_y) && (basey <= bounds.max_y)) - { - while (1) - { - width = font->string_width(ourheight/num_shown, aspect, m_stopnames[fruit]); - if (width < bounds.width()) - break; - aspect *= 0.9f; - } - - INT32 curx; - curx = bounds.min_x + (bounds.width() - width) / 2; - - if (m_file[fruit]) - if (!m_bitmap[fruit].valid()) - load_reel_bitmap(fruit); - - if (m_file[fruit]) // render gfx - { - bitmap_argb32 tempbitmap2(dest.width(), ourheight/num_shown); - - if (m_bitmap[fruit].valid()) - { - render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color); - - for (int y = 0; y < ourheight/num_shown; y++) - { - int effy = basey + y; - - if (effy >= bounds.min_y && effy <= bounds.max_y) - { - UINT32 *src = &tempbitmap2.pix32(y); - UINT32 *d = &dest.pix32(effy); - for (int x = 0; x < dest.width(); x++) - { - int effx = x; - if (effx >= bounds.min_x && effx <= bounds.max_x) - { - UINT32 spix = rgb_t(src[x]).a(); - if (spix != 0) - { - d[effx] = src[x]; - } - } - } - } - - } - } - } - else // render text (fallback) - { - // allocate a temporary bitmap - bitmap_argb32 tempbitmap(dest.width(), dest.height()); - - // loop over characters - for (const char *s = m_stopnames[fruit]; *s != 0; s++) - { - // get the font bitmap - rectangle chbounds; - font->get_scaled_bitmap_and_bounds(tempbitmap, ourheight/num_shown, aspect, *s, chbounds); - - // copy the data into the target - for (int y = 0; y < chbounds.height(); y++) - { - int effy = basey + y; - - if (effy >= bounds.min_y && effy <= bounds.max_y) - { - UINT32 *src = &tempbitmap.pix32(y); - UINT32 *d = &dest.pix32(effy); - for (int x = 0; x < chbounds.width(); x++) - { - int effx = curx + x + chbounds.min_x; - if (effx >= bounds.min_x && effx <= bounds.max_x) - { - UINT32 spix = rgb_t(src[x]).a(); - if (spix != 0) - { - rgb_t dpix = d[effx]; - UINT32 ta = (a * (spix + 1)) >> 8; - UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; - UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; - UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; - d[effx] = rgb_t(tr, tg, tb); - } - } - } - } - } - - // advance in the X direction - curx += font->char_width(ourheight/num_shown, aspect, *s); - - } - - } - } - - curry += ourheight/num_shown; - } - // free the temporary bitmap and font - machine.render().font_free(font); - } + if (m_beltreel) + { + draw_beltreel(machine,dest,bounds,state); + } + else + { + const int max_state_used = 0x10000; + + // shift the reels a bit based on this param, allows fine tuning + int use_state = (state + m_stateoffset) % max_state_used; + + // compute premultiplied colors + UINT32 r = m_color.r * 255.0; + UINT32 g = m_color.g * 255.0; + UINT32 b = m_color.b * 255.0; + UINT32 a = m_color.a * 255.0; + + // get the width of the string + render_font *font = machine.render().font_alloc("default"); + float aspect = 1.0f; + INT32 width; + + + int curry = 0; + int num_shown = m_numsymbolsvisible; + + int ourheight = bounds.height(); + + for (int fruit = 0;fruit<m_numstops;fruit++) + { + int basey; + + if (m_reelreversed==1) + { + basey = bounds.min_y + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry; + } + else + { + basey = bounds.min_y - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry; + } + + // wrap around... + if (basey < bounds.min_y) + basey += ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops)); + if (basey > bounds.max_y) + basey -= ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops)); + + int endpos = basey+ourheight/num_shown; + + // only render the symbol / text if it's atually in view because the code is SLOW + if ((endpos >= bounds.min_y) && (basey <= bounds.max_y)) + { + while (1) + { + width = font->string_width(ourheight/num_shown, aspect, m_stopnames[fruit]); + if (width < bounds.width()) + break; + aspect *= 0.9f; + } + + INT32 curx; + curx = bounds.min_x + (bounds.width() - width) / 2; + + if (m_file[fruit]) + if (!m_bitmap[fruit].valid()) + load_reel_bitmap(fruit); + + if (m_file[fruit]) // render gfx + { + bitmap_argb32 tempbitmap2(dest.width(), ourheight/num_shown); + + if (m_bitmap[fruit].valid()) + { + render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color); + + for (int y = 0; y < ourheight/num_shown; y++) + { + int effy = basey + y; + + if (effy >= bounds.min_y && effy <= bounds.max_y) + { + UINT32 *src = &tempbitmap2.pix32(y); + UINT32 *d = &dest.pix32(effy); + for (int x = 0; x < dest.width(); x++) + { + int effx = x; + if (effx >= bounds.min_x && effx <= bounds.max_x) + { + UINT32 spix = rgb_t(src[x]).a(); + if (spix != 0) + { + d[effx] = src[x]; + } + } + } + } + + } + } + } + else // render text (fallback) + { + // allocate a temporary bitmap + bitmap_argb32 tempbitmap(dest.width(), dest.height()); + + // loop over characters + for (const char *s = m_stopnames[fruit]; *s != 0; s++) + { + // get the font bitmap + rectangle chbounds; + font->get_scaled_bitmap_and_bounds(tempbitmap, ourheight/num_shown, aspect, *s, chbounds); + + // copy the data into the target + for (int y = 0; y < chbounds.height(); y++) + { + int effy = basey + y; + + if (effy >= bounds.min_y && effy <= bounds.max_y) + { + UINT32 *src = &tempbitmap.pix32(y); + UINT32 *d = &dest.pix32(effy); + for (int x = 0; x < chbounds.width(); x++) + { + int effx = curx + x + chbounds.min_x; + if (effx >= bounds.min_x && effx <= bounds.max_x) + { + UINT32 spix = rgb_t(src[x]).a(); + if (spix != 0) + { + rgb_t dpix = d[effx]; + UINT32 ta = (a * (spix + 1)) >> 8; + UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; + UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; + UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; + d[effx] = rgb_t(tr, tg, tb); + } + } + } + } + } + + // advance in the X direction + curx += font->char_width(ourheight/num_shown, aspect, *s); + + } + + } + } + + curry += ourheight/num_shown; + } + // free the temporary bitmap and font + machine.render().font_free(font); + } } void layout_element::component::draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) { - const int max_state_used = 0x10000; - - // shift the reels a bit based on this param, allows fine tuning - int use_state = (state + m_stateoffset) % max_state_used; - - // compute premultiplied colors - UINT32 r = m_color.r * 255.0; - UINT32 g = m_color.g * 255.0; - UINT32 b = m_color.b * 255.0; - UINT32 a = m_color.a * 255.0; - - // get the width of the string - render_font *font = machine.render().font_alloc("default"); - float aspect = 1.0f; - INT32 width; - int currx = 0; - int num_shown = m_numsymbolsvisible; - - int ourwidth = bounds.width(); - - for (int fruit = 0;fruit<m_numstops;fruit++) - { - int basex; - if (m_reelreversed==1) - { - basex = bounds.min_x + ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx; - } - else - { - basex = bounds.min_x - ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx; - } - - // wrap around... - if (basex < bounds.min_x) - basex += ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops)); - if (basex > bounds.max_x) - basex -= ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops)); - - int endpos = basex+(ourwidth/num_shown); - - // only render the symbol / text if it's atually in view because the code is SLOW - if ((endpos >= bounds.min_x) && (basex <= bounds.max_x)) - { - while (1) - { - width = font->string_width(dest.height(), aspect, m_stopnames[fruit]); - if (width < bounds.width()) - break; - aspect *= 0.9f; - } - - INT32 curx; - curx = bounds.min_x; - - if (m_file[fruit]) - if (!m_bitmap[fruit].valid()) - load_reel_bitmap(fruit); - - if (m_file[fruit]) // render gfx - { - bitmap_argb32 tempbitmap2(ourwidth/num_shown, dest.height()); - - if (m_bitmap[fruit].valid()) - { - render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color); - - for (int y = 0; y < dest.height(); y++) - { - int effy = y; - - if (effy >= bounds.min_y && effy <= bounds.max_y) - { - UINT32 *src = &tempbitmap2.pix32(y); - UINT32 *d = &dest.pix32(effy); - for (int x = 0; x < ourwidth/num_shown; x++) - { - int effx = basex + x; - if (effx >= bounds.min_x && effx <= bounds.max_x) - { - UINT32 spix = rgb_t(src[x]).a(); - if (spix != 0) - { - d[effx] = src[x]; - } - } - } - } - - } - } - } - else // render text (fallback) - { - // allocate a temporary bitmap - bitmap_argb32 tempbitmap(dest.width(), dest.height()); - - // loop over characters - for (const char *s = m_stopnames[fruit]; *s != 0; s++) - { - // get the font bitmap - rectangle chbounds; - font->get_scaled_bitmap_and_bounds(tempbitmap, dest.height(), aspect, *s, chbounds); - - // copy the data into the target - for (int y = 0; y < chbounds.height(); y++) - { - int effy = y; - - if (effy >= bounds.min_y && effy <= bounds.max_y) - { - UINT32 *src = &tempbitmap.pix32(y); - UINT32 *d = &dest.pix32(effy); - for (int x = 0; x < chbounds.width(); x++) - { - int effx = basex + curx + x; - if (effx >= bounds.min_x && effx <= bounds.max_x) - { - UINT32 spix = rgb_t(src[x]).a(); - if (spix != 0) - { - rgb_t dpix = d[effx]; - UINT32 ta = (a * (spix + 1)) >> 8; - UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; - UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; - UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; - d[effx] = rgb_t(tr, tg, tb); - } - } - } - } - } - - // advance in the X direction - curx += font->char_width(dest.height(), aspect, *s); - - } - - } - } - - currx += ourwidth/num_shown; - } - - // free the temporary bitmap and font - machine.render().font_free(font); + const int max_state_used = 0x10000; + + // shift the reels a bit based on this param, allows fine tuning + int use_state = (state + m_stateoffset) % max_state_used; + + // compute premultiplied colors + UINT32 r = m_color.r * 255.0; + UINT32 g = m_color.g * 255.0; + UINT32 b = m_color.b * 255.0; + UINT32 a = m_color.a * 255.0; + + // get the width of the string + render_font *font = machine.render().font_alloc("default"); + float aspect = 1.0f; + INT32 width; + int currx = 0; + int num_shown = m_numsymbolsvisible; + + int ourwidth = bounds.width(); + + for (int fruit = 0;fruit<m_numstops;fruit++) + { + int basex; + if (m_reelreversed==1) + { + basex = bounds.min_x + ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx; + } + else + { + basex = bounds.min_x - ((use_state)*(ourwidth/num_shown)/(max_state_used/m_numstops)) + currx; + } + + // wrap around... + if (basex < bounds.min_x) + basex += ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops)); + if (basex > bounds.max_x) + basex -= ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops)); + + int endpos = basex+(ourwidth/num_shown); + + // only render the symbol / text if it's atually in view because the code is SLOW + if ((endpos >= bounds.min_x) && (basex <= bounds.max_x)) + { + while (1) + { + width = font->string_width(dest.height(), aspect, m_stopnames[fruit]); + if (width < bounds.width()) + break; + aspect *= 0.9f; + } + + INT32 curx; + curx = bounds.min_x; + + if (m_file[fruit]) + if (!m_bitmap[fruit].valid()) + load_reel_bitmap(fruit); + + if (m_file[fruit]) // render gfx + { + bitmap_argb32 tempbitmap2(ourwidth/num_shown, dest.height()); + + if (m_bitmap[fruit].valid()) + { + render_resample_argb_bitmap_hq(tempbitmap2, m_bitmap[fruit], m_color); + + for (int y = 0; y < dest.height(); y++) + { + int effy = y; + + if (effy >= bounds.min_y && effy <= bounds.max_y) + { + UINT32 *src = &tempbitmap2.pix32(y); + UINT32 *d = &dest.pix32(effy); + for (int x = 0; x < ourwidth/num_shown; x++) + { + int effx = basex + x; + if (effx >= bounds.min_x && effx <= bounds.max_x) + { + UINT32 spix = rgb_t(src[x]).a(); + if (spix != 0) + { + d[effx] = src[x]; + } + } + } + } + + } + } + } + else // render text (fallback) + { + // allocate a temporary bitmap + bitmap_argb32 tempbitmap(dest.width(), dest.height()); + + // loop over characters + for (const char *s = m_stopnames[fruit]; *s != 0; s++) + { + // get the font bitmap + rectangle chbounds; + font->get_scaled_bitmap_and_bounds(tempbitmap, dest.height(), aspect, *s, chbounds); + + // copy the data into the target + for (int y = 0; y < chbounds.height(); y++) + { + int effy = y; + + if (effy >= bounds.min_y && effy <= bounds.max_y) + { + UINT32 *src = &tempbitmap.pix32(y); + UINT32 *d = &dest.pix32(effy); + for (int x = 0; x < chbounds.width(); x++) + { + int effx = basex + curx + x; + if (effx >= bounds.min_x && effx <= bounds.max_x) + { + UINT32 spix = rgb_t(src[x]).a(); + if (spix != 0) + { + rgb_t dpix = d[effx]; + UINT32 ta = (a * (spix + 1)) >> 8; + UINT32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; + UINT32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; + UINT32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; + d[effx] = rgb_t(tr, tg, tb); + } + } + } + } + } + + // advance in the X direction + curx += font->char_width(dest.height(), aspect, *s); + + } + + } + } + + currx += ourwidth/num_shown; + } + + // free the temporary bitmap and font + machine.render().font_free(font); } @@ -1308,49 +1308,49 @@ void layout_element::component::draw_beltreel(running_machine &machine, bitmap_a void layout_element::component::load_bitmap() { - // load the basic bitmap - assert(m_file[0] != NULL); - m_hasalpha[0] = render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_imagefile[0]); - - // load the alpha bitmap if specified - if (m_bitmap[0].valid() && m_alphafile[0]) - render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_alphafile[0], true); - - // if we can't load the bitmap, allocate a dummy one and report an error - if (!m_bitmap[0].valid()) - { - // draw some stripes in the bitmap - m_bitmap[0].allocate(100, 100); - m_bitmap[0].fill(0); - for (int step = 0; step < 100; step += 25) - for (int line = 0; line < 100; line++) - m_bitmap[0].pix32((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff); - - // log an error - if (!m_alphafile[0]) - osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile[0].cstr()); - else - osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile[0].cstr(), m_alphafile[0].cstr()); - } + // load the basic bitmap + assert(m_file[0] != NULL); + m_hasalpha[0] = render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_imagefile[0]); + + // load the alpha bitmap if specified + if (m_bitmap[0].valid() && m_alphafile[0]) + render_load_png(m_bitmap[0], *m_file[0], m_dirname, m_alphafile[0], true); + + // if we can't load the bitmap, allocate a dummy one and report an error + if (!m_bitmap[0].valid()) + { + // draw some stripes in the bitmap + m_bitmap[0].allocate(100, 100); + m_bitmap[0].fill(0); + for (int step = 0; step < 100; step += 25) + for (int line = 0; line < 100; line++) + m_bitmap[0].pix32((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff); + + // log an error + if (!m_alphafile[0]) + osd_printf_warning("Unable to load component bitmap '%s'\n", m_imagefile[0].cstr()); + else + osd_printf_warning("Unable to load component bitmap '%s'/'%s'\n", m_imagefile[0].cstr(), m_alphafile[0].cstr()); + } } void layout_element::component::load_reel_bitmap(int number) { - // load the basic bitmap - assert(m_file != NULL); - /*m_hasalpha[number] = */ render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_imagefile[number]); + // load the basic bitmap + assert(m_file != NULL); + /*m_hasalpha[number] = */ render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_imagefile[number]); - // load the alpha bitmap if specified - //if (m_bitmap[number].valid() && m_alphafile[number]) - // render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_alphafile[number], true); + // load the alpha bitmap if specified + //if (m_bitmap[number].valid() && m_alphafile[number]) + // render_load_png(m_bitmap[number], *m_file[number], m_dirname, m_alphafile[number], true); - // if we can't load the bitmap just use text rendering - if (!m_bitmap[number].valid()) - { - // fallback to text rendering - m_file[number].reset(); - } + // if we can't load the bitmap just use text rendering + if (!m_bitmap[number].valid()) + { + // fallback to text rendering + m_file[number].reset(); + } } @@ -1362,48 +1362,48 @@ void layout_element::component::load_reel_bitmap(int number) void layout_element::component::draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern) { - const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff); - const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20); + const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff); + const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20); - // sizes for computation - int bmwidth = 250; - int bmheight = 400; - int segwidth = 40; - int skewwidth = 40; + // sizes for computation + int bmwidth = 250; + int bmheight = 400; + int segwidth = 40; + int skewwidth = 40; - // allocate a temporary bitmap for drawing - bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight); - tempbitmap.fill(rgb_t(0xff,0x00,0x00,0x00)); + // allocate a temporary bitmap for drawing + bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight); + tempbitmap.fill(rgb_t(0xff,0x00,0x00,0x00)); - // top bar - draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen); + // top bar + draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen); - // top-right bar - draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen); + // top-right bar + draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen); - // bottom-right bar - draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen); + // bottom-right bar + draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen); - // bottom bar - draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen); + // bottom bar + draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen); - // bottom-left bar - draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen); + // bottom-left bar + draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen); - // top-left bar - draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen); + // top-left bar + draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen); - // middle bar - draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen); + // middle bar + draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen); - // apply skew - apply_skew(tempbitmap, 40); + // apply skew + apply_skew(tempbitmap, 40); - // decimal point - draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 7)) ? onpen : offpen); + // decimal point + draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 7)) ? onpen : offpen); - // resample to the target size - render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); + // resample to the target size + render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); } @@ -1413,54 +1413,54 @@ void layout_element::component::draw_led7seg(bitmap_argb32 &dest, const rectangl void layout_element::component::draw_led8seg_gts1(bitmap_argb32 &dest, const rectangle &bounds, int pattern) { - const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff); - const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20); - const rgb_t backpen = rgb_t(0xff,0x00,0x00,0x00); + const rgb_t onpen = rgb_t(0xff,0xff,0xff,0xff); + const rgb_t offpen = rgb_t(0xff,0x20,0x20,0x20); + const rgb_t backpen = rgb_t(0xff,0x00,0x00,0x00); - // sizes for computation - int bmwidth = 250; - int bmheight = 400; - int segwidth = 40; - int skewwidth = 40; + // sizes for computation + int bmwidth = 250; + int bmheight = 400; + int segwidth = 40; + int skewwidth = 40; - // allocate a temporary bitmap for drawing - bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight); - tempbitmap.fill(backpen); + // allocate a temporary bitmap for drawing + bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight); + tempbitmap.fill(backpen); - // top bar - draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen); + // top bar + draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 0)) ? onpen : offpen); - // top-right bar - draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen); + // top-right bar + draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 1)) ? onpen : offpen); - // bottom-right bar - draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen); + // bottom-right bar + draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, segwidth, (pattern & (1 << 2)) ? onpen : offpen); - // bottom bar - draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen); + // bottom bar + draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, segwidth, (pattern & (1 << 3)) ? onpen : offpen); - // bottom-left bar - draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen); + // bottom-left bar + draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 4)) ? onpen : offpen); - // top-left bar - draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen); + // top-left bar + draw_segment_vertical(tempbitmap, 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, segwidth, (pattern & (1 << 5)) ? onpen : offpen); - // horizontal bars - draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, 2*bmwidth/3 - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen); - draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3 + bmwidth/2, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen); + // horizontal bars + draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3, 2*bmwidth/3 - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen); + draw_segment_horizontal(tempbitmap, 0 + 2*segwidth/3 + bmwidth/2, bmwidth - 2*segwidth/3, bmheight/2, segwidth, (pattern & (1 << 6)) ? onpen : offpen); - // vertical bars - draw_segment_vertical(tempbitmap, 0 + segwidth/3 - 8, bmheight/2 - segwidth/3 + 2, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen); - draw_segment_vertical(tempbitmap, 0 + segwidth/3, bmheight/2 - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen); + // vertical bars + draw_segment_vertical(tempbitmap, 0 + segwidth/3 - 8, bmheight/2 - segwidth/3 + 2, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen); + draw_segment_vertical(tempbitmap, 0 + segwidth/3, bmheight/2 - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen); - draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3 - 2, bmheight - segwidth/3 + 8, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen); - draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen); + draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3 - 2, bmheight - segwidth/3 + 8, 2*bmwidth/3 - segwidth/2 - 4, segwidth + 8, backpen); + draw_segment_vertical(tempbitmap, bmheight/2 + segwidth/3, bmheight - segwidth/3, 2*bmwidth/3 - segwidth/2 - 4, segwidth, (pattern & (1 << 7)) ? onpen : offpen); - // apply skew - apply_skew(tempbitmap, 40); + // apply skew + apply_skew(tempbitmap, 40); - // resample to the target size - render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); + // resample to the target size + render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); } @@ -1470,98 +1470,98 @@ void layout_element::component::draw_led8seg_gts1(bitmap_argb32 &dest, const rec void layout_element::component::draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern) { - const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); - const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20); - - // sizes for computation - int bmwidth = 250; - int bmheight = 400; - int segwidth = 40; - int skewwidth = 40; - - // allocate a temporary bitmap for drawing - bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight); - tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00)); - - // top bar - draw_segment_horizontal(tempbitmap, - 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, - segwidth, (pattern & (1 << 0)) ? onpen : offpen); - - // right-top bar - draw_segment_vertical(tempbitmap, - 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, - segwidth, (pattern & (1 << 1)) ? onpen : offpen); - - // right-bottom bar - draw_segment_vertical(tempbitmap, - bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, - segwidth, (pattern & (1 << 2)) ? onpen : offpen); - - // bottom bar - draw_segment_horizontal(tempbitmap, - 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, - segwidth, (pattern & (1 << 3)) ? onpen : offpen); - - // left-bottom bar - draw_segment_vertical(tempbitmap, - bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, - segwidth, (pattern & (1 << 4)) ? onpen : offpen); - - // left-top bar - draw_segment_vertical(tempbitmap, - 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, - segwidth, (pattern & (1 << 5)) ? onpen : offpen); - - // horizontal-middle-left bar - draw_segment_horizontal_caps(tempbitmap, - 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2, - segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen); - - // horizontal-middle-right bar - draw_segment_horizontal_caps(tempbitmap, - 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2, - segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen); - - // vertical-middle-top bar - draw_segment_vertical_caps(tempbitmap, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2, - segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen); - - // vertical-middle-bottom bar - draw_segment_vertical_caps(tempbitmap, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2, - segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen); - - // diagonal-left-bottom bar - draw_segment_diagonal_1(tempbitmap, - 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, - segwidth, (pattern & (1 << 10)) ? onpen : offpen); - - // diagonal-left-top bar - draw_segment_diagonal_2(tempbitmap, - 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, - segwidth, (pattern & (1 << 11)) ? onpen : offpen); - - // diagonal-right-top bar - draw_segment_diagonal_1(tempbitmap, - bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, - segwidth, (pattern & (1 << 12)) ? onpen : offpen); - - // diagonal-right-bottom bar - draw_segment_diagonal_2(tempbitmap, - bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, - segwidth, (pattern & (1 << 13)) ? onpen : offpen); - - // apply skew - apply_skew(tempbitmap, 40); - - // resample to the target size - render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); + const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); + const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20); + + // sizes for computation + int bmwidth = 250; + int bmheight = 400; + int segwidth = 40; + int skewwidth = 40; + + // allocate a temporary bitmap for drawing + bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight); + tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00)); + + // top bar + draw_segment_horizontal(tempbitmap, + 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, + segwidth, (pattern & (1 << 0)) ? onpen : offpen); + + // right-top bar + draw_segment_vertical(tempbitmap, + 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, + segwidth, (pattern & (1 << 1)) ? onpen : offpen); + + // right-bottom bar + draw_segment_vertical(tempbitmap, + bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, + segwidth, (pattern & (1 << 2)) ? onpen : offpen); + + // bottom bar + draw_segment_horizontal(tempbitmap, + 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, + segwidth, (pattern & (1 << 3)) ? onpen : offpen); + + // left-bottom bar + draw_segment_vertical(tempbitmap, + bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, + segwidth, (pattern & (1 << 4)) ? onpen : offpen); + + // left-top bar + draw_segment_vertical(tempbitmap, + 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, + segwidth, (pattern & (1 << 5)) ? onpen : offpen); + + // horizontal-middle-left bar + draw_segment_horizontal_caps(tempbitmap, + 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2, + segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen); + + // horizontal-middle-right bar + draw_segment_horizontal_caps(tempbitmap, + 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2, + segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen); + + // vertical-middle-top bar + draw_segment_vertical_caps(tempbitmap, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2, + segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen); + + // vertical-middle-bottom bar + draw_segment_vertical_caps(tempbitmap, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2, + segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen); + + // diagonal-left-bottom bar + draw_segment_diagonal_1(tempbitmap, + 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, + segwidth, (pattern & (1 << 10)) ? onpen : offpen); + + // diagonal-left-top bar + draw_segment_diagonal_2(tempbitmap, + 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, + segwidth, (pattern & (1 << 11)) ? onpen : offpen); + + // diagonal-right-top bar + draw_segment_diagonal_1(tempbitmap, + bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, + segwidth, (pattern & (1 << 12)) ? onpen : offpen); + + // diagonal-right-bottom bar + draw_segment_diagonal_2(tempbitmap, + bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, + segwidth, (pattern & (1 << 13)) ? onpen : offpen); + + // apply skew + apply_skew(tempbitmap, 40); + + // resample to the target size + render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); } @@ -1572,107 +1572,107 @@ void layout_element::component::draw_led14seg(bitmap_argb32 &dest, const rectang void layout_element::component::draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern) { - const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); - const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20); - - // sizes for computation - int bmwidth = 250; - int bmheight = 400; - int segwidth = 40; - int skewwidth = 40; - - // allocate a temporary bitmap for drawing, adding some extra space for the tail - bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth); - tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00)); - - // top bar - draw_segment_horizontal(tempbitmap, - 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, - segwidth, (pattern & (1 << 0)) ? onpen : offpen); - - // right-top bar - draw_segment_vertical(tempbitmap, - 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, - segwidth, (pattern & (1 << 1)) ? onpen : offpen); - - // right-bottom bar - draw_segment_vertical(tempbitmap, - bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, - segwidth, (pattern & (1 << 2)) ? onpen : offpen); - - // bottom bar - draw_segment_horizontal(tempbitmap, - 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, - segwidth, (pattern & (1 << 3)) ? onpen : offpen); - - // left-bottom bar - draw_segment_vertical(tempbitmap, - bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, - segwidth, (pattern & (1 << 4)) ? onpen : offpen); - - // left-top bar - draw_segment_vertical(tempbitmap, - 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, - segwidth, (pattern & (1 << 5)) ? onpen : offpen); - - // horizontal-middle-left bar - draw_segment_horizontal_caps(tempbitmap, - 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2, - segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen); - - // horizontal-middle-right bar - draw_segment_horizontal_caps(tempbitmap, - 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2, - segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen); - - // vertical-middle-top bar - draw_segment_vertical_caps(tempbitmap, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2, - segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen); - - // vertical-middle-bottom bar - draw_segment_vertical_caps(tempbitmap, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2, - segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen); - - // diagonal-left-bottom bar - draw_segment_diagonal_1(tempbitmap, - 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, - segwidth, (pattern & (1 << 10)) ? onpen : offpen); - - // diagonal-left-top bar - draw_segment_diagonal_2(tempbitmap, - 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, - segwidth, (pattern & (1 << 11)) ? onpen : offpen); - - // diagonal-right-top bar - draw_segment_diagonal_1(tempbitmap, - bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, - segwidth, (pattern & (1 << 12)) ? onpen : offpen); - - // diagonal-right-bottom bar - draw_segment_diagonal_2(tempbitmap, - bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, - segwidth, (pattern & (1 << 13)) ? onpen : offpen); - - // apply skew - apply_skew(tempbitmap, 40); - - // comma tail - draw_segment_diagonal_1(tempbitmap, - bmwidth - (segwidth/2), bmwidth + segwidth, - bmheight - (segwidth), bmheight + segwidth*1.5, - segwidth/2, (pattern & (1 << 15)) ? onpen : offpen); - - // decimal point - draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 14)) ? onpen : offpen); - - // resample to the target size - render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); + const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); + const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20); + + // sizes for computation + int bmwidth = 250; + int bmheight = 400; + int segwidth = 40; + int skewwidth = 40; + + // allocate a temporary bitmap for drawing, adding some extra space for the tail + bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth); + tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00)); + + // top bar + draw_segment_horizontal(tempbitmap, + 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, 0 + segwidth/2, + segwidth, (pattern & (1 << 0)) ? onpen : offpen); + + // right-top bar + draw_segment_vertical(tempbitmap, + 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, + segwidth, (pattern & (1 << 1)) ? onpen : offpen); + + // right-bottom bar + draw_segment_vertical(tempbitmap, + bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, + segwidth, (pattern & (1 << 2)) ? onpen : offpen); + + // bottom bar + draw_segment_horizontal(tempbitmap, + 0 + 2*segwidth/3, bmwidth - 2*segwidth/3, bmheight - segwidth/2, + segwidth, (pattern & (1 << 3)) ? onpen : offpen); + + // left-bottom bar + draw_segment_vertical(tempbitmap, + bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, + segwidth, (pattern & (1 << 4)) ? onpen : offpen); + + // left-top bar + draw_segment_vertical(tempbitmap, + 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, + segwidth, (pattern & (1 << 5)) ? onpen : offpen); + + // horizontal-middle-left bar + draw_segment_horizontal_caps(tempbitmap, + 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2, + segwidth, LINE_CAP_START, (pattern & (1 << 6)) ? onpen : offpen); + + // horizontal-middle-right bar + draw_segment_horizontal_caps(tempbitmap, + 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2, + segwidth, LINE_CAP_END, (pattern & (1 << 7)) ? onpen : offpen); + + // vertical-middle-top bar + draw_segment_vertical_caps(tempbitmap, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2, + segwidth, LINE_CAP_NONE, (pattern & (1 << 8)) ? onpen : offpen); + + // vertical-middle-bottom bar + draw_segment_vertical_caps(tempbitmap, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2, + segwidth, LINE_CAP_NONE, (pattern & (1 << 9)) ? onpen : offpen); + + // diagonal-left-bottom bar + draw_segment_diagonal_1(tempbitmap, + 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, + segwidth, (pattern & (1 << 10)) ? onpen : offpen); + + // diagonal-left-top bar + draw_segment_diagonal_2(tempbitmap, + 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, + segwidth, (pattern & (1 << 11)) ? onpen : offpen); + + // diagonal-right-top bar + draw_segment_diagonal_1(tempbitmap, + bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, + segwidth, (pattern & (1 << 12)) ? onpen : offpen); + + // diagonal-right-bottom bar + draw_segment_diagonal_2(tempbitmap, + bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, + segwidth, (pattern & (1 << 13)) ? onpen : offpen); + + // apply skew + apply_skew(tempbitmap, 40); + + // comma tail + draw_segment_diagonal_1(tempbitmap, + bmwidth - (segwidth/2), bmwidth + segwidth, + bmheight - (segwidth), bmheight + segwidth*1.5, + segwidth/2, (pattern & (1 << 15)) ? onpen : offpen); + + // decimal point + draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 14)) ? onpen : offpen); + + // resample to the target size + render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); } @@ -1682,108 +1682,108 @@ void layout_element::component::draw_led14segsc(bitmap_argb32 &dest, const recta void layout_element::component::draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern) { - const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); - const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20); - - // sizes for computation - int bmwidth = 250; - int bmheight = 400; - int segwidth = 40; - int skewwidth = 40; - - // allocate a temporary bitmap for drawing - bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight); - tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00)); - - // top-left bar - draw_segment_horizontal_caps(tempbitmap, - 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2, - segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen); - - // top-right bar - draw_segment_horizontal_caps(tempbitmap, - 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2, - segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen); - - // right-top bar - draw_segment_vertical(tempbitmap, - 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, - segwidth, (pattern & (1 << 2)) ? onpen : offpen); - - // right-bottom bar - draw_segment_vertical(tempbitmap, - bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, - segwidth, (pattern & (1 << 3)) ? onpen : offpen); - - // bottom-right bar - draw_segment_horizontal_caps(tempbitmap, - 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2, - segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen); - - // bottom-left bar - draw_segment_horizontal_caps(tempbitmap, - 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2, - segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen); - - // left-bottom bar - draw_segment_vertical(tempbitmap, - bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, - segwidth, (pattern & (1 << 6)) ? onpen : offpen); - - // left-top bar - draw_segment_vertical(tempbitmap, - 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, - segwidth, (pattern & (1 << 7)) ? onpen : offpen); - - // horizontal-middle-left bar - draw_segment_horizontal_caps(tempbitmap, - 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2, - segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen); - - // horizontal-middle-right bar - draw_segment_horizontal_caps(tempbitmap, - 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2, - segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen); - - // vertical-middle-top bar - draw_segment_vertical_caps(tempbitmap, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2, - segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen); - - // vertical-middle-bottom bar - draw_segment_vertical_caps(tempbitmap, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2, - segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen); - - // diagonal-left-bottom bar - draw_segment_diagonal_1(tempbitmap, - 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, - segwidth, (pattern & (1 << 12)) ? onpen : offpen); - - // diagonal-left-top bar - draw_segment_diagonal_2(tempbitmap, - 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, - segwidth, (pattern & (1 << 13)) ? onpen : offpen); - - // diagonal-right-top bar - draw_segment_diagonal_1(tempbitmap, - bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, - segwidth, (pattern & (1 << 14)) ? onpen : offpen); - - // diagonal-right-bottom bar - draw_segment_diagonal_2(tempbitmap, - bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, - segwidth, (pattern & (1 << 15)) ? onpen : offpen); - - // apply skew - apply_skew(tempbitmap, 40); - - // resample to the target size - render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); + const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); + const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20); + + // sizes for computation + int bmwidth = 250; + int bmheight = 400; + int segwidth = 40; + int skewwidth = 40; + + // allocate a temporary bitmap for drawing + bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight); + tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00)); + + // top-left bar + draw_segment_horizontal_caps(tempbitmap, + 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2, + segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen); + + // top-right bar + draw_segment_horizontal_caps(tempbitmap, + 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2, + segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen); + + // right-top bar + draw_segment_vertical(tempbitmap, + 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, + segwidth, (pattern & (1 << 2)) ? onpen : offpen); + + // right-bottom bar + draw_segment_vertical(tempbitmap, + bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, + segwidth, (pattern & (1 << 3)) ? onpen : offpen); + + // bottom-right bar + draw_segment_horizontal_caps(tempbitmap, + 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2, + segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen); + + // bottom-left bar + draw_segment_horizontal_caps(tempbitmap, + 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2, + segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen); + + // left-bottom bar + draw_segment_vertical(tempbitmap, + bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, + segwidth, (pattern & (1 << 6)) ? onpen : offpen); + + // left-top bar + draw_segment_vertical(tempbitmap, + 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, + segwidth, (pattern & (1 << 7)) ? onpen : offpen); + + // horizontal-middle-left bar + draw_segment_horizontal_caps(tempbitmap, + 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2, + segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen); + + // horizontal-middle-right bar + draw_segment_horizontal_caps(tempbitmap, + 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2, + segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen); + + // vertical-middle-top bar + draw_segment_vertical_caps(tempbitmap, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2, + segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen); + + // vertical-middle-bottom bar + draw_segment_vertical_caps(tempbitmap, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2, + segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen); + + // diagonal-left-bottom bar + draw_segment_diagonal_1(tempbitmap, + 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, + segwidth, (pattern & (1 << 12)) ? onpen : offpen); + + // diagonal-left-top bar + draw_segment_diagonal_2(tempbitmap, + 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, + segwidth, (pattern & (1 << 13)) ? onpen : offpen); + + // diagonal-right-top bar + draw_segment_diagonal_1(tempbitmap, + bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, + segwidth, (pattern & (1 << 14)) ? onpen : offpen); + + // diagonal-right-bottom bar + draw_segment_diagonal_2(tempbitmap, + bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, + segwidth, (pattern & (1 << 15)) ? onpen : offpen); + + // apply skew + apply_skew(tempbitmap, 40); + + // resample to the target size + render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); } @@ -1794,117 +1794,117 @@ void layout_element::component::draw_led16seg(bitmap_argb32 &dest, const rectang void layout_element::component::draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern) { - const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); - const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20); - - // sizes for computation - int bmwidth = 250; - int bmheight = 400; - int segwidth = 40; - int skewwidth = 40; - - // allocate a temporary bitmap for drawing - bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth); - tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00)); - - // top-left bar - draw_segment_horizontal_caps(tempbitmap, - 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2, - segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen); - - // top-right bar - draw_segment_horizontal_caps(tempbitmap, - 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2, - segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen); - - // right-top bar - draw_segment_vertical(tempbitmap, - 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, - segwidth, (pattern & (1 << 2)) ? onpen : offpen); - - // right-bottom bar - draw_segment_vertical(tempbitmap, - bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, - segwidth, (pattern & (1 << 3)) ? onpen : offpen); - - // bottom-right bar - draw_segment_horizontal_caps(tempbitmap, - 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2, - segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen); - - // bottom-left bar - draw_segment_horizontal_caps(tempbitmap, - 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2, - segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen); - - // left-bottom bar - draw_segment_vertical(tempbitmap, - bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, - segwidth, (pattern & (1 << 6)) ? onpen : offpen); - - // left-top bar - draw_segment_vertical(tempbitmap, - 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, - segwidth, (pattern & (1 << 7)) ? onpen : offpen); - - // horizontal-middle-left bar - draw_segment_horizontal_caps(tempbitmap, - 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2, - segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen); - - // horizontal-middle-right bar - draw_segment_horizontal_caps(tempbitmap, - 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2, - segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen); - - // vertical-middle-top bar - draw_segment_vertical_caps(tempbitmap, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2, - segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen); - - // vertical-middle-bottom bar - draw_segment_vertical_caps(tempbitmap, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2, - segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen); - - // diagonal-left-bottom bar - draw_segment_diagonal_1(tempbitmap, - 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, - segwidth, (pattern & (1 << 12)) ? onpen : offpen); - - // diagonal-left-top bar - draw_segment_diagonal_2(tempbitmap, - 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, - segwidth, (pattern & (1 << 13)) ? onpen : offpen); - - // diagonal-right-top bar - draw_segment_diagonal_1(tempbitmap, - bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, - 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, - segwidth, (pattern & (1 << 14)) ? onpen : offpen); - - // diagonal-right-bottom bar - draw_segment_diagonal_2(tempbitmap, - bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, - bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, - segwidth, (pattern & (1 << 15)) ? onpen : offpen); - - // comma tail - draw_segment_diagonal_1(tempbitmap, - bmwidth - (segwidth/2), bmwidth + segwidth, - bmheight - (segwidth), bmheight + segwidth*1.5, - segwidth/2, (pattern & (1 << 17)) ? onpen : offpen); - - // decimal point (draw last for priority) - draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 16)) ? onpen : offpen); - - // apply skew - apply_skew(tempbitmap, 40); - - // resample to the target size - render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); + const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); + const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20); + + // sizes for computation + int bmwidth = 250; + int bmheight = 400; + int segwidth = 40; + int skewwidth = 40; + + // allocate a temporary bitmap for drawing + bitmap_argb32 tempbitmap(bmwidth + skewwidth, bmheight + segwidth); + tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00)); + + // top-left bar + draw_segment_horizontal_caps(tempbitmap, + 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, 0 + segwidth/2, + segwidth, LINE_CAP_START, (pattern & (1 << 0)) ? onpen : offpen); + + // top-right bar + draw_segment_horizontal_caps(tempbitmap, + 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, 0 + segwidth/2, + segwidth, LINE_CAP_END, (pattern & (1 << 1)) ? onpen : offpen); + + // right-top bar + draw_segment_vertical(tempbitmap, + 0 + 2*segwidth/3, bmheight/2 - segwidth/3, bmwidth - segwidth/2, + segwidth, (pattern & (1 << 2)) ? onpen : offpen); + + // right-bottom bar + draw_segment_vertical(tempbitmap, + bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, bmwidth - segwidth/2, + segwidth, (pattern & (1 << 3)) ? onpen : offpen); + + // bottom-right bar + draw_segment_horizontal_caps(tempbitmap, + 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight - segwidth/2, + segwidth, LINE_CAP_END, (pattern & (1 << 4)) ? onpen : offpen); + + // bottom-left bar + draw_segment_horizontal_caps(tempbitmap, + 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight - segwidth/2, + segwidth, LINE_CAP_START, (pattern & (1 << 5)) ? onpen : offpen); + + // left-bottom bar + draw_segment_vertical(tempbitmap, + bmheight/2 + segwidth/3, bmheight - 2*segwidth/3, 0 + segwidth/2, + segwidth, (pattern & (1 << 6)) ? onpen : offpen); + + // left-top bar + draw_segment_vertical(tempbitmap, + 0 + 2*segwidth/3, bmheight/2 - segwidth/3, 0 + segwidth/2, + segwidth, (pattern & (1 << 7)) ? onpen : offpen); + + // horizontal-middle-left bar + draw_segment_horizontal_caps(tempbitmap, + 0 + 2*segwidth/3, bmwidth/2 - segwidth/10, bmheight/2, + segwidth, LINE_CAP_START, (pattern & (1 << 8)) ? onpen : offpen); + + // horizontal-middle-right bar + draw_segment_horizontal_caps(tempbitmap, + 0 + bmwidth/2 + segwidth/10, bmwidth - 2*segwidth/3, bmheight/2, + segwidth, LINE_CAP_END, (pattern & (1 << 9)) ? onpen : offpen); + + // vertical-middle-top bar + draw_segment_vertical_caps(tempbitmap, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, bmwidth/2, + segwidth, LINE_CAP_NONE, (pattern & (1 << 10)) ? onpen : offpen); + + // vertical-middle-bottom bar + draw_segment_vertical_caps(tempbitmap, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, bmwidth/2, + segwidth, LINE_CAP_NONE, (pattern & (1 << 11)) ? onpen : offpen); + + // diagonal-left-bottom bar + draw_segment_diagonal_1(tempbitmap, + 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, + segwidth, (pattern & (1 << 12)) ? onpen : offpen); + + // diagonal-left-top bar + draw_segment_diagonal_2(tempbitmap, + 0 + segwidth + segwidth/5, bmwidth/2 - segwidth/2 - segwidth/5, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, + segwidth, (pattern & (1 << 13)) ? onpen : offpen); + + // diagonal-right-top bar + draw_segment_diagonal_1(tempbitmap, + bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, + 0 + segwidth + segwidth/3, bmheight/2 - segwidth/2 - segwidth/3, + segwidth, (pattern & (1 << 14)) ? onpen : offpen); + + // diagonal-right-bottom bar + draw_segment_diagonal_2(tempbitmap, + bmwidth/2 + segwidth/2 + segwidth/5, bmwidth - segwidth - segwidth/5, + bmheight/2 + segwidth/2 + segwidth/3, bmheight - segwidth - segwidth/3, + segwidth, (pattern & (1 << 15)) ? onpen : offpen); + + // comma tail + draw_segment_diagonal_1(tempbitmap, + bmwidth - (segwidth/2), bmwidth + segwidth, + bmheight - (segwidth), bmheight + segwidth*1.5, + segwidth/2, (pattern & (1 << 17)) ? onpen : offpen); + + // decimal point (draw last for priority) + draw_segment_decimal(tempbitmap, bmwidth + segwidth/2, bmheight - segwidth/2, segwidth, (pattern & (1 << 16)) ? onpen : offpen); + + // apply skew + apply_skew(tempbitmap, 40); + + // resample to the target size + render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); } @@ -1915,22 +1915,22 @@ void layout_element::component::draw_led16segsc(bitmap_argb32 &dest, const recta void layout_element::component::draw_dotmatrix(int dots, bitmap_argb32 &dest, const rectangle &bounds, int pattern) { - const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); - const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20); + const rgb_t onpen = rgb_t(0xff, 0xff, 0xff, 0xff); + const rgb_t offpen = rgb_t(0xff, 0x20, 0x20, 0x20); - // sizes for computation - int bmheight = 300; - int dotwidth = 250; + // sizes for computation + int bmheight = 300; + int dotwidth = 250; - // allocate a temporary bitmap for drawing - bitmap_argb32 tempbitmap(dotwidth*dots, bmheight); - tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00)); + // allocate a temporary bitmap for drawing + bitmap_argb32 tempbitmap(dotwidth*dots, bmheight); + tempbitmap.fill(rgb_t(0xff, 0x00, 0x00, 0x00)); - for (int i = 0; i < dots; i++) - draw_segment_decimal(tempbitmap, ((dotwidth/2 )+ (i * dotwidth)), bmheight/2, dotwidth, (pattern & (1 << i))?onpen:offpen); + for (int i = 0; i < dots; i++) + draw_segment_decimal(tempbitmap, ((dotwidth/2 )+ (i * dotwidth)), bmheight/2, dotwidth, (pattern & (1 << i))?onpen:offpen); - // resample to the target size - render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); + // resample to the target size + render_resample_argb_bitmap_hq(dest, tempbitmap, m_color); } @@ -1942,17 +1942,17 @@ void layout_element::component::draw_dotmatrix(int dots, bitmap_argb32 &dest, co void layout_element::component::draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color) { - // loop over the width of the segment - for (int y = 0; y < width / 2; y++) - { - UINT32 *d0 = &dest.pix32(midy - y); - UINT32 *d1 = &dest.pix32(midy + y); - int ty = (y < width / 8) ? width / 8 : y; - - // loop over the length of the segment - for (int x = minx + ((caps & LINE_CAP_START) ? ty : 0); x < maxx - ((caps & LINE_CAP_END) ? ty : 0); x++) - d0[x] = d1[x] = color; - } + // loop over the width of the segment + for (int y = 0; y < width / 2; y++) + { + UINT32 *d0 = &dest.pix32(midy - y); + UINT32 *d1 = &dest.pix32(midy + y); + int ty = (y < width / 8) ? width / 8 : y; + + // loop over the length of the segment + for (int x = minx + ((caps & LINE_CAP_START) ? ty : 0); x < maxx - ((caps & LINE_CAP_END) ? ty : 0); x++) + d0[x] = d1[x] = color; + } } @@ -1963,7 +1963,7 @@ void layout_element::component::draw_segment_horizontal_caps(bitmap_argb32 &dest void layout_element::component::draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color) { - draw_segment_horizontal_caps(dest, minx, maxx, midy, width, LINE_CAP_START | LINE_CAP_END, color); + draw_segment_horizontal_caps(dest, minx, maxx, midy, width, LINE_CAP_START | LINE_CAP_END, color); } @@ -1975,17 +1975,17 @@ void layout_element::component::draw_segment_horizontal(bitmap_argb32 &dest, int void layout_element::component::draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color) { - // loop over the width of the segment - for (int x = 0; x < width / 2; x++) - { - UINT32 *d0 = &dest.pix32(0, midx - x); - UINT32 *d1 = &dest.pix32(0, midx + x); - int tx = (x < width / 8) ? width / 8 : x; - - // loop over the length of the segment - for (int y = miny + ((caps & LINE_CAP_START) ? tx : 0); y < maxy - ((caps & LINE_CAP_END) ? tx : 0); y++) - d0[y * dest.rowpixels()] = d1[y * dest.rowpixels()] = color; - } + // loop over the width of the segment + for (int x = 0; x < width / 2; x++) + { + UINT32 *d0 = &dest.pix32(0, midx - x); + UINT32 *d1 = &dest.pix32(0, midx + x); + int tx = (x < width / 8) ? width / 8 : x; + + // loop over the length of the segment + for (int y = miny + ((caps & LINE_CAP_START) ? tx : 0); y < maxy - ((caps & LINE_CAP_END) ? tx : 0); y++) + d0[y * dest.rowpixels()] = d1[y * dest.rowpixels()] = color; + } } @@ -1996,7 +1996,7 @@ void layout_element::component::draw_segment_vertical_caps(bitmap_argb32 &dest, void layout_element::component::draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color) { - draw_segment_vertical_caps(dest, miny, maxy, midx, width, LINE_CAP_START | LINE_CAP_END, color); + draw_segment_vertical_caps(dest, miny, maxy, midx, width, LINE_CAP_START | LINE_CAP_END, color); } @@ -2007,21 +2007,21 @@ void layout_element::component::draw_segment_vertical(bitmap_argb32 &dest, int m void layout_element::component::draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color) { - // compute parameters - width *= 1.5; - float ratio = (maxy - miny - width) / (float)(maxx - minx); - - // draw line - for (int x = minx; x < maxx; x++) - if (x >= 0 && x < dest.width()) - { - UINT32 *d = &dest.pix32(0, x); - int step = (x - minx) * ratio; - - for (int y = maxy - width - step; y < maxy - step; y++) - if (y >= 0 && y < dest.height()) - d[y * dest.rowpixels()] = color; - } + // compute parameters + width *= 1.5; + float ratio = (maxy - miny - width) / (float)(maxx - minx); + + // draw line + for (int x = minx; x < maxx; x++) + if (x >= 0 && x < dest.width()) + { + UINT32 *d = &dest.pix32(0, x); + int step = (x - minx) * ratio; + + for (int y = maxy - width - step; y < maxy - step; y++) + if (y >= 0 && y < dest.height()) + d[y * dest.rowpixels()] = color; + } } @@ -2032,21 +2032,21 @@ void layout_element::component::draw_segment_diagonal_1(bitmap_argb32 &dest, int void layout_element::component::draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color) { - // compute parameters - width *= 1.5; - float ratio = (maxy - miny - width) / (float)(maxx - minx); - - // draw line - for (int x = minx; x < maxx; x++) - if (x >= 0 && x < dest.width()) - { - UINT32 *d = &dest.pix32(0, x); - int step = (x - minx) * ratio; - - for (int y = miny + step; y < miny + step + width; y++) - if (y >= 0 && y < dest.height()) - d[y * dest.rowpixels()] = color; - } + // compute parameters + width *= 1.5; + float ratio = (maxy - miny - width) / (float)(maxx - minx); + + // draw line + for (int x = minx; x < maxx; x++) + if (x >= 0 && x < dest.width()) + { + UINT32 *d = &dest.pix32(0, x); + int step = (x - minx) * ratio; + + for (int y = miny + step; y < miny + step + width; y++) + if (y >= 0 && y < dest.height()) + d[y * dest.rowpixels()] = color; + } } @@ -2056,26 +2056,26 @@ void layout_element::component::draw_segment_diagonal_2(bitmap_argb32 &dest, int void layout_element::component::draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color) { - // compute parameters - width /= 2; - float ooradius2 = 1.0f / (float)(width * width); - - // iterate over y - for (UINT32 y = 0; y <= width; y++) - { - UINT32 *d0 = &dest.pix32(midy - y); - UINT32 *d1 = &dest.pix32(midy + y); - float xval = width * sqrt(1.0f - (float)(y * y) * ooradius2); - INT32 left, right; - - // compute left/right coordinates - left = midx - (INT32)(xval + 0.5f); - right = midx + (INT32)(xval + 0.5f); - - // draw this scanline - for (UINT32 x = left; x < right; x++) - d0[x] = d1[x] = color; - } + // compute parameters + width /= 2; + float ooradius2 = 1.0f / (float)(width * width); + + // iterate over y + for (UINT32 y = 0; y <= width; y++) + { + UINT32 *d0 = &dest.pix32(midy - y); + UINT32 *d1 = &dest.pix32(midy + y); + float xval = width * sqrt(1.0f - (float)(y * y) * ooradius2); + INT32 left, right; + + // compute left/right coordinates + left = midx - (INT32)(xval + 0.5f); + right = midx + (INT32)(xval + 0.5f); + + // draw this scanline + for (UINT32 x = left; x < right; x++) + d0[x] = d1[x] = color; + } } @@ -2085,19 +2085,19 @@ void layout_element::component::draw_segment_decimal(bitmap_argb32 &dest, int mi void layout_element::component::draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color) { - // compute parameters - width *= 1.5; - float ratio = (maxy - miny - width) / (float)(maxx - minx); - - // draw line - for (int x = minx; x < maxx; x++) - { - UINT32 *d = &dest.pix32(0, x); - int step = (x - minx) * ratio; - - for (int y = maxy; y < maxy - width - step; y--) - d[y * dest.rowpixels()] = color; - } + // compute parameters + width *= 1.5; + float ratio = (maxy - miny - width) / (float)(maxx - minx); + + // draw line + for (int x = minx; x < maxx; x++) + { + UINT32 *d = &dest.pix32(0, x); + int step = (x - minx) * ratio; + + for (int y = maxy; y < maxy - width - step; y--) + d[y * dest.rowpixels()] = color; + } } @@ -2107,15 +2107,15 @@ void layout_element::component::draw_segment_comma(bitmap_argb32 &dest, int minx void layout_element::component::apply_skew(bitmap_argb32 &dest, int skewwidth) { - for (int y = 0; y < dest.height(); y++) - { - UINT32 *destrow = &dest.pix32(y); - int offs = skewwidth * (dest.height() - y) / dest.height(); - for (int x = dest.width() - skewwidth - 1; x >= 0; x--) - destrow[x + offs] = destrow[x]; - for (int x = 0; x < offs; x++) - destrow[x] = 0; - } + for (int y = 0; y < dest.height(); y++) + { + UINT32 *destrow = &dest.pix32(y); + int offs = skewwidth * (dest.height() - y) / dest.height(); + for (int x = dest.width() - skewwidth - 1; x >= 0; x--) + destrow[x + offs] = destrow[x]; + for (int x = 0; x < offs; x++) + destrow[x] = 0; + } } @@ -2129,45 +2129,45 @@ void layout_element::component::apply_skew(bitmap_argb32 &dest, int skewwidth) //------------------------------------------------- layout_view::layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist) - : m_next(NULL), - m_aspect(1.0f), - m_scraspect(1.0f) + : m_next(NULL), + m_aspect(1.0f), + m_scraspect(1.0f) { - // allocate a copy of the name - m_name = xml_get_attribute_string_with_subst(machine, viewnode, "name", ""); + // allocate a copy of the name + m_name = xml_get_attribute_string_with_subst(machine, viewnode, "name", ""); - // if we have a bounds item, load it - xml_data_node *boundsnode = xml_get_sibling(viewnode.child, "bounds"); - m_expbounds.x0 = m_expbounds.y0 = m_expbounds.x1 = m_expbounds.y1 = 0; - if (boundsnode != NULL) - parse_bounds(machine, xml_get_sibling(boundsnode, "bounds"), m_expbounds); + // if we have a bounds item, load it + xml_data_node *boundsnode = xml_get_sibling(viewnode.child, "bounds"); + m_expbounds.x0 = m_expbounds.y0 = m_expbounds.x1 = m_expbounds.y1 = 0; + if (boundsnode != NULL) + parse_bounds(machine, xml_get_sibling(boundsnode, "bounds"), m_expbounds); - // load backdrop items - for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "backdrop"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "backdrop")) - m_backdrop_list.append(*global_alloc(item(machine, *itemnode, elemlist))); + // load backdrop items + for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "backdrop"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "backdrop")) + m_backdrop_list.append(*global_alloc(item(machine, *itemnode, elemlist))); - // load screen items - for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "screen"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "screen")) - m_screen_list.append(*global_alloc(item(machine, *itemnode, elemlist))); + // load screen items + for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "screen"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "screen")) + m_screen_list.append(*global_alloc(item(machine, *itemnode, elemlist))); - // load overlay items - for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "overlay"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "overlay")) - m_overlay_list.append(*global_alloc(item(machine, *itemnode, elemlist))); + // load overlay items + for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "overlay"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "overlay")) + m_overlay_list.append(*global_alloc(item(machine, *itemnode, elemlist))); - // load bezel items - for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "bezel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "bezel")) - m_bezel_list.append(*global_alloc(item(machine, *itemnode, elemlist))); + // load bezel items + for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "bezel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "bezel")) + m_bezel_list.append(*global_alloc(item(machine, *itemnode, elemlist))); - // load cpanel items - for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "cpanel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "cpanel")) - m_cpanel_list.append(*global_alloc(item(machine, *itemnode, elemlist))); + // load cpanel items + for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "cpanel"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "cpanel")) + m_cpanel_list.append(*global_alloc(item(machine, *itemnode, elemlist))); - // load marquee items - for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "marquee"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "marquee")) - m_marquee_list.append(*global_alloc(item(machine, *itemnode, elemlist))); + // load marquee items + for (xml_data_node *itemnode = xml_get_sibling(viewnode.child, "marquee"); itemnode != NULL; itemnode = xml_get_sibling(itemnode->next, "marquee")) + m_marquee_list.append(*global_alloc(item(machine, *itemnode, elemlist))); - // recompute the data for the view based on a default layer config - recompute(render_layer_config()); + // recompute the data for the view based on a default layer config + recompute(render_layer_config()); } @@ -2187,16 +2187,16 @@ layout_view::~layout_view() layout_view::item *layout_view::first_item(item_layer layer) const { - switch (layer) - { - case ITEM_LAYER_BACKDROP: return m_backdrop_list.first(); - case ITEM_LAYER_SCREEN: return m_screen_list.first(); - case ITEM_LAYER_OVERLAY: return m_overlay_list.first(); - case ITEM_LAYER_BEZEL: return m_bezel_list.first(); - case ITEM_LAYER_CPANEL: return m_cpanel_list.first(); - case ITEM_LAYER_MARQUEE: return m_marquee_list.first(); - default: return NULL; - } + switch (layer) + { + case ITEM_LAYER_BACKDROP: return m_backdrop_list.first(); + case ITEM_LAYER_SCREEN: return m_screen_list.first(); + case ITEM_LAYER_OVERLAY: return m_overlay_list.first(); + case ITEM_LAYER_BEZEL: return m_bezel_list.first(); + case ITEM_LAYER_CPANEL: return m_cpanel_list.first(); + case ITEM_LAYER_MARQUEE: return m_marquee_list.first(); + default: return NULL; + } } @@ -2207,97 +2207,97 @@ layout_view::item *layout_view::first_item(item_layer layer) const void layout_view::recompute(render_layer_config layerconfig) { - // reset the bounds - m_bounds.x0 = m_bounds.y0 = m_bounds.x1 = m_bounds.y1 = 0.0f; - m_scrbounds.x0 = m_scrbounds.y0 = m_scrbounds.x1 = m_scrbounds.y1 = 0.0f; - m_screens.reset(); - - // loop over all layers - bool first = true; - bool scrfirst = true; - for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++) - { - // determine if this layer should be visible - switch (layer) - { - case ITEM_LAYER_BACKDROP: m_layenabled[layer] = layerconfig.backdrops_enabled(); break; - case ITEM_LAYER_OVERLAY: m_layenabled[layer] = layerconfig.overlays_enabled(); break; - case ITEM_LAYER_BEZEL: m_layenabled[layer] = layerconfig.bezels_enabled(); break; - case ITEM_LAYER_CPANEL: m_layenabled[layer] = layerconfig.cpanels_enabled(); break; - case ITEM_LAYER_MARQUEE: m_layenabled[layer] = layerconfig.marquees_enabled(); break; - default: m_layenabled[layer] = true; break; - } - - // only do it if requested - if (m_layenabled[layer]) - for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next()) - { - // accumulate bounds - if (first) - m_bounds = curitem->m_rawbounds; - else - union_render_bounds(&m_bounds, &curitem->m_rawbounds); - first = false; - - // accumulate screen bounds - if (curitem->m_screen != NULL) - { - if (scrfirst) - m_scrbounds = curitem->m_rawbounds; - else - union_render_bounds(&m_scrbounds, &curitem->m_rawbounds); - scrfirst = false; - - // accumulate the screens in use while we're scanning - m_screens.add(*curitem->m_screen); - } - } - } - - // if we have an explicit bounds, override it - if (m_expbounds.x1 > m_expbounds.x0) - m_bounds = m_expbounds; - - // if we're handling things normally, the target bounds are (0,0)-(1,1) - render_bounds target_bounds; - if (!layerconfig.zoom_to_screen() || m_screens.count() == 0) - { - // compute the aspect ratio of the view - m_aspect = (m_bounds.x1 - m_bounds.x0) / (m_bounds.y1 - m_bounds.y0); - - target_bounds.x0 = target_bounds.y0 = 0.0f; - target_bounds.x1 = target_bounds.y1 = 1.0f; - } - - // if we're cropping, we want the screen area to fill (0,0)-(1,1) - else - { - // compute the aspect ratio of the screen - m_scraspect = (m_scrbounds.x1 - m_scrbounds.x0) / (m_scrbounds.y1 - m_scrbounds.y0); - - float targwidth = (m_bounds.x1 - m_bounds.x0) / (m_scrbounds.x1 - m_scrbounds.x0); - float targheight = (m_bounds.y1 - m_bounds.y0) / (m_scrbounds.y1 - m_scrbounds.y0); - target_bounds.x0 = (m_bounds.x0 - m_scrbounds.x0) / (m_bounds.x1 - m_bounds.x0) * targwidth; - target_bounds.y0 = (m_bounds.y0 - m_scrbounds.y0) / (m_bounds.y1 - m_bounds.y0) * targheight; - target_bounds.x1 = target_bounds.x0 + targwidth; - target_bounds.y1 = target_bounds.y0 + targheight; - } - - // determine the scale/offset for normalization - float xoffs = m_bounds.x0; - float yoffs = m_bounds.y0; - float xscale = (target_bounds.x1 - target_bounds.x0) / (m_bounds.x1 - m_bounds.x0); - float yscale = (target_bounds.y1 - target_bounds.y0) / (m_bounds.y1 - m_bounds.y0); - - // normalize all the item bounds - for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++) - for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next()) - { - curitem->m_bounds.x0 = target_bounds.x0 + (curitem->m_rawbounds.x0 - xoffs) * xscale; - curitem->m_bounds.x1 = target_bounds.x0 + (curitem->m_rawbounds.x1 - xoffs) * xscale; - curitem->m_bounds.y0 = target_bounds.y0 + (curitem->m_rawbounds.y0 - yoffs) * yscale; - curitem->m_bounds.y1 = target_bounds.y0 + (curitem->m_rawbounds.y1 - yoffs) * yscale; - } + // reset the bounds + m_bounds.x0 = m_bounds.y0 = m_bounds.x1 = m_bounds.y1 = 0.0f; + m_scrbounds.x0 = m_scrbounds.y0 = m_scrbounds.x1 = m_scrbounds.y1 = 0.0f; + m_screens.reset(); + + // loop over all layers + bool first = true; + bool scrfirst = true; + for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++) + { + // determine if this layer should be visible + switch (layer) + { + case ITEM_LAYER_BACKDROP: m_layenabled[layer] = layerconfig.backdrops_enabled(); break; + case ITEM_LAYER_OVERLAY: m_layenabled[layer] = layerconfig.overlays_enabled(); break; + case ITEM_LAYER_BEZEL: m_layenabled[layer] = layerconfig.bezels_enabled(); break; + case ITEM_LAYER_CPANEL: m_layenabled[layer] = layerconfig.cpanels_enabled(); break; + case ITEM_LAYER_MARQUEE: m_layenabled[layer] = layerconfig.marquees_enabled(); break; + default: m_layenabled[layer] = true; break; + } + + // only do it if requested + if (m_layenabled[layer]) + for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next()) + { + // accumulate bounds + if (first) + m_bounds = curitem->m_rawbounds; + else + union_render_bounds(&m_bounds, &curitem->m_rawbounds); + first = false; + + // accumulate screen bounds + if (curitem->m_screen != NULL) + { + if (scrfirst) + m_scrbounds = curitem->m_rawbounds; + else + union_render_bounds(&m_scrbounds, &curitem->m_rawbounds); + scrfirst = false; + + // accumulate the screens in use while we're scanning + m_screens.add(*curitem->m_screen); + } + } + } + + // if we have an explicit bounds, override it + if (m_expbounds.x1 > m_expbounds.x0) + m_bounds = m_expbounds; + + // if we're handling things normally, the target bounds are (0,0)-(1,1) + render_bounds target_bounds; + if (!layerconfig.zoom_to_screen() || m_screens.count() == 0) + { + // compute the aspect ratio of the view + m_aspect = (m_bounds.x1 - m_bounds.x0) / (m_bounds.y1 - m_bounds.y0); + + target_bounds.x0 = target_bounds.y0 = 0.0f; + target_bounds.x1 = target_bounds.y1 = 1.0f; + } + + // if we're cropping, we want the screen area to fill (0,0)-(1,1) + else + { + // compute the aspect ratio of the screen + m_scraspect = (m_scrbounds.x1 - m_scrbounds.x0) / (m_scrbounds.y1 - m_scrbounds.y0); + + float targwidth = (m_bounds.x1 - m_bounds.x0) / (m_scrbounds.x1 - m_scrbounds.x0); + float targheight = (m_bounds.y1 - m_bounds.y0) / (m_scrbounds.y1 - m_scrbounds.y0); + target_bounds.x0 = (m_bounds.x0 - m_scrbounds.x0) / (m_bounds.x1 - m_bounds.x0) * targwidth; + target_bounds.y0 = (m_bounds.y0 - m_scrbounds.y0) / (m_bounds.y1 - m_bounds.y0) * targheight; + target_bounds.x1 = target_bounds.x0 + targwidth; + target_bounds.y1 = target_bounds.y0 + targheight; + } + + // determine the scale/offset for normalization + float xoffs = m_bounds.x0; + float yoffs = m_bounds.y0; + float xscale = (target_bounds.x1 - target_bounds.x0) / (m_bounds.x1 - m_bounds.x0); + float yscale = (target_bounds.y1 - target_bounds.y0) / (m_bounds.y1 - m_bounds.y0); + + // normalize all the item bounds + for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; layer++) + for (item *curitem = first_item(layer); curitem != NULL; curitem = curitem->next()) + { + curitem->m_bounds.x0 = target_bounds.x0 + (curitem->m_rawbounds.x0 - xoffs) * xscale; + curitem->m_bounds.x1 = target_bounds.x0 + (curitem->m_rawbounds.x1 - xoffs) * xscale; + curitem->m_bounds.y0 = target_bounds.y0 + (curitem->m_rawbounds.y0 - yoffs) * yscale; + curitem->m_bounds.y1 = target_bounds.y0 + (curitem->m_rawbounds.y1 - yoffs) * yscale; + } } @@ -2311,57 +2311,57 @@ void layout_view::recompute(render_layer_config layerconfig) //------------------------------------------------- layout_view::item::item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist) - : m_next(NULL), - m_element(NULL), - m_input_mask(0), - m_screen(NULL), - m_orientation(ROT0) + : m_next(NULL), + m_element(NULL), + m_input_mask(0), + m_screen(NULL), + m_orientation(ROT0) { - // allocate a copy of the output name - m_output_name = xml_get_attribute_string_with_subst(machine, itemnode, "name", ""); - - // allocate a copy of the input tag - m_input_tag = xml_get_attribute_string_with_subst(machine, itemnode, "inputtag", ""); - - // find the associated element - const char *name = xml_get_attribute_string_with_subst(machine, itemnode, "element", NULL); - if (name != NULL) - { - // search the list of elements for a match - for (m_element = elemlist.first(); m_element != NULL; m_element = m_element->next()) - if (strcmp(name, m_element->name()) == 0) - break; - - // error if not found - if (m_element == NULL) - throw emu_fatalerror("Unable to find layout element %s", name); - } - - // fetch common data - int index = xml_get_attribute_int_with_subst(machine, itemnode, "index", -1); - if (index != -1) - { - screen_device_iterator iter(machine.root_device()); - m_screen = iter.byindex(index); - } - m_input_mask = xml_get_attribute_int_with_subst(machine, itemnode, "inputmask", 0); - if (m_output_name[0] != 0 && m_element != NULL) - output_set_value(m_output_name, m_element->default_state()); - parse_bounds(machine, xml_get_sibling(itemnode.child, "bounds"), m_rawbounds); - parse_color(machine, xml_get_sibling(itemnode.child, "color"), m_color); - parse_orientation(machine, xml_get_sibling(itemnode.child, "orientation"), m_orientation); - - // sanity checks - if (strcmp(itemnode.name, "screen") == 0) - { - if (m_screen == NULL) - throw emu_fatalerror("Layout references invalid screen index %d", index); - } - else - { - if (m_element == NULL) - throw emu_fatalerror("Layout item of type %s require an element tag", itemnode.name); - } + // allocate a copy of the output name + m_output_name = xml_get_attribute_string_with_subst(machine, itemnode, "name", ""); + + // allocate a copy of the input tag + m_input_tag = xml_get_attribute_string_with_subst(machine, itemnode, "inputtag", ""); + + // find the associated element + const char *name = xml_get_attribute_string_with_subst(machine, itemnode, "element", NULL); + if (name != NULL) + { + // search the list of elements for a match + for (m_element = elemlist.first(); m_element != NULL; m_element = m_element->next()) + if (strcmp(name, m_element->name()) == 0) + break; + + // error if not found + if (m_element == NULL) + throw emu_fatalerror("Unable to find layout element %s", name); + } + + // fetch common data + int index = xml_get_attribute_int_with_subst(machine, itemnode, "index", -1); + if (index != -1) + { + screen_device_iterator iter(machine.root_device()); + m_screen = iter.byindex(index); + } + m_input_mask = xml_get_attribute_int_with_subst(machine, itemnode, "inputmask", 0); + if (m_output_name[0] != 0 && m_element != NULL) + output_set_value(m_output_name, m_element->default_state()); + parse_bounds(machine, xml_get_sibling(itemnode.child, "bounds"), m_rawbounds); + parse_color(machine, xml_get_sibling(itemnode.child, "color"), m_color); + parse_orientation(machine, xml_get_sibling(itemnode.child, "orientation"), m_orientation); + + // sanity checks + if (strcmp(itemnode.name, "screen") == 0) + { + if (m_screen == NULL) + throw emu_fatalerror("Layout references invalid screen index %d", index); + } + else + { + if (m_element == NULL) + throw emu_fatalerror("Layout item of type %s require an element tag", itemnode.name); + } } @@ -2381,7 +2381,7 @@ layout_view::item::~item() render_container *layout_view::item::screen_container(running_machine &machine) const { - return (m_screen != NULL) ? &m_screen->container() : NULL; + return (m_screen != NULL) ? &m_screen->container() : NULL; } //------------------------------------------------- @@ -2390,26 +2390,26 @@ render_container *layout_view::item::screen_container(running_machine &machine) int layout_view::item::state() const { - int state = 0; - - assert(m_element != NULL); - - // if configured to an output, fetch the output value - if (m_output_name[0] != 0) - state = output_get_value(m_output_name); - - // if configured to an input, fetch the input value - else if (m_input_tag[0] != 0) - { - ioport_port *port = m_element->machine().root_device().ioport(m_input_tag); - if (port != NULL) - { - ioport_field *field = port->field(m_input_mask); - if (field != NULL) - state = ((port->read() ^ field->defvalue()) & m_input_mask) ? 1 : 0; - } - } - return state; + int state = 0; + + assert(m_element != NULL); + + // if configured to an output, fetch the output value + if (m_output_name[0] != 0) + state = output_get_value(m_output_name); + + // if configured to an input, fetch the input value + else if (m_input_tag[0] != 0) + { + ioport_port *port = m_element->machine().root_device().ioport(m_input_tag); + if (port != NULL) + { + ioport_field *field = port->field(m_input_mask); + if (field != NULL) + state = ((port->read() ^ field->defvalue()) & m_input_mask) ? 1 : 0; + } + } + return state; } @@ -2423,25 +2423,25 @@ int layout_view::item::state() const //------------------------------------------------- layout_file::layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname) - : m_next(NULL) + : m_next(NULL) { - // find the layout node - xml_data_node *mamelayoutnode = xml_get_sibling(rootnode.child, "mamelayout"); - if (mamelayoutnode == NULL) - throw emu_fatalerror("Invalid XML file: missing mamelayout node"); - - // validate the config data version - int version = xml_get_attribute_int(mamelayoutnode, "version", 0); - if (version != LAYOUT_VERSION) - throw emu_fatalerror("Invalid XML file: unsupported version"); - - // parse all the elements - for (xml_data_node *elemnode = xml_get_sibling(mamelayoutnode->child, "element"); elemnode != NULL; elemnode = xml_get_sibling(elemnode->next, "element")) - m_elemlist.append(*global_alloc(layout_element(machine, *elemnode, dirname))); - - // parse all the views - for (xml_data_node *viewnode = xml_get_sibling(mamelayoutnode->child, "view"); viewnode != NULL; viewnode = xml_get_sibling(viewnode->next, "view")) - m_viewlist.append(*global_alloc(layout_view(machine, *viewnode, m_elemlist))); + // find the layout node + xml_data_node *mamelayoutnode = xml_get_sibling(rootnode.child, "mamelayout"); + if (mamelayoutnode == NULL) + throw emu_fatalerror("Invalid XML file: missing mamelayout node"); + + // validate the config data version + int version = xml_get_attribute_int(mamelayoutnode, "version", 0); + if (version != LAYOUT_VERSION) + throw emu_fatalerror("Invalid XML file: unsupported version"); + + // parse all the elements + for (xml_data_node *elemnode = xml_get_sibling(mamelayoutnode->child, "element"); elemnode != NULL; elemnode = xml_get_sibling(elemnode->next, "element")) + m_elemlist.append(*global_alloc(layout_element(machine, *elemnode, dirname))); + + // parse all the views + for (xml_data_node *viewnode = xml_get_sibling(mamelayoutnode->child, "view"); viewnode != NULL; viewnode = xml_get_sibling(viewnode->next, "view")) + m_viewlist.append(*global_alloc(layout_view(machine, *viewnode, m_elemlist))); } diff --git a/src/emu/rendlay.h b/src/emu/rendlay.h index b8c6c8cf41b..af2eff64e59 100644 --- a/src/emu/rendlay.h +++ b/src/emu/rendlay.h @@ -20,14 +20,14 @@ enum item_layer { - ITEM_LAYER_FIRST = 0, - ITEM_LAYER_BACKDROP = ITEM_LAYER_FIRST, - ITEM_LAYER_SCREEN, - ITEM_LAYER_OVERLAY, - ITEM_LAYER_BEZEL, - ITEM_LAYER_CPANEL, - ITEM_LAYER_MARQUEE, - ITEM_LAYER_MAX + ITEM_LAYER_FIRST = 0, + ITEM_LAYER_BACKDROP = ITEM_LAYER_FIRST, + ITEM_LAYER_SCREEN, + ITEM_LAYER_OVERLAY, + ITEM_LAYER_BEZEL, + ITEM_LAYER_CPANEL, + ITEM_LAYER_MARQUEE, + ITEM_LAYER_MAX }; DECLARE_ENUM_OPERATORS(item_layer); @@ -43,140 +43,140 @@ DECLARE_ENUM_OPERATORS(item_layer); // a layout_element is a single named element, which may have multiple components class layout_element { - friend class simple_list<layout_element>; + friend class simple_list<layout_element>; public: - // construction/destruction - layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname); - virtual ~layout_element(); - - // getters - layout_element *next() const { return m_next; } - const char *name() const { return m_name; } - running_machine &machine() const { return m_machine; } - int default_state() const { return m_defstate; } - int maxstate() const { return m_maxstate; } - render_texture *state_texture(int state); + // construction/destruction + layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname); + virtual ~layout_element(); + + // getters + layout_element *next() const { return m_next; } + const char *name() const { return m_name; } + running_machine &machine() const { return m_machine; } + int default_state() const { return m_defstate; } + int maxstate() const { return m_maxstate; } + render_texture *state_texture(int state); private: - // a component represents an image, rectangle, or disk in an element - class component - { - friend class layout_element; - friend class simple_list<component>; - - public: - // construction/destruction - component(running_machine &machine, xml_data_node &compnode, const char *dirname); - ~component(); - - // getters - component *next() const { return m_next; } - const render_bounds &bounds() const { return m_bounds; } - - // operations - void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); - - private: - // component types - enum component_type - { - CTYPE_INVALID = 0, - CTYPE_IMAGE, - CTYPE_RECT, - CTYPE_DISK, - CTYPE_TEXT, - CTYPE_LED7SEG, - CTYPE_LED8SEG_GTS1, - CTYPE_LED14SEG, - CTYPE_LED16SEG, - CTYPE_LED14SEGSC, - CTYPE_LED16SEGSC, - CTYPE_DOTMATRIX, - CTYPE_DOTMATRIX5DOT, - CTYPE_DOTMATRIXDOT, - CTYPE_SIMPLECOUNTER, - CTYPE_REEL, - CTYPE_MAX - }; - - // helpers - void draw_rect(bitmap_argb32 &dest, const rectangle &bounds); - void draw_disk(bitmap_argb32 &dest, const rectangle &bounds); - void draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds); - void draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); - void draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); - void draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); - void load_bitmap(); - void load_reel_bitmap(int number); - void draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); - void draw_led8seg_gts1(bitmap_argb32 &dest, const rectangle &bounds, int pattern); - void draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); - void draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern); - void draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); - void draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern); - void draw_dotmatrix(int dots,bitmap_argb32 &dest, const rectangle &bounds, int pattern); - void draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color); - void draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color); - void draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color); - void draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color); - void draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); - void draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); - void draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color); - void draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); - void apply_skew(bitmap_argb32 &dest, int skewwidth); - - #define MAX_BITMAPS 32 - - // internal state - component * m_next; // link to next component - component_type m_type; // type of component - int m_state; // state where this component is visible (-1 means all states) - render_bounds m_bounds; // bounds of the element - render_color m_color; // color of the element - astring m_string; // string for text components - int m_digits; // number of digits for simple counters - int m_textalign; // text alignment to box - bitmap_argb32 m_bitmap[MAX_BITMAPS]; // source bitmap for images - astring m_dirname; // directory name of image file (for lazy loading) - auto_pointer<emu_file> m_file[MAX_BITMAPS]; // file object for reading image/alpha files - astring m_imagefile[MAX_BITMAPS]; // name of the image file (for lazy loading) - astring m_alphafile[MAX_BITMAPS]; // name of the alpha file (for lazy loading) - bool m_hasalpha[MAX_BITMAPS]; // is there any alpha component present? - - // stuff for fruit machine reels - // basically made up of multiple text strings / gfx - int m_numstops; - astring m_stopnames[MAX_BITMAPS]; - int m_stateoffset; - int m_reelreversed; - int m_numsymbolsvisible; - int m_beltreel; - }; - - // a texture encapsulates a texture for a given element in a given state - class texture - { - public: - texture(); - ~texture(); - - layout_element * m_element; // pointer back to the element - render_texture * m_texture; // texture for this state - int m_state; // associated state number - }; - - // internal helpers - static void element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param); - - // internal state - layout_element * m_next; // link to next element - running_machine & m_machine; // reference to the owning machine - astring m_name; // name of this element - simple_list<component> m_complist; // list of components - int m_defstate; // default state of this element - int m_maxstate; // maximum state value for all components - dynamic_array<texture> m_elemtex; // array of element textures used for managing the scaled bitmaps + // a component represents an image, rectangle, or disk in an element + class component + { + friend class layout_element; + friend class simple_list<component>; + + public: + // construction/destruction + component(running_machine &machine, xml_data_node &compnode, const char *dirname); + ~component(); + + // getters + component *next() const { return m_next; } + const render_bounds &bounds() const { return m_bounds; } + + // operations + void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); + + private: + // component types + enum component_type + { + CTYPE_INVALID = 0, + CTYPE_IMAGE, + CTYPE_RECT, + CTYPE_DISK, + CTYPE_TEXT, + CTYPE_LED7SEG, + CTYPE_LED8SEG_GTS1, + CTYPE_LED14SEG, + CTYPE_LED16SEG, + CTYPE_LED14SEGSC, + CTYPE_LED16SEGSC, + CTYPE_DOTMATRIX, + CTYPE_DOTMATRIX5DOT, + CTYPE_DOTMATRIXDOT, + CTYPE_SIMPLECOUNTER, + CTYPE_REEL, + CTYPE_MAX + }; + + // helpers + void draw_rect(bitmap_argb32 &dest, const rectangle &bounds); + void draw_disk(bitmap_argb32 &dest, const rectangle &bounds); + void draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds); + void draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); + void draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); + void draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); + void load_bitmap(); + void load_reel_bitmap(int number); + void draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); + void draw_led8seg_gts1(bitmap_argb32 &dest, const rectangle &bounds, int pattern); + void draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); + void draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern); + void draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); + void draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern); + void draw_dotmatrix(int dots,bitmap_argb32 &dest, const rectangle &bounds, int pattern); + void draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color); + void draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color); + void draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color); + void draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color); + void draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); + void draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); + void draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color); + void draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); + void apply_skew(bitmap_argb32 &dest, int skewwidth); + + #define MAX_BITMAPS 32 + + // internal state + component * m_next; // link to next component + component_type m_type; // type of component + int m_state; // state where this component is visible (-1 means all states) + render_bounds m_bounds; // bounds of the element + render_color m_color; // color of the element + astring m_string; // string for text components + int m_digits; // number of digits for simple counters + int m_textalign; // text alignment to box + bitmap_argb32 m_bitmap[MAX_BITMAPS]; // source bitmap for images + astring m_dirname; // directory name of image file (for lazy loading) + auto_pointer<emu_file> m_file[MAX_BITMAPS]; // file object for reading image/alpha files + astring m_imagefile[MAX_BITMAPS]; // name of the image file (for lazy loading) + astring m_alphafile[MAX_BITMAPS]; // name of the alpha file (for lazy loading) + bool m_hasalpha[MAX_BITMAPS]; // is there any alpha component present? + + // stuff for fruit machine reels + // basically made up of multiple text strings / gfx + int m_numstops; + astring m_stopnames[MAX_BITMAPS]; + int m_stateoffset; + int m_reelreversed; + int m_numsymbolsvisible; + int m_beltreel; + }; + + // a texture encapsulates a texture for a given element in a given state + class texture + { + public: + texture(); + ~texture(); + + layout_element * m_element; // pointer back to the element + render_texture * m_texture; // texture for this state + int m_state; // associated state number + }; + + // internal helpers + static void element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param); + + // internal state + layout_element * m_next; // link to next element + running_machine & m_machine; // reference to the owning machine + astring m_name; // name of this element + simple_list<component> m_complist; // list of components + int m_defstate; // default state of this element + int m_maxstate; // maximum state value for all components + dynamic_array<texture> m_elemtex; // array of element textures used for managing the scaled bitmaps }; @@ -185,83 +185,83 @@ private: // a layout_view encapsulates a named list of items class layout_view { - friend class simple_list<layout_view>; + friend class simple_list<layout_view>; public: - // an item is a single backdrop, screen, overlay, bezel, cpanel, or marquee item - class item - { - friend class layout_view; - friend class simple_list<item>; - - public: - // construction/destruction - item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist); - virtual ~item(); - - // getters - item *next() const { return m_next; } - layout_element *element() const { return m_element; } - screen_device *screen() { return m_screen; } - const render_bounds &bounds() const { return m_bounds; } - const render_color &color() const { return m_color; } - int orientation() const { return m_orientation; } - render_container *screen_container(running_machine &machine) const; - bool has_input() const { return bool(m_input_tag); } - const char *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_tag; } - - // fetch state based on configured source - int state() const; - - private: - // internal state - item * m_next; // link to next item - layout_element * m_element; // pointer to the associated element (non-screens only) - astring m_output_name; // name of this item - astring m_input_tag; // input tag of this item - ioport_value m_input_mask; // input mask of this item - screen_device * m_screen; // pointer to screen - int m_orientation; // orientation of this item - render_bounds m_bounds; // bounds of the item - render_bounds m_rawbounds; // raw (original) bounds of the item - render_color m_color; // color of the item - }; - - // construction/destruction - layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist); - virtual ~layout_view(); - - // getters - layout_view *next() const { return m_next; } - item *first_item(item_layer layer) const; - const char *name() const { return m_name; } - const render_screen_list &screens() const { return m_screens; } - bool layer_enabled(item_layer layer) const { return m_layenabled[layer]; } - - // - bool has_art() const { return (m_backdrop_list.count() + m_overlay_list.count() + m_bezel_list.count() + m_cpanel_list.count() + m_marquee_list.count() != 0); } - float effective_aspect(render_layer_config config) const { return (config.zoom_to_screen() && m_screens.count() != 0) ? m_scraspect : m_aspect; } - - // operations - void recompute(render_layer_config layerconfig); + // an item is a single backdrop, screen, overlay, bezel, cpanel, or marquee item + class item + { + friend class layout_view; + friend class simple_list<item>; + + public: + // construction/destruction + item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist); + virtual ~item(); + + // getters + item *next() const { return m_next; } + layout_element *element() const { return m_element; } + screen_device *screen() { return m_screen; } + const render_bounds &bounds() const { return m_bounds; } + const render_color &color() const { return m_color; } + int orientation() const { return m_orientation; } + render_container *screen_container(running_machine &machine) const; + bool has_input() const { return bool(m_input_tag); } + const char *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_tag; } + + // fetch state based on configured source + int state() const; + + private: + // internal state + item * m_next; // link to next item + layout_element * m_element; // pointer to the associated element (non-screens only) + astring m_output_name; // name of this item + astring m_input_tag; // input tag of this item + ioport_value m_input_mask; // input mask of this item + screen_device * m_screen; // pointer to screen + int m_orientation; // orientation of this item + render_bounds m_bounds; // bounds of the item + render_bounds m_rawbounds; // raw (original) bounds of the item + render_color m_color; // color of the item + }; + + // construction/destruction + layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist); + virtual ~layout_view(); + + // getters + layout_view *next() const { return m_next; } + item *first_item(item_layer layer) const; + const char *name() const { return m_name; } + const render_screen_list &screens() const { return m_screens; } + bool layer_enabled(item_layer layer) const { return m_layenabled[layer]; } + + // + bool has_art() const { return (m_backdrop_list.count() + m_overlay_list.count() + m_bezel_list.count() + m_cpanel_list.count() + m_marquee_list.count() != 0); } + float effective_aspect(render_layer_config config) const { return (config.zoom_to_screen() && m_screens.count() != 0) ? m_scraspect : m_aspect; } + + // operations + void recompute(render_layer_config layerconfig); private: - // internal state - layout_view * m_next; // pointer to next layout in the list - astring m_name; // name of the layout - float m_aspect; // X/Y of the layout - float m_scraspect; // X/Y of the screen areas - render_screen_list m_screens; // list of active screens - render_bounds m_bounds; // computed bounds of the view - render_bounds m_scrbounds; // computed bounds of the screens within the view - render_bounds m_expbounds; // explicit bounds of the view - bool m_layenabled[ITEM_LAYER_MAX]; // is this layer enabled? - simple_list<item> m_backdrop_list; // list of backdrop items - simple_list<item> m_screen_list; // list of screen items - simple_list<item> m_overlay_list; // list of overlay items - simple_list<item> m_bezel_list; // list of bezel items - simple_list<item> m_cpanel_list; // list of marquee items - simple_list<item> m_marquee_list; // list of marquee items + // internal state + layout_view * m_next; // pointer to next layout in the list + astring m_name; // name of the layout + float m_aspect; // X/Y of the layout + float m_scraspect; // X/Y of the screen areas + render_screen_list m_screens; // list of active screens + render_bounds m_bounds; // computed bounds of the view + render_bounds m_scrbounds; // computed bounds of the screens within the view + render_bounds m_expbounds; // explicit bounds of the view + bool m_layenabled[ITEM_LAYER_MAX]; // is this layer enabled? + simple_list<item> m_backdrop_list; // list of backdrop items + simple_list<item> m_screen_list; // list of screen items + simple_list<item> m_overlay_list; // list of overlay items + simple_list<item> m_bezel_list; // list of bezel items + simple_list<item> m_cpanel_list; // list of marquee items + simple_list<item> m_marquee_list; // list of marquee items }; @@ -270,23 +270,23 @@ private: // a layout_file consists of a list of elements and a list of views class layout_file { - friend class simple_list<layout_file>; + friend class simple_list<layout_file>; public: - // construction/destruction - layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname); - virtual ~layout_file(); + // construction/destruction + layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname); + virtual ~layout_file(); - // getters - layout_file *next() const { return m_next; } - layout_element *first_element() const { return m_elemlist.first(); } - layout_view *first_view() const { return m_viewlist.first(); } + // getters + layout_file *next() const { return m_next; } + layout_element *first_element() const { return m_elemlist.first(); } + layout_view *first_view() const { return m_viewlist.first(); } private: - // internal state - layout_file * m_next; // pointer to the next file in the list - simple_list<layout_element> m_elemlist; // list of shared layout elements - simple_list<layout_view> m_viewlist; // list of views + // internal state + layout_file * m_next; // pointer to the next file in the list + simple_list<layout_element> m_elemlist; // list of shared layout elements + simple_list<layout_view> m_viewlist; // list of views }; diff --git a/src/emu/sound/tms5110.c b/src/emu/sound/tms5110.c index 16e96a13226..d66f753c157 100644 --- a/src/emu/sound/tms5110.c +++ b/src/emu/sound/tms5110.c @@ -1056,7 +1056,7 @@ READ8_MEMBER( tms5110_device::ctl_r ) else if (m_state == CTL_STATE_OUTPUT) { if (DEBUG_5110) logerror("Status read while outputting buffer (buffer=%2d)\n", m_CTL_buffer); - return (m_CTL_buffer); + return (m_CTL_buffer); } else // we're reading with the bus in input mode! just return the last thing written to the bus { @@ -1150,8 +1150,8 @@ void tms5110_device::sound_stream_update(sound_stream &stream, stream_sample_t * /****************************************************************************** tms5110_set_frequency -- adjusts the playback frequency - TODO: kill this function; we should be adjusting the tms51xx device clock itself, - not setting it here! + TODO: kill this function; we should be adjusting the tms51xx device clock itself, + not setting it here! ******************************************************************************/ diff --git a/src/emu/video/315_5124.c b/src/emu/video/315_5124.c index 9099ec8326e..021b6f96d93 100644 --- a/src/emu/video/315_5124.c +++ b/src/emu/video/315_5124.c @@ -1420,7 +1420,7 @@ void sega315_5378_device::blit_scanline( int *line_buffer, int *priority_selecte } while (++x < 208); } - + /* border on right side of the GG active screen */ do { diff --git a/src/emu/video/stvvdp2.c b/src/emu/video/stvvdp2.c index b0e5d2be19a..5632882f2e9 100644 --- a/src/emu/video/stvvdp2.c +++ b/src/emu/video/stvvdp2.c @@ -5725,10 +5725,10 @@ READ16_MEMBER ( saturn_state::saturn_vdp2_regs_r ) m_vdp2_regs[offset] = (STV_VDP2_VRAMSZ << 15) | ((0 << 0) & 0xf); // VDP2 version - /* Games basically r/w the entire VDP2 register area when this is tripped. (example: Silhouette Mirage) + /* Games basically r/w the entire VDP2 register area when this is tripped. (example: Silhouette Mirage) Disable log for the time being. */ //if(!space.debugger_access()) - // printf("Warning: VDP2 version read\n"); + // printf("Warning: VDP2 version read\n"); break; } diff --git a/src/emu/video/tea1002.c b/src/emu/video/tea1002.c index f9d014ae113..2784e45382b 100644 --- a/src/emu/video/tea1002.c +++ b/src/emu/video/tea1002.c @@ -18,7 +18,7 @@ const float tea1002_device::m_luminance[] = { - 0, 22.5, 44, 66.5, 8.5, 31, 52.5, 100, // INV = 0 + 0, 22.5, 44, 66.5, 8.5, 31, 52.5, 100, // INV = 0 75, 52.5, 31, 8.5, 66.5, 44, 22.5, 0 // INV = 1 }; |
