Previous 199869 Revisions Next

r31475 Wednesday 30th July, 2014 at 20:35:53 UTC by hap
fix prev commit again + removed unneeded class member names prefixes
[src/emu/video]epic12.c epic12.h epic12in.inc
[src/mame/drivers]cv1k.c

trunk/src/mame/drivers/cv1k.c
r31474r31475
349349   AM_RANGE(SH3_PORT_E, SH3_PORT_E+7) AM_READ( cv1k_flash_port_e_r )
350350   AM_RANGE(SH3_PORT_F, SH3_PORT_F+7) AM_READ_PORT("PORT_F")
351351   AM_RANGE(SH3_PORT_L, SH3_PORT_L+7) AM_READ_PORT("PORT_L")
352   AM_RANGE(SH3_PORT_J, SH3_PORT_J+7) AM_DEVREADWRITE( "blitter", epic12_device, epic12_device_fpga_r, epic12_device_fpga_w )
352   AM_RANGE(SH3_PORT_J, SH3_PORT_J+7) AM_DEVREADWRITE( "blitter", epic12_device, fpga_r, fpga_w )
353353ADDRESS_MAP_END
354354
355355
trunk/src/emu/video/epic12in.inc
r31474r31475
1/* blitter function */
12
2
3
43const void epic12_device::FUNCNAME(BLIT_PARAMS)
54{
65   UINT32* gfx2;
trunk/src/emu/video/epic12.c
r31474r31475
1313{
1414   m_is_unsafe = 0;
1515   m_delay_scale = 0;
16   m_maincpu = 0;
17   queue = 0;
18   blitter_request = 0;
19   epic12_device_blitter_delay_timer = 0;
20   blitter_busy = 0;
21   use_ram = 0;
22   epic12_device_ram16 = 0;
23   epic12_device_gfx_addr = 0;
24   epic12_device_gfx_scroll_0_x = 0;
25   epic12_device_gfx_scroll_0_y = 0;
26   epic12_device_gfx_scroll_1_x = 0;
27   epic12_device_gfx_scroll_1_y = 0;
28   epic12_device_gfx_size = 0;
29   epic12_device_gfx_addr_shadowcopy = 0;
30   epic12_device_gfx_scroll_0_x_shadowcopy = 0;
31   epic12_device_gfx_scroll_0_y_shadowcopy = 0;
32   epic12_device_gfx_scroll_1_x_shadowcopy = 0;
33   epic12_device_gfx_scroll_1_y_shadowcopy = 0;
34   epic12_device_ram16_copy = 0;
16   m_blitter_request = 0;
17   m_blitter_delay_timer = 0;
18   m_blitter_busy = 0;
19   m_gfx_addr = 0;
20   m_gfx_scroll_0_x = 0;
21   m_gfx_scroll_0_y = 0;
22   m_gfx_scroll_1_x = 0;
23   m_gfx_scroll_1_y = 0;
24   m_gfx_addr_shadowcopy = 0;
25   m_gfx_scroll_0_x_shadowcopy = 0;
26   m_gfx_scroll_0_y_shadowcopy = 0;
27   m_gfx_scroll_1_x_shadowcopy = 0;
28   m_gfx_scroll_1_y_shadowcopy = 0;
3529   epic12_device_blit_delay = 0;
3630}
3731
38TIMER_CALLBACK_MEMBER( epic12_device::epic12_device_blitter_delay_callback )
32TIMER_CALLBACK_MEMBER( epic12_device::blitter_delay_callback )
3933{
40   blitter_busy = 0;
34   m_blitter_busy = 0;
4135}
4236
4337
4438void epic12_device::device_start()
4539{
46   epic12_device_gfx_size = 0x2000 * 0x1000;
47   epic12_device_bitmaps = auto_bitmap_rgb32_alloc(machine(), 0x2000, 0x1000);
48   epic12_device_clip = epic12_device_bitmaps->cliprect();
49   epic12_device_clip.set(0, 0x2000-1, 0, 0x1000-1);
40   m_gfx_size = 0x2000 * 0x1000;
41   m_bitmaps = auto_bitmap_rgb32_alloc(machine(), 0x2000, 0x1000);
42   m_clip = m_bitmaps->cliprect();
43   m_clip.set(0, 0x2000-1, 0, 0x1000-1);
5044   
51   epic12_device_ram16_copy = auto_alloc_array(machine(), UINT16, m_main_ramsize/2);
45   m_ram16_copy = auto_alloc_array(machine(), UINT16, m_main_ramsize/2);
5246
53   epic12_device_blitter_delay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(epic12_device::epic12_device_blitter_delay_callback),this));
54   epic12_device_blitter_delay_timer->adjust(attotime::never);
47   m_blitter_delay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(epic12_device::blitter_delay_callback),this));
48   m_blitter_delay_timer->adjust(attotime::never);
5549}
5650
5751void epic12_device::device_reset()
5852{
5953   if (m_is_unsafe)
6054   {
61      use_ram = epic12_device_ram16;
62      queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_HIGH_FREQ|WORK_QUEUE_FLAG_MULTI);
55      m_use_ram = m_ram16;
56      m_work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_HIGH_FREQ|WORK_QUEUE_FLAG_MULTI);
6357   }
6458   else
6559   {
66      use_ram = epic12_device_ram16_copy; // slow mode
67      queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_HIGH_FREQ);
60      m_use_ram = m_ram16_copy; // slow mode
61      m_work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_HIGH_FREQ);
6862   }
6963
70
7164   // cache table to avoid divides in blit code, also pre-clamped
7265   int x,y;
7366   for (y=0;y<0x40;y++)
r31474r31475
9285      }
9386   }
9487
95   blitter_busy = 0;
96
88   m_blitter_busy = 0;
9789}
9890
9991// todo, get these into the device class without ruining performance
r31474r31475
10597inline UINT16 epic12_device::READ_NEXT_WORD(offs_t *addr)
10698{
10799//  UINT16 data = space.read_word(*addr); // going through the memory system is 'more correct' but noticably slower
108   UINT16 data = use_ram[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)];
100   UINT16 data = m_use_ram[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)];
109101
110102   *addr += 2;
111103
r31474r31475
116108inline UINT16 epic12_device::COPY_NEXT_WORD(address_space &space, offs_t *addr)
117109{
118110//  UINT16 data = space.read_word(*addr); // going through the memory system is 'more correct' but noticably slower
119   UINT16 data = epic12_device_ram16[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)];
120   epic12_device_ram16_copy[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)] = data;
111   UINT16 data = m_ram16[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)];
112   m_ram16_copy[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)] = data;
121113
122114   *addr += 2;
123115
r31474r31475
126118}
127119
128120
129inline void epic12_device::epic12_device_gfx_upload_shadow_copy(address_space &space, offs_t *addr)
121inline void epic12_device::gfx_upload_shadow_copy(address_space &space, offs_t *addr)
130122{
131123   UINT32 x,y, dimx,dimy;
132124   COPY_NEXT_WORD(space, addr);
r31474r31475
148140   }
149141}
150142
151inline void epic12_device::epic12_device_gfx_upload(offs_t *addr)
143inline void epic12_device::gfx_upload(offs_t *addr)
152144{
153145   UINT32 x,y, dst_p,dst_x_start,dst_y_start, dimx,dimy;
154146   UINT32 *dst;
r31474r31475
175167
176168   for (y = 0; y < dimy; y++)
177169   {
178      dst = &epic12_device_bitmaps->pix(dst_y_start + y, 0);
170      dst = &m_bitmaps->pix(dst_y_start + y, 0);
179171      dst += dst_x_start;
180172
181173      for (x = 0; x < dimx; x++)
r31474r31475
191183   }
192184}
193185
194#define draw_params epic12_device_bitmaps, &epic12_device_clip, &epic12_device_bitmaps->pix(0,0),src_x,src_y, x,y, dimx,dimy, flipy, s_alpha, d_alpha, &tint_clr
186#define draw_params m_bitmaps, &m_clip, &m_bitmaps->pix(0,0),src_x,src_y, x,y, dimx,dimy, flipy, s_alpha, d_alpha, &tint_clr
195187
196188
197189
r31474r31475
295287
296288
297289
298inline void epic12_device::epic12_device_gfx_draw_shadow_copy(address_space &space, offs_t *addr)
290inline void epic12_device::gfx_draw_shadow_copy(address_space &space, offs_t *addr)
299291{
300292   COPY_NEXT_WORD(space, addr);
301293   COPY_NEXT_WORD(space, addr);
r31474r31475
317309
318310
319311
320inline void epic12_device::epic12_device_gfx_draw(offs_t *addr)
312inline void epic12_device::gfx_draw(offs_t *addr)
321313{
322314   int x,y, dimx,dimy, flipx,flipy;//, src_p;
323315   int trans,blend, s_mode, d_mode;
r31474r31475
533525}
534526
535527
536void epic12_device::epic12_device_gfx_create_shadow_copy(address_space &space)
528void epic12_device::gfx_create_shadow_copy(address_space &space)
537529{
538   offs_t addr = epic12_device_gfx_addr & 0x1fffffff;
539   epic12_device_clip.set(epic12_device_gfx_scroll_1_x_shadowcopy, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y_shadowcopy, epic12_device_clip.min_y + 240-1);
530   offs_t addr = m_gfx_addr & 0x1fffffff;
531   m_clip.set(m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_x_shadowcopy + 320-1, m_gfx_scroll_1_y_shadowcopy, m_gfx_scroll_1_y_shadowcopy + 240-1);
540532
541533   while (1)
542534   {
r31474r31475
550542
551543         case 0xc000:
552544            if (COPY_NEXT_WORD(space, &addr)) // cliptype
553               epic12_device_clip.set(epic12_device_gfx_scroll_1_x_shadowcopy, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y_shadowcopy, epic12_device_clip.min_y + 240-1);
545               m_clip.set(m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_x_shadowcopy + 320-1, m_gfx_scroll_1_y_shadowcopy, m_gfx_scroll_1_y_shadowcopy + 240-1);
554546            else
555               epic12_device_clip.set(0, 0x2000-1, 0, 0x1000-1);
547               m_clip.set(0, 0x2000-1, 0, 0x1000-1);
556548            break;
557549
558550         case 0x2000:
559551            addr -= 2;
560            epic12_device_gfx_upload_shadow_copy(space, &addr);
552            gfx_upload_shadow_copy(space, &addr);
561553            break;
562554
563555         case 0x1000:
564556            addr -= 2;
565            epic12_device_gfx_draw_shadow_copy(space, &addr);
557            gfx_draw_shadow_copy(space, &addr);
566558            break;
567559
568560         default:
r31474r31475
573565}
574566
575567
576void epic12_device::epic12_device_gfx_exec(void)
568void epic12_device::gfx_exec(void)
577569{
578   offs_t addr = epic12_device_gfx_addr_shadowcopy & 0x1fffffff;
579   epic12_device_clip.set(epic12_device_gfx_scroll_1_x_shadowcopy, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y_shadowcopy, epic12_device_clip.min_y + 240-1);
570   offs_t addr = m_gfx_addr_shadowcopy & 0x1fffffff;
571   m_clip.set(m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_x_shadowcopy + 320-1, m_gfx_scroll_1_y_shadowcopy, m_gfx_scroll_1_y_shadowcopy + 240-1);
580572
581573//  logerror("GFX EXEC: %08X\n", addr);
582574
r31474r31475
592584
593585         case 0xc000:
594586            if (READ_NEXT_WORD(&addr)) // cliptype
595               epic12_device_clip.set(epic12_device_gfx_scroll_1_x_shadowcopy, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y_shadowcopy, epic12_device_clip.min_y + 240-1);
587               m_clip.set(m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_x_shadowcopy + 320-1, m_gfx_scroll_1_y_shadowcopy, m_gfx_scroll_1_y_shadowcopy + 240-1);
596588            else
597               epic12_device_clip.set(0, 0x2000-1, 0, 0x1000-1);
589               m_clip.set(0, 0x2000-1, 0, 0x1000-1);
598590            break;
599591
600592         case 0x2000:
601593            addr -= 2;
602            epic12_device_gfx_upload(&addr);
594            gfx_upload(&addr);
603595            break;
604596
605597         case 0x1000:
606598            addr -= 2;
607            epic12_device_gfx_draw(&addr);
599            gfx_draw(&addr);
608600            break;
609601
610602         default:
r31474r31475
615607}
616608
617609
618void epic12_device::epic12_device_gfx_exec_unsafe(void)
610void epic12_device::gfx_exec_unsafe(void)
619611{
620   offs_t addr = epic12_device_gfx_addr & 0x1fffffff;
621   epic12_device_clip.set(epic12_device_gfx_scroll_1_x, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y, epic12_device_clip.min_y + 240-1);
612   offs_t addr = m_gfx_addr & 0x1fffffff;
613   m_clip.set(m_gfx_scroll_1_x, m_gfx_scroll_1_x + 320-1, m_gfx_scroll_1_y, m_gfx_scroll_1_y + 240-1);
622614
623615//  logerror("GFX EXEC: %08X\n", addr);
624616
r31474r31475
634626
635627         case 0xc000:
636628            if (READ_NEXT_WORD(&addr)) // cliptype
637               epic12_device_clip.set(epic12_device_gfx_scroll_1_x, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y, epic12_device_clip.min_y + 240-1);
629               m_clip.set(m_gfx_scroll_1_x, m_gfx_scroll_1_x + 320-1, m_gfx_scroll_1_y, m_gfx_scroll_1_y + 240-1);
638630            else
639               epic12_device_clip.set(0, 0x2000-1, 0, 0x1000-1);
631               m_clip.set(0, 0x2000-1, 0, 0x1000-1);
640632            break;
641633
642634         case 0x2000:
643635            addr -= 2;
644            epic12_device_gfx_upload(&addr);
636            gfx_upload(&addr);
645637            break;
646638
647639         case 0x1000:
648640            addr -= 2;
649            epic12_device_gfx_draw(&addr);
641            gfx_draw(&addr);
650642            break;
651643
652644         default:
r31474r31475
662654{
663655   epic12_device *object = reinterpret_cast<epic12_device *>(param);
664656
665   object->epic12_device_gfx_exec();
657   object->gfx_exec();
666658   return NULL;
667659}
668660
r31474r31475
673665   epic12_device *object = reinterpret_cast<epic12_device *>(param);
674666
675667   epic12_device_blit_delay = 0;
676   object->epic12_device_gfx_exec_unsafe();
668   object->gfx_exec_unsafe();
677669   return NULL;
678670}
679671
680672
681READ32_MEMBER( epic12_device::epic12_device_gfx_ready_r )
673READ32_MEMBER( epic12_device::gfx_ready_r )
682674{
683675   return 0x00000010;
684676}
685677
686READ32_MEMBER( epic12_device::epic12_device_gfx_ready_r_unsafe )
678READ32_MEMBER( epic12_device::gfx_ready_r_unsafe )
687679{
688   if (blitter_busy)
680   if (m_blitter_busy)
689681   {
690682      m_maincpu->spin_until_time(attotime::from_usec(10));
691683      return 0x00000000;
r31474r31475
694686      return 0x00000010;
695687}
696688
697WRITE32_MEMBER( epic12_device::epic12_device_gfx_exec_w )
689WRITE32_MEMBER( epic12_device::gfx_exec_w )
698690{
699691   if ( ACCESSING_BITS_0_7 )
700692   {
r31474r31475
702694      {
703695         //g_profiler.start(PROFILER_USER1);
704696         // make sure we've not already got a request running
705         if (blitter_request)
697         if (m_blitter_request)
706698         {
707699            int result;
708700            do
709701            {
710               result = osd_work_item_wait(blitter_request, 1000);
702               result = osd_work_item_wait(m_blitter_request, 1000);
711703            } while (result==0);
712            osd_work_item_release(blitter_request);
704            osd_work_item_release(m_blitter_request);
713705         }
714706
715707         epic12_device_blit_delay = 0;
716         epic12_device_gfx_create_shadow_copy(space); // create a copy of the blit list so we can safely thread it.
708         gfx_create_shadow_copy(space); // create a copy of the blit list so we can safely thread it.
717709
718710         if (epic12_device_blit_delay)
719711         {
720            blitter_busy = 1;
721            epic12_device_blitter_delay_timer->adjust(attotime::from_nsec(epic12_device_blit_delay*8)); // NOT accurate timing (currently ignored anyway)
712            m_blitter_busy = 1;
713            m_blitter_delay_timer->adjust(attotime::from_nsec(epic12_device_blit_delay*8)); // NOT accurate timing (currently ignored anyway)
722714         }
723715
724         epic12_device_gfx_addr_shadowcopy = epic12_device_gfx_addr;
725         epic12_device_gfx_scroll_0_x_shadowcopy =  epic12_device_gfx_scroll_0_x;
726         epic12_device_gfx_scroll_0_y_shadowcopy = epic12_device_gfx_scroll_0_y;
727         epic12_device_gfx_scroll_1_x_shadowcopy = epic12_device_gfx_scroll_1_x;
728         epic12_device_gfx_scroll_1_y_shadowcopy = epic12_device_gfx_scroll_1_y;
729         blitter_request = osd_work_item_queue(queue, blit_request_callback, (void*)this, 0);
716         m_gfx_addr_shadowcopy = m_gfx_addr;
717         m_gfx_scroll_0_x_shadowcopy =  m_gfx_scroll_0_x;
718         m_gfx_scroll_0_y_shadowcopy = m_gfx_scroll_0_y;
719         m_gfx_scroll_1_x_shadowcopy = m_gfx_scroll_1_x;
720         m_gfx_scroll_1_y_shadowcopy = m_gfx_scroll_1_y;
721         m_blitter_request = osd_work_item_queue(m_work_queue, blit_request_callback, (void*)this, 0);
730722         //g_profiler.stop();
731723      }
732724   }
733725}
734726
735727
736WRITE32_MEMBER( epic12_device::epic12_device_gfx_exec_w_unsafe )
728WRITE32_MEMBER( epic12_device::gfx_exec_w_unsafe )
737729{
738730   if ( ACCESSING_BITS_0_7 )
739731   {
r31474r31475
741733      {
742734         //g_profiler.start(PROFILER_USER1);
743735         // make sure we've not already got a request running
744         if (blitter_request)
736         if (m_blitter_request)
745737         {
746738            int result;
747739            do
748740            {
749               result = osd_work_item_wait(blitter_request, 1000);
741               result = osd_work_item_wait(m_blitter_request, 1000);
750742            } while (result==0);
751            osd_work_item_release(blitter_request);
743            osd_work_item_release(m_blitter_request);
752744         }
753745
754746         if (epic12_device_blit_delay)
755747         {
756            blitter_busy = 1;
748            m_blitter_busy = 1;
757749            int delay = epic12_device_blit_delay*(15 * m_delay_scale / 50);
758750            //printf("delay %d\n", delay);
759            epic12_device_blitter_delay_timer->adjust(attotime::from_nsec(delay));
751            m_blitter_delay_timer->adjust(attotime::from_nsec(delay));
760752         }
761753         else
762754         {
763            blitter_busy = 0;
755            m_blitter_busy = 0;
764756         }
765757
766         blitter_request = osd_work_item_queue(queue, blit_request_callback_unsafe, (void*)this, 0);
758         m_blitter_request = osd_work_item_queue(m_work_queue, blit_request_callback_unsafe, (void*)this, 0);
767759         //g_profiler.stop();
768760      }
769761   }
r31474r31475
774766{
775767   if (!m_is_unsafe)
776768   {
777      if (blitter_request)
769      if (m_blitter_request)
778770      {
779771         int result;
780772         do
781773         {
782            result = osd_work_item_wait(blitter_request, 1000);
774            result = osd_work_item_wait(m_blitter_request, 1000);
783775         } while (result==0);
784         osd_work_item_release(blitter_request);
776         osd_work_item_release(m_blitter_request);
785777      }
786778   }
787779
r31474r31475
790782
791783   bitmap.fill(0, cliprect);
792784
793   scroll_0_x = -epic12_device_gfx_scroll_0_x;
794   scroll_0_y = -epic12_device_gfx_scroll_0_y;
795//  scroll_1_x = -epic12_device_gfx_scroll_1_x;
796//  scroll_1_y = -epic12_device_gfx_scroll_1_y;
785   scroll_0_x = -m_gfx_scroll_0_x;
786   scroll_0_y = -m_gfx_scroll_0_y;
787//  scroll_1_x = -m_gfx_scroll_1_x;
788//  scroll_1_y = -m_gfx_scroll_1_y;
797789
798790   //printf("SCREEN UPDATE\n %d %d %d %d\n", scroll_0_x, scroll_0_y, scroll_1_x, scroll_1_y);
799791
800   copyscrollbitmap(bitmap, *epic12_device_bitmaps, 1,&scroll_0_x, 1,&scroll_0_y, cliprect);
792   copyscrollbitmap(bitmap, *m_bitmaps, 1,&scroll_0_x, 1,&scroll_0_y, cliprect);
801793}
802794
803795
r31474r31475
805797
806798
807799
808READ32_MEMBER( epic12_device::epic12_device_blitter_r )
800READ32_MEMBER( epic12_device::blitter_r )
809801{
810802   switch (offset*4)
811803   {
812804      case 0x10:
813         return epic12_device::epic12_device_gfx_ready_r(space,offset,mem_mask);
805         return gfx_ready_r(space, offset, mem_mask);
814806
815807      case 0x24:
816808         return 0xffffffff;
r31474r31475
822814         return space.machine().root_device().ioport(":DSW")->read();
823815
824816      default:
825         logerror("unknownepic12_device_blitter_r %08x %08x\n", offset*4, mem_mask);
817         logerror("unknownblitter_r %08x %08x\n", offset*4, mem_mask);
826818         break;
827819
828820   }
829821   return 0;
830822}
831823
832READ32_MEMBER( epic12_device::epic12_device_blitter_r_unsafe )
824READ32_MEMBER( epic12_device::blitter_r_unsafe )
833825{
834826   switch (offset*4)
835827   {
836828      case 0x10:
837         return epic12_device::epic12_device_gfx_ready_r_unsafe(space,offset,mem_mask);
829         return gfx_ready_r_unsafe(space, offset, mem_mask);
838830
839831      case 0x24:
840832         return 0xffffffff;
r31474r31475
846838         return space.machine().root_device().ioport(":DSW")->read();
847839
848840      default:
849         logerror("unknownepic12_device_blitter_r %08x %08x\n", offset*4, mem_mask);
841         logerror("unknownblitter_r %08x %08x\n", offset*4, mem_mask);
850842         break;
851843
852844   }
r31474r31475
854846}
855847
856848
857WRITE32_MEMBER( epic12_device::epic12_device_blitter_w )
849WRITE32_MEMBER( epic12_device::blitter_w )
858850{
859851   switch (offset*4)
860852   {
861853      case 0x04:
862         epic12_device_gfx_exec_w(space,offset,data,mem_mask);
854         gfx_exec_w(space,offset,data,mem_mask);
863855         break;
864856
865857      case 0x08:
866         COMBINE_DATA(&epic12_device_gfx_addr);
858         COMBINE_DATA(&m_gfx_addr);
867859         break;
868860
869861      case 0x14:
870         COMBINE_DATA(&epic12_device_gfx_scroll_0_x);
862         COMBINE_DATA(&m_gfx_scroll_0_x);
871863         break;
872864
873865      case 0x18:
874         COMBINE_DATA(&epic12_device_gfx_scroll_0_y);
866         COMBINE_DATA(&m_gfx_scroll_0_y);
875867         break;
876868
877869      case 0x40:
878         COMBINE_DATA(&epic12_device_gfx_scroll_1_x);
870         COMBINE_DATA(&m_gfx_scroll_1_x);
879871         break;
880872
881873      case 0x44:
882         COMBINE_DATA(&epic12_device_gfx_scroll_1_y);
874         COMBINE_DATA(&m_gfx_scroll_1_y);
883875         break;
884876
885877   }
886878}
887879
888WRITE32_MEMBER( epic12_device::epic12_device_blitter_w_unsafe )
880WRITE32_MEMBER( epic12_device::blitter_w_unsafe )
889881{
890882   switch (offset*4)
891883   {
892884      case 0x04:
893         epic12_device_gfx_exec_w_unsafe(space,offset,data,mem_mask);
885         gfx_exec_w_unsafe(space,offset,data,mem_mask);
894886         break;
895887
896888      case 0x08:
897         COMBINE_DATA(&epic12_device_gfx_addr);
889         COMBINE_DATA(&m_gfx_addr);
898890         break;
899891
900892      case 0x14:
901         COMBINE_DATA(&epic12_device_gfx_scroll_0_x);
893         COMBINE_DATA(&m_gfx_scroll_0_x);
902894         break;
903895
904896      case 0x18:
905         COMBINE_DATA(&epic12_device_gfx_scroll_0_y);
897         COMBINE_DATA(&m_gfx_scroll_0_y);
906898         break;
907899
908900      case 0x40:
909         COMBINE_DATA(&epic12_device_gfx_scroll_1_x);
901         COMBINE_DATA(&m_gfx_scroll_1_x);
910902         break;
911903
912904      case 0x44:
913         COMBINE_DATA(&epic12_device_gfx_scroll_1_y);
905         COMBINE_DATA(&m_gfx_scroll_1_y);
914906         break;
915907
916908   }
r31474r31475
926918   if (m_is_unsafe)
927919   {
928920      printf("using unsafe blit code!\n");
929      read = read32_delegate(FUNC(epic12_device::epic12_device_blitter_r_unsafe), this);
930      write = write32_delegate(FUNC(epic12_device::epic12_device_blitter_w_unsafe), this);
921      read = read32_delegate(FUNC(epic12_device::blitter_r_unsafe), this);
922      write = write32_delegate(FUNC(epic12_device::blitter_w_unsafe), this);
931923   }
932924   else
933925   {
934      read = read32_delegate(FUNC(epic12_device::epic12_device_blitter_r), this);
935      write = write32_delegate(FUNC(epic12_device::epic12_device_blitter_w), this);
926      read = read32_delegate(FUNC(epic12_device::blitter_r), this);
927      write = write32_delegate(FUNC(epic12_device::blitter_w), this);
936928   }
937929
938930   space.install_readwrite_handler(addr1, addr2, read , write, U64(0xffffffffffffffff));
939931}
940932
941READ64_MEMBER( epic12_device::epic12_device_fpga_r )
933READ64_MEMBER( epic12_device::fpga_r )
942934{
943935   return 0xff;
944936}
945937
946938// todo, store what's written here and checksum it, different microcode probably leads to slightly different blitter timings
947WRITE64_MEMBER( epic12_device::epic12_device_fpga_w )
939WRITE64_MEMBER( epic12_device::fpga_w )
948940{
949941   if (ACCESSING_BITS_24_31)
950942   {
trunk/src/emu/video/epic12.h
r31474r31475
5151public:
5252   epic12_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
5353
54   void set_rambase(UINT16* rambase) { epic12_device_ram16 = rambase; }
54   void set_rambase(UINT16* rambase) { m_ram16 = rambase; }
55   void set_delay_scale(int delay_scale) { m_delay_scale = delay_scale; }
56   void set_is_unsafe(int is_unsafe) { m_is_unsafe = is_unsafe; }
57   void set_cpu_device(cpu_device* maincpu) { m_maincpu = maincpu; }
5558
5659   inline UINT16 READ_NEXT_WORD(offs_t *addr);
5760
r31474r31475
6265      dev.m_main_rammask = ramsize-1;
6366   }
6467
65
6668   static void *blit_request_callback(void *param, int threadid);
6769
68   DECLARE_READ64_MEMBER( epic12_device_fpga_r );
69   DECLARE_WRITE64_MEMBER( epic12_device_fpga_w );
70   DECLARE_READ64_MEMBER( fpga_r );
71   DECLARE_WRITE64_MEMBER( fpga_w );
7072
7173   void draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect);
7274
73   UINT16* epic12_device_ram16;
74   UINT32 epic12_device_gfx_addr;
75   UINT32 epic12_device_gfx_scroll_0_x, epic12_device_gfx_scroll_0_y;
76   UINT32 epic12_device_gfx_scroll_1_x, epic12_device_gfx_scroll_1_y;
75   UINT16* m_ram16;
76   UINT32 m_gfx_addr;
77   UINT32 m_gfx_scroll_0_x, m_gfx_scroll_0_y;
78   UINT32 m_gfx_scroll_1_x, m_gfx_scroll_1_y;
7779
80   int m_gfx_size;
81   bitmap_rgb32 *m_bitmaps;
82   rectangle m_clip;
7883
79   int epic12_device_gfx_size;
80   bitmap_rgb32 *epic12_device_bitmaps;
81   rectangle epic12_device_clip;
82
83
84   UINT16* use_ram;
84   UINT16* m_use_ram;
8585   int m_main_ramsize; // type D has double the main ram
8686   int m_main_rammask;
8787
88   // thread safe mode, with no delays & shadow ram copy
89   DECLARE_READ32_MEMBER(epic12_device_blitter_r);
90   DECLARE_WRITE32_MEMBER(epic12_device_blitter_w);
91   UINT32 epic12_device_gfx_addr_shadowcopy;
92   UINT32 epic12_device_gfx_scroll_0_x_shadowcopy, epic12_device_gfx_scroll_0_y_shadowcopy;
93   UINT32 epic12_device_gfx_scroll_1_x_shadowcopy, epic12_device_gfx_scroll_1_y_shadowcopy;
94   UINT16* epic12_device_ram16_copy;
95   inline void epic12_device_gfx_upload_shadow_copy(address_space &space, offs_t *addr);
96   inline void epic12_device_gfx_create_shadow_copy(address_space &space);
97   inline UINT16 COPY_NEXT_WORD(address_space &space, offs_t *addr);
98   inline void epic12_device_gfx_draw_shadow_copy(address_space &space, offs_t *addr);
99   inline void epic12_device_gfx_upload(offs_t *addr);
100   inline void epic12_device_gfx_draw(offs_t *addr);
101   void epic12_device_gfx_exec(void);
102   DECLARE_READ32_MEMBER( epic12_device_gfx_ready_r );
103   DECLARE_WRITE32_MEMBER( epic12_device_gfx_exec_w );
104
105
106   // for thread unsafe mode with blitter delays, no shadow copy of RAM
107   DECLARE_READ32_MEMBER(epic12_device_blitter_r_unsafe);
108   DECLARE_WRITE32_MEMBER(epic12_device_blitter_w_unsafe);
109   READ32_MEMBER( epic12_device_gfx_ready_r_unsafe );
110   WRITE32_MEMBER( epic12_device_gfx_exec_w_unsafe );
111   void epic12_device_gfx_exec_unsafe(void);
112   static void *blit_request_callback_unsafe(void *param, int threadid);
113
11488   int m_is_unsafe;
11589   int m_delay_scale;
11690   cpu_device* m_maincpu;
11791
118   void set_delay_scale(int delay_scale) { m_delay_scale = delay_scale; }
119   void set_is_unsafe(int is_unsafe) { m_is_unsafe = is_unsafe; }
120   void set_cpu_device(cpu_device* maincpu) { m_maincpu = maincpu; }
121
12292   void install_handlers(int addr1, int addr2);
12393
94   // thread safe mode, with no delays & shadow ram copy
95   DECLARE_READ32_MEMBER(blitter_r);
96   DECLARE_WRITE32_MEMBER(blitter_w);
97   UINT32 m_gfx_addr_shadowcopy;
98   UINT32 m_gfx_scroll_0_x_shadowcopy, m_gfx_scroll_0_y_shadowcopy;
99   UINT32 m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_y_shadowcopy;
100   UINT16* m_ram16_copy;
101   inline void gfx_upload_shadow_copy(address_space &space, offs_t *addr);
102   inline void gfx_create_shadow_copy(address_space &space);
103   inline UINT16 COPY_NEXT_WORD(address_space &space, offs_t *addr);
104   inline void gfx_draw_shadow_copy(address_space &space, offs_t *addr);
105   inline void gfx_upload(offs_t *addr);
106   inline void gfx_draw(offs_t *addr);
107   void gfx_exec(void);
108   DECLARE_READ32_MEMBER( gfx_ready_r );
109   DECLARE_WRITE32_MEMBER( gfx_exec_w );
110
111   // for thread unsafe mode with blitter delays, no shadow copy of RAM
112   DECLARE_READ32_MEMBER(blitter_r_unsafe);
113   DECLARE_WRITE32_MEMBER(blitter_w_unsafe);
114   READ32_MEMBER( gfx_ready_r_unsafe );
115   WRITE32_MEMBER( gfx_exec_w_unsafe );
116   void gfx_exec_unsafe(void);
117   static void *blit_request_callback_unsafe(void *param, int threadid);
118
124119#define BLIT_FUNCTION static const void
125120#define BLIT_PARAMS bitmap_rgb32 *bitmap, const rectangle *clip, UINT32 *gfx, int src_x, int src_y, const int dst_x_start, const int dst_y_start, int dimx, int dimy, const int flipy, const UINT8 s_alpha, const UINT8 d_alpha, const clr_t *tint_clr
126121
r31474r31475
832827   virtual void device_start();
833828   virtual void device_reset();
834829
835   osd_work_queue *    queue;                  /* work queue */
836   osd_work_item * blitter_request;
830   osd_work_queue *m_work_queue;
831   osd_work_item *m_blitter_request;
837832
838833   // blit timing
839   emu_timer *epic12_device_blitter_delay_timer;
840   int blitter_busy;
834   emu_timer *m_blitter_delay_timer;
835   int m_blitter_busy;
841836
842   TIMER_CALLBACK_MEMBER( epic12_device_blitter_delay_callback );
837   TIMER_CALLBACK_MEMBER( blitter_delay_callback );
843838};
844839
845840

Previous 199869 Revisions Next


© 1997-2024 The MAME Team