src/mess/video/cgc7900.c
| r7930 | r7931 | |
| 5 | 5 | PARAMETERS |
| 6 | 6 | ***************************************************************************/ |
| 7 | 7 | |
| 8 | | #define OVERLAY_CUR BIT(cell, 31) /* places a cursor in the cell if SET */ |
| 9 | | #define OVERLAY_BLK BIT(cell, 30) /* blinks the foreground character in the cell if SET */ |
| 10 | | #define OVERLAY_VF BIT(cell, 28) /* makes the foreground visible if SET (else transparent) */ |
| 11 | | #define OVERLAY_VB BIT(cell, 27) /* makes the background visible if SET (else transparent) */ |
| 12 | | #define OVERLAY_PL BIT(cell, 24) /* uses bits 0-7 as PLOT DOT descriptor if SET (else ASCII) */ |
| 13 | | #define OVERLAY_BR BIT(cell, 18) /* turns on Red in background if SET */ |
| 14 | | #define OVERLAY_BG BIT(cell, 17) /* turns on Green in background if SET */ |
| 15 | | #define OVERLAY_BB BIT(cell, 16) /* turns on Blue in background if SET */ |
| 16 | | #define OVERLAY_FR BIT(cell, 10) /* turns on Red in foreground if SET */ |
| 17 | | #define OVERLAY_FG BIT(cell, 9) /* turns on Green in foreground if SET */ |
| 18 | | #define OVERLAY_FB BIT(cell, 8) /* turns on Blue in background if SET */ |
| 19 | | #define OVERLAY_DATA (cell & 0xff) /* ASCII or Plot Dot character */ |
| 8 | #define OVERLAY_CUR BIT(cell, 31) /* places a cursor in the cell if SET */ |
| 9 | #define OVERLAY_BLK BIT(cell, 30) /* blinks the foreground character in the cell if SET */ |
| 10 | #define OVERLAY_VF BIT(cell, 28) /* makes the foreground visible if SET (else transparent) */ |
| 11 | #define OVERLAY_VB BIT(cell, 27) /* makes the background visible if SET (else transparent) */ |
| 12 | #define OVERLAY_PL BIT(cell, 24) /* uses bits 0-7 as PLOT DOT descriptor if SET (else ASCII) */ |
| 13 | #define OVERLAY_BR BIT(cell, 18) /* turns on Red in background if SET */ |
| 14 | #define OVERLAY_BG BIT(cell, 17) /* turns on Green in background if SET */ |
| 15 | #define OVERLAY_BB BIT(cell, 16) /* turns on Blue in background if SET */ |
| 16 | #define OVERLAY_FR BIT(cell, 10) /* turns on Red in foreground if SET */ |
| 17 | #define OVERLAY_FG BIT(cell, 9) /* turns on Green in foreground if SET */ |
| 18 | #define OVERLAY_FB BIT(cell, 8) /* turns on Blue in background if SET */ |
| 19 | #define OVERLAY_DATA (cell & 0xff) /* ASCII or Plot Dot character */ |
| 20 | 20 | |
| 21 | #define IMAGE_SELECT BIT(state->roll_overlay, 13) |
| 22 | #define OVERLAY_CURSOR_BLINK BIT(state->roll_overlay, 12) |
| 23 | #define OVERLAY_CHARACTER_BLINK BIT(state->roll_overlay, 11) |
| 24 | |
| 21 | 25 | /*************************************************************************** |
| 22 | 26 | READ/WRITE HANDLERS |
| 23 | 27 | ***************************************************************************/ |
| r7930 | r7931 | |
| 53 | 57 | |
| 54 | 58 | READ16_HANDLER( cgc7900_sync_r ) |
| 55 | 59 | { |
| 56 | | return 0; |
| 60 | /* |
| 61 | |
| 62 | bit signal description |
| 63 | |
| 64 | 0 _VERT vertical retrace (0=vblank) |
| 65 | 1 interlace (1=first field, 0=second field) |
| 66 | 2 _HG horizontal retrace (0=hblank) |
| 67 | 3 1 |
| 68 | 4 1 |
| 69 | 5 1 |
| 70 | 6 1 |
| 71 | 7 1 |
| 72 | 8 1 |
| 73 | 9 1 |
| 74 | 10 1 |
| 75 | 11 1 |
| 76 | 12 1 |
| 77 | 13 1 |
| 78 | 14 1 |
| 79 | 15 1 |
| 80 | |
| 81 | */ |
| 82 | |
| 83 | return 0xffff; |
| 57 | 84 | } |
| 58 | 85 | |
| 59 | 86 | /*************************************************************************** |
| r7930 | r7931 | |
| 70 | 97 | |
| 71 | 98 | for (int i = 0; i < 256; i++) |
| 72 | 99 | { |
| 73 | | UINT16 addr = i * 4; |
| 100 | UINT16 addr = i * 2; |
| 74 | 101 | UINT32 data = (state->clut_ram[addr + 1] << 16) | state->clut_ram[addr]; |
| 75 | 102 | UINT8 b = data & 0xff; |
| 76 | 103 | UINT8 g = (data >> 8) & 0xff; |
| r7930 | r7931 | |
| 81 | 108 | } |
| 82 | 109 | |
| 83 | 110 | /*------------------------------------------------- |
| 84 | | draw_image - draw bitmap image |
| 111 | draw_bitmap - draw bitmap image |
| 85 | 112 | -------------------------------------------------*/ |
| 86 | 113 | |
| 87 | | static void draw_image(running_device *screen, bitmap_t *bitmap) |
| 114 | static void draw_bitmap(running_device *screen, bitmap_t *bitmap) |
| 88 | 115 | { |
| 89 | 116 | } |
| 90 | 117 | |
| r7930 | r7931 | |
| 113 | 140 | { |
| 114 | 141 | if (OVERLAY_CUR) |
| 115 | 142 | { |
| 116 | | *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = 7; |
| 143 | if (!OVERLAY_CURSOR_BLINK || state->blink) |
| 144 | { |
| 145 | *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = 7; |
| 146 | } |
| 117 | 147 | } |
| 118 | 148 | else |
| 119 | 149 | { |
| 120 | | if (BIT(data, x)) |
| 150 | if (BIT(data, x) && (!OVERLAY_CHARACTER_BLINK || state->blink)) |
| 121 | 151 | { |
| 122 | 152 | if (OVERLAY_VF) *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = fg; |
| 123 | 153 | } |
| r7930 | r7931 | |
| 132 | 162 | } |
| 133 | 163 | |
| 134 | 164 | /*------------------------------------------------- |
| 165 | TIMER_DEVICE_CALLBACK( blink_tick ) |
| 166 | -------------------------------------------------*/ |
| 167 | |
| 168 | static TIMER_DEVICE_CALLBACK( blink_tick ) |
| 169 | { |
| 170 | cgc7900_state *state = (cgc7900_state *)timer->machine->driver_data; |
| 171 | |
| 172 | state->blink = !state->blink; |
| 173 | } |
| 174 | |
| 175 | /*------------------------------------------------- |
| 135 | 176 | PALETTE_INIT( cgc7900 ) |
| 136 | 177 | -------------------------------------------------*/ |
| 137 | 178 | |
| r7930 | r7931 | |
| 166 | 207 | static VIDEO_UPDATE( cgc7900 ) |
| 167 | 208 | { |
| 168 | 209 | update_clut(screen->machine); |
| 169 | | draw_image(screen, bitmap); |
| 210 | draw_bitmap(screen, bitmap); |
| 170 | 211 | draw_overlay(screen, bitmap); |
| 171 | 212 | |
| 172 | 213 | return 0; |
| r7930 | r7931 | |
| 218 | 259 | |
| 219 | 260 | MDRV_VIDEO_START(cgc7900) |
| 220 | 261 | MDRV_VIDEO_UPDATE(cgc7900) |
| 262 | |
| 263 | MDRV_TIMER_ADD_PERIODIC("blink", blink_tick, HZ(XTAL_28_48MHz/7500000)) |
| 221 | 264 | MACHINE_DRIVER_END |
src/mess/drivers/cgc7900.c
| r7930 | r7931 | |
| 11 | 11 | TODO: |
| 12 | 12 | |
| 13 | 13 | - does not boot |
| 14 | | - mirror ROM to 000000 |
| 14 | - interrupts |
| 15 | - vsync interrupt |
| 16 | - map ROM to 000000-000007 at boot |
| 15 | 17 | - floppy |
| 16 | 18 | - bitmap display |
| 17 | 19 | - Z mode read/write |
| 18 | 20 | - color status write |
| 19 | 21 | - bitmap roll |
| 20 | 22 | - overlay roll |
| 21 | | - blinking |
| 22 | 23 | - keyboard |
| 23 | 24 | - joystick |
| 24 | 25 | - light pen |
| r7930 | r7931 | |
| 77 | 78 | |
| 78 | 79 | static READ16_HANDLER( keyboard_r ) |
| 79 | 80 | { |
| 81 | /* |
| 82 | |
| 83 | bit description |
| 84 | |
| 85 | 0 key data bit 0 |
| 86 | 1 key data bit 1 |
| 87 | 2 key data bit 2 |
| 88 | 3 key data bit 3 |
| 89 | 4 key data bit 4 |
| 90 | 5 key data bit 5 |
| 91 | 6 key data bit 6 |
| 92 | 7 key data bit 7 |
| 93 | 8 SHIFT key |
| 94 | 9 CTRL key |
| 95 | 10 M1 key |
| 96 | 11 M2 key |
| 97 | 12 |
| 98 | 13 |
| 99 | 14 |
| 100 | 15 |
| 101 | |
| 102 | */ |
| 103 | |
| 80 | 104 | return 0; |
| 81 | 105 | } |
| 82 | 106 | |
| r7930 | r7931 | |
| 86 | 110 | |
| 87 | 111 | static WRITE16_HANDLER( keyboard_w ) |
| 88 | 112 | { |
| 113 | /* |
| 114 | |
| 115 | bit description |
| 116 | |
| 117 | 0 LED select bit 0 |
| 118 | 1 LED select bit 1 |
| 119 | 2 LED select bit 2 |
| 120 | 3 LED select bit 3 |
| 121 | 4 LED select bit 4 |
| 122 | 5 |
| 123 | 6 |
| 124 | 7 LED switch (1=on, 0=off) |
| 125 | 8 |
| 126 | 9 |
| 127 | 10 |
| 128 | 11 |
| 129 | 12 |
| 130 | 13 |
| 131 | 14 |
| 132 | 15 |
| 133 | |
| 134 | */ |
| 89 | 135 | } |
| 90 | 136 | |
| 91 | 137 | /*------------------------------------------------- |
| r7930 | r7931 | |
| 94 | 140 | |
| 95 | 141 | static WRITE16_HANDLER( interrupt_mask_w ) |
| 96 | 142 | { |
| 143 | /* |
| 144 | |
| 145 | bit description |
| 146 | |
| 147 | 0 real time clock |
| 148 | 1 RS-449 Tx ready |
| 149 | 2 BINT 2 |
| 150 | 3 RS-232 Tx ready |
| 151 | 4 disk |
| 152 | 5 BINT 3 |
| 153 | 6 bezel keys |
| 154 | 7 keyboard |
| 155 | 8 RS-449 Rx ready |
| 156 | 9 light pen |
| 157 | 10 BINT 4 |
| 158 | 11 joystick |
| 159 | 12 vertical retrace |
| 160 | 13 BINT 5 |
| 161 | 14 BINT 1 |
| 162 | 15 RS-232 Rx ready |
| 163 | |
| 164 | */ |
| 165 | |
| 97 | 166 | cgc7900_state *state = (cgc7900_state *)space->machine->driver_data; |
| 98 | 167 | |
| 99 | 168 | state->int_mask = data; |
| 100 | 169 | } |
| 101 | 170 | |
| 171 | /*------------------------------------------------- |
| 172 | disk_data_r - disk data read |
| 173 | -------------------------------------------------*/ |
| 174 | |
| 175 | static READ16_HANDLER( disk_data_r ) |
| 176 | { |
| 177 | return 0; |
| 178 | } |
| 179 | |
| 180 | /*------------------------------------------------- |
| 181 | disk_data_w - disk data write |
| 182 | -------------------------------------------------*/ |
| 183 | |
| 184 | static WRITE16_HANDLER( disk_data_w ) |
| 185 | { |
| 186 | } |
| 187 | /*------------------------------------------------- |
| 188 | disk_status_r - disk status read |
| 189 | -------------------------------------------------*/ |
| 190 | |
| 191 | static READ16_HANDLER( disk_status_r ) |
| 192 | { |
| 193 | /* |
| 194 | |
| 195 | bit signal description |
| 196 | |
| 197 | 0 _I/O input/output |
| 198 | 1 _REQ request |
| 199 | 2 _BSY busy |
| 200 | 3 C/_D control/data |
| 201 | 4 _MSG message |
| 202 | 5 _RDY ready |
| 203 | 6 |
| 204 | 7 |
| 205 | 8 |
| 206 | 9 |
| 207 | 10 |
| 208 | 11 |
| 209 | 12 |
| 210 | 13 |
| 211 | 14 |
| 212 | 15 |
| 213 | |
| 214 | */ |
| 215 | |
| 216 | return 0xffff - 0x04; |
| 217 | } |
| 218 | |
| 219 | /*------------------------------------------------- |
| 220 | disk_command_w - disk command write |
| 221 | -------------------------------------------------*/ |
| 222 | |
| 223 | static WRITE16_HANDLER( disk_command_w ) |
| 224 | { |
| 225 | } |
| 226 | |
| 102 | 227 | /*************************************************************************** |
| 103 | 228 | MEMORY MAPS |
| 104 | 229 | ***************************************************************************/ |
| r7930 | r7931 | |
| 108 | 233 | -------------------------------------------------*/ |
| 109 | 234 | |
| 110 | 235 | static ADDRESS_MAP_START( cgc7900_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 111 | | // ADDRESS_MAP_UNMAP_HIGH |
| 236 | ADDRESS_MAP_UNMAP_HIGH |
| 112 | 237 | AM_RANGE(0x000000, 0x7fffff) AM_RAM AM_BASE(&chrom_ram) |
| 113 | 238 | AM_RANGE(0x800000, 0x80ffff) AM_ROM AM_REGION(M68000_TAG, 0) |
| 114 | 239 | AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cgc7900_z_mode_r, cgc7900_z_mode_w) |
| r7930 | r7931 | |
| 144 | 269 | // AM_RANGE(0xff80c6, 0xff80c7) Joystick X axis |
| 145 | 270 | // AM_RANGE(0xff80ca, 0xff80cb) Joystick Y axis |
| 146 | 271 | // AM_RANGE(0xff80cc, 0xff80cd) Joystick Z axis |
| 147 | | // AM_RANGE(0xff8100, 0xff8101) Disk data port |
| 148 | | // AM_RANGE(0xff8120, 0xff8121) Disk control/status port |
| 149 | | // AM_RANGE(0xff8141, 0xff8141) Bezel switches |
| 150 | | // AM_RANGE(0xff8181, 0xff8181) Baud rate generator |
| 272 | AM_RANGE(0xff8100, 0xff8101) AM_READWRITE(disk_data_r, disk_data_w) |
| 273 | AM_RANGE(0xff8120, 0xff8121) AM_READWRITE(disk_status_r, disk_command_w) |
| 274 | AM_RANGE(0xff8140, 0xff8141) AM_READ_PORT("BEZEL") |
| 275 | // AM_RANGE(0xff8180, 0xff8181) AM_DEVWRITE8(K1135A_TAG, k1135a_w, 0xff00) Baud rate generator |
| 151 | 276 | // AM_RANGE(0xff81c0, 0xff81ff) AM_DEVREADWRITE8(MM58167_TAG, mm58167_r, mm58167_w, 0xff00) |
| 152 | 277 | AM_RANGE(0xff8200, 0xff8201) AM_WRITE(interrupt_mask_w) |
| 153 | 278 | // AM_RANGE(0xff8240, 0xff8241) Light Pen enable |
| r7930 | r7931 | |
| 192 | 317 | -------------------------------------------------*/ |
| 193 | 318 | |
| 194 | 319 | static INPUT_PORTS_START( cgc7900 ) |
| 320 | PORT_START("BEZEL") |
| 321 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 7") |
| 322 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 8") |
| 323 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 5") |
| 324 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 6") |
| 325 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 3") |
| 326 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 4") |
| 327 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 1") |
| 328 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 2") |
| 329 | |
| 330 | PORT_START("JOYSTICK_X") |
| 331 | PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_X ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50) |
| 332 | |
| 333 | PORT_START("JOYSTICK_Y") |
| 334 | PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Y ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50) |
| 335 | |
| 336 | PORT_START("JOYSTICK_Z") |
| 337 | PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Z ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50) |
| 338 | |
| 339 | PORT_START("LIGHT_PEN_X") |
| 340 | PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0, 511) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) |
| 341 | |
| 342 | PORT_START("LIGHT_PEN_Y") |
| 343 | PORT_BIT( 0x1ff, 0x0c0, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0, 383) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) |
| 195 | 344 | INPUT_PORTS_END |
| 196 | 345 | |
| 197 | 346 | /*************************************************************************** |
| r7930 | r7931 | |
| 275 | 424 | MDRV_DRIVER_DATA(cgc7900_state) |
| 276 | 425 | |
| 277 | 426 | /* basic machine hardware */ |
| 278 | | MDRV_CPU_ADD(M68000_TAG, M68000, XTAL_8MHz) |
| 427 | MDRV_CPU_ADD(M68000_TAG, M68000, XTAL_28_48MHz/4) |
| 279 | 428 | MDRV_CPU_PROGRAM_MAP(cgc7900_mem) |
| 280 | 429 | |
| 281 | | MDRV_CPU_ADD(I8035_TAG, I8035, 1000000) |
| 430 | /* MDRV_CPU_ADD(I8035_TAG, I8035, 1000000) |
| 282 | 431 | MDRV_CPU_PROGRAM_MAP(keyboard_mem) |
| 283 | | MDRV_CPU_IO_MAP(keyboard_io) |
| 432 | MDRV_CPU_IO_MAP(keyboard_io)*/ |
| 284 | 433 | |
| 285 | 434 | MDRV_MACHINE_START(cgc7900) |
| 286 | 435 | MDRV_MACHINE_RESET(cgc7900) |
| r7930 | r7931 | |
| 290 | 439 | |
| 291 | 440 | /* sound hardware */ |
| 292 | 441 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 293 | | MDRV_SOUND_ADD(AY8910_TAG, AY8910, 3579545/2) |
| 442 | MDRV_SOUND_ADD(AY8910_TAG, AY8910, XTAL_28_48MHz/16) |
| 294 | 443 | MDRV_SOUND_CONFIG(ay8910_intf) |
| 295 | 444 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 296 | 445 | |