src/mess/video/wswan.c
| r2202 | r2203 | |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | | static void wswan_draw_background( running_machine *machine ) { |
| 69 | static void wswan_draw_background( void ) { |
| 70 | 70 | UINT16 map_addr; |
| 71 | 71 | UINT8 start_column; |
| 72 | 72 | int column; |
| r2202 | r2203 | |
| 136 | 136 | if ( vdp.colors_16 ) { |
| 137 | 137 | if ( col ) { |
| 138 | 138 | if ( vdp.color_mode ) { |
| 139 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 139 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 140 | 140 | } else { |
| 141 | 141 | /* Hmmmm, what should we do here... Is this correct?? */ |
| 142 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 142 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | } else { |
| 146 | 146 | if ( col || !(tile_palette & 4 ) ) { |
| 147 | 147 | if ( vdp.color_mode ) { |
| 148 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 148 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 149 | 149 | } else { |
| 150 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[vdp.main_palette[pal[tile_palette][col]]] ); |
| 150 | wswan_plot_pixel( x_offset, vdp.current_line, vdp.main_palette[pal[tile_palette][col]] ); |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | } |
| r2202 | r2203 | |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | | static void wswan_draw_foreground_0( running_machine *machine ) { |
| 159 | static void wswan_draw_foreground_0( void ) { |
| 160 | 160 | UINT16 map_addr; |
| 161 | 161 | UINT8 start_column; |
| 162 | 162 | int column; |
| r2202 | r2203 | |
| 223 | 223 | if ( vdp.colors_16 ) { |
| 224 | 224 | if ( col ) { |
| 225 | 225 | // if ( vdp.color_mode ) { |
| 226 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 226 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 227 | 227 | // } else { |
| 228 | 228 | // /* Hmmmm, what should we do here... Is this correct?? */ |
| 229 | | // wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 229 | // wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 230 | 230 | // } |
| 231 | 231 | } |
| 232 | 232 | } else { |
| 233 | 233 | if ( col || !(tile_palette & 4 ) ) { |
| 234 | 234 | if ( vdp.color_mode ) { |
| 235 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 235 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 236 | 236 | } else { |
| 237 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[vdp.main_palette[pal[tile_palette][col]]] ); |
| 237 | wswan_plot_pixel( x_offset, vdp.current_line, vdp.main_palette[pal[tile_palette][col]] ); |
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | } |
| r2202 | r2203 | |
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | | static void wswan_draw_foreground_2( running_machine *machine ) { |
| 246 | static void wswan_draw_foreground_2( void ) { |
| 247 | 247 | UINT16 map_addr; |
| 248 | 248 | UINT8 start_column; |
| 249 | 249 | int column; |
| r2202 | r2203 | |
| 310 | 310 | if ( vdp.colors_16 ) { |
| 311 | 311 | if ( col ) { |
| 312 | 312 | if ( vdp.color_mode ) { |
| 313 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 313 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 314 | 314 | } else { |
| 315 | 315 | /* Hmmmm, what should we do here... Is this correct?? */ |
| 316 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 316 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | } else { |
| 320 | 320 | if ( col || !(tile_palette & 4 ) ) { |
| 321 | 321 | if ( vdp.color_mode ) { |
| 322 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 322 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 323 | 323 | } else { |
| 324 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[vdp.main_palette[pal[tile_palette][col]]] ); |
| 324 | wswan_plot_pixel( x_offset, vdp.current_line, vdp.main_palette[pal[tile_palette][col]] ); |
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | } |
| r2202 | r2203 | |
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | | static void wswan_draw_foreground_3( running_machine *machine ) { |
| 333 | static void wswan_draw_foreground_3( void ) { |
| 334 | 334 | UINT16 map_addr; |
| 335 | 335 | UINT8 start_column; |
| 336 | 336 | int column; |
| r2202 | r2203 | |
| 397 | 397 | if ( vdp.colors_16 ) { |
| 398 | 398 | if ( col ) { |
| 399 | 399 | if ( vdp.color_mode ) { |
| 400 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 400 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 401 | 401 | } else { |
| 402 | 402 | /* Hmmmm, what should we do here... Is this correct?? */ |
| 403 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 403 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | } else { |
| 407 | 407 | if ( col || !(tile_palette & 4 ) ) { |
| 408 | 408 | if ( vdp.color_mode ) { |
| 409 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 409 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 410 | 410 | } else { |
| 411 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[vdp.main_palette[pal[tile_palette][col]]] ); |
| 411 | wswan_plot_pixel( x_offset, vdp.current_line, vdp.main_palette[pal[tile_palette][col]] ); |
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | } |
| r2202 | r2203 | |
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | | static void wswan_handle_sprites( running_machine *machine, int mask ) { |
| 420 | static void wswan_handle_sprites( int mask ) { |
| 421 | 421 | int i; |
| 422 | 422 | if ( vdp.sprite_count == 0 ) |
| 423 | 423 | return; |
| r2202 | r2203 | |
| 514 | 514 | if ( vdp.colors_16 ) { |
| 515 | 515 | if ( col ) { |
| 516 | 516 | if ( vdp.color_mode ) { |
| 517 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 517 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 518 | 518 | } else { |
| 519 | 519 | /* Hmmmm, what should we do here... Is this correct?? */ |
| 520 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 520 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | 523 | } else { |
| 524 | 524 | if ( col || !(tile_palette & 4 ) ) { |
| 525 | 525 | if ( vdp.color_mode ) { |
| 526 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[pal[tile_palette][col]] ); |
| 526 | wswan_plot_pixel( x_offset, vdp.current_line, pal[tile_palette][col] ); |
| 527 | 527 | } else { |
| 528 | | wswan_plot_pixel( x_offset, vdp.current_line, machine->pens[vdp.main_palette[pal[tile_palette][col]]] ); |
| 528 | wswan_plot_pixel( x_offset, vdp.current_line, vdp.main_palette[pal[tile_palette][col]] ); |
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | 531 | } |
| r2202 | r2203 | |
| 535 | 535 | } |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | | void wswan_refresh_scanline( running_machine *machine ) |
| 538 | void wswan_refresh_scanline( void ) |
| 539 | 539 | { |
| 540 | 540 | rectangle rec; |
| 541 | 541 | |
| r2202 | r2203 | |
| 547 | 547 | if ( ws_portram[0x14] ) { |
| 548 | 548 | /* Not sure if these background color checks and settings are correct */ |
| 549 | 549 | if ( vdp.color_mode && vdp.colors_16 ) { |
| 550 | | wswan_fillbitmap( machine->pens[ pal[ws_portram[0x01]>>4][ws_portram[0x01]&0x0F] ], &rec ); |
| 550 | wswan_fillbitmap( pal[ws_portram[0x01]>>4][ws_portram[0x01]&0x0F], &rec ); |
| 551 | 551 | } else { |
| 552 | | wswan_fillbitmap( machine->pens[ vdp.main_palette[ws_portram[0x01]&0x07] ], &rec ); |
| 552 | wswan_fillbitmap( vdp.main_palette[ws_portram[0x01]&0x07], &rec ); |
| 553 | 553 | } |
| 554 | 554 | } else { |
| 555 | | wswan_fillbitmap( machine->pens[ 0 ], &rec ); |
| 555 | wswan_fillbitmap( 0, &rec ); |
| 556 | 556 | return; |
| 557 | 557 | } |
| 558 | 558 | |
| r2202 | r2203 | |
| 560 | 560 | * Draw background layer |
| 561 | 561 | */ |
| 562 | 562 | if ( vdp.layer_bg_enable ) { |
| 563 | | wswan_draw_background( machine ); |
| 563 | wswan_draw_background(); |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | /* |
| 567 | 567 | * Draw sprites between background and foreground layers |
| 568 | 568 | */ |
| 569 | 569 | if ( vdp.sprites_enable ) { |
| 570 | | wswan_handle_sprites( machine, 0 ); |
| 570 | wswan_handle_sprites( 0 ); |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | /* |
| r2202 | r2203 | |
| 576 | 576 | if ( vdp.layer_fg_enable ) { |
| 577 | 577 | switch( vdp.window_fg_mode ) { |
| 578 | 578 | case 0: /* FG inside & outside window area */ |
| 579 | | wswan_draw_foreground_0( machine ); |
| 579 | wswan_draw_foreground_0(); |
| 580 | 580 | break; |
| 581 | 581 | case 1: /* ??? */ |
| 582 | 582 | logerror( "Unknown foreground mode 1 set\n" ); |
| 583 | 583 | break; |
| 584 | 584 | case 2: /* FG only inside window area */ |
| 585 | 585 | if ( vdp.current_line >= vdp.window_fg_top && vdp.current_line <= vdp.window_fg_bottom ) { |
| 586 | | wswan_draw_foreground_2( machine ); |
| 586 | wswan_draw_foreground_2(); |
| 587 | 587 | } |
| 588 | 588 | break; |
| 589 | 589 | case 3: /* FG only outside window area */ |
| 590 | 590 | if ( vdp.current_line < vdp.window_fg_top || vdp.current_line > vdp.window_fg_bottom ) { |
| 591 | | wswan_draw_foreground_0( machine ); |
| 591 | wswan_draw_foreground_0(); |
| 592 | 592 | } else { |
| 593 | | wswan_draw_foreground_3( machine ); |
| 593 | wswan_draw_foreground_3(); |
| 594 | 594 | } |
| 595 | 595 | break; |
| 596 | 596 | } |
| r2202 | r2203 | |
| 600 | 600 | * Draw sprites in front of foreground layer |
| 601 | 601 | */ |
| 602 | 602 | if ( vdp.sprites_enable ) { |
| 603 | | wswan_handle_sprites( machine, 0x2000 ); |
| 603 | wswan_handle_sprites( 0x2000 ); |
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | 606 | |
src/mess/video/vic6560.c
| r2202 | r2203 | |
| 92 | 92 | |
| 93 | 93 | static bitmap_t *vic6560_bitmap; |
| 94 | 94 | static int rasterline = 0, lastline = 0; |
| 95 | | static void vic6560_drawlines (running_machine *machine, int start, int last); |
| 95 | static void vic6560_drawlines (int start, int last); |
| 96 | 96 | |
| 97 | 97 | static int (*vic_dma_read) (int); |
| 98 | 98 | static int (*vic_dma_read_color) (int); |
| r2202 | r2203 | |
| 166 | 166 | int width = video_screen_get_width(screen); |
| 167 | 167 | int height = video_screen_get_height(screen); |
| 168 | 168 | |
| 169 | | black = machine->pens[0]; |
| 170 | | white = machine->pens[1]; |
| 169 | black = 0; |
| 170 | white = 1; |
| 171 | 171 | pointerelement = allocgfx(&pointerlayout); |
| 172 | 172 | decodegfx(pointerelement, pointermask, 0, 1); |
| 173 | 173 | /* 7-Sep-2007 - After 0.118u5, you cannot revector the color table */ |
| 174 | 174 | /* pointerelement->colortable = pointercolortable; */ |
| 175 | | pointercolortable[1] = machine->pens[1]; |
| 176 | | pointercolortable[2] = machine->pens[0]; |
| 175 | pointercolortable[1] = 1; |
| 176 | pointercolortable[2] = 0; |
| 177 | 177 | pointerelement->total_colors = 3; |
| 178 | 178 | vic6560_bitmap = auto_bitmap_alloc(width, height, BITMAP_FORMAT_INDEXED16); |
| 179 | 179 | add_exit_callback(machine, vic6560_video_stop); |
| r2202 | r2203 | |
| 203 | 203 | case 5: |
| 204 | 204 | case 0xe: |
| 205 | 205 | case 0xf: |
| 206 | | vic6560_drawlines (machine, lastline, rasterline); |
| 206 | vic6560_drawlines (lastline, rasterline); |
| 207 | 207 | break; |
| 208 | 208 | } |
| 209 | 209 | vic6560[offset] = data; |
| r2202 | r2203 | |
| 233 | 233 | videoaddr = VIDEOADDR; |
| 234 | 234 | break; |
| 235 | 235 | case 0xe: |
| 236 | | multi[3] = multiinverted[3] = helpercolor = machine->pens[HELPERCOLOR]; |
| 236 | multi[3] = multiinverted[3] = helpercolor = HELPERCOLOR; |
| 237 | 237 | break; |
| 238 | 238 | case 0xf: |
| 239 | 239 | inverted = INVERTED; |
| 240 | | multi[1] = multiinverted[1] = framecolor = machine->pens[FRAMECOLOR]; |
| 240 | multi[1] = multiinverted[1] = framecolor = FRAMECOLOR; |
| 241 | 241 | mono[0] = monoinverted[1] = |
| 242 | | multi[0] = multiinverted[2] = backgroundcolor = machine->pens[BACKGROUNDCOLOR]; |
| 242 | multi[0] = multiinverted[2] = backgroundcolor = BACKGROUNDCOLOR; |
| 243 | 243 | break; |
| 244 | 244 | } |
| 245 | 245 | } |
| r2202 | r2203 | |
| 256 | 256 | val = ((rasterline & 1) << 7) | (vic6560[offset] & 0x7f); |
| 257 | 257 | break; |
| 258 | 258 | case 4: /*rasterline */ |
| 259 | | vic6560_drawlines (machine, lastline, rasterline); |
| 259 | vic6560_drawlines (lastline, rasterline); |
| 260 | 260 | val = (rasterline / 2) & 0xff; |
| 261 | 261 | break; |
| 262 | 262 | case 6: /*lightpen horicontal */ |
| r2202 | r2203 | |
| 375 | 375 | } |
| 376 | 376 | #endif |
| 377 | 377 | |
| 378 | | static void vic6560_drawlines (running_machine *machine, int first, int last) |
| 378 | static void vic6560_drawlines (int first, int last) |
| 379 | 379 | { |
| 380 | 380 | int line, vline; |
| 381 | 381 | int offs, yoff, xoff, ybegin, yend, i; |
| r2202 | r2203 | |
| 420 | 420 | { |
| 421 | 421 | if (attr & 8) |
| 422 | 422 | { |
| 423 | | multiinverted[0] = machine->pens[attr & 7]; |
| 423 | multiinverted[0] = attr & 7; |
| 424 | 424 | vic6560_draw_character_multi (ybegin, yend, ch, yoff, xoff, |
| 425 | 425 | multiinverted); |
| 426 | 426 | } |
| 427 | 427 | else |
| 428 | 428 | { |
| 429 | | monoinverted[0] = machine->pens[attr]; |
| 429 | monoinverted[0] = attr; |
| 430 | 430 | vic6560_draw_character (ybegin, yend, ch, yoff, xoff, monoinverted); |
| 431 | 431 | } |
| 432 | 432 | } |
| r2202 | r2203 | |
| 434 | 434 | { |
| 435 | 435 | if (attr & 8) |
| 436 | 436 | { |
| 437 | | multi[2] = machine->pens[attr & 7]; |
| 437 | multi[2] = attr & 7; |
| 438 | 438 | vic6560_draw_character_multi (ybegin, yend, ch, yoff, xoff, multi); |
| 439 | 439 | } |
| 440 | 440 | else |
| 441 | 441 | { |
| 442 | | mono[1] = machine->pens[attr]; |
| 442 | mono[1] = attr; |
| 443 | 443 | vic6560_draw_character (ybegin, yend, ch, yoff, xoff, mono); |
| 444 | 444 | } |
| 445 | 445 | } |
| r2202 | r2203 | |
| 478 | 478 | if (rasterline >= vic656x_lines) |
| 479 | 479 | { |
| 480 | 480 | rasterline = 0; |
| 481 | | vic6560_drawlines (machine, lastline, vic656x_lines); |
| 481 | vic6560_drawlines (lastline, vic656x_lines); |
| 482 | 482 | lastline = 0; |
| 483 | 483 | |
| 484 | 484 | if (LIGHTPEN_POINTER) |
src/mess/video/vic4567.c
| r2202 | r2203 | |
| 169 | 169 | return val; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | | static void vic3_drawlines (running_machine *machine, int first, int last) |
| 172 | static void vic3_drawlines (int first, int last) |
| 173 | 173 | { |
| 174 | 174 | int line, vline, end; |
| 175 | 175 | int attr, ch, ecm; |
| r2202 | r2203 | |
| 199 | 199 | if (!SCREENON) |
| 200 | 200 | { |
| 201 | 201 | for (line = first; (line < last) && (line < vic2.bitmap->height); line++) |
| 202 | | memset16 (BITMAP_ADDR16(vic2.bitmap, line, 0), machine->pens[0], vic2.bitmap->width); |
| 202 | memset16 (BITMAP_ADDR16(vic2.bitmap, line, 0), 0, vic2.bitmap->width); |
| 203 | 203 | return; |
| 204 | 204 | } |
| 205 | 205 | if (COLUMNS40) |
| r2202 | r2203 | |
| 214 | 214 | |
| 215 | 215 | for (line = first; line < end; line++) |
| 216 | 216 | { |
| 217 | | memset16 (BITMAP_ADDR16(vic2.bitmap, line, 0), machine->pens[FRAMECOLOR], |
| 217 | memset16 (BITMAP_ADDR16(vic2.bitmap, line, 0), FRAMECOLOR, |
| 218 | 218 | vic2.bitmap->width); |
| 219 | 219 | } |
| 220 | 220 | |
| r2202 | r2203 | |
| 247 | 247 | attr = vic2.dma_read_color (vic2.videoaddr + offs); |
| 248 | 248 | if (HIRESON) |
| 249 | 249 | { |
| 250 | | vic2.bitmapmulti[1] = vic2.c64_bitmap[1] = machine->pens[ch >> 4]; |
| 251 | | vic2.bitmapmulti[2] = vic2.c64_bitmap[0] = machine->pens[ch & 0xf]; |
| 250 | vic2.bitmapmulti[1] = vic2.c64_bitmap[1] = ch >> 4; |
| 251 | vic2.bitmapmulti[2] = vic2.c64_bitmap[0] = ch & 0xf; |
| 252 | 252 | if (MULTICOLORON) |
| 253 | 253 | { |
| 254 | | vic2.bitmapmulti[3] = machine->pens[attr]; |
| 254 | vic2.bitmapmulti[3] = attr; |
| 255 | 255 | vic2_draw_bitmap_multi (ybegin, yend, offs, yoff, xoff); |
| 256 | 256 | } |
| 257 | 257 | else |
| r2202 | r2203 | |
| 263 | 263 | { |
| 264 | 264 | ecm = ch >> 6; |
| 265 | 265 | vic2.ecmcolor[0] = vic2.colors[ecm]; |
| 266 | | vic2.ecmcolor[1] = machine->pens[attr]; |
| 266 | vic2.ecmcolor[1] = attr; |
| 267 | 267 | vic2_draw_character (ybegin, yend, ch & ~0xC0, yoff, xoff, vic2.ecmcolor); |
| 268 | 268 | } |
| 269 | 269 | else if (MULTICOLORON && (attr & 8)) |
| 270 | 270 | { |
| 271 | | vic2.multi[3] = machine->pens[attr & 7]; |
| 271 | vic2.multi[3] = attr & 7; |
| 272 | 272 | vic2_draw_character_multi (ybegin, yend, ch, yoff, xoff); |
| 273 | 273 | } |
| 274 | 274 | else |
| 275 | 275 | { |
| 276 | | vic2.mono[1] = machine->pens[attr]; |
| 276 | vic2.mono[1] = attr; |
| 277 | 277 | vic2_draw_character (ybegin, yend, ch, yoff, xoff, vic2.mono); |
| 278 | 278 | } |
| 279 | 279 | } |
| r2202 | r2203 | |
| 296 | 296 | if (yoff + syend > YPOS + 200) |
| 297 | 297 | syend = YPOS + 200 - yoff - 1; |
| 298 | 298 | if (SPRITE_MULTICOLOR (i)) |
| 299 | | vic2_draw_sprite_multi (machine, i, yoff, ybegin, syend); |
| 299 | vic2_draw_sprite_multi (i, yoff, ybegin, syend); |
| 300 | 300 | else |
| 301 | | vic2_draw_sprite (machine, i, yoff, ybegin, syend); |
| 301 | vic2_draw_sprite (i, yoff, ybegin, syend); |
| 302 | 302 | if ((syend != yend) || (vic2.sprites[i].line > 20)) |
| 303 | 303 | { |
| 304 | 304 | vic2.sprites[i].line = vic2.sprites[i].repeat = 0; |
| r2202 | r2203 | |
| 325 | 325 | for (j = 0; j < SPRITE_Y_POS (i) - yoff; j++) |
| 326 | 326 | vic2.sprites[i].paintedline[j] = 0; |
| 327 | 327 | if (SPRITE_MULTICOLOR (i)) |
| 328 | | vic2_draw_sprite_multi (machine, i, yoff, SPRITE_Y_POS (i) - yoff, syend); |
| 328 | vic2_draw_sprite_multi (i, yoff, SPRITE_Y_POS (i) - yoff, syend); |
| 329 | 329 | else |
| 330 | | vic2_draw_sprite (machine, i, yoff, SPRITE_Y_POS (i) - yoff, syend); |
| 330 | vic2_draw_sprite (i, yoff, SPRITE_Y_POS (i) - yoff, syend); |
| 331 | 331 | if ((syend != yend) || (vic2.sprites[i].line > 20)) |
| 332 | 332 | { |
| 333 | 333 | for (j = syend; j <= yend; j++) |
| r2202 | r2203 | |
| 344 | 344 | for (i = ybegin; i <= yend; i++) |
| 345 | 345 | { |
| 346 | 346 | memset16 (BITMAP_ADDR16(vic2.bitmap, yoff + 1, 0), |
| 347 | | machine->pens[FRAMECOLOR], xbegin); |
| 347 | FRAMECOLOR, xbegin); |
| 348 | 348 | memset16 (BITMAP_ADDR16(vic2.bitmap, yoff + 1, xend), |
| 349 | | machine->pens[FRAMECOLOR], vic2.bitmap->width - xend); |
| 349 | FRAMECOLOR, vic2.bitmap->width - xend); |
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | if (last < vic2.bitmap->height) |
| r2202 | r2203 | |
| 356 | 356 | |
| 357 | 357 | for (; line < end; line++) |
| 358 | 358 | { |
| 359 | | memset16 (BITMAP_ADDR16(vic2.bitmap, line, 0), machine->pens[FRAMECOLOR], |
| 359 | memset16 (BITMAP_ADDR16(vic2.bitmap, line, 0), FRAMECOLOR, |
| 360 | 360 | vic2.bitmap->width); |
| 361 | 361 | } |
| 362 | 362 | } |
| r2202 | r2203 | |
| 437 | 437 | INLINE void vic3_draw_block(int x, int y, UINT8 colors[8]) |
| 438 | 438 | { |
| 439 | 439 | vic2.bitmap->line[YPOS+y][XPOS+x]= |
| 440 | | machine->pens[vic3_bitplane_to_packed(colors, vic2.reg[0x32], 7)]; |
| 440 | vic3_bitplane_to_packed(colors, vic2.reg[0x32], 7); |
| 441 | 441 | vic2.bitmap->line[YPOS+y][XPOS+x+1]= |
| 442 | | machine->pens[vic3_bitplane_to_packed(colors, vic2.reg[0x32], 6)]; |
| 442 | vic3_bitplane_to_packed(colors, vic2.reg[0x32], 6); |
| 443 | 443 | vic2.bitmap->line[YPOS+y][XPOS+x+2]= |
| 444 | | machine->pens[vic3_bitplane_to_packed(colors, vic2.reg[0x32], 5)]; |
| 444 | vic3_bitplane_to_packed(colors, vic2.reg[0x32], 5); |
| 445 | 445 | vic2.bitmap->line[YPOS+y][XPOS+x+3]= |
| 446 | | machine->pens[vic3_bitplane_to_packed(colors, vic2.reg[0x32], 4)]; |
| 446 | vic3_bitplane_to_packed(colors, vic2.reg[0x32], 4); |
| 447 | 447 | vic2.bitmap->line[YPOS+y][XPOS+x+4]= |
| 448 | | machine->pens[vic3_bitplane_to_packed(colors, vic2.reg[0x32], 3)]; |
| 448 | vic3_bitplane_to_packed(colors, vic2.reg[0x32], 3); |
| 449 | 449 | vic2.bitmap->line[YPOS+y][XPOS+x+5]= |
| 450 | | machine->pens[vic3_bitplane_to_packed(colors, vic2.reg[0x32], 2)]; |
| 450 | vic3_bitplane_to_packed(colors, vic2.reg[0x32], 2); |
| 451 | 451 | vic2.bitmap->line[YPOS+y][XPOS+x+6]= |
| 452 | | machine->pens[vic3_bitplane_to_packed(colors, vic2.reg[0x32], 1)]; |
| 452 | vic3_bitplane_to_packed(colors, vic2.reg[0x32], 1); |
| 453 | 453 | vic2.bitmap->line[YPOS+y][XPOS+x+7]= |
| 454 | | machine->pens[vic3_bitplane_to_packed(colors, vic2.reg[0x32], 0)]; |
| 454 | vic3_bitplane_to_packed(colors, vic2.reg[0x32], 0); |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | #else |
| r2202 | r2203 | |
| 518 | 518 | p |= colors[7] & 0x80; \ |
| 519 | 519 | colors[7] >>= 1; \ |
| 520 | 520 | } \ |
| 521 | | *BITMAP_ADDR16(vic2.bitmap, YPOS+y, XPOS+x+i) = machine->pens[p]; \ |
| 521 | *BITMAP_ADDR16(vic2.bitmap, YPOS+y, XPOS+x+i) = p; \ |
| 522 | 522 | } \ |
| 523 | 523 | } |
| 524 | 524 | |
| r2202 | r2203 | |
| 574 | 574 | } |
| 575 | 575 | for (i=7;i>=0;i--) { |
| 576 | 576 | *BITMAP_ADDR16(vic2.bitmap, YPOS+y, XPOS+x+i) = |
| 577 | | machine->pens[(colors[0]&1)|(colors[1]&2) |
| 577 | (colors[0]&1)|(colors[1]&2) |
| 578 | 578 | |(colors[2]&4)|(colors[3]&8) |
| 579 | 579 | |(colors[4]&0x10)|(colors[5]&0x20) |
| 580 | | |(colors[6]&0x40)|(colors[7]&0x80)]; |
| 580 | |(colors[6]&0x40)|(colors[7]&0x80); |
| 581 | 581 | colors[0]>>=1; |
| 582 | 582 | colors[1]>>=1; |
| 583 | 583 | colors[2]>>=1; |
| r2202 | r2203 | |
| 643 | 643 | } |
| 644 | 644 | for (i=7;i>=0;i--) { |
| 645 | 645 | *BITMAP_ADDR16(vic2.bitmap, YPOS+y, XPOS+x+i) = |
| 646 | | machine->pens[(colors[0]&1)|(colors[1]&2) |
| 646 | (colors[0]&1)|(colors[1]&2) |
| 647 | 647 | |(colors[2]&4)|(colors[3]&8) |
| 648 | 648 | |(colors[4]&0x10)|(colors[5]&0x20) |
| 649 | | |(colors[6]&0x40)|(colors[7]&0x80)]; |
| 649 | |(colors[6]&0x40)|(colors[7]&0x80); |
| 650 | 650 | colors[0]>>=1; |
| 651 | 651 | colors[1]>>=1; |
| 652 | 652 | colors[2]>>=1; |
| r2202 | r2203 | |
| 712 | 712 | vis.max_x = XPOS-1; |
| 713 | 713 | vis.min_y = 0; |
| 714 | 714 | vis.max_y = visarea->max_y; |
| 715 | | fillbitmap(vic2.bitmap, machine->pens[FRAMECOLOR],&vis); |
| 715 | fillbitmap(vic2.bitmap, FRAMECOLOR,&vis); |
| 716 | 716 | } |
| 717 | 717 | if (XPOS+VIC3_BITPLANES_WIDTH<visarea->max_x) { |
| 718 | 718 | vis.min_x = XPOS+VIC3_BITPLANES_WIDTH; |
| 719 | 719 | vis.max_x = visarea->max_x; |
| 720 | 720 | vis.min_y = 0; |
| 721 | 721 | vis.max_y = visarea->max_y; |
| 722 | | fillbitmap(vic2.bitmap, machine->pens[FRAMECOLOR],&vis); |
| 722 | fillbitmap(vic2.bitmap, FRAMECOLOR,&vis); |
| 723 | 723 | } |
| 724 | 724 | if (YPOS>0) |
| 725 | 725 | { |
| r2202 | r2203 | |
| 727 | 727 | vis.max_y = YPOS-1; |
| 728 | 728 | vis.min_x = 0; |
| 729 | 729 | vis.max_x = visarea->max_x; |
| 730 | | fillbitmap(vic2.bitmap, machine->pens[FRAMECOLOR],&vis); |
| 730 | fillbitmap(vic2.bitmap, FRAMECOLOR,&vis); |
| 731 | 731 | } |
| 732 | 732 | if (YPOS+VIC3_LINES<visarea->max_y) { |
| 733 | 733 | vis.min_y = YPOS+VIC3_LINES; |
| 734 | 734 | vis.max_y = visarea->max_y; |
| 735 | 735 | vis.min_x = 0; |
| 736 | 736 | vis.max_x = visarea->max_x; |
| 737 | | fillbitmap(vic2.bitmap, machine->pens[FRAMECOLOR],&vis); |
| 737 | fillbitmap(vic2.bitmap, FRAMECOLOR,&vis); |
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | |
| r2202 | r2203 | |
| 756 | 756 | } |
| 757 | 757 | } |
| 758 | 758 | if (vic3.palette_dirty) { |
| 759 | | vic2.spritemulti[1] = machine->pens[SPRITE_MULTICOLOR1]; |
| 760 | | vic2.spritemulti[3] = machine->pens[SPRITE_MULTICOLOR2]; |
| 759 | vic2.spritemulti[1] = SPRITE_MULTICOLOR1; |
| 760 | vic2.spritemulti[3] = SPRITE_MULTICOLOR2; |
| 761 | 761 | vic2.mono[0] = vic2.bitmapmulti[0] = vic2.multi[0] = |
| 762 | | vic2.colors[0] = machine->pens[BACKGROUNDCOLOR]; |
| 763 | | vic2.multi[1] = vic2.colors[1] = machine->pens[MULTICOLOR1]; |
| 764 | | vic2.multi[2] = vic2.colors[2] = machine->pens[MULTICOLOR2]; |
| 765 | | vic2.colors[3] = machine->pens[FOREGROUNDCOLOR]; |
| 762 | vic2.colors[0] = BACKGROUNDCOLOR; |
| 763 | vic2.multi[1] = vic2.colors[1] = MULTICOLOR1; |
| 764 | vic2.multi[2] = vic2.colors[2] = MULTICOLOR2; |
| 765 | vic2.colors[3] = FOREGROUNDCOLOR; |
| 766 | 766 | vic3.palette_dirty=0; |
| 767 | 767 | } |
| 768 | 768 | new_raws=200; |
| r2202 | r2203 | |
| 783 | 783 | if (VIC3_BITPLANES) { |
| 784 | 784 | if (!video_skip_this_frame ()) vic3_draw_bitplanes(machine); |
| 785 | 785 | } else { |
| 786 | | if (vic2.on) vic2_drawlines (machine, vic2.lastline, vic2.lines); |
| 786 | if (vic2.on) vic2_drawlines (vic2.lastline, vic2.lines); |
| 787 | 787 | } |
| 788 | 788 | for (i = 0; i < 8; i++) |
| 789 | 789 | vic2.sprites[i].repeat = vic2.sprites[i].line = 0; |
| r2202 | r2203 | |
| 798 | 798 | if (vic2.rasterline == C64_2_RASTERLINE (RASTERLINE)) |
| 799 | 799 | { |
| 800 | 800 | if (vic2.on) |
| 801 | | vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 801 | vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 802 | 802 | vic2_set_interrupt (1); |
| 803 | 803 | } |
| 804 | 804 | } |
src/mess/video/vic6567.c
| r2202 | r2203 | |
| 233 | 233 | } |
| 234 | 234 | #endif |
| 235 | 235 | |
| 236 | | static void vic2_drawlines (running_machine *machine, int first, int last); |
| 236 | static void vic2_drawlines (int first, int last); |
| 237 | 237 | |
| 238 | 238 | void vic6567_init (int chip_vic2e, int pal, |
| 239 | 239 | int (*dma_read) (int), int (*dma_read_color) (int), |
| r2202 | r2203 | |
| 347 | 347 | /* sprite y positions */ |
| 348 | 348 | if (vic2.reg[offset] != data) { |
| 349 | 349 | if (vic2.on) |
| 350 | | vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 350 | vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 351 | 351 | vic2.reg[offset] = data; |
| 352 | 352 | vic2.sprites[offset/2].y=SPRITE_Y_POS(offset/2); |
| 353 | 353 | } |
| r2202 | r2203 | |
| 363 | 363 | /* sprite x positions */ |
| 364 | 364 | if (vic2.reg[offset] != data) { |
| 365 | 365 | if (vic2.on) |
| 366 | | vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 366 | vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 367 | 367 | vic2.reg[offset] = data; |
| 368 | 368 | vic2.sprites[offset/2].x=SPRITE_X_POS(offset/2); |
| 369 | 369 | } |
| r2202 | r2203 | |
| 372 | 372 | /* sprite x positions */ |
| 373 | 373 | if (vic2.reg[offset] != data) { |
| 374 | 374 | if (vic2.on) |
| 375 | | vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 375 | vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 376 | 376 | vic2.reg[offset] = data; |
| 377 | 377 | vic2.sprites[0].x=SPRITE_X_POS(0); |
| 378 | 378 | vic2.sprites[1].x=SPRITE_X_POS(1); |
| r2202 | r2203 | |
| 400 | 400 | { |
| 401 | 401 | vic2.reg[offset] = data; |
| 402 | 402 | if (vic2.on) |
| 403 | | vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 403 | vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 404 | 404 | } |
| 405 | 405 | break; |
| 406 | 406 | case 0x25: |
| 407 | 407 | if (vic2.reg[offset] != data) |
| 408 | 408 | { |
| 409 | 409 | vic2.reg[offset] = data; |
| 410 | | vic2.spritemulti[1] = machine->pens[SPRITE_MULTICOLOR1]; |
| 410 | vic2.spritemulti[1] = SPRITE_MULTICOLOR1; |
| 411 | 411 | if (vic2.on) |
| 412 | | vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 412 | vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 413 | 413 | } |
| 414 | 414 | break; |
| 415 | 415 | case 0x26: |
| 416 | 416 | if (vic2.reg[offset] != data) |
| 417 | 417 | { |
| 418 | 418 | vic2.reg[offset] = data; |
| 419 | | vic2.spritemulti[3] = machine->pens[SPRITE_MULTICOLOR2]; |
| 420 | | if (vic2.on) vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 419 | vic2.spritemulti[3] = SPRITE_MULTICOLOR2; |
| 420 | if (vic2.on) vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 421 | 421 | } |
| 422 | 422 | break; |
| 423 | 423 | case 0x19: |
| r2202 | r2203 | |
| 431 | 431 | if (vic2.reg[offset] != data) |
| 432 | 432 | { |
| 433 | 433 | if (vic2.on) |
| 434 | | vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 434 | vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 435 | 435 | vic2.reg[offset] = data; |
| 436 | 436 | if (LINES25) |
| 437 | 437 | { |
| r2202 | r2203 | |
| 455 | 455 | if (vic2.reg[offset] != data) |
| 456 | 456 | { |
| 457 | 457 | if (vic2.on) |
| 458 | | vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 458 | vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 459 | 459 | vic2.reg[offset] = data; |
| 460 | 460 | if (COLUMNS40) |
| 461 | 461 | { |
| r2202 | r2203 | |
| 472 | 472 | case 0x18: |
| 473 | 473 | if (vic2.reg[offset] != data) |
| 474 | 474 | { |
| 475 | | if (vic2.on) vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 475 | if (vic2.on) vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 476 | 476 | vic2.reg[offset] = data; |
| 477 | 477 | vic2.videoaddr = VIDEOADDR; |
| 478 | 478 | vic2.chargenaddr = CHARGENADDR; |
| r2202 | r2203 | |
| 481 | 481 | case 0x21: /* backgroundcolor */ |
| 482 | 482 | if (vic2.reg[offset] != data) |
| 483 | 483 | { |
| 484 | | if (vic2.on) vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 484 | if (vic2.on) vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 485 | 485 | vic2.reg[offset] = data; |
| 486 | 486 | vic2.mono[0] = vic2.bitmapmulti[0] = vic2.multi[0] = |
| 487 | | vic2.colors[0] = machine->pens[BACKGROUNDCOLOR]; |
| 487 | vic2.colors[0] = BACKGROUNDCOLOR; |
| 488 | 488 | } |
| 489 | 489 | break; |
| 490 | 490 | case 0x22: /* background color 1 */ |
| 491 | 491 | if (vic2.reg[offset] != data) |
| 492 | 492 | { |
| 493 | | if (vic2.on) vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 493 | if (vic2.on) vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 494 | 494 | vic2.reg[offset] = data; |
| 495 | | vic2.multi[1] = vic2.colors[1] = machine->pens[MULTICOLOR1]; |
| 495 | vic2.multi[1] = vic2.colors[1] = MULTICOLOR1; |
| 496 | 496 | } |
| 497 | 497 | break; |
| 498 | 498 | case 0x23: /* background color 2 */ |
| 499 | 499 | if (vic2.reg[offset] != data) |
| 500 | 500 | { |
| 501 | 501 | if (vic2.on) |
| 502 | | vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 502 | vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 503 | 503 | vic2.reg[offset] = data; |
| 504 | | vic2.multi[2] = vic2.colors[2] = machine->pens[MULTICOLOR2]; |
| 504 | vic2.multi[2] = vic2.colors[2] = MULTICOLOR2; |
| 505 | 505 | } |
| 506 | 506 | break; |
| 507 | 507 | case 0x24: /* background color 3 */ |
| 508 | 508 | if (vic2.reg[offset] != data) |
| 509 | 509 | { |
| 510 | | if (vic2.on) vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 510 | if (vic2.on) vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 511 | 511 | vic2.reg[offset] = data; |
| 512 | | vic2.colors[3] = machine->pens[FOREGROUNDCOLOR]; |
| 512 | vic2.colors[3] = FOREGROUNDCOLOR; |
| 513 | 513 | } |
| 514 | 514 | break; |
| 515 | 515 | case 0x20: /* framecolor */ |
| 516 | 516 | if (vic2.reg[offset] != data) |
| 517 | 517 | { |
| 518 | 518 | if (vic2.on) |
| 519 | | vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 519 | vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 520 | 520 | vic2.reg[offset] = data; |
| 521 | 521 | } |
| 522 | 522 | break; |
| r2202 | r2203 | |
| 565 | 565 | { |
| 566 | 566 | case 0x11: |
| 567 | 567 | val = (vic2.reg[offset] & ~0x80) | ((vic2.rasterline & 0x100) >> 1); |
| 568 | | if (vic2.on) vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 568 | if (vic2.on) vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 569 | 569 | break; |
| 570 | 570 | case 0x12: |
| 571 | 571 | val = vic2.rasterline & 0xff; |
| 572 | | if (vic2.on) vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 572 | if (vic2.on) vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 573 | 573 | break; |
| 574 | 574 | case 0x16: |
| 575 | 575 | val = vic2.reg[offset] | 0xc0; |
| r2202 | r2203 | |
| 888 | 888 | } |
| 889 | 889 | } |
| 890 | 890 | |
| 891 | | static void vic2_draw_sprite_multi (running_machine *machine, int nr, int yoff, int ybegin, int yend) |
| 891 | static void vic2_draw_sprite_multi (int nr, int yoff, int ybegin, int yend) |
| 892 | 892 | { |
| 893 | 893 | int y, i, prior, addr, xbegin, collision; |
| 894 | 894 | int value, value2, value3 = 0, bg, color[2]; |
| 895 | 895 | |
| 896 | 896 | xbegin = SPRITE_X_POS (nr); |
| 897 | 897 | addr = vic2.dma_read (SPRITE_ADDR (nr)) << 6; |
| 898 | | vic2.spritemulti[2] = machine->pens[SPRITE_COLOR (nr)]; |
| 898 | vic2.spritemulti[2] = SPRITE_COLOR (nr); |
| 899 | 899 | prior = SPRITE_PRIORITY (nr); |
| 900 | 900 | collision = SPRITE_BG_COLLISION (nr); |
| 901 | | color[0] = machine->pens[0]; |
| 902 | | color[1] = machine->pens[1]; |
| 901 | color[0] = 0; |
| 902 | color[1] = 1; |
| 903 | 903 | |
| 904 | 904 | if (SPRITE_X_EXPAND (nr)) |
| 905 | 905 | { |
| r2202 | r2203 | |
| 1003 | 1003 | } |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | | static void vic2_draw_sprite (running_machine *machine, int nr, int yoff, int ybegin, int yend) |
| 1006 | static void vic2_draw_sprite (int nr, int yoff, int ybegin, int yend) |
| 1007 | 1007 | { |
| 1008 | 1008 | int y, i, addr, xbegin, color, prior, collision; |
| 1009 | 1009 | int value, value3 = 0; |
| 1010 | 1010 | |
| 1011 | 1011 | xbegin = SPRITE_X_POS (nr); |
| 1012 | 1012 | addr = vic2.dma_read (SPRITE_ADDR (nr)) << 6; |
| 1013 | | color = machine->pens[SPRITE_COLOR (nr)]; |
| 1013 | color = SPRITE_COLOR (nr); |
| 1014 | 1014 | prior = SPRITE_PRIORITY (nr); |
| 1015 | 1015 | collision = SPRITE_BG_COLLISION (nr); |
| 1016 | 1016 | |
| r2202 | r2203 | |
| 1097 | 1097 | } |
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | | static void vic3_drawlines (running_machine *machine, int first, int last); |
| 1100 | static void vic3_drawlines (int first, int last); |
| 1101 | 1101 | |
| 1102 | | static void vic2_drawlines (running_machine *machine, int first, int last) |
| 1102 | static void vic2_drawlines (int first, int last) |
| 1103 | 1103 | { |
| 1104 | 1104 | int line, vline, end; |
| 1105 | 1105 | int attr, ch, ecm; |
| r2202 | r2203 | |
| 1110 | 1110 | if (vic2.vic3 && VIC3_BITPLANES) return ; |
| 1111 | 1111 | /* temporary allowing vic3 displaying 80 columns */ |
| 1112 | 1112 | if (vic2.vic3&&(vic2.reg[0x31]&0x80)) { |
| 1113 | | vic3_drawlines(machine,first,last); |
| 1113 | vic3_drawlines(first,last); |
| 1114 | 1114 | return; |
| 1115 | 1115 | } |
| 1116 | 1116 | |
| r2202 | r2203 | |
| 1136 | 1136 | if (!SCREENON) |
| 1137 | 1137 | { |
| 1138 | 1138 | for (line = first; (line < last) && (line < vic2.bitmap->height); line++) |
| 1139 | | memset16 (BITMAP_ADDR16(vic2.bitmap, line, 0), machine->pens[0], vic2.bitmap->width); |
| 1139 | memset16 (BITMAP_ADDR16(vic2.bitmap, line, 0), 0, vic2.bitmap->width); |
| 1140 | 1140 | return; |
| 1141 | 1141 | } |
| 1142 | 1142 | |
| r2202 | r2203 | |
| 1153 | 1153 | line=first; |
| 1154 | 1154 | if (line<end) { |
| 1155 | 1155 | plot_box(vic2.bitmap, 0, line, vic2.bitmap->width, end-line, |
| 1156 | | machine->pens[FRAMECOLOR]); |
| 1156 | FRAMECOLOR); |
| 1157 | 1157 | line=end; |
| 1158 | 1158 | } |
| 1159 | 1159 | |
| r2202 | r2203 | |
| 1191 | 1191 | #endif |
| 1192 | 1192 | if (HIRESON) |
| 1193 | 1193 | { |
| 1194 | | vic2.bitmapmulti[1] = vic2.c64_bitmap[1] = machine->pens[ch >> 4]; |
| 1195 | | vic2.bitmapmulti[2] = vic2.c64_bitmap[0] = machine->pens[ch & 0xf]; |
| 1194 | vic2.bitmapmulti[1] = vic2.c64_bitmap[1] = ch >> 4; |
| 1195 | vic2.bitmapmulti[2] = vic2.c64_bitmap[0] = ch & 0xf; |
| 1196 | 1196 | if (MULTICOLORON) |
| 1197 | 1197 | { |
| 1198 | | vic2.bitmapmulti[3] = machine->pens[attr]; |
| 1198 | vic2.bitmapmulti[3] = attr; |
| 1199 | 1199 | vic2_draw_bitmap_multi (ybegin, yend, offs, yoff, xoff); |
| 1200 | 1200 | } |
| 1201 | 1201 | else |
| r2202 | r2203 | |
| 1207 | 1207 | { |
| 1208 | 1208 | ecm = ch >> 6; |
| 1209 | 1209 | vic2.ecmcolor[0] = vic2.colors[ecm]; |
| 1210 | | vic2.ecmcolor[1] = machine->pens[attr]; |
| 1210 | vic2.ecmcolor[1] = attr; |
| 1211 | 1211 | vic2_draw_character (ybegin, yend, ch & ~0xC0, yoff, xoff, vic2.ecmcolor); |
| 1212 | 1212 | } |
| 1213 | 1213 | else if (MULTICOLORON && (attr & 8)) |
| 1214 | 1214 | { |
| 1215 | | vic2.multi[3] = machine->pens[attr & 7]; |
| 1215 | vic2.multi[3] = attr & 7; |
| 1216 | 1216 | vic2_draw_character_multi (ybegin, yend, ch, yoff, xoff); |
| 1217 | 1217 | } |
| 1218 | 1218 | else |
| 1219 | 1219 | { |
| 1220 | | vic2.mono[1] = machine->pens[attr]; |
| 1220 | vic2.mono[1] = attr; |
| 1221 | 1221 | vic2_draw_character (ybegin, yend, ch, yoff, xoff, vic2.mono); |
| 1222 | 1222 | } |
| 1223 | 1223 | } |
| r2202 | r2203 | |
| 1240 | 1240 | if (yoff + syend > YPOS + 200) |
| 1241 | 1241 | syend = YPOS + 200 - yoff - 1; |
| 1242 | 1242 | if (SPRITE_MULTICOLOR (i)) |
| 1243 | | vic2_draw_sprite_multi (machine, i, yoff, ybegin, syend); |
| 1243 | vic2_draw_sprite_multi (i, yoff, ybegin, syend); |
| 1244 | 1244 | else |
| 1245 | | vic2_draw_sprite (machine, i, yoff, ybegin, syend); |
| 1245 | vic2_draw_sprite (i, yoff, ybegin, syend); |
| 1246 | 1246 | if ((syend != yend) || (vic2.sprites[i].line > 20)) |
| 1247 | 1247 | { |
| 1248 | 1248 | vic2.sprites[i].line = vic2.sprites[i].repeat = 0; |
| r2202 | r2203 | |
| 1269 | 1269 | for (j = 0; j < SPRITE_Y_POS (i) - yoff; j++) |
| 1270 | 1270 | vic2.sprites[i].paintedline[j] = 0; |
| 1271 | 1271 | if (SPRITE_MULTICOLOR (i)) |
| 1272 | | vic2_draw_sprite_multi (machine, i, yoff, SPRITE_Y_POS (i) - yoff, syend); |
| 1272 | vic2_draw_sprite_multi (i, yoff, SPRITE_Y_POS (i) - yoff, syend); |
| 1273 | 1273 | else |
| 1274 | | vic2_draw_sprite (machine, i, yoff, SPRITE_Y_POS (i) - yoff, syend); |
| 1274 | vic2_draw_sprite (i, yoff, SPRITE_Y_POS (i) - yoff, syend); |
| 1275 | 1275 | if ((syend != yend) || (vic2.sprites[i].line > 20)) |
| 1276 | 1276 | { |
| 1277 | 1277 | for (j = syend; j <= yend; j++) |
| r2202 | r2203 | |
| 1285 | 1285 | } |
| 1286 | 1286 | } |
| 1287 | 1287 | plot_box(vic2.bitmap, 0, yoff+ybegin, xbegin, yend-ybegin+1, |
| 1288 | | machine->pens[FRAMECOLOR]); |
| 1288 | FRAMECOLOR); |
| 1289 | 1289 | plot_box(vic2.bitmap, xend, yoff+ybegin, vic2.bitmap->width - xend, yend-ybegin+1, |
| 1290 | | machine->pens[FRAMECOLOR]); |
| 1290 | FRAMECOLOR); |
| 1291 | 1291 | } |
| 1292 | 1292 | if (last < vic2.bitmap->height) |
| 1293 | 1293 | end = last; |
| r2202 | r2203 | |
| 1295 | 1295 | end = vic2.bitmap->height; |
| 1296 | 1296 | if (line<end) { |
| 1297 | 1297 | plot_box(vic2.bitmap, 0, line, vic2.bitmap->width, end-line, |
| 1298 | | machine->pens[FRAMECOLOR]); |
| 1298 | FRAMECOLOR); |
| 1299 | 1299 | line=end; |
| 1300 | 1300 | } |
| 1301 | 1301 | } |
| r2202 | r2203 | |
| 1310 | 1310 | if (vic2.rasterline >= vic2.lines) |
| 1311 | 1311 | { |
| 1312 | 1312 | vic2.rasterline = 0; |
| 1313 | | if (vic2.on) vic2_drawlines (machine, vic2.lastline, vic2.lines); |
| 1313 | if (vic2.on) vic2_drawlines (vic2.lastline, vic2.lines); |
| 1314 | 1314 | |
| 1315 | 1315 | for (i = 0; i < 8; i++) |
| 1316 | 1316 | vic2.sprites[i].repeat = vic2.sprites[i].line = 0; |
| r2202 | r2203 | |
| 1324 | 1324 | if (vic2.rasterline == C64_2_RASTERLINE (RASTERLINE)) |
| 1325 | 1325 | { |
| 1326 | 1326 | if (vic2.on) |
| 1327 | | vic2_drawlines (machine, vic2.lastline, vic2.rasterline); |
| 1327 | vic2_drawlines (vic2.lastline, vic2.rasterline); |
| 1328 | 1328 | vic2_set_interrupt (1); |
| 1329 | 1329 | } |
| 1330 | 1330 | } |