Previous 15994 Revisions Next

r2104 Tuesday 25th March, 2008 at 18:05:22 UTC by Wilbert Pol
[PC_CGA] Fixed bg color handling in text_inten mode (bug #1560). Added more explicit hpixel settings for different modes.
[src/mess/video]pc_cga.c

src/mess/video/pc_cga.c
r2103r2104
5454#include "memconv.h"
5555
5656#define VERBOSE_CGA 0      /* CGA (Color Graphics Adapter) */
57#define   NTSC_FILTER   0
5758
5859#define CGA_LOG(N,M,A) \
5960   if(VERBOSE_CGA>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()),(char*)M ); logerror A; }
r2103r2104
103104   MDRV_SCREEN_ADD(CGA_SCREEN_NAME, RASTER)
104105   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
105106   MDRV_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,912,0,640,262,0,200)
106   MDRV_PALETTE_LENGTH( CGA_PALETTE_SETS * 16 )
107   MDRV_PALETTE_LENGTH(/* CGA_PALETTE_SETS * 16*/ 65536 )
107108
108109   MDRV_PALETTE_INIT(pc_cga)
109110
r2103r2104
170171
171172
172173/***************************************************************************
174 *
175 * NTSC filter
176 *
177 * Code taken from http://www.reenigne.org/crtc.html
178 *
179 ***************************************************************************/
173180
181struct ntsc_decoder {
182   int period;
183
184   int *I_filter;
185   int *Q_filter;
186
187   int *Y_buffer;
188   int *I_buffer;
189   int *Q_buffer;
190
191   int Y_total;
192   int I_total;
193   int Q_total;
194} ntsc;
195
196
197/* Clear NTSC buffers and running totals. Call this before the beginning of each new line. */
198static void ntsc_clear(struct ntsc_decoder *ntsc) {
199   int j;
200   for (j=0;j<ntsc->period;++j) {
201      ntsc->Y_buffer[j] = 0;
202      ntsc->I_buffer[j] = 0;
203      ntsc->Q_buffer[j] = 0;
204   }
205   ntsc->Y_total = 0;
206   ntsc->I_total = 0;
207   ntsc->Q_total = 0;
208}
209
210
211/* Create an NTSC decoder object.
212
213   period is the number of times the NTSC signal is sampled per cycle of the color subcarrier clock (3.579545 MHz).
214   e.g. CGA is 8 because you need to sample the chroma signal at 28.6MHz to retain all color information.
215   For 4-color composite systems such as CoCo, 2 samples may suffice.
216
217   samples is also the number of data points whose values are used to determine the color of a given point.
218
219   Points here do not necessarily correspond to pixels - points are samples of the RGB color decoded output and pixels
220   are CPU addressable points in the input composite data.
221
222   The correct value for hue will usually be a multiple of 128.
223*/
224static void ntsc_decoder_init(struct ntsc_decoder *ntsc, int period, int hue) {
225   int j;
226
227   ntsc->period = period;
228   ntsc->I_filter = auto_malloc(period * sizeof(int));
229   ntsc->Q_filter = auto_malloc(period * sizeof(int));
230   ntsc->Y_buffer = auto_malloc(period * sizeof(int));
231   ntsc->I_buffer = auto_malloc(period * sizeof(int));
232   ntsc->Q_buffer = auto_malloc(period * sizeof(int));
233   ntsc_clear(ntsc);
234   for (j=0;j<period;++j) {
235      double angle = M_PI*((hue+(j<<8))/(period*128.0)-33.0/180);
236      ntsc->I_filter[j] = (int)(512.0*cos(angle));
237      ntsc->Q_filter[j] = (int)(512.0*sin(angle));
238   }
239}
240
241
242/* Decode some NTSC data, working from left to right.
243
244   The composite (luma+chroma) values are in "input", scaled to 0-255 values.
245   Red, green and blue bytes (in that order) are placed in "output".
246
247   Note that consecutive calls to ntsc_decode() should be on consecutive input data,
248   or the first ntsc->samples points will be inaccurate. To avoid this inaccuracy,
249   first call ntsc_decode(ntsc, input, NULL, 1) with "input" containing the
250   samples directly before the samples you will subsequently be using.
251*/
252static void ntsc_decode(struct ntsc_decoder *ntsc, UINT8 *input, UINT8 *output, int periods) {
253   int j;
254
255   int *I_filter;
256   int *Q_filter;
257   int *Y_buffer;
258   int *I_buffer;
259   int *Q_buffer;
260   int Y_total = ntsc->Y_total;
261   int I_total = ntsc->I_total;
262   int Q_total = ntsc->Q_total;
263   int Y,I,Q;
264   int R,G,B;
265   int period = ntsc->period;
266
267   while ((--periods)>=0) {
268      I_filter = ntsc->I_filter;
269      Q_filter = ntsc->Q_filter;
270      Y_buffer = ntsc->Y_buffer;
271      I_buffer = ntsc->I_buffer;
272      Q_buffer = ntsc->Q_buffer;
273
274      for (j=0;j<period;++j) {
275
276         /* Get next point */
277         Y = *(input++);
278         I = Y * *(I_filter++);
279         Q = Y * *(Q_filter++);
280
281         /* Update running totals */
282         Y_total += Y - *Y_buffer;
283         I_total += I - *I_buffer;
284         Q_total += Q - *Q_buffer;
285
286         /* Save point in buffer */
287         *(Y_buffer++) = Y;
288         *(I_buffer++) = I;
289         *(Q_buffer++) = Q;
290
291         /* Compute averages over entire period */
292         Y = Y_total/period;
293         I = I_total/period;
294         Q = Q_total/period;
295
296         /* Clamp YIQ values to avoid hue drift of oversaturated colors */
297         if (Y>256) Y=256; if (Y<0) Y=0;
298         if (I>39041) I=39041; if (I<-39041) I=-39041;
299         if (Q>34249) Q=34249; if (Q<-34249) Q=-34249;
300
301         /* Convert YIQ to RGB */
302         Y<<=16;
303         R = (Y + 249*I + 159*Q)>>16;
304         G = (Y -  70*I - 166*Q)>>16;
305         B = (Y - 283*I + 436*Q)>>16;
306
307         /* Clamp the RGB values */
308         if (R>255) R=255; if (R<0) R=0;
309         if (G>255) G=255; if (G<0) G=0;
310         if (B>255) B=255; if (B<0) B=0;
311
312         /* Emit the RGB values to the output buffer */
313         *output = R; output++;
314         *output = G; output++;
315         *output = B; output++;
316      }
317   }
318   ntsc->Y_total = Y_total;
319   ntsc->I_total = I_total;
320   ntsc->Q_total = Q_total;
321}
322
323
324/***************************************************************************
325
174326   Methods
175327
176328***************************************************************************/
r2103r2104
178330/* Initialise the cga palette */
179331static PALETTE_INIT( pc_cga )
180332{
181   int i;
333   int i, r, g, b;
182334
183335   for ( i = 0; i < CGA_PALETTE_SETS * 16; i++ ) {
184336      palette_set_color_rgb( machine, i, cga_palette[i][0], cga_palette[i][1], cga_palette[i][2] );
185337   }
338
339   i = 0x8000;
340   for ( r = 0; r < 32; r++ ) {
341      for ( g = 0; g < 32; g++ ) {
342         for ( b = 0; b < 32; b++ ) {
343            palette_set_color_rgb( machine, i, r << 3, g << 3, b << 3 );
344            i++;
345         }
346      }
347   }
186348}
187349
188350
r2103r2104
247409   memory_set_bankptr(11, videoram);
248410
249411   internal_pc_cga_video_start(M6845_PERSONALITY_GENUINE);
412
413   ntsc_decoder_init( &ntsc, 8, 256 );
250414}
251415
252416
r2103r2104
284448      UINT8 attr = videoram[ offset +1 ];
285449      UINT8 data = cga.chr_gen[ chr * 8 + ra ];
286450      UINT16 fg = attr & 0x0F;
287      UINT16 bg = ( attr >> 4 ) & 0x07;
451      UINT16 bg = attr >> 4;
288452
289453      if ( i == cursor_x ) {
290454         data = 0xFF;
r2103r2104
304468
305469/***************************************************************************
306470  Draw text mode with 40x25 characters (default) with high intensity bg.
471  The character cell size is 16x8. Composite monitor, greyscale.
472***************************************************************************/
473
474static MC6845_UPDATE_ROW( cga_text_inten_comp_grey_update_row ) {
475   UINT16  *p = BITMAP_ADDR16(bitmap, y, 0);
476   int i;
477
478   if ( y == 0 ) logerror("cga_text_inten_update_row\n");
479   for ( i = 0; i < x_count; i++ ) {
480      UINT16 offset = ( ( ma + i ) << 1 ) & 0x3fff;
481      UINT8 chr = videoram[ offset ];
482      UINT8 attr = videoram[ offset +1 ];
483      UINT8 data = cga.chr_gen[ chr * 8 + ra ];
484      UINT16 fg = 0x10 + ( attr & 0x0F );
485      UINT16 bg = 0x10 + ( ( attr >> 4 ) & 0x07 );
486
487      if ( i == cursor_x ) {
488         data = 0xFF;
489      }
490
491      *p = ( data & 0x80 ) ? fg : bg; p++;
492      *p = ( data & 0x40 ) ? fg : bg; p++;
493      *p = ( data & 0x20 ) ? fg : bg; p++;
494      *p = ( data & 0x10 ) ? fg : bg; p++;
495      *p = ( data & 0x08 ) ? fg : bg; p++;
496      *p = ( data & 0x04 ) ? fg : bg; p++;
497      *p = ( data & 0x02 ) ? fg : bg; p++;
498      *p = ( data & 0x01 ) ? fg : bg; p++;
499   }
500}
501
502/***************************************************************************
503  Draw text mode with 40x25 characters (default) with high intensity bg.
307504  The character cell size is 16x8
308505***************************************************************************/
309506
r2103r2104
411608}
412609
413610
414/* The lo-res graphics mode on a colour composite monitor */
611/* The lo-res (320x200) graphics mode on a colour composite monitor */
415612
416613static MC6845_UPDATE_ROW( cga_gfx_4bppl_update_row ) {
417614   UINT16  *p = BITMAP_ADDR16(bitmap, y, 0);
r2103r2104
443640 * are the same size as the normal colour ones.
444641 */
445642
643static const UINT8 yc_lut2[4] = { 0, 182, 71, 255 };
644
645static const UINT8 yc_lut[16][8] = {
646   { 0, 0, 0, 0, 0, 0, 0, 0 },   /* black */
647   { 0, 0, 0, 0, 1, 1, 1, 1 },   /* blue */
648   { 0, 1, 1, 1, 1, 0, 0, 0 },   /* green */
649   { 0, 0, 1, 1, 1, 1, 0, 0 },   /* cyan */
650   { 1, 1, 0, 0, 0, 0, 1, 1 }, /* red */
651   { 1, 0, 0, 0, 0, 1, 1, 1 }, /* magenta */
652   { 1, 1, 1, 1, 0, 0, 0, 0 }, /* yellow */
653   { 1, 1, 1, 1, 1, 1, 1, 1 }, /* white */
654   /* Intensity set */
655   { 2, 2, 2, 2, 2, 2, 2, 2 }, /* black */
656   { 2, 2, 2, 2, 3, 3, 3, 3 }, /* blue */
657   { 2, 3, 3, 3, 3, 2, 2, 2 }, /* green */
658   { 2, 2, 3, 3, 3, 3, 2, 2 }, /* cyan */
659   { 3, 3, 2, 2, 2, 2, 3, 3 }, /* red */
660   { 3, 2, 2, 2, 2, 3, 3, 3 }, /* magenta */
661   { 3, 3, 3, 3, 2, 2, 2, 2 }, /* yellow */
662   { 3, 3, 3, 3, 3, 3, 3, 3 }, /* white */
663};
664
446665static MC6845_UPDATE_ROW( cga_gfx_4bpph_update_row ) {
666   UINT8   samples[1280];
667   UINT8   ntsc_decoded[3*1280];
668   int      samp_index = 0;
447669   UINT16  *p = BITMAP_ADDR16(bitmap, y, 0);
448670   int i;
449671
450672   if ( y == 0 ) logerror("cga_gfx_4bpph_update_row\n");
673if ( NTSC_FILTER ) {
674   ntsc_clear( &ntsc );
675   memset( ntsc_decoded, 0, sizeof(ntsc_decoded));
676}
451677   for ( i = 0; i < x_count; i++ ) {
452678      UINT16 offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( y & 1 ) << 13 );
453679      UINT8 data = videoram[ offset ];
454680
681if ( NTSC_FILTER ) {
682      samples[samp_index] = yc_lut2[yc_lut[data>>4][0]]; samp_index++;
683      samples[samp_index] = yc_lut2[yc_lut[data>>4][1]]; samp_index++;
684      samples[samp_index] = yc_lut2[yc_lut[data>>4][2]]; samp_index++;
685      samples[samp_index] = yc_lut2[yc_lut[data>>4][3]]; samp_index++;
686      samples[samp_index] = yc_lut2[yc_lut[data>>4][4]]; samp_index++;
687      samples[samp_index] = yc_lut2[yc_lut[data>>4][5]]; samp_index++;
688      samples[samp_index] = yc_lut2[yc_lut[data>>4][6]]; samp_index++;
689      samples[samp_index] = yc_lut2[yc_lut[data>>4][7]]; samp_index++;
690
691      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][0]]; samp_index++;
692      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][1]]; samp_index++;
693      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][2]]; samp_index++;
694      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][3]]; samp_index++;
695      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][4]]; samp_index++;
696      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][5]]; samp_index++;
697      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][6]]; samp_index++;
698      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][7]]; samp_index++;
699}
700
455701      *p = data >> 4; p++;
456702      *p = data >> 4; p++;
703      *p = data >> 4; p++;
704      *p = data >> 4; p++;
457705      *p = data & 0x0F; p++;
458706      *p = data & 0x0F; p++;
707      *p = data & 0x0F; p++;
708      *p = data & 0x0F; p++;
459709
460710      data = videoram[ offset + 1 ];
461711
712if ( NTSC_FILTER ) {
713      samples[samp_index] = yc_lut2[yc_lut[data>>4][0]]; samp_index++;
714      samples[samp_index] = yc_lut2[yc_lut[data>>4][1]]; samp_index++;
715      samples[samp_index] = yc_lut2[yc_lut[data>>4][2]]; samp_index++;
716      samples[samp_index] = yc_lut2[yc_lut[data>>4][3]]; samp_index++;
717      samples[samp_index] = yc_lut2[yc_lut[data>>4][4]]; samp_index++;
718      samples[samp_index] = yc_lut2[yc_lut[data>>4][5]]; samp_index++;
719      samples[samp_index] = yc_lut2[yc_lut[data>>4][6]]; samp_index++;
720      samples[samp_index] = yc_lut2[yc_lut[data>>4][7]]; samp_index++;
721
722      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][0]]; samp_index++;
723      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][1]]; samp_index++;
724      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][2]]; samp_index++;
725      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][3]]; samp_index++;
726      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][4]]; samp_index++;
727      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][5]]; samp_index++;
728      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][6]]; samp_index++;
729      samples[samp_index] = yc_lut2[yc_lut[data & 0x0F][7]]; samp_index++;
730}
731
462732      *p = data >> 4; p++;
463733      *p = data >> 4; p++;
734      *p = data >> 4; p++;
735      *p = data >> 4; p++;
464736      *p = data & 0x0F; p++;
465737      *p = data & 0x0F; p++;
738      *p = data & 0x0F; p++;
739      *p = data & 0x0F; p++;
466740   }
741if (NTSC_FILTER) {
742   ntsc_decode( &ntsc, samples, ntsc_decoded, 160 );
743   p = BITMAP_ADDR16(bitmap, y, 0);
744   samp_index = 0;
745   for ( i = 0; i < ( 8 * x_count ); i++ ) {
746      int r = ( ntsc_decoded[samp_index] + ntsc_decoded[samp_index+3] ) / 2;
747      int g = ( ntsc_decoded[samp_index+1] + ntsc_decoded[samp_index+4] ) / 2;
748      int b = ( ntsc_decoded[samp_index+2] + ntsc_decoded[samp_index+5] ) / 2;
749      *p = 0x8000 + ( ( ( r & 0xF8 ) << 7 ) | ( ( g & 0xF8 ) << 2 ) | ( ( b & 0xF8 ) >> 3 ) );
750      p++;
751      samp_index +=6;
752   }
467753}
754}
468755
469756
470757/***************************************************************************
r2103r2104
498785
499786
500787/***************************************************************************
788  Draw graphics mode with 320x200 pixels (default) with 2 bits/pixel.
789  Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000
790  cga fetches 2 byte per mscrtc6845 access.
791***************************************************************************/
792
793static MC6845_UPDATE_ROW( cga_gfx_2bpph_update_row ) {
794      UINT16  *p = BITMAP_ADDR16(bitmap, y, 0);
795      int i;
796
797//  if ( y == 0 ) logerror("cga_gfx_2bpph_update_row\n");
798   for ( i = 0; i < x_count; i++ ) {
799      UINT16 offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( y & 1 ) << 13 );
800      UINT8 data = videoram[ offset ];
801
802      *p = cga.palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]; p++;
803      *p = cga.palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]; p++;
804      *p = cga.palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]; p++;
805      *p = cga.palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]; p++;
806      *p = cga.palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]; p++;
807      *p = cga.palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]; p++;
808      *p = cga.palette_lut_2bpp[   data        & 0x03 ]; p++;
809      *p = cga.palette_lut_2bpp[   data        & 0x03 ]; p++;
810
811      data = videoram[ offset+1 ];
812
813      *p = cga.palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]; p++;
814      *p = cga.palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]; p++;
815      *p = cga.palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]; p++;
816      *p = cga.palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]; p++;
817      *p = cga.palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]; p++;
818      *p = cga.palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]; p++;
819      *p = cga.palette_lut_2bpp[   data        & 0x03 ]; p++;
820      *p = cga.palette_lut_2bpp[   data        & 0x03 ]; p++;
821   }
822}
823
824/***************************************************************************
501825  Draw graphics mode with 640x200 pixels (default).
502826  The cell size is 1x1 (1 scanline is the real default)
503827  Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000
r2103r2104
594918 *  x x x 0 1 1 1 1 - unknown/invalid.
595919 *  x x x 1 1 0 0 0 - unknown/invalid.
596920 *  x x x 1 1 0 0 1 - unknown/invalid.
597 *  x x x 1 1 0 1 0 - 160x200/640x200 graphics. 640x200 on RGB monitor, 160x200 on composite monitor.
921 *  x x x 1 1 0 1 0 - 160x200/640x200 graphics. 640x200 ?? on RGB monitor, 160x200 on composite monitor.
598922 *  x x x 1 1 0 1 1 - unknown/invalid.
599923 *  x x x 1 1 1 0 0 - unknown/invalid.
600924 *  x x x 1 1 1 0 1 - unknown/invalid.
r2103r2104
604928static void pc_cga_mode_control_w(running_machine *machine, int data)
605929{
606930   device_config   *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, CGA_MC6845_NAME);
607   unsigned char mask = 0x3B;
608931
609932   CGA_LOG(1,"CGA_mode_control_w",("$%02x: columns %d, gfx %d, hires %d, blink %d\n",
610933      data, (data&1)?80:40, (data>>1)&1, (data>>4)&1, (data>>5)&1));
611934
612   /* CGA composite: Switching between mono & colour behaves like a
613    * mode change */
614   if(CGA_MONITOR == CGA_MONITOR_COMPOSITE) mask = 0x3F;
615935   cga.mode_control = data;
616936
617937   //logerror("mode set to %02X\n", cga.mode_control & 0x3F );
618938   switch ( cga.mode_control & 0x3F ) {
619939   case 0x08: case 0x09: case 0x0C: case 0x0D:
620940      mc6845_set_hpixels_per_column( devconf, 8 );
621      cga.update_row = cga_text_inten_update_row;
941      if ( CGA_MONITOR == CGA_MONITOR_COMPOSITE ) {
942         if ( cga.mode_control & 0x04 ) {
943            /* Composite greyscale */
944            cga.update_row = cga_text_inten_comp_grey_update_row;
945         } else {
946            /* Composite colour */
947            cga.update_row = cga_text_inten_update_row;
948         }
949      } else {
950         /* RGB colour */
951         cga.update_row = cga_text_inten_update_row;
952      }
622953      break;
623954   case 0x0A: case 0x0B: case 0x2A: case 0x2B:
624955      mc6845_set_hpixels_per_column( devconf, 8 );
r2103r2104
637968      cga.update_row = cga_text_inten_alt_update_row;
638969      break;
639970   case 0x1A: case 0x1B: case 0x3A: case 0x3B:
640      mc6845_set_hpixels_per_column( devconf, 8 );
971      mc6845_set_hpixels_per_column( devconf, 16 );
641972      if ( CGA_MONITOR == CGA_MONITOR_COMPOSITE ) {
642973         cga.update_row = cga_gfx_4bpph_update_row;
643974      } else {
644         cga.update_row = cga_gfx_2bpp_update_row;
975         cga.update_row = cga_gfx_2bpph_update_row;
645976      }
646977      break;
647978   case 0x1E: case 0x1F: case 0x3E: case 0x3F:
r2103r2104
650981      break;
651982   case 0x28: case 0x29: case 0x2C: case 0x2D:
652983      mc6845_set_hpixels_per_column( devconf, 8 );
653      cga.update_row = cga_text_blink_update_row;
984      if ( CGA_MONITOR == CGA_MONITOR_COMPOSITE ) {
985         if ( cga.mode_control & 0x04 ) {
986            /* Composite greyscale */
987            cga.update_row = cga_text_blink_update_row;
988         } else {
989            /* Composite colour */
990            cga.update_row = cga_text_blink_update_row;
991         }
992      } else {
993         /* RGB colour */
994         cga.update_row = cga_text_blink_update_row;
995      }
654996      break;
655997   case 0x38: case 0x39: case 0x3C: case 0x3D:
656998      mc6845_set_hpixels_per_column( devconf, 8 );
r2103r2104
9911333
9921334static WRITE8_HANDLER ( pc1512_w )
9931335{
994   device_config   *devconf;
1336   device_config   *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, CGA_MC6845_NAME);
9951337
9961338   switch (offset) {
9971339   case 0: case 2: case 4: case 6:
998      devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, CGA_MC6845_NAME);
9991340      data &= 0x1F;
10001341      mc6845_address_w( devconf, offset, data );
10011342      pc1512.mc6845_address = data;
10021343      break;
10031344
10041345   case 1: case 3: case 5: case 7:
1005      devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, CGA_MC6845_NAME);
10061346      if ( ! pc1512.mc6845_locked_register[pc1512.mc6845_address] ) {
10071347         mc6845_register_w( devconf, offset, data );
10081348         if ( mc6845_writeonce_register[pc1512.mc6845_address] ) {
r2103r2104
10211361      cga.mode_control = data;
10221362      switch( cga.mode_control & 0x3F ) {
10231363      case 0x08: case 0x09: case 0x0C: case 0x0D:
1364         mc6845_set_hpixels_per_column( devconf, 8 );
10241365         cga.update_row = cga_text_inten_update_row;
10251366         break;
10261367      case 0x0A: case 0x0B: case 0x2A: case 0x2B:
1368         mc6845_set_hpixels_per_column( devconf, 8 );
10271369         if ( CGA_MONITOR == CGA_MONITOR_COMPOSITE ) {
10281370            cga.update_row = cga_gfx_4bppl_update_row;
10291371         } else {
r2103r2104
10311373         }
10321374         break;
10331375      case 0x0E: case 0x0F: case 0x2E: case 0x2F:
1376         mc6845_set_hpixels_per_column( devconf, 8 );
10341377         cga.update_row = cga_gfx_2bpp_update_row;
10351378         break;
10361379      case 0x18: case 0x19: case 0x1C: case 0x1D:
1380         mc6845_set_hpixels_per_column( devconf, 8 );
10371381         cga.update_row = cga_text_inten_alt_update_row;
10381382         break;
10391383      case 0x1A: case 0x1B: case 0x3A: case 0x3B:
1384         mc6845_set_hpixels_per_column( devconf, 8 );
10401385         cga.update_row = pc1512_gfx_4bpp_update_row;
10411386         break;
10421387      case 0x1E: case 0x1F: case 0x3E: case 0x3F:
1388         mc6845_set_hpixels_per_column( devconf, 16 );
10431389         cga.update_row = cga_gfx_1bpp_update_row;
10441390         break;
10451391      case 0x28: case 0x29: case 0x2C: case 0x2D:
1392         mc6845_set_hpixels_per_column( devconf, 8 );
10461393         cga.update_row = cga_text_blink_update_row;
10471394         break;
10481395      case 0x38: case 0x39: case 0x3C: case 0x3D:
1396         mc6845_set_hpixels_per_column( devconf, 8 );
10491397         cga.update_row = cga_text_blink_alt_update_row;
10501398         break;
10511399      default:

Previous 15994 Revisions Next


© 1998-2018 The MESS Team