Previous 15994 Revisions Next

r7906 Tuesday 27th April, 2010 at 07:59:23 UTC by Curt Coder
[CGC7900] Fixed display overlay.
[src/mess/drivers]cgc7900.c
[src/mess/includes]cgc7900.h
[src/mess/video]cgc7900.c

src/mess/video/cgc7900.c
r7905r7906
3939   }
4040}
4141
42#define OVERLAY_CUR      0x80000000   /* places a cursor in the cell if SET */
43#define OVERLAY_BLK      0x40000000   /* blinks the foreground character in the cell if SET */
44#define OVERLAY_VF      0x10000000   /* makes the foreground visible if SET (else transparent) */
45#define OVERLAY_VB      0x08000000   /* makes the background visible if SET (else transparent) */
46#define OVERLAY_PL      0x01000000   /* uses bits 0-7 as PLOT DOT descriptor if SET (else ASCII) */
47#define OVERLAY_BR      0x00040000   /* turns on Red in background if SET */
48#define OVERLAY_BG      0x00020000   /* turns on Green in background if SET */
49#define OVERLAY_BB      0x00010000   /* turns on Blue in background if SET */
50#define OVERLAY_FR      0x00000400   /* turns on Red in foreground if SET */
51#define OVERLAY_FG      0x00000200   /* turns on Green in foreground if SET */
52#define OVERLAY_FB      0x00000100   /* turns on Blue in background if SET */
42#define OVERLAY_CUR      BIT(cell, 31)   /* places a cursor in the cell if SET */
43#define OVERLAY_BLK      BIT(cell, 30)   /* blinks the foreground character in the cell if SET */
44#define OVERLAY_VF      BIT(cell, 28)   /* makes the foreground visible if SET (else transparent) */
45#define OVERLAY_VB      BIT(cell, 27)   /* makes the background visible if SET (else transparent) */
46#define OVERLAY_PL      BIT(cell, 24)   /* uses bits 0-7 as PLOT DOT descriptor if SET (else ASCII) */
47#define OVERLAY_BR      BIT(cell, 18)   /* turns on Red in background if SET */
48#define OVERLAY_BG      BIT(cell, 17)   /* turns on Green in background if SET */
49#define OVERLAY_BB      BIT(cell, 16)   /* turns on Blue in background if SET */
50#define OVERLAY_FR      BIT(cell, 10)   /* turns on Red in foreground if SET */
51#define OVERLAY_FG      BIT(cell, 9)   /* turns on Green in foreground if SET */
52#define OVERLAY_FB      BIT(cell, 8)   /* turns on Blue in background if SET */
53#define OVERLAY_DATA   (cell & 0xff)   /* ASCII or Plot Dot character */
5354
5455static void draw_overlay(running_device *screen, bitmap_t *bitmap)
5556{
r7905r7906
5859   for (int y = 0; y < 768; y++)
5960   {
6061      int sy = y / 8;
62      int line = y % 8;
6163
6264      for (int sx = 0; sx < 85; sx++)
6365      {
64         UINT16 addr = (sy * 85) + sx;
65         UINT32 cell = (state->overlay_ram[addr + 1] << 16) | state->overlay_ram[addr];
66         UINT8 data = state->char_rom[(cell & 0xff) << 3];
66         UINT16 addr = (sy * 170) + (sx * 2);
67         UINT32 cell = (state->overlay_ram[addr] << 16) | state->overlay_ram[addr + 1];
68         UINT8 data = state->char_rom[(OVERLAY_DATA << 3) | line];
6769         int fg = (cell >> 8) & 0x07;
6870         int bg = (cell >> 16) & 0x07;
6971
7072         for (int x = 0; x < 8; x++)
7173         {
72            *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = BIT(data, 7) ? fg : bg;
73            data <<= 1;
74            if (OVERLAY_CUR)
75            {
76               *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = 7;
77            }
78            else
79            {
80               if (BIT(data, x))
81               {
82                  if (OVERLAY_VF) *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = fg;
83               }
84               else
85               {
86                  if (OVERLAY_VB) *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = bg;
87               }
88            }
7489         }
75
76         addr += 2;
7790      }
7891   }
7992}
src/mess/includes/cgc7900.h
r7905r7906
1818   cgc7900_state(running_machine &machine) { }
1919
2020   /* video state */
21   UINT16 *z_ram;
2221   UINT16 *plane_ram;
2322   UINT16 *clut_ram;
2423   UINT16 *overlay_ram;
src/mess/drivers/cgc7900.c
r7905r7906
2020   ADDRESS_MAP_UNMAP_HIGH
2121   AM_RANGE(0x000000, 0x7fffff) AM_RAM AM_BASE(&chrom_ram) // 16 * Buffer card memory
2222   AM_RANGE(0x800000, 0x80ffff) AM_ROM AM_REGION(M68000_TAG, 0)   
23   AM_RANGE(0xa00000, 0xbfffff) AM_RAM AM_BASE_MEMBER(cgc7900_state, z_ram)
23//   AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(z_mode_r, z_mode_w)
2424   AM_RANGE(0xc00000, 0xdfffff) AM_RAM AM_BASE_MEMBER(cgc7900_state, plane_ram)
2525//   AM_RANGE(0xe00000, 0xe1ffff) AM_WRITE(color_status_w)
2626//   AM_RANGE(0xe20000, 0xe23fff) Raster Processor
r7905r7906
7676static INPUT_PORTS_START( cgc7900 )
7777INPUT_PORTS_END
7878
79static MACHINE_START( cgc7900 )
80{
81   cgc7900_state *state = (cgc7900_state *)machine->driver_data;
7982
83   /* register for state saving */
84   state_save_register_global_pointer(machine, state->overlay_ram, 0x4000);
85}
86
8087static MACHINE_RESET(cgc7900)
8188{
8289   UINT8* user1 = memory_region(machine, M68000_TAG);
8390
8491   memcpy((UINT8*)chrom_ram,user1,0x10000);
8592
86   devtag_get_device(machine, M68000_TAG)->reset();   
93   devtag_get_device(machine, M68000_TAG)->reset();
8794}
8895
8996
r7905r7906
118125    MDRV_CPU_ADD(M68000_TAG, M68000, XTAL_8MHz)
119126    MDRV_CPU_PROGRAM_MAP(cgc7900_mem)
120127
128    MDRV_MACHINE_START(cgc7900)
121129    MDRV_MACHINE_RESET(cgc7900)
122130   
123131    /* video hardware */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team