Previous 199869 Revisions Next

r18237 Tuesday 2nd October, 2012 at 02:11:47 UTC by Barry Rodewald
(MESS) Moved 8514/A specific functions and variables to the ATI device, as the Mach8 is properly 8514/A compatible, and made the S3 device derived from the ATI device (instead of vice versa). (no whatsnew)
[src/emu/video]pc_vga.c pc_vga.h
[src/mess/video]isa_svga_s3.c isa_svga_s3.h isa_vga_ati.c

trunk/src/emu/video/pc_vga.c
r18236r18237
103103#define LOG_ACCESSES   0
104104#define LOG_REGISTERS   0
105105
106#define LOG_8514      0
106#define LOG_8514      1
107107
108108/***************************************************************************
109109
r18236r18237
144144{
145145}
146146
147s3_vga_device::s3_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
148    : svga_device(mconfig, type, name, tag, owner, clock)
149{
150}
151
152147s3_vga_device::s3_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
153    : svga_device(mconfig, S3_VGA, "S3_VGA", tag, owner, clock)
148    : ati_vga_device(mconfig, S3_VGA, "S3_VGA", tag, owner, clock)
154149{
155150}
156151
r18236r18237
160155}
161156
162157ati_vga_device::ati_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
163    : s3_vga_device(mconfig, ATI_VGA, "ATI_VGA", tag, owner, clock)
158    : svga_device(mconfig, ATI_VGA, "ATI_VGA", tag, owner, clock)
164159{
165160}
161
162ati_vga_device::ati_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
163    : svga_device(mconfig, type, name, tag, owner, clock)
164{
165}
166
166167cirrus_vga_device::cirrus_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
167168    : svga_device(mconfig, CIRRUS_VGA, "CIRRUS_VGA", tag, owner, clock)
168169{
r18236r18237
26702671            {
26712672               ibm8514.state = IBM8514_IDLE;
26722673               ibm8514.gpbusy = false;
2673               s3.write_count = 0;
26742674            }
26752675            break;
26762676/*
r18236r18237
29722972
29732973/* accelerated ports, TBD ... */
29742974
2975void s3_vga_device::s3_write_fg(UINT32 offset)
2975void ati_vga_device::ibm8514_write_fg(UINT32 offset)
29762976{
29772977   UINT8 dst = vga.memory[offset];
29782978   UINT8 src = 0;
29792979
29802980   // check clipping rectangle
2981   if(ibm8514.curr_x < s3.scissors_left || ibm8514.curr_x > s3.scissors_right || ibm8514.curr_y < s3.scissors_top || ibm8514.curr_y > s3.scissors_bottom)
2981   if(ibm8514.curr_x < ibm8514.scissors_left || ibm8514.curr_x > ibm8514.scissors_right || ibm8514.curr_y < ibm8514.scissors_top || ibm8514.curr_y > ibm8514.scissors_bottom)
29822982      return;  // do nothing
29832983
29842984   // determine source
2985   switch(s3.fgmix & 0x0060)
2985   switch(ibm8514.fgmix & 0x0060)
29862986   {
29872987   case 0x0000:
2988      src = s3.bgcolour;
2988      src = ibm8514.bgcolour;
29892989      break;
29902990   case 0x0020:
2991      src = s3.fgcolour;
2991      src = ibm8514.fgcolour;
29922992      break;
29932993   case 0x0040:
2994      src = s3.pixel_xfer;
2994      src = ibm8514.pixel_xfer;
29952995      break;
29962996   case 0x0060:
29972997      // video memory - presume the memory is sourced from the current X/Y co-ords
r18236r18237
30003000   }
30013001
30023002   // write the data
3003   switch(s3.fgmix & 0x000f)
3003   switch(ibm8514.fgmix & 0x000f)
30043004   {
30053005   case 0x0000:
30063006      vga.memory[offset] = ~dst;
r18236r18237
30533053   }
30543054}
30553055
3056void s3_vga_device::s3_write_bg(UINT32 offset)
3056void ati_vga_device::ibm8514_write_bg(UINT32 offset)
30573057{
30583058   UINT8 dst = vga.memory[offset];
30593059   UINT8 src = 0;
30603060
30613061   // check clipping rectangle
3062   if(ibm8514.curr_x < s3.scissors_left || ibm8514.curr_x > s3.scissors_right || ibm8514.curr_y < s3.scissors_top || ibm8514.curr_y > s3.scissors_bottom)
3062   if(ibm8514.curr_x < ibm8514.scissors_left || ibm8514.curr_x > ibm8514.scissors_right || ibm8514.curr_y < ibm8514.scissors_top || ibm8514.curr_y > ibm8514.scissors_bottom)
30633063      return;  // do nothing
30643064
30653065   // determine source
3066   switch(s3.bgmix & 0x0060)
3066   switch(ibm8514.bgmix & 0x0060)
30673067   {
30683068   case 0x0000:
3069      src = s3.bgcolour;
3069      src = ibm8514.bgcolour;
30703070      break;
30713071   case 0x0020:
3072      src = s3.fgcolour;
3072      src = ibm8514.fgcolour;
30733073      break;
30743074   case 0x0040:
3075      src = s3.pixel_xfer;
3075      src = ibm8514.pixel_xfer;
30763076      break;
30773077   case 0x0060:
30783078      // video memory - presume the memory is sourced from the current X/Y co-ords
r18236r18237
30813081   }
30823082
30833083   // write the data
3084   switch(s3.bgmix & 0x000f)
3084   switch(ibm8514.bgmix & 0x000f)
30853085   {
30863086   case 0x0000:
30873087      vga.memory[offset] = ~dst;
r18236r18237
31343134   }
31353135}
31363136
3137void s3_vga_device::s3_write(UINT32 offset, UINT32 src)
3137void ati_vga_device::ibm8514_write(UINT32 offset, UINT32 src)
31383138{
31393139   int data_size = 8;
31403140   UINT32 xfer = 0;
31413141
3142   switch(s3.pixel_control & 0x00c0)
3142   switch(ibm8514.pixel_control & 0x00c0)
31433143   {
31443144   case 0x0000:  // Foreground Mix only
31453145      // check clipping rectangle
3146      if(ibm8514.curr_x < s3.scissors_left || ibm8514.curr_x > s3.scissors_right || ibm8514.curr_y < s3.scissors_top || ibm8514.curr_y > s3.scissors_bottom)
3146      if(ibm8514.curr_x < ibm8514.scissors_left || ibm8514.curr_x > ibm8514.scissors_right || ibm8514.curr_y < ibm8514.scissors_top || ibm8514.curr_y > ibm8514.scissors_bottom)
31473147         return;  // do nothing
3148      s3_write_fg(offset);
3148      ibm8514_write_fg(offset);
31493149      break;
31503150   case 0x0040:  // fixed pattern (?)
31513151      // TODO
31523152      break;
31533153   case 0x0080:  // use pixel transfer register
3154      if(s3.bus_size == 0)  // 8-bit
3154      if(ibm8514.bus_size == 0)  // 8-bit
31553155         data_size = 8;
3156      if(s3.bus_size == 1)  // 16-bit
3156      if(ibm8514.bus_size == 1)  // 16-bit
31573157         data_size = 16;
3158      if(s3.bus_size == 2)  // 32-bit
3158      if(ibm8514.bus_size == 2)  // 32-bit
31593159         data_size = 32;
3160      if((s3.current_cmd & 0x1000) && (data_size != 8))
3160      if((ibm8514.current_cmd & 0x1000) && (data_size != 8))
31613161      {
3162         xfer = ((s3.pixel_xfer & 0x000000ff) << 8) | ((s3.pixel_xfer & 0x0000ff00) >> 8)
3163             | ((s3.pixel_xfer & 0x00ff0000) << 8) | ((s3.pixel_xfer & 0xff000000) >> 8);
3162         xfer = ((ibm8514.pixel_xfer & 0x000000ff) << 8) | ((ibm8514.pixel_xfer & 0x0000ff00) >> 8)
3163             | ((ibm8514.pixel_xfer & 0x00ff0000) << 8) | ((ibm8514.pixel_xfer & 0xff000000) >> 8);
31643164      }
31653165      else
3166         xfer = s3.pixel_xfer;
3167      if(s3.current_cmd & 0x0002)
3166         xfer = ibm8514.pixel_xfer;
3167      if(ibm8514.current_cmd & 0x0002)
31683168      {
3169         if((xfer & ((1<<(data_size-1))>>s3.src_x)) != 0)
3170            s3_write_fg(offset);
3169         if((xfer & ((1<<(data_size-1))>>ibm8514.src_x)) != 0)
3170            ibm8514_write_fg(offset);
31713171         else
3172            s3_write_bg(offset);
3172            ibm8514_write_bg(offset);
31733173      }
31743174      else
31753175      {
3176         s3_write_fg(offset);
3176         ibm8514_write_fg(offset);
31773177      }
3178      s3.src_x++;
3179      if(s3.src_x >= data_size)
3180         s3.src_x = 0;
3178      ibm8514.src_x++;
3179      if(ibm8514.src_x >= data_size)
3180         ibm8514.src_x = 0;
31813181      break;
31823182   case 0x00c0:  // use source plane
31833183      if(vga.memory[(src) % vga.svga_intf.vram_size] != 0x00)
3184         s3_write_fg(offset);
3184         ibm8514_write_fg(offset);
31853185      else
3186         s3_write_bg(offset);
3186         ibm8514_write_bg(offset);
31873187      break;
31883188   }
31893189}
r18236r18237
31983198            the major or independent axis).
31993199     0-13  (80x +) LINE PARAMETER/ERROR TERM. See above.
32003200 */
3201READ16_MEMBER(s3_vga_device::s3_line_error_r)
3201READ16_MEMBER(ati_vga_device::ibm8514_line_error_r)
32023202{
32033203   return ibm8514.line_errorterm;
32043204}
32053205
3206WRITE16_MEMBER(s3_vga_device::s3_line_error_w)
3206WRITE16_MEMBER(ati_vga_device::ibm8514_line_error_w)
32073207{
32083208   ibm8514.line_errorterm = data;
3209   if(LOG_8514) logerror("S3: Line Parameter/Error Term write %04x\n",data);
3209   if(LOG_8514) logerror("8514/A: Line Parameter/Error Term write %04x\n",data);
32103210}
32113211
32123212/*
r18236r18237
32303230            available, Fh for 9 words, 7 for 10 words, 3 for 11 words, 1 for
32313231            12 words and 0 for 13 words available.
32323232 */
3233READ16_MEMBER(s3_vga_device::ibm8514_gpstatus_r)
3233READ16_MEMBER(ati_vga_device::ibm8514_gpstatus_r)
32343234{
32353235   UINT16 ret = 0x0000;
32363236
r18236r18237
32423242   return ret;
32433243}
32443244
3245void s3_vga_device::ibm8514_draw_vector(UINT8 len, UINT8 dir, bool draw)
3245void ati_vga_device::ibm8514_draw_vector(UINT8 len, UINT8 dir, bool draw)
32463246{
32473247   UINT32 offset;
32483248   int x = 0;
r18236r18237
32513251   {
32523252      offset = (ibm8514.curr_y * VGA_LINE_LENGTH) + ibm8514.curr_x;
32533253      if(draw)
3254         s3_write(offset,offset);
3254         ibm8514_write(offset,offset);
32553255      switch(dir)
32563256      {
32573257      case 0:  // 0 degrees
r18236r18237
33873387                rectangle, which is copied repeatably to the destination
33883388                rectangle.
33893389 */
3390WRITE16_MEMBER(s3_vga_device::ibm8514_cmd_w)
3390WRITE16_MEMBER(ati_vga_device::ibm8514_cmd_w)
33913391{
33923392   int x,y;
33933393   int pattern_x,pattern_y;
33943394   UINT32 off,src;
33953395
3396   s3.current_cmd = data;
3397   s3.src_x = 0;
3398   s3.src_y = 0;
3399   s3.bus_size = (data & 0x0600) >> 9;
3396   ibm8514.current_cmd = data;
3397   ibm8514.src_x = 0;
3398   ibm8514.src_y = 0;
3399   ibm8514.bus_size = (data & 0x0600) >> 9;
34003400   switch(data & 0xe000)
34013401   {
34023402   case 0x0000:  // NOP (for "Short Stroke Vectors")
34033403      ibm8514.state = IBM8514_IDLE;
34043404      ibm8514.gpbusy = false;
3405      if(LOG_8514) logerror("S3: Command (%04x) - NOP (Short Stroke Vector)\n",s3.current_cmd);
3405      if(LOG_8514) logerror("S3: Command (%04x) - NOP (Short Stroke Vector)\n",ibm8514.current_cmd);
34063406      break;
34073407   case 0x2000:  // Line
34083408      ibm8514.state = IBM8514_IDLE;
r18236r18237
34133413         {
34143414            ibm8514.state = IBM8514_DRAWING_LINE;
34153415            ibm8514.data_avail = true;
3416            if(LOG_8514) logerror("S3: Command (%04x) - Vector Line (WAIT) %i,%i \n",s3.current_cmd,ibm8514.curr_x,ibm8514.curr_y);
3416            if(LOG_8514) logerror("S3: Command (%04x) - Vector Line (WAIT) %i,%i \n",ibm8514.current_cmd,ibm8514.curr_x,ibm8514.curr_y);
34173417         }
34183418         else
34193419         {
3420            ibm8514_draw_vector(s3.rect_width,(data & 0x00e0) >> 5,(data & 0010) ? true : false);
3421            if(LOG_8514) logerror("S3: Command (%04x) - Vector Line - %i,%i \n",s3.current_cmd,ibm8514.curr_x,ibm8514.curr_y);
3420            ibm8514_draw_vector(ibm8514.rect_width,(data & 0x00e0) >> 5,(data & 0010) ? true : false);
3421            if(LOG_8514) logerror("S3: Command (%04x) - Vector Line - %i,%i \n",ibm8514.current_cmd,ibm8514.curr_x,ibm8514.curr_y);
34223422         }
34233423      }
34243424      else
34253425      {
34263426         // Not perfect, but will do for now.
3427         INT16 dx = s3.rect_width;
3427         INT16 dx = ibm8514.rect_width;
34283428         INT16 dy = ibm8514.line_axial_step >> 1;
34293429         INT16 err = ibm8514.line_errorterm;
34303430         int sx = (data & 0x0020) ? 1 : -1;
r18236r18237
34323432         int count = 0;
34333433         INT16 temp;
34343434
3435         if(LOG_8514) logerror("S3: Command (%04x) - Line (Bresenham) - %i,%i  Axial %i, Diagonal %i, Error %i, Major Axis %i, Minor Axis %i\n",s3.current_cmd,
3436            ibm8514.curr_x,ibm8514.curr_y,ibm8514.line_axial_step,ibm8514.line_diagonal_step,ibm8514.line_errorterm,s3.rect_width,s3.rect_height);
3435         if(LOG_8514) logerror("S3: Command (%04x) - Line (Bresenham) - %i,%i  Axial %i, Diagonal %i, Error %i, Major Axis %i, Minor Axis %i\n",ibm8514.current_cmd,
3436            ibm8514.curr_x,ibm8514.curr_y,ibm8514.line_axial_step,ibm8514.line_diagonal_step,ibm8514.line_errorterm,ibm8514.rect_width,ibm8514.rect_height);
34373437
34383438         if((data & 0x0040))
34393439         {
r18236r18237
34413441         }
34423442         for(;;)
34433443         {
3444            s3_write(ibm8514.curr_x + (ibm8514.curr_y * VGA_LINE_LENGTH),ibm8514.curr_x + (ibm8514.curr_y * VGA_LINE_LENGTH));
3445            if (count > s3.rect_width) break;
3444            ibm8514_write(ibm8514.curr_x + (ibm8514.curr_y * VGA_LINE_LENGTH),ibm8514.curr_x + (ibm8514.curr_y * VGA_LINE_LENGTH));
3445            if (count > ibm8514.rect_width) break;
34463446            count++;
34473447            if((err*2) > -dy)
34483448            {
r18236r18237
34623462      {
34633463         ibm8514.state = IBM8514_DRAWING_RECT;
34643464         //ibm8514.gpbusy = true;  // DirectX 5 keeps waiting for the busy bit to be clear...
3465         s3.bus_size = (data & 0x0600) >> 9;
3465         ibm8514.bus_size = (data & 0x0600) >> 9;
34663466         ibm8514.data_avail = true;
3467         if(LOG_8514) logerror("S3: Command (%04x) - Rectangle Fill (WAIT) %i,%i Width: %i Height: %i Colour: %08x\n",s3.current_cmd,ibm8514.curr_x,
3468               ibm8514.curr_y,s3.rect_width,s3.rect_height,s3.fgcolour);
3467         if(LOG_8514) logerror("S3: Command (%04x) - Rectangle Fill (WAIT) %i,%i Width: %i Height: %i Colour: %08x\n",ibm8514.current_cmd,ibm8514.curr_x,
3468               ibm8514.curr_y,ibm8514.rect_width,ibm8514.rect_height,ibm8514.fgcolour);
34693469         break;
34703470      }
3471      if(LOG_8514) logerror("S3: Command (%04x) - Rectangle Fill %i,%i Width: %i Height: %i Colour: %08x\n",s3.current_cmd,ibm8514.curr_x,
3472            ibm8514.curr_y,s3.rect_width,s3.rect_height,s3.fgcolour);
3471      if(LOG_8514) logerror("S3: Command (%04x) - Rectangle Fill %i,%i Width: %i Height: %i Colour: %08x\n",ibm8514.current_cmd,ibm8514.curr_x,
3472            ibm8514.curr_y,ibm8514.rect_width,ibm8514.rect_height,ibm8514.fgcolour);
34733473      off = 0;
34743474      off += (VGA_LINE_LENGTH * ibm8514.curr_y);
34753475      off += ibm8514.curr_x;
3476      for(y=0;y<=s3.rect_height;y++)
3476      for(y=0;y<=ibm8514.rect_height;y++)
34773477      {
3478         for(x=0;x<=s3.rect_width;x++)
3478         for(x=0;x<=ibm8514.rect_width;x++)
34793479         {
34803480            if(data & 0x0020)  // source pattern is always based on current X/Y?
3481               s3_write((off+x) % vga.svga_intf.vram_size,(off+x) % vga.svga_intf.vram_size);
3481               ibm8514_write((off+x) % vga.svga_intf.vram_size,(off+x) % vga.svga_intf.vram_size);
34823482            else
3483               s3_write((off-x) % vga.svga_intf.vram_size,(off-x) % vga.svga_intf.vram_size);
3484            if(s3.current_cmd & 0x0020)
3483               ibm8514_write((off-x) % vga.svga_intf.vram_size,(off-x) % vga.svga_intf.vram_size);
3484            if(ibm8514.current_cmd & 0x0020)
34853485            {
34863486               ibm8514.curr_x++;
3487               if(ibm8514.curr_x > ibm8514.prev_x + s3.rect_width)
3487               if(ibm8514.curr_x > ibm8514.prev_x + ibm8514.rect_width)
34883488               {
34893489                  ibm8514.curr_x = ibm8514.prev_x;
3490                  s3.src_x = 0;
3491                  if(s3.current_cmd & 0x0080)
3490                  ibm8514.src_x = 0;
3491                  if(ibm8514.current_cmd & 0x0080)
34923492                     ibm8514.curr_y++;
34933493                  else
34943494                     ibm8514.curr_y--;
r18236r18237
34973497            else
34983498            {
34993499               ibm8514.curr_x--;
3500               if(ibm8514.curr_x < ibm8514.prev_x - s3.rect_width)
3500               if(ibm8514.curr_x < ibm8514.prev_x - ibm8514.rect_width)
35013501               {
35023502                  ibm8514.curr_x = ibm8514.prev_x;
3503                  s3.src_x = 0;
3504                  if(s3.current_cmd & 0x0080)
3503                  ibm8514.src_x = 0;
3504                  if(ibm8514.current_cmd & 0x0080)
35053505                     ibm8514.curr_y++;
35063506                  else
35073507                     ibm8514.curr_y--;
r18236r18237
35173517      ibm8514.gpbusy = false;
35183518      break;
35193519   case 0xc000:  // BitBLT
3520      if(LOG_8514) logerror("S3: Command (%04x) - BitBLT from %i,%i to %i,%i  Width: %i  Height: %i\n",s3.current_cmd,
3521            ibm8514.curr_x,ibm8514.curr_y,ibm8514.dest_x,ibm8514.dest_y,s3.rect_width,s3.rect_height);
3520      if(LOG_8514) logerror("S3: Command (%04x) - BitBLT from %i,%i to %i,%i  Width: %i  Height: %i\n",ibm8514.current_cmd,
3521            ibm8514.curr_x,ibm8514.curr_y,ibm8514.dest_x,ibm8514.dest_y,ibm8514.rect_width,ibm8514.rect_height);
35223522      off = 0;
35233523      off += (VGA_LINE_LENGTH * ibm8514.dest_y);
35243524      off += ibm8514.dest_x;
35253525      src = 0;
35263526      src += (VGA_LINE_LENGTH * ibm8514.curr_y);
35273527      src += ibm8514.curr_x;
3528      for(y=0;y<=s3.rect_height;y++)
3528      for(y=0;y<=ibm8514.rect_height;y++)
35293529      {
3530         for(x=0;x<=s3.rect_width;x++)
3530         for(x=0;x<=ibm8514.rect_width;x++)
35313531         {
35323532            if(data & 0x0020)
35333533               vga.memory[(off+x) % vga.svga_intf.vram_size] = vga.memory[(src+x) % vga.svga_intf.vram_size];
35343534            else
35353535               vga.memory[(off-x) % vga.svga_intf.vram_size] = vga.memory[(src-x) % vga.svga_intf.vram_size];
3536            if(s3.current_cmd & 0x0020)
3536            if(ibm8514.current_cmd & 0x0020)
35373537            {
35383538               ibm8514.curr_x++;
3539               if(ibm8514.curr_x > ibm8514.prev_x + s3.rect_width)
3539               if(ibm8514.curr_x > ibm8514.prev_x + ibm8514.rect_width)
35403540               {
35413541                  ibm8514.curr_x = ibm8514.prev_x;
3542                  s3.src_x = 0;
3543                  if(s3.current_cmd & 0x0080)
3542                  ibm8514.src_x = 0;
3543                  if(ibm8514.current_cmd & 0x0080)
35443544                     ibm8514.curr_y++;
35453545                  else
35463546                     ibm8514.curr_y--;
r18236r18237
35493549            else
35503550            {
35513551               ibm8514.curr_x--;
3552               if(ibm8514.curr_x < ibm8514.prev_x - s3.rect_width)
3552               if(ibm8514.curr_x < ibm8514.prev_x - ibm8514.rect_width)
35533553               {
35543554                  ibm8514.curr_x = ibm8514.prev_x;
3555                  s3.src_x = 0;
3556                  if(s3.current_cmd & 0x0080)
3555                  ibm8514.src_x = 0;
3556                  if(ibm8514.current_cmd & 0x0080)
35573557                     ibm8514.curr_y++;
35583558                  else
35593559                     ibm8514.curr_y--;
r18236r18237
35753575      ibm8514.gpbusy = false;
35763576      break;
35773577   case 0xe000:  // Pattern Fill
3578      if(LOG_8514) logerror("S3: Command (%04x) - Pattern Fill - source %i,%i  dest %i,%i  Width: %i Height: %i\n",s3.current_cmd,
3579            ibm8514.curr_x,ibm8514.curr_y,ibm8514.dest_x,ibm8514.dest_y,s3.rect_width,s3.rect_height);
3578      if(LOG_8514) logerror("S3: Command (%04x) - Pattern Fill - source %i,%i  dest %i,%i  Width: %i Height: %i\n",ibm8514.current_cmd,
3579            ibm8514.curr_x,ibm8514.curr_y,ibm8514.dest_x,ibm8514.dest_y,ibm8514.rect_width,ibm8514.rect_height);
35803580      off = 0;
35813581      off += (VGA_LINE_LENGTH * ibm8514.dest_y);
35823582      off += ibm8514.dest_x;
r18236r18237
35923592      else
35933593         pattern_y = 7;
35943594
3595      for(y=0;y<=s3.rect_height;y++)
3595      for(y=0;y<=ibm8514.rect_height;y++)
35963596      {
3597         for(x=0;x<=s3.rect_width;x++)
3597         for(x=0;x<=ibm8514.rect_width;x++)
35983598         {
35993599            if(data & 0x0020)
36003600            {
3601               s3_write(off+x,src+pattern_x);
3601               ibm8514_write(off+x,src+pattern_x);
36023602               pattern_x++;
36033603               if(pattern_x >= 8)
36043604                  pattern_x = 0;
36053605            }
36063606            else
36073607            {
3608               s3_write(off-x,src-pattern_x);
3608               ibm8514_write(off-x,src-pattern_x);
36093609               pattern_x--;
36103610               if(pattern_x < 0)
36113611                  pattern_x = 7;
r18236r18237
36673667     0-13  (80 x+) LINE PARAMETER AXIAL STEP CONSTANT. Se above
36683668
36693669 */
3670READ16_MEMBER(s3_vga_device::ibm8514_desty_r)
3670READ16_MEMBER(ati_vga_device::ibm8514_desty_r)
36713671{
36723672   return ibm8514.line_axial_step;
36733673}
36743674
3675WRITE16_MEMBER(s3_vga_device::ibm8514_desty_w)
3675WRITE16_MEMBER(ati_vga_device::ibm8514_desty_w)
36763676{
36773677   ibm8514.line_axial_step = data;
36783678   ibm8514.dest_y = data;
r18236r18237
36923692     0-13  (80x +) LINE PARAMETER DIAGONAL STEP CONSTANT. Se above
36933693
36943694 */
3695READ16_MEMBER(s3_vga_device::ibm8514_destx_r)
3695READ16_MEMBER(ati_vga_device::ibm8514_destx_r)
36963696{
36973697   return ibm8514.line_diagonal_step;
36983698}
36993699
3700WRITE16_MEMBER(s3_vga_device::ibm8514_destx_w)
3700WRITE16_MEMBER(ati_vga_device::ibm8514_destx_w)
37013701{
37023702   ibm8514.line_diagonal_step = data;
37033703   ibm8514.dest_x = data;
r18236r18237
37263726      9EE9h before execution starts. A single 16bit write will do.
37273727      If only one SSV is desired the other byte can be set to 0.
37283728 */
3729void s3_vga_device::ibm8514_wait_draw_ssv()
3729void ati_vga_device::ibm8514_wait_draw_ssv()
37303730{
37313731   UINT8 len = ibm8514.wait_vector_len;
37323732   UINT8 dir = ibm8514.wait_vector_dir;
r18236r18237
37363736   int x;
37373737   int data_size;
37383738
3739   switch(s3.bus_size)
3739   switch(ibm8514.bus_size)
37403740   {
37413741   case 0:
37423742      data_size = 8;
r18236r18237
37783778      {
37793779         offset = (ibm8514.curr_y * VGA_LINE_LENGTH) + ibm8514.curr_x;
37803780         if(draw)
3781            s3_write(offset,offset);
3781            ibm8514_write(offset,offset);
37823782         switch(dir)
37833783         {
37843784         case 0:  // 0 degrees
r18236r18237
38143814   }
38153815}
38163816
3817void s3_vga_device::ibm8514_draw_ssv(UINT8 data)
3817void ati_vga_device::ibm8514_draw_ssv(UINT8 data)
38183818{
38193819   UINT8 len = data & 0x0f;
38203820   UINT8 dir = (data & 0xe0) >> 5;
r18236r18237
38233823   ibm8514_draw_vector(len,dir,draw);
38243824}
38253825
3826READ16_MEMBER(s3_vga_device::ibm8514_ssv_r)
3826READ16_MEMBER(ati_vga_device::ibm8514_ssv_r)
38273827{
38283828   return ibm8514.ssv;
38293829}
38303830
3831WRITE16_MEMBER(s3_vga_device::ibm8514_ssv_w)
3831WRITE16_MEMBER(ati_vga_device::ibm8514_ssv_w)
38323832{
38333833   ibm8514.ssv = data;
38343834
3835   if(s3.current_cmd & 0x0100)
3835   if(ibm8514.current_cmd & 0x0100)
38363836   {
38373837      ibm8514.state = IBM8514_DRAWING_SSV_1;
38383838      ibm8514.data_avail = true;
r18236r18237
38433843      return;
38443844   }
38453845
3846   if(s3.current_cmd & 0x1000)  // byte sequence
3846   if(ibm8514.current_cmd & 0x1000)  // byte sequence
38473847   {
38483848      ibm8514_draw_ssv(data & 0xff);
38493849      ibm8514_draw_ssv(data >> 8);
r18236r18237
38563856   if(LOG_8514) logerror("8514/A: Short Stroke Vector write %04x\n",data);
38573857}
38583858
3859void s3_vga_device::ibm8514_wait_draw_vector()
3859void ati_vga_device::ibm8514_wait_draw_vector()
38603860{
38613861   UINT8 len = ibm8514.wait_vector_len;
38623862   UINT8 dir = ibm8514.wait_vector_dir;
r18236r18237
38663866   UINT8 data_size = 0;
38673867   int x;
38683868
3869   if(s3.bus_size == 0)  // 8-bit
3869   if(ibm8514.bus_size == 0)  // 8-bit
38703870      data_size = 8;
3871   if(s3.bus_size == 1)  // 16-bit
3871   if(ibm8514.bus_size == 1)  // 16-bit
38723872      data_size = 16;
3873   if(s3.bus_size == 2)  // 32-bit
3873   if(ibm8514.bus_size == 2)  // 32-bit
38743874      data_size = 32;
38753875
38763876   for(x=0;x<data_size;x++)
r18236r18237
38903890      {
38913891         offset = (ibm8514.curr_y * VGA_LINE_LENGTH) + ibm8514.curr_x;
38923892         if(draw)
3893            s3_write(offset,offset);
3893            ibm8514_write(offset,offset);
38943894         switch(dir)
38953895         {
38963896         case 0:  // 0 degrees
r18236r18237
39353935            independent axis). Must be positive.
39363936     0-11  (80x +) RECTANGLE WIDTH/LINE PARAMETER MAX. See above
39373937 */
3938READ16_MEMBER(s3_vga_device::s3_width_r)
3938READ16_MEMBER(ati_vga_device::ibm8514_width_r)
39393939{
3940   return s3.rect_width;
3940   return ibm8514.rect_width;
39413941}
39423942
3943WRITE16_MEMBER(s3_vga_device::s3_width_w)
3943WRITE16_MEMBER(ati_vga_device::ibm8514_width_w)
39443944{
3945   s3.rect_width = data & 0x1fff;
3945   ibm8514.rect_width = data & 0x1fff;
39463946   if(LOG_8514) logerror("S3: Major Axis Pixel Count / Rectangle Width write %04x\n",data);
39473947}
39483948
3949READ16_MEMBER(s3_vga_device::ibm8514_currentx_r)
3949READ16_MEMBER(ati_vga_device::ibm8514_currentx_r)
39503950{
39513951   return ibm8514.curr_x;
39523952}
39533953
3954WRITE16_MEMBER(s3_vga_device::ibm8514_currentx_w)
3954WRITE16_MEMBER(ati_vga_device::ibm8514_currentx_w)
39553955{
39563956   ibm8514.curr_x = data;
39573957   ibm8514.prev_x = data;
39583958   if(LOG_8514) logerror("8514/A: Current X set to %04x (%i)\n",data,ibm8514.curr_x);
39593959}
39603960
3961READ16_MEMBER(s3_vga_device::ibm8514_currenty_r)
3961READ16_MEMBER(ati_vga_device::ibm8514_currenty_r)
39623962{
39633963   return ibm8514.curr_y;
39643964}
39653965
3966WRITE16_MEMBER(s3_vga_device::ibm8514_currenty_w)
3966WRITE16_MEMBER(ati_vga_device::ibm8514_currenty_w)
39673967{
39683968   ibm8514.curr_y = data;
39693969   ibm8514.prev_y = data;
39703970   if(LOG_8514) logerror("8514/A: Current Y set to %04x (%i)\n",data,ibm8514.curr_y);
39713971}
39723972
3973READ16_MEMBER(s3_vga_device::s3_fgcolour_r)
3973READ16_MEMBER(ati_vga_device::ibm8514_fgcolour_r)
39743974{
3975   return s3.fgcolour;
3975   return ibm8514.fgcolour;
39763976}
39773977
3978WRITE16_MEMBER(s3_vga_device::s3_fgcolour_w)
3978WRITE16_MEMBER(ati_vga_device::ibm8514_fgcolour_w)
39793979{
3980   s3.fgcolour = data;
3980   ibm8514.fgcolour = data;
39813981   if(LOG_8514) logerror("S3: Foreground Colour write %04x\n",data);
39823982}
39833983
3984READ16_MEMBER(s3_vga_device::s3_bgcolour_r)
3984READ16_MEMBER(ati_vga_device::ibm8514_bgcolour_r)
39853985{
3986   return s3.bgcolour;
3986   return ibm8514.bgcolour;
39873987}
39883988
3989WRITE16_MEMBER(s3_vga_device::s3_bgcolour_w)
3989WRITE16_MEMBER(ati_vga_device::ibm8514_bgcolour_w)
39903990{
3991   s3.bgcolour = data;
3991   ibm8514.bgcolour = data;
39923992   if(LOG_8514) logerror("S3: Background Colour write %04x\n",data);
39933993}
39943994
3995READ16_MEMBER(s3_vga_device::s3_multifunc_r )
3995READ16_MEMBER(ati_vga_device::ibm8514_multifunc_r )
39963996{
3997   switch(s3.multifunc_sel)
3997   switch(ibm8514.multifunc_sel)
39983998   {
39993999   case 0:
4000      return s3.rect_height;
4000      return ibm8514.rect_height;
40014001   case 1:
4002      return s3.scissors_top;
4002      return ibm8514.scissors_top;
40034003   case 2:
4004      return s3.scissors_left;
4004      return ibm8514.scissors_left;
40054005   case 3:
4006      return s3.scissors_bottom;
4006      return ibm8514.scissors_bottom;
40074007   case 4:
4008      return s3.scissors_right;
4008      return ibm8514.scissors_right;
40094009      // TODO: remaining functions
40104010   default:
4011      if(LOG_8514) logerror("S3: Unimplemented multifunction register %i selected\n",s3.multifunc_sel);
4011      if(LOG_8514) logerror("8514/A: Unimplemented multifunction register %i selected\n",ibm8514.multifunc_sel);
40124012      return 0xff;
40134013   }
40144014}
40154015
4016WRITE16_MEMBER(s3_vga_device::s3_multifunc_w )
4016WRITE16_MEMBER(ati_vga_device::ibm8514_multifunc_w )
40174017{
40184018   switch(data & 0xf000)
40194019   {
r18236r18237
40244024     0-11  (80x +) Rectangle Height. See above
40254025*/
40264026   case 0x0000:
4027      s3.rect_height = data & 0x0fff;
4028      if(LOG_8514) logerror("S3: Minor Axis Pixel Count / Rectangle Height write %04x\n",data);
4027      ibm8514.rect_height = data & 0x0fff;
4028      if(LOG_8514) logerror("8514/A: Minor Axis Pixel Count / Rectangle Height write %04x\n",data);
40294029      break;
40304030/*
40314031BEE8h index 01h W(R/W):  Top Scissors Register (SCISSORS_T).
r18236r18237
40494049     0-11  (80x +) Clipping Bottom Limit. See above.
40504050 */
40514051   case 0x1000:
4052      s3.scissors_top = data & 0x0fff;
4052      ibm8514.scissors_top = data & 0x0fff;
40534053      if(LOG_8514) logerror("S3: Scissors Top write %04x\n",data);
40544054      break;
40554055   case 0x2000:
4056      s3.scissors_left = data & 0x0fff;
4056      ibm8514.scissors_left = data & 0x0fff;
40574057      if(LOG_8514) logerror("S3: Scissors Left write %04x\n",data);
40584058      break;
40594059   case 0x3000:
4060      s3.scissors_bottom = data & 0x0fff;
4060      ibm8514.scissors_bottom = data & 0x0fff;
40614061      if(LOG_8514) logerror("S3: Scissors Bottom write %04x\n",data);
40624062      break;
40634063   case 0x4000:
4064      s3.scissors_right = data & 0x0fff;
4064      ibm8514.scissors_right = data & 0x0fff;
40654065      if(LOG_8514) logerror("S3: Scissors Right write %04x\n",data);
40664066      break;
40674067/*
r18236r18237
40754075             3  Video memory determines the Mix register used.
40764076 */
40774077   case 0xa000:
4078      s3.pixel_control = data;
4078      ibm8514.pixel_control = data;
40794079      if(LOG_8514) logerror("S3: Pixel control write %04x\n",data);
40804080      break;
40814081/*
r18236r18237
40974097            10: Read will return contents of BEE8h index 0Dh
40984098 */
40994099   case 0xf000:
4100      s3.multifunc_sel = data & 0x000f;
4100      ibm8514.multifunc_sel = data & 0x000f;
41014101      if(LOG_8514) logerror("S3: Multifunction select write %04x\n",data);
41024102   default:
41034103      if(LOG_8514) logerror("S3: Unimplemented multifunction register %i write %03x\n",data >> 12,data & 0x0fff);
41044104   }
41054105}
41064106
4107void s3_vga_device::s3_wait_draw()
4107void ati_vga_device::ibm8514_wait_draw()
41084108{
41094109   int x, data_size = 8;
41104110   UINT32 off;
41114111
41124112   // the data in the pixel transfer register or written to VRAM masks the rectangle output
4113   if(s3.bus_size == 0)  // 8-bit
4113   if(ibm8514.bus_size == 0)  // 8-bit
41144114      data_size = 8;
4115   if(s3.bus_size == 1)  // 16-bit
4115   if(ibm8514.bus_size == 1)  // 16-bit
41164116      data_size = 16;
4117   if(s3.bus_size == 2)  // 32-bit
4117   if(ibm8514.bus_size == 2)  // 32-bit
41184118      data_size = 32;
41194119   off = 0;
41204120   off += (VGA_LINE_LENGTH * ibm8514.curr_y);
41214121   off += ibm8514.curr_x;
4122   if(s3.current_cmd & 0x02) // "across plane mode"
4122   if(ibm8514.current_cmd & 0x02) // "across plane mode"
41234123   {
41244124      for(x=0;x<data_size;x++)
41254125      {
4126         s3_write(off % vga.svga_intf.vram_size,off % vga.svga_intf.vram_size);
4127         if(s3.current_cmd & 0x0020)
4126         ibm8514_write(off % vga.svga_intf.vram_size,off % vga.svga_intf.vram_size);
4127         if(ibm8514.current_cmd & 0x0020)
41284128         {
41294129            off++;
41304130            ibm8514.curr_x++;
4131            if(ibm8514.curr_x > ibm8514.prev_x + s3.rect_width)
4131            if(ibm8514.curr_x > ibm8514.prev_x + ibm8514.rect_width)
41324132            {
41334133               ibm8514.curr_x = ibm8514.prev_x;
4134               s3.src_x = 0;
4135               if(s3.current_cmd & 0x0080)
4134               ibm8514.src_x = 0;
4135               if(ibm8514.current_cmd & 0x0080)
41364136               {
41374137                  ibm8514.curr_y++;
4138                  if(ibm8514.curr_y > ibm8514.prev_y + s3.rect_height)
4138                  if(ibm8514.curr_y > ibm8514.prev_y + ibm8514.rect_height)
41394139                  {
41404140                     ibm8514.state = IBM8514_IDLE;
41414141                     ibm8514.data_avail = false;
r18236r18237
41454145               else
41464146               {
41474147                  ibm8514.curr_y--;
4148                  if(ibm8514.curr_y < ibm8514.prev_y - s3.rect_height)
4148                  if(ibm8514.curr_y < ibm8514.prev_y - ibm8514.rect_height)
41494149                  {
41504150                     ibm8514.state = IBM8514_IDLE;
41514151                     ibm8514.data_avail = false;
r18236r18237
41594159         {
41604160            off--;
41614161            ibm8514.curr_x--;
4162            if(ibm8514.curr_x < ibm8514.prev_x - s3.rect_width)
4162            if(ibm8514.curr_x < ibm8514.prev_x - ibm8514.rect_width)
41634163            {
41644164               ibm8514.curr_x = ibm8514.prev_x;
4165               s3.src_x = 0;
4166               if(s3.current_cmd & 0x0080)
4165               ibm8514.src_x = 0;
4166               if(ibm8514.current_cmd & 0x0080)
41674167               {
41684168                  ibm8514.curr_y++;
4169                  if(ibm8514.curr_y > ibm8514.prev_y + s3.rect_height)
4169                  if(ibm8514.curr_y > ibm8514.prev_y + ibm8514.rect_height)
41704170                  {
41714171                     ibm8514.state = IBM8514_IDLE;
41724172                     ibm8514.gpbusy = false;
r18236r18237
41764176               else
41774177               {
41784178                  ibm8514.curr_y--;
4179                  if(ibm8514.curr_y < ibm8514.prev_y - s3.rect_height)
4179                  if(ibm8514.curr_y < ibm8514.prev_y - ibm8514.rect_height)
41804180                  {
41814181                     ibm8514.state = IBM8514_IDLE;
41824182                     ibm8514.gpbusy = false;
r18236r18237
41934193      // "through plane" mode (single pixel)
41944194      for(x=0;x<data_size;x+=8)
41954195      {
4196         s3_write(off % vga.svga_intf.vram_size,off % vga.svga_intf.vram_size);
4196         ibm8514_write(off % vga.svga_intf.vram_size,off % vga.svga_intf.vram_size);
41974197
4198         if(s3.current_cmd & 0x0020)
4198         if(ibm8514.current_cmd & 0x0020)
41994199         {
42004200            off++;
42014201            ibm8514.curr_x++;
4202            if(ibm8514.curr_x > ibm8514.prev_x + s3.rect_width)
4202            if(ibm8514.curr_x > ibm8514.prev_x + ibm8514.rect_width)
42034203            {
42044204               ibm8514.curr_x = ibm8514.prev_x;
4205               s3.src_x = 0;
4206               if(s3.current_cmd & 0x0080)
4205               ibm8514.src_x = 0;
4206               if(ibm8514.current_cmd & 0x0080)
42074207               {
42084208                  ibm8514.curr_y++;
4209                  if(ibm8514.curr_y > ibm8514.prev_y + s3.rect_height)
4209                  if(ibm8514.curr_y > ibm8514.prev_y + ibm8514.rect_height)
42104210                  {
42114211                     ibm8514.state = IBM8514_IDLE;
42124212                     ibm8514.gpbusy = false;
r18236r18237
42164216               else
42174217               {
42184218                  ibm8514.curr_y--;
4219                  if(ibm8514.curr_y < ibm8514.prev_y - s3.rect_height)
4219                  if(ibm8514.curr_y < ibm8514.prev_y - ibm8514.rect_height)
42204220                  {
42214221                     ibm8514.state = IBM8514_IDLE;
42224222                     ibm8514.gpbusy = false;
r18236r18237
42304230         {
42314231            off--;
42324232            ibm8514.curr_x--;
4233            if(ibm8514.curr_x < ibm8514.prev_x - s3.rect_width)
4233            if(ibm8514.curr_x < ibm8514.prev_x - ibm8514.rect_width)
42344234            {
42354235               ibm8514.curr_x = ibm8514.prev_x;
4236               s3.src_x = 0;
4237               if(s3.current_cmd & 0x0080)
4236               ibm8514.src_x = 0;
4237               if(ibm8514.current_cmd & 0x0080)
42384238               {
42394239                  ibm8514.curr_y++;
4240                  if(ibm8514.curr_y > ibm8514.prev_y + s3.rect_height)
4240                  if(ibm8514.curr_y > ibm8514.prev_y + ibm8514.rect_height)
42414241                  {
42424242                     ibm8514.state = IBM8514_IDLE;
42434243                     ibm8514.gpbusy = false;
r18236r18237
42474247               else
42484248               {
42494249                  ibm8514.curr_y--;
4250                  if(ibm8514.curr_y < ibm8514.prev_y - s3.rect_height)
4250                  if(ibm8514.curr_y < ibm8514.prev_y - ibm8514.rect_height)
42514251                  {
42524252                     ibm8514.state = IBM8514_IDLE;
42534253                     ibm8514.gpbusy = false;
r18236r18237
42884288             2  BSS is Pixel Data from the PIX_TRANS register (E2E8h)
42894289             3  BSS is Bitmap Data (Source data from display buffer).
42904290 */
4291READ16_MEMBER(s3_vga_device::s3_backmix_r)
4291READ16_MEMBER(ati_vga_device::ibm8514_backmix_r)
42924292{
4293   return s3.bgmix;
4293   return ibm8514.bgmix;
42944294}
42954295
4296WRITE16_MEMBER(s3_vga_device::s3_backmix_w)
4296WRITE16_MEMBER(ati_vga_device::ibm8514_backmix_w)
42974297{
4298   s3.bgmix = data;
4299   if(LOG_8514) logerror("S3: BG Mix write %04x\n",data);
4298   ibm8514.bgmix = data;
4299   if(LOG_8514) logerror("8514/A: BG Mix write %04x\n",data);
43004300}
43014301
4302READ16_MEMBER(s3_vga_device::s3_foremix_r)
4302READ16_MEMBER(ati_vga_device::ibm8514_foremix_r)
43034303{
4304   return s3.fgmix;
4304   return ibm8514.fgmix;
43054305}
43064306
4307WRITE16_MEMBER(s3_vga_device::s3_foremix_w)
4307WRITE16_MEMBER(ati_vga_device::ibm8514_foremix_w)
43084308{
4309   s3.fgmix = data;
4310   if(LOG_8514) logerror("S3: FG Mix write %04x\n",data);
4309   ibm8514.fgmix = data;
4310   if(LOG_8514) logerror("8514/A: FG Mix write %04x\n",data);
43114311}
43124312
4313READ16_MEMBER(s3_vga_device::s3_pixel_xfer_r)
4313READ16_MEMBER(ati_vga_device::ibm8514_pixel_xfer_r)
43144314{
43154315   if(offset == 1)
4316      return (s3.pixel_xfer & 0xffff0000) >> 16;
4316      return (ibm8514.pixel_xfer & 0xffff0000) >> 16;
43174317   else
4318      return s3.pixel_xfer & 0x0000ffff;
4318      return ibm8514.pixel_xfer & 0x0000ffff;
43194319}
43204320
4321WRITE16_MEMBER(s3_vga_device::s3_pixel_xfer_w)
4321WRITE16_MEMBER(ati_vga_device::ibm8514_pixel_xfer_w)
43224322{
43234323   if(offset == 1)
4324      s3.pixel_xfer = (s3.pixel_xfer & 0x0000ffff) | (data << 16);
4324      ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0x0000ffff) | (data << 16);
43254325   else
4326      s3.pixel_xfer = (s3.pixel_xfer & 0xffff0000) | data;
4326      ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0xffff0000) | data;
43274327
43284328   if(ibm8514.state == IBM8514_DRAWING_RECT)
4329      s3_wait_draw();
4329      ibm8514_wait_draw();
43304330
43314331   if(ibm8514.state == IBM8514_DRAWING_SSV_1 || ibm8514.state == IBM8514_DRAWING_SSV_2)
43324332      ibm8514_wait_draw_ssv();
r18236r18237
43344334   if(ibm8514.state == IBM8514_DRAWING_LINE)
43354335      ibm8514_wait_draw_vector();
43364336
4337   if(LOG_8514) logerror("S3: Pixel Transfer = %08x\n",s3.pixel_xfer);
4337   if(LOG_8514) logerror("S3: Pixel Transfer = %08x\n",ibm8514.pixel_xfer);
43384338}
43394339
43404340READ8_MEMBER(s3_vga_device::mem_r)
r18236r18237
43714371      if(offset < 0x8000)
43724372      {
43734373         // pass through to the pixel transfer register (DirectX 5 wants this)
4374         if(s3.bus_size == 0)
4374         if(ibm8514.bus_size == 0)
43754375         {
4376            s3.pixel_xfer = (s3.pixel_xfer & 0xffffff00) | data;
4377            s3_wait_draw();
4376            ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0xffffff00) | data;
4377            ibm8514_wait_draw();
43784378         }
4379         if(s3.bus_size == 1)
4379         if(ibm8514.bus_size == 1)
43804380         {
43814381            switch(offset & 0x0001)
43824382            {
43834383            case 0:
43844384            default:
4385               s3.pixel_xfer = (s3.pixel_xfer & 0xffffff00) | data;
4385               ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0xffffff00) | data;
43864386               break;
43874387            case 1:
4388               s3.pixel_xfer = (s3.pixel_xfer & 0xffff00ff) | (data << 8);
4389               s3_wait_draw();
4388               ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0xffff00ff) | (data << 8);
4389               ibm8514_wait_draw();
43904390               break;
43914391            }
43924392         }
4393         if(s3.bus_size == 2)
4393         if(ibm8514.bus_size == 2)
43944394         {
43954395            switch(offset & 0x0003)
43964396            {
43974397            case 0:
43984398            default:
4399               s3.pixel_xfer = (s3.pixel_xfer & 0xffffff00) | data;
4399               ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0xffffff00) | data;
44004400               break;
44014401            case 1:
4402               s3.pixel_xfer = (s3.pixel_xfer & 0xffff00ff) | (data << 8);
4402               ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0xffff00ff) | (data << 8);
44034403               break;
44044404            case 2:
4405               s3.pixel_xfer = (s3.pixel_xfer & 0xff00ffff) | (data << 16);
4405               ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0xff00ffff) | (data << 16);
44064406               break;
44074407            case 3:
4408               s3.pixel_xfer = (s3.pixel_xfer & 0x00ffffff) | (data << 24);
4409               s3_wait_draw();
4408               ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0x00ffffff) | (data << 24);
4409               ibm8514_wait_draw();
44104410               break;
44114411            }
44124412         }
r18236r18237
44654465         break;
44664466      case 0x8120:
44674467      case 0xa2e8:
4468         s3.bgcolour = (s3.bgcolour & 0xff00) | data;
4468         ibm8514.bgcolour = (ibm8514.bgcolour & 0xff00) | data;
44694469         break;
44704470      case 0x8121:
44714471      case 0xa2e9:
4472         s3.bgcolour = (s3.bgcolour & 0x00ff) | (data << 8);
4472         ibm8514.bgcolour = (ibm8514.bgcolour & 0x00ff) | (data << 8);
44734473         break;
44744474      case 0x8124:
44754475      case 0xa6e8:
4476         s3.fgcolour = (s3.fgcolour & 0xff00) | data;
4476         ibm8514.fgcolour = (ibm8514.fgcolour & 0xff00) | data;
44774477         break;
44784478      case 0x8125:
44794479      case 0xa6e9:
4480         s3.fgcolour = (s3.fgcolour & 0x00ff) | (data << 8);
4480         ibm8514.fgcolour = (ibm8514.fgcolour & 0x00ff) | (data << 8);
44814481         break;
44824482      case 0xb6e8:
44834483      case 0x8134:
4484         s3.bgmix = (s3.bgmix & 0xff00) | data;
4484         ibm8514.bgmix = (ibm8514.bgmix & 0xff00) | data;
44854485         break;
44864486      case 0x8135:
44874487      case 0xb6e9:
4488         s3.bgmix = (s3.bgmix & 0x00ff) | (data << 8);
4488         ibm8514.bgmix = (ibm8514.bgmix & 0x00ff) | (data << 8);
44894489         break;
44904490      case 0x8136:
44914491      case 0xbae8:
4492         s3.fgmix = (s3.fgmix & 0xff00) | data;
4492         ibm8514.fgmix = (ibm8514.fgmix & 0xff00) | data;
44934493         break;
44944494      case 0x8137:
44954495      case 0xbae9:
4496         s3.fgmix = (s3.fgmix & 0x00ff) | (data << 8);
4496         ibm8514.fgmix = (ibm8514.fgmix & 0x00ff) | (data << 8);
44974497         break;
44984498      case 0x8138:
4499         s3.scissors_top = (s3.scissors_top & 0xff00) | data;
4499         ibm8514.scissors_top = (ibm8514.scissors_top & 0xff00) | data;
45004500         break;
45014501      case 0x8139:
4502         s3.scissors_top = (s3.scissors_top & 0x00ff) | (data << 8);
4502         ibm8514.scissors_top = (ibm8514.scissors_top & 0x00ff) | (data << 8);
45034503         break;
45044504      case 0x813a:
4505         s3.scissors_left = (s3.scissors_left & 0xff00) | data;
4505         ibm8514.scissors_left = (ibm8514.scissors_left & 0xff00) | data;
45064506         break;
45074507      case 0x813b:
4508         s3.scissors_left = (s3.scissors_left & 0x00ff) | (data << 8);
4508         ibm8514.scissors_left = (ibm8514.scissors_left & 0x00ff) | (data << 8);
45094509         break;
45104510      case 0x813c:
4511         s3.scissors_bottom = (s3.scissors_bottom & 0xff00) | data;
4511         ibm8514.scissors_bottom = (ibm8514.scissors_bottom & 0xff00) | data;
45124512         break;
45134513      case 0x813d:
4514         s3.scissors_bottom = (s3.scissors_bottom & 0x00ff) | (data << 8);
4514         ibm8514.scissors_bottom = (ibm8514.scissors_bottom & 0x00ff) | (data << 8);
45154515         break;
45164516      case 0x813e:
4517         s3.scissors_right = (s3.scissors_right & 0xff00) | data;
4517         ibm8514.scissors_right = (ibm8514.scissors_right & 0xff00) | data;
45184518         break;
45194519      case 0x813f:
4520         s3.scissors_right = (s3.scissors_right & 0x00ff) | (data << 8);
4520         ibm8514.scissors_right = (ibm8514.scissors_right & 0x00ff) | (data << 8);
45214521         break;
45224522      case 0x8140:
4523         s3.pixel_control = (s3.pixel_control & 0xff00) | data;
4523         ibm8514.pixel_control = (ibm8514.pixel_control & 0xff00) | data;
45244524         break;
45254525      case 0x8141:
4526         s3.pixel_control = (s3.pixel_control & 0x00ff) | (data << 8);
4526         ibm8514.pixel_control = (ibm8514.pixel_control & 0x00ff) | (data << 8);
45274527         break;
45284528      case 0x8146:
4529         s3.multifunc_sel = (s3.multifunc_sel & 0xff00) | data;
4529         ibm8514.multifunc_sel = (ibm8514.multifunc_sel & 0xff00) | data;
45304530         break;
45314531      case 0x8148:
4532         s3.rect_height = (s3.rect_height & 0xff00) | data;
4532         ibm8514.rect_height = (ibm8514.rect_height & 0xff00) | data;
45334533         break;
45344534      case 0x8149:
4535         s3.rect_height = (s3.rect_height & 0x00ff) | (data << 8);
4535         ibm8514.rect_height = (ibm8514.rect_height & 0x00ff) | (data << 8);
45364536         break;
45374537      case 0x814a:
4538         s3.rect_width = (s3.rect_width & 0xff00) | data;
4538         ibm8514.rect_width = (ibm8514.rect_width & 0xff00) | data;
45394539         break;
45404540      case 0x814b:
4541         s3.rect_width = (s3.rect_width & 0x00ff) | (data << 8);
4541         ibm8514.rect_width = (ibm8514.rect_width & 0x00ff) | (data << 8);
45424542         break;
45434543      case 0x8150:
4544         s3.pixel_xfer = (s3.pixel_xfer & 0xffffff00) | data;
4544         ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0xffffff00) | data;
45454545         if(ibm8514.state == IBM8514_DRAWING_RECT)
4546            s3_wait_draw();
4546            ibm8514_wait_draw();
45474547         break;
45484548      case 0x8151:
4549         s3.pixel_xfer = (s3.pixel_xfer & 0xffff00ff) | (data << 8);
4549         ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0xffff00ff) | (data << 8);
45504550         if(ibm8514.state == IBM8514_DRAWING_RECT)
4551            s3_wait_draw();
4551            ibm8514_wait_draw();
45524552         break;
45534553      case 0x8152:
4554         s3.pixel_xfer = (s3.pixel_xfer & 0xff00ffff) | (data << 16);
4554         ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0xff00ffff) | (data << 16);
45554555         if(ibm8514.state == IBM8514_DRAWING_RECT)
4556            s3_wait_draw();
4556            ibm8514_wait_draw();
45574557         break;
45584558      case 0x8153:
4559         s3.pixel_xfer = (s3.pixel_xfer & 0x00ffffff) | (data << 24);
4559         ibm8514.pixel_xfer = (ibm8514.pixel_xfer & 0x00ffffff) | (data << 24);
45604560         if(ibm8514.state == IBM8514_DRAWING_RECT)
4561            s3_wait_draw();
4561            ibm8514_wait_draw();
45624562         break;
45634563      case 0xbee8:
45644564         s3.mmio_bee8 = (s3.mmio_bee8 & 0xff00) | data;
45654565         break;
45664566      case 0xbee9:
45674567         s3.mmio_bee8 = (s3.mmio_bee8 & 0x00ff) | (data << 8);
4568         s3_multifunc_w(space,0,s3.mmio_bee8,0xffff);
4568         ibm8514_multifunc_w(space,0,s3.mmio_bee8,0xffff);
45694569         break;
45704570      default:
45714571         if(LOG_8514) logerror("S3: MMIO offset %05x write %02x\n",offset+0xa0000,data);
r18236r18237
50585058
50595059READ16_MEMBER(ati_vga_device::mach8_bresenham_count_r)
50605060{
5061   return s3.rect_width & 0x1fff;
5061   return ibm8514.rect_width & 0x1fff;
50625062}
50635063
50645064WRITE16_MEMBER(ati_vga_device::mach8_bresenham_count_w)
50655065{
5066   s3.rect_width = data & 0x1fff;
5066   ibm8514.rect_width = data & 0x1fff;
50675067   if(LOG_8514) logerror("Mach8: Bresenham count write %04x\n",data);
50685068}
50695069
trunk/src/emu/video/pc_vga.h
r18236r18237
287287extern const device_type TRIDENT_VGA;
288288
289289
290// ======================> s3_vga_device
290// ======================> ati_vga_device
291291
292class s3_vga_device :  public svga_device
292class ati_vga_device :  public svga_device
293293{
294294public:
295295    // construction/destruction
296    s3_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
297   s3_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
296    ati_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
297    ati_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
298298
299   virtual READ8_MEMBER(port_03b0_r);
300   virtual WRITE8_MEMBER(port_03b0_w);
301   virtual READ8_MEMBER(port_03c0_r);
302   virtual WRITE8_MEMBER(port_03c0_w);
303   virtual READ8_MEMBER(port_03d0_r);
304   virtual WRITE8_MEMBER(port_03d0_w);
305299   virtual READ8_MEMBER(mem_r);
306300   virtual WRITE8_MEMBER(mem_w);
307   
308   virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
309   
310   READ16_MEMBER(s3_line_error_r);
311   WRITE16_MEMBER(s3_line_error_w);
301
302   // VGA registers
303   virtual READ8_MEMBER(port_03c0_r);
304   READ8_MEMBER(ati_port_ext_r);
305   WRITE8_MEMBER(ati_port_ext_w);
306
307   // TODO: move 8514/A registers to their own device
312308   READ16_MEMBER(ibm8514_gpstatus_r);
313   READ16_MEMBER(s3_gpstatus_r);
314309   WRITE16_MEMBER(ibm8514_cmd_w);
315   WRITE16_MEMBER(s3_cmd_w);
310   READ16_MEMBER(ibm8514_line_error_r);
311   WRITE16_MEMBER(ibm8514_line_error_w);
312   READ16_MEMBER(ibm8514_status_r);
313   WRITE16_MEMBER(ibm8514_htotal_w);
314   READ16_MEMBER(ibm8514_substatus_r);
315   WRITE16_MEMBER(ibm8514_subcontrol_w);
316   READ16_MEMBER(ibm8514_subcontrol_r);
317   READ16_MEMBER(ibm8514_htotal_r);
318   READ16_MEMBER(ibm8514_vtotal_r);
319   WRITE16_MEMBER(ibm8514_vtotal_w);
320   READ16_MEMBER(ibm8514_vdisp_r);
321   WRITE16_MEMBER(ibm8514_vdisp_w);
322   READ16_MEMBER(ibm8514_vsync_r);
323   WRITE16_MEMBER(ibm8514_vsync_w);
316324   READ16_MEMBER(ibm8514_desty_r);
317325   WRITE16_MEMBER(ibm8514_desty_w);
318326   READ16_MEMBER(ibm8514_destx_r);
319327   WRITE16_MEMBER(ibm8514_destx_w);
320328   READ16_MEMBER(ibm8514_ssv_r);
321329   WRITE16_MEMBER(ibm8514_ssv_w);
322   READ16_MEMBER(s3_width_r);
323   WRITE16_MEMBER(s3_width_w);
324330   READ16_MEMBER(ibm8514_currentx_r);
325331   WRITE16_MEMBER(ibm8514_currentx_w);
326332   READ16_MEMBER(ibm8514_currenty_r);
327333   WRITE16_MEMBER(ibm8514_currenty_w);
328   READ16_MEMBER(s3_fgcolour_r);
329   WRITE16_MEMBER(s3_fgcolour_w);
330   READ16_MEMBER(s3_bgcolour_r);
331   WRITE16_MEMBER(s3_bgcolour_w);
332   READ16_MEMBER(s3_multifunc_r);
333   WRITE16_MEMBER(s3_multifunc_w);
334   READ16_MEMBER(s3_backmix_r);
335   WRITE16_MEMBER(s3_backmix_w);
336   READ16_MEMBER(s3_foremix_r);
337   WRITE16_MEMBER(s3_foremix_w);
338   READ16_MEMBER(s3_pixel_xfer_r);
339   WRITE16_MEMBER(s3_pixel_xfer_w);
340   
334   READ16_MEMBER(ibm8514_width_r);
335   WRITE16_MEMBER(ibm8514_width_w);
336   READ16_MEMBER(ibm8514_fgcolour_r);
337   WRITE16_MEMBER(ibm8514_fgcolour_w);
338   READ16_MEMBER(ibm8514_bgcolour_r);
339   WRITE16_MEMBER(ibm8514_bgcolour_w);
340   READ16_MEMBER(ibm8514_multifunc_r);
341   WRITE16_MEMBER(ibm8514_multifunc_w);
342   READ16_MEMBER(ibm8514_backmix_r);
343   WRITE16_MEMBER(ibm8514_backmix_w);
344   READ16_MEMBER(ibm8514_foremix_r);
345   WRITE16_MEMBER(ibm8514_foremix_w);
346   READ16_MEMBER(ibm8514_pixel_xfer_r);
347   WRITE16_MEMBER(ibm8514_pixel_xfer_w);
348
349   // extra registers for the Mach8
350   READ16_MEMBER(mach8_ec0_r);
351   WRITE16_MEMBER(mach8_ec0_w);
352   READ16_MEMBER(mach8_ec1_r);
353   WRITE16_MEMBER(mach8_ec1_w);
354   READ16_MEMBER(mach8_ec2_r);
355   WRITE16_MEMBER(mach8_ec2_w);
356   READ16_MEMBER(mach8_ec3_r);
357   WRITE16_MEMBER(mach8_ec3_w);
358   READ16_MEMBER(mach8_ext_fifo_r);
359   WRITE16_MEMBER(mach8_linedraw_index_w);
360   READ16_MEMBER(mach8_bresenham_count_r);
361   WRITE16_MEMBER(mach8_bresenham_count_w);
362   WRITE16_MEMBER(mach8_linedraw_w);
363   READ16_MEMBER(mach8_scratch0_r);
364   WRITE16_MEMBER(mach8_scratch0_w);
365   READ16_MEMBER(mach8_scratch1_r);
366   WRITE16_MEMBER(mach8_scratch1_w);
367   READ16_MEMBER(mach8_config1_r);
368   READ16_MEMBER(mach8_config2_r);
341369protected:
342    // device-level overrides
343    virtual void device_start();
344
370   virtual machine_config_constructor device_mconfig_additions() const;
371   void ibm8514_wait_draw();
345372   struct
346373   {
347      UINT8 memory_config;
348      UINT8 ext_misc_ctrl_2;
349      UINT8 crt_reg_lock;
350      UINT8 reg_lock1;
351      UINT8 reg_lock2;
352      UINT8 enable_8514;
353      UINT8 cr53;
354      UINT16 current_cmd;
355      UINT16 src_x;
356      UINT16 src_y;
357      UINT16 rect_width;
358      UINT16 rect_height;
359      UINT32 fgcolour;
360      UINT32 bgcolour;
361      UINT16 fgmix;
362      UINT16 bgmix;
363      UINT32 pixel_xfer;
364      INT16 scissors_left;
365      INT16 scissors_right;
366      INT16 scissors_top;
367      INT16 scissors_bottom;
368      UINT16 pixel_control;
369      UINT8 bus_size;
370      UINT8 multifunc_sel;
371      UINT8 write_count;
372
373      // data for memory-mapped I/O
374      UINT16 mmio_9ae8;
375      UINT16 mmio_bee8;
376
377      // hardware graphics cursor
378      UINT8 cursor_mode;
379      UINT16 cursor_x;
380      UINT16 cursor_y;
381      UINT16 cursor_start_addr;
382      UINT8 cursor_pattern_x;  // cursor pattern origin
383      UINT8 cursor_pattern_y;
384      UINT8 cursor_fg[4];
385      UINT8 cursor_bg[4];
386      UINT8 cursor_fg_ptr;
387      UINT8 cursor_bg_ptr;
388      UINT8 extended_dac_ctrl;
389   } s3;   
390   struct
391   {
392374      UINT16 htotal;  // Horizontal total (9 bits)
393375      UINT16 vtotal;  // Vertical total adjust (3 bits), Vertical total base (9 bit)
394376      UINT16 vdisp;
r18236r18237
411393      INT16 line_axial_step;
412394      INT16 line_diagonal_step;
413395      INT16 line_errorterm;
396      UINT16 current_cmd;
397      UINT16 src_x;
398      UINT16 src_y;
399      INT16 scissors_left;
400      INT16 scissors_right;
401      INT16 scissors_top;
402      INT16 scissors_bottom;
403      UINT16 rect_width;
404      UINT16 rect_height;
405      UINT32 fgcolour;
406      UINT32 bgcolour;
407      UINT16 fgmix;
408      UINT16 bgmix;
409      UINT32 pixel_xfer;
410      UINT16 pixel_control;
411      UINT8 bus_size;
412      UINT8 multifunc_sel;
413
414414      int state;
415
416415      UINT8 wait_vector_len;
417416      UINT8 wait_vector_dir;
418417      bool wait_vector_draw;
r18236r18237
420419
421420   } ibm8514;
422421private:
423   UINT8 s3_crtc_reg_read(UINT8 index);
424   void s3_define_video_mode(void);
425   void s3_crtc_reg_write(UINT8 index, UINT8 data);
426   void s3_write_fg(UINT32 offset);
427   void s3_write_bg(UINT32 offset);
428   void s3_write(UINT32 offset, UINT32 src);
422   void ati_define_video_mode();
429423   void ibm8514_draw_vector(UINT8 len, UINT8 dir, bool draw);
430424   void ibm8514_wait_draw_ssv();
431425   void ibm8514_draw_ssv(UINT8 data);
432426   void ibm8514_wait_draw_vector();
433   void s3_wait_draw();
427   struct
428   {
429      UINT8 ext_reg[64];
430      UINT8 ext_reg_select;
431      UINT16 scratch0;
432      UINT16 scratch1;
433      UINT16 linedraw;
434   } ati;
435   void ibm8514_write_fg(UINT32 offset);
436   void ibm8514_write_bg(UINT32 offset);
437   void ibm8514_write(UINT32 offset, UINT32 src);
434438};
435439
436
437440// device type definition
438extern const device_type S3_VGA;
441extern const device_type ATI_VGA;
439442
440443
441// ======================> gamtor_vga_device
444// ======================> s3_vga_device
442445
443class gamtor_vga_device :  public svga_device
446class s3_vga_device :  public ati_vga_device
444447{
445448public:
446449    // construction/destruction
447    gamtor_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
450    s3_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
448451
449
450452   virtual READ8_MEMBER(port_03b0_r);
451453   virtual WRITE8_MEMBER(port_03b0_w);
452454   virtual READ8_MEMBER(port_03c0_r);
r18236r18237
456458   virtual READ8_MEMBER(mem_r);
457459   virtual WRITE8_MEMBER(mem_w);
458460   
461   virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
462   
463   READ16_MEMBER(s3_gpstatus_r);
464   WRITE16_MEMBER(s3_cmd_w);
465   
459466protected:
467    // device-level overrides
468    virtual void device_start();
469   struct
470   {
471      UINT8 memory_config;
472      UINT8 ext_misc_ctrl_2;
473      UINT8 crt_reg_lock;
474      UINT8 reg_lock1;
475      UINT8 reg_lock2;
476      UINT8 enable_8514;
477      UINT8 cr53;
478
479      // data for memory-mapped I/O
480      UINT16 mmio_9ae8;
481      UINT16 mmio_bee8;
482
483      // hardware graphics cursor
484      UINT8 cursor_mode;
485      UINT16 cursor_x;
486      UINT16 cursor_y;
487      UINT16 cursor_start_addr;
488      UINT8 cursor_pattern_x;  // cursor pattern origin
489      UINT8 cursor_pattern_y;
490      UINT8 cursor_fg[4];
491      UINT8 cursor_bg[4];
492      UINT8 cursor_fg_ptr;
493      UINT8 cursor_bg_ptr;
494      UINT8 extended_dac_ctrl;
495   } s3;   
460496private:
497   UINT8 s3_crtc_reg_read(UINT8 index);
498   void s3_define_video_mode(void);
499   void s3_crtc_reg_write(UINT8 index, UINT8 data);
461500};
462501
463502
464503// device type definition
465extern const device_type GAMTOR_VGA;
504extern const device_type S3_VGA;
466505
467// ======================> ati_vga_device
468506
469class ati_vga_device :  public s3_vga_device
507// ======================> gamtor_vga_device
508
509class gamtor_vga_device :  public svga_device
470510{
471511public:
472512    // construction/destruction
473    ati_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
513    gamtor_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
474514
515
516   virtual READ8_MEMBER(port_03b0_r);
517   virtual WRITE8_MEMBER(port_03b0_w);
518   virtual READ8_MEMBER(port_03c0_r);
519   virtual WRITE8_MEMBER(port_03c0_w);
520   virtual READ8_MEMBER(port_03d0_r);
521   virtual WRITE8_MEMBER(port_03d0_w);
475522   virtual READ8_MEMBER(mem_r);
476523   virtual WRITE8_MEMBER(mem_w);
477   virtual READ8_MEMBER(port_03c0_r);
478   READ8_MEMBER(ati_port_ext_r);
479   WRITE8_MEMBER(ati_port_ext_w);
480   READ16_MEMBER(ibm8514_status_r);
481   WRITE16_MEMBER(ibm8514_htotal_w);
482   READ16_MEMBER(ibm8514_substatus_r);
483   WRITE16_MEMBER(ibm8514_subcontrol_w);
484   READ16_MEMBER(ibm8514_subcontrol_r);
485   READ16_MEMBER(ibm8514_htotal_r);
486   READ16_MEMBER(ibm8514_vtotal_r);
487   WRITE16_MEMBER(ibm8514_vtotal_w);
488   READ16_MEMBER(ibm8514_vdisp_r);
489   WRITE16_MEMBER(ibm8514_vdisp_w);
490   READ16_MEMBER(ibm8514_vsync_r);
491   WRITE16_MEMBER(ibm8514_vsync_w);
492   READ16_MEMBER(mach8_ec0_r);
493   WRITE16_MEMBER(mach8_ec0_w);
494   READ16_MEMBER(mach8_ec1_r);
495   WRITE16_MEMBER(mach8_ec1_w);
496   READ16_MEMBER(mach8_ec2_r);
497   WRITE16_MEMBER(mach8_ec2_w);
498   READ16_MEMBER(mach8_ec3_r);
499   WRITE16_MEMBER(mach8_ec3_w);
500   READ16_MEMBER(mach8_ext_fifo_r);
501   WRITE16_MEMBER(mach8_linedraw_index_w);
502   READ16_MEMBER(mach8_bresenham_count_r);
503   WRITE16_MEMBER(mach8_bresenham_count_w);
504   WRITE16_MEMBER(mach8_linedraw_w);
505   READ16_MEMBER(mach8_scratch0_r);
506   WRITE16_MEMBER(mach8_scratch0_w);
507   READ16_MEMBER(mach8_scratch1_r);
508   WRITE16_MEMBER(mach8_scratch1_w);
509   READ16_MEMBER(mach8_config1_r);
510   READ16_MEMBER(mach8_config2_r);   
524   
511525protected:
512   virtual machine_config_constructor device_mconfig_additions() const;
513526private:
514   void ati_define_video_mode();
515   struct
516   {
517      UINT8 ext_reg[64];
518      UINT8 ext_reg_select;
519      UINT16 scratch0;
520      UINT16 scratch1;
521      UINT16 linedraw;
522   } ati;
523527};
524528
525529
526530// device type definition
527extern const device_type ATI_VGA;
531extern const device_type GAMTOR_VGA;
528532
529533// ======================> cirrus_vga_device
530534
trunk/src/mess/video/isa_svga_s3.c
r18236r18237
5555//**************************************************************************
5656
5757//-------------------------------------------------
58//  isa8_vga_device - constructor
58//  isa16_vga_device - constructor
5959//-------------------------------------------------
6060
6161isa16_svga_s3_device::isa16_svga_s3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
r18236r18237
8585   m_isa->install16_device(0x86e8, 0x86eb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_currentx_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_currentx_w),m_vga));
8686   m_isa->install16_device(0x8ae8, 0x8aeb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_desty_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_desty_w),m_vga));
8787   m_isa->install16_device(0x8ee8, 0x8eeb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_destx_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_destx_w),m_vga));
88   m_isa->install16_device(0x92e8, 0x92eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_line_error_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_line_error_w),m_vga));
89   m_isa->install16_device(0x96e8, 0x96eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_width_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_width_w),m_vga));
88   m_isa->install16_device(0x92e8, 0x92eb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_line_error_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_line_error_w),m_vga));
89   m_isa->install16_device(0x96e8, 0x96eb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_width_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_width_w),m_vga));
9090   m_isa->install16_device(0x9ae8, 0x9aeb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_gpstatus_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_cmd_w),m_vga));
9191   m_isa->install16_device(0x9ee8, 0x9eeb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_ssv_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_ssv_w),m_vga));
92   m_isa->install16_device(0xa2e8, 0xa2eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_bgcolour_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_bgcolour_w),m_vga));
93   m_isa->install16_device(0xa6e8, 0xa6eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_fgcolour_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_fgcolour_w),m_vga));
94   m_isa->install16_device(0xb6e8, 0xb6eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_backmix_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_backmix_w),m_vga));
95   m_isa->install16_device(0xbae8, 0xbaeb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_foremix_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_foremix_w),m_vga));
96   m_isa->install16_device(0xbee8, 0xbeeb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_multifunc_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_multifunc_w),m_vga));
97   m_isa->install16_device(0xe2e8, 0xe2eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_pixel_xfer_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_pixel_xfer_w),m_vga));
92   m_isa->install16_device(0xa2e8, 0xa2eb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_bgcolour_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_bgcolour_w),m_vga));
93   m_isa->install16_device(0xa6e8, 0xa6eb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_fgcolour_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_fgcolour_w),m_vga));
94   m_isa->install16_device(0xb6e8, 0xb6eb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_backmix_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_backmix_w),m_vga));
95   m_isa->install16_device(0xbae8, 0xbaeb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_foremix_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_foremix_w),m_vga));
96   m_isa->install16_device(0xbee8, 0xbeeb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_multifunc_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_multifunc_w),m_vga));
97   m_isa->install16_device(0xe2e8, 0xe2eb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_pixel_xfer_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_pixel_xfer_w),m_vga));
9898
9999   m_isa->install_memory(0xa0000, 0xbffff, 0, 0, read8_delegate(FUNC(s3_vga_device::mem_r),m_vga), write8_delegate(FUNC(s3_vga_device::mem_w),m_vga));
100100}
trunk/src/mess/video/isa_svga_s3.h
r18236r18237
1111//  TYPE DEFINITIONS
1212//**************************************************************************
1313
14// ======================> isa8_vga_device
14// ======================> isa16_vga_device
1515
1616class isa16_svga_s3_device :
1717      public device_t,
trunk/src/mess/video/isa_vga_ati.c
r18236r18237
103103   m_isa->install16_device(0x86e8, 0x86eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_currentx_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_currentx_w),m_vga));
104104   m_isa->install16_device(0x8ae8, 0x8aeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_desty_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_desty_w),m_vga));
105105   m_isa->install16_device(0x8ee8, 0x8eeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_destx_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_destx_w),m_vga));
106   m_isa->install16_device(0x92e8, 0x92eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_line_error_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_line_error_w),m_vga));
107   m_isa->install16_device(0x96e8, 0x96eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_width_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_width_w),m_vga));
106   m_isa->install16_device(0x92e8, 0x92eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_line_error_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_line_error_w),m_vga));
107   m_isa->install16_device(0x96e8, 0x96eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_width_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_width_w),m_vga));
108108   m_isa->install16_device(0x96ec, 0x96ef, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_bresenham_count_r),m_vga), write16_delegate(FUNC(ati_vga_device::mach8_bresenham_count_w),m_vga));
109109   m_isa->install16_device(0x9ae8, 0x9aeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_gpstatus_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_cmd_w),m_vga));
110110   m_isa->install16_device(0x9aec, 0x9aef, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_ext_fifo_r),m_vga), write16_delegate(FUNC(ati_vga_device::mach8_linedraw_index_w),m_vga));
111111   m_isa->install16_device(0x9ee8, 0x9eeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_ssv_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_ssv_w),m_vga));
112   m_isa->install16_device(0xa2e8, 0xa2eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_bgcolour_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_bgcolour_w),m_vga));
113   m_isa->install16_device(0xa6e8, 0xa6eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_fgcolour_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_fgcolour_w),m_vga));
114   m_isa->install16_device(0xb6e8, 0xb6eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_backmix_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_backmix_w),m_vga));
115   m_isa->install16_device(0xbae8, 0xbaeb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_foremix_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_foremix_w),m_vga));
116   m_isa->install16_device(0xbee8, 0xbeeb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_multifunc_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_multifunc_w),m_vga));
117   m_isa->install16_device(0xe2e8, 0xe2eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_pixel_xfer_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_pixel_xfer_w),m_vga));
112   m_isa->install16_device(0xa2e8, 0xa2eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_bgcolour_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_bgcolour_w),m_vga));
113   m_isa->install16_device(0xa6e8, 0xa6eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_fgcolour_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_fgcolour_w),m_vga));
114   m_isa->install16_device(0xb6e8, 0xb6eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_backmix_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_backmix_w),m_vga));
115   m_isa->install16_device(0xbae8, 0xbaeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_foremix_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_foremix_w),m_vga));
116   m_isa->install16_device(0xbee8, 0xbeeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_multifunc_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_multifunc_w),m_vga));
117   m_isa->install16_device(0xe2e8, 0xe2eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_pixel_xfer_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_pixel_xfer_w),m_vga));
118118   m_isa->install16_device(0xfeec, 0xfeef, 0, 0, read16_delegate(), write16_delegate(FUNC(ati_vga_device::mach8_linedraw_w),m_vga));
119119
120120   m_isa->install_memory(0xa0000, 0xbffff, 0, 0, read8_delegate(FUNC(ati_vga_device::mem_r),m_vga), write8_delegate(FUNC(ati_vga_device::mem_w),m_vga));

Previous 199869 Revisions Next


© 1997-2024 The MAME Team