diff options
Diffstat (limited to 'src')
55 files changed, 2320 insertions, 840 deletions
diff --git a/src/devices/bus/isa/s3virge.cpp b/src/devices/bus/isa/s3virge.cpp index 959e9a2e79f..7730f4e1d12 100644 --- a/src/devices/bus/isa/s3virge.cpp +++ b/src/devices/bus/isa/s3virge.cpp @@ -85,10 +85,19 @@ void s3virge_vga_device::device_start() save_pointer(vga.attribute.data,"Attribute Registers", 0x15); m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vga_device::vblank_timer_cb),this)); + m_draw_timer = timer_alloc(TIMER_DRAW_STEP); memset(&s3, 0, sizeof(s3)); memset(&s3virge, 0, sizeof(s3virge)); s3virge.linear_address = 0x70000000; + s3virge.s3d.cmd_fifo_slots_free = 16; + save_pointer(s3virge.s3d.pattern,"S3D Pattern Data", 0xc0); + save_pointer(s3virge.s3d.reg[0],"S3D Registers: BitBLT",0x100); + save_pointer(s3virge.s3d.reg[1],"S3D Registers: 2D Line",0x100); + save_pointer(s3virge.s3d.reg[2],"S3D Registers: 2D Polygon",0x100); + save_pointer(s3virge.s3d.reg[3],"S3D Registers: 3D Line",0x100); + save_pointer(s3virge.s3d.reg[4],"S3D Registers: 3D Triangle",0x100); + // Initialise hardware graphics cursor colours, Windows 95 doesn't touch the registers for some reason for(x=0;x<4;x++) { @@ -149,6 +158,13 @@ void s3virgedx_rev1_vga_device::device_reset() s3.strapping = 0x0aff0912; } +uint16_t s3virge_vga_device::offset() +{ + if(svga.rgb24_en) + return vga.crtc.offset * 6; // special handling for 24bpp packed mode + return s3_vga_device::offset(); +} + uint8_t s3virge_vga_device::s3_crtc_reg_read(uint8_t index) { uint8_t res; @@ -315,13 +331,13 @@ void s3virge_vga_device::s3_define_video_mode() svga.rgb8_en = 0; svga.rgb15_en = 0; svga.rgb16_en = 0; - svga.rgb32_en = 0; + svga.rgb24_en = 0; switch((s3.ext_misc_ctrl_2) >> 4) { case 0x01: svga.rgb8_en = 1; break; case 0x03: svga.rgb15_en = 1; divisor = 2; break; case 0x05: svga.rgb16_en = 1; divisor = 2; break; - case 0x0d: svga.rgb32_en = 1; divisor = 1; break; + case 0x0d: svga.rgb24_en = 1; divisor = 1; break; default: fatalerror("TODO: s3 video mode not implemented %02x\n",((s3.ext_misc_ctrl_2) >> 4)); } } @@ -330,9 +346,9 @@ void s3virge_vga_device::s3_define_video_mode() svga.rgb8_en = (s3.cr3a & 0x10) >> 4; svga.rgb15_en = 0; svga.rgb16_en = 0; - svga.rgb32_en = 0; + svga.rgb24_en = 0; } - if(s3.cr43 & 0x80) // Horizontal clock doubling (techincally, doubles horizontal CRT parameters) + if(s3.cr43 & 0x80) // Horizontal clock doubling (technically, doubles horizontal CRT parameters) divisor *= 2; recompute_params_clock(divisor, xtal.value()); } @@ -394,10 +410,10 @@ void s3virge_vga_device::s3_crtc_reg_write(uint8_t index, uint8_t data) case 0x43: s3.cr43 = data; // bit 2 = bit 8 of offset register, but only if bits 4-5 of CR51 are 00h. if((s3.cr51 & 0x30) == 0) - { vga.crtc.offset = (vga.crtc.offset & 0x00ff) | ((data & 0x04) << 6); - s3_define_video_mode(); - } + else + vga.crtc.offset = (vga.crtc.offset & 0x00ff) | ((s3.cr51 & 0x30) << 4); + s3_define_video_mode(); break; /* 3d4h index 45h (R/W): CR45 Hardware Graphics Cursor Mode @@ -502,11 +518,13 @@ bit 0-9 (911,924) HCS_STADR. Hardware Graphics Cursor Storage Start Address (801/5,928) For Hi/True color modes use the Horizontal Stretch bits (3d4h index 45h bits 2 and 3). */ - case 0x4c: + case 0x4c: s3.cursor_start_addr = (s3.cursor_start_addr & 0x00ff) | (data << 8); + LOGREG("HW Cursor Address: %08x\n",s3.cursor_start_addr); break; case 0x4d: s3.cursor_start_addr = (s3.cursor_start_addr & 0xff00) | data; + LOGREG("HW Cursor Address: %08x\n",s3.cursor_start_addr); break; /* 3d4h index 4Eh (R/W): CR4E HGC Pattern Disp Start X-Pixel Position @@ -782,7 +800,7 @@ WRITE8_MEMBER(s3virge_vga_device::port_03d0_w) READ8_MEMBER(s3virge_vga_device::mem_r) { - if (svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb32_en) + if (svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb24_en || svga.rgb32_en) { uint8_t data; if(offset & 0x10000) @@ -864,6 +882,502 @@ WRITE8_MEMBER(s3virge_vga_device::fb_w) vga.memory[offset % vga.svga_intf.vram_size] = data; } +void s3virge_vga_device::add_command(int cmd_type) +{ + // add command to S3D FIFO + if(s3virge.s3d.cmd_fifo_slots_free == 0) + { + LOGMMIO("Attempt to add command when all command slots are full\n"); + return; + } + memcpy(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_next_ptr].reg,s3virge.s3d.reg[cmd_type],256*4); + s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_next_ptr].op_type = cmd_type; + LOGMMIO("Added command type %i cmd %08x ptr %u\n",s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_next_ptr].op_type,s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_next_ptr].reg[S3D_REG_COMMAND],s3virge.s3d.cmd_fifo_next_ptr); + s3virge.s3d.cmd_fifo_next_ptr++; + if(s3virge.s3d.cmd_fifo_next_ptr >= 16) + s3virge.s3d.cmd_fifo_next_ptr = 0; + if(s3virge.s3d.cmd_fifo_slots_free == 16) // if all slots are free, start command now + command_start(); + s3virge.s3d.cmd_fifo_slots_free--; + // TODO: handle full FIFO +} + +void s3virge_vga_device::command_start() +{ + // start next command in FIFO + int cmd_type = s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].op_type; + + switch(cmd_type) + { + case OP_BITBLT: + s3virge.s3d.state = S3D_STATE_BITBLT; + s3virge.s3d.busy = true; + s3virge.s3d.bitblt_x_src = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_RSRC_XY] & 0x07ff0000) >> 16; + s3virge.s3d.bitblt_y_src = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_RSRC_XY] & 0x000007ff); + s3virge.s3d.bitblt_x_dst = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_RDEST_XY] & 0x07ff0000) >> 16; + s3virge.s3d.bitblt_y_dst = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_RDEST_XY] & 0x000007ff); + s3virge.s3d.bitblt_width = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_RWIDTH_HEIGHT] & 0xffff0000) >> 16; + s3virge.s3d.bitblt_height = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_RWIDTH_HEIGHT] & 0x0000ffff); + s3virge.s3d.bitblt_x_current = s3virge.s3d.bitblt_x_dst; + s3virge.s3d.bitblt_x_src_current = s3virge.s3d.bitblt_x_src; + s3virge.s3d.bitblt_y_current = s3virge.s3d.bitblt_y_dst; + s3virge.s3d.bitblt_y_src_current = s3virge.s3d.bitblt_y_src; + s3virge.s3d.bitblt_pat_x = s3virge.s3d.bitblt_x_current % 8; + s3virge.s3d.bitblt_pat_y = s3virge.s3d.bitblt_y_current % 8; + s3virge.s3d.clip_r = s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_CLIP_L_R] & 0x000007ff; + s3virge.s3d.clip_l = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_CLIP_L_R] & 0x07ff0000) >> 16; + s3virge.s3d.clip_b = s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_CLIP_T_B] & 0x000007ff; + s3virge.s3d.clip_t = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_CLIP_T_B] & 0x07ff0000) >> 16; + if(!(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000080)) + m_draw_timer->adjust(attotime::from_nsec(250),0,attotime::from_nsec(250)); + s3virge.s3d.bitblt_step_count = 0; + s3virge.s3d.bitblt_mono_pattern = + s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_MONO_PAT_0] | (uint64_t)(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_MONO_PAT_1]) << 32; + s3virge.s3d.bitblt_current_pixel = 0; + s3virge.s3d.bitblt_pixel_pos = 0; + s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_PAT_BG_CLR] = 0xffffffff; // win31 never sets this? + LOGMMIO("Started BitBLT command [%u]\n", s3virge.s3d.cmd_fifo_current_ptr); + //if(((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x01fe0000) >> 17) == 0xf0) machine().debug_break(); + break; + } +} + +void s3virge_vga_device::command_finish() +{ + s3virge.s3d.state = S3D_STATE_IDLE; + s3virge.s3d.cmd_fifo_current_ptr++; + if(s3virge.s3d.cmd_fifo_current_ptr >= 16) + s3virge.s3d.cmd_fifo_current_ptr = 0; + s3virge.s3d.cmd_fifo_slots_free++; + if(s3virge.s3d.cmd_fifo_slots_free > 16) + s3virge.s3d.cmd_fifo_slots_free = 16; + m_draw_timer->adjust(attotime::never); + + // check if there is another command in the FIFO + if(s3virge.s3d.cmd_fifo_slots_free < 16) + command_start(); + else + s3virge.s3d.busy = false; + //machine().debug_break(); + LOGMMIO("Command finished [%u] (%u slots free)\n",s3virge.s3d.cmd_fifo_current_ptr,s3virge.s3d.cmd_fifo_slots_free); +} + +uint32_t s3virge_vga_device::GetROP(uint8_t rop, uint32_t src, uint32_t dst, uint32_t pat) +{ + uint32_t ret = 0; + + switch(rop) + { + case 0x00: // 0 + ret = 0; + break; + case 0x55: // Dn + ret = ~dst; + break; + case 0x5a: // DPx + ret = dst ^ pat; + break; + case 0x66: // DSx + ret = dst ^ src; + break; + case 0x88: // DSa + ret = dst & src; + break; + case 0xb8: // PSDPxax + ret = ((dst ^ pat) & src) ^ pat; +// machine().debug_break(); + break; + case 0xcc: + ret = src; + break; + case 0xf0: + ret = pat; + break; + case 0xff: // 1 + ret = 0xffffffff; + break; + default: + popmessage("Unimplemented ROP 0x%02x",rop); + } + + return ret; +} + +bool s3virge_vga_device::advance_pixel() +{ + bool xpos, ypos; + int16_t top, left, right, bottom; + // advance src/dst and pattern location + xpos = s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x02000000; // X Positive + ypos = s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x04000000; // Y Positive + if(xpos) + { + left = s3virge.s3d.bitblt_x_dst; + right = s3virge.s3d.bitblt_x_dst + s3virge.s3d.bitblt_width + 1; + s3virge.s3d.bitblt_x_current++; + s3virge.s3d.bitblt_x_src_current++; + s3virge.s3d.bitblt_pat_x++; + } + else + { + left = s3virge.s3d.bitblt_x_dst - s3virge.s3d.bitblt_width - 1; + right = s3virge.s3d.bitblt_x_dst; + s3virge.s3d.bitblt_x_current--; + s3virge.s3d.bitblt_x_src_current--; + s3virge.s3d.bitblt_pat_x--; +// machine().debug_break(); + } + if(ypos) + { + top = s3virge.s3d.bitblt_y_dst; + bottom = s3virge.s3d.bitblt_y_dst + s3virge.s3d.bitblt_height; + } + else + { + top = s3virge.s3d.bitblt_y_dst - s3virge.s3d.bitblt_height; + bottom = s3virge.s3d.bitblt_y_dst; + } + if(s3virge.s3d.bitblt_pat_x < 0 || s3virge.s3d.bitblt_pat_x >= 8) + s3virge.s3d.bitblt_pat_x = s3virge.s3d.bitblt_x_current % 8; + if((s3virge.s3d.bitblt_x_current >= right) || (s3virge.s3d.bitblt_x_current <= left)) + { + s3virge.s3d.bitblt_x_current = s3virge.s3d.bitblt_x_dst; + s3virge.s3d.bitblt_x_src_current = s3virge.s3d.bitblt_x_src; + if(ypos) + { + s3virge.s3d.bitblt_y_current++; + s3virge.s3d.bitblt_y_src_current++; + s3virge.s3d.bitblt_pat_y++; + } + else + { + s3virge.s3d.bitblt_y_current--; + s3virge.s3d.bitblt_y_src_current--; + s3virge.s3d.bitblt_pat_y--; + } + s3virge.s3d.bitblt_pat_x = s3virge.s3d.bitblt_x_current % 8; + if(s3virge.s3d.bitblt_pat_y >= 8 || s3virge.s3d.bitblt_pat_y < 0) + s3virge.s3d.bitblt_pat_y = s3virge.s3d.bitblt_y_current % 8; + logerror("SRC: %i,%i DST: %i,%i PAT: %i,%i Bounds: %i,%i,%i,%i\n", + s3virge.s3d.bitblt_x_src_current,s3virge.s3d.bitblt_y_src_current,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,s3virge.s3d.bitblt_pat_x,s3virge.s3d.bitblt_pat_y, + left,right,top,bottom); + if((s3virge.s3d.bitblt_y_current >= bottom) || (s3virge.s3d.bitblt_y_current <= top)) + return true; + } + return false; +} + +void s3virge_vga_device::bitblt_step() +{ + if((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x40)) + bitblt_monosrc_step(); + else + bitblt_colour_step(); +} + +void s3virge_vga_device::bitblt_colour_step() +{ + // progress current BitBLT operation + // get source and destination addresses + uint32_t src_base = s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_SRC_BASE] & 0x003ffff8; + uint32_t dst_base = s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_DEST_BASE] & 0x003ffff8; + uint8_t pixel_size = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x0000001c) >> 2; + uint8_t rop = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x01fe0000) >> 17; + uint32_t src = 0; + uint32_t dst = 0; + uint32_t pat = 0; + int align = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x000000c00) >> 10; + int x; + bool done = false; + + switch(pixel_size) + { + case 0: // 8bpp + for(x=0;x<4;x++) + { + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) + src = s3virge.s3d.image_xfer >> (x*8); + else + src = read_pixel8(src_base,s3virge.s3d.bitblt_x_src_current,s3virge.s3d.bitblt_y_src_current); + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x100) + { + pat = (s3virge.s3d.bitblt_mono_pattern & (1 << ((s3virge.s3d.bitblt_pat_y*8) + (7-s3virge.s3d.bitblt_pat_x))) + ? s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_PAT_FG_CLR] : s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_PAT_BG_CLR]); + } + else + pat = (s3virge.s3d.pattern[(s3virge.s3d.bitblt_pat_y*8) + s3virge.s3d.bitblt_pat_x]) << 8; + dst = read_pixel8(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current); + write_pixel8(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,GetROP(rop, src, dst, pat) & 0xff); + done = advance_pixel(); + if(done) + { + command_finish(); + break; + } + if((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) && s3virge.s3d.bitblt_x_current == s3virge.s3d.bitblt_x_dst) + { + if(align == 2) // doubleword aligned, end here + break; + if(align == 1) // word aligned, move to next word + { + if(x < 2) + x = 2; + else + break; + } + } + } + break; + case 1: // 16bpp + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) + src = s3virge.s3d.image_xfer; + else + src = read_pixel16(src_base,s3virge.s3d.bitblt_x_src_current,s3virge.s3d.bitblt_y_src_current); + dst = read_pixel16(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current); + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x100) + { + pat = (s3virge.s3d.bitblt_mono_pattern & (1 << ((s3virge.s3d.bitblt_pat_y*8) + (7-s3virge.s3d.bitblt_pat_x))) + ? s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_PAT_FG_CLR] : s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_PAT_BG_CLR]); + } + else + pat = s3virge.s3d.pattern[(s3virge.s3d.bitblt_pat_y*16) + (s3virge.s3d.bitblt_pat_x*2)] | (s3virge.s3d.pattern[(s3virge.s3d.bitblt_pat_y*16) + (s3virge.s3d.bitblt_pat_x*2) + 1]) << 8; + write_pixel16(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,GetROP(rop, src, dst, pat) & 0xffff); + done = advance_pixel(); + if(done) + { + command_finish(); + break; + } + if((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) && s3virge.s3d.bitblt_x_current == s3virge.s3d.bitblt_x_dst && align == 2) + break; // if a new line of an image transfer, and is dword aligned, stop here + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) + src = s3virge.s3d.image_xfer >> 16; + else + src = read_pixel16(src_base,s3virge.s3d.bitblt_x_src_current,s3virge.s3d.bitblt_y_src_current); + dst = read_pixel16(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current); + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x100) + { + pat = (s3virge.s3d.bitblt_mono_pattern & (1 << ((s3virge.s3d.bitblt_pat_y*8) + (7-s3virge.s3d.bitblt_pat_x))) + ? s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_PAT_FG_CLR] : s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_PAT_BG_CLR]); + } + else + pat = s3virge.s3d.pattern[(s3virge.s3d.bitblt_pat_y*16) + (s3virge.s3d.bitblt_pat_x*2)] | (s3virge.s3d.pattern[(s3virge.s3d.bitblt_pat_y*16) + (s3virge.s3d.bitblt_pat_x*2) + 1]) << 8; + write_pixel16(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,GetROP(rop, src, dst, pat) & 0xffff); + if(advance_pixel()) + command_finish(); + break; + case 2: // 24bpp + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) + { + src = s3virge.s3d.image_xfer; + for(x=0;x<4;x++) + { + s3virge.s3d.bitblt_current_pixel |= ((s3virge.s3d.image_xfer >> (x*8)) & 0xff) << s3virge.s3d.bitblt_pixel_pos*8; + s3virge.s3d.bitblt_pixel_pos++; + if(s3virge.s3d.bitblt_pixel_pos > 2) + { + s3virge.s3d.bitblt_pixel_pos = 0; + dst = read_pixel24(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current); + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x100) + { + pat = (s3virge.s3d.bitblt_mono_pattern & (1 << ((s3virge.s3d.bitblt_pat_y*8) + (7-s3virge.s3d.bitblt_pat_x))) + ? s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_PAT_FG_CLR] : s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_PAT_BG_CLR]); + } + else + pat = s3virge.s3d.pattern[(s3virge.s3d.bitblt_pat_y*24) + (s3virge.s3d.bitblt_pat_x*3)] | (s3virge.s3d.pattern[(s3virge.s3d.bitblt_pat_y*24) + (s3virge.s3d.bitblt_pat_x*3) + 1]) << 8 + | (s3virge.s3d.pattern[(s3virge.s3d.bitblt_pat_y*24) + (s3virge.s3d.bitblt_pat_x*3) + 2]) << 16; + write_pixel24(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,GetROP(rop, s3virge.s3d.bitblt_current_pixel, dst, pat)); + s3virge.s3d.bitblt_current_pixel = 0; + done = advance_pixel(); + if((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) && s3virge.s3d.bitblt_x_current == s3virge.s3d.bitblt_x_dst) + { + if(align == 2) // doubleword aligned, end here + x = 4; + if(align == 1) // word aligned, move to next word + { + if(x < 2) + x = 2; + else + x = 4; + } + } + if(done) + command_finish(); + } + } + break; + } + else + { + src = read_pixel24(src_base,s3virge.s3d.bitblt_x_src_current,s3virge.s3d.bitblt_y_src_current); + dst = read_pixel24(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current); + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x100) + { + pat = (s3virge.s3d.bitblt_mono_pattern & (1 << ((s3virge.s3d.bitblt_pat_y*8) + (7-s3virge.s3d.bitblt_pat_x))) + ? s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_PAT_FG_CLR] : s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_PAT_BG_CLR]); + } + else + pat = s3virge.s3d.pattern[(s3virge.s3d.bitblt_pat_y*24) + (s3virge.s3d.bitblt_pat_x*3)] | (s3virge.s3d.pattern[(s3virge.s3d.bitblt_pat_y*24) + (s3virge.s3d.bitblt_pat_x*3) + 1]) << 8 + | (s3virge.s3d.pattern[(s3virge.s3d.bitblt_pat_y*24) + (s3virge.s3d.bitblt_pat_x*3) + 2]) << 16; + } + write_pixel24(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,GetROP(rop, src, dst, pat)); + if(advance_pixel()) + command_finish(); + break; + } + + s3virge.s3d.bitblt_step_count++; +} + +void s3virge_vga_device::bitblt_monosrc_step() +{ + // progress current monochrome source BitBLT operation + uint32_t src_base = s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_SRC_BASE] & 0x003ffff8; + uint32_t dst_base = s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_DEST_BASE] & 0x003ffff8; + uint8_t pixel_size = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x0000001c) >> 2; + uint8_t rop = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x01fe0000) >> 17; + uint32_t src = 0; + uint32_t dst = 0; + uint32_t pat = 0; + int align = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x000000c00) >> 10; + int x; + bool done = false; + + switch(pixel_size) + { + case 0: // 8bpp + for(x=31;x>=0;x--) + { + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) + src = bitswap<32>(s3virge.s3d.image_xfer,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24); + else + src = read_pixel8(src_base,s3virge.s3d.bitblt_x_src_current,s3virge.s3d.bitblt_y_src_current); + dst = read_pixel8(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current); + + if(src & (1 << x)) + write_pixel8(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,GetROP(rop, s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_SRC_FG_CLR], dst, pat) & 0xff); + else if(!(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x200)) // only draw background colour if transparency is not set + write_pixel8(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,GetROP(rop, s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_SRC_BG_CLR], dst, pat) & 0xff); + //printf("Pixel write(%i): X: %i Y: %i SRC: %04x DST: %04x PAT: %04x ROP: %02x\n",x,s3virge.s3d.bitblt_x_current, s3virge.s3d.bitblt_y_current, src, dst, pat, rop); + done = advance_pixel(); + if((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) && s3virge.s3d.bitblt_x_current == s3virge.s3d.bitblt_x_dst) + { + switch(align) + { + case 0: + x &= ~7; + break; + case 1: + x &= ~15; + break; + case 2: + x = -1; + break; + } + if(done) + { + command_finish(); + break; + } + } + } + break; + case 1: // 16bpp + for(x=31;x>=0;x--) + { + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) + src = bitswap<32>(s3virge.s3d.image_xfer,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24); + else + src = read_pixel16(src_base,s3virge.s3d.bitblt_x_src_current,s3virge.s3d.bitblt_y_src_current); + dst = read_pixel16(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current); + + if(src & (1 << x)) + write_pixel16(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,GetROP(rop, s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_SRC_FG_CLR], dst, pat) & 0xffff); + else if(!(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x200)) // only draw background colour if transparency is not set + write_pixel16(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,GetROP(rop, s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_SRC_BG_CLR], dst, pat) & 0xffff); + //printf("Pixel write(%i): X: %i Y: %i SRC: %04x DST: %04x PAT: %04x ROP: %02x\n",x,s3virge.s3d.bitblt_x_current, s3virge.s3d.bitblt_y_current, src, dst, pat, rop); + done = advance_pixel(); + if((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) && s3virge.s3d.bitblt_x_current == s3virge.s3d.bitblt_x_dst) + { + switch(align) + { + case 0: + x &= ~7; + break; + case 1: + x &= ~15; + break; + case 2: + x = -1; + break; + } + if(done) + { + command_finish(); + break; + } + } + } + break; + case 2: // 24bpp + for(x=31;x>=0;x--) + { + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) + src = bitswap<32>(s3virge.s3d.image_xfer,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24); + else + src = read_pixel24(src_base,s3virge.s3d.bitblt_x_src_current,s3virge.s3d.bitblt_y_src_current); + dst = read_pixel24(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current); + + if(src & (1 << x)) + write_pixel24(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,GetROP(rop, s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_SRC_FG_CLR], dst, pat)); + else if(!(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x200)) // only draw background colour if transparency is not set + write_pixel24(dst_base,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_y_current,GetROP(rop, s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_SRC_BG_CLR], dst, pat)); + //printf("Pixel write(%i): X: %i Y: %i SRC: %04x DST: %04x PAT: %04x ROP: %02x\n",x,s3virge.s3d.bitblt_x_current, s3virge.s3d.bitblt_y_current, src, dst, pat, rop); + done = advance_pixel(); + if((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x80) && s3virge.s3d.bitblt_x_current == s3virge.s3d.bitblt_x_dst) + { + switch(align) + { + case 0: + x &= ~7; + break; + case 1: + x &= ~15; + break; + case 2: + x = -1; + break; + } + if(done) + { + command_finish(); + break; + } + } + } + break; + } + + s3virge.s3d.bitblt_step_count++; +} + +void s3virge_vga_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + // TODO: S3D state timing + if(id == TIMER_DRAW_STEP) + { + switch(s3virge.s3d.state) + { + case S3D_STATE_IDLE: + m_draw_timer->adjust(attotime::zero); + break; + case S3D_STATE_BITBLT: + bitblt_step(); + break; + } + } +} + // 2D command register format - A500 (BitBLT), A900 (2D line), AD00 (2D Polygon) // bit 0 - Autoexecute, if set command is executed when the highest relevant register is written to (A50C / A97C / AD7C) // bit 1 - Enable hardware clipping @@ -885,7 +1399,16 @@ WRITE8_MEMBER(s3virge_vga_device::fb_w) READ32_MEMBER(s3virge_vga_device::s3d_sub_status_r) { - return 0x00003000; // S3D engine idle, all FIFO slots free + uint32_t res = 0x00000000; + + if(!s3virge.s3d.busy) + res |= 0x00002000; // S3d engine is idle + + //res |= (s3virge.s3d.cmd_fifo_slots_free << 8); + if(s3virge.s3d.cmd_fifo_slots_free == 16) + res |= 0x1f00; + + return res; } WRITE32_MEMBER(s3virge_vga_device::s3d_sub_control_w) @@ -895,99 +1418,68 @@ WRITE32_MEMBER(s3virge_vga_device::s3d_sub_control_w) LOGMMIO("Sub control = %08x\n", data); } +READ32_MEMBER(s3virge_vga_device::s3d_func_ctrl_r) +{ + uint32_t ret = 0; + + ret |= (s3virge.s3d.cmd_fifo_slots_free << 6); + return ret; +} + READ32_MEMBER(s3virge_vga_device::s3d_register_r) { uint32_t res = 0; - int op_type = (((offset*4) & 0x0f00) / 4) - 1; - - switch(offset) - { - case 0x4d4/4: - case 0x8d4/4: - case 0xcd4/4: - res = s3virge.s3d.src_base[op_type]; - break; - case 0xad8/4: - case 0x8d8/4: - case 0xcd8/4: - res = s3virge.s3d.dest_base[op_type]; - break; - case 0x500/4: - case 0x900/4: - case 0xd00/4: - res = s3virge.s3d.command[op_type]; - break; - case 0x504/4: - res = s3virge.s3d.rect_height[op_type]; - res |= (s3virge.s3d.rect_width[op_type] << 16); - break; - case 0x508/4: - res = s3virge.s3d.source_y[op_type]; - res |= (s3virge.s3d.source_x[op_type] << 16); - break; - case 0x50c/4: - res = s3virge.s3d.dest_y[op_type]; - res |= (s3virge.s3d.dest_x[op_type] << 16); - break; - default: - res = 0xffffffff; - LOGMMIO("MMIO unknown/unused register read MM%04X\n", (offset*4)+0xa000); - } - + int op_type = (((offset*4) & 0x1c00) >> 10) - 1; + + // unused registers + if(offset < 0x100/4) + return 0; + if(offset >= 0x1c0/4 && offset < 0x400/4) + return 0; + + // handle BitBLT pattern registers + if((offset >= 0x100/4) && (offset < 0x1c0/4)) + return s3virge.s3d.pattern[offset - (0x100/4)]; + + res = s3virge.s3d.reg[op_type][((offset*4) & 0x03ff) / 4]; + LOGMMIO("MM%04X returning %08x\n", (offset*4)+0xa000, res); + return res; } WRITE32_MEMBER(s3virge_vga_device::s3d_register_w) { - int op_type = (((offset*4) & 0x0f00) / 4) - 1; + int op_type = (((offset*4) & 0x1c00) >> 10) - 1; + + // unused registers + if(offset < 0x100/4) + return; + if(offset >= 0x1c0/4 && offset < 0x400/4) + return; + // handle BitBLT pattern registers + if((offset >= 0x100/4) && (offset < 0x1c0/4)) + { + //COMBINE_DATA(&s3virge.s3d.pattern[(offset*4) - (0x100/4)]); + s3virge.s3d.pattern[((offset - 0x100/4)*4)+3] = (data & 0xff000000) >> 24; + s3virge.s3d.pattern[((offset - 0x100/4)*4)+2] = (data & 0x00ff0000) >> 16; + s3virge.s3d.pattern[((offset - 0x100/4)*4)+1] = (data & 0x0000ff00) >> 8; + s3virge.s3d.pattern[((offset - 0x100/4)*4)] = (data & 0x000000ff); + return; + } + + s3virge.s3d.reg[op_type][((offset*4) & 0x03ff) / 4] = data; + LOGMMIO("MM%04X = %08x\n", (offset*4)+0xa000, data); switch(offset) { - case 0x4d4/4: - case 0x8d4/4: - case 0xcd4/4: - s3virge.s3d.src_base[op_type] = data; - LOGMMIO("MM%04X: Source Base = %08x\n", (offset*4)+0xa000, data); - break; - case 0xad8/4: - case 0x8d8/4: - case 0xcd8/4: - s3virge.s3d.dest_base[op_type] = data; - LOGMMIO("MM%04X: Destination base address = %08x\n", (offset*4)+0xa000, data); - break; case 0x500/4: - s3virge.s3d.command[OP_BITBLT] = data; - // TODO:if bit 0 is reset, then execute now - LOGMMIO("MM%04X: Command [BitBLT/FilledRect] = %08x\n", (offset*4)+0xa000, data); - break; - case 0x900/4: - s3virge.s3d.command[OP_2DLINE] = data; - // TODO:if bit 0 is reset, then execute now - LOGMMIO("MM%04X: Command [2D Line] = %08x\n", (offset*4)+0xa000, data); - break; - case 0xd00/4: - s3virge.s3d.command[OP_2DPOLY] = data; - // TODO:if bit 0 is reset, then execute now - LOGMMIO("MM%04X: Command [2D Polygon] = %08x\n", (offset*4)+0xa000, data); - break; - case 0x504/4: - s3virge.s3d.rect_height[OP_BITBLT] = data & 0x000003ff; - s3virge.s3d.rect_width[OP_BITBLT] = (data & 0x03ff0000) >> 16; - LOGMMIO("MM%04X: Rectangle Width/Height = %08x (%ix%i)\n", (offset*4)+0xa000, data, s3virge.s3d.rect_width[OP_BITBLT], s3virge.s3d.rect_height[OP_BITBLT]); - break; - case 0x508/4: - s3virge.s3d.source_y[OP_BITBLT] = data & 0x000003ff; - s3virge.s3d.source_x[OP_BITBLT] = (data & 0x03ff0000) >> 16; - LOGMMIO("MM%04X: Rectangle Source X/Y = %08x (%i, %i)\n",(offset*4)+0xa000, data, s3virge.s3d.source_x[OP_BITBLT], s3virge.s3d.source_y[OP_BITBLT]); + if(!(data & 0x00000001)) + add_command(op_type); break; case 0x50c/4: - s3virge.s3d.dest_y[OP_BITBLT] = data & 0x000003ff; - s3virge.s3d.dest_x[OP_BITBLT] = (data & 0x03ff0000) >> 16; - // TODO:if previous command has bit 0 set, then execute here - LOGMMIO("MM%04X: Rectangle Destination X/Y = %08x (%i, %i)\n", (offset*4)+0xa000, data, s3virge.s3d.dest_x[OP_BITBLT], s3virge.s3d.dest_y[OP_BITBLT]); + if(s3virge.s3d.reg[op_type][S3D_REG_COMMAND] & 0x00000001) // autoexecute enabled + add_command(op_type); break; - default: - LOGMMIO("MMIO unknown/unused register write MM%04X = %08x\n", (offset*4)+0xa000, data); } } diff --git a/src/devices/bus/isa/s3virge.h b/src/devices/bus/isa/s3virge.h index daa7607ef0c..9b9716b88f2 100644 --- a/src/devices/bus/isa/s3virge.h +++ b/src/devices/bus/isa/s3virge.h @@ -35,26 +35,56 @@ public: DECLARE_WRITE8_MEMBER(fb_w); DECLARE_READ32_MEMBER(s3d_sub_status_r); DECLARE_WRITE32_MEMBER(s3d_sub_control_w); + DECLARE_READ32_MEMBER(s3d_func_ctrl_r); DECLARE_READ32_MEMBER(s3d_register_r); DECLARE_WRITE32_MEMBER(s3d_register_w); + DECLARE_WRITE32_MEMBER(image_xfer) + { +// if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000080) + { +// logerror("IMG Xfer:(%u):%08x X:%u(%u) Y:%u(%u)\n",s3virge.s3d.bitblt_step_count,data,s3virge.s3d.bitblt_x_current,s3virge.s3d.bitblt_width,s3virge.s3d.bitblt_y_current,s3virge.s3d.bitblt_height); + s3virge.s3d.image_xfer = data; + bitblt_step(); + } + } + uint16_t get_crtc_port() { return (vga.miscellaneous_output&1)?0x3d0:0x3b0; } uint32_t get_linear_address() { return s3virge.linear_address; } void set_linear_address(uint32_t addr) { s3virge.linear_address = addr; } uint8_t get_linear_address_size() { return s3virge.linear_address_size; } bool is_linear_address_active() { return s3virge.linear_address_enable; } bool is_new_mmio_active() { return s3.cr53 & 0x08; } + uint16_t dest_stride() + { +// if((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x0000001c) == 0x08) +// { +// popmessage("Stride=%08x",(((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_DEST_SRC_STR] >> 16) & 0xfff8) / 3) +// + ((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_DEST_SRC_STR] >> 16) & 0xfff8)); +// return (((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_DEST_SRC_STR] >> 16) & 0xfff8) / 3) +// + ((s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_DEST_SRC_STR] >> 16) & 0xfff8); +// } +// else + return (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_DEST_SRC_STR] >> 16) & 0xfff8; + } ibm8514a_device* get_8514() { fatalerror("s3virge requested non-existent 8514/A device\n"); return nullptr; } + enum + { + TIMER_DRAW_STEP = 10 + }; + + protected: s3virge_vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); // device-level overrides virtual void device_start() override; virtual void device_reset() override; - + virtual uint16_t offset() override; + enum { LAW_64K = 0, @@ -63,6 +93,7 @@ protected: LAW_4MB }; + // register groups enum { OP_BITBLT = 0, @@ -72,6 +103,35 @@ protected: OP_3DTRI }; + enum + { + S3D_STATE_IDLE = 0, + S3D_STATE_BITBLT, + S3D_STATE_2DLINE, + S3D_STATE_2DPOLY, + S3D_STATE_3DLINE, + S3D_STATE_3DPOLY + }; + + enum + { + S3D_REG_SRC_BASE = 0xd4/4, + S3D_REG_DEST_BASE = 0xd8/4, + S3D_REG_CLIP_L_R = 0xdc/4, + S3D_REG_CLIP_T_B = 0xe0/4, + S3D_REG_DEST_SRC_STR = 0xe4/4, + S3D_REG_MONO_PAT_0 = 0xe8/4, + S3D_REG_MONO_PAT_1 = 0xec/4, + S3D_REG_PAT_BG_CLR = 0xf0/4, + S3D_REG_PAT_FG_CLR = 0xf4/4, + S3D_REG_SRC_BG_CLR = 0xf8/4, + S3D_REG_SRC_FG_CLR = 0xfc/4, + S3D_REG_COMMAND = 0x100/4, + S3D_REG_RWIDTH_HEIGHT = 0x104/4, + S3D_REG_RSRC_XY = 0x108/4, + S3D_REG_RDEST_XY = 0x10c/4 + }; + struct { uint32_t linear_address; @@ -82,19 +142,109 @@ protected: struct { - uint32_t src_base[5]; - uint32_t dest_base[5]; - uint32_t command[5]; - uint16_t source_x[5]; - uint16_t source_y[5]; - uint16_t dest_x[5]; - uint16_t dest_y[5]; - uint16_t rect_width[5]; - uint16_t rect_height[5]; + int state; + bool busy; + struct + { + uint32_t reg[256]; + int op_type; + } cmd_fifo[16]; + int cmd_fifo_next_ptr; // command added here in FIFO + int cmd_fifo_current_ptr; // command currently being processed in FIFO + int cmd_fifo_slots_free; + + uint8_t pattern[0xc0]; + uint32_t reg[5][256]; + + // BitBLT command state + uint16_t bitblt_x_src; + uint16_t bitblt_y_src; + uint16_t bitblt_x_dst; + uint16_t bitblt_y_dst; + int16_t bitblt_x_current; + int16_t bitblt_y_current; + int16_t bitblt_x_src_current; + int16_t bitblt_y_src_current; + int8_t bitblt_pat_x; + int8_t bitblt_pat_y; + uint16_t bitblt_height; + uint16_t bitblt_width; + uint32_t bitblt_step_count; + uint64_t bitblt_mono_pattern; + uint32_t bitblt_current_pixel; + uint32_t bitblt_pixel_pos; // current position in a pixel (for packed 24bpp colour image transfers) + uint32_t image_xfer; // source data via image transfer ports + uint16_t clip_l; + uint16_t clip_r; + uint16_t clip_t; + uint16_t clip_b; } s3d; } s3virge; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + void write_pixel32(uint32_t base, uint16_t x, uint16_t y, uint32_t val) + { + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002) + if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b) + return; + vga.memory[(base + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff; + vga.memory[(base + 1 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff; + vga.memory[(base + 2 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 16) & 0xff; + vga.memory[(base + 3 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 24) & 0xff; + } + void write_pixel24(uint32_t base, uint16_t x, uint16_t y, uint32_t val) + { + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002) + if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b) + return; + vga.memory[(base + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff; + vga.memory[(base + 1 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff; + vga.memory[(base + 2 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 16) & 0xff; + } + void write_pixel16(uint32_t base, uint16_t x, uint16_t y, uint16_t val) + { + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002) + if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b) + return; + vga.memory[(base + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff; + vga.memory[(base + 1 + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff; + } + void write_pixel8(uint32_t base, uint16_t x, uint16_t y, uint8_t val) + { + if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002) + if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b) + return; + vga.memory[(base + x + (y*dest_stride())) % vga.svga_intf.vram_size] = val; + } + uint32_t read_pixel32(uint32_t base, uint16_t x, uint16_t y) + { + return (vga.memory[(base + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 24) | (vga.memory[(base + 1 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 16) + | (vga.memory[(base + 2 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8) | vga.memory[(base + 3 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size]; + } + uint32_t read_pixel24(uint32_t base, uint16_t x, uint16_t y) + { + return (vga.memory[(base + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size]) | (vga.memory[(base + 1 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8) + | (vga.memory[(base + 2 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] << 16); + } + uint16_t read_pixel16(uint32_t base, uint16_t x, uint16_t y) + { + return (vga.memory[(base + (x*2) + (y*dest_stride()) % vga.svga_intf.vram_size)]) | (vga.memory[(base + 1 + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8); + } + uint8_t read_pixel8(uint32_t base, uint16_t x, uint16_t y) + { + return vga.memory[(base + x + (y*dest_stride())) % vga.svga_intf.vram_size]; + } + uint32_t GetROP(uint8_t rop, uint32_t src, uint32_t dst, uint32_t pat); + bool advance_pixel(); private: + emu_timer* m_draw_timer; + void bitblt_step(); + void bitblt_colour_step(); + void bitblt_monosrc_step(); + void add_command(int cmd_type); + void command_start(); + void command_finish(); + virtual uint8_t s3_crtc_reg_read(uint8_t index); virtual void s3_define_video_mode(void); virtual void s3_crtc_reg_write(uint8_t index, uint8_t data); diff --git a/src/devices/cpu/we32000/we32100d.cpp b/src/devices/cpu/we32000/we32100d.cpp index 955cbbd63d9..c90528c6fc0 100644 --- a/src/devices/cpu/we32000/we32100d.cpp +++ b/src/devices/cpu/we32000/we32100d.cpp @@ -57,7 +57,7 @@ void we32100_disassembler::format_signed(std::ostream &stream, s32 x) util::stream_format(stream, "-0x%x", u32(-x)); } -void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we32100_disassembler::data_buffer &opcodes, u8 n, bool dst) +void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we32100_disassembler::data_buffer &opcodes, u8 n, bool dst, bool spectype) { switch (n & 0xf0) { @@ -183,6 +183,8 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321 util::stream_format(stream, "*$0x%08x", swapendian_int32(opcodes.r32(pc))); pc += 4; } + else if (spectype) + util::stream_format(stream, "invalid(0x%02x)", n); else if (BIT(n, 3) || (n & 0x03) == 0x01) util::stream_format(stream, "reserved(0x%02x)", n); else @@ -195,7 +197,7 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321 else util::stream_format(stream, "{%cbyte}", BIT(n, 2) ? 's' : 'u'); u8 m = opcodes.r8(pc++); - dasm_am(stream, pc, opcodes, m, dst); + dasm_am(stream, pc, opcodes, m, dst, true); } break; } @@ -204,31 +206,25 @@ void we32100_disassembler::dasm_am(std::ostream &stream, offs_t &pc, const we321 void we32100_disassembler::dasm_src(std::ostream &stream, offs_t &pc, const we32100_disassembler::data_buffer &opcodes) { u8 n = opcodes.r8(pc++); - dasm_am(stream, pc, opcodes, n, false); + dasm_am(stream, pc, opcodes, n, false, false); } void we32100_disassembler::dasm_srcw(std::ostream &stream, offs_t &pc, const we32100_disassembler::data_buffer &opcodes) { u8 n = opcodes.r8(pc++); - if (n < 0xe0 || n >= 0xef) - dasm_am(stream, pc, opcodes, n, false); - else - util::stream_format(stream, "invalid(0x%02x)", n); + dasm_am(stream, pc, opcodes, n, false, true); } void we32100_disassembler::dasm_dst(std::ostream &stream, offs_t &pc, const we32100_disassembler::data_buffer &opcodes) { u8 n = opcodes.r8(pc++); - dasm_am(stream, pc, opcodes, n, true); + dasm_am(stream, pc, opcodes, n, true, false); } void we32100_disassembler::dasm_dstw(std::ostream &stream, offs_t &pc, const we32100_disassembler::data_buffer &opcodes) { u8 n = opcodes.r8(pc++); - if (n < 0xe0 || n == 0xef) - dasm_am(stream, pc, opcodes, n, true); - else - util::stream_format(stream, "invalid(0x%02x)", n); + dasm_am(stream, pc, opcodes, n, true, true); } void we32100_disassembler::dasm_ea(std::ostream &stream, offs_t &pc, offs_t ppc, const we32100_disassembler::data_buffer &opcodes) @@ -259,7 +255,7 @@ void we32100_disassembler::dasm_ea(std::ostream &stream, offs_t &pc, offs_t ppc, util::stream_format(stream, "(%%%s) <%x>", s_rnames[15], u32(ppc + disp)); } else - dasm_am(stream, pc, opcodes, n, false); + dasm_am(stream, pc, opcodes, n, false, true); } else util::stream_format(stream, "invalid(0x%02x)", n); diff --git a/src/devices/cpu/we32000/we32100d.h b/src/devices/cpu/we32000/we32100d.h index efc820675b9..afe653d518d 100644 --- a/src/devices/cpu/we32000/we32100d.h +++ b/src/devices/cpu/we32000/we32100d.h @@ -22,7 +22,7 @@ private: // internal helpers void format_signed(std::ostream &stream, s32 x); - void dasm_am(std::ostream &stream, offs_t &pc, const data_buffer &opcodes, u8 n, bool dst); + void dasm_am(std::ostream &stream, offs_t &pc, const data_buffer &opcodes, u8 n, bool dst, bool spectype); void dasm_src(std::ostream &stream, offs_t &pc, const data_buffer &opcodes); void dasm_srcw(std::ostream &stream, offs_t &pc, const data_buffer &opcodes); void dasm_dst(std::ostream &stream, offs_t &pc, const data_buffer &opcodes); diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp index a6a8325d818..9c7cdc03f72 100644 --- a/src/devices/machine/netlist.cpp +++ b/src/devices/machine/netlist.cpp @@ -36,8 +36,6 @@ #define MOVE_UNIQUE_PTR(x) (x) #endif - - DEFINE_DEVICE_TYPE(NETLIST_CORE, netlist_mame_device, "netlist_core", "Netlist Core Device") DEFINE_DEVICE_TYPE(NETLIST_CPU, netlist_mame_cpu_device, "netlist_cpu", "Netlist CPU Device") DEFINE_DEVICE_TYPE(NETLIST_SOUND, netlist_mame_sound_device, "netlist_sound", "Netlist Sound Device") @@ -182,12 +180,12 @@ public: m_cpu_device = downcast<netlist_mame_cpu_device *>(&nl->parent()); } - ATTR_COLD void reset() override + void reset() override { m_last = 0.0; } - ATTR_COLD void register_callback(netlist_mame_analog_output_device::output_delegate &&callback) + void register_callback(netlist_mame_analog_output_device::output_delegate &&callback) { m_callback.reset(new netlist_mame_analog_output_device::output_delegate(std::move(callback))); } @@ -240,12 +238,12 @@ public: m_cpu_device = downcast<netlist_mame_cpu_device *>(&nl->parent()); } - ATTR_COLD void reset() override + void reset() override { m_last = 0; } - ATTR_COLD void register_callback(netlist_mame_logic_output_device::output_delegate &&callback) + void register_callback(netlist_mame_logic_output_device::output_delegate &&callback) { m_callback.reset(new netlist_mame_logic_output_device::output_delegate(std::move(callback))); } @@ -418,7 +416,7 @@ public: , m_offset(*this, "OFFSET", 0.0) , m_buffer(nullptr) , m_bufsize(0) - , m_sample_time(netlist::netlist_time::from_hz(1)) //sufficiently big enough + , m_sample_time(netlist::netlist_time::from_hz(1)) , m_in(*this, "IN") , m_cur(0.0) , m_last_pos(0) @@ -426,36 +424,15 @@ public: { } - //static const int BUFSIZE = 2048; +protected: - ATTR_COLD void reset() override + void reset() override { m_cur = 0.0; m_last_pos = 0; m_last_buffer_time = netlist::netlist_time_ext::zero(); } - ATTR_HOT void sound_update(const netlist::netlist_time_ext &upto) - { - int pos = (upto - m_last_buffer_time()) / m_sample_time; - if (pos > m_bufsize) - throw emu_fatalerror("sound %s: pos %d exceeded bufsize %d\n", name().c_str(), pos, m_bufsize); - while (m_last_pos < pos ) - { - m_buffer[m_last_pos++] = (stream_sample_t) m_cur; - } - } - - ATTR_HOT void sound_update_fill(int samples) - { - if (samples > m_bufsize) - throw emu_fatalerror("sound %s: pos %d exceeded bufsize %d\n", name().c_str(), samples, m_bufsize); - while (m_last_pos < samples ) - { - m_buffer[m_last_pos++] = (stream_sample_t) m_cur; - } - } - NETLIB_UPDATEI() { nl_fptype val = m_in() * m_mult() + m_offset(); @@ -471,12 +448,34 @@ public: } public: - ATTR_HOT void buffer_reset(const netlist::netlist_time_ext &upto) + void buffer_reset(const netlist::netlist_time_ext &upto) { m_last_pos = 0; m_last_buffer_time = upto; } + void sound_update(const netlist::netlist_time_ext &upto) + { + int pos = (upto - m_last_buffer_time()) / m_sample_time; + if (pos > m_bufsize) + throw emu_fatalerror("sound %s: pos %d exceeded bufsize %d\n", name().c_str(), pos, m_bufsize); + while (m_last_pos < pos ) + { + m_buffer[m_last_pos++] = (stream_sample_t) m_cur; + } + } + + void sound_update_fill(int samples) + { + if (samples > m_bufsize) + throw emu_fatalerror("sound %s: pos %d exceeded bufsize %d\n", name().c_str(), samples, m_bufsize); + while (m_last_pos < samples ) + { + m_buffer[m_last_pos++] = (stream_sample_t) m_cur; + } + } + + netlist::param_int_t m_channel; netlist::param_fp_t m_mult; netlist::param_fp_t m_offset; @@ -504,10 +503,11 @@ public: NETLIB_NAME(sound_in)(netlist::netlist_state_t &anetlist, const pstring &name) : netlist::device_t(anetlist, name) - , m_inc(netlist::netlist_time::from_nsec(1)) + , m_sample_time(netlist::netlist_time::from_nsec(1)) , m_feedback(*this, "FB") // clock part , m_Q(*this, "Q") , m_pos(0) + , m_samples(0) , m_num_channels(0) { connect(m_feedback, m_Q); @@ -520,16 +520,44 @@ public: } } - ATTR_COLD void reset() override +protected: + void reset() override { m_pos = 0; for (auto & elem : m_channels) elem.m_buffer = nullptr; } - ATTR_COLD void resolve() + NETLIB_UPDATEI() + { + if (m_pos < m_samples) + { + for (int i=0; i<m_num_channels; i++) + { + if (m_channels[i].m_buffer == nullptr) + break; // stop, called outside of stream_update + const nl_fptype v = m_channels[i].m_buffer[m_pos]; + m_channels[i].m_param->setTo(v * (*m_channels[i].m_param_mult)() + (*m_channels[i].m_param_offset)()); + } + } + else + { + // FIXME: The logic has a rounding issue because time resolution divided + // by 48,000 is not a natural number. The fractional part + // adds up to one samples every 13 seconds for 100 ps resolution. + // Fixing this is possible but complicated and expensive. + } + m_pos++; + + m_Q.net().toggle_and_push_to_queue(m_sample_time); + } + +public: + void resolve(netlist::netlist_time sample_time) { m_pos = 0; + m_sample_time = sample_time; + for (int i = 0; i < MAX_INPUT_CHANNELS; i++) { if ((*m_channels[i].m_param_name)() != pstring("")) @@ -542,23 +570,17 @@ public: } } - NETLIB_UPDATEI() + template <typename S> + void buffer_reset(netlist::netlist_time sample_time, int num_samples, S **inputs) { - for (int i=0; i<m_num_channels; i++) - { - if (m_channels[i].m_buffer == nullptr) - break; // stop, called outside of stream_update - const nl_fptype v = m_channels[i].m_buffer[m_pos]; - m_channels[i].m_param->setTo(v * (*m_channels[i].m_param_mult)() + (*m_channels[i].m_param_offset)()); - } - m_pos++; - m_Q.net().toggle_and_push_to_queue(m_inc); - } + m_samples = num_samples; + m_sample_time = sample_time; -public: - ATTR_HOT void buffer_reset() - { m_pos = 0; + for (int i=0; i < m_num_channels; i++) + { + m_channels[i].m_buffer = inputs[i]; + } } struct channel @@ -569,16 +591,18 @@ public: netlist::unique_pool_ptr<netlist::param_fp_t> m_param_mult; netlist::unique_pool_ptr<netlist::param_fp_t> m_param_offset; }; - channel m_channels[MAX_INPUT_CHANNELS]; - netlist::netlist_time m_inc; int num_channels() { return m_num_channels; } private: + channel m_channels[MAX_INPUT_CHANNELS]; + netlist::netlist_time m_sample_time; + netlist::logic_input_t m_feedback; netlist::logic_output_t m_Q; int m_pos; + int m_samples; int m_num_channels; }; @@ -1156,14 +1180,16 @@ void netlist_mame_device::device_start() save_state(); m_old = netlist::netlist_time_ext::zero(); - m_rem = netlist::netlist_time::zero(); + m_rem = netlist::netlist_time_ext::zero(); LOGDEVCALLS("device_start exit\n"); } void netlist_mame_device::device_clock_changed() { - m_div = netlist::netlist_time::from_hz(clock()); + m_div = static_cast<netlist::netlist_time_ext>( + (netlist::netlist_time_ext::resolution() << MDIV_SHIFT) / clock()); + //printf("m_div %d\n", (int) m_div.as_raw()); netlist().log().debug("Setting clock {1} and divisor {2}\n", clock(), m_div.as_double()); } @@ -1172,7 +1198,7 @@ void netlist_mame_device::device_reset() { LOGDEVCALLS("device_reset\n"); m_old = netlist::netlist_time_ext::zero(); - m_rem = netlist::netlist_time::zero(); + m_rem = netlist::netlist_time_ext::zero(); netlist().exec().reset(); } @@ -1182,7 +1208,7 @@ void netlist_mame_device::device_stop() netlist().exec().stop(); } -ATTR_COLD void netlist_mame_device::device_post_load() +void netlist_mame_device::device_post_load() { LOGDEVCALLS("device_post_load\n"); @@ -1190,7 +1216,7 @@ ATTR_COLD void netlist_mame_device::device_post_load() netlist().rebuild_lists(); } -ATTR_COLD void netlist_mame_device::device_pre_save() +void netlist_mame_device::device_pre_save() { LOGDEVCALLS("device_pre_save\n"); @@ -1199,10 +1225,11 @@ ATTR_COLD void netlist_mame_device::device_pre_save() void netlist_mame_device::update_icount(netlist::netlist_time_ext time) noexcept { - const netlist::netlist_time_ext delta(time - m_old + m_rem); - const auto d(delta / m_div); + const netlist::netlist_time_ext delta = (time - m_old).shl(MDIV_SHIFT) + m_rem; + const uint64_t d = delta / m_div; m_old = time; - m_rem = static_cast<netlist::netlist_time>(delta - (m_div * d)); + m_rem = (delta - (m_div * d)); + //printf("d %d m_rem %d\n", (int) d, (int) m_rem.as_raw()); m_icount -= d; } @@ -1212,7 +1239,7 @@ void netlist_mame_device::check_mame_abort_slice() noexcept netlist().exec().abort_current_queue_slice(); } -ATTR_COLD void netlist_mame_device::save_state() +void netlist_mame_device::save_state() { for (auto const & s : netlist().run_state_manager().save_list()) { @@ -1300,17 +1327,17 @@ void netlist_mame_cpu_device::nl_register_devices(netlist::setup_t &lsetup) cons lsetup.factory().register_device<nld_analog_callback>( "NETDEV_CALLBACK", "nld_analog_callback", "-"); } -ATTR_COLD uint64_t netlist_mame_cpu_device::execute_clocks_to_cycles(uint64_t clocks) const noexcept +uint64_t netlist_mame_cpu_device::execute_clocks_to_cycles(uint64_t clocks) const noexcept { return clocks; } -ATTR_COLD uint64_t netlist_mame_cpu_device::execute_cycles_to_clocks(uint64_t cycles) const noexcept +uint64_t netlist_mame_cpu_device::execute_cycles_to_clocks(uint64_t cycles) const noexcept { return cycles; } -ATTR_HOT void netlist_mame_cpu_device::execute_run() +void netlist_mame_cpu_device::execute_run() { //m_ppc = m_pc; // copy PC to previous PC if (debugger_enabled()) @@ -1320,13 +1347,13 @@ ATTR_HOT void netlist_mame_cpu_device::execute_run() m_genPC++; m_genPC &= 255; debugger_instruction_hook(m_genPC); - netlist().exec().process_queue(static_cast<netlist::netlist_time_ext>(nl_clock_period())); + netlist().exec().process_queue(nltime_ext_from_clocks(1)); update_icount(netlist().exec().time()); } } else { - netlist().exec().process_queue(static_cast<netlist::netlist_time_ext>(nl_clock_period()) * m_icount); + netlist().exec().process_queue(nltime_ext_from_clocks(m_icount)); update_icount(netlist().exec().time()); } } @@ -1440,8 +1467,7 @@ void netlist_mame_sound_device::device_start() if (indevs.size() == 1) { m_in = indevs[0]; - m_in->resolve(); - m_in->m_inc = netlist::netlist_time::from_hz(clock()); + m_in->resolve(nltime_from_clocks(1)); } /* initialize the stream(s) */ @@ -1462,20 +1488,16 @@ void netlist_mame_sound_device::sound_stream_update(sound_stream &stream, stream { e.second->m_buffer = outputs[e.first]; e.second->m_bufsize = samples; + e.second->m_sample_time = nltime_from_clocks(1); } - if (m_in) { - m_in->buffer_reset(); - for (int i=0; i < m_in->num_channels(); i++) - { - m_in->m_channels[i].m_buffer = inputs[i]; - } + m_in->buffer_reset(nltime_from_clocks(1), samples, inputs); } auto cur(netlist().exec().time()); - const auto delta(static_cast<netlist::netlist_time_ext>(nl_clock_period()) * samples); + const auto delta(nltime_ext_from_clocks(samples)); netlist().exec().process_queue(delta); cur += delta; diff --git a/src/devices/machine/netlist.h b/src/devices/machine/netlist.h index 0be9fcac109..bef8a524645 100644 --- a/src/devices/machine/netlist.h +++ b/src/devices/machine/netlist.h @@ -82,7 +82,20 @@ public: int m_icount; + static constexpr const unsigned MDIV_SHIFT = 16; + + netlist::netlist_time_ext nltime_ext_from_clocks(unsigned c) const noexcept + { + return (m_div * c).shr(MDIV_SHIFT); + } + + netlist::netlist_time nltime_from_clocks(unsigned c) const noexcept + { + return static_cast<netlist::netlist_time>((m_div * c).shr(MDIV_SHIFT)); + } + protected: + netlist_mame_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); // Custom to netlist ... @@ -98,8 +111,6 @@ protected: virtual void device_pre_save() override; virtual void device_clock_changed() override; - netlist::netlist_time nl_clock_period() const noexcept { return m_div; } - plib::unique_ptr<netlist::netlist_state_t> base_validity_check(validity_checker &valid) const; private: @@ -107,8 +118,8 @@ private: void common_dev_start(netlist::netlist_state_t *lnetlist) const; - netlist::netlist_time m_div; - netlist::netlist_time m_rem; + netlist::netlist_time_ext m_div; + netlist::netlist_time_ext m_rem; netlist::netlist_time_ext m_old; std::unique_ptr<netlist_mame_t> m_netlist; diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp index cc30d50bae7..f5a7f7148e9 100644 --- a/src/devices/video/pc_vga.cpp +++ b/src/devices/video/pc_vga.cpp @@ -1150,17 +1150,18 @@ uint32_t s3_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma uint16_t cy = s3.cursor_y & 0x07ff; uint32_t bg_col; uint32_t fg_col; + int r,g,b; + uint32_t datax; if(cur_mode == SCREEN_OFF || cur_mode == TEXT_MODE || cur_mode == MONO_MODE || cur_mode == CGA_MODE || cur_mode == EGA_MODE) return 0; // cursor only works in VGA or SVGA modes src = s3.cursor_start_addr * 1024; // start address is in units of 1024 bytes - if(cur_mode == RGB16_MODE) + switch(cur_mode) { - int r,g,b; - uint16_t datax; - + case RGB15_MODE: + case RGB16_MODE: datax = s3.cursor_bg[0]|s3.cursor_bg[1]<<8; r = (datax&0xf800)>>11; g = (datax&0x07e0)>>5; @@ -1178,11 +1179,25 @@ uint32_t s3_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma g = (g << 2) | (g & 0x3); b = (b << 3) | (b & 0x7); fg_col = (0xff<<24)|(r<<16)|(g<<8)|(b<<0); - } - else /* TODO: other modes */ - { + break; + case RGB24_MODE: + datax = s3.cursor_bg[0]|s3.cursor_bg[1]<<8|s3.cursor_bg[2]<<16; + r = (datax&0xff0000)>>16; + g = (datax&0x00ff00)>>8; + b = (datax&0x0000ff)>>0; + bg_col = (0xff<<24)|(r<<16)|(g<<8)|(b<<0); + + datax = s3.cursor_fg[0]|s3.cursor_fg[1]<<8|s3.cursor_fg[2]<<16; + r = (datax&0xff0000)>>16; + g = (datax&0x00ff00)>>8; + b = (datax&0x0000ff)>>0; + fg_col = (0xff<<24)|(r<<16)|(g<<8)|(b<<0); + break; + case RGB8_MODE: + default: bg_col = pen(s3.cursor_bg[0]); fg_col = pen(s3.cursor_fg[0]); + break; } //popmessage("%08x %08x",(s3.cursor_bg[0])|(s3.cursor_bg[1]<<8)|(s3.cursor_bg[2]<<16)|(s3.cursor_bg[3]<<24) diff --git a/src/devices/video/virge_pci.cpp b/src/devices/video/virge_pci.cpp index c3d55f4cc62..6bebe26bc88 100644 --- a/src/devices/video/virge_pci.cpp +++ b/src/devices/video/virge_pci.cpp @@ -26,11 +26,19 @@ virgedx_pci_device::virgedx_pci_device(const machine_config &mconfig, const char void virge_pci_device::mmio_map(address_map& map) { + // image transfer ports + map(0x1000000,0x1007fff).w(m_vga, FUNC(s3virge_vga_device::image_xfer)); + // MMIO address map map(0x1008504,0x1008507).rw(m_vga, FUNC(s3virge_vga_device::s3d_sub_status_r), FUNC(s3virge_vga_device::s3d_sub_control_w)); + map(0x100850c,0x100850f).r(m_vga, FUNC(s3virge_vga_device::s3d_func_ctrl_r)); // S3D engine registers map(0x100a000,0x100b7ff).rw(m_vga, FUNC(s3virge_vga_device::s3d_register_r), FUNC(s3virge_vga_device::s3d_register_w)); + + // alternate image transfer ports + map(0x100d000,0x100efff).w(m_vga, FUNC(s3virge_vga_device::image_xfer)); + } void virge_pci_device::lfb_map(address_map& map) diff --git a/src/emu/xtal.cpp b/src/emu/xtal.cpp index da2c0e7d8bb..0e47cffa87a 100644 --- a/src/emu/xtal.cpp +++ b/src/emu/xtal.cpp @@ -414,6 +414,7 @@ const double XTAL::known_xtals[] = { 61'440'000, /* 61.44_MHz_XTAL Donkey Kong */ 64'000'000, /* 64_MHz_XTAL BattleToads */ 64'108'800, /* 64.1088_MHz_XTAL HP Topcat high-res */ + 66'000'000, /* 66_MHz_XTAL - */ 66'666'700, /* 66.6667_MHz_XTAL Later Midway games */ 67'737'600, /* 67.7376_MHz_XTAL PSX-based h/w, Sony ZN1-2-based */ 68'850'000, /* 68.85_MHz_XTAL Wyse WY-50 */ diff --git a/src/lib/netlist/analog/nld_generic_models.h b/src/lib/netlist/analog/nld_generic_models.h index a5d035ed32b..fac8bcb9a6d 100644 --- a/src/lib/netlist/analog/nld_generic_models.h +++ b/src/lib/netlist/analog/nld_generic_models.h @@ -153,16 +153,19 @@ namespace analog void update_diode(nl_fptype nVd) noexcept { - nl_fptype IseVDVt(nlconst::zero()); - if (TYPE == diode_e::BIPOLAR) { //printf("%s: %g %g\n", m_name.c_str(), nVd, (nl_fptype) m_Vd); if (nVd > m_Vcrit) { - const nl_fptype d = std::min(+fp_constants<nl_fptype>::DIODE_MAXDIFF(), nVd - m_Vd); + // if the old voltage is less than zero and new is above + // make sure we move enough so that matrix and current + // changes. + const nl_fptype old = std::max(nlconst::zero(), m_Vd()); + const nl_fptype d = std::min(+fp_constants<nl_fptype>::DIODE_MAXDIFF(), nVd - old); const nl_fptype a = plib::abs(d) * m_VtInv; - m_Vd = m_Vd + nlconst::magic(d < 0 ? -1.0 : 1.0) * plib::log1p(a) * m_Vt; + m_Vd = old + nlconst::magic(d < 0 ? -1.0 : 1.0) * plib::log1p(a) * m_Vt; + //printf("new VD: %g\n", (nl_fptype)m_Vd); } else m_Vd = std::max(-fp_constants<nl_fptype>::DIODE_MAXDIFF(), nVd); @@ -175,7 +178,7 @@ namespace analog } else { - IseVDVt = plib::exp(m_logIs + m_Vd * m_VtInv); + const auto IseVDVt = plib::exp(m_logIs + m_Vd * m_VtInv); m_Id = IseVDVt - m_Is; m_G = IseVDVt * m_VtInv + m_gmin; } @@ -191,7 +194,7 @@ namespace analog else // log stepping should already be done in mosfet { m_Vd = nVd; - IseVDVt = plib::exp(std::min(+fp_constants<nl_fptype>::DIODE_MAXVOLT(), m_logIs + m_Vd * m_VtInv)); + const auto IseVDVt = plib::exp(std::min(+fp_constants<nl_fptype>::DIODE_MAXVOLT(), m_logIs + m_Vd * m_VtInv)); m_Id = IseVDVt - m_Is; m_G = IseVDVt * m_VtInv + m_gmin; } diff --git a/src/lib/netlist/devices/nld_7493.cpp b/src/lib/netlist/devices/nld_7493.cpp index 855bd8a3770..48c2b179073 100644 --- a/src/lib/netlist/devices/nld_7493.cpp +++ b/src/lib/netlist/devices/nld_7493.cpp @@ -131,7 +131,7 @@ namespace netlist NETLIB_HANDLERI(updB) { - auto cnt = (++m_bcd &= 0x07); + const auto cnt(++m_bcd &= 0x07); m_QD.push((cnt >> 2) & 1, out_delay3); m_QC.push((cnt >> 1) & 1, out_delay2); m_QB.push(cnt & 1, out_delay); diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index 625696ddf93..d2ec68800bf 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -569,17 +569,24 @@ namespace netlist public plib::linkedlist_t<core_terminal_t>::element_t { public: + /// \brief Number of signal bits + /// + /// Going forward setting this to 8 will allow 8-bit signal + /// busses to be used in netlist, e.g. for more complex memory + /// arrangements. + static constexpr const unsigned int INP_BITS = 1; + static constexpr const unsigned int INP_MASK = (1 << INP_BITS) - 1; static constexpr const unsigned int INP_HL_SHIFT = 0; - static constexpr const unsigned int INP_LH_SHIFT = 1; + static constexpr const unsigned int INP_LH_SHIFT = INP_BITS; enum state_e { STATE_INP_PASSIVE = 0, - STATE_INP_HL = (1 << INP_HL_SHIFT), - STATE_INP_LH = (1 << INP_LH_SHIFT), + STATE_INP_HL = (INP_MASK << INP_HL_SHIFT), + STATE_INP_LH = (INP_MASK << INP_LH_SHIFT), STATE_INP_ACTIVE = STATE_INP_HL | STATE_INP_LH, - STATE_OUT = 128, - STATE_BIDIR = 256 + STATE_OUT = (1 << (2*INP_BITS)), + STATE_BIDIR = (1 << (2*INP_BITS + 1)) }; core_terminal_t(core_device_t &dev, const pstring &aname, @@ -590,12 +597,11 @@ namespace netlist /// \brief The object type. /// \returns type of the object - terminal_type type() const noexcept(false); + /// \brief Checks if object is of specified type. /// \param atype type to check object against. /// \returns true if object is of specified type else false. - bool is_type(const terminal_type atype) const noexcept(false) { return (type() == atype); } void set_net(net_t *anet) noexcept { m_net = anet; } @@ -632,7 +638,7 @@ namespace netlist void set_delegate(const nldelegate &delegate) noexcept { m_delegate = delegate; } nldelegate &delegate() noexcept { return m_delegate; } const nldelegate &delegate() const noexcept { return m_delegate; } - void run_delegate() noexcept { m_delegate(); } + inline void run_delegate() noexcept { m_delegate(); } private: nldelegate m_delegate; net_t * m_net; @@ -762,7 +768,7 @@ namespace netlist private: state_var<netlist_sig_t> m_new_Q; state_var<netlist_sig_t> m_cur_Q; - state_var<queue_status> m_in_queue; // 0: not in queue, 1: in queue, 2: last was taken + state_var<queue_status> m_in_queue; state_var<netlist_time_ext> m_next_scheduled_time; core_terminal_t * m_railterminal; @@ -1858,7 +1864,7 @@ namespace netlist { m_next_scheduled_time = exec().time() + delay; - if (is_queued()) + if (!!is_queued()) exec().qremove(this); if (!m_list_active.empty()) @@ -2028,7 +2034,7 @@ namespace netlist // ----------------------------------------------------------------------------- template <bool KEEP_STATS, typename T> - inline void detail::net_t::process(const T mask, netlist_sig_t sig) noexcept + inline void detail::net_t::process(T mask, netlist_sig_t sig) noexcept { m_cur_Q = sig; diff --git a/src/lib/netlist/nl_config.h b/src/lib/netlist/nl_config.h index 47707af7d22..0fc82ae4f79 100644 --- a/src/lib/netlist/nl_config.h +++ b/src/lib/netlist/nl_config.h @@ -17,11 +17,11 @@ /// /// \brief Version - Minor. /// -#define NL_VERSION_MINOR 5 +#define NL_VERSION_MINOR 7 /// /// \brief Version - Patch level. /// -#define NL_VERSION_PATCHLEVEL 0 +#define NL_VERSION_PATCHLEVEL 1 /// /// \addtogroup compiledefine @@ -61,7 +61,7 @@ /// This approach is stricter and should identify bugs in /// the netlist core faster. /// By default it is disabled since it is not as fast as -/// the default approach. It is up to 10% slower. +/// the default approach. It is up to 20% slower. /// #ifndef NL_USE_COPY_INSTEAD_OF_REFERENCE @@ -135,19 +135,30 @@ /// \brief Resolution as clocks per second for timing /// -/// Uses nano-second resolution - Sufficient for now +/// Uses 100 pico second resolution. This is aligned to MAME's +/// attotime resolution. +/// +/// The table below shows the maximum run times depending on +/// time type size and resolution. +/// +/// | Bits | Res | Seconds | Days | Years | +/// | ====-| ===-| =======-| ====-| =====-| +/// | 63 | 1,000,000,000 | 9,223,372,037 | 106,752| 292.3 | +/// | 63 | 10,000,000,000 | 922,337,204 | 10,675| 29.2 | +/// | 63 | 100,000,000,000 | 92,233,720 | 1,068| 2.9 | +/// | 63 | 1,000,000,000,000 | 9,223,372 | 107| 0.3 | +/// -#if 1 -static constexpr const auto NETLIST_INTERNAL_RES = 1'000'000'000; -static constexpr const auto NETLIST_CLOCK = NETLIST_INTERNAL_RES; -#else -//static constexpr const auto NETLIST_INTERNAL_RES = (1<<30); // 1,073,741,824 -//static constexpr const std::int64_t NETLIST_INTERNAL_RES = (static_cast<std::int64_t>(1)<<33); // 8,589,934,592 -static constexpr const std::int64_t NETLIST_INTERNAL_RES = (static_cast<std::int64_t>(1)<<37); // 137,438,953,472 -// FIXME: Belongs into MAME netlist.h -static constexpr const std::int32_t NETLIST_CLOCK = (static_cast<std::int64_t>(1)<<30); // 1,073,741,824 -#endif +static constexpr const auto NETLIST_INTERNAL_RES = 10'000'000'000ll; + +/// \brief Recommended clock to be used +/// +/// This is the recommended clock to be used in fixed clock applications limited +/// to 32 bit clock resolution. The MAME code (netlist.cpp) contains code +/// illustrating how to deal with remainders if \ref NETLIST_INTERNAL_RES is +/// bigger than NETLIST_CLOCK. +static constexpr const int NETLIST_CLOCK = 1'000'000'000; /// \brief Floating point types used /// diff --git a/src/lib/netlist/nltypes.h b/src/lib/netlist/nltypes.h index 3688c41421d..ab106f9f59a 100644 --- a/src/lib/netlist/nltypes.h +++ b/src/lib/netlist/nltypes.h @@ -106,8 +106,8 @@ namespace netlist #else using netlist_time = plib::ptime<std::int64_t, NETLIST_INTERNAL_RES>; using netlist_time_ext = netlist_time; - static_assert(noexcept(netlist_time::from_nsec(1)) == true, "Not evaluated as constexpr"); #endif + static_assert(noexcept(netlist_time::from_nsec(1)) == true, "Not evaluated as constexpr"); //============================================================ // MACROS diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h index 5262d0c569d..1aa23682ca6 100644 --- a/src/lib/netlist/plib/palloc.h +++ b/src/lib/netlist/plib/palloc.h @@ -11,6 +11,7 @@ #include "pconfig.h" #include "pstring.h" #include "ptypes.h" +#include "pmath.h" #include <cstddef> // for std::max_align_t (usually long long) #include <memory> @@ -281,6 +282,9 @@ namespace plib { static inline void *allocate( size_t alignment, size_t size ) { + m_stat_cur_alloc() += size; + m_stat_max_alloc() = std::max(m_stat_max_alloc(), m_stat_cur_alloc()); + #if (PUSE_ALIGNED_ALLOCATION) #if defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER) return _aligned_malloc(size, alignment); @@ -301,7 +305,8 @@ namespace plib { static inline void deallocate( void *ptr, size_t size ) noexcept { - unused_var(size); + //unused_var(size); + m_stat_cur_alloc() -= size; #if (PUSE_ALIGNED_ALLOCATION) // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) free(ptr); @@ -342,12 +347,32 @@ namespace plib { } } + template<typename T, typename... Args> + static T *alloc(Args&&... args) + { + auto *p = allocate(alignof(T), sizeof(T)); + return new(p) T(std::forward<Args>(args)...); + } + + template<typename T> + static void free(T *ptr) noexcept + { + ptr->~T(); + aligned_arena::deallocate(ptr, sizeof(T)); + } + bool operator ==(const aligned_arena &rhs) const noexcept { plib::unused_var(rhs); return true; } + size_type cur_alloc() const noexcept { return m_stat_cur_alloc(); } + size_type max_alloc() const noexcept { return m_stat_max_alloc(); } + private: + static size_t &m_stat_cur_alloc() noexcept { static size_t val = 0; return val; } + static size_t &m_stat_max_alloc() noexcept { static size_t val = 0; return val; } + }; template <typename T, std::size_t ALIGN> @@ -377,29 +402,13 @@ namespace plib { #endif } - // FIXME: remove - template<typename T, typename... Args> - inline T *pnew(Args&&... args) - { - auto *p = aligned_arena::allocate(alignof(T), sizeof(T)); - return new(p) T(std::forward<Args>(args)...); - } - - template<typename T> - inline void pdelete(T *ptr) noexcept - { - ptr->~T(); - aligned_arena::deallocate(ptr, sizeof(T)); - } - - template <typename T> - using unique_ptr = std::unique_ptr<T, arena_deleter<aligned_arena, T>>; + using unique_ptr = aligned_arena::unique_pool_ptr<T>; template<typename T, typename... Args> plib::unique_ptr<T> make_unique(Args&&... args) { - return plib::unique_ptr<T>(pnew<T>(std::forward<Args>(args)...)); + return aligned_arena::instance().make_unique<T>(std::forward<Args>(args)...); } template <class T, std::size_t ALIGN = alignof(T)> diff --git a/src/lib/netlist/plib/pconfig.h b/src/lib/netlist/plib/pconfig.h index 0870d8c59d5..115eafd2196 100644 --- a/src/lib/netlist/plib/pconfig.h +++ b/src/lib/netlist/plib/pconfig.h @@ -25,7 +25,7 @@ /// \brief System supports INT128 /// /// Set this to one if you want to use 128 bit int for ptime. -/// This is about 15% slower on a kaby lake processor for pongf. +/// This is about 10% slower on a skylake processor for pongf. /// #ifndef PHAS_INT128 #define PHAS_INT128 (0) diff --git a/src/lib/netlist/plib/pmath.h b/src/lib/netlist/plib/pmath.h index 9738994770d..4fd928ddb54 100644 --- a/src/lib/netlist/plib/pmath.h +++ b/src/lib/netlist/plib/pmath.h @@ -9,6 +9,7 @@ /// #include "pconfig.h" +#include "ptypes.h" #include <algorithm> #include <cmath> @@ -329,6 +330,91 @@ namespace plib #endif + /// \brief is argument a power of two? + /// + /// \tparam T type of the argument + /// \param v argument to be checked + /// \return true if argument is a power of two + /// + template <typename T> + constexpr bool is_pow2(T v) noexcept + { + static_assert(is_integral<T>::value, "is_pow2 needs integer arguments"); + return !(v & (v-1)); + } + + /// \brief return absolute value of signed argument + /// + /// \tparam T type of the argument + /// \param v argument + /// \return absolute value of argument + /// + template<typename T> + constexpr + typename std::enable_if<std::is_integral<T>::value && std::is_signed<T>::value, T>::type + abs(T v) noexcept + { + return v < 0 ? -v : v; + } + + /// \brief return absolute value of unsigned argument + /// + /// \tparam T type of the argument + /// \param v argument + /// \return argument since it has no sign + /// + template<typename T> + constexpr + typename std::enable_if<std::is_integral<T>::value && std::is_unsigned<T>::value, T>::type + abs(T v) noexcept + { + return v; + } + + /// \brief return greatest common denominator + /// + /// Function returns the greatest common denominator of m and n. For known + /// arguments, this function also works at compile time. + /// + /// \tparam M type of the first argument + /// \tparam N type of the second argument + /// \param m first argument + /// \param n first argument + /// \return greatest common denominator of m and n + /// + template<typename M, typename N> + constexpr typename std::common_type<M, N>::type + gcd(M m, N n) noexcept + { + static_assert(std::is_integral<M>::value, "gcd: M must be an integer"); + static_assert(std::is_integral<N>::value, "gcd: N must be an integer"); + + return m == 0 ? plib::abs(n) + : n == 0 ? plib::abs(m) + : gcd(n, m % n); + } + + /// \brief return least common multiple + /// + /// Function returns the least common multiple of m and n. For known + /// arguments, this function also works at compile time. + /// + /// \tparam M type of the first argument + /// \tparam N type of the second argument + /// \param m first argument + /// \param n first argument + /// \return least common multiple of m and n + /// + template<typename M, typename N> + constexpr typename std::common_type<M, N>::type + lcm(M m, N n) noexcept + { + static_assert(std::is_integral<M>::value, "lcm: M must be an integer"); + static_assert(std::is_integral<N>::value, "lcm: N must be an integer"); + + return (m != 0 && n != 0) ? (plib::abs(m) / gcd(m, n)) * plib::abs(n) : 0; + } + static_assert(noexcept(constants<double>::one()) == true, "Not evaluated as constexpr"); } // namespace plib diff --git a/src/lib/netlist/plib/pmempool.h b/src/lib/netlist/plib/pmempool.h index 1e197fdfc82..a06c67acd8e 100644 --- a/src/lib/netlist/plib/pmempool.h +++ b/src/lib/netlist/plib/pmempool.h @@ -59,7 +59,7 @@ namespace plib { plib::perrlogger("Found {} info blocks\n", sinfo().size()); plib::perrlogger("Found block with {} dangling allocations\n", b->m_num_alloc); } - plib::pdelete(b); + aligned_arena::free(b); //::operator delete(b->m_data); } } @@ -126,7 +126,7 @@ namespace plib { plib::terminate("mempool::free - block not found"); mp.m_blocks.erase(itb); - plib::pdelete(b); + aligned_arena::free(b); } sinfo().erase(it); } @@ -222,15 +222,13 @@ namespace plib { size_type m_pos; }; - block * new_block(size_type min_bytes) { - auto *b = plib::pnew<block>(*this, min_bytes); + auto *b = aligned_arena::alloc<block>(*this, min_bytes); m_blocks.push_back(b); return b; } - static std::unordered_map<void *, info> &sinfo() { static std::unordered_map<void *, info> spinfo; diff --git a/src/lib/netlist/plib/ppmf.h b/src/lib/netlist/plib/ppmf.h index bbbe95ded05..a9df2f6b4aa 100644 --- a/src/lib/netlist/plib/ppmf.h +++ b/src/lib/netlist/plib/ppmf.h @@ -273,7 +273,7 @@ namespace plib { #endif } template<typename O> - R call(O *obj, Targs... args) const noexcept(true) + R call(O *obj, Targs&&... args) const noexcept(true) { using function_ptr = MEMBER_ABI R (*)(O *obj, Targs... args); return (reinterpret_cast<function_ptr>(m_func))(obj, std::forward<Targs>(args)...); @@ -311,7 +311,7 @@ namespace plib { m_obj = reinterpret_cast<generic_class *>(object); } - inline R operator()(Targs ... args) const noexcept(true) + inline R operator()(Targs... args) const noexcept(true) { return this->call(m_obj, std::forward<Targs>(args)...); } diff --git a/src/lib/netlist/plib/ptime.h b/src/lib/netlist/plib/ptime.h index df0bac92477..82ee2213015 100644 --- a/src/lib/netlist/plib/ptime.h +++ b/src/lib/netlist/plib/ptime.h @@ -80,32 +80,41 @@ namespace plib m_time -= rhs.m_time; return *this; } - C14CONSTEXPR ptime &operator*=(const mult_type factor) noexcept { m_time *= static_cast<internal_type>(factor); return *this; } + + template <typename M> + C14CONSTEXPR ptime &operator*=(const M factor) noexcept + { + static_assert(plib::is_integral<M>::value, "Factor must be an integral type"); + m_time *= factor; + return *this; + } template <typename O> - friend constexpr const ptime operator-(const ptime &lhs, const ptime<O, RES> &rhs) noexcept + constexpr const ptime operator-(const ptime<O, RES> &rhs) const noexcept { static_assert(ptime_le<ptime<O, RES>, ptime>::value, "Invalid ptime type"); - return ptime(lhs.m_time - rhs.m_time); + return ptime(m_time - rhs.m_time); } template <typename O> - friend constexpr const ptime operator+(const ptime &lhs, const ptime<O, RES> &rhs) noexcept + constexpr const ptime operator+(const ptime<O, RES> &rhs) const noexcept { static_assert(ptime_le<ptime<O, RES>, ptime>::value, "Invalid ptime type"); - return ptime(lhs.m_time + rhs.m_time); + return ptime(m_time + rhs.m_time); } - friend constexpr const ptime operator*(ptime lhs, const mult_type factor) noexcept + template <typename M> + constexpr const ptime operator*(const M &factor) const noexcept { - return ptime(lhs.m_time * factor); + static_assert(plib::is_integral<M>::value, "Factor must be an integral type"); + return ptime(m_time * static_cast<mult_type>(factor)); } template <typename O> - friend constexpr mult_type operator/(const ptime lhs, const ptime<O, RES> rhs) noexcept + constexpr const mult_type operator/(const ptime<O, RES> &rhs) const noexcept { static_assert(ptime_le<ptime<O, RES>, ptime>::value, "Invalid ptime type"); - return static_cast<mult_type>(lhs.m_time / rhs.m_time); + return static_cast<mult_type>(m_time / rhs.m_time); } friend constexpr bool operator<(const ptime lhs, const ptime rhs) noexcept @@ -159,6 +168,10 @@ namespace plib constexpr double as_float() const noexcept { return as_fp<float>(); } constexpr double as_long_double() const noexcept { return as_fp<long double>(); } + + constexpr ptime shl(unsigned shift) const noexcept { return ptime(m_time << shift); } + constexpr ptime shr(unsigned shift) const noexcept { return ptime(m_time >> shift); } + // for save states .... C14CONSTEXPR internal_type *get_internaltype_ptr() noexcept { return &m_time; } @@ -202,7 +215,6 @@ namespace plib internal_type m_time; }; - } // namespace plib diff --git a/src/lib/netlist/plib/ptypes.h b/src/lib/netlist/plib/ptypes.h index 7619faa1348..32ec6e7f9bf 100644 --- a/src/lib/netlist/plib/ptypes.h +++ b/src/lib/netlist/plib/ptypes.h @@ -82,58 +82,6 @@ namespace plib template<typename... Ts> inline void unused_var(Ts&&...) noexcept {} - //============================================================ - // is_pow2 - //============================================================ - template <typename T> - constexpr bool is_pow2(T v) noexcept - { - static_assert(is_integral<T>::value, "is_pow2 needs integer arguments"); - return !(v & (v-1)); - } - - //============================================================ - // abs, lcd, gcm - //============================================================ - - template<typename T> - constexpr - typename std::enable_if<std::is_integral<T>::value && std::is_signed<T>::value, T>::type - abs(T v) noexcept - { - return v < 0 ? -v : v; - } - - template<typename T> - constexpr - typename std::enable_if<std::is_integral<T>::value && std::is_unsigned<T>::value, T>::type - abs(T v) noexcept - { - return v; - } - - template<typename M, typename N> - constexpr typename std::common_type<M, N>::type - gcd(M m, N n) noexcept - { - static_assert(std::is_integral<M>::value, "gcd: M must be an integer"); - static_assert(std::is_integral<N>::value, "gcd: N must be an integer"); - - return m == 0 ? plib::abs(n) - : n == 0 ? plib::abs(m) - : gcd(n, m % n); - } - - template<typename M, typename N> - constexpr typename std::common_type<M, N>::type - lcm(M m, N n) noexcept - { - static_assert(std::is_integral<M>::value, "lcm: M must be an integer"); - static_assert(std::is_integral<N>::value, "lcm: N must be an integer"); - - return (m != 0 && n != 0) ? (plib::abs(m) / gcd(m, n)) * plib::abs(n) : 0; - } - } // namespace plib //============================================================ diff --git a/src/mame/arcade.flt b/src/mame/arcade.flt index cd1ed0ca95a..1ac8c2db214 100644 --- a/src/mame/arcade.flt +++ b/src/mame/arcade.flt @@ -1268,6 +1268,7 @@ tattack.cpp taxidriv.cpp tbowl.cpp tceptor.cpp +teamjocs.cpp techno.cpp tecmo.cpp tecmo16.cpp diff --git a/src/mame/drivers/actions_atj2279b.cpp b/src/mame/drivers/actions_atj2279b.cpp new file mode 100644 index 00000000000..8c6fd8eb87a --- /dev/null +++ b/src/mame/drivers/actions_atj2279b.cpp @@ -0,0 +1,98 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/****************************************************************************** + + System is fairly barebones + Main PCB has the SoC, RAM, ROM + connects to other PCBs with various types of slots (USB, SD etc.) + (ADD FULL DETAILS) + + TODO: everything - emulate the SoC + + Presumably has an internal bootstrap (at least) to boot from the NAND + + -- + + reviews for this device were less than favourable with many comments + about how the SNES and Arcade games often did not run at full speed + and how the overall quality of emulation was unremarkable + +*******************************************************************************/ + +#include "emu.h" + +#include "cpu/arm7/arm7.h" + +#include "speaker.h" +#include "screen.h" + + +class actions_atj2279b_state : public driver_device +{ +public: + actions_atj2279b_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "arm7") + { } + + void actions_atj2279b(machine_config &config); + +private: + virtual void machine_start() override; + virtual void machine_reset() override; + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + + void atj2279b_map(address_map &map); + + required_device<arm7_cpu_device> m_maincpu; +}; + +void actions_atj2279b_state::atj2279b_map(address_map &map) +{ +} + +void actions_atj2279b_state::machine_start() +{ +} + +void actions_atj2279b_state::machine_reset() +{ +} + +static INPUT_PORTS_START( actions_atj2279b ) +INPUT_PORTS_END + + +uint32_t actions_atj2279b_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + +void actions_atj2279b_state::actions_atj2279b(machine_config &config) +{ + ARM7_BE(config, m_maincpu, 100'000'000); // unknown ARM type in SoC (are there any documents?) probably much newer than this + m_maincpu->set_addrmap(AS_PROGRAM, &actions_atj2279b_state::atj2279b_map); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + screen.set_size(640, 480); + screen.set_visarea(0, 640-1, 0, 480-1); + screen.set_screen_update(FUNC(actions_atj2279b_state::screen_update)); + + SPEAKER(config, "lspeaker").front_left(); + SPEAKER(config, "rspeaker").front_right(); +} + +ROM_START( rbitgen ) + ROM_REGION32_BE( 0x21000000, "nand", 0 ) // NAND dump + //TOSHIBA + // TC58NVG2S3?A00 (there is a yellow stripe on the label before A00 obscuring the text) + ROM_LOAD16_WORD_SWAP( "nand.bin", 0x000000, 0x21000000, CRC(92576add) SHA1(1fe61ef1d2dd24e5b5d48c477846ef0c83ec6568) ) +ROM_END + + +// year, name, parent, compat, machine, input, class, init, company, fullname, flags +CONS( 2016, rbitgen, 0, 0, actions_atj2279b, actions_atj2279b, actions_atj2279b_state, empty_init, "Retro-Bit", "Generations (Retro-Bit)", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/atarittl.cpp b/src/mame/drivers/atarittl.cpp index dfe252d9be8..23258bcec78 100644 --- a/src/mame/drivers/atarittl.cpp +++ b/src/mame/drivers/atarittl.cpp @@ -93,8 +93,8 @@ #define HRES_MULT (1) // end -#define SC_VIDCLOCK (14318181/2) -#define SC_HTOTAL (0x1C8+1) // 456 +#define SC_VIDCLOCK (14318000/2) +#define SC_HTOTAL (0x1C8+0) // 456 #define SC_VTOTAL (0x103+1) // 259 #define SC_HBSTART (SC_HTOTAL) #define SC_HBEND (32) @@ -138,34 +138,10 @@ public: stuntcyc_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") - //, m_video(*this, "fixfreq") - , m_probe_screen(*this, "screen") - , m_probe_bit0(0.0) - , m_probe_bit1(0.0) - , m_probe_bit2(0.0) - , m_probe_bit3(0.0) - , m_probe_bit4(0.0) - , m_probe_bit5(0.0) - , m_probe_bit6(0.0) - , m_probe_data(nullptr) - , m_last_beam(0.0) - , m_last_hpos(0) - , m_last_vpos(0) - , m_last_fraction(0.0) + , m_video(*this, "fixfreq") { } - NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit0_cb); - NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit1_cb); - NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit2_cb); - NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit3_cb); - NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit4_cb); - NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit5_cb); - NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit6_cb); - NETDEV_LOGIC_CALLBACK_MEMBER(probe_clock_cb); - - uint32_t screen_update_stuntcyc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void stuntcyc(machine_config &config); protected: @@ -175,23 +151,7 @@ protected: private: required_device<netlist_mame_device> m_maincpu; - //required_device<fixedfreq_device> m_video; - required_device<screen_device> m_probe_screen; - - int m_probe_bit0; - int m_probe_bit1; - int m_probe_bit2; - int m_probe_bit3; - int m_probe_bit4; - int m_probe_bit5; - int m_probe_bit6; - - std::unique_ptr<int[]> m_probe_data; - - int m_last_beam; - int m_last_hpos; - int m_last_vpos; - double m_last_fraction; + required_device<fixedfreq_device> m_video; }; class gtrak10_state : public driver_device @@ -236,93 +196,10 @@ void atarikee_state::video_start() void stuntcyc_state::machine_start() { - save_item(NAME(m_probe_bit0)); - save_item(NAME(m_probe_bit1)); - save_item(NAME(m_probe_bit2)); - save_item(NAME(m_probe_bit3)); - save_item(NAME(m_probe_bit4)); - save_item(NAME(m_probe_bit5)); - save_item(NAME(m_probe_bit6)); - save_item(NAME(m_last_beam)); - save_item(NAME(m_last_hpos)); - save_item(NAME(m_last_vpos)); - save_item(NAME(m_last_fraction)); - - m_probe_bit0 = 0; - m_probe_bit1 = 0; - m_probe_bit2 = 0; - m_probe_bit3 = 0; - m_probe_bit4 = 0; - m_probe_bit5 = 0; - m_probe_bit6 = 0; - - m_probe_data = std::make_unique<int[]>(SC_HTOTAL * SC_VTOTAL); } void stuntcyc_state::machine_reset() { - m_probe_bit0 = 0; - m_probe_bit1 = 0; - m_probe_bit2 = 0; - m_probe_bit3 = 0; - m_probe_bit4 = 0; - m_probe_bit5 = 0; - m_probe_bit6 = 0; -} - -NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit0_cb) { m_probe_bit0 = data; } -NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit1_cb) { m_probe_bit1 = data; } -NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit2_cb) { m_probe_bit2 = data; } -NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit3_cb) { m_probe_bit3 = data; } -NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit4_cb) { m_probe_bit4 = data; } -NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit5_cb) { m_probe_bit5 = data; } -NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit6_cb) { m_probe_bit6 = data; } -NETDEV_LOGIC_CALLBACK_MEMBER(stuntcyc_state::probe_clock_cb) -{ - synchronize(); - attotime second_fraction(0, time.attoseconds()); - attotime frame_fraction(0, (second_fraction * 60).attoseconds()); - attotime pixel_time = frame_fraction * (SC_HTOTAL * SC_VTOTAL); - int32_t pixel_index = (frame_fraction * (SC_HTOTAL * SC_VTOTAL)).seconds(); - double pixel_fraction = ATTOSECONDS_TO_DOUBLE(pixel_time.attoseconds()); - - const int hpos = pixel_index % SC_HTOTAL;//m_screen->hpos(); - const int vpos = pixel_index / SC_HTOTAL;//m_screen->vpos(); - const int curr_index = vpos * SC_HTOTAL + hpos; - - int last_index = m_last_vpos * SC_HTOTAL + m_last_hpos; - if (last_index != curr_index) - { - m_probe_data[last_index] = int(double(m_probe_data[last_index]) * m_last_fraction); - m_probe_data[last_index] += int(double(m_last_beam) * (1.0 - m_last_fraction)); - last_index++; - while (last_index <= curr_index) - m_probe_data[last_index++] = m_last_beam; - } - - //m_last_beam = float(data); - m_last_beam = m_probe_bit0 + m_probe_bit1 * 2 + m_probe_bit2 * 4 + m_probe_bit3 * 8 + m_probe_bit4 * 16 + m_probe_bit5 * 32 + m_probe_bit6 * 64; - m_last_hpos = hpos; - m_last_vpos = vpos; - m_last_fraction = pixel_fraction; -} - -uint32_t stuntcyc_state::screen_update_stuntcyc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - m_last_hpos = 0; - m_last_vpos = 0; - - uint32_t pixindex = 0; - for (int y = 0; y < SC_VTOTAL; y++) - { - uint32_t *scanline = &bitmap.pix32(y); - pixindex = y * SC_HTOTAL; - for (int x = 0; x < SC_HTOTAL; x++) - *scanline++ = 0xff000000 | (m_probe_data[pixindex++] * 0x010101); - //*scanline++ = 0xff000000 | (uint8_t(m_screen_buf[pixindex++] * 63.0) * 0x010101); - } - - return 0; } void atarikee_state::atarikee(machine_config &config) @@ -347,26 +224,18 @@ void stuntcyc_state::stuntcyc(machine_config &config) { /* basic machine hardware */ NETLIST_CPU(config, m_maincpu, STUNTCYC_NL_CLOCK).set_source(netlist_stuntcyc); + NETLIST_ANALOG_OUTPUT(config, "maincpu:vid0", 0).set_params("VIDEO_OUT", "fixfreq", FUNC(fixedfreq_device::update_composite_monochrome)); - NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit0", 0).set_params("probe_bit0", FUNC(stuntcyc_state::probe_bit0_cb)); - NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit1", 0).set_params("probe_bit1", FUNC(stuntcyc_state::probe_bit1_cb)); - NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit2", 0).set_params("probe_bit2", FUNC(stuntcyc_state::probe_bit2_cb)); - NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit3", 0).set_params("probe_bit3", FUNC(stuntcyc_state::probe_bit3_cb)); - NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit4", 0).set_params("probe_bit4", FUNC(stuntcyc_state::probe_bit4_cb)); - NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit5", 0).set_params("probe_bit5", FUNC(stuntcyc_state::probe_bit5_cb)); - NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit6", 0).set_params("probe_bit6", FUNC(stuntcyc_state::probe_bit6_cb)); - NETLIST_LOGIC_OUTPUT(config, "maincpu:probe_clock", 0).set_params("probe_clock", FUNC(stuntcyc_state::probe_clock_cb)); - -/* video hardware */ - SCREEN(config, m_probe_screen, SCREEN_TYPE_RASTER); - m_probe_screen->set_screen_update(FUNC(stuntcyc_state::screen_update_stuntcyc)); - m_probe_screen->set_raw(SC_HTOTAL*SC_VTOTAL*60, SC_HTOTAL, 0, SC_HTOTAL, SC_VTOTAL, 0, SC_VTOTAL); - //FIXFREQ(config, m_video).set_screen("screen"); - //m_video->set_monitor_clock(SC_VIDCLOCK); - //m_video->set_horz_params(SC_HTOTAL-67,SC_HTOTAL-40,SC_HTOTAL-8, SC_HTOTAL); - //m_video->set_vert_params(SC_VTOTAL-22,SC_VTOTAL-19,SC_VTOTAL-12,SC_VTOTAL); - //m_video->set_fieldcount(1); - //m_video->set_threshold(0.30); + /* video hardware */ + SCREEN(config, "screen", SCREEN_TYPE_RASTER); + FIXFREQ(config, m_video).set_screen("screen"); + m_video->set_monitor_clock(SC_VIDCLOCK); + m_video->set_horz_params(SC_HTOTAL-84,SC_HTOTAL-64,SC_HTOTAL-16, SC_HTOTAL); + m_video->set_vert_params(SC_VTOTAL-21,SC_VTOTAL-17,SC_VTOTAL-12, SC_VTOTAL); + m_video->set_fieldcount(1); + m_video->set_threshold(0.89); + m_video->set_gain(0.2); + m_video->set_horz_scale(4); } void gtrak10_state::gtrak10(machine_config &config) diff --git a/src/mame/drivers/bagman.cpp b/src/mame/drivers/bagman.cpp index 6022a34ff25..2b3c339dc60 100644 --- a/src/mame/drivers/bagman.cpp +++ b/src/mame/drivers/bagman.cpp @@ -870,6 +870,45 @@ ROM_END ROM_START( sbagman ) ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "sb5v5.9e", 0x0000, 0x1000, CRC(b61029ea) SHA1(2166ca62eb1e237b56252b83d0199e58ec1c8dac) ) + ROM_LOAD( "sb6v4.9f", 0x1000, 0x1000, CRC(bb6a6883) SHA1(a65ac9aeac9c6c85bd4e7eca385d875def92b954) ) + ROM_LOAD( "sb7v4.9j", 0x2000, 0x1000, CRC(a62b6b77) SHA1(ae9cb9c148e293519e391cb88eed9d137d80ea57) ) + ROM_LOAD( "sb8v3.9k", 0x3000, 0x1000, CRC(b94fbb73) SHA1(5d676c5d1d864d70d98f0137c4072062a781b3a0) ) + ROM_LOAD( "sb9v3.9m", 0x4000, 0x1000, CRC(601f34ba) SHA1(1b7ee61a341b9a87abe4fe10b0c647a9b0b97d38) ) + ROM_LOAD( "sb10v3.9n", 0x5000, 0x1000, CRC(5f750918) SHA1(3dc44f259e88999dbb95b4d4376281cc81c1ab87) ) + ROM_LOAD( "sb13v5.8d", 0xc000, 0x0e00, CRC(e0e920f6) SHA1(fbdb36e2d3f4c8dd1f27b3f39a4c025fa47df234) ) + ROM_CONTINUE( 0xfe00, 0x0200 ) + ROM_LOAD( "sb14v3.8f", 0xd000, 0x0400, CRC(83b10139) SHA1(8a1880c6ab8a345676fe30465351d69cc1b416b2) ) + ROM_CONTINUE( 0xe400, 0x0200 ) + ROM_CONTINUE( 0xd600, 0x0a00 ) + ROM_LOAD( "sb15v3.8j", 0xe000, 0x0400, CRC(fe924879) SHA1(b80cbf9cba91e553f7685aef348854c02f0619c7) ) + ROM_CONTINUE( 0xd400, 0x0200 ) + ROM_CONTINUE( 0xe600, 0x0a00 ) + ROM_LOAD( "sb16v3.8k", 0xf000, 0x0e00, CRC(b77eb1f5) SHA1(ef94c1b449e3fa230491052fc3bd4db3f1239263) ) + ROM_CONTINUE( 0xce00, 0x0200 ) + + ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_LOAD( "sb2v3.1e", 0x0000, 0x1000, CRC(f4d3d4e6) SHA1(167ad0259578966fe86384df844e69cf2cc77443) ) + ROM_LOAD( "sb4v3.1j", 0x1000, 0x1000, CRC(2c6a510d) SHA1(304064f11e80f4ec471174823b8aaf59844061ac) ) + + ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_LOAD( "sb1v3.1c", 0x0000, 0x1000, CRC(a046ff44) SHA1(af319cfb74e5efe435c26e971de13bd390f4b378) ) + ROM_LOAD( "sb3v3.1f", 0x1000, 0x1000, CRC(a4422da4) SHA1(3aa55ca8c99566c1c9eb097b6d645c4216e09dfb) ) + + ROM_REGION( 0x0040, "proms", 0 ) // not dumped for this set + ROM_LOAD( "p3.bin", 0x0000, 0x0020, BAD_DUMP CRC(2a855523) SHA1(91e032233fee397c90b7c1662934aca9e0671482) ) + ROM_LOAD( "r3.bin", 0x0020, 0x0020, BAD_DUMP CRC(ae6f1019) SHA1(fd711882b670380cb4bd909c840ba06277b8fbe3) ) + + ROM_REGION( 0x0020, "5110ctrl", 0) // not dumped for this set + ROM_LOAD( "r6.bin", 0x0000, 0x0020, BAD_DUMP CRC(c58a4f6a) SHA1(35ef244b3e94032df2610aa594ea5670b91e1449) ) /*state machine driving TMS5110*/ + + ROM_REGION( 0x2000, "tmsprom", 0 ) /* data for the TMS5110 speech chip */ + ROM_LOAD( "b11v3.9r", 0x0000, 0x1000, CRC(2e0057ff) SHA1(33e3ffa6418f86864eb81e5e9bda4bf540c143a6) ) + ROM_LOAD( "b12v3.9t", 0x1000, 0x1000, CRC(b2120edd) SHA1(52b89dbcc749b084331fa82b13d0876e911fce52) ) +ROM_END + +ROM_START( sbagman2 ) + ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "5.9e", 0x0000, 0x1000, CRC(1b1d6b0a) SHA1(549161f6adc88fa16339815e05af33ca57815660) ) ROM_LOAD( "6.9f", 0x1000, 0x1000, CRC(ac49cb82) SHA1(5affa0c03bedf2c9d5368c7f075818e1760c12ae) ) ROM_LOAD( "7.9j", 0x2000, 0x1000, CRC(9a1c778d) SHA1(a655e25dc9efdf60cc5b34e42c93c4acaa4a7922) ) @@ -1121,7 +1160,8 @@ GAME( 1982, bagmans, bagman, bagman, bagmans, bagman_state, empty_init, GAME( 1982, bagmans2, bagman, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation (Stern Electronics license)", "Bagman (Stern Electronics, set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1982, bagmanj, bagman, bagman, bagman, bagman_state, empty_init, ROT270, "Valadon Automation (Taito license)", "Bagman (Taito)", MACHINE_SUPPORTS_SAVE ) // title screen actually doesn't mention Valadon, only Stern and Taito -GAME( 1984, sbagman, 0, sbagman, sbagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Super Bagman", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, sbagman, 0, sbagman, sbagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Super Bagman (version 5)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, sbagman2, sbagman, sbagman, sbagman, bagman_state, empty_init, ROT270, "Valadon Automation", "Super Bagman (version 3?)", MACHINE_SUPPORTS_SAVE ) GAME( 1984, sbagmani, sbagman, sbagmani, sbagman, bagman_state, empty_init, ROT90, "Valadon Automation (Itisa license)", "Super Bagman (Itisa, Spain)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // different color PROMs, needs correct decoding GAME( 1984, sbagmans, sbagman, sbagman, sbagman, bagman_state, empty_init, ROT270, "Valadon Automation (Stern Electronics license)", "Super Bagman (Stern Electronics)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/bandai_design_master.cpp b/src/mame/drivers/bandai_design_master.cpp new file mode 100644 index 00000000000..12e1ab87f23 --- /dev/null +++ b/src/mame/drivers/bandai_design_master.cpp @@ -0,0 +1,160 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood +/****************************************************************************************************************************** + + __________________________________IR___ + | ____ RX/TX | + | _____ ________ | | __ | + | | | | | | | | || + | |IC3 | | IC2 | | |CN2->_|| + | | | | | | | | + | |____| |_______| | | | + | ____ | | | + | | | CART SLOT->| | | + | |IC5| | | | + | |___| ________ | | | + | ____ | | | | | + | | | | IC1 | | | | + | |IC4| | | | | | + | |___| |_______| |___| | + | | + | SW2 | + |______________________________________| + + IC1 = Hitachi H8/328 (24K-byte internal ROM + 1K-byte RAM) + IC2 = Hitachi HG62G010R21FBN Gate Array (low gatecount and low I/O-count packages) + IC3 = Hitachi HM62256LFP-10T 256kbit CMOS SRAM + IC4 = BA10324AF Ground Sense Operational Amplifier + IC5 = Hitachi 74HC00 (5B2T HC00) + + + TODO: cartridge pinouts / information + + NOTE: cartridge dumps contain boot vectors so Internal ROM likely only used when no cartridge is present + +******************************************************************************************************************************/ + +#include "emu.h" +#include "cpu/h8/h83337.h" + +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + +#include "screen.h" +//#include "speaker.h" + +class bdsm_state : public driver_device +{ +public: + bdsm_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cartslot(*this, "cartslot"), + m_cartslot_region(nullptr), + m_bank(*this, "cartbank"), + m_screen(*this, "screen") + { } + + void bdesignm(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + void io_map(address_map &map); + void mem_map(address_map &map); + + DECLARE_READ16_MEMBER(io_p7_r); + DECLARE_WRITE16_MEMBER(io_p7_w); + + uint32_t screen_update(screen_device& screen, bitmap_rgb32& bitmap, const rectangle& cliprect); + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load_bdesignm); + + required_device<cpu_device> m_maincpu; + required_device<generic_slot_device> m_cartslot; + memory_region *m_cartslot_region; + required_memory_bank m_bank; + required_device<screen_device> m_screen; +}; + +void bdsm_state::machine_start() +{ + if (m_cartslot && m_cartslot->exists()) + { + std::string region_tag; + m_cartslot_region = memregion(region_tag.assign(m_cartslot->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + m_bank->configure_entries(0, (m_cartslot_region->bytes() / 0x8000), m_cartslot_region->base(), 0x8000); + m_bank->set_entry(0); // only the first bank seems to contain a valid reset vector '0x50' which points at the first code in the ROM. The other banks contain 0x5a00 as the reset vector. IRQ vector seems valid in all banks. + } +} + +DEVICE_IMAGE_LOAD_MEMBER(bdsm_state::cart_load_bdesignm) +{ + uint32_t size = m_cartslot->common_get_size("rom"); + + m_cartslot->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG); + m_cartslot->common_load_rom(m_cartslot->get_rom_base(), size, "rom"); + + return image_init_result::PASS; +} + +void bdsm_state::mem_map(address_map &map) +{ + map(0x0000, 0x7fff).bankr("cartbank"); + map(0x8000, 0x895f).ram().share("unkram"); +} + +READ16_MEMBER(bdsm_state::io_p7_r) +{ + return machine().rand(); +} + +WRITE16_MEMBER(bdsm_state::io_p7_w) +{ + logerror("%s: io_p7_w %04x %04x\n", machine().describe_context(), data, mem_mask); +} + + +void bdsm_state::io_map(address_map &map) +{ + map(h8_device::PORT_7, h8_device::PORT_7).rw(FUNC(bdsm_state::io_p7_r), FUNC(bdsm_state::io_p7_w)); +} + +static INPUT_PORTS_START( bdesignm ) +INPUT_PORTS_END + +uint32_t bdsm_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + +void bdsm_state::bdesignm(machine_config &config) +{ + /* basic machine hardware */ + H83334(config, m_maincpu, XTAL(20'000'000)); /* H8/328 (24kbytes internal ROM, 1kbyte internal ROM) ?Mhz */ + m_maincpu->set_addrmap(AS_PROGRAM, &bdsm_state::mem_map); + m_maincpu->set_addrmap(AS_IO, &bdsm_state::io_map); + + SCREEN(config, m_screen, SCREEN_TYPE_LCD); + m_screen->set_refresh_hz(60); + m_screen->set_size(160, 150); // resolution unknown + m_screen->set_visarea(0, 160-1, 0, 150-1); + m_screen->set_screen_update(FUNC(bdsm_state::screen_update)); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); + + GENERIC_CARTSLOT(config, m_cartslot, generic_linear_slot, "bdesignm_cart"); // TODO: this should be a custom bus type with capability to plug the 'design' carts into it + //m_cartslot->set_must_be_loaded(true); + + SOFTWARE_LIST(config, "cart_list_game").set_original("bdesignm_game_cart"); // Game carts, these appear to disable the Internal ROM + SOFTWARE_LIST(config, "cart_list_design").set_original("bdesignm_design_cart"); // You can also plug a design cart directly into the unit for use by the Internal ROM program (they contain no program) +} + +ROM_START( bdesignm ) + ROM_REGION16_BE(0x88000, "roms", ROMREGION_ERASE00) + ROM_LOAD( "h8_328.bin", 0x00000, 0x6000, NO_DUMP ) // internal rom (When the console is booted up without a cart it enters the default (builtin) art / drawing program, otherwise probably not used as carts contain boot vectors etc.) +ROM_END + + +CONS( 1995, bdesignm, 0, 0, bdesignm, bdesignm, bdsm_state, empty_init, "Bandai", "Design Master Denshi Mangajuku", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/bbl380.cpp b/src/mame/drivers/bbl380.cpp index f56bf1edb9e..3ada15a1487 100644 --- a/src/mame/drivers/bbl380.cpp +++ b/src/mame/drivers/bbl380.cpp @@ -24,9 +24,9 @@ public: void bbl380(machine_config &config); private: - void cs3_command_w(u8 data); - u8 cs3_data_r(); - void cs3_data_w(u8 data); + void lcdc_command_w(u8 data); + u8 lcdc_data_r(); + void lcdc_data_w(u8 data); virtual void machine_start() override; virtual void machine_reset() override; @@ -53,28 +53,28 @@ void bbl380_state::machine_reset() { } -void bbl380_state::cs3_command_w(u8 data) +void bbl380_state::lcdc_command_w(u8 data) { - logerror("%s: CS3 command $%02X\n", machine().describe_context(), data); + logerror("%s: LCDC command $%02X\n", machine().describe_context(), data); } -u8 bbl380_state::cs3_data_r() +u8 bbl380_state::lcdc_data_r() { if (!machine().side_effects_disabled()) - logerror("%s: CS3 data read\n", machine().describe_context()); + logerror("%s: LCDC data read\n", machine().describe_context()); return 0; } -void bbl380_state::cs3_data_w(u8 data) +void bbl380_state::lcdc_data_w(u8 data) { - logerror("%s: CS3 data $%02X\n", machine().describe_context(), data); + logerror("%s: LCDC data $%02X\n", machine().describe_context(), data); } void bbl380_state::bbl380_map(address_map &map) { map(0x000000, 0x3fffff).rom().region("maincpu", 0); // not correct - map(0x600000, 0x600000).w(FUNC(bbl380_state::cs3_command_w)); - map(0x604000, 0x604000).rw(FUNC(bbl380_state::cs3_data_r), FUNC(bbl380_state::cs3_data_w)); + map(0x600000, 0x600000).w(FUNC(bbl380_state::lcdc_command_w)); + map(0x604000, 0x604000).rw(FUNC(bbl380_state::lcdc_data_r), FUNC(bbl380_state::lcdc_data_w)); } static INPUT_PORTS_START( bbl380 ) @@ -85,15 +85,18 @@ void bbl380_state::bbl380(machine_config &config) ST2205U(config, m_maincpu, 8000000); // unknown clock; type guessed m_maincpu->set_addrmap(AS_DATA, &bbl380_state::bbl380_map); - SCREEN(config, m_screen, SCREEN_TYPE_LCD); // RGB LCD + SCREEN(config, m_screen, SCREEN_TYPE_LCD); // TFT color LCD m_screen->set_refresh_hz(60); m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); - m_screen->set_size(64*8, 32*8); - m_screen->set_visarea(0*8, 40*8-1, 0*8, 30*8-1); + m_screen->set_size(132, 162); + m_screen->set_visarea(0, 132-1, 0, 162-1); m_screen->set_screen_update(FUNC(bbl380_state::screen_update)); m_screen->set_palette(m_palette); PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x200); + + // LCD controller seems to be either Sitronix ST7735R or (if RDDID bytes match) Ilitek ILI9163C + // (unless the SoC's built-in one is used and the routines which program these are leftovers) } ROM_START( bbl380 ) diff --git a/src/mame/drivers/bfm_sc2.cpp b/src/mame/drivers/bfm_sc2.cpp index 404c53eb117..f976ba2cd75 100644 --- a/src/mame/drivers/bfm_sc2.cpp +++ b/src/mame/drivers/bfm_sc2.cpp @@ -7721,7 +7721,7 @@ GAMEL( 1996, sltblgpo, 0, scorpion2_vid, sltblgpo, bfm_sc2_vid_state, GAMEL( 1996, sltblgp1, sltblgpo, scorpion2_vid, sltblgpo, bfm_sc2_vid_state, init_sltsbelg, 0, "BFM/ELAM", "Slots (Belgian Cash, Game Card 95-752-008)", MACHINE_SUPPORTS_SAVE,layout_sltblgpo ) GAMEL( 1997, gldncrwn, 0, scorpion2_vid, gldncrwn, bfm_sc2_vid_state, init_gldncrwn, 0, "BFM/ELAM", "Golden Crown (Dutch, Game Card 95-752-011)", MACHINE_SUPPORTS_SAVE,layout_gldncrwn ) -GAMEL( 1997, gldncrwnhop, gldncrwn, scorpion2_vid, gldncrwn, bfm_sc2_vid_state, init_gldncrwn, 0, "BFM/ELAM", "Golden Crown Hopper (Dutch, Game Card)", MACHINE_SUPPORTS_SAVE,layout_gldncrwn ) +GAMEL( 1997, gldncrwnhop, gldncrwn, scorpion2_vid, gldncrwn, bfm_sc2_vid_state, init_gldncrwn, 0, "BFM/ELAM", "Golden Crown Hopper (Dutch, Game Card)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE,layout_gldncrwn ) // SUMCHECK 3 and SUMCHECK 4 errors /* Non-Video */ diff --git a/src/mame/drivers/cubo.cpp b/src/mame/drivers/cubo.cpp index 50cf4c71f52..75572b5c596 100644 --- a/src/mame/drivers/cubo.cpp +++ b/src/mame/drivers/cubo.cpp @@ -8,23 +8,26 @@ for JAMMA use. Known Games: - Title | rev. | year - ---------------------------------------------- - Candy Puzzle | 1.0 | 1995 - Double Strixx | | 1995 - Greyhound Race | | 199x - Harem Challenge | | 1995 - Laser Quiz | | 1995 - Laser Quiz France | 1.0 | 1995 - Laser Quiz Greece? | | 1995 *may exist - Laser Quiz 2 "Italy" | 1.0 | 1995 - Laser Strixx | | 1995 - Laser Strixx 2 | | 1995 - Lucky Five | | 1995 - Magic Number | | 1995 - Magic Premium | 1.1 | 1996 - Odeon Twister | | 199x - Odeon Twister 2 |202.19| 1999 + Dumped | Title | Rev. | Year | Notes + ---------------------------------------------------- + YES | Candy Puzzle | 1.0 | 1995 | + | Double Strixx | | 1995 | + YES | El Dorado | 4.2 | 199x | Laser Gate 2 + | Greyhound Race | | 199x | + YES | Harem Challenge | | 1995 | + | Laser Quiz | | 1995 | + | Laser Quiz France | 1.0 | 1995 | + | Laser Quiz Greece | | 1995 | May exist + YES | Laser Quiz Italy | | 1995 | + YES | Laser Quiz 2 Greece | | 1995 | + YES | Laser Quiz 2 Italy | 1.0 | 1995 | + | Laser Strixx | | 1995 | + YES | Laser Strixx 2 | | 1995 | + | Lucky Five | | 1995 | + YES | Magic Number | | 1995 | + YES | Magic Premium | 1.1| 1996 | + YES | Odeon Twister | 1.4| 199x | + YES | Odeon Twister 2 | 202.19| 1999 | ToDo: - remove the hack needed to make inputs working @@ -1139,13 +1142,20 @@ ROM_START( lsrquiz ) DISK_IMAGE_READONLY( "lsrquiz", 0, BAD_DUMP SHA1(41fb6cd0c9d36bd77e9c3db69d36801edc791e96) ) ROM_END -ROM_START( lsrquiz2 ) +ROM_START( lsrquiz2i ) CD32_BIOS DISK_REGION( "cdrom" ) DISK_IMAGE_READONLY( "lsrquiz2", 0, BAD_DUMP SHA1(78e261df1c548fa492e6cf37a9469640bb8816bf) ) ROM_END +ROM_START( lsrquizg ) + CD32_BIOS + + DISK_REGION( "cdrom" ) + DISK_IMAGE_READONLY( "laserquizgreek2pro", 0, BAD_DUMP SHA1(8538915b4a0078f19197a5562e37ed3e6d0429a4) ) +ROM_END + ROM_START( mgprem11 ) CD32_BIOS @@ -1167,6 +1177,13 @@ ROM_START( mgnumber ) DISK_IMAGE_READONLY( "magicnumber", 0, BAD_DUMP SHA1(60e1fadc42694742d19cc0ac2b6e99e9e33faa3d) ) ROM_END +ROM_START( odeontw ) + CD32_BIOS + + DISK_REGION( "cdrom" ) + DISK_IMAGE_READONLY( "twister32_17_3", 0, BAD_DUMP SHA1(a40ec484708e22059f7186415283084ebf01323e) ) // has its audio cut a little, worth to mark as redump needed +ROM_END + ROM_START( odeontw2 ) CD32_BIOS @@ -1174,6 +1191,12 @@ ROM_START( odeontw2 ) DISK_IMAGE_READONLY( "odeontw2", 0, BAD_DUMP SHA1(f39e09f35b65a6ae9f1eba4a22f970626b7d3b71) ) ROM_END +ROM_START( eldoralg ) + CD32_BIOS + + DISK_REGION( "cdrom" ) + DISK_IMAGE_READONLY( "eldorado", 0, BAD_DUMP SHA1(bc1617c2e3438b729421c1d8b1bf88840b12f030) ) +ROM_END /************************************* @@ -1369,12 +1392,17 @@ INPUT_PORTS_END -GAME( 1993, cubo, 0, cubo, cubo, cubo_state, init_cubo, ROT0, "Commodore", "Cubo BIOS", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_IS_BIOS_ROOT ) -GAME( 1995, cndypuzl, cubo, cubo, cndypuzl, cubo_state, init_cndypuzl, ROT0, "CD Express", "Candy Puzzle (v1.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1995, haremchl, cubo, cubo, haremchl, cubo_state, init_haremchl, ROT0, "CD Express", "Harem Challenge", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1995, lsrquiz, cubo, cubo, lsrquiz, cubo_state, init_lsrquiz, ROT0, "CD Express", "Laser Quiz Italy", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) /* no player 2 inputs (ingame), wrong pitch for most gfxs */ -GAME( 1995, lsrquiz2, cubo, cubo, lsrquiz2, cubo_state, init_lsrquiz2, ROT0, "CD Express", "Laser Quiz 2 Italy (v1.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) /* wrong pitch for some gfxs, crashes during gameplay */ -GAME( 1995, lasstixx, cubo, cubo, lasstixx, cubo_state, init_lasstixx, ROT0, "CD Express", "Laser Strixx 2", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1995, mgnumber, cubo, cubo, mgnumber, cubo_state, init_mgnumber, ROT0, "CD Express", "Magic Number", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1996, mgprem11, cubo, cubo, mgprem11, cubo_state, init_mgprem11, ROT0, "CD Express", "Magic Premium (v1.1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1999, odeontw2, cubo, cubo, odeontw2, cubo_state, init_cubo, ROT0, "CD Express", "Odeon Twister 2 (v202.19)", MACHINE_NOT_WORKING ) +GAME( 1993, cubo, 0, cubo, cubo, cubo_state, init_cubo, ROT0, "Commodore", "Cubo BIOS", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_IS_BIOS_ROOT ) +GAME( 1995, cndypuzl, cubo, cubo, cndypuzl, cubo_state, init_cndypuzl, ROT0, "CD Express", "Candy Puzzle (v1.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1995, haremchl, cubo, cubo, haremchl, cubo_state, init_haremchl, ROT0, "CD Express", "Harem Challenge", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1995, lsrquiz, cubo, cubo, lsrquiz, cubo_state, init_lsrquiz, ROT0, "CD Express", "Laser Quiz Italy", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) /* no player 2 inputs (ingame), wrong pitch for most gfxs */ +GAME( 1995, lsrquizg, cubo, cubo, lsrquiz, cubo_state, init_lsrquiz, ROT0, "CD Express", "Laser Quiz Greece", MACHINE_NOT_WORKING ) +GAME( 1995, lsrquiz2i, cubo, cubo, lsrquiz2, cubo_state, init_lsrquiz2, ROT0, "CD Express", "Laser Quiz 2 Italy (v1.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) /* wrong pitch for some gfxs, crashes during gameplay */ +GAME( 1995, lasstixx, cubo, cubo, lasstixx, cubo_state, init_lasstixx, ROT0, "CD Express", "Laser Strixx 2", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1995, mgnumber, cubo, cubo, mgnumber, cubo_state, init_mgnumber, ROT0, "CD Express", "Magic Number", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 1996, mgprem11, cubo, cubo, mgprem11, cubo_state, init_mgprem11, ROT0, "CD Express", "Magic Premium (v1.1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +GAME( 19??, odeontw, cubo, cubo, odeontw2, cubo_state, init_cubo, ROT0, "CD Express", "Odeon Twister (v1.4)", MACHINE_NOT_WORKING ) +GAME( 1999, odeontw2, cubo, cubo, odeontw2, cubo_state, init_cubo, ROT0, "CD Express", "Odeon Twister 2 (v202.19)", MACHINE_NOT_WORKING ) + +// Laser Gate 2 +GAME( 19??, eldoralg, cubo, cubo, cubo, cubo_state, init_cubo, ROT0, "CD Express", "Eldorado (4.2)", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/deco_mlc.cpp b/src/mame/drivers/deco_mlc.cpp index b2f385759d3..24ad15cadc2 100644 --- a/src/mame/drivers/deco_mlc.cpp +++ b/src/mame/drivers/deco_mlc.cpp @@ -102,6 +102,8 @@ Driver by Bryan McPhail, bmcphail@tendril.co.uk, thank you to Avedis and The Guru. + Note: MLC stands for MotherLess Cassette + ***************************************************************************/ #include "emu.h" diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 6ff706d8964..8ac0a6d7599 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -13459,13 +13459,35 @@ ROM_START( wcat3 ) ROM_LOAD( "wcat3.g14", 0x0100, 0x0100, CRC(dcd53d2c) SHA1(bbcb4266117c3cd1c8ef0e5046d3558c8293313a) ) ROM_REGION( 0x40, "proms2", 0 ) - ROM_LOAD( "wcat3.d12", 0x0000, 0x0020, CRC(6df3f972) SHA1(0096a7f7452b70cac6c0752cb62e24b643015b5c) ) + ROM_LOAD( "wcat3.d13", 0x0000, 0x0020, CRC(eab832ed) SHA1(0fbc8914ba1805cfc6698fe7f137a934e63a4f89) ) ROM_REGION( 0x100, "unkprom", 0 ) ROM_LOAD( "wcat3.f3", 0x0000, 0x0100, CRC(1d668d4a) SHA1(459117f78323ea264d3a29f1da2889bbabe9e4be) ) ROM_REGION( 0x40, "unkprom2", 0 ) - ROM_LOAD( "wcat3.d13", 0x0000, 0x0020, CRC(eab832ed) SHA1(0fbc8914ba1805cfc6698fe7f137a934e63a4f89) ) + ROM_LOAD( "wcat3.d12", 0x0000, 0x0020, CRC(6df3f972) SHA1(0096a7f7452b70cac6c0752cb62e24b643015b5c) ) +ROM_END + +ROM_START( wcat3a ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "main program sub 27c512.bin", 0x0000, 0x10000, CRC(50b61d88) SHA1(7cea2a03d9b48a1f324171f69ae9df62cf65dc6f) ) + + ROM_REGION( 0x18000, "gfx1", 0 ) + ROM_LOAD( "rom7.bin", 0x10000, 0x8000, CRC(3e2ade27) SHA1(9a463219c5028ed32086c378a17079f69d1c0439) ) + ROM_LOAD( "rom6.bin", 0x08000, 0x8000, CRC(71ae4c3c) SHA1(7b3b0a7453e5844194f3d3ed449549e4c091b127) ) + ROM_LOAD( "rom5.bin", 0x00000, 0x8000, CRC(8fac3f23) SHA1(e2c67620aa2ea01c2d469d963b5a34ca710742ec) ) + + ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_LOAD( "rom4.bin", 0x6000, 0x2000, CRC(0509d556) SHA1(c2f46d279f45b544c67b0c966659cc6d5d53c22f) ) + ROM_LOAD( "rom3.bin", 0x4000, 0x2000, CRC(d50f3d62) SHA1(8500c7f3a2f51ea0ed7e142ecdc4e669ba3e7065) ) + ROM_LOAD( "rom2.bin", 0x2000, 0x2000, CRC(373d9949) SHA1(ff483505fb9e86411acad7059bf5434dde290946) ) + ROM_LOAD( "rom1.bin", 0x0000, 0x2000, CRC(50febe3b) SHA1(0479bcee53b174aa0413951e283e446b09a6f156) ) + + ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF ) // no girls bitmap + + ROM_REGION( 0x200, "proms", 0 ) + ROM_LOAD( "n82s129 u84.bin", 0x0000, 0x0100, CRC(d12b865b) SHA1(cb1fee592c9eb51e38c33a27f8d706c4c57b9823) ) + ROM_LOAD( "n82s129 u79.bin", 0x0100, 0x0100, CRC(89af30d9) SHA1(049252654a25399ad5ca95d1b063eb45356efcad) ) ROM_END @@ -17066,32 +17088,62 @@ void goldstar_state::init_ladylinre() void wingco_state::init_wcat3() { - // the following is very preliminary and only good to decrypt text strings. Treat everything as incomplete and probably incorrect. + // there must be some more conditions and/or some errors as the game needs to be soft resets 4-5 times before working apparently fine + // see from 0xb0 - 0xcf range for an example (comparable to range 0x96 - 0xb5 in lucky8) uint8_t *rom = memregion("maincpu")->base(); + static const uint8_t op_convtable[8][8] = + { + // opcodes address + // 0 1 2 3 4 5 6 7 + { 0x10, 0x00, 0x80, 0x90, 0x30, 0x20, 0xa0, 0xb0 }, // 0x000 + { 0x10, 0x00, 0x80, 0x90, 0x30, 0x20, 0xa0, 0xb0 }, // 0x001 + { 0x20, 0xa0, 0x00, 0x80, 0x10, 0x90, 0x30, 0xb0 }, // 0x004 + { 0x00, 0x20, 0x10, 0x30, 0x80, 0xa0, 0x90, 0xb0 }, // 0x005 + { 0x20, 0x80, 0x00, 0xa0, 0x30, 0x90, 0x10, 0xb0 }, // 0x400 + { 0x00, 0x80, 0x10, 0x90, 0x20, 0xa0, 0x30, 0xb0 }, // 0x401 + { 0x20, 0x80, 0x00, 0xa0, 0x30, 0x90, 0x10, 0xb0 }, // 0x404 + { 0x80, 0xa0, 0x10, 0x30, 0x00, 0x20, 0x90, 0xb0 }, // 0x405 + }; + + static const uint8_t convtable[8][8] = + { + // data address + // 0 1 2 3 4 5 6 7 + { 0x00, 0x10, 0x20, 0x30, 0x80, 0x90, 0xa0, 0xb0 }, // 0x000 + { 0x10, 0x00, 0x90, 0x80, 0x20, 0x30, 0xa0, 0xb0 }, // 0x001 + { 0x20, 0xa0, 0x00, 0x80, 0x10, 0x90, 0x30, 0xb0 }, // 0x004 // verify 0x00, 0x90, 0xa0 + { 0x80, 0x20, 0x90, 0x30, 0x00, 0xa0, 0x10, 0xb0 }, // 0x005 + { 0x00, 0x10, 0x20, 0x30, 0x80, 0x90, 0xa0, 0xb0 }, // 0x400 + { 0x10, 0x00, 0x90, 0x80, 0x20, 0x30, 0xa0, 0xb0 }, // 0x401 + { 0x00, 0x80, 0x20, 0xa0, 0x10, 0x90, 0x30, 0xb0 }, // 0x404 + { 0x00, 0x80, 0x20, 0xa0, 0x10, 0x90, 0x30, 0xb0 }, // 0x405 + }; + for (int i = 0x0000; i < 0x10000; i++) { uint8_t x = rom[i]; - m_decrypted_opcodes[i] = x; + // translation table from address + uint8_t row = (BIT(i, 0) + (BIT(i, 2) << 1) + (BIT(i, 10) << 2)); + + // offset in the table from source data + uint8_t col = (BIT(x, 4) + (BIT(x, 5) << 1) + (BIT(x, 7) << 2)); + + m_decrypted_opcodes[i] = (x & ~0xb0) | op_convtable[row][col]; } - // data encryption seems to involve only bits 4, 5 and 7 and some conditional XORs - for (int i = 0x4000; i < 0x10000; i++) + for (int i = 0x0000; i < 0x10000; i++) { uint8_t x = rom[i]; - switch (i & 0x405) - { - case 0x001: x = bitswap<8>(BIT(x, 6) ? x ^ 0x10 : x, 5, 6, 7, 4, 3, 2, 1, 0); break; - case 0x004: x = bitswap<8>(!BIT(x, 7) ? x ^ 0x20 : x, 4, 6, 5, 7, 3, 2, 1, 0); break; - case 0x005: x = bitswap<8>(BIT(x, 7) ? x ^ 0x80 : x, 7, 6, 4, 5, 3, 2, 1, 0); break; - case 0x401: x = bitswap<8>(!BIT(x, 7) ? x ^ 0x10 : x, 5, 6, 7, 4, 3, 2, 1, 0); break; - case 0x404: x = bitswap<8>(x, 4, 6, 5, 7, 3, 2, 1, 0); break; - case 0x405: x = bitswap<8>(x, 4, 6, 5, 7, 3, 2, 1, 0); break; - } + // translation table from address + uint8_t row = (BIT(i, 0) + (BIT(i, 2) << 1) + (BIT(i, 10) << 2)); - rom[i] = x; + // offset in the table from source data + uint8_t col = (BIT(x, 4) + (BIT(x, 5) << 1) + (BIT(x, 7) << 2)); + + rom[i] = (x & ~0xb0) | convtable[row][col]; } } @@ -17237,6 +17289,47 @@ void goldstar_state::init_chryangl() } } +void cmaster_state::init_wcat3a() // seems ok, but needs checking +{ + uint8_t *rom = memregion("maincpu")->base(); + + for (int i = 0; i < 0x10000; i++) + { + uint8_t x = rom[i]; + + switch (i & 0x83) + { + case 0x00: x = bitswap<8>(x ^ 0x2a, 1, 6, 7, 4, 5, 2, 3, 0); break; + case 0x01: x = bitswap<8>(x ^ 0x0a, 5, 6, 3, 4, 1, 2, 7, 0); break; + case 0x02: x = bitswap<8>(x ^ 0xa8, 5, 6, 3, 4, 1, 2, 7, 0); break; + case 0x03: x = bitswap<8>(x ^ 0x0a, 3, 6, 1, 4, 7, 2, 5, 0); break; + case 0x80: x = bitswap<8>(x ^ 0x28, 3, 6, 1, 4, 7, 2, 5, 0); break; + case 0x81: x = bitswap<8>(x ^ 0xa8, 1, 6, 7, 4, 5, 2, 3, 0); break; + case 0x82: x = bitswap<8>(x ^ 0xa2, 3, 6, 1, 4, 7, 2, 5, 0); break; + case 0x83: x = bitswap<8>(x ^ 0x2a, 5, 6, 3, 4, 1, 2, 7, 0); break; + } + + m_decrypted_opcodes[i] = x; + } + + for (int i = 0; i < 0x10000; i++) + { + uint8_t x = rom[i]; + switch (i & 0x83) + { + case 0x00: x = bitswap<8>(x ^ 0x88, 3, 6, 1, 4, 7, 2, 5, 0); break; + case 0x01: x = bitswap<8>(x ^ 0x80, 5, 6, 3, 4, 1, 2, 7, 0); break; + case 0x02: x = bitswap<8>(x ^ 0x28, 1, 6, 7, 4, 5, 2, 3, 0); break; + case 0x03: x = bitswap<8>(x ^ 0x80, 3, 6, 1, 4, 7, 2, 5, 0); break; + case 0x80: x = bitswap<8>(x ^ 0x02, 5, 6, 3, 4, 1, 2, 7, 0); break; + case 0x81: x = bitswap<8>(x ^ 0x22, 3, 6, 1, 4, 7, 2, 5, 0); break; + case 0x82: x = bitswap<8>(x ^ 0x88, 5, 6, 3, 4, 1, 2, 7, 0); break; + case 0x83: x = bitswap<8>(x ^ 0x22, 1, 6, 7, 4, 5, 2, 3, 0); break; + } + rom[i] = x; + } +} + void cb3_state::init_chrygld() { uint8_t *rom = memregion("maincpu")->base(); @@ -18121,6 +18214,7 @@ GAMEL( 1991, cmasterf, cmaster, cm, cmasterb, cmaster_state, init_cmv4, GAMEL( 1991, cmasterg, cmaster, cm, cmasterg, cmaster_state, init_cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.01, set 8, V4-B-)", 0, layout_cmasterb ) GAMEL( 1991, cmasterh, cmaster, cm, cmasterb, cmaster_state, init_cmv4, ROT0, "Dyna", "Cherry Master I (ver.1.10)", 0, layout_cmasterb ) GAMEL( 199?, super7, cmaster, cm, cmaster, cmaster_state, init_super7, ROT0, "bootleg", "Super Seven", MACHINE_NOT_WORKING, layout_cmasterb ) +GAME ( 199?, wcat3a, wcat3, chryangl, cmaster, cmaster_state, init_wcat3a, ROT0, "E.A.I.", "Wild Cat 3 (CMV4 hardware)", MACHINE_NOT_WORKING ) // does not boot. Wrong decryption, wrong machine or wrong what? GAMEL( 1991, tonypok, 0, cm, tonypok, cmaster_state, init_tonypok, ROT0, "Corsica", "Poker Master (Tony-Poker V3.A, hack?)", 0 , layout_tonypok ) GAME( 1999, jkrmast, 0, pkrmast, pkrmast, goldstar_state, init_jkrmast, ROT0, "Pick-A-Party USA", "Joker Master (V515)", MACHINE_NOT_WORKING ) // encryption broken, needs GFX and controls @@ -18165,7 +18259,7 @@ GAME( 198?, ladylinrb, ladylinr, ladylinrb,ladylinr, goldstar_state, init_ladyl GAME( 198?, ladylinrc, ladylinr, ladylinrb,ladylinr, goldstar_state, init_ladylinrc, ROT0, "TAB Austria", "Lady Liner (encrypted, set 2)", 0 ) GAME( 198?, ladylinrd, ladylinr, ladylinrb,ladylinr, goldstar_state, init_ladylinrd, ROT0, "TAB Austria", "Lady Liner (encrypted, set 3)", 0 ) GAME( 198?, ladylinre, ladylinr, ladylinrb,ladylinr, goldstar_state, init_ladylinre, ROT0, "TAB Austria", "Lady Liner (encrypted, set 4)", 0 ) -GAME( 198?, wcat3, 0, wcat3, lucky8, wingco_state, init_wcat3, ROT0, "E.A.I.", "Wild Cat 3", MACHINE_NOT_WORKING ) +GAME( 1995, wcat3, 0, wcat3, lucky8, wingco_state, init_wcat3, ROT0, "E.A.I.", "Wild Cat 3", MACHINE_NOT_WORKING | MACHINE_WRONG_COLORS ) // decryption partially wrong, needs soft resets before running. Bad PROM decode GAME( 1985, luckylad, 0, luckylad, luckylad, wingco_state, empty_init, ROT0, "Wing Co., Ltd.", "Lucky Lady (Wing, encrypted)", MACHINE_NOT_WORKING | MACHINE_WRONG_COLORS ) // controls / dips, colors not correctly decoded GAME( 1991, megaline, 0, megaline, megaline, unkch_state, empty_init, ROT0, "Fun World", "Mega Lines", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/igs011.cpp b/src/mame/drivers/igs011.cpp index c1e8262bcd1..9f516de60d6 100644 --- a/src/mame/drivers/igs011.cpp +++ b/src/mame/drivers/igs011.cpp @@ -3727,7 +3727,7 @@ INPUT_PORTS_END // vbowlhk: joystick only, no cabinet linking static INPUT_PORTS_START( vbowlhk ) PORT_START("DSW1") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3") PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) @@ -3736,60 +3736,60 @@ static INPUT_PORTS_START( vbowlhk ) PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) PORT_DIPSETTING( 0x03, DEF_STR( 1C_5C ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:4") PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Sexy Interlude" ) + PORT_DIPNAME( 0x10, 0x10, "Sexy Interlude" ) PORT_DIPLOCATION("SW1:5") PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x20, 0x20, "Open Picture" ) + PORT_DIPNAME( 0x20, 0x20, "Open Picture" ) PORT_DIPLOCATION("SW1:6") PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) - PORT_DIPUNKNOWN( 0x40, 0x40 ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) + PORT_DIPUNKNOWN_DIPLOC(0x40, IP_ACTIVE_LOW, "SW1:7" ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW1:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSW2") - PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) ) + PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) // 5 PORT_DIPSETTING( 0x02, DEF_STR( Normal ) ) // 7 PORT_DIPSETTING( 0x01, DEF_STR( Medium ) ) // 9 PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) // 11 - PORT_DIPNAME( 0x04, 0x04, "Spares To Win (Frames 1-5)" ) + PORT_DIPNAME( 0x04, 0x04, "Spares To Win (Frames 1-5)" ) PORT_DIPLOCATION("SW2:3") PORT_DIPSETTING( 0x04, "3" ) PORT_DIPSETTING( 0x00, "4" ) - PORT_DIPNAME( 0x18, 0x18, "Points To Win (Frames 6-10)" ) + PORT_DIPNAME( 0x18, 0x18, "Points To Win (Frames 6-10)" ) PORT_DIPLOCATION("SW2:4,5") PORT_DIPSETTING( 0x18, "160" ) PORT_DIPSETTING( 0x10, "170" ) PORT_DIPSETTING( 0x08, "180" ) PORT_DIPSETTING( 0x00, "190" ) - PORT_DIPUNKNOWN( 0x20, 0x20 ) - PORT_DIPUNKNOWN( 0x40, 0x40 ) - PORT_DIPUNKNOWN( 0x80, 0x80 ) + PORT_DIPUNKNOWN_DIPLOC(0x20, IP_ACTIVE_LOW, "SW2:6" ) + PORT_DIPUNKNOWN_DIPLOC(0x40, IP_ACTIVE_LOW, "SW2:7" ) + PORT_DIPUNKNOWN_DIPLOC(0x80, IP_ACTIVE_LOW, "SW2:8" ) PORT_START("DSW3") - PORT_DIPUNKNOWN( 0x01, 0x01 ) - PORT_DIPUNKNOWN( 0x02, 0x02 ) - PORT_DIPUNKNOWN( 0x04, 0x04 ) - PORT_DIPUNKNOWN( 0x08, 0x08 ) - PORT_DIPUNKNOWN( 0x10, 0x10 ) - PORT_DIPUNKNOWN( 0x20, 0x20 ) - PORT_DIPUNKNOWN( 0x40, 0x40 ) - PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) + PORT_DIPUNKNOWN_DIPLOC(0x01, IP_ACTIVE_LOW, "SW3:1" ) + PORT_DIPUNKNOWN_DIPLOC(0x02, IP_ACTIVE_LOW, "SW3:2" ) + PORT_DIPUNKNOWN_DIPLOC(0x04, IP_ACTIVE_LOW, "SW3:3" ) + PORT_DIPUNKNOWN_DIPLOC(0x08, IP_ACTIVE_LOW, "SW3:4" ) + PORT_DIPUNKNOWN_DIPLOC(0x10, IP_ACTIVE_LOW, "SW3:5" ) + PORT_DIPUNKNOWN_DIPLOC(0x20, IP_ACTIVE_LOW, "SW3:6" ) + PORT_DIPUNKNOWN_DIPLOC(0x40, IP_ACTIVE_LOW, "SW3:7" ) + PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_LOW, "SW3:8" ) PORT_START("DSW4") - PORT_DIPNAME( 0x81, 0x81, "Protection & Comm Test" ) // includes IGS011 and IGS012 protection tests + PORT_DIPNAME( 0x81, 0x81, "Protection & Comm Test" ) PORT_DIPLOCATION("SW4:1,8") // includes IGS011 and IGS012 protection tests PORT_DIPSETTING( 0x81, "No (0)" ) PORT_DIPSETTING( 0x80, "No (1)" ) PORT_DIPSETTING( 0x01, "No (2)" ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) - PORT_DIPUNKNOWN( 0x02, 0x02 ) - PORT_DIPUNKNOWN( 0x04, 0x04 ) - PORT_DIPUNKNOWN( 0x08, 0x08 ) - PORT_DIPUNKNOWN( 0x10, 0x10 ) - PORT_DIPUNKNOWN( 0x20, 0x20 ) - PORT_DIPUNKNOWN( 0x40, 0x40 ) + PORT_DIPUNKNOWN_DIPLOC(0x02, IP_ACTIVE_LOW, "SW4:2" ) + PORT_DIPUNKNOWN_DIPLOC(0x04, IP_ACTIVE_LOW, "SW4:3" ) + PORT_DIPUNKNOWN_DIPLOC(0x08, IP_ACTIVE_LOW, "SW4:4" ) + PORT_DIPUNKNOWN_DIPLOC(0x10, IP_ACTIVE_LOW, "SW4:5" ) + PORT_DIPUNKNOWN_DIPLOC(0x20, IP_ACTIVE_LOW, "SW4:6" ) + PORT_DIPUNKNOWN_DIPLOC(0x40, IP_ACTIVE_LOW, "SW4:7" ) PORT_START("COIN") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -3834,45 +3834,19 @@ static INPUT_PORTS_START( vbowl ) PORT_INCLUDE(vbowlhk) PORT_MODIFY("DSW1") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) - PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) - PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) - PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( 1C_5C ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Sexy Interlude" ) - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x20, 0x20, "Open Picture" ) - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Controls ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Controls ) ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x40, DEF_STR( Joystick ) ) PORT_DIPSETTING( 0x00, DEF_STR( Trackball ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_MODIFY("DSW3") - PORT_DIPNAME( 0x03, 0x03, "Cabinet ID" ) + PORT_DIPNAME( 0x03, 0x03, "Cabinet ID" ) PORT_DIPLOCATION("SW3:1,2") PORT_DIPSETTING( 0x03, "1" ) PORT_DIPSETTING( 0x02, "2" ) PORT_DIPSETTING( 0x01, "3" ) PORT_DIPSETTING( 0x00, "4" ) - PORT_DIPNAME( 0x04, 0x04, "Linked Cabinets" ) + PORT_DIPNAME( 0x04, 0x04, "Linked Cabinets" ) PORT_DIPLOCATION("SW3:3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPUNKNOWN( 0x08, 0x08 ) - PORT_DIPUNKNOWN( 0x10, 0x10 ) - PORT_DIPUNKNOWN( 0x20, 0x20 ) - PORT_DIPUNKNOWN( 0x40, 0x40 ) - PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) PORT_MODIFY("AN0") PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1) @@ -3887,28 +3861,9 @@ static INPUT_PORTS_START( vbowlj ) PORT_INCLUDE(vbowl) PORT_MODIFY("DSW1") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) ) - PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) - PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) - PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( 1C_5C ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Sexy Interlude" ) - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Controls ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Controls ) ) PORT_DIPLOCATION("SW1:6") PORT_DIPSETTING( 0x20, DEF_STR( Joystick ) ) PORT_DIPSETTING( 0x00, DEF_STR( Trackball ) ) - PORT_DIPUNKNOWN( 0x40, 0x40 ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -4974,5 +4929,5 @@ GAME( 1996, xymg, 0, xymg, xymg, igs011_state, in GAME( 1996, wlcc, xymg, wlcc, wlcc, igs011_state, init_wlcc, ROT0, "IGS", "Wanli Changcheng (China, V638C)", MACHINE_SUPPORTS_SAVE ) GAME( 1996, vbowl, 0, vbowl, vbowl, igs011_state, init_vbowl, ROT0, "IGS", "Virtua Bowling (World, V101XCM)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) GAME( 1996, vbowlj, vbowl, vbowl, vbowlj, igs011_state, init_vbowlj, ROT0, "IGS / Alta", "Virtua Bowling (Japan, V100JCM)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -GAME( 1996, vbowlhk, vbowl, vbowlhk, vbowl, igs011_state, init_vbowlhk, ROT0, "IGS / Tai Tin Amusement", "Virtua Bowling (Hong Kong, V101HJS)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +GAME( 1996, vbowlhk, vbowl, vbowlhk, vbowlhk, igs011_state, init_vbowlhk, ROT0, "IGS / Tai Tin Amusement", "Virtua Bowling (Hong Kong, V101HJS)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) GAME( 1998, nkishusp, lhb2, nkishusp, nkishusp, igs011_state, init_nkishusp, ROT0, "IGS / Alta", "Mahjong Nenrikishu SP (Japan, V250J)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/konmedal.cpp b/src/mame/drivers/konmedal.cpp index 140239167d3..1dce27a0501 100644 --- a/src/mame/drivers/konmedal.cpp +++ b/src/mame/drivers/konmedal.cpp @@ -35,9 +35,10 @@ K051649 (sound) #include "emu.h" #include "cpu/z80/z80.h" -#include "machine/eepromser.h" -#include "machine/gen_latch.h" +#include "machine/nvram.h" +#include "machine/ticket.h" #include "machine/timer.h" +#include "machine/k053252.h" #include "sound/ymz280b.h" #include "sound/okim6295.h" #include "sound/k051649.h" @@ -56,11 +57,14 @@ public: driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_k056832(*this, "k056832"), + m_k053252(*this, "k053252"), m_k052109(*this, "k052109"), m_palette(*this, "palette"), m_ymz(*this, "ymz"), m_oki(*this, "oki"), - m_upd7759(*this, "upd7759") + m_upd7759(*this, "upd7759"), + m_nvram(*this, "nvram"), + m_outport(*this, "OUT") { } void shuriboy(machine_config &config); @@ -71,28 +75,31 @@ public: private: void konmedal_palette(palette_device &palette) const; + void shuriboy_nvram_init(nvram_device &nvram, void *base, size_t size); + void fuusenpn_nvram_init(nvram_device &nvram, void *base, size_t size); + void mario_nvram_init(nvram_device &nvram, void *base, size_t size); DECLARE_MACHINE_START(shuriboy); DECLARE_READ8_MEMBER(vram_r); DECLARE_WRITE8_MEMBER(vram_w); - DECLARE_READ8_MEMBER(magic_r); DECLARE_WRITE8_MEMBER(bankswitch_w); DECLARE_WRITE8_MEMBER(control2_w); - READ8_MEMBER(inputs_r) - { - return 0xff; - } uint32_t screen_update_konmedal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_shuriboy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_fuusenpn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_mariorou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(konmedal_interrupt); K056832_CB_MEMBER(tile_callback); + TIMER_DEVICE_CALLBACK_MEMBER(konmedal_scanline); + WRITE_LINE_MEMBER(vbl_ack_w) { m_maincpu->set_input_line(0, CLEAR_LINE); } + WRITE_LINE_MEMBER(nmi_ack_w) { m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } + WRITE8_MEMBER(ccu_int_time_w) { m_ccu_int_time = data; } + WRITE8_MEMBER(k056832_w) { m_k056832->write(offset ^ 1, data); } + WRITE8_MEMBER(k056832_b_w) { m_k056832->b_w(offset ^ 1, data); } K052109_CB_MEMBER(shuriboy_tile_callback); - TIMER_DEVICE_CALLBACK_MEMBER(scanline); + TIMER_DEVICE_CALLBACK_MEMBER(shuri_scanline); DECLARE_WRITE8_MEMBER(shuri_bank_w); DECLARE_READ8_MEMBER(shuri_irq_r); DECLARE_WRITE8_MEMBER(shuri_irq_w); @@ -107,20 +114,24 @@ private: required_device<cpu_device> m_maincpu; optional_device<k056832_device> m_k056832; + optional_device<k053252_device> m_k053252; optional_device<k052109_device> m_k052109; required_device<palette_device> m_palette; optional_device<ymz280b_device> m_ymz; optional_device<okim6295_device> m_oki; optional_device<upd7759_device> m_upd7759; + required_device<nvram_device> m_nvram; + required_ioport m_outport; u8 m_control, m_control2, m_shuri_irq; - u32 m_vrom_base; + int m_ccu_int_time, m_ccu_int_time_count; }; WRITE8_MEMBER(konmedal_state::control2_w) { //printf("%02x to control2\n", data); m_control2 = data; + m_outport->write(data); } READ8_MEMBER(konmedal_state::vram_r) @@ -158,11 +169,6 @@ WRITE8_MEMBER(konmedal_state::vram_w) m_k056832->ram_code_lo_w(offset>>1, data); } -READ8_MEMBER(konmedal_state::magic_r) -{ - return 0xc1; // checked at 60f in tsukande before reading a page of the VROM -} - K056832_CB_MEMBER(konmedal_state::tile_callback) { int codebits = *code; @@ -187,9 +193,10 @@ uint32_t konmedal_state::screen_update_konmedal(screen_device &screen, bitmap_in bitmap.fill(0, cliprect); screen.priority().fill(0, cliprect); - // game only draws on this layer, apparently m_k056832->tilemap_draw(screen, bitmap, cliprect, 3, 0, 1); - + m_k056832->tilemap_draw(screen, bitmap, cliprect, 2, 0, 2); + m_k056832->tilemap_draw(screen, bitmap, cliprect, 1, 0, 4); + m_k056832->tilemap_draw(screen, bitmap, cliprect, 0, 0, 8); return 0; } @@ -225,10 +232,10 @@ uint32_t konmedal_state::screen_update_mariorou(screen_device &screen, bitmap_in screen.priority().fill(0, cliprect); m_k052109->tilemap_update(); - m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 1); - m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 2); - m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 4); + m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 1); + m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 4); + m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 2); return 0; } @@ -238,7 +245,6 @@ void konmedal_state::konmedal_palette(palette_device &palette) const for (int i = 0; i < 256; i++) { - // this is extremely wrong, see the color test screen palette.set_pen_color(i, (PROM[i]) << 4, (PROM[0x100 + i]) << 4, @@ -246,10 +252,26 @@ void konmedal_state::konmedal_palette(palette_device &palette) const } } -INTERRUPT_GEN_MEMBER(konmedal_state::konmedal_interrupt) +TIMER_DEVICE_CALLBACK_MEMBER(konmedal_state::konmedal_scanline) { - m_maincpu->set_input_line(0, HOLD_LINE); - m_k056832->mark_plane_dirty(3); + int scanline = param; + + // z80 /IRQ is connected to the IRQ1(vblank) pin of k053252 CCU + if (scanline == 255) + { + m_maincpu->set_input_line(0, ASSERT_LINE); + //m_k056832->mark_plane_dirty(3); + } + + // z80 /NMI is connected to the IRQ2 pin of k053252 CCU + // the following code is emulating INT_TIME of the k053252, this code will go away + // when the new konami branch is merged. + m_ccu_int_time_count--; + if (m_ccu_int_time_count <= 0) + { + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + m_ccu_int_time_count = m_ccu_int_time; + } } WRITE8_MEMBER(konmedal_state::bankswitch_w) @@ -263,18 +285,17 @@ void konmedal_state::medal_main(address_map &map) { map(0x0000, 0x7fff).rom().region("maincpu", 0); map(0x8000, 0x9fff).bankr("bank1"); - map(0xa000, 0xafff).ram(); // work RAM? - map(0xb800, 0xbfff).ram(); // stack goes here - map(0xc000, 0xc03f).w(m_k056832, FUNC(k056832_device::write)); + map(0xa000, 0xbfff).ram().share("nvram"); // work RAM + map(0xc000, 0xc03f).w(FUNC(konmedal_state::k056832_w)); map(0xc100, 0xc100).w(FUNC(konmedal_state::control2_w)); map(0xc400, 0xc400).w(FUNC(konmedal_state::bankswitch_w)); map(0xc500, 0xc500).noprw(); // read to reset watchdog + map(0xc600, 0xc60f).w(FUNC(konmedal_state::k056832_b_w)); map(0xc700, 0xc700).portr("DSW2"); map(0xc701, 0xc701).portr("DSW1"); map(0xc702, 0xc702).portr("IN1"); map(0xc703, 0xc703).portr("IN2"); - map(0xc800, 0xc80f).w(m_k056832, FUNC(k056832_device::b_w)); - map(0xc80f, 0xc80f).r(FUNC(konmedal_state::magic_r)); + map(0xc800, 0xc80f).rw(m_k053252, FUNC(k053252_device::read), FUNC(k053252_device::write)); map(0xd000, 0xd001).rw(m_ymz, FUNC(ymz280b_device::read), FUNC(ymz280b_device::write)); map(0xe000, 0xffff).rw(FUNC(konmedal_state::vram_r), FUNC(konmedal_state::vram_w)); } @@ -283,15 +304,17 @@ void konmedal_state::ddboy_main(address_map &map) { map(0x0000, 0x7fff).rom().region("maincpu", 0); map(0x8000, 0x9fff).bankr("bank1"); - map(0xa000, 0xbfff).ram(); // work RAM - map(0xc000, 0xc03f).w(m_k056832, FUNC(k056832_device::write)); + map(0xa000, 0xbfff).ram().share("nvram"); // work RAM + map(0xc000, 0xc03f).w(FUNC(konmedal_state::k056832_w)); map(0xc100, 0xc100).w(FUNC(konmedal_state::control2_w)); map(0xc400, 0xc400).w(FUNC(konmedal_state::bankswitch_w)); map(0xc500, 0xc500).noprw(); // read to reset watchdog + map(0xc600, 0xc60f).w(FUNC(konmedal_state::k056832_b_w)); + map(0xc700, 0xc700).portr("DSW1"); + map(0xc701, 0xc701).portr("DSW2"); map(0xc702, 0xc702).portr("IN1"); map(0xc703, 0xc703).portr("IN2"); - map(0xc800, 0xc80f).w(m_k056832, FUNC(k056832_device::b_w)); - map(0xc80f, 0xc80f).r(FUNC(konmedal_state::magic_r)); + map(0xc800, 0xc80f).rw(m_k053252, FUNC(k053252_device::read), FUNC(k053252_device::write)); map(0xcc00, 0xcc00).rw(m_oki, FUNC(okim6295_device::read), FUNC(okim6295_device::write)); map(0xd000, 0xd000).nopw(); // ??? writes 00 and 3f every frame map(0xd800, 0xd8ff).m("k051649", FUNC(k051649_device::scc_map)); @@ -301,12 +324,12 @@ void konmedal_state::ddboy_main(address_map &map) void konmedal_state::shuriboy_main(address_map &map) { map(0x0000, 0x7fff).rom().region("maincpu", 0); - map(0x8000, 0x87ff).ram(); + map(0x8000, 0x87ff).ram().share("nvram"); // actual RAM chip is 8Kbyte, might be banked somewhow map(0x8800, 0x8800).portr("IN2"); map(0x8801, 0x8801).portr("IN1"); map(0x8802, 0x8802).portr("DSW1"); map(0x8803, 0x8803).portr("DSW2"); - map(0x8900, 0x8900).nopw(); + map(0x8900, 0x8900).w(FUNC(konmedal_state::control2_w)); map(0x8b00, 0x8b00).nopw(); // watchdog? map(0x8c00, 0x8c00).w(FUNC(konmedal_state::shuri_bank_w)); map(0x8d00, 0x8d00).w(m_upd7759, FUNC(upd7759_device::port_w)); @@ -319,7 +342,7 @@ void konmedal_state::shuriboy_main(address_map &map) static INPUT_PORTS_START( konmedal ) PORT_START("DSW1") - PORT_DIPNAME( 0x07, 0x00, "Coin Slot 1" ) PORT_DIPLOCATION("SW1:1,2,3") + PORT_DIPNAME( 0x07, 0x07, "Coin Slot 1" ) PORT_DIPLOCATION("SW1:1,2,3") PORT_DIPSETTING( 0x00, "5 Coins/2 Credits" ) PORT_DIPSETTING( 0x01, DEF_STR( 4C_3C ) ) PORT_DIPSETTING( 0x02, DEF_STR( 2C_3C ) ) @@ -345,9 +368,9 @@ static INPUT_PORTS_START( konmedal ) PORT_DIPSETTING( 0x68, "3 Medals" ) PORT_DIPSETTING( 0x70, "2 Medals" ) // PORT_DIPSETTING( 0x78, "2 Medals" ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") - PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") // more like debug mode + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_START("DSW2") PORT_DIPNAME( 0x0f, 0x00, "Standard of Payout" ) PORT_DIPLOCATION("SW2:1,2,3,4") @@ -390,8 +413,11 @@ static INPUT_PORTS_START( konmedal ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Test") PORT_CODE(KEYCODE_F2) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // medal ack + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("hopper", hopper_device, line_r) PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN ) // unused + + PORT_START("OUT") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("hopper", hopper_device, motor_w) INPUT_PORTS_END void konmedal_state::machine_start() @@ -408,8 +434,9 @@ MACHINE_START_MEMBER(konmedal_state, shuriboy) void konmedal_state::machine_reset() { - m_vrom_base = 0; m_control = m_control2 = m_shuri_irq = 0; + m_ccu_int_time_count = 0; + m_ccu_int_time = 31; } void konmedal_state::tsukande(machine_config &config) @@ -417,7 +444,15 @@ void konmedal_state::tsukande(machine_config &config) /* basic machine hardware */ Z80(config, m_maincpu, XTAL(14'318'181)/2); // z84c0008pec 8mhz part, 14.31818Mhz xtal verified on PCB, divisor unknown m_maincpu->set_addrmap(AS_PROGRAM, &konmedal_state::medal_main); - m_maincpu->set_vblank_int("screen", FUNC(konmedal_state::konmedal_interrupt)); + TIMER(config, "scantimer").configure_scanline(FUNC(konmedal_state::konmedal_scanline), "screen", 0, 1); + + NVRAM(config, m_nvram, nvram_device::DEFAULT_ALL_0); + HOPPER(config, "hopper", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH); + + K053252(config, m_k053252, XTAL(14'318'181) / 2); // not verified + m_k053252->int1_ack().set(FUNC(konmedal_state::vbl_ack_w)); + m_k053252->int2_ack().set(FUNC(konmedal_state::nmi_ack_w)); + m_k053252->int_time().set(FUNC(konmedal_state::ccu_int_time_w)); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -450,7 +485,15 @@ void konmedal_state::ddboy(machine_config &config) /* basic machine hardware */ Z80(config, m_maincpu, XTAL(14'318'181)/2); // z84c0008pec 8mhz part, 14.31818Mhz xtal verified on PCB, divisor unknown m_maincpu->set_addrmap(AS_PROGRAM, &konmedal_state::ddboy_main); - m_maincpu->set_vblank_int("screen", FUNC(konmedal_state::konmedal_interrupt)); + TIMER(config, "scantimer").configure_scanline(FUNC(konmedal_state::konmedal_scanline), "screen", 0, 1); + + NVRAM(config, m_nvram, nvram_device::DEFAULT_ALL_0); + HOPPER(config, "hopper", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH); + + K053252(config, m_k053252, XTAL(14'318'181) / 2); // not verified + m_k053252->int1_ack().set(FUNC(konmedal_state::vbl_ack_w)); + m_k053252->int2_ack().set(FUNC(konmedal_state::nmi_ack_w)); + m_k053252->int_time().set(FUNC(konmedal_state::ccu_int_time_w)); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -501,27 +544,34 @@ K052109_CB_MEMBER(konmedal_state::shuriboy_tile_callback) { if (*color == 1) *color = 0; if (*color == 2) *color = 1; - if (*color == 6) *color = 5; + if (*color == 3) *color = 1; + if (*color == 4) *color = 2; + if (*color == 6) *color = 3; if (*color == 8) *color = 4; if (*color == 9) *color = 4; if (*color == 0xa) *color = 5; + if (*color == 0xb) *color = 5; if (*color == 0xd) *color = 6; if (*color == 0xe) *color = 3; } if (layer == 1) { + if (*color == 8) *color = 2; if (*color == 0) *color = 8; if (*color == 0xa) *color = 0xe; if (*color == 4) *color = 0xa; + if (*color == 6) *color = 3; } if (layer == 2) { - if (*color == 6) *color = 3; + if (*color == 2) *color = 9; + if (*color == 6) *color = 2; if (*color == 8) *color = 0xc; if (*color == 0) *color = 8; if (*color == 0xa) *color = 0xd; if (*color == 4) *color = 0xa; if (*color == 5) *color = 0xa; + if (*color == 0xf) *color = 0xb; } } @@ -550,7 +600,7 @@ WRITE8_MEMBER(konmedal_state::shuri_irq_w) m_shuri_irq = data; } -TIMER_DEVICE_CALLBACK_MEMBER(konmedal_state::scanline) +TIMER_DEVICE_CALLBACK_MEMBER(konmedal_state::shuri_scanline) { int scanline = param; @@ -571,7 +621,11 @@ void konmedal_state::shuriboy(machine_config &config) /* basic machine hardware */ Z80(config, m_maincpu, XTAL(24'000'000) / 3); // divisor unknown m_maincpu->set_addrmap(AS_PROGRAM, &konmedal_state::shuriboy_main); - TIMER(config, "scantimer").configure_scanline(FUNC(konmedal_state::scanline), "screen", 0, 1); + TIMER(config, "scantimer").configure_scanline(FUNC(konmedal_state::shuri_scanline), "screen", 0, 1); + + NVRAM(config, m_nvram, nvram_device::DEFAULT_ALL_0); + m_nvram->set_custom_handler(FUNC(konmedal_state::shuriboy_nvram_init));; + HOPPER(config, "hopper", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); // everything not verified, just a placeholder @@ -605,6 +659,8 @@ void konmedal_state::fuusenpn(machine_config &config) { shuriboy(config); + m_nvram->set_custom_handler(FUNC(konmedal_state::fuusenpn_nvram_init)); + screen_device &screen(SCREEN(config.replace(), "screen", SCREEN_TYPE_RASTER)); // everything not verified, just a placeholder screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(30)); @@ -620,6 +676,8 @@ void konmedal_state::mariorou(machine_config &config) { shuriboy(config); + m_nvram->set_custom_handler(FUNC(konmedal_state::mario_nvram_init)); + screen_device &screen(SCREEN(config.replace(), "screen", SCREEN_TYPE_RASTER)); // everything not verified, just a placeholder screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(30)); @@ -631,6 +689,40 @@ void konmedal_state::mariorou(machine_config &config) m_k052109->set_tile_callback(FUNC(konmedal_state::shuriboy_tile_callback)); } +// required at 1st boot with "Backup Keep" DIPSW setting +void konmedal_state::shuriboy_nvram_init(nvram_device &nvram, void *base, size_t size) +{ + memset(base, 0x00, size); + u8 *ram = (u8*)base; + ram[0x08] = 0x01; + ram[0x09] = 0x02; + ram[0x0e] = 0x04; + ram[0x17] = 0x08; + ram[0x18] = 0x10; + ram[0x21] = 0x20; + ram[0x50] = 0x40; + ram[0x52] = 0x80; + ram[0x53] = 0x55; + ram[0x54] = 0xaa; +} + +void konmedal_state::fuusenpn_nvram_init(nvram_device &nvram, void *base, size_t size) +{ + memset(base, 0x00, size); + u8 *ram = (u8*)base; + ram[0x203] = 0xff; + ram[0x209] = 0xaa; +} + +void konmedal_state::mario_nvram_init(nvram_device &nvram, void *base, size_t size) +{ + memset(base, 0x00, size); + u8 *ram = (u8*)base; + ram[0x502] = 0xff; + ram[0x506] = 0xaa; + ram[0x508] = 0x55; +} + ROM_START( tsukande ) ROM_REGION( 0x20000, "maincpu", 0 ) /* main program */ ROM_LOAD( "441-d02.4g", 0x000000, 0x020000, CRC(6ed17227) SHA1(4e3f5219cbf6f42c60df38a99f3009fe49f78fc1) ) diff --git a/src/mame/drivers/megadriv.cpp b/src/mame/drivers/megadriv.cpp index 762448cc049..deb73e7111c 100644 --- a/src/mame/drivers/megadriv.cpp +++ b/src/mame/drivers/megadriv.cpp @@ -1006,6 +1006,8 @@ ROM_START( megacdj ) // EEPROM had no SEGA's label, might be 14088(no rev) or 14088A ROM_SYSTEM_BIOS(5, "v100c", "v1.00C") // CRC: c3b60c13 when byteswapped ROMX_LOAD( "100c.bin", 0x000000, 0x020000, CRC(41af44c4) SHA1(f30d109d1c2f7c9feaf38600c65834261db73d1f), ROM_BIOS(5) ) + ROM_SYSTEM_BIOS(6, "v111", "v1.11") // CRC: e0a6179b when byteswapped + ROMX_LOAD( "mpr-14837.bin", 0x000000, 0x020000, CRC(4be18ff6) SHA1(204758d5a64c24e96e1a9fe6bd82e1878fef7ade), ROM_BIOS(6) ) ROM_END /* Asia bios, when run in USA region will show : diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp index a1534f0771f..2a463844f5d 100644 --- a/src/mame/drivers/naomi.cpp +++ b/src/mame/drivers/naomi.cpp @@ -2922,6 +2922,17 @@ MACHINE_RESET_MEMBER(naomi_state,naomi) naomi_state::machine_reset(); } +WRITE_LINE_MEMBER(naomi_state::external_reset) +{ + // routine called by the dimm board to reboot the naomi mainboard + logerror("Received reset fromm dimm board !\n"); + naomi_state::machine_reset(); + m_maincpu->reset(); + // it will probably need to be adjusted + m_aica->reset(); + m_soundcpu->reset(); +} + /* * Common for Naomi 1, Naomi GD-Rom, Naomi 2, Atomiswave ... */ @@ -3012,6 +3023,7 @@ void naomi_state::naomi(machine_config &config) naomi_rom_board &rom_board(NAOMI_ROM_BOARD(config, "rom_board", 0, "naomibd_eeprom")); rom_board.irq_callback().set(FUNC(dc_state::g1_irq)); rom_board.ext_irq_callback().set(FUNC(dc_state::external_irq)); + rom_board.reset_out_callback().set(FUNC(naomi_state::external_reset)); } /* @@ -3024,6 +3036,7 @@ void naomi_state::naomigd(machine_config &config) naomi_gdrom_board &rom_board(NAOMI_GDROM_BOARD(config, "rom_board", 0, "naomibd_eeprom", ":gdrom", "pic")); rom_board.irq_callback().set(FUNC(dc_state::g1_irq)); rom_board.ext_irq_callback().set(FUNC(dc_state::external_irq)); + rom_board.reset_out_callback().set(FUNC(naomi_state::external_reset)); } /* diff --git a/src/mame/drivers/spg110.cpp b/src/mame/drivers/spg110.cpp index cc61b63037c..80a677f58e7 100644 --- a/src/mame/drivers/spg110.cpp +++ b/src/mame/drivers/spg110.cpp @@ -10,12 +10,13 @@ JAKKS Classic Arcade Pinball JAKKS Spiderman 5-in-1 (original release) Conny TV Virtual Tennis + Conny Ping Pong + Conny TV Virtual Fighter assumed: JAKKS EA Sports (NHL 95 + Madden 95) (US) JAKKS EA Sports (NHL 95 + Fifa 96) (US) JAKKS Bob the Builder - Conny Ping Pong JAKKS Disney (original release) *******************************************************************************/ @@ -532,6 +533,14 @@ ROM_START( conyping ) // MCU (I/O?) read protected TODO: add NO_DUMP ROM_END +ROM_START( conyfght ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD16_WORD_SWAP( "mx29lw320.u2", 0x000000, 0x400000, CRC(515cce2c) SHA1(647cee206d23ff815d01f49cec391701b9a87de9) ) + + // MCU (I/O?) read protected TODO: add NO_DUMP +ROM_END + + // JAKKS Pacific Inc TV games @@ -546,3 +555,6 @@ CONS( 2003, conyteni, 0, 0, spg110_base, conyteni, spg110_game_state, e // from a US SDW Games unit, has SDW Games banners in background so ROM might differ to other regsions CONS( 2003, conyping, 0, 0, spg110_base, conyteni, spg110_game_state, empty_init, "Conny / SDW Games", "Virtual Ping Pong (Conny / SDW Games)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +// from a Big Ben 'TV Virtual Fighter' unit, although shows Free Fight Kung Fu on title screen +// Also sold by SDW Games as both TV Virtual Fighter and TV Kickboxing (unit still has TV Virtual Fighter stickers even when box is TV Kickboxing - possibly just box changed due to Sega?) +CONS( 200?, conyfght, 0, 0, spg110_base, conyteni, spg110_game_state, empty_init, "Conny / Big Ben", "TV Virtual Fighter / Free Fight Kung Fu (Conny / Big Ben)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/splash.cpp b/src/mame/drivers/splash.cpp index 91e53133b3b..501213dc9f5 100644 --- a/src/mame/drivers/splash.cpp +++ b/src/mame/drivers/splash.cpp @@ -360,7 +360,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( funystrp ) PORT_START("DSW1") - PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) + PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4") PORT_DIPSETTING( 0x06, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) @@ -373,7 +373,7 @@ static INPUT_PORTS_START( funystrp ) PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) ) PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) ) PORT_DIPSETTING( 0x00, "1C/1C or Free Play (if Coin B too)" ) - PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) + PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:5,6,7,8") PORT_DIPSETTING( 0x60, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x70, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) ) @@ -388,26 +388,26 @@ static INPUT_PORTS_START( funystrp ) PORT_DIPSETTING( 0x00, "1C/1C or Free Play (if Coin A too)" ) PORT_START("DSW2") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x03, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x02, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) - PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) ) + PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:3,4") PORT_DIPSETTING( 0x04, "1" ) PORT_DIPSETTING( 0x08, "2" ) PORT_DIPSETTING( 0x0c, "3" ) PORT_DIPSETTING( 0x00, "5" ) - PORT_DIPNAME( 0x30, 0x30, "Bonus" ) + PORT_DIPNAME( 0x30, 0x30, "Bonus" ) PORT_DIPLOCATION("SW2:5,6") PORT_DIPSETTING( 0x30, "Bonus Chance HI/LO Cards" ) PORT_DIPSETTING( 0x10, "Life at Stage 10" ) PORT_DIPSETTING( 0x00, "Life at Stage 20" ) PORT_DIPSETTING( 0x20, DEF_STR( None ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPSETTING( 0x40, DEF_STR( Normal ) ) - PORT_DIPNAME( 0x80, 0x80, "Strip Mode" ) + PORT_DIPNAME( 0x80, 0x80, "Strip Mode" ) PORT_DIPLOCATION("SW2:8") PORT_DIPSETTING( 0x80, "Soft" ) PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) diff --git a/src/mame/drivers/teamjocs.cpp b/src/mame/drivers/teamjocs.cpp new file mode 100644 index 00000000000..b9710da9dd1 --- /dev/null +++ b/src/mame/drivers/teamjocs.cpp @@ -0,0 +1,82 @@ +// license:BSD-3-Clause +// copyright-holders: + +/* + TEAM JOCS Grupo Presas + Mod. PELU CPU + ____________________________________________________ + | _____________ _CN5_ _CN2_ _______________ | + | |___CN7______| |____| |____| |____CN4_______| | + | | + |__ ULN2003A ULN2003A | + || | | + || | HC245A 74HC273D 74HC273D __ | + ||C| | || + ||N| M28C17 HC245A HC245A | || + ||6| | || + || | HC245A XTAL | || + || | 4.0000MHz | || + ||_| | || + | PIC17C44-16 | || + |__ 74HC2730 | || + || | | || + || | OKI-M6375 |_|| + ||C| | + ||N| 74HC2730 NM27C010Q __ | + ||3| | || + ||_| HC245A CN10->|_|| + | BATT | + | ______________ ___ ___ | + | |_____________|<-CN8 |__|<-CN12 CN9->|__| | + |___________________________________________________| +*/ + +#include "emu.h" +#include "cpu/pic16c5x/pic16c5x.h" +#include "machine/nvram.h" +#include "sound/okim6376.h" +#include "speaker.h" + + +class teamjocs_state : public driver_device +{ +public: + teamjocs_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { + } + + void teamjocs(machine_config &config); + +private: + + required_device<cpu_device> m_maincpu; +}; + +static INPUT_PORTS_START(teamjocs) +INPUT_PORTS_END + +void teamjocs_state::teamjocs(machine_config &config) +{ + PIC16C55(config, m_maincpu, 4_MHz_XTAL); // actually PIC17C44-16 + + SPEAKER(config, "mono").front_center(); + + OKIM6376(config, "oki", 4_MHz_XTAL); // divided unknown + +} + +ROM_START(diaelite) + ROM_REGION(0x8000, "maincpu", 0) + ROM_LOAD( "elite_3_4_6_pic17c44.ic7", 0x0000, 0x8000, NO_DUMP ) + + ROM_REGION(0x20000, "oki", 0) + ROM_LOAD( "b.ic4", 0x00000, 0x20000, CRC(c8505516) SHA1(cd56e25b57752970f6a0de7e5efdda5527e21019) ) + + ROM_REGION(0x800, "28c17", 0) + ROM_LOAD( "m28c17.ic13", 0x000, 0x800, CRC(4a292b0d) SHA1(1f86e52b52ed53a7a8197e1ee394876dfc51fb91) ) +ROM_END + + +GAME(199?, diaelite, 0, teamjocs, teamjocs, teamjocs_state, empty_init, ROT0, "Recreativos Presas", "Diana Elite", MACHINE_IS_SKELETON_MECHANICAL) diff --git a/src/mame/drivers/testpat.cpp b/src/mame/drivers/testpat.cpp index 78b9e418537..22964d24221 100644 --- a/src/mame/drivers/testpat.cpp +++ b/src/mame/drivers/testpat.cpp @@ -127,8 +127,8 @@ void tp1985_state::tp1985(machine_config &config) SCREEN(config, "screen", SCREEN_TYPE_RASTER); FIXFREQ(config, m_video).set_screen("screen"); m_video->set_monitor_clock(MASTER_CLOCK); - m_video->set_horz_params(H_TOTAL_PONG-64,H_TOTAL_PONG-40,H_TOTAL_PONG-8,H_TOTAL_PONG); - m_video->set_vert_params(V_TOTAL_PONG-19,V_TOTAL_PONG-16,V_TOTAL_PONG-12,V_TOTAL_PONG); + m_video->set_horz_params(H_TOTAL_PONG-80,H_TOTAL_PONG-56,H_TOTAL_PONG-8,H_TOTAL_PONG); + m_video->set_vert_params(V_TOTAL_PONG-19,V_TOTAL_PONG-15,V_TOTAL_PONG-12,V_TOTAL_PONG); m_video->set_fieldcount(1); m_video->set_threshold(1); m_video->set_gain(0.36); diff --git a/src/mame/drivers/ut88.cpp b/src/mame/drivers/ut88.cpp index 6fe1196a35c..65fc7f4d060 100644 --- a/src/mame/drivers/ut88.cpp +++ b/src/mame/drivers/ut88.cpp @@ -38,15 +38,15 @@ static GFXDECODE_START( gfx_ut88 ) GFXDECODE_END /* Address maps */ -void ut88_state::ut88mini_mem(address_map &map) +void ut88mini_state::mem_map(address_map &map) { map.unmap_value_high(); map(0x0000, 0x03ff).rom(); // System ROM map(0xc000, 0xc3ff).ram(); // RAM - map(0x9000, 0x9fff).w(FUNC(ut88_state::ut88mini_write_led)); // 7seg LED + map(0x9000, 0x9fff).w(FUNC(ut88mini_state::led_w)); // 7seg LED } -void ut88_state::ut88_mem(address_map &map) +void ut88_state::mem_map(address_map &map) { map(0x0000, 0x07ff).bankrw("bank1"); // First bank map(0x0800, 0xdfff).ram(); // RAM @@ -56,16 +56,16 @@ void ut88_state::ut88_mem(address_map &map) map(0xf800, 0xffff).rom(); // System ROM } -void ut88_state::ut88mini_io(address_map &map) +void ut88mini_state::io_map(address_map &map) { - map(0xA0, 0xA0).r(FUNC(ut88_state::ut88mini_keyboard_r)); - map(0xA1, 0xA1).r(FUNC(ut88_state::ut88_tape_r)); + map(0xA0, 0xA0).r(FUNC(ut88mini_state::keyboard_r)); + map(0xA1, 0xA1).r(FUNC(ut88mini_state::tape_r)); } -void ut88_state::ut88_io(address_map &map) +void ut88_state::io_map(address_map &map) { - map(0x04, 0x07).rw(FUNC(ut88_state::ut88_keyboard_r), FUNC(ut88_state::ut88_keyboard_w)); - map(0xA1, 0xA1).rw(FUNC(ut88_state::ut88_tape_r), FUNC(ut88_state::ut88_sound_w)); + map(0x04, 0x07).rw(FUNC(ut88_state::keyboard_r), FUNC(ut88_state::keyboard_w)); + map(0xA1, 0xA1).rw(FUNC(ut88_state::tape_r), FUNC(ut88_state::sound_w)); } /* Input ports */ @@ -191,9 +191,8 @@ void ut88_state::ut88(machine_config &config) { /* basic machine hardware */ I8080(config, m_maincpu, 2000000); - m_maincpu->set_addrmap(AS_PROGRAM, &ut88_state::ut88_mem); - m_maincpu->set_addrmap(AS_IO, &ut88_state::ut88_io); - MCFG_MACHINE_RESET_OVERRIDE(ut88_state, ut88 ) + m_maincpu->set_addrmap(AS_PROGRAM, &ut88_state::mem_map); + m_maincpu->set_addrmap(AS_IO, &ut88_state::io_map); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); @@ -201,11 +200,9 @@ void ut88_state::ut88(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ screen.set_size(64*8, 28*8); screen.set_visarea(0, 64*8-1, 0, 28*8-1); - screen.set_screen_update(FUNC(ut88_state::screen_update_ut88)); + screen.set_screen_update(FUNC(ut88_state::screen_update)); screen.set_palette(m_palette); - MCFG_VIDEO_START_OVERRIDE(ut88_state,ut88) - PALETTE(config, m_palette, palette_device::MONOCHROME); GFXDECODE(config, m_gfxdecode, m_palette, gfx_ut88); @@ -217,9 +214,9 @@ void ut88_state::ut88(machine_config &config) /* Devices */ I8255A(config, m_ppi); - m_ppi->out_pa_callback().set(FUNC(ut88_state::ut88_8255_porta_w)); - m_ppi->in_pb_callback().set(FUNC(ut88_state::ut88_8255_portb_r)); - m_ppi->in_pc_callback().set(FUNC(ut88_state::ut88_8255_portc_r)); + m_ppi->out_pa_callback().set(FUNC(ut88_state::ppi_porta_w)); + m_ppi->in_pb_callback().set(FUNC(ut88_state::ppi_portb_r)); + m_ppi->in_pc_callback().set(FUNC(ut88_state::ppi_portc_r)); CASSETTE(config, m_cassette); m_cassette->set_formats(rku_cassette_formats); @@ -230,14 +227,12 @@ void ut88_state::ut88(machine_config &config) SOFTWARE_LIST(config, "cass_list").set_original("ut88"); } -void ut88_state::ut88mini(machine_config &config) +void ut88mini_state::ut88mini(machine_config &config) { /* basic machine hardware */ I8080(config, m_maincpu, 2000000); - m_maincpu->set_addrmap(AS_PROGRAM, &ut88_state::ut88mini_mem); - m_maincpu->set_addrmap(AS_IO, &ut88_state::ut88mini_io); - MCFG_MACHINE_START_OVERRIDE(ut88_state,ut88mini) - MCFG_MACHINE_RESET_OVERRIDE(ut88_state, ut88mini ) + m_maincpu->set_addrmap(AS_PROGRAM, &ut88mini_state::mem_map); + m_maincpu->set_addrmap(AS_IO, &ut88mini_state::io_map); /* video hardware */ config.set_default_layout(layout_ut88mini); @@ -272,6 +267,6 @@ ROM_END /* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1989, ut88mini, 0, 0, ut88mini, ut88mini, ut88_state, init_ut88mini, "<unknown>", "UT-88 mini", 0) -COMP( 1989, ut88, ut88mini, 0, ut88, ut88, ut88_state, init_ut88, "<unknown>", "UT-88", 0) +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1989, ut88mini, 0, 0, ut88mini, ut88mini, ut88mini_state, empty_init, "<unknown>", "UT-88 mini", 0) +COMP( 1989, ut88, ut88mini, 0, ut88, ut88, ut88_state, empty_init, "<unknown>", "UT-88", 0) diff --git a/src/mame/drivers/v6809.cpp b/src/mame/drivers/v6809.cpp index 96b80f7414f..304514441f6 100644 --- a/src/mame/drivers/v6809.cpp +++ b/src/mame/drivers/v6809.cpp @@ -86,6 +86,8 @@ public: void v6809(machine_config &config); private: + virtual void machine_reset() override; + DECLARE_WRITE_LINE_MEMBER(speaker_en_w); DECLARE_WRITE_LINE_MEMBER(speaker_w); DECLARE_READ8_MEMBER(pb_r); @@ -94,7 +96,6 @@ private: DECLARE_WRITE8_MEMBER(v6809_address_w); DECLARE_WRITE8_MEMBER(v6809_register_w); void kbd_put(u8 data); - DECLARE_MACHINE_RESET(v6809); MC6845_UPDATE_ROW(crtc_update_row); MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr); @@ -139,7 +140,7 @@ void v6809_state::v6809_mem(address_map &map) static INPUT_PORTS_START( v6809 ) INPUT_PORTS_END -MACHINE_RESET_MEMBER( v6809_state, v6809) +void v6809_state::machine_reset() { m_term_data = 0; m_pia0->cb1_w(1); @@ -287,7 +288,6 @@ void v6809_state::v6809(machine_config &config) /* basic machine hardware */ MC6809(config, m_maincpu, 16_MHz_XTAL / 4); // divided by 4 again internally m_maincpu->set_addrmap(AS_PROGRAM, &v6809_state::v6809_mem); - MCFG_MACHINE_RESET_OVERRIDE(v6809_state, v6809) /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); diff --git a/src/mame/drivers/vii.cpp b/src/mame/drivers/vii.cpp index 27dfeca5575..bbd55369e52 100644 --- a/src/mame/drivers/vii.cpp +++ b/src/mame/drivers/vii.cpp @@ -195,6 +195,7 @@ public: void init_crc(); void init_zeus(); void init_taikeegr(); + void init_wiwi18(); protected: virtual void machine_start() override; @@ -1509,6 +1510,114 @@ static INPUT_PORTS_START( rad_sktv ) PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END +static INPUT_PORTS_START( wiwi18 ) + PORT_START("P1") + PORT_DIPNAME( 0x0001, 0x0001, "IN0" ) + PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) + 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( Unknown ) ) + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + 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, "Possible Input" ) + PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + + + PORT_START("P2") + PORT_DIPNAME( 0x0001, 0x0001, "IN1" ) + PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) + 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( Unknown ) ) + PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + 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( 0x1000, 0x1000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + + + PORT_START("P3") + PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_CUSTOM ) // NTSC (1) / PAL (0) flag +INPUT_PORTS_END + + static INPUT_PORTS_START( mattelcs ) // there is a 'secret test mode' that previously got activated before inputs were mapped, might need unused inputs to active? PORT_START("P1") PORT_BIT( 0x0007, IP_ACTIVE_LOW, IPT_UNUSED ) // must be IP_ACTIVE_LOW or you can't switch to Football properly? @@ -4029,6 +4138,11 @@ ROM_START( shredmjr ) ROM_LOAD16_WORD_SWAP( "shredmasterjr.bin", 0x000000, 0x800000, CRC(95a6dcf1) SHA1(44893cd6ebe6b7f33a73817b72ae7be70c3126dc) ) ROM_END +ROM_START( wiwi18 ) + ROM_REGION( 0x1000000, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD16_WORD_SWAP( "26gl128.bin", 0x000000, 0x1000000, CRC(0b103ac9) SHA1(14434908f429942096fb8db5b5630603fd54fb2c) ) +ROM_END + ROM_START( sentx6p ) ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASE00 ) @@ -4157,6 +4271,15 @@ void wireless60_state::init_lx_jg7415() m_bankmask = 0xf; } +void spg2xx_game_state::init_wiwi18() +{ + uint16_t* rom = (uint16_t*)memregion("maincpu")->base(); + rom[0x1ca259] = 0xf165; +} + + + + // year, name, parent, compat, machine, input, class, init, company, fullname, flags @@ -4249,4 +4372,8 @@ CONS( 2007, shredmjr, taikeegr, 0, shredmjr, taikeegr, shredmjr_ga // a 'deluxe' version of this also exists with extra game modes CONS( 2004, sentx6p, 0, 0, sentx6p, sentx6p, sentx6p_state, empty_init, "Senario / Play Vision", "Vs Maxx Texas Hold'em TV Poker - 6 Player Edition (UK)", MACHINE_NOT_WORKING | MACHINE_CLICKABLE_ARTWORK | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // from a UK Play Vision branded box, values in GBP +// box marked 'Wireless game console' 'Drahtlose Spielekonsole' 87 Sports games included : 18 hyper sports games, 69 arcade games. +// Unit marked 'Hamy System' 'WiWi' +// actually a cartridge, but all hardware is in the cart, overriding any internal hardware entirely. see nes_vt.cp 'mc_sp69' for the '69 arcade game' part +CONS( 200?, wiwi18, 0, 0, rad_skat, wiwi18, spg2xx_game_state, init_wiwi18, "Hamy System", "WiWi 18-in-1 Sports Game", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/xavix.cpp b/src/mame/drivers/xavix.cpp index 8de87d92bf2..3abcf19495a 100644 --- a/src/mame/drivers/xavix.cpp +++ b/src/mame/drivers/xavix.cpp @@ -103,12 +103,12 @@ 10 Evio /TOMY/Japan - - - - - - dumped (some carts not dumped tho) 11 Together Minimoni,Jumping Party! /EPOCH/Japan - - - - - - - 12 Hamutaro TV computer /EPOCH/Japan - - - - - - - - 13 Jara-Ja Land /TAKARA/Japan - - - - - - - (is this the home release of Jala Jaland /atlus/Japan above?) - 14 Tomika, Draiving by Car navigation system /TOMY/Japan - - - - - - - + 13 Jara-Ja Land /TAKARA/Japan - - - - - - dumped (is this the home release of Jala Jaland /atlus/Japan above?) + 14 Tomika, Draiving by Car navigation system /TOMY/Japan - - - - - - dumped 15 PLAY TV Rescue Heroes /RADICA/USA 73036 x8 48 2M none SSD 98 PL7351-181 dumped 16 PLAY TV Huntin' 2 /RADICA/USA 73030 x8 none none SSD 98 PL7351-181 dumped 17 Let's play Ping-pong. Exciting pingpong2 /EPOCH/Japan - - - - - - - - 18 Cartridge for Slot machine TV "King of wild animal" /TAKARA/Japan - - - - - - - + 18 Cartridge for Slot machine TV "King of wild animal" /TAKARA/Japan - - - - - - *** maybe dumped? ** Is this one dumped, or the Jr version below** 19 ChyoroQ "Burning up Racer /TAKARA/Japan - - - - - - - 20 Super shot! Exciting golf /EPOCH/Japan - - - - - - - 21 PichiPichi Pitchi /TAKARA/Japan - - - - - - dumped (same as e-kara Japan) @@ -117,7 +117,7 @@ 24 Let's fish a big one. Exciting fishing! /EPOCH/Japan - - - - - - - 25 Champion Pinball /TOMY/Japan - - - - - - - 26 Excite Fishing DX EF2J x8 48 4M 24C08 SSD 98 PL7351-181 dumped - 2002 1 Accessory cartridge for Slot machine "Gin-gin maru TV" /TAKARA/Japan - - - - - - - + 2002 1 Accessory cartridge for Slot machine "Gin-gin maru TV" /TAKARA/Japan - - - - - - dumped 2 Wildest computer robot "Daigander" (Korean version) /TAKARA/Korea - - - - - - - 3 Hamutaro's circus /EPOCH/Japan - - - - - - - 4 Doraemon Wakuwaku Kuukihou /EPOCH/Japan - x8 - - - - dumped @@ -137,7 +137,7 @@ 18 Starter set for e-kara N "Morning sisters" /TAKARA/Japan - - - - - - - 19 e-kara /Hasbro/England - - - - - - dumped? (if same as one of the 'US' sets?) 20 e-kara /Takara USA/USA - - - - - - dumped? (or #10 below, this might be ekaraa set with improved text) - 21 PLAY TV Soccer /RADICA/USA 76088500 x8 none none SSD 98 PA7351-107 have + 21 PLAY TV Soccer /RADICA/USA 76088500 x8 none none SSD 98 PA7351-107 dumped 22 PLAY TV Jr. Construction /RADICA/USA - - - - - - - 23 PLAY TV Boxing /RADICA/Japan 72039 x8 48 2M none SSD 98 PA7351-107 dumped 24 PLAY TV Baseball 2 /RADICA/USA 72042 x8 48 2M none SSD 98 PL7351-181 dumped @@ -146,7 +146,7 @@ 27 e-kara N /EPOCH/Japan - - - - - - - 28 Who's the ace? Excite Tennis /EPOCH/Japan - - - - - - - 29 Wildest computer robot, "Daigander" /TAKARA/Japan - - - - - - - - 30 Cartridge for Slot machine TV "King of wild animal Jr." /TAKARA/Japan - - - - - - dumped? (cart) + 30 Cartridge for Slot machine TV "King of wild animal Jr." /TAKARA/Japan - - - - - - *** maybe dumped? ** Is this one dumped, or the non-Jr version above** 31 Gachinko Contest! Slot machine TV /DCT/Japan - - - - - - dumped 32 Beyblade Ultimate shooter /TAKARA/Japan - - - - - - - 2001 1 Ping-pong(Chinese version) /Tenpon/China - - - - - - - @@ -1230,6 +1230,65 @@ static INPUT_PORTS_START( gcslottv ) // TODO: proper button names PORT_DIPSETTING( 0x80, DEF_STR( On ) ) INPUT_PORTS_END +static INPUT_PORTS_START( jarajal ) + PORT_INCLUDE(xavix) + + PORT_MODIFY("IN0") + PORT_DIPNAME( 0x01, 0x00, "IN0" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + + + PORT_MODIFY("IN1") + PORT_DIPNAME( 0x01, 0x00, "IN1" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) + +INPUT_PORTS_END + + /* correct, 4bpp gfxs */ static const gfx_layout charlayout = { @@ -1322,7 +1381,6 @@ void xavix_state::xavix(machine_config &config) m_screen->set_screen_update(FUNC(xavix_state::screen_update)); m_screen->set_size(32*8, 32*8); m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1); - m_screen->set_palette(m_palette); //m_screen->set_video_attributes(VIDEO_UPDATE_SCANLINE); GFXDECODE(config, m_gfxdecode, m_palette, gfx_xavix); @@ -1550,7 +1608,7 @@ void xavix_cart_state::xavix_cart_evio(machine_config &config) SOFTWARE_LIST(config, "cart_list_evio").set_original("evio"); } -void xavix_cart_state::xavix_cart_gcslottv(machine_config &config) +void xavix_cart_gcslottv_state::xavix_cart_gcslottv(machine_config &config) { xavix_cart(config); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); @@ -1866,6 +1924,16 @@ ROM_START( tak_geig ) ROM_LOAD("geigeki.bin", 0x000000, 0x400000, CRC(bd0c3576) SHA1(06f614dbec0225ce4ed866b98450912986d72faf) ) ROM_END +ROM_START( jarajal ) + ROM_REGION(0x200000, "bios", ROMREGION_ERASE00) + ROM_LOAD("takaraslots.bin", 0x000000, 0x200000, CRC(afae0b72) SHA1(b1c5d80a8dc8466982efd79d54cd82a58f0ff997) ) +ROM_END + +ROM_START( tcarnavi ) + ROM_REGION(0x400000, "bios", ROMREGION_ERASE00) + ROM_LOAD("navi.bin", 0x000000, 0x400000, CRC(f4e693fb) SHA1(be37b35f1e1e661e10187253c2c3aa9858a90812) ) +ROM_END + /* The e-kara cartridges require the BIOS rom to map into 2nd external bus space as they fetch palette data from it etc. @@ -2054,6 +2122,12 @@ CONS( 2002, epo_dmon, 0, 0, xavix_i2c_24c02, xavix_i2c,xavix_i2c_sta CONS( 200?, has_wamg, 0, 0, xavix, has_wamg, xavix_state, init_xavix, "Hasbro / Milton Bradley / SSD Company LTD", "TV Wild Adventure Mini Golf (NTSC)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) CONS( 2002, tak_geig, 0, 0, xavix_nv, tak_geig, xavix_state, init_xavix, "Takara / SSD Company LTD", "Geigeki Go Go Shooting (Japan)", MACHINE_IMPERFECT_SOUND ) + +// was also distributed by Atlus as an arcade cabinet in 2005, ROM almost certainly different (this one will auto-power off after inactivity, an arcade wouldn't do that) +CONS( 2003, jarajal, 0, 0, xavix_nv, jarajal, xavix_state, init_xavix, "Takara / SSD Company LTD", "Jara-Ja Land (Japan, home version)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) + +CONS( 2003, tcarnavi, 0, 0, xavix_nv, jarajal, xavix_state, init_xavix, "Tomy / SSD Company LTD", "Tomica Carnavi Drive (Japan)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) + /* Music titles: Emulation note: SEEPROM write appears to work (save NVRAM file looks valid) but game fails to read it back properly, fails backup data checksum, and blanks it again. @@ -2086,7 +2160,7 @@ CONS( 2004, jpopira, 0, 0, xavix_i2c_jpopira,jpopira, xavix_i2c_car CONS( 2003, evio, 0, 0, xavix_cart_evio, evio, xavix_cart_state, init_xavix, "Tomy / SSD Company LTD", "Evio (Japan)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND /*|MACHINE_IS_BIOS_ROOT*/ ) // inputs? it's a violin controller -CONS( 2002, gcslottv, 0, 0, xavix_cart_gcslottv, gcslottv, xavix_cart_state, init_xavix, "Takara / Sammy / DCT / SSD Company LTD", "Gachinko Contest! Slot machine TV (Japan)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND /*|MACHINE_IS_BIOS_ROOT*/ ) +CONS( 2002, gcslottv, 0, 0, xavix_cart_gcslottv, gcslottv, xavix_cart_gcslottv_state, init_xavix, "Takara / Sammy / DCT / SSD Company LTD", "Gachinko Contest! Slot machine TV (Japan)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND /*|MACHINE_IS_BIOS_ROOT*/ ) diff --git a/src/mame/includes/goldstar.h b/src/mame/includes/goldstar.h index 1dba9e1ccd4..cb7e163f923 100644 --- a/src/mame/includes/goldstar.h +++ b/src/mame/includes/goldstar.h @@ -184,6 +184,7 @@ public: void init_tcl(); void init_super7(); void init_chthree(); + void init_wcat3a(); uint32_t screen_update_amcoe1a(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); diff --git a/src/mame/includes/naomi.h b/src/mame/includes/naomi.h index 11160f45f98..9c6a3173851 100644 --- a/src/mame/includes/naomi.h +++ b/src/mame/includes/naomi.h @@ -79,6 +79,7 @@ protected: optional_ioport_array<5> m_mp; DECLARE_MACHINE_RESET(naomi); + DECLARE_WRITE_LINE_MEMBER(external_reset); DECLARE_READ16_MEMBER( naomi_g2bus_r ); DECLARE_READ64_MEMBER( eeprom_93c46a_r ); diff --git a/src/mame/includes/ut88.h b/src/mame/includes/ut88.h index eb29fc92666..3a19639d0cb 100644 --- a/src/mame/includes/ut88.h +++ b/src/mame/includes/ut88.h @@ -16,90 +16,123 @@ #include "imagedev/cassette.h" #include "emupal.h" - -class ut88_state : public driver_device +class ut88_base_state : public driver_device { public: - ut88_state(const machine_config &mconfig, device_type type, const char *tag) + ut88_base_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_cassette(*this, "cassette") - , m_ppi(*this, "ppi8255") - , m_dac(*this, "dac") - , m_p_videoram(*this, "videoram") , m_region_maincpu(*this, "maincpu") - , m_region_proms(*this, "proms") - , m_bank1(*this, "bank1") , m_io_line0(*this, "LINE0") , m_io_line1(*this, "LINE1") , m_io_line2(*this, "LINE2") + , m_maincpu(*this, "maincpu") + { + } + +protected: + DECLARE_READ8_MEMBER(tape_r); + + required_device<cassette_image_device> m_cassette; + required_memory_region m_region_maincpu; + required_ioport m_io_line0; + required_ioport m_io_line1; + required_ioport m_io_line2; + required_device<cpu_device> m_maincpu; +}; + +class ut88_state : public ut88_base_state +{ +public: + ut88_state(const machine_config &mconfig, device_type type, const char *tag) + : ut88_base_state(mconfig, type, tag) + , m_ppi(*this, "ppi8255") + , m_dac(*this, "dac") + , m_p_videoram(*this, "videoram") + , m_bank1(*this, "bank1") , m_io_line3(*this, "LINE3") , m_io_line4(*this, "LINE4") , m_io_line5(*this, "LINE5") , m_io_line6(*this, "LINE6") , m_io_line7(*this, "LINE7") , m_io_line8(*this, "LINE8") - , m_maincpu(*this, "maincpu") , m_gfxdecode(*this, "gfxdecode") , m_palette(*this, "palette") - , m_digits(*this, "digit%u", 0U) { } void ut88(machine_config &config); - void ut88mini(machine_config &config); - - void init_ut88(); - void init_ut88mini(); private: + virtual void driver_init() override; + virtual void machine_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + enum { TIMER_RESET, TIMER_UPDATE_DISPLAY }; - DECLARE_READ8_MEMBER(ut88_keyboard_r); - DECLARE_WRITE8_MEMBER(ut88_keyboard_w); - DECLARE_WRITE8_MEMBER(ut88_sound_w); - DECLARE_READ8_MEMBER(ut88_tape_r); - DECLARE_READ8_MEMBER(ut88mini_keyboard_r); - DECLARE_WRITE8_MEMBER(ut88mini_write_led); - DECLARE_READ8_MEMBER(ut88_8255_portb_r); - DECLARE_READ8_MEMBER(ut88_8255_portc_r); - DECLARE_WRITE8_MEMBER(ut88_8255_porta_w); - DECLARE_MACHINE_RESET(ut88); - DECLARE_VIDEO_START(ut88); - DECLARE_MACHINE_START(ut88mini); - DECLARE_MACHINE_RESET(ut88mini); - uint32_t screen_update_ut88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - void ut88_io(address_map &map); - void ut88_mem(address_map &map); - void ut88mini_io(address_map &map); - void ut88mini_mem(address_map &map); + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(keyboard_w); + DECLARE_WRITE8_MEMBER(sound_w); + DECLARE_READ8_MEMBER(ppi_portb_r); + DECLARE_READ8_MEMBER(ppi_portc_r); + DECLARE_WRITE8_MEMBER(ppi_porta_w); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void io_map(address_map &map); + void mem_map(address_map &map); - required_device<cassette_image_device> m_cassette; - optional_device<i8255_device> m_ppi; - optional_device<dac_bit_interface> m_dac; - optional_shared_ptr<uint8_t> m_p_videoram; int m_keyboard_mask; + + required_device<i8255_device> m_ppi; + required_device<dac_bit_interface> m_dac; + required_shared_ptr<uint8_t> m_p_videoram; + required_memory_bank m_bank1; + required_ioport m_io_line3; + required_ioport m_io_line4; + required_ioport m_io_line5; + required_ioport m_io_line6; + required_ioport m_io_line7; + required_ioport m_io_line8; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; +}; + +class ut88mini_state : public ut88_base_state +{ +public: + ut88mini_state(const machine_config &mconfig, device_type type, const char *tag) + : ut88_base_state(mconfig, type, tag) + , m_region_proms(*this, "proms") + , m_digits(*this, "digit%u", 0U) + { } + + void ut88mini(machine_config &config); + +private: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + + void io_map(address_map &map); + void mem_map(address_map &map); + + enum + { + TIMER_RESET, + TIMER_UPDATE_DISPLAY + }; + + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(led_w); + + required_memory_region m_region_proms; + int m_lcd_digit[6]; - required_memory_region m_region_maincpu; - optional_memory_region m_region_proms; - optional_memory_bank m_bank1; - required_ioport m_io_line0; - required_ioport m_io_line1; - required_ioport m_io_line2; - optional_ioport m_io_line3; - optional_ioport m_io_line4; - optional_ioport m_io_line5; - optional_ioport m_io_line6; - optional_ioport m_io_line7; - optional_ioport m_io_line8; - required_device<cpu_device> m_maincpu; - optional_device<gfxdecode_device> m_gfxdecode; - optional_device<palette_device> m_palette; output_finder<6> m_digits; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; }; /*----------- defined in video/ut88.c -----------*/ diff --git a/src/mame/includes/xavix.h b/src/mame/includes/xavix.h index e56d50f1fbc..aaf553f6c36 100644 --- a/src/mame/includes/xavix.h +++ b/src/mame/includes/xavix.h @@ -199,7 +199,7 @@ protected: private: // screen updates - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void xavix_map(address_map &map); @@ -534,11 +534,11 @@ private: required_device<gfxdecode_device> m_gfxdecode; void update_pen(int pen, uint8_t shval, uint8_t lval); - void draw_tile_line(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int tile, int bpp, int xpos, int ypos, int drawheight, int drawwidth, int flipx, int flipy, int pal, int zval, int line); - void draw_tilemap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which); - void draw_tilemap_line(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int line); - void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites_line(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int line); + void draw_tile_line(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int tile, int bpp, int xpos, int ypos, int drawheight, int drawwidth, int flipx, int flipy, int pal, int zval, int line); + void draw_tilemap(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int which); + void draw_tilemap_line(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int which, int line); + void draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void draw_sprites_line(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int line); void decode_inline_header(int &flipx, int &flipy, int &test, int& pal, int debug_packets); bitmap_ind16 m_zbuffer; @@ -752,17 +752,18 @@ protected: class xavix_cart_state : public xavix_state { public: - xavix_cart_state(const machine_config &mconfig, device_type type, const char *tag) - : xavix_state(mconfig, type, tag), + xavix_cart_state(const machine_config &mconfig, device_type type, const char *tag) : + xavix_state(mconfig, type, tag), m_cartslot(*this, "cartslot") - { } + { + m_cartlimit = 0x400000; + } void xavix_cart(machine_config &config); void xavix_cart_ekara(machine_config &config); void xavix_cart_popira(machine_config &config); void xavix_cart_ddrfammt(machine_config &config); void xavix_cart_evio(machine_config &config); - void xavix_cart_gcslottv(machine_config &config); protected: @@ -772,7 +773,7 @@ protected: { if (offset & 0x8000) { - if (offset & 0x400000) + if ((offset & 0x7fffff) >= m_cartlimit) { return m_rgn[(offset) & (m_rgnlen - 1)]; } @@ -796,7 +797,7 @@ protected: virtual uint8_t opcodes_800000_r(offs_t offset) override { - if (offset & 0x400000) + if ((offset & 0x7fffff) >= m_cartlimit) { return m_rgn[(offset) & (m_rgnlen - 1)]; } @@ -839,7 +840,7 @@ protected: } else { - if (offset & 0x400000) + if ((offset & 0x7fffff) >= m_cartlimit) { return m_rgn[(offset) & (m_rgnlen - 1)]; } @@ -882,7 +883,7 @@ protected: if (databank >= 0x80) { - if (offset & 0x400000) + if ((offset & 0x7fffff) >= m_cartlimit) { return m_rgn[(offset) & (m_rgnlen - 1)]; } @@ -902,7 +903,7 @@ protected: { if ((offset & 0xffff) >= 0x8000) { - if (offset & 0x400000) + if ((offset & 0x7fffff) >= m_cartlimit) { return m_rgn[(offset) & (m_rgnlen - 1)]; } @@ -925,9 +926,25 @@ protected: } } + int m_cartlimit; required_device<ekara_cart_slot_device> m_cartslot; }; + +class xavix_cart_gcslottv_state : public xavix_cart_state +{ +public: + xavix_cart_gcslottv_state(const machine_config &mconfig, device_type type, const char *tag) : + xavix_cart_state(mconfig, type, tag) + { + m_cartlimit = 0x800000; + } + + void xavix_cart_gcslottv(machine_config &config); + +protected: +}; + class xavix_i2c_cart_state : public xavix_cart_state { public: diff --git a/src/mame/machine/naomigd.cpp b/src/mame/machine/naomigd.cpp index 99463c8cc07..9468b4edcc8 100644 --- a/src/mame/machine/naomigd.cpp +++ b/src/mame/machine/naomigd.cpp @@ -1070,13 +1070,12 @@ ROM_START( dimm ) // dynamically filled with data ROM_REGION(0x1000, "pic", ROMREGION_ERASE00) - // filled with test data until actual dumps of serial memories are available ROM_REGION(0x80, "i2c_0", ROMREGION_ERASE00) - ROM_FILL(0, 1, 0x40) ROM_FILL(1, 1, 0x00) ROM_FILL(2, 1, 0x01) ROM_FILL(3, 1, 0x02) ROM_FILL(4, 1, 0x03) + ROM_LOAD("dimmspd.bin", 0x00, 0x80, CRC(45dac6d7) SHA1(4548675f8d31348fa6828d5b4f247af1f072b62d)) ROM_REGION(0x80, "i2c_1", ROMREGION_ERASE00) - ROM_FILL(0, 1, 0x40) ROM_FILL(1, 1, 0x80) ROM_FILL(2, 1, 0x81) ROM_FILL(3, 1, 0x82) ROM_FILL(4, 1, 0x83) + ROM_LOAD("dimmspd.bin", 0x00, 0x80, CRC(45dac6d7) SHA1(4548675f8d31348fa6828d5b4f247af1f072b62d)) ROM_REGION(0x80, "eeprom", ROMREGION_ERASE00) - ROM_FILL(0, 1, 'M') ROM_FILL(1, 1, 'A') ROM_FILL(2, 1, 'M') ROM_FILL(3, 1, 'E') ROM_FILL(4, 12, 0x20) + ROM_LOAD("93c46.bin", 0x00, 0x80, CRC(daafbccd) SHA1(1e39983779a62ebc6801ec6f2a5138717a7a5259)) ROM_END const tiny_rom_entry *naomi_gdrom_board::device_rom_region() const diff --git a/src/mame/machine/nl_stuntcyc.cpp b/src/mame/machine/nl_stuntcyc.cpp index 37a4f639568..8d534fb2312 100644 --- a/src/mame/machine/nl_stuntcyc.cpp +++ b/src/mame/machine/nl_stuntcyc.cpp @@ -12,8 +12,8 @@ NETLIST_START(stuntcyc) SOLVER(Solver, 48000) + PARAM(Solver.PARALLEL, 0) // Don't do parallel solvers - PARAM(Solver.ACCURACY, 1e-4) // works and is sufficient PARAM(NETLIST.USE_DEACTIVATE, 1) ANALOG_INPUT(V5, 5) @@ -22,8 +22,8 @@ NETLIST_START(stuntcyc) TTL_INPUT(high, 1) TTL_INPUT(low, 0) - MAINCLOCK(main_clk, 14258400) - //MAINCLOCK(main_clk, 14318181) + //MAINCLOCK(main_clk, 14258400) + MAINCLOCK(main_clk, 14318000) ALIAS(Y1, main_clk) #if 1 @@ -326,6 +326,10 @@ NETLIST_START(stuntcyc) NET_C(R15.1, E4_2.Q) //RES(R107, RES_K(1)) + // FIXME: Having the diode in the video output has a negative impact + // on performance. A "fast-but-not-perfect" approach could + // use a switched resistor. + DIODE(D17, "1N914") NET_C(D17.K, COMP_SYNC_Q) //NET_C(D17.A, R107.1, R13.2, R14.2, R15.2) diff --git a/src/mame/machine/ut88.cpp b/src/mame/machine/ut88.cpp index 0f7b2c09d14..da3f4687010 100644 --- a/src/mame/machine/ut88.cpp +++ b/src/mame/machine/ut88.cpp @@ -25,69 +25,69 @@ static const uint8_t hex_to_7seg[16] = /* Driver initialization */ -void ut88_state::init_ut88() +void ut88_state::driver_init() { /* set initially ROM to be visible on first bank */ - uint8_t *RAM = m_region_maincpu->base(); - memset(RAM,0x0000,0x0800); // make first page empty by default - m_bank1->configure_entries(1, 2, RAM, 0x0000); - m_bank1->configure_entries(0, 2, RAM, 0xf800); + uint8_t *ram = m_region_maincpu->base(); + memset(ram, 0x0000, 0x0800); // make first page empty by default + m_bank1->configure_entries(1, 2, ram, 0x0000); + m_bank1->configure_entries(0, 2, ram, 0xf800); } void ut88_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - switch (id) + if (id == TIMER_RESET) { - case TIMER_RESET: m_bank1->set_entry(0); - break; - case TIMER_UPDATE_DISPLAY: - for (int i=0;i<6;i++) + } +} + +void ut88mini_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (id == TIMER_UPDATE_DISPLAY) + { + for (int i = 0; i < 6; i++) m_digits[i] = hex_to_7seg[m_lcd_digit[i]]; timer_set(attotime::from_hz(60), TIMER_UPDATE_DISPLAY); - break; - default: - throw emu_fatalerror("Unknown id in ut88_state::device_timer"); } } - -READ8_MEMBER( ut88_state::ut88_8255_portb_r ) +READ8_MEMBER( ut88_state::ppi_portb_r ) { uint8_t data = 0xff; - if ( m_keyboard_mask & 0x01 ) + if (BIT(m_keyboard_mask, 0)) data &= m_io_line0->read(); - if ( m_keyboard_mask & 0x02 ) + if (BIT(m_keyboard_mask, 1)) data &= m_io_line1->read(); - if ( m_keyboard_mask & 0x04 ) + if (BIT(m_keyboard_mask, 2)) data &= m_io_line2->read(); - if ( m_keyboard_mask & 0x08 ) + if (BIT(m_keyboard_mask, 3)) data &= m_io_line3->read(); - if ( m_keyboard_mask & 0x10 ) + if (BIT(m_keyboard_mask, 4)) data &= m_io_line4->read(); - if ( m_keyboard_mask & 0x20 ) + if (BIT(m_keyboard_mask, 5)) data &= m_io_line5->read(); - if ( m_keyboard_mask & 0x40 ) + if (BIT(m_keyboard_mask, 6)) data &= m_io_line6->read(); - if ( m_keyboard_mask & 0x80 ) + if (BIT(m_keyboard_mask, 7)) data &= m_io_line7->read(); return data; } -READ8_MEMBER( ut88_state::ut88_8255_portc_r ) +READ8_MEMBER( ut88_state::ppi_portc_r ) { return m_io_line8->read(); } -WRITE8_MEMBER( ut88_state::ut88_8255_porta_w ) +WRITE8_MEMBER( ut88_state::ppi_porta_w ) { m_keyboard_mask = data ^ 0xff; } -MACHINE_RESET_MEMBER(ut88_state,ut88) +void ut88_state::machine_reset() { timer_set(attotime::from_usec(10), TIMER_RESET); m_bank1->set_entry(1); @@ -95,31 +95,31 @@ MACHINE_RESET_MEMBER(ut88_state,ut88) } -READ8_MEMBER( ut88_state::ut88_keyboard_r ) +READ8_MEMBER( ut88_state::keyboard_r ) { - return m_ppi->read(offset^0x03); + return m_ppi->read(offset ^ 0x03); } -WRITE8_MEMBER( ut88_state::ut88_keyboard_w ) +WRITE8_MEMBER( ut88_state::keyboard_w ) { - m_ppi->write(offset^0x03, data); + m_ppi->write(offset ^ 0x03, data); } -WRITE8_MEMBER( ut88_state::ut88_sound_w ) +WRITE8_MEMBER( ut88_state::sound_w ) { m_dac->write(BIT(data, 0)); m_cassette->output(BIT(data, 0) ? 1 : -1); } -READ8_MEMBER( ut88_state::ut88_tape_r ) +READ8_MEMBER( ut88_base_state::tape_r ) { double level = m_cassette->input(); return (level < 0) ? 0 : 0xff; } -READ8_MEMBER( ut88_state::ut88mini_keyboard_r ) +READ8_MEMBER( ut88mini_state::keyboard_r ) { // This is real keyboard implementation uint8_t *keyrom1 = m_region_proms->base(); @@ -145,7 +145,7 @@ READ8_MEMBER( ut88_state::ut88mini_keyboard_r ) } -WRITE8_MEMBER( ut88_state::ut88mini_write_led ) +WRITE8_MEMBER( ut88mini_state::led_w ) { switch(offset) { @@ -161,17 +161,13 @@ WRITE8_MEMBER( ut88_state::ut88mini_write_led ) } } -void ut88_state::init_ut88mini() -{ -} - -MACHINE_START_MEMBER(ut88_state,ut88mini) +void ut88mini_state::machine_start() { m_digits.resolve(); timer_set(attotime::from_hz(60), TIMER_UPDATE_DISPLAY); } -MACHINE_RESET_MEMBER(ut88_state,ut88mini) +void ut88mini_state::machine_reset() { m_lcd_digit[0] = m_lcd_digit[1] = m_lcd_digit[2] = 0; m_lcd_digit[3] = m_lcd_digit[4] = m_lcd_digit[5] = 0; diff --git a/src/mame/mame.lst b/src/mame/mame.lst index e58693dde63..f7b07f2ab9a 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -914,6 +914,9 @@ actfancrj // (c) 1989 Data East Corporation (Japan) triothep // (c) 1989 Data East Corporation (World) triothepj // (c) 1989 Data East Corporation (Japan) +@source:actions_atj2279b.cpp +rbitgen + @source:acvirus.cpp virusa // (c) 1997 Access GmbH virusb // (c) 1999 Access GmbH @@ -3092,6 +3095,7 @@ botanic2 // (c) 1983 botanicf // (c) 1984 pickin // (c) 1983 sbagman // (c) 1984 +sbagman2 // (c) 1984 sbagmani // (c) 1984 + Itisa license sbagmans // (c) 1984 + Stern license squaitsa // (c) 1985 @@ -3143,6 +3147,9 @@ triviaes5 // (c) 19?? (Maibesa hardware) @source:banctec.cpp banctec // BancTec ESeries panel +@source:bandai_design_master.cpp +bdesignm + @source:bankp.cpp bankp // (c) 1984 Sega, made by Sanritsu combh // (c) 1987 Sega, made by Sanritsu @@ -11262,12 +11269,15 @@ cubeqsta // (c) 1983 Simutrek Inc. @source:cubo.cpp cndypuzl // (c) 1995 cubo // Base unit +eldoralg // haremchl // (c) 1995 lasstixx // (c) 1995 lsrquiz // (c) 1995 -lsrquiz2 // (c) 1995 +lsrquizg // (c) 1995 +lsrquiz2i // (c) 1995 mgnumber // (c) 1995 mgprem11 // (c) 1995 +odeontw // odeontw2 // (c) 1999 @source:cultures.cpp @@ -15017,6 +15027,7 @@ unkch2 // bootleg unkch3 // bootleg unkch4 // bootleg wcat3 // +wcat3a // wcherry // bootleg @source:gomoku.cpp @@ -38335,6 +38346,9 @@ tceptor2 // (c) 1986 @source:tdv2324.cpp tdv2324 // +@source:teamjocs.cpp +diaelite // + @source:tec1.cpp tec1 // Talking Electronics Computer tecjmon // Talking Electronics Computer @@ -39789,6 +39803,7 @@ jak_capb // jak_spdmo // conyteni // conyping // +conyfght @source:vii.cpp jak_batm // The Batman, 2004 @@ -39834,6 +39849,7 @@ taikeegr // shredmjr // sentx6p // telestry // +wiwi18 // @source:vsmile.cpp vsmile // @@ -41020,6 +41036,8 @@ rad_bdp // has_wamg // ltv_tam // tak_geig // +jarajal // +tcarnavi // ban_onep // ekara // ekaraa // diff --git a/src/mame/mess.flt b/src/mame/mess.flt index f097889c05e..f4b026a1870 100644 --- a/src/mame/mess.flt +++ b/src/mame/mess.flt @@ -22,6 +22,7 @@ aci_ggm.cpp aci_prodigy.cpp acrnsys1.cpp acrnsys.cpp +actions_atj2279b.cpp acvirus.cpp adam.cpp adm11.cpp @@ -97,6 +98,7 @@ b16.cpp b2m.cpp babbage.cpp banctec.cpp +bandai_design_master.cpp basic52.cpp bbc.cpp bbcbc.cpp diff --git a/src/mame/video/k054156_k054157_k056832.cpp b/src/mame/video/k054156_k054157_k056832.cpp index 2d0cb0d5724..f530599da4d 100644 --- a/src/mame/video/k054156_k054157_k056832.cpp +++ b/src/mame/video/k054156_k054157_k056832.cpp @@ -676,7 +676,7 @@ u32 k056832_device::k_6bpp_rom_long_r(offs_t offset, u32 mem_mask) u8 k056832_device::konmedal_rom_r(offs_t offset) { - uint32_t addr = ((m_regs[0x1b] << 7) | ((m_regs[0x1a] & 0xc) * 0x800)) + offset; + uint32_t addr = (((m_regs[0x1a] << 9) & 0x60000) | ((m_regs[0x1b] << 15) & 0x18000) | ((m_regs[0x1a] << 3) & 0x06000)) + offset; return m_rombase[addr]; } diff --git a/src/mame/video/ut88.cpp b/src/mame/video/ut88.cpp index f8c8bd7b4ba..565d27cae48 100644 --- a/src/mame/video/ut88.cpp +++ b/src/mame/video/ut88.cpp @@ -24,20 +24,14 @@ const gfx_layout ut88_charlayout = 8*8 /* size of one char */ }; -VIDEO_START_MEMBER(ut88_state,ut88) +uint32_t ut88_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { -} - -uint32_t ut88_state::screen_update_ut88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y; - - for(y = 0; y < 28; y++ ) + for (int y = 0; y < 28; y++) { - for(x = 0; x < 64; x++ ) + for (int x = 0; x < 64; x++) { - int code = m_p_videoram[ x + y*64 ] & 0x7f; - int attr = m_p_videoram[ x+1 + y*64 ] & 0x80; + int code = m_p_videoram[x + y*64] & 0x7f; + int attr = m_p_videoram[x+1 + y*64] & 0x80; m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, code | attr, 0, 0,0, x*8,y*8); } } diff --git a/src/mame/video/xavix.cpp b/src/mame/video/xavix.cpp index 58a12e516a3..2c576515c83 100644 --- a/src/mame/video/xavix.cpp +++ b/src/mame/video/xavix.cpp @@ -202,11 +202,13 @@ void xavix_state::update_pen(int pen, uint8_t shval, uint8_t lval) int b_real = b1 * 255.0f; m_palette->set_pen_color(pen, r_real, g_real, b_real); + + m_screen->update_partial(m_screen->vpos()); } -void xavix_state::draw_tilemap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which) +void xavix_state::draw_tilemap(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int which) { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { @@ -287,7 +289,7 @@ void xavix_state::decode_inline_header(int &flipx, int &flipy, int &test, int &p //if (debug_packets) LOG("\n"); } -void xavix_state::draw_tilemap_line(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int line) +void xavix_state::draw_tilemap_line(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int which, int line) { uint8_t* tileregs; if (which == 0) @@ -488,7 +490,7 @@ void xavix_state::draw_tilemap_line(screen_device &screen, bitmap_ind16 &bitmap, } } -void xavix_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +void xavix_state::draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { @@ -496,7 +498,7 @@ void xavix_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, cons } } -void xavix_state::draw_sprites_line(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int line) +void xavix_state::draw_sprites_line(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int line) { int alt_addressing = 0; @@ -703,9 +705,9 @@ void xavix_state::draw_sprites_line(screen_device &screen, bitmap_ind16 &bitmap, } } -void xavix_state::draw_tile_line(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int tile, int bpp, int xpos, int ypos, int drawheight, int drawwidth, int flipx, int flipy, int pal, int zval, int line) +void xavix_state::draw_tile_line(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int tile, int bpp, int xpos, int ypos, int drawheight, int drawwidth, int flipx, int flipy, int pal, int zval, int line) { - //const pen_t *paldata = m_palette->pens(); + const pen_t *paldata = m_palette->pens(); if (ypos > cliprect.max_y || ypos < cliprect.min_y) return; @@ -760,11 +762,8 @@ void xavix_state::draw_tile_line(screen_device &screen, bitmap_ind16 &bitmap, co if ((m_palram_sh[pen] & 0x1f) < 24) // hue values 24-31 are transparent { - uint16_t* yposptr = &bitmap.pix16(ypos); - yposptr[col] = pen; - - //uint32_t* yposptr = &bitmap.pix32(ypos); - //yposptr[col] = paldata[pen]; + uint32_t* yposptr = &bitmap.pix32(ypos); + yposptr[col] = paldata[pen]; zyposptr[col] = zval; } @@ -774,8 +773,9 @@ void xavix_state::draw_tile_line(screen_device &screen, bitmap_ind16 &bitmap, co } } -uint32_t xavix_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t xavix_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { + const pen_t *paldata = m_palette->pens(); // not sure what you end up with if you fall through all layers as transparent, so far no issues noticed bitmap.fill(m_palette->black_pen(), cliprect); m_zbuffer.fill(0, cliprect); @@ -810,7 +810,7 @@ uint32_t xavix_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, clip.max_x = cliprect.max_x; } } - bitmap.fill(0, clip); + bitmap.fill(paldata[0], clip); draw_tilemap(screen, bitmap, clip, 1); draw_tilemap(screen, bitmap, clip, 0); @@ -862,7 +862,7 @@ uint32_t xavix_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { for (int x = 0; x < width; x++) { - uint16_t* yposptr = &bitmap.pix16(y); + uint32_t* yposptr = &bitmap.pix32(y); uint16_t* zyposptr = &m_zbuffer.pix16(y); uint8_t dat = 0; @@ -877,7 +877,7 @@ uint32_t xavix_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { if (zval >= zyposptr[x]) { - yposptr[x] = dat + 0x100; + yposptr[x] = paldata[dat + 0x100]; zyposptr[x] = zval; } } |