src/mess/drivers/pc8801.c
| r15896 | r15897 | |
| 94 | 94 | - Explosion (fails to load ADPCM data?) |
| 95 | 95 | - F-15 Strike Eagle |
| 96 | 96 | - F2 Grand Prix ("Boot dekimasen") |
| 97 | (Fancy Promenade) |
| 97 | 98 | |
| 98 | | |
| 99 | 99 | - Harakiri |
| 100 | 100 | - Kaseijin (app) (code snippet is empty at some point) |
| 101 | 101 | - MakaiMura (attempts to r/w the sio ports, but it's clearly crashed) |
| r15896 | r15897 | |
| 256 | 256 | UINT8 inverse; |
| 257 | 257 | } crtc_t; |
| 258 | 258 | |
| 259 | typedef struct |
| 260 | { |
| 261 | UINT8 phase; |
| 262 | UINT8 x,y; |
| 263 | attotime time; |
| 264 | } mouse_t; |
| 265 | |
| 259 | 266 | class pc8801_state : public driver_device |
| 260 | 267 | { |
| 261 | 268 | public: |
| r15896 | r15897 | |
| 315 | 322 | UINT8 m_has_cdrom; |
| 316 | 323 | UINT8 m_cdrom_reg[0x10]; |
| 317 | 324 | crtc_t m_crtc; |
| 325 | mouse_t m_mouse; |
| 318 | 326 | struct { UINT8 r, g, b; } m_palram[8]; |
| 319 | 327 | UINT8 m_dmac_ff; |
| 320 | 328 | UINT32 m_knj_addr[2]; |
| 321 | | struct{ |
| 322 | | UINT8 phase; |
| 323 | | UINT8 x,y; |
| 324 | | attotime time; |
| 325 | | }m_mouse; |
| 329 | |
| 326 | 330 | DECLARE_READ8_MEMBER(pc8801_alu_r); |
| 327 | 331 | DECLARE_WRITE8_MEMBER(pc8801_alu_w); |
| 328 | 332 | DECLARE_READ8_MEMBER(pc8801_wram_r); |
| r15896 | r15897 | |
| 401 | 405 | DECLARE_WRITE8_MEMBER(pc8801_opna_w); |
| 402 | 406 | |
| 403 | 407 | UINT8 pc8801_pixel_clock(void); |
| 404 | | }; |
| 408 | void pc8801_dynamic_res_change(void); |
| 409 | void draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect); |
| 410 | void draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &cliprect); |
| 411 | UINT8 calc_cursor_pos(int x,int y,int yi); |
| 412 | UINT8 extract_text_attribute(UINT32 address,int x, UINT8 width, UINT8 &non_special); |
| 413 | void pc8801_draw_char(bitmap_ind16 &bitmap,int x,int y,int pal,UINT8 gfx_mode,UINT8 reverse,UINT8 secret, |
| 414 | UINT8 blink,UINT8 upper,UINT8 lower,int y_size,int width, UINT8 non_special); |
| 415 | void draw_text(bitmap_ind16 &bitmap,int y_size, UINT8 width); |
| 405 | 416 | |
| 417 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 406 | 418 | |
| 407 | | static void pc8801_dynamic_res_change(running_machine &machine); |
| 419 | protected: |
| 408 | 420 | |
| 421 | virtual void video_start(); |
| 422 | }; |
| 423 | |
| 424 | |
| 409 | 425 | /* |
| 410 | 426 | CRTC command params: |
| 411 | 427 | 0. CRTC reset |
| r15896 | r15897 | |
| 430 | 446 | [4] ---x xxxx attribute size (+1) |
| 431 | 447 | */ |
| 432 | 448 | |
| 433 | | #define screen_width ((state->m_crtc.param[0][0] & 0x7f) + 2) * 8 |
| 449 | #define screen_width ((m_crtc.param[0][0] & 0x7f) + 2) * 8 |
| 434 | 450 | |
| 435 | | #define blink_speed ((((state->m_crtc.param[0][1] & 0xc0) >> 6) + 1) << 3) |
| 436 | | #define screen_height ((state->m_crtc.param[0][1] & 0x3f) + 1) |
| 451 | #define blink_speed ((((m_crtc.param[0][1] & 0xc0) >> 6) + 1) << 3) |
| 452 | #define screen_height ((m_crtc.param[0][1] & 0x3f) + 1) |
| 437 | 453 | |
| 438 | | #define lines_per_char ((state->m_crtc.param[0][2] & 0x1f) + 1) |
| 454 | #define lines_per_char ((m_crtc.param[0][2] & 0x1f) + 1) |
| 439 | 455 | |
| 440 | | #define vretrace (((state->m_crtc.param[0][3] & 0xe0) >> 5) + 1) |
| 441 | | #define hretrace ((state->m_crtc.param[0][3] & 0x1f) + 2) * 8 |
| 456 | #define vretrace (((m_crtc.param[0][3] & 0xe0) >> 5) + 1) |
| 457 | #define hretrace ((m_crtc.param[0][3] & 0x1f) + 2) * 8 |
| 442 | 458 | |
| 443 | | #define text_color_flag ((state->m_crtc.param[0][4] & 0xe0) == 0x40) |
| 444 | | #define monitor_24KHz ((state->m_gfx_ctrl & 0x19) == 0x08) /* TODO: this is most likely to be WRONG */ |
| 459 | #define text_color_flag ((m_crtc.param[0][4] & 0xe0) == 0x40) |
| 460 | //#define monitor_24KHz ((m_gfx_ctrl & 0x19) == 0x08) /* TODO: this is most likely to be WRONG */ |
| 445 | 461 | |
| 446 | | static VIDEO_START( pc8801 ) |
| 462 | void pc8801_state::video_start() |
| 447 | 463 | { |
| 448 | 464 | |
| 449 | 465 | } |
| 450 | 466 | |
| 451 | | static void draw_bitmap_3bpp(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 467 | void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 452 | 468 | { |
| 453 | | pc8801_state *state = machine.driver_data<pc8801_state>(); |
| 454 | 469 | int x,y,xi; |
| 455 | 470 | UINT32 count; |
| 456 | | UINT8 *gvram = machine.root_device().memregion("gvram")->base(); |
| 471 | UINT8 *gvram = machine().root_device().memregion("gvram")->base(); |
| 457 | 472 | UINT16 y_size; |
| 458 | 473 | UINT16 y_double; |
| 459 | 474 | |
| 460 | 475 | count = 0; |
| 461 | 476 | |
| 462 | | y_double = (state->pc8801_pixel_clock()); |
| 477 | y_double = (pc8801_pixel_clock()); |
| 463 | 478 | y_size = (y_double+1) * 200; |
| 464 | 479 | |
| 465 | 480 | for(y=0;y<y_size;y+=(y_double+1)) |
| r15896 | r15897 | |
| 480 | 495 | if(y_double) |
| 481 | 496 | { |
| 482 | 497 | if(cliprect.contains(x+xi, y+0)) |
| 483 | | bitmap.pix16(y+0, x+xi) = machine.pens[pen & 7]; |
| 498 | bitmap.pix16(y+0, x+xi) = machine().pens[pen & 7]; |
| 484 | 499 | |
| 485 | 500 | if(cliprect.contains(x+xi, y+1)) |
| 486 | | bitmap.pix16(y+1, x+xi) = machine.pens[pen & 7]; |
| 501 | bitmap.pix16(y+1, x+xi) = machine().pens[pen & 7]; |
| 487 | 502 | } |
| 488 | 503 | else |
| 489 | 504 | { |
| 490 | 505 | if(cliprect.contains(x+xi, y+0)) |
| 491 | | bitmap.pix16(y, x+xi) = machine.pens[pen & 7]; |
| 506 | bitmap.pix16(y, x+xi) = machine().pens[pen & 7]; |
| 492 | 507 | } |
| 493 | 508 | } |
| 494 | 509 | |
| r15896 | r15897 | |
| 497 | 512 | } |
| 498 | 513 | } |
| 499 | 514 | |
| 500 | | static void draw_bitmap_1bpp(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 515 | void pc8801_state::draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 501 | 516 | { |
| 502 | | pc8801_state *state = machine.driver_data<pc8801_state>(); |
| 503 | 517 | int x,y,xi; |
| 504 | 518 | UINT32 count; |
| 505 | | UINT8 *gvram = state->memregion("gvram")->base(); |
| 519 | UINT8 *gvram = machine().root_device().memregion("gvram")->base(); |
| 506 | 520 | UINT8 color; |
| 507 | 521 | |
| 508 | 522 | count = 0; |
| 509 | | color = (state->m_gfx_ctrl & 1) ? 7 & ((state->m_layer_mask ^ 0xe) >> 1) : 7; |
| 523 | color = (m_gfx_ctrl & 1) ? 7 & ((m_layer_mask ^ 0xe) >> 1) : 7; |
| 510 | 524 | |
| 511 | 525 | for(y=0;y<200;y++) |
| 512 | 526 | { |
| r15896 | r15897 | |
| 518 | 532 | |
| 519 | 533 | pen = ((gvram[count+0x0000] >> (7-xi)) & 1) << 0; |
| 520 | 534 | |
| 521 | | if((state->m_gfx_ctrl & 1)) |
| 535 | if((m_gfx_ctrl & 1)) |
| 522 | 536 | { |
| 523 | 537 | if(cliprect.contains(x+xi, y*2+0)) |
| 524 | | bitmap.pix16(y*2+0, x+xi) = machine.pens[pen ? color : 0]; |
| 538 | bitmap.pix16(y*2+0, x+xi) = machine().pens[pen ? color : 0]; |
| 525 | 539 | |
| 526 | 540 | if(cliprect.contains(x+xi, y*2+1)) |
| 527 | | bitmap.pix16(y*2+1, x+xi) = machine.pens[pen ? color : 0]; |
| 541 | bitmap.pix16(y*2+1, x+xi) = machine().pens[pen ? color : 0]; |
| 528 | 542 | } |
| 529 | 543 | else |
| 530 | 544 | { |
| 531 | 545 | if(cliprect.contains(x+xi, y)) |
| 532 | | bitmap.pix16(y, x+xi) = machine.pens[pen ? color : 0]; |
| 546 | bitmap.pix16(y, x+xi) = machine().pens[pen ? color : 0]; |
| 533 | 547 | } |
| 534 | 548 | } |
| 535 | 549 | |
| r15896 | r15897 | |
| 537 | 551 | } |
| 538 | 552 | } |
| 539 | 553 | |
| 540 | | if(!(state->m_gfx_ctrl & 1)) // 400 lines |
| 554 | if(!(m_gfx_ctrl & 1)) // 400 lines |
| 541 | 555 | { |
| 542 | 556 | count = 0; |
| 543 | 557 | |
| r15896 | r15897 | |
| 552 | 566 | pen = ((gvram[count+0x4000] >> (7-xi)) & 1) << 0; |
| 553 | 567 | |
| 554 | 568 | if(cliprect.contains(x+xi, y)) |
| 555 | | bitmap.pix16(y, x+xi) = machine.pens[pen ? 7 : 0]; |
| 569 | bitmap.pix16(y, x+xi) = machine().pens[pen ? 7 : 0]; |
| 556 | 570 | } |
| 557 | 571 | |
| 558 | 572 | count++; |
| r15896 | r15897 | |
| 561 | 575 | } |
| 562 | 576 | } |
| 563 | 577 | |
| 564 | | static UINT8 calc_cursor_pos(running_machine &machine,int x,int y,int yi) |
| 578 | UINT8 pc8801_state::calc_cursor_pos(int x,int y,int yi) |
| 565 | 579 | { |
| 566 | | pc8801_state *state = machine.driver_data<pc8801_state>(); |
| 567 | | |
| 568 | | if(!(state->m_crtc.cursor_on)) // don't bother if cursor is off |
| 580 | if(!(m_crtc.cursor_on)) // don't bother if cursor is off |
| 569 | 581 | return 0; |
| 570 | 582 | |
| 571 | | if(x == state->m_crtc.param[4][0] && y == state->m_crtc.param[4][1]) /* check if position matches */ |
| 583 | if(x == m_crtc.param[4][0] && y == m_crtc.param[4][1]) /* check if position matches */ |
| 572 | 584 | { |
| 573 | 585 | /* don't pass through if we are using underscore */ |
| 574 | | if((!(state->m_crtc.param[0][2] & 0x40)) && yi != 7) |
| 586 | if((!(m_crtc.param[0][2] & 0x40)) && yi != 7) |
| 575 | 587 | return 0; |
| 576 | 588 | |
| 577 | 589 | /* finally check if blinking is currently active high */ |
| 578 | | if(!(state->m_crtc.param[0][2] & 0x20)) |
| 590 | if(!(m_crtc.param[0][2] & 0x20)) |
| 579 | 591 | return 1; |
| 580 | 592 | |
| 581 | | if(((machine.primary_screen->frame_number() / blink_speed) & 1) == 0) |
| 593 | if(((machine().primary_screen->frame_number() / blink_speed) & 1) == 0) |
| 582 | 594 | return 1; |
| 583 | 595 | |
| 584 | 596 | return 0; |
| r15896 | r15897 | |
| 589 | 601 | |
| 590 | 602 | |
| 591 | 603 | |
| 592 | | static UINT8 extract_text_attribute(running_machine &machine,UINT32 address,int x, UINT8 width, UINT8 &non_special) |
| 604 | UINT8 pc8801_state::extract_text_attribute(UINT32 address,int x, UINT8 width, UINT8 &non_special) |
| 593 | 605 | { |
| 594 | | pc8801_state *state = machine.driver_data<pc8801_state>(); |
| 595 | | UINT8 *vram = state->memregion("wram")->base(); |
| 606 | UINT8 *vram = machine().root_device().memregion("wram")->base(); |
| 596 | 607 | int i; |
| 597 | 608 | int fifo_size; |
| 598 | 609 | int offset; |
| 599 | 610 | |
| 600 | 611 | non_special = 0; |
| 601 | | if(state->m_crtc.param[0][4] & 0x80) |
| 612 | if(m_crtc.param[0][4] & 0x80) |
| 602 | 613 | { |
| 603 | 614 | popmessage("Using non-separate mode for text tilemap, contact MESSdev"); |
| 604 | 615 | return 0; |
| 605 | 616 | } |
| 606 | 617 | |
| 607 | | fifo_size = (state->m_crtc.param[0][4] & 0x20) ? 0 : ((state->m_crtc.param[0][4] & 0x1f) + 1); |
| 618 | fifo_size = (m_crtc.param[0][4] & 0x20) ? 0 : ((m_crtc.param[0][4] & 0x1f) + 1); |
| 608 | 619 | |
| 609 | 620 | if(fifo_size == 0) |
| 610 | 621 | { |
| r15896 | r15897 | |
| 628 | 639 | return vram[address-3+offset]; |
| 629 | 640 | } |
| 630 | 641 | |
| 631 | | static void pc8801_draw_char(running_machine &machine,bitmap_ind16 &bitmap,int x,int y,int pal,UINT8 gfx_mode,UINT8 reverse,UINT8 secret,UINT8 blink,UINT8 upper,UINT8 lower,int y_size,int height,int width, UINT8 non_special) |
| 642 | void pc8801_state::pc8801_draw_char(bitmap_ind16 &bitmap,int x,int y,int pal,UINT8 gfx_mode,UINT8 reverse,UINT8 secret,UINT8 blink,UINT8 upper,UINT8 lower,int y_size,int width, UINT8 non_special) |
| 632 | 643 | { |
| 633 | | pc8801_state *state = machine.driver_data<pc8801_state>(); |
| 634 | 644 | int xi,yi; |
| 635 | | UINT8 *vram = state->memregion("wram")->base(); |
| 636 | | UINT8 *gfx_rom = machine.root_device().memregion("gfx1")->base(); |
| 645 | UINT8 *vram = machine().root_device().memregion("wram")->base(); |
| 646 | UINT8 *gfx_rom = machine().root_device().memregion("gfx1")->base(); |
| 637 | 647 | UINT8 is_cursor; |
| 638 | 648 | UINT8 y_height, y_double; |
| 639 | 649 | UINT8 y_step; |
| 640 | 650 | |
| 641 | 651 | y_height = lines_per_char; |
| 642 | | y_double = (state->pc8801_pixel_clock()); |
| 652 | y_double = (pc8801_pixel_clock()); |
| 643 | 653 | y_step = (non_special) ? 80 : 120; // trusted by Elthlead |
| 644 | 654 | |
| 645 | 655 | for(yi=0;yi<y_height;yi++) |
| 646 | 656 | { |
| 647 | | is_cursor = calc_cursor_pos(machine,x,y,yi); |
| 657 | is_cursor = calc_cursor_pos(x,y,yi); |
| 648 | 658 | |
| 649 | 659 | for(xi=0;xi<8;xi++) |
| 650 | 660 | { |
| r15896 | r15897 | |
| 653 | 663 | int color; |
| 654 | 664 | |
| 655 | 665 | { |
| 656 | | tile = vram[x+(y*y_step)+state->m_dma_address[2]]; |
| 666 | tile = vram[x+(y*y_step)+m_dma_address[2]]; |
| 657 | 667 | |
| 658 | 668 | res_x = x*8+xi*(width+1); |
| 659 | | res_y = y*y_height*(height+1)+yi*(height+1); |
| 669 | res_y = y*y_height+yi; |
| 660 | 670 | |
| 661 | | if(!machine.primary_screen->visible_area().contains(res_x, res_y)) |
| 671 | if(!machine().primary_screen->visible_area().contains(res_x, res_y)) |
| 662 | 672 | continue; |
| 663 | 673 | |
| 664 | 674 | if(gfx_mode) |
| r15896 | r15897 | |
| 675 | 685 | UINT8 blink_mask; |
| 676 | 686 | |
| 677 | 687 | blink_mask = 0; |
| 678 | | if(blink && ((machine.primary_screen->frame_number() / blink_speed) & 3) == 1) |
| 688 | if(blink && ((machine().primary_screen->frame_number() / blink_speed) & 3) == 1) |
| 679 | 689 | blink_mask = 1; |
| 680 | 690 | |
| 681 | 691 | if(yi >= (1 << (y_double+3)) || secret || blink_mask) |
| r15896 | r15897 | |
| 699 | 709 | } |
| 700 | 710 | |
| 701 | 711 | if(color != -1) |
| 702 | | bitmap.pix16(res_y, res_x) = machine.pens[color]; |
| 703 | | |
| 704 | | if(width) |
| 705 | 712 | { |
| 706 | | if(!machine.primary_screen->visible_area().contains(res_x+1, res_y)) |
| 707 | | continue; |
| 713 | bitmap.pix16(res_y, res_x) = machine().pens[color]; |
| 714 | if(width) |
| 715 | { |
| 716 | if(!machine().primary_screen->visible_area().contains(res_x+1, res_y)) |
| 717 | continue; |
| 708 | 718 | |
| 709 | | if(color != -1) |
| 710 | | bitmap.pix16(res_y, res_x+1) = machine.pens[color]; |
| 719 | bitmap.pix16(res_y, res_x+1) = machine().pens[color]; |
| 720 | } |
| 711 | 721 | } |
| 712 | | if(height) |
| 713 | | { |
| 714 | | if(!machine.primary_screen->visible_area().contains(res_x, res_y+1)) |
| 715 | | continue; |
| 716 | | |
| 717 | | if(color != -1) |
| 718 | | bitmap.pix16(res_y+1, res_x) = machine.pens[color]; |
| 719 | | |
| 720 | | if(!machine.primary_screen->visible_area().contains(res_x+1, res_y+1)) |
| 721 | | continue; |
| 722 | | |
| 723 | | if(color != -1) |
| 724 | | bitmap.pix16(res_y+1, res_x+1) = machine.pens[color]; |
| 725 | | } |
| 726 | 722 | } |
| 727 | 723 | } |
| 728 | 724 | } |
| 729 | 725 | } |
| 730 | 726 | |
| 731 | | static void draw_text(running_machine &machine, bitmap_ind16 &bitmap,int y_size, UINT8 width) |
| 727 | void pc8801_state::draw_text(bitmap_ind16 &bitmap,int y_size, UINT8 width) |
| 732 | 728 | { |
| 733 | | pc8801_state *state = machine.driver_data<pc8801_state>(); |
| 734 | 729 | int x,y; |
| 735 | 730 | UINT8 attr; |
| 736 | 731 | UINT8 reverse; |
| r15896 | r15897 | |
| 749 | 744 | if(x & 1 && !width) |
| 750 | 745 | continue; |
| 751 | 746 | |
| 752 | | attr = extract_text_attribute(machine,(((y*120)+80+state->m_dma_address[2]) & 0xffff),(x),width,non_special); |
| 747 | attr = extract_text_attribute((((y*120)+80+m_dma_address[2]) & 0xffff),(x),width,non_special); |
| 753 | 748 | |
| 754 | 749 | if(text_color_flag && (attr & 8)) // color mode |
| 755 | 750 | { |
| r15896 | r15897 | |
| 772 | 767 | lower = (attr & 0x20) >> 5; |
| 773 | 768 | blink = (attr & 2) >> 1; |
| 774 | 769 | pal|=8; //text pal bank |
| 775 | | reverse ^= state->m_crtc.inverse; |
| 770 | reverse ^= m_crtc.inverse; |
| 776 | 771 | |
| 777 | 772 | if(attr & 0x80) |
| 778 | 773 | popmessage("Warning: mono gfx mode enabled, contact MESSdev"); |
| 779 | 774 | |
| 780 | 775 | } |
| 781 | 776 | |
| 782 | | pc8801_draw_char(machine,bitmap,x,y,pal,gfx_mode,reverse,secret,blink,upper,lower,y_size,monitor_24KHz,!width,non_special); |
| 777 | pc8801_draw_char(bitmap,x,y,pal,gfx_mode,reverse,secret,blink,upper,lower,y_size,!width,non_special); |
| 783 | 778 | } |
| 784 | 779 | } |
| 785 | 780 | } |
| 786 | 781 | |
| 787 | | static SCREEN_UPDATE_IND16( pc8801 ) |
| 782 | UINT32 pc8801_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 788 | 783 | { |
| 789 | | pc8801_state *state = screen.machine().driver_data<pc8801_state>(); |
| 790 | 784 | bitmap.fill(screen.machine().pens[0], cliprect); |
| 791 | 785 | |
| 792 | | // popmessage("%04x %04x %02x",state->m_dma_address[2],state->m_dma_counter[2],state->m_dmac_mode); |
| 786 | // popmessage("%04x %04x %02x",m_dma_address[2],m_dma_counter[2],m_dmac_mode); |
| 793 | 787 | |
| 794 | | if(state->m_gfx_ctrl & 8) |
| 788 | if(m_gfx_ctrl & 8) |
| 795 | 789 | { |
| 796 | | if(state->m_gfx_ctrl & 0x10) |
| 797 | | draw_bitmap_3bpp(screen.machine(),bitmap,cliprect); |
| 790 | if(m_gfx_ctrl & 0x10) |
| 791 | draw_bitmap_3bpp(bitmap,cliprect); |
| 798 | 792 | else |
| 799 | | draw_bitmap_1bpp(screen.machine(),bitmap,cliprect); |
| 793 | draw_bitmap_1bpp(bitmap,cliprect); |
| 800 | 794 | } |
| 801 | 795 | |
| 802 | 796 | //popmessage("%02x %02x %02x %02x %02x",state->m_layer_mask,state->m_dmac_mode,state->m_crtc.status,state->m_crtc.irq_mask,state->m_gfx_ctrl); |
| 803 | 797 | |
| 804 | | if(!(state->m_layer_mask & 1) && state->m_dmac_mode & 4 && state->m_crtc.status & 0x10 && state->m_crtc.irq_mask == 3) |
| 798 | if(!(m_layer_mask & 1) && m_dmac_mode & 4 && m_crtc.status & 0x10 && m_crtc.irq_mask == 3) |
| 805 | 799 | { |
| 806 | | //popmessage("%02x %02x",state->m_crtc.param[0][0],state->m_crtc.param[0][4]); |
| 800 | //popmessage("%02x %02x",m_crtc.param[0][0],m_crtc.param[0][4]); |
| 807 | 801 | |
| 808 | | draw_text(screen.machine(),bitmap,screen_height,state->m_txt_width); |
| 802 | draw_text(bitmap,screen_height,m_txt_width); |
| 809 | 803 | } |
| 810 | 804 | |
| 811 | 805 | return 0; |
| r15896 | r15897 | |
| 1188 | 1182 | return (ysize >= 400); |
| 1189 | 1183 | } |
| 1190 | 1184 | |
| 1191 | | static void pc8801_dynamic_res_change(running_machine &machine) |
| 1185 | void pc8801_state::pc8801_dynamic_res_change(void) |
| 1192 | 1186 | { |
| 1193 | | pc8801_state *state = machine.driver_data<pc8801_state>(); |
| 1194 | 1187 | rectangle visarea; |
| 1195 | 1188 | int xsize,ysize,xvis,yvis; |
| 1196 | 1189 | attoseconds_t refresh;; |
| 1197 | 1190 | |
| 1198 | 1191 | /* bail out if screen params aren't valid */ |
| 1199 | | if(!state->m_crtc.param[0][0] || !state->m_crtc.param[0][1] || !state->m_crtc.param[0][2] || !state->m_crtc.param[0][3]) |
| 1192 | if(!m_crtc.param[0][0] || !m_crtc.param[0][1] || !m_crtc.param[0][2] || !m_crtc.param[0][3]) |
| 1200 | 1193 | return; |
| 1201 | 1194 | |
| 1202 | 1195 | xvis = screen_width; |
| r15896 | r15897 | |
| 1207 | 1200 | // popmessage("H %d V %d (%d x %d) HR %d VR %d (%d %d)\n",xvis,yvis,screen_height,lines_per_char,hretrace,vretrace, xsize,ysize); |
| 1208 | 1201 | |
| 1209 | 1202 | visarea.set(0, xvis - 1, 0, yvis - 1); |
| 1210 | | if(state->pc8801_pixel_clock()) |
| 1203 | if(pc8801_pixel_clock()) |
| 1211 | 1204 | refresh = HZ_TO_ATTOSECONDS(PIXEL_CLOCK_24KHz) * (xsize) * ysize; |
| 1212 | 1205 | else |
| 1213 | 1206 | refresh = HZ_TO_ATTOSECONDS(PIXEL_CLOCK_15KHz) * (xsize) * ysize; |
| 1214 | 1207 | |
| 1215 | | machine.primary_screen->configure(xsize, ysize, visarea, refresh); |
| 1208 | machine().primary_screen->configure(xsize, ysize, visarea, refresh); |
| 1216 | 1209 | } |
| 1217 | 1210 | |
| 1218 | 1211 | WRITE8_MEMBER(pc8801_state::pc8801_gfx_ctrl_w) |
| r15896 | r15897 | |
| 1228 | 1221 | |
| 1229 | 1222 | m_gfx_ctrl = data; |
| 1230 | 1223 | |
| 1231 | | pc8801_dynamic_res_change(machine()); |
| 1224 | pc8801_dynamic_res_change(); |
| 1232 | 1225 | } |
| 1233 | 1226 | |
| 1234 | 1227 | READ8_MEMBER(pc8801_state::pc8801_vram_select_r) |
| r15896 | r15897 | |
| 1396 | 1389 | { |
| 1397 | 1390 | m_crtc.param[m_crtc.cmd][m_crtc.param_count] = data; |
| 1398 | 1391 | if(m_crtc.cmd == 0) |
| 1399 | | pc8801_dynamic_res_change(machine()); |
| 1392 | pc8801_dynamic_res_change(); |
| 1400 | 1393 | |
| 1401 | 1394 | m_crtc.param_count++; |
| 1402 | 1395 | } |
| r15896 | r15897 | |
| 1842 | 1835 | |
| 1843 | 1836 | static TIMER_CALLBACK( pc8801fd_upd765_tc_to_zero ) |
| 1844 | 1837 | { |
| 1845 | | // pc88va_state *state = machine.driver_data<pc88va_state>(); |
| 1838 | // pc8801_state *state = machine.driver_data<pc8801_state>(); |
| 1846 | 1839 | |
| 1847 | 1840 | //printf("0\n"); |
| 1848 | 1841 | upd765_tc_w(machine.device("upd765"), 0); |
| r15896 | r15897 | |
| 2660 | 2653 | /* video hardware */ |
| 2661 | 2654 | MCFG_SCREEN_ADD("screen", RASTER) |
| 2662 | 2655 | MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK_24KHz,848,0,640,448,0,400) |
| 2663 | | MCFG_SCREEN_UPDATE_STATIC(pc8801) |
| 2656 | MCFG_SCREEN_UPDATE_DRIVER(pc8801_state, screen_update) |
| 2664 | 2657 | |
| 2665 | 2658 | MCFG_GFXDECODE( pc8801 ) |
| 2666 | 2659 | MCFG_PALETTE_LENGTH(0x10) |
| 2667 | 2660 | MCFG_PALETTE_INIT( pc8801 ) |
| 2668 | 2661 | |
| 2669 | | MCFG_VIDEO_START(pc8801) |
| 2662 | // MCFG_VIDEO_START(pc8801) |
| 2670 | 2663 | |
| 2671 | 2664 | /* sound hardware */ |
| 2672 | 2665 | MCFG_SPEAKER_STANDARD_MONO("mono") |