src/mess/video/mbee.c
| r1542 | r1543 | |
| 73 | 73 | logerror("mbee videoram [$%04X] <- $%02X\n", offset, data); |
| 74 | 74 | videoram[offset] = data; |
| 75 | 75 | colorram[offset] = 2; |
| 76 | | dirtybuffer[offset] = 1; |
| 77 | 76 | } |
| 78 | 77 | } |
| 79 | 78 | |
| r1542 | r1543 | |
| 100 | 99 | if( pcgram[0x0800+offset] != data ) |
| 101 | 100 | { |
| 102 | 101 | int chr = 0x80 + offset / 16; |
| 103 | | int i; |
| 104 | 102 | |
| 105 | 103 | logerror("mbee pcgram [$%04X] <- $%02X\n", offset, data); |
| 106 | 104 | pcgram[0x0800+offset] = data; |
| 107 | 105 | /* decode character graphics again */ |
| 108 | 106 | decodechar(Machine->gfx[0], chr, pcgram); |
| 109 | | |
| 110 | | /* mark all visible characters with that code dirty */ |
| 111 | | for( i = 0; i < videoram_size; i++ ) |
| 112 | | { |
| 113 | | if( videoram[i] == chr ) |
| 114 | | dirtybuffer[i] = 1; |
| 115 | | } |
| 116 | 107 | } |
| 117 | 108 | } |
| 118 | 109 | else |
| r1542 | r1543 | |
| 121 | 112 | { |
| 122 | 113 | logerror("colorram [$%04X] <- $%02X\n", offset, data); |
| 123 | 114 | colorram[offset] = data; |
| 124 | | dirtybuffer[offset] = 1; |
| 125 | 115 | } |
| 126 | 116 | } |
| 127 | 117 | } |
| r1542 | r1543 | |
| 414 | 404 | crt.cursor_top = data; |
| 415 | 405 | logerror("6545 cursor top %d/$%02X\n", data & 31, data); |
| 416 | 406 | addr = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 417 | | dirtybuffer[addr] = 1; |
| 418 | 407 | break; |
| 419 | 408 | case 11: |
| 420 | 409 | if( crt.cursor_bottom == data ) |
| r1542 | r1543 | |
| 422 | 411 | crt.cursor_bottom = data; |
| 423 | 412 | logerror("6545 cursor bottom %d/$%02X\n", data & 31, data); |
| 424 | 413 | addr = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 425 | | dirtybuffer[addr] = 1; |
| 426 | 414 | break; |
| 427 | 415 | case 12: |
| 428 | 416 | data &= 63; |
| r1542 | r1543 | |
| 445 | 433 | break; |
| 446 | 434 | crt.cursor_address_hi = data; |
| 447 | 435 | addr = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 448 | | dirtybuffer[addr] = 1; |
| 449 | 436 | logerror("6545 cursor address hi $%02X\n", data); |
| 450 | 437 | break; |
| 451 | 438 | case 15: |
| r1542 | r1543 | |
| 453 | 440 | break; |
| 454 | 441 | crt.cursor_address_lo = data; |
| 455 | 442 | addr = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 456 | | dirtybuffer[addr] = 1; |
| 457 | 443 | logerror("6545 cursor address lo $%02X\n", data); |
| 458 | 444 | break; |
| 459 | 445 | case 16: |
| r1542 | r1543 | |
| 492 | 478 | |
| 493 | 479 | videoram = auto_malloc(0x800); |
| 494 | 480 | colorram = auto_malloc(0x800); |
| 495 | | memset(dirtybuffer, 1, videoram_size); |
| 496 | 481 | } |
| 497 | 482 | |
| 498 | 483 | VIDEO_UPDATE( mbee ) |
| r1542 | r1543 | |
| 510 | 495 | } |
| 511 | 496 | } |
| 512 | 497 | |
| 513 | | if( full_refresh ) |
| 514 | | { |
| 515 | | memset(dirtybuffer, 1, videoram_size); |
| 516 | | } |
| 517 | | |
| 518 | 498 | for( offs = 0x000; offs < 0x380; offs += 0x10 ) |
| 519 | 499 | keyboard_matrix_r(offs); |
| 520 | 500 | |
| r1542 | r1543 | |
| 524 | 504 | screen_ = crt.screen_address_hi * 256 + crt.screen_address_lo; |
| 525 | 505 | for( offs = screen_; offs < crt.horizontal_displayed * crt.vertical_displayed + screen_; offs++ ) |
| 526 | 506 | { |
| 527 | | if( dirtybuffer[offs] ) |
| 507 | int sx, sy, code, color; |
| 508 | sy = off_y + ((offs - screen_) / crt.horizontal_displayed) * (crt.scan_lines + 1); |
| 509 | sx = (off_x + ((offs - screen_) % crt.horizontal_displayed)) * 8; |
| 510 | code = videoram[offs]; |
| 511 | color = colorram[offs]; |
| 512 | drawgfx( bitmap,machine->gfx[0],code,color,0,0,sx,sy, |
| 513 | &machine->screen[0].visarea,TRANSPARENCY_NONE,0); |
| 514 | |
| 515 | if( offs == cursor && (crt.cursor_top & 0x60) != 0x20 ) |
| 528 | 516 | { |
| 529 | | int sx, sy, code, color; |
| 530 | | sy = off_y + ((offs - screen_) / crt.horizontal_displayed) * (crt.scan_lines + 1); |
| 531 | | sx = (off_x + ((offs - screen_) % crt.horizontal_displayed)) * 8; |
| 532 | | code = videoram[offs]; |
| 533 | | color = colorram[offs]; |
| 534 | | drawgfx( bitmap,machine->gfx[0],code,color,0,0,sx,sy, |
| 535 | | &machine->screen[0].visarea,TRANSPARENCY_NONE,0); |
| 536 | | dirtybuffer[offs] = 0; |
| 537 | | if( offs == cursor && (crt.cursor_top & 0x60) != 0x20 ) |
| 517 | if( (crt.cursor_top & 0x60) == 0x60 || (framecnt & 16) == 0 ) |
| 538 | 518 | { |
| 539 | | if( (crt.cursor_top & 0x60) == 0x60 || (framecnt & 16) == 0 ) |
| 519 | int x, y; |
| 520 | for( y = (crt.cursor_top & 31); y <= (crt.cursor_bottom & 31); y++ ) |
| 540 | 521 | { |
| 541 | | int x, y; |
| 542 | | for( y = (crt.cursor_top & 31); y <= (crt.cursor_bottom & 31); y++ ) |
| 543 | | { |
| 544 | | if( y > crt.scan_lines ) |
| 545 | | break; |
| 546 | | for( x = 0; x < 8; x++ ) |
| 547 | | *BITMAP_ADDR16(bitmap, sy+y, sx+x) = machine->pens[color]; |
| 548 | | } |
| 549 | | dirtybuffer[offs] = 1; |
| 522 | if( y > crt.scan_lines ) |
| 523 | break; |
| 524 | for( x = 0; x < 8; x++ ) |
| 525 | *BITMAP_ADDR16(bitmap, sy+y, sx+x) = machine->pens[color]; |
| 550 | 526 | } |
| 551 | | } |
| 552 | | } |
| 527 | } |
| 528 | } |
| 553 | 529 | } |
| 554 | 530 | return 0; |
| 555 | 531 | } |
| 556 | | |
| 557 | | |
| 558 | | |
src/mess/video/cgenie.c
| r1542 | r1543 | |
| 14 | 14 | static CRTC6845 crt; |
| 15 | 15 | static int graphics = 0; |
| 16 | 16 | static mame_bitmap *dlybitmap = NULL; |
| 17 | | static UINT8 *cleanbuffer = NULL; |
| 18 | | static UINT8 *colorbuffer = NULL; |
| 19 | | static int update_all = 0; |
| 20 | 17 | static int off_x = 0; |
| 21 | 18 | static int off_y = 0; |
| 22 | 19 | |
| r1542 | r1543 | |
| 33 | 30 | video_start_generic(machine); |
| 34 | 31 | |
| 35 | 32 | dlybitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, BITMAP_FORMAT_INDEXED16); |
| 36 | | |
| 37 | | cleanbuffer = (UINT8*)auto_malloc(64 * 32 * 8); |
| 38 | | memset(cleanbuffer, 0, 64 * 32 * 8); |
| 39 | | |
| 40 | | colorbuffer = (UINT8*)auto_malloc(64 * 32 * 8); |
| 41 | | memset(colorbuffer, 0, 64 * 32 * 8); |
| 42 | 33 | } |
| 43 | 34 | |
| 44 | 35 | /*************************************************************************** |
| r1542 | r1543 | |
| 135 | 126 | break; |
| 136 | 127 | crt.cursor_top = data; |
| 137 | 128 | addr = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 138 | | dirtybuffer[addr] = 1; |
| 139 | 129 | break; |
| 140 | 130 | case 11: |
| 141 | 131 | if( crt.cursor_bottom == data ) |
| 142 | 132 | break; |
| 143 | 133 | crt.cursor_bottom = data; |
| 144 | 134 | addr = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 145 | | dirtybuffer[addr] = 1; |
| 146 | 135 | break; |
| 147 | 136 | case 12: |
| 148 | 137 | data &= 63; |
| 149 | 138 | if( crt.screen_address_hi == data ) |
| 150 | 139 | break; |
| 151 | | update_all = 1; |
| 152 | 140 | crt.screen_address_hi = data; |
| 153 | 141 | break; |
| 154 | 142 | case 13: |
| 155 | 143 | if( crt.screen_address_lo == data ) |
| 156 | 144 | break; |
| 157 | | update_all = 1; |
| 158 | 145 | crt.screen_address_lo = data; |
| 159 | 146 | break; |
| 160 | 147 | case 14: |
| r1542 | r1543 | |
| 163 | 150 | break; |
| 164 | 151 | crt.cursor_address_hi = data; |
| 165 | 152 | addr = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 166 | | dirtybuffer[addr] = 1; |
| 167 | 153 | break; |
| 168 | 154 | case 15: |
| 169 | 155 | if( crt.cursor_address_lo == data ) |
| 170 | 156 | break; |
| 171 | 157 | crt.cursor_address_lo = data; |
| 172 | 158 | addr = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 173 | | dirtybuffer[addr] = 1; |
| 174 | 159 | break; |
| 175 | 160 | } |
| 176 | 161 | } |
| r1542 | r1543 | |
| 250 | 235 | graphics = (mode) ? 1 : 0; |
| 251 | 236 | } |
| 252 | 237 | |
| 253 | | /*************************************************************************** |
| 254 | | Invalidate a range of characters with codes from l to h |
| 255 | | ***************************************************************************/ |
| 256 | | void cgenie_invalidate_range(int l, int h) |
| 257 | | { |
| 258 | | int base = 256 * crt.screen_address_hi + crt.screen_address_lo; |
| 259 | | int size = crt.horizontal_displayed * crt.vertical_displayed; |
| 260 | | int addr; |
| 261 | | int i; |
| 262 | 238 | |
| 263 | | for (addr = 0; addr < size; addr++) |
| 264 | | { |
| 265 | | i = (base + addr) & 0x3fff; |
| 266 | | if( videoram[i] >= l && videoram[i] <= h ) |
| 267 | | dirtybuffer[i] = 1; |
| 268 | | } |
| 269 | | } |
| 270 | | |
| 271 | | |
| 272 | | static void cgenie_refresh_monitor(mame_bitmap * bitmap, int full_refresh) |
| 239 | static void cgenie_refresh_monitor(running_machine *machine, mame_bitmap * bitmap, const rectangle *cliprect) |
| 273 | 240 | { |
| 274 | 241 | int i, address, offset, cursor, size, code, x, y; |
| 275 | 242 | rectangle r; |
| 276 | 243 | |
| 277 | | if( crt.vertical_displayed == 0 || crt.horizontal_displayed == 0 ) |
| 244 | fillbitmap(bitmap, get_black_pen(machine), cliprect); |
| 245 | |
| 246 | if(crt.vertical_displayed || crt.horizontal_displayed) |
| 278 | 247 | { |
| 279 | | fillbitmap(bitmap, Machine->remapped_colortable[0], &Machine->screen[0].visarea); |
| 280 | | } |
| 281 | | else |
| 282 | | { |
| 283 | 248 | offset = 256 * crt.screen_address_hi + crt.screen_address_lo; |
| 284 | 249 | size = crt.horizontal_displayed * crt.vertical_displayed; |
| 285 | 250 | cursor = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 286 | 251 | |
| 287 | | if( full_refresh ) |
| 288 | | { |
| 289 | | full_refresh = 0; |
| 290 | | fillbitmap(bitmap, Machine->remapped_colortable[0], &Machine->screen[0].visarea); |
| 291 | | for( i = offset; i < offset + size; i++ ) |
| 292 | | dirtybuffer[i] = 1; |
| 293 | | } |
| 294 | | |
| 295 | 252 | /* |
| 296 | 253 | * for every character in the Video RAM, check if it has been modified since |
| 297 | 254 | * last time and update it accordingly. |
| r1542 | r1543 | |
| 301 | 258 | i = (offset + address) & 0x3fff; |
| 302 | 259 | x = address % crt.horizontal_displayed + off_x; |
| 303 | 260 | y = address / crt.horizontal_displayed; |
| 304 | | if( dirtybuffer[i] || (update_all && |
| 305 | | (cleanbuffer[y * 64 + x] != videoram[i] || |
| 306 | | colorbuffer[y * 64 + x] != colorram[i & 0x3ff])) ) |
| 261 | |
| 262 | r.min_x = x * 8; |
| 263 | r.max_x = r.min_x + 7; |
| 264 | r.min_y = y * (crt.scan_lines + 1) + off_y; |
| 265 | r.max_y = r.min_y + crt.scan_lines; |
| 266 | |
| 267 | if( graphics ) |
| 307 | 268 | { |
| 308 | | r.min_x = x * 8; |
| 309 | | r.max_x = r.min_x + 7; |
| 310 | | r.min_y = y * (crt.scan_lines + 1) + off_y; |
| 311 | | r.max_y = r.min_y + crt.scan_lines; |
| 269 | /* get graphics code */ |
| 270 | code = videoram[i]; |
| 271 | drawgfx(bitmap, Machine->gfx[1], code, 0, |
| 272 | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 273 | } |
| 274 | else |
| 275 | { |
| 276 | /* get character code */ |
| 277 | code = videoram[i]; |
| 278 | |
| 279 | /* translate defined character sets */ |
| 280 | code += cgenie_font_offset[(code >> 6) & 3]; |
| 281 | drawgfx(bitmap, Machine->gfx[0], code, colorram[i&0x3ff], |
| 282 | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 283 | } |
| 312 | 284 | |
| 313 | | colorbuffer[y * 64 + x] = colorram[i & 0x3ff]; |
| 314 | | cleanbuffer[y * 64 + x] = videoram[i]; |
| 315 | | dirtybuffer[i] = 0; |
| 285 | if( i == cursor ) |
| 286 | { |
| 287 | rectangle rc; |
| 316 | 288 | |
| 317 | | if( graphics ) |
| 289 | /* check if cursor turned off */ |
| 290 | if( (crt.cursor_top & 0x60) == 0x20 ) |
| 291 | continue; |
| 292 | |
| 293 | if( (crt.cursor_top & 0x60) == 0x60 ) |
| 318 | 294 | { |
| 319 | | /* get graphics code */ |
| 320 | | code = videoram[i]; |
| 321 | | drawgfx(bitmap, Machine->gfx[1], code, 0, |
| 322 | | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 295 | crt.cursor_visible = 1; |
| 323 | 296 | } |
| 324 | 297 | else |
| 325 | 298 | { |
| 326 | | /* get character code */ |
| 327 | | code = videoram[i]; |
| 328 | | /* translate defined character sets */ |
| 329 | | code += cgenie_font_offset[(code >> 6) & 3]; |
| 330 | | drawgfx(bitmap, Machine->gfx[0], code, colorram[i&0x3ff], |
| 331 | | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 299 | crt.cursor_phase++; |
| 300 | crt.cursor_visible = (crt.cursor_phase >> 3) & 1; |
| 332 | 301 | } |
| 333 | | |
| 334 | | if( i == cursor ) |
| 335 | | { |
| 336 | | rectangle rc; |
| 337 | | |
| 338 | | /* check if cursor turned off */ |
| 339 | | if( (crt.cursor_top & 0x60) == 0x20 ) |
| 340 | | continue; |
| 341 | | dirtybuffer[i] = 1; |
| 342 | | if( (crt.cursor_top & 0x60) == 0x60 ) |
| 343 | | { |
| 344 | | crt.cursor_visible = 1; |
| 345 | | } |
| 346 | | else |
| 347 | | { |
| 348 | | crt.cursor_phase++; |
| 349 | | crt.cursor_visible = (crt.cursor_phase >> 3) & 1; |
| 350 | | } |
| 351 | | if( !crt.cursor_visible ) |
| 352 | | continue; |
| 353 | | rc.min_x = r.min_x; |
| 354 | | rc.max_x = r.max_x; |
| 355 | | rc.min_y = r.min_y + (crt.cursor_top & 15); |
| 356 | | rc.max_y = r.min_y + (crt.cursor_bottom & 15); |
| 357 | | drawgfx(bitmap, Machine->gfx[0], 0x7f, colorram[i&0x3ff], |
| 358 | | 0, 0, rc.min_x, rc.min_y, &rc, TRANSPARENCY_NONE, 0); |
| 359 | | } |
| 302 | |
| 303 | if( !crt.cursor_visible ) |
| 304 | continue; |
| 305 | |
| 306 | rc.min_x = r.min_x; |
| 307 | rc.max_x = r.max_x; |
| 308 | rc.min_y = r.min_y + (crt.cursor_top & 15); |
| 309 | rc.max_y = r.min_y + (crt.cursor_bottom & 15); |
| 310 | drawgfx(bitmap, Machine->gfx[0], 0x7f, colorram[i&0x3ff], |
| 311 | 0, 0, rc.min_x, rc.min_y, &rc, TRANSPARENCY_NONE, 0); |
| 360 | 312 | } |
| 361 | 313 | } |
| 362 | 314 | } |
| 363 | | update_all = 0; |
| 364 | 315 | } |
| 365 | 316 | |
| 366 | | static void cgenie_refresh_tv_set(mame_bitmap * bitmap, int full_refresh) |
| 317 | static void cgenie_refresh_tv_set(running_machine *machine, mame_bitmap * bitmap, const rectangle *cliprect) |
| 367 | 318 | { |
| 368 | 319 | int i, address, offset, cursor, size, code, x, y; |
| 369 | 320 | rectangle r; |
| 370 | 321 | |
| 371 | | if( crt.vertical_displayed == 0 || crt.horizontal_displayed == 0 ) |
| 322 | fillbitmap(tmpbitmap, get_black_pen(machine), cliprect); |
| 323 | fillbitmap(dlybitmap, get_black_pen(machine), cliprect); |
| 324 | |
| 325 | if(crt.vertical_displayed || crt.horizontal_displayed) |
| 372 | 326 | { |
| 373 | | fillbitmap(tmpbitmap, Machine->remapped_colortable[0], &Machine->screen[0].visarea); |
| 374 | | fillbitmap(dlybitmap, Machine->remapped_colortable[0], &Machine->screen[0].visarea); |
| 375 | | } |
| 376 | | else |
| 377 | | { |
| 378 | 327 | offset = 256 * crt.screen_address_hi + crt.screen_address_lo; |
| 379 | 328 | size = crt.horizontal_displayed * crt.vertical_displayed; |
| 380 | 329 | cursor = 256 * crt.cursor_address_hi + crt.cursor_address_lo; |
| 381 | 330 | |
| 382 | | if( full_refresh ) |
| 383 | | { |
| 384 | | full_refresh = 0; |
| 385 | | fillbitmap(tmpbitmap, Machine->remapped_colortable[0], &Machine->screen[0].visarea); |
| 386 | | fillbitmap(dlybitmap, Machine->remapped_colortable[0], &Machine->screen[0].visarea); |
| 387 | | for (i = offset; i < offset + size; i++) |
| 388 | | dirtybuffer[i] = 1; |
| 389 | | } |
| 390 | | |
| 391 | 331 | /* |
| 392 | 332 | * for every character in the Video RAM, check if it has been modified since |
| 393 | 333 | * last time and update it accordingly. |
| r1542 | r1543 | |
| 397 | 337 | i = (offset + address) & 0x3fff; |
| 398 | 338 | x = address % crt.horizontal_displayed + off_x; |
| 399 | 339 | y = address / crt.horizontal_displayed; |
| 400 | | if( dirtybuffer[i] || (update_all && |
| 401 | | (cleanbuffer[y * 64 + x] != videoram[i] || |
| 402 | | colorbuffer[y * 64 + x] != colorram[i & 0x3ff])) ) |
| 340 | |
| 341 | r.min_x = x * 8; |
| 342 | r.max_x = r.min_x + 7; |
| 343 | r.min_y = y * (crt.scan_lines + 1) + off_y; |
| 344 | r.max_y = r.min_y + crt.scan_lines; |
| 345 | |
| 346 | if( graphics ) |
| 403 | 347 | { |
| 404 | | r.min_x = x * 8; |
| 405 | | r.max_x = r.min_x + 7; |
| 406 | | r.min_y = y * (crt.scan_lines + 1) + off_y; |
| 407 | | r.max_y = r.min_y + crt.scan_lines; |
| 348 | /* get graphics code */ |
| 349 | code = videoram[i]; |
| 350 | drawgfx(tmpbitmap, Machine->gfx[1], code, 1, |
| 351 | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 352 | drawgfx(dlybitmap, Machine->gfx[1], code, 2, |
| 353 | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 354 | } |
| 355 | else |
| 356 | { |
| 357 | /* get character code */ |
| 358 | code = videoram[i]; |
| 359 | |
| 360 | /* translate defined character sets */ |
| 361 | code += cgenie_font_offset[(code >> 6) & 3]; |
| 362 | drawgfx(tmpbitmap, Machine->gfx[0], code, colorram[i&0x3ff] + 16, |
| 363 | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 364 | drawgfx(dlybitmap, Machine->gfx[0], code, colorram[i&0x3ff] + 32, |
| 365 | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 366 | } |
| 408 | 367 | |
| 409 | | colorbuffer[y * 64 + x] = colorram[i & 0x3ff]; |
| 410 | | cleanbuffer[y * 64 + x] = videoram[i]; |
| 411 | | dirtybuffer[i] = 0; |
| 368 | if( i == cursor ) |
| 369 | { |
| 370 | rectangle rc; |
| 412 | 371 | |
| 413 | | if( graphics ) |
| 372 | /* check if cursor turned off */ |
| 373 | if( (crt.cursor_top & 0x60) == 0x20 ) |
| 374 | continue; |
| 375 | |
| 376 | if( (crt.cursor_top & 0x60) == 0x60 ) |
| 414 | 377 | { |
| 415 | | /* get graphics code */ |
| 416 | | code = videoram[i]; |
| 417 | | drawgfx(tmpbitmap, Machine->gfx[1], code, 1, |
| 418 | | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 419 | | drawgfx(dlybitmap, Machine->gfx[1], code, 2, |
| 420 | | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 378 | crt.cursor_visible = 1; |
| 421 | 379 | } |
| 422 | 380 | else |
| 423 | 381 | { |
| 424 | | /* get character code */ |
| 425 | | code = videoram[i]; |
| 426 | | /* translate defined character sets */ |
| 427 | | code += cgenie_font_offset[(code >> 6) & 3]; |
| 428 | | drawgfx(tmpbitmap, Machine->gfx[0], code, colorram[i&0x3ff] + 16, |
| 429 | | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 430 | | drawgfx(dlybitmap, Machine->gfx[0], code, colorram[i&0x3ff] + 32, |
| 431 | | 0, 0, r.min_x, r.min_y, &r, TRANSPARENCY_NONE, 0); |
| 382 | crt.cursor_phase++; |
| 383 | crt.cursor_visible = (crt.cursor_phase >> 3) & 1; |
| 432 | 384 | } |
| 433 | | |
| 434 | | if( i == cursor ) |
| 435 | | { |
| 436 | | rectangle rc; |
| 437 | | |
| 438 | | /* check if cursor turned off */ |
| 439 | | if( (crt.cursor_top & 0x60) == 0x20 ) |
| 440 | | continue; |
| 441 | | dirtybuffer[i] = 1; |
| 442 | | if( (crt.cursor_top & 0x60) == 0x60 ) |
| 443 | | { |
| 444 | | crt.cursor_visible = 1; |
| 445 | | } |
| 446 | | else |
| 447 | | { |
| 448 | | crt.cursor_phase++; |
| 449 | | crt.cursor_visible = (crt.cursor_phase >> 3) & 1; |
| 450 | | } |
| 451 | | if( !crt.cursor_visible ) |
| 452 | | continue; |
| 453 | | rc.min_x = r.min_x; |
| 454 | | rc.max_x = r.max_x; |
| 455 | | rc.min_y = r.min_y + (crt.cursor_top & 15); |
| 456 | | rc.max_y = r.min_y + (crt.cursor_bottom & 15); |
| 457 | | drawgfx(tmpbitmap, Machine->gfx[0], 0x7f, colorram[i&0x3ff] + 16, |
| 458 | | 0, 0, rc.min_x, rc.min_y, &rc, TRANSPARENCY_NONE, 0); |
| 459 | | drawgfx(dlybitmap, Machine->gfx[0], 0x7f, colorram[i&0x3ff] + 32, |
| 460 | | 0, 0, rc.min_x, rc.min_y, &rc, TRANSPARENCY_NONE, 0); |
| 461 | | } |
| 385 | |
| 386 | if( !crt.cursor_visible ) |
| 387 | continue; |
| 388 | |
| 389 | rc.min_x = r.min_x; |
| 390 | rc.max_x = r.max_x; |
| 391 | rc.min_y = r.min_y + (crt.cursor_top & 15); |
| 392 | rc.max_y = r.min_y + (crt.cursor_bottom & 15); |
| 393 | |
| 394 | drawgfx(tmpbitmap, Machine->gfx[0], 0x7f, colorram[i&0x3ff] + 16, |
| 395 | 0, 0, rc.min_x, rc.min_y, &rc, TRANSPARENCY_NONE, 0); |
| 396 | drawgfx(dlybitmap, Machine->gfx[0], 0x7f, colorram[i&0x3ff] + 32, |
| 397 | 0, 0, rc.min_x, rc.min_y, &rc, TRANSPARENCY_NONE, 0); |
| 462 | 398 | } |
| 463 | 399 | } |
| 464 | 400 | } |
| 465 | | update_all = 0; |
| 466 | | copybitmap(bitmap, tmpbitmap, 0, 0, 0, 0, |
| 467 | | &Machine->screen[0].visarea, TRANSPARENCY_NONE, 0); |
| 468 | | copybitmap(bitmap, dlybitmap, 0, 0, 1, 0, |
| 469 | | &Machine->screen[0].visarea, TRANSPARENCY_COLOR, 0); |
| 401 | |
| 402 | copybitmap(bitmap, tmpbitmap, 0, 0, 0, 0, cliprect, TRANSPARENCY_NONE, 0); |
| 403 | copybitmap(bitmap, dlybitmap, 0, 0, 1, 0, cliprect, TRANSPARENCY_COLOR, 0); |
| 470 | 404 | } |
| 471 | 405 | |
| 472 | 406 | /*************************************************************************** |
| 473 | 407 | Draw the game screen in the given mame_bitmap. |
| 474 | | Do NOT call osd_update_display() from this function, |
| 475 | | it will be called by the main emulation engine. |
| 476 | 408 | ***************************************************************************/ |
| 477 | 409 | VIDEO_UPDATE( cgenie ) |
| 478 | 410 | { |
| 479 | | int full_refresh = 1; |
| 480 | 411 | if( cgenie_tv_mode ) |
| 481 | | cgenie_refresh_tv_set(bitmap,full_refresh); |
| 412 | cgenie_refresh_tv_set(machine, bitmap, cliprect); |
| 482 | 413 | else |
| 483 | | cgenie_refresh_monitor(bitmap,full_refresh); |
| 414 | cgenie_refresh_monitor(machine, bitmap, cliprect); |
| 484 | 415 | return 0; |
| 485 | 416 | } |
src/mess/drivers/ti99_2.c
| r1542 | r1543 | |
| 146 | 146 | memcpy(colortable, & ti99_2_colortable, sizeof(ti99_2_colortable)); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | | static VIDEO_START(ti99_2) |
| 150 | | { |
| 151 | | videoram_size = 768; |
| 152 | 149 | |
| 153 | | video_start_generic(machine); |
| 154 | | } |
| 155 | | |
| 156 | | #define ti99_2_video_w videoram_w |
| 157 | | |
| 158 | 150 | static VIDEO_UPDATE(ti99_2) |
| 159 | 151 | { |
| 160 | 152 | int i, sx, sy; |
| r1542 | r1543 | |
| 164 | 156 | |
| 165 | 157 | for (i = 0; i < 768; i++) |
| 166 | 158 | { |
| 167 | | if (dirtybuffer[i]) |
| 168 | | { |
| 169 | | dirtybuffer[i] = 0; |
| 159 | /* Is the char code masked or not ??? */ |
| 160 | drawgfx(bitmap, machine->gfx[0], videoram[i] & 0x7F, 0, |
| 161 | 0, 0, sx, sy, cliprect, TRANSPARENCY_NONE, 0); |
| 170 | 162 | |
| 171 | | /* Is the char code masked or not ??? */ |
| 172 | | drawgfx(tmpbitmap, machine->gfx[0], videoram[i] & 0x7F, 0, |
| 173 | | 0, 0, sx, sy, &machine->screen[0].visarea, TRANSPARENCY_NONE, 0); |
| 174 | | } |
| 175 | | |
| 176 | 163 | sx += 8; |
| 177 | 164 | if (sx == 256) |
| 178 | 165 | { |
| r1542 | r1543 | |
| 181 | 168 | } |
| 182 | 169 | } |
| 183 | 170 | |
| 184 | | copybitmap(bitmap, tmpbitmap, 0, 0, 0, 0, &machine->screen[0].visarea, TRANSPARENCY_NONE, 0); |
| 185 | 171 | return 0; |
| 186 | 172 | } |
| 187 | 173 | |
| r1542 | r1543 | |
| 207 | 193 | Memory map - see description above |
| 208 | 194 | */ |
| 209 | 195 | |
| 210 | | static ADDRESS_MAP_START(ti99_2_memmap, ADDRESS_SPACE_PROGRAM, 8) |
| 211 | | |
| 212 | | AM_RANGE(0x0000, 0x3fff) AM_READWRITE(MRA8_ROM, MWA8_ROM) /*system ROM*/ |
| 213 | | AM_RANGE(0x4000, 0x5fff) AM_READWRITE(MRA8_BANK1, MWA8_BANK1) /*system ROM, banked on 32kb ROMs protos*/ |
| 214 | | AM_RANGE(0x6000, 0xdfff) AM_READWRITE(MRA8_NOP, MWA8_NOP) /*free for expansion*/ |
| 215 | | AM_RANGE(0xe000, 0xebff) AM_READWRITE(MRA8_RAM, MWA8_RAM) /*system RAM*/ |
| 216 | | AM_RANGE(0xec00, 0xeeff) AM_READWRITE(MRA8_RAM, ti99_2_video_w) AM_BASE(& videoram) /*system RAM: used for video*/ |
| 217 | | AM_RANGE(0xef00, 0xefff) AM_READWRITE(MRA8_RAM, MWA8_RAM) /*system RAM*/ |
| 218 | | AM_RANGE(0xf000, 0xffff) AM_READWRITE(MRA8_NOP, MWA8_NOP) /*free for expansion (and internal processor RAM)*/ |
| 219 | | |
| 196 | static ADDRESS_MAP_START( ti99_2_memmap, ADDRESS_SPACE_PROGRAM, 8 ) |
| 197 | AM_RANGE(0x0000, 0x3fff) AM_ROM /* system ROM */ |
| 198 | AM_RANGE(0x4000, 0x5fff) AM_ROMBANK(1) /* system ROM, banked on 32kb ROMs protos */ |
| 199 | AM_RANGE(0x6000, 0xdfff) AM_NOP /* free for expansion */ |
| 200 | AM_RANGE(0xe000, 0xebff) AM_RAM /* system RAM */ |
| 201 | AM_RANGE(0xec00, 0xeeff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) |
| 202 | AM_RANGE(0xef00, 0xefff) AM_RAM /* system RAM */ |
| 203 | AM_RANGE(0xf000, 0xffff) AM_NOP /* free for expansion (and internal processor RAM) */ |
| 220 | 204 | ADDRESS_MAP_END |
| 221 | 205 | |
| 222 | 206 | |
| r1542 | r1543 | |
| 385 | 369 | }; |
| 386 | 370 | |
| 387 | 371 | static MACHINE_DRIVER_START(ti99_2) |
| 388 | | |
| 389 | 372 | /* basic machine hardware */ |
| 390 | | /* TMS9995 CPU @ 10.7 MHz */ |
| 391 | 373 | MDRV_CPU_ADD(TMS9995, 10700000) |
| 392 | 374 | MDRV_CPU_CONFIG(ti99_2_processor_config) |
| 393 | 375 | MDRV_CPU_PROGRAM_MAP(ti99_2_memmap, 0) |
| 394 | 376 | MDRV_CPU_IO_MAP(ti99_2_readcru, ti99_2_writecru) |
| 395 | 377 | MDRV_CPU_VBLANK_INT(ti99_2_vblank_interrupt, 1) |
| 396 | | /*MDRV_CPU_PERIODIC_INT(func, rate)*/ |
| 397 | 378 | |
| 398 | 379 | MDRV_SCREEN_REFRESH_RATE(60) |
| 399 | 380 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) |
| 400 | | /*MDRV_INTERLEAVE(interleave)*/ |
| 401 | 381 | |
| 402 | 382 | MDRV_MACHINE_RESET( ti99_2 ) |
| 403 | 383 | |
| r1542 | r1543 | |
| 412 | 392 | MDRV_COLORTABLE_LENGTH(TI99_2_COLORTABLE_SIZE) |
| 413 | 393 | MDRV_PALETTE_INIT(ti99_2) |
| 414 | 394 | |
| 415 | | MDRV_VIDEO_START(ti99_2) |
| 416 | 395 | MDRV_VIDEO_UPDATE(ti99_2) |
| 417 | | |
| 418 | | /* no sound! */ |
| 419 | | |
| 420 | 396 | MACHINE_DRIVER_END |
| 421 | 397 | |
| 422 | 398 | |