Previous 199869 Revisions Next

r17477 Sunday 26th August, 2012 at 00:15:06 UTC by Barry Rodewald
(MESS) svga_s3: converted to 16-bit ISA device. The S3 chipsets have 16-bit wide registers, and can only be used on AT systems. (no whatsnew)
[src/emu/video]pc_vga.c pc_vga.h
[src/mess/drivers]at.c genpc.c
[src/mess/machine]isa.c isa.h
[src/mess/video]isa_svga_s3.c isa_svga_s3.h

trunk/src/emu/video/pc_vga.c
r17476r17477
193193   UINT8 crt_reg_lock;
194194   UINT8 reg_lock1;
195195   UINT8 reg_lock2;
196   UINT8 enable_8514;
196197}s3;
197198
198199#define CRTC_PORT_ADDR ((vga.miscellaneous_output&1)?0x3d0:0x3b0)
r17476r17477
25632564            /* TODO: reg lock mechanism */
25642565            s3.reg_lock2 = data;
25652566            break;
2567         case 0x40:
2568            s3.enable_8514 = data & 0x01;  // enable 8514/A registers (x2e8, x6e8, xae8, xee8)
2569            break;
25662570         case 0x51:
25672571            vga.crtc.start_addr &= ~0xc0000;
25682572            vga.crtc.start_addr |= ((data & 0x3) << 18);
r17476r17477
26862690}
26872691
26882692/* accelerated ports, TBD ... */
2689READ8_HANDLER(s3_port_9ae8_r)
2693/*
2694  9AE8h W(R):  Graphics Processor Status Register (GP_STAT)
2695bit   0-7  Queue State.
2696             00h = 8 words available - queue is empty
2697             01h = 7 words available
2698             03h = 6 words available
2699             07h = 5 words available
2700             0Fh = 4 words available
2701             1Fh = 3 words available
2702             3Fh = 2 words available
2703             7Fh = 1 word  available
2704             FFh = 0 words available - queue is full
2705        8  (911-928) DTA AVA. Read Data Available. If set data is ready to be
2706            read from the PIX_TRANS register (E2E8h).
2707        9  HDW BSY. Hardware Graphics Processor Busy
2708           If set the Graphics Processor is busy.
2709       10  (928 +) AE. All FIFO Slots Empty. If set all FIFO slots are empty.
2710    11-15  (864/964) (R) Queue State bits 8-12. 1Fh if 8 words or less
2711            available, Fh for 9 words, 7 for 10 words, 3 for 11 words, 1 for
2712            12 words and 0 for 13 words available.
2713 */
2714READ16_HANDLER(s3_port_9ae8_r)
26902715{
2691   return 0;
2716   logerror("S3: 9AE8 read\n");
2717   if(s3.enable_8514 != 0)
2718      return 0;
2719   else
2720      return 0xffff;
26922721}
26932722
2694WRITE8_HANDLER(s3_port_9ae8_w)
2723/*
27249AE8h W(W):  Drawing Command Register (CMD)
2725bit     0  (911-928) ~RD/WT. Read/Write Data. If set VRAM write operations are
2726            enabled. If clear operations execute normally but writes are
2727            disabled.
2728        1  PX MD. Pixel Mode. Defines the orientation of the display bitmap.
2729             0 = Through plane mode (Single pixel transferred at a time)
2730             1 = Across plane mode (Multiple pixels transferred at a time).
2731        2  LAST PXOF. Last Pixel Off. If set the last pixel of a line command
2732           (CMD_LINE, SSV or LINEAF) is not drawn. This is used for mixes such
2733           as XOR where drawing the same pixel twice would give the wrong
2734           color.
2735        3  DIR TYP. Direction Type.
2736             0: Bresenham line drawing (X-Y Axial)
2737                  CMD_LINE draws a line using the Bresenham algorithm as
2738                  specified in the DESTY_AXSTP (8AE8h), DESTX_DIASTP (8EE8h),
2739                  ERR_TERM (92E8h) and MAJ_AXIS_PCNT (96E8h) registers
2740                  INC_X, INC_Y and YMAJAXIS determines the direction.
2741             1: Vector line draws (Radial).
2742                  CMD_NOP allows drawing of Short Stroke Vectors (SSVs) by
2743                  writing to the Short Stroke register (9EE8h).
2744                  CMD_LINE draws a vector of length MAJ_AXIS_PCNT (96E8h)
2745                  in the direction specified by LINEDIR (bits 5-7).
2746                  DRWG-DIR determines the direction of the line.
2747        4  DRAW YES. If clear the current position is moved, but no pixels
2748           are modified. This bit should be set when attempting read or
2749           write of bitmap data.
2750      5-7  DRWG-DIR. Drawing Direction. When a line draw command (CMD_LINE)
2751           with DIR TYP=1 (Radial) is issued, these bits define the direction
2752           of the line counter clockwise relative to the positive X-axis.
2753             0 = 000 degrees
2754             1 = 045 degrees
2755             2 = 090 degrees
2756             3 = 135 degrees
2757             4 = 180 degrees
2758             5 = 225 degrees
2759             6 = 270 degrees
2760             7 = 315 degrees
2761        5  INC_X. This bit together with INC_Y determines which quadrant
2762           the slope of a line lies within. They also determine the
2763           orientation of rectangle draw commands.
2764           If set lines are drawn in the positive X direction (left to right).
2765        6  YMAJAXIS. For Bresenham line drawing commands this bit determines
2766           which axis is the independent or major axis. INC_X and INC_Y
2767           determines which quadrant the slope falls within. This bit further
2768           defines the slope to within an octant.
2769           If set Y is the major (independent) axis.
2770        7  INC_Y. This bit together with INC_X determines which quadrant
2771           the slope of a line lies within. They also determine the
2772           orientation of rectangle draw commands.
2773           If set lines are drawn in the positive Y direction (down).
2774        8  WAIT YES. If set the drawing engine waits for read/write of the
2775           PIX_TRANS register (E2E8h) for each pixel during a draw operation.
2776        9  (911-928) BUS SIZE. If set the PIX_TRANS register (E2E8h) is
2777            processed internally as two bytes in the order specified by BYTE
2778            SWAP. If clear all accesses to E2E8h are 8bit.
2779     9-10  (864,964) BUS SIZE. Select System Bus Size. Controls the width of
2780            the Pixel Data Transfer registers (E2E8h,E2EAh) and the memory
2781            mapped I/O. 0: 8bit, 1: 16bit, 2: 32bit
2782       12  BYTE SWAP. Affects both reads and writes of SHORT_STROKE (9EE8h)
2783           and PIX_TRANS (E2E8h) when 16bit=1.
2784           If set take low byte first, if clear take high byte first.
2785    13-15  Draw Command:
2786            0 = NOP. Used for Short Stroke Vectors.
2787            1 = Draw Line. If bit 3 is set the line is drawn to the angle in
2788                bits 5-7 and the length in the Major Axis Pixel Count register
2789                (96E8h), if clear the line is drawn from the Bresenham
2790                constants in the Axial Step Constant register(8AE8h), Diagonal
2791                Step Constant register (8EE8h), Line Error Term register
2792               (92E8h) and bits 5-7 of this register.
2793            2 = Rectangle Fill. The Destination X (8EE8h) and Y (8AE8h)
2794                registers holds the coordinates of the rectangle to fill and
2795                the Major Axis Pixel Count register (96E8h) holds the
2796                horizontal width (in pixels) fill and the Minor Axis Pixel
2797                Count register (BEE8h index 0) holds the height of the
2798                rectangle.
2799            6 = BitBLT. Copies the source rectangle specified by the Current X
2800                (86E8h) and Y (8AE8h) registers to the destination rectangle,
2801                specified as for the Rectangle Fills.
2802            7 = (80x +) Pattern Fill. The source rectangle is an 8x8 pattern
2803                rectangle, which is copied repeatably to the destination
2804                rectangle.
2805 */
2806WRITE16_HANDLER(s3_port_9ae8_w)
26952807{
2696   // ...
2808   /* really needs to be 16-bit... */
2809   if(s3.enable_8514 != 0)
2810   {
2811      logerror("S3: 9AE8+%i write %04x\n",offset,data);
2812   }
2813   else
2814      logerror("S3: Write to 8514/A port 9ae8 while disabled.\n");
26972815}
26982816
26992817READ8_HANDLER( s3_mem_r )
trunk/src/emu/video/pc_vga.h
r17476r17477
6464WRITE8_HANDLER(s3_port_03c0_w);
6565READ8_HANDLER(s3_port_03d0_r);
6666WRITE8_HANDLER(s3_port_03d0_w);
67READ8_HANDLER(s3_port_9ae8_r);
68WRITE8_HANDLER(s3_port_9ae8_w);
67READ16_HANDLER(s3_port_9ae8_r);
68WRITE16_HANDLER(s3_port_9ae8_w);
6969READ8_HANDLER(s3_mem_r);
7070WRITE8_HANDLER(s3_mem_w);
7171
trunk/src/mess/machine/isa.c
r17476r17477
599599   }
600600}
601601
602void isa16_device::install16_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_space_func rhandler, const char* rhandler_name, write16_space_func whandler, const char *whandler_name)
603{
604   int buswidth = m_maincpu->memory().space_config(AS_PROGRAM)->m_databus_width;
605   switch(buswidth)
606   {
607      case 16:
608         m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0);
609         break;
610      case 32:
611         m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0xffffffff);
612         if ((start % 4) == 0) {
613            if ((end-start)==1) {
614               m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(start, end+2, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0x0000ffff);
615            } else {
616               m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(start, end,   mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0xffffffff);
617            }
618         } else {
619            // we handle just misalligned by 2
620            m_maincpu->memory().space(AS_IO)->install_legacy_readwrite_handler(start-2, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0xffff0000);
621         }
622
623         break;
624      default:
625         fatalerror("ISA16: Bus width %d not supported", buswidth);
626         break;
627   }
628}
629
602630// interrupt request from isa card
603631WRITE_LINE_MEMBER( isa16_device::irq10_w ) { m_out_irq10_func(state); }
604632WRITE_LINE_MEMBER( isa16_device::irq11_w ) { m_out_irq11_func(state); }
trunk/src/mess/machine/isa.h
r17476r17477
294294
295295   void install16_device(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_device_func rhandler, const char* rhandler_name, write16_device_func whandler, const char *whandler_name);
296296   void install16_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_delegate rhandler, write16_delegate whandler);
297   void install16_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read16_space_func rhandler, const char* rhandler_name, write16_space_func whandler, const char *whandler_name);
297298
298299   DECLARE_WRITE_LINE_MEMBER( irq10_w );
299300   DECLARE_WRITE_LINE_MEMBER( irq11_w );
trunk/src/mess/video/isa_svga_s3.c
r17476r17477
1818//  GLOBAL VARIABLES
1919//**************************************************************************
2020
21const device_type ISA8_SVGA_S3 = &device_creator<isa8_svga_s3_device>;
21const device_type ISA16_SVGA_S3 = &device_creator<isa16_svga_s3_device>;
2222
2323
2424//-------------------------------------------------
r17476r17477
2626//  machine configurations
2727//-------------------------------------------------
2828
29machine_config_constructor isa8_svga_s3_device::device_mconfig_additions() const
29machine_config_constructor isa16_svga_s3_device::device_mconfig_additions() const
3030{
3131   return MACHINE_CONFIG_NAME( pcvideo_vga_isa );
3232}
r17476r17477
3535//  rom_region - device-specific ROM region
3636//-------------------------------------------------
3737
38const rom_entry *isa8_svga_s3_device::device_rom_region() const
38const rom_entry *isa16_svga_s3_device::device_rom_region() const
3939{
4040   return ROM_NAME( s3_764 );
4141}
r17476r17477
4848//  isa8_vga_device - constructor
4949//-------------------------------------------------
5050
51isa8_svga_s3_device::isa8_svga_s3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
52        device_t(mconfig, ISA8_SVGA_S3, "SVGA S3 Graphics Card", tag, owner, clock),
53      device_isa8_card_interface(mconfig, *this)
51isa16_svga_s3_device::isa16_svga_s3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
52        device_t(mconfig, ISA16_SVGA_S3, "SVGA S3 Graphics Card", tag, owner, clock),
53      device_isa16_card_interface(mconfig, *this)
5454{
5555   m_shortname = "s3_764";
5656}
r17476r17477
6060//-------------------------------------------------
6161static READ8_HANDLER( input_port_0_r ) { return 0xff; } //return space->machine().root_device().ioport("IN0")->read(); }
6262
63void isa8_svga_s3_device::device_start()
63void isa16_svga_s3_device::device_start()
6464{
6565   set_isa_device();
6666
r17476r17477
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->install_device(0x9ae8, 0x9aeb, 0, 0, FUNC(s3_port_9ae8_r), FUNC(s3_port_9ae8_w));
81   m_isa->install16_device(0x9ae8, 0x9aeb, 0, 0, FUNC(s3_port_9ae8_r), FUNC(s3_port_9ae8_w));
8282
8383   m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(s3_mem_r), FUNC(s3_mem_w));
8484}
r17476r17477
8787//  device_reset - device-specific reset
8888//-------------------------------------------------
8989
90void isa8_svga_s3_device::device_reset()
90void isa16_svga_s3_device::device_reset()
9191{
9292   pc_vga_reset(machine());
9393}
trunk/src/mess/video/isa_svga_s3.h
r17476r17477
1212
1313// ======================> isa8_vga_device
1414
15class isa8_svga_s3_device :
15class isa16_svga_s3_device :
1616      public device_t,
17      public device_isa8_card_interface
17      public device_isa16_card_interface
1818{
1919public:
2020        // construction/destruction
21        isa8_svga_s3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
21        isa16_svga_s3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2222
2323      // optional information overrides
2424      virtual machine_config_constructor device_mconfig_additions() const;
r17476r17477
3131
3232
3333// device type definition
34extern const device_type ISA8_SVGA_S3;
34extern const device_type ISA16_SVGA_S3;
3535
3636#endif  /* __ISA_VGA_H__ */
trunk/src/mess/drivers/genpc.c
r17476r17477
9797   SLOT_INTERFACE("mda", ISA8_MDA)
9898   SLOT_INTERFACE("ega", ISA8_EGA)
9999   SLOT_INTERFACE("svga_et4k", ISA8_SVGA_ET4K)
100   SLOT_INTERFACE("svga_s3",ISA8_SVGA_S3)
101100   SLOT_INTERFACE("com", ISA8_COM)
102101   SLOT_INTERFACE("fdc", ISA8_FDC)
103102   SLOT_INTERFACE("finalchs", ISA8_FINALCHS)
trunk/src/mess/drivers/at.c
r17476r17477
351351   SLOT_INTERFACE("cga", ISA8_CGA)
352352   SLOT_INTERFACE("ega", ISA8_EGA)
353353   SLOT_INTERFACE("svga_et4k", ISA8_SVGA_ET4K)
354   SLOT_INTERFACE("svga_s3",ISA8_SVGA_S3)
355354   SLOT_INTERFACE("svga_dm",ISA8_SVGA_CIRRUS)
356355   SLOT_INTERFACE("com", ISA8_COM)
357356   SLOT_INTERFACE("comat", ISA8_COM_AT)
r17476r17477
374373   SLOT_INTERFACE("ne2000", NE2000)
375374   SLOT_INTERFACE("aha1542", AHA1542)
376375   SLOT_INTERFACE("gus",ISA16_GUS)
376   SLOT_INTERFACE("svga_s3",ISA16_SVGA_S3)
377377SLOT_INTERFACE_END
378378
379379static MACHINE_CONFIG_FRAGMENT( at_motherboard )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team