Previous 199869 Revisions Next

r17482 Sunday 26th August, 2012 at 13:34:49 UTC by Barry Rodewald
(MESS) Preliminary work on S3 764.
[src/emu/video]pc_vga.c pc_vga.h
[src/mess/video]isa_svga_s3.c

trunk/src/emu/video/pc_vga.c
r17481r17482
194194   UINT8 reg_lock1;
195195   UINT8 reg_lock2;
196196   UINT8 enable_8514;
197   UINT16 current_cmd;
198   UINT16 dest_x;
199   UINT16 dest_y;
200   UINT16 curr_x;
201   UINT16 curr_y;
202   UINT16 line_axial_step;
203   UINT16 line_diagonal_step;
204   UINT16 rect_width;
205   UINT16 rect_height;
206   UINT32 fgcolour;
207   UINT32 bgcolour;
208   UINT32 pixel_xfer;
209   UINT8 multifunc_sel;
197210}s3;
198211
199212#define CRTC_PORT_ADDR ((vga.miscellaneous_output&1)?0x3d0:0x3b0)
r17481r17482
27112724            available, Fh for 9 words, 7 for 10 words, 3 for 11 words, 1 for
27122725            12 words and 0 for 13 words available.
27132726 */
2714READ16_HANDLER(s3_port_9ae8_r)
2727READ16_HANDLER(s3_gpstatus_r)
27152728{
27162729   logerror("S3: 9AE8 read\n");
27172730   if(s3.enable_8514 != 0)
r17481r17482
27902803                constants in the Axial Step Constant register(8AE8h), Diagonal
27912804                Step Constant register (8EE8h), Line Error Term register
27922805               (92E8h) and bits 5-7 of this register.
2793            2 = Rectangle Fill. The Destination X (8EE8h) and Y (8AE8h)
2806            2 = Rectangle Fill. The Current X (86E8h) and Y (82E8h)
27942807                registers holds the coordinates of the rectangle to fill and
27952808                the Major Axis Pixel Count register (96E8h) holds the
27962809                horizontal width (in pixels) fill and the Minor Axis Pixel
r17481r17482
28032816                rectangle, which is copied repeatably to the destination
28042817                rectangle.
28052818 */
2806WRITE16_HANDLER(s3_port_9ae8_w)
2819WRITE16_HANDLER(s3_cmd_w)
28072820{
28082821   /* really needs to be 16-bit... */
28092822   if(s3.enable_8514 != 0)
28102823   {
2811      logerror("S3: 9AE8+%i write %04x\n",offset,data);
2824      int x,y;
2825      int dir_x;
2826      UINT32 offset;
2827      s3.current_cmd = data;
2828      switch(data & 0xe000)
2829      {
2830      case 0x0000:  // NOP (for "Short Stroke Vectors")
2831         logerror("S3: Command (%04x) - NOP\n",s3.current_cmd);
2832         break;
2833      case 0x2000:  // Line
2834         logerror("S3: Command (%04x) - Line\n",s3.current_cmd);
2835         break;
2836      case 0x4000:  // Rectangle Fill
2837         // TODO: handle wait-per-pixel drawing
2838         offset = VGA_START_ADDRESS;
2839         offset += (VGA_LINE_LENGTH * s3.curr_y);
2840         offset += s3.curr_x;
2841         if(s3.current_cmd & 0x0010) // INC_X (rectangle horizontal direction)
2842            dir_x = 2;
2843         else
2844            dir_x = -2;
2845         for(y=0;y<s3.rect_height;y++)
2846         {
2847            for(x=0;x<s3.rect_width;x+=dir_x)
2848            {
2849               vga.memory[(offset+x) % vga.svga_intf.vram_size] = s3.fgcolour & 0x000000ff;  // TODO: handle 16-bit or 32-bit transfers
2850               vga.memory[(offset+x+1) % vga.svga_intf.vram_size] = (s3.fgcolour & 0x0000ff00) >> 8;
2851            }
2852            if(s3.current_cmd & 0x0040) // INC_Y (rectangle vertical direction)
2853               offset += VGA_LINE_LENGTH;
2854            else
2855               offset -= VGA_LINE_LENGTH;
2856         }
2857         logerror("S3: Command (%04x) - Rectangle Fill %i,%i Width: %i Height: %i Colour: %08x\n",s3.current_cmd,s3.curr_x,s3.curr_y,s3.rect_width,s3.rect_height,s3.fgcolour);
2858         break;
2859      case 0xc000:  // BitBLT
2860         logerror("S3: Command (%04x) - BitBLT\n",s3.current_cmd);
2861         break;
2862      case 0xe000:  // Pattern Fill
2863         logerror("S3: Command (%04x) - Pattern Fill\n",s3.current_cmd);
2864         break;
2865      default:
2866         logerror("S3: Unknown command: %04x\n",data);
2867      }
28122868   }
28132869   else
28142870      logerror("S3: Write to 8514/A port 9ae8 while disabled.\n");
28152871}
28162872
2873/*
28748AE8h W(R/W):  Destination Y Position & Axial Step Constant Register
2875               (DESTY_AXSTP)
2876bit  0-11  DESTINATION Y-POSITION. During BITBLT operations this is the Y
2877           co-ordinate of the destination in pixels.
2878     0-12  (911/924) LINE PARAMETER AXIAL STEP CONSTANT. During Line Drawing,
2879            this is the Bresenham constant 2*dminor in two's complement
2880            format. (dminor is the length of the line projected onto the minor
2881            or dependent axis).
2882     0-13  (80 x+) LINE PARAMETER AXIAL STEP CONSTANT. Se above
2883
2884 */
2885READ16_HANDLER( s3_8ae8_r )
2886{
2887   return s3.line_axial_step;
2888}
2889
2890WRITE16_HANDLER( s3_8ae8_w )
2891{
2892   s3.line_axial_step = data & 0x3fff;
2893   s3.dest_y = data & 0x0fff;
2894   logerror("S3: Line Axial Step / Destination Y write %04x\n",data);
2895}
2896
2897/*
28988EE8h W(R/W):  Destination X Position & Diagonal Step Constant Register
2899               (DESTX_DISTP)
2900bit  0-11  DESTINATION X-POSITION. During BITBLT operations this is the X
2901           co-ordinate of the destination in pixels.
2902     0-12  (911/924) LINE PARAMETER DIAGONAL STEP CONSTANT. During Line
2903            Drawing this is the Bresenham constant 2*dminor-2*dmajor in two's
2904            complement format. (dminor is the length of the line projected
2905            onto the minor or dependent axis, dmajor is the length of the line
2906            projected onto the major or independent axis)
2907     0-13  (80x +) LINE PARAMETER DIAGONAL STEP CONSTANT. Se above
2908
2909 */
2910READ16_HANDLER( s3_8ee8_r )
2911{
2912   return s3.line_diagonal_step;
2913}
2914
2915WRITE16_HANDLER( s3_8ee8_w )
2916{
2917   s3.line_diagonal_step = data & 0x3fff;
2918   s3.dest_x = data & 0x0fff;
2919   logerror("S3: Line Diagonal Step / Destination X write %04x\n",data);
2920}
2921
2922/*
292396E8h W(R/W):  Major Axis Pixel Count/Rectangle Width Register (MAJ_AXIS_PCNT)
2924bit  0-10  (911/924)  RECTANGLE WIDTH/LINE PARAMETER MAX. For BITBLT and
2925            rectangle commands this is the width of the area. For Line Drawing
2926            this is the Bresenham constant dmajor in two's complement format.
2927            (dmajor is the length of the line projected onto the major or
2928            independent axis). Must be positive.
2929     0-11  (80x +) RECTANGLE WIDTH/LINE PARAMETER MAX. See above
2930 */
2931READ16_HANDLER( s3_width_r )
2932{
2933   return s3.rect_width;
2934}
2935
2936WRITE16_HANDLER( s3_width_w )
2937{
2938   s3.rect_width = data & 0x0fff;
2939   logerror("S3: Major Axis Pixel Count / Rectangle Width write %04x\n",data);
2940}
2941
2942READ16_HANDLER(s3_currentx_r)
2943{
2944   return s3.curr_x;
2945}
2946
2947WRITE16_HANDLER(s3_currentx_w)
2948{
2949   s3.curr_x = data & 0x0fff;
2950}
2951
2952READ16_HANDLER(s3_currenty_r)
2953{
2954   return s3.curr_y;
2955}
2956
2957WRITE16_HANDLER(s3_currenty_w)
2958{
2959   s3.curr_y = data & 0x0fff;
2960}
2961
2962READ16_HANDLER(s3_fgcolour_r)
2963{
2964   return s3.fgcolour;
2965}
2966
2967WRITE16_HANDLER(s3_fgcolour_w)
2968{
2969   s3.fgcolour = data;
2970   logerror("S3: Foreground Colour write %04x\n",data);
2971}
2972
2973READ16_HANDLER(s3_bgcolour_r)
2974{
2975   return s3.bgcolour;
2976}
2977
2978WRITE16_HANDLER(s3_bgcolour_w)
2979{
2980   s3.bgcolour = data;
2981   logerror("S3: Background Colour write %04x\n",data);
2982}
2983
2984READ16_HANDLER( s3_multifunc_r )
2985{
2986   switch(s3.multifunc_sel)
2987   {
2988   case 0:
2989      return s3.rect_height;
2990      // TODO: remaining functions
2991   default:
2992      logerror("S3: Unimplemented multifunction register %i selected\n",s3.multifunc_sel);
2993      return 0xff;
2994   }
2995}
2996
2997WRITE16_HANDLER( s3_multifunc_w )
2998{
2999   switch(data & 0xf000)
3000   {
3001/*
3002BEE8h index 00h W(R/W): Minor Axis Pixel Count Register (MIN_AXIS_PCNT).
3003bit  0-10  (911/924) Rectangle Height. Height of BITBLT or rectangle command.
3004            Actual height is one larger.
3005     0-11  (80x +) Rectangle Height. See above
3006*/
3007   case 0x0000:
3008      s3.rect_height = data & 0x0fff;
3009      logerror("S3: Minor Axis Pixel Count / Rectangle Height write %04x\n",data);
3010      break;
3011/*
3012BEE8h index 0Fh W(W):  Read Register Select Register (READ_SEL)    (801/5,928)
3013bit   0-2  (911-928) READ-REG-SEL. Read Register Select. Selects the register
3014            that is actually read when a read of BEE8h happens. Each read of
3015            BEE8h increments this register by one.
3016             0: Read will return contents of BEE8h index 0.
3017             1: Read will return contents of BEE8h index 1.
3018             2: Read will return contents of BEE8h index 2.
3019             3: Read will return contents of BEE8h index 3.
3020             4: Read will return contents of BEE8h index 4.
3021             5: Read will return contents of BEE8h index 0Ah.
3022             6: Read will return contents of BEE8h index 0Eh.
3023             7: Read will return contents of 9AE8h (Bits 13-15 will be 0).
3024      0-3  (864,964) READ-REG-SEL. See above plus:
3025             8: Read will return contents of 42E8h (Bits 12-15 will be 0)
3026             9: Read will return contents of 46E8h
3027            10: Read will return contents of BEE8h index 0Dh
3028 */
3029   case 0xf000:
3030      s3.multifunc_sel = data & 0x000f;
3031   default:
3032      logerror("S3: Unimplemented multifunction register %i write\n",data >> 12);
3033   }
3034}
3035
3036READ16_HANDLER(s3_pixel_xfer_r)
3037{
3038   if(offset == 1)
3039      return (s3.pixel_xfer & 0xffff0000) >> 16;
3040   else
3041      return s3.pixel_xfer & 0x0000ffff;
3042}
3043
3044WRITE16_HANDLER(s3_pixel_xfer_w)
3045{
3046   if(offset == 1)
3047      s3.pixel_xfer = (s3.pixel_xfer & 0x0000ffff) | (data << 16);
3048   else
3049      s3.pixel_xfer = (s3.pixel_xfer & 0xffff0000) | data;
3050}
3051
28173052READ8_HANDLER( s3_mem_r )
28183053{
28193054   if (svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb32_en)
trunk/src/emu/video/pc_vga.h
r17481r17482
6464WRITE8_HANDLER(s3_port_03c0_w);
6565READ8_HANDLER(s3_port_03d0_r);
6666WRITE8_HANDLER(s3_port_03d0_w);
67READ16_HANDLER(s3_port_9ae8_r);
68WRITE16_HANDLER(s3_port_9ae8_w);
67READ16_HANDLER(s3_gpstatus_r);
68WRITE16_HANDLER(s3_cmd_w);
69READ16_HANDLER(s3_8ae8_r);
70WRITE16_HANDLER(s3_8ae8_w);
71READ16_HANDLER(s3_8ee8_r);
72WRITE16_HANDLER(s3_8ee8_w);
73READ16_HANDLER(s3_currentx_r);
74WRITE16_HANDLER(s3_currentx_w);
75READ16_HANDLER(s3_currenty_r);
76WRITE16_HANDLER(s3_currenty_w);
77READ16_HANDLER(s3_width_r);
78WRITE16_HANDLER(s3_width_w);
79READ16_HANDLER(s3_multifunc_r);
80WRITE16_HANDLER(s3_multifunc_w);
81READ16_HANDLER(s3_fgcolour_r);
82WRITE16_HANDLER(s3_fgcolour_w);
83READ16_HANDLER(s3_bgcolour_r);
84WRITE16_HANDLER(s3_bgcolour_w);
85READ16_HANDLER(s3_pixel_xfer_r);
86WRITE16_HANDLER(s3_pixel_xfer_w);
6987READ8_HANDLER(s3_mem_r);
7088WRITE8_HANDLER(s3_mem_w);
7189
trunk/src/mess/video/isa_svga_s3.c
r17481r17482
7878   m_isa->install_device(0x03b0, 0x03bf, 0, 0, FUNC(s3_port_03b0_r), FUNC(s3_port_03b0_w));
7979   m_isa->install_device(0x03c0, 0x03cf, 0, 0, FUNC(s3_port_03c0_r), FUNC(s3_port_03c0_w));
8080   m_isa->install_device(0x03d0, 0x03df, 0, 0, FUNC(s3_port_03d0_r), FUNC(s3_port_03d0_w));
81   m_isa->install16_device(0x9ae8, 0x9aeb, 0, 0, FUNC(s3_port_9ae8_r), FUNC(s3_port_9ae8_w));
81   m_isa->install16_device(0x82e8, 0x82eb, 0, 0, FUNC(s3_currenty_r), FUNC(s3_currenty_w));
82   m_isa->install16_device(0x86e8, 0x86eb, 0, 0, FUNC(s3_currentx_r), FUNC(s3_currentx_w));
83   m_isa->install16_device(0x8ae8, 0x8aeb, 0, 0, FUNC(s3_8ae8_r), FUNC(s3_8ae8_w));
84   m_isa->install16_device(0x8ee8, 0x8eeb, 0, 0, FUNC(s3_8ee8_r), FUNC(s3_8ee8_w));
85   m_isa->install16_device(0x96e8, 0x96eb, 0, 0, FUNC(s3_width_r), FUNC(s3_width_w));
86   m_isa->install16_device(0x9ae8, 0x9aeb, 0, 0, FUNC(s3_gpstatus_r), FUNC(s3_cmd_w));
87   m_isa->install16_device(0xa2e8, 0xa2eb, 0, 0, FUNC(s3_bgcolour_r), FUNC(s3_bgcolour_w));
88   m_isa->install16_device(0xa6e8, 0xa6eb, 0, 0, FUNC(s3_fgcolour_r), FUNC(s3_fgcolour_w));
89   m_isa->install16_device(0xbee8, 0xbeeb, 0, 0, FUNC(s3_multifunc_r), FUNC(s3_multifunc_w));
90   m_isa->install16_device(0xe2e8, 0xe2eb, 0, 0, FUNC(s3_pixel_xfer_r), FUNC(s3_pixel_xfer_w));
8291
8392   m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(s3_mem_r), FUNC(s3_mem_w));
8493}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team