src/mess/machine/c65.c
| r5842 | r5843 | |
| 1 | 1 | /*************************************************************************** |
| 2 | | commodore c65 home computer |
| 3 | | peter.trauner@jk.uni-linz.ac.at |
| 2 | commodore c65 home computer |
| 3 | peter.trauner@jk.uni-linz.ac.at |
| 4 | 4 | documention |
| 5 | 5 | www.funet.fi |
| 6 | 6 | ***************************************************************************/ |
| r5842 | r5843 | |
| 30 | 30 | } \ |
| 31 | 31 | } while (0) |
| 32 | 32 | |
| 33 | | static int c65_charset_select = 0; |
| 33 | static int c65_charset_select; |
| 34 | 34 | |
| 35 | | static int c64mode = 0; |
| 35 | static int c64mode; |
| 36 | 36 | |
| 37 | | static UINT8 c65_6511_port = 0xff; |
| 37 | static UINT8 c65_6511_port; |
| 38 | 38 | static UINT8 c65_keyline = { 0xff }; |
| 39 | 39 | |
| 40 | 40 | static UINT8 serial_clock, serial_data, serial_atn; |
| 41 | | static UINT8 vicirq = 0; |
| 41 | static UINT8 vicirq; |
| 42 | 42 | |
| 43 | 43 | /*UINT8 *c65_basic; */ |
| 44 | 44 | /*UINT8 *c65_kernal; */ |
| r5842 | r5843 | |
| 49 | 49 | /*UINT8 *c65_graphics; */ |
| 50 | 50 | |
| 51 | 51 | |
| 52 | | static void c65_nmi(running_machine *machine) |
| 52 | static void c65_nmi( running_machine *machine ) |
| 53 | 53 | { |
| 54 | 54 | static int nmilevel = 0; |
| 55 | 55 | const device_config *cia_1 = devtag_get_device(machine, "cia_1"); |
| r5842 | r5843 | |
| 66 | 66 | |
| 67 | 67 | /*********************************************** |
| 68 | 68 | |
| 69 | | CIA Interfaces |
| 69 | CIA Interfaces |
| 70 | 70 | |
| 71 | 71 | ***********************************************/ |
| 72 | 72 | |
| 73 | 73 | /* |
| 74 | | * CIA 0 - Port A keyboard line select |
| 75 | | * CIA 0 - Port B keyboard line read |
| 74 | * CIA 0 - Port A keyboard line select |
| 75 | * CIA 0 - Port B keyboard line read |
| 76 | 76 | * |
| 77 | | * flag cassette read input, serial request in |
| 78 | | * irq to irq connected |
| 77 | * flag cassette read input, serial request in |
| 78 | * irq to irq connected |
| 79 | 79 | * |
| 80 | | * see machine/cbm.c |
| 80 | * see machine/cbm.c |
| 81 | 81 | */ |
| 82 | 82 | |
| 83 | 83 | static READ8_DEVICE_HANDLER( c65_cia0_port_a_r ) |
| r5842 | r5843 | |
| 102 | 102 | |
| 103 | 103 | static WRITE8_DEVICE_HANDLER( c65_cia0_port_b_w ) |
| 104 | 104 | { |
| 105 | | // was there lightpen support in c65 video chip? |
| 106 | | // vic2_lightpen_write(data & 0x10); |
| 105 | // was there lightpen support in c65 video chip? |
| 106 | // vic2_lightpen_write(data & 0x10); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | | static void c65_irq (running_machine *machine, int level) |
| 109 | static void c65_irq( running_machine *machine, int level ) |
| 110 | 110 | { |
| 111 | 111 | static int old_level = 0; |
| 112 | 112 | |
| r5842 | r5843 | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /* is this correct for c65 as well as c64? */ |
| 122 | | static void c65_cia0_interrupt (const device_config *device, int level) |
| 122 | static void c65_cia0_interrupt( const device_config *device, int level ) |
| 123 | 123 | { |
| 124 | 124 | c65_irq (device->machine, level || vicirq); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /* is this correct for c65 as well as c64? */ |
| 128 | | static void c65_vic_interrupt (running_machine *machine, int level) |
| 128 | static void c65_vic_interrupt( running_machine *machine, int level ) |
| 129 | 129 | { |
| 130 | 130 | const device_config *cia_0 = devtag_get_device(machine, "cia_0"); |
| 131 | 131 | #if 1 |
| r5842 | r5843 | |
| 209 | 209 | c64_vicaddr = c64_memory + helper[data & 0x03]; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | | static void c65_cia1_interrupt (const device_config *device, int level) |
| 212 | static void c65_cia1_interrupt( const device_config *device, int level ) |
| 213 | 213 | { |
| 214 | 214 | c65_nmi(device->machine); |
| 215 | 215 | } |
| r5842 | r5843 | |
| 241 | 241 | |
| 242 | 242 | /*********************************************** |
| 243 | 243 | |
| 244 | | Memory Handlers |
| 244 | Memory Handlers |
| 245 | 245 | |
| 246 | 246 | ***********************************************/ |
| 247 | 247 | |
| 248 | 248 | /* processor has only 1 mega address space !? */ |
| 249 | 249 | /* and system 8 megabyte */ |
| 250 | 250 | /* dma controller and bankswitch hardware ?*/ |
| 251 | | static READ8_HANDLER(c65_read_mem) |
| 251 | static READ8_HANDLER( c65_read_mem ) |
| 252 | 252 | { |
| 253 | 253 | UINT8 result; |
| 254 | | if (offset <= 0x0FFFF) |
| 254 | if (offset <= 0x0ffff) |
| 255 | 255 | result = c64_memory[offset]; |
| 256 | 256 | else |
| 257 | 257 | result = memory_read_byte(space, offset); |
| 258 | 258 | return result; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | | static WRITE8_HANDLER(c65_write_mem) |
| 261 | static WRITE8_HANDLER( c65_write_mem ) |
| 262 | 262 | { |
| 263 | | if (offset <= 0x0FFFF) |
| 263 | if (offset <= 0x0ffff) |
| 264 | 264 | c64_memory[offset] = data; |
| 265 | 265 | else |
| 266 | 266 | memory_write_byte(space, offset, data); |
| r5842 | r5843 | |
| 275 | 275 | writing banknumber to offset 2 |
| 276 | 276 | writing hibyte to offset 1 |
| 277 | 277 | writing lobyte to offset 0 |
| 278 | | cpu holded, dma transfer (data at address) executed, cpu activated |
| 278 | cpu holded, dma transfer(data at address) executed, cpu activated |
| 279 | 279 | |
| 280 | 280 | command data: |
| 281 | 281 | 0 command (0 copy, 3 fill) |
| r5842 | r5843 | |
| 295 | 295 | version 2: |
| 296 | 296 | cmd 0x30 used for this |
| 297 | 297 | */ |
| 298 | | static void c65_dma_port_w(running_machine *machine, int offset, int value) |
| 298 | static void c65_dma_port_w( running_machine *machine, int offset, int value ) |
| 299 | 299 | { |
| 300 | 300 | static int dump = 0; |
| 301 | 301 | PAIR pair, src, dst, len; |
| r5842 | r5843 | |
| 303 | 303 | int i; |
| 304 | 304 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 305 | 305 | |
| 306 | | switch (offset & 3) |
| 306 | switch (offset & 3) |
| 307 | 307 | { |
| 308 | 308 | case 2: |
| 309 | 309 | case 1: |
| r5842 | r5843 | |
| 327 | 327 | dst.b.h = c65_read_mem(space, pair.d++); |
| 328 | 328 | dst.b.h2 = c65_read_mem(space, pair.d++); |
| 329 | 329 | |
| 330 | | switch (cmd) |
| 330 | switch (cmd) |
| 331 | 331 | { |
| 332 | 332 | case 0: |
| 333 | 333 | if (src.d == 0x3ffff) dump = 1; |
| r5842 | r5843 | |
| 337 | 337 | len.w.l, src.d, dst.d, c65_read_mem(space, pair.d), |
| 338 | 338 | c65_read_mem(space, pair.d + 1) ) ); |
| 339 | 339 | if ((dma.version == 1) |
| 340 | | && ( (src.d&0x400000) || (dst.d & 0x400000))) |
| 340 | && ( (src.d&0x400000) || (dst.d & 0x400000))) |
| 341 | 341 | { |
| 342 | | if (!(src.d & 0x400000)) |
| 342 | if (!(src.d & 0x400000)) |
| 343 | 343 | { |
| 344 | 344 | dst.d &= ~0x400000; |
| 345 | 345 | for (i = 0; i < len.w.l; i++) |
| 346 | 346 | c65_write_mem(space, dst.d--, c65_read_mem(space, src.d++)); |
| 347 | 347 | } |
| 348 | | else if (!(dst.d & 0x400000)) |
| 348 | else if (!(dst.d & 0x400000)) |
| 349 | 349 | { |
| 350 | 350 | src.d &= ~0x400000; |
| 351 | 351 | for (i = 0; i < len.w.l; i++) |
| 352 | 352 | c65_write_mem(space, dst.d++, c65_read_mem(space, src.d--)); |
| 353 | | } |
| 354 | | else |
| 353 | } |
| 354 | else |
| 355 | 355 | { |
| 356 | 356 | src.d &= ~0x400000; |
| 357 | 357 | dst.d &= ~0x400000; |
| 358 | 358 | for (i = 0; i < len.w.l; i++) |
| 359 | 359 | c65_write_mem(space, --dst.d, c65_read_mem(space, --src.d)); |
| 360 | 360 | } |
| 361 | | } |
| 362 | | else |
| 361 | } |
| 362 | else |
| 363 | 363 | { |
| 364 | 364 | for (i = 0; i < len.w.l; i++) |
| 365 | 365 | c65_write_mem(space, dst.d++, c65_read_mem(space, src.d++)); |
| r5842 | r5843 | |
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | | static int c65_dma_port_r(running_machine *machine, int offset) |
| 397 | static int c65_dma_port_r( running_machine *machine, int offset ) |
| 398 | 398 | { |
| 399 | 399 | /* offset 3 bit 7 in progress ? */ |
| 400 | 400 | DBG_LOG(machine, 2, "dma chip read", ("%.3x\n", offset)); |
| 401 | 401 | return 0x7f; |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | | static void c65_6511_port_w(running_machine *machine, int offset, int value) |
| 404 | static void c65_6511_port_w( running_machine *machine, int offset, int value ) |
| 405 | 405 | { |
| 406 | | if (offset == 7) |
| 406 | if (offset == 7) |
| 407 | 407 | { |
| 408 | 408 | c65_6511_port = value; |
| 409 | 409 | } |
| 410 | 410 | DBG_LOG(machine, 2, "r6511 write", ("%.2x %.2x\n", offset, value)); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | | static int c65_6511_port_r(running_machine *machine, int offset) |
| 413 | static int c65_6511_port_r( running_machine *machine, int offset ) |
| 414 | 414 | { |
| 415 | 415 | int data = 0xff; |
| 416 | 416 | |
| 417 | | if (offset == 7) |
| 417 | if (offset == 7) |
| 418 | 418 | { |
| 419 | | if (input_port_read(machine, "SPECIAL") & 0x20) |
| 419 | if (input_port_read(machine, "SPECIAL") & 0x20) |
| 420 | 420 | data &= ~1; |
| 421 | 421 | } |
| 422 | 422 | DBG_LOG(machine, 2, "r6511 read", ("%.2x\n", offset)); |
| r5842 | r5843 | |
| 537 | 537 | #if 0 |
| 538 | 538 | static void c65_fdc_state(void) |
| 539 | 539 | { |
| 540 | | switch (c65_fdc.state) |
| 540 | switch (c65_fdc.state) |
| 541 | 541 | { |
| 542 | 542 | case FDC_CMD_MOTOR_SPIN_UP: |
| 543 | | if (timer_get_time(machine) - c65_fdc.time) |
| 543 | if (timer_get_time(machine) - c65_fdc.time) |
| 544 | 544 | { |
| 545 | 545 | c65_fdc.state = 0; |
| 546 | 546 | c65_fdc.status &= ~FDC_BUSY; |
| r5842 | r5843 | |
| 553 | 553 | static void c65_fdc_w( running_machine *machine, int offset, int data ) |
| 554 | 554 | { |
| 555 | 555 | DBG_LOG(machine, 1, "fdc write", ("%.5x %.2x %.2x\n", cpu_get_pc(cputag_get_cpu(machine, "maincpu")), offset, data)); |
| 556 | | switch (offset & 0xf) |
| 556 | switch (offset & 0xf) |
| 557 | 557 | { |
| 558 | 558 | case 0: |
| 559 | 559 | c65_fdc.reg[0] = data; |
| 560 | 560 | break; |
| 561 | 561 | case 1: |
| 562 | 562 | c65_fdc.reg[1] = data; |
| 563 | | switch (data & 0xf9) |
| 563 | switch (data & 0xf9) |
| 564 | 564 | { |
| 565 | 565 | case 0x20: // wait for motor spin up |
| 566 | 566 | c65_fdc.status &= ~(FDC_IRQ|FDC_LOST|FDC_CRC|FDC_RNF); |
| r5842 | r5843 | |
| 606 | 606 | static int c65_fdc_r( running_machine *machine, int offset ) |
| 607 | 607 | { |
| 608 | 608 | UINT8 data = 0; |
| 609 | | switch (offset & 0xf) |
| 609 | switch (offset & 0xf) |
| 610 | 610 | { |
| 611 | 611 | case 0: |
| 612 | 612 | data = c65_fdc.reg[0]; |
| r5842 | r5843 | |
| 659 | 659 | UINT8 reg; |
| 660 | 660 | } expansion_ram = {0}; |
| 661 | 661 | |
| 662 | | static READ8_HANDLER(c65_ram_expansion_r) |
| 662 | static READ8_HANDLER( c65_ram_expansion_r ) |
| 663 | 663 | { |
| 664 | 664 | UINT8 data = 0xff; |
| 665 | 665 | if (mess_ram_size > (128 * 1024)) |
| r5842 | r5843 | |
| 667 | 667 | return data; |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | | static WRITE8_HANDLER(c65_ram_expansion_w) |
| 670 | static WRITE8_HANDLER( c65_ram_expansion_w ) |
| 671 | 671 | { |
| 672 | 672 | offs_t expansion_ram_begin; |
| 673 | 673 | offs_t expansion_ram_end; |
| r5842 | r5843 | |
| 689 | 689 | } |
| 690 | 690 | } |
| 691 | 691 | |
| 692 | | static WRITE8_HANDLER ( c65_write_io ) |
| 692 | static WRITE8_HANDLER( c65_write_io ) |
| 693 | 693 | { |
| 694 | 694 | const device_config *sid_0 = devtag_get_device(space->machine, "sid_r"); |
| 695 | 695 | const device_config *sid_1 = devtag_get_device(space->machine, "sid_l"); |
| 696 | 696 | |
| 697 | | switch(offset&0xf00) { |
| 697 | switch (offset & 0xf00) |
| 698 | { |
| 698 | 699 | case 0x000: |
| 699 | 700 | if (offset < 0x80) |
| 700 | | vic3_port_w (space, offset & 0x7f, data); |
| 701 | | else if (offset < 0xa0) { |
| 701 | vic3_port_w(space, offset & 0x7f, data); |
| 702 | else if (offset < 0xa0) |
| 702 | 703 | c65_fdc_w(space->machine, offset&0x1f,data); |
| 703 | | } else { |
| 704 | else |
| 705 | { |
| 704 | 706 | c65_ram_expansion_w(space, offset&0x1f, data); |
| 705 | 707 | /*ram expansion crtl optional */ |
| 706 | 708 | } |
| 707 | 709 | break; |
| 708 | | case 0x100:case 0x200: case 0x300: |
| 710 | case 0x100: |
| 711 | case 0x200: |
| 712 | case 0x300: |
| 709 | 713 | vic3_palette_w(space, offset-0x100,data); |
| 710 | 714 | break; |
| 711 | 715 | case 0x400: |
| r5842 | r5843 | |
| 728 | 732 | } |
| 729 | 733 | } |
| 730 | 734 | |
| 731 | | static WRITE8_HANDLER ( c65_write_io_dc00 ) |
| 735 | static WRITE8_HANDLER( c65_write_io_dc00 ) |
| 732 | 736 | { |
| 733 | 737 | const device_config *cia_0 = devtag_get_device(space->machine, "cia_0"); |
| 734 | 738 | const device_config *cia_1 = devtag_get_device(space->machine, "cia_1"); |
| 735 | 739 | |
| 736 | | switch(offset & 0xf00) |
| 740 | switch (offset & 0xf00) |
| 737 | 741 | { |
| 738 | 742 | case 0x000: |
| 739 | 743 | cia_w(cia_0, offset, data); |
| r5842 | r5843 | |
| 748 | 752 | } |
| 749 | 753 | } |
| 750 | 754 | |
| 751 | | static READ8_HANDLER ( c65_read_io ) |
| 755 | static READ8_HANDLER( c65_read_io ) |
| 752 | 756 | { |
| 753 | 757 | const device_config *sid_0 = devtag_get_device(space->machine, "sid_r"); |
| 754 | 758 | const device_config *sid_1 = devtag_get_device(space->machine, "sid_l"); |
| 755 | 759 | |
| 756 | | switch(offset & 0xf00) |
| 760 | switch (offset & 0xf00) |
| 757 | 761 | { |
| 758 | 762 | case 0x000: |
| 759 | 763 | if (offset < 0x80) |
| 760 | | return vic3_port_r (space, offset & 0x7f); |
| 761 | | if (offset < 0xa0) |
| 762 | | { |
| 764 | return vic3_port_r(space, offset & 0x7f); |
| 765 | if (offset < 0xa0) |
| 763 | 766 | return c65_fdc_r(space->machine, offset&0x1f); |
| 764 | | } |
| 765 | | else |
| 767 | else |
| 766 | 768 | { |
| 767 | 769 | return c65_ram_expansion_r(space, offset&0x1f); |
| 768 | 770 | /*return; ram expansion crtl optional */ |
| 769 | 771 | } |
| 770 | 772 | break; |
| 771 | 773 | case 0x100: |
| 772 | | case 0x200: |
| 774 | case 0x200: |
| 773 | 775 | case 0x300: |
| 774 | 776 | /* read only !? */ |
| 775 | 777 | DBG_LOG(space->machine, 1, "io read", ("%.3x\n", offset)); |
| r5842 | r5843 | |
| 792 | 794 | return 0xff; |
| 793 | 795 | } |
| 794 | 796 | |
| 795 | | static READ8_HANDLER ( c65_read_io_dc00 ) |
| 797 | static READ8_HANDLER( c65_read_io_dc00 ) |
| 796 | 798 | { |
| 797 | 799 | const device_config *cia_0 = devtag_get_device(space->machine, "cia_0"); |
| 798 | 800 | const device_config *cia_1 = devtag_get_device(space->machine, "cia_1"); |
| 799 | 801 | |
| 800 | | switch(offset & 0x300) |
| 802 | switch (offset & 0x300) |
| 801 | 803 | { |
| 802 | 804 | case 0x000: |
| 803 | 805 | return cia_r(cia_0, offset); |
| r5842 | r5843 | |
| 822 | 824 | /* bit 1 external sync enable (genlock) |
| 823 | 825 | bit 2 palette enable |
| 824 | 826 | bit 6 vic3 c65 character set */ |
| 825 | | static void c65_bankswitch_interface(running_machine *machine, int value) |
| 827 | static void c65_bankswitch_interface( running_machine *machine, int value ) |
| 826 | 828 | { |
| 827 | 829 | static int old = 0; |
| 828 | 830 | read8_space_func rh; |
| r5842 | r5843 | |
| 848 | 850 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0dc00, 0x0dfff, 0, 0, wh); |
| 849 | 851 | } |
| 850 | 852 | |
| 851 | | c65_io_dc00_on =! (value & 1); |
| 853 | c65_io_dc00_on = !(value & 1); |
| 852 | 854 | #if 0 |
| 853 | 855 | /* cartridge roms !?*/ |
| 854 | 856 | if (value & 0x08) |
| 855 | | memory_set_bankptr (machine, 1, c64_roml); |
| 857 | memory_set_bankptr(machine, 1, c64_roml); |
| 856 | 858 | else |
| 857 | | memory_set_bankptr (machine, 1, c64_memory + 0x8000); |
| 859 | memory_set_bankptr(machine, 1, c64_memory + 0x8000); |
| 858 | 860 | |
| 859 | 861 | if (value & 0x10) |
| 860 | | memory_set_bankptr (machine, 2, c64_basic); |
| 862 | memory_set_bankptr(machine, 2, c64_basic); |
| 861 | 863 | else |
| 862 | | memory_set_bankptr (machine, 2, c64_memory + 0xa000); |
| 864 | memory_set_bankptr(machine, 2, c64_memory + 0xa000); |
| 863 | 865 | #endif |
| 864 | | if ((old^value) & 0x20) |
| 865 | | { |
| 866 | if ((old^value) & 0x20) |
| 867 | { |
| 866 | 868 | /* bankswitching faulty when doing actual page */ |
| 867 | | if (value & 0x20) |
| 868 | | memory_set_bankptr (machine, 3, c65_interface); |
| 869 | if (value & 0x20) |
| 870 | memory_set_bankptr(machine, 3, c65_interface); |
| 869 | 871 | else |
| 870 | | memory_set_bankptr (machine, 3, c64_memory + 0xc000); |
| 872 | memory_set_bankptr(machine, 3, c64_memory + 0xc000); |
| 871 | 873 | } |
| 872 | | c65_charset_select=value&0x40; |
| 874 | c65_charset_select = value & 0x40; |
| 873 | 875 | #if 0 |
| 874 | 876 | /* cartridge roms !?*/ |
| 875 | 877 | if (value & 0x80) |
| 876 | | memory_set_bankptr (machine, 8, c64_kernal); |
| 878 | memory_set_bankptr(machine, 8, c64_kernal); |
| 877 | 879 | else |
| 878 | | memory_set_bankptr (machine, 6, c64_memory + 0xe000); |
| 880 | memory_set_bankptr(machine, 6, c64_memory + 0xe000); |
| 879 | 881 | #endif |
| 880 | | old=value; |
| 882 | old = value; |
| 881 | 883 | } |
| 882 | 884 | |
| 883 | | void c65_bankswitch (running_machine *machine) |
| 885 | void c65_bankswitch( running_machine *machine ) |
| 884 | 886 | { |
| 885 | 887 | static int old = -1; |
| 886 | 888 | int data, loram, hiram, charen; |
| r5842 | r5843 | |
| 896 | 898 | hiram = (data & 2) ? 1 : 0; |
| 897 | 899 | charen = (data & 4) ? 1 : 0; |
| 898 | 900 | |
| 899 | | if ((!c64_game && c64_exrom) |
| 900 | | || (loram && hiram && !c64_exrom)) |
| 901 | | { |
| 902 | | memory_set_bankptr (machine, 1, c64_roml); |
| 903 | | } |
| 901 | if ((!c64_game && c64_exrom) || (loram && hiram && !c64_exrom)) |
| 902 | memory_set_bankptr(machine, 1, c64_roml); |
| 904 | 903 | else |
| 905 | | { |
| 906 | | memory_set_bankptr (machine, 1, c64_memory + 0x8000); |
| 907 | | } |
| 904 | memory_set_bankptr(machine, 1, c64_memory + 0x8000); |
| 908 | 905 | |
| 909 | | if ((!c64_game && c64_exrom && hiram) |
| 910 | | || (!c64_exrom)) |
| 911 | | { |
| 912 | | memory_set_bankptr (machine, 2, c64_romh); |
| 913 | | } |
| 906 | if ((!c64_game && c64_exrom && hiram) || (!c64_exrom)) |
| 907 | memory_set_bankptr(machine, 2, c64_romh); |
| 914 | 908 | else if (loram && hiram) |
| 915 | | { |
| 916 | | memory_set_bankptr (machine, 2, c64_basic); |
| 917 | | } |
| 909 | memory_set_bankptr(machine, 2, c64_basic); |
| 918 | 910 | else |
| 919 | | { |
| 920 | | memory_set_bankptr (machine, 2, c64_memory + 0xa000); |
| 921 | | } |
| 911 | memory_set_bankptr(machine, 2, c64_memory + 0xa000); |
| 922 | 912 | |
| 923 | | if ((!c64_game && c64_exrom) |
| 924 | | || (charen && (loram || hiram))) |
| 913 | if ((!c64_game && c64_exrom) || (charen && (loram || hiram))) |
| 925 | 914 | { |
| 926 | 915 | c65_io_on = 1; |
| 927 | 916 | rh4 = c65_read_io; |
| 928 | 917 | wh5 = c65_write_io; |
| 929 | | memory_set_bankptr (machine, 6, c64_colorram); |
| 930 | | memory_set_bankptr (machine, 7, c64_colorram); |
| 918 | memory_set_bankptr(machine, 6, c64_colorram); |
| 919 | memory_set_bankptr(machine, 7, c64_colorram); |
| 931 | 920 | |
| 932 | 921 | if (c65_io_dc00_on) |
| 933 | 922 | { |
| r5842 | r5843 | |
| 938 | 927 | { |
| 939 | 928 | rh8 = SMH_BANK(8); |
| 940 | 929 | wh9 = SMH_BANK(9); |
| 941 | | memory_set_bankptr (machine, 8, c64_colorram+0x400); |
| 942 | | memory_set_bankptr (machine, 9, c64_colorram+0x400); |
| 930 | memory_set_bankptr(machine, 8, c64_colorram + 0x400); |
| 931 | memory_set_bankptr(machine, 9, c64_colorram + 0x400); |
| 943 | 932 | } |
| 944 | 933 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0dc00, 0x0dfff, 0, 0, rh8); |
| 945 | 934 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0dc00, 0x0dfff, 0, 0, wh9); |
| r5842 | r5843 | |
| 949 | 938 | c65_io_on = 0; |
| 950 | 939 | rh4 = SMH_BANK(4); |
| 951 | 940 | wh5 = SMH_BANK(5); |
| 952 | | memory_set_bankptr(machine, 5, c64_memory+0xd000); |
| 953 | | memory_set_bankptr(machine, 7, c64_memory+0xd800); |
| 954 | | memory_set_bankptr(machine, 9, c64_memory+0xdc00); |
| 941 | memory_set_bankptr(machine, 5, c64_memory + 0xd000); |
| 942 | memory_set_bankptr(machine, 7, c64_memory + 0xd800); |
| 943 | memory_set_bankptr(machine, 9, c64_memory + 0xdc00); |
| 955 | 944 | if (!charen && (loram || hiram)) |
| 956 | 945 | { |
| 957 | | memory_set_bankptr (machine, 4, c64_chargen); |
| 958 | | memory_set_bankptr (machine, 6, c64_chargen+0x800); |
| 959 | | memory_set_bankptr (machine, 8, c64_chargen+0xc00); |
| 946 | memory_set_bankptr(machine, 4, c64_chargen); |
| 947 | memory_set_bankptr(machine, 6, c64_chargen + 0x800); |
| 948 | memory_set_bankptr(machine, 8, c64_chargen + 0xc00); |
| 960 | 949 | } |
| 961 | 950 | else |
| 962 | 951 | { |
| 963 | | memory_set_bankptr (machine, 4, c64_memory + 0xd000); |
| 964 | | memory_set_bankptr (machine, 6, c64_memory + 0xd800); |
| 965 | | memory_set_bankptr (machine, 8, c64_memory + 0xdc00); |
| 952 | memory_set_bankptr(machine, 4, c64_memory + 0xd000); |
| 953 | memory_set_bankptr(machine, 6, c64_memory + 0xd800); |
| 954 | memory_set_bankptr(machine, 8, c64_memory + 0xdc00); |
| 966 | 955 | } |
| 967 | 956 | } |
| 968 | 957 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0d000, 0x0d7ff, 0, 0, rh4); |
| r5842 | r5843 | |
| 970 | 959 | |
| 971 | 960 | if (!c64_game && c64_exrom) |
| 972 | 961 | { |
| 973 | | memory_set_bankptr (machine, 10, c64_romh); |
| 962 | memory_set_bankptr(machine, 10, c64_romh); |
| 974 | 963 | } |
| 975 | 964 | else |
| 976 | 965 | { |
| 977 | 966 | if (hiram) |
| 978 | 967 | { |
| 979 | | memory_set_bankptr (machine, 10, c64_kernal); |
| 968 | memory_set_bankptr(machine, 10, c64_kernal); |
| 980 | 969 | } |
| 981 | 970 | else |
| 982 | 971 | { |
| 983 | | memory_set_bankptr (machine, 10, c64_memory + 0xe000); |
| 972 | memory_set_bankptr(machine, 10, c64_memory + 0xe000); |
| 984 | 973 | } |
| 985 | 974 | } |
| 986 | 975 | old = data; |
| 987 | 976 | } |
| 988 | 977 | |
| 989 | | void c65_colorram_write (int offset, int value) |
| 978 | void c65_colorram_write( int offset, int value ) |
| 990 | 979 | { |
| 991 | 980 | c64_colorram[offset & 0x7ff] = value | 0xf0; |
| 992 | 981 | } |
| r5842 | r5843 | |
| 996 | 985 | * a15 and a14 portlines |
| 997 | 986 | * 0x1000-0x1fff, 0x9000-0x9fff char rom |
| 998 | 987 | */ |
| 999 | | static int c65_dma_read(running_machine *machine, int offset) |
| 988 | static int c65_dma_read( running_machine *machine, int offset ) |
| 1000 | 989 | { |
| 1001 | 990 | if (!c64_game && c64_exrom) |
| 1002 | 991 | { |
| r5842 | r5843 | |
| 1019 | 1008 | return c64_vicaddr[offset & 0x3fff]; |
| 1020 | 1009 | } |
| 1021 | 1010 | |
| 1022 | | static int c65_dma_read_color(running_machine *machine, int offset) |
| 1011 | static int c65_dma_read_color( running_machine *machine, int offset ) |
| 1023 | 1012 | { |
| 1024 | | if (c64mode) return c64_colorram[offset&0x3ff]&0xf; |
| 1013 | if (c64mode) |
| 1014 | return c64_colorram[offset & 0x3ff] & 0xf; |
| 1025 | 1015 | return c64_colorram[offset & 0x7ff]; |
| 1026 | 1016 | } |
| 1027 | 1017 | |
| 1028 | | static void c65_common_driver_init (running_machine *machine) |
| 1018 | static void c65_common_driver_init( running_machine *machine ) |
| 1029 | 1019 | { |
| 1030 | 1020 | c64_memory = auto_alloc_array_clear(machine, UINT8, 0x10000); |
| 1031 | 1021 | memory_set_bankptr(machine, 11, c64_memory + 0x00000); |
| r5842 | r5843 | |
| 1034 | 1024 | memory_set_bankptr(machine, 14, c64_memory + 0x0c000); |
| 1035 | 1025 | memory_set_bankptr(machine, 15, c64_memory + 0x0e000); |
| 1036 | 1026 | |
| 1027 | c65_charset_select = 0; |
| 1028 | c65_6511_port = 0xff; |
| 1029 | vicirq = 0; |
| 1030 | |
| 1037 | 1031 | /* C65 had no datasette port */ |
| 1038 | 1032 | c64_tape_on = 0; |
| 1039 | 1033 | |
| 1040 | | /*memset(c64_memory+0x40000, 0, 0x800000-0x40000); */ |
| 1034 | /*memset(c64_memory + 0x40000, 0, 0x800000 - 0x40000); */ |
| 1041 | 1035 | |
| 1042 | 1036 | vic4567_init(machine, c64_pal, c65_dma_read, c65_dma_read_color, c65_vic_interrupt, c65_bankswitch_interface); |
| 1043 | 1037 | } |
| r5842 | r5843 | |
| 1047 | 1041 | c64_pal = 0; |
| 1048 | 1042 | dma.version = 2; |
| 1049 | 1043 | c65_common_driver_init(machine); |
| 1050 | | |
| 1051 | 1044 | } |
| 1052 | 1045 | |
| 1053 | 1046 | DRIVER_INIT( c65pal ) |
src/mess/machine/vc1541.c
| r5842 | r5843 | |
| 96 | 96 | 2 heads |
| 97 | 97 | |
| 98 | 98 | */ |
| 99 | | /* 2008-09 FP |
| 99 | /* 2008-09 FP |
| 100 | 100 | Started some work on the floppy emulation code: |
| 101 | | + made the functions / structs less vc1541-centric & d64-centric |
| 102 | | + unified config & reset functions, using type variable |
| 103 | | to choose the actions to be done |
| 104 | | + moved GCR encoding at loading time (wip untested code) |
| 105 | | |
| 101 | + made the functions / structs less vc1541-centric & d64-centric |
| 102 | + unified config & reset functions, using type variable |
| 103 | to choose the actions to be done |
| 104 | + moved GCR encoding at loading time (wip untested code) |
| 105 | |
| 106 | 106 | A limitation is clear: only a single occurrence of emulated drive |
| 107 | | is expected. |
| 107 | is expected. |
| 108 | 108 | At a later stage, at least drive_config & drive_reset will need |
| 109 | 109 | an index to choose between the drives |
| 110 | 110 | In the end, we could also split the floppy drives emulation from the |
| 111 | 111 | disk image handling... |
| 112 | 112 | |
| 113 | 113 | Current status: |
| 114 | | + preliminary vc1541 & c1551 implementation (quite slow, especially |
| 115 | | if you turn on logging) |
| 116 | | + no support for other drive types (even if now I list all |
| 117 | | the variants supported by Vice in the enum) |
| 118 | | + communications between the drive CPU and the computer CPU have |
| 119 | | to be checked, debugged and improved: somehow it works, but no |
| 120 | | sync bit is set (encoding bug? timers-related bug?) and the drive |
| 121 | | keeps reading beyond the end of the track (synchronization |
| 122 | | problems?) |
| 123 | | + all but .g64 images should be correctly encoded at loading time |
| 124 | | (I actually have doubts about some .d82 details) |
| 125 | | + error maps are not still used, even if their presence is |
| 126 | | acknowledged |
| 127 | | + floppy drives should become devices and use ROMREGION_LOADBYNAME |
| 128 | | for their ROMs (not the current defines) |
| 129 | | + all available drive dumps are included for each systems using it |
| 130 | | (vc1541 = sx64, vip64, c16v, plus4v; vc1571 = c128d; vc1571cr = c128dcr; |
| 131 | | vc1581 = c128d81; vc1540 = vc20v, vic20plv; c2031 = vc20i (only dumps added); |
| 132 | | c1551 = c16c, plus4c). this is only a temporary workaround to document |
| 133 | | available dumps. correct revisions will be used with each systems when |
| 134 | | emulation works (or 'default' bios will be used for most common |
| 135 | | configurations, when machines were compatible with more than a single |
| 136 | | drive model) |
| 114 | + preliminary vc1541 & c1551 implementation (quite slow, especially |
| 115 | if you turn on logging) |
| 116 | + no support for other drive types (even if now I list all |
| 117 | the variants supported by Vice in the enum) |
| 118 | + communications between the drive CPU and the computer CPU have |
| 119 | to be checked, debugged and improved: somehow it works, but no |
| 120 | sync bit is set (encoding bug? timers-related bug?) and the drive |
| 121 | keeps reading beyond the end of the track (synchronization |
| 122 | problems?) |
| 123 | + all but .g64 images should be correctly encoded at loading time |
| 124 | (I actually have doubts about some .d82 details) |
| 125 | + error maps are not still used, even if their presence is |
| 126 | acknowledged |
| 127 | + floppy drives should become devices and use ROMREGION_LOADBYNAME |
| 128 | for their ROMs (not the current defines) |
| 129 | + all available drive dumps are included for each systems using it |
| 130 | (vc1541 = sx64, vip64, c16v, plus4v; vc1571 = c128d; vc1571cr = c128dcr; |
| 131 | vc1581 = c128d81; vc1540 = vc20v, vic20plv; c2031 = vc20i (only dumps added); |
| 132 | c1551 = c16c, plus4c). this is only a temporary workaround to document |
| 133 | available dumps. correct revisions will be used with each systems when |
| 134 | emulation works (or 'default' bios will be used for most common |
| 135 | configurations, when machines were compatible with more than a single |
| 136 | drive model) |
| 137 | 137 | */ |
| 138 | 138 | /* |
| 139 | 139 | Informations on the fileformats (which the code is based on) |
| r5842 | r5843 | |
| 146 | 146 | GCR - http://www.baltissen.org/newhtm/1541c.htm |
| 147 | 147 | |
| 148 | 148 | Other info sources: |
| 149 | | http://sta.c64.org/cbm1541mem.html |
| 149 | http://sta.c64.org/cbm1541mem.html |
| 150 | 150 | |
| 151 | 151 | */ |
| 152 | 152 | |
| r5842 | r5843 | |
| 184 | 184 | |
| 185 | 185 | /******************************************* |
| 186 | 186 | |
| 187 | | Structures |
| 187 | Structures |
| 188 | 188 | |
| 189 | 189 | *******************************************/ |
| 190 | 190 | |
| 191 | 191 | /* Legacy code. At a later stage, we should convert everything to devices. |
| 192 | | However, fixing the C64 / Floppy drive communications is a priority over |
| 192 | However, fixing the C64 / Floppy drive communications is a priority over |
| 193 | 193 | cleaning up of this part */ |
| 194 | 194 | |
| 195 | 195 | |
| r5842 | r5843 | |
| 200 | 200 | } |
| 201 | 201 | serial; |
| 202 | 202 | |
| 203 | | typedef struct |
| 203 | typedef struct |
| 204 | 204 | { |
| 205 | 205 | int sync; // active after > 9 '1's |
| 206 | 206 | int ones_count; |
| 207 | 207 | int ready; // needed for 1551 |
| 208 | | UINT8 data[0x500000]; // entire d64 image encoded at loading time |
| 208 | UINT8 *data; // entire d64 image encoded at loading time |
| 209 | 209 | } GCR_data; |
| 210 | 210 | |
| 211 | 211 | typedef struct |
| r5842 | r5843 | |
| 232 | 232 | |
| 233 | 233 | int via0irq, via1irq; |
| 234 | 234 | |
| 235 | | } vc1541_drive_emu; |
| 235 | } _vc1541_drive_emu_t; |
| 236 | 236 | |
| 237 | 237 | typedef struct |
| 238 | 238 | { |
| r5842 | r5843 | |
| 253 | 253 | UINT8 cpu_ddr, cpu_port; |
| 254 | 254 | void *irq_timer; |
| 255 | 255 | |
| 256 | | } c1551_drive_emu; |
| 256 | } _c1551_drive_emu_t; |
| 257 | 257 | |
| 258 | | static vc1541_drive_emu vc1541_drive_static = { 0 }, *vc1541_drive = &vc1541_drive_static; |
| 259 | | static c1551_drive_emu c1551_drive_static = { 0 }, *c1551_drive = &c1551_drive_static; |
| 258 | static _vc1541_drive_emu_t vc1541_drive; |
| 259 | static _c1551_drive_emu_t c1551_drive; |
| 260 | 260 | |
| 261 | 261 | |
| 262 | 262 | /******************************************* |
| 263 | 263 | |
| 264 | | Format specific code |
| 264 | Format specific code |
| 265 | 265 | |
| 266 | 266 | *******************************************/ |
| 267 | 267 | |
| r5842 | r5843 | |
| 279 | 279 | 18, 18, 18, 18, 18, 18, |
| 280 | 280 | 17, 17, 17, 17, 17, |
| 281 | 281 | 17, 17, 17, 17, 17, /* only for 40 tracks d64 */ |
| 282 | | 17, 17 /* in principle the drive could read 42 tracks */ |
| 282 | 17, 17 /* in principle the drive could read 42 tracks */ |
| 283 | 283 | }; |
| 284 | 284 | |
| 285 | 285 | #define D71_MAX_TRACKS 70 |
| r5842 | r5843 | |
| 305 | 305 | static const int d80_sectors_per_track[] = |
| 306 | 306 | { |
| 307 | 307 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
| 308 | | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
| 308 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
| 309 | 309 | 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, |
| 310 | 310 | 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, |
| 311 | 311 | 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23 |
| r5842 | r5843 | |
| 319 | 319 | static const int d82_sectors_per_track[] = |
| 320 | 320 | { |
| 321 | 321 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
| 322 | | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
| 322 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
| 323 | 323 | 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, |
| 324 | 324 | 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, |
| 325 | 325 | 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, |
| 326 | 326 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
| 327 | | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
| 327 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
| 328 | 328 | 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, |
| 329 | 329 | 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, |
| 330 | 330 | 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23 |
| r5842 | r5843 | |
| 346 | 346 | 0 /* Still to add support for .g64 */ |
| 347 | 347 | }; |
| 348 | 348 | |
| 349 | | static int image_offset[IMAGE_MAX_TRACKS] = { 0 }; |
| 350 | | static int gcr_offset[IMAGE_MAX_TRACKS] = { 0 }; |
| 349 | static int image_offset[IMAGE_MAX_TRACKS]; |
| 350 | static int gcr_offset[IMAGE_MAX_TRACKS]; |
| 351 | 351 | |
| 352 | 352 | /******************************************* |
| 353 | 353 | |
| 354 | | Offset initialization |
| 354 | Offset initialization |
| 355 | 355 | |
| 356 | 356 | *******************************************/ |
| 357 | 357 | |
| r5842 | r5843 | |
| 411 | 411 | |
| 412 | 412 | /******************************************* |
| 413 | 413 | |
| 414 | | Generic image handling |
| 414 | Generic image handling |
| 415 | 415 | |
| 416 | 416 | *******************************************/ |
| 417 | 417 | |
| 418 | 418 | |
| 419 | 419 | /* This calculates starting offset (from the beginning of the image file) of a sector */ |
| 420 | 420 | /* Since sectors are always 256 bytes large, this works no matter the file format! */ |
| 421 | | static int image_tracksector2offset (int track, int sector) |
| 421 | static int image_tracksector2offset( int track, int sector ) |
| 422 | 422 | { |
| 423 | 423 | return image_offset[track - 1] + sector * 256; |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | /* |
| 427 | 427 | // WARNING: this would work with a d64 image... it has to be adapted to work with GCR image we store at loading time |
| 428 | | static void image_offset2tracksector (int offset) |
| 428 | static void image_offset2tracksector( int offset ) |
| 429 | 429 | { |
| 430 | | int track = 0, sector = 0, helper, i = 0; |
| 431 | | |
| 432 | | helper = offset; |
| 433 | | |
| 434 | | do |
| 435 | | { |
| 436 | | helper -= (d64_sectors_per_track[++i] * 256); |
| 437 | | } while ( helper > 0); |
| 438 | | |
| 439 | | track = i; |
| 430 | int track = 0, sector = 0, helper, i = 0; |
| 440 | 431 | |
| 441 | | sector = (offset - image_offset[track]) / 256; |
| 432 | helper = offset; |
| 442 | 433 | |
| 443 | | logerror("We are reading at offset %d, which is in track %d and sector %d \n", offset, track, sector); |
| 434 | do |
| 435 | { |
| 436 | helper -= (d64_sectors_per_track[++i] * 256); |
| 437 | } while (helper > 0); |
| 438 | |
| 439 | track = i; |
| 440 | |
| 441 | sector = (offset - image_offset[track]) / 256; |
| 442 | |
| 443 | logerror("We are reading at offset %d, which is in track %d and sector %d \n", offset, track, sector); |
| 444 | 444 | } |
| 445 | 445 | */ |
| 446 | 446 | |
| r5842 | r5843 | |
| 450 | 450 | indeed, in these cases a g64 image is needed (which stores the |
| 451 | 451 | Disk ID as coded in the GCR data) */ |
| 452 | 452 | |
| 453 | | static int disk_id1 (int format) |
| 453 | static int disk_id1( int format ) |
| 454 | 454 | { |
| 455 | 455 | int id1 = 0; |
| 456 | 456 | |
| r5842 | r5843 | |
| 480 | 480 | logerror("Unsupported format\n"); |
| 481 | 481 | break; |
| 482 | 482 | } |
| 483 | | |
| 483 | |
| 484 | 484 | return id1; |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | |
| 488 | | static int disk_id2 (int format) |
| 488 | static int disk_id2( int format ) |
| 489 | 489 | { |
| 490 | 490 | int id2 = 0; |
| 491 | 491 | |
| r5842 | r5843 | |
| 515 | 515 | logerror("Unsupported format\n"); |
| 516 | 516 | break; |
| 517 | 517 | } |
| 518 | | |
| 518 | |
| 519 | 519 | return id2; |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | |
| 523 | 523 | /* Four different frequencies for the 4 different zones on the disk */ |
| 524 | 524 | /* These work for 1541 drives, are the same for other drives? */ |
| 525 | | static const double drive_times[4]= |
| 525 | static const double drive_times[4]= |
| 526 | 526 | { |
| 527 | 527 | XTAL_16_MHz / 13, XTAL_16_MHz / 14, XTAL_16_MHz / 15, XTAL_16_MHz / 16 |
| 528 | 528 | }; |
| r5842 | r5843 | |
| 530 | 530 | |
| 531 | 531 | /* Commodore GCR format */ |
| 532 | 532 | /* |
| 533 | | Original Encoded |
| 534 | | 4 bits 5 bits |
| 533 | Original Encoded |
| 534 | 4 bits 5 bits |
| 535 | 535 | |
| 536 | | 0000 -> 01010 = 0x0a |
| 537 | | 0001 -> 01011 = 0x0b |
| 538 | | 0010 -> 10010 = 0x12 |
| 539 | | 0011 -> 10011 = 0x13 |
| 540 | | 0100 -> 01110 = 0x0e |
| 541 | | 0101 -> 01111 = 0x0f |
| 542 | | 0110 -> 10110 = 0x16 |
| 543 | | 0111 -> 10111 = 0x17 |
| 544 | | 1000 -> 01001 = 0x09 |
| 545 | | 1001 -> 11001 = 0x19 |
| 546 | | 1010 -> 11010 = 0x1a |
| 547 | | 1011 -> 11011 = 0x1b |
| 548 | | 1100 -> 01101 = 0x0d |
| 549 | | 1101 -> 11101 = 0x1d |
| 550 | | 1110 -> 11110 = 0x1e |
| 551 | | 1111 -> 10101 = 0x15 |
| 536 | 0000 -> 01010 = 0x0a |
| 537 | 0001 -> 01011 = 0x0b |
| 538 | 0010 -> 10010 = 0x12 |
| 539 | 0011 -> 10011 = 0x13 |
| 540 | 0100 -> 01110 = 0x0e |
| 541 | 0101 -> 01111 = 0x0f |
| 542 | 0110 -> 10110 = 0x16 |
| 543 | 0111 -> 10111 = 0x17 |
| 544 | 1000 -> 01001 = 0x09 |
| 545 | 1001 -> 11001 = 0x19 |
| 546 | 1010 -> 11010 = 0x1a |
| 547 | 1011 -> 11011 = 0x1b |
| 548 | 1100 -> 01101 = 0x0d |
| 549 | 1101 -> 11101 = 0x1d |
| 550 | 1110 -> 11110 = 0x1e |
| 551 | 1111 -> 10101 = 0x15 |
| 552 | 552 | |
| 553 | | We use the encoded values in bytes because we use them to encode |
| 553 | We use the encoded values in bytes because we use them to encode |
| 554 | 554 | groups of 4 bytes into groups of 5 bytes, below. |
| 555 | 555 | */ |
| 556 | 556 | |
| r5842 | r5843 | |
| 563 | 563 | |
| 564 | 564 | /* This could be of use if we ever implement saving in .d64 format, to convert back GCR -> d64 */ |
| 565 | 565 | /* |
| 566 | | static const int gcr_2_bin[] = |
| 566 | static const int gcr_2_bin[] = |
| 567 | 567 | { |
| 568 | | -1, -1, -1, -1, |
| 569 | | -1, -1, -1, -1, |
| 570 | | -1, 0x08, 0x00, 0x01, |
| 571 | | -1, 0x0c, 0x04, 0x05, |
| 572 | | -1, -1, 0x02, 0x03, |
| 573 | | -1, 0x0f, 0x06, 0x07, |
| 574 | | -1, 0x09, 0x0a, 0x0b, |
| 575 | | -1, 0x0d, 0x0e, -1 |
| 568 | -1, -1, -1, -1, |
| 569 | -1, -1, -1, -1, |
| 570 | -1, 0x08, 0x00, 0x01, |
| 571 | -1, 0x0c, 0x04, 0x05, |
| 572 | -1, -1, 0x02, 0x03, |
| 573 | -1, 0x0f, 0x06, 0x07, |
| 574 | -1, 0x09, 0x0a, 0x0b, |
| 575 | -1, 0x0d, 0x0e, -1 |
| 576 | 576 | }; |
| 577 | 577 | */ |
| 578 | 578 | |
| 579 | 579 | |
| 580 | 580 | /* gcr_double_2_gcr takes 4 bytes (a, b, c, d) and shuffles their nibbles to obtain 5 bytes in dest */ |
| 581 | | /* The result is basically res = (enc(a) << 15) | (enc(b) << 10) | (enc(c) << 5) | enc(d) |
| 581 | /* The result is basically res = (enc(a) << 15) | (enc(b) << 10) | (enc(c) << 5) | enc(d) |
| 582 | 582 | * with res being 5 bytes long and enc(x) being the GCR encode of x. |
| 583 | 583 | * In fact, we store the result as five separate bytes in the dest argument |
| 584 | 584 | */ |
| 585 | | static void gcr_double_2_gcr(UINT8 a, UINT8 b, UINT8 c, UINT8 d, UINT8 *dest) |
| 585 | static void gcr_double_2_gcr( UINT8 a, UINT8 b, UINT8 c, UINT8 d, UINT8 *dest ) |
| 586 | 586 | { |
| 587 | 587 | UINT8 gcr[8]; |
| 588 | 588 | |
| r5842 | r5843 | |
| 604 | 604 | dest[4] = (gcr[6] << 5) | gcr[7]; |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | /* FIXME: temp workaround */ |
| 608 | static void filling_byte( UINT8 a, UINT8 *dest ) |
| 609 | { |
| 610 | dest[0] = a; |
| 611 | } |
| 607 | 612 | |
| 613 | |
| 608 | 614 | /************************************** |
| 609 | 615 | |
| 610 | | Drive timers (aka floppy reading) |
| 616 | Drive timers (aka floppy reading) |
| 611 | 617 | |
| 612 | 618 | **************************************/ |
| 613 | 619 | |
| 614 | | static TIMER_CALLBACK(vc1541_drive_timer) |
| 620 | static TIMER_CALLBACK( vc1541_drive_timer ) |
| 615 | 621 | { |
| 616 | 622 | const device_config *via_1 = devtag_get_device(machine, "_1541_via_1"); |
| 617 | 623 | |
| 618 | | if (vc1541_drive->clock == 0) |
| 624 | if (vc1541_drive.clock == 0) |
| 619 | 625 | { |
| 620 | | vc1541_drive->gcr.ready = 0; |
| 626 | vc1541_drive.gcr.ready = 0; |
| 621 | 627 | // why put sync back to 0 here?!? it would break the sync count, isn't it? |
| 622 | 628 | // or is it the way the serial port reads the sync count?!? |
| 623 | | vc1541_drive->gcr.sync = 0; |
| 624 | | |
| 625 | | cputag_set_input_line(machine, vc1541_drive->cputag, M6502_SET_OVERFLOW, 1); |
| 629 | vc1541_drive.gcr.sync = 0; |
| 630 | |
| 631 | cputag_set_input_line(machine, vc1541_drive.cputag, M6502_SET_OVERFLOW, 1); |
| 626 | 632 | via_ca1_w(via_1, 0, 1); |
| 627 | 633 | |
| 628 | | vc1541_drive->clock = 1; |
| 634 | vc1541_drive.clock = 1; |
| 629 | 635 | return; |
| 630 | 636 | } |
| 631 | 637 | |
| 632 | 638 | // this code has 2 effects: move on the pos on the data and reset it to 0 at the end of the track! |
| 633 | 639 | // size of the track is: (# sectors in the track) * (size of sector GCR endoded) |
| 634 | | // Here, size of sector is 368 because of our choices in the loading: 9 bytes of header gap & 14 bytes of sector gap |
| 640 | // Here, size of sector is 368 because of our choices in the loading: 9 bytes of header gap & 14 bytes of sector gap |
| 635 | 641 | // We will need to set the size at loading time when adding support for G64 images |
| 636 | | if (++(vc1541_drive->pos) >= (d64_sectors_per_track[(int)vc1541_drive->track - 1] * 368)) |
| 637 | | vc1541_drive->pos = 0; |
| 642 | if (++(vc1541_drive.pos) >= (d64_sectors_per_track[(int)vc1541_drive.track - 1] * 368)) |
| 643 | vc1541_drive.pos = 0; |
| 638 | 644 | // should we check if there is a change of track? to reset the pos in that case as well? |
| 639 | 645 | |
| 640 | | vc1541_drive->gcr.ready = 1; |
| 646 | vc1541_drive.gcr.ready = 1; |
| 641 | 647 | |
| 642 | | // notice that if there is a sequence of more than 40 1s it correctly does not reset the sync |
| 648 | // notice that if there is a sequence of more than 40 1s it correctly does not reset the sync |
| 643 | 649 | // counter until a 0 is found |
| 644 | | if (vc1541_drive->gcr.data[vc1541_drive->pos] == 0xff) |
| 650 | if (vc1541_drive.gcr.data[vc1541_drive.pos] == 0xff) |
| 645 | 651 | { |
| 646 | | vc1541_drive->gcr.ones_count++; |
| 652 | vc1541_drive.gcr.ones_count++; |
| 647 | 653 | |
| 648 | | // if (vc1541_drive->gcr.ones_count == 2) // 9 ones should already mark it as a sync, even if CBM chose to use 40 of them |
| 649 | | if (vc1541_drive->gcr.ones_count == 5) |
| 650 | | vc1541_drive->gcr.sync = 1; |
| 651 | | } |
| 652 | | else |
| 654 | // if (vc1541_drive.gcr.ones_count == 2) // 9 ones should already mark it as a sync, even if CBM chose to use 40 of them |
| 655 | if (vc1541_drive.gcr.ones_count == 5) |
| 656 | vc1541_drive.gcr.sync = 1; |
| 657 | } |
| 658 | else |
| 653 | 659 | { |
| 654 | | vc1541_drive->gcr.ones_count = 0; |
| 655 | | vc1541_drive->gcr.sync = 0; |
| 660 | vc1541_drive.gcr.ones_count = 0; |
| 661 | vc1541_drive.gcr.sync = 0; |
| 656 | 662 | } |
| 657 | 663 | |
| 658 | | cputag_set_input_line(machine, vc1541_drive->cputag, M6502_SET_OVERFLOW, 0); |
| 664 | cputag_set_input_line(machine, vc1541_drive.cputag, M6502_SET_OVERFLOW, 0); |
| 659 | 665 | via_ca1_w(via_1, 0, 0); |
| 660 | 666 | |
| 661 | | vc1541_drive->clock = 0; |
| 667 | vc1541_drive.clock = 0; |
| 662 | 668 | } |
| 663 | 669 | |
| 664 | | static TIMER_CALLBACK(c1551_drive_timer) |
| 670 | static TIMER_CALLBACK( c1551_drive_timer ) |
| 665 | 671 | { |
| 666 | | if (c1551_drive->clock == 0) |
| 672 | if (c1551_drive.clock == 0) |
| 667 | 673 | { |
| 668 | | c1551_drive->gcr.ready = 0; |
| 674 | c1551_drive.gcr.ready = 0; |
| 669 | 675 | // why put sync back to 0 here?!? it would break the sync count, isn't it? |
| 670 | 676 | // or is it the way the serial port reads the sync count?!? |
| 671 | | c1551_drive->gcr.sync = 0; |
| 672 | | |
| 673 | | c1551_drive->clock = 1; |
| 677 | c1551_drive.gcr.sync = 0; |
| 678 | |
| 679 | c1551_drive.clock = 1; |
| 674 | 680 | return; |
| 675 | 681 | } |
| 676 | 682 | |
| 677 | 683 | // this code has 2 effects: move on the pos on the data and reset it to 0 at the end of the track! |
| 678 | 684 | // size of the track is: (# sectors in the track) * (size of sector GCR endoded) |
| 679 | | // Here, size of sector is 368 because of our choices in the loading: 9 bytes of header gap & 14 bytes of sector gap |
| 685 | // Here, size of sector is 368 because of our choices in the loading: 9 bytes of header gap & 14 bytes of sector gap |
| 680 | 686 | // We will need to set the size at loading time when adding support for G64 images |
| 681 | | if (++(c1551_drive->pos) >= (d64_sectors_per_track[(int)c1551_drive->track - 1] * 368)) |
| 682 | | c1551_drive->pos = 0; |
| 687 | if (++(c1551_drive.pos) >= (d64_sectors_per_track[(int)c1551_drive.track - 1] * 368)) |
| 688 | c1551_drive.pos = 0; |
| 683 | 689 | // should we check if there is a change of track? to reset the pos in that case as well? |
| 684 | 690 | |
| 685 | | c1551_drive->gcr.ready = 1; |
| 691 | c1551_drive.gcr.ready = 1; |
| 686 | 692 | |
| 687 | | // notice that if there is a sequence of more than 40 1s it correctly does not reset the sync |
| 693 | // notice that if there is a sequence of more than 40 1s it correctly does not reset the sync |
| 688 | 694 | // counter until a 0 is found |
| 689 | | if (c1551_drive->gcr.data[c1551_drive->pos] == 0xff) |
| 695 | if (c1551_drive.gcr.data[c1551_drive.pos] == 0xff) |
| 690 | 696 | { |
| 691 | | c1551_drive->gcr.ones_count++; |
| 697 | c1551_drive.gcr.ones_count++; |
| 692 | 698 | |
| 693 | | // if (c1551_drive->gcr.ones_count == 2) // 9 ones should already mark it as a sync, even if CBM chose to use 40 of them |
| 694 | | if (c1551_drive->gcr.ones_count == 5) |
| 695 | | c1551_drive->gcr.sync = 1; |
| 696 | | } |
| 697 | | else |
| 699 | // if (c1551_drive.gcr.ones_count == 2) // 9 ones should already mark it as a sync, even if CBM chose to use 40 of them |
| 700 | if (c1551_drive.gcr.ones_count == 5) |
| 701 | c1551_drive.gcr.sync = 1; |
| 702 | } |
| 703 | else |
| 698 | 704 | { |
| 699 | | c1551_drive->gcr.ones_count = 0; |
| 700 | | c1551_drive->gcr.sync = 0; |
| 705 | c1551_drive.gcr.ones_count = 0; |
| 706 | c1551_drive.gcr.sync = 0; |
| 701 | 707 | } |
| 702 | 708 | |
| 703 | | c1551_drive->clock = 0; |
| 709 | c1551_drive.clock = 0; |
| 704 | 710 | } |
| 705 | 711 | |
| 706 | 712 | |
| 707 | 713 | /************************************** |
| 708 | 714 | |
| 709 | | VC1541 Serial Bus Device Interface |
| 715 | VC1541 Serial Bus Device Interface |
| 710 | 716 | |
| 711 | 717 | **************************************/ |
| 712 | 718 | |
| 713 | | /* 2009-05 FP - Note: I could use directly these functions as DEVICE_HANDLERs for |
| 714 | | the serial bus device, but these are also used in the VIA interface above, so I |
| 715 | | prefer to keep the handlers separated at this stage. Further work on the serial |
| 719 | /* 2009-05 FP - Note: I could use directly these functions as DEVICE_HANDLERs for |
| 720 | the serial bus device, but these are also used in the VIA interface above, so I |
| 721 | prefer to keep the handlers separated at this stage. Further work on the serial |
| 716 | 722 | bus emulation should allow to remove the duplicated code. */ |
| 717 | 723 | |
| 718 | 724 | static void vc1541_serial_reset_write( running_machine *machine, int which, int level ) |
| r5842 | r5843 | |
| 754 | 760 | #endif |
| 755 | 761 | via_ca1_w (via_0, 0, !level); |
| 756 | 762 | #if 0 |
| 757 | | value = vc1541_drive->vc1541_serial.data; |
| 758 | | if (vc1541_drive->vc1541_serial.acka != !level) |
| 763 | value = vc1541_drive.vc1541_serial.data; |
| 764 | if (vc1541_drive.vc1541_serial.acka != !level) |
| 759 | 765 | value = 0; |
| 760 | | if (value != serial.data[2]) |
| 766 | if (value != serial.data[2]) |
| 761 | 767 | { |
| 762 | 768 | serial.data[2] = value; |
| 763 | | if (serial.data[0] != value) |
| 769 | if (serial.data[0] != value) |
| 764 | 770 | { |
| 765 | 771 | serial.data[0] = serial.data[1] && serial.data[2]; |
| 766 | 772 | } |
| r5842 | r5843 | |
| 828 | 834 | serial.clock[0] = serial.clock[1] && serial.clock[2]; |
| 829 | 835 | if (serial.clock[0] == level) |
| 830 | 836 | { |
| 831 | | /* DBG_LOG(machine, 1, "vc1541",("%d:%.4x clock %s\n", |
| 832 | | cpu_getactivecpu (), |
| 833 | | activecpu_get_pc(), |
| 834 | | serial.clock[0]?"CLOCK":"clock"));*/ |
| 837 | /* DBG_LOG(machine, 1, "vc1541",("%d:%.4x clock %s\n", |
| 838 | cpu_getactivecpu (), |
| 839 | activecpu_get_pc(), |
| 840 | serial.clock[0]?"CLOCK":"clock"));*/ |
| 835 | 841 | } |
| 836 | 842 | } |
| 837 | 843 | } |
| r5842 | r5843 | |
| 847 | 853 | } |
| 848 | 854 | |
| 849 | 855 | |
| 850 | | /* 2009-05 FP - TODO: better implementation of the DEVICE_HANDLERs below. Right now they are |
| 856 | /* 2009-05 FP - TODO: better implementation of the DEVICE_HANDLERs below. Right now they are |
| 851 | 857 | redundant (see also my Note above) */ |
| 852 | 858 | static READ8_DEVICE_HANDLER( emu_drive_atn_read ) |
| 853 | 859 | { |
| r5842 | r5843 | |
| 868 | 874 | { |
| 869 | 875 | return vc1541_serial_request_read(device->machine, 0); |
| 870 | 876 | } |
| 871 | | |
| 877 | |
| 872 | 878 | static WRITE8_DEVICE_HANDLER( emu_drive_atn_write ) |
| 873 | 879 | { |
| 874 | 880 | vc1541_serial_atn_write(device->machine, 0, data); |
| r5842 | r5843 | |
| 912 | 918 | |
| 913 | 919 | |
| 914 | 920 | /************************************************************************** |
| 915 | | * VIA 6522 at 0x1800 |
| 921 | * VIA 6522 at 0x1800 |
| 916 | 922 | * |
| 917 | | * 0x1800 port B |
| 918 | | * bit 0 : data in (inverted: 0 = Low, 1 = High) |
| 919 | | * bit 1 : data out (inverted: 0 = Low, 1 = High) |
| 920 | | * bit 2 : clock in (inverted: 0 = Low, 1 = High) |
| 921 | | * bit 3 : clock out (inverted: 0 = Low, 1 = High) |
| 922 | | * bit 4 : atna out (inverted: 0 = Low, 1 = High) |
| 923 | | * bit 5 : device id 1 |
| 924 | | * bit 6 : device id 2 |
| 925 | | * device ID number is set by a jumper: |
| 926 | | * 00 = 8 (default), 01 = 9, 10 = 10, 11 = 11 |
| 927 | | * bit 7 : atn in (inverted: 0 = Low, 1 = High) |
| 928 | | * 0x1801 port A - Read to acknowledge interrupt generated by ATN IN going high. |
| 929 | | * 0x1802 port B data direction register. |
| 930 | | * if a bit here is 0, then the corresponding bit of portB can only be read |
| 931 | | * if a bit here is 1, then the corresponding bit of portB can be read and written |
| 932 | | * default value 0x1a |
| 933 | | * 0x1803 port A data direction register. |
| 934 | | * default value 0xff |
| 935 | | * 0x1804 timer 1 counter (low) |
| 936 | | * 0x1805 timer 1 counter (high) / Timer one counter |
| 937 | | * Read low byte or write high byte to start timer or restart timer upon underflow. |
| 938 | | * 0x1806 timer 1 latch (low) |
| 939 | | * 0x1807 timer 1 latch (high) |
| 940 | | * read/write starting value of timer from/to here. |
| 941 | | * 0x1808 timer 2 counter (low) |
| 942 | | * 0x1809 timer 2 counter (high) |
| 943 | | * 0x180a shift register |
| 944 | | * 0x180b auxiliary control register. bit 6: 0 = Stop timer; 1 = Start timer. |
| 945 | | * 0x180c peripheral control register |
| 946 | | * 0x180d interrupt flag register. bit 1: 1 = ATN IN went high, bit 6: 1 = Timer underflow occurred. |
| 947 | | * 0x180e interrupt enable register. |
| 948 | | * bit 1: write - 1 = Enable interrupts generated by ATN IN going high |
| 949 | | * bit 7: read - interrupt has been generated. |
| 950 | | * bit 7: write - Fill bit: bits 0-6, that are set to 1, get their values from this bit; bits 0-6, that are set to 0, are left unchanged |
| 923 | * 0x1800 port B |
| 924 | * bit 0 : data in (inverted: 0 = Low, 1 = High) |
| 925 | * bit 1 : data out (inverted: 0 = Low, 1 = High) |
| 926 | * bit 2 : clock in (inverted: 0 = Low, 1 = High) |
| 927 | * bit 3 : clock out (inverted: 0 = Low, 1 = High) |
| 928 | * bit 4 : atna out (inverted: 0 = Low, 1 = High) |
| 929 | * bit 5 : device id 1 |
| 930 | * bit 6 : device id 2 |
| 931 | * device ID number is set by a jumper: |
| 932 | * 00 = 8 (default), 01 = 9, 10 = 10, 11 = 11 |
| 933 | * bit 7 : atn in (inverted: 0 = Low, 1 = High) |
| 934 | * 0x1801 port A - Read to acknowledge interrupt generated by ATN IN going high. |
| 935 | * 0x1802 port B data direction register. |
| 936 | * if a bit here is 0, then the corresponding bit of portB can only be read |
| 937 | * if a bit here is 1, then the corresponding bit of portB can be read and written |
| 938 | * default value 0x1a |
| 939 | * 0x1803 port A data direction register. |
| 940 | * default value 0xff |
| 941 | * 0x1804 timer 1 counter (low) |
| 942 | * 0x1805 timer 1 counter (high) / Timer one counter |
| 943 | * Read low byte or write high byte to start timer or restart timer upon underflow. |
| 944 | * 0x1806 timer 1 latch (low) |
| 945 | * 0x1807 timer 1 latch (high) |
| 946 | * read/write starting value of timer from/to here. |
| 947 | * 0x1808 timer 2 counter (low) |
| 948 | * 0x1809 timer 2 counter (high) |
| 949 | * 0x180a shift register |
| 950 | * 0x180b auxiliary control register. bit 6: 0 = Stop timer; 1 = Start timer. |
| 951 | * 0x180c peripheral control register |
| 952 | * 0x180d interrupt flag register. bit 1: 1 = ATN IN went high, bit 6: 1 = Timer underflow occurred. |
| 953 | * 0x180e interrupt enable register. |
| 954 | * bit 1: write - 1 = Enable interrupts generated by ATN IN going high |
| 955 | * bit 7: read - interrupt has been generated. |
| 956 | * bit 7: write - Fill bit: bits 0-6, that are set to 1, get their values from this bit; bits 0-6, that are set to 0, are left unchanged |
| 951 | 957 | * |
| 952 | 958 | * also ca1 (books says cb2) |
| 953 | 959 | * irq to m6502 irq connected (or with second via irq) |
| 954 | 960 | * |
| 955 | 961 | **************************************************************************/ |
| 956 | 962 | |
| 957 | | static void vc1541_via0_irq(const device_config *device, int level) |
| 963 | static void vc1541_via0_irq( const device_config *device, int level ) |
| 958 | 964 | { |
| 959 | | vc1541_drive->via0irq = level; |
| 960 | | DBG_LOG(device->machine, 2, "vc1541 via0 irq", ("level %d %d\n", vc1541_drive->via0irq, vc1541_drive->via1irq)); |
| 965 | vc1541_drive.via0irq = level; |
| 966 | DBG_LOG(device->machine, 2, "vc1541 via0 irq", ("level %d %d\n", vc1541_drive.via0irq, vc1541_drive.via1irq)); |
| 961 | 967 | |
| 962 | | cputag_set_input_line(device->machine, vc1541_drive->cputag, M6502_IRQ_LINE, vc1541_drive->via1irq || vc1541_drive->via0irq); |
| 968 | cputag_set_input_line(device->machine, vc1541_drive.cputag, M6502_IRQ_LINE, vc1541_drive.via1irq || vc1541_drive.via0irq); |
| 963 | 969 | } |
| 964 | 970 | |
| 965 | 971 | static READ8_DEVICE_HANDLER( vc1541_via0_read_portb ) |
| 966 | 972 | { |
| 967 | 973 | int value = 0x7a; |
| 968 | 974 | |
| 969 | | if (!vc1541_drive->vc1541_serial.serial_data || !serial.data[0]) |
| 975 | if (!vc1541_drive.vc1541_serial.serial_data || !serial.data[0]) |
| 970 | 976 | value |= 0x01; |
| 971 | 977 | |
| 972 | | if (!vc1541_drive->vc1541_serial.serial_clock || !serial.clock[0]) |
| 978 | if (!vc1541_drive.vc1541_serial.serial_clock || !serial.clock[0]) |
| 973 | 979 | value |= 0x04; |
| 974 | 980 | |
| 975 | | if (!serial.atn[0]) |
| 981 | if (!serial.atn[0]) |
| 976 | 982 | value |= 0x80; |
| 977 | 983 | |
| 978 | | switch (vc1541_drive->vc1541_serial.deviceid) |
| 984 | switch (vc1541_drive.vc1541_serial.deviceid) |
| 979 | 985 | { |
| 980 | 986 | case 8: |
| 981 | 987 | value &= ~0x60; |
| r5842 | r5843 | |
| 1000 | 1006 | data & 0x08 ? "CLOCK" : "clock", |
| 1001 | 1007 | data & 0x02 ? "DATA" : "data")); |
| 1002 | 1008 | |
| 1003 | | vc1541_drive->vc1541_serial.data = data & 0x02 ? 0 : 1; |
| 1004 | | vc1541_drive->vc1541_serial.acka = data & 0x10 ? 1 : 0; |
| 1009 | vc1541_drive.vc1541_serial.data = data & 0x02 ? 0 : 1; |
| 1010 | vc1541_drive.vc1541_serial.acka = data & 0x10 ? 1 : 0; |
| 1005 | 1011 | |
| 1006 | | if ((!(data & 0x02)) != vc1541_drive->vc1541_serial.serial_data) |
| 1012 | if ((!(data & 0x02)) != vc1541_drive.vc1541_serial.serial_data) |
| 1007 | 1013 | { |
| 1008 | | vc1541_serial_data_write(device->machine, 1, vc1541_drive->vc1541_serial.serial_data = !(data & 0x02)); |
| 1014 | vc1541_serial_data_write(device->machine, 1, vc1541_drive.vc1541_serial.serial_data = !(data & 0x02)); |
| 1009 | 1015 | } |
| 1010 | 1016 | |
| 1011 | | if ((!(data & 0x08)) != vc1541_drive->vc1541_serial.serial_clock) |
| 1017 | if ((!(data & 0x08)) != vc1541_drive.vc1541_serial.serial_clock) |
| 1012 | 1018 | { |
| 1013 | | vc1541_serial_clock_write(device->machine, 1, vc1541_drive->vc1541_serial.serial_clock = !(data & 0x08)); |
| 1019 | vc1541_serial_clock_write(device->machine, 1, vc1541_drive.vc1541_serial.serial_clock = !(data & 0x08)); |
| 1014 | 1020 | } |
| 1015 | 1021 | |
| 1016 | | vc1541_serial_atn_write(device->machine, 1, vc1541_drive->vc1541_serial.serial_atn = 1); |
| 1022 | vc1541_serial_atn_write(device->machine, 1, vc1541_drive.vc1541_serial.serial_atn = 1); |
| 1017 | 1023 | } |
| 1018 | 1024 | |
| 1019 | 1025 | static const via6522_interface vc1541_via0 = |
| r5842 | r5843 | |
| 1035 | 1041 | |
| 1036 | 1042 | |
| 1037 | 1043 | /************************************************************************** |
| 1038 | | * VIA 6522 at 0x1c00 |
| 1044 | * VIA 6522 at 0x1c00 |
| 1039 | 1045 | * |
| 1040 | | * 0x1c00 port B - Disk controller i/o control line |
| 1041 | | * bit 0 : step head motor output 1 |
| 1042 | | * bit 1 : step head motor output 2 |
| 1043 | | * bit 2 : motor on output (0 = Off, 1 = On) - 300 revolutions per minute |
| 1044 | | * bit 3 : LED control output (0 = Off, 1 = On) |
| 1045 | | * bit 4 : write protect sense (0 = protected, 1 = unprotected) |
| 1046 | | * bit 5 : density select 0 |
| 1047 | | * bit 6 : density select 1 |
| 1048 | | * data density (track dependend): 00 = lowest (faster time), 11 = highest (slower timer) |
| 1049 | | * bit 7 : sync signal (more then nine 1 bits) detect |
| 1050 | | * 0x1c01 Port A - byte in gcr format from or to floppy |
| 1051 | | * 0x1c02 Port B data direction register + LED output - default 0x6f |
| 1052 | | * 0x1c03 Port A data direction register - 0x00 read from disk, 0xff write to disk |
| 1053 | | * 0x1c04 Timer 1 counter (low) |
| 1054 | | * 0x1c05 Timer 1 counter (high) |
| 1055 | | * Read low byte or write high byte to start timer or restart timer upon underflow. |
| 1056 | | * 0x1c06 Timer 1 latch (low) |
| 1057 | | * 0x1c07 Timer 1 latch (high) |
| 1058 | | * read/write starting value of timer from/to here. |
| 1059 | | * 0x1c08 Timer 2 latch (low) |
| 1060 | | * 0x1c09 Timer 2 latch (high) |
| 1061 | | * 0x1c0a Shift register |
| 1062 | | * 0x1c0b Auxiliary control register. bit 6: 0 = Stop timer; 1 = Start timer. |
| 1063 | | * 0x1c0c Peripheral control register |
| 1064 | | * 0x1c0d Interrupt flag register. bit 6: 1 = Timer underflow occurred. |
| 1065 | | * 0x1c0e Interrupt enable register |
| 1066 | | * bit 6: write - 1 = Enable interrupts generated by timer underflow |
| 1067 | | * bit 7: read - interrupt has been generated. |
| 1068 | | * bit 7: write - Fill bit: bits 0-6, that are set to 1, get their values from this bit; bits 0-6, that are set to 0, are left unchanged |
| 1046 | * 0x1c00 port B - Disk controller i/o control line |
| 1047 | * bit 0 : step head motor output 1 |
| 1048 | * bit 1 : step head motor output 2 |
| 1049 | * bit 2 : motor on output (0 = Off, 1 = On) - 300 revolutions per minute |
| 1050 | * bit 3 : LED control output (0 = Off, 1 = On) |
| 1051 | * bit 4 : write protect sense (0 = protected, 1 = unprotected) |
| 1052 | * bit 5 : density select 0 |
| 1053 | * bit 6 : density select 1 |
| 1054 | * data density (track dependend): 00 = lowest (faster time), 11 = highest (slower timer) |
| 1055 | * bit 7 : sync signal (more then nine 1 bits) detect |
| 1056 | * 0x1c01 Port A - byte in gcr format from or to floppy |
| 1057 | * 0x1c02 Port B data direction register + LED output - default 0x6f |
| 1058 | * 0x1c03 Port A data direction register - 0x00 read from disk, 0xff write to disk |
| 1059 | * 0x1c04 Timer 1 counter (low) |
| 1060 | * 0x1c05 Timer 1 counter (high) |
| 1061 | * Read low byte or write high byte to start timer or restart timer upon underflow. |
| 1062 | * 0x1c06 Timer 1 latch (low) |
| 1063 | * 0x1c07 Timer 1 latch (high) |
| 1064 | * read/write starting value of timer from/to here. |
| 1065 | * 0x1c08 Timer 2 latch (low) |
| 1066 | * 0x1c09 Timer 2 latch (high) |
| 1067 | * 0x1c0a Shift register |
| 1068 | * 0x1c0b Auxiliary control register. bit 6: 0 = Stop timer; 1 = Start timer. |
| 1069 | * 0x1c0c Peripheral control register |
| 1070 | * 0x1c0d Interrupt flag register. bit 6: 1 = Timer underflow occurred. |
| 1071 | * 0x1c0e Interrupt enable register |
| 1072 | * bit 6: write - 1 = Enable interrupts generated by timer underflow |
| 1073 | * bit 7: read - interrupt has been generated. |
| 1074 | * bit 7: write - Fill bit: bits 0-6, that are set to 1, get their values from this bit; bits 0-6, that are set to 0, are left unchanged |
| 1069 | 1075 | * |
| 1070 | 1076 | * ca1 byte ready input (also m6502 set overflow input) |
| 1071 | 1077 | * ca2 set overflow enable for 6502 |
| r5842 | r5843 | |
| 1076 | 1082 | **************************************************************************/ |
| 1077 | 1083 | |
| 1078 | 1084 | |
| 1079 | | static void vc1541_via1_irq (const device_config *device, int level) |
| 1085 | static void vc1541_via1_irq( const device_config *device, int level ) |
| 1080 | 1086 | { |
| 1081 | | vc1541_drive->via1irq = level; |
| 1082 | | DBG_LOG(device->machine, 2, "vc1541 via1 irq", ("level %d %d\n", vc1541_drive->via0irq, vc1541_drive->via1irq)); |
| 1087 | vc1541_drive.via1irq = level; |
| 1088 | DBG_LOG(device->machine, 2, "vc1541 via1 irq", ("level %d %d\n", vc1541_drive.via0irq, vc1541_drive.via1irq)); |
| 1083 | 1089 | |
| 1084 | | cputag_set_input_line(device->machine, vc1541_drive->cputag, M6502_IRQ_LINE, vc1541_drive->via1irq || vc1541_drive->via0irq); |
| 1090 | cputag_set_input_line(device->machine, vc1541_drive.cputag, M6502_IRQ_LINE, vc1541_drive.via1irq || vc1541_drive.via0irq); |
| 1085 | 1091 | } |
| 1086 | 1092 | |
| 1087 | 1093 | static READ8_DEVICE_HANDLER( vc1541_via1_read_porta ) |
| 1088 | 1094 | { |
| 1089 | | UINT8 data = vc1541_drive->gcr.data[vc1541_drive->start_pos + vc1541_drive->pos]; |
| 1095 | UINT8 data = vc1541_drive.gcr.data[vc1541_drive.start_pos + vc1541_drive.pos]; |
| 1090 | 1096 | |
| 1091 | | // logerror("Data read: Track %.1f Pos %d\n", vc1541_drive->track, vc1541_drive->pos); |
| 1097 | // logerror("Data read: Track %.1f Pos %d\n", vc1541_drive.track, vc1541_drive.pos); |
| 1092 | 1098 | |
| 1093 | 1099 | DBG_LOG(device->machine, 2, "vc1541 drive", ("port a read %.2x\n", data)); |
| 1094 | 1100 | return data; |
| r5842 | r5843 | |
| 1108 | 1114 | value &= ~0x10; |
| 1109 | 1115 | #endif |
| 1110 | 1116 | |
| 1111 | | if (vc1541_drive->gcr.sync) |
| 1117 | if (vc1541_drive.gcr.sync) |
| 1112 | 1118 | { |
| 1113 | 1119 | value &= ~0x80; |
| 1114 | 1120 | } |
| r5842 | r5843 | |
| 1120 | 1126 | |
| 1121 | 1127 | static WRITE8_DEVICE_HANDLER( vc1541_via1_write_portb ) |
| 1122 | 1128 | { |
| 1123 | | if (data != old) |
| 1129 | if (data != old) |
| 1124 | 1130 | { |
| 1125 | 1131 | DBG_LOG(device->machine, 1, "vc1541 drive",("%.2x\n", data)); |
| 1126 | 1132 | |
| 1127 | | /* decrease value (%00-%11-%10-%01-%00...) to move head downwards; */ |
| 1128 | | /* increase value (%00-%01-%10-%11-%00...) to move head upwards. */ |
| 1129 | | if ((old & 0x03) != (data & 0x03)) |
| 1133 | /* decrease value (%00-%11-%10-%01-%00...) to move head downwards; */ |
| 1134 | /* increase value (%00-%01-%10-%11-%00...) to move head upwards. */ |
| 1135 | if ((old & 0x03) != (data & 0x03)) |
| 1130 | 1136 | { |
| 1131 | | switch (old & 0x03) |
| 1137 | switch (old & 0x03) |
| 1132 | 1138 | { |
| 1133 | 1139 | case 0: |
| 1134 | | if ((data & 0x03) == 1) |
| 1135 | | vc1541_drive->track += 0.5; |
| 1136 | | else if ((data & 0x03) == 3) |
| 1137 | | vc1541_drive->track -= 0.5; |
| 1140 | if ((data & 0x03) == 1) |
| 1141 | vc1541_drive.track += 0.5; |
| 1142 | else if ((data & 0x03) == 3) |
| 1143 | vc1541_drive.track -= 0.5; |
| 1138 | 1144 | break; |
| 1139 | 1145 | |
| 1140 | 1146 | case 1: |
| 1141 | | if ((data & 0x03) == 2) |
| 1142 | | vc1541_drive->track += 0.5; |
| 1143 | | else if ((data & 0x03) == 0) |
| 1144 | | vc1541_drive->track -= 0.5; |
| 1147 | if ((data & 0x03) == 2) |
| 1148 | vc1541_drive.track += 0.5; |
| 1149 | else if ((data & 0x03) == 0) |
| 1150 | vc1541_drive.track -= 0.5; |
| 1145 | 1151 | break; |
| 1146 | 1152 | |
| 1147 | 1153 | case 2: |
| 1148 | | if ((data & 0x03) == 3) |
| 1149 | | vc1541_drive->track += 0.5; |
| 1150 | | else if ((data & 0x03) == 1) |
| 1151 | | vc1541_drive->track -= 0.5; |
| 1154 | if ((data & 0x03) == 3) |
| 1155 | vc1541_drive.track += 0.5; |
| 1156 | else if ((data & 0x03) == 1) |
| 1157 | vc1541_drive.track -= 0.5; |
| 1152 | 1158 | break; |
| 1153 | 1159 | |
| 1154 | 1160 | case 3: |
| 1155 | | if ((data & 0x03) == 0) |
| 1156 | | vc1541_drive->track += 0.5; |
| 1157 | | else if ((data & 0x03) == 2) |
| 1158 | | vc1541_drive->track -= 0.5; |
| 1161 | if ((data & 0x03) == 0) |
| 1162 | vc1541_drive.track += 0.5; |
| 1163 | else if ((data & 0x03) == 2) |
| 1164 | vc1541_drive.track -= 0.5; |
| 1159 | 1165 | break; |
| 1160 | 1166 | } |
| 1161 | 1167 | |
| 1162 | 1168 | /* If we have reached the first or last track, we cannot proceed further! */ |
| 1163 | | if (vc1541_drive->track < 1) |
| 1164 | | vc1541_drive->track = 1.0; |
| 1165 | | if (vc1541_drive->track > 35) |
| 1166 | | vc1541_drive->track = 35.0; |
| 1169 | if (vc1541_drive.track < 1) |
| 1170 | vc1541_drive.track = 1.0; |
| 1171 | if (vc1541_drive.track > 35) |
| 1172 | vc1541_drive.track = 35.0; |
| 1167 | 1173 | |
| 1168 | | logerror("Track #: %.1f\n", vc1541_drive->track); |
| 1174 | logerror("Track #: %.1f\n", vc1541_drive.track); |
| 1169 | 1175 | |
| 1170 | | /* We now adjust the vc1541_drive->pos according to the new track */ |
| 1176 | /* We now adjust the vc1541_drive.pos according to the new track */ |
| 1171 | 1177 | /* This seems a simple way to deal with half tracks */ |
| 1172 | | vc1541_drive->pos = 0; |
| 1173 | | vc1541_drive->start_pos = gcr_offset[(int)vc1541_drive->track - 1] // starting point of Track # |
| 1174 | | + (int)(2 * (vc1541_drive->track - (int)vc1541_drive->track)) * 184 / 2; // half track if needed (again, 184 comes from out loading choices) |
| 1178 | vc1541_drive.pos = 0; |
| 1179 | vc1541_drive.start_pos = gcr_offset[(int)vc1541_drive.track - 1] // starting point of Track # |
| 1180 | + (int)(2 * (vc1541_drive.track - (int)vc1541_drive.track)) * 184 / 2; // half track if needed (again, 184 comes from out loading choices) |
| 1175 | 1181 | } |
| 1176 | 1182 | |
| 1177 | | if ((vc1541_drive->motor != (data & 0x04)) || (vc1541_drive->frequency != (data & 0x60))) |
| 1183 | if ((vc1541_drive.motor != (data & 0x04)) || (vc1541_drive.frequency != (data & 0x60))) |
| 1178 | 1184 | { |
| 1179 | 1185 | double tme; |
| 1180 | | vc1541_drive->motor = data & 0x04; |
| 1181 | | vc1541_drive->frequency = data & 0x60; |
| 1182 | | tme = drive_times[vc1541_drive->frequency >> 5]; |
| 1186 | vc1541_drive.motor = data & 0x04; |
| 1187 | vc1541_drive.frequency = data & 0x60; |
| 1188 | tme = drive_times[vc1541_drive.frequency >> 5]; |
| 1183 | 1189 | |
| 1184 | | if (vc1541_drive->motor) |
| 1190 | if (vc1541_drive.motor) |
| 1185 | 1191 | { |
| 1186 | | if (attotime_to_double(timer_timeelapsed(vc1541_drive->timer)) > 1.0e29) |
| 1192 | if (attotime_to_double(timer_timeelapsed(vc1541_drive.timer)) > 1.0e29) |
| 1187 | 1193 | { |
| 1188 | | timer_reset(vc1541_drive->timer, attotime_never); |
| 1194 | timer_reset(vc1541_drive.timer, attotime_never); |
| 1189 | 1195 | } |
| 1190 | 1196 | else |
| 1191 | 1197 | { |
| 1192 | | timer_adjust_periodic(vc1541_drive->timer, attotime_zero, 0, ATTOTIME_IN_HZ(tme)); |
| 1198 | timer_adjust_periodic(vc1541_drive.timer, attotime_zero, 0, ATTOTIME_IN_HZ(tme)); |
| 1193 | 1199 | logerror("Freq changed: %f\n", tme); |
| 1194 | 1200 | } |
| 1195 | 1201 | } |
| 1196 | 1202 | else |
| 1197 | 1203 | { |
| 1198 | | timer_reset(vc1541_drive->timer, attotime_never); |
| 1204 | timer_reset(vc1541_drive.timer, attotime_never); |
| 1199 | 1205 | logerror("Motor turned off\n"); |
| 1200 | 1206 | } |
| 1201 | 1207 | } |
| 1202 | 1208 | old = data; |
| 1203 | 1209 | } |
| 1204 | 1210 | |
| 1205 | | vc1541_drive->led = data & 0x08; |
| 1211 | vc1541_drive.led = data & 0x08; |
| 1206 | 1212 | } |
| 1207 | 1213 | |
| 1208 | 1214 | static const via6522_interface vc1541_via1 = |
| r5842 | r5843 | |
| 1225 | 1231 | |
| 1226 | 1232 | /************************************** |
| 1227 | 1233 | |
| 1228 | | 1541 / 1541B / 1541C / 1541II / |
| 1229 | | 2031 (same as 1541 but IEEE) |
| 1234 | 1541 / 1541B / 1541C / 1541II / |
| 1235 | 2031 (same as 1541 but IEEE) |
| 1230 | 1236 | |
| 1231 | 1237 | **************************************/ |
| 1232 | 1238 | |
| r5842 | r5843 | |
| 1248 | 1254 | |
| 1249 | 1255 | /************************************** |
| 1250 | 1256 | |
| 1251 | | 1570 / 1571 / 1571CR |
| 1257 | 1570 / 1571 / 1571CR |
| 1252 | 1258 | |
| 1253 | 1259 | **************************************/ |
| 1254 | 1260 | |
| r5842 | r5843 | |
| 1256 | 1262 | AM_RANGE(0x0000, 0x07ff) AM_RAM |
| 1257 | 1263 | AM_RANGE(0x1800, 0x180f) AM_DEVREADWRITE("_1541_via_0", via_r, via_w) /* 0 and 1 used in vc20 */ |
| 1258 | 1264 | AM_RANGE(0x1c00, 0x1c0f) AM_DEVREADWRITE("_1541_via_1", via_r, via_w) |
| 1259 | | // AM_RANGE(0x2000, 0x2003) // WD17xx |
| 1260 | | // AM_RANGE(0x4000, 0x400f) // CIA |
| 1265 | // AM_RANGE(0x2000, 0x2003) // WD17xx |
| 1266 | // AM_RANGE(0x4000, 0x400f) // CIA |
| 1261 | 1267 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 1262 | 1268 | ADDRESS_MAP_END |
| 1263 | 1269 | |
| r5842 | r5843 | |
| 1265 | 1271 | /* |
| 1266 | 1272 | David Gahris provided info about differences between 128DCR and stand-alone 1571s |
| 1267 | 1273 | |
| 1268 | | * There is no 6526 or 8521 in the drive section of the 128DCR. I believe the |
| 1269 | | 5710 handles fast serial because the 5710 is a Commodore custom chip and |
| 1274 | * There is no 6526 or 8521 in the drive section of the 128DCR. I believe the |
| 1275 | 5710 handles fast serial because the 5710 is a Commodore custom chip and |
| 1270 | 1276 | 128 fast serial is a Commodore custom protocol. [Ed's note: Commodore lists |
| 1271 | 1277 | NTE229, ECG229, SK3246A/229, and 121-Z9021 as substitutes of the 5710.] |
| 1272 | 1278 | |
| 1273 | | * There is no 177x or heat-shrink-wrapped daughterboard in the drive section |
| 1274 | | of the 128DCR. I believe the Motorola plastic quad flat-pack chip handles |
| 1275 | | MFM because I am pretty sure that I have seen this chip in IBM PC drive |
| 1276 | | mechanisms. |
| 1279 | * There is no 177x or heat-shrink-wrapped daughterboard in the drive section |
| 1280 | of the 128DCR. I believe the Motorola plastic quad flat-pack chip handles |
| 1281 | MFM because I am pretty sure that I have seen this chip in IBM PC drive |
| 1282 | mechanisms. |
| 1277 | 1283 | |
| 1278 | | * The 1571cr ROM works great in 1541 mode but not at all in 1571 mode in a |
| 1279 | | standalone 1571. |
| 1284 | * The 1571cr ROM works great in 1541 mode but not at all in 1571 mode in a |
| 1285 | standalone 1571. |
| 1280 | 1286 | |
| 1281 | | * Olaf Seibert informed me that the 1571cr ROM contains a string to the |
| 1287 | * Olaf Seibert informed me that the 1571cr ROM contains a string to the |
| 1282 | 1288 | effect of "5710 (c) 1986 by c. hauck" |
| 1283 | 1289 | */ |
| 1284 | 1290 | static ADDRESS_MAP_START( _1571cr_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 1285 | 1291 | AM_RANGE(0x0000, 0x07ff) AM_RAM |
| 1286 | 1292 | AM_RANGE(0x1800, 0x180f) AM_DEVREADWRITE("_1541_via_0", via_r, via_w) /* 0 and 1 used in vc20 */ |
| 1287 | 1293 | AM_RANGE(0x1c00, 0x1c0f) AM_DEVREADWRITE("_1541_via_1", via_r, via_w) |
| 1288 | | // AM_RANGE(0x2000, 0x2005) // 5710 FDC |
| 1289 | | // AM_RANGE(0x400c, 0x400f) // 5710 CIA Serial Port |
| 1290 | | // AM_RANGE(0x4010, 0x4017) // 5710 FDC2 |
| 1291 | | // AM_RANGE(0x6000, 0x7fff) // RAM shadows |
| 1294 | // AM_RANGE(0x2000, 0x2005) // 5710 FDC |
| 1295 | // AM_RANGE(0x400c, 0x400f) // 5710 CIA Serial Port |
| 1296 | // AM_RANGE(0x4010, 0x4017) // 5710 FDC2 |
| 1297 | // AM_RANGE(0x6000, 0x7fff) // RAM shadows |
| 1292 | 1298 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 1293 | 1299 | ADDRESS_MAP_END |
| 1294 | 1300 | |
| 1295 | 1301 | |
| 1296 | 1302 | /************************************** |
| 1297 | 1303 | |
| 1298 | | 1581 |
| 1304 | 1581 |
| 1299 | 1305 | |
| 1300 | 1306 | **************************************/ |
| 1301 | 1307 | |
| 1302 | 1308 | static ADDRESS_MAP_START( _1581_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 1303 | | // AM_RANGE(0x4000, 0x400f) // CIA |
| 1304 | | // AM_RANGE(0x6000, 0x6003) // WD17xx |
| 1309 | // AM_RANGE(0x4000, 0x400f) // CIA |
| 1310 | // AM_RANGE(0x6000, 0x6003) // WD17xx |
| 1305 | 1311 | AM_RANGE(0x8000, 0xffff) AM_ROM |
| 1306 | 1312 | ADDRESS_MAP_END |
| 1307 | 1313 | |
| 1308 | 1314 | |
| 1309 | 1315 | /************************************** |
| 1310 | 1316 | |
| 1311 | | 1001 / 8050 / 8250 |
| 1317 | 1001 / 8050 / 8250 |
| 1312 | 1318 | |
| 1313 | 1319 | http://www.zimmers.net/anonftp/pub/cbm/firmware/drives/old/8050/d/8250.notes |
| 1314 | 1320 | |
| 1315 | 1321 | **************************************/ |
| 1316 | 1322 | |
| 1317 | 1323 | static ADDRESS_MAP_START( sfd1001_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 1318 | | // AM_RANGE(0x0200, 0x021f) // RIOT1 |
| 1319 | | // AM_RANGE(0x0280, 0x029f) // RIOT2 |
| 1324 | // AM_RANGE(0x0200, 0x021f) // RIOT1 |
| 1325 | // AM_RANGE(0x0280, 0x029f) // RIOT2 |
| 1320 | 1326 | AM_RANGE(0xc000, 0xffff) AM_ROM |
| 1321 | 1327 | ADDRESS_MAP_END |
| 1322 | 1328 | |
| 1323 | 1329 | |
| 1324 | 1330 | /************************************** |
| 1325 | 1331 | |
| 1326 | | 2040 / 3040 / 4040 |
| 1332 | 2040 / 3040 / 4040 |
| 1327 | 1333 | |
| 1328 | 1334 | http://www.zimmers.net/anonftp/pub/cbm/schematics/drives/old/4040/memorymap.txt |
| 1329 | 1335 | |
| r5842 | r5843 | |
| 1335 | 1341 | |
| 1336 | 1342 | /************************************** |
| 1337 | 1343 | |
| 1338 | | 1551 |
| 1344 | 1551 |
| 1339 | 1345 | |
| 1340 | 1346 | **************************************/ |
| 1341 | 1347 | |
| r5842 | r5843 | |
| 1345 | 1351 | */ |
| 1346 | 1352 | static TIMER_CALLBACK(c1551_irq_timer) |
| 1347 | 1353 | { |
| 1348 | | cputag_set_input_line(machine, c1551_drive->cputag, M6502_IRQ_LINE, ASSERT_LINE); |
| 1354 | cputag_set_input_line(machine, c1551_drive.cputag, M6502_IRQ_LINE, ASSERT_LINE); |
| 1349 | 1355 | } |
| 1350 | 1356 | |
| 1351 | 1357 | /* |
| r5842 | r5843 | |
| 1360 | 1366 | |
| 1361 | 1367 | static WRITE8_HANDLER( c1551_port_w ) |
| 1362 | 1368 | { |
| 1363 | | if (offset) |
| 1369 | if (offset) |
| 1364 | 1370 | { |
| 1365 | 1371 | DBG_LOG(space->machine, 1, "c1551 port",("write %.2x\n", data)); |
| 1366 | | c1551_drive->cpu_port = data; |
| 1372 | c1551_drive.cpu_port = data; |
| 1367 | 1373 | |
| 1368 | | if (data != old) |
| 1374 | if (data != old) |
| 1369 | 1375 | { |
| 1370 | 1376 | DBG_LOG(space->machine, 1, "c1551 drive",("%.2x\n", data)); |
| 1371 | | |
| 1372 | | if ((old & 0x03) != (data & 0x03)) |
| 1377 | |
| 1378 | if ((old & 0x03) != (data & 0x03)) |
| 1373 | 1379 | { |
| 1374 | | switch (old & 0x03) |
| 1380 | switch (old & 0x03) |
| 1375 | 1381 | { |
| 1376 | 1382 | case 0: |
| 1377 | | if ((data & 0x03) == 1) |
| 1378 | | c1551_drive->track += 0.5; |
| 1379 | | else if ((data & 0x03) == 3) |
| 1380 | | c1551_drive->track -= 0.5; |
| 1383 | if ((data & 0x03) == 1) |
| 1384 | c1551_drive.track += 0.5; |
| 1385 | else if ((data & 0x03) == 3) |
| 1386 | c1551_drive.track -= 0.5; |
| 1381 | 1387 | break; |
| 1382 | 1388 | |
| 1383 | 1389 | case 1: |
| 1384 | | if ((data & 0x03) == 2) |
| 1385 | | c1551_drive->track += 0.5; |
| 1386 | | else if ((data & 0x03) == 0) |
| 1387 | | c1551_drive->track -= 0.5; |
| 1390 | if ((data & 0x03) == 2) |
| 1391 | c1551_drive.track += 0.5; |
| 1392 | else if ((data & 0x03) == 0) |
| 1393 | c1551_drive.track -= 0.5; |
| 1388 | 1394 | break; |
| 1389 | 1395 | |
| 1390 | 1396 | case 2: |
| 1391 | | if ((data & 0x03) == 3) |
| 1392 | | c1551_drive->track += 0.5; |
| 1393 | | else if ((data & 0x03) == 1) |
| 1394 | | c1551_drive->track -= 0.5; |
| 1397 | if ((data & 0x03) == 3) |
| 1398 | c1551_drive.track += 0.5; |
| 1399 | else if ((data & 0x03) == 1) |
| 1400 | c1551_drive.track -= 0.5; |
| 1395 | 1401 | break; |
| 1396 | 1402 | |
| 1397 | 1403 | case 3: |
| 1398 | | if ((data & 0x03) == 0) |
| 1399 | | c1551_drive->track += 0.5; |
| 1400 | | else if ((data & 0x03) == 2) |
| 1401 | | c1551_drive->track -= 0.5; |
| 1404 | if ((data & 0x03) == 0) |
| 1405 | c1551_drive.track += 0.5; |
| 1406 | else if ((data & 0x03) == 2) |
| 1407 | c1551_drive.track -= 0.5; |
| 1402 | 1408 | break; |
| 1403 | 1409 | } |
| 1404 | 1410 | |
| 1405 | 1411 | /* If we have reached the first or last track, we cannot proceed further! */ |
| 1406 | | if (c1551_drive->track < 1) |
| 1407 | | c1551_drive->track = 1.0; |
| 1408 | | if (c1551_drive->track > 35) |
| 1409 | | c1551_drive->track = 35.0; |
| 1412 | if (c1551_drive.track < 1) |
| 1413 | c1551_drive.track = 1.0; |
| 1414 | if (c1551_drive.track > 35) |
| 1415 | c1551_drive.track = 35.0; |
| 1410 | 1416 | |
| 1411 | | logerror("Track #: %.1f\n", c1551_drive->track); |
| 1417 | logerror("Track #: %.1f\n", c1551_drive.track); |
| 1412 | 1418 | |
| 1413 | | /* We now adjust the c1551_drive->pos according to the new track */ |
| 1419 | /* We now adjust the c1551_drive.pos according to the new track */ |
| 1414 | 1420 | /* This seems a simple way to deal with half tracks */ |
| 1415 | | c1551_drive->pos = 0; |
| 1416 | | c1551_drive->start_pos = gcr_offset[(int)c1551_drive->track - 1] // starting point of Track # |
| 1417 | | + (int)(2 * (c1551_drive->track - (int)c1551_drive->track)) * 184 / 2; // half track if needed (again, 184 comes from out loading choices) |
| 1421 | c1551_drive.pos = 0; |
| 1422 | c1551_drive.start_pos = gcr_offset[(int)c1551_drive.track - 1] // starting point of Track # |
| 1423 | + (int)(2 * (c1551_drive.track - (int)c1551_drive.track)) * 184 / 2; // half track if needed (again, 184 comes from out loading choices) |
| 1418 | 1424 | } |
| 1419 | 1425 | |
| 1420 | | if ((c1551_drive->motor != (data & 0x04)) || (c1551_drive->frequency != (data & 0x60))) |
| 1426 | if ((c1551_drive.motor != (data & 0x04)) || (c1551_drive.frequency != (data & 0x60))) |
| 1421 | 1427 | { |
| 1422 | 1428 | double tme; |
| 1423 | | c1551_drive->motor = data & 0x04; |
| 1424 | | c1551_drive->frequency = data & 0x60; |
| 1429 | c1551_drive.motor = data & 0x04; |
| 1430 | c1551_drive.frequency = data & 0x60; |
| 1425 | 1431 | |
| 1426 | | tme = drive_times[c1551_drive->frequency >> 5]; |
| 1427 | | if (c1551_drive->motor) |
| 1432 | tme = drive_times[c1551_drive.frequency >> 5]; |
| 1433 | if (c1551_drive.motor) |
| 1428 | 1434 | { |
| 1429 | | if (attotime_to_double(timer_timeelapsed(c1551_drive->timer)) > 1.0e29) |
| 1430 | | timer_reset(c1551_drive->timer, attotime_never); |
| 1435 | if (attotime_to_double(timer_timeelapsed(c1551_drive.timer)) > 1.0e29) |
| 1436 | timer_reset(c1551_drive.timer, attotime_never); |
| 1431 | 1437 | else |
| 1432 | | timer_adjust_periodic(c1551_drive->timer, attotime_zero, 0, ATTOTIME_IN_HZ(tme)); |
| 1438 | timer_adjust_periodic(c1551_drive.timer, attotime_zero, 0, ATTOTIME_IN_HZ(tme)); |
| 1433 | 1439 | } |
| 1434 | 1440 | else |
| 1435 | 1441 | { |
| 1436 | | timer_reset(c1551_drive->timer, attotime_never); |
| 1442 | timer_reset(c1551_drive.timer, attotime_never); |
| 1437 | 1443 | } |
| 1438 | 1444 | } |
| 1439 | 1445 | old = data; |
| 1440 | 1446 | } |
| 1441 | | c1551_drive->led = data & 0x08; |
| 1442 | | } |
| 1443 | | else |
| 1447 | c1551_drive.led = data & 0x08; |
| 1448 | } |
| 1449 | else |
| 1444 | 1450 | { |
| 1445 | | c1551_drive->cpu_ddr = data; |
| 1451 | c1551_drive.cpu_ddr = data; |
| 1446 | 1452 | DBG_LOG(space->machine, 1, "c1551 ddr", ("write %.2x\n", data)); |
| 1447 | 1453 | } |
| 1448 | 1454 | } |
| r5842 | r5843 | |
| 1451 | 1457 | { |
| 1452 | 1458 | int data; |
| 1453 | 1459 | |
| 1454 | | if (offset) |
| 1460 | if (offset) |
| 1455 | 1461 | { |
| 1456 | 1462 | data = 0x7f; |
| 1457 | 1463 | #if 0 |
| 1458 | 1464 | if (WRITEPROTECTED) |
| 1459 | 1465 | data &= ~0x10; |
| 1460 | 1466 | #endif |
| 1461 | | if (c1551_drive->gcr.ready) |
| 1467 | if (c1551_drive.gcr.ready) |
| 1462 | 1468 | { |
| 1463 | 1469 | data |= 0x80; |
| 1464 | | c1551_drive->gcr.ready = 0; |
| 1470 | c1551_drive.gcr.ready = 0; |
| 1465 | 1471 | } |
| 1466 | 1472 | |
| 1467 | | data &= ~c1551_drive->cpu_ddr; |
| 1468 | | data |= c1551_drive->cpu_ddr & c1551_drive->cpu_port; |
| 1473 | data &= ~c1551_drive.cpu_ddr; |
| 1474 | data |= c1551_drive.cpu_ddr & c1551_drive.cpu_port; |
| 1469 | 1475 | DBG_LOG(space->machine, 3, "c1551 port",("read %.2x\n", data)); |
| 1470 | | } |
| 1471 | | else |
| 1476 | } |
| 1477 | else |
| 1472 | 1478 | { |
| 1473 | | data = c1551_drive->cpu_ddr; |
| 1479 | data = c1551_drive.cpu_ddr; |
| 1474 | 1480 | DBG_LOG(space->machine, 3, "c1551 ddr",("read %.2x\n", data)); |
| 1475 | 1481 | } |
| 1476 | 1482 | return data; |
| r5842 | r5843 | |
| 1478 | 1484 | |
| 1479 | 1485 | |
| 1480 | 1486 | static ADDRESS_MAP_START( _1551_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 1481 | | AM_RANGE(0x0000, 0x0001) AM_READWRITE(c1551_port_r, c1551_port_w) |
| 1487 | AM_RANGE(0x0000, 0x0001) AM_READWRITE(c1551_port_r, c1551_port_w) |
| 1482 | 1488 | AM_RANGE(0x0002, 0x07ff) AM_RAM |
| 1483 | | AM_RANGE(0x4000, 0x4007) AM_DEVREADWRITE("c1551_tpi", tpi6525_r, tpi6525_w) |
| 1489 | AM_RANGE(0x4000, 0x4007) AM_DEVREADWRITE("c1551_tpi", tpi6525_r, tpi6525_w) |
| 1484 | 1490 | AM_RANGE(0xc000, 0xffff) AM_ROM |
| 1485 | 1491 | ADDRESS_MAP_END |
| 1486 | 1492 | |
| r5842 | r5843 | |
| 1495 | 1501 | drive data in/out |
| 1496 | 1502 | port c ddr (0x1f) |
| 1497 | 1503 | 0 output status out |
| 1498 | | 1 output status out |
| 1499 | | 2 output |
| 1500 | | 3 output handshake out |
| 1501 | | 4 output |
| 1502 | | 5 input drive number 9 |
| 1503 | | 6 input sync 0 active |
| 1504 | | 7 input handshake in |
| 1504 | 1 output status out |
| 1505 | 2 output |
| 1506 | 3 output handshake out |
| 1507 | 4 output |
| 1508 | 5 input drive number 9 |
| 1509 | 6 input sync 0 active |
| 1510 | 7 input handshake in |
| 1505 | 1511 | */ |
| 1506 | 1512 | static READ8_DEVICE_HANDLER( c1551_port_c_r ) |
| 1507 | 1513 | { |
| 1508 | 1514 | int data = 0xff; |
| 1509 | | |
| 1515 | |
| 1510 | 1516 | data &= ~0x20; |
| 1511 | 1517 | |
| 1512 | | if (c1551_drive->gcr.sync) |
| 1518 | if (c1551_drive.gcr.sync) |
| 1513 | 1519 | data &= ~0x40; |
| 1514 | 1520 | |
| 1515 | 1521 | return data; |
| r5842 | r5843 | |
| 1517 | 1523 | |
| 1518 | 1524 | static READ8_DEVICE_HANDLER( c1551_port_b_r ) |
| 1519 | 1525 | { |
| 1520 | | UINT8 data = c1551_drive->gcr.data[c1551_drive->start_pos + c1551_drive->pos]; |
| 1526 | UINT8 data = c1551_drive.gcr.data[c1551_drive.start_pos + c1551_drive.pos]; |
| 1521 | 1527 | |
| 1522 | 1528 | DBG_LOG(device->machine, 2, "c1551 drive",("port a read %.2x\n", data)); |
| 1523 | 1529 | return data; |
| r5842 | r5843 | |
| 1541 | 1547 | |
| 1542 | 1548 | WRITE8_DEVICE_HANDLER( c1551x_write_data ) |
| 1543 | 1549 | { |
| 1544 | | // DBG_LOG(device->machine, 1, "c1551 cpu", ("%d write data %.2x\n", cpu_getactivecpu (), data)); |
| 1550 | // DBG_LOG(device->machine, 1, "c1551 cpu", ("%d write data %.2x\n", cpu_getactivecpu (), data)); |
| 1545 | 1551 | #ifdef CPU_SYNC |
| 1546 | 1552 | cpu_sync(); |
| 1547 | 1553 | #endif |
| r5842 | r5843 | |
| 1560 | 1566 | #endif |
| 1561 | 1567 | |
| 1562 | 1568 | data = tpi6525_porta_r(tpi_0, 0); |
| 1563 | | // DBG_LOG(device->machine, 2, "c1551 cpu",("%d read data %.2x\n", cpu_getactivecpu (), data)); |
| 1569 | // DBG_LOG(device->machine, 2, "c1551 cpu",("%d read data %.2x\n", cpu_getactivecpu (), data)); |
| 1564 | 1570 | return data; |
| 1565 | 1571 | } |
| 1566 | 1572 | |
| 1567 | 1573 | WRITE8_DEVICE_HANDLER( c1551x_write_handshake ) |
| 1568 | 1574 | { |
| 1569 | 1575 | const device_config *tpi_0 = devtag_get_device(device->machine, "c1551_tpi"); |
| 1570 | | // DBG_LOG(device->machine, 1, "c1551 cpu",("%d write handshake %.2x\n", cpu_getactivecpu (), data)); |
| 1576 | // DBG_LOG(device->machine, 1, "c1551 cpu",("%d write handshake %.2x\n", cpu_getactivecpu (), data)); |
| 1571 | 1577 | #ifdef CPU_SYNC |
| 1572 | 1578 | cpu_sync(); |
| 1573 | 1579 | #endif |
| r5842 | r5843 | |
| 1584 | 1590 | #endif |
| 1585 | 1591 | |
| 1586 | 1592 | data = tpi6525_portc_r(tpi_0, 0) & 0x08 ? 0x80 : 0x00; |
| 1587 | | // DBG_LOG(device->machine, 2, "c1551 cpu",("%d read handshake %.2x\n", cpu_getactivecpu (), data)); |
| 1593 | // DBG_LOG(device->machine, 2, "c1551 cpu",("%d read handshake %.2x\n", cpu_getactivecpu (), data)); |
| 1588 | 1594 | return data; |
| 1589 | 1595 | } |
| 1590 | 1596 | |
| r5842 | r5843 | |
| 1597 | 1603 | #endif |
| 1598 | 1604 | |
| 1599 | 1605 | data = tpi6525_portc_r(tpi_0, 0) & 0x03; |
| 1600 | | // DBG_LOG(device->machine, 1, "c1551 cpu",("%d read status %.2x\n", cpu_getactivecpu (), data)); |
| 1606 | // DBG_LOG(device->machine, 1, "c1551 cpu",("%d read status %.2x\n", cpu_getactivecpu (), data)); |
| 1601 | 1607 | |
| 1602 | 1608 | return data; |
| 1603 | 1609 | } |
| r5842 | r5843 | |
| 1606 | 1612 | |
| 1607 | 1613 | /************************************** |
| 1608 | 1614 | |
| 1609 | | Machine drivers |
| 1615 | Machine drivers |
| 1610 | 1616 | |
| 1611 | 1617 | **************************************/ |
| 1612 | 1618 | |
| r5842 | r5843 | |
| 1673 | 1679 | |
| 1674 | 1680 | /************************************** |
| 1675 | 1681 | |
| 1676 | | Drive init & reset |
| 1682 | Drive init & reset |
| 1677 | 1683 | |
| 1678 | 1684 | **************************************/ |
| 1679 | 1685 | |
| 1680 | | void drive_config( running_machine *machine, int type, int id, int mode, const char *cputag, int devicenr ) |
| 1686 | void cbm_drive_config( running_machine *machine, int type, int id, int mode, const char *cputag, int devicenr ) |
| 1681 | 1687 | { |
| 1682 | | vc1541_drive->type = type; |
| 1683 | | vc1541_drive->cputag = cputag; |
| 1684 | | vc1541_drive->vc1541_serial.deviceid = devicenr; |
| 1685 | | vc1541_drive->timer = timer_alloc(machine, vc1541_drive_timer, NULL); |
| 1688 | vc1541_drive.type = type; |
| 1689 | vc1541_drive.cputag = cputag; |
| 1690 | vc1541_drive.vc1541_serial.deviceid = devicenr; |
| 1691 | vc1541_drive.timer = timer_alloc(machine, vc1541_drive_timer, NULL); |
| 1692 | vc1541_drive.gcr.data = (UINT8*)auto_alloc_array(machine, UINT8, 0x500000); |
| 1686 | 1693 | } |
| 1687 | 1694 | |
| 1688 | 1695 | void c1551_config( running_machine *machine, const char *cputag ) |
| 1689 | 1696 | { |
| 1690 | | c1551_drive->type = type_1551; |
| 1691 | | c1551_drive->cputag = cputag; |
| 1692 | | c1551_drive->timer = timer_alloc(machine, c1551_drive_timer, NULL); |
| 1697 | c1551_drive.type = type_1551; |
| 1698 | c1551_drive.cputag = cputag; |
| 1699 | c1551_drive.timer = timer_alloc(machine, c1551_drive_timer, NULL); |
| 1700 | c1551_drive.gcr.data = (UINT8*)auto_alloc_array(machine, UINT8, 0x500000); |
| 1693 | 1701 | |
| 1694 | 1702 | /* time should be small enough to allow quitting of the irq |
| 1695 | | line before the next interrupt is triggered */ |
| 1696 | | c1551_drive->irq_timer = timer_alloc(machine, c1551_irq_timer, NULL); |
| 1697 | | timer_adjust_periodic(c1551_drive->irq_timer, attotime_zero, 0, ATTOTIME_IN_HZ(60)); |
| 1703 | line before the next interrupt is triggered */ |
| 1704 | c1551_drive.irq_timer = timer_alloc(machine, c1551_irq_timer, NULL); |
| 1705 | timer_adjust_periodic(c1551_drive.irq_timer, attotime_zero, 0, ATTOTIME_IN_HZ(60)); |
| 1698 | 1706 | } |
| 1699 | 1707 | |
| 1700 | | void drive_reset (void) |
| 1708 | void cbm_drive_reset( running_machine* machine ) |
| 1701 | 1709 | { |
| 1702 | 1710 | int i; |
| 1703 | 1711 | |
| 1704 | | if (vc1541_drive->type == type_1541) |
| 1712 | if (vc1541_drive.type == type_1541) |
| 1705 | 1713 | { |
| 1706 | 1714 | for (i = 0; i < sizeof (serial.atn) / sizeof (serial.atn[0]); i++) |
| 1707 | 1715 | { |
| r5842 | r5843 | |
| 1710 | 1718 | } |
| 1711 | 1719 | |
| 1712 | 1720 | /* Create offset map for GCR encoded images: it speeds up finding position where to read data from */ |
| 1713 | | switch (vc1541_drive->type) |
| 1721 | switch (vc1541_drive.type) |
| 1714 | 1722 | { |
| 1715 | 1723 | case type_1541: |
| 1716 | 1724 | case type_1541ii: |
| r5842 | r5843 | |
| 1731 | 1739 | logerror("GCR offset map not created\n"); |
| 1732 | 1740 | } |
| 1733 | 1741 | |
| 1734 | | vc1541_drive->track = 1.0; |
| 1735 | | vc1541_drive->start_pos = 0; |
| 1736 | | vc1541_drive->pos = 0; |
| 1742 | vc1541_drive.gcr.sync = 0; |
| 1743 | vc1541_drive.gcr.ones_count = 0; |
| 1744 | vc1541_drive.gcr.ready = 0; |
| 1745 | |
| 1746 | vc1541_drive.track = 1.0; |
| 1747 | vc1541_drive.start_pos = 0; |
| 1748 | vc1541_drive.pos = 0; |
| 1749 | vc1541_drive.led = 0; |
| 1750 | vc1541_drive.motor = 0; |
| 1751 | vc1541_drive.frequency = 0; |
| 1752 | vc1541_drive.clock = 0; |
| 1753 | |
| 1754 | vc1541_drive.vc1541_serial.acka = 0; |
| 1755 | vc1541_drive.vc1541_serial.data = 0; |
| 1756 | |
| 1737 | 1757 | } |
| 1738 | 1758 | |
| 1739 | | void c1551_drive_reset (void) |
| 1759 | void c1551_drive_reset( void ) |
| 1740 | 1760 | { |
| 1741 | 1761 | offset_init(format_d64_40t, gcr_offset, 368); // offset map is the same for both 35 and 40 track discs |
| 1742 | | c1551_drive->track = 1.0; |
| 1743 | | c1551_drive->start_pos = 0; |
| 1744 | | c1551_drive->pos = 0; |
| 1762 | |
| 1763 | c1551_drive.gcr.sync = 0; |
| 1764 | c1551_drive.gcr.ones_count = 0; |
| 1765 | c1551_drive.gcr.ready = 0; |
| 1766 | |
| 1767 | c1551_drive.track = 1.0; |
| 1768 | c1551_drive.start_pos = 0; |
| 1769 | c1551_drive.pos = 0; |
| 1770 | c1551_drive.led = 0; |
| 1771 | c1551_drive.motor = 0; |
| 1772 | c1551_drive.frequency = 0; |
| 1773 | c1551_drive.clock = 0; |
| 1745 | 1774 | } |
| 1746 | 1775 | |
| 1747 | 1776 | |
| 1748 | 1777 | |
| 1749 | 1778 | /************************************** |
| 1750 | 1779 | |
| 1751 | | Device configurations |
| 1780 | Device configurations |
| 1752 | 1781 | |
| 1753 | 1782 | **************************************/ |
| 1754 | 1783 | |
| r5842 | r5843 | |
| 1762 | 1791 | |
| 1763 | 1792 | for (k = 1; k <= max_tracks_per_format[format]; k++) |
| 1764 | 1793 | { |
| 1765 | | /* logerror("decoding track %d offset %d %d %d %d %d\n", k, |
| 1766 | | image_tracksector2offset(k, 0) / (16*16*16*16), |
| 1767 | | (image_tracksector2offset(k, 0) % (16*16*16*16)) / (16*16*16), |
| 1768 | | (image_tracksector2offset(k, 0) % (16*16*16)) / (16*16), |
| 1769 | | (image_tracksector2offset(k, 0) % (16*16)) / 16, |
| 1770 | | image_tracksector2offset(k, 0) % 16); |
| 1794 | /* logerror("decoding track %d offset %d %d %d %d %d\n", k, |
| 1795 | image_tracksector2offset(k, 0) / (16*16*16*16), |
| 1796 | (image_tracksector2offset(k, 0) % (16*16*16*16)) / (16*16*16), |
| 1797 | (image_tracksector2offset(k, 0) % (16*16*16)) / (16*16), |
| 1798 | (image_tracksector2offset(k, 0) % (16*16)) / 16, |
| 1799 | image_tracksector2offset(k, 0) % 16); |
| 1771 | 1800 | */ |
| 1772 | 1801 | |
| 1773 | 1802 | for (l = 0; l < d64_sectors_per_track[k - 1]; l++) |
| r5842 | r5843 | |
| 1780 | 1809 | pos = image_tracksector2offset(k, l); |
| 1781 | 1810 | |
| 1782 | 1811 | /* |
| 1783 | | 1. Header sync FF FF FF FF FF (40 'on' bits, not GCR encoded) |
| 1784 | | 2. Header info 52 54 B5 29 4B 7A 5E 95 55 55 (10 GCR bytes) |
| 1785 | | 3. Header gap 55 55 55 55 55 55 55 55 55 (9 bytes, never read) |
| 1786 | | 4. Data sync FF FF FF FF FF (40 'on' bits, not GCR encoded) |
| 1787 | | 5. Data block 55...4A (325 GCR bytes) |
| 1788 | | 6. Inter-sector gap 55 55 55 55...55 55 (4 to 19 bytes, never read) |
| 1789 | | */ |
| 1812 | 1. Header sync FF FF FF FF FF (40 'on' bits, not GCR encoded) |
| 1813 | 2. Header info 52 54 B5 29 4B 7A 5E 95 55 55 (10 GCR bytes) |
| 1814 | 3. Header gap 55 55 55 55 55 55 55 55 55 (9 bytes, never read) |
| 1815 | 4. Data sync FF FF FF FF FF (40 'on' bits, not GCR encoded) |
| 1816 | 5. Data block 55...4A (325 GCR bytes) |
| 1817 | 6. Inter-sector gap 55 55 55 55...55 55 (4 to 19 bytes, never read) |
| 1818 | */ |
| 1790 | 1819 | |
| 1791 | 1820 | /* Header sync */ |
| 1792 | 1821 | for (j = 0; j < 5; j++) |
| 1793 | | gcr.data[i + j] = 0xff; |
| 1822 | filling_byte(0xff, gcr.data + i + j); |
| 1794 | 1823 | i += 5; |
| 1795 | 1824 | |
| 1796 | 1825 | /* Header info */ |
| 1797 | 1826 | /* These are 8 bytes unencoded, which become 10 bytes encoded */ |
| 1798 | | // $00 - header block ID ($08) // this byte can be modified by error code 20 -> 0xff |
| 1799 | | // $01 - header block checksum (EOR of $02-$05) // this byte can be modified by error code 27 -> ^ 0xff |
| 1827 | // $00 - header block ID ($08) // this byte can be modified by error code 20 -> 0xff |
| 1828 | // $01 - header block checksum (EOR of $02-$05) // this byte can be modified by error code 27 -> ^ 0xff |
| 1800 | 1829 | // $02 - Sector# of data block |
| 1801 | 1830 | // $03 - Track# of data block |
| 1802 | | gcr_double_2_gcr(0x08, l ^ k ^ id2 ^ id1, l, k, gcr.data + i); |
| 1831 | gcr_double_2_gcr(0x08, l ^ k ^ id2 ^ id1, l, k, gcr.data + i); |
| 1803 | 1832 | i += 5; |
| 1804 | 1833 | |
| 1805 | 1834 | // $04 - Format ID byte #2 |
| r5842 | r5843 | |
| 1811 | 1840 | |
| 1812 | 1841 | /* Header gap */ |
| 1813 | 1842 | for (j = 0; j < 9; j++) |
| 1814 | | gcr.data[i + j] = 0x55; |
| 1843 | filling_byte(0x55, gcr.data + i + j); |
| 1815 | 1844 | i += 9; |
| 1816 | 1845 | |
| 1817 | 1846 | /* Data sync */ |
| 1818 | 1847 | for (j = 0; j < 5; j++) |
| 1819 | | gcr.data[i + j] = 0xff; |
| 1848 | filling_byte(0xff, gcr.data + i + j); |
| 1820 | 1849 | i += 5; |
| 1821 | 1850 | |
| 1822 | 1851 | /* Data block */ |
| r5842 | r5843 | |
| 1826 | 1855 | sector_checksum ^= copy[pos + j]; |
| 1827 | 1856 | |
| 1828 | 1857 | /* |
| 1829 | | $00 - data block ID ($07) |
| 1830 | | $01-100 - 256 bytes sector data |
| 1831 | | $101 - data block checksum (EOR of $01-100) |
| 1832 | | $102-103 - $00 ("off" bytes, to make the sector size a multiple of 5) |
| 1833 | | */ |
| 1834 | | gcr_double_2_gcr(0x07, copy[pos], copy[pos + 1], |
| 1858 | $00 - data block ID ($07) |
| 1859 | $01-100 - 256 bytes sector data |
| 1860 | $101 - data block checksum (EOR of $01-100) |
| 1861 | $102-103 - $00 ("off" bytes, to make the sector size a multiple of 5) |
| 1862 | */ |
| 1863 | gcr_double_2_gcr(0x07, copy[pos], copy[pos + 1], |
| 1835 | 1864 | copy[pos + 2], gcr.data + i); |
| 1836 | 1865 | i += 5; |
| 1837 | 1866 | |
| 1838 | 1867 | for (j = 1; j < 64; j++) |
| 1839 | 1868 | { |
| 1840 | | gcr_double_2_gcr(copy[pos + 4 * j - 1], copy[pos + 4 * j], |
| 1869 | gcr_double_2_gcr(copy[pos + 4 * j - 1], copy[pos + 4 * j], |
| 1841 | 1870 | copy[pos + 4 * j + 1], copy[pos + 4 * j + 2], gcr.data + i); |
| 1842 | 1871 | i += 5; |
| 1843 | 1872 | } |
| 1844 | | |
| 1873 | |
| 1845 | 1874 | gcr_double_2_gcr(copy[pos + 255], sector_checksum, 0x00, 0x00, gcr.data + i); |
| 1846 | 1875 | i += 5; |
| 1847 | 1876 | |
| r5842 | r5843 | |
| 1849 | 1878 | // "In tests that the author conducted on a real 1541 disk, gap sizes of 8 to 19 bytes were seen." |
| 1850 | 1879 | // Here we put 14 as an average... |
| 1851 | 1880 | for (j = 0; j < 14; j++) |
| 1852 | | gcr.data[i + j] = 0x55; |
| 1881 | filling_byte(0x55, gcr.data + i + j); |
| 1853 | 1882 | i += 14; |
| 1854 | 1883 | } |
| 1855 | 1884 | } |
| r5842 | r5843 | |
| 1884 | 1913 | format = format_d64_40t_err; |
| 1885 | 1914 | break; |
| 1886 | 1915 | default: |
| 1887 | | logerror("The image you're trying to load has not the regular size of a .d64 image: \n"); |
| 1916 | logerror("The image you're trying to load has not the regular size of a .d64 image: \n"); |
| 1888 | 1917 | logerror("Image %s size %d\n", image_filename(image), filesize); |
| 1889 | 1918 | return INIT_FAIL; |
| 1890 | 1919 | } |
| r5842 | r5843 | |
| 1901 | 1930 | format = format_d71_err; |
| 1902 | 1931 | break; |
| 1903 | 1932 | default: |
| 1904 | | logerror("The image you're trying to load has not the regular size of a .d71 image: \n"); |
| 1933 | logerror("The image you're trying to load has not the regular size of a .d71 image: \n"); |
| 1905 | 1934 | logerror("Image %s size %d\n", image_filename(image), filesize); |
| 1906 | 1935 | return INIT_FAIL; |
| 1907 | 1936 | } |
| r5842 | r5843 | |
| 1920 | 1949 | logerror("Unsupported format\n"); |
| 1921 | 1950 | return INIT_FAIL; |
| 1922 | 1951 | } |
| 1923 | | |
| 1952 | |
| 1924 | 1953 | /* Set up track / sector map according to the format of the image */ |
| 1925 | 1954 | offset_init(format, image_offset, 256); |
| 1926 | 1955 | |
| r5842 | r5843 | |
| 1934 | 1963 | format_id_1 = temp_copy[disk_id1(format)]; // can be modified by error code 29 -> ^ 0xff |
| 1935 | 1964 | format_id_2 = temp_copy[disk_id2(format)]; |
| 1936 | 1965 | |
| 1937 | | /* Disk is encoded and stored in xxx_drive->gcr.data */ |
| 1938 | | cbm_floppy_image_loading( format, format_id_1, format_id_2, temp_copy, vc1541_drive->gcr ); |
| 1966 | /* Disk is encoded and stored in xxx_drive.gcr.data */ |
| 1967 | cbm_floppy_image_loading( format, format_id_1, format_id_2, temp_copy, vc1541_drive.gcr ); |
| 1939 | 1968 | |
| 1940 | 1969 | logerror("Floppy image %s successfully loaded\n", image_filename(image)); |
| 1941 | 1970 | return INIT_PASS; |
| r5842 | r5843 | |
| 1969 | 1998 | format = format_d64_40t_err; |
| 1970 | 1999 | break; |
| 1971 | 2000 | default: |
| 1972 | | logerror("The image you're trying to load has not the regular size of a .d64 image: \n"); |
| 2001 | logerror("The image you're trying to load has not the regular size of a .d64 image: \n"); |
| 1973 | 2002 | logerror("Image %s size %d\n", image_filename(image), filesize); |
| 1974 | 2003 | return INIT_FAIL; |
| 1975 | 2004 | } |
| r5842 | r5843 | |
| 1979 | 2008 | logerror("Unsupported format\n"); |
| 1980 | 2009 | return INIT_FAIL; |
| 1981 | 2010 | } |
| 1982 | | |
| 2011 | |
| 1983 | 2012 | /* Set up track / sector map according to the format of the image */ |
| 1984 | 2013 | offset_init(format, image_offset, 256); |
| 1985 | 2014 | |
| r5842 | r5843 | |
| 1993 | 2022 | format_id_1 = temp_copy[disk_id1(format)]; // can be modified by error code 29 -> ^ 0xff |
| 1994 | 2023 | format_id_2 = temp_copy[disk_id2(format)]; |
| 1995 | 2024 | |
| 1996 | | /* Disk is encoded and stored in xxx_drive->gcr.data */ |
| 1997 | | cbm_floppy_image_loading( format, format_id_1, format_id_2, temp_copy, c1551_drive->gcr ); |
| 2025 | /* Disk is encoded and stored in xxx_drive.gcr.data */ |
| 2026 | cbm_floppy_image_loading( format, format_id_1, format_id_2, temp_copy, c1551_drive.gcr ); |
| 1998 | 2027 | |
| 1999 | 2028 | logerror("Floppy image %s successfully loaded\n", image_filename(image)); |
| 2000 | 2029 | return INIT_PASS; |
| r5842 | r5843 | |
| 2019 | 2048 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 2020 | 2049 | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(_1541); break; |
| 2021 | 2050 | case MESS_DEVINFO_PTR_UNLOAD: info->unload = DEVICE_IMAGE_UNLOAD_NAME(_1541); break; |
| 2022 | | case MESS_DEVINFO_PTR_DEV_SPECIFIC: info->f = (genf *) drive_config; break; |
| 2051 | case MESS_DEVINFO_PTR_DEV_SPECIFIC: info->f = (genf *) cbm_drive_config; break; |
| 2023 | 2052 | |
| 2024 | 2053 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 2025 | 2054 | case MESS_DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "d64"); break; |
| r5842 | r5843 | |
| 2039 | 2068 | { |
| 2040 | 2069 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 2041 | 2070 | case MESS_DEVINFO_PTR_LOAD: info->load = DEVICE_IMAGE_LOAD_NAME(_1551); break; |
| 2071 | case MESS_DEVINFO_PTR_DEV_SPECIFIC: info->f = (genf *) c1551_config; break; |
| 2042 | 2072 | |
| 2043 | 2073 | default: vc1541_device_getinfo(devclass, state, info); |
| 2044 | 2074 | } |
src/mess/machine/c128.c
| r5842 | r5843 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | commodore c128 home computer |
| 3 | commodore c128 home computer |
| 4 | 4 | |
| 5 | | peter.trauner@jk.uni-linz.ac.at |
| 5 | peter.trauner@jk.uni-linz.ac.at |
| 6 | 6 | documentation: |
| 7 | | iDOC (http://www.softwolves.pp.se/idoc) |
| 7 | iDOC (http://www.softwolves.pp.se/idoc) |
| 8 | 8 | Christian Janoff mepk@c64.org |
| 9 | 9 | |
| 10 | 10 | ***************************************************************************/ |
| r5842 | r5843 | |
| 66 | 66 | UINT8 *c128_external_function; |
| 67 | 67 | UINT8 *c128_vdcram; |
| 68 | 68 | |
| 69 | | static int c64mode = 0, c128_write_io; |
| 69 | static int c64mode, c128_write_io; |
| 70 | 70 | |
| 71 | 71 | static int c128_ram_bottom, c128_ram_top; |
| 72 | 72 | static UINT8 *c128_ram; |
| r5842 | r5843 | |
| 76 | 76 | static UINT8 c128_keyline[3] = {0xff, 0xff, 0xff}; |
| 77 | 77 | |
| 78 | 78 | static int c128_va1617; |
| 79 | | static int c128_cia1_on = 1; |
| 79 | static int c128_cia1_on; |
| 80 | 80 | static UINT8 serial_clock, serial_data, serial_atn; |
| 81 | | static UINT8 vicirq = 0; |
| 82 | | static int emulated_drive = 0; |
| 81 | static UINT8 vicirq; |
| 82 | static int emulated_drive; |
| 83 | 83 | |
| 84 | | static void c128_nmi(running_machine *machine) |
| 84 | static void c128_nmi( running_machine *machine ) |
| 85 | 85 | { |
| 86 | 86 | static int nmilevel = 0; |
| 87 | 87 | const device_config *cia_1 = devtag_get_device(machine, "cia_1"); |
| r5842 | r5843 | |
| 105 | 105 | |
| 106 | 106 | /*********************************************** |
| 107 | 107 | |
| 108 | | CIA Interfaces |
| 108 | CIA Interfaces |
| 109 | 109 | |
| 110 | 110 | ***********************************************/ |
| 111 | 111 | |
| 112 | 112 | /* |
| 113 | | * CIA 0 - Port A keyboard line select |
| 114 | | * CIA 0 - Port B keyboard line read |
| 113 | * CIA 0 - Port A keyboard line select |
| 114 | * CIA 0 - Port B keyboard line read |
| 115 | 115 | * |
| 116 | | * flag cassette read input, serial request in |
| 117 | | * irq to irq connected |
| 116 | * flag cassette read input, serial request in |
| 117 | * irq to irq connected |
| 118 | 118 | * |
| 119 | | * see machine/cbm.c |
| 119 | * see machine/cbm.c |
| 120 | 120 | */ |
| 121 | 121 | |
| 122 | 122 | static READ8_DEVICE_HANDLER( c128_cia0_port_a_r ) |
| r5842 | r5843 | |
| 128 | 128 | |
| 129 | 129 | static READ8_DEVICE_HANDLER( c128_cia0_port_b_r ) |
| 130 | 130 | { |
| 131 | | UINT8 value = 0xff; |
| 131 | UINT8 value = 0xff; |
| 132 | 132 | UINT8 cia0porta = cia_get_output_a(devtag_get_device(device->machine, "cia_0")); |
| 133 | 133 | |
| 134 | 134 | value &= common_cia0_port_b_r(device, cia0porta); |
| r5842 | r5843 | |
| 148 | 148 | vic2_lightpen_write(data & 0x10); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | | static void c128_irq (running_machine *machine, int level) |
| 151 | static void c128_irq( running_machine *machine, int level ) |
| 152 | 152 | { |
| 153 | 153 | static int old_level = 0; |
| 154 | 154 | |
| r5842 | r5843 | |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | | static void c128_cia0_interrupt (const device_config *device, int level) |
| 172 | static void c128_cia0_interrupt( const device_config *device, int level ) |
| 173 | 173 | { |
| 174 | 174 | c128_irq (device->machine, level || vicirq); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | | static void c128_vic_interrupt (running_machine *machine, int level) |
| 177 | static void c128_vic_interrupt( running_machine *machine, int level ) |
| 178 | 178 | { |
| 179 | 179 | const device_config *cia_0 = devtag_get_device(machine, "cia_0"); |
| 180 | 180 | #if 1 |
| r5842 | r5843 | |
| 260 | 260 | c128_vicaddr = c64_memory + helper[data & 0x03] + c128_va1617; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | | static void c128_cia1_interrupt (const device_config *device, int level) |
| 263 | static void c128_cia1_interrupt( const device_config *device, int level ) |
| 264 | 264 | { |
| 265 | 265 | c128_nmi(device->machine); |
| 266 | 266 | } |
| r5842 | r5843 | |
| 291 | 291 | |
| 292 | 292 | /*********************************************** |
| 293 | 293 | |
| 294 | | Memory Handlers |
| 294 | Memory Handlers |
| 295 | 295 | |
| 296 | 296 | ***********************************************/ |
| 297 | 297 | |
| 298 | | static void c128_set_m8502_read_handler(running_machine *machine, UINT16 start, UINT16 end, read8_space_func rh) |
| 298 | static void c128_set_m8502_read_handler( running_machine *machine, UINT16 start, UINT16 end, read8_space_func rh ) |
| 299 | 299 | { |
| 300 | 300 | const device_config *cpu; |
| 301 | 301 | cpu = cputag_get_cpu(machine, "m8502"); |
| 302 | 302 | memory_install_read8_handler(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), start, end, 0, 0, rh); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | | static WRITE8_HANDLER(c128_dma8726_port_w) |
| 305 | static WRITE8_HANDLER( c128_dma8726_port_w ) |
| 306 | 306 | { |
| 307 | 307 | DBG_LOG(space->machine, 1, "dma write", ("%.3x %.2x\n",offset,data)); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | | static READ8_HANDLER(c128_dma8726_port_r) |
| 310 | static READ8_HANDLER( c128_dma8726_port_r ) |
| 311 | 311 | { |
| 312 | 312 | DBG_LOG(space->machine, 1, "dma read", ("%.3x\n",offset)); |
| 313 | 313 | return 0xff; |
| r5842 | r5843 | |
| 404 | 404 | return 0xff; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | | void c128_bankswitch_64(running_machine *machine, int reset) |
| 407 | void c128_bankswitch_64( running_machine *machine, int reset ) |
| 408 | 408 | { |
| 409 | 409 | static int old, exrom, game; |
| 410 | 410 | int data, loram, hiram, charen; |
| r5842 | r5843 | |
| 422 | 422 | hiram = (data & 2) ? 1 : 0; |
| 423 | 423 | charen = (data & 4) ? 1 : 0; |
| 424 | 424 | |
| 425 | | if ((!c64_game && c64_exrom) |
| 426 | | || (loram && hiram && !c64_exrom)) |
| 427 | | { |
| 428 | | memory_set_bankptr (machine, 8, c64_roml); |
| 429 | | } |
| 425 | if ((!c64_game && c64_exrom) || (loram && hiram && !c64_exrom)) |
| 426 | memory_set_bankptr(machine, 8, c64_roml); |
| 430 | 427 | else |
| 431 | | { |
| 432 | | memory_set_bankptr (machine, 8, c64_memory + 0x8000); |
| 433 | | } |
| 428 | memory_set_bankptr(machine, 8, c64_memory + 0x8000); |
| 434 | 429 | |
| 435 | | if ((!c64_game && c64_exrom && hiram) |
| 436 | | || (!c64_exrom)) |
| 437 | | { |
| 438 | | memory_set_bankptr (machine, 9, c64_romh); |
| 439 | | } |
| 430 | if ((!c64_game && c64_exrom && hiram) || (!c64_exrom)) |
| 431 | memory_set_bankptr(machine, 9, c64_romh); |
| 440 | 432 | else if (loram && hiram) |
| 441 | | { |
| 442 | | memory_set_bankptr (machine, 9, c64_basic); |
| 443 | | } |
| 433 | memory_set_bankptr(machine, 9, c64_basic); |
| 444 | 434 | else |
| 445 | | { |
| 446 | | memory_set_bankptr (machine, 9, c64_memory + 0xa000); |
| 447 | | } |
| 435 | memory_set_bankptr(machine, 9, c64_memory + 0xa000); |
| 448 | 436 | |
| 449 | | if ((!c64_game && c64_exrom) |
| 450 | | || (charen && (loram || hiram))) |
| 437 | if ((!c64_game && c64_exrom) || (charen && (loram || hiram))) |
| 451 | 438 | { |
| 452 | 439 | rh = c128_read_io; |
| 453 | 440 | c128_write_io = 1; |
| r5842 | r5843 | |
| 457 | 444 | rh = SMH_BANK(5); |
| 458 | 445 | c128_write_io = 0; |
| 459 | 446 | if ((!charen && (loram || hiram))) |
| 460 | | memory_set_bankptr (machine, 13, c64_chargen); |
| 447 | memory_set_bankptr(machine, 13, c64_chargen); |
| 461 | 448 | else |
| 462 | | memory_set_bankptr (machine, 13, c64_memory + 0xd000); |
| 449 | memory_set_bankptr(machine, 13, c64_memory + 0xd000); |
| 463 | 450 | } |
| 451 | |
| 464 | 452 | c128_set_m8502_read_handler(machine, 0xd000, 0xdfff, rh); |
| 465 | 453 | |
| 466 | 454 | if (!c64_game && c64_exrom) |
| 467 | 455 | { |
| 468 | | memory_set_bankptr (machine, 14, c64_romh); |
| 469 | | memory_set_bankptr (machine, 15, c64_romh+0x1f00); |
| 470 | | memory_set_bankptr (machine, 16, c64_romh+0x1f05); |
| 456 | memory_set_bankptr(machine, 14, c64_romh); |
| 457 | memory_set_bankptr(machine, 15, c64_romh+0x1f00); |
| 458 | memory_set_bankptr(machine, 16, c64_romh+0x1f05); |
| 471 | 459 | } |
| 472 | 460 | else |
| 473 | 461 | { |
| 474 | 462 | if (hiram) |
| 475 | 463 | { |
| 476 | | memory_set_bankptr (machine, 14, c64_kernal); |
| 477 | | memory_set_bankptr (machine, 15, c64_kernal+0x1f00); |
| 478 | | memory_set_bankptr (machine, 16, c64_kernal+0x1f05); |
| 464 | memory_set_bankptr(machine, 14, c64_kernal); |
| 465 | memory_set_bankptr(machine, 15, c64_kernal+0x1f00); |
| 466 | memory_set_bankptr(machine, 16, c64_kernal+0x1f05); |
| 479 | 467 | } |
| 480 | 468 | else |
| 481 | 469 | { |
| 482 | | memory_set_bankptr (machine, 14, c64_memory + 0xe000); |
| 483 | | memory_set_bankptr (machine, 15, c64_memory + 0xff00); |
| 484 | | memory_set_bankptr (machine, 16, c64_memory + 0xff05); |
| 470 | memory_set_bankptr(machine, 14, c64_memory + 0xe000); |
| 471 | memory_set_bankptr(machine, 15, c64_memory + 0xff00); |
| 472 | memory_set_bankptr(machine, 16, c64_memory + 0xff05); |
| 485 | 473 | } |
| 486 | 474 | } |
| 487 | 475 | old = data; |
| 488 | | exrom= c64_exrom; |
| 489 | | game=c64_game; |
| 476 | exrom = c64_exrom; |
| 477 | game =c64_game; |
| 490 | 478 | } |
| 491 | 479 | |
| 492 | 480 | static UINT8 c128_mmu[0x0b]; |
| 493 | 481 | static const int c128_mmu_helper[4] = |
| 494 | 482 | {0x400, 0x1000, 0x2000, 0x4000}; |
| 495 | | static int mmu_cpu=0; |
| 483 | static int mmu_cpu; |
| 496 | 484 | static int mmu_page0, mmu_page1; |
| 497 | 485 | |
| 498 | 486 | #define MMU_PAGE1 ((((c128_mmu[10]&0xf)<<8)|c128_mmu[9])<<8) |
| r5842 | r5843 | |
| 526 | 514 | |
| 527 | 515 | /* typical z80 configuration |
| 528 | 516 | 0x3f 0x3f 0x7f 0x3e 0x7e 0xb0 0x0b 0x00 0x00 0x01 0x00 */ |
| 529 | | static void c128_bankswitch_z80(running_machine *machine) |
| 517 | static void c128_bankswitch_z80( running_machine *machine ) |
| 530 | 518 | { |
| 531 | 519 | c128_ram = c64_memory + MMU_RAM_ADDR; |
| 532 | 520 | c128_va1617 = MMU_VIC_ADDR; |
| 533 | 521 | #if 1 |
| 534 | | memory_set_bankptr (machine, 10, c128_z80); |
| 535 | | memory_set_bankptr (machine, 11, c128_ram + 0x1000); |
| 522 | memory_set_bankptr(machine, 10, c128_z80); |
| 523 | memory_set_bankptr(machine, 11, c128_ram + 0x1000); |
| 536 | 524 | if ( (( (input_port_read(machine, "SPECIAL") & 0x06) == 0x02 ) && (MMU_RAM_ADDR >= 0x40000)) |
| 537 | 525 | || (( (input_port_read(machine, "SPECIAL") & 0x06) == 0x00) && (MMU_RAM_ADDR >= 0x20000)) ) |
| 538 | 526 | c128_ram = NULL; |
| r5842 | r5843 | |
| 543 | 531 | c128_ram_bottom = 0; |
| 544 | 532 | |
| 545 | 533 | if (MMU_RAM_ADDR==0) { /* this is used in z80 mode for rom on/off switching !*/ |
| 546 | | memory_set_bankptr (machine, 10, c128_z80); |
| 547 | | memory_set_bankptr (machine, 11, c128_z80 + 0x400); |
| 548 | | } |
| 549 | | else |
| 534 | memory_set_bankptr(machine, 10, c128_z80); |
| 535 | memory_set_bankptr(machine, 11, c128_z80 + 0x400); |
| 536 | } |
| 537 | else |
| 550 | 538 | { |
| 551 | | memory_set_bankptr (machine, 10, (c128_ram_bottom > 0 ? c64_memory : c128_ram)); |
| 552 | | memory_set_bankptr (machine, 11, (c128_ram_bottom > 0x400 ? c64_memory : c128_ram) + 0x400); |
| 539 | memory_set_bankptr(machine, 10, (c128_ram_bottom > 0 ? c64_memory : c128_ram)); |
| 540 | memory_set_bankptr(machine, 11, (c128_ram_bottom > 0x400 ? c64_memory : c128_ram) + 0x400); |
| 553 | 541 | } |
| 554 | | |
| 555 | | memory_set_bankptr (machine, 1, (c128_ram_bottom > 0 ? c64_memory : c128_ram)); |
| 556 | | memory_set_bankptr (machine, 2, (c128_ram_bottom > 0x400 ? c64_memory : c128_ram) + 0x400); |
| 557 | 542 | |
| 558 | | memory_set_bankptr (machine, 3, (c128_ram_bottom > 0x1000 ? c64_memory : c128_ram) + 0x1000); |
| 559 | | memory_set_bankptr (machine, 4, (c128_ram_bottom > 0x2000 ? c64_memory : c128_ram) + 0x2000); |
| 560 | | memory_set_bankptr (machine, 5, c128_ram + 0x4000); |
| 543 | memory_set_bankptr(machine, 1, (c128_ram_bottom > 0 ? c64_memory : c128_ram)); |
| 544 | memory_set_bankptr(machine, 2, (c128_ram_bottom > 0x400 ? c64_memory : c128_ram) + 0x400); |
| 561 | 545 | |
| 546 | memory_set_bankptr(machine, 3, (c128_ram_bottom > 0x1000 ? c64_memory : c128_ram) + 0x1000); |
| 547 | memory_set_bankptr(machine, 4, (c128_ram_bottom > 0x2000 ? c64_memory : c128_ram) + 0x2000); |
| 548 | memory_set_bankptr(machine, 5, c128_ram + 0x4000); |
| 549 | |
| 562 | 550 | if (MMU_TOP) |
| 563 | 551 | c128_ram_top = 0x10000 - MMU_SIZE; |
| 564 | 552 | else |
| 565 | 553 | c128_ram_top = 0x10000; |
| 566 | 554 | |
| 567 | | if (c128_ram_top > 0xc000) |
| 568 | | { |
| 569 | | memory_set_bankptr (machine, 6, c128_ram + 0xc000); |
| 570 | | } |
| 571 | | else |
| 572 | | { |
| 573 | | memory_set_bankptr (machine, 6, c64_memory + 0xc000); |
| 574 | | } |
| 555 | if (c128_ram_top > 0xc000) |
| 556 | memory_set_bankptr(machine, 6, c128_ram + 0xc000); |
| 557 | else |
| 558 | memory_set_bankptr(machine, 6, c64_memory + 0xc000); |
| 575 | 559 | |
| 576 | | if (c128_ram_top > 0xe000) |
| 577 | | { |
| 578 | | memory_set_bankptr (machine, 7, c128_ram + 0xe000); |
| 579 | | } |
| 580 | | else |
| 581 | | { |
| 582 | | memory_set_bankptr (machine, 7, c64_memory + 0xd000); |
| 583 | | } |
| 560 | if (c128_ram_top > 0xe000) |
| 561 | memory_set_bankptr(machine, 7, c128_ram + 0xe000); |
| 562 | else |
| 563 | memory_set_bankptr(machine, 7, c64_memory + 0xd000); |
| 584 | 564 | |
| 585 | | if (c128_ram_top > 0xf000) |
| 586 | | { |
| 587 | | memory_set_bankptr (machine, 8, c128_ram + 0xf000); |
| 588 | | } |
| 589 | | else |
| 590 | | { |
| 591 | | memory_set_bankptr (machine, 8, c64_memory + 0xe000); |
| 592 | | } |
| 565 | if (c128_ram_top > 0xf000) |
| 566 | memory_set_bankptr(machine, 8, c128_ram + 0xf000); |
| 567 | else |
| 568 | memory_set_bankptr(machine, 8, c64_memory + 0xe000); |
| 593 | 569 | |
| 594 | | if (c128_ram_top > 0xff05) |
| 595 | | { |
| 596 | | memory_set_bankptr (machine, 9, c128_ram + 0xff05); |
| 597 | | } |
| 598 | | else |
| 599 | | { |
| 600 | | memory_set_bankptr (machine, 9, c64_memory + 0xff05); |
| 601 | | } |
| 570 | if (c128_ram_top > 0xff05) |
| 571 | memory_set_bankptr(machine, 9, c128_ram + 0xff05); |
| 572 | else |
| 573 | memory_set_bankptr(machine, 9, c64_memory + 0xff05); |
| 602 | 574 | |
| 603 | 575 | if ( (( (input_port_read(machine, "SPECIAL") & 0x06) == 0x02 ) && (MMU_RAM_ADDR >= 0x40000)) |
| 604 | 576 | || (( (input_port_read(machine, "SPECIAL") & 0x06) == 0x00) && (MMU_RAM_ADDR >= 0x20000)) ) |
| r5842 | r5843 | |
| 606 | 578 | #endif |
| 607 | 579 | } |
| 608 | 580 | |
| 609 | | static void c128_bankswitch_128 (running_machine *machine, int reset) |
| 581 | static void c128_bankswitch_128( running_machine *machine, int reset ) |
| 610 | 582 | { |
| 611 | 583 | read8_space_func rh; |
| 612 | 584 | |
| r5842 | r5843 | |
| 619 | 591 | c128_ram_bottom = 0; |
| 620 | 592 | c128_ram_top = 0x10000; |
| 621 | 593 | |
| 622 | | memory_set_bankptr (machine, 1, c64_memory); |
| 623 | | memory_set_bankptr (machine, 2, c64_memory + 0x100); |
| 594 | memory_set_bankptr(machine, 1, c64_memory); |
| 595 | memory_set_bankptr(machine, 2, c64_memory + 0x100); |
| 624 | 596 | |
| 625 | | memory_set_bankptr (machine, 3, c64_memory + 0x200); |
| 626 | | memory_set_bankptr (machine, 4, c64_memory + 0x400); |
| 627 | | memory_set_bankptr (machine, 5, c64_memory + 0x1000); |
| 628 | | memory_set_bankptr (machine, 6, c64_memory + 0x2000); |
| 597 | memory_set_bankptr(machine, 3, c64_memory + 0x200); |
| 598 | memory_set_bankptr(machine, 4, c64_memory + 0x400); |
| 599 | memory_set_bankptr(machine, 5, c64_memory + 0x1000); |
| 600 | memory_set_bankptr(machine, 6, c64_memory + 0x2000); |
| 629 | 601 | |
| 630 | | memory_set_bankptr (machine, 7, c64_memory + 0x4000); |
| 602 | memory_set_bankptr(machine, 7, c64_memory + 0x4000); |
| 631 | 603 | |
| 632 | | memory_set_bankptr (machine, 12, c64_memory + 0xc000); |
| 604 | memory_set_bankptr(machine, 12, c64_memory + 0xc000); |
| 633 | 605 | |
| 634 | | c128_bankswitch_64 (machine, reset); |
| 606 | c128_bankswitch_64(machine, reset); |
| 635 | 607 | } |
| 636 | 608 | else |
| 637 | 609 | { |
| 638 | 610 | c128_ram = c64_memory + MMU_RAM_ADDR; |
| 639 | 611 | c128_va1617 = MMU_VIC_ADDR; |
| 640 | | memory_set_bankptr (machine, 1, c64_memory + mmu_page0); |
| 641 | | memory_set_bankptr (machine, 2, c64_memory + mmu_page1); |
| 612 | memory_set_bankptr(machine, 1, c64_memory + mmu_page0); |
| 613 | memory_set_bankptr(machine, 2, c64_memory + mmu_page1); |
| 642 | 614 | if (MMU_BOTTOM) |
| 643 | 615 | { |
| 644 | 616 | c128_ram_bottom = MMU_SIZE; |
| 645 | 617 | } |
| 646 | 618 | else |
| 647 | 619 | c128_ram_bottom = 0; |
| 648 | | memory_set_bankptr (machine, 3, (c128_ram_bottom > 0x200 ? c64_memory : c128_ram) + 0x200); |
| 649 | | memory_set_bankptr (machine, 4, (c128_ram_bottom > 0x400 ? c64_memory : c128_ram) + 0x400); |
| 650 | | memory_set_bankptr (machine, 5, (c128_ram_bottom > 0x1000 ? c64_memory : c128_ram) + 0x1000); |
| 651 | | memory_set_bankptr (machine, 6, (c128_ram_bottom > 0x2000 ? c64_memory : c128_ram) + 0x2000); |
| 620 | memory_set_bankptr(machine, 3, (c128_ram_bottom > 0x200 ? c64_memory : c128_ram) + 0x200); |
| 621 | memory_set_bankptr(machine, 4, (c128_ram_bottom > 0x400 ? c64_memory : c128_ram) + 0x400); |
| 622 | memory_set_bankptr(machine, 5, (c128_ram_bottom > 0x1000 ? c64_memory : c128_ram) + 0x1000); |
| 623 | memory_set_bankptr(machine, 6, (c128_ram_bottom > 0x2000 ? c64_memory : c128_ram) + 0x2000); |
| 652 | 624 | |
| 653 | 625 | if (MMU_RAM_LO) |
| 654 | 626 | { |
| 655 | | memory_set_bankptr (machine, 7, c128_ram + 0x4000); |
| 627 | memory_set_bankptr(machine, 7, c128_ram + 0x4000); |
| 656 | 628 | } |
| 657 | 629 | else |
| 658 | 630 | { |
| 659 | | memory_set_bankptr (machine, 7, c128_basic); |
| 631 | memory_set_bankptr(machine, 7, c128_basic); |
| 660 | 632 | } |
| 661 | 633 | |
| 662 | 634 | if (MMU_RAM_MID) |
| 663 | 635 | { |
| 664 | | memory_set_bankptr (machine, 8, c128_ram + 0x8000); |
| 665 | | memory_set_bankptr (machine, 9, c128_ram + 0xa000); |
| 636 | memory_set_bankptr(machine, 8, c128_ram + 0x8000); |
| 637 | memory_set_bankptr(machine, 9, c128_ram + 0xa000); |
| 666 | 638 | } |
| 667 | 639 | else if (MMU_ROM_MID) |
| 668 | 640 | { |
| 669 | | memory_set_bankptr (machine, 8, c128_basic + 0x4000); |
| 670 | | memory_set_bankptr (machine, 9, c128_basic + 0x6000); |
| 641 | memory_set_bankptr(machine, 8, c128_basic + 0x4000); |
| 642 | memory_set_bankptr(machine, 9, c128_basic + 0x6000); |
| 671 | 643 | } |
| 672 | 644 | else if (MMU_INTERNAL_ROM_MID) |
| 673 | 645 | { |
| 674 | | memory_set_bankptr (machine, 8, c128_internal_function); |
| 675 | | memory_set_bankptr (machine, 9, c128_internal_function + 0x2000); |
| 646 | memory_set_bankptr(machine, 8, c128_internal_function); |
| 647 | memory_set_bankptr(machine, 9, c128_internal_function + 0x2000); |
| 676 | 648 | } |
| 677 | 649 | else |
| 678 | 650 | { |
| 679 | | memory_set_bankptr (machine, 8, c128_external_function); |
| 680 | | memory_set_bankptr (machine, 9, c128_external_function + 0x2000); |
| 651 | memory_set_bankptr(machine, 8, c128_external_function); |
| 652 | memory_set_bankptr(machine, 9, c128_external_function + 0x2000); |
| 681 | 653 | } |
| 682 | 654 | |
| 683 | 655 | if (MMU_TOP) |
| r5842 | r5843 | |
| 705 | 677 | { |
| 706 | 678 | if (c128_ram_top > 0xc000) |
| 707 | 679 | { |
| 708 | | memory_set_bankptr (machine, 12, c128_ram + 0xc000); |
| 680 | memory_set_bankptr(machine, 12, c128_ram + 0xc000); |
| 709 | 681 | } |
| 710 | 682 | else |
| 711 | 683 | { |
| 712 | | memory_set_bankptr (machine, 12, c64_memory + 0xc000); |
| 684 | memory_set_bankptr(machine, 12, c64_memory + 0xc000); |
| 713 | 685 | } |
| 714 | 686 | if (!MMU_IO_ON) |
| 715 | 687 | { |
| 716 | 688 | if (c128_ram_top > 0xd000) |
| 717 | 689 | { |
| 718 | | memory_set_bankptr (machine, 13, c128_ram + 0xd000); |
| 690 | memory_set_bankptr(machine, 13, c128_ram + 0xd000); |
| 719 | 691 | } |
| 720 | 692 | else |
| 721 | 693 | { |
| 722 | | memory_set_bankptr (machine, 13, c64_memory + 0xd000); |
| 694 | memory_set_bankptr(machine, 13, c64_memory + 0xd000); |
| 723 | 695 | } |
| 724 | 696 | } |
| 725 | 697 | if (c128_ram_top > 0xe000) |
| 726 | 698 | { |
| 727 | | memory_set_bankptr (machine, 14, c128_ram + 0xe000); |
| 699 | memory_set_bankptr(machine, 14, c128_ram + 0xe000); |
| 728 | 700 | } |
| 729 | 701 | else |
| 730 | 702 | { |
| 731 | | memory_set_bankptr (machine, 14, c64_memory + 0xe000); |
| 703 | memory_set_bankptr(machine, 14, c64_memory + 0xe000); |
| 732 | 704 | } |
| 733 | 705 | if (c128_ram_top > 0xff05) |
| 734 | 706 | { |
| 735 | | memory_set_bankptr (machine, 16, c128_ram + 0xff05); |
| 707 | memory_set_bankptr(machine, 16, c128_ram + 0xff05); |
| 736 | 708 | } |
| 737 | 709 | else |
| 738 | 710 | { |
| 739 | | memory_set_bankptr (machine, 16, c64_memory + 0xff05); |
| 711 | memory_set_bankptr(machine, 16, c64_memory + 0xff05); |
| 740 | 712 | } |
| 741 | 713 | } |
| 742 | 714 | else if (MMU_ROM_HI) |
| 743 | 715 | { |
| 744 | | memory_set_bankptr (machine, 12, c128_editor); |
| 716 | memory_set_bankptr(machine, 12, c128_editor); |
| 745 | 717 | if (!MMU_IO_ON) { |
| 746 | | memory_set_bankptr (machine, 13, c128_chargen); |
| 718 | memory_set_bankptr(machine, 13, c128_chargen); |
| 747 | 719 | } |
| 748 | | memory_set_bankptr (machine, 14, c128_kernal); |
| 749 | | memory_set_bankptr (machine, 16, c128_kernal + 0x1f05); |
| 720 | memory_set_bankptr(machine, 14, c128_kernal); |
| 721 | memory_set_bankptr(machine, 16, c128_kernal + 0x1f05); |
| 750 | 722 | } |
| 751 | 723 | else if (MMU_INTERNAL_ROM_HI) |
| 752 | 724 | { |
| 753 | | memory_set_bankptr (machine, 12, c128_internal_function); |
| 725 | memory_set_bankptr(machine, 12, c128_internal_function); |
| 754 | 726 | if (!MMU_IO_ON) { |
| 755 | | memory_set_bankptr (machine, 13, c128_internal_function + 0x1000); |
| 727 | memory_set_bankptr(machine, 13, c128_internal_function + 0x1000); |
| 756 | 728 | } |
| 757 | | memory_set_bankptr (machine, 14, c128_internal_function + 0x2000); |
| 758 | | memory_set_bankptr (machine, 16, c128_internal_function + 0x3f05); |
| 729 | memory_set_bankptr(machine, 14, c128_internal_function + 0x2000); |
| 730 | memory_set_bankptr(machine, 16, c128_internal_function + 0x3f05); |
| 759 | 731 | } |
| 760 | 732 | else /*if (MMU_EXTERNAL_ROM_HI) */ |
| 761 | 733 | { |
| 762 | | memory_set_bankptr (machine, 12, c128_external_function); |
| 734 | memory_set_bankptr(machine, 12, c128_external_function); |
| 763 | 735 | if (!MMU_IO_ON) { |
| 764 | | memory_set_bankptr (machine, 13, c128_external_function + 0x1000); |
| 736 | memory_set_bankptr(machine, 13, c128_external_function + 0x1000); |
| 765 | 737 | } |
| 766 | | memory_set_bankptr (machine, 14, c128_external_function + 0x2000); |
| 767 | | memory_set_bankptr (machine, 16, c128_external_function + 0x3f05); |
| 738 | memory_set_bankptr(machine, 14, c128_external_function + 0x2000); |
| 739 | memory_set_bankptr(machine, 16, c128_external_function + 0x3f05); |
| 768 | 740 | } |
| 769 | 741 | |
| 770 | 742 | if ( (( (input_port_read(machine, "SPECIAL") & 0x06) == 0x02 ) && (MMU_RAM_ADDR >= 0x40000)) |
| r5842 | r5843 | |
| 775 | 747 | |
| 776 | 748 | // 128u4 |
| 777 | 749 | // FIX-ME: are the bankswitch functions working in the expected way without the memory_set_context? |
| 778 | | static void c128_bankswitch (running_machine *machine, int reset) |
| 750 | static void c128_bankswitch( running_machine *machine, int reset ) |
| 779 | 751 | { |
| 780 | 752 | if (mmu_cpu != MMU_CPU8502) |
| 781 | 753 | { |
| 782 | 754 | if (!MMU_CPU8502) |
| 783 | 755 | { |
| 784 | | // DBG_LOG(machine, 1, "switching to z80", ("active %d\n",cpu_getactivecpu()) ); |
| 785 | | // memory_set_context(machine, 0); |
| 756 | // DBG_LOG(machine, 1, "switching to z80", ("active %d\n",cpu_getactivecpu()) ); |
| 757 | // memory_set_context(machine, 0); |
| 786 | 758 | c128_bankswitch_z80(machine); |
| 787 | | // memory_set_context(machine, 1); |
| 759 | // memory_set_context(machine, 1); |
| 788 | 760 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE); |
| 789 | 761 | cputag_set_input_line(machine, "m8502", INPUT_LINE_HALT, ASSERT_LINE); |
| 790 | 762 | } |
| 791 | 763 | else |
| 792 | 764 | { |
| 793 | | // DBG_LOG(machine, 1, "switching to m6502", ("active %d\n",cpu_getactivecpu()) ); |
| 794 | | // memory_set_context(machine, 1); |
| 765 | // DBG_LOG(machine, 1, "switching to m6502", ("active %d\n",cpu_getactivecpu()) ); |
| 766 | // memory_set_context(machine, 1); |
| 795 | 767 | c128_bankswitch_128(machine, reset); |
| 796 | | // memory_set_context(machine, 0); |
| 768 | // memory_set_context(machine, 0); |
| 797 | 769 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, ASSERT_LINE); |
| 798 | 770 | cputag_set_input_line(machine, "m8502", INPUT_LINE_HALT, CLEAR_LINE); |
| 799 | 771 | |
| 800 | 772 | /* NPW 19-Nov-2005 - In the C128, CPU #0 starts out and hands over |
| 801 | | * control to CPU #1. CPU #1 seems to execute garbage from 0x0000 |
| 802 | | * up to 0x1100, at which point it finally hits some code |
| 803 | | * (presumably set up by CPU #1.) This always worked, but when I |
| 804 | | * changed the m8502 CPU core to use an internal memory map, it |
| 805 | | * started BRK-ing forever when trying to execute 0x0000. |
| 806 | | * |
| 807 | | * I am not sure whether the C128 actually executes this invalid |
| 808 | | * memory or if this is a bug in the C128 driver. In any case, the |
| 809 | | * driver used to work with this behavior, so I am doing this hack |
| 810 | | * where I set CPU #1's PC to 0x1100 on reset. |
| 811 | | */ |
| 773 | * control to CPU #1. CPU #1 seems to execute garbage from 0x0000 |
| 774 | * up to 0x1100, at which point it finally hits some code |
| 775 | * (presumably set up by CPU #1.) This always worked, but when I |
| 776 | * changed the m8502 CPU core to use an internal memory map, it |
| 777 | * started BRK-ing forever when trying to execute 0x0000. |
| 778 | * |
| 779 | * I am not sure whether the C128 actually executes this invalid |
| 780 | * memory or if this is a bug in the C128 driver. In any case, the |
| 781 | * driver used to work with this behavior, so I am doing this hack |
| 782 | * where I set CPU #1's PC to 0x1100 on reset. |
| 783 | */ |
| 812 | 784 | if (cpu_get_reg(cputag_get_cpu(machine, "m8502"), REG_GENPC) == 0x0000) |
| 813 | 785 | cpu_set_reg(cputag_get_cpu(machine, "m8502"), REG_GENPC, 0x1100); |
| 814 | 786 | } |
| r5842 | r5843 | |
| 821 | 793 | c128_bankswitch_128(machine, reset); |
| 822 | 794 | } |
| 823 | 795 | |
| 824 | | static void c128_mmu8722_reset (running_machine *machine) |
| 796 | static void c128_mmu8722_reset( running_machine *machine ) |
| 825 | 797 | { |
| 826 | 798 | memset(c128_mmu, 0, sizeof (c128_mmu)); |
| 827 | 799 | c128_mmu[5] |= 0x38; |
| 828 | 800 | c128_mmu[10] = 1; |
| 829 | 801 | mmu_cpu = 0; |
| 830 | | mmu_page0 = 0; |
| 831 | | mmu_page1 = 0x0100; |
| 802 | mmu_page0 = 0; |
| 803 | mmu_page1 = 0x0100; |
| 832 | 804 | c128_bankswitch (machine, 1); |
| 833 | 805 | } |
| 834 | 806 | |
| r5842 | r5843 | |
| 892 | 864 | /* hinybble number of 64 kb memory blocks */ |
| 893 | 865 | if ((input_port_read(space->machine, "SPECIAL") & 0x06) == 0x02) // 256KB RAM |
| 894 | 866 | data = 0x4f; |
| 895 | | else if ((input_port_read(space->machine, "SPECIAL") & 0x06) == 0x04) // 1MB |
| 867 | else if ((input_port_read(space->machine, "SPECIAL") & 0x06) == 0x04) // 1MB |
| 896 | 868 | data = 0xf; |
| 897 | | else |
| 869 | else |
| 898 | 870 | data = 0x2f; |
| 899 | 871 | break; |
| 900 | 872 | case 0xc: |
| r5842 | r5843 | |
| 938 | 910 | |
| 939 | 911 | WRITE8_HANDLER( c128_write_0000 ) |
| 940 | 912 | { |
| 941 | | if (c128_ram!=NULL) |
| 913 | if (c128_ram != NULL) |
| 942 | 914 | c128_ram[0x0000 + offset] = data; |
| 943 | 915 | } |
| 944 | 916 | |
| 945 | 917 | WRITE8_HANDLER( c128_write_1000 ) |
| 946 | 918 | { |
| 947 | | if (c128_ram!=NULL) |
| 919 | if (c128_ram != NULL) |
| 948 | 920 | c128_ram[0x1000 + offset] = data; |
| 949 | 921 | } |
| 950 | 922 | |
| 951 | 923 | WRITE8_HANDLER( c128_write_4000 ) |
| 952 | 924 | { |
| 953 | | if (c128_ram!=NULL) |
| 925 | if (c128_ram != NULL) |
| 954 | 926 | c128_ram[0x4000 + offset] = data; |
| 955 | 927 | } |
| 956 | 928 | |
| 957 | 929 | WRITE8_HANDLER( c128_write_8000 ) |
| 958 | 930 | { |
| 959 | | if (c128_ram!=NULL) |
| 931 | if (c128_ram != NULL) |
| 960 | 932 | c128_ram[0x8000 + offset] = data; |
| 961 | 933 | } |
| 962 | 934 | |
| 963 | 935 | WRITE8_HANDLER( c128_write_a000 ) |
| 964 | 936 | { |
| 965 | | if (c128_ram!=NULL) |
| 937 | if (c128_ram != NULL) |
| 966 | 938 | c128_ram[0xa000 + offset] = data; |
| 967 | 939 | } |
| 968 | 940 | |
| 969 | 941 | WRITE8_HANDLER( c128_write_c000 ) |
| 970 | 942 | { |
| 971 | | if (c128_ram!=NULL) |
| 943 | if (c128_ram != NULL) |
| 972 | 944 | c128_ram[0xc000 + offset] = data; |
| 973 | 945 | } |
| 974 | 946 | |
| r5842 | r5843 | |
| 976 | 948 | { |
| 977 | 949 | if (offset + 0xe000 >= c128_ram_top) |
| 978 | 950 | c64_memory[0xe000 + offset] = data; |
| 979 | | else if (c128_ram!=NULL) |
| 951 | else if (c128_ram != NULL) |
| 980 | 952 | c128_ram[0xe000 + offset] = data; |
| 981 | 953 | } |
| 982 | 954 | |
| 983 | 955 | WRITE8_HANDLER( c128_write_ff00 ) |
| 984 | 956 | { |
| 985 | 957 | if (!c64mode) |
| 986 | | c128_mmu8722_ff00_w (space, offset, data); |
| 958 | c128_mmu8722_ff00_w(space, offset, data); |
| 987 | 959 | else if (c128_ram!=NULL) |
| 988 | 960 | c64_memory[0xff00 + offset] = data; |
| 989 | 961 | } |
| r5842 | r5843 | |
| 1018 | 990 | return c64_chargen[offset & 0xfff]; |
| 1019 | 991 | return c64_vicaddr[offset]; |
| 1020 | 992 | } |
| 1021 | | if ( !(c64_port6510&4) |
| 1022 | | && (((c128_vicaddr - c64_memory + offset) & 0x7000) == 0x1000) ) |
| 993 | if (!(c64_port6510&4) |
| 994 | && (((c128_vicaddr - c64_memory + offset) & 0x7000) == 0x1000)) |
| 1023 | 995 | return c128_chargen[offset & 0xfff]; |
| 1024 | 996 | return c128_vicaddr[offset]; |
| 1025 | 997 | } |
| r5842 | r5843 | |
| 1035 | 1007 | } |
| 1036 | 1008 | |
| 1037 | 1009 | /* 2008-09-01 |
| 1038 | | We need here the m6510 port handlers from c64, otherwise c128_common_driver_init |
| 1039 | | seems unable to use correctly the timer. |
| 1040 | | This will be probably fixed in a future clean up. |
| 1010 | We need here the m6510 port handlers from c64, otherwise c128_common_driver_init |
| 1011 | seems unable to use correctly the timer. |
| 1012 | This will be probably fixed in a future clean up. |
| 1041 | 1013 | */ |
| 1042 | 1014 | |
| 1043 | 1015 | static emu_timer *datasette_timer; |
| 1044 | 1016 | |
| 1045 | | void c128_m6510_port_write(const device_config *device, UINT8 direction, UINT8 data) |
| 1017 | void c128_m6510_port_write( const device_config *device, UINT8 direction, UINT8 data ) |
| 1046 | 1018 | { |
| 1047 | 1019 | /* if line is marked as input then keep current value */ |
| 1048 | 1020 | data = (c64_port_data & ~direction) | (data & direction); |
| 1049 | 1021 | |
| 1050 | 1022 | /* resistors make P0,P1,P2 go high when respective line is changed to input */ |
| 1051 | | if (!(direction & 0x04)) |
| 1023 | if (!(direction & 0x04)) |
| 1052 | 1024 | data |= 0x04; |
| 1053 | 1025 | |
| 1054 | 1026 | if (!(direction & 0x02)) |
| r5842 | r5843 | |
| 1061 | 1033 | |
| 1062 | 1034 | if (c64_tape_on) |
| 1063 | 1035 | { |
| 1064 | | if (direction & 0x08) |
| 1036 | if (direction & 0x08) |
| 1065 | 1037 | { |
| 1066 | 1038 | cassette_output(devtag_get_device(device->machine, "cassette"), (data & 0x08) ? -(0x5a9e >> 1) : +(0x5a9e >> 1)); |
| 1067 | 1039 | } |
| 1068 | 1040 | |
| 1069 | 1041 | if (direction & 0x20) |
| 1070 | 1042 | { |
| 1071 | | if(!(data & 0x20)) |
| 1043 | if (!(data & 0x20)) |
| 1072 | 1044 | { |
| 1073 | 1045 | cassette_change_state(devtag_get_device(device->machine, "cassette"),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); |
| 1074 | 1046 | timer_adjust_periodic(datasette_timer, attotime_zero, 0, ATTOTIME_IN_HZ(44100)); |
| r5842 | r5843 | |
| 1087 | 1059 | c64_memory[0x001] = memory_read_byte( cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 1 ); |
| 1088 | 1060 | } |
| 1089 | 1061 | |
| 1090 | | UINT8 c128_m6510_port_read(const device_config *device, UINT8 direction) |
| 1062 | UINT8 c128_m6510_port_read( const device_config *device, UINT8 direction ) |
| 1091 | 1063 | { |
| 1092 | 1064 | UINT8 data = c64_port_data; |
| 1093 | 1065 | |
| r5842 | r5843 | |
| 1104 | 1076 | return data; |
| 1105 | 1077 | } |
| 1106 | 1078 | |
| 1107 | | static void c128_common_driver_init(running_machine *machine) |
| 1079 | static void c128_common_driver_init( running_machine *machine ) |
| 1108 | 1080 | { |
| 1109 | 1081 | UINT8 *gfx=memory_region(machine, "gfx1"); |
| 1110 | 1082 | UINT8 *ram = memory_region(machine, "maincpu"); |
| r5842 | r5843 | |
| 1112 | 1084 | |
| 1113 | 1085 | c64_memory = ram; |
| 1114 | 1086 | |
| 1115 | | c128_basic = ram+0x100000; |
| 1116 | | c64_basic = ram+0x108000; |
| 1117 | | c64_kernal = ram+0x10a000; |
| 1118 | | c128_editor = ram+0x10c000; |
| 1119 | | c128_z80 = ram+0x10d000; |
| 1120 | | c128_kernal = ram+0x10e000; |
| 1121 | | c128_internal_function = ram+0x110000; |
| 1122 | | c128_external_function = ram+0x118000; |
| 1123 | | c64_chargen = ram+0x120000; |
| 1124 | | c128_chargen = ram+0x121000; |
| 1125 | | c64_colorram = ram+0x122000; |
| 1126 | | c128_vdcram = ram+0x122800; |
| 1087 | c128_basic = ram + 0x100000; |
| 1088 | c64_basic = ram + 0x108000; |
| 1089 | c64_kernal = ram + 0x10a000; |
| 1090 | c128_editor = ram + 0x10c000; |
| 1091 | c128_z80 = ram + 0x10d000; |
| 1092 | c128_kernal = ram + 0x10e000; |
| 1093 | c128_internal_function = ram + 0x110000; |
| 1094 | c128_external_function = ram + 0x118000; |
| 1095 | c64_chargen = ram + 0x120000; |
| 1096 | c128_chargen = ram + 0x121000; |
| 1097 | c64_colorram = ram + 0x122000; |
| 1098 | c128_vdcram = ram + 0x122800; |
| 1127 | 1099 | |
| 1128 | | for (i=0; i<0x100; i++) |
| 1129 | | gfx[i]=i; |
| 1100 | c64mode = 0; |
| 1101 | c128_cia1_on = 1; |
| 1102 | vicirq = 0; |
| 1130 | 1103 | |
| 1104 | for (i = 0; i < 0x100; i++) |
| 1105 | gfx[i] = i; |
| 1106 | |
| 1131 | 1107 | if (c64_tape_on) |
| 1132 | 1108 | datasette_timer = timer_alloc(machine, c64_tape_timer, NULL); |
| 1133 | 1109 | } |
| r5842 | r5843 | |
| 1135 | 1111 | DRIVER_INIT( c128 ) |
| 1136 | 1112 | { |
| 1137 | 1113 | c64_tape_on = 1; |
| 1114 | c64_pal = 0; |
| 1115 | emulated_drive = 0; |
| 1138 | 1116 | c128_common_driver_init(machine); |
| 1139 | 1117 | vic6567_init(1, c64_pal, c128_dma_read, c128_dma_read_color, c128_vic_interrupt); |
| 1140 | 1118 | vic2_set_rastering(0); |
| r5842 | r5843 | |
| 1146 | 1124 | { |
| 1147 | 1125 | c64_tape_on = 1; |
| 1148 | 1126 | c64_pal = 1; |
| 1127 | emulated_drive = 0; |
| 1149 | 1128 | c128_common_driver_init(machine); |
| 1150 | 1129 | vic6567_init(1, c64_pal, c128_dma_read, c128_dma_read_color, c128_vic_interrupt); |
| 1151 | 1130 | vic2_set_rastering(1); |
| r5842 | r5843 | |
| 1157 | 1136 | { |
| 1158 | 1137 | DRIVER_INIT_CALL( c128 ); |
| 1159 | 1138 | emulated_drive = 1; |
| 1160 | | drive_config(machine, type_1571, 0, 0, "cpu_vc1571", 8); |
| 1139 | cbm_drive_config(machine, type_1571, 0, 0, "cpu_vc1571", 8); |
| 1161 | 1140 | } |
| 1162 | 1141 | |
| 1163 | 1142 | DRIVER_INIT( c128dpal ) |
| 1164 | 1143 | { |
| 1165 | 1144 | DRIVER_INIT_CALL( c128pal ); |
| 1166 | 1145 | emulated_drive = 1; |
| 1167 | | drive_config(machine, type_1571, 0, 0, "cpu_vc1571", 8); |
| 1146 | cbm_drive_config(machine, type_1571, 0, 0, "cpu_vc1571", 8); |
| 1168 | 1147 | } |
| 1169 | 1148 | |
| 1170 | 1149 | DRIVER_INIT( c128dcr ) |
| 1171 | 1150 | { |
| 1172 | 1151 | DRIVER_INIT_CALL( c128 ); |
| 1173 | 1152 | emulated_drive = 1; |
| 1174 | | drive_config(machine, type_1571cr, 0, 0, "cpu_vc1571", 8); |
| 1153 | cbm_drive_config(machine, type_1571cr, 0, 0, "cpu_vc1571", 8); |
| 1175 | 1154 | } |
| 1176 | 1155 | |
| 1177 | 1156 | DRIVER_INIT( c128dcrp ) |
| 1178 | 1157 | { |
| 1179 | 1158 | DRIVER_INIT_CALL( c128pal ); |
| 1180 | 1159 | emulated_drive = 1; |
| 1181 | | drive_config(machine, type_1571cr, 0, 0, "cpu_vc1571", 8); |
| 1160 | cbm_drive_config(machine, type_1571cr, 0, 0, "cpu_vc1571", 8); |
| 1182 | 1161 | } |
| 1183 | 1162 | |
| 1184 | 1163 | DRIVER_INIT( c128d81 ) |
| 1185 | 1164 | { |
| 1186 | 1165 | DRIVER_INIT_CALL( c128 ); |
| 1187 | 1166 | emulated_drive = 1; |
| 1188 | | drive_config(machine, type_1581, 0, 0, "cpu_vc1571", 8); |
| 1167 | cbm_drive_config(machine, type_1581, 0, 0, "cpu_vc1571", 8); |
| 1189 | 1168 | } |
| 1190 | 1169 | |
| 1191 | 1170 | MACHINE_START( c128 ) |
| 1192 | 1171 | { |
| 1193 | 1172 | if (emulated_drive) |
| 1194 | 1173 | { |
| 1195 | | drive_reset(); |
| 1174 | cbm_drive_reset(machine); |
| 1196 | 1175 | } |
| 1197 | 1176 | else if (c128_cia1_on) |
| 1198 | 1177 | { |
| r5842 | r5843 | |
| 1211 | 1190 | { |
| 1212 | 1191 | c128_vicaddr = c64_vicaddr = c64_memory; |
| 1213 | 1192 | c64mode = 0; |
| 1214 | | c128_mmu8722_reset (machine); |
| 1193 | c128_mmu8722_reset(machine); |
| 1215 | 1194 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE); |
| 1216 | 1195 | cputag_set_input_line(machine, "m8502", INPUT_LINE_HALT, ASSERT_LINE); |
| 1217 | 1196 | } |
| r5842 | r5843 | |
| 1250 | 1229 | cbm_common_interrupt(device); |
| 1251 | 1230 | |
| 1252 | 1231 | /* Fix Me! Currently, neither left Shift nor Shift Lock work in c128, but reading the correspondent input produces a bug! |
| 1253 | | Hence, we overwrite the actual reading as it never happens */ |
| 1254 | | if ((input_port_read(device->machine, "SPECIAL") & 0x40)) // |
| 1232 | Hence, we overwrite the actual reading as it never happens */ |
| 1233 | if ((input_port_read(device->machine, "SPECIAL") & 0x40)) // |
| 1255 | 1234 | c64_keyline[1] |= 0x80; |
| 1256 | 1235 | |
| 1257 | 1236 | /* c128 specific: keypad input ports */ |
src/mess/machine/c16.c
| r5842 | r5843 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | commodore c16 home computer |
| 3 | commodore c16 home computer |
| 4 | 4 | |
| 5 | | peter.trauner@jk.uni-linz.ac.at |
| 5 | peter.trauner@jk.uni-linz.ac.at |
| 6 | 6 | documentation |
| 7 | | www.funet.fi |
| 7 | www.funet.fi |
| 8 | 8 | |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| r5842 | r5843 | |
| 56 | 56 | |
| 57 | 57 | static UINT8 port6529; |
| 58 | 58 | |
| 59 | | static int lowrom = 0, highrom = 0; |
| 59 | static int lowrom, highrom; |
| 60 | 60 | |
| 61 | 61 | static UINT8 *c16_memory_10000; |
| 62 | 62 | static UINT8 *c16_memory_14000; |
| r5842 | r5843 | |
| 67 | 67 | static UINT8 *c16_memory_28000; |
| 68 | 68 | static UINT8 *c16_memory_2c000; |
| 69 | 69 | |
| 70 | | static int has_c1551 = 0, has_vc1541 = 0, has_iec8 = 0, has_iec9 = 0; // Notice that iec8 & iec9 have never been implemented |
| 70 | static int has_c1551, has_vc1541, has_iec8, has_iec9; // Notice that iec8 & iec9 have never been implemented |
| 71 | 71 | |
| 72 | | static UINT8 read_cfg1(running_machine *machine) |
| 72 | static UINT8 read_cfg1( running_machine *machine ) |
| 73 | 73 | { |
| 74 | 74 | UINT8 result; |
| 75 | | switch(mame_get_phase(machine)) |
| 75 | switch (mame_get_phase(machine)) |
| 76 | 76 | { |
| 77 | 77 | case MAME_PHASE_RESET: |
| 78 | 78 | case MAME_PHASE_RUNNING: |
| r5842 | r5843 | |
| 110 | 110 | p7 serial data in, serial bus 5 |
| 111 | 111 | */ |
| 112 | 112 | |
| 113 | | void c16_m7501_port_write(const device_config *device, UINT8 direction, UINT8 data) |
| 113 | void c16_m7501_port_write( const device_config *device, UINT8 direction, UINT8 data ) |
| 114 | 114 | { |
| 115 | 115 | const device_config *serbus = devtag_get_device(device->machine, "serial_bus"); |
| 116 | 116 | int dat, atn, clk; |
| r5842 | r5843 | |
| 121 | 121 | cbm_serial_data_write(serbus, 0, dat = !(data & 0x01)); |
| 122 | 122 | |
| 123 | 123 | cassette_output(devtag_get_device(device->machine, "cassette"), !(data & 0x02) ? -(0x5a9e >> 1) : +(0x5a9e >> 1)); |
| 124 | | |
| 124 | |
| 125 | 125 | cassette_change_state(devtag_get_device(device->machine, "cassette"), (data & 0x08) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | | UINT8 c16_m7501_port_read(const device_config *device, UINT8 direction) |
| 128 | UINT8 c16_m7501_port_read( const device_config *device, UINT8 direction ) |
| 129 | 129 | { |
| 130 | 130 | UINT8 data = 0xff; |
| 131 | 131 | UINT8 c16_port7501 = (UINT8) devtag_get_info_int(device->machine, "maincpu", CPUINFO_INT_M6510_PORT); |
| r5842 | r5843 | |
| 137 | 137 | if ((c16_port7501 & 0x02) || !cbm_serial_clock_read(serbus, 0)) |
| 138 | 138 | data &= ~0x40; |
| 139 | 139 | |
| 140 | | // data &= ~0x20; // port bit not in pinout |
| 140 | // data &= ~0x20; // port bit not in pinout |
| 141 | 141 | |
| 142 | 142 | if (cassette_input(devtag_get_device(device->machine, "cassette")) > +0.0) |
| 143 | 143 | data |= 0x10; |
| r5842 | r5843 | |
| 147 | 147 | return data; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | | static void c16_bankswitch (running_machine *machine) |
| 150 | static void c16_bankswitch( running_machine *machine ) |
| 151 | 151 | { |
| 152 | 152 | UINT8 *rom = memory_region(machine, "maincpu"); |
| 153 | | memory_set_bankptr (machine, 9, mess_ram); |
| 153 | memory_set_bankptr(machine, 9, mess_ram); |
| 154 | 154 | |
| 155 | 155 | switch (lowrom) |
| 156 | 156 | { |
| 157 | 157 | case 0: |
| 158 | | memory_set_bankptr (machine, 2, rom + 0x10000); |
| 158 | memory_set_bankptr(machine, 2, rom + 0x10000); |
| 159 | 159 | break; |
| 160 | 160 | case 1: |
| 161 | | memory_set_bankptr (machine, 2, rom + 0x18000); |
| 161 | memory_set_bankptr(machine, 2, rom + 0x18000); |
| 162 | 162 | break; |
| 163 | 163 | case 2: |
| 164 | | memory_set_bankptr (machine, 2, rom + 0x20000); |
| 164 | memory_set_bankptr(machine, 2, rom + 0x20000); |
| 165 | 165 | break; |
| 166 | 166 | case 3: |
| 167 | | memory_set_bankptr (machine, 2, rom + 0x28000); |
| 167 | memory_set_bankptr(machine, 2, rom + 0x28000); |
| 168 | 168 | break; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | switch (highrom) |
| 172 | 172 | { |
| 173 | 173 | case 0: |
| 174 | | memory_set_bankptr (machine, 3, rom + 0x14000); |
| 175 | | memory_set_bankptr (machine, 8, rom + 0x17f20); |
| 174 | memory_set_bankptr(machine, 3, rom + 0x14000); |
| 175 | memory_set_bankptr(machine, 8, rom + 0x17f20); |
| 176 | 176 | break; |
| 177 | 177 | case 1: |
| 178 | | memory_set_bankptr (machine, 3, rom + 0x1c000); |
| 179 | | memory_set_bankptr (machine, 8, rom + 0x1ff20); |
| 178 | memory_set_bankptr(machine, 3, rom + 0x1c000); |
| 179 | memory_set_bankptr(machine, 8, rom + 0x1ff20); |
| 180 | 180 | break; |
| 181 | 181 | case 2: |
| 182 | | memory_set_bankptr (machine, 3, rom + 0x24000); |
| 183 | | memory_set_bankptr (machine, 8, rom + 0x27f20); |
| 182 | memory_set_bankptr(machine, 3, rom + 0x24000); |
| 183 | memory_set_bankptr(machine, 8, rom + 0x27f20); |
| 184 | 184 | break; |
| 185 | 185 | case 3: |
| 186 | | memory_set_bankptr (machine, 3, rom + 0x2c000); |
| 187 | | memory_set_bankptr (machine, 8, rom + 0x2ff20); |
| 186 | memory_set_bankptr(machine, 3, rom + 0x2c000); |
| 187 | memory_set_bankptr(machine, 8, rom + 0x2ff20); |
| 188 | 188 | break; |
| 189 | 189 | } |
| 190 | | memory_set_bankptr (machine, 4, rom + 0x17c00); |
| 190 | memory_set_bankptr(machine, 4, rom + 0x17c00); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | | WRITE8_HANDLER(c16_switch_to_rom) |
| 193 | WRITE8_HANDLER( c16_switch_to_rom ) |
| 194 | 194 | { |
| 195 | 195 | ted7360_rom = 1; |
| 196 | 196 | c16_bankswitch(space->machine); |
| r5842 | r5843 | |
| 209 | 209 | * 0 1 plus4 hi |
| 210 | 210 | * 1 0 c1 high |
| 211 | 211 | * 1 1 c2 high */ |
| 212 | | WRITE8_HANDLER(c16_select_roms) |
| 212 | WRITE8_HANDLER( c16_select_roms ) |
| 213 | 213 | { |
| 214 | 214 | lowrom = offset & 0x03; |
| 215 | 215 | highrom = (offset & 0x0c) >> 2; |
| r5842 | r5843 | |
| 217 | 217 | c16_bankswitch(space->machine); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | | WRITE8_HANDLER(c16_switch_to_ram) |
| 220 | WRITE8_HANDLER( c16_switch_to_ram ) |
| 221 | 221 | { |
| 222 | 222 | ted7360_rom = 0; |
| 223 | | memory_set_bankptr (space->machine, 2, mess_ram + (0x8000 % mess_ram_size)); |
| 224 | | memory_set_bankptr (space->machine, 3, mess_ram + (0xc000 % mess_ram_size)); |
| 225 | | memory_set_bankptr (space->machine, 4, mess_ram + (0xfc00 % mess_ram_size)); |
| 226 | | memory_set_bankptr (space->machine, 8, mess_ram + (0xff20 % mess_ram_size)); |
| 223 | memory_set_bankptr(space->machine, 2, mess_ram + (0x8000 % mess_ram_size)); |
| 224 | memory_set_bankptr(space->machine, 3, mess_ram + (0xc000 % mess_ram_size)); |
| 225 | memory_set_bankptr(space->machine, 4, mess_ram + (0xfc00 % mess_ram_size)); |
| 226 | memory_set_bankptr(space->machine, 8, mess_ram + (0xff20 % mess_ram_size)); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | | int c16_read_keyboard (int databus) |
| 229 | int c16_read_keyboard( int databus ) |
| 230 | 230 | { |
| 231 | 231 | int value = 0xff; |
| 232 | 232 | |
| r5842 | r5843 | |
| 255 | 255 | value &= keyline[7]; |
| 256 | 256 | |
| 257 | 257 | /* looks like joy 0 needs dataline2 low |
| 258 | | * and joy 1 needs dataline1 low |
| 259 | | * write to 0xff08 (value on databus) reloads latches */ |
| 258 | * and joy 1 needs dataline1 low |
| 259 | * write to 0xff08 (value on databus) reloads latches */ |
| 260 | 260 | if (!(databus & 0x04)) |
| 261 | 261 | value &= keyline[8]; |
| 262 | 262 | |
| r5842 | r5843 | |
| 277 | 277 | * output low means keyboard line selected |
| 278 | 278 | * keyboard line is then read into the ted7360 latch |
| 279 | 279 | */ |
| 280 | | WRITE8_HANDLER(c16_6529_port_w) |
| 280 | WRITE8_HANDLER( c16_6529_port_w ) |
| 281 | 281 | { |
| 282 | 282 | port6529 = data; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | | READ8_HANDLER(c16_6529_port_r) |
| 285 | READ8_HANDLER( c16_6529_port_r ) |
| 286 | 286 | { |
| 287 | 287 | return port6529 & (c16_read_keyboard (0xff /*databus */ ) | (port6529 ^ 0xff)); |
| 288 | 288 | } |
| r5842 | r5843 | |
| 297 | 297 | * p6 Userport j |
| 298 | 298 | * p7 Userport f |
| 299 | 299 | */ |
| 300 | | WRITE8_HANDLER(plus4_6529_port_w) |
| 300 | WRITE8_HANDLER( plus4_6529_port_w ) |
| 301 | 301 | { |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | | READ8_HANDLER(plus4_6529_port_r) |
| 304 | READ8_HANDLER( plus4_6529_port_r ) |
| 305 | 305 | { |
| 306 | 306 | int data = 0x00; |
| 307 | 307 | |
| r5842 | r5843 | |
| 313 | 313 | return data; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | | READ8_HANDLER(c16_fd1x_r) |
| 316 | READ8_HANDLER( c16_fd1x_r ) |
| 317 | 317 | { |
| 318 | 318 | int data = 0x00; |
| 319 | 319 | |
| r5842 | r5843 | |
| 362 | 362 | 1111 19200 |
| 363 | 363 | control register |
| 364 | 364 | */ |
| 365 | | WRITE8_HANDLER(c16_6551_port_w) |
| 365 | WRITE8_HANDLER( c16_6551_port_w ) |
| 366 | 366 | { |
| 367 | 367 | offset &= 0x03; |
| 368 | 368 | DBG_LOG(space->machine, 3, "6551", ("port write %.2x %.2x\n", offset, data)); |
| 369 | 369 | port6529 = data; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | | READ8_HANDLER(c16_6551_port_r) |
| 372 | READ8_HANDLER( c16_6551_port_r ) |
| 373 | 373 | { |
| 374 | 374 | int data = 0x00; |
| 375 | 375 | |
| r5842 | r5843 | |
| 378 | 378 | return data; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | | static READ8_HANDLER(ted7360_dma_read) |
| 381 | static READ8_HANDLER( ted7360_dma_read ) |
| 382 | 382 | { |
| 383 | 383 | return mess_ram[offset % mess_ram_size]; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | | static READ8_HANDLER(ted7360_dma_read_rom) |
| 386 | static READ8_HANDLER( ted7360_dma_read_rom ) |
| 387 | 387 | { |
| 388 | 388 | /* should read real c16 system bus from 0xfd00 -ff1f */ |
| 389 | 389 | if (offset >= 0xc000) |
| r5842 | r5843 | |
| 421 | 421 | return mess_ram[offset % mess_ram_size]; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | | void c16_interrupt (running_machine *machine, int level) |
| 424 | void c16_interrupt( running_machine *machine, int level ) |
| 425 | 425 | { |
| 426 | 426 | static int old_level; |
| 427 | 427 | |
| r5842 | r5843 | |
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | | static void c16_common_driver_init (running_machine *machine) |
| 436 | static void c16_common_driver_init( running_machine *machine ) |
| 437 | 437 | { |
| 438 | 438 | UINT8 *rom; |
| 439 | 439 | |
| 440 | lowrom = 0; |
| 441 | highrom = 0; |
| 442 | |
| 440 | 443 | c16_select_roms (cputag_get_address_space(machine,"maincpu",ADDRESS_SPACE_PROGRAM), 0, 0); |
| 441 | 444 | c16_switch_to_rom (cputag_get_address_space(machine,"maincpu",ADDRESS_SPACE_PROGRAM), 0, 0); |
| 442 | 445 | |
| r5842 | r5843 | |
| 455 | 458 | memset(mess_ram + (0xfdc0 % mess_ram_size), 0xff, 0x40); |
| 456 | 459 | |
| 457 | 460 | memset(mess_ram + (0xfd40 % mess_ram_size), 0xff, 0x20); |
| 458 | | |
| 461 | |
| 459 | 462 | if (has_c1551) /* C1551 */ |
| 460 | 463 | c1551_config(machine, "cpu_c1551"); |
| 461 | 464 | |
| 462 | 465 | if (has_vc1541) /* VC1541 */ |
| 463 | | drive_config(machine, type_1541, 0, 0, "cpu_vc1540", 8); |
| 466 | cbm_drive_config(machine, type_1541, 0, 0, "cpu_vc1540", 8); |
| 464 | 467 | } |
| 465 | 468 | |
| 466 | | static void c16_driver_init(running_machine *machine) |
| 469 | static void c16_driver_init( running_machine *machine ) |
| 467 | 470 | { |
| 471 | int i; |
| 472 | |
| 468 | 473 | c16_common_driver_init(machine); |
| 469 | | ted7360_init(machine, (read_cfg1(machine) & 0x10 ) == 0x00); /* is it PAL? */ |
| 474 | |
| 475 | /* not sure this is the right place for this. ATM ted7360[] is shared by video and audio TED */ |
| 476 | for(i = 0; i < 0x20; i++) |
| 477 | ted7360[i] = 0x00; |
| 478 | ted7360_rom = 1; // FIX-ME: at start should be RAM or ROM? |
| 479 | |
| 480 | ted7360_init(machine, (read_cfg1(machine) & 0x10) == 0x00); /* is it PAL? */ |
| 470 | 481 | ted7360_set_dma(ted7360_dma_read, ted7360_dma_read_rom); |
| 471 | 482 | } |
| 472 | 483 | |
| 473 | 484 | |
| 474 | 485 | DRIVER_INIT( c16 ) |
| 475 | | { |
| 476 | | c16_driver_init(machine); |
| 486 | { |
| 487 | has_c1551 = 0; |
| 488 | has_vc1541 = 0; |
| 489 | has_iec8 = 0; |
| 490 | has_iec9 = 0; |
| 491 | c16_driver_init(machine); |
| 477 | 492 | } |
| 478 | 493 | |
| 479 | 494 | DRIVER_INIT( c16c ) |
| 480 | | { |
| 495 | { |
| 481 | 496 | has_c1551 = 1; |
| 482 | | c16_driver_init(machine); |
| 497 | has_vc1541 = 0; |
| 498 | has_iec8 = 0; |
| 499 | has_iec9 = 0; |
| 500 | c16_driver_init(machine); |
| 483 | 501 | } |
| 484 | 502 | |
| 485 | 503 | DRIVER_INIT( c16v ) |
| 486 | | { |
| 504 | { |
| 505 | has_c1551 = 0; |
| 487 | 506 | has_vc1541 = 1; |
| 488 | | c16_driver_init(machine); |
| 507 | has_iec8 = 0; |
| 508 | has_iec9 = 0; |
| 509 | c16_driver_init(machine); |
| 489 | 510 | } |
| 490 | 511 | |
| 491 | 512 | |
| r5842 | r5843 | |
| 493 | 514 | { |
| 494 | 515 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 495 | 516 | const device_config *sid = devtag_get_device(space->machine, "sid"); |
| 496 | | |
| 517 | |
| 497 | 518 | c364_speech_init(machine); |
| 498 | 519 | |
| 499 | 520 | if (read_cfg1(machine) & 0x80) /* SID card present */ |
| 500 | 521 | { |
| 501 | 522 | memory_install_read8_device_handler(space, sid, 0xfd40, 0xfd5f, 0, 0, sid6581_r); |
| 502 | | memory_install_write8_device_handler(space, sid, 0xfd40, 0xfd5f, 0, 0, sid6581_w); |
| 523 | memory_install_write8_device_handler(space, sid, 0xfd40, 0xfd5f, 0, 0, sid6581_w); |
| 503 | 524 | memory_install_read8_device_handler(space, sid, 0xfe80, 0xfe9f, 0, 0, sid6581_r); |
| 504 | | memory_install_write8_device_handler(space, sid, 0xfe80, 0xfe9f, 0, 0, sid6581_w); |
| 525 | memory_install_write8_device_handler(space, sid, 0xfe80, 0xfe9f, 0, 0, sid6581_w); |
| 505 | 526 | } |
| 506 | 527 | else |
| 507 | 528 | { |
| 508 | 529 | memory_install_read8_handler(space, 0xfd40, 0xfd5f, 0, 0, SMH_NOP); |
| 509 | | memory_install_write8_handler(space, 0xfd40, 0xfd5f, 0, 0, SMH_NOP); |
| 530 | memory_install_write8_handler(space, 0xfd40, 0xfd5f, 0, 0, SMH_NOP); |
| 510 | 531 | memory_install_read8_handler(space, 0xfe80, 0xfe9f, 0, 0, SMH_NOP); |
| 511 | | memory_install_write8_handler(space, 0xfe80, 0xfe9f, 0, 0, SMH_NOP); |
| 532 | memory_install_write8_handler(space, 0xfe80, 0xfe9f, 0, 0, SMH_NOP); |
| 512 | 533 | } |
| 513 | 534 | |
| 514 | 535 | #if 0 |
| 515 | 536 | c16_switch_to_rom (0, 0); |
| 516 | 537 | c16_select_roms (0, 0); |
| 517 | 538 | #endif |
| 518 | | if ((read_cfg1(machine) & 0x0c ) == 0x00) /* is it C16? */ |
| 539 | if ((read_cfg1(machine) & 0x0c) == 0x00) /* is it C16? */ |
| 519 | 540 | { |
| 520 | | memory_set_bankptr (machine, 1, mess_ram + (0x4000 % mess_ram_size)); |
| 541 | memory_set_bankptr(machine, 1, mess_ram + (0x4000 % mess_ram_size)); |
| 521 | 542 | |
| 522 | | memory_set_bankptr (machine, 5, mess_ram + (0x4000 % mess_ram_size)); |
| 523 | | memory_set_bankptr (machine, 6, mess_ram + (0x8000 % mess_ram_size)); |
| 524 | | memory_set_bankptr (machine, 7, mess_ram + (0xc000 % mess_ram_size)); |
| 543 | memory_set_bankptr(machine, 5, mess_ram + (0x4000 % mess_ram_size)); |
| 544 | memory_set_bankptr(machine, 6, mess_ram + (0x8000 % mess_ram_size)); |
| 545 | memory_set_bankptr(machine, 7, mess_ram + (0xc000 % mess_ram_size)); |
| 525 | 546 | |
| 526 | 547 | memory_install_write8_handler(space, 0xff20, 0xff3d, 0, 0, SMH_BANK(10)); |
| 527 | 548 | memory_install_write8_handler(space, 0xff40, 0xffff, 0, 0, SMH_BANK(11)); |
| 528 | | memory_set_bankptr (machine, 10, mess_ram + (0xff20 % mess_ram_size)); |
| 529 | | memory_set_bankptr (machine, 11, mess_ram + (0xff40 % mess_ram_size)); |
| 549 | memory_set_bankptr(machine, 10, mess_ram + (0xff20 % mess_ram_size)); |
| 550 | memory_set_bankptr(machine, 11, mess_ram + (0xff40 % mess_ram_size)); |
| 530 | 551 | |
| 531 | 552 | ted7360_set_dma (ted7360_dma_read, ted7360_dma_read_rom); |
| 532 | 553 | } |
| 533 | 554 | else |
| 534 | 555 | { |
| 535 | 556 | memory_install_write8_handler(space, 0x4000, 0xfcff, 0, 0, SMH_BANK(10)); |
| 536 | | memory_set_bankptr (machine, 10, mess_ram + (0x4000 % mess_ram_size)); |
| 557 | memory_set_bankptr(machine, 10, mess_ram + (0x4000 % mess_ram_size)); |
| 537 | 558 | |
| 538 | 559 | ted7360_set_dma (ted7360_dma_read, ted7360_dma_read_rom); |
| 539 | 560 | } |
| r5842 | r5843 | |
| 566 | 587 | } |
| 567 | 588 | if (has_vc1541) /* vc1541 */ |
| 568 | 589 | { |
| 569 | | drive_reset(); |
| 590 | cbm_drive_reset(machine); |
| 570 | 591 | } |
| 571 | 592 | else /* simulated drives */ |
| 572 | 593 | { |
| r5842 | r5843 | |
| 589 | 610 | |
| 590 | 611 | /* Shift Lock is mapped on Left/Right Shift */ |
| 591 | 612 | if ((i == 1) && (input_port_read(device->machine, "SPECIAL") & 0x80)) |
| 592 | | value &= ~0x80; |
| 613 | value &= ~0x80; |
| 593 | 614 | |
| 594 | 615 | keyline[i] = value; |
| 595 | 616 | } |
| 596 | 617 | |
| 597 | | if (input_port_read(device->machine, "DSW0") & 0x80) |
| 618 | if (input_port_read(device->machine, "DSW0") & 0x80) |
| 598 | 619 | { |
| 599 | 620 | value = 0xff; |
| 600 | 621 | if (input_port_read(device->machine, "JOY0") & 0x10) /* Joypad1_Button */ |
| r5842 | r5843 | |
| 613 | 634 | keyline[8] = value; |
| 614 | 635 | } |
| 615 | 636 | |
| 616 | | if (input_port_read(device->machine, "DSW0") & 0x40) |
| 637 | if (input_port_read(device->machine, "DSW0") & 0x40) |
| 617 | 638 | { |
| 618 | 639 | value = 0xff; |
| 619 | 640 | if (input_port_read(device->machine, "JOY1") & 0x10) /* Joypad2_Button */ |
| r5842 | r5843 | |
| 625 | 646 | } |
| 626 | 647 | |
| 627 | 648 | value &= ~(input_port_read(device->machine, "JOY1") & 0x0f); /* Other Inputs Joypad2 */ |
| 628 | | |
| 649 | |
| 629 | 650 | if (input_port_read(device->machine, "SPECIAL") & 0x40) |
| 630 | 651 | keyline[8] = value; |
| 631 | 652 | else |
| r5842 | r5843 | |
| 634 | 655 | |
| 635 | 656 | ted7360_frame_interrupt (device); |
| 636 | 657 | |
| 637 | | set_led_status (1, input_port_read(device->machine, "SPECIAL") & 0x80 ? 1 : 0); /* Shift Lock */ |
| 638 | | set_led_status (0, input_port_read(device->machine, "SPECIAL") & 0x40 ? 1 : 0); /* Joystick Swap */ |
| 658 | set_led_status(1, input_port_read(device->machine, "SPECIAL") & 0x80 ? 1 : 0); /* Shift Lock */ |
| 659 | set_led_status(0, input_port_read(device->machine, "SPECIAL") & 0x40 ? 1 : 0); /* Joystick Swap */ |
| 639 | 660 | } |
| 640 | 661 | |
| 641 | 662 | |
| 642 | 663 | /*********************************************** |
| 643 | 664 | |
| 644 | | C16 Cartridges |
| 665 | C16 Cartridges |
| 645 | 666 | |
| 646 | 667 | ***********************************************/ |
| 647 | 668 | |
| 648 | | static DEVICE_IMAGE_LOAD(c16_cart) |
| 669 | static DEVICE_IMAGE_LOAD( c16_cart ) |
| 649 | 670 | { |
| 650 | 671 | UINT8 *mem = memory_region(image->machine, "maincpu"); |
| 651 | | int size = image_length (image), test; |
| 672 | int size = image_length(image), test; |
| 652 | 673 | const char *filetype; |
| 653 | 674 | int address = 0; |
| 654 | 675 | |
| 655 | 676 | /* magic lowrom at offset 7: $43 $42 $4d */ |
| 656 | 677 | /* if at offset 6 stands 1 it will immediatly jumped to offset 0 (0x8000) */ |
| 657 | | static const unsigned char magic[] = {0x43, 0x42, 0x4d}; |
| 678 | static const unsigned char magic[] = {0x43, 0x42, 0x4d}; |
| 658 | 679 | unsigned char buffer[sizeof (magic)]; |
| 659 | 680 | |
| 660 | | image_fseek (image, 7, SEEK_SET); |
| 661 | | image_fread (image, buffer, sizeof (magic)); |
| 662 | | image_fseek (image, 0, SEEK_SET); |
| 681 | image_fseek(image, 7, SEEK_SET); |
| 682 | image_fread(image, buffer, sizeof (magic)); |
| 683 | image_fseek(image, 0, SEEK_SET); |
| 663 | 684 | |
| 664 | 685 | /* Check if our cart has the magic string, and set its loading address */ |
| 665 | | if (!memcmp (buffer, magic, sizeof (magic))) |
| 686 | if (!memcmp(buffer, magic, sizeof (magic))) |
| 666 | 687 | address = 0x20000; |
| 667 | | |
| 688 | |
| 668 | 689 | /* Give a loading address to non .bin / non .rom carts as well */ |
| 669 | 690 | filetype = image_filetype(image); |
| 670 | 691 | |
| 671 | | /* We would support .hi and .lo files, but currently I'm not sure where to load them. |
| 672 | | We simply load them at 0x20000 at this stage, even if it's probably wrong! |
| 673 | | It could also well be that they both need to be loaded at the same time, but this |
| 674 | | is now impossible since I reduced to 1 the number of cart slots. |
| 675 | | More investigations are in order if any .hi, .lo dump would surface! */ |
| 676 | | if (!mame_stricmp (filetype, "hi")) |
| 692 | /* We would support .hi and .lo files, but currently I'm not sure where to load them. |
| 693 | We simply load them at 0x20000 at this stage, even if it's probably wrong! |
| 694 | It could also well be that they both need to be loaded at the same time, but this |
| 695 | is now impossible since I reduced to 1 the number of cart slots. |
| 696 | More investigations are in order if any .hi, .lo dump would surface! */ |
| 697 | if (!mame_stricmp(filetype, "hi")) |
| 677 | 698 | address = 0x20000; /* FIX ME! */ |
| 678 | 699 | |
| 679 | | else if (!mame_stricmp (filetype, "lo")) |
| 700 | else if (!mame_stricmp(filetype, "lo")) |
| 680 | 701 | address = 0x20000; /* FIX ME! */ |
| 681 | 702 | |
| 682 | | /* As a last try, give a reasonable loading address also to .bin/.rom without the magic string */ |
| 703 | /* As a last try, give a reasonable loading address also to .bin/.rom without the magic string */ |
| 683 | 704 | else if (!address) |
| 684 | 705 | { |
| 685 | 706 | logerror("Cart %s does not contain the magic string: it may be loaded at the wrong memory address!\n", image_filename(image)); |
| r5842 | r5843 | |
| 689 | 710 | logerror("Loading cart %s at %.5x size:%.4x\n", image_filename(image), address, size); |
| 690 | 711 | |
| 691 | 712 | /* Finally load the cart */ |
| 692 | | test = image_fread (image, mem + address, size); |
| 713 | test = image_fread(image, mem + address, size); |
| 693 | 714 | |
| 694 | 715 | if (test != size) |
| 695 | 716 | return INIT_FAIL; |
| r5842 | r5843 | |
| 697 | 718 | return INIT_PASS; |
| 698 | 719 | } |
| 699 | 720 | |
| 700 | | MACHINE_DRIVER_START(c16_cartslot) |
| 721 | MACHINE_DRIVER_START( c16_cartslot ) |
| 701 | 722 | MDRV_CARTSLOT_ADD("cart") |
| 702 | 723 | MDRV_CARTSLOT_EXTENSION_LIST("bin,rom,hi,lo") |
| 703 | 724 | MDRV_CARTSLOT_NOT_MANDATORY |
src/mess/machine/cbmipt.c
| r5842 | r5843 | |
| 1 | 1 | /********************************************************************************** |
| 2 | 2 | * |
| 3 | | * machine/cbmipt.c |
| 4 | | * |
| 5 | | * Input port macros shared by various CBM computers |
| 3 | * machine/cbmipt.c |
| 6 | 4 | * |
| 5 | * Input port macros shared by various CBM computers |
| 7 | 6 | * |
| 8 | | * TO DO: |
| 9 | 7 | * |
| 10 | | * - investigate C128 input problem with Left Shift / Shift Lock |
| 11 | | * - investigate superpet different reading of Caps Lock (check machine/pet.c) |
| 12 | | * - move here lightpen inputs from vc20.c, eventually |
| 13 | | * - clean up the "SPECIAL" and "CFG" input ports (e.g. there a quite a lot |
| 14 | | * of settings that are not checked anymore! we have either to implement |
| 15 | | * the features properly or, if they're hacks, to remove them) |
| 8 | * TO DO: |
| 16 | 9 | * |
| 10 | * - investigate C128 input problem with Left Shift / Shift Lock |
| 11 | * - investigate superpet different reading of Caps Lock (check machine/pet.c) |
| 12 | * - move here lightpen inputs from vc20.c, eventually |
| 13 | * - clean up the "SPECIAL" and "CFG" input ports (e.g. there a quite a lot |
| 14 | * of settings that are not checked anymore! we have either to implement |
| 15 | * the features properly or, if they're hacks, to remove them) |
| 16 | * |
| 17 | 17 | *********************************************************************************/ |
| 18 | 18 | |
| 19 | 19 | #include "driver.h" |
| r5842 | r5843 | |
| 22 | 22 | |
| 23 | 23 | /***************************** Commodore 64 **************************************** |
| 24 | 24 | * |
| 25 | | * - common_cbm_keyboard: C64 keyboard; used by C16, C65 and C128 as well |
| 26 | | * - c64_special: input port for the Restore key and the Shift Lock Switch |
| 27 | | * - c64_controls: joypads, paddles and lightpen; shared with C65, C128 |
| 28 | | * and CBMB |
| 25 | * - common_cbm_keyboard: C64 keyboard; used by C16, C65 and C128 as well |
| 26 | * - c64_special: input port for the Restore key and the Shift Lock Switch |
| 27 | * - c64_controls: joypads, paddles and lightpen; shared with C65, C128 |
| 28 | * and CBMB |
| 29 | 29 | * |
| 30 | 30 | **********************************************************************************/ |
| 31 | 31 | |
| r5842 | r5843 | |
| 35 | 35 | ------------------- |
| 36 | 36 | |
| 37 | 37 | CLR INST |
| 38 | | <- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - £ HOME DEL f 1 |
| 38 | <- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - ? HOME DEL f 1 |
| 39 | 39 | |
| 40 | | |
| 40 | |
| 41 | 41 | CTRL Q W E R T Y U I O P @ * UP RESTORE f 3 |
| 42 | 42 | |
| 43 | 43 | RUN SHIFT |
| r5842 | r5843 | |
| 50 | 50 | SPACEBAR |
| 51 | 51 | |
| 52 | 52 | |
| 53 | | Notes: "C=" is a key with the Commodore logo, "UP" is an arrow pointing up, the "CRSR" keys at the |
| 54 | | bottom-right corner are used to move the cursor on screen (Up/Down and Left/Right resp.). |
| 53 | Notes: "C=" is a key with the Commodore logo, "UP" is an arrow pointing up, the "CRSR" keys at the |
| 54 | bottom-right corner are used to move the cursor on screen (Up/Down and Left/Right resp.). |
| 55 | 55 | */ |
| 56 | 56 | |
| 57 | 57 | |
| r5842 | r5843 | |
| 68 | 68 | |
| 69 | 69 | PORT_START( "ROW1" ) |
| 70 | 70 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 71 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 72 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 73 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 71 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 72 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 73 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 74 | 74 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 75 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 76 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 75 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 76 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 77 | 77 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 78 | 78 | |
| 79 | 79 | PORT_START( "ROW2" ) |
| 80 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 81 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 82 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 83 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 80 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 81 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 82 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 83 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 84 | 84 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 85 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 86 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 85 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 86 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 87 | 87 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 88 | 88 | |
| 89 | 89 | PORT_START( "ROW3" ) |
| 90 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 91 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 92 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 93 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 90 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 91 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 92 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 93 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 94 | 94 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 95 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 96 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 95 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 96 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 97 | 97 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| 98 | 98 | |
| 99 | 99 | PORT_START( "ROW4" ) |
| 100 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 101 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 102 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 103 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 104 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 105 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| 106 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 100 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 101 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 102 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 103 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 104 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 105 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| 106 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 107 | 107 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 108 | 108 | |
| 109 | 109 | PORT_START( "ROW5" ) |
| 110 | 110 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 111 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') |
| 111 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') |
| 112 | 112 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') |
| 113 | 113 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 114 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') |
| 115 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 116 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 117 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') |
| 114 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') |
| 115 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 116 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 117 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') |
| 118 | 118 | |
| 119 | 119 | PORT_START( "ROW6" ) |
| 120 | 120 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| r5842 | r5843 | |
| 127 | 127 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') |
| 128 | 128 | |
| 129 | 129 | PORT_START( "ROW7" ) |
| 130 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_HOME) |
| 131 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 132 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) |
| 133 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 130 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_HOME) |
| 131 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 132 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) |
| 133 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 134 | 134 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') |
| 135 | 135 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) |
| 136 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) |
| 136 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) |
| 137 | 137 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 138 | 138 | INPUT_PORTS_END |
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | INPUT_PORTS_START( c64_special ) |
| 142 | | PORT_START( "SPECIAL" ) /* special keys */ |
| 142 | PORT_START( "SPECIAL" ) /* special keys */ |
| 143 | 143 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) |
| 144 | 144 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 145 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 146 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 145 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 146 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 147 | 147 | INPUT_PORTS_END |
| 148 | 148 | |
| 149 | 149 | |
| r5842 | r5843 | |
| 155 | 155 | PORT_CATEGORY_ITEM( 0x02, "Mouse 1351", 12 ) |
| 156 | 156 | PORT_CATEGORY_ITEM( 0x03, "Mouse (Non Proportional) 1350", 13 ) |
| 157 | 157 | PORT_CATEGORY_ITEM( 0x04, "Lightpen", 14 ) |
| 158 | | // PORT_CATEGORY_ITEM( 0x05, "Koala Pad", 15 ) |
| 158 | // PORT_CATEGORY_ITEM( 0x05, "Koala Pad", 15 ) |
| 159 | 159 | PORT_CATEGORY_ITEM( 0x07, "No Device Connected", 17 ) |
| 160 | 160 | PORT_CATEGORY_CLASS( 0x70, 0x00, "Gameport B" ) |
| 161 | 161 | PORT_CATEGORY_ITEM( 0x00, DEF_STR( Joystick ), 20 ) |
| 162 | 162 | PORT_CATEGORY_ITEM( 0x10, "Paddles 3 & 4", 21 ) |
| 163 | | // PORT_CATEGORY_ITEM( 0x20, "Mouse 1351", 22 ) |
| 164 | | // PORT_CATEGORY_ITEM( 0x30, "Mouse (Non Proportional) 1350", 23 ) |
| 163 | // PORT_CATEGORY_ITEM( 0x20, "Mouse 1351", 22 ) |
| 164 | // PORT_CATEGORY_ITEM( 0x30, "Mouse (Non Proportional) 1350", 23 ) |
| 165 | 165 | PORT_CATEGORY_ITEM( 0x70, "No Device Connected", 27 ) |
| 166 | 166 | PORT_CONFNAME( 0x08, 0x00, "Workaround for RDY") |
| 167 | | PORT_CONFSETTING( 0x00, DEF_STR( No ) ) |
| 167 | PORT_CONFSETTING( 0x00, DEF_STR( No ) ) |
| 168 | 168 | PORT_CONFSETTING( 0x08, DEF_STR( Yes ) ) |
| 169 | 169 | PORT_CONFNAME( 0x80, 0x00, "Swap Gameport A and B") PORT_CODE(KEYCODE_F1) PORT_TOGGLE |
| 170 | | PORT_CONFSETTING( 0x00, DEF_STR( No ) ) |
| 170 | PORT_CONFSETTING( 0x00, DEF_STR( No ) ) |
| 171 | 171 | PORT_CONFSETTING( 0x80, DEF_STR( Yes ) ) |
| 172 | 172 | |
| 173 | 173 | PORT_START("JOY1_1B") |
| r5842 | r5843 | |
| 176 | 176 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10) |
| 177 | 177 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10) |
| 178 | 178 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CATEGORY(10) |
| 179 | | PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 179 | PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 180 | 180 | |
| 181 | | PORT_START("JOY2_1B") |
| 181 | PORT_START("JOY2_1B") |
| 182 | 182 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) |
| 183 | 183 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) |
| 184 | 184 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH) |
| 185 | 185 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) |
| 186 | 186 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CATEGORY(20) PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) |
| 187 | | PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 187 | PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 188 | 188 | |
| 189 | 189 | /* Mouse Commodore 1350 was basically working as a Joystick */ |
| 190 | 190 | PORT_START("JOY1_2B") |
| r5842 | r5843 | |
| 194 | 194 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Right") PORT_CATEGORY(13) |
| 195 | 195 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Mouse 1350 Button 1") PORT_CATEGORY(13) |
| 196 | 196 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Mouse 1350 Button 2") PORT_CATEGORY(13) |
| 197 | | PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 197 | PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 198 | 198 | |
| 199 | 199 | /* Still to verify how many mices you were able to plug into a c64 */ |
| 200 | 200 | /* Only one, for now */ |
| 201 | | PORT_START("JOY2_2B") |
| 202 | | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 203 | | /* PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) |
| 204 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) |
| 205 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH) |
| 206 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) |
| 207 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) |
| 208 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_PGUP) PORT_CODE(JOYCODE_BUTTON2) |
| 209 | | PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 201 | PORT_START("JOY2_2B") |
| 202 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 203 | /* PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) |
| 204 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) |
| 205 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH) |
| 206 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) |
| 207 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) |
| 208 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_PGUP) PORT_CODE(JOYCODE_BUTTON2) |
| 209 | PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 210 | 210 | */ |
| 211 | 211 | PORT_START("PADDLE1") |
| 212 | 212 | PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_CATEGORY(11) PORT_PLAYER(1) PORT_REVERSE |
| 213 | 213 | |
| 214 | | PORT_START("PADDLE2") |
| 214 | PORT_START("PADDLE2") |
| 215 | 215 | PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_DOWN) PORT_CODE_INC(KEYCODE_UP) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_CATEGORY(11) PORT_PLAYER(2) PORT_REVERSE |
| 216 | 216 | |
| 217 | | PORT_START("PADDLE3") |
| 217 | PORT_START("PADDLE3") |
| 218 | 218 | PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_HOME) PORT_CODE_INC(KEYCODE_PGUP) PORT_CATEGORY(21) PORT_PLAYER(3) PORT_REVERSE |
| 219 | 219 | |
| 220 | | PORT_START("PADDLE4") |
| 220 | PORT_START("PADDLE4") |
| 221 | 221 | PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_END) PORT_CODE_INC(KEYCODE_PGDN) PORT_CATEGORY(21) PORT_PLAYER(4) PORT_REVERSE |
| 222 | 222 | |
| 223 | | PORT_START("TRACKX") |
| 223 | PORT_START("TRACKX") |
| 224 | 224 | PORT_BIT( 0x7e, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_CATEGORY(12) |
| 225 | 225 | |
| 226 | | PORT_START("TRACKY") |
| 226 | PORT_START("TRACKY") |
| 227 | 227 | PORT_BIT( 0x7e, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_CATEGORY(12) PORT_REVERSE |
| 228 | 228 | |
| 229 | | PORT_START("LIGHTX") |
| 229 | PORT_START("LIGHTX") |
| 230 | 230 | PORT_BIT( 0x7e, 0x00, IPT_TRACKBALL_X) PORT_NAME("Lightpen X Axis") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(2) PORT_PLAYER(1) PORT_CATEGORY(14) |
| 231 | | /* PORT_BIT( 0x1ff,0,IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(2) PORT_MINMAX(0,320-1) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) */ |
| 231 | /* PORT_BIT( 0x1ff,0,IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(2) PORT_MINMAX(0,320-1) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) */ |
| 232 | 232 | |
| 233 | | PORT_START("LIGHTY") |
| 233 | PORT_START("LIGHTY") |
| 234 | 234 | PORT_BIT( 0x7e, 0x00, IPT_TRACKBALL_Y) PORT_NAME("Lightpen Y Axis") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(2) PORT_PLAYER(1) PORT_CATEGORY(14) |
| 235 | | /* PORT_BIT( 0xff,0,IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(2) PORT_MINMAX(0,200-1) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) */ |
| 235 | /* PORT_BIT( 0xff,0,IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(2) PORT_MINMAX(0,200-1) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) */ |
| 236 | 236 | |
| 237 | 237 | PORT_START("OTHER") |
| 238 | 238 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Paddle 1 Button") PORT_CATEGORY(11) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) |
| r5842 | r5843 | |
| 247 | 247 | |
| 248 | 248 | /***************************** Commodore 16 **************************************** |
| 249 | 249 | * |
| 250 | | * - C16 shares Keyboard with C64 (only few changes, see c16.c) |
| 251 | | * - c16_special: input port for the Shift Lock Switch |
| 252 | | * - c16_controls: control inputs |
| 253 | | * - c16_config: control and devices configurations |
| 250 | * - C16 shares Keyboard with C64 (only few changes, see c16.c) |
| 251 | * - c16_special: input port for the Shift Lock Switch |
| 252 | * - c16_controls: control inputs |
| 253 | * - c16_config: control and devices configurations |
| 254 | 254 | * |
| 255 | 255 | **********************************************************************************/ |
| 256 | 256 | |
| r5842 | r5843 | |
| 261 | 261 | |
| 262 | 262 | INST |
| 263 | 263 | ESC 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0^ LEFT RIGHT UP DOWN DEL f 1 |
| 264 | | |
| 264 | |
| 265 | 265 | CLEAR |
| 266 | 266 | CTRL Q W E R T Y U I O P @ + - HOME f 3 |
| 267 | | |
| 267 | |
| 268 | 268 | RUN SHIFT |
| 269 | 269 | STOP LOCK A S D F G H J K L :[ ;] * RETURN f 5 |
| 270 | | |
| 271 | | |
| 272 | | C= SHIFT Z X C V B N M ,< .> /? SHIFT £ = HELP |
| 273 | | |
| 274 | | |
| 270 | |
| 271 | |
| 272 | C= SHIFT Z X C V B N M ,< .> /? SHIFT ? = HELP |
| 273 | |
| 274 | |
| 275 | 275 | SPACEBAR |
| 276 | 276 | |
| 277 | 277 | |
| 278 | | Notes: "C=" is a key with the Commodore logo, Shift+0 produces an arrow pointing up (''^'' above). |
| 278 | Notes: "C=" is a key with the Commodore logo, Shift+0 produces an arrow pointing up (''^'' above). |
| 279 | 279 | |
| 280 | 280 | C116 Keyboard Layout |
| 281 | 281 | -------------------- |
| 282 | 282 | |
| 283 | 283 | F1/F4 F2/F5 F3/F6 HELP/F7 HOME/CLEAR DEL/INST |
| 284 | | |
| 285 | | |
| 286 | | ESC 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0^ + - * |
| 287 | | |
| 288 | | |
| 284 | |
| 285 | |
| 286 | ESC 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0^ + - * |
| 287 | |
| 288 | |
| 289 | 289 | CONTROL Q W E R T Y U I O P @ RETURN |
| 290 | | |
| 291 | | RUN |
| 292 | | STOP £ A S D F G H J K L :[ ;] = |
| 293 | | |
| 294 | | |
| 290 | |
| 291 | RUN |
| 292 | STOP ?? A S D F G H J K L :[ ;] = |
| 293 | |
| 294 | |
| 295 | 295 | C= SHIFT Z X C V B N M ,< .> /? SHIFT |
| 296 | | UP |
| 297 | | LEFT RIGHT |
| 296 | UP |
| 297 | LEFT RIGHT |
| 298 | 298 | SPACEBAR DOWN |
| 299 | 299 | |
| 300 | 300 | |
| r5842 | r5843 | |
| 302 | 302 | ----------------------------------- |
| 303 | 303 | |
| 304 | 304 | F1/F4 F2/F5 F3/F6 HELP/F7 |
| 305 | | |
| 305 | |
| 306 | 306 | CLEAR INST |
| 307 | 307 | ESC 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0^ + - = HOME DEL || @ + - = |
| 308 | 308 | || |
| 309 | 309 | || |
| 310 | | CONTROL Q W E R T Y U I O P @ £ * CONTROL || 7 8 9 * |
| 310 | CONTROL Q W E R T Y U I O P @ ? * CONTROL || 7 8 9 * |
| 311 | 311 | || |
| 312 | 312 | RUN SHIFT || |
| 313 | 313 | STOP LOCK A S D F G H J K L :[ ;] RETURN || 4 5 6 / |
| r5842 | r5843 | |
| 318 | 318 | LEFT RIGHT || e |
| 319 | 319 | SPACEBAR DOWN || 0 . : r |
| 320 | 320 | |
| 321 | | The 19-keys keypad on the left was present only in the 364 prototype (but probably those |
| 321 | The 19-keys keypad on the left was present only in the 364 prototype (but probably those |
| 322 | 322 | keys were simply wired to the lines of regular number keys of the keyboard). |
| 323 | 323 | |
| 324 | 324 | */ |
| 325 | 325 | |
| 326 | 326 | INPUT_PORTS_START( c16_special ) |
| 327 | | PORT_START("SPECIAL") |
| 327 | PORT_START("SPECIAL") |
| 328 | 328 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| 329 | 329 | PORT_CONFNAME( 0x40, 0x00, "Swap Gameport 1 and 2") PORT_CODE(KEYCODE_F1) PORT_TOGGLE |
| 330 | | PORT_CONFSETTING( 0x00, DEF_STR( No ) ) |
| 330 | PORT_CONFSETTING( 0x00, DEF_STR( No ) ) |
| 331 | 331 | PORT_CONFSETTING( 0x40, DEF_STR( Yes ) ) |
| 332 | 332 | INPUT_PORTS_END |
| 333 | 333 | |
| 334 | 334 | |
| 335 | 335 | INPUT_PORTS_START( c16_controls ) |
| 336 | | PORT_START("JOY0") |
| 337 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_8WAY |
| 338 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_8WAY |
| 339 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_8WAY |
| 340 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_8WAY |
| 341 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) |
| 336 | PORT_START("JOY0") |
| 337 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_8WAY |
| 338 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_8WAY |
| 339 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_8WAY |
| 340 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_8WAY |
| 341 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) |
| 342 | 342 | |
| 343 | | PORT_START("JOY1") |
| 344 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_NAME("P2 Up") PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_8WAY PORT_PLAYER(2) |
| 345 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_NAME("P2 Down") PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_8WAY PORT_PLAYER(2) |
| 346 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("P2 Left") PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH ) PORT_8WAY PORT_PLAYER(2) |
| 347 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("P2 Right") PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH ) PORT_8WAY PORT_PLAYER(2) |
| 348 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P2 Button") PORT_CODE(KEYCODE_LALT) PORT_CODE(JOYCODE_BUTTON1 ) PORT_PLAYER(2) |
| 343 | PORT_START("JOY1") |
| 344 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_NAME("P2 Up") PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_8WAY PORT_PLAYER(2) |
| 345 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_NAME("P2 Down") PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_8WAY PORT_PLAYER(2) |
| 346 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("P2 Left") PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH ) PORT_8WAY PORT_PLAYER(2) |
| 347 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("P2 Right") PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH ) PORT_8WAY PORT_PLAYER(2) |
| 348 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P2 Button") PORT_CODE(KEYCODE_LALT) PORT_CODE(JOYCODE_BUTTON1 ) PORT_PLAYER(2) |
| 349 | 349 | INPUT_PORTS_END |
| 350 | 350 | |
| 351 | 351 | |
| 352 | 352 | INPUT_PORTS_START( c16_config ) |
| 353 | 353 | PORT_START("DSW0") |
| 354 | | PORT_DIPNAME( 0x80, 0x80, "Joystick 1") |
| 355 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 356 | | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 357 | | PORT_DIPNAME( 0x40, 0x40, "Joystick 2") |
| 358 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 359 | | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 354 | PORT_DIPNAME( 0x80, 0x80, "Joystick 1") |
| 355 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 356 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 357 | PORT_DIPNAME( 0x40, 0x40, "Joystick 2") |
| 358 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 359 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 360 | 360 | PORT_DIPNAME( 0x20, 0x20, "Tape Drive / Device 1") |
| 361 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 362 | | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 363 | | PORT_DIPNAME( 0x10, 0x00, "Tape Sound") |
| 364 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 365 | | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) |
| 361 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 362 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 363 | PORT_DIPNAME( 0x10, 0x00, "Tape Sound") |
| 364 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 365 | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) |
| 366 | 366 | |
| 367 | 367 | PORT_START("CFG1") |
| 368 | | PORT_DIPNAME( 0x80, 0x80, "Sidcard") |
| 369 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 370 | | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 368 | PORT_DIPNAME( 0x80, 0x80, "Sidcard") |
| 369 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 370 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 371 | 371 | PORT_BIT( 0x40, 0x00, IPT_UNUSED ) /* 2008-05 FP: removed the SID card hack cfg */ |
| 372 | | PORT_BIT( 0x10, 0x00, IPT_UNUSED ) /* pal */ |
| 372 | PORT_BIT( 0x10, 0x00, IPT_UNUSED ) /* pal */ |
| 373 | 373 | PORT_BIT( 0x0c, 0x00, IPT_UNUSED ) /* c16 */ |
| 374 | 374 | INPUT_PORTS_END |
| 375 | 375 | |
| 376 | 376 | |
| 377 | 377 | /***************************** Commodore 128 *************************************** |
| 378 | 378 | * |
| 379 | | * - C128 shares Controls and Keyboard with C64 (+ a keypad, see c128.c) |
| 380 | | * - c128_special: input port for the Restore key and the Shift Lock, |
| 381 | | * TV/RGBI and 40/80 columns switches |
| 379 | * - C128 shares Controls and Keyboard with C64 (+ a keypad, see c128.c) |
| 380 | * - c128_special: input port for the Restore key and the Shift Lock, |
| 381 | * TV/RGBI and 40/80 columns switches |
| 382 | 382 | * |
| 383 | 383 | **********************************************************************************/ |
| 384 | 384 | |
| r5842 | r5843 | |
| 390 | 390 | |
| 391 | 391 | CAPS LINE 40/80 NO |
| 392 | 392 | ESC TAB ALT LOCK HELP FEED DISPLAY SCROLL UP DOWN LEFT RIGHT F1 F3 F5 F7 |
| 393 | | |
| 393 | |
| 394 | 394 | CLR INST |
| 395 | | <- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - £ HOME DEL 7 8 9 + |
| 396 | | |
| 397 | | |
| 395 | <- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - ? HOME DEL 7 8 9 + |
| 396 | |
| 397 | |
| 398 | 398 | CONTROL Q W E R T Y U I O P @ * UP RESTORE 4 5 6 - |
| 399 | | |
| 399 | |
| 400 | 400 | RUN SHIFT E |
| 401 | 401 | STOP LOCK A S D F G H J K L :[ ;] = RETURN 1 2 3 n |
| 402 | 402 | t |
| 403 | 403 | CRSR CRSR e |
| 404 | 404 | C= SHIFT Z X C V B N M ,< .> /? SHIFT U/D L/R 0 . r |
| 405 | | |
| 406 | | |
| 405 | |
| 406 | |
| 407 | 407 | SPACEBAR |
| 408 | 408 | |
| 409 | | Notes: "C=" is a key with the Commodore logo, "UP" is an arrow pointing up, the "CRSR" keys at the bottom-right |
| 410 | | corner are used to move the cursor on screen (Up/Down and Left/Right resp.). |
| 409 | Notes: "C=" is a key with the Commodore logo, "UP" is an arrow pointing up, the "CRSR" keys at the bottom-right |
| 410 | corner are used to move the cursor on screen (Up/Down and Left/Right resp.). |
| 411 | 411 | |
| 412 | 412 | */ |
| 413 | 413 | |
| 414 | 414 | INPUT_PORTS_START( c128_special ) |
| 415 | | PORT_START( "SPECIAL" ) /* special keys */ |
| 416 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) |
| 415 | PORT_START( "SPECIAL" ) /* special keys */ |
| 416 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) |
| 417 | 417 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 418 | | PORT_DIPNAME( 0x20, 0x00, "Caps Lock (switch)") |
| 419 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 420 | | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 421 | | PORT_DIPNAME( 0x10, 0x10, "40 80 Display (switch) (active after a rebooting)") |
| 422 | | PORT_DIPSETTING( 0x00, "40 Columns (DIN/TV)") |
| 418 | PORT_DIPNAME( 0x20, 0x00, "Caps Lock (switch)") |
| 419 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 420 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 421 | PORT_DIPNAME( 0x10, 0x10, "40 80 Display (switch) (active after a rebooting)") |
| 422 | PORT_DIPSETTING( 0x00, "40 Columns (DIN/TV)") |
| 423 | 423 | PORT_DIPSETTING( 0x10, "80 Columns (RGBI)") |
| 424 | 424 | PORT_DIPNAME( 0x08, 0x08, "DIN,TV / RGBI Monitor (switch)") PORT_CODE(KEYCODE_ENTER_PAD) |
| 425 | | PORT_DIPSETTING( 0x00, "DIN,TV" ) |
| 426 | | PORT_DIPSETTING( 0x08, "RGBI" ) |
| 425 | PORT_DIPSETTING( 0x00, "DIN,TV" ) |
| 426 | PORT_DIPSETTING( 0x08, "RGBI" ) |
| 427 | 427 | PORT_DIPNAME( 0x06, 0x00, "Main Memory / MMU Version") |
| 428 | 428 | PORT_DIPSETTING( 0x00, "128 KByte" ) |
| 429 | 429 | PORT_DIPSETTING( 0x02, "256 KByte" ) |
| r5842 | r5843 | |
| 433 | 433 | |
| 434 | 434 | /***************************** Commodore 65 **************************************** |
| 435 | 435 | * |
| 436 | | * - C65 shares Keyboard and Inputs with C64 (+ some function keys, see c65.c) |
| 437 | | * - c65_special: input port for the Restore key and the Shift Lock and DIN |
| 438 | | * switches |
| 436 | * - C65 shares Keyboard and Inputs with C64 (+ some function keys, see c65.c) |
| 437 | * - c65_special: input port for the Restore key and the Shift Lock and DIN |
| 438 | * switches |
| 439 | 439 | * |
| 440 | 440 | **********************************************************************************/ |
| 441 | 441 | |
| r5842 | r5843 | |
| 446 | 446 | |
| 447 | 447 | RUN CAPS NO |
| 448 | 448 | STOP ESC ALT LOCK SCROLL F1 F3 F5 F7 F9 F11 F13 HELP |
| 449 | | |
| 449 | |
| 450 | 450 | CLR INST |
| 451 | | <- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - £ HOME DEL |
| 452 | | |
| 453 | | |
| 451 | <- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - ?? HOME DEL |
| 452 | |
| 453 | |
| 454 | 454 | TAB Q W E R T Y U I O P @ * UP RESTORE |
| 455 | | |
| 455 | |
| 456 | 456 | SHIFT |
| 457 | 457 | CTRL LOCK A S D F G H J K L :[ ;] = RETURN |
| 458 | 458 | |
| 459 | 459 | |
| 460 | 460 | C= SHIFT Z X C V B N M ,< .> /? SHIFT UP |
| 461 | | |
| 462 | | |
| 461 | |
| 462 | |
| 463 | 463 | SPACEBAR LEFT DOWN RIGHT |
| 464 | 464 | |
| 465 | 465 | Notes: "C=" is a key with the Commodore logo, "UP" is an arrow pointing up. |
| 466 | 466 | |
| 467 | 467 | */ |
| 468 | 468 | INPUT_PORTS_START( c65_special ) |
| 469 | | PORT_START( "SPECIAL" ) /* special keys */ |
| 470 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) |
| 469 | PORT_START( "SPECIAL" ) /* special keys */ |
| 470 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) |
| 471 | 471 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) |
| 472 | | PORT_DIPNAME( 0x20, 0x00, "(C65) Caps Lock (switch)") PORT_CODE(KEYCODE_F3) |
| 473 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 474 | | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 475 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 472 | PORT_DIPNAME( 0x20, 0x00, "(C65) Caps Lock (switch)") PORT_CODE(KEYCODE_F3) |
| 473 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 474 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 475 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 476 | 476 | INPUT_PORTS_END |
| 477 | 477 | |
| 478 | 478 | |
| 479 | 479 | /***************************** Commodore Pet *************************************** |
| 480 | 480 | * |
| 481 | | * - pet_keyboard: original keyboard used by PET2001 |
| 482 | | * - pet_business_keyboard: business keyboard is used by the other computers |
| 483 | | * in pet.c |
| 484 | | * - pet_special: input port for the Shift Lock Switch |
| 485 | | * - pet_config: memory and serial port configurations |
| 481 | * - pet_keyboard: original keyboard used by PET2001 |
| 482 | * - pet_business_keyboard: business keyboard is used by the other computers |
| 483 | * in pet.c |
| 484 | * - pet_special: input port for the Shift Lock Switch |
| 485 | * - pet_config: memory and serial port configurations |
| 486 | 486 | * |
| 487 | 487 | **********************************************************************************/ |
| 488 | 488 | |
| r5842 | r5843 | |
| 493 | 493 | |
| 494 | 494 | CLR CRSR CRSR INST |
| 495 | 495 | @ ! " # $ % ' & \ ( ) <- [ ] HOME U/D L/R DEL |
| 496 | | |
| 496 | |
| 497 | 497 | RVS |
| 498 | 498 | OFF Q W E R T Y U I O P UP < > 7 8 9 / |
| 499 | 499 | |
| 500 | 500 | SHIFT STOP |
| 501 | 501 | LOCK A S D F G H J K L : RUN RETURN 4 5 6 * |
| 502 | | |
| 503 | | |
| 502 | |
| 503 | |
| 504 | 504 | SHIFT Z X C V B N M , ; ? SHIFT 1 2 3 + |
| 505 | | |
| 506 | | |
| 505 | |
| 506 | |
| 507 | 507 | SPACEBAR 0 . - = |
| 508 | 508 | |
| 509 | 509 | |
| 510 | | The PET Keypad has 16 keys, making impossible to map it in a satisfactory way to a PC keypad. |
| 511 | | Therefore, default settings for these keys in Full Emulation are currently based on the effect |
| 510 | The PET Keypad has 16 keys, making impossible to map it in a satisfactory way to a PC keypad. |
| 511 | Therefore, default settings for these keys in Full Emulation are currently based on the effect |
| 512 | 512 | of the key and not on their real position |
| 513 | 513 | |
| 514 | 514 | |
| r5842 | r5843 | |
| 521 | 521 | CRSR DEL |
| 522 | 522 | TAB Q W E R T Y U I O P [ \ U/D INST 4 5 6 |
| 523 | 523 | |
| 524 | | SHIFT |
| 524 | SHIFT |
| 525 | 525 | ESC LOCK A S D F G H J K L ;+ @ ] RETURN 1 2 3 |
| 526 | 526 | |
| 527 | 527 | RVS HOME |
| r5842 | r5843 | |
| 535 | 535 | INPUT_PORTS_START( pet_keyboard ) |
| 536 | 536 | PORT_START( "ROW0" ) |
| 537 | 537 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 538 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clr Screen") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 538 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clr Screen") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 539 | 539 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0x2190) |
| 540 | 540 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('(') |
| 541 | 541 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('&') |
| r5842 | r5843 | |
| 545 | 545 | |
| 546 | 546 | PORT_START( "ROW1" ) |
| 547 | 547 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Inst") PORT_CODE(KEYCODE_DEL) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) |
| 548 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 548 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 549 | 549 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 550 | 550 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR(')') |
| 551 | 551 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('\\') |
| r5842 | r5843 | |
| 557 | 557 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR('9') |
| 558 | 558 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR('7') |
| 559 | 559 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) |
| 560 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 561 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 562 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 563 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 564 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 560 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 561 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 562 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 563 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 564 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 565 | 565 | |
| 566 | 566 | PORT_START( "ROW3" ) |
| 567 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') |
| 567 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR('/') |
| 568 | 568 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR('8') |
| 569 | 569 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 570 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 571 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 572 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 573 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 574 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 570 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 571 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 572 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 573 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 574 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 575 | 575 | |
| 576 | 576 | PORT_START( "ROW4" ) |
| 577 | 577 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR('6') |
| 578 | 578 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR('4') |
| 579 | 579 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 580 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 581 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| 582 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 583 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 584 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 580 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 581 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| 582 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 583 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 584 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 585 | 585 | |
| 586 | 586 | PORT_START( "ROW5" ) |
| 587 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') |
| 587 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') |
| 588 | 588 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR('5') |
| 589 | 589 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 590 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') |
| 591 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 592 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 593 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 594 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 590 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') |
| 591 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 592 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 593 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 594 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 595 | 595 | |
| 596 | 596 | PORT_START( "ROW6" ) |
| 597 | 597 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR('3') |
| 598 | 598 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR('1') |
| 599 | 599 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 600 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR(';') |
| 601 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 602 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 603 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 604 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 600 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR(';') |
| 601 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 602 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 603 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 604 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 605 | 605 | |
| 606 | 606 | PORT_START( "ROW7" ) |
| 607 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') |
| 607 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR('+') |
| 608 | 608 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR('2') |
| 609 | 609 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 610 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') |
| 611 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') |
| 612 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 613 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 614 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 610 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('?') |
| 611 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') |
| 612 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 613 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 614 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 615 | 615 | |
| 616 | 616 | PORT_START( "ROW8" ) |
| 617 | 617 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR('-') |
| 618 | 618 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR('0') |
| 619 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 620 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('>') |
| 619 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 620 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('>') |
| 621 | 621 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 622 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(']') |
| 623 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') |
| 622 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(']') |
| 623 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') |
| 624 | 624 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) |
| 625 | 625 | |
| 626 | 626 | PORT_START( "ROW9" ) |
| 627 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR('=') |
| 627 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad =") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR('=') |
| 628 | 628 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR('.') |
| 629 | 629 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 630 | 630 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_QUOTE) |
| 631 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('<') |
| 632 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 633 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('[') |
| 631 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('<') |
| 632 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 633 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('[') |
| 634 | 634 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Rvs Off") PORT_CODE(KEYCODE_TAB) |
| 635 | 635 | INPUT_PORTS_END |
| 636 | 636 | |
| r5842 | r5843 | |
| 640 | 640 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 641 | 641 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 642 | 642 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_PGUP) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 643 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 643 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 644 | 644 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') |
| 645 | 645 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('\\') |
| 646 | 646 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 647 | 647 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') |
| 648 | 648 | |
| 649 | 649 | PORT_START( "ROW1" ) |
| 650 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 650 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 651 | 651 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 652 | 652 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x2191) |
| 653 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 654 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 653 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 654 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 655 | 655 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') |
| 656 | 656 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| 657 | 657 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 658 | 658 | |
| 659 | 659 | PORT_START( "ROW2" ) |
| 660 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 660 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 661 | 661 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') |
| 662 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 663 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') |
| 664 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 665 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 666 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 667 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 662 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 663 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') |
| 664 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 665 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 666 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 667 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 668 | 668 | |
| 669 | 669 | PORT_START( "ROW3" ) |
| 670 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 671 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') |
| 672 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 670 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 671 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') |
| 672 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 673 | 673 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 674 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| 675 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 676 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 677 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 674 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| 675 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 676 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 677 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 678 | 678 | |
| 679 | 679 | PORT_START( "ROW4" ) |
| 680 | 680 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Inst") PORT_CODE(KEYCODE_DEL) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) |
| 681 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 682 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 683 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') |
| 684 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 685 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 686 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 681 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 682 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 683 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') |
| 684 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 685 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 686 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 687 | 687 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') |
| 688 | 688 | |
| 689 | 689 | PORT_START( "ROW5" ) |
| 690 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 691 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') |
| 692 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 693 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 694 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 695 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 696 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 697 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 690 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 691 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') |
| 692 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 693 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_PGDN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 694 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 695 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 696 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 697 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 698 | 698 | |
| 699 | 699 | PORT_START( "ROW6" ) |
| 700 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 701 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 700 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 701 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 702 | 702 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 703 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 703 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 704 | 704 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 705 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 706 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 705 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 706 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 707 | 707 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) |
| 708 | 708 | |
| 709 | 709 | PORT_START( "ROW7" ) |
| 710 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 710 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 711 | 711 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Repeat") PORT_CODE(KEYCODE_LALT) |
| 712 | 712 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 713 | 713 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') |
| 714 | 714 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 715 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 716 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 717 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 715 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 716 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 717 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 718 | 718 | |
| 719 | 719 | PORT_START( "ROW8" ) |
| 720 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 720 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 721 | 721 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 722 | 722 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 723 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clr Screen") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 724 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 725 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 726 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 723 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clr Screen") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 724 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 725 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 726 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 727 | 727 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Rvs Off") PORT_CODE(KEYCODE_INSERT) |
| 728 | 728 | |
| 729 | 729 | PORT_START( "ROW9" ) |
| r5842 | r5843 | |
| 739 | 739 | |
| 740 | 740 | |
| 741 | 741 | INPUT_PORTS_START( pet_special ) |
| 742 | | PORT_START( "SPECIAL" ) /* Special keys */ |
| 742 | PORT_START( "SPECIAL" ) /* Special keys */ |
| 743 | 743 | PORT_DIPNAME( 0x80, 0x00, "Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| 744 | | PORT_DIPSETTING(0x00, DEF_STR( Off ) ) |
| 744 | PORT_DIPSETTING(0x00, DEF_STR( Off ) ) |
| 745 | 745 | PORT_DIPSETTING(0x80, DEF_STR( On ) ) |
| 746 | 746 | INPUT_PORTS_END |
| 747 | 747 | |
| 748 | 748 | |
| 749 | 749 | INPUT_PORTS_START( pet_config ) |
| 750 | 750 | PORT_START("CFG") |
| 751 | | PORT_DIPNAME( 0x180, 0x180, "Memory") |
| 752 | | PORT_DIPSETTING( 0x000, "4 KByte" ) |
| 753 | | PORT_DIPSETTING( 0x080, "8 KByte" ) |
| 754 | | PORT_DIPSETTING( 0x100, "16 KByte" ) |
| 755 | | PORT_DIPSETTING( 0x180, "32 KByte" ) |
| 756 | | PORT_BIT( 0x08, 0x00, IPT_UNUSED ) /* no 8096 hardware */ |
| 751 | PORT_DIPNAME( 0x180, 0x180, "Memory") |
| 752 | PORT_DIPSETTING( 0x000, "4 KByte" ) |
| 753 | PORT_DIPSETTING( 0x080, "8 KByte" ) |
| 754 | PORT_DIPSETTING( 0x100, "16 KByte" ) |
| 755 | PORT_DIPSETTING( 0x180, "32 KByte" ) |
| 756 | PORT_BIT( 0x08, 0x00, IPT_UNUSED ) /* no 8096 hardware */ |
| 757 | 757 | PORT_BIT( 0x04, 0x00, IPT_UNUSED ) /* no superpet switch */ |
| 758 | 758 | PORT_DIPNAME( 0x02, 0x02, "IEEE488 Bus/Dev 8/Floppy Sim") |
| 759 | | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 760 | | PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) |
| 759 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 760 | PORT_DIPSETTING( 0x02, DEF_STR( Yes ) ) |
| 761 | 761 | PORT_DIPNAME( 0x01, 0x00, "IEEE488 Bus/Dev 9/Floppy Sim") |
| 762 | | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 762 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 763 | 763 | PORT_DIPSETTING( 0x01, DEF_STR( Yes ) ) |
| 764 | 764 | INPUT_PORTS_END |
| 765 | 765 | |
| r5842 | r5843 | |
| 767 | 767 | |
| 768 | 768 | /***************************** Commodore CBMB ************************************** |
| 769 | 769 | * |
| 770 | | * - CBMB machines share Controls (in particular Lightpen) with C64 |
| 771 | | * - cbmb_keyboard: Keyboard used by all the models of this series |
| 772 | | * - cbmb_special: input port for the Shift Lock Switch |
| 770 | * - CBMB machines share Controls (in particular Lightpen) with C64 |
| 771 | * - cbmb_keyboard: Keyboard used by all the models of this series |
| 772 | * - cbmb_special: input port for the Shift Lock Switch |
| 773 | 773 | * |
| 774 | 774 | **********************************************************************************/ |
| 775 | 775 | |
| r5842 | r5843 | |
| 779 | 779 | --------------------------------------------------------- |
| 780 | 780 | |
| 781 | 781 | F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 DOWN UP LEFT RIGHT HOME/CLEAR DEL/INST |
| 782 | | |
| 783 | | INS |
| 784 | | ESC 1! 2" 3# 4$ 5% 6^ 7& 8* 9( 0) - =+ <-£ DEL ? CE . / |
| 785 | | |
| 786 | | ________ |
| 782 | |
| 783 | INS |
| 784 | ESC 1! 2" 3# 4$ 5% 6^ 7& 8* 9( 0) - =+ <-? DEL ? CE . / |
| 785 | |
| 786 | ________ |
| 787 | 787 | TAB Q W E R T Y U I O P [ ] | RETURN | 7 8 9 - |
| 788 | 788 | |__ | |
| 789 | | SHIFT | | |
| 790 | | LOCK A S D F G H J K L ;: '" Pi | | 4 5 6 + |
| 791 | | |_____| |
| 789 | SHIFT | | |
| 790 | LOCK A S D F G H J K L ;: '" Pi | | 4 5 6 + |
| 791 | |_____| |
| 792 | 792 | E |
| 793 | 793 | SHIFT Z X C V B N M ,< .> /? SHIFT C= 1 2 3 n |
| 794 | 794 | t |
| 795 | | e |
| 795 | e |
| 796 | 796 | CTRL SPACEBAR 0 . 00 r |
| 797 | 797 | |
| 798 | 798 | |
| 799 | | Notes: "C=" is a key with the Commodore logo, Shift+6 produces an arrow pointing up ("^" above). |
| 799 | Notes: "C=" is a key with the Commodore logo, Shift+6 produces an arrow pointing up ("^" above). |
| 800 | 800 | |
| 801 | 801 | |
| 802 | 802 | */ |
| r5842 | r5843 | |
| 807 | 807 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RVS Off") PORT_CODE(KEYCODE_HOME) |
| 808 | 808 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Graph Norm") PORT_CODE(KEYCODE_PGUP) |
| 809 | 809 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Home Clr") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 810 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 811 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| 810 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 811 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) |
| 812 | 812 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10)) |
| 813 | 813 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9)) |
| 814 | 814 | |
| r5842 | r5843 | |
| 823 | 823 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) |
| 824 | 824 | |
| 825 | 825 | PORT_START("ROW2") |
| 826 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) |
| 827 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) |
| 826 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) |
| 827 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) |
| 828 | 828 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad CE") PORT_CODE(KEYCODE_NUMLOCK) |
| 829 | 829 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad ?") PORT_CODE(KEYCODE_END) |
| 830 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 830 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 831 | 831 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') |
| 832 | 832 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') |
| 833 | 833 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(') |
| r5842 | r5843 | |
| 843 | 843 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) |
| 844 | 844 | |
| 845 | 845 | PORT_START("ROW4") |
| 846 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 847 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 848 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 849 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 850 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 846 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 847 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) |
| 848 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| 849 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) |
| 850 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) |
| 851 | 851 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90 \xC2\xA3") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) PORT_CHAR('\xA3') |
| 852 | 852 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') |
| 853 | 853 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') |
| r5842 | r5843 | |
| 863 | 863 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') |
| 864 | 864 | |
| 865 | 865 | PORT_START("ROW6") |
| 866 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 867 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 868 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 869 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 866 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 867 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) |
| 868 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) |
| 869 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 870 | 870 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del Ins") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) |
| 871 | 871 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') |
| 872 | 872 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') |
| r5842 | r5843 | |
| 883 | 883 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 884 | 884 | |
| 885 | 885 | PORT_START("ROW8") |
| 886 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) |
| 887 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 888 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 889 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 886 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) |
| 887 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) |
| 888 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 889 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 890 | 890 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(RALT)) |
| 891 | 891 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 892 | 892 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') |
| r5842 | r5843 | |
| 902 | 902 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') |
| 903 | 903 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 904 | 904 | |
| 905 | | PORT_START("ROW10") |
| 905 | PORT_START("ROW10") |
| 906 | 906 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 907 | 907 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad 00") PORT_CODE(KEYCODE_PGDN) |
| 908 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 909 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 908 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 909 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 910 | 910 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 911 | 911 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Pi") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(0x03C0) |
| 912 | 912 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') |
| 913 | 913 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 914 | 914 | |
| 915 | | PORT_START("ROW11") |
| 915 | PORT_START("ROW11") |
| 916 | 916 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 917 | 917 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 918 | 918 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') |
| r5842 | r5843 | |
| 926 | 926 | |
| 927 | 927 | INPUT_PORTS_START( cbmb_special ) |
| 928 | 928 | PORT_START("SPECIAL") |
| 929 | | PORT_BIT( 0x200, 0x200, IPT_UNUSED ) /* ntsc */ |
| 930 | | PORT_BIT( 0x100, 0x000, IPT_UNUSED ) /* cbm600 */ |
| 929 | PORT_BIT( 0x200, 0x200, IPT_UNUSED ) /* ntsc */ |
| 930 | PORT_BIT( 0x100, 0x000, IPT_UNUSED ) /* cbm600 */ |
| 931 | 931 | PORT_DIPNAME( 0x04, 0x00, "Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| 932 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 933 | | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) |
| 932 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 933 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) |
| 934 | 934 | INPUT_PORTS_END |
| 935 | 935 | |
| 936 | 936 | |
| 937 | 937 | /***************************** Commodore Vic 20 *********************************** |
| 938 | 938 | * |
| 939 | | * - vic_keyboard: basic Vic 20 keyboard |
| 939 | * - vic_keyboard: basic Vic 20 keyboard |
| 940 | 940 | * - vic_special: input port for the Shift Lock Switch |
| 941 | | * - vic_controls: joypads and paddles |
| 942 | | * - vic_expansion: RAM expansions |
| 943 | | * - VIC20 also has 2 lightpen ports, vic_lightpen_6560 & vic_lightpen_6561 |
| 944 | | * currently in vc20.c (they need visible area parameters for centering) |
| 941 | * - vic_controls: joypads and paddles |
| 942 | * - vic_expansion: RAM expansions |
| 943 | * - VIC20 also has 2 lightpen ports, vic_lightpen_6560 & vic_lightpen_6561 |
| 944 | * currently in vc20.c (they need visible area parameters for centering) |
| 945 | 945 | * |
| 946 | 946 | **********************************************************************************/ |
| 947 | 947 | |
| r5842 | r5843 | |
| 951 | 951 | --------------------- |
| 952 | 952 | |
| 953 | 953 | CLR INST |
| 954 | | <- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - £ HOME DEL f 1 |
| 954 | <- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - ? HOME DEL f 1 |
| 955 | 955 | |
| 956 | | |
| 956 | |
| 957 | 957 | CTRL Q W E R T Y U I O P @ * UP RESTORE f 3 |
| 958 | 958 | |
| 959 | 959 | RUN SHIFT |
| r5842 | r5843 | |
| 966 | 966 | SPACEBAR |
| 967 | 967 | |
| 968 | 968 | |
| 969 | | Notes: "C=" is a key with the Commodore logo, "UP" is an arrow pointing up, the "CRSR" keys at the |
| 969 | Notes: "C=" is a key with the Commodore logo, "UP" is an arrow pointing up, the "CRSR" keys at the |
| 970 | 970 | bottom-right corner are used to move the cursor on screen (Up/Down and Left/Right respectively). |
| 971 | 971 | Notice that this is exactly the same layout of C64 keyboard. |
| 972 | | |
| 972 | |
| 973 | 973 | */ |
| 974 | 974 | |
| 975 | 975 | INPUT_PORTS_START( vic_keyboard ) |
| 976 | 976 | PORT_START( "ROW0" ) |
| 977 | 977 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Del Inst") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) |
| 978 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') |
| 978 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') |
| 979 | 979 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') |
| 980 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 981 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| 982 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 983 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 984 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 980 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') |
| 981 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') |
| 982 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') |
| 983 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| 984 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') |
| 985 | 985 | |
| 986 | 986 | PORT_START( "ROW1" ) |
| 987 | 987 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) |
| 988 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') |
| 989 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 990 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 991 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 992 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 993 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 988 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') |
| 989 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 990 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 991 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 992 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 993 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 994 | 994 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) |
| 995 | 995 | |
| 996 | 996 | PORT_START( "ROW2" ) |
| 997 | 997 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) |
| 998 | 998 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') |
| 999 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 1000 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| 1001 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 1002 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 1003 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 999 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 1000 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| 1001 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 1002 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 1003 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 1004 | 1004 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) |
| 1005 | 1005 | |
| 1006 | 1006 | PORT_START( "ROW3" ) |
| 1007 | 1007 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) |
| 1008 | 1008 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') |
| 1009 | 1009 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') |
| 1010 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 1011 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 1012 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 1010 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 1011 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| 1012 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 1013 | 1013 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) |
| 1014 | 1014 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Stop Run") PORT_CODE(KEYCODE_HOME) |
| 1015 | 1015 | |
| 1016 | 1016 | PORT_START( "ROW4" ) |
| 1017 | 1017 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHAR(UCHAR_MAMEKEY(F2)) |
| 1018 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 1018 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) |
| 1019 | 1019 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') |
| 1020 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 1021 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 1022 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 1023 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 1024 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 1020 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') |
| 1021 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| 1022 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 1023 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 1024 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') |
| 1025 | 1025 | |
| 1026 | 1026 | PORT_START( "ROW5" ) |
| 1027 | 1027 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CHAR(UCHAR_MAMEKEY(F4)) |
| 1028 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') |
| 1028 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') |
| 1029 | 1029 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') |
| 1030 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 1031 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 1032 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 1033 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 1030 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 1031 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 1032 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 1033 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 1034 | 1034 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LCONTROL) |
| 1035 | 1035 | |
| 1036 | 1036 | PORT_START( "ROW6" ) |
| 1037 | 1037 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CHAR(UCHAR_MAMEKEY(F6)) |
| 1038 | 1038 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) |
| 1039 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') |
| 1040 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 1041 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 1042 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 1043 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 1044 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 1039 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') |
| 1040 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 1041 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 1042 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 1043 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 1044 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') |
| 1045 | 1045 | |
| 1046 | 1046 | PORT_START( "ROW7" ) |
| 1047 | 1047 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CHAR(UCHAR_MAMEKEY(F8)) |
| 1048 | 1048 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Home Clr") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) |
| 1049 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') |
| 1050 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 1049 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') |
| 1050 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 1051 | 1051 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') |
| 1052 | 1052 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') |
| 1053 | 1053 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') |
| r5842 | r5843 | |
| 1056 | 1056 | |
| 1057 | 1057 | |
| 1058 | 1058 | INPUT_PORTS_START( vic_special ) |
| 1059 | | PORT_START( "SPECIAL" ) /* special keys */ |
| 1060 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) |
| 1061 | | PORT_DIPNAME( 0x01, 0x00, "Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| 1062 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1059 | PORT_START( "SPECIAL" ) /* special keys */ |
| 1060 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) |
| 1061 | PORT_DIPNAME( 0x01, 0x00, "Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE |
| 1062 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 1063 | 1063 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) |
| 1064 | 1064 | INPUT_PORTS_END |
| 1065 | 1065 | |
| r5842 | r5843 | |
| 1069 | 1069 | { |
| 1070 | 1070 | int bit_mask = (FPTR)param; |
| 1071 | 1071 | UINT8 port = 0; |
| 1072 | | |
| 1072 | |
| 1073 | 1073 | if ((input_port_read(field->port->machine, "CTRLSEL") & 0xf0) == 0x10) |
| 1074 | 1074 | port |= (input_port_read(field->port->machine, "FAKE0") & bit_mask) ? 1 : 0; |
| 1075 | 1075 | |
| r5842 | r5843 | |
| 1078 | 1078 | |
| 1079 | 1079 | return port; |
| 1080 | 1080 | } |
| 1081 | | |
| 1081 | |
| 1082 | 1082 | INPUT_PORTS_START( vic_controls ) |
| 1083 | 1083 | PORT_START( "CTRLSEL" ) |
| 1084 | 1084 | PORT_CATEGORY_CLASS( 0xf0, 0x00, DEF_STR( Controller ) ) |
| r5842 | r5843 | |
| 1114 | 1114 | PORT_START( "EXP" ) |
| 1115 | 1115 | PORT_DIPNAME( 0x07, 0x00, "RAM Cartridge") |
| 1116 | 1116 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 1117 | | PORT_DIPSETTING( 0x01, "3k" ) |
| 1118 | | PORT_DIPSETTING( 0x02, "8k" ) |
| 1119 | | PORT_DIPSETTING( 0x03, "16k" ) |
| 1120 | | PORT_DIPSETTING( 0x04, "32k" ) |
| 1121 | | PORT_DIPSETTING( 0x05, "Custom" ) |
| 1117 | PORT_DIPSETTING( 0x01, "3k" ) |
| 1118 | PORT_DIPSETTING( 0x02, "8k" ) |
| 1119 | PORT_DIPSETTING( 0x03, "16k" ) |
| 1120 | PORT_DIPSETTING( 0x04, "32k" ) |
| 1121 | PORT_DIPSETTING( 0x05, "Custom" ) |
| 1122 | 1122 | PORT_DIPNAME( 0x08, 0x00, "RAM at 0x0400") |
| 1123 | 1123 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 1124 | 1124 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) |
| r5842 | r5843 | |
| 1133 | 1133 | PORT_DIPSETTING( 0x40, DEF_STR( Yes ) ) |
| 1134 | 1134 | PORT_DIPNAME( 0x80, 0x00, "RAM at 0xa000") |
| 1135 | 1135 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 1136 | | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 1136 | PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) |
| 1137 | 1137 | INPUT_PORTS_END |
src/mess/machine/c64.c
| r5842 | r5843 | |
| 1 | 1 | /*************************************************************************** |
| 2 | | commodore c64 home computer |
| 2 | commodore c64 home computer |
| 3 | 3 | |
| 4 | 4 | peter.trauner@jk.uni-linz.ac.at |
| 5 | 5 | documentation |
| r5842 | r5843 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | /* |
| 10 | | 2008-09-06: Tape status for C64 & C128 [FP & RZ] |
| 11 | | - tape loading works |
| 12 | | - tap files are supported |
| 13 | | - tape writing works |
| 10 | 2008-09-06: Tape status for C64 & C128 [FP & RZ] |
| 11 | - tape loading works |
| 12 | - tap files are supported |
| 13 | - tape writing works |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | #include "driver.h" |
| r5842 | r5843 | |
| 66 | 66 | static int ultimax; |
| 67 | 67 | int c64_tape_on; |
| 68 | 68 | static int c64_cia1_on; |
| 69 | | static int c64_io_enabled = 0; |
| 69 | static int c64_io_enabled; |
| 70 | 70 | static int is_sx64; // temporary workaround until we implement full vc1541 emulation for every c64 set |
| 71 | 71 | static UINT8 c64_cart_n_banks = 0; |
| 72 | 72 | |
| 73 | 73 | static UINT8 serial_clock, serial_data, serial_atn; |
| 74 | | static UINT8 vicirq = 0; |
| 74 | static UINT8 vicirq; |
| 75 | 75 | |
| 76 | | static void c64_nmi(running_machine *machine) |
| 76 | static void c64_nmi( running_machine *machine ) |
| 77 | 77 | { |
| 78 | 78 | static int nmilevel = 0; |
| 79 | 79 | const device_config *cia_1 = devtag_get_device(machine, "cia_1"); |
| r5842 | r5843 | |
| 90 | 90 | |
| 91 | 91 | /*********************************************** |
| 92 | 92 | |
| 93 | | CIA Interfaces |
| 93 | CIA Interfaces |
| 94 | 94 | |
| 95 | 95 | ***********************************************/ |
| 96 | 96 | |
| 97 | 97 | /* |
| 98 | | * CIA 0 - Port A keyboard line select |
| 99 | | * CIA 0 - Port B keyboard line read |
| 98 | * CIA 0 - Port A keyboard line select |
| 99 | * CIA 0 - Port B keyboard line read |
| 100 | 100 | * |
| 101 | | * flag cassette read input, serial request in |
| 102 | | * irq to irq connected |
| 101 | * flag cassette read input, serial request in |
| 102 | * irq to irq connected |
| 103 | 103 | * |
| 104 | | * see machine/cbm.c |
| 104 | * see machine/cbm.c |
| 105 | 105 | */ |
| 106 | 106 | |
| 107 | 107 | static READ8_DEVICE_HANDLER( c64_cia0_port_a_r ) |
| r5842 | r5843 | |
| 123 | 123 | vic2_lightpen_write(data & 0x10); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | | static void c64_irq (running_machine *machine, int level) |
| 126 | static void c64_irq( running_machine *machine, int level ) |
| 127 | 127 | { |
| 128 | 128 | static int old_level = 0; |
| 129 | 129 | |
| r5842 | r5843 | |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | | static void c64_cia0_interrupt (const device_config *device, int level) |
| 138 | static void c64_cia0_interrupt( const device_config *device, int level ) |
| 139 | 139 | { |
| 140 | 140 | c64_irq (device->machine, level || vicirq); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | | void c64_vic_interrupt (running_machine *machine, int level) |
| 143 | void c64_vic_interrupt( running_machine *machine, int level ) |
| 144 | 144 | { |
| 145 | 145 | const device_config *cia_0 = devtag_get_device(machine, "cia_0"); |
| 146 | 146 | #if 1 |
| r5842 | r5843 | |
| 225 | 225 | c64_vicaddr = c64_memory + helper[data & 0x03]; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | | static void c64_cia1_interrupt (const device_config *device, int level) |
| 228 | static void c64_cia1_interrupt( const device_config *device, int level ) |
| 229 | 229 | { |
| 230 | 230 | c64_nmi(device->machine); |
| 231 | 231 | } |
| r5842 | r5843 | |
| 256 | 256 | |
| 257 | 257 | /*********************************************** |
| 258 | 258 | |
| 259 | | Memory Handlers |
| 259 | Memory Handlers |
| 260 | 260 | |
| 261 | 261 | ***********************************************/ |
| 262 | 262 | |
| r5842 | r5843 | |
| 269 | 269 | const device_config *cia_1 = devtag_get_device(space->machine, "cia_1"); |
| 270 | 270 | const device_config *sid = devtag_get_device(space->machine, "sid6581"); |
| 271 | 271 | |
| 272 | | c64_io_mirror[ offset ] = data; |
| 273 | | if (offset < 0x400) { |
| 274 | | vic2_port_w (space, offset & 0x3ff, data); |
| 275 | | } else if (offset < 0x800) { |
| 276 | | sid6581_w (sid, offset & 0x3ff, data); |
| 277 | | } else if (offset < 0xc00) |
| 272 | c64_io_mirror[offset] = data; |
| 273 | if (offset < 0x400) |
| 274 | vic2_port_w(space, offset & 0x3ff, data); |
| 275 | else if (offset < 0x800) |
| 276 | sid6581_w(sid, offset & 0x3ff, data); |
| 277 | else if (offset < 0xc00) |
| 278 | 278 | c64_colorram[offset & 0x3ff] = data | 0xf0; |
| 279 | 279 | else if (offset < 0xd00) |
| 280 | 280 | cia_w(cia_0, offset, data); |
| r5842 | r5843 | |
| 286 | 286 | DBG_LOG(space->machine, 1, "io write", ("%.3x %.2x\n", offset, data)); |
| 287 | 287 | } |
| 288 | 288 | else if (offset < 0xf00) |
| 289 | | { |
| 290 | | /* i/o 1 */ |
| 291 | | DBG_LOG(space->machine, 1, "io write", ("%.3x %.2x\n", offset, data)); |
| 292 | | } |
| 289 | DBG_LOG(space->machine, 1, "io write", ("%.3x %.2x\n", offset, data)); /* i/o 1 */ |
| 293 | 290 | else |
| 294 | | { |
| 295 | | /* i/o 2 */ |
| 296 | | DBG_LOG(space->machine, 1, "io write", ("%.3x %.2x\n", offset, data)); |
| 297 | | } |
| 291 | DBG_LOG(space->machine, 1, "io write", ("%.3x %.2x\n", offset, data)); /* i/o 2 */ |
| 298 | 292 | } |
| 299 | 293 | |
| 300 | | WRITE8_HANDLER(c64_ioarea_w) |
| 294 | WRITE8_HANDLER( c64_ioarea_w ) |
| 301 | 295 | { |
| 302 | 296 | if (c64_io_enabled) |
| 303 | | { |
| 304 | 297 | c64_write_io(space, offset, data); |
| 305 | | } |
| 306 | 298 | else |
| 307 | | { |
| 308 | 299 | c64_io_ram_w_ptr[offset] = data; |
| 309 | | } |
| 310 | 300 | } |
| 311 | 301 | |
| 312 | 302 | READ8_HANDLER( c64_read_io ) |
| r5842 | r5843 | |
| 316 | 306 | const device_config *sid = devtag_get_device(space->machine, "sid6581"); |
| 317 | 307 | |
| 318 | 308 | if (offset < 0x400) |
| 319 | | return vic2_port_r (space, offset & 0x3ff); |
| 309 | return vic2_port_r(space, offset & 0x3ff); |
| 320 | 310 | |
| 321 | 311 | else if (offset < 0x800) |
| 322 | | return sid6581_r (sid, offset & 0x3ff); |
| 312 | return sid6581_r(sid, offset & 0x3ff); |
| 323 | 313 | |
| 324 | 314 | else if (offset < 0xc00) |
| 325 | 315 | return c64_colorram[offset & 0x3ff]; |
| r5842 | r5843 | |
| 347 | 337 | return 0xff; |
| 348 | 338 | } |
| 349 | 339 | |
| 350 | | READ8_HANDLER(c64_ioarea_r) |
| 340 | READ8_HANDLER( c64_ioarea_r ) |
| 351 | 341 | { |
| 352 | 342 | return c64_io_enabled ? c64_read_io(space, offset) : c64_io_ram_r_ptr[offset]; |
| 353 | 343 | } |
| r5842 | r5843 | |
| 466 | 456 | |
| 467 | 457 | */ |
| 468 | 458 | |
| 469 | | static void c64_bankswitch(running_machine *machine, int reset) |
| 459 | static void c64_bankswitch( running_machine *machine, int reset ) |
| 470 | 460 | { |
| 471 | 461 | static int old = -1, exrom, game; |
| 472 | 462 | int loram, hiram, charen; |
| r5842 | r5843 | |
| 492 | 482 | { |
| 493 | 483 | c64_io_enabled = 1; // charen has no effect in ultimax_mode |
| 494 | 484 | |
| 495 | | memory_set_bankptr (machine, 1, roml); |
| 496 | | memory_set_bankptr (machine, 2, c64_memory + 0x8000); |
| 497 | | memory_set_bankptr (machine, 3, c64_memory + 0xa000); |
| 498 | | memory_set_bankptr (machine, 4, romh); |
| 485 | memory_set_bankptr(machine, 1, roml); |
| 486 | memory_set_bankptr(machine, 2, c64_memory + 0x8000); |
| 487 | memory_set_bankptr(machine, 3, c64_memory + 0xa000); |
| 488 | memory_set_bankptr(machine, 4, romh); |
| 499 | 489 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, SMH_NOP); |
| 500 | 490 | } |
| 501 | 491 | else |
| r5842 | r5843 | |
| 503 | 493 | /* 0x8000-0x9000 */ |
| 504 | 494 | if (loram && hiram && !c64_exrom) |
| 505 | 495 | { |
| 506 | | memory_set_bankptr (machine, 1, roml); |
| 507 | | memory_set_bankptr (machine, 2, c64_memory + 0x8000); |
| 496 | memory_set_bankptr(machine, 1, roml); |
| 497 | memory_set_bankptr(machine, 2, c64_memory + 0x8000); |
| 508 | 498 | } |
| 509 | 499 | else |
| 510 | 500 | { |
| 511 | | memory_set_bankptr (machine, 1, c64_memory + 0x8000); |
| 512 | | memory_set_bankptr (machine, 2, c64_memory + 0x8000); |
| 501 | memory_set_bankptr(machine, 1, c64_memory + 0x8000); |
| 502 | memory_set_bankptr(machine, 2, c64_memory + 0x8000); |
| 513 | 503 | } |
| 514 | 504 | |
| 515 | 505 | /* 0xa000 */ |
| 516 | 506 | if (hiram && !c64_game && !c64_exrom) |
| 517 | | memory_set_bankptr (machine, 3, romh); |
| 507 | memory_set_bankptr(machine, 3, romh); |
| 518 | 508 | |
| 519 | 509 | else if (loram && hiram && c64_game) |
| 520 | | memory_set_bankptr (machine, 3, c64_basic); |
| 510 | memory_set_bankptr(machine, 3, c64_basic); |
| 521 | 511 | |
| 522 | 512 | else |
| 523 | | memory_set_bankptr (machine, 3, c64_memory + 0xa000); |
| 513 | memory_set_bankptr(machine, 3, c64_memory + 0xa000); |
| 524 | 514 | |
| 525 | 515 | /* 0xd000 */ |
| 526 | 516 | // RAM |
| r5842 | r5843 | |
| 550 | 540 | } |
| 551 | 541 | |
| 552 | 542 | /* 0xe000-0xf000 */ |
| 553 | | memory_set_bankptr (machine, 4, hiram ? c64_kernal : c64_memory + 0xe000); |
| 554 | | memory_set_bankptr (machine, 5, c64_memory + 0xe000); |
| 543 | memory_set_bankptr(machine, 4, hiram ? c64_kernal : c64_memory + 0xe000); |
| 544 | memory_set_bankptr(machine, 5, c64_memory + 0xe000); |
| 555 | 545 | } |
| 556 | 546 | |
| 557 | 547 | /* make sure the opbase function gets called each time */ |
| r5842 | r5843 | |
| 578 | 568 | |
| 579 | 569 | static emu_timer *datasette_timer; |
| 580 | 570 | |
| 581 | | void c64_m6510_port_write(const device_config *device, UINT8 direction, UINT8 data) |
| 571 | void c64_m6510_port_write( const device_config *device, UINT8 direction, UINT8 data ) |
| 582 | 572 | { |
| 583 | 573 | /* if line is marked as input then keep current value */ |
| 584 | 574 | data = (c64_port_data & ~direction) | (data & direction); |
| r5842 | r5843 | |
| 620 | 610 | if (!ultimax) |
| 621 | 611 | c64_bankswitch(device->machine, 0); |
| 622 | 612 | |
| 623 | | c64_memory[0x000] = memory_read_byte( cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 0 ); |
| 624 | | c64_memory[0x001] = memory_read_byte( cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 1 ); |
| 613 | c64_memory[0x000] = memory_read_byte(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 0); |
| 614 | c64_memory[0x001] = memory_read_byte(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 1); |
| 625 | 615 | } |
| 626 | 616 | |
| 627 | | UINT8 c64_m6510_port_read(const device_config *device, UINT8 direction) |
| 617 | UINT8 c64_m6510_port_read( const device_config *device, UINT8 direction ) |
| 628 | 618 | { |
| 629 | 619 | UINT8 data = c64_port_data; |
| 630 | 620 | |
| r5842 | r5843 | |
| 640 | 630 | } |
| 641 | 631 | |
| 642 | 632 | |
| 643 | | int c64_paddle_read (const device_config *device, int which) |
| 633 | int c64_paddle_read( const device_config *device, int which ) |
| 644 | 634 | { |
| 645 | 635 | running_machine *machine = device->machine; |
| 646 | 636 | int pot1 = 0xff, pot2 = 0xff, pot3 = 0xff, pot4 = 0xff, temp; |
| r5842 | r5843 | |
| 742 | 732 | } |
| 743 | 733 | } |
| 744 | 734 | |
| 745 | | READ8_HANDLER(c64_colorram_read) |
| 735 | READ8_HANDLER( c64_colorram_read ) |
| 746 | 736 | { |
| 747 | 737 | return c64_colorram[offset & 0x3ff]; |
| 748 | 738 | } |
| r5842 | r5843 | |
| 757 | 747 | * a15 and a14 portlines |
| 758 | 748 | * 0x1000-0x1fff, 0x9000-0x9fff char rom |
| 759 | 749 | */ |
| 760 | | static int c64_dma_read(running_machine *machine, int offset) |
| 750 | static int c64_dma_read( running_machine *machine, int offset ) |
| 761 | 751 | { |
| 762 | 752 | if (!c64_game && c64_exrom) |
| 763 | 753 | { |
| r5842 | r5843 | |
| 773 | 763 | return c64_vicaddr[offset]; |
| 774 | 764 | } |
| 775 | 765 | |
| 776 | | static int c64_dma_read_ultimax(running_machine *machine, int offset ) |
| 766 | static int c64_dma_read_ultimax( running_machine *machine, int offset ) |
| 777 | 767 | { |
| 778 | 768 | if (offset < 0x3000) |
| 779 | 769 | return c64_memory[offset]; |
| r5842 | r5843 | |
| 781 | 771 | return c64_romh[offset & 0x1fff]; |
| 782 | 772 | } |
| 783 | 773 | |
| 784 | | static int c64_dma_read_color(running_machine *machine, int offset) |
| 774 | static int c64_dma_read_color( running_machine *machine, int offset ) |
| 785 | 775 | { |
| 786 | 776 | return c64_colorram[offset & 0x3ff] & 0xf; |
| 787 | 777 | } |
| r5842 | r5843 | |
| 799 | 789 | last = tmp; |
| 800 | 790 | } |
| 801 | 791 | |
| 802 | | static void c64_common_driver_init (running_machine *machine) |
| 792 | static void c64_common_driver_init( running_machine *machine ) |
| 803 | 793 | { |
| 804 | 794 | if (!ultimax) |
| 805 | 795 | { |
| r5842 | r5843 | |
| 876 | 866 | c64_cia1_on = 1; |
| 877 | 867 | c64_tape_on = 0; |
| 878 | 868 | c64_common_driver_init(machine); |
| 879 | | drive_config(machine, type_1541, 0, 0, "cpu_vc1540", 8); |
| 869 | cbm_drive_config(machine, type_1541, 0, 0, "cpu_vc1540", 8); |
| 880 | 870 | } |
| 881 | 871 | |
| 882 | 872 | MACHINE_START( c64 ) |
| r5842 | r5843 | |
| 884 | 874 | c64_port_data = 0x17; |
| 885 | 875 | |
| 886 | 876 | c64_io_mirror = auto_alloc_array(machine, UINT8, 0x1000); |
| 877 | c64_io_enabled = 0; |
| 887 | 878 | |
| 888 | 879 | if (is_sx64) |
| 889 | 880 | { |
| 890 | | drive_reset(); |
| 881 | cbm_drive_reset(machine); |
| 891 | 882 | } |
| 892 | 883 | else if (c64_cia1_on) |
| 893 | 884 | { |
| r5842 | r5843 | |
| 912 | 903 | |
| 913 | 904 | /*********************************************** |
| 914 | 905 | |
| 915 | | C64 Cartridges |
| 906 | C64 Cartridges |
| 916 | 907 | |
| 917 | 908 | ***********************************************/ |
| 918 | 909 | |
| 919 | | /* Info based on http://ist.uwaterloo.ca/~schepers/formats/CRT.TXT */ |
| 910 | /* Info based on http://ist.uwaterloo.ca/~schepers/formats/CRT.TXT */ |
| 920 | 911 | /* Please refer to the webpage for the latest version and for a very |
| 921 | | complete listing of various cart types and their bankswitch tricks */ |
| 912 | complete listing of various cart types and their bankswitch tricks */ |
| 922 | 913 | /* |
| 923 | 914 | Cartridge files were introduced in the CCS64 emulator, written by Per |
| 924 | 915 | Hakan Sundell, and use the ".CRT" file extension. This format was created |
| r5842 | r5843 | |
| 938 | 929 | |
| 939 | 930 | [ A .CRT file consists of |
| 940 | 931 | |
| 941 | | $0000-0040 : Header of the whole .crt files |
| 942 | | $0040-EOF : Blocks of data |
| 932 | $0000-0040 : Header of the whole .crt files |
| 933 | $0040-EOF : Blocks of data |
| 943 | 934 | |
| 944 | 935 | Each block of data, called 'CHIP', can be of variable size. The first |
| 945 | 936 | 0x10 bytes of each CHIP block is the block header, and it contains various |
| r5842 | r5843 | |
| 1000 | 991 | static INT8 cbm_c64_game; |
| 1001 | 992 | static INT8 cbm_c64_exrom; |
| 1002 | 993 | |
| 1003 | | static DEVICE_IMAGE_UNLOAD(c64_cart) |
| 994 | static DEVICE_IMAGE_UNLOAD( c64_cart ) |
| 1004 | 995 | { |
| 1005 | 996 | int i; |
| 1006 | 997 | |
| r5842 | r5843 | |
| 1013 | 1004 | } |
| 1014 | 1005 | |
| 1015 | 1006 | |
| 1016 | | static DEVICE_START(c64_cart) |
| 1007 | static DEVICE_START( c64_cart ) |
| 1017 | 1008 | { |
| 1018 | 1009 | int index = 0; |
| 1019 | 1010 | |
| 1020 | | if (strcmp(device->tag, "cart1") == 0) |
| 1011 | if (strcmp(device->tag, "cart1") == 0) |
| 1021 | 1012 | index = 0; |
| 1022 | 1013 | |
| 1023 | | if (strcmp(device->tag, "cart2") == 0) |
| 1014 | if (strcmp(device->tag, "cart2") == 0) |
| 1024 | 1015 | index = 1; |
| 1025 | 1016 | |
| 1026 | 1017 | |
| 1027 | | /* In the first slot we can load a .crt file. In this case we want |
| 1028 | | to use game & exrom values from the header, not the default ones. */ |
| 1018 | /* In the first slot we can load a .crt file. In this case we want |
| 1019 | to use game & exrom values from the header, not the default ones. */ |
| 1029 | 1020 | if (index == 0) |
| 1030 | 1021 | { |
| 1031 | 1022 | cbm_c64_game = -1; |
| r5842 | r5843 | |
| 1035 | 1026 | |
| 1036 | 1027 | /* Hardware Types for C64 carts */ |
| 1037 | 1028 | enum { |
| 1038 | | GENERIC_CRT = 0, /* 00 - Normal cartridge */ |
| 1039 | | ACTION_REPLAY, /* 01 - Action Replay */ |
| 1040 | | KCS_PC, /* 02 - KCS Power Cartridge */ |
| 1041 | | FINAL_CART_III, /* 03 - Final Cartridge III */ |
| 1042 | | SIMONS_BASIC, /* 04 - Simons Basic */ |
| 1043 | | OCEAN_1, /* 05 - Ocean type 1 (1) */ |
| 1044 | | EXPERT, /* 06 - Expert Cartridge */ |
| 1045 | | FUN_PLAY, /* 07 - Fun Play, Power Play */ |
| 1046 | | SUPER_GAMES, /* 08 - Super Games */ |
| 1047 | | ATOMIC_POWER, /* 09 - Atomic Power */ |
| 1048 | | EPYX_FASTLOAD, /* 10 - Epyx Fastload */ |
| 1049 | | WESTERMANN, /* 11 - Westermann Learning */ |
| 1050 | | REX, /* 12 - Rex Utility */ |
| 1051 | | FINAL_CART_I, /* 13 - Final Cartridge I */ |
| 1052 | | MAGIC_FORMEL, /* 14 - Magic Formel */ |
| 1053 | | C64GS, /* 15 - C64 Game System, System 3 */ |
| 1054 | | WARPSPEED, /* 16 - WarpSpeed */ |
| 1055 | | DINAMIC, /* 17 - Dinamic (2) */ |
| 1056 | | ZAXXON, /* 18 - Zaxxon, Super Zaxxon (SEGA) */ |
| 1057 | | DOMARK, /* 19 - Magic Desk, Domark, HES Australia */ |
| 1058 | | SUPER_SNAP_5, /* 20 - Super Snapshot 5 */ |
| 1059 | | COMAL_80, /* 21 - Comal-80 */ |
| 1060 | | STRUCT_BASIC, /* 22 - Structured Basic */ |
| 1061 | | ROSS, /* 23 - Ross */ |
| 1062 | | DELA_EP64, /* 24 - Dela EP64 */ |
| 1063 | | DELA_EP7X8, /* 25 - Dela EP7x8 */ |
| 1064 | | DELA_EP256, /* 26 - Dela EP256 */ |
| 1065 | | REX_EP256, /* 27 - Rex EP256 */ |
| 1066 | | MIKRO_ASSMBLR, /* 28 - Mikro Assembler */ |
| 1067 | | REAL_FC_I, /* 29 - (3) */ |
| 1068 | | ACTION_REPLAY_4, /* 30 - Action Replay 4 */ |
| 1069 | | STARDOS, /* 31 - StarDOS */ |
| 1029 | GENERIC_CRT = 0, /* 00 - Normal cartridge */ |
| 1030 | ACTION_REPLAY, /* 01 - Action Replay */ |
| 1031 | KCS_PC, /* 02 - KCS Power Cartridge */ |
| 1032 | FINAL_CART_III, /* 03 - Final Cartridge III */ |
| 1033 | SIMONS_BASIC, /* 04 - Simons Basic */ |
| 1034 | OCEAN_1, /* 05 - Ocean type 1 (1) */ |
| 1035 | EXPERT, /* 06 - Expert Cartridge */ |
| 1036 | FUN_PLAY, /* 07 - Fun Play, Power Play */ |
| 1037 | SUPER_GAMES, /* 08 - Super Games */ |
| 1038 | ATOMIC_POWER, /* 09 - Atomic Power */ |
| 1039 | EPYX_FASTLOAD, /* 10 - Epyx Fastload */ |
| 1040 | WESTERMANN, /* 11 - Westermann Learning */ |
| 1041 | REX, /* 12 - Rex Utility */ |
| 1042 | FINAL_CART_I, /* 13 - Final Cartridge I */ |
| 1043 | MAGIC_FORMEL, /* 14 - Magic Formel */ |
| 1044 | C64GS, /* 15 - C64 Game System, System 3 */ |
| 1045 | WARPSPEED, /* 16 - WarpSpeed */ |
| 1046 | DINAMIC, /* 17 - Dinamic (2) */ |
| 1047 | ZAXXON, /* 18 - Zaxxon, Super Zaxxon (SEGA) */ |
| 1048 | DOMARK, /* 19 - Magic Desk, Domark, HES Australia */ |
| 1049 | SUPER_SNAP_5, /* 20 - Super Snapshot 5 */ |
| 1050 | COMAL_80, /* 21 - Comal-80 */ |
| 1051 | STRUCT_BASIC, /* 22 - Structured Basic */ |
| 1052 | ROSS, /* 23 - Ross */ |
| 1053 | DELA_EP64, /* 24 - Dela EP64 */ |
| 1054 | DELA_EP7X8, /* 25 - Dela EP7x8 */ |
| 1055 | DELA_EP256, /* 26 - Dela EP256 */ |
| 1056 | REX_EP256, /* 27 - Rex EP256 */ |
| 1057 | MIKRO_ASSMBLR, /* 28 - Mikro Assembler */ |
| 1058 | REAL_FC_I, /* 29 - (3) */ |
| 1059 | ACTION_REPLAY_4, /* 30 - Action Replay 4 */ |
| 1060 | STARDOS, /* 31 - StarDOS */ |
| 1070 | 1061 | /* |
| 1071 | | (1) Ocean type 1 includes Navy Seals, Robocop 2 & 3, Shadow of |
| 1072 | | the Beast, Toki, Terminator 2 and more. Both 256 and 128 Kb images. |
| 1073 | | (2) Dinamic includes Narco Police and more. |
| 1074 | | (3) Type 29 is reserved for the real Final Cartridge I, the one |
| 1075 | | above (Type 13) will become Final Cartridge II. */ |
| 1062 | (1) Ocean type 1 includes Navy Seals, Robocop 2 & 3, Shadow of |
| 1063 | the Beast, Toki, Terminator 2 and more. Both 256 and 128 Kb images. |
| 1064 | (2) Dinamic includes Narco Police and more. |
| 1065 | (3) Type 29 is reserved for the real Final Cartridge I, the one |
| 1066 | above (Type 13) will become Final Cartridge II. */ |
| 1076 | 1067 | /**************************************** |
| 1077 | | Vice also defines the following types: |
| 1078 | | #define CARTRIDGE_ACTION_REPLAY3 -29 |
| 1079 | | #define CARTRIDGE_IEEE488 -11 |
| 1080 | | #define CARTRIDGE_IDE64 -7 |
| 1081 | | #define CARTRIDGE_RETRO_REPLAY -5 |
| 1082 | | #define CARTRIDGE_SUPER_SNAPSHOT -4 |
| 1068 | Vice also defines the following types: |
| 1069 | #define CARTRIDGE_ACTION_REPLAY3 -29 |
| 1070 | #define CARTRIDGE_IEEE488 -11 |
| 1071 | #define CARTRIDGE_IDE64 -7 |
| 1072 | #define CARTRIDGE_RETRO_REPLAY -5 |
| 1073 | #define CARTRIDGE_SUPER_SNAPSHOT -4 |
| 1083 | 1074 | |
| 1084 | | Can we support these as well? |
| 1085 | | *****************************************/ |
| 1075 | Can we support these as well? |
| 1076 | *****************************************/ |
| 1086 | 1077 | }; |
| 1087 | 1078 | |
| 1088 | 1079 | static UINT8 c64_mapper = GENERIC_CRT; |
| 1089 | 1080 | |
| 1090 | | static DEVICE_IMAGE_LOAD(c64_cart) |
| 1081 | static DEVICE_IMAGE_LOAD( c64_cart ) |
| 1091 | 1082 | { |
| 1092 | 1083 | int size = image_length(image), test, i = 0, n_banks; |
| 1093 | 1084 | const char *filetype; |
| r5842 | r5843 | |
| 1098 | 1089 | filetype = image_filetype(image); |
| 1099 | 1090 | |
| 1100 | 1091 | /* We support .crt files */ |
| 1101 | | if (!mame_stricmp (filetype, "crt")) |
| 1092 | if (!mame_stricmp(filetype, "crt")) |
| 1102 | 1093 | { |
| 1103 | 1094 | int j; |
| 1104 | 1095 | unsigned short c64_cart_type; |
| r5842 | r5843 | |
| 1164 | 1155 | |
| 1165 | 1156 | |
| 1166 | 1157 | /* Data in a .crt image are organized in blocks called 'CHIP': |
| 1167 | | each 'CHIP' consists of a 0x10 header, which contains the |
| 1168 | | actual size of the block, the loading address and info on |
| 1169 | | the bankswitch, followed by the actual data */ |
| 1158 | each 'CHIP' consists of a 0x10 header, which contains the |
| 1159 | actual size of the block, the loading address and info on |
| 1160 | the bankswitch, followed by the actual data */ |
| 1170 | 1161 | while (j < size) |
| 1171 | 1162 | { |
| 1172 | 1163 | unsigned short chip_size, chip_bank_index, chip_data_size; |
| r5842 | r5843 | |
| 1275 | 1266 | memset(roml, 0, 0x2000); |
| 1276 | 1267 | memset(romh, 0, 0x2000); |
| 1277 | 1268 | |
| 1278 | | switch( c64_mapper ) |
| 1269 | switch (c64_mapper) |
| 1279 | 1270 | { |
| 1280 | 1271 | case ZAXXON: |
| 1281 | 1272 | memcpy(romh, cart + 0x1000, 0x2000); |
| r5842 | r5843 | |
| 1314 | 1305 | memcpy(roml, cart + bank * 0x4000, 0x2000); |
| 1315 | 1306 | memcpy(romh, cart + bank * 0x4000 + 0x2000, 0x2000); |
| 1316 | 1307 | /* |
| 1317 | | if (log_cart) |
| 1318 | | { |
| 1319 | | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1320 | | if (c64_cbm_cart[bank].index != bank) |
| 1321 | | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1322 | | } |
| 1308 | if (log_cart) |
| 1309 | { |
| 1310 | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1311 | if (c64_cbm_cart[bank].index != bank) |
| 1312 | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1313 | } |
| 1323 | 1314 | */ |
| 1324 | 1315 | } |
| 1325 | 1316 | } |
| r5842 | r5843 | |
| 1346 | 1337 | memcpy(roml, cart + bank * 0x2000, 0x2000); |
| 1347 | 1338 | } |
| 1348 | 1339 | /* |
| 1349 | | if (log_cart) |
| 1350 | | { |
| 1351 | | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1352 | | if (c64_cbm_cart[bank].index != bank) |
| 1353 | | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1354 | | } |
| 1340 | if (log_cart) |
| 1341 | { |
| 1342 | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1343 | if (c64_cbm_cart[bank].index != bank) |
| 1344 | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1345 | } |
| 1355 | 1346 | */ |
| 1356 | 1347 | } |
| 1357 | 1348 | |
| r5842 | r5843 | |
| 1365 | 1356 | UINT8 *cart = memory_region(space->machine, "cart"); |
| 1366 | 1357 | |
| 1367 | 1358 | /* This should be written after the bankswitch has happened. We log it to see if it is really working */ |
| 1368 | | if (data == 0x86 ) |
| 1359 | if (data == 0x86) |
| 1369 | 1360 | logerror("Reserved value written\n"); |
| 1370 | 1361 | else |
| 1371 | 1362 | { |
| r5842 | r5843 | |
| 1374 | 1365 | |
| 1375 | 1366 | memcpy(roml, cart + real_bank * 0x2000, 0x2000); |
| 1376 | 1367 | /* |
| 1377 | | if (log_cart) |
| 1378 | | { |
| 1379 | | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1380 | | if (c64_cbm_cart[bank].index != bank) |
| 1381 | | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1382 | | } |
| 1368 | if (log_cart) |
| 1369 | { |
| 1370 | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1371 | if (c64_cbm_cart[bank].index != bank) |
| 1372 | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1373 | } |
| 1383 | 1374 | */ |
| 1384 | 1375 | } |
| 1385 | 1376 | } |
| r5842 | r5843 | |
| 1436 | 1427 | |
| 1437 | 1428 | memcpy(roml, cart + bank * 0x2000, 0x2000); |
| 1438 | 1429 | /* |
| 1439 | | if (log_cart) |
| 1440 | | { |
| 1441 | | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1442 | | if (c64_cbm_cart[bank].index != bank) |
| 1443 | | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1444 | | } |
| 1430 | if (log_cart) |
| 1431 | { |
| 1432 | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1433 | if (c64_cbm_cart[bank].index != bank) |
| 1434 | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1435 | } |
| 1445 | 1436 | */ |
| 1446 | 1437 | } |
| 1447 | 1438 | |
| r5842 | r5843 | |
| 1459 | 1450 | |
| 1460 | 1451 | memcpy(roml, cart + bank * 0x2000, 0x2000); |
| 1461 | 1452 | /* |
| 1462 | | if (log_cart) |
| 1463 | | { |
| 1464 | | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1465 | | if (c64_cbm_cart[bank].index != bank) |
| 1466 | | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1467 | | } |
| 1453 | if (log_cart) |
| 1454 | { |
| 1455 | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1456 | if (c64_cbm_cart[bank].index != bank) |
| 1457 | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1458 | } |
| 1468 | 1459 | */ |
| 1469 | 1460 | return 0; |
| 1470 | 1461 | } |
| r5842 | r5843 | |
| 1531 | 1522 | |
| 1532 | 1523 | memcpy(roml, cart + bank * 0x4000, 0x4000); |
| 1533 | 1524 | /* |
| 1534 | | if (log_cart) |
| 1535 | | { |
| 1536 | | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1537 | | if (c64_cbm_cart[bank].index != bank) |
| 1538 | | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1539 | | } |
| 1540 | | */ |
| 1525 | if (log_cart) |
| 1526 | { |
| 1527 | logerror("bank %d of size %d successfully loaded at %d!\n", bank, c64_cbm_cart[bank].size, c64_cbm_cart[bank].addr); |
| 1528 | if (c64_cbm_cart[bank].index != bank) |
| 1529 | logerror("Warning: According to the CHIP info this should be bank %d, but we are loading it as bank %d!\n", c64_cbm_cart[bank].index, bank); |
| 1530 | } |
| 1531 | */ |
| 1541 | 1532 | } |
| 1542 | 1533 | } |
| 1543 | 1534 | |
| r5842 | r5843 | |
| 1545 | 1536 | { |
| 1546 | 1537 | const address_space *space = cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ); |
| 1547 | 1538 | |
| 1548 | | switch( c64_mapper ) |
| 1539 | switch (c64_mapper) |
| 1549 | 1540 | { |
| 1550 | 1541 | case ACTION_REPLAY: /* Type # 1 not working */ |
| 1551 | 1542 | break; |
| r5842 | r5843 | |
| 1605 | 1596 | |
| 1606 | 1597 | MACHINE_RESET( c64 ) |
| 1607 | 1598 | { |
| 1608 | | if(c64_cart_n_banks) |
| 1599 | if (c64_cart_n_banks) |
| 1609 | 1600 | setup_c64_custom_mappers(machine); |
| 1610 | 1601 | } |
| 1611 | 1602 | |
| 1612 | 1603 | |
| 1613 | | MACHINE_DRIVER_START(c64_cartslot) |
| 1604 | MACHINE_DRIVER_START( c64_cartslot ) |
| 1614 | 1605 | MDRV_CARTSLOT_ADD("cart1") |
| 1615 | 1606 | MDRV_CARTSLOT_EXTENSION_LIST("crt,80") |
| 1616 | 1607 | MDRV_CARTSLOT_NOT_MANDATORY |
| r5842 | r5843 | |
| 1626 | 1617 | MDRV_CARTSLOT_UNLOAD(c64_cart) |
| 1627 | 1618 | MACHINE_DRIVER_END |
| 1628 | 1619 | |
| 1629 | | MACHINE_DRIVER_START(ultimax_cartslot) |
| 1620 | MACHINE_DRIVER_START( ultimax_cartslot ) |
| 1630 | 1621 | MDRV_CARTSLOT_ADD("cart") |
| 1631 | 1622 | MDRV_CARTSLOT_EXTENSION_LIST("crt,e0,f0") |
| 1632 | 1623 | MDRV_CARTSLOT_MANDATORY |