src/mess/video/saa505x.c
| r10163 | r10164 | |
| 3365 | 3365 | }; |
| 3366 | 3366 | |
| 3367 | 3367 | |
| 3368 | | static int teletext_data; |
| 3369 | | static int teletext_LOSE; |
| 3368 | typedef struct |
| 3369 | { |
| 3370 | int data; |
| 3371 | int lose; |
| 3370 | 3372 | |
| 3371 | | static const char *tt_lookup; |
| 3372 | | static const char *tt_graphics; |
| 3373 | | static int tt_colour; |
| 3374 | | static int tt_rcolour; |
| 3375 | | static int tt_bgcolour=0; |
| 3376 | | static int tt_start_line=0; |
| 3377 | | static int tt_double_height=0; |
| 3378 | | static int tt_double_height_set=0; |
| 3379 | | static int tt_double_height_offset=0; |
| 3380 | | static int tt_linecount=0; |
| 3381 | | static int tt_flash=0; |
| 3382 | | static int tt_holdgraphics=0; |
| 3383 | | static int tt_lastcode=0; |
| 3373 | const char *lookup; |
| 3374 | const char *graphics; |
| 3375 | int colour; |
| 3376 | int rcolour; |
| 3377 | int bgcolour; |
| 3378 | int start_line; |
| 3379 | int double_height; |
| 3380 | int double_height_set; |
| 3381 | int double_height_offset; |
| 3382 | int linecount; |
| 3383 | int flash; |
| 3384 | int holdgraphics; |
| 3385 | int lastcode; |
| 3384 | 3386 | |
| 3385 | | static int tt_frame_count=0; |
| 3387 | int frame_count; |
| 3388 | const saa505x_interface *intf; |
| 3389 | } teletext_t; |
| 3386 | 3390 | |
| 3387 | | // local copy of the 6845 external procedure calls |
| 3388 | | static struct saa505x_interface saa505x_calls; |
| 3389 | 3391 | |
| 3392 | INLINE teletext_t *get_safe_token( device_t *device ) |
| 3393 | { |
| 3394 | assert(device != NULL); |
| 3395 | assert(device->type() == SAA505X); |
| 3390 | 3396 | |
| 3391 | | void saa505x_config(const struct saa505x_interface *intf) |
| 3397 | return (teletext_t *)downcast<legacy_device_base *>(device)->token(); |
| 3398 | } |
| 3399 | |
| 3400 | static DEVICE_START( saa505x ) |
| 3392 | 3401 | { |
| 3393 | | tt_lookup=teletext_saa5050_characters; |
| 3394 | | tt_graphics=teletext_graphics; |
| 3395 | | tt_colour=7; |
| 3396 | | saa505x_calls.out_Pixel_func=*intf->out_Pixel_func; |
| 3402 | teletext_t *tt = get_safe_token(device); |
| 3403 | tt->lookup=teletext_saa5050_characters; |
| 3404 | tt->graphics=teletext_graphics; |
| 3405 | tt->colour=7; |
| 3406 | tt->intf = (const saa505x_interface *)device->baseconfig().static_config(); |
| 3397 | 3407 | } |
| 3398 | 3408 | |
| 3409 | DEVICE_GET_INFO( saa505x ) |
| 3410 | { |
| 3411 | switch (state) |
| 3412 | { |
| 3413 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 3414 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(teletext_t); break; |
| 3399 | 3415 | |
| 3416 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 3417 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(saa505x); break; |
| 3400 | 3418 | |
| 3401 | | void teletext_data_w(int offset, int data) |
| 3419 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 3420 | case DEVINFO_STR_NAME: strcpy(info->s, "SAA505x Video"); break; |
| 3421 | case DEVINFO_STR_FAMILY: strcpy(info->s, "SAA505x Video"); break; |
| 3422 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 3423 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 3424 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright MESS Team"); break; |
| 3425 | } |
| 3426 | } |
| 3427 | |
| 3428 | DEFINE_LEGACY_DEVICE(SAA505X, saa505x); |
| 3429 | |
| 3430 | void teletext_data_w(device_t *device, int offset, int data) |
| 3402 | 3431 | { |
| 3403 | | teletext_data=data & 0x7f; |
| 3432 | teletext_t *tt = get_safe_token(device); |
| 3433 | tt->data=data & 0x7f; |
| 3404 | 3434 | } |
| 3405 | 3435 | |
| 3406 | | void teletext_DEW(void) |
| 3436 | void teletext_DEW(device_t *device) |
| 3407 | 3437 | { |
| 3408 | | tt_linecount=9; |
| 3409 | | tt_double_height=0; |
| 3410 | | tt_double_height_set=0; |
| 3411 | | tt_double_height_offset=0; |
| 3412 | | tt_frame_count=(tt_frame_count+1)%50; |
| 3438 | teletext_t *tt = get_safe_token(device); |
| 3439 | tt->linecount=9; |
| 3440 | tt->double_height=0; |
| 3441 | tt->double_height_set=0; |
| 3442 | tt->double_height_offset=0; |
| 3443 | tt->frame_count=(tt->frame_count+1)%50; |
| 3413 | 3444 | } |
| 3414 | 3445 | |
| 3415 | | void teletext_LOSE_w(int offset, int data) |
| 3446 | void teletext_LOSE_w(device_t *device, int offset, int data) |
| 3416 | 3447 | { |
| 3417 | | if ((data)&&(!teletext_LOSE)) |
| 3448 | teletext_t *tt = get_safe_token(device); |
| 3449 | |
| 3450 | if ((data)&&(!tt->lose)) |
| 3418 | 3451 | { |
| 3419 | 3452 | |
| 3420 | | tt_lookup=teletext_saa5050_characters; |
| 3421 | | tt_colour=7; |
| 3422 | | tt_bgcolour=0; |
| 3423 | | tt_graphics=teletext_graphics; |
| 3424 | | tt_linecount=(tt_linecount+1)%10; |
| 3425 | | tt_start_line=0; |
| 3426 | | tt_double_height=0; |
| 3427 | | tt_flash=0; |
| 3428 | | tt_holdgraphics=0; |
| 3429 | | tt_lastcode=0x20; |
| 3453 | tt->lookup=teletext_saa5050_characters; |
| 3454 | tt->colour=7; |
| 3455 | tt->bgcolour=0; |
| 3456 | tt->graphics=teletext_graphics; |
| 3457 | tt->linecount=(tt->linecount+1)%10; |
| 3458 | tt->start_line=0; |
| 3459 | tt->double_height=0; |
| 3460 | tt->flash=0; |
| 3461 | tt->holdgraphics=0; |
| 3462 | tt->lastcode=0x20; |
| 3430 | 3463 | |
| 3431 | 3464 | // only check the double height stuff if at the first row of a new line |
| 3432 | | if (!tt_linecount) |
| 3465 | if (!tt->linecount) |
| 3433 | 3466 | { |
| 3434 | | tt_double_height_offset=((!tt_double_height_set)||tt_double_height_offset)?0:10; |
| 3435 | | tt_double_height_set=0; |
| 3467 | tt->double_height_offset=((!tt->double_height_set)||tt->double_height_offset)?0:10; |
| 3468 | tt->double_height_set=0; |
| 3436 | 3469 | } |
| 3437 | 3470 | |
| 3438 | 3471 | } |
| 3439 | 3472 | |
| 3440 | | teletext_LOSE=data; |
| 3473 | tt->lose=data; |
| 3441 | 3474 | } |
| 3442 | 3475 | |
| 3443 | 3476 | |
| 3444 | | void teletext_F1(running_machine *machine) |
| 3477 | void teletext_F1(device_t *device) |
| 3445 | 3478 | { |
| 3479 | teletext_t *tt = get_safe_token(device); |
| 3446 | 3480 | int sc1; |
| 3447 | 3481 | int code; |
| 3448 | | code=teletext_data; |
| 3482 | code=tt->data; |
| 3449 | 3483 | |
| 3450 | 3484 | switch (code) |
| 3451 | 3485 | { |
| r10163 | r10164 | |
| 3453 | 3487 | |
| 3454 | 3488 | case 0x01: case 0x02: case 0x03: case 0x04: |
| 3455 | 3489 | case 0x05: case 0x06: case 0x07: |
| 3456 | | tt_lookup=teletext_saa5050_characters; |
| 3457 | | tt_colour=code; |
| 3490 | tt->lookup=teletext_saa5050_characters; |
| 3491 | tt->colour=code; |
| 3458 | 3492 | break; |
| 3459 | 3493 | |
| 3460 | 3494 | |
| 3461 | 3495 | case 0x08: // Flash |
| 3462 | | tt_flash=tt_frame_count<20?1:0; |
| 3496 | tt->flash=tt->frame_count<20?1:0; |
| 3463 | 3497 | break; |
| 3464 | 3498 | case 0x09: // Steady |
| 3465 | | tt_flash=0; |
| 3499 | tt->flash=0; |
| 3466 | 3500 | break; |
| 3467 | 3501 | |
| 3468 | 3502 | // 0x0a End Box NOT USED |
| 3469 | 3503 | // 0x0b Start Box NOT USED |
| 3470 | 3504 | |
| 3471 | 3505 | case 0x0c: // Normal Height |
| 3472 | | tt_double_height=0; |
| 3473 | | tt_start_line=0; |
| 3506 | tt->double_height=0; |
| 3507 | tt->start_line=0; |
| 3474 | 3508 | break; |
| 3475 | 3509 | case 0x0d: // Double Height |
| 3476 | | tt_double_height=1; |
| 3477 | | tt_double_height_set=1; |
| 3478 | | tt_start_line=tt_double_height_offset; |
| 3510 | tt->double_height=1; |
| 3511 | tt->double_height_set=1; |
| 3512 | tt->start_line=tt->double_height_offset; |
| 3479 | 3513 | break; |
| 3480 | 3514 | |
| 3481 | 3515 | // 0x0e S0 NOT USED |
| r10163 | r10164 | |
| 3484 | 3518 | |
| 3485 | 3519 | case 0x11: case 0x12: case 0x13: case 0x14: |
| 3486 | 3520 | case 0x15: case 0x16: case 0x17: |
| 3487 | | tt_lookup=tt_graphics; |
| 3488 | | tt_colour=code&0x07; |
| 3521 | tt->lookup=tt->graphics; |
| 3522 | tt->colour=code&0x07; |
| 3489 | 3523 | break; |
| 3490 | 3524 | |
| 3491 | 3525 | // 0x18 Conceal Display |
| 3492 | 3526 | |
| 3493 | 3527 | case 0x19: // Contiguois Graphics |
| 3494 | | tt_graphics=teletext_graphics; |
| 3495 | | if (tt_lookup!=teletext_saa5050_characters) |
| 3496 | | tt_lookup=tt_graphics; |
| 3528 | tt->graphics=teletext_graphics; |
| 3529 | if (tt->lookup!=teletext_saa5050_characters) |
| 3530 | tt->lookup=tt->graphics; |
| 3497 | 3531 | break; |
| 3498 | 3532 | case 0x1a: // Separated Graphics |
| 3499 | | tt_graphics=teletext_separated_graphics; |
| 3500 | | if (tt_lookup!=teletext_saa5050_characters) |
| 3501 | | tt_lookup=tt_graphics; |
| 3533 | tt->graphics=teletext_separated_graphics; |
| 3534 | if (tt->lookup!=teletext_saa5050_characters) |
| 3535 | tt->lookup=tt->graphics; |
| 3502 | 3536 | break; |
| 3503 | 3537 | |
| 3504 | 3538 | // 0x1b ESC NOT USED |
| 3505 | 3539 | |
| 3506 | 3540 | case 0x1c: // Black Background |
| 3507 | | tt_bgcolour=0; |
| 3541 | tt->bgcolour=0; |
| 3508 | 3542 | break; |
| 3509 | 3543 | case 0x1d: // New Background |
| 3510 | | tt_bgcolour=tt_colour; |
| 3544 | tt->bgcolour=tt->colour; |
| 3511 | 3545 | break; |
| 3512 | 3546 | |
| 3513 | 3547 | case 0x1e: |
| 3514 | | tt_holdgraphics=1; |
| 3548 | tt->holdgraphics=1; |
| 3515 | 3549 | break; |
| 3516 | 3550 | |
| 3517 | 3551 | case 0x1f: |
| 3518 | | tt_holdgraphics=0; |
| 3552 | tt->holdgraphics=0; |
| 3519 | 3553 | break; |
| 3520 | 3554 | } |
| 3521 | 3555 | |
| 3522 | | if (teletext_LOSE) |
| 3556 | if (tt->lose) |
| 3523 | 3557 | { |
| 3524 | | tt_rcolour=tt_flash?tt_bgcolour:tt_colour; |
| 3558 | tt->rcolour=tt->flash?tt->bgcolour:tt->colour; |
| 3525 | 3559 | if (code<0x20) { |
| 3526 | | if (tt_holdgraphics) { |
| 3527 | | code=tt_lastcode; |
| 3560 | if (tt->holdgraphics) { |
| 3561 | code=tt->lastcode; |
| 3528 | 3562 | } else { |
| 3529 | 3563 | code=0x20; |
| 3530 | 3564 | } |
| 3531 | 3565 | } |
| 3532 | | tt_lastcode=code; |
| 3533 | | code=(code-0x20)*60+(6*((tt_linecount+tt_start_line)>>tt_double_height)); |
| 3566 | tt->lastcode=code; |
| 3567 | code=(code-0x20)*60+(6*((tt->linecount+tt->start_line)>>tt->double_height)); |
| 3534 | 3568 | for(sc1=0;sc1<6;sc1++) |
| 3535 | 3569 | { |
| 3536 | | (saa505x_calls.out_Pixel_func)(machine,0,tt_lookup[code++]?tt_rcolour:tt_bgcolour); |
| 3570 | (tt->intf->out_Pixel_func)(device,0,tt->lookup[code++]?tt->rcolour:tt->bgcolour); |
| 3537 | 3571 | } |
| 3538 | 3572 | } else { |
| 3539 | 3573 | |
| 3540 | | (saa505x_calls.out_Pixel_func)(machine,0,0); |
| 3541 | | (saa505x_calls.out_Pixel_func)(machine,0,0); |
| 3542 | | (saa505x_calls.out_Pixel_func)(machine,0,0); |
| 3543 | | (saa505x_calls.out_Pixel_func)(machine,0,0); |
| 3544 | | (saa505x_calls.out_Pixel_func)(machine,0,0); |
| 3545 | | (saa505x_calls.out_Pixel_func)(machine,0,0); |
| 3574 | (tt->intf->out_Pixel_func)(device,0,0); |
| 3575 | (tt->intf->out_Pixel_func)(device,0,0); |
| 3576 | (tt->intf->out_Pixel_func)(device,0,0); |
| 3577 | (tt->intf->out_Pixel_func)(device,0,0); |
| 3578 | (tt->intf->out_Pixel_func)(device,0,0); |
| 3579 | (tt->intf->out_Pixel_func)(device,0,0); |
| 3546 | 3580 | } |
| 3547 | 3581 | } |
src/mess/video/crt.c
| r10163 | r10164 | |
| 39 | 39 | int next; /* index of next pixel in list */ |
| 40 | 40 | } point; |
| 41 | 41 | |
| 42 | | static point *list; /* array of (crt_window_width*crt_window_height) point */ |
| 43 | | static int *list_head; /* head of the list of lit pixels (index in the array) */ |
| 44 | | /* keep a separate list for each display line (makes the video code slightly faster) */ |
| 45 | | |
| 46 | | static int decay_counter; /* incremented each frame (tells for how many frames the CRT has decayed between two screen refresh) */ |
| 47 | | |
| 48 | | /* CRT window */ |
| 49 | | static int window_offset_x, window_offset_y, window_width, window_height; |
| 50 | | |
| 51 | 42 | enum |
| 52 | 43 | { |
| 53 | 44 | intensity_pixel_not_in_list = -1 /* special value that tells that the node is not in list */ |
| 54 | 45 | }; |
| 55 | | static int num_intensity_levels; |
| 56 | | #define intensity_new_pixel num_intensity_levels |
| 57 | 46 | |
| 47 | typedef struct |
| 48 | { |
| 49 | point *list; /* array of (crt_window_width*crt_window_height) point */ |
| 50 | int *list_head; /* head of the list of lit pixels (index in the array) */ |
| 51 | /* keep a separate list for each display line (makes the video code slightly faster) */ |
| 58 | 52 | |
| 59 | | /* |
| 60 | | video_start_crt |
| 53 | int decay_counter; /* incremented each frame (tells for how many frames the CRT has decayed between two screen refresh) */ |
| 61 | 54 | |
| 62 | | video init |
| 63 | | */ |
| 64 | | int video_start_crt(running_machine *machine, int num_levels, int offset_x, int offset_y, int width, int height) |
| 55 | /* CRT window */ |
| 56 | int num_intensity_levels; |
| 57 | int window_offset_x, window_offset_y; |
| 58 | int window_width, window_height; |
| 59 | } crt_t; |
| 60 | |
| 61 | |
| 62 | INLINE crt_t *get_safe_token(device_t *device) |
| 65 | 63 | { |
| 64 | assert(device != NULL); |
| 65 | assert(device->type() == CRT); |
| 66 | |
| 67 | return (crt_t *)downcast<legacy_device_base *>(device)->token(); |
| 68 | } |
| 69 | |
| 70 | static DEVICE_START( crt ) |
| 71 | { |
| 72 | crt_t *crt = get_safe_token(device); |
| 73 | const crt_interface *intf = (const crt_interface *)device->baseconfig().static_config(); |
| 74 | int width = intf->width; |
| 75 | int height = intf->height; |
| 66 | 76 | int i; |
| 67 | 77 | |
| 68 | | num_intensity_levels = num_levels; |
| 69 | | window_offset_x = offset_x; |
| 70 | | window_offset_y = offset_y; |
| 71 | | window_width = width; |
| 72 | | window_height = height; |
| 78 | crt->num_intensity_levels = intf->num_levels; |
| 79 | crt->window_offset_x = intf->offset_x; |
| 80 | crt->window_offset_y = intf->offset_y; |
| 81 | crt->window_width = width; |
| 82 | crt->window_height = height; |
| 73 | 83 | |
| 74 | 84 | /* alloc the arrays */ |
| 75 | | list = auto_alloc_array(machine, point, window_width * window_height); |
| 85 | crt->list = auto_alloc_array(device->machine, point, width * height); |
| 76 | 86 | |
| 77 | | list_head = auto_alloc_array(machine, int, window_height); |
| 87 | crt->list_head = auto_alloc_array(device->machine, int, height); |
| 78 | 88 | |
| 79 | 89 | /* fill with black and set up list as empty */ |
| 80 | | for (i=0; i<(window_width * window_height); i++) |
| 90 | for (i=0; i<(width * height); i++) |
| 81 | 91 | { |
| 82 | | list[i].intensity = intensity_pixel_not_in_list; |
| 92 | crt->list[i].intensity = intensity_pixel_not_in_list; |
| 83 | 93 | } |
| 84 | 94 | |
| 85 | | for (i=0; i<window_height; i++) |
| 86 | | list_head[i] = -1; |
| 95 | for (i=0; i<height; i++) |
| 96 | crt->list_head[i] = -1; |
| 87 | 97 | |
| 88 | | decay_counter = 0; |
| 98 | crt->decay_counter = 0; |
| 99 | } |
| 89 | 100 | |
| 90 | | return 0; |
| 101 | |
| 102 | DEVICE_GET_INFO( crt ) |
| 103 | { |
| 104 | switch (state) |
| 105 | { |
| 106 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 107 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(crt_t); break; |
| 108 | |
| 109 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 110 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(crt); break; |
| 111 | |
| 112 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 113 | case DEVINFO_STR_NAME: strcpy(info->s, "CRT Video"); break; |
| 114 | case DEVINFO_STR_FAMILY: strcpy(info->s, "CRT Video"); break; |
| 115 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 116 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 117 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright MESS Team"); break; |
| 118 | } |
| 91 | 119 | } |
| 92 | 120 | |
| 121 | DEFINE_LEGACY_DEVICE(CRT, crt); |
| 93 | 122 | |
| 94 | 123 | /* |
| 95 | 124 | crt_plot |
| 96 | 125 | |
| 97 | 126 | schedule a pixel to be plotted |
| 98 | 127 | */ |
| 99 | | void crt_plot(int x, int y) |
| 128 | void crt_plot(device_t *device, int x, int y) |
| 100 | 129 | { |
| 130 | crt_t *crt = get_safe_token(device); |
| 101 | 131 | point *node; |
| 102 | 132 | int list_index; |
| 103 | 133 | |
| 104 | 134 | /* compute pixel coordinates */ |
| 105 | 135 | if (x<0) x=0; |
| 106 | 136 | if (y<0) y=0; |
| 107 | | if ((x>(window_width-1)) || ((y>window_height-1))) |
| 137 | if ((x>(crt->window_width-1)) || ((y>crt->window_height-1))) |
| 108 | 138 | return; |
| 109 | | y = (window_height-1) - y; |
| 139 | y = (crt->window_height-1) - y; |
| 110 | 140 | |
| 111 | 141 | /* find entry in list */ |
| 112 | | list_index = x + y*window_width; |
| 142 | list_index = x + y*crt->window_width; |
| 113 | 143 | |
| 114 | | node = & list[list_index]; |
| 144 | node = &crt->list[list_index]; |
| 115 | 145 | |
| 116 | 146 | if (node->intensity == intensity_pixel_not_in_list) |
| 117 | 147 | { /* insert node in list if it is not in it */ |
| 118 | | node->next = list_head[y]; |
| 119 | | list_head[y] = list_index; |
| 148 | node->next = crt->list_head[y]; |
| 149 | crt->list_head[y] = list_index; |
| 120 | 150 | } |
| 121 | 151 | /* set intensity */ |
| 122 | | node->intensity = intensity_new_pixel; |
| 152 | node->intensity = crt->num_intensity_levels; |
| 123 | 153 | } |
| 124 | 154 | |
| 125 | 155 | |
| 126 | 156 | /* |
| 127 | | VIDEO_EOF( crt ) |
| 157 | crt_eof |
| 128 | 158 | |
| 129 | 159 | keep track of time |
| 130 | 160 | */ |
| 131 | | VIDEO_EOF( crt ) |
| 161 | void crt_eof(device_t *device) |
| 132 | 162 | { |
| 133 | | decay_counter++; |
| 163 | crt_t *crt = get_safe_token(device); |
| 164 | crt->decay_counter++; |
| 134 | 165 | } |
| 135 | 166 | |
| 136 | 167 | |
| 137 | 168 | /* |
| 138 | | VIDEO_UPDATE( crt ) |
| 169 | crt_update |
| 139 | 170 | |
| 140 | 171 | update the bitmap |
| 141 | 172 | */ |
| 142 | | VIDEO_UPDATE( crt ) |
| 173 | void crt_update(device_t *device, bitmap_t *bitmap) |
| 143 | 174 | { |
| 175 | crt_t *crt = get_safe_token(device); |
| 144 | 176 | int i, p_i; |
| 145 | 177 | int y; |
| 146 | 178 | |
| 147 | | //if (decay_counter) |
| 179 | //if (crt->decay_counter) |
| 148 | 180 | { |
| 149 | 181 | /* some time has elapsed: let's update the screen */ |
| 150 | | for (y=0; y<window_height; y++) |
| 182 | for (y=0; y<crt->window_height; y++) |
| 151 | 183 | { |
| 152 | | UINT16 *line = BITMAP_ADDR16(bitmap, y+window_offset_y, 0); |
| 184 | UINT16 *line = BITMAP_ADDR16(bitmap, y+crt->window_offset_y, 0); |
| 153 | 185 | |
| 154 | 186 | p_i = -1; |
| 155 | 187 | |
| 156 | | for (i=list_head[y]; (i != -1); i=list[i].next) |
| 188 | for (i=crt->list_head[y]; (i != -1); i=crt->list[i].next) |
| 157 | 189 | { |
| 158 | | point *node = & list[i]; |
| 159 | | int x = (i % window_width) + window_offset_x; |
| 190 | point *node = &crt->list[i]; |
| 191 | int x = (i % crt->window_width) + crt->window_offset_x; |
| 160 | 192 | |
| 161 | | if (node->intensity == intensity_new_pixel) |
| 193 | if (node->intensity == crt->num_intensity_levels) |
| 162 | 194 | /* new pixel: set to max intensity */ |
| 163 | | node->intensity = num_intensity_levels-1; |
| 195 | node->intensity = crt->num_intensity_levels-1; |
| 164 | 196 | else |
| 165 | 197 | { |
| 166 | 198 | /* otherwise, apply intensity decay */ |
| 167 | | node->intensity -= decay_counter; |
| 199 | node->intensity -= crt->decay_counter; |
| 168 | 200 | if (node->intensity < 0) |
| 169 | 201 | node->intensity = 0; |
| 170 | 202 | } |
| 171 | 203 | |
| 172 | 204 | /* draw pixel on screen */ |
| 173 | | //plot_pixel(bitmap, x, y+crt_window_offset_y, node->intensity); |
| 205 | //plot_pixel(bitmap, x, y+crt->window_offset_y, node->intensity); |
| 174 | 206 | line[x] = node->intensity; |
| 175 | 207 | |
| 176 | 208 | if (node->intensity != 0) |
| r10163 | r10164 | |
| 179 | 211 | { /* delete current node */ |
| 180 | 212 | node->intensity = intensity_pixel_not_in_list; |
| 181 | 213 | if (p_i != -1) |
| 182 | | list[p_i].next = node->next; |
| 214 | crt->list[p_i].next = node->next; |
| 183 | 215 | else |
| 184 | | list_head[y] = node->next; |
| 216 | crt->list_head[y] = node->next; |
| 185 | 217 | } |
| 186 | 218 | } |
| 187 | 219 | } |
| 188 | 220 | |
| 189 | | decay_counter = 0; |
| 221 | crt->decay_counter = 0; |
| 190 | 222 | } |
| 191 | | |
| 192 | | return 0; |
| 193 | 223 | } |
src/mess/video/bbc.c
| r10163 | r10164 | |
| 17 | 17 | static void BBC_draw_hi_res(running_machine* machine); |
| 18 | 18 | static void BBC_draw_teletext(running_machine *machine); |
| 19 | 19 | |
| 20 | | static void BBC_draw_RGB_in(running_machine *machine, int offset,int data); |
| 21 | | |
| 22 | 20 | /************************************************************************ |
| 23 | 21 | * video_refresh flag is used in optimising the screen redrawing |
| 24 | 22 | * it is set whenever a 6845 or VideoULA registers are change. |
| r10163 | r10164 | |
| 178 | 176 | |
| 179 | 177 | |
| 180 | 178 | |
| 181 | | static const struct saa505x_interface BBCsaa5050 = |
| 182 | | { |
| 183 | | BBC_draw_RGB_in, |
| 184 | | }; |
| 185 | | |
| 186 | 179 | static void BBC_draw_teletext(running_machine *machine) |
| 187 | 180 | { |
| 188 | 181 | bbc_state *state = machine->driver_data<bbc_state>(); |
| r10163 | r10164 | |
| 191 | 184 | //Teletext Latch bit 6 is only passed onto bits 6 on the Teletext chip if DE is true |
| 192 | 185 | //Teletext Latch bit 7 goes to LOSE on the Teletext chip |
| 193 | 186 | |
| 194 | | int meml; |
| 187 | int meml; |
| 195 | 188 | |
| 196 | | teletext_LOSE_w(0,(state->Teletext_Latch>>7)&1); |
| 189 | teletext_LOSE_w(state->saa505x, 0, (state->Teletext_Latch>>7)&1); |
| 197 | 190 | |
| 198 | | teletext_F1(machine); |
| 191 | teletext_F1(state->saa505x); |
| 199 | 192 | |
| 200 | | teletext_data_w(0,(state->Teletext_Latch&0x3f)|((state->Teletext_Latch&0x40)|(state->BBC_DE?0:0x40))); |
| 193 | teletext_data_w(state->saa505x, 0, (state->Teletext_Latch&0x3f)|((state->Teletext_Latch&0x40)|(state->BBC_DE?0:0x40))); |
| 201 | 194 | |
| 202 | 195 | meml=m6845_memory_address_r(0); |
| 203 | 196 | |
| r10163 | r10164 | |
| 389 | 382 | |
| 390 | 383 | // RGB input to the Video ULA from the Teletext IC |
| 391 | 384 | // Just pass on the output at the correct pixel size. |
| 392 | | static void BBC_draw_RGB_in(running_machine *machine, int offset,int data) |
| 385 | void bbc_draw_RGB_in(device_t *device, int offset,int data) |
| 393 | 386 | { |
| 394 | | bbc_state *state = machine->driver_data<bbc_state>(); |
| 387 | bbc_state *state = device->machine->driver_data<bbc_state>(); |
| 395 | 388 | BBC_ula_drawpixel(state, data, state->emulation_pixels_per_real_pixel); |
| 396 | 389 | } |
| 397 | 390 | |
| r10163 | r10164 | |
| 469 | 462 | |
| 470 | 463 | state->BBC_display = state->BBC_display_left + state->x_screen_offset; |
| 471 | 464 | |
| 472 | | teletext_DEW(); |
| 465 | teletext_DEW(state->saa505x); |
| 473 | 466 | } |
| 474 | 467 | state->BBC_VSync=data; |
| 475 | 468 | |
| r10163 | r10164 | |
| 654 | 647 | |
| 655 | 648 | set_pixel_lookup(state); |
| 656 | 649 | m6845_config(&BBC6845); |
| 657 | | saa505x_config(&BBCsaa5050); |
| 650 | state->saa505x = machine->device("saa505x"); |
| 658 | 651 | |
| 659 | 652 | state->BBC_Video_RAM = machine->region("maincpu")->base(); |
| 660 | 653 | state->vidmem_RAM = state->vidmem; |