src/mame/video/voodoo.c
| r1070 | r1071 | |
| 1 | 1 | //fix me -- blitz2k dies when starting a game with heavy fog (in DRC) |
| 2 | | //optimize -- 64-bit multiplies for S/T |
| 3 | 2 | |
| 4 | 3 | /************************************************************************* |
| 5 | 4 | |
| r1070 | r1071 | |
| 206 | 205 | static void banshee_io_w(voodoo_state *v, offs_t offset, UINT32 data, UINT32 mem_mask); |
| 207 | 206 | static UINT32 banshee_io_r(voodoo_state *v, offs_t offset, UINT32 mem_mask); |
| 208 | 207 | static UINT32 banshee_rom_r(voodoo_state *v, offs_t offset, UINT32 mem_mask); |
| 208 | |
| 209 | /* work item management */ |
| 210 | static void work_item_enqueue(voodoo_state *v); |
| 211 | static void work_item_wait(voodoo_state *v); |
| 212 | static void *work_item_callback(void *param); |
| 213 | |
| 214 | /* command handlers */ |
| 209 | 215 | static INT32 fastfill(voodoo_state *v); |
| 210 | 216 | static INT32 swapbuffer(voodoo_state *v, UINT32 data); |
| 217 | static INT32 triangle(voodoo_state *v); |
| 211 | 218 | static INT32 begin_triangle(voodoo_state *v); |
| 212 | 219 | static INT32 draw_triangle(voodoo_state *v); |
| 213 | | static INT32 triangle(voodoo_state *v); |
| 220 | |
| 221 | /* triangle helpers */ |
| 214 | 222 | static INT32 setup_and_draw_triangle(voodoo_state *v); |
| 223 | static INT32 triangle_create_work_item(voodoo_state *v, UINT16 *drawbuf, int texcount); |
| 224 | |
| 225 | /* rasterizer management */ |
| 215 | 226 | static raster_info *add_rasterizer(voodoo_state *v, const raster_info *cinfo); |
| 216 | 227 | static raster_info *find_rasterizer(voodoo_state *v, int texcount); |
| 217 | 228 | static void dump_rasterizer_stats(voodoo_state *v); |
| 218 | 229 | |
| 219 | | static void raster_generic_0tmu(voodoo_state *v, UINT16 *drawbuf); |
| 220 | | static void raster_generic_1tmu(voodoo_state *v, UINT16 *drawbuf); |
| 221 | | static void raster_generic_2tmu(voodoo_state *v, UINT16 *drawbuf); |
| 230 | /* generic rasterizers */ |
| 231 | static void raster_fastfill(voodoo_state *v, INT32 scanline); |
| 232 | static void raster_generic_0tmu(voodoo_state *v, INT32 y); |
| 233 | static void raster_generic_1tmu(voodoo_state *v, INT32 y); |
| 234 | static void raster_generic_2tmu(voodoo_state *v, INT32 y); |
| 222 | 235 | |
| 223 | 236 | |
| 224 | 237 | |
| r1070 | r1071 | |
| 244 | 257 | *************************************/ |
| 245 | 258 | |
| 246 | 259 | #define RASTERIZER_ENTRY(fbzcp, alpha, fog, fbz, tex0, tex1) \ |
| 247 | | { NULL, raster_##fbzcp##_##alpha##_##fog##_##fbz##_##tex0##_##tex1, FALSE, 0, 0, fbzcp, alpha, fog, fbz, tex0, tex1 }, |
| 260 | { NULL, raster_##fbzcp##_##alpha##_##fog##_##fbz##_##tex0##_##tex1, FALSE, 0, 0, 0, fbzcp, alpha, fog, fbz, tex0, tex1 }, |
| 248 | 261 | |
| 249 | 262 | static const raster_info predef_raster_table[] = |
| 250 | 263 | { |
| r1070 | r1071 | |
| 273 | 286 | memset(v, 0, sizeof(*v)); |
| 274 | 287 | voodoo[which] = v; |
| 275 | 288 | |
| 289 | /* create a multiprocessor work queue */ |
| 290 | v->work.queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI); |
| 291 | |
| 276 | 292 | /* create a table of precomputed 1/n and log2(n) values */ |
| 277 | 293 | /* n ranges from 1.0000 to 2.0000 */ |
| 278 | 294 | for (val = 0; val <= (1 << RECIPLOG_LOOKUP_BITS); val++) |
| r1070 | r1071 | |
| 400 | 416 | |
| 401 | 417 | /************************************* |
| 402 | 418 | * |
| 419 | * Video exit |
| 420 | * |
| 421 | *************************************/ |
| 422 | |
| 423 | void voodoo_exit(int which) |
| 424 | { |
| 425 | /* release the work queue, ensuring all work is finished */ |
| 426 | if (voodoo[which] != NULL && voodoo[which]->work.queue != NULL) |
| 427 | osd_work_queue_free(voodoo[which]->work.queue); |
| 428 | } |
| 429 | |
| 430 | |
| 431 | |
| 432 | /************************************* |
| 433 | * |
| 403 | 434 | * Video update |
| 404 | 435 | * |
| 405 | 436 | *************************************/ |
| r1070 | r1071 | |
| 2151 | 2182 | return 0; |
| 2152 | 2183 | } |
| 2153 | 2184 | |
| 2185 | /* wait for any outstanding work to finish */ |
| 2186 | work_item_wait(v); |
| 2187 | |
| 2154 | 2188 | /* switch off the register */ |
| 2155 | 2189 | switch (regnum) |
| 2156 | 2190 | { |
| r1070 | r1071 | |
| 2822 | 2856 | int x, y, scry, mask; |
| 2823 | 2857 | int pixel, destbuf; |
| 2824 | 2858 | |
| 2859 | /* wait for any outstanding work to finish */ |
| 2860 | work_item_wait(v); |
| 2861 | |
| 2825 | 2862 | /* statistics */ |
| 2826 | 2863 | v->stats.lfb_writes++; |
| 2827 | 2864 | |
| r1070 | r1071 | |
| 3100 | 3137 | /* tricky case: run the full pixel pipeline on the pixel */ |
| 3101 | 3138 | else |
| 3102 | 3139 | { |
| 3140 | DECLARE_STATISTICS; |
| 3141 | |
| 3103 | 3142 | if (LOG_LFB) logerror("VOODOO.%d.LFB:write pipelined mode %X (%d,%d) = %08X & %08X\n", v->index, LFBMODE_WRITE_FORMAT(v->reg[lfbMode].u), x, y, data, mem_mask); |
| 3104 | 3143 | |
| 3105 | 3144 | /* determine the screen Y */ |
| r1070 | r1071 | |
| 3143 | 3182 | x++; |
| 3144 | 3183 | mask >>= 4; |
| 3145 | 3184 | } |
| 3185 | |
| 3186 | UPDATE_STATISTICS(v); |
| 3146 | 3187 | } |
| 3147 | 3188 | |
| 3148 | 3189 | return 0; |
| r1070 | r1071 | |
| 3161 | 3202 | int tmunum = (offset >> 19) & 0x03; |
| 3162 | 3203 | tmu_state *t; |
| 3163 | 3204 | |
| 3205 | /* wait for any outstanding work to finish */ |
| 3206 | work_item_wait(v); |
| 3207 | |
| 3164 | 3208 | /* statistics */ |
| 3165 | 3209 | v->stats.tex_writes++; |
| 3166 | 3210 | |
| r1070 | r1071 | |
| 3767 | 3811 | UINT32 data; |
| 3768 | 3812 | int x, y, scry, destbuf; |
| 3769 | 3813 | |
| 3814 | /* wait for any outstanding work to finish */ |
| 3815 | work_item_wait(v); |
| 3816 | |
| 3770 | 3817 | /* statistics */ |
| 3771 | 3818 | v->stats.lfb_reads++; |
| 3772 | 3819 | |
| r1070 | r1071 | |
| 4403 | 4450 | |
| 4404 | 4451 | |
| 4405 | 4452 | |
| 4406 | | /************************************* |
| 4407 | | * |
| 4408 | | * Command handlers |
| 4409 | | * |
| 4410 | | *************************************/ |
| 4453 | /*************************************************************************** |
| 4454 | WORK ITEM MANAGEMENT |
| 4455 | ***************************************************************************/ |
| 4411 | 4456 | |
| 4457 | /*------------------------------------------------- |
| 4458 | work_item_enqueue - enqueue a new work item, |
| 4459 | remembering starting statistics |
| 4460 | -------------------------------------------------*/ |
| 4461 | |
| 4462 | static void work_item_enqueue(voodoo_state *v) |
| 4463 | { |
| 4464 | /* remember the starting statistics values */ |
| 4465 | v->work.start_pixels_in = v->reg[fbiPixelsIn].u; |
| 4466 | v->work.start_pixels_out = v->reg[fbiPixelsOut].u; |
| 4467 | v->work.start_chroma_fail = v->reg[fbiChromaFail].u; |
| 4468 | v->work.start_zfunc_fail = v->reg[fbiZfuncFail].u; |
| 4469 | v->work.start_afunc_fail = v->reg[fbiAfuncFail].u; |
| 4470 | |
| 4471 | /* enqueue the work item */ |
| 4472 | osd_work_item_queue(v->work.queue, work_item_callback, &v->work, WORK_ITEM_FLAG_AUTO_RELEASE | WORK_ITEM_FLAG_SHARED); |
| 4473 | } |
| 4474 | |
| 4475 | |
| 4476 | /*------------------------------------------------- |
| 4477 | work_item_wait - wait for all pending work |
| 4478 | items to complete, then update statistics |
| 4479 | -------------------------------------------------*/ |
| 4480 | |
| 4481 | static void work_item_wait(voodoo_state *v) |
| 4482 | { |
| 4483 | /* wait for the work item to complete */ |
| 4484 | osd_work_queue_wait(v->work.queue, osd_ticks_per_second()); |
| 4485 | |
| 4486 | /* update our global stats based on the results */ |
| 4487 | v->stats.total_pixels_in += v->reg[fbiPixelsIn].u - v->work.start_pixels_in; |
| 4488 | v->stats.total_pixels_out += v->reg[fbiPixelsOut].u - v->work.start_pixels_out; |
| 4489 | v->stats.total_chroma_fail += v->reg[fbiChromaFail].u - v->work.start_chroma_fail; |
| 4490 | v->stats.total_zfunc_fail += v->reg[fbiZfuncFail].u - v->work.start_zfunc_fail; |
| 4491 | v->stats.total_afunc_fail += v->reg[fbiAfuncFail].u - v->work.start_afunc_fail; |
| 4492 | if (v->work.info != NULL) |
| 4493 | v->work.info->hits += v->reg[fbiPixelsIn].u - v->work.start_pixels_in; |
| 4494 | |
| 4495 | /* remember the starting statistics values */ |
| 4496 | v->work.start_pixels_in = v->reg[fbiPixelsIn].u; |
| 4497 | v->work.start_pixels_out = v->reg[fbiPixelsOut].u; |
| 4498 | v->work.start_chroma_fail = v->reg[fbiChromaFail].u; |
| 4499 | v->work.start_zfunc_fail = v->reg[fbiZfuncFail].u; |
| 4500 | v->work.start_afunc_fail = v->reg[fbiAfuncFail].u; |
| 4501 | } |
| 4502 | |
| 4503 | |
| 4504 | /*------------------------------------------------- |
| 4505 | work_item_callback - work item callback; |
| 4506 | loop over scanlines and call the rasterizer |
| 4507 | for each one |
| 4508 | -------------------------------------------------*/ |
| 4509 | |
| 4510 | static void *work_item_callback(void *param) |
| 4511 | { |
| 4512 | /* recover the state pointer and scanline from the param */ |
| 4513 | work_info *work = param; |
| 4514 | voodoo_state *v = work->state; |
| 4515 | |
| 4516 | /* render the scanlines and return */ |
| 4517 | while (1) |
| 4518 | { |
| 4519 | int scanline = osd_sync_add(&work->curscanline, 1) - 1; |
| 4520 | |
| 4521 | /* stop when we hit the end scanline */ |
| 4522 | if (scanline >= work->endscanline) |
| 4523 | break; |
| 4524 | |
| 4525 | /* handle this scanline then continue */ |
| 4526 | (*work->callback)(v, scanline); |
| 4527 | } |
| 4528 | return NULL; |
| 4529 | } |
| 4530 | |
| 4531 | |
| 4532 | |
| 4533 | /*************************************************************************** |
| 4534 | COMMAND HANDLERS |
| 4535 | ***************************************************************************/ |
| 4536 | |
| 4537 | /*------------------------------------------------- |
| 4538 | fastfill - execute the 'fastfill' |
| 4539 | command |
| 4540 | -------------------------------------------------*/ |
| 4541 | |
| 4412 | 4542 | static INT32 fastfill(voodoo_state *v) |
| 4413 | 4543 | { |
| 4414 | 4544 | int sx = (v->reg[clipLeftRight].u >> 16) & 0x3ff; |
| r1070 | r1071 | |
| 4418 | 4548 | int x, y; |
| 4419 | 4549 | |
| 4420 | 4550 | /* if we're not clearing either, take no time */ |
| 4421 | | if (!FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u) && |
| 4422 | | !FBZMODE_AUX_BUFFER_MASK(v->reg[fbzMode].u)) |
| 4551 | if (!FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u) && !FBZMODE_AUX_BUFFER_MASK(v->reg[fbzMode].u)) |
| 4423 | 4552 | return 0; |
| 4424 | 4553 | |
| 4425 | 4554 | /* are we clearing the RGB buffer? */ |
| 4426 | 4555 | if (FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u)) |
| 4427 | 4556 | { |
| 4428 | | UINT16 dither[16]; |
| 4429 | | UINT16 *drawbuf; |
| 4430 | | int destbuf; |
| 4431 | | |
| 4432 | 4557 | /* determine the draw buffer */ |
| 4433 | | destbuf = (v->type >= VOODOO_BANSHEE) ? 1 : FBZMODE_DRAW_BUFFER(v->reg[fbzMode].u); |
| 4558 | int destbuf = (v->type >= VOODOO_BANSHEE) ? 1 : FBZMODE_DRAW_BUFFER(v->reg[fbzMode].u); |
| 4434 | 4559 | switch (destbuf) |
| 4435 | 4560 | { |
| 4436 | 4561 | case 0: /* front buffer */ |
| 4437 | | drawbuf = v->fbi.rgb[v->fbi.frontbuf]; |
| 4562 | v->work.drawbuf = v->fbi.rgb[v->fbi.frontbuf]; |
| 4438 | 4563 | break; |
| 4439 | 4564 | |
| 4440 | 4565 | case 1: /* back buffer */ |
| 4441 | | drawbuf = v->fbi.rgb[v->fbi.backbuf]; |
| 4566 | v->work.drawbuf = v->fbi.rgb[v->fbi.backbuf]; |
| 4442 | 4567 | break; |
| 4443 | 4568 | |
| 4444 | 4569 | default: /* reserved */ |
| 4445 | | return 0; |
| 4570 | break; |
| 4446 | 4571 | } |
| 4447 | 4572 | |
| 4448 | 4573 | /* determine the dither pattern */ |
| r1070 | r1071 | |
| 4454 | 4579 | int b = RGB_BLUE(v->reg[color1].u); |
| 4455 | 4580 | |
| 4456 | 4581 | APPLY_DITHER(v->reg[fbzMode].u, x, y, r, g, b); |
| 4457 | | dither[y*4 + x] = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | ((b & 0xf8) >> 3); |
| 4582 | v->work.dither[y*4 + x] = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | ((b & 0xf8) >> 3); |
| 4458 | 4583 | } |
| 4584 | } |
| 4459 | 4585 | |
| 4460 | | /* now do the fill */ |
| 4461 | | for (y = sy; y < ey; y++) |
| 4462 | | { |
| 4463 | | UINT16 *ditherow = &dither[(y & 3) * 4]; |
| 4464 | | UINT16 *dest; |
| 4465 | | int scry; |
| 4586 | /* create a shared work item to actually perform the fill */ |
| 4587 | v->work.state = v; |
| 4588 | v->work.minx = sx; |
| 4589 | v->work.maxx = ex; |
| 4590 | v->work.curscanline = sy; |
| 4591 | v->work.endscanline = ey; |
| 4592 | v->work.callback = raster_fastfill; |
| 4593 | v->work.info = NULL; |
| 4594 | work_item_enqueue(v); |
| 4466 | 4595 | |
| 4467 | | /* determine the screen Y */ |
| 4468 | | scry = y; |
| 4469 | | if (FBZMODE_Y_ORIGIN(v->reg[fbzMode].u)) |
| 4470 | | scry = (v->fbi.yorigin - y) & 0x3ff; |
| 4471 | | |
| 4472 | | /* fill this row */ |
| 4473 | | dest = drawbuf + scry * v->fbi.rowpixels; |
| 4474 | | for (x = sx; x < ex; x++) |
| 4475 | | dest[x] = ditherow[x & 3]; |
| 4476 | | } |
| 4477 | | |
| 4478 | | /* track pixel writes to the frame buffer regardless of mask */ |
| 4596 | /* track pixel writes to the frame buffer regardless of mask */ |
| 4597 | if (FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u)) |
| 4479 | 4598 | v->reg[fbiPixelsOut].u += (ey - sy) * (ex - sx); |
| 4480 | | } |
| 4481 | 4599 | |
| 4482 | | /* are we clearing the depth buffer? */ |
| 4483 | | if (FBZMODE_AUX_BUFFER_MASK(v->reg[fbzMode].u) && v->fbi.aux) |
| 4484 | | { |
| 4485 | | UINT16 color = v->reg[zaColor].u; |
| 4486 | | |
| 4487 | | /* now do the fill */ |
| 4488 | | for (y = sy; y < ey; y++) |
| 4489 | | { |
| 4490 | | UINT16 *dest; |
| 4491 | | int scry; |
| 4492 | | |
| 4493 | | /* determine the screen Y */ |
| 4494 | | scry = y; |
| 4495 | | if (FBZMODE_Y_ORIGIN(v->reg[fbzMode].u)) |
| 4496 | | scry = (v->fbi.yorigin - y) & 0x3ff; |
| 4497 | | |
| 4498 | | /* fill this row */ |
| 4499 | | dest = v->fbi.aux + scry * v->fbi.rowpixels; |
| 4500 | | for (x = sx; x < ex; x++) |
| 4501 | | dest[x] = color; |
| 4502 | | } |
| 4503 | | } |
| 4504 | | |
| 4505 | 4600 | /* 2 pixels per clock */ |
| 4506 | 4601 | return ((ey - sy) * (ex - sx)) / 2; |
| 4507 | 4602 | } |
| 4508 | 4603 | |
| 4509 | 4604 | |
| 4605 | /*------------------------------------------------- |
| 4606 | swapbuffer - execute the 'swapbuffer' |
| 4607 | command |
| 4608 | -------------------------------------------------*/ |
| 4609 | |
| 4510 | 4610 | static INT32 swapbuffer(voodoo_state *v, UINT32 data) |
| 4511 | 4611 | { |
| 4512 | 4612 | /* set the don't swap value for Voodoo 2 */ |
| r1070 | r1071 | |
| 4527 | 4627 | } |
| 4528 | 4628 | |
| 4529 | 4629 | |
| 4630 | /*------------------------------------------------- |
| 4631 | triangle - execute the 'triangle' |
| 4632 | command |
| 4633 | -------------------------------------------------*/ |
| 4634 | |
| 4530 | 4635 | static INT32 triangle(voodoo_state *v) |
| 4531 | 4636 | { |
| 4532 | | INT32 start_pixels_in = v->reg[fbiPixelsIn].u; |
| 4533 | | INT32 start_pixels_out = v->reg[fbiPixelsOut].u; |
| 4534 | | INT32 start_chroma_fail = v->reg[fbiChromaFail].u; |
| 4535 | | INT32 start_zfunc_fail = v->reg[fbiZfuncFail].u; |
| 4536 | | INT32 start_afunc_fail = v->reg[fbiAfuncFail].u; |
| 4537 | | raster_info *info; |
| 4538 | | int texcount = 0; |
| 4637 | int texcount = 0, texnum; |
| 4539 | 4638 | UINT16 *drawbuf; |
| 4540 | 4639 | int destbuf; |
| 4640 | int pixels; |
| 4541 | 4641 | |
| 4542 | 4642 | profiler_mark(PROFILER_USER2); |
| 4543 | 4643 | |
| 4644 | /* determine the number of TMUs involved */ |
| 4645 | texcount = 0; |
| 4646 | if (!FBIINIT3_DISABLE_TMUS(v->reg[fbiInit3].u) && FBZCP_TEXTURE_ENABLE(v->reg[fbzColorPath].u)) |
| 4647 | { |
| 4648 | texcount = 1; |
| 4649 | if (v->chipmask & 0x04) |
| 4650 | texcount = 2; |
| 4651 | } |
| 4652 | |
| 4544 | 4653 | /* perform subpixel adjustments */ |
| 4545 | 4654 | if (FBZCP_CCA_SUBPIXEL_ADJUST(v->reg[fbzColorPath].u)) |
| 4546 | 4655 | { |
| 4547 | 4656 | INT32 dx = 8 - (v->fbi.ax & 15); |
| 4548 | 4657 | INT32 dy = 8 - (v->fbi.ay & 15); |
| 4549 | 4658 | |
| 4659 | /* adjust iterated R,G,B,A and W/Z */ |
| 4550 | 4660 | v->fbi.startr += (dy * v->fbi.drdy + dx * v->fbi.drdx) >> 4; |
| 4551 | 4661 | v->fbi.startg += (dy * v->fbi.dgdy + dx * v->fbi.dgdx) >> 4; |
| 4552 | 4662 | v->fbi.startb += (dy * v->fbi.dbdy + dx * v->fbi.dbdx) >> 4; |
| r1070 | r1071 | |
| 4554 | 4664 | v->fbi.startw += (dy * v->fbi.dwdy + dx * v->fbi.dwdx) >> 4; |
| 4555 | 4665 | v->fbi.startz += fixed_mul_shift(dy, v->fbi.dzdy, 4) + fixed_mul_shift(dx, v->fbi.dzdx, 4); |
| 4556 | 4666 | |
| 4557 | | v->tmu[0].startw += (dy * v->tmu[0].dwdy + dx * v->tmu[0].dwdx) >> 4; |
| 4558 | | v->tmu[0].starts += (dy * v->tmu[0].dsdy + dx * v->tmu[0].dsdx) >> 4; |
| 4559 | | v->tmu[0].startt += (dy * v->tmu[0].dtdy + dx * v->tmu[0].dtdx) >> 4; |
| 4667 | /* adjust iterated W/S/T for TMU 0 */ |
| 4668 | if (texcount >= 1) |
| 4669 | { |
| 4670 | v->tmu[0].startw += (dy * v->tmu[0].dwdy + dx * v->tmu[0].dwdx) >> 4; |
| 4671 | v->tmu[0].starts += (dy * v->tmu[0].dsdy + dx * v->tmu[0].dsdx) >> 4; |
| 4672 | v->tmu[0].startt += (dy * v->tmu[0].dtdy + dx * v->tmu[0].dtdx) >> 4; |
| 4560 | 4673 | |
| 4561 | | if (v->chipmask & 0x04) |
| 4562 | | { |
| 4563 | | v->tmu[1].startw += (dy * v->tmu[1].dwdy + dx * v->tmu[1].dwdx) >> 4; |
| 4564 | | v->tmu[1].starts += (dy * v->tmu[1].dsdy + dx * v->tmu[1].dsdx) >> 4; |
| 4565 | | v->tmu[1].startt += (dy * v->tmu[1].dtdy + dx * v->tmu[1].dtdx) >> 4; |
| 4674 | /* adjust iterated W/S/T for TMU 1 */ |
| 4675 | if (texcount >= 2) |
| 4676 | { |
| 4677 | v->tmu[1].startw += (dy * v->tmu[1].dwdy + dx * v->tmu[1].dwdx) >> 4; |
| 4678 | v->tmu[1].starts += (dy * v->tmu[1].dsdy + dx * v->tmu[1].dsdx) >> 4; |
| 4679 | v->tmu[1].startt += (dy * v->tmu[1].dtdy + dx * v->tmu[1].dtdx) >> 4; |
| 4680 | } |
| 4566 | 4681 | } |
| 4567 | 4682 | } |
| 4568 | 4683 | |
| 4684 | /* set up the textures */ |
| 4685 | for (texnum = 0; texnum < texcount; texnum++) |
| 4686 | { |
| 4687 | prepare_tmu(&v->tmu[texnum]); |
| 4688 | v->stats.texture_mode[TEXMODE_FORMAT(v->tmu[texnum].reg[textureMode].u)]++; |
| 4689 | } |
| 4690 | |
| 4569 | 4691 | /* determine the draw buffer */ |
| 4570 | 4692 | destbuf = (v->type >= VOODOO_BANSHEE) ? 1 : FBZMODE_DRAW_BUFFER(v->reg[fbzMode].u); |
| 4571 | 4693 | switch (destbuf) |
| r1070 | r1071 | |
| 4583 | 4705 | return TRIANGLE_SETUP_CLOCKS; |
| 4584 | 4706 | } |
| 4585 | 4707 | |
| 4586 | | /* set up the textures */ |
| 4587 | | texcount = 0; |
| 4588 | | if (!FBIINIT3_DISABLE_TMUS(v->reg[fbiInit3].u) && FBZCP_TEXTURE_ENABLE(v->reg[fbzColorPath].u)) |
| 4589 | | { |
| 4590 | | texcount = 1; |
| 4591 | | prepare_tmu(&v->tmu[0]); |
| 4592 | | v->stats.texture_mode[TEXMODE_FORMAT(v->tmu[0].reg[textureMode].u)]++; |
| 4593 | | |
| 4594 | | /* see if we need to deal with a second TMU */ |
| 4595 | | if (v->chipmask & 0x04) |
| 4596 | | { |
| 4597 | | texcount = 2; |
| 4598 | | prepare_tmu(&v->tmu[1]); |
| 4599 | | v->stats.texture_mode[TEXMODE_FORMAT(v->tmu[1].reg[textureMode].u)]++; |
| 4600 | | } |
| 4601 | | } |
| 4602 | | |
| 4603 | 4708 | /* find a rasterizer that matches our current state */ |
| 4604 | | info = find_rasterizer(v, texcount); |
| 4605 | | (*info->callback)(v, drawbuf); |
| 4606 | | info->polys++; |
| 4607 | | info->hits += v->reg[fbiPixelsIn].u - start_pixels_in; |
| 4709 | pixels = triangle_create_work_item(v, drawbuf, texcount); |
| 4608 | 4710 | |
| 4609 | 4711 | /* update stats */ |
| 4610 | 4712 | v->reg[fbiTrianglesOut].u++; |
| 4611 | 4713 | |
| 4612 | | if (LOG_REGISTERS) logerror("cycles = %d\n", TRIANGLE_SETUP_CLOCKS + v->reg[fbiPixelsIn].u - start_pixels_in); |
| 4613 | | |
| 4614 | 4714 | /* update stats */ |
| 4615 | 4715 | v->stats.total_triangles++; |
| 4616 | | v->stats.total_pixels_in += v->reg[fbiPixelsIn].u - start_pixels_in; |
| 4617 | | v->stats.total_pixels_out += v->reg[fbiPixelsOut].u - start_pixels_out; |
| 4618 | | v->stats.total_chroma_fail += v->reg[fbiChromaFail].u - start_chroma_fail; |
| 4619 | | v->stats.total_zfunc_fail += v->reg[fbiZfuncFail].u - start_zfunc_fail; |
| 4620 | | v->stats.total_afunc_fail += v->reg[fbiAfuncFail].u - start_afunc_fail; |
| 4621 | 4716 | |
| 4622 | 4717 | profiler_mark(PROFILER_END); |
| 4623 | 4718 | |
| 4624 | 4719 | /* 1 pixel per clock, plus some setup time */ |
| 4625 | | return TRIANGLE_SETUP_CLOCKS + v->reg[fbiPixelsIn].u - start_pixels_in; |
| 4720 | if (LOG_REGISTERS) logerror("cycles = %d\n", TRIANGLE_SETUP_CLOCKS + pixels); |
| 4721 | return TRIANGLE_SETUP_CLOCKS + pixels; |
| 4626 | 4722 | } |
| 4627 | 4723 | |
| 4628 | 4724 | |
| 4725 | /*------------------------------------------------- |
| 4726 | begin_triangle - execute the 'beginTri' |
| 4727 | command |
| 4728 | -------------------------------------------------*/ |
| 4729 | |
| 4629 | 4730 | static INT32 begin_triangle(voodoo_state *v) |
| 4630 | 4731 | { |
| 4631 | 4732 | setup_vertex *sv = &v->fbi.svert[2]; |
| r1070 | r1071 | |
| 4653 | 4754 | } |
| 4654 | 4755 | |
| 4655 | 4756 | |
| 4757 | /*------------------------------------------------- |
| 4758 | draw_triangle - execute the 'DrawTri' |
| 4759 | command |
| 4760 | -------------------------------------------------*/ |
| 4761 | |
| 4656 | 4762 | static INT32 draw_triangle(voodoo_state *v) |
| 4657 | 4763 | { |
| 4658 | 4764 | setup_vertex *sv = &v->fbi.svert[2]; |
| r1070 | r1071 | |
| 4689 | 4795 | |
| 4690 | 4796 | |
| 4691 | 4797 | |
| 4692 | | /************************************* |
| 4693 | | * |
| 4694 | | * Triangle setup |
| 4695 | | * |
| 4696 | | *************************************/ |
| 4798 | /*************************************************************************** |
| 4799 | TRIANGLE HELPERS |
| 4800 | ***************************************************************************/ |
| 4697 | 4801 | |
| 4802 | /*------------------------------------------------- |
| 4803 | setup_and_draw_triangle - process the setup |
| 4804 | parameters and render the triangle |
| 4805 | -------------------------------------------------*/ |
| 4806 | |
| 4698 | 4807 | static INT32 setup_and_draw_triangle(voodoo_state *v) |
| 4699 | 4808 | { |
| 4700 | 4809 | float dx1, dy1, dx2, dy2; |
| 4701 | 4810 | float divisor, tdiv; |
| 4702 | 4811 | |
| 4812 | /* wait for any outstanding work to finish */ |
| 4813 | work_item_wait(v); |
| 4814 | |
| 4703 | 4815 | /* grab the X/Ys at least */ |
| 4704 | 4816 | v->fbi.ax = (INT16)(v->fbi.svert[0].x * 16.0); |
| 4705 | 4817 | v->fbi.ay = (INT16)(v->fbi.svert[0].y * 16.0); |
| r1070 | r1071 | |
| 4817 | 4929 | } |
| 4818 | 4930 | |
| 4819 | 4931 | |
| 4932 | /*------------------------------------------------- |
| 4933 | triangle_create_work_item - finish triangle |
| 4934 | setup and create the work item |
| 4935 | -------------------------------------------------*/ |
| 4820 | 4936 | |
| 4821 | | /************************************* |
| 4822 | | * |
| 4823 | | * Rasterizer management |
| 4824 | | * |
| 4825 | | *************************************/ |
| 4937 | static INT32 triangle_create_work_item(voodoo_state *v, UINT16 *drawbuf, int texcount) |
| 4938 | { |
| 4939 | raster_info *info = find_rasterizer(v, texcount); |
| 4940 | int curscan, pixels = 0; |
| 4826 | 4941 | |
| 4942 | /* sort the vertices */ |
| 4943 | /* note that this is not necessary on the Voodoo 1 as the card assumes the vertices */ |
| 4944 | /* are presorted such that ay <= by <= cy, but we do it anyway because it is cheap enough */ |
| 4945 | if (v->fbi.ay <= v->fbi.by) |
| 4946 | { |
| 4947 | if (v->fbi.by <= v->fbi.cy) |
| 4948 | { |
| 4949 | v->work.minx = v->fbi.ax; v->work.miny = v->fbi.ay; |
| 4950 | v->work.midx = v->fbi.bx; v->work.midy = v->fbi.by; |
| 4951 | v->work.maxx = v->fbi.cx; v->work.maxy = v->fbi.cy; |
| 4952 | } |
| 4953 | else if (v->fbi.ay <= v->fbi.cy) |
| 4954 | { |
| 4955 | v->work.minx = v->fbi.ax; v->work.miny = v->fbi.ay; |
| 4956 | v->work.midx = v->fbi.cx; v->work.midy = v->fbi.cy; |
| 4957 | v->work.maxx = v->fbi.bx; v->work.maxy = v->fbi.by; |
| 4958 | } |
| 4959 | else |
| 4960 | { |
| 4961 | v->work.minx = v->fbi.cx; v->work.miny = v->fbi.cy; |
| 4962 | v->work.midx = v->fbi.ax; v->work.midy = v->fbi.ay; |
| 4963 | v->work.maxx = v->fbi.bx; v->work.maxy = v->fbi.by; |
| 4964 | } |
| 4965 | } |
| 4966 | else |
| 4967 | { |
| 4968 | if (v->fbi.ay <= v->fbi.cy) |
| 4969 | { |
| 4970 | v->work.minx = v->fbi.bx; v->work.miny = v->fbi.by; |
| 4971 | v->work.midx = v->fbi.ax; v->work.midy = v->fbi.ay; |
| 4972 | v->work.maxx = v->fbi.cx; v->work.maxy = v->fbi.cy; |
| 4973 | } |
| 4974 | else if (v->fbi.by <= v->fbi.cy) |
| 4975 | { |
| 4976 | v->work.minx = v->fbi.bx; v->work.miny = v->fbi.by; |
| 4977 | v->work.midx = v->fbi.cx; v->work.midy = v->fbi.cy; |
| 4978 | v->work.maxx = v->fbi.ax; v->work.maxy = v->fbi.ay; |
| 4979 | } |
| 4980 | else |
| 4981 | { |
| 4982 | v->work.minx = v->fbi.cx; v->work.miny = v->fbi.cy; |
| 4983 | v->work.midx = v->fbi.bx; v->work.midy = v->fbi.by; |
| 4984 | v->work.maxx = v->fbi.ax; v->work.maxy = v->fbi.ay; |
| 4985 | } |
| 4986 | } |
| 4987 | |
| 4988 | /* compute the slopes as 16.16 numbers */ |
| 4989 | v->work.dxdy_minmid = (v->work.miny == v->work.midy) ? 0 : ((v->work.midx - v->work.minx) << 16) / (v->work.midy - v->work.miny); |
| 4990 | v->work.dxdy_minmax = (v->work.miny == v->work.maxy) ? 0 : ((v->work.maxx - v->work.minx) << 16) / (v->work.maxy - v->work.miny); |
| 4991 | v->work.dxdy_midmax = (v->work.midy == v->work.maxy) ? 0 : ((v->work.maxx - v->work.midx) << 16) / (v->work.maxy - v->work.midy); |
| 4992 | |
| 4993 | /* clamp to full pixels */ |
| 4994 | v->work.startscanline = v->work.curscanline = (v->work.miny + 7) >> 4; |
| 4995 | v->work.endscanline = (v->work.maxy + 7) >> 4; |
| 4996 | |
| 4997 | /* compute the X extents for each scanline */ |
| 4998 | for (curscan = v->work.startscanline; curscan < v->work.endscanline; curscan++) |
| 4999 | { |
| 5000 | INT32 fully = (curscan << 4) + 8; |
| 5001 | INT32 startx = v->work.minx + (((fully - v->work.miny) * v->work.dxdy_minmax) >> 16); |
| 5002 | INT32 stopx; |
| 5003 | |
| 5004 | if (fully < v->work.midy) |
| 5005 | stopx = v->work.minx + (((fully - v->work.miny) * v->work.dxdy_minmid) >> 16); |
| 5006 | else |
| 5007 | stopx = v->work.midx + (((fully - v->work.midy) * v->work.dxdy_midmax) >> 16); |
| 5008 | |
| 5009 | /* clamp to full pixels */ |
| 5010 | startx = (startx + 7) >> 4; |
| 5011 | stopx = (stopx + 7) >> 4; |
| 5012 | |
| 5013 | /* force start < stop */ |
| 5014 | if (startx > stopx) |
| 5015 | { |
| 5016 | int temp = startx; |
| 5017 | startx = stopx; |
| 5018 | stopx = temp; |
| 5019 | } |
| 5020 | |
| 5021 | /* set the extent and update the total pixel count */ |
| 5022 | v->work.extent[curscan - v->work.startscanline].startx = startx; |
| 5023 | v->work.extent[curscan - v->work.startscanline].stopx = stopx; |
| 5024 | pixels += stopx - startx; |
| 5025 | } |
| 5026 | |
| 5027 | /* farm the rasterization out to other threads */ |
| 5028 | v->work.state = v; |
| 5029 | v->work.callback = info->callback; |
| 5030 | v->work.drawbuf = drawbuf; |
| 5031 | v->work.info = info; |
| 5032 | work_item_enqueue(v); |
| 5033 | |
| 5034 | /* update statistics */ |
| 5035 | info->polys++; |
| 5036 | return pixels; |
| 5037 | } |
| 5038 | |
| 5039 | |
| 5040 | |
| 5041 | /*************************************************************************** |
| 5042 | RASTERIZER MANAGEMENT |
| 5043 | ***************************************************************************/ |
| 5044 | |
| 5045 | /*------------------------------------------------- |
| 5046 | add_rasterizer - add a rasterizer to our |
| 5047 | hash table |
| 5048 | -------------------------------------------------*/ |
| 5049 | |
| 4827 | 5050 | static raster_info *add_rasterizer(voodoo_state *v, const raster_info *cinfo) |
| 4828 | 5051 | { |
| 4829 | 5052 | raster_info *info = &v->rasterizer[v->next_rasterizer++]; |
| r1070 | r1071 | |
| 4843 | 5066 | v->raster_hash[hash] = info; |
| 4844 | 5067 | |
| 4845 | 5068 | if (LOG_RASTERIZERS) |
| 4846 | | mame_printf_debug("Adding rasterizer @ %p : %08X %08X %08X %08X %08X %08X (hash=%d)\n", |
| 5069 | printf("Adding rasterizer @ %p : %08X %08X %08X %08X %08X %08X (hash=%d)\n", |
| 4847 | 5070 | info->callback, |
| 4848 | 5071 | info->eff_color_path, info->eff_alpha_mode, info->eff_fog_mode, info->eff_fbz_mode, |
| 4849 | 5072 | info->eff_tex_mode_0, info->eff_tex_mode_1, hash); |
| r1070 | r1071 | |
| 4852 | 5075 | } |
| 4853 | 5076 | |
| 4854 | 5077 | |
| 5078 | /*------------------------------------------------- |
| 5079 | find_rasterizer - find a rasterizer that |
| 5080 | matches our current parameters and return |
| 5081 | it, creating a new one if necessary |
| 5082 | -------------------------------------------------*/ |
| 5083 | |
| 4855 | 5084 | static raster_info *find_rasterizer(voodoo_state *v, int texcount) |
| 4856 | 5085 | { |
| 4857 | 5086 | raster_info *info, *prev = NULL; |
| r1070 | r1071 | |
| 4890 | 5119 | return info; |
| 4891 | 5120 | } |
| 4892 | 5121 | |
| 4893 | | /* attempt to generate one */ |
| 4894 | | #ifdef VOODOO_DRC |
| 4895 | | curinfo.callback = generate_rasterizer(v); |
| 4896 | | curinfo.is_generic = FALSE; |
| 4897 | | if (curinfo.callback == NULL) |
| 4898 | | #endif |
| 4899 | | { |
| 4900 | | curinfo.callback = (texcount == 0) ? raster_generic_0tmu : (texcount == 1) ? raster_generic_1tmu : raster_generic_2tmu; |
| 4901 | | curinfo.is_generic = TRUE; |
| 4902 | | } |
| 4903 | | |
| 5122 | /* generate a new one using the generic entry */ |
| 5123 | curinfo.callback = (texcount == 0) ? raster_generic_0tmu : (texcount == 1) ? raster_generic_1tmu : raster_generic_2tmu; |
| 5124 | curinfo.is_generic = TRUE; |
| 5125 | curinfo.display = 0; |
| 4904 | 5126 | curinfo.polys = 0; |
| 4905 | 5127 | curinfo.hits = 0; |
| 4906 | 5128 | curinfo.next = 0; |
| r1070 | r1071 | |
| 4909 | 5131 | } |
| 4910 | 5132 | |
| 4911 | 5133 | |
| 5134 | /*------------------------------------------------- |
| 5135 | dump_rasterizer_stats - dump statistics on |
| 5136 | the current rasterizer usage patterns |
| 5137 | -------------------------------------------------*/ |
| 5138 | |
| 4912 | 5139 | static void dump_rasterizer_stats(voodoo_state *v) |
| 4913 | 5140 | { |
| 5141 | static UINT8 display_index; |
| 4914 | 5142 | raster_info *cur, *best; |
| 4915 | 5143 | int hash; |
| 4916 | 5144 | |
| 4917 | | mame_printf_debug("----\n"); |
| 5145 | printf("----\n"); |
| 5146 | display_index++; |
| 4918 | 5147 | |
| 4919 | 5148 | /* loop until we've displayed everything */ |
| 4920 | 5149 | while (1) |
| r1070 | r1071 | |
| 4924 | 5153 | /* find the highest entry */ |
| 4925 | 5154 | for (hash = 0; hash < RASTER_HASH_SIZE; hash++) |
| 4926 | 5155 | for (cur = v->raster_hash[hash]; cur; cur = cur->next) |
| 4927 | | if (!best || cur->hits > best->hits) |
| 5156 | if (cur->display != display_index && (best == NULL || cur->hits > best->hits)) |
| 4928 | 5157 | best = cur; |
| 4929 | 5158 | |
| 4930 | 5159 | /* if we're done, we're done */ |
| 4931 | | if (!best || best->hits == 0) |
| 5160 | if (best == NULL || best->hits == 0) |
| 4932 | 5161 | break; |
| 4933 | 5162 | |
| 4934 | 5163 | /* print it */ |
| 4935 | | mame_printf_debug("%9d %10d %c ( 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X )\n", |
| 4936 | | best->polys, |
| 4937 | | best->hits, |
| 4938 | | best->is_generic ? '*' : ' ', |
| 5164 | printf("RASTERIZER_ENTRY( 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X ) /* %c %8d %10d */\n", |
| 4939 | 5165 | best->eff_color_path, |
| 4940 | 5166 | best->eff_alpha_mode, |
| 4941 | 5167 | best->eff_fog_mode, |
| 4942 | 5168 | best->eff_fbz_mode, |
| 4943 | 5169 | best->eff_tex_mode_0, |
| 4944 | | best->eff_tex_mode_1); |
| 5170 | best->eff_tex_mode_1, |
| 5171 | best->is_generic ? '*' : ' ', |
| 5172 | best->polys, |
| 5173 | best->hits); |
| 4945 | 5174 | |
| 4946 | 5175 | /* reset */ |
| 4947 | | best->hits = best->polys = 0; |
| 5176 | best->display = display_index; |
| 4948 | 5177 | } |
| 4949 | 5178 | } |
| 4950 | 5179 | |
| 4951 | 5180 | |
| 4952 | 5181 | |
| 4953 | | /************************************* |
| 4954 | | * |
| 4955 | | * Generic rasterizers |
| 4956 | | * |
| 4957 | | *************************************/ |
| 5182 | /*************************************************************************** |
| 5183 | GENERIC RASTERIZERS |
| 5184 | ***************************************************************************/ |
| 4958 | 5185 | |
| 5186 | /*------------------------------------------------- |
| 5187 | raster_fastfill - per-scanline |
| 5188 | implementation of the 'fastfill' command |
| 5189 | -------------------------------------------------*/ |
| 5190 | |
| 5191 | static void raster_fastfill(voodoo_state *v, INT32 scanline) |
| 5192 | { |
| 5193 | int scry, x; |
| 5194 | |
| 5195 | /* determine the screen Y */ |
| 5196 | scry = scanline; |
| 5197 | if (FBZMODE_Y_ORIGIN(v->reg[fbzMode].u)) |
| 5198 | scry = (v->fbi.yorigin - scanline) & 0x3ff; |
| 5199 | |
| 5200 | /* fill this RGB row */ |
| 5201 | if (FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u)) |
| 5202 | { |
| 5203 | UINT16 *ditherow = &v->work.dither[(scanline & 3) * 4]; |
| 5204 | UINT16 *dest = v->work.drawbuf + scry * v->fbi.rowpixels; |
| 5205 | |
| 5206 | for (x = v->work.minx; x < v->work.maxx; x++) |
| 5207 | dest[x] = ditherow[x & 3]; |
| 5208 | } |
| 5209 | |
| 5210 | /* fill this dest buffer row */ |
| 5211 | if (FBZMODE_AUX_BUFFER_MASK(v->reg[fbzMode].u) && v->fbi.aux) |
| 5212 | { |
| 5213 | UINT16 color = v->reg[zaColor].u; |
| 5214 | UINT16 *dest = v->fbi.aux + scry * v->fbi.rowpixels; |
| 5215 | |
| 5216 | for (x = v->work.minx; x < v->work.maxx; x++) |
| 5217 | dest[x] = color; |
| 5218 | } |
| 5219 | } |
| 5220 | |
| 5221 | |
| 5222 | /*------------------------------------------------- |
| 5223 | generic_0tmu - generic rasterizer for 0 TMUs |
| 5224 | -------------------------------------------------*/ |
| 5225 | |
| 4959 | 5226 | RASTERIZER(generic_0tmu, 0, v->reg[fbzColorPath].u, v->reg[fbzMode].u, v->reg[alphaMode].u, |
| 4960 | 5227 | v->reg[fogMode].u, 0, 0) |
| 4961 | 5228 | |
| 5229 | |
| 5230 | /*------------------------------------------------- |
| 5231 | generic_1tmu - generic rasterizer for 1 TMU |
| 5232 | -------------------------------------------------*/ |
| 5233 | |
| 4962 | 5234 | RASTERIZER(generic_1tmu, 1, v->reg[fbzColorPath].u, v->reg[fbzMode].u, v->reg[alphaMode].u, |
| 4963 | 5235 | v->reg[fogMode].u, v->tmu[0].reg[textureMode].u, 0) |
| 4964 | 5236 | |
| 5237 | |
| 5238 | /*------------------------------------------------- |
| 5239 | generic_2tmu - generic rasterizer for 2 TMUs |
| 5240 | -------------------------------------------------*/ |
| 5241 | |
| 4965 | 5242 | RASTERIZER(generic_2tmu, 2, v->reg[fbzColorPath].u, v->reg[fbzMode].u, v->reg[alphaMode].u, |
| 4966 | 5243 | v->reg[fogMode].u, v->tmu[0].reg[textureMode].u, v->tmu[1].reg[textureMode].u) |
| 4967 | 5244 | |
| 4968 | 5245 | |
| 4969 | | |
| 4970 | 5246 | #else |
| 4971 | 5247 | |
| 4972 | | /************************************* |
| 4973 | | * |
| 4974 | | * Specific rasterizers |
| 4975 | | * |
| 4976 | | *************************************/ |
| 4977 | 5248 | |
| 4978 | | /* blitz -------> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 4979 | | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000000, 0x000B073B, 0x0C261ACF, 0xFFFFFFFF ) /* title */ |
| 4980 | | RASTERIZER_ENTRY( 0x00582C35, 0x00515110, 0x00000000, 0x000B0739, 0x0C261ACF, 0xFFFFFFFF ) /* video */ |
| 4981 | | RASTERIZER_ENTRY( 0x00000035, 0x00000000, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* in-game */ |
| 4982 | | RASTERIZER_ENTRY( 0x00002C35, 0x00515110, 0x00000000, 0x000B07F9, 0x0C261A0F, 0xFFFFFFFF ) /* select screen */ |
| 4983 | | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000000, 0x000B07F9, 0x0C261ACF, 0xFFFFFFFF ) /* select screens */ |
| 4984 | 5249 | |
| 4985 | | /* blitz2k -----> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 4986 | | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000000, 0x000B0739, 0x0C261ACF, 0xFFFFFFFF ) /* select screens */ |
| 5250 | /*************************************************************************** |
| 5251 | GAME-SPECIFIC RASTERIZERS |
| 5252 | ***************************************************************************/ |
| 4987 | 5253 | |
| 4988 | | /* carnevil ----> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 4989 | | RASTERIZER_ENTRY( 0x00002435, 0x04045119, 0x00000000, 0x00030279, 0x0C261A0F, 0xFFFFFFFF ) /* clown */ |
| 4990 | | RASTERIZER_ENTRY( 0x00002425, 0x00045119, 0x00000000, 0x00030679, 0x0C261A0F, 0xFFFFFFFF ) /* clown */ |
| 5254 | /* blitz ------> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5255 | RASTERIZER_ENTRY( 0x00000035, 0x00000000, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* 284269 914846168 */ |
| 5256 | RASTERIZER_ENTRY( 0x00002C35, 0x00515110, 0x00000000, 0x000B07F9, 0x0C261A0F, 0xFFFFFFFF ) /* 485421 440309121 */ |
| 5257 | RASTERIZER_ENTRY( 0x00582C35, 0x00515110, 0x00000000, 0x000B0739, 0x0C261ACF, 0xFFFFFFFF ) /* 31606 230753709 */ |
| 5258 | RASTERIZER_ENTRY( 0x00582C35, 0x00515110, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* 76742 211701679 */ |
| 5259 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000000, 0x000B073B, 0x0C261ACF, 0xFFFFFFFF ) /* 6188 152109056 */ |
| 5260 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000000, 0x000B07F9, 0x0C261ACF, 0xFFFFFFFF ) /* 1100 108134400 */ |
| 5261 | RASTERIZER_ENTRY( 0x00002C35, 0x64515119, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* 6229525 106197740 */ |
| 5262 | RASTERIZER_ENTRY( 0x00002C35, 0x40515119, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* 87756 103438805 */ |
| 5263 | RASTERIZER_ENTRY( 0x00002C35, 0x64515119, 0x00000000, 0x000B0799, 0x0C261A0F, 0xFFFFFFFF ) /* 905641 75886220 */ |
| 5264 | RASTERIZER_ENTRY( 0x00002C35, 0x40515119, 0x00000000, 0x000B07F9, 0x0C261A0F, 0xFFFFFFFF ) /* 205236 53317253 */ |
| 5265 | RASTERIZER_ENTRY( 0x01422439, 0x00000000, 0x00000000, 0x000B073B, 0x0C2610C9, 0xFFFFFFFF ) /* 817356 48881349 */ |
| 5266 | RASTERIZER_ENTRY( 0x00000035, 0x00000000, 0x00000000, 0x000B07F9, 0x0C261A0F, 0xFFFFFFFF ) /* 37979 41687251 */ |
| 5267 | RASTERIZER_ENTRY( 0x00002C35, 0x00515110, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* 26014 41183295 */ |
| 5268 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000000, 0x000B07F9, 0x0C261A0F, 0xFFFFFFFF ) /* 2512 37911104 */ |
| 5269 | RASTERIZER_ENTRY( 0x00006136, 0x40515119, 0x00000000, 0x000B07F9, 0x0C261A0F, 0xFFFFFFFF ) /* 28834 15527654 */ |
| 5270 | RASTERIZER_ENTRY( 0x00582435, 0x00515110, 0x00000000, 0x000B0739, 0x0C261ACF, 0xFFFFFFFF ) /* 9878 4979429 */ |
| 5271 | RASTERIZER_ENTRY( 0x00002C35, 0x64515119, 0x00000000, 0x000B0739, 0x0C261ACF, 0xFFFFFFFF ) /* 199952 4622064 */ |
| 5272 | RASTERIZER_ENTRY( 0x00582C35, 0x00515110, 0x00000000, 0x000B0739, 0x0C261AC9, 0xFFFFFFFF ) /* 8672 3676949 */ |
| 5273 | RASTERIZER_ENTRY( 0x00582C35, 0x00515010, 0x00000000, 0x000B0739, 0x0C2610CF, 0xFFFFFFFF ) /* 616 2743972 */ |
| 5274 | RASTERIZER_ENTRY( 0x01422C39, 0x00045110, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* 81380 2494832 */ |
| 5275 | //RASTERIZER_ENTRY( 0x00582435, 0x00515110, 0x00000000, 0x000B0739, 0x0C261AC9, 0xFFFFFFFF ) /* 7670 2235587 */ |
| 5276 | //RASTERIZER_ENTRY( 0x00592136, 0x00515110, 0x00000000, 0x000B073B, 0x0C261A0F, 0xFFFFFFFF ) /* 210 1639140 */ |
| 5277 | //RASTERIZER_ENTRY( 0x00582C35, 0x00515110, 0x00000000, 0x000B073B, 0x0C261A0F, 0xFFFFFFFF ) /* 108 1154736 */ |
| 5278 | //RASTERIZER_ENTRY( 0x00002C35, 0x00515110, 0x00000000, 0x000B07F9, 0x0C26180F, 0xFFFFFFFF ) /* 2152 1150842 */ |
| 5279 | //RASTERIZER_ENTRY( 0x00592136, 0x00515110, 0x00000000, 0x000B073B, 0x0C261ACF, 0xFFFFFFFF ) /* 152 880560 */ |
| 5280 | //RASTERIZER_ENTRY( 0x00008035, 0x64515119, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* 90848 805730 */ |
| 5281 | //RASTERIZER_ENTRY( 0x00002C35, 0x40515119, 0x00000000, 0x000B07F9, 0x0C261AC9, 0xFFFFFFFF ) /* 2024 571406 */ |
| 5282 | //RASTERIZER_ENTRY( 0x00012136, 0x00515110, 0x00000000, 0x000B07F9, 0x0C261A0F, 0xFFFFFFFF ) /* 1792 494592 */ |
| 5283 | //RASTERIZER_ENTRY( 0x00000002, 0x00000000, 0x00000000, 0x00000300, 0xFFFFFFFF, 0xFFFFFFFF ) /* 256 161280 */ |
| 4991 | 5284 | |
| 4992 | | /* calspeed ----> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 4993 | | RASTERIZER_ENTRY( 0x00002815, 0x05045119, 0x00000001, 0x000A0723, 0x0C261ACF, 0xFFFFFFFF ) /* movie */ |
| 4994 | | RASTERIZER_ENTRY( 0x01022C19, 0x05000009, 0x00000001, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* in-game */ |
| 4995 | | RASTERIZER_ENTRY( 0x00002C15, 0x05045119, 0x00000001, 0x000B0739, 0x0C26180F, 0xFFFFFFFF ) /* in-game */ |
| 4996 | | RASTERIZER_ENTRY( 0x01022C19, 0x05000009, 0x00000001, 0x000B073B, 0x0C26100F, 0xFFFFFFFF ) /* in-game */ |
| 4997 | | RASTERIZER_ENTRY( 0x00480015, 0x05045119, 0x00000001, 0x000B0339, 0x0C26100F, 0xFFFFFFFF ) /* in-game */ |
| 5285 | /* blitz99 ----> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5286 | RASTERIZER_ENTRY( 0x00000035, 0x64000009, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* * 6297478 149465839 */ |
| 5287 | RASTERIZER_ENTRY( 0x00000035, 0x64000009, 0x00000000, 0x000B0739, 0x0C261ACF, 0xFFFFFFFF ) /* * 210693 6285480 */ |
| 5288 | RASTERIZER_ENTRY( 0x01422C39, 0x00045110, 0x00000000, 0x000B073B, 0x0C2610C9, 0xFFFFFFFF ) /* * 20180 2718710 */ |
| 5289 | RASTERIZER_ENTRY( 0x00582C35, 0x00515110, 0x00000000, 0x000B073B, 0x0C261ACF, 0xFFFFFFFF ) /* * 360 2425416 */ |
| 5290 | RASTERIZER_ENTRY( 0x00002C35, 0x64000009, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* * 67059 1480978 */ |
| 5291 | RASTERIZER_ENTRY( 0x00008035, 0x64000009, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* * 24811 400666 */ |
| 5292 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000000, 0x000B073B, 0x0C2610C9, 0xFFFFFFFF ) /* * 10304 324468 */ |
| 5293 | RASTERIZER_ENTRY( 0x00002C35, 0x00515110, 0x00000000, 0x000B0739, 0x0C261ACF, 0xFFFFFFFF ) /* * 1024 112665 */ |
| 4998 | 5294 | |
| 4999 | | /* mace --------> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5000 | | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0xFFFFFFFF ) /* character screen */ |
| 5001 | | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0824100F, 0xFFFFFFFF ) /* in-game */ |
| 5002 | | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0824180F, 0xFFFFFFFF ) /* in-game */ |
| 5003 | | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x082410CF, 0xFFFFFFFF ) /* in-game */ |
| 5004 | | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x082418CF, 0xFFFFFFFF ) /* in-game */ |
| 5295 | /* blitz2k ----> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5296 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000000, 0x000B0739, 0x0C261ACF, 0xFFFFFFFF ) /* * 3880 95344128 */ |
| 5297 | RASTERIZER_ENTRY( 0x00582C35, 0x00514110, 0x00000000, 0x000B0739, 0x0C261ACF, 0xFFFFFFFF ) /* * 148 1785480 */ |
| 5298 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000000, 0x000B073B, 0x0C2610CF, 0xFFFFFFFF ) /* * 9976 314244 */ |
| 5005 | 5299 | |
| 5006 | | /* vaportrx ----> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5007 | | RASTERIZER_ENTRY( 0x00482405, 0x00000009, 0x00000000, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* intro */ |
| 5008 | | RASTERIZER_ENTRY( 0x00482405, 0x00000000, 0x00000000, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* in-game */ |
| 5009 | | RASTERIZER_ENTRY( 0x00482435, 0x00000000, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* in-game */ |
| 5010 | | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B07F9, 0x0C261ACF, 0xFFFFFFFF ) /* in-game */ |
| 5300 | /* carnevil ---> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5301 | RASTERIZER_ENTRY( 0x00002435, 0x04045119, 0x00000000, 0x00030279, 0x0C261A0F, 0xFFFFFFFF ) /* * 492 84128082 */ |
| 5302 | RASTERIZER_ENTRY( 0x00002425, 0x00045119, 0x00000000, 0x00030679, 0x0C261A0F, 0xFFFFFFFF ) /* * 1988398 36166780 */ |
| 5303 | RASTERIZER_ENTRY( 0x00486116, 0x01045119, 0x00000000, 0x00030279, 0x0C26180F, 0xFFFFFFFF ) /* * 34424 28788847 */ |
| 5304 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x00030679, 0x0C261A0F, 0xFFFFFFFF ) /* * 514 26316800 */ |
| 5305 | RASTERIZER_ENTRY( 0x00480015, 0x0F045119, 0x00000000, 0x000306F9, 0x0C261AC9, 0xFFFFFFFF ) /* * 7346 18805760 */ |
| 5306 | RASTERIZER_ENTRY( 0x00002435, 0x40045119, 0x00000000, 0x000302F9, 0x0C26180F, 0xFFFFFFFF ) /* * 130764 18678972 */ |
| 5307 | RASTERIZER_ENTRY( 0x00000035, 0x40045119, 0x00000000, 0x00030679, 0x0C261A0F, 0xFFFFFFFF ) /* * 3380 13844480 */ |
| 5308 | RASTERIZER_ENTRY( 0x00482415, 0x0F045119, 0x00000000, 0x000306F9, 0x0C2618C9, 0xFFFFFFFF ) /* * 7244 12179040 */ |
| 5309 | RASTERIZER_ENTRY( 0x00482415, 0x0A045119, 0x00000000, 0x000306F9, 0x0C26180F, 0xFFFFFFFF ) /* * 84520 12059721 */ |
| 5310 | RASTERIZER_ENTRY( 0x00000035, 0x0A045119, 0x00000000, 0x000306F9, 0x0C261AC9, 0xFFFFFFFF ) /* * 21926 11226112 */ |
| 5311 | RASTERIZER_ENTRY( 0x00482415, 0x40045119, 0x00000000, 0x00030679, 0x0C2618C9, 0xFFFFFFFF ) /* * 92115 8926536 */ |
| 5312 | RASTERIZER_ENTRY( 0x00480015, 0x04045119, 0x00000000, 0x000306F9, 0x0C261AC9, 0xFFFFFFFF ) /* * 5018 7711968 */ |
| 5313 | RASTERIZER_ENTRY( 0x00482415, 0x04045119, 0x00000000, 0x00030279, 0x0C261A0F, 0xFFFFFFFF ) /* * 1730 7629334 */ |
| 5314 | RASTERIZER_ENTRY( 0x00002435, 0x40045119, 0x00000000, 0x000B0779, 0x0C26180F, 0xFFFFFFFF ) /* * 37408 5545956 */ |
| 5315 | RASTERIZER_ENTRY( 0x00002435, 0x40045119, 0x00000000, 0x00030679, 0x0C26180F, 0xFFFFFFFF ) /* * 26528 4225026 */ |
| 5316 | RASTERIZER_ENTRY( 0x00002435, 0x08045119, 0x00000000, 0x000306F9, 0x0C26180F, 0xFFFFFFFF ) /* * 35764 3230884 */ |
| 5317 | RASTERIZER_ENTRY( 0x00000035, 0x08045119, 0x00000000, 0x000306F9, 0x0C261AC9, 0xFFFFFFFF ) /* * 3926 2404352 */ |
| 5318 | RASTERIZER_ENTRY( 0x01422409, 0x00045119, 0x00000000, 0x00030679, 0x0C261A0F, 0xFFFFFFFF ) /* * 96020 1226438 */ |
| 5319 | RASTERIZER_ENTRY( 0x00482415, 0x04045119, 0x00000000, 0x00030279, 0x0C2618C9, 0xFFFFFFFF ) /* * 1020 574649 */ |
| 5320 | RASTERIZER_ENTRY( 0x00482415, 0x05045119, 0x00000000, 0x00030679, 0x0C261A0F, 0xFFFFFFFF ) /* * 360 370008 */ |
| 5321 | RASTERIZER_ENTRY( 0x00480015, 0x04045119, 0x00000000, 0x000306F9, 0x0C261A0F, 0xFFFFFFFF ) /* * 576 334404 */ |
| 5011 | 5322 | |
| 5012 | | /* wg3dh -------> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5013 | | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x082410DF, 0xFFFFFFFF ) /* title */ |
| 5014 | | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x0824101F, 0xFFFFFFFF ) /* credits */ |
| 5015 | | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x08241ADF, 0xFFFFFFFF ) /* in-game */ |
| 5016 | | RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0xFFFFFFFF ) /* in-game */ |
| 5017 | | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x0824189F, 0xFFFFFFFF ) /* in-game */ |
| 5323 | /* calspeed ---> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5324 | RASTERIZER_ENTRY( 0x00002815, 0x05045119, 0x00000001, 0x000B07F9, 0x0C26100F, 0xFFFFFFFF ) /* * 99120 1731923836 */ |
| 5325 | RASTERIZER_ENTRY( 0x01022819, 0x05000009, 0x00000001, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 9955804 1526119944 */ |
| 5326 | RASTERIZER_ENTRY( 0x00002815, 0x05045119, 0x00000001, 0x000B0739, 0x0C26180F, 0xFFFFFFFF ) /* * 1898207 1124776864 */ |
| 5327 | RASTERIZER_ENTRY( 0x01022819, 0x05000009, 0x00000001, 0x000B073B, 0x0C26100F, 0xFFFFFFFF ) /* * 3487467 1101663125 */ |
| 5328 | RASTERIZER_ENTRY( 0x01022C19, 0x05000009, 0x00000001, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 1079277 609256033 */ |
| 5329 | RASTERIZER_ENTRY( 0x00002815, 0x05045119, 0x00000001, 0x000A0723, 0x0C261ACF, 0xFFFFFFFF ) /* * 11880 583925760 */ |
| 5330 | RASTERIZER_ENTRY( 0x00602819, 0x05045119, 0x00000001, 0x000B07F9, 0x0C26180F, 0xFFFFFFFF ) /* * 63644 582469888 */ |
| 5331 | RASTERIZER_ENTRY( 0x01022819, 0x05000009, 0x00000001, 0x000B07F9, 0x0C261A0F, 0xFFFFFFFF ) /* * 22688 556797972 */ |
| 5332 | RASTERIZER_ENTRY( 0x00002815, 0x05045119, 0x00000001, 0x000B07F9, 0x0C26180F, 0xFFFFFFFF ) /* * 1360254 417068457 */ |
| 5333 | RASTERIZER_ENTRY( 0x00002815, 0x05045119, 0x00000001, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 3427489 405421272 */ |
| 5334 | RASTERIZER_ENTRY( 0x00002C15, 0x05045119, 0x00000001, 0x000B0739, 0x0C26180F, 0xFFFFFFFF ) /* * 286809 238944049 */ |
| 5335 | RASTERIZER_ENTRY( 0x00002815, 0x05045119, 0x00000001, 0x000A0321, 0x0C26180F, 0xFFFFFFFF ) /* * 28160 231084818 */ |
| 5336 | RASTERIZER_ENTRY( 0x01022819, 0x05000009, 0x00000001, 0x000B07FB, 0x0C26100F, 0xFFFFFFFF ) /* * 183564 201014424 */ |
| 5337 | RASTERIZER_ENTRY( 0x00480015, 0x05045119, 0x00000001, 0x000B0339, 0x0C26100F, 0xFFFFFFFF ) /* * 15275 168207109 */ |
| 5338 | RASTERIZER_ENTRY( 0x01022819, 0x05000009, 0x00000001, 0x000B07F9, 0x0C26100F, 0xFFFFFFFF ) /* * 2856 134400000 */ |
| 5339 | RASTERIZER_ENTRY( 0x00002815, 0x05045119, 0x00000001, 0x000B0339, 0x0C26180F, 0xFFFFFFFF ) /* * 98551 110417974 */ |
| 5340 | RASTERIZER_ENTRY( 0x01022819, 0x05000009, 0x00000001, 0x000B07F9, 0x0C2610CF, 0xFFFFFFFF ) /* * 47040 107360728 */ |
| 5341 | RASTERIZER_ENTRY( 0x00480015, 0x05045119, 0x00000001, 0x000B0339, 0x0C26180F, 0xFFFFFFFF ) /* * 13128 86876789 */ |
| 5342 | RASTERIZER_ENTRY( 0x01022C19, 0x05000009, 0x00000001, 0x000B073B, 0x0C26100F, 0xFFFFFFFF ) /* * 257515 76329054 */ |
| 5343 | RASTERIZER_ENTRY( 0x00002815, 0x05045119, 0x00000001, 0x000B07F9, 0x0C261A0F, 0xFFFFFFFF ) /* * 3934 64958208 */ |
| 5344 | //RASTERIZER_ENTRY( 0x00002C15, 0x05045119, 0x00000001, 0x000B07F9, 0x0C26180F, 0xFFFFFFFF ) /* * 77400 63786236 */ |
| 5345 | //RASTERIZER_ENTRY( 0x01022C19, 0x05000009, 0x00000001, 0x000B07F9, 0x0C261A0F, 0xFFFFFFFF ) /* * 12500 63151200 */ |
| 5346 | //RASTERIZER_ENTRY( 0x0102001A, 0x05045119, 0x00000001, 0x000A0321, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 8764 57629312 */ |
| 5347 | //RASTERIZER_ENTRY( 0x00002C15, 0x05045119, 0x00000001, 0x000A0321, 0x0C26180F, 0xFFFFFFFF ) /* * 3257 32708448 */ |
| 5348 | //RASTERIZER_ENTRY( 0x00002815, 0x05045119, 0x00000001, 0x000A07E3, 0x0C2610CF, 0xFFFFFFFF ) /* * 28364 31195605 */ |
| 5349 | //RASTERIZER_ENTRY( 0x00002C15, 0x05045119, 0x00000001, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 409001 30699647 */ |
| 5350 | //RASTERIZER_ENTRY( 0x00482C35, 0x05045119, 0x00000001, 0x000A0321, 0x0C26100F, 0xFFFFFFFF ) /* * 17669 11214172 */ |
| 5351 | //RASTERIZER_ENTRY( 0x00002C15, 0x05045119, 0x00000001, 0x000B0339, 0x0C26180F, 0xFFFFFFFF ) /* * 5844 6064373 */ |
| 5352 | //RASTERIZER_ENTRY( 0x00002C15, 0x05045119, 0x00000001, 0x000B07FB, 0x0C26100F, 0xFFFFFFFF ) /* * 626 4651080 */ |
| 5353 | //RASTERIZER_ENTRY( 0x00482C35, 0x05045119, 0x00000001, 0x000A0321, 0x0C26180F, 0xFFFFFFFF ) /* * 5887 2945500 */ |
| 5354 | //RASTERIZER_ENTRY( 0x00480015, 0x05045119, 0x00000001, 0x000B0339, 0x0C261A0F, 0xFFFFFFFF ) /* * 1090 2945093 */ |
| 5355 | //RASTERIZER_ENTRY( 0x00602C19, 0x05045119, 0x00000001, 0x000B07F9, 0x0C26180F, 0xFFFFFFFF ) /* * 228 1723908 */ |
| 5356 | //RASTERIZER_ENTRY( 0x00002C15, 0x05045119, 0x00000001, 0x000A0321, 0x0C261A0F, 0xFFFFFFFF ) /* * 112 1433600 */ |
| 5357 | //RASTERIZER_ENTRY( 0x00002815, 0x05045119, 0x00000001, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* * 3091 1165805 */ |
| 5358 | //RASTERIZER_ENTRY( 0x01022C19, 0x05000009, 0x00000001, 0x000B07FB, 0x0C26100F, 0xFFFFFFFF ) /* * 620 791202 */ |
| 5018 | 5359 | |
| 5360 | /* hyprdriv ---> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5361 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000001, 0x000B0739, 0x0C261ACF, 0xFFFFFFFF ) /* * 60860 498565120 */ |
| 5362 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000001, 0x000B07F9, 0x0C261A0F, 0xFFFFFFFF ) /* * 28688 235012096 */ |
| 5363 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000001, 0x000B07F9, 0x0C261ACF, 0xFFFFFFFF ) /* * 11844 156499968 */ |
| 5364 | RASTERIZER_ENTRY( 0x00580035, 0x0A045119, 0x00000001, 0x00030279, 0x0C261A0F, 0xFFFFFFFF ) /* * 175990 146518715 */ |
| 5365 | RASTERIZER_ENTRY( 0x00582C35, 0x00515110, 0x00000001, 0x000B0739, 0x0C261ACF, 0xFFFFFFFF ) /* * 2336 114819072 */ |
| 5366 | RASTERIZER_ENTRY( 0x00580035, 0x00000000, 0x00000001, 0x000B073B, 0x0C261A1F, 0xFFFFFFFF ) /* * 363325 100404294 */ |
| 5367 | RASTERIZER_ENTRY( 0x00582C35, 0x00045110, 0x00000001, 0x000B073B, 0x0C261A0F, 0xFFFFFFFF ) /* * 40918 96318738 */ |
| 5368 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000001, 0x000B0739, 0x0C26101F, 0xFFFFFFFF ) /* * 54815 94990269 */ |
| 5369 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000001, 0x000B0739, 0x0C261A1F, 0xFFFFFFFF ) /* * 123032 91652828 */ |
| 5370 | RASTERIZER_ENTRY( 0x01422429, 0x00000000, 0x00000001, 0x000B0739, 0x0C261A1F, 0xFFFFFFFF ) /* * 82767 86431997 */ |
| 5371 | RASTERIZER_ENTRY( 0x01422429, 0x00000000, 0x00000001, 0x000B0739, 0x0C26101F, 0xFFFFFFFF ) /* * 9874 78101834 */ |
| 5372 | RASTERIZER_ENTRY( 0x01422429, 0x00000000, 0x00000001, 0x000B073B, 0x0C261A1F, 0xFFFFFFFF ) /* * 102146 72570879 */ |
| 5373 | RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000001, 0x000B073B, 0x0C26100F, 0xFFFFFFFF ) /* * 657804 67229658 */ |
| 5374 | RASTERIZER_ENTRY( 0x00580035, 0x00045110, 0x00000001, 0x000B03F9, 0x0C261A0F, 0xFFFFFFFF ) /* * 10428 63173865 */ |
| 5375 | RASTERIZER_ENTRY( 0x01422429, 0x00000000, 0x00000001, 0x000B073B, 0x0C261A0F, 0xFFFFFFFF ) /* * 230145 57902926 */ |
| 5376 | RASTERIZER_ENTRY( 0x01422C19, 0x00000000, 0x00000001, 0x000B073B, 0x0C261A0F, 0xFFFFFFFF ) /* * 769654 53992486 */ |
| 5377 | RASTERIZER_ENTRY( 0x01422C19, 0x00000000, 0x00000001, 0x000B0739, 0x0C26101F, 0xFFFFFFFF ) /* * 85365 51865697 */ |
| 5378 | RASTERIZER_ENTRY( 0x00582435, 0x00515110, 0x00000001, 0x000B0739, 0x0C261AC9, 0xFFFFFFFF ) /* * 454674 46165536 */ |
| 5379 | RASTERIZER_ENTRY( 0x00580035, 0x00000000, 0x00000001, 0x000B073B, 0x0C26101F, 0xFFFFFFFF ) /* * 101889 33337987 */ |
| 5380 | RASTERIZER_ENTRY( 0x00580035, 0x00000000, 0x00000001, 0x000B0739, 0x0C26101F, 0xFFFFFFFF ) /* * 255952 29810993 */ |
| 5381 | //RASTERIZER_ENTRY( 0x00582425, 0x00000000, 0x00000001, 0x000B073B, 0x0C261A1F, 0xFFFFFFFF ) /* * 106190 25430383 */ |
| 5382 | //RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000001, 0x000B073B, 0x0C261A1F, 0xFFFFFFFF ) /* * 595001 23268601 */ |
| 5383 | //RASTERIZER_ENTRY( 0x0142612A, 0x00000000, 0x00000001, 0x000B0739, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 946410 22589110 */ |
| 5384 | //RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000001, 0x000B073B, 0x0C261A0F, 0xFFFFFFFF ) /* * 330036 21323230 */ |
| 5385 | //RASTERIZER_ENTRY( 0x01422C19, 0x00000000, 0x00000001, 0x000B0739, 0x0C261A1F, 0xFFFFFFFF ) /* * 40089 13470498 */ |
| 5386 | //RASTERIZER_ENTRY( 0x01422C19, 0x00000000, 0x00000000, 0x000B073B, 0x0C261A0F, 0xFFFFFFFF ) /* * 90906 12850855 */ |
| 5387 | //RASTERIZER_ENTRY( 0x00582C35, 0x00515110, 0x00000001, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* * 9492 12115280 */ |
| 5388 | //RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000001, 0x000B073B, 0x0C26101F, 0xFFFFFFFF ) /* * 453515 12013961 */ |
| 5389 | //RASTERIZER_ENTRY( 0x01422C19, 0x00000000, 0x00000001, 0x000B073B, 0x0C261A1F, 0xFFFFFFFF ) /* * 33829 8384312 */ |
| 5390 | //RASTERIZER_ENTRY( 0x00580035, 0x00000000, 0x00000001, 0x000B073B, 0x0C26100F, 0xFFFFFFFF ) /* * 83986 7841206 */ |
| 5391 | //RASTERIZER_ENTRY( 0x00580035, 0x00045110, 0x00000001, 0x000B0339, 0x0C261A0F, 0xFFFFFFFF ) /* * 42515 7242660 */ |
| 5392 | //RASTERIZER_ENTRY( 0x00582425, 0x00000000, 0x00000001, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 706 6158684 */ |
| 5393 | //RASTERIZER_ENTRY( 0x00582425, 0x00000000, 0x00000001, 0x000B0739, 0x0C26101F, 0xFFFFFFFF ) /* * 62051 5819485 */ |
| 5394 | //RASTERIZER_ENTRY( 0x0142612A, 0x00000000, 0x00000000, 0x000B0739, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 135139 5063467 */ |
| 5395 | //RASTERIZER_ENTRY( 0x01422429, 0x00000000, 0x00000001, 0x000B073B, 0x0C26100F, 0xFFFFFFFF ) /* * 10359 5135837 */ |
| 5396 | //RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000001, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 170159 4449246 */ |
| 5397 | //RASTERIZER_ENTRY( 0x00582425, 0x00000000, 0x00000001, 0x000B073B, 0x0C26101F, 0xFFFFFFFF ) /* * 19037 4371219 */ |
| 5398 | //RASTERIZER_ENTRY( 0x01422429, 0x00000000, 0x00000001, 0x000B073B, 0x0C26101F, 0xFFFFFFFF ) /* * 8963 4352501 */ |
| 5399 | //RASTERIZER_ENTRY( 0x01422C39, 0x00045110, 0x00000001, 0x000B073B, 0x0C261A0F, 0xFFFFFFFF ) /* * 47712 4159994 */ |
| 5400 | //RASTERIZER_ENTRY( 0x01422C19, 0x00000000, 0x00000000, 0x000B073B, 0x0C261ACF, 0xFFFFFFFF ) /* * 47525 4151435 */ |
| 5401 | //RASTERIZER_ENTRY( 0x01422C19, 0x00000000, 0x00000001, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* * 34980 3794066 */ |
| 5402 | //RASTERIZER_ENTRY( 0x0142613A, 0x00045110, 0x00000000, 0x000B0739, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 6540 2358068 */ |
| 5403 | //RASTERIZER_ENTRY( 0x0142611A, 0x00045110, 0x00000000, 0x000B0739, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 703308 2096781 */ |
| 5404 | //RASTERIZER_ENTRY( 0x00580035, 0x00045110, 0x00000001, 0x000B0339, 0x0C261A1F, 0xFFFFFFFF ) /* * 3963 2079440 */ |
| 5405 | //RASTERIZER_ENTRY( 0x01422439, 0x00000000, 0x00000001, 0x000B073B, 0x0C261AC9, 0xFFFFFFFF ) /* * 22866 2008397 */ |
| 5406 | //RASTERIZER_ENTRY( 0x01420039, 0x00000000, 0x00000001, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* * 69705 1673671 */ |
| 5407 | //RASTERIZER_ENTRY( 0x01422C19, 0x00000000, 0x00000001, 0x000B073B, 0x0C26100F, 0xFFFFFFFF ) /* * 13366 1575120 */ |
| 5408 | //RASTERIZER_ENTRY( 0x0142613A, 0x00000000, 0x00000000, 0x000B0739, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 50625 1408211 */ |
| 5409 | //RASTERIZER_ENTRY( 0x0142613A, 0x00045110, 0x00000001, 0x000B0739, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 1244348 1244346 */ |
| 5410 | //RASTERIZER_ENTRY( 0x00582425, 0x00000000, 0x00000001, 0x000B073B, 0x0C26100F, 0xFFFFFFFF ) /* * 13791 1222735 */ |
| 5411 | //RASTERIZER_ENTRY( 0x00580035, 0x00000000, 0x00000001, 0x000B073B, 0x0C261A0F, 0xFFFFFFFF ) /* * 33064 943590 */ |
| 5412 | //RASTERIZER_ENTRY( 0x0142610A, 0x00045110, 0x00000001, 0x000B0739, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 2041 926507 */ |
| 5413 | //RASTERIZER_ENTRY( 0x00480019, 0x00045110, 0x00000001, 0x000B073B, 0x0C261A0F, 0xFFFFFFFF ) /* * 2722 453924 */ |
| 5414 | //RASTERIZER_ENTRY( 0x00580035, 0x00000000, 0x00000001, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 68232 306869 */ |
| 5415 | //RASTERIZER_ENTRY( 0x0142611A, 0x00045110, 0x00000001, 0x000B0379, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 7164 269002 */ |
| 5416 | |
| 5417 | /* mace -------> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5418 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0824100F, 0xFFFFFFFF ) /* * 7204150 1340201579 */ |
| 5419 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x08241ADF, 0xFFFFFFFF ) /* * 15332 1181663232 */ |
| 5420 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0xFFFFFFFF ) /* * 104456 652582379 */ |
| 5421 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0824180F, 0xFFFFFFFF ) /* * 488613 368880164 */ |
| 5422 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x082418CF, 0xFFFFFFFF ) /* * 352924 312417405 */ |
| 5423 | RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0xFFFFFFFF ) /* * 15024 291762384 */ |
| 5424 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x082410CF, 0xFFFFFFFF ) /* * 711824 279246170 */ |
| 5425 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x0824100F, 0xFFFFFFFF ) /* * 735574 171881981 */ |
| 5426 | RASTERIZER_ENTRY( 0x00602401, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0xFFFFFFFF ) /* * 943006 154374023 */ |
| 5427 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x082410CF, 0xFFFFFFFF ) /* * 103877 101077498 */ |
| 5428 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0824108F, 0xFFFFFFFF ) /* * 710125 87547221 */ |
| 5429 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x08241ACF, 0xFFFFFFFF ) /* * 9834 79774966 */ |
| 5430 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0379, 0x082418DF, 0xFFFFFFFF ) /* * 17644 70187036 */ |
| 5431 | RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000000, 0x000B0379, 0x082418DF, 0xFFFFFFFF ) /* * 11324 56633925 */ |
| 5432 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0379, 0x0824180F, 0xFFFFFFFF ) /* * 96743 40820171 */ |
| 5433 | RASTERIZER_ENTRY( 0x00482435, 0xA4045119, 0x00000000, 0x000B0739, 0x082418CF, 0xFFFFFFFF ) /* * 166053 29100794 */ |
| 5434 | RASTERIZER_ENTRY( 0x00482435, 0xA4045117, 0x00000000, 0x000B0339, 0x082418CF, 0xFFFFFFFF ) /* * 166053 29100697 */ |
| 5435 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0379, 0x0824188F, 0xFFFFFFFF ) /* * 6723 29076516 */ |
| 5436 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0824188F, 0xFFFFFFFF ) /* * 53297 23928976 */ |
| 5437 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x0824180F, 0xFFFFFFFF ) /* * 10309 19001776 */ |
| 5438 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0379, 0x0824180F, 0xFFFFFFFF ) /* * 22105 17473157 */ |
| 5439 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0379, 0x0824188F, 0xFFFFFFFF ) /* * 11304 17236698 */ |
| 5440 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x082410DF, 0xFFFFFFFF ) /* * 1664 17180883 */ |
| 5441 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x08241A0F, 0xFFFFFFFF ) /* * 148606 12274278 */ |
| 5442 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x082418CF, 0xFFFFFFFF ) /* * 80692 9248007 */ |
| 5443 | //RASTERIZER_ENTRY( 0x00482435, 0xA4045119, 0x00000001, 0x000B0739, 0x082418CF, 0xFFFFFFFF ) /* * 37819 8080994 */ |
| 5444 | //RASTERIZER_ENTRY( 0x00482435, 0xA4045117, 0x00000001, 0x000B0339, 0x082418CF, 0xFFFFFFFF ) /* * 37819 8080969 */ |
| 5445 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B0379, 0x082418DF, 0xFFFFFFFF ) /* * 536 7930305 */ |
| 5446 | //RASTERIZER_ENTRY( 0x00482435, 0x99045117, 0x00000000, 0x000B0339, 0x082418CF, 0xFFFFFFFF ) /* * 27601 7905364 */ |
| 5447 | //RASTERIZER_ENTRY( 0x00482435, 0x99045119, 0x00000000, 0x000B0739, 0x082418CF, 0xFFFFFFFF ) /* * 27601 7905364 */ |
| 5448 | //RASTERIZER_ENTRY( 0x00482435, 0xAF045119, 0x00000000, 0x000B0739, 0x082418CF, 0xFFFFFFFF ) /* * 36314 7667917 */ |
| 5449 | //RASTERIZER_ENTRY( 0x00482435, 0xAF045117, 0x00000000, 0x000B0339, 0x082418CF, 0xFFFFFFFF ) /* * 36314 7667917 */ |
| 5450 | //RASTERIZER_ENTRY( 0x00482435, 0xBA045119, 0x00000000, 0x000B0739, 0x082418CF, 0xFFFFFFFF ) /* * 31109 6020110 */ |
| 5451 | //RASTERIZER_ENTRY( 0x00482435, 0xBA045117, 0x00000000, 0x000B0339, 0x082418CF, 0xFFFFFFFF ) /* * 31109 6020110 */ |
| 5452 | //RASTERIZER_ENTRY( 0x00482435, 0x6D045117, 0x00000000, 0x000B0339, 0x082418CF, 0xFFFFFFFF ) /* * 42689 5959231 */ |
| 5453 | //RASTERIZER_ENTRY( 0x00482435, 0x6D045119, 0x00000000, 0x000B0739, 0x082418CF, 0xFFFFFFFF ) /* * 42689 5959231 */ |
| 5454 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x0824188F, 0xFFFFFFFF ) /* * 11965 5118044 */ |
| 5455 | //RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000001, 0x000B0379, 0x0824180F, 0xFFFFFFFF ) /* * 11923 4662909 */ |
| 5456 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0379, 0x082410CF, 0xFFFFFFFF ) /* * 4422 4624260 */ |
| 5457 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0379, 0x0824100F, 0xFFFFFFFF ) /* * 3853 3596375 */ |
| 5458 | //RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000001, 0x000B0379, 0x082418DF, 0xFFFFFFFF ) /* * 400 3555759 */ |
| 5459 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0379, 0x0824180F, 0xFFFFFFFF ) /* * 3755 3453084 */ |
| 5460 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B0779, 0x082418DF, 0xFFFFFFFF ) /* * 4170 2425016 */ |
| 5461 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0824184F, 0xFFFFFFFF ) /* * 322 2220073 */ |
| 5462 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0379, 0x082418CF, 0xFFFFFFFF ) /* * 4008 1201335 */ |
| 5463 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x0824108F, 0xFFFFFFFF ) /* * 13704 883585 */ |
| 5464 | |
| 5465 | /* sfrush -----> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5466 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0824101F ) /* * 590139 246714190 */ |
| 5467 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x0824101F, 0x0824101F ) /* * 397774 153418144 */ |
| 5468 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x082410DF ) /* * 22732 146975666 */ |
| 5469 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x00000000, 0x0824101F ) /* * 306398 130393278 */ |
| 5470 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0824101F, 0x0824101F ) /* * 437743 117403881 */ |
| 5471 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0824181F, 0x0824101F ) /* * 66608 109289500 */ |
| 5472 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x00000000, 0x082410DF ) /* * 19101 92573085 */ |
| 5473 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0824181F ) /* * 258287 78618228 */ |
| 5474 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x0824181F, 0x0824101F ) /* * 61814 68788856 */ |
| 5475 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B0779, 0x082410DF, 0x0824181F ) /* * 149792 61464124 */ |
| 5476 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0824181F, 0x0824181F ) /* * 109988 55083276 */ |
| 5477 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x08241ADF, 0x00000000 ) /* * 478 46989312 */ |
| 5478 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x08241ADF, 0x0824181F ) /* * 468 46006272 */ |
| 5479 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x00000000, 0x0824181F ) /* * 125204 39023396 */ |
| 5480 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x08241ADF, 0x082410DB ) /* * 394 38731776 */ |
| 5481 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x082410DF, 0x082410DB ) /* * 12890 36333568 */ |
| 5482 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0379, 0x0824101F, 0x0824101F ) /* * 147995 31086325 */ |
| 5483 | RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000000, 0x000B077B, 0x00000000, 0x082410DB ) /* * 3576 29294592 */ |
| 5484 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x0824181F, 0x0824181F ) /* * 76059 29282981 */ |
| 5485 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B0779, 0x082418DF, 0x0824101F ) /* * 12632 29173808 */ |
| 5486 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x00000000, 0x082418DF ) /* * 14040 24318118 */ |
| 5487 | //RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000001, 0x000B0379, 0x0824101F, 0x0824101F ) /* * 56586 17643207 */ |
| 5488 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B0779, 0x082418DF, 0x0824181F ) /* * 9130 17277440 */ |
| 5489 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0x0824101F ) /* * 66302 17049921 */ |
| 5490 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B0779, 0x082410DF, 0x0824101F ) /* * 64380 16463672 */ |
| 5491 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x082410DF, 0x0824181F ) /* * 152 14942208 */ |
| 5492 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0x0824101F ) /* * 8748 13810176 */ |
| 5493 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x082708DF, 0x0824101F ) /* * 216634 10628656 */ |
| 5494 | //RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000001, 0x000B077B, 0x00000000, 0x082410DB ) /* * 1282 10502144 */ |
| 5495 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x082418DF, 0x0824101F ) /* * 74636 9758030 */ |
| 5496 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0x082410DB ) /* * 58652 9353671 */ |
| 5497 | //RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0x082410DB ) /* * 5242 8038747 */ |
| 5498 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B077B, 0x082410DB, 0x082410DB ) /* * 11048 7538060 */ |
| 5499 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0824101F, 0x0824181F ) /* * 121630 6906591 */ |
| 5500 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x082418DF ) /* * 19553 6864245 */ |
| 5501 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x082418DF, 0x082418DF ) /* * 1287 6648834 */ |
| 5502 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x082708DF, 0x0824101F ) /* * 197766 6617876 */ |
| 5503 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x082700DF, 0x0824101F ) /* * 75470 6231739 */ |
| 5504 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B0779, 0x08241ADF, 0x0824101F ) /* * 180 5898240 */ |
| 5505 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B0779, 0x082410DF, 0x082410DB ) /* * 7692 5743360 */ |
| 5506 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x082418DF, 0x0824181F ) /* * 20128 4980591 */ |
| 5507 | //RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000001, 0x000B0779, 0x082418DF, 0x0824181F ) /* * 1144 4685824 */ |
| 5508 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x082700DF, 0x0824101F ) /* * 72299 4466336 */ |
| 5509 | //RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000000, 0x000B0779, 0x082410DF, 0x082410DB ) /* * 3750 4018176 */ |
| 5510 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x082410DF, 0x082410DF ) /* * 7533 3692141 */ |
| 5511 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B077B, 0x082410DB, 0x0824101F ) /* * 9484 3610674 */ |
| 5512 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000001, 0x000B0779, 0x0824101F, 0x0824181F ) /* * 128660 3216280 */ |
| 5513 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B0779, 0x082418DF, 0x082410DB ) /* * 22214 3172813 */ |
| 5514 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B077B, 0x082410DB, 0x0824181F ) /* * 5094 3099098 */ |
| 5515 | //RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000001, 0x000B0779, 0x082418DF, 0x0824101F ) /* * 1954 2850924 */ |
| 5516 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0x0824181F ) /* * 1542 2434304 */ |
| 5517 | //RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0x00000000 ) /* * 478 1957888 */ |
| 5518 | //RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0x0824181F ) /* * 468 1916928 */ |
| 5519 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B077B, 0x082410DB, 0x0824101F ) /* * 11664 1729188 */ |
| 5520 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000001, 0x000B077B, 0x082410DB, 0x082410DB ) /* * 1282 1640960 */ |
| 5521 | //RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000001, 0x000B077B, 0x082410DB, 0x0824101F ) /* * 388 1589248 */ |
| 5522 | //RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000001, 0x000B0779, 0x082410DF, 0x082410DB ) /* * 1282 1312768 */ |
| 5523 | //RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B077B, 0x082410DB, 0x0824181F ) /* * 3928 1046582 */ |
| 5524 | |
| 5525 | /* vaportrx ---> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5526 | RASTERIZER_ENTRY( 0x00482405, 0x00000000, 0x00000000, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 2226138 592165102 */ |
| 5527 | RASTERIZER_ENTRY( 0x00482435, 0x00000000, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* * 53533 281405105 */ |
| 5528 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B07F9, 0x0C261ACF, 0xFFFFFFFF ) /* * 314131 219103141 */ |
| 5529 | RASTERIZER_ENTRY( 0x00482405, 0x00045119, 0x00000000, 0x000B0339, 0x0C261A0F, 0xFFFFFFFF ) /* * 216329 95014510 */ |
| 5530 | RASTERIZER_ENTRY( 0x00482405, 0x00000009, 0x00000000, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 317128 92010096 */ |
| 5531 | RASTERIZER_ENTRY( 0x0142613A, 0x00045119, 0x00000000, 0x000B07F9, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 13728 88595930 */ |
| 5532 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0339, 0x0C261ACF, 0xFFFFFFFF ) /* * 649448 81449105 */ |
| 5533 | RASTERIZER_ENTRY( 0x00482435, 0x00000000, 0x00000000, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 444231 60067944 */ |
| 5534 | RASTERIZER_ENTRY( 0x00482405, 0x00045119, 0x00000000, 0x000B0339, 0x0C26184F, 0xFFFFFFFF ) /* * 36057 58970468 */ |
| 5535 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0339, 0x0C26100F, 0xFFFFFFFF ) /* * 53147 48856709 */ |
| 5536 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B07F9, 0x0C2610C9, 0xFFFFFFFF ) /* * 447654 47171792 */ |
| 5537 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0339, 0x0C261A0F, 0xFFFFFFFF ) /* * 207392 38933691 */ |
| 5538 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0739, 0x0C2610CF, 0xFFFFFFFF ) /* * 2015632 33364173 */ |
| 5539 | RASTERIZER_ENTRY( 0x00482405, 0x00045119, 0x00000000, 0x000B0339, 0x0C26100F, 0xFFFFFFFF ) /* * 196361 30395218 */ |
| 5540 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0339, 0x0C2610CF, 0xFFFFFFFF ) /* * 110898 28973006 */ |
| 5541 | RASTERIZER_ENTRY( 0x00482435, 0x00000009, 0x00000000, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 135107 16301589 */ |
| 5542 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0339, 0x0C261A8F, 0xFFFFFFFF ) /* * 22375 15797748 */ |
| 5543 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0339, 0x0C26184F, 0xFFFFFFFF ) /* * 141539 7513140 */ |
| 5544 | RASTERIZER_ENTRY( 0x0142613A, 0x00045119, 0x00000000, 0x000B0739, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 621403 5369705 */ |
| 5545 | RASTERIZER_ENTRY( 0x00482435, 0x00045110, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* * 30443 4070277 */ |
| 5546 | //RASTERIZER_ENTRY( 0x00482405, 0x00045110, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* * 22121 3129894 */ |
| 5547 | //RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 9187 1864599 */ |
| 5548 | //RASTERIZER_ENTRY( 0x00482405, 0x00044110, 0x00000000, 0x000B0739, 0x0C2610CF, 0xFFFFFFFF ) /* * 10390 1694950 */ |
| 5549 | //RASTERIZER_ENTRY( 0x0142610A, 0x00000009, 0x00000000, 0x000B0739, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 25366 1624563 */ |
| 5550 | //RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0739, 0x0C261A0F, 0xFFFFFFFF ) /* * 69033 1607970 */ |
| 5551 | //RASTERIZER_ENTRY( 0x0142610A, 0x00000000, 0x00000000, 0x000B0739, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 36316 1084818 */ |
| 5552 | //RASTERIZER_ENTRY( 0x00482405, 0x00045119, 0x00000000, 0x000B0339, 0x0C2610CF, 0xFFFFFFFF ) /* * 1813 816763 */ |
| 5553 | //RASTERIZER_ENTRY( 0x0142613A, 0x00045119, 0x00000000, 0x000B0339, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 6602 767221 */ |
| 5554 | //RASTERIZER_ENTRY( 0x00482435, 0x00045110, 0x00000000, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 2547 646048 */ |
| 5555 | //RASTERIZER_ENTRY( 0x00482405, 0x00045119, 0x00000000, 0x000B0339, 0x0C261A8F, 0xFFFFFFFF ) /* * 2394 501590 */ |
| 5556 | //RASTERIZER_ENTRY( 0x0142613A, 0x00000009, 0x00000000, 0x000B0739, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 14078 440086 */ |
| 5557 | //RASTERIZER_ENTRY( 0x0142610A, 0x00045119, 0x00000000, 0x000B0339, 0xFFFFFFFF, 0xFFFFFFFF ) /* * 9877 429160 */ |
| 5558 | //RASTERIZER_ENTRY( 0x00482405, 0x00045119, 0x00000000, 0x000B0339, 0x0C261ACF, 0xFFFFFFFF ) /* * 3222 366052 */ |
| 5559 | //RASTERIZER_ENTRY( 0x00482435, 0x00000009, 0x00000000, 0x000B0739, 0x0C2610CF, 0xFFFFFFFF ) /* * 5942 285657 */ |
| 5560 | //RASTERIZER_ENTRY( 0x00482405, 0x00044119, 0x00000000, 0x000B0339, 0x0C2610CF, 0xFFFFFFFF ) /* * 2328 239688 */ |
| 5561 | //RASTERIZER_ENTRY( 0x00482405, 0x00045119, 0x00000000, 0x000B0739, 0x0C26100F, 0xFFFFFFFF ) /* * 1129 208448 */ |
| 5562 | |
| 5563 | /* wg3dh ------> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5564 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x0824181F, 0xFFFFFFFF ) /* * 127676 116109477 */ |
| 5565 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x0824189F, 0xFFFFFFFF ) /* * 96310 112016758 */ |
| 5566 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x0824109F, 0xFFFFFFFF ) /* * 1412831 108682642 */ |
| 5567 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x0824101F, 0xFFFFFFFF ) /* * 1612798 45952714 */ |
| 5568 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x08241AD9, 0xFFFFFFFF ) /* * 5960 6103040 */ |
| 5569 | RASTERIZER_ENTRY( 0x00002435, 0x00045119, 0x00000000, 0x000B0779, 0x082418DF, 0xFFFFFFFF ) /* * 56512 4856542 */ |
| 5570 | RASTERIZER_ENTRY( 0x00480035, 0x00045119, 0x00000000, 0x000B0779, 0x0824109F, 0xFFFFFFFF ) /* * 8480 2045940 */ |
| 5571 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0379, 0x0824181F, 0xFFFFFFFF ) /* * 2779 1994317 */ |
| 5572 | RASTERIZER_ENTRY( 0x00000035, 0x00045119, 0x00000000, 0x000B0779, 0x0824105F, 0xFFFFFFFF ) /* * 154691 1922774 */ |
| 5573 | RASTERIZER_ENTRY( 0x00002435, 0x00045119, 0x00000000, 0x000B0779, 0x082410DF, 0xFFFFFFFF ) /* * 18114 776139 */ |
| 5574 | |
| 5575 | /* gauntleg ---> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5576 | RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C24100F ) /* * 157050 668626339 */ |
| 5577 | RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B0779, 0x0C22400F, 0x0C241ACF ) /* * 1079126 580272490 */ |
| 5578 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0779, 0x0C241A4F, 0x0C24100F ) /* * 49686 232178144 */ |
| 5579 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0779, 0x0C24104F, 0x0C24100F ) /* * 1048560 206304396 */ |
| 5580 | RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B0779, 0x0C2240CF, 0x0C241ACF ) /* * 59176 182444375 */ |
| 5581 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C241A4F ) /* * 66342 179689728 */ |
| 5582 | RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0779, 0x0C24180F, 0x0C24180F ) /* * 72264 109413344 */ |
| 5583 | RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0779, 0x0C24100F, 0x0C24100F ) /* * 281243 75399210 */ |
| 5584 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C24104F ) /* * 126384 68412120 */ |
| 5585 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0C241A0F, 0x0C24100F ) /* * 26864 43754988 */ |
| 5586 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C241ACF ) /* * 30510 32759936 */ |
| 5587 | RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0779, 0x0C24180F, 0x0C24100F ) /* * 44783 31884168 */ |
| 5588 | RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C24180F ) /* * 34946 31359362 */ |
| 5589 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C241ACF ) /* * 8006 28367999 */ |
| 5590 | RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0379, 0x0C24180F, 0x0C24180F ) /* * 15430 27908213 */ |
| 5591 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C241A0F ) /* * 29306 25166802 */ |
| 5592 | RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0779, 0x0C24180F, 0x0C241ACF ) /* * 27737 24517949 */ |
| 5593 | RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0C241ACF, 0x0C24100F ) /* * 6783 21292092 */ |
| 5594 | RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0379, 0x00000000, 0x0C24180F ) /* * 9591 17815763 */ |
| 5595 | RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0779, 0x0C24100F, 0x0C24180F ) /* * 343966 13864759 */ |
| 5596 | //RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0779, 0x0C241ACF, 0x0C24100F ) /* * 11842 12126208 */ |
| 5597 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0C241A8F, 0x0C24100F ) /* * 6648 9788508 */ |
| 5598 | //RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C2418CF ) /* * 8444 8646656 */ |
| 5599 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0379, 0x0C24180F, 0x0C24100F ) /* * 9677 8365606 */ |
| 5600 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0C24100F, 0x0C24100F ) /* * 844920 8289326 */ |
| 5601 | //RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C24184F ) /* * 3108 8010176 */ |
| 5602 | //RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B03F9, 0x00000000, 0x0C24180F ) /* * 1435 6209238 */ |
| 5603 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0379, 0x0C24180F, 0x0C24100F ) /* * 5754 5617499 */ |
| 5604 | //RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B0379, 0x0C24180F, 0x0C24180F ) /* * 1608 5557253 */ |
| 5605 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0779, 0x0C24100F, 0x0C241ACF ) /* * 105127 5133321 */ |
| 5606 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0379, 0x0C24180F, 0x0C241ACF ) /* * 3460 4689138 */ |
| 5607 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x0C24180F, 0x0C24100F ) /* * 7025 4629550 */ |
| 5608 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C24180F ) /* * 7164 4407683 */ |
| 5609 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C24188F ) /* * 1922 3924179 */ |
| 5610 | //RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C24180F ) /* * 4116 3733777 */ |
| 5611 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0779, 0x00000000, 0x0C241A8F ) /* * 2626 3732809 */ |
| 5612 | //RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B03F9, 0x0C24180F, 0x0C24180F ) /* * 778 3202973 */ |
| 5613 | //RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x00000000, 0x000B0779, 0x0C24184F, 0x0C24100F ) /* * 1525 2997446 */ |
| 5614 | //RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B03F9, 0x0C24180F, 0x0C241A0F ) /* * 645 2975266 */ |
| 5615 | //RASTERIZER_ENTRY( 0x00600039, 0x00044119, 0x00000000, 0x000B0379, 0x00000000, 0x0C241A0F ) /* * 5212 2491361 */ |
| 5616 | //RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B0379, 0x00000000, 0x0C24180F ) /* * 825 1996513 */ |
| 5617 | //RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B0379, 0x0C24180F, 0x0C241A0F ) /* * 466 1967163 */ |
| 5618 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0779, 0x0580000F, 0x0C24180F ) /* * 77400 1883434 */ |
| 5619 | //RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B0379, 0x0C24180F, 0x0C24100F ) /* * 472 1698177 */ |
| 5620 | //RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B0779, 0x0C24180F, 0x0C24180F ) /* * 2476 1678760 */ |
| 5621 | //RASTERIZER_ENTRY( 0x00600C09, 0x00045119, 0x00000000, 0x000B0379, 0x00000000, 0x0C24180F ) /* * 4054 1541748 */ |
| 5622 | //RASTERIZER_ENTRY( 0x00600039, 0x00044119, 0x00000000, 0x000B0379, 0x0C241A0F, 0x0C24180F ) /* * 3132 1509438 */ |
| 5623 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x00000000, 0x000B0779, 0x0580080F, 0x0C24180F ) /* * 8582 1324196 */ |
| 5624 | //RASTERIZER_ENTRY( 0x00602C19, 0x00044119, 0x00000000, 0x000B0379, 0x00000000, 0x0C24100F ) /* * 1436 1239704 */ |
| 5625 | //RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B03F9, 0x0C24180F, 0x0C24100F ) /* * 253 1220316 */ |
| 5626 | //RASTERIZER_ENTRY( 0x00600039, 0x00045119, 0x00000000, 0x000B0779, 0x0C22480F, 0x0C241ACF ) /* * 2433 1014668 */ |
| 5627 | |
| 5628 | /* gauntdl ----> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5629 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x000000C1, 0x000B0779, 0x00000009, 0x0C241ACF ) /* * 30860 1128173568 */ |
| 5630 | RASTERIZER_ENTRY( 0x0060743A, 0x00045119, 0x000000C1, 0x000B0779, 0x0C22400F, 0x0C241ACF ) /* * 2631692 1117011118 */ |
| 5631 | RASTERIZER_ENTRY( 0x0060743A, 0x00045110, 0x000000C1, 0x000B0779, 0x0C22400F, 0x0C241ACF ) /* * 2429239 826969012 */ |
| 5632 | RASTERIZER_ENTRY( 0x0060743A, 0x00045119, 0x000000C1, 0x000B0779, 0x0C22480F, 0x0C241ACF ) /* * 454056 468285142 */ |
| 5633 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x000000C1, 0x000B0779, 0x00000009, 0x0C2418CF ) /* * 257586 355634672 */ |
| 5634 | RASTERIZER_ENTRY( 0x00602439, 0x00045119, 0x000000C1, 0x000B0379, 0x00000009, 0x0C24180F ) /* * 10898 134362122 */ |
| 5635 | RASTERIZER_ENTRY( 0x00602439, 0x00045119, 0x000000C1, 0x000B0779, 0x00000009, 0x0C241A0F ) /* * 32195 126327049 */ |
| 5636 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x000000C1, 0x000B0779, 0x0C2410CF, 0x0C24100F ) /* * 855240 123899880 */ |
| 5637 | RASTERIZER_ENTRY( 0x00602439, 0x00045110, 0x000000C1, 0x000B0379, 0x00000009, 0x0C24180F ) /* * 1718 120629204 */ |
| 5638 | RASTERIZER_ENTRY( 0x0060743A, 0x00045119, 0x000000C1, 0x000B0779, 0x0C22488F, 0x0C241ACF ) /* * 186839 120281357 */ |
| 5639 | RASTERIZER_ENTRY( 0x0060743A, 0x00045119, 0x000000C1, 0x000B0379, 0x0C22480F, 0x0C241ACF ) /* * 14102 115428820 */ |
| 5640 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x000000C1, 0x000B0779, 0x00000009, 0x0C2410CF ) /* * 88530 98271949 */ |
| 5641 | RASTERIZER_ENTRY( 0x0060743A, 0x00045110, 0x000000C1, 0x000B0379, 0x0C22480F, 0x0C241ACF ) /* * 12994 68053222 */ |
| 5642 | RASTERIZER_ENTRY( 0x00602439, 0x00044110, 0x00000000, 0x000B0379, 0x00000009, 0x0C24100F ) /* * 68273 67454880 */ |
| 5643 | RASTERIZER_ENTRY( 0x00602439, 0x00045119, 0x000000C1, 0x000B0779, 0x00000009, 0x0C24180F ) /* * 100026 62271618 */ |
| 5644 | RASTERIZER_ENTRY( 0x0060743A, 0x00045110, 0x000000C1, 0x000B0779, 0x0C22480F, 0x0C241ACF ) /* * 153285 44411342 */ |
| 5645 | RASTERIZER_ENTRY( 0x00602439, 0x00045119, 0x000000C1, 0x000B0779, 0x00000009, 0x0C24100F ) /* * 157545 40702131 */ |
| 5646 | RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x000000C1, 0x000B0779, 0x0C241ACF, 0x0C24100F ) /* * 7800 31948800 */ |
| 5647 | RASTERIZER_ENTRY( 0x0060743A, 0x00045110, 0x000000C1, 0x000B0779, 0x0C22408F, 0x0C241ACF ) /* * 47623 20321183 */ |
| 5648 | RASTERIZER_ENTRY( 0x00602439, 0x00044119, 0x00000000, 0x000B0379, 0x00000009, 0x0C24188F ) /* * 21570 19324892 */ |
| 5649 | //RASTERIZER_ENTRY( 0x00482435, 0x00045110, 0x000000C1, 0x000B0779, 0x0C241ACF, 0x0C24100F ) /* * 3698 15147008 */ |
| 5650 | //RASTERIZER_ENTRY( 0x0060743A, 0x00045119, 0x000000C1, 0x000B0779, 0x0C22408F, 0x0C241ACF ) /* * 19765 12383722 */ |
| 5651 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x0C24100F, 0x0C241ACF ) /* * 662274 10563855 */ |
| 5652 | //RASTERIZER_ENTRY( 0x00602439, 0x00045110, 0x000000C1, 0x000B0779, 0x0C24180F, 0x0C241ACF ) /* * 27909 10462997 */ |
| 5653 | //RASTERIZER_ENTRY( 0x00602439, 0x00045110, 0x000000C1, 0x000B0779, 0x00000009, 0x0C24180F ) /* * 78671 10286957 */ |
| 5654 | //RASTERIZER_ENTRY( 0x00602439, 0x00045110, 0x000000C1, 0x000B0779, 0x00000009, 0x0C24188F ) /* * 52038 9928244 */ |
| 5655 | //RASTERIZER_ENTRY( 0x0060743A, 0x00045119, 0x000000C1, 0x000B0779, 0x0C224A0F, 0x0C241ACF ) /* * 27469 9239782 */ |
| 5656 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x00000009, 0x0C24100F ) /* * 757116 8072783 */ |
| 5657 | //RASTERIZER_ENTRY( 0x0060743A, 0x00045110, 0x000000C1, 0x000B0779, 0x0C22488F, 0x0C241ACF ) /* * 18018 7035833 */ |
| 5658 | //RASTERIZER_ENTRY( 0x00602439, 0x00044119, 0x00000000, 0x000B0379, 0x00000009, 0x0C241A0F ) /* * 50339 5976564 */ |
| 5659 | //RASTERIZER_ENTRY( 0x00603430, 0x00040219, 0x00000000, 0x000B0379, 0x00000009, 0x0C2410CE ) /* * 29385 5466384 */ |
| 5660 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x0C24100F, 0x0C24180F ) /* * 423347 5355017 */ |
| 5661 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x0C24180F, 0x0C241ACF ) /* * 162620 4709092 */ |
| 5662 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045110, 0x000000C1, 0x000B0779, 0x00000009, 0x0C24100F ) /* * 463705 4642480 */ |
| 5663 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x0C24180F, 0x0C24180F ) /* * 280337 4425529 */ |
| 5664 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045110, 0x000000C1, 0x000B0779, 0x0C24180F, 0x0C24180F ) /* * 212646 3432265 */ |
| 5665 | //RASTERIZER_ENTRY( 0x00482435, 0x00045119, 0x000000C1, 0x000B0779, 0x0C2418CF, 0x0C24100F ) /* * 5788 2963456 */ |
| 5666 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045110, 0x000000C1, 0x000B0779, 0x0C24180F, 0x0C24100F ) /* * 460800 2609198 */ |
| 5667 | //RASTERIZER_ENTRY( 0x00602439, 0x00045119, 0x000000C1, 0x000B0779, 0x0C24100F, 0x0C24180F ) /* * 251108 2392362 */ |
| 5668 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045110, 0x000000C1, 0x000B0779, 0x0C24100F, 0x0C24100F ) /* * 297219 2352862 */ |
| 5669 | //RASTERIZER_ENTRY( 0x00602439, 0x00045119, 0x000000C1, 0x000B0779, 0x0584180F, 0x0C2410CF ) /* * 9913 2097069 */ |
| 5670 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045110, 0x000000C1, 0x000B0779, 0x0C24180F, 0x0C241ACF ) /* * 142722 2091569 */ |
| 5671 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0379, 0x0C24180F, 0x0C241ACF ) /* * 8820 2053325 */ |
| 5672 | //RASTERIZER_ENTRY( 0x00602439, 0x00045119, 0x000000C1, 0x000B0779, 0x00000009, 0x0C24188F ) /* * 10346 2033427 */ |
| 5673 | //RASTERIZER_ENTRY( 0x00602439, 0x00045119, 0x000000C1, 0x000B0779, 0x0C24188F, 0x0C241ACF ) /* * 2136 2017241 */ |
| 5674 | //RASTERIZER_ENTRY( 0x00602439, 0x00044119, 0x00000000, 0x000B0379, 0x00000009, 0x0C24100F ) /* * 1505 1928490 */ |
| 5675 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045110, 0x000000C1, 0x000B0779, 0x0C24100F, 0x0C241ACF ) /* * 176734 1842440 */ |
| 5676 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045110, 0x000000C1, 0x000B0779, 0x0C24100F, 0x0C24180F ) /* * 262577 1799080 */ |
| 5677 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x00000009, 0x0C24180F ) /* * 83179 1534171 */ |
| 5678 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x00000009, 0x0C24188F ) /* * 3863 1527077 */ |
| 5679 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0379, 0x0C24180F, 0x0C24180F ) /* * 8021 1472661 */ |
| 5680 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x0C241A0F, 0x0C241ACF ) /* * 85416 1342195 */ |
| 5681 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x0C24180F, 0x0C24100F ) /* * 261360 1335048 */ |
| 5682 | //RASTERIZER_ENTRY( 0x00602C19, 0x80000009, 0x000000C1, 0x000B0779, 0x0C2418CF, 0x0C24100F ) /* * 74811 1320900 */ |
| 5683 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x0C24100F, 0x0C24100F ) /* * 239331 1268661 */ |
| 5684 | //RASTERIZER_ENTRY( 0x00602439, 0x00045119, 0x000000C1, 0x000B0779, 0x0C24100F, 0x0C241ACF ) /* * 107769 1244175 */ |
| 5685 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045110, 0x000000C1, 0x000B0379, 0x0C24180F, 0x0C241ACF ) /* * 3706 1216182 */ |
| 5686 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x0C24100F, 0x0C24188F ) /* * 49608 1206129 */ |
| 5687 | //RASTERIZER_ENTRY( 0x00602C19, 0x80000009, 0x000000C1, 0x000B0779, 0x0C2418CF, 0x0C241ACF ) /* * 42440 1204109 */ |
| 5688 | //RASTERIZER_ENTRY( 0x00482435, 0x00045110, 0x000000C1, 0x000B0779, 0x0C2410CF, 0x0C24100F ) /* * 29584 1168568 */ |
| 5689 | //RASTERIZER_ENTRY( 0x00602439, 0x00045119, 0x000000C1, 0x000B0779, 0x0C24180F, 0x0C241ACF ) /* * 17729 1152869 */ |
| 5690 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045110, 0x000000C1, 0x000B0379, 0x0C24180F, 0x0C24100F ) /* * 4052 1108726 */ |
| 5691 | //RASTERIZER_ENTRY( 0x00602C19, 0x00045119, 0x000000C1, 0x000B0779, 0x0C2418CF, 0x0C24100F ) /* * 7082 1079348 */ |
| 5692 | //RASTERIZER_ENTRY( 0x00602439, 0x00044119, 0x00000000, 0x000B0379, 0x00000009, 0x0C24180F ) /* * 7761 1023855 */ |
| 5693 | |
| 5019 | 5694 | /* gradius4 ----> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5020 | | RASTERIZER_ENTRY( 0x02420002, 0x00000009, 0x00000000, 0x00030F7B, 0x08241AC7, 0xFFFFFFFF ) /* intro */ |
| 5021 | | RASTERIZER_ENTRY( 0x01420021, 0x00005119, 0x00000000, 0x00030F7B, 0x14261AC7, 0xFFFFFFFF ) /* intro */ |
| 5022 | | RASTERIZER_ENTRY( 0x00000005, 0x00005119, 0x00000000, 0x00030F7B, 0x14261A87, 0xFFFFFFFF ) /* in-game */ |
| 5695 | //RASTERIZER_ENTRY( 0x02420002, 0x00000009, 0x00000000, 0x00030F7B, 0x08241AC7, 0xFFFFFFFF ) /* intro */ |
| 5696 | //RASTERIZER_ENTRY( 0x01420021, 0x00005119, 0x00000000, 0x00030F7B, 0x14261AC7, 0xFFFFFFFF ) /* intro */ |
| 5697 | //RASTERIZER_ENTRY( 0x00000005, 0x00005119, 0x00000000, 0x00030F7B, 0x14261A87, 0xFFFFFFFF ) /* in-game */ |
| 5023 | 5698 | |
| 5024 | 5699 | /* nbapbp ------> fbzColorPath alphaMode fogMode, fbzMode, texMode0, texMode1 */ |
| 5025 | | RASTERIZER_ENTRY( 0x00424219, 0x00000000, 0x00000001, 0x00030B7B, 0x08241AC7, 0xFFFFFFFF ) /* intro */ |
| 5026 | | RASTERIZER_ENTRY( 0x00002809, 0x00004110, 0x00000001, 0x00030FFB, 0x08241AC7, 0xFFFFFFFF ) /* in-game */ |
| 5027 | | RASTERIZER_ENTRY( 0x00424219, 0x00000000, 0x00000001, 0x00030F7B, 0x08241AC7, 0xFFFFFFFF ) /* in-game */ |
| 5028 | | RASTERIZER_ENTRY( 0x0200421A, 0x00001510, 0x00000001, 0x00030F7B, 0x08241AC7, 0xFFFFFFFF ) /* in-game */ |
| 5700 | //RASTERIZER_ENTRY( 0x00424219, 0x00000000, 0x00000001, 0x00030B7B, 0x08241AC7, 0xFFFFFFFF ) /* intro */ |
| 5701 | //RASTERIZER_ENTRY( 0x00002809, 0x00004110, 0x00000001, 0x00030FFB, 0x08241AC7, 0xFFFFFFFF ) /* in-game */ |
| 5702 | //RASTERIZER_ENTRY( 0x00424219, 0x00000000, 0x00000001, 0x00030F7B, 0x08241AC7, 0xFFFFFFFF ) /* in-game */ |
| 5703 | //RASTERIZER_ENTRY( 0x0200421A, 0x00001510, 0x00000001, 0x00030F7B, 0x08241AC7, 0xFFFFFFFF ) /* in-game */ |
| 5029 | 5704 | |
| 5030 | 5705 | #endif |
src/mame/video/model2.c
| r1070 | r1071 | |
| 1 | /********************************************************************************************************************************* |
| 2 | |
| 3 | Sega Model 2 Geometry Engine and 3D Rasterizer Emulation |
| 4 | |
| 5 | General Notes: |
| 6 | |
| 7 | - The 3D rendering system has 3 main parts: |
| 8 | 1) The Geometry Engine: Model 2B and 2C hardware upload the geometry code to a DSP. The original and 2A hardware |
| 9 | have the geometry code in an internal ROM inside the DSP itself. The simulation written here for the geometry engine |
| 10 | is based off the disassembly of the code uploaded to a 2B game. |
| 11 | 2) The Z-Sort and Clip Hardware: Not much information about this hardware. There are a couple of variables that |
| 12 | can be passed to this stage, like a master Z-Clip enable register, and a Z-Sort mode variable. |
| 13 | 3) The Hardware Renderer: Not much information about the inner workings of this hardware. Based on the available |
| 14 | tidbits from the 2B manual, it is a double-buffered device (can be toggled between page flipping and single |
| 15 | buffer mode), and can also be switched to generate output at 60Hz or 30Hz. |
| 16 | |
| 17 | - Most of the information used to write this code come from 3 main sources: |
| 18 | 1) The Geometry Engine code disassembly from a 2B game. |
| 19 | 2) The Model 2B-CRX Manual. |
| 20 | 3) ElSemi's Direct3D implementation of the geometrizer engine. |
| 21 | |
| 22 | - The emulation strategy used here is to decouple the geometrizer code from the Z-Sort/Clip/Renderer code, so that for |
| 23 | original and 2A games, the HLE version of the geometrizer can be used, while for 2B and 2C games, the original geometrizer |
| 24 | DSP can be emulated, and data can be pushed to the Z-Sort/Clip/Renderer code. |
| 25 | |
| 26 | |
| 27 | |
| 28 | Geometry Engine Notes and Known Bugs: |
| 29 | |
| 30 | - Top Skater seem to use a slightly different geometry code that has a secondary transformation matrix. Once we implement |
| 31 | the real DSP code upload and emulation for 2B and 2C games, this should not be an issue. |
| 32 | |
| 33 | |
| 34 | |
| 35 | Z-Sort Notes and Known Bugs: |
| 36 | |
| 37 | - The Z-Sort algorithm is not entirely understood. The manual states that the Z-Sort works internally in 1.4.8 bit format, |
| 38 | but then it states that the Z-Sort Mode register value is added to the floating point z value, and converted to a 16 bit |
| 39 | format (most likely 4.12). |
| 40 | - The system allows for Z-Sort override, by means of specifying wether a polygon will use the same Z value ordinal as the |
| 41 | previous polygon, or the calculated minimum or maximum from it's points. This allows for a full object to be in front of |
| 42 | another, even though the first object might have some z coordinates that are bigger than the second object's z coordinates. |
| 43 | - The current implementation takes the effective computed z value for the polygon and converts it into a 4.12 fixed point |
| 44 | representation, used as an index into an array of linked polygons. Every polygon with the same z value is linked with any |
| 45 | previous polygon that had that same z value: |
| 46 | |
| 47 | z-value index linked list of polygons |
| 48 | 0000 triangle3->triangle2->triangle1 |
| 49 | 0001 triangle22->triangle8->triangle7 |
| 50 | .... |
| 51 | FFFF triangle33->triangle11->triangle9 |
| 52 | |
| 53 | As we add polygons to the array, we also keep track of the minimum and maximum z-value indexes seen this frame. |
| 54 | When it's time to render, we start and the max z-value seen, and iterate through the array going down to the minimum |
| 55 | z-value seen, clipping and rendering the linked polygons as we go. |
| 56 | Unfortunately, it seems there's something not quite right, as there are some visible Z-Sort problems in various games. |
| 57 | Perhaps the linked list of polygons need to be presorted by a unknown factor before rendering. |
| 58 | |
| 59 | |
| 60 | |
| 61 | Clip Notes and Known Bugs: |
| 62 | |
| 63 | - The Z-Clip happens at z=0. Since dividing by 0 during projection would give bogus values, we scale by a distance of |
| 64 | 1, thus our projection equation turns into vd.x = (d*vs.x) / (d+vs.z) where d = 1, since we know we won't have polygons |
| 65 | with a z < 0. This, however, poses the problem that for objects originally between 0.0 and 1.0 are not going to be |
| 66 | scaled properly. We still need to find a solution for this. |
| 67 | - A small offset need to be added horizontally and vertically to the viewport and center variables for certain games (like |
| 68 | the original Model 2 games). The coordinate system has been worked out from the 2B specifications, but the older games |
| 69 | need a slight adjustment. |
| 70 | |
| 71 | |
| 72 | |
| 73 | Hardware Renderer Notes and Known Bugs: |
| 74 | |
| 75 | - Texturing code could use a real good speed optimization. |
| 76 | - The U and V coordinates provided by the game are in 13.3 fixed point format. |
| 77 | - The luma/texel combination algorithm is not known. There are currently some small color glitches here and |
| 78 | there, and this might be the culprit. |
| 79 | - The log tables and distance coefficients are used to calculate the number of texels per world unit that need to |
| 80 | be used to render a texture. Textures can also be provided with smaller levels of details and a LOD bit selector |
| 81 | in the texture header tells the rasterizer which texture map to use. The rasterizer then can average two texture |
| 82 | maps to do mip mapping. More information can be found on the 2B manual, on the 'Texturing' and 'Data Format' chapters. |
| 83 | This is currently unemulated. We always use the texture data from the bigger texture map. |
| 84 | - The rasterizer supports up to 128x128 'microtex' textures, which are supposed to be higher resolution textures used |
| 85 | to display more detail when a texture is real close to the viewer. This is currently unemulated. |
| 86 | |
| 87 | *********************************************************************************************************************************/ |
| 1 | 88 | #include "driver.h" |
| 2 | 89 | #include "video/segaic24.h" |
| 3 | 90 | #include "video/poly.h" |
| r1070 | r1071 | |
| 2 | 89 | |
| 3 | | typedef struct |
| 4 | | { |
| 5 | | int x, y, width, height; |
| 6 | | } WINDOW; |
| 90 | #define DEBUG 0 |
| 7 | 91 | |
| 92 | extern UINT32 geo_read_start_address; |
| 93 | extern UINT32 geo_write_start_address; |
| 94 | extern UINT32 *model2_bufferram; |
| 95 | extern UINT32 *model2_colorxlat; |
| 96 | extern UINT32 *model2_textureram0; |
| 97 | extern UINT32 *model2_textureram1; |
| 98 | extern UINT32 *model2_lumaram; |
| 99 | |
| 100 | /******************************************* |
| 101 | * |
| 102 | * Basic Data Types |
| 103 | * |
| 104 | *******************************************/ |
| 105 | |
| 8 | 106 | typedef struct |
| 9 | 107 | { |
| 10 | 108 | float x, y, z; |
| 11 | 109 | UINT16 u, v; |
| 12 | | } VERTEX; |
| 110 | } vertex; |
| 13 | 111 | |
| 14 | 112 | typedef struct |
| 15 | 113 | { |
| 16 | | VERTEX v[3]; |
| 17 | | WINDOW window; |
| 18 | | float z; |
| 19 | | int luminance; |
| 20 | | UINT16 r, g, b; |
| 21 | | UINT16 luma_select; |
| 22 | | UINT16 tex_x, tex_y, tex_width, tex_height; |
| 23 | | UINT32 flags; |
| 24 | | } TRIANGLE; |
| 114 | vertex normal; |
| 115 | float distance; |
| 116 | } plane; |
| 25 | 117 | |
| 26 | | typedef struct { |
| 27 | | float x,y,z,d; |
| 28 | | } PLANE; |
| 118 | typedef struct |
| 119 | { |
| 120 | float diffuse; |
| 121 | float ambient; |
| 122 | UINT32 specular_control; |
| 123 | float specular_scale; |
| 124 | } texture_parameter; |
| 29 | 125 | |
| 126 | typedef struct |
| 127 | { |
| 128 | void * next; |
| 129 | vertex v[3]; |
| 130 | UINT16 z; |
| 131 | UINT16 texheader[4]; |
| 132 | UINT16 luma; |
| 133 | INT16 viewport[4]; |
| 134 | INT16 center[2]; |
| 135 | } triangle; |
| 30 | 136 | |
| 31 | 137 | typedef struct |
| 32 | 138 | { |
| 33 | | UINT32 diffuse; |
| 34 | | UINT32 ambient; |
| 35 | | UINT32 reflection; |
| 36 | | float c; |
| 37 | | } TEXTURE_PARAMETER; |
| 139 | vertex v[4]; |
| 140 | UINT16 z; |
| 141 | UINT16 texheader[4]; |
| 142 | UINT16 luma; |
| 143 | } quad; |
| 38 | 144 | |
| 39 | | #define TRI_FLAG_TEXTURE 0x1 |
| 40 | | #define TRI_FLAG_TEXTURE_TRANS 0x2 |
| 41 | | #define TRI_FLAG_EVEN_BANK 0x4 |
| 42 | | #define TRI_FLAG_CHECKER 0x8 |
| 43 | | #define TRI_FLAG_MICROTEX 0x10 |
| 44 | | #define TRI_FLAG_MIRROR_X 0x20 |
| 45 | | #define TRI_FLAG_MIRROR_Y 0x40 |
| 46 | | #define TRI_FLAG_WRAP_X 0x80 |
| 47 | | #define TRI_FLAG_WRAP_Y 0x100 |
| 48 | 145 | |
| 146 | /******************************************* |
| 147 | * |
| 148 | * Generic 3D Math Functions |
| 149 | * |
| 150 | *******************************************/ |
| 49 | 151 | |
| 50 | | static UINT32 geo_mode; |
| 152 | static void transform_point( vertex *point, float *matrix ) |
| 153 | { |
| 154 | float tx = (point->x * matrix[0]) + (point->y * matrix[3]) + (point->z * matrix[6]) + (matrix[9]); |
| 155 | float ty = (point->x * matrix[1]) + (point->y * matrix[4]) + (point->z * matrix[7]) + (matrix[10]); |
| 156 | float tz = (point->x * matrix[2]) + (point->y * matrix[5]) + (point->z * matrix[8]) + (matrix[11]); |
| 51 | 157 | |
| 158 | point->x = tx; |
| 159 | point->y = ty; |
| 160 | point->z = tz; |
| 161 | } |
| 52 | 162 | |
| 53 | | static void parse_display_list(void); |
| 54 | | static void render_triangles(mame_bitmap *bitmap, const rectangle *cliprect); |
| 163 | static void transform_vector( vertex *vector, float *matrix ) |
| 164 | { |
| 165 | float tx = (vector->x * matrix[0]) + (vector->y * matrix[3]) + (vector->z * matrix[6]); |
| 166 | float ty = (vector->x * matrix[1]) + (vector->y * matrix[4]) + (vector->z * matrix[7]); |
| 167 | float tz = (vector->x * matrix[2]) + (vector->y * matrix[5]) + (vector->z * matrix[8]); |
| 55 | 168 | |
| 169 | vector->x = tx; |
| 170 | vector->y = ty; |
| 171 | vector->z = tz; |
| 172 | } |
| 56 | 173 | |
| 57 | | #define TRIBUFFER_SIZE 16384 |
| 174 | static void normalize_vector( vertex *vector ) |
| 175 | { |
| 176 | float n = sqrt( (vector->x * vector->x) + (vector->y * vector->y) + (vector->z * vector->z) ); |
| 58 | 177 | |
| 59 | | static TRIANGLE *tribuffer; |
| 60 | | static int tribuffer_pos; |
| 178 | if ( n ) |
| 179 | { |
| 180 | vector->x /= n; |
| 181 | vector->y /= n; |
| 182 | vector->z /= n; |
| 183 | } |
| 184 | } |
| 61 | 185 | |
| 62 | | extern UINT32 geo_read_start_address; |
| 63 | | extern UINT32 geo_write_start_address; |
| 64 | | extern UINT32 *model2_bufferram; |
| 65 | | extern UINT32 *model2_textureram0; |
| 66 | | extern UINT32 *model2_textureram1; |
| 67 | | extern UINT32 *model2_colorxlat; |
| 68 | | extern UINT32 *model2_lumaram; |
| 186 | static float dot_product( vertex *v1, vertex *v2 ) |
| 187 | { |
| 188 | return (v1->x * v2->x) + (v1->y * v2->y) + (v1->z * v2->z); |
| 189 | } |
| 69 | 190 | |
| 70 | | static float matrix[12]; |
| 71 | | static float light_vector[3]; |
| 191 | static void vector_cross3( vertex *dst, vertex *v0, vertex *v1, vertex *v2 ) |
| 192 | { |
| 193 | vertex p1, p2; |
| 72 | 194 | |
| 73 | | static WINDOW window; |
| 74 | | static float focus_x, focus_y; |
| 195 | p1.x = v1->x - v0->x; p1.y = v1->y - v0->y; p1.z = v1->z - v0->z; |
| 196 | p2.x = v2->x - v0->x; p2.y = v2->y - v0->y; p2.z = v2->z - v0->z; |
| 75 | 197 | |
| 76 | | static UINT32 *polygon_rom; |
| 77 | | static UINT32 *polygon_ram; |
| 78 | | static UINT16 *texture_rom; |
| 79 | | static UINT16 *texture_ram; |
| 198 | dst->x = (p1.y * p2.z) - (p1.z * p2.y); |
| 199 | dst->y = (p1.z * p2.x) - (p1.x * p2.z); |
| 200 | dst->z = (p1.x * p2.y) - (p1.y * p2.x); |
| 201 | } |
| 80 | 202 | |
| 81 | | static TEXTURE_PARAMETER texture_parameter[32]; |
| 203 | /* 1.8.23 float to 4.12 float converter, courtesy of Aaron Giles */ |
| 204 | static UINT16 float_to_zval( float floatval ) |
| 205 | { |
| 206 | INT32 fpint = f2u(floatval); |
| 207 | INT32 exponent = ((fpint >> 23) & 0xff) - 127; |
| 208 | UINT32 mantissa = fpint & 0x7fffff; |
| 82 | 209 | |
| 83 | | static bitmap_t *sys24_bitmap = NULL; |
| 210 | /* round the low bits and reduce to 12 */ |
| 211 | mantissa += 0x400; |
| 212 | if (mantissa > 0x7fffff) { exponent++; mantissa = (mantissa & 0x7fffff) >> 1; } |
| 213 | mantissa >>= 11; |
| 84 | 214 | |
| 85 | | static void model2_exit(running_machine *machine) |
| 215 | /* if negative, clamp to 0 */ |
| 216 | if (fpint < 0) |
| 217 | return 0x0000; |
| 218 | |
| 219 | /* the rest depends on the exponent */ |
| 220 | /* less than -12 is too small, return 0 */ |
| 221 | if ( exponent < -12 ) |
| 222 | return 0x0000; |
| 223 | |
| 224 | /* between -12 and 0 create a denormal with exponent of 0 */ |
| 225 | else if ( exponent < 0 ) |
| 226 | return (mantissa | 0x1000) >> -exponent; |
| 227 | |
| 228 | /* between 0 and 14 create a FP value with exponent + 1 */ |
| 229 | else if ( exponent < 15 ) |
| 230 | return (( exponent + 1 ) << 12) | mantissa; |
| 231 | |
| 232 | /* above 14 is too large */ |
| 233 | return 0xffff; |
| 234 | } |
| 235 | |
| 236 | static INT32 clip_polygon(vertex *v, INT32 num_vertices, plane *cp, vertex *vout) |
| 86 | 237 | { |
| 87 | | if ( sys24_bitmap != NULL ) |
| 238 | vertex *cur, *out; |
| 239 | float curdot, nextdot, scale; |
| 240 | INT32 i, curin, nextin, nextvert, outcount; |
| 241 | |
| 242 | outcount = 0; |
| 243 | |
| 244 | cur = v; |
| 245 | out = vout; |
| 246 | |
| 247 | curdot = dot_product( cur, &cp->normal ); |
| 248 | curin = (curdot >= cp->distance) ? 1 : 0; |
| 249 | |
| 250 | for( i = 0; i < num_vertices; i++ ) |
| 88 | 251 | { |
| 89 | | bitmap_free( sys24_bitmap ); |
| 90 | | sys24_bitmap = NULL; |
| 252 | nextvert = (i + 1) % num_vertices; |
| 253 | |
| 254 | /* if the current point is inside the plane, add it */ |
| 255 | if ( curin ) memcpy( &out[outcount++], cur, sizeof( vertex ) ); |
| 256 | |
| 257 | nextdot = dot_product( &v[nextvert], &cp->normal ); |
| 258 | nextin = (nextdot >= cp->distance) ? 1 : 0; |
| 259 | |
| 260 | /* Add a clipped vertex if one end of the current edge is inside the plane and the other is outside */ |
| 261 | if ( curin != nextin ) |
| 262 | { |
| 263 | scale = (cp->distance - curdot) / (nextdot - curdot); |
| 264 | |
| 265 | out[outcount].x = cur->x + ((v[nextvert].x - cur->x) * scale); |
| 266 | out[outcount].y = cur->y + ((v[nextvert].y - cur->y) * scale); |
| 267 | out[outcount].z = cur->z + ((v[nextvert].z - cur->z) * scale); |
| 268 | out[outcount].u = (UINT16)((float)cur->u + (((float)v[nextvert].u - (float)cur->u) * scale)); |
| 269 | out[outcount].v = (UINT16)((float)cur->v + (((float)v[nextvert].v - (float)cur->v) * scale)); |
| 270 | outcount++; |
| 271 | } |
| 272 | |
| 273 | curdot = nextdot; |
| 274 | curin = nextin; |
| 275 | cur++; |
| 91 | 276 | } |
| 277 | |
| 278 | return outcount; |
| 92 | 279 | } |
| 93 | 280 | |
| 94 | | VIDEO_START(model2) |
| 281 | /***********************************************************************************************/ |
| 282 | |
| 283 | /******************************************* |
| 284 | * |
| 285 | * Hardware 3D Rasterizer Interal State |
| 286 | * |
| 287 | *******************************************/ |
| 288 | |
| 289 | #define MAX_TRIANGLES 32768 |
| 290 | |
| 291 | typedef struct |
| 95 | 292 | { |
| 96 | | int width = machine->screen[0].visarea.max_x - machine->screen[0].visarea.min_x; |
| 97 | | int height = machine->screen[0].visarea.max_y - machine->screen[0].visarea.min_y; |
| 293 | UINT32 mode; /* bit 0 = Test Mode, bit 2 = Switch 60Hz(1)/30Hz(0) operation */ |
| 294 | UINT16 * texture_rom; /* Texture ROM pointer */ |
| 295 | UINT16 * texture_ram; /* Texture RAM pointer */ |
| 296 | UINT8 * log_ram; /* Log RAM pointer */ |
| 297 | INT16 viewport[4]; /* View port (startx,starty,endx,endy) */ |
| 298 | INT16 center[4][2]; /* Centers (eye 0[x,y],1[x,y],2[x,y],3[x,y]) */ |
| 299 | UINT16 center_sel; /* Selected center */ |
| 300 | UINT32 reverse; /* Left/Right Reverse */ |
| 301 | float z_adjust; /* ZSort Mode */ |
| 302 | float triangle_z; /* Current Triangle z value */ |
| 303 | UINT8 master_z_clip; /* Master Z-Clip value */ |
| 304 | UINT32 cur_command; /* Current command */ |
| 305 | UINT32 command_buffer[32]; /* Command buffer */ |
| 306 | UINT32 command_index; /* Command buffer index */ |
| 307 | triangle * tri_list; /* Triangle list */ |
| 308 | UINT32 tri_list_index; /* Triangle list index */ |
| 309 | triangle ** tri_sorted_list; /* Sorted Triangle list */ |
| 310 | UINT16 min_z; /* Minimum sortable Z value */ |
| 311 | UINT16 max_z; /* Maximum sortable Z value */ |
| 98 | 312 | |
| 99 | | sys24_tile_vh_start(machine, 0x3fff); |
| 313 | } raster_state; |
| 100 | 314 | |
| 101 | | sys24_bitmap = bitmap_alloc(width, height+4, BITMAP_FORMAT_INDEXED16); |
| 315 | static raster_state raster; |
| 102 | 316 | |
| 103 | | add_exit_callback(machine, model2_exit); |
| 317 | /******************************************* |
| 318 | * |
| 319 | * Hardware 3D Rasterizer Initialization |
| 320 | * |
| 321 | *******************************************/ |
| 104 | 322 | |
| 105 | | tribuffer = auto_malloc(TRIBUFFER_SIZE * sizeof(TRIANGLE)); |
| 323 | static void model2_3d_init( UINT16 *texture_rom ) |
| 324 | { |
| 325 | memset( &raster, 0, sizeof( raster_state ) ); |
| 106 | 326 | |
| 107 | | polygon_rom = (UINT32*)memory_region(REGION_USER2); |
| 108 | | polygon_ram = auto_malloc(0x8000 * sizeof(UINT32)); |
| 327 | raster.texture_rom = texture_rom; |
| 328 | raster.texture_ram = auto_malloc(0x10000 * sizeof(UINT16)); |
| 329 | raster.log_ram = auto_malloc(0x40000 * sizeof(UINT8)); |
| 330 | raster.tri_list = auto_malloc(MAX_TRIANGLES * sizeof(triangle)); |
| 331 | raster.tri_sorted_list = auto_malloc(0x10000 * sizeof( triangle * )); |
| 332 | } |
| 109 | 333 | |
| 110 | | texture_rom = (UINT16*)memory_region(REGION_USER3); |
| 111 | | texture_ram = auto_malloc(0x10000 * sizeof(UINT16)); |
| 334 | /******************************************* |
| 335 | * |
| 336 | * Hardware 3D Rasterizer Z-Clip selection |
| 337 | * |
| 338 | *******************************************/ |
| 339 | |
| 340 | void model2_3d_set_zclip( UINT8 clip ) |
| 341 | { |
| 342 | raster.master_z_clip = clip; |
| 112 | 343 | } |
| 113 | 344 | |
| 114 | | static void convert_bitmap( running_machine *machine, bitmap_t *dst, bitmap_t *src, const rectangle *rect ) |
| 345 | /******************************************* |
| 346 | * |
| 347 | * Hardware 3D Rasterizer Processing |
| 348 | * |
| 349 | *******************************************/ |
| 350 | |
| 351 | static void model2_3d_process_quad( UINT32 attr ) |
| 115 | 352 | { |
| 116 | | int x, y; |
| 353 | quad object; |
| 354 | UINT16 *th, *tp; |
| 355 | INT32 tho; |
| 356 | UINT32 cull, i; |
| 357 | float zvalue; |
| 358 | float min_z, max_z; |
| 117 | 359 | |
| 118 | | for( y = rect->min_y; y < rect->max_y; y++ ) |
| 360 | /* extract P0(n-1) */ |
| 361 | object.v[1].x = u2f( raster.command_buffer[2] << 8 ); |
| 362 | object.v[1].y = u2f( raster.command_buffer[3] << 8 ); |
| 363 | object.v[1].z = u2f( raster.command_buffer[4] << 8 ); |
| 364 | |
| 365 | /* extract P1(n-1) */ |
| 366 | object.v[0].x = u2f( raster.command_buffer[5] << 8 ); |
| 367 | object.v[0].y = u2f( raster.command_buffer[6] << 8 ); |
| 368 | object.v[0].z = u2f( raster.command_buffer[7] << 8 ); |
| 369 | |
| 370 | /* extract P0(n) */ |
| 371 | object.v[2].x = u2f( raster.command_buffer[11] << 8 ); |
| 372 | object.v[2].y = u2f( raster.command_buffer[12] << 8 ); |
| 373 | object.v[2].z = u2f( raster.command_buffer[13] << 8 ); |
| 374 | |
| 375 | /* extract P1(n) */ |
| 376 | object.v[3].x = u2f( raster.command_buffer[14] << 8 ); |
| 377 | object.v[3].y = u2f( raster.command_buffer[15] << 8 ); |
| 378 | object.v[3].z = u2f( raster.command_buffer[16] << 8 ); |
| 379 | |
| 380 | /* always calculate the min z and max z value */ |
| 381 | min_z = object.v[0].z; |
| 382 | if ( object.v[1].z < min_z ) min_z = object.v[1].z; |
| 383 | if ( object.v[2].z < min_z ) min_z = object.v[2].z; |
| 384 | if ( object.v[3].z < min_z ) min_z = object.v[3].z; |
| 385 | |
| 386 | max_z = object.v[0].z; |
| 387 | if ( object.v[1].z > max_z ) max_z = object.v[1].z; |
| 388 | if ( object.v[2].z > max_z ) max_z = object.v[2].z; |
| 389 | if ( object.v[3].z > max_z ) max_z = object.v[3].z; |
| 390 | |
| 391 | /* read in the texture information */ |
| 392 | |
| 393 | /* texture point data */ |
| 394 | if ( raster.command_buffer[0] & 0x800000 ) |
| 395 | tp = &raster.texture_ram[raster.command_buffer[0] & 0xFFFF]; |
| 396 | else |
| 397 | tp = &raster.texture_rom[raster.command_buffer[0] & 0x7FFFFF]; |
| 398 | |
| 399 | object.v[0].v = *tp++; |
| 400 | object.v[0].u = *tp++; |
| 401 | object.v[1].v = *tp++; |
| 402 | object.v[1].u = *tp++; |
| 403 | object.v[2].v = *tp++; |
| 404 | object.v[2].u = *tp++; |
| 405 | object.v[3].v = *tp++; |
| 406 | object.v[3].u = *tp++; |
| 407 | |
| 408 | /* update the address */ |
| 409 | raster.command_buffer[0] += 8; |
| 410 | |
| 411 | /* texture header data */ |
| 412 | if ( raster.command_buffer[1] & 0x800000 ) |
| 413 | th = &raster.texture_ram[raster.command_buffer[1] & 0xFFFF]; |
| 414 | else |
| 415 | th = &raster.texture_rom[raster.command_buffer[1] & 0x7FFFFF]; |
| 416 | |
| 417 | object.texheader[0] = *th++; |
| 418 | object.texheader[1] = *th++; |
| 419 | object.texheader[2] = *th++; |
| 420 | object.texheader[3] = *th++; |
| 421 | |
| 422 | /* extract the texture header offset */ |
| 423 | tho = (attr >> 12) & 0x1F; |
| 424 | |
| 425 | /* adjust for sign */ |
| 426 | if ( tho & 0x10 ) |
| 427 | tho |= -16; |
| 428 | |
| 429 | /* update the address */ |
| 430 | raster.command_buffer[1] += tho * 4; |
| 431 | |
| 432 | /* set the luma value of this quad */ |
| 433 | object.luma = (raster.command_buffer[9] >> 14) & 0xFF; |
| 434 | |
| 435 | /* determine wether we can cull this quad */ |
| 436 | cull = 0; |
| 437 | |
| 438 | /* if doubleside is disabled */ |
| 439 | if ( ((attr >> 17) & 1) == 0 ) |
| 119 | 440 | { |
| 120 | | UINT32 *d = BITMAP_ADDR32( dst, y, 0 ); |
| 121 | | UINT16 *s = BITMAP_ADDR16( src, y, 0 ); |
| 441 | /* if it's the backface, cull it */ |
| 442 | if ( raster.command_buffer[9] & 0x00800000 ) |
| 443 | cull = 1; |
| 444 | } |
| 122 | 445 | |
| 123 | | for( x = rect->min_x; x < rect->max_x; x++ ) |
| 446 | /* if the linktype is 0, then we can also cull it */ |
| 447 | if ( ((attr >> 8) & 3) == 0 ) |
| 448 | cull = 1; |
| 449 | |
| 450 | /* if the minimum z value is bigger than the master z clip value, don't render */ |
| 451 | if ( (INT32)(1.0/min_z) > raster.master_z_clip ) |
| 452 | cull = 1; |
| 453 | |
| 454 | /* if the maximum z value is < 0 then we can safely clip the entire polygon */ |
| 455 | if ( max_z < 0 ) |
| 456 | cull = 1; |
| 457 | |
| 458 | if ( cull == 0 ) |
| 459 | { |
| 460 | INT32 clipped_verts; |
| 461 | vertex verts[10]; |
| 462 | plane clip_plane; |
| 463 | |
| 464 | clip_plane.normal.x = 0; |
| 465 | clip_plane.normal.y = 0; |
| 466 | clip_plane.normal.z = 1; |
| 467 | clip_plane.distance = 0; |
| 468 | |
| 469 | /* do near z clipping */ |
| 470 | clipped_verts = clip_polygon( object.v, 4, &clip_plane, verts); |
| 471 | |
| 472 | if ( clipped_verts > 2 ) |
| 124 | 473 | { |
| 125 | | if ( s[x] ) |
| 126 | | d[x] = machine->pens[s[x]]; |
| 474 | triangle *ztri; |
| 475 | |
| 476 | /* set the object's z value */ |
| 477 | zvalue = raster.triangle_z; |
| 478 | |
| 479 | /* see if we need to recompute min/max z */ |
| 480 | if ( (attr >> 10) & 3 ) |
| 481 | { |
| 482 | /* update min_z and max_z with the new clipped values */ |
| 483 | min_z = verts[0].z; |
| 484 | max_z = verts[0].z; |
| 485 | |
| 486 | for( i = 1; i < clipped_verts; i++ ) |
| 487 | { |
| 488 | if ( verts[i].z < min_z ) min_z = verts[i].z; |
| 489 | if ( verts[i].z > max_z ) max_z = verts[i].z; |
| 490 | } |
| 491 | |
| 492 | if ( (attr >> 10) & 1 ) /* min value */ |
| 493 | { |
| 494 | zvalue = min_z; |
| 495 | } |
| 496 | else if ( (attr >> 10) & 2 ) /* max value */ |
| 497 | { |
| 498 | zvalue = max_z; |
| 499 | } |
| 500 | |
| 501 | raster.triangle_z = zvalue; |
| 502 | } |
| 503 | |
| 504 | /* adjust and set the object z-sort value */ |
| 505 | object.z = float_to_zval( zvalue + raster.z_adjust ); |
| 506 | |
| 507 | /* get our list read to add the triangles */ |
| 508 | ztri = raster.tri_sorted_list[object.z]; |
| 509 | |
| 510 | if ( ztri != NULL ) |
| 511 | { |
| 512 | while( ztri->next != NULL ) |
| 513 | ztri = ztri->next; |
| 514 | } |
| 515 | |
| 516 | /* go through the clipped vertex list, adding triangles */ |
| 517 | for( i = 2; i < clipped_verts; i++ ) |
| 518 | { |
| 519 | triangle *tri; |
| 520 | |
| 521 | tri = &raster.tri_list[raster.tri_list_index++]; |
| 522 | |
| 523 | if ( raster.tri_list_index >= MAX_TRIANGLES ) |
| 524 | { |
| 525 | fatalerror( "SEGA 3D: Max triangle limit exceeded\n" ); |
| 526 | } |
| 527 | |
| 528 | /* copy the object information */ |
| 529 | tri->z = object.z; |
| 530 | tri->texheader[0] = object.texheader[0]; |
| 531 | tri->texheader[1] = object.texheader[1]; |
| 532 | tri->texheader[2] = object.texheader[2]; |
| 533 | tri->texheader[3] = object.texheader[3]; |
| 534 | tri->luma = object.luma; |
| 535 | |
| 536 | /* set the viewport */ |
| 537 | tri->viewport[0] = raster.viewport[0]; |
| 538 | tri->viewport[1] = raster.viewport[1]; |
| 539 | tri->viewport[2] = raster.viewport[2]; |
| 540 | tri->viewport[3] = raster.viewport[3]; |
| 541 | |
| 542 | /* set the center */ |
| 543 | tri->center[0] = raster.center[raster.center_sel][0]; |
| 544 | tri->center[1] = raster.center[raster.center_sel][1]; |
| 545 | |
| 546 | memcpy( &tri->v[0], &verts[0], sizeof( vertex ) ); |
| 547 | memcpy( &tri->v[1], &verts[i-1], sizeof( vertex ) ); |
| 548 | memcpy( &tri->v[2], &verts[i], sizeof( vertex ) ); |
| 549 | |
| 550 | /* add to our sorted list */ |
| 551 | tri->next = NULL; |
| 552 | |
| 553 | if ( ztri == NULL ) |
| 554 | { |
| 555 | raster.tri_sorted_list[object.z] = tri; |
| 556 | } |
| 557 | else |
| 558 | { |
| 559 | ztri->next = tri; |
| 560 | } |
| 561 | |
| 562 | ztri = tri; |
| 563 | } |
| 564 | |
| 565 | /* keep around the min and max z values for this frame */ |
| 566 | if ( object.z < raster.min_z ) raster.min_z = object.z; |
| 567 | if ( object.z > raster.max_z ) raster.max_z = object.z; |
| 127 | 568 | } |
| 128 | 569 | } |
| 570 | |
| 571 | /* update linking */ |
| 572 | switch( ((attr >> 8) & 3) ) |
| 573 | { |
| 574 | case 0: |
| 575 | case 2: |
| 576 | { |
| 577 | /* reuse P0(n) and P1(n) */ |
| 578 | for( i = 0; i < 6; i++ ) /* P0(n) -> P0(n-1) */ |
| 579 | raster.command_buffer[2+i] = raster.command_buffer[11+i]; /* P1(n) -> P1(n-1) */ |
| 580 | } |
| 581 | break; |
| 582 | |
| 583 | case 1: |
| 584 | { |
| 585 | /* reuse P0(n-1) and P0(n) */ |
| 586 | for( i = 0; i < 3; i++ ) |
| 587 | raster.command_buffer[5+i] = raster.command_buffer[11+i]; /* P0(n) -> P1(n-1) */ |
| 588 | } |
| 589 | break; |
| 590 | |
| 591 | case 3: |
| 592 | { |
| 593 | /* reuse P1(n-1) and P1(n) */ |
| 594 | for( i = 0; i < 3; i++ ) |
| 595 | raster.command_buffer[2+i] = raster.command_buffer[14+i]; /* P1(n) -> P1(n-1) */ |
| 596 | } |
| 597 | break; |
| 598 | } |
| 129 | 599 | } |
| 130 | 600 | |
| 131 | | VIDEO_UPDATE(model2) |
| 601 | static void model2_3d_process_triangle( UINT32 attr ) |
| 132 | 602 | { |
| 133 | | sys24_tile_update(machine); |
| 134 | | fillbitmap(bitmap, machine->pens[0], &machine->screen[0].visarea); |
| 135 | | fillbitmap(sys24_bitmap, 0, &machine->screen[0].visarea); |
| 603 | triangle object; |
| 604 | UINT16 *th, *tp; |
| 605 | INT32 tho; |
| 606 | UINT32 cull, i; |
| 607 | float zvalue; |
| 608 | float min_z, max_z; |
| 136 | 609 | |
| 137 | | sys24_tile_draw(machine, sys24_bitmap, cliprect, 7, 0, 0); |
| 138 | | sys24_tile_draw(machine, sys24_bitmap, cliprect, 6, 0, 0); |
| 139 | | sys24_tile_draw(machine, sys24_bitmap, cliprect, 5, 0, 0); |
| 140 | | sys24_tile_draw(machine, sys24_bitmap, cliprect, 4, 0, 0); |
| 610 | /* extract P0(n-1) */ |
| 611 | object.v[1].x = u2f( raster.command_buffer[2] << 8 ); |
| 612 | object.v[1].y = u2f( raster.command_buffer[3] << 8 ); |
| 613 | object.v[1].z = u2f( raster.command_buffer[4] << 8 ); |
| 141 | 614 | |
| 142 | | convert_bitmap(machine, bitmap, sys24_bitmap, cliprect); |
| 615 | /* extract P1(n-1) */ |
| 616 | object.v[0].x = u2f( raster.command_buffer[5] << 8 ); |
| 617 | object.v[0].y = u2f( raster.command_buffer[6] << 8 ); |
| 618 | object.v[0].z = u2f( raster.command_buffer[7] << 8 ); |
| 143 | 619 | |
| 144 | | tribuffer_pos = 0; |
| 145 | | parse_display_list(); |
| 146 | | render_triangles(bitmap, cliprect); |
| 620 | /* extract P0(n) */ |
| 621 | object.v[2].x = u2f( raster.command_buffer[11] << 8 ); |
| 622 | object.v[2].y = u2f( raster.command_buffer[12] << 8 ); |
| 623 | object.v[2].z = u2f( raster.command_buffer[13] << 8 ); |
| 147 | 624 | |
| 148 | | fillbitmap(sys24_bitmap, 0, &machine->screen[0].visarea); |
| 149 | | sys24_tile_draw(machine, sys24_bitmap, cliprect, 3, 0, 0); |
| 150 | | sys24_tile_draw(machine, sys24_bitmap, cliprect, 2, 0, 0); |
| 151 | | sys24_tile_draw(machine, sys24_bitmap, cliprect, 1, 0, 0); |
| 152 | | sys24_tile_draw(machine, sys24_bitmap, cliprect, 0, 0, 0); |
| 625 | /* for triangles, the rope of P1(n) is achieved by P0(n-1) (linktype 3) */ |
| 626 | raster.command_buffer[14] = raster.command_buffer[11]; |
| 627 | raster.command_buffer[15] = raster.command_buffer[12]; |
| 628 | raster.command_buffer[16] = raster.command_buffer[13]; |
| 153 | 629 | |
| 154 | | convert_bitmap(machine, bitmap, sys24_bitmap, cliprect); |
| 630 | /* always calculate the min z and max z values */ |
| 631 | min_z = object.v[0].z; |
| 632 | if ( object.v[1].z < min_z ) min_z = object.v[1].z; |
| 633 | if ( object.v[2].z < min_z ) min_z = object.v[2].z; |
| 155 | 634 | |
| 156 | | return 0; |
| 157 | | } |
| 635 | max_z = object.v[0].z; |
| 636 | if ( object.v[1].z > max_z ) max_z = object.v[1].z; |
| 637 | if ( object.v[2].z > max_z ) max_z = object.v[2].z; |
| 158 | 638 | |
| 159 | | static void draw_solid_triangle(mame_bitmap *bitmap, const rectangle *rect, TRIANGLE *tri) |
| 160 | | { |
| 161 | | int x, y; |
| 162 | | struct poly_vertex vert[3]; |
| 163 | | const struct poly_scanline_data *scans; |
| 164 | | int r, g, b; |
| 165 | | UINT32 luminance, tr, tg, tb, ri, gi, bi; |
| 166 | | UINT32 color, loffset; |
| 639 | /* read in the texture information */ |
| 167 | 640 | |
| 168 | | UINT32 *colortable_r = &model2_colorxlat[0x0000/4]; |
| 169 | | UINT32 *colortable_g = &model2_colorxlat[0x4000/4]; |
| 170 | | UINT32 *colortable_b = &model2_colorxlat[0x8000/4]; |
| 641 | /* texture point data */ |
| 642 | if ( raster.command_buffer[0] & 0x800000 ) |
| 643 | tp = &raster.texture_ram[raster.command_buffer[0] & 0xFFFF]; |
| 644 | else |
| 645 | tp = &raster.texture_rom[raster.command_buffer[0] & 0x7FFFFF]; |
| 171 | 646 | |
| 172 | | vert[0].x = tri->v[0].x; vert[0].y = tri->v[0].y; |
| 173 | | vert[1].x = tri->v[1].x; vert[1].y = tri->v[1].y; |
| 174 | | vert[2].x = tri->v[2].x; vert[2].y = tri->v[2].y; |
| 647 | object.v[0].v = *tp++; |
| 648 | object.v[0].u = *tp++; |
| 649 | object.v[1].v = *tp++; |
| 650 | object.v[1].u = *tp++; |
| 651 | object.v[2].v = *tp++; |
| 652 | object.v[2].u = *tp++; |
| 175 | 653 | |
| 176 | | scans = setup_triangle_0(&vert[0], &vert[1], &vert[2], rect); |
| 654 | /* update the address */ |
| 655 | raster.command_buffer[0] += 6; |
| 177 | 656 | |
| 178 | | r = tri->r; |
| 179 | | g = tri->g; |
| 180 | | b = tri->b; |
| 181 | | luminance = tri->luminance; |
| 657 | /* texture header data */ |
| 658 | if ( raster.command_buffer[1] & 0x800000 ) |
| 659 | th = &raster.texture_ram[raster.command_buffer[1] & 0xFFFF]; |
| 660 | else |
| 661 | th = &raster.texture_rom[raster.command_buffer[1] & 0x7FFFFF]; |
| 182 | 662 | |
| 183 | | /* apply luma to texel */ |
| 184 | | loffset = (tri->luma_select << 8) + (0x0f << 4) + ((luminance >> 4) & 0x0f); |
| 663 | object.texheader[0] = *th++; |
| 664 | object.texheader[1] = *th++; |
| 665 | object.texheader[2] = *th++; |
| 666 | object.texheader[3] = *th++; |
| 185 | 667 | |
| 186 | | luminance = model2_lumaram[loffset >> 2]; |
| 668 | /* extract the texture header offset */ |
| 669 | tho = (attr >> 12) & 0x1F; |
| 187 | 670 | |
| 188 | | if ( loffset & 2 ) |
| 189 | | luminance >>= 16; |
| 671 | /* adjust for sign */ |
| 672 | if ( tho & 0x10 ) |
| 673 | tho |= -16; |
| 190 | 674 | |
| 191 | | luminance &= 0xff; |
| 675 | /* update the address */ |
| 676 | raster.command_buffer[1] += tho * 4; |
| 192 | 677 | |
| 193 | | ri = (r<<9) + (luminance<<1); |
| 194 | | gi = (g<<9) + (luminance<<1); |
| 195 | | bi = (b<<9) + (luminance<<1); |
| 678 | /* set the luma value of this quad */ |
| 679 | object.luma = (raster.command_buffer[9] >> 14) & 0xFF; |
| 196 | 680 | |
| 197 | | tr = colortable_r[ri>>2]; |
| 198 | | tg = colortable_g[gi>>2]; |
| 199 | | tb = colortable_b[bi>>2]; |
| 681 | /* determine wether we can cull this quad */ |
| 682 | cull = 0; |
| 200 | 683 | |
| 201 | | if ( ri & 2 ) tr >>= 16; |
| 202 | | if ( gi & 2 ) tg >>= 16; |
| 203 | | if ( bi & 2 ) tb >>= 16; |
| 684 | /* if doubleside is disabled */ |
| 685 | if ( ((attr >> 17) & 1) == 0 ) |
| 686 | { |
| 687 | /* if it's the backface, cull it */ |
| 688 | if ( raster.command_buffer[9] & 0x00800000 ) |
| 689 | cull = 1; |
| 690 | } |
| 204 | 691 | |
| 205 | | tr &= 0xff; |
| 206 | | tg &= 0xff; |
| 207 | | tb &= 0xff; |
| 692 | /* if the linktype is 0, then we can also cull it */ |
| 693 | if ( ((attr >> 8) & 3) == 0 ) |
| 694 | cull = 1; |
| 208 | 695 | |
| 209 | | color = (tr << 16) | (tg << 8) | (tb); |
| 696 | /* if the minimum z value is bigger than the master z clip value, don't render */ |
| 697 | if ( (INT32)(1.0/min_z) > raster.master_z_clip ) |
| 698 | cull = 1; |
| 210 | 699 | |
| 211 | | if(scans) |
| 700 | /* if the maximum z value is < 0 then we can safely clip the entire polygon */ |
| 701 | if ( max_z < 0 ) |
| 702 | cull = 1; |
| 703 | |
| 704 | /* if we're not culling, do z-clip and add to out triangle list */ |
| 705 | if ( cull == 0 ) |
| 212 | 706 | { |
| 213 | | for(y = scans->sy; y <= scans->ey; y++) |
| 707 | INT32 clipped_verts; |
| 708 | vertex verts[10]; |
| 709 | plane clip_plane; |
| 710 | |
| 711 | clip_plane.normal.x = 0; |
| 712 | clip_plane.normal.y = 0; |
| 713 | clip_plane.normal.z = 1; |
| 714 | clip_plane.distance = 0; |
| 715 | |
| 716 | /* do near z clipping */ |
| 717 | clipped_verts = clip_polygon( object.v, 3, &clip_plane, verts); |
| 718 | |
| 719 | if ( clipped_verts > 2 ) |
| 214 | 720 | { |
| 215 | | int x1, x2; |
| 216 | | const struct poly_scanline *scan = &scans->scanline[y - scans->sy]; |
| 217 | | UINT32 *p = BITMAP_ADDR32(bitmap, y, 0); |
| 721 | triangle *ztri; |
| 218 | 722 | |
| 219 | | x1 = scan->sx; |
| 220 | | x2 = scan->ex; |
| 723 | /* set the object's z value */ |
| 724 | zvalue = raster.triangle_z; |
| 221 | 725 | |
| 222 | | for(x = x1; x <= x2; x++) |
| 726 | /* see if we need to recompute min/max z */ |
| 727 | if ( (attr >> 10) & 3 ) |
| 223 | 728 | { |
| 224 | | if ( tri->flags & TRI_FLAG_CHECKER ) |
| 729 | /* update min_z and max_z with the new clipped values */ |
| 730 | min_z = verts[0].z; |
| 731 | max_z = verts[0].z; |
| 732 | |
| 733 | for( i = 1; i < clipped_verts; i++ ) |
| 225 | 734 | { |
| 226 | | UINT32 br, bg, bb; |
| 735 | if ( verts[i].z < min_z ) min_z = verts[i].z; |
| 736 | if ( verts[i].z > max_z ) max_z = verts[i].z; |
| 737 | } |
| 227 | 738 | |
| 228 | | /* blend */ |
| 229 | | br = (tr + ( ( p[x] >> 16 ) & 0xff ) / 2 ); |
| 230 | | bg = (tg + ( ( p[x] >> 8 ) & 0xff ) / 2 ); |
| 231 | | bb = (tb + ( ( p[x] >> 0 ) & 0xff ) / 2 ); |
| 739 | if ( (attr >> 10) & 1 ) /* min value */ |
| 740 | { |
| 741 | zvalue = min_z; |
| 742 | } |
| 743 | else if ( (attr >> 10) & 2 ) /* max value */ |
| 744 | { |
| 745 | zvalue = max_z; |
| 746 | } |
| 232 | 747 | |
| 233 | | color = (br << 16) | (bg << 8) | (bb); |
| 748 | raster.triangle_z = zvalue; |
| 749 | } |
| 750 | |
| 751 | /* adjust and set the object z-sort value */ |
| 752 | object.z = float_to_zval( zvalue + raster.z_adjust ); |
| 753 | |
| 754 | /* get our list read to add the triangles */ |
| 755 | ztri = raster.tri_sorted_list[object.z]; |
| 756 | |
| 757 | if ( ztri != NULL ) |
| 758 | { |
| 759 | while( ztri->next != NULL ) |
| 760 | ztri = ztri->next; |
| 761 | } |
| 762 | |
| 763 | /* go through the clipped vertex list, adding triangles */ |
| 764 | for( i = 2; i < clipped_verts; i++ ) |
| 765 | { |
| 766 | triangle *tri; |
| 767 | |
| 768 | tri = &raster.tri_list[raster.tri_list_index++]; |
| 769 | |
| 770 | if ( raster.tri_list_index >= MAX_TRIANGLES ) |
| 771 | { |
| 772 | fatalerror( "SEGA 3D: Max triangle limit exceeded\n" ); |
| 234 | 773 | } |
| 235 | 774 | |
| 236 | | p[x] = color; |
| 775 | /* copy the object information */ |
| 776 | tri->z = object.z; |
| 777 | tri->texheader[0] = object.texheader[0]; |
| 778 | tri->texheader[1] = object.texheader[1]; |
| 779 | tri->texheader[2] = object.texheader[2]; |
| 780 | tri->texheader[3] = object.texheader[3]; |
| 781 | tri->luma = object.luma; |
| 782 | |
| 783 | /* set the viewport */ |
| 784 | tri->viewport[0] = raster.viewport[0]; |
| 785 | tri->viewport[1] = raster.viewport[1]; |
| 786 | tri->viewport[2] = raster.viewport[2]; |
| 787 | tri->viewport[3] = raster.viewport[3]; |
| 788 | |
| 789 | /* set the center */ |
| 790 | tri->center[0] = raster.center[raster.center_sel][0]; |
| 791 | tri->center[1] = raster.center[raster.center_sel][1]; |
| 792 | |
| 793 | memcpy( &tri->v[0], &verts[0], sizeof( vertex ) ); |
| 794 | memcpy( &tri->v[1], &verts[i-1], sizeof( vertex ) ); |
| 795 | memcpy( &tri->v[2], &verts[i], sizeof( vertex ) ); |
| 796 | |
| 797 | /* add to our sorted list */ |
| 798 | tri->next = NULL; |
| 799 | |
| 800 | if ( ztri == NULL ) |
| 801 | { |
| 802 | raster.tri_sorted_list[object.z] = tri; |
| 803 | } |
| 804 | else |
| 805 | { |
| 806 | ztri->next = tri; |
| 807 | } |
| 808 | |
| 809 | ztri = tri; |
| 237 | 810 | } |
| 811 | |
| 812 | /* keep around the min and max z values for this frame */ |
| 813 | if ( object.z < raster.min_z ) raster.min_z = object.z; |
| 814 | if ( object.z > raster.max_z ) raster.max_z = object.z; |
| 238 | 815 | } |
| 239 | 816 | } |
| 817 | |
| 818 | /* update linking */ |
| 819 | switch( ((attr >> 8) & 3) ) |
| 820 | { |
| 821 | case 0: |
| 822 | case 2: |
| 823 | { |
| 824 | /* reuse P0(n) and P1(n) */ |
| 825 | for( i = 0; i < 6; i++ ) /* P0(n) -> P0(n-1) */ |
| 826 | raster.command_buffer[2+i] = raster.command_buffer[11+i]; /* P1(n) -> P1(n-1) */ |
| 827 | } |
| 828 | break; |
| 829 | |
| 830 | case 1: |
| 831 | { |
| 832 | /* reuse P0(n-1) and P0(n) */ |
| 833 | for( i = 0; i < 3; i++ ) |
| 834 | raster.command_buffer[5+i] = raster.command_buffer[11+i]; /* P0(n) -> P1(n-1) */ |
| 835 | } |
| 836 | break; |
| 837 | |
| 838 | case 3: |
| 839 | { |
| 840 | /* reuse P1(n-1) and P1(n) */ |
| 841 | for( i = 0; i < 3; i++ ) |
| 842 | raster.command_buffer[2+i] = raster.command_buffer[14+i]; /* P1(n) -> P1(n-1) */ |
| 843 | } |
| 844 | break; |
| 845 | } |
| 240 | 846 | } |
| 241 | 847 | |
| 242 | | INLINE int get_texel( UINT32 base_x, UINT32 base_y, int x, int y, UINT32 *sheet ) |
| 848 | /***********************************************************************************************/ |
| 849 | |
| 850 | INLINE UINT16 get_texel( UINT32 base_x, UINT32 base_y, int x, int y, UINT32 *sheet ) |
| 243 | 851 | { |
| r1070 | r1071 | |
| 260 | 868 | return (texel & 0x0f); |
| 261 | 869 | } |
| 262 | 870 | |
| 263 | | static void draw_textured_triangle(mame_bitmap *bitmap, const rectangle *rect, TRIANGLE *tri) |
| 264 | | { |
| 265 | | int x, y; |
| 266 | | struct poly_vertex vert[3]; |
| 267 | | const struct poly_scanline_data *scans; |
| 268 | | int r, g, b; |
| 269 | | int luminance; |
| 270 | | UINT32 tex_x = 32 * tri->tex_x; |
| 271 | | UINT32 tex_y = 32 * tri->tex_y; |
| 272 | | UINT32 tex_width = 32 << tri->tex_width; |
| 273 | | UINT32 tex_height = 32 << tri->tex_height; |
| 274 | | UINT32 tex_x_mask = tex_width - 1; |
| 275 | | UINT32 tex_y_mask = tex_height - 1; |
| 276 | | UINT32 *sheet = (tri->flags & TRI_FLAG_EVEN_BANK) ? (model2_textureram1) : (model2_textureram0); |
| 871 | /* checker = 0, textured = 0, transparent = 0 */ |
| 872 | #define MODEL2_FUNC 0 |
| 873 | #define MODEL2_FUNC_NAME model2_3d_render_0 |
| 874 | #include "model2rd.c" |
| 875 | #undef MODEL2_FUNC |
| 876 | #undef MODEL2_FUNC_NAME |
| 277 | 877 | |
| 278 | | UINT32 *colortable_r = &model2_colorxlat[0x0000/4]; |
| 279 | | UINT32 *colortable_g = &model2_colorxlat[0x4000/4]; |
| 280 | | UINT32 *colortable_b = &model2_colorxlat[0x8000/4]; |
| 878 | /* checker = 0, textured = 0, translucent = 1 */ |
| 879 | #define MODEL2_FUNC 1 |
| 880 | #define MODEL2_FUNC_NAME model2_3d_render_1 |
| 881 | #include "model2rd.c" |
| 882 | #undef MODEL2_FUNC |
| 883 | #undef MODEL2_FUNC_NAME |
| 281 | 884 | |
| 282 | | // mame_printf_debug("Tex X: %d, Tex Y: %d, Tex Width: %d, Tex Height: %d - Bank = %d\n", tex_x, tex_y, tex_width, tex_height, (tri->flags & TRI_FLAG_EVEN_BANK) ? 1 : 0 ); |
| 283 | | // mame_printf_debug("U0: %d, V0: %d, U1: %d, V1: %d, U2: %d, V2: %d\n", tri->v[0].u, tri->v[0].v, tri->v[1].u, tri->v[1].v, tri->v[2].u, tri->v[2].v); |
| 885 | /* checker = 0, textured = 1, translucent = 0 */ |
| 886 | #define MODEL2_FUNC 2 |
| 887 | #define MODEL2_FUNC_NAME model2_3d_render_2 |
| 888 | #include "model2rd.c" |
| 889 | #undef MODEL2_FUNC |
| 890 | #undef MODEL2_FUNC_NAME |
| 284 | 891 | |
| 285 | | vert[0].x = tri->v[0].x; vert[0].y = tri->v[0].y; vert[0].p[0] = tri->v[0].u; vert[0].p[1] = tri->v[0].v; |
| 286 | | vert[1].x = tri->v[1].x; vert[1].y = tri->v[1].y; vert[1].p[0] = tri->v[1].u; vert[1].p[1] = tri->v[1].v; |
| 287 | | vert[2].x = tri->v[2].x; vert[2].y = tri->v[2].y; vert[2].p[0] = tri->v[2].u; vert[2].p[1] = tri->v[2].v; |
| 892 | /* checker = 0, textured = 1, translucent = 1 */ |
| 893 | #define MODEL2_FUNC 3 |
| 894 | #define MODEL2_FUNC_NAME model2_3d_render_3 |
| 895 | #include "model2rd.c" |
| 896 | #undef MODEL2_FUNC |
| 897 | #undef MODEL2_FUNC_NAME |
| 288 | 898 | |
| 289 | | scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], rect); |
| 899 | /* checker = 1, textured = 0, translucent = 0 */ |
| 900 | #define MODEL2_FUNC 4 |
| 901 | #define MODEL2_FUNC_NAME model2_3d_render_4 |
| 902 | #include "model2rd.c" |
| 903 | #undef MODEL2_FUNC |
| 904 | #undef MODEL2_FUNC_NAME |
| 290 | 905 | |
| 291 | | r = tri->r; |
| 292 | | g = tri->g; |
| 293 | | b = tri->b; |
| 294 | | luminance = tri->luminance; |
| 906 | /* checker = 1, textured = 0, translucent = 1 */ |
| 907 | #define MODEL2_FUNC 5 |
| 908 | #define MODEL2_FUNC_NAME model2_3d_render_5 |
| 909 | #include "model2rd.c" |
| 910 | #undef MODEL2_FUNC |
| 911 | #undef MODEL2_FUNC_NAME |
| 295 | 912 | |
| 296 | | if(scans) |
| 297 | | { |
| 298 | | INT64 du, dv; |
| 299 | | du = scans->dp[0]; |
| 300 | | dv = scans->dp[1]; |
| 913 | /* checker = 1, textured = 1, translucent = 0 */ |
| 914 | #define MODEL2_FUNC 6 |
| 915 | #define MODEL2_FUNC_NAME model2_3d_render_6 |
| 916 | #include "model2rd.c" |
| 917 | #undef MODEL2_FUNC |
| 918 | #undef MODEL2_FUNC_NAME |
| 301 | 919 | |
| 302 | | for(y = scans->sy; y <= scans->ey; y++) |
| 303 | | { |
| 304 | | INT64 u, v; |
| 305 | | int x1, x2; |
| 306 | | UINT16 loffset; |
| 307 | | const struct poly_scanline *scan = &scans->scanline[y - scans->sy]; |
| 308 | | UINT32 *p = BITMAP_ADDR32(bitmap, y, 0); |
| 920 | /* checker = 1, textured = 1, translucent = 1 */ |
| 921 | #define MODEL2_FUNC 7 |
| 922 | #define MODEL2_FUNC_NAME model2_3d_render_7 |
| 923 | #include "model2rd.c" |
| 924 | #undef MODEL2_FUNC |
| 925 | #undef MODEL2_FUNC_NAME |
| 309 | 926 | |
| 310 | | x1 = scan->sx; |
| 311 | | x2 = scan->ex; |
| 927 | /***********************************************************************************************/ |
| 312 | 928 | |
| 313 | | u = scans->scanline[y - scans->sy].p[0]; |
| 314 | | v = scans->scanline[y - scans->sy].p[1]; |
| 929 | typedef void (*model2_3d_render_func)( mame_bitmap *bitmap, triangle *tri, const rectangle *cliprect ); |
| 315 | 930 | |
| 316 | | for(x = x1; x <= x2; x++) |
| 317 | | { |
| 318 | | UINT32 tr, tg, tb, luma, ri, gi, bi; |
| 319 | | UINT16 t; |
| 320 | | int u2 = (int)(u >> (16+3)) & tex_x_mask; |
| 321 | | int v2 = (int)(v >> (16+3)) & tex_y_mask; |
| 931 | static model2_3d_render_func render_funcs[8] = |
| 932 | { |
| 933 | model2_3d_render_0, /* checker = 0, textured = 0, translucent = 0 */ |
| 934 | model2_3d_render_1, /* checker = 0, textured = 0, translucent = 1 */ |
| 935 | model2_3d_render_2, /* checker = 0, textured = 1, translucent = 0 */ |
| 936 | model2_3d_render_3, /* checker = 0, textured = 1, translucent = 1 */ |
| 937 | model2_3d_render_4, /* checker = 1, textured = 0, translucent = 0 */ |
| 938 | model2_3d_render_5, /* checker = 1, textured = 0, translucent = 1 */ |
| 939 | model2_3d_render_6, /* checker = 1, textured = 1, translucent = 0 */ |
| 940 | model2_3d_render_7 /* checker = 1, textured = 1, translucent = 1 */ |
| 941 | }; |
| 322 | 942 | |
| 323 | | if ( tri->flags & TRI_FLAG_MIRROR_X ) |
| 324 | | u2 = ( tex_width - 1 ) - u2; |
| 943 | static void model2_3d_render( mame_bitmap *bitmap, triangle *tri, const rectangle *cliprect ) |
| 944 | { |
| 945 | UINT8 renderer; |
| 946 | rectangle vp; |
| 325 | 947 | |
| 326 | | if ( tri->flags & TRI_FLAG_MIRROR_Y ) |
| 327 | | v2 = ( tex_height - 1 ) - v2; |
| 948 | /* select renderer based on attributes (bit15 = checker, bit14 = textured, bit13 = transparent */ |
| 949 | renderer = (tri->texheader[0] >> 13) & 7; |
| 328 | 950 | |
| 329 | | t = get_texel( tex_x, tex_y, u2, v2, sheet ); |
| 951 | /* calculate and clip to viewport */ |
| 952 | vp.min_x = tri->viewport[0] - 8; |
| 953 | vp.max_x = tri->viewport[2] - 8; |
| 954 | vp.min_y = (384-tri->viewport[3])+90; |
| 955 | vp.max_y = (384-tri->viewport[1])+90; |
| 330 | 956 | |
| 331 | | if ( !(t == 0x0f && ( tri->flags & TRI_FLAG_TEXTURE_TRANS ) ) ) |
| 332 | | { |
| 333 | | loffset = (tri->luma_select << 8) + (t << 4) + ((luminance >> 4) & 0x0f); |
| 957 | if ( vp.min_x < cliprect->min_x ) vp.min_x = cliprect->min_x; |
| 958 | if ( vp.max_x > cliprect->max_x ) vp.max_x = cliprect->max_x; |
| 959 | if ( vp.min_y < cliprect->min_y ) vp.min_y = cliprect->min_y; |
| 960 | if ( vp.max_y > cliprect->max_y ) vp.max_y = cliprect->max_y; |
| 334 | 961 | |
| 335 | | luma = model2_lumaram[loffset >> 2]; |
| 962 | /* render */ |
| 963 | (*render_funcs[renderer])( bitmap, tri, &vp ); |
| 964 | } |
| 336 | 965 | |
| 337 | | if ( loffset & 2 ) |
| 338 | | luma >>= 16; |
| 966 | /* |
| 967 | Projection: |
| 339 | 968 | |
| 340 | | luma &= 0xff; |
| 969 | According to the 2B Manual the screen coordinates are: |
| 341 | 970 | |
| 342 | | ri = (r<<9) + (luma<<1); |
| 343 | | gi = (g<<9) + (luma<<1); |
| 344 | | bi = (b<<9) + (luma<<1); |
| 971 | (8,474) (504,474) |
| 972 | +--------------------------------+ |
| 973 | | | |
| 974 | | | |
| 975 | | | |
| 976 | | | |
| 977 | | | |
| 978 | | | |
| 979 | | | |
| 980 | | | |
| 981 | +--------------------------------+ |
| 982 | (8,90) (504,90) |
| 983 | */ |
| 345 | 984 | |
| 346 | | tr = colortable_r[ri>>2]; |
| 347 | | tg = colortable_g[gi>>2]; |
| 348 | | tb = colortable_b[bi>>2]; |
| 985 | /* 3D Rasterizer projection: projects a triangle into screen coordinates */ |
| 986 | static void model2_3d_project( triangle *tri ) |
| 987 | { |
| 988 | UINT16 i; |
| 349 | 989 | |
| 350 | | if ( ri & 2 ) tr >>= 16; |
| 351 | | if ( gi & 2 ) tg >>= 16; |
| 352 | | if ( bi & 2 ) tb >>= 16; |
| 353 | | |
| 354 | | tr &= 0xff; |
| 355 | | tg &= 0xff; |
| 356 | | tb &= 0xff; |
| 357 | | |
| 358 | | if ( tri->flags & TRI_FLAG_CHECKER ) |
| 359 | | { |
| 360 | | /* blend */ |
| 361 | | tr = ( tr + ( ( p[x] >> 16 ) & 0xff ) ) / 2; |
| 362 | | tg = ( tg + ( ( p[x] >> 8 ) & 0xff ) ) / 2; |
| 363 | | tb = ( tb + ( ( p[x] >> 0 ) & 0xff ) ) / 2; |
| 364 | | } |
| 365 | | |
| 366 | | p[x] = (tr << 16) | (tg << 8) | (tb); |
| 367 | | } |
| 368 | | |
| 369 | | u += du; |
| 370 | | v += dv; |
| 371 | | } |
| 372 | | } |
| 990 | for( i = 0; i < 3; i++ ) |
| 991 | { |
| 992 | /* project the vertices */ |
| 993 | tri->v[i].x = -8 + tri->center[0] + (tri->v[i].x / (1.0+tri->v[i].z)); |
| 994 | tri->v[i].y = ((384 - tri->center[1])+90) - (tri->v[i].y / (1.0+tri->v[i].z)); |
| 373 | 995 | } |
| 374 | 996 | } |
| 375 | 997 | |
| 376 | | static int zsort(const void * a, const void * b) |
| 998 | /* 3D Rasterizer frame start: Resets frame variables */ |
| 999 | static void model2_3d_frame_start( void ) |
| 377 | 1000 | { |
| 378 | | if (((TRIANGLE*)(a))->z < ((TRIANGLE*)(b))->z) |
| 379 | | return 1; |
| 380 | | else if (((TRIANGLE*)(a))->z > ((TRIANGLE*)(b))->z) |
| 381 | | return -1; |
| 382 | | else |
| 383 | | return 0; |
| 1001 | /* reset the triangle list index */ |
| 1002 | raster.tri_list_index = 0; |
| 1003 | |
| 1004 | /* reset the sorted z list */ |
| 1005 | memset( raster.tri_sorted_list, 0, 0x10000 * sizeof( triangle * ) ); |
| 1006 | |
| 1007 | /* reset the min-max sortable Z values */ |
| 1008 | raster.min_z = 0xFFFF; |
| 1009 | raster.max_z = 0; |
| 384 | 1010 | } |
| 385 | 1011 | |
| 386 | | static void render_triangles(mame_bitmap *bitmap, const rectangle *cliprect) |
| 1012 | static void model2_3d_frame_end( bitmap_t *bitmap, const rectangle *cliprect ) |
| 387 | 1013 | { |
| 388 | | int i; |
| 1014 | INT32 z; |
| 389 | 1015 | |
| 390 | | qsort(tribuffer, tribuffer_pos, sizeof(TRIANGLE), zsort); |
| 1016 | /* if we have nothing to render, bail */ |
| 1017 | if ( raster.tri_list_index == 0 ) |
| 1018 | return; |
| 391 | 1019 | |
| 392 | | for (i=0; i < tribuffer_pos; i++) |
| 1020 | #if DEBUG |
| 1021 | if (input_code_pressed(KEYCODE_Q)) |
| 393 | 1022 | { |
| 394 | | rectangle rect; |
| 395 | | rect.min_x = tribuffer[i].window.x; |
| 396 | | rect.max_x = tribuffer[i].window.x + tribuffer[i].window.width; |
| 397 | | rect.min_y = tribuffer[i].window.y; |
| 398 | | rect.max_y = tribuffer[i].window.y + tribuffer[i].window.height; |
| 1023 | UINT32 i; |
| 399 | 1024 | |
| 400 | | if (rect.min_x < cliprect->min_x) rect.min_x = cliprect->min_x; |
| 401 | | if (rect.min_x > cliprect->max_x) rect.min_x = cliprect->max_x; |
| 402 | | if (rect.max_x < cliprect->min_x) rect.max_x = cliprect->min_x; |
| 403 | | if (rect.max_x > cliprect->max_x) rect.max_x = cliprect->max_x; |
| 404 | | if (rect.min_y < cliprect->min_y) rect.min_y = cliprect->min_y; |
| 405 | | if (rect.min_y > cliprect->max_y) rect.min_y = cliprect->max_y; |
| 406 | | if (rect.max_y < cliprect->min_y) rect.max_y = cliprect->min_y; |
| 407 | | if (rect.max_y > cliprect->max_y) rect.max_y = cliprect->max_y; |
| 1025 | FILE *f = fopen( "triangles.txt", "w" ); |
| 408 | 1026 | |
| 409 | | if (tribuffer[i].flags & TRI_FLAG_TEXTURE) |
| 1027 | if ( f ) |
| 410 | 1028 | { |
| 411 | | draw_textured_triangle(bitmap, &rect, &tribuffer[i]); |
| 412 | | //draw_solid_triangle(bitmap, &rect, &tribuffer[i]); |
| 1029 | for( i = 0; i < raster.tri_list_index; i++ ) |
| 1030 | { |
| 1031 | |
| 1032 | fprintf( f, "index: %d\n", i ); |
| 1033 | fprintf( f, "v0.x = %f, v0.y = %f, v0.z = %f\n", raster.tri_list[i].v[0].x, raster.tri_list[i].v[0].y, raster.tri_list[i].v[0].z ); |
| 1034 | fprintf( f, "v1.x = %f, v1.y = %f, v1.z = %f\n", raster.tri_list[i].v[1].x, raster.tri_list[i].v[1].y, raster.tri_list[i].v[1].z ); |
| 1035 | fprintf( f, "v2.x = %f, v2.y = %f, v2.z = %f\n", raster.tri_list[i].v[2].x, raster.tri_list[i].v[2].y, raster.tri_list[i].v[2].z ); |
| 1036 | |
| 1037 | fprintf( f, "tri z: %04x\n", raster.tri_list[i].z ); |
| 1038 | fprintf( f, "texheader - 0: %04x\n", raster.tri_list[i].texheader[0] ); |
| 1039 | fprintf( f, "texheader - 1: %04x\n", raster.tri_list[i].texheader[1] ); |
| 1040 | fprintf( f, "texheader - 2: %04x\n", raster.tri_list[i].texheader[2] ); |
| 1041 | fprintf( f, "texheader - 3: %04x\n", raster.tri_list[i].texheader[3] ); |
| 1042 | fprintf( f, "luma: %02x\n", raster.tri_list[i].luma ); |
| 1043 | fprintf( f, "vp.sx: %04x\n", raster.tri_list[i].viewport[0] ); |
| 1044 | fprintf( f, "vp.sy: %04x\n", raster.tri_list[i].viewport[1] ); |
| 1045 | fprintf( f, "vp.ex: %04x\n", raster.tri_list[i].viewport[2] ); |
| 1046 | fprintf( f, "vp.ey: %04x\n", raster.tri_list[i].viewport[3] ); |
| 1047 | fprintf( f, "vp.swx: %04x\n", raster.tri_list[i].center[0] ); |
| 1048 | fprintf( f, "vp.swy: %04x\n", raster.tri_list[i].center[1] ); |
| 1049 | fprintf( f, "\n---\n\n" ); |
| 1050 | } |
| 1051 | |
| 1052 | fprintf( f, "min_z = %04x, max_z = %04x\n", raster.min_z, raster.max_z ); |
| 1053 | |
| 1054 | fclose( f ); |
| 413 | 1055 | } |
| 414 | | else |
| 1056 | } |
| 1057 | #endif |
| 1058 | |
| 1059 | /* go through the Z levels, and render each bucket */ |
| 1060 | for( z = raster.max_z; z >= raster.min_z; z-- ) |
| 1061 | { |
| 1062 | /* see if we have items at this z level */ |
| 1063 | if ( raster.tri_sorted_list[z] != NULL ) |
| 415 | 1064 | { |
| 416 | | draw_solid_triangle(bitmap, &rect, &tribuffer[i]); |
| 1065 | /* get a pointer to the first triangle */ |
| 1066 | triangle *tri = raster.tri_sorted_list[z]; |
| 1067 | |
| 1068 | /* and loop clipping and rendering each triangle */ |
| 1069 | while( tri != NULL ) |
| 1070 | { |
| 1071 | /* project and render */ |
| 1072 | model2_3d_project( tri ); |
| 1073 | model2_3d_render( bitmap, tri, cliprect ); |
| 1074 | |
| 1075 | tri = tri->next; |
| 1076 | } |
| 417 | 1077 | } |
| 418 | 1078 | } |
| 1079 | } |
| 419 | 1080 | |
| 420 | | #if 0 |
| 1081 | /* 3D Rasterizer main data input port */ |
| 1082 | void model2_3d_push( UINT32 input ) |
| 1083 | { |
| 1084 | /* see if we have a command in progress */ |
| 1085 | if ( raster.cur_command != 0 ) |
| 421 | 1086 | { |
| 1087 | raster.command_buffer[raster.command_index++] = input; |
| 422 | 1088 | |
| 423 | | #define TEX_BASE_X 512 |
| 424 | | #define TEX_BASE_Y 640 |
| 425 | | #define TEX_WIDTH 128 |
| 426 | | #define TEX_HEIGHT 128 |
| 427 | | #define TEX_BANK 1 |
| 1089 | switch( raster.cur_command ) |
| 1090 | { |
| 1091 | case 0x00: /* NOP */ |
| 1092 | break; |
| 428 | 1093 | |
| 429 | | int x,y; |
| 1094 | case 0x01: /* Polygon Data */ |
| 1095 | { |
| 1096 | UINT32 attr; |
| 430 | 1097 | |
| 431 | | for( y = 0; y < TEX_HEIGHT; y++ ) |
| 432 | | { |
| 433 | | UINT32 *y0 = BITMAP_ADDR32(bitmap, y, 0); |
| 1098 | /* start by looking if we have the basic input data */ |
| 1099 | if ( raster.command_index < 9 ) |
| 1100 | return; |
| 434 | 1101 | |
| 435 | | for( x = 0; x < TEX_WIDTH; x++ ) |
| 1102 | /* get the attributes */ |
| 1103 | attr = raster.command_buffer[8]; |
| 1104 | |
| 1105 | /* see if we're done */ |
| 1106 | if ( (attr & 3) == 0 ) |
| 1107 | { |
| 1108 | raster.cur_command = 0; |
| 1109 | return; |
| 1110 | } |
| 1111 | |
| 1112 | /* see if it's a quad or a triangle */ |
| 1113 | if ( attr & 1 ) |
| 1114 | { |
| 1115 | /* it's a quad, wait for the rest of the points */ |
| 1116 | if ( raster.command_index < 17 ) |
| 1117 | return; |
| 1118 | |
| 1119 | /* we have a full quad info, fill up our quad structure */ |
| 1120 | model2_3d_process_quad( attr ); |
| 1121 | |
| 1122 | /* back up and wait for more data */ |
| 1123 | raster.command_index = 8; |
| 1124 | } |
| 1125 | else |
| 1126 | { |
| 1127 | /* it's a triangle, wait for the rest of the point */ |
| 1128 | if ( raster.command_index < 14 ) |
| 1129 | return; |
| 1130 | |
| 1131 | /* we have a full quad info, fill up our quad structure */ |
| 1132 | model2_3d_process_triangle( attr ); |
| 1133 | |
| 1134 | /* back up and wait for more data */ |
| 1135 | raster.command_index = 8; |
| 1136 | } |
| 1137 | } |
| 1138 | break; |
| 1139 | |
| 1140 | case 0x03: /* Window Data */ |
| 436 | 1141 | { |
| 437 | | UINT32 lup[0x10] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, |
| 438 | | 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; |
| 1142 | UINT32 i; |
| 439 | 1143 | |
| 440 | | UINT32 *tb = (TEX_BANK) ? model2_textureram1 : model2_textureram0; |
| 1144 | /* make sure we have all the data */ |
| 1145 | if ( raster.command_index < 6 ) |
| 1146 | return; |
| 441 | 1147 | |
| 442 | | UINT16 tv = get_texel( TEX_BASE_X, TEX_BASE_Y, x, y, tb ); |
| 1148 | /* coordinates are 12 bit signed */ |
| 443 | 1149 | |
| 444 | | if ( x >= cliprect->min_x && x < cliprect->max_x && y >= cliprect->min_y && y < cliprect->max_y ) |
| 1150 | /* extract the viewport start x */ |
| 1151 | raster.viewport[0] = (raster.command_buffer[0] >> 12) & 0xFFF; |
| 1152 | |
| 1153 | if ( raster.viewport[0] & 0x800 ) |
| 1154 | raster.viewport[0] = -( 0x800 - (raster.viewport[0] & 0x7FF) ); |
| 1155 | |
| 1156 | /* extract the viewport start y */ |
| 1157 | raster.viewport[1] = raster.command_buffer[0] & 0xFFF; |
| 1158 | |
| 1159 | if ( raster.viewport[1] & 0x800 ) |
| 1160 | raster.viewport[1] = -( 0x800 - (raster.viewport[1] & 0x7FF) ); |
| 1161 | |
| 1162 | /* extract the viewport end x */ |
| 1163 | raster.viewport[2] = (raster.command_buffer[1] >> 12) & 0xFFF; |
| 1164 | |
| 1165 | if ( raster.viewport[2] & 0x800 ) |
| 1166 | raster.viewport[2] = -( 0x800 - (raster.viewport[2] & 0x7FF) ); |
| 1167 | |
| 1168 | /* extract the viewport end y */ |
| 1169 | raster.viewport[3] = raster.command_buffer[1] & 0xFFF; |
| 1170 | |
| 1171 | if ( raster.viewport[3] & 0x800 ) |
| 1172 | raster.viewport[3] = -( 0x800 - (raster.viewport[3] & 0x7FF) ); |
| 1173 | |
| 1174 | /* extract the centers */ |
| 1175 | for( i = 0; i < 4; i++ ) |
| 445 | 1176 | { |
| 446 | | y0[x] = lup[tv] | ((lup[tv])<<8) | ((lup[tv])<<16); |
| 1177 | /* center x */ |
| 1178 | raster.center[i][0] = (raster.command_buffer[2+i] >> 12) & 0xFFF; |
| 1179 | |
| 1180 | if ( raster.center[i][0] & 0x800 ) |
| 1181 | raster.center[i][0] = -( 0x800 - (raster.center[i][0] & 0x7FF) ); |
| 1182 | |
| 1183 | /* center y */ |
| 1184 | raster.center[i][1] = raster.command_buffer[2+i] & 0xFFF; |
| 1185 | |
| 1186 | if ( raster.center[i][1] & 0x800 ) |
| 1187 | raster.center[i][1] = -( 0x800 - (raster.center[i][1] & 0x7FF) ); |
| 447 | 1188 | } |
| 1189 | |
| 1190 | /* done with this command */ |
| 1191 | raster.cur_command = 0; |
| 448 | 1192 | } |
| 1193 | break; |
| 1194 | |
| 1195 | case 0x04: /* Texture/Log Data write */ |
| 1196 | { |
| 1197 | /* make sure we have enough data */ |
| 1198 | if ( raster.command_index < 2 ) |
| 1199 | return; |
| 1200 | |
| 1201 | /* see if the count is non-zero */ |
| 1202 | if ( raster.command_buffer[1] > 0 ) |
| 1203 | { |
| 1204 | /* see if we have data available */ |
| 1205 | if ( raster.command_index >= 3 ) |
| 1206 | { |
| 1207 | /* get the address */ |
| 1208 | UINT32 address = raster.command_buffer[0]; |
| 1209 | |
| 1210 | /* do the write */ |
| 1211 | if ( address & 0x800000 ) |
| 1212 | raster.texture_ram[address&0xFFFF] = raster.command_buffer[2]; |
| 1213 | else |
| 1214 | raster.log_ram[address&0xFFFF] = raster.command_buffer[2]; |
| 1215 | |
| 1216 | /* increment the address and decrease the count */ |
| 1217 | raster.command_buffer[0]++; |
| 1218 | raster.command_buffer[1]--; |
| 1219 | |
| 1220 | /* decrease the index, so we keep placing data in the same slot */ |
| 1221 | raster.command_index--; |
| 1222 | } |
| 1223 | } |
| 1224 | |
| 1225 | /* see if we're done with this command */ |
| 1226 | if ( raster.command_buffer[1] == 0 ) |
| 1227 | raster.cur_command = 0; |
| 1228 | } |
| 1229 | break; |
| 1230 | |
| 1231 | case 0x08: /* ZSort mode */ |
| 1232 | { |
| 1233 | /* save the zsort mode value */ |
| 1234 | raster.z_adjust = u2f( raster.command_buffer[0] << 8 ); |
| 1235 | |
| 1236 | /* done with this command */ |
| 1237 | raster.cur_command = 0; |
| 1238 | } |
| 1239 | break; |
| 1240 | |
| 1241 | default: |
| 1242 | { |
| 1243 | fatalerror( "SEGA 3D: Unknown rasterizer command %08x\n", raster.cur_command ); |
| 1244 | } |
| 1245 | break; |
| 449 | 1246 | } |
| 450 | 1247 | } |
| 451 | | #endif |
| 1248 | else |
| 1249 | { |
| 1250 | /* new command */ |
| 1251 | raster.cur_command = input & 0x0F; |
| 1252 | raster.command_index = 0; |
| 1253 | |
| 1254 | /* see if it's object data */ |
| 1255 | if ( raster.cur_command == 1 ) |
| 1256 | { |
| 1257 | /* extract reverse bit */ |
| 1258 | raster.reverse = (input >> 4) & 1; |
| 1259 | |
| 1260 | /* extract center select */ |
| 1261 | raster.center_sel = ( input >> 6 ) & 3; |
| 1262 | |
| 1263 | /* reset the triangle z value */ |
| 1264 | raster.triangle_z = 0; |
| 1265 | } |
| 1266 | } |
| 452 | 1267 | } |
| 453 | 1268 | |
| 454 | | INLINE int is_point_inside(float x, float y, float z, PLANE cp) |
| 1269 | /***********************************************************************************************/ |
| 1270 | |
| 1271 | |
| 1272 | |
| 1273 | /******************************************* |
| 1274 | * |
| 1275 | * Geometry Engine Internal State |
| 1276 | * |
| 1277 | *******************************************/ |
| 1278 | |
| 1279 | typedef struct |
| 455 | 1280 | { |
| 456 | | float s = (x * cp.x) + (y * cp.y) + (z * cp.z) + cp.d; |
| 457 | | if (s >= 0.0f) |
| 458 | | return 1; |
| 459 | | else |
| 460 | | return 0; |
| 461 | | } |
| 1281 | UINT32 mode; /* bit 0 = Enable Specular, bit 1 = Calculate Normals */ |
| 1282 | UINT32 * polygon_rom; /* Polygon ROM pointer */ |
| 1283 | UINT32 * polygon_ram0; /* Fast Polygon RAM pointer */ |
| 1284 | UINT32 * polygon_ram1; /* Slow Polygon RAM pointer */ |
| 1285 | float matrix[12]; /* Current Transformation Matrix */ |
| 1286 | vertex focus; /* Focus (x,y) */ |
| 1287 | vertex light; /* Light Vector */ |
| 1288 | float lod; /* LOD */ |
| 1289 | float coef_table[32]; /* Distane Coefficient table */ |
| 1290 | texture_parameter texture_parameters[32]; /* Texture parameters */ |
| 1291 | } geo_state; |
| 462 | 1292 | |
| 463 | | INLINE float line_plane_intersection(VERTEX *v1, VERTEX *v2, PLANE cp) |
| 1293 | static geo_state geo; |
| 1294 | |
| 1295 | /******************************************* |
| 1296 | * |
| 1297 | * Geometry Engine Initialization |
| 1298 | * |
| 1299 | *******************************************/ |
| 1300 | |
| 1301 | static void geo_init( UINT32 *polygon_rom ) |
| 464 | 1302 | { |
| 465 | | float x = v1->x - v2->x; |
| 466 | | float y = v1->y - v2->y; |
| 467 | | float z = v1->z - v2->z; |
| 468 | | float t = ((cp.x * v1->x) + (cp.y * v1->y) + (cp.z * v1->z)) / ((cp.x * x) + (cp.y * y) + (cp.z * z)); |
| 469 | | return t; |
| 1303 | memset( &geo, 0, sizeof( geo_state ) ); |
| 1304 | |
| 1305 | geo.polygon_rom = polygon_rom; |
| 1306 | geo.polygon_ram0 = auto_malloc(0x8000 * sizeof(UINT32)); |
| 1307 | geo.polygon_ram1 = auto_malloc(0x8000 * sizeof(UINT32)); |
| 470 | 1308 | } |
| 471 | 1309 | |
| 472 | | static int clip_polygon(VERTEX *v, int num_vertices, PLANE cp, VERTEX *vout) |
| 1310 | /******************************************* |
| 1311 | * |
| 1312 | * Geometry Engine Polygon Parsers |
| 1313 | * |
| 1314 | *******************************************/ |
| 1315 | |
| 1316 | /* Parse Polygons: Normals Present, No Specular case */ |
| 1317 | static void geo_parse_np_ns( UINT32 *input, UINT32 count ) |
| 473 | 1318 | { |
| 474 | | VERTEX clipv[10]; |
| 475 | | int clip_verts = 0; |
| 476 | | float t; |
| 477 | | int i; |
| 1319 | vertex point, normal; |
| 1320 | UINT32 attr, i; |
| 478 | 1321 | |
| 479 | | int pv = num_vertices - 1; |
| 1322 | /* read the 1st point */ |
| 1323 | point.x = u2f( *input++ ); |
| 1324 | point.y = u2f( *input++ ); |
| 1325 | point.z = u2f( *input++ ); |
| 480 | 1326 | |
| 481 | | for (i=0; i < num_vertices; i++) |
| 1327 | /* transform with the current matrix */ |
| 1328 | transform_point( &point, geo.matrix ); |
| 1329 | |
| 1330 | /* apply focus */ |
| 1331 | point.x *= geo.focus.x; |
| 1332 | point.y *= geo.focus.y; |
| 1333 | |
| 1334 | /* push it to the 3d rasterizer */ |
| 1335 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1336 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1337 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1338 | |
| 1339 | /* read the 2nd point */ |
| 1340 | point.x = u2f( *input++ ); |
| 1341 | point.y = u2f( *input++ ); |
| 1342 | point.z = u2f( *input++ ); |
| 1343 | |
| 1344 | /* transform with the current matrix */ |
| 1345 | transform_point( &point, geo.matrix ); |
| 1346 | |
| 1347 | /* apply focus */ |
| 1348 | point.x *= geo.focus.x; |
| 1349 | point.y *= geo.focus.y; |
| 1350 | |
| 1351 | /* push it to the 3d rasterizer */ |
| 1352 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1353 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1354 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1355 | |
| 1356 | /* loop through the following links */ |
| 1357 | for( i = 0; i < count; i++ ) |
| 482 | 1358 | { |
| 483 | | int v1_in = is_point_inside(v[i].x, v[i].y, v[i].z, cp); |
| 484 | | int v2_in = is_point_inside(v[pv].x, v[pv].y, v[pv].z, cp); |
| 1359 | /* read in the attributes */ |
| 1360 | attr = *input++; |
| 485 | 1361 | |
| 486 | | if (v1_in && v2_in) /* edge is completely inside the volume */ |
| 1362 | /* push to the 3d rasterizer */ |
| 1363 | model2_3d_push( attr & 0x0003FFFF ); |
| 1364 | |
| 1365 | /* read in the normal */ |
| 1366 | normal.x = u2f(*input++); |
| 1367 | normal.y = u2f(*input++); |
| 1368 | normal.z = u2f(*input++); |
| 1369 | |
| 1370 | /* transform with the current matrix */ |
| 1371 | transform_vector( &normal, geo.matrix ); |
| 1372 | |
| 1373 | if ( (attr & 3) != 0 ) /* quad or triangle */ |
| 487 | 1374 | { |
| 488 | | memcpy(&clipv[clip_verts], &v[i], sizeof(VERTEX)); |
| 489 | | ++clip_verts; |
| 490 | | } |
| 491 | | else if (!v1_in && v2_in) /* edge is entering the volume */ |
| 492 | | { |
| 493 | | /* insert vertex at intersection point */ |
| 494 | | t = line_plane_intersection(&v[i], &v[pv], cp); |
| 495 | | clipv[clip_verts].x = v[i].x + ((v[pv].x - v[i].x) * t); |
| 496 | | clipv[clip_verts].y = v[i].y + ((v[pv].y - v[i].y) * t); |
| 497 | | clipv[clip_verts].z = v[i].z + ((v[pv].z - v[i].z) * t); |
| 498 | | clipv[clip_verts].u = (UINT32)((float)v[i].u + (((float)v[pv].u - (float)v[i].u) * t)); |
| 499 | | clipv[clip_verts].v = (UINT32)((float)v[i].v + (((float)v[pv].v - (float)v[i].v) * t)); |
| 500 | | ++clip_verts; |
| 501 | | } |
| 502 | | else if (v1_in && !v2_in) /* edge is leaving the volume */ |
| 503 | | { |
| 504 | | /* insert vertex at intersection point */ |
| 505 | | t = line_plane_intersection(&v[i], &v[pv], cp); |
| 506 | | clipv[clip_verts].x = v[i].x + ((v[pv].x - v[i].x) * t); |
| 507 | | clipv[clip_verts].y = v[i].y + ((v[pv].y - v[i].y) * t); |
| 508 | | clipv[clip_verts].z = v[i].z + ((v[pv].z - v[i].z) * t); |
| 509 | | clipv[clip_verts].u = (UINT32)((float)v[i].u + (((float)v[pv].u - (float)v[i].u) * t)); |
| 510 | | clipv[clip_verts].v = (UINT32)((float)v[i].v + (((float)v[pv].v - (float)v[i].v) * t)); |
| 511 | | ++clip_verts; |
| 1375 | float dotl, dotp, luminance, distance; |
| 1376 | float coef, face; |
| 1377 | INT32 luma; |
| 1378 | texture_parameter * texparam; |
| 512 | 1379 | |
| 513 | | /* insert the existing vertex */ |
| 514 | | memcpy(&clipv[clip_verts], &v[i], sizeof(VERTEX)); |
| 515 | | ++clip_verts; |
| 516 | | } |
| 1380 | /* read in the next point */ |
| 1381 | point.x = u2f( *input++ ); |
| 1382 | point.y = u2f( *input++ ); |
| 1383 | point.z = u2f( *input++ ); |
| 517 | 1384 | |
| 518 | | pv = i; |
| 519 | | } |
| 520 | | memcpy(&vout[0], &clipv[0], sizeof(VERTEX) * clip_verts); |
| 521 | | return clip_verts; |
| 522 | | } |
| 1385 | /* transform with the current matrix */ |
| 1386 | transform_point( &point, geo.matrix ); |
| 523 | 1387 | |
| 524 | | INLINE void project_point( VERTEX *v ) |
| 525 | | { |
| 526 | | float ooz = 1.0f / -v->z; |
| 527 | | v->x = -((v->x * ooz) * focus_x) + (float)(window.x + (window.width / 2)); |
| 528 | | v->y = ((v->y * ooz) * focus_y) + (float)(window.y + (window.height / 2)); |
| 529 | | } |
| 1388 | /* calculate the dot product of the normal and the light vector */ |
| 1389 | dotl = dot_product( &normal, &geo.light ); |
| 530 | 1390 | |
| 531 | | static void push_triangle(TRIANGLE *tri) |
| 532 | | { |
| 533 | | int i; |
| 534 | | int clipped_verts; |
| 535 | | VERTEX verts[10]; |
| 536 | | PLANE clip_plane = { 0.0f, 0.0f, 1.0f, -1.0f }; |
| 537 | | clipped_verts = clip_polygon(tri->v, 3, clip_plane, verts); |
| 1391 | /* calculate the dot product of the normal and the point */ |
| 1392 | dotp = dot_product( &normal, &point ); |
| 538 | 1393 | |
| 539 | | project_point( &verts[0] ); |
| 540 | | project_point( &verts[1] ); |
| 541 | | for (i=2; i < clipped_verts; i++) |
| 542 | | { |
| 543 | | TRIANGLE *dt = &tribuffer[tribuffer_pos]; |
| 1394 | /* apply focus */ |
| 1395 | point.x *= geo.focus.x; |
| 1396 | point.y *= geo.focus.y; |
| 544 | 1397 | |
| 545 | | project_point( &verts[i] ); |
| 1398 | /* determine wether this is the front or the back of the polygon */ |
| 1399 | face = 0x100; /* rear */ |
| 1400 | if ( dotp >= 0 ) face = 0; /* front */ |
| 546 | 1401 | |
| 547 | | memcpy(dt, tri, sizeof(TRIANGLE)); |
| 1402 | /* get the texture parameters */ |
| 1403 | texparam = &geo.texture_parameters[(attr>>18) & 0x1f]; |
| 548 | 1404 | |
| 549 | | memcpy(&dt->v[0], &verts[0], sizeof(VERTEX)); |
| 550 | | memcpy(&dt->v[1], &verts[i-1], sizeof(VERTEX)); |
| 551 | | memcpy(&dt->v[2], &verts[i], sizeof(VERTEX)); |
| 552 | | memcpy(&dt->window, &window, sizeof(WINDOW)); |
| 1405 | /* calculate luminance */ |
| 1406 | if ( (dotl * dotp) < 0 ) luminance = 0; |
| 1407 | else luminance = fabs( dotl ); |
| 553 | 1408 | |
| 554 | | tribuffer_pos++; |
| 555 | | if (tribuffer_pos >= TRIBUFFER_SIZE) |
| 1409 | luminance = (luminance * texparam->diffuse) + texparam->ambient; |
| 1410 | luma = (INT32)luminance; |
| 1411 | |
| 1412 | if ( luma > 255 ) luma = 255; |
| 1413 | if ( luma < 0 ) luma = 0; |
| 1414 | |
| 1415 | /* add the face bit to the luma */ |
| 1416 | luma += face; |
| 1417 | |
| 1418 | /* extract distance coefficient */ |
| 1419 | coef = geo.coef_table[attr>>27]; |
| 1420 | |
| 1421 | /* calculate texture level of detail */ |
| 1422 | distance = coef * fabs( dotp ) * geo.lod; |
| 1423 | |
| 1424 | /* push to the 3d rasterizer */ |
| 1425 | model2_3d_push( luma << 15 ); |
| 1426 | model2_3d_push( f2u(distance) >> 8 ); |
| 1427 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1428 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1429 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1430 | |
| 1431 | /* if it's a quad, push one more point */ |
| 1432 | if ( attr & 1 ) |
| 1433 | { |
| 1434 | /* read in the next point */ |
| 1435 | point.x = u2f( *input++ ); |
| 1436 | point.y = u2f( *input++ ); |
| 1437 | point.z = u2f( *input++ ); |
| 1438 | |
| 1439 | /* transform with the current matrix */ |
| 1440 | transform_point( &point, geo.matrix ); |
| 1441 | |
| 1442 | /* apply focus */ |
| 1443 | point.x *= geo.focus.x; |
| 1444 | point.y *= geo.focus.y; |
| 1445 | |
| 1446 | /* push to the 3d rasterizer */ |
| 1447 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1448 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1449 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1450 | } |
| 1451 | else /* triangle */ |
| 1452 | { |
| 1453 | /* skip the next 3 points */ |
| 1454 | input += 3; |
| 1455 | } |
| 1456 | } |
| 1457 | else /* we're done */ |
| 556 | 1458 | { |
| 557 | | fatalerror("push_triangle: tribuffer overflow"); |
| 1459 | break; |
| 558 | 1460 | } |
| 559 | 1461 | } |
| 560 | | } |
| 561 | 1462 | |
| 562 | | static void push_direct_triangle(TRIANGLE *tri) |
| 563 | | { |
| 564 | | TRIANGLE *dt = &tribuffer[tribuffer_pos]; |
| 565 | | |
| 566 | | memcpy(dt, tri, sizeof(TRIANGLE)); |
| 567 | | memcpy(&dt->window, &window, sizeof(WINDOW)); |
| 1463 | /* notify the 3d rasterizer we're done */ |
| 1464 | model2_3d_push( 0 ); |
| 568 | 1465 | } |
| 569 | 1466 | |
| 570 | | static void draw_object(UINT32 address, UINT32 num_polys, UINT32 tex_point_addr, UINT32 tex_hdr_addr) |
| 1467 | /* Parse Polygons: Normals Present, Specular case */ |
| 1468 | static void geo_parse_np_s( UINT32 *input, UINT32 count ) |
| 571 | 1469 | { |
| 572 | | int i; |
| 573 | | VERTEX prev_p1 = { 0 }, prev_p2 = { 0 }; |
| 1470 | vertex point, normal; |
| 1471 | UINT32 attr, i; |
| 574 | 1472 | |
| 575 | | UINT16 *thdr; |
| 576 | | UINT16 *tpoint; |
| 577 | | UINT32 *object; |
| 1473 | /* read the 1st point */ |
| 1474 | point.x = u2f( *input++ ); |
| 1475 | point.y = u2f( *input++ ); |
| 1476 | point.z = u2f( *input++ ); |
| 578 | 1477 | |
| 579 | | int th_addr = 0; |
| 580 | | int tp_addr = 0; |
| 581 | | float previous_zvalue = -12345.0f; |
| 1478 | /* transform with the current matrix */ |
| 1479 | transform_point( &point, geo.matrix ); |
| 582 | 1480 | |
| 583 | | (void)num_polys; |
| 1481 | /* apply focus */ |
| 1482 | point.x *= geo.focus.x; |
| 1483 | point.y *= geo.focus.y; |
| 584 | 1484 | |
| 585 | | if (address < 0x800000) |
| 586 | | { |
| 587 | | object = polygon_ram; |
| 588 | | address &= 0x7fff; |
| 589 | | } |
| 590 | | else |
| 591 | | { |
| 592 | | object = polygon_rom; |
| 593 | | address = address - 0x800000; |
| 594 | | } |
| 1485 | /* push it to the 3d rasterizer */ |
| 1486 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1487 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1488 | model2_3d_push( f2u(point.z) >> 8 ); |
| 595 | 1489 | |
| 596 | | if (tex_hdr_addr < 0x800000) |
| 597 | | { |
| 598 | | thdr = texture_rom; |
| 599 | | th_addr = tex_hdr_addr; |
| 600 | | } |
| 601 | | else |
| 602 | | { |
| 603 | | thdr = texture_ram; |
| 604 | | th_addr = tex_hdr_addr & 0xffff; |
| 605 | | } |
| 1490 | /* read the 2nd point */ |
| 1491 | point.x = u2f( *input++ ); |
| 1492 | point.y = u2f( *input++ ); |
| 1493 | point.z = u2f( *input++ ); |
| 606 | 1494 | |
| 607 | | if (tex_point_addr < 0x800000) |
| 608 | | { |
| 609 | | tpoint = texture_rom; |
| 610 | | tp_addr = tex_point_addr; |
| 611 | | } |
| 612 | | else |
| 613 | | { |
| 614 | | tpoint = texture_ram; |
| 615 | | tp_addr = tex_point_addr & 0xffff; |
| 616 | | } |
| 1495 | /* transform with the current matrix */ |
| 1496 | transform_point( &point, geo.matrix ); |
| 617 | 1497 | |
| 618 | | prev_p1.x = u2f(object[address++]); |
| 619 | | prev_p1.y = u2f(object[address++]); |
| 620 | | prev_p1.z = u2f(object[address++]); |
| 1498 | /* apply focus */ |
| 1499 | point.x *= geo.focus.x; |
| 1500 | point.y *= geo.focus.y; |
| 621 | 1501 | |
| 622 | | prev_p2.x = u2f(object[address++]); |
| 623 | | prev_p2.y = u2f(object[address++]); |
| 624 | | prev_p2.z = u2f(object[address++]); |
| 1502 | /* push it to the 3d rasterizer */ |
| 1503 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1504 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1505 | model2_3d_push( f2u(point.z) >> 8 ); |
| 625 | 1506 | |
| 626 | | while ( 1 ) |
| 1507 | /* loop through the following links */ |
| 1508 | for( i = 0; i < count; i++ ) |
| 627 | 1509 | { |
| 628 | | TEXTURE_PARAMETER *texparam; |
| 629 | | VERTEX v[4], p1, p2; |
| 630 | | float nx, ny, nz; |
| 631 | | UINT32 attr; |
| 632 | | UINT16 color, rgb; |
| 633 | | UINT16 tex_header[4]; |
| 634 | | UINT16 s[4], t[4]; |
| 635 | | int polytype, linktype, tex_hdr_offset, zsort_type, texture_code; |
| 1510 | /* read in the attributes */ |
| 1511 | attr = *input++; |
| 636 | 1512 | |
| 637 | | attr = object[address++]; |
| 638 | | polytype = attr & 0x3; |
| 1513 | /* push to the 3d rasterizer */ |
| 1514 | model2_3d_push( attr & 0x0003FFFF ); |
| 639 | 1515 | |
| 640 | | if ( polytype == 0 ) |
| 641 | | break; |
| 1516 | /* read in the normal */ |
| 1517 | normal.x = u2f(*input++); |
| 1518 | normal.y = u2f(*input++); |
| 1519 | normal.z = u2f(*input++); |
| 642 | 1520 | |
| 643 | | linktype = (attr >> 8) & 0x3; |
| 644 | | if (linktype != ((attr >> 23) & 0x3)) |
| 1521 | /* transform with the current matrix */ |
| 1522 | transform_vector( &normal, geo.matrix ); |
| 1523 | |
| 1524 | if ( (attr & 3) != 0 ) /* quad or triangle */ |
| 645 | 1525 | { |
| 646 | | //return; |
| 647 | | //fatalerror("Linktype not matching, attribute = %08X at %08X\n", attr, address*4); |
| 648 | | linktype = (attr >> 23) & 0x3; |
| 649 | | } |
| 1526 | float dotl, dotp, luminance, distance, specular; |
| 1527 | float coef, face; |
| 1528 | INT32 luma; |
| 1529 | texture_parameter * texparam; |
| 650 | 1530 | |
| 651 | | zsort_type = (attr >> 10) & 0x3; |
| 652 | | texture_code = (attr >> 12) & 0x1f; |
| 1531 | /* read in the next point */ |
| 1532 | point.x = u2f( *input++ ); |
| 1533 | point.y = u2f( *input++ ); |
| 1534 | point.z = u2f( *input++ ); |
| 653 | 1535 | |
| 654 | | texparam = &texture_parameter[texture_code]; |
| 1536 | /* transform with the current matrix */ |
| 1537 | transform_point( &point, geo.matrix ); |
| 655 | 1538 | |
| 656 | | // load vertex data and polygon normal |
| 657 | | nx = -(u2f(object[address++])); |
| 658 | | ny = -(u2f(object[address++])); |
| 659 | | nz = -(u2f(object[address++])); |
| 660 | | p1.x = u2f(object[address++]); |
| 661 | | p1.y = u2f(object[address++]); |
| 662 | | p1.z = u2f(object[address++]); |
| 663 | | p2.x = u2f(object[address++]); |
| 664 | | p2.y = u2f(object[address++]); |
| 665 | | p2.z = u2f(object[address++]); |
| 1539 | /* calculate the dot product of the normal and the light vector */ |
| 1540 | dotl = dot_product( &normal, &geo.light ); |
| 666 | 1541 | |
| 1542 | /* calculate the dot product of the normal and the point */ |
| 1543 | dotp = dot_product( &normal, &point ); |
| 667 | 1544 | |
| 668 | | // load texture parameters |
| 669 | | tex_header[0] = thdr[th_addr+0]; |
| 670 | | tex_header[1] = thdr[th_addr+1]; |
| 671 | | tex_header[2] = thdr[th_addr+2]; |
| 672 | | tex_header[3] = thdr[th_addr+3]; |
| 1545 | /* apply focus */ |
| 1546 | point.x *= geo.focus.x; |
| 1547 | point.y *= geo.focus.y; |
| 673 | 1548 | |
| 674 | | color = (tex_header[3] >> 6) & 0x3ff; |
| 1549 | /* determine wether this is the front or the back of the polygon */ |
| 1550 | face = 0x100; /* rear */ |
| 1551 | if ( dotp >= 0 ) face = 0; /* front */ |
| 675 | 1552 | |
| 676 | | // lookup color in palette ram |
| 677 | | // we need the original 15 bit color, not the remapped 32 bit version |
| 678 | | { |
| 679 | | UINT32 pval = paletteram32[(0x2000/4)+(color >> 1)]; |
| 1553 | /* get the texture parameters */ |
| 1554 | texparam = &geo.texture_parameters[(attr>>18) & 0x1f]; |
| 680 | 1555 | |
| 681 | | if ( color & 1 ) |
| 682 | | rgb = (pval >> 16); |
| 683 | | else |
| 684 | | rgb = pval; |
| 685 | | } |
| 1556 | /* calculate luminance and specular */ |
| 1557 | if ( (dotl * dotp) < 0 ) luminance = 0; |
| 1558 | else luminance = fabs( dotl ); |
| 686 | 1559 | |
| 687 | | rgb &= 0x7fff; |
| 1560 | specular = ((2*dotl) * normal.z) - geo.light.z; |
| 1561 | if ( specular < 0 ) specular = 0; |
| 1562 | if ( texparam->specular_control == 0 ) specular = 0; |
| 1563 | if ( (texparam->specular_control >> 1) != 0 ) specular *= specular; |
| 1564 | if ( (texparam->specular_control >> 2) != 0 ) specular *= specular; |
| 1565 | if ( ((texparam->specular_control+1) >> 3) != 0 ) specular *= specular; |
| 688 | 1566 | |
| 689 | | tex_hdr_offset = (attr >> 12) & 0x1f; |
| 1567 | specular *= texparam->specular_scale; |
| 690 | 1568 | |
| 691 | | if (tex_hdr_offset & 0x10) |
| 692 | | tex_hdr_offset |= -16; |
| 1569 | luminance = (luminance * texparam->diffuse) + texparam->ambient + specular; |
| 1570 | luma = (INT32)luminance; |
| 693 | 1571 | |
| 694 | | th_addr += tex_hdr_offset * 4; |
| 1572 | if ( luma > 255 ) luma = 255; |
| 1573 | if ( luma < 0 ) luma = 0; |
| 695 | 1574 | |
| 696 | | // load texture coordinates |
| 697 | | if (polytype == 2) |
| 698 | | { |
| 699 | | t[0] = tpoint[tp_addr+0]; |
| 700 | | s[0] = tpoint[tp_addr+1]; |
| 701 | | t[1] = tpoint[tp_addr+2]; |
| 702 | | s[1] = tpoint[tp_addr+3]; |
| 703 | | t[2] = tpoint[tp_addr+4]; |
| 704 | | s[2] = tpoint[tp_addr+5]; |
| 705 | | t[3] = 0; /* unused */ |
| 706 | | s[3] = 0; /* unused */ |
| 707 | | tp_addr += 6; |
| 708 | | } |
| 709 | | else |
| 710 | | { |
| 711 | | t[0] = tpoint[tp_addr+0]; |
| 712 | | s[0] = tpoint[tp_addr+1]; |
| 713 | | t[1] = tpoint[tp_addr+2]; |
| 714 | | s[1] = tpoint[tp_addr+3]; |
| 715 | | t[2] = tpoint[tp_addr+4]; |
| 716 | | s[2] = tpoint[tp_addr+5]; |
| 717 | | t[3] = tpoint[tp_addr+6]; |
| 718 | | s[3] = tpoint[tp_addr+7]; |
| 719 | | tp_addr += 8; |
| 720 | | } |
| 1575 | /* add the face bit to the luma */ |
| 1576 | luma += face; |
| 721 | 1577 | |
| 722 | | // transform and normalize the normal |
| 723 | | { |
| 724 | | float tx = (nx * matrix[0]) + (ny * matrix[3]) + (nz * matrix[6]); |
| 725 | | float ty = (nx * matrix[1]) + (ny * matrix[4]) + (nz * matrix[7]); |
| 726 | | float tz = (nx * matrix[2]) + (ny * matrix[5]) + (nz * matrix[8]); |
| 727 | | float norm = sqrt( tx*tx + ty*ty + tz*tz ); |
| 728 | | if ( norm ) |
| 1578 | /* extract distance coefficient */ |
| 1579 | coef = geo.coef_table[attr>>27]; |
| 1580 | |
| 1581 | /* calculate texture level of detail */ |
| 1582 | distance = coef * fabs( dotp ) * geo.lod; |
| 1583 | |
| 1584 | /* push to the 3d rasterizer */ |
| 1585 | model2_3d_push( luma << 15 ); |
| 1586 | model2_3d_push( f2u(distance) >> 8 ); |
| 1587 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1588 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1589 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1590 | |
| 1591 | /* if it's a quad, push one more point */ |
| 1592 | if ( attr & 1 ) |
| 729 | 1593 | { |
| 730 | | tx /= norm; |
| 731 | | ty /= norm; |
| 732 | | tz /= norm; |
| 1594 | /* read in the next point */ |
| 1595 | point.x = u2f( *input++ ); |
| 1596 | point.y = u2f( *input++ ); |
| 1597 | point.z = u2f( *input++ ); |
| 1598 | |
| 1599 | /* transform with the current matrix */ |
| 1600 | transform_point( &point, geo.matrix ); |
| 1601 | |
| 1602 | /* apply focus */ |
| 1603 | point.x *= geo.focus.x; |
| 1604 | point.y *= geo.focus.y; |
| 1605 | |
| 1606 | /* push to the 3d rasterizer */ |
| 1607 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1608 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1609 | model2_3d_push( f2u(point.z) >> 8 ); |
| 733 | 1610 | } |
| 734 | | nx = tx; |
| 735 | | ny = ty; |
| 736 | | nz = tz; |
| 1611 | else /* triangle */ |
| 1612 | { |
| 1613 | /* skip the next 3 points */ |
| 1614 | input += 3; |
| 1615 | } |
| 737 | 1616 | } |
| 1617 | else /* we're done */ |
| 1618 | { |
| 1619 | break; |
| 1620 | } |
| 1621 | } |
| 738 | 1622 | |
| 739 | | // transform and push the polygon to render buffer |
| 1623 | /* notify the 3d rasterizer we're done */ |
| 1624 | model2_3d_push( 0 ); |
| 1625 | } |
| 1626 | |
| 1627 | /* Parse Polygons: No Normals, No Specular case */ |
| 1628 | static void geo_parse_nn_ns( UINT32 *input, UINT32 count ) |
| 1629 | { |
| 1630 | vertex point, normal, p0, p1, p2, p3; |
| 1631 | UINT32 attr, i; |
| 1632 | |
| 1633 | /* read the 1st point */ |
| 1634 | point.x = u2f( *input++ ); |
| 1635 | point.y = u2f( *input++ ); |
| 1636 | point.z = u2f( *input++ ); |
| 1637 | |
| 1638 | /* transform with the current matrix */ |
| 1639 | transform_point( &point, geo.matrix ); |
| 1640 | |
| 1641 | /* save for normal calculation */ |
| 1642 | p0.x = point.x; p0.y = point.y; p0.z = point.z; |
| 1643 | |
| 1644 | /* apply focus */ |
| 1645 | point.x *= geo.focus.x; |
| 1646 | point.y *= geo.focus.y; |
| 1647 | |
| 1648 | /* push it to the 3d rasterizer */ |
| 1649 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1650 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1651 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1652 | |
| 1653 | /* read the 2nd point */ |
| 1654 | point.x = u2f( *input++ ); |
| 1655 | point.y = u2f( *input++ ); |
| 1656 | point.z = u2f( *input++ ); |
| 1657 | |
| 1658 | /* transform with the current matrix */ |
| 1659 | transform_point( &point, geo.matrix ); |
| 1660 | |
| 1661 | /* save for normal calculation */ |
| 1662 | p1.x = point.x; p1.y = point.y; p1.z = point.z; |
| 1663 | |
| 1664 | /* apply focus */ |
| 1665 | point.x *= geo.focus.x; |
| 1666 | point.y *= geo.focus.y; |
| 1667 | |
| 1668 | /* push it to the 3d rasterizer */ |
| 1669 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1670 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1671 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1672 | |
| 1673 | /* skip 4 */ |
| 1674 | input += 4; |
| 1675 | |
| 1676 | /* loop through the following links */ |
| 1677 | for( i = 0; i < count; i++ ) |
| 1678 | { |
| 1679 | /* read in the attributes */ |
| 1680 | attr = *input++; |
| 1681 | |
| 1682 | /* push to the 3d rasterizer */ |
| 1683 | model2_3d_push( attr & 0x0003FFFF ); |
| 1684 | |
| 1685 | if ( (attr & 3) != 0 ) /* quad or triangle */ |
| 740 | 1686 | { |
| 1687 | float dotl, dotp, luminance, distance; |
| 1688 | float coef, face; |
| 1689 | INT32 luma; |
| 1690 | texture_parameter * texparam; |
| 741 | 1691 | |
| 742 | | float dot, intensity; |
| 743 | | float zvalue; |
| 744 | | TRIANGLE tri1, tri2; |
| 745 | | v[0].x = prev_p2.x; v[0].y = prev_p2.y; v[0].z = prev_p2.z; v[0].u = s[0]; v[0].v = t[0]; |
| 746 | | v[1].x = prev_p1.x; v[1].y = prev_p1.y; v[1].z = prev_p1.z; v[1].u = s[1]; v[1].v = t[1]; |
| 747 | | v[2].x = p1.x; v[2].y = p1.y; v[2].z = p1.z; v[2].u = s[2]; v[2].v = t[2]; |
| 748 | | v[3].x = p2.x; v[3].y = p2.y; v[3].z = p2.z; v[3].u = s[3]; v[3].v = t[3]; |
| 1692 | /* read in the next point */ |
| 1693 | point.x = u2f( *input++ ); |
| 1694 | point.y = u2f( *input++ ); |
| 1695 | point.z = u2f( *input++ ); |
| 749 | 1696 | |
| 750 | | // transform with the current matrix |
| 751 | | for ( i = 0; i < 4; i++) |
| 752 | | { |
| 753 | | float tx = (v[i].x * matrix[0]) + (v[i].y * matrix[3]) + (v[i].z * matrix[6]) + (matrix[9]); |
| 754 | | float ty = (v[i].x * matrix[1]) + (v[i].y * matrix[4]) + (v[i].z * matrix[7]) + (matrix[10]); |
| 755 | | float tz = (v[i].x * matrix[2]) + (v[i].y * matrix[5]) + (v[i].z * matrix[8]) + (matrix[11]); |
| 756 | | v[i].x = tx; |
| 757 | | v[i].y = ty; |
| 758 | | v[i].z = tz; |
| 759 | | } |
| 1697 | /* transform with the current matrix */ |
| 1698 | transform_point( &point, geo.matrix ); |
| 760 | 1699 | |
| 761 | | dot = -( (light_vector[0] * nx) + (light_vector[1] * ny) + (light_vector[2] * nz) ); |
| 1700 | /* save for normal calculation */ |
| 1701 | p2.x = point.x; p2.y = point.y; p2.z = point.z; |
| 762 | 1702 | |
| 763 | | if (dot < 0.0f) |
| 764 | | dot = 0.0f; |
| 765 | | if (dot > 1.0f) |
| 766 | | dot = 1.0f; |
| 1703 | /* compute the normal */ |
| 1704 | vector_cross3( &normal, &p0, &p1, &p2 ); |
| 767 | 1705 | |
| 768 | | intensity = (dot * (float)texparam->diffuse); |
| 769 | | intensity += (float)texparam->ambient; |
| 1706 | /* normalize it */ |
| 1707 | normalize_vector( &normal ); |
| 770 | 1708 | |
| 771 | | if (intensity < 0) |
| 772 | | intensity = 0; |
| 773 | | if (intensity > 255.0f) |
| 774 | | intensity = 255.0f; |
| 1709 | /* calculate the dot product of the normal and the light vector */ |
| 1710 | dotl = dot_product( &normal, &geo.light ); |
| 775 | 1711 | |
| 776 | | memcpy(&tri1.v[0], &v[0], sizeof(VERTEX)); |
| 777 | | memcpy(&tri1.v[1], &v[1], sizeof(VERTEX)); |
| 778 | | memcpy(&tri1.v[2], &v[2], sizeof(VERTEX)); |
| 1712 | /* calculate the dot product of the normal and the point */ |
| 1713 | dotp = dot_product( &normal, &point ); |
| 779 | 1714 | |
| 780 | | memcpy(&tri2.v[0], &v[2], sizeof(VERTEX)); |
| 781 | | memcpy(&tri2.v[1], &v[3], sizeof(VERTEX)); |
| 782 | | memcpy(&tri2.v[2], &v[0], sizeof(VERTEX)); |
| 1715 | /* apply focus */ |
| 1716 | point.x *= geo.focus.x; |
| 1717 | point.y *= geo.focus.y; |
| 783 | 1718 | |
| 784 | | switch (zsort_type) |
| 785 | | { |
| 786 | | case 0: // Previous value |
| 787 | | { |
| 788 | | zvalue = previous_zvalue; |
| 789 | | break; |
| 790 | | } |
| 791 | | case 1: // Min value |
| 792 | | { |
| 793 | | zvalue = v[0].z; |
| 794 | | zvalue = MIN(zvalue, v[1].z); |
| 795 | | zvalue = MIN(zvalue, v[2].z); |
| 796 | | zvalue = MIN(zvalue, v[3].z); |
| 797 | | break; |
| 798 | | } |
| 799 | | case 2: // Max value |
| 800 | | { |
| 801 | | zvalue = v[0].z; |
| 802 | | zvalue = MAX(zvalue, v[1].z); |
| 803 | | zvalue = MAX(zvalue, v[2].z); |
| 804 | | zvalue = MAX(zvalue, v[3].z); |
| 805 | | break; |
| 806 | | } |
| 807 | | default: mame_printf_error("draw_object: unknown zsort mode %d!\n", zsort_type); |
| 808 | | zvalue = /* previous_zvalue */0.0; /* complete hack */ |
| 809 | | break; |
| 810 | | } |
| 1719 | /* determine wether this is the front or the back of the polygon */ |
| 1720 | face = 0x100; /* rear */ |
| 1721 | if ( dotp >= 0 ) face = 0; /* front */ |
| 811 | 1722 | |
| 812 | | previous_zvalue = zvalue; |
| 1723 | /* get the texture parameters */ |
| 1724 | texparam = &geo.texture_parameters[(attr>>18) & 0x1f]; |
| 813 | 1725 | |
| 814 | | if (polytype == 2) |
| 815 | | memcpy(&p2, &p1, sizeof(VERTEX)); |
| 1726 | /* calculate luminance */ |
| 1727 | if ( (dotl * dotp) < 0 ) luminance = 0; |
| 1728 | else luminance = fabs( dotl ); |
| 816 | 1729 | |
| 817 | | if (linktype != 0) |
| 1730 | luminance = (luminance * texparam->diffuse) + texparam->ambient; |
| 1731 | luma = (INT32)luminance; |
| 1732 | |
| 1733 | if ( luma > 255 ) luma = 255; |
| 1734 | if ( luma < 0 ) luma = 0; |
| 1735 | |
| 1736 | /* add the face bit to the luma */ |
| 1737 | luma += face; |
| 1738 | |
| 1739 | /* extract distance coefficient */ |
| 1740 | coef = geo.coef_table[attr>>27]; |
| 1741 | |
| 1742 | /* calculate texture level of detail */ |
| 1743 | distance = coef * fabs( dotp ) * geo.lod; |
| 1744 | |
| 1745 | /* push to the 3d rasterizer */ |
| 1746 | model2_3d_push( luma << 15 ); |
| 1747 | model2_3d_push( f2u(distance) >> 8 ); |
| 1748 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1749 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1750 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1751 | |
| 1752 | /* if it's a quad, push one more point */ |
| 1753 | if ( attr & 1 ) |
| 818 | 1754 | { |
| 819 | | tri1.flags = 0; |
| 820 | | if (tex_header[0] & 0x8000) tri1.flags |= TRI_FLAG_CHECKER; |
| 821 | | if (tex_header[0] & 0x4000) tri1.flags |= TRI_FLAG_TEXTURE; |
| 822 | | if (tex_header[0] & 0x2000) tri1.flags |= TRI_FLAG_TEXTURE_TRANS; |
| 823 | | if (tex_header[0] & 0x1000) tri1.flags |= TRI_FLAG_MICROTEX; |
| 824 | | if (tex_header[0] & 0x0200) tri1.flags |= TRI_FLAG_MIRROR_X; |
| 825 | | if (tex_header[0] & 0x0100) tri1.flags |= TRI_FLAG_MIRROR_Y; |
| 826 | | if (tex_header[0] & 0x0080) tri1.flags |= TRI_FLAG_WRAP_X; |
| 827 | | if (tex_header[0] & 0x0040) tri1.flags |= TRI_FLAG_WRAP_Y; |
| 828 | | if (tex_header[2] & 0x1000) tri1.flags |= TRI_FLAG_EVEN_BANK; |
| 829 | | tri2.flags = tri1.flags; |
| 1755 | /* read in the next point */ |
| 1756 | point.x = u2f( *input++ ); |
| 1757 | point.y = u2f( *input++ ); |
| 1758 | point.z = u2f( *input++ ); |
| 830 | 1759 | |
| 831 | | tri1.tex_x = tri2.tex_x = (tex_header[2] >> 0) & 0x1f; |
| 832 | | tri1.tex_y = tri2.tex_y = (tex_header[2] >> 6) & 0x1f; |
| 1760 | /* transform with the current matrix */ |
| 1761 | transform_point( &point, geo.matrix ); |
| 833 | 1762 | |
| 834 | | if ( tex_header[2] & 0x20 ) |
| 835 | | { |
| 836 | | tri1.tex_y += 0x20; |
| 837 | | tri2.tex_y += 0x20; |
| 838 | | } |
| 1763 | /* save for normal calculation */ |
| 1764 | p3.x = point.x; p3.y = point.y; p3.z = point.z; |
| 839 | 1765 | |
| 840 | | tri1.tex_width = tri2.tex_width = (tex_header[0] >> 0) & 0x7; |
| 841 | | tri1.tex_height = tri2.tex_height = (tex_header[0] >> 3) & 0x7; |
| 842 | | tri1.luma_select = tri2.luma_select = tex_header[1] & 0xff; |
| 1766 | /* apply focus */ |
| 1767 | point.x *= geo.focus.x; |
| 1768 | point.y *= geo.focus.y; |
| 843 | 1769 | |
| 844 | | tri1.z = tri2.z = zvalue; |
| 845 | | tri1.r = tri2.r = (rgb >> 0) & 0x1f; |
| 846 | | tri1.g = tri2.g = (rgb >> 5) & 0x1f; |
| 847 | | tri1.b = tri2.b = (rgb >> 10) & 0x1f; |
| 848 | | tri1.luminance = tri2.luminance = (int)intensity; |
| 1770 | /* push to the 3d rasterizer */ |
| 1771 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1772 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1773 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1774 | } |
| 1775 | else |
| 1776 | { |
| 1777 | /* skip the next 3 points */ |
| 1778 | input += 3; |
| 849 | 1779 | |
| 850 | | if (polytype == 1) |
| 851 | | { |
| 852 | | push_triangle(&tri2); |
| 853 | | push_triangle(&tri1); |
| 854 | | } |
| 855 | | else |
| 856 | | { |
| 857 | | push_triangle(&tri1); |
| 858 | | } |
| 1780 | /* for triangles, the rope of P1(n) is achieved by P0(n-1) (linktype 3) */ |
| 1781 | p3.x = p2.x; p3.y = p2.y; p3.z = p2.z; |
| 859 | 1782 | } |
| 860 | 1783 | } |
| 1784 | else /* we're done */ |
| 1785 | { |
| 1786 | break; |
| 1787 | } |
| 861 | 1788 | |
| 862 | | switch (linktype) |
| 1789 | /* link type */ |
| 1790 | switch( (attr>>8) & 3 ) |
| 863 | 1791 | { |
| 864 | 1792 | case 0: |
| 865 | 1793 | case 2: |
| 866 | 1794 | { |
| 867 | | memcpy(&prev_p1, &p1, sizeof(VERTEX)); |
| 868 | | memcpy(&prev_p2, &p2, sizeof(VERTEX)); |
| 869 | | break; |
| 1795 | /* reuse P0(n) and P1(n) */ |
| 1796 | p0.x = p2.x; p0.y = p2.y; p0.z = p2.z; |
| 1797 | p1.x = p3.x; p1.y = p3.y; p1.z = p3.z; |
| 870 | 1798 | } |
| 1799 | break; |
| 871 | 1800 | |
| 872 | 1801 | case 1: |
| 873 | 1802 | { |
| 874 | | // prev P1 = prev P1 |
| 875 | | memcpy(&prev_p2, &p1, sizeof(VERTEX)); |
| 876 | | break; |
| 1803 | /* reuse P0(n-1) and P0(n) */ |
| 1804 | p1.x = p2.x; p1.y = p2.y; p1.z = p2.z; |
| 877 | 1805 | } |
| 1806 | break; |
| 878 | 1807 | |
| 879 | 1808 | case 3: |
| 880 | 1809 | { |
| 881 | | // prev P2 = prev P2 |
| 882 | | memcpy(&prev_p1, &p2, sizeof(VERTEX)); |
| 883 | | break; |
| 1810 | /* reuse P1(n-1) and P1(n) */ |
| 1811 | p0.x = p3.x; p0.y = p3.y; p0.z = p3.z; |
| 884 | 1812 | } |
| 1813 | break; |
| 885 | 1814 | } |
| 886 | 1815 | } |
| 1816 | |
| 1817 | /* notify the 3d rasterizer we're done */ |
| 1818 | model2_3d_push( 0 ); |
| 887 | 1819 | } |
| 888 | 1820 | |
| 889 | | static int draw_direct_data(UINT32 *mem) |
| 1821 | /* Parse Polygons: No Normals, Specular case */ |
| 1822 | static void geo_parse_nn_s( UINT32 *input, UINT32 count ) |
| 890 | 1823 | { |
| 891 | | int offset = 0; |
| 892 | | int end = 0; |
| 893 | | VERTEX prev_p1, prev_p2; |
| 894 | | UINT32 texture_point_address; |
| 895 | | UINT32 texture_header_address; |
| 1824 | vertex point, normal, p0, p1, p2, p3; |
| 1825 | UINT32 attr, i; |
| 896 | 1826 | |
| 897 | | texture_point_address = mem[offset++]; |
| 898 | | texture_header_address = mem[offset++]; |
| 899 | | prev_p1.x = u2f(mem[offset++]); |
| 900 | | prev_p1.y = u2f(mem[offset++]); |
| 901 | | prev_p1.z = u2f(mem[offset++]); |
| 902 | | prev_p2.x = u2f(mem[offset++]); |
| 903 | | prev_p2.y = u2f(mem[offset++]); |
| 904 | | prev_p2.z = u2f(mem[offset++]); |
| 1827 | /* read the 1st point */ |
| 1828 | point.x = u2f( *input++ ); |
| 1829 | point.y = u2f( *input++ ); |
| 1830 | point.z = u2f( *input++ ); |
| 905 | 1831 | |
| 906 | | while (!end) |
| 1832 | /* transform with the current matrix */ |
| 1833 | transform_point( &point, geo.matrix ); |
| 1834 | |
| 1835 | /* save for normal calculation */ |
| 1836 | p0.x = point.x; p0.y = point.y; p0.z = point.z; |
| 1837 | |
| 1838 | /* apply focus */ |
| 1839 | point.x *= geo.focus.x; |
| 1840 | point.y *= geo.focus.y; |
| 1841 | |
| 1842 | /* push it to the 3d rasterizer */ |
| 1843 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1844 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1845 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1846 | |
| 1847 | /* read the 2nd point */ |
| 1848 | point.x = u2f( *input++ ); |
| 1849 | point.y = u2f( *input++ ); |
| 1850 | point.z = u2f( *input++ ); |
| 1851 | |
| 1852 | /* transform with the current matrix */ |
| 1853 | transform_point( &point, geo.matrix ); |
| 1854 | |
| 1855 | /* save for normal calculation */ |
| 1856 | p1.x = point.x; p1.y = point.y; p1.z = point.z; |
| 1857 | |
| 1858 | /* apply focus */ |
| 1859 | point.x *= geo.focus.x; |
| 1860 | point.y *= geo.focus.y; |
| 1861 | |
| 1862 | /* push it to the 3d rasterizer */ |
| 1863 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1864 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1865 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1866 | |
| 1867 | /* skip 4 */ |
| 1868 | input += 4; |
| 1869 | |
| 1870 | /* loop through the following links */ |
| 1871 | for( i = 0; i < count; i++ ) |
| 907 | 1872 | { |
| 908 | | UINT32 luminance_data; |
| 909 | | float d; |
| 910 | | VERTEX p1, p2; |
| 911 | | UINT32 attr; |
| 912 | | int polytype, linktype; |
| 1873 | /* read in the attributes */ |
| 1874 | attr = *input++; |
| 913 | 1875 | |
| 914 | | attr = mem[offset++]; |
| 915 | | polytype = attr & 0x3; |
| 1876 | /* push to the 3d rasterizer */ |
| 1877 | model2_3d_push( attr & 0x0003FFFF ); |
| 916 | 1878 | |
| 917 | | if (polytype == 0) |
| 1879 | if ( (attr & 3) != 0 ) /* quad or triangle */ |
| 918 | 1880 | { |
| 919 | | return offset; |
| 920 | | } |
| 1881 | float dotl, dotp, luminance, distance, specular; |
| 1882 | float coef, face; |
| 1883 | INT32 luma; |
| 1884 | texture_parameter * texparam; |
| 921 | 1885 | |
| 922 | | linktype = (attr >> 8) & 0x3; |
| 923 | | if (linktype != ((attr >> 23) & 0x3)) |
| 924 | | { |
| 925 | | //return; |
| 926 | | fatalerror("draw_direct_data: Linktype not matching, attribute = %08X\n", attr); |
| 927 | | } |
| 1886 | /* read in the next point */ |
| 1887 | point.x = u2f( *input++ ); |
| 1888 | point.y = u2f( *input++ ); |
| 1889 | point.z = u2f( *input++ ); |
| 928 | 1890 | |
| 929 | | luminance_data = mem[offset++]; |
| 930 | | d = u2f(mem[offset++]); |
| 931 | | p1.x = u2f(mem[offset++]); |
| 932 | | p1.y = u2f(mem[offset++]); |
| 933 | | p1.z = u2f(mem[offset++]); |
| 934 | | p2.x = u2f(mem[offset++]); |
| 935 | | p2.y = u2f(mem[offset++]); |
| 936 | | p2.z = u2f(mem[offset++]); |
| 1891 | /* transform with the current matrix */ |
| 1892 | transform_point( &point, geo.matrix ); |
| 937 | 1893 | |
| 938 | | if (linktype != 0) |
| 939 | | { |
| 940 | | TRIANGLE tri1, tri2; |
| 941 | | tri1.v[0].x = p1.x; tri1.v[0].y = p1.y; tri1.v[0].z = p1.z; |
| 942 | | tri1.v[1].x = p2.x; tri1.v[1].y = p2.y; tri1.v[1].z = p2.z; |
| 943 | | tri1.v[2].x = prev_p1.x; tri1.v[2].y = prev_p1.y; tri1.v[2].z = prev_p1.z; |
| 944 | | tri2.v[0].x = p2.x; tri2.v[0].y = p2.y; tri2.v[0].z = p2.z; |
| 945 | | tri2.v[1].x = prev_p1.x; tri2.v[1].y = prev_p1.y; tri2.v[1].z = prev_p1.z; |
| 946 | | tri2.v[2].x = prev_p2.x; tri2.v[2].y = prev_p2.y; tri2.v[2].z = prev_p2.z; |
| 1894 | /* save for normal calculation */ |
| 1895 | p2.x = point.x; p2.y = point.y; p2.z = point.z; |
| 947 | 1896 | |
| 948 | | if (polytype == 1) |
| 1897 | /* compute the normal */ |
| 1898 | vector_cross3( &normal, &p0, &p1, &p2 ); |
| 1899 | |
| 1900 | /* normalize it */ |
| 1901 | normalize_vector( &normal ); |
| 1902 | |
| 1903 | /* calculate the dot product of the normal and the light vector */ |
| 1904 | dotl = dot_product( &normal, &geo.light ); |
| 1905 | |
| 1906 | /* calculate the dot product of the normal and the point */ |
| 1907 | dotp = dot_product( &normal, &point ); |
| 1908 | |
| 1909 | /* apply focus */ |
| 1910 | point.x *= geo.focus.x; |
| 1911 | point.y *= geo.focus.y; |
| 1912 | |
| 1913 | /* determine wether this is the front or the back of the polygon */ |
| 1914 | face = 0x100; /* rear */ |
| 1915 | if ( dotp >= 0 ) face = 0; /* front */ |
| 1916 | |
| 1917 | /* get the texture parameters */ |
| 1918 | texparam = &geo.texture_parameters[(attr>>18) & 0x1f]; |
| 1919 | |
| 1920 | /* calculate luminance and specular */ |
| 1921 | if ( (dotl * dotp) < 0 ) luminance = 0; |
| 1922 | else luminance = fabs( dotl ); |
| 1923 | |
| 1924 | specular = ((2*dotl) * normal.z) - geo.light.z; |
| 1925 | if ( specular < 0 ) specular = 0; |
| 1926 | if ( texparam->specular_control == 0 ) specular = 0; |
| 1927 | if ( (texparam->specular_control >> 1) != 0 ) specular *= specular; |
| 1928 | if ( (texparam->specular_control >> 2) != 0 ) specular *= specular; |
| 1929 | if ( ((texparam->specular_control+1) >> 3) != 0 ) specular *= specular; |
| 1930 | |
| 1931 | specular *= texparam->specular_scale; |
| 1932 | |
| 1933 | luminance = (luminance * texparam->diffuse) + texparam->ambient + specular; |
| 1934 | luma = (INT32)luminance; |
| 1935 | |
| 1936 | if ( luma > 255 ) luma = 255; |
| 1937 | if ( luma < 0 ) luma = 0; |
| 1938 | |
| 1939 | /* add the face bit to the luma */ |
| 1940 | luma += face; |
| 1941 | |
| 1942 | /* extract distance coefficient */ |
| 1943 | coef = geo.coef_table[attr>>27]; |
| 1944 | |
| 1945 | /* calculate texture level of detail */ |
| 1946 | distance = coef * fabs( dotp ) * geo.lod; |
| 1947 | |
| 1948 | /* push to the 3d rasterizer */ |
| 1949 | model2_3d_push( luma << 15 ); |
| 1950 | model2_3d_push( f2u(distance) >> 8 ); |
| 1951 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1952 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1953 | model2_3d_push( f2u(point.z) >> 8 ); |
| 1954 | |
| 1955 | /* if it's a quad, push one more point */ |
| 1956 | if ( attr & 1 ) |
| 949 | 1957 | { |
| 950 | | push_direct_triangle(&tri1); |
| 951 | | push_direct_triangle(&tri2); |
| 1958 | /* read in the next point */ |
| 1959 | point.x = u2f( *input++ ); |
| 1960 | point.y = u2f( *input++ ); |
| 1961 | point.z = u2f( *input++ ); |
| 1962 | |
| 1963 | /* transform with the current matrix */ |
| 1964 | transform_point( &point, geo.matrix ); |
| 1965 | |
| 1966 | /* save for normal calculation */ |
| 1967 | p3.x = point.x; p3.y = point.y; p3.z = point.z; |
| 1968 | |
| 1969 | /* apply focus */ |
| 1970 | point.x *= geo.focus.x; |
| 1971 | point.y *= geo.focus.y; |
| 1972 | |
| 1973 | /* push to the 3d rasterizer */ |
| 1974 | model2_3d_push( f2u(point.x) >> 8 ); |
| 1975 | model2_3d_push( f2u(point.y) >> 8 ); |
| 1976 | model2_3d_push( f2u(point.z) >> 8 ); |
| 952 | 1977 | } |
| 953 | 1978 | else |
| 954 | 1979 | { |
| 955 | | push_direct_triangle(&tri1); |
| 1980 | /* skip the next 3 points */ |
| 1981 | input += 3; |
| 1982 | |
| 1983 | /* for triangles, the rope of P1(n) is achieved by P0(n-1) (linktype 3) */ |
| 1984 | p3.x = p2.x; p3.y = p2.y; p3.z = p2.z; |
| 956 | 1985 | } |
| 957 | 1986 | } |
| 1987 | else /* we're done */ |
| 1988 | { |
| 1989 | break; |
| 1990 | } |
| 958 | 1991 | |
| 959 | | switch (linktype) |
| 1992 | /* link type */ |
| 1993 | switch( (attr>>8) & 3 ) |
| 960 | 1994 | { |
| 961 | 1995 | case 0: |
| 962 | 1996 | case 2: |
| 963 | 1997 | { |
| 964 | | memcpy(&prev_p1, &p1, sizeof(VERTEX)); |
| 965 | | memcpy(&prev_p2, &p2, sizeof(VERTEX)); |
| 966 | | break; |
| 1998 | /* reuse P0(n) and P1(n) */ |
| 1999 | p0.x = p2.x; p0.y = p2.y; p0.z = p2.z; |
| 2000 | p1.x = p3.x; p1.y = p3.y; p1.z = p3.z; |
| 967 | 2001 | } |
| 2002 | break; |
| 968 | 2003 | |
| 969 | 2004 | case 1: |
| 970 | 2005 | { |
| 971 | | // prev P1 = prev P1 |
| 972 | | memcpy(&prev_p2, &p1, sizeof(VERTEX)); |
| 973 | | break; |
| 2006 | /* reuse P0(n-1) and P0(n) */ |
| 2007 | p1.x = p2.x; p1.y = p2.y; p1.z = p2.z; |
| 974 | 2008 | } |
| 2009 | break; |
| 975 | 2010 | |
| 976 | 2011 | case 3: |
| 977 | 2012 | { |
| 978 | | // prev P2 = prev P2 |
| 979 | | memcpy(&prev_p1, &p2, sizeof(VERTEX)); |
| 980 | | break; |
| 2013 | /* reuse P1(n-1) and P1(n) */ |
| 2014 | p0.x = p3.x; p0.y = p3.y; p0.z = p3.z; |
| 981 | 2015 | } |
| 2016 | break; |
| 982 | 2017 | } |
| 983 | 2018 | } |
| 984 | 2019 | |
| 985 | | return offset; |
| 2020 | /* notify the 3d rasterizer we're done */ |
| 2021 | model2_3d_push( 0 ); |
| 986 | 2022 | } |
| 987 | 2023 | |
| 988 | | static void parse_display_list(void) |
| 2024 | /******************************************* |
| 2025 | * |
| 2026 | * Geometry Engine Commands |
| 2027 | * |
| 2028 | *******************************************/ |
| 2029 | |
| 2030 | /* Command 00: NOP */ |
| 2031 | static UINT32 * geo_nop( UINT32 opcode, UINT32 *input ) |
| 989 | 2032 | { |
| 990 | | UINT32 address, length, tex_point_addr, tex_hdr_addr; |
| 991 | | int i; |
| 992 | | int end; |
| 993 | | int dlptr; |
| 2033 | /* push the opcode to the 3d rasterizer */ |
| 2034 | model2_3d_push( opcode >> 23 ); |
| 994 | 2035 | |
| 995 | | dlptr = geo_read_start_address / 4; |
| 2036 | return input; |
| 2037 | } |
| 996 | 2038 | |
| 997 | | end = 0; |
| 998 | | while (!end && dlptr < (0x20000/4)) |
| 2039 | /* Command 01: Object Data */ |
| 2040 | static UINT32 * geo_object_data( UINT32 opcode, UINT32 *input ) |
| 2041 | { |
| 2042 | UINT32 tpa = *input++; /* Texture Point Address */ |
| 2043 | UINT32 tha = *input++; /* Texture Header Address */ |
| 2044 | UINT32 oba = *input++; /* Object Address */ |
| 2045 | UINT32 obc = *input++; /* Object Count */ |
| 2046 | |
| 2047 | UINT32 *obp; /* Object Pointer */ |
| 2048 | |
| 2049 | /* push the initial set of data to the 3d rasterizer */ |
| 2050 | model2_3d_push( opcode >> 23 ); |
| 2051 | model2_3d_push( tpa ); |
| 2052 | model2_3d_push( tha ); |
| 2053 | |
| 2054 | /* select where we're reading polygon information from */ |
| 2055 | if ( oba & 0x01000000 ) |
| 999 | 2056 | { |
| 1000 | | UINT32 op = model2_bufferram[dlptr++]; |
| 1001 | | int cmd3 = (op >> 0) & 0xff; |
| 1002 | | int cmd2 = (op >> 8) & 0xff; |
| 1003 | | int cmd1 = (op >> 23) & 0xff; |
| 2057 | /* Fast polygon RAM */ |
| 2058 | obp = &geo.polygon_ram0[oba & 0x7FFF]; |
| 2059 | } |
| 2060 | else if ( oba & 0x00800000 ) |
| 2061 | { |
| 2062 | /* Polygon ROM */ |
| 2063 | obp = &geo.polygon_rom[oba & 0x7FFFFF]; |
| 2064 | } |
| 2065 | else |
| 2066 | { |
| 2067 | /* Slow Polygon RAM */ |
| 2068 | obp = &geo.polygon_ram1[oba & 0x7FFF]; |
| 2069 | } |
| 1004 | 2070 | |
| 1005 | | if (op & 0x80000000) |
| 2071 | switch( geo.mode & 3 ) |
| 2072 | { |
| 2073 | /* Normals present, No Specular */ |
| 2074 | case 0: geo_parse_np_ns( obp, obc ); break; |
| 2075 | |
| 2076 | /* Normals present, Specular */ |
| 2077 | case 1: geo_parse_np_s( obp, obc ); break; |
| 2078 | |
| 2079 | /* No Normals present, No Specular */ |
| 2080 | case 2: geo_parse_nn_ns( obp, obc ); break; |
| 2081 | |
| 2082 | /* No Normals present, Specular */ |
| 2083 | case 3: geo_parse_nn_s( obp, obc ); break; |
| 2084 | } |
| 2085 | |
| 2086 | /* move by 4 parameters */ |
| 2087 | return input; |
| 2088 | } |
| 2089 | |
| 2090 | /* Command 02: Direct Data */ |
| 2091 | static UINT32 * geo_direct_data( UINT32 opcode, UINT32 *input ) |
| 2092 | { |
| 2093 | UINT32 tpa = *input++; /* Texture Point Address */ |
| 2094 | UINT32 tha = *input++; /* Texture Header Address */ |
| 2095 | UINT32 attr; |
| 2096 | |
| 2097 | /* push the initial set of data to the 3d rasterizer */ |
| 2098 | model2_3d_push( (opcode >> 23) - 1 ); |
| 2099 | model2_3d_push( tpa ); |
| 2100 | model2_3d_push( tha ); |
| 2101 | |
| 2102 | /* push the initial points */ |
| 2103 | model2_3d_push( (*input++) >> 8 ); /* x */ |
| 2104 | model2_3d_push( (*input++) >> 8 ); /* y */ |
| 2105 | model2_3d_push( (*input++) >> 8 ); /* z */ |
| 2106 | |
| 2107 | model2_3d_push( (*input++) >> 8 ); /* x */ |
| 2108 | model2_3d_push( (*input++) >> 8 ); /* y */ |
| 2109 | model2_3d_push( (*input++) >> 8 ); /* z */ |
| 2110 | |
| 2111 | do |
| 2112 | { |
| 2113 | /* read in the attributes */ |
| 2114 | attr = *input++; |
| 2115 | |
| 2116 | if ( (attr & 3) == 0 ) |
| 2117 | break; |
| 2118 | |
| 2119 | /* push attributes */ |
| 2120 | model2_3d_push( attr & 0x00FFFFFF ); |
| 2121 | |
| 2122 | /* push luma */ |
| 2123 | model2_3d_push( (*input++) >> 8 ); |
| 2124 | |
| 2125 | /* push distance */ |
| 2126 | model2_3d_push( (*input++) >> 8 ); |
| 2127 | |
| 2128 | /* push the next point */ |
| 2129 | model2_3d_push( (*input++) >> 8 ); /* x */ |
| 2130 | model2_3d_push( (*input++) >> 8 ); /* y */ |
| 2131 | model2_3d_push( (*input++) >> 8 ); /* z */ |
| 2132 | |
| 2133 | /* if it's a quad, output another point */ |
| 2134 | if ( attr & 1 ) |
| 1006 | 2135 | { |
| 1007 | | // Jump command |
| 2136 | model2_3d_push( (*input++) >> 8 ); /* x */ |
| 2137 | model2_3d_push( (*input++) >> 8 ); /* y */ |
| 2138 | model2_3d_push( (*input++) >> 8 ); /* z */ |
| 1008 | 2139 | } |
| 1009 | | else |
| 2140 | } while( 1 ); |
| 2141 | |
| 2142 | /* we're done */ |
| 2143 | model2_3d_push( 0 ); |
| 2144 | |
| 2145 | return input; |
| 2146 | } |
| 2147 | |
| 2148 | /* Command 03: Window Data */ |
| 2149 | static UINT32 * geo_window_data( UINT32 opcode, UINT32 *input ) |
| 2150 | { |
| 2151 | UINT32 x, y, i; |
| 2152 | |
| 2153 | /* start by pushing the opcode */ |
| 2154 | model2_3d_push( opcode >> 23 ); |
| 2155 | |
| 2156 | /* |
| 2157 | we're going to move 6 coordinates to the 3d rasterizer: |
| 2158 | - starting coordinate |
| 2159 | - completion coordinate |
| 2160 | - vanishing point 0 (eye mode 0) |
| 2161 | - vanishing point 1 (eye mode 1) |
| 2162 | - vanishing point 2 (eye mode 2) |
| 2163 | - vanishing point 3 (eye mode 3) |
| 2164 | */ |
| 2165 | |
| 2166 | for( i = 0; i < 6; i++ ) |
| 2167 | { |
| 2168 | /* read in the coordinate */ |
| 2169 | y = *input++; |
| 2170 | |
| 2171 | /* convert to the 3d rasterizer format (00XXXYYY) */ |
| 2172 | x = ( y & 0x0FFF0000 ) >> 4 ; |
| 2173 | y &= 0xFFF; |
| 2174 | |
| 2175 | /* push it */ |
| 2176 | model2_3d_push( x | y ); |
| 2177 | } |
| 2178 | |
| 2179 | return input; |
| 2180 | } |
| 2181 | |
| 2182 | /* Command 04: Texture Data Write */ |
| 2183 | static UINT32 * geo_texture_data( UINT32 opcode, UINT32 *input ) |
| 2184 | { |
| 2185 | UINT32 i, count; |
| 2186 | |
| 2187 | /* start by pushing the opcode */ |
| 2188 | model2_3d_push( opcode >> 23 ); |
| 2189 | |
| 2190 | /* push the starting address/dsp id */ |
| 2191 | model2_3d_push( *input++ ); |
| 2192 | |
| 2193 | /* get the count */ |
| 2194 | count = *input++; |
| 2195 | |
| 2196 | /* push the count */ |
| 2197 | model2_3d_push( count ); |
| 2198 | |
| 2199 | /* loop and send the data */ |
| 2200 | for( i = 0; i < count; i++ ) |
| 2201 | model2_3d_push( *input++ ); |
| 2202 | |
| 2203 | return input; |
| 2204 | } |
| 2205 | |
| 2206 | /* Command 05: Polygon Data */ |
| 2207 | static UINT32 * geo_polygon_data( UINT32 opcode, UINT32 *input ) |
| 2208 | { |
| 2209 | UINT32 address, count, i; |
| 2210 | UINT32 *p; |
| 2211 | |
| 2212 | (void)opcode; |
| 2213 | |
| 2214 | /* read in the address */ |
| 2215 | address = *input++; |
| 2216 | |
| 2217 | /* prepare the pointer */ |
| 2218 | if ( address & 0x01000000 ) |
| 2219 | { |
| 2220 | /* Fast polygon RAM */ |
| 2221 | p = &geo.polygon_ram0[address & 0x7FFF]; |
| 2222 | } |
| 2223 | else |
| 2224 | { |
| 2225 | /* Slow Polygon RAM */ |
| 2226 | p = &geo.polygon_ram1[address & 0x7FFF]; |
| 2227 | } |
| 2228 | |
| 2229 | /* read the count */ |
| 2230 | count = *input++; |
| 2231 | |
| 2232 | /* move the data */ |
| 2233 | for( i = 0; i < count; i++ ) |
| 2234 | *p++ = *input++; |
| 2235 | |
| 2236 | return input; |
| 2237 | } |
| 2238 | |
| 2239 | /* Command 06: Texture Parameters */ |
| 2240 | static UINT32 * geo_texture_parameters( UINT32 opcode, UINT32 *input ) |
| 2241 | { |
| 2242 | UINT32 index, count, i, param; |
| 2243 | |
| 2244 | (void)opcode; |
| 2245 | |
| 2246 | /* read in the index */ |
| 2247 | index = *input++; |
| 2248 | |
| 2249 | /* read in the conut */ |
| 2250 | count = *input++; |
| 2251 | |
| 2252 | for( i = 0; i < count; i++ ) |
| 2253 | { |
| 2254 | /* read in the texture parameters */ |
| 2255 | param = *input++; |
| 2256 | |
| 2257 | geo.texture_parameters[index].diffuse = (float)( param & 0xFF ); |
| 2258 | geo.texture_parameters[index].ambient = (float)( (param >> 8) & 0xFF ); |
| 2259 | geo.texture_parameters[index].specular_control = (param >> 24) & 0xFF; |
| 2260 | geo.texture_parameters[index].specular_scale = (float)( (param >> 16) & 0xFF ); |
| 2261 | |
| 2262 | /* read in the distance coefficient */ |
| 2263 | geo.coef_table[index] = u2f(*input++); |
| 2264 | |
| 2265 | index = (index + 1) & 0x1F; |
| 2266 | } |
| 2267 | |
| 2268 | return input; |
| 2269 | } |
| 2270 | |
| 2271 | /* Command 07: Geo Mode */ |
| 2272 | static UINT32 * geo_mode( UINT32 opcode, UINT32 *input ) |
| 2273 | { |
| 2274 | (void)opcode; |
| 2275 | |
| 2276 | /* read in the mode */ |
| 2277 | geo.mode = *input++; |
| 2278 | |
| 2279 | return input; |
| 2280 | } |
| 2281 | |
| 2282 | /* Command 08: ZSort Mode */ |
| 2283 | static UINT32 * geo_zsort_mode( UINT32 opcode, UINT32 *input ) |
| 2284 | { |
| 2285 | /* push the opcode */ |
| 2286 | model2_3d_push( opcode >> 23 ); |
| 2287 | |
| 2288 | /* push the mode */ |
| 2289 | model2_3d_push( (*input++) >> 8 ); |
| 2290 | |
| 2291 | return input; |
| 2292 | } |
| 2293 | |
| 2294 | /* Command 09: Focal Distance */ |
| 2295 | static UINT32 * geo_focal_distance( UINT32 opcode, UINT32 *input ) |
| 2296 | { |
| 2297 | (void)opcode; |
| 2298 | |
| 2299 | /* read the x focus value */ |
| 2300 | geo.focus.x = u2f( *input++ ); |
| 2301 | |
| 2302 | /* read the y focus value */ |
| 2303 | geo.focus.y = u2f( *input++ ); |
| 2304 | |
| 2305 | return input; |
| 2306 | } |
| 2307 | |
| 2308 | /* Command 0A: Light Source Vector Write */ |
| 2309 | static UINT32 * geo_light_source( UINT32 opcode, UINT32 *input ) |
| 2310 | { |
| 2311 | (void)opcode; |
| 2312 | |
| 2313 | /* read the x light value */ |
| 2314 | geo.light.x = u2f( *input++ ); |
| 2315 | |
| 2316 | /* read the y light value */ |
| 2317 | geo.light.y = u2f( *input++ ); |
| 2318 | |
| 2319 | /* read the z light value */ |
| 2320 | geo.light.z = u2f( *input++ ); |
| 2321 | |
| 2322 | return input; |
| 2323 | } |
| 2324 | |
| 2325 | /* Command 0B: Transformation Matrix Write */ |
| 2326 | static UINT32 * geo_matrix_write( UINT32 opcode, UINT32 *input ) |
| 2327 | { |
| 2328 | UINT32 i; |
| 2329 | |
| 2330 | (void)opcode; |
| 2331 | |
| 2332 | /* read in the transformation matrix */ |
| 2333 | for( i = 0; i < 12; i++ ) |
| 2334 | geo.matrix[i] = u2f( *input++ ); |
| 2335 | |
| 2336 | return input; |
| 2337 | } |
| 2338 | |
| 2339 | /* Command 0C: Parallel Transfer Vector Write */ |
| 2340 | static UINT32 * geo_translate_write( UINT32 opcode, UINT32 *input ) |
| 2341 | { |
| 2342 | UINT32 i; |
| 2343 | |
| 2344 | (void)opcode; |
| 2345 | |
| 2346 | /* read in the translation vector */ |
| 2347 | for( i = 0; i < 3; i++ ) |
| 2348 | geo.matrix[i+9] = u2f( *input++ ); |
| 2349 | |
| 2350 | return input; |
| 2351 | } |
| 2352 | |
| 2353 | /* Command 0D: Geo Data Memory Push (undocumented, unsupported) */ |
| 2354 | static UINT32 * geo_data_mem_push( UINT32 opcode, UINT32 *input ) |
| 2355 | { |
| 2356 | UINT32 address, count, i; |
| 2357 | |
| 2358 | /* |
| 2359 | This command pushes data stored in the Geometry DSP's RAM |
| 2360 | to the hardware 3D rasterizer. Since we don't emulate the |
| 2361 | DSP, we don't know what the RAM contents are. |
| 2362 | |
| 2363 | Eventually, we could check for the address, and if it |
| 2364 | happens to point to a polygon ROM, we could potentially |
| 2365 | emulate it partially. |
| 2366 | |
| 2367 | No games are known to use this command yet. |
| 2368 | */ |
| 2369 | |
| 2370 | |
| 2371 | (void)opcode; |
| 2372 | |
| 2373 | /* read in the address */ |
| 2374 | address = *input++; |
| 2375 | |
| 2376 | /* read in the count */ |
| 2377 | count = *input++; |
| 2378 | |
| 2379 | logerror( "SEGA GEO: Executing unsupported geo_data_mem_push (address = %08x, count = %08x)\n", address, count ); |
| 2380 | |
| 2381 | (void)i; |
| 2382 | /* |
| 2383 | for( i = 0; i < count; i++ ) |
| 2384 | model2_3d_push( 0 ); |
| 2385 | */ |
| 2386 | |
| 2387 | return input; |
| 2388 | } |
| 2389 | |
| 2390 | /* Command 0E: Geo Test */ |
| 2391 | static UINT32 * geo_test( UINT32 opcode, UINT32 *input ) |
| 2392 | { |
| 2393 | UINT32 data, blocks, address, count, checksum, i; |
| 2394 | |
| 2395 | (void)opcode; |
| 2396 | |
| 2397 | /* fifo test */ |
| 2398 | data = 1; |
| 2399 | |
| 2400 | for( i = 0; i < 32; i++ ) |
| 2401 | { |
| 2402 | if ( *input++ != data ) |
| 1010 | 2403 | { |
| 1011 | | if (cmd2 != cmd1 || cmd3 != cmd1) |
| 1012 | | { |
| 1013 | | //mame_printf_debug("parse_display_list: CMD bits not matching: %08X at %08X\n", op, dlptr); |
| 1014 | | //return; |
| 1015 | | /*{ |
| 1016 | | int i; |
| 1017 | | FILE *file = fopen("buffer2.bin", "wb"); |
| 1018 | | for (i=0; i < 0x20000/4; i++) |
| 1019 | | { |
| 1020 | | fputc((model2_bufferram[i] >> 24) & 0xff, file); |
| 1021 | | fputc((model2_bufferram[i] >> 16) & 0xff, file); |
| 1022 | | fputc((model2_bufferram[i] >> 8) & 0xff, file); |
| 1023 | | fputc((model2_bufferram[i] >> 0) & 0xff, file); |
| 1024 | | } |
| 1025 | | fclose(file); |
| 1026 | | }*/ |
| 2404 | /* TODO: Set Red LED on */ |
| 2405 | logerror( "SEGA GEO: FIFO Test failed\n" ); |
| 2406 | } |
| 1027 | 2407 | |
| 1028 | | //fatalerror("parse_display_list: CMD bits not matching: %08X at %08X\n", op, dlptr*4); |
| 1029 | | } |
| 2408 | data <<= 1; |
| 2409 | } |
| 1030 | 2410 | |
| 1031 | | switch (cmd1) |
| 1032 | | { |
| 1033 | | case 0x00: // NOP |
| 1034 | | { |
| 1035 | | break; |
| 1036 | | } |
| 1037 | | case 0x01: // Object Data |
| 1038 | | { |
| 1039 | | tex_point_addr = model2_bufferram[dlptr+0] & 0xffffff; |
| 1040 | | tex_hdr_addr = model2_bufferram[dlptr+1] & 0xffffff; |
| 1041 | | address = model2_bufferram[dlptr+2]; |
| 1042 | | length = model2_bufferram[dlptr+3]; |
| 2411 | /* get the number of checksums we have to run */ |
| 2412 | blocks = *input++; |
| 1043 | 2413 | |
| 1044 | | if ( tex_point_addr != 0 || tex_hdr_addr != 0 || address != 0 || length != 0 ) |
| 1045 | | { |
| 1046 | | draw_object(address, length, tex_point_addr, tex_hdr_addr); |
| 1047 | | } |
| 2414 | for( i = 0; i < blocks; i++ ) |
| 2415 | { |
| 2416 | UINT32 sum_even, sum_odd, j; |
| 1048 | 2417 | |
| 1049 | | dlptr += 4; |
| 1050 | | break; |
| 1051 | | } |
| 1052 | | case 0x02: // Direct Data |
| 1053 | | { |
| 1054 | | length = draw_direct_data(&model2_bufferram[dlptr]); |
| 1055 | | dlptr += length; |
| 1056 | | break; |
| 1057 | | } |
| 1058 | | case 0x03: // Window Data |
| 1059 | | { |
| 1060 | | int x1 = (INT16)(model2_bufferram[dlptr+0] >> 16); |
| 1061 | | int y1 = (INT16)(model2_bufferram[dlptr+0] >> 0); |
| 1062 | | int x2 = (INT16)(model2_bufferram[dlptr+1] >> 16); |
| 1063 | | int y2 = (INT16)(model2_bufferram[dlptr+1] >> 0); |
| 2418 | /* read in the address */ |
| 2419 | address = (*input++) & 0x7FFFFF; |
| 1064 | 2420 | |
| 1065 | | window.x = x1; |
| 1066 | | window.y = 0; |
| 1067 | | window.width = x2 - x1; |
| 1068 | | window.height = y2 - y1; |
| 2421 | /* read in the count */ |
| 2422 | count = *input++; |
| 1069 | 2423 | |
| 1070 | | dlptr += 6; |
| 1071 | | break; |
| 1072 | | } |
| 1073 | | case 0x04: // Texture Data Write |
| 1074 | | { |
| 1075 | | address = model2_bufferram[dlptr++]; |
| 1076 | | length = model2_bufferram[dlptr++]; |
| 2424 | /* read in the checksum */ |
| 2425 | checksum = *input++; |
| 1077 | 2426 | |
| 1078 | | if ((address & 0x800000) == 0) |
| 1079 | | { |
| 1080 | | fatalerror("Trying to write log data at texture data write"); |
| 1081 | | } |
| 2427 | /* reset the checksum counters */ |
| 2428 | sum_even = 0; |
| 2429 | sum_odd = 0; |
| 1082 | 2430 | |
| 1083 | | address &= 0x7fffff; |
| 2431 | for( j = 0; j < count; j++ ) |
| 2432 | { |
| 2433 | data = geo.polygon_rom[address++]; |
| 1084 | 2434 | |
| 1085 | | for (i=0; i < length; i++) |
| 1086 | | { |
| 1087 | | texture_ram[address] = model2_bufferram[dlptr++]; |
| 1088 | | address++; |
| 1089 | | } |
| 1090 | | break; |
| 1091 | | } |
| 1092 | | case 0x05: // Object Data Write |
| 1093 | | { |
| 1094 | | address = model2_bufferram[dlptr++] & 0x7fff; |
| 1095 | | length = model2_bufferram[dlptr++] & 0xffff; |
| 2435 | address &= 0x7FFFFF; |
| 1096 | 2436 | |
| 1097 | | for (i=0; i < length; i++) |
| 1098 | | { |
| 1099 | | polygon_ram[address] = model2_bufferram[dlptr++]; |
| 1100 | | address++; |
| 1101 | | } |
| 1102 | | break; |
| 1103 | | } |
| 1104 | | case 0x06: // Texture Parameter Write |
| 1105 | | { |
| 1106 | | address = model2_bufferram[dlptr++]; |
| 1107 | | length = model2_bufferram[dlptr++]; |
| 2437 | sum_even += data >> 16; |
| 2438 | sum_even &= 0xFFFF; |
| 1108 | 2439 | |
| 1109 | | if (address > 0x1f) |
| 1110 | | { |
| 1111 | | mame_printf_debug("texture_parameter_write: address = %08X\n", address); |
| 1112 | | break; |
| 1113 | | } |
| 2440 | sum_odd += data & 0xFFFF; |
| 2441 | sum_odd &= 0xFFFF; |
| 2442 | } |
| 1114 | 2443 | |
| 1115 | | if (length > 0x20) |
| 1116 | | { |
| 1117 | | mame_printf_debug("texture_parameter_write: length = %08X\n", length); |
| 1118 | | break; |
| 1119 | | } |
| 2444 | sum_even += checksum >> 16; |
| 2445 | sum_even &= 0xFFFF; |
| 1120 | 2446 | |
| 1121 | | for (i=0; i < length; i++) |
| 1122 | | { |
| 1123 | | UINT32 data = model2_bufferram[dlptr++]; |
| 1124 | | texture_parameter[i].diffuse = (data >> 0) & 0xff; |
| 1125 | | texture_parameter[i].ambient = (data >> 8) & 0xff; |
| 1126 | | texture_parameter[i].reflection = (data >> 16) & 0xff; |
| 1127 | | texture_parameter[i].c = u2f(model2_bufferram[dlptr++]); |
| 1128 | | } |
| 1129 | | break; |
| 1130 | | } |
| 1131 | | case 0x07: // Operation Mode |
| 1132 | | { |
| 1133 | | geo_mode = model2_bufferram[dlptr]; |
| 1134 | | dlptr++; |
| 1135 | | break; |
| 1136 | | } |
| 1137 | | case 0x08: // Z-Sort Mode |
| 1138 | | { |
| 1139 | | dlptr++; |
| 1140 | | break; |
| 1141 | | } |
| 1142 | | case 0x09: // Focal Distance |
| 1143 | | { |
| 1144 | | focus_x = u2f(model2_bufferram[dlptr+0]); |
| 1145 | | focus_y = u2f(model2_bufferram[dlptr+1]); |
| 1146 | | dlptr += 2; |
| 1147 | | break; |
| 1148 | | } |
| 1149 | | case 0x0a: // Light Source Vector |
| 1150 | | { |
| 1151 | | float norm; |
| 2447 | sum_odd += checksum & 0xFFFF; |
| 2448 | sum_odd &= 0xFFFF; |
| 1152 | 2449 | |
| 1153 | | light_vector[0] = u2f(model2_bufferram[dlptr++]); |
| 1154 | | light_vector[1] = u2f(model2_bufferram[dlptr++]); |
| 1155 | | light_vector[2] = u2f(model2_bufferram[dlptr++]); |
| 2450 | if ( sum_even != 0 || sum_odd != 0 ) |
| 2451 | { |
| 2452 | /* TODO: Set Green LED on */ |
| 2453 | logerror( "SEGA GEO: Polygon ROM Test failed\n" ); |
| 2454 | } |
| 2455 | } |
| 1156 | 2456 | |
| 1157 | | norm = sqrt( light_vector[0]*light_vector[0] + light_vector[1]*light_vector[1] + light_vector[2]*light_vector[2] ); |
| 1158 | | if ( norm ) |
| 1159 | | { |
| 1160 | | light_vector[0] /= norm; |
| 1161 | | light_vector[1] /= norm; |
| 1162 | | light_vector[2] /= norm; |
| 1163 | | } |
| 2457 | return input; |
| 2458 | } |
| 1164 | 2459 | |
| 1165 | | break; |
| 1166 | | } |
| 1167 | | case 0x0b: // Matrix |
| 1168 | | { |
| 1169 | | matrix[ 0] = u2f(model2_bufferram[dlptr++]); |
| 1170 | | matrix[ 1] = u2f(model2_bufferram[dlptr++]); |
| 1171 | | matrix[ 2] = u2f(model2_bufferram[dlptr++]); |
| 1172 | | matrix[ 3] = u2f(model2_bufferram[dlptr++]); |
| 1173 | | matrix[ 4] = u2f(model2_bufferram[dlptr++]); |
| 1174 | | matrix[ 5] = u2f(model2_bufferram[dlptr++]); |
| 1175 | | matrix[ 6] = u2f(model2_bufferram[dlptr++]); |
| 1176 | | matrix[ 7] = u2f(model2_bufferram[dlptr++]); |
| 1177 | | matrix[ 8] = u2f(model2_bufferram[dlptr++]); |
| 1178 | | matrix[ 9] = u2f(model2_bufferram[dlptr++]); |
| 1179 | | matrix[10] = u2f(model2_bufferram[dlptr++]); |
| 1180 | | matrix[11] = u2f(model2_bufferram[dlptr++]); |
| 1181 | | break; |
| 1182 | | } |
| 1183 | | case 0x0c: // Parallel Transfer Vector |
| 1184 | | { |
| 1185 | | matrix[ 9] = u2f(model2_bufferram[dlptr++]); |
| 1186 | | matrix[10] = u2f(model2_bufferram[dlptr++]); |
| 1187 | | matrix[11] = u2f(model2_bufferram[dlptr++]); |
| 1188 | | break; |
| 1189 | | } |
| 1190 | | case 0x0e: // TGP Test |
| 1191 | | { |
| 1192 | | dlptr += 32; |
| 1193 | | length = model2_bufferram[dlptr++]; |
| 1194 | | dlptr += length; |
| 1195 | | break; |
| 1196 | | } |
| 1197 | | case 0x0f: // End |
| 1198 | | { |
| 1199 | | end = 1; |
| 1200 | | break; |
| 1201 | | } |
| 1202 | | case 0x10: // Dummy |
| 1203 | | { |
| 1204 | | dlptr++; |
| 1205 | | break; |
| 1206 | | } |
| 1207 | | case 0x14: // Log Data Write |
| 1208 | | { |
| 1209 | | dlptr++; |
| 1210 | | length = model2_bufferram[dlptr++]; |
| 1211 | | dlptr += length; |
| 1212 | | break; |
| 1213 | | } |
| 1214 | | case 0x16: // LOD |
| 1215 | | { |
| 1216 | | dlptr++; |
| 1217 | | break; |
| 1218 | | } |
| 1219 | | default: |
| 1220 | | { |
| 1221 | | /* |
| 1222 | | { |
| 1223 | | int i; |
| 1224 | | FILE *file = fopen("buffer2.bin", "wb"); |
| 1225 | | for (i=0; i < 0x20000/4; i++) |
| 1226 | | { |
| 1227 | | fputc((model2_bufferram[i] >> 24) & 0xff, file); |
| 1228 | | fputc((model2_bufferram[i] >> 16) & 0xff, file); |
| 1229 | | fputc((model2_bufferram[i] >> 8) & 0xff, file); |
| 1230 | | fputc((model2_bufferram[i] >> 0) & 0xff, file); |
| 1231 | | } |
| 1232 | | fclose(file); |
| 1233 | | } |
| 1234 | | fatalerror("parse_display_list: unknown command %02X (%08X) at %08X\n", cmd1, op, dlptr*4); |
| 1235 | | */ |
| 1236 | | } |
| 1237 | | } |
| 2460 | /* Command 0F: End */ |
| 2461 | static UINT32 * geo_end( UINT32 opcode, UINT32 *input ) |
| 2462 | { |
| 2463 | (void)opcode; |
| 2464 | |
| 2465 | /* signal the end of this data block the rasterizer */ |
| 2466 | model2_3d_push( 0xFF000000 ); |
| 2467 | |
| 2468 | /* signal end by returning NULL */ |
| 2469 | return NULL; |
| 2470 | } |
| 2471 | |
| 2472 | /* Command 10: Dummy */ |
| 2473 | static UINT32 * geo_dummy( UINT32 opcode, UINT32 *input ) |
| 2474 | { |
| 2475 | UINT32 data; |
| 2476 | (void)opcode; |
| 2477 | |
| 2478 | /* do the dummy read cycle */ |
| 2479 | data = *input++; |
| 2480 | |
| 2481 | return input; |
| 2482 | } |
| 2483 | |
| 2484 | /* Command 14: Log Data Write */ |
| 2485 | static UINT32 * geo_log_data( UINT32 opcode, UINT32 *input ) |
| 2486 | { |
| 2487 | UINT32 i, count; |
| 2488 | |
| 2489 | /* start by pushing the opcode */ |
| 2490 | model2_3d_push( opcode >> 23 ); |
| 2491 | |
| 2492 | /* push the starting address/dsp id */ |
| 2493 | model2_3d_push( *input++ ); |
| 2494 | |
| 2495 | /* get the count */ |
| 2496 | count = *input++; |
| 2497 | |
| 2498 | /* push the count */ |
| 2499 | model2_3d_push( count << 2 ); |
| 2500 | |
| 2501 | /* loop and send the data */ |
| 2502 | for( i = 0; i < count; i++ ) |
| 2503 | { |
| 2504 | UINT32 data = *input++; |
| 2505 | |
| 2506 | model2_3d_push( data & 0xff ); |
| 2507 | model2_3d_push( (data >> 8) & 0xff ); |
| 2508 | model2_3d_push( (data >> 16) & 0xff ); |
| 2509 | model2_3d_push( (data >> 24) & 0xff ); |
| 2510 | } |
| 2511 | |
| 2512 | return input; |
| 2513 | } |
| 2514 | |
| 2515 | /* Command 16: LOD */ |
| 2516 | static UINT32 * geo_lod( UINT32 opcode, UINT32 *input ) |
| 2517 | { |
| 2518 | (void)opcode; |
| 2519 | |
| 2520 | /* read in the LOD */ |
| 2521 | geo.lod = u2f(*input++); |
| 2522 | |
| 2523 | return input; |
| 2524 | } |
| 2525 | |
| 2526 | /* Command 1D: Code Upload (undocumented, unsupported) */ |
| 2527 | static UINT32 * geo_code_upload( UINT32 opcode, UINT32 *input ) |
| 2528 | { |
| 2529 | UINT32 flags, count, i; |
| 2530 | |
| 2531 | /* |
| 2532 | This command uploads code to program memory and |
| 2533 | optionally runs it. Probably used for debugging. |
| 2534 | |
| 2535 | No games are known to use this command yet. |
| 2536 | */ |
| 2537 | |
| 2538 | logerror( "SEGA GEO: Uploading debug code (unimplemented)\n" ); |
| 2539 | |
| 2540 | (void)opcode; |
| 2541 | |
| 2542 | /* read in the flags */ |
| 2543 | flags = *input++; |
| 2544 | |
| 2545 | /* read in the count */ |
| 2546 | count = *input++; |
| 2547 | |
| 2548 | for( i = 0; i < count; i++ ) |
| 2549 | { |
| 2550 | UINT64 code; |
| 2551 | |
| 2552 | /* read the top part of the opcode */ |
| 2553 | code = *input++; |
| 2554 | |
| 2555 | code <<= 32; |
| 2556 | |
| 2557 | /* the bottom part comes in two pieces */ |
| 2558 | code |= *input++; |
| 2559 | code |= (*input++) << 16; |
| 2560 | } |
| 2561 | |
| 2562 | /* |
| 2563 | Bit 10 of flags indicate wether to run iummediately after upload |
| 2564 | */ |
| 2565 | |
| 2566 | /* |
| 2567 | if ( flags & 0x400 ) |
| 2568 | code_jump(); |
| 2569 | */ |
| 2570 | |
| 2571 | return input; |
| 2572 | } |
| 2573 | |
| 2574 | /* Command 1E: Code Jump (undocumented, unsupported) */ |
| 2575 | static UINT32 * geo_code_jump( UINT32 opcode, UINT32 *input ) |
| 2576 | { |
| 2577 | UINT32 address; |
| 2578 | |
| 2579 | /* |
| 2580 | This command jumps to a specified address in program |
| 2581 | memory. Code can be uploaded with function 1D. |
| 2582 | Probably used for debugging. |
| 2583 | |
| 2584 | No games are known to use this command yet. |
| 2585 | */ |
| 2586 | |
| 2587 | logerror( "SEGA GEO: Jumping to debug code (unimplemented)\n" ); |
| 2588 | |
| 2589 | (void)opcode; |
| 2590 | |
| 2591 | address = *input++ & 0x3FF; |
| 2592 | |
| 2593 | /* |
| 2594 | code_jump( address ) |
| 2595 | */ |
| 2596 | return input; |
| 2597 | } |
| 2598 | |
| 2599 | static UINT32 * geo_process_command( UINT32 opcode, UINT32 *input ) |
| 2600 | { |
| 2601 | switch( opcode >> 23 ) |
| 2602 | { |
| 2603 | case 0x00: input = geo_nop( opcode, input ); break; |
| 2604 | case 0x01: input = geo_object_data( opcode, input ); break; |
| 2605 | case 0x02: input = geo_direct_data( opcode, input ); break; |
| 2606 | case 0x03: input = geo_window_data( opcode, input ); break; |
| 2607 | case 0x04: input = geo_texture_data( opcode, input ); break; |
| 2608 | case 0x05: input = geo_polygon_data( opcode, input ); break; |
| 2609 | case 0x06: input = geo_texture_parameters( opcode, input ); break; |
| 2610 | case 0x07: input = geo_mode( opcode, input ); break; |
| 2611 | case 0x08: input = geo_zsort_mode( opcode, input ); break; |
| 2612 | case 0x09: input = geo_focal_distance( opcode, input ); break; |
| 2613 | case 0x0A: input = geo_light_source( opcode, input ); break; |
| 2614 | case 0x0B: input = geo_matrix_write( opcode, input ); break; |
| 2615 | case 0x0C: input = geo_translate_write( opcode, input ); break; |
| 2616 | case 0x0D: input = geo_data_mem_push( opcode, input ); break; |
| 2617 | case 0x0E: input = geo_test( opcode, input ); break; |
| 2618 | case 0x0F: input = geo_end( opcode, input ); break; |
| 2619 | case 0x10: input = geo_dummy( opcode, input ); break; |
| 2620 | case 0x11: input = geo_object_data( opcode, input ); break; |
| 2621 | case 0x12: input = geo_direct_data( opcode, input ); break; |
| 2622 | case 0x13: input = geo_window_data( opcode, input ); break; |
| 2623 | case 0x14: input = geo_log_data( opcode, input ); break; |
| 2624 | case 0x15: input = geo_polygon_data( opcode, input ); break; |
| 2625 | case 0x16: input = geo_lod( opcode, input ); break; |
| 2626 | case 0x17: input = geo_mode( opcode, input ); break; |
| 2627 | case 0x18: input = geo_zsort_mode( opcode, input ); break; |
| 2628 | case 0x19: input = geo_focal_distance( opcode, input ); break; |
| 2629 | case 0x1A: input = geo_light_source( opcode, input ); break; |
| 2630 | case 0x1B: input = geo_matrix_write( opcode, input ); break; |
| 2631 | case 0x1C: input = geo_translate_write( opcode, input ); break; |
| 2632 | case 0x1D: input = geo_code_upload( opcode, input ); break; |
| 2633 | case 0x1E: input = geo_code_jump( opcode, input ); break; |
| 2634 | case 0x1F: input = geo_end( opcode, input ); break; |
| 2635 | } |
| 2636 | |
| 2637 | return input; |
| 2638 | } |
| 2639 | |
| 2640 | static void geo_parse( void ) |
| 2641 | { |
| 2642 | UINT32 address = (geo_read_start_address/4); |
| 2643 | UINT32 *input = &model2_bufferram[address]; |
| 2644 | UINT32 opcode; |
| 2645 | |
| 2646 | while( input != NULL && (input - model2_bufferram) < 0x20000 ) |
| 2647 | { |
| 2648 | /* read in the opcode */ |
| 2649 | opcode = *input++; |
| 2650 | |
| 2651 | /* if it's a jump opcode, do the jump */ |
| 2652 | if ( opcode & 0x80000000 ) |
| 2653 | { |
| 2654 | /* get the address */ |
| 2655 | address = (opcode & 0x7FFFF) / 4; |
| 2656 | |
| 2657 | /* update our pointer */ |
| 2658 | input = &model2_bufferram[address]; |
| 2659 | |
| 2660 | /* go again */ |
| 2661 | continue; |
| 1238 | 2662 | } |
| 1239 | | }; |
| 2663 | |
| 2664 | /* process it */ |
| 2665 | input = geo_process_command( opcode, input ); |
| 2666 | } |
| 1240 | 2667 | } |
| 2668 | |
| 2669 | /***********************************************************************************************/ |
| 2670 | |
| 2671 | static bitmap_t *sys24_bitmap = NULL; |
| 2672 | |
| 2673 | static void model2_exit(running_machine *machine) |
| 2674 | { |
| 2675 | if ( sys24_bitmap != NULL ) |
| 2676 | { |
| 2677 | bitmap_free( sys24_bitmap ); |
| 2678 | sys24_bitmap = NULL; |
| 2679 | } |
| 2680 | } |
| 2681 | |
| 2682 | VIDEO_START(model2) |
| 2683 | { |
| 2684 | int width = machine->screen[0].visarea.max_x - machine->screen[0].visarea.min_x; |
| 2685 | int height = machine->screen[0].visarea.max_y - machine->screen[0].visarea.min_y; |
| 2686 | |
| 2687 | sys24_tile_vh_start(machine, 0x3fff); |
| 2688 | sys24_bitmap = bitmap_alloc(width, height+4, BITMAP_FORMAT_INDEXED16); |
| 2689 | add_exit_callback(machine, model2_exit); |
| 2690 | |
| 2691 | /* initialize the geometry engine */ |
| 2692 | geo_init( (UINT32*)memory_region(REGION_USER2) ); |
| 2693 | |
| 2694 | /* initialize the hardware rasterizer */ |
| 2695 | model2_3d_init( (UINT16*)memory_region(REGION_USER3) ); |
| 2696 | } |
| 2697 | |
| 2698 | static void convert_bitmap( running_machine *machine, bitmap_t *dst, bitmap_t *src, const rectangle *rect ) |
| 2699 | { |
| 2700 | int x, y; |
| 2701 | |
| 2702 | for( y = rect->min_y; y < rect->max_y; y++ ) |
| 2703 | { |
| 2704 | UINT32 *d = BITMAP_ADDR32( dst, y, 0 ); |
| 2705 | UINT16 *s = BITMAP_ADDR16( src, y, 0 ); |
| 2706 | |
| 2707 | for( x = rect->min_x; x < rect->max_x; x++ ) |
| 2708 | { |
| 2709 | if ( s[x] ) |
| 2710 | d[x] = machine->pens[s[x]]; |
| 2711 | } |
| 2712 | } |
| 2713 | } |
| 2714 | |
| 2715 | VIDEO_UPDATE(model2) |
| 2716 | { |
| 2717 | sys24_tile_update(machine); |
| 2718 | fillbitmap(bitmap, machine->pens[0], &machine->screen[0].visarea); |
| 2719 | fillbitmap(sys24_bitmap, 0, &machine->screen[0].visarea); |
| 2720 | |
| 2721 | sys24_tile_draw(machine, sys24_bitmap, cliprect, 7, 0, 0); |
| 2722 | sys24_tile_draw(machine, sys24_bitmap, cliprect, 6, 0, 0); |
| 2723 | sys24_tile_draw(machine, sys24_bitmap, cliprect, 5, 0, 0); |
| 2724 | sys24_tile_draw(machine, sys24_bitmap, cliprect, 4, 0, 0); |
| 2725 | |
| 2726 | convert_bitmap(machine, bitmap, sys24_bitmap, cliprect); |
| 2727 | |
| 2728 | /* tell the rasterizer we're starting a frame */ |
| 2729 | model2_3d_frame_start(); |
| 2730 | |
| 2731 | /* let the geometry engine do it's thing */ |
| 2732 | geo_parse(); |
| 2733 | |
| 2734 | /* have the rasterizer output the frame */ |
| 2735 | model2_3d_frame_end( bitmap, cliprect ); |
| 2736 | |
| 2737 | fillbitmap(sys24_bitmap, 0, &machine->screen[0].visarea); |
| 2738 | sys24_tile_draw(machine, sys24_bitmap, cliprect, 3, 0, 0); |
| 2739 | sys24_tile_draw(machine, sys24_bitmap, cliprect, 2, 0, 0); |
| 2740 | sys24_tile_draw(machine, sys24_bitmap, cliprect, 1, 0, 0); |
| 2741 | sys24_tile_draw(machine, sys24_bitmap, cliprect, 0, 0, 0); |
| 2742 | |
| 2743 | convert_bitmap(machine, bitmap, sys24_bitmap, cliprect); |
| 2744 | |
| 2745 | return 0; |
| 2746 | } |
| 2747 | |
src/mame/drivers/ddenlovr.c
| r1070 | r1071 | |
| 9 | 9 | Sound: (AY-3-8910) + YM2413 + MSM6295 |
| 10 | 10 | Other: Real Time Clock (Oki MSM6242B or 72421B) |
| 11 | 11 | |
| 12 | | --------------------------------------------------------------------------------------------------------------------------- |
| 13 | | Year + Game Board CPU Sound Custom Notes |
| 14 | | --------------------------------------------------------------------------------------------------------------------------- |
| 15 | | 92 Monkey Mole Panic 2xZ80 AY8910 + YM2413 + M6295 Dynax NL-001 8251 |
| 16 | | 93 Animalandia Jr. 2xZ80 AY8910 + YM2413 + M6295 NL-001, NL-003 (x2), NL-004 (x2) TMP82C51 (USART) |
| 17 | | 93 Quiz Channel Question N7311208L1-2 Z80 YM2413 + M6295 NAKANIHON NL-002 |
| 18 | | 93 The First Funky Fighter N7403208L-2 2xZ80 YM2149 + YM2413 + M6295 NL-001, NL-002, NL-005 |
| 19 | | 94 Mahjong Mysterious World D7107058L1-1 Z80 YM2149 + YM2413 + M6295 |
| 20 | | 94 Quiz 365 68000 AY8910 + YM2413 + M6295 |
| 21 | | 94 Rong Rong Z80 YM2413 + M6295 NAKANIHON NL-002 |
| 22 | | 95 Mahjong Dai Chuuka Ken D11107218L1 Z80 AY8910 + YM2413 + M6295 70C160F009 |
| 23 | | 95 Nettoh Quiz Champion 68000 AY8910 + YM2413 + M6295 |
| 24 | | 95 Don Den Lover Vol 1 (J) D1120901L8 68000 YMZ284 + YM2413 + M6295 NAKANIHON NL-005 |
| 25 | | 96 Don Den Lover Vol 1 (HK) D11309208L1 68000 YMZ284 + YM2413 + M6295 NAKANIHON NL-005 |
| 26 | | 96 Panel & Variety Akamaru 68000 YMZ284 + YM2413 + M6295 NAKANIHON NL-005 |
| 27 | | 96 Mahjong Fantastic Love NS5000101 + ? Z80 YMZ284 + YM2413 + M6295 NAKANIHON NL-005 |
| 28 | | 96 Hana Kanzashi Z80 YM2413 + M6295 70C160F011? |
| 29 | | 97 Hana Kagerou Z80 YM2413 + M6295 70C160F011 |
| 30 | | 98 Mahjong Chuukanejyo D11107218L1 Z80 AY8910 + YM2413 + M6295 70C160F009 |
| 31 | | 98 Mahjong Reach Ippatsu Z80 YM2413 + M6295 70C160F011 |
| 32 | | --------------------------------------------------------------------------------------------------------------------------- |
| 12 | ----------------------------------------------------------------------------------------------------------------------------- |
| 13 | Year + Game Board CPU Sound Custom Notes |
| 14 | ----------------------------------------------------------------------------------------------------------------------------- |
| 15 | 92 Monkey Mole Panic 2xZ80 AY8910 + YM2413 + M6295 NL-001 1108(x2) 1427(x2) 8251 |
| 16 | 93 Animalandia Jr. 2xZ80 AY8910 + YM2413 + M6295 NL-001 NL-003(x2) NL-004(x2) TMP82C51 |
| 17 | 93 Quiz Channel Question N7311208L1-2 Z80 YM2413 + M6295 NL-002 1108F0405 1427F0071 |
| 18 | 93 First Funky Fighter N7403208L-2 2xZ80 YM2149 + YM2413 + M6295 NL-001 NL-002 NL-005 |
| 19 | 94 Mysterious World D7107058L1-1 Z80 YM2149 + YM2413 + M6295 NL-002 1108F0405 1427F0071 4L02? |
| 20 | 94 Mysterious Universe D7107058L1-1 Z80 YM2149 + YM2413 + M6295 NL-002 1108F0405 1427F0071 |
| 21 | 94 Mysterious Orient D7107058L1-1 Z80 YM2149 + YM2413 + M6295 NL-002 1108F0405 1427F0071 |
| 22 | 94 Quiz 365 68000 AY8910 + YM2413 + M6295 |
| 23 | 94 Rong Rong (J) N8010178L1 Z80 YM2413 + M6295 NL-002 1108F0405 1427F0071 4L02F2637 |
| 24 | 94 Hana Ginga D8102048L1 Z80 YM2149 + YM2413 + M6295 NL-002 1108F0405 1427F0071 4L02? |
| 25 | 94 Super Hana Paradise N8010178L1+N73RSUB Z80 YM2413 + M6295 NL-002 1108F0406 1427F0071 4L02F2637 |
| 26 | 95 Dai Chuuka Ken D11107218L1 Z80 AY8910 + YM2413 + M6295 70C160F009 |
| 27 | 95 Hana Gokou N83061581L1 Z80 AY8910 + YM2413 + M6295 NL-002 1108? 1427? 4L02? |
| 28 | 95 Nettoh Quiz Champion 68000 AY8910 + YM2413 + M6295 |
| 29 | 95 Don Den Lover (J) D1120901L8 68000 YMZ284 + YM2413 + M6295 NL-005 |
| 30 | 96 Don Den Lover (HK) D11309208L1 68000 YMZ284 + YM2413 + M6295 NL-005 |
| 31 | 96 Panel&Variety Akamaru 68000 YMZ284 + YM2413 + M6295 NL-005 |
| 32 | 96 Fantasic Love NS5000101+? Z80 YMZ284 + YM2413 + M6295 NL-005 |
| 33 | 96 Hana Kanzashi Z80 YM2413 + M6295 70C160F011? |
| 34 | 97 Hana Kagerou Z80 YM2413 + M6295 70C160F011 |
| 35 | 98 Chuukanejyo D11107218L1 Z80 AY8910 + YM2413 + M6295 70C160F009 |
| 36 | 98 Reach Ippatsu Z80 YM2413 + M6295 70C160F011 |
| 37 | ----------------------------------------------------------------------------------------------------------------------------- |
| 33 | 38 | |
| 34 | 39 | Notes: |
| 35 | 40 | |
| r1070 | r1071 | |
| 2749 | 2754 | hginga_rombank = data; |
| 2750 | 2755 | } |
| 2751 | 2756 | |
| 2752 | | static READ8_HANDLER( hginga_rand_r ) |
| 2757 | // similar to rongrong |
| 2758 | static READ8_HANDLER( hginga_protection_r ) |
| 2753 | 2759 | { |
| 2754 | 2760 | UINT8 *rom = memory_region(REGION_CPU1); |
| 2755 | 2761 | if (hginga_rombank & 0x10) |
| r1070 | r1071 | |
| 2761 | 2767 | AM_RANGE(0x0000, 0x5fff) AM_READ( MRA8_ROM ) // ROM |
| 2762 | 2768 | AM_RANGE(0x6000, 0x6fff) AM_READ( MRA8_RAM ) // RAM |
| 2763 | 2769 | AM_RANGE(0x7000, 0x7fff) AM_READ( MRA8_BANK2 ) // RAM (Banked) |
| 2764 | | AM_RANGE(0xf601, 0xf601) AM_READ( hginga_rand_r ) |
| 2770 | AM_RANGE(0xf601, 0xf601) AM_READ( hginga_protection_r ) |
| 2765 | 2771 | AM_RANGE(0x8000, 0xffff) AM_READ( MRA8_BANK1 ) // ROM/RAM (Banked) |
| 2766 | 2772 | ADDRESS_MAP_END |
| 2767 | 2773 | |
| r1070 | r1071 | |
| 2769 | 2775 | AM_RANGE(0x6000, 0x6fff) AM_WRITE( MWA8_RAM ) // RAM |
| 2770 | 2776 | AM_RANGE(0x7000, 0x7fff) AM_WRITE( MWA8_BANK2 ) // RAM (Banked) |
| 2771 | 2777 | AM_RANGE(0xf000, 0xf1ff) AM_WRITE( rongrong_palette_w ) // RAM enabled by bit 4 of rombank |
| 2772 | | AM_RANGE(0xf705, 0xf706) AM_WRITE( MWA8_NOP ) |
| 2778 | AM_RANGE(0xf700, 0xf706) AM_WRITE( MWA8_NOP ) |
| 2773 | 2779 | ADDRESS_MAP_END |
| 2774 | 2780 | |
| 2775 | 2781 | static READ8_HANDLER( hginga_dsw_r ) |
| r1070 | r1071 | |
| 2820 | 2826 | // bit 1 = out counter |
| 2821 | 2827 | // bit 2 = 1 if bet on |
| 2822 | 2828 | // bit 3 = 1 if bet on |
| 2823 | | // bit 8? |
| 2829 | // bit 7? |
| 2824 | 2830 | coin_counter_w(0, data & 1); |
| 2831 | #ifdef MAME_DEBUG |
| 2825 | 2832 | // popmessage("COINS %02x",data); |
| 2833 | #endif |
| 2826 | 2834 | hginga_coins = data; |
| 2827 | 2835 | break; |
| 2828 | 2836 | default: |
| r1070 | r1071 | |
| 2911 | 2919 | ADDRESS_MAP_END |
| 2912 | 2920 | |
| 2913 | 2921 | |
| 2922 | /*************************************************************************** |
| 2923 | Hanafuda Hana Gokou |
| 2924 | ***************************************************************************/ |
| 2914 | 2925 | |
| 2926 | UINT8 hgokou_hopper; |
| 2927 | |
| 2928 | static UINT8 hgokou_player_r(int player) |
| 2929 | { |
| 2930 | UINT8 hopper_bit = ((hgokou_hopper && !(cpu_getcurrentframe()%10)) ? 0 : (1<<6)); |
| 2931 | |
| 2932 | if (!(dynax_select2 & 0x01)) return readinputport(player * 5 + 1) | hopper_bit; |
| 2933 | if (!(dynax_select2 & 0x02)) return readinputport(player * 5 + 2) | hopper_bit; |
| 2934 | if (!(dynax_select2 & 0x04)) return readinputport(player * 5 + 3) | hopper_bit; |
| 2935 | if (!(dynax_select2 & 0x08)) return readinputport(player * 5 + 4) | hopper_bit; |
| 2936 | if (!(dynax_select2 & 0x10)) return readinputport(player * 5 + 5) | hopper_bit; |
| 2937 | |
| 2938 | return 0x7f; // bit 7 = blitter busy, bit 6 = hopper |
| 2939 | } |
| 2940 | |
| 2941 | static READ8_HANDLER( hgokou_input_r ) |
| 2942 | { |
| 2943 | switch (hginga_select) |
| 2944 | { |
| 2945 | case 0x20: return readinputport(0); |
| 2946 | case 0x21: return hgokou_player_r(1); |
| 2947 | case 0x22: return hgokou_player_r(0); |
| 2948 | case 0x23: return hginga_coins; |
| 2949 | } |
| 2950 | logerror("%06x: warning, unknown bits read, hginga_select = %02x\n", activecpu_get_pc(), hginga_select); |
| 2951 | return 0xff; |
| 2952 | } |
| 2953 | |
| 2954 | static WRITE8_HANDLER( hgokou_input_w ) |
| 2955 | { |
| 2956 | switch (hginga_select) |
| 2957 | { |
| 2958 | case 0x2c: |
| 2959 | // bit 0 = coin counter |
| 2960 | // bit 1 = out counter |
| 2961 | // bit 2 = hopper |
| 2962 | coin_counter_w(0, data & 1); |
| 2963 | hgokou_hopper = data & 0x04; |
| 2964 | #ifdef MAME_DEBUG |
| 2965 | // popmessage("COINS %02x",data); |
| 2966 | #endif |
| 2967 | hginga_coins = data; |
| 2968 | break; |
| 2969 | |
| 2970 | case 0x2d: dynax_select2 = data; break; |
| 2971 | |
| 2972 | case 0x2f: break; // ? written with 2f |
| 2973 | |
| 2974 | default: |
| 2975 | logerror("%04x: input_w with select = %02x, data = %02x\n",activecpu_get_pc(),hginga_select,data); |
| 2976 | } |
| 2977 | } |
| 2978 | |
| 2979 | // similar to rongrong |
| 2980 | static READ8_HANDLER( hgokou_protection_r ) |
| 2981 | { |
| 2982 | UINT8 *rom = memory_region(REGION_CPU1); |
| 2983 | if (hginga_rombank == 0) |
| 2984 | return hanakanz_rand_r(0); |
| 2985 | return rom[0x10000 + 0x8000 * (hginga_rombank & 0x7) + 0xe601 - 0x8000]; |
| 2986 | } |
| 2987 | |
| 2988 | static ADDRESS_MAP_START( hgokou_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 2989 | AM_RANGE(0x0000, 0x5fff) AM_READ(MRA8_ROM ) // ROM |
| 2990 | AM_RANGE(0x6000, 0x6fff) AM_READ(MRA8_RAM ) // RAM |
| 2991 | AM_RANGE(0x7000, 0x7fff) AM_READ(MRA8_BANK2 ) // RAM (Banked) |
| 2992 | AM_RANGE(0xe601, 0xe601) AM_READ(hgokou_protection_r ) |
| 2993 | AM_RANGE(0x8000, 0xffff) AM_READ(MRA8_BANK1 ) // ROM (Banked) |
| 2994 | ADDRESS_MAP_END |
| 2995 | static ADDRESS_MAP_START( hgokou_writemem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 2996 | AM_RANGE(0x6000, 0x6fff) AM_WRITE(MWA8_RAM ) // RAM |
| 2997 | AM_RANGE(0x7000, 0x7fff) AM_WRITE(MWA8_BANK2 ) // RAM (Banked) |
| 2998 | AM_RANGE(0xe000, 0xe1ff) AM_WRITE(rongrong_palette_w ) |
| 2999 | AM_RANGE(0xe700, 0xe706) AM_WRITE(MWA8_NOP ) |
| 3000 | ADDRESS_MAP_END |
| 3001 | |
| 3002 | |
| 3003 | static ADDRESS_MAP_START( hgokou_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 3004 | AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r ) |
| 3005 | AM_RANGE(0x1c, 0x1c) AM_READ(MRA8_NOP ) // ? ack on RTC int |
| 3006 | AM_RANGE(0x20, 0x2f) AM_READ(msm6242_r ) // 6242RTC |
| 3007 | AM_RANGE(0x58, 0x58) AM_READ(unk_r ) // ? must be 78 on startup |
| 3008 | AM_RANGE(0x62, 0x62) AM_READ(hgokou_input_r ) |
| 3009 | AM_RANGE(0x80, 0x80) AM_READ(OKIM6295_status_0_r ) |
| 3010 | AM_RANGE(0x84, 0x84) AM_READ(AY8910_read_port_0_r ) |
| 3011 | AM_RANGE(0xb0, 0xb0) AM_READ(hanakanz_rand_r ) |
| 3012 | ADDRESS_MAP_END |
| 3013 | static ADDRESS_MAP_START( hgokou_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 3014 | AM_RANGE(0x00, 0x01) AM_WRITE(hginga_blitter_w ) |
| 3015 | AM_RANGE(0x1c, 0x1c) AM_WRITE(mjmyster_rambank_w ) |
| 3016 | AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w ) |
| 3017 | AM_RANGE(0x20, 0x2f) AM_WRITE(msm6242_w ) // 6242RTC |
| 3018 | AM_RANGE(0x40, 0x43) AM_WRITE(dynax_palette_base_w ) |
| 3019 | AM_RANGE(0x44, 0x47) AM_WRITE(dynax_palette_mask_w ) |
| 3020 | AM_RANGE(0x48, 0x4b) AM_WRITE(dynax_transparency_pen_w ) |
| 3021 | AM_RANGE(0x4c, 0x4f) AM_WRITE(dynax_transparency_mask_w ) |
| 3022 | AM_RANGE(0x54, 0x54) AM_WRITE(dynax_bgcolor_w ) |
| 3023 | AM_RANGE(0x55, 0x55) AM_WRITE(dynax_priority_w ) |
| 3024 | AM_RANGE(0x56, 0x56) AM_WRITE(dynax_layer_enable_w ) |
| 3025 | AM_RANGE(0x60, 0x60) AM_WRITE(hginga_input_w ) |
| 3026 | AM_RANGE(0x61, 0x61) AM_WRITE(hgokou_input_w ) |
| 3027 | AM_RANGE(0x80, 0x80) AM_WRITE(OKIM6295_data_0_w ) |
| 3028 | AM_RANGE(0x82, 0x82) AM_WRITE(YM2413_register_port_0_w ) |
| 3029 | AM_RANGE(0x83, 0x83) AM_WRITE(YM2413_data_port_0_w ) |
| 3030 | AM_RANGE(0x86, 0x86) AM_WRITE(AY8910_write_port_0_w ) |
| 3031 | AM_RANGE(0x88, 0x88) AM_WRITE(AY8910_control_port_0_w ) |
| 3032 | ADDRESS_MAP_END |
| 3033 | |
| 3034 | |
| 3035 | /*************************************************************************** |
| 3036 | Super Hana Paradise |
| 3037 | ***************************************************************************/ |
| 3038 | |
| 3039 | static WRITE8_HANDLER( hparadis_select_w ) |
| 3040 | { |
| 3041 | UINT8 *rom = memory_region(REGION_CPU1); |
| 3042 | |
| 3043 | dynax_select = data; |
| 3044 | hginga_ip = 0; |
| 3045 | |
| 3046 | memory_set_bankptr(1, &rom[0x10000 + 0x8000 * (data & 0x07)]); |
| 3047 | memory_set_bankptr(2, &rom[0x50000 + 0x1000 * ((data & 0xe0) >> 5)]); |
| 3048 | } |
| 3049 | |
| 3050 | |
| 3051 | static READ8_HANDLER( hparadis_input_r ) |
| 3052 | { |
| 3053 | switch (hginga_select) |
| 3054 | { |
| 3055 | case 0x00: return readinputport(0); // P1 (Joy) |
| 3056 | case 0x01: return readinputport(1); // P2 (Joy) |
| 3057 | case 0x02: return readinputport(2); // Coins |
| 3058 | case 0x0d: return 0x00; |
| 3059 | case 0x80: return readinputport(3 + hginga_ip++); // P1 (Keys) |
| 3060 | case 0x81: return readinputport(8 + hginga_ip++); // P2 (Keys) |
| 3061 | } |
| 3062 | logerror("%06x: warning, unknown bits read, hginga_select = %02x\n", activecpu_get_pc(), hginga_select); |
| 3063 | return 0xff; |
| 3064 | } |
| 3065 | |
| 3066 | static READ8_HANDLER( hparadis_dsw_r ) |
| 3067 | { |
| 3068 | if (!(dynax_select & 0x01)) return readinputport(13); |
| 3069 | if (!(dynax_select & 0x02)) return readinputport(14); |
| 3070 | if (!(dynax_select & 0x04)) return 0xff; |
| 3071 | if (!(dynax_select & 0x08)) return 0xff; |
| 3072 | if (!(dynax_select & 0x10)) return readinputport(15); |
| 3073 | return 0xff; |
| 3074 | } |
| 3075 | |
| 3076 | static WRITE8_HANDLER( hparadis_coin_w ) |
| 3077 | { |
| 3078 | switch ( hginga_select ) |
| 3079 | { |
| 3080 | case 0x0c: coin_counter_w(0, data & 1); break; |
| 3081 | case 0x0d: break; |
| 3082 | default: |
| 3083 | logerror("%04x: coins_w with select = %02x, data = %02x\n",activecpu_get_pc(),hginga_select,data); |
| 3084 | } |
| 3085 | } |
| 3086 | |
| 3087 | static ADDRESS_MAP_START( hparadis_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 3088 | AM_RANGE(0x0000, 0x5fff) AM_READ(MRA8_ROM ) // ROM |
| 3089 | AM_RANGE(0x6000, 0x6fff) AM_READ(MRA8_RAM ) // RAM |
| 3090 | AM_RANGE(0x7000, 0x7fff) AM_READ(MRA8_BANK2 ) // RAM (Banked) |
| 3091 | AM_RANGE(0x8000, 0xffff) AM_READ(MRA8_BANK1 ) // ROM (Banked) |
| 3092 | ADDRESS_MAP_END |
| 3093 | static ADDRESS_MAP_START( hparadis_writemem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 3094 | AM_RANGE(0x6000, 0x6fff) AM_WRITE(MWA8_RAM ) // RAM |
| 3095 | AM_RANGE(0x7000, 0x7fff) AM_WRITE(MWA8_BANK2 ) // RAM (Banked) |
| 3096 | AM_RANGE(0xc000, 0xc1ff) AM_WRITE(rongrong_palette_w ) |
| 3097 | ADDRESS_MAP_END |
| 3098 | |
| 3099 | // the RTC seems unused |
| 3100 | static ADDRESS_MAP_START( hparadis_readport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 3101 | AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r ) |
| 3102 | AM_RANGE(0x1b, 0x1b) AM_READ(rongrong_blitter_busy_r ) |
| 3103 | AM_RANGE(0x1c, 0x1c) AM_READ(hparadis_dsw_r ) |
| 3104 | AM_RANGE(0x40, 0x40) AM_READ(OKIM6295_status_0_r ) |
| 3105 | AM_RANGE(0x98, 0x98) AM_READ(unk_r ) // ? must be 78 on startup |
| 3106 | AM_RANGE(0xa2, 0xa3) AM_READ(hparadis_input_r ) |
| 3107 | ADDRESS_MAP_END |
| 3108 | static ADDRESS_MAP_START( hparadis_writeport, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 3109 | AM_RANGE(0x00, 0x01) AM_WRITE(rongrong_blitter_w ) |
| 3110 | AM_RANGE(0x1b, 0x1b) AM_WRITE(rongrong_blitter_busy_w ) |
| 3111 | AM_RANGE(0x1e, 0x1e) AM_WRITE(hparadis_select_w ) |
| 3112 | AM_RANGE(0x40, 0x40) AM_WRITE(OKIM6295_data_0_w ) |
| 3113 | AM_RANGE(0x60, 0x60) AM_WRITE(YM2413_register_port_0_w ) |
| 3114 | AM_RANGE(0x61, 0x61) AM_WRITE(YM2413_data_port_0_w ) |
| 3115 | AM_RANGE(0x80, 0x83) AM_WRITE(dynax_palette_base_w ) |
| 3116 | AM_RANGE(0x84, 0x87) AM_WRITE(dynax_palette_mask_w ) |
| 3117 | AM_RANGE(0x88, 0x8b) AM_WRITE(dynax_transparency_pen_w ) |
| 3118 | AM_RANGE(0x8c, 0x8f) AM_WRITE(dynax_transparency_mask_w ) |
| 3119 | AM_RANGE(0x94, 0x94) AM_WRITE(dynax_bgcolor_w ) |
| 3120 | AM_RANGE(0x95, 0x95) AM_WRITE(dynax_priority_w ) |
| 3121 | AM_RANGE(0x96, 0x96) AM_WRITE(dynax_layer_enable_w ) |
| 3122 | AM_RANGE(0xa0, 0xa0) AM_WRITE(hginga_input_w ) |
| 3123 | AM_RANGE(0xa1, 0xa1) AM_WRITE(hparadis_coin_w ) |
| 3124 | AM_RANGE(0xc2, 0xc2) AM_WRITE(MWA8_NOP ) // enables palette RAM at c000 |
| 3125 | ADDRESS_MAP_END |
| 3126 | |
| 3127 | |
| 3128 | /*************************************************************************** |
| 3129 | Mahjong Mysterious World |
| 3130 | ***************************************************************************/ |
| 3131 | |
| 2915 | 3132 | static READ8_HANDLER( mjmywrld_coins_r ) |
| 2916 | 3133 | { |
| 2917 | 3134 | switch( dynax_select2 ) |
| r1070 | r1071 | |
| 3054 | 3271 | |
| 3055 | 3272 | |
| 3056 | 3273 | /*************************************************************************** |
| 3057 | | Mahjong Fantastic Love |
| 3274 | Mahjong Fantasic Love |
| 3058 | 3275 | ***************************************************************************/ |
| 3059 | 3276 | |
| 3060 | 3277 | static WRITE8_HANDLER( mjflove_rombank_w ) |
| r1070 | r1071 | |
| 3529 | 3746 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 3530 | 3747 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 3531 | 3748 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 3532 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1) /* Test */ |
| 3749 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1) PORT_TOGGLE |
| 3533 | 3750 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 3534 | 3751 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) // ? quiz365 |
| 3535 | 3752 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // ? blitter irq flag ? |
| r1070 | r1071 | |
| 3549 | 3766 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Free_Play ) ) |
| 3550 | 3767 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 3551 | 3768 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3552 | | PORT_DIPNAME( 0x20, 0x20, "Help" ) |
| 3769 | PORT_DIPNAME( 0x20, 0x20, "Helps" ) |
| 3770 | PORT_DIPSETTING( 0x00, "2" ) |
| 3553 | 3771 | PORT_DIPSETTING( 0x20, "3" ) |
| 3554 | | PORT_DIPSETTING( 0x00, "2" ) |
| 3555 | 3772 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) |
| 3556 | 3773 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 3557 | 3774 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| r1070 | r1071 | |
| 3560 | 3777 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3561 | 3778 | |
| 3562 | 3779 | PORT_START // IN4 - DSW |
| 3563 | | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 3564 | | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 3565 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3566 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) |
| 3567 | | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 3568 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3569 | | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) |
| 3570 | | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 3571 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3572 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 3573 | | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 3574 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3575 | | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 3576 | | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 3577 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3578 | | PORT_DIPNAME( 0x20, 0x20, "VS Round" ) |
| 3579 | | PORT_DIPSETTING( 0x20, "1" ) |
| 3580 | | PORT_DIPSETTING( 0x00, "2" ) |
| 3780 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) |
| 3781 | PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) |
| 3782 | PORT_DIPSETTING( 0x03, DEF_STR( Normal ) ) |
| 3783 | PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) |
| 3784 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 3785 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) ) |
| 3786 | PORT_DIPSETTING( 0x0c, "0" ) |
| 3787 | PORT_DIPSETTING( 0x08, "1" ) |
| 3788 | PORT_DIPSETTING( 0x04, "2" ) |
| 3789 | PORT_DIPSETTING( 0x00, "3" ) |
| 3790 | PORT_DIPNAME( 0x30, 0x30, "VS Rounds" ) |
| 3791 | PORT_DIPSETTING( 0x30, "1" ) |
| 3792 | PORT_DIPSETTING( 0x20, "2" ) |
| 3793 | PORT_DIPSETTING( 0x10, "3" ) |
| 3794 | // PORT_DIPSETTING( 0x00, "3" ) |
| 3581 | 3795 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 3582 | 3796 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 3583 | 3797 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r1070 | r1071 | |
| 3586 | 3800 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3587 | 3801 | |
| 3588 | 3802 | PORT_START // IN5 - DSW |
| 3589 | | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 3803 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) |
| 3590 | 3804 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 3591 | 3805 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3592 | | PORT_DIPNAME( 0x02, 0x02, "Test Mode" ) |
| 3593 | | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 3594 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 3806 | PORT_SERVICE( 0x02, IP_ACTIVE_LOW ) |
| 3595 | 3807 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) |
| 3596 | 3808 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 3597 | 3809 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r1070 | r1071 | |
| 5318 | 5530 | PORT_BIT( 0xbf, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5319 | 5531 | INPUT_PORTS_END |
| 5320 | 5532 | |
| 5533 | INPUT_PORTS_START( hgokou ) |
| 5534 | PORT_START // IN0 |
| 5535 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3 ) // medal out |
| 5536 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5537 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1) PORT_TOGGLE |
| 5538 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) // analyzer |
| 5539 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 ) // data clear |
| 5540 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) // note |
| 5541 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 5542 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5543 | |
| 5544 | // keyb 1 |
| 5545 | PORT_START // IN1 |
| 5546 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) // A |
| 5547 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) // E |
| 5548 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // I |
| 5549 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME(DEF_STR( Yes )) PORT_CODE(KEYCODE_Y) // M |
| 5550 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) // Kan |
| 5551 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) |
| 5552 | |
| 5553 | PORT_START // IN2 |
| 5554 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) // B |
| 5555 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) // F |
| 5556 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // J |
| 5557 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME(DEF_STR( No )) PORT_CODE(KEYCODE_N) // N |
| 5558 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) // Reach |
| 5559 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // BET |
| 5560 | |
| 5561 | PORT_START // IN3 |
| 5562 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) // C |
| 5563 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // G |
| 5564 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // K |
| 5565 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) // Chi |
| 5566 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Ron |
| 5567 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5568 | |
| 5569 | PORT_START // IN4 |
| 5570 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) // D |
| 5571 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // H |
| 5572 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // L |
| 5573 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) // PON |
| 5574 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5575 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5576 | |
| 5577 | PORT_START // IN5 |
| 5578 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5579 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "t" |
| 5580 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "w" |
| 5581 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5582 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "b" |
| 5583 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "s" |
| 5584 | |
| 5585 | // keyb 2 |
| 5586 | PORT_START // IN6 |
| 5587 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2) // A |
| 5588 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2) // E |
| 5589 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // I |
| 5590 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2) // M |
| 5591 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) PORT_PLAYER(2) // Kan |
| 5592 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) |
| 5593 | |
| 5594 | PORT_START // IN7 |
| 5595 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2) // B |
| 5596 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2) // F |
| 5597 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // J |
| 5598 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2) // N |
| 5599 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) PORT_PLAYER(2) // Reach |
| 5600 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // BET |
| 5601 | |
| 5602 | PORT_START // IN8 |
| 5603 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2) // C |
| 5604 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_PLAYER(2) // G |
| 5605 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // K |
| 5606 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) PORT_PLAYER(2) // Chi |
| 5607 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Ron |
| 5608 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5609 | |
| 5610 | PORT_START // IN9 |
| 5611 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2) // D |
| 5612 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_PLAYER(2) // H |
| 5613 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // L |
| 5614 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) PORT_PLAYER(2) // PON |
| 5615 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5616 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5617 | |
| 5618 | PORT_START // IN10 |
| 5619 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5620 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "t" |
| 5621 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "w" |
| 5622 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5623 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "b" |
| 5624 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "s" |
| 5625 | |
| 5626 | PORT_START // IN11 - DSW4 |
| 5627 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Demo_Sounds ) ) |
| 5628 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 5629 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) |
| 5630 | PORT_DIPNAME( 0x02, 0x02, "Unknown 4-1" ) |
| 5631 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 5632 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5633 | PORT_DIPNAME( 0x04, 0x04, "Girls" ) |
| 5634 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 5635 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) |
| 5636 | PORT_DIPNAME( 0x08, 0x08, "Unknown 4-3" ) |
| 5637 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 5638 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5639 | PORT_DIPNAME( 0x10, 0x10, "Change Cards" ) |
| 5640 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 5641 | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) |
| 5642 | PORT_DIPNAME( 0x20, 0x20, "Unknown 4-5" ) |
| 5643 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 5644 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5645 | PORT_DIPNAME( 0x40, 0x40, "Unknown 4-6" ) |
| 5646 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 5647 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5648 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5649 | PORT_DIPNAME( 0x80, 0x00, "Cards Labels" ) |
| 5650 | PORT_DIPSETTING( 0x80, "Numbers" ) |
| 5651 | PORT_DIPSETTING( 0x00, "Letters" ) |
| 5652 | |
| 5653 | PORT_START // IN12 - DSW3 |
| 5654 | PORT_DIPNAME( 0x03, 0x03, "Unknown 3-0&1" ) |
| 5655 | PORT_DIPSETTING( 0x03, "1" ) |
| 5656 | PORT_DIPSETTING( 0x02, "2" ) |
| 5657 | PORT_DIPSETTING( 0x01, "3" ) |
| 5658 | PORT_DIPSETTING( 0x00, "4" ) |
| 5659 | PORT_DIPNAME( 0x04, 0x04, "Unknown 3-2" ) |
| 5660 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 5661 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5662 | PORT_DIPNAME( 0x18, 0x18, "Unknown 3-3&4" ) |
| 5663 | PORT_DIPSETTING( 0x18, "10" ) |
| 5664 | PORT_DIPSETTING( 0x10, "20" ) |
| 5665 | PORT_DIPSETTING( 0x08, "30" ) |
| 5666 | PORT_DIPSETTING( 0x00, "50" ) |
| 5667 | PORT_DIPNAME( 0x20, 0x20, "Unknown 3-5" ) |
| 5668 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 5669 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5670 | PORT_DIPNAME( 0xc0, 0xc0, "Unknown 3-6&7" ) |
| 5671 | PORT_DIPSETTING( 0xc0, "0" ) |
| 5672 | PORT_DIPSETTING( 0x80, "1" ) |
| 5673 | PORT_DIPSETTING( 0x40, "2" ) |
| 5674 | PORT_DIPSETTING( 0x00, "3" ) |
| 5675 | |
| 5676 | PORT_START // IN13 - DSW2 |
| 5677 | PORT_DIPNAME( 0x03, 0x03, "Unknown 2-0&1" ) |
| 5678 | PORT_DIPSETTING( 0x03, "1" ) |
| 5679 | PORT_DIPSETTING( 0x02, "2" ) |
| 5680 | PORT_DIPSETTING( 0x01, "5" ) |
| 5681 | PORT_DIPSETTING( 0x00, "10" ) |
| 5682 | PORT_DIPNAME( 0x04, 0x04, "Unknown 2-2" ) |
| 5683 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 5684 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5685 | PORT_DIPNAME( 0x08, 0x08, "Unknown 2-3" ) |
| 5686 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 5687 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5688 | PORT_DIPNAME( 0x30, 0x30, "Odds Rate" ) |
| 5689 | PORT_DIPSETTING( 0x30, "2 5 6 20 50 100" ) |
| 5690 | PORT_DIPSETTING( 0x20, "2 5 6 20 50 200" ) |
| 5691 | PORT_DIPSETTING( 0x10, "2 5 6 20 50 250" ) |
| 5692 | PORT_DIPSETTING( 0x00, "2 5 6 20 50 300" ) |
| 5693 | PORT_DIPNAME( 0xc0, 0xc0, "Unknown 2-6&7" ) |
| 5694 | PORT_DIPSETTING( 0xc0, "50" ) |
| 5695 | PORT_DIPSETTING( 0x80, "60" ) |
| 5696 | PORT_DIPSETTING( 0x40, "70" ) |
| 5697 | PORT_DIPSETTING( 0x00, "80" ) |
| 5698 | |
| 5699 | PORT_START // IN14 - DSW1 |
| 5700 | PORT_DIPNAME( 0x07, 0x07, "Unknown 1-0&1&2" ) |
| 5701 | PORT_DIPSETTING( 0x07, "0" ) |
| 5702 | PORT_DIPSETTING( 0x06, "1" ) |
| 5703 | PORT_DIPSETTING( 0x05, "2" ) |
| 5704 | PORT_DIPSETTING( 0x04, "3" ) |
| 5705 | PORT_DIPSETTING( 0x03, "4" ) |
| 5706 | PORT_DIPSETTING( 0x02, "5" ) |
| 5707 | PORT_DIPSETTING( 0x01, "6" ) |
| 5708 | PORT_DIPSETTING( 0x00, "7" ) |
| 5709 | PORT_DIPNAME( 0x08, 0x08, "Unknown 1-3" ) |
| 5710 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 5711 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5712 | PORT_DIPNAME( 0x10, 0x10, "Unknown 1-4" ) |
| 5713 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 5714 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5715 | PORT_DIPNAME( 0x60, 0x60, "Unknown 1-5&6" ) |
| 5716 | PORT_DIPSETTING( 0x60, "0" ) |
| 5717 | PORT_DIPSETTING( 0x40, "1" ) |
| 5718 | PORT_DIPSETTING( 0x20, "2" ) |
| 5719 | PORT_DIPSETTING( 0x00, "3" ) |
| 5720 | PORT_DIPNAME( 0x80, 0x80, "Unknown 1-7" ) |
| 5721 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 5722 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5723 | |
| 5724 | PORT_START // IN15 - DSWs top bits |
| 5725 | PORT_DIPNAME( 0x01, 0x00, "Control Panel" ) |
| 5726 | PORT_DIPSETTING( 0x00, "Hanafuda" ) |
| 5727 | PORT_DIPSETTING( 0x01, "Mahjong" ) // Requires different inputs |
| 5728 | PORT_SERVICE( 0x02, IP_ACTIVE_LOW ) |
| 5729 | PORT_DIPNAME( 0x04, 0x04, "Unknown 2-8" ) |
| 5730 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 5731 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5732 | PORT_DIPNAME( 0x08, 0x08, "Unknown 2-9" ) |
| 5733 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 5734 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5735 | PORT_DIPNAME( 0x10, 0x10, "Unknown 3-8" ) |
| 5736 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 5737 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5738 | PORT_DIPNAME( 0x20, 0x20, "Unknown 3-9" ) |
| 5739 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 5740 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5741 | PORT_DIPNAME( 0x40, 0x40, "Unknown 4-8" ) |
| 5742 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 5743 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5744 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) |
| 5745 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 5746 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5747 | INPUT_PORTS_END |
| 5748 | |
| 5321 | 5749 | INPUT_PORTS_START( mjmyornt ) |
| 5322 | 5750 | PORT_START // IN0 - Coins + Service Keys |
| 5323 | 5751 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3 ) // medal out |
| r1070 | r1071 | |
| 5902 | 6330 | PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) |
| 5903 | 6331 | INPUT_PORTS_END |
| 5904 | 6332 | |
| 6333 | INPUT_PORTS_START( hparadis ) |
| 6334 | PORT_START // IN0 - Player 1 |
| 6335 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 6336 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) |
| 6337 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) |
| 6338 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) |
| 6339 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) |
| 6340 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 6341 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6342 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5905 | 6343 | |
| 6344 | PORT_START // IN1 - Player 2 |
| 6345 | PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6346 | |
| 6347 | PORT_START // IN2 |
| 6348 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 6349 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 6350 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 6351 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1) PORT_TOGGLE |
| 6352 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 ) // analyzer |
| 6353 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 ) // data clear |
| 6354 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6355 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6356 | |
| 6357 | // keyb 1 |
| 6358 | PORT_START // IN3 |
| 6359 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) // A |
| 6360 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) // E |
| 6361 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // I |
| 6362 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME(DEF_STR( Yes )) PORT_CODE(KEYCODE_Y) // M |
| 6363 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Kan |
| 6364 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) |
| 6365 | |
| 6366 | PORT_START // IN4 |
| 6367 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) // B |
| 6368 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) // F |
| 6369 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // J |
| 6370 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME(DEF_STR( No )) PORT_CODE(KEYCODE_N) // N |
| 6371 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Reach |
| 6372 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // BET |
| 6373 | |
| 6374 | PORT_START // IN5 |
| 6375 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) // C |
| 6376 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) // G |
| 6377 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // K |
| 6378 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Chi |
| 6379 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Ron |
| 6380 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6381 | |
| 6382 | PORT_START // IN6 |
| 6383 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) // D |
| 6384 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) // H |
| 6385 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // L |
| 6386 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // PON |
| 6387 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6388 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6389 | |
| 6390 | PORT_START // IN7 |
| 6391 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6392 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "t" |
| 6393 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "w" |
| 6394 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Flip Flop |
| 6395 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "b" |
| 6396 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "s" |
| 6397 | |
| 6398 | // keyb 2 |
| 6399 | PORT_START // IN8 |
| 6400 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2) // A |
| 6401 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2) // E |
| 6402 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // I |
| 6403 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2) // M |
| 6404 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Kan |
| 6405 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) |
| 6406 | |
| 6407 | PORT_START // IN9 |
| 6408 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2) // B |
| 6409 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2) // F |
| 6410 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // J |
| 6411 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2) // N |
| 6412 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Reach |
| 6413 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // BET |
| 6414 | |
| 6415 | PORT_START // IN10 |
| 6416 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2) // C |
| 6417 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2) // G |
| 6418 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // K |
| 6419 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Chi |
| 6420 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Ron |
| 6421 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6422 | |
| 6423 | PORT_START // IN11 |
| 6424 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2) // D |
| 6425 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2) // H |
| 6426 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // L |
| 6427 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // PON |
| 6428 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6429 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6430 | |
| 6431 | PORT_START // IN12 |
| 6432 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 6433 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "t" |
| 6434 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "w" |
| 6435 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Flip Flop |
| 6436 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "b" |
| 6437 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "s" |
| 6438 | |
| 6439 | PORT_START // IN13 - DSW1 |
| 6440 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) |
| 6441 | PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) |
| 6442 | PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) ) |
| 6443 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) |
| 6444 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) |
| 6445 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) |
| 6446 | PORT_DIPSETTING( 0x08, DEF_STR( Easy ) ) |
| 6447 | PORT_DIPSETTING( 0x0c, DEF_STR( Normal ) ) |
| 6448 | PORT_DIPSETTING( 0x04, DEF_STR( Hard ) ) |
| 6449 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
| 6450 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) ) |
| 6451 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 6452 | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) |
| 6453 | PORT_DIPNAME( 0x60, 0x60, "Control Panel" ) |
| 6454 | PORT_DIPSETTING( 0x60, "Hanafuda" ) |
| 6455 | PORT_DIPSETTING( 0x40, "Mahjong" ) |
| 6456 | PORT_DIPSETTING( 0x20, DEF_STR( Joystick ) ) |
| 6457 | // PORT_DIPSETTING( 0x00, DEF_STR( Joystick ) ) |
| 6458 | PORT_DIPNAME( 0x80, 0x80, "First Chance" ) |
| 6459 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 6460 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 6461 | |
| 6462 | PORT_START // IN14 - DSW2 |
| 6463 | PORT_DIPNAME( 0x03, 0x03, "Unknown 2-0&1" ) |
| 6464 | PORT_DIPSETTING( 0x03, "0" ) |
| 6465 | PORT_DIPSETTING( 0x02, "1" ) |
| 6466 | PORT_DIPSETTING( 0x01, "2" ) |
| 6467 | PORT_DIPSETTING( 0x00, "0?" ) |
| 6468 | PORT_DIPNAME( 0x04, 0x04, "Unknown 2-2" ) |
| 6469 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 6470 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6471 | PORT_DIPNAME( 0x08, 0x08, "Unknown 2-3" ) |
| 6472 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 6473 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6474 | PORT_DIPNAME( 0x10, 0x10, "Unknown 2-4" ) |
| 6475 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 6476 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6477 | PORT_DIPNAME( 0x20, 0x20, "Unknown 2-5" ) |
| 6478 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 6479 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6480 | PORT_DIPNAME( 0x40, 0x40, "Unknown 2-6" ) |
| 6481 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 6482 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6483 | PORT_DIPNAME( 0x80, 0x80, "Unknown 2-7" ) |
| 6484 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 6485 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6486 | |
| 6487 | PORT_START // IN15 - DSWs top bits |
| 6488 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) |
| 6489 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 6490 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6491 | PORT_SERVICE( 0x02, IP_ACTIVE_LOW ) |
| 6492 | PORT_DIPNAME( 0x04, 0x04, "Unknown 2-8" ) |
| 6493 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 6494 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6495 | PORT_DIPNAME( 0x08, 0x08, "Unknown 2-9" ) |
| 6496 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 6497 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6498 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 6499 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 6500 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6501 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) |
| 6502 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 6503 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6504 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 6505 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 6506 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6507 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 6508 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 6509 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 6510 | INPUT_PORTS_END |
| 6511 | |
| 6512 | |
| 5906 | 6513 | /*************************************************************************** |
| 5907 | 6514 | Don Den Lover Vol.1 |
| 5908 | 6515 | ***************************************************************************/ |
| r1070 | r1071 | |
| 6367 | 6974 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) |
| 6368 | 6975 | MACHINE_DRIVER_END |
| 6369 | 6976 | |
| 6977 | static MACHINE_DRIVER_START( hgokou ) |
| 6978 | /* basic machine hardware */ |
| 6979 | MDRV_IMPORT_FROM( quizchq ) |
| 6980 | MDRV_CPU_MODIFY("main") |
| 6981 | MDRV_CPU_PROGRAM_MAP(hgokou_readmem,hgokou_writemem) |
| 6982 | MDRV_CPU_IO_MAP(hgokou_readport,hgokou_writeport) |
| 6983 | MDRV_CPU_VBLANK_INT(hginga_irq, 1) |
| 6984 | |
| 6985 | MDRV_SOUND_ADD(AY8910, 3579545) |
| 6986 | MDRV_SOUND_CONFIG(hginga_ay8910_interface) |
| 6987 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) |
| 6988 | MACHINE_DRIVER_END |
| 6989 | |
| 6370 | 6990 | static MACHINE_DRIVER_START( mjmywrld ) |
| 6371 | 6991 | /* basic machine hardware */ |
| 6372 | 6992 | MDRV_IMPORT_FROM( mjmyster ) |
| r1070 | r1071 | |
| 6433 | 7053 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) |
| 6434 | 7054 | MACHINE_DRIVER_END |
| 6435 | 7055 | |
| 7056 | /* It runs in IM 2, thus needs a vector on the data bus: |
| 7057 | 0xee is vblank */ |
| 7058 | INTERRUPT_GEN( hparadis_irq ) |
| 7059 | { |
| 7060 | cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0xee); |
| 7061 | } |
| 6436 | 7062 | |
| 7063 | static MACHINE_DRIVER_START( hparadis ) |
| 7064 | /* basic machine hardware */ |
| 7065 | MDRV_IMPORT_FROM( quizchq ) |
| 7066 | MDRV_CPU_MODIFY("main") |
| 7067 | MDRV_CPU_PROGRAM_MAP(hparadis_readmem,hparadis_writemem) |
| 7068 | MDRV_CPU_IO_MAP(hparadis_readport,hparadis_writeport) |
| 7069 | MDRV_CPU_VBLANK_INT(hparadis_irq, 1) |
| 7070 | MACHINE_DRIVER_END |
| 7071 | |
| 7072 | |
| 6437 | 7073 | /*************************************************************************** |
| 6438 | 7074 | |
| 6439 | 7075 | Monkey Mole Panic |
| r1070 | r1071 | |
| 6665 | 7301 | ROM_LOAD( "gal16v8b.1e", 0x0000, 0x0117, CRC(cf1b6e1d) SHA1(f1db4cd0636f390d745be33026b2e9e0da599d22) ) |
| 6666 | 7302 | ROM_END |
| 6667 | 7303 | |
| 7304 | /*************************************************************************** |
| 7305 | |
| 7306 | Rong Rong (Europe) |
| 7307 | Nakanihon |
| 7308 | |
| 7309 | Revision: 6.2.14 |
| 7310 | |
| 7311 | CPU: |
| 7312 | 1x Nakanihon NL-002-3D1 (main) |
| 7313 | 1x oscillator 28.6363MHz |
| 7314 | 1x Toshiba TMPZ84C015BF-8-9328ECZ |
| 7315 | 1x OKI M6295-3372202 (sound) |
| 7316 | 1x YM2413-9344HAAG (sound) |
| 7317 | 1x Tpshiba TD62003AP-9348K |
| 7318 | 1x DYNAX 1108F405-9401EAI |
| 7319 | 1x DYNAX 4L02F2637-9337EAI |
| 7320 | 1x DYNAX 1427F0071-9232EAI |
| 7321 | |
| 7322 | ROMs: |
| 7323 | 1x M27C2001-12FI (8001W)(sound) |
| 7324 | 1x M27C4001-12FI (8002E)(sound) |
| 7325 | 2x TC534000AP (8003-8004) |
| 7326 | 2x M27C4001-12FI (8005E-8007E) |
| 7327 | 1x TMS 27C040-15 (8006E) |
| 7328 | 1x GAL16V8B-25LP |
| 7329 | |
| 7330 | ***************************************************************************/ |
| 7331 | |
| 6668 | 7332 | ROM_START( rongrngg ) |
| 6669 | 7333 | ROM_REGION( 0x118000, REGION_CPU1, 0 ) /* Z80 Code + space for banked RAM */ |
| 6670 | 7334 | ROM_LOAD( "rr_8002g.rom", 0x00000, 0x80000, CRC(9a5d2885) SHA1(9ca049085d14b1cfba6bd48adbb0b883494e7d29) ) |
| r1070 | r1071 | |
| 6682 | 7346 | ROM_LOAD( "rr_8001w.rom", 0x00000, 0x40000, CRC(8edc87a2) SHA1(87e8ad50be025263e682cbfb5623f3a35b17118f) ) |
| 6683 | 7347 | ROM_END |
| 6684 | 7348 | |
| 7349 | /*************************************************************************** |
| 6685 | 7350 | |
| 7351 | Rong Rong (Japan) |
| 7352 | (c)1994 Nakanihon (Dynax) |
| 7353 | |
| 7354 | N8010178L1 |
| 7355 | |
| 7356 | CPU : TMPZ84C015BF-8 |
| 7357 | Sound : YM2413, M6295 |
| 7358 | OSC : 28.6363MHz, ?(near CPU) |
| 7359 | DIPs : 10 position (x2) |
| 7360 | Custom: NL-002 |
| 7361 | 1427F0071 (10D) |
| 7362 | 4L02F2637 (10F) |
| 7363 | 1108F0405 (10H) |
| 7364 | |
| 7365 | ROMs : 8001.2F [9fc8a367] - Samples |
| 7366 | |
| 7367 | 8002.3E [27142684] - Main program |
| 7368 | |
| 7369 | 8003.8C [f57192e5] \ |
| 7370 | 8004.9C [c8c0b5cb] | |
| 7371 | 8005.10C [d1e5f74c] |- Blitter data |
| 7372 | 8006.11C [bcbd1b0b] | |
| 7373 | 8007.12C [c76cbb69] / |
| 7374 | |
| 7375 | ***************************************************************************/ |
| 7376 | |
| 7377 | ROM_START( rongrngj ) |
| 7378 | ROM_REGION( 0x118000, REGION_CPU1, 0 ) /* Z80 Code + space for banked RAM */ |
| 7379 | ROM_LOAD( "8002.3e", 0x00000, 0x80000, CRC(27142684) SHA1(4626576d032a89b558c8542f82b286e5673f8662) ) |
| 7380 | ROM_RELOAD( 0x10000, 0x80000 ) |
| 7381 | /* 90000-10ffff empty */ |
| 7382 | |
| 7383 | ROM_REGION( 0x240000, REGION_GFX1, 0 ) /* blitter data */ |
| 7384 | ROM_LOAD( "8003.8c", 0x000000, 0x80000, CRC(f57192e5) SHA1(e33f5243028520492cd876be3e4b6a76a9b20d46) ) |
| 7385 | ROM_LOAD( "8004.9c", 0x080000, 0x80000, CRC(c8c0b5cb) SHA1(d0c99908022b7d5d484e6d1990c00f15f7d8665a) ) |
| 7386 | ROM_LOAD( "8005.10c", 0x100000, 0x80000, CRC(d1e5f74c) SHA1(808b37a4992f27768b85eea24fd868d5c9b1e1c0) ) |
| 7387 | ROM_LOAD( "8006.11c", 0x180000, 0x80000, CRC(bcbd1b0b) SHA1(9b2f990de495b8fafbed71e9649d715f30768f0e) ) |
| 7388 | ROM_LOAD( "8007.12c", 0x200000, 0x40000, CRC(c76cbb69) SHA1(691133fb4d6669106ea10880757168c45661154f) ) |
| 7389 | |
| 7390 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* Samples */ |
| 7391 | ROM_LOAD( "8001.2f", 0x00000, 0x40000, CRC(9fc8a367) SHA1(bd8c9ddb3c1c8867321ca235f2d53cdc4c837907) ) |
| 7392 | ROM_END |
| 7393 | |
| 6686 | 7394 | /*************************************************************************** |
| 6687 | 7395 | |
| 6688 | 7396 | Netto Quiz Champion (c) Nakanihon |
| r1070 | r1071 | |
| 7516 | 8224 | |
| 7517 | 8225 | /*************************************************************************** |
| 7518 | 8226 | |
| 7519 | | Mahjong Fantastic Love |
| 8227 | Mahjong Fantasic Love |
| 7520 | 8228 | Nakanihon, 1996 |
| 7521 | 8229 | |
| 7522 | 8230 | PCB Layout |
| r1070 | r1071 | |
| 7608 | 8316 | ROM_RELOAD( 0x1c0000, 0x40000 ) |
| 7609 | 8317 | ROM_END |
| 7610 | 8318 | |
| 8319 | /*************************************************************************** |
| 7611 | 8320 | |
| 8321 | Super Hana Paradise |
| 8322 | 1995 |
| 8323 | |
| 8324 | PCB almost like Mysterious World |
| 8325 | |
| 8326 | PCB Layout |
| 8327 | ---------- |
| 8328 | N8010178L1 |
| 8329 | |-------------------------------------------------------| |
| 8330 | |MA1384 VOL 1011.2F | |
| 8331 | | 62256 | |
| 8332 | | M6295 1012.3E | |
| 8333 | | VOL 16MHz | |
| 8334 | | YM2413 TMPZ84C015 | |
| 8335 | | | |
| 8336 | |M | |
| 8337 | |A NL-002 DSW1(10)| |
| 8338 | |H | |
| 8339 | |J DSW2(10)| |
| 8340 | |O | |
| 8341 | |N | |
| 8342 | |G DIP32 | |
| 8343 | | 28.636MHz | |
| 8344 | | TC5588 DIP32 | |
| 8345 | | | |
| 8346 | | 1108F0406 4L02F2637 1427F0071 DIP32 | |
| 8347 | | | |
| 8348 | | DIP32 | |
| 8349 | | TC524258Z-10 TC524258Z-10 | |
| 8350 | | TC524258Z-10 TC524258Z-10 DIP32 | |
| 8351 | |-------------------------------------------------------| |
| 8352 | Notes: |
| 8353 | TMPZ84C015 - Toshiba TMPZ84C015F-6 (QFP100). Clocks 16.000MHz (pins 65 & 66), 8.000MHz (pins 68 & 69) |
| 8354 | 62256 - 32k x8 SRAM (DIP28) |
| 8355 | TC5588 - 8k x8 SRAM (DIP28) |
| 8356 | TC524258Z-10 - Toshiba TC524258Z-10 256k x4 Dual Port VRAM (ZIP28) |
| 8357 | 1427F0071 \ |
| 8358 | 1108F0406 | Dynax Custom ICs |
| 8359 | NL-002 | |
| 8360 | 4L02F2637 / |
| 8361 | DIP32 - Empty sockets |
| 8362 | M6295 - Oki M6295 (QFP44). Clock 1.02272MHz [28.636/28]. pin 7 = high |
| 8363 | YM2413 - Clock 3.579545MHz [28.636/8] |
| 8364 | VSync - 61Hz |
| 8365 | HSync - 15.27kHz |
| 8366 | |
| 8367 | ROM Daughterboard N73RSUB |
| 8368 | Contains the remaining ROMS, 1 PAL and nothing else |
| 8369 | 1013, 1014, 1015, 1016 |
| 8370 | |
| 8371 | -- |
| 8372 | |
| 8373 | Super Hana Paradise |
| 8374 | (c)1994 Dynax |
| 8375 | |
| 8376 | D10110258L1 |
| 8377 | |
| 8378 | CPU: TMPZ84C015BF-8 |
| 8379 | Sound: YM2413 M6295 |
| 8380 | OSC: 28.6363MHz 16AKSS |
| 8381 | Custom: NL-002 |
| 8382 | 1427F0071 |
| 8383 | 4L02F2637 |
| 8384 | 1108F0405 |
| 8385 | |
| 8386 | ROMs: |
| 8387 | 1011.2F |
| 8388 | 1012.3E |
| 8389 | |
| 8390 | Subboard |
| 8391 | 1013.1A |
| 8392 | 1014.2A |
| 8393 | 1015.3A |
| 8394 | 1016.4A |
| 8395 | |
| 8396 | ***************************************************************************/ |
| 8397 | |
| 8398 | ROM_START( hparadis ) |
| 8399 | ROM_REGION( 0x50000+8*0x1000, REGION_CPU1, 0 ) /* Z80 Code */ |
| 8400 | ROM_LOAD( "1012.3e", 0x00000, 0x40000, CRC(bd3a3a8f) SHA1(35d70c2869a93192de7041b5c90b8a8a5e910946) ) |
| 8401 | ROM_RELOAD( 0x10000, 0x40000 ) |
| 8402 | |
| 8403 | ROM_REGION( 0x600000, REGION_GFX1, 0 ) /* blitter data */ |
| 8404 | // unused |
| 8405 | ROM_LOAD( "1015.3a", 0x400000, 0x80000, CRC(ea7b282e) SHA1(4fb33f3a8fe0dd792bcdd90894b90f1ac09ef6a5) ) |
| 8406 | ROM_LOAD( "1014.2a", 0x480000, 0x80000, CRC(5f057c13) SHA1(d17211c3b697b48012018b738cff22fc4743d607) ) |
| 8407 | ROM_LOAD( "1016.4a", 0x500000, 0x80000, CRC(c8e7ffb6) SHA1(9a7df1d6b3723e56b69d56831ce32c5326764a68) ) |
| 8408 | ROM_LOAD( "1013.1a", 0x580000, 0x80000, CRC(c26b0563) SHA1(a09209c7e44fde418f917aed3a436bdf515942eb) ) |
| 8409 | |
| 8410 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* Samples */ |
| 8411 | ROM_LOAD( "1011.2f", 0x00000, 0x40000, CRC(8c852b1a) SHA1(39e3e037f441df1d7cc7a698fea3e7825f8f6984) ) |
| 8412 | ROM_END |
| 8413 | |
| 8414 | |
| 8415 | /*************************************************************************** |
| 8416 | |
| 8417 | Hanafuda Hana Gokou |
| 8418 | Dynax (Alba License), 1995 |
| 8419 | |
| 8420 | PCB almost like Mysterious World |
| 8421 | |
| 8422 | PCB Layout |
| 8423 | ---------- |
| 8424 | N83061581L1 |
| 8425 | |-------------------------------------------------------| |
| 8426 | |MB3714 VOL DSW1(10) M6242B TC55257 BATTERY | |
| 8427 | | 32.768kHz 1081.2D 1082B.2B | |
| 8428 | | VOL DSW2(10) M6295 | |
| 8429 | | DSW5(4) 16MHz | |
| 8430 | | YM2413 DSW3(10) PAL TMPZ84C015 | |
| 8431 | | | |
| 8432 | |M DSW4(10) | |
| 8433 | |A YM2149 | |
| 8434 | |H * | |
| 8435 | |J NL-002 28.63636MHz | |
| 8436 | |O PAL | |
| 8437 | |N | |
| 8438 | |G | |
| 8439 | |2 | |
| 8440 | |8 1083.9A | |
| 8441 | | | |
| 8442 | | & % # 1084.10A| |
| 8443 | | | |
| 8444 | | TC5588 DIP32 | |
| 8445 | | TC524258Z-10 TC524258Z-10 DIP32 | |
| 8446 | | TC524258Z-10 TC524258Z-10 DIP32 | |
| 8447 | |-------------------------------------------------------| |
| 8448 | Notes: |
| 8449 | TMPZ84C015 - Toshiba TMPZ84C015F-6 (QFP100). Clocks 16.000MHz (pins 65 & 66), 8.000MHz (pins 68 & 69) |
| 8450 | TC55257 - 32k x8 SRAM (DIP28) |
| 8451 | TC5588 - 8k x8 SRAM (DIP28) |
| 8452 | TC524258Z-10 - Toshiba TC524258Z-10 256k x4 Dual Port VRAM (ZIP28) |
| 8453 | & - Unknown QFP64. Possibly Dynax Custom 1108F0406 |
| 8454 | % - Unknown QFP100. Possibly Dynax Custom 4L02F2637 |
| 8455 | # - Unknown QFP100. Possibly Dynax Custom 1427F0071 |
| 8456 | * - Unknown PLCC44. Possibly MACH311 or similar CPLD |
| 8457 | DIP32 - Empty sockets |
| 8458 | M6295 - Oki M6295 (QFP44). Clock 1.02272MHz [28.63636/28]. pin 7 = HIGH |
| 8459 | YM2413 - Clock 3.579545MHz [28.63636/8] |
| 8460 | YM2149 - Clock 3.579545MHz [28.63636/8] |
| 8461 | VSync - 60Hz |
| 8462 | HSync - 15.36kHz |
| 8463 | |
| 8464 | ***************************************************************************/ |
| 8465 | |
| 8466 | ROM_START( hgokou ) |
| 8467 | ROM_REGION( 0x90000+8*0x1000, REGION_CPU1, 0 ) /* Z80 Code */ |
| 8468 | ROM_LOAD( "1082b.2b", 0x00000, 0x40000, CRC(e33bc5a5) SHA1(cb723cc81b914b45f89236812492c105c93c4e0b) ) |
| 8469 | ROM_RELOAD( 0x10000, 0x40000 ) |
| 8470 | |
| 8471 | ROM_REGION( 0x200000, REGION_GFX1, 0 ) /* blitter data */ |
| 8472 | // unused |
| 8473 | ROM_LOAD( "1083.9a", 0x100000, 0x80000, CRC(054200c3) SHA1(7db457fa1f8639d15a6faa3e1e05d4302e7dd281) ) |
| 8474 | ROM_LOAD( "1084.10a", 0x180000, 0x80000, CRC(49f657e8) SHA1(077c553f88a76f826495ad516350a53ce361c6da) ) |
| 8475 | |
| 8476 | ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* Samples */ |
| 8477 | ROM_LOAD( "1081.2d", 0x00000, 0x40000, CRC(74dede40) SHA1(d148f9ab9223b4c0b2f457a6f0e7fa3d173ab12b) ) |
| 8478 | ROM_END |
| 8479 | |
| 8480 | |
| 7612 | 8481 | GAME( 1992, mmpanic, 0, mmpanic, mmpanic, 0, ROT0, "Nakanihon + East Technology (Taito license)", "Monkey Mole Panic (USA)", GAME_NO_COCKTAIL ) |
| 7613 | 8482 | GAME( 1993, funkyfig, 0, funkyfig, funkyfig, 0, ROT0, "Nakanihon + East Technology (Taito license)", "The First Funky Fighter", GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS ) // scrolling, priority? |
| 7614 | 8483 | GAME( 1993, quizchq, 0, quizchq, quizchq, 0, ROT0, "Nakanihon", "Quiz Channel Question (Ver 1.00) (Japan)", GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| r1070 | r1071 | |
| 7621 | 8490 | GAME( 1994, mjmyuniv, 0, mjmyuniv, mjmyster, 0, ROT0, "Dynax", "Mahjong The Mysterious Universe", GAME_NO_COCKTAIL ) |
| 7622 | 8491 | GAME( 1994, quiz365, 0, quiz365, quiz365, 0, ROT0, "Nakanihon", "Quiz 365 (Japan)", GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION ) |
| 7623 | 8492 | GAME( 1994, quiz365t, quiz365, quiz365, quiz365, 0, ROT0, "Nakanihon + Taito", "Quiz 365 (Hong Kong & Taiwan)", GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION ) |
| 7624 | | GAME( 1994, rongrong, 0, rongrong, rongrong, rongrong, ROT0, "Nakanihon", "Rong Rong (Europe)", GAME_NO_COCKTAIL | GAME_IMPERFECT_COLORS ) |
| 7625 | | GAME( 1994, rongrngg, rongrong, rongrong, rongrong, rongrong, ROT0, "Nakanihon", "Rong Rong (Germany)", GAME_NO_COCKTAIL | GAME_IMPERFECT_COLORS ) |
| 8493 | GAME( 1994, rongrong, 0, rongrong, rongrong, rongrong, ROT0, "Nakanihon (Activision licence)", "Puzzle Game Rong Rong (Europe)", GAME_NO_COCKTAIL | GAME_IMPERFECT_COLORS ) |
| 8494 | GAME( 1994, rongrngj, rongrong, rongrong, rongrong, rongrong, ROT0, "Nakanihon (Activision licence)", "Puzzle Game Rong Rong (Japan)", GAME_NO_COCKTAIL | GAME_IMPERFECT_COLORS ) |
| 8495 | GAME( 1994, rongrngg, rongrong, rongrong, rongrong, rongrong, ROT0, "Nakanihon (Activision licence)", "Puzzle Game Rong Rong (Germany)", GAME_NO_COCKTAIL | GAME_IMPERFECT_COLORS ) |
| 8496 | GAME( 1994, hparadis, 0, hparadis, hparadis, 0, ROT0, "Dynax", "Super Hana Paradise (Japan)", GAME_NO_COCKTAIL ) |
| 8497 | GAME( 1995, hgokou, 0, hgokou, hgokou, 0, ROT0, "Dynax (Alba licence)", "Hanafuda Hana Gokou (Japan)", GAME_NO_COCKTAIL ) |
| 7626 | 8498 | GAME( 1995, mjdchuka, 0, mjchuuka, mjchuuka, 0, ROT0, "Dynax", "Mahjong The Dai Chuuka Ken (China, v. D111)", GAME_NO_COCKTAIL ) |
| 7627 | 8499 | GAME( 1995, nettoqc, 0, nettoqc, nettoqc, 0, ROT0, "Nakanihon", "Nettoh Quiz Champion (Japan)", GAME_NO_COCKTAIL | GAME_IMPERFECT_COLORS ) |
| 7628 | 8500 | GAME( 1995, ddenlvrj, 0, ddenlvrj, ddenlvrj, 0, ROT0, "Dynax", "Don Den Lover Vol. 1 - Shiro Kuro Tsukeyo! (Japan)", GAME_NO_COCKTAIL ) |
| r1070 | r1071 | |
| 7630 | 8502 | GAME( 1996, ddenlovb, ddenlvrj, ddenlovr, ddenlovr, 0, ROT0, "[Dynax] (bootleg)", "Don Den Lover Vol. 1 (Korea, bootleg)", GAME_NO_COCKTAIL ) |
| 7631 | 8503 | GAME( 1996, hanakanz, 0, hanakanz, hanakanz, 0, ROT0, "Dynax", "Hana Kanzashi (Japan)", GAME_NO_COCKTAIL ) |
| 7632 | 8504 | GAME( 1996, akamaru, 0, akamaru, akamaru, 0, ROT0, "Dynax (Nakanihon licence)", "Panel & Variety Akamaru Q Jousyou Dont-R", GAME_NO_COCKTAIL ) |
| 7633 | | GAME( 1996, mjflove, 0, mjflove, mjflove, 0, ROT0, "Nakanihon", "Mahjong Fantastic Love (Japan)", GAME_NO_COCKTAIL ) |
| 8505 | GAME( 1996, mjflove, 0, mjflove, mjflove, 0, ROT0, "Nakanihon", "Mahjong Fantasic Love (Japan)", GAME_NO_COCKTAIL ) |
| 7634 | 8506 | GAME( 1997, hkagerou, 0, hkagerou, hkagerou, 0, ROT0, "Nakanihon + Dynax", "Hana Kagerou [BET] (Japan)", GAME_NO_COCKTAIL ) |
| 7635 | 8507 | GAME( 1998, mjchuuka, 0, mjchuuka, mjchuuka, 0, ROT0, "Dynax", "Mahjong Chuukanejyo (China)", GAME_NO_COCKTAIL ) |
| 7636 | 8508 | GAME( 1998, mjreach1, 0, mjreach1, mjreach1, 0, ROT0, "Nihon System", "Mahjong Reach Ippatsu (Japan)", GAME_NO_COCKTAIL ) |
src/mame/drivers/gstream.c
| r1070 | r1071 | |
| 9 | 9 | Simple Sprites (16x16x8bpp tiles) |
| 10 | 10 | 3 Simple Tilemaps (32x32x8bpp tiles) |
| 11 | 11 | |
| 12 | | |
| 13 | | |
| 14 | 12 | todo: sprite lag (sprites need buffering?) |
| 15 | 13 | sound banking |
| 16 | 14 | |
| r1070 | r1071 | |
| 94 | 92 | . Board supplied by Tormod |
| 95 | 93 | . Board dumped by Tormod |
| 96 | 94 | |
| 97 | | |
| 98 | | |
| 99 | 95 | *********************************************************************/ |
| 100 | 96 | |
| 101 | 97 | #include "driver.h" |
| 102 | 98 | #include "sound/okim6295.h" |
| 103 | 99 | |
| 104 | | static UINT32* gstream_vram; |
| 105 | | static UINT32* gstream_workram; |
| 106 | | static UINT32* gstream_backupram; |
| 100 | static UINT32 *gstream_vram; |
| 101 | static UINT32 *gstream_workram; |
| 107 | 102 | |
| 108 | 103 | static tilemap *gstream_tilemap1; |
| 109 | 104 | static tilemap *gstream_tilemap2; |
| r1070 | r1071 | |
| 114 | 109 | |
| 115 | 110 | static WRITE32_HANDLER( gstream_palette_w ) |
| 116 | 111 | { |
| 117 | | |
| 118 | 112 | COMBINE_DATA(&paletteram32[offset]); |
| 119 | 113 | |
| 120 | 114 | palette_set_color_rgb(Machine,offset*2,pal5bit(paletteram32[offset] >> (0+16)), |
| r1070 | r1071 | |
| 156 | 150 | static WRITE32_HANDLER( gstream_tilemap3_scrolly_w ) { tilemap3_scrolly = data; } |
| 157 | 151 | |
| 158 | 152 | static ADDRESS_MAP_START( gstream_32bit_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 159 | | AM_RANGE(0x00000000, 0x00FFFFFF) AM_RAM AM_BASE(&gstream_workram) // work ram, how big? |
| 160 | | |
| 153 | AM_RANGE(0x00000000, 0x003FFFFF) AM_RAM AM_BASE(&gstream_workram) // work ram |
| 161 | 154 | // AM_RANGE(0x40000000, 0x40FFFFFF) AM_RAM // ?? lots of data gets copied here if present, but game runs without it?? |
| 162 | | |
| 163 | 155 | AM_RANGE(0x80000000, 0x80003FFF) AM_RAM AM_WRITE(gstream_vram_w) AM_BASE(&gstream_vram) // video ram |
| 164 | | |
| 165 | 156 | AM_RANGE(0x4E000000, 0x4E1FFFFF) AM_ROM AM_REGION(REGION_USER2,0) // main game rom |
| 166 | | |
| 167 | 157 | AM_RANGE(0x4F000000, 0x4F000003) AM_WRITE(gstream_tilemap3_scrollx_w) |
| 168 | 158 | AM_RANGE(0x4F200000, 0x4F200003) AM_WRITE(gstream_tilemap3_scrolly_w) |
| 169 | 159 | AM_RANGE(0x4F400000, 0x4F406FFF) AM_RAM AM_WRITE(gstream_palette_w) AM_BASE(&paletteram32) |
| r1070 | r1071 | |
| 171 | 161 | AM_RANGE(0x4FA00000, 0x4FA00003) AM_WRITE(gstream_tilemap1_scrolly_w) |
| 172 | 162 | AM_RANGE(0x4FC00000, 0x4FC00003) AM_WRITE(gstream_tilemap2_scrollx_w) |
| 173 | 163 | AM_RANGE(0x4FE00000, 0x4FE00003) AM_WRITE(gstream_tilemap2_scrolly_w) |
| 164 | AM_RANGE(0xFFC00000, 0xFFC01FFF) AM_RAM AM_BASE(&generic_nvram32) AM_SIZE(&generic_nvram_size) // Backup RAM |
| 165 | AM_RANGE(0xFFF80000, 0xFFFFFFFF) AM_ROM AM_REGION(REGION_USER1,0) // boot rom |
| 166 | ADDRESS_MAP_END |
| 174 | 167 | |
| 175 | | AM_RANGE(0xFFC00000, 0xFFC01FFF) AM_RAM AM_BASE(&gstream_backupram) // Backup RAM |
| 168 | static READ32_HANDLER( gstream_oki_0_r ) { return OKIM6295_status_0_r(0); } |
| 169 | static READ32_HANDLER( gstream_oki_1_r ) { return OKIM6295_status_1_r(0); } |
| 170 | static WRITE32_HANDLER( gstream_oki_0_w ) { OKIM6295_data_0_w(0, data & 0xff); } |
| 171 | static WRITE32_HANDLER( gstream_oki_1_w ) { OKIM6295_data_1_w(0, data & 0xff); } |
| 176 | 172 | |
| 177 | | AM_RANGE(0xFFF80000, 0xFFFFFFFF) AM_ROM AM_REGION(REGION_USER1,0) // boot rom |
| 173 | static WRITE32_HANDLER( gstream_oki_4030_w ) |
| 174 | { |
| 175 | /* |
| 176 | // the only nibbles that are written are: 0x6 0x7 0x9 0xa 0xb 0xe 0xd 0xf which should map to the 8 oki banks |
| 178 | 177 | |
| 179 | | ADDRESS_MAP_END |
| 178 | static const int bank_lookup[16] = { -1, -1, -1, -1, -1, -1, 0, 1, -1, 2, 3, 4, -1, 5, 6, 7 }; |
| 180 | 179 | |
| 180 | static int old_bank_0 = -1; |
| 181 | static int old_bank_1 = -1; |
| 181 | 182 | |
| 182 | | static READ32_HANDLER(player1_inputs_read) { return readinputport(0); } |
| 183 | | static READ32_HANDLER(player2_inputs_read) { return readinputport(1); } |
| 184 | | static READ32_HANDLER(gstream_unk_r) { return readinputport(2); } |
| 183 | if(bank_lookup[data & 0xf] != old_bank_0) |
| 184 | { |
| 185 | old_bank_0 = bank_lookup[data & 0xf]; |
| 185 | 186 | |
| 186 | | static READ32_HANDLER( gstream_oki_0_r ) { return OKIM6295_status_0_r(0); } |
| 187 | | static READ32_HANDLER( gstream_oki_1_r ) { return OKIM6295_status_1_r(0); } |
| 188 | | static WRITE32_HANDLER( gstream_oki_0_w ) { OKIM6295_data_0_w(0, data & 0x000000ff); } // check other bits |
| 189 | | static WRITE32_HANDLER( gstream_oki_1_w ) { OKIM6295_data_1_w(0, data & 0x000000ff); } // check other bits |
| 187 | if(old_bank_0 != -1) |
| 188 | OKIM6295_set_bank_base(0, old_bank_0 * 0x40000); |
| 189 | else |
| 190 | logerror("oki_0 banking value = %X\n",data & 0xf); |
| 191 | } |
| 190 | 192 | |
| 191 | | static WRITE32_HANDLER( gstream_oki_4030_w ) |
| 192 | | { |
| 193 | | //printf("4030: %08x\n", data); |
| 193 | if(bank_lookup[(data >> 4) & 0xf] != old_bank_1) |
| 194 | { |
| 195 | old_bank_1 = bank_lookup[(data >> 4) & 0xf]; |
| 196 | |
| 197 | if(old_bank_1 != -1) |
| 198 | OKIM6295_set_bank_base(1, old_bank_1 * 0x40000); |
| 199 | else |
| 200 | logerror("oki_1 banking value = %X\n",(data >> 4) & 0xf); |
| 201 | } |
| 202 | */ |
| 194 | 203 | } |
| 195 | 204 | |
| 196 | 205 | static WRITE32_HANDLER( gstream_oki_4040_w ) |
| 197 | 206 | { |
| 198 | | //printf("4040: %08x\n", data); |
| 207 | // data == 0 or data == 0x81 |
| 199 | 208 | } |
| 200 | 209 | |
| 201 | | |
| 202 | 210 | static ADDRESS_MAP_START( gstream_io, ADDRESS_SPACE_IO, 32 ) |
| 203 | | |
| 204 | | AM_RANGE(0x0000, 0x0003) AM_WRITE(MWA32_NOP) // unknown |
| 205 | | AM_RANGE(0x001c, 0x001f) AM_READ(MRA32_NOP) AM_WRITE(MWA32_NOP) // unknown |
| 206 | | |
| 207 | | AM_RANGE(0x4000, 0x4003) AM_READ(player1_inputs_read) |
| 208 | | AM_RANGE(0x4010, 0x4013) AM_READ(player2_inputs_read) |
| 209 | | AM_RANGE(0x4020, 0x4023) AM_READ(gstream_unk_r) // extra coin switches etc?? |
| 210 | | |
| 211 | | /* oki banking?? */ |
| 211 | AM_RANGE(0x4000, 0x4003) AM_READ(input_port_0_dword_r) |
| 212 | AM_RANGE(0x4010, 0x4013) AM_READ(input_port_1_dword_r) |
| 213 | AM_RANGE(0x4020, 0x4023) AM_READ(input_port_2_dword_r) // extra coin switches etc |
| 212 | 214 | AM_RANGE(0x4030, 0x4033) AM_WRITE(gstream_oki_4030_w) // ?? |
| 213 | 215 | AM_RANGE(0x4040, 0x4043) AM_WRITE(gstream_oki_4040_w) // ?? |
| 214 | | |
| 215 | | AM_RANGE(0x4050, 0x4053) AM_READ(gstream_oki_1_r) AM_WRITE(gstream_oki_1_w) // music |
| 216 | | AM_RANGE(0x4060, 0x4063) AM_READ(gstream_oki_0_r) AM_WRITE(gstream_oki_0_w) // samples |
| 216 | AM_RANGE(0x4050, 0x4053) AM_READWRITE(gstream_oki_1_r, gstream_oki_1_w) // music |
| 217 | AM_RANGE(0x4060, 0x4063) AM_READWRITE(gstream_oki_0_r, gstream_oki_0_w) // samples |
| 217 | 218 | ADDRESS_MAP_END |
| 218 | 219 | |
| 219 | 220 | |
| 220 | 221 | static INPUT_PORTS_START( gstream ) |
| 221 | 222 | PORT_START |
| 222 | | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 223 | | PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 224 | | PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) |
| 225 | | PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) |
| 226 | | PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 227 | | PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 228 | | PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) |
| 229 | | PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) |
| 230 | | PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 231 | | PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 232 | | PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_START1 ) |
| 233 | | PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 234 | | PORT_DIPNAME( 0x00001000, 0x00001000, DEF_STR( Unknown ) ) |
| 235 | | PORT_DIPSETTING( 0x00001000, DEF_STR( Off ) ) |
| 236 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 237 | | PORT_DIPNAME( 0x00002000, 0x00002000, DEF_STR( Unknown ) ) |
| 238 | | PORT_DIPSETTING( 0x00002000, DEF_STR( Off ) ) |
| 239 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 240 | | PORT_DIPNAME( 0x00004000, 0x00004000, DEF_STR( Unknown ) ) |
| 241 | | PORT_DIPSETTING( 0x00004000, DEF_STR( Off ) ) |
| 242 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 243 | | PORT_DIPNAME( 0x00008000, 0x00008000, DEF_STR( Unknown ) ) // test1? |
| 244 | | PORT_DIPSETTING( 0x00008000, DEF_STR( Off ) ) |
| 245 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 223 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| 224 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) |
| 225 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) |
| 226 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) |
| 227 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 228 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 229 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) |
| 230 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) |
| 231 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 232 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 233 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START1 ) |
| 234 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 235 | PORT_BIT( 0xe000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 236 | PORT_SERVICE_NO_TOGGLE( 0x8000, IP_ACTIVE_LOW ) |
| 246 | 237 | |
| 247 | 238 | PORT_START |
| 248 | | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 249 | | PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 250 | | PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 251 | | PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| 252 | | PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 253 | | PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 254 | | PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 255 | | PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) |
| 256 | | PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 257 | | PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 258 | | PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_START2 ) |
| 259 | | PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_SERVICE2 ) |
| 260 | | PORT_DIPNAME( 0x00001000, 0x00001000, DEF_STR( Unknown ) ) |
| 261 | | PORT_DIPSETTING( 0x00001000, DEF_STR( Off ) ) |
| 262 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 263 | | PORT_DIPNAME( 0x00002000, 0x00002000, DEF_STR( Unknown ) ) |
| 264 | | PORT_DIPSETTING( 0x00002000, DEF_STR( Off ) ) |
| 265 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 266 | | PORT_DIPNAME( 0x00004000, 0x00004000, DEF_STR( Unknown ) ) |
| 267 | | PORT_DIPSETTING( 0x00004000, DEF_STR( Off ) ) |
| 268 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 269 | | PORT_DIPNAME( 0x00008000, 0x00008000, DEF_STR( Unknown ) ) // test 2? |
| 270 | | PORT_DIPSETTING( 0x00008000, DEF_STR( Off ) ) |
| 271 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 239 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 240 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 241 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 242 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| 243 | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 244 | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 245 | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 246 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) |
| 247 | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 248 | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 249 | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START2 ) |
| 250 | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_SERVICE2 ) |
| 251 | PORT_BIT( 0xe000, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 252 | PORT_SERVICE_NO_TOGGLE( 0x8000, IP_ACTIVE_LOW ) |
| 272 | 253 | |
| 273 | 254 | PORT_START |
| 274 | | PORT_DIPNAME( 0x00000001, 0x00000001, "0" ) |
| 275 | | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 276 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 277 | | PORT_DIPNAME( 0x00000002, 0x00000002, DEF_STR( Unknown ) ) |
| 278 | | PORT_DIPSETTING( 0x00000002, DEF_STR( Off ) ) |
| 279 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 280 | | PORT_DIPNAME( 0x00000004, 0x00000004, DEF_STR( Unknown ) ) |
| 281 | | PORT_DIPSETTING( 0x00000004, DEF_STR( Off ) ) |
| 282 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 283 | | PORT_DIPNAME( 0x00000008, 0x00000008, DEF_STR( Unknown ) ) |
| 284 | | PORT_DIPSETTING( 0x00000008, DEF_STR( Off ) ) |
| 285 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 286 | | PORT_DIPNAME( 0x00000010, 0x00000010, DEF_STR( Unknown ) ) |
| 287 | | PORT_DIPSETTING( 0x00000010, DEF_STR( Off ) ) |
| 288 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 289 | | PORT_DIPNAME( 0x00000020, 0x00000020, DEF_STR( Unknown ) ) |
| 290 | | PORT_DIPSETTING( 0x00000020, DEF_STR( Off ) ) |
| 291 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 292 | | PORT_DIPNAME( 0x00000040, 0x00000040, DEF_STR( Unknown ) ) |
| 293 | | PORT_DIPSETTING( 0x00000040, DEF_STR( Off ) ) |
| 294 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 295 | | PORT_DIPNAME( 0x00000080, 0x00000080, DEF_STR( Unknown ) ) |
| 296 | | PORT_DIPSETTING( 0x00000080, DEF_STR( Off ) ) |
| 297 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 298 | | PORT_DIPNAME( 0x00000100, 0x00000100, DEF_STR( Unknown ) ) |
| 299 | | PORT_DIPSETTING( 0x00000100, DEF_STR( Off ) ) |
| 300 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 301 | | PORT_DIPNAME( 0x00000200, 0x00000200, DEF_STR( Unknown ) ) |
| 302 | | PORT_DIPSETTING( 0x00000200, DEF_STR( Off ) ) |
| 303 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 304 | | PORT_DIPNAME( 0x00000400, 0x00000400, DEF_STR( Unknown ) ) |
| 305 | | PORT_DIPSETTING( 0x00000400, DEF_STR( Off ) ) |
| 306 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 307 | | PORT_DIPNAME( 0x00000800, 0x00000800, DEF_STR( Unknown ) ) |
| 308 | | PORT_DIPSETTING( 0x00000800, DEF_STR( Off ) ) |
| 309 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 310 | | PORT_DIPNAME( 0x00001000, 0x00001000, DEF_STR( Unknown ) ) |
| 311 | | PORT_DIPSETTING( 0x00001000, DEF_STR( Off ) ) |
| 312 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 313 | | PORT_DIPNAME( 0x00002000, 0x00002000, DEF_STR( Unknown ) ) |
| 314 | | PORT_DIPSETTING( 0x00002000, DEF_STR( Off ) ) |
| 315 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 316 | | PORT_DIPNAME( 0x00004000, 0x00004000, DEF_STR( Unknown ) ) |
| 317 | | PORT_DIPSETTING( 0x00004000, DEF_STR( Off ) ) |
| 318 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 319 | | PORT_DIPNAME( 0x00008000, 0x00008000, DEF_STR( Unknown ) ) |
| 320 | | PORT_DIPSETTING( 0x00008000, DEF_STR( Off ) ) |
| 321 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 322 | | PORT_DIPNAME( 0x00010000, 0x00010000, "1" ) |
| 323 | | PORT_DIPSETTING( 0x00010000, DEF_STR( Off ) ) |
| 324 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 325 | | PORT_DIPNAME( 0x00020000, 0x00020000, DEF_STR( Unknown ) ) |
| 326 | | PORT_DIPSETTING( 0x00020000, DEF_STR( Off ) ) |
| 327 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 328 | | PORT_DIPNAME( 0x00040000, 0x00040000, DEF_STR( Unknown ) ) |
| 329 | | PORT_DIPSETTING( 0x00040000, DEF_STR( Off ) ) |
| 330 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 331 | | PORT_DIPNAME( 0x00080000, 0x00080000, DEF_STR( Unknown ) ) |
| 332 | | PORT_DIPSETTING( 0x00080000, DEF_STR( Off ) ) |
| 333 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 334 | | PORT_DIPNAME( 0x00100000, 0x00100000, DEF_STR( Unknown ) ) |
| 335 | | PORT_DIPSETTING( 0x00100000, DEF_STR( Off ) ) |
| 336 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 337 | | PORT_DIPNAME( 0x00200000, 0x00200000, DEF_STR( Unknown ) ) |
| 338 | | PORT_DIPSETTING( 0x00200000, DEF_STR( Off ) ) |
| 339 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 340 | | PORT_DIPNAME( 0x00400000, 0x00400000, DEF_STR( Unknown ) ) |
| 341 | | PORT_DIPSETTING( 0x00400000, DEF_STR( Off ) ) |
| 342 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 343 | | PORT_DIPNAME( 0x00800000, 0x00800000, DEF_STR( Unknown ) ) |
| 344 | | PORT_DIPSETTING( 0x00800000, DEF_STR( Off ) ) |
| 345 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 346 | | PORT_DIPNAME( 0x01000000, 0x01000000, DEF_STR( Unknown ) ) |
| 347 | | PORT_DIPSETTING( 0x01000000, DEF_STR( Off ) ) |
| 348 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 349 | | PORT_DIPNAME( 0x02000000, 0x02000000, DEF_STR( Unknown ) ) |
| 350 | | PORT_DIPSETTING( 0x02000000, DEF_STR( Off ) ) |
| 351 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 352 | | PORT_DIPNAME( 0x04000000, 0x04000000, DEF_STR( Unknown ) ) |
| 353 | | PORT_DIPSETTING( 0x04000000, DEF_STR( Off ) ) |
| 354 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 355 | | PORT_DIPNAME( 0x08000000, 0x08000000, DEF_STR( Unknown ) ) |
| 356 | | PORT_DIPSETTING( 0x08000000, DEF_STR( Off ) ) |
| 357 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 358 | | PORT_DIPNAME( 0x10000000, 0x10000000, DEF_STR( Unknown ) ) |
| 359 | | PORT_DIPSETTING( 0x10000000, DEF_STR( Off ) ) |
| 360 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 361 | | PORT_DIPNAME( 0x20000000, 0x20000000, DEF_STR( Unknown ) ) |
| 362 | | PORT_DIPSETTING( 0x20000000, DEF_STR( Off ) ) |
| 363 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 364 | | PORT_DIPNAME( 0x40000000, 0x40000000, DEF_STR( Unknown ) ) |
| 365 | | PORT_DIPSETTING( 0x40000000, DEF_STR( Off ) ) |
| 366 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 367 | | PORT_DIPNAME( 0x80000000, 0x80000000, DEF_STR( Unknown ) ) |
| 368 | | PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) |
| 369 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 370 | | |
| 371 | | PORT_START |
| 372 | | PORT_DIPNAME( 0x00000001, 0x00000001, "2" ) |
| 373 | | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 374 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 375 | | PORT_DIPNAME( 0x00000002, 0x00000002, DEF_STR( Unknown ) ) |
| 376 | | PORT_DIPSETTING( 0x00000002, DEF_STR( Off ) ) |
| 377 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 378 | | PORT_DIPNAME( 0x00000004, 0x00000004, DEF_STR( Unknown ) ) |
| 379 | | PORT_DIPSETTING( 0x00000004, DEF_STR( Off ) ) |
| 380 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 381 | | PORT_DIPNAME( 0x00000008, 0x00000008, DEF_STR( Unknown ) ) |
| 382 | | PORT_DIPSETTING( 0x00000008, DEF_STR( Off ) ) |
| 383 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 384 | | PORT_DIPNAME( 0x00000010, 0x00000010, DEF_STR( Unknown ) ) |
| 385 | | PORT_DIPSETTING( 0x00000010, DEF_STR( Off ) ) |
| 386 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 387 | | PORT_DIPNAME( 0x00000020, 0x00000020, DEF_STR( Unknown ) ) |
| 388 | | PORT_DIPSETTING( 0x00000020, DEF_STR( Off ) ) |
| 389 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 390 | | PORT_DIPNAME( 0x00000040, 0x00000040, DEF_STR( Unknown ) ) |
| 391 | | PORT_DIPSETTING( 0x00000040, DEF_STR( Off ) ) |
| 392 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 393 | | PORT_DIPNAME( 0x00000080, 0x00000080, DEF_STR( Unknown ) ) |
| 394 | | PORT_DIPSETTING( 0x00000080, DEF_STR( Off ) ) |
| 395 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 396 | | PORT_DIPNAME( 0x00000100, 0x00000100, DEF_STR( Unknown ) ) |
| 397 | | PORT_DIPSETTING( 0x00000100, DEF_STR( Off ) ) |
| 398 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 399 | | PORT_DIPNAME( 0x00000200, 0x00000200, DEF_STR( Unknown ) ) |
| 400 | | PORT_DIPSETTING( 0x00000200, DEF_STR( Off ) ) |
| 401 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 402 | | PORT_DIPNAME( 0x00000400, 0x00000400, DEF_STR( Unknown ) ) |
| 403 | | PORT_DIPSETTING( 0x00000400, DEF_STR( Off ) ) |
| 404 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 405 | | PORT_DIPNAME( 0x00000800, 0x00000800, DEF_STR( Unknown ) ) |
| 406 | | PORT_DIPSETTING( 0x00000800, DEF_STR( Off ) ) |
| 407 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 408 | | PORT_DIPNAME( 0x00001000, 0x00001000, DEF_STR( Unknown ) ) |
| 409 | | PORT_DIPSETTING( 0x00001000, DEF_STR( Off ) ) |
| 410 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 411 | | PORT_DIPNAME( 0x00002000, 0x00002000, DEF_STR( Unknown ) ) |
| 412 | | PORT_DIPSETTING( 0x00002000, DEF_STR( Off ) ) |
| 413 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 414 | | PORT_DIPNAME( 0x00004000, 0x00004000, DEF_STR( Unknown ) ) |
| 415 | | PORT_DIPSETTING( 0x00004000, DEF_STR( Off ) ) |
| 416 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 417 | | PORT_DIPNAME( 0x00008000, 0x00008000, DEF_STR( Unknown ) ) |
| 418 | | PORT_DIPSETTING( 0x00008000, DEF_STR( Off ) ) |
| 419 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 420 | | PORT_DIPNAME( 0x00010000, 0x00010000, "3" ) |
| 421 | | PORT_DIPSETTING( 0x00010000, DEF_STR( Off ) ) |
| 422 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 423 | | PORT_DIPNAME( 0x00020000, 0x00020000, DEF_STR( Unknown ) ) |
| 424 | | PORT_DIPSETTING( 0x00020000, DEF_STR( Off ) ) |
| 425 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 426 | | PORT_DIPNAME( 0x00040000, 0x00040000, DEF_STR( Unknown ) ) |
| 427 | | PORT_DIPSETTING( 0x00040000, DEF_STR( Off ) ) |
| 428 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 429 | | PORT_DIPNAME( 0x00080000, 0x00080000, DEF_STR( Unknown ) ) |
| 430 | | PORT_DIPSETTING( 0x00080000, DEF_STR( Off ) ) |
| 431 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 432 | | PORT_DIPNAME( 0x00100000, 0x00100000, DEF_STR( Unknown ) ) |
| 433 | | PORT_DIPSETTING( 0x00100000, DEF_STR( Off ) ) |
| 434 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 435 | | PORT_DIPNAME( 0x00200000, 0x00200000, DEF_STR( Unknown ) ) |
| 436 | | PORT_DIPSETTING( 0x00200000, DEF_STR( Off ) ) |
| 437 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 438 | | PORT_DIPNAME( 0x00400000, 0x00400000, DEF_STR( Unknown ) ) |
| 439 | | PORT_DIPSETTING( 0x00400000, DEF_STR( Off ) ) |
| 440 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 441 | | PORT_DIPNAME( 0x00800000, 0x00800000, DEF_STR( Unknown ) ) |
| 442 | | PORT_DIPSETTING( 0x00800000, DEF_STR( Off ) ) |
| 443 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 444 | | PORT_DIPNAME( 0x01000000, 0x01000000, DEF_STR( Unknown ) ) |
| 445 | | PORT_DIPSETTING( 0x01000000, DEF_STR( Off ) ) |
| 446 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 447 | | PORT_DIPNAME( 0x02000000, 0x02000000, DEF_STR( Unknown ) ) |
| 448 | | PORT_DIPSETTING( 0x02000000, DEF_STR( Off ) ) |
| 449 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 450 | | PORT_DIPNAME( 0x04000000, 0x04000000, DEF_STR( Unknown ) ) |
| 451 | | PORT_DIPSETTING( 0x04000000, DEF_STR( Off ) ) |
| 452 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 453 | | PORT_DIPNAME( 0x08000000, 0x08000000, DEF_STR( Unknown ) ) |
| 454 | | PORT_DIPSETTING( 0x08000000, DEF_STR( Off ) ) |
| 455 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 456 | | PORT_DIPNAME( 0x10000000, 0x10000000, DEF_STR( Unknown ) ) |
| 457 | | PORT_DIPSETTING( 0x10000000, DEF_STR( Off ) ) |
| 458 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 459 | | PORT_DIPNAME( 0x20000000, 0x20000000, DEF_STR( Unknown ) ) |
| 460 | | PORT_DIPSETTING( 0x20000000, DEF_STR( Off ) ) |
| 461 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 462 | | PORT_DIPNAME( 0x40000000, 0x40000000, DEF_STR( Unknown ) ) |
| 463 | | PORT_DIPSETTING( 0x40000000, DEF_STR( Off ) ) |
| 464 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 465 | | PORT_DIPNAME( 0x80000000, 0x80000000, DEF_STR( Unknown ) ) |
| 466 | | PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) |
| 467 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 468 | | |
| 255 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) // mirror of some inputs... |
| 256 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 257 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) |
| 258 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 ) |
| 259 | PORT_BIT( 0xffb0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 260 | PORT_SERVICE_NO_TOGGLE( 0x40, IP_ACTIVE_LOW ) |
| 469 | 261 | INPUT_PORTS_END |
| 470 | 262 | |
| 471 | 263 | |
| 472 | | static const gfx_layout sprites_layout = |
| 264 | static const gfx_layout layout16x16 = |
| 473 | 265 | { |
| 474 | 266 | 16,16, |
| 475 | 267 | RGN_FRAC(1,1), |
| r1070 | r1071 | |
| 480 | 272 | 16*128, |
| 481 | 273 | }; |
| 482 | 274 | |
| 483 | | static const gfx_layout sprites32_layout = |
| 275 | static const gfx_layout layout32x32 = |
| 484 | 276 | { |
| 485 | 277 | 32,32, |
| 486 | 278 | RGN_FRAC(1,1), |
| r1070 | r1071 | |
| 499 | 291 | }; |
| 500 | 292 | |
| 501 | 293 | static GFXDECODE_START( gstream ) |
| 502 | | GFXDECODE_ENTRY( REGION_GFX2, 0, sprites32_layout, 0, 0x80 ) |
| 503 | | GFXDECODE_ENTRY( REGION_GFX1, 0, sprites_layout, 0, 0x80 ) |
| 294 | GFXDECODE_ENTRY( REGION_GFX2, 0, layout32x32, 0, 0x80 ) |
| 295 | GFXDECODE_ENTRY( REGION_GFX1, 0, layout16x16, 0, 0x80 ) |
| 504 | 296 | GFXDECODE_END |
| 505 | 297 | |
| 506 | 298 | |
| 299 | |
| 507 | 300 | static TILE_GET_INFO( get_gs1_tile_info ) |
| 508 | 301 | { |
| 509 | 302 | int tileno, palette; |
| r1070 | r1071 | |
| 549 | 342 | Sprites start at the top of memory, tilemaps at |
| 550 | 343 | the bottom, but the areas can overlap |
| 551 | 344 | |
| 552 | | *potential problem* |
| 345 | *What seems an actual game bug* |
| 553 | 346 | when a sprite ends up with a negative co-ordinate |
| 554 | 347 | a value of 0xfffffffe gets set in the sprite list. |
| 555 | 348 | this could corrupt the tile value as both words |
| 556 | | are being set ?! -- todo, check if this happens |
| 557 | | and if it does figure out if its a core bug |
| 558 | | |
| 349 | are being set ?! |
| 559 | 350 | */ |
| 560 | 351 | |
| 561 | 352 | int i; |
| r1070 | r1071 | |
| 571 | 362 | tilemap_set_scrollx( gstream_tilemap2, 0, tilemap2_scrollx>>16 ); |
| 572 | 363 | tilemap_set_scrolly( gstream_tilemap2, 0, tilemap2_scrolly>>16 ); |
| 573 | 364 | |
| 574 | | |
| 575 | | |
| 576 | | fillbitmap(bitmap,get_black_pen(machine),cliprect); |
| 577 | 365 | tilemap_draw(bitmap,cliprect,gstream_tilemap3,0,0); |
| 578 | 366 | tilemap_draw(bitmap,cliprect,gstream_tilemap2,0,0); |
| 579 | 367 | tilemap_draw(bitmap,cliprect,gstream_tilemap1,0,0); |
| r1070 | r1071 | |
| 581 | 369 | for (i=0x0000/4;i<0x4000/4;i+=4) |
| 582 | 370 | { |
| 583 | 371 | /* Upper bits are used by the tilemaps */ |
| 584 | | int code = (gstream_vram[i+0]&0x0000ffff); |
| 585 | | int x = (gstream_vram[i+1]&0x0000ffff); |
| 586 | | int y = (gstream_vram[i+2]&0x0000ffff); |
| 587 | | int col = (gstream_vram[i+3]&0x0000ffff)&0x1f; |
| 372 | int code = gstream_vram[i+0] & 0xffff; |
| 373 | int x = gstream_vram[i+1] & 0xffff; |
| 374 | int y = gstream_vram[i+2] & 0xffff; |
| 375 | int col = gstream_vram[i+3] & 0x1f; |
| 588 | 376 | |
| 589 | 377 | /* co-ordinates are signed */ |
| 590 | | if (x&0x8000) x-=0x10000; |
| 591 | | if (y&0x8000) y-=0x10000; |
| 378 | if (x & 0x8000) x-=0x10000; |
| 379 | if (y & 0x8000) y-=0x10000; |
| 592 | 380 | |
| 593 | | drawgfx(bitmap,machine->gfx[1],code,col,0,0,x+1,y+1,cliprect,TRANSPARENCY_PEN,0); |
| 381 | drawgfx(bitmap,machine->gfx[1],code,col,0,0,x-2,y,cliprect,TRANSPARENCY_PEN,0); |
| 594 | 382 | } |
| 595 | 383 | |
| 596 | | |
| 597 | 384 | return 0; |
| 598 | 385 | } |
| 599 | 386 | |
| 600 | | |
| 601 | | static NVRAM_HANDLER( gstream ) |
| 602 | | { |
| 603 | | if (read_or_write) |
| 604 | | { |
| 605 | | mame_fwrite(file, (UINT8*)gstream_backupram, 0x2000); |
| 606 | | } |
| 607 | | else |
| 608 | | { |
| 609 | | if (file) |
| 610 | | { |
| 611 | | mame_fread(file, (UINT8*)gstream_backupram, 0x2000); |
| 612 | | } |
| 613 | | else |
| 614 | | { |
| 615 | | /* Initialize NVRAM to defaults to avoid ambiguous 'RAM ERROR' message */ |
| 616 | | int i; |
| 617 | | UINT32 data[32] = { |
| 618 | | 0x00000001, 0x00000000, 0x00000001, 0x00000001, |
| 619 | | 0x00000001, 0x00000000, 0x00000000, 0x00000001, |
| 620 | | 0x00000000, 0x00000002, 0x00000000, 0x00000000, |
| 621 | | 0x000F4240, 0x082E2E2E, 0x000DBBA0, 0x072E2E2E, |
| 622 | | 0x000C3500, 0x062E2E2E, 0x000AAE60, 0x052E2E2E, |
| 623 | | 0x000927C0, 0x042E2E2E, 0x0007A120, 0x032E2E2E, |
| 624 | | 0x00061A80, 0x022E2E2E, 0x000493E0, 0x012E2E2E, |
| 625 | | 0x00030D40, 0x012E2E2E, 0x000186A0, 0x012E2E2E |
| 626 | | |
| 627 | | }; |
| 628 | | |
| 629 | | memset(gstream_backupram, 0, 0x2000); |
| 630 | | for(i=0;i<32;i++) |
| 631 | | gstream_backupram[i] = data[i]; |
| 632 | | |
| 633 | | gstream_backupram[(0x2000-4)/4] = 0x4B42290E; |
| 634 | | |
| 635 | | } |
| 636 | | } |
| 637 | | |
| 638 | | } |
| 639 | | |
| 640 | | |
| 641 | 387 | static MACHINE_DRIVER_START( gstream ) |
| 642 | 388 | MDRV_CPU_ADD_TAG("main", E132XT, 16000000) /* 16 Mhz? */ |
| 643 | 389 | MDRV_CPU_PROGRAM_MAP(gstream_32bit_map,0) |
| r1070 | r1071 | |
| 656 | 402 | MDRV_PALETTE_LENGTH(0x1000 + 0x400 + 0x400 + 0x400) // sprites + 3 bg layers |
| 657 | 403 | MDRV_GFXDECODE(gstream) |
| 658 | 404 | |
| 659 | | MDRV_NVRAM_HANDLER(gstream) |
| 405 | MDRV_NVRAM_HANDLER(generic_1fill) |
| 660 | 406 | |
| 661 | 407 | MDRV_VIDEO_START(gstream) |
| 662 | 408 | MDRV_VIDEO_UPDATE(gstream) |
| 663 | 409 | |
| 664 | | MDRV_SPEAKER_STANDARD_STEREO("left", "right") |
| 410 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 665 | 411 | |
| 666 | 412 | MDRV_SOUND_ADD(OKIM6295, 1000000) /* 1 Mhz? */ |
| 667 | 413 | MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7low) // pin 7 not verified |
| 668 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.50) |
| 669 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.50) |
| 414 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 670 | 415 | |
| 671 | 416 | MDRV_SOUND_ADD(OKIM6295, 1000000) /* 1 Mhz? */ |
| 672 | 417 | MDRV_SOUND_CONFIG(okim6295_interface_region_2_pin7low) // pin 7 not verified |
| 673 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.50) |
| 674 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.50) |
| 418 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 675 | 419 | MACHINE_DRIVER_END |
| 676 | 420 | |
| 677 | | |
| 678 | 421 | ROM_START( gstream ) |
| 679 | 422 | ROM_REGION32_BE( 0x080000, REGION_USER1, 0 ) /* Hyperstone CPU Code */ |
| 680 | 423 | ROM_LOAD( "u56.bin", 0x000000, 0x080000, CRC(0d0c6a38) SHA1(a810bfc1c9158cccc37710d0ea7268e26e520cc2) ) |
| r1070 | r1071 | |
| 682 | 425 | ROM_REGION32_BE( 0x200000, REGION_USER2, 0 ) /* Hyperstone CPU Code */ |
| 683 | 426 | ROM_LOAD16_WORD_SWAP( "gs_prg_02.bin", 0x000000, 0x200000, CRC(2f8a6bea) SHA1(c0a32838f4bd8599f09002139f87562db625c1c5) ) |
| 684 | 427 | |
| 685 | | ROM_REGION( 0x1000000, REGION_GFX1, ROMREGION_DISPOSE | ROMREGION_ERASE00 ) /* sprite tiles (16x16x8) */ |
| 428 | ROM_REGION( 0x1000000, REGION_GFX1, ROMREGION_DISPOSE ) /* sprite tiles (16x16x8) */ |
| 686 | 429 | ROM_LOAD32_WORD( "gs_gr_07.bin", 0x000000, 0x200000, CRC(84e66fe1) SHA1(73d828714f9ed9baffdc06998f5bf3298396fe9c) ) |
| 687 | 430 | ROM_LOAD32_WORD( "gs_gr_11.bin", 0x000002, 0x200000, CRC(946d71d1) SHA1(516bd3f4d7f5bce59f0593ed6565114dbd5a4ef0) ) |
| 688 | 431 | ROM_LOAD32_WORD( "gs_gr_08.bin", 0x400000, 0x200000, CRC(abd0d6aa) SHA1(dd294bbdda05697df84247257f735ab51bc26ca3) ) |
| r1070 | r1071 | |
| 692 | 435 | ROM_LOAD32_WORD( "gs_gr_10.bin", 0xc00000, 0x200000, CRC(d696d15d) SHA1(85aaa5cdb35f3a8d3266bb8debec0558c860cb53) ) |
| 693 | 436 | ROM_LOAD32_WORD( "gs_gr_14.bin", 0xc00002, 0x200000, CRC(6bd2a1e1) SHA1(aedca91643f14ececc101a7708255ce9b1d70f68) ) |
| 694 | 437 | |
| 695 | | ROM_REGION( 0x1000000, REGION_GFX2, ROMREGION_DISPOSE | ROMREGION_ERASE00 ) /* bg tiles (32x32x8) */ |
| 438 | ROM_REGION( 0xc00000, REGION_GFX2, ROMREGION_DISPOSE ) /* bg tiles (32x32x8) */ |
| 696 | 439 | ROM_LOAD( "gs_gr_01.bin", 0x000000, 0x200000, CRC(b82cfab8) SHA1(08f0eaef5c927fb056c6cc9342e39f445aae9062) ) |
| 697 | 440 | ROM_LOAD( "gs_gr_02.bin", 0x200000, 0x200000, CRC(37e19cbd) SHA1(490ebb037fce09100ec4bba3f73ecdf101526641) ) |
| 698 | 441 | ROM_LOAD( "gs_gr_03.bin", 0x400000, 0x200000, CRC(1a3b2b11) SHA1(a4b1dc1a9709f8f8f2ab2190d7badc246caa540f) ) |
| r1070 | r1071 | |
| 700 | 443 | ROM_LOAD( "gs_gr_05.bin", 0x800000, 0x200000, CRC(ef283a73) SHA1(8b598facb344eac33138611abc141a2acb375983) ) |
| 701 | 444 | ROM_LOAD( "gs_gr_06.bin", 0xa00000, 0x200000, CRC(d4e3a2b2) SHA1(4577c007172c718bf7ca55a8ccee5455c281026c) ) |
| 702 | 445 | |
| 703 | | ROM_REGION( 0x100000, REGION_SOUND1, 0 ) |
| 704 | | ROM_LOAD( "gs_snd_01.bin", 0x080000, 0x080000, CRC(79b64d3f) SHA1(b2166210d3a3b85b9ace90749a444c881f69d551) ) |
| 705 | | ROM_LOAD( "gs_snd_03.bin", 0x000000, 0x080000, CRC(2bfff4ac) SHA1(cce1bb3c78b86722c926854c737f9589806012ba) ) |
| 446 | ROM_REGION( 0x200000, REGION_SOUND1, 0 ) |
| 447 | ROM_LOAD( "gs_snd_01.bin", 0x000000, 0x080000, CRC(79b64d3f) SHA1(b2166210d3a3b85b9ace90749a444c881f69d551) ) |
| 448 | ROM_LOAD( "gs_snd_02.bin", 0x080000, 0x080000, CRC(e49ed92c) SHA1(a3d7b3fe93a786a246acf2657d9056398c793078) ) |
| 449 | ROM_LOAD( "gs_snd_03.bin", 0x100000, 0x080000, CRC(2bfff4ac) SHA1(cce1bb3c78b86722c926854c737f9589806012ba) ) |
| 450 | ROM_LOAD( "gs_snd_04.bin", 0x180000, 0x080000, CRC(b259de3b) SHA1(1a64f41d4344fefad5832332f1a7655e23f6b017) ) |
| 706 | 451 | |
| 707 | | ROM_REGION( 0x100000, REGION_SOUND2, 0 ) |
| 708 | | ROM_LOAD( "gs_snd_02.bin", 0x000000, 0x080000, CRC(e49ed92c) SHA1(a3d7b3fe93a786a246acf2657d9056398c793078) ) |
| 709 | | ROM_LOAD( "gs_snd_04.bin", 0x080000, 0x080000, CRC(b259de3b) SHA1(1a64f41d4344fefad5832332f1a7655e23f6b017) ) |
| 452 | ROM_REGION( 0x200000, REGION_SOUND2, 0 ) |
| 453 | ROM_COPY( REGION_SOUND1, 0, 0, 0x200000 ) |
| 710 | 454 | ROM_END |
| 711 | 455 | |
| 712 | 456 | static READ32_HANDLER( gstream_speedup_r ) |
| 713 | 457 | { |
| 714 | | if (activecpu_get_pc()==0xc0001592) {cpu_spinuntil_int();return gstream_workram[0xd1ee0/4];} |
| 458 | if (activecpu_get_pc()==0xc0001592) |
| 459 | { |
| 460 | cpu_spinuntil_int(); |
| 461 | } |
| 462 | |
| 715 | 463 | return gstream_workram[0xd1ee0/4]; |
| 716 | 464 | } |
| 717 | 465 | |
| r1070 | r1071 | |
| 720 | 468 | memory_install_read32_handler(0, ADDRESS_SPACE_PROGRAM, 0xd1ee0, 0xd1ee3, 0, 0, gstream_speedup_r ); |
| 721 | 469 | |
| 722 | 470 | } |
| 723 | | GAME( 2002, gstream, 0, gstream, gstream, gstream, ROT270, "Oriental Soft Japan", "G-Stream G2020", GAME_IMPERFECT_SOUND ) |
| 471 | GAME( 2002, gstream, 0, gstream, gstream, gstream, ROT270, "Oriental Soft Japan", "G-Stream G2020", GAME_IMPERFECT_SOUND ) |
src/mame/drivers/galaga.c
| r1070 | r1071 | |
| 706 | 706 | #include "rescap.h" |
| 707 | 707 | #include "sound/samples.h" |
| 708 | 708 | #include "audio/namco54.h" |
| 709 | #include "nam_cust.h" |
| 709 | 710 | |
| 710 | 711 | |
| 711 | | |
| 712 | 712 | static INTERRUPT_GEN( galaga_cpu3_nmi ) |
| 713 | 713 | { |
| 714 | 714 | /* see notes at the top of the driver */ |
| r1070 | r1071 | |
| 1893 | 1893 | |
| 1894 | 1894 | ***************************************************************************/ |
| 1895 | 1895 | |
| 1896 | /********************************************************************************************** |
| 1897 | Bosconian & clones |
| 1898 | **********************************************************************************************/ |
| 1899 | |
| 1900 | #define BOSCO_CUSTOMS \ |
| 1901 | ROM_REGION_NAMCO_50XX( REGION_CPU4 ) \ |
| 1902 | ROM_REGION_NAMCO_50XX( REGION_CPU5 ) \ |
| 1903 | ROM_REGION_NAMCO_54XX( REGION_CPU6 ) \ |
| 1904 | ROM_REGION_NAMCO_51XX( REGION_CPU7 ) \ |
| 1905 | ROM_REGION_NAMCO_52XX( REGION_CPU8 ) \ |
| 1906 | |
| 1907 | |
| 1896 | 1908 | ROM_START( bosco ) |
| 1897 | 1909 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for code for the first CPU */ |
| 1898 | 1910 | ROM_LOAD( "bos3_1.bin", 0x0000, 0x1000, CRC(96021267) SHA1(bd49b0caabcccf9df45a272d767456a4fc8a7c07) ) |
| r1070 | r1071 | |
| 1907 | 1919 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 1908 | 1920 | ROM_LOAD( "2900.3e", 0x0000, 0x1000, CRC(d45a4911) SHA1(547236adca9174f5cc0ec05b9649618bb92ba630) ) |
| 1909 | 1921 | |
| 1910 | | ROM_REGION( 0x800, REGION_CPU4, 0 ) /* 2k for the 1st 50xx */ |
| 1911 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 1922 | BOSCO_CUSTOMS |
| 1912 | 1923 | |
| 1913 | | ROM_REGION( 0x800, REGION_CPU5, 0 ) /* 2k for the 2nd 50xx */ |
| 1914 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 1915 | | |
| 1916 | | ROM_REGION( 0x400, REGION_CPU6, 0 ) /* 1k for the 54xx */ |
| 1917 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 1918 | | |
| 1919 | 1924 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 1920 | 1925 | ROM_LOAD( "5300.5d", 0x0000, 0x1000, CRC(a956d3c5) SHA1(c5a9d7b1f9b4acda8fb9762414e085cb5fb80c9e) ) |
| 1921 | 1926 | |
| r1070 | r1071 | |
| 1955 | 1960 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 1956 | 1961 | ROM_LOAD( "2900.3e", 0x0000, 0x1000, CRC(d45a4911) SHA1(547236adca9174f5cc0ec05b9649618bb92ba630) ) |
| 1957 | 1962 | |
| 1958 | | ROM_REGION( 0x800, REGION_CPU4, 0 ) /* 2k for the 1st 50xx */ |
| 1959 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 1963 | BOSCO_CUSTOMS |
| 1960 | 1964 | |
| 1961 | | ROM_REGION( 0x800, REGION_CPU5, 0 ) /* 2k for the 2nd 50xx */ |
| 1962 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 1963 | | |
| 1964 | | ROM_REGION( 0x400, REGION_CPU6, 0 ) /* 1k for the 54xx */ |
| 1965 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 1966 | | |
| 1967 | 1965 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 1968 | 1966 | ROM_LOAD( "5300.5d", 0x0000, 0x1000, CRC(a956d3c5) SHA1(c5a9d7b1f9b4acda8fb9762414e085cb5fb80c9e) ) |
| 1969 | 1967 | |
| r1070 | r1071 | |
| 2003 | 2001 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2004 | 2002 | ROM_LOAD( "2900.3e", 0x0000, 0x1000, CRC(d45a4911) SHA1(547236adca9174f5cc0ec05b9649618bb92ba630) ) |
| 2005 | 2003 | |
| 2006 | | ROM_REGION( 0x800, REGION_CPU4, 0 ) /* 2k for the 1st 50xx */ |
| 2007 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2004 | BOSCO_CUSTOMS |
| 2008 | 2005 | |
| 2009 | | ROM_REGION( 0x800, REGION_CPU5, 0 ) /* 2k for the 2nd 50xx */ |
| 2010 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2011 | | |
| 2012 | | ROM_REGION( 0x400, REGION_CPU6, 0 ) /* 1k for the 54xx */ |
| 2013 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2014 | | |
| 2015 | 2006 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2016 | 2007 | ROM_LOAD( "5300.5d", 0x0000, 0x1000, CRC(a956d3c5) SHA1(c5a9d7b1f9b4acda8fb9762414e085cb5fb80c9e) ) |
| 2017 | 2008 | |
| r1070 | r1071 | |
| 2051 | 2042 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2052 | 2043 | ROM_LOAD( "2900.3e", 0x0000, 0x1000, CRC(d45a4911) SHA1(547236adca9174f5cc0ec05b9649618bb92ba630) ) |
| 2053 | 2044 | |
| 2054 | | ROM_REGION( 0x800, REGION_CPU4, 0 ) /* 2k for the 1st 50xx */ |
| 2055 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2045 | BOSCO_CUSTOMS |
| 2056 | 2046 | |
| 2057 | | ROM_REGION( 0x800, REGION_CPU5, 0 ) /* 2k for the 2nd 50xx */ |
| 2058 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2059 | | |
| 2060 | | ROM_REGION( 0x400, REGION_CPU6, 0 ) /* 1k for the 54xx */ |
| 2061 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2062 | | |
| 2063 | 2047 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2064 | 2048 | ROM_LOAD( "5300.5d", 0x0000, 0x1000, CRC(a956d3c5) SHA1(c5a9d7b1f9b4acda8fb9762414e085cb5fb80c9e) ) |
| 2065 | 2049 | |
| r1070 | r1071 | |
| 2099 | 2083 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2100 | 2084 | ROM_LOAD( "2900.3e", 0x0000, 0x1000, CRC(d45a4911) SHA1(547236adca9174f5cc0ec05b9649618bb92ba630) ) |
| 2101 | 2085 | |
| 2102 | | ROM_REGION( 0x800, REGION_CPU4, 0 ) /* 2k for the 1st 50xx */ |
| 2103 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2086 | BOSCO_CUSTOMS |
| 2104 | 2087 | |
| 2105 | | ROM_REGION( 0x800, REGION_CPU5, 0 ) /* 2k for the 2nd 50xx */ |
| 2106 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2107 | | |
| 2108 | | ROM_REGION( 0x400, REGION_CPU6, 0 ) /* 1k for the 54xx */ |
| 2109 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2110 | | |
| 2111 | 2088 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2112 | 2089 | ROM_LOAD( "5300.5d", 0x0000, 0x1000, CRC(a956d3c5) SHA1(c5a9d7b1f9b4acda8fb9762414e085cb5fb80c9e) ) |
| 2113 | 2090 | |
| r1070 | r1071 | |
| 2133 | 2110 | ROM_LOAD( "5100.5l", 0x2000, 0x1000, CRC(17ac9511) SHA1(266f3fae90d2fe38d109096d352863a52b379899) ) |
| 2134 | 2111 | ROM_END |
| 2135 | 2112 | |
| 2113 | /********************************************************************************************** |
| 2114 | Galaga & clones |
| 2115 | **********************************************************************************************/ |
| 2136 | 2116 | |
| 2117 | #define GALAGA_CUSTOMS \ |
| 2118 | ROM_REGION_NAMCO_54XX( REGION_CPU4 ) \ |
| 2119 | ROM_REGION_NAMCO_51XX( REGION_CPU5 ) \ |
| 2137 | 2120 | |
| 2121 | |
| 2138 | 2122 | ROM_START( galaga ) |
| 2139 | 2123 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for code for the first CPU */ |
| 2140 | 2124 | ROM_LOAD( "gg1-1b.3p", 0x0000, 0x1000, CRC(ab036c9f) SHA1(ca7f5da42d4e76fd89bb0b35198a23c01462fbfe) ) |
| r1070 | r1071 | |
| 2148 | 2132 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2149 | 2133 | ROM_LOAD( "gg1-7b.2c", 0x0000, 0x1000, CRC(d016686b) SHA1(44c1a04fba3c7c826ff484185cb881b4b22e6657) ) |
| 2150 | 2134 | |
| 2151 | | ROM_REGION( 0x400, REGION_CPU4, 0 ) /* 1k for the 54xx */ |
| 2152 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2135 | GALAGA_CUSTOMS |
| 2153 | 2136 | |
| 2154 | 2137 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2155 | 2138 | ROM_LOAD( "gg1-9.4l", 0x0000, 0x1000, CRC(58b2f47c) SHA1(62f1279a784ab2f8218c4137c7accda00e6a3490) ) |
| r1070 | r1071 | |
| 2181 | 2164 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2182 | 2165 | ROM_LOAD( "gg1-7", 0x0000, 0x1000, CRC(8995088d) SHA1(d6cb439de0718826d1a0363c9d77de8740b18ecf) ) |
| 2183 | 2166 | |
| 2184 | | ROM_REGION( 0x400, REGION_CPU4, 0 ) /* 1k for the 54xx */ |
| 2185 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2167 | GALAGA_CUSTOMS |
| 2186 | 2168 | |
| 2187 | 2169 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2188 | 2170 | ROM_LOAD( "gg1-9.4l", 0x0000, 0x1000, CRC(58b2f47c) SHA1(62f1279a784ab2f8218c4137c7accda00e6a3490) ) |
| r1070 | r1071 | |
| 2214 | 2196 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2215 | 2197 | ROM_LOAD( "3700g.bin", 0x0000, 0x1000, CRC(b07f0aa4) SHA1(7528644a8480d0be2d0d37069515ed319e94778f) ) |
| 2216 | 2198 | |
| 2217 | | ROM_REGION( 0x400, REGION_CPU4, 0 ) /* 1k for the 54xx */ |
| 2218 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2199 | GALAGA_CUSTOMS |
| 2219 | 2200 | |
| 2220 | 2201 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2221 | 2202 | ROM_LOAD( "gg1-9.4l", 0x0000, 0x1000, CRC(58b2f47c) SHA1(62f1279a784ab2f8218c4137c7accda00e6a3490) ) |
| r1070 | r1071 | |
| 2247 | 2228 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2248 | 2229 | ROM_LOAD( "3700g.bin", 0x0000, 0x1000, CRC(b07f0aa4) SHA1(7528644a8480d0be2d0d37069515ed319e94778f) ) |
| 2249 | 2230 | |
| 2250 | | ROM_REGION( 0x400, REGION_CPU4, 0 ) /* 1k for the 54xx */ |
| 2251 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2231 | GALAGA_CUSTOMS |
| 2252 | 2232 | |
| 2253 | 2233 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2254 | 2234 | ROM_LOAD( "gg1-9.4l", 0x0000, 0x1000, CRC(58b2f47c) SHA1(62f1279a784ab2f8218c4137c7accda00e6a3490) ) |
| r1070 | r1071 | |
| 2280 | 2260 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2281 | 2261 | ROM_LOAD( "gg1-7b.2c", 0x0000, 0x1000, CRC(d016686b) SHA1(44c1a04fba3c7c826ff484185cb881b4b22e6657) ) |
| 2282 | 2262 | |
| 2283 | | ROM_REGION( 0x400, REGION_CPU4, 0 ) /* 1k for the 54xx */ |
| 2284 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2263 | GALAGA_CUSTOMS |
| 2285 | 2264 | |
| 2286 | 2265 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2287 | 2266 | ROM_LOAD( "gg1-9.4l", 0x0000, 0x1000, CRC(58b2f47c) SHA1(62f1279a784ab2f8218c4137c7accda00e6a3490) ) |
| r1070 | r1071 | |
| 2366 | 2345 | ROM_LOAD( "prom-2.5c", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* timing - not used */ |
| 2367 | 2346 | ROM_END |
| 2368 | 2347 | |
| 2348 | /********************************************************************************************** |
| 2349 | Xevious & clones |
| 2350 | **********************************************************************************************/ |
| 2369 | 2351 | |
| 2352 | #define XEVIOUS_CUSTOMS \ |
| 2353 | ROM_REGION_NAMCO_50XX( REGION_CPU4 ) \ |
| 2354 | ROM_REGION_NAMCO_54XX( REGION_CPU5 ) \ |
| 2355 | ROM_REGION_NAMCO_51XX( REGION_CPU6 ) \ |
| 2370 | 2356 | |
| 2371 | 2357 | ROM_START( xevious ) |
| 2372 | 2358 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for the first CPU */ |
| r1070 | r1071 | |
| 2382 | 2368 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2383 | 2369 | ROM_LOAD( "xvi_7.2c", 0x0000, 0x1000, CRC(dd35cf1c) SHA1(f8d1f8e019d8198308443c2e7e815d0d04b23d14) ) |
| 2384 | 2370 | |
| 2385 | | ROM_REGION( 0x800, REGION_CPU4, 0 ) /* 2k for the 50xx */ |
| 2386 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2371 | XEVIOUS_CUSTOMS |
| 2387 | 2372 | |
| 2388 | | ROM_REGION( 0x400, REGION_CPU5, 0 ) /* 1k for the 54xx */ |
| 2389 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2390 | | |
| 2391 | 2373 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2392 | 2374 | ROM_LOAD( "xvi_12.3b", 0x0000, 0x1000, CRC(088c8b26) SHA1(9c3b61dfca2f84673a78f7f66e363777a8f47a59) ) /* foreground characters */ |
| 2393 | 2375 | |
| r1070 | r1071 | |
| 2433 | 2415 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2434 | 2416 | ROM_LOAD( "xvi_7.2c", 0x0000, 0x1000, CRC(dd35cf1c) SHA1(f8d1f8e019d8198308443c2e7e815d0d04b23d14) ) |
| 2435 | 2417 | |
| 2436 | | ROM_REGION( 0x800, REGION_CPU4, 0 ) /* 2k for the 50xx */ |
| 2437 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2418 | XEVIOUS_CUSTOMS |
| 2438 | 2419 | |
| 2439 | | ROM_REGION( 0x400, REGION_CPU5, 0 ) /* 1k for the 54xx */ |
| 2440 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2441 | | |
| 2442 | 2420 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2443 | 2421 | ROM_LOAD( "xvi_12.3b", 0x0000, 0x1000, CRC(088c8b26) SHA1(9c3b61dfca2f84673a78f7f66e363777a8f47a59) ) /* foreground characters */ |
| 2444 | 2422 | |
| r1070 | r1071 | |
| 2484 | 2462 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2485 | 2463 | ROM_LOAD( "xvi_7.2c", 0x0000, 0x1000, CRC(dd35cf1c) SHA1(f8d1f8e019d8198308443c2e7e815d0d04b23d14) ) |
| 2486 | 2464 | |
| 2487 | | ROM_REGION( 0x800, REGION_CPU4, 0 ) /* 2k for the 50xx */ |
| 2488 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2465 | XEVIOUS_CUSTOMS |
| 2489 | 2466 | |
| 2490 | | ROM_REGION( 0x400, REGION_CPU5, 0 ) /* 1k for the 54xx */ |
| 2491 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2492 | | |
| 2493 | 2467 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2494 | 2468 | ROM_LOAD( "xvi_12.3b", 0x0000, 0x1000, CRC(088c8b26) SHA1(9c3b61dfca2f84673a78f7f66e363777a8f47a59) ) /* foreground characters */ |
| 2495 | 2469 | |
| r1070 | r1071 | |
| 2538 | 2512 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2539 | 2513 | ROM_LOAD( "xvi_7.2c", 0x0000, 0x1000, CRC(dd35cf1c) SHA1(f8d1f8e019d8198308443c2e7e815d0d04b23d14) ) |
| 2540 | 2514 | |
| 2541 | | ROM_REGION( 0x800, REGION_CPU4, 0 ) /* 2k for the 50xx */ |
| 2542 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2515 | XEVIOUS_CUSTOMS |
| 2543 | 2516 | |
| 2544 | | ROM_REGION( 0x400, REGION_CPU5, 0 ) /* 1k for the 54xx */ |
| 2545 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2546 | | |
| 2547 | 2517 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2548 | 2518 | ROM_LOAD( "xvi_12.3b", 0x0000, 0x1000, CRC(088c8b26) SHA1(9c3b61dfca2f84673a78f7f66e363777a8f47a59) ) /* foreground characters */ |
| 2549 | 2519 | |
| r1070 | r1071 | |
| 2592 | 2562 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2593 | 2563 | ROM_LOAD( "xvi_7.2c", 0x0000, 0x1000, CRC(dd35cf1c) SHA1(f8d1f8e019d8198308443c2e7e815d0d04b23d14) ) |
| 2594 | 2564 | |
| 2595 | | ROM_REGION( 0x800, REGION_CPU4, 0 ) /* 2k for the 50xx */ |
| 2596 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2565 | /* This is a bootleg, it probably shouldn't be loading these, see 'unknown roms' below */ |
| 2566 | XEVIOUS_CUSTOMS |
| 2597 | 2567 | |
| 2598 | | ROM_REGION( 0x400, REGION_CPU5, 0 ) /* 1k for the 54xx */ |
| 2599 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2600 | | |
| 2601 | 2568 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2602 | 2569 | ROM_LOAD( "xvi_12.3b", 0x0000, 0x1000, CRC(088c8b26) SHA1(9c3b61dfca2f84673a78f7f66e363777a8f47a59) ) /* foreground characters */ |
| 2603 | 2570 | |
| r1070 | r1071 | |
| 2631 | 2598 | ROM_LOAD( "xvi_2bpr.7n", 0x0000, 0x0100, CRC(550f06bc) SHA1(816a0fafa0b084ac11ae1af70a5186539376fc2a) ) |
| 2632 | 2599 | ROM_LOAD( "xvi_1bpr.5n", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* timing - not used */ |
| 2633 | 2600 | |
| 2634 | | ROM_REGION( 0x3000, REGION_USER1, 0 ) |
| 2601 | ROM_REGION( 0x3000, REGION_USER1, 0 ) /* unknown roms */ |
| 2635 | 2602 | /* extra ROMs (function unknown, could be emulation of the custom I/O */ |
| 2636 | 2603 | /* chip with a Z80): */ |
| 2637 | 2604 | ROM_LOAD( "1.16j", 0x0000, 0x1000, CRC(2618f0ce) SHA1(54e8644b5609d6f6ec717a7469c76901eb79f26e) ) |
| r1070 | r1071 | |
| 2700 | 2667 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2701 | 2668 | ROM_LOAD( "xvi_7.2c", 0x0000, 0x1000, CRC(dd35cf1c) SHA1(f8d1f8e019d8198308443c2e7e815d0d04b23d14) ) |
| 2702 | 2669 | |
| 2703 | | ROM_REGION( 0x800, REGION_CPU4, 0 ) /* 2k for the 50xx */ |
| 2704 | | ROM_LOAD( "50xx.bin", 0x0000, 0x0800, CRC(a0acbaf7) SHA1(f03c79451e73b3a93c1591cdb27fedc9f130508d) ) |
| 2670 | XEVIOUS_CUSTOMS |
| 2705 | 2671 | |
| 2706 | | ROM_REGION( 0x400, REGION_CPU5, 0 ) /* 1k for the 54xx */ |
| 2707 | | ROM_LOAD( "54xx.bin", 0x0000, 0x0400, CRC(ee7357e0) SHA1(01bdf984a49e8d0cc8761b2cc162fd6434d5afbe) ) |
| 2708 | | |
| 2709 | 2672 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2710 | 2673 | ROM_LOAD( "xvi_12.3b", 0x0000, 0x1000, CRC(088c8b26) SHA1(9c3b61dfca2f84673a78f7f66e363777a8f47a59) ) /* foreground characters */ |
| 2711 | 2674 | |
| r1070 | r1071 | |
| 2740 | 2703 | ROM_LOAD( "xvi_1bpr.5n", 0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* timing - not used */ |
| 2741 | 2704 | ROM_END |
| 2742 | 2705 | |
| 2706 | /********************************************************************************************** |
| 2707 | Dig Dug & clones |
| 2708 | **********************************************************************************************/ |
| 2743 | 2709 | |
| 2710 | #define DIGDUG_CUSTOMS \ |
| 2711 | ROM_REGION_NAMCO_51XX( REGION_CPU4 ) \ |
| 2712 | ROM_REGION_NAMCO_53XX( REGION_CPU5 ) \ |
| 2744 | 2713 | |
| 2745 | 2714 | ROM_START( digdug ) |
| 2746 | 2715 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for code for the first CPU */ |
| r1070 | r1071 | |
| 2756 | 2725 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2757 | 2726 | ROM_LOAD( "136007.107", 0x0000, 0x1000, CRC(a41bce72) SHA1(2b9b74f56aa7939d9d47cf29497ae11f10d78598) ) |
| 2758 | 2727 | |
| 2728 | DIGDUG_CUSTOMS |
| 2729 | |
| 2759 | 2730 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2760 | 2731 | ROM_LOAD( "dd1.9", 0x0000, 0x0800, CRC(f14a6fe1) SHA1(0aa63300c2cb887196de590aceb98f3cf06fead4) ) |
| 2761 | 2732 | |
| r1070 | r1071 | |
| 2795 | 2766 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2796 | 2767 | ROM_LOAD( "136007.107", 0x0000, 0x1000, CRC(a41bce72) SHA1(2b9b74f56aa7939d9d47cf29497ae11f10d78598) ) |
| 2797 | 2768 | |
| 2769 | DIGDUG_CUSTOMS |
| 2770 | |
| 2798 | 2771 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2799 | 2772 | ROM_LOAD( "dd1.9", 0x0000, 0x0800, CRC(f14a6fe1) SHA1(0aa63300c2cb887196de590aceb98f3cf06fead4) ) |
| 2800 | 2773 | |
| r1070 | r1071 | |
| 2834 | 2807 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2835 | 2808 | ROM_LOAD( "136007.107", 0x0000, 0x1000, CRC(a41bce72) SHA1(2b9b74f56aa7939d9d47cf29497ae11f10d78598) ) |
| 2836 | 2809 | |
| 2810 | DIGDUG_CUSTOMS |
| 2811 | |
| 2837 | 2812 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2838 | 2813 | ROM_LOAD( "136007.108", 0x0000, 0x0800, CRC(3d24a3af) SHA1(857ae93e2a41258a129dcecbaed2df359540b735) ) |
| 2839 | 2814 | |
| r1070 | r1071 | |
| 2873 | 2848 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 2874 | 2849 | ROM_LOAD( "136007.107", 0x0000, 0x1000, CRC(a41bce72) SHA1(2b9b74f56aa7939d9d47cf29497ae11f10d78598) ) |
| 2875 | 2850 | |
| 2851 | DIGDUG_CUSTOMS |
| 2852 | |
| 2876 | 2853 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2877 | 2854 | ROM_LOAD( "136007.108", 0x0000, 0x0800, CRC(3d24a3af) SHA1(857ae93e2a41258a129dcecbaed2df359540b735) ) |
| 2878 | 2855 | |
| r1070 | r1071 | |
| 3009 | 2986 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for the third CPU */ |
| 3010 | 2987 | ROM_LOAD( "digdug6.6", 0x0000, 0x1000, CRC(a41bce72) SHA1(2b9b74f56aa7939d9d47cf29497ae11f10d78598) ) |
| 3011 | 2988 | |
| 2989 | DIGDUG_CUSTOMS |
| 2990 | |
| 3012 | 2991 | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 3013 | 2992 | ROM_LOAD( "digdug8.8", 0x0000, 0x0800, CRC(f14a6fe1) SHA1(0aa63300c2cb887196de590aceb98f3cf06fead4) ) |
| 3014 | 2993 | |
| r1070 | r1071 | |
| 3108 | 3087 | } |
| 3109 | 3088 | |
| 3110 | 3089 | |
| 3090 | /* Original Namco hardware, with Namco Customs */ |
| 3111 | 3091 | |
| 3112 | 3092 | GAME( 1981, bosco, 0, bosco, bosco, 0, ROT0, "Namco", "Bosconian (new version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) |
| 3113 | 3093 | GAME( 1981, boscoo, bosco, bosco, bosco, 0, ROT0, "Namco", "Bosconian (old version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) |
| r1070 | r1071 | |
| 3120 | 3100 | GAME( 1981, galagamw, galaga, galaga, galagamw, galaga, ROT90, "[Namco] (Midway license)", "Galaga (Midway set 1)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) |
| 3121 | 3101 | GAME( 1981, galagamk, galaga, galaga, galaga, galaga, ROT90, "[Namco] (Midway license)", "Galaga (Midway set 2)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) |
| 3122 | 3102 | GAME( 1981, galagamf, galaga, galaga, galaga, galaga, ROT90, "[Namco] (Midway license)", "Galaga (Midway set 1 with fast shoot hack)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) |
| 3123 | | GAME( 1981, gallag, galaga, galagab, galaga, galaga, ROT90, "bootleg", "Gallag", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3124 | | GAME( 1984, gatsbee, galaga, galagab, gatsbee, gatsbee, ROT90, "hack", "Gatsbee", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3125 | 3103 | |
| 3126 | 3104 | GAME( 1982, xevious, 0, xevious, xevious, xevious, ROT90, "Namco", "Xevious (Namco)", GAME_SUPPORTS_SAVE ) |
| 3127 | 3105 | GAME( 1982, xeviousa, xevious, xevious, xeviousa, xevious, ROT90, "Namco (Atari license)", "Xevious (Atari set 1)", GAME_SUPPORTS_SAVE ) |
| 3128 | 3106 | GAME( 1982, xeviousb, xevious, xevious, xeviousb, xevious, ROT90, "Namco (Atari license)", "Xevious (Atari set 2)", GAME_SUPPORTS_SAVE ) |
| 3129 | 3107 | GAME( 1982, xeviousc, xevious, xevious, xeviousa, xevious, ROT90, "Namco (Atari license)", "Xevious (Atari set 3)", GAME_SUPPORTS_SAVE ) |
| 3130 | | GAME( 1982, xevios, xevious, xevious, xevious, xevios, ROT90, "bootleg", "Xevios", GAME_SUPPORTS_SAVE ) |
| 3131 | | GAME( 1982, battles, xevious, battles, xevious, battles, ROT90, "bootleg", "Battles", GAME_SUPPORTS_SAVE ) |
| 3132 | 3108 | GAME( 1984, sxevious, xevious, xevious, sxevious, xevious, ROT90, "Namco", "Super Xevious", GAME_SUPPORTS_SAVE ) |
| 3133 | 3109 | |
| 3134 | 3110 | GAME( 1982, digdug, 0, digdug, digdug, 0, ROT90, "Namco", "Dig Dug (rev 2)", GAME_SUPPORTS_SAVE ) |
| 3135 | 3111 | GAME( 1982, digdugb, digdug, digdug, digdug, 0, ROT90, "Namco", "Dig Dug (rev 1)", GAME_SUPPORTS_SAVE ) |
| 3136 | 3112 | GAME( 1982, digdugat, digdug, digdug, digdug, 0, ROT90, "[Namco] (Atari license)", "Dig Dug (Atari, rev 2)", GAME_SUPPORTS_SAVE ) |
| 3137 | 3113 | GAME( 1982, digduga1, digdug, digdug, digdug, 0, ROT90, "[Namco] (Atari license)", "Dig Dug (Atari, rev 1)", GAME_SUPPORTS_SAVE ) |
| 3114 | GAME( 1982, digsid, digdug, digdug, digdug, 0, ROT90, "Namco [Sidam license]", "Dig Dug (manufactured by Sidam)", GAME_SUPPORTS_SAVE ) |
| 3115 | |
| 3116 | /* Bootlegs with replacement I/O chips */ |
| 3117 | |
| 3118 | GAME( 1981, gallag, galaga, galagab, galaga, galaga, ROT90, "bootleg", "Gallag", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3119 | GAME( 1984, gatsbee, galaga, galagab, gatsbee, gatsbee, ROT90, "hack", "Gatsbee", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3120 | |
| 3121 | GAME( 1982, xevios, xevious, xevious, xevious, xevios, ROT90, "bootleg", "Xevios", GAME_SUPPORTS_SAVE ) |
| 3122 | GAME( 1982, battles, xevious, battles, xevious, battles, ROT90, "bootleg", "Battles", GAME_SUPPORTS_SAVE ) |
| 3123 | |
| 3138 | 3124 | GAME( 1982, dzigzag, digdug, dzigzag, digdug, 0, ROT90, "bootleg", "Zig Zag (Dig Dug hardware)", GAME_SUPPORTS_SAVE ) |
| 3139 | | GAME( 1982, digsid, digdug, digdug, digdug, 0, ROT90, "[Namco] (Sidam license)", "Dig Dug (Sidam)", GAME_SUPPORTS_SAVE ) // still has Namco copyright intact |
src/mame/drivers/m72.c
| r1070 | r1071 | |
| 338 | 338 | 0xc6,0x06,0x00,0x09,0x49^0xff, // mov [0900h], byte 049h |
| 339 | 339 | 0xc6,0x06,0x00,0x0a,0x49^0xff, // mov [0a00h], byte 049h |
| 340 | 340 | 0xc6,0x06,0x00,0x0b,0x49^0xff, // mov [0b00h], byte 049h |
| 341 | |
| 342 | 0x68,0x00,0xd0, // push 0d000h // Japan set only |
| 343 | 0x1f, // pop ds // Japan set only |
| 344 | 0xc6,0x06,0x70,0x16,0x57, // mov [1670h], byte 057h // Japan set only - checks this (W) of WARNING |
| 345 | |
| 341 | 346 | 0xea,0x5d,0x01,0x40,0x00 // jmp 0040:$015d |
| 347 | |
| 342 | 348 | }; |
| 343 | 349 | static UINT8 loht_crc[CRC_LEN] = { 0x39,0x00,0x82,0xae, 0x2c,0x9d,0x4b,0x73, |
| 344 | 350 | 0xfb,0xac,0xd4,0x6d, 0x6d,0x5b,0x77,0xc0, 0x00,0x00 }; |
| 351 | /* service mode crashes at the moment (119u2), so I can't add the CRCs for lohtj */ |
| 345 | 352 | |
| 346 | 353 | /* X Multiply */ |
| 347 | 354 | static UINT8 xmultipl_code[CODE_LEN] = |
| r1070 | r1071 | |
| 465 | 472 | memset(m72_videoram2,0,0x4000); |
| 466 | 473 | } |
| 467 | 474 | |
| 475 | READ16_HANDLER( m72_main_mcu_r) |
| 476 | { |
| 477 | return protection_ram[offset]; |
| 478 | } |
| 479 | |
| 480 | WRITE16_HANDLER( m72_main_mcu_w) |
| 481 | { |
| 482 | COMBINE_DATA(&protection_ram[offset]); |
| 483 | } |
| 484 | |
| 485 | static DRIVER_INIT( loht_mcu ) |
| 486 | { |
| 487 | |
| 488 | protection_ram = auto_malloc(0x10000); |
| 489 | |
| 490 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0fff, 0, 0, m72_main_mcu_r); |
| 491 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0fff, 0, 0, m72_main_mcu_w); |
| 492 | |
| 493 | memory_install_write16_handler(0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, loht_sample_trigger_w); |
| 494 | |
| 495 | } |
| 496 | |
| 497 | |
| 468 | 498 | static DRIVER_INIT( xmultipl ) |
| 469 | 499 | { |
| 470 | 500 | install_protection_handler(xmultipl_code,xmultipl_crc); |
| r1070 | r1071 | |
| 1868 | 1898 | MACHINE_DRIVER_END |
| 1869 | 1899 | |
| 1870 | 1900 | |
| 1901 | static ADDRESS_MAP_START( mcu_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 1902 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 1903 | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 1904 | ADDRESS_MAP_END |
| 1905 | |
| 1906 | static WRITE8_HANDLER( m72_mcu_data_w ) |
| 1907 | { |
| 1908 | if (offset&1) protection_ram[offset/2] = (protection_ram[offset/2] & 0x00ff) | (data << 8); |
| 1909 | else protection_ram[offset/2] = (protection_ram[offset/2] & 0xff00) | (data&0xff); |
| 1910 | } |
| 1911 | |
| 1912 | static READ8_HANDLER(m72_mcu_data_r ) |
| 1913 | { |
| 1914 | UINT8 ret; |
| 1915 | |
| 1916 | if (offset&1) ret = (protection_ram[offset/2] & 0xff00)>>8; |
| 1917 | else ret =(protection_ram[offset/2] & 0x00ff); |
| 1918 | |
| 1919 | // printf("ret %02x\n",ret); |
| 1920 | return ret; |
| 1921 | } |
| 1922 | |
| 1923 | static ADDRESS_MAP_START( mcu_data_map, ADDRESS_SPACE_DATA, 8 ) |
| 1924 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 1925 | /* shared at b0000 - b0fff on the main cpu */ |
| 1926 | AM_RANGE(0xc000, 0xcfff) AM_READWRITE(m72_mcu_data_r,m72_mcu_data_w ) |
| 1927 | ADDRESS_MAP_END |
| 1928 | |
| 1929 | |
| 1871 | 1930 | static MACHINE_DRIVER_START( m72 ) |
| 1872 | 1931 | |
| 1873 | 1932 | /* basic machine hardware */ |
| r1070 | r1071 | |
| 1910 | 1969 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.40) |
| 1911 | 1970 | MACHINE_DRIVER_END |
| 1912 | 1971 | |
| 1972 | static MACHINE_DRIVER_START( m72_8751 ) |
| 1973 | MDRV_IMPORT_FROM(m72) |
| 1913 | 1974 | |
| 1975 | MDRV_CPU_ADD(I8751, 8000000) |
| 1976 | MDRV_CPU_PROGRAM_MAP(mcu_map,0) |
| 1977 | MDRV_CPU_DATA_MAP(mcu_data_map,0) |
| 1978 | MDRV_CPU_VBLANK_INT(irq0_line_pulse,1) |
| 1979 | MACHINE_DRIVER_END |
| 1980 | |
| 1981 | |
| 1914 | 1982 | static MACHINE_DRIVER_START( dkgenm72 ) |
| 1915 | 1983 | |
| 1916 | 1984 | /* basic machine hardware */ |
| r1070 | r1071 | |
| 2507 | 2575 | ROM_LOAD16_BYTE( "c-l3-b.rom", 0x60000, 0x10000, CRC(11562221) SHA1(a2f136a487fb6f30350e8d1e26c0729eb0686c7d) ) |
| 2508 | 2576 | ROM_RELOAD( 0xe0000, 0x10000 ) |
| 2509 | 2577 | |
| 2578 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2579 | ROM_LOAD( "bchopper_i8751.mcu", 0x00000, 0x10000, NO_DUMP ) // read protected |
| 2580 | |
| 2510 | 2581 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2511 | 2582 | ROM_LOAD( "c-00-a.rom", 0x00000, 0x10000, CRC(f6e6e660) SHA1(e066e5ed37719cf2b6fd36e0117f11325bb06f9c) ) /* sprites */ |
| 2512 | 2583 | ROM_LOAD( "c-01-b.rom", 0x10000, 0x10000, CRC(708cdd37) SHA1(24f3fcd381422f0d75410c2af7a56744e3b4a699) ) |
| r1070 | r1071 | |
| 2544 | 2615 | ROM_LOAD16_BYTE( "mh-c-l3.bin", 0x60000, 0x10000, CRC(c0982536) SHA1(45399f8d0577c6e2a277a69303954ce5d2de7c07) ) |
| 2545 | 2616 | ROM_RELOAD( 0xe0000, 0x10000 ) |
| 2546 | 2617 | |
| 2618 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2619 | ROM_LOAD( "mrheli_i8751.mcu", 0x00000, 0x10000, NO_DUMP ) // read protected |
| 2620 | |
| 2547 | 2621 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2548 | 2622 | ROM_LOAD( "mh-c-00.bin", 0x00000, 0x20000, CRC(dec4e121) SHA1(92169b523f1600e994e016dc1959a52958e1d89d) ) /* sprites */ |
| 2549 | 2623 | ROM_LOAD( "mh-c-10.bin", 0x20000, 0x20000, CRC(7aaa151e) SHA1(efd980bb2eed7084354b7a4aa2f733cd2f876741) ) |
| r1070 | r1071 | |
| 2579 | 2653 | ROM_LOAD16_BYTE( "nin-c-l3.rom", 0x60000, 0x10000, CRC(fd7408b8) SHA1(3cbe72835a561c50265a047f0f5cd62db48378fd) ) |
| 2580 | 2654 | ROM_RELOAD( 0xe0000, 0x10000 ) |
| 2581 | 2655 | |
| 2656 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2657 | ROM_LOAD( "nspirit_i8751.mcu", 0x00000, 0x10000, NO_DUMP ) // read protected |
| 2658 | |
| 2582 | 2659 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2583 | 2660 | ROM_LOAD( "nin-r00.rom", 0x00000, 0x20000, CRC(5f61d30b) SHA1(7754697e43f6117fa604f50885b76014b1dc5760) ) /* sprites */ |
| 2584 | 2661 | ROM_LOAD( "nin-r10.rom", 0x20000, 0x20000, CRC(0caad107) SHA1(c4eff00327313e05ac8f7c6dbee3a0de1c83fadd) ) |
| r1070 | r1071 | |
| 2614 | 2691 | ROM_LOAD16_BYTE( "c-l3", 0x60000, 0x10000, CRC(e754a87a) SHA1(9951d972ed13a0415c827beff122bc7ddb078447) ) |
| 2615 | 2692 | ROM_RELOAD( 0xe0000, 0x10000 ) |
| 2616 | 2693 | |
| 2694 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2695 | ROM_LOAD( "nspiritj_i8751.mcu", 0x00000, 0x10000, NO_DUMP ) // read protected |
| 2696 | |
| 2617 | 2697 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2618 | 2698 | ROM_LOAD( "nin-r00.rom", 0x00000, 0x20000, CRC(5f61d30b) SHA1(7754697e43f6117fa604f50885b76014b1dc5760) ) /* sprites */ |
| 2619 | 2699 | ROM_LOAD( "nin-r10.rom", 0x20000, 0x20000, CRC(0caad107) SHA1(c4eff00327313e05ac8f7c6dbee3a0de1c83fadd) ) |
| r1070 | r1071 | |
| 2645 | 2725 | ROM_LOAD16_BYTE( "if-c-l3.bin", 0x40000, 0x20000, CRC(c66ae348) SHA1(eca5096ebd5bffc6e68f3fc9969cda9679bd921f) ) |
| 2646 | 2726 | ROM_RELOAD( 0xc0000, 0x20000 ) |
| 2647 | 2727 | |
| 2728 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2729 | ROM_LOAD( "imgfight_i8751.mcu", 0x00000, 0x10000, NO_DUMP ) // read protected |
| 2730 | |
| 2648 | 2731 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2649 | 2732 | ROM_LOAD( "if-c-00.bin", 0x00000, 0x20000, CRC(745e6638) SHA1(43fb1f9da4190fea67eee3aee8caf4219becc21b) ) /* sprites */ |
| 2650 | 2733 | ROM_LOAD( "if-c-10.bin", 0x20000, 0x20000, CRC(b7108449) SHA1(1f41ebe7164fab86958caaf6749b99425e682657) ) |
| r1070 | r1071 | |
| 2677 | 2760 | ROM_LOAD16_BYTE( "tom_c-l3.rom", 0x40000, 0x20000, CRC(2f049b03) SHA1(21047cb10912b1fc23795673af3ea7de249328b7) ) |
| 2678 | 2761 | ROM_RELOAD( 0xc0000, 0x20000 ) |
| 2679 | 2762 | |
| 2763 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2764 | ROM_LOAD( "loht_i8751.mcu", 0x00000, 0x10000, NO_DUMP ) // read protected |
| 2765 | |
| 2680 | 2766 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2681 | 2767 | ROM_LOAD( "tom_m53.rom", 0x00000, 0x20000, CRC(0b83265f) SHA1(b31918d6442b79c9fe4f20410189788b050a994e) ) /* sprites */ |
| 2682 | 2768 | ROM_LOAD( "tom_m51.rom", 0x20000, 0x20000, CRC(8ec5f6f3) SHA1(210f2753f5eeb06396758d21ab1778d459add247) ) |
| r1070 | r1071 | |
| 2699 | 2785 | ROM_LOAD( "tom_m44.rom", 0x00000, 0x10000, CRC(3ed51d1f) SHA1(84f3aa17d640df91387e5f1f5b5971cf8dcd4e17) ) |
| 2700 | 2786 | ROM_END |
| 2701 | 2787 | |
| 2788 | /* |
| 2789 | |
| 2790 | Legend of Hero TONMA |
| 2791 | (c)1989 Irem |
| 2792 | |
| 2793 | M72 System |
| 2794 | Horizontal Freq. = 15.625KHz |
| 2795 | H.Period = 64.0us |
| 2796 | H.Blank = 16.0us |
| 2797 | H.Sync Pulse = 5.0us |
| 2798 | Vertical Freq. = 55.02Hz |
| 2799 | V.Period = 18.176ms |
| 2800 | V.Blank = 1.792ms |
| 2801 | V.Sync Pulse = 384us |
| 2802 | |
| 2803 | ROMs: |
| 2804 | on M72-C mainboard |
| 2805 | set jumper pins |
| 2806 | J1:A |
| 2807 | J2:A |
| 2808 | J3:A |
| 2809 | J4:A |
| 2810 | J5:B |
| 2811 | J6:A |
| 2812 | J7:A |
| 2813 | J9:A |
| 2814 | J10:A |
| 2815 | J11:B |
| 2816 | J12:A |
| 2817 | |
| 2818 | TOM_C-H0- (M5M27C101K, main programs) |
| 2819 | TOM_C-L0- |
| 2820 | TOM_C-H3- |
| 2821 | TOM_C-H0- |
| 2822 | |
| 2823 | R200 (28pin 1Mbit mask, read as 531000) |
| 2824 | R210 |
| 2825 | R220 |
| 2826 | R230 |
| 2827 | |
| 2828 | 082 - Samples |
| 2829 | |
| 2830 | TOM_C-PR- (i8751H, read protected, not dumped) |
| 2831 | TOM_C-3F- (PAL, read protected, not dumped) |
| 2832 | |
| 2833 | |
| 2834 | on M72-B-B or M72-B-C or M72-B-D |
| 2835 | set jumper pins (J2, J3, J4, J5) to "B" |
| 2836 | R2A0.A0 (27C512) |
| 2837 | R2A1.A1 |
| 2838 | R2A2.A2 |
| 2839 | R2A3.A3 |
| 2840 | |
| 2841 | 078.B0 |
| 2842 | 079.B1 |
| 2843 | 080.B2 |
| 2844 | 081.B3 |
| 2845 | |
| 2846 | */ |
| 2847 | |
| 2848 | ROM_START( lohtj ) |
| 2849 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) |
| 2850 | ROM_LOAD16_BYTE( "tom_c-h0-", 0x00001, 0x20000, CRC(2a752998) SHA1(a88c3c75a1106665c94ddd0945bfaa7696a21b75) ) |
| 2851 | ROM_LOAD16_BYTE( "tom_c-l0-", 0x00000, 0x20000, CRC(a224d928) SHA1(c4744f6ca19ce60b0c03415be979f2a824235a1c) ) |
| 2852 | ROM_LOAD16_BYTE( "tom_c-h3-", 0x40001, 0x20000, CRC(714778b5) SHA1(e2eaa35d6b5fa5df5163fe0d7b45fa66667f9947) ) |
| 2853 | ROM_RELOAD( 0xc0001, 0x20000 ) |
| 2854 | ROM_LOAD16_BYTE( "tom_c-l3-", 0x40000, 0x20000, CRC(2f049b03) SHA1(21047cb10912b1fc23795673af3ea7de249328b7) ) |
| 2855 | ROM_RELOAD( 0xc0000, 0x20000 ) |
| 2856 | |
| 2857 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2858 | ROM_LOAD( "lohtj_i8751.mcu", 0x00000, 0x10000, NO_DUMP ) // read protected |
| 2859 | |
| 2860 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2861 | ROM_LOAD( "r200", 0x00000, 0x20000, CRC(0b83265f) SHA1(b31918d6442b79c9fe4f20410189788b050a994e) ) /* sprites */ |
| 2862 | ROM_LOAD( "r210", 0x20000, 0x20000, CRC(8ec5f6f3) SHA1(210f2753f5eeb06396758d21ab1778d459add247) ) |
| 2863 | ROM_LOAD( "r220", 0x40000, 0x20000, CRC(a41d3bfd) SHA1(536fb7c0321dbbc1a8b73e9647fba9c53a253fcc) ) |
| 2864 | ROM_LOAD( "r230", 0x60000, 0x20000, CRC(9d81a25b) SHA1(a354537c2fbba85f06485aa8487d7583a7133357) ) |
| 2865 | |
| 2866 | ROM_REGION( 0x040000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 2867 | ROM_LOAD( "r2a0.a0", 0x00000, 0x10000, CRC(3ca3e771) SHA1(be052e01c5429ee89057c9d408794f2c7744047c) ) /* tiles #1 */ |
| 2868 | ROM_LOAD( "r2a1.a1", 0x10000, 0x10000, CRC(7a05ee2f) SHA1(7d1ca5db9a5a85610129e3bc6c640ade036fe7f9) ) |
| 2869 | ROM_LOAD( "r2a2.a2", 0x20000, 0x10000, CRC(79aa2335) SHA1(6b70c79d800a7b755aa7c9a368c4ea74029aaa1e) ) |
| 2870 | ROM_LOAD( "r2a3.a3", 0x30000, 0x10000, CRC(789e8b24) SHA1(e957cd25c3c155ca295ab1aea03d610f91562cfb) ) |
| 2871 | |
| 2872 | ROM_REGION( 0x040000, REGION_GFX3, ROMREGION_DISPOSE ) |
| 2873 | ROM_LOAD( "078.b0", 0x00000, 0x10000, CRC(44626bf6) SHA1(571ef74d42d30a272ff0fb33f830652b4a4bad29) ) /* tiles #2 */ |
| 2874 | ROM_LOAD( "079.b1", 0x10000, 0x10000, CRC(464952cf) SHA1(6b99360b6ba1ed5a72c257f51291f9f7a1ddf363) ) |
| 2875 | ROM_LOAD( "080.b2", 0x20000, 0x10000, CRC(3db9b2c7) SHA1(02a318ffc459c494b7f40827eff5f89b41ac0426) ) |
| 2876 | ROM_LOAD( "081.b3", 0x30000, 0x10000, CRC(f01fe899) SHA1(c5ab967b7af55a757638bcdc9975f4b15064022d) ) |
| 2877 | |
| 2878 | ROM_REGION( 0x10000, REGION_SOUND1, 0 ) /* samples */ |
| 2879 | ROM_LOAD( "082", 0x00000, 0x10000, CRC(3ed51d1f) SHA1(84f3aa17d640df91387e5f1f5b5971cf8dcd4e17) ) |
| 2880 | ROM_END |
| 2881 | |
| 2882 | /* |
| 2883 | CPU cpu: nec v30 |
| 2884 | cpu: z80 (sharp LH0080B z80b-cpu) |
| 2885 | cpu: 2x YM2203C |
| 2886 | |
| 2887 | quarzi: 16mhz vicino al v30 e 28mhz vicino allo z80 e ym2203c |
| 2888 | */ |
| 2889 | |
| 2890 | ROM_START( lohtb ) |
| 2891 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) |
| 2892 | ROM_LOAD16_BYTE( "lohtb03.b", 0x00001, 0x20000, CRC(8b845a70) SHA1(902c623310cd77b25592496745f9c6121149b516) ) |
| 2893 | ROM_LOAD16_BYTE( "lohtb05.d", 0x00000, 0x20000, CRC(e90f7623) SHA1(e6e2f66a39286b2d7c03fc267beb2024913fb4ca) ) |
| 2894 | ROM_LOAD16_BYTE( "lohtb02.a", 0x40001, 0x20000, CRC(714778b5) SHA1(e2eaa35d6b5fa5df5163fe0d7b45fa66667f9947) ) |
| 2895 | ROM_RELOAD( 0xc0001, 0x20000 ) |
| 2896 | ROM_LOAD16_BYTE( "lohtb04.c", 0x40000, 0x20000, CRC(2f049b03) SHA1(21047cb10912b1fc23795673af3ea7de249328b7) ) |
| 2897 | ROM_RELOAD( 0xc0000, 0x20000 ) |
| 2898 | |
| 2899 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* Sound CPU program (Z80) + Samples*/ |
| 2900 | ROM_LOAD( "lohtb01.02", 0x00000, 0x10000, CRC(e4bd8f03) SHA1(69fe41a978db92daa912cb345c2c7bafd2a6eb93) ) |
| 2901 | |
| 2902 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites */ |
| 2903 | ROM_LOAD( "lohtb14.11", 0x00000, 0x10000, CRC(df5ac5ee) SHA1(5b45417ada402047d97dfb6cee6545686ad26e37) ) |
| 2904 | ROM_LOAD( "lohtb15.12", 0x20000, 0x10000, CRC(45220b01) SHA1(83715cf155f91c82067d69f14b3b01ed77777b7d) ) |
| 2905 | ROM_LOAD( "lohtb16.13", 0x40000, 0x10000, CRC(25b85cfc) SHA1(c7a9962165379193dc6553ed1f977795a79e0f78) ) |
| 2906 | ROM_LOAD( "lohtb17.14", 0x60000, 0x10000, CRC(763fa4ec) SHA1(2d72b1b41f24ae299fde23869942c0b6bbb82363) ) |
| 2907 | ROM_LOAD( "lohtb18.15", 0x10000, 0x10000, CRC(d7ecf849) SHA1(ab86a88eae21e054d4e8a740a60c7c6c198232d4) ) |
| 2908 | ROM_LOAD( "lohtb19.16", 0x30000, 0x10000, CRC(35d1a808) SHA1(9378ff000104ecfb842b3b884197be82c43a01b4)) |
| 2909 | ROM_LOAD( "lohtb20.17", 0x50000, 0x10000, CRC(464d8579) SHA1(b5981f4865ee5439f0e330091927e6d97d29933f) ) |
| 2910 | ROM_LOAD( "lohtb21.18", 0x70000, 0x10000, CRC(a73568c7) SHA1(8fe1867256708cc1ed76d1bed5566b1852b47c40) ) |
| 2911 | |
| 2912 | ROM_REGION( 0x040000, REGION_GFX2, ROMREGION_INVERT|ROMREGION_DISPOSE ) /* tiles #1 */ |
| 2913 | ROM_LOAD( "lohtb13.10", 0x00000, 0x10000, CRC(359f17d4) SHA1(2875ba48395e7faa1a58404475be936dcca45ed1) ) |
| 2914 | ROM_LOAD( "lohtb11.08", 0x10000, 0x10000, CRC(73391e8a) SHA1(53ca89b8a10895f817ecdb9fa5eef462edb94ae6) ) |
| 2915 | ROM_LOAD( "lohtb09.06", 0x20000, 0x10000, CRC(7096d390) SHA1(f4a16bf8aef7a1a65619ab022cbdb67d2f191888) ) |
| 2916 | ROM_LOAD( "lohtb07.04", 0x30000, 0x10000, CRC(71a27b81) SHA1(d8fe72d15bbcd5b170d1123d8f4c58874cefdca3) ) |
| 2917 | |
| 2918 | ROM_REGION( 0x040000, REGION_GFX3, ROMREGION_INVERT|ROMREGION_DISPOSE ) /* tiles #2 */ |
| 2919 | ROM_LOAD( "lohtb12.09", 0x00000, 0x10000, CRC(4d5e9b53) SHA1(3e3977bab7a66ed0171afcd555d181960e338749) ) |
| 2920 | ROM_LOAD( "lohtb10.07", 0x10000, 0x10000, CRC(4f75a26a) SHA1(79c09a1ad3a6f9cfbd07cb527bbd89d2478ce582) ) |
| 2921 | ROM_LOAD( "lohtb08.05", 0x20000, 0x10000, CRC(34854262) SHA1(37436c12579fb41d22a1596b495f065959c14a26) ) |
| 2922 | ROM_LOAD( "lohtb06.03", 0x30000, 0x10000, CRC(f923183c) SHA1(a6b578191864aefa81e0cad3ba12a2ca491c91cf) ) |
| 2923 | |
| 2924 | ROM_REGION( 0x10000, REGION_SOUND1, ROMREGION_ERASEFF ) /* -- no sample roms on bootleg, included with z80 code */ |
| 2925 | ROM_END |
| 2926 | |
| 2927 | |
| 2928 | ROM_START( lohtb2 ) |
| 2929 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) |
| 2930 | ROM_LOAD16_BYTE( "loht-a2.bin", 0x00001, 0x10000, CRC(ccc90e54) SHA1(860da001d9b0782adc25cfc3b453383225253d9e) ) |
| 2931 | ROM_LOAD16_BYTE( "loht-a3.bin", 0x20001, 0x10000, CRC(ff8a98de) SHA1(ccb8275241bea81abc01dc36e62557712c1b5a8c) ) |
| 2932 | ROM_LOAD16_BYTE( "loht-a10.bin", 0x00000, 0x10000, CRC(3aa06730) SHA1(483b135f8ee0fc54b1953c7c28e909a88aa2fa2e) ) |
| 2933 | ROM_LOAD16_BYTE( "loht-a11.bin", 0x20000, 0x10000, CRC(eab1d7bc) SHA1(ec50fe89f05ae46e91b9f2f3d4e4383aa764e71d) ) |
| 2934 | |
| 2935 | ROM_LOAD16_BYTE( "loht-a5.bin", 0x40001, 0x10000, CRC(79e007ec) SHA1(b2e4cc4a47f5f127ba9a1a00eaaf067464314ea0) ) |
| 2936 | ROM_RELOAD( 0xc0001, 0x10000 ) |
| 2937 | ROM_LOAD16_BYTE( "loht-a4.bin", 0x60001, 0x10000, CRC(254ea4d5) SHA1(07277bbe2ea6678f0de1f28e40be794880b3faff) ) |
| 2938 | ROM_RELOAD( 0xe0001, 0x10000 ) |
| 2939 | ROM_LOAD16_BYTE( "loht-a13.bin", 0x40000, 0x10000, CRC(b951346e) SHA1(82fa3c4a09a86b74b98c31aaea5c0629ddff83a0) ) |
| 2940 | ROM_RELOAD( 0xc0000, 0x10000 ) |
| 2941 | ROM_LOAD16_BYTE( "loht-a12.bin", 0x60000, 0x10000, CRC(cfb0390d) SHA1(4acc61a51a7ae681bd8d835e2644b44c4d6d7bcb) ) |
| 2942 | ROM_RELOAD( 0xe0000, 0x10000 ) |
| 2943 | |
| 2944 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2945 | ROM_LOAD( "loht-a26.bin", 0x00000, 0x2000, CRC(ac901e17) SHA1(70a73288d594c78ad2aca78ce55a699cb040bede) ) // unprotected?? |
| 2946 | |
| 2947 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2948 | ROM_LOAD( "loht-a16.bin", 0x00000, 0x10000, CRC(df5ac5ee) SHA1(5b45417ada402047d97dfb6cee6545686ad26e37) ) |
| 2949 | ROM_LOAD( "loht-a17.bin", 0x10000, 0x10000, CRC(d7ecf849) SHA1(ab86a88eae21e054d4e8a740a60c7c6c198232d4) ) |
| 2950 | ROM_LOAD( "loht-a8.bin", 0x20000, 0x10000, CRC(45220b01) SHA1(83715cf155f91c82067d69f14b3b01ed77777b7d) ) |
| 2951 | ROM_LOAD( "loht-a9.bin", 0x30000, 0x10000, CRC(4af9bb3c) SHA1(04f66caae5b3ae985451002293ad8f609a8d9377) ) |
| 2952 | ROM_LOAD( "loht-a14.bin", 0x40000, 0x10000, CRC(25b85cfc) SHA1(c7a9962165379193dc6553ed1f977795a79e0f78) ) |
| 2953 | ROM_LOAD( "loht-a15.bin", 0x50000, 0x10000, CRC(464d8579) SHA1(b5981f4865ee5439f0e330091927e6d97d29933f) ) |
| 2954 | ROM_LOAD( "loht-a6.bin", 0x60000, 0x10000, CRC(763fa4ec) SHA1(2d72b1b41f24ae299fde23869942c0b6bbb82363) ) |
| 2955 | ROM_LOAD( "loht-a7.bin", 0x70000, 0x10000, CRC(a73568c7) SHA1(8fe1867256708cc1ed76d1bed5566b1852b47c40) ) |
| 2956 | |
| 2957 | ROM_REGION( 0x040000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 2958 | ROM_LOAD( "loht-a19.bin", 0x00000, 0x10000, CRC(3ca3e771) SHA1(be052e01c5429ee89057c9d408794f2c7744047c) ) /* tiles #1 */ |
| 2959 | // ROM_LOAD( "loht-a20.bin", 0x10000, 0x10000, BAD_DUMP CRC(db2e3d77) SHA1(3f0758f74490b084321d8b2da29525dd1f19da09) ) |
| 2960 | ROM_LOAD( "loht-a20.bin", 0x10000, 0x10000, CRC(7a05ee2f) SHA1(7d1ca5db9a5a85610129e3bc6c640ade036fe7f9) ) |
| 2961 | ROM_LOAD( "loht-a18.bin", 0x20000, 0x10000, CRC(79aa2335) SHA1(6b70c79d800a7b755aa7c9a368c4ea74029aaa1e) ) |
| 2962 | ROM_LOAD( "loht-a21.bin", 0x30000, 0x10000, CRC(789e8b24) SHA1(e957cd25c3c155ca295ab1aea03d610f91562cfb) ) |
| 2963 | |
| 2964 | ROM_REGION( 0x040000, REGION_GFX3, ROMREGION_DISPOSE ) |
| 2965 | ROM_LOAD( "loht-a24.bin", 0x00000, 0x10000, CRC(44626bf6) SHA1(571ef74d42d30a272ff0fb33f830652b4a4bad29) ) /* tiles #2 */ |
| 2966 | ROM_LOAD( "loht-a25.bin", 0x10000, 0x10000, CRC(464952cf) SHA1(6b99360b6ba1ed5a72c257f51291f9f7a1ddf363) ) |
| 2967 | ROM_LOAD( "loht-a23.bin", 0x20000, 0x10000, CRC(3db9b2c7) SHA1(02a318ffc459c494b7f40827eff5f89b41ac0426) ) |
| 2968 | ROM_LOAD( "loht-a22.bin", 0x30000, 0x10000, CRC(f01fe899) SHA1(c5ab967b7af55a757638bcdc9975f4b15064022d) ) |
| 2969 | |
| 2970 | ROM_REGION( 0x10000, REGION_SOUND1, 0 ) /* samples */ |
| 2971 | ROM_LOAD( "loht-a1.bin", 0x00000, 0x10000, CRC(3ed51d1f) SHA1(84f3aa17d640df91387e5f1f5b5971cf8dcd4e17) ) |
| 2972 | ROM_END |
| 2973 | |
| 2974 | |
| 2702 | 2975 | ROM_START( xmultipl ) |
| 2703 | 2976 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) |
| 2704 | 2977 | ROM_LOAD16_BYTE( "ch3.h3", 0x00001, 0x20000, CRC(20685021) SHA1(92f4216320bf525045223b9454fb5bb224c536d8) ) |
| r1070 | r1071 | |
| 2708 | 2981 | ROM_LOAD16_BYTE( "cl0.l0", 0x40000, 0x10000, CRC(06a9e213) SHA1(9831c110814642703d6e71d49848d854095b7d3a) ) |
| 2709 | 2982 | ROM_RELOAD( 0xe0000, 0x10000 ) |
| 2710 | 2983 | |
| 2984 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 2985 | ROM_LOAD( "xmultipl_i8751.mcu", 0x00000, 0x10000, NO_DUMP ) // read protected |
| 2986 | |
| 2711 | 2987 | ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2712 | 2988 | ROM_LOAD( "t44.00", 0x00000, 0x20000, CRC(db45186e) SHA1(8c8edeb4b7e6b0516f2597823dc27eba9c5d9528) ) /* sprites */ |
| 2713 | 2989 | ROM_LOAD( "t45.01", 0x20000, 0x20000, CRC(4d0764d4) SHA1(4942333336a110b033f16ac1afa06ffef7b2dad6) ) |
| r1070 | r1071 | |
| 2771 | 3047 | ROM_LOAD16_BYTE( "db_c-l0.rom", 0x60000, 0x10000, CRC(ed0f5e06) SHA1(9030840b15e83c18d59c884ed08c93c05fa70c5b) ) |
| 2772 | 3048 | ROM_RELOAD( 0xe0000, 0x10000 ) |
| 2773 | 3049 | |
| 3050 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 3051 | ROM_LOAD( "dbreed72_i8751.mcu", 0x00000, 0x10000, NO_DUMP ) // read protected |
| 3052 | |
| 2774 | 3053 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2775 | 3054 | ROM_LOAD( "db_k800m.00", 0x00000, 0x20000, CRC(c027a8cf) SHA1(534dc416b8f5587168c7f644d3f9438c8a190491) ) /* sprites */ |
| 2776 | 3055 | ROM_LOAD( "db_k801m.10", 0x20000, 0x20000, CRC(093faf33) SHA1(2704f644cdce87daf975984f143b1d55ba731c3f) ) |
| r1070 | r1071 | |
| 2984 | 3263 | ROM_LOAD16_BYTE( "ge72-l3.bin", 0x60000, 0x10000, CRC(23d303a5) SHA1(b62010f34d71afb590deae458493454f9af38f7c) ) |
| 2985 | 3264 | ROM_RELOAD( 0xe0000, 0x10000 ) |
| 2986 | 3265 | |
| 3266 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 3267 | ROM_LOAD( "dkgenm72_i8751.mcu", 0x00000, 0x10000, NO_DUMP ) // read protected |
| 3268 | |
| 2987 | 3269 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 2988 | 3270 | ROM_LOAD( "hh_00.rom", 0x00000, 0x20000, CRC(ec5127ef) SHA1(014ac8ad7b19cd9b475b72a0f42a4991119501c4) ) /* sprites */ |
| 2989 | 3271 | ROM_LOAD( "hh_10.rom", 0x20000, 0x20000, CRC(def65294) SHA1(23f5d99fa9f604fde37cb52113bff233d9be1d25) ) |
| r1070 | r1071 | |
| 3099 | 3381 | ROM_LOAD16_BYTE( "ad-c-l3.bin", 0x40000, 0x20000, CRC(9dd343f7) SHA1(9f499936b6d3807aa5b5c18e9811c73c9a2c99f9) ) |
| 3100 | 3382 | ROM_RELOAD( 0xc0000, 0x20000 ) |
| 3101 | 3383 | |
| 3384 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 3385 | ROM_LOAD( "airduel_i8751.mcu", 0x00000, 0x10000, NO_DUMP ) // read protected |
| 3386 | |
| 3102 | 3387 | ROM_REGION( 0x080000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 3103 | 3388 | ROM_LOAD( "ad-00.bin", 0x00000, 0x20000, CRC(2f0d599b) SHA1(a966f806b5e25bb98cc63c46c49e0e676a62afcf) ) /* sprites */ |
| 3104 | 3389 | ROM_LOAD( "ad-10.bin", 0x20000, 0x20000, CRC(9865856b) SHA1(b18a06899ae29d45e2351594df544220f3f4485a) ) |
| r1070 | r1071 | |
| 3223 | 3508 | GAME( 1988, nspiritj, nspirit, m72, nspirit, nspiritj, ROT0, "Irem", "Saigo no Nindou (Japan)", GAME_NO_COCKTAIL ) |
| 3224 | 3509 | GAME( 1988, imgfight, 0, m72, imgfight, imgfight, ROT270, "Irem", "Image Fight (Japan)", 0 ) |
| 3225 | 3510 | GAME( 1989, loht, 0, m72, loht, loht, ROT0, "Irem", "Legend of Hero Tonma", GAME_NO_COCKTAIL ) |
| 3511 | GAME( 1989, lohtj, loht, m72, loht, loht, ROT0, "Irem", "Legend of Hero Tonma (Japan)", GAME_NO_COCKTAIL ) |
| 3512 | GAME( 1989, lohtb, loht, m72, loht, 0, ROT0, "Irem", "Legend of Hero Tonma (bootleg)", GAME_NOT_WORKING| GAME_NO_COCKTAIL ) |
| 3513 | GAME( 1989, lohtb2, loht, m72_8751, loht, loht_mcu, ROT0, "Irem", "Legend of Hero Tonma (bootleg, set 2)", GAME_NO_COCKTAIL ) |
| 3226 | 3514 | GAME( 1989, xmultipl, 0, xmultipl, xmultipl, xmultipl, ROT0, "Irem", "X Multiply (Japan)", GAME_NO_COCKTAIL ) |
| 3227 | 3515 | GAME( 1989, dbreed, 0, dbreed, dbreed, 0, ROT0, "Irem", "Dragon Breed (M81 pcb version)", GAME_NO_COCKTAIL ) |
| 3228 | 3516 | GAME( 1989, dbreed72, dbreed, dbreed72, dbreed, dbreed72, ROT0, "Irem", "Dragon Breed (M72 pcb version)", GAME_NO_COCKTAIL ) |
src/mame/drivers/cabal.c
| r1070 | r1071 | |
| 64 | 64 | |
| 65 | 65 | /******************************************************************************************/ |
| 66 | 66 | |
| 67 | // we should emulate the z80s, not simulate them |
| 68 | #if 0 |
| 67 | 69 | static struct cabalbl_adpcm_state |
| 68 | 70 | { |
| 69 | 71 | struct adpcm_state adpcm; |
| r1070 | r1071 | |
| 149 | 151 | } |
| 150 | 152 | } |
| 151 | 153 | } |
| 152 | | |
| 154 | #endif |
| 153 | 155 | static WRITE16_HANDLER( cabalbl_sndcmd_w ) |
| 154 | 156 | { |
| 155 | 157 | switch (offset) |
| r1070 | r1071 | |
| 267 | 269 | |
| 268 | 270 | /*********************************************************************/ |
| 269 | 271 | |
| 272 | |
| 270 | 273 | static READ8_HANDLER( cabalbl_snd_r ) |
| 271 | 274 | { |
| 272 | 275 | switch(offset){ |
| r1070 | r1071 | |
| 279 | 282 | |
| 280 | 283 | static WRITE8_HANDLER( cabalbl_snd_w ) |
| 281 | 284 | { |
| 285 | #if 0 |
| 282 | 286 | switch( offset ){ |
| 283 | 287 | case 0x00: cabalbl_play_adpcm( 0, data ); break; |
| 284 | 288 | case 0x02: cabalbl_play_adpcm( 1, data ); break; |
| 285 | 289 | } |
| 290 | #endif |
| 286 | 291 | } |
| 287 | 292 | |
| 288 | 293 | static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 ) |
| r1070 | r1071 | |
| 331 | 336 | AM_RANGE(0x8000, 0xffff) AM_WRITE(MWA8_ROM) |
| 332 | 337 | ADDRESS_MAP_END |
| 333 | 338 | |
| 334 | | /* ADPCM CPU (common) */ |
| 339 | /* the bootleg has 2x z80 sample players */ |
| 335 | 340 | |
| 336 | | #if 0 |
| 337 | | static ADDRESS_MAP_START( cabalbl_readmem_adpcm, ADDRESS_SPACE_PROGRAM, 8 ) |
| 338 | | AM_RANGE(0x0000, 0xffff) AM_READ(MRA8_ROM) |
| 341 | READ8_HANDLER( cabalbl_talk1_port00_r ) |
| 342 | { |
| 343 | return mame_rand(Machine); |
| 344 | } |
| 345 | |
| 346 | static ADDRESS_MAP_START( cabalbl_talk1_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 347 | AM_RANGE(0x0000, 0xffff) AM_READWRITE(MRA8_ROM, MWA8_NOP) |
| 339 | 348 | ADDRESS_MAP_END |
| 340 | | static ADDRESS_MAP_START( cabalbl_writemem_adpcm, ADDRESS_SPACE_PROGRAM, 8 ) |
| 341 | | AM_RANGE(0x0000, 0xffff) AM_WRITE(MWA8_NOP) |
| 349 | |
| 350 | static ADDRESS_MAP_START( cabalbl_talk1_portmap, ADDRESS_SPACE_IO, 8 ) |
| 351 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 352 | AM_RANGE(0x00, 0x00) AM_READ(cabalbl_talk1_port00_r) |
| 353 | AM_RANGE(0x01, 0x01) AM_WRITE(MWA8_NOP) // DAC output? |
| 342 | 354 | ADDRESS_MAP_END |
| 343 | | #endif |
| 344 | 355 | |
| 356 | READ8_HANDLER( cabalbl_talk2_port00_r ) |
| 357 | { |
| 358 | return mame_rand(Machine); |
| 359 | } |
| 345 | 360 | |
| 361 | static ADDRESS_MAP_START( cabalbl_talk2_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 362 | AM_RANGE(0x0000, 0xffff) AM_READWRITE(MRA8_ROM, MWA8_NOP) |
| 363 | ADDRESS_MAP_END |
| 364 | |
| 365 | static ADDRESS_MAP_START( cabalbl_talk2_portmap, ADDRESS_SPACE_IO, 8 ) |
| 366 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 367 | AM_RANGE(0x00, 0x00) AM_READ(cabalbl_talk2_port00_r) |
| 368 | AM_RANGE(0x01, 0x01) AM_WRITE(MWA8_NOP) // DAC output? |
| 369 | ADDRESS_MAP_END |
| 370 | |
| 346 | 371 | /***************************************************************************/ |
| 347 | 372 | |
| 348 | 373 | #define CABALDSW\ |
| r1070 | r1071 | |
| 409 | 434 | PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )\ |
| 410 | 435 | PORT_DIPSETTING( 0x8000, DEF_STR( On ) ) |
| 411 | 436 | |
| 412 | | INPUT_PORTS_START( cabal ) |
| 437 | INPUT_PORTS_START( cabalt ) |
| 438 | CABALDSW |
| 413 | 439 | |
| 414 | | CABALDSW |
| 415 | 440 | PORT_START_TAG("IN0") |
| 416 | 441 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 417 | 442 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| r1070 | r1071 | |
| 440 | 465 | PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(30) PORT_PLAYER(2) |
| 441 | 466 | INPUT_PORTS_END |
| 442 | 467 | |
| 468 | |
| 469 | |
| 470 | INPUT_PORTS_START( cabalj ) |
| 471 | CABALDSW |
| 472 | |
| 473 | /* Since the Trackball version was produced first, and it doesn't use |
| 474 | the third button, Pin 24 of the JAMMA connector ('JAMMA button 3') |
| 475 | has no trace on the pcb. To work around this design issue the |
| 476 | manufacturer had to use pin 15 which is usually the test / service |
| 477 | button |
| 478 | */ |
| 479 | PORT_START_TAG("IN0") |
| 480 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 481 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 482 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 483 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 484 | PORT_BIT( 0x0ff0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 485 | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) /* the 3rd button connects to the service switch */ |
| 486 | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) |
| 487 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START2 ) |
| 488 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 ) |
| 489 | |
| 490 | PORT_START_TAG("IN1") |
| 491 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(4) /* read through sound cpu */ |
| 492 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(4) /* read through sound cpu */ |
| 493 | PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 494 | |
| 495 | /* The joystick version has a PCB marked "Joystick sub" containing a 74ls245. It plugs in the |
| 496 | sockets of the two D4701AC */ |
| 497 | PORT_START_TAG("IN2") |
| 498 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 499 | |
| 500 | PORT_START_TAG("IN3") |
| 501 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 502 | |
| 503 | PORT_START_TAG("IN4") |
| 504 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 505 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 506 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| 507 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| 508 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) |
| 509 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| 510 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| 511 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) |
| 512 | |
| 513 | PORT_START_TAG("IN5") |
| 514 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 515 | INPUT_PORTS_END |
| 516 | |
| 443 | 517 | INPUT_PORTS_START( cabalbl ) |
| 444 | | CABALDSW |
| 518 | CABALDSW |
| 445 | 519 | |
| 446 | 520 | PORT_START_TAG("IN0") |
| 447 | 521 | PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r1070 | r1071 | |
| 471 | 545 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(4) /* read through sound cpu */ |
| 472 | 546 | INPUT_PORTS_END |
| 473 | 547 | |
| 474 | | |
| 475 | | |
| 476 | 548 | static const gfx_layout text_layout = |
| 477 | 549 | { |
| 478 | 550 | 8,8, |
| r1070 | r1071 | |
| 535 | 607 | |
| 536 | 608 | SEIBU_SOUND_SYSTEM_ADPCM_HARDWARE |
| 537 | 609 | |
| 538 | | static struct CustomSound_interface cabalbl_adpcm_interface = |
| 539 | | { |
| 540 | | cabalbl_adpcm_start, |
| 541 | | cabalbl_adpcm_stop |
| 542 | | }; |
| 543 | 610 | |
| 544 | 611 | |
| 545 | 612 | static MACHINE_DRIVER_START( cabal ) |
| r1070 | r1071 | |
| 580 | 647 | MDRV_SOUND_CONFIG(adpcm_interface) |
| 581 | 648 | MDRV_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.40) |
| 582 | 649 | |
| 583 | | |
| 584 | 650 | MDRV_SOUND_ADD(CUSTOM, 8000) |
| 585 | 651 | MDRV_SOUND_CONFIG(adpcm_interface) |
| 586 | 652 | MDRV_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.40) |
| 587 | 653 | MACHINE_DRIVER_END |
| 588 | 654 | |
| 655 | #if 0 |
| 656 | static struct CustomSound_interface cabalbl_adpcm_interface = |
| 657 | { |
| 658 | cabalbl_adpcm_start, |
| 659 | cabalbl_adpcm_stop |
| 660 | }; |
| 661 | #endif |
| 662 | |
| 663 | /* the bootleg has different sound hardware (2 extra Z80s for ADPCM playback) */ |
| 589 | 664 | static MACHINE_DRIVER_START( cabalbl ) |
| 590 | 665 | |
| 591 | 666 | /* basic machine hardware */ |
| r1070 | r1071 | |
| 594 | 669 | MDRV_CPU_VBLANK_INT(irq1_line_hold,1) |
| 595 | 670 | |
| 596 | 671 | MDRV_CPU_ADD(Z80, 4000000) |
| 597 | | /* audio CPU */ /* 4 MHz */ |
| 598 | 672 | MDRV_CPU_PROGRAM_MAP(cabalbl_readmem_sound,cabalbl_writemem_sound) |
| 599 | 673 | |
| 674 | /* there are 2x z80s for the ADPCM */ |
| 675 | MDRV_CPU_ADD(Z80, 4000000) |
| 676 | MDRV_CPU_PROGRAM_MAP(cabalbl_talk1_map,0) |
| 677 | MDRV_CPU_IO_MAP(cabalbl_talk1_portmap,0) |
| 678 | MDRV_CPU_VBLANK_INT(irq0_line_hold,10) |
| 679 | |
| 680 | MDRV_CPU_ADD(Z80, 4000000) |
| 681 | MDRV_CPU_PROGRAM_MAP(cabalbl_talk2_map,0) |
| 682 | MDRV_CPU_IO_MAP(cabalbl_talk2_portmap,0) |
| 683 | MDRV_CPU_VBLANK_INT(irq0_line_hold,10) |
| 684 | |
| 685 | |
| 600 | 686 | MDRV_SCREEN_REFRESH_RATE(60) |
| 601 | 687 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) |
| 602 | 688 | MDRV_INTERLEAVE(10) |
| r1070 | r1071 | |
| 621 | 707 | MDRV_SOUND_CONFIG(cabalbl_ym2151_interface) |
| 622 | 708 | MDRV_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.80) |
| 623 | 709 | |
| 624 | | MDRV_SOUND_ADD(CUSTOM, 8000) |
| 625 | | MDRV_SOUND_CONFIG(cabalbl_adpcm_interface) |
| 626 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) |
| 710 | // MDRV_SOUND_ADD(CUSTOM, 8000) |
| 711 | // MDRV_SOUND_CONFIG(cabalbl_adpcm_interface) |
| 712 | // MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) |
| 627 | 713 | |
| 628 | | MDRV_SOUND_ADD(CUSTOM, 8000) |
| 629 | | MDRV_SOUND_CONFIG(cabalbl_adpcm_interface) |
| 630 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) |
| 714 | // MDRV_SOUND_ADD(CUSTOM, 8000) |
| 715 | // MDRV_SOUND_CONFIG(cabalbl_adpcm_interface) |
| 716 | // MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) |
| 631 | 717 | MACHINE_DRIVER_END |
| 632 | 718 | |
| 633 | 719 | ROM_START( cabal ) |
| 634 | 720 | ROM_REGION( 0x50000, REGION_CPU1, 0 ) /* 64k for cpu code */ |
| 635 | | ROM_LOAD16_BYTE( "13.bin", 0x00000, 0x10000, CRC(00abbe0c) SHA1(bacf17444abfb4f56248ff56e37b0aa2b1a3800d) ) |
| 636 | | ROM_LOAD16_BYTE( "11.bin", 0x00001, 0x10000, CRC(96d5e8af) SHA1(1d6da95ef96d9c02aea70791e1cb87b70097d5ed) ) |
| 637 | | ROM_LOAD16_BYTE( "12.bin", 0x20000, 0x10000, CRC(d763a47c) SHA1(146d8082a404b6eddaf2dc9ba41a997949c17f8a) ) |
| 638 | | ROM_LOAD16_BYTE( "10.bin", 0x20001, 0x10000, CRC(96d5e8af) SHA1(ed7d854f08e87db5ae6cf526eafa029dfd2bfb9f) ) |
| 721 | ROM_LOAD16_BYTE( "13.7h", 0x00000, 0x10000, CRC(00abbe0c) SHA1(bacf17444abfb4f56248ff56e37b0aa2b1a3800d) ) |
| 722 | ROM_LOAD16_BYTE( "11.6h", 0x00001, 0x10000, CRC(44736281) SHA1(1d6da95ef96d9c02aea70791e1cb87b70097d5ed) ) |
| 723 | ROM_LOAD16_BYTE( "12.7j", 0x20000, 0x10000, CRC(d763a47c) SHA1(146d8082a404b6eddaf2dc9ba41a997949c17f8a) ) |
| 724 | ROM_LOAD16_BYTE( "10.6j", 0x20001, 0x10000, CRC(96d5e8af) SHA1(ed7d854f08e87db5ae6cf526eafa029dfd2bfb9f) ) |
| 639 | 725 | |
| 640 | 726 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for sound cpu code */ |
| 641 | 727 | ROM_LOAD( "4-3n", 0x0000, 0x2000, CRC(4038eff2) SHA1(0bcafc1b78c3bef9a0e9b822c482ea4a942fd180) ) |
| r1070 | r1071 | |
| 644 | 730 | ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 645 | 731 | ROM_LOAD( "5-6s", 0x00000, 0x04000, CRC(6a76955a) SHA1(733cb4b862b5dac97c2641b58f2362471e62fcf2) ) /* characters */ |
| 646 | 732 | |
| 733 | /* The Joystick versions use a sub-board instead of the mask roms |
| 734 | the content is the same as the mask roms */ |
| 647 | 735 | ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 648 | | ROM_LOAD( "tad-2.7s", 0x00000, 0x80000, CRC(13ca7ae1) SHA1(b26bb4876a6518e3809e0fa4d442616508b3e7e8) ) /* tiles */ |
| 649 | | #if 0 /* same data, different layout */ |
| 650 | | ROM_LOAD16_BYTE( "cabal_17.bin", 0x00000, 0x10000, CRC(3b6d2b09) ) |
| 651 | | ROM_LOAD16_BYTE( "cabal_15.bin", 0x00001, 0x10000, CRC(1023319b) ) |
| 652 | | ROM_LOAD16_BYTE( "cabal_16.bin", 0x20000, 0x10000, CRC(77bc7a60) ) |
| 653 | | ROM_LOAD16_BYTE( "cabal_14.bin", 0x20001, 0x10000, CRC(420b0801) ) |
| 654 | | ROM_LOAD16_BYTE( "cabal_18.bin", 0x40000, 0x10000, CRC(0bc50075) ) |
| 655 | | ROM_LOAD16_BYTE( "cabal_12.bin", 0x40001, 0x10000, CRC(543fcb37) ) |
| 656 | | ROM_LOAD16_BYTE( "cabal_19.bin", 0x60000, 0x10000, CRC(67e4fe47) ) |
| 657 | | ROM_LOAD16_BYTE( "cabal_13.bin", 0x60001, 0x10000, CRC(d28d921e) ) |
| 658 | | #endif |
| 736 | ROM_LOAD16_BYTE( "bg_rom1.bin", 0x00000, 0x10000, CRC(1023319b) ) |
| 737 | ROM_LOAD16_BYTE( "bg_rom2.bin", 0x00001, 0x10000, CRC(3b6d2b09) ) |
| 738 | ROM_LOAD16_BYTE( "bg_rom3.bin", 0x20000, 0x10000, CRC(420b0801) ) |
| 739 | ROM_LOAD16_BYTE( "bg_rom4.bin", 0x20001, 0x10000, CRC(77bc7a60) ) |
| 740 | ROM_LOAD16_BYTE( "bg_rom5.bin", 0x40000, 0x10000, CRC(543fcb37) ) |
| 741 | ROM_LOAD16_BYTE( "bg_rom6.bin", 0x40001, 0x10000, CRC(0bc50075) ) |
| 742 | ROM_LOAD16_BYTE( "bg_rom7.bin", 0x60000, 0x10000, CRC(d28d921e) ) |
| 743 | ROM_LOAD16_BYTE( "bg_rom8.bin", 0x60001, 0x10000, CRC(67e4fe47) ) |
| 659 | 744 | |
| 660 | 745 | ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE ) |
| 661 | | ROM_LOAD( "tad-1.5e", 0x00000, 0x80000, CRC(8324a7fe) SHA1(aed4470df35ec18e65e35bddc9c217a5019fdcbf) ) /* sprites */ |
| 662 | | #if 0 /* same data, different layout */ |
| 663 | | ROM_LOAD16_BYTE( "cabal_05.bin", 0x00000, 0x10000, CRC(4e49c28e) ) |
| 664 | | ROM_LOAD16_BYTE( "cabal_04.bin", 0x00001, 0x10000, CRC(34d3cac8) ) |
| 665 | | ROM_LOAD16_BYTE( "cabal_06.bin", 0x20000, 0x10000, CRC(6a0e739d) ) |
| 666 | | ROM_LOAD16_BYTE( "cabal_03.bin", 0x20001, 0x10000, CRC(7065e840) ) |
| 667 | | ROM_LOAD16_BYTE( "cabal_07.bin", 0x40000, 0x10000, CRC(581a50c1) ) |
| 668 | | ROM_LOAD16_BYTE( "cabal_02.bin", 0x40001, 0x10000, CRC(0e1ec30e) ) |
| 669 | | ROM_LOAD16_BYTE( "cabal_08.bin", 0x60000, 0x10000, CRC(702735c9) ) |
| 670 | | ROM_LOAD16_BYTE( "cabal_01.bin", 0x60001, 0x10000, CRC(55c44764) ) |
| 671 | | #endif |
| 746 | ROM_LOAD16_BYTE( "sp_rom1.bin", 0x00000, 0x10000, CRC(34d3cac8) ) |
| 747 | ROM_LOAD16_BYTE( "sp_rom2.bin", 0x00001, 0x10000, CRC(4e49c28e) ) |
| 748 | ROM_LOAD16_BYTE( "sp_rom3.bin", 0x20000, 0x10000, CRC(7065e840) ) |
| 749 | ROM_LOAD16_BYTE( "sp_rom4.bin", 0x20001, 0x10000, CRC(6a0e739d) ) |
| 750 | ROM_LOAD16_BYTE( "sp_rom5.bin", 0x40000, 0x10000, CRC(0e1ec30e) ) |
| 751 | ROM_LOAD16_BYTE( "sp_rom6.bin", 0x40001, 0x10000, CRC(581a50c1) ) |
| 752 | ROM_LOAD16_BYTE( "sp_rom7.bin", 0x60000, 0x10000, CRC(55c44764) ) |
| 753 | ROM_LOAD16_BYTE( "sp_rom8.bin", 0x60001, 0x10000, CRC(702735c9) ) |
| 672 | 754 | |
| 673 | | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) /* Samples? */ |
| 755 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) /* Samples */ |
| 674 | 756 | ROM_LOAD( "2-1s", 0x00000, 0x10000, CRC(850406b4) SHA1(23ac1650c6d6f35607a5264b3aa89868401a645a) ) |
| 675 | 757 | ROM_LOAD( "1-1u", 0x10000, 0x10000, CRC(8b3e0789) SHA1(b1450db1b1bada237c90930623e4def321099f13) ) |
| 758 | ROM_END |
| 676 | 759 | |
| 760 | ROM_START( cabala ) |
| 761 | ROM_REGION( 0x50000, REGION_CPU1, 0 ) /* 64k for cpu code */ |
| 762 | ROM_LOAD16_BYTE( "epr-a-9.7h", 0x00000, 0x10000, CRC(00abbe0c) SHA1(bacf17444abfb4f56248ff56e37b0aa2b1a3800d) ) |
| 763 | ROM_LOAD16_BYTE( "epr-a-7.6h", 0x00001, 0x10000, CRC(c89608db) SHA1(a56e77526227af5b693eea9ef74da0d9d57cc55c) ) |
| 764 | ROM_LOAD16_BYTE( "epr-a-8.7k", 0x20000, 0x08000, CRC(fe84788a) SHA1(29c49ebbe62357c27befcdcc4c19841a8bf32b2d) ) |
| 765 | ROM_RELOAD(0x30000,0x08000) |
| 766 | ROM_LOAD16_BYTE( "epr-a-6.6k", 0x20001, 0x08000, CRC(81eb1355) SHA1(bbf926d40164d78319e982da0e8fb8ec4d4f8b87) ) |
| 767 | ROM_RELOAD(0x30001,0x08000) |
| 768 | |
| 769 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for sound cpu code */ |
| 770 | ROM_LOAD( "epr-a-4.3n", 0x0000, 0x2000, CRC(4038eff2) SHA1(0bcafc1b78c3bef9a0e9b822c482ea4a942fd180) ) |
| 771 | ROM_LOAD( "epr-a-3.3p", 0x8000, 0x4000, CRC(c0097c55) SHA1(874f813c1b466dab2d15a707e340b9bdb200246c) ) |
| 772 | |
| 773 | ROM_REGION( 0x8000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 774 | ROM_LOAD( "epr-a-5.6s", 0x00000, 0x08000, CRC(189033fd) SHA1(814f0cbc5f72345c04922d6d7c986f99d57335fa) ) /* characters */ |
| 775 | |
| 776 | ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 777 | ROM_LOAD( "tad-2.7s", 0x00000, 0x80000, CRC(13ca7ae1) SHA1(b26bb4876a6518e3809e0fa4d442616508b3e7e8) ) /* tiles */ |
| 778 | |
| 779 | ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE ) |
| 780 | ROM_LOAD( "tad-1.5e", 0x00000, 0x80000, CRC(8324a7fe) SHA1(aed4470df35ec18e65e35bddc9c217a5019fdcbf) ) /* sprites */ |
| 781 | |
| 782 | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) /* Samples */ |
| 783 | ROM_LOAD( "epr-a-2.1s", 0x00000, 0x10000, CRC(850406b4) SHA1(23ac1650c6d6f35607a5264b3aa89868401a645a) ) |
| 784 | ROM_LOAD( "epr-a-1.1u", 0x10000, 0x10000, CRC(8b3e0789) SHA1(b1450db1b1bada237c90930623e4def321099f13) ) |
| 677 | 785 | ROM_END |
| 678 | 786 | |
| 679 | 787 | ROM_START( cabalus ) |
| r1070 | r1071 | |
| 705 | 813 | ROM_LOAD( "prom10.4j", 0x0100, 0x0100, CRC(261c93bc) SHA1(942470198143d584d3766f28587d1879abd912c1) ) |
| 706 | 814 | ROM_END |
| 707 | 815 | |
| 708 | | ROM_START( cabal2 ) |
| 816 | ROM_START( cabalus2 ) |
| 709 | 817 | ROM_REGION( 0x50000, REGION_CPU1, 0 ) /* 64k for cpu code */ |
| 710 | 818 | ROM_LOAD16_BYTE( "9-7h", 0x00000, 0x10000, CRC(ebbb9484) SHA1(2c77d5b4acdc37720dc7ccab526862981bf8da51) ) |
| 711 | 819 | ROM_LOAD16_BYTE( "7-6h", 0x00001, 0x10000, CRC(51aeb49e) SHA1(df38dc58d8c6fa3d35904bf34e29111e7bd523ad) ) |
| r1070 | r1071 | |
| 734 | 842 | ROM_LOAD( "prom10.4j", 0x0100, 0x0100, CRC(261c93bc) SHA1(942470198143d584d3766f28587d1879abd912c1) ) |
| 735 | 843 | ROM_END |
| 736 | 844 | |
| 845 | /* |
| 846 | |
| 847 | cabal - tad corporation ? - (clone) |
| 848 | |
| 849 | 2 boards |
| 850 | |
| 851 | 1st board |
| 852 | |
| 853 | (prg) |
| 854 | 1 x 68000 |
| 855 | from cabal_21 to cabal_24 |
| 856 | |
| 857 | (snd) |
| 858 | 1 x z80 |
| 859 | 1 x ym2151 |
| 860 | cabal_11 |
| 861 | |
| 862 | (gfx ?) |
| 863 | from cabal_12 to cabal_19 |
| 864 | |
| 865 | (?) |
| 866 | 2 x z80 |
| 867 | cabal_09 and cabal_10 |
| 868 | |
| 869 | (?) |
| 870 | cabal_20 (near the snd area) |
| 871 | |
| 872 | 2nd board |
| 873 | |
| 874 | (gfx) |
| 875 | from cabal_01 to cabal_08 |
| 876 | |
| 877 | Note: The bootleg has *3* Z80s |
| 878 | |
| 879 | */ |
| 880 | |
| 737 | 881 | ROM_START( cabalbl ) |
| 738 | 882 | ROM_REGION( 0x50000, REGION_CPU1, 0 ) /* 64k for cpu code */ |
| 739 | 883 | ROM_LOAD16_BYTE( "cabal_24.bin", 0x00000, 0x10000, CRC(00abbe0c) SHA1(bacf17444abfb4f56248ff56e37b0aa2b1a3800d) ) |
| r1070 | r1071 | |
| 744 | 888 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for sound cpu code */ |
| 745 | 889 | ROM_LOAD( "cabal_11.bin", 0x0000, 0x10000, CRC(d308a543) SHA1(4f45db42512f83266001daee55d06f49e7908e35) ) |
| 746 | 890 | |
| 747 | | ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 748 | | ROM_LOAD( "5-6s", 0x00000, 0x04000, CRC(6a76955a) SHA1(733cb4b862b5dac97c2641b58f2362471e62fcf2) ) /* characters */ |
| 891 | ROM_REGION( 0x8000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 892 | ROM_LOAD( "cabal_20.bin", 0x00000, 0x08000, CRC(189033fd) SHA1(814f0cbc5f72345c04922d6d7c986f99d57335fa) ) /* characters */ |
| 749 | 893 | |
| 894 | /* The bootleg versions use a sub-board instead of the mask roms |
| 895 | the content is the same as the mask roms */ |
| 750 | 896 | ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 751 | | ROM_LOAD( "tad-2.7s", 0x00000, 0x80000, CRC(13ca7ae1) SHA1(b26bb4876a6518e3809e0fa4d442616508b3e7e8) ) /* tiles */ |
| 752 | | #if 0 /* same data, different layout */ |
| 753 | | ROM_LOAD16_BYTE( "cabal_17.bin", 0x00000, 0x10000, CRC(3b6d2b09) ) |
| 754 | | ROM_LOAD16_BYTE( "cabal_15.bin", 0x00001, 0x10000, CRC(1023319b) ) |
| 755 | | ROM_LOAD16_BYTE( "cabal_16.bin", 0x20000, 0x10000, CRC(77bc7a60) ) |
| 756 | | ROM_LOAD16_BYTE( "cabal_14.bin", 0x20001, 0x10000, CRC(420b0801) ) |
| 757 | | ROM_LOAD16_BYTE( "cabal_18.bin", 0x40000, 0x10000, CRC(0bc50075) ) |
| 758 | | ROM_LOAD16_BYTE( "cabal_12.bin", 0x40001, 0x10000, CRC(543fcb37) ) |
| 759 | | ROM_LOAD16_BYTE( "cabal_19.bin", 0x60000, 0x10000, CRC(67e4fe47) ) |
| 760 | | ROM_LOAD16_BYTE( "cabal_13.bin", 0x60001, 0x10000, CRC(d28d921e) ) |
| 761 | | #endif |
| 897 | ROM_LOAD16_BYTE( "cabal_15.bin", 0x00000, 0x10000, CRC(1023319b) ) |
| 898 | ROM_LOAD16_BYTE( "cabal_17.bin", 0x00001, 0x10000, CRC(3b6d2b09) ) |
| 899 | ROM_LOAD16_BYTE( "cabal_14.bin", 0x20000, 0x10000, CRC(420b0801) ) |
| 900 | ROM_LOAD16_BYTE( "cabal_16.bin", 0x20001, 0x10000, CRC(77bc7a60) ) |
| 901 | ROM_LOAD16_BYTE( "cabal_12.bin", 0x40000, 0x10000, CRC(543fcb37) ) |
| 902 | ROM_LOAD16_BYTE( "cabal_18.bin", 0x40001, 0x10000, CRC(0bc50075) ) |
| 903 | ROM_LOAD16_BYTE( "cabal_13.bin", 0x60000, 0x10000, CRC(d28d921e) ) |
| 904 | ROM_LOAD16_BYTE( "cabal_19.bin", 0x60001, 0x10000, CRC(67e4fe47) ) |
| 762 | 905 | |
| 763 | 906 | ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE ) |
| 764 | | ROM_LOAD( "tad-1.5e", 0x00000, 0x80000, CRC(8324a7fe) SHA1(aed4470df35ec18e65e35bddc9c217a5019fdcbf) ) /* sprites */ |
| 765 | | #if 0 /* same data, different layout */ |
| 766 | | ROM_LOAD16_BYTE( "cabal_05.bin", 0x00000, 0x10000, CRC(4e49c28e) ) |
| 767 | | ROM_LOAD16_BYTE( "cabal_04.bin", 0x00001, 0x10000, CRC(34d3cac8) ) |
| 768 | | ROM_LOAD16_BYTE( "cabal_06.bin", 0x20000, 0x10000, CRC(6a0e739d) ) |
| 769 | | ROM_LOAD16_BYTE( "cabal_03.bin", 0x20001, 0x10000, CRC(7065e840) ) |
| 770 | | ROM_LOAD16_BYTE( "cabal_07.bin", 0x40000, 0x10000, CRC(581a50c1) ) |
| 771 | | ROM_LOAD16_BYTE( "cabal_02.bin", 0x40001, 0x10000, CRC(0e1ec30e) ) |
| 772 | | ROM_LOAD16_BYTE( "cabal_08.bin", 0x60000, 0x10000, CRC(702735c9) ) |
| 773 | | ROM_LOAD16_BYTE( "cabal_01.bin", 0x60001, 0x10000, CRC(55c44764) ) |
| 774 | | #endif |
| 907 | ROM_LOAD16_BYTE( "cabal_04.bin", 0x00000, 0x10000, CRC(34d3cac8) ) |
| 908 | ROM_LOAD16_BYTE( "cabal_05.bin", 0x00001, 0x10000, CRC(4e49c28e) ) |
| 909 | ROM_LOAD16_BYTE( "cabal_03.bin", 0x20000, 0x10000, CRC(7065e840) ) |
| 910 | ROM_LOAD16_BYTE( "cabal_06.bin", 0x20001, 0x10000, CRC(6a0e739d) ) |
| 911 | ROM_LOAD16_BYTE( "cabal_02.bin", 0x40000, 0x10000, CRC(0e1ec30e) ) |
| 912 | ROM_LOAD16_BYTE( "cabal_07.bin", 0x40001, 0x10000, CRC(581a50c1) ) |
| 913 | ROM_LOAD16_BYTE( "cabal_01.bin", 0x60000, 0x10000, CRC(55c44764) ) |
| 914 | ROM_LOAD16_BYTE( "cabal_08.bin", 0x60001, 0x10000, CRC(702735c9) ) |
| 775 | 915 | |
| 776 | | ROM_REGION( 0x20000, REGION_SOUND1, 0 ) |
| 916 | ROM_REGION( 0x10000, REGION_CPU3, 0 ) |
| 777 | 917 | ROM_LOAD( "cabal_09.bin", 0x00000, 0x10000, CRC(4ffa7fe3) SHA1(381d8e765a7b94678fb3308965c748bbe9f8e247) ) /* Z80 code/adpcm data */ |
| 778 | | ROM_LOAD( "cabal_10.bin", 0x10000, 0x10000, CRC(958789b6) SHA1(344c3ee8a1e272b56499e5c0415bb714aec0ddcf) ) /* Z80 code/adpcm data */ |
| 918 | |
| 919 | ROM_REGION( 0x10000, REGION_CPU4, 0 ) |
| 920 | ROM_LOAD( "cabal_10.bin", 0x00000, 0x10000, CRC(958789b6) SHA1(344c3ee8a1e272b56499e5c0415bb714aec0ddcf) ) /* Z80 code/adpcm data */ |
| 779 | 921 | ROM_END |
| 780 | 922 | |
| 781 | 923 | |
| r1070 | r1071 | |
| 787 | 929 | } |
| 788 | 930 | |
| 789 | 931 | |
| 790 | | GAME( 1988, cabal, 0, cabal, cabal, cabal, ROT0, "Tad (Fabtek license)", "Cabal (US set 1)", 0 ) |
| 791 | | GAME( 1988, cabal2, cabal, cabal, cabal, cabal, ROT0, "Tad (Fabtek license)", "Cabal (US set 2)", 0 ) |
| 792 | | GAME( 1988, cabalbl, cabal, cabalbl, cabalbl, 0, ROT0, "bootleg", "Cabal (bootleg)", GAME_IMPERFECT_SOUND ) |
| 932 | GAME( 1988, cabal, 0, cabal, cabalj, cabal, ROT0, "Tad Corporation", "Cabal (World, Joystick version)", 0 ) |
| 933 | GAME( 1989, cabala, cabal, cabal, cabalj, cabal, ROT0, "Tad Corporation (Alpha Trading license)", "Cabal (Alpha Trading)", 0 ) // korea? |
| 934 | GAME( 1988, cabalbl, cabal, cabalbl, cabalbl, 0, ROT0, "[Tad Corporation] (Red Corporation bootleg)", "Cabal (bootleg of Joystick version)", GAME_IMPERFECT_SOUND ) |
| 935 | |
| 936 | GAME( 1988, cabalus, cabal, cabal, cabalt, cabal, ROT0, "Tad (Fabtek license)", "Cabal (US set 1, Trackball version)", 0 ) |
| 937 | GAME( 1988, cabalus2,cabal, cabal, cabalt, cabal, ROT0, "Tad (Fabtek license)", "Cabal (US set 2, Trackball version)", 0 ) |
src/emu/cpu/mips/mdrc64.c
| r1070 | r1071 | |
| 60 | 60 | anything and tracks both, or else shifts ownership to new |
| 61 | 61 | target |
| 62 | 62 | |
| 63 | | * generic frontend: |
| 64 | | * flags to indicate variable shifts and multiply/divides |
| 65 | | to help register allocator avoid ECX/EDX/EAX as |
| 66 | | appropriate |
| 67 | | |
| 68 | 63 | * generic drc: |
| 69 | 64 | * common code to load registers prior to instruction |
| 70 | 65 | - each register has a callback that generates the load |
| r1070 | r1071 | |
| 90 | 85 | DEBUGGING |
| 91 | 86 | ***************************************************************************/ |
| 92 | 87 | |
| 93 | | #define SINGLE_INSTRUCTION_MODE (0) |
| 94 | 88 | #define DISABLE_FIXED_RAM_LOAD (0) |
| 95 | 89 | #define DISABLE_FIXED_RAM_STORE (0) |
| 96 | 90 | #define FLUSH_AFTER_EACH_INSTRUCTION (0) |
| r1070 | r1071 | |
| 224 | 218 | |
| 225 | 219 | struct _oob_handler |
| 226 | 220 | { |
| 227 | | oob_callback callback; /* pointer to callback function */ |
| 228 | | void * param; /* callback parameter */ |
| 229 | | const mips3_opcode_desc *desc; /* pointer to description of relevant instruction */ |
| 230 | | emit_link link; /* link to source of the branch */ |
| 231 | | compiler_state compiler; /* state of the compiler at this time */ |
| 221 | oob_callback callback; /* pointer to callback function */ |
| 222 | void * param; /* callback parameter */ |
| 223 | const opcode_desc * desc; /* pointer to description of relevant instruction */ |
| 224 | emit_link link; /* link to source of the branch */ |
| 225 | compiler_state compiler; /* state of the compiler at this time */ |
| 232 | 226 | }; |
| 233 | 227 | |
| 234 | 228 | |
| r1070 | r1071 | |
| 270 | 264 | oob_handler ooblist[COMPILE_MAX_INSTRUCTIONS*2]; |
| 271 | 265 | int oobcount; |
| 272 | 266 | |
| 273 | | #if COMPARE_AGAINST_C |
| 274 | 267 | /* C functions */ |
| 275 | 268 | x86code * execute_c_version; |
| 276 | | #endif |
| 277 | 269 | }; |
| 278 | 270 | |
| 279 | 271 | |
| r1070 | r1071 | |
| 286 | 278 | static void drc_recompile_callback(drc_core *drc); |
| 287 | 279 | static void drc_entrygen_callback(drc_core *drc); |
| 288 | 280 | |
| 289 | | static void compile_one(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc); |
| 281 | static void compile_one(drc_core *drc, compiler_state *compiler, const opcode_desc *desc); |
| 290 | 282 | |
| 291 | 283 | static void oob_exception_cleanup(drc_core *drc, oob_handler *oob, void *param); |
| 292 | 284 | static void oob_interrupt_cleanup(drc_core *drc, oob_handler *oob, void *param); |
| 293 | 285 | |
| 294 | 286 | static void compiler_register_set_constant(compiler_state *compiler, UINT8 mipsreg, UINT64 constval); |
| 295 | | static mipsreg_state compiler_register_allocate(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, UINT8 mipsreg, UINT8 flags); |
| 287 | static mipsreg_state compiler_register_allocate(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, UINT8 mipsreg, UINT8 flags); |
| 296 | 288 | static void compiler_register_flush(drc_core *drc, compiler_state *compiler, UINT8 mipsreg, int free); |
| 297 | 289 | static void compiler_register_flush_all(drc_core *drc, compiler_state *compiler); |
| 298 | 290 | |
| r1070 | r1071 | |
| 305 | 297 | static void append_find_exception_handler(drc_core *drc); |
| 306 | 298 | static void append_explode_ccr31(drc_core *drc); |
| 307 | 299 | static void append_recover_ccr31(drc_core *drc); |
| 308 | | static void append_check_interrupts(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc); |
| 300 | static void append_check_interrupts(drc_core *drc, compiler_state *compiler, const opcode_desc *desc); |
| 309 | 301 | static void append_check_sw_interrupts(drc_core *drc, int inline_generate); |
| 310 | 302 | |
| 311 | | static int compile_instruction(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc); |
| 312 | | static int compile_special(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc); |
| 313 | | static int compile_regimm(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc); |
| 314 | | static int compile_idt(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc); |
| 315 | | static int compile_cop0(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc); |
| 316 | | static int compile_cop1(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc); |
| 317 | | static int compile_cop1x(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc); |
| 303 | static int compile_instruction(drc_core *drc, compiler_state *compiler, const opcode_desc *desc); |
| 304 | static int compile_special(drc_core *drc, compiler_state *compiler, const opcode_desc *desc); |
| 305 | static int compile_regimm(drc_core *drc, compiler_state *compiler, const opcode_desc *desc); |
| 306 | static int compile_idt(drc_core *drc, compiler_state *compiler, const opcode_desc *desc); |
| 307 | static int compile_cop0(drc_core *drc, compiler_state *compiler, const opcode_desc *desc); |
| 308 | static int compile_cop1(drc_core *drc, compiler_state *compiler, const opcode_desc *desc); |
| 309 | static int compile_cop1x(drc_core *drc, compiler_state *compiler, const opcode_desc *desc); |
| 318 | 310 | |
| 319 | | static int compile_shift(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int shift_type, int shift_variable); |
| 320 | | static int compile_dshift(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int shift_type, int shift_variable, int shift_const_plus32); |
| 321 | | static int compile_movzn(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_movn); |
| 322 | | static int compile_trapcc(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int condition, int immediate); |
| 323 | | static int compile_branchcc(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int condition); |
| 324 | | static int compile_branchcz(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int condition, int link); |
| 325 | | static int compile_add(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int suppress_exceptions, int immediate); |
| 326 | | static int compile_dadd(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int suppress_exceptions, int immediate); |
| 327 | | static int compile_sub(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int suppress_exceptions); |
| 328 | | static int compile_dsub(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int suppress_exceptions); |
| 329 | | static int compile_mult(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_unsigned); |
| 330 | | static int compile_dmult(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_unsigned); |
| 331 | | static int compile_div(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_unsigned); |
| 332 | | static int compile_ddiv(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_unsigned); |
| 333 | | static int compile_logical(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int operation, int immediate); |
| 334 | | static int compile_slt(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_unsigned, int immediate); |
| 335 | | static int compile_load(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size, int is_unsigned); |
| 336 | | static int compile_load_cop(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size, void *dest); |
| 337 | | static int compile_loadx_cop(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size, void *dest); |
| 338 | | static int compile_load_word_partial(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_right); |
| 339 | | static int compile_load_double_partial(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_right); |
| 340 | | static int compile_store(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size); |
| 341 | | static int compile_store_cop(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size, void *src); |
| 342 | | static int compile_storex_cop(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size, void *src); |
| 343 | | static int compile_store_word_partial(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_right); |
| 344 | | static int compile_store_double_partial(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_right); |
| 311 | static int compile_shift(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int shift_type, int shift_variable); |
| 312 | static int compile_dshift(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int shift_type, int shift_variable, int shift_const_plus32); |
| 313 | static int compile_movzn(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_movn); |
| 314 | static int compile_trapcc(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int condition, int immediate); |
| 315 | static int compile_branchcc(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int condition); |
| 316 | static int compile_branchcz(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int condition, int link); |
| 317 | static int compile_add(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int suppress_exceptions, int immediate); |
| 318 | static int compile_dadd(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int suppress_exceptions, int immediate); |
| 319 | static int compile_sub(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int suppress_exceptions); |
| 320 | static int compile_dsub(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int suppress_exceptions); |
| 321 | static int compile_mult(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_unsigned); |
| 322 | static int compile_dmult(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_unsigned); |
| 323 | static int compile_div(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_unsigned); |
| 324 | static int compile_ddiv(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_unsigned); |
| 325 | static int compile_logical(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int operation, int immediate); |
| 326 | static int compile_slt(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_unsigned, int immediate); |
| 327 | static int compile_load(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size, int is_unsigned); |
| 328 | static int compile_load_cop(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size, void *dest); |
| 329 | static int compile_loadx_cop(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size, void *dest); |
| 330 | static int compile_load_word_partial(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_right); |
| 331 | static int compile_load_double_partial(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_right); |
| 332 | static int compile_store(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size); |
| 333 | static int compile_store_cop(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size, void *src); |
| 334 | static int compile_storex_cop(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size, void *src); |
| 335 | static int compile_store_word_partial(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_right); |
| 336 | static int compile_store_double_partial(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_right); |
| 345 | 337 | |
| 346 | 338 | |
| 347 | 339 | |
| r1070 | r1071 | |
| 370 | 362 | bounds callback for later |
| 371 | 363 | -------------------------------------------------*/ |
| 372 | 364 | |
| 373 | | INLINE void oob_request_callback(drc_core *drc, UINT8 condition, oob_callback callback, const compiler_state *compiler, const mips3_opcode_desc *desc, void *param) |
| 365 | INLINE void oob_request_callback(drc_core *drc, UINT8 condition, oob_callback callback, const compiler_state *compiler, const opcode_desc *desc, void *param) |
| 374 | 366 | { |
| 375 | 367 | oob_handler *oob = &mips3.drcdata->ooblist[mips3.drcdata->oobcount++]; |
| 376 | 368 | |
| r1070 | r1071 | |
| 423 | 415 | memset(&drconfig, 0, sizeof(drconfig)); |
| 424 | 416 | drconfig.cache_base = mips3.cache; |
| 425 | 417 | drconfig.cache_size = CACHE_SIZE; |
| 426 | | drconfig.max_instructions = MAX_INSTRUCTIONS; |
| 418 | drconfig.max_instructions = (512 + 128) / 4; |
| 427 | 419 | drconfig.address_bits = 32; |
| 428 | 420 | drconfig.lsbs_to_ignore = 2; |
| 429 | 421 | drconfig.baseptr = &mips3.core->r[17]; |
| r1070 | r1071 | |
| 467 | 459 | static void mips3drc_exit(void) |
| 468 | 460 | { |
| 469 | 461 | printf("Final code size = %d\n", (int)(mips3.drc->cache_top - mips3.drc->cache_base)); |
| 470 | | mips3fe_exit(); |
| 471 | 462 | } |
| 472 | 463 | |
| 473 | 464 | |
| r1070 | r1071 | |
| 568 | 559 | |
| 569 | 560 | static void drc_recompile_callback(drc_core *drc) |
| 570 | 561 | { |
| 571 | | int maxseq = (Machine->debug_mode || SINGLE_INSTRUCTION_MODE) ? 1 : MAX_INSTRUCTION_SEQUENCE; |
| 572 | 562 | int compiled_last_sequence = FALSE; |
| 573 | | mips3_opcode_desc *seqhead, *seqlast; |
| 574 | | mips3_opcode_desc *desclist; |
| 563 | const opcode_desc *seqhead, *seqlast; |
| 564 | const opcode_desc *desclist; |
| 575 | 565 | void *start = drc->cache_top; |
| 576 | 566 | int override = FALSE; |
| 577 | 567 | int oobnum; |
| r1070 | r1071 | |
| 583 | 573 | mips3.drcdata->oobcount = 0; |
| 584 | 574 | |
| 585 | 575 | /* get a description of this sequence */ |
| 586 | | desclist = mips3fe_describe_sequence(mips3.core, mips3.core->pc, mips3.core->pc - 128, mips3.core->pc + 512, maxseq); |
| 576 | desclist = drcfe_describe_code(mips3.drcfe, mips3.core->pc); |
| 587 | 577 | if (LOG_CODE) |
| 588 | 578 | log_opcode_desc(mips3.log, desclist, 0); |
| 589 | 579 | |
| 590 | 580 | /* loop until we get through all instruction sequences */ |
| 591 | 581 | for (seqhead = desclist; seqhead != NULL; seqhead = seqlast->next) |
| 592 | 582 | { |
| 593 | | mips3_opcode_desc *curdesc; |
| 583 | const opcode_desc *curdesc; |
| 594 | 584 | compiler_state compiler; |
| 595 | 585 | |
| 596 | 586 | /* determine the last instruction in this sequence */ |
| 597 | 587 | for (seqlast = seqhead; seqlast != NULL; seqlast = seqlast->next) |
| 598 | | if (seqlast->flags & IDESC_END_SEQUENCE) |
| 588 | if (seqlast->flags & OPFLAG_END_SEQUENCE) |
| 599 | 589 | break; |
| 600 | 590 | assert(seqlast != NULL); |
| 601 | 591 | |
| r1070 | r1071 | |
| 630 | 620 | { |
| 631 | 621 | if (LOG_CODE) |
| 632 | 622 | x86log_add_comment(mips3.log, drc->cache_top, "[Validation for %08X]", seqhead->pc); |
| 633 | | emit_mov_r64_imm(DRCTOP, REG_RAX, (UINT64)seqhead->opptr); // mov rax,seqhead->opptr |
| 623 | emit_mov_r64_imm(DRCTOP, REG_RAX, (UINT64)seqhead->opptr.v); // mov rax,seqhead->opptr |
| 634 | 624 | for (curdesc = seqhead; curdesc != seqlast->next; curdesc = curdesc->next) |
| 635 | 625 | { |
| 636 | | emit_cmp_m32_imm(DRCTOP, MBD(REG_RAX, (UINT8 *)curdesc->opptr - (UINT8 *)seqhead->opptr), *curdesc->opptr); |
| 626 | emit_cmp_m32_imm(DRCTOP, MBD(REG_RAX, curdesc->opptr.b - seqhead->opptr.b), *curdesc->opptr.l); |
| 637 | 627 | // cmp [code],val |
| 638 | 628 | emit_jcc(DRCTOP, COND_NE, mips3.drc->recompile); // jne recompile |
| 639 | 629 | } |
| r1070 | r1071 | |
| 647 | 637 | compile_one(drc, &compiler, curdesc); |
| 648 | 638 | |
| 649 | 639 | /* at the end of the sequence; update the PC in memory and check cycle counts */ |
| 650 | | if (!(seqlast->flags & (IDESC_IS_UNCONDITIONAL_BRANCH | IDESC_WILL_CAUSE_EXCEPTION))) |
| 640 | if (!(seqlast->flags & (OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_WILL_CAUSE_EXCEPTION))) |
| 651 | 641 | { |
| 652 | | UINT32 nextpc = seqlast->pc + ((seqlast->flags & IDESC_IS_LIKELY_BRANCH) ? 8 : 4); |
| 642 | UINT32 nextpc = seqlast->pc + (seqlast->skipslots + 1) * 4; |
| 653 | 643 | if (compiler.cycles != 0) |
| 654 | 644 | emit_sub_m32_imm(DRCTOP, ICOUNTADDR, compiler.cycles); // sub [icount],cycles |
| 655 | 645 | emit_mov_r32_imm(DRCTOP, REG_P1, nextpc); // mov p1,nextpc |
| r1070 | r1071 | |
| 659 | 649 | } |
| 660 | 650 | |
| 661 | 651 | /* if this is a likely branch, the fall through case needs to skip the next instruction */ |
| 662 | | if ((seqlast->flags & (IDESC_IS_CONDITIONAL_BRANCH | IDESC_IS_LIKELY_BRANCH)) == (IDESC_IS_CONDITIONAL_BRANCH | IDESC_IS_LIKELY_BRANCH)) |
| 652 | if ((seqlast->flags & OPFLAG_IS_CONDITIONAL_BRANCH) && seqlast->skipslots > 0) |
| 663 | 653 | if (seqlast->next != NULL && seqlast->next->pc != seqlast->pc + 8) |
| 664 | 654 | { |
| 665 | 655 | compiler_register_flush_all(drc, &compiler); |
| r1070 | r1071 | |
| 667 | 657 | } |
| 668 | 658 | |
| 669 | 659 | /* if we need a redispatch, do it now */ |
| 670 | | if (seqlast->flags & IDESC_REDISPATCH) |
| 660 | if (seqlast->flags & OPFLAG_REDISPATCH) |
| 671 | 661 | { |
| 672 | | UINT32 nextpc = seqlast->pc + ((seqlast->flags & IDESC_IS_LIKELY_BRANCH) ? 8 : 4); |
| 662 | UINT32 nextpc = seqlast->pc + (seqlast->skipslots + 1) * 4; |
| 673 | 663 | compiler_register_flush_all(drc, &compiler); |
| 674 | 664 | drc_append_tentative_fixed_dispatcher(drc, nextpc, TRUE); // jmp <nextpc> |
| 675 | 665 | } |
| 676 | 666 | |
| 677 | 667 | /* if we need to return to the start, do it */ |
| 678 | | if (seqlast->flags & IDESC_RETURN_TO_START) |
| 668 | if (seqlast->flags & OPFLAG_RETURN_TO_START) |
| 679 | 669 | { |
| 680 | 670 | compiler_register_flush_all(drc, &compiler); |
| 681 | 671 | drc_append_tentative_fixed_dispatcher(drc, mips3.core->pc, FALSE); // jmp <startpc> |
| 682 | 672 | } |
| 683 | 673 | } |
| 684 | 674 | |
| 685 | | /* free the list */ |
| 686 | | mips3fe_release_descriptions(desclist); |
| 687 | | |
| 688 | 675 | /* end the sequence */ |
| 689 | 676 | drc_end_sequence(drc); |
| 690 | 677 | |
| r1070 | r1071 | |
| 724 | 711 | compile_one |
| 725 | 712 | ------------------------------------------------------------------*/ |
| 726 | 713 | |
| 727 | | static void compile_one(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc) |
| 714 | static void compile_one(drc_core *drc, compiler_state *compiler, const opcode_desc *desc) |
| 728 | 715 | { |
| 729 | 716 | int hotnum; |
| 730 | 717 | |
| 731 | 718 | /* register this instruction */ |
| 732 | | if (!(desc->flags & IDESC_IN_DELAY_SLOT)) |
| 719 | if (!(desc->flags & OPFLAG_IN_DELAY_SLOT)) |
| 733 | 720 | drc_register_code_at_cache_top(drc, desc->pc); |
| 734 | 721 | |
| 735 | 722 | /* add an entry for the log */ |
| 736 | 723 | if (LOG_CODE) |
| 737 | | log_add_disasm_comment(mips3.log, drc->cache_top, desc->pc, *desc->opptr); |
| 724 | log_add_disasm_comment(mips3.log, drc->cache_top, desc->pc, *desc->opptr.l); |
| 738 | 725 | |
| 739 | 726 | /* if we want a probe, add it here */ |
| 740 | 727 | if (desc->pc == PROBE_ADDRESS) |
| r1070 | r1071 | |
| 746 | 733 | } |
| 747 | 734 | |
| 748 | 735 | /* if we are debugging, call the debugger */ |
| 749 | | if (Machine->debug_mode) |
| 736 | if (Machine->debug_mode || COMPARE_AGAINST_C) |
| 750 | 737 | { |
| 751 | 738 | emit_mov_m32_imm(DRCTOP, PCADDR, desc->pc); // mov [pc],desc->pc |
| 752 | | #if COMPARE_AGAINST_C |
| 753 | | if (!(desc->flags & IDESC_IN_DELAY_SLOT)) |
| 739 | if (COMPARE_AGAINST_C && !(desc->flags & OPFLAG_IN_DELAY_SLOT)) |
| 754 | 740 | emit_call_m64(DRCTOP, MDRC(&mips3.drcdata->execute_c_version)); |
| 755 | | #endif |
| 756 | | drc_append_call_debugger(drc); // <call debugger> |
| 741 | if (Machine->debug_mode) |
| 742 | drc_append_call_debugger(drc); // <call debugger> |
| 757 | 743 | } |
| 758 | 744 | |
| 759 | 745 | /* validate our TLB entry at this PC; if we fail, we need to recompile */ |
| 760 | | if (desc->flags & IDESC_VALIDATE_TLB) |
| 746 | if ((desc->flags & OPFLAG_VALIDATE_TLB) && (desc->pc < 0x80000000 || desc->pc >= 0xc0000000)) |
| 761 | 747 | { |
| 762 | 748 | emit_cmp_m32_imm(DRCTOP, MDRC(&mips3.core->tlb_table[desc->pc >> 12]), mips3.core->tlb_table[desc->pc >> 12]); |
| 763 | 749 | // cmp tlb_table[pc>>12],<original value> |
| r1070 | r1071 | |
| 770 | 756 | |
| 771 | 757 | /* is this a hotspot? */ |
| 772 | 758 | for (hotnum = 0; hotnum < MIPS3_MAX_HOTSPOTS; hotnum++) |
| 773 | | if (desc->pc == mips3.hotspot[hotnum].pc && *desc->opptr == mips3.hotspot[hotnum].opcode) |
| 759 | if (desc->pc == mips3.hotspot[hotnum].pc && *desc->opptr.l == mips3.hotspot[hotnum].opcode) |
| 774 | 760 | { |
| 775 | 761 | compiler->cycles += mips3.hotspot[hotnum].cycles; |
| 776 | 762 | break; |
| 777 | 763 | } |
| 778 | 764 | |
| 779 | 765 | /* if this is an invalid opcode, generate the exception now */ |
| 780 | | if (desc->flags & IDESC_INVALID_OPCODE) |
| 766 | if (desc->flags & OPFLAG_INVALID_OPCODE) |
| 781 | 767 | oob_request_callback(drc, COND_NONE, oob_exception_cleanup, compiler, desc, mips3.drcdata->generate_invalidop_exception); |
| 782 | 768 | |
| 783 | 769 | /* otherwise, it's a regular instruction */ |
| 784 | 770 | else |
| 785 | 771 | { |
| 786 | | UINT32 nextpc = desc->pc + ((desc->flags & IDESC_IS_LIKELY_BRANCH) ? 8 : 4); |
| 787 | | |
| 788 | 772 | /* compile the instruction */ |
| 789 | 773 | if (!compile_instruction(drc, compiler, desc)) |
| 790 | | fatalerror("Unimplemented op %08X (%02X,%02X)", *desc->opptr, *desc->opptr >> 26, *desc->opptr & 0x3f); |
| 774 | fatalerror("Unimplemented op %08X (%02X,%02X)", *desc->opptr.l, *desc->opptr.l >> 26, *desc->opptr.l & 0x3f); |
| 791 | 775 | |
| 792 | 776 | /* flush */ |
| 793 | 777 | if (FLUSH_AFTER_EACH_INSTRUCTION) |
| r1070 | r1071 | |
| 842 | 826 | emit_sub_m32_imm(DRCTOP, ICOUNTADDR, oob->compiler.cycles); // sub [icount],cycles |
| 843 | 827 | |
| 844 | 828 | /* update the PC with the instruction PC */ |
| 845 | | if (!(oob->desc->flags & IDESC_IN_DELAY_SLOT)) |
| 829 | if (!(oob->desc->flags & OPFLAG_IN_DELAY_SLOT)) |
| 846 | 830 | emit_mov_r32_imm(DRCTOP, REG_P1, oob->desc->pc); // mov p1,pc |
| 847 | 831 | else |
| 848 | 832 | emit_mov_r32_imm(DRCTOP, REG_P1, oob->desc->pc | 1); // mov p1,pc | 1 |
| r1070 | r1071 | |
| 876 | 860 | emit_sub_m32_imm(DRCTOP, ICOUNTADDR, oob->compiler.cycles); // sub [icount],cycles |
| 877 | 861 | |
| 878 | 862 | /* update the PC with the following instruction PC */ |
| 879 | | if (!(oob->desc->flags & IDESC_IN_DELAY_SLOT)) |
| 863 | if (!(oob->desc->flags & OPFLAG_IN_DELAY_SLOT)) |
| 880 | 864 | { |
| 881 | | assert(!(oob->desc->flags & IDESC_IS_BRANCH)); |
| 865 | assert(!(oob->desc->flags & OPFLAG_IS_BRANCH)); |
| 882 | 866 | emit_mov_r32_imm(DRCTOP, REG_P1, oob->desc->pc + 4); // mov p1,pc + 4 |
| 883 | 867 | } |
| 884 | 868 | else |
| 885 | 869 | { |
| 886 | 870 | assert(oob->desc->branch != NULL); |
| 887 | | if (oob->desc->branch->targetpc != ~0) |
| 871 | if (oob->desc->branch->targetpc != BRANCH_TARGET_DYNAMIC) |
| 888 | 872 | emit_mov_r32_imm(DRCTOP, REG_P1, oob->desc->branch->targetpc); // mov p1,<targetpc> |
| 889 | 873 | else |
| 890 | 874 | emit_mov_r32_m32(DRCTOP, REG_P1, MBD(REG_RSP, SPOFFS_NEXTPC)); // mov p1,[rsp + nextpc] |
| r1070 | r1071 | |
| 931 | 915 | register to hold a MIPS register |
| 932 | 916 | -------------------------------------------------*/ |
| 933 | 917 | |
| 934 | | static mipsreg_state compiler_register_allocate(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, UINT8 mipsreg, UINT8 flags) |
| 918 | static mipsreg_state compiler_register_allocate(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, UINT8 mipsreg, UINT8 flags) |
| 935 | 919 | { |
| 936 | 920 | UINT8 regindex, regnum = 0; |
| 937 | 921 | UINT64 livemask = 0; |
| r1070 | r1071 | |
| 983 | 967 | } |
| 984 | 968 | |
| 985 | 969 | /* advance to the next instruction; stop if we hit end-of-sequence */ |
| 986 | | if (desc->flags & IDESC_END_SEQUENCE) |
| 970 | if (desc->flags & OPFLAG_END_SEQUENCE) |
| 987 | 971 | break; |
| 988 | 972 | desc = desc->next; |
| 989 | 973 | } |
| r1070 | r1071 | |
| 1604 | 1588 | for (ramnum = 0; ramnum < MIPS3_MAX_FASTRAM; ramnum++) |
| 1605 | 1589 | { |
| 1606 | 1590 | const fast_ram_info *raminfo = &mips3.fastram[ramnum]; |
| 1607 | | if (!Machine->debug_mode && raminfo->base != NULL && (!(flags & ARW_WRITE) || !raminfo->readonly)) |
| 1591 | if (!COMPARE_AGAINST_C && !Machine->debug_mode && raminfo->base != NULL && (!(flags & ARW_WRITE) || !raminfo->readonly)) |
| 1608 | 1592 | { |
| 1609 | 1593 | emit_link notram1 = { 0 }, notram2 = { 0 }; |
| 1610 | 1594 | |
| r1070 | r1071 | |
| 1826 | 1810 | append_check_interrupts |
| 1827 | 1811 | ------------------------------------------------------------------*/ |
| 1828 | 1812 | |
| 1829 | | static void append_check_interrupts(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc) |
| 1813 | static void append_check_interrupts(drc_core *drc, compiler_state *compiler, const opcode_desc *desc) |
| 1830 | 1814 | { |
| 1831 | 1815 | emit_link link1, link2; |
| 1832 | 1816 | |
| r1070 | r1071 | |
| 1890 | 1874 | register and populate it |
| 1891 | 1875 | -------------------------------------------------*/ |
| 1892 | 1876 | |
| 1893 | | static void emit_set_constant_value(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, UINT8 mipsreg, UINT64 constval) |
| 1877 | static void emit_set_constant_value(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, UINT8 mipsreg, UINT64 constval) |
| 1894 | 1878 | { |
| 1895 | 1879 | /* ignore reigster 0 destination */ |
| 1896 | 1880 | if (mipsreg == 0) |
| r1070 | r1071 | |
| 1913 | 1897 | emit_delay_slot_and_branch |
| 1914 | 1898 | ------------------------------------------------------------------*/ |
| 1915 | 1899 | |
| 1916 | | static void emit_delay_slot_and_branch(drc_core *drc, const compiler_state *compiler, const mips3_opcode_desc *desc, UINT8 linkreg) |
| 1900 | static void emit_delay_slot_and_branch(drc_core *drc, const compiler_state *compiler, const opcode_desc *desc, UINT8 linkreg) |
| 1917 | 1901 | { |
| 1918 | 1902 | compiler_state compiler_temp = *compiler; |
| 1919 | 1903 | |
| r1070 | r1071 | |
| 1930 | 1914 | emit_sub_m32_imm(DRCTOP, ICOUNTADDR, compiler_temp.cycles); // sub [icount],cycles |
| 1931 | 1915 | |
| 1932 | 1916 | /* load the target PC into P1 */ |
| 1933 | | if (desc->targetpc != ~0) |
| 1917 | if (desc->targetpc != BRANCH_TARGET_DYNAMIC) |
| 1934 | 1918 | emit_mov_r32_imm(DRCTOP, REG_P1, desc->targetpc); // mov p1,desc->targetpc |
| 1935 | 1919 | else |
| 1936 | 1920 | emit_mov_r32_m32(DRCTOP, REG_P1, MBD(REG_RSP, SPOFFS_NEXTPC)); // mov p1,[esp+nextpc] |
| r1070 | r1071 | |
| 1943 | 1927 | emit_jcc(DRCTOP, COND_S, mips3.drc->exit_point); // js exit_point |
| 1944 | 1928 | |
| 1945 | 1929 | /* otherwise, append a dispatcher */ |
| 1946 | | if (desc->targetpc != ~0) |
| 1930 | if (desc->targetpc != BRANCH_TARGET_DYNAMIC) |
| 1947 | 1931 | drc_append_tentative_fixed_dispatcher(drc, desc->targetpc, FALSE); // <redispatch> |
| 1948 | 1932 | else |
| 1949 | 1933 | drc_append_dispatcher(drc); // <redispatch> |
| r1070 | r1071 | |
| 1954 | 1938 | emit_fixed_byte_read |
| 1955 | 1939 | ------------------------------------------------------------------*/ |
| 1956 | 1940 | |
| 1957 | | static int emit_fixed_byte_read(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, UINT8 destreg, int is_unsigned, offs_t address) |
| 1941 | static int emit_fixed_byte_read(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, UINT8 destreg, int is_unsigned, offs_t address) |
| 1958 | 1942 | { |
| 1959 | 1943 | void *fastram = fastram_ptr(address, 1, FALSE); |
| 1960 | 1944 | |
| r1070 | r1071 | |
| 2006 | 1990 | emit_fixed_half_read |
| 2007 | 1991 | ------------------------------------------------------------------*/ |
| 2008 | 1992 | |
| 2009 | | static int emit_fixed_half_read(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, UINT8 destreg, int is_unsigned, offs_t address) |
| 1993 | static int emit_fixed_half_read(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, UINT8 destreg, int is_unsigned, offs_t address) |
| 2010 | 1994 | { |
| 2011 | 1995 | void *fastram = fastram_ptr(address & ~1, 2, FALSE); |
| 2012 | 1996 | |
| r1070 | r1071 | |
| 2058 | 2042 | emit_fixed_word_read |
| 2059 | 2043 | ------------------------------------------------------------------*/ |
| 2060 | 2044 | |
| 2061 | | static int emit_fixed_word_read(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, UINT8 destreg, int is_unsigned, offs_t address, UINT32 mask) |
| 2045 | static int emit_fixed_word_read(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, UINT8 destreg, int is_unsigned, offs_t address, UINT32 mask) |
| 2062 | 2046 | { |
| 2063 | 2047 | void *fastram = fastram_ptr(address & ~3, 4, FALSE); |
| 2064 | 2048 | |
| r1070 | r1071 | |
| 2115 | 2099 | emit_fixed_double_read |
| 2116 | 2100 | ------------------------------------------------------------------*/ |
| 2117 | 2101 | |
| 2118 | | static int emit_fixed_double_read(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, UINT8 destreg, offs_t address, UINT64 mask) |
| 2102 | static int emit_fixed_double_read(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, UINT8 destreg, offs_t address, UINT64 mask) |
| 2119 | 2103 | { |
| 2120 | 2104 | void *fastram = fastram_ptr(address & ~7, 8, FALSE); |
| 2121 | 2105 | |
| r1070 | r1071 | |
| 2166 | 2150 | emit_fixed_byte_write |
| 2167 | 2151 | ------------------------------------------------------------------*/ |
| 2168 | 2152 | |
| 2169 | | static int emit_fixed_byte_write(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, mipsreg_state srcreg, offs_t address) |
| 2153 | static int emit_fixed_byte_write(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, mipsreg_state srcreg, offs_t address) |
| 2170 | 2154 | { |
| 2171 | 2155 | void *fastram = fastram_ptr(address, 1, TRUE); |
| 2172 | 2156 | |
| r1070 | r1071 | |
| 2219 | 2203 | emit_fixed_half_write |
| 2220 | 2204 | ------------------------------------------------------------------*/ |
| 2221 | 2205 | |
| 2222 | | static int emit_fixed_half_write(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, mipsreg_state srcreg, offs_t address) |
| 2206 | static int emit_fixed_half_write(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, mipsreg_state srcreg, offs_t address) |
| 2223 | 2207 | { |
| 2224 | 2208 | void *fastram = fastram_ptr(address & ~1, 2, TRUE); |
| 2225 | 2209 | |
| r1070 | r1071 | |
| 2272 | 2256 | emit_fixed_word_write |
| 2273 | 2257 | ------------------------------------------------------------------*/ |
| 2274 | 2258 | |
| 2275 | | static int emit_fixed_word_write(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, mipsreg_state srcreg, offs_t address, UINT32 mask) |
| 2259 | static int emit_fixed_word_write(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, mipsreg_state srcreg, offs_t address, UINT32 mask) |
| 2276 | 2260 | { |
| 2277 | 2261 | void *fastram = fastram_ptr(address & ~3, 4, TRUE); |
| 2278 | 2262 | |
| r1070 | r1071 | |
| 2364 | 2348 | emit_fixed_double_write |
| 2365 | 2349 | ------------------------------------------------------------------*/ |
| 2366 | 2350 | |
| 2367 | | static int emit_fixed_double_write(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, mipsreg_state srcreg, offs_t address, UINT64 mask) |
| 2351 | static int emit_fixed_double_write(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, mipsreg_state srcreg, offs_t address, UINT64 mask) |
| 2368 | 2352 | { |
| 2369 | 2353 | void *fastram = fastram_ptr(address & ~7, 8, TRUE); |
| 2370 | 2354 | |
| r1070 | r1071 | |
| 2480 | 2464 | for compiling a given opcode |
| 2481 | 2465 | -------------------------------------------------*/ |
| 2482 | 2466 | |
| 2483 | | static int compile_instruction(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc) |
| 2467 | static int compile_instruction(drc_core *drc, compiler_state *compiler, const opcode_desc *desc) |
| 2484 | 2468 | { |
| 2485 | | UINT32 op = *desc->opptr; |
| 2469 | UINT32 op = *desc->opptr.l; |
| 2486 | 2470 | UINT8 opswitch = op >> 26; |
| 2487 | 2471 | |
| 2488 | 2472 | switch (opswitch) |
| r1070 | r1071 | |
| 2647 | 2631 | 'SPECIAL' group |
| 2648 | 2632 | -------------------------------------------------*/ |
| 2649 | 2633 | |
| 2650 | | static int compile_special(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc) |
| 2634 | static int compile_special(drc_core *drc, compiler_state *compiler, const opcode_desc *desc) |
| 2651 | 2635 | { |
| 2652 | | UINT32 op = *desc->opptr; |
| 2636 | UINT32 op = *desc->opptr.l; |
| 2653 | 2637 | UINT8 opswitch = op & 63; |
| 2654 | 2638 | emit_link link1; |
| 2655 | 2639 | |
| r1070 | r1071 | |
| 2844 | 2828 | 'REGIMM' group |
| 2845 | 2829 | -------------------------------------------------*/ |
| 2846 | 2830 | |
| 2847 | | static int compile_regimm(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc) |
| 2831 | static int compile_regimm(drc_core *drc, compiler_state *compiler, const opcode_desc *desc) |
| 2848 | 2832 | { |
| 2849 | | UINT32 op = *desc->opptr; |
| 2833 | UINT32 op = *desc->opptr.l; |
| 2850 | 2834 | UINT8 opswitch = RTREG; |
| 2851 | 2835 | |
| 2852 | 2836 | switch (opswitch) |
| r1070 | r1071 | |
| 2878 | 2862 | specific group |
| 2879 | 2863 | -------------------------------------------------*/ |
| 2880 | 2864 | |
| 2881 | | static int compile_idt(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc) |
| 2865 | static int compile_idt(drc_core *drc, compiler_state *compiler, const opcode_desc *desc) |
| 2882 | 2866 | { |
| 2883 | 2867 | fatalerror("Unimplemented IDT instructions"); |
| 2884 | 2868 | #if 0 |
| 2885 | | UINT32 op = *desc->opptr; |
| 2869 | UINT32 op = *desc->opptr.l; |
| 2886 | 2870 | UINT8 opswitch = op & 0x1f; |
| 2887 | 2871 | |
| 2888 | 2872 | switch (opswitch) |
| r1070 | r1071 | |
| 2951 | 2935 | handle special COP0 registers |
| 2952 | 2936 | -------------------------------------------------*/ |
| 2953 | 2937 | |
| 2954 | | static int compile_set_cop0_reg(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, UINT8 reg) |
| 2938 | static int compile_set_cop0_reg(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, UINT8 reg) |
| 2955 | 2939 | { |
| 2956 | 2940 | emit_link link1; |
| 2957 | 2941 | |
| r1070 | r1071 | |
| 3027 | 3011 | read special COP0 registers |
| 3028 | 3012 | -------------------------------------------------*/ |
| 3029 | 3013 | |
| 3030 | | static int compile_get_cop0_reg(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, UINT8 reg) |
| 3014 | static int compile_get_cop0_reg(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, UINT8 reg) |
| 3031 | 3015 | { |
| 3032 | 3016 | emit_link link1, link2; |
| 3033 | 3017 | |
| 3034 | 3018 | switch (reg) |
| 3035 | 3019 | { |
| 3036 | 3020 | case COP0_Count: |
| 3037 | | #if (!COMPARE_AGAINST_C) |
| 3038 | | emit_sub_m32_imm(DRCTOP, ICOUNTADDR, compiler->cycles + MIPS3_COUNT_READ_CYCLES); |
| 3039 | | // sub [icount],<lots> |
| 3040 | | compiler->cycles = 0; |
| 3041 | | emit_jcc_short_link(DRCTOP, COND_NS, &link1); // jns notneg |
| 3042 | | emit_mov_m32_imm(DRCTOP, ICOUNTADDR, 0); // mov [icount],0 |
| 3043 | | resolve_link(DRCTOP, &link1); // notneg: |
| 3044 | | #endif |
| 3045 | | emit_call_m64(DRCTOP, MDRC(&mips3.drcdata->activecpu_gettotalcycles64)); |
| 3046 | | // call activecpu_gettotalcycles64 |
| 3021 | compiler->cycles += MIPS3_COUNT_READ_CYCLES; |
| 3022 | emit_call_m64(DRCTOP, MDRC(&mips3.drcdata->activecpu_gettotalcycles64)); // call activecpu_gettotalcycles64 |
| 3047 | 3023 | emit_sub_r64_m64(DRCTOP, REG_RAX, MDRC(&mips3.core->count_zero_time)); // sub rax,[count_zero_time] |
| 3048 | 3024 | emit_shr_r64_imm(DRCTOP, REG_RAX, 1); // shr rax,1 |
| 3049 | 3025 | emit_movsxd_r64_r32(DRCTOP, REG_RAX, REG_EAX); // movsxd rax,eax |
| 3050 | 3026 | return TRUE; |
| 3051 | 3027 | |
| 3052 | 3028 | case COP0_Cause: |
| 3053 | | #if (!COMPARE_AGAINST_C) |
| 3054 | | emit_sub_m32_imm(DRCTOP, ICOUNTADDR, compiler->cycles + MIPS3_CAUSE_READ_CYCLES); |
| 3055 | | // sub [icount],<lots> |
| 3056 | | compiler->cycles = 0; |
| 3057 | | emit_jcc_short_link(DRCTOP, COND_NS, &link1); // jns notneg |
| 3058 | | emit_mov_m32_imm(DRCTOP, ICOUNTADDR, 0); // mov [icount],0 |
| 3059 | | resolve_link(DRCTOP, &link1); // notneg: |
| 3060 | | #endif |
| 3029 | compiler->cycles += MIPS3_COUNT_READ_CYCLES; |
| 3061 | 3030 | emit_movsxd_r64_m32(DRCTOP, REG_RAX, CPR0ADDR(COP0_Cause)); // movsxd rax,[Cause] |
| 3062 | 3031 | return TRUE; |
| 3063 | 3032 | |
| 3064 | 3033 | case COP0_Random: |
| 3065 | | emit_call_m64(DRCTOP, MDRC(&mips3.drcdata->activecpu_gettotalcycles64)); |
| 3066 | | // call activecpu_gettotalcycles64 |
| 3067 | | emit_sub_r64_m64(DRCTOP, REG_RAX, MDRC(&mips3.core->count_zero_time)); // sub rax,[count_zero_time] |
| 3034 | emit_call_m64(DRCTOP, MDRC(&mips3.drcdata->activecpu_gettotalcycles64)); // call activecpu_gettotalcycles64 |
| 3068 | 3035 | emit_mov_r32_m32(DRCTOP, REG_ECX, CPR0ADDR(COP0_Wired)); // mov ecx,[Wired] |
| 3069 | 3036 | emit_mov_r32_imm(DRCTOP, REG_R8D, 48); // mov r8d,48 |
| 3070 | 3037 | emit_and_r32_imm(DRCTOP, REG_ECX, 0x3f); // and ecx,0x3f |
| 3038 | emit_sub_r64_m64(DRCTOP, REG_RAX, MDRC(&mips3.core->count_zero_time)); // sub rax,[count_zero_time] |
| 3071 | 3039 | emit_sub_r32_r32(DRCTOP, REG_R8D, REG_ECX); // sub r8d,ecx |
| 3072 | | emit_mov_r64_r64(DRCTOP, REG_RDX, REG_RAX); // mov rdx,rax |
| 3073 | 3040 | emit_jcc_short_link(DRCTOP, COND_BE, &link1); // jbe link1 |
| 3074 | | emit_shr_r64_imm(DRCTOP, REG_RDX, 32); // shr rdx,32 |
| 3075 | | emit_idiv_r32(DRCTOP, REG_R8D); // idiv r8d |
| 3041 | emit_xor_r32_r32(DRCTOP, REG_EDX, REG_EDX); // xor edx,edx |
| 3042 | emit_div_r64(DRCTOP, REG_R8); // div r8 |
| 3076 | 3043 | emit_mov_r32_r32(DRCTOP, REG_EAX, REG_EDX); // mov eax,edx |
| 3077 | 3044 | emit_add_r32_r32(DRCTOP, REG_EAX, REG_ECX); // add eax,ecx |
| 3078 | 3045 | emit_and_r32_imm(DRCTOP, REG_EAX, 0x3f); // and eax,0x3f |
| r1070 | r1071 | |
| 3094 | 3061 | compile_cop0 - compile COP0 opcodes |
| 3095 | 3062 | -------------------------------------------------*/ |
| 3096 | 3063 | |
| 3097 | | static int compile_cop0(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc) |
| 3064 | static int compile_cop0(drc_core *drc, compiler_state *compiler, const opcode_desc *desc) |
| 3098 | 3065 | { |
| 3099 | | UINT32 op = *desc->opptr; |
| 3066 | UINT32 op = *desc->opptr.l; |
| 3100 | 3067 | UINT8 opswitch = RSREG; |
| 3101 | 3068 | |
| 3102 | 3069 | /* generate an exception if COP0 is disabled or we are not in kernel mode */ |
| r1070 | r1071 | |
| 3127 | 3094 | } |
| 3128 | 3095 | return TRUE; |
| 3129 | 3096 | |
| 3097 | case 0x02: /* CFCz */ |
| 3098 | if (RTREG != 0) |
| 3099 | { |
| 3100 | mipsreg_state rt = compiler_register_allocate(drc, compiler, desc, RTREG, ALLOC_DST | ALLOC_DIRTY); |
| 3101 | emit_movsxd_r64_m32(DRCTOP, X86REG(rt), CCR0ADDR(RDREG)); // movsxd <rt>,ccr1[rd] |
| 3102 | } |
| 3103 | return TRUE; |
| 3104 | |
| 3130 | 3105 | case 0x04: /* MTCz */ |
| 3131 | 3106 | case 0x05: /* DMTCz */ |
| 3132 | 3107 | { |
| r1070 | r1071 | |
| 3136 | 3111 | } |
| 3137 | 3112 | return TRUE; |
| 3138 | 3113 | |
| 3114 | case 0x06: /* CTCz */ |
| 3115 | { |
| 3116 | mipsreg_state rt = compiler_register_allocate(drc, compiler, desc, RTREG, ALLOC_SRC); |
| 3117 | emit_load_register_value(drc, compiler, REG_EAX, rt); // mov eax,<rt> |
| 3118 | emit_mov_m32_r32(DRCTOP, CCR0ADDR(RDREG), REG_EAX); // mov ccr1[rd],eax |
| 3119 | } |
| 3120 | return TRUE; |
| 3121 | |
| 3139 | 3122 | case 0x10: |
| 3140 | 3123 | case 0x11: |
| 3141 | 3124 | case 0x12: |
| r1070 | r1071 | |
| 3200 | 3183 | compile_cop1 - compile COP1 opcodes |
| 3201 | 3184 | -------------------------------------------------*/ |
| 3202 | 3185 | |
| 3203 | | static int compile_cop1(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc) |
| 3186 | static int compile_cop1(drc_core *drc, compiler_state *compiler, const opcode_desc *desc) |
| 3204 | 3187 | { |
| 3205 | | UINT32 op = *desc->opptr; |
| 3188 | UINT32 op = *desc->opptr.l; |
| 3206 | 3189 | emit_link link1; |
| 3207 | 3190 | |
| 3208 | 3191 | /* generate an exception if COP1 is disabled */ |
| r1070 | r1071 | |
| 3706 | 3689 | |
| 3707 | 3690 | case 0x37: |
| 3708 | 3691 | case 0x3f: |
| 3709 | | if (IS_SINGLE(op)) /* C.OLE.S */ |
| 3692 | if (IS_SINGLE(op)) /* C.ULE.S */ |
| 3710 | 3693 | { |
| 3711 | 3694 | emit_movss_r128_m32(DRCTOP, REG_XMM0, FPR32ADDR(FSREG)); // movss xmm0,[fsreg] |
| 3712 | 3695 | emit_ucomiss_r128_m32(DRCTOP, REG_XMM0, FPR32ADDR(FTREG)); // ucomiss xmm0,[ftreg] |
| 3713 | 3696 | } |
| 3714 | | else /* C.OLE.D */ |
| 3697 | else /* C.ULE.D */ |
| 3715 | 3698 | { |
| 3716 | 3699 | emit_movsd_r128_m64(DRCTOP, REG_XMM0, FPR64ADDR(FSREG)); // movsd xmm0,[fsreg] |
| 3717 | 3700 | emit_ucomisd_r128_m64(DRCTOP, REG_XMM0, FPR64ADDR(FTREG)); // ucomisd xmm0,[ftreg] |
| r1070 | r1071 | |
| 3734 | 3717 | compile_cop1x - compile COP1X opcodes |
| 3735 | 3718 | -------------------------------------------------*/ |
| 3736 | 3719 | |
| 3737 | | static int compile_cop1x(drc_core *drc, compiler_state *compiler, mips3_opcode_desc *desc) |
| 3720 | static int compile_cop1x(drc_core *drc, compiler_state *compiler, const opcode_desc *desc) |
| 3738 | 3721 | { |
| 3739 | | UINT32 op = *desc->opptr; |
| 3722 | UINT32 op = *desc->opptr.l; |
| 3740 | 3723 | |
| 3741 | 3724 | if (mips3.drcoptions & MIPS3DRC_STRICT_COP1) |
| 3742 | 3725 | { |
| r1070 | r1071 | |
| 3854 | 3837 | 3: sra/srav rD,rT,rS |
| 3855 | 3838 | -------------------------------------------------*/ |
| 3856 | 3839 | |
| 3857 | | static int compile_shift(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int shift_type, int shift_variable) |
| 3840 | static int compile_shift(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int shift_type, int shift_variable) |
| 3858 | 3841 | { |
| 3859 | | UINT32 op = *desc->opptr; |
| 3842 | UINT32 op = *desc->opptr.l; |
| 3860 | 3843 | mipsreg_state rd, rs, rt; |
| 3861 | 3844 | |
| 3862 | 3845 | assert(shift_type == 0 || shift_type == 2 || shift_type == 3); |
| r1070 | r1071 | |
| 3884 | 3867 | else |
| 3885 | 3868 | { |
| 3886 | 3869 | /* allocate the register and load rT into it */ |
| 3870 | /* if rS is non-const, must load it first in case rD == rS */ |
| 3887 | 3871 | rd = compiler_register_allocate(drc, compiler, desc, RDREG, ALLOC_DST | ALLOC_DIRTY); |
| 3872 | if (!ISCONST(rs)) |
| 3873 | emit_load_register_value(drc, compiler, REG_ECX, rs); // mov ecx,<rs> |
| 3888 | 3874 | emit_load_register_value(drc, compiler, X86REG(rd), rt); // mov <rd>,<rt> |
| 3889 | 3875 | |
| 3890 | 3876 | /* if rs is constant, use immediate forms of the shift */ |
| r1070 | r1071 | |
| 3901 | 3887 | /* otherwise, load rs into cl so we can do a variable shift */ |
| 3902 | 3888 | else |
| 3903 | 3889 | { |
| 3904 | | emit_load_register_value(drc, compiler, REG_ECX, rs); // mov ecx,<rs> |
| 3905 | 3890 | if (shift_type == 0) |
| 3906 | 3891 | emit_shl_r32_cl(DRCTOP, X86REG(rd)); // shl <rd>,cl |
| 3907 | 3892 | else if (shift_type == 2) |
| r1070 | r1071 | |
| 3924 | 3909 | 3: dsra/dsra32/dsrav rD,rT,rS |
| 3925 | 3910 | -------------------------------------------------*/ |
| 3926 | 3911 | |
| 3927 | | static int compile_dshift(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int shift_type, int shift_variable, int shift_const_plus32) |
| 3912 | static int compile_dshift(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int shift_type, int shift_variable, int shift_const_plus32) |
| 3928 | 3913 | { |
| 3929 | | UINT32 op = *desc->opptr; |
| 3914 | UINT32 op = *desc->opptr.l; |
| 3930 | 3915 | mipsreg_state rd, rs, rt; |
| 3931 | 3916 | |
| 3932 | 3917 | assert(shift_type == 0 || shift_type == 2 || shift_type == 3); |
| r1070 | r1071 | |
| 3954 | 3939 | else |
| 3955 | 3940 | { |
| 3956 | 3941 | /* allocate the register and load rT into it */ |
| 3942 | /* if rS is non-const, must load it first in case rD == rS */ |
| 3957 | 3943 | rd = compiler_register_allocate(drc, compiler, desc, RDREG, ALLOC_DST | ALLOC_DIRTY); |
| 3944 | if (!ISCONST(rs)) |
| 3945 | emit_load_register_value(drc, compiler, REG_ECX, rs); // mov ecx,<rs> |
| 3958 | 3946 | emit_load_register_value(drc, compiler, X86REG(rd), rt); // mov <rd>,<rt> |
| 3959 | 3947 | |
| 3960 | 3948 | /* if rs is constant, use immediate forms of the shift */ |
| r1070 | r1071 | |
| 3971 | 3959 | /* otherwise, load rs into cl so we can do a variable shift */ |
| 3972 | 3960 | else |
| 3973 | 3961 | { |
| 3974 | | emit_load_register_value(drc, compiler, REG_ECX, rs); // mov ecx,<rs> |
| 3975 | 3962 | if (shift_type == 0) |
| 3976 | 3963 | emit_shl_r64_cl(DRCTOP, X86REG(rd)); // shl <rd>,cl |
| 3977 | 3964 | else if (shift_type == 2) |
| r1070 | r1071 | |
| 3991 | 3978 | movz/movn rD,rS,rT |
| 3992 | 3979 | -------------------------------------------------*/ |
| 3993 | 3980 | |
| 3994 | | static int compile_movzn(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_movn) |
| 3981 | static int compile_movzn(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_movn) |
| 3995 | 3982 | { |
| 3996 | | UINT32 op = *desc->opptr; |
| 3983 | UINT32 op = *desc->opptr.l; |
| 3997 | 3984 | mipsreg_state rd, rs, rt; |
| 3998 | 3985 | emit_link skip = { 0 }; |
| 3999 | 3986 | |
| r1070 | r1071 | |
| 4040 | 4027 | 6: tne rS,rT / tnei rS,SIMM |
| 4041 | 4028 | -------------------------------------------------*/ |
| 4042 | 4029 | |
| 4043 | | static int compile_trapcc(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int condition, int immediate) |
| 4030 | static int compile_trapcc(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int condition, int immediate) |
| 4044 | 4031 | { |
| 4045 | 4032 | static const UINT8 condtype[] = { COND_GE, COND_AE, COND_L, COND_B, COND_E, COND_NONE, COND_NE, COND_NONE }; |
| 4046 | | UINT32 op = *desc->opptr; |
| 4033 | UINT32 op = *desc->opptr.l; |
| 4047 | 4034 | mipsreg_state rs, rt; |
| 4048 | 4035 | |
| 4049 | 4036 | assert(condition < ARRAY_LENGTH(condtype) && condtype[condition] != COND_NONE); |
| r1070 | r1071 | |
| 4111 | 4098 | bne rS,rT,dest |
| 4112 | 4099 | -------------------------------------------------*/ |
| 4113 | 4100 | |
| 4114 | | static int compile_branchcc(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int condition) |
| 4101 | static int compile_branchcc(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int condition) |
| 4115 | 4102 | { |
| 4116 | | UINT32 op = *desc->opptr; |
| 4103 | UINT32 op = *desc->opptr.l; |
| 4117 | 4104 | emit_link skip = { 0 }; |
| 4118 | 4105 | mipsreg_state rs, rt; |
| 4119 | 4106 | |
| r1070 | r1071 | |
| 4180 | 4167 | bgezall rS,dest |
| 4181 | 4168 | -------------------------------------------------*/ |
| 4182 | 4169 | |
| 4183 | | static int compile_branchcz(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int condition, int link) |
| 4170 | static int compile_branchcz(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int condition, int link) |
| 4184 | 4171 | { |
| 4185 | | UINT32 op = *desc->opptr; |
| 4172 | UINT32 op = *desc->opptr.l; |
| 4186 | 4173 | emit_link skip = { 0 }; |
| 4187 | 4174 | mipsreg_state rs; |
| 4188 | 4175 | |
| r1070 | r1071 | |
| 4222 | 4209 | addu rD,rS,rT / addiu rT,rS,SIMM |
| 4223 | 4210 | -------------------------------------------------*/ |
| 4224 | 4211 | |
| 4225 | | static int compile_add(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int suppress_exceptions, int immediate) |
| 4212 | static int compile_add(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int suppress_exceptions, int immediate) |
| 4226 | 4213 | { |
| 4227 | | UINT32 op = *desc->opptr; |
| 4214 | UINT32 op = *desc->opptr.l; |
| 4228 | 4215 | UINT8 destreg = immediate ? RTREG : RDREG; |
| 4229 | 4216 | mipsreg_state rd, rs, rt; |
| 4230 | 4217 | |
| r1070 | r1071 | |
| 4307 | 4294 | daddu rD,rS,rT |
| 4308 | 4295 | -------------------------------------------------*/ |
| 4309 | 4296 | |
| 4310 | | static int compile_dadd(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int suppress_exceptions, int immediate) |
| 4297 | static int compile_dadd(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int suppress_exceptions, int immediate) |
| 4311 | 4298 | { |
| 4312 | | UINT32 op = *desc->opptr; |
| 4299 | UINT32 op = *desc->opptr.l; |
| 4313 | 4300 | UINT8 destreg = immediate ? RTREG : RDREG; |
| 4314 | 4301 | mipsreg_state rd, rs, rt; |
| 4315 | 4302 | |
| r1070 | r1071 | |
| 4379 | 4366 | subu rD,rS,rT |
| 4380 | 4367 | -------------------------------------------------*/ |
| 4381 | 4368 | |
| 4382 | | static int compile_sub(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int suppress_exceptions) |
| 4369 | static int compile_sub(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int suppress_exceptions) |
| 4383 | 4370 | { |
| 4384 | | UINT32 op = *desc->opptr; |
| 4371 | UINT32 op = *desc->opptr.l; |
| 4385 | 4372 | mipsreg_state rd, rs, rt; |
| 4386 | 4373 | |
| 4387 | 4374 | /* note that we still must perform this operation even if RDREG == 0 |
| r1070 | r1071 | |
| 4472 | 4459 | dsubu rD,rS,rT |
| 4473 | 4460 | -------------------------------------------------*/ |
| 4474 | 4461 | |
| 4475 | | static int compile_dsub(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int suppress_exceptions) |
| 4462 | static int compile_dsub(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int suppress_exceptions) |
| 4476 | 4463 | { |
| 4477 | | UINT32 op = *desc->opptr; |
| 4464 | UINT32 op = *desc->opptr.l; |
| 4478 | 4465 | mipsreg_state rd, rs, rt; |
| 4479 | 4466 | |
| 4480 | 4467 | /* note that we still must perform this operation even if RDREG == 0 |
| r1070 | r1071 | |
| 4564 | 4551 | multu rS,rT |
| 4565 | 4552 | -------------------------------------------------*/ |
| 4566 | 4553 | |
| 4567 | | static int compile_mult(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_unsigned) |
| 4554 | static int compile_mult(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_unsigned) |
| 4568 | 4555 | { |
| 4569 | | UINT32 op = *desc->opptr; |
| 4556 | UINT32 op = *desc->opptr.l; |
| 4570 | 4557 | mipsreg_state rs, rt, lo, hi; |
| 4571 | 4558 | |
| 4572 | 4559 | /* allocate source registers */ |
| r1070 | r1071 | |
| 4610 | 4597 | dmultu rS,rT |
| 4611 | 4598 | -------------------------------------------------*/ |
| 4612 | 4599 | |
| 4613 | | static int compile_dmult(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_unsigned) |
| 4600 | static int compile_dmult(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_unsigned) |
| 4614 | 4601 | { |
| 4615 | | UINT32 op = *desc->opptr; |
| 4602 | UINT32 op = *desc->opptr.l; |
| 4616 | 4603 | mipsreg_state rs, rt, lo, hi; |
| 4617 | 4604 | |
| 4618 | 4605 | /* allocate source registers */ |
| r1070 | r1071 | |
| 4656 | 4643 | divu rS,rT |
| 4657 | 4644 | -------------------------------------------------*/ |
| 4658 | 4645 | |
| 4659 | | static int compile_div(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_unsigned) |
| 4646 | static int compile_div(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_unsigned) |
| 4660 | 4647 | { |
| 4661 | | UINT32 op = *desc->opptr; |
| 4648 | UINT32 op = *desc->opptr.l; |
| 4662 | 4649 | mipsreg_state rs, rt, lo, hi; |
| 4663 | 4650 | |
| 4664 | 4651 | /* allocate source registers */ |
| r1070 | r1071 | |
| 4722 | 4709 | ddivu rS,rT |
| 4723 | 4710 | -------------------------------------------------*/ |
| 4724 | 4711 | |
| 4725 | | static int compile_ddiv(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_unsigned) |
| 4712 | static int compile_ddiv(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_unsigned) |
| 4726 | 4713 | { |
| 4727 | | UINT32 op = *desc->opptr; |
| 4714 | UINT32 op = *desc->opptr.l; |
| 4728 | 4715 | mipsreg_state rs, rt, lo, hi; |
| 4729 | 4716 | |
| 4730 | 4717 | /* allocate source registers */ |
| r1070 | r1071 | |
| 4786 | 4773 | 3: nor rD,rS,rT |
| 4787 | 4774 | -------------------------------------------------*/ |
| 4788 | 4775 | |
| 4789 | | static int compile_logical(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int operation, int immediate) |
| 4776 | static int compile_logical(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int operation, int immediate) |
| 4790 | 4777 | { |
| 4791 | | UINT32 op = *desc->opptr; |
| 4778 | UINT32 op = *desc->opptr.l; |
| 4792 | 4779 | UINT8 destreg = immediate ? RTREG : RDREG; |
| 4793 | 4780 | mipsreg_state rd, rs, rt; |
| 4794 | 4781 | |
| r1070 | r1071 | |
| 4873 | 4860 | sltiu rD,rS,rT / sltiu rT,rS,SIMM |
| 4874 | 4861 | -------------------------------------------------*/ |
| 4875 | 4862 | |
| 4876 | | static int compile_slt(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_unsigned, int immediate) |
| 4863 | static int compile_slt(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_unsigned, int immediate) |
| 4877 | 4864 | { |
| 4878 | | UINT32 op = *desc->opptr; |
| 4865 | UINT32 op = *desc->opptr.l; |
| 4879 | 4866 | UINT8 destreg = immediate ? RTREG : RDREG; |
| 4880 | 4867 | mipsreg_state rd, rs, rt; |
| 4881 | 4868 | |
| r1070 | r1071 | |
| 4926 | 4913 | ld rT,SIMM(rS) |
| 4927 | 4914 | -------------------------------------------------*/ |
| 4928 | 4915 | |
| 4929 | | static int compile_load(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size, int is_unsigned) |
| 4916 | static int compile_load(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size, int is_unsigned) |
| 4930 | 4917 | { |
| 4931 | | UINT32 op = *desc->opptr; |
| 4918 | UINT32 op = *desc->opptr.l; |
| 4932 | 4919 | mipsreg_state rs, rt; |
| 4933 | 4920 | int was_fixed = FALSE; |
| 4934 | 4921 | |
| r1070 | r1071 | |
| 5002 | 4989 | ldc2 rT,SIMM(rs) |
| 5003 | 4990 | -------------------------------------------------*/ |
| 5004 | 4991 | |
| 5005 | | static int compile_load_cop(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size, void *dest) |
| 4992 | static int compile_load_cop(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size, void *dest) |
| 5006 | 4993 | { |
| 5007 | | UINT32 op = *desc->opptr; |
| 4994 | UINT32 op = *desc->opptr.l; |
| 5008 | 4995 | int was_fixed = FALSE; |
| 5009 | 4996 | mipsreg_state rs; |
| 5010 | 4997 | |
| r1070 | r1071 | |
| 5060 | 5047 | ldxc1 fD,rS,rT |
| 5061 | 5048 | -------------------------------------------------*/ |
| 5062 | 5049 | |
| 5063 | | static int compile_loadx_cop(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size, void *dest) |
| 5050 | static int compile_loadx_cop(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size, void *dest) |
| 5064 | 5051 | { |
| 5065 | | UINT32 op = *desc->opptr; |
| 5052 | UINT32 op = *desc->opptr.l; |
| 5066 | 5053 | int was_fixed = FALSE; |
| 5067 | 5054 | mipsreg_state rs, rt; |
| 5068 | 5055 | |
| r1070 | r1071 | |
| 5123 | 5110 | lwr rT,SIMM(rS) |
| 5124 | 5111 | -------------------------------------------------*/ |
| 5125 | 5112 | |
| 5126 | | static int compile_load_word_partial(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_right) |
| 5113 | static int compile_load_word_partial(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_right) |
| 5127 | 5114 | { |
| 5128 | | UINT32 op = *desc->opptr; |
| 5115 | UINT32 op = *desc->opptr.l; |
| 5129 | 5116 | int was_fixed = FALSE; |
| 5130 | 5117 | mipsreg_state rs, rt; |
| 5131 | 5118 | |
| r1070 | r1071 | |
| 5168 | 5155 | else |
| 5169 | 5156 | { |
| 5170 | 5157 | /* compute the address and mask values */ |
| 5171 | | emit_lea_r32_m32(DRCTOP, REG_EAX, MBD(X86REG(rs), SIMMVAL)); // lea eax,[<rs> + SIMMVAL] |
| 5158 | if (ISCONST(rs)) |
| 5159 | emit_mov_r32_imm(DRCTOP, REG_EAX, CONSTVAL(rs) + SIMMVAL); // mov eax,<rs> + SIMMVAL |
| 5160 | else |
| 5161 | emit_lea_r32_m32(DRCTOP, REG_EAX, MBD(X86REG(rs), SIMMVAL)); // lea eax,[<rs> + SIMMVAL] |
| 5172 | 5162 | emit_lea_r32_m32(DRCTOP, REG_ECX, MISD(REG_RAX, 8, 0)); // lea ecx,[rax*8] |
| 5173 | 5163 | emit_or_r32_imm(DRCTOP, REG_P2, -1); // or p2,-1 |
| 5174 | 5164 | if ((!mips3.core->bigendian && !is_right) || (mips3.core->bigendian && is_right)) |
| r1070 | r1071 | |
| 5226 | 5216 | ldr rT,SIMM(rS) |
| 5227 | 5217 | -------------------------------------------------*/ |
| 5228 | 5218 | |
| 5229 | | static int compile_load_double_partial(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_right) |
| 5219 | static int compile_load_double_partial(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_right) |
| 5230 | 5220 | { |
| 5231 | | UINT32 op = *desc->opptr; |
| 5221 | UINT32 op = *desc->opptr.l; |
| 5232 | 5222 | int was_fixed = FALSE; |
| 5233 | 5223 | mipsreg_state rs, rt; |
| 5234 | 5224 | |
| r1070 | r1071 | |
| 5276 | 5266 | else |
| 5277 | 5267 | { |
| 5278 | 5268 | /* compute the address and mask values */ |
| 5279 | | emit_lea_r32_m32(DRCTOP, REG_EAX, MBD(X86REG(rs), SIMMVAL)); // lea eax,[<rs> + SIMMVAL] |
| 5269 | if (ISCONST(rs)) |
| 5270 | emit_mov_r32_imm(DRCTOP, REG_EAX, CONSTVAL(rs) + SIMMVAL); // mov eax,<rs> + SIMMVAL |
| 5271 | else |
| 5272 | emit_lea_r32_m32(DRCTOP, REG_EAX, MBD(X86REG(rs), SIMMVAL)); // lea eax,[<rs> + SIMMVAL] |
| 5280 | 5273 | emit_lea_r32_m32(DRCTOP, REG_ECX, MISD(REG_RAX, 8, 0)); // lea ecx,[rax*8] |
| 5281 | 5274 | emit_or_r64_imm(DRCTOP, REG_P2, -1); // or p2,-1 |
| 5282 | 5275 | if ((!mips3.core->bigendian && !is_right) || (mips3.core->bigendian && is_right)) |
| r1070 | r1071 | |
| 5335 | 5328 | sd rT,SIMM(rS) |
| 5336 | 5329 | -------------------------------------------------*/ |
| 5337 | 5330 | |
| 5338 | | static int compile_store(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size) |
| 5331 | static int compile_store(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size) |
| 5339 | 5332 | { |
| 5340 | | UINT32 op = *desc->opptr; |
| 5333 | UINT32 op = *desc->opptr.l; |
| 5341 | 5334 | int was_fixed = FALSE; |
| 5342 | 5335 | mipsreg_state rs, rt; |
| 5343 | 5336 | |
| r1070 | r1071 | |
| 5399 | 5392 | sdc2 rT,SIMM(rs) |
| 5400 | 5393 | -------------------------------------------------*/ |
| 5401 | 5394 | |
| 5402 | | static int compile_store_cop(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size, void *src) |
| 5395 | static int compile_store_cop(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size, void *src) |
| 5403 | 5396 | { |
| 5404 | | UINT32 op = *desc->opptr; |
| 5397 | UINT32 op = *desc->opptr.l; |
| 5405 | 5398 | int was_fixed = FALSE; |
| 5406 | 5399 | mipsreg_state rs; |
| 5407 | 5400 | |
| r1070 | r1071 | |
| 5457 | 5450 | sdxc1 fD,rS,rT |
| 5458 | 5451 | -------------------------------------------------*/ |
| 5459 | 5452 | |
| 5460 | | static int compile_storex_cop(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int size, void *src) |
| 5453 | static int compile_storex_cop(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int size, void *src) |
| 5461 | 5454 | { |
| 5462 | | UINT32 op = *desc->opptr; |
| 5455 | UINT32 op = *desc->opptr.l; |
| 5463 | 5456 | int was_fixed = FALSE; |
| 5464 | 5457 | mipsreg_state rs, rt; |
| 5465 | 5458 | |
| r1070 | r1071 | |
| 5520 | 5513 | swr rT,SIMM(rS) |
| 5521 | 5514 | -------------------------------------------------*/ |
| 5522 | 5515 | |
| 5523 | | static int compile_store_word_partial(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_right) |
| 5516 | static int compile_store_word_partial(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_right) |
| 5524 | 5517 | { |
| 5525 | | UINT32 op = *desc->opptr; |
| 5518 | UINT32 op = *desc->opptr.l; |
| 5526 | 5519 | int was_fixed = FALSE; |
| 5527 | 5520 | mipsreg_state rs, rt; |
| 5528 | 5521 | |
| r1070 | r1071 | |
| 5615 | 5608 | sdr rT,SIMM(rS) |
| 5616 | 5609 | -------------------------------------------------*/ |
| 5617 | 5610 | |
| 5618 | | static int compile_store_double_partial(drc_core *drc, compiler_state *compiler, const mips3_opcode_desc *desc, int is_right) |
| 5611 | static int compile_store_double_partial(drc_core *drc, compiler_state *compiler, const opcode_desc *desc, int is_right) |
| 5619 | 5612 | { |
| 5620 | | UINT32 op = *desc->opptr; |
| 5613 | UINT32 op = *desc->opptr.l; |
| 5621 | 5614 | int was_fixed = FALSE; |
| 5622 | 5615 | mipsreg_state rs, rt; |
| 5623 | 5616 | |
src/emu/cpu/mips/mips3fe.c
| r1070 | r1071 | |
| 4 | 4 | |
| 5 | 5 | Front-end for MIPS3 recompiler |
| 6 | 6 | |
| 7 | Copyright (c) 2007, Aaron Giles |
| 8 | Released for general use under the MAME license |
| 9 | Visit http://mamedev.org for licensing and usage restrictions. |
| 10 | |
| 7 | 11 | ***************************************************************************/ |
| 8 | 12 | |
| 9 | 13 | #include <stddef.h> |
| 10 | 14 | #include "cpuintrf.h" |
| 11 | 15 | #include "mips3fe.h" |
| 16 | #include "mips3com.h" |
| 12 | 17 | |
| 13 | 18 | |
| 14 | 19 | /*************************************************************************** |
| 15 | | CONSTANTS |
| 16 | | ***************************************************************************/ |
| 17 | | |
| 18 | | #define MAX_STACK_DEPTH 100 |
| 19 | | |
| 20 | | |
| 21 | | |
| 22 | | /*************************************************************************** |
| 23 | | TYPE DEFINITIONS |
| 24 | | ***************************************************************************/ |
| 25 | | |
| 26 | | typedef struct _pc_stack_entry pc_stack_entry; |
| 27 | | struct _pc_stack_entry |
| 28 | | { |
| 29 | | UINT32 targetpc; |
| 30 | | UINT32 srcpc; |
| 31 | | }; |
| 32 | | |
| 33 | | |
| 34 | | |
| 35 | | /*************************************************************************** |
| 36 | | LOCAL VARAIBLES |
| 37 | | ***************************************************************************/ |
| 38 | | |
| 39 | | static mips3_opcode_desc *desc_free_list; |
| 40 | | static mips3_opcode_desc **desc_array; |
| 41 | | static UINT32 desc_array_size; |
| 42 | | static UINT32 dummy_nop = 0; |
| 43 | | |
| 44 | | |
| 45 | | |
| 46 | | /*************************************************************************** |
| 47 | 20 | FUNCTION PROTOTYPES |
| 48 | 21 | ***************************************************************************/ |
| 49 | 22 | |
| 50 | | static mips3_opcode_desc **build_sequence(mips3_opcode_desc **tailptr, int start, int end, UINT32 endflag, int maxseq); |
| 23 | static int describe_instruction_special(mips3_state *mips, UINT32 op, opcode_desc *desc); |
| 24 | static int describe_instruction_regimm(mips3_state *mips, UINT32 op, opcode_desc *desc); |
| 25 | static int describe_instruction_idt(mips3_state *mips, UINT32 op, opcode_desc *desc); |
| 26 | static int describe_instruction_cop0(mips3_state *mips, UINT32 op, opcode_desc *desc); |
| 27 | static int describe_instruction_cop1(mips3_state *mips, UINT32 op, opcode_desc *desc); |
| 28 | static int describe_instruction_cop1x(mips3_state *mips, UINT32 op, opcode_desc *desc); |
| 29 | static int describe_instruction_cop2(mips3_state *mips, UINT32 op, opcode_desc *desc); |
| 51 | 30 | |
| 52 | | static int describe_one(mips3_state *mips, UINT32 curpc, mips3_opcode_desc *curdesc); |
| 53 | | static void describe_instruction(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc); |
| 54 | | static void describe_instruction_special(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc); |
| 55 | | static void describe_instruction_regimm(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc); |
| 56 | | static void describe_instruction_idt(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc); |
| 57 | | static void describe_instruction_cop0(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc); |
| 58 | | static void describe_instruction_cop1(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc); |
| 59 | | static void describe_instruction_cop1x(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc); |
| 60 | | static void describe_instruction_cop2(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc); |
| 61 | 31 | |
| 62 | 32 | |
| 63 | | |
| 64 | 33 | /*************************************************************************** |
| 65 | | INLINE FUNCTIONS |
| 66 | | ***************************************************************************/ |
| 67 | | |
| 68 | | INLINE mips3_opcode_desc *desc_alloc(void) |
| 69 | | { |
| 70 | | mips3_opcode_desc *desc = desc_free_list; |
| 71 | | |
| 72 | | /* pull a description off of the free list or allocate a new one */ |
| 73 | | if (desc != NULL) |
| 74 | | desc_free_list = desc->next; |
| 75 | | else |
| 76 | | desc = malloc_or_die(sizeof(*desc)); |
| 77 | | return desc; |
| 78 | | } |
| 79 | | |
| 80 | | |
| 81 | | INLINE void desc_free(mips3_opcode_desc *desc) |
| 82 | | { |
| 83 | | /* just put ourselves on the free list */ |
| 84 | | desc->next = desc_free_list; |
| 85 | | desc_free_list = desc; |
| 86 | | } |
| 87 | | |
| 88 | | |
| 89 | | INLINE void invalid_opcode(mips3_opcode_desc *desc) |
| 90 | | { |
| 91 | | desc->flags |= IDESC_WILL_CAUSE_EXCEPTION | IDESC_END_SEQUENCE | IDESC_INVALID_OPCODE; |
| 92 | | } |
| 93 | | |
| 94 | | |
| 95 | | INLINE int is_fixed_mapped(UINT32 pc) |
| 96 | | { |
| 97 | | return (pc >= 0x80000000 && pc < 0xc0000000); |
| 98 | | } |
| 99 | | |
| 100 | | |
| 101 | | |
| 102 | | /*************************************************************************** |
| 103 | | CORE IMPLEMENTATION |
| 104 | | ***************************************************************************/ |
| 105 | | |
| 106 | | /*------------------------------------------------- |
| 107 | | mips3fe_init - initialization |
| 108 | | -------------------------------------------------*/ |
| 109 | | |
| 110 | | void mips3fe_init(void) |
| 111 | | { |
| 112 | | desc_free_list = NULL; |
| 113 | | desc_array = NULL; |
| 114 | | desc_array_size = 0; |
| 115 | | } |
| 116 | | |
| 117 | | |
| 118 | | /*------------------------------------------------- |
| 119 | | mipsfe_exit - clean up after ourselves |
| 120 | | -------------------------------------------------*/ |
| 121 | | |
| 122 | | void mips3fe_exit(void) |
| 123 | | { |
| 124 | | /* free our free list of descriptions */ |
| 125 | | while (desc_free_list != NULL) |
| 126 | | { |
| 127 | | mips3_opcode_desc *freeme = desc_free_list; |
| 128 | | desc_free_list = desc_free_list->next; |
| 129 | | free(freeme); |
| 130 | | } |
| 131 | | |
| 132 | | /* free the description array */ |
| 133 | | if (desc_array != NULL) |
| 134 | | free(desc_array); |
| 135 | | desc_array_size = 0; |
| 136 | | } |
| 137 | | |
| 138 | | |
| 139 | | /*------------------------------------------------- |
| 140 | | mips3fe_describe_sequence - describe a |
| 141 | | sequence of instructions that falls within |
| 142 | | the given range |
| 143 | | -------------------------------------------------*/ |
| 144 | | |
| 145 | | mips3_opcode_desc *mips3fe_describe_sequence(mips3_state *mips, UINT32 startpc, UINT32 minpc, UINT32 maxpc, int maxseq) |
| 146 | | { |
| 147 | | pc_stack_entry pcstack[MAX_STACK_DEPTH]; |
| 148 | | pc_stack_entry *pcstackptr = &pcstack[0]; |
| 149 | | mips3_opcode_desc *head, **tailptr; |
| 150 | | |
| 151 | | /* make sure our array is big enough */ |
| 152 | | if ((maxpc - minpc) / 4 + 10 > desc_array_size) |
| 153 | | { |
| 154 | | desc_array_size = (maxpc - minpc) / 4 + 10; |
| 155 | | desc_array = realloc(desc_array, desc_array_size * sizeof(desc_array[0])); |
| 156 | | memset(desc_array, 0, desc_array_size * sizeof(desc_array[0])); |
| 157 | | } |
| 158 | | |
| 159 | | /* add the initial PC to the stack */ |
| 160 | | pcstackptr->srcpc = 0; |
| 161 | | pcstackptr->targetpc = startpc; |
| 162 | | pcstackptr++; |
| 163 | | |
| 164 | | /* loop while we still have a stack */ |
| 165 | | while (pcstackptr != &pcstack[0]) |
| 166 | | { |
| 167 | | pc_stack_entry *curstack = --pcstackptr; |
| 168 | | mips3_opcode_desc *prevdesc = NULL; |
| 169 | | mips3_opcode_desc *curdesc; |
| 170 | | UINT32 curpc; |
| 171 | | |
| 172 | | /* if we've already hit this PC, just mark it a branch target and continue */ |
| 173 | | curdesc = desc_array[(curstack->targetpc - minpc) / 4]; |
| 174 | | if (curdesc != NULL) |
| 175 | | { |
| 176 | | curdesc->flags |= IDESC_IS_BRANCH_TARGET; |
| 177 | | |
| 178 | | /* if the branch crosses a page boundary, mark the target as needing to revalidate */ |
| 179 | | if (!is_fixed_mapped(curdesc->pc) && ((curstack->srcpc ^ curdesc->pc) & ~0xfff) != 0) |
| 180 | | curdesc->flags |= IDESC_VALIDATE_TLB | IDESC_CAN_CAUSE_EXCEPTION; |
| 181 | | |
| 182 | | /* continue processing */ |
| 183 | | continue; |
| 184 | | } |
| 185 | | |
| 186 | | /* loop until we exit the block */ |
| 187 | | for (curpc = curstack->targetpc; curpc < maxpc && desc_array[(curpc - minpc) / 4] == NULL; curpc += 4) |
| 188 | | { |
| 189 | | /* describe one instruction */ |
| 190 | | desc_array[(curpc - minpc) / 4] = curdesc = desc_alloc(); |
| 191 | | if (!describe_one(mips, curpc, curdesc)) |
| 192 | | break; |
| 193 | | |
| 194 | | /* first instruction in a block is always a branch target */ |
| 195 | | if (curpc == curstack->targetpc) |
| 196 | | curdesc->flags |= IDESC_IS_BRANCH_TARGET; |
| 197 | | |
| 198 | | /* first instruction in a block or page must always validate the TLB */ |
| 199 | | if (!is_fixed_mapped(curpc) && (curpc == startpc || (curpc & 0xfff) == 0)) |
| 200 | | curdesc->flags |= IDESC_VALIDATE_TLB | IDESC_CAN_CAUSE_EXCEPTION; |
| 201 | | |
| 202 | | /* if we are a branch, add the branch target to our stack */ |
| 203 | | if ((curdesc->flags & IDESC_IS_BRANCH) && curdesc->targetpc >= minpc && curdesc->targetpc < maxpc && pcstackptr < &pcstack[MAX_STACK_DEPTH]) |
| 204 | | { |
| 205 | | curdesc->flags |= IDESC_INTRABLOCK_BRANCH; |
| 206 | | pcstackptr->srcpc = curdesc->pc; |
| 207 | | pcstackptr->targetpc = curdesc->targetpc; |
| 208 | | pcstackptr++; |
| 209 | | } |
| 210 | | |
| 211 | | /* we now become the previous desc */ |
| 212 | | prevdesc = curdesc; |
| 213 | | |
| 214 | | /* if we're done, we're done */ |
| 215 | | if (curdesc->flags & IDESC_END_SEQUENCE) |
| 216 | | break; |
| 217 | | |
| 218 | | /* if this is a likely branch, advance an extra 4 */ |
| 219 | | if (curdesc->flags & IDESC_IS_LIKELY_BRANCH) |
| 220 | | curpc += 4; |
| 221 | | } |
| 222 | | } |
| 223 | | |
| 224 | | /* now build the list of descriptions in order */ |
| 225 | | /* first from startpc -> maxpc, then from minpc -> startpc */ |
| 226 | | head = NULL; |
| 227 | | tailptr = build_sequence(&head, (startpc - minpc) / 4, (maxpc - minpc) / 4, IDESC_REDISPATCH, maxseq); |
| 228 | | tailptr = build_sequence(tailptr, (minpc - minpc) / 4, (startpc - minpc) / 4, IDESC_RETURN_TO_START, maxseq); |
| 229 | | return head; |
| 230 | | } |
| 231 | | |
| 232 | | |
| 233 | | /*------------------------------------------------- |
| 234 | | mips3fe_release_descriptions - release a |
| 235 | | list of descriptions |
| 236 | | -------------------------------------------------*/ |
| 237 | | |
| 238 | | void mips3fe_release_descriptions(mips3_opcode_desc *desc) |
| 239 | | { |
| 240 | | while (desc != NULL) |
| 241 | | { |
| 242 | | mips3_opcode_desc *freeme = desc; |
| 243 | | if (desc->delay != NULL) |
| 244 | | mips3fe_release_descriptions(desc->delay); |
| 245 | | desc = desc->next; |
| 246 | | desc_free(freeme); |
| 247 | | } |
| 248 | | } |
| 249 | | |
| 250 | | |
| 251 | | |
| 252 | | /*************************************************************************** |
| 253 | | INTERNAL HELPERS |
| 254 | | ***************************************************************************/ |
| 255 | | |
| 256 | | /*------------------------------------------------- |
| 257 | | accumulate_live_info_forwards - recursively |
| 258 | | accumulate live register liveness information |
| 259 | | walking in a forward direction |
| 260 | | -------------------------------------------------*/ |
| 261 | | |
| 262 | | static void accumulate_live_info_forwards(mips3_opcode_desc *desc, UINT64 *gprread, UINT64 *gprwrite, UINT64 *fprread, UINT64 *fprwrite) |
| 263 | | { |
| 264 | | /* set the initial information */ |
| 265 | | desc->gpr.liveread = (*gprread |= desc->gpr.used); |
| 266 | | desc->gpr.livewrite = (*gprwrite |= desc->gpr.modified); |
| 267 | | desc->fpr.liveread = (*fprread |= desc->fpr.used); |
| 268 | | desc->fpr.livewrite = (*fprwrite |= desc->fpr.modified); |
| 269 | | |
| 270 | | /* recursively handle delay slots */ |
| 271 | | if (desc->delay != NULL) |
| 272 | | accumulate_live_info_forwards(desc->delay, gprread, gprwrite, fprread, fprwrite); |
| 273 | | } |
| 274 | | |
| 275 | | |
| 276 | | /*------------------------------------------------- |
| 277 | | accumulate_live_info_backwards - recursively |
| 278 | | accumulate live register liveness information |
| 279 | | walking in a backwards direction |
| 280 | | -------------------------------------------------*/ |
| 281 | | |
| 282 | | static void accumulate_live_info_backwards(mips3_opcode_desc *desc, UINT64 *gprread, UINT64 *gprwrite, UINT64 *fprread, UINT64 *fprwrite) |
| 283 | | { |
| 284 | | /* recursively handle delay slots */ |
| 285 | | if (desc->delay != NULL) |
| 286 | | accumulate_live_info_backwards(desc->delay, gprread, gprwrite, fprread, fprwrite); |
| 287 | | |
| 288 | | /* accumulate the info from this instruction */ |
| 289 | | desc->gpr.liveread &= (*gprread |= desc->gpr.used); |
| 290 | | desc->gpr.livewrite &= (*gprwrite |= desc->gpr.modified); |
| 291 | | desc->fpr.liveread &= (*fprread |= desc->fpr.used); |
| 292 | | desc->fpr.livewrite &= (*fprwrite |= desc->fpr.modified); |
| 293 | | } |
| 294 | | |
| 295 | | |
| 296 | | /*------------------------------------------------- |
| 297 | | build_sequence - build an ordered sequence |
| 298 | | of instructions |
| 299 | | -------------------------------------------------*/ |
| 300 | | |
| 301 | | static mips3_opcode_desc **build_sequence(mips3_opcode_desc **tailptr, int start, int end, UINT32 endflag, int maxseq) |
| 302 | | { |
| 303 | | UINT64 gprread = 0, gprwrite = 0; |
| 304 | | UINT64 fprread = 0, fprwrite = 0; |
| 305 | | int consecutive = 0; |
| 306 | | int seqstart = -1; |
| 307 | | int descnum; |
| 308 | | |
| 309 | | /* iterate in order from start to end, picking up all non-NULL instructions */ |
| 310 | | for (descnum = start; descnum < end; descnum++) |
| 311 | | if (desc_array[descnum] != NULL) |
| 312 | | { |
| 313 | | mips3_opcode_desc *desc = desc_array[descnum]; |
| 314 | | mips3_opcode_desc *next = NULL; |
| 315 | | int nextoffs; |
| 316 | | |
| 317 | | /* determine the next instruction */ |
| 318 | | nextoffs = (desc->flags & IDESC_IS_LIKELY_BRANCH) ? 2 : 1; |
| 319 | | if (descnum + nextoffs < end) |
| 320 | | next = desc_array[descnum + nextoffs]; |
| 321 | | |
| 322 | | /* start a new sequence if we aren't already in the middle of one */ |
| 323 | | if (seqstart == -1) |
| 324 | | seqstart = descnum; |
| 325 | | |
| 326 | | /* if this is a likely branch and there is a branch into the delay slot, mark it as */ |
| 327 | | /* end-of-sequence so that the common flow will branch over it */ |
| 328 | | if ((desc->flags & IDESC_IS_LIKELY_BRANCH) && desc_array[descnum + 1] != NULL) |
| 329 | | desc->flags |= IDESC_END_SEQUENCE; |
| 330 | | |
| 331 | | /* if the next instruction is a branch target, mark this instruction as end of sequence */ |
| 332 | | if (next != NULL && (next->flags & IDESC_IS_BRANCH_TARGET)) |
| 333 | | desc->flags |= IDESC_END_SEQUENCE; |
| 334 | | |
| 335 | | /* if we are the last instruction, indicate end-of-sequence and redispatch */ |
| 336 | | if (next == NULL) |
| 337 | | desc->flags |= IDESC_END_SEQUENCE | endflag; |
| 338 | | |
| 339 | | /* if we exceed the maximum consecutive count, cut off the sequence */ |
| 340 | | if (!(desc->flags & IDESC_END_SEQUENCE) && ++consecutive >= maxseq) |
| 341 | | desc->flags |= IDESC_END_SEQUENCE; |
| 342 | | if (desc->flags & IDESC_END_SEQUENCE) |
| 343 | | consecutive = 0; |
| 344 | | |
| 345 | | /* update register accumulators */ |
| 346 | | accumulate_live_info_forwards(desc, &gprread, &gprwrite, &fprread, &fprwrite); |
| 347 | | |
| 348 | | /* if this is the end of a sequence, work backwards */ |
| 349 | | if (desc->flags & IDESC_END_SEQUENCE) |
| 350 | | { |
| 351 | | int backdesc; |
| 352 | | |
| 353 | | /* loop until all the registers have been accounted for */ |
| 354 | | gprread = gprwrite = 0; |
| 355 | | fprread = fprwrite = 0; |
| 356 | | for (backdesc = descnum; backdesc != seqstart - 1; backdesc--) |
| 357 | | if (desc_array[backdesc] != NULL) |
| 358 | | accumulate_live_info_backwards(desc_array[backdesc], &gprread, &gprwrite, &fprread, &fprwrite); |
| 359 | | |
| 360 | | /* reset the register states */ |
| 361 | | seqstart = -1; |
| 362 | | gprread = gprwrite = 0; |
| 363 | | fprread = fprwrite = 0; |
| 364 | | } |
| 365 | | |
| 366 | | /* add us to the end of the list and clear our array slot */ |
| 367 | | *tailptr = desc; |
| 368 | | tailptr = &desc->next; |
| 369 | | } |
| 370 | | |
| 371 | | /* zap the array */ |
| 372 | | memset(&desc_array[start], 0, (end - start) * sizeof(desc_array[0])); |
| 373 | | |
| 374 | | /* return the final tailptr */ |
| 375 | | return tailptr; |
| 376 | | } |
| 377 | | |
| 378 | | |
| 379 | | |
| 380 | | /*************************************************************************** |
| 381 | 34 | INSTRUCTION PARSERS |
| 382 | 35 | ***************************************************************************/ |
| 383 | 36 | |
| 384 | 37 | /*------------------------------------------------- |
| 385 | | describe_one - describe a single instruction |
| 386 | | -------------------------------------------------*/ |
| 387 | | |
| 388 | | static int describe_one(mips3_state *mips, UINT32 curpc, mips3_opcode_desc *curdesc) |
| 389 | | { |
| 390 | | /* fill in default values */ |
| 391 | | curdesc->next = NULL; |
| 392 | | curdesc->delay = NULL; |
| 393 | | curdesc->pc = curpc; |
| 394 | | curdesc->targetpc = ~0; |
| 395 | | curdesc->flags = 0; |
| 396 | | curdesc->cycles = 1; |
| 397 | | curdesc->gpr.used = 0; |
| 398 | | curdesc->gpr.modified = 0; |
| 399 | | curdesc->gpr.liveread = 0; |
| 400 | | curdesc->gpr.livewrite = 0; |
| 401 | | curdesc->fpr.used = 0; |
| 402 | | curdesc->fpr.modified = 0; |
| 403 | | curdesc->fpr.liveread = 0; |
| 404 | | curdesc->fpr.livewrite = 0; |
| 405 | | |
| 406 | | /* determine the physical PC and pointer to opcode for this instruction */ |
| 407 | | curdesc->physpc = curpc; |
| 408 | | if (!mips3com_translate_address(mips, ADDRESS_SPACE_PROGRAM, &curdesc->physpc)) |
| 409 | | { |
| 410 | | /* if we're not mapped, generate an exception */ |
| 411 | | curdesc->opptr = &dummy_nop; |
| 412 | | curdesc->flags = IDESC_CAN_CAUSE_EXCEPTION | IDESC_END_SEQUENCE | IDESC_REDISPATCH; |
| 413 | | return FALSE; |
| 414 | | } |
| 415 | | curdesc->opptr = memory_get_op_ptr(cpu_getactivecpu(), curdesc->physpc, FALSE); |
| 416 | | assert(curdesc->opptr != NULL); |
| 417 | | |
| 418 | | /* describe this instruction */ |
| 419 | | describe_instruction(mips, curpc, *curdesc->opptr, curdesc); |
| 420 | | |
| 421 | | /* if we are a branch, describe the delay slot as well */ |
| 422 | | if (curdesc->flags & IDESC_IS_BRANCH) |
| 423 | | { |
| 424 | | curdesc->delay = desc_alloc(); |
| 425 | | describe_one(mips, curpc + 4, curdesc->delay); |
| 426 | | curdesc->delay->flags |= IDESC_IN_DELAY_SLOT; |
| 427 | | curdesc->delay->branch = curdesc; |
| 428 | | } |
| 429 | | return TRUE; |
| 430 | | } |
| 431 | | |
| 432 | | |
| 433 | | /*------------------------------------------------- |
| 434 | 38 | describe_instruction - build a description |
| 435 | 39 | of a single instruction |
| 436 | 40 | -------------------------------------------------*/ |
| 437 | 41 | |
| 438 | | static void describe_instruction(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc) |
| 42 | int mips3fe_describe(void *param, opcode_desc *desc) |
| 439 | 43 | { |
| 44 | mips3_state *mips = param; |
| 45 | UINT32 op = *desc->opptr.l; |
| 46 | UINT8 opswitch = op >> 26; |
| 47 | |
| 48 | /* all instructions are 4 bytes and default to a single cycle each */ |
| 49 | desc->length = 4; |
| 50 | desc->cycles = 1; |
| 51 | |
| 440 | 52 | /* parse the instruction */ |
| 441 | | switch (op >> 26) |
| 53 | switch (opswitch) |
| 442 | 54 | { |
| 443 | 55 | case 0x00: /* SPECIAL */ |
| 444 | | describe_instruction_special(mips, pc, op, desc); |
| 445 | | break; |
| 56 | return describe_instruction_special(mips, op, desc); |
| 446 | 57 | |
| 447 | 58 | case 0x01: /* REGIMM */ |
| 448 | | describe_instruction_regimm(mips, pc, op, desc); |
| 449 | | break; |
| 59 | return describe_instruction_regimm(mips, op, desc); |
| 450 | 60 | |
| 451 | 61 | case 0x10: /* COP0 */ |
| 452 | | describe_instruction_cop0(mips, pc, op, desc); |
| 453 | | break; |
| 62 | return describe_instruction_cop0(mips, op, desc); |
| 454 | 63 | |
| 455 | 64 | case 0x11: /* COP1 */ |
| 456 | | describe_instruction_cop1(mips, pc, op, desc); |
| 457 | | break; |
| 65 | return describe_instruction_cop1(mips, op, desc); |
| 458 | 66 | |
| 459 | 67 | case 0x12: /* COP2 */ |
| 460 | | describe_instruction_cop2(mips, pc, op, desc); |
| 461 | | break; |
| 68 | return describe_instruction_cop2(mips, op, desc); |
| 462 | 69 | |
| 463 | 70 | case 0x13: /* COP1X - MIPS IV */ |
| 464 | 71 | if (mips->flavor < MIPS3_TYPE_MIPS_IV) |
| 465 | | { |
| 466 | | invalid_opcode(desc); |
| 467 | | break; |
| 468 | | } |
| 469 | | describe_instruction_cop1x(mips, pc, op, desc); |
| 470 | | break; |
| 72 | return FALSE; |
| 73 | return describe_instruction_cop1x(mips, op, desc); |
| 471 | 74 | |
| 472 | 75 | case 0x1c: /* IDT-specific opcodes: mad/madu/mul on R4640/4650, msub on RC32364 */ |
| 473 | | describe_instruction_idt(mips, pc, op, desc); |
| 474 | | break; |
| 76 | return describe_instruction_idt(mips, op, desc); |
| 475 | 77 | |
| 476 | 78 | case 0x02: /* J */ |
| 477 | | desc->flags |= IDESC_IS_UNCONDITIONAL_BRANCH | IDESC_END_SEQUENCE; |
| 478 | | desc->targetpc = (pc & 0xf0000000) | (LIMMVAL << 2); |
| 479 | | break; |
| 79 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 80 | desc->targetpc = (desc->pc & 0xf0000000) | (LIMMVAL << 2); |
| 81 | desc->delayslots = 1; |
| 82 | return TRUE; |
| 480 | 83 | |
| 481 | 84 | case 0x03: /* JAL */ |
| 482 | 85 | desc->gpr.modified |= REGFLAG_R(31); |
| 483 | | desc->flags |= IDESC_IS_UNCONDITIONAL_BRANCH | IDESC_END_SEQUENCE; |
| 484 | | desc->targetpc = (pc & 0xf0000000) | (LIMMVAL << 2); |
| 485 | | break; |
| 86 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 87 | desc->targetpc = (desc->pc & 0xf0000000) | (LIMMVAL << 2); |
| 88 | desc->delayslots = 1; |
| 89 | return TRUE; |
| 486 | 90 | |
| 487 | | case 0x14: /* BEQL */ |
| 488 | | case 0x15: /* BNEL */ |
| 489 | | desc->flags |= IDESC_IS_LIKELY_BRANCH; |
| 490 | | /* fall through */ |
| 491 | | |
| 492 | 91 | case 0x04: /* BEQ */ |
| 493 | 92 | case 0x05: /* BNE */ |
| 494 | | if (((op >> 26) == 0x04 || (op >> 26) == 0x14) && RSREG == RTREG) |
| 495 | | desc->flags |= IDESC_IS_UNCONDITIONAL_BRANCH | IDESC_END_SEQUENCE; |
| 93 | case 0x14: /* BEQL */ |
| 94 | case 0x15: /* BNEL */ |
| 95 | if ((opswitch == 0x04 || opswitch == 0x14) && RSREG == RTREG) |
| 96 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 496 | 97 | else |
| 497 | 98 | { |
| 498 | 99 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 499 | | desc->flags |= IDESC_IS_CONDITIONAL_BRANCH; |
| 100 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 500 | 101 | } |
| 501 | | desc->targetpc = pc + 4 + (SIMMVAL << 2); |
| 502 | | break; |
| 102 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| 103 | desc->delayslots = 1; |
| 104 | desc->skipslots = (opswitch & 0x10) ? 1 : 0; |
| 105 | return TRUE; |
| 503 | 106 | |
| 504 | | case 0x16: /* BLEZL */ |
| 505 | | case 0x17: /* BGTZL */ |
| 506 | | desc->flags |= IDESC_IS_LIKELY_BRANCH; |
| 507 | | /* fall through */ |
| 508 | | |
| 509 | 107 | case 0x06: /* BLEZ */ |
| 510 | 108 | case 0x07: /* BGTZ */ |
| 511 | | if (((op >> 26) == 0x06 || (op >> 26) == 0x16) && RSREG == 0) |
| 512 | | desc->flags |= IDESC_IS_UNCONDITIONAL_BRANCH | IDESC_END_SEQUENCE; |
| 109 | case 0x16: /* BLEZL */ |
| 110 | case 0x17: /* BGTZL */ |
| 111 | if ((opswitch == 0x06 || opswitch == 0x16) && RSREG == 0) |
| 112 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 513 | 113 | else |
| 514 | 114 | { |
| 515 | 115 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 516 | | desc->flags |= IDESC_IS_CONDITIONAL_BRANCH; |
| 116 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 517 | 117 | } |
| 518 | | desc->targetpc = pc + 4 + (SIMMVAL << 2); |
| 519 | | break; |
| 118 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| 119 | desc->delayslots = 1; |
| 120 | desc->skipslots = (opswitch & 0x10) ? 1 : 0; |
| 121 | return TRUE; |
| 520 | 122 | |
| 521 | 123 | case 0x08: /* ADDI */ |
| 522 | 124 | case 0x18: /* DADDI */ |
| 523 | 125 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 524 | 126 | desc->gpr.modified |= REGFLAG_R(RTREG); |
| 525 | | desc->flags |= IDESC_CAN_CAUSE_EXCEPTION; |
| 526 | | break; |
| 127 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 128 | return TRUE; |
| 527 | 129 | |
| 528 | 130 | case 0x09: /* ADDIU */ |
| 529 | 131 | case 0x0a: /* SLTI */ |
| r1070 | r1071 | |
| 534 | 136 | case 0x19: /* DADDIU */ |
| 535 | 137 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 536 | 138 | desc->gpr.modified |= REGFLAG_R(RTREG); |
| 537 | | break; |
| 139 | return TRUE; |
| 538 | 140 | |
| 539 | 141 | case 0x0f: /* LUI */ |
| 540 | 142 | desc->gpr.modified |= REGFLAG_R(RTREG); |
| 541 | | break; |
| 143 | return TRUE; |
| 542 | 144 | |
| 543 | 145 | case 0x1a: /* LDL */ |
| 544 | 146 | case 0x1b: /* LDR */ |
| r1070 | r1071 | |
| 556 | 158 | case 0x37: /* LD */ |
| 557 | 159 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 558 | 160 | desc->gpr.modified |= REGFLAG_R(RTREG); |
| 559 | | desc->flags |= IDESC_READS_MEMORY | IDESC_CAN_CAUSE_EXCEPTION; |
| 560 | | break; |
| 161 | desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 162 | return TRUE; |
| 561 | 163 | |
| 562 | 164 | case 0x28: /* SB */ |
| 563 | 165 | case 0x29: /* SH */ |
| r1070 | r1071 | |
| 570 | 172 | case 0x3c: /* SCD */ |
| 571 | 173 | case 0x3f: /* SD */ |
| 572 | 174 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 573 | | desc->flags |= IDESC_WRITES_MEMORY | IDESC_CAN_CAUSE_EXCEPTION; |
| 574 | | break; |
| 175 | desc->flags |= OPFLAG_WRITES_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 176 | return TRUE; |
| 575 | 177 | |
| 576 | 178 | case 0x31: /* LWC1 */ |
| 577 | 179 | case 0x35: /* LDC1 */ |
| 578 | 180 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 579 | 181 | desc->fpr.modified |= REGFLAG_CPR1(RTREG); |
| 580 | | desc->flags |= IDESC_READS_MEMORY | IDESC_CAN_CAUSE_EXCEPTION; |
| 581 | | break; |
| 182 | desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 183 | return TRUE; |
| 582 | 184 | |
| 583 | 185 | case 0x39: /* SWC1 */ |
| 584 | 186 | case 0x3d: /* SDC1 */ |
| 585 | 187 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 586 | 188 | desc->fpr.used |= REGFLAG_CPR1(RTREG); |
| 587 | | desc->flags |= IDESC_WRITES_MEMORY | IDESC_CAN_CAUSE_EXCEPTION; |
| 588 | | break; |
| 189 | desc->flags |= OPFLAG_WRITES_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 190 | return TRUE; |
| 589 | 191 | |
| 590 | 192 | case 0x32: /* LWC2 */ |
| 591 | 193 | case 0x36: /* LDC2 */ |
| 592 | 194 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 593 | | desc->flags |= IDESC_READS_MEMORY | IDESC_CAN_CAUSE_EXCEPTION; |
| 594 | | break; |
| 195 | desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 196 | return TRUE; |
| 595 | 197 | |
| 596 | 198 | case 0x3a: /* SWC2 */ |
| 597 | 199 | case 0x3e: /* SDC2 */ |
| 598 | 200 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 599 | | desc->flags |= IDESC_WRITES_MEMORY | IDESC_CAN_CAUSE_EXCEPTION; |
| 600 | | break; |
| 201 | desc->flags |= OPFLAG_WRITES_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION; |
| 202 | return TRUE; |
| 601 | 203 | |
| 602 | | case 0x2f: /* CACHE */ |
| 603 | | /* effective no-op */ |
| 604 | | break; |
| 605 | | |
| 606 | 204 | case 0x33: /* PREF */ |
| 607 | 205 | if (mips->flavor < MIPS3_TYPE_MIPS_IV) |
| 608 | | invalid_opcode(desc); |
| 609 | | else |
| 610 | | ; /* effective no-op */ |
| 611 | | break; |
| 612 | | |
| 613 | | default: /* anything else */ |
| 614 | | invalid_opcode(desc); |
| 615 | | break; |
| 206 | return FALSE; |
| 207 | case 0x2f: /* CACHE */ |
| 208 | /* effective no-op */ |
| 209 | return TRUE; |
| 616 | 210 | } |
| 617 | 211 | |
| 618 | | /* remove any modifications of R0 */ |
| 619 | | desc->gpr.modified &= ~REGFLAG_R(0); |
| 212 | return FALSE; |
| 620 | 213 | } |
| 621 | 214 | |
| 622 | 215 | |
| r1070 | r1071 | |
| 626 | 219 | 'special' group |
| 627 | 220 | -------------------------------------------------*/ |
| 628 | 221 | |
| 629 | | static void describe_instruction_special(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc) |
| 222 | static int describe_instruction_special(mips3_state *mips, UINT32 op, opcode_desc *desc) |
| 630 | 223 | { |
| 631 | 224 | switch (op & 63) |
| 632 | 225 | { |
| r1070 | r1071 | |
| 641 | 234 | case 0x3f: /* DSRA32 */ |
| 642 | 235 | desc->gpr.used |= REGFLAG_R(RTREG); |
| 643 | 236 | desc->gpr.modified |= REGFLAG_R(RDREG); |
| 644 | | break; |
| 237 | return TRUE; |
| 645 | 238 | |
| 646 | 239 | case 0x0a: /* MOVZ - MIPS IV */ |
| 647 | 240 | case 0x0b: /* MOVN - MIPS IV */ |
| 648 | 241 | if (mips->flavor < MIPS3_TYPE_MIPS_IV) |
| 649 | | { |
| 650 | | invalid_opcode(desc); |
| 651 | | break; |
| 652 | | } |
| 242 | return FALSE; |
| 653 | 243 | desc->gpr.used |= REGFLAG_R(RDREG); |
| 654 | 244 | case 0x04: /* SLLV */ |
| 655 | 245 | case 0x06: /* SRLV */ |
| r1070 | r1071 | |
| 669 | 259 | case 0x2f: /* DSUBU */ |
| 670 | 260 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 671 | 261 | desc->gpr.modified |= REGFLAG_R(RDREG); |
| 672 | | break; |
| 262 | return TRUE; |
| 673 | 263 | |
| 674 | 264 | case 0x20: /* ADD */ |
| 675 | 265 | case 0x22: /* SUB */ |
| r1070 | r1071 | |
| 677 | 267 | case 0x2e: /* DSUB */ |
| 678 | 268 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 679 | 269 | desc->gpr.modified |= REGFLAG_R(RDREG); |
| 680 | | desc->flags |= IDESC_CAN_CAUSE_EXCEPTION; |
| 681 | | break; |
| 270 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 271 | return TRUE; |
| 682 | 272 | |
| 683 | 273 | case 0x30: /* TGE */ |
| 684 | 274 | case 0x31: /* TGEU */ |
| r1070 | r1071 | |
| 687 | 277 | case 0x34: /* TEQ */ |
| 688 | 278 | case 0x36: /* TNE */ |
| 689 | 279 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 690 | | desc->flags |= IDESC_CAN_CAUSE_EXCEPTION; |
| 691 | | break; |
| 280 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 281 | return TRUE; |
| 692 | 282 | |
| 693 | 283 | case 0x01: /* MOVF - MIPS IV */ |
| 694 | 284 | if (mips->flavor < MIPS3_TYPE_MIPS_IV) |
| 695 | | { |
| 696 | | invalid_opcode(desc); |
| 697 | | break; |
| 698 | | } |
| 285 | return FALSE; |
| 699 | 286 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 700 | 287 | desc->fpr.used |= REGFLAG_FCC; |
| 701 | 288 | desc->gpr.modified |= REGFLAG_R(RDREG); |
| 702 | | break; |
| 289 | return TRUE; |
| 703 | 290 | |
| 704 | 291 | case 0x08: /* JR */ |
| 705 | 292 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 706 | | desc->flags |= IDESC_IS_UNCONDITIONAL_BRANCH | IDESC_END_SEQUENCE; |
| 707 | | break; |
| 293 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 294 | desc->delayslots = 1; |
| 295 | return TRUE; |
| 708 | 296 | |
| 709 | 297 | case 0x09: /* JALR */ |
| 710 | 298 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 711 | 299 | desc->gpr.modified |= REGFLAG_R(RDREG); |
| 712 | | desc->flags |= IDESC_IS_UNCONDITIONAL_BRANCH | IDESC_END_SEQUENCE; |
| 713 | | break; |
| 300 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 301 | desc->delayslots = 1; |
| 302 | return TRUE; |
| 714 | 303 | |
| 715 | 304 | case 0x10: /* MFHI */ |
| 716 | 305 | desc->gpr.used |= REGFLAG_HI; |
| 717 | 306 | desc->gpr.modified |= REGFLAG_R(RDREG); |
| 718 | | break; |
| 307 | return TRUE; |
| 719 | 308 | |
| 720 | 309 | case 0x11: /* MTHI */ |
| 721 | 310 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 722 | 311 | desc->gpr.modified |= REGFLAG_HI; |
| 723 | | break; |
| 312 | return TRUE; |
| 724 | 313 | |
| 725 | 314 | case 0x12: /* MFLO */ |
| 726 | 315 | desc->gpr.used |= REGFLAG_LO; |
| 727 | 316 | desc->gpr.modified |= REGFLAG_R(RDREG); |
| 728 | | break; |
| 317 | return TRUE; |
| 729 | 318 | |
| 730 | 319 | case 0x13: /* MTLO */ |
| 731 | 320 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 732 | 321 | desc->gpr.modified |= REGFLAG_LO; |
| 733 | | break; |
| 322 | return TRUE; |
| 734 | 323 | |
| 735 | 324 | case 0x18: /* MULT */ |
| 736 | 325 | case 0x19: /* MULTU */ |
| 737 | 326 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 738 | 327 | desc->gpr.modified |= REGFLAG_LO | REGFLAG_HI; |
| 739 | 328 | desc->cycles = 3; |
| 740 | | break; |
| 329 | return TRUE; |
| 741 | 330 | |
| 742 | 331 | case 0x1a: /* DIV */ |
| 743 | 332 | case 0x1b: /* DIVU */ |
| 744 | 333 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 745 | 334 | desc->gpr.modified |= REGFLAG_LO | REGFLAG_HI; |
| 746 | 335 | desc->cycles = 35; |
| 747 | | break; |
| 336 | return TRUE; |
| 748 | 337 | |
| 749 | 338 | case 0x1c: /* DMULT */ |
| 750 | 339 | case 0x1d: /* DMULTU */ |
| 751 | 340 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 752 | 341 | desc->gpr.modified |= REGFLAG_LO | REGFLAG_HI; |
| 753 | 342 | desc->cycles = 7; |
| 754 | | break; |
| 343 | return TRUE; |
| 755 | 344 | |
| 756 | 345 | case 0x1e: /* DDIV */ |
| 757 | 346 | case 0x1f: /* DDIVU */ |
| 758 | 347 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 759 | 348 | desc->gpr.modified |= REGFLAG_LO | REGFLAG_HI; |
| 760 | 349 | desc->cycles = 67; |
| 761 | | break; |
| 350 | return TRUE; |
| 762 | 351 | |
| 763 | 352 | case 0x0c: /* SYSCALL */ |
| 764 | 353 | case 0x0d: /* BREAK */ |
| 765 | | desc->flags |= IDESC_WILL_CAUSE_EXCEPTION | IDESC_END_SEQUENCE; |
| 766 | | break; |
| 354 | desc->flags |= OPFLAG_WILL_CAUSE_EXCEPTION | OPFLAG_END_SEQUENCE; |
| 355 | return TRUE; |
| 767 | 356 | |
| 768 | 357 | case 0x0f: /* SYNC */ |
| 769 | 358 | /* effective no-op */ |
| 770 | | break; |
| 771 | | |
| 772 | | default: /* anything else */ |
| 773 | | invalid_opcode(desc); |
| 774 | | break; |
| 359 | return TRUE; |
| 775 | 360 | } |
| 361 | |
| 362 | return FALSE; |
| 776 | 363 | } |
| 777 | 364 | |
| 778 | 365 | |
| r1070 | r1071 | |
| 782 | 369 | 'regimm' group |
| 783 | 370 | -------------------------------------------------*/ |
| 784 | 371 | |
| 785 | | static void describe_instruction_regimm(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc) |
| 372 | static int describe_instruction_regimm(mips3_state *mips, UINT32 op, opcode_desc *desc) |
| 786 | 373 | { |
| 787 | 374 | switch (RTREG) |
| 788 | 375 | { |
| 789 | | case 0x02: /* BLTZL */ |
| 790 | | case 0x03: /* BGEZL */ |
| 791 | | desc->flags |= IDESC_IS_LIKELY_BRANCH; |
| 792 | | /* fall through */ |
| 793 | | |
| 794 | 376 | case 0x00: /* BLTZ */ |
| 795 | 377 | case 0x01: /* BGEZ */ |
| 378 | case 0x02: /* BLTZL */ |
| 379 | case 0x03: /* BGEZL */ |
| 796 | 380 | if (RTREG == 0x01 && RSREG == 0) |
| 797 | | desc->flags |= IDESC_IS_UNCONDITIONAL_BRANCH | IDESC_END_SEQUENCE; |
| 381 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 798 | 382 | else |
| 799 | 383 | { |
| 800 | 384 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 801 | | desc->flags |= IDESC_IS_CONDITIONAL_BRANCH; |
| 385 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 802 | 386 | } |
| 803 | | desc->targetpc = pc + 4 + (SIMMVAL << 2); |
| 804 | | break; |
| 387 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| 388 | desc->delayslots = 1; |
| 389 | desc->skipslots = (RTREG & 0x02) ? 1 : 0; |
| 390 | return TRUE; |
| 805 | 391 | |
| 806 | 392 | case 0x08: /* TGEI */ |
| 807 | 393 | case 0x09: /* TGEIU */ |
| r1070 | r1071 | |
| 810 | 396 | case 0x0c: /* TEQI */ |
| 811 | 397 | case 0x0e: /* TNEI */ |
| 812 | 398 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 813 | | desc->flags |= IDESC_CAN_CAUSE_EXCEPTION; |
| 814 | | break; |
| 399 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 400 | return TRUE; |
| 815 | 401 | |
| 816 | | case 0x12: /* BLTZALL */ |
| 817 | | case 0x13: /* BGEZALL */ |
| 818 | | desc->flags |= IDESC_IS_LIKELY_BRANCH; |
| 819 | | /* fall through */ |
| 820 | | |
| 821 | 402 | case 0x10: /* BLTZAL */ |
| 822 | 403 | case 0x11: /* BGEZAL */ |
| 404 | case 0x12: /* BLTZALL */ |
| 405 | case 0x13: /* BGEZALL */ |
| 823 | 406 | if (RTREG == 0x11 && RSREG == 0) |
| 824 | | desc->flags |= IDESC_IS_UNCONDITIONAL_BRANCH | IDESC_END_SEQUENCE; |
| 407 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 825 | 408 | else |
| 826 | 409 | { |
| 827 | 410 | desc->gpr.used |= REGFLAG_R(RSREG); |
| 828 | | desc->flags |= IDESC_IS_CONDITIONAL_BRANCH; |
| 411 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 829 | 412 | } |
| 830 | 413 | desc->gpr.modified |= REGFLAG_R(31); |
| 831 | | desc->targetpc = pc + 4 + (SIMMVAL << 2); |
| 832 | | break; |
| 833 | | |
| 834 | | default: /* anything else */ |
| 835 | | invalid_opcode(desc); |
| 836 | | break; |
| 414 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| 415 | desc->delayslots = 1; |
| 416 | desc->skipslots = (RTREG & 0x02) ? 1 : 0; |
| 417 | return TRUE; |
| 837 | 418 | } |
| 419 | |
| 420 | return FALSE; |
| 838 | 421 | } |
| 839 | 422 | |
| 840 | 423 | |
| r1070 | r1071 | |
| 844 | 427 | IDT-specific group |
| 845 | 428 | -------------------------------------------------*/ |
| 846 | 429 | |
| 847 | | static void describe_instruction_idt(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc) |
| 430 | static int describe_instruction_idt(mips3_state *mips, UINT32 op, opcode_desc *desc) |
| 848 | 431 | { |
| 849 | 432 | switch (op & 0x1f) |
| 850 | 433 | { |
| r1070 | r1071 | |
| 852 | 435 | case 1: /* MADU */ |
| 853 | 436 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG) | REGFLAG_LO | REGFLAG_HI; |
| 854 | 437 | desc->gpr.modified |= REGFLAG_LO | REGFLAG_HI; |
| 855 | | break; |
| 438 | return TRUE; |
| 856 | 439 | |
| 857 | 440 | case 2: /* MUL */ |
| 858 | 441 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 859 | 442 | desc->gpr.modified |= REGFLAG_R(RDREG); |
| 860 | 443 | desc->cycles = 3; |
| 861 | | break; |
| 862 | | |
| 863 | | default: /* anything else */ |
| 864 | | invalid_opcode(desc); |
| 865 | | break; |
| 444 | return TRUE; |
| 866 | 445 | } |
| 446 | |
| 447 | return FALSE; |
| 867 | 448 | } |
| 868 | 449 | |
| 869 | 450 | |
| r1070 | r1071 | |
| 873 | 454 | COP0 group |
| 874 | 455 | -------------------------------------------------*/ |
| 875 | 456 | |
| 876 | | static void describe_instruction_cop0(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc) |
| 457 | static int describe_instruction_cop0(mips3_state *mips, UINT32 op, opcode_desc *desc) |
| 877 | 458 | { |
| 878 | 459 | /* any COP0 instruction can potentially cause an exception */ |
| 879 | | desc->flags |= IDESC_CAN_CAUSE_EXCEPTION; |
| 460 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 880 | 461 | |
| 881 | 462 | switch (RSREG) |
| 882 | 463 | { |
| r1070 | r1071 | |
| 884 | 465 | case 0x01: /* DMFCz */ |
| 885 | 466 | case 0x02: /* CFCz */ |
| 886 | 467 | desc->gpr.modified |= REGFLAG_R(RTREG); |
| 887 | | break; |
| 468 | return TRUE; |
| 888 | 469 | |
| 889 | 470 | case 0x04: /* MTCz */ |
| 890 | 471 | case 0x05: /* DMTCz */ |
| r1070 | r1071 | |
| 893 | 474 | if (RSREG == 0x04 || RSREG == 0x05) |
| 894 | 475 | { |
| 895 | 476 | if (RDREG == COP0_Cause) |
| 896 | | desc->flags |= IDESC_CAN_TRIGGER_SW_INT; |
| 477 | desc->flags |= OPFLAG_CAN_TRIGGER_SW_INT; |
| 897 | 478 | if (RDREG == COP0_Status) |
| 898 | | desc->flags |= IDESC_CAN_EXPOSE_EXTERNAL_INT; |
| 479 | desc->flags |= OPFLAG_CAN_EXPOSE_EXTERNAL_INT | OPFLAG_CAN_CHANGE_MODES | OPFLAG_END_SEQUENCE; |
| 899 | 480 | } |
| 900 | | break; |
| 481 | return TRUE; |
| 901 | 482 | |
| 902 | 483 | case 0x08: /* BC */ |
| 903 | 484 | switch (RTREG) |
| 904 | 485 | { |
| 905 | 486 | case 0x00: /* BCzF */ |
| 906 | 487 | case 0x01: /* BCzT */ |
| 907 | | desc->flags |= IDESC_IS_CONDITIONAL_BRANCH; |
| 908 | | desc->targetpc = pc + 4 + (SIMMVAL << 2); |
| 909 | | break; |
| 910 | | |
| 911 | | default: /* anything else */ |
| 912 | | invalid_opcode(desc); |
| 913 | | break; |
| 488 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 489 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| 490 | desc->delayslots = 1; |
| 491 | return TRUE; |
| 914 | 492 | } |
| 915 | | break; |
| 493 | return FALSE; |
| 916 | 494 | |
| 917 | 495 | case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: |
| 918 | 496 | case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f: /* COP */ |
| r1070 | r1071 | |
| 921 | 499 | case 0x01: /* TLBR */ |
| 922 | 500 | case 0x08: /* TLBP */ |
| 923 | 501 | case 0x20: /* WAIT */ |
| 924 | | break; |
| 502 | return TRUE; |
| 925 | 503 | |
| 926 | 504 | case 0x02: /* TLBWI */ |
| 927 | 505 | case 0x06: /* TLBWR */ |
| 928 | | desc->flags |= IDESC_MODIFIES_TRANSLATION; |
| 929 | | break; |
| 506 | desc->flags |= OPFLAG_MODIFIES_TRANSLATION; |
| 507 | return TRUE; |
| 930 | 508 | |
| 931 | 509 | case 0x18: /* ERET */ |
| 932 | | desc->flags |= IDESC_IS_UNCONDITIONAL_BRANCH | IDESC_END_SEQUENCE; |
| 933 | | break; |
| 934 | | |
| 935 | | default: /* anything else */ |
| 936 | | invalid_opcode(desc); |
| 937 | | break; |
| 510 | desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE; |
| 511 | return TRUE; |
| 938 | 512 | } |
| 939 | | break; |
| 940 | | |
| 941 | | default: /* anything else */ |
| 942 | | invalid_opcode(desc); |
| 943 | | break; |
| 513 | return FALSE; |
| 944 | 514 | } |
| 515 | |
| 516 | return FALSE; |
| 945 | 517 | } |
| 946 | 518 | |
| 947 | 519 | |
| r1070 | r1071 | |
| 951 | 523 | COP1 group |
| 952 | 524 | -------------------------------------------------*/ |
| 953 | 525 | |
| 954 | | static void describe_instruction_cop1(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc) |
| 526 | static int describe_instruction_cop1(mips3_state *mips, UINT32 op, opcode_desc *desc) |
| 955 | 527 | { |
| 956 | 528 | /* any COP1 instruction can potentially cause an exception */ |
| 957 | | // desc->flags |= IDESC_CAN_CAUSE_EXCEPTION; |
| 529 | // desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 958 | 530 | |
| 959 | 531 | switch (RSREG) |
| 960 | 532 | { |
| r1070 | r1071 | |
| 962 | 534 | case 0x01: /* DMFCz */ |
| 963 | 535 | desc->fpr.used |= REGFLAG_CPR1(RDREG); |
| 964 | 536 | desc->gpr.modified |= REGFLAG_R(RTREG); |
| 965 | | break; |
| 537 | return TRUE; |
| 966 | 538 | |
| 967 | 539 | case 0x02: /* CFCz */ |
| 968 | 540 | desc->gpr.modified |= REGFLAG_R(RTREG); |
| 969 | | break; |
| 541 | return TRUE; |
| 970 | 542 | |
| 971 | 543 | case 0x04: /* MTCz */ |
| 972 | 544 | case 0x05: /* DMTCz */ |
| 973 | 545 | desc->gpr.used |= REGFLAG_R(RTREG); |
| 974 | 546 | desc->fpr.modified |= REGFLAG_CPR1(RDREG); |
| 975 | | break; |
| 547 | return TRUE; |
| 976 | 548 | |
| 977 | 549 | case 0x06: /* CTCz */ |
| 978 | 550 | desc->gpr.used |= REGFLAG_R(RTREG); |
| 979 | | break; |
| 551 | return TRUE; |
| 980 | 552 | |
| 981 | 553 | case 0x08: /* BC */ |
| 982 | | switch (RTREG) |
| 554 | switch (RTREG & 3) |
| 983 | 555 | { |
| 984 | | case 0x02: /* BCzFL */ |
| 985 | | case 0x03: /* BCzTL */ |
| 986 | | desc->flags |= IDESC_IS_LIKELY_BRANCH; |
| 987 | | /* fall through */ |
| 988 | | |
| 989 | 556 | case 0x00: /* BCzF */ |
| 990 | 557 | case 0x01: /* BCzT */ |
| 558 | case 0x02: /* BCzFL */ |
| 559 | case 0x03: /* BCzTL */ |
| 991 | 560 | desc->fpr.used |= REGFLAG_FCC; |
| 992 | | desc->flags |= IDESC_IS_CONDITIONAL_BRANCH; |
| 993 | | desc->targetpc = pc + 4 + (SIMMVAL << 2); |
| 994 | | break; |
| 995 | | |
| 996 | | default: /* anything else */ |
| 997 | | invalid_opcode(desc); |
| 998 | | break; |
| 561 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 562 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| 563 | desc->delayslots = 1; |
| 564 | desc->skipslots = (RTREG & 0x02) ? 1 : 0; |
| 565 | return TRUE; |
| 999 | 566 | } |
| 1000 | | break; |
| 567 | return FALSE; |
| 1001 | 568 | |
| 1002 | 569 | case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: |
| 1003 | 570 | case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f: /* COP */ |
| r1070 | r1071 | |
| 1006 | 573 | case 0x12: /* MOVZ - MIPS IV */ |
| 1007 | 574 | case 0x13: /* MOVN - MIPS IV */ |
| 1008 | 575 | if (mips->flavor < MIPS3_TYPE_MIPS_IV) |
| 1009 | | { |
| 1010 | | invalid_opcode(desc); |
| 1011 | | break; |
| 1012 | | } |
| 576 | return FALSE; |
| 1013 | 577 | case 0x00: /* ADD */ |
| 1014 | 578 | case 0x01: /* SUB */ |
| 1015 | 579 | case 0x02: /* MUL */ |
| 1016 | 580 | case 0x03: /* DIV */ |
| 1017 | 581 | desc->fpr.used |= REGFLAG_CPR1(FSREG) | REGFLAG_CPR1(FTREG); |
| 1018 | 582 | desc->fpr.modified |= REGFLAG_CPR1(FDREG); |
| 1019 | | break; |
| 583 | return TRUE; |
| 1020 | 584 | |
| 1021 | 585 | case 0x15: /* RECIP - MIPS IV */ |
| 1022 | 586 | case 0x16: /* RSQRT - MIPS IV */ |
| 1023 | 587 | if (mips->flavor < MIPS3_TYPE_MIPS_IV) |
| 1024 | | { |
| 1025 | | invalid_opcode(desc); |
| 1026 | | break; |
| 1027 | | } |
| 588 | return FALSE; |
| 1028 | 589 | case 0x04: /* SQRT */ |
| 1029 | 590 | case 0x05: /* ABS */ |
| 1030 | 591 | case 0x06: /* MOV */ |
| r1070 | r1071 | |
| 1043 | 604 | case 0x25: /* CVT.L */ |
| 1044 | 605 | desc->fpr.used |= REGFLAG_CPR1(FSREG); |
| 1045 | 606 | desc->fpr.modified |= REGFLAG_CPR1(FDREG); |
| 1046 | | break; |
| 607 | return TRUE; |
| 1047 | 608 | |
| 1048 | 609 | case 0x11: /* MOVT/F - MIPS IV */ |
| 1049 | 610 | if (mips->flavor < MIPS3_TYPE_MIPS_IV) |
| 1050 | | { |
| 1051 | | invalid_opcode(desc); |
| 1052 | | break; |
| 1053 | | } |
| 611 | return FALSE; |
| 1054 | 612 | desc->fpr.used |= REGFLAG_CPR1(FSREG) | REGFLAG_FCC; |
| 1055 | 613 | desc->fpr.modified |= REGFLAG_CPR1(FDREG); |
| 1056 | | break; |
| 614 | return TRUE; |
| 1057 | 615 | |
| 1058 | 616 | case 0x30: case 0x38: /* C.F */ |
| 1059 | 617 | case 0x31: case 0x39: /* C.UN */ |
| 1060 | 618 | desc->fpr.modified |= REGFLAG_FCC; |
| 1061 | | break; |
| 619 | return TRUE; |
| 1062 | 620 | |
| 1063 | 621 | case 0x32: case 0x3a: /* C.EQ */ |
| 1064 | 622 | case 0x33: case 0x3b: /* C.UEQ */ |
| r1070 | r1071 | |
| 1068 | 626 | case 0x37: case 0x3f: /* C.ULE */ |
| 1069 | 627 | desc->fpr.used |= REGFLAG_CPR1(FSREG) | REGFLAG_CPR1(FTREG); |
| 1070 | 628 | desc->fpr.modified |= REGFLAG_FCC; |
| 1071 | | break; |
| 1072 | | |
| 1073 | | default: /* anything else */ |
| 1074 | | invalid_opcode(desc); |
| 1075 | | break; |
| 629 | return TRUE; |
| 1076 | 630 | } |
| 1077 | | break; |
| 1078 | | |
| 1079 | | default: /* anything else */ |
| 1080 | | invalid_opcode(desc); |
| 1081 | | break; |
| 631 | return FALSE; |
| 1082 | 632 | } |
| 633 | |
| 634 | return FALSE; |
| 1083 | 635 | } |
| 1084 | 636 | |
| 1085 | 637 | |
| r1070 | r1071 | |
| 1089 | 641 | COP1X group |
| 1090 | 642 | -------------------------------------------------*/ |
| 1091 | 643 | |
| 1092 | | static void describe_instruction_cop1x(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc) |
| 644 | static int describe_instruction_cop1x(mips3_state *mips, UINT32 op, opcode_desc *desc) |
| 1093 | 645 | { |
| 1094 | 646 | /* any COP1 instruction can potentially cause an exception */ |
| 1095 | | // desc->flags |= IDESC_CAN_CAUSE_EXCEPTION; |
| 647 | // desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 1096 | 648 | |
| 1097 | 649 | switch (op & 0x3f) |
| 1098 | 650 | { |
| r1070 | r1071 | |
| 1100 | 652 | case 0x01: /* LDXC1 */ |
| 1101 | 653 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 1102 | 654 | desc->fpr.modified |= REGFLAG_CPR1(FDREG); |
| 1103 | | desc->flags |= IDESC_READS_MEMORY; |
| 1104 | | break; |
| 655 | desc->flags |= OPFLAG_READS_MEMORY; |
| 656 | return TRUE; |
| 1105 | 657 | |
| 1106 | | case 0x02: /* SWXC1 */ |
| 1107 | | case 0x03: /* SDXC1 */ |
| 658 | case 0x08: /* SWXC1 */ |
| 659 | case 0x09: /* SDXC1 */ |
| 1108 | 660 | desc->gpr.used |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG); |
| 1109 | 661 | desc->fpr.used |= REGFLAG_CPR1(FDREG); |
| 1110 | | desc->flags |= IDESC_WRITES_MEMORY; |
| 1111 | | break; |
| 662 | desc->flags |= OPFLAG_WRITES_MEMORY; |
| 663 | return TRUE; |
| 1112 | 664 | |
| 1113 | 665 | case 0x0f: /* PREFX */ |
| 1114 | 666 | /* effective no-op */ |
| 1115 | | break; |
| 667 | return TRUE; |
| 1116 | 668 | |
| 1117 | 669 | case 0x20: case 0x21: /* MADD */ |
| 1118 | 670 | case 0x28: case 0x29: /* MSUB */ |
| 1119 | 671 | case 0x30: case 0x31: /* NMADD */ |
| 1120 | | case 0x32: case 0x39: /* NMSUB */ |
| 672 | case 0x38: case 0x39: /* NMSUB */ |
| 1121 | 673 | desc->fpr.used |= REGFLAG_CPR1(FSREG) | REGFLAG_CPR1(FTREG) | REGFLAG_CPR1(FRREG); |
| 1122 | 674 | desc->fpr.modified |= REGFLAG_CPR1(FDREG); |
| 1123 | | break; |
| 1124 | | |
| 1125 | | default: /* anything else */ |
| 1126 | | invalid_opcode(desc); |
| 1127 | | break; |
| 675 | return TRUE; |
| 1128 | 676 | } |
| 677 | |
| 678 | return FALSE; |
| 1129 | 679 | } |
| 1130 | 680 | |
| 1131 | 681 | |
| r1070 | r1071 | |
| 1135 | 685 | COP2 group |
| 1136 | 686 | -------------------------------------------------*/ |
| 1137 | 687 | |
| 1138 | | static void describe_instruction_cop2(mips3_state *mips, UINT32 pc, UINT32 op, mips3_opcode_desc *desc) |
| 688 | static int describe_instruction_cop2(mips3_state *mips, UINT32 op, opcode_desc *desc) |
| 1139 | 689 | { |
| 1140 | 690 | /* any COP2 instruction can potentially cause an exception */ |
| 1141 | | desc->flags |= IDESC_CAN_CAUSE_EXCEPTION; |
| 691 | desc->flags |= OPFLAG_CAN_CAUSE_EXCEPTION; |
| 1142 | 692 | |
| 1143 | 693 | switch (RSREG) |
| 1144 | 694 | { |
| r1070 | r1071 | |
| 1146 | 696 | case 0x01: /* DMFCz */ |
| 1147 | 697 | case 0x02: /* CFCz */ |
| 1148 | 698 | desc->gpr.modified |= REGFLAG_R(RTREG); |
| 1149 | | break; |
| 699 | return TRUE; |
| 1150 | 700 | |
| 1151 | 701 | case 0x04: /* MTCz */ |
| 1152 | 702 | case 0x05: /* DMTCz */ |
| 1153 | 703 | case 0x06: /* CTCz */ |
| 1154 | 704 | desc->gpr.used |= REGFLAG_R(RTREG); |
| 1155 | | break; |
| 705 | return TRUE; |
| 1156 | 706 | |
| 1157 | 707 | case 0x08: /* BC */ |
| 1158 | 708 | switch (RTREG) |
| 1159 | 709 | { |
| 1160 | 710 | case 0x00: /* BCzF */ |
| 1161 | 711 | case 0x01: /* BCzT */ |
| 1162 | | desc->flags |= IDESC_IS_CONDITIONAL_BRANCH; |
| 1163 | | desc->targetpc = pc + 4 + (SIMMVAL << 2); |
| 1164 | | break; |
| 1165 | | |
| 1166 | | default: /* anything else */ |
| 1167 | | invalid_opcode(desc); |
| 1168 | | break; |
| 712 | desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH; |
| 713 | desc->targetpc = desc->pc + 4 + (SIMMVAL << 2); |
| 714 | desc->delayslots = 1; |
| 715 | return TRUE; |
| 1169 | 716 | } |
| 1170 | | break; |
| 1171 | | |
| 1172 | | default: /* anything else */ |
| 1173 | | invalid_opcode(desc); |
| 1174 | | break; |
| 717 | return FALSE; |
| 1175 | 718 | } |
| 719 | |
| 720 | return FALSE; |
| 1176 | 721 | } |