src/mess/video/isa_ega.c
| r14294 | r14295 | |
| 487 | 487 | ROM_REGION(0x4000, "user2", ROMREGION_ERASE00) |
| 488 | 488 | ROM_END |
| 489 | 489 | |
| 490 | /* |
| 491 | 0000 - MONOC PRIMARY, EGA COLOR, 40x25 |
| 492 | 0001 - MONOC PRIMARY, EGA COLOR, 80x25 |
| 493 | 0010 - MONOC PRIMARY, EGA HI RES EMULATE (SAME AS 0001) |
| 494 | 0011 - MONOC PRIMARY, EGA HI RES ENHANCED |
| 495 | 0100 - COLOR 40 PRIMARY, EGA MONOCHROME |
| 496 | 0101 - COLOR 80 PRIMARY, EGA MONOCHROME |
| 497 | |
| 498 | 0110 - MONOC SECONDARY, EGA COLOR, 40x24 |
| 499 | 0111 - MONOC SECONDARY, EGA COLOR, 80x25 |
| 500 | 1000 - MONOC SECONDARY, EGA HI RES EMULATE (SAME AS 0111) |
| 501 | 1001 - MONOC SECONDARY, EGA HI RES ENHANCED |
| 502 | 1010 - COLOR 40 SECONDARY, EGA |
| 503 | 1011 - COLOR 80 SECONDARY, EGA |
| 504 | |
| 505 | 1100 - RESERVED |
| 506 | 1101 - RESERVED |
| 507 | 1110 - RESERVED |
| 508 | 1111 - RESERVED |
| 509 | */ |
| 510 | |
| 511 | INPUT_PORTS_START( ega ) |
| 512 | PORT_START( "config" ) |
| 513 | PORT_CONFNAME( 0x0f, 0x0e, "dipswitches" ) |
| 514 | PORT_CONFSETTING( 0x00, "0000 - MDA PRIMARY, EGA COLOR, 40x25" ) |
| 515 | PORT_CONFSETTING( 0x08, "0001 - MDA PRIMARY, EGA COLOR, 80x25" ) |
| 516 | PORT_CONFSETTING( 0x04, "0010 - MDA PRIMARY, EGA HI RES EMULATE (SAME AS 0001)" ) |
| 517 | PORT_CONFSETTING( 0x0c, "0011 - MDA PRIMARY, EGA HI RES ENHANCED" ) |
| 518 | PORT_CONFSETTING( 0x02, "0100 - CGA 40 PRIMARY, EGA MONOCHROME" ) |
| 519 | PORT_CONFSETTING( 0x0a, "0101 - CGA 80 PRIMARY, EGA MONOCHROME" ) |
| 520 | PORT_CONFSETTING( 0x06, "0110 - MDA SECONDARY, EGA COLOR, 40x25" ) |
| 521 | PORT_CONFSETTING( 0x0e, "0111 - MDA SECONDARY, EGA COLOR, 80x25" ) |
| 522 | PORT_CONFSETTING( 0x01, "1000 - MDA SECONDARY, EGA HI RES EMULATE (SAME AS 0111)" ) |
| 523 | PORT_CONFSETTING( 0x09, "1001 - MDA SECONDARY, EGA HI RES ENHANCED" ) |
| 524 | PORT_CONFSETTING( 0x05, "1010 - COLOR 40 SECONDARY, EGA" ) |
| 525 | PORT_CONFSETTING( 0x0d, "1011 - COLOR 80 SECONDARY, EGA" ) |
| 526 | PORT_CONFSETTING( 0x03, "1100 - RESERVED" ) |
| 527 | PORT_CONFSETTING( 0x0b, "1101 - RESERVED" ) |
| 528 | PORT_CONFSETTING( 0x07, "1110 - RESERVED" ) |
| 529 | PORT_CONFSETTING( 0x0f, "1111 - RESERVED" ) |
| 530 | INPUT_PORTS_END |
| 531 | |
| 490 | 532 | //************************************************************************** |
| 491 | 533 | // GLOBAL VARIABLES |
| 492 | 534 | //************************************************************************** |
| r14294 | r14295 | |
| 513 | 555 | return ROM_NAME( ega ); |
| 514 | 556 | } |
| 515 | 557 | |
| 558 | ioport_constructor isa8_ega_device::device_input_ports() const |
| 559 | { |
| 560 | return INPUT_PORTS_NAME( ega ); |
| 561 | } |
| 562 | |
| 516 | 563 | //************************************************************************** |
| 517 | 564 | // LIVE DEVICE |
| 518 | 565 | //************************************************************************** |
| r14294 | r14295 | |
| 730 | 777 | UINT16 fg = ega->m_attribute.data[ attr & 0x0F ]; |
| 731 | 778 | UINT16 bg = ega->m_attribute.data[ attr >> 4 ]; |
| 732 | 779 | |
| 780 | if ( i == cursor_x && ega->m_frame_cnt & 0x08 ) |
| 781 | { |
| 782 | data = 0xFF; |
| 783 | } |
| 784 | |
| 733 | 785 | *p = ( data & 0x80 ) ? fg : bg; p++; |
| 734 | 786 | *p = ( data & 0x40 ) ? fg : bg; p++; |
| 735 | 787 | *p = ( data & 0x20 ) ? fg : bg; p++; |
| r14294 | r14295 | |
| 912 | 964 | |
| 913 | 965 | READ8_MEMBER(isa8_ega_device::pc_ega8_3c0_r ) |
| 914 | 966 | { |
| 915 | | UINT8 dips = 0x0e; // bits in reverse order 0111 == > 1110 |
| 916 | | /* |
| 917 | | 0000 - MONOC PRIMARY, EGA COLOR, 40x25 |
| 918 | | 0001 - MONOC PRIMARY, EGA COLOR, 80x25 |
| 919 | | 0010 - MONOC PRIMARY, EGA HI RES EMULATE (SAME AS 0001) |
| 920 | | 0011 - MONOC PRIMARY, EGA HI RES ENHANCED |
| 921 | | 0100 - COLOR 40 PRIMARY, EGA MONOCHROME |
| 922 | | 0101 - COLOR 80 PRIMARY, EGA MONOCHROME |
| 923 | | |
| 924 | | 0110 - MONOC SECONDARY, EGA COLOR, 40x24 |
| 925 | | 0111 - MONOC SECONDARY, EGA COLOR, 80x25 |
| 926 | | 1000 - MONOC SECONDARY, EGA HI RES EMULATE (SAME AS 0111) |
| 927 | | 1001 - MONOC SECONDARY, EGA HI RES ENHANCED |
| 928 | | 1010 - COLOR 40 SECONDARY, EGA |
| 929 | | 1011 - COLOR 80 SECONDARY, EGA |
| 930 | | |
| 931 | | 1100 - RESERVED |
| 932 | | 1101 - RESERVED |
| 933 | | 1110 - RESERVED |
| 934 | | 1111 - RESERVED |
| 935 | | */ |
| 936 | 967 | int data = 0xff; |
| 937 | 968 | |
| 938 | 969 | if ( VERBOSE_EGA ) |
| r14294 | r14295 | |
| 948 | 979 | |
| 949 | 980 | /* Feature Read */ |
| 950 | 981 | case 2: |
| 951 | | data = ( data & 0x0f ); |
| 952 | | data |= ( ( m_feature_control & 0x03 ) << 5 ); |
| 953 | | data |= ( m_vsync ? 0x00 : 0x80 ); |
| 954 | | data |= ( ( ( dips >> ( ( ( m_misc_output & 0x0c ) >> 2 ) ) ) & 0x01 ) << 4 ); |
| 982 | { |
| 983 | UINT8 dips = input_port_read(*this, "config" ); |
| 984 | |
| 985 | data = ( data & 0x0f ); |
| 986 | data |= ( ( m_feature_control & 0x03 ) << 5 ); |
| 987 | data |= ( m_vsync ? 0x00 : 0x80 ); |
| 988 | data |= ( ( ( dips >> ( ( ( m_misc_output & 0x0c ) >> 2 ) ) ) & 0x01 ) << 4 ); |
| 989 | } |
| 955 | 990 | break; |
| 956 | 991 | |
| 957 | 992 | /* Sequencer */ |
src/mess/video/crtc_ega.c
| r14294 | r14295 | |
| 255 | 255 | vsync_on_pos = crtc_ega->vert_retr_start; /* + 1 ?? */ |
| 256 | 256 | vsync_off_pos = vsync_on_pos + vert_sync_pix_width; |
| 257 | 257 | |
| 258 | | /* the Commodore PET computers program a horizontal synch pulse that extends |
| 259 | | past the scanline width. I assume that the real device will clamp it */ |
| 260 | 258 | if (hsync_off_pos > horiz_pix_total) |
| 261 | 259 | hsync_off_pos = horiz_pix_total; |
| 262 | 260 | |
| r14294 | r14295 | |
| 402 | 400 | { |
| 403 | 401 | if (crtc_ega->has_valid_parameters && (crtc_ega->vblank_on_timer != NULL)) |
| 404 | 402 | { |
| 405 | | crtc_ega->vblank_on_timer->adjust(crtc_ega->screen->time_until_pos(crtc_ega->vert_disp_end, crtc_ega->hsync_on_pos)); |
| 406 | | crtc_ega->vblank_off_timer->adjust(crtc_ega->screen->time_until_pos(0, crtc_ega->hsync_off_pos)); |
| 403 | crtc_ega->vblank_on_timer->adjust(crtc_ega->screen->time_until_pos(crtc_ega->vert_disp_end, crtc_ega->hsync_off_pos)); |
| 404 | crtc_ega->vblank_off_timer->adjust(crtc_ega->screen->time_until_pos(0, crtc_ega->hsync_on_pos)); |
| 407 | 405 | } |
| 408 | 406 | } |
| 409 | 407 | |
| r14294 | r14295 | |
| 620 | 618 | UINT8 last_cursor_blink_count = crtc_ega->cursor_blink_count; |
| 621 | 619 | crtc_ega->cursor_blink_count = crtc_ega->cursor_blink_count + 1; |
| 622 | 620 | |
| 621 | printf("update_cursor_state - "); |
| 623 | 622 | /* switch on cursor blinking mode */ |
| 624 | 623 | switch (crtc_ega->cursor_start_ras & 0x60) |
| 625 | 624 | { |
| r14294 | r14295 | |
| 627 | 626 | case 0x00: crtc_ega->cursor_state = TRUE; break; |
| 628 | 627 | |
| 629 | 628 | /* always off */ |
| 630 | | default: |
| 631 | 629 | case 0x20: crtc_ega->cursor_state = FALSE; break; |
| 632 | 630 | |
| 633 | 631 | /* fast blink */ |
| 634 | 632 | case 0x40: |
| 635 | 633 | if ((last_cursor_blink_count & 0x10) != (crtc_ega->cursor_blink_count & 0x10)) |
| 634 | { |
| 636 | 635 | crtc_ega->cursor_state = !crtc_ega->cursor_state; |
| 636 | } |
| 637 | 637 | break; |
| 638 | 638 | |
| 639 | 639 | /* slow blink */ |
| 640 | 640 | case 0x60: |
| 641 | 641 | if ((last_cursor_blink_count & 0x20) != (crtc_ega->cursor_blink_count & 0x20)) |
| 642 | { |
| 642 | 643 | crtc_ega->cursor_state = !crtc_ega->cursor_state; |
| 644 | } |
| 643 | 645 | break; |
| 644 | 646 | } |
| 645 | 647 | } |
| r14294 | r14295 | |
| 681 | 683 | /* check if the cursor is visible and is on this scanline */ |
| 682 | 684 | int cursor_visible = crtc_ega->cursor_state && |
| 683 | 685 | (ra >= (crtc_ega->cursor_start_ras & 0x1f)) && |
| 684 | | (ra <= crtc_ega->cursor_end_ras) && |
| 686 | ( (ra <= (crtc_ega->cursor_end_ras & 0x1f)) || ((crtc_ega->cursor_end_ras & 0x1f) == 0x00 )) && |
| 685 | 687 | (crtc_ega->cursor_addr >= crtc_ega->current_disp_addr) && |
| 686 | 688 | (crtc_ega->cursor_addr < (crtc_ega->current_disp_addr + ( crtc_ega->horiz_disp + 1 ))); |
| 687 | 689 | |