trunk/src/mame/drivers/dwarfd.c
| r30666 | r30667 | |
| 299 | 299 | #include "emu.h" |
| 300 | 300 | #include "cpu/i8085/i8085.h" |
| 301 | 301 | #include "sound/ay8910.h" |
| 302 | #include "video/i8275.h" |
| 302 | 303 | |
| 303 | 304 | class dwarfd_state : public driver_device |
| 304 | 305 | { |
| r30666 | r30667 | |
| 306 | 307 | dwarfd_state(const machine_config &mconfig, device_type type, const char *tag) |
| 307 | 308 | : driver_device(mconfig, type, tag), |
| 308 | 309 | m_maincpu(*this,"maincpu"), |
| 309 | | m_gfxdecode(*this, "gfxdecode"), |
| 310 | | m_palette(*this, "palette") |
| 310 | m_palette(*this, "palette"), |
| 311 | m_crtc(*this, "i8275"), |
| 312 | m_charmap(*this, "gfx1"), |
| 313 | m_dsw2(*this, "DSW2") |
| 311 | 314 | { } |
| 312 | 315 | |
| 313 | 316 | /* video-related */ |
| 314 | | int m_bank; |
| 315 | | int m_line; |
| 316 | | int m_idx; |
| 317 | 317 | int m_crt_access; |
| 318 | 318 | |
| 319 | | /* i8275 */ |
| 320 | | int m_i8275Command; |
| 321 | | int m_i8275HorizontalCharactersRow; |
| 322 | | int m_i8275CommandSeqCnt; |
| 323 | | int m_i8275SpacedRows; |
| 324 | | int m_i8275VerticalRows; |
| 325 | | int m_i8275VerticalRetraceRows; |
| 326 | | int m_i8275Underline; |
| 327 | | int m_i8275Lines; |
| 328 | | int m_i8275LineCounterMode; |
| 329 | | int m_i8275FieldAttributeMode; |
| 330 | | int m_i8275CursorFormat; |
| 331 | | int m_i8275HorizontalRetrace; |
| 332 | | |
| 333 | 319 | /* memory */ |
| 334 | 320 | UINT8 m_dw_ram[0x1000]; |
| 335 | | UINT8 m_videobuf[0x8000]; |
| 336 | 321 | |
| 337 | 322 | required_device<cpu_device> m_maincpu; |
| 338 | | required_device<gfxdecode_device> m_gfxdecode; |
| 339 | 323 | required_device<palette_device> m_palette; |
| 324 | required_device<i8275_device> m_crtc; |
| 325 | required_memory_region m_charmap; |
| 326 | required_ioport m_dsw2; |
| 340 | 327 | |
| 341 | | DECLARE_WRITE8_MEMBER(i8275_preg_w); |
| 342 | | DECLARE_READ8_MEMBER(i8275_preg_r); |
| 343 | | DECLARE_WRITE8_MEMBER(i8275_creg_w); |
| 344 | | DECLARE_READ8_MEMBER(i8275_sreg_r); |
| 345 | 328 | DECLARE_READ8_MEMBER(dwarfd_ram_r); |
| 346 | 329 | DECLARE_WRITE8_MEMBER(dwarfd_ram_w); |
| 347 | 330 | DECLARE_WRITE8_MEMBER(output1_w); |
| 348 | 331 | DECLARE_WRITE8_MEMBER(output2_w); |
| 349 | 332 | DECLARE_READ8_MEMBER(qc_b8_r); |
| 350 | 333 | DECLARE_WRITE_LINE_MEMBER(dwarfd_sod_callback); |
| 334 | DECLARE_WRITE_LINE_MEMBER(drq_w); |
| 351 | 335 | DECLARE_DRIVER_INIT(qc); |
| 352 | 336 | DECLARE_DRIVER_INIT(dwarfd); |
| 353 | 337 | virtual void machine_start(); |
| 354 | 338 | virtual void machine_reset(); |
| 355 | | virtual void video_start(); |
| 356 | 339 | DECLARE_PALETTE_INIT(dwarfd); |
| 357 | | UINT32 screen_update_dwarfd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 358 | | TIMER_DEVICE_CALLBACK_MEMBER(dwarfd_interrupt); |
| 359 | | void drawCrt( bitmap_rgb32 &bitmap,const rectangle &cliprect ); |
| 340 | I8275_DRAW_CHARACTER_MEMBER(display_pixels); |
| 341 | I8275_DRAW_CHARACTER_MEMBER(qc_display_pixels); |
| 360 | 342 | }; |
| 361 | 343 | |
| 362 | 344 | |
| 363 | | //should be taken from crt params |
| 364 | | static const int maxy = 25; |
| 365 | | static const int maxx = 80; |
| 366 | | |
| 367 | | |
| 368 | | #define TOPLINE 7 |
| 369 | | #define BOTTOMLINE 18 |
| 370 | | |
| 371 | | #define CHARACTERS_UNDEFINED -1 |
| 372 | | |
| 373 | | enum |
| 374 | | { |
| 375 | | I8275_COMMAND_RESET=0, |
| 376 | | I8275_COMMAND_START, |
| 377 | | I8275_COMMAND_STOP, |
| 378 | | I8275_COMMAND_READ_LIGHT_PEN, |
| 379 | | I8275_COMMAND_LOAD_CURSOR, |
| 380 | | I8275_COMMAND_EI, |
| 381 | | I8275_COMMAND_DI, |
| 382 | | I8275_COMMAND_PRESET, |
| 383 | | |
| 384 | | NUM_I8275_COMMANDS |
| 385 | | }; |
| 386 | | |
| 387 | | enum |
| 388 | | { |
| 389 | | I8275_COMMAND_RESET_LENGTH = 4, |
| 390 | | I8275_COMMAND_START_LENGTH = 0, |
| 391 | | I8275_COMMAND_STOP_LENGTH = 0, |
| 392 | | I8275_COMMAND_EI_LENGTH = 0, |
| 393 | | I8275_COMMAND_DI_LENGTH = 0, |
| 394 | | I8275_COMMAND_READ_LIGHT_PEN_LENGTH = 2, |
| 395 | | I8275_COMMAND_LOAD_CURSOR_LENGTH = 2, |
| 396 | | I8275_COMMAND_PRESET_LENGTH = 0 |
| 397 | | }; |
| 398 | | |
| 399 | | |
| 400 | | WRITE8_MEMBER(dwarfd_state::i8275_preg_w)//param reg |
| 401 | | { |
| 402 | | switch (m_i8275Command) |
| 403 | | { |
| 404 | | case I8275_COMMAND_RESET: |
| 405 | | { |
| 406 | | switch (m_i8275CommandSeqCnt) |
| 407 | | { |
| 408 | | case 4: |
| 409 | | { |
| 410 | | //screen byte comp byte 1 |
| 411 | | m_i8275SpacedRows = data >> 7; |
| 412 | | m_i8275HorizontalCharactersRow = (data & 0x7f) + 1; |
| 413 | | if (m_i8275HorizontalCharactersRow > 80) |
| 414 | | { |
| 415 | | logerror("i8275 Undefined num of characters/Row! = %d\n", m_i8275HorizontalCharactersRow); |
| 416 | | m_i8275HorizontalCharactersRow = CHARACTERS_UNDEFINED; |
| 417 | | } |
| 418 | | else |
| 419 | | { |
| 420 | | logerror("i8275 %d characters/row\n", m_i8275HorizontalCharactersRow); |
| 421 | | } |
| 422 | | if (m_i8275SpacedRows & 1) |
| 423 | | { |
| 424 | | logerror("i8275 spaced rows\n"); |
| 425 | | } |
| 426 | | else |
| 427 | | { |
| 428 | | logerror("i8275 normal rows\n"); |
| 429 | | } |
| 430 | | m_i8275CommandSeqCnt--; |
| 431 | | } |
| 432 | | break; |
| 433 | | |
| 434 | | case 3: |
| 435 | | { |
| 436 | | //screen byte comp byte 2 |
| 437 | | m_i8275VerticalRows = (data & 0x3f) + 1; |
| 438 | | m_i8275VerticalRetraceRows = (data >> 6) + 1; |
| 439 | | |
| 440 | | logerror("i8275 %d rows\n", m_i8275VerticalRows); |
| 441 | | logerror("i8275 %d vertical retrace rows\n", m_i8275VerticalRetraceRows); |
| 442 | | |
| 443 | | m_i8275CommandSeqCnt--; |
| 444 | | } |
| 445 | | break; |
| 446 | | |
| 447 | | case 2: |
| 448 | | { |
| 449 | | //screen byte comp byte 3 |
| 450 | | m_i8275Underline = (data >> 4) + 1; |
| 451 | | m_i8275Lines = (data & 0xf) + 1; |
| 452 | | logerror("i8275 underline placement: %d\n", m_i8275Underline); |
| 453 | | logerror("i8275 %d lines/row\n", m_i8275Lines); |
| 454 | | |
| 455 | | m_i8275CommandSeqCnt--; |
| 456 | | } |
| 457 | | break; |
| 458 | | |
| 459 | | case 1: |
| 460 | | { |
| 461 | | //screen byte comp byte 4 |
| 462 | | m_i8275LineCounterMode = data >> 7; |
| 463 | | m_i8275FieldAttributeMode = (data >> 6) & 1; |
| 464 | | m_i8275CursorFormat = (data >> 4) & 3; |
| 465 | | m_i8275HorizontalRetrace = ((data & 0xf) + 1) << 1; |
| 466 | | logerror("i8275 line counter mode: %d\n", m_i8275LineCounterMode); |
| 467 | | if (m_i8275FieldAttributeMode) |
| 468 | | { |
| 469 | | logerror("i8275 field attribute mode non-transparent\n"); |
| 470 | | } |
| 471 | | else |
| 472 | | { |
| 473 | | logerror("i8275 field attribute mode transparent\n"); |
| 474 | | } |
| 475 | | |
| 476 | | switch (m_i8275CursorFormat) |
| 477 | | { |
| 478 | | case 0: {logerror("i8275 cursor format - blinking reverse video block\n");} break; |
| 479 | | case 1: {logerror("i8275 cursor format - blinking underline\n");}break; |
| 480 | | case 2: {logerror("i8275 cursor format - nonblinking reverse video block\n");}break; |
| 481 | | case 3: {logerror("i8275 cursor format - nonblinking underline\n");}break; |
| 482 | | } |
| 483 | | |
| 484 | | logerror("i8275 %d chars for horizontal retrace\n",m_i8275HorizontalRetrace ); |
| 485 | | m_i8275CommandSeqCnt--; |
| 486 | | } |
| 487 | | break; |
| 488 | | |
| 489 | | default: |
| 490 | | { |
| 491 | | logerror("i8275 illegal\n"); |
| 492 | | } |
| 493 | | |
| 494 | | } |
| 495 | | } |
| 496 | | break; |
| 497 | | |
| 498 | | case I8275_COMMAND_START: |
| 499 | | { |
| 500 | | } |
| 501 | | break; |
| 502 | | |
| 503 | | case I8275_COMMAND_STOP: |
| 504 | | { |
| 505 | | } |
| 506 | | break; |
| 507 | | |
| 508 | | } |
| 509 | | |
| 510 | | } |
| 511 | | |
| 512 | | READ8_MEMBER(dwarfd_state::i8275_preg_r)//param reg |
| 513 | | { |
| 514 | | return 0; |
| 515 | | } |
| 516 | | |
| 517 | | WRITE8_MEMBER(dwarfd_state::i8275_creg_w)//comand reg |
| 518 | | { |
| 519 | | switch (data>>5) |
| 520 | | { |
| 521 | | case 0: |
| 522 | | { |
| 523 | | /* reset */ |
| 524 | | m_i8275Command = I8275_COMMAND_RESET; |
| 525 | | m_i8275CommandSeqCnt = I8275_COMMAND_RESET_LENGTH; |
| 526 | | } |
| 527 | | break; |
| 528 | | |
| 529 | | case 5: |
| 530 | | { |
| 531 | | /* enable interrupt */ |
| 532 | | m_i8275Command = I8275_COMMAND_EI; |
| 533 | | m_i8275CommandSeqCnt = I8275_COMMAND_EI_LENGTH; |
| 534 | | } |
| 535 | | break; |
| 536 | | |
| 537 | | case 6: |
| 538 | | { |
| 539 | | /* disable interrupt */ |
| 540 | | m_i8275Command = I8275_COMMAND_DI; |
| 541 | | m_i8275CommandSeqCnt = I8275_COMMAND_DI_LENGTH; |
| 542 | | } |
| 543 | | break; |
| 544 | | |
| 545 | | case 7: |
| 546 | | { |
| 547 | | /* preset counters */ |
| 548 | | m_i8275CommandSeqCnt = I8275_COMMAND_PRESET_LENGTH; |
| 549 | | |
| 550 | | } |
| 551 | | break; |
| 552 | | } |
| 553 | | } |
| 554 | | |
| 555 | | READ8_MEMBER(dwarfd_state::i8275_sreg_r)//status |
| 556 | | { |
| 557 | | return 0; |
| 558 | | } |
| 559 | | |
| 560 | 345 | READ8_MEMBER(dwarfd_state::dwarfd_ram_r) |
| 561 | 346 | { |
| 562 | 347 | if (m_crt_access == 0) |
| r30666 | r30667 | |
| 565 | 350 | } |
| 566 | 351 | else |
| 567 | 352 | { |
| 568 | | m_videobuf[m_line * 256 + m_idx] = m_dw_ram[offset]; |
| 569 | | m_idx++; |
| 353 | m_crtc->dack_w(space, 0, m_dw_ram[offset], mem_mask); |
| 570 | 354 | return m_dw_ram[offset]; |
| 571 | 355 | } |
| 572 | 356 | } |
| r30666 | r30667 | |
| 622 | 406 | AM_RANGE(0x01, 0x01) AM_DEVREAD("aysnd", ay8910_device, data_r) |
| 623 | 407 | AM_RANGE(0x02, 0x03) AM_DEVWRITE("aysnd", ay8910_device, data_address_w) |
| 624 | 408 | |
| 625 | | AM_RANGE(0x20, 0x20) AM_READWRITE(i8275_preg_r, i8275_preg_w) |
| 626 | | AM_RANGE(0x21, 0x21) AM_READWRITE(i8275_sreg_r, i8275_creg_w) |
| 409 | AM_RANGE(0x20, 0x21) AM_DEVREADWRITE("i8275", i8275_device, read, write) |
| 627 | 410 | AM_RANGE(0x40, 0x40) AM_WRITENOP // unknown |
| 628 | 411 | AM_RANGE(0x60, 0x60) AM_WRITE(output1_w) |
| 629 | 412 | AM_RANGE(0x80, 0x80) AM_WRITE(output2_w) |
| r30666 | r30667 | |
| 785 | 568 | INPUT_PORTS_END |
| 786 | 569 | |
| 787 | 570 | |
| 788 | | void dwarfd_state::video_start() |
| 571 | I8275_DRAW_CHARACTER_MEMBER(dwarfd_state::display_pixels) |
| 789 | 572 | { |
| 573 | int i; |
| 574 | int bank = ((gpa & 2) ? 0 : 4) + (gpa & 1) + ((m_dsw2->read() & 4) >> 1); |
| 575 | const rgb_t *palette = m_palette->palette()->entry_list_raw(); |
| 576 | UINT16 pixels = m_charmap->u16((linecount & 7) + ((charcode + (bank * 128)) << 3)); |
| 577 | |
| 578 | //if(!linecount) |
| 579 | // logerror("%d %d %02x %02x %02x %02x %02x %02x %02x\n", x/8, y/8, charcode, lineattr, lten, rvv, vsp, gpa, hlgt); |
| 580 | |
| 581 | for(i=0;i<8;i+=2) |
| 582 | { |
| 583 | UINT8 pixel = (pixels >> (i * 2)) & 0xf; |
| 584 | bitmap.pix32(y, x + i) = palette[pixel & 0xe]; |
| 585 | bitmap.pix32(y, x + i + 1) = palette[(pixel & 1) ? 0 : (pixel & 0xe)]; |
| 586 | } |
| 790 | 587 | } |
| 791 | 588 | |
| 792 | | void dwarfd_state::drawCrt( bitmap_rgb32 &bitmap,const rectangle &cliprect ) |
| 589 | I8275_DRAW_CHARACTER_MEMBER(dwarfd_state::qc_display_pixels) |
| 793 | 590 | { |
| 794 | | int x, y; |
| 795 | | for (y = 0; y < maxy; y++) |
| 796 | | { |
| 797 | | int count = y * 256; |
| 798 | | int bank2 = 4; |
| 591 | int i; |
| 592 | int bank = gpa; |
| 593 | const rgb_t *palette = m_palette->palette()->entry_list_raw(); |
| 594 | UINT16 pixels = m_charmap->u16((linecount & 7) + ((charcode + (bank * 128)) << 3)); |
| 799 | 595 | |
| 800 | | if (y < TOPLINE || y > BOTTOMLINE) |
| 801 | | { |
| 802 | | bank2 = 0; |
| 803 | | } |
| 804 | | for (x = 0; x < maxx; x++) |
| 805 | | { |
| 806 | | int tile = 0; |
| 596 | //if(!linecount) |
| 597 | // logerror("%d %d %02x %02x %02x %02x %02x %02x %02x\n", x/8, y/8, charcode, lineattr, lten, rvv, vsp, gpa, hlgt); |
| 807 | 598 | |
| 808 | | int b = 0; //end marker |
| 809 | | while (b == 0) |
| 810 | | { |
| 811 | | if (count < 0x8000) |
| 812 | | tile = m_videobuf[count++]; |
| 813 | | else |
| 814 | | return; |
| 599 | if(vsp) |
| 600 | pixels ^= 0xeeee; // FIXME: What is this really supposed to do? |
| 815 | 601 | |
| 816 | | if (tile & 0x80) |
| 817 | | { |
| 818 | | if ((tile & 0xfc) == 0xf0) |
| 819 | | { |
| 820 | | switch (tile & 3) |
| 821 | | { |
| 822 | | case 0: |
| 823 | | case 1: break; |
| 824 | | |
| 825 | | case 2: |
| 826 | | case 3: return; |
| 827 | | } |
| 828 | | } |
| 829 | | if ((tile & 0xc0) == 0x80) |
| 830 | | { |
| 831 | | m_bank = (tile >> 2) & 3; |
| 832 | | } |
| 833 | | if ((tile & 0xc0) == 0xc0) |
| 834 | | { |
| 835 | | b = 1; |
| 836 | | tile = machine().rand() & 0x7f;//(tile >> 2) & 0xf; |
| 837 | | } |
| 838 | | } |
| 839 | | else |
| 840 | | b = 1; |
| 841 | | } |
| 842 | | m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, |
| 843 | | tile + (m_bank + bank2) * 128, |
| 844 | | 0, |
| 845 | | 0, 0, |
| 846 | | x*8,y*8,0); |
| 847 | | } |
| 602 | for(i=0;i<8;i+=2) |
| 603 | { |
| 604 | UINT8 pixel = (pixels >> (i * 2)) & 0xf; |
| 605 | bitmap.pix32(y, x + i) = palette[pixel & 0xe]; |
| 606 | bitmap.pix32(y, x + i + 1) = palette[(pixel & 1) ? 0 : (pixel & 0xe)]; |
| 848 | 607 | } |
| 849 | 608 | } |
| 850 | 609 | |
| 851 | | |
| 852 | | UINT32 dwarfd_state::screen_update_dwarfd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 853 | | { |
| 854 | | bitmap.fill(m_palette->black_pen(), cliprect); |
| 855 | | drawCrt(bitmap, cliprect); |
| 856 | | return 0; |
| 857 | | } |
| 858 | | |
| 859 | 610 | WRITE_LINE_MEMBER(dwarfd_state::dwarfd_sod_callback) |
| 860 | 611 | { |
| 861 | 612 | m_crt_access = state; |
| 862 | 613 | } |
| 863 | 614 | |
| 864 | | TIMER_DEVICE_CALLBACK_MEMBER(dwarfd_state::dwarfd_interrupt) |
| 615 | WRITE_LINE_MEMBER(dwarfd_state::drq_w) |
| 865 | 616 | { |
| 866 | | int scanline = param; |
| 617 | if(state && !m_crt_access) |
| 618 | m_maincpu->set_input_line(I8085_RST65_LINE, ASSERT_LINE); |
| 619 | else if(!state) |
| 620 | m_maincpu->set_input_line(I8085_RST65_LINE, CLEAR_LINE); |
| 867 | 621 | |
| 868 | | if((scanline % 8) != 0) |
| 869 | | return; |
| 870 | | |
| 871 | | if (scanline < 25*8) |
| 872 | | { |
| 873 | | m_maincpu->set_input_line(I8085_RST65_LINE, HOLD_LINE); // 34 - every 8th line |
| 874 | | m_line = scanline/8; |
| 875 | | m_idx = 0; |
| 876 | | } |
| 877 | | else |
| 878 | | { |
| 879 | | if (scanline == 25*8) |
| 880 | | { |
| 881 | | m_maincpu->set_input_line(I8085_RST55_LINE, HOLD_LINE);//2c - generated by crt - end of frame |
| 882 | | } |
| 883 | | } |
| 884 | 622 | } |
| 885 | 623 | |
| 886 | 624 | #if 0 |
| r30666 | r30667 | |
| 892 | 630 | { 0,1,2,3}, |
| 893 | 631 | {8,0,24,16 }, |
| 894 | 632 | //{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, |
| 895 | | { 7*32, 6*32, 5*32, 4*32, 3*32, 2*32, 1*32, 0*32 }, |
| 633 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 896 | 634 | 8*32 |
| 897 | 635 | }; |
| 898 | 636 | #endif |
| r30666 | r30667 | |
| 906 | 644 | {8,12,0,4,24,28,16,20 }, |
| 907 | 645 | // {12,8,4,0,28,24,20,16 }, |
| 908 | 646 | //{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, |
| 909 | | { 7*32, 6*32, 5*32, 4*32, 3*32, 2*32, 1*32, 0*32 }, |
| 647 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 910 | 648 | 8*32 |
| 911 | 649 | }; |
| 912 | 650 | |
| r30666 | r30667 | |
| 919 | 657 | { 0 }, |
| 920 | 658 | {8,0,24,16 }, |
| 921 | 659 | //{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, |
| 922 | | { 7*32, 6*32, 5*32, 4*32, 3*32, 2*32, 1*32, 0*32 }, |
| 660 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 923 | 661 | 8*32 |
| 924 | 662 | }; |
| 925 | 663 | |
| r30666 | r30667 | |
| 931 | 669 | { 1 }, |
| 932 | 670 | {8,0,24,16 }, |
| 933 | 671 | //{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, |
| 934 | | { 7*32, 6*32, 5*32, 4*32, 3*32, 2*32, 1*32, 0*32 }, |
| 672 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 935 | 673 | 8*32 |
| 936 | 674 | }; |
| 937 | 675 | |
| r30666 | r30667 | |
| 943 | 681 | { 2 }, |
| 944 | 682 | {8,0,24,16 }, |
| 945 | 683 | //{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, |
| 946 | | { 7*32, 6*32, 5*32, 4*32, 3*32, 2*32, 1*32, 0*32 }, |
| 684 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 947 | 685 | 8*32 |
| 948 | 686 | }; |
| 949 | 687 | |
| r30666 | r30667 | |
| 955 | 693 | { 3 }, |
| 956 | 694 | {8,0,24,16 }, |
| 957 | 695 | //{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, |
| 958 | | { 7*32, 6*32, 5*32, 4*32, 3*32, 2*32, 1*32, 0*32 }, |
| 696 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 959 | 697 | 8*32 |
| 960 | 698 | }; |
| 961 | 699 | /* |
| r30666 | r30667 | |
| 967 | 705 | { 1,1}, |
| 968 | 706 | {6,6,2,2,14,14,10,10 }, |
| 969 | 707 | //{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, |
| 970 | | { 7*16, 6*16, 5*16, 4*16, 3*16, 2*16, 1*16, 0*16 }, |
| 708 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 971 | 709 | 8*16 |
| 972 | 710 | }; |
| 973 | 711 | */ |
| r30666 | r30667 | |
| 1001 | 739 | |
| 1002 | 740 | void dwarfd_state::machine_start() |
| 1003 | 741 | { |
| 1004 | | save_item(NAME(m_bank)); |
| 1005 | | save_item(NAME(m_line)); |
| 1006 | | save_item(NAME(m_idx)); |
| 1007 | 742 | save_item(NAME(m_crt_access)); |
| 1008 | | |
| 1009 | | /* i8275 */ |
| 1010 | | save_item(NAME(m_i8275Command)); |
| 1011 | | save_item(NAME(m_i8275HorizontalCharactersRow)); |
| 1012 | | save_item(NAME(m_i8275CommandSeqCnt)); |
| 1013 | | save_item(NAME(m_i8275SpacedRows)); |
| 1014 | | save_item(NAME(m_i8275VerticalRows)); |
| 1015 | | save_item(NAME(m_i8275VerticalRetraceRows)); |
| 1016 | | save_item(NAME(m_i8275Underline)); |
| 1017 | | save_item(NAME(m_i8275Lines)); |
| 1018 | | save_item(NAME(m_i8275LineCounterMode)); |
| 1019 | | save_item(NAME(m_i8275FieldAttributeMode)); |
| 1020 | | save_item(NAME(m_i8275CursorFormat)); |
| 1021 | | save_item(NAME(m_i8275HorizontalRetrace)); |
| 1022 | 743 | } |
| 1023 | 744 | |
| 1024 | 745 | void dwarfd_state::machine_reset() |
| 1025 | 746 | { |
| 1026 | | m_bank = 0; |
| 1027 | | m_line = 0; |
| 1028 | | m_idx = 0; |
| 1029 | 747 | m_crt_access = 0; |
| 1030 | | m_i8275Command = 0; |
| 1031 | | m_i8275HorizontalCharactersRow = 0; |
| 1032 | | m_i8275CommandSeqCnt = 0; |
| 1033 | | m_i8275SpacedRows = 0; |
| 1034 | | m_i8275VerticalRows = 0; |
| 1035 | | m_i8275VerticalRetraceRows = 0; |
| 1036 | | m_i8275Underline = 0; |
| 1037 | | m_i8275Lines = 0; |
| 1038 | | m_i8275LineCounterMode = 0; |
| 1039 | | m_i8275FieldAttributeMode = 0; |
| 1040 | | m_i8275CursorFormat = 0; |
| 1041 | | m_i8275HorizontalRetrace = 0; |
| 1042 | 748 | } |
| 1043 | 749 | |
| 1044 | 750 | static MACHINE_CONFIG_START( dwarfd, dwarfd_state ) |
| r30666 | r30667 | |
| 1049 | 755 | MCFG_I8085A_SOD(WRITELINE(dwarfd_state,dwarfd_sod_callback)) |
| 1050 | 756 | MCFG_CPU_PROGRAM_MAP(mem_map) |
| 1051 | 757 | MCFG_CPU_IO_MAP(io_map) |
| 1052 | | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dwarfd_state, dwarfd_interrupt, "screen", 0, 1) |
| 1053 | 758 | |
| 1054 | | |
| 1055 | 759 | /* video hardware */ |
| 1056 | 760 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1057 | 761 | MCFG_SCREEN_REFRESH_RATE(60) |
| 1058 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1059 | 762 | MCFG_SCREEN_SIZE(272*2, 200+4*8) |
| 1060 | 763 | MCFG_SCREEN_VISIBLE_AREA(0, 272*2-1, 0, 200-1) |
| 1061 | | MCFG_SCREEN_UPDATE_DRIVER(dwarfd_state, screen_update_dwarfd) |
| 764 | MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update) |
| 1062 | 765 | |
| 766 | MCFG_DEVICE_ADD("i8275", I8275, 10595000/3) |
| 767 | MCFG_I8275_CHARACTER_WIDTH(8) |
| 768 | MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(dwarfd_state, display_pixels) |
| 769 | MCFG_I8275_IRQ_CALLBACK(INPUTLINE("maincpu", I8085_RST55_LINE)) |
| 770 | MCFG_I8275_DRQ_CALLBACK(WRITELINE(dwarfd_state, drq_w)) |
| 771 | |
| 1063 | 772 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", dwarfd) |
| 1064 | 773 | MCFG_PALETTE_ADD("palette", 0x100) |
| 1065 | 774 | MCFG_PALETTE_INIT_OWNER(dwarfd_state, dwarfd) |
| r30666 | r30667 | |
| 1076 | 785 | MCFG_CPU_MODIFY("maincpu") |
| 1077 | 786 | MCFG_CPU_PROGRAM_MAP(qc_map) |
| 1078 | 787 | MCFG_CPU_IO_MAP(qc_io_map) |
| 788 | |
| 789 | MCFG_DEVICE_MODIFY("i8275") |
| 790 | MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(dwarfd_state, qc_display_pixels) |
| 1079 | 791 | MACHINE_CONFIG_END |
| 1080 | 792 | |
| 1081 | 793 | /* Dwarfs den PROM explanation: |
| r30666 | r30667 | |
| 1300 | 1012 | // src[i] = src[i] & 0xe0; |
| 1301 | 1013 | } |
| 1302 | 1014 | |
| 1303 | | save_item(NAME(m_videobuf)); |
| 1304 | 1015 | save_item(NAME(m_dw_ram)); |
| 1305 | 1016 | |
| 1306 | | memset(m_videobuf, 0, sizeof(m_videobuf)); |
| 1307 | 1017 | memset(m_dw_ram, 0, sizeof(m_dw_ram)); |
| 1308 | 1018 | |
| 1309 | 1019 | } |
| r30666 | r30667 | |
| 1323 | 1033 | } |
| 1324 | 1034 | |
| 1325 | 1035 | /* YEAR NAME PARENT MACHINE INPUT INIT ORENTATION, COMPANY FULLNAME FLAGS */ |
| 1326 | | GAME( 1981, dwarfd, 0, dwarfd, dwarfd, dwarfd_state, dwarfd, ORIENTATION_FLIP_Y, "Electro-Sport", "Draw Poker III / Dwarfs Den (Dwarf Gfx)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) |
| 1327 | | GAME( 1981, dwarfda, dwarfd, dwarfd, dwarfd, dwarfd_state, dwarfd, ORIENTATION_FLIP_Y, "Electro-Sport", "Draw Poker III / Dwarfs Den (Card Gfx)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) |
| 1328 | | GAME( 1983, quarterh, 0, dwarfd, quarterh, dwarfd_state, dwarfd, ORIENTATION_FLIP_Y, "Electro-Sport", "Quarter Horse (set 1, Pioneer PR-8210)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) |
| 1329 | | GAME( 1983, quarterha, quarterh, dwarfd, quarterh, dwarfd_state, dwarfd, ORIENTATION_FLIP_Y, "Electro-Sport", "Quarter Horse (set 2, Pioneer PR-8210)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) |
| 1330 | | GAME( 1983, quarterhb, quarterh, dwarfd, quarterh, dwarfd_state, dwarfd, ORIENTATION_FLIP_Y, "Electro-Sport", "Quarter Horse (set 3, Pioneer LD-V2000)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) |
| 1331 | | GAME( 1995, qc, 0, qc, quarterh, dwarfd_state, qc, ORIENTATION_FLIP_Y, "ArJay Exports/Prestige Games", "Quarter Horse Classic", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING ) |
| 1036 | GAME( 1981, dwarfd, 0, dwarfd, dwarfd, dwarfd_state, dwarfd, 0, "Electro-Sport", "Draw Poker III / Dwarfs Den (Dwarf Gfx)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) |
| 1037 | GAME( 1981, dwarfda, dwarfd, dwarfd, dwarfd, dwarfd_state, dwarfd, 0, "Electro-Sport", "Draw Poker III / Dwarfs Den (Card Gfx)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) |
| 1038 | GAME( 1983, quarterh, 0, dwarfd, quarterh, dwarfd_state, dwarfd, 0, "Electro-Sport", "Quarter Horse (set 1, Pioneer PR-8210)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) |
| 1039 | GAME( 1983, quarterha, quarterh, dwarfd, quarterh, dwarfd_state, dwarfd, 0, "Electro-Sport", "Quarter Horse (set 2, Pioneer PR-8210)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) |
| 1040 | GAME( 1983, quarterhb, quarterh, dwarfd, quarterh, dwarfd_state, dwarfd, 0, "Electro-Sport", "Quarter Horse (set 3, Pioneer LD-V2000)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) |
| 1041 | GAME( 1995, qc, 0, qc, quarterh, dwarfd_state, qc, 0, "ArJay Exports/Prestige Games", "Quarter Horse Classic", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING ) |