trunk/src/mame/video/tc0150rod.c
| r29458 | r29459 | |
| 11 | 11 | |
| 12 | 12 | #define TC0150ROD_RAM_SIZE 0x2000 |
| 13 | 13 | |
| 14 | | |
| 15 | | |
| 16 | 14 | const device_type TC0150ROD = &device_creator<tc0150rod_device>; |
| 17 | 15 | |
| 18 | 16 | tc0150rod_device::tc0150rod_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| r29458 | r29459 | |
| 22 | 20 | } |
| 23 | 21 | |
| 24 | 22 | //------------------------------------------------- |
| 25 | | // device_config_complete - perform any |
| 26 | | // operations now that the configuration is |
| 27 | | // complete |
| 28 | | //------------------------------------------------- |
| 29 | | |
| 30 | | void tc0150rod_device::device_config_complete() |
| 31 | | { |
| 32 | | // inherit a copy of the static data |
| 33 | | const tc0150rod_interface *intf = reinterpret_cast<const tc0150rod_interface *>(static_config()); |
| 34 | | if (intf != NULL) |
| 35 | | *static_cast<tc0150rod_interface *>(this) = *intf; |
| 36 | | |
| 37 | | // or initialize to defaults if none provided |
| 38 | | else |
| 39 | | { |
| 40 | | } |
| 41 | | } |
| 42 | | |
| 43 | | //------------------------------------------------- |
| 44 | 23 | // device_start - device-specific startup |
| 45 | 24 | //------------------------------------------------- |
| 46 | 25 | |
| 47 | 26 | void tc0150rod_device::device_start() |
| 48 | 27 | { |
| 49 | 28 | m_ram = auto_alloc_array_clear(machine(), UINT16, TC0150ROD_RAM_SIZE / 2); |
| 50 | | |
| 51 | 29 | save_pointer(NAME(m_ram), TC0150ROD_RAM_SIZE / 2); |
| 30 | |
| 31 | m_roadgfx = (UINT16 *)machine().root_device().memregion(m_gfx_region)->base(); |
| 32 | assert(m_roadgfx); |
| 52 | 33 | } |
| 53 | 34 | |
| 54 | 35 | |
| r29458 | r29459 | |
| 240 | 221 | UINT16 roada_line[512], roadb_line[512]; |
| 241 | 222 | UINT16 *dst16; |
| 242 | 223 | UINT16 *roada, *roadb; |
| 243 | | UINT16 *roadgfx = (UINT16 *)machine().root_device().memregion(m_gfx_region)->base(); |
| 244 | 224 | |
| 245 | 225 | UINT16 pixel, color, gfx_word; |
| 246 | 226 | UINT16 roada_clipl, roada_clipr, roada_bodyctrl; |
| r29458 | r29459 | |
| 434 | 414 | { |
| 435 | 415 | if (road_gfx_tilenum) /* fixes Nightstr round C */ |
| 436 | 416 | { |
| 437 | | gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 417 | gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 438 | 418 | pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1); |
| 439 | 419 | |
| 440 | 420 | if ((pixel) || !(road_trans)) |
| r29458 | r29459 | |
| 485 | 465 | { |
| 486 | 466 | for (i = left_edge; i >= 0; i--) |
| 487 | 467 | { |
| 488 | | gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 468 | gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 489 | 469 | pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1); |
| 490 | 470 | |
| 491 | 471 | pixpri = (pixel == 0) ? (0) : (pri); /* off edge has low priority */ |
| r29458 | r29459 | |
| 528 | 508 | { |
| 529 | 509 | for (i = right_edge; i < screen_width; i++) |
| 530 | 510 | { |
| 531 | | gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 511 | gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 532 | 512 | pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1); |
| 533 | 513 | |
| 534 | 514 | pixpri = (pixel == 0) ? (0) : (pri); /* off edge has low priority */ |
| r29458 | r29459 | |
| 642 | 622 | { |
| 643 | 623 | for (i = begin; i < end; i++) |
| 644 | 624 | { |
| 645 | | gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 625 | gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 646 | 626 | pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1); |
| 647 | 627 | |
| 648 | 628 | if ((pixel) || !(road_trans)) |
| r29458 | r29459 | |
| 692 | 672 | { |
| 693 | 673 | for (i = left_edge; i >= 0; i--) |
| 694 | 674 | { |
| 695 | | gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 675 | gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 696 | 676 | pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1); |
| 697 | 677 | |
| 698 | 678 | pixpri = (pixel == 0) ? (0) : (pri); /* off edge has low priority */ |
| r29458 | r29459 | |
| 735 | 715 | { |
| 736 | 716 | for (i = right_edge; i < screen_width; i++) |
| 737 | 717 | { |
| 738 | | gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 718 | gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)]; |
| 739 | 719 | pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1); |
| 740 | 720 | |
| 741 | 721 | pixpri = (pixel == 0) ? (0) : (pri); /* off edge has low priority */ |
trunk/src/mame/video/tc0150rod.h
| r29458 | r29459 | |
| 1 | 1 | #ifndef __TC0150ROD_H__ |
| 2 | 2 | #define __TC0150ROD_H__ |
| 3 | 3 | |
| 4 | | struct tc0150rod_interface |
| 4 | class tc0150rod_device : public device_t |
| 5 | 5 | { |
| 6 | | const char *m_gfx_region; /* gfx region for the road */ |
| 7 | | }; |
| 8 | | |
| 9 | | class tc0150rod_device : public device_t, |
| 10 | | public tc0150rod_interface |
| 11 | | { |
| 12 | 6 | public: |
| 13 | 7 | tc0150rod_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 14 | 8 | ~tc0150rod_device() {} |
| 15 | 9 | |
| 10 | static void set_gfx_tag(device_t &device, const char *tag) { downcast<tc0150rod_device &>(device).m_gfx_region = tag; } |
| 11 | |
| 16 | 12 | DECLARE_READ16_MEMBER( word_r ); |
| 17 | 13 | DECLARE_WRITE16_MEMBER( word_w ); |
| 18 | 14 | void draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs, int palette_offs, int type, int road_trans, bitmap_ind8 &priority_bitmap, UINT32 low_priority, UINT32 high_priority); |
| 19 | 15 | |
| 20 | 16 | protected: |
| 21 | 17 | // device-level overrides |
| 22 | | virtual void device_config_complete(); |
| 23 | 18 | virtual void device_start(); |
| 24 | 19 | |
| 25 | 20 | private: |
| 26 | 21 | // internal state |
| 27 | 22 | UINT16 * m_ram; |
| 23 | const char *m_gfx_region; /* gfx region for the road */ |
| 24 | UINT16 * m_roadgfx; |
| 28 | 25 | }; |
| 29 | 26 | |
| 30 | 27 | extern const device_type TC0150ROD; |
| 31 | 28 | |
| 32 | | #define MCFG_TC0150ROD_ADD(_tag, _interface) \ |
| 33 | | MCFG_DEVICE_ADD(_tag, TC0150ROD, 0) \ |
| 34 | | MCFG_DEVICE_CONFIG(_interface) |
| 35 | 29 | |
| 30 | #define MCFG_TC0150ROD_GFXTAG(_tag) \ |
| 31 | tc0150rod_device::set_gfx_tag(*device, _tag); |
| 32 | |
| 36 | 33 | #endif |
trunk/src/mame/drivers/taito_z.c
| r29458 | r29459 | |
| 2994 | 2994 | }; |
| 2995 | 2995 | |
| 2996 | 2996 | |
| 2997 | | static const tc0150rod_interface taitoz_tc0150rod_intf = { "gfx3" }; |
| 2998 | | |
| 2999 | 2997 | /*********************************************************** |
| 3000 | 2998 | SAVE STATES |
| 3001 | 2999 | ***********************************************************/ |
| r29458 | r29459 | |
| 3081 | 3079 | MCFG_TC0100SCN_GFXDECODE("gfxdecode") |
| 3082 | 3080 | MCFG_TC0100SCN_PALETTE("palette") |
| 3083 | 3081 | |
| 3084 | | MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf) |
| 3082 | MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0) |
| 3083 | MCFG_TC0150ROD_GFXTAG("gfx3") |
| 3084 | |
| 3085 | 3085 | MCFG_TC0110PCR_ADD("tc0110pcr") |
| 3086 | 3086 | MCFG_TC0110PCR_PALETTE("palette") |
| 3087 | 3087 | |
| r29458 | r29459 | |
| 3156 | 3156 | MCFG_TC0100SCN_GFXDECODE("gfxdecode") |
| 3157 | 3157 | MCFG_TC0100SCN_PALETTE("palette") |
| 3158 | 3158 | |
| 3159 | | MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf) |
| 3159 | MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0) |
| 3160 | MCFG_TC0150ROD_GFXTAG("gfx3") |
| 3161 | |
| 3160 | 3162 | MCFG_TC0110PCR_ADD("tc0110pcr") |
| 3161 | 3163 | MCFG_TC0110PCR_PALETTE("palette") |
| 3162 | 3164 | |
| r29458 | r29459 | |
| 3233 | 3235 | MCFG_TC0100SCN_GFXDECODE("gfxdecode") |
| 3234 | 3236 | MCFG_TC0100SCN_PALETTE("palette") |
| 3235 | 3237 | |
| 3236 | | MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf) |
| 3238 | MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0) |
| 3239 | MCFG_TC0150ROD_GFXTAG("gfx3") |
| 3240 | |
| 3237 | 3241 | MCFG_TC0110PCR_ADD("tc0110pcr") |
| 3238 | 3242 | MCFG_TC0110PCR_PALETTE("palette") |
| 3239 | 3243 | |
| r29458 | r29459 | |
| 3306 | 3310 | MCFG_TC0100SCN_GFXDECODE("gfxdecode") |
| 3307 | 3311 | MCFG_TC0100SCN_PALETTE("palette") |
| 3308 | 3312 | |
| 3309 | | MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf) |
| 3313 | MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0) |
| 3314 | MCFG_TC0150ROD_GFXTAG("gfx3") |
| 3310 | 3315 | |
| 3311 | 3316 | /* sound hardware */ |
| 3312 | 3317 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| r29458 | r29459 | |
| 3385 | 3390 | MCFG_TC0100SCN_GFXDECODE("gfxdecode") |
| 3386 | 3391 | MCFG_TC0100SCN_PALETTE("palette") |
| 3387 | 3392 | |
| 3388 | | MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf) |
| 3393 | MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0) |
| 3394 | MCFG_TC0150ROD_GFXTAG("gfx3") |
| 3389 | 3395 | |
| 3390 | 3396 | /* sound hardware */ |
| 3391 | 3397 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| r29458 | r29459 | |
| 3459 | 3465 | MCFG_TC0100SCN_GFXDECODE("gfxdecode") |
| 3460 | 3466 | MCFG_TC0100SCN_PALETTE("palette") |
| 3461 | 3467 | |
| 3462 | | MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf) |
| 3468 | MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0) |
| 3469 | MCFG_TC0150ROD_GFXTAG("gfx3") |
| 3470 | |
| 3463 | 3471 | MCFG_TC0110PCR_ADD("tc0110pcr") |
| 3464 | 3472 | MCFG_TC0110PCR_PALETTE("palette") |
| 3465 | 3473 | |
| r29458 | r29459 | |
| 3536 | 3544 | MCFG_TC0100SCN_GFXDECODE("gfxdecode") |
| 3537 | 3545 | MCFG_TC0100SCN_PALETTE("palette") |
| 3538 | 3546 | |
| 3539 | | MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf) |
| 3547 | MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0) |
| 3548 | MCFG_TC0150ROD_GFXTAG("gfx3") |
| 3549 | |
| 3540 | 3550 | MCFG_TC0110PCR_ADD("tc0110pcr") |
| 3541 | 3551 | MCFG_TC0110PCR_PALETTE("palette") |
| 3542 | 3552 | |
| r29458 | r29459 | |
| 3679 | 3689 | MCFG_TC0480SCP_GFXDECODE("gfxdecode") |
| 3680 | 3690 | MCFG_TC0480SCP_PALETTE("palette") |
| 3681 | 3691 | |
| 3682 | | MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf) |
| 3692 | MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0) |
| 3693 | MCFG_TC0150ROD_GFXTAG("gfx3") |
| 3683 | 3694 | |
| 3684 | 3695 | /* sound hardware */ |
| 3685 | 3696 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| r29458 | r29459 | |
| 3752 | 3763 | MCFG_TC0480SCP_GFXDECODE("gfxdecode") |
| 3753 | 3764 | MCFG_TC0480SCP_PALETTE("palette") |
| 3754 | 3765 | |
| 3755 | | MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf) |
| 3766 | MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0) |
| 3767 | MCFG_TC0150ROD_GFXTAG("gfx3") |
| 3756 | 3768 | |
| 3757 | 3769 | /* sound hardware */ |
| 3758 | 3770 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |