src/emu/video/cdp1869.c
| r2218 | r2219 | |
| 1 | 1 | #include "driver.h" |
| 2 | | #include "deprecat.h" |
| 2 | #include "sndintrf.h" |
| 3 | #include "streams.h" |
| 3 | 4 | #include "cpu/cdp1802/cdp1802.h" |
| 4 | 5 | #include "video/cdp1869.h" |
| 5 | 6 | #include "sound/cdp1869.h" |
| r2218 | r2219 | |
| 8 | 9 | |
| 9 | 10 | TODO: |
| 10 | 11 | |
| 11 | | - convert CDP1869 into a device with video/sound |
| 12 | | - add predisplay/display timers |
| 12 | - connect to sound system when possible |
| 13 | - white noise |
| 14 | - scanline based update |
| 15 | - fix flashing spaceship in destryer/altair |
| 16 | - fix flashing player in draco |
| 13 | 17 | |
| 14 | 18 | */ |
| 15 | 19 | |
| 16 | | typedef struct |
| 20 | #define CDP1869_WEIGHT_RED 30 /* % of max luminance */ |
| 21 | #define CDP1869_WEIGHT_GREEN 59 |
| 22 | #define CDP1869_WEIGHT_BLUE 11 |
| 23 | |
| 24 | #define CDP1869_COLUMNS_HALF 20 |
| 25 | #define CDP1869_COLUMNS_FULL 40 |
| 26 | #define CDP1869_ROWS_HALF 12 |
| 27 | #define CDP1869_ROWS_FULL_PAL 25 |
| 28 | #define CDP1869_ROWS_FULL_NTSC 24 |
| 29 | |
| 30 | enum |
| 17 | 31 | { |
| 18 | | int ntsc_pal; |
| 19 | | int dispoff; |
| 20 | | int fresvert, freshorz; |
| 21 | | int dblpage, line16, line9, cmem, cfc; |
| 22 | | UINT8 col, bkg; |
| 23 | | UINT16 pma, hma; |
| 24 | | UINT8 cram[CDP1869_CHARRAM_SIZE]; |
| 25 | | UINT8 pram[CDP1869_PAGERAM_SIZE]; |
| 26 | | int cramsize, pramsize; |
| 27 | | UINT8 (*color_callback)(UINT8 cramdata, UINT16 cramaddr, UINT16 pramaddr); |
| 28 | | } CDP1869_VIDEO_CONFIG; |
| 32 | CDB0 = 0, |
| 33 | CDB1, |
| 34 | CDB2, |
| 35 | CDB3, |
| 36 | CDB4, |
| 37 | CDB5, |
| 38 | CCB0, |
| 39 | CCB1 |
| 40 | }; |
| 29 | 41 | |
| 30 | | static CDP1869_VIDEO_CONFIG cdp1869; |
| 42 | typedef struct _cdp1869_t cdp1869_t; |
| 43 | struct _cdp1869_t |
| 44 | { |
| 45 | const cdp1869_interface *intf; /* interface */ |
| 46 | const device_config *screen; /* screen */ |
| 47 | sound_stream *stream; /* sound output */ |
| 31 | 48 | |
| 49 | /* video state */ |
| 50 | int dispoff; /* display off */ |
| 51 | int fresvert; /* full resolution vertical */ |
| 52 | int freshorz; /* full resolution horizontal */ |
| 53 | int cmem; /* character memory access mode */ |
| 54 | int dblpage; /* double page mode */ |
| 55 | int line16; /* 16-line hi-res mode */ |
| 56 | int line9; /* 9 line mode */ |
| 57 | int cfc; /* color format control */ |
| 58 | UINT8 col; /* character color control */ |
| 59 | UINT8 bkg; /* background color */ |
| 60 | UINT16 pma; /* page memory address */ |
| 61 | UINT16 hma; /* home memory address */ |
| 62 | |
| 63 | /* video timer */ |
| 64 | emu_timer *prd_changed_timer; /* predisplay changed timer */ |
| 65 | |
| 66 | /* sound state */ |
| 67 | INT16 signal; /* current signal */ |
| 68 | int incr; /* initial wave state */ |
| 69 | int toneoff; /* tone off */ |
| 70 | int wnoff; /* white noise off */ |
| 71 | UINT8 tonediv; /* tone divisor */ |
| 72 | UINT8 tonefreq; /* tone range select */ |
| 73 | UINT8 toneamp; /* tone output amplitude */ |
| 74 | UINT8 wnfreq; /* white noise range select */ |
| 75 | UINT8 wnamp; /* white noise output amplitude */ |
| 76 | }; |
| 77 | |
| 78 | INLINE cdp1869_t *get_safe_token(const device_config *device) |
| 79 | { |
| 80 | assert(device != NULL); |
| 81 | assert(device->token != NULL); |
| 82 | |
| 83 | return (cdp1869_t *)device->token; |
| 84 | } |
| 85 | |
| 86 | /* Predisplay Timer */ |
| 87 | |
| 88 | static void update_prd_changed_timer(cdp1869_t *cdp1869) |
| 89 | { |
| 90 | if (cdp1869->prd_changed_timer != NULL) |
| 91 | { |
| 92 | attotime duration; |
| 93 | int start, end, level; |
| 94 | int scanline = video_screen_get_vpos(cdp1869->screen); |
| 95 | int next_scanline; |
| 96 | |
| 97 | if (cdp1869->intf->pal_ntsc == CDP1869_NTSC) |
| 98 | { |
| 99 | start = CDP1869_SCANLINE_PREDISPLAY_START_NTSC; |
| 100 | end = CDP1869_SCANLINE_PREDISPLAY_END_NTSC; |
| 101 | } |
| 102 | else |
| 103 | { |
| 104 | start = CDP1869_SCANLINE_PREDISPLAY_START_PAL; |
| 105 | end = CDP1869_SCANLINE_PREDISPLAY_END_PAL; |
| 106 | } |
| 107 | |
| 108 | if (scanline < start) |
| 109 | { |
| 110 | next_scanline = start; |
| 111 | level = 0; |
| 112 | } |
| 113 | else if (scanline < end) |
| 114 | { |
| 115 | next_scanline = end; |
| 116 | level = 1; |
| 117 | } |
| 118 | else |
| 119 | { |
| 120 | next_scanline = start; |
| 121 | level = 0; |
| 122 | } |
| 123 | |
| 124 | if (cdp1869->dispoff) |
| 125 | { |
| 126 | level = 1; |
| 127 | } |
| 128 | |
| 129 | duration = video_screen_get_time_until_pos(cdp1869->screen, next_scanline, 0); |
| 130 | timer_adjust_oneshot(cdp1869->prd_changed_timer, duration, level); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | static TIMER_CALLBACK( prd_changed_tick ) |
| 135 | { |
| 136 | const device_config *device = ptr; |
| 137 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 138 | |
| 139 | /* call the callback function -- we know it exists */ |
| 140 | cdp1869->intf->on_prd_changed(device, param); |
| 141 | |
| 142 | update_prd_changed_timer(cdp1869); |
| 143 | } |
| 144 | |
| 145 | /* State Save Postload */ |
| 146 | |
| 147 | static void cdp1869_state_save_postload(void *param) |
| 148 | { |
| 149 | update_prd_changed_timer(param); |
| 150 | } |
| 151 | |
| 152 | /* CDP1802 X Register */ |
| 153 | |
| 32 | 154 | static UINT16 cdp1802_get_r_x(void) |
| 33 | 155 | { |
| 34 | 156 | return activecpu_get_reg(CDP1802_R0 + activecpu_get_reg(CDP1802_X)); |
| 35 | 157 | } |
| 36 | 158 | |
| 37 | | WRITE8_HANDLER ( cdp1869_out3_w ) |
| 159 | /* Palette Initialization */ |
| 160 | |
| 161 | static rgb_t cdp1869_get_rgb(int i, int c, int l) |
| 38 | 162 | { |
| 163 | int luma = 0, r, g, b; |
| 164 | |
| 165 | luma += (l & 4) ? CDP1869_WEIGHT_RED : 0; |
| 166 | luma += (l & 1) ? CDP1869_WEIGHT_GREEN : 0; |
| 167 | luma += (l & 2) ? CDP1869_WEIGHT_BLUE : 0; |
| 168 | |
| 169 | luma = (luma * 0xff) / 100; |
| 170 | |
| 171 | r = (c & 4) ? luma : 0; |
| 172 | g = (c & 1) ? luma : 0; |
| 173 | b = (c & 2) ? luma : 0; |
| 174 | |
| 175 | return MAKE_RGB(r, g, b); |
| 176 | } |
| 177 | |
| 178 | /* Screen Update */ |
| 179 | |
| 180 | static int cdp1869_get_lines(const device_config *device) |
| 181 | { |
| 182 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 183 | |
| 184 | if (cdp1869->line16 && !cdp1869->dblpage) |
| 185 | { |
| 186 | return 16; |
| 187 | } |
| 188 | else if (!cdp1869->line9) |
| 189 | { |
| 190 | return 9; |
| 191 | } |
| 192 | else |
| 193 | { |
| 194 | return 8; |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | static UINT16 cdp1869_get_pmemsize(const device_config *device, int cols, int rows) |
| 199 | { |
| 200 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 201 | |
| 202 | int pmemsize = cols * rows; |
| 203 | |
| 204 | if (cdp1869->dblpage) pmemsize *= 2; |
| 205 | if (cdp1869->line16) pmemsize *= 2; |
| 206 | |
| 207 | return pmemsize; |
| 208 | } |
| 209 | |
| 210 | static UINT16 cdp1869_get_pma(const device_config *device) |
| 211 | { |
| 212 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 213 | |
| 214 | if (cdp1869->dblpage) |
| 215 | { |
| 216 | return cdp1869->pma; |
| 217 | } |
| 218 | else |
| 219 | { |
| 220 | return cdp1869->pma & 0x3ff; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | static int cdp1869_get_pen(const device_config *device, int ccb0, int ccb1, int pcb) |
| 225 | { |
| 226 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 227 | |
| 228 | int r = 0, g = 0, b = 0, color; |
| 229 | |
| 230 | switch (cdp1869->col) |
| 231 | { |
| 232 | case 0: |
| 233 | r = ccb0; |
| 234 | b = ccb1; |
| 235 | g = pcb; |
| 236 | break; |
| 237 | |
| 238 | case 1: |
| 239 | r = ccb0; |
| 240 | b = pcb; |
| 241 | g = ccb1; |
| 242 | break; |
| 243 | |
| 244 | case 2: |
| 245 | case 3: |
| 246 | r = pcb; |
| 247 | b = ccb0; |
| 248 | g = ccb1; |
| 249 | break; |
| 250 | } |
| 251 | |
| 252 | color = (r << 2) + (b << 1) + g; |
| 253 | |
| 254 | if (cdp1869->cfc) |
| 255 | { |
| 256 | return color + ((cdp1869->bkg + 1) * 8); |
| 257 | } |
| 258 | else |
| 259 | { |
| 260 | return color; |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | static void cdp1869_draw_line(const device_config *device, bitmap_t *bitmap, int x, int y, int data, int color) |
| 265 | { |
| 266 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 267 | |
| 268 | int i; |
| 269 | |
| 270 | data <<= 2; |
| 271 | |
| 272 | for (i = 0; i < CDP1869_CHAR_WIDTH; i++) |
| 273 | { |
| 274 | if (data & 0x80) |
| 275 | { |
| 276 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 277 | |
| 278 | if (!cdp1869->fresvert) |
| 279 | { |
| 280 | *BITMAP_ADDR16(bitmap, y + 1, x) = color; |
| 281 | } |
| 282 | |
| 283 | if (!cdp1869->freshorz) |
| 284 | { |
| 285 | *BITMAP_ADDR16(bitmap, y, x + 1) = color; |
| 286 | |
| 287 | if (!cdp1869->fresvert) |
| 288 | { |
| 289 | *BITMAP_ADDR16(bitmap, y + 1, x + 1) = color; |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | if (!cdp1869->freshorz) |
| 295 | { |
| 296 | x++; |
| 297 | } |
| 298 | |
| 299 | x++; |
| 300 | |
| 301 | data <<= 1; |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | static void cdp1869_draw_char(const device_config *device, bitmap_t *bitmap, int x, int y, UINT16 pma, const rectangle *screenrect) |
| 306 | { |
| 307 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 308 | |
| 309 | UINT8 cma = 0; |
| 310 | |
| 311 | int pcb = cdp1869->intf->pcb_r(device, pma, cma); |
| 312 | |
| 313 | for (cma = 0; cma < cdp1869_get_lines(device); cma++) |
| 314 | { |
| 315 | UINT8 data = cdp1869->intf->char_ram_r(device, pma, cma); |
| 316 | |
| 317 | int ccb0 = BIT(data, CCB0); |
| 318 | int ccb1 = BIT(data, CCB1); |
| 319 | |
| 320 | int color = cdp1869_get_pen(device, ccb0, ccb1, pcb); |
| 321 | |
| 322 | cdp1869_draw_line(device, bitmap, screenrect->min_x + x, screenrect->min_y + y, data, color); |
| 323 | |
| 324 | y++; |
| 325 | |
| 326 | if (!cdp1869->fresvert) |
| 327 | { |
| 328 | y++; |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | /* Palette Initialization */ |
| 334 | |
| 335 | PALETTE_INIT( cdp1869 ) |
| 336 | { |
| 337 | int i, c, l; |
| 338 | |
| 339 | // color-on-color display (CFC=0) |
| 340 | |
| 341 | for (i = 0; i < 8; i++) |
| 342 | { |
| 343 | palette_set_color(machine, i, cdp1869_get_rgb(i, i, 15)); |
| 344 | } |
| 345 | |
| 346 | // tone-on-tone display (CFC=1) |
| 347 | |
| 348 | for (c = 0; c < 8; c++) |
| 349 | { |
| 350 | for (l = 0; l < 8; l++) |
| 351 | { |
| 352 | palette_set_color(machine, i, cdp1869_get_rgb(i, c, l)); |
| 353 | i++; |
| 354 | } |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | /* Register Access */ |
| 359 | |
| 360 | WRITE8_DEVICE_HANDLER( cdp1869_out3_w ) |
| 361 | { |
| 362 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 363 | |
| 39 | 364 | /* |
| 40 | 365 | bit description |
| 41 | 366 | |
| r2218 | r2219 | |
| 49 | 374 | 7 fres horz |
| 50 | 375 | */ |
| 51 | 376 | |
| 52 | | cdp1869.bkg = (data & 0x07); |
| 53 | | cdp1869.cfc = (data & 0x08) >> 3; |
| 54 | | cdp1869.dispoff = (data & 0x10) >> 4; |
| 55 | | cdp1869.col = (data & 0x60) >> 5; |
| 56 | | cdp1869.freshorz = (data & 0x80) >> 7; |
| 377 | cdp1869->bkg = data & 0x07; |
| 378 | cdp1869->cfc = BIT(data, 3); |
| 379 | cdp1869->dispoff = BIT(data, 4); |
| 380 | cdp1869->col = (data & 0x60) >> 5; |
| 381 | cdp1869->freshorz = BIT(data, 7); |
| 57 | 382 | } |
| 58 | 383 | |
| 59 | | WRITE8_HANDLER ( cdp1869_out4_w ) |
| 384 | WRITE8_DEVICE_HANDLER( cdp1869_out4_w ) |
| 60 | 385 | { |
| 386 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 387 | |
| 61 | 388 | UINT16 word = cdp1802_get_r_x(); |
| 62 | 389 | |
| 63 | 390 | /* |
| r2218 | r2219 | |
| 81 | 408 | 15 always 0 |
| 82 | 409 | */ |
| 83 | 410 | |
| 84 | | cdp1869_set_toneamp(0, word & 0x0f); |
| 85 | | cdp1869_set_tonefreq(0, (word & 0x70) >> 4); |
| 86 | | cdp1869_set_toneoff(0, (word & 0x80) >> 7); |
| 87 | | cdp1869_set_tonediv(0, (word & 0x7f00) >> 8); |
| 411 | cdp1869->toneamp = word & 0x0f; |
| 412 | cdp1869->tonefreq = (word & 0x70) >> 4; |
| 413 | cdp1869->toneoff = BIT(word, 7); |
| 414 | cdp1869->tonediv = (word & 0x7f00) >> 8; |
| 415 | |
| 416 | // fork out to CDP1869 sound core |
| 417 | cdp1869_set_toneamp(0, cdp1869->toneamp); |
| 418 | cdp1869_set_tonefreq(0, cdp1869->tonefreq); |
| 419 | cdp1869_set_toneoff(0, cdp1869->toneoff); |
| 420 | cdp1869_set_tonediv(0, cdp1869->tonediv); |
| 88 | 421 | } |
| 89 | 422 | |
| 90 | | WRITE8_HANDLER ( cdp1869_out5_w ) |
| 423 | WRITE8_DEVICE_HANDLER( cdp1869_out5_w ) |
| 91 | 424 | { |
| 425 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 426 | |
| 92 | 427 | UINT16 word = cdp1802_get_r_x(); |
| 93 | 428 | |
| 94 | 429 | /* |
| r2218 | r2219 | |
| 112 | 447 | 15 wn off |
| 113 | 448 | */ |
| 114 | 449 | |
| 115 | | cdp1869.cmem = (word & 0x01); |
| 116 | | cdp1869.line9 = (word & 0x08) >> 3; |
| 117 | | cdp1869.line16 = (word & 0x20) >> 5; |
| 118 | | cdp1869.dblpage = (word & 0x40) >> 6; |
| 119 | | cdp1869.fresvert = (word & 0x80) >> 7; |
| 450 | cdp1869->cmem = BIT(word, 0); |
| 451 | cdp1869->line9 = BIT(word, 3); |
| 120 | 452 | |
| 121 | | cdp1869_set_wnamp(0, (word & 0x0f00) >> 8); |
| 122 | | cdp1869_set_wnfreq(0, (word & 0x7000) >> 12); |
| 123 | | cdp1869_set_wnoff(0, (word & 0x8000) >> 15); |
| 453 | if (cdp1869->intf->pal_ntsc == CDP1869_NTSC) |
| 454 | { |
| 455 | cdp1869->line16 = BIT(word, 5); |
| 456 | } |
| 457 | |
| 458 | cdp1869->dblpage = BIT(word, 6); |
| 459 | cdp1869->fresvert = BIT(word, 7); |
| 460 | |
| 461 | cdp1869->wnamp = (word & 0x0f00) >> 8; |
| 462 | cdp1869->wnfreq = (word & 0x7000) >> 12; |
| 463 | cdp1869->wnoff = BIT(word, 15); |
| 464 | |
| 465 | // fork out to CDP1869 sound core |
| 466 | cdp1869_set_wnamp(0, cdp1869->wnamp); |
| 467 | cdp1869_set_wnfreq(0, cdp1869->wnfreq); |
| 468 | cdp1869_set_wnoff(0, cdp1869->wnoff); |
| 469 | |
| 470 | if (cdp1869->cmem) |
| 471 | { |
| 472 | cdp1869->pma = word; |
| 473 | } |
| 474 | else |
| 475 | { |
| 476 | cdp1869->pma = 0; |
| 477 | } |
| 124 | 478 | } |
| 125 | 479 | |
| 126 | | WRITE8_HANDLER ( cdp1869_out6_w ) |
| 480 | WRITE8_DEVICE_HANDLER( cdp1869_out6_w ) |
| 127 | 481 | { |
| 482 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 483 | |
| 128 | 484 | UINT16 word = cdp1802_get_r_x(); |
| 129 | 485 | |
| 130 | 486 | /* |
| r2218 | r2219 | |
| 148 | 504 | 15 x |
| 149 | 505 | */ |
| 150 | 506 | |
| 151 | | cdp1869.pma = word & 0x7ff; |
| 507 | cdp1869->pma = word & 0x7ff; |
| 152 | 508 | } |
| 153 | 509 | |
| 154 | | WRITE8_HANDLER ( cdp1869_out7_w ) |
| 510 | WRITE8_DEVICE_HANDLER( cdp1869_out7_w ) |
| 155 | 511 | { |
| 512 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 513 | |
| 156 | 514 | UINT16 word = cdp1802_get_r_x(); |
| 157 | 515 | |
| 158 | 516 | /* |
| r2218 | r2219 | |
| 176 | 534 | 15 x |
| 177 | 535 | */ |
| 178 | 536 | |
| 179 | | cdp1869.hma = word & 0x7fc; |
| 537 | cdp1869->hma = word & 0x7fc; |
| 180 | 538 | } |
| 181 | 539 | |
| 182 | | static void cdp1869_set_color(int i, int c, int l) |
| 183 | | { |
| 184 | | int luma = 0, r, g, b; |
| 540 | /* Page RAM Access */ |
| 185 | 541 | |
| 186 | | luma += (l & 4) ? CDP1869_WEIGHT_RED : 0; |
| 187 | | luma += (l & 1) ? CDP1869_WEIGHT_GREEN : 0; |
| 188 | | luma += (l & 2) ? CDP1869_WEIGHT_BLUE : 0; |
| 189 | | |
| 190 | | luma = (luma * 0xff) / 100; |
| 191 | | |
| 192 | | r = (c & 4) ? luma : 0; |
| 193 | | g = (c & 1) ? luma : 0; |
| 194 | | b = (c & 2) ? luma : 0; |
| 195 | | |
| 196 | | palette_set_color( Machine, i, MAKE_RGB(r, g, b) ); |
| 197 | | } |
| 198 | | |
| 199 | | PALETTE_INIT( cdp1869 ) |
| 542 | READ8_DEVICE_HANDLER( cdp1869_pageram_r ) |
| 200 | 543 | { |
| 201 | | int i, c, l; |
| 544 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 202 | 545 | |
| 203 | | // color-on-color display (CFC=0) |
| 546 | UINT16 pma; |
| 204 | 547 | |
| 205 | | for (i = 0; i < 8; i++) |
| 548 | if (cdp1869->cmem) |
| 206 | 549 | { |
| 207 | | cdp1869_set_color(i, i, 15); |
| 550 | pma = cdp1869_get_pma(device); |
| 208 | 551 | } |
| 209 | | |
| 210 | | // tone-on-tone display (CFC=1) |
| 211 | | |
| 212 | | for (c = 0; c < 8; c++) |
| 552 | else |
| 213 | 553 | { |
| 214 | | for (l = 0; l < 8; l++) |
| 215 | | { |
| 216 | | cdp1869_set_color(i, c, l); |
| 217 | | i++; |
| 218 | | } |
| 554 | pma = offset; |
| 219 | 555 | } |
| 220 | | } |
| 221 | 556 | |
| 222 | | static int cdp1869_get_lines(void) |
| 223 | | { |
| 224 | | if (cdp1869.line16 && !cdp1869.dblpage) |
| 225 | | { |
| 226 | | return 16; |
| 227 | | } |
| 228 | | else if (!cdp1869.line9) |
| 229 | | { |
| 230 | | return 9; |
| 231 | | } |
| 232 | | else |
| 233 | | { |
| 234 | | return 8; |
| 235 | | } |
| 557 | return cdp1869->intf->page_ram_r(device, pma); |
| 236 | 558 | } |
| 237 | 559 | |
| 238 | | static UINT16 cdp1869_get_pmemsize(int cols, int rows) |
| 560 | WRITE8_DEVICE_HANDLER( cdp1869_pageram_w ) |
| 239 | 561 | { |
| 240 | | int pmemsize = cols * rows; |
| 562 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 241 | 563 | |
| 242 | | if (cdp1869.dblpage) pmemsize *= 2; |
| 243 | | if (cdp1869.line16) pmemsize *= 2; |
| 564 | UINT16 pma; |
| 244 | 565 | |
| 245 | | return pmemsize; |
| 246 | | } |
| 247 | | |
| 248 | | static UINT16 cdp1869_get_pma(void) |
| 249 | | { |
| 250 | | if (cdp1869.dblpage) |
| 566 | if (cdp1869->cmem) |
| 251 | 567 | { |
| 252 | | return cdp1869.pma; |
| 568 | pma = cdp1869_get_pma(device); |
| 253 | 569 | } |
| 254 | 570 | else |
| 255 | 571 | { |
| 256 | | return cdp1869.pma & 0x3ff; |
| 572 | pma = offset; |
| 257 | 573 | } |
| 574 | |
| 575 | cdp1869->intf->page_ram_w(device, pma, data); |
| 258 | 576 | } |
| 259 | 577 | |
| 260 | | UINT16 cdp1869_get_cma(UINT16 offset) |
| 578 | /* Character RAM Access */ |
| 579 | |
| 580 | READ8_DEVICE_HANDLER( cdp1869_charram_r ) |
| 261 | 581 | { |
| 262 | | int column = cdp1869.pram[cdp1869_get_pma()]; |
| 263 | | int row = offset & 0x07; |
| 582 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 264 | 583 | |
| 265 | | int addr = (column << 3) + row; |
| 266 | | |
| 267 | | if ((offset & 0x08) && (cdp1869_get_lines() > 8)) |
| 584 | if (cdp1869->cmem) |
| 268 | 585 | { |
| 269 | | addr += (CDP1869_CHARRAM_SIZE / 2); |
| 270 | | } |
| 586 | UINT16 pma = cdp1869_get_pma(device); |
| 587 | UINT8 cma = offset & 0x0f; |
| 271 | 588 | |
| 272 | | return addr; |
| 273 | | } |
| 589 | if (cdp1869_get_lines(device) == 8) |
| 590 | { |
| 591 | cma &= 0x07; |
| 592 | } |
| 274 | 593 | |
| 275 | | static UINT8 cdp1869_read_pageram(UINT16 addr) |
| 276 | | { |
| 277 | | if (addr >= cdp1869.pramsize) |
| 278 | | { |
| 279 | | return 0xff; |
| 594 | return cdp1869->intf->char_ram_r(device, pma, cma); |
| 280 | 595 | } |
| 281 | 596 | else |
| 282 | 597 | { |
| 283 | | return cdp1869.pram[addr]; |
| 284 | | } |
| 285 | | } |
| 286 | | |
| 287 | | #ifdef UNUSED_FUNCTION |
| 288 | | UINT8 cdp1869_read_charram(UINT16 addr) |
| 289 | | { |
| 290 | | if (addr >= cdp1869.cramsize) |
| 291 | | { |
| 292 | 598 | return 0xff; |
| 293 | 599 | } |
| 294 | | else |
| 295 | | { |
| 296 | | return cdp1869.cram[addr]; |
| 297 | | } |
| 298 | 600 | } |
| 299 | | #endif |
| 300 | 601 | |
| 301 | | WRITE8_HANDLER ( cdp1869_charram_w ) |
| 602 | WRITE8_DEVICE_HANDLER( cdp1869_charram_w ) |
| 302 | 603 | { |
| 303 | | if (cdp1869.cmem) |
| 304 | | { |
| 305 | | UINT16 addr = cdp1869_get_cma(offset); |
| 306 | | cdp1869.cram[addr] = data; |
| 307 | | } |
| 308 | | } |
| 604 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 309 | 605 | |
| 310 | | READ8_HANDLER ( cdp1869_charram_r ) |
| 311 | | { |
| 312 | | if (cdp1869.cmem) |
| 606 | if (cdp1869->cmem) |
| 313 | 607 | { |
| 314 | | UINT16 addr = cdp1869_get_cma(offset); |
| 315 | | return cdp1869.cram[addr]; |
| 316 | | } |
| 317 | | else |
| 318 | | { |
| 319 | | return 0xff; |
| 320 | | } |
| 321 | | } |
| 608 | UINT16 pma = cdp1869_get_pma(device); |
| 609 | UINT8 cma = offset & 0x0f; |
| 322 | 610 | |
| 323 | | WRITE8_HANDLER ( cdp1869_pageram_w ) |
| 324 | | { |
| 325 | | UINT16 addr; |
| 611 | if (cdp1869_get_lines(device) == 8) |
| 612 | { |
| 613 | cma &= 0x07; |
| 614 | } |
| 326 | 615 | |
| 327 | | if (cdp1869.cmem) |
| 328 | | { |
| 329 | | addr = cdp1869_get_pma(); |
| 616 | cdp1869->intf->char_ram_w(device, pma, cma, data); |
| 330 | 617 | } |
| 331 | | else |
| 332 | | { |
| 333 | | addr = offset; |
| 334 | | } |
| 335 | | |
| 336 | | cdp1869.pram[addr] = data; |
| 337 | 618 | } |
| 338 | 619 | |
| 339 | | READ8_HANDLER ( cdp1869_pageram_r ) |
| 620 | /* Screen Update */ |
| 621 | |
| 622 | void cdp1869_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect) |
| 340 | 623 | { |
| 341 | | UINT16 addr; |
| 624 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 342 | 625 | |
| 343 | | if (cdp1869.cmem) |
| 344 | | { |
| 345 | | addr = cdp1869_get_pma(); |
| 346 | | } |
| 347 | | else |
| 348 | | { |
| 349 | | addr = offset; |
| 350 | | } |
| 626 | rectangle screen_rect, outer; |
| 351 | 627 | |
| 352 | | return cdp1869.pram[addr]; |
| 353 | | } |
| 354 | | |
| 355 | | static int cdp1869_get_color(int ccb0, int ccb1, int pcb) |
| 356 | | { |
| 357 | | int r = 0, g = 0, b = 0, color; |
| 358 | | |
| 359 | | switch (cdp1869.col) |
| 628 | switch (cdp1869->intf->pal_ntsc) |
| 360 | 629 | { |
| 361 | | case 0: |
| 362 | | r = ccb0; |
| 363 | | g = pcb; |
| 364 | | b = ccb1; |
| 630 | case CDP1869_NTSC: |
| 631 | outer.min_x = CDP1869_HBLANK_END; |
| 632 | outer.max_x = CDP1869_HBLANK_START - 1; |
| 633 | outer.min_y = CDP1869_SCANLINE_VBLANK_END_NTSC; |
| 634 | outer.max_y = CDP1869_SCANLINE_VBLANK_START_NTSC - 1; |
| 635 | screen_rect.min_x = CDP1869_SCREEN_START_NTSC; |
| 636 | screen_rect.max_x = CDP1869_SCREEN_END - 1; |
| 637 | screen_rect.min_y = CDP1869_SCANLINE_DISPLAY_START_NTSC; |
| 638 | screen_rect.max_y = CDP1869_SCANLINE_DISPLAY_END_NTSC - 1; |
| 365 | 639 | break; |
| 366 | 640 | |
| 367 | | case 1: |
| 368 | | r = ccb0; |
| 369 | | g = ccb1; |
| 370 | | b = pcb; |
| 641 | default: |
| 642 | case CDP1869_PAL: |
| 643 | outer.min_x = CDP1869_HBLANK_END; |
| 644 | outer.max_x = CDP1869_HBLANK_START - 1; |
| 645 | outer.min_y = CDP1869_SCANLINE_VBLANK_END_PAL; |
| 646 | outer.max_y = CDP1869_SCANLINE_VBLANK_START_PAL - 1; |
| 647 | screen_rect.min_x = CDP1869_SCREEN_START_PAL; |
| 648 | screen_rect.max_x = CDP1869_SCREEN_END - 1; |
| 649 | screen_rect.min_y = CDP1869_SCANLINE_DISPLAY_START_PAL; |
| 650 | screen_rect.max_y = CDP1869_SCANLINE_DISPLAY_END_PAL - 1; |
| 371 | 651 | break; |
| 372 | | |
| 373 | | case 2: |
| 374 | | case 3: |
| 375 | | r = pcb; |
| 376 | | g = ccb1; |
| 377 | | b = ccb0; |
| 378 | | break; |
| 379 | 652 | } |
| 380 | 653 | |
| 381 | | color = (r << 2) + (b << 1) + g; |
| 654 | sect_rect(&outer, cliprect); |
| 655 | fillbitmap(bitmap, device->machine->pens[cdp1869->bkg], &outer); |
| 382 | 656 | |
| 383 | | if (cdp1869.cfc) |
| 657 | if (!cdp1869->dispoff) |
| 384 | 658 | { |
| 385 | | return color + ((cdp1869.bkg + 1) * 8); |
| 386 | | } |
| 387 | | else |
| 388 | | { |
| 389 | | return color; |
| 390 | | } |
| 391 | | } |
| 659 | int sx, sy, rows, cols, width, height; |
| 660 | UINT16 addr, pmemsize; |
| 392 | 661 | |
| 393 | | static void cdp1869_draw_line(running_machine *machine, bitmap_t *bitmap, int x, int y, int data, int color) |
| 394 | | { |
| 395 | | int i; |
| 662 | width = CDP1869_CHAR_WIDTH; |
| 663 | height = cdp1869_get_lines(device); |
| 396 | 664 | |
| 397 | | data <<= 2; |
| 665 | if (!cdp1869->freshorz) |
| 666 | { |
| 667 | width *= 2; |
| 668 | } |
| 398 | 669 | |
| 399 | | for (i = 0; i < CDP1869_CHAR_WIDTH; i++) |
| 400 | | { |
| 401 | | if (data & 0x80) |
| 670 | if (!cdp1869->fresvert) |
| 402 | 671 | { |
| 403 | | *BITMAP_ADDR16(bitmap, y, x) = machine->pens[color]; |
| 672 | height *= 2; |
| 673 | } |
| 404 | 674 | |
| 405 | | if (!cdp1869.fresvert) |
| 406 | | { |
| 407 | | *BITMAP_ADDR16(bitmap, y + 1, x) = machine->pens[color]; |
| 408 | | } |
| 675 | cols = cdp1869->freshorz ? CDP1869_COLUMNS_FULL : CDP1869_COLUMNS_HALF; |
| 676 | rows = (screen_rect.max_y - screen_rect.min_y + 1) / height; |
| 409 | 677 | |
| 410 | | if (!cdp1869.freshorz) |
| 411 | | { |
| 412 | | *BITMAP_ADDR16(bitmap, y, x + 1) = machine->pens[color]; |
| 678 | pmemsize = cdp1869_get_pmemsize(device, cols, rows); |
| 413 | 679 | |
| 414 | | if (!cdp1869.fresvert) |
| 415 | | { |
| 416 | | *BITMAP_ADDR16(bitmap, y + 1, x + 1) = machine->pens[color]; |
| 417 | | } |
| 418 | | } |
| 419 | | } |
| 680 | addr = cdp1869->hma; |
| 420 | 681 | |
| 421 | | if (!cdp1869.freshorz) |
| 682 | for (sy = 0; sy < rows; sy++) |
| 422 | 683 | { |
| 423 | | x++; |
| 424 | | } |
| 684 | for (sx = 0; sx < cols; sx++) |
| 685 | { |
| 686 | int x = sx * width; |
| 687 | int y = sy * height; |
| 425 | 688 | |
| 426 | | x++; |
| 689 | cdp1869_draw_char(device, bitmap, x, y, addr, &screen_rect); |
| 427 | 690 | |
| 428 | | data <<= 1; |
| 691 | addr++; |
| 692 | |
| 693 | if (addr == pmemsize) addr = 0; |
| 694 | } |
| 695 | } |
| 429 | 696 | } |
| 430 | 697 | } |
| 431 | 698 | |
| 432 | | static void cdp1869_draw_char(running_machine *machine, bitmap_t *bitmap, int x, int y, UINT16 pramaddr, const rectangle *screenrect) |
| 699 | /* Sound Update */ |
| 700 | |
| 701 | #ifdef UNUSED_FUNCTION |
| 702 | static void cdp1869_sum_square_wave(stream_sample_t *buffer, double frequency, double amplitude) |
| 433 | 703 | { |
| 434 | | int i; |
| 435 | | UINT8 code = cdp1869_read_pageram(pramaddr); |
| 436 | | UINT16 addr = code * 8; |
| 437 | | UINT16 addr2 = addr + (CDP1869_CHARRAM_SIZE / 2); |
| 704 | // do a fast fourier transform on all the waves in the white noise range |
| 705 | } |
| 438 | 706 | |
| 439 | | for (i = 0; i < cdp1869_get_lines(); i++) |
| 440 | | { |
| 441 | | UINT8 data = cdp1869.cram[addr]; |
| 707 | static void cdp1869_sound_update(const device_config *device, stream_sample_t **inputs, stream_sample_t **_buffer, int length) |
| 708 | { |
| 709 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 442 | 710 | |
| 443 | | UINT8 colorbits = cdp1869.color_callback(data, addr, pramaddr); |
| 711 | INT16 signal = cdp1869->signal; |
| 712 | stream_sample_t *buffer = _buffer[0]; |
| 444 | 713 | |
| 445 | | int pcb = colorbits & 0x01; |
| 446 | | int ccb1 = (colorbits & 0x02) >> 1; |
| 447 | | int ccb0 = (colorbits & 0x04) >> 2; |
| 714 | memset(buffer, 0, length * sizeof(*buffer)); |
| 448 | 715 | |
| 449 | | int color = cdp1869_get_color(ccb0, ccb1, pcb); |
| 716 | if (!cdp1869->toneoff && cdp1869->toneamp) |
| 717 | { |
| 718 | double frequency = (cdp1869->intf->pixel_clock / 2) / (512 >> cdp1869->tonefreq) / (cdp1869->tonediv + 1); |
| 450 | 719 | |
| 451 | | cdp1869_draw_line(machine, bitmap, screenrect->min_x + x, screenrect->min_y + y, data, color); |
| 720 | int rate = device->machine->sample_rate / 2; |
| 452 | 721 | |
| 453 | | addr++; |
| 454 | | y++; |
| 722 | /* get progress through wave */ |
| 723 | int incr = cdp1869->incr; |
| 455 | 724 | |
| 456 | | if (!cdp1869.fresvert) |
| 725 | if (signal < 0) |
| 457 | 726 | { |
| 458 | | y++; |
| 727 | signal = -(cdp1869->toneamp * (0x07fff / 15)); |
| 459 | 728 | } |
| 729 | else |
| 730 | { |
| 731 | signal = cdp1869->toneamp * (0x07fff / 15); |
| 732 | } |
| 460 | 733 | |
| 461 | | if (i == 7) |
| 734 | while( length-- > 0 ) |
| 462 | 735 | { |
| 463 | | addr = addr2; |
| 736 | *buffer++ = signal; |
| 737 | incr -= frequency; |
| 738 | while( incr < 0 ) |
| 739 | { |
| 740 | incr += rate; |
| 741 | signal = -signal; |
| 742 | } |
| 464 | 743 | } |
| 744 | |
| 745 | /* store progress through wave */ |
| 746 | cdp1869->incr = incr; |
| 747 | cdp1869->signal = signal; |
| 465 | 748 | } |
| 466 | | } |
| 467 | 749 | |
| 468 | | VIDEO_START( cdp1869 ) |
| 469 | | { |
| 470 | | state_save_register_item("cdp1869", 0, cdp1869.ntsc_pal); |
| 471 | | state_save_register_item("cdp1869", 0, cdp1869.dispoff); |
| 472 | | state_save_register_item("cdp1869", 0, cdp1869.fresvert); |
| 473 | | state_save_register_item("cdp1869", 0, cdp1869.freshorz); |
| 474 | | state_save_register_item("cdp1869", 0, cdp1869.dblpage); |
| 475 | | state_save_register_item("cdp1869", 0, cdp1869.line16); |
| 476 | | state_save_register_item("cdp1869", 0, cdp1869.line9); |
| 477 | | state_save_register_item("cdp1869", 0, cdp1869.cmem); |
| 478 | | state_save_register_item("cdp1869", 0, cdp1869.cfc); |
| 479 | | state_save_register_item("cdp1869", 0, cdp1869.col); |
| 480 | | state_save_register_item("cdp1869", 0, cdp1869.bkg); |
| 481 | | state_save_register_item("cdp1869", 0, cdp1869.pma); |
| 482 | | state_save_register_item("cdp1869", 0, cdp1869.hma); |
| 483 | | state_save_register_item_array("cdp1869", 0, cdp1869.cram); |
| 484 | | state_save_register_item_array("cdp1869", 0, cdp1869.pram); |
| 485 | | state_save_register_item("cdp1869", 0, cdp1869.cramsize); |
| 486 | | state_save_register_item("cdp1869", 0, cdp1869.pramsize); |
| 750 | if (!cdp1869->wnoff) |
| 751 | { |
| 752 | int wndiv; |
| 753 | double amplitude = cdp1869->wnamp * ((0.78*5) / 15); |
| 754 | |
| 755 | for (wndiv = 0; wndiv < 128; wndiv++) |
| 756 | { |
| 757 | double frequency = (cdp1869->intf->pixel_clock / 2) / (4096 >> cdp1869->wnfreq) / (wndiv + 1); |
| 758 | |
| 759 | cdp1869_sum_square_wave(buffer, frequency, amplitude); |
| 760 | } |
| 761 | } |
| 487 | 762 | } |
| 763 | #endif |
| 488 | 764 | |
| 489 | | VIDEO_UPDATE( cdp1869 ) |
| 765 | /* Device Interface */ |
| 766 | |
| 767 | static DEVICE_START( cdp1869 ) |
| 490 | 768 | { |
| 491 | | fillbitmap(bitmap, get_black_pen(screen->machine), cliprect); |
| 769 | cdp1869_t *cdp1869 = get_safe_token(device); |
| 770 | char unique_tag[30]; |
| 492 | 771 | |
| 493 | | if (!cdp1869.dispoff) |
| 494 | | { |
| 495 | | int sx, sy, rows, cols, width, height; |
| 496 | | UINT16 addr, pmemsize; |
| 497 | | rectangle screen_rect, outer; |
| 772 | // validate arguments |
| 498 | 773 | |
| 499 | | switch (cdp1869.ntsc_pal) |
| 500 | | { |
| 501 | | case CDP1869_NTSC: |
| 502 | | outer.min_x = CDP1869_HBLANK_END; |
| 503 | | outer.max_x = CDP1869_HBLANK_START - 1; |
| 504 | | outer.min_y = CDP1869_SCANLINE_VBLANK_END_NTSC; |
| 505 | | outer.max_y = CDP1869_SCANLINE_VBLANK_START_NTSC - 1; |
| 506 | | screen_rect.min_x = CDP1869_SCREEN_START_NTSC; |
| 507 | | screen_rect.max_x = CDP1869_SCREEN_END - 1; |
| 508 | | screen_rect.min_y = CDP1869_SCANLINE_DISPLAY_START_NTSC; |
| 509 | | screen_rect.max_y = CDP1869_SCANLINE_DISPLAY_END_NTSC - 1; |
| 510 | | break; |
| 774 | assert(device != NULL); |
| 775 | assert(device->tag != NULL); |
| 776 | assert(strlen(device->tag) < 20); |
| 777 | assert(device->static_config != NULL); |
| 511 | 778 | |
| 512 | | default: |
| 513 | | case CDP1869_PAL: |
| 514 | | outer.min_x = CDP1869_HBLANK_END; |
| 515 | | outer.max_x = CDP1869_HBLANK_START - 1; |
| 516 | | outer.min_y = CDP1869_SCANLINE_VBLANK_END_PAL; |
| 517 | | outer.max_y = CDP1869_SCANLINE_VBLANK_START_PAL - 1; |
| 518 | | screen_rect.min_x = CDP1869_SCREEN_START_PAL; |
| 519 | | screen_rect.max_x = CDP1869_SCREEN_END - 1; |
| 520 | | screen_rect.min_y = CDP1869_SCANLINE_DISPLAY_START_PAL; |
| 521 | | screen_rect.max_y = CDP1869_SCANLINE_DISPLAY_END_PAL - 1; |
| 522 | | break; |
| 523 | | } |
| 779 | cdp1869->intf = device->static_config; |
| 524 | 780 | |
| 525 | | sect_rect(&outer, cliprect); |
| 526 | | fillbitmap(bitmap, screen->machine->pens[cdp1869.bkg], &outer); |
| 781 | assert(cdp1869->intf->page_ram_r != NULL); |
| 782 | assert(cdp1869->intf->page_ram_w != NULL); |
| 783 | assert(cdp1869->intf->pcb_r != NULL); |
| 784 | assert(cdp1869->intf->char_ram_r != NULL); |
| 785 | assert(cdp1869->intf->char_ram_w != NULL); |
| 527 | 786 | |
| 528 | | width = CDP1869_CHAR_WIDTH; |
| 529 | | height = cdp1869_get_lines(); |
| 787 | // set initial values |
| 530 | 788 | |
| 531 | | if (!cdp1869.freshorz) |
| 532 | | { |
| 533 | | width *= 2; |
| 534 | | } |
| 789 | cdp1869->toneoff = 1; |
| 790 | cdp1869->wnoff = 1; |
| 535 | 791 | |
| 536 | | if (!cdp1869.fresvert) |
| 537 | | { |
| 538 | | height *= 2; |
| 539 | | } |
| 792 | // get the screen device |
| 540 | 793 | |
| 541 | | cols = cdp1869.freshorz ? CDP1869_COLUMNS_FULL : CDP1869_COLUMNS_HALF; |
| 542 | | rows = (screen_rect.max_y - screen_rect.min_y + 1) / height; |
| 794 | cdp1869->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, cdp1869->intf->screen_tag); |
| 795 | assert(cdp1869->screen != NULL); |
| 543 | 796 | |
| 544 | | pmemsize = cdp1869_get_pmemsize(cols, rows); |
| 797 | // allocate timers |
| 545 | 798 | |
| 546 | | addr = cdp1869.hma; |
| 799 | if (cdp1869->intf->on_prd_changed != NULL) |
| 800 | { |
| 801 | cdp1869->prd_changed_timer = timer_alloc(prd_changed_tick, (void *)device); |
| 802 | update_prd_changed_timer(cdp1869); |
| 803 | } |
| 547 | 804 | |
| 548 | | for (sy = 0; sy < rows; sy++) |
| 549 | | { |
| 550 | | for (sx = 0; sx < cols; sx++) |
| 551 | | { |
| 552 | | int x = sx * width; |
| 553 | | int y = sy * height; |
| 805 | // register for state saving |
| 554 | 806 | |
| 555 | | cdp1869_draw_char(screen->machine, bitmap, x, y, addr, &screen_rect); |
| 807 | state_save_combine_module_and_tag(unique_tag, "CDP1869", device->tag); |
| 808 | state_save_register_func_postload_ptr(cdp1869_state_save_postload, cdp1869); |
| 556 | 809 | |
| 557 | | addr++; |
| 810 | state_save_register_item(unique_tag, 0, cdp1869->dispoff); |
| 811 | state_save_register_item(unique_tag, 0, cdp1869->fresvert); |
| 812 | state_save_register_item(unique_tag, 0, cdp1869->freshorz); |
| 813 | state_save_register_item(unique_tag, 0, cdp1869->cmem); |
| 814 | state_save_register_item(unique_tag, 0, cdp1869->dblpage); |
| 815 | state_save_register_item(unique_tag, 0, cdp1869->line16); |
| 816 | state_save_register_item(unique_tag, 0, cdp1869->line9); |
| 817 | state_save_register_item(unique_tag, 0, cdp1869->cfc); |
| 818 | state_save_register_item(unique_tag, 0, cdp1869->col); |
| 819 | state_save_register_item(unique_tag, 0, cdp1869->bkg); |
| 820 | state_save_register_item(unique_tag, 0, cdp1869->pma); |
| 821 | state_save_register_item(unique_tag, 0, cdp1869->hma); |
| 558 | 822 | |
| 559 | | if (addr == pmemsize) addr = 0; |
| 560 | | } |
| 561 | | } |
| 823 | state_save_register_item(unique_tag, 0, cdp1869->signal); |
| 824 | state_save_register_item(unique_tag, 0, cdp1869->incr); |
| 825 | state_save_register_item(unique_tag, 0, cdp1869->toneoff); |
| 826 | state_save_register_item(unique_tag, 0, cdp1869->wnoff); |
| 827 | state_save_register_item(unique_tag, 0, cdp1869->tonediv); |
| 828 | state_save_register_item(unique_tag, 0, cdp1869->tonefreq); |
| 829 | state_save_register_item(unique_tag, 0, cdp1869->toneamp); |
| 830 | state_save_register_item(unique_tag, 0, cdp1869->wnfreq); |
| 831 | state_save_register_item(unique_tag, 0, cdp1869->wnamp); |
| 832 | } |
| 833 | |
| 834 | static DEVICE_SET_INFO( cdp1869 ) |
| 835 | { |
| 836 | switch (state) |
| 837 | { |
| 838 | /* no parameters to set */ |
| 562 | 839 | } |
| 563 | | |
| 564 | | return 0; |
| 565 | 840 | } |
| 566 | 841 | |
| 567 | | void cdp1869_configure(const CDP1869_interface *intf) |
| 842 | DEVICE_GET_INFO( cdp1869_video ) |
| 568 | 843 | { |
| 569 | | if (intf->charrom_region != REGION_INVALID) |
| 844 | switch (state) |
| 570 | 845 | { |
| 571 | | UINT8 *memory = memory_region(intf->charrom_region); |
| 572 | | memcpy(cdp1869.cram, memory, intf->charram_size); |
| 846 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 847 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(cdp1869_t); break; |
| 848 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 849 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 850 | |
| 851 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 852 | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(cdp1869); break; |
| 853 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cdp1869); break; |
| 854 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 855 | case DEVINFO_FCT_RESET: /* Nothing */ break; |
| 856 | |
| 857 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 858 | case DEVINFO_STR_NAME: info->s = "RCA CDP1869"; break; |
| 859 | case DEVINFO_STR_FAMILY: info->s = "RCA CDP1869"; break; |
| 860 | case DEVINFO_STR_VERSION: info->s = "1.0"; break; |
| 861 | case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break; |
| 862 | case DEVINFO_STR_CREDITS: info->s = "Copyright Nicola Salmoria and the MAME Team"; break; |
| 573 | 863 | } |
| 574 | | |
| 575 | | cdp1869.ntsc_pal = intf->video_format; |
| 576 | | cdp1869.cramsize = intf->charram_size; |
| 577 | | cdp1869.pramsize = intf->pageram_size; |
| 578 | | cdp1869.color_callback = intf->get_color_bits; |
| 579 | 864 | } |
src/emu/video/cdp1869.h
| r2218 | r2219 | |
| 34 | 34 | #ifndef __CDP1869_VIDEO__ |
| 35 | 35 | #define __CDP1869_VIDEO__ |
| 36 | 36 | |
| 37 | | typedef enum _cdp1869_video_format cdp1869_video_format; |
| 38 | | |
| 39 | | enum _cdp1869_video_format { |
| 40 | | CDP1869_NTSC, |
| 41 | | CDP1869_PAL |
| 42 | | }; |
| 43 | | |
| 44 | 37 | #define CDP1869_DOT_CLK_PAL 5626000.0 |
| 45 | 38 | #define CDP1869_DOT_CLK_NTSC 5670000.0 |
| 46 | 39 | #define CDP1869_COLOR_CLK_PAL 8867236.0 |
| r2218 | r2219 | |
| 54 | 47 | #define CDP1869_HSYNC_START (56 * CDP1869_CHAR_WIDTH) |
| 55 | 48 | #define CDP1869_HSYNC_END (60 * CDP1869_CHAR_WIDTH) |
| 56 | 49 | #define CDP1869_HBLANK_START (54 * CDP1869_CHAR_WIDTH) |
| 57 | | #define CDP1869_HBLANK_END (5 * CDP1869_CHAR_WIDTH) |
| 58 | | #define CDP1869_SCREEN_START_PAL (9 * CDP1869_CHAR_WIDTH) |
| 50 | #define CDP1869_HBLANK_END ( 5 * CDP1869_CHAR_WIDTH) |
| 51 | #define CDP1869_SCREEN_START_PAL ( 9 * CDP1869_CHAR_WIDTH) |
| 59 | 52 | #define CDP1869_SCREEN_START_NTSC (10 * CDP1869_CHAR_WIDTH) |
| 60 | 53 | #define CDP1869_SCREEN_START (10 * CDP1869_CHAR_WIDTH) |
| 61 | 54 | #define CDP1869_SCREEN_END (50 * CDP1869_CHAR_WIDTH) |
| r2218 | r2219 | |
| 83 | 76 | #define CDP1869_SCANLINE_PREDISPLAY_END_NTSC 228 |
| 84 | 77 | #define CDP1869_VISIBLE_SCANLINES_NTSC (CDP1869_SCANLINE_DISPLAY_END_NTSC - CDP1869_SCANLINE_DISPLAY_START_NTSC) |
| 85 | 78 | |
| 86 | | #define CDP1869_FPS_PAL CDP1869_DOT_CLK_PAL / CDP1869_SCREEN_WIDTH / CDP1869_TOTAL_SCANLINES_PAL |
| 87 | | #define CDP1869_FPS_NTSC CDP1869_DOT_CLK_NTSC / CDP1869_SCREEN_WIDTH / CDP1869_TOTAL_SCANLINES_NTSC |
| 79 | #define CDP1869_PALETTE_LENGTH 8+64 |
| 88 | 80 | |
| 89 | | #define CDP1869_WEIGHT_RED 30 // % of max luminance |
| 90 | | #define CDP1869_WEIGHT_GREEN 59 |
| 91 | | #define CDP1869_WEIGHT_BLUE 11 |
| 81 | #define CDP1869_VIDEO DEVICE_GET_INFO_NAME(cdp1869_video) |
| 92 | 82 | |
| 93 | | #define CDP1869_CHARRAM_SIZE 0x1000 |
| 94 | | #define CDP1869_PAGERAM_SIZE 0x800 |
| 83 | typedef UINT8 (*cdp1869_char_ram_read_func)(const device_config *device, UINT16 pma, UINT8 cma); |
| 84 | #define CDP1869_CHAR_RAM_READ(name) UINT8 name(const device_config *device, UINT16 pma, UINT8 cma) |
| 95 | 85 | |
| 96 | | #define CDP1869_COLUMNS_HALF 20 |
| 97 | | #define CDP1869_COLUMNS_FULL 40 |
| 98 | | #define CDP1869_ROWS_HALF 12 |
| 99 | | #define CDP1869_ROWS_FULL_PAL 25 |
| 100 | | #define CDP1869_ROWS_FULL_NTSC 24 |
| 86 | typedef void (*cdp1869_char_ram_write_func)(const device_config *device, UINT16 pma, UINT8 cma, UINT8 data); |
| 87 | #define CDP1869_CHAR_RAM_WRITE(name) void name(const device_config *device, UINT16 pma, UINT8 cma, UINT8 data) |
| 101 | 88 | |
| 102 | | typedef struct CDP1869_interface |
| 89 | typedef UINT8 (*cdp1869_page_ram_read_func)(const device_config *device, UINT16 pma); |
| 90 | #define CDP1869_PAGE_RAM_READ(name) UINT8 name(const device_config *device, UINT16 pma) |
| 91 | |
| 92 | typedef void (*cdp1869_page_ram_write_func)(const device_config *device, UINT16 pma, UINT8 data); |
| 93 | #define CDP1869_PAGE_RAM_WRITE(name) void name(const device_config *device, UINT16 pma, UINT8 data) |
| 94 | |
| 95 | typedef int (*cdp1869_pcb_read_func)(const device_config *device, UINT16 pma, UINT8 cma); |
| 96 | #define CDP1869_PCB_READ(name) int name(const device_config *device, UINT16 pma, UINT8 cma) |
| 97 | |
| 98 | typedef void (*cdp1869_on_prd_changed_func) (const device_config *device, int prd); |
| 99 | #define CDP1869_ON_PRD_CHANGED(name) void name(const device_config *device, int prd) |
| 100 | |
| 101 | typedef enum _cdp1869_format cdp1869_format; |
| 102 | enum _cdp1869_format { |
| 103 | CDP1869_NTSC = 0, |
| 104 | CDP1869_PAL |
| 105 | }; |
| 106 | |
| 107 | /* interface */ |
| 108 | typedef struct _cdp1869_interface cdp1869_interface; |
| 109 | struct _cdp1869_interface |
| 103 | 110 | { |
| 104 | | cdp1869_video_format video_format; // display format (NTSC/PAL) |
| 105 | | int charrom_region; // memory region to load CHARRAM from |
| 106 | | UINT16 charram_size; // CHARRAM size |
| 107 | | UINT16 pageram_size; // PAGERAM size |
| 108 | | UINT8 (*get_color_bits)(UINT8 cramdata, UINT16 cramaddr, UINT16 pramaddr); // 0x01 = PCB, 0x02 = CCB0, 0x04 = CCB1 |
| 109 | | } CDP1869_interface; |
| 111 | const char *screen_tag; /* screen we are acting on */ |
| 112 | int pixel_clock; /* the dot clock of the chip */ |
| 113 | int color_clock; /* the chroma clock of the chip */ |
| 110 | 114 | |
| 111 | | WRITE8_HANDLER ( cdp1869_out3_w ); |
| 112 | | WRITE8_HANDLER ( cdp1869_out4_w ); |
| 113 | | WRITE8_HANDLER ( cdp1869_out5_w ); |
| 114 | | WRITE8_HANDLER ( cdp1869_out6_w ); |
| 115 | | WRITE8_HANDLER ( cdp1869_out7_w ); |
| 115 | cdp1869_format pal_ntsc; /* screen format */ |
| 116 | 116 | |
| 117 | /* page memory read function */ |
| 118 | cdp1869_page_ram_read_func page_ram_r; |
| 119 | |
| 120 | /* page memory write function */ |
| 121 | cdp1869_page_ram_write_func page_ram_w; |
| 122 | |
| 123 | /* page memory color bit read function */ |
| 124 | cdp1869_pcb_read_func pcb_r; |
| 125 | |
| 126 | /* character memory read function */ |
| 127 | cdp1869_char_ram_read_func char_ram_r; |
| 128 | |
| 129 | /* character memory write function */ |
| 130 | cdp1869_char_ram_write_func char_ram_w; |
| 131 | |
| 132 | /* if specified, this gets called for every change of the predisplay pin (CDP1870/76 pin 1) */ |
| 133 | cdp1869_on_prd_changed_func on_prd_changed; |
| 134 | }; |
| 135 | |
| 136 | /* device interface */ |
| 137 | DEVICE_GET_INFO( cdp1869_video ); |
| 138 | |
| 139 | /* palette initialization */ |
| 117 | 140 | PALETTE_INIT( cdp1869 ); |
| 118 | | VIDEO_START( cdp1869 ); |
| 119 | | VIDEO_UPDATE( cdp1869 ); |
| 120 | 141 | |
| 121 | | READ8_HANDLER ( cdp1869_charram_r ); |
| 122 | | READ8_HANDLER ( cdp1869_pageram_r ); |
| 123 | | WRITE8_HANDLER ( cdp1869_charram_w ); |
| 124 | | WRITE8_HANDLER ( cdp1869_pageram_w ); |
| 142 | /* io port access */ |
| 143 | WRITE8_DEVICE_HANDLER( cdp1869_out3_w ); |
| 144 | WRITE8_DEVICE_HANDLER( cdp1869_out4_w ); |
| 145 | WRITE8_DEVICE_HANDLER( cdp1869_out5_w ); |
| 146 | WRITE8_DEVICE_HANDLER( cdp1869_out6_w ); |
| 147 | WRITE8_DEVICE_HANDLER( cdp1869_out7_w ); |
| 125 | 148 | |
| 126 | | void cdp1869_configure(const CDP1869_interface *intf); |
| 149 | /* character memory access */ |
| 150 | READ8_DEVICE_HANDLER ( cdp1869_charram_r ); |
| 151 | WRITE8_DEVICE_HANDLER ( cdp1869_charram_w ); |
| 127 | 152 | |
| 128 | | UINT16 cdp1869_get_cma(UINT16 offset); |
| 153 | /* page memory access */ |
| 154 | READ8_DEVICE_HANDLER ( cdp1869_pageram_r ); |
| 155 | WRITE8_DEVICE_HANDLER ( cdp1869_pageram_w ); |
| 129 | 156 | |
| 157 | /* updates the screen */ |
| 158 | void cdp1869_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect); |
| 159 | |
| 130 | 160 | #endif |
src/mess/drivers/tmc600.c
| r2218 | r2219 | |
| 89 | 89 | #include "cpu/cdp1802/cdp1802.h" |
| 90 | 90 | #include "video/cdp1869.h" |
| 91 | 91 | |
| 92 | #define SCREEN_TAG "main" |
| 93 | #define CDP1869_TAG "cdp1869" |
| 94 | |
| 95 | #define TMC600_PAGERAM_SIZE 0x400 |
| 96 | #define TMC600_PAGERAM_MASK 0x3ff |
| 97 | |
| 92 | 98 | /* Read/Write Handlers */ |
| 93 | 99 | |
| 94 | 100 | static int vismac_reg_latch; |
| 95 | 101 | static int vismac_color_latch; |
| 96 | 102 | static int vismac_bkg_latch; |
| 97 | 103 | static int vismac_blink; |
| 98 | | static UINT8 vismac_colorram[0x400]; // 1024x4 bit color ram (0x08 = blink) |
| 104 | static UINT8 *pageram, *vismac_colorram; |
| 99 | 105 | |
| 100 | 106 | static WRITE8_HANDLER( vismac_register_w ) |
| 101 | 107 | { |
| 102 | 108 | vismac_reg_latch = data; |
| 103 | 109 | } |
| 104 | 110 | |
| 105 | | static WRITE8_HANDLER( vismac_data_w ) |
| 111 | static WRITE8_DEVICE_HANDLER( vismac_data_w ) |
| 106 | 112 | { |
| 107 | 113 | switch (vismac_reg_latch) |
| 108 | 114 | { |
| r2218 | r2219 | |
| 114 | 120 | case 0x30: |
| 115 | 121 | // write cdp1869 command on the data bus |
| 116 | 122 | vismac_bkg_latch = data & 0x07; |
| 117 | | cdp1869_out3_w(machine, 0, data); |
| 123 | cdp1869_out3_w(device, 0, data); |
| 118 | 124 | break; |
| 119 | 125 | |
| 120 | 126 | case 0x40: |
| 121 | | cdp1869_out4_w(machine, 0, data); |
| 127 | cdp1869_out4_w(device, 0, data); |
| 122 | 128 | break; |
| 123 | 129 | |
| 124 | 130 | case 0x50: |
| 125 | | cdp1869_out5_w(machine, 0, data); |
| 131 | cdp1869_out5_w(device, 0, data); |
| 126 | 132 | break; |
| 127 | 133 | |
| 128 | 134 | case 0x60: |
| 129 | | cdp1869_out6_w(machine, 0, data); |
| 135 | cdp1869_out6_w(device, 0, data); |
| 130 | 136 | break; |
| 131 | 137 | |
| 132 | 138 | case 0x70: |
| 133 | | cdp1869_out7_w(machine, 0, data); |
| 139 | cdp1869_out7_w(device, 0, data); |
| 134 | 140 | break; |
| 135 | 141 | } |
| 136 | 142 | } |
| 137 | 143 | |
| 138 | | static WRITE8_HANDLER( vismac_pageram_w ) |
| 139 | | { |
| 140 | | cdp1869_pageram_w( machine, offset, data ); |
| 141 | | vismac_colorram[offset] = vismac_color_latch; |
| 142 | | } |
| 143 | | |
| 144 | 144 | static int keylatch; |
| 145 | 145 | |
| 146 | 146 | static WRITE8_HANDLER( keyboard_latch_w ) |
| r2218 | r2219 | |
| 158 | 158 | static ADDRESS_MAP_START( tmc600_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 159 | 159 | AM_RANGE(0x0000, 0x4fff) AM_ROM |
| 160 | 160 | AM_RANGE(0x6000, 0x7fff) AM_RAM |
| 161 | | AM_RANGE(0xf400, 0xf7ff) AM_READWRITE(cdp1869_charram_r, cdp1869_charram_w) |
| 162 | | AM_RANGE(0xf800, 0xffff) AM_READWRITE(cdp1869_pageram_r, vismac_pageram_w) |
| 161 | AM_RANGE(0xf400, 0xf7ff) AM_DEVREADWRITE(CDP1869_VIDEO, CDP1869_TAG, cdp1869_charram_r, cdp1869_charram_w) |
| 162 | AM_RANGE(0xf800, 0xffff) AM_DEVREADWRITE(CDP1869_VIDEO, CDP1869_TAG, cdp1869_pageram_r, cdp1869_pageram_w) |
| 163 | 163 | ADDRESS_MAP_END |
| 164 | 164 | |
| 165 | 165 | static ADDRESS_MAP_START( tmc600_io_map, ADDRESS_SPACE_IO, 8 ) |
| 166 | 166 | AM_RANGE(0x03, 0x03) AM_WRITE(keyboard_latch_w) |
| 167 | 167 | AM_RANGE(0x04, 0x04) AM_WRITE(printer_w) |
| 168 | | AM_RANGE(0x05, 0x05) AM_WRITE(vismac_data_w) |
| 168 | AM_RANGE(0x05, 0x05) AM_DEVWRITE(CDP1869_VIDEO, CDP1869_TAG, vismac_data_w) |
| 169 | 169 | // AM_RANGE(0x06, 0x06) AM_WRITE(floppy_w) |
| 170 | 170 | AM_RANGE(0x07, 0x07) AM_WRITE(vismac_register_w) |
| 171 | 171 | ADDRESS_MAP_END |
| r2218 | r2219 | |
| 309 | 309 | NULL |
| 310 | 310 | }; |
| 311 | 311 | |
| 312 | /* Video */ |
| 313 | |
| 312 | 314 | static INTERRUPT_GEN( vismac_blink_int ) |
| 313 | 315 | { |
| 314 | 316 | vismac_blink = !vismac_blink; |
| 315 | 317 | } |
| 316 | 318 | |
| 319 | static UINT8 tmc600_get_color(UINT16 pma) |
| 320 | { |
| 321 | UINT8 color = vismac_colorram[pma]; |
| 322 | |
| 323 | if (BIT(color, 3) && vismac_blink) |
| 324 | { |
| 325 | return vismac_bkg_latch; |
| 326 | } |
| 327 | else |
| 328 | { |
| 329 | return color; |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | static CDP1869_PAGE_RAM_READ(tmc600_pageram_r) |
| 334 | { |
| 335 | UINT16 addr = pma & TMC600_PAGERAM_MASK; |
| 336 | |
| 337 | return pageram[addr]; |
| 338 | } |
| 339 | |
| 340 | static CDP1869_PAGE_RAM_WRITE(tmc600_pageram_w) |
| 341 | { |
| 342 | UINT16 addr = pma & TMC600_PAGERAM_MASK; |
| 343 | |
| 344 | pageram[addr] = data; |
| 345 | vismac_colorram[addr] = vismac_color_latch; |
| 346 | } |
| 347 | |
| 348 | static CDP1869_CHAR_RAM_READ(tmc600_charram_r) |
| 349 | { |
| 350 | UINT16 pageaddr = pma & TMC600_PAGERAM_MASK; |
| 351 | UINT8 column = pageram[pageaddr]; |
| 352 | UINT8 color = tmc600_get_color(pageaddr); |
| 353 | UINT16 charaddr = (column << 3) | (cma & 0x07); |
| 354 | UINT8 *charrom = memory_region(REGION_GFX1); |
| 355 | UINT8 cdb = charrom[charaddr] & 0x3f; |
| 356 | |
| 357 | int ccb0 = BIT(color, 2); |
| 358 | int ccb1 = BIT(color, 1); |
| 359 | |
| 360 | if (BIT(cma, 3)) |
| 361 | { |
| 362 | charaddr += 0x800; |
| 363 | } |
| 364 | |
| 365 | return (ccb1 << 7) | (ccb0 << 6) | cdb; |
| 366 | } |
| 367 | |
| 368 | static CDP1869_CHAR_RAM_WRITE(tmc600_charram_w) |
| 369 | { |
| 370 | // character ROM cannot be written to |
| 371 | } |
| 372 | |
| 373 | static CDP1869_PCB_READ(tmc600_pcb_r) |
| 374 | { |
| 375 | UINT16 pageaddr = pma & TMC600_PAGERAM_MASK; |
| 376 | UINT8 color = tmc600_get_color(pageaddr); |
| 377 | |
| 378 | int pcb = BIT(color, 0); |
| 379 | |
| 380 | return pcb; |
| 381 | } |
| 382 | |
| 383 | static const cdp1869_interface tmc600_cdp1869_intf = |
| 384 | { |
| 385 | SCREEN_TAG, |
| 386 | CDP1869_DOT_CLK_PAL, |
| 387 | CDP1869_COLOR_CLK_PAL, |
| 388 | CDP1869_PAL, |
| 389 | tmc600_pageram_r, |
| 390 | tmc600_pageram_w, |
| 391 | tmc600_pcb_r, |
| 392 | tmc600_charram_r, |
| 393 | tmc600_charram_w, |
| 394 | NULL |
| 395 | }; |
| 396 | |
| 397 | static VIDEO_START( tmc600 ) |
| 398 | { |
| 399 | // allocate memory |
| 400 | |
| 401 | pageram = auto_malloc(TMC600_PAGERAM_SIZE); |
| 402 | vismac_colorram = auto_malloc(TMC600_PAGERAM_SIZE); |
| 403 | |
| 404 | // register for save state |
| 405 | |
| 406 | state_save_register_global_pointer(pageram, TMC600_PAGERAM_SIZE); |
| 407 | state_save_register_global_pointer(vismac_colorram, TMC600_PAGERAM_SIZE); |
| 408 | } |
| 409 | |
| 410 | static VIDEO_UPDATE( tmc600 ) |
| 411 | { |
| 412 | const device_config *cdp1869 = device_list_find_by_tag(screen->machine->config->devicelist, CDP1869_VIDEO, CDP1869_TAG); |
| 413 | |
| 414 | cdp1869_update(cdp1869, bitmap, cliprect); |
| 415 | |
| 416 | return 0; |
| 417 | } |
| 418 | |
| 317 | 419 | /* Machine Initialization */ |
| 318 | 420 | |
| 319 | 421 | static MACHINE_START( tmc600 ) |
| r2218 | r2219 | |
| 322 | 424 | state_save_register_global(vismac_color_latch); |
| 323 | 425 | state_save_register_global(vismac_bkg_latch); |
| 324 | 426 | state_save_register_global(vismac_blink); |
| 325 | | state_save_register_global_array(vismac_colorram); |
| 326 | 427 | state_save_register_global(keylatch); |
| 327 | 428 | } |
| 328 | 429 | |
| r2218 | r2219 | |
| 348 | 449 | |
| 349 | 450 | // video hardware |
| 350 | 451 | |
| 351 | | MDRV_SCREEN_ADD("main", RASTER) |
| 452 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 352 | 453 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 353 | 454 | MDRV_PALETTE_LENGTH(8+64) |
| 354 | 455 | MDRV_PALETTE_INIT(cdp1869) |
| 355 | | MDRV_VIDEO_START(cdp1869) |
| 356 | | MDRV_VIDEO_UPDATE(cdp1869) |
| 456 | MDRV_VIDEO_START(tmc600) |
| 457 | MDRV_VIDEO_UPDATE(tmc600) |
| 357 | 458 | MDRV_SCREEN_RAW_PARAMS(CDP1869_DOT_CLK_PAL, CDP1869_SCREEN_WIDTH, CDP1869_HBLANK_END, CDP1869_HBLANK_START, CDP1869_TOTAL_SCANLINES_PAL, CDP1869_SCANLINE_VBLANK_END_PAL, CDP1869_SCANLINE_VBLANK_START_PAL) |
| 358 | 459 | |
| 460 | MDRV_DEVICE_ADD(CDP1869_TAG, CDP1869_VIDEO) |
| 461 | MDRV_DEVICE_CONFIG(tmc600_cdp1869_intf) |
| 462 | |
| 359 | 463 | // sound hardware |
| 360 | 464 | |
| 361 | 465 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| r2218 | r2219 | |
| 374 | 478 | ROM_LOAD( "sb23", 0x3000, 0x1000, NO_DUMP ) |
| 375 | 479 | ROM_LOAD( "190482_2", 0x4000, 0x1000, NO_DUMP ) |
| 376 | 480 | |
| 377 | | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 481 | ROM_REGION( 0x1000, REGION_GFX1, 0 ) |
| 378 | 482 | ROM_LOAD( "chargen", 0x0000, 0x1000, NO_DUMP ) |
| 379 | 483 | ROM_END |
| 380 | 484 | |
| r2218 | r2219 | |
| 386 | 490 | ROM_LOAD( "sb33", 0x3000, 0x1000, CRC(b7d241fa) SHA1(6f3eadf86c4e3aaf93d123e302a18dc4d9db964b) ) |
| 387 | 491 | ROM_LOAD( "151182", 0x4000, 0x1000, CRC(c1a8d9d8) SHA1(4552e1f06d0e338ba7b0f1c3a20b8a51c27dafde) ) |
| 388 | 492 | |
| 389 | | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 493 | ROM_REGION( 0x1000, REGION_GFX1, 0 ) |
| 390 | 494 | ROM_LOAD( "chargen", 0x0000, 0x1000, CRC(93f92cbf) SHA1(371156fb38fa5319c6fde537ccf14eed94e7adfb) ) |
| 391 | 495 | ROM_END |
| 392 | 496 | |
| r2218 | r2219 | |
| 466 | 570 | CONFIG_DEVICE(tmc600_quickload_getinfo) |
| 467 | 571 | SYSTEM_CONFIG_END |
| 468 | 572 | |
| 469 | | static UINT8 tmc600_get_color_bits(UINT8 cramdata, UINT16 cramaddr, UINT16 pramaddr) |
| 470 | | { |
| 471 | | UINT8 color = vismac_colorram[pramaddr]; |
| 472 | | |
| 473 | | if ((color & 0x08) && vismac_blink) |
| 474 | | { |
| 475 | | return vismac_bkg_latch; |
| 476 | | } |
| 477 | | else |
| 478 | | { |
| 479 | | return color; |
| 480 | | } |
| 481 | | } |
| 482 | | |
| 483 | | static const CDP1869_interface tmc600_CDP1869_interface = |
| 484 | | { |
| 485 | | CDP1869_PAL, |
| 486 | | REGION_GFX1, |
| 487 | | 0x1000, // charrom size |
| 488 | | 0x400, // pageram size |
| 489 | | tmc600_get_color_bits // color bit callback |
| 490 | | }; |
| 491 | | |
| 492 | | static DRIVER_INIT( tmc600 ) |
| 493 | | { |
| 494 | | cdp1869_configure(&tmc600_CDP1869_interface); |
| 495 | | } |
| 496 | | |
| 497 | 573 | /* System Drivers */ |
| 498 | 574 | |
| 499 | 575 | // YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME |
| 500 | | COMP( 1982, tmc600s1, 0, 0, tmc600, tmc600, tmc600, tmc600, "Telercas Oy", "Telmac TMC-600 (Sarja I)", GAME_NOT_WORKING ) |
| 501 | | COMP( 1982, tmc600s2, 0, 0, tmc600, tmc600, tmc600, tmc600, "Telercas Oy", "Telmac TMC-600 (Sarja II)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 576 | COMP( 1982, tmc600s1, 0, 0, tmc600, tmc600, 0, tmc600, "Telercas Oy", "Telmac TMC-600 (Sarja I)", GAME_NOT_WORKING ) |
| 577 | COMP( 1982, tmc600s2, 0, 0, tmc600, tmc600, 0, tmc600, "Telercas Oy", "Telmac TMC-600 (Sarja II)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |