src/mess/drivers/apf.c
| r1614 | r1615 | |
| 9 | 9 | #include "machine/wd17xx.h" |
| 10 | 10 | #include "devices/basicdsk.h" |
| 11 | 11 | #include "devices/cassette.h" |
| 12 | #include "devices/cartslot.h" |
| 12 | 13 | #include "formats/apf_apt.h" |
| 13 | 14 | #include "sound/speaker.h" |
| 14 | 15 | |
| r1614 | r1615 | |
| 37 | 38 | |
| 38 | 39 | static READ8_HANDLER(apf_m1000_pia_in_a_func) |
| 39 | 40 | { |
| 40 | | return pad_data; |
| 41 | |
| 42 | UINT8 data=~0; |
| 43 | if (!(pad_data & 0x08)) |
| 44 | data &= readinputportbytag("joy3"); |
| 45 | if (!(pad_data & 0x04)) |
| 46 | data &= readinputportbytag("joy2"); |
| 47 | if (!(pad_data & 0x02)) |
| 48 | data &= readinputportbytag("joy1"); |
| 49 | if (!(pad_data & 0x01)) |
| 50 | data &= readinputportbytag("joy0"); |
| 51 | |
| 52 | return data; |
| 41 | 53 | } |
| 42 | 54 | |
| 43 | 55 | static READ8_HANDLER(apf_m1000_pia_in_b_func) |
| r1614 | r1615 | |
| 74 | 86 | |
| 75 | 87 | static WRITE8_HANDLER(apf_m1000_pia_out_b_func) |
| 76 | 88 | { |
| 77 | | pad_data = 0x0ff; |
| 89 | pad_data = data; |
| 78 | 90 | |
| 79 | 91 | /* bit 7..4 video control */ |
| 80 | 92 | /* bit 3..0 keypad line select */ |
| 81 | | if (data & 0x08) |
| 82 | | pad_data &= readinputportbytag("joy3"); |
| 83 | | if (data & 0x04) |
| 84 | | pad_data &= readinputportbytag("joy2"); |
| 85 | | if (data & 0x02) |
| 86 | | pad_data &= readinputportbytag("joy1"); |
| 87 | | if (data & 0x01) |
| 88 | | pad_data &= readinputportbytag("joy0"); |
| 89 | 93 | |
| 90 | 94 | /* 1b standard, 5b, db */ |
| 91 | 95 | /* 0001 */ |
| r1614 | r1615 | |
| 135 | 139 | { |
| 136 | 140 | if (state) |
| 137 | 141 | { |
| 138 | | apf_ints|=1; |
| 142 | apf_ints|=1; |
| 139 | 143 | } |
| 140 | 144 | else |
| 141 | 145 | { |
| r1614 | r1615 | |
| 152 | 156 | |
| 153 | 157 | if (state) |
| 154 | 158 | { |
| 155 | | apf_ints|=2; |
| 159 | apf_ints|=2; |
| 156 | 160 | } |
| 157 | 161 | else |
| 158 | 162 | { |
| r1614 | r1615 | |
| 410 | 414 | AM_RANGE( 0x02000, 0x03fff) AM_READWRITE(pia_0_r, pia_0_w) |
| 411 | 415 | AM_RANGE( 0x04000, 0x047ff) AM_ROM AM_REGION(REGION_CPU1, 0x10000) AM_MIRROR(0x1800) |
| 412 | 416 | AM_RANGE( 0x06800, 0x077ff) AM_ROM |
| 413 | | AM_RANGE( 0x08000, 0x09fff) AM_ROM |
| 417 | AM_RANGE( 0x08000, 0x09fff) AM_ROM AM_REGION(REGION_CPU1, 0x8000) |
| 414 | 418 | AM_RANGE( 0x0a000, 0x0dfff) AM_RAM |
| 415 | 419 | AM_RANGE( 0x0e000, 0x0e7ff) AM_ROM AM_REGION(REGION_CPU1, 0x10000) AM_MIRROR(0x1800) |
| 416 | 420 | ADDRESS_MAP_END |
| r1614 | r1615 | |
| 461 | 465 | |
| 462 | 466 | */ |
| 463 | 467 | |
| 468 | /* |
| 469 | ? player right is player 1 |
| 470 | */ |
| 471 | |
| 464 | 472 | /* line 0 */ |
| 465 | 473 | PORT_START_TAG("joy0") |
| 466 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("q") PORT_CODE(KEYCODE_Q) |
| 467 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("w") PORT_CODE(KEYCODE_W) |
| 468 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("e") PORT_CODE(KEYCODE_E) |
| 469 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("r") PORT_CODE(KEYCODE_R) |
| 470 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("t") PORT_CODE(KEYCODE_T) |
| 471 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("y") PORT_CODE(KEYCODE_Y) |
| 472 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("u") PORT_CODE(KEYCODE_U) |
| 473 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("i") PORT_CODE(KEYCODE_I) |
| 474 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 1") PORT_CODE(KEYCODE_1) PORT_PLAYER(1) |
| 475 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 0") PORT_CODE(KEYCODE_0) PORT_PLAYER(1) |
| 476 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 4") PORT_CODE(KEYCODE_4) PORT_PLAYER(1) |
| 477 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 7") PORT_CODE(KEYCODE_7) PORT_PLAYER(1) |
| 478 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 1") PORT_CODE(KEYCODE_1_PAD) PORT_PLAYER(2) |
| 479 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 0") PORT_CODE(KEYCODE_0_PAD) PORT_PLAYER(2) |
| 480 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 4") PORT_CODE(KEYCODE_4_PAD) PORT_PLAYER(2) |
| 481 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 7") PORT_CODE(KEYCODE_7_PAD) PORT_PLAYER(2) |
| 474 | 482 | |
| 475 | 483 | /* line 1 */ |
| 476 | 484 | PORT_START_TAG("joy1") |
| 477 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("o") PORT_CODE(KEYCODE_O) |
| 478 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("p") PORT_CODE(KEYCODE_P) |
| 479 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("a") PORT_CODE(KEYCODE_A) |
| 480 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("s") PORT_CODE(KEYCODE_S) |
| 481 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("d") PORT_CODE(KEYCODE_D) |
| 482 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("f") PORT_CODE(KEYCODE_F) |
| 483 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("g") PORT_CODE(KEYCODE_G) |
| 484 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("h") PORT_CODE(KEYCODE_H) |
| 485 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("PAD 1/RIGHT down") PORT_PLAYER(1) PORT_8WAY |
| 486 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("PAD 1/RIGHT left?") PORT_PLAYER(1) PORT_8WAY |
| 487 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("PAD 1/RIGHT up") PORT_PLAYER(1) PORT_8WAY |
| 488 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("PAD 1/RIGHT right?") PORT_PLAYER(1) PORT_8WAY |
| 489 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("PAD 2/LEFT down") PORT_PLAYER(2) PORT_8WAY |
| 490 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("PAD 2/LEFT left?") PORT_PLAYER(2) PORT_8WAY |
| 491 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("PAD 2/LEFT up") PORT_PLAYER(2) PORT_8WAY |
| 492 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("PAD 2/LEFT right?") PORT_PLAYER(2) PORT_8WAY |
| 485 | 493 | |
| 486 | 494 | /* line 2 */ |
| 487 | 495 | PORT_START_TAG("joy2") |
| 488 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("j") PORT_CODE(KEYCODE_J) |
| 489 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("k") PORT_CODE(KEYCODE_K) |
| 490 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("l") PORT_CODE(KEYCODE_L) |
| 491 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("z") PORT_CODE(KEYCODE_Z) |
| 492 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("x") PORT_CODE(KEYCODE_X) |
| 493 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("c") PORT_CODE(KEYCODE_C) |
| 494 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("v") PORT_CODE(KEYCODE_V) |
| 495 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("b") PORT_CODE(KEYCODE_B) |
| 496 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 3") PORT_CODE(KEYCODE_3) PORT_PLAYER(1) |
| 497 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT clear") PORT_CODE(KEYCODE_DEL) PORT_PLAYER(1) |
| 498 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 6") PORT_CODE(KEYCODE_6) PORT_PLAYER(1) |
| 499 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 9") PORT_CODE(KEYCODE_9) PORT_PLAYER(1) |
| 500 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 3") PORT_CODE(KEYCODE_3_PAD) PORT_PLAYER(2) |
| 501 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT clear") PORT_CODE(KEYCODE_DEL_PAD) PORT_PLAYER(2) |
| 502 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 6") PORT_CODE(KEYCODE_6_PAD) PORT_PLAYER(2) |
| 503 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 9") PORT_CODE(KEYCODE_9_PAD) PORT_PLAYER(2) |
| 496 | 504 | |
| 497 | 505 | /* line 3 */ |
| 498 | 506 | PORT_START_TAG("joy3") |
| 499 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("n") PORT_CODE(KEYCODE_N) |
| 500 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("m") PORT_CODE(KEYCODE_M) |
| 501 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| 502 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| 503 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("3") PORT_CODE(KEYCODE_3) |
| 504 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 505 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 506 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 507 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 2") PORT_CODE(KEYCODE_2) PORT_PLAYER(1) |
| 508 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT enter/fire") PORT_CODE(KEYCODE_ENTER) PORT_PLAYER(1) |
| 509 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 5") PORT_CODE(KEYCODE_5) PORT_PLAYER(1) |
| 510 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 8") PORT_CODE(KEYCODE_8) PORT_PLAYER(1) |
| 511 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 2") PORT_CODE(KEYCODE_2_PAD) PORT_PLAYER(2) |
| 512 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT enter/fire") PORT_CODE(KEYCODE_ENTER_PAD) PORT_PLAYER(2) |
| 513 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 5") PORT_CODE(KEYCODE_5_PAD) PORT_PLAYER(2) |
| 514 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 8") PORT_CODE(KEYCODE_8_PAD) PORT_PLAYER(2) |
| 507 | 515 | |
| 508 | 516 | INPUT_PORTS_END |
| 509 | 517 | |
| r1614 | r1615 | |
| 657 | 665 | ROM_START(apfm1000) |
| 658 | 666 | ROM_REGION(0x10000+0x0800,REGION_CPU1,0) |
| 659 | 667 | ROM_LOAD("apf_4000.rom",0x010000, 0x0800, CRC(2a331a33) SHA1(387b90882cd0b66c192d9cbaa3bec250f897e4f1)) |
| 668 | // ROM_LOAD("apf-m1000rom.bin",0x010000, 0x0800, CRC(cc6ac840) SHA1(1110a234bcad99bd0894ad44c591389d16376ca4)) |
| 660 | 669 | ROM_END |
| 661 | 670 | |
| 662 | 671 | static void apfimag_cassette_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) |
| r1614 | r1615 | |
| 692 | 701 | } |
| 693 | 702 | } |
| 694 | 703 | |
| 704 | static int device_load_apfm1000_cart(mess_image *image) |
| 705 | { |
| 706 | UINT8 *rom = memory_region(REGION_CPU1)+0x8000; |
| 707 | int size; |
| 708 | |
| 709 | size = image_length(image); |
| 710 | |
| 711 | if (image_fread(image, rom, size) != size) |
| 712 | { |
| 713 | logerror("%s load error\n", image_filename(image)); |
| 714 | return 1; |
| 715 | } |
| 716 | |
| 717 | |
| 718 | return 0; |
| 719 | } |
| 720 | |
| 721 | static void apfm1000_cartslot_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) |
| 722 | { |
| 723 | /* cartslot */ |
| 724 | switch(state) |
| 725 | { |
| 726 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 727 | case DEVINFO_INT_COUNT: info->i = 1; break; |
| 728 | |
| 729 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 730 | case DEVINFO_PTR_LOAD: info->load = device_load_apfm1000_cart; break; |
| 731 | // case DEVINFO_PTR_PARTIAL_HASH: info->partialhash = lynx_partialhash; break; |
| 732 | |
| 733 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 734 | case DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "bin"); break; |
| 735 | |
| 736 | default: cartslot_device_getinfo(devclass, state, info); break; |
| 737 | } |
| 738 | } |
| 739 | |
| 695 | 740 | SYSTEM_CONFIG_START( apfimag ) |
| 696 | 741 | CONFIG_DEVICE(apfimag_cassette_getinfo) |
| 697 | 742 | CONFIG_DEVICE(apfimag_floppy_getinfo) |
| 698 | 743 | SYSTEM_CONFIG_END |
| 699 | 744 | |
| 745 | SYSTEM_CONFIG_START(apfm1000) |
| 746 | CONFIG_DEVICE(apfm1000_cartslot_getinfo) |
| 747 | SYSTEM_CONFIG_END |
| 748 | |
| 700 | 749 | /*************************************************************************** |
| 701 | 750 | |
| 702 | 751 | Game driver(s) |
| r1614 | r1615 | |
| 705 | 754 | |
| 706 | 755 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 707 | 756 | COMP(1977, apfimag, 0, 0, apf_imagination, apf_imagination, 0, apfimag, "APF Electronics Inc", "APF Imagination Machine" ,GAME_NOT_WORKING) |
| 708 | | COMP(1978, apfm1000, 0, 0, apf_m1000, apf_m1000, 0, NULL, "APF Electronics Inc", "APF M-1000" ,GAME_NOT_WORKING) |
| 757 | CONS(1978, apfm1000, 0, 0, apf_m1000, apf_m1000, 0, apfm1000, "APF Electronics Inc", "APF M-1000" ,GAME_NOT_WORKING) |