Previous 15994 Revisions Next

r5364 Thursday 6th August, 2009 at 21:02:38 UTC by Wilbert Pol
[IBMPCJR]
1. Updated video memory to use a ram bank.
2. Added proper support for b/w and color modes.
3. Added clock selection for mc6845 based on the graphics mode.
4. Documented driver changes in messnew.txt
[docs]messnew.txt
[src/mess/drivers]pc.c
[src/mess/video]pc_t1t.c

src/mess/video/pc_t1t.c
r5363r5364
4848   MDRV_SCREEN_ADD(T1000_SCREEN_NAME, RASTER)
4949   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
5050   MDRV_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,912,0,640,262,0,200)
51   MDRV_PALETTE_LENGTH( 16 )
51   MDRV_PALETTE_LENGTH( 32 )
5252   MDRV_PALETTE_INIT(pcjr)
5353
5454   MDRV_MC6845_ADD(T1000_MC6845_NAME, MC6845, XTAL_14_31818MHz/8, mc6845_t1000_intf)
r5363r5364
7676   MDRV_SCREEN_ADD(T1000_SCREEN_NAME, RASTER)
7777   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
7878   MDRV_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,912,0,640,262,0,200)
79   MDRV_PALETTE_LENGTH( 16 )
79   MDRV_PALETTE_LENGTH( 32 )
8080   MDRV_PALETTE_INIT(pcjr)
8181
8282   MDRV_MC6845_ADD(T1000_MC6845_NAME, MC6845, XTAL_14_31818MHz/16, mc6845_pcjr_intf)
r5363r5364
104104   };
105105   int i;
106106
107   /* colors */
107108   for(i = 0; i < 16; i++)
108109      palette_set_color_rgb(machine, i, tga_palette[i][0], tga_palette[i][1], tga_palette[i][2]);
110
111   /* b/w mode shades */
112   for(i = 0; i < 16; i++)
113      palette_set_color_rgb( machine, 16+i, ( i << 4 ) | i, ( i << 4 ) | i, ( i << 4 ) | i );
109114}
110115
111116
r5363r5364
142147   mc6845_update_row_func   update_row;
143148   UINT8   display_enable;
144149   UINT8   vsync;
150   UINT8   palette_base;
145151} pcjr = { 0 };
146152
147153
r5363r5364
187193      UINT8 chr = pcjr.displayram[ offset ];
188194      UINT8 attr = pcjr.displayram[ offset +1 ];
189195      UINT8 data = pcjr.chr_gen[ chr * pcjr.chr_size + ra ];
190      UINT16 fg = attr & 0x0F;
191      UINT16 bg = ( attr >> 4 ) & 0x07;
196      UINT16 fg = pcjr.palette_base + ( attr & 0x0F );
197      UINT16 bg = pcjr.palette_base + ( ( attr >> 4 ) & 0x07 );
192198
193199      if ( i == cursor_x && ( pcjr.pc_framecnt & 0x08 ) )
194200      {
r5363r5364
218224      UINT8 chr = pcjr.displayram[ offset ];
219225      UINT8 attr = pcjr.displayram[ offset +1 ];
220226      UINT8 data = pcjr.chr_gen[ chr * pcjr.chr_size + ra ];
221      UINT16 fg = attr & 0x0F;
222      UINT16 bg = ( attr >> 4 ) & 0x07;
227      UINT16 fg = pcjr.palette_base + ( attr & 0x0F );
228      UINT16 bg = pcjr.palette_base + ( ( attr >> 4 ) & 0x07 );
223229
224230      if ( i == cursor_x )
225231      {
r5363r5364
259265      UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff;
260266      UINT8 data = vid[ offset ];
261267
262      *p = pcjr.reg.data[0x10 + ( data >> 4 )]; p++;
263      *p = pcjr.reg.data[0x10 + ( data >> 4 )]; p++;
264      *p = pcjr.reg.data[0x10 + ( data & 0x0F )]; p++;
265      *p = pcjr.reg.data[0x10 + ( data & 0x0F )]; p++;
268      *p = pcjr.palette_base + pcjr.reg.data[0x10 + ( data >> 4 )]; p++;
269      *p = pcjr.palette_base + pcjr.reg.data[0x10 + ( data >> 4 )]; p++;
270      *p = pcjr.palette_base + pcjr.reg.data[0x10 + ( data & 0x0F )]; p++;
271      *p = pcjr.palette_base + pcjr.reg.data[0x10 + ( data & 0x0F )]; p++;
266272
267273      data = vid[ offset + 1 ];
268274
269      *p = pcjr.reg.data[0x10 + ( data >> 4 )]; p++;
270      *p = pcjr.reg.data[0x10 + ( data >> 4 )]; p++;
271      *p = pcjr.reg.data[0x10 + ( data & 0x0F )]; p++;
272      *p = pcjr.reg.data[0x10 + ( data & 0x0F )]; p++;
275      *p = pcjr.palette_base + pcjr.reg.data[0x10 + ( data >> 4 )]; p++;
276      *p = pcjr.palette_base + pcjr.reg.data[0x10 + ( data >> 4 )]; p++;
277      *p = pcjr.palette_base + pcjr.reg.data[0x10 + ( data & 0x0F )]; p++;
278      *p = pcjr.palette_base + pcjr.reg.data[0x10 + ( data & 0x0F )]; p++;
273279   }
274280}
275281
r5363r5364
280286   UINT8   *vid = pcjr.displayram + ( ra << 13 );
281287   int i;
282288
283   if ( y == 0 ) logerror("t1000_gfx_2bpp_update_row\n");
284289   for ( i = 0; i < x_count; i++ )
285290   {
286291      UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff;
287292      UINT8 data = vid[ offset ];
288293
289      *p = pcjr.reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]; p++;
290      *p = pcjr.reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]; p++;
291      *p = pcjr.reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]; p++;
292      *p = pcjr.reg.data[ 0x10 + (   data        & 0x03 ) ]; p++;
294      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]; p++;
295      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]; p++;
296      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]; p++;
297      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + (   data        & 0x03 ) ]; p++;
293298
294299      data = vid[ offset+1 ];
295300
296      *p = pcjr.reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]; p++;
297      *p = pcjr.reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]; p++;
298      *p = pcjr.reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]; p++;
299      *p = pcjr.reg.data[ 0x10 + (   data        & 0x03 ) ]; p++;
301      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]; p++;
302      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]; p++;
303      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]; p++;
304      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + (   data        & 0x03 ) ]; p++;
300305   }
301306}
302307
303308
309static MC6845_UPDATE_ROW( pcjr_gfx_2bpp_high_update_row )
310{
311   UINT16  *p = BITMAP_ADDR16(bitmap, y, 0);
312   UINT8   *vid = pcjr.displayram + ( ra << 13 );
313   int i;
314
315   for ( i = 0; i < x_count; i++ )
316   {
317      UINT16 offset = ( ( ma + i ) << 1 ) & 0x1fff;
318      UINT8 data0 = vid[ offset ];
319      UINT8 data1 = vid[ offset + 1 ];
320
321      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x80 ) >> 7 ) | ( ( data1 & 0x80 ) >> 6 ) ) ]; p++;
322      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x40 ) >> 6 ) | ( ( data1 & 0x40 ) >> 5 ) ) ]; p++;
323      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x20 ) >> 5 ) | ( ( data1 & 0x20 ) >> 4 ) ) ]; p++;
324      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x10 ) >> 4 ) | ( ( data1 & 0x10 ) >> 3 ) ) ]; p++;
325      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x08 ) >> 3 ) | ( ( data1 & 0x08 ) >> 2 ) ) ]; p++;
326      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x04 ) >> 2 ) | ( ( data1 & 0x04 ) >> 1 ) ) ]; p++;
327      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x02 ) >> 1 ) | ( ( data1 & 0x02 )      ) ) ]; p++;
328      *p = pcjr.palette_base + pcjr.reg.data[ 0x10 + ( ( ( data0 & 0x01 )      ) | ( ( data1 & 0x01 ) << 1 ) ) ]; p++;
329   }
330}
331
332
304333static MC6845_UPDATE_ROW( t1000_gfx_2bpp_tga_update_row )
305334{
306335   UINT16   *p = BITMAP_ADDR16(bitmap, y, 0);
r5363r5364
331360{
332361   UINT16  *p = BITMAP_ADDR16(bitmap, y, 0);
333362   UINT8   *vid = pcjr.displayram + ( ra << 13 );
334   UINT8   fg = pcjr.reg.data[0x11];
335   UINT8   bg = pcjr.reg.data[0x10];
363   UINT8   fg = pcjr.palette_base + pcjr.reg.data[0x11];
364   UINT8   bg = pcjr.palette_base + pcjr.reg.data[0x10];
336365   int i;
337366
338367   if ( y == 0 ) logerror("t1000_gfx_1bpp_update_row\n");
r5363r5364
363392   }
364393}
365394
395
366396static MC6845_UPDATE_ROW( t1000_update_row )
367397{
368398   if ( pcjr.update_row )
r5363r5364
371401   }
372402}
373403
404
374405 READ8_HANDLER ( pc_t1t_videoram_r )
375406{
376407   int data = 0xff;
r5363r5364
452483/* bit1 - 1 = enable blink */
453484/* bit3 - 1 = 2 color graphics */
454485
455static void pc_pcjr_mode_switch( void )
486static void pc_pcjr_mode_switch( running_machine *machine )
456487{
457   switch( pcjr.reg.data[0] & 0x1F )
488   const device_config *mc6845 = devtag_get_device(machine, T1000_MC6845_NAME);
489
490   switch( pcjr.reg.data[0] & 0x1A )
458491   {
459   case 0x08: case 0x09:
460   case 0x0C: case 0x0D:   /* B/W modes */
492   case 0x08:      /* 01x0x */
461493      if ( pcjr.reg.data[3] & 0x02 )
462494      {
463495         pcjr.update_row = t1000_text_blink_update_row;
r5363r5364
467499         pcjr.update_row = t1000_text_inten_update_row;
468500      }
469501      break;
470   case 0x1A: case 0x1B:
471      pcjr.update_row = t1000_gfx_4bpp_update_row;
472      break;
473   case 0x0A: case 0x0B:
502   case 0x0A:      /* 01x1x */
503      /* By default use medium resolution mode */
474504      pcjr.update_row = t1000_gfx_2bpp_update_row;
475      break;
476   case 0x0E:
477      if ( pcjr.reg.data[3] & 0x08 )
505
506      /* Check for high resolution mode */
507      if ( ( pcjr.bank & 0xc0 ) == 0xc0 )
508         pcjr.update_row = pcjr_gfx_2bpp_high_update_row;
509
510      /* Check for 640x200 b/w 2 shades mode */
511      if ( ( pcjr.reg.data[0] & 0x04 ) && ( pcjr.reg.data[3] & 0x08 ) )
478512      {
479513         pcjr.update_row = t1000_gfx_1bpp_update_row;
480514      }
481      else
482      {
483         pcjr.update_row = t1000_gfx_2bpp_update_row;   /* B/W mode */
484      }
485515      break;
516   case 0x18:      /* 11x0x - invalid?? */
517      pcjr.update_row = NULL;
518      break;
519   case 0x1A:      /* 11x1x */
520      pcjr.update_row = t1000_gfx_4bpp_update_row;
521      break;
486522   default:
487523      pcjr.update_row = NULL;
488524      break;
489525   }
526
527   /* Determine mc6845 input clock */
528   if ( pcjr.reg.data[0] & 0x01 )
529   {
530      mc6845_set_clock( mc6845, XTAL_14_31818MHz/8 );
531   }
532   else
533   {
534      mc6845_set_clock( mc6845, XTAL_14_31818MHz/16 );
535   }
536
537   /* color or b/w? */
538   pcjr.palette_base = ( pcjr.reg.data[0] & 0x04 ) ? 16 : 0;
490539}
491540
492541
r5363r5364
592641}
593642
594643
595static void pc_pcjr_vga_data_w(int data)
644static void pc_pcjr_vga_data_w(running_machine *machine, int data)
596645{
597646   pcjr.reg.data[pcjr.reg.index] = data;
598647
r5363r5364
604653               /* bit2 - 0 = color, 1 = b/w */
605654               /* bit3 - 0 = video disable, 1 = video enable */
606655               /* bit4 - 1 = 16 color graphics */
607         pc_pcjr_mode_switch();
656//printf("pc_pcjr_vga_data_w: mode control 1 write %02x\n", data );
657         pc_pcjr_mode_switch(machine);
608658         break;
609659      case 0x01:   /* palette mask (bits 3-0) */
610660         break;
r5363r5364
613663      case 0x03:   /* mode control 2 */
614664               /* bit1 - 1 = enable blink */
615665               /* bit3 - 1 = 2 color graphics */
616         pc_pcjr_mode_switch();
666//printf("pc_pcjr_vga_data_w: mode control 2 write %02x\n", data );
667         pc_pcjr_mode_switch(machine);
617668         break;
618669      case 0x04:   /* reset register */
619670         break;
r5363r5364
690741#endif
691742      videoram = &ram[vram];
692743      pcjr.displayram = &ram[dram];
744      pc_t1t_mode_switch();
693745   }
694   pc_t1t_mode_switch();
695746}
696747
697748
698749static void pc_pcjr_bank_w(running_machine *machine, int data)
699750{
751//printf("pc_pcjr_bank_w: %02x\n", data);
700752   if (pcjr.bank != data)
701753   {
702754      int dram, vram;
r5363r5364
712764         dram = ((data & 0x07) << 14);
713765         vram = ((data & 0x38) << (14-3));
714766      }
715      videoram = mess_ram + vram;
767      memory_set_bankptr( machine, 14, mess_ram + vram );
716768      pcjr.displayram = mess_ram + dram;
717769   }
718   pc_pcjr_mode_switch();
770   pc_pcjr_mode_switch(machine);
719771}
720772
721773
r5363r5364
788840      case 10:
789841         if ( pcjr.address_data_ff & 0x01 )
790842         {
791            pc_pcjr_vga_data_w( data );
843            pc_pcjr_vga_data_w( space->machine, data );
792844         }
793845         else
794846         {
src/mess/drivers/pc.c
r5363r5364
410410   AM_RANGE(0x00000, 0x9ffff) AM_RAMBANK(10)
411411   AM_RANGE(0xa0000, 0xaffff) AM_RAM
412412   AM_RANGE(0xb0000, 0xb7fff) AM_NOP
413   AM_RANGE(0xb8000, 0xbffff) AM_READWRITE(pc_t1t_videoram_r, pc_video_videoram_w)
413   AM_RANGE(0xb8000, 0xbffff) AM_RAMBANK(14)
414414   AM_RANGE(0xc0000, 0xc7fff) AM_NOP
415415   AM_RANGE(0xc8000, 0xc9fff) AM_ROM
416416   AM_RANGE(0xca000, 0xcffff) AM_NOP
docs/messnew.txt
r5363r5364
2323----------------------
2424- [COCO] Bug #1839 fixed [Miodrag Milanovic]
2525
26- [IBMPCJR] Fixed the floppy watchdog timer.  [Wilbert Pol]
27
28- [IBMPCJR] Main memory and video ram are now shared.  [Wilbert Pol]
29
30- [IBMPCJR] Added proper support for b/w and color modes.  [Wilbert Pol]
31
32- [IBMPCJR] Added selection of proper mc6845 input clocks for
33            different graphics modes.  [Wilbert Pol]
34
2635- [JAGUAR] Replaced wave table code with a ROM. [Zerosquare, Robbbert]
2736           Fixed quickload problems.
2837           Various miscellaneous improvements. [Robbbert]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team