diff options
31 files changed, 1468 insertions, 943 deletions
diff --git a/src/devices/cpu/sparc/mb86901.cpp b/src/devices/cpu/sparc/mb86901.cpp index 2bf8e1ba284..fea2908952f 100644 --- a/src/devices/cpu/sparc/mb86901.cpp +++ b/src/devices/cpu/sparc/mb86901.cpp @@ -26,6 +26,14 @@ const device_type MB86901 = &device_creator<mb86901_device>; const int mb86901_device::NWINDOWS = 7; +#if LOG_FCODES +#include "ss1fcode.ipp" +#endif + +#if SPARCV8 +#include "sparcv8ops.ipp" +#endif + //------------------------------------------------- // mb86901_device - constructor //------------------------------------------------- @@ -40,13 +48,87 @@ mb86901_device::mb86901_device(const machine_config &mconfig, const char *tag, d void mb86901_device::device_start() { +#if LOG_FCODES + m_ss1_fcode_table.clear(); + FILE* input = fopen("names.txt", "rb"); + + if (input != NULL) + { + fseek(input, 0, SEEK_END); + size_t filesize = ftell(input); + fseek(input, 0, SEEK_SET); + + UINT8 *buf = new UINT8[filesize]; + fread(buf, 1, filesize, input); + fclose(input); + + size_t pos = 0; + while (pos < filesize) + { + // eat newlines + while (pos < filesize && (buf[pos] == 0x0d || buf[pos] == 0x0a)) + pos++; + + if (pos >= filesize) + break; + + // get opcode + UINT16 opcode = 0; + for (int shift = 12; shift >= 0 && pos < filesize; shift -= 4) + { + UINT8 digit = buf[pos]; + if (digit >= 'a' && digit <= 'z') + { + digit &= ~0x20; + } + + if (digit >= '0' && digit <= '9') + { + opcode |= (digit - 0x30) << shift; + } + else if (digit >= 'A' && digit <= 'F') + { + opcode |= ((digit - 0x41) + 10) << shift; + } + pos++; + } + + if (pos >= filesize) + break; + + // skip " : " + pos += 3; + + if (pos >= filesize) + break; + + // read description + std::string description; + while (buf[pos] != ';' && pos < filesize) + { + description += char(buf[pos]); + pos++; + } + + if (pos >= filesize) + break; + + if (buf[pos] == ';') + pos++; + + m_ss1_fcode_table[opcode & ~1] = description; + } + delete [] buf; + } +#endif m_bp_reset_in = false; - m_bp_irl = 0; m_bp_fpu_present = false; m_bp_cp_present = false; m_pb_error = false; m_pb_block_ldst_byte = false; m_pb_block_ldst_word = false; + m_bp_irl = 0; + m_irq_state = 0; memset(m_dbgregs, 0, 24 * sizeof(UINT32)); @@ -298,6 +380,9 @@ void mb86901_device::device_reset() m_fpu_sequence_err = 0; m_cp_sequence_err = 0; + m_bp_irl = 0; + m_irq_state = 0; + m_asi = 0; MAE = false; HOLD_BUS = false; @@ -329,6 +414,14 @@ void mb86901_device::device_reset() m_regs[i] = m_r + i; } update_gpr_pointers(); + +#if LOG_FCODES + m_ss1_next_pc = ~0; + m_ss1_next_opcode = ~0; + m_ss1_next_handler_base = ~0; + m_ss1_next_entry_point = ~0; + m_ss1_next_stack = ~0; +#endif } @@ -495,7 +588,7 @@ UINT32 mb86901_device::execute_max_cycles() const UINT32 mb86901_device::execute_input_lines() const { - return 0; + return 16; } @@ -506,12 +599,52 @@ UINT32 mb86901_device::execute_input_lines() const void mb86901_device::execute_set_input(int inputnum, int state) { -} + switch (inputnum) + { + case SPARC_IRQ1: + case SPARC_IRQ2: + case SPARC_IRQ3: + case SPARC_IRQ4: + case SPARC_IRQ5: + case SPARC_IRQ6: + case SPARC_IRQ7: + case SPARC_IRQ8: + case SPARC_IRQ9: + case SPARC_IRQ10: + case SPARC_IRQ11: + case SPARC_IRQ12: + case SPARC_IRQ13: + case SPARC_IRQ14: + case SPARC_NMI: + { + int index = (inputnum - SPARC_IRQ1) + 1; + if (state) + { + m_irq_state |= 1 << index; + } + else + { + m_irq_state &= ~(1 << index); + } + for(index = 15; index > 0; index--) + { + if (m_irq_state & (1 << index)) + { + break; + } + } + + m_bp_irl = index; + break; + } + + case SPARC_MAE: + m_mae = (state != 0) ? 1 : 0; + break; + } +} -#if SPARCV8 -#include "sparcv8ops.ipp" -#endif //------------------------------------------------- // execute_add - execute an add-type opcode @@ -541,14 +674,14 @@ void mb86901_device::execute_add(UINT32 op) ((not result<31>) and (r[rs1]<31> or operand2<31>)) ); */ + UINT32 rs1 = RS1REG; UINT32 operand2 = USEIMM ? SIMM13 : RS2REG; UINT32 result = 0; if (ADD || ADDCC) - result = RS1REG + operand2; + result = rs1 + operand2; else if (ADDX || ADDXCC) - result = RS1REG + operand2 + ICC_C; - + result = rs1 + operand2 + ICC_C; if (RD != 0) RDREG = result; @@ -558,10 +691,10 @@ void mb86901_device::execute_add(UINT32 op) CLEAR_ICC; PSR |= (BIT31(result)) ? PSR_N_MASK : 0; PSR |= (result == 0) ? PSR_Z_MASK : 0; - PSR |= ((BIT31(RS1REG) && BIT31(operand2) && !BIT31(result)) || - (!BIT31(RS1REG) && !BIT31(operand2) && BIT31(result))) ? PSR_V_MASK : 0; - PSR |= ((BIT31(RS1REG) && BIT31(operand2)) || - (!BIT31(result) && (BIT31(RS1REG) || BIT31(operand2)))) ? PSR_C_MASK : 0; + PSR |= ((BIT31(rs1) && BIT31(operand2) && !BIT31(result)) || + (!BIT31(rs1) && !BIT31(operand2) && BIT31(result))) ? PSR_V_MASK : 0; + PSR |= ((BIT31(rs1) && BIT31(operand2)) || + (!BIT31(result) && (BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; } } @@ -598,13 +731,14 @@ void mb86901_device::execute_taddcc(UINT32 op) r[rd] <- result; ); */ + UINT32 rs1 = RS1REG; UINT32 operand2 = USEIMM ? SIMM13 : RS2REG; - UINT32 result = RS1REG + operand2; + UINT32 result = rs1 + operand2; - bool temp_v = (BIT31(RS1REG) && BIT31(operand2) && !BIT31(result)) || - (!BIT31(RS1REG) && !BIT31(operand2) && BIT31(result)) || - ((RS1REG & 3) != 0 || (RS1REG & 3) != 0) ? true : false; + bool temp_v = (BIT31(rs1) && BIT31(operand2) && !BIT31(result)) || + (!BIT31(rs1) && !BIT31(operand2) && BIT31(result)) || + ((rs1 & 3) != 0 || (operand2 & 3) != 0) ? true : false; if (TADDCCTV && temp_v) { @@ -617,8 +751,8 @@ void mb86901_device::execute_taddcc(UINT32 op) PSR |= (BIT31(result)) ? PSR_N_MASK : 0; PSR |= (result == 0) ? PSR_Z_MASK : 0; PSR |= temp_v ? PSR_V_MASK : 0; - PSR |= ((BIT31(RS1REG) && BIT31(operand2)) || - (!BIT31(result) && (BIT31(RS1REG) || BIT31(operand2)))) ? PSR_C_MASK : 0; + PSR |= ((BIT31(rs1) && BIT31(operand2)) || + (!BIT31(result) && (BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; if (RD != 0) RDREG = result; @@ -655,13 +789,14 @@ void mb86901_device::execute_sub(UINT32 op) (result<31> and ((not r[rs1]<31>) or operand2<31>)) ); */ + UINT32 rs1 = RS1REG; UINT32 operand2 = USEIMM ? SIMM13 : RS2REG; UINT32 result = 0; if (SUB || SUBCC) - result = RS1REG - operand2; + result = rs1 - operand2; else if (SUBX || SUBXCC) - result = RS1REG - operand2 - ICC_C; + result = rs1 - operand2 - ICC_C; if (RD != 0) RDREG = result; @@ -671,10 +806,10 @@ void mb86901_device::execute_sub(UINT32 op) CLEAR_ICC; PSR |= (BIT31(result)) ? PSR_N_MASK : 0; PSR |= (result == 0) ? PSR_Z_MASK : 0; - PSR |= ((BIT31(RS1REG) && !BIT31(operand2) && !BIT31(result)) || - (!BIT31(RS1REG) && BIT31(operand2) && BIT31(result))) ? PSR_V_MASK : 0; - PSR |= ((!BIT31(RS1REG) && BIT31(operand2)) || - (BIT31(result) && (!BIT31(RS1REG) || BIT31(operand2)))) ? PSR_C_MASK : 0; + PSR |= ((BIT31(rs1) && !BIT31(operand2) && !BIT31(result)) || + (!BIT31(rs1) && BIT31(operand2) && BIT31(result))) ? PSR_V_MASK : 0; + PSR |= ((!BIT31(rs1) && BIT31(operand2)) || + (BIT31(result) && (!BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; } } @@ -712,13 +847,14 @@ void mb86901_device::execute_tsubcc(UINT32 op) ); */ + UINT32 rs1 = RS1REG; UINT32 operand2 = USEIMM ? SIMM13 : RS2REG; - UINT32 result = RS1REG - operand2; + UINT32 result = rs1 - operand2; - bool temp_v = (BIT31(RS1REG) && !BIT31(operand2) && !BIT31(result)) || - (!BIT31(RS1REG) && BIT31(operand2) && BIT31(result)) || - ((RS1REG & 3) != 0 || (RS1REG & 3) != 0) ? true : false; + bool temp_v = (BIT31(rs1) && !BIT31(operand2) && !BIT31(result)) || + (!BIT31(rs1) && BIT31(operand2) && BIT31(result)) || + ((rs1 & 3) != 0 || (operand2 & 3) != 0) ? true : false; if (TSUBCCTV && temp_v) { @@ -731,8 +867,8 @@ void mb86901_device::execute_tsubcc(UINT32 op) PSR |= (BIT31(result)) ? PSR_N_MASK : 0; PSR |= (result == 0) ? PSR_Z_MASK : 0; PSR |= temp_v ? PSR_V_MASK : 0; - PSR |= ((!BIT31(RS1REG) && BIT31(operand2)) || - (BIT31(result) && (!BIT31(RS1REG) || BIT31(operand2)))) ? PSR_C_MASK : 0; + PSR |= ((!BIT31(rs1) && BIT31(operand2)) || + (BIT31(result) && (!BIT31(rs1) || BIT31(operand2)))) ? PSR_C_MASK : 0; if (RD != 0) RDREG = result; @@ -1111,8 +1247,14 @@ void mb86901_device::execute_rett(UINT32 op) if (ET) { m_trap = 1; - if (IS_USER) m_privileged_instruction = 1; - else m_illegal_instruction = 1; + if (IS_USER) + { + m_privileged_instruction = 1; + } + else + { + m_illegal_instruction = 1; + } } else if (IS_USER) { @@ -1129,7 +1271,6 @@ void mb86901_device::execute_rett(UINT32 op) m_tt = 6; m_execute_mode = 0; m_error_mode = 1; - } else if (address & 3) { @@ -1384,9 +1525,11 @@ void mb86901_device::execute_group2(UINT32 op) #endif default: + { m_trap = 1; m_illegal_instruction = 1; break; + } } } @@ -2408,6 +2551,7 @@ void mb86901_device::select_trap() if (m_reset_trap) { + m_reset_trap = 0; m_trap = 0; return; } @@ -2457,6 +2601,7 @@ void mb86901_device::select_trap() else if (m_interrupt_level > 0) m_tt = 0x10 | m_interrupt_level; + TBR |= m_tt << 4; m_instruction_access_exception = 0; m_illegal_instruction = 0; m_privileged_instruction = 0; @@ -2472,6 +2617,7 @@ void mb86901_device::select_trap() m_division_by_zero = 0; m_trap_instruction = 0; m_interrupt_level = 0; + m_mae = 0; } @@ -2563,7 +2709,9 @@ void mb86901_device::execute_trap() */ if (!m_trap) + { return; + } select_trap(); @@ -2702,7 +2850,6 @@ void mb86901_device::dispatch_instruction(UINT32 op) { m_trap = 1; m_illegal_instruction = 1; - } if (((OP == OP_ALU && (FPOP1 || FPOP2)) || (OP == OP_TYPE0 && OP2 == OP2_FBFCC)) && (!EF || !m_bp_fpu_present)) { @@ -2731,7 +2878,6 @@ void mb86901_device::complete_fp_execution(UINT32 /*op*/) { } - //------------------------------------------------- // execute_step - perform one step in execute // mode (versus error or reset modes) @@ -2812,7 +2958,7 @@ void mb86901_device::execute_step() UINT32 addr_space = (IS_USER ? 8 : 9); UINT32 op = read_sized_word(addr_space, PC, 4); -#if 0 +#if LOG_FCODES if (PC == 0xffef0000) { UINT32 opcode = read_sized_word(11, REG(5), 2); @@ -2820,252 +2966,47 @@ void mb86901_device::execute_step() { opcode >>= 16; } - UINT32 l1 = opcode << 2; - l1 += REG(2); - UINT32 handler_offset = read_sized_word(11, l1, 2); - if (!(l1 & 2)) - { - handler_offset >>= 16; - } - handler_offset <<= 2; - handler_offset += REG(2); - if (handler_offset == 0xffe87964) - { - printf("Opcode at %08x: %04x, handler is at %08x // call %08x\n", REG(5), opcode, handler_offset, l1 + 2); - } - else if (handler_offset == 0xffe8799c) - { - UINT32 address = REG(5) + 2; - UINT32 half = read_sized_word(11, address, 2); - if (!(address & 2)) half >>= 16; - - printf("Opcode at %08x: %04x, handler is at %08x // push_data current result (%08x) + load address %08x\n", REG(5), opcode, handler_offset, REG(4), REG(3) + half); - } - else if (handler_offset == 0xffe879e4) - { - UINT32 address = l1 + 2; - UINT32 half0 = read_sized_word(11, address, 2); - if (address & 2) half0 <<= 16; - address = l1 + 4; - UINT32 half1 = read_sized_word(11, address, 2); - if (!(address & 2)) half1 >>= 16; + UINT32 handler_base = opcode << 2; + handler_base += REG(2); // l1 = r2 + opcode << 2 - UINT32 value = half0 | half1; - - printf("Opcode at %08x: %04x, handler is at %08x // push_data current result (%08x) + load immediate word from handler table (%08x)\n", REG(5), opcode, handler_offset, REG(4), value); - } - else if (handler_offset == 0xffe879c4) + UINT32 entry_point = read_sized_word(11, handler_base, 2); + if (!(handler_base & 2)) { - UINT32 address = l1 + 2; - UINT32 l0 = read_sized_word(11, address, 2); - if (!(address & 2)) l0 >>= 16; - - address = REG(3) + l0; - UINT32 l1_2 = read_sized_word(11, address, 2); - if (!(address & 2)) l1_2 >>= 16; - - address = REG(2) + (l1_2 << 2); - UINT32 l0_2 = read_sized_word(11, address, 2); - if (!(address & 2)) l0_2 >>= 16; - - UINT32 dest = REG(2) + (l0_2 << 2); - - printf("Opcode at %08x: %04x, handler is at %08x // SPARC branch to %08x, calcs: g2(%08x) + halfword[g2(%04x) + (halfword[g3(%08x) + halfword[entry_point(%04x) + 2](%04x)](%04x) << 2)](%08x)\n", REG(5), opcode, handler_offset, dest, REG(2), REG(2), REG(3), l1, l0, l1_2, l0_2); - printf(" // Target func: %08x\n", l0_2 << 2); - switch (l0_2 << 2) - { - case 0x10: // call - printf(" // call %08x\n", (REG(2) + (l1_2 << 2)) + 2); - break; - default: - printf(" // unknown handler address: %08x\n", REG(2) + (l0_2 << 2)); - break; - } + entry_point >>= 16; } - else if (handler_offset == 0xffe8c838) - { - UINT32 address = l1 + 2; - UINT32 half0 = read_sized_word(11, address, 2); - if (address & 2) half0 <<= 16; - - address = l1 + 4; - UINT32 half1 = read_sized_word(11, address, 2); - if (!(address & 2)) half1 >>= 16; - - UINT32 value = half0 | half1; + entry_point <<= 2; + entry_point += REG(2); // l0 = r2 + entry_point << 2 - printf("Opcode at %08x: %04x, handler is at %08x // add 32-bit word (%08x) from handler table to result (%08x + %08x = %08x)\n", REG(5), opcode, handler_offset, value, REG(4), value, REG(4) + value); - } - else if (opcode == 0x003f || opcode == 0x0066 || opcode == 0x0099 || opcode == 0x0121 || opcode == 0x0136 || opcode == 0x014f || opcode == 0x0155 || opcode == 0x01c7 || opcode == 0x01cd || - opcode == 0x0217 || opcode == 0x0289 || opcode == 0x0296 || opcode == 0x029d || opcode == 0x02f2 || opcode == 0x0334 || opcode == 0x0381 || opcode == 0x3d38) +#if 0 + // Doesn't seem to work + UINT32 name_length_addr = (REG(2) + ((opcode & ~1) << 2)) - 1; + UINT32 name_length_shift = (3 - (name_length_addr & 3)) * 8; + UINT32 name_length = (read_sized_word(11, name_length_addr, 1) >> name_length_shift) & 0x7f; + UINT32 name_start_addr = name_length_addr - name_length; + char name_buf[129]; + memset(name_buf, 0, 129); + if (name_length > 0) { - switch(opcode) + for (int i = 0; i < name_length; i++) { - case 0x003f: - { - UINT32 address = REG(5) + 2; - UINT32 half0 = read_sized_word(11, address, 2); - if (address & 2) half0 <<= 16; - - address = REG(5) + 4; - UINT32 half1 = read_sized_word(11, address, 2); - if (!(address & 2)) half1 >>= 16; - - UINT32 value = half0 | half1; - - printf("Opcode at %08x: %04x, handler is at %08x // push_data current result (%08x) + load immediate word from instructions (%08x)\n", REG(5), opcode, handler_offset, REG(4), value); - break; - } - - case 0x0066: - { - UINT32 address = REG(5) + 2; - UINT32 offset = read_sized_word(11, address, 2); - if (!(address & 2)) offset >>= 16; - - UINT32 target = REG(5) + 2 + offset; - - printf("Opcode at %08x: %04x, handler is at %08x // if result (%08x) is zero, jump to %08x\n", REG(5), opcode, handler_offset, REG(4), target); - break; - } - - case 0x0099: - { - UINT32 l1_2 = REG(4); - - UINT32 address = REG(7); - UINT32 l0_2 = read_sized_word(11, address, 4); - - address = REG(7) + 4; - UINT32 popped_g4 = read_sized_word(11, address, 4); - - address = REG(5) + 2; - UINT32 offset = read_sized_word(11, address, 2); - if (!(address & 2)) offset >>= 16; - - UINT32 target = REG(5) + 2 + offset; - - printf("Opcode at %08x: %04x, handler is at %08x // branch relative to %08x if data stack pop/top (%08x) == result (%08x), pop_data result (%08x)\n", REG(5), opcode, handler_offset, target, l0_2, l1_2, popped_g4); - if (l1_2 == l0_2) - { - printf(" // branch will be taken\n"); - } - else - { - printf(" // branch will not be taken\n"); - printf(" // push pc (%08x) onto program stack\n", REG(5) + 2); - printf(" // push previous data stack top + 0x80000000 (%08x) onto program stack\n", l0_2 + 0x8000000); - printf(" // push diff of (result - stack top) (%08x - %08x = %08x)\n", popped_g4, l0_2 + 0x8000000, popped_g4 - (l0_2 + 0x80000000)); - } - - break; - } - - case 0x0121: - { - UINT32 address = REG(7); - UINT32 word = read_sized_word(11, address, 4); - printf("Opcode at %08x: %04x, handler is at %08x // logical-AND result with data stack pop, store in result: %08x = %08x & %08x\n", REG(5), opcode, handler_offset, word & REG(4), word, REG(4)); - break; - } - - case 0x0136: - printf("Opcode at %08x: %04x, handler is at %08x // invert result (%08x -> %08x)\n", REG(5), opcode, handler_offset, REG(4), REG(4) ^ 0xffffffff); - break; - - case 0x014f: - { - UINT32 address = REG(7); - UINT32 word = read_sized_word(11, address, 4); - printf("Opcode at %08x: %04x, handler is at %08x // add result to data stack pop, store in result: %08x = %08x + %08x\n", REG(5), opcode, handler_offset, word + REG(4), word, REG(4)); - break; - } - - case 0x0155: - { - UINT32 address = REG(7); - UINT32 word = read_sized_word(11, address, 4); - printf("Opcode at %08x: %04x, handler is at %08x // subtract result from data stack pop, store in result: %08x = %08x - %08x\n", REG(5), opcode, handler_offset, word - REG(4), word, REG(4)); - break; - } - - case 0x01c7: - { - UINT32 address = REG(6); - UINT32 half0 = read_sized_word(11, address, 2); - if (address & 2) half0 <<= 16; - - address = REG(6) + 2; - UINT32 half1 = read_sized_word(11, address, 2); - if (!(address & 2)) half1 >>= 16; - - UINT32 value = half0 | half1; - - printf("Opcode at %08x: %04x, handler is at %08x // return (%08x) (pops off program stack)\n", REG(5), opcode, handler_offset, value); - break; - } - - case 0x01cd: - printf("Opcode at %08x: %04x, handler is at %08x // insert result (%08x) between data stack top (%08x) and next data stack entry\n", REG(5), opcode, handler_offset, REG(4), read_sized_word(11, REG(7), 4)); - break; - - case 0x0217: - { - UINT32 value = read_sized_word(11, REG(7), 4); - printf("Opcode at %08x: %04x, handler is at %08x // if pop_data (%08x) >= result (%08x), set result to 0, otherwise -1 (%08x)\n", REG(5), opcode, handler_offset, value, REG(4), (value >= REG(4)) ? 0 : ~0); - break; - } - - case 0x0289: - printf("Opcode at %08x: %04x, handler is at %08x // push_data(g4 (%08x))\n", REG(5), opcode, handler_offset, REG(4)); - break; - - case 0x0296: - printf("Opcode at %08x: %04x, handler is at %08x // swap result (%08x) with top of data stack (%08x)\n", REG(5), opcode, handler_offset, REG(4), read_sized_word(11, REG(7), 4)); - break; - - case 0x029d: - { - UINT32 top = read_sized_word(11, REG(7), 4); - UINT32 next = read_sized_word(11, REG(7) + 4, 4); - printf("Opcode at %08x: %04x, handler is at %08x // swap the top two values of the data stack (%08x <-> %08x), exchange second value with result (%08x <-> %08x)\n", REG(5), opcode, handler_offset, top, next, REG(4), next); - break; - } - - case 0x02f2: - printf("Opcode at %08x: %04x, handler is at %08x // decrement g4 (%08x -> %08x)\n", REG(5), opcode, handler_offset, REG(4), REG(4) - 1); - break; - - case 0x0334: - { - UINT32 address = REG(4); - UINT32 half0 = read_sized_word(11, address, 2); - if (address & 2) half0 <<= 16; - - address = REG(4) + 2; - UINT32 half1 = read_sized_word(11, address, 2); - if (!(address & 2)) half1 >>= 16; - - UINT32 value = half0 | half1; - - printf("Opcode at %08x: %04x, handler is at %08x // load result with 32-bit word at result address (g4 = [%08x] (%08x)\n", REG(5), opcode, handler_offset, REG(4), value); - break; - } - - case 0x0381: - printf("Opcode at %08x: %04x, handler is at %08x // word[g4 (%08x)] = pop_data(g7), result = pop_data(g7), g7 = %08x\n", REG(5), opcode, handler_offset, REG(4), REG(7)); - break; - - case 0x3d38: - printf("Opcode at %08x: %04x, handler is at %08x // call ffe8fe90\n", REG(5), opcode, handler_offset); - break; + UINT32 char_addr = name_start_addr + i; + UINT32 char_shift = (3 - (char_addr & 3)) * 8; + name_buf[i] = (read_sized_word(11, char_addr, 1) >> char_shift) & 0xff; } } - else - { - printf("Opcode at %08x: %04x, handler is at %08x\n", REG(5), opcode, handler_offset); - } +#endif + + disassemble_ss1_fcode(REG(5), opcode, handler_base, entry_point, REG(7)); + } + else if (PC == m_ss1_next_entry_point) + { + disassemble_ss1_fcode(m_ss1_next_pc, m_ss1_next_opcode, m_ss1_next_handler_base, m_ss1_next_entry_point, m_ss1_next_stack); + m_ss1_next_pc = ~0; + m_ss1_next_opcode = ~0; + m_ss1_next_handler_base = ~0; + m_ss1_next_entry_point = ~0; + m_ss1_next_stack = ~0; } #endif diff --git a/src/devices/cpu/sparc/sparc.h b/src/devices/cpu/sparc/sparc.h index 1acc2263854..cca7a70eceb 100644 --- a/src/devices/cpu/sparc/sparc.h +++ b/src/devices/cpu/sparc/sparc.h @@ -11,36 +11,41 @@ #include "sparcdasm.h" -#define SPARCV8 (0) - -#define SPARC_NO_TRAP 256 -#define SPARC_RESET 0 -#define SPARC_INSTRUCTION_ACCESS_EXCEPTION 1 -#define SPARC_ILLEGAL_INSTRUCTION 2 -#define SPARC_PRIVILEGED_INSTRUCTION 3 -#define SPARC_FP_DISABLED 4 -#define SPARC_WINDOW_OVERFLOW 5 -#define SPARC_WINDOW_UNDERFLOW 6 -#define SPARC_MEM_ADDRESS_NOT_ALIGNED 7 -#define SPARC_FLOATING_POINT_EXCEPTION 8 -#define SPARC_DATA_ACCESS_EXCEPTION 9 -#define SPARC_TAG_OVERFLOW 10 -#define SPARC_INT1 17 -#define SPARC_INT2 18 -#define SPARC_INT3 19 -#define SPARC_INT4 20 -#define SPARC_INT5 21 -#define SPARC_INT6 22 -#define SPARC_INT7 23 -#define SPARC_INT8 24 -#define SPARC_INT9 25 -#define SPARC_INT10 26 -#define SPARC_INT11 27 -#define SPARC_INT12 28 -#define SPARC_INT13 29 -#define SPARC_INT14 30 -#define SPARC_INT15 31 -#define SPARC_TRAP_INSTRUCTION 128 +#define SPARCV8 (0) +#define LOG_FCODES (0) + +#if LOG_FCODES +#include <map> +#endif + +#define SPARC_NO_TRAP 256 +#define SPARC_RESET 0 +#define SPARC_INSTRUCTION_ACCESS_EXCEPTION 1 +#define SPARC_ILLEGAL_INSTRUCTION 2 +#define SPARC_PRIVILEGED_INSTRUCTION 3 +#define SPARC_FP_DISABLED 4 +#define SPARC_WINDOW_OVERFLOW 5 +#define SPARC_WINDOW_UNDERFLOW 6 +#define SPARC_MEM_ADDRESS_NOT_ALIGNED 7 +#define SPARC_FLOATING_POINT_EXCEPTION 8 +#define SPARC_DATA_ACCESS_EXCEPTION 9 +#define SPARC_TAG_OVERFLOW 10 +#define SPARC_INT1 17 +#define SPARC_INT2 18 +#define SPARC_INT3 19 +#define SPARC_INT4 20 +#define SPARC_INT5 21 +#define SPARC_INT6 22 +#define SPARC_INT7 23 +#define SPARC_INT8 24 +#define SPARC_INT9 25 +#define SPARC_INT10 26 +#define SPARC_INT11 27 +#define SPARC_INT12 28 +#define SPARC_INT13 29 +#define SPARC_INT14 30 +#define SPARC_INT15 31 +#define SPARC_TRAP_INSTRUCTION 128 #define SPARC_FPU_SEQUENCE_ERROR // TODO: when there are more SPARC CPUs, move setter to a base class @@ -78,11 +83,6 @@ public: UINT8 get_asi() { return m_asi; } UINT32 pc() { return m_pc; } - void trap(UINT8 type, UINT8 tt_override = 0); - void set_mae() { m_mae = true; } - void hold_bus() { m_hold_bus = true; } - void release_bus() { m_hold_bus = false; } - template<typename T> static void add_asi_desc(device_t &device, const T &desc) { return downcast<mb86901_device &>(device).add_asi_desc(desc); } protected: @@ -130,6 +130,11 @@ protected: void reset_step(); void error_step(); +#if LOG_FCODES + void indent(); + void disassemble_ss1_fcode(UINT32 r5, UINT32 opcode, UINT32 handler_base, UINT32 entry_point, UINT32 stack); +#endif + // address spaces const address_space_config m_program_config; @@ -167,6 +172,7 @@ protected: bool m_pb_error; bool m_pb_block_ldst_byte; bool m_pb_block_ldst_word; + UINT16 m_irq_state; // trap and error registers bool m_trap; @@ -235,6 +241,15 @@ protected: // address spaces address_space *m_program; +#if LOG_FCODES + UINT32 m_ss1_next_pc; + UINT32 m_ss1_next_opcode; + UINT32 m_ss1_next_handler_base; + UINT32 m_ss1_next_entry_point; + UINT32 m_ss1_next_stack; + std::map<UINT16, std::string> m_ss1_fcode_table; +#endif + // processor configuration static const int NWINDOWS; }; @@ -242,10 +257,6 @@ protected: // device type definition extern const device_type MB86901; -/*************************************************************************** - REGISTER ENUMERATION -***************************************************************************/ - enum { SPARC_PC = 1, @@ -280,4 +291,24 @@ enum SPARC_R96, SPARC_R97, SPARC_R98, SPARC_R99, SPARC_R100, SPARC_R101, SPARC_R102, SPARC_R103, SPARC_R104, SPARC_R105, SPARC_R106, SPARC_R107, SPARC_R108, SPARC_R109, SPARC_R110, SPARC_R111 }; +enum +{ + SPARC_IRQ1, + SPARC_IRQ2, + SPARC_IRQ3, + SPARC_IRQ4, + SPARC_IRQ5, + SPARC_IRQ6, + SPARC_IRQ7, + SPARC_IRQ8, + SPARC_IRQ9, + SPARC_IRQ10, + SPARC_IRQ11, + SPARC_IRQ12, + SPARC_IRQ13, + SPARC_IRQ14, + SPARC_NMI, + SPARC_MAE +}; + #endif /* __SPARC_H__ */ diff --git a/src/devices/cpu/sparc/ss1fcode.ipp b/src/devices/cpu/sparc/ss1fcode.ipp new file mode 100644 index 00000000000..ebfd6abeb2c --- /dev/null +++ b/src/devices/cpu/sparc/ss1fcode.ipp @@ -0,0 +1,605 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//================================================================ +// +// ss1fcode.ipp - Logging support for execution of the Forth VM +// used in the Sun SPARCstation 1. +// +//================================================================ + +void mb86901_device::indent() +{ + UINT32 program_depth = (0xffeff000 - (REG(6) - 4)) / 4; + for (int i = 0; i < program_depth; i++) + { + printf(" "); + } +} + +void mb86901_device::disassemble_ss1_fcode(UINT32 r5, UINT32 opcode, UINT32 handler_base, UINT32 entry_point, UINT32 stack) +{ + std::string opdesc = m_ss1_fcode_table[opcode & ~1]; + if (opdesc.length() == 0) + opdesc = "[unknown]"; + + if (entry_point == 0xffe87964) + { + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; call %08x\n", r5, opcode, entry_point, opdesc.c_str(), handler_base + 2); + indent(); printf(" // program stack now %08x (%d words deep)\n", REG(6) - 4, (0xffeff000 - (REG(6) - 4)) / 4); + } + else if (entry_point == 0xffe87974) + { + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push handler_base+2 (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), handler_base + 2); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + } + else if (entry_point == 0xffe8799c) + { + UINT32 address = handler_base + 2; + UINT32 half = read_sized_word(11, address, 2); + if (!(address & 2)) half >>= 16; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; add halfword at handler_base+2 (%04x) to VM base pointer (%08x) and push onto stack (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), half, REG(3), REG(3) + half); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + } + else if (entry_point == 0xffe879e4) + { + UINT32 address = handler_base + 2; + UINT32 half0 = read_sized_word(11, address, 2); + if (address & 2) half0 <<= 16; + + address = handler_base + 4; + UINT32 half1 = read_sized_word(11, address, 2); + if (!(address & 2)) half1 >>= 16; + + UINT32 value = half0 | half1; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push immediate word from handler table (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), value); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + } + else if (entry_point == 0xffe879c4) + { + UINT32 address = handler_base + 2; + UINT32 l0 = read_sized_word(11, address, 2); + if (!(address & 2)) l0 >>= 16; + + address = REG(3) + l0; + UINT32 handler_base_2 = read_sized_word(11, address, 2); + if (!(address & 2)) handler_base_2 >>= 16; + + address = REG(2) + (handler_base_2 << 2); + UINT32 l0_2 = read_sized_word(11, address, 2); + if (!(address & 2)) l0_2 >>= 16; + + UINT32 dest = REG(2) + (l0_2 << 2); + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; SPARC branch to %08x, calcs: g2(%08x) + halfword[g2(%04x) + (halfword[g3(%08x) + halfword[entry_point(%04x) + 2](%04x)](%04x) << 2)](%08x)\n", r5, opcode, entry_point, opdesc.c_str(), dest, REG(2), REG(2), REG(3), handler_base, l0, handler_base_2, l0_2); + indent(); printf(" // target func: %08x\n", l0_2 << 2); + switch (l0_2 << 2) + { + case 0x10: // call + indent(); printf(" // call %08x\n", (REG(2) + (handler_base_2 << 2)) + 2); + indent(); printf(" // program stack now %08x (%d words deep)\n", REG(6) - 4, (0xffeff000 - (REG(6) - 4)) / 4); + break; + default: + indent(); printf(" // unknown handler address: %08x\n", REG(2) + (l0_2 << 2)); + break; + } + } + else if (entry_point == 0xffe8c838) + { + UINT32 address = handler_base + 2; + UINT32 half0 = read_sized_word(11, address, 2); + if (address & 2) half0 <<= 16; + + address = handler_base + 4; + UINT32 half1 = read_sized_word(11, address, 2); + if (!(address & 2)) half1 >>= 16; + + UINT32 value = half0 | half1; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; add 32-bit word (%08x) from handler table to top of stack (%08x + %08x = %08x)\n", r5, opcode, entry_point, opdesc.c_str(), value, REG(4), value, REG(4) + value); + } + else + { + switch(opcode) + { + case 0x003f: + { + UINT32 address = r5 + 2; + UINT32 half0 = read_sized_word(11, address, 2); + if (address & 2) half0 <<= 16; + + address = r5 + 4; + UINT32 half1 = read_sized_word(11, address, 2); + if (!(address & 2)) half1 >>= 16; + + UINT32 value = half0 | half1; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push immediate word from instructions (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), value); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + } + + case 0x004b: + { + UINT32 address = r5 + 2; + UINT32 value = read_sized_word(11, address, 2); + if (!(address & 2)) value >>= 16; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push immediate halfword from instructions (%04x)\n", r5, opcode, entry_point, opdesc.c_str(), value); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + } + + case 0x0055: + { + UINT32 address = REG(4); + UINT32 new_opcode = read_sized_word(11, address, 2); + if (!(address & 2)) new_opcode >>= 16; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; pop stack top (%08x) as an opcode to execute\n", r5, opcode, entry_point, opdesc.c_str(), REG(4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + indent(); printf(" // inserted opcode:\n"); + + m_ss1_next_pc = REG(4); + m_ss1_next_opcode = new_opcode; + m_ss1_next_handler_base = REG(4); + + m_ss1_next_entry_point = read_sized_word(11, m_ss1_next_handler_base, 2); + if (!(m_ss1_next_handler_base & 2)) + { + m_ss1_next_entry_point >>= 16; + } + m_ss1_next_entry_point <<= 2; + m_ss1_next_entry_point += REG(2); + m_ss1_next_stack = stack + 4; + break; + } + + case 0x05f: + { + UINT32 address = r5 + 2; + UINT32 pc_offset = read_sized_word(11, address, 2); + if (!(address & 2)) pc_offset >>= 16; + + // advance program counter by amount specified as parameter + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; advance program counter by amount specified as parameter (%08x = %08x + %04x)\n", r5, opcode, entry_point, opdesc.c_str(), r5 + 2 + pc_offset, r5 + 2, pc_offset); + break; + } + + case 0x0066: + { + UINT32 address = r5 + 2; + UINT32 offset = read_sized_word(11, address, 2); + if (!(address & 2)) offset >>= 16; + + UINT32 target = r5 + 2 + offset; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; pop data stack top (%08x) and if zero, jump to %08x\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), target); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + } + + case 0x007b: + { + UINT32 r4 = REG(4); + UINT32 value = read_sized_word(11, REG(6), 4); + UINT32 result = value + r4; + bool arithmetic_overflow = ((BIT31(value) && BIT31(r4) && !BIT31(result)) || (!BIT31(value) && !BIT31(r4) && BIT31(result))); + + UINT32 address = r5 + 2; + UINT32 offset = read_sized_word(11, address, 2); + if (!(address & 2)) offset >>= 16; + UINT32 target = r5 + 2 + offset; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; pop data stack top and add to program stack top (%08x = %08x + %08x)\n", r5, opcode, entry_point, opdesc.c_str(), result, value, r4); + indent(); printf(" // if no addition overflow, jump to %08x\n", target); + indent(); printf(" // if addition overflow, pop 3 words off program stack\n"); + if (arithmetic_overflow) + { + indent(); printf(" // program stack now %08x (%d words deep)\n", REG(6) + 12, (0xffeff000 - (REG(6) + 12)) / 4); + } + break; + } + + case 0x0099: + { + UINT32 handler_base_2 = REG(4); + + UINT32 address = stack; + UINT32 l0_2 = read_sized_word(11, address, 4); + + address = stack + 4; + UINT32 popped_g4 = read_sized_word(11, address, 4); + + address = r5 + 2; + UINT32 offset = read_sized_word(11, address, 2); + if (!(address & 2)) offset >>= 16; + + UINT32 target = r5 + 2 + offset; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; branch relative to %08x if data stack second (%08x) == data stack top (%08x), pop_data result (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), target, l0_2, handler_base_2, popped_g4); + if (handler_base_2 == l0_2) + { + indent(); printf(" // branch will be taken\n"); + } + else + { + indent(); printf(" // branch will not be taken\n"); + indent(); printf(" // push pc (%08x) onto program stack\n", r5 + 2); + indent(); printf(" // push previous data stack top + 0x80000000 (%08x) onto program stack\n", l0_2 + 0x80000000); + indent(); printf(" // push diff of (result - stack top) (%08x = %08x - %08x) onto program stack\n", handler_base_2, l0_2 + 0x80000000, handler_base_2 - (l0_2 + 0x80000000)); + indent(); printf(" // program stack now %08x (%d words deep)\n", REG(6) - 12, (0xffeff000 - (REG(6) - 12)) / 4); + } + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 8, (0xffefebe4 - (stack + 8)) / 4); + + break; + } + + case 0x00a4: + { + UINT32 word0 = read_sized_word(11, REG(6), 4); + UINT32 word1 = read_sized_word(11, REG(6) + 4, 4); + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push result (%08x) to data stack, add the top two values on the program stack, store in result (%08x = %08x + %08x)\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), word0 + word1, word0, word1); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + } + + case 0x0121: + { + UINT32 address = stack; + UINT32 word = read_sized_word(11, address, 4); + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; logical-AND result with data stack pop, store in result (%08x = %08x & %08x)\n", r5, opcode, entry_point, opdesc.c_str(), word & REG(4), word, REG(4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + } + + case 0x0128: + { + UINT32 address = stack; + UINT32 word = read_sized_word(11, address, 4); + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; logical-OR result with data stack pop, store in result: %08x = %08x & %08x\n", r5, opcode, entry_point, opdesc.c_str(), word | REG(4), word, REG(4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + } + + case 0x0136: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; invert result (%08x -> %08x)\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), REG(4) ^ 0xffffffff); + break; + + case 0x014f: + { + UINT32 address = stack; + UINT32 word = read_sized_word(11, address, 4); + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; add result to data stack pop, store in result: %08x = %08x + %08x\n", r5, opcode, entry_point, opdesc.c_str(), word + REG(4), word, REG(4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + } + + case 0x0155: + { + UINT32 address = stack; + UINT32 word = read_sized_word(11, address, 4); + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; subtract result from data stack pop, store in result: %08x = %08x - %08x\n", r5, opcode, entry_point, opdesc.c_str(), word - REG(4), word, REG(4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + } + + case 0x017f: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push result (%08x) onto data stack, set result to address of opcode dispatcher\n", r5, opcode, entry_point, opdesc.c_str(), REG(4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + + case 0x01a9: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push result (%08x) onto program stack, pop result from data stack (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), read_sized_word(11, stack, 4)); + indent(); printf(" // program stack now %08x (%d words deep)\n", REG(6) - 4, (0xffeff000 - (REG(6) - 4)) / 4); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + + case 0x01b1: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push result (%08x) onto data stack, pop result from program stack (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), read_sized_word(11, REG(6), 4)); + indent(); printf(" // program stack now %08x (%d words deep)\n", REG(6) + 4, (0xffeff000 - (REG(6) + 4)) / 4); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + + case 0x01b9: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push result (%08x) onto data stack, assign program stack top to result (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), read_sized_word(11, REG(6), 4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + + case 0x01c0: + case 0x01c7: + { + UINT32 address = REG(6); + UINT32 half0 = read_sized_word(11, address, 2); + if (address & 2) half0 <<= 16; + + address = REG(6) + 2; + UINT32 half1 = read_sized_word(11, address, 2); + if (!(address & 2)) half1 >>= 16; + + UINT32 value = half0 | half1; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; return (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), value); + indent(); printf(" // program stack now %08x (%d words deep)\n", REG(6) + 4, (0xffeff000 - (REG(6) + 4)) / 4); + break; + } + + case 0x01cd: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; insert result (%08x) between data stack top (%08x) and next data stack entry\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), read_sized_word(11, stack, 4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + + case 0x01d5: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; throw away the word at the top of the data stack\n", r5, opcode, entry_point, opdesc.c_str()); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + + case 0x01f4: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; if result (%08x) >= 0, set result to 0, otherwise -1 (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), (REG(4) >= 0) ? 0 : ~0); + break; + + case 0x0217: + { + UINT32 value = read_sized_word(11, stack, 4); + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; if pop_data (%08x) >= result (%08x), set result to 0, otherwise -1 (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), value, REG(4), (value >= REG(4)) ? 0 : ~0); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + } + + case 0x022b: + { + UINT32 value = read_sized_word(11, stack, 4); + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; if pop_data (%08x) != result (%08x), set result to 0, otherwise -1 (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), value, REG(4), (value != REG(4)) ? 0 : ~0); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + } + + case 0x0236: + { + UINT32 value = read_sized_word(11, stack, 4); + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; if pop_data (%08x) == result (%08x), set result to 0, otherwise -1 (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), value, REG(4), (value == REG(4)) ? 0 : ~0); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + } + + case 0x026d: + { + UINT32 value = read_sized_word(11, stack, 4); + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; if pop_data (%08x) < result (%08x), set result to 0, otherwise -1 (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), value, REG(4), (value < REG(4)) ? 0 : ~0); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + } + + case 0x0278: + { + UINT32 value = read_sized_word(11, stack, 4); + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; if pop_data (%08x) > result (%08x), set result to 0, otherwise -1 (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), value, REG(4), (value > REG(4)) ? 0 : ~0); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (stack + 4)) / 4); + break; + } + + case 0x0289: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push result (%08x) to data stack\n", r5, opcode, entry_point, opdesc.c_str(), REG(4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + + case 0x0283: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; pop result from data stack (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), read_sized_word(11, stack, 4)); + break; + + case 0x028f: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push result (%08x) onto data stack, assign previous top (%08x) to result\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), read_sized_word(11, stack, 4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + + case 0x0296: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; swap result (%08x) with top of data stack (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), read_sized_word(11, stack, 4)); + break; + + case 0x029d: + { + UINT32 top = read_sized_word(11, stack, 4); + UINT32 next = read_sized_word(11, stack + 4, 4); + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; swap the top two values of the data stack (%08x <-> %08x), exchange second value with result (%08x <-> %08x)\n", r5, opcode, entry_point, opdesc.c_str(), top, next, REG(4), next); + break; + } + + case 0x02af: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; pop_data to throw away data_top, then pop_data into result (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), read_sized_word(11, stack + 4, 4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 8, (0xffefebe4 - (stack + 8)) / 4); + break; + + case 0x02b6: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; duplicate top of data stack (%08x) and push the result (%08x) in between\n", r5, opcode, entry_point, opdesc.c_str(), read_sized_word(11, stack, 4), REG(4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 8, (0xffefebe4 - (REG(7) - 8)) / 4); + break; + + case 0x02e2: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; load result with value on data stack (%08x) indexed by result (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), read_sized_word(11, stack + (REG(4) << 2), 4), REG(4)); + break; + + case 0x02f2: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; decrement result (%08x = %08x - 1)\n", r5, opcode, entry_point, opdesc.c_str(), REG(4) - 1, REG(4)); + break; + + case 0x0306: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; shift result left by 1 bit (%08x = %08x << 1)\n", r5, opcode, entry_point, opdesc.c_str(), REG(4) << 1, REG(4)); + break; + + case 0x031e: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; store 0 at address contained by result (%08x), pop word from data stack into result (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), read_sized_word(11, stack, 4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 4, (0xffefebe4 - (REG(7) + 4)) / 4); + break; + + case 0x0334: + { + UINT32 address = REG(4); + UINT32 half0 = read_sized_word(11, address, 2); + if (address & 2) half0 <<= 16; + + address = REG(4) + 2; + UINT32 half1 = read_sized_word(11, address, 2); + if (!(address & 2)) half1 >>= 16; + + UINT32 value = half0 | half1; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; load result with word (%08x) at result address (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), value, REG(4)); + break; + } + + case 0x0349: + { + UINT32 address = REG(4); + UINT32 value = read_sized_word(11, address, 2); + if (!(address & 2)) value >>= 16; + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; load result with unsigned halfword (%04x) at result address (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), value, REG(4)); + break; + } + + case 0x0353: + { + UINT32 address = REG(4); + UINT32 value = read_sized_word(11, address, 1); + value >>= (3 - (address & 3)) * 8; + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; load result with unsigned byte (%02x) at result address (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), value, REG(4)); + break; + } + + case 0x0381: + case 0x0382: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; pop_data (%08x) into address contained by result (%08x), pop_data (%08x) into result\n", r5, opcode, entry_point, opdesc.c_str(), read_sized_word(11, stack, 4), REG(4), read_sized_word(11, stack + 4, 4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 8, (0xffefebe4 - (stack + 8)) / 4); + break; + + case 0x045a: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; pop word from data stack and add it to result << 2, (%08x = %08x + (%08x << 2))\n", r5, opcode, entry_point, opdesc.c_str(), (REG(4) << 2) + read_sized_word(11, stack, 4), read_sized_word(11, stack, 4), REG(4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + + case 0x0462: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; pop word from data stack and add it to result << 1, (%08x = %08x + (%08x << 1))\n", r5, opcode, entry_point, opdesc.c_str(), (REG(4) << 1) + read_sized_word(11, stack, 4), read_sized_word(11, stack, 4), REG(4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + + case 0x046a: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; increment result (%08x = %08x + 1\n", r5, opcode, entry_point, opdesc.c_str(), REG(4) + 1, REG(4)); + break; + + case 0x047e: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; add 2 to result (%08x = %08x + 2\n", r5, opcode, entry_point, opdesc.c_str(), REG(4) + 2, REG(4)); + break; + + case 0x04ff: + { + UINT32 address = r5 + 2; + UINT32 next_op = read_sized_word(11, address, 2); + if (!(address & 2)) next_op >>= 16; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push_data result (%08x), load result with entry_point for next opcode (%08x = %08x + %08x, op %04x)\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), REG(2) + (next_op << 2), REG(2), next_op << 2, next_op); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + } + + case 0x050a: + { + UINT32 byte_addr = read_sized_word(11, REG(6), 4); + UINT32 address_shift = (3 - (byte_addr & 3)) * 8; + UINT8 value = read_sized_word(11, byte_addr, 1) >> address_shift; + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push result (%08x) onto data stack\n", r5, opcode, entry_point, opdesc.c_str(), REG(4)); + indent(); printf(" // load result with byte pointed to by top of program stack (%02x)\n", value); + indent(); printf(" // push address of next byte (%08x) onto data stack\n", byte_addr + 1); + indent(); printf(" // add (result + 3) to program_top and clear the low bit (now %08x)\n", (byte_addr + value + 3) & ~1); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 8, (0xffefebe4 - (stack - 8)) / 4); + break; + } + + case 0x05ca: + { + // + UINT32 address = REG(4); + UINT32 g2_offset = read_sized_word(11, address, 2); + if (!(address & 2)) g2_offset >>= 16; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; add halfword at address in result (%08x) to forth table base pointer (%08x) and store in result (%08x = %08x + %08x)\n", r5, opcode, entry_point, opdesc.c_str(), address, REG(2), REG(2) + g2_offset, REG(2), g2_offset); + break; + } + + case 0x05e6: + { + UINT32 address = REG(4); + UINT32 next_op = read_sized_word(11, address, 2); + if (!(address & 2)) next_op >>= 16; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; load result with entry_point for opcode (%08x = %08x + %08x, op %04x) pointed to by result (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), REG(2) + (next_op << 2), REG(2), next_op << 2, next_op, REG(4)); + break; + } + + case 0x05ee: + case 0x05ef: + { + UINT32 stack_top = read_sized_word(11, stack, 4); + UINT32 new_opcode = (stack_top - REG(2)) >> 2; + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; pop word (%08x) from the data stack, turn it into a 16-bit opcode (%04x)\n", r5, opcode, entry_point, opdesc.c_str(), stack_top, new_opcode); + indent(); printf(" // store the opcode at the address contained in the result (%08x)\n", REG(4)); + indent(); printf(" // pop word from the data stack into to the result (%08x)\n", read_sized_word(11, stack + 4, 4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 8, (0xffefebe4 - (stack + 8)) / 4); + break; + } + + case 0x05fe: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push result (%08x) onto data stack, load base pointer of Fcode table (%08x) into result\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), REG(2)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + + case 0x0613: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; if result (%08x) is equal to g2 (%08x), push result to data stack and load with 0, else push nothing and load with ~0\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), REG(2)); + if (REG(4) == REG(2)) + { + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + } + break; + + case 0x0668: + { + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; some complex junk I don't understand, the amount of asm in this function is a PITA.\n", r5, opcode, entry_point, opdesc.c_str()); + indent(); printf(" // basically it involves a bunch of comparisons between whatever's on the top of the stack, the\n"); + indent(); printf(" // current result, and some other weird junk like 0x20000000\n"); + indent(); printf(" // like seriously, this function is a couple hundred lines of asm long\n"); + break; + } + + case 0x3d38: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; call ffe8fe90\n", r5, opcode, entry_point, opdesc.c_str()); + indent(); printf(" // program stack now %08x (%d words deep)\n", REG(6) - 4, (0xffeff000 - (REG(6) - 4)) / 4); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + + case 0x3fd2: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; pop address from data stack (%08x), pop data from data stack (%08x)\n", r5, opcode, entry_point, opdesc.c_str(), read_sized_word(11, stack, 4), read_sized_word(11, stack + 4, 4)); + indent(); printf(" // address at ASI specified by result (%d), then pop word from data stack (%08x) into result\n", REG(4), read_sized_word(11, stack + 8, 4)); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack + 12, (0xffefebe4 - (stack + 12)) / 4); + break; + + case 0x4181: + { + UINT32 address = handler_base + 2; + UINT32 g3_offset = read_sized_word(11, address, 2); + if (!(address & 2)) g3_offset >>= 16; + + address = REG(3) + g3_offset; + UINT32 new_result = read_sized_word(11, address, 2); + if (!(address & 2)) new_result >>= 16; + + indent(); printf("Opcode at %08x: %04x, entry is at %08x // %s ; push result (%08x) to data stack, load halfword (%04x) from handler table\n", r5, opcode, entry_point, opdesc.c_str(), REG(4), g3_offset); + indent(); printf(" // use g3 (%08x) plus first halfword as the address (%08x) from which to load a halfword (%04x) into result\n", REG(3), address, new_result); + indent(); printf(" // data stack now %08x (%d words deep)\n", stack - 4, (0xffefebe4 - (stack - 4)) / 4); + break; + } + + default: + indent(); printf("Opcode at %08x: %04x, entry is at %08x // unknown\n", r5, opcode, entry_point); + break; + } + } +} diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp index f41253ffb6f..655df3f3084 100644 --- a/src/devices/video/zeus2.cpp +++ b/src/devices/video/zeus2.cpp @@ -22,7 +22,7 @@ const device_type ZEUS2 = &device_creator<zeus2_device>; zeus2_device::zeus2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, ZEUS2, "Midway Zeus2", tag, owner, clock, "zeus2", __FILE__), - m_vblank(*this), m_irq(*this), m_ieee754_float(0) + m_vblank(*this), m_irq(*this), m_atlantis(0) { } @@ -104,6 +104,7 @@ void zeus2_device::device_start() save_item(NAME(zeus_texbase)); save_item(NAME(m_fill_color)); save_item(NAME(m_fill_depth)); + save_item(NAME(m_renderPtr)); } void zeus2_device::device_reset() @@ -111,13 +112,15 @@ void zeus2_device::device_reset() memset(m_zeusbase, 0, sizeof(m_zeusbase[0]) * 0x80); memset(m_renderRegs, 0, sizeof(m_renderRegs[0]) * 0x40); - zbase = 64.0f; - m_yScale = 1; - yoffs = 0; + zbase = 32.0f; + m_yScale = 0; + yoffs = 0x1dc000; + //yoffs = 0x00040000; texel_width = 256; zeus_fifo_words = 0; m_fill_color = 0; m_fill_depth = 0; + m_renderPtr = 0; } void zeus2_device::device_stop() @@ -190,8 +193,8 @@ UINT32 zeus2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, poly->wait(); -if (machine().input().code_pressed(KEYCODE_UP)) { zbase += 1.0f; popmessage("Zbase = %f", (double) zbase); } -if (machine().input().code_pressed(KEYCODE_DOWN)) { zbase -= 1.0f; popmessage("Zbase = %f", (double) zbase); } + if (machine().input().code_pressed(KEYCODE_DOWN)) { zbase += machine().input().code_pressed(KEYCODE_LSHIFT) ? 0x10 : 1; popmessage("Zbase = %f", (double)zbase); } + if (machine().input().code_pressed(KEYCODE_UP)) { zbase -= machine().input().code_pressed(KEYCODE_LSHIFT) ? 0x10 : 1; popmessage("Zbase = %f", (double)zbase); } /* normal update case */ if (!machine().input().code_pressed(KEYCODE_W)) @@ -214,14 +217,17 @@ if (machine().input().code_pressed(KEYCODE_DOWN)) { zbase -= 1.0f; popmessage("Z { const void *base; - if (machine().input().code_pressed(KEYCODE_DOWN)) yoffs += machine().input().code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1; - if (machine().input().code_pressed(KEYCODE_UP)) yoffs -= machine().input().code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1; + if (machine().input().code_pressed(KEYCODE_DOWN)) yoffs += machine().input().code_pressed(KEYCODE_LSHIFT) ? 0x1000 : 40; + if (machine().input().code_pressed(KEYCODE_UP)) yoffs -= machine().input().code_pressed(KEYCODE_LSHIFT) ? 0x1000 : 40; if (machine().input().code_pressed(KEYCODE_LEFT) && texel_width > 4) { texel_width >>= 1; while (machine().input().code_pressed(KEYCODE_LEFT)) ; } if (machine().input().code_pressed(KEYCODE_RIGHT) && texel_width < 512) { texel_width <<= 1; while (machine().input().code_pressed(KEYCODE_RIGHT)) ; } if (yoffs < 0) yoffs = 0; - if (1) - base = waveram0_ptr_from_expanded_addr(yoffs << 16); + if (1) { + //base = waveram0_ptr_from_expanded_addr(yoffs << 8); + //base = waveram0_ptr_from_expanded_addr(yoffs); + base = WAVERAM_BLOCK0(yoffs); + } else base = (void *)&m_frameColor[yoffs << 6]; @@ -240,7 +246,7 @@ if (machine().input().code_pressed(KEYCODE_DOWN)) { zbase -= 1.0f; popmessage("Z } } } - popmessage("offs = %06X base = %08X", yoffs, yoffs<<16); + popmessage("offs = %06X base = %08X", yoffs, base); } return 0; @@ -399,26 +405,16 @@ void zeus2_device::zeus2_register_update(offs_t offset, UINT32 oldval, int logit case 0x30: { - int horPixels = (m_zeusbase[0x34] & 0xffff) - (m_zeusbase[0x33] >> 16); - // Just a guess. Atlantis startup has two scanlines per physical ram row - if (horPixels <= 0x200) - m_yScale = 1; - else - m_yScale = 0; - popmessage("reg[30]: %08X horPixels: %d scale: %d", m_zeusbase[0x30], horPixels, m_yScale); + m_yScale = (((m_zeusbase[0x39] >> 16) & 0xfff) < 0x100) ? 0 : 1; + int hor = ((m_zeusbase[0x34] & 0xffff) - (m_zeusbase[0x33] >> 16)) << m_yScale; + int ver = ((m_zeusbase[0x35] & 0xffff) + 1) << m_yScale; + popmessage("reg[30]: %08X Screen: %dH X %dV yScale: %d", m_zeusbase[0x30], hor, ver, m_yScale); } - break; - - case 0x33: - case 0x34: - case 0x35: - case 0x36: - case 0x37: m_screen->update_partial(m_screen->vpos()); { - int vtotal = (m_zeusbase[0x37] & 0xffff); - int htotal = (m_zeusbase[0x34] >> 16); - rectangle visarea((m_zeusbase[0x33] >> 16), htotal - 1, 0, (m_zeusbase[0x35] & 0xffff)); + int vtotal = (m_zeusbase[0x37] & 0xffff) << m_yScale; + int htotal = (m_zeusbase[0x34] >> 16) << m_yScale; + rectangle visarea((m_zeusbase[0x33] >> 16) << m_yScale, htotal - 1, 0, (m_zeusbase[0x35] & 0xffff) << m_yScale); if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) { m_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)ZEUS2_VIDEO_CLOCK / 4.0 / (htotal * vtotal))); @@ -426,11 +422,18 @@ void zeus2_device::zeus2_register_update(offs_t offset, UINT32 oldval, int logit zeus_cliprect.max_x -= zeus_cliprect.min_x; zeus_cliprect.min_x = 0; // Startup vblank timer - vblank_timer->adjust(attotime::from_usec(100)); + vblank_timer->adjust(attotime::from_usec(1)); } } break; + case 0x33: + case 0x34: + case 0x35: + case 0x36: + case 0x37: + break; + case 0x38: { UINT32 temp = m_zeusbase[0x38]; @@ -527,17 +530,24 @@ void zeus2_device::zeus2_register_update(offs_t offset, UINT32 oldval, int logit logerror("zeus2_register_update: Warning! Different fill colors are set.\n"); } } - else if (1 && ((m_zeusbase[0x50] & 0x000f0000)==0x80000) && (m_zeusbase[0x50] & 0xffff)) { + //else if (1 && ((m_zeusbase[0x50] & 0x000f0000)==0x80000) && (m_zeusbase[0x50] & 0xffff)) { + else if ((m_zeusbase[0x50] & 0x80000) && (m_zeusbase[0x50] & 0xffff)) { // Fast fill // Unknown what the exact bit fields are, this is a just a guess // Atlantis: 0x00983FFF => clear entire frame buffer, 0x00981FFF => clear one frame // crusnexo: 0x007831FF => clear one frame // thegrid: 0x008831FF => clear one frame - // thegrid: 0x0079FFFF => clear one frame at 51=0 then 51=00800000 ??? - UINT32 addr = frame_addr_from_reg51(); + // thegrid: 0x0079FFFF => clear entire frame buffer at 51=0 then 51=00800000, only seen at initial tests in thegrid + UINT32 addr = frame_addr_from_phys_addr(m_zeusbase[0x51]); UINT32 numBytes = (m_zeusbase[0x50] & 0xffff) + 1; numBytes *= 0x40; - //printf("Clearing buffer: numPixels: %08X addr: %08X reg50: %08X\n", numBytes/4, addr, m_zeusbase[0x50]); + if (m_zeusbase[0x50] & 0x10000) { + addr = 0x0; + numBytes = WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 8; + //printf("Clearing buffer: numBytes: %08X addr: %08X reg50: %08X\n", numBytes, addr, m_zeusbase[0x50]); + } + if (logit) + logerror(" -- Clearing buffer: numBytes: %08X addr: %08X reg51: %08X", numBytes, addr, m_zeusbase[0x51]); memset(&m_frameColor[addr], m_fill_color, numBytes); memset(&m_frameDepth[addr], m_fill_depth, numBytes/2); } @@ -562,7 +572,7 @@ void zeus2_device::zeus2_register_update(offs_t offset, UINT32 oldval, int logit } /* make sure we log anything else */ else if (1 || logit) - logerror("\t[50]=%08X [5E]=%08X\n", m_zeusbase[0x50], m_zeusbase[0x5e]); + logerror("\tw[50]=%08X [5E]=%08X\n", m_zeusbase[0x50], m_zeusbase[0x5e]); } break; case 0x51: @@ -617,11 +627,12 @@ void zeus2_device::zeus2_register_update(offs_t offset, UINT32 oldval, int logit } /* make sure we log anything else */ - else if (logit) - logerror("\t[50]=%08X [5E]=%08X", m_zeusbase[0x50], m_zeusbase[0x5e]); + else if ((m_zeusbase[0x5e] >> 16) == 0xf208) + if (logit) + logerror("\t[50]=%08X [5E]=%08X", m_zeusbase[0x50], m_zeusbase[0x5e]); break; - case 0x6a: case 0x6b: + case 0x63: case 0x6a: case 0x6b: case 0x76: case 0x77: if (logit) logerror("\tfloatIEEE754 = %8.2f", reinterpret_cast<float&>(m_zeusbase[offset])); @@ -667,7 +678,9 @@ if (subregdata_count[which] < 256) { case 0x40: m_renderMode = value; - zeus_quad_size = (m_renderMode & 0x4) ? 14 : 10; + // 0x020202 crusnexo quad ?? + //zeus_quad_size = ((m_renderMode & 0xff) == 0x04) ? 14 : 10; + //zeus_quad_size = (m_renderMode & 0x020000) ? 14 : 10; if (logit) logerror("\tRender Mode = %06X", m_renderMode); //printf("\tRender Mode = %06X\n", m_renderMode); @@ -679,6 +692,11 @@ if (subregdata_count[which] < 256) logerror("\tRender Reset"); break; + case 0x04: + if (logit) + logerror("\t(R%02X) = %06x Render Loc", which, value); + break; + case 0x05: zeus_texbase = value % (WAVERAM0_HEIGHT * WAVERAM0_WIDTH); if (logit) @@ -797,13 +815,15 @@ int zeus2_device::zeus2_fifo_process(const UINT32 *data, int numwords) break; /* 0x1c: */ + // 0x1b: the grid + case 0x1b: case 0x1c: if (numwords < 4) return FALSE; if (log_fifo) { log_fifo_command(data, numwords, " -- unknown control + happens after clear screen\n"); - logerror("\t\tvector %8.2f %8.2f %8.5f\n", + logerror("\t\tvector2 %8.2f %8.2f %8.5f\n", (double) convert_float(data[1]), (double) convert_float(data[2]), (double) convert_float(data[3])); @@ -815,6 +835,19 @@ int zeus2_device::zeus2_fifo_process(const UINT32 *data, int numwords) } break; + // thegrid ??? + case 0x1d: + if (numwords < 2) + return FALSE; + //zeus_point[2] = convert_float(data[1]); + if (log_fifo) + { + log_fifo_command(data, numwords, " -- unknown\n"); + logerror("\t\tdata %8.5f\n", + (double)convert_float(data[1])); + } + break; + /* 0x23: render model in waveram (thegrid) */ /* 0x24: render model in waveram (crusnexo) */ // 0x17: ??? (atlantis) @@ -829,36 +862,41 @@ int zeus2_device::zeus2_fifo_process(const UINT32 *data, int numwords) zeus2_draw_model(data[1], data[0] & 0x3fff, log_fifo); break; - // 0x2d; direct render quad (atlantis) + // 0x2d; set direct render pixels location (atlantis) case 0x2d: if (numwords < 2) return FALSE; if (log_fifo) log_fifo_command(data, numwords, "\n"); + m_renderPtr = frame_addr_from_phys_addr(data[1]); //zeus2_draw_model(data[1], data[0] & 0xff, log_fifo); break; - // 0x25 ?? (atlantis) - case 0x25: - if (log_fifo) - log_fifo_command(data, numwords, "\n"); - //zeus_quad_size = 14; - break; - /* 0x31: sync pipeline? (thegrid) */ /* 0x32: sync pipeline? (crusnexo) */ + // 0x25 ?? (atlantis) + case 0x25: case 0x31: case 0x32: if (log_fifo) - log_fifo_command(data, numwords, "\n"); + log_fifo_command(data, numwords, " sync? \n"); //zeus_quad_size = 10; break; /* 0x38: direct render quad (crusnexo) */ // 0x38: ?? (atlantis) case 0x38: - if (numwords < 12) + if (data[0] == 0x38000000) { + if (numwords < 3) + return FALSE; + // Direct write to frame buffer + m_frameColor[m_renderPtr++] = conv_rgb555_to_rgb32((UINT16)data[1]); + m_frameColor[m_renderPtr++] = conv_rgb555_to_rgb32((UINT16)(data[1] >> 16)); + m_frameColor[m_renderPtr++] = conv_rgb555_to_rgb32((UINT16)data[2]); + m_frameColor[m_renderPtr++] = conv_rgb555_to_rgb32((UINT16)(data[2] >> 16)); + } else if (numwords < 12) return FALSE; + //print_fifo_command(data, numwords, "\n"); if (log_fifo) log_fifo_command(data, numwords, "\n"); break; @@ -891,7 +929,9 @@ void zeus2_device::zeus2_draw_model(UINT32 baseaddr, UINT16 count, int logit) int databufcount = 0; int model_done = FALSE; UINT32 texdata = 0; - int quadsize = zeus_quad_size; + + // need to only set the quad size at the start of model ?? + zeus_quad_size = (m_renderMode & 0x020000) ? 14 : 10; if (logit) logerror(" -- model @ %08X, len %04X\n", baseaddr, count); @@ -920,12 +960,14 @@ void zeus2_device::zeus2_draw_model(UINT32 baseaddr, UINT16 count, int logit) /* if this is enough, process the command */ cmd = databuffer[0] >> 24; if ((cmd == 0x38) || (cmd == 0x2d)) - countneeded = quadsize; + countneeded = zeus_quad_size; if (databufcount == countneeded) { /* handle logging of the command */ if (logit) { + //if ((cmd == 0x38) || (cmd == 0x2d)) + // log_render_info(); int offs; logerror("\t"); for (offs = 0; offs < databufcount; offs++) @@ -962,11 +1004,6 @@ void zeus2_device::zeus2_draw_model(UINT32 baseaddr, UINT16 count, int logit) break; case 0x2d: // atlantis - //texdata = m_renderRegs[0x14]; - //texdata = databuffer[1]; - //databuffer[1] = m_renderRegs[0x14]; - //databuffer[1] = 0; - //poly->zeus2_draw_quad(&databuffer[1], texoffs, logit); poly->zeus2_draw_quad(databuffer, texdata, logit); break; @@ -975,11 +1012,11 @@ void zeus2_device::zeus2_draw_model(UINT32 baseaddr, UINT16 count, int logit) break; default: - if (quadsize == 10) - { - logerror("Correcting quad size\n"); - quadsize = 14; - } + //if (quadsize == 10) + //{ + // logerror("Correcting quad size\n"); + // quadsize = 14; + //} if (logit) logerror("unknown model data\n"); break; @@ -1010,11 +1047,16 @@ void zeus2_renderer::zeus2_draw_quad(const UINT32 *databuffer, UINT32 texdata, i if (logit) m_state->logerror("quad %d\n", m_state->zeus_quad_size); - if (machine().input().code_pressed(KEYCODE_Q) && (texdata & 0xffff) == 0x119) return; - if (machine().input().code_pressed(KEYCODE_E) && (texdata & 0xffff) == 0x01d) return; - if (machine().input().code_pressed(KEYCODE_R) && (texdata & 0xffff) == 0x11d) return; - if (machine().input().code_pressed(KEYCODE_T) && (texdata & 0xffff) == 0x05d) return; - if (machine().input().code_pressed(KEYCODE_Y) && (texdata & 0xffff) == 0x0dd) return; + if (machine().input().code_pressed(KEYCODE_Q) && (m_state->m_renderRegs[0x5] != 0x1fdf00)) return; + if (machine().input().code_pressed(KEYCODE_E) && (m_state->m_renderRegs[0x5] != 0x07f540)) return; + if (machine().input().code_pressed(KEYCODE_R) && (m_state->m_renderRegs[0x5] != 0x081580)) return; + if (machine().input().code_pressed(KEYCODE_T) && (m_state->m_renderRegs[0x5] != 0x14db00)) return; + if (machine().input().code_pressed(KEYCODE_Y) && (m_state->m_renderRegs[0x5] != 0x14d880)) return; + //if (machine().input().code_pressed(KEYCODE_Q) && (texdata & 0xffff) == 0x119) return; + //if (machine().input().code_pressed(KEYCODE_E) && (texdata & 0xffff) == 0x01d) return; + //if (machine().input().code_pressed(KEYCODE_R) && (texdata & 0xffff) == 0x11d) return; + //if (machine().input().code_pressed(KEYCODE_T) && (texdata & 0xffff) == 0x05d) return; + //if (machine().input().code_pressed(KEYCODE_Y) && (texdata & 0xffff) == 0x0dd) return; //if (machine().input().code_pressed(KEYCODE_U) && (texdata & 0xffff) == 0x119) return; //if (machine().input().code_pressed(KEYCODE_I) && (texdata & 0xffff) == 0x119) return; //if (machine().input().code_pressed(KEYCODE_O) && (texdata & 0xffff) == 0x119) return; @@ -1060,11 +1102,9 @@ void zeus2_renderer::zeus2_draw_quad(const UINT32 *databuffer, UINT32 texdata, i 38810000 00000000 00C7|FF38 FF5E|FF5E 15400154 11400114 00000000 00000000 FF38|00C7 00A3|00A3 -- quad xxxx|xxxx yyyy|yyyy xxxx|xxxx yyyy|yyyy */ - - UINT32 renderMode = m_state->m_renderMode; // Altantis rendermode: 0x024004 startup, then 0x020202, then 0x021E0E /* extract raw x,y,z */ - if (m_state->zeus_quad_size==14) { + if (m_state->m_atlantis) { // Atlantis quad 14 texdata = databuffer[1]; vert[0].x = (INT16)databuffer[2]; @@ -1090,13 +1130,6 @@ void zeus2_renderer::zeus2_draw_quad(const UINT32 *databuffer, UINT32 texdata, i vert[3].p[0] = (INT16)(databuffer[8] >> 16); vert[3].p[1] = (databuffer[9] >> 16) & 0xff; vert[3].p[2] = (databuffer[9] >> 24) & 0xff; - - // buffer 10-13 ???? 00000000 1FF7FC00 00000000 1FF7FC00 -- quad 14 - /* extract the translation point from the raw data */ - m_state->zeus_point[0] = m_state->convert_float(databuffer[10]); - m_state->zeus_point[1] = m_state->convert_float(databuffer[11]); - m_state->zeus_point[2] = m_state->convert_float(databuffer[12]); - // 13??? } else { //printf("renderMode: %06X\n", m_state->m_renderMode); @@ -1124,6 +1157,24 @@ void zeus2_renderer::zeus2_draw_quad(const UINT32 *databuffer, UINT32 texdata, i vert[3].p[1] = (databuffer[5] >> 12) & 0xff; vert[3].p[2] = (databuffer[5] >> 22) & 0xff; } + int unknown[8]; + float unknownFloat[4]; + if (m_state->zeus_quad_size == 14) { + // buffer 10-13 ???? 00000000 1FF7FC00 00000000 1FF7FC00 -- mwskinsa quad 14 + /* 10:13 16 bit coordinates */ + unknown[0] = (INT16)databuffer[10]; + unknown[1] = (INT16)(databuffer[10] >> 16); + unknown[2] = (INT16)databuffer[11]; + unknown[3] = (INT16)(databuffer[11] >> 16); + unknown[4] = (INT16)databuffer[12]; + unknown[5] = (INT16)(databuffer[12] >> 16); + unknown[6] = (INT16)databuffer[13]; + unknown[7] = (INT16)(databuffer[13] >> 16); + unknownFloat[0] = m_state->convert_float(databuffer[10]); + unknownFloat[1] = m_state->convert_float(databuffer[11]); + unknownFloat[2] = m_state->convert_float(databuffer[12]); + unknownFloat[3] = m_state->convert_float(databuffer[13]); + } /* vert[0].x = (INT16)databuffer[1]; vert[0].y = (INT16)databuffer[3]; @@ -1150,58 +1201,119 @@ void zeus2_renderer::zeus2_draw_quad(const UINT32 *databuffer, UINT32 texdata, i vert[3].p[2] = (UINT16)(databuffer[7] >> 16); */ + int logextra = 1; + + //float xScale = 1.0f / 8.0f; + //float yScale = 1.0f / 8.0f; + //float zScale = 1.0f / 8.0f; for (i = 0; i < 4; i++) { float x = vert[i].x; float y = vert[i].y; float z = vert[i].p[0]; - - vert[i].x = x * m_state->zeus_matrix[0][0] + y * m_state->zeus_matrix[0][1] + z * m_state->zeus_matrix[0][2] + m_state->zeus_point[0]; - vert[i].y = x * m_state->zeus_matrix[1][0] + y * m_state->zeus_matrix[1][1] + z * m_state->zeus_matrix[1][2] + m_state->zeus_point[1]; - vert[i].p[0] = x * m_state->zeus_matrix[2][0] + y * m_state->zeus_matrix[2][1] + z * m_state->zeus_matrix[2][2] + m_state->zeus_point[2]; - vert[i].p[0] += m_state->zbase; + //if (0) { + // x *= xScale; + // y *= yScale; + // z *= zScale; + + //} + vert[i].x = x * m_state->zeus_matrix[0][0] + y * m_state->zeus_matrix[0][1] + z * m_state->zeus_matrix[0][2]; + vert[i].y = x * m_state->zeus_matrix[1][0] + y * m_state->zeus_matrix[1][1] + z * m_state->zeus_matrix[1][2]; + vert[i].p[0] = x * m_state->zeus_matrix[2][0] + y * m_state->zeus_matrix[2][1] + z * m_state->zeus_matrix[2][2]; + + if (1 || !(m_state->m_renderRegs[0x14] & 0x000001)) { + vert[i].x += m_state->zeus_point[0]; + vert[i].y += m_state->zeus_point[1]; + vert[i].p[0] += m_state->zeus_point[2]; + } + if (0) + vert[i].p[0] += m_state->zbase; + else { + int shift; + // Not sure why but atlantis coordinates are scaled differently + if (0 && m_state->m_atlantis) + shift = 2048 >> m_state->m_zeusbase[0x6c]; + else + shift = 1024 >> m_state->m_zeusbase[0x6c]; + //int shift = 8 << ((m_state->m_renderRegs[0x14] >> 4) & 0xf); + vert[i].p[0] += shift; + } + //vert[i].p[0] *= 2.0f; vert[i].p[2] += texdata >> 16; vert[i].p[1] *= 256.0f; vert[i].p[2] *= 256.0f; - if (logit) + // back face cull using polygon normal and first vertex + if (1 && i == 0) + { + INT8 normal[3]; + float rotnormal[3]; + + normal[0] = databuffer[0] >> 0; + normal[1] = databuffer[0] >> 8; + normal[2] = databuffer[0] >> 16; + + rotnormal[0] = normal[0] * m_state->zeus_matrix[0][0] + normal[1] * m_state->zeus_matrix[0][1] + normal[2] * m_state->zeus_matrix[0][2]; + rotnormal[1] = normal[0] * m_state->zeus_matrix[1][0] + normal[1] * m_state->zeus_matrix[1][1] + normal[2] * m_state->zeus_matrix[1][2]; + rotnormal[2] = normal[0] * m_state->zeus_matrix[2][0] + normal[1] * m_state->zeus_matrix[2][1] + normal[2] * m_state->zeus_matrix[2][2]; + + float dot = rotnormal[0] * vert[0].x + rotnormal[1] * vert[0].y + rotnormal[2] * vert[0].p[0]; + + if (dot >= 0) + return; + } + + + if (logextra & logit) { m_state->logerror("\t\t(%f,%f,%f) (%02X,%02X)\n", (double)vert[i].x, (double)vert[i].y, (double)vert[i].p[0], (int)(vert[i].p[1] / 256.0f), (int)(vert[i].p[2] / 256.0f)); } } - float clipVal = 1.0f / 512.0f / 4.0f; + if (logextra & logit && m_state->zeus_quad_size == 14) { + m_state->logerror("uknown: int16: %d %d %d %d %d %d %d %d float: %f %f %f %f\n", + unknown[0], unknown[1], unknown[2], unknown[3], unknown[4], unknown[5], unknown[6], unknown[7], + unknownFloat[0], unknownFloat[1], unknownFloat[2], unknownFloat[3]); + } + bool enable_perspective = true;// !(m_state->m_renderRegs[0x14] & 0x80); + float clipVal = enable_perspective ? 1.0f / 512.0f / 4.0f : -1.0f; numverts = this->zclip_if_less(4, &vert[0], &clipvert[0], 4, clipVal); if (numverts < 3) return; + float xOrigin = reinterpret_cast<float&>(m_state->m_zeusbase[0x6a]); + float yOrigin = reinterpret_cast<float&>(m_state->m_zeusbase[0x6b]); + + float oozBase = (m_state->m_atlantis) ? 1024.0f : 512.0f; + maxx = maxy = -1000.0f; for (i = 0; i < numverts; i++) { - // 412.0f here works for crusnexo - float ooz = 512.0f / clipvert[i].p[0]; - - // ooz *= 1.0f / (512.0f * 512.0f); - - clipvert[i].x *= ooz; - clipvert[i].y *= ooz; - if (1 && renderMode != 0) { - clipvert[i].x += 256.5f / 1.0f; - clipvert[i].y += 200.5f / 1.0f; - //clipvert[i].x += reinterpret_cast<float&>(m_state->m_zeusbase[0x6a]) / float(1 << (renderMode & 0xff)); // 256.5f; - //clipvert[i].y += reinterpret_cast<float&>(m_state->m_zeusbase[0x6b]) / float(1 << (renderMode & 0xff)); // 200.5f; - //clipvert[i].y += reinterpret_cast<float&>(m_state->m_zeusbase[0x76]); // 799.0f; - //clipvert[i].x += reinterpret_cast<float&>(m_state->m_zeusbase[0x77]); // 511.0f; - } else { - clipvert[i].x += 256.5f; - clipvert[i].y += 200.5f; + // mwskinsa has R14=0x40a1 for tips box which has z=0 + //if (!(m_state->m_renderRegs[0x14] & 0x1)) { + if (enable_perspective) { + // 412.0f here works for crusnexo + // 1024.0f works for mwskinsa + float ooz = oozBase / clipvert[i].p[0]; + //float ooz = 1024.0f / clipvert[i].p[0]; + //float ooz = float(1 << m_state->m_zeusbase[0x6c]) / clipvert[i].p[0]; + + clipvert[i].x *= ooz; + clipvert[i].y *= ooz; + } + if (1) { + //clipvert[i].x += 256.5f / 1.0f; + //clipvert[i].y += 200.5f / 1.0f; + clipvert[i].x += xOrigin; + clipvert[i].y += yOrigin; } + clipvert[i].p[0] *= 65536.0f * 16.0f; maxx = MAX(maxx, clipvert[i].x); maxy = MAX(maxy, clipvert[i].y); - if (logit) + if (logextra & logit) m_state->logerror("\t\t\tTranslated=(%f,%f)\n", (double)clipvert[i].x, (double)clipvert[i].y); } for (i = 0; i < numverts; i++) @@ -1214,23 +1326,12 @@ void zeus2_renderer::zeus2_draw_quad(const UINT32 *databuffer, UINT32 texdata, i zeus2_poly_extra_data& extra = this->object_data_alloc(); int texmode = texdata & 0xffff; + // 0x014d == atlantis initial screen and scoreboard background + //if (texmode != 0x014D) return; // Just a guess but seems to work - switch ((texmode >> 2) & 3) - { - case 3: - extra.texwidth = 256; - break; - case 2: - extra.texwidth = 128; - break; - case 1: - extra.texwidth = 64; - break; - case 0: - default: - extra.texwidth = 32; - break; - } + //extra.texwidth = 2 << ((texmode >> 2) & 7); + extra.texwidth = 0x20 << ((texmode >> 2) & 3); + //extra.texwidth = 0x2 << ((texmode >> 2) & 0xf); //switch (texmode) //{ @@ -1282,11 +1383,17 @@ void zeus2_renderer::zeus2_draw_quad(const UINT32 *databuffer, UINT32 texdata, i //} extra.solidcolor = 0;//m_zeusbase[0x00] & 0x7fff; - extra.zoffset = 0;//m_zeusbase[0x7e] >> 16; + extra.zoffset = m_state->m_renderRegs[0x15]; extra.alpha = 0;//m_zeusbase[0x4e]; - extra.transcolor = 0x100;//((databuffer[1] >> 16) & 1) ? 0 : 0x100; + extra.transcolor = 0x100; // !(texmode & 100) ? 0 : 0x100; extra.texbase = WAVERAM_BLOCK0_EXT(m_state->zeus_texbase); extra.palbase = m_state->waveram0_ptr_from_expanded_addr(m_state->m_zeusbase[0x41]); + //extra.depth_test_enable = !(m_state->m_renderMode & 0x020000); + // crusnexo text is R14=0x4062 + extra.depth_test_enable = !(m_state->m_renderRegs[0x14] & 0x000020); + //extra.depth_test_enable = !(m_state->m_renderMode & 0x000002); + //extra.depth_test_enable = true; // (texmode & 0x0010); + extra.depth_write_enable = true; // Note: Before being converted to the "poly.h" interface, this used to call the polylgcy function // poly_render_quad_fan. The behavior seems to be the same as it once was after a few short @@ -1327,17 +1434,25 @@ void zeus2_renderer::render_poly_8bit(INT32 scanline, const extent_t& extent, co UINT32 *colorptr = &m_state->m_frameColor[addr]; for (x = extent.startx; x < extent.stopx; x++) { - //UINT16 *depthptr = WAVERAM_PTRDEPTH(m_state->zeus_renderbase, scanline, x); - INT32 depth = (curz >> 16) + object.zoffset; - //if (depth > 0x7fff) depth = 0x7fff; - if (depth > 0xffff) depth = 0xffff; - if (depth >= 0 && depth <= depthptr[x]) - { + bool depth_pass = true; + if (object.depth_test_enable) { + //UINT16 *depthptr = WAVERAM_PTRDEPTH(m_state->zeus_renderbase, scanline, x); + INT32 depth = (curz >> 16) + object.zoffset; + //if (depth > 0x7fff) depth = 0x7fff; + if (depth > 0xffff) depth = 0xffff; + if (depth < 0 || depth > depthptr[x]) + depth_pass = false; + else if (object.depth_write_enable) + depthptr[x] = depth; + } + if (depth_pass) { int u0 = (curu >> 8);// & (texwidth - 1); int v0 = (curv >> 8);// & 255; int u1 = (u0 + 1); int v1 = (v0 + 1); UINT8 texel0 = m_state->get_texel_8bit(texbase, v0, u0, texwidth); + if (texel0 == object.transcolor) + continue; UINT8 texel1 = m_state->get_texel_8bit(texbase, v0, u1, texwidth); UINT8 texel2 = m_state->get_texel_8bit(texbase, v1, u0, texwidth); UINT8 texel3 = m_state->get_texel_8bit(texbase, v1, u1, texwidth); @@ -1355,10 +1470,8 @@ void zeus2_renderer::render_poly_8bit(INT32 scanline, const extent_t& extent, co //WAVERAM_WRITEPIX(m_state->zeus_renderbase, scanline, x, filtered); //*depthptr = depth; colorptr[x] = filtered; - depthptr[x] = depth; } } - curz += dzdx; curu += dudx; curv += dvdx; @@ -1373,9 +1486,28 @@ void zeus2_renderer::render_poly_8bit(INT32 scanline, const extent_t& extent, co void zeus2_device::log_fifo_command(const UINT32 *data, int numwords, const char *suffix) { int wordnum; - std::string errorStr; logerror("Zeus cmd %02X :", data[0] >> 24); for (wordnum = 0; wordnum < numwords; wordnum++) logerror(" %08X", data[wordnum]); logerror("%s", suffix); } + +void zeus2_device::print_fifo_command(const UINT32 *data, int numwords, const char *suffix) +{ + int wordnum; + printf("Zeus cmd %02X :", data[0] >> 24); + for (wordnum = 0; wordnum < numwords; wordnum++) + printf(" %08X", data[wordnum]); + printf("%s", suffix); +} + +void zeus2_device::log_render_info() +{ + logerror("-- RMode = %08X", m_renderMode); + for (int i = 1; i <= 0x15; ++i) + logerror(" R%02X=%06X", i, m_renderRegs[i]); + logerror("\n-- RMode "); + for (int i = 0x63; i <= 0x6f; ++i) + logerror(" %02X=%08X", i, m_zeusbase[i]); + logerror("\n"); +} diff --git a/src/devices/video/zeus2.h b/src/devices/video/zeus2.h index 647837f401a..135d900f86c 100644 --- a/src/devices/video/zeus2.h +++ b/src/devices/video/zeus2.h @@ -43,6 +43,10 @@ struct zeus2_poly_extra_data UINT16 texwidth; UINT16 color; UINT32 alpha; + UINT32 ctrl_word; + bool blend_enable; + bool depth_test_enable; + bool depth_write_enable; }; /************************************* @@ -127,8 +131,8 @@ public: devcb_write_line m_vblank; devcb_write_line m_irq; - void set_float_mode(int mode) { m_ieee754_float = mode; } - int m_ieee754_float; // Used to switch to using IEEE754 floating point format + void set_float_mode(int mode) { m_atlantis = mode; } + int m_atlantis; // Used to switch to using IEEE754 floating point format for atlantis UINT32 m_zeusbase[0x80]; UINT32 m_renderRegs[0x40]; @@ -143,6 +147,7 @@ public: UINT32 zeus_texbase; UINT32 m_renderMode; int zeus_quad_size; + UINT32 m_renderPtr; UINT32 *waveram[2]; std::unique_ptr<UINT32[]> m_frameColor; @@ -150,7 +155,6 @@ public: emu_timer *int_timer; emu_timer *vblank_timer; - int m_yScale; int yoffs; int texel_width; float zbase; @@ -169,7 +173,8 @@ private: void zeus2_pointer_write(UINT8 which, UINT32 value, int logit); void zeus2_draw_model(UINT32 baseaddr, UINT16 count, int logit); void log_fifo_command(const UINT32 *data, int numwords, const char *suffix); - + void print_fifo_command(const UINT32 *data, int numwords, const char *suffix); + void log_render_info(); /************************************* * Member variables *************************************/ @@ -181,6 +186,8 @@ private: UINT32 m_fill_color; UINT32 m_fill_depth; + int m_yScale; + #if TRACK_REG_USAGE struct reg_info { @@ -202,38 +209,39 @@ public: *************************************/ inline float convert_float(UINT32 val) { - if (m_ieee754_float) + if (m_atlantis) { return reinterpret_cast<float&>(val); + } else return tms3203x_device::fp_to_float(val); } inline UINT32 frame_addr_from_xy(UINT32 x, UINT32 y, bool render) { - UINT32 addr = render ? frame_addr_from_expanded_addr(m_renderRegs[0x4] << 16) - : frame_addr_from_expanded_addr(m_zeusbase[0x38]); - addr += ((y * WAVERAM1_WIDTH) << (1 - m_yScale)) + x; + UINT32 addr = render ? frame_addr_from_phys_addr(m_renderRegs[0x4] << (15 + m_yScale)) + : frame_addr_from_phys_addr((m_zeusbase[0x38] >> 1) << (m_yScale << 1)); + addr += (y << (9 + m_yScale)) + x; return addr; } // Convert 0xRRRRCCCC to frame buffer addresss - inline UINT32 frame_addr_from_expanded_addr(UINT32 addr) - { - return (((addr & 0x3ff0000) >> (16 - 9 + m_yScale)) | (addr & 0x1ff)) << 1; - } + //inline UINT32 frame_addr_from_expanded_addr(UINT32 addr) + //{ + // return (((addr & 0x3ff0000) >> (16 - 9 + 1)) | (addr & 0x1ff)) << 1; + //} // Convert Physical 0xRRRRCCCC to frame buffer addresss // Based on address reg 51 (no scaling) - inline UINT32 frame_addr_from_reg51() + inline UINT32 frame_addr_from_phys_addr(UINT32 physAddr) { - UINT32 addr = (((m_zeusbase[0x51] & 0x3ff0000) >> (16 - 9)) | (m_zeusbase[0x51] & 0x1ff)) << 1; + UINT32 addr = (((physAddr & 0x3ff0000) >> (16 - 9)) | (physAddr & 0x1ff)) << 1; return addr; } // Read from frame buffer inline void frame_read() { - UINT32 addr = frame_addr_from_reg51(); + UINT32 addr = frame_addr_from_phys_addr(m_zeusbase[0x51]); m_zeusbase[0x58] = m_frameColor[addr]; m_zeusbase[0x59] = m_frameColor[addr + 1]; m_zeusbase[0x5a] = *(UINT32*)&m_frameDepth[addr]; @@ -248,7 +256,7 @@ public: // Write to frame buffer inline void frame_write() { - UINT32 addr = frame_addr_from_reg51(); + UINT32 addr = frame_addr_from_phys_addr(m_zeusbase[0x51]); if (m_zeusbase[0x57] & 0x1) m_frameColor[addr] = m_zeusbase[0x58]; if (m_zeusbase[0x5e] & 0x20) { @@ -293,6 +301,10 @@ public: /************************************* * Inlines for rendering *************************************/ + inline UINT32 conv_rgb555_to_rgb32(UINT16 color) + { + return ((color & 0x7c00) << 9) | ((color & 0x3e0) << 6) | ((color & 0x1f) << 3); + } #ifdef UNUSED_FUNCTION inline void WAVERAM_plot(int y, int x, UINT32 color) diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 361f8f14fdf..bdfd4dbf826 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -39,7 +39,7 @@ const size_t debugger_commands::MAX_GLOBALS = 1000; bool debugger_commands::cheat_address_is_valid(address_space &space, offs_t address) { - return m_cpu.translate(space, TRANSLATE_READ, &address) && (space.get_write_ptr(address) != nullptr); + return space.device().memory().translate(space.spacenum(), TRANSLATE_READ, address) && (space.get_write_ptr(address) != nullptr); } @@ -1727,7 +1727,7 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[]) if (i + j <= endoffset) { offs_t curaddr = i + j; - if (m_cpu.translate(*space, TRANSLATE_READ_DEBUG, &curaddr)) + if (space->device().memory().translate(space->spacenum(), TRANSLATE_READ_DEBUG, curaddr)) { UINT64 value = m_cpu.read_memory(*space, i + j, width, TRUE); util::stream_format(output, " %0*X", width * 2, value); @@ -1748,7 +1748,7 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[]) for (UINT64 j = 0; j < 16 && (i + j) <= endoffset; j++) { offs_t curaddr = i + j; - if (m_cpu.translate(*space, TRANSLATE_READ_DEBUG, &curaddr)) + if (space->device().memory().translate(space->spacenum(), TRANSLATE_READ_DEBUG, curaddr)) { UINT8 byte = m_cpu.read_byte(*space, i + j, TRUE); util::stream_format(output, "%c", (byte >= 32 && byte < 127) ? byte : '.'); @@ -2379,7 +2379,7 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[]) /* make sure we can translate the address */ tempaddr = pcbyte; - if (m_cpu.translate(*space, TRANSLATE_FETCH_DEBUG, &tempaddr)) + if (space->device().memory().translate(space->spacenum(), TRANSLATE_FETCH_DEBUG, tempaddr)) { UINT8 opbuf[64], argbuf[64]; @@ -2391,7 +2391,7 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[]) } /* disassemble the result */ - i += numbytes = space->device().debug()->disassemble(disasm, offset + i, opbuf, argbuf) & DASMFLAG_LENGTHMASK; + i += numbytes = dasmintf->disassemble(disasm, offset + i, opbuf, argbuf) & DASMFLAG_LENGTHMASK; } /* print the bytes */ @@ -2544,7 +2544,12 @@ void debugger_commands::execute_history(int ref, int params, const char *param[] /* loop over lines */ device_disasm_interface *dasmintf; - int maxbytes = space->device().interface(dasmintf) ? dasmintf->max_opcode_bytes() : 1; + if (!space->device().interface(dasmintf)) + { + m_console.printf("No disassembler available for %s\n", space->device().name()); + return; + } + int maxbytes = dasmintf->max_opcode_bytes(); for (int index = 0; index < (int) count; index++) { offs_t pc = debug->history_pc(-index); @@ -2559,7 +2564,7 @@ void debugger_commands::execute_history(int ref, int params, const char *param[] } char buffer[200]; - debug->disassemble(buffer, pc, opbuf, argbuf); + dasmintf->disassemble(buffer, pc, opbuf, argbuf); m_console.printf("%0*X: %s\n", space->logaddrchars(), pc, buffer); } @@ -2761,7 +2766,7 @@ void debugger_commands::execute_map(int ref, int params, const char *param[]) { static const char *const intnames[] = { "Read", "Write", "Fetch" }; taddress = space->address_to_byte(address) & space->bytemask(); - if (m_cpu.translate(*space, intention, &taddress)) + if (space->device().memory().translate(space->spacenum(), intention, taddress)) { const char *mapname = space->get_handler_string((intention == TRANSLATE_WRITE_DEBUG) ? ROW_WRITE : ROW_READ, taddress); m_console.printf( diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 94c586d8270..d28a15bd79b 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -349,24 +349,6 @@ bool debugger_cpu::comment_load(bool is_inline) /*************************************************************************** - MEMORY AND DISASSEMBLY HELPERS -***************************************************************************/ - -/*------------------------------------------------- - translate - return the physical address - corresponding to the given logical address --------------------------------------------------*/ - -bool debugger_cpu::translate(address_space &space, int intention, offs_t *address) -{ - device_memory_interface *memory; - if (space.device().interface(memory)) - return memory->translate(space.spacenum(), intention, *address); - return true; -} - - -/*************************************************************************** DEBUGGER MEMORY ACCESSORS ***************************************************************************/ @@ -377,6 +359,8 @@ bool debugger_cpu::translate(address_space &space, int intention, offs_t *addres UINT8 debugger_cpu::read_byte(address_space &space, offs_t address, int apply_translation) { + device_memory_interface &memory = space.device().memory(); + /* mask against the logical byte mask */ address &= space.logbytemask(); @@ -387,11 +371,11 @@ UINT8 debugger_cpu::read_byte(address_space &space, offs_t address, int apply_tr /* translate if necessary; if not mapped, return 0xff */ UINT64 custom; UINT8 result; - if (apply_translation && !translate(space, TRANSLATE_READ_DEBUG, &address)) + if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { result = 0xff; } - else if (space.device().memory().read(space.spacenum(), address, 1, custom)) + else if (memory.read(space.spacenum(), address, 1, custom)) { /* if there is a custom read handler, and it returns true, use that value */ result = custom; } @@ -431,6 +415,7 @@ UINT16 debugger_cpu::read_word(address_space &space, offs_t address, int apply_t } else { /* otherwise, this proceeds like the byte case */ + device_memory_interface &memory = space.device().memory(); /* all accesses from this point on are for the debugger */ m_debugger_access = true; @@ -438,11 +423,11 @@ UINT16 debugger_cpu::read_word(address_space &space, offs_t address, int apply_t /* translate if necessary; if not mapped, return 0xffff */ UINT64 custom; - if (apply_translation && !translate(space, TRANSLATE_READ_DEBUG, &address)) + if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { result = 0xffff; } - else if (space.device().memory().read(space.spacenum(), address, 2, custom)) + else if (memory.read(space.spacenum(), address, 2, custom)) { /* if there is a custom read handler, and it returns true, use that value */ result = custom; } @@ -484,17 +469,18 @@ UINT32 debugger_cpu::read_dword(address_space &space, offs_t address, int apply_ } else { /* otherwise, this proceeds like the byte case */ + device_memory_interface &memory = space.device().memory(); /* all accesses from this point on are for the debugger */ m_debugger_access = true; space.set_debugger_access(true); UINT64 custom; - if (apply_translation && !translate(space, TRANSLATE_READ_DEBUG, &address)) + if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { /* translate if necessary; if not mapped, return 0xffffffff */ result = 0xffffffff; } - else if (space.device().memory().read(space.spacenum(), address, 4, custom)) + else if (memory.read(space.spacenum(), address, 4, custom)) { /* if there is a custom read handler, and it returns true, use that value */ result = custom; } @@ -536,6 +522,7 @@ UINT64 debugger_cpu::read_qword(address_space &space, offs_t address, int apply_ } else { /* otherwise, this proceeds like the byte case */ + device_memory_interface &memory = space.device().memory(); /* all accesses from this point on are for the debugger */ m_debugger_access = true; @@ -543,11 +530,11 @@ UINT64 debugger_cpu::read_qword(address_space &space, offs_t address, int apply_ /* translate if necessary; if not mapped, return 0xffffffffffffffff */ UINT64 custom; - if (apply_translation && !translate(space, TRANSLATE_READ_DEBUG, &address)) + if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { result = ~(UINT64)0; } - else if (space.device().memory().read(space.spacenum(), address, 8, custom)) + else if (memory.read(space.spacenum(), address, 8, custom)) { /* if there is a custom read handler, and it returns true, use that value */ result = custom; } @@ -591,6 +578,8 @@ UINT64 debugger_cpu::read_memory(address_space &space, offs_t address, int size, void debugger_cpu::write_byte(address_space &space, offs_t address, UINT8 data, int apply_translation) { + device_memory_interface &memory = space.device().memory(); + /* mask against the logical byte mask */ address &= space.logbytemask(); @@ -599,11 +588,11 @@ void debugger_cpu::write_byte(address_space &space, offs_t address, UINT8 data, space.set_debugger_access(true); /* translate if necessary; if not mapped, we're done */ - if (apply_translation && !translate(space, TRANSLATE_WRITE_DEBUG, &address)) + if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address)) ; /* if there is a custom write handler, and it returns true, use that */ - else if (space.device().memory().write(space.spacenum(), address, 1, data)) + else if (memory.write(space.spacenum(), address, 1, data)) ; /* otherwise, call the byte reading function for the translated address */ @@ -646,16 +635,18 @@ void debugger_cpu::write_word(address_space &space, offs_t address, UINT16 data, /* otherwise, this proceeds like the byte case */ else { + device_memory_interface &memory = space.device().memory(); + /* all accesses from this point on are for the debugger */ m_debugger_access = true; space.set_debugger_access(true); /* translate if necessary; if not mapped, we're done */ - if (apply_translation && !translate(space, TRANSLATE_WRITE_DEBUG, &address)) + if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address)) ; /* if there is a custom write handler, and it returns true, use that */ - else if (space.device().memory().write(space.spacenum(), address, 2, data)) + else if (memory.write(space.spacenum(), address, 2, data)) ; /* otherwise, call the byte reading function for the translated address */ @@ -699,15 +690,17 @@ void debugger_cpu::write_dword(address_space &space, offs_t address, UINT32 data /* otherwise, this proceeds like the byte case */ else { + device_memory_interface &memory = space.device().memory(); + /* all accesses from this point on are for the debugger */ space.set_debugger_access(m_debugger_access = true); /* translate if necessary; if not mapped, we're done */ - if (apply_translation && !translate(space, TRANSLATE_WRITE_DEBUG, &address)) + if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address)) ; /* if there is a custom write handler, and it returns true, use that */ - else if (space.device().memory().write(space.spacenum(), address, 4, data)) + else if (memory.write(space.spacenum(), address, 4, data)) ; /* otherwise, call the byte reading function for the translated address */ @@ -751,16 +744,18 @@ void debugger_cpu::write_qword(address_space &space, offs_t address, UINT64 data /* otherwise, this proceeds like the byte case */ else { + device_memory_interface &memory = space.device().memory(); + /* all accesses from this point on are for the debugger */ m_debugger_access = true; space.set_debugger_access(true); /* translate if necessary; if not mapped, we're done */ - if (apply_translation && !translate(space, TRANSLATE_WRITE_DEBUG, &address)) + if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address)) ; /* if there is a custom write handler, and it returns true, use that */ - else if (space.device().memory().write(space.spacenum(), address, 8, data)) + else if (memory.write(space.spacenum(), address, 8, data)) ; /* otherwise, call the byte reading function for the translated address */ @@ -800,6 +795,8 @@ void debugger_cpu::write_memory(address_space &space, offs_t address, UINT64 dat UINT64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size) { + device_memory_interface &memory = space.device().memory(); + UINT64 result = ~(UINT64)0 & (~(UINT64)0 >> (64 - 8*size)), result2; /* keep in logical range */ @@ -808,8 +805,7 @@ UINT64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size) /* return early if we got the result directly */ m_debugger_access = true; space.set_debugger_access(true); - device_memory_interface *memory; - if (space.device().interface(memory) && memory->readop(address, size, result2)) + if (memory.readop(address, size, result2)) { m_debugger_access = false; space.set_debugger_access(false); @@ -830,7 +826,7 @@ UINT64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size) } /* translate to physical first */ - if (!translate(space, TRANSLATE_FETCH_DEBUG, &address)) + if (!memory.translate(space.spacenum(), TRANSLATE_FETCH_DEBUG, address)) return result; /* keep in physical range */ @@ -1977,36 +1973,6 @@ void device_debug::set_instruction_hook(debug_instruction_hook_func hook) //------------------------------------------------- -// disassemble - disassemble a line at a given -// PC on a given device -//------------------------------------------------- - -offs_t device_debug::disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) const -{ - if (m_disasm == nullptr) - return 0; - - // if we have a disassembler, run it - offs_t result = m_disasm->disassemble(buffer, pc, oprom, opram, 0); - - // make sure we get good results - assert((result & DASMFLAG_LENGTHMASK) != 0); -#ifdef MAME_DEBUG - if (m_memory != nullptr) - { - address_space &space = m_memory->space(AS_PROGRAM); - int bytes = space.address_to_byte(result & DASMFLAG_LENGTHMASK); - assert(bytes >= m_disasm->min_opcode_bytes()); - assert(bytes <= m_disasm->max_opcode_bytes()); - (void) bytes; // appease compiler - } -#endif - - return result; -} - - -//------------------------------------------------- // ignore - ignore/observe a given device //------------------------------------------------- @@ -2653,10 +2619,14 @@ UINT32 device_debug::compute_opcode_crc32(offs_t pc) const argbuf[numbytes] = m_device.machine().debugger().cpu().read_opcode(space, pcbyte + numbytes, 1); } - // disassemble to our buffer - char diasmbuf[200]; - memset(diasmbuf, 0x00, 200); - UINT32 numbytes = disassemble(diasmbuf, pc, opbuf, argbuf) & DASMFLAG_LENGTHMASK; + UINT32 numbytes = maxbytes; + if (m_disasm != nullptr) + { + // disassemble to our buffer + char diasmbuf[200]; + memset(diasmbuf, 0x00, 200); + numbytes = m_disasm->disassemble(diasmbuf, pc, opbuf, argbuf) & DASMFLAG_LENGTHMASK; + } // return a CRC of the exact count of opcode bytes return core_crc32(0, opbuf, numbytes); @@ -3054,7 +3024,7 @@ UINT32 device_debug::dasm_wrapped(std::string &buffer, offs_t pc) // disassemble to our buffer char diasmbuf[200]; memset(diasmbuf, 0x00, 200); - UINT32 result = disassemble(diasmbuf, pc, opbuf, argbuf); + UINT32 result = m_disasm->disassemble(diasmbuf, pc, opbuf, argbuf); buffer.assign(diasmbuf); return result; } diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index 9915760b146..bc4ee3675cf 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -185,9 +185,6 @@ public: // hooks into our operations void set_instruction_hook(debug_instruction_hook_func hook); - // disassembly - offs_t disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) const; - // debugger focus void ignore(bool ignore = true); bool observing() const { return ((m_flags & DEBUG_FLAG_OBSERVING) != 0); } @@ -511,9 +508,6 @@ public: /* ----- debugger memory accessors ----- */ - /* return the physical address corresponding to the given logical address */ - bool translate(address_space &space, int intention, offs_t *address); - /* return a byte from the specified memory space */ UINT8 read_byte(address_space &space, offs_t address, int apply_translation); diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp index a2aad9162cf..e49010e2ef6 100644 --- a/src/emu/debug/dvdisasm.cpp +++ b/src/emu/debug/dvdisasm.cpp @@ -269,10 +269,10 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs) // get the disassembly, but only if mapped instlen = 1; - if (machine().debugger().cpu().translate(source.m_space, TRANSLATE_FETCH, &physpcbyte)) + if (source.m_space.device().memory().translate(source.m_space.spacenum(), TRANSLATE_FETCH, physpcbyte)) { char dasmbuffer[100]; - instlen = source.device()->debug()->disassemble(dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK; + instlen = source.m_disasmintf->disassemble(dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK; } // count this one @@ -395,7 +395,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) char buffer[100]; int numbytes = 0; offs_t physpcbyte = pcbyte; - if (machine().debugger().cpu().translate(source.m_space, TRANSLATE_FETCH_DEBUG, &physpcbyte)) + if (source.m_space.device().memory().translate(source.m_space.spacenum(), TRANSLATE_FETCH_DEBUG, physpcbyte)) { UINT8 opbuf[64], argbuf[64]; @@ -407,7 +407,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) } // disassemble the result - pc += numbytes = source.device()->debug()->disassemble(buffer, pc & source.m_space.logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK; + pc += numbytes = source.m_disasmintf->disassemble(buffer, pc & source.m_space.logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK; } else strcpy(buffer, "<unmapped>"); diff --git a/src/emu/didisasm.cpp b/src/emu/didisasm.cpp index 875b2bfef5e..9c10087d6c2 100644 --- a/src/emu/didisasm.cpp +++ b/src/emu/didisasm.cpp @@ -74,5 +74,19 @@ offs_t device_disasm_interface::disassemble(char *buffer, offs_t pc, const UINT8 if (result == 0) result = disasm_disassemble(buffer, pc, oprom, opram, options); + // make sure we get good results + assert((result & DASMFLAG_LENGTHMASK) != 0); +#ifdef MAME_DEBUG + device_memory_interface *memory; + if (device().interface(memory)) + { + address_space &space = memory->space(AS_PROGRAM); + int bytes = space.address_to_byte(result & DASMFLAG_LENGTHMASK); + assert(bytes >= min_opcode_bytes()); + assert(bytes <= max_opcode_bytes()); + (void) bytes; // appease compiler + } +#endif + return result; } diff --git a/src/frontend/mame/ui/dirmenu.cpp b/src/frontend/mame/ui/dirmenu.cpp index 94c45da03b6..ec9e2753de7 100644 --- a/src/frontend/mame/ui/dirmenu.cpp +++ b/src/frontend/mame/ui/dirmenu.cpp @@ -196,7 +196,7 @@ void menu_display_actual::populate() while (path.next(curpath, nullptr)) m_folders.push_back(curpath); - item_append((s_folders[m_ref].action == CHANGE) ? _("Change Folder") : _("Add Folder"), nullptr, 0, (void *)ADD_CHANGE); + item_append((s_folders[m_ref].action == CHANGE) ? _("Change Folder") : _("Add Folder"), "", 0, (void *)ADD_CHANGE); if (m_folders.size() > 1) item_append(_("Remove Folder"), "", 0, (void *)REMOVE); diff --git a/src/frontend/mame/ui/moptions.cpp b/src/frontend/mame/ui/moptions.cpp index 3c8d37fec12..6a95a737301 100644 --- a/src/frontend/mame/ui/moptions.cpp +++ b/src/frontend/mame/ui/moptions.cpp @@ -54,6 +54,7 @@ const options_entry ui_options::s_option_entries[] = { OPTION_LAST_USED_FILTER, "", OPTION_STRING, "latest used filter" }, { OPTION_LAST_USED_MACHINE, "", OPTION_STRING, "latest used machine" }, { OPTION_INFO_AUTO_AUDIT, "0", OPTION_BOOLEAN, "enable auto audit in the general info panel" }, + { OPTION_HIDE_ROMLESS, "1", OPTION_BOOLEAN, "hide romless machine from available list" }, // UI options { nullptr, nullptr, OPTION_HEADER, "UI OPTIONS" }, diff --git a/src/frontend/mame/ui/moptions.h b/src/frontend/mame/ui/moptions.h index 55d800651f4..766f15c38c5 100644 --- a/src/frontend/mame/ui/moptions.h +++ b/src/frontend/mame/ui/moptions.h @@ -48,6 +48,8 @@ #define OPTION_LAST_USED_FILTER "last_used_filter" #define OPTION_LAST_USED_MACHINE "last_used_machine" #define OPTION_INFO_AUTO_AUDIT "info_audit_enabled" +#define OPTION_HIDE_ROMLESS "hide_romless" + // core UI options #define OPTION_INFOS_SIZE "infos_text_size" @@ -110,6 +112,7 @@ public: const char *last_used_machine() const { return value(OPTION_LAST_USED_MACHINE); } const char *last_used_filter() const { return value(OPTION_LAST_USED_FILTER); } bool info_audit() const { return bool_value(OPTION_INFO_AUTO_AUDIT); } + bool hide_romless() const { return bool_value(OPTION_HIDE_ROMLESS); } // UI options float infos_size() const { return float_value(OPTION_INFOS_SIZE); } diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp index 556867ffa5e..979902732a6 100644 --- a/src/frontend/mame/ui/selgame.cpp +++ b/src/frontend/mame/ui/selgame.cpp @@ -660,75 +660,77 @@ void menu_select_game::build_available_list() } // now check and include NONE_NEEDED - for (int x = 0; x < m_total; ++x) + if (!ui().options().hide_romless()) { - auto driver = &driver_list::driver(x); - if (!m_included[x] && driver != &GAME_NAME(___empty)) + for (int x = 0; x < m_total; ++x) { - const rom_entry *rom = driver->rom; - auto noroms = true; + auto driver = &driver_list::driver(x); + if (!m_included[x] && driver != &GAME_NAME(___empty)) + { + const rom_entry *rom = driver->rom; + bool noroms = true; - // check NO-DUMP - for (; !ROMENTRY_ISEND(rom) && noroms == true; ++rom) - if (ROMENTRY_ISFILE(rom)) - { - hash_collection hashes(ROM_GETHASHDATA(rom)); - if (!hashes.flag(hash_collection::FLAG_NO_DUMP) && !ROM_ISOPTIONAL(rom)) - noroms = false; - } + // check NO-DUMP + for (; !ROMENTRY_ISEND(rom) && noroms == true; ++rom) + if (ROMENTRY_ISFILE(rom)) + { + hash_collection hashes(ROM_GETHASHDATA(rom)); + if (!hashes.flag(hash_collection::FLAG_NO_DUMP) && !ROM_ISOPTIONAL(rom)) + noroms = false; + } - if (!noroms) - { - // check if clone == parent - int cx = driver_list::clone(*driver); - if (cx != -1 && m_included[cx]) + if (!noroms) { - auto drv = &driver_list::driver(cx); - auto parentrom = drv->rom; - if ((rom = driver->rom) == parentrom) - noroms = true; - - // check if clone < parent - if (!noroms) + // check if clone == parent + auto cx = driver_list::clone(*driver); + if (cx != -1 && m_included[cx]) { - noroms = true; - for (; !ROMENTRY_ISEND(rom) && noroms == true; ++rom) + auto drv = &driver_list::driver(cx); + auto parentrom = drv->rom; + if ((rom = driver->rom) == parentrom) + noroms = true; + + // check if clone < parent + if (!noroms) { - if (ROMENTRY_ISFILE(rom)) + noroms = true; + for (; !ROMENTRY_ISEND(rom) && noroms == true; ++rom) { - hash_collection hashes(ROM_GETHASHDATA(rom)); - if (hashes.flag(hash_collection::FLAG_NO_DUMP) || ROM_ISOPTIONAL(rom)) - continue; - - UINT64 lenght = ROM_GETLENGTH(rom); - auto found = false; - for (parentrom = drv->rom; !ROMENTRY_ISEND(parentrom) && found == false; ++parentrom) + if (ROMENTRY_ISFILE(rom)) { - if (ROMENTRY_ISFILE(parentrom) && ROM_GETLENGTH(parentrom) == lenght) - { - hash_collection parenthashes(ROM_GETHASHDATA(parentrom)); - if (parenthashes.flag(hash_collection::FLAG_NO_DUMP) || ROM_ISOPTIONAL(parentrom)) - continue; + hash_collection hashes(ROM_GETHASHDATA(rom)); + if (hashes.flag(hash_collection::FLAG_NO_DUMP) || ROM_ISOPTIONAL(rom)) + continue; - if (hashes == parenthashes) - found = true; + UINT64 lenght = ROM_GETLENGTH(rom); + auto found = false; + for (parentrom = drv->rom; !ROMENTRY_ISEND(parentrom) && found == false; ++parentrom) + { + if (ROMENTRY_ISFILE(parentrom) && ROM_GETLENGTH(parentrom) == lenght) + { + hash_collection parenthashes(ROM_GETHASHDATA(parentrom)); + if (parenthashes.flag(hash_collection::FLAG_NO_DUMP) || ROM_ISOPTIONAL(parentrom)) + continue; + + if (hashes == parenthashes) + found = true; + } } + noroms = found; } - noroms = found; } } } } - } - if (noroms) - { - m_availsortedlist.push_back(&driver_list::driver(x)); - m_included[x] = true; + if (noroms) + { + m_availsortedlist.push_back(&driver_list::driver(x)); + m_included[x] = true; + } } } } - // sort std::stable_sort(m_availsortedlist.begin(), m_availsortedlist.end(), sorted_game_list); diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp index 75c62177a33..cdecec0ca80 100644 --- a/src/frontend/mame/ui/submenu.cpp +++ b/src/frontend/mame/ui/submenu.cpp @@ -31,6 +31,7 @@ std::vector<submenu::option> submenu::misc_options = { { submenu::option_type::UI, __("Skip bios selection menu"), OPTION_SKIP_BIOS_MENU }, { submenu::option_type::UI, __("Skip software parts selection menu"), OPTION_SKIP_PARTS_MENU }, { submenu::option_type::UI, __("Info auto audit"), OPTION_INFO_AUTO_AUDIT }, + { submenu::option_type::UI, __("Hide romless machine from available list"),OPTION_HIDE_ROMLESS }, }; std::vector<submenu::option> submenu::advanced_options = { diff --git a/src/mame/drivers/atlantis.cpp b/src/mame/drivers/atlantis.cpp index 60173f3ce22..c42666c1945 100644 --- a/src/mame/drivers/atlantis.cpp +++ b/src/mame/drivers/atlantis.cpp @@ -555,8 +555,9 @@ WRITE32_MEMBER(atlantis_state::port_ctrl_w) UINT32 newOffset = offset >> 17; COMBINE_DATA(&m_port_ctrl_reg[newOffset]); - //switch (newOffset) { - if (newOffset == 1) { + switch (newOffset) { + case 1: + { UINT32 bits = ioport("KEYPAD")->read(); m_port_ctrl_reg[2] = 0; if (!(data & 0x8)) @@ -569,10 +570,18 @@ WRITE32_MEMBER(atlantis_state::port_ctrl_w) m_port_ctrl_reg[2] = (bits >> 12) & 7; // Row 3 if (LOG_PORT) logerror("%s: port_ctrl_w Keypad Row Sel = %04X bits = %08X\n", machine().describe_context(), data, bits); + break; } - else { + case 3: + if (data==0x8f) + m_port_ctrl_reg[4] = ioport("AN.1")->read(); + else + m_port_ctrl_reg[4] = ioport("AN.0")->read(); + break; + default: if (LOG_PORT) logerror("%s: port_ctrl_w write to offset %04X = %08X & %08X bus offset = %08X\n", machine().describe_context(), newOffset, data, mem_mask, offset); + break; } } @@ -657,13 +666,13 @@ static ADDRESS_MAP_START( map1, AS_PROGRAM, 32, atlantis_state ) AM_RANGE(0x00200000, 0x00200003) AM_WRITE(dcs3_fifo_full_w) AM_RANGE(0x00400000, 0x00400003) AM_DEVWRITE("dcs", dcs_audio_device, dsio_idma_addr_w) AM_RANGE(0x00600000, 0x00600003) AM_DEVREADWRITE("dcs", dcs_audio_device, dsio_idma_data_r, dsio_idma_data_w) - AM_RANGE(0x00800000, 0x00900003) AM_READWRITE(port_ctrl_r, port_ctrl_w) + AM_RANGE(0x00800000, 0x00a00003) AM_READWRITE(port_ctrl_r, port_ctrl_w) //AM_RANGE(0x00800000, 0x00800003) // Written once = 0000fff8 //AM_RANGE(0x00880000, 0x00880003) // Initial write 0000fff0, follow by sequence ffef, ffdf, ffbf, fff7. Row Select? //AM_RANGE(0x00900000, 0x00900003) // Read once before each sequence write to 0x00880000. Code checks bits 0,1,2. Keypad? //AM_RANGE(0x00980000, 0x00980003) // Read / Write. Bytes written 0x8f, 0xcf. Code if read 0x1 then read 00a00000. POTs? //AM_RANGE(0x00a00000, 0x00a00003) - AM_RANGE(0x00980000, 0x00980003) AM_NOP // AM_WRITE(asic_fifo_w) + //AM_RANGE(0x00980000, 0x00980003) AM_NOP // AM_WRITE(asic_fifo_w) ADDRESS_MAP_END static ADDRESS_MAP_START(map2, AS_PROGRAM, 32, atlantis_state) @@ -769,6 +778,12 @@ static INPUT_PORTS_START( mwskins ) //PORT_BIT(0x0007, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, atlantis_state, port_mod_r, "KEYPAD") PORT_BIT(0xffff, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_START("AN.0") + PORT_BIT(0x1ff, 0x100, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) + + PORT_START("AN.1") + PORT_BIT(0x1ff, 0x100, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) + PORT_START("KEYPAD") PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) /* keypad 1 */ PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_SPECIAL) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) /* keypad 2 */ diff --git a/src/mame/drivers/chihiro.cpp b/src/mame/drivers/chihiro.cpp index b4af01645a2..d23a545de6f 100644 --- a/src/mame/drivers/chihiro.cpp +++ b/src/mame/drivers/chihiro.cpp @@ -377,7 +377,6 @@ Thanks to Alex, Mr Mudkips, and Philip Burke for this info. #include "video/poly.h" #include "debug/debugcon.h" #include "debug/debugcmd.h" -#include "debug/debugcpu.h" #include "debugger.h" #include "includes/chihiro.h" #include "includes/xbox.h" @@ -506,7 +505,7 @@ St. Instr. Comment void chihiro_state::jamtable_disasm(address_space &space, UINT32 address, UINT32 size) // 0xff000080 == fff00080 { offs_t addr = (offs_t)address; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &addr)) + if (!space.device().memory().translate(space.spacenum(), TRANSLATE_READ_DEBUG, addr)) { machine().debugger().console().printf("Address is unmapped.\n"); return; diff --git a/src/mame/drivers/dynax.cpp b/src/mame/drivers/dynax.cpp index e09b4e22c24..5780f72416f 100644 --- a/src/mame/drivers/dynax.cpp +++ b/src/mame/drivers/dynax.cpp @@ -2612,32 +2612,33 @@ INPUT_PORTS_END static INPUT_PORTS_START( mjdialq2 ) PORT_START("DSW0") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2") PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x04, 0x00, "PINFU with TSUMO" ) PORT_DIPLOCATION("SW1:3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) + PORT_DIPNAME( 0x38, 0x20, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,5,6") + PORT_DIPSETTING( 0x38, "1 (Easy)" ) + PORT_DIPSETTING( 0x30, "2" ) + PORT_DIPSETTING( 0x28, "3" ) + PORT_DIPSETTING( 0x20, "4" ) + PORT_DIPSETTING( 0x18, "5" ) + PORT_DIPSETTING( 0x10, "6" ) + PORT_DIPSETTING( 0x08, "7" ) + PORT_DIPSETTING( 0x00, "8 (Hard)" ) + + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSW1") - PORT_DIPNAME( 0x07, 0x07, "Time Setting" ) + PORT_DIPNAME( 0x07, 0x07, "Time Setting" ) PORT_DIPLOCATION("SW2:1,2,3") PORT_DIPSETTING( 0x07, "08:30" ) PORT_DIPSETTING( 0x06, "09:00" ) PORT_DIPSETTING( 0x05, "09:30" ) @@ -2646,19 +2647,19 @@ static INPUT_PORTS_START( mjdialq2 ) PORT_DIPSETTING( 0x02, "11:00" ) PORT_DIPSETTING( 0x01, "11:30" ) PORT_DIPSETTING( 0x00, "12:00" ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x08, 0x00, "Time Service" ) PORT_DIPLOCATION("SW2:4") // "secret moves" happen at certain time stamps PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "Select Special Item" ) /* Allows to select which one of the nine special items you want. */ + PORT_DIPNAME( 0x10, 0x10, "TEL Display" ) PORT_DIPLOCATION("SW2:5") + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPNAME( 0x20, 0x20, "GAL mode" ) PORT_DIPLOCATION("SW2:6") // unknown what this does + PORT_DIPSETTING( 0x20, "1" ) + PORT_DIPSETTING( 0x00, "2" ) + PORT_DIPNAME( 0x40, 0x40, "Select Special Item" ) PORT_DIPLOCATION("SW2:7")/* Allows to select which one of the nine special items you want. */ PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Debug" ) + PORT_DIPNAME( 0x80, 0x80, "Debug" ) PORT_DIPLOCATION("SW2:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) diff --git a/src/mame/drivers/homedata.cpp b/src/mame/drivers/homedata.cpp index 716a5b0f0aa..f5d2a6181b1 100644 --- a/src/mame/drivers/homedata.cpp +++ b/src/mame/drivers/homedata.cpp @@ -169,6 +169,8 @@ Sound: SN76489AN DAC OSC: 9.000MHz 16.000MHz Custom: GX61A01 +Note: Manual dips are completely wrong, this actually matches pteacher + ---------------------------------------------------------------------------- Mahjong-yougo no Kisotairyoku (c)1989 Home Data @@ -637,21 +639,19 @@ ADDRESS_MAP_END static INPUT_PORTS_START( mjhokite ) PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) + PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:8") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coinage ) ) + PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW1:7" ) + PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:6,5") PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x10, 0x10, "Initial Score" ) + PORT_DIPNAME( 0x10, 0x10, "Initial Score" ) PORT_DIPLOCATION("SW1:4") PORT_DIPSETTING( 0x10, "1000" ) PORT_DIPSETTING( 0x00, "2000" ) - PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Difficulty ) ) + PORT_DIPNAME( 0xe0, 0x80, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,2,1") PORT_DIPSETTING( 0xe0, "1 (easiest)" ) PORT_DIPSETTING( 0xc0, "2" ) PORT_DIPSETTING( 0xa0, "3" ) @@ -662,30 +662,18 @@ static INPUT_PORTS_START( mjhokite ) PORT_DIPSETTING( 0x00, "8 (hardest)" ) PORT_START("DSW2") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x00, "Girl Voice" ) + PORT_DIPNAME( 0x02, 0x00, "Girl Voice" ) PORT_DIPLOCATION("SW2:7") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW2:6" ) + PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW2:5" ) + PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW2:4" ) + PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW2:3" ) + PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW2:2" ) + PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:1" ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -925,40 +913,30 @@ INPUT_PORTS_END static INPUT_PORTS_START( pteacher ) PORT_START("DSW") /* dip switches (handled by pteacher_keyboard_r) */ - PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) ) + PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1") PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x0002, 0x0000, "In-Game BGM") PORT_DIPLOCATION("SW1:2") PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_SERVICE( 0x0100, IP_ACTIVE_LOW ) - PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,4") + PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0004, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x000c, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x0008, DEF_STR( 1C_2C ) ) + PORT_DIPNAME( 0x0010, 0x0010, "Female Voices" ) PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( On ) ) + PORT_DIPUNKNOWN_DIPLOC( 0x0020, 0x0020, "SW1:6" ) + PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0040, "SW1:7" ) + PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + + PORT_SERVICE_DIPLOC(0x0100, IP_ACTIVE_LOW, "SW2:1" ) + PORT_DIPUNKNOWN_DIPLOC( 0x0200, 0x0200, "SW2:2" ) + PORT_DIPUNKNOWN_DIPLOC( 0x0400, 0x0400, "SW2:3" ) + PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "SW2:4" ) PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("COIN") @@ -972,67 +950,23 @@ INPUT_PORTS_END static INPUT_PORTS_START( mjjoship ) PORT_INCLUDE( pteacher ) + // Manual wrong for this game - it's an incomplete version of the + // pteacher set, with no service mode and start score instead of + // girl voices. Coins stated in manual in same place but do nothing + PORT_MODIFY("DSW") // SW1 - PORT_DIPNAME( 0x0001, 0x0000, "Attract Sound" ) PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPUNKNOWN_DIPLOC( 0x0002, 0x0002, "SW1:2" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0004, 0x0004, "SW1:3" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0008, 0x0008, "SW1:4" ) - PORT_DIPNAME( 0x0010, 0x0010, "Player Start Score" ) PORT_DIPLOCATION("SW1:5") - PORT_DIPSETTING( 0x0010, "1000" ) - PORT_DIPSETTING( 0x0000, "2000" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0020, 0x0020, "SW1:6" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0040, "SW1:7" ) - PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8") - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPUNUSED_DIPLOC( 0x0002, 0x0002, "SW1:2" ) + PORT_DIPUNUSED_DIPLOC( 0x0004, 0x0004, "SW1:3" ) + PORT_DIPUNUSED_DIPLOC( 0x0008, 0x0008, "SW1:4" ) + PORT_DIPNAME( 0x0010, 0x0010, "Player Start Score" ) PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x0010, "1000" ) + PORT_DIPSETTING( 0x0000, "2000" ) // SW2 - PORT_DIPUNKNOWN_DIPLOC( 0x0100, 0x0100, "SW2:1" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0200, 0x0200, "SW2:2" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0400, 0x0400, "SW2:3" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "SW2:4" ) - PORT_DIPUNKNOWN_DIPLOC( 0x1000, 0x1000, "SW2:5" ) - PORT_DIPUNKNOWN_DIPLOC( 0x2000, 0x2000, "SW2:6" ) - PORT_DIPUNKNOWN_DIPLOC( 0x4000, 0x4000, "SW2:7" ) - PORT_DIPUNKNOWN_DIPLOC( 0x8000, 0x8000, "SW2:8" ) - -INPUT_PORTS_END - -static INPUT_PORTS_START( lemnangl ) - PORT_INCLUDE( pteacher ) - - PORT_MODIFY("DSW") - PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1") - PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0000, "In-Game BGM" ) PORT_DIPLOCATION("SW1:2") - PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,4") - PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x0004, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x000c, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x0008, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x0010, 0x0010, "Female Voices" ) PORT_DIPLOCATION("SW1:5") - PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0010, DEF_STR( On ) ) - PORT_DIPUNKNOWN_DIPLOC( 0x0020, 0x0020, "SW1:6" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0040, "SW1:7" ) - PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8") - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPUNUSED_DIPLOC( 0x0100, 0x0100, "SW2:1" ) + PORT_DIPUNUSED_DIPLOC( 0x0200, 0x0200, "SW2:2" ) - PORT_SERVICE_DIPLOC(0x0100, IP_ACTIVE_LOW, "SW2:1" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0200, 0x0200, "SW2:2" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0400, 0x0400, "SW2:3" ) - PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "SW2:4" ) - PORT_DIPUNKNOWN_DIPLOC( 0x1000, 0x1000, "SW2:5" ) - PORT_DIPUNKNOWN_DIPLOC( 0x2000, 0x2000, "SW2:6" ) - PORT_DIPUNKNOWN_DIPLOC( 0x4000, 0x4000, "SW2:7" ) - PORT_DIPUNKNOWN_DIPLOC( 0x8000, 0x8000, "SW2:8" ) INPUT_PORTS_END static INPUT_PORTS_START( jogakuen ) @@ -2124,7 +2058,7 @@ GAME( 1989, mjyougo, 0, pteacher, pteacher, driver_device, 0, ROT0, " GAME( 1991, mjkinjas, 0, mjkinjas, pteacher, driver_device, 0, ROT0, "Home Data", "Mahjong Kinjirareta Asobi (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1992?,jogakuen, 0, pteacher, jogakuen, homedata_state, jogakuen, ROT0, "Windom", "Mahjong Jogakuen (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, lemnangl, 0, lemnangl, lemnangl, driver_device, 0, ROT0, "Home Data", "Mahjong Lemon Angel (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, lemnangl, 0, lemnangl, pteacher, driver_device, 0, ROT0, "Home Data", "Mahjong Lemon Angel (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1991, mjprivat, 0, lemnangl, pteacher, driver_device, 0, ROT0, "Matoba", "Mahjong Private (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1991?,mjikaga, 0, lemnangl, mjikaga, homedata_state, mjikaga, ROT0, "Mitchell", "Mahjong Ikaga Desu ka (Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/konamigx.cpp b/src/mame/drivers/konamigx.cpp index 5138f3a9f62..f877f6a99c5 100644 --- a/src/mame/drivers/konamigx.cpp +++ b/src/mame/drivers/konamigx.cpp @@ -1473,7 +1473,10 @@ static INPUT_PORTS_START( type3 ) PORT_INCLUDE( common ) PORT_MODIFY("SYSTEM_DSW") - PORT_BIT( 0x00008000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_COIN3 ) + PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_COIN4 ) + PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_SERVICE3 ) + PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_SERVICE4 ) PORT_DIPNAME( 0x01000000, 0x00000000, DEF_STR( Stereo )) PORT_DIPSETTING( 0x00000000, DEF_STR( Stereo )) PORT_DIPSETTING( 0x01000000, DEF_STR( Mono )) diff --git a/src/mame/drivers/midzeus.cpp b/src/mame/drivers/midzeus.cpp index 5544c1f693e..4a9fb4eaa7a 100644 --- a/src/mame/drivers/midzeus.cpp +++ b/src/mame/drivers/midzeus.cpp @@ -357,6 +357,12 @@ READ32_MEMBER(midzeus_state::linkram_r) return 0x30313042; else if (offset == 0x3c) return 0xffffffff; + else if (offset == 0x30) + // ??? + return 0xffffffff; + else if (offset == 0xc) + // ??? + return 0xffffffff; return m_linkram[offset]; } diff --git a/src/mame/drivers/nbmj8891.cpp b/src/mame/drivers/nbmj8891.cpp index c38200bf48a..a1c6e2b9e4d 100644 --- a/src/mame/drivers/nbmj8891.cpp +++ b/src/mame/drivers/nbmj8891.cpp @@ -1939,55 +1939,32 @@ INPUT_PORTS_END static INPUT_PORTS_START( mladyhtr ) PORT_START("DSWA") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2") PORT_DIPSETTING( 0x03, "1" ) PORT_DIPSETTING( 0x02, "2" ) PORT_DIPSETTING( 0x01, "3" ) PORT_DIPSETTING( 0x00, "4" ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:3") PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Flip_Screen ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:5") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "Game Sounds" ) + PORT_DIPNAME( 0x20, 0x20, "Game Sounds" ) PORT_DIPLOCATION("SWA:6") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "Game Mode" ) + PORT_DIPNAME( 0x40, 0x40, "Game Mode" ) PORT_DIPLOCATION("SWA:7") PORT_DIPSETTING( 0x40, "Beginner" ) PORT_DIPSETTING( 0x00, "Expert" ) - PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) + PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) PORT_DIPLOCATION("SWA:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSWB") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, nbmj8891_state, nb1413m3_busyflag_r, nullptr) // DRAW BUSY diff --git a/src/mame/drivers/nbmj8991.cpp b/src/mame/drivers/nbmj8991.cpp index cff29c44ec6..24a49727239 100644 --- a/src/mame/drivers/nbmj8991.cpp +++ b/src/mame/drivers/nbmj8991.cpp @@ -300,55 +300,32 @@ INPUT_PORTS_END static INPUT_PORTS_START( triplew1 ) PORT_START("DSWA") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2") PORT_DIPSETTING( 0x03, "1 (Easy)" ) PORT_DIPSETTING( 0x02, "2" ) PORT_DIPSETTING( 0x01, "3" ) PORT_DIPSETTING( 0x00, "4 (Hard)" ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:3") PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:4") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Game Sounds" ) + PORT_DIPNAME( 0x10, 0x10, "Game Sounds" ) PORT_DIPLOCATION("SWA:5") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "Character Display Test" ) + PORT_DIPNAME( 0x40, 0x40, "Character Display Test" ) PORT_DIPLOCATION("SWA:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) + PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) PORT_DIPLOCATION("SWA:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSWB") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, nbmj8991_state, nb1413m3_busyflag_r, nullptr) // DRAW BUSY @@ -692,7 +669,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( galkoku ) PORT_START("DSWA") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWA:1,2,3") PORT_DIPSETTING( 0x07, "1 (Easy)" ) PORT_DIPSETTING( 0x06, "2" ) PORT_DIPSETTING( 0x05, "3" ) @@ -701,47 +678,25 @@ static INPUT_PORTS_START( galkoku ) PORT_DIPSETTING( 0x02, "6" ) PORT_DIPSETTING( 0x01, "7" ) PORT_DIPSETTING( 0x00, "8 (Hard)" ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Coinage ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SWA:4") PORT_DIPSETTING( 0x08, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x10, 0x10, "Character Display Test" ) + PORT_DIPNAME( 0x10, 0x10, "Character Display Test" ) PORT_DIPLOCATION("SWA:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SWA:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SWA:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + // not even physically present on PCBs PORT_START("DSWB") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, nbmj8991_state, nb1413m3_busyflag_r, nullptr) // DRAW BUSY diff --git a/src/mame/drivers/nbmj9195.cpp b/src/mame/drivers/nbmj9195.cpp index b37bd410dfc..06eddd16b8c 100644 --- a/src/mame/drivers/nbmj9195.cpp +++ b/src/mame/drivers/nbmj9195.cpp @@ -814,57 +814,56 @@ INPUT_PORTS_END static INPUT_PORTS_START( patimono ) - // I don't have manual for this game. + // Interesting note - manual states switch A:8 is always off/unused PORT_START("DSWA") - PORT_DIPNAME( 0x01, 0x01, "DIPSW 1-1" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, "DIPSW 1-2" ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSWA:1,2") + PORT_DIPSETTING( 0x03, "1" ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x01, "3" ) + PORT_DIPSETTING( 0x00, "4" ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSWA:3") PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSWA:4") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Music" ) + PORT_DIPNAME( 0x10, 0x10, "Music" ) PORT_DIPLOCATION("DSWA:5") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Flip_Screen ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("DSWA:6") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "Character Display Test" ) + PORT_DIPNAME( 0x40, 0x40, "Character Display Test" ) PORT_DIPLOCATION("DSWA:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) + PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) PORT_DIPLOCATION("DSWA:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSWB") - PORT_DIPNAME( 0x01, 0x01, "DIPSW 2-1" ) + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, "DIPSW 2-2" ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:2") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, "DIPSW 2-3" ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, "DIPSW 2-4" ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "DIPSW 2-5" ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "DIPSW 2-6" ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "DIPSW 2-7" ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "DIPSW 2-8" ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("DSWB:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -1360,71 +1359,6 @@ static INPUT_PORTS_START( mjlaman ) PORT_INCLUDE( nbmjcontrols ) INPUT_PORTS_END -static INPUT_PORTS_START( mkeibaou ) - PORT_START("DSWA") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) - PORT_DIPSETTING( 0x03, "1" ) - PORT_DIPSETTING( 0x02, "2" ) - PORT_DIPSETTING( 0x01, "3" ) - PORT_DIPSETTING( 0x00, "4" ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) - PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Game Sounds" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x10, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Flip_Screen ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "Character Display Test" ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Graphic ROM Test" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("DSWB") - PORT_DIPNAME( 0x01, 0x01, "DIPSW 2-1" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, "DIPSW 2-2" ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, "DIPSW 2-3" ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, "DIPSW 2-4" ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "DIPSW 2-5" ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "DIPSW 2-6" ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "DIPSW 2-7" ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "DIPSW 2-8" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START("SYSTEM") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // COIN OUT - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE3 ) // MEMORY RESET - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 ) // ANALYZER - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Credit Clear") PORT_CODE(KEYCODE_4) // CREDIT CLEAR - PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) // TEST - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) // COIN1 - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) // COIN2 - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) // SERVICE - - PORT_INCLUDE( nbmjcontrols ) -INPUT_PORTS_END - static INPUT_PORTS_START( pachiten ) PORT_START("DSWA") PORT_DIPNAME( 0x07, 0x07, "Game Out" ) @@ -3598,7 +3532,7 @@ GAME( 1993, ultramhm, 0, ultramhm, ultramhm, nbmj9195_state, nbmj9195, RO GAME( 1993, gal10ren, 0, gal10ren, gal10ren, nbmj9195_state, nbmj9195, ROT0, "Fujic", "Mahjong Gal 10-renpatsu (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, renaiclb, 0, renaiclb, renaiclb, nbmj9195_state, nbmj9195, ROT0, "Fujic", "Mahjong Ren-ai Club (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, mjlaman, 0, mjlaman, mjlaman, nbmj9195_state, nbmj9195, ROT0, "Nichibutsu / AV Japan", "Mahjong La Man (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1993, mkeibaou, 0, mkeibaou, mkeibaou, nbmj9195_state, nbmj9195, ROT0, "Nichibutsu", "Mahjong Keibaou (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1993, mkeibaou, 0, mkeibaou, patimono, nbmj9195_state, nbmj9195, ROT0, "Nichibutsu", "Mahjong Keibaou (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, pachiten, 0, pachiten, pachiten, nbmj9195_state, nbmj9195, ROT0, "Nichibutsu / AV Japan / Miki Syouji", "Medal Mahjong Pachi-Slot Tengoku [BET] (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, sailorws, 0, sailorws, sailorws, nbmj9195_state, nbmj9195, ROT0, "Nichibutsu", "Mahjong Sailor Wars (Japan set 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1993, sailorwa, sailorws, sailorws, sailorws, nbmj9195_state, nbmj9195, ROT0, "Nichibutsu", "Mahjong Sailor Wars (Japan set 2)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/pc88va.cpp b/src/mame/drivers/pc88va.cpp index 37b2dc73f7e..e27944a5040 100644 --- a/src/mame/drivers/pc88va.cpp +++ b/src/mame/drivers/pc88va.cpp @@ -27,7 +27,6 @@ #include "emu.h" #include "cpu/nec/nec.h" #include "cpu/z80/z80.h" -#include "debug/debugcpu.h" #include "machine/i8255.h" #include "machine/pic8259.h" #include "machine/pit8253.h" diff --git a/src/mame/drivers/sun4.cpp b/src/mame/drivers/sun4.cpp index 95551566d5e..3550a84e173 100644 --- a/src/mame/drivers/sun4.cpp +++ b/src/mame/drivers/sun4.cpp @@ -406,7 +406,6 @@ #include "debug/debugcon.h" #include "debug/debugcmd.h" -#include "debug/debugcpu.h" #include "debugger.h" #define TIMEKEEPER_TAG "timekpr" diff --git a/src/mame/drivers/xbox.cpp b/src/mame/drivers/xbox.cpp index 375ecaf869b..1bd75dce3ca 100644 --- a/src/mame/drivers/xbox.cpp +++ b/src/mame/drivers/xbox.cpp @@ -21,7 +21,6 @@ #include "bitmap.h" #include "debug/debugcon.h" #include "debug/debugcmd.h" -#include "debug/debugcpu.h" #include "debugger.h" #include "includes/chihiro.h" #include "includes/xbox.h" diff --git a/src/mame/machine/macpci.cpp b/src/mame/machine/macpci.cpp index 705f686f056..a8f9f0e007f 100644 --- a/src/mame/machine/macpci.cpp +++ b/src/mame/machine/macpci.cpp @@ -16,7 +16,6 @@ #include "machine/applefdc.h" #include "machine/sonydriv.h" #include "includes/macpci.h" -#include "debug/debugcpu.h" #include "machine/ram.h" #include "debugger.h" diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp index 13db44bea65..09dfa898575 100644 --- a/src/mame/machine/xbox.cpp +++ b/src/mame/machine/xbox.cpp @@ -14,7 +14,6 @@ #include "debugger.h" #include "debug/debugcon.h" #include "debug/debugcmd.h" -#include "debug/debugcpu.h" #include "includes/chihiro.h" #include "includes/xbox.h" #include "includes/xbox_usb.h" @@ -35,7 +34,7 @@ void xbox_base_state::dump_string_command(int ref, int params, const char **para return; offs_t address = (offs_t)addr; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address)) { machine().debugger().console().printf("Address is unmapped.\n"); return; @@ -47,7 +46,7 @@ void xbox_base_state::dump_string_command(int ref, int params, const char **para machine().debugger().console().printf("Length %d word\n", length); machine().debugger().console().printf("MaximumLength %d word\n", maximumlength); machine().debugger().console().printf("Buffer %08X byte* ", buffer); - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &buffer)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, buffer)) { machine().debugger().console().printf("\nBuffer is unmapped.\n"); return; @@ -76,7 +75,7 @@ void xbox_base_state::dump_process_command(int ref, int params, const char **par return; offs_t address = (offs_t)addr; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address)) { machine().debugger().console().printf("Address is unmapped.\n"); return; @@ -113,7 +112,7 @@ void xbox_base_state::dump_list_command(int ref, int params, const char **param) UINT64 start = addr; offs_t address = (offs_t)addr; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address)) { machine().debugger().console().printf("Address is unmapped.\n"); return; @@ -137,7 +136,7 @@ void xbox_base_state::dump_list_command(int ref, int params, const char **param) if (addr == old) break; address = (offs_t)addr; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address)) break; } } @@ -154,7 +153,7 @@ void xbox_base_state::dump_dpc_command(int ref, int params, const char **param) return; offs_t address = (offs_t)addr; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address)) { machine().debugger().console().printf("Address is unmapped.\n"); return; @@ -181,7 +180,7 @@ void xbox_base_state::dump_timer_command(int ref, int params, const char **param return; offs_t address = (offs_t)addr; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address)) { machine().debugger().console().printf("Address is unmapped.\n"); return; @@ -204,7 +203,7 @@ void xbox_base_state::curthread_command(int ref, int params, const char **param) UINT64 fsbase = m_maincpu->state_int(44); offs_t address = (offs_t)fsbase + 0x28; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address)) { machine().debugger().console().printf("Address is unmapped.\n"); return; @@ -214,14 +213,14 @@ void xbox_base_state::curthread_command(int ref, int params, const char **param) machine().debugger().console().printf("Current thread is %08X\n", kthrd); address = (offs_t)kthrd + 0x1c; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address)) return; UINT32 topstack = space.read_dword_unaligned(address); machine().debugger().console().printf("Current thread stack top is %08X\n", topstack); address = (offs_t)kthrd + 0x28; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address)) return; UINT32 tlsdata = space.read_dword_unaligned(address); @@ -229,7 +228,7 @@ void xbox_base_state::curthread_command(int ref, int params, const char **param) address = (offs_t)topstack - 0x210 - 8; else address = (offs_t)tlsdata - 8; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address)) return; machine().debugger().console().printf("Current thread function is %08X\n", space.read_dword_unaligned(address)); } @@ -325,7 +324,7 @@ void xbox_base_state::vprogdis_command(int ref, int params, const char **param) if (type == 1) { offs_t addr = (offs_t)address; - if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &addr)) + if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, addr)) return; instruction[0] = space.read_dword_unaligned(address); instruction[1] = space.read_dword_unaligned(address + 4); diff --git a/src/mame/machine/xbox_usb.cpp b/src/mame/machine/xbox_usb.cpp index 38efc96c984..e9431c98459 100644 --- a/src/mame/machine/xbox_usb.cpp +++ b/src/mame/machine/xbox_usb.cpp @@ -11,10 +11,6 @@ #include "machine/idectrl.h" #include "video/poly.h" #include "bitmap.h" -#include "debugger.h" -#include "debug/debugcon.h" -#include "debug/debugcmd.h" -#include "debug/debugcpu.h" #include "includes/chihiro.h" #include "includes/xbox.h" #include "includes/xbox_usb.h" diff --git a/src/mame/video/rmnimbus.cpp b/src/mame/video/rmnimbus.cpp index 654e7f48b96..3b0a1aefc69 100644 --- a/src/mame/video/rmnimbus.cpp +++ b/src/mame/video/rmnimbus.cpp @@ -27,7 +27,6 @@ #include "emu.h" #include "debugger.h" -#include "debug/debugcpu.h" #include "debug/debugcon.h" #include "includes/rmnimbus.h" |