src/mess/drivers/x1.c
| r10133 | r10134 | |
| 5 | 5 | driver by Angelo Salese & Barry Rodewald |
| 6 | 6 | |
| 7 | 7 | TODO: |
| 8 | | - Understand how keyboard works and decap/dump the keyboard MCU if possible; |
| 8 | - Rewrite keyboard input hook-up and decap/dump the keyboard MCU if possible; |
| 9 | - x1turbo keyboard inputs are currently broken; |
| 10 | - Fix palette stuff, make it a lot cleaner; |
| 11 | - Implement proper PCG index hooks by beam positions; |
| 9 | 12 | - Hook-up remaining .tap image formats; |
| 10 | 13 | - Implement .rom format support (needs an image for it); |
| 11 | 14 | - Implement tape commands; |
| 12 | 15 | - Sort out / redump the BIOS gfx roms; |
| 13 | 16 | - X1Turbo: Implement SIO. |
| 14 | 17 | - X1Twin: Hook-up the PC Engine part (actually needs his own driver?); |
| 18 | - Implement SASI HDD interface; |
| 15 | 19 | - clean-ups! |
| 16 | 20 | - There are various unclear video things, these are: |
| 17 | | - Understand why some games still doesn't upload the proper PCG index; |
| 18 | 21 | - Implement the remaining scrn regs; |
| 19 | | - Interlace mode? |
| 22 | - Interlace mode |
| 20 | 23 | - Implement the new features of the x1turbo, namely the 4096 color feature amongst other |
| 21 | 24 | things |
| 22 | 25 | - (anything else?) |
| r10133 | r10134 | |
| 230 | 233 | state->gfx_bitmap_ram = auto_alloc_array(machine, UINT8, 0xc000*2); |
| 231 | 234 | } |
| 232 | 235 | |
| 236 | static void x1_draw_pixel(running_machine *machine, bitmap_t *bitmap,int y,int x,UINT16 pen) |
| 237 | { |
| 238 | if((x)>machine->primary_screen->visible_area().max_x || (y)>machine->primary_screen->visible_area().max_y) |
| 239 | return; |
| 240 | |
| 241 | *BITMAP_ADDR16(bitmap, y, x) = machine->pens[pen]; |
| 242 | } |
| 243 | |
| 233 | 244 | static void draw_fgtilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w) |
| 234 | 245 | { |
| 235 | 246 | x1_state *state = machine->driver_data<x1_state>(); |
| r10133 | r10134 | |
| 286 | 297 | if((state->scrn_reg.blackclip & 8) && (color == (state->scrn_reg.blackclip & 7))) |
| 287 | 298 | pcg_pen = 0; // clip the pen to black |
| 288 | 299 | |
| 289 | | if((res_x+xi)>machine->primary_screen->visible_area().max_x && (res_y+yi)>machine->primary_screen->visible_area().max_y) |
| 290 | | continue; |
| 291 | | |
| 292 | 300 | if(state->scrn_reg.v400_mode) |
| 293 | 301 | { |
| 294 | | *BITMAP_ADDR16(bitmap, (res_y+yi)*2+0, res_x+xi) = machine->pens[pcg_pen]; |
| 295 | | *BITMAP_ADDR16(bitmap, (res_y+yi)*2+1, res_x+xi) = machine->pens[pcg_pen]; |
| 302 | x1_draw_pixel(machine,bitmap,(res_y+yi)*2+0,res_x+xi,pcg_pen); |
| 303 | x1_draw_pixel(machine,bitmap,(res_y+yi)*2+1,res_x+xi,pcg_pen); |
| 296 | 304 | if(width) |
| 297 | 305 | { |
| 298 | | *BITMAP_ADDR16(bitmap, (res_y+yi)*2+0, res_x+xi+1) = machine->pens[pcg_pen]; |
| 299 | | *BITMAP_ADDR16(bitmap, (res_y+yi)*2+1, res_x+xi+1) = machine->pens[pcg_pen]; |
| 306 | x1_draw_pixel(machine,bitmap,(res_y+yi)*2+0,res_x+xi+1,pcg_pen); |
| 307 | x1_draw_pixel(machine,bitmap,(res_y+yi)*2+1,res_x+xi+1,pcg_pen); |
| 300 | 308 | } |
| 301 | 309 | if(height) |
| 302 | 310 | { |
| 303 | | *BITMAP_ADDR16(bitmap, (res_y+yi+1)*2+0, res_x+xi) = machine->pens[pcg_pen]; |
| 304 | | *BITMAP_ADDR16(bitmap, (res_y+yi+1)*2+1, res_x+xi) = machine->pens[pcg_pen]; |
| 311 | x1_draw_pixel(machine,bitmap,(res_y+yi+1)*2+0,res_x+xi,pcg_pen); |
| 312 | x1_draw_pixel(machine,bitmap,(res_y+yi+1)*2+1,res_x+xi,pcg_pen); |
| 305 | 313 | } |
| 306 | 314 | if(width && height) |
| 307 | 315 | { |
| 308 | | *BITMAP_ADDR16(bitmap, (res_y+yi+1)*2+0, res_x+xi+1) = machine->pens[pcg_pen]; |
| 309 | | *BITMAP_ADDR16(bitmap, (res_y+yi+1)*2+1, res_x+xi+1) = machine->pens[pcg_pen]; |
| 316 | x1_draw_pixel(machine,bitmap,(res_y+yi+1)*2+0,res_x+xi+1,pcg_pen); |
| 317 | x1_draw_pixel(machine,bitmap,(res_y+yi+1)*2+1,res_x+xi+1,pcg_pen); |
| 310 | 318 | } |
| 311 | 319 | } |
| 312 | 320 | else |
| 313 | 321 | { |
| 314 | | *BITMAP_ADDR16(bitmap, res_y+yi, res_x+xi) = machine->pens[pcg_pen]; |
| 322 | x1_draw_pixel(machine,bitmap,res_y+yi,res_x+xi,pcg_pen); |
| 315 | 323 | if(width) |
| 316 | | *BITMAP_ADDR16(bitmap, res_y+yi, res_x+xi+1) = machine->pens[pcg_pen]; |
| 324 | x1_draw_pixel(machine,bitmap,res_y+yi,res_x+xi+1,pcg_pen); |
| 317 | 325 | if(height) |
| 318 | | *BITMAP_ADDR16(bitmap, res_y+yi+1, res_x+xi) = machine->pens[pcg_pen]; |
| 326 | x1_draw_pixel(machine,bitmap,res_y+yi+1,res_x+xi,pcg_pen); |
| 319 | 327 | if(width && height) |
| 320 | | *BITMAP_ADDR16(bitmap, res_y+yi+1, res_x+xi+1) = machine->pens[pcg_pen]; |
| 328 | x1_draw_pixel(machine,bitmap,res_y+yi+1,res_x+xi+1,pcg_pen); |
| 321 | 329 | } |
| 322 | 330 | } |
| 323 | 331 | } |
| r10133 | r10134 | |
| 327 | 335 | } |
| 328 | 336 | |
| 329 | 337 | /* |
| 330 | | * Priority Mixer Calculation (PLY) |
| 338 | * Priority Mixer Calculation (pri) |
| 331 | 339 | * |
| 332 | | * If ply is 0xff then the bitmap entirely covers the tilemap, if it's 0x00 then |
| 340 | * If pri is 0xff then the bitmap entirely covers the tilemap, if it's 0x00 then |
| 333 | 341 | * the tilemap priority is entirely above the bitmap. Any other value mixes the |
| 334 | 342 | * bitmap and the tilemap priorities based on the pen value, bit 0 = entry 0 <-> bit 7 = entry 7 |
| 335 | 343 | * of the bitmap. |
| 336 | 344 | * |
| 337 | 345 | */ |
| 338 | | static int priority_mixer_ply(running_machine *machine,int color) |
| 346 | static int priority_mixer_pri(running_machine *machine,int color) |
| 339 | 347 | { |
| 340 | 348 | int pri_i,pri_mask_calc; |
| 341 | 349 | |
| r10133 | r10134 | |
| 375 | 383 | |
| 376 | 384 | color = pen_g<<2 | pen_r<<1 | pen_b<<0; |
| 377 | 385 | |
| 378 | | pri_mask_val = priority_mixer_ply(machine,color); |
| 386 | pri_mask_val = priority_mixer_pri(machine,color); |
| 379 | 387 | if(pri_mask_val & pri) continue; |
| 380 | 388 | |
| 381 | 389 | if(state->scrn_reg.v400_mode) |
| 382 | 390 | { |
| 383 | | if((x*8+xi)<=machine->primary_screen->visible_area().max_x && (( y*(state->tile_height+1)+yi)*2+0)<=machine->primary_screen->visible_area().max_y) |
| 384 | | *BITMAP_ADDR16(bitmap, ( y*(state->tile_height+1)+yi)*2+0, x*8+xi) = machine->pens[color+0x100]; |
| 385 | | if((x*8+xi)<=machine->primary_screen->visible_area().max_x && (( y*(state->tile_height+1)+yi)*2+1)<=machine->primary_screen->visible_area().max_y) |
| 386 | | *BITMAP_ADDR16(bitmap, ( y*(state->tile_height+1)+yi)*2+1, x*8+xi) = machine->pens[color+0x100]; |
| 391 | x1_draw_pixel(machine,bitmap,(y*(state->tile_height+1)+yi)*2+0,x*8+xi,color); |
| 392 | x1_draw_pixel(machine,bitmap,(y*(state->tile_height+1)+yi)*2+1,x*8+xi,color); |
| 387 | 393 | } |
| 388 | 394 | else |
| 389 | | { |
| 390 | | if((x*8+xi)<=machine->primary_screen->visible_area().max_x && (y*(state->tile_height+1)+yi)<=machine->primary_screen->visible_area().max_y) |
| 391 | | *BITMAP_ADDR16(bitmap, y*(state->tile_height+1)+yi, x*8+xi) = machine->pens[color+0x100]; |
| 392 | | } |
| 393 | | } |
| 394 | | } |
| 395 | | } |
| 396 | | } |
| 397 | | } |
| 395 | x1_draw_pixel(machine,bitmap,y*(state->tile_height+1)+yi,x*8+xi,color); |
| 398 | 396 | |
| 399 | | #if 0 |
| 400 | | /* Old code for reference, to be removed soon */ |
| 401 | | static void draw_gfxbitmap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int w,int plane,int pri) |
| 402 | | { |
| 403 | | x1_state *state = machine->driver_data<x1_state>(); |
| 404 | | int count,xi,yi,x,y; |
| 405 | | int pen_r,pen_g,pen_b,color; |
| 406 | | int yi_size; |
| 407 | | int pri_mask_val; |
| 408 | | |
| 409 | | count = state->crtc_start_addr; |
| 410 | | |
| 411 | | yi_size = (w == 1) ? 16 : 8; |
| 412 | | |
| 413 | | for(yi=0;yi<yi_size;yi++) |
| 414 | | { |
| 415 | | for(y=0;y<200;y+=8) |
| 416 | | { |
| 417 | | for(x=0;x<(320*w);x+=8) |
| 418 | | { |
| 419 | | for(xi=0;xi<8;xi++) |
| 420 | | { |
| 421 | | pen_b = (state->gfx_bitmap_ram[count+0x0000+plane*0xc000]>>(7-xi)) & 1; |
| 422 | | pen_r = (state->gfx_bitmap_ram[count+0x4000+plane*0xc000]>>(7-xi)) & 1; |
| 423 | | pen_g = (state->gfx_bitmap_ram[count+0x8000+plane*0xc000]>>(7-xi)) & 1; |
| 424 | | |
| 425 | | color = pen_g<<2 | pen_r<<1 | pen_b<<0; |
| 426 | | |
| 427 | | pri_mask_val = priority_mixer_ply(machine,color); |
| 428 | | if(pri_mask_val & pri) continue; |
| 429 | | |
| 430 | | if(w == 1) |
| 431 | | { |
| 432 | | if(yi & 1) |
| 433 | | continue; |
| 434 | | |
| 435 | | if(state->scrn_reg.v400_mode) |
| 436 | | { |
| 437 | | if((x+xi)<=machine->primary_screen->visible_area().max_x && (y+(yi >> 1)*2+0)<=machine->primary_screen->visible_area().max_y) |
| 438 | | *BITMAP_ADDR16(bitmap, (y+(yi >> 1))*2+0, x+xi) = machine->pens[color+0x100]; |
| 439 | | if((x+xi)<=machine->primary_screen->visible_area().max_x && (y+(yi >> 1)*2+1)<=machine->primary_screen->visible_area().max_y) |
| 440 | | *BITMAP_ADDR16(bitmap, (y+(yi >> 1))*2+1, x+xi) = machine->pens[color+0x100]; |
| 441 | | } |
| 442 | | else |
| 443 | | { |
| 444 | | if((x+xi)<=machine->primary_screen->visible_area().max_x && (y+(yi >> 1))<=machine->primary_screen->visible_area().max_y) |
| 445 | | *BITMAP_ADDR16(bitmap, y+(yi >> 1), x+xi) = machine->pens[color+0x100]; |
| 446 | | } |
| 447 | | } |
| 448 | | else |
| 449 | | { |
| 450 | | if(state->scrn_reg.v400_mode) |
| 451 | | { |
| 452 | | if((x+xi)<=machine->primary_screen->visible_area().max_x && ((y+yi)*2+0)<=machine->primary_screen->visible_area().max_y) |
| 453 | | *BITMAP_ADDR16(bitmap, (y+yi)*2+0, x+xi) = machine->pens[color+0x100]; |
| 454 | | if((x+xi)<=machine->primary_screen->visible_area().max_x && ((y+yi)*2+1)<=machine->primary_screen->visible_area().max_y) |
| 455 | | *BITMAP_ADDR16(bitmap, (y+yi)*2+1, x+xi) = machine->pens[color+0x100]; |
| 456 | | } |
| 457 | | else |
| 458 | | { |
| 459 | | if((x+xi)<=machine->primary_screen->visible_area().max_x && (y+yi)<=machine->primary_screen->visible_area().max_y) |
| 460 | | *BITMAP_ADDR16(bitmap, y+yi, x+xi) = machine->pens[color+0x100]; |
| 461 | | } |
| 462 | | } |
| 463 | 397 | } |
| 464 | | count++; |
| 465 | 398 | } |
| 466 | 399 | } |
| 467 | | count+= (w == 2) ? 48 : 24; |
| 468 | | count&=0x3fff; |
| 469 | 400 | } |
| 470 | 401 | } |
| 471 | | #endif |
| 472 | 402 | |
| 473 | 403 | static VIDEO_UPDATE( x1 ) |
| 474 | 404 | { |
| r10133 | r10134 | |
| 479 | 409 | |
| 480 | 410 | bitmap_fill(bitmap, cliprect, MAKE_ARGB(0xff,0x00,0x00,0x00)); |
| 481 | 411 | |
| 482 | | draw_gfxbitmap(screen->machine,bitmap,cliprect,w,state->scrn_reg.disp_bank,state->scrn_reg.ply); |
| 412 | draw_gfxbitmap(screen->machine,bitmap,cliprect,w,state->scrn_reg.disp_bank,state->scrn_reg.pri); |
| 483 | 413 | draw_fgtilemap(screen->machine,bitmap,cliprect,w); |
| 484 | | draw_gfxbitmap(screen->machine,bitmap,cliprect,w,state->scrn_reg.disp_bank,state->scrn_reg.ply^0xff); |
| 414 | draw_gfxbitmap(screen->machine,bitmap,cliprect,w,state->scrn_reg.disp_bank,state->scrn_reg.pri^0xff); |
| 485 | 415 | /* Y's uses the following as a normal buffer/work ram without anything reasonable to draw */ |
| 486 | 416 | // draw_gfxbitmap(screen->machine,bitmap,cliprect,w,1); |
| 487 | 417 | |
| r10133 | r10134 | |
| 563 | 493 | static UINT8 check_keyboard_shift(running_machine *machine) |
| 564 | 494 | { |
| 565 | 495 | UINT8 val = 0xe0; |
| 496 | /* |
| 497 | all of those are active low |
| 498 | x--- ---- TEN: Numpad, Function key, special input key |
| 499 | -x-- ---- KIN: Valid key |
| 500 | --x- ---- REP: Key repeat |
| 501 | ---x ---- GRAPH key ON |
| 502 | ---- x--- CAPS lock ON |
| 503 | ---- -x-- KANA lock ON |
| 504 | ---- --x- SHIFT ON |
| 505 | ---- ---x CTRL ON |
| 506 | */ |
| 507 | |
| 566 | 508 | val |= input_port_read(machine,"key_modifiers") & 0x1f; |
| 567 | 509 | |
| 568 | 510 | if(check_keyboard_press(machine) != 0) |
| r10133 | r10134 | |
| 742 | 684 | static WRITE8_HANDLER( sub_io_w ) |
| 743 | 685 | { |
| 744 | 686 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 745 | | /* TODO: check sub-routine at $10e */ |
| 746 | | /* $17a -> floppy? */ |
| 747 | | /* $094 -> ROM */ |
| 748 | | /* $0c0 -> timer*/ |
| 749 | | /* $052 -> cmt */ |
| 750 | | /* $0f5 -> reload sub-routine? */ |
| 687 | /* sub-routine at $10e sends to these sub-routines when a keyboard input is triggered: |
| 688 | $17a -> floppy |
| 689 | $094 -> ROM |
| 690 | $0c0 -> timer |
| 691 | $052 -> cmt |
| 692 | $0f5 -> reload sub-routine? */ |
| 751 | 693 | |
| 752 | 694 | if(state->sub_cmd == 0xe4) |
| 753 | 695 | { |
| r10133 | r10134 | |
| 758 | 700 | if(state->sub_cmd == 0xe9) |
| 759 | 701 | cmt_command(space->machine,data); |
| 760 | 702 | |
| 761 | | if((data & 0xf0) == 0xd0) //reads here tv recording timer data. |
| 703 | if((data & 0xf0) == 0xd0) //reads here tv recording timer data. (Timer set (0xd0) / Timer readout (0xd8)) |
| 762 | 704 | { |
| 705 | /* |
| 706 | xx-- ---- mode |
| 707 | --xx xxxx interval |
| 708 | */ |
| 763 | 709 | state->sub_val[0] = 0; |
| 710 | /* |
| 711 | xxxx xxxx command code: |
| 712 | 00 timer disabled |
| 713 | 01 TV command |
| 714 | 10 interrupt |
| 715 | 11 Cassette deck |
| 716 | */ |
| 764 | 717 | state->sub_val[1] = 0; |
| 718 | /* |
| 719 | ---x xxxx minute |
| 720 | */ |
| 765 | 721 | state->sub_val[2] = 0; |
| 722 | /* |
| 723 | ---- xxxx hour |
| 724 | */ |
| 766 | 725 | state->sub_val[3] = 0; |
| 726 | /* |
| 727 | xxxx ---- month |
| 728 | ---- -xxx day of the week |
| 729 | */ |
| 767 | 730 | state->sub_val[4] = 0; |
| 731 | /* |
| 732 | --xx xxxx day |
| 733 | */ |
| 768 | 734 | state->sub_val[5] = 0; |
| 769 | 735 | state->sub_cmd_length = 6; |
| 770 | 736 | } |
| 771 | 737 | |
| 772 | 738 | switch(data) |
| 773 | 739 | { |
| 774 | | case 0xe3: |
| 740 | case 0xe3: //game key obtaining |
| 775 | 741 | state->sub_cmd_length = 3; |
| 776 | 742 | state->sub_val[0] = get_game_key(space->machine,0); |
| 777 | 743 | state->sub_val[1] = get_game_key(space->machine,1); |
| 778 | 744 | state->sub_val[2] = get_game_key(space->machine,2); |
| 779 | 745 | break; |
| 780 | | case 0xe6: |
| 746 | case 0xe4: //irq vector setting |
| 747 | break; |
| 748 | //case 0xe5: //timer irq clear |
| 749 | // break; |
| 750 | case 0xe6: //key data readout |
| 781 | 751 | state->sub_val[0] = check_keyboard_shift(space->machine); |
| 782 | 752 | state->sub_val[1] = check_keyboard_press(space->machine); |
| 783 | 753 | state->sub_cmd_length = 2; |
| 784 | 754 | break; |
| 785 | | case 0xe8: |
| 755 | // case 0xe7: // TV Control |
| 756 | // break; |
| 757 | case 0xe8: // TV Control read-out |
| 786 | 758 | state->sub_val[0] = state->sub_cmd; |
| 787 | 759 | state->sub_cmd_length = 1; |
| 788 | 760 | break; |
| 761 | case 0xe9: // CMT Control |
| 762 | break; |
| 789 | 763 | case 0xea: // CMT Control status |
| 790 | 764 | state->sub_val[0] = state->cmt_current_cmd; |
| 791 | 765 | state->sub_cmd_length = 1; |
| r10133 | r10134 | |
| 794 | 768 | case 0xeb: // CMT Tape status |
| 795 | 769 | // bit 0 = tape end (0=end of tape) |
| 796 | 770 | // bit 1 = tape inserted |
| 797 | | // bit 2 = record status (1=OK, 0=write protect?) |
| 771 | // bit 2 = record status (1=OK, 0=write protect) |
| 798 | 772 | state->sub_val[0] = 0x05; |
| 799 | 773 | if(cassette_get_image(space->machine->device("cass")) != NULL) |
| 800 | 774 | state->sub_val[0] |= 0x02; |
| 801 | 775 | state->sub_cmd_length = 1; |
| 802 | 776 | logerror("CMT: Command 0xEB received, returning 0x%02x.\n",state->sub_val[0]); |
| 803 | 777 | break; |
| 778 | // case 0xec: //set date |
| 779 | // break; |
| 804 | 780 | case 0xed: //get date |
| 805 | 781 | state->sub_val[0] = state->rtc.day; |
| 806 | 782 | state->sub_val[1] = (state->rtc.month<<4) | (state->rtc.wday & 0xf); |
| 807 | 783 | state->sub_val[2] = state->rtc.year; |
| 808 | 784 | state->sub_cmd_length = 3; |
| 809 | 785 | break; |
| 786 | // case 0xee: //set time |
| 787 | // break; |
| 810 | 788 | case 0xef: //get time |
| 811 | 789 | state->sub_val[0] = state->rtc.hour; |
| 812 | 790 | state->sub_val[1] = state->rtc.min; |
| 813 | 791 | state->sub_val[2] = state->rtc.sec; |
| 814 | 792 | state->sub_cmd_length = 3; |
| 815 | 793 | break; |
| 816 | | #if 0 |
| 817 | | default: |
| 818 | | { |
| 819 | | if(data > 0xe3 && data <= 0xef) |
| 820 | | printf("%02x CMD\n",data); |
| 821 | | } |
| 822 | | #endif |
| 823 | 794 | } |
| 824 | 795 | |
| 825 | 796 | state->sub_cmd = data; |
| 826 | 797 | |
| 827 | 798 | state->sub_obf = (state->sub_cmd_length) ? 0x00 : 0x20; |
| 828 | | logerror("SUB: Command byte 0x%02x\n",data); |
| 799 | |
| 800 | if(data != 0xe6) |
| 801 | logerror("SUB: Command byte 0x%02x\n",data); |
| 829 | 802 | } |
| 830 | 803 | |
| 831 | 804 | /************************************* |
| r10133 | r10134 | |
| 900 | 873 | case 0x0ffb: |
| 901 | 874 | return wd17xx_data_r(dev,offset); |
| 902 | 875 | case 0x0ffc: |
| 876 | printf("FDC: read FM type\n"); |
| 877 | return 0xff; |
| 903 | 878 | case 0x0ffd: |
| 879 | printf("FDC: read MFM typex\n"); |
| 880 | return 0xff; |
| 904 | 881 | case 0x0ffe: |
| 882 | printf("FDC: read 1.6M type\n"); |
| 883 | return 0xff; |
| 905 | 884 | case 0x0fff: |
| 906 | | logerror("FDC: read from %04x\n",offset+0xff8); |
| 885 | printf("FDC: switching between 500k/1M\n"); |
| 907 | 886 | return 0xff; |
| 908 | 887 | } |
| 909 | 888 | |
| r10133 | r10134 | |
| 937 | 916 | case 0x0ffd: |
| 938 | 917 | case 0x0ffe: |
| 939 | 918 | case 0x0fff: |
| 940 | | logerror("FDC: write to %04x = %02x\n",offset+0xff8,data); |
| 919 | logerror("FDC: invalid write to %04x = %02x\n",offset+0xff8,data); |
| 941 | 920 | break; |
| 942 | 921 | } |
| 943 | 922 | } |
| r10133 | r10134 | |
| 1109 | 1088 | *************************************/ |
| 1110 | 1089 | |
| 1111 | 1090 | /* for bitmap mode */ |
| 1112 | | |
| 1113 | 1091 | static void set_current_palette(running_machine *machine) |
| 1114 | 1092 | { |
| 1115 | 1093 | x1_state *state = machine->driver_data<x1_state>(); |
| r10133 | r10134 | |
| 1125 | 1103 | } |
| 1126 | 1104 | } |
| 1127 | 1105 | |
| 1106 | /* Note: docs claims that reading the palette ports makes the value to change somehow in X1 mode ... |
| 1107 | In 4096 color mode, it's used for reading the value back. */ |
| 1128 | 1108 | static WRITE8_HANDLER( x1_pal_r_w ) |
| 1129 | 1109 | { |
| 1130 | 1110 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1131 | 1111 | state->x_r = data; |
| 1132 | 1112 | set_current_palette(space->machine); |
| 1113 | |
| 1114 | /* TODO: 4096 mode for x1turboz */ |
| 1133 | 1115 | } |
| 1134 | 1116 | |
| 1135 | 1117 | static WRITE8_HANDLER( x1_pal_g_w ) |
| r10133 | r10134 | |
| 1137 | 1119 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1138 | 1120 | state->x_g = data; |
| 1139 | 1121 | set_current_palette(space->machine); |
| 1122 | |
| 1123 | /* TODO: 4096 mode for x1turboz */ |
| 1140 | 1124 | } |
| 1141 | 1125 | |
| 1142 | 1126 | static WRITE8_HANDLER( x1_pal_b_w ) |
| r10133 | r10134 | |
| 1144 | 1128 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1145 | 1129 | state->x_b = data; |
| 1146 | 1130 | set_current_palette(space->machine); |
| 1131 | |
| 1132 | /* TODO: 4096 mode for x1turboz */ |
| 1147 | 1133 | } |
| 1148 | 1134 | |
| 1149 | 1135 | static WRITE8_HANDLER( x1_ex_gfxram_w ) |
| r10133 | r10134 | |
| 1164 | 1150 | /* |
| 1165 | 1151 | SCRN flags |
| 1166 | 1152 | |
| 1167 | | d0(01) = 0:low res 1:high res |
| 1168 | | d1(02) = 0:1 raster 1:2 raster <- 0=400-line mode, legal when 'd0=1' |
| 1169 | | d2(04) = 0:25(20) lines 1:12(10) lines |
| 1170 | | d3(08) = 0:bank 0 0:bank 1 <- display |
| 1171 | | d4(10) = 0:bank 0 0:bank 1 <- access |
| 1172 | | d5(20) = 0:compatibility 1:high speed <- define PCG mode |
| 1173 | | d6(40) = 0:8-raster graphics 1:16-raster graphics |
| 1174 | | d7(80) = 0:don't display 1:display <- underline (when 1, graphics are not displayed) |
| 1175 | | |
| 1176 | | The value output by the X1turbo's IOCS at 0x1fd* |
| 1177 | | is stored in memory at 0xf8d6 |
| 1153 | d0(01) = 0:low resolution (15KHz) 1: high resolution (24KHz) |
| 1154 | d1(02) = 0:1 raster / pixel 1:2 raster / pixel |
| 1155 | d2(04) = 0:8 rasters / CHR 1:16 rasters / CHR |
| 1156 | d3(08) = 0:bank 0 0:bank 1 <- display |
| 1157 | d4(10) = 0:bank 0 0:bank 1 <- access |
| 1158 | d5(20) = 0:compatibility 1:high speed <- define PCG mode |
| 1159 | d6(40) = 0:8-raster graphics 1:16-raster graphics |
| 1160 | d7(80) = 0:don't display 1:display <- underline (when 1, graphics are not displayed) |
| 1178 | 1161 | */ |
| 1179 | 1162 | static WRITE8_HANDLER( x1_scrn_w ) |
| 1180 | 1163 | { |
| r10133 | r10134 | |
| 1185 | 1168 | state->scrn_reg.v400_mode = ((data & 0x03) == 3) ? 1 : 0; |
| 1186 | 1169 | if(data & 0xc4) |
| 1187 | 1170 | printf("SCRN = %02x\n",data & 0xc4); |
| 1171 | if((data & 0x03) == 1) |
| 1172 | printf("SCRN sets true 400 lines mode\n"); |
| 1188 | 1173 | } |
| 1189 | 1174 | |
| 1190 | | static WRITE8_HANDLER( x1_ply_w ) |
| 1175 | static WRITE8_HANDLER( x1_pri_w ) |
| 1191 | 1176 | { |
| 1192 | 1177 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1193 | | state->scrn_reg.ply = data; |
| 1194 | | // printf("PLY = %02x\n",data); |
| 1178 | state->scrn_reg.pri = data; |
| 1179 | // printf("PRI = %02x\n",data); |
| 1195 | 1180 | } |
| 1196 | 1181 | |
| 1197 | 1182 | static WRITE8_HANDLER( x1_6845_w ) |
| r10133 | r10134 | |
| 1222 | 1207 | static READ8_HANDLER( x1_blackclip_r ) |
| 1223 | 1208 | { |
| 1224 | 1209 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1210 | /* TODO: this returns only on x1turboz */ |
| 1225 | 1211 | return state->scrn_reg.blackclip; |
| 1226 | 1212 | } |
| 1227 | 1213 | |
| r10133 | r10134 | |
| 1229 | 1215 | { |
| 1230 | 1216 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1231 | 1217 | state->scrn_reg.blackclip = data; |
| 1218 | if(data & 0xf0) |
| 1219 | printf("Blackclip data access %02x\n",data); |
| 1232 | 1220 | } |
| 1233 | 1221 | |
| 1234 | 1222 | static READ8_HANDLER( x1turbo_pal_r ) |
| r10133 | r10134 | |
| 1296 | 1284 | |
| 1297 | 1285 | |
| 1298 | 1286 | /* |
| 1299 | | * FIXME: this makes no sense atm, the only game that uses this function so far is Hyper Olympics '84 disk version |
| 1287 | * FIXME: this is still wrong, the only game that uses this function so far is Hyper Olympics '84 disk version. Perhaps it's the source ROM that isn't correct ... |
| 1300 | 1288 | */ |
| 1301 | 1289 | static READ8_HANDLER( x1_kanji_r ) |
| 1302 | 1290 | { |
| r10133 | r10134 | |
| 1305 | 1293 | UINT8 res; |
| 1306 | 1294 | |
| 1307 | 1295 | //res = 0; |
| 1296 | res = kanji_rom[state->kanji_addr*2+offset]; |
| 1308 | 1297 | |
| 1309 | | printf("%08x\n",state->kanji_addr*0x20+state->kanji_count); |
| 1298 | if(offset == 1) |
| 1299 | state->kanji_addr_latch++; |
| 1310 | 1300 | |
| 1311 | | res = kanji_rom[(state->kanji_addr*0x20)+(state->kanji_count)]; |
| 1312 | | state->kanji_count++; |
| 1313 | | state->kanji_count&=0x1f; |
| 1314 | | |
| 1315 | | //printf("%04x R\n",offset); |
| 1316 | | |
| 1317 | 1301 | return res; |
| 1318 | 1302 | } |
| 1319 | 1303 | |
| r10133 | r10134 | |
| 1321 | 1305 | { |
| 1322 | 1306 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1323 | 1307 | // if(offset < 2) |
| 1324 | | printf("%04x %02x W\n",offset,data); |
| 1325 | 1308 | |
| 1326 | 1309 | switch(offset) |
| 1327 | 1310 | { |
| 1328 | | case 0: state->kanji_addr_l = (data & 0xff); break; |
| 1329 | | case 1: state->kanji_addr_h = (data & 0xff); state->kanji_count = 0; break; |
| 1311 | case 0: state->kanji_addr_latch = (data & 0xff)|(state->kanji_addr_latch&0xff00); break; |
| 1312 | case 1: state->kanji_addr_latch = (data<<8)|(state->kanji_addr_latch&0x00ff); break; |
| 1330 | 1313 | case 2: |
| 1331 | | if(data) |
| 1314 | { |
| 1315 | /* 0 -> selects Expanded EEPROM */ |
| 1316 | /* 1 -> selects Kanji ROM */ |
| 1317 | /* 0 -> 1 -> latches Kanji ROM data */ |
| 1318 | |
| 1319 | if(((state->kanji_eksel & 1) == 0) && ((data & 1) == 1)) |
| 1332 | 1320 | { |
| 1333 | | state->kanji_addr = (state->kanji_addr_h<<8) | (state->kanji_addr_l); |
| 1321 | state->kanji_addr = (state->kanji_addr_latch); |
| 1334 | 1322 | //state->kanji_addr &= 0x3fff; //<- temp kludge until the rom is redumped. |
| 1335 | 1323 | //printf("%08x\n",state->kanji_addr); |
| 1336 | 1324 | //state->kanji_addr+= state->kanji_count; |
| 1337 | 1325 | } |
| 1338 | | break; |
| 1326 | state->kanji_eksel = data & 1; |
| 1327 | } |
| 1328 | break; |
| 1339 | 1329 | } |
| 1340 | 1330 | } |
| 1341 | 1331 | |
| r10133 | r10134 | |
| 1351 | 1341 | UINT8 *videoram = state->videoram; |
| 1352 | 1342 | state->io_bank_mode = 0; //any read disables the extended mode. |
| 1353 | 1343 | |
| 1344 | if(offset == 0x0e03) { return x1_rom_r(space, 0); } |
| 1345 | // TODO: user could install ym2151 on plain X1 too |
| 1346 | //0x700, 0x701 |
| 1354 | 1347 | //if(offset >= 0x0704 && offset <= 0x0707) { return z80ctc_r(space->machine->device("ctc"), offset-0x0704); } |
| 1355 | | if(offset == 0x0e03) { return x1_rom_r(space, 0); } |
| 1356 | 1348 | else if(offset >= 0x0ff8 && offset <= 0x0fff) { return x1_fdc_r(space, offset-0xff8); } |
| 1357 | 1349 | else if(offset >= 0x1400 && offset <= 0x17ff) { return x1_pcg_r(space, offset-0x1400); } |
| 1358 | 1350 | else if(offset >= 0x1900 && offset <= 0x19ff) { return sub_io_r(space, 0); } |
| r10133 | r10134 | |
| 1380 | 1372 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1381 | 1373 | UINT8 *videoram = state->videoram; |
| 1382 | 1374 | if(state->io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } |
| 1375 | // TODO: user could install ym2151 on plain X1 too |
| 1376 | //0x700, 0x701 |
| 1383 | 1377 | // else if(offset >= 0x0704 && offset <= 0x0707) { z80ctc_w(space->machine->device("ctc"), offset-0x0704,data); } |
| 1384 | 1378 | // else if(offset >= 0x0c00 && offset <= 0x0cff) { x1_rs232c_w(space->machine, 0, data); } |
| 1385 | 1379 | else if(offset >= 0x0e00 && offset <= 0x0e02) { x1_rom_w(space, offset-0xe00,data); } |
| r10133 | r10134 | |
| 1388 | 1382 | else if(offset >= 0x1000 && offset <= 0x10ff) { x1_pal_b_w(space, 0,data); } |
| 1389 | 1383 | else if(offset >= 0x1100 && offset <= 0x11ff) { x1_pal_r_w(space, 0,data); } |
| 1390 | 1384 | else if(offset >= 0x1200 && offset <= 0x12ff) { x1_pal_g_w(space, 0,data); } |
| 1391 | | else if(offset >= 0x1300 && offset <= 0x13ff) { x1_ply_w(space, 0,data); } |
| 1385 | else if(offset >= 0x1300 && offset <= 0x13ff) { x1_pri_w(space, 0,data); } |
| 1392 | 1386 | else if(offset >= 0x1400 && offset <= 0x17ff) { x1_pcg_w(space, offset-0x1400,data); } |
| 1393 | 1387 | else if(offset == 0x1800 || offset == 0x1801) { x1_6845_w(space, offset-0x1800, data); } |
| 1394 | 1388 | else if(offset >= 0x1900 && offset <= 0x19ff) { sub_io_w(space, 0,data); } |
| r10133 | r10134 | |
| 1406 | 1400 | // else if(offset >= 0x1fb9 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb9,data); } |
| 1407 | 1401 | // else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } |
| 1408 | 1402 | // else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } |
| 1409 | | else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } |
| 1403 | // else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } |
| 1410 | 1404 | // else if(offset == 0x1fe0) { x1_blackclip_w(space,0,data); } |
| 1411 | 1405 | else if(offset >= 0x2000 && offset <= 0x2fff) { state->colorram[offset-0x2000] = data; } |
| 1412 | 1406 | else if(offset >= 0x3000 && offset <= 0x3fff) { videoram[offset-0x3000] = state->pcg_write_addr = data; } |
| r10133 | r10134 | |
| 1417 | 1411 | } |
| 1418 | 1412 | } |
| 1419 | 1413 | |
| 1414 | /* TODO: I should actually simplify this, by just overwriting X1 Turbo specifics here, and call plain X1 functions otherwise */ |
| 1415 | // * at the end states devices used on plain X1 too |
| 1420 | 1416 | static READ8_HANDLER( x1turbo_io_r ) |
| 1421 | 1417 | { |
| 1422 | 1418 | x1_state *state = space->machine->driver_data<x1_state>(); |
| r10133 | r10134 | |
| 1425 | 1421 | |
| 1426 | 1422 | if(offset == 0x0700) { return (ym2151_r(space->machine->device("ym"), offset-0x0700) & 0x7f) | (input_port_read(space->machine, "SOUND_SW") & 0x80); } |
| 1427 | 1423 | else if(offset == 0x0701) { return ym2151_r(space->machine->device("ym"), offset-0x0700); } |
| 1424 | //0x704 is FM sound detection port on X1 turboZ |
| 1428 | 1425 | else if(offset >= 0x0704 && offset <= 0x0707) { return z80ctc_r(space->machine->device("ctc"), offset-0x0704); } |
| 1426 | else if(offset == 0x0801) { printf("Color image board read\n"); return 0xff; } // * |
| 1427 | else if(offset == 0x0803) { printf("Color image board 2 read\n"); return 0xff; } // * |
| 1428 | else if(offset >= 0x0a00 && offset <= 0x0a07) { printf("Stereoscopic board read %04x\n",offset); return 0xff; } // * |
| 1429 | else if(offset == 0x0b00) { printf("Bank memory switch read\n"); return 0xff; } |
| 1430 | else if(offset >= 0x0c00 && offset <= 0x0cff) { printf("RS-232C read %04x\n",offset); return 0xff; } // * |
| 1431 | else if(offset >= 0x0d00 && offset <= 0x0dff) { printf("EMM read %04x\n",offset); return 0xff; } // * |
| 1429 | 1432 | else if(offset == 0x0e03) { return x1_rom_r(space, 0); } |
| 1430 | | else if(offset >= 0x0e80 && offset <= 0x0e83) { return x1_kanji_r(space, offset-0xe80); } |
| 1433 | else if(offset >= 0x0e80 && offset <= 0x0e81) { return x1_kanji_r(space, offset-0xe80); } |
| 1434 | else if(offset >= 0x0fd0 && offset <= 0x0fd3) { /* printf("SASI HDD read %04x\n",offset); */ return 0xff; } // * |
| 1435 | else if(offset >= 0x0fe8 && offset <= 0x0fef) { printf("8-inch FD read %04x\n",offset); return 0xff; } // * |
| 1431 | 1436 | else if(offset >= 0x0ff8 && offset <= 0x0fff) { return x1_fdc_r(space, offset-0xff8); } |
| 1432 | 1437 | else if(offset >= 0x1400 && offset <= 0x17ff) { return x1_pcg_r(space, offset-0x1400); } |
| 1433 | 1438 | else if(offset >= 0x1900 && offset <= 0x19ff) { return sub_io_r(space, 0); } |
| r10133 | r10134 | |
| 1436 | 1441 | else if(offset >= 0x1f80 && offset <= 0x1f8f) { return z80dma_r(space->machine->device("dma"), 0); } |
| 1437 | 1442 | else if(offset >= 0x1f90 && offset <= 0x1f91) { return z80sio_c_r(space->machine->device("sio"), (offset-0x1f90) & 1); } |
| 1438 | 1443 | else if(offset >= 0x1f92 && offset <= 0x1f93) { return z80sio_d_r(space->machine->device("sio"), (offset-0x1f92) & 1); } |
| 1444 | else if(offset >= 0x1f98 && offset <= 0x1f9f) { printf("Extended SIO/CTC read %04x\n",offset); return 0xff; } |
| 1439 | 1445 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { return z80ctc_r(space->machine->device("ctc"), offset-0x1fa0); } |
| 1440 | 1446 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { return z80ctc_r(space->machine->device("ctc"), offset-0x1fa8); } |
| 1441 | | else if(offset == 0x1fb0) { return x1turbo_pal_r(space,0); } |
| 1442 | | else if(offset >= 0x1fb8 && offset <= 0x1fbf) { return x1turbo_txpal_r(space,offset-0x1fb8); } |
| 1443 | | else if(offset == 0x1fc0) { return x1turbo_txdisp_r(space,0); } |
| 1444 | | else if(offset == 0x1fc5) { return x1turbo_gfxpal_r(space,0); } |
| 1445 | | // else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } |
| 1447 | else if(offset == 0x1fb0) { return x1turbo_pal_r(space,0); } // Z only! |
| 1448 | else if(offset >= 0x1fb8 && offset <= 0x1fbf) { return x1turbo_txpal_r(space,offset-0x1fb8); } //Z only! |
| 1449 | else if(offset == 0x1fc0) { return x1turbo_txdisp_r(space,0); } // Z only! |
| 1450 | else if(offset == 0x1fc5) { return x1turbo_gfxpal_r(space,0); } // Z only! |
| 1451 | // else if(offset >= 0x1fd0 && offset <= 0x1fdf) { return x1_scrn_r(space,offset-0x1fd0); } //Z only |
| 1446 | 1452 | else if(offset == 0x1fe0) { return x1_blackclip_r(space,0); } |
| 1453 | else if(offset == 0x1ff0) { return input_port_read(space->machine, "X1TURBO_DSW"); } |
| 1447 | 1454 | else if(offset >= 0x2000 && offset <= 0x2fff) { return state->colorram[offset-0x2000]; } |
| 1448 | 1455 | else if(offset >= 0x3000 && offset <= 0x3fff) { return videoram[offset-0x3000]; } |
| 1449 | 1456 | else if(offset >= 0x4000 && offset <= 0xffff) { return state->gfx_bitmap_ram[offset-0x4000+(state->scrn_reg.gfx_bank*0xc000)]; } |
| 1450 | 1457 | else |
| 1451 | 1458 | { |
| 1452 | | //0xfd0-0xfd7: FDC extended area? |
| 1453 | | //0x1ff0: if 0, game screen is interlaced |
| 1454 | 1459 | logerror("(PC=%06x) Read i/o address %04x\n",cpu_get_pc(space->cpu),offset); |
| 1455 | 1460 | } |
| 1456 | 1461 | return 0xff; |
| r10133 | r10134 | |
| 1460 | 1465 | { |
| 1461 | 1466 | x1_state *state = space->machine->driver_data<x1_state>(); |
| 1462 | 1467 | UINT8 *videoram = state->videoram; |
| 1463 | | if(state->io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } |
| 1468 | if(state->io_bank_mode == 1) { x1_ex_gfxram_w(space, offset, data); } |
| 1464 | 1469 | else if(offset == 0x0700 || offset == 0x0701) { ym2151_w(space->machine->device("ym"), offset-0x0700,data); } |
| 1470 | //0x704 is FM sound detection port on X1 turboZ |
| 1465 | 1471 | else if(offset >= 0x0704 && offset <= 0x0707) { z80ctc_w(space->machine->device("ctc"), offset-0x0704,data); } |
| 1466 | | // else if(offset >= 0x0c00 && offset <= 0x0cff) { x1_rs232c_w(space->machine, 0, data); } |
| 1472 | else if(offset == 0x0800) { printf("Color image board write %02x\n",data); } // * |
| 1473 | else if(offset == 0x0802) { printf("Color image board 2 write %02x\n",data); } // * |
| 1474 | else if(offset >= 0x0a00 && offset <= 0x0a07) { printf("Stereoscopic board write %04x %02x\n",offset,data); } // * |
| 1475 | else if(offset == 0x0b00) { printf("Bank memory switch write %02x\n",data); } |
| 1476 | else if(offset >= 0x0c00 && offset <= 0x0cff) { printf("RS-232C write %04x %02x\n",offset,data); } // * |
| 1477 | else if(offset >= 0x0d00 && offset <= 0x0dff) { printf("EMM write %04x %02x\n",offset,data); } // * |
| 1467 | 1478 | else if(offset >= 0x0e00 && offset <= 0x0e02) { x1_rom_w(space, offset-0xe00,data); } |
| 1468 | 1479 | else if(offset >= 0x0e80 && offset <= 0x0e83) { x1_kanji_w(space, offset-0xe80,data); } |
| 1480 | else if(offset >= 0x0fd0 && offset <= 0x0fd3) { printf("SASI HDD write %04x %02x\n",offset,data); } // * |
| 1481 | else if(offset >= 0x0fe8 && offset <= 0x0fef) { printf("8-inch FD write %04x %02x\n",offset,data); } // * |
| 1469 | 1482 | else if(offset >= 0x0ff8 && offset <= 0x0fff) { x1_fdc_w(space, offset-0xff8,data); } |
| 1470 | 1483 | else if(offset >= 0x1000 && offset <= 0x10ff) { x1_pal_b_w(space, 0,data); } |
| 1471 | 1484 | else if(offset >= 0x1100 && offset <= 0x11ff) { x1_pal_r_w(space, 0,data); } |
| 1472 | 1485 | else if(offset >= 0x1200 && offset <= 0x12ff) { x1_pal_g_w(space, 0,data); } |
| 1473 | | else if(offset >= 0x1300 && offset <= 0x13ff) { x1_ply_w(space, 0,data); } |
| 1486 | else if(offset >= 0x1300 && offset <= 0x13ff) { x1_pri_w(space, 0,data); } |
| 1474 | 1487 | else if(offset >= 0x1400 && offset <= 0x17ff) { x1_pcg_w(space, offset-0x1400,data); } |
| 1475 | 1488 | else if(offset == 0x1800 || offset == 0x1801) { x1_6845_w(space, offset-0x1800, data); } |
| 1476 | 1489 | else if(offset >= 0x1900 && offset <= 0x19ff) { sub_io_w(space, 0,data); } |
| r10133 | r10134 | |
| 1482 | 1495 | else if(offset >= 0x1f80 && offset <= 0x1f8f) { z80dma_w(space->machine->device("dma"), 0,data); } |
| 1483 | 1496 | else if(offset >= 0x1f90 && offset <= 0x1f91) { z80sio_c_w(space->machine->device("sio"), (offset-0x1f90) & 1,data); } |
| 1484 | 1497 | else if(offset >= 0x1f92 && offset <= 0x1f93) { z80sio_d_w(space->machine->device("sio"), (offset-0x1f92) & 1,data); } |
| 1498 | else if(offset >= 0x1f98 && offset <= 0x1f9f) { printf("Extended SIO/CTC write %04x %02x\n",offset,data); } |
| 1485 | 1499 | else if(offset >= 0x1fa0 && offset <= 0x1fa3) { z80ctc_w(space->machine->device("ctc"), offset-0x1fa0,data); } |
| 1486 | 1500 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { z80ctc_w(space->machine->device("ctc"), offset-0x1fa8,data); } |
| 1487 | | else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } |
| 1488 | | else if(offset >= 0x1fb8 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb8,data); } |
| 1489 | | else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } |
| 1490 | | else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } |
| 1501 | else if(offset == 0x1fb0) { x1turbo_pal_w(space,0,data); } // Z only! |
| 1502 | else if(offset >= 0x1fb8 && offset <= 0x1fbf) { x1turbo_txpal_w(space,offset-0x1fb8,data); } //Z only! |
| 1503 | else if(offset == 0x1fc0) { x1turbo_txdisp_w(space,0,data); } //Z only! |
| 1504 | else if(offset == 0x1fc1) { printf("Z image capturing access %02x\n",data); } // Z only! |
| 1505 | else if(offset == 0x1fc2) { printf("Z mosaic effect access %02x\n",data); } // Z only! |
| 1506 | else if(offset == 0x1fc3) { printf("Z Chroma key access %02x\n",data); } // Z only! |
| 1507 | else if(offset == 0x1fc4) { printf("Z Extra scroll config access %02x\n",data); } // Z only! |
| 1508 | else if(offset == 0x1fc5) { x1turbo_gfxpal_w(space,0,data); } // Z only! |
| 1491 | 1509 | else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } |
| 1492 | 1510 | else if(offset == 0x1fe0) { x1_blackclip_w(space,0,data); } |
| 1493 | 1511 | else if(offset >= 0x2000 && offset <= 0x2fff) { state->colorram[offset-0x2000] = data; } |
| r10133 | r10134 | |
| 1538 | 1556 | -x-- ---- "sub cpu ibf" |
| 1539 | 1557 | --x- ---- "sub cpu obf" |
| 1540 | 1558 | ---x ---- ROM/RAM flag (0=ROM, 1=RAM) |
| 1541 | | ---- x--- "busy" |
| 1559 | ---- x--- "busy" <- allow printer data output |
| 1542 | 1560 | ---- -x-- "v sync" |
| 1543 | 1561 | ---- --x- "cmt read" |
| 1544 | | ---- ---x "cmt test" (active low) |
| 1562 | ---- ---x "cmt test" (active low) <- actually this is "Sub CPU detected BREAK" |
| 1545 | 1563 | */ |
| 1546 | 1564 | UINT8 dat = 0; |
| 1547 | 1565 | state->vdisp = (device->machine->primary_screen->vpos() < 200) ? 0x80 : 0x00; |
| r10133 | r10134 | |
| 1571 | 1589 | x1_state *state = device->machine->driver_data<x1_state>(); |
| 1572 | 1590 | //printf("PPI Port C read\n"); |
| 1573 | 1591 | /* |
| 1574 | | x--x xxxx <unknown> |
| 1592 | x--- ---- Printer port output |
| 1575 | 1593 | -x-- ---- 320 mode (r/w) |
| 1576 | 1594 | --x- ---- i/o mode (r/w) |
| 1595 | ---x ---- smooth scroll enabled (?) |
| 1596 | ---- ---x cassette output data |
| 1577 | 1597 | */ |
| 1578 | 1598 | return (state->io_sys & 0x9f) | state->hres_320 | ~state->io_switch; |
| 1579 | 1599 | } |
| r10133 | r10134 | |
| 1912 | 1932 | #endif |
| 1913 | 1933 | INPUT_PORTS_END |
| 1914 | 1934 | |
| 1935 | INPUT_PORTS_START( x1turbo ) |
| 1936 | PORT_INCLUDE( x1 ) |
| 1937 | |
| 1938 | PORT_START("X1TURBO_DSW") |
| 1939 | PORT_DIPNAME( 0x01, 0x01, "Interlace mode" ) |
| 1940 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 1941 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1942 | PORT_DIPNAME( 0x0e, 0x00, "Default Boot Device" ) // this selects what kind of device is loaded at start-up |
| 1943 | PORT_DIPSETTING( 0x00, "5/3-inch 2D" ) |
| 1944 | PORT_DIPSETTING( 0x02, "5/3-inch 2DD" ) |
| 1945 | PORT_DIPSETTING( 0x04, "5/3-inch 2HD" ) |
| 1946 | PORT_DIPSETTING( 0x06, "5/3-inch 2DD (IBM)" ) |
| 1947 | PORT_DIPSETTING( 0x08, "8-inch 2D256" ) |
| 1948 | PORT_DIPSETTING( 0x0a, "8-inch 2D256 (IBM)" ) |
| 1949 | PORT_DIPSETTING( 0x0c, "8-inch 1S128 (IBM)" ) |
| 1950 | PORT_DIPSETTING( 0x0e, "SASI HDD" ) |
| 1951 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 1952 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 1953 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1954 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) //this is a port conditional of some sort ... |
| 1955 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 1956 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1957 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 1958 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 1959 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1960 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 1961 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 1962 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 1963 | INPUT_PORTS_END |
| 1964 | |
| 1915 | 1965 | /************************************* |
| 1916 | 1966 | * |
| 1917 | 1967 | * GFX decoding |
| r10133 | r10134 | |
| 2462 | 2512 | } |
| 2463 | 2513 | |
| 2464 | 2514 | |
| 2465 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 2466 | | COMP( 1982, x1, 0, 0, x1, x1, 0, "Sharp", "X1 (CZ-800C)", 0) |
| 2467 | | COMP( 1986, x1twin, x1, 0, x1, x1, kanji,"Sharp", "X1 Twin (CZ-830C)", GAME_NOT_WORKING) |
| 2468 | | COMP( 1984, x1turbo, x1, 0, x1turbo, x1, kanji,"Sharp", "X1 Turbo (CZ-850C)", GAME_NOT_WORKING) //model 10 |
| 2469 | | COMP( 1985, x1turbo40, x1, 0, x1turbo, x1, kanji,"Sharp", "X1 Turbo (CZ-862C)", GAME_NOT_WORKING) //model 40 |
| 2515 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ |
| 2516 | COMP( 1982, x1, 0, 0, x1, x1, 0, "Sharp", "X1 (CZ-800C)", 0) |
| 2517 | COMP( 1986, x1twin, x1, 0, x1, x1, kanji,"Sharp", "X1 Twin (CZ-830C)", GAME_NOT_WORKING) |
| 2518 | COMP( 1984, x1turbo, x1, 0, x1turbo, x1turbo, kanji,"Sharp", "X1 Turbo (CZ-850C)", GAME_NOT_WORKING) //model 10 |
| 2519 | COMP( 1985, x1turbo40, x1, 0, x1turbo, x1turbo, kanji,"Sharp", "X1 Turbo (CZ-862C)", GAME_NOT_WORKING) //model 40 |
| 2470 | 2520 | // x1turboz /* 1986 Sharp X1 TurboZ */ |