Previous 15994 Revisions Next

r4402 Saturday 7th March, 2009 at 04:51:13 UTC by Robbbert
[MBEE] Video is now scanline based.
[src/mess/drivers]mbee.c
[src/mess/video]mbee.c super80.c

src/mess/video/mbee.c
r4401r4402
7272
7373WRITE8_HANDLER ( mbee_pcg_w )
7474{
75   if( mbee_pcgram[0x0800+offset] != data )
76   {
77      int chr = 0x80 + offset / 16;
78      mbee_pcgram[0x0800+offset] = data;
79      /* decode character graphics again */
80      gfx_element_mark_dirty(space->machine->gfx[0], chr);
81   }
75   mbee_pcgram[0x0800 | offset] = data;
8276}
8377
8478WRITE8_HANDLER ( mbee_pcg_color_w )
8579{
8680   if( (m6545_video_bank & 0x01) || (mbee_pcg_color_latch & 0x40) == 0 )
87   {
88      if( mbee_pcgram[0x0800+offset] != data )
89      {
90         int chr = 0x80 + offset / 16;
91         mbee_pcgram[0x0800+offset] = data;
92         /* decode character graphics again */
93         gfx_element_mark_dirty(space->machine->gfx[0], chr);
94      }
95   }
81      mbee_pcgram[0x0800 | offset] = data;
9682   else
9783      colorram[offset] = data;
9884}
r4401r4402
461447
462448VIDEO_UPDATE( mbee )
463449{
464   UINT16 i, bytes = crt.horizontal_displayed*crt.vertical_displayed;
450   UINT8 y,z,chr,gfx;
451   UINT16 mem,sy=0,sx=0,x,i;
465452   UINT8 speed = crt.cursor_top&0x20, flash = crt.cursor_top&0x40;            // cursor modes
466453   UINT16 cursor = (crt.cursor_address_hi<<8) | crt.cursor_address_lo;         // get cursor position
467454   UINT16 screen_home = (crt.screen_address_hi<<8) | crt.screen_address_lo;      // screen home offset (usually zero)
r4401r4402
470457
471458   framecnt++;
472459
473   /* Get the graphics of the character under the cursor, xor with the visible cursor scan lines,
474      and store as character number 256. */
475   for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++)
476      mbee_pcgram[0x1000+i] = mbee_pcgram[(videoram[cursor]<<4) + i] ^ mc6845_cursor[i];
460   for (y = 0; y < crt.vertical_displayed; y++)                  // for each row of chars
461   {
462      for (z = 0; z < crt.scan_lines+1; z++)                  // for each scanline
463      {
464         UINT16  *p = BITMAP_ADDR16(bitmap, sy++, 0);
477465
478   gfx_element_mark_dirty(screen->machine->gfx[0],256);         // and into machine graphics
466         for (x = sx; x < sx + crt.horizontal_displayed; x++)         // for each character
467         {
468            UINT8 inv=0;
469            mem = (x + screen_home) & 0x7ff;
470            chr = videoram[mem];
479471
480   for( i = 0; i < bytes; i++ )
481   {
482      int mem = (i + screen_home) & 0x7ff;
483      int sy = (i / crt.horizontal_displayed) * (crt.scan_lines + 1);
484      int sx = (i % crt.horizontal_displayed) << 3;
485      int chr = videoram[mem];
472            /* process cursor */
473            if ((((!flash) && (!speed)) ||               // (5,6)=(0,0) = cursor on always
474               ((flash) && (speed) && (framecnt & 0x10)) ||      // (5,6)=(1,1) = cycle per 32 frames
475               ((flash) && (!speed) && (framecnt & 8))) &&      // (5,6)=(0,1) = cycle per 16 frames
476               (mem == cursor))               // displaying at cursor position?
477                  inv ^= mc6845_cursor[z];         // cursor scan row
486478
487      /* if cursor is on and we are at cursor position, show it */
488      /* NOTE: flash rates obtained from real hardware */
479            /* get pattern of pixels for that character scanline */
480            gfx = mbee_pcgram[(chr<<4) | z] ^ inv;
489481
490      if ((((!flash) && (!speed)) ||               // (5,6)=(0,0) = cursor on always
491         ((flash) && (speed) && (framecnt & 0x10)) ||      // (5,6)=(1,1) = cycle per 32 frames
492         ((flash) && (!speed) && (framecnt & 8))) &&      // (5,6)=(0,1) = cycle per 16 frames
493         (mem == cursor))               // displaying at cursor position?
494            chr = 256;               // 256 = cursor character
495
496      drawgfx( bitmap, screen->machine->gfx[0],chr,0,0,0,sx,sy,
497         NULL,TRANSPARENCY_NONE,0);   // put character on the screen
482            /* Display a scanline of a character (8 pixels) */
483            *p = ( gfx & 0x80 ) ? 1 : 0; p++;
484            *p = ( gfx & 0x40 ) ? 1 : 0; p++;
485            *p = ( gfx & 0x20 ) ? 1 : 0; p++;
486            *p = ( gfx & 0x10 ) ? 1 : 0; p++;
487            *p = ( gfx & 0x08 ) ? 1 : 0; p++;
488            *p = ( gfx & 0x04 ) ? 1 : 0; p++;
489            *p = ( gfx & 0x02 ) ? 1 : 0; p++;
490            *p = ( gfx & 0x01 ) ? 1 : 0; p++;
491         }
492      }
493      sx+=crt.horizontal_displayed;
498494   }
499     
500495   return 0;
501496}
502497
503498VIDEO_UPDATE( mbeeic )
504499{
505   UINT16 i, bytes = crt.horizontal_displayed*crt.vertical_displayed;
500   UINT8 y,z,chr,gfx,fg,bg;
501   UINT16 mem,sy=0,sx=0,x,i,col;
506502   UINT8 speed = crt.cursor_top&0x20, flash = crt.cursor_top&0x40;            // cursor modes
507503   UINT16 cursor = (crt.cursor_address_hi<<8) | crt.cursor_address_lo;         // get cursor position
508504   UINT16 screen_home = (crt.screen_address_hi<<8) | crt.screen_address_lo;      // screen home offset (usually zero)
r4401r4402
512508
513509   framecnt++;
514510
515   /* Get the graphics of the character under the cursor, xor with the visible cursor scan lines,
516      and store as character number 256. */
517   for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++)
518      mbee_pcgram[0x1000+i] = mbee_pcgram[(videoram[cursor]<<4) + i] ^ mc6845_cursor[i];
519
520   gfx_element_mark_dirty(screen->machine->gfx[0],256);         // and into machine graphics
521
522   for( i = 0; i < bytes; i++ )
511   for (y = 0; y < crt.vertical_displayed; y++)                  // for each row of chars
523512   {
524      int mem = (i + screen_home) & 0x7ff;
525      int sy = (i / crt.horizontal_displayed) * (crt.scan_lines + 1);
526      int sx = (i % crt.horizontal_displayed) << 3;
527      int chr = videoram[mem];
528      int col = colorram[mem] | colourm;                  // read a byte of colour
513      for (z = 0; z < crt.scan_lines+1; z++)                  // for each scanline
514      {
515         UINT16  *p = BITMAP_ADDR16(bitmap, sy++, 0);
529516
530      /* if cursor is on and we are at cursor position, show it */
531      /* NOTE: flash rates obtained from real hardware */
517         for (x = sx; x < sx + crt.horizontal_displayed; x++)         // for each character
518         {
519            UINT8 inv=0;
520            mem = (x + screen_home) & 0x7ff;
521            chr = videoram[mem];
522            col = colorram[mem] | colourm;               // read a byte of colour
532523
533      if ((((!flash) && (!speed)) ||               // (5,6)=(0,0) = cursor on always
534         ((flash) && (speed) && (framecnt & 0x10)) ||      // (5,6)=(1,1) = cycle per 32 frames
535         ((flash) && (!speed) && (framecnt & 8))) &&      // (5,6)=(0,1) = cycle per 16 frames
536         (mem == cursor))               // displaying at cursor position?
537            chr = 256;               // 256 = cursor character
524            /* process cursor */
525            if ((((!flash) && (!speed)) ||               // (5,6)=(0,0) = cursor on always
526               ((flash) && (speed) && (framecnt & 0x10)) ||      // (5,6)=(1,1) = cycle per 32 frames
527               ((flash) && (!speed) && (framecnt & 8))) &&      // (5,6)=(0,1) = cycle per 16 frames
528               (mem == cursor))               // displaying at cursor position?
529                  inv ^= mc6845_cursor[z];         // cursor scan row
538530
539      drawgfx( bitmap, screen->machine->gfx[0],chr,col,0,0,sx,sy,
540         cliprect,TRANSPARENCY_NONE,0);   // put character on the screen
531            /* get pattern of pixels for that character scanline */
532            gfx = mbee_pcgram[(chr<<4) | z] ^ inv;
533            fg = (col & 0x001f) | 64;               // map to foreground palette
534            bg = (col & 0x07e0) >> 5;               // and background palette
541535
536            /* Display a scanline of a character (8 pixels) */
537            *p = ( gfx & 0x80 ) ? fg : bg; p++;
538            *p = ( gfx & 0x40 ) ? fg : bg; p++;
539            *p = ( gfx & 0x20 ) ? fg : bg; p++;
540            *p = ( gfx & 0x10 ) ? fg : bg; p++;
541            *p = ( gfx & 0x08 ) ? fg : bg; p++;
542            *p = ( gfx & 0x04 ) ? fg : bg; p++;
543            *p = ( gfx & 0x02 ) ? fg : bg; p++;
544            *p = ( gfx & 0x01 ) ? fg : bg; p++;
545         }
546      }
547      sx+=crt.horizontal_displayed;
542548   }
543
544549   return 0;
545550}
src/mess/video/super80.c
r4401r4402
290290            if ((((!flash) && (!speed)) ||               // (5,6)=(0,0) = cursor on always
291291               ((flash) && (speed) && (framecnt & 0x10)) ||      // (5,6)=(1,1) = cycle per 32 frames
292292               ((flash) && (!speed) && (framecnt & 8))) &&      // (5,6)=(0,1) = cycle per 16 frames
293               (x == cursor))                  // displaying at cursor position?
293               (mem == cursor))                  // displaying at cursor position?
294294                  inv ^= mc6845_cursor[z];            // cursor scan row
295295 
296296            /* get pattern of pixels for that character scanline */
src/mess/drivers/mbee.c
r4401r4402
242242//   PORT_CONFSETTING(    0x00, DEF_STR(Off))
243243INPUT_PORTS_END
244244
245/* GFX not used by video update - for documentation only */
245246static const gfx_layout mbee_charlayout =
246247{
247248    8,16,                   /* 8 x 16 characters */
r4401r4402
261262GFXDECODE_END
262263
263264static GFXDECODE_START( mbeeic )
264   GFXDECODE_ENTRY( "maincpu", 0x11000, mbee_charlayout, 0, 4096 )
265   GFXDECODE_ENTRY( "maincpu", 0x11000, mbee_charlayout, 0, 48 )
265266GFXDECODE_END
266267
267268static PALETTE_INIT( mbeeic )
r4401r4402
270271   UINT8 r, b, g, k;
271272   UINT8 level[] = { 0, 0x80, 0xff, 0xff };   /* off, half, full intensity */
272273
273   /* space for colortable (64 background and 32 foreground) */
274   machine->colortable = colortable_alloc(machine, 96);
275
276   /* set up background colortable */
274   /* set up background palette (00-63) */
277275   for (i = 0; i < 64; i++)
278276   {
279277      r = level[((i>>0)&1)|((i>>2)&2)];
280278      g = level[((i>>1)&1)|((i>>3)&2)];
281279      b = level[((i>>2)&1)|((i>>4)&2)];
282      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
280      palette_set_color(machine, i, MAKE_RGB(r, g, b));
283281   }
284282
285   /* set up foreground colortable by reading the prom */
283   /* set up foreground palette (64-95) by reading the prom */
286284   for (i = 0; i < 32; i++)
287285   {
288286      k = color_prom[i];
289287      r = level[((k>>2)&1)|((k>>4)&2)];
290288      g = level[((k>>1)&1)|((k>>3)&2)];
291289      b = level[((k>>0)&1)|((k>>2)&2)];
292      colortable_palette_set_color(machine->colortable, i|64, MAKE_RGB(r, g, b));
290      palette_set_color(machine, i|64, MAKE_RGB(r, g, b));
293291   }
294
295   /* set up background palette */
296   for (i = 0; i < 64; i++)
297      for (r = 0; r < 32; r++)
298         colortable_entry_set_value(machine->colortable, ((i<<5)|r)<<1, i);
299
300   /* set up foreground palette */
301   for (i = 0; i < 64; i++)
302      for (r = 0; r < 32; r++)
303         colortable_entry_set_value(machine->colortable, (((i<<5)|r)<<1)|1, r|64);
304292}
305293
306
307294static int mbee_vsync;
308295
309296static void mbee_pio_interrupt(const device_config *device, int state)
r4401r4402
402389   MDRV_SCREEN_REFRESH_RATE(50)
403390   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(250)) /* not accurate */
404391   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
405   MDRV_SCREEN_SIZE(64*8, 16*16)
406   MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 16*16-1)
392   MDRV_SCREEN_SIZE(64*8, 19*16)         /* need at least 17 lines for NET */
393   MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 19*16-1)
407394   MDRV_PALETTE_LENGTH(2)
408395   MDRV_PALETTE_INIT(black_and_white)
409396
r4401r4402
447434   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
448435   MDRV_SCREEN_SIZE(70*8, 310)
449436   MDRV_SCREEN_VISIBLE_AREA(0*8, 70*8-1, 0, 19*16-1)
450   MDRV_PALETTE_LENGTH(0x1000)
437   MDRV_PALETTE_LENGTH(96)
451438   MDRV_PALETTE_INIT(mbeeic)
452439
453440   MDRV_VIDEO_START(mbeeic)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team