diff options
-rw-r--r-- | .gitattributes | 8 | ||||
-rw-r--r-- | hash/apfm1000.xml | 38 | ||||
-rw-r--r-- | hash/channelf.xml | 66 | ||||
-rw-r--r-- | src/emu/bus/apf/rom.c | 76 | ||||
-rw-r--r-- | src/emu/bus/apf/rom.h | 60 | ||||
-rw-r--r-- | src/emu/bus/apf/slot.c | 296 | ||||
-rw-r--r-- | src/emu/bus/apf/slot.h | 115 | ||||
-rw-r--r-- | src/emu/bus/bus.mak | 24 | ||||
-rw-r--r-- | src/emu/bus/chanf/rom.c | 206 | ||||
-rw-r--r-- | src/emu/bus/chanf/rom.h | 119 | ||||
-rw-r--r-- | src/emu/bus/chanf/slot.c | 285 | ||||
-rw-r--r-- | src/emu/bus/chanf/slot.h | 117 | ||||
-rw-r--r-- | src/mess/drivers/apf.c | 178 | ||||
-rw-r--r-- | src/mess/drivers/channelf.c | 194 | ||||
-rw-r--r-- | src/mess/includes/channelf.h | 47 | ||||
-rw-r--r-- | src/mess/mess.mak | 2 |
16 files changed, 1558 insertions, 273 deletions
diff --git a/.gitattributes b/.gitattributes index 7a645e8bfa3..34177686c7b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -577,6 +577,10 @@ src/emu/bus/amiga/zorro/cards.c svneol=native#text/plain src/emu/bus/amiga/zorro/cards.h svneol=native#text/plain src/emu/bus/amiga/zorro/zorro.c svneol=native#text/plain src/emu/bus/amiga/zorro/zorro.h svneol=native#text/plain +src/emu/bus/apf/rom.c svneol=native#text/plain +src/emu/bus/apf/rom.h svneol=native#text/plain +src/emu/bus/apf/slot.c svneol=native#text/plain +src/emu/bus/apf/slot.h svneol=native#text/plain src/emu/bus/bml3/bml3bus.c svneol=native#text/plain src/emu/bus/bml3/bml3bus.h svneol=native#text/plain src/emu/bus/bml3/bml3kanji.c svneol=native#text/plain @@ -778,6 +782,10 @@ src/emu/bus/centronics/epson_lx800.c svneol=native#text/plain src/emu/bus/centronics/epson_lx800.h svneol=native#text/plain src/emu/bus/centronics/printer.c svneol=native#text/plain src/emu/bus/centronics/printer.h svneol=native#text/plain +src/emu/bus/chanf/rom.c svneol=native#text/plain +src/emu/bus/chanf/rom.h svneol=native#text/plain +src/emu/bus/chanf/slot.c svneol=native#text/plain +src/emu/bus/chanf/slot.h svneol=native#text/plain src/emu/bus/coco/coco_232.c svneol=native#text/plain src/emu/bus/coco/coco_232.h svneol=native#text/plain src/emu/bus/coco/coco_fdc.c svneol=native#text/plain diff --git a/hash/apfm1000.xml b/hash/apfm1000.xml index 197b6b83065..ac5b3b0e86b 100644 --- a/hash/apfm1000.xml +++ b/hash/apfm1000.xml @@ -7,6 +7,7 @@ <publisher>APF</publisher> <info name="serial" value="MG1008" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="backgmmn.bin" size="4096" crc="811c6269" sha1="f820334bb6df9b856f54f1957b60a5e70bdd6d7e" offset="0" /> </dataarea> @@ -19,6 +20,7 @@ <publisher>APF</publisher> <info name="serial" value="MG1006" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="baseball.bin" size="4096" crc="1fb354b7" sha1="2c93d8e764b1e1dfdc1bde7888b385cc28064f86" offset="0" /> </dataarea> @@ -31,6 +33,7 @@ <publisher>APF</publisher> <info name="serial" value="MG1007" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="blackjck.bin" size="4096" crc="38faa709" sha1="1a99f4781ce4604a550f4ec9d8559e3456303464" offset="0" /> </dataarea> @@ -43,6 +46,7 @@ <publisher>APF</publisher> <info name="serial" value="MG1004" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="bowling.bin" size="4096" crc="cca5836b" sha1="4ff1c4ffa46c543bbf48a519a4285b5d2c697ae3" offset="0" /> </dataarea> @@ -55,6 +59,7 @@ <publisher>APF</publisher> <info name="serial" value="MG1012" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="boxing.bin" size="4096" crc="7121f8b1" sha1="e7ae8571b496444ded77aaaa3c1d5f5ee97c651f" offset="0" /> </dataarea> @@ -67,6 +72,7 @@ <publisher>APF</publisher> <info name="serial" value="MG1005" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="brickdwn.bin" size="2048" crc="bc1f5b8b" sha1="3e2f1e93501cd0dd2c9b747c594b784360e5b175" offset="0" /> </dataarea> @@ -79,6 +85,7 @@ <publisher>APF</publisher> <info name="serial" value="MG1009" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="casino.bin" size="4096" crc="21d5f63f" sha1="fa34ebdb799ccd2bff9f63ce4189a4ee690706fa" offset="0" /> </dataarea> @@ -91,6 +98,7 @@ <publisher>APF</publisher> <info name="serial" value="MG1001" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="catena.bin" size="2048" crc="6baad95f" sha1="b63ad3a60b59aad9b4605ff96f77839565144278" offset="0" /> </dataarea> @@ -103,6 +111,7 @@ <publisher>APF</publisher> <info name="serial" value="MG1002" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="catenaa.bin" size="2048" crc="5d03a812" sha1="29db4ca3c8b76c413b84b6d2bfd3499a70eccd3d" offset="0" /> </dataarea> @@ -115,6 +124,7 @@ <publisher>APF</publisher> <info name="serial" value="MG1003" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="hangman.bin" size="4096" crc="e58a5d5b" sha1="205d659db0e0ab0292d33b5b4a9c2b46ca9d1dd5" offset="0" /> </dataarea> @@ -127,6 +137,7 @@ <publisher>APF</publisher> <info name="serial" value="MG1011" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="pinball.bin" size="4096" crc="3f4b8c83" sha1="1f5bca6e96777ccbe830d1143a3549f51a3e386e" offset="0" /> </dataarea> @@ -157,7 +168,7 @@ $9C00 to $9FFF 1k empty space (39936 to 40959) --> <part name="cart" interface="apfm1000_cart"> - <feature name="ram" value="1"/> + <feature name="slot" value="spacedst"/> <dataarea name="rom" size="8192"> <rom name="apf1013a.bin" size="4096" crc="f25215a0" sha1="72da492092b883eb31cffb41ea353e919c86d285" offset="0" /> <rom name="apf1013b.bin" size="2048" crc="8c3a9faa" sha1="b3cfc23c65558ef7b67c9afa01a306c8123e227f" offset="0x1000" /> @@ -167,12 +178,13 @@ $9C00 to $9FFF 1k empty space (39936 to 40959) </part> </software> - <software name="ufo" supported="yes"> + <software name="ufo"> <description>Ufo / Sea Monsters / Break It Down / Rebuild / Shoot</description> <year>1979</year> <publisher>APF</publisher> <info name="serial" value="MG1010" /> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="ufo.bin" size="4096" crc="0504d667" sha1="6e33593f9e7a4551bc31b347741d9ff87ce618ca" offset="0" /> </dataarea> @@ -181,11 +193,12 @@ $9C00 to $9FFF 1k empty space (39936 to 40959) <!-- Homebrew --> - <software name="chardump" supported="yes"> + <software name="chardump"> <description>Character Dump</description> <year>2010</year> <publisher>Adam Trionfo</publisher> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="chardump.bin" size="4096" crc="27bd1c3c" sha1="826b608b6c33798942bd716928eef70cc8e83bda" offset="0" /> </dataarea> @@ -205,33 +218,36 @@ $9C00 to $9FFF 1k empty space (39936 to 40959) </part> </software> - <software name="movblock" supported="yes"> + <software name="movblock"> <description>Move Block</description> <year>2010</year> <publisher>Adam Trionfo</publisher> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="movblock.bin" size="4096" crc="f77f72f4" sha1="2cf3a82d584b2a2e4c7e5ae751da8d0255c2295a" offset="0" /> </dataarea> </part> </software> - <software name="mblock02" supported="yes"> + <software name="mblock02"> <description>Move Block 2</description> <year>2010</year> <publisher>Adam Trionfo</publisher> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="mblock02.bin" size="4096" crc="cf63865a" sha1="8c8e6924ab511d69a31eb52faaaad5efb7888f33" offset="0" /> </dataarea> </part> </software> - <software name="readpia" supported="yes"> + <software name="readpia"> <description>Read PIA</description> <year>2010</year> <publisher>Adam Trionfo</publisher> <part name="cart" interface="apfm1000_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="readpia.bin" size="4096" crc="700c1e39" sha1="701c4f8a9fc20c8f28a5c0562592ed873d9d9ab4" offset="0" /> </dataarea> @@ -240,13 +256,13 @@ $9C00 to $9FFF 1k empty space (39936 to 40959) <!-- apfimag only --> - <software name="basic" supported="yes"> + <software name="basic"> <description>APF Basic</description> <year>1979</year> <publisher>APF</publisher> <info name="serial" value="AL100A" /> <part name="cart" interface="apfm1000_cart"> - <feature name="ram" value="8"/> + <feature name="slot" value="basic"/> <dataarea name="rom" size="12288"> <rom name="basic_80.rom" size="8192" crc="a4c69fae" sha1="7f98aa482589bf7c5a26d338fec105e797ba43f6" offset="0" /> <rom name="basic_68.rom" size="4096" crc="5f30370b" sha1="cf11bd975749b88df4d82cd460035cb92563ceff" offset="0x2000" /> @@ -254,12 +270,12 @@ $9C00 to $9FFF 1k empty space (39936 to 40959) </part> </software> - <software name="ebasic" supported="yes"> + <software name="ebasic"> <description>Extended Basic</description> <year>1983</year> - <publisher>R.L.Recker</publisher> + <publisher>R.L. Recker</publisher> <part name="cart" interface="apfm1000_cart"> - <feature name="ram" value="8"/> + <feature name="slot" value="basic"/> <dataarea name="rom" size="14336"> <rom name="basic_80.bin" size="8192" crc="3fefbd81" sha1="d8c3ea8a152da50f71b98c464f47919e16743d29" offset="0" /> <rom name="basic_68.bin" size="4096" crc="e99b5102" sha1="62a79dc5f25a60d9007c90adf778fba432dfb900" offset="0x2000" /> diff --git a/hash/channelf.xml b/hash/channelf.xml index bdde8a2fd0c..088dea2f29b 100644 --- a/hash/channelf.xml +++ b/hash/channelf.xml @@ -8,6 +8,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Democart 1" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="democrt1.bin" size="2048" crc="42727ad5" sha1="e462e594c14cdb10ddc4c263b74e753316c3b358" offset="0" /> </dataarea> @@ -20,6 +21,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Democart 2" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="democrt2.bin" size="2048" crc="44cf1d89" sha1="13a5ca0471e6f4a7a5a2fc4d2b8f881516a28ec4" offset="0" /> </dataarea> @@ -32,6 +34,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 1" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="tctactoe.bin" size="2048" crc="ff4768b0" sha1="8edfb668b3eb759f8597fb13b1aeaf43aaf53680" offset="0" /> </dataarea> @@ -44,6 +47,7 @@ <publisher>SABA</publisher> <info name="series" value="Videocart 1" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="muehle.bin" size="2048" crc="7124dc59" sha1="15d5e6d152d93a2099b97a2bd5dcf7134dd1a770" offset="0" /> </dataarea> @@ -56,6 +60,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 2" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="dsrtfox.bin" size="2048" crc="1570934b" sha1="3440928903f39354e1358018cebf12a00c8dff77" offset="0" /> </dataarea> @@ -68,6 +73,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 3" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="vblckjck.bin" size="2048" crc="e98d4456" sha1="86579196567c9686009ad271263269181496a9c7" offset="0" /> </dataarea> @@ -80,6 +86,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 4" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="spitfire.bin" size="2048" crc="5357c5f6" sha1="9af18e7fa3b2d040f33cbe2286392ce5fe31d0df" offset="0" /> </dataarea> @@ -91,6 +98,7 @@ <year>1976</year> <publisher>Fairchild</publisher> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="spitfire (proto).bin" size="2048" crc="0a728afc" sha1="66e2d158095721c0c9b4d50de4a6d9925ec62c73" offset="0" /> </dataarea> @@ -103,6 +111,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 5" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="spacewar.bin" size="2048" crc="22ef49e8" sha1="c1d83b1e89d11465456bd5829a85db06c4ef322f" offset="0" /> </dataarea> @@ -115,6 +124,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 6" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="mthquiz1.bin" size="2048" crc="bb4c24a2" sha1="f0bfdc8f6beed2ef54add820c5e164005d2d1d25" offset="0" /> </dataarea> @@ -127,6 +137,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 7" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="mthquiz2.bin" size="2048" crc="4aa7ea97" sha1="4c643e00f32629c066e778be92f37e3f7bfd1ad6" offset="0" /> </dataarea> @@ -139,6 +150,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 8" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="magicnum.bin" size="2048" crc="24da0529" sha1="4b696a4f8a20f6dcd6a4ba690756d862956515a4" offset="0" /> </dataarea> @@ -151,6 +163,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 9" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="dragrace.bin" size="2048" crc="6a64dda3" sha1="d915c8997f56ae09548498feecebf3c3bfcdf6c4" offset="0" /> </dataarea> @@ -163,9 +176,12 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 10" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="maze" /> <dataarea name="rom" size="2048"> <rom name="maze.bin" size="2048" crc="4d42b296" sha1="a7b70fb6f24bb1dd79f2cbb1e57b3edb04332e04" offset="0" /> </dataarea> + <dataarea name="ram" size="1024"> + </dataarea> </part> </software> @@ -175,9 +191,12 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 10" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="maze" /> <dataarea name="rom" size="2048"> <rom name="mazealt.bin" size="2048" crc="0a948b61" sha1="b53ba16c6d91e2f62e020d18445217b91907a83b" offset="0" /> </dataarea> + <dataarea name="ram" size="1024"> + </dataarea> </part> </software> @@ -187,6 +206,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 11" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="backgmmn.bin" size="2048" crc="a1731b52" sha1="9ac23df58c95bdbe68e3a0d0a477f07cd4e951d0" offset="0" /> </dataarea> @@ -200,6 +220,7 @@ <info name="series" value="Videocart 12" /> <info name="usage" value="Hit CTRL and A to start." /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="baseball.bin" size="2048" crc="01129bcd" sha1="9b0c9bd3e52da22ca7f2aab6fbb5f3c24f89ef75" offset="0" /> </dataarea> @@ -212,6 +233,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 13" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="robotwar.bin" size="2048" crc="38241e4f" sha1="87f3f9afcc232d767cf6a5040c88b31283f76199" offset="0" /> </dataarea> @@ -223,6 +245,7 @@ <year>1977</year> <publisher>Fairchild</publisher> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="robot war (proto).bin" size="2048" crc="7f62a23c" sha1="7e5966c1c393dc1b02ac34d57733a357bbcd4d5c" offset="0" /> </dataarea> @@ -235,6 +258,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 14" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="sonrsrch.bin" size="2048" crc="dbdc56bf" sha1="a15449eec75382af6dd71e766cae1171308d192c" offset="0" /> </dataarea> @@ -247,6 +271,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 15" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="mmrymtch.bin" size="2048" crc="104b5e18" sha1="e46406119020c85002513b1c01352f76dcd604a4" offset="0" /> </dataarea> @@ -259,6 +284,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 16" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="dodgeit.bin" size="2048" crc="e3c1811c" sha1="54fdab06a07f84d073858f56a054a59ec0b1142e" offset="0" /> </dataarea> @@ -271,6 +297,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 17" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="pinball.bin" size="2048" crc="c610b330" sha1="9267d85982414af753172e4c9998863463c32c99" offset="0" /> </dataarea> @@ -283,6 +310,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 17" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="pinballa.bin" size="2048" crc="7cadf0fd" sha1="cc69feb8243e6fce3e6317bf9ea82d70a85eae1c" offset="0" /> </dataarea> @@ -295,9 +323,12 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 18" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="hangman" /> <dataarea name="rom" size="3072"> <rom name="hangman.bin" size="3072" crc="9238d6ce" sha1="19166d49dec273cae1f2dbac983b130d282ed231" offset="0" /> </dataarea> + <dataarea name="ram" size="1024"> + </dataarea> </part> </software> @@ -307,9 +338,12 @@ <publisher>Luxor</publisher> <info name="series" value="Luxor 18" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="hangman" /> <dataarea name="rom" size="3072"> <rom name="ordtvlng.bin" size="3072" crc="3a386e79" sha1="62509545b8eef641c432705ff82cd8264c3e1d82" offset="0" /> </dataarea> + <dataarea name="ram" size="1024"> + </dataarea> </part> </software> @@ -319,9 +353,12 @@ <publisher>SABA</publisher> <info name="series" value="SABA 16" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="hangman" /> <dataarea name="rom" size="3072"> <rom name="ratmal.bin" size="3072" crc="87752425" sha1="35f3fb741b643c4b8e8fdbff4ed0ea24402c4528" offset="0" /> </dataarea> + <dataarea name="ram" size="1024"> + </dataarea> </part> </software> @@ -331,6 +368,7 @@ <publisher>Zircon</publisher> <info name="series" value="Videocart 19" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="checkers.bin" size="2048" crc="fdae7044" sha1="2683b330dc2350341a51f1e3bdf75922bb425a9e" offset="0" /> </dataarea> @@ -343,6 +381,7 @@ <publisher>Fairchild</publisher> <info name="series" value="Videocart 20" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="3072"> <rom name="vwhzball.bin" size="3072" crc="65fdfe49" sha1="61babb950ebc0b0acab29acf5dcbecc60dcd70a3" offset="0" /> </dataarea> @@ -355,9 +394,12 @@ <publisher>SABA</publisher> <info name="series" value="SABA 20" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="chess" /> <dataarea name="rom" size="6144"> <rom name="schach.bin" size="6144" crc="04fb6dce" sha1="cbbaa8522fee16a0cc13ed3140d41e22919da24b" offset="0" /> </dataarea> + <dataarea name="ram" size="2048"> + </dataarea> </part> </software> @@ -367,6 +409,7 @@ <publisher>Fairchild/Zircon</publisher> <info name="series" value="Videocart 21" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="bowling.bin" size="2048" crc="94322c79" sha1="82d49201ee82e8cba6a907aca80969796a84d7f4" offset="0" /> </dataarea> @@ -379,6 +422,7 @@ <publisher>Zircon</publisher> <info name="series" value="Videocart 22" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="slotmchn.bin" size="2048" crc="b7eabd08" sha1="97e12dba298460ce466509e9aefb82fe2503ef6f" offset="0" /> </dataarea> @@ -391,6 +435,7 @@ <publisher>Zircon</publisher> <info name="series" value="Videocart 23" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="galactic.bin" size="2048" crc="c8ef3410" sha1="fc3cadc90d73ce7e3b32b5c9a855d621e79c592a" offset="0" /> </dataarea> @@ -402,6 +447,7 @@ <year>1980</year> <publisher>Zircon</publisher> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="glactic space war (proto).bin" size="2048" crc="a61258a8" sha1="7077e42b2e8a101da05bb2188d7b65858ca8ec1e" offset="0" /> </dataarea> @@ -414,6 +460,7 @@ <publisher>Zircon</publisher> <info name="series" value="Videocart 24" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="pfootbll.bin" size="4096" crc="a1ae99be" sha1="9be97cace9b99f15a373bd95f3996034d633fff5" offset="0" /> </dataarea> @@ -425,6 +472,7 @@ <year>1981</year> <publisher>Zircon</publisher> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="football (proto).bin" size="4096" crc="7e5dafea" sha1="db17bbc4f3f64bc5cb698de66b0f4838be430afa" offset="0" /> </dataarea> @@ -437,6 +485,7 @@ <publisher>Zircon</publisher> <info name="series" value="Videocart 25" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="casinop.bin" size="4096" crc="5aa30c12" sha1="4540b1cfca461d6eba26754c34090aa74822a4bd" offset="0" /> </dataarea> @@ -448,6 +497,7 @@ <year>1980</year> <publisher>Zircon</publisher> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="draw poker (proto).bin" size="4096" crc="619fcc00" sha1="f1bd458f1efc4e9afe06db190a2a7ddb660418bf" offset="0" /> </dataarea> @@ -460,6 +510,7 @@ <publisher>Zircon</publisher> <info name="series" value="Videocart 26" /> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="4096"> <rom name="alieninv.bin" size="4096" crc="85e00865" sha1="1837e95e6631687fc6d008207e56a31705d55cdf" offset="0" /> </dataarea> @@ -471,10 +522,25 @@ <year>19??</year> <publisher>Zircon</publisher> <part name="cart" interface="channelf_cart"> + <feature name="slot" value="std" /> <dataarea name="rom" size="2048"> <rom name="color organ (proto).bin" size="2048" crc="3fa2d4eb" sha1="1ccc13a2f4aeb4538379d77d08ac7bf425bc4780" offset="0" /> </dataarea> </part> </software> + + <software name="multicrt"> + <description>Channel F Multi-Cart</description> + <year>2004</year> + <publisher><homebrew></publisher> + <part name="cart" interface="channelf_cart"> + <feature name="slot" value="multi" /> + <dataarea name="rom" size="262144"> + <rom name="multigame rom.bin" size="262144" crc="a1ecbd58" sha1="d8d266846a01db69c0bb436093634ada7558f37f" offset="0" /> + </dataarea> + </part> + </software> + + </softwarelist> diff --git a/src/emu/bus/apf/rom.c b/src/emu/bus/apf/rom.c new file mode 100644 index 00000000000..80e302ef3e7 --- /dev/null +++ b/src/emu/bus/apf/rom.c @@ -0,0 +1,76 @@ +/*********************************************************************************************************** + + + APF Imagination / M-1000 cart emulation + + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "rom.h" + + +//------------------------------------------------- +// apf_rom_device - constructor +//------------------------------------------------- + +const device_type APF_ROM_STD = &device_creator<apf_rom_device>; +const device_type APF_ROM_BASIC = &device_creator<apf_basic_device>; +const device_type APF_ROM_SPACEDST = &device_creator<apf_spacedst_device>; + + +apf_rom_device::apf_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_apf_cart_interface( mconfig, *this ) +{ +} + +apf_rom_device::apf_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, APF_ROM_STD, "APF Standard Carts", tag, owner, clock, "apf_rom", __FILE__), + device_apf_cart_interface( mconfig, *this ) +{ +} + +apf_basic_device::apf_basic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : apf_rom_device(mconfig, APF_ROM_BASIC, "APF BASIC Carts", tag, owner, clock, "apf_basic", __FILE__) +{ +} + +apf_spacedst_device::apf_spacedst_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : apf_rom_device(mconfig, APF_ROM_SPACEDST, "APF Space Destroyer Cart", tag, owner, clock, "apf_spacedst", __FILE__) +{ +} + + +/*------------------------------------------------- + mapper specific handlers + -------------------------------------------------*/ + +READ8_MEMBER(apf_rom_device::read_rom) +{ + if (offset < m_rom_size) + return m_rom[offset]; + else + return 0xff; +} + + +READ8_MEMBER(apf_basic_device::extra_rom) +{ + if (offset < (m_rom_size - 0x2000)) + return m_rom[offset + 0x2000]; + else + return 0xff; +} + + +READ8_MEMBER(apf_spacedst_device::read_ram) +{ + return m_ram[offset]; +} + +WRITE8_MEMBER(apf_spacedst_device::write_ram) +{ + m_ram[offset] = data; +} diff --git a/src/emu/bus/apf/rom.h b/src/emu/bus/apf/rom.h new file mode 100644 index 00000000000..0881a2ac4eb --- /dev/null +++ b/src/emu/bus/apf/rom.h @@ -0,0 +1,60 @@ +#ifndef __APF_ROM_H +#define __APF_ROM_H + +#include "slot.h" + + +// ======================> apf_rom_device + +class apf_rom_device : public device_t, + public device_apf_cart_interface +{ +public: + // construction/destruction + apf_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + apf_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start() {} + virtual void device_reset() {} + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom); +}; + +// ======================> apf_basic_device + +class apf_basic_device : public apf_rom_device +{ +public: + // construction/destruction + apf_basic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // reading and writing + virtual DECLARE_READ8_MEMBER(extra_rom); +}; + +// ======================> apf_spacedst_device + +class apf_spacedst_device : public apf_rom_device +{ +public: + // construction/destruction + apf_spacedst_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_ram); + virtual DECLARE_WRITE8_MEMBER(write_ram); +}; + + + + + +// device type definition +extern const device_type APF_ROM_STD; +extern const device_type APF_ROM_BASIC; +extern const device_type APF_ROM_SPACEDST; + + +#endif diff --git a/src/emu/bus/apf/slot.c b/src/emu/bus/apf/slot.c new file mode 100644 index 00000000000..e685434fd6e --- /dev/null +++ b/src/emu/bus/apf/slot.c @@ -0,0 +1,296 @@ +/*********************************************************************************************************** + + APF Imagination / M-1000 cart emulation + (through slot devices) + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "slot.h" + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type APF_CART_SLOT = &device_creator<apf_cart_slot_device>; + +//************************************************************************** +// APF Cartridges Interface +//************************************************************************** + +//------------------------------------------------- +// device_apf_cart_interface - constructor +//------------------------------------------------- + +device_apf_cart_interface::device_apf_cart_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device), + m_rom(NULL), + m_rom_size(0) +{ +} + + +//------------------------------------------------- +// ~device_apf_cart_interface - destructor +//------------------------------------------------- + +device_apf_cart_interface::~device_apf_cart_interface() +{ +} + +//------------------------------------------------- +// rom_alloc - alloc the space for the cart +//------------------------------------------------- + +void device_apf_cart_interface::rom_alloc(UINT32 size, const char *tag) +{ + if (m_rom == NULL) + { + astring tempstring(tag); + tempstring.cat(APFSLOT_ROM_REGION_TAG); + m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); + m_rom_size = size; + } +} + + +//------------------------------------------------- +// ram_alloc - alloc the space for the ram +//------------------------------------------------- + +void device_apf_cart_interface::ram_alloc(UINT32 size) +{ + m_ram.resize(size); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// apf_cart_slot_device - constructor +//------------------------------------------------- +apf_cart_slot_device::apf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, APF_CART_SLOT, "APF Cartridge Slot", tag, owner, clock, "apf_cart_slot", __FILE__), + device_image_interface(mconfig, *this), + device_slot_interface(mconfig, *this), + m_type(APF_STD) +{ +} + + +//------------------------------------------------- +// apf_cart_slot_device - destructor +//------------------------------------------------- + +apf_cart_slot_device::~apf_cart_slot_device() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void apf_cart_slot_device::device_start() +{ + m_cart = dynamic_cast<device_apf_cart_interface *>(get_card_device()); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void apf_cart_slot_device::device_config_complete() +{ + // set brief and instance name + update_names(); +} + + +//------------------------------------------------- +// APF PCB +//------------------------------------------------- + +struct apf_slot +{ + int pcb_id; + const char *slot_option; +}; + +// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it +static const apf_slot slot_list[] = +{ + { APF_STD, "std" }, + { APF_BASIC, "basic" }, + { APF_SPACEDST, "spacedst" } +}; + +static int apf_get_pcb_id(const char *slot) +{ + for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + { + if (!core_stricmp(slot_list[i].slot_option, slot)) + return slot_list[i].pcb_id; + } + + return 0; +} + +static const char *apf_get_slot(int type) +{ + for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + { + if (slot_list[i].pcb_id == type) + return slot_list[i].slot_option; + } + + return "std"; +} + + +/*------------------------------------------------- + call load + -------------------------------------------------*/ + +bool apf_cart_slot_device::call_load() +{ + if (m_cart) + { + UINT32 size = (software_entry() == NULL) ? length() : get_software_region_length("rom"); + + if (size > 0x3800) + { + seterror(IMAGE_ERROR_UNSPECIFIED, "Image extends beyond the expected size for an APF cart"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(size, tag()); + + if (software_entry() == NULL) + fread(m_cart->get_rom_base(), size); + else + memcpy(m_cart->get_rom_base(), get_software_region("rom"), size); + + if (software_entry() == NULL) + { + m_type = APF_STD; + // attempt to identify Space Destroyer, which needs 1K of additional RAM + if (size == 0x1800) + { + m_type = APF_SPACEDST; + m_cart->ram_alloc(0x400); + } + if (size > 0x2000) + m_type = APF_BASIC; + } + else + { + const char *pcb_name = get_feature("slot"); + if (pcb_name) + m_type = apf_get_pcb_id(pcb_name); + + if (get_software_region("ram")) + m_cart->ram_alloc(get_software_region_length("ram")); + } + + printf("Type: %s\n", apf_get_slot(m_type)); + + return IMAGE_INIT_PASS; + } + + return IMAGE_INIT_PASS; +} + + +/*------------------------------------------------- + call softlist load + -------------------------------------------------*/ + +bool apf_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) +{ + load_software_part_region(*this, swlist, swname, start_entry); + return TRUE; +} + + +/*------------------------------------------------- + get default card software + -------------------------------------------------*/ + +void apf_cart_slot_device::get_default_card_software(astring &result) +{ + if (open_image_file(mconfig().options())) + { + const char *slot_string = "std"; + UINT32 size = core_fsize(m_file); + int type = APF_STD; + + // attempt to identify Space Destroyer, which needs 1K of additional RAM + if (size == 0x1800) + type = APF_SPACEDST; + if (size > 0x2000) + type = APF_BASIC; + + slot_string = apf_get_slot(type); + + //printf("type: %s\n", slot_string); + clear(); + + result.cpy(slot_string); + return; + } + + software_get_default_slot(result, "std"); +} + +/*------------------------------------------------- + read + -------------------------------------------------*/ + +READ8_MEMBER(apf_cart_slot_device::read_rom) +{ + if (m_cart) + return m_cart->read_rom(space, offset); + else + return 0xff; +} + +/*------------------------------------------------- + read + -------------------------------------------------*/ + +READ8_MEMBER(apf_cart_slot_device::extra_rom) +{ + if (m_cart) + return m_cart->extra_rom(space, offset); + else + return 0xff; +} + +/*------------------------------------------------- + read + -------------------------------------------------*/ + +READ8_MEMBER(apf_cart_slot_device::read_ram) +{ + if (m_cart) + return m_cart->read_ram(space, offset); + else + return 0xff; +} + +/*------------------------------------------------- + write + -------------------------------------------------*/ + +WRITE8_MEMBER(apf_cart_slot_device::write_ram) +{ + if (m_cart) + m_cart->write_ram(space, offset, data); +} + + diff --git a/src/emu/bus/apf/slot.h b/src/emu/bus/apf/slot.h new file mode 100644 index 00000000000..c18e51dfe66 --- /dev/null +++ b/src/emu/bus/apf/slot.h @@ -0,0 +1,115 @@ +#ifndef __APF_SLOT_H +#define __APF_SLOT_H + +/*************************************************************************** + TYPE DEFINITIONS + ***************************************************************************/ + + +/* PCB */ +enum +{ + APF_STD = 0, + APF_BASIC, + APF_SPACEDST +}; + + +// ======================> device_apf_cart_interface + +class device_apf_cart_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_apf_cart_interface(const machine_config &mconfig, device_t &device); + virtual ~device_apf_cart_interface(); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom) { return 0xff; } + virtual DECLARE_READ8_MEMBER(extra_rom) { return 0xff; } + virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; } + virtual DECLARE_WRITE8_MEMBER(write_ram) {} + + void rom_alloc(UINT32 size, const char *tag); + void ram_alloc(UINT32 size); + UINT8* get_rom_base() { return m_rom; } + UINT8* get_ram_base() { return m_ram; } + UINT32 get_rom_size() { return m_rom_size; } + UINT32 get_ram_size() { return m_ram.count(); } + + void save_ram() { device().save_item(NAME(m_ram)); } + +protected: + // internal state + UINT8 *m_rom; + UINT32 m_rom_size; + dynamic_buffer m_ram; +}; + + +// ======================> apf_cart_slot_device + +class apf_cart_slot_device : public device_t, + public device_image_interface, + public device_slot_interface +{ +public: + // construction/destruction + apf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~apf_cart_slot_device(); + + // device-level overrides + virtual void device_start(); + virtual void device_config_complete(); + + // image-level overrides + virtual bool call_load(); + virtual void call_unload() {} + virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry); + + int get_type() { return m_type; } + + void save_ram() { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); } + + virtual iodevice_t image_type() const { return IO_CARTSLOT; } + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 0; } + virtual bool is_creatable() const { return 0; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 1; } + virtual const option_guide *create_option_guide() const { return NULL; } + virtual const char *image_interface() const { return "apfm1000_cart"; } + virtual const char *file_extensions() const { return "bin"; } + + // slot interface overrides + virtual void get_default_card_software(astring &result); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom); + virtual DECLARE_READ8_MEMBER(extra_rom); + virtual DECLARE_READ8_MEMBER(read_ram); + virtual DECLARE_WRITE8_MEMBER(write_ram); + +protected: + + int m_type; + device_apf_cart_interface* m_cart; +}; + + + +// device type definition +extern const device_type APF_CART_SLOT; + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS + ***************************************************************************/ + +#define APFSLOT_ROM_REGION_TAG ":cart:rom" + +#define MCFG_APF_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ + MCFG_DEVICE_ADD(_tag, APF_CART_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ + +#endif diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index 09986d28ac2..e2b2b56b410 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -98,6 +98,18 @@ endif #------------------------------------------------- # +#@src/emu/bus/apf/slot.h,BUSES += APF +#------------------------------------------------- + +ifneq ($(filter APF,$(BUSES)),) +OBJDIRS += $(BUSOBJ)/apf +BUSOBJS += $(BUSOBJ)/apf/slot.o +BUSOBJS += $(BUSOBJ)/apf/rom.o +endif + + +#------------------------------------------------- +# #@src/emu/bus/bw2/exp.h,BUSES += BW2 #------------------------------------------------- @@ -228,6 +240,18 @@ endif #------------------------------------------------- # +#@src/emu/bus/chanf/slot.h,BUSES += CHANNELF +#------------------------------------------------- + +ifneq ($(filter CHANNELF,$(BUSES)),) +OBJDIRS += $(BUSOBJ)/chanf +BUSOBJS += $(BUSOBJ)/chanf/slot.o +BUSOBJS += $(BUSOBJ)/chanf/rom.o +endif + + +#------------------------------------------------- +# #@src/emu/bus/comx35/exp.h,BUSES += COMX35 #------------------------------------------------- diff --git a/src/emu/bus/chanf/rom.c b/src/emu/bus/chanf/rom.c new file mode 100644 index 00000000000..7506dfca1c3 --- /dev/null +++ b/src/emu/bus/chanf/rom.c @@ -0,0 +1,206 @@ +/*********************************************************************************************************** + + + Fairchild Channel F cart emulation + + Three kind of carts: + - ROM only (the vast majority of carts) + - ROM + 2102 RAM chip (used by carts 10 and 18, with different I/O ports) + - ROM + 3853 RAM chip (used by Schach + some homebrew) + + Based on Sean Riddle's documentation (especially for the 2102 RAM!) + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "rom.h" + + +//------------------------------------------------- +// chanf_rom_device - constructor +//------------------------------------------------- + +const device_type CHANF_ROM_STD = &device_creator<chanf_rom_device>; +const device_type CHANF_ROM_MAZE = &device_creator<chanf_maze_device>; +const device_type CHANF_ROM_HANGMAN = &device_creator<chanf_hangman_device>; +const device_type CHANF_ROM_CHESS = &device_creator<chanf_chess_device>; +const device_type CHANF_ROM_MULTI = &device_creator<chanf_multi_device>; + + +chanf_rom_device::chanf_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_channelf_cart_interface( mconfig, *this ) +{ +} + +chanf_rom_device::chanf_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, CHANF_ROM_STD, "Channel F Standard Carts", tag, owner, clock, "chanf_rom", __FILE__), + device_channelf_cart_interface( mconfig, *this ) +{ +} + +chanf_maze_device::chanf_maze_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : chanf_rom_device(mconfig, CHANF_ROM_MAZE, "Channel F Maze Cart", tag, owner, clock, "chanf_maze", __FILE__) +{ +} + +chanf_hangman_device::chanf_hangman_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : chanf_rom_device(mconfig, CHANF_ROM_HANGMAN, "Channel F Hangman Cart", tag, owner, clock, "chanf_hang", __FILE__) +{ +} + +chanf_chess_device::chanf_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : chanf_rom_device(mconfig, CHANF_ROM_CHESS, "Channel F Chess Cart", tag, owner, clock, "chanf_chess", __FILE__) +{ +} + +chanf_multi_device::chanf_multi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : chanf_rom_device(mconfig, CHANF_ROM_MULTI, "Channel F Multigame Cart", tag, owner, clock, "chanf_multi", __FILE__) +{ +} + + + +//------------------------------------------------- +// mapper specific start/reset +//------------------------------------------------- + + +void chanf_maze_device::device_start() +{ + // 2012 RAM related + save_item(NAME(m_latch)); + save_item(NAME(m_addr_latch)); + save_item(NAME(m_addr)); + save_item(NAME(m_read_write)); + save_item(NAME(m_data0)); +} + +void chanf_maze_device::device_reset() +{ + m_latch[0] = 0; + m_latch[1] = 0; + m_addr = 0; + m_addr_latch = 0; + m_read_write = 0; + m_data0 = 0; +} + + +void chanf_hangman_device::device_start() +{ + // 2012 RAM related + save_item(NAME(m_latch)); + save_item(NAME(m_addr_latch)); + save_item(NAME(m_addr)); + save_item(NAME(m_read_write)); + save_item(NAME(m_data0)); +} + +void chanf_hangman_device::device_reset() +{ + m_latch[0] = 0; + m_latch[1] = 0; + m_addr = 0; + m_addr_latch = 0; + m_read_write = 0; + m_data0 = 0; +} + + +void chanf_multi_device::device_start() +{ + save_item(NAME(m_base_bank)); +} + +void chanf_multi_device::device_reset() +{ + m_base_bank = 0; +} + + +/*------------------------------------------------- + mapper specific handlers + -------------------------------------------------*/ + +READ8_MEMBER(chanf_rom_device::read_rom) +{ + if (offset < m_rom_size) + return m_rom[offset]; + else + return 0xff; +} + +// These are shared among Maze & Hangman cart types (not directly used by base chanf_rom_device) +UINT8 chanf_rom_device::common_read_2102(UINT32 offset) +{ + if (offset == 0) + { + if (m_read_write == 0) + { + m_addr = m_addr_latch; + m_data0 = m_ram[m_addr] & 1; + return (m_latch[0] & 0x7f | (m_data0 << 7)); + } + + return m_latch[0]; + } + else + return m_latch[1]; +} + +void chanf_rom_device::common_write_2102(UINT32 offset, UINT8 data) +{ + if (offset == 0) + { + m_latch[0] = data; + + m_read_write = BIT(data, 0); + + m_addr_latch = (m_addr_latch & 0x3f3) | (BIT(data, 2) << 2) | (BIT(data, 1) << 3); // bits 2,3 come from this write! + m_addr = m_addr_latch; + + m_data0 = BIT(data, 3); + + if (m_read_write == 1) + m_ram[m_addr] = m_data0; + } + else + { + m_latch[1] = data; + // all bits but 2,3 come from this write, but they are shuffled + // notice that data is 8bits, so when swapping bit8 & bit9 are always 0! + m_addr_latch = (m_addr_latch & 0x0c) | (BITSWAP16(data, 15, 14, 13, 12, 11, 10, 7, 6, 5, 3, 2, 1, 9, 8, 4, 0)); + } +} + + +// These are shared among Schach & Multigame cart types (not directly used by base chanf_rom_device) +UINT8 chanf_rom_device::common_read_3853(UINT32 offset) +{ + if (offset < m_ram.count()) + return m_ram[offset]; + else + return 0xff; +} + +void chanf_rom_device::common_write_3853(UINT32 offset, UINT8 data) +{ + if (offset < m_ram.count()) + m_ram[offset] = data; +} + +READ8_MEMBER(chanf_multi_device::read_rom) +{ + if (offset < 0x2000) + return m_rom[offset + (m_base_bank * 0x2000)]; + else + return 0xff; +} + +WRITE8_MEMBER(chanf_multi_device::write_bank) +{ + m_base_bank = data; +} + diff --git a/src/emu/bus/chanf/rom.h b/src/emu/bus/chanf/rom.h new file mode 100644 index 00000000000..e9b26c6204b --- /dev/null +++ b/src/emu/bus/chanf/rom.h @@ -0,0 +1,119 @@ +#ifndef __CHANF_ROM_H +#define __CHANF_ROM_H + +#include "slot.h" + + +// ======================> chanf_rom_device + +class chanf_rom_device : public device_t, + public device_channelf_cart_interface +{ +public: + // construction/destruction + chanf_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + chanf_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start() {} + virtual void device_reset() {} + + UINT8 common_read_2102(UINT32 offset); + UINT8 common_read_3853(UINT32 offset); + void common_write_2102(UINT32 offset, UINT8 data); + void common_write_3853(UINT32 offset, UINT8 data); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom); + + +protected: + // used for RAM chip in Hangman & Maze + UINT8 m_latch[2]; // PORT A & PORT B + UINT16 m_addr_latch, m_addr; + int m_read_write, m_data0; +}; + +// ======================> chanf_maze_device + +class chanf_maze_device : public chanf_rom_device +{ +public: + // construction/destruction + chanf_maze_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_ram) { return common_read_2102(offset); } + virtual DECLARE_WRITE8_MEMBER(write_ram) { common_write_2102(offset, data); } +}; + + +// ======================> chanf_hangman_device + +class chanf_hangman_device : public chanf_rom_device +{ +public: + // construction/destruction + chanf_hangman_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_ram) { return common_read_2102(offset); } + virtual DECLARE_WRITE8_MEMBER(write_ram) { common_write_2102(offset, data); } +}; + + +// ======================> chanf_chess_device + +class chanf_chess_device : public chanf_rom_device +{ +public: + // construction/destruction + chanf_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_ram) { return common_read_3853(offset); } + virtual DECLARE_WRITE8_MEMBER(write_ram) { common_write_3853(offset, data); } +}; + + +// ======================> chanf_multi_device + +class chanf_multi_device : public chanf_rom_device +{ +public: + // construction/destruction + chanf_multi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom); + virtual DECLARE_READ8_MEMBER(read_ram) { return common_read_3853(offset); } + virtual DECLARE_WRITE8_MEMBER(write_ram) { common_write_3853(offset, data); } + virtual DECLARE_WRITE8_MEMBER(write_bank); + +private: + int m_base_bank; +}; + + + +// device type definition +extern const device_type CHANF_ROM_STD; +extern const device_type CHANF_ROM_MAZE; +extern const device_type CHANF_ROM_HANGMAN; +extern const device_type CHANF_ROM_CHESS; +extern const device_type CHANF_ROM_MULTI; + + +#endif diff --git a/src/emu/bus/chanf/slot.c b/src/emu/bus/chanf/slot.c new file mode 100644 index 00000000000..d47cae4ed0a --- /dev/null +++ b/src/emu/bus/chanf/slot.c @@ -0,0 +1,285 @@ +/*********************************************************************************************************** + + Fairchild Channel F cart emulation + (through slot devices) + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "slot.h" + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type CHANF_CART_SLOT = &device_creator<channelf_cart_slot_device>; + +//************************************************************************** +// Channel F cartridges Interface +//************************************************************************** + +//------------------------------------------------- +// device_channelf_cart_interface - constructor +//------------------------------------------------- + +device_channelf_cart_interface::device_channelf_cart_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device), + m_rom(NULL), + m_rom_size(0) +{ +} + + +//------------------------------------------------- +// ~device_channelf_cart_interface - destructor +//------------------------------------------------- + +device_channelf_cart_interface::~device_channelf_cart_interface() +{ +} + +//------------------------------------------------- +// rom_alloc - alloc the space for the cart +//------------------------------------------------- + +void device_channelf_cart_interface::rom_alloc(UINT32 size, const char *tag) +{ + if (m_rom == NULL) + { + astring tempstring(tag); + tempstring.cat(CHANFSLOT_ROM_REGION_TAG); + m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base(); + m_rom_size = size; + } +} + + +//------------------------------------------------- +// ram_alloc - alloc the space for the ram +//------------------------------------------------- + +void device_channelf_cart_interface::ram_alloc(UINT32 size) +{ + m_ram.resize(size); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// channelf_cart_slot_device - constructor +//------------------------------------------------- +channelf_cart_slot_device::channelf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, CHANF_CART_SLOT, "Fairchild Channel F Cartridge Slot", tag, owner, clock, "cf_cart_slot", __FILE__), + device_image_interface(mconfig, *this), + device_slot_interface(mconfig, *this), + m_type(CF_CHESS) +{ +} + + +//------------------------------------------------- +// ~channelf_cart_slot_device - destructor +//------------------------------------------------- + +channelf_cart_slot_device::~channelf_cart_slot_device() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void channelf_cart_slot_device::device_start() +{ + m_cart = dynamic_cast<device_channelf_cart_interface *>(get_card_device()); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void channelf_cart_slot_device::device_config_complete() +{ + // set brief and instance name + update_names(); +} + + +//------------------------------------------------- +// Channel F PCB +//------------------------------------------------- + +struct chanf_slot +{ + int pcb_id; + const char *slot_option; +}; + +// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it +static const chanf_slot slot_list[] = +{ + { CF_STD, "std" }, + { CF_MAZE, "maze" }, + { CF_HANGMAN, "hangman" }, + { CF_CHESS, "chess" }, + { CF_MULTI, "multi" } +}; + +static int chanf_get_pcb_id(const char *slot) +{ + for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + { + if (!core_stricmp(slot_list[i].slot_option, slot)) + return slot_list[i].pcb_id; + } + + return 0; +} + +static const char *chanf_get_slot(int type) +{ + for (int i = 0; i < ARRAY_LENGTH(slot_list); i++) + { + if (slot_list[i].pcb_id == type) + return slot_list[i].slot_option; + } + + return "chess"; +} + + +/*------------------------------------------------- + call load + -------------------------------------------------*/ + +bool channelf_cart_slot_device::call_load() +{ + if (m_cart) + { + UINT32 len = (software_entry() == NULL) ? length() : get_software_region_length("rom"); + m_cart->rom_alloc(len, tag()); + + if (software_entry() == NULL) + fread(m_cart->get_rom_base(), len); + else + memcpy(m_cart->get_rom_base(), get_software_region("rom"), len); + + if (software_entry() == NULL) + { + // we default to "chess" slot because some homebrew programs have been written to run + // on PCBs with RAM at $2000-$2800 as Saba Schach! + if (len == 0x40000) + m_type = CF_MULTI; + else + m_type = CF_CHESS; // is there any way to detect Maze and Hangman from fullpath? + + m_cart->ram_alloc(0x800); + } + else + { + const char *pcb_name = get_feature("slot"); + if (pcb_name) + m_type = chanf_get_pcb_id(pcb_name); + + if (get_software_region("ram")) + m_cart->ram_alloc(get_software_region_length("ram")); + } + + //printf("Type: %s\n", chanf_get_slot(m_type)); + + return IMAGE_INIT_PASS; + } + + return IMAGE_INIT_PASS; +} + + +/*------------------------------------------------- + call softlist load + -------------------------------------------------*/ + +bool channelf_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) +{ + load_software_part_region(*this, swlist, swname, start_entry); + return TRUE; +} + + + +/*------------------------------------------------- + get default card software + -------------------------------------------------*/ + +void channelf_cart_slot_device::get_default_card_software(astring &result) +{ + if (open_image_file(mconfig().options())) + { + const char *slot_string = "chess"; + UINT32 len = core_fsize(m_file); + int type; + + if (len == 0x40000) + type = CF_MULTI; + else + type = CF_CHESS; // is there any way to detect the other carts from fullpath? + + slot_string = chanf_get_slot(type); + + //printf("type: %s\n", slot_string); + clear(); + + result.cpy(slot_string); + return; + } + software_get_default_slot(result, "chess"); +} + +/*------------------------------------------------- + read + -------------------------------------------------*/ + +READ8_MEMBER(channelf_cart_slot_device::read_rom) +{ + if (m_cart) + return m_cart->read_rom(space, offset); + else + return 0xff; +} + +/*------------------------------------------------- + read + -------------------------------------------------*/ + +READ8_MEMBER(channelf_cart_slot_device::read_ram) +{ + if (m_cart) + return m_cart->read_ram(space, offset); + else + return 0xff; +} + +/*------------------------------------------------- + write + -------------------------------------------------*/ + +WRITE8_MEMBER(channelf_cart_slot_device::write_ram) +{ + if (m_cart) + m_cart->write_ram(space, offset, data); +} + +/*------------------------------------------------- + write + -------------------------------------------------*/ + +WRITE8_MEMBER(channelf_cart_slot_device::write_bank) +{ + if (m_cart) + m_cart->write_bank(space, offset, data); +} diff --git a/src/emu/bus/chanf/slot.h b/src/emu/bus/chanf/slot.h new file mode 100644 index 00000000000..359c895f694 --- /dev/null +++ b/src/emu/bus/chanf/slot.h @@ -0,0 +1,117 @@ +#ifndef __CHANF_SLOT_H +#define __CHANF_SLOT_H + +/*************************************************************************** + TYPE DEFINITIONS + ***************************************************************************/ + + +/* PCB */ +enum +{ + CF_STD = 0, + CF_MAZE, + CF_HANGMAN, + CF_CHESS, + CF_MULTI +}; + + +// ======================> device_channelf_cart_interface + +class device_channelf_cart_interface : public device_slot_card_interface +{ +public: + // device_channelf_cart_interface/destruction + device_channelf_cart_interface(const machine_config &mconfig, device_t &device); + virtual ~device_channelf_cart_interface(); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom) { return 0xff; } + virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; } + virtual DECLARE_WRITE8_MEMBER(write_ram) {} + virtual DECLARE_WRITE8_MEMBER(write_bank) {} + + void rom_alloc(UINT32 size, const char *tag); + void ram_alloc(UINT32 size); + UINT8* get_rom_base() { return m_rom; } + UINT8* get_ram_base() { return m_ram; } + UINT32 get_rom_size() { return m_rom_size; } + UINT32 get_ram_size() { return m_ram.count(); } + + void save_ram() { device().save_item(NAME(m_ram)); } + +protected: + // internal state + UINT8 *m_rom; + UINT32 m_rom_size; + dynamic_buffer m_ram; +}; + + +// ======================> channelf_cart_slot_device + +class channelf_cart_slot_device : public device_t, + public device_image_interface, + public device_slot_interface +{ +public: + // construction/destruction + channelf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~channelf_cart_slot_device(); + + // device-level overrides + virtual void device_start(); + virtual void device_config_complete(); + + // image-level overrides + virtual bool call_load(); + virtual void call_unload() {} + virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry); + + int get_type() { return m_type; } + + void save_ram() { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); } + + virtual iodevice_t image_type() const { return IO_CARTSLOT; } + virtual bool is_readable() const { return 1; } + virtual bool is_writeable() const { return 0; } + virtual bool is_creatable() const { return 0; } + virtual bool must_be_loaded() const { return 0; } + virtual bool is_reset_on_load() const { return 1; } + virtual const option_guide *create_option_guide() const { return NULL; } + virtual const char *image_interface() const { return "channelf_cart"; } + virtual const char *file_extensions() const { return "bin,chf"; } + + // slot interface overrides + virtual void get_default_card_software(astring &result); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_rom); + virtual DECLARE_READ8_MEMBER(read_ram); + virtual DECLARE_WRITE8_MEMBER(write_ram); + virtual DECLARE_WRITE8_MEMBER(write_bank); + +protected: + + int m_type; + device_channelf_cart_interface* m_cart; +}; + + + +// device type definition +extern const device_type CHANF_CART_SLOT; + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS + ***************************************************************************/ + +#define CHANFSLOT_ROM_REGION_TAG ":cart:rom" + +#define MCFG_CHANNELF_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ + MCFG_DEVICE_ADD(_tag, CHANF_CART_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ + +#endif diff --git a/src/mess/drivers/apf.c b/src/mess/drivers/apf.c index 62829b6b1c2..e2462a40636 100644 --- a/src/mess/drivers/apf.c +++ b/src/mess/drivers/apf.c @@ -76,10 +76,12 @@ ToDo: #include "machine/6821pia.h" #include "machine/wd_fdc.h" #include "imagedev/cassette.h" -#include "imagedev/cartslot.h" #include "formats/apf_apt.h" #include "machine/ram.h" +#include "bus/apf/slot.h" +#include "bus/apf/rom.h" + class apf_state : public driver_device { @@ -87,7 +89,6 @@ public: apf_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_has_cart_ram(false) - , m_p_videoram(*this, "videoram") , m_maincpu(*this, "maincpu") , m_ram(*this, RAM_TAG) , m_crtc(*this, "mc6847") @@ -95,9 +96,13 @@ public: , m_pia0(*this, "pia0") , m_pia1(*this, "pia1") , m_cass(*this, "cassette") + , m_cart(*this, "cartslot") , m_fdc(*this, "fdc") , m_floppy0(*this, "fdc:0") , m_floppy1(*this, "fdc:1") + , m_joy(*this, "joy") + , m_key(*this, "key") + , m_p_videoram(*this, "videoram") { } DECLARE_READ8_MEMBER(videoram_r); @@ -110,7 +115,7 @@ public: DECLARE_WRITE8_MEMBER(apf_dischw_w); DECLARE_READ8_MEMBER(serial_r); DECLARE_WRITE8_MEMBER(serial_w); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(apf_cart); + private: UINT8 m_latch; UINT8 m_keyboard_data; @@ -118,8 +123,8 @@ private: UINT8 m_portb; bool m_ca2; bool m_has_cart_ram; + virtual void machine_start(); virtual void machine_reset(); - required_shared_ptr<UINT8> m_p_videoram; required_device<m6800_cpu_device> m_maincpu; required_device<ram_device> m_ram; required_device<mc6847_base_device> m_crtc; @@ -127,10 +132,13 @@ private: required_device<pia6821_device> m_pia0; optional_device<pia6821_device> m_pia1; optional_device<cassette_image_device> m_cass; + required_device<apf_cart_slot_device> m_cart; optional_device<fd1771_t> m_fdc; optional_device<floppy_connector> m_floppy0; optional_device<floppy_connector> m_floppy1; - dynamic_buffer m_cart_ram; + required_ioport_array<4> m_joy; + optional_ioport_array<8> m_key; + required_shared_ptr<UINT8> m_p_videoram; }; @@ -169,14 +177,9 @@ READ8_MEMBER( apf_state::pia0_porta_r ) { UINT8 data = 0xff; - if (!BIT(m_pad_data, 3)) - data &= ioport("joy3")->read(); - if (!BIT(m_pad_data, 2)) - data &= ioport("joy2")->read(); - if (!BIT(m_pad_data, 1)) - data &= ioport("joy1")->read(); - if (!BIT(m_pad_data, 0)) - data &= ioport("joy0")->read(); + for (int i = 3; i >= 0; i--) + if (!BIT(m_pad_data, i)) + data &= m_joy[i]->read(); return data; } @@ -198,8 +201,7 @@ WRITE_LINE_MEMBER( apf_state::pia0_ca2_w ) READ8_MEMBER( apf_state::pia1_porta_r ) { - static const char *const keynames[] = { "key0", "key1", "key2", "key3", "key4", "key5", "key6", "key7" }; - return ioport(keynames[m_keyboard_data])->read(); + return m_key[m_keyboard_data]->read(); } READ8_MEMBER( apf_state::pia1_portb_r ) @@ -231,6 +233,28 @@ WRITE8_MEMBER( apf_state::pia1_portb_w ) m_cass->output(BIT(data, 6) ? -1.0 : 1.0); } + +void apf_state::machine_start() +{ + if (m_cart->exists()) + { + switch (m_cart->get_type()) + { + case APF_BASIC: + m_maincpu->space(AS_PROGRAM).install_read_handler(0x6800, 0x7fff, read8_delegate(FUNC(apf_cart_slot_device::extra_rom),(apf_cart_slot_device*)m_cart)); + break; + case APF_SPACEDST: + m_maincpu->space(AS_PROGRAM).unmap_readwrite(0x9800, 0x9fff); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x9800, 0x9bff, read8_delegate(FUNC(apf_cart_slot_device::read_ram),(apf_cart_slot_device*)m_cart), write8_delegate(FUNC(apf_cart_slot_device::write_ram),(apf_cart_slot_device*)m_cart)); + m_has_cart_ram = true; + break; + } + + m_cart->save_ram(); + } +} + + void apf_state::machine_reset() { address_space &space = m_maincpu->space(AS_PROGRAM); @@ -248,13 +272,6 @@ void apf_state::machine_reset() else space.write_byte(0xa002, 0xe5); } - - /* Space Destroyer has 1K of on-cart RAM */ - if (m_has_cart_ram) - { - space.unmap_readwrite(0x9800, 0x9fff); - space.install_ram(0x9800, 0x9bff, m_cart_ram); - } } WRITE8_MEMBER( apf_state::apf_dischw_w) @@ -290,23 +307,23 @@ WRITE8_MEMBER( apf_state::serial_w) } static ADDRESS_MAP_START( apfm1000_map, AS_PROGRAM, 8, apf_state ) - AM_RANGE( 0x0000, 0x03ff) AM_MIRROR(0x1c00) AM_RAM AM_SHARE("videoram") - AM_RANGE( 0x2000, 0x3fff) AM_MIRROR(0x1ffc) AM_DEVREADWRITE("pia0", pia6821_device, read, write) - AM_RANGE( 0x4000, 0x4fff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0) - AM_RANGE( 0x6800, 0x7fff) AM_ROM AM_REGION("cart", 0x2000) - AM_RANGE( 0x8000, 0x9fff) AM_ROM AM_REGION("cart", 0) - AM_RANGE( 0xe000, 0xefff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x1c00) AM_RAM AM_SHARE("videoram") + AM_RANGE(0x2000, 0x3fff) AM_MIRROR(0x1ffc) AM_DEVREADWRITE("pia0", pia6821_device, read, write) + AM_RANGE(0x4000, 0x4fff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0) + AM_RANGE(0x6800, 0x7fff) AM_NOP // BASIC accesses ROM here too, but this is installed at machine_start + AM_RANGE(0x8000, 0x9fff) AM_DEVREAD("cartslot", apf_cart_slot_device, read_rom) + AM_RANGE(0xe000, 0xefff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0) ADDRESS_MAP_END static ADDRESS_MAP_START( apfimag_map, AS_PROGRAM, 8, apf_state ) AM_IMPORT_FROM(apfm1000_map) - AM_RANGE( 0x6000, 0x63ff) AM_MIRROR(0x03fc) AM_DEVREADWRITE("pia1", pia6821_device, read, write) + AM_RANGE(0x6000, 0x63ff) AM_MIRROR(0x03fc) AM_DEVREADWRITE("pia1", pia6821_device, read, write) // These need to be confirmed, disk does not work - AM_RANGE( 0x6400, 0x64ff) AM_READWRITE(serial_r, serial_w) - AM_RANGE( 0x6500, 0x6503) AM_DEVREADWRITE("fdc", fd1771_t, read, write) - AM_RANGE( 0x6600, 0x6600) AM_WRITE(apf_dischw_w) - AM_RANGE( 0xa000, 0xbfff) AM_RAM // standard - AM_RANGE( 0xc000, 0xdfff) AM_RAM // expansion + AM_RANGE(0x6400, 0x64ff) AM_READWRITE(serial_r, serial_w) + AM_RANGE(0x6500, 0x6503) AM_DEVREADWRITE("fdc", fd1771_t, read, write) + AM_RANGE(0x6600, 0x6600) AM_WRITE(apf_dischw_w) + AM_RANGE(0xa000, 0xbfff) AM_RAM // standard + AM_RANGE(0xc000, 0xdfff) AM_RAM // expansion ADDRESS_MAP_END @@ -352,8 +369,7 @@ static INPUT_PORTS_START( apfm1000 ) ? player right is player 1 */ - /* line 0 */ - PORT_START("joy0") + PORT_START("joy.0") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 1") PORT_CODE(KEYCODE_1) PORT_PLAYER(2) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 0") PORT_CODE(KEYCODE_0) PORT_PLAYER(2) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 4") PORT_CODE(KEYCODE_4) PORT_PLAYER(2) @@ -363,8 +379,7 @@ static INPUT_PORTS_START( apfm1000 ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 4") PORT_CODE(KEYCODE_4_PAD) PORT_PLAYER(1) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 7") PORT_CODE(KEYCODE_7_PAD) PORT_PLAYER(1) - /* line 1 */ - PORT_START("joy1") + PORT_START("joy.1") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("PAD 1/RIGHT down") PORT_PLAYER(2) PORT_8WAY PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("PAD 1/RIGHT right") PORT_PLAYER(2) PORT_8WAY PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("PAD 1/RIGHT up") PORT_PLAYER(2) PORT_8WAY @@ -374,8 +389,7 @@ static INPUT_PORTS_START( apfm1000 ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("PAD 2/LEFT up") PORT_PLAYER(1) PORT_8WAY PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("PAD 2/LEFT left") PORT_PLAYER(1) PORT_8WAY - /* line 2 */ - PORT_START("joy2") + PORT_START("joy.2") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 3") PORT_CODE(KEYCODE_3) PORT_PLAYER(2) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT clear") PORT_CODE(KEYCODE_DEL) PORT_PLAYER(2) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 6") PORT_CODE(KEYCODE_6) PORT_PLAYER(2) @@ -385,8 +399,7 @@ static INPUT_PORTS_START( apfm1000 ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 6") PORT_CODE(KEYCODE_6_PAD) PORT_PLAYER(1) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 9") PORT_CODE(KEYCODE_9_PAD) PORT_PLAYER(1) - /* line 3 */ - PORT_START("joy3") + PORT_START("joy.3") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 2") PORT_CODE(KEYCODE_2) PORT_PLAYER(2) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT enter/fire") PORT_CODE(KEYCODE_ENTER) PORT_PLAYER(2) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 5") PORT_CODE(KEYCODE_5) PORT_PLAYER(2) @@ -404,8 +417,7 @@ static INPUT_PORTS_START( apfimag ) /* Reference: http://www.nausicaa.net/~lgreenf/apfpage2.htm */ - /* keyboard line 0 */ - PORT_START("key0") + PORT_START("key.0") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q IF") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') @@ -415,8 +427,7 @@ static INPUT_PORTS_START( apfimag ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W STEP") PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('S') - /* keyboard line 1 */ - PORT_START("key1") + PORT_START("key.1") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R READ") PORT_CODE(KEYCODE_R) PORT_CHAR('R') @@ -426,8 +437,7 @@ static INPUT_PORTS_START( apfimag ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E STOP") PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('D') - /* keyboard line 2 */ - PORT_START("key2") + PORT_START("key.2") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N ^") PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('^') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T NEXT") PORT_CODE(KEYCODE_T) PORT_CHAR('T') @@ -437,8 +447,7 @@ static INPUT_PORTS_START( apfimag ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y PRINT") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('H') - /* keyboard line 3 */ - PORT_START("key3") + PORT_START("key.3") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M ]") PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR(']') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I LIST") PORT_CODE(KEYCODE_I) PORT_CHAR('I') @@ -448,8 +457,7 @@ static INPUT_PORTS_START( apfimag ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U END") PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('J') - /* keyboard line 4 */ - PORT_START("key4") + PORT_START("key.4") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O _ REM") PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('_') @@ -459,8 +467,7 @@ static INPUT_PORTS_START( apfimag ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P @ USING") PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('@') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - /* keyboard line 5 */ - PORT_START("key5") + PORT_START("key.5") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(13) @@ -470,8 +477,7 @@ static INPUT_PORTS_START( apfimag ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(10) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rubout") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(8) - /* line 6 */ - PORT_START("key6") + PORT_START("key.6") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_TAB) PORT_CHAR(27) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) @@ -481,56 +487,11 @@ static INPUT_PORTS_START( apfimag ) PORT_BIT(0x40, 0x40, IPT_UNUSED) // another X PORT_BIT(0x80, 0x80, IPT_UNUSED) // another Z - /* line 7 */ - PORT_START("key7") + PORT_START("key.7") PORT_BIT(0xff, 0xff, IPT_UNUSED) INPUT_PORTS_END -DEVICE_IMAGE_LOAD_MEMBER( apf_state, apf_cart ) -{ - UINT8 *ROM = memregion("cart")->base(); - UINT32 cart_size; - - if (image.software_entry() == NULL) - { - cart_size = image.length(); - if (cart_size > 0x3800) - { - logerror("%s extends beyond the expected size for an APF cart.\n", image.filename()); - return IMAGE_INIT_FAIL; - } - - image.fread(ROM, cart_size); - - // attempt to identify Space Destroyer, which needs 1K of additional RAM - if (cart_size == 0x1800) - { - m_has_cart_ram = true; - m_cart_ram.resize(0x400); - } - } - else - { - cart_size = image.get_software_region_length("rom"); - if (cart_size > 0x3800) - { - logerror("%s extends beyond the expected size for an APF cart.\n", image.filename()); - return IMAGE_INIT_FAIL; - } - - memcpy(ROM, image.get_software_region("rom"), cart_size); - - if (image.get_software_region("ram")) - { - m_has_cart_ram = true; - m_cart_ram.resize(image.get_software_region_length("ram")); - } - } - - return IMAGE_INIT_PASS; -} - static SLOT_INTERFACE_START( apf_floppies ) SLOT_INTERFACE( "525dd", FLOPPY_525_SSDD ) SLOT_INTERFACE_END @@ -553,6 +514,13 @@ static const floppy_interface apfimag_floppy_interface = }; #endif +static SLOT_INTERFACE_START(apf_cart) + SLOT_INTERFACE_INTERNAL("std", APF_ROM_STD) + SLOT_INTERFACE_INTERNAL("basic", APF_ROM_BASIC) + SLOT_INTERFACE_INTERNAL("spacedst", APF_ROM_SPACEDST) +SLOT_INTERFACE_END + + static MACHINE_CONFIG_START( apfm1000, apf_state ) /* basic machine hardware */ @@ -588,9 +556,7 @@ static MACHINE_CONFIG_START( apfm1000, apf_state ) MCFG_RAM_DEFAULT_SIZE("8K") MCFG_RAM_EXTRA_OPTIONS("16K") - MCFG_CARTSLOT_ADD("cart") - MCFG_CARTSLOT_INTERFACE("apfm1000_cart") - MCFG_CARTSLOT_LOAD(apf_state, apf_cart) + MCFG_APF_CARTRIDGE_ADD("cartslot", apf_cart, NULL) /* software lists */ MCFG_SOFTWARE_LIST_ADD("cart_list","apfm1000") @@ -635,8 +601,6 @@ ROM_START(apfm1000) ROM_SYSTEM_BIOS( 2, "mod", "Mod Bios" ) // (c) 1982 W.Lunquist - In Basic, CALL 18450 to get a machine-language monitor ROMX_LOAD("mod_bios.bin", 0x0000, 0x1000, CRC(f320aba6) SHA1(9442349fca8b001a5765e2fe8b84db4ece7886c1), ROM_BIOS(3) ) - - ROM_REGION(0x3800,"cart", ROMREGION_ERASEFF) ROM_END #define rom_apfimag rom_apfm1000 diff --git a/src/mess/drivers/channelf.c b/src/mess/drivers/channelf.c index ba9fc22e88b..afaf6178c1a 100644 --- a/src/mess/drivers/channelf.c +++ b/src/mess/drivers/channelf.c @@ -8,6 +8,7 @@ * * Fredric "e5frog" Blaoholtz, added support large cartridges * also spanning from $3000 to $FFFF. Added clones + * Fabio "etabeta" Priuli, moved carts to be slot devices * ******************************************************************/ @@ -46,12 +47,12 @@ UINT8 channelf_state::port_read_with_latch(UINT8 ext, UINT8 latch_state) return (~ext | latch_state); } -READ8_MEMBER( channelf_state::channelf_port_0_r ) +READ8_MEMBER( channelf_state::port_0_r ) { return port_read_with_latch(ioport("PANEL")->read(), m_latch[0]); } -READ8_MEMBER( channelf_state::channelf_port_1_r ) +READ8_MEMBER( channelf_state::port_1_r ) { UINT8 ext_value; @@ -63,7 +64,7 @@ READ8_MEMBER( channelf_state::channelf_port_1_r ) return port_read_with_latch(ext_value,m_latch[1]); } -READ8_MEMBER( channelf_state::channelf_port_4_r ) +READ8_MEMBER( channelf_state::port_4_r ) { UINT8 ext_value; @@ -75,37 +76,12 @@ READ8_MEMBER( channelf_state::channelf_port_4_r ) return port_read_with_latch(ext_value,m_latch[2]); } -READ8_MEMBER( channelf_state::channelf_port_5_r ) +READ8_MEMBER( channelf_state::port_5_r ) { return port_read_with_latch(0xff, m_latch[3]); } -READ8_MEMBER( channelf_state::channelf_2102A_r ) /* SKR */ -{ - UINT8 pdata; - - if (m_r2102.r_w==0) - { - m_r2102.addr=(m_r2102.a[0]&1)+((m_r2102.a[1]<<1)&2)+((m_r2102.a[2]<<2)&4)+((m_r2102.a[3]<<3)&8)+((m_r2102.a[4]<<4)&16)+((m_r2102.a[5]<<5)&32)+((m_r2102.a[6]<<6)&64)+((m_r2102.a[7]<<7)&128)+((m_r2102.a[8]<<8)&256)+((m_r2102.a[9]<<9)&512); - m_r2102.d=m_r2102.ram[m_r2102.addr]&1; - pdata=m_latch[4]&0x7f; - pdata|=(m_r2102.d<<7); - LOG(("rhA: addr=%d, d=%d, r_w=%d, ram[%d]=%d, a[9]=%d, a[8]=%d, a[7]=%d, a[6]=%d, a[5]=%d, a[4]=%d, a[3]=%d, a[2]=%d, a[1]=%d, a[0]=%d\n",m_r2102.addr,m_r2102.d,m_r2102.r_w,m_r2102.addr,m_r2102.ram[m_r2102.addr],m_r2102.a[9],m_r2102.a[8],m_r2102.a[7],m_r2102.a[6],m_r2102.a[5],m_r2102.a[4],m_r2102.a[3],m_r2102.a[2],m_r2102.a[1],m_r2102.a[0])); - return port_read_with_latch(0xff,pdata); - } - else - LOG(("rhA: r_w=%d\n",m_r2102.r_w)); - - return port_read_with_latch(0xff, m_latch[4]); -} - -READ8_MEMBER( channelf_state::channelf_2102B_r ) /* SKR */ -{ - LOG(("rhB\n")); - return port_read_with_latch(0xff, m_latch[5]); -} - -WRITE8_MEMBER( channelf_state::channelf_port_0_w ) +WRITE8_MEMBER( channelf_state::port_0_w ) { int offs; @@ -118,140 +94,106 @@ WRITE8_MEMBER( channelf_state::channelf_port_0_w ) } } -WRITE8_MEMBER( channelf_state::channelf_port_1_w ) +WRITE8_MEMBER( channelf_state::port_1_w ) { m_latch[1] = data; m_val_reg = ((data ^ 0xff) >> 6) & 0x03; } -WRITE8_MEMBER( channelf_state::channelf_port_4_w ) +WRITE8_MEMBER( channelf_state::port_4_w ) { m_latch[2] = data; m_col_reg = (data | 0x80) ^ 0xff; } -WRITE8_MEMBER( channelf_state::channelf_port_5_w ) +WRITE8_MEMBER( channelf_state::port_5_w ) { m_latch[3] = data; m_custom->sound_w((data>>6)&3); m_row_reg = (data | 0xc0) ^ 0xff; } -WRITE8_MEMBER( channelf_state::channelf_2102A_w ) /* SKR */ -{ - m_latch[4]=data; - m_r2102.a[2]=(data>>2)&1; - m_r2102.a[3]=(data>>1)&1; - m_r2102.r_w=data&1; - m_r2102.addr=(m_r2102.a[0]&1)+((m_r2102.a[1]<<1)&2)+((m_r2102.a[2]<<2)&4)+((m_r2102.a[3]<<3)&8)+((m_r2102.a[4]<<4)&16)+((m_r2102.a[5]<<5)&32)+((m_r2102.a[6]<<6)&64)+((m_r2102.a[7]<<7)&128)+((m_r2102.a[8]<<8)&256)+((m_r2102.a[9]<<9)&512); - m_r2102.d=(data>>3)&1; - if(m_r2102.r_w==1) - m_r2102.ram[m_r2102.addr]=m_r2102.d; - LOG(("whA: data=%d, addr=%d, d=%d, r_w=%d, ram[%d]=%d\n",data,m_r2102.addr,m_r2102.d,m_r2102.r_w,m_r2102.addr,m_r2102.ram[m_r2102.addr])); -} - -WRITE8_MEMBER( channelf_state::channelf_2102B_w ) /* SKR */ -{ - m_latch[5]=data; - m_r2102.a[9]=(data>>7)&1; - m_r2102.a[8]=(data>>6)&1; - m_r2102.a[7]=(data>>5)&1; - m_r2102.a[1]=(data>>4)&1; - m_r2102.a[6]=(data>>3)&1; - m_r2102.a[5]=(data>>2)&1; - m_r2102.a[4]=(data>>1)&1; - m_r2102.a[0]=data&1; - LOG(("whB: data=%d, a[9]=%d,a[8]=%d,a[0]=%d\n",data,m_r2102.a[9],m_r2102.a[8],m_r2102.a[0])); -} - static ADDRESS_MAP_START( channelf_map, AS_PROGRAM, 8, channelf_state ) AM_RANGE(0x0000, 0x07ff) AM_ROM - AM_RANGE(0x0800, 0x27ff) AM_ROM /* Cartridge Data */ - AM_RANGE(0x2800, 0x2fff) AM_RAM /* Schach RAM */ - AM_RANGE(0x3000, 0xffff) AM_ROM /* Cartridge Data continued */ + AM_RANGE(0x0800, 0xffff) AM_DEVREAD("cartslot", channelf_cart_slot_device, read_rom) ADDRESS_MAP_END static ADDRESS_MAP_START( channelf_io, AS_IO, 8, channelf_state ) - AM_RANGE(0x00, 0x00) AM_READWRITE(channelf_port_0_r, channelf_port_0_w) /* Front panel switches */ - AM_RANGE(0x01, 0x01) AM_READWRITE(channelf_port_1_r, channelf_port_1_w) /* Right controller */ - AM_RANGE(0x04, 0x04) AM_READWRITE(channelf_port_4_r, channelf_port_4_w) /* Left controller */ - AM_RANGE(0x05, 0x05) AM_READWRITE(channelf_port_5_r, channelf_port_5_w) - - AM_RANGE(0x20, 0x20) AM_READWRITE(channelf_2102A_r, channelf_2102A_w) /* SKR 2102 control and addr for cart 18 */ - AM_RANGE(0x21, 0x21) AM_READWRITE(channelf_2102B_r, channelf_2102B_w) /* SKR 2102 addr */ - AM_RANGE(0x24, 0x24) AM_READWRITE(channelf_2102A_r, channelf_2102A_w) /* SKR 2102 control and addr for cart 10 */ - AM_RANGE(0x25, 0x25) AM_READWRITE(channelf_2102B_r, channelf_2102B_w) /* SKR 2102 addr */ + AM_RANGE(0x00, 0x00) AM_READWRITE(port_0_r, port_0_w) /* Front panel switches */ + AM_RANGE(0x01, 0x01) AM_READWRITE(port_1_r, port_1_w) /* Right controller */ + AM_RANGE(0x04, 0x04) AM_READWRITE(port_4_r, port_4_w) /* Left controller */ + AM_RANGE(0x05, 0x05) AM_READWRITE(port_5_r, port_5_w) ADDRESS_MAP_END static INPUT_PORTS_START( channelf ) - PORT_START("PANEL") /* Front panel buttons */ - PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_START ) /* TIME (1) */ - PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) /* HOLD (2) */ - PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) /* MODE (3) */ - PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON7 ) /* START (4) */ - PORT_BIT ( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("RIGHT_C") /* Right controller */ - PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) - PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) - PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) - PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) - PORT_BIT ( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) /* C-CLOCKWISE */ PORT_PLAYER(1) - PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) /* CLOCKWISE */ PORT_PLAYER(1) - PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) /* PULL UP */ PORT_PLAYER(1) - PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) /* PUSH DOWN */ PORT_PLAYER(1) - - PORT_START("LEFT_C") /* Left controller */ - PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) - PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) - PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) - PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) - PORT_BIT ( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) /* C-CLOCKWISE */ PORT_PLAYER(2) - PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) /* CLOCKWISE */ PORT_PLAYER(2) - PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) /* PULL UP */ PORT_PLAYER(2) - PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) /* PUSH DOWN */ PORT_PLAYER(2) + PORT_START("PANEL") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("TIME (Button 1)") PORT_CODE(KEYCODE_1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("HOLD (Button 2)") PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MODE (Button 3)") PORT_CODE(KEYCODE_3) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("START (Button 4)") PORT_CODE(KEYCODE_4) + PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("RIGHT_C") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("P1 Twist Counterclockwise") PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("P1 Twist Clockwise")PORT_PLAYER(1) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("P1 Pull Up") PORT_PLAYER(1) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P1 Push Down") PORT_PLAYER(1) + + PORT_START("LEFT_C") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("P2 Twist Counterclockwise") PORT_PLAYER(2) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("P2 Twist Clockwise")PORT_PLAYER(2) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("P2 Pull Up") PORT_PLAYER(2) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P2 Push Down") PORT_PLAYER(2) INPUT_PORTS_END - -DEVICE_IMAGE_LOAD_MEMBER( channelf_state, channelf_cart ) +void channelf_state::machine_start() { - UINT32 size; - - if (image.software_entry() == NULL) + if (m_cart->exists()) { - size = image.length(); - - if (size > 0xf800) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return IMAGE_INIT_FAIL; - } - - if (image.fread( memregion("maincpu")->base() + 0x0800, size) != size) + switch (m_cart->get_type()) { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file"); - return IMAGE_INIT_FAIL; + case CF_MAZE: + m_maincpu->space(AS_IO).install_readwrite_handler(0x24, 0x25, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); + break; + case CF_HANGMAN: + m_maincpu->space(AS_IO).install_readwrite_handler(0x20, 0x21, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); + break; + case CF_CHESS: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2800, 0x2fff, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); + break; + case CF_MULTI: + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2800, 0x2fff, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x3000, 0x3fff, write8_delegate(FUNC(channelf_cart_slot_device::write_bank),(channelf_cart_slot_device*)m_cart)); + break; } - - } - else - { - size = image.get_software_region_length("rom"); - memcpy(memregion("maincpu")->base() + 0x0800, image.get_software_region("rom"), size); + + m_cart->save_ram(); } - - return IMAGE_INIT_PASS; } +static SLOT_INTERFACE_START(cf_cart) + SLOT_INTERFACE_INTERNAL("std", CHANF_ROM_STD) + SLOT_INTERFACE_INTERNAL("maze", CHANF_ROM_MAZE) + SLOT_INTERFACE_INTERNAL("hangman", CHANF_ROM_HANGMAN) + SLOT_INTERFACE_INTERNAL("chess", CHANF_ROM_CHESS) + SLOT_INTERFACE_INTERNAL("multi", CHANF_ROM_MULTI) +SLOT_INTERFACE_END + + static MACHINE_CONFIG_FRAGMENT( channelf_cart ) /* cartridge */ - MCFG_CARTSLOT_ADD("cart") - MCFG_CARTSLOT_EXTENSION_LIST("bin,chf") - MCFG_CARTSLOT_INTERFACE("channelf_cart") - MCFG_CARTSLOT_LOAD(channelf_state,channelf_cart) + MCFG_CHANNELF_CARTRIDGE_ADD("cartslot", cf_cart, NULL) /* Software lists */ MCFG_SOFTWARE_LIST_ADD("cart_list","channelf") diff --git a/src/mess/includes/channelf.h b/src/mess/includes/channelf.h index f2f970bf08e..842db13ee4f 100644 --- a/src/mess/includes/channelf.h +++ b/src/mess/includes/channelf.h @@ -9,19 +9,10 @@ #include "emu.h" #include "cpu/f8/f8.h" -#include "imagedev/cartslot.h" #include "audio/channelf.h" - -/* SKR - 2102 RAM chip on carts 10 and 18 I/O ports */ -struct r2102_t -{ - UINT8 d; /* data bit:inverted logic, but reading/writing cancel out */ - UINT8 r_w; /* inverted logic: 0 means read, 1 means write */ - UINT8 a[10]; /* addr bits: inverted logic, but reading/writing cancel out */ - UINT16 addr; /* calculated addr from addr bits */ - UINT8 ram[1024]; /* RAM array */ -}; +#include "bus/chanf/slot.h" +#include "bus/chanf/rom.h" class channelf_state : public driver_device @@ -29,34 +20,32 @@ class channelf_state : public driver_device public: channelf_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_custom(*this,"custom") , - m_maincpu(*this, "maincpu") { } - - DECLARE_READ8_MEMBER(channelf_port_0_r); - DECLARE_READ8_MEMBER(channelf_port_1_r); - DECLARE_READ8_MEMBER(channelf_port_4_r); - DECLARE_READ8_MEMBER(channelf_port_5_r); - DECLARE_READ8_MEMBER(channelf_2102A_r); - DECLARE_READ8_MEMBER(channelf_2102B_r); - DECLARE_WRITE8_MEMBER(channelf_port_0_w); - DECLARE_WRITE8_MEMBER(channelf_port_1_w); - DECLARE_WRITE8_MEMBER(channelf_port_4_w); - DECLARE_WRITE8_MEMBER(channelf_port_5_w); - DECLARE_WRITE8_MEMBER(channelf_2102A_w); - DECLARE_WRITE8_MEMBER(channelf_2102B_w); + m_maincpu(*this, "maincpu"), + m_custom(*this,"custom"), + m_cart(*this, "cartslot") + { } + + DECLARE_READ8_MEMBER(port_0_r); + DECLARE_READ8_MEMBER(port_1_r); + DECLARE_READ8_MEMBER(port_4_r); + DECLARE_READ8_MEMBER(port_5_r); + DECLARE_WRITE8_MEMBER(port_0_w); + DECLARE_WRITE8_MEMBER(port_1_w); + DECLARE_WRITE8_MEMBER(port_4_w); + DECLARE_WRITE8_MEMBER(port_5_w); UINT8 *m_p_videoram; UINT8 m_latch[6]; - r2102_t m_r2102; UINT8 m_val_reg; UINT8 m_row_reg; UINT8 m_col_reg; UINT8 port_read_with_latch(UINT8 ext, UINT8 latch_state); virtual void video_start(); + virtual void machine_start(); DECLARE_PALETTE_INIT(channelf); UINT32 screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( channelf_cart ); - required_device<channelf_sound_device> m_custom; required_device<cpu_device> m_maincpu; + required_device<channelf_sound_device> m_custom; + required_device<channelf_cart_slot_device> m_cart; int recalc_palette_offset(int reg1, int reg2); }; diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 47b18329e99..37691c7acdb 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -568,12 +568,14 @@ BUSES += ABCBUS BUSES += ABCKB BUSES += ADAM BUSES += ADAMNET +BUSES += APF BUSES += BML3 BUSES += BW2 BUSES += C64 BUSES += CBM2 BUSES += CBMIEC BUSES += CENTRONICS +BUSES += CHANNELF BUSES += COCO BUSES += COLECO BUSES += COMPUCOLOR |