trunk/src/emu/machine/stvcd.c
| r21172 | r21173 | |
| 70 | 70 | #define CD_STAT_WAIT 0x8000 // waiting for command if set, else executed immediately |
| 71 | 71 | #define CD_STAT_REJECT 0xff00 // ultra-fatal error. |
| 72 | 72 | |
| 73 | int saturn_state::get_timing_command(void) |
| 74 | { |
| 75 | /* TODO: calculate timings based off command params */ |
| 76 | return 16667; |
| 77 | } |
| 78 | |
| 73 | 79 | /* FIXME: assume Saturn CD-ROMs to have a 2 secs pre-gap for now. */ |
| 74 | 80 | int saturn_state::get_track_index(void) |
| 75 | 81 | { |
| r21172 | r21173 | |
| 1298 | 1304 | |
| 1299 | 1305 | TIMER_DEVICE_CALLBACK_MEMBER( saturn_state::stv_sh1_sim ) |
| 1300 | 1306 | { |
| 1301 | | sh1_timer->adjust(attotime::from_hz(16667)); |
| 1302 | | |
| 1303 | 1307 | if((cmd_pending == 0xf) && (!(hirqreg & CMOK))) |
| 1304 | | { |
| 1305 | 1308 | cd_exec_command(); |
| 1306 | | return; |
| 1307 | | } |
| 1308 | | |
| 1309 | | /* TODO: doesn't boot if a disk isn't in? */ |
| 1310 | | /* TODO: Check out when this really happens. (Daytona USA original version definitely wants it to be on).*/ |
| 1311 | | //if(((cd_stat & 0x0f00) != CD_STAT_NODISC) && ((cd_stat & 0x0f00) != CD_STAT_OPEN)) |
| 1312 | | hirqreg |= SCDQ; |
| 1313 | | |
| 1314 | | if(cd_stat & CD_STAT_PERI) |
| 1315 | | { |
| 1316 | | cr_standard_return(cd_stat); |
| 1317 | | } |
| 1318 | 1309 | } |
| 1319 | 1310 | |
| 1320 | 1311 | TIMER_DEVICE_CALLBACK_MEMBER( saturn_state::stv_sector_cb ) |
| r21172 | r21173 | |
| 1329 | 1320 | sector_timer->adjust(attotime::from_hz(75)); // 75 sectors / second = 150kBytes/second (cdda track ignores cd_speed setting) |
| 1330 | 1321 | else |
| 1331 | 1322 | sector_timer->adjust(attotime::from_hz(75*cd_speed)); // 75 / 150 sectors / second = 150 / 300kBytes/second |
| 1323 | |
| 1324 | /* TODO: doesn't boot if a disk isn't in? */ |
| 1325 | /* TODO: Check out when this really happens. (Daytona USA original version definitely wants it to be on).*/ |
| 1326 | //if(((cd_stat & 0x0f00) != CD_STAT_NODISC) && ((cd_stat & 0x0f00) != CD_STAT_OPEN)) |
| 1327 | hirqreg |= SCDQ; |
| 1328 | |
| 1329 | if(cd_stat & CD_STAT_PERI) |
| 1330 | { |
| 1331 | cr_standard_return(cd_stat); |
| 1332 | } |
| 1332 | 1333 | } |
| 1333 | 1334 | |
| 1334 | 1335 | // global functions |
| r21172 | r21173 | |
| 1420 | 1421 | sector_timer = machine().device<timer_device>("sector_timer"); |
| 1421 | 1422 | sector_timer->adjust(attotime::from_hz(150)); // 150 sectors / second = 300kBytes/second |
| 1422 | 1423 | sh1_timer = machine().device<timer_device>("sh1_cmd"); |
| 1423 | | sh1_timer->adjust(attotime::from_hz(16667)); |
| 1424 | 1424 | } |
| 1425 | 1425 | |
| 1426 | 1426 | saturn_state::blockT *saturn_state::cd_alloc_block(UINT8 *blknum) |
| r21172 | r21173 | |
| 1794 | 1794 | case 0x000a: |
| 1795 | 1795 | // CDROM_LOG(("%s:WW HIRQ: %04x & %04x => %04x\n", machine().describe_context(), hirqreg, data, hirqreg & data)) |
| 1796 | 1796 | hirqreg &= data; |
| 1797 | | if(!(hirqreg & CMOK)) |
| 1798 | | { |
| 1799 | | sh1_timer->reset(); |
| 1800 | | sh1_timer->adjust(attotime::from_hz(16667)); |
| 1801 | | } |
| 1802 | 1797 | return; |
| 1803 | 1798 | case 0x000c: |
| 1804 | 1799 | case 0x000e: |
| r21172 | r21173 | |
| 1830 | 1825 | // CDROM_LOG(("WW CR4: %04x\n", data)) |
| 1831 | 1826 | cr4 = data; |
| 1832 | 1827 | cmd_pending |= 8; |
| 1828 | sh1_timer->adjust(attotime::from_hz(get_timing_command())); |
| 1833 | 1829 | break; |
| 1834 | 1830 | default: |
| 1835 | 1831 | CDROM_LOG(("CD: WW %08x %04x\n", addr, data)) |
trunk/src/emu/video/stvvdp2.c
| r21172 | r21173 | |
| 3289 | 3289 | } |
| 3290 | 3290 | } |
| 3291 | 3291 | |
| 3292 | void saturn_state::draw_11bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 3293 | { |
| 3294 | int xsize, ysize, xsize_mask, ysize_mask; |
| 3295 | int xsrc,ysrc,xdst,ydst; |
| 3296 | int src_offs; |
| 3297 | UINT8* vram = m_vdp2.gfx_decode; |
| 3298 | UINT32 map_offset = stv2_current_tilemap.bitmap_map * 0x20000; |
| 3299 | int scrollx = stv2_current_tilemap.scrollx; |
| 3300 | int scrolly = stv2_current_tilemap.scrolly; |
| 3301 | UINT16 dot_data; |
| 3302 | UINT16 pal_bank; |
| 3303 | int xf, yf; |
| 3304 | |
| 3305 | xsize = (stv2_current_tilemap.bitmap_size & 2) ? 1024 : 512; |
| 3306 | ysize = (stv2_current_tilemap.bitmap_size & 1) ? 512 : 256; |
| 3307 | |
| 3308 | xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize; |
| 3309 | ysize_mask = (stv2_current_tilemap.vertical_linescroll_enable) ? 512 : ysize; |
| 3310 | |
| 3311 | pal_bank = 0; |
| 3312 | if(stv2_current_tilemap.fade_control & 1) |
| 3313 | pal_bank = ((stv2_current_tilemap.fade_control & 2) ? (2*2048) : (2048)); |
| 3314 | |
| 3315 | for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++) |
| 3316 | { |
| 3317 | for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++) |
| 3318 | { |
| 3319 | if(!stv_vdp2_window_process(xdst,ydst)) |
| 3320 | continue; |
| 3321 | |
| 3322 | xf = stv2_current_tilemap.incx * xdst; |
| 3323 | xf>>=16; |
| 3324 | yf = stv2_current_tilemap.incy * ydst; |
| 3325 | yf>>=16; |
| 3326 | |
| 3327 | xsrc = (xf + scrollx) & (xsize_mask-1); |
| 3328 | ysrc = (yf + scrolly) & (ysize_mask-1); |
| 3329 | src_offs = (xsrc + (ysrc*xsize)); |
| 3330 | src_offs *= 2; |
| 3331 | src_offs += map_offset; |
| 3332 | src_offs &= 0x7ffff; |
| 3333 | |
| 3334 | dot_data = ((vram[src_offs]<<8)|(vram[src_offs+1]<<0)) & 0x7ff; |
| 3335 | |
| 3336 | if ((dot_data != 0) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE)) |
| 3337 | { |
| 3338 | dot_data += pal_bank; |
| 3339 | |
| 3340 | if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) |
| 3341 | bitmap.pix32(ydst, xdst) = machine().pens[dot_data]; |
| 3342 | else |
| 3343 | bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), machine().pens[dot_data], stv2_current_tilemap.alpha); |
| 3344 | } |
| 3345 | } |
| 3346 | } |
| 3347 | } |
| 3348 | |
| 3349 | |
| 3292 | 3350 | void saturn_state::draw_rgb15_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 3293 | 3351 | { |
| 3294 | 3352 | int xsize, ysize, xsize_mask, ysize_mask; |
| r21172 | r21173 | |
| 3417 | 3475 | { |
| 3418 | 3476 | case 0: draw_4bpp_bitmap(bitmap,cliprect); return; |
| 3419 | 3477 | case 1: draw_8bpp_bitmap(bitmap,cliprect); return; |
| 3478 | case 2: draw_11bpp_bitmap(bitmap, cliprect); return; |
| 3420 | 3479 | case 3: draw_rgb15_bitmap(bitmap,cliprect); return; |
| 3421 | 3480 | case 4: draw_rgb32_bitmap(bitmap,cliprect); return; |
| 3422 | 3481 | } |
| r21172 | r21173 | |
| 3433 | 3492 | { |
| 3434 | 3493 | // case 0: draw_4bpp_bitmap(bitmap,cliprect); return; |
| 3435 | 3494 | case 1: draw_8bpp_bitmap(bitmap,cliprect); return; |
| 3495 | // case 2: draw_11bpp_bitmap(bitmap, cliprect); return; |
| 3436 | 3496 | case 3: draw_rgb15_bitmap(bitmap,cliprect); return; |
| 3437 | 3497 | case 4: draw_rgb32_bitmap(bitmap,cliprect); return; |
| 3438 | 3498 | } |
trunk/src/mame/includes/stv.h
| r21172 | r21173 | |
| 395 | 395 | void stv_vdp2_draw_basic_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 396 | 396 | void draw_4bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 397 | 397 | void draw_8bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 398 | | // void draw_11bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 398 | void draw_11bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 399 | 399 | void draw_rgb15_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 400 | 400 | void draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 401 | 401 | |
| r21172 | r21173 | |
| 694 | 694 | UINT8 cdda_maxrepeat; |
| 695 | 695 | UINT8 cdda_repeat_count; |
| 696 | 696 | UINT8 tray_is_closed; |
| 697 | int get_timing_command( void ); |
| 697 | 698 | |
| 698 | 699 | direntryT curroot; // root entry of current filesystem |
| 699 | 700 | direntryT *curdir; // current directory |