Previous 199869 Revisions Next

r18654 Sunday 21st October, 2012 at 21:47:04 UTC by R. Belmont
(MESS) Mac: Add support for Lapis ProColor Server 8*16 PDS video card [R. Belmont, Sharkpuncher]
[src/mess]mess.mak
[src/mess/drivers]mac.c
[src/mess/video]pds30_procolor816.c* pds30_procolor816.h*

trunk/src/mess/video/pds30_procolor816.c
r0r18654
1/***************************************************************************
2
3  Lapis ProColor Server 8*16 video card
4 
5  FsFF6001: DAC color # (seems to have the data bits perfectly reversed)
6  FsFF6003: DAC color write (not bitswapped)
7  FsFF6017: Mode (13 = 1bpp, 17 = 2bpp, 1b = 4bpp, 1e = 8bpp, 0a = 15bpp)
8  FsFF7000: Bit 2 is VBL IRQ enable/ack
9  FsFF7001: Bit 0 is VBL status
10 
11***************************************************************************/
12
13#include "emu.h"
14#include "video/pds30_procolor816.h"
15
16#define PROCOLOR816_SCREEN_NAME "cb264_screen"
17#define PROCOLOR816_ROM_REGION  "cb264_rom"
18
19#define VRAM_SIZE   (0x200000)  // 2 megs?
20
21MACHINE_CONFIG_FRAGMENT( procolor816 )
22   MCFG_SCREEN_ADD( PROCOLOR816_SCREEN_NAME, RASTER)
23   MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, nubus_procolor816_device, screen_update)
24   MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
25   MCFG_SCREEN_SIZE(1024,768)
26   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
27MACHINE_CONFIG_END
28
29ROM_START( procolor816 )
30   ROM_REGION(0x8000, PROCOLOR816_ROM_REGION, 0)
31    ROM_LOAD( "procolor_ver60590.bin", 0x000000, 0x008000, CRC(ebef6168) SHA1(e41ecc7d12fc13bc74f9223ca02920e8a7eb072b) )
32ROM_END
33
34//**************************************************************************
35//  GLOBAL VARIABLES
36//**************************************************************************
37
38const device_type PDS030_PROCOLOR816 = &device_creator<nubus_procolor816_device>;
39
40
41//-------------------------------------------------
42//  machine_config_additions - device-specific
43//  machine configurations
44//-------------------------------------------------
45
46machine_config_constructor nubus_procolor816_device::device_mconfig_additions() const
47{
48   return MACHINE_CONFIG_NAME( procolor816 );
49}
50
51//-------------------------------------------------
52//  rom_region - device-specific ROM region
53//-------------------------------------------------
54
55const rom_entry *nubus_procolor816_device::device_rom_region() const
56{
57   return ROM_NAME( procolor816 );
58}
59
60//**************************************************************************
61//  LIVE DEVICE
62//**************************************************************************
63
64//-------------------------------------------------
65//  nubus_procolor816_device - constructor
66//-------------------------------------------------
67
68nubus_procolor816_device::nubus_procolor816_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
69        device_t(mconfig, PDS030_PROCOLOR816, "Lapis ProColor Server 8*16", tag, owner, clock),
70      device_nubus_card_interface(mconfig, *this)
71{
72   m_shortname = "pd3_pc16";
73}
74
75nubus_procolor816_device::nubus_procolor816_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
76        device_t(mconfig, type, name, tag, owner, clock),
77      device_nubus_card_interface(mconfig, *this)
78{
79   m_shortname = "pd3_pc16";
80}
81
82//-------------------------------------------------
83//  device_start - device-specific startup
84//-------------------------------------------------
85
86void nubus_procolor816_device::device_start()
87{
88   UINT32 slotspace;
89
90   // set_nubus_device makes m_slot valid
91   set_nubus_device();
92   install_declaration_rom(this, PROCOLOR816_ROM_REGION);
93
94   slotspace = get_slotspace();
95
96//  printf("[procolor816 %p] slotspace = %x\n", this, slotspace);
97
98   m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
99   m_vram32 = (UINT32 *)m_vram;
100
101   m_nubus->install_device(slotspace, slotspace+VRAM_SIZE-1, read32_delegate(FUNC(nubus_procolor816_device::vram_r), this), write32_delegate(FUNC(nubus_procolor816_device::vram_w), this));
102   m_nubus->install_device(slotspace+0x900000, slotspace+VRAM_SIZE-1+0x900000, read32_delegate(FUNC(nubus_procolor816_device::vram_r), this), write32_delegate(FUNC(nubus_procolor816_device::vram_w), this));
103   m_nubus->install_device(slotspace+0xf00000, slotspace+0xff7fff, read32_delegate(FUNC(nubus_procolor816_device::procolor816_r), this), write32_delegate(FUNC(nubus_procolor816_device::procolor816_w), this));
104
105   m_timer = timer_alloc(0, NULL);
106   m_screen = NULL;   // can we look this up now?
107}
108
109//-------------------------------------------------
110//  device_reset - device-specific reset
111//-------------------------------------------------
112
113void nubus_procolor816_device::device_reset()
114{
115   m_count = 0;
116   m_clutoffs = 0;
117   m_vbl_disable = 1;
118   m_mode = 3;
119   memset(m_vram, 0, VRAM_SIZE);
120   memset(m_palette, 0, sizeof(m_palette));
121
122   m_palette[0] = MAKE_RGB(255, 255, 255);
123   m_palette[0x80] = MAKE_RGB(0, 0, 0);
124}
125
126
127void nubus_procolor816_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
128{
129   if (!m_vbl_disable)
130   {
131      raise_slot_irq();
132   }
133
134   m_timer->adjust(m_screen->time_until_pos(479, 0), 0);
135}
136
137/***************************************************************************
138
139  CB264 section
140
141***************************************************************************/
142
143UINT32 nubus_procolor816_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
144{
145   UINT32 *scanline;
146   int x, y;
147   UINT8 pixels, *vram;
148
149   // first time?  kick off the VBL timer
150   if (!m_screen)
151   {
152      m_screen = &screen;
153      m_timer->adjust(m_screen->time_until_pos(479, 0), 0);
154   }
155
156   vram = m_vram + 4;
157
158   switch (m_mode)
159   {
160      case 0: // 1 bpp?
161         for (y = 0; y < 480; y++)
162         {
163            scanline = &bitmap.pix32(y);
164            for (x = 0; x < 640/8; x++)
165            {
166               pixels = vram[(y * 640/8) + (BYTE4_XOR_BE(x))];
167
168                    *scanline++ = m_palette[(pixels&0x80)];
169                    *scanline++ = m_palette[((pixels<<1)&0x80)];
170                    *scanline++ = m_palette[((pixels<<2)&0x80)];
171                    *scanline++ = m_palette[((pixels<<3)&0x80)];
172                    *scanline++ = m_palette[((pixels<<4)&0x80)];
173                    *scanline++ = m_palette[((pixels<<5)&0x80)];
174                    *scanline++ = m_palette[((pixels<<6)&0x80)];
175                    *scanline++ = m_palette[((pixels<<7)&0x80)];
176            }
177         }
178         break;
179
180      case 1: // 2 bpp
181         for (y = 0; y < 480; y++)
182         {
183            scanline = &bitmap.pix32(y);
184            for (x = 0; x < 640/4; x++)
185            {
186               pixels = vram[(y * 640/4) + (BYTE4_XOR_BE(x))];
187
188               *scanline++ = m_palette[(pixels&0xc0)];
189               *scanline++ = m_palette[((pixels<<2)&0xc0)];
190               *scanline++ = m_palette[((pixels<<4)&0xc0)];
191               *scanline++ = m_palette[((pixels<<6)&0xc0)];
192            }
193         }
194         break;
195
196      case 2: // 4 bpp
197         for (y = 0; y < 480; y++)
198         {
199            scanline = &bitmap.pix32(y);
200
201            for (x = 0; x < 640/2; x++)
202            {
203               pixels = vram[(y * 640/2) + (BYTE4_XOR_BE(x))];
204
205               *scanline++ = m_palette[(pixels&0xf0)];
206               *scanline++ = m_palette[((pixels&0x0f)<<4)];
207            }
208         }
209         break;
210
211      case 3: // 8 bpp
212         for (y = 0; y < 480; y++)
213         {
214            scanline = &bitmap.pix32(y);
215
216            for (x = 0; x < 640; x++)
217            {
218               pixels = vram[(y * 640) + (BYTE4_XOR_BE(x))];
219               *scanline++ = m_palette[pixels];
220            }
221         }
222         break;
223
224        case 4:   // 15 bpp
225            {
226                UINT16 *vram16 = (UINT16 *)m_vram;
227                UINT16 pixels;
228
229                for (y = 0; y < 480; y++)
230                {
231                    scanline = &bitmap.pix32(y);
232                    for (x = 0; x < 640; x++)
233                    {
234                        pixels = vram16[(y * 640) + (x^1)];
235                        *scanline++ = MAKE_RGB(((pixels>>10) & 0x1f)<<3, ((pixels>>5) & 0x1f)<<3, (pixels & 0x1f)<<3);
236                    }
237                }
238            }
239            break;
240
241      default:
242         fatalerror("procolor816: unknown video mode %d\n", m_mode);
243         break;
244   }
245   return 0;
246}
247
248WRITE32_MEMBER( nubus_procolor816_device::procolor816_w )
249{
250    switch (offset)
251   {
252        case 0x3d805:         // mode
253            if (mem_mask == 0xff)
254            {
255                switch (data & 0xff)
256                {
257                    case 0x13:
258                        m_mode = 0;
259                        break;
260
261                    case 0x17:
262                        m_mode = 1;
263                        break;
264
265                    case 0x1b:
266                        m_mode = 2;
267                        break;
268
269                    case 0x1e:
270                        m_mode = 3;
271                        break;
272
273                    case 0x0a:
274                        m_mode = 4;
275                        break;
276                }
277            }
278         break;
279
280        case 0x3d800:
281            if (mem_mask == 0x00ff0000)
282            {
283        //          printf("%08x to DAC control (PC=%x)\n", data, space.device().safe_pc());
284                    m_clutoffs = BITSWAP8((data>>16)&0xff, 0, 1, 2, 3, 4, 5, 6, 7);
285            }
286            else if (mem_mask == 0x000000ff)
287            {
288                    m_colors[m_count++] = (data & 0xff);
289
290                    if (m_count == 3)
291                    {
292//                        printf("RAMDAC: color %02x = %02x %02x %02x (PC=%x)\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], space.device().safe_pc() );
293                        m_palette[m_clutoffs] = MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]);
294                        m_clutoffs++;
295                        if (m_clutoffs > 255)
296                        {
297                            m_clutoffs = 0;
298                        }
299                        m_count = 0;
300                    }
301            }
302         break;
303
304    case 0x3dc00:   // VBL control
305            if (mem_mask == 0xff000000)
306            {
307                if (data & 0x04000000)
308                {
309                    m_vbl_disable = 0;
310                    lower_slot_irq();
311                }
312                else
313                {
314                    m_vbl_disable = 1;
315                }
316            }
317         break;
318
319        default:
320//            printf("procolor816_w: %08x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
321         break;
322   }
323}
324
325READ32_MEMBER( nubus_procolor816_device::procolor816_r )
326{
327    if (offset == 0x3dc00)
328    {
329        m_toggle ^= 0xffffffff;
330        return m_toggle;
331    }
332    else if (offset == 0x3d807)
333    {
334        return 0;
335    }
336    else
337    {
338        printf("procolor816_r: @ %x, mask %08x [PC=%x]\n", offset, mem_mask, machine().device("maincpu")->safe_pc());
339    }
340
341   return 0;
342}
343
344WRITE32_MEMBER( nubus_procolor816_device::vram_w )
345{
346   COMBINE_DATA(&m_vram32[offset]);
347}
348
349READ32_MEMBER( nubus_procolor816_device::vram_r )
350{
351   return m_vram32[offset];
352}
353
trunk/src/mess/video/pds30_procolor816.h
r0r18654
1#pragma once
2
3#ifndef __NUBUS_PROCOLOR816_H__
4#define __NUBUS_PROCOLOR816_H__
5
6#include "emu.h"
7#include "machine/nubus.h"
8
9//**************************************************************************
10//  TYPE DEFINITIONS
11//**************************************************************************
12
13// ======================> nubus_procolor816_device
14
15class nubus_procolor816_device :
16      public device_t,
17      public device_nubus_card_interface
18{
19public:
20        // construction/destruction
21        nubus_procolor816_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
22      nubus_procolor816_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
23
24      // optional information overrides
25      virtual machine_config_constructor device_mconfig_additions() const;
26      virtual const rom_entry *device_rom_region() const;
27
28      UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
29protected:
30        // device-level overrides
31        virtual void device_start();
32        virtual void device_reset();
33        virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
34
35        DECLARE_READ32_MEMBER(procolor816_r);
36        DECLARE_WRITE32_MEMBER(procolor816_w);
37        DECLARE_READ32_MEMBER(vram_r);
38        DECLARE_WRITE32_MEMBER(vram_w);
39
40public:
41        UINT8 *m_vram;
42        UINT32 *m_vram32;
43        UINT32 m_mode, m_vbl_disable, m_toggle;
44        UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;
45        screen_device *m_screen;
46        emu_timer *m_timer;
47};
48
49
50// device type definition
51extern const device_type PDS030_PROCOLOR816;
52
53#endif  /* __NUBUS_PROCOLOR816_H__ */
trunk/src/mess/drivers/mac.c
r18653r18654
7070#include "machine/nubus_asntmc3b.h"
7171#include "video/nubus_m2video.h"
7272#include "video/pds30_cb264.h"
73#include "video/pds30_procolor816.h"
7374#include "includes/mac.h"
7475#include "mac.lh"
7576
r18653r18654
860861SLOT_INTERFACE_END
861862
862863static SLOT_INTERFACE_START(mac_pds030_cards)
863    SLOT_INTERFACE("cb264", PDS030_CB264SE30)
864    SLOT_INTERFACE("cb264", PDS030_CB264SE30)   // RasterOps Colorboard 264/SE30
865    SLOT_INTERFACE("pc816", PDS030_PROCOLOR816) // Lapis ProColor Server 8*16 PDS
864866SLOT_INTERFACE_END
865867
866868/***************************************************************************
trunk/src/mess/mess.mak
r18653r18654
709709   $(MESS_MACHINE)/nubus_asntmc3b.o \
710710   $(MESS_VIDEO)/nubus_wsportrait.o \
711711    $(MESS_VIDEO)/pds30_cb264.o \
712    $(MESS_VIDEO)/pds30_procolor816.o \
712713
713714$(MESSOBJ)/applied.a:         \
714715   $(MESS_VIDEO)/mbee.o      \

Previous 199869 Revisions Next


© 1997-2024 The MAME Team