trunk/src/mess/drivers/cat.c
| r20474 | r20475 | |
| 182 | 182 | DECLARE_READ16_MEMBER(cat_modem_r); |
| 183 | 183 | DECLARE_WRITE16_MEMBER(cat_modem_w); |
| 184 | 184 | DECLARE_READ16_MEMBER(cat_6ms_counter_r); |
| 185 | | DECLARE_WRITE16_MEMBER(cat_video_enable_w); |
| 186 | | DECLARE_WRITE16_MEMBER(cat_test_mode_w); |
| 185 | DECLARE_WRITE16_MEMBER(cat_opr_w); |
| 186 | DECLARE_WRITE16_MEMBER(cat_tcb_w); |
| 187 | 187 | DECLARE_READ16_MEMBER(cat_2e80_r); |
| 188 | 188 | DECLARE_READ16_MEMBER(cat_0080_r); |
| 189 | 189 | DECLARE_READ16_MEMBER(cat_0000_r); |
| r20474 | r20475 | |
| 198 | 198 | */ |
| 199 | 199 | UINT16 m_6ms_counter; |
| 200 | 200 | UINT8 m_video_enable; |
| 201 | UINT8 m_video_invert; |
| 201 | 202 | UINT16 m_pr_cont; |
| 202 | 203 | UINT8 m_keyboard_line; |
| 203 | 204 | |
| r20474 | r20475 | |
| 425 | 426 | return m_6ms_counter; |
| 426 | 427 | } |
| 427 | 428 | |
| 428 | | // 0x840000: video enable (also controls hsync/vsync?) |
| 429 | | WRITE16_MEMBER( cat_state::cat_video_enable_w ) |
| 429 | /* 0x840001: 'opr' Output Port Register |
| 430 | * writing 0x1c (or possibly anything) here resets the watchdog |
| 431 | * if the watchdog expires an NMI is sent to the cpu |
| 432 | */ |
| 433 | WRITE16_MEMBER( cat_state::cat_opr_w ) |
| 430 | 434 | { |
| 431 | 435 | /* |
| 432 | | * 76543210 |
| 436 | * 76543210 (FEDCBA98 are ignored) |
| 433 | 437 | * |||||||\-- ? |
| 434 | 438 | * ||||||\--- ? |
| 435 | 439 | * |||||\---- Video enable (1 = video on, 0 = video off/screen black) |
| 436 | | * ||||\----- ? (always written as 1?) maybe hsync |
| 437 | | * |||\------ ? (always written as 1?) maybe vsync |
| 440 | * ||||\----- Watchdog reset? |
| 441 | * |||\------ Video invert (1 = black-on-white video; 0 = white-on-black) |
| 438 | 442 | * ||\------- ? |
| 439 | 443 | * |\-------- ? |
| 440 | 444 | * \--------- ? |
| 441 | 445 | */ |
| 442 | | |
| 443 | 446 | #ifdef DEBUG_VIDEO_ENABLE_W |
| 447 | //if ((data&0xef)!= 0x0c) |
| 444 | 448 | fprintf(stderr, "Video enable reg write: offset %06X, data %04X\n", 0x840000+(offset<<1), data); |
| 445 | 449 | #endif |
| 446 | 450 | m_video_enable = BIT( data, 2 ); |
| 451 | m_video_invert = 1-BIT( data, 4 ); |
| 447 | 452 | } |
| 448 | 453 | |
| 449 | | // 0x850000: test mode registers |
| 450 | | WRITE16_MEMBER( cat_state::cat_test_mode_w ) |
| 454 | // 0x850000: watchdog timer/video status |
| 455 | // implement me! |
| 456 | |
| 457 | // 0x860000: test regitser |
| 458 | // the power fail status reset bit also lives here somewhere? |
| 459 | WRITE16_MEMBER( cat_state::cat_tcb_w ) |
| 451 | 460 | { |
| 452 | 461 | #ifdef DEBUG_TEST_W |
| 453 | | fprintf(stderr, "Test mode reg write: offset %06X, data %04X\n", 0x860000+(offset<<1), data); |
| 462 | fprintf(stderr, "Test reg write: offset %06X, data %04X\n", 0x860000+(offset<<1), data); |
| 454 | 463 | #endif |
| 455 | 464 | } |
| 456 | 465 | |
| r20474 | r20475 | |
| 491 | 500 | *NOTE: DRAM rows 2 and 3 above are only usually populated in cat developer units!* |
| 492 | 501 | 0 1 1 ? ? * * * ? ? ? ? ? ? ? * * * * * * * * x W VIDEO CONTRL REGISTERS (reads as 0x2e80) |
| 493 | 502 | 1 x x x x x x x x x x x x x x x x x x * * * * * *GATE ARRAY 3 DECODES THIS AREA, GA3 IS ENABLED BY /IOCS1 FROM GA2* |
| 494 | | 1 0 0 Y Y 0 0 0 x x x x x x x x x x x * * * * 0 *IO AREA* Note byte reads in this area behave erratically if both Y bits are set while word reads work fine always |
| 503 | 1 0 0 Y Y 0 0 0 x x x x x x x x x x x * * * * 0 {'ga3'} *IO AREA* Note byte reads in this area behave erratically if both Y bits are set while word reads work fine always |
| 495 | 504 | x x x x 1 O OPEN BUS (reads as 0x80) |
| 496 | | 0 0 0 0 0 RW Floppy control lines (drive select, motor on, direction, step, side select, ?write gate?) |
| 497 | | 0 0 0 1 0 W Keyboard Row Select (reads as 0x00) |
| 498 | | 0 0 1 0 0 W Centronics Printer Data W (reads as 0x00) |
| 499 | | 0 0 1 1 0 RW Floppy data register |
| 500 | | 0 1 0 0 0 R Floppy status lines (write protect, ready, index, track0) |
| 505 | 0 0 0 0 0 RW {'fd.cont'} Floppy control lines (drive select, motor on, direction, step, side select, ?write gate?) |
| 506 | 0 0 0 1 0 W {'kb.wr'} Keyboard Row Select (reads as 0x00) |
| 507 | 0 0 1 0 0 W {'pr.data'} Centronics Printer Data W (reads as 0x00) |
| 508 | 0 0 1 1 0 RW {'fd.dwr' and 'fd.drd'} Floppy data read/write register; maybe the write gate value in fd.cont chooses which? |
| 509 | 0 1 0 0 0 R {'fd.status'} Floppy status lines (write protect, ready, index, track0) |
| 501 | 510 | 0 1 0 1 0 R Keyboard Column Read |
| 502 | 511 | 0 1 1 0 0 W? Unknown (reads as 0x00) |
| 503 | 512 | 0 1 1 1 0 RW Read: Battery status (MSB bit, 0 = ok, 1 = dead, other bits read as 0)/Write: Centronics Printer and Keyboard LED/Country Code Related |
| 504 | 513 | 1 x x x 0 W? Unknown (reads as 0x00) |
| 505 | | 1 0 0 x x 0 0 1 x x x x x x x x x x x * * * * 1 RW 68681 DUART at ic34 [controlled via GA2 /DUARTCS] |
| 506 | | 1 0 0 x x 0 1 0 x x x x x x x x x x * * * * * 0 RW Modem Chip AMI S35213 @ IC37 DATA BIT 7 ONLY [controlled via GA2 /SMCS] |
| 507 | | 1 0 0 x x 0 1 1 x x x x x x x x x x x x x x x * R Read: Fixed 16-bit counter from ga2. increments once another 16-bit counter clocked at 10mhz overflows |
| 508 | | 1 0 0 x x 1 0 0 x x x x x x x x x x x x x x x * W? Video/Sync enable register? (screen enable on bit 3?) (reads as 0x2e80) |
| 509 | | 1 0 0 x x 1 0 1 x x x x x x x x x x x x x x x * R? reads as 0x0100 0x0101 or 0x0102, some sort of test register or video status register? |
| 510 | | 1 0 0 x x 1 1 0 x x x x x x x x x x x x x x x * W? Test register? (reads as 0x0000) |
| 514 | 1 0 0 x x 0 0 1 x x x x x x x x x x x * * * * 1 RW {'duart'} 68681 DUART at ic34 [controlled via GA2 /DUARTCS] |
| 515 | 1 0 0 x x 0 1 0 x x x x x x x x x x * * * * * 0 RW {'modem'} Modem Chip AMI S35213 @ IC37 DATA BIT 7 ONLY [controlled via GA2 /SMCS] |
| 516 | 1 0 0 x x 0 1 1 x x x x x x x x x x x x x x x * R {'timer'} Read: Fixed 16-bit counter from ga2. increments every 6.5535ms when another 16-bit counter clocked at 10mhz overflows |
| 517 | 1 0 0 x x 1 0 0 x x x x x x x x x x x x x x x * W {'opr'} Output Port (Video/Sync enable and watchdog reset?) register (screen enable on bit 3?) (reads as 0x2e80) |
| 518 | 1 0 0 x x 1 0 1 x x x x x x x x x x x x x x x * R {'wdt'} Watchdog timer reads as 0x0100 0x0101 or 0x0102, some sort of test register or video status register? |
| 519 | 1 0 0 x x 1 1 0 x x x x x x x x x x x x x x x * R?W {'tcb'} test control bits: powerfail status in bit <?> (reads as 0x0000) |
| 511 | 520 | 1 0 0 x x 1 1 1 x x x x x x x x x x x x x x x * ? Unknown (reads as 0x2e80) |
| 512 | 521 | |
| 513 | 522 | 1 0 1 x x x x x x x x x x x x x x x x x x x x x O OPEN BUS (reads as 0x2e80) |
| r20474 | r20475 | |
| 534 | 543 | AM_RANGE(0x810000, 0x81001f) AM_DEVREADWRITE8_LEGACY("duart68681", duart68681_r, duart68681_w, 0xff ) AM_MIRROR(0x18FFE0) |
| 535 | 544 | AM_RANGE(0x820000, 0x82003f) AM_READWRITE(cat_modem_r,cat_modem_w) AM_MIRROR(0x18FFC0) // AMI S35213 Modem Chip, all access is on bit 7 |
| 536 | 545 | AM_RANGE(0x830000, 0x830001) AM_READ(cat_6ms_counter_r) AM_MIRROR(0x18FFFE) // 16bit 6ms counter clocked by output of another 16bit counter clocked at 10mhz |
| 537 | | AM_RANGE(0x840000, 0x840001) AM_READWRITE(cat_2e80_r,cat_video_enable_w) AM_MIRROR(0x18FFFE) // Video status/Output port register |
| 538 | | //AM_RANGE(0x850000, 0x850001) AM_READ(cat_video_status) AM_MIRROR(0x18FFFE) // video status read: hblank, vblank or draw? |
| 539 | | AM_RANGE(0x860000, 0x860001) AM_READWRITE(cat_0000_r, cat_test_mode_w) AM_MIRROR(0x18FFFE) // Test mode |
| 546 | AM_RANGE(0x840000, 0x840001) AM_READWRITE(cat_2e80_r,cat_opr_w) AM_MIRROR(0x18FFFE) // Output port register (video enable, invert, watchdog reset) |
| 547 | //AM_RANGE(0x850000, 0x850001) AM_READ(cat_video_status) AM_MIRROR(0x18FFFE) // video status and watchdog read: hblank, vblank or draw? |
| 548 | AM_RANGE(0x860000, 0x860001) AM_READWRITE(cat_0000_r, cat_tcb_w) AM_MIRROR(0x18FFFE) // Test mode |
| 540 | 549 | AM_RANGE(0x870000, 0x870001) AM_READ(cat_2e80_r) AM_MIRROR(0x18FFFE) // Open bus? |
| 541 | 550 | AM_RANGE(0xA00000, 0xA00001) AM_READ(cat_2e80_r) AM_MIRROR(0x1FFFFE) // Open bus? |
| 542 | 551 | AM_RANGE(0xC00000, 0xC00001) AM_READ(cat_2e80_r) AM_MIRROR(0x3FFFFE) // Open bus? |
| r20474 | r20475 | |
| 682 | 691 | { |
| 683 | 692 | m_duart_inp = 0x0e; |
| 684 | 693 | m_6ms_counter = 0; |
| 694 | m_video_enable = 1; |
| 695 | m_video_invert = 0; |
| 685 | 696 | m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cat_state::keyboard_callback),this)); |
| 686 | 697 | m_6ms_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cat_state::counter_6ms_callback),this)); |
| 687 | 698 | machine().device<nvram_device>("nvram")->set_base(m_svram, 0x4000); |
| r20474 | r20475 | |
| 715 | 726 | code = m_p_videoram[addr++]; |
| 716 | 727 | for (b = 15; b >= 0; b--) |
| 717 | 728 | { |
| 718 | | bitmap.pix16(y, horpos++) = (code >> b) & 0x01; |
| 729 | bitmap.pix16(y, horpos++) = ((code >> b) & 0x01) ^ m_video_invert; |
| 719 | 730 | } |
| 720 | 731 | } |
| 721 | 732 | } |