Previous 199869 Revisions Next

r32493 Thursday 2nd October, 2014 at 12:07:03 UTC by Fabio Priuli
(MESS) converted channelf and apfm1000/apfimag to use slot devices for
their carts. this allows to remove on-cart RAM from the driver class (since it
does not belong there). also added (partial) support for Channel F multicart.
nw.
[hash]apfm1000.xml channelf.xml
[src/emu/bus]bus.mak
[src/emu/bus/apf]rom.c* rom.h* slot.c* slot.h*
[src/emu/bus/chanf]rom.c* rom.h* slot.c* slot.h*
[src/mess]mess.mak
[src/mess/drivers]apf.c channelf.c
[src/mess/includes]channelf.h

trunk/hash/channelf.xml
r32492r32493
88      <publisher>Fairchild</publisher>
99      <info name="series" value="Democart 1" />
1010      <part name="cart" interface="channelf_cart">
11         <feature name="slot" value="std" />
1112         <dataarea name="rom" size="2048">
1213            <rom name="democrt1.bin" size="2048" crc="42727ad5" sha1="e462e594c14cdb10ddc4c263b74e753316c3b358" offset="0" />
1314         </dataarea>
r32492r32493
2021      <publisher>Fairchild</publisher>
2122      <info name="series" value="Democart 2" />
2223      <part name="cart" interface="channelf_cart">
24         <feature name="slot" value="std" />
2325         <dataarea name="rom" size="2048">
2426            <rom name="democrt2.bin" size="2048" crc="44cf1d89" sha1="13a5ca0471e6f4a7a5a2fc4d2b8f881516a28ec4" offset="0" />
2527         </dataarea>
r32492r32493
3234      <publisher>Fairchild</publisher>
3335      <info name="series" value="Videocart 1" />
3436      <part name="cart" interface="channelf_cart">
37         <feature name="slot" value="std" />
3538         <dataarea name="rom" size="2048">
3639            <rom name="tctactoe.bin" size="2048" crc="ff4768b0" sha1="8edfb668b3eb759f8597fb13b1aeaf43aaf53680" offset="0" />
3740         </dataarea>
r32492r32493
4447      <publisher>SABA</publisher>
4548      <info name="series" value="Videocart 1" />
4649      <part name="cart" interface="channelf_cart">
50         <feature name="slot" value="std" />
4751         <dataarea name="rom" size="2048">
4852            <rom name="muehle.bin" size="2048" crc="7124dc59" sha1="15d5e6d152d93a2099b97a2bd5dcf7134dd1a770" offset="0" />
4953         </dataarea>
r32492r32493
5660      <publisher>Fairchild</publisher>
5761      <info name="series" value="Videocart 2" />
5862      <part name="cart" interface="channelf_cart">
63         <feature name="slot" value="std" />
5964         <dataarea name="rom" size="2048">
6065            <rom name="dsrtfox.bin" size="2048" crc="1570934b" sha1="3440928903f39354e1358018cebf12a00c8dff77" offset="0" />
6166         </dataarea>
r32492r32493
6873      <publisher>Fairchild</publisher>
6974      <info name="series" value="Videocart 3" />
7075      <part name="cart" interface="channelf_cart">
76         <feature name="slot" value="std" />
7177         <dataarea name="rom" size="2048">
7278            <rom name="vblckjck.bin" size="2048" crc="e98d4456" sha1="86579196567c9686009ad271263269181496a9c7" offset="0" />
7379         </dataarea>
r32492r32493
8086      <publisher>Fairchild</publisher>
8187      <info name="series" value="Videocart 4" />
8288      <part name="cart" interface="channelf_cart">
89         <feature name="slot" value="std" />
8390         <dataarea name="rom" size="2048">
8491            <rom name="spitfire.bin" size="2048" crc="5357c5f6" sha1="9af18e7fa3b2d040f33cbe2286392ce5fe31d0df" offset="0" />
8592         </dataarea>
r32492r32493
9198      <year>1976</year>
9299      <publisher>Fairchild</publisher>
93100      <part name="cart" interface="channelf_cart">
101         <feature name="slot" value="std" />
94102         <dataarea name="rom" size="2048">
95103            <rom name="spitfire (proto).bin" size="2048" crc="0a728afc" sha1="66e2d158095721c0c9b4d50de4a6d9925ec62c73" offset="0" />
96104         </dataarea>
r32492r32493
103111      <publisher>Fairchild</publisher>
104112      <info name="series" value="Videocart 5" />
105113      <part name="cart" interface="channelf_cart">
114         <feature name="slot" value="std" />
106115         <dataarea name="rom" size="2048">
107116            <rom name="spacewar.bin" size="2048" crc="22ef49e8" sha1="c1d83b1e89d11465456bd5829a85db06c4ef322f" offset="0" />
108117         </dataarea>
r32492r32493
115124      <publisher>Fairchild</publisher>
116125      <info name="series" value="Videocart 6" />
117126      <part name="cart" interface="channelf_cart">
127         <feature name="slot" value="std" />
118128         <dataarea name="rom" size="2048">
119129            <rom name="mthquiz1.bin" size="2048" crc="bb4c24a2" sha1="f0bfdc8f6beed2ef54add820c5e164005d2d1d25" offset="0" />
120130         </dataarea>
r32492r32493
127137      <publisher>Fairchild</publisher>
128138      <info name="series" value="Videocart 7" />
129139      <part name="cart" interface="channelf_cart">
140         <feature name="slot" value="std" />
130141         <dataarea name="rom" size="2048">
131142            <rom name="mthquiz2.bin" size="2048" crc="4aa7ea97" sha1="4c643e00f32629c066e778be92f37e3f7bfd1ad6" offset="0" />
132143         </dataarea>
r32492r32493
139150      <publisher>Fairchild</publisher>
140151      <info name="series" value="Videocart 8" />
141152      <part name="cart" interface="channelf_cart">
153         <feature name="slot" value="std" />
142154         <dataarea name="rom" size="2048">
143155            <rom name="magicnum.bin" size="2048" crc="24da0529" sha1="4b696a4f8a20f6dcd6a4ba690756d862956515a4" offset="0" />
144156         </dataarea>
r32492r32493
151163      <publisher>Fairchild</publisher>
152164      <info name="series" value="Videocart 9" />
153165      <part name="cart" interface="channelf_cart">
166         <feature name="slot" value="std" />
154167         <dataarea name="rom" size="2048">
155168            <rom name="dragrace.bin" size="2048" crc="6a64dda3" sha1="d915c8997f56ae09548498feecebf3c3bfcdf6c4" offset="0" />
156169         </dataarea>
r32492r32493
163176      <publisher>Fairchild</publisher>
164177      <info name="series" value="Videocart 10" />
165178      <part name="cart" interface="channelf_cart">
179         <feature name="slot" value="maze" />
166180         <dataarea name="rom" size="2048">
167181            <rom name="maze.bin" size="2048" crc="4d42b296" sha1="a7b70fb6f24bb1dd79f2cbb1e57b3edb04332e04" offset="0" />
168182         </dataarea>
183         <dataarea name="ram" size="1024">
184         </dataarea>
169185      </part>
170186   </software>
171187
r32492r32493
175191      <publisher>Fairchild</publisher>
176192      <info name="series" value="Videocart 10" />
177193      <part name="cart" interface="channelf_cart">
194         <feature name="slot" value="maze" />
178195         <dataarea name="rom" size="2048">
179196            <rom name="mazealt.bin" size="2048" crc="0a948b61" sha1="b53ba16c6d91e2f62e020d18445217b91907a83b" offset="0" />
180197         </dataarea>
198         <dataarea name="ram" size="1024">
199         </dataarea>
181200      </part>
182201   </software>
183202
r32492r32493
187206      <publisher>Fairchild</publisher>
188207      <info name="series" value="Videocart 11" />
189208      <part name="cart" interface="channelf_cart">
209         <feature name="slot" value="std" />
190210         <dataarea name="rom" size="2048">
191211            <rom name="backgmmn.bin" size="2048" crc="a1731b52" sha1="9ac23df58c95bdbe68e3a0d0a477f07cd4e951d0" offset="0" />
192212         </dataarea>
r32492r32493
200220      <info name="series" value="Videocart 12" />
201221      <info name="usage" value="Hit CTRL and A to start." />
202222      <part name="cart" interface="channelf_cart">
223         <feature name="slot" value="std" />
203224         <dataarea name="rom" size="2048">
204225            <rom name="baseball.bin" size="2048" crc="01129bcd" sha1="9b0c9bd3e52da22ca7f2aab6fbb5f3c24f89ef75" offset="0" />
205226         </dataarea>
r32492r32493
212233      <publisher>Fairchild</publisher>
213234      <info name="series" value="Videocart 13" />
214235      <part name="cart" interface="channelf_cart">
236         <feature name="slot" value="std" />
215237         <dataarea name="rom" size="2048">
216238            <rom name="robotwar.bin" size="2048" crc="38241e4f" sha1="87f3f9afcc232d767cf6a5040c88b31283f76199" offset="0" />
217239         </dataarea>
r32492r32493
223245      <year>1977</year>
224246      <publisher>Fairchild</publisher>
225247      <part name="cart" interface="channelf_cart">
248         <feature name="slot" value="std" />
226249         <dataarea name="rom" size="2048">
227250            <rom name="robot war (proto).bin" size="2048" crc="7f62a23c" sha1="7e5966c1c393dc1b02ac34d57733a357bbcd4d5c" offset="0" />
228251         </dataarea>
r32492r32493
235258      <publisher>Fairchild</publisher>
236259      <info name="series" value="Videocart 14" />
237260      <part name="cart" interface="channelf_cart">
261         <feature name="slot" value="std" />
238262         <dataarea name="rom" size="2048">
239263            <rom name="sonrsrch.bin" size="2048" crc="dbdc56bf" sha1="a15449eec75382af6dd71e766cae1171308d192c" offset="0" />
240264         </dataarea>
r32492r32493
247271      <publisher>Fairchild</publisher>
248272      <info name="series" value="Videocart 15" />
249273      <part name="cart" interface="channelf_cart">
274         <feature name="slot" value="std" />
250275         <dataarea name="rom" size="2048">
251276            <rom name="mmrymtch.bin" size="2048" crc="104b5e18" sha1="e46406119020c85002513b1c01352f76dcd604a4" offset="0" />
252277         </dataarea>
r32492r32493
259284      <publisher>Fairchild</publisher>
260285      <info name="series" value="Videocart 16" />
261286      <part name="cart" interface="channelf_cart">
287         <feature name="slot" value="std" />
262288         <dataarea name="rom" size="2048">
263289            <rom name="dodgeit.bin" size="2048" crc="e3c1811c" sha1="54fdab06a07f84d073858f56a054a59ec0b1142e" offset="0" />
264290         </dataarea>
r32492r32493
271297      <publisher>Fairchild</publisher>
272298      <info name="series" value="Videocart 17" />
273299      <part name="cart" interface="channelf_cart">
300         <feature name="slot" value="std" />
274301         <dataarea name="rom" size="2048">
275302            <rom name="pinball.bin" size="2048" crc="c610b330" sha1="9267d85982414af753172e4c9998863463c32c99" offset="0" />
276303         </dataarea>
r32492r32493
283310      <publisher>Fairchild</publisher>
284311      <info name="series" value="Videocart 17" />
285312      <part name="cart" interface="channelf_cart">
313         <feature name="slot" value="std" />
286314         <dataarea name="rom" size="2048">
287315            <rom name="pinballa.bin" size="2048" crc="7cadf0fd" sha1="cc69feb8243e6fce3e6317bf9ea82d70a85eae1c" offset="0" />
288316         </dataarea>
r32492r32493
295323      <publisher>Fairchild</publisher>
296324      <info name="series" value="Videocart 18" />
297325      <part name="cart" interface="channelf_cart">
326         <feature name="slot" value="hangman" />
298327         <dataarea name="rom" size="3072">
299328            <rom name="hangman.bin" size="3072" crc="9238d6ce" sha1="19166d49dec273cae1f2dbac983b130d282ed231" offset="0" />
300329         </dataarea>
330         <dataarea name="ram" size="1024">
331         </dataarea>
301332      </part>
302333   </software>
303334
r32492r32493
307338      <publisher>Luxor</publisher>
308339      <info name="series" value="Luxor 18" />
309340      <part name="cart" interface="channelf_cart">
341         <feature name="slot" value="hangman" />
310342         <dataarea name="rom" size="3072">
311343            <rom name="ordtvlng.bin" size="3072" crc="3a386e79" sha1="62509545b8eef641c432705ff82cd8264c3e1d82" offset="0" />
312344         </dataarea>
345         <dataarea name="ram" size="1024">
346         </dataarea>
313347      </part>
314348   </software>
315349
r32492r32493
319353      <publisher>SABA</publisher>
320354      <info name="series" value="SABA 16" />
321355      <part name="cart" interface="channelf_cart">
356         <feature name="slot" value="hangman" />
322357         <dataarea name="rom" size="3072">
323358            <rom name="ratmal.bin" size="3072" crc="87752425" sha1="35f3fb741b643c4b8e8fdbff4ed0ea24402c4528" offset="0" />
324359         </dataarea>
360         <dataarea name="ram" size="1024">
361         </dataarea>
325362      </part>
326363   </software>
327364
r32492r32493
331368      <publisher>Zircon</publisher>
332369      <info name="series" value="Videocart 19" />
333370      <part name="cart" interface="channelf_cart">
371         <feature name="slot" value="std" />
334372         <dataarea name="rom" size="2048">
335373            <rom name="checkers.bin" size="2048" crc="fdae7044" sha1="2683b330dc2350341a51f1e3bdf75922bb425a9e" offset="0" />
336374         </dataarea>
r32492r32493
343381      <publisher>Fairchild</publisher>
344382      <info name="series" value="Videocart 20" />
345383      <part name="cart" interface="channelf_cart">
384         <feature name="slot" value="std" />
346385         <dataarea name="rom" size="3072">
347386            <rom name="vwhzball.bin" size="3072" crc="65fdfe49" sha1="61babb950ebc0b0acab29acf5dcbecc60dcd70a3" offset="0" />
348387         </dataarea>
r32492r32493
355394      <publisher>SABA</publisher>
356395      <info name="series" value="SABA 20" />
357396      <part name="cart" interface="channelf_cart">
397         <feature name="slot" value="chess" />
358398         <dataarea name="rom" size="6144">
359399            <rom name="schach.bin" size="6144" crc="04fb6dce" sha1="cbbaa8522fee16a0cc13ed3140d41e22919da24b" offset="0" />
360400         </dataarea>
401         <dataarea name="ram" size="2048">
402         </dataarea>
361403      </part>
362404   </software>
363405
r32492r32493
367409      <publisher>Fairchild/Zircon</publisher>
368410      <info name="series" value="Videocart 21" />
369411      <part name="cart" interface="channelf_cart">
412         <feature name="slot" value="std" />
370413         <dataarea name="rom" size="2048">
371414            <rom name="bowling.bin" size="2048" crc="94322c79" sha1="82d49201ee82e8cba6a907aca80969796a84d7f4" offset="0" />
372415         </dataarea>
r32492r32493
379422      <publisher>Zircon</publisher>
380423      <info name="series" value="Videocart 22" />
381424      <part name="cart" interface="channelf_cart">
425         <feature name="slot" value="std" />
382426         <dataarea name="rom" size="2048">
383427            <rom name="slotmchn.bin" size="2048" crc="b7eabd08" sha1="97e12dba298460ce466509e9aefb82fe2503ef6f" offset="0" />
384428         </dataarea>
r32492r32493
391435      <publisher>Zircon</publisher>
392436      <info name="series" value="Videocart 23" />
393437      <part name="cart" interface="channelf_cart">
438         <feature name="slot" value="std" />
394439         <dataarea name="rom" size="2048">
395440            <rom name="galactic.bin" size="2048" crc="c8ef3410" sha1="fc3cadc90d73ce7e3b32b5c9a855d621e79c592a" offset="0" />
396441         </dataarea>
r32492r32493
402447      <year>1980</year>
403448      <publisher>Zircon</publisher>
404449      <part name="cart" interface="channelf_cart">
450         <feature name="slot" value="std" />
405451         <dataarea name="rom" size="2048">
406452            <rom name="glactic space war (proto).bin" size="2048" crc="a61258a8" sha1="7077e42b2e8a101da05bb2188d7b65858ca8ec1e" offset="0" />
407453         </dataarea>
r32492r32493
414460      <publisher>Zircon</publisher>
415461      <info name="series" value="Videocart 24" />
416462      <part name="cart" interface="channelf_cart">
463         <feature name="slot" value="std" />
417464         <dataarea name="rom" size="4096">
418465            <rom name="pfootbll.bin" size="4096" crc="a1ae99be" sha1="9be97cace9b99f15a373bd95f3996034d633fff5" offset="0" />
419466         </dataarea>
r32492r32493
425472      <year>1981</year>
426473      <publisher>Zircon</publisher>
427474      <part name="cart" interface="channelf_cart">
475         <feature name="slot" value="std" />
428476         <dataarea name="rom" size="4096">
429477            <rom name="football (proto).bin" size="4096" crc="7e5dafea" sha1="db17bbc4f3f64bc5cb698de66b0f4838be430afa" offset="0" />
430478         </dataarea>
r32492r32493
437485      <publisher>Zircon</publisher>
438486      <info name="series" value="Videocart 25" />
439487      <part name="cart" interface="channelf_cart">
488         <feature name="slot" value="std" />
440489         <dataarea name="rom" size="4096">
441490            <rom name="casinop.bin" size="4096" crc="5aa30c12" sha1="4540b1cfca461d6eba26754c34090aa74822a4bd" offset="0" />
442491         </dataarea>
r32492r32493
448497      <year>1980</year>
449498      <publisher>Zircon</publisher>
450499      <part name="cart" interface="channelf_cart">
500         <feature name="slot" value="std" />
451501         <dataarea name="rom" size="4096">
452502            <rom name="draw poker (proto).bin" size="4096" crc="619fcc00" sha1="f1bd458f1efc4e9afe06db190a2a7ddb660418bf" offset="0" />
453503         </dataarea>
r32492r32493
460510      <publisher>Zircon</publisher>
461511      <info name="series" value="Videocart 26" />
462512      <part name="cart" interface="channelf_cart">
513         <feature name="slot" value="std" />
463514         <dataarea name="rom" size="4096">
464515            <rom name="alieninv.bin" size="4096" crc="85e00865" sha1="1837e95e6631687fc6d008207e56a31705d55cdf" offset="0" />
465516         </dataarea>
r32492r32493
471522      <year>19??</year>
472523      <publisher>Zircon</publisher>
473524      <part name="cart" interface="channelf_cart">
525         <feature name="slot" value="std" />
474526         <dataarea name="rom" size="2048">
475527            <rom name="color organ (proto).bin" size="2048" crc="3fa2d4eb" sha1="1ccc13a2f4aeb4538379d77d08ac7bf425bc4780" offset="0" />
476528         </dataarea>
477529      </part>
478530   </software>
479531
532
533   <software name="multicrt">
534      <description>Channel F Multi-Cart</description>
535      <year>2004</year>
536      <publisher>&lt;homebrew&gt;</publisher>
537      <part name="cart" interface="channelf_cart">
538         <feature name="slot" value="multi" />
539         <dataarea name="rom" size="262144">
540            <rom name="multigame rom.bin" size="262144" crc="a1ecbd58" sha1="d8d266846a01db69c0bb436093634ada7558f37f" offset="0" />
541         </dataarea>
542      </part>
543   </software>
544
545
480546</softwarelist>
trunk/hash/apfm1000.xml
r32492r32493
77      <publisher>APF</publisher>
88      <info name="serial" value="MG1008" />
99      <part name="cart" interface="apfm1000_cart">
10         <feature name="slot" value="std" />
1011         <dataarea name="rom" size="4096">
1112            <rom name="backgmmn.bin" size="4096" crc="811c6269" sha1="f820334bb6df9b856f54f1957b60a5e70bdd6d7e" offset="0" />
1213         </dataarea>
r32492r32493
1920      <publisher>APF</publisher>
2021      <info name="serial" value="MG1006" />
2122      <part name="cart" interface="apfm1000_cart">
23         <feature name="slot" value="std" />
2224         <dataarea name="rom" size="4096">
2325            <rom name="baseball.bin" size="4096" crc="1fb354b7" sha1="2c93d8e764b1e1dfdc1bde7888b385cc28064f86" offset="0" />
2426         </dataarea>
r32492r32493
3133      <publisher>APF</publisher>
3234      <info name="serial" value="MG1007" />
3335      <part name="cart" interface="apfm1000_cart">
36         <feature name="slot" value="std" />
3437         <dataarea name="rom" size="4096">
3538            <rom name="blackjck.bin" size="4096" crc="38faa709" sha1="1a99f4781ce4604a550f4ec9d8559e3456303464" offset="0" />
3639         </dataarea>
r32492r32493
4346      <publisher>APF</publisher>
4447      <info name="serial" value="MG1004" />
4548      <part name="cart" interface="apfm1000_cart">
49         <feature name="slot" value="std" />
4650         <dataarea name="rom" size="4096">
4751            <rom name="bowling.bin" size="4096" crc="cca5836b" sha1="4ff1c4ffa46c543bbf48a519a4285b5d2c697ae3" offset="0" />
4852         </dataarea>
r32492r32493
5559      <publisher>APF</publisher>
5660      <info name="serial" value="MG1012" />
5761      <part name="cart" interface="apfm1000_cart">
62         <feature name="slot" value="std" />
5863         <dataarea name="rom" size="4096">
5964            <rom name="boxing.bin" size="4096" crc="7121f8b1" sha1="e7ae8571b496444ded77aaaa3c1d5f5ee97c651f" offset="0" />
6065         </dataarea>
r32492r32493
6772      <publisher>APF</publisher>
6873      <info name="serial" value="MG1005" />
6974      <part name="cart" interface="apfm1000_cart">
75         <feature name="slot" value="std" />
7076         <dataarea name="rom" size="2048">
7177            <rom name="brickdwn.bin" size="2048" crc="bc1f5b8b" sha1="3e2f1e93501cd0dd2c9b747c594b784360e5b175" offset="0" />
7278         </dataarea>
r32492r32493
7985      <publisher>APF</publisher>
8086      <info name="serial" value="MG1009" />
8187      <part name="cart" interface="apfm1000_cart">
88         <feature name="slot" value="std" />
8289         <dataarea name="rom" size="4096">
8390            <rom name="casino.bin" size="4096" crc="21d5f63f" sha1="fa34ebdb799ccd2bff9f63ce4189a4ee690706fa" offset="0" />
8491         </dataarea>
r32492r32493
9198      <publisher>APF</publisher>
9299      <info name="serial" value="MG1001" />
93100      <part name="cart" interface="apfm1000_cart">
101         <feature name="slot" value="std" />
94102         <dataarea name="rom" size="2048">
95103            <rom name="catena.bin" size="2048" crc="6baad95f" sha1="b63ad3a60b59aad9b4605ff96f77839565144278" offset="0" />
96104         </dataarea>
r32492r32493
103111      <publisher>APF</publisher>
104112      <info name="serial" value="MG1002" />
105113      <part name="cart" interface="apfm1000_cart">
114         <feature name="slot" value="std" />
106115         <dataarea name="rom" size="2048">
107116            <rom name="catenaa.bin" size="2048" crc="5d03a812" sha1="29db4ca3c8b76c413b84b6d2bfd3499a70eccd3d" offset="0" />
108117         </dataarea>
r32492r32493
115124      <publisher>APF</publisher>
116125      <info name="serial" value="MG1003" />
117126      <part name="cart" interface="apfm1000_cart">
127         <feature name="slot" value="std" />
118128         <dataarea name="rom" size="4096">
119129            <rom name="hangman.bin" size="4096" crc="e58a5d5b" sha1="205d659db0e0ab0292d33b5b4a9c2b46ca9d1dd5" offset="0" />
120130         </dataarea>
r32492r32493
127137      <publisher>APF</publisher>
128138      <info name="serial" value="MG1011" />
129139      <part name="cart" interface="apfm1000_cart">
140         <feature name="slot" value="std" />
130141         <dataarea name="rom" size="4096">
131142            <rom name="pinball.bin" size="4096" crc="3f4b8c83" sha1="1f5bca6e96777ccbe830d1143a3549f51a3e386e" offset="0" />
132143         </dataarea>
r32492r32493
157168
158169-->
159170      <part name="cart" interface="apfm1000_cart">
160         <feature name="ram" value="1"/>
171         <feature name="slot" value="spacedst"/>
161172         <dataarea name="rom" size="8192">
162173            <rom name="apf1013a.bin" size="4096" crc="f25215a0" sha1="72da492092b883eb31cffb41ea353e919c86d285" offset="0" />
163174            <rom name="apf1013b.bin" size="2048" crc="8c3a9faa" sha1="b3cfc23c65558ef7b67c9afa01a306c8123e227f" offset="0x1000" />
r32492r32493
167178      </part>
168179   </software>
169180
170   <software name="ufo" supported="yes">
181   <software name="ufo">
171182      <description>Ufo / Sea Monsters / Break It Down / Rebuild / Shoot</description>
172183      <year>1979</year>
173184      <publisher>APF</publisher>
174185      <info name="serial" value="MG1010" />
175186      <part name="cart" interface="apfm1000_cart">
187         <feature name="slot" value="std" />
176188         <dataarea name="rom" size="4096">
177189            <rom name="ufo.bin" size="4096" crc="0504d667" sha1="6e33593f9e7a4551bc31b347741d9ff87ce618ca" offset="0" />
178190         </dataarea>
r32492r32493
181193
182194<!-- Homebrew -->
183195
184   <software name="chardump" supported="yes">
196   <software name="chardump">
185197      <description>Character Dump</description>
186198      <year>2010</year>
187199      <publisher>Adam Trionfo</publisher>
188200      <part name="cart" interface="apfm1000_cart">
201         <feature name="slot" value="std" />
189202         <dataarea name="rom" size="4096">
190203            <rom name="chardump.bin" size="4096" crc="27bd1c3c" sha1="826b608b6c33798942bd716928eef70cc8e83bda" offset="0" />
191204         </dataarea>
r32492r32493
205218      </part>
206219   </software>
207220
208   <software name="movblock" supported="yes">
221   <software name="movblock">
209222      <description>Move Block</description>
210223      <year>2010</year>
211224      <publisher>Adam Trionfo</publisher>
212225      <part name="cart" interface="apfm1000_cart">
226         <feature name="slot" value="std" />
213227         <dataarea name="rom" size="4096">
214228            <rom name="movblock.bin" size="4096" crc="f77f72f4" sha1="2cf3a82d584b2a2e4c7e5ae751da8d0255c2295a" offset="0" />
215229         </dataarea>
216230      </part>
217231   </software>
218232
219   <software name="mblock02" supported="yes">
233   <software name="mblock02">
220234      <description>Move Block 2</description>
221235      <year>2010</year>
222236      <publisher>Adam Trionfo</publisher>
223237      <part name="cart" interface="apfm1000_cart">
238         <feature name="slot" value="std" />
224239         <dataarea name="rom" size="4096">
225240            <rom name="mblock02.bin" size="4096" crc="cf63865a" sha1="8c8e6924ab511d69a31eb52faaaad5efb7888f33" offset="0" />
226241         </dataarea>
227242      </part>
228243   </software>
229244
230   <software name="readpia" supported="yes">
245   <software name="readpia">
231246      <description>Read PIA</description>
232247      <year>2010</year>
233248      <publisher>Adam Trionfo</publisher>
234249      <part name="cart" interface="apfm1000_cart">
250         <feature name="slot" value="std" />
235251         <dataarea name="rom" size="4096">
236252            <rom name="readpia.bin" size="4096" crc="700c1e39" sha1="701c4f8a9fc20c8f28a5c0562592ed873d9d9ab4" offset="0" />
237253         </dataarea>
r32492r32493
240256
241257<!-- apfimag only -->
242258
243   <software name="basic" supported="yes">
259   <software name="basic">
244260      <description>APF Basic</description>
245261      <year>1979</year>
246262      <publisher>APF</publisher>
247263      <info name="serial" value="AL100A" />
248264      <part name="cart" interface="apfm1000_cart">
249         <feature name="ram" value="8"/>
265         <feature name="slot" value="basic"/>
250266         <dataarea name="rom" size="12288">
251267            <rom name="basic_80.rom" size="8192" crc="a4c69fae" sha1="7f98aa482589bf7c5a26d338fec105e797ba43f6" offset="0" />
252268            <rom name="basic_68.rom" size="4096" crc="5f30370b" sha1="cf11bd975749b88df4d82cd460035cb92563ceff" offset="0x2000" />
r32492r32493
254270      </part>
255271   </software>
256272
257   <software name="ebasic" supported="yes">
273   <software name="ebasic">
258274      <description>Extended Basic</description>
259275      <year>1983</year>
260      <publisher>R.L.Recker</publisher>
276      <publisher>R.L. Recker</publisher>
261277      <part name="cart" interface="apfm1000_cart">
262         <feature name="ram" value="8"/>
278         <feature name="slot" value="basic"/>
263279         <dataarea name="rom" size="14336">
264280            <rom name="basic_80.bin" size="8192" crc="3fefbd81" sha1="d8c3ea8a152da50f71b98c464f47919e16743d29" offset="0" />
265281            <rom name="basic_68.bin" size="4096" crc="e99b5102" sha1="62a79dc5f25a60d9007c90adf778fba432dfb900" offset="0x2000" />
trunk/src/emu/bus/chanf/slot.c
r0r32493
1/***********************************************************************************************************
2
3    Fairchild Channel F 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 CHANF_CART_SLOT = &device_creator<channelf_cart_slot_device>;
17
18//**************************************************************************
19//    Channel F cartridges Interface
20//**************************************************************************
21
22//-------------------------------------------------
23//  device_channelf_cart_interface - constructor
24//-------------------------------------------------
25
26device_channelf_cart_interface::device_channelf_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_channelf_cart_interface - destructor
36//-------------------------------------------------
37
38device_channelf_cart_interface::~device_channelf_cart_interface()
39{
40}
41
42//-------------------------------------------------
43//  rom_alloc - alloc the space for the cart
44//-------------------------------------------------
45
46void device_channelf_cart_interface::rom_alloc(UINT32 size, const char *tag)
47{
48   if (m_rom == NULL)
49   {
50      astring tempstring(tag);
51      tempstring.cat(CHANFSLOT_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_channelf_cart_interface::ram_alloc(UINT32 size)
63{
64   m_ram.resize(size);
65}
66
67
68//**************************************************************************
69//  LIVE DEVICE
70//**************************************************************************
71
72//-------------------------------------------------
73//  channelf_cart_slot_device - constructor
74//-------------------------------------------------
75channelf_cart_slot_device::channelf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
76                  device_t(mconfig, CHANF_CART_SLOT, "Fairchild Channel F Cartridge Slot", tag, owner, clock, "cf_cart_slot", __FILE__),
77                  device_image_interface(mconfig, *this),
78                  device_slot_interface(mconfig, *this),
79                  m_type(CF_CHESS)
80{
81}
82
83
84//-------------------------------------------------
85//  ~channelf_cart_slot_device - destructor
86//-------------------------------------------------
87
88channelf_cart_slot_device::~channelf_cart_slot_device()
89{
90}
91
92//-------------------------------------------------
93//  device_start - device-specific startup
94//-------------------------------------------------
95
96void channelf_cart_slot_device::device_start()
97{
98   m_cart = dynamic_cast<device_channelf_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 channelf_cart_slot_device::device_config_complete()
108{
109   // set brief and instance name
110   update_names();
111}
112
113
114//-------------------------------------------------
115//  Channel F PCB
116//-------------------------------------------------
117
118struct chanf_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 chanf_slot slot_list[] =
126{
127   { CF_STD,     "std" },
128   { CF_MAZE,    "maze" },
129   { CF_HANGMAN, "hangman" },
130   { CF_CHESS,   "chess" },
131   { CF_MULTI,   "multi" }
132};
133
134static int chanf_get_pcb_id(const char *slot)
135{
136   for (int i = 0; i < ARRAY_LENGTH(slot_list); i++)
137   {
138      if (!core_stricmp(slot_list[i].slot_option, slot))
139         return slot_list[i].pcb_id;
140   }
141
142   return 0;
143}
144
145static const char *chanf_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 "chess";
154}
155
156
157/*-------------------------------------------------
158 call load
159 -------------------------------------------------*/
160
161bool channelf_cart_slot_device::call_load()
162{
163   if (m_cart)
164   {
165      UINT32 len = (software_entry() == NULL) ? length() : get_software_region_length("rom");
166      m_cart->rom_alloc(len, tag());
167
168      if (software_entry() == NULL)
169         fread(m_cart->get_rom_base(), len);
170      else
171         memcpy(m_cart->get_rom_base(), get_software_region("rom"), len);
172
173      if (software_entry() == NULL)
174      {
175         // we default to "chess" slot because some homebrew programs have been written to run
176         // on PCBs with RAM at $2000-$2800 as Saba Schach!
177         if (len == 0x40000)
178            m_type = CF_MULTI;
179         else
180            m_type = CF_CHESS;   // is there any way to detect Maze and Hangman from fullpath?
181
182         m_cart->ram_alloc(0x800);
183      }
184      else
185      {
186         const char *pcb_name = get_feature("slot");
187         if (pcb_name)
188            m_type = chanf_get_pcb_id(pcb_name);
189
190         if (get_software_region("ram"))
191            m_cart->ram_alloc(get_software_region_length("ram"));
192      }
193
194      //printf("Type: %s\n", chanf_get_slot(m_type));
195
196      return IMAGE_INIT_PASS;
197   }
198
199   return IMAGE_INIT_PASS;
200}
201
202
203/*-------------------------------------------------
204 call softlist load
205 -------------------------------------------------*/
206
207bool channelf_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
208{
209   load_software_part_region(*this, swlist, swname, start_entry);
210   return TRUE;
211}
212
213
214
215/*-------------------------------------------------
216 get default card software
217 -------------------------------------------------*/
218
219void channelf_cart_slot_device::get_default_card_software(astring &result)
220{
221   if (open_image_file(mconfig().options()))
222   {
223      const char *slot_string = "chess";
224      UINT32 len = core_fsize(m_file);
225      int type;
226     
227      if (len == 0x40000)
228         type = CF_MULTI;
229      else
230         type = CF_CHESS;   // is there any way to detect the other carts from fullpath?
231     
232      slot_string = chanf_get_slot(type);
233     
234      //printf("type: %s\n", slot_string);
235      clear();
236     
237      result.cpy(slot_string);
238      return;
239   }
240   software_get_default_slot(result, "chess");
241}
242
243/*-------------------------------------------------
244 read
245 -------------------------------------------------*/
246
247READ8_MEMBER(channelf_cart_slot_device::read_rom)
248{
249   if (m_cart)
250      return m_cart->read_rom(space, offset);
251   else
252      return 0xff;
253}
254
255/*-------------------------------------------------
256 read
257 -------------------------------------------------*/
258
259READ8_MEMBER(channelf_cart_slot_device::read_ram)
260{
261   if (m_cart)
262      return m_cart->read_ram(space, offset);
263   else
264      return 0xff;
265}
266
267/*-------------------------------------------------
268 write
269 -------------------------------------------------*/
270
271WRITE8_MEMBER(channelf_cart_slot_device::write_ram)
272{
273   if (m_cart)
274      m_cart->write_ram(space, offset, data);
275}
276
277/*-------------------------------------------------
278 write
279 -------------------------------------------------*/
280
281WRITE8_MEMBER(channelf_cart_slot_device::write_bank)
282{
283   if (m_cart)
284      m_cart->write_bank(space, offset, data);
285}
Property changes on: trunk/src/emu/bus/chanf/slot.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/emu/bus/chanf/rom.h
r0r32493
1#ifndef __CHANF_ROM_H
2#define __CHANF_ROM_H
3
4#include "slot.h"
5
6
7// ======================> chanf_rom_device
8
9class chanf_rom_device : public device_t,
10                  public device_channelf_cart_interface
11{
12public:
13   // construction/destruction
14   chanf_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
15   chanf_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   virtual void device_reset() {}
20
21   UINT8 common_read_2102(UINT32 offset);
22   UINT8 common_read_3853(UINT32 offset);
23   void common_write_2102(UINT32 offset, UINT8 data);
24   void common_write_3853(UINT32 offset, UINT8 data);
25   
26   // reading and writing
27   virtual DECLARE_READ8_MEMBER(read_rom);
28
29   
30protected:
31   // used for RAM chip in Hangman & Maze
32   UINT8 m_latch[2];      // PORT A & PORT B
33   UINT16 m_addr_latch, m_addr;
34   int m_read_write, m_data0;
35};
36
37// ======================> chanf_maze_device
38
39class chanf_maze_device : public chanf_rom_device
40{
41public:
42   // construction/destruction
43   chanf_maze_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
44   
45   // device-level overrides
46   virtual void device_start();
47   virtual void device_reset();
48   
49   // reading and writing
50   virtual DECLARE_READ8_MEMBER(read_ram) { return common_read_2102(offset); }
51   virtual DECLARE_WRITE8_MEMBER(write_ram) { common_write_2102(offset, data); }
52};
53
54
55// ======================> chanf_hangman_device
56
57class chanf_hangman_device : public chanf_rom_device
58{
59public:
60   // construction/destruction
61   chanf_hangman_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
62   
63   // device-level overrides
64   virtual void device_start();
65   virtual void device_reset();
66   
67   // reading and writing
68   virtual DECLARE_READ8_MEMBER(read_ram) { return common_read_2102(offset); }
69   virtual DECLARE_WRITE8_MEMBER(write_ram) { common_write_2102(offset, data); }
70};
71
72
73// ======================> chanf_chess_device
74
75class chanf_chess_device : public chanf_rom_device
76{
77public:
78   // construction/destruction
79   chanf_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
80   
81   // reading and writing
82   virtual DECLARE_READ8_MEMBER(read_ram) { return common_read_3853(offset); }
83   virtual DECLARE_WRITE8_MEMBER(write_ram) { common_write_3853(offset, data); }
84};
85
86
87// ======================> chanf_multi_device
88
89class chanf_multi_device : public chanf_rom_device
90{
91public:
92   // construction/destruction
93   chanf_multi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
94   
95   // device-level overrides
96   virtual void device_start();
97   virtual void device_reset();
98   
99   // reading and writing
100   virtual DECLARE_READ8_MEMBER(read_rom);
101   virtual DECLARE_READ8_MEMBER(read_ram) { return common_read_3853(offset); }
102   virtual DECLARE_WRITE8_MEMBER(write_ram) { common_write_3853(offset, data); }
103   virtual DECLARE_WRITE8_MEMBER(write_bank);
104
105private:
106   int m_base_bank;
107};
108
109
110
111// device type definition
112extern const device_type CHANF_ROM_STD;
113extern const device_type CHANF_ROM_MAZE;
114extern const device_type CHANF_ROM_HANGMAN;
115extern const device_type CHANF_ROM_CHESS;
116extern const device_type CHANF_ROM_MULTI;
117
118
119#endif
Property changes on: trunk/src/emu/bus/chanf/rom.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/chanf/slot.h
r0r32493
1#ifndef __CHANF_SLOT_H
2#define __CHANF_SLOT_H
3
4/***************************************************************************
5 TYPE DEFINITIONS
6 ***************************************************************************/
7
8
9/* PCB */
10enum
11{
12   CF_STD = 0,
13   CF_MAZE,
14   CF_HANGMAN,
15   CF_CHESS,
16   CF_MULTI
17};
18
19
20// ======================> device_channelf_cart_interface
21
22class device_channelf_cart_interface : public device_slot_card_interface
23{
24public:
25   // device_channelf_cart_interface/destruction
26   device_channelf_cart_interface(const machine_config &mconfig, device_t &device);
27   virtual ~device_channelf_cart_interface();
28
29   // reading and writing
30   virtual DECLARE_READ8_MEMBER(read_rom) { return 0xff; }
31   virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; }
32   virtual DECLARE_WRITE8_MEMBER(write_ram) {}
33   virtual DECLARE_WRITE8_MEMBER(write_bank) {}
34
35   void rom_alloc(UINT32 size, const char *tag);
36   void ram_alloc(UINT32 size);
37   UINT8* get_rom_base() { return m_rom; }
38   UINT8* get_ram_base() { return m_ram; }
39   UINT32 get_rom_size() { return m_rom_size; }
40   UINT32 get_ram_size() { return m_ram.count(); }
41
42   void save_ram()   { device().save_item(NAME(m_ram)); }
43
44protected:
45   // internal state
46   UINT8 *m_rom;
47   UINT32 m_rom_size;
48   dynamic_buffer m_ram;
49};
50
51
52// ======================> channelf_cart_slot_device
53
54class channelf_cart_slot_device : public device_t,
55                        public device_image_interface,
56                        public device_slot_interface
57{
58public:
59   // construction/destruction
60   channelf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
61   virtual ~channelf_cart_slot_device();
62
63   // device-level overrides
64   virtual void device_start();
65   virtual void device_config_complete();
66
67   // image-level overrides
68   virtual bool call_load();
69   virtual void call_unload() {}
70   virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry);
71
72   int get_type() { return m_type; }
73
74   void save_ram()   { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); }
75
76   virtual iodevice_t image_type() const { return IO_CARTSLOT; }
77   virtual bool is_readable()  const { return 1; }
78   virtual bool is_writeable() const { return 0; }
79   virtual bool is_creatable() const { return 0; }
80   virtual bool must_be_loaded() const { return 0; }
81   virtual bool is_reset_on_load() const { return 1; }
82   virtual const option_guide *create_option_guide() const { return NULL; }
83   virtual const char *image_interface() const { return "channelf_cart"; }
84   virtual const char *file_extensions() const { return "bin,chf"; }
85
86   // slot interface overrides
87   virtual void get_default_card_software(astring &result);
88
89   // reading and writing
90   virtual DECLARE_READ8_MEMBER(read_rom);
91   virtual DECLARE_READ8_MEMBER(read_ram);
92   virtual DECLARE_WRITE8_MEMBER(write_ram);
93   virtual DECLARE_WRITE8_MEMBER(write_bank);
94
95protected:
96
97   int m_type;
98   device_channelf_cart_interface*       m_cart;
99};
100
101
102
103// device type definition
104extern const device_type CHANF_CART_SLOT;
105
106
107/***************************************************************************
108 DEVICE CONFIGURATION MACROS
109 ***************************************************************************/
110
111#define CHANFSLOT_ROM_REGION_TAG ":cart:rom"
112
113#define MCFG_CHANNELF_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
114   MCFG_DEVICE_ADD(_tag, CHANF_CART_SLOT, 0) \
115   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
116
117#endif
Property changes on: trunk/src/emu/bus/chanf/slot.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/chanf/rom.c
r0r32493
1/***********************************************************************************************************
2
3
4 Fairchild Channel F cart emulation
5
6 Three kind of carts:
7 - ROM only (the vast majority of carts)
8 - ROM + 2102 RAM chip (used by carts 10 and 18, with different I/O ports)
9 - ROM + 3853 RAM chip (used by Schach + some homebrew)
10
11 Based on Sean Riddle's documentation (especially for the 2102 RAM!)
12
13 ***********************************************************************************************************/
14
15
16#include "emu.h"
17#include "rom.h"
18
19
20//-------------------------------------------------
21//  chanf_rom_device - constructor
22//-------------------------------------------------
23
24const device_type CHANF_ROM_STD = &device_creator<chanf_rom_device>;
25const device_type CHANF_ROM_MAZE = &device_creator<chanf_maze_device>;
26const device_type CHANF_ROM_HANGMAN = &device_creator<chanf_hangman_device>;
27const device_type CHANF_ROM_CHESS = &device_creator<chanf_chess_device>;
28const device_type CHANF_ROM_MULTI = &device_creator<chanf_multi_device>;
29
30
31chanf_rom_device::chanf_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
32               : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
33                  device_channelf_cart_interface( mconfig, *this )
34{
35}
36
37chanf_rom_device::chanf_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
38               : device_t(mconfig, CHANF_ROM_STD, "Channel F Standard Carts", tag, owner, clock, "chanf_rom", __FILE__),
39                  device_channelf_cart_interface( mconfig, *this )
40{
41}
42
43chanf_maze_device::chanf_maze_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
44               : chanf_rom_device(mconfig, CHANF_ROM_MAZE, "Channel F Maze Cart", tag, owner, clock, "chanf_maze", __FILE__)
45{
46}
47
48chanf_hangman_device::chanf_hangman_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
49               : chanf_rom_device(mconfig, CHANF_ROM_HANGMAN, "Channel F Hangman Cart", tag, owner, clock, "chanf_hang", __FILE__)
50{
51}
52
53chanf_chess_device::chanf_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
54               : chanf_rom_device(mconfig, CHANF_ROM_CHESS, "Channel F Chess Cart", tag, owner, clock, "chanf_chess", __FILE__)
55{
56}
57
58chanf_multi_device::chanf_multi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
59               : chanf_rom_device(mconfig, CHANF_ROM_MULTI, "Channel F Multigame Cart", tag, owner, clock, "chanf_multi", __FILE__)
60{
61}
62
63
64
65//-------------------------------------------------
66//  mapper specific start/reset
67//-------------------------------------------------
68
69
70void chanf_maze_device::device_start()
71{
72   // 2012 RAM related
73   save_item(NAME(m_latch));
74   save_item(NAME(m_addr_latch));
75   save_item(NAME(m_addr));
76   save_item(NAME(m_read_write));
77   save_item(NAME(m_data0));
78}
79
80void chanf_maze_device::device_reset()
81{
82   m_latch[0] = 0;
83   m_latch[1] = 0;
84   m_addr = 0;
85   m_addr_latch = 0;
86   m_read_write = 0;
87   m_data0 = 0;
88}
89
90
91void chanf_hangman_device::device_start()
92{
93   // 2012 RAM related
94   save_item(NAME(m_latch));
95   save_item(NAME(m_addr_latch));
96   save_item(NAME(m_addr));
97   save_item(NAME(m_read_write));
98   save_item(NAME(m_data0));
99}
100
101void chanf_hangman_device::device_reset()
102{
103   m_latch[0] = 0;
104   m_latch[1] = 0;
105   m_addr = 0;
106   m_addr_latch = 0;
107   m_read_write = 0;
108   m_data0 = 0;
109}
110
111
112void chanf_multi_device::device_start()
113{
114   save_item(NAME(m_base_bank));
115}
116
117void chanf_multi_device::device_reset()
118{
119   m_base_bank = 0;
120}
121
122
123/*-------------------------------------------------
124 mapper specific handlers
125 -------------------------------------------------*/
126
127READ8_MEMBER(chanf_rom_device::read_rom)
128{
129   if (offset < m_rom_size)
130      return m_rom[offset];
131   else
132      return 0xff;
133}
134
135// These are shared among Maze & Hangman cart types (not directly used by base chanf_rom_device)
136UINT8 chanf_rom_device::common_read_2102(UINT32 offset)
137{
138   if (offset == 0)
139   {
140      if (m_read_write == 0)
141      {
142         m_addr = m_addr_latch;
143         m_data0 = m_ram[m_addr] & 1;
144         return (m_latch[0] & 0x7f | (m_data0 << 7));
145      }
146     
147      return m_latch[0];
148   }
149   else
150      return m_latch[1];
151}
152
153void chanf_rom_device::common_write_2102(UINT32 offset, UINT8 data)
154{
155   if (offset == 0)
156   {
157      m_latch[0] = data;
158     
159      m_read_write = BIT(data, 0);
160
161      m_addr_latch = (m_addr_latch & 0x3f3) | (BIT(data, 2) << 2) | (BIT(data, 1) << 3);   // bits 2,3 come from this write!
162      m_addr = m_addr_latch;
163
164      m_data0 = BIT(data, 3);
165
166      if (m_read_write == 1)
167         m_ram[m_addr] = m_data0;
168   }
169   else
170   {
171      m_latch[1] = data;
172      // all bits but 2,3 come from this write, but they are shuffled
173      // notice that data is 8bits, so when swapping bit8 & bit9 are always 0!
174      m_addr_latch = (m_addr_latch & 0x0c) | (BITSWAP16(data, 15, 14, 13, 12, 11, 10, 7, 6, 5, 3, 2, 1, 9, 8, 4, 0));
175   }
176}
177
178
179// These are shared among Schach & Multigame cart types (not directly used by base chanf_rom_device)
180UINT8 chanf_rom_device::common_read_3853(UINT32 offset)
181{
182   if (offset < m_ram.count())
183      return m_ram[offset];
184   else
185      return 0xff;
186}
187
188void chanf_rom_device::common_write_3853(UINT32 offset, UINT8 data)
189{
190   if (offset < m_ram.count())
191      m_ram[offset] = data;
192}
193
194READ8_MEMBER(chanf_multi_device::read_rom)
195{
196   if (offset < 0x2000)
197      return m_rom[offset + (m_base_bank * 0x2000)];
198   else
199      return 0xff;
200}
201
202WRITE8_MEMBER(chanf_multi_device::write_bank)
203{
204   m_base_bank = data;
205}
206
Property changes on: trunk/src/emu/bus/chanf/rom.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/bus.mak
r32492r32493
9898
9999#-------------------------------------------------
100100#
101#@src/emu/bus/apf/slot.h,BUSES += APF
102#-------------------------------------------------
103
104ifneq ($(filter APF,$(BUSES)),)
105OBJDIRS += $(BUSOBJ)/apf
106BUSOBJS += $(BUSOBJ)/apf/slot.o
107BUSOBJS += $(BUSOBJ)/apf/rom.o
108endif
109
110
111#-------------------------------------------------
112#
101113#@src/emu/bus/bw2/exp.h,BUSES += BW2
102114#-------------------------------------------------
103115
r32492r32493
228240
229241#-------------------------------------------------
230242#
243#@src/emu/bus/chanf/slot.h,BUSES += CHANNELF
244#-------------------------------------------------
245
246ifneq ($(filter CHANNELF,$(BUSES)),)
247OBJDIRS += $(BUSOBJ)/chanf
248BUSOBJS += $(BUSOBJ)/chanf/slot.o
249BUSOBJS += $(BUSOBJ)/chanf/rom.o
250endif
251
252
253#-------------------------------------------------
254#
231255#@src/emu/bus/comx35/exp.h,BUSES += COMX35
232256#-------------------------------------------------
233257
trunk/src/emu/bus/apf/slot.h
r0r32493
1#ifndef __APF_SLOT_H
2#define __APF_SLOT_H
3
4/***************************************************************************
5 TYPE DEFINITIONS
6 ***************************************************************************/
7
8
9/* PCB */
10enum
11{
12   APF_STD = 0,
13   APF_BASIC,
14   APF_SPACEDST
15};
16
17
18// ======================> device_apf_cart_interface
19
20class device_apf_cart_interface : public device_slot_card_interface
21{
22public:
23   // construction/destruction
24   device_apf_cart_interface(const machine_config &mconfig, device_t &device);
25   virtual ~device_apf_cart_interface();
26
27   // reading and writing
28   virtual DECLARE_READ8_MEMBER(read_rom) { return 0xff; }
29   virtual DECLARE_READ8_MEMBER(extra_rom) { return 0xff; }
30   virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; }
31   virtual DECLARE_WRITE8_MEMBER(write_ram) {}
32
33   void rom_alloc(UINT32 size, const char *tag);
34   void ram_alloc(UINT32 size);
35   UINT8* get_rom_base() { return m_rom; }
36   UINT8* get_ram_base() { return m_ram; }
37   UINT32 get_rom_size() { return m_rom_size; }
38   UINT32 get_ram_size() { return m_ram.count(); }
39
40   void save_ram()   { device().save_item(NAME(m_ram)); }
41
42protected:
43   // internal state
44   UINT8 *m_rom;
45   UINT32 m_rom_size;
46   dynamic_buffer m_ram;
47};
48
49
50// ======================> apf_cart_slot_device
51
52class apf_cart_slot_device : public device_t,
53                        public device_image_interface,
54                        public device_slot_interface
55{
56public:
57   // construction/destruction
58   apf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
59   virtual ~apf_cart_slot_device();
60
61   // device-level overrides
62   virtual void device_start();
63   virtual void device_config_complete();
64
65   // image-level overrides
66   virtual bool call_load();
67   virtual void call_unload() {}
68   virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry);
69
70   int get_type() { return m_type; }
71
72   void save_ram()   { if (m_cart && m_cart->get_ram_size()) m_cart->save_ram(); }
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 0; }
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 "apfm1000_cart"; }
82   virtual const char *file_extensions() const { return "bin"; }
83
84   // slot interface overrides
85   virtual void get_default_card_software(astring &result);
86
87   // reading and writing
88   virtual DECLARE_READ8_MEMBER(read_rom);
89   virtual DECLARE_READ8_MEMBER(extra_rom);
90   virtual DECLARE_READ8_MEMBER(read_ram);
91   virtual DECLARE_WRITE8_MEMBER(write_ram);
92
93protected:
94
95   int m_type;
96   device_apf_cart_interface*       m_cart;
97};
98
99
100
101// device type definition
102extern const device_type APF_CART_SLOT;
103
104
105/***************************************************************************
106 DEVICE CONFIGURATION MACROS
107 ***************************************************************************/
108
109#define APFSLOT_ROM_REGION_TAG ":cart:rom"
110
111#define MCFG_APF_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
112   MCFG_DEVICE_ADD(_tag, APF_CART_SLOT, 0) \
113   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
114
115#endif
Property changes on: trunk/src/emu/bus/apf/slot.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/apf/rom.c
r0r32493
1/***********************************************************************************************************
2
3
4 APF Imagination / M-1000 cart emulation
5
6
7 ***********************************************************************************************************/
8
9
10#include "emu.h"
11#include "rom.h"
12
13
14//-------------------------------------------------
15//  apf_rom_device - constructor
16//-------------------------------------------------
17
18const device_type APF_ROM_STD = &device_creator<apf_rom_device>;
19const device_type APF_ROM_BASIC = &device_creator<apf_basic_device>;
20const device_type APF_ROM_SPACEDST = &device_creator<apf_spacedst_device>;
21
22
23apf_rom_device::apf_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
24               : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
25                  device_apf_cart_interface( mconfig, *this )
26{
27}
28
29apf_rom_device::apf_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
30               : device_t(mconfig, APF_ROM_STD, "APF Standard Carts", tag, owner, clock, "apf_rom", __FILE__),
31                  device_apf_cart_interface( mconfig, *this )
32{
33}
34
35apf_basic_device::apf_basic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
36               : apf_rom_device(mconfig, APF_ROM_BASIC, "APF BASIC Carts", tag, owner, clock, "apf_basic", __FILE__)
37{
38}
39
40apf_spacedst_device::apf_spacedst_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
41               : apf_rom_device(mconfig, APF_ROM_SPACEDST, "APF Space Destroyer Cart", tag, owner, clock, "apf_spacedst", __FILE__)
42{
43}
44
45
46/*-------------------------------------------------
47 mapper specific handlers
48 -------------------------------------------------*/
49
50READ8_MEMBER(apf_rom_device::read_rom)
51{
52   if (offset < m_rom_size)
53      return m_rom[offset];
54   else
55      return 0xff;
56}
57
58
59READ8_MEMBER(apf_basic_device::extra_rom)
60{
61   if (offset < (m_rom_size - 0x2000))
62      return m_rom[offset + 0x2000];
63   else
64      return 0xff;
65}
66
67
68READ8_MEMBER(apf_spacedst_device::read_ram)
69{
70   return m_ram[offset];
71}
72
73WRITE8_MEMBER(apf_spacedst_device::write_ram)
74{
75   m_ram[offset] = data;
76}
Property changes on: trunk/src/emu/bus/apf/rom.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/apf/slot.c
r0r32493
1/***********************************************************************************************************
2
3    APF Imagination / M-1000 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 APF_CART_SLOT = &device_creator<apf_cart_slot_device>;
17
18//**************************************************************************
19//    APF Cartridges Interface
20//**************************************************************************
21
22//-------------------------------------------------
23//  device_apf_cart_interface - constructor
24//-------------------------------------------------
25
26device_apf_cart_interface::device_apf_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_apf_cart_interface - destructor
36//-------------------------------------------------
37
38device_apf_cart_interface::~device_apf_cart_interface()
39{
40}
41
42//-------------------------------------------------
43//  rom_alloc - alloc the space for the cart
44//-------------------------------------------------
45
46void device_apf_cart_interface::rom_alloc(UINT32 size, const char *tag)
47{
48   if (m_rom == NULL)
49   {
50      astring tempstring(tag);
51      tempstring.cat(APFSLOT_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_apf_cart_interface::ram_alloc(UINT32 size)
63{
64   m_ram.resize(size);
65}
66
67
68//**************************************************************************
69//  LIVE DEVICE
70//**************************************************************************
71
72//-------------------------------------------------
73//  apf_cart_slot_device - constructor
74//-------------------------------------------------
75apf_cart_slot_device::apf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
76                  device_t(mconfig, APF_CART_SLOT, "APF Cartridge Slot", tag, owner, clock, "apf_cart_slot", __FILE__),
77                  device_image_interface(mconfig, *this),
78                  device_slot_interface(mconfig, *this),
79                  m_type(APF_STD)
80{
81}
82
83
84//-------------------------------------------------
85//  apf_cart_slot_device - destructor
86//-------------------------------------------------
87
88apf_cart_slot_device::~apf_cart_slot_device()
89{
90}
91
92//-------------------------------------------------
93//  device_start - device-specific startup
94//-------------------------------------------------
95
96void apf_cart_slot_device::device_start()
97{
98   m_cart = dynamic_cast<device_apf_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 apf_cart_slot_device::device_config_complete()
108{
109   // set brief and instance name
110   update_names();
111}
112
113
114//-------------------------------------------------
115//  APF PCB
116//-------------------------------------------------
117
118struct apf_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 apf_slot slot_list[] =
126{
127   { APF_STD,      "std" },
128   { APF_BASIC,    "basic" },
129   { APF_SPACEDST, "spacedst" }
130};
131
132static int apf_get_pcb_id(const char *slot)
133{
134   for (int i = 0; i < ARRAY_LENGTH(slot_list); i++)
135   {
136      if (!core_stricmp(slot_list[i].slot_option, slot))
137         return slot_list[i].pcb_id;
138   }
139
140   return 0;
141}
142
143static const char *apf_get_slot(int type)
144{
145   for (int i = 0; i < ARRAY_LENGTH(slot_list); i++)
146   {
147      if (slot_list[i].pcb_id == type)
148         return slot_list[i].slot_option;
149   }
150
151   return "std";
152}
153
154
155/*-------------------------------------------------
156 call load
157 -------------------------------------------------*/
158
159bool apf_cart_slot_device::call_load()
160{
161   if (m_cart)
162   {
163      UINT32 size = (software_entry() == NULL) ? length() : get_software_region_length("rom");
164
165      if (size > 0x3800)
166      {
167         seterror(IMAGE_ERROR_UNSPECIFIED, "Image extends beyond the expected size for an APF cart");
168         return IMAGE_INIT_FAIL;
169      }
170     
171      m_cart->rom_alloc(size, tag());
172         
173      if (software_entry() == NULL)
174         fread(m_cart->get_rom_base(), size);
175      else
176         memcpy(m_cart->get_rom_base(), get_software_region("rom"), size);
177
178      if (software_entry() == NULL)
179      {
180         m_type = APF_STD;
181         // attempt to identify Space Destroyer, which needs 1K of additional RAM
182         if (size == 0x1800)
183         {
184            m_type = APF_SPACEDST;
185            m_cart->ram_alloc(0x400);
186         }
187         if (size > 0x2000)
188            m_type = APF_BASIC;
189      }
190      else
191      {
192         const char *pcb_name = get_feature("slot");
193         if (pcb_name)
194            m_type = apf_get_pcb_id(pcb_name);
195
196         if (get_software_region("ram"))
197            m_cart->ram_alloc(get_software_region_length("ram"));
198      }
199
200      printf("Type: %s\n", apf_get_slot(m_type));
201
202      return IMAGE_INIT_PASS;
203   }
204
205   return IMAGE_INIT_PASS;
206}
207
208
209/*-------------------------------------------------
210 call softlist load
211 -------------------------------------------------*/
212
213bool apf_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
214{
215   load_software_part_region(*this, swlist, swname, start_entry);
216   return TRUE;
217}
218
219
220/*-------------------------------------------------
221 get default card software
222 -------------------------------------------------*/
223
224void apf_cart_slot_device::get_default_card_software(astring &result)
225{
226   if (open_image_file(mconfig().options()))
227   {
228      const char *slot_string = "std";
229      UINT32 size = core_fsize(m_file);
230      int type = APF_STD;
231
232      // attempt to identify Space Destroyer, which needs 1K of additional RAM
233      if (size == 0x1800)
234         type = APF_SPACEDST;
235      if (size > 0x2000)
236         type = APF_BASIC;
237
238      slot_string = apf_get_slot(type);
239
240      //printf("type: %s\n", slot_string);
241      clear();
242
243      result.cpy(slot_string);
244      return;
245   }
246
247   software_get_default_slot(result, "std");
248}
249
250/*-------------------------------------------------
251 read
252 -------------------------------------------------*/
253
254READ8_MEMBER(apf_cart_slot_device::read_rom)
255{
256   if (m_cart)
257      return m_cart->read_rom(space, offset);
258   else
259      return 0xff;
260}
261
262/*-------------------------------------------------
263 read
264 -------------------------------------------------*/
265
266READ8_MEMBER(apf_cart_slot_device::extra_rom)
267{
268   if (m_cart)
269      return m_cart->extra_rom(space, offset);
270   else
271      return 0xff;
272}
273
274/*-------------------------------------------------
275 read
276 -------------------------------------------------*/
277
278READ8_MEMBER(apf_cart_slot_device::read_ram)
279{
280   if (m_cart)
281      return m_cart->read_ram(space, offset);
282   else
283      return 0xff;
284}
285
286/*-------------------------------------------------
287 write
288 -------------------------------------------------*/
289
290WRITE8_MEMBER(apf_cart_slot_device::write_ram)
291{
292   if (m_cart)
293      m_cart->write_ram(space, offset, data);
294}
295
296
Property changes on: trunk/src/emu/bus/apf/slot.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/apf/rom.h
r0r32493
1#ifndef __APF_ROM_H
2#define __APF_ROM_H
3
4#include "slot.h"
5
6
7// ======================> apf_rom_device
8
9class apf_rom_device : public device_t,
10                  public device_apf_cart_interface
11{
12public:
13   // construction/destruction
14   apf_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
15   apf_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   virtual void device_reset() {}
20
21   // reading and writing
22   virtual DECLARE_READ8_MEMBER(read_rom);
23};
24
25// ======================> apf_basic_device
26
27class apf_basic_device : public apf_rom_device
28{
29public:
30   // construction/destruction
31   apf_basic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33   // reading and writing
34   virtual DECLARE_READ8_MEMBER(extra_rom);
35};
36
37// ======================> apf_spacedst_device
38
39class apf_spacedst_device : public apf_rom_device
40{
41public:
42   // construction/destruction
43   apf_spacedst_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
44   
45   // reading and writing
46   virtual DECLARE_READ8_MEMBER(read_ram);
47   virtual DECLARE_WRITE8_MEMBER(write_ram);
48};
49
50
51
52
53
54// device type definition
55extern const device_type APF_ROM_STD;
56extern const device_type APF_ROM_BASIC;
57extern const device_type APF_ROM_SPACEDST;
58
59
60#endif
Property changes on: trunk/src/emu/bus/apf/rom.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/includes/channelf.h
r32492r32493
99
1010#include "emu.h"
1111#include "cpu/f8/f8.h"
12#include "imagedev/cartslot.h"
1312#include "audio/channelf.h"
1413
14#include "bus/chanf/slot.h"
15#include "bus/chanf/rom.h"
1516
16/* SKR - 2102 RAM chip on carts 10 and 18 I/O ports */
17struct r2102_t
18{
19   UINT8 d;            /* data bit:inverted logic, but reading/writing cancel out */
20   UINT8 r_w;          /* inverted logic: 0 means read, 1 means write */
21   UINT8 a[10];        /* addr bits: inverted logic, but reading/writing cancel out */
22   UINT16 addr;        /* calculated addr from addr bits */
23   UINT8 ram[1024];    /* RAM array */
24};
2517
26
2718class channelf_state : public driver_device
2819{
2920public:
3021   channelf_state(const machine_config &mconfig, device_type type, const char *tag)
3122      : driver_device(mconfig, type, tag),
32         m_custom(*this,"custom")    ,
33      m_maincpu(*this, "maincpu") { }
23         m_maincpu(*this, "maincpu"),
24         m_custom(*this,"custom"),
25         m_cart(*this, "cartslot")
26   { }
3427
35   DECLARE_READ8_MEMBER(channelf_port_0_r);
36   DECLARE_READ8_MEMBER(channelf_port_1_r);
37   DECLARE_READ8_MEMBER(channelf_port_4_r);
38   DECLARE_READ8_MEMBER(channelf_port_5_r);
39   DECLARE_READ8_MEMBER(channelf_2102A_r);
40   DECLARE_READ8_MEMBER(channelf_2102B_r);
41   DECLARE_WRITE8_MEMBER(channelf_port_0_w);
42   DECLARE_WRITE8_MEMBER(channelf_port_1_w);
43   DECLARE_WRITE8_MEMBER(channelf_port_4_w);
44   DECLARE_WRITE8_MEMBER(channelf_port_5_w);
45   DECLARE_WRITE8_MEMBER(channelf_2102A_w);
46   DECLARE_WRITE8_MEMBER(channelf_2102B_w);
28   DECLARE_READ8_MEMBER(port_0_r);
29   DECLARE_READ8_MEMBER(port_1_r);
30   DECLARE_READ8_MEMBER(port_4_r);
31   DECLARE_READ8_MEMBER(port_5_r);
32   DECLARE_WRITE8_MEMBER(port_0_w);
33   DECLARE_WRITE8_MEMBER(port_1_w);
34   DECLARE_WRITE8_MEMBER(port_4_w);
35   DECLARE_WRITE8_MEMBER(port_5_w);
4736   UINT8 *m_p_videoram;
4837   UINT8 m_latch[6];
49   r2102_t m_r2102;
5038   UINT8 m_val_reg;
5139   UINT8 m_row_reg;
5240   UINT8 m_col_reg;
5341   UINT8 port_read_with_latch(UINT8 ext, UINT8 latch_state);
5442   virtual void video_start();
43   virtual void machine_start();
5544   DECLARE_PALETTE_INIT(channelf);
5645   UINT32 screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
57   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( channelf_cart );
58   required_device<channelf_sound_device> m_custom;
5946   required_device<cpu_device> m_maincpu;
47   required_device<channelf_sound_device> m_custom;
48   required_device<channelf_cart_slot_device> m_cart;
6049   int recalc_palette_offset(int reg1, int reg2);
6150};
6251
trunk/src/mess/drivers/apf.c
r32492r32493
7676#include "machine/6821pia.h"
7777#include "machine/wd_fdc.h"
7878#include "imagedev/cassette.h"
79#include "imagedev/cartslot.h"
8079#include "formats/apf_apt.h"
8180#include "machine/ram.h"
8281
82#include "bus/apf/slot.h"
83#include "bus/apf/rom.h"
8384
85
8486class apf_state : public driver_device
8587{
8688public:
8789   apf_state(const machine_config &mconfig, device_type type, const char *tag)
8890      : driver_device(mconfig, type, tag)
8991      , m_has_cart_ram(false)
90      , m_p_videoram(*this, "videoram")
9192      , m_maincpu(*this, "maincpu")
9293      , m_ram(*this, RAM_TAG)
9394      , m_crtc(*this, "mc6847")
r32492r32493
9596      , m_pia0(*this, "pia0")
9697      , m_pia1(*this, "pia1")
9798      , m_cass(*this, "cassette")
99      , m_cart(*this, "cartslot")
98100      , m_fdc(*this, "fdc")
99101      , m_floppy0(*this, "fdc:0")
100102      , m_floppy1(*this, "fdc:1")
103      , m_joy(*this, "joy")
104      , m_key(*this, "key")
105      , m_p_videoram(*this, "videoram")
101106   { }
102107
103108   DECLARE_READ8_MEMBER(videoram_r);
r32492r32493
110115   DECLARE_WRITE8_MEMBER(apf_dischw_w);
111116   DECLARE_READ8_MEMBER(serial_r);
112117   DECLARE_WRITE8_MEMBER(serial_w);
113   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(apf_cart);
118
114119private:
115120   UINT8 m_latch;
116121   UINT8 m_keyboard_data;
r32492r32493
118123   UINT8 m_portb;
119124   bool m_ca2;
120125   bool m_has_cart_ram;
126   virtual void machine_start();
121127   virtual void machine_reset();
122   required_shared_ptr<UINT8> m_p_videoram;
123128   required_device<m6800_cpu_device> m_maincpu;
124129   required_device<ram_device> m_ram;
125130   required_device<mc6847_base_device> m_crtc;
r32492r32493
127132   required_device<pia6821_device> m_pia0;
128133   optional_device<pia6821_device> m_pia1;
129134   optional_device<cassette_image_device> m_cass;
135   required_device<apf_cart_slot_device> m_cart;
130136   optional_device<fd1771_t> m_fdc;
131137   optional_device<floppy_connector> m_floppy0;
132138   optional_device<floppy_connector> m_floppy1;
133   dynamic_buffer m_cart_ram;
139   required_ioport_array<4> m_joy;
140   optional_ioport_array<8> m_key;
141   required_shared_ptr<UINT8> m_p_videoram;
134142};
135143
136144
r32492r32493
169177{
170178   UINT8 data = 0xff;
171179
172   if (!BIT(m_pad_data, 3))
173      data &= ioport("joy3")->read();
174   if (!BIT(m_pad_data, 2))
175      data &= ioport("joy2")->read();
176   if (!BIT(m_pad_data, 1))
177      data &= ioport("joy1")->read();
178   if (!BIT(m_pad_data, 0))
179      data &= ioport("joy0")->read();
180   for (int i = 3; i >= 0; i--)
181      if (!BIT(m_pad_data, i))
182         data &= m_joy[i]->read();
180183
181184   return data;
182185}
r32492r32493
198201
199202READ8_MEMBER( apf_state::pia1_porta_r )
200203{
201   static const char *const keynames[] = { "key0", "key1", "key2", "key3", "key4", "key5", "key6", "key7" };
202   return ioport(keynames[m_keyboard_data])->read();
204   return m_key[m_keyboard_data]->read();
203205}
204206
205207READ8_MEMBER( apf_state::pia1_portb_r )
r32492r32493
231233      m_cass->output(BIT(data, 6) ? -1.0 : 1.0);
232234}
233235
236
237void apf_state::machine_start()
238{
239   if (m_cart->exists())
240   {
241      switch (m_cart->get_type())
242      {
243         case APF_BASIC:
244            m_maincpu->space(AS_PROGRAM).install_read_handler(0x6800, 0x7fff, read8_delegate(FUNC(apf_cart_slot_device::extra_rom),(apf_cart_slot_device*)m_cart));
245            break;
246         case APF_SPACEDST:
247            m_maincpu->space(AS_PROGRAM).unmap_readwrite(0x9800, 0x9fff);
248            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x9800, 0x9bff, read8_delegate(FUNC(apf_cart_slot_device::read_ram),(apf_cart_slot_device*)m_cart), write8_delegate(FUNC(apf_cart_slot_device::write_ram),(apf_cart_slot_device*)m_cart));
249            m_has_cart_ram = true;
250            break;
251      }
252     
253      m_cart->save_ram();
254   }
255}
256
257
234258void apf_state::machine_reset()
235259{
236260   address_space &space = m_maincpu->space(AS_PROGRAM);
r32492r32493
248272      else
249273         space.write_byte(0xa002, 0xe5);
250274   }
251
252   /* Space Destroyer has 1K of on-cart RAM */
253   if (m_has_cart_ram)
254   {
255      space.unmap_readwrite(0x9800, 0x9fff);
256      space.install_ram(0x9800, 0x9bff, m_cart_ram);
257   }
258275}
259276
260277WRITE8_MEMBER( apf_state::apf_dischw_w)
r32492r32493
290307}
291308
292309static ADDRESS_MAP_START( apfm1000_map, AS_PROGRAM, 8, apf_state )
293   AM_RANGE( 0x0000, 0x03ff) AM_MIRROR(0x1c00) AM_RAM AM_SHARE("videoram")
294   AM_RANGE( 0x2000, 0x3fff) AM_MIRROR(0x1ffc) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
295   AM_RANGE( 0x4000, 0x4fff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0)
296   AM_RANGE( 0x6800, 0x7fff) AM_ROM AM_REGION("cart", 0x2000)
297   AM_RANGE( 0x8000, 0x9fff) AM_ROM AM_REGION("cart", 0)
298   AM_RANGE( 0xe000, 0xefff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0)
310   AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x1c00) AM_RAM AM_SHARE("videoram")
311   AM_RANGE(0x2000, 0x3fff) AM_MIRROR(0x1ffc) AM_DEVREADWRITE("pia0", pia6821_device, read, write)
312   AM_RANGE(0x4000, 0x4fff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0)
313   AM_RANGE(0x6800, 0x7fff) AM_NOP   // BASIC accesses ROM here too, but this is installed at machine_start
314   AM_RANGE(0x8000, 0x9fff) AM_DEVREAD("cartslot", apf_cart_slot_device, read_rom)
315   AM_RANGE(0xe000, 0xefff) AM_MIRROR(0x1000) AM_ROM AM_REGION("roms", 0)
299316ADDRESS_MAP_END
300317
301318static ADDRESS_MAP_START( apfimag_map, AS_PROGRAM, 8, apf_state )
302319   AM_IMPORT_FROM(apfm1000_map)
303   AM_RANGE( 0x6000, 0x63ff) AM_MIRROR(0x03fc) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
320   AM_RANGE(0x6000, 0x63ff) AM_MIRROR(0x03fc) AM_DEVREADWRITE("pia1", pia6821_device, read, write)
304321   // These need to be confirmed, disk does not work
305   AM_RANGE( 0x6400, 0x64ff) AM_READWRITE(serial_r, serial_w)
306   AM_RANGE( 0x6500, 0x6503) AM_DEVREADWRITE("fdc", fd1771_t, read, write)
307   AM_RANGE( 0x6600, 0x6600) AM_WRITE(apf_dischw_w)
308   AM_RANGE( 0xa000, 0xbfff) AM_RAM // standard
309   AM_RANGE( 0xc000, 0xdfff) AM_RAM // expansion
322   AM_RANGE(0x6400, 0x64ff) AM_READWRITE(serial_r, serial_w)
323   AM_RANGE(0x6500, 0x6503) AM_DEVREADWRITE("fdc", fd1771_t, read, write)
324   AM_RANGE(0x6600, 0x6600) AM_WRITE(apf_dischw_w)
325   AM_RANGE(0xa000, 0xbfff) AM_RAM // standard
326   AM_RANGE(0xc000, 0xdfff) AM_RAM // expansion
310327ADDRESS_MAP_END
311328
312329
r32492r32493
352369  ? player right is player 1
353370*/
354371
355   /* line 0 */
356   PORT_START("joy0")
372   PORT_START("joy.0")
357373   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 1") PORT_CODE(KEYCODE_1) PORT_PLAYER(2)
358374   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 0") PORT_CODE(KEYCODE_0) PORT_PLAYER(2)
359375   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 4") PORT_CODE(KEYCODE_4) PORT_PLAYER(2)
r32492r32493
363379   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 4") PORT_CODE(KEYCODE_4_PAD) PORT_PLAYER(1)
364380   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 7") PORT_CODE(KEYCODE_7_PAD) PORT_PLAYER(1)
365381
366   /* line 1 */
367   PORT_START("joy1")
382   PORT_START("joy.1")
368383   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("PAD 1/RIGHT down") PORT_PLAYER(2) PORT_8WAY
369384   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("PAD 1/RIGHT right") PORT_PLAYER(2) PORT_8WAY
370385   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("PAD 1/RIGHT up") PORT_PLAYER(2) PORT_8WAY
r32492r32493
374389   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("PAD 2/LEFT up") PORT_PLAYER(1) PORT_8WAY
375390   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("PAD 2/LEFT left") PORT_PLAYER(1) PORT_8WAY
376391
377   /* line 2 */
378   PORT_START("joy2")
392   PORT_START("joy.2")
379393   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 3") PORT_CODE(KEYCODE_3) PORT_PLAYER(2)
380394   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT clear") PORT_CODE(KEYCODE_DEL) PORT_PLAYER(2)
381395   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 6") PORT_CODE(KEYCODE_6) PORT_PLAYER(2)
r32492r32493
385399   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 6") PORT_CODE(KEYCODE_6_PAD) PORT_PLAYER(1)
386400   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 2/LEFT 9") PORT_CODE(KEYCODE_9_PAD) PORT_PLAYER(1)
387401
388   /* line 3 */
389   PORT_START("joy3")
402   PORT_START("joy.3")
390403   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 2") PORT_CODE(KEYCODE_2) PORT_PLAYER(2)
391404   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT enter/fire") PORT_CODE(KEYCODE_ENTER) PORT_PLAYER(2)
392405   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("PAD 1/RIGHT 5") PORT_CODE(KEYCODE_5) PORT_PLAYER(2)
r32492r32493
404417
405418   /* Reference: http://www.nausicaa.net/~lgreenf/apfpage2.htm */
406419
407   /* keyboard line 0 */
408   PORT_START("key0")
420   PORT_START("key.0")
409421   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X")               PORT_CODE(KEYCODE_X)          PORT_CHAR('X')
410422   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z")               PORT_CODE(KEYCODE_Z)          PORT_CHAR('Z')
411423   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q       IF")      PORT_CODE(KEYCODE_Q)          PORT_CHAR('Q')
r32492r32493
415427   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("W       STEP")    PORT_CODE(KEYCODE_W)          PORT_CHAR('W')
416428   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("S")               PORT_CODE(KEYCODE_S)          PORT_CHAR('S')
417429
418   /* keyboard line 1 */
419   PORT_START("key1")
430   PORT_START("key.1")
420431   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C")               PORT_CODE(KEYCODE_C)          PORT_CHAR('C')
421432   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V")               PORT_CODE(KEYCODE_V)          PORT_CHAR('V')
422433   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R       READ")    PORT_CODE(KEYCODE_R)          PORT_CHAR('R')
r32492r32493
426437   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E       STOP")    PORT_CODE(KEYCODE_E)          PORT_CHAR('E')
427438   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D")               PORT_CODE(KEYCODE_D)          PORT_CHAR('D')
428439
429   /* keyboard line 2 */
430   PORT_START("key2")
440   PORT_START("key.2")
431441   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N   ^")           PORT_CODE(KEYCODE_N)          PORT_CHAR('N') PORT_CHAR('^')
432442   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B")               PORT_CODE(KEYCODE_B)          PORT_CHAR('B')
433443   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("T       NEXT")    PORT_CODE(KEYCODE_T)          PORT_CHAR('T')
r32492r32493
437447   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y       PRINT")   PORT_CODE(KEYCODE_Y)          PORT_CHAR('Y')
438448   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("H")               PORT_CODE(KEYCODE_H)          PORT_CHAR('H')
439449
440   /* keyboard line 3 */
441   PORT_START("key3")
450   PORT_START("key.3")
442451   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M   ]")           PORT_CODE(KEYCODE_M)          PORT_CHAR('M') PORT_CHAR(']')
443452   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",   <")           PORT_CODE(KEYCODE_COMMA)      PORT_CHAR(',') PORT_CHAR('<')
444453   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("I       LIST")    PORT_CODE(KEYCODE_I)          PORT_CHAR('I')
r32492r32493
448457   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U       END")     PORT_CODE(KEYCODE_U)          PORT_CHAR('U')
449458   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("J")               PORT_CODE(KEYCODE_J)          PORT_CHAR('J')
450459
451   /* keyboard line 4 */
452   PORT_START("key4")
460   PORT_START("key.4")
453461   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/   ?")           PORT_CODE(KEYCODE_SLASH)      PORT_CHAR('/') PORT_CHAR('?')
454462   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".   >")           PORT_CODE(KEYCODE_STOP)       PORT_CHAR('.') PORT_CHAR('>')
455463   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O   _   REM")     PORT_CODE(KEYCODE_O)          PORT_CHAR('O') PORT_CHAR('_')
r32492r32493
459467   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P   @   USING")   PORT_CODE(KEYCODE_P)          PORT_CHAR('P') PORT_CHAR('@')
460468   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(";   +")           PORT_CODE(KEYCODE_COLON)      PORT_CHAR(';') PORT_CHAR('+')
461469
462   /* keyboard line 5 */
463   PORT_START("key5")
470   PORT_START("key.5")
464471   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space")           PORT_CODE(KEYCODE_SPACE)      PORT_CHAR(32)
465472   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":   *")           PORT_CODE(KEYCODE_MINUS)      PORT_CHAR(':') PORT_CHAR('*')
466473   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return")          PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(13)
r32492r32493
470477   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line Feed")       PORT_CODE(KEYCODE_OPENBRACE)  PORT_CHAR(10)
471478   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rubout")          PORT_CODE(KEYCODE_QUOTE)      PORT_CHAR(8)
472479
473   /* line 6 */
474   PORT_START("key6")
480   PORT_START("key.6")
475481   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift")     PORT_CODE(KEYCODE_RSHIFT) PORT_CODE(KEYCODE_LSHIFT)     PORT_CHAR(UCHAR_SHIFT_1)
476482   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc")             PORT_CODE(KEYCODE_TAB)        PORT_CHAR(27)
477483   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl")            PORT_CODE(KEYCODE_LCONTROL)   PORT_CHAR(UCHAR_SHIFT_2)
r32492r32493
481487   PORT_BIT(0x40, 0x40, IPT_UNUSED) // another X
482488   PORT_BIT(0x80, 0x80, IPT_UNUSED) // another Z
483489
484   /* line 7 */
485   PORT_START("key7")
490   PORT_START("key.7")
486491   PORT_BIT(0xff, 0xff, IPT_UNUSED)
487492INPUT_PORTS_END
488493
489494
490DEVICE_IMAGE_LOAD_MEMBER( apf_state, apf_cart )
491{
492   UINT8 *ROM = memregion("cart")->base();
493   UINT32 cart_size;
494
495   if (image.software_entry() == NULL)
496   {
497      cart_size = image.length();
498      if (cart_size > 0x3800)
499      {
500         logerror("%s extends beyond the expected size for an APF cart.\n", image.filename());
501         return IMAGE_INIT_FAIL;
502      }
503
504      image.fread(ROM, cart_size);
505
506      // attempt to identify Space Destroyer, which needs 1K of additional RAM
507      if (cart_size == 0x1800)
508      {
509         m_has_cart_ram = true;
510         m_cart_ram.resize(0x400);
511      }
512   }
513   else
514   {
515      cart_size = image.get_software_region_length("rom");
516      if (cart_size > 0x3800)
517      {
518         logerror("%s extends beyond the expected size for an APF cart.\n", image.filename());
519         return IMAGE_INIT_FAIL;
520      }
521
522      memcpy(ROM, image.get_software_region("rom"), cart_size);
523
524      if (image.get_software_region("ram"))
525      {
526         m_has_cart_ram = true;
527         m_cart_ram.resize(image.get_software_region_length("ram"));
528      }
529   }
530
531   return IMAGE_INIT_PASS;
532}
533
534495static SLOT_INTERFACE_START( apf_floppies )
535496   SLOT_INTERFACE( "525dd", FLOPPY_525_SSDD )
536497SLOT_INTERFACE_END
r32492r32493
553514};
554515#endif
555516
517static SLOT_INTERFACE_START(apf_cart)
518   SLOT_INTERFACE_INTERNAL("std",       APF_ROM_STD)
519   SLOT_INTERFACE_INTERNAL("basic",     APF_ROM_BASIC)
520   SLOT_INTERFACE_INTERNAL("spacedst",  APF_ROM_SPACEDST)
521SLOT_INTERFACE_END
522
523
556524static MACHINE_CONFIG_START( apfm1000, apf_state )
557525
558526   /* basic machine hardware */
r32492r32493
588556   MCFG_RAM_DEFAULT_SIZE("8K")
589557   MCFG_RAM_EXTRA_OPTIONS("16K")
590558
591   MCFG_CARTSLOT_ADD("cart")
592   MCFG_CARTSLOT_INTERFACE("apfm1000_cart")
593   MCFG_CARTSLOT_LOAD(apf_state, apf_cart)
559   MCFG_APF_CARTRIDGE_ADD("cartslot", apf_cart, NULL)
594560
595561   /* software lists */
596562   MCFG_SOFTWARE_LIST_ADD("cart_list","apfm1000")
r32492r32493
635601
636602   ROM_SYSTEM_BIOS( 2, "mod", "Mod Bios" ) // (c) 1982 W.Lunquist - In Basic, CALL 18450 to get a machine-language monitor
637603   ROMX_LOAD("mod_bios.bin", 0x0000, 0x1000, CRC(f320aba6) SHA1(9442349fca8b001a5765e2fe8b84db4ece7886c1), ROM_BIOS(3) )
638
639   ROM_REGION(0x3800,"cart", ROMREGION_ERASEFF)
640604ROM_END
641605
642606#define rom_apfimag rom_apfm1000
trunk/src/mess/drivers/channelf.c
r32492r32493
88 *
99 *  Fredric "e5frog" Blaoholtz, added support large cartridges
1010 *    also spanning from $3000 to $FFFF. Added clones
11 *  Fabio "etabeta" Priuli, moved carts to be slot devices
1112 *
1213 ******************************************************************/
1314
r32492r32493
4647   return (~ext | latch_state);
4748}
4849
49READ8_MEMBER( channelf_state::channelf_port_0_r )
50READ8_MEMBER( channelf_state::port_0_r )
5051{
5152   return port_read_with_latch(ioport("PANEL")->read(), m_latch[0]);
5253}
5354
54READ8_MEMBER( channelf_state::channelf_port_1_r )
55READ8_MEMBER( channelf_state::port_1_r )
5556{
5657   UINT8 ext_value;
5758
r32492r32493
6364   return port_read_with_latch(ext_value,m_latch[1]);
6465}
6566
66READ8_MEMBER( channelf_state::channelf_port_4_r )
67READ8_MEMBER( channelf_state::port_4_r )
6768{
6869   UINT8 ext_value;
6970
r32492r32493
7576   return port_read_with_latch(ext_value,m_latch[2]);
7677}
7778
78READ8_MEMBER( channelf_state::channelf_port_5_r )
79READ8_MEMBER( channelf_state::port_5_r )
7980{
8081   return port_read_with_latch(0xff, m_latch[3]);
8182}
8283
83READ8_MEMBER( channelf_state::channelf_2102A_r )    /* SKR */
84WRITE8_MEMBER( channelf_state::port_0_w )
8485{
85   UINT8 pdata;
86
87   if (m_r2102.r_w==0)
88   {
89      m_r2102.addr=(m_r2102.a[0]&1)+((m_r2102.a[1]<<1)&2)+((m_r2102.a[2]<<2)&4)+((m_r2102.a[3]<<3)&8)+((m_r2102.a[4]<<4)&16)+((m_r2102.a[5]<<5)&32)+((m_r2102.a[6]<<6)&64)+((m_r2102.a[7]<<7)&128)+((m_r2102.a[8]<<8)&256)+((m_r2102.a[9]<<9)&512);
90      m_r2102.d=m_r2102.ram[m_r2102.addr]&1;
91      pdata=m_latch[4]&0x7f;
92      pdata|=(m_r2102.d<<7);
93      LOG(("rhA: addr=%d, d=%d, r_w=%d, ram[%d]=%d,  a[9]=%d, a[8]=%d, a[7]=%d, a[6]=%d, a[5]=%d, a[4]=%d, a[3]=%d, a[2]=%d, a[1]=%d, a[0]=%d\n",m_r2102.addr,m_r2102.d,m_r2102.r_w,m_r2102.addr,m_r2102.ram[m_r2102.addr],m_r2102.a[9],m_r2102.a[8],m_r2102.a[7],m_r2102.a[6],m_r2102.a[5],m_r2102.a[4],m_r2102.a[3],m_r2102.a[2],m_r2102.a[1],m_r2102.a[0]));
94      return port_read_with_latch(0xff,pdata);
95   }
96   else
97      LOG(("rhA: r_w=%d\n",m_r2102.r_w));
98
99   return port_read_with_latch(0xff, m_latch[4]);
100}
101
102READ8_MEMBER( channelf_state::channelf_2102B_r )  /* SKR */
103{
104   LOG(("rhB\n"));
105   return port_read_with_latch(0xff, m_latch[5]);
106}
107
108WRITE8_MEMBER( channelf_state::channelf_port_0_w )
109{
11086   int offs;
11187
11288   m_latch[0] = data;
r32492r32493
11894   }
11995}
12096
121WRITE8_MEMBER( channelf_state::channelf_port_1_w )
97WRITE8_MEMBER( channelf_state::port_1_w )
12298{
12399   m_latch[1] = data;
124100   m_val_reg = ((data ^ 0xff) >> 6) & 0x03;
125101}
126102
127WRITE8_MEMBER( channelf_state::channelf_port_4_w )
103WRITE8_MEMBER( channelf_state::port_4_w )
128104{
129105   m_latch[2] = data;
130106   m_col_reg = (data | 0x80) ^ 0xff;
131107}
132108
133WRITE8_MEMBER( channelf_state::channelf_port_5_w )
109WRITE8_MEMBER( channelf_state::port_5_w )
134110{
135111   m_latch[3] = data;
136112   m_custom->sound_w((data>>6)&3);
137113   m_row_reg = (data | 0xc0) ^ 0xff;
138114}
139115
140WRITE8_MEMBER( channelf_state::channelf_2102A_w )  /* SKR */
141{
142   m_latch[4]=data;
143   m_r2102.a[2]=(data>>2)&1;
144   m_r2102.a[3]=(data>>1)&1;
145   m_r2102.r_w=data&1;
146   m_r2102.addr=(m_r2102.a[0]&1)+((m_r2102.a[1]<<1)&2)+((m_r2102.a[2]<<2)&4)+((m_r2102.a[3]<<3)&8)+((m_r2102.a[4]<<4)&16)+((m_r2102.a[5]<<5)&32)+((m_r2102.a[6]<<6)&64)+((m_r2102.a[7]<<7)&128)+((m_r2102.a[8]<<8)&256)+((m_r2102.a[9]<<9)&512);
147   m_r2102.d=(data>>3)&1;
148   if(m_r2102.r_w==1)
149      m_r2102.ram[m_r2102.addr]=m_r2102.d;
150   LOG(("whA: data=%d, addr=%d, d=%d, r_w=%d, ram[%d]=%d\n",data,m_r2102.addr,m_r2102.d,m_r2102.r_w,m_r2102.addr,m_r2102.ram[m_r2102.addr]));
151}
152
153WRITE8_MEMBER( channelf_state::channelf_2102B_w )  /* SKR */
154{
155   m_latch[5]=data;
156   m_r2102.a[9]=(data>>7)&1;
157   m_r2102.a[8]=(data>>6)&1;
158   m_r2102.a[7]=(data>>5)&1;
159   m_r2102.a[1]=(data>>4)&1;
160   m_r2102.a[6]=(data>>3)&1;
161   m_r2102.a[5]=(data>>2)&1;
162   m_r2102.a[4]=(data>>1)&1;
163   m_r2102.a[0]=data&1;
164   LOG(("whB: data=%d, a[9]=%d,a[8]=%d,a[0]=%d\n",data,m_r2102.a[9],m_r2102.a[8],m_r2102.a[0]));
165}
166
167116static ADDRESS_MAP_START( channelf_map, AS_PROGRAM, 8, channelf_state )
168117   AM_RANGE(0x0000, 0x07ff) AM_ROM
169   AM_RANGE(0x0800, 0x27ff) AM_ROM /* Cartridge Data */
170   AM_RANGE(0x2800, 0x2fff) AM_RAM /* Schach RAM */
171   AM_RANGE(0x3000, 0xffff) AM_ROM /* Cartridge Data continued */
118   AM_RANGE(0x0800, 0xffff) AM_DEVREAD("cartslot", channelf_cart_slot_device, read_rom)
172119ADDRESS_MAP_END
173120
174121static ADDRESS_MAP_START( channelf_io, AS_IO, 8, channelf_state )
175   AM_RANGE(0x00, 0x00) AM_READWRITE(channelf_port_0_r, channelf_port_0_w) /* Front panel switches */
176   AM_RANGE(0x01, 0x01) AM_READWRITE(channelf_port_1_r, channelf_port_1_w) /* Right controller     */
177   AM_RANGE(0x04, 0x04) AM_READWRITE(channelf_port_4_r, channelf_port_4_w) /* Left controller      */
178   AM_RANGE(0x05, 0x05) AM_READWRITE(channelf_port_5_r, channelf_port_5_w)
179
180   AM_RANGE(0x20, 0x20) AM_READWRITE(channelf_2102A_r, channelf_2102A_w) /* SKR 2102 control and addr for cart 18 */
181   AM_RANGE(0x21, 0x21) AM_READWRITE(channelf_2102B_r, channelf_2102B_w) /* SKR 2102 addr */
182   AM_RANGE(0x24, 0x24) AM_READWRITE(channelf_2102A_r, channelf_2102A_w) /* SKR 2102 control and addr for cart 10 */
183   AM_RANGE(0x25, 0x25) AM_READWRITE(channelf_2102B_r, channelf_2102B_w) /* SKR 2102 addr */
122   AM_RANGE(0x00, 0x00) AM_READWRITE(port_0_r, port_0_w) /* Front panel switches */
123   AM_RANGE(0x01, 0x01) AM_READWRITE(port_1_r, port_1_w) /* Right controller     */
124   AM_RANGE(0x04, 0x04) AM_READWRITE(port_4_r, port_4_w) /* Left controller      */
125   AM_RANGE(0x05, 0x05) AM_READWRITE(port_5_r, port_5_w)
184126ADDRESS_MAP_END
185127
186128
187129
188130static INPUT_PORTS_START( channelf )
189   PORT_START("PANEL") /* Front panel buttons */
190   PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_START )    /* TIME  (1) */
191   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 )  /* HOLD  (2) */
192   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 )  /* MODE  (3) */
193   PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON7 )  /* START (4) */
194   PORT_BIT ( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
131   PORT_START("PANEL")
132   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("TIME (Button 1)") PORT_CODE(KEYCODE_1)
133   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("HOLD (Button 2)") PORT_CODE(KEYCODE_2)
134   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MODE (Button 3)") PORT_CODE(KEYCODE_3)
135   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("START (Button 4)") PORT_CODE(KEYCODE_4)
136   PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED)
195137
196   PORT_START("RIGHT_C") /* Right controller */
197   PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1)
198   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1)
199   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1)
200   PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1)
201   PORT_BIT ( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) /* C-CLOCKWISE */ PORT_PLAYER(1)
202   PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) /* CLOCKWISE   */ PORT_PLAYER(1)
203   PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) /* PULL UP     */ PORT_PLAYER(1)
204   PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) /* PUSH DOWN   */ PORT_PLAYER(1)
138   PORT_START("RIGHT_C")
139   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1)
140   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1)
141   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1)
142   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1)
143   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("P1 Twist Counterclockwise") PORT_PLAYER(1)
144   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("P1 Twist Clockwise")PORT_PLAYER(1)
145   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("P1 Pull Up") PORT_PLAYER(1)
146   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P1 Push Down") PORT_PLAYER(1)
205147
206   PORT_START("LEFT_C") /* Left controller */
207   PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2)
208   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2)
209   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2)
210   PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2)
211   PORT_BIT ( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) /* C-CLOCKWISE */ PORT_PLAYER(2)
212   PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) /* CLOCKWISE   */ PORT_PLAYER(2)
213   PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) /* PULL UP     */ PORT_PLAYER(2)
214   PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) /* PUSH DOWN   */ PORT_PLAYER(2)
148   PORT_START("LEFT_C")
149   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2)
150   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2)
151   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2)
152   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2)
153   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("P2 Twist Counterclockwise") PORT_PLAYER(2)
154   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("P2 Twist Clockwise")PORT_PLAYER(2)
155   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("P2 Pull Up") PORT_PLAYER(2)
156   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P2 Push Down") PORT_PLAYER(2)
215157INPUT_PORTS_END
216158
217159
218
219DEVICE_IMAGE_LOAD_MEMBER( channelf_state, channelf_cart )
160void channelf_state::machine_start()
220161{
221   UINT32 size;
222
223   if (image.software_entry() == NULL)
162   if (m_cart->exists())
224163   {
225      size = image.length();
226
227      if (size > 0xf800)
164      switch (m_cart->get_type())
228165      {
229         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
230         return IMAGE_INIT_FAIL;
166         case CF_MAZE:
167            m_maincpu->space(AS_IO).install_readwrite_handler(0x24, 0x25, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart));
168            break;
169         case CF_HANGMAN:
170            m_maincpu->space(AS_IO).install_readwrite_handler(0x20, 0x21, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart));
171            break;
172         case CF_CHESS:
173            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2800, 0x2fff, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart));
174            break;
175         case CF_MULTI:
176            m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2800, 0x2fff, read8_delegate(FUNC(channelf_cart_slot_device::read_ram),(channelf_cart_slot_device*)m_cart), write8_delegate(FUNC(channelf_cart_slot_device::write_ram),(channelf_cart_slot_device*)m_cart));
177            m_maincpu->space(AS_PROGRAM).install_write_handler(0x3000, 0x3fff, write8_delegate(FUNC(channelf_cart_slot_device::write_bank),(channelf_cart_slot_device*)m_cart));
178            break;
231179      }
232
233      if (image.fread( memregion("maincpu")->base() + 0x0800, size) != size)
234      {
235         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file");
236         return IMAGE_INIT_FAIL;
237      }
238
180     
181      m_cart->save_ram();
239182   }
240   else
241   {
242      size = image.get_software_region_length("rom");
243      memcpy(memregion("maincpu")->base() + 0x0800, image.get_software_region("rom"), size);
244   }
245
246   return IMAGE_INIT_PASS;
247183}
248184
185static SLOT_INTERFACE_START(cf_cart)
186   SLOT_INTERFACE_INTERNAL("std",      CHANF_ROM_STD)
187   SLOT_INTERFACE_INTERNAL("maze",     CHANF_ROM_MAZE)
188   SLOT_INTERFACE_INTERNAL("hangman",  CHANF_ROM_HANGMAN)
189   SLOT_INTERFACE_INTERNAL("chess",    CHANF_ROM_CHESS)
190   SLOT_INTERFACE_INTERNAL("multi",    CHANF_ROM_MULTI)
191SLOT_INTERFACE_END
192
193
249194static MACHINE_CONFIG_FRAGMENT( channelf_cart )
250195   /* cartridge */
251   MCFG_CARTSLOT_ADD("cart")
252   MCFG_CARTSLOT_EXTENSION_LIST("bin,chf")
253   MCFG_CARTSLOT_INTERFACE("channelf_cart")
254   MCFG_CARTSLOT_LOAD(channelf_state,channelf_cart)
196   MCFG_CHANNELF_CARTRIDGE_ADD("cartslot", cf_cart, NULL)
255197
256198   /* Software lists */
257199   MCFG_SOFTWARE_LIST_ADD("cart_list","channelf")
trunk/src/mess/mess.mak
r32492r32493
568568BUSES += ABCKB
569569BUSES += ADAM
570570BUSES += ADAMNET
571BUSES += APF
571572BUSES += BML3
572573BUSES += BW2
573574BUSES += C64
574575BUSES += CBM2
575576BUSES += CBMIEC
576577BUSES += CENTRONICS
578BUSES += CHANNELF
577579BUSES += COCO
578580BUSES += COLECO
579581BUSES += COMPUCOLOR

Previous 199869 Revisions Next


© 1997-2024 The MAME Team