src/mess/video/cgc7900.c
| r7905 | r7906 | |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 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 */ |
| 53 | 54 | |
| 54 | 55 | static void draw_overlay(running_device *screen, bitmap_t *bitmap) |
| 55 | 56 | { |
| r7905 | r7906 | |
| 58 | 59 | for (int y = 0; y < 768; y++) |
| 59 | 60 | { |
| 60 | 61 | int sy = y / 8; |
| 62 | int line = y % 8; |
| 61 | 63 | |
| 62 | 64 | for (int sx = 0; sx < 85; sx++) |
| 63 | 65 | { |
| 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]; |
| 67 | 69 | int fg = (cell >> 8) & 0x07; |
| 68 | 70 | int bg = (cell >> 16) & 0x07; |
| 69 | 71 | |
| 70 | 72 | for (int x = 0; x < 8; x++) |
| 71 | 73 | { |
| 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 | } |
| 74 | 89 | } |
| 75 | | |
| 76 | | addr += 2; |
| 77 | 90 | } |
| 78 | 91 | } |
| 79 | 92 | } |
src/mess/drivers/cgc7900.c
| r7905 | r7906 | |
| 20 | 20 | ADDRESS_MAP_UNMAP_HIGH |
| 21 | 21 | AM_RANGE(0x000000, 0x7fffff) AM_RAM AM_BASE(&chrom_ram) // 16 * Buffer card memory |
| 22 | 22 | 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) |
| 24 | 24 | AM_RANGE(0xc00000, 0xdfffff) AM_RAM AM_BASE_MEMBER(cgc7900_state, plane_ram) |
| 25 | 25 | // AM_RANGE(0xe00000, 0xe1ffff) AM_WRITE(color_status_w) |
| 26 | 26 | // AM_RANGE(0xe20000, 0xe23fff) Raster Processor |
| r7905 | r7906 | |
| 76 | 76 | static INPUT_PORTS_START( cgc7900 ) |
| 77 | 77 | INPUT_PORTS_END |
| 78 | 78 | |
| 79 | static MACHINE_START( cgc7900 ) |
| 80 | { |
| 81 | cgc7900_state *state = (cgc7900_state *)machine->driver_data; |
| 79 | 82 | |
| 83 | /* register for state saving */ |
| 84 | state_save_register_global_pointer(machine, state->overlay_ram, 0x4000); |
| 85 | } |
| 86 | |
| 80 | 87 | static MACHINE_RESET(cgc7900) |
| 81 | 88 | { |
| 82 | 89 | UINT8* user1 = memory_region(machine, M68000_TAG); |
| 83 | 90 | |
| 84 | 91 | memcpy((UINT8*)chrom_ram,user1,0x10000); |
| 85 | 92 | |
| 86 | | devtag_get_device(machine, M68000_TAG)->reset(); |
| 93 | devtag_get_device(machine, M68000_TAG)->reset(); |
| 87 | 94 | } |
| 88 | 95 | |
| 89 | 96 | |
| r7905 | r7906 | |
| 118 | 125 | MDRV_CPU_ADD(M68000_TAG, M68000, XTAL_8MHz) |
| 119 | 126 | MDRV_CPU_PROGRAM_MAP(cgc7900_mem) |
| 120 | 127 | |
| 128 | MDRV_MACHINE_START(cgc7900) |
| 121 | 129 | MDRV_MACHINE_RESET(cgc7900) |
| 122 | 130 | |
| 123 | 131 | /* video hardware */ |