src/mess/video/i8275.c
| r5484 | r5485 | |
| 61 | 61 | |
| 62 | 62 | struct _i8275_t |
| 63 | 63 | { |
| 64 | devcb_resolved_write_line out_drq_func; |
| 65 | devcb_resolved_write_line out_irq_func; |
| 66 | |
| 64 | 67 | const device_config *screen; |
| 65 | 68 | |
| 66 | 69 | const i8275_interface *intf; |
| r5484 | r5485 | |
| 398 | 401 | i8275->current_row++; |
| 399 | 402 | } |
| 400 | 403 | |
| 401 | | void i8275_dack_set_data(const device_config *device, UINT8 data) |
| 404 | WRITE8_DEVICE_HANDLER( i8275_dack_w ) |
| 402 | 405 | { |
| 403 | 406 | i8275_t *i8275 = get_safe_token(device); |
| 404 | 407 | |
| r5484 | r5485 | |
| 451 | 454 | { |
| 452 | 455 | i8275->ypos = 0; |
| 453 | 456 | i8275->current_row = 0; |
| 454 | | i8275->intf->dma_request(device,0); |
| 457 | |
| 458 | devcb_call_write_line(&i8275->out_drq_func, 0); |
| 455 | 459 | } |
| 456 | 460 | } |
| 457 | 461 | |
| r5484 | r5485 | |
| 478 | 482 | // if value < 32 it is visible otherwise not |
| 479 | 483 | i8275->char_blink_cnt++; |
| 480 | 484 | if(i8275->char_blink_cnt==64) i8275->char_blink_cnt = 0; |
| 481 | | i8275->intf->dma_request(device,1); |
| 485 | |
| 486 | devcb_call_write_line(&i8275->out_drq_func, 1); |
| 482 | 487 | } |
| 483 | 488 | if (i8275->status_reg & I8275_STATUS_INTERRUPT_ENABLE) { |
| 484 | 489 | i8275->status_reg |= I8275_STATUS_INTERRUPT_REQUEST; |
| r5484 | r5485 | |
| 490 | 495 | static DEVICE_START( i8275 ) |
| 491 | 496 | { |
| 492 | 497 | i8275_t *i8275 = get_safe_token(device); |
| 493 | | // validate arguments |
| 494 | | |
| 498 | |
| 499 | /* validate arguments */ |
| 495 | 500 | assert(device != NULL); |
| 496 | 501 | assert(device->tag != NULL); |
| 497 | 502 | assert(device->static_config != NULL); |
| 498 | 503 | |
| 499 | 504 | i8275->intf = device->static_config; |
| 500 | 505 | |
| 501 | | assert(i8275->intf->dma_request != NULL); |
| 502 | 506 | assert(i8275->intf->display_pixels != NULL); |
| 503 | 507 | |
| 504 | | // get the screen device |
| 505 | | |
| 508 | /* get the screen device */ |
| 506 | 509 | i8275->screen = devtag_get_device(device->machine, i8275->intf->screen_tag); |
| 507 | 510 | assert(i8275->screen != NULL); |
| 508 | 511 | |
| 509 | | // register for state saving |
| 510 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->status_reg); |
| 511 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->num_of_params); |
| 512 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->current_command); |
| 513 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->param_type); |
| 512 | /* resolve callbacks */ |
| 513 | devcb_resolve_write_line(&i8275->out_drq_func, &i8275->intf->out_drq_func, device); |
| 514 | devcb_resolve_write_line(&i8275->out_irq_func, &i8275->intf->out_irq_func, device); |
| 514 | 515 | |
| 515 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->cursor_col); |
| 516 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->cursor_row); |
| 516 | /* register for state saving */ |
| 517 | state_save_register_device_item(device, 0, i8275->status_reg); |
| 518 | state_save_register_device_item(device, 0, i8275->num_of_params); |
| 519 | state_save_register_device_item(device, 0, i8275->current_command); |
| 520 | state_save_register_device_item(device, 0, i8275->param_type); |
| 517 | 521 | |
| 518 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->light_pen_col); |
| 519 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->light_pen_row); |
| 522 | state_save_register_device_item(device, 0, i8275->cursor_col); |
| 523 | state_save_register_device_item(device, 0, i8275->cursor_row); |
| 520 | 524 | |
| 521 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->rows_type); |
| 522 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->chars_per_row); |
| 523 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->vert_retrace_rows); |
| 524 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->rows_per_frame); |
| 525 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->undeline_line_num); |
| 526 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->lines_per_row); |
| 527 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->line_counter_mode); |
| 528 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->field_attribute_mode); |
| 529 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->cursor_format); |
| 530 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->hor_retrace_count); |
| 525 | state_save_register_device_item(device, 0, i8275->light_pen_col); |
| 526 | state_save_register_device_item(device, 0, i8275->light_pen_row); |
| 531 | 527 | |
| 532 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->burst_space_code); |
| 533 | | state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->burst_count_code); |
| 528 | state_save_register_device_item(device, 0, i8275->rows_type); |
| 529 | state_save_register_device_item(device, 0, i8275->chars_per_row); |
| 530 | state_save_register_device_item(device, 0, i8275->vert_retrace_rows); |
| 531 | state_save_register_device_item(device, 0, i8275->rows_per_frame); |
| 532 | state_save_register_device_item(device, 0, i8275->undeline_line_num); |
| 533 | state_save_register_device_item(device, 0, i8275->lines_per_row); |
| 534 | state_save_register_device_item(device, 0, i8275->line_counter_mode); |
| 535 | state_save_register_device_item(device, 0, i8275->field_attribute_mode); |
| 536 | state_save_register_device_item(device, 0, i8275->cursor_format); |
| 537 | state_save_register_device_item(device, 0, i8275->hor_retrace_count); |
| 538 | |
| 539 | state_save_register_device_item(device, 0, i8275->burst_space_code); |
| 540 | state_save_register_device_item(device, 0, i8275->burst_count_code); |
| 534 | 541 | } |
| 535 | 542 | |
| 536 | 543 | static DEVICE_RESET( i8275 ) |
src/mess/video/i8275.h
| r5484 | r5485 | |
| 12 | 12 | #ifndef __I8275_VIDEO__ |
| 13 | 13 | #define __I8275_VIDEO__ |
| 14 | 14 | |
| 15 | #include "devcb.h" |
| 16 | |
| 15 | 17 | /*************************************************************************** |
| 16 | 18 | MACROS |
| 17 | 19 | ***************************************************************************/ |
| r5484 | r5485 | |
| 22 | 24 | TYPE DEFINITIONS |
| 23 | 25 | ***************************************************************************/ |
| 24 | 26 | |
| 25 | | typedef void (*i8275_dma_request_func)(const device_config *device, int state); |
| 26 | | #define I8275_DMA_REQUEST(name) void name(const device_config *device, int state ) |
| 27 | | |
| 28 | | typedef void (*i8275_int_request_func)(const device_config *device, int state); |
| 29 | | #define I8275_INT_REQUEST(name) void name(const device_config *device, int state) |
| 30 | | |
| 31 | 27 | typedef void (*i8275_display_pixels_func)(const device_config *device, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt); |
| 32 | 28 | #define I8275_DISPLAY_PIXELS(name) void name(const device_config *device, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt) |
| 33 | 29 | |
| r5484 | r5485 | |
| 38 | 34 | const char *screen_tag; /* screen we are acting on */ |
| 39 | 35 | int width; /* char width in pixels */ |
| 40 | 36 | int char_delay; /* delay of display char */ |
| 41 | | i8275_dma_request_func dma_request; |
| 37 | |
| 38 | devcb_write_line out_drq_func; |
| 42 | 39 | |
| 43 | | i8275_int_request_func int_request; |
| 40 | devcb_write_line out_irq_func; |
| 44 | 41 | |
| 45 | 42 | i8275_display_pixels_func display_pixels; |
| 46 | 43 | }; |
| r5484 | r5485 | |
| 59 | 56 | /* updates the screen */ |
| 60 | 57 | void i8275_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect); |
| 61 | 58 | |
| 62 | | void i8275_dack_set_data(const device_config *device, UINT8 data); |
| 59 | WRITE8_DEVICE_HANDLER( i8275_dack_w ); |
| 63 | 60 | |
| 64 | 61 | /*************************************************************************** |
| 65 | 62 | DEVICE CONFIGURATION MACROS |