Previous 15994 Revisions Next

r7370 Tuesday 16th February, 2010 at 09:57:45 UTC by Fabio Priuli
[CBM] converted vdc8563 to be a device and updated c128 to use the new code
[src/mess/drivers]c128.c
[src/mess/includes]c128.h
[src/mess/machine]c128.c
[src/mess/video]vdc8563.c vdc8563.h vic4567.h

src/mess/video/vic4567.h
r7369r7370
152152
153153/*----------- defined in video/vic4567.c -----------*/
154154
155/* to be called when writting to port */
156155WRITE8_DEVICE_HANDLER( vic3_port_w );
157156WRITE8_DEVICE_HANDLER( vic3_palette_w );
158
159/* to be called when reading from port */
160157READ8_DEVICE_HANDLER( vic3_port_r );
161READ8_DEVICE_HANDLER( vic3_palette_red_r );
162READ8_DEVICE_HANDLER( vic3_palette_green_r );
163READ8_DEVICE_HANDLER( vic3_palette_blue_r );
164158
165159void vic3_raster_interrupt_gen( running_device *device );
166160UINT32 vic3_video_update( running_device *device, bitmap_t *bitmap, const rectangle *cliprect );
src/mess/video/vdc8563.c
r7369r7370
22
33  CBM Video Device Chip 8563
44
5  copyright 2000 peter.trauner@jk.uni-linz.ac.at
5  Original code by PeT (peter.trauner@jk.uni-linz.ac.at)
66
7    2010-02: converted to be a device
8
9    TODO:
10      - clean up the code
11      - add RAM with an internal address map
12
713***************************************************************************/
814/*
915 several graphic problems
1016 some are in the rastering engine and should be solved during its evalution
1117 rare and short documentation,
1218 registers and some words of description in the c128 user guide */
19/* seems to be a motorola m6845 variant */
1320
14#include <math.h>
15#include <stdio.h>
16#include <assert.h>
21
1722#include "emu.h"
23#include "video/vdc8563.h"
1824
19#include "includes/crtc6845.h" // include only several register defines
20#include "vdc8563.h"
21
22#define VERBOSE 0
23#define VERBOSE_DBG   0
24
25#define DBG_LOG(N,M,A)      \
26   do { \
27      if(VERBOSE>=N) \
28      { \
29         if( M ) \
30            logerror("%11.6f: %-24s",attotime_to_double(timer_get_time(machine)),(char*)M ); \
31         logerror A; \
32      } \
33   } while (0)
34
35/* seems to be a motorola m6845 variant */
36
37/* permutation for c64/vic6567 conversion to vdc8563
38 0 --> 0 black
39 1 --> 0xf white
40 2 --> 8 red
41 3 --> 7 cyan
42 4 --> 0xb violett
43 5 --> 4 green
44 6 --> 2 blue
45 7 --> 0xd yellow
46 8 --> 0xa orange
47 9 --> 0xc brown
48 0xa --> 9 light red
49 0xb --> 6 dark gray
50 0xc --> 1 gray
51 0xd --> 5 light green
52 0xe --> 3 light blue
53 0xf --> 0xf light gray
54 */
55
56/* x128
57 commodore assignment!?
58 black gray orange yellow dardgrey vio red lgreen
59 lred lgray brown blue white green cyan lblue
60*/
61const unsigned char vdc8563_palette[] =
25typedef struct _vdc8563_state vdc8563_state;
26struct _vdc8563_state
6227{
63#if 0
64   0x00, 0x00, 0x00, /* black */
65   0x70, 0x74, 0x6f, /* gray */
66   0x21, 0x1b, 0xae, /* blue */
67   0x5f, 0x53, 0xfe, /* light blue */
68   0x1f, 0xd2, 0x1e, /* green */
69   0x59, 0xfe, 0x59, /* light green */
70   0x42, 0x45, 0x40, /* dark gray */
71   0x30, 0xe6, 0xc6, /* cyan */
72   0xbe, 0x1a, 0x24, /* red */
73   0xfe, 0x4a, 0x57, /* light red */
74   0xb8, 0x41, 0x04, /* orange */
75   0xb4, 0x1a, 0xe2, /* purple */
76   0x6a, 0x33, 0x04, /* brown */
77   0xdf, 0xf6, 0x0a, /* yellow */
78   0xa4, 0xa7, 0xa2, /* light gray */
79   0xfd, 0xfe, 0xfc /* white */
80#else
81   /* vice */
82   0,0,0, /* black */
83   0x20,0x20,0x20, /* gray */
84   0,0,0x80, /* blue */
85   0,0,0xff, /* light blue */
86   0,0x80,0, /* green */
87   0,0xff,0, /* light green */
88   0,0x80,0x80, /* cyan */
89   0,0xff,0xff, /* light cyan */
90   0x80,0,0, /* red */
91   0xff,0,0, /* light red */
92   0x80,0,0x80, /* purble */
93   0xff,0,0xff, /* light purble */
94   0x80,0x80,0, /* brown */
95   0xff, 0xff, 0, /* yellow */
96   0xc0,0xc0,0xc0, /* light gray */
97   0xff, 0xff,0xff /* white */
98#endif
99};
28   running_device *screen;
10029
101
102static struct {
10330   int state;
10431   UINT8 reg[37];
10532   UINT8 index;
r7369r7370
12047   int   cursor_on;
12148
12249   int changed;
123} vdc;
50};
12451
52/*****************************************************************************
53    CONSTANTS
54*****************************************************************************/
55
56#define VERBOSE_LEVEL 0
57#define DBG_LOG(N, M, A)      \
58   do { \
59      if (VERBOSE_LEVEL >= N) \
60      { \
61         if (M) \
62            logerror("%11.6f: %-24s",attotime_to_double(timer_get_time(device->machine)),(char*)M ); \
63         logerror A; \
64      } \
65   } while (0)
66
67
12568static const struct {
12669   int stored,
12770      read;
r7369r7370
164107   {  0xff, -1 },
165108   {  0x0f, -1 },
166109};
167#define REG(x) (vdc.reg[x]&reg_mask[x].stored)
110#define REG(x)          (vdc8563->reg[x] & reg_mask[x].stored)
168111
169void vdc8563_init (int ram16konly)
170{
171   memset(&vdc, 0, sizeof(vdc));
172   vdc.cursor_time=0.0;
173   vdc.state=1;
174112
175   if (ram16konly) {
176      vdc.mask=0x3fff;
177      vdc.fontmask=0x2000;
178   } else {
179      vdc.mask=0xffff;
180      vdc.fontmask=0xe000;
181   }
113#define CHAR_WIDTH      (((vdc8563->reg[0x16] & 0xf0) >> 4) + 1)
114#define CHAR_WIDTH_VISIBLE ((vdc8563->reg[0x16] & 0x0f) + 1)
182115
183   vdc.rastering=1;
184}
116#define BLOCK_COPY      (vdc8563->reg[0x18] & 0x80)
185117
186static void vdc_videoram_w(int offset, int data)
187{
188   offset&=vdc.mask;
189    if (vdc.ram[offset]!=data) {
190      vdc.ram[offset] = data;
191      vdc.dirty[offset] = 1;
192      if ((vdc.fontram_start&vdc.fontmask)==(offset&vdc.fontmask))
193         vdc.fontdirty[(offset&0x1ff0)>>4]=1;
194   }
195}
118#define MONOTEXT        ((vdc8563->reg[0x19] & 0xc0) == 0)
119#define TEXT            ((vdc8563->reg[0x19] & 0xc0) == 0x40)
120#define GRAPHIC         (vdc8563->reg[0x19] & 0x80)
196121
197INLINE int vdc_videoram_r(int offset)
122#define FRAMECOLOR      (vdc8563->reg[0x1a] & 0x0f)
123#define MONOCOLOR       (vdc8563->reg[0x1a] >> 4)
124
125#define LINEDIFF        (vdc8563->reg[0x1b])
126#define FONT_START      ((vdc8563->reg[0x1c] & 0xe0) << 8)
127/* 0x1c 0x10 dram 0:4416, 1: 4164 */
128
129/* 0x1d 0x1f counter for underlining */
130
131#define FILLBYTE        vdc8563->reg[0x1f]
132
133#define CLOCK_HALFING   (vdc8563->reg[25] & 0x10)
134
135
136/* the regs below corresponds to the ones used by 6845, hence we borrow the macros */
137#define CRTC6845_COLUMNS (REG(0) + 1)
138#define CRTC6845_CHAR_COLUMNS (REG(1))
139#define CRTC6845_CHAR_LINES REG(6)
140#define CRTC6845_CHAR_HEIGHT ((REG(9) & 0x1f) + 1)
141#define CRTC6845_LINES (REG(4) * CRTC6845_CHAR_HEIGHT + REG(5))
142#define CRTC6845_VIDEO_START ((REG(0xc) << 8) | REG(0xd))
143#define CRTC6845_INTERLACE_MODE (REG(8) & 3)
144#define CRTC6845_INTERLACE_SIGNAL 1
145#define CRTC6845_INTERLACE 3
146#define CRTC6845_CURSOR_MODE (REG(0xa) & 0x60)
147#define CRTC6845_CURSOR_OFF 0x20
148#define CRTC6845_CURSOR_16FRAMES 0x40
149#define CRTC6845_CURSOR_32FRAMES 0x60
150#define CRTC6845_SKEW   (REG(8) & 15)
151#define CRTC6845_CURSOR_POS ((REG(0xe) << 8) | REG(0xf))
152#define CRTC6845_CURSOR_TOP   (REG(0xa) & 0x1f)
153#define CRTC6845_CURSOR_BOTTOM REG(0xb)
154
155
156/*****************************************************************************
157    INLINE FUNCTIONS
158*****************************************************************************/
159
160INLINE vdc8563_state *get_safe_token( running_device *device )
198161{
199   return vdc.ram[offset&vdc.mask];
200}
162   assert(device != NULL);
163   assert(device->token != NULL);
164   assert(device->type == VDC8563);
201165
202void vdc8563_set_rastering(int on)
203{
204   vdc.rastering=on;
205   vdc.changed|=1;
166   return (vdc8563_state *)device->token;
206167}
207168
208VIDEO_START( vdc8563 )
169INLINE const vdc8563_interface *get_interface( running_device *device )
209170{
210   vdc.ram = auto_alloc_array(machine, UINT8, 0x20000);
211   vdc.dirty = vdc.ram + 0x10000;
171   assert(device != NULL);
172   assert((device->type == VDC8563));
173   return (const vdc8563_interface *) device->baseconfig().static_config;
212174}
213175
214#define CHAR_WIDTH (((vdc.reg[0x16]&0xf0)>>4)+1)
215#define CHAR_WIDTH_VISIBLE ((vdc.reg[0x16]&0xf)+1)
176/*****************************************************************************
177    IMPLEMENTATION
178*****************************************************************************/
216179
217#define BLOCK_COPY (vdc.reg[0x18]&0x80)
180static void vdc_videoram_w( running_device *device, int offset, int data )
181{
182   vdc8563_state *vdc8563 = get_safe_token(device);
218183
219#define MONOTEXT ((vdc.reg[0x19]&0xc0)==0)
220#define TEXT ((vdc.reg[0x19]&0xc0)==0x40)
221#define GRAPHIC (vdc.reg[0x19]&0x80)
184   offset &= vdc8563->mask;
222185
223#define FRAMECOLOR (vdc.reg[0x1a]&0xf)
224#define MONOCOLOR (vdc.reg[0x1a]>>4)
186   if (vdc8563->ram[offset] != data)
187   {
188      vdc8563->ram[offset] = data;
189      vdc8563->dirty[offset] = 1;
190      if ((vdc8563->fontram_start & vdc8563->fontmask) == (offset & vdc8563->fontmask))
191         vdc8563->fontdirty[(offset & 0x1ff0) >> 4] = 1;
192   }
193}
225194
226#define LINEDIFF (vdc.reg[0x1b])
227#define FONT_START ((vdc.reg[0x1c]&0xe0)<<8)
228/* 0x1c 0x10 dram 0:4416, 1: 4164 */
195INLINE int vdc_videoram_r( running_device *device, int offset )
196{
197   vdc8563_state *vdc8563 = get_safe_token(device);
198   return vdc8563->ram[offset & vdc8563->mask];
199}
229200
230/* 0x1d 0x1f counter for underlining */
201void vdc8563_set_rastering( running_device *device, int on )
202{
203   vdc8563_state *vdc8563 = get_safe_token(device);
204   vdc8563->rastering = on;
205   vdc8563->changed |= 1;
206}
231207
232#define FILLBYTE vdc.reg[0x1f]
233208
234#define CLOCK_HALFING (vdc.reg[25]&0x10)
235209
236210/* 0x22 number of chars from start of line to positiv edge of display enable */
237211/* 0x23 number of chars from start of line to negativ edge of display enable */
238212/* 0x24 0xf number of refresh cycles per line */
239213
240WRITE8_HANDLER ( vdc8563_port_w )
214WRITE8_DEVICE_HANDLER( vdc8563_port_w )
241215{
242   running_machine *machine = space->machine;
216   vdc8563_state *vdc8563 = get_safe_token(device);
243217   UINT8 i;
244218
245219   if (offset & 1)
246220   {
247      if ((vdc.index & 0x3f) < 37)
221      if ((vdc8563->index & 0x3f) < 37)
248222      {
249         switch (vdc.index & 0x3f)
223         switch (vdc8563->index & 0x3f)
250224         {
251225         case 1: case 4: case 0x1b:
252            vdc.reg[vdc.index]=data;
253            vdc.videoram_size=CRTC6845_CHAR_LINES*(CRTC6845_CHAR_COLUMNS+LINEDIFF);
254            vdc.changed=1;
226            vdc8563->reg[vdc8563->index] = data;
227            vdc8563->videoram_size = CRTC6845_CHAR_LINES * (CRTC6845_CHAR_COLUMNS + LINEDIFF);
228            vdc8563->changed = 1;
255229            break;
256230         case 0xe: case 0xf: case 0xa: case 0xb:
257            vdc.dirty[CRTC6845_CURSOR_POS&vdc.mask]=1;
258            vdc.reg[vdc.index]=data;
231            vdc8563->dirty[CRTC6845_CURSOR_POS & vdc8563->mask] = 1;
232            vdc8563->reg[vdc8563->index] = data;
259233            break;
260234         case 0xc: case 0xd:
261            vdc.reg[vdc.index]=data;
262            vdc.videoram_start=CRTC6845_VIDEO_START;
263            vdc.changed=1;
235            vdc8563->reg[vdc8563->index] = data;
236            vdc8563->videoram_start = CRTC6845_VIDEO_START;
237            vdc8563->changed = 1;
264238            break;
265239         case 0x12:
266            vdc.addr=(vdc.addr&0xff)|(data<<8);
240            vdc8563->addr = (vdc8563->addr & 0x00ff) | (data << 8);
267241            break;
268242         case 0x13:
269            vdc.addr=(vdc.addr&0xff00)|data;
243            vdc8563->addr = (vdc8563->addr & 0xff00) | data;
270244            break;
271245         case 0x20:
272            vdc.src=(vdc.src&0xff)|(data<<8);
246            vdc8563->src = (vdc8563->src & 0x00ff) | (data << 8);
273247            break;
274248         case 0x21:
275            vdc.src=(vdc.src&0xff00)|data;
249            vdc8563->src = (vdc8563->src & 0xff00) | data;
276250            break;
277251         case 0x14: case 0x15:
278            vdc.reg[vdc.index]=data;
279            vdc.colorram_start=(vdc.reg[0x14]<<8)|vdc.reg[0x15];
280            vdc.changed=1;
252            vdc8563->reg[vdc8563->index] = data;
253            vdc8563->colorram_start = (vdc8563->reg[0x14] << 8) | vdc8563->reg[0x15];
254            vdc8563->changed = 1;
281255            break;
282256         case 0x1c:
283            vdc.reg[vdc.index]=data;
284            vdc.fontram_start=FONT_START;
285            vdc.changed=1;
257            vdc8563->reg[vdc8563->index] = data;
258            vdc8563->fontram_start = FONT_START;
259            vdc8563->changed = 1;
286260            break;
287261         case 0x16: case 0x19: case 0x1a:
288            vdc.reg[vdc.index]=data;
289            vdc.changed=1;
262            vdc8563->reg[vdc8563->index] = data;
263            vdc8563->changed = 1;
290264            break;
291265         case 0x1e:
292            vdc.reg[vdc.index]=data;
293            if (BLOCK_COPY) {
294               DBG_LOG (2, "vdc block copy",
295                      ("src:%.4x dst:%.4x size:%.2x\n",
296                       vdc.src, vdc.addr, data));
297               i=data;do {
298                  vdc_videoram_w(vdc.addr++, vdc_videoram_r(vdc.src++));
299               } while (--i!=0);
300            } else {
301               DBG_LOG (2, "vdc block set",
302                      ("dest:%.4x value:%.2x size:%.2x\n",
303                       vdc.addr, FILLBYTE, data));
304               i=data;do {
305                  vdc_videoram_w(vdc.addr++, FILLBYTE);
306               } while (--i!=0);
266            vdc8563->reg[vdc8563->index] = data;
267            if (BLOCK_COPY)
268            {
269               DBG_LOG(2, "vdc block copy", ("src:%.4x dst:%.4x size:%.2x\n", vdc8563->src, vdc8563->addr, data));
270               i = data;
271               do {
272                  vdc_videoram_w(device, vdc8563->addr++, vdc_videoram_r(device, vdc8563->src++));
273               } while (--i != 0);
307274            }
275            else
276            {
277               DBG_LOG(2, "vdc block set", ("dest:%.4x value:%.2x size:%.2x\n", vdc8563->addr, FILLBYTE, data));
278               i = data;
279               do {
280                  vdc_videoram_w(device, vdc8563->addr++, FILLBYTE);
281               } while (--i != 0);
282            }
308283            break;
309284         case 0x1f:
310            DBG_LOG (2, "vdc written",
311                   ("dest:%.4x size:%.2x\n",
312                    vdc.addr, data));
313            vdc.reg[vdc.index]=data;
314            vdc_videoram_w(vdc.addr++, data);
285            DBG_LOG(2, "vdc written", ("dest:%.4x size:%.2x\n", vdc8563->addr, data));
286            vdc8563->reg[vdc8563->index] = data;
287            vdc_videoram_w(device, vdc8563->addr++, data);
315288            break;
316289         default:
317            vdc.reg[vdc.index]=data;
318            DBG_LOG (2, "vdc8563_port_w",
319                   ("%.2x:%.2x\n", vdc.index, data));
290            vdc8563->reg[vdc8563->index] = data;
291            DBG_LOG(2, "vdc8563_port_w", ("%.2x:%.2x\n", vdc8563->index, data));
320292            break;
321293         }
322294      }
323      DBG_LOG (3, "vdc8563_port_w",
324             ("%.2x:%.2x\n", vdc.index, data));
295      DBG_LOG(3, "vdc8563_port_w", ("%.2x:%.2x\n", vdc8563->index, data));
325296   }
326297   else
327298   {
328      vdc.index = data;
299      vdc8563->index = data;
329300   }
330301}
331302
332READ8_HANDLER ( vdc8563_port_r )
303READ8_DEVICE_HANDLER( vdc8563_port_r )
333304{
334   running_machine *machine = space->machine;
305   vdc8563_state *vdc8563 = get_safe_token(device);
335306   int val;
336307
337308   val = 0xff;
338309   if (offset & 1)
339310   {
340      if ((vdc.index & 0x3f) < 37)
311      if ((vdc8563->index & 0x3f) < 37)
341312      {
342         switch (vdc.index & 0x3f)
313         switch (vdc8563->index & 0x3f)
343314         {
344315         case 0x12:
345            val=vdc.addr>>8;
316            val = vdc8563->addr >> 8;
346317            break;
347318         case 0x13:
348            val=vdc.addr&0xff;
319            val = vdc8563->addr & 0xff;
349320            break;
350321         case 0x1e:
351            val=0;
322            val = 0;
352323            break;
353324         case 0x1f:
354            val=vdc_videoram_r(vdc.addr);
355            DBG_LOG (2, "vdc read", ("%.4x %.2x\n", vdc.addr, val));
325            val = vdc_videoram_r(device, vdc8563->addr);
326            DBG_LOG(2, "vdc read", ("%.4x %.2x\n", vdc8563->addr, val));
356327            break;
357328         case 0x20:
358            val=vdc.src>>8;
329            val = vdc8563->src >> 8;
359330            break;
360331         case 0x21:
361            val=vdc.src&0xff;
332            val = vdc8563->src & 0xff;
362333            break;
363334         default:
364            val=vdc.reg[vdc.index&0x3f]&reg_mask[vdc.index&0x3f].read;
335            val = vdc8563->reg[vdc8563->index & 0x3f] & reg_mask[vdc8563->index & 0x3f].read;
365336         }
366337      }
367      DBG_LOG (2, "vdc8563_port_r", ("%.2x:%.2x\n", vdc.index, val));
338      DBG_LOG(2, "vdc8563_port_r", ("%.2x:%.2x\n", vdc8563->index, val));
368339   }
369340   else
370341   {
371      val = vdc.index;
372      if (vdc.state) val|=0x80;
342      val = vdc8563->index;
343      if (vdc8563->state)
344         val |= 0x80;
373345   }
374346   return val;
375347}
376348
377static int vdc8563_clocks_in_frame(void)
349static int vdc8563_clocks_in_frame( running_device *device )
378350{
379   int clocks=CRTC6845_COLUMNS*CRTC6845_LINES;
380   switch (CRTC6845_INTERLACE_MODE) {
351   vdc8563_state *vdc8563 = get_safe_token(device);
352   int clocks = CRTC6845_COLUMNS * CRTC6845_LINES;
353
354   switch (CRTC6845_INTERLACE_MODE)
355   {
381356   case CRTC6845_INTERLACE_SIGNAL: // interlace generation of video signals only
382357   case CRTC6845_INTERLACE: // interlace
383      return clocks/2;
358      return clocks / 2;
384359   default:
385360      return clocks;
386361   }
387362}
388363
389static void vdc8563_time(running_machine *machine)
364static void vdc8563_time( running_device *device )
390365{
391   double neu, ftime;
392   neu=attotime_to_double(timer_get_time(machine));
366   vdc8563_state *vdc8563 = get_safe_token(device);
367   double newtime, ftime;
368   newtime = attotime_to_double(timer_get_time(device->machine));
393369
394   if (vdc8563_clocks_in_frame()==0.0) return;
395   ftime=16*vdc8563_clocks_in_frame()/2000000.0;
396   if (CLOCK_HALFING) ftime*=2;
397   switch (CRTC6845_CURSOR_MODE) {
398   case CRTC6845_CURSOR_OFF: vdc.cursor_on=0;break;
370   if (vdc8563_clocks_in_frame(device) == 0.0)
371      return;
372
373   ftime = 16 * vdc8563_clocks_in_frame(device) / 2000000.0;
374   if (CLOCK_HALFING)
375      ftime *= 2;
376   switch (CRTC6845_CURSOR_MODE)
377   {
378   case CRTC6845_CURSOR_OFF:
379      vdc8563->cursor_on = 0;
380      break;
399381   case CRTC6845_CURSOR_32FRAMES:
400      ftime*=2;
382      ftime *= 2;
401383   case CRTC6845_CURSOR_16FRAMES:
402      if (neu-vdc.cursor_time>ftime) {
403         vdc.cursor_time+=ftime;
404         vdc.dirty[CRTC6845_CURSOR_POS&vdc.mask]=1;
405         vdc.cursor_on^=1;
384      if (newtime - vdc8563->cursor_time > ftime)
385      {
386         vdc8563->cursor_time += ftime;
387         vdc8563->dirty[CRTC6845_CURSOR_POS & vdc8563->mask] = 1;
388         vdc8563->cursor_on ^= 1;
406389      }
407390      break;
408391   default:
409      vdc.cursor_on=1;break;
392      vdc8563->cursor_on = 1;
393      break;
410394   }
411395}
412396
413static void vdc8563_monotext_screenrefresh (running_machine *machine, bitmap_t *bitmap, int full_refresh)
397static void vdc8563_monotext_screenrefresh( running_device *device, bitmap_t *bitmap, int full_refresh )
414398{
399   vdc8563_state *vdc8563 = get_safe_token(device);
400   running_machine *machine = device->machine;
415401   int x, y, i;
416402   rectangle rect;
417   int w=CRTC6845_CHAR_COLUMNS;
418   int h=CRTC6845_CHAR_LINES;
419   int height=CRTC6845_CHAR_HEIGHT;
420   running_device *screen = video_screen_first(machine);
403   int w = CRTC6845_CHAR_COLUMNS;
404   int h = CRTC6845_CHAR_LINES;
405   int height = CRTC6845_CHAR_HEIGHT;
421406
422   rect.min_x = video_screen_get_visible_area(screen)->min_x;
423   rect.max_x = video_screen_get_visible_area(screen)->max_x;
407   rect.min_x = video_screen_get_visible_area(vdc8563->screen)->min_x;
408   rect.max_x = video_screen_get_visible_area(vdc8563->screen)->max_x;
424409
425410   if (full_refresh)
426      memset(vdc.dirty+vdc.videoram_start, 1, vdc.videoram_size);
411      memset(vdc8563->dirty + vdc8563->videoram_start, 1, vdc8563->videoram_size);
427412
428   for (y=0, rect.min_y=height, rect.max_y=rect.min_y+height-1,
429      i=vdc.videoram_start&vdc.mask; y<h;
430      y++, rect.min_y+=height, rect.max_y+=height)
413   for (y = 0, rect.min_y = height, rect.max_y = rect.min_y + height - 1, i = vdc8563->videoram_start & vdc8563->mask; y < h;
414      y++, rect.min_y += height, rect.max_y += height)
431415   {
432      for (x=0; x<w; x++, i=(i+1)&vdc.mask)
416      for (x = 0; x < w; x++, i = (i + 1) & vdc8563->mask)
433417      {
434         if (vdc.dirty[i])
418         if (vdc8563->dirty[i])
435419         {
436            drawgfx_opaque(bitmap,&rect,machine->gfx[0],
437                  vdc.ram[i], FRAMECOLOR|(MONOCOLOR<<4), 0, 0,
438                  machine->gfx[0]->width*x+8,height*y+height);
439            if ((vdc.cursor_on)&&(i==(CRTC6845_CURSOR_POS&vdc.mask)))
420            drawgfx_opaque(bitmap,&rect,machine->gfx[0], vdc8563->ram[i], FRAMECOLOR | (MONOCOLOR << 4), 0, 0,
421                  machine->gfx[0]->width * x + 8, height * y + height);
422
423            if ((vdc8563->cursor_on) && (i == (CRTC6845_CURSOR_POS & vdc8563->mask)))
440424            {
441               int k=height-CRTC6845_CURSOR_TOP;
442               if (CRTC6845_CURSOR_BOTTOM<height) k=CRTC6845_CURSOR_BOTTOM-CRTC6845_CURSOR_TOP+1;
425               int k = height - CRTC6845_CURSOR_TOP;
426               if (CRTC6845_CURSOR_BOTTOM < height)
427                  k = CRTC6845_CURSOR_BOTTOM - CRTC6845_CURSOR_TOP + 1;
443428
444               if (k>0)
445                  plot_box(bitmap, machine->gfx[0]->width*x+8,
446                         height*y+height+CRTC6845_CURSOR_TOP,
447                         machine->gfx[0]->width, k, FRAMECOLOR);
429               if (k > 0)
430                  plot_box(bitmap, machine->gfx[0]->width * x + 8, height * y + height + CRTC6845_CURSOR_TOP, machine->gfx[0]->width, k, FRAMECOLOR);
448431            }
449432
450            vdc.dirty[i]=0;
433            vdc8563->dirty[i] = 0;
451434         }
452435      }
453      i+=LINEDIFF;
436      i += LINEDIFF;
454437   }
455438}
456439
457static void vdc8563_text_screenrefresh (running_machine *machine, bitmap_t *bitmap, int full_refresh)
440static void vdc8563_text_screenrefresh( running_device *device, bitmap_t *bitmap, int full_refresh )
458441{
442   vdc8563_state *vdc8563 = get_safe_token(device);
443   running_machine *machine = device->machine;
459444   int x, y, i, j;
460445   rectangle rect;
461   int w=CRTC6845_CHAR_COLUMNS;
462   int h=CRTC6845_CHAR_LINES;
463   int height=CRTC6845_CHAR_HEIGHT;
464   running_device *screen = video_screen_first(machine);
446   int w = CRTC6845_CHAR_COLUMNS;
447   int h = CRTC6845_CHAR_LINES;
448   int height = CRTC6845_CHAR_HEIGHT;
465449
466   rect.min_x = video_screen_get_visible_area(screen)->min_x;
467   rect.max_x = video_screen_get_visible_area(screen)->max_x;
450   rect.min_x = video_screen_get_visible_area(vdc8563->screen)->min_x;
451   rect.max_x = video_screen_get_visible_area(vdc8563->screen)->max_x;
468452
469453   if (full_refresh)
470      memset(vdc.dirty+vdc.videoram_start, 1, vdc.videoram_size);
454      memset(vdc8563->dirty + vdc8563->videoram_start, 1, vdc8563->videoram_size);
471455
472   for (y=0, rect.min_y=height, rect.max_y=rect.min_y+height-1,
473      i=vdc.videoram_start&vdc.mask, j=vdc.colorram_start&vdc.mask; y<h;
474      y++, rect.min_y+=height, rect.max_y+=height)
456   for (y = 0, rect.min_y = height, rect.max_y = rect.min_y + height - 1, i = vdc8563->videoram_start & vdc8563->mask,
457      j = vdc8563->colorram_start & vdc8563->mask; y < h; y++, rect.min_y += height, rect.max_y += height)
475458   {
476      for (x=0; x<w; x++, i=(i+1)&vdc.mask, j=(j+1)&vdc.mask)
459      for (x = 0; x < w; x++, i = (i + 1) & vdc8563->mask, j = (j + 1) & vdc8563->mask)
477460      {
478         if (vdc.dirty[i]||vdc.dirty[j])
461         if (vdc8563->dirty[i] || vdc8563->dirty[j])
479462         {
480463            {
481464               UINT16 ch, fg, bg;
r7369r7370
483466               int v, h;
484467               UINT16 *pixel;
485468
486               ch = vdc.ram[i] | ((vdc.ram[j] & 0x80) ? 0x100 : 0);
487               charptr = &vdc.ram[(vdc.fontram_start + (ch * 16)) & vdc.mask];
488               fg = ((vdc.ram[j] & 0x0F) >> 0) + 0x10;
489               bg = ((vdc.ram[j] & 0x70) >> 4) + 0x10;
469               ch = vdc8563->ram[i] | ((vdc8563->ram[j] & 0x80) ? 0x100 : 0);
470               charptr = &vdc8563->ram[(vdc8563->fontram_start + (ch * 16)) & vdc8563->mask];
471               fg = ((vdc8563->ram[j] & 0x0f) >> 0) + 0x10;
472               bg = ((vdc8563->ram[j] & 0x70) >> 4) + 0x10;
490473
491474               for (v = 0; v < 16; v++)
492475               {
r7369r7370
498481               }
499482            }
500483
501            if ((vdc.cursor_on)&&(i==(CRTC6845_CURSOR_POS&vdc.mask)))
484            if ((vdc8563->cursor_on) && (i == (CRTC6845_CURSOR_POS & vdc8563->mask)))
502485            {
503               int k=height-CRTC6845_CURSOR_TOP;
504               if (CRTC6845_CURSOR_BOTTOM<height) k=CRTC6845_CURSOR_BOTTOM-CRTC6845_CURSOR_TOP+1;
486               int k = height - CRTC6845_CURSOR_TOP;
487               if (CRTC6845_CURSOR_BOTTOM < height)
488                  k = CRTC6845_CURSOR_BOTTOM - CRTC6845_CURSOR_TOP + 1;
505489
506               if (k>0)
507                  plot_box(bitmap, machine->gfx[0]->width*x+8,
508                         height*y+height+CRTC6845_CURSOR_TOP,
509                         machine->gfx[0]->width, k, 0x10|(vdc.ram[j]&0xf));
490               if (k > 0)
491                  plot_box(bitmap, machine->gfx[0]->width * x + 8, height * y + height + CRTC6845_CURSOR_TOP, machine->gfx[0]->width,
492                        k, 0x10 | (vdc8563->ram[j] & 0x0f));
510493            }
511494
512            vdc.dirty[i]=0;
513            vdc.dirty[j]=0;
495            vdc8563->dirty[i] = 0;
496            vdc8563->dirty[j] = 0;
514497         }
515498      }
516      i+=LINEDIFF;
517      j+=LINEDIFF;
499      i += LINEDIFF;
500      j += LINEDIFF;
518501   }
519502}
520503
521static void vdc8563_graphic_screenrefresh (running_machine *machine, bitmap_t *bitmap, int full_refresh)
504static void vdc8563_graphic_screenrefresh( running_device *device, bitmap_t *bitmap, int full_refresh )
522505{
506   vdc8563_state *vdc8563 = get_safe_token(device);
507   running_machine *machine = device->machine;
523508   int x, y, i, j, k;
524509   rectangle rect;
525   int w=CRTC6845_CHAR_COLUMNS;
526   int h=CRTC6845_CHAR_LINES;
527   int height=CRTC6845_CHAR_HEIGHT;
528   running_device *screen = video_screen_first(machine);
510   int w = CRTC6845_CHAR_COLUMNS;
511   int h = CRTC6845_CHAR_LINES;
512   int height = CRTC6845_CHAR_HEIGHT;
529513
530   rect.min_x = video_screen_get_visible_area(screen)->min_x;
531   rect.max_x = video_screen_get_visible_area(screen)->max_x;
514   rect.min_x = video_screen_get_visible_area(vdc8563->screen)->min_x;
515   rect.max_x = video_screen_get_visible_area(vdc8563->screen)->max_x;
532516
533517   if (full_refresh)
534      memset(vdc.dirty, 1, vdc.mask+1);
518      memset(vdc8563->dirty, 1, vdc8563->mask + 1);
535519
536   for (y=0, rect.min_y=height, rect.max_y=rect.min_y+height-1,
537      i=vdc.videoram_start&vdc.mask; y<h;
538      y++, rect.min_y+=height, rect.max_y+=height)
520   for (y = 0, rect.min_y = height, rect.max_y = rect.min_y + height - 1, i = vdc8563->videoram_start & vdc8563->mask; y < h;
521      y++, rect.min_y += height, rect.max_y += height)
539522   {
540      for (x=0; x<w; x++, i=(i+1)&vdc.mask)
523      for (x = 0; x < w; x++, i = (i + 1) & vdc8563->mask)
541524      {
542         for (j=0; j<height; j++)
525         for (j = 0; j < height; j++)
543526         {
544            k=((i<<4)+j)&vdc.mask;
545            if (vdc.dirty[k])
527            k = ((i << 4) + j) & vdc8563->mask;
528            if (vdc8563->dirty[k])
546529            {
547               drawgfx_opaque(bitmap,&rect,machine->gfx[1],
548                     vdc.ram[k], FRAMECOLOR|(MONOCOLOR<<4), 0, 0,
549                     machine->gfx[0]->width*x+8,height*y+height+j);
550               vdc.dirty[k]=0;
530               drawgfx_opaque(bitmap, &rect, machine->gfx[1], vdc8563->ram[k], FRAMECOLOR | (MONOCOLOR << 4), 0, 0,
531                     machine->gfx[0]->width * x + 8, height * y + height + j);
532               vdc8563->dirty[k] = 0;
551533            }
552534         }
553535      }
554      i+=LINEDIFF;
536      i += LINEDIFF;
555537   }
556538}
557539
558VIDEO_UPDATE( vdc8563 )
540UINT32 vdc8563_video_update( running_device *device, bitmap_t *bitmap, const rectangle *cliprect )
559541{
542   vdc8563_state *vdc8563 = get_safe_token(device);
560543   int i;
561544   int full_refresh = 1;
562545
563   if (!vdc.rastering) return 0;
564   vdc8563_time(screen->machine);
546   if (!vdc8563->rastering)
547      return 0;
565548
566   full_refresh|=vdc.changed;
549   vdc8563_time(device);
550
551   full_refresh |= vdc8563->changed;
552
567553   if (GRAPHIC)
568554   {
569      vdc8563_graphic_screenrefresh(screen->machine, bitmap, full_refresh);
555      vdc8563_graphic_screenrefresh(device, bitmap, full_refresh);
570556   }
571557   else
572558   {
573      for (i=0; i<512; i++)
559      for (i = 0; i < 512; i++)
574560      {
575         if (full_refresh||vdc.fontdirty[i])
561         if (full_refresh || vdc8563->fontdirty[i])
576562         {
577            gfx_element_mark_dirty(screen->machine->gfx[0],i);
578            vdc.fontdirty[i]=0;
563            gfx_element_mark_dirty(device->machine->gfx[0],i);
564            vdc8563->fontdirty[i] = 0;
579565         }
580566      }
581      if (TEXT) vdc8563_text_screenrefresh(screen->machine, bitmap, full_refresh);
582      else vdc8563_monotext_screenrefresh(screen->machine, bitmap, full_refresh);
567      if (TEXT)
568         vdc8563_text_screenrefresh(device, bitmap, full_refresh);
569      else
570         vdc8563_monotext_screenrefresh(device, bitmap, full_refresh);
583571   }
584572
585573   if (full_refresh)
586574   {
587      int w=CRTC6845_CHAR_COLUMNS;
588      int h=CRTC6845_CHAR_LINES;
589      int height=CRTC6845_CHAR_HEIGHT;
575      int w = CRTC6845_CHAR_COLUMNS;
576      int h = CRTC6845_CHAR_LINES;
577      int height = CRTC6845_CHAR_HEIGHT;
590578
591      plot_box(bitmap, 0, 0, screen->machine->gfx[0]->width*(w+2), height, FRAMECOLOR);
579      plot_box(bitmap, 0, 0, device->machine->gfx[0]->width * (w + 2), height, FRAMECOLOR);
592580
593      plot_box(bitmap, 0, height, screen->machine->gfx[0]->width, height*h, FRAMECOLOR);
581      plot_box(bitmap, 0, height, device->machine->gfx[0]->width, height * h, FRAMECOLOR);
594582
595      plot_box(bitmap, screen->machine->gfx[0]->width*(w+1), height, screen->machine->gfx[0]->width, height*h,
596             FRAMECOLOR);
583      plot_box(bitmap, device->machine->gfx[0]->width * (w + 1), height, device->machine->gfx[0]->width, height * h, FRAMECOLOR);
597584
598      plot_box(bitmap, 0, height*(h+1), screen->machine->gfx[0]->width*(w+2), height,
599             FRAMECOLOR);
585      plot_box(bitmap, 0, height * (h + 1), device->machine->gfx[0]->width * (w + 2), height, FRAMECOLOR);
600586   }
601587
602   vdc.changed=0;
588   vdc8563->changed = 0;
603589   return 0;
604590}
591
592/*****************************************************************************
593    DEVICE INTERFACE
594*****************************************************************************/
595
596static DEVICE_START( vdc8563 )
597{
598   vdc8563_state *vdc8563 = get_safe_token(device);
599   const vdc8563_interface *intf = (vdc8563_interface *)device->baseconfig().static_config;
600
601   vdc8563->screen = devtag_get_device(device->machine, intf->screen);
602
603   vdc8563->ram = auto_alloc_array_clear(device->machine, UINT8, 0x20000);
604   vdc8563->dirty = vdc8563->ram + 0x10000;
605
606   /* currently no driver uses 16k only */
607   if (intf->ram16konly)
608   {
609      vdc8563->mask = 0x3fff;
610      vdc8563->fontmask = 0x2000;
611   }
612   else
613   {
614      vdc8563->mask = 0xffff;
615      vdc8563->fontmask = 0xe000;
616   }
617
618   state_save_register_device_item_pointer(device, 0, vdc8563->ram, 0x20000);
619
620   state_save_register_device_item_array(device, 0, vdc8563->reg);
621   state_save_register_device_item(device, 0, vdc8563->state);
622   state_save_register_device_item(device, 0, vdc8563->index);
623
624   state_save_register_device_item(device, 0, vdc8563->addr);
625   state_save_register_device_item(device, 0, vdc8563->src);
626
627   state_save_register_device_item(device, 0, vdc8563->videoram_start);
628   state_save_register_device_item(device, 0, vdc8563->colorram_start);
629   state_save_register_device_item(device, 0, vdc8563->fontram_start);
630   state_save_register_device_item(device, 0, vdc8563->videoram_size);
631
632   state_save_register_device_item(device, 0, vdc8563->rastering);
633
634   state_save_register_device_item_array(device, 0, vdc8563->fontdirty);
635
636   state_save_register_device_item(device, 0, vdc8563->cursor_time);
637   state_save_register_device_item(device, 0, vdc8563->cursor_on);
638
639   state_save_register_device_item(device, 0, vdc8563->changed);
640}
641
642
643static DEVICE_RESET( vdc8563 )
644{
645   vdc8563_state *vdc8563 = get_safe_token(device);
646
647   memset(vdc8563->reg, 0, ARRAY_LENGTH(vdc8563->reg));
648   memset(vdc8563->fontdirty, 0, ARRAY_LENGTH(vdc8563->fontdirty));
649
650   vdc8563->cursor_time = 0.0;
651   vdc8563->state = 1;
652
653   vdc8563->index = 0;
654   vdc8563->addr = 0;
655   vdc8563->src = 0;
656   vdc8563->videoram_start = 0;
657   vdc8563->colorram_start = 0;
658   vdc8563->fontram_start = 0;
659   vdc8563->videoram_size = 0;
660   vdc8563->rastering = 1;
661   vdc8563->cursor_on = 0;
662   vdc8563->changed = 0;
663}
664
665/*-------------------------------------------------
666    device definition
667-------------------------------------------------*/
668
669static const char DEVTEMPLATE_SOURCE[] = __FILE__;
670
671#define DEVTEMPLATE_ID(p,s)            p##vdc8563##s
672#define DEVTEMPLATE_FEATURES         DT_HAS_START | DT_HAS_RESET
673#define DEVTEMPLATE_NAME            "8563 / 8568 VDC"
674#define DEVTEMPLATE_FAMILY            "8563 / 8568 VDC"
675#include "devtempl.h"
src/mess/video/vdc8563.h
r7369r7370
88 *
99 ****************************************************************************/
1010
11#ifndef VDC8563_H_
12#define VDC8563_H_
11#ifndef __VDC8563_H__
12#define __VDC8563_H__
1313
14#ifdef __cplusplus
15extern "C" {
16#endif
14#include "devcb.h"
1715
1816
19/*----------- defined in video/vdc8563.c -----------*/
17/***************************************************************************
18    TYPE DEFINITIONS
19***************************************************************************/
2020
21/* call to init videodriver */
22extern void vdc8563_init (int ram16konly);
21typedef struct _vdc8563_interface vdc8563_interface;
22struct _vdc8563_interface
23{
24   const char         *screen;
25   int                ram16konly;
26};
2327
24extern void vdc8563_set_rastering(int on);
28/***************************************************************************
29    FUNCTION PROTOTYPES
30***************************************************************************/
2531
26extern VIDEO_START( vdc8563 );
27extern VIDEO_UPDATE( vdc8563 );
32DEVICE_GET_INFO( vdc8563 );
2833
29extern const unsigned char vdc8563_palette[16 * 3];
34/***************************************************************************
35    DEVICE CONFIGURATION MACROS
36***************************************************************************/
3037
31/* to be called when writting to port */
32extern WRITE8_HANDLER ( vdc8563_port_w );
38#define VDC8563 DEVICE_GET_INFO_NAME( vdc8563 )
3339
34/* to be called when reading from port */
35extern  READ8_HANDLER ( vdc8563_port_r );
40#define MDRV_VDC8563_ADD(_tag, _interface) \
41   MDRV_DEVICE_ADD(_tag, VDC8563, 0) \
42   MDRV_DEVICE_CONFIG(_interface)
3643
3744
38#ifdef __cplusplus
39}
40#endif
45/*----------- defined in video/vdc8563.c -----------*/
4146
42#endif /* VDC8563_H_ */
47void vdc8563_set_rastering(running_device *device, int on);
48UINT32 vdc8563_video_update(running_device *device, bitmap_t *bitmap, const rectangle *cliprect);
49
50WRITE8_DEVICE_HANDLER( vdc8563_port_w );
51READ8_DEVICE_HANDLER( vdc8563_port_r );
52
53
54#endif /* __VDC8563_H__ */
src/mess/includes/c128.h
r7369r7370
1111 *
1212 ****************************************************************************/
1313
14#ifndef C128_H_
15#define C128_H_
14#ifndef __C128_H__
15#define __C128_H__
1616
1717#include "machine/6526cia.h"
1818
r7369r7370
5454extern MACHINE_RESET( c128 );
5555extern INTERRUPT_GEN( c128_frame_interrupt );
5656
57extern VIDEO_START( c128 );
5857extern VIDEO_UPDATE( c128 );
5958
6059void c128_bankswitch_64(running_machine *machine, int reset);
r7369r7370
7271WRITE_LINE_DEVICE_HANDLER( c128_iec_srq_w );
7372WRITE_LINE_DEVICE_HANDLER( c128_iec_data_w );
7473
75#endif /* C128_H_ */
74#endif /* __C128_H__ */
src/mess/machine/c128.c
r7369r7370
402402   running_device *cia_1 = devtag_get_device(space->machine, "cia_1");
403403   running_device *sid = devtag_get_device(space->machine, "sid6581");
404404   running_device *vic2e = devtag_get_device(space->machine, "vic2e");
405   running_device *vdc8563 = devtag_get_device(space->machine, "vdc8563");
405406
406407   UINT8 c64_port6510 = (UINT8) space->machine->device("maincpu")->get_runtime_int(CPUINFO_INT_M6510_PORT);
407408
r7369r7370
426427         c128_mmu8722_port_w(space, offset & 0xff, data);
427428         break;
428429      case 6:case 7:
429         vdc8563_port_w(space, offset & 0xff, data);
430         vdc8563_port_w(vdc8563, offset & 0xff, data);
430431         break;
431432      case 8: case 9: case 0xa: case 0xb:
432433          if (c64mode)
r7369r7370
458459   running_device *cia_1 = devtag_get_device(space->machine, "cia_1");
459460   running_device *sid = devtag_get_device(space->machine, "sid6581");
460461   running_device *vic2e= devtag_get_device(space->machine, "vic2e");
462   running_device *vdc8563 = devtag_get_device(space->machine, "vdc8563");
461463
462464   if (offset < 0x400)
463465      return vic2_port_r(vic2e, offset & 0x3ff);
r7369r7370
466468   else if (offset < 0x600)
467469      return c128_mmu8722_port_r(space, offset & 0xff);
468470   else if (offset < 0x800)
469      return vdc8563_port_r(space, offset & 0xff);
471      return vdc8563_port_r(vdc8563, offset & 0xff);
470472   else if (offset < 0xc00)
471473      return c64_colorram[offset & 0x3ff];
472474   else if (offset == 0xc00)
r7369r7370
11601162DRIVER_INIT( c128 )
11611163{
11621164   running_device *vic2e = devtag_get_device(machine, "vic2e");
1165   running_device *vdc8563 = devtag_get_device(machine, "vdc8563");
11631166
11641167   c64_tape_on = 1;
11651168   c64_pal = 0;
11661169   c128_common_driver_init(machine);
11671170   vic2_set_rastering(vic2e, 0);
1168   vdc8563_init(0);
1169   vdc8563_set_rastering(1);
1171   vdc8563_set_rastering(vdc8563, 1);
11701172}
11711173
11721174DRIVER_INIT( c128pal )
11731175{
11741176   running_device *vic2e = devtag_get_device(machine, "vic2e");
1177   running_device *vdc8563 = devtag_get_device(machine, "vdc8563");
11751178
11761179   c64_tape_on = 1;
11771180   c64_pal = 1;
11781181   c128_common_driver_init(machine);
11791182   vic2_set_rastering(vic2e, 1);
1180   vdc8563_init(0);
1181   vdc8563_set_rastering(0);
1183   vdc8563_set_rastering(vdc8563, 0);
11821184}
11831185
11841186DRIVER_INIT( c128d )
r7369r7370
12301232   static const char *const c128ports[] = { "KP0", "KP1", "KP2" };
12311233   int i, value;
12321234   running_device *vic2e = devtag_get_device(device->machine, "vic2e");
1235   running_device *vdc8563 = devtag_get_device(device->machine, "vdc8563");
12331236
12341237   c128_nmi(device->machine);
12351238
r7369r7370
12381241      if (input_port_read(device->machine, "SPECIAL") & 0x08)
12391242      {
12401243         vic2_set_rastering(vic2e, 0);
1241         vdc8563_set_rastering(1);
1244         vdc8563_set_rastering(vdc8563, 1);
12421245         video_screen_set_visarea(device->machine->primary_screen, 0, 655, 0, 215);
12431246      }
12441247      else
12451248      {
12461249         vic2_set_rastering(vic2e, 1);
1247         vdc8563_set_rastering(0);
1250         vdc8563_set_rastering(vdc8563, 0);
12481251         if (c64_pal)
12491252            video_screen_set_visarea(device->machine->primary_screen, 0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1);
12501253         else
r7369r7370
12711274   }
12721275}
12731276
1274
1275VIDEO_START( c128 )
1276{
1277   VIDEO_START_CALL(vdc8563);
1278}
1279
12801277VIDEO_UPDATE( c128 )
12811278{
12821279   running_device *vic2e = devtag_get_device(screen->machine, "vic2e");
1280   running_device *vdc8563 = devtag_get_device(screen->machine, "vdc8563");
12831281
1284   VIDEO_UPDATE_CALL(vdc8563);
1282   vdc8563_video_update(vdc8563, bitmap, cliprect);
12851283   vic2_video_update(vic2e, bitmap, cliprect);
12861284   return 0;
12871285}
src/mess/drivers/c128.c
r7369r7370
255255   AM_RANGE(0xd000, 0xd3ff) AM_DEVREADWRITE("vic2e", vic2_port_r, vic2_port_w)
256256   AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w)
257257   AM_RANGE(0xd500, 0xd5ff) AM_READWRITE(c128_mmu8722_port_r, c128_mmu8722_port_w)
258   AM_RANGE(0xd600, 0xd7ff) AM_READWRITE(vdc8563_port_r, vdc8563_port_w)
258   AM_RANGE(0xd600, 0xd7ff) AM_DEVREADWRITE("vdc8563", vdc8563_port_r, vdc8563_port_w)
259259   AM_RANGE(0xdc00, 0xdcff) AM_DEVREADWRITE("cia_0", mos6526_r, mos6526_w)
260260   AM_RANGE(0xdd00, 0xddff) AM_DEVREADWRITE("cia_1", mos6526_r, mos6526_w)
261261/*  AM_RANGE(0xdf00, 0xdfff) AM_READWRITE(dma_port_r, dma_port_w) */
r7369r7370
522522   0x70, 0x74, 0x6f,  0x59, 0xfe, 0x59,  0x5f, 0x53, 0xfe,  0xa4, 0xa7, 0xa2
523523};
524524
525/* permutation for c64/vic6567 conversion to vdc8563
526 0 --> 0 black
527 1 --> 0xf white
528 2 --> 8 red
529 3 --> 7 cyan
530 4 --> 0xb violett
531 5 --> 4 green
532 6 --> 2 blue
533 7 --> 0xd yellow
534 8 --> 0xa orange
535 9 --> 0xc brown
536 0xa --> 9 light red
537 0xb --> 6 dark gray
538 0xc --> 1 gray
539 0xd --> 5 light green
540 0xe --> 3 light blue
541 0xf --> 0xf light gray
542 */
543
544/* c128
545 commodore assignment!?
546 black gray orange yellow dardgrey vio red lgreen
547 lred lgray brown blue white green cyan lblue
548*/
549const unsigned char vdc8563_palette[] =
550{
551#if 0
552   0x00, 0x00, 0x00, /* black */
553   0x70, 0x74, 0x6f, /* gray */
554   0x21, 0x1b, 0xae, /* blue */
555   0x5f, 0x53, 0xfe, /* light blue */
556   0x1f, 0xd2, 0x1e, /* green */
557   0x59, 0xfe, 0x59, /* light green */
558   0x42, 0x45, 0x40, /* dark gray */
559   0x30, 0xe6, 0xc6, /* cyan */
560   0xbe, 0x1a, 0x24, /* red */
561   0xfe, 0x4a, 0x57, /* light red */
562   0xb8, 0x41, 0x04, /* orange */
563   0xb4, 0x1a, 0xe2, /* purple */
564   0x6a, 0x33, 0x04, /* brown */
565   0xdf, 0xf6, 0x0a, /* yellow */
566   0xa4, 0xa7, 0xa2, /* light gray */
567   0xfd, 0xfe, 0xfc /* white */
568#else
569   /* vice */
570   0x00, 0x00, 0x00, /* black */
571   0x20, 0x20, 0x20, /* gray */
572   0x00, 0x00, 0x80, /* blue */
573   0x00, 0x00, 0xff, /* light blue */
574   0x00, 0x80, 0x00, /* green */
575   0x00, 0xff, 0x00, /* light green */
576   0x00, 0x80, 0x80, /* cyan */
577   0x00, 0xff, 0xff, /* light cyan */
578   0x80, 0x00, 0x00, /* red */
579   0xff, 0x00, 0x00, /* light red */
580   0x80, 0x00, 0x80, /* purble */
581   0xff, 0x00, 0xff, /* light purble */
582   0x80, 0x80, 0x00, /* brown */
583   0xff, 0xff, 0x00, /* yellow */
584   0xc0, 0xc0, 0xc0, /* light gray */
585   0xff, 0xff, 0xff  /* white */
586#endif
587};
588
525589static PALETTE_INIT( c128 )
526590{
527591   int i;
r7369r7370
611675
612676/*************************************
613677 *
614 *  VIC II interfaces
678 *  VIC II / VDC interfaces
615679 *
616680 *************************************/
617681
r7369r7370
661725   c128_rdy_cb
662726};
663727
728static const vdc8563_interface c128_vdc8563_intf = {
729   "screen",
730   0
731};
732
664733/*************************************
665734
666735 *
r7369r7370
697766   MDRV_PALETTE_LENGTH((ARRAY_LENGTH(vic2_palette) + ARRAY_LENGTH(vdc8563_palette)) / 3 )
698767   MDRV_PALETTE_INIT( c128 )
699768
700   MDRV_VIDEO_START( c128 )
701769   MDRV_VIDEO_UPDATE( c128 )
702770
703771   MDRV_VIC2_ADD("vic2e", c128_vic2_ntsc_intf)
772   MDRV_VDC8563_ADD("vdc8563", c128_vdc8563_intf)
704773
705774   /* sound hardware */
706775   MDRV_SPEAKER_STANDARD_MONO("mono")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team