Previous 199869 Revisions Next

r32470 Tuesday 30th September, 2014 at 06:05:07 UTC by Fabio Priuli
(MESS) converted scv and vboy to use slot devices for
their carts. nw.
[hash]scv.xml vboy.xml
[src/emu/bus]bus.mak
[src/emu/bus/scv]rom.c* rom.h* slot.c* slot.h*
[src/emu/bus/vboy]rom.c* rom.h* slot.c* slot.h*
[src/mess]mess.mak
[src/mess/drivers]scv.c vboy.c

trunk/hash/scv.xml
r32469r32470
6363      <year>1984</year>
6464      <publisher>Epoch</publisher>
6565      <part name="cart" interface="scv_cart">
66         <feature name="slot" value="rom8k" />
6667         <dataarea name="rom" size="8192">
6768            <rom name="astrwrs.bin" size="8192" crc="2dbdb166" sha1="53a9a308b6f0bcb2137704f70657698719551b5e" offset="0000" />
6869         </dataarea>
r32469r32470
7475      <year>1984</year>
7576      <publisher>Epoch</publisher>
7677      <part name="cart" interface="scv_cart">
78         <feature name="slot" value="rom8k" />
7779         <dataarea name="rom" size="8192">
7880            <rom name="astrwrs2.bin" size="8192" crc="34781de1" sha1="b419f2fccf3b2fbd360da2833064d2ea8bd6500b" offset="0000" />
7981         </dataarea>
r32469r32470
8587      <year>1985</year>
8688      <publisher>Epoch</publisher>
8789      <part name="cart" interface="scv_cart">
90         <feature name="slot" value="rom32k" />
8891         <dataarea name="rom" size="32768">
8992            <rom name="basic.bin" size="32768" crc="ca965c2b" sha1="c68e2b81dec2c83e2aa5626c8df4011eada45245" offset="0000" />
9093         </dataarea>
r32469r32470
97100      <year>1984</year>
98101      <publisher>Epoch</publisher>
99102      <part name="cart" interface="scv_cart">
103         <feature name="slot" value="rom16k" />
100104         <dataarea name="rom" size="16384">
101105            <rom name="baseball.bin" size="16384" crc="56f1c473" sha1="37a1dce6c1921950c588d6492cd1b57feb615175" offset="0000" />
102106         </dataarea>
r32469r32470
108112      <year>1985</year>
109113      <publisher>Epoch</publisher>
110114      <part name="cart" interface="scv_cart">
115         <feature name="slot" value="rom16k" />
111116         <dataarea name="rom" size="16384">
112117            <rom name="boulder_dash.bin" size="16384" crc="e045884c" sha1="55942e5b7824314b072b7b40c6b72db0d5404189" offset="0" />
113118         </dataarea>
r32469r32470
119124      <year>1985</year>
120125      <publisher>Epoch</publisher>
121126      <part name="cart" interface="scv_cart">
127         <feature name="slot" value="rom16k" />
122128         <dataarea name="rom" size="16384">
123129            <rom name="comic_circus.bin" size="16384" crc="ea55faed" sha1="2e4ceb2bf68d26c263c3d1c63f7e2143ef2355bc" offset="0" />
124130         </dataarea>
r32469r32470
130136      <year>1985</year>
131137      <publisher>Epoch</publisher>
132138      <part name="cart" interface="scv_cart">
139         <feature name="slot" value="rom64k" />
133140         <dataarea name="rom" size="65536">
134141            <rom name="doraemon.0" size="32768" crc="ee0b874d" sha1="425eb6ed31faa2afdecc216145616f577f72db9a" offset="0" />
135142            <rom name="doraemon.1" size="32768" crc="d2de91a6" sha1="6aba5ee3d08afad222bec9a176c2607829fa5cc6" offset="0x8000" />
r32469r32470
142149      <year>1986</year>
143150      <publisher>Epoch</publisher>
144151      <part name="cart" interface="scv_cart">
152         <feature name="slot" value="rom128k" />
145153         <dataarea name="rom" size="131072">
146154            <rom name="dragonba.bin" size="131072" crc="ea251664" sha1="bd3791ed43a2019a255152e3fc0d8a663cb9567a" offset="0" />
147155         </dataarea>
r32469r32470
153161      <year>1986</year>
154162      <publisher>Epoch</publisher>
155163      <part name="cart" interface="scv_cart">
164         <feature name="slot" value="rom32k_ram" />
156165         <dataarea name="rom" size="32768">
157166            <rom name="dragonsl.bin" size="32768" crc="5971940f" sha1="c6e67e05d365fa81d3d9a3ad66d41bfeb1c3dd0d" offset="0" />
158167         </dataarea>
r32469r32470
166175      <year>1984</year>
167176      <publisher>Epoch</publisher>
168177      <part name="cart" interface="scv_cart">
178         <feature name="slot" value="rom16k" />
169179         <dataarea name="rom" size="16384">
170180            <rom name="elevfght.bin" size="16384" crc="72dd6031" sha1="8b2c185408309ee1e75d40299c003041db17b133" offset="0000" />
171181         </dataarea>
r32469r32470
178188      <year>1985</year>
179189      <publisher>Epoch</publisher>
180190      <part name="cart" interface="scv_cart">
191         <feature name="slot" value="rom64k" />
181192         <dataarea name="rom" size="65536">
182193            <rom name="kungfurd.0" size="32768" crc="9cfc5a67" sha1="1c34470c1f389db7be755e130db298f6b475c7ce" offset="0" />
183194            <rom size="24576" offset="0x8000" loadflag="reload" />
r32469r32470
191202      <year>1984</year>
192203      <publisher>Epoch</publisher>
193204      <part name="cart" interface="scv_cart">
205         <feature name="slot" value="rom16k" />
194206         <dataarea name="rom" size="16384">
195207            <rom name="lupin3.bin" size="16384" crc="16d7eb4a" sha1="62698c7c9d9723f74214626a4211a3c3f34e9dd5" offset="0" />
196208         </dataarea>
r32469r32470
202214      <year>1986</year>
203215      <publisher>Epoch</publisher>
204216      <part name="cart" interface="scv_cart">
217         <feature name="slot" value="rom32k" />
205218         <dataarea name="rom" size="32768">
206219            <rom name="mappy.bin" size="32768" crc="605829bb" sha1="70dc025ab3f32e18fd6f373dc47c9aa7fb9d48f0" offset="0" />
207220         </dataarea>
r32469r32470
213226      <year>1985</year>
214227      <publisher>Epoch</publisher>
215228      <part name="cart" interface="scv_cart">
229         <feature name="slot" value="rom32k" />
216230         <dataarea name="rom" size="32768">
217231            <rom name="mlkprncs.bin" size="32768" crc="b2457990" sha1="b6234f99e474abd87a22a4b691b66bcb12e664cb" offset="0" />
218232         </dataarea>
r32469r32470
224238      <year>1985</year>
225239      <publisher>Epoch</publisher>
226240      <part name="cart" interface="scv_cart">
241         <feature name="slot" value="rom16k" />
227242         <dataarea name="rom" size="16384">
228243            <rom name="miner_2049er.bin" size="16384" crc="b0ffc6e2" sha1="0414878f4aedade180b273257497c1d11cdccb2f" offset="0" />
229244         </dataarea>
r32469r32470
236251      <year>1986</year>
237252      <publisher>Epoch</publisher>
238253      <part name="cart" interface="scv_cart">
254         <feature name="slot" value="rom128k" />
239255         <dataarea name="rom" size="131072">
240256            <rom name="y2mnstld.bin" size="131072" crc="3ac28fe0" sha1="5ae7796ad35a7c537de11ebd3cfe3868d67235a1" offset="0" />
241257         </dataarea>
r32469r32470
247263      <year>1984</year>
248264      <publisher>Epoch</publisher>
249265      <part name="cart" interface="scv_cart">
266         <feature name="slot" value="rom16k" />
250267         <dataarea name="rom" size="16384">
251268            <rom name="nebula.bin" size="16384" crc="5e6a4caf" sha1="699eaf434e73a42e71adf52426b22f0dd85e2897" offset="0000" />
252269         </dataarea>
r32469r32470
258275      <year>1984</year>
259276      <publisher>Epoch</publisher>
260277      <part name="cart" interface="scv_cart">
278         <feature name="slot" value="rom16k" />
261279         <dataarea name="rom" size="16384">
262280            <rom name="nebulaa.bin" size="16384" crc="efb4bdcd" sha1="94a4b9a92d6f9a5f4a68721be4cc35920ca32628" offset="0" />
263281         </dataarea>
r32469r32470
269287      <year>1985</year>
270288      <publisher>Epoch</publisher>
271289      <part name="cart" interface="scv_cart">
290         <feature name="slot" value="rom128k_ram" />
272291         <dataarea name="rom" size="131072">
273292            <rom name="polepos2.bin" size="131072" crc="cb69903d" sha1="472900d7b7fa6cdf30014731dcc925ef5ca65499" offset="0" />
274293         </dataarea>
r32469r32470
282301      <year>1985</year>
283302      <publisher>Epoch</publisher>
284303      <part name="cart" interface="scv_cart">
304         <feature name="slot" value="rom32k_ram" />
285305         <dataarea name="rom" size="32768">
286306            <rom name="popchips.bin" size="32768" crc="cc4fb04d" sha1="5979abd6051d531eafe1ea3b37c97ce2e3e97f8e" offset="0" />
287307         </dataarea>
r32469r32470
295315      <year>1986</year>
296316      <publisher>Epoch</publisher>
297317      <part name="cart" interface="scv_cart">
318         <feature name="slot" value="rom128k" />
298319         <dataarea name="rom" size="131072">
299320            <rom name="prowrest.bin" size="131072" crc="5b1fb2a8" sha1="55fe356c04ce3db83cb3148d867cc8b8060cbb48" offset="0" />
300321         </dataarea>
r32469r32470
306327      <year>1984</year>
307328      <publisher>Epoch</publisher>
308329      <part name="cart" interface="scv_cart">
330         <feature name="slot" value="rom16k" />
309331         <dataarea name="rom" size="16384">
310332            <rom name="punchboy.bin" size="16384" crc="4107f03a" sha1="e7391c71ba7deede3db22191ea058ccf429d7bb5" offset="0000" />
311333         </dataarea>
r32469r32470
317339      <year>1984</year>
318340      <publisher>Epoch</publisher>
319341      <part name="cart" interface="scv_cart">
342         <feature name="slot" value="rom16k" />
320343         <dataarea name="rom" size="16384">
321344            <rom name="real_graphic_mahjong.bin" size="16384" crc="d3d9106c" sha1="7190ff2944c1ffbde6866e720417b86b3844ffa2" offset="0" />
322345         </dataarea>
r32469r32470
328351      <year>1986</year>
329352      <publisher>Epoch</publisher>
330353      <part name="cart" interface="scv_cart">
354         <feature name="slot" value="rom64k" />
331355         <dataarea name="rom" size="65536">
332356            <rom name="skykid.bin" size="65536" crc="f49f2085" sha1="7342fe10d38c79ed12fbfa94b5fd4bf1266c2571" offset="0" />
333357         </dataarea>
r32469r32470
339363      <year>1985</year>
340364      <publisher>Epoch</publisher>
341365      <part name="cart" interface="scv_cart">
366         <feature name="slot" value="rom64k" />
342367         <dataarea name="rom" size="65536">
343368            <rom name="starspeeder.1" size="8192"  crc="7978c4a6" sha1="6bb5ff3946867fa7adb6561dc084ef5a7a92c507" offset="0" />
344369            <rom size="8192" offset="0x2000" loadflag="reload" />
r32469r32470
354379      <year>1985</year>
355380      <publisher>Epoch</publisher>
356381      <part name="cart" interface="scv_cart">
382         <feature name="slot" value="rom32k_ram" />
357383         <dataarea name="rom" size="32768">
358384            <rom name="shoginyu.bin" size="32768" crc="84005c4c" sha1="bd6681013dbbae94c03e501932836db07943468e" offset="0" />
359385         </dataarea>
r32469r32470
367393      <year>1985</year>
368394      <publisher>Epoch</publisher>
369395      <part name="cart" interface="scv_cart">
396         <feature name="slot" value="rom32k" />
370397         <dataarea name="rom" size="32768">
371398            <rom name="sansupyuta.bin" size="32768" crc="6e7e01b5" sha1="dc05257c831cffa5ec66302c88e1d45a92c6dc9c" offset="0" />
372399         </dataarea>
r32469r32470
379406      <year>1985</year>
380407      <publisher>Epoch</publisher>
381408      <part name="cart" interface="scv_cart">
409         <feature name="slot" value="rom16k" />
382410         <dataarea name="rom" size="16384">
383411            <rom name="soccer.bin" size="16384" crc="8283907c" sha1="61e4b8e43cc593b3a2e838c08f6dad6cca77d712" offset="0000" />
384412         </dataarea>
r32469r32470
391419      <year>1985</year>
392420      <publisher>Epoch</publisher>
393421      <part name="cart" interface="scv_cart">
422         <feature name="slot" value="rom16k" />
394423         <dataarea name="rom" size="16384">
395424            <rom name="soccera.bin" size="16384" crc="590eeefd" sha1="951ecd2a1d2e7d900c13e91ff028723a9df9e60e" offset="0000" />
396425         </dataarea>
r32469r32470
403432      <year>1984</year>
404433      <publisher>Epoch</publisher>
405434      <part name="cart" interface="scv_cart">
435         <feature name="slot" value="rom16k" />
406436         <dataarea name="rom" size="16384">
407437            <rom name="suprgolf.bin" size="16384" crc="0c0581c9" sha1="2d3ab09907a4a9c5d66306f316c7211f498cbcc2" offset="0000" />
408438         </dataarea>
r32469r32470
414444      <year>1985</year>
415445      <publisher>Epoch</publisher>
416446      <part name="cart" interface="scv_cart">
447         <feature name="slot" value="rom16k" />
417448         <dataarea name="rom" size="16384">
418449            <rom name="ttball.bin" size="16384" crc="7f873bfa" sha1="093235ac2234c4c4e78a2addaab780d7a2cbe004" offset="0" />
419450         </dataarea>
r32469r32470
425456      <year>1985</year>
426457      <publisher>Epoch</publisher>
427458      <part name="cart" interface="scv_cart">
459         <feature name="slot" value="rom16k" />
428460         <dataarea name="rom" size="16384">
429461            <rom name="wheelrcr.bin" size="16384" crc="9d9b29db" sha1="479f767384e7b7bfe58eeadd67dbe642fe8a2fcf" offset="0000" />
430462         </dataarea>
trunk/hash/vboy.xml
r32469r32470
2121      <info name="serial" value="VUE-VPBE-USA"/>
2222      <info name="release" value="19960322"/>
2323      <part name="cart" interface="vboy_cart">
24         <feature name="slot" value="vb_rom" />
2425         <dataarea name="rom" size="2097152">
2526            <rom name="3-d tetris (usa).bin" size="1048576" crc="bb71b522" sha1="5177015a91442e56bd76af39447bca365e06c272" offset="000000" />
2627            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
3637      <publisher>Nintendo</publisher>
3738      <info name="serial" value="VUE-VBHE-JPN, VUE-VBHE-USA"/>
3839      <part name="cart" interface="vboy_cart">
40         <feature name="slot" value="vb_rom" />
3941         <dataarea name="rom" size="2097152">
4042            <rom name="bound high! (ju).bin" size="2097152" crc="e81a3703" sha1="1196ef8b9a96a0ff2f3634f8eb1c4865c0fb6b01" offset="000000" />
4143         </dataarea>
r32469r32470
5052      <info name="serial" value="VUE-VGPJ-JPN, VUE-VGPJ-USA"/>
5153      <info name="release" value="19950701 (JPN), 19950814 (USA)"/>
5254      <part name="cart" interface="vboy_cart">
55         <feature name="slot" value="vb_rom" />
5356         <dataarea name="rom" size="2097152">
5457            <rom name="galactic pinball (japan, usa).bin" size="1048576" crc="c9710a36" sha1="93a25abf4f86e71a49c1c3a470140bb40cb693d6" offset="000000" />
5558            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
6568      <info name="serial" value="VUE-VVGE-USA"/>
6669      <info name="release" value="199511xx"/>
6770      <part name="cart" interface="vboy_cart">
71         <feature name="slot" value="vb_eeprom" />
6872         <dataarea name="rom" size="2097152">
6973            <rom name="golf (usa).bin" size="2097152" crc="2199af41" sha1="23ce3c174789cdd306497d86cb2c4e76ba8b06e5" offset="000000" />
7074         </dataarea>
r32469r32470
8185      <info name="serial" value="VUE-VIMJ-JPN"/>
8286      <info name="release" value="19951013"/>
8387      <part name="cart" interface="vboy_cart">
88         <feature name="slot" value="vb_rom" />
8489         <dataarea name="rom" size="2097152">
8590            <rom name="innsmouth no yakata (japan).bin" size="1048576" crc="83cb6a00" sha1="37e06e53ce2810e870835c48decdd6c72079bfda" offset="000000" />
8691            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
96101      <info name="serial" value="VUE-VJBE-USA"/>
97102      <info name="release" value="19951020"/>
98103      <part name="cart" interface="vboy_cart">
104         <feature name="slot" value="vb_rom" />
99105         <dataarea name="rom" size="2097152">
100106            <rom name="jack bros. (usa).bin" size="1048576" crc="a44de03c" sha1="0e086d7ef2bd8b97315196943fd0b71da07aa8f1" offset="000000" />
101107            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
111117      <info name="serial" value="VUE-VJBJ-JPN"/>
112118      <info name="release" value="19950929"/>
113119      <part name="cart" interface="vboy_cart">
120         <feature name="slot" value="vb_rom" />
114121         <dataarea name="rom" size="2097152">
115122            <rom name="jack bros. no meiro de hiihoo! (japan).bin" size="1048576" crc="cab61e8b" sha1="a973406590382ee503037271330d68d2834b79db" offset="000000" />
116123            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
126133      <info name="serial" value="VUE-VMCJ-JPN, VUE-VMCJ-USA"/>
127134      <info name="release" value="19950928 (JPN), 199510xx (USA)"/>
128135      <part name="cart" interface="vboy_cart">
136         <feature name="slot" value="vb_rom" />
129137         <dataarea name="rom" size="2097152">
130138            <rom name="mario clash (japan, usa).bin" size="1048576" crc="a47de78c" sha1="7556a778b60490bdb81774bcbaa7413fc84cb985" offset="000000" />
131139            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
141149      <info name="serial" value="VUE-VMTJ-JPN, VUE-VMTJ-USA"/>
142150      <info name="release" value="19950721 (JPN), 19950814 (USA)"/>
143151      <part name="cart" interface="vboy_cart">
152         <feature name="slot" value="vb_rom" />
144153         <dataarea name="rom" size="2097152">
145154            <rom name="mario's tennis (japan, usa).bin" size="524288" crc="7ce7460d" sha1="5162f7fa9e3eae4338c53ccba641ba080c768754" offset="000000" />
146155            <rom size="524288" offset="0x080000" loadflag="reload" />
r32469r32470
158167      <info name="serial" value="VUE-VNFE-USA"/>
159168      <info name="release" value="19960226"/>
160169      <part name="cart" interface="vboy_cart">
170         <feature name="slot" value="vb_rom" />
161171         <dataarea name="rom" size="2097152">
162172            <rom name="nester's funky bowling (usa).bin" size="2097152" crc="df4d56b4" sha1="f4a4c7928f15102cf14c90c5f044e5f7cc7c32f9" offset="000000" />
163173         </dataarea>
r32469r32470
170180      <publisher>Bullet-Proof Software</publisher>
171181      <info name="alt_title" value="ニコちゃんバトル"/>
172182      <part name="cart" interface="vboy_cart">
183         <feature name="slot" value="vb_rom" />
173184         <dataarea name="rom" size="2097152">
174185            <rom name="nikochan battle (j)(prototype).bin" size="1048576" crc="f3cd40dd" sha1="217ca062f65d4e8b2848085918af5ac4b33b12d4" offset="000000" />
175186            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
185196      <info name="serial" value="VUE-VH2E-USA"/>
186197      <info name="release" value="199512xx"/>
187198      <part name="cart" interface="vboy_cart">
199         <feature name="slot" value="vb_rom" />
188200         <dataarea name="rom" size="2097152">
189201            <rom name="panic bomber (usa).bin" size="524288" crc="19bb2dfb" sha1="80216b2874cf162f301d571bb8aebc98d80b4f3e" offset="000000" />
190202            <rom size="524288" offset="0x080000" loadflag="reload" />
r32469r32470
202214      <info name="serial" value="VUE-VREE-USA"/>
203215      <info name="release" value="19950814"/>
204216      <part name="cart" interface="vboy_cart">
217         <feature name="slot" value="vb_rom" />
205218         <dataarea name="rom" size="2097152">
206219            <rom name="red alarm (usa).bin" size="1048576" crc="aa10a7b4" sha1="494fa60cb8997880b4e8cd3270b21d6c2768a48a" offset="000000" />
207220            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
217230      <info name="serial" value="VUE-VREJ-JPN"/>
218231      <info name="release" value="19950721"/>
219232      <part name="cart" interface="vboy_cart">
233         <feature name="slot" value="vb_rom" />
220234         <dataarea name="rom" size="2097152">
221235            <rom name="red alarm (japan).bin" size="1048576" crc="7e85c45d" sha1="f5057fa9bfd9d60b9dcfc004cfdd12aa8eb1cb4a" offset="000000" />
222236            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
232246      <info name="serial" value="VUE-VSDJ-JPN"/>
233247      <info name="release" value="19951222"/>
234248      <part name="cart" interface="vboy_cart">
249         <feature name="slot" value="vb_rom" />
235250         <dataarea name="rom" size="2097152">
236251            <rom name="sd gundam - dimension war (japan).bin" size="1048576" crc="44788197" sha1="1a67f6bdb45db46e22b8aadea754a68ad379ae29" offset="000000" />
237252            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
247262      <info name="serial" value="VUE-VSPJ-JPN"/>
248263      <info name="release" value="19951201"/>
249264      <part name="cart" interface="vboy_cart">
265         <feature name="slot" value="vb_rom" />
250266         <dataarea name="rom" size="2097152">
251267            <rom name="space invaders - virtual collection (japan).bin" size="524288" crc="fa44402d" sha1="16ad904faafd24642dfd056d10a768e81f0d9bfa" offset="000000" />
252268            <rom size="524288" offset="0x080000" loadflag="reload" />
r32469r32470
261277      <year>1995</year>
262278      <publisher>Nintendo</publisher>
263279      <part name="cart" interface="vboy_cart">
280         <feature name="slot" value="vb_rom" />
264281         <dataarea name="rom" size="2097152">
265282            <rom name="space pinball prototype (j).bin" size="2097152" crc="44c2b723" sha1="dc182360c7c8d26323db8921f09db76638e81ced" offset="000000" />
266283         </dataarea>
r32469r32470
275292      <info name="serial" value="VUE-VSSJ-JPN"/>
276293      <info name="release" value="19950929"/>
277294      <part name="cart" interface="vboy_cart">
295         <feature name="slot" value="vb_rom" />
278296         <dataarea name="rom" size="2097152">
279297            <rom name="space squash (japan).bin" size="524288" crc="60895693" sha1="3f08cae2b6f9e386529949ff954220860db1af64" offset="000000" />
280298            <rom size="524288" offset="0x080000" loadflag="reload" />
r32469r32470
292310      <info name="serial" value="VUE-VTBJ-JPN, VUE-VTBJ-USA"/>
293311      <info name="release" value="19950721 (JPN), 19950814 (USA)"/>
294312      <part name="cart" interface="vboy_cart">
313         <feature name="slot" value="vb_eeprom" />
295314         <dataarea name="rom" size="2097152">
296315            <rom name="teleroboxer (japan, usa).bin" size="1048576" crc="36103000" sha1="c59e020f9674774c5cbc022317ebba0eb1d744f7" offset="000000" />
297316            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
309328      <info name="serial" value="VUE-VH2J-JPN"/>
310329      <info name="release" value="19950721"/>
311330      <part name="cart" interface="vboy_cart">
331         <feature name="slot" value="vb_rom" />
312332         <dataarea name="rom" size="2097152">
313333            <rom name="tobidase! panibon (japan).bin" size="524288" crc="40498f5e" sha1="b8a12a9677afa5cbce6ed43eb0effb5a02875534" offset="000000" />
314334            <rom size="524288" offset="0x080000" loadflag="reload" />
r32469r32470
326346      <info name="serial" value="VUE-VVBJ-JPN"/>
327347      <info name="release" value="19951222"/>
328348      <part name="cart" interface="vboy_cart">
349         <feature name="slot" value="vb_rom" />
329350         <dataarea name="rom" size="2097152">
330351            <rom name="virtual bowling (japan).bin" size="1048576" crc="20688279" sha1="a5be7654037050f0a781e70efea0191f43d26f06" offset="000000" />
331352            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
341362      <info name="serial" value="VUE-VVFJ-JPN"/>
342363      <info name="release" value="19951016"/>
343364      <part name="cart" interface="vboy_cart">
365         <feature name="slot" value="vb_eeprom" />
344366         <dataarea name="rom" size="2097152">
345367            <rom name="virtual fishing (japan).bin" size="1048576" crc="526cc969" sha1="583b409b7215159219d08e789db46140062095f2" offset="000000" />
346368            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
358380      <info name="serial" value="VUE-VH3E-USA"/>
359381      <info name="release" value="19951201"/>
360382      <part name="cart" interface="vboy_cart">
383         <feature name="slot" value="vb_rom" />
361384         <dataarea name="rom" size="2097152">
362385            <rom name="vertical force (usa).bin" size="1048576" crc="4c32ba5e" sha1="38f9008f60b09deef1151d46b905b090a0338200" offset="000000" />
363386            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
373396      <info name="serial" value="VUE-VH3J-JPN"/>
374397      <info name="release" value="19950812"/>
375398      <part name="cart" interface="vboy_cart">
399         <feature name="slot" value="vb_rom" />
376400         <dataarea name="rom" size="2097152">
377401            <rom name="vertical force (japan).bin" size="1048576" crc="9e9b8b92" sha1="c7204ba5cfe7d26394b5e22badc580c8ed8c0b37" offset="000000" />
378402            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
388412      <info name="serial" value="VUE-VVGJ-JPN"/>
389413      <info name="release" value="19950811"/>
390414      <part name="cart" interface="vboy_cart">
415         <feature name="slot" value="vb_eeprom" />
391416         <dataarea name="rom" size="2097152">
392417            <rom name="t&amp;e virtual golf (japan).bin" size="2097152" crc="6ba07915" sha1="c595285d42c69f14b2b418c1edfbe4a7f9a624b6" offset="000000" />
393418         </dataarea>
r32469r32470
404429      <info name="serial" value="VUE-VJVJ-JPN"/>
405430      <info name="release" value="19951208"/>
406431      <part name="cart" interface="vboy_cart">
432         <feature name="slot" value="vb_rom" />
407433         <dataarea name="rom" size="2097152">
408434            <rom name="virtual lab (japan).bin" size="1048576" crc="8989fe0a" sha1="d96c9f8aac5b4ea012a8fe659bb68fb1159a9c6d" offset="000000" />
409435            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
419445      <info name="serial" value="VUE-VVPE-USA"/>
420446      <info name="release" value="19950911"/>
421447      <part name="cart" interface="vboy_cart">
448         <feature name="slot" value="vb_rom" />
422449         <dataarea name="rom" size="2097152">
423450            <rom name="virtual league baseball (usa).bin" size="1048576" crc="736b40d6" sha1="266fe615ee3df1160a20b456824699f16810fa28" offset="000000" />
424451            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
434461      <info name="serial" value="VUE-VVPJ-JPN"/>
435462      <info name="release" value="19950811"/>
436463      <part name="cart" interface="vboy_cart">
464         <feature name="slot" value="vb_rom" />
437465         <dataarea name="rom" size="2097152">
438466            <rom name="virtual pro yakyuu '95 (japan).bin" size="1048576" crc="9ba8bb5e" sha1="ab8fa82b79512eefefccdccea6768078a374c4aa" offset="000000" />
439467            <rom size="1048576" offset="0x100000" loadflag="reload" />
r32469r32470
449477      <info name="serial" value="VUE-VTRJ-JPN"/>
450478      <info name="release" value="19950825"/>
451479      <part name="cart" interface="vboy_cart">
480         <feature name="slot" value="vb_rom" />
452481         <dataarea name="rom" size="2097152">
453482            <rom name="v-tetris (japan).bin" size="524288" crc="3ccb67ae" sha1="ff7d4dfc467e6e0d3fe8517102132a65a9d17589" offset="000000" />
454483            <rom size="524288" offset="0x080000" loadflag="reload" />
r32469r32470
466495      <info name="serial" value="VUE-VWCJ-JPN, VUE-VWCJ-USA"/>
467496      <info name="release" value="19951201 (JPN), 199511xx (USA)"/>
468497      <part name="cart" interface="vboy_cart">
498         <feature name="slot" value="vb_eeprom" />
469499         <dataarea name="rom" size="2097152">
470500            <rom name="virtual boy wario land (japan, usa).bin" size="2097152" crc="133e9372" sha1="274c328fbd904f20e69172ab826bf8f94ced1bdb" offset="000000" />
471501         </dataarea>
r32469r32470
482512      <info name="serial" value="VUE-VWEE-USA"/>
483513      <info name="release" value="19951221"/>
484514      <part name="cart" interface="vboy_cart">
515         <feature name="slot" value="vb_rom" />
485516         <dataarea name="rom" size="2097152">
486517            <rom name="waterworld (usa).bin" size="2097152" crc="82a95e51" sha1="dcc46484bd0acab0ac1ea178f425a0f5ccfb8dc2" offset="000000" />
487518         </dataarea>
trunk/src/emu/bus/scv/rom.c
r0r32470
1/***********************************************************************************************************
2
3
4 Epoch Super Cassette Vision cart emulation
5
6
7 ***********************************************************************************************************/
8
9
10#include "emu.h"
11#include "rom.h"
12
13
14//-------------------------------------------------
15//  scv_rom_device - constructor
16//-------------------------------------------------
17
18const device_type SCV_ROM8K = &device_creator<scv_rom8_device>;
19const device_type SCV_ROM16K = &device_creator<scv_rom16_device>;
20const device_type SCV_ROM32K = &device_creator<scv_rom32_device>;
21const device_type SCV_ROM32K_RAM8K = &device_creator<scv_rom32ram8_device>;
22const device_type SCV_ROM64K = &device_creator<scv_rom64_device>;
23const device_type SCV_ROM128K = &device_creator<scv_rom128_device>;
24const device_type SCV_ROM128K_RAM4K = &device_creator<scv_rom128ram4_device>;
25
26
27scv_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)
28               : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
29                  device_scv_cart_interface( mconfig, *this )
30{
31}
32
33scv_rom8_device::scv_rom8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
34               : device_t(mconfig, SCV_ROM8K, "SCV 8K Carts", tag, owner, clock, "scv_rom8", __FILE__),
35                  device_scv_cart_interface( mconfig, *this )
36{
37}
38
39scv_rom16_device::scv_rom16_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
40               : scv_rom8_device(mconfig, SCV_ROM16K, "SCV 16K Carts", tag, owner, clock, "scv_rom16", __FILE__)
41{
42}
43
44scv_rom32_device::scv_rom32_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
45               : scv_rom8_device(mconfig, SCV_ROM32K, "SCV 32K Carts", tag, owner, clock, "scv_rom32", __FILE__)
46{
47}
48
49scv_rom32ram8_device::scv_rom32ram8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
50               : scv_rom8_device(mconfig, SCV_ROM32K_RAM8K, "SCV 32K + RAM 8K Carts", tag, owner, clock, "scv_rom32_ram8", __FILE__)
51{
52}
53
54scv_rom64_device::scv_rom64_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
55               : scv_rom8_device(mconfig, SCV_ROM16K, "SCV 64K Carts", tag, owner, clock, "scv_rom64", __FILE__)
56{
57}
58
59scv_rom128_device::scv_rom128_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
60               : scv_rom8_device(mconfig, SCV_ROM32K, "SCV 128K Carts", tag, owner, clock, "scv_rom128", __FILE__)
61{
62}
63
64scv_rom128ram4_device::scv_rom128ram4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
65               : scv_rom8_device(mconfig, SCV_ROM128K_RAM4K, "SCV 128K + RAM 4K Carts", tag, owner, clock, "scv_rom128_ram4", __FILE__)
66{
67}
68
69
70//-------------------------------------------------
71//  mapper specific start/reset
72//-------------------------------------------------
73
74void scv_rom32ram8_device::device_start()
75{
76   save_item(NAME(m_ram_enabled));
77}
78
79void scv_rom32ram8_device::device_reset()
80{
81   m_ram_enabled = 1;
82}
83
84
85void scv_rom64_device::device_start()
86{
87   save_item(NAME(m_bank_base));
88}
89
90void scv_rom64_device::device_reset()
91{
92   m_bank_base = 0;
93}
94
95
96void scv_rom128_device::device_start()
97{
98   save_item(NAME(m_bank_base));
99}
100
101void scv_rom128_device::device_reset()
102{
103   m_bank_base = 0;
104}
105
106
107void scv_rom128ram4_device::device_start()
108{
109   save_item(NAME(m_bank_base));
110   save_item(NAME(m_ram_enabled));
111}
112
113void scv_rom128ram4_device::device_reset()
114{
115   m_bank_base = 0;
116   m_ram_enabled = 1;
117}
118
119
120
121/*-------------------------------------------------
122 mapper specific handlers
123 -------------------------------------------------*/
124
125READ8_MEMBER(scv_rom8_device::read_cart)
126{
127   return m_rom[offset & 0x1fff];
128}
129
130
131READ8_MEMBER(scv_rom16_device::read_cart)
132{
133   return m_rom[offset & 0x3fff];
134}
135
136
137READ8_MEMBER(scv_rom32_device::read_cart)
138{
139   return m_rom[offset];
140}
141
142
143READ8_MEMBER(scv_rom32ram8_device::read_cart)
144{
145   if (m_ram_enabled && offset >= 0x6000)
146      return m_ram[offset & 0x1fff];
147
148   return m_rom[offset];
149}
150
151WRITE8_MEMBER(scv_rom32ram8_device::write_cart)
152{
153   if (m_ram_enabled && offset >= 0x6000)
154      m_ram[offset & 0x1fff] = data;
155}
156
157WRITE8_MEMBER(scv_rom32ram8_device::write_bank)
158{
159   m_ram_enabled = BIT(data, 5);
160}
161
162
163READ8_MEMBER(scv_rom64_device::read_cart)
164{
165   return m_rom[offset + (m_bank_base * 0x8000)];
166}
167
168WRITE8_MEMBER(scv_rom64_device::write_bank)
169{
170   m_bank_base = BIT(data, 5);
171}
172
173
174READ8_MEMBER(scv_rom128_device::read_cart)
175{
176   return m_rom[offset + (m_bank_base * 0x8000)];
177}
178
179WRITE8_MEMBER(scv_rom128_device::write_bank)
180{
181   m_bank_base = (data >> 5) & 0x03;
182}
183
184
185READ8_MEMBER(scv_rom128ram4_device::read_cart)
186{
187   if (m_ram_enabled && offset >= 0x7000)
188      return m_ram[offset & 0xfff];
189
190   return m_rom[offset + (m_bank_base * 0x8000)];
191}
192
193WRITE8_MEMBER(scv_rom128ram4_device::write_cart)
194{
195   if (m_ram_enabled && offset >= 0x7000)
196      m_ram[offset & 0xfff] = data;
197}
198
199WRITE8_MEMBER(scv_rom128ram4_device::write_bank)
200{
201   m_bank_base = (data >> 5) & 0x03;
202   m_ram_enabled = BIT(data, 6);
203}
Property changes on: trunk/src/emu/bus/scv/rom.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/emu/bus/scv/slot.c
r0r32470
1/***********************************************************************************************************
2
3    Epoch Super Cassette Vision cart emulation
4    (through slot devices)
5
6 ***********************************************************************************************************/
7
8
9#include "emu.h"
10#include "slot.h"
11
12//**************************************************************************
13//  GLOBAL VARIABLES
14//**************************************************************************
15
16const device_type SCV_CART_SLOT = &device_creator<scv_cart_slot_device>;
17
18//**************************************************************************
19//    SCV cartridges Interface
20//**************************************************************************
21
22//-------------------------------------------------
23//  device_scv_cart_interface - constructor
24//-------------------------------------------------
25
26device_scv_cart_interface::device_scv_cart_interface(const machine_config &mconfig, device_t &device)
27   : device_slot_card_interface(mconfig, device),
28      m_rom(NULL),
29      m_rom_size(0)
30{
31}
32
33
34//-------------------------------------------------
35//  ~device_scv_cart_interface - destructor
36//-------------------------------------------------
37
38device_scv_cart_interface::~device_scv_cart_interface()
39{
40}
41
42//-------------------------------------------------
43//  rom_alloc - alloc the space for the cart
44//-------------------------------------------------
45
46void device_scv_cart_interface::rom_alloc(UINT32 size, const char *tag)
47{
48   if (m_rom == NULL)
49   {
50      astring tempstring(tag);
51      tempstring.cat(SCVSLOT_ROM_REGION_TAG);
52      m_rom = device().machine().memory().region_alloc(tempstring, size, 1, ENDIANNESS_LITTLE)->base();
53      m_rom_size = size;
54   }
55}
56
57
58//-------------------------------------------------
59//  ram_alloc - alloc the space for the ram
60//-------------------------------------------------
61
62void device_scv_cart_interface::ram_alloc(UINT32 size)
63{
64   m_ram.resize(size);
65}
66
67
68//**************************************************************************
69//  LIVE DEVICE
70//**************************************************************************
71
72//-------------------------------------------------
73//  scv_cart_slot_device - constructor
74//-------------------------------------------------
75scv_cart_slot_device::scv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
76                  device_t(mconfig, SCV_CART_SLOT, "SCV Cartridge Slot", tag, owner, clock, "scv_cart_slot", __FILE__),
77                  device_image_interface(mconfig, *this),
78                  device_slot_interface(mconfig, *this),
79                  m_type(SCV_8K)
80{
81}
82
83
84//-------------------------------------------------
85//  scv_cart_slot_device - destructor
86//-------------------------------------------------
87
88scv_cart_slot_device::~scv_cart_slot_device()
89{
90}
91
92//-------------------------------------------------
93//  device_start - device-specific startup
94//-------------------------------------------------
95
96void scv_cart_slot_device::device_start()
97{
98   m_cart = dynamic_cast<device_scv_cart_interface *>(get_card_device());
99}
100
101//-------------------------------------------------
102//  device_config_complete - perform any
103//  operations now that the configuration is
104//  complete
105//-------------------------------------------------
106
107void scv_cart_slot_device::device_config_complete()
108{
109   // set brief and instance name
110   update_names();
111}
112
113
114//-------------------------------------------------
115//  SCV PCB
116//-------------------------------------------------
117
118struct scv_slot
119{
120   int                     pcb_id;
121   const char              *slot_option;
122};
123
124// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it
125static const scv_slot slot_list[] =
126{
127   { SCV_8K,       "rom8k" },
128   { SCV_16K,      "rom16k" },
129   { SCV_32K,      "rom32k" },
130   { SCV_32K_RAM,  "rom32k_ram" },
131   { SCV_64K,      "rom64k" },
132   { SCV_128K,     "rom128k" },
133   { SCV_128K_RAM, "rom128k_ram" }
134};
135
136static int scv_get_pcb_id(const char *slot)
137{
138   for (int i = 0; i < ARRAY_LENGTH(slot_list); i++)
139   {
140      if (!core_stricmp(slot_list[i].slot_option, slot))
141         return slot_list[i].pcb_id;
142   }
143
144   return 0;
145}
146
147static const char *scv_get_slot(int type)
148{
149   for (int i = 0; i < ARRAY_LENGTH(slot_list); i++)
150   {
151      if (slot_list[i].pcb_id == type)
152         return slot_list[i].slot_option;
153   }
154
155   return "rom8k";
156}
157
158
159/*-------------------------------------------------
160 call load
161 -------------------------------------------------*/
162
163bool scv_cart_slot_device::call_load()
164{
165   if (m_cart)
166   {
167      UINT8 *ROM;
168      UINT32 len = (software_entry() == NULL) ? length() : get_software_region_length("rom");
169      bool has_ram = (software_entry() != NULL) && get_software_region("ram");
170
171      if (len > 0x20000)
172      {
173         seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
174         return IMAGE_INIT_FAIL;
175      }
176     
177      m_cart->rom_alloc(len, tag());
178      if (has_ram)
179         m_cart->ram_alloc(get_software_region_length("ram"));
180         
181      ROM = m_cart->get_rom_base();
182
183      if (software_entry() == NULL)
184         fread(ROM, len);
185      else
186         memcpy(ROM, get_software_region("rom"), len);
187
188      if (software_entry() == NULL)
189         m_type = get_cart_type(ROM, len);
190      else
191      {
192         const char *pcb_name = get_feature("slot");
193         if (pcb_name)
194            m_type = scv_get_pcb_id(pcb_name);
195      }
196
197      // for the moment we only support RAM from softlist and in the following configurations
198      // 1) 32K ROM + 8K RAM; 2) 128K ROM + 4K RAM
199      if (m_type == SCV_32K && has_ram)
200         m_type = SCV_32K_RAM;
201      if (m_type == SCV_128K && has_ram)
202         m_type = SCV_128K_RAM;
203
204      //printf("Type: %s\n", scv_get_slot(m_type));
205
206      return IMAGE_INIT_PASS;
207   }
208
209   return IMAGE_INIT_PASS;
210}
211
212
213/*-------------------------------------------------
214 call softlist load
215 -------------------------------------------------*/
216
217bool scv_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
218{
219   load_software_part_region(*this, swlist, swname, start_entry);
220   return TRUE;
221}
222
223
224
225/*-------------------------------------------------
226 get_cart_type - code to detect NVRAM type from
227 fullpath
228 -------------------------------------------------*/
229
230int scv_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len)
231{
232   int type = SCV_8K;
233
234   // TO DO: is there any way to identify carts with RAM?!?
235   switch (len)
236   {
237      case 0x2000:
238         type = SCV_8K;
239         break;
240      case 0x4000:
241         type = SCV_16K;
242         break;
243      case 0x8000:
244         type = SCV_32K;
245         break;
246      case 0x10000:
247         type = SCV_64K;
248         break;
249      case 0x20000:
250         type = SCV_128K;
251         break;
252   }
253
254   return type;
255}
256
257
258/*-------------------------------------------------
259 get default card software
260 -------------------------------------------------*/
261
262void scv_cart_slot_device::get_default_card_software(astring &result)
263{
264   if (open_image_file(mconfig().options()))
265   {
266      const char *slot_string = "rom8k";
267      UINT32 len = core_fsize(m_file);
268      dynamic_buffer rom(len);
269      int type;
270
271      core_fread(m_file, rom, len);
272
273      type = get_cart_type(rom, len);
274      slot_string = scv_get_slot(type);
275
276      //printf("type: %s\n", slot_string);
277      clear();
278
279      result.cpy(slot_string);
280      return;
281   }
282
283   software_get_default_slot(result, "rom8k");
284}
285
286/*-------------------------------------------------
287 read
288 -------------------------------------------------*/
289
290READ8_MEMBER(scv_cart_slot_device::read_cart)
291{
292   if (m_cart)
293      return m_cart->read_cart(space, offset);
294   else
295      return 0xff;
296}
297
298/*-------------------------------------------------
299 write
300 -------------------------------------------------*/
301
302WRITE8_MEMBER(scv_cart_slot_device::write_cart)
303{
304   if (m_cart)
305      m_cart->write_cart(space, offset, data);
306}
307
308
309/*-------------------------------------------------
310 write_bank
311 -------------------------------------------------*/
312
313WRITE8_MEMBER(scv_cart_slot_device::write_bank)
314{
315   if (m_cart)
316      m_cart->write_bank(space, offset, data);
317}
318
Property changes on: trunk/src/emu/bus/scv/slot.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/scv/rom.h
r0r32470
1#ifndef __SCV_ROM_H
2#define __SCV_ROM_H
3
4#include "slot.h"
5
6
7// ======================> scv_rom8_device
8
9class scv_rom8_device : public device_t,
10                  public device_scv_cart_interface
11{
12public:
13   // construction/destruction
14   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);
15   scv_rom8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
16
17   // device-level overrides
18   virtual void device_start() {}
19   virtual void device_reset() {}
20
21   // reading and writing
22   virtual DECLARE_READ8_MEMBER(read_cart);
23};
24
25// ======================> scv_rom16_device
26
27class scv_rom16_device : public scv_rom8_device
28{
29public:
30   // construction/destruction
31   scv_rom16_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33   // reading and writing
34   virtual DECLARE_READ8_MEMBER(read_cart);
35};
36
37
38// ======================> scv_rom32_device
39
40class scv_rom32_device : public scv_rom8_device
41{
42public:
43   // construction/destruction
44   scv_rom32_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
45
46   // reading and writing
47   virtual DECLARE_READ8_MEMBER(read_cart);
48};
49
50
51// ======================> scv_rom32ram8_device
52
53class scv_rom32ram8_device : public scv_rom8_device
54{
55public:
56   // construction/destruction
57   scv_rom32ram8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
58
59   // device-level overrides
60   virtual void device_start();
61   virtual void device_reset();
62
63   // reading and writing
64   virtual DECLARE_READ8_MEMBER(read_cart);
65   virtual DECLARE_WRITE8_MEMBER(write_cart);
66   virtual DECLARE_WRITE8_MEMBER(write_bank);
67
68private:
69   UINT8 m_ram_enabled;
70};
71
72
73// ======================> scv_rom64_device
74
75class scv_rom64_device : public scv_rom8_device
76{
77public:
78   // construction/destruction
79   scv_rom64_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
80   
81   // device-level overrides
82   virtual void device_start();
83   virtual void device_reset();
84   
85   // reading and writing
86   virtual DECLARE_READ8_MEMBER(read_cart);
87   virtual DECLARE_WRITE8_MEMBER(write_bank);
88
89private:
90   UINT8 m_bank_base;
91};
92
93
94// ======================> scv_rom128_device
95
96class scv_rom128_device : public scv_rom8_device
97{
98public:
99   // construction/destruction
100   scv_rom128_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
101   
102   // device-level overrides
103   virtual void device_start();
104   virtual void device_reset();
105   
106   // reading and writing
107   virtual DECLARE_READ8_MEMBER(read_cart);
108   virtual DECLARE_WRITE8_MEMBER(write_bank);
109   
110private:
111   UINT8 m_bank_base;
112};
113
114
115// ======================> scv_rom128ram4_device
116
117class scv_rom128ram4_device : public scv_rom8_device
118{
119public:
120   // construction/destruction
121   scv_rom128ram4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
122   
123   // device-level overrides
124   virtual void device_start();
125   virtual void device_reset();
126   
127   // reading and writing
128   virtual DECLARE_READ8_MEMBER(read_cart);
129   virtual DECLARE_WRITE8_MEMBER(write_cart);
130   virtual DECLARE_WRITE8_MEMBER(write_bank);
131   
132private:
133   UINT8 m_bank_base, m_ram_enabled;
134};
135
136
137
138// device type definition
139extern const device_type SCV_ROM8K;
140extern const device_type SCV_ROM16K;
141extern const device_type SCV_ROM32K;
142extern const device_type SCV_ROM32K_RAM8K;
143extern const device_type SCV_ROM64K;
144extern const device_type SCV_ROM128K;
145extern const device_type SCV_ROM128K_RAM4K;
146
147
148
149#endif
Property changes on: trunk/src/emu/bus/scv/rom.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/scv/slot.h
r0r32470
1#ifndef __SCV_SLOT_H
2#define __SCV_SLOT_H
3
4/***************************************************************************
5 TYPE DEFINITIONS
6 ***************************************************************************/
7
8
9/* PCB */
10enum
11{
12   SCV_8K = 0,
13   SCV_16K,
14   SCV_32K,
15   SCV_32K_RAM,
16   SCV_64K,
17   SCV_128K,
18   SCV_128K_RAM
19};
20
21
22// ======================> device_scv_cart_interface
23
24class device_scv_cart_interface : public device_slot_card_interface
25{
26public:
27   // construction/destruction
28   device_scv_cart_interface(const machine_config &mconfig, device_t &device);
29   virtual ~device_scv_cart_interface();
30
31   // reading and writing
32   virtual DECLARE_READ8_MEMBER(read_cart) { return 0xff; }
33   virtual DECLARE_WRITE8_MEMBER(write_cart) {}
34   virtual DECLARE_WRITE8_MEMBER(write_bank) {}
35
36   void rom_alloc(UINT32 size, const char *tag);
37   void ram_alloc(UINT32 size);
38   UINT8* get_rom_base() { return m_rom; }
39   UINT8* get_ram_base() { return m_ram; }
40   UINT32 get_rom_size() { return m_rom_size; }
41   UINT32 get_ram_size() { return m_ram.count(); }
42
43   void save_ram()   { device().save_item(NAME(m_ram)); }
44
45protected:
46   // internal state
47   UINT8 *m_rom;
48   UINT32 m_rom_size;
49   dynamic_buffer m_ram;
50};
51
52
53// ======================> scv_cart_slot_device
54
55class scv_cart_slot_device : public device_t,
56                        public device_image_interface,
57                        public device_slot_interface
58{
59public:
60   // construction/destruction
61   scv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
62   virtual ~scv_cart_slot_device();
63
64   // device-level overrides
65   virtual void device_start();
66   virtual void device_config_complete();
67
68   // image-level overrides
69   virtual bool call_load();
70   virtual void call_unload() {}
71   virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry);
72
73   int get_type() { return m_type; }
74   int get_cart_type(UINT8 *ROM, UINT32 len);
75
76   void save_ram()   { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); }
77
78   virtual iodevice_t image_type() const { return IO_CARTSLOT; }
79   virtual bool is_readable()  const { return 1; }
80   virtual bool is_writeable() const { return 0; }
81   virtual bool is_creatable() const { return 0; }
82   virtual bool must_be_loaded() const { return 0; }
83   virtual bool is_reset_on_load() const { return 1; }
84   virtual const option_guide *create_option_guide() const { return NULL; }
85   virtual const char *image_interface() const { return "scv_cart"; }
86   virtual const char *file_extensions() const { return "bin"; }
87
88   // slot interface overrides
89   virtual void get_default_card_software(astring &result);
90
91   // reading and writing
92   virtual DECLARE_READ8_MEMBER(read_cart);
93   virtual DECLARE_WRITE8_MEMBER(write_cart);
94   virtual DECLARE_WRITE8_MEMBER(write_bank);
95
96protected:
97
98   int m_type;
99   device_scv_cart_interface*       m_cart;
100};
101
102
103
104// device type definition
105extern const device_type SCV_CART_SLOT;
106
107
108/***************************************************************************
109 DEVICE CONFIGURATION MACROS
110 ***************************************************************************/
111
112#define SCVSLOT_ROM_REGION_TAG ":cart:rom"
113
114#define MCFG_SCV_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
115   MCFG_DEVICE_ADD(_tag, SCV_CART_SLOT, 0) \
116   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
117
118#endif
Property changes on: trunk/src/emu/bus/scv/slot.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/bus.mak
r32469r32470
958958
959959#-------------------------------------------------
960960#
961#@src/emu/bus/vboy/slot.h,BUSES += VBOY
962#-------------------------------------------------
963ifneq ($(filter VBOY,$(BUSES)),)
964OBJDIRS += $(BUSOBJ)/vboy
965BUSOBJS += $(BUSOBJ)/vboy/slot.o
966BUSOBJS += $(BUSOBJ)/vboy/rom.o
967endif
968
969#-------------------------------------------------
970#
961971#@src/emu/bus/megadrive/md_slot.h,BUSES += MEGADRIVE
962972#-------------------------------------------------
963973
r32469r32470
11751185
11761186#-------------------------------------------------
11771187#
1188#@src/emu/bus/scv/slot.h,BUSES += SCV
1189#-------------------------------------------------
1190ifneq ($(filter SCV,$(BUSES)),)
1191OBJDIRS += $(BUSOBJ)/scv
1192BUSOBJS += $(BUSOBJ)/scv/slot.o
1193BUSOBJS += $(BUSOBJ)/scv/rom.o
1194endif
1195
1196#-------------------------------------------------
1197#
11781198#@src/emu/bus/x68k/x68kexp.h,BUSES += X68K
11791199#-------------------------------------------------
11801200ifneq ($(filter X68K,$(BUSES)),)
trunk/src/emu/bus/vboy/rom.c
r0r32470
1/***********************************************************************************************************
2
3
4 Nintendo Virtual Boy cart emulation
5
6
7 ***********************************************************************************************************/
8
9
10#include "emu.h"
11#include "rom.h"
12
13
14//-------------------------------------------------
15//  vboy_rom_device - constructor
16//-------------------------------------------------
17
18const device_type VBOY_ROM_STD = &device_creator<vboy_rom_device>;
19const device_type VBOY_ROM_EEPROM = &device_creator<vboy_eeprom_device>;
20
21
22vboy_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)
23               : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
24                  device_vboy_cart_interface( mconfig, *this )
25{
26}
27
28vboy_rom_device::vboy_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
29               : device_t(mconfig, VBOY_ROM_STD, "Nintendo Virtual Boy Carts", tag, owner, clock, "vboy_rom", __FILE__),
30                  device_vboy_cart_interface( mconfig, *this )
31{
32}
33
34vboy_eeprom_device::vboy_eeprom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
35               : vboy_rom_device(mconfig, VBOY_ROM_EEPROM, "Nintendo Virtual Boy Carts + EEPROM", tag, owner, clock, "vboy_eeprom", __FILE__)
36{
37}
38
39
40/*-------------------------------------------------
41 mapper specific handlers
42 -------------------------------------------------*/
43
44READ32_MEMBER(vboy_rom_device::read_cart)
45{
46   return m_rom[offset & m_rom_mask];
47}
48
49
50READ32_MEMBER(vboy_eeprom_device::read_eeprom)
51{
52   return m_eeprom[offset];
53}
54
55
56WRITE32_MEMBER(vboy_eeprom_device::write_eeprom)
57{
58   COMBINE_DATA(&m_eeprom[offset]);
59}
Property changes on: trunk/src/emu/bus/vboy/rom.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vboy/slot.c
r0r32470
1/***********************************************************************************************************
2
3    Nintendo Virtual Boy cart emulation
4    (through slot devices)
5
6 ***********************************************************************************************************/
7
8
9#include "emu.h"
10#include "slot.h"
11
12//**************************************************************************
13//  GLOBAL VARIABLES
14//**************************************************************************
15
16const device_type VBOY_CART_SLOT = &device_creator<vboy_cart_slot_device>;
17
18//**************************************************************************
19//    vboy cartridges Interface
20//**************************************************************************
21
22//-------------------------------------------------
23//  device_vboy_cart_interface - constructor
24//-------------------------------------------------
25
26device_vboy_cart_interface::device_vboy_cart_interface(const machine_config &mconfig, device_t &device)
27   : device_slot_card_interface(mconfig, device),
28      m_rom(NULL),
29      m_rom_size(0),
30      m_rom_mask(0)
31{
32}
33
34
35//-------------------------------------------------
36//  ~device_vboy_cart_interface - destructor
37//-------------------------------------------------
38
39device_vboy_cart_interface::~device_vboy_cart_interface()
40{
41}
42
43//-------------------------------------------------
44//  rom_alloc - alloc the space for the cart
45//-------------------------------------------------
46
47void device_vboy_cart_interface::rom_alloc(UINT32 size, const char *tag)
48{
49   if (m_rom == NULL)
50   {
51      astring tempstring(tag);
52      tempstring.cat(VBOYSLOT_ROM_REGION_TAG);
53      m_rom = (UINT32 *)device().machine().memory().region_alloc(tempstring, size, 4, ENDIANNESS_LITTLE)->base();
54      m_rom_size = size/4;
55      m_rom_mask = m_rom_size - 1;
56   }
57}
58
59
60//-------------------------------------------------
61//  ram_alloc - alloc the space for the ram
62//-------------------------------------------------
63
64void device_vboy_cart_interface::eeprom_alloc(UINT32 size)
65{
66   m_eeprom.resize(size/sizeof(UINT32));
67}
68
69
70//**************************************************************************
71//  LIVE DEVICE
72//**************************************************************************
73
74//-------------------------------------------------
75//  vboy_cart_slot_device - constructor
76//-------------------------------------------------
77vboy_cart_slot_device::vboy_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
78                  device_t(mconfig, VBOY_CART_SLOT, "Nintendo Virtual Boy Cartridge Slot", tag, owner, clock, "vboy_cart_slot", __FILE__),
79                  device_image_interface(mconfig, *this),
80                  device_slot_interface(mconfig, *this),
81                  m_type(VBOY_STD)
82{
83}
84
85
86//-------------------------------------------------
87//  vboy_cart_slot_device - destructor
88//-------------------------------------------------
89
90vboy_cart_slot_device::~vboy_cart_slot_device()
91{
92}
93
94//-------------------------------------------------
95//  device_start - device-specific startup
96//-------------------------------------------------
97
98void vboy_cart_slot_device::device_start()
99{
100   m_cart = dynamic_cast<device_vboy_cart_interface *>(get_card_device());
101}
102
103//-------------------------------------------------
104//  device_config_complete - perform any
105//  operations now that the configuration is
106//  complete
107//-------------------------------------------------
108
109void vboy_cart_slot_device::device_config_complete()
110{
111   // set brief and instance name
112   update_names();
113}
114
115
116//-------------------------------------------------
117//  vboy PCB
118//-------------------------------------------------
119
120struct vboy_slot
121{
122   int                     pcb_id;
123   const char              *slot_option;
124};
125
126// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it
127static const vboy_slot slot_list[] =
128{
129   { VBOY_STD,       "vb_rom" },
130   { VBOY_EEPROM,    "vb_eeprom" }
131};
132
133static int vboy_get_pcb_id(const char *slot)
134{
135   for (int i = 0; i < ARRAY_LENGTH(slot_list); i++)
136   {
137      if (!core_stricmp(slot_list[i].slot_option, slot))
138         return slot_list[i].pcb_id;
139   }
140
141   return 0;
142}
143
144#if 0
145static const char *vboy_get_slot(int type)
146{
147   for (int i = 0; i < ARRAY_LENGTH(slot_list); i++)
148   {
149      if (slot_list[i].pcb_id == type)
150         return slot_list[i].slot_option;
151   }
152   
153   return "vb_rom";
154}
155#endif
156
157/*-------------------------------------------------
158 call load
159 -------------------------------------------------*/
160
161bool vboy_cart_slot_device::call_load()
162{
163   if (m_cart)
164   {
165      UINT8 *ROM;
166      UINT32 len = (software_entry() == NULL) ? length() : get_software_region_length("rom");
167      bool has_eeprom = (software_entry() != NULL) && get_software_region("eeprom");
168
169      if (len > 0x200000)
170      {
171         seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
172         return IMAGE_INIT_FAIL;
173      }
174     
175      m_cart->rom_alloc(len, tag());
176      if (has_eeprom)
177         m_cart->eeprom_alloc(get_software_region_length("eeprom"));
178         
179      ROM = (UINT8 *)m_cart->get_rom_base();
180
181      if (software_entry() == NULL)
182         fread(ROM, len);
183      else
184         memcpy(ROM, get_software_region("rom"), len);
185
186      if (software_entry() == NULL)
187         m_type = vboy_get_pcb_id("vb_rom");
188      else
189      {
190         const char *pcb_name = get_feature("slot");
191         if (pcb_name)
192            m_type = vboy_get_pcb_id(pcb_name);
193      }
194
195      //printf("Type: %s\n", vboy_get_slot(m_type));
196
197      return IMAGE_INIT_PASS;
198   }
199
200   return IMAGE_INIT_PASS;
201}
202
203
204/*-------------------------------------------------
205 call_unload
206 -------------------------------------------------*/
207
208void vboy_cart_slot_device::call_unload()
209{
210   if (m_cart && m_cart->get_eeprom_size())
211      battery_save(m_cart->get_eeprom_base(), m_cart->get_eeprom_size() * 4);
212}
213
214/*-------------------------------------------------
215 call softlist load
216 -------------------------------------------------*/
217
218bool vboy_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
219{
220   load_software_part_region(*this, swlist, swname, start_entry);
221   return TRUE;
222}
223
224
225
226/*-------------------------------------------------
227 get default card software
228 -------------------------------------------------*/
229
230void vboy_cart_slot_device::get_default_card_software(astring &result)
231{
232   software_get_default_slot(result, "vb_rom");
233}
234
235/*-------------------------------------------------
236 read
237 -------------------------------------------------*/
238
239READ32_MEMBER(vboy_cart_slot_device::read_cart)
240{
241   if (m_cart)
242      return m_cart->read_cart(space, offset, mem_mask);
243   else
244      return 0xffffffff;
245}
246
247/*-------------------------------------------------
248 read
249 -------------------------------------------------*/
250
251READ32_MEMBER(vboy_cart_slot_device::read_eeprom)
252{
253   if (m_cart)
254      return m_cart->read_eeprom(space, offset, mem_mask);
255   else
256      return 0xffffffff;
257}
258
259/*-------------------------------------------------
260 write
261 -------------------------------------------------*/
262
263WRITE32_MEMBER(vboy_cart_slot_device::write_eeprom)
264{
265   if (m_cart)
266      m_cart->write_eeprom(space, offset, data, mem_mask);
267}
Property changes on: trunk/src/emu/bus/vboy/slot.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vboy/rom.h
r0r32470
1#ifndef __VBOY_ROM_H
2#define __VBOY_ROM_H
3
4#include "slot.h"
5
6
7// ======================> vboy_rom_device
8
9class vboy_rom_device : public device_t,
10                  public device_vboy_cart_interface
11{
12public:
13   // construction/destruction
14   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);
15   vboy_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
16   
17   // device-level overrides
18   virtual void device_start() {}
19   
20   // reading and writing
21   virtual DECLARE_READ32_MEMBER(read_cart);
22};
23
24// ======================> vboy_eeprom_device
25
26class vboy_eeprom_device : public vboy_rom_device
27{
28public:
29   // construction/destruction
30   vboy_eeprom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31
32   // reading and writing
33   virtual DECLARE_READ32_MEMBER(read_eeprom);
34   virtual DECLARE_WRITE32_MEMBER(write_eeprom);
35};
36
37
38
39// device type definition
40extern const device_type VBOY_ROM_STD;
41extern const device_type VBOY_ROM_EEPROM;
42
43
44
45#endif
Property changes on: trunk/src/emu/bus/vboy/rom.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/vboy/slot.h
r0r32470
1#ifndef __VBOY_SLOT_H
2#define __VBOY_SLOT_H
3
4/***************************************************************************
5 TYPE DEFINITIONS
6 ***************************************************************************/
7
8
9/* PCB */
10enum
11{
12   VBOY_STD = 0,
13   VBOY_EEPROM
14};
15
16
17// ======================> device_vboy_cart_interface
18
19class device_vboy_cart_interface : public device_slot_card_interface
20{
21public:
22   // construction/destruction
23   device_vboy_cart_interface(const machine_config &mconfig, device_t &device);
24   virtual ~device_vboy_cart_interface();
25
26   // reading and writing
27   virtual DECLARE_READ32_MEMBER(read_cart) { return 0xffffffff; }
28   virtual DECLARE_READ32_MEMBER(read_eeprom) { return 0xffffffff; }
29   virtual DECLARE_WRITE32_MEMBER(write_eeprom) {}
30
31   void rom_alloc(UINT32 size, const char *tag);
32   void eeprom_alloc(UINT32 size);
33   UINT32* get_rom_base() { return m_rom; }
34   UINT32* get_eeprom_base() { return m_eeprom; }
35   UINT32 get_rom_size() { return m_rom_size; }
36   UINT32 get_eeprom_size() { return m_eeprom.count(); }
37
38   void save_eeprom()   { device().save_item(NAME(m_eeprom)); }
39
40protected:
41   // internal state
42   UINT32 *m_rom;
43   UINT32 m_rom_size;
44   UINT32 m_rom_mask;
45   dynamic_array<UINT32> m_eeprom;
46};
47
48
49// ======================> vboy_cart_slot_device
50
51class vboy_cart_slot_device : public device_t,
52                        public device_image_interface,
53                        public device_slot_interface
54{
55public:
56   // construction/destruction
57   vboy_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
58   virtual ~vboy_cart_slot_device();
59
60   // device-level overrides
61   virtual void device_start();
62   virtual void device_config_complete();
63
64   // image-level overrides
65   virtual bool call_load();
66   virtual void call_unload();
67   virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry);
68
69   int get_type() { return m_type; }
70   int get_cart_type(UINT8 *ROM, UINT32 len);
71
72   void save_eeprom()   { if (m_cart && m_cart->get_eeprom_size()) m_cart->save_eeprom(); }
73
74   virtual iodevice_t image_type() const { return IO_CARTSLOT; }
75   virtual bool is_readable()  const { return 1; }
76   virtual bool is_writeable() const { return 0; }
77   virtual bool is_creatable() const { return 0; }
78   virtual bool must_be_loaded() const { return 1; }
79   virtual bool is_reset_on_load() const { return 1; }
80   virtual const option_guide *create_option_guide() const { return NULL; }
81   virtual const char *image_interface() const { return "vboy_cart"; }
82   virtual const char *file_extensions() const { return "vb,bin"; }
83
84   // slot interface overrides
85   virtual void get_default_card_software(astring &result);
86
87   // reading and writing
88   virtual DECLARE_READ32_MEMBER(read_cart);
89   virtual DECLARE_READ32_MEMBER(read_eeprom);
90   virtual DECLARE_WRITE32_MEMBER(write_eeprom);
91
92protected:
93
94   int m_type;
95   device_vboy_cart_interface*       m_cart;
96};
97
98
99
100// device type definition
101extern const device_type VBOY_CART_SLOT;
102
103
104/***************************************************************************
105 DEVICE CONFIGURATION MACROS
106 ***************************************************************************/
107
108#define VBOYSLOT_ROM_REGION_TAG ":cart:rom"
109
110#define MCFG_VBOY_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
111   MCFG_DEVICE_ADD(_tag, VBOY_CART_SLOT, 0) \
112   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
113
114#endif
Property changes on: trunk/src/emu/bus/vboy/slot.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/drivers/vboy.c
r32469r32470
2828
2929#include "emu.h"
3030#include "cpu/v810/v810.h"
31#include "imagedev/cartslot.h"
3231#include "audio/vboy.h"
32#include "bus/vboy/slot.h"
33#include "bus/vboy/rom.h"
3334#include "vboy.lh"
3435
3536#define READ_BGMAP(bgoffs) m_bgmap[(bgoffs) & 0xffff]
r32469r32470
104105public:
105106   vboy_state(const machine_config &mconfig, device_type type, const char *tag)
106107      : driver_device(mconfig, type, tag),
107         m_maintimer(*this, "timer_main"),
108108         m_maincpu(*this, "maincpu"),
109      m_palette(*this, "palette")
109         m_cart(*this, "cartslot"),
110         m_maintimer(*this, "timer_main"),
111         m_palette(*this, "palette")
110112   {
111113      m_vip_regs.INTPND = 0;
112114      m_vip_regs.INTENB = 0;
r32469r32470
151153      m_vboy_timer.latch = 0;
152154   }
153155
154   required_device<timer_device> m_maintimer;
155156   required_device<cpu_device> m_maincpu;
157   required_device<vboy_cart_slot_device> m_cart;
158   required_device<timer_device> m_maintimer;
156159   required_device<palette_device> m_palette;
157160
158161   DECLARE_READ32_MEMBER(io_r);
159162   DECLARE_WRITE32_MEMBER(io_w);
160163   DECLARE_READ16_MEMBER(vip_r);
161164   DECLARE_WRITE16_MEMBER(vip_w);
162   DECLARE_WRITE16_MEMBER(vboy_font0_w);
163   DECLARE_WRITE16_MEMBER(vboy_font1_w);
164   DECLARE_WRITE16_MEMBER(vboy_font2_w);
165   DECLARE_WRITE16_MEMBER(vboy_font3_w);
166   DECLARE_READ16_MEMBER(vboy_font0_r);
167   DECLARE_READ16_MEMBER(vboy_font1_r);
168   DECLARE_READ16_MEMBER(vboy_font2_r);
169   DECLARE_READ16_MEMBER(vboy_font3_r);
165   DECLARE_WRITE16_MEMBER(font0_w);
166   DECLARE_WRITE16_MEMBER(font1_w);
167   DECLARE_WRITE16_MEMBER(font2_w);
168   DECLARE_WRITE16_MEMBER(font3_w);
169   DECLARE_READ16_MEMBER(font0_r);
170   DECLARE_READ16_MEMBER(font1_r);
171   DECLARE_READ16_MEMBER(font2_r);
172   DECLARE_READ16_MEMBER(font3_r);
170173   DECLARE_WRITE16_MEMBER(vboy_bgmap_w);
171174   DECLARE_READ16_MEMBER(vboy_bgmap_r);
172   DECLARE_READ8_MEMBER(vboy_lfb0_r);
173   DECLARE_READ8_MEMBER(vboy_lfb1_r);
174   DECLARE_READ8_MEMBER(vboy_rfb0_r);
175   DECLARE_READ8_MEMBER(vboy_rfb1_r);
176   DECLARE_WRITE8_MEMBER(vboy_lfb0_w);
177   DECLARE_WRITE8_MEMBER(vboy_lfb1_w);
178   DECLARE_WRITE8_MEMBER(vboy_rfb0_w);
179   DECLARE_WRITE8_MEMBER(vboy_rfb1_w);
175   DECLARE_READ8_MEMBER(lfb0_r);
176   DECLARE_READ8_MEMBER(lfb1_r);
177   DECLARE_READ8_MEMBER(rfb0_r);
178   DECLARE_READ8_MEMBER(rfb1_r);
179   DECLARE_WRITE8_MEMBER(lfb0_w);
180   DECLARE_WRITE8_MEMBER(lfb1_w);
181   DECLARE_WRITE8_MEMBER(rfb0_w);
182   DECLARE_WRITE8_MEMBER(rfb1_w);
180183   UINT16 *m_font;
181184   UINT16 *m_bgmap;
182185   UINT8 *m_l_frame_0;
r32469r32470
195198   void m_timer_tick(void);
196199   void m_scanline_tick(int scanline, UINT8 screen_type);
197200   void m_set_irq(UINT16 irq_vector);
198   UINT8 *m_nvptr;
199   UINT32 m_vboy_sram[0x10000/4];
200   device_t *m_nvimage;
201   DECLARE_READ32_MEMBER(sram_r);
202   DECLARE_WRITE32_MEMBER(sram_w);
203201
204202   void put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, UINT16 code, UINT8 pal);
205203   void fill_ovr_char(UINT16 code, UINT8 pal);
r32469r32470
220218   TIMER_DEVICE_CALLBACK_MEMBER(timer_pad_tick);
221219   TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineL);
222220   TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineR);
223   void vboy_machine_stop();
224   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vboy_cart);
225221};
226222
227223
228224void vboy_state::video_start()
229225{
230   //int i;
231
232226   // Allocate memory for temporary screens
233227   m_ovr_tempdraw_map = auto_alloc_array_clear(machine(), INT32, 0x40);
234228
r32469r32470
10311025
10321026
10331027
1034WRITE16_MEMBER( vboy_state::vboy_font0_w )
1028WRITE16_MEMBER( vboy_state::font0_w )
10351029{
10361030   WRITE_FONT(offset);
10371031}
10381032
1039WRITE16_MEMBER( vboy_state::vboy_font1_w )
1033WRITE16_MEMBER( vboy_state::font1_w )
10401034{
10411035   WRITE_FONT(offset+0x1000);
10421036}
10431037
1044WRITE16_MEMBER( vboy_state::vboy_font2_w )
1038WRITE16_MEMBER( vboy_state::font2_w )
10451039{
10461040   WRITE_FONT(offset+0x2000);
10471041}
10481042
1049WRITE16_MEMBER( vboy_state::vboy_font3_w )
1043WRITE16_MEMBER( vboy_state::font3_w )
10501044{
10511045   WRITE_FONT(offset+0x3000);
10521046}
10531047
1054READ16_MEMBER( vboy_state::vboy_font0_r )
1048READ16_MEMBER( vboy_state::font0_r )
10551049{
10561050   return READ_FONT(offset);
10571051}
10581052
1059READ16_MEMBER( vboy_state::vboy_font1_r )
1053READ16_MEMBER( vboy_state::font1_r )
10601054{
10611055   return READ_FONT(offset + 0x1000);
10621056}
10631057
1064READ16_MEMBER( vboy_state::vboy_font2_r )
1058READ16_MEMBER( vboy_state::font2_r )
10651059{
10661060   return READ_FONT(offset + 0x2000);
10671061}
10681062
1069READ16_MEMBER( vboy_state::vboy_font3_r )
1063READ16_MEMBER( vboy_state::font3_r )
10701064{
10711065   return READ_FONT(offset + 0x3000);
10721066}
r32469r32470
10811075   return m_bgmap[offset];
10821076}
10831077
1084READ8_MEMBER( vboy_state::vboy_lfb0_r ) { return m_l_frame_0[offset]; }
1085READ8_MEMBER( vboy_state::vboy_lfb1_r ) { return m_l_frame_1[offset]; }
1086READ8_MEMBER( vboy_state::vboy_rfb0_r ) { return m_r_frame_0[offset]; }
1087READ8_MEMBER( vboy_state::vboy_rfb1_r ) { return m_r_frame_1[offset]; }
1088WRITE8_MEMBER( vboy_state::vboy_lfb0_w ) { m_l_frame_0[offset] = data; }
1089WRITE8_MEMBER( vboy_state::vboy_lfb1_w ) { m_l_frame_1[offset] = data; }
1090WRITE8_MEMBER( vboy_state::vboy_rfb0_w ) { m_r_frame_0[offset] = data; }
1091WRITE8_MEMBER( vboy_state::vboy_rfb1_w ) { m_r_frame_1[offset] = data; }
1078READ8_MEMBER( vboy_state::lfb0_r ) { return m_l_frame_0[offset]; }
1079READ8_MEMBER( vboy_state::lfb1_r ) { return m_l_frame_1[offset]; }
1080READ8_MEMBER( vboy_state::rfb0_r ) { return m_r_frame_0[offset]; }
1081READ8_MEMBER( vboy_state::rfb1_r ) { return m_r_frame_1[offset]; }
1082WRITE8_MEMBER( vboy_state::lfb0_w ) { m_l_frame_0[offset] = data; }
1083WRITE8_MEMBER( vboy_state::lfb1_w ) { m_l_frame_1[offset] = data; }
1084WRITE8_MEMBER( vboy_state::rfb0_w ) { m_r_frame_0[offset] = data; }
1085WRITE8_MEMBER( vboy_state::rfb1_w ) { m_r_frame_1[offset] = data; }
10921086
10931087
10941088static ADDRESS_MAP_START( vboy_mem, AS_PROGRAM, 32, vboy_state )
10951089   ADDRESS_MAP_GLOBAL_MASK(0x07ffffff)
1096   AM_RANGE( 0x00000000, 0x00005fff ) AM_READWRITE8(vboy_lfb0_r,vboy_lfb0_w,0xffffffff) // L frame buffer 0
1097   AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511
1098   AM_RANGE( 0x00008000, 0x0000dfff ) AM_READWRITE8(vboy_lfb1_r,vboy_lfb1_w,0xffffffff) // L frame buffer 1
1099   AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023
1100   AM_RANGE( 0x00010000, 0x00015fff ) AM_READWRITE8(vboy_rfb0_r,vboy_rfb0_w,0xffffffff)  // R frame buffer 0
1101   AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535
1102   AM_RANGE( 0x00018000, 0x0001dfff ) AM_READWRITE8(vboy_rfb1_r,vboy_rfb1_w,0xffffffff)  // R frame buffer 1
1103   AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047
1090   AM_RANGE( 0x00000000, 0x00005fff ) AM_READWRITE8(lfb0_r, lfb0_w,0xffffffff) // L frame buffer 0
1091   AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511
1092   AM_RANGE( 0x00008000, 0x0000dfff ) AM_READWRITE8(lfb1_r, lfb1_w,0xffffffff) // L frame buffer 1
1093   AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023
1094   AM_RANGE( 0x00010000, 0x00015fff ) AM_READWRITE8(rfb0_r, rfb0_w,0xffffffff)  // R frame buffer 0
1095   AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535
1096   AM_RANGE( 0x00018000, 0x0001dfff ) AM_READWRITE8(rfb1_r, rfb1_w,0xffffffff)  // R frame buffer 1
1097   AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047
11041098
11051099   AM_RANGE( 0x00020000, 0x0003ffff ) AM_READWRITE16(vboy_bgmap_r,vboy_bgmap_w, 0xffffffff) // VIPC memory
11061100
11071101   //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC
11081102   AM_RANGE( 0x0005f800, 0x0005f87f ) AM_READWRITE16(vip_r, vip_w, 0xffffffff)
11091103
1110   AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511 mirror
1111   AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023 mirror
1112   AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 mirror
1113   AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 mirror
1104   AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 mirror
1105   AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 mirror
1106   AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 mirror
1107   AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 mirror
11141108
11151109   AM_RANGE( 0x01000000, 0x010005ff ) AM_DEVREADWRITE8("vbsnd", vboysnd_device, read, write, 0xffffffff)
11161110   AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(io_r, io_w) // Hardware control registers mask 0xff
11171111   //AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area
11181112   AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM AM_SHARE("wram")// Main RAM - 64K mask 0xffff
1119//  AM_RANGE( 0x06000000, 0x06003fff ) AM_RAM AM_SHARE("nvram") // Cart RAM - 8K NVRAM
1120   AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_ROM AM_REGION("cartridge", 0) /* ROM */
1113   AM_RANGE( 0x06000000, 0x06003fff ) AM_DEVREADWRITE("cartslot", vboy_cart_slot_device, read_eeprom, write_eeprom) // Cart RAM - 8K NVRAM
1114   AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */
11211115ADDRESS_MAP_END
11221116
11231117static ADDRESS_MAP_START( vboy_io, AS_IO, 32, vboy_state )
11241118   ADDRESS_MAP_GLOBAL_MASK(0x07ffffff)
11251119   AM_RANGE( 0x00000000, 0x00005fff ) AM_RAM AM_SHARE("l_frame_0") // L frame buffer 0
1126   AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511
1120   AM_RANGE( 0x00006000, 0x00007fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511
11271121   AM_RANGE( 0x00008000, 0x0000dfff ) AM_RAM AM_SHARE("l_frame_1") // L frame buffer 1
1128   AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023
1122   AM_RANGE( 0x0000e000, 0x0000ffff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023
11291123   AM_RANGE( 0x00010000, 0x00015fff ) AM_RAM AM_SHARE("r_frame_0") // R frame buffer 0
1130   AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535
1124   AM_RANGE( 0x00016000, 0x00017fff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535
11311125   AM_RANGE( 0x00018000, 0x0001dfff ) AM_RAM AM_SHARE("r_frame_1") // R frame buffer 1
1132   AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047
1126   AM_RANGE( 0x0001e000, 0x0001ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047
11331127
11341128   AM_RANGE( 0x00020000, 0x0003ffff ) AM_READWRITE16(vboy_bgmap_r,vboy_bgmap_w, 0xffffffff) // VIPC memory
11351129
11361130   //AM_RANGE( 0x00040000, 0x0005ffff ) AM_RAM // VIPC
11371131   AM_RANGE( 0x0005f800, 0x0005f87f ) AM_READWRITE16(vip_r, vip_w, 0xffffffff)
11381132
1139   AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(vboy_font0_r, vboy_font0_w, 0xffffffff) // Font 0-511 mirror
1140   AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(vboy_font1_r, vboy_font1_w, 0xffffffff) // Font 512-1023 mirror
1141   AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(vboy_font2_r, vboy_font2_w, 0xffffffff) // Font 1024-1535 mirror
1142   AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(vboy_font3_r, vboy_font3_w, 0xffffffff) // Font 1536-2047 mirror
1133   AM_RANGE( 0x00078000, 0x00079fff ) AM_READWRITE16(font0_r, font0_w, 0xffffffff) // Font 0-511 mirror
1134   AM_RANGE( 0x0007a000, 0x0007bfff ) AM_READWRITE16(font1_r, font1_w, 0xffffffff) // Font 512-1023 mirror
1135   AM_RANGE( 0x0007c000, 0x0007dfff ) AM_READWRITE16(font2_r, font2_w, 0xffffffff) // Font 1024-1535 mirror
1136   AM_RANGE( 0x0007e000, 0x0007ffff ) AM_READWRITE16(font3_r, font3_w, 0xffffffff) // Font 1536-2047 mirror
11431137
11441138   AM_RANGE( 0x01000000, 0x010005ff ) AM_DEVREADWRITE8("vbsnd", vboysnd_device, read, write, 0xffffffff)
11451139   AM_RANGE( 0x02000000, 0x0200002b ) AM_MIRROR(0x0ffff00) AM_READWRITE(io_r, io_w) // Hardware control registers mask 0xff
11461140//  AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area
11471141   AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM AM_SHARE("wram") // Main RAM - 64K mask 0xffff
1148   AM_RANGE( 0x06000000, 0x06003fff ) AM_RAM AM_SHARE("nvram") // Cart RAM - 8K NVRAM
1149   AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_ROM AM_REGION("cartridge", 0) /* ROM */
1142   AM_RANGE( 0x06000000, 0x06003fff ) AM_NOP // Cart RAM - 8K NVRAM ?
1143   AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */
11501144ADDRESS_MAP_END
11511145
11521146/* Input ports */
r32469r32470
11701164   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // Battery low
11711165INPUT_PORTS_END
11721166
1173void vboy_state::vboy_machine_stop()
1174{
1175   // only do this if the cart loader detected some form of backup
1176   if (m_nvptr != NULL)
1177   {
1178      device_image_interface *image = dynamic_cast<device_image_interface *>(m_nvimage);
1179      image->battery_save(m_nvptr, 0x10000);
1180   }
1181}
11821167
11831168void vboy_state::machine_start()
11841169{
1185   /* add a hook for battery save */
1186   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(vboy_state::vboy_machine_stop),this));
1187
1188//  m_vboy_sram = auto_alloc_array(machine(), UINT32, 0x10000/4);
1170   if (m_cart->exists())
1171      m_cart->save_eeprom();
11891172}
11901173
11911174void vboy_state::machine_reset()
r32469r32470
13391322#endif
13401323
13411324
1325static SLOT_INTERFACE_START(vboy_cart)
1326   SLOT_INTERFACE_INTERNAL("vb_rom",    VBOY_ROM_STD)
1327   SLOT_INTERFACE_INTERNAL("vb_eeprom", VBOY_ROM_EEPROM)
1328SLOT_INTERFACE_END
13421329
1343READ32_MEMBER(vboy_state::sram_r)
1344{
1345   return m_vboy_sram[offset];
1346}
1347
1348WRITE32_MEMBER(vboy_state::sram_w)
1349{
1350   COMBINE_DATA(&m_vboy_sram[offset]);
1351}
1352
1353
1354DEVICE_IMAGE_LOAD_MEMBER( vboy_state, vboy_cart )
1355{
1356   UINT32 chip = 0;
1357   UINT8 *ROM = memregion("cartridge")->base();
1358   UINT32 cart_size;
1359
1360   m_nvptr = (UINT8 *)NULL;
1361   if (image.software_entry() == NULL)
1362   {
1363      cart_size = image.length();
1364      image.fread(ROM, cart_size);
1365      switch (cart_size)
1366      {
1367         case 0x001000:
1368            memcpy(ROM + 0x001000, ROM, 0x001000);
1369         case 0x002000:
1370            memcpy(ROM + 0x002000, ROM, 0x002000);
1371         case 0x004000:
1372            memcpy(ROM + 0x004000, ROM, 0x004000);
1373         case 0x008000:
1374            memcpy(ROM + 0x008000, ROM, 0x008000);
1375         case 0x010000:
1376            memcpy(ROM + 0x010000, ROM, 0x010000);
1377         case 0x020000:
1378            memcpy(ROM + 0x020000, ROM, 0x020000);
1379         case 0x040000:
1380            memcpy(ROM + 0x040000, ROM, 0x040000);
1381         case 0x080000:
1382            memcpy(ROM + 0x080000, ROM, 0x080000);
1383         case 0x100000:
1384            memcpy(ROM + 0x100000, ROM, 0x100000);
1385         default:
1386            break;
1387      }
1388   }
1389   else
1390   {
1391      cart_size = image.get_software_region_length("rom");
1392      memcpy(ROM, image.get_software_region("rom"), cart_size);
1393
1394      UINT8 *tmp_eeprom = image.get_software_region("eeprom");
1395      if (tmp_eeprom)
1396         chip = 1;
1397   }
1398
1399   if (chip)
1400   {
1401      m_nvptr = (UINT8 *)&m_vboy_sram;
1402
1403      m_maincpu->space(AS_PROGRAM).install_read_handler(0x06000000, 0x0600ffff, read32_delegate(FUNC(vboy_state::sram_r),this));
1404      m_maincpu->space(AS_PROGRAM).install_write_handler(0x06000000, 0x0600ffff, write32_delegate(FUNC(vboy_state::sram_w),this));
1405
1406      image.battery_load(m_nvptr, 0x10000, 0x00);
1407      m_nvimage = image;
1408   }
1409   else
1410   {
1411      m_nvimage = NULL;
1412   }
1413
1414   return IMAGE_INIT_PASS;
1415}
1416
14171330static MACHINE_CONFIG_START( vboy, vboy_state )
14181331
14191332   /* basic machine hardware */
r32469r32470
14231336   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer_l", vboy_state, vboy_scanlineL, "3dleft", 0, 1)
14241337   //MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer_r", vboy_state, vboy_scanlineR, "3dright", 0, 1)
14251338
1426
14271339   // programmable timer
14281340   MCFG_TIMER_DRIVER_ADD("timer_main", vboy_state, timer_main_tick)
14291341
r32469r32470
14481360   MCFG_SCREEN_PALETTE("palette")
14491361
14501362   /* cartridge */
1451   MCFG_CARTSLOT_ADD("cart")
1452   MCFG_CARTSLOT_EXTENSION_LIST("vb,bin")
1453   MCFG_CARTSLOT_MANDATORY
1454   MCFG_CARTSLOT_INTERFACE("vboy_cart")
1455   MCFG_CARTSLOT_LOAD(vboy_state, vboy_cart)
1363   MCFG_VBOY_CARTRIDGE_ADD("cartslot", vboy_cart, NULL)
14561364
14571365   /* software lists */
14581366   MCFG_SOFTWARE_LIST_ADD("cart_list","vboy")
r32469r32470
14661374
14671375/* ROM definition */
14681376ROM_START( vboy )
1469   ROM_REGION( 0x2000000, "cartridge", ROMREGION_ERASEFF )
1377   ROM_REGION( 0x2000000, "maincpu", ROMREGION_ERASEFF )
14701378ROM_END
14711379
14721380/* Driver */
trunk/src/mess/drivers/scv.c
r32469r32470
22
33    Driver for Epoch Super Cassette Vision
44
5
65***************************************************************************/
76
87#include "emu.h"
98#include "cpu/upd7810/upd7810.h"
10#include "imagedev/cartslot.h"
119#include "audio/upd1771.h"
10#include "bus/scv/slot.h"
11#include "bus/scv/rom.h"
1212
1313
1414class scv_state : public driver_device
r32469r32470
1717   scv_state(const machine_config &mconfig, device_type type, const char *tag)
1818      : driver_device(mconfig, type, tag),
1919      m_videoram(*this,"videoram"),
20      m_cart_rom_size(0),
21      m_cart_ram(NULL),
22      m_cart_ram_size(0),
2320      m_maincpu(*this, "maincpu"),
2421      m_upd1771c(*this, "upd1771c"),
22      m_cart(*this, "cartslot"),
23      m_pa(*this, "PA"),
2524      m_pc0(*this, "PC0"),
26      m_bank0(*this, "bank0"),
27      m_bank1(*this, "bank1"),
28      m_bank2(*this, "bank2"),
29      m_bank3(*this, "bank3"),
30      m_bank4(*this, "bank4"),
3125      m_charrom(*this, "charrom") { }
3226
33   DECLARE_WRITE8_MEMBER(scv_porta_w);
34   DECLARE_READ8_MEMBER(scv_portb_r);
35   DECLARE_READ8_MEMBER(scv_portc_r);
36   DECLARE_WRITE8_MEMBER(scv_portc_w);
37   DECLARE_WRITE8_MEMBER(scv_cart_ram_w);
38   DECLARE_WRITE8_MEMBER(scv_cart_ram2_w);
39   DECLARE_WRITE_LINE_MEMBER(scv_upd1771_ack_w);
27   DECLARE_WRITE8_MEMBER(porta_w);
28   DECLARE_READ8_MEMBER(portb_r);
29   DECLARE_READ8_MEMBER(portc_r);
30   DECLARE_WRITE8_MEMBER(portc_w);
31   DECLARE_WRITE_LINE_MEMBER(upd1771_ack_w);
4032   required_shared_ptr<UINT8> m_videoram;
4133   UINT8 m_porta;
4234   UINT8 m_portc;
4335   emu_timer *m_vb_timer;
44   UINT8 *m_cart_rom;
45   UINT32 m_cart_rom_size;
46   UINT8 *m_cart_ram;
47   UINT32 m_cart_ram_size;
48   bool m_cart_ram_enabled;
4936   virtual void machine_start();
5037   virtual void machine_reset();
5138   DECLARE_PALETTE_INIT(scv);
52   void scv_postload();
5339   UINT32 screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
54   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( scv_cart );
5540
5641protected:
5742   enum
r32469r32470
6146
6247   required_device<cpu_device> m_maincpu;
6348   required_device<upd1771c_device> m_upd1771c;
49   required_device<scv_cart_slot_device> m_cart;
50   required_ioport_array<8> m_pa;
6451   required_ioport m_pc0;
65   required_memory_bank m_bank0;
66   required_memory_bank m_bank1;
67   required_memory_bank m_bank2;
68   required_memory_bank m_bank3;
69   required_memory_bank m_bank4;
7052   required_memory_region m_charrom;
7153
7254   ioport_port *m_key[8];
r32469r32470
8264
8365
8466static ADDRESS_MAP_START( scv_mem, AS_PROGRAM, 8, scv_state )
85   AM_RANGE( 0x0000, 0x0fff ) AM_ROM       /* BIOS */
67   AM_RANGE( 0x0000, 0x0fff ) AM_ROM   // BIOS
8668
87   AM_RANGE( 0x2000, 0x3403 ) AM_RAM AM_SHARE("videoram")  /* VRAM + 4 registers */
88
69   AM_RANGE( 0x2000, 0x3403 ) AM_RAM AM_SHARE("videoram")  // VRAM + 4 registers
8970   AM_RANGE( 0x3600, 0x3600 ) AM_DEVWRITE("upd1771c", upd1771c_device, write)
9071
91   AM_RANGE( 0x8000, 0x9fff ) AM_ROMBANK("bank0")
92   AM_RANGE( 0xa000, 0xbfff ) AM_ROMBANK("bank1")
93   AM_RANGE( 0xc000, 0xdfff ) AM_ROMBANK("bank2")
94   AM_RANGE( 0xe000, 0xefff ) AM_READ_BANK("bank3")    AM_WRITE( scv_cart_ram_w )
95   AM_RANGE( 0xf000, 0xff7f ) AM_READ_BANK("bank4")    AM_WRITE( scv_cart_ram2_w )
96   AM_RANGE( 0xff80, 0xffff ) AM_RAM       /* upd7801 internal RAM */
72   AM_RANGE( 0x8000, 0xff7f ) AM_DEVREADWRITE("cartslot", scv_cart_slot_device, read_cart, write_cart)   // cartridge
73   AM_RANGE( 0xff80, 0xffff ) AM_RAM   // upd7801 internal RAM
9774ADDRESS_MAP_END
9875
9976
10077static ADDRESS_MAP_START( scv_io, AS_IO, 8, scv_state )
101   AM_RANGE( 0x00, 0x00 ) AM_WRITE( scv_porta_w )
102   AM_RANGE( 0x01, 0x01 ) AM_READ( scv_portb_r )
103   AM_RANGE( 0x02, 0x02 ) AM_READWRITE( scv_portc_r, scv_portc_w )
78   AM_RANGE( 0x00, 0x00 ) AM_WRITE(porta_w)
79   AM_RANGE( 0x01, 0x01 ) AM_READ(portb_r)
80   AM_RANGE( 0x02, 0x02 ) AM_READWRITE(portc_r, portc_w)
10481ADDRESS_MAP_END
10582
10683
10784static INPUT_PORTS_START( scv )
108   PORT_START( "PA0" )
85   PORT_START( "PA.0" )
10986   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
11087   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
11188   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
r32469r32470
11592   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
11693   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
11794
118   PORT_START( "PA1" )
95   PORT_START( "PA.1" )
11996   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
12097   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
12198   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r32469r32470
125102   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
126103   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
127104
128   PORT_START( "PA2" )
105   PORT_START( "PA.2" )
129106   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
130107   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
131108   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r32469r32470
135112   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD)
136113   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)
137114
138   PORT_START( "PA3" )
115   PORT_START( "PA.3" )
139116   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
140117   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
141118   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r32469r32470
145122   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)
146123   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD)
147124
148   PORT_START( "PA4" )
125   PORT_START( "PA.4" )
149126   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
150127   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
151128   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r32469r32470
155132   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD)
156133   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD)
157134
158   PORT_START( "PA5" )
135   PORT_START( "PA.5" )
159136   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
160137   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
161138   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r32469r32470
165142   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)
166143   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD)
167144
168   PORT_START( "PA6" )
145   PORT_START( "PA.6" )
169146   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
170147   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
171148   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r32469r32470
175152   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD)
176153   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD)
177154
178   PORT_START( "PA7" )
155   PORT_START( "PA.7" )
179156   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
180157   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
181158   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r32469r32470
190167INPUT_PORTS_END
191168
192169
193WRITE8_MEMBER( scv_state::scv_cart_ram_w )
170WRITE8_MEMBER( scv_state::porta_w )
194171{
195   /* Check if cartridge ram is enabled */
196   if ( m_cart_ram_enabled )
197   {
198      m_cart_ram[offset] = data;
199   }
200}
201
202
203WRITE8_MEMBER( scv_state::scv_cart_ram2_w )
204{
205   /* Check if cartridge ram is enabled */
206   if ( m_cart_ram_enabled )
207   {
208      if ( m_cart_ram_size > 0x1000 )
209      {
210         offset += 0x1000;
211      }
212
213      m_cart_ram[offset] = data;
214   }
215}
216
217
218WRITE8_MEMBER( scv_state::scv_porta_w )
219{
220172   m_porta = data;
221173}
222174
223175
224READ8_MEMBER( scv_state::scv_portb_r )
176READ8_MEMBER( scv_state::portb_r )
225177{
226178   UINT8 data = 0xff;
227179
228180   for (int i = 0; i < 8; i++)
229181   {
230182      if (!BIT(m_porta, i))
231         data &= m_key[i]->read();
183         data &= m_pa[i]->read();
232184   }
233185
234186   return data;
235187}
236188
237189
238READ8_MEMBER( scv_state::scv_portc_r )
190READ8_MEMBER( scv_state::portc_r )
239191{
240192   UINT8 data = m_portc;
241193
r32469r32470
245197}
246198
247199
248void scv_state::scv_set_banks()
200WRITE8_MEMBER( scv_state::portc_w )
249201{
250   m_cart_ram_enabled = false;
251
252   switch( m_cart_rom_size )
253   {
254   case 0:
255   case 0x2000:
256      m_bank0->set_base( m_cart_rom );
257      m_bank1->set_base( m_cart_rom );
258      m_bank2->set_base( m_cart_rom );
259      m_bank3->set_base( m_cart_rom );
260      m_bank4->set_base( m_cart_rom + 0x1000 );
261      break;
262   case 0x4000:
263      m_bank0->set_base( m_cart_rom );
264      m_bank1->set_base( m_cart_rom + 0x2000 );
265      m_bank2->set_base( m_cart_rom );
266      m_bank3->set_base( m_cart_rom + 0x2000 );
267      m_bank4->set_base( m_cart_rom + 0x3000 );
268      break;
269   case 0x8000:
270      m_bank0->set_base( m_cart_rom );
271      m_bank1->set_base( m_cart_rom + 0x2000 );
272      m_bank2->set_base( m_cart_rom + 0x4000 );
273      m_bank3->set_base( m_cart_rom + 0x6000 );
274      m_bank4->set_base( m_cart_rom + 0x7000 );
275      break;
276   case 0x10000:
277      m_bank0->set_base( m_cart_rom + ( ( m_portc & 0x20 ) ? 0x8000 : 0 ) );
278      m_bank1->set_base( m_cart_rom + ( ( m_portc & 0x20 ) ? 0xa000 : 0x2000 ) );
279      m_bank2->set_base( m_cart_rom + ( ( m_portc & 0x20 ) ? 0xc000 : 0x4000 ) );
280      m_bank3->set_base( m_cart_rom + ( ( m_portc & 0x20 ) ? 0xe000 : 0x6000 ) );
281      m_bank4->set_base( m_cart_rom + ( ( m_portc & 0x20 ) ? 0xf000 : 0x7000 ) );
282      break;
283   case 0x20000:   /* Pole Position 2 */
284      int base = ( ( m_portc >> 5 ) & 0x03 ) * 0x8000 ;
285      m_bank0->set_base( m_cart_rom + base + 0 );
286      m_bank1->set_base( m_cart_rom + base + 0x2000 );
287      m_bank2->set_base( m_cart_rom + base + 0x4000 );
288      m_bank3->set_base( m_cart_rom + base + 0x6000 );
289      m_bank4->set_base( m_cart_rom + base + 0x7000 );
290      /* On-cart RAM is enabled when PC6 is high */
291      if ( m_cart_ram && m_portc & 0x40 )
292      {
293         m_cart_ram_enabled = true;
294         m_bank4->set_base( m_cart_ram );
295      }
296      break;
297   }
298
299   /* Check if cartridge RAM is available and should be enabled */
300   if ( m_cart_rom_size < 0x20000 && m_cart_ram && m_cart_ram_size && ( m_portc & 0x20 ) )
301   {
302      if ( m_cart_ram_size == 0x1000 )
303      {
304         m_bank4->set_base( m_cart_ram );
305      }
306      else
307      {
308         m_bank3->set_base( m_cart_ram );
309         m_bank4->set_base( m_cart_ram + 0x1000 );
310      }
311      m_cart_ram_enabled = true;
312   }
313
314}
315
316
317WRITE8_MEMBER( scv_state::scv_portc_w )
318{
319202   //logerror("%04x: scv_portc_w: data = 0x%02x\n", m_maincpu->pc(), data );
320203   m_portc = data;
321
322   scv_set_banks();
204   m_cart->write_bank(space, 0, m_portc);
323205   m_upd1771c->pcm_write(m_portc & 0x08);
324206}
325207
326208
327DEVICE_IMAGE_LOAD_MEMBER( scv_state, scv_cart )
328{
329   UINT8 *cart = memregion( "cart" )->base();
330
331   if ( image.software_entry() == NULL )
332   {
333      int size = image.length();
334
335      if ( size > memregion( "cart" )->bytes() )
336      {
337         image.seterror( IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size" );
338         return IMAGE_INIT_FAIL;
339      }
340
341      if ( image.fread( cart, size ) != size )
342      {
343         image.seterror( IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file" );
344         return IMAGE_INIT_FAIL;
345      }
346
347      m_cart_rom_size = size;
348   }
349   else
350   {
351      m_cart_rom_size = image.get_software_region_length( "rom" );
352      memcpy( cart, image.get_software_region( "rom" ), m_cart_rom_size );
353      m_cart_ram_size = image.get_software_region_length( "ram" );
354      if ( m_cart_ram_size > 0 )
355      {
356         m_cart_ram = auto_alloc_array_clear( machine(), UINT8, m_cart_ram_size );
357         save_pointer(NAME(m_cart_ram), m_cart_ram_size);
358      }
359   }
360
361   return IMAGE_INIT_PASS;
362}
363
364
365209PALETTE_INIT_MEMBER(scv_state, scv)
366210{
367211   /*
r32469r32470
758602}
759603
760604
761WRITE_LINE_MEMBER( scv_state::scv_upd1771_ack_w )
605WRITE_LINE_MEMBER( scv_state::upd1771_ack_w )
762606{
763607   m_maincpu->set_input_line(UPD7810_INTF1, (state) ? ASSERT_LINE : CLEAR_LINE);
764608}
765609
766void scv_state::scv_postload()
767{
768   scv_set_banks();
769}
770
771
772610void scv_state::machine_start()
773611{
774   m_cart_rom = memregion( "cart" )->base();
775612   m_vb_timer = timer_alloc(TIMER_VB);
776613
777   for (int i = 0; i < 8; i++)
778   {
779      char str[4];
780      sprintf(str, "PA%i", i);
781      m_key[i] = ioport(str);
782   }
783
784614   save_item(NAME(m_porta));
785615   save_item(NAME(m_portc));
786   save_item(NAME(m_cart_ram_enabled));
616   if (m_cart->exists())
617      m_cart->save_ram();
787618
788   machine().save().register_postload(save_prepost_delegate(FUNC(scv_state::scv_postload), this));
789619}
790620
791621
792622void scv_state::machine_reset()
793623{
794624   m_vb_timer->adjust(machine().first_screen()->time_until_pos(0, 0));
795   scv_set_banks();
796625}
797626
798627
r32469r32470
815644GFXDECODE_END
816645
817646
647static SLOT_INTERFACE_START(scv_cart)
648   SLOT_INTERFACE_INTERNAL("rom8k",       SCV_ROM8K)
649   SLOT_INTERFACE_INTERNAL("rom16k",      SCV_ROM16K)
650   SLOT_INTERFACE_INTERNAL("rom32k",      SCV_ROM32K)
651   SLOT_INTERFACE_INTERNAL("rom32k_ram",  SCV_ROM32K_RAM8K)
652   SLOT_INTERFACE_INTERNAL("rom64k",      SCV_ROM64K)
653   SLOT_INTERFACE_INTERNAL("rom128k",     SCV_ROM128K)
654   SLOT_INTERFACE_INTERNAL("rom128k_ram", SCV_ROM128K_RAM4K)
655SLOT_INTERFACE_END
656
818657static MACHINE_CONFIG_START( scv, scv_state )
819658
820659   MCFG_CPU_ADD( "maincpu", UPD7801, XTAL_4MHz )
821660   MCFG_CPU_PROGRAM_MAP( scv_mem )
822661   MCFG_CPU_IO_MAP( scv_io )
823662
824
825663   /* Video chip is EPOCH TV-1 */
826664   MCFG_SCREEN_ADD( "screen", RASTER )
827665   MCFG_SCREEN_RAW_PARAMS( XTAL_14_31818MHz/2, 456, 24, 24+192, 262, 23, 23+222 )  /* TODO: Verify */
r32469r32470
835673   /* Sound is generated by UPD1771C clocked at XTAL_6MHz */
836674   MCFG_SPEAKER_STANDARD_MONO("mono")
837675   MCFG_SOUND_ADD( "upd1771c", UPD1771C, XTAL_6MHz )
838   MCFG_UPD1771_ACK_HANDLER(WRITELINE(scv_state, scv_upd1771_ack_w))
676   MCFG_UPD1771_ACK_HANDLER(WRITELINE(scv_state, upd1771_ack_w))
839677   MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
840678
841   MCFG_CARTSLOT_ADD( "cart" )
842   MCFG_CARTSLOT_EXTENSION_LIST( "bin" )
843   MCFG_CARTSLOT_NOT_MANDATORY
844   MCFG_CARTSLOT_INTERFACE("scv_cart")
845   MCFG_CARTSLOT_LOAD( scv_state, scv_cart )
679   MCFG_SCV_CARTRIDGE_ADD("cartslot", scv_cart, NULL)
846680
847681   /* Software lists */
848682   MCFG_SOFTWARE_LIST_ADD("cart_list","scv")
r32469r32470
850684
851685
852686static MACHINE_CONFIG_DERIVED( scv_pal, scv )
853
854687   MCFG_CPU_MODIFY( "maincpu" )
855688   MCFG_CPU_CLOCK( 3780000 )
856689
r32469r32470
864697ROM_START( scv )
865698   ROM_REGION( 0x1000, "maincpu", 0 )
866699   ROM_LOAD( "upd7801g.s01", 0, 0x1000, CRC(7ac06182) SHA1(6e89d1227581c76441a53d605f9e324185f1da33) )
700
867701   ROM_REGION( 0x400, "charrom", 0 )
868702   ROM_LOAD( "epochtv.chr", 0, 0x400, BAD_DUMP CRC(db521533) SHA1(40b4e44838c35191f115437a14f200f052e71509) )
869
870   ROM_REGION( 0x20000, "cart", ROMREGION_ERASEFF )
871703ROM_END
872704
873705
874706ROM_START( scv_pal )
875707   ROM_REGION( 0x1000, "maincpu", 0 )
876708   ROM_LOAD( "upd7801g.s01", 0, 0x1000, CRC(7ac06182) SHA1(6e89d1227581c76441a53d605f9e324185f1da33) )
709
877710   ROM_REGION( 0x400, "charrom", 0 )
878711   ROM_LOAD( "epochtv.chr", 0, 0x400, BAD_DUMP CRC(db521533) SHA1(40b4e44838c35191f115437a14f200f052e71509) )
879
880   ROM_REGION( 0x20000, "cart", ROMREGION_ERASEFF )
881712ROM_END
882713
883714
trunk/src/mess/mess.mak
r32469r32470
612612BUSES += S100
613613BUSES += SATURN
614614BUSES += SCSI
615BUSES += SCV
615616BUSES += SEGA8
616617BUSES += SMS_CTRL
617618BUSES += SMS_EXP
618619BUSES += SNES
619620BUSES += TI99PEB
620621BUSES += TVC
622BUSES += VBOY
621623BUSES += VCS
622624BUSES += VCS_CTRL
623625BUSES += VIC10

Previous 199869 Revisions Next


© 1997-2024 The MAME Team