Previous 15994 Revisions Next

r1615 Sunday 27th January, 2008 at 16:56:17 UTC by PeT
apfm1000: added cartridge support, fixed and nearly finished pads
[src/mess/drivers]apf.c

src/mess/drivers/apf.c
r1614r1615
99#include "machine/wd17xx.h"
1010#include "devices/basicdsk.h"
1111#include "devices/cassette.h"
12#include "devices/cartslot.h"
1213#include "formats/apf_apt.h"
1314#include "sound/speaker.h"
1415
r1614r1615
3738
3839static  READ8_HANDLER(apf_m1000_pia_in_a_func)
3940{
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;
4153}
4254
4355static  READ8_HANDLER(apf_m1000_pia_in_b_func)
r1614r1615
7486
7587static WRITE8_HANDLER(apf_m1000_pia_out_b_func)
7688{
77   pad_data = 0x0ff;
89   pad_data = data;
7890
7991   /* bit 7..4 video control */
8092   /* 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");
8993
9094   /* 1b standard, 5b, db */
9195   /* 0001 */
r1614r1615
135139{
136140   if (state)
137141   {
138      apf_ints|=1;
142        apf_ints|=1;
139143   }
140144   else
141145   {
r1614r1615
152156
153157   if (state)
154158   {
155      apf_ints|=2;
159        apf_ints|=2;
156160   }
157161   else
158162   {
r1614r1615
410414   AM_RANGE( 0x02000, 0x03fff) AM_READWRITE(pia_0_r, pia_0_w)
411415   AM_RANGE( 0x04000, 0x047ff) AM_ROM AM_REGION(REGION_CPU1, 0x10000) AM_MIRROR(0x1800)
412416   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)
414418   AM_RANGE( 0x0a000, 0x0dfff) AM_RAM
415419   AM_RANGE( 0x0e000, 0x0e7ff) AM_ROM AM_REGION(REGION_CPU1, 0x10000) AM_MIRROR(0x1800)
416420ADDRESS_MAP_END
r1614r1615
461465
462466    */
463467
468/*
469  ? player right is player 1
470 */
471
464472   /* line 0 */
465473   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)
474482
475483   /* line 1 */
476484   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
485493
486494   /* line 2 */
487495   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)
496504
497505   /* line 3 */
498506   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)
507515
508516INPUT_PORTS_END
509517
r1614r1615
657665ROM_START(apfm1000)
658666   ROM_REGION(0x10000+0x0800,REGION_CPU1,0)
659667   ROM_LOAD("apf_4000.rom",0x010000, 0x0800, CRC(2a331a33) SHA1(387b90882cd0b66c192d9cbaa3bec250f897e4f1))
668//   ROM_LOAD("apf-m1000rom.bin",0x010000, 0x0800, CRC(cc6ac840) SHA1(1110a234bcad99bd0894ad44c591389d16376ca4))
660669ROM_END
661670
662671static void apfimag_cassette_getinfo(const device_class *devclass, UINT32 state, union devinfo *info)
r1614r1615
692701   }
693702}
694703
704static 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
721static 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
695740SYSTEM_CONFIG_START( apfimag )
696741   CONFIG_DEVICE(apfimag_cassette_getinfo)
697742   CONFIG_DEVICE(apfimag_floppy_getinfo)
698743SYSTEM_CONFIG_END
699744
745SYSTEM_CONFIG_START(apfm1000)
746   CONFIG_DEVICE(apfm1000_cartslot_getinfo)
747SYSTEM_CONFIG_END
748
700749/***************************************************************************
701750
702751  Game driver(s)
r1614r1615
705754
706755/*    YEAR  NAME        PARENT  COMPAT  MACHINE             INPUT               INIT    CONFIG      COMPANY               FULLNAME */
707756COMP(1977, apfimag,   0,      0,      apf_imagination,   apf_imagination,   0,      apfimag,   "APF Electronics Inc",  "APF Imagination Machine" ,GAME_NOT_WORKING)
708COMP(1978,   apfm1000,   0,      0,      apf_m1000,         apf_m1000,         0,      NULL,      "APF Electronics Inc",  "APF M-1000" ,GAME_NOT_WORKING)
757CONS(1978,   apfm1000,   0,      0,      apf_m1000,         apf_m1000,         0,      apfm1000,      "APF Electronics Inc",  "APF M-1000" ,GAME_NOT_WORKING)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team