Previous 15994 Revisions Next

r1345 Wednesday 28th November, 2007 at 08:54:31 UTC by Curt Coder
[ATARIST] Slight refactoring to the shifter.
[src/mess/drivers]atarist.c
[src/mess/video]atarist.c

src/mess/video/atarist.c
r1344r1345
3030   int bitplane;
3131   int shift;
3232   int h, v;
33   int de;
3334} shifter;
3435
3536static emu_timer *atarist_glue_timer;
3637static emu_timer *atarist_shifter_timer;
37static mame_bitmap *atarist_bitmap;
3838
39pen_t INLINE atarist_shift_mode_0(void)
40{
41   int color = (BIT(shifter.rr[3], 15) << 3) | (BIT(shifter.rr[2], 15) << 2) | (BIT(shifter.rr[1], 15) << 1) | BIT(shifter.rr[0], 15);
42
43   shifter.rr[0] <<= 1;
44   shifter.rr[1] <<= 1;
45   shifter.rr[2] <<= 1;
46   shifter.rr[3] <<= 1;
47
48   return Machine->pens[color];
49}
50
51pen_t INLINE atarist_shift_mode_1(void)
52{
53   int color = (BIT(shifter.rr[1], 15) << 1) | BIT(shifter.rr[0], 15);
54
55   shifter.rr[0] <<= 1;
56   shifter.rr[1] <<= 1;
57   shifter.shift++;
58
59   if (shifter.shift == 15)
60   {
61      shifter.rr[0] = shifter.rr[2];
62      shifter.rr[1] = shifter.rr[3];
63      shifter.rr[2] = shifter.rr[3] = 0;
64      shifter.shift = 0;
65   }
66
67   return Machine->pens[color];
68}
69
70pen_t INLINE atarist_shift_mode_2(void)
71{
72   // not implemented
73   return Machine->pens[0];
74}
75
3976static TIMER_CALLBACK(atarist_shifter_tick)
4077{
4178   int y = video_screen_get_vpos(0);
4279   int x = video_screen_get_hpos(0);
43   int color;
4480
81   pen_t pen;
82
4583   switch (shifter.mode)
4684   {
47   case 0: // 320 x 200, 4 Plane
48      color = (BIT(shifter.rr[3], 15) << 3) | (BIT(shifter.rr[2], 15) << 2) | (BIT(shifter.rr[1], 15) << 1) | BIT(shifter.rr[0], 15);
49     
50      *BITMAP_ADDR32(atarist_bitmap, y, x) = Machine->pens[color];
51
52      shifter.rr[0] <<= 1;
53      shifter.rr[1] <<= 1;
54      shifter.rr[2] <<= 1;
55      shifter.rr[3] <<= 1;
85   case 0:
86      pen = atarist_shift_mode_0();
5687      break;
5788
58   case 1: // 640 x 200, 2 Plane
59      color = (BIT(shifter.rr[1], 15) << 1) | BIT(shifter.rr[0], 15);
60
61      *BITMAP_ADDR32(atarist_bitmap, y, x) = Machine->pens[color];
62
63      shifter.rr[0] <<= 1;
64      shifter.rr[1] <<= 1;
65      shifter.shift++;
66
67      if (shifter.shift == 15)
68      {
69         shifter.rr[0] = shifter.rr[2];
70         shifter.rr[1] = shifter.rr[3];
71         shifter.rr[2] = shifter.rr[3] = 0;
72         shifter.shift = 0;
73      }
89   case 1:
90      pen = atarist_shift_mode_1();
7491      break;
7592
76   case 2: // 640 x 400, 1 Plane
77      // unimplemented
93   case 2:
94      pen = atarist_shift_mode_2();
7895      break;
7996   }
97
98   *BITMAP_ADDR32(tmpbitmap, y, x) = pen;
8099}
81100
82101static TIMER_CALLBACK(atarist_glue_tick)
83102{
84   UINT8 *RAM = memory_region(REGION_CPU1) + shifter.ofs;
85
103   int vcount = video_screen_get_vpos(0);
86104   int hcount = video_screen_get_hpos(0) / 4;
87   int vcount = video_screen_get_vpos(0);
88105
89106   int de;
90107
r1344r1345
161178
162179   de = shifter.h && shifter.v;
163180
164   mfp68901_tbi_w(0, de);
181   if (de != shifter.de)
182   {
183      mfp68901_tbi_w(0, de);
184      shifter.de = de;
185   }
165186   
166187   if (de)
167188   {
189      UINT8 *RAM = memory_region(REGION_CPU1) + shifter.ofs;
190
168191      shifter.ir[shifter.bitplane] = (RAM[1] << 8) | RAM[0];
169192      shifter.bitplane++;
170193      shifter.ofs += 2;
r1344r1345
375398   UINT32 srcbuf;
376399} blitter;
377400
378static emu_timer *blitter_timer;
379
380401static void atarist_blitter_source(void)
381402{
382403   UINT8 *RAM = memory_region(REGION_CPU1) + blitter.src;
r1344r1345
681702         if ((data >> 8) & ATARIST_BLITTER_CTRL_BUSY)
682703         {
683704            int nops = BLITTER_NOPS[blitter.op][blitter.hop]; // each NOP takes 4 cycles
684            timer_pulse(ATTOTIME_IN_HZ((Y2/4)/(4*nops)), 0, atarist_blitter_tick);
705            timer_set(ATTOTIME_IN_HZ((Y2/4)/(4*nops)), 0, atarist_blitter_tick);
685706         }
686707      }
687708   }
r1344r1345
697718{
698719   atarist_shifter_timer = timer_alloc(atarist_shifter_tick);
699720   atarist_glue_timer = timer_alloc(atarist_glue_tick);
700   blitter_timer = timer_alloc(atarist_blitter_tick);
701721
722   timer_adjust(atarist_shifter_timer, video_screen_get_time_until_pos(0,0,0), 0, ATTOTIME_IN_HZ(Y2/4)); // 125 ns
702723   timer_adjust(atarist_glue_timer, video_screen_get_time_until_pos(0,0,4), 0, ATTOTIME_IN_HZ(Y2/16)); // 500 ns
703   timer_adjust(atarist_shifter_timer, video_screen_get_time_until_pos(0,0,0), 0, ATTOTIME_IN_HZ(Y2/4)); // 125 ns
704724
705   atarist_bitmap = auto_bitmap_alloc(Machine->screen[0].width, Machine->screen[0].height, Machine->screen[0].format);
706
707725   memset(&shifter, 0, sizeof(shifter));
708726
709727   state_save_register_global(shifter.base);
r1344r1345
719737   state_save_register_global(shifter.shift);
720738   state_save_register_global(shifter.h);
721739   state_save_register_global(shifter.v);
740   state_save_register_global(shifter.de);
722741
723742   state_save_register_global_array(blitter.halftone);
724743   state_save_register_global(blitter.src_inc_x);
r1344r1345
738757   state_save_register_global(blitter.ctrl);
739758   state_save_register_global(blitter.skew);
740759
741   state_save_register_bitmap("video", 0, "atarist_bitmap", atarist_bitmap);
760   video_start_generic_bitmapped(machine);
742761}
743
744VIDEO_UPDATE( atarist )
745{
746   copybitmap(bitmap, atarist_bitmap, 0, 0, 0, 0, cliprect, TRANSPARENCY_NONE, 0);
747
748   return 0;
749}
src/mess/drivers/atarist.c
r1344r1345
17521752   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
17531753   MDRV_PALETTE_LENGTH(16)
17541754   MDRV_VIDEO_START( atarist )
1755   MDRV_VIDEO_UPDATE( atarist )
1755   MDRV_VIDEO_UPDATE( generic_bitmapped )
17561756
17571757   MDRV_SCREEN_ADD("main", 0)
17581758   MDRV_SCREEN_RAW_PARAMS(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL)
r1344r1345
17891789   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
17901790   MDRV_PALETTE_LENGTH(512)
17911791   MDRV_VIDEO_START( atarist )
1792   MDRV_VIDEO_UPDATE( atarist )
1792   MDRV_VIDEO_UPDATE( generic_bitmapped )
17931793
17941794   MDRV_SCREEN_ADD("main", 0)
17951795   MDRV_SCREEN_RAW_PARAMS(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team