diff options
author | 2014-09-30 06:05:07 +0000 | |
---|---|---|
committer | 2014-09-30 06:05:07 +0000 | |
commit | 5f77979a2c8cd7e215574367cc18b17a521dcdbd (patch) | |
tree | 0cc7dc35c5841b74ea76fe420389bf6926eeee2a | |
parent | bf5d2bcf28c9844c53c4b09d805f0c2dff4d69a5 (diff) |
(MESS) converted scv and vboy to use slot devices for
their carts. nw.
-rw-r--r-- | .gitattributes | 8 | ||||
-rw-r--r-- | hash/scv.xml | 32 | ||||
-rw-r--r-- | hash/vboy.xml | 31 | ||||
-rw-r--r-- | src/emu/bus/bus.mak | 20 | ||||
-rw-r--r-- | src/emu/bus/scv/rom.c | 203 | ||||
-rw-r--r-- | src/emu/bus/scv/rom.h | 149 | ||||
-rw-r--r-- | src/emu/bus/scv/slot.c | 318 | ||||
-rw-r--r-- | src/emu/bus/scv/slot.h | 118 | ||||
-rw-r--r-- | src/emu/bus/vboy/rom.c | 59 | ||||
-rw-r--r-- | src/emu/bus/vboy/rom.h | 45 | ||||
-rw-r--r-- | src/emu/bus/vboy/slot.c | 267 | ||||
-rw-r--r-- | src/emu/bus/vboy/slot.h | 114 | ||||
-rw-r--r-- | src/mess/drivers/scv.c | 267 | ||||
-rw-r--r-- | src/mess/drivers/vboy.c | 234 | ||||
-rw-r--r-- | src/mess/mess.mak | 2 |
15 files changed, 1486 insertions, 381 deletions
diff --git a/.gitattributes b/.gitattributes index cd2c92be163..175b7d8c17f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1495,6 +1495,10 @@ src/emu/bus/scsi/scsihd.c svneol=native#text/plain src/emu/bus/scsi/scsihd.h svneol=native#text/plain src/emu/bus/scsi/scsihle.c svneol=native#text/plain src/emu/bus/scsi/scsihle.h svneol=native#text/plain +src/emu/bus/scv/rom.c svneol=native#text/plain +src/emu/bus/scv/rom.h svneol=native#text/plain +src/emu/bus/scv/slot.c svneol=native#text/plain +src/emu/bus/scv/slot.h svneol=native#text/plain src/emu/bus/sega8/rom.c svneol=native#text/plain src/emu/bus/sega8/rom.h svneol=native#text/plain src/emu/bus/sega8/sega8_slot.c svneol=native#text/plain @@ -1581,6 +1585,10 @@ src/emu/bus/tvc/hbf.c svneol=native#text/plain src/emu/bus/tvc/hbf.h svneol=native#text/plain src/emu/bus/tvc/tvc.c svneol=native#text/plain src/emu/bus/tvc/tvc.h svneol=native#text/plain +src/emu/bus/vboy/rom.c svneol=native#text/plain +src/emu/bus/vboy/rom.h svneol=native#text/plain +src/emu/bus/vboy/slot.c svneol=native#text/plain +src/emu/bus/vboy/slot.h svneol=native#text/plain src/emu/bus/vcs/compumat.c svneol=native#text/plain src/emu/bus/vcs/compumat.h svneol=native#text/plain src/emu/bus/vcs/dpc.c svneol=native#text/plain diff --git a/hash/scv.xml b/hash/scv.xml index b3c7aac8516..1e3446c32dd 100644 --- a/hash/scv.xml +++ b/hash/scv.xml @@ -63,6 +63,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1984</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom8k" /> <dataarea name="rom" size="8192"> <rom name="astrwrs.bin" size="8192" crc="2dbdb166" sha1="53a9a308b6f0bcb2137704f70657698719551b5e" offset="0000" /> </dataarea> @@ -74,6 +75,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1984</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom8k" /> <dataarea name="rom" size="8192"> <rom name="astrwrs2.bin" size="8192" crc="34781de1" sha1="b419f2fccf3b2fbd360da2833064d2ea8bd6500b" offset="0000" /> </dataarea> @@ -85,6 +87,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom32k" /> <dataarea name="rom" size="32768"> <rom name="basic.bin" size="32768" crc="ca965c2b" sha1="c68e2b81dec2c83e2aa5626c8df4011eada45245" offset="0000" /> </dataarea> @@ -97,6 +100,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1984</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="baseball.bin" size="16384" crc="56f1c473" sha1="37a1dce6c1921950c588d6492cd1b57feb615175" offset="0000" /> </dataarea> @@ -108,6 +112,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="boulder_dash.bin" size="16384" crc="e045884c" sha1="55942e5b7824314b072b7b40c6b72db0d5404189" offset="0" /> </dataarea> @@ -119,6 +124,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="comic_circus.bin" size="16384" crc="ea55faed" sha1="2e4ceb2bf68d26c263c3d1c63f7e2143ef2355bc" offset="0" /> </dataarea> @@ -130,6 +136,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom64k" /> <dataarea name="rom" size="65536"> <rom name="doraemon.0" size="32768" crc="ee0b874d" sha1="425eb6ed31faa2afdecc216145616f577f72db9a" offset="0" /> <rom name="doraemon.1" size="32768" crc="d2de91a6" sha1="6aba5ee3d08afad222bec9a176c2607829fa5cc6" offset="0x8000" /> @@ -142,6 +149,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1986</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom128k" /> <dataarea name="rom" size="131072"> <rom name="dragonba.bin" size="131072" crc="ea251664" sha1="bd3791ed43a2019a255152e3fc0d8a663cb9567a" offset="0" /> </dataarea> @@ -153,6 +161,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1986</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom32k_ram" /> <dataarea name="rom" size="32768"> <rom name="dragonsl.bin" size="32768" crc="5971940f" sha1="c6e67e05d365fa81d3d9a3ad66d41bfeb1c3dd0d" offset="0" /> </dataarea> @@ -166,6 +175,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1984</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="elevfght.bin" size="16384" crc="72dd6031" sha1="8b2c185408309ee1e75d40299c003041db17b133" offset="0000" /> </dataarea> @@ -178,6 +188,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom64k" /> <dataarea name="rom" size="65536"> <rom name="kungfurd.0" size="32768" crc="9cfc5a67" sha1="1c34470c1f389db7be755e130db298f6b475c7ce" offset="0" /> <rom size="24576" offset="0x8000" loadflag="reload" /> @@ -191,6 +202,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1984</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="lupin3.bin" size="16384" crc="16d7eb4a" sha1="62698c7c9d9723f74214626a4211a3c3f34e9dd5" offset="0" /> </dataarea> @@ -202,6 +214,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1986</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom32k" /> <dataarea name="rom" size="32768"> <rom name="mappy.bin" size="32768" crc="605829bb" sha1="70dc025ab3f32e18fd6f373dc47c9aa7fb9d48f0" offset="0" /> </dataarea> @@ -213,6 +226,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom32k" /> <dataarea name="rom" size="32768"> <rom name="mlkprncs.bin" size="32768" crc="b2457990" sha1="b6234f99e474abd87a22a4b691b66bcb12e664cb" offset="0" /> </dataarea> @@ -224,6 +238,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="miner_2049er.bin" size="16384" crc="b0ffc6e2" sha1="0414878f4aedade180b273257497c1d11cdccb2f" offset="0" /> </dataarea> @@ -236,6 +251,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1986</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom128k" /> <dataarea name="rom" size="131072"> <rom name="y2mnstld.bin" size="131072" crc="3ac28fe0" sha1="5ae7796ad35a7c537de11ebd3cfe3868d67235a1" offset="0" /> </dataarea> @@ -247,6 +263,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1984</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="nebula.bin" size="16384" crc="5e6a4caf" sha1="699eaf434e73a42e71adf52426b22f0dd85e2897" offset="0000" /> </dataarea> @@ -258,6 +275,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1984</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="nebulaa.bin" size="16384" crc="efb4bdcd" sha1="94a4b9a92d6f9a5f4a68721be4cc35920ca32628" offset="0" /> </dataarea> @@ -269,6 +287,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom128k_ram" /> <dataarea name="rom" size="131072"> <rom name="polepos2.bin" size="131072" crc="cb69903d" sha1="472900d7b7fa6cdf30014731dcc925ef5ca65499" offset="0" /> </dataarea> @@ -282,6 +301,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom32k_ram" /> <dataarea name="rom" size="32768"> <rom name="popchips.bin" size="32768" crc="cc4fb04d" sha1="5979abd6051d531eafe1ea3b37c97ce2e3e97f8e" offset="0" /> </dataarea> @@ -295,6 +315,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1986</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom128k" /> <dataarea name="rom" size="131072"> <rom name="prowrest.bin" size="131072" crc="5b1fb2a8" sha1="55fe356c04ce3db83cb3148d867cc8b8060cbb48" offset="0" /> </dataarea> @@ -306,6 +327,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1984</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="punchboy.bin" size="16384" crc="4107f03a" sha1="e7391c71ba7deede3db22191ea058ccf429d7bb5" offset="0000" /> </dataarea> @@ -317,6 +339,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1984</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="real_graphic_mahjong.bin" size="16384" crc="d3d9106c" sha1="7190ff2944c1ffbde6866e720417b86b3844ffa2" offset="0" /> </dataarea> @@ -328,6 +351,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1986</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom64k" /> <dataarea name="rom" size="65536"> <rom name="skykid.bin" size="65536" crc="f49f2085" sha1="7342fe10d38c79ed12fbfa94b5fd4bf1266c2571" offset="0" /> </dataarea> @@ -339,6 +363,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom64k" /> <dataarea name="rom" size="65536"> <rom name="starspeeder.1" size="8192" crc="7978c4a6" sha1="6bb5ff3946867fa7adb6561dc084ef5a7a92c507" offset="0" /> <rom size="8192" offset="0x2000" loadflag="reload" /> @@ -354,6 +379,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom32k_ram" /> <dataarea name="rom" size="32768"> <rom name="shoginyu.bin" size="32768" crc="84005c4c" sha1="bd6681013dbbae94c03e501932836db07943468e" offset="0" /> </dataarea> @@ -367,6 +393,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom32k" /> <dataarea name="rom" size="32768"> <rom name="sansupyuta.bin" size="32768" crc="6e7e01b5" sha1="dc05257c831cffa5ec66302c88e1d45a92c6dc9c" offset="0" /> </dataarea> @@ -379,6 +406,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="soccer.bin" size="16384" crc="8283907c" sha1="61e4b8e43cc593b3a2e838c08f6dad6cca77d712" offset="0000" /> </dataarea> @@ -391,6 +419,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="soccera.bin" size="16384" crc="590eeefd" sha1="951ecd2a1d2e7d900c13e91ff028723a9df9e60e" offset="0000" /> </dataarea> @@ -403,6 +432,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1984</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="suprgolf.bin" size="16384" crc="0c0581c9" sha1="2d3ab09907a4a9c5d66306f316c7211f498cbcc2" offset="0000" /> </dataarea> @@ -414,6 +444,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="ttball.bin" size="16384" crc="7f873bfa" sha1="093235ac2234c4c4e78a2addaab780d7a2cbe004" offset="0" /> </dataarea> @@ -425,6 +456,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html <year>1985</year> <publisher>Epoch</publisher> <part name="cart" interface="scv_cart"> + <feature name="slot" value="rom16k" /> <dataarea name="rom" size="16384"> <rom name="wheelrcr.bin" size="16384" crc="9d9b29db" sha1="479f767384e7b7bfe58eeadd67dbe642fe8a2fcf" offset="0000" /> </dataarea> diff --git a/hash/vboy.xml b/hash/vboy.xml index 0f3457d990f..215dcf2d50c 100644 --- a/hash/vboy.xml +++ b/hash/vboy.xml @@ -21,6 +21,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VPBE-USA"/> <info name="release" value="19960322"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="3-d tetris (usa).bin" size="1048576" crc="bb71b522" sha1="5177015a91442e56bd76af39447bca365e06c272" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -36,6 +37,7 @@ According to Planet Virtual Boy, the following undumped protos exist <publisher>Nintendo</publisher> <info name="serial" value="VUE-VBHE-JPN, VUE-VBHE-USA"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="bound high! (ju).bin" size="2097152" crc="e81a3703" sha1="1196ef8b9a96a0ff2f3634f8eb1c4865c0fb6b01" offset="000000" /> </dataarea> @@ -50,6 +52,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VGPJ-JPN, VUE-VGPJ-USA"/> <info name="release" value="19950701 (JPN), 19950814 (USA)"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="galactic pinball (japan, usa).bin" size="1048576" crc="c9710a36" sha1="93a25abf4f86e71a49c1c3a470140bb40cb693d6" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -65,6 +68,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VVGE-USA"/> <info name="release" value="199511xx"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_eeprom" /> <dataarea name="rom" size="2097152"> <rom name="golf (usa).bin" size="2097152" crc="2199af41" sha1="23ce3c174789cdd306497d86cb2c4e76ba8b06e5" offset="000000" /> </dataarea> @@ -81,6 +85,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VIMJ-JPN"/> <info name="release" value="19951013"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="innsmouth no yakata (japan).bin" size="1048576" crc="83cb6a00" sha1="37e06e53ce2810e870835c48decdd6c72079bfda" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -96,6 +101,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VJBE-USA"/> <info name="release" value="19951020"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="jack bros. (usa).bin" size="1048576" crc="a44de03c" sha1="0e086d7ef2bd8b97315196943fd0b71da07aa8f1" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -111,6 +117,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VJBJ-JPN"/> <info name="release" value="19950929"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="jack bros. no meiro de hiihoo! (japan).bin" size="1048576" crc="cab61e8b" sha1="a973406590382ee503037271330d68d2834b79db" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -126,6 +133,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VMCJ-JPN, VUE-VMCJ-USA"/> <info name="release" value="19950928 (JPN), 199510xx (USA)"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="mario clash (japan, usa).bin" size="1048576" crc="a47de78c" sha1="7556a778b60490bdb81774bcbaa7413fc84cb985" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -141,6 +149,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VMTJ-JPN, VUE-VMTJ-USA"/> <info name="release" value="19950721 (JPN), 19950814 (USA)"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="mario's tennis (japan, usa).bin" size="524288" crc="7ce7460d" sha1="5162f7fa9e3eae4338c53ccba641ba080c768754" offset="000000" /> <rom size="524288" offset="0x080000" loadflag="reload" /> @@ -158,6 +167,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VNFE-USA"/> <info name="release" value="19960226"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="nester's funky bowling (usa).bin" size="2097152" crc="df4d56b4" sha1="f4a4c7928f15102cf14c90c5f044e5f7cc7c32f9" offset="000000" /> </dataarea> @@ -170,6 +180,7 @@ According to Planet Virtual Boy, the following undumped protos exist <publisher>Bullet-Proof Software</publisher> <info name="alt_title" value="ニコちゃんバトル"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="nikochan battle (j)(prototype).bin" size="1048576" crc="f3cd40dd" sha1="217ca062f65d4e8b2848085918af5ac4b33b12d4" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -185,6 +196,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VH2E-USA"/> <info name="release" value="199512xx"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="panic bomber (usa).bin" size="524288" crc="19bb2dfb" sha1="80216b2874cf162f301d571bb8aebc98d80b4f3e" offset="000000" /> <rom size="524288" offset="0x080000" loadflag="reload" /> @@ -202,6 +214,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VREE-USA"/> <info name="release" value="19950814"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="red alarm (usa).bin" size="1048576" crc="aa10a7b4" sha1="494fa60cb8997880b4e8cd3270b21d6c2768a48a" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -217,6 +230,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VREJ-JPN"/> <info name="release" value="19950721"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="red alarm (japan).bin" size="1048576" crc="7e85c45d" sha1="f5057fa9bfd9d60b9dcfc004cfdd12aa8eb1cb4a" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -232,6 +246,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VSDJ-JPN"/> <info name="release" value="19951222"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="sd gundam - dimension war (japan).bin" size="1048576" crc="44788197" sha1="1a67f6bdb45db46e22b8aadea754a68ad379ae29" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -247,6 +262,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VSPJ-JPN"/> <info name="release" value="19951201"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="space invaders - virtual collection (japan).bin" size="524288" crc="fa44402d" sha1="16ad904faafd24642dfd056d10a768e81f0d9bfa" offset="000000" /> <rom size="524288" offset="0x080000" loadflag="reload" /> @@ -261,6 +277,7 @@ According to Planet Virtual Boy, the following undumped protos exist <year>1995</year> <publisher>Nintendo</publisher> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="space pinball prototype (j).bin" size="2097152" crc="44c2b723" sha1="dc182360c7c8d26323db8921f09db76638e81ced" offset="000000" /> </dataarea> @@ -275,6 +292,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VSSJ-JPN"/> <info name="release" value="19950929"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="space squash (japan).bin" size="524288" crc="60895693" sha1="3f08cae2b6f9e386529949ff954220860db1af64" offset="000000" /> <rom size="524288" offset="0x080000" loadflag="reload" /> @@ -292,6 +310,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VTBJ-JPN, VUE-VTBJ-USA"/> <info name="release" value="19950721 (JPN), 19950814 (USA)"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_eeprom" /> <dataarea name="rom" size="2097152"> <rom name="teleroboxer (japan, usa).bin" size="1048576" crc="36103000" sha1="c59e020f9674774c5cbc022317ebba0eb1d744f7" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -309,6 +328,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VH2J-JPN"/> <info name="release" value="19950721"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="tobidase! panibon (japan).bin" size="524288" crc="40498f5e" sha1="b8a12a9677afa5cbce6ed43eb0effb5a02875534" offset="000000" /> <rom size="524288" offset="0x080000" loadflag="reload" /> @@ -326,6 +346,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VVBJ-JPN"/> <info name="release" value="19951222"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="virtual bowling (japan).bin" size="1048576" crc="20688279" sha1="a5be7654037050f0a781e70efea0191f43d26f06" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -341,6 +362,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VVFJ-JPN"/> <info name="release" value="19951016"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_eeprom" /> <dataarea name="rom" size="2097152"> <rom name="virtual fishing (japan).bin" size="1048576" crc="526cc969" sha1="583b409b7215159219d08e789db46140062095f2" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -358,6 +380,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VH3E-USA"/> <info name="release" value="19951201"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="vertical force (usa).bin" size="1048576" crc="4c32ba5e" sha1="38f9008f60b09deef1151d46b905b090a0338200" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -373,6 +396,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VH3J-JPN"/> <info name="release" value="19950812"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="vertical force (japan).bin" size="1048576" crc="9e9b8b92" sha1="c7204ba5cfe7d26394b5e22badc580c8ed8c0b37" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -388,6 +412,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VVGJ-JPN"/> <info name="release" value="19950811"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_eeprom" /> <dataarea name="rom" size="2097152"> <rom name="t&e virtual golf (japan).bin" size="2097152" crc="6ba07915" sha1="c595285d42c69f14b2b418c1edfbe4a7f9a624b6" offset="000000" /> </dataarea> @@ -404,6 +429,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VJVJ-JPN"/> <info name="release" value="19951208"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="virtual lab (japan).bin" size="1048576" crc="8989fe0a" sha1="d96c9f8aac5b4ea012a8fe659bb68fb1159a9c6d" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -419,6 +445,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VVPE-USA"/> <info name="release" value="19950911"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="virtual league baseball (usa).bin" size="1048576" crc="736b40d6" sha1="266fe615ee3df1160a20b456824699f16810fa28" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -434,6 +461,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VVPJ-JPN"/> <info name="release" value="19950811"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="virtual pro yakyuu '95 (japan).bin" size="1048576" crc="9ba8bb5e" sha1="ab8fa82b79512eefefccdccea6768078a374c4aa" offset="000000" /> <rom size="1048576" offset="0x100000" loadflag="reload" /> @@ -449,6 +477,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VTRJ-JPN"/> <info name="release" value="19950825"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="v-tetris (japan).bin" size="524288" crc="3ccb67ae" sha1="ff7d4dfc467e6e0d3fe8517102132a65a9d17589" offset="000000" /> <rom size="524288" offset="0x080000" loadflag="reload" /> @@ -466,6 +495,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VWCJ-JPN, VUE-VWCJ-USA"/> <info name="release" value="19951201 (JPN), 199511xx (USA)"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_eeprom" /> <dataarea name="rom" size="2097152"> <rom name="virtual boy wario land (japan, usa).bin" size="2097152" crc="133e9372" sha1="274c328fbd904f20e69172ab826bf8f94ced1bdb" offset="000000" /> </dataarea> @@ -482,6 +512,7 @@ According to Planet Virtual Boy, the following undumped protos exist <info name="serial" value="VUE-VWEE-USA"/> <info name="release" value="19951221"/> <part name="cart" interface="vboy_cart"> + <feature name="slot" value="vb_rom" /> <dataarea name="rom" size="2097152"> <rom name="waterworld (usa).bin" size="2097152" crc="82a95e51" sha1="dcc46484bd0acab0ac1ea178f425a0f5ccfb8dc2" offset="000000" /> </dataarea> diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index 009fede5a0b..09986d28ac2 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -958,6 +958,16 @@ endif #------------------------------------------------- # +#@src/emu/bus/vboy/slot.h,BUSES += VBOY +#------------------------------------------------- +ifneq ($(filter VBOY,$(BUSES)),) +OBJDIRS += $(BUSOBJ)/vboy +BUSOBJS += $(BUSOBJ)/vboy/slot.o +BUSOBJS += $(BUSOBJ)/vboy/rom.o +endif + +#------------------------------------------------- +# #@src/emu/bus/megadrive/md_slot.h,BUSES += MEGADRIVE #------------------------------------------------- @@ -1175,6 +1185,16 @@ endif #------------------------------------------------- # +#@src/emu/bus/scv/slot.h,BUSES += SCV +#------------------------------------------------- +ifneq ($(filter SCV,$(BUSES)),) +OBJDIRS += $(BUSOBJ)/scv +BUSOBJS += $(BUSOBJ)/scv/slot.o +BUSOBJS += $(BUSOBJ)/scv/rom.o +endif + +#------------------------------------------------- +# #@src/emu/bus/x68k/x68kexp.h,BUSES += X68K #------------------------------------------------- ifneq ($(filter X68K,$(BUSES)),) diff --git a/src/emu/bus/scv/rom.c b/src/emu/bus/scv/rom.c new file mode 100644 index 00000000000..39d33a86ee8 --- /dev/null +++ b/src/emu/bus/scv/rom.c @@ -0,0 +1,203 @@ +/*********************************************************************************************************** + + + Epoch Super Cassette Vision cart emulation + + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "rom.h" + + +//------------------------------------------------- +// scv_rom_device - constructor +//------------------------------------------------- + +const device_type SCV_ROM8K = &device_creator<scv_rom8_device>; +const device_type SCV_ROM16K = &device_creator<scv_rom16_device>; +const device_type SCV_ROM32K = &device_creator<scv_rom32_device>; +const device_type SCV_ROM32K_RAM8K = &device_creator<scv_rom32ram8_device>; +const device_type SCV_ROM64K = &device_creator<scv_rom64_device>; +const device_type SCV_ROM128K = &device_creator<scv_rom128_device>; +const device_type SCV_ROM128K_RAM4K = &device_creator<scv_rom128ram4_device>; + + +scv_rom8_device::scv_rom8_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_scv_cart_interface( mconfig, *this ) +{ +} + +scv_rom8_device::scv_rom8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SCV_ROM8K, "SCV 8K Carts", tag, owner, clock, "scv_rom8", __FILE__), + device_scv_cart_interface( mconfig, *this ) +{ +} + +scv_rom16_device::scv_rom16_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : scv_rom8_device(mconfig, SCV_ROM16K, "SCV 16K Carts", tag, owner, clock, "scv_rom16", __FILE__) +{ +} + +scv_rom32_device::scv_rom32_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : scv_rom8_device(mconfig, SCV_ROM32K, "SCV 32K Carts", tag, owner, clock, "scv_rom32", __FILE__) +{ +} + +scv_rom32ram8_device::scv_rom32ram8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : scv_rom8_device(mconfig, SCV_ROM32K_RAM8K, "SCV 32K + RAM 8K Carts", tag, owner, clock, "scv_rom32_ram8", __FILE__) +{ +} + +scv_rom64_device::scv_rom64_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : scv_rom8_device(mconfig, SCV_ROM16K, "SCV 64K Carts", tag, owner, clock, "scv_rom64", __FILE__) +{ +} + +scv_rom128_device::scv_rom128_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : scv_rom8_device(mconfig, SCV_ROM32K, "SCV 128K Carts", tag, owner, clock, "scv_rom128", __FILE__) +{ +} + +scv_rom128ram4_device::scv_rom128ram4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : scv_rom8_device(mconfig, SCV_ROM128K_RAM4K, "SCV 128K + RAM 4K Carts", tag, owner, clock, "scv_rom128_ram4", __FILE__) +{ +} + + +//------------------------------------------------- +// mapper specific start/reset +//------------------------------------------------- + +void scv_rom32ram8_device::device_start() +{ + save_item(NAME(m_ram_enabled)); +} + +void scv_rom32ram8_device::device_reset() +{ + m_ram_enabled = 1; +} + + +void scv_rom64_device::device_start() +{ + save_item(NAME(m_bank_base)); +} + +void scv_rom64_device::device_reset() +{ + m_bank_base = 0; +} + + +void scv_rom128_device::device_start() +{ + save_item(NAME(m_bank_base)); +} + +void scv_rom128_device::device_reset() +{ + m_bank_base = 0; +} + + +void scv_rom128ram4_device::device_start() +{ + save_item(NAME(m_bank_base)); + save_item(NAME(m_ram_enabled)); +} + +void scv_rom128ram4_device::device_reset() +{ + m_bank_base = 0; + m_ram_enabled = 1; +} + + + +/*------------------------------------------------- + mapper specific handlers + -------------------------------------------------*/ + +READ8_MEMBER(scv_rom8_device::read_cart) +{ + return m_rom[offset & 0x1fff]; +} + + +READ8_MEMBER(scv_rom16_device::read_cart) +{ + return m_rom[offset & 0x3fff]; +} + + +READ8_MEMBER(scv_rom32_device::read_cart) +{ + return m_rom[offset]; +} + + +READ8_MEMBER(scv_rom32ram8_device::read_cart) +{ + if (m_ram_enabled && offset >= 0x6000) + return m_ram[offset & 0x1fff]; + + return m_rom[offset]; +} + +WRITE8_MEMBER(scv_rom32ram8_device::write_cart) +{ + if (m_ram_enabled && offset >= 0x6000) + m_ram[offset & 0x1fff] = data; +} + +WRITE8_MEMBER(scv_rom32ram8_device::write_bank) +{ + m_ram_enabled = BIT(data, 5); +} + + +READ8_MEMBER(scv_rom64_device::read_cart) +{ + return m_rom[offset + (m_bank_base * 0x8000)]; +} + +WRITE8_MEMBER(scv_rom64_device::write_bank) +{ + m_bank_base = BIT(data, 5); +} + + +READ8_MEMBER(scv_rom128_device::read_cart) +{ + return m_rom[offset + (m_bank_base * 0x8000)]; +} + +WRITE8_MEMBER(scv_rom128_device::write_bank) +{ + m_bank_base = (data >> 5) & 0x03; +} + + +READ8_MEMBER(scv_rom128ram4_device::read_cart) +{ + if (m_ram_enabled && offset >= 0x7000) + return m_ram[offset & 0xfff]; + + return m_rom[offset + (m_bank_base * 0x8000)]; +} + +WRITE8_MEMBER(scv_rom128ram4_device::write_cart) +{ + if (m_ram_enabled && offset >= 0x7000) + m_ram[offset & 0xfff] = data; +} + +WRITE8_MEMBER(scv_rom128ram4_device::write_bank) +{ + m_bank_base = (data >> 5) & 0x03; + m_ram_enabled = BIT(data, 6); +} diff --git a/src/emu/bus/scv/rom.h b/src/emu/bus/scv/rom.h new file mode 100644 index 00000000000..1ef3c4f8ecc --- /dev/null +++ b/src/emu/bus/scv/rom.h @@ -0,0 +1,149 @@ +#ifndef __SCV_ROM_H +#define __SCV_ROM_H + +#include "slot.h" + + +// ======================> scv_rom8_device + +class scv_rom8_device : public device_t, + public device_scv_cart_interface +{ +public: + // construction/destruction + scv_rom8_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); + scv_rom8_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_cart); +}; + +// ======================> scv_rom16_device + +class scv_rom16_device : public scv_rom8_device +{ +public: + // construction/destruction + scv_rom16_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_cart); +}; + + +// ======================> scv_rom32_device + +class scv_rom32_device : public scv_rom8_device +{ +public: + // construction/destruction + scv_rom32_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_cart); +}; + + +// ======================> scv_rom32ram8_device + +class scv_rom32ram8_device : public scv_rom8_device +{ +public: + // construction/destruction + scv_rom32ram8_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_cart); + virtual DECLARE_WRITE8_MEMBER(write_cart); + virtual DECLARE_WRITE8_MEMBER(write_bank); + +private: + UINT8 m_ram_enabled; +}; + + +// ======================> scv_rom64_device + +class scv_rom64_device : public scv_rom8_device +{ +public: + // construction/destruction + scv_rom64_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_cart); + virtual DECLARE_WRITE8_MEMBER(write_bank); + +private: + UINT8 m_bank_base; +}; + + +// ======================> scv_rom128_device + +class scv_rom128_device : public scv_rom8_device +{ +public: + // construction/destruction + scv_rom128_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_cart); + virtual DECLARE_WRITE8_MEMBER(write_bank); + +private: + UINT8 m_bank_base; +}; + + +// ======================> scv_rom128ram4_device + +class scv_rom128ram4_device : public scv_rom8_device +{ +public: + // construction/destruction + scv_rom128ram4_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_cart); + virtual DECLARE_WRITE8_MEMBER(write_cart); + virtual DECLARE_WRITE8_MEMBER(write_bank); + +private: + UINT8 m_bank_base, m_ram_enabled; +}; + + + +// device type definition +extern const device_type SCV_ROM8K; +extern const device_type SCV_ROM16K; +extern const device_type SCV_ROM32K; +extern const device_type SCV_ROM32K_RAM8K; +extern const device_type SCV_ROM64K; +extern const device_type SCV_ROM128K; +extern const device_type SCV_ROM128K_RAM4K; + + + +#endif diff --git a/src/emu/bus/scv/slot.c b/src/emu/bus/scv/slot.c new file mode 100644 index 00000000000..1696051b013 --- /dev/null +++ b/src/emu/bus/scv/slot.c @@ -0,0 +1,318 @@ +/*********************************************************************************************************** + + Epoch Super Cassette Vision cart emulation + (through slot devices) + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "slot.h" + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type SCV_CART_SLOT = &device_creator<scv_cart_slot_device>; + +//************************************************************************** +// SCV cartridges Interface +//************************************************************************** + +//------------------------------------------------- +// device_scv_cart_interface - constructor +//------------------------------------------------- + +device_scv_cart_interface::device_scv_cart_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device), + m_rom(NULL), + m_rom_size(0) +{ +} + + +//------------------------------------------------- +// ~device_scv_cart_interface - destructor +//------------------------------------------------- + +device_scv_cart_interface::~device_scv_cart_interface() +{ +} + +//------------------------------------------------- +// rom_alloc - alloc the space for the cart +//------------------------------------------------- + +void device_scv_cart_interface::rom_alloc(UINT32 size, const char *tag) +{ + if (m_rom == NULL) + { + astring tempstring(tag); + tempstring.cat(SCVSLOT_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_scv_cart_interface::ram_alloc(UINT32 size) +{ + m_ram.resize(size); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// scv_cart_slot_device - constructor +//------------------------------------------------- +scv_cart_slot_device::scv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, SCV_CART_SLOT, "SCV Cartridge Slot", tag, owner, clock, "scv_cart_slot", __FILE__), + device_image_interface(mconfig, *this), + device_slot_interface(mconfig, *this), + m_type(SCV_8K) +{ +} + + +//------------------------------------------------- +// scv_cart_slot_device - destructor +//------------------------------------------------- + +scv_cart_slot_device::~scv_cart_slot_device() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void scv_cart_slot_device::device_start() +{ + m_cart = dynamic_cast<device_scv_cart_interface *>(get_card_device()); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void scv_cart_slot_device::device_config_complete() +{ + // set brief and instance name + update_names(); +} + + +//------------------------------------------------- +// SCV PCB +//------------------------------------------------- + +struct scv_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 scv_slot slot_list[] = +{ + { SCV_8K, "rom8k" }, + { SCV_16K, "rom16k" }, + { SCV_32K, "rom32k" }, + { SCV_32K_RAM, "rom32k_ram" }, + { SCV_64K, "rom64k" }, + { SCV_128K, "rom128k" }, + { SCV_128K_RAM, "rom128k_ram" } +}; + +static int scv_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 *scv_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 "rom8k"; +} + + +/*------------------------------------------------- + call load + -------------------------------------------------*/ + +bool scv_cart_slot_device::call_load() +{ + if (m_cart) + { + UINT8 *ROM; + UINT32 len = (software_entry() == NULL) ? length() : get_software_region_length("rom"); + bool has_ram = (software_entry() != NULL) && get_software_region("ram"); + + if (len > 0x20000) + { + seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(len, tag()); + if (has_ram) + m_cart->ram_alloc(get_software_region_length("ram")); + + ROM = m_cart->get_rom_base(); + + if (software_entry() == NULL) + fread(ROM, len); + else + memcpy(ROM, get_software_region("rom"), len); + + if (software_entry() == NULL) + m_type = get_cart_type(ROM, len); + else + { + const char *pcb_name = get_feature("slot"); + if (pcb_name) + m_type = scv_get_pcb_id(pcb_name); + } + + // for the moment we only support RAM from softlist and in the following configurations + // 1) 32K ROM + 8K RAM; 2) 128K ROM + 4K RAM + if (m_type == SCV_32K && has_ram) + m_type = SCV_32K_RAM; + if (m_type == SCV_128K && has_ram) + m_type = SCV_128K_RAM; + + //printf("Type: %s\n", scv_get_slot(m_type)); + + return IMAGE_INIT_PASS; + } + + return IMAGE_INIT_PASS; +} + + +/*------------------------------------------------- + call softlist load + -------------------------------------------------*/ + +bool scv_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_cart_type - code to detect NVRAM type from + fullpath + -------------------------------------------------*/ + +int scv_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) +{ + int type = SCV_8K; + + // TO DO: is there any way to identify carts with RAM?!? + switch (len) + { + case 0x2000: + type = SCV_8K; + break; + case 0x4000: + type = SCV_16K; + break; + case 0x8000: + type = SCV_32K; + break; + case 0x10000: + type = SCV_64K; + break; + case 0x20000: + type = SCV_128K; + break; + } + + return type; +} + + +/*------------------------------------------------- + get default card software + -------------------------------------------------*/ + +void scv_cart_slot_device::get_default_card_software(astring &result) +{ + if (open_image_file(mconfig().options())) + { + const char *slot_string = "rom8k"; + UINT32 len = core_fsize(m_file); + dynamic_buffer rom(len); + int type; + + core_fread(m_file, rom, len); + + type = get_cart_type(rom, len); + slot_string = scv_get_slot(type); + + //printf("type: %s\n", slot_string); + clear(); + + result.cpy(slot_string); + return; + } + + software_get_default_slot(result, "rom8k"); +} + +/*------------------------------------------------- + read + -------------------------------------------------*/ + +READ8_MEMBER(scv_cart_slot_device::read_cart) +{ + if (m_cart) + return m_cart->read_cart(space, offset); + else + return 0xff; +} + +/*------------------------------------------------- + write + -------------------------------------------------*/ + +WRITE8_MEMBER(scv_cart_slot_device::write_cart) +{ + if (m_cart) + m_cart->write_cart(space, offset, data); +} + + +/*------------------------------------------------- + write_bank + -------------------------------------------------*/ + +WRITE8_MEMBER(scv_cart_slot_device::write_bank) +{ + if (m_cart) + m_cart->write_bank(space, offset, data); +} + diff --git a/src/emu/bus/scv/slot.h b/src/emu/bus/scv/slot.h new file mode 100644 index 00000000000..61e3fdfd9da --- /dev/null +++ b/src/emu/bus/scv/slot.h @@ -0,0 +1,118 @@ +#ifndef __SCV_SLOT_H +#define __SCV_SLOT_H + +/*************************************************************************** + TYPE DEFINITIONS + ***************************************************************************/ + + +/* PCB */ +enum +{ + SCV_8K = 0, + SCV_16K, + SCV_32K, + SCV_32K_RAM, + SCV_64K, + SCV_128K, + SCV_128K_RAM +}; + + +// ======================> device_scv_cart_interface + +class device_scv_cart_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_scv_cart_interface(const machine_config &mconfig, device_t &device); + virtual ~device_scv_cart_interface(); + + // reading and writing + virtual DECLARE_READ8_MEMBER(read_cart) { return 0xff; } + virtual DECLARE_WRITE8_MEMBER(write_cart) {} + 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; +}; + + +// ======================> scv_cart_slot_device + +class scv_cart_slot_device : public device_t, + public device_image_interface, + public device_slot_interface +{ +public: + // construction/destruction + scv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~scv_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; } + int get_cart_type(UINT8 *ROM, UINT32 len); + + 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 "scv_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_cart); + virtual DECLARE_WRITE8_MEMBER(write_cart); + virtual DECLARE_WRITE8_MEMBER(write_bank); + +protected: + + int m_type; + device_scv_cart_interface* m_cart; +}; + + + +// device type definition +extern const device_type SCV_CART_SLOT; + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS + ***************************************************************************/ + +#define SCVSLOT_ROM_REGION_TAG ":cart:rom" + +#define MCFG_SCV_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ + MCFG_DEVICE_ADD(_tag, SCV_CART_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ + +#endif diff --git a/src/emu/bus/vboy/rom.c b/src/emu/bus/vboy/rom.c new file mode 100644 index 00000000000..a572c08c367 --- /dev/null +++ b/src/emu/bus/vboy/rom.c @@ -0,0 +1,59 @@ +/*********************************************************************************************************** + + + Nintendo Virtual Boy cart emulation + + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "rom.h" + + +//------------------------------------------------- +// vboy_rom_device - constructor +//------------------------------------------------- + +const device_type VBOY_ROM_STD = &device_creator<vboy_rom_device>; +const device_type VBOY_ROM_EEPROM = &device_creator<vboy_eeprom_device>; + + +vboy_rom_device::vboy_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_vboy_cart_interface( mconfig, *this ) +{ +} + +vboy_rom_device::vboy_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VBOY_ROM_STD, "Nintendo Virtual Boy Carts", tag, owner, clock, "vboy_rom", __FILE__), + device_vboy_cart_interface( mconfig, *this ) +{ +} + +vboy_eeprom_device::vboy_eeprom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : vboy_rom_device(mconfig, VBOY_ROM_EEPROM, "Nintendo Virtual Boy Carts + EEPROM", tag, owner, clock, "vboy_eeprom", __FILE__) +{ +} + + +/*------------------------------------------------- + mapper specific handlers + -------------------------------------------------*/ + +READ32_MEMBER(vboy_rom_device::read_cart) +{ + return m_rom[offset & m_rom_mask]; +} + + +READ32_MEMBER(vboy_eeprom_device::read_eeprom) +{ + return m_eeprom[offset]; +} + + +WRITE32_MEMBER(vboy_eeprom_device::write_eeprom) +{ + COMBINE_DATA(&m_eeprom[offset]); +} diff --git a/src/emu/bus/vboy/rom.h b/src/emu/bus/vboy/rom.h new file mode 100644 index 00000000000..cc13aa3ec84 --- /dev/null +++ b/src/emu/bus/vboy/rom.h @@ -0,0 +1,45 @@ +#ifndef __VBOY_ROM_H +#define __VBOY_ROM_H + +#include "slot.h" + + +// ======================> vboy_rom_device + +class vboy_rom_device : public device_t, + public device_vboy_cart_interface +{ +public: + // construction/destruction + vboy_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); + vboy_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start() {} + + // reading and writing + virtual DECLARE_READ32_MEMBER(read_cart); +}; + +// ======================> vboy_eeprom_device + +class vboy_eeprom_device : public vboy_rom_device +{ +public: + // construction/destruction + vboy_eeprom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // reading and writing + virtual DECLARE_READ32_MEMBER(read_eeprom); + virtual DECLARE_WRITE32_MEMBER(write_eeprom); +}; + + + +// device type definition +extern const device_type VBOY_ROM_STD; +extern const device_type VBOY_ROM_EEPROM; + + + +#endif diff --git a/src/emu/bus/vboy/slot.c b/src/emu/bus/vboy/slot.c new file mode 100644 index 00000000000..244f7a80b60 --- /dev/null +++ b/src/emu/bus/vboy/slot.c @@ -0,0 +1,267 @@ +/*********************************************************************************************************** + + Nintendo Virtual Boy cart emulation + (through slot devices) + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "slot.h" + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type VBOY_CART_SLOT = &device_creator<vboy_cart_slot_device>; + +//************************************************************************** +// vboy cartridges Interface +//************************************************************************** + +//------------------------------------------------- +// device_vboy_cart_interface - constructor +//------------------------------------------------- + +device_vboy_cart_interface::device_vboy_cart_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig, device), + m_rom(NULL), + m_rom_size(0), + m_rom_mask(0) +{ +} + + +//------------------------------------------------- +// ~device_vboy_cart_interface - destructor +//------------------------------------------------- + +device_vboy_cart_interface::~device_vboy_cart_interface() +{ +} + +//------------------------------------------------- +// rom_alloc - alloc the space for the cart +//------------------------------------------------- + +void device_vboy_cart_interface::rom_alloc(UINT32 size, const char *tag) +{ + if (m_rom == NULL) + { + astring tempstring(tag); + tempstring.cat(VBOYSLOT_ROM_REGION_TAG); + m_rom = (UINT32 *)device().machine().memory().region_alloc(tempstring, size, 4, ENDIANNESS_LITTLE)->base(); + m_rom_size = size/4; + m_rom_mask = m_rom_size - 1; + } +} + + +//------------------------------------------------- +// ram_alloc - alloc the space for the ram +//------------------------------------------------- + +void device_vboy_cart_interface::eeprom_alloc(UINT32 size) +{ + m_eeprom.resize(size/sizeof(UINT32)); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// vboy_cart_slot_device - constructor +//------------------------------------------------- +vboy_cart_slot_device::vboy_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, VBOY_CART_SLOT, "Nintendo Virtual Boy Cartridge Slot", tag, owner, clock, "vboy_cart_slot", __FILE__), + device_image_interface(mconfig, *this), + device_slot_interface(mconfig, *this), + m_type(VBOY_STD) +{ +} + + +//------------------------------------------------- +// vboy_cart_slot_device - destructor +//------------------------------------------------- + +vboy_cart_slot_device::~vboy_cart_slot_device() +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vboy_cart_slot_device::device_start() +{ + m_cart = dynamic_cast<device_vboy_cart_interface *>(get_card_device()); +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void vboy_cart_slot_device::device_config_complete() +{ + // set brief and instance name + update_names(); +} + + +//------------------------------------------------- +// vboy PCB +//------------------------------------------------- + +struct vboy_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 vboy_slot slot_list[] = +{ + { VBOY_STD, "vb_rom" }, + { VBOY_EEPROM, "vb_eeprom" } +}; + +static int vboy_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; +} + +#if 0 +static const char *vboy_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 "vb_rom"; +} +#endif + +/*------------------------------------------------- + call load + -------------------------------------------------*/ + +bool vboy_cart_slot_device::call_load() +{ + if (m_cart) + { + UINT8 *ROM; + UINT32 len = (software_entry() == NULL) ? length() : get_software_region_length("rom"); + bool has_eeprom = (software_entry() != NULL) && get_software_region("eeprom"); + + if (len > 0x200000) + { + seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + m_cart->rom_alloc(len, tag()); + if (has_eeprom) + m_cart->eeprom_alloc(get_software_region_length("eeprom")); + + ROM = (UINT8 *)m_cart->get_rom_base(); + + if (software_entry() == NULL) + fread(ROM, len); + else + memcpy(ROM, get_software_region("rom"), len); + + if (software_entry() == NULL) + m_type = vboy_get_pcb_id("vb_rom"); + else + { + const char *pcb_name = get_feature("slot"); + if (pcb_name) + m_type = vboy_get_pcb_id(pcb_name); + } + + //printf("Type: %s\n", vboy_get_slot(m_type)); + + return IMAGE_INIT_PASS; + } + + return IMAGE_INIT_PASS; +} + + +/*------------------------------------------------- + call_unload + -------------------------------------------------*/ + +void vboy_cart_slot_device::call_unload() +{ + if (m_cart && m_cart->get_eeprom_size()) + battery_save(m_cart->get_eeprom_base(), m_cart->get_eeprom_size() * 4); +} + +/*------------------------------------------------- + call softlist load + -------------------------------------------------*/ + +bool vboy_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 vboy_cart_slot_device::get_default_card_software(astring &result) +{ + software_get_default_slot(result, "vb_rom"); +} + +/*------------------------------------------------- + read + -------------------------------------------------*/ + +READ32_MEMBER(vboy_cart_slot_device::read_cart) +{ + if (m_cart) + return m_cart->read_cart(space, offset, mem_mask); + else + return 0xffffffff; +} + +/*------------------------------------------------- + read + -------------------------------------------------*/ + +READ32_MEMBER(vboy_cart_slot_device::read_eeprom) +{ + if (m_cart) + return m_cart->read_eeprom(space, offset, mem_mask); + else + return 0xffffffff; +} + +/*------------------------------------------------- + write + -------------------------------------------------*/ + +WRITE32_MEMBER(vboy_cart_slot_device::write_eeprom) +{ + if (m_cart) + m_cart->write_eeprom(space, offset, data, mem_mask); +} diff --git a/src/emu/bus/vboy/slot.h b/src/emu/bus/vboy/slot.h new file mode 100644 index 00000000000..0d5c3edb403 --- /dev/null +++ b/src/emu/bus/vboy/slot.h @@ -0,0 +1,114 @@ +#ifndef __VBOY_SLOT_H +#define __VBOY_SLOT_H + +/*************************************************************************** + TYPE DEFINITIONS + ***************************************************************************/ + + +/* PCB */ +enum +{ + VBOY_STD = 0, + VBOY_EEPROM +}; + + +// ======================> device_vboy_cart_interface + +class device_vboy_cart_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_vboy_cart_interface(const machine_config &mconfig, device_t &device); + virtual ~device_vboy_cart_interface(); + + // reading and writing + virtual DECLARE_READ32_MEMBER(read_cart) { return 0xffffffff; } + virtual DECLARE_READ32_MEMBER(read_eeprom) { return 0xffffffff; } + virtual DECLARE_WRITE32_MEMBER(write_eeprom) {} + + void rom_alloc(UINT32 size, const char *tag); + void eeprom_alloc(UINT32 size); + UINT32* get_rom_base() { return m_rom; } + UINT32* get_eeprom_base() { return m_eeprom; } + UINT32 get_rom_size() { return m_rom_size; } + UINT32 get_eeprom_size() { return m_eeprom.count(); } + + void save_eeprom() { device().save_item(NAME(m_eeprom)); } + +protected: + // internal state + UINT32 *m_rom; + UINT32 m_rom_size; + UINT32 m_rom_mask; + dynamic_array<UINT32> m_eeprom; +}; + + +// ======================> vboy_cart_slot_device + +class vboy_cart_slot_device : public device_t, + public device_image_interface, + public device_slot_interface +{ +public: + // construction/destruction + vboy_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~vboy_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; } + int get_cart_type(UINT8 *ROM, UINT32 len); + + void save_eeprom() { if (m_cart && m_cart->get_eeprom_size()) m_cart->save_eeprom(); } + + 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 1; } + 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 "vboy_cart"; } + virtual const char *file_extensions() const { return "vb,bin"; } + + // slot interface overrides + virtual void get_default_card_software(astring &result); + + // reading and writing + virtual DECLARE_READ32_MEMBER(read_cart); + virtual DECLARE_READ32_MEMBER(read_eeprom); + virtual DECLARE_WRITE32_MEMBER(write_eeprom); + +protected: + + int m_type; + device_vboy_cart_interface* m_cart; +}; + + + +// device type definition +extern const device_type VBOY_CART_SLOT; + + +/*************************************************************************** + DEVICE CONFIGURATION MACROS + ***************************************************************************/ + +#define VBOYSLOT_ROM_REGION_TAG ":cart:rom" + +#define MCFG_VBOY_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ + MCFG_DEVICE_ADD(_tag, VBOY_CART_SLOT, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ + +#endif diff --git a/src/mess/drivers/scv.c b/src/mess/drivers/scv.c index fe642456746..9ee007a2550 100644 --- a/src/mess/drivers/scv.c +++ b/src/mess/drivers/scv.c @@ -2,13 +2,13 @@ Driver for Epoch Super Cassette Vision - ***************************************************************************/ #include "emu.h" #include "cpu/upd7810/upd7810.h" -#include "imagedev/cartslot.h" #include "audio/upd1771.h" +#include "bus/scv/slot.h" +#include "bus/scv/rom.h" class scv_state : public driver_device @@ -17,41 +17,26 @@ public: scv_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_videoram(*this,"videoram"), - m_cart_rom_size(0), - m_cart_ram(NULL), - m_cart_ram_size(0), m_maincpu(*this, "maincpu"), m_upd1771c(*this, "upd1771c"), + m_cart(*this, "cartslot"), + m_pa(*this, "PA"), m_pc0(*this, "PC0"), - m_bank0(*this, "bank0"), - m_bank1(*this, "bank1"), - m_bank2(*this, "bank2"), - m_bank3(*this, "bank3"), - m_bank4(*this, "bank4"), m_charrom(*this, "charrom") { } - DECLARE_WRITE8_MEMBER(scv_porta_w); - DECLARE_READ8_MEMBER(scv_portb_r); - DECLARE_READ8_MEMBER(scv_portc_r); - DECLARE_WRITE8_MEMBER(scv_portc_w); - DECLARE_WRITE8_MEMBER(scv_cart_ram_w); - DECLARE_WRITE8_MEMBER(scv_cart_ram2_w); - DECLARE_WRITE_LINE_MEMBER(scv_upd1771_ack_w); + DECLARE_WRITE8_MEMBER(porta_w); + DECLARE_READ8_MEMBER(portb_r); + DECLARE_READ8_MEMBER(portc_r); + DECLARE_WRITE8_MEMBER(portc_w); + DECLARE_WRITE_LINE_MEMBER(upd1771_ack_w); required_shared_ptr<UINT8> m_videoram; UINT8 m_porta; UINT8 m_portc; emu_timer *m_vb_timer; - UINT8 *m_cart_rom; - UINT32 m_cart_rom_size; - UINT8 *m_cart_ram; - UINT32 m_cart_ram_size; - bool m_cart_ram_enabled; virtual void machine_start(); virtual void machine_reset(); DECLARE_PALETTE_INIT(scv); - void scv_postload(); UINT32 screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER( scv_cart ); protected: enum @@ -61,12 +46,9 @@ protected: required_device<cpu_device> m_maincpu; required_device<upd1771c_device> m_upd1771c; + required_device<scv_cart_slot_device> m_cart; + required_ioport_array<8> m_pa; required_ioport m_pc0; - required_memory_bank m_bank0; - required_memory_bank m_bank1; - required_memory_bank m_bank2; - required_memory_bank m_bank3; - required_memory_bank m_bank4; required_memory_region m_charrom; ioport_port *m_key[8]; @@ -82,30 +64,25 @@ protected: static ADDRESS_MAP_START( scv_mem, AS_PROGRAM, 8, scv_state ) - AM_RANGE( 0x0000, 0x0fff ) AM_ROM /* BIOS */ - - AM_RANGE( 0x2000, 0x3403 ) AM_RAM AM_SHARE("videoram") /* VRAM + 4 registers */ + AM_RANGE( 0x0000, 0x0fff ) AM_ROM // BIOS + AM_RANGE( 0x2000, 0x3403 ) AM_RAM AM_SHARE("videoram") // VRAM + 4 registers AM_RANGE( 0x3600, 0x3600 ) AM_DEVWRITE("upd1771c", upd1771c_device, write) - AM_RANGE( 0x8000, 0x9fff ) AM_ROMBANK("bank0") - AM_RANGE( 0xa000, 0xbfff ) AM_ROMBANK("bank1") - AM_RANGE( 0xc000, 0xdfff ) AM_ROMBANK("bank2") - AM_RANGE( 0xe000, 0xefff ) AM_READ_BANK("bank3") AM_WRITE( scv_cart_ram_w ) - AM_RANGE( 0xf000, 0xff7f ) AM_READ_BANK("bank4") AM_WRITE( scv_cart_ram2_w ) - AM_RANGE( 0xff80, 0xffff ) AM_RAM /* upd7801 internal RAM */ + AM_RANGE( 0x8000, 0xff7f ) AM_DEVREADWRITE("cartslot", scv_cart_slot_device, read_cart, write_cart) // cartridge + AM_RANGE( 0xff80, 0xffff ) AM_RAM // upd7801 internal RAM ADDRESS_MAP_END static ADDRESS_MAP_START( scv_io, AS_IO, 8, scv_state ) - AM_RANGE( 0x00, 0x00 ) AM_WRITE( scv_porta_w ) - AM_RANGE( 0x01, 0x01 ) AM_READ( scv_portb_r ) - AM_RANGE( 0x02, 0x02 ) AM_READWRITE( scv_portc_r, scv_portc_w ) + AM_RANGE( 0x00, 0x00 ) AM_WRITE(porta_w) + AM_RANGE( 0x01, 0x01 ) AM_READ(portb_r) + AM_RANGE( 0x02, 0x02 ) AM_READWRITE(portc_r, portc_w) ADDRESS_MAP_END static INPUT_PORTS_START( scv ) - PORT_START( "PA0" ) + PORT_START( "PA.0" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) @@ -115,7 +92,7 @@ static INPUT_PORTS_START( scv ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START( "PA1" ) + PORT_START( "PA.1" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) @@ -125,7 +102,7 @@ static INPUT_PORTS_START( scv ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START( "PA2" ) + PORT_START( "PA.2" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -135,7 +112,7 @@ static INPUT_PORTS_START( scv ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) - PORT_START( "PA3" ) + PORT_START( "PA.3" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -145,7 +122,7 @@ static INPUT_PORTS_START( scv ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD) - PORT_START( "PA4" ) + PORT_START( "PA.4" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -155,7 +132,7 @@ static INPUT_PORTS_START( scv ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD) - PORT_START( "PA5" ) + PORT_START( "PA.5" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -165,7 +142,7 @@ static INPUT_PORTS_START( scv ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD) - PORT_START( "PA6" ) + PORT_START( "PA.6" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -175,7 +152,7 @@ static INPUT_PORTS_START( scv ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD) - PORT_START( "PA7" ) + PORT_START( "PA.7" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -190,52 +167,27 @@ static INPUT_PORTS_START( scv ) INPUT_PORTS_END -WRITE8_MEMBER( scv_state::scv_cart_ram_w ) -{ - /* Check if cartridge ram is enabled */ - if ( m_cart_ram_enabled ) - { - m_cart_ram[offset] = data; - } -} - - -WRITE8_MEMBER( scv_state::scv_cart_ram2_w ) -{ - /* Check if cartridge ram is enabled */ - if ( m_cart_ram_enabled ) - { - if ( m_cart_ram_size > 0x1000 ) - { - offset += 0x1000; - } - - m_cart_ram[offset] = data; - } -} - - -WRITE8_MEMBER( scv_state::scv_porta_w ) +WRITE8_MEMBER( scv_state::porta_w ) { m_porta = data; } -READ8_MEMBER( scv_state::scv_portb_r ) +READ8_MEMBER( scv_state::portb_r ) { UINT8 data = 0xff; for (int i = 0; i < 8; i++) { if (!BIT(m_porta, i)) - data &= m_key[i]->read(); + data &= m_pa[i]->read(); } return data; } -READ8_MEMBER( scv_state::scv_portc_r ) +READ8_MEMBER( scv_state::portc_r ) { UINT8 data = m_portc; @@ -245,123 +197,15 @@ READ8_MEMBER( scv_state::scv_portc_r ) } -void scv_state::scv_set_banks() -{ - m_cart_ram_enabled = false; - - switch( m_cart_rom_size ) - { - case 0: - case 0x2000: - m_bank0->set_base( m_cart_rom ); - m_bank1->set_base( m_cart_rom ); - m_bank2->set_base( m_cart_rom ); - m_bank3->set_base( m_cart_rom ); - m_bank4->set_base( m_cart_rom + 0x1000 ); - break; - case 0x4000: - m_bank0->set_base( m_cart_rom ); - m_bank1->set_base( m_cart_rom + 0x2000 ); - m_bank2->set_base( m_cart_rom ); - m_bank3->set_base( m_cart_rom + 0x2000 ); - m_bank4->set_base( m_cart_rom + 0x3000 ); - break; - case 0x8000: - m_bank0->set_base( m_cart_rom ); - m_bank1->set_base( m_cart_rom + 0x2000 ); - m_bank2->set_base( m_cart_rom + 0x4000 ); - m_bank3->set_base( m_cart_rom + 0x6000 ); - m_bank4->set_base( m_cart_rom + 0x7000 ); - break; - case 0x10000: - m_bank0->set_base( m_cart_rom + ( ( m_portc & 0x20 ) ? 0x8000 : 0 ) ); - m_bank1->set_base( m_cart_rom + ( ( m_portc & 0x20 ) ? 0xa000 : 0x2000 ) ); - m_bank2->set_base( m_cart_rom + ( ( m_portc & 0x20 ) ? 0xc000 : 0x4000 ) ); - m_bank3->set_base( m_cart_rom + ( ( m_portc & 0x20 ) ? 0xe000 : 0x6000 ) ); - m_bank4->set_base( m_cart_rom + ( ( m_portc & 0x20 ) ? 0xf000 : 0x7000 ) ); - break; - case 0x20000: /* Pole Position 2 */ - int base = ( ( m_portc >> 5 ) & 0x03 ) * 0x8000 ; - m_bank0->set_base( m_cart_rom + base + 0 ); - m_bank1->set_base( m_cart_rom + base + 0x2000 ); - m_bank2->set_base( m_cart_rom + base + 0x4000 ); - m_bank3->set_base( m_cart_rom + base + 0x6000 ); - m_bank4->set_base( m_cart_rom + base + 0x7000 ); - /* On-cart RAM is enabled when PC6 is high */ - if ( m_cart_ram && m_portc & 0x40 ) - { - m_cart_ram_enabled = true; - m_bank4->set_base( m_cart_ram ); - } - break; - } - - /* Check if cartridge RAM is available and should be enabled */ - if ( m_cart_rom_size < 0x20000 && m_cart_ram && m_cart_ram_size && ( m_portc & 0x20 ) ) - { - if ( m_cart_ram_size == 0x1000 ) - { - m_bank4->set_base( m_cart_ram ); - } - else - { - m_bank3->set_base( m_cart_ram ); - m_bank4->set_base( m_cart_ram + 0x1000 ); - } - m_cart_ram_enabled = true; - } - -} - - -WRITE8_MEMBER( scv_state::scv_portc_w ) +WRITE8_MEMBER( scv_state::portc_w ) { //logerror("%04x: scv_portc_w: data = 0x%02x\n", m_maincpu->pc(), data ); m_portc = data; - - scv_set_banks(); + m_cart->write_bank(space, 0, m_portc); m_upd1771c->pcm_write(m_portc & 0x08); } -DEVICE_IMAGE_LOAD_MEMBER( scv_state, scv_cart ) -{ - UINT8 *cart = memregion( "cart" )->base(); - - if ( image.software_entry() == NULL ) - { - int size = image.length(); - - if ( size > memregion( "cart" )->bytes() ) - { - image.seterror( IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size" ); - return IMAGE_INIT_FAIL; - } - - if ( image.fread( cart, size ) != size ) - { - image.seterror( IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file" ); - return IMAGE_INIT_FAIL; - } - - m_cart_rom_size = size; - } - else - { - m_cart_rom_size = image.get_software_region_length( "rom" ); - memcpy( cart, image.get_software_region( "rom" ), m_cart_rom_size ); - m_cart_ram_size = image.get_software_region_length( "ram" ); - if ( m_cart_ram_size > 0 ) - { - m_cart_ram = auto_alloc_array_clear( machine(), UINT8, m_cart_ram_size ); - save_pointer(NAME(m_cart_ram), m_cart_ram_size); - } - } - - return IMAGE_INIT_PASS; -} - - PALETTE_INIT_MEMBER(scv_state, scv) { /* @@ -758,41 +602,26 @@ UINT32 scv_state::screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, } -WRITE_LINE_MEMBER( scv_state::scv_upd1771_ack_w ) +WRITE_LINE_MEMBER( scv_state::upd1771_ack_w ) { m_maincpu->set_input_line(UPD7810_INTF1, (state) ? ASSERT_LINE : CLEAR_LINE); } -void scv_state::scv_postload() -{ - scv_set_banks(); -} - - void scv_state::machine_start() { - m_cart_rom = memregion( "cart" )->base(); m_vb_timer = timer_alloc(TIMER_VB); - for (int i = 0; i < 8; i++) - { - char str[4]; - sprintf(str, "PA%i", i); - m_key[i] = ioport(str); - } - save_item(NAME(m_porta)); save_item(NAME(m_portc)); - save_item(NAME(m_cart_ram_enabled)); + if (m_cart->exists()) + m_cart->save_ram(); - machine().save().register_postload(save_prepost_delegate(FUNC(scv_state::scv_postload), this)); } void scv_state::machine_reset() { m_vb_timer->adjust(machine().first_screen()->time_until_pos(0, 0)); - scv_set_banks(); } @@ -815,13 +644,22 @@ static GFXDECODE_START( scv ) GFXDECODE_END +static SLOT_INTERFACE_START(scv_cart) + SLOT_INTERFACE_INTERNAL("rom8k", SCV_ROM8K) + SLOT_INTERFACE_INTERNAL("rom16k", SCV_ROM16K) + SLOT_INTERFACE_INTERNAL("rom32k", SCV_ROM32K) + SLOT_INTERFACE_INTERNAL("rom32k_ram", SCV_ROM32K_RAM8K) + SLOT_INTERFACE_INTERNAL("rom64k", SCV_ROM64K) + SLOT_INTERFACE_INTERNAL("rom128k", SCV_ROM128K) + SLOT_INTERFACE_INTERNAL("rom128k_ram", SCV_ROM128K_RAM4K) +SLOT_INTERFACE_END + static MACHINE_CONFIG_START( scv, scv_state ) MCFG_CPU_ADD( "maincpu", UPD7801, XTAL_4MHz ) MCFG_CPU_PROGRAM_MAP( scv_mem ) MCFG_CPU_IO_MAP( scv_io ) - /* Video chip is EPOCH TV-1 */ MCFG_SCREEN_ADD( "screen", RASTER ) MCFG_SCREEN_RAW_PARAMS( XTAL_14_31818MHz/2, 456, 24, 24+192, 262, 23, 23+222 ) /* TODO: Verify */ @@ -835,14 +673,10 @@ static MACHINE_CONFIG_START( scv, scv_state ) /* Sound is generated by UPD1771C clocked at XTAL_6MHz */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD( "upd1771c", UPD1771C, XTAL_6MHz ) - MCFG_UPD1771_ACK_HANDLER(WRITELINE(scv_state, scv_upd1771_ack_w)) + MCFG_UPD1771_ACK_HANDLER(WRITELINE(scv_state, upd1771_ack_w)) MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - MCFG_CARTSLOT_ADD( "cart" ) - MCFG_CARTSLOT_EXTENSION_LIST( "bin" ) - MCFG_CARTSLOT_NOT_MANDATORY - MCFG_CARTSLOT_INTERFACE("scv_cart") - MCFG_CARTSLOT_LOAD( scv_state, scv_cart ) + MCFG_SCV_CARTRIDGE_ADD("cartslot", scv_cart, NULL) /* Software lists */ MCFG_SOFTWARE_LIST_ADD("cart_list","scv") @@ -850,7 +684,6 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( scv_pal, scv ) - MCFG_CPU_MODIFY( "maincpu" ) MCFG_CPU_CLOCK( 3780000 ) @@ -864,20 +697,18 @@ MACHINE_CONFIG_END ROM_START( scv ) ROM_REGION( 0x1000, "maincpu", 0 ) ROM_LOAD( "upd7801g.s01", 0, 0x1000, CRC(7ac06182) SHA1(6e89d1227581c76441a53d605f9e324185f1da33) ) + ROM_REGION( 0x400, "charrom", 0 ) ROM_LOAD( "epochtv.chr", 0, 0x400, BAD_DUMP CRC(db521533) SHA1(40b4e44838c35191f115437a14f200f052e71509) ) - - ROM_REGION( 0x20000, "cart", ROMREGION_ERASEFF ) ROM_END ROM_START( scv_pal ) ROM_REGION( 0x1000, "maincpu", 0 ) ROM_LOAD( "upd7801g.s01", 0, 0x1000, CRC(7ac06182) SHA1(6e89d1227581c76441a53d605f9e324185f1da33) ) + ROM_REGION( 0x400, "charrom", 0 ) ROM_LOAD( "epochtv.chr", 0, 0x400, BAD_DUMP CRC(db521533) SHA1(40b4e44838c35191f115437a14f200f052e71509) ) - - ROM_REGION( 0x20000, "cart", ROMREGION_ERASEFF ) ROM_END diff --git a/src/mess/drivers/vboy.c b/src/mess/drivers/vboy.c index 19b236fe3f2..de8c6d11003 100644 --- a/src/mess/drivers/vboy.c +++ b/src/mess/drivers/vboy.c @@ -28,8 +28,9 @@ #include "emu.h" #include "cpu/v810/v810.h" -#include "imagedev/cartslot.h" #include "audio/vboy.h" +#include "bus/vboy/slot.h" +#include "bus/vboy/rom.h" #include "vboy.lh" #define READ_BGMAP(bgoffs) m_bgmap[(bgoffs) & 0xffff] @@ -104,9 +105,10 @@ class vboy_state : public driver_device public: vboy_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maintimer(*this, "timer_main"), m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") + m_cart(*this, "cartslot"), + m_maintimer(*this, "timer_main"), + m_palette(*this, "palette") { m_vip_regs.INTPND = 0; m_vip_regs.INTENB = 0; @@ -151,32 +153,33 @@ public: m_vboy_timer.latch = 0; } - required_device<timer_device> m_maintimer; required_device<cpu_device> m_maincpu; + required_device<vboy_cart_slot_device> m_cart; + required_device<timer_device> m_maintimer; required_device<palette_device> m_palette; DECLARE_READ32_MEMBER(io_r); DECLARE_WRITE32_MEMBER(io_w); DECLARE_READ16_MEMBER(vip_r); DECLARE_WRITE16_MEMBER(vip_w); - DECLARE_WRITE16_MEMBER(vboy_font0_w); - DECLARE_WRITE16_MEMBER(vboy_font1_w); - DECLARE_WRITE16_MEMBER(vboy_font2_w); - DECLARE_WRITE16_MEMBER(vboy_font3_w); - DECLARE_READ16_MEMBER(vboy_font0_r); - DECLARE_READ16_MEMBER(vboy_font1_r); - DECLARE_READ16_MEMBER(vboy_font2_r); - DECLARE_READ16_MEMBER(vboy_font3_r); + DECLARE_WRITE16_MEMBER(font0_w); + DECLARE_WRITE16_MEMBER(font1_w); + DECLARE_WRITE16_MEMBER(font2_w); + DECLARE_WRITE16_MEMBER(font3_w); + DECLARE_READ16_MEMBER(font0_r); + DECLARE_READ16_MEMBER(font1_r); + DECLARE_READ16_MEMBER(font2_r); + DECLARE_READ16_MEMBER(font3_r); DECLARE_WRITE16_MEMBER(vboy_bgmap_w); DECLARE_READ16_MEMBER(vboy_bgmap_r); - DECLARE_READ8_MEMBER(vboy_lfb0_r); - DECLARE_READ8_MEMBER(vboy_lfb1_r); - DECLARE_READ8_MEMBER(vboy_rfb0_r); - DECLARE_READ8_MEMBER(vboy_rfb1_r); - DECLARE_WRITE8_MEMBER(vboy_lfb0_w); - DECLARE_WRITE8_MEMBER(vboy_lfb1_w); - DECLARE_WRITE8_MEMBER(vboy_rfb0_w); - DECLARE_WRITE8_MEMBER(vboy_rfb1_w); + DECLARE_READ8_MEMBER(lfb0_r); + DECLARE_READ8_MEMBER(lfb1_r); + DECLARE_READ8_MEMBER(rfb0_r); + DECLARE_READ8_MEMBER(rfb1_r); + DECLARE_WRITE8_MEMBER(lfb0_w); + DECLARE_WRITE8_MEMBER(lfb1_w); + DECLARE_WRITE8_MEMBER(rfb0_w); + DECLARE_WRITE8_MEMBER(rfb1_w); UINT16 *m_font; UINT16 *m_bgmap; UINT8 *m_l_frame_0; @@ -195,11 +198,6 @@ public: void m_timer_tick(void); void m_scanline_tick(int scanline, UINT8 screen_type); void m_set_irq(UINT16 irq_vector); - UINT8 *m_nvptr; - UINT32 m_vboy_sram[0x10000/4]; - device_t *m_nvimage; - DECLARE_READ32_MEMBER(sram_r); - DECLARE_WRITE32_MEMBER(sram_w); void put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, UINT16 code, UINT8 pal); void fill_ovr_char(UINT16 code, UINT8 pal); @@ -220,15 +218,11 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(timer_pad_tick); TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineL); TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineR); - void vboy_machine_stop(); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vboy_cart); }; void vboy_state::video_start() { - //int i; - // Allocate memory for temporary screens m_ovr_tempdraw_map = auto_alloc_array_clear(machine(), INT32, 0x40); @@ -1031,42 +1025,42 @@ WRITE16_MEMBER( vboy_state::vip_w ) -WRITE16_MEMBER( vboy_state::vboy_font0_w ) +WRITE16_MEMBER( vboy_state::font0_w ) { WRITE_FONT(offset); } -WRITE16_MEMBER( vboy_state::vboy_font1_w ) +WRITE16_MEMBER( vboy_state::font1_w ) { WRITE_FONT(offset+0x1000); } -WRITE16_MEMBER( vboy_state::vboy_font2_w ) +WRITE16_MEMBER( vboy_state::font2_w ) { WRITE_FONT(offset+0x2000); } -WRITE16_MEMBER( vboy_state::vboy_font3_w ) +WRITE16_MEMBER( vboy_state::font3_w ) { WRITE_FONT(offset+0x3000); } -READ16_MEMBER( vboy_state::vboy_font0_r ) +READ16_MEMBER( vboy_state::font0_r ) { return READ_FONT(offset); } -READ16_MEMBER( vboy_state::vboy_font1_r ) +READ16_MEMBER( vboy_state::font1_r ) { return READ_FONT(offset + 0x1000); } -READ16_MEMBER( vboy_state::vboy_font2_r ) +READ16_MEMBER( vboy_state::font2_r ) { return READ_FONT(offset + 0x2000); } -READ16_MEMBER( vboy_state::vboy_font3_r ) +READ16_MEMBER( vboy_state::font3_r ) { return READ_FONT(offset + 0x3000); } @@ -1081,72 +1075,72 @@ READ16_MEMBER( vboy_state::vboy_bgmap_r ) return m_bgmap[offset]; } -READ8_MEMBER( vboy_state::vboy_lfb0_r ) { return m_l_frame_0[offset]; } -READ8_MEMBER( vboy_state::vboy_lfb1_r ) { return m_l_frame_1[offset]; } -READ8_MEMBER( vboy_state::vboy_rfb0_r ) { return m_r_frame_0[offset]; } -READ8_MEMBER( vboy_state::vboy_rfb1_r ) { return m_r_frame_1[offset]; } -WRITE8_MEMBER( vboy_state::vboy_lfb0_w ) { m_l_frame_0[offset] = data; } -WRITE8_MEMBER( vboy_state::vboy_lfb1_w ) { m_l_frame_1[offset] = data; } -WRITE8_MEMBER( vboy_state::vboy_rfb0_w ) { m_r_frame_0[offset] = data; } -WRITE8_MEMBER( vboy_state::vboy_rfb1_w ) { m_r_frame_1[offset] = data; } +READ8_MEMBER( vboy_state::lfb0_r ) { return m_l_frame_0[offset]; } +READ8_MEMBER( vboy_state::lfb1_r ) { return m_l_frame_1[offset]; } +READ8_MEMBER( vboy_state::rfb0_r ) { return m_r_frame_0[offset]; } +READ8_MEMBER( vboy_state::rfb1_r ) { return m_r_frame_1[offset]; } +WRITE8_MEMBER( vboy_state::lfb0_w ) { m_l_frame_0[offset] = data; } +WRITE8_MEMBER( vboy_state::lfb1_w ) { m_l_frame_1[offset] = data; } +WRITE8_MEMBER( vboy_state::rfb0_w ) { m_r_frame_0[offset] = data; } +WRITE8_MEMBER( vboy_state::rfb1_w ) { m_r_frame_1[offset] = data; } static ADDRESS_MAP_START( vboy_mem, AS_PROGRAM, 32, vboy_state ) ADDRESS_MAP_GLOBAL_MASK(0x07ffffff) - AM_RANGE( 0x00000000, 0x00005fff ) AM_READWRITE8(vboy_lfb0_r,vboy_lfb0_w,0xffffffff) // L frame buffer 0 - AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511 - AM_RANGE( 0x00008000, 0x0000dfff ) AM_READWRITE8(vboy_lfb1_r,vboy_lfb1_w,0xffffffff) // L frame buffer 1 - AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023 - AM_RANGE( 0x00010000, 0x00015fff ) AM_READWRITE8(vboy_rfb0_r,vboy_rfb0_w,0xffffffff) // R frame buffer 0 - AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 - AM_RANGE( 0x00018000, 0x0001dfff ) AM_READWRITE8(vboy_rfb1_r,vboy_rfb1_w,0xffffffff) // R frame buffer 1 - AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 + AM_RANGE( 0x00000000, 0x00005fff ) AM_READWRITE8(lfb0_r, lfb0_w,0xffffffff) // L frame buffer 0 + AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 + AM_RANGE( 0x00008000, 0x0000dfff ) AM_READWRITE8(lfb1_r, lfb1_w,0xffffffff) // L frame buffer 1 + AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 + AM_RANGE( 0x00010000, 0x00015fff ) AM_READWRITE8(rfb0_r, rfb0_w,0xffffffff) // R frame buffer 0 + AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 + AM_RANGE( 0x00018000, 0x0001dfff ) AM_READWRITE8(rfb1_r, rfb1_w,0xffffffff) // R frame buffer 1 + AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 AM_RANGE( 0x00020000, 0x0003ffff ) AM_READWRITE16(vboy_bgmap_r,vboy_bgmap_w, 0xffffffff) // VIPC memory //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC AM_RANGE( 0x0005f800, 0x0005f87f ) AM_READWRITE16(vip_r, vip_w, 0xffffffff) - AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511 mirror - AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023 mirror - AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 mirror - AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 mirror + AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 mirror + AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 mirror + AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 mirror + AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 mirror AM_RANGE( 0x01000000, 0x010005ff ) AM_DEVREADWRITE8("vbsnd", vboysnd_device, read, write, 0xffffffff) AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(io_r, io_w) // Hardware control registers mask 0xff //AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM AM_SHARE("wram")// Main RAM - 64K mask 0xffff -// AM_RANGE( 0x06000000, 0x06003fff ) AM_RAM AM_SHARE("nvram") // Cart RAM - 8K NVRAM - AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_ROM AM_REGION("cartridge", 0) /* ROM */ + AM_RANGE( 0x06000000, 0x06003fff ) AM_DEVREADWRITE("cartslot", vboy_cart_slot_device, read_eeprom, write_eeprom) // Cart RAM - 8K NVRAM + AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */ ADDRESS_MAP_END static ADDRESS_MAP_START( vboy_io, AS_IO, 32, vboy_state ) ADDRESS_MAP_GLOBAL_MASK(0x07ffffff) AM_RANGE( 0x00000000, 0x00005fff ) AM_RAM AM_SHARE("l_frame_0") // L frame buffer 0 - AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511 + AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 AM_RANGE( 0x00008000, 0x0000dfff ) AM_RAM AM_SHARE("l_frame_1") // L frame buffer 1 - AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023 + AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 AM_RANGE( 0x00010000, 0x00015fff ) AM_RAM AM_SHARE("r_frame_0") // R frame buffer 0 - AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 + AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 AM_RANGE( 0x00018000, 0x0001dfff ) AM_RAM AM_SHARE("r_frame_1") // R frame buffer 1 - AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 + AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 AM_RANGE( 0x00020000, 0x0003ffff ) AM_READWRITE16(vboy_bgmap_r,vboy_bgmap_w, 0xffffffff) // VIPC memory //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC AM_RANGE( 0x0005f800, 0x0005f87f ) AM_READWRITE16(vip_r, vip_w, 0xffffffff) - AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511 mirror - AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023 mirror - AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 mirror - AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 mirror + AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 mirror + AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 mirror + AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 mirror + AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 mirror AM_RANGE( 0x01000000, 0x010005ff ) AM_DEVREADWRITE8("vbsnd", vboysnd_device, read, write, 0xffffffff) AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(io_r, io_w) // Hardware control registers mask 0xff // AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM AM_SHARE("wram") // Main RAM - 64K mask 0xffff - AM_RANGE( 0x06000000, 0x06003fff ) AM_RAM AM_SHARE("nvram") // Cart RAM - 8K NVRAM - AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_ROM AM_REGION("cartridge", 0) /* ROM */ + AM_RANGE( 0x06000000, 0x06003fff ) AM_NOP // Cart RAM - 8K NVRAM ? + AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */ ADDRESS_MAP_END /* Input ports */ @@ -1170,22 +1164,11 @@ static INPUT_PORTS_START( vboy ) PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // Battery low INPUT_PORTS_END -void vboy_state::vboy_machine_stop() -{ - // only do this if the cart loader detected some form of backup - if (m_nvptr != NULL) - { - device_image_interface *image = dynamic_cast<device_image_interface *>(m_nvimage); - image->battery_save(m_nvptr, 0x10000); - } -} void vboy_state::machine_start() { - /* add a hook for battery save */ - machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(vboy_state::vboy_machine_stop),this)); - -// m_vboy_sram = auto_alloc_array(machine(), UINT32, 0x10000/4); + if (m_cart->exists()) + m_cart->save_eeprom(); } void vboy_state::machine_reset() @@ -1339,80 +1322,10 @@ TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::vboy_scanlineR) #endif - -READ32_MEMBER(vboy_state::sram_r) -{ - return m_vboy_sram[offset]; -} - -WRITE32_MEMBER(vboy_state::sram_w) -{ - COMBINE_DATA(&m_vboy_sram[offset]); -} - - -DEVICE_IMAGE_LOAD_MEMBER( vboy_state, vboy_cart ) -{ - UINT32 chip = 0; - UINT8 *ROM = memregion("cartridge")->base(); - UINT32 cart_size; - - m_nvptr = (UINT8 *)NULL; - if (image.software_entry() == NULL) - { - cart_size = image.length(); - image.fread(ROM, cart_size); - switch (cart_size) - { - case 0x001000: - memcpy(ROM + 0x001000, ROM, 0x001000); - case 0x002000: - memcpy(ROM + 0x002000, ROM, 0x002000); - case 0x004000: - memcpy(ROM + 0x004000, ROM, 0x004000); - case 0x008000: - memcpy(ROM + 0x008000, ROM, 0x008000); - case 0x010000: - memcpy(ROM + 0x010000, ROM, 0x010000); - case 0x020000: - memcpy(ROM + 0x020000, ROM, 0x020000); - case 0x040000: - memcpy(ROM + 0x040000, ROM, 0x040000); - case 0x080000: - memcpy(ROM + 0x080000, ROM, 0x080000); - case 0x100000: - memcpy(ROM + 0x100000, ROM, 0x100000); - default: - break; - } - } - else - { - cart_size = image.get_software_region_length("rom"); - memcpy(ROM, image.get_software_region("rom"), cart_size); - - UINT8 *tmp_eeprom = image.get_software_region("eeprom"); - if (tmp_eeprom) - chip = 1; - } - - if (chip) - { - m_nvptr = (UINT8 *)&m_vboy_sram; - - m_maincpu->space(AS_PROGRAM).install_read_handler(0x06000000, 0x0600ffff, read32_delegate(FUNC(vboy_state::sram_r),this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x06000000, 0x0600ffff, write32_delegate(FUNC(vboy_state::sram_w),this)); - - image.battery_load(m_nvptr, 0x10000, 0x00); - m_nvimage = image; - } - else - { - m_nvimage = NULL; - } - - return IMAGE_INIT_PASS; -} +static SLOT_INTERFACE_START(vboy_cart) + SLOT_INTERFACE_INTERNAL("vb_rom", VBOY_ROM_STD) + SLOT_INTERFACE_INTERNAL("vb_eeprom", VBOY_ROM_EEPROM) +SLOT_INTERFACE_END static MACHINE_CONFIG_START( vboy, vboy_state ) @@ -1423,7 +1336,6 @@ static MACHINE_CONFIG_START( vboy, vboy_state ) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer_l", vboy_state, vboy_scanlineL, "3dleft", 0, 1) //MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer_r", vboy_state, vboy_scanlineR, "3dright", 0, 1) - // programmable timer MCFG_TIMER_DRIVER_ADD("timer_main", vboy_state, timer_main_tick) @@ -1448,11 +1360,7 @@ static MACHINE_CONFIG_START( vboy, vboy_state ) MCFG_SCREEN_PALETTE("palette") /* cartridge */ - MCFG_CARTSLOT_ADD("cart") - MCFG_CARTSLOT_EXTENSION_LIST("vb,bin") - MCFG_CARTSLOT_MANDATORY - MCFG_CARTSLOT_INTERFACE("vboy_cart") - MCFG_CARTSLOT_LOAD(vboy_state, vboy_cart) + MCFG_VBOY_CARTRIDGE_ADD("cartslot", vboy_cart, NULL) /* software lists */ MCFG_SOFTWARE_LIST_ADD("cart_list","vboy") @@ -1466,7 +1374,7 @@ MACHINE_CONFIG_END /* ROM definition */ ROM_START( vboy ) - ROM_REGION( 0x2000000, "cartridge", ROMREGION_ERASEFF ) + ROM_REGION( 0x2000000, "maincpu", ROMREGION_ERASEFF ) ROM_END /* Driver */ diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 20d9f782168..47b18329e99 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -612,12 +612,14 @@ BUSES += RS232 BUSES += S100 BUSES += SATURN BUSES += SCSI +BUSES += SCV BUSES += SEGA8 BUSES += SMS_CTRL BUSES += SMS_EXP BUSES += SNES BUSES += TI99PEB BUSES += TVC +BUSES += VBOY BUSES += VCS BUSES += VCS_CTRL BUSES += VIC10 |